Tuesday, July 24, 2012

A basic example with Git


In this post, I shall talk about how to create a sample project on Github and start pushing files to your Github account from your machine. You will learn how to create and get started with an example project and start working on a full fledged social project.


  • Create a new repository on Github. In your computer, create a new folder (Eg. C:\Documents\My Projects\Sample)
  • Download and install Git and navigate to the directory in Git console and initialize git – git init
  • Create/add all the project files to the folder and use the command – git add .
  • Enter the command git commit –m “message” and hit enter.
  • Next, enter the command git remote add origin https://github.com/username/repo-name.git where the username is your username and repo-name is the name of the repository you created.
  • Enter git push and your project files are now pushed to the server.



Each time when you make changes to your project and push it to the server, repeat the following steps:


  • git add . 
  • git commit –m “message”
  • git push

That's it! You have learnt the basics of Git and all set to start social coding!


Basic Git commands


Github is an online service that hosts git projects and helps achieve social coding. Sign up for Github. After you have signed up and logged in, create a new repository. Once the repository has been created in Github, start the Git Bash/Terminal and navigate to a folder in your local machine where you want to store your project files.

  • You can use the Change Directory – cd and Make Directory – mkdir commands in both Git Bash and Terminal to navigate to the directory.

The initial setup requires an username and email that will be used to uniquely identify the user who has made changes to the project. 

  • Once you have navigated to the directory, initialize Git in that folder by using the command git init

Add all the necessary project files. To make Git track these files, you need to explicitly specify it using the Git Add command. 


  • To track all files, you can use the git add . command (notice the dot in the end).
  • Next, the files need to be committed to the local repository. The command is git commit –m “message”. The –m “message” requires a message every time you commit, to uniquely identify the versions and you need to specify it within quotes.

Now, the server location has to be known by Git to put the files on the server.

  • The command for this is : git remote add origin https://github.com/username/repo-name.git (where the username is your Github username and the repo-name is your repository name.)

The files now need to be sent or pushed to the server. This enables the server to maintain the latest version of the code every time.

  • The command to send the latest commit version to the server is git push

If the server has a newer version of the project, it will not allow a push until you have a newer version. So the push fails and Git asks you to do a pull before you can push.

  • The command for a pull from the server is git pull

You will now be able to push your commits to the server once you have a newer version.



Monday, July 23, 2012

Setting up Git

Setting up Git in Windows:

  • Login to Github account and create a new repository.
  • Download Git for Windows. The exe is available here.
  • After the installation is complete, run the Git Bash program in Windows.
Setting up Git in Linux:
  • Git can be set up on Ubuntu using the command “apt-get install git-core”
  • Start the terminal access and use the features of git.

The basics of Git

In short, Git can be summed up as the following:

  • Git is a version control system where multiple people can work on a same project and maintain the code at a central location.
  • It maintains all the previous versions of files in a smart way and we can recover the changes the made to any of the versions.
  • It is free for open sourced projects and we can use anyone’s code on Github and work on them.
    The set up process for Windows and Linux are different, but the commands are same for both Windows and Linux as well.
  • The code is stored in a local project directory and is periodically updated to the server as changes are made to the project.
  • Every time, the latest code is always on the server, and changes are always made to the latest version.
I shall explain more about Git and the basic commands in Git in the next post.

Wednesday, July 18, 2012

How to get rid of system tray in PhoneGap within Windows Phone

Visual Studio 2010 Express Edition creates a basic template for you in PhoneGap, but it does come with an inherent, irritating native system tray for Windows Phone applications. This is what I'm talking about:


 In your Visual Studio project, you can safely disable the system tray with one click so that it doesn't affect the look and feel of your application. You just need to set the SystemTray.IsVisible to "false". Select the system tray in your design area and look at the properties panel. I have illustrated it for better understanding:


Now,  take a look at the properties panel and un-check the SystemTray.IsVisible option: 


 Once you have un-checked the box, the System Tray disappears :) This can also be done by modifying the XAML and setting the same property to "False" all by yourself. Also, changing this in one page does not mean that it gets changed for all other pages. You need to manually edit and change them all.

Monday, July 16, 2012

PhoneGap Windows Phone test results

I have tested all the features of PhoneGap (Apache Cordova) on Windows Phone (on my HTC T8788, Surround) and I have gathered the following test results:


1. Start call, end call buttons not available on Windows Phone.
2. PhoneGap does not have access to Windows Phone battery APIs, even though they are available through the native C# development.
3. The play, pause, stop and record events report a JSON error.