Thursday, October 28, 2010

Shortcut launcher for IntelJ Idea in Ubuntu

Than starting from command prompt, Launcher is a fascinating way to start programs by a single click in Ubuntu.



We can add launchers either in the Desktop or on panels.
To add one, right click the panel and select "Add to panel...", you will get the "Add to panel" window.
Here double click on "custom application launcher".



On the "Create launcher" window, for name type "Idea" and for the  command type:
/bin/sh -c 'export JDK_HOME=path for Java home && path for /bin/idea.sh
E.g.
/bin/sh -c 'export JDK_HOME=/usr/lib/jvm/java-6-sun-1.6.0.20 && /home/suho/proj/idea-IU-95.66/bin/idea.sh'

By clicking the launcher icon on the "Create launcher" window you can select an image file to add as the icon of your launcher. For Idea you can find its image form Idea_Home/bin/

Happy coding!

Huawei E1550 USB 3G Modem on Ubuntu

USB modem configuration is always an issue for Ubuntu users. Here I provide an easy solution which worked for my Huawei E1550 USB modem on my Ubuntu 10.04 Lucid Lynx.

Ubuntu has a great feature called rule files, here we only need to create a new configuration file for our USB modem. After creating the corresponding rule file the machine will automatically switch the USB mode of your 3G Modem from USB Storage to USB Modem.

As the first step we need to find out the product id and the vendor id of our 3G USB modem. Connect the Modem, then in the terminal type;
$ lsusb
You will get a list of drivers connected to the USB ports.
In my case, one of the entries I found was.
Bus 002 Device 004: ID 12d1:1446 Huawei Technologies
Here 1446 is the Product id, and 12d1 is the vendor id, of my USB Modem.
Note: In this case, my system has only recognized the USB Modem a USB Storage drive.

Now you need to create a rule file for the Modem.

$ sudo vi /etc/udev/rules.d/15-huawei-155x.rules

Then type the following:

ACTION!="add", GOTO="huawei_zerocd_end"

SUBSYSTEM=="usb", ATTR{bDeviceClass}!="ff" ,ENV{DEVTYPE}=="usb_device", GOTO="huawei_zerocd_disable"
SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", GOTO="huawei_zerocd_disable"
GOTO="huawei_zerocd_end"

LABEL="huawei_zerocd_disable"
ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1446", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd"

LABEL="huawei_zerocd_end"

Now, save and exit. Next time when you plug in your USB modem, your system should automatically switch it to USB Modem mode and you’re good to go.

To cross check whether Ubuntu has properly detected the USB modem, type;
$ lsusb
now your output should contain a line like;
Bus 002 Device 004: ID 12d1:1001 Huawei Technologies Co., Ltd. E620 USB Modem
Now if you get something like this, then you can be sure that the system has successfully recognized your USB as 3G Modem.
Note there is an “USB Modem ” at the end of the line.

But before you can finally start using your USB modem to connect to the Internet, you still need to configure your network connections. Simply go to “System -> Preferences -> Network Connections” and select the “Mobile Broadband” tab. Then click the “Add” button and the Mobile Broadband Connection wizard should be able to help you configure your Internet connection in no time.

For other USB Modems try the same technique by adding the corresponding product and vendor ids. Wish they will work for you :-)

Tuesday, October 5, 2010

The 'vi' arrow keys not working in Ubuntu

Most people get this issue of arrow keys not working for 'vi' in Ubuntu. Instead, it displays A, B, C, and D characters.

This is because the default 'vi' in Ubuntu is a vi 'light' version (that is the vim-tiny package). This does not use the arrow keys as you would expect.

If you want the arrow keys to function you have to install the 'full' vim package. By this you not only get the arrow keys working but also other nice features such as colored syntax.

Just installing the 'vim' package should get you fixed up. Try:

sudo apt-get install vim
or
sudo apt-get install vim-full

'vim-full' will install all the vim related package and the dependencies, that includes gnome libs, etc... if you don't use gnome and just want to fix this issue in the text mode you can also run :

sudo apt-get install vim-runtime