Making WordPress comments form work with Bootstrap 3

While re-designing my WordPress blog template I came across the challenge of making the WordPress comments form play nicely with Bootstrap 3. Unlike the search form which is easily customized by simply adding a ‘searchform.php’ template file, the comments form is a little more complicated.

When making WordPress templates the comments area is modified by adding the ‘comments.php’ file. This however, is only the layout of the comments. The comments form itself is output by using the function:


'<?php comment_form( $args ); ?>'.

The output of this form can be modified using the arguments documented in the official documentation. However I found this handy article, that gives a brilliant and easy to understand breakdown of how to make the ‘comment_form()’ function output some Bootstrap 3 friendly code.

http://www.codecheese.com/2013/11/wordpress-comment-form-with-twitter-bootstrap-3-supports/

How to clone a GitHub project on Android Studio

You may have read/watched my previous tutorial How to use GitHub with Android Studio 1.x. This is a follow up tutorial which explains how to clone a project that has been added to GitHub. If you’re looking for more in-depth training, check out my ebook How to Use GitHub with Android Studio: A complete step-by-step guide to mastering the technology.

Click here to download an easy-to-follow PDF version of this post

Read more

How to remove a git remote

In the comments of my article How to use GitHub with Android Studio 1.x, Cynthia gets the following error:


can't add remote
fatal: remote origin already exists.
during execution git remote add origin

Read more

How to use GitHub with Android Studio 1.x

Previously, I wrote a post called How to use GitHub with Android Studio, which was based on the beta version of Android Studio. Since then, Android Studio has progressed past the Beta phase and is now officially the primary IDE for Android.

As I expected, they added GitHub support so you no longer have to follow the tutorial in my previous post to use GitHub with Android Studio.

If you’re looking for more in-depth training, check out my ebook How to Use GitHub with Android Studio: A complete step-by-step guide to mastering the technology.

Read more

Low cost backup solution for linux using Dropbox and a shell script

In this guide I will explain how to create a backup solution for your Linux server using a basic shell script and Dropbox. It’s good for text files but not so good for bigger media files such as audio and video.

It works as follows:

  • We install Dropbox on our server
  • Then we create a shell script that will copy all the directories you want to backup to a temp directory
  • An finally we compress that temp directory into our Dropbox folder and remove the temp files

I use this method to backup all my Git repositories, MySQL databases, project source code and my server configuration files. A free Dropbox account gives you 2GB of storage, which should be enough for some compressed text files as well as a couple of databases.

Read more

How to use GitHub with Android Studio

This article provides a basic overview of how to use GitHub with Android Studio. If you’re looking for more in-depth training, check out my ebook How to Use GitHub with Android Studio: A complete step-by-step guide to mastering the technology.

Click here to download an easy-to-follow PDF version of this post Read more

How to push to a remote Git repository over SSH with private/public key authentication using Android Studio

Android Studio is currently in Beta phase. However given that it is most likely to supercede Eclipse as the next Android IDE, I thought it would be a good idea to start using it now to develop my apps.

Like many software engineers, I use Git as my source control software. I have a set of Git repositories that I keep on a Digital Ocean cloud virtual machine. This serves as a central place to store my code as well as a backup in-case my hard disk fails or someone comes and steals my computer (knock on wood).

When I first started using Android Studio, it took me some time to figure out how to work from  a remote Git repository over SSH using private/public key authentication. As a result, I wrote this guide on how to do it.

At the time of writing this guide, I am using the following on my development machine:

Read more

What to do if Aptana Stuido 3 stops allowing you to commit to git?

I had the following problem:

I had been working on a project and wanted to commit my changes to git. When trying to commit (clicking Commands > Commit), it would let me type a message and add the files, however when I click Commit, the box closes but it doesn’t actually commit anything.

I was using Aptana Studio 3, build: 3.4.2.201308081805 on Windows 8.

It doesn’t display any error messages, however after some investigation I was able to resolve this issue. It turns out that git didn’t know my email address or name, which meant I couldn’t commit.

I resolved this by doing the following:

1. Exit Aptana Stuido and then use windows explorer and find the projects folder.

2. Right click the folder and select “Git Bash”.

3. Set my email address and name by typing the following:

git config --global user.email "email@address.com"
git config --global user.name "Firstname Lastname"

How to change the hostname of a Linux server

This post describes how to change a hostname on a Debian 7 Linux server, however it will work on most other Linux distributions too.

Switch to root

sudo -i

Change the /etc/hostname file

echo 'new.host.name' > /etc/hostname

Restart the hostname service

/etc/init.d/hostname.sh start

That’s it. The host name is now updated.

How to add an SSH public key to your Linux user account

Click here for the quick copy-paste option

Hi there, this is something that helps me out frequently so I wanted to share it with the community.

If you are at all security conscious, you will want to use public/private key authentication, instead of regular passwords, when authenticating to your servers.

This short guide will explain, quite simply, how to add your SSH private key to your server, so you can authenticate with your public key. This guide assumes you already have your public key to hand. I am using Debian 7, however it will work with many other popular distributions of Linux such as CentOS and Ubuntu.

1. Login to your server, and change to your home directory.


cd ~

2. Create a new folder called .ssh.


mkdir .ssh

3. Set the permissions on .ssh to 700.


chmod 700 .ssh

4. Change into that directory.


cd .ssh

5. Create a new file called authorized_keys.


touch authorized_keys

6. Set the permissions to 600 (many applications including OpenSSH will reject your key by default, if it’s accessible by other users).


chmod 600 authorized_keys

7. Open the file with a text editor (I use vi), and paste your keys in.


vi authorized_keys

That’s it. Now disable password authentication in SSH to improve the security of your box.

Thanks for reading.

Here are all the commands together in-case you are want a quick copy and paste job:


cd ~
mkdir .ssh
chmod 700 .ssh
cd .ssh
touch authorized_keys
chmod 600 authorized_keys
vi authorized_keys