- deb http://ppa.launchpad.net/brianmercer/php/ubuntu lucid main
- deb-src http://ppa.launchpad.net/brianmercer/php/ubuntu lucid main
Monday, October 3, 2011
Installing php-fpm in ubuntu 10.04
put these in sources.list sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 8D0DC64F sudo aptitude update sudo aptitude install php5-fpm
Sunday, January 31, 2010
Useful shortcuts in eclipse
disclaimer: This is a pure cut-copy-paste stuff with an intention to increase the reach of useful stuff such as this to the users who need it. Follow the sources if required.
Use your hands to write code
You should try to keep your hands on keyboard. The less you touch the mouse, the more code you can write. I am trying to keep the mouse laying still and control the IDE completely using keyboard. What do you think is faster: pressing ALT + C or right clicking the project, selecting Team -> Commit?
It is said, that if a function does not have a key binding, it is useless. Below you will find a set of essential keyboard shortcuts that I love. These shortcuts are set up by default, they should all work.
- CTRL + D
- Delete row. Try it! You no more need to grab the mouse and select the line, no more Home, Shift + End, Delete. Quick and clean.
- ALT + Up/Down Arrow
- Move the row (or the entire selection) up or down. Very useful when rearranging code. You can even select more rows and move them all. Notice, that it will be always correctly indented.

- ALT + Left/Right Arrow
- Move to the last location you edited. Imagine you just created a class Foo, and now you are working on a class Boo. Now, if you need to look at the Foo class, just press Alt+Left Arrow. Alt+Right Arrow brings you back to Boo.
- CTRL+SHIFT+O
- Organize imports. What happens when you first use a class you have not yet imported? You will see an error. But when you press this magical combination, all your missing classes will be imported, and the unused imports will vanish.
- CTRL+1
- Probably the most useful one. It activates the quick fix. Imagine you create a class, which implements some interface. You will get an error, because the inherited methods are not yet implemented. While you are on line where the error occurs, press this combination to activate the quick fix. Now, select the "Add unimplemented methods" option. You can use the quick fix at every error you ever receive.
Quick fix comes handy in other situations too. My favorite is the "Split variable declaration". Sometimes I need to broaden the scope of a variable. I activate the quick fix, split declaration, and use alt + arrow to put it where it belongs. You can find even more usages: Convert local variable to field, rename in file, Inline local variable..
You could use the "Split variable declaration" on the bar variable, and then move it with Alt+Arrows above the try block..
Or you could use the "Add unimplemented methods" fix here.
The best thing you can do if you see an error is to use the quick fix. - CTRL+SHIFT+T
- Open Type. Imagine, that you need to have a look at the Foo class. But, where is the Foo class? Is it in the Boo project and in the foo.bar package? Or somewhere else? With this shortcut, you don't need to know. Just press it, type Foo and you are in.

- CTRL+E
- Shows you a list of all open editors.

- CTRL+F6
- Use to move between open editors. This is an slower alternative to Ctrl + E. Comes handy in a situation when you want to periodically switch between two editors, something, what is nearly impossible with Ctrl+E as it sorts entries quite randomly. Or you might just use Alt+Arrows..
- CTRL+F7
- Move between views. When in editor, press Ctrl+F7 to switch to the Package Explorer, or hold Ctrl and press F7 multiple times to switch to other views.
- CTRL+F8
- Move between perspectives. The same as previous.

