Tuesday, August 23, 2011

Introduction to GIT on Linux – Install, Create Project, Commit Files

The way GIT tracks and handles file changes is very efficient and different than how other version control software tracks the changes (including CVS and Subversion).
GIT is the most versatile distributed version control system.
This article is for those who are new to GIT. This is a jump-start guide that will show you how to install GIT from source, create a new project, commit changes to the GIT repository.

If you are from CVS/SVN background, you are used to the client-server model, where the repository is installed on a server, and you’ll use a client to download the project from the repository, make changes, and commit it to the repository in the server.
GIT doesn’t use the client-server model. When you download a project from a remote GIT repository, you download everything, including the version history and changes of the individual files, and your local GIT acts as a server, where you can do check-in, check-out, and all other typical version control activities. Later when you are ready, you can merge your changes to the remote GIT repository.
So, the installation and configuration steps are exactly the same whether you using GIT on your local machine, to manage your own project, or you are installing GIT on a server, from where other developers will download the project to their local GIT repositories.
If you are a developer, you might want to install GIT on your local machine for two reasons: 1) You like to manage your own project locally using a version control tool 2) You want to modify a code that is located in a remote central GIT repository.
If you are a sysadmin, you might want to install GIT on a server so that it acts as a central repository to hold all the source code for your company. From here, you can allow developers to download the projects to their local GIT repositories, make changes and they can check-in back to your central repository when they are done.
Irrespective of how you are planning to use GIT, the installation steps, and the basic commands mentioned below are exactly the same.

1. Download and Install GIT

First, download the GIT from here. Or, download it directly using wget as shown below.
cd
wget http://kernel.org/pub/software/scm/git/git-1.7.6.tar.bz2
Next, extract the downloaded file.
tar xvfj git-1.7.6.tar.bz2
cd git-1.7.6
Finally, install GIT as shown below using the default configure option. If you want to customize the installation, do “./configure –help” to view all available configuration options.
./configure

make

make install

2. Initial Configuration

Git is installed by default under /usr/local/bin. Once you’ve installed GIT, verify it as shown below.
$ whereis git
git: /usr/local/bin/git

$ git --version
git version 1.7.6

$ git --help.
The first step is to specify your username and email address to your GIT repository using “git config” as shown below.
git config --global user.name "GIT Admin"

git config --global user.email ramesh@thegeekstuff.com
Verify the git configuration information as shown below.
$ git config --list
user.name=GIT Admin
user.email=ramesh@thegeekstuff.com
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
This information is stored in the .gitconfig file under your home directory.
$ cat ~/.gitconfig
[user]
        name = GIT Admin
        email = ramesh@thegeekstuff.com

3. Create a Project

You can make any of your local directory as a GIT project (i.e repository). For example, if your project is located under /home/ramesh/projects/passworddragon, you can make that as your GIT project. First, cd to that directory, and execute git init as shown below.
$ cd /home/ramesh/projects/passworddragon

$ git init
Initialized empty Git repository in /home/ramesh/projects/passworddragon/.git/
This will create a .git directory under your project folder. Following is the content of the .git directory. GIT uses this directory to store information on how it is tracking the changes.
$ ls -altr .git
total 40
drwxrwxr-x  4 git git 4096 Aug 13 22:39 refs
drwxrwxr-x  4 git git 4096 Aug 13 22:39 objects
drwxrwxr-x  2 git git 4096 Aug 13 22:39 info
drwxrwxr-x  2 git git 4096 Aug 13 22:39 hooks
-rw-rw-r--  1 git git   23 Aug 13 22:39 HEAD
-rw-rw-r--  1 git git   73 Aug 13 22:39 description
-rw-rw-r--  1 git git   92 Aug 13 22:39 config
drwxrwxr-x  2 git git 4096 Aug 13 22:39 branches
drwxrwxr-x 36 git git 4096 Aug 13 22:39 ..
drwxrwxr-x  7 git git 4096 Aug 13 22:39 .
Note: If you are sysadmin, who is trying to create a GIT central repository for your company, from where developers can download the projects, you may want to create a username called ‘git’ and organize all your projects under this account. For example: /home/git/project1, /home/git/project2, etc. Once you have the project organized, cd to the project directory, and do ‘git init’ from there as git user.

4. Add and Commit files to the Project

