Wednesday, August 7, 2013

How to set up git on an AWS EC2 Ubuntu instance & use SourceTree on Windows to connect to it.

This setup was done from a Windows 7 computer connecting to an Ubuntu 14.02 LTS EC2 instance.

Part 1: Connect to your Amazon EC2 Ubuntu instance and run the following commands to install git

1. Navigate to the home directory:
cd ~

2. Use apt-get to install git-core:
sudo apt-get -y install git-core

3. Set up the git user:
git config --global "John Smith"
git config --global

4. Make a directory for the git repository, navigate to it, and initialise it with --bare
mkdir test_repo.git
cd test_repo.git
git init --bare

Part 2: Clone your git repository locally to initialise it

1. Open Putty to SSH to your EC2 instance and "Allow Agent Forwarding" in the settings for the connection so that you can authenticate through a second ssh session (this is to perform the clone which will create a local repository on the EC2 machine). See image below (Connection --> SSH --> Auth)

2. Make a new directory for the git clone
cd ~
mkdir test_clone
cd test_clone

3. Initialise the git repository for the clone folder
git init
git remote add origin ssh://ubuntu@localhost/test_repo.git

Part 3: Setup the connection from SourceTree on your Windows computer

1. Add your private key to the Pageant tool in the task bar (it is installed with SourceTree)

2. In Source Tree click 'Clone/New' 

3. In the Source Path/URL enter a connection formatted similar to below: 

If all ok, the 'Repository Type' should say "This is a git repository". If not, try going to your test_repo.git folder and type "git status" to see if the repository is having any problems.
(i.e. type
cd ~/test_repo.git
git status)

4. Set the Destination Path to a folder on your local computer where you want your local git repository to be located. 

5. Click "Clone" when done.


Note: To be updated in future with more screenshots & better descriptions. 

Useful Links: (free private repo for up to 5 users - alternative to github which is only free if your repo is public). Not required for git, only if you want a third party to also host your repo. - Git Documentation

Thursday, July 26, 2012

How to add an HTML Editor for Eclipse

I started using Eclipse to work with PhoneGap(Cordova). However, editing HTML files in Eclipse was not nice - it felt similar to using Windows notepad.  I found the following information on stackoverflow about adding a HTML editor: 

This post details the instructions for adding Web Page Editor to your installation of Eclipse (if it wasn't installed with your version initially). It is really simple, but I've detailed it out anyway.

I'm using Eclipse Juno (SDK Version 4.2.0). It's probably a similar process in other versions. 

1. Go to Help --> Install New Software...

 2. Select the Juno repository ( from the 'Work with:' menu:

3. In the search box, enter 'web' to filter the results, and select 'Web Page Editor':

4. Click Next:

5. Accept the terms and click Finish:

6. Wait for the install to run:

7. You might see this - just click OK:

8. Click Yes when ready:

Now that you have finished installing this, and restarted, you might notice that none of the text in your existing html files has changed colour in the editor as you might expect. I wasn't sure how to adjust this, so thanks to balla85 for figuring this out for me. All you need to do is go to the Window --> Preferences menu as shown:

Then for both *.htm and *.html, click on the 'HTML Editor' in the window below and click the 'Default' and 'OK' to apply. The result should be similar to below:

Anyway that was pretty easy wasn't it? Now get working!

Thursday, March 15, 2012

How to install the NLTK package for Python 2.7 on Windows

These instructions describe how to install NLTK for Python 2.7 on Windows 7. I installed them using Win 7 Professional with SP1)

Note that for these instructions, I am using Python 2.7 (32-bit). There is a known bug (unresolved since 2009!!) with the installers for 64-bit version of Python, so I removed it and installed 32-bit Python instead. I also did not use Python 3.2 as there are limited packages that are compatible with it at this point in time (15th March 2012). This will most likely change in future, but for now it's 2.7.

These instructions assume you have already installed Python 2.7 (32-bit) and set the PATH variable to include 'C:\Python27\' (or wherever you installed Python).

Here are the steps.

1. The best way to install NLTK is using easy-install. This is part of the setuptools package ( Download this and install it. [My install used: setuptools-0.6c11.win32-py2.7.exe]

Be sure to set the path to the easy install directory (If you're like me you might have skipped through the instructions in the install windows, but read this part: "
Once installation is complete, you will find an ``easy_install.exe`` program in your Python ``Scripts`` subdirectory. Be sure to add this directory to your ``PATH`` environment variable, if you haven't already done so.")

2. Install NumPy. Download from: [My install used: numpy-1.6.1-win32-superpack-python2.7.exe]

3. Install PyYAML. Download from: . [My install used: PyYAML-3.10.win32-py2.7.exe]

4. Use easy-install to install NLTK. Just type something similar to the following to install: "
\Python27\lib\site-packages\ nltk".

5. Install all the corpora required using the following command: "python -m nltk.downloader -d D:\Python27\nltk_data all"

Note that I've used -d D:\Python27\nltk_data. You can exclude this if you just want to install it in the default directory C:\nltk_data. I just wanted to install it in the specified location.
Find more info here:

If any packages fail to install just press n on the retry option as shown:

[nltk_data] | Downloading package 'punkt' to
[nltk_data] | D:\Python27\nltk_data...
[nltk_data] | Unzipping tokenizers\
[nltk_data] | Error with downloaded zip file
Error installing package. Retry? [n/y/e]

And run the following at the python command line:

>>> import nltk
NLTK Downloader
d) Download l) List u) Update c) Config h) Help q) Quit
Downloader> d

Download which package (l=list; x=cancel)?
Identifier> punkt
Downloading package 'punkt' to D:\python27\nltk_data...
Unzipping tokenizers\

d) Download l) List u) Update c) Config h) Help q) Quit
Downloader> q

Good Luck!

Monday, September 19, 2011

How to add Public Holidays to your iPad Calendar

This is a useful guide:

As copied from their site:
1. In the Accounts section, touch “Add Account…”
2. Select “Other”
3. Under Calendars, tap “Add Subscribed Calendar”
4. Paste or type a calendar feed URL here. (More about where to get these in a moment!)
5. If you want US holidays, paste or type the following into the Server field:
6. Tap Next
7. If you have entered a valid calendar feed, you should see a display that shows a Description, and allows you to enter optional information. Just leave those as they are and touch “Save”
8. Now exit Settings and go to the Calendar App.
9. At the top left, tap “Calendars” and put a check mark next to the new calendar in the Subscribed section.
10. Voila! You have holidays!
Repeat these steps for any additional calendars you may want to add.

Instead of the US Public holidays:

Add Australian Public holidays using this link

Add NZ Public Holidays using this link