- CTRL + F11
- Runs the application. What gets launched depends on your settings. It will either launch the last launched class (my preffered way) or it will launch currently selected resource (the default way). If you want to change its behavior read the previous post.
- CTL + N
- Open new type wizard. This is not very quick because you have to select the wizard type (weather you want to create new class, jsp, xml or something else) in the next step. Much faster way would be if you could just hit the shortcut and invoke the particular wizard. It is possible, just keep reading..
- CTRL + M
- Maximize or umaximize current tab.
- CTRL + I
- Corrects indentation.
- CTRL + SHIFT + F
- Formats code. You can make a beautiful looking code out of a mess with this. It requires a bit of setup, but it is well worth it. You can find its settings under Window->Preferences->Java->Code style->Formatter
- CTRL + J
- Incremental search. Similar to the search in firefox. It shows you results as you type. Don't be surprised, if you hit this combination, nothing happens - at the first glance. Just start typing and eclipse will move your cursor to the first ocurence.
- CTRL + SHIFT + L
- Shows you a list of your currently defined shortcut keys.
source: http://tkramar.blogspot.com/2007/10/effective-eclipse-ii-shortcut-keys_16.html
Saturday, December 19, 2009
Word web like dictionary in linux - StarDict
In Linux, two best dictionary tools are JaLingo and StartDict. Stardict is supported by many Linux distributions and particularly by Ubuntu.
StarDict uses its own dictionary format. So, you have to install dictionaries before you actually start using StarDict. You can find a good selection of ready-to-use dictionaries at http://stardict.sourceforge.net/Dictionaries.php.
Steps to install it.
$ sudo apt-get install stardict
Download the Dictionary of your choice from http://stardict.sourceforge.net/Dictionaries.php
untar the dictionary file in current directory,
$ tar -xjvf stardict-freedict-eng-hin-2.4.2.tar.bz2
Move the untar file to /usr/share/stardict/dic. Issue this command in Terminal - "sudo mv stardict-freedict-eng-hin-2.4.2 /usr/share/stardict/dic".
Start StarDict, if required kill the process and start it.
StarDict uses its own dictionary format. So, you have to install dictionaries before you actually start using StarDict. You can find a good selection of ready-to-use dictionaries at http://stardict.sourceforge.net/Dictionaries.php.
Steps to install it.
$ sudo apt-get install stardict
Download the Dictionary of your choice from http://stardict.sourceforge.net/Dictionaries.php
untar the dictionary file in current directory,
$ tar -xjvf stardict-freedict-eng-hin-2.4.2.tar.bz2
Move the untar file to /usr/share/stardict/dic. Issue this command in Terminal - "sudo mv stardict-freedict-eng-hin-2.4.2 /usr/share/stardict/dic".
Start StarDict, if required kill the process and start it.
Sunday, December 13, 2009
Why does cron fail to run a job? what is cron EOF error?
The cronjobcommand works from the command prompt but from a crontab it doesnt seem to be getting invoked at all.
First, check the error log for the cronjob
$* * * * * cronjobcommand 2> log
One of the problems could be cron EOF error.
esp if the cron command has % in the command (most of the cron commands have `date +%F` to log the output according to date)
Read the manpage for the crontab file (`man 5 crontab`) and pay
particular attention to the discussion of the "%" character. % needs to be escaped
wrong: $ 1 0 * * * /scripts/nmon.sh -F /scripts/log/NMON`date '+%d'`.nmon -t -s 300 -c 2880
correct: $ 1 0 * * * /scripts/nmon.sh -F /scripts/log/NMON`date '+\%d'`.nmon -t -s 300 -c 2880
First, check the error log for the cronjob
$* * * * * cronjobcommand 2> log
One of the problems could be cron EOF error.
esp if the cron command has % in the command (most of the cron commands have `date +%F` to log the output according to date)
Read the manpage for the crontab file (`man 5 crontab`) and pay
particular attention to the discussion of the "%" character. % needs to be escaped
wrong: $ 1 0 * * * /scripts/nmon.sh -F /scripts/log/NMON`date '+%d'`.nmon -t -s 300 -c 2880
correct: $ 1 0 * * * /scripts/nmon.sh -F /scripts/log/NMON`date '+\%d'`.nmon -t -s 300 -c 2880
How to install / untar / unzip a tar.gz tar.bz2 tar zip file in Linux/Ubuntu?
You could try use
tar -xzvf file.tar.gz
tar -xjvf file.tar.bz2
tar -xvf file.tar
unzip file.zip
this will actually uncompress the file.
Depending on package you need to do
./configure
make
make install (Eg. mplayer)
or leave as it is. (Eg. eclipse, tomcat)
tar -xzvf file.tar.gz
tar -xjvf file.tar.bz2
tar -xvf file.tar
unzip file.zip
this will actually uncompress the file.
Depending on package you need to do
./configure
make
make install (Eg. mplayer)
or leave as it is. (Eg. eclipse, tomcat)
How to use 'SCREEN' command in linux?
To start a screen session:
$screen -S screenname
We have now started a screen session with name `screenname`. Lets start a process here for us to understand the working of screen. 'top' command initiates a process that shows the list of processes running on the machine.
$top
Now you find top process running on the terminal.
To suspend screen session do the following.
Press Ctrl + a , z (Press Ctrl + a and then press z)
This would only suspend and does not end the session, so that you can comeback later and check.
Now you are out of screen and at the terminal where you started.
To see the list of screen sessions,
$screen -ls
you should be finding the screenname listed.
To go back to the screen
$screen -dR screenname
you should now find the top command still being executed.
To end the screen
$exit
You can recheck it with `screen -ls` command.
Done !! Now that you have got your hands dirty, you can visit the following resources to know more about it.
http://linux.die.net/man/1/screen
$screen -S screenname
We have now started a screen session with name `screenname`. Lets start a process here for us to understand the working of screen. 'top' command initiates a process that shows the list of processes running on the machine.
$top
Now you find top process running on the terminal.
To suspend screen session do the following.
Press Ctrl + a , z (Press Ctrl + a and then press z)
This would only suspend and does not end the session, so that you can comeback later and check.
Now you are out of screen and at the terminal where you started.
To see the list of screen sessions,
$screen -ls
you should be finding the screenname listed.
To go back to the screen
$screen -dR screenname
you should now find the top command still being executed.
To end the screen
$exit
You can recheck it with `screen -ls` command.
Done !! Now that you have got your hands dirty, you can visit the following resources to know more about it.
http://linux.die.net/man/1/screen
Subscribe to:
Comments (Atom)