Wednesday, April 30, 2008

Ask questions in smart way

In this technological days so many times we have to ask question in order to fix things or get things to work out. You post so many questions in the forum or mailing list but do you feel that some guy is getting more attention but you are not.

The main reason you are not getting the simplest of the answer is not because of the question but because of the way you are asking the question.

It is 100% true that a smart question brings a smart answer.

If you are feeling how to ask smart questions then follow the Eric Steven Raymond popular guide. Click here.

ubuntu 7.10 vs 8.04 benchmarks

If you haven't upgraded ubuntu to 8.04 and still wondering if you should do so here is a benchmark result.

Read here

Monday, April 28, 2008

filter google search with date drop down box.

If you want to filter google search by date then there is a trick by which you can produce date drop down box to filter your search.



First search your desired thing.
After the result is displayed add &as_qdr=d at the end of the address bar.

Thursday, April 24, 2008

Monday, April 21, 2008

Wednesday, April 16, 2008

Bash loop examples

For Loop Example 1

#!/bin/bash
# Date: 15.04.08
# Author: bash@roshankarki.com.np
# Purpose: Demonstrate for loop
clear
for item in usa india china japan nepal
do
echo $item
done
#END


For Loop Example 2

#!/bin/bash
# Date: 15.04.08
# Author: bash@roshankarki.com.np
# Purpose: Demonstrate for loop
clear
for i in 1 2 3 4 5
do
echo $i
done
#END


For Loop Example 3

#!/bin/bash
# Date: 15.04.08
# Author: bash@roshankarki.com.np
# Purpose: Demonstrate for loop
clear
for i in `seq 100`
do
echo $i
done
#END


For Loop Example 4

#!/bin/bash
# Date: 15.04.08
# Author: bash@roshankarki.com.np
# Purpose: Demonstrate for loop
clear
for file in `ls *`
do
echo $file
done
#END


While Loop Example

#!/bin/bash
# Date: 15.04.08
# Author: bash@roshankarki.com.np
# Purpose: Demonstrate until loop
clear
c=1
while [ $c -gt 5 ]
do
echo Welocme
let "c += 1"
done
#END


gt >
lt <
eq =
le <=
ge >=
nq !=


Until Loop Example

#!/bin/bash
# Date: 15.04.08
# Author: bash@roshankarki.com.np
# Purpose: Demonstrate while loop
clear
c=1
while [ $c -lt 5 ]
do
echo Welocme
let "c += 1"
done
#END

Tuesday, April 15, 2008

bash select menu example

Here is a simple bash select menu example:
(Thanks to my friend)

#!/bin/bash
# Date: 15.04.08
# Author: bash@roshankarki.com.mnp
# Purpose: Usage of select

PS3='Please enter your choice'
LIST="choice1 choice2 END"
select OPT in $LIST
do
if [ $OPT = "choice1" ] &> /dev/null
then
echo you chose choice1
elif [ $OPT = "choice2" ] &> /dev/null
then
echo you chose choice2
elif [ $OPT = "END" ] &> /dev/null
then
exit 0
fi
done
#END

Monday, April 14, 2008

how to pause script until a key is pressed

Hello,

A travelers hint, pause your script until a key is pressed

#!/bin/bash
# Date: 13.04.08
# Author: bash@roshankarki.com.np
# Purpose: Demonstrate how to pause script until a key is pressed

clear
echo The screen is now paused
read -n 1
echo You pressed a key

#END


man read to see how it works.

Sunday, April 13, 2008

Open multiple terminal in arranged way in tile fashion

Being a system administrator is never an easy job. You are messed up with so many things that you dont know whats currently going through. No doubt you make your system superb but you never care the way you work, be it food, sleep or your place.

Today a small thing caught my eye. Usually if you see a linux user or admin's desktop they are all filled with terminals all messed up but yesterday I went to one of my friend and his terminals were arranged very nicely. See below.



With a help of small script four gnome-terminal will tile up for you. With his permission I have copied the script here.

#!/bin/bash
# Date: 12.Apr.2008
# Author: bash@roshankarki.com.np
# purpose: open four terminal in tile fashion
# Please note that you may need to adjust 69x22 if the screen looks to big or small.

gnome-terminal --geometry 69x22+0+0 --hide-menubar &
gnome-terminal --geometry 69x22-0+0 --hide-menubar &
gnome-terminal --geometry 69x22+0-0 --hide-menubar &
gnome-terminal --geometry 69x22-0-0 --hide-menubar &

#END


One more thing, if you already have terminal icon on your panel you can use it to lauch this script. Simply replace the Command with /bin/bash /path to script/sricptname.sh

Friday, April 11, 2008

screenlets: mac or vista widget for linux

Linux is powerful with command line, no doubt about it but with few packages you can beat it in graphics to MAC OS and Vista.

The kiba-dock or AWN produces dock that resembles MAC dock. Here is my older post regarding them if you have missed it http://techspalace.blogspot.com/2008/03/mac-like-dock-for-ubunut.html

Now lets see the power of a program called screenlets. With it, you can put widgets on your desktop. Check preview below.



Follw the installation procedure.

sudo echo 'deb http://hendrik.kaju.pri.ee/ubuntu gutsy screenlets ' >> /etc/apt/sources.list

sudo apt-get update

sudo apt-get install screenlets
sudo apt-get install python-gnome2-extras
sudo apt-get install python-feedparser

This will install screenlets on your system.

Now go to Accessories->screenlets or simply run screenlets-manager from terminal.
There you will find many screenlets.
Double click them or select start/stop to start them.
Select Auto start to start the selected screenlets automatically at logon.

There are few important options:
Window->Lock This locks the position of screenlets making them unmovable.
Window->Sticky This makes your screenlets appear on all workspace.
Window->Widget This makes you screenlets like dashboard in Mac OS X. RUN csm(compiz setting manager), search for the option widget in top left corner and enable it. Now change your screenlets to widget. It will disappear but appear when you press F9 key.

Goto screenlets.org for more screenlets.

Also, now you can use Google gadgets, and other gadgets and web application as your screenlets.
On screenlets-manager select install and select the required option.

Here's what screenlets.org have to say regarding them.

http://screenlets.org/index.php/Google_gadgets_now_run_on_Screenlets_engine_...
http://screenlets.org/index.php/SuperKaramba_themes_now_runs_on_Screenlets_engine_...

Have fun.

Sunday, April 6, 2008

what next ubuntu

Do you want some new thing or new features added in your Ubuntu?
Do you ever wish that the things were in little different way than the way it is?
Do you think that there are people wishing the same?

If you are answering yes then be glad that there are sites like

http://brainstorm.ubuntu.com/
http://www.ideastorm.com/

The concept of these sites is you get some idea, you post there and if it has high vote then it will get attention. Similarly you are the one who vote for others idea too.

So what are you doing here. Go submit and vote.