Saturday, September 26, 2009

Reliance Netconnect Broadband connection in Ubuntu 8.10 desktop edition

Being a programmer in always wanted internet connection in my Ubuntu. I was wondering if it is possible to do that before i found this blog http://himanshuonweb.blogspot.com. Thanks to Himanshu.
I followed those instructions and i was successfully able to connect to internet.
Follow these steps below:
1- Start Ubuntu ensuring USB modem is not connected and configure the file /etc/wvdial.conf
sudo gedit /etc/wvdial.conf


paste the following lines:


[Dialer Defaults]

Init1 = ATZ

Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0

Stupid Mode = 1

Modem Type = USB Modem

ISDN = 0

Phone = #777

New PPPD = yes

Modem = /dev/ttyUSB0

Username =

Password =
Problem while saving?? I believe you do not have permission to save contents. You can manually set the permission to write contents by typing sudo chmod 777 /etc/youfilename (in this case your file name is wvdial.conf). You might also want to set "write" permissions where you are not able to modify the file in the steps below
2- Plug-in USB modem, your /var/log/messages will display something like:


Aug 16 19:35:57 abc-laptop kernel: [ 111.532151] usb 4-1: new full speed USB device using uhci_hcd and address 2
Aug 16 19:35:57 abc-laptop kernel: [ 111.744188] usb 4-1: configuration #1 chosen from 1 choice
Aug 16 19:35:57 abc-laptop kernel: [ 111.747614] usbserial_generic 4-1:1.0: generic converter detected
Aug 16 19:35:57 abc-laptop kernel: [ 111.748339] usb 4-1: generic converter now attached to ttyUSB0
Aug 16 19:35:57 abc-laptop kernel: [ 111.909454] usbcore: registered new interface driver libusual


3- Run
lsusb
whose output will be like:

us 007 Device 002: ID 04f2:b008 Chicony Electronics Co., Ltd
Bus 007 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 002: ID 12d1:142b Huawei Technologies Co., Ltd.
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub


4- Add a module for the above listed Huawei device, as:

sudo modprobe usbserial vendor=0x12d1 product=0x142b


make sure the vendor and product ID are the same as listed in the above lsusb output

5- Check the files for USB device:
ls -la /dev/ttyU*


Output will be similar to:

crw-rw---- 1 root uucp 188, 0 2009-08-16 19:36 /dev/ttyUSB0
crw-r--r-- 1 root root 188, 1 2009-08-16 19:34 /dev/ttyUSB1


if no USB0 or USB1 files listed, then try creating it as:
sudo mknod /dev/ttyUSB0 c 188 0
sudo mknod /dev/ttyUSB1 c 188 1


6- now hopefully your are done with the configuration part. just try connecting internet:
sudo wvdial

console will look like:
--> WvDial: Internet dialer version 1.60
--> Cannot get information for serial port.
--> Initializing modem.
--> Sending: ATZ
ATZ
OK
--> Sending: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
OK
--> Modem initialized.
--> Sending: ATDT#777
--> Waiting for carrier.
ATDT#777
CONNECT
--> Carrier detected. Starting PPP immediately.
--> Starting pppd at Thu Aug 20 22:06:00 2009
--> Pid of pppd: 7268
--> Using interface ppp0
--> pppd: [10]�[17]
--> pppd: [10]�[17]


Congrats! your are connected!!! to DISCONNECT use ctrl+c.

Sunday, September 20, 2009

Few commands in Git source control system

I always prefer writing commands rather than using the tool and be a handicap. In Windows Explorer, right-click on the working directory you want and choose “Gui Bash Here”. Then enter a command like this:

To clone a repository from remote repository, you will have to type

git clone git@github.com:firstnamelastname/yourrepo.git

git clone repoURL

Git might prompt you about an SSH key, the first time you do this with github (or any other new server). Answer “yes”.

It’s worth pointing out here, if you didn’t already understand from the various Git web sites, that Git is a distributed source control system. It will pull down the whole project history, so you can browse history and even commit changes without online access. Thus Git works very well if you have an intermittent or poor network connection.

Few commands:

As with all source control, work in the directory where you use source control. Do not copy files back and forth between here and some other working directory, that is a path to endless merge and update problems.

Once you have checked out the software, here is a summary of your work flow. For more details, please read the copies Git documentation online. I suggest reading both the official Git material, as well as other sites and articles about Git.

Getting Changes

Get changes from others with “git pull” (or using the GUI). By default this will pull from the repo from which you cloned, so if you cloned the upstream repo, that will get other peoples’ changes.

If you cloned from your own Git hub repo, you’ll need to use something like this:

git remote add upstream git@github.com:firstnamelastname/yourrepo.git

git pull yourname upstream

Sending Changes

Commit your changes locally with “git commit” (or using the GUI). Remember that Git generally wants you to explicitly say which files’ changes to include (”git add”), so make sure you read and understand enough about Git to do this properly; it is only a few commands or clicks in the GUI. The usual caveat applies, to only commit actual source files, not generated files or temp files.

Push your changes up to your GitHub repository with “git push”. This step will make it so others on your project can see your changes. Do this at least once per day, and ideally more often as you collaborate. Assuming that you cloned from the upstream repo, you’ll need to set up a reference to your own Git hub repo (the one you can push to), with something like this:

git remote add name git@github.com:firstnamelastname/yourrepo.git

As usual, use reasonable names and relevant URLs, not my sample names and URLs. Once you’ve added the remote reference, pushing is easy:

git push name master

When you have a set of changes (one or more commits) that you think are ready to go in to the main-line of the project, use Git hub to issue a “pull request”.A key thing to understand about Git is that it makes branching extremely easy and fast, so that very convenient to use branches.

Installing Git version control from windows

This sentence confirms my ownership of the site and this site comply with the Terms and Conditions and program policies for Google AdSense. ca-pub-0819929743481189

  1. Go to http://code.google.com/p/msysgit/downloads/list and download the latest version of git and install it.
  2. Now open the Git bash and generate a ssh key. Type ssh-keygen -C "username@email.com" -t rsa ( When you click on 'Enter' key note where the ssh key is going to be saved"
  3. Now open the file where you have saved ssh key and note it down.
  4. Go to www.github.com
  5. Create your own git hub account. While creating the account you will be asked to enter the ssh key. Copy the saved ssh key.
  6. Now you need to create your own user name and email for the local repository. This will be information incase of multiple users committing the code to know who is the committing the code . Type this with your email and password
    git config –global user.email Your.Email@domain.com
    git config –global user.name “Your Real Name”
  7. Then you are ready to proceed with getting into a project. Copy the “Clone URL” from a github project page. Make a new directory on your machine, to become your working directory. There are two approaches to which project to clone.
  • Clone from your own fork repo. This will make it trivial to push your changes up, but require one more command to get upstream changes.
  • Clone from the upstream (my) repo. This will make it trivial to get change, but require one more command to be able to push changes, because you can’t push to another Github users’ repo.
Now if you have already created a repository in github.com, and want to clone it to your local machine then follow the below steps
  • Go to start --> All programs --> Git --> Git UI
  • A new window will open and click on "Clone Existing Repository"
  • Now it wil ask you to enter source location which will be something like git@github.com:firstnamelastname/yourrepository.git and target directory would be your rails_apps folder/yourappname
  • Click on 'clone'.
  • Incase you get "Permission denied" then type ssh git@github.com and press enter and then you should get a welcome message from git hub. If you have not received then you should do some more research on git.
  • Congratulations! you have successfully cloned a remote repository. Suggestions are welcome incase of errors in this blog.