Once you’ve initialized the project using “git init”, add the files located under this project directory, using “git add”.
If there are different types of files under your project directory, and you want GIT to manage only certain types of files, add only those to the GIT as shown below. This example adds only the *.java and *.c files.
git add *.java
git add *.c
Typically you would like to add all the files under the project directory to the GIT project. Just do “git add .”, which will add all the files in the current directory and all the sub-directories to the GIT project.
git add .
Once you’ve added the files to the repository, you should commit those files, as shown below.
$ git commit -m 'Initial upload of the project'
 create mode 100755 PasswordDragon.java
 create mode 100755 pwm/ui/DataManager.java
 create mode 100755 pwm/ui/PasswordFrame.java
 create mode 100755 pwm/tools/StrongEncryption.java
 create mode 100755 pwm/tools/PasswordStrength.java
 ..
If you didn’t specify your username and email address using “git config” as explained above, you’ll get the following error message.
$ git commit -m 'Initial upload of the project'

*** Please tell me who you are.

Run

  git config --global user.email "you@example.com"
  git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: empty ident   not allowed

5. Make Changes and Commit the File

You’ve installed GIT, created a project repository, committed all the files to the GIT project.
Now it is time to start making some changes to a file and commit it to the repository.
vi PasswordDragon.java
Once you’ve modified a file locally, you can view the changes. i.e The difference between your local copy, and the copy already committed in the GIT project using “git diff” as shown below.
$ git diff
diff --git a/PasswordDragon.java b/PasswordDragon.java
index 6166ed1..fd82d32 100644
--- a/PasswordDragon.java
+++ b/PasswordDragon.java
@@ -2,7 +2,7 @@
-    public counter=10
+    public counter=55
Once you’ve made modifications to it, reviewed the changes, and happy with it, you can commit the file to GIT repository. This is a two step process. First, you should add the file to the staging area, and commit to the GIT project as shown below.
git add PasswordDragon.java
When you perform commit, it will open your default editor, where you can enter the comment. Once you save your comment and exit the editor, it will commit the file to the GIT project and display the following message.
$ git commit
[master 80f10a9] Added password strength meter functionality
 1 files changed, 56 insertions(+), 7 deletions(-)
Note: You can also do “git commit -a”, which will do the add and commit at the same time.

6. View Status and Commit Logs

From your local repository, when you perform “git status”, it will display the current status. When the local copy is not changed (or when all the files are committed), you’ll see the following message.
$ git status
# On branch master
nothing to commit (working directory clean)
If you’ve made changes to a file, and not committed yet, you’ll see the following message.
$ git status
# On branch master
# Changes not staged for commit:
#   (use "git add ..." to update what will be committed)
#   (use "git checkout -- ..." to discard changes in working directory)
#
#       modified:   PasswordDragon.java
#
no changes added to commit (use "git add" and/or "git commit -a")
You can also view the history of a file as shown below.
$ git log PasswordDragon.java
commit c919ced7f42f4bc06d563c1a1eaa107f2b2420d5
Author: GIT Admin
Date:   Sat Aug 13 22:54:57 2011 -0700

    Added password strength meter functionality

commit c141b7bdbff429de35e36bafb2e43edc655e9957
Author: GIT Admin
Date:   Sat Aug 13 20:08:02 2011 -0700

    Initial upload of the project

Cheat Sheets

Monday, August 22, 2011

HP TouchPad Price in India – 9.7-inch Touchscreen HP tablet with webOS 3.0

The new HP TouchPad is a large 9.7-inch multi-touch tablet running the webOS 3.0 operating system . It is powered by the 1.2GHz dual-core Snapdragon processor .It will compete with the market leader Apple iPad (or the upcoming iPad 2) and the Samsung Galaxy Tab tablet .It is almost similar in design (and thickness) with its main competitor , the Apple iPad .
NOTE : HP Touchpad has been discontinued due to halt of the HP WebOS project .
HP TouchPad Tablet key features :
  • 9.7 inch touchscreen display
  • HP WebOS 3.0
  • 1.2 GHz Dual Core processor
  • 1.3 mega-pixel front camera (there is not rear camera)
  • Wi-Fi n
  • 16/32GB storage
  • Beats audio technology
  • HP Touchstone support
HP TouchPad Tablet specifications :
  • 9.7-inch XGA capacitive, multi-touch screen with a vibrant 18-bit color, 1024×768 resolution display
  • Operating System : HP Web OS
  • HP Touchstone for TouchPad
  • Weight : 740 grams
  • Dimensions : 240x190x13.7mm
  • Processor : Dual Core CPU 1.2 GHz Qualcomm Snapdragon APQ8060 1.2GHz
  • Front-facing 1.3 megapixel webcam for Video calling
  • Stereo speakers
  • 6300 mAh Battery
  • 3.5mm audio jack
  • microUSB connector
  • Wireless LAN : 802.11b/g/n WiFi
  • A-GPS (3G models only)
  • Bluetooth 2.1+EDR with A2DP
  • Memory : 16 GB or 32GB
  • Audio formats: DRM-free MP3, AAC, AAC+, eAAC+, AMR, QCELP, WAV
  • Video formats: MPEG-4, H.263, H.264
  • gyroscope, accelerometer, compass, light sensor
  • Google Docs, QuickOffice, Dropbox and Box.net compatibility
  • Email : Microsoft Exchange email with Microsoft Direct Push Technology POP3/IMAP (Yahoo! Mail, Gmail , AOL, Hotmail , etc.)
  • Browser with Full Flash support
  • Features Synergy which can sync all your personal information easily
  • Accessories
    • Case / stand
    • Wireless keyboard
    • Touchstone dock – enables all of the wireless communication magic between webOS devices
  • HP Synergy, a slick virtual keyboard
  • VPN support, wireless printing
HP Touchpad Video

HP TouchPad Price in India

The new HP TouchPad Price in India is not revealed yet . 
It should cost around Rs.30,000 .It will be launched in Summers 2011 .
NOTE : HP Touchpad has been discontinued due to halt of the HP WebOS project . Now a days it is selling at $99 in various US retails stores for clearance . There will be no further support for WebOS .
HP Touchstone Technology
The next generation of Touchstone technology makes HP devices work better together. Easily share a URL with your Pre3 simply by tapping them together.Receive text messages and answer phone calls on your TouchPad so you don’t miss a thing. Start reading a website or blog on a TouchPad and then tap your smartphone to take it to go.
HP TouchPad TouchStone

LACS launches Android tablet at Rs 6,250


 Bangalore-based Lakshmi Access Communications Systems today unveiled tablets built on Android platform in the price range of Rs 6,250 to Rs 35,000.
"The base price for the tablet is USD 99 but with taxes it goes up to Rs 6,250," Lakshmi Access Communications Systems (LACS) MD Mahendra Kumar D Jain said.
The tablets are available in 7-, 8- and 10-inch model in four product category namely Pepper, Tamarind, Mirchi and Paprika.
Pepper, priced at Rs 6,250, is built on Android 2.2 and has 800 Mhz Via processor. It has 4 GB in-built memory, expandable up to 16 GB and supports 3G dongles for connectivity. Each of the tablet will have external keyboard and USB port connectivity option.

Android’s $99 Tablet Enters Indian Market


According to reports, along with Bharti Enterprise’s Beetel Magiq and Reliance’s Tab 3G, a Bangalore-based company called Lakshmi Access Communication Systems (LACS), too, claimed that they were all set to launch another Android-based tablet in the Indian market and the best part of the announcement was that the device was priced as low as $99 (around 5,000 INR).
However, the LACS Company officials, while explaining the magical features about the device, accounted that the 7-inch tablet device, entitled as Magnum Pepper Tablet PC, runs Android 2.2 FroYo with a resistive touchscreen.
Moreover, besides all these features, the device, too offered 800 MHz processor; it includes 256 MB of RAM, Wi-Fi connectivity, USB 2.0 port and a RJ45 LAN port for wired internet connectivity and the microSD card up to 32 GB, which had a front facing camera and 2GB of built-in storage, was the key feature of the device.
"The base price for the tablet is USD 99 but with taxes it goes up to Rs 6,250” and we will set up our 10,000 showrooms in 12 months across country”, Mahendra Kumar D Jain, from Lakshmi Access Communications Systems (LACS) said. “This will be mix of directly owned and franchised outlets. Our franchisee owner will not have to register for sales tax because we have central billing".

Anna Hazare says !!!!!!!!!


Anna Hazare says bring back the Black Money.Do u know what will happen if11,456 Lac Crores comes back.

1. India Financialy No.1

2. Each district will get 60000 crores.1 & 1 village will get 100 Crores

3. No need to pay taxes for next 20 yrs.

4. Petrol 25 Rs, Diesel 15 Rs.

5. No need to pay electricity bill.

6. Indian borders will become more stronger than the China Wall.

7. 1500 Oxford like Universitis can be opened.

8. 28,000 kms Rubber road (like in Paris) can be made.

9. 2,000 hospitals (with all facilities) all medicine Free.

10. 95 crore people will have their own house.

Support Anna Hazare by forwarding this message to atleast 10 Indians. I did my job.