Friday, August 14, 2009

Syntax highlighting in vi/vim editor on ubuntu

To turn on syntax highlighting, use this command. :syntax on
When you open any file in vi editor, press escape and enter :syntax on.
Ubuntu by deafult has vim-tiny installed. So syntax command may not work. You may get this message: "E319: Sorry, the command is not available in this version"

ubuntu vi editor screenshot

To install full version of vim, use following command.

$ sudo apt-get install vim
or
$ sudo apt-get install vim-full
You can also check which package is ubuntu using by entering following command.
$ dpkg -l vim*
priyank@priyank-laptop:~$ dpkg -l vim*
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Cfg-files/Unpacked/Failed-cfg/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
||/ Name Version Description
+++-=======================-=======================-============================================
ii vim 2:7.2.079-1ubuntu5 Vi IMproved - enhanced vi editor
ii vim-common 2:7.2.079-1ubuntu5 Vi IMproved - Common files
un vim-doc (no description available)
un vim-gnome (no description available)
un vim-gtk (no description available)
un vim-lesstif (no description available)
un vim-nox (no description available)
ii vim-runtime 2:7.2.079-1ubuntu5 Vi IMproved - Runtime files
un vim-scripts (no description available)
ii vim-tiny 2:7.2.079-1ubuntu5 Vi IMproved - enhanced vi editor - compact version

Once you install vim, and open any file using vi/vim editor turn on syntax highlighting by using the commnad given above. You should be able to see your code like this.

Thursday, August 13, 2009

Voyij.com travel deals widget

Latest Travel Deals powered by Voyij

Tuesday, August 4, 2009

UNIX: useful applications list (opensource)

I came across this website - thanks to Bing.
It contains list of applications every UNIX/Ubuntu user should have.
The list includes following categories.
- Audio Applications
- Graphic Design Applications (2D)
- Graphic Design Applications (3D)
- Video Applications
- System Applications:
- Developer Applications
- Productivity Applications
- Web Development Applications

Some the applications that I am using or I have installed are:
GNOME Do
Basket Note Pads
Pidgin
jEdit
Audocity
GIMPshop
Wine
OpenSSH
OpenOffice
Putty
bugzilla
Eclipse
Geany
TrueCrypt

Wednesday, July 29, 2009

Installing and configuring mysql on ubuntu

Open terminal.

Enter following commands.

$ sudo apt-get install mysql-server mysql-client
$ mysql_secure_installation

First command will install mysql server and client both.
Second command is not required butif you want to make your database more secure, it is helpful.
Default port for mysql is 3306. If you wish to change this, you can do so by editing mysql configuration (my.cnf) file which is located under /etc/mysql.

$ sudo vi /etc/mysql/my.cnf

Look for string port=3306
Update it to your desired port number.
Once you save my.cnf file, you will have to restart mysql server to effect your changes.
You can use following command (remove curly brackets) to start,stop or restart mysql server.

$ service mysql {start|stop|restart}


Wednesday, June 3, 2009

JAVA: PatternSyntaxException: Dangling meta character '*' near index

Pattern Syntax Exception is thrown when you have "*" in any String and you want to replace "*" with something else.
This exception is likely when you use method java.lang.String.replaceAll().

There are two solutions to this problem.
Solution 1: escape all metacharacters and use replaceAll().

Solution 2:
I prefer this solution over solution 1. This method reduces most of the work as you don't need to escape any metacharacters.
Just use org.apache.commons.lang.StringUtils

Wednesday, May 20, 2009

Information about Internet Explorer and CSS issues

I found out this website when I was fixing IE and Iframe issues for a website.
This website contains lot of good and important information about different CSS issues you will face in Internet Explorer.

The article talks about following issues.
  • Narrower page elements in IE
  • Text spilling out of container in Non-IE browsers
  • Disappearing background images
  • Widths only working on IE
  • Unstyled version of web page appearing in IE
  • Fixed width webpage center alignment issue
Click Here

Tuesday, May 5, 2009

Pidgin + Twitter integration

Pigdgin + TwitterInterested in twittering from your IM???
You can also "chat" with your twitter contacts.
There is an interesting plugin microblog-purple for pidgin which enables twitter in conversion windows.
This works on both Windows and Unix.
Follow link: microblog-purple

For Windows, download this file.