Dec 29, 2007

Multiple X-clients in Linux

Before starting note that this is tested in ubuntu (a debian-based distro).

Here i will be assuming that you are familiar with X-system in linux.

Perhaps you know, what you will get when you press F1 to F8 with control and alt key. Well, if you don't know let me just brief it for you. By default, there are six virtual terminals in linux, F1 through F6.By pressing <ctrl> + <shift> + Fx you can switch to corresponding terminal. Next in F7 there is you your desktop manager. If you are reading this from linux, I must say this is where you currently are. In F8 you will see system logs. From F9 - F12 ...? Yes, this is where we will run other instance of desktop manager.

A brief intro about X-system:
In x-system there are two main parts X-server and X-clients. X-server simply communicates your hardware with the x-clients and a desktop manager gives a gui-environment to make the communication between the user and the x-client easier.
For detail goto wiki-page

Okay, Lets kick off:
It's just a single command. Open a terminal and login using any user-account and just enter the following command:

~$ startx -- :1 &

This command starts a new desktop-manager in screen:1 and the '&' symbol simply backgrounds the process.

The desktop manager on which you currently are, is Screen:0 ==> F7 and by issuing :1 as argument you are requesting to start it on Screen:1 ==> F9 (as you know in F8 there is system log)
Note: You might get it in F8 too or even other in other ditros.

Similarly you can start other three x-client from F10-F12 simply by choosing a from screen 2-4. By starting the x-client as user 'xyz' you will be logged in as same user. And remember you cannot start multiple x-clients in same screen.
In some distro you may also get some error or warning if you try to run it as root.


Note: I have tested it in Ubuntu. If you have tested it successfully in other distro then please post it as a comment.

Dec 7, 2007

Shortcuts in Terminal (console)

Must of use face the problem with cutting and pasting in terminal... I know it because i did felt it a few days back too.
I don't know how but it was my luck that that i pressed ctrl+l insted of shift+l. I got amazed when i saw it cleared my console .. OMG it was a short to clear the terminal screen...

Soon after that i tested with each combination and here are the shortcuts that i found working...

ctrl+L = clear the screen
ctrl+W = clear the current word
ctrl+K = clears everything after the current curser position
ctrl+T = swaps last two letters
ctrl+U = cut
ctrl+Y = paste
ctrl+I = autocomplete (similar to pressing tab-key)
ctrl+P = Previous command (similar to pressing up-arrow)
ctrl+A = Move the cursor to the begenning
ctrl+D = same as what DEL-key does
ctrl+H = same as what BACKSPACE-Key does

...

please comment if you have any more...

Nov 30, 2007

Getting Relational(Designer) view in Phpmyadmin

Its just simple....
just go to the phpmyadmin folder
In my case i am using lampp and and the path to phpmyadmin is:
/opt/lampp/phpmyadmin

open the file:
confing.inc.php
Note: You should be root (or use sudo command) to open the file.

Find the line:
$cfg['Servers'][$i]['pmadb'] = '';
Edit it to:
$cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';
and save the file.
And also conform the the following lines exists and exactly same as below:
$cfg['Servers'][$i]['bookmarktable'] = 'pma_bookmark';
$cfg['Servers'][$i]['relation'] = 'pma_relation';
$cfg['Servers'][$i]['table_info'] = 'pma_table_info';
$cfg['Servers'][$i]['table_coords'] = 'pma_table_coords';
$cfg['Servers'][$i]['pdf_pages'] = 'pma_pdf_pages';
$cfg['Servers'][$i]['column_info'] = 'pma_column_info';
$cfg['Servers'][$i]['history'] = 'pma_history';
$cfg['Servers'][$i]['designer_coords'] = 'pma_designer_coords';



Reopen phpmyadmin and you will get, what you are searching for.

Nov 29, 2007

Limiting the power of Sudoers

Basically in linux, a default user "root" have full access to any kind of file (every thing is file in linux, yes! even device!!!). Sometimes it is necessary for other users in the same system to access some file which are inaccessible for him by default. Command "sudo" helps to solve this problem. It is used as follows:

$sudo <command-inacessable_by_default arguments_if_any>

This Sudo command limits the user's power on the basis of the configuration made on the file "/etc/sudoers".
Generally in default case you might see something like this:
root ALL=(ALL) ALL
Above, you can see ALL 3 times. But what does it mean?
The first ALL: Run from any(all) host
The Second ALL: From any Terminal
The third ALL: Can Run any command

So, the line means the "root" run any command from any terminal from any host.
Now, how to change this? Dont ever attempt to change the power of root :) any thing may happen to your system. I cannot predict what will happen, but it is not obviously going to be good.

Yes, but you can add another user to sudoers list and limit his authority(power).Lets kick off:

Let me add another user "foo" which can have full acess to "ifconfig" command from current host.

foo HOST=(ALL) COMMAND

what do you think? will it work. Obviously not.

What does HOST and COMMAND mean?
HOST is just an alias to host(s), which i defined here.
Similarly COMMAND is a alias to command(s)

We should also define these aliases in the same file (etc/sudoers)

Host_Alias HOST = 127.0.0.1
Cmnd_Alias COMMAND =/sbin/ifconfig


If you want to give "foo" to access other commands too. you can simply append the line line with a seperator comma(,). ie:
Cmnd_Alias COMMAND =/sbin/ifconfig, <path to other command(1)>,<path to other command(2)>...

In similar fashion you can also add add other hosts too.
Further there are other 2 more types of aliases you can define:
User_Alias
Runas_Alias


I hope you got it...

you can find a detailed info by running the following line in console:
man sudoers

A visual defination of sudo:
http://howtoxyz.blogspot.com/2007/11/this-is-what-sudo-is.html :)

ref: http://www.go2linux.org/sudoers-how-to

Nov 28, 2007

Tux in Text

Have you ever seen Text-Art of linux?
In either case you must visit this site, http://www.100mb.nl . This site contains a text picture of the Penguin (the icon of linux).
Great Art. I cannot stop myself to appreciate it.

If I am not mistaken,the text is the code of linux kernel (Obviously... not complete)

Visit it @ http://www.100mb.nl

Nov 26, 2007

check your download speed online...

To check your download speed just click here

This site checks your download speed and even gives your ip. It also shows your download speed in graph, comparing with standard connection types.
http://www.whatismyip.com.np/checkdownlink

Its also provides you to browse anonymously from http://www.whatismyip.com.np/tools/proxy

EDIT: This isnt working anymore.

Nov 25, 2007

This is what sudo is.



:)

Configuring Netbeans to new look and feel

Everybody wants to be unique. Isn't it...
I too want. I changed the default look and feel of the netbeans.

Adding theme
<path to netbeans>/netbeans -cp:p ${substance}\substance.jar
-laf org.jvnet.substance.SubstanceLookAndFeel


Adding Watermark
"<path to netbeans>/netbeans" -J-Dsubstancelaf.watermark = org.jvnet.substance.watermark.SubstanceKatakanaWatermark


Changing buttons laf
"<path to netbeans>/netbeans"
-J-Dsubstancelaf.gradientPainter=org.jvnet.substance.painter.WaveGradientPainter

Note: I am using the substance look and feel. You can download it from https://substance.dev.java.net/servlets/ProjectDocumentList

And finally here is what i am using recently,
/opt/netbeans-5.5/bin/netbeans" -cp:p /opt/mymodules/substance/lib/substance.jar -laf org.jvnet.substance.SubstanceLookAndFeel -J -Dsubstancelaf.watermark = org.jvnet.substance.watermark.SubstanceBinaryWatermark

Yea I have my netbeans in /opt folder and i run linux in my system.

With similar options you can also change java's default laf.

for more detail info:laf@netbeans

Opening file as root with just few clicks...

[I tested it in ubuntu]
For basic user, I hope need not to go to terminal for any of of the region beside editing a file as root. You might feel bored about this. Here's a handy shortcut... ( yea, you wont need to go to terminal each time.)

First goto to the following directory create a file.
/home/<current_user>/.gnome2/nautilus-scripts

create a file with name "Open as root"
and copy and paste all this code into the file:
for a in $NAUTILUS_SCRIPT_SELECTED_URIS; do
gksudo "gnome-open $a" &
done


and save that.


and its done...

Right click on any file/ folder while browsing from "nautilus" and goto the Scripts menu and select "Open as root" .... give your password to open it.

Note: You should be in sudo-ers list to accomplish this.

Nov 19, 2007

!0 mins email

yea an email-address for only 10 mins. Is this of any use. yea, let me explain.
Have you ever registered for any site, that require an email address for just verification purpose. Obviously it will verify you, but beside this you end up getting spam-email in your inbox too. For this case you can use the e-mail address given by http://10minutemail.com. You can check the mail received and reply too. If required you can even extend the lifetime of the email for 10 more mins.

Get a 10-min email-address at: http://10minutemail.com

Oct 28, 2007

batch resizing images in linux

we often need to decrease the image size before uploading. You must be using some graphical software to resize them. Its not that tedious if its one or two but what if you have to resize a large numbers of images!!!. This is what i do.

Basically two commands are used here.
1. djpeg - decompress a JPEG file to an image file
2. cjpeg - compress an image file to a JPEG file

So to resize, i run this script on a folder containing the image files.

#!/bin/sh

mkdir resized
for i in *.JPG
do
echo 'Resizing image..' $i
djpeg -scale 1/2 $i | cjpeg > resized/$i
done


After script is done, a folder named 'resized' is created containing the resized images.

Note:
Both djpeg and cjpeg aren't installed by default, they're part of libjpeg-progs package. Under Ubuntu you can get it by

sudo apt-get install libjpeg-progs


(source: jwalanta.blogspot.com)

Sep 29, 2007

switch from xp to linux,

I know its was not easy for me to switch from xp to linux(ubuntu). The first thing that made me difficult was that there was not any type of media-player that could play my mp3-library. Though there was totem movie player it didnt played my library due to missing codec.
The next first thing that made me difficult to use linux was the name given to applications. Most of them were irrelevant for me. Lets take "amarok", it didnt have any significant meaning (at least not for me). I heard its name from my friend and got to know that it was audio-player.
There were so many of other problems i faced that include burining a disk,installing from tar.gz or tar.bz2 by making own compilation, or using internet, etc

Though i found it a bit later after i switched to linux. This link was very helpful for me.

The Linux alternative project

Edit:
One More:
http://www.webi.org/osalternative.html

Sep 27, 2007

real-time traffic data on your blog/site

You might be wondering, is there any service provider that serves real-time traffic data in your site. The answer is yes,
And here is the solution

http://feedjit.com/

you can also see it aside in this blog.

Sep 13, 2007

How to Download From YouTube?

Just copy the link location of your video from you tube.

And Open any of the following site and Enter your link to youTube Video there.

http://video.qooqle.jp/dl/
http://www.kissyoutube.com


You can also use extension for mozilla internet explorer. You can get the extension here;
http://javimoya.com/blog/youtube_en.php

Aug 12, 2007

How to hide your file?

This howto is for Microsoft OS'es only.
1.Gather your image and the files you wish to lodge into it. Here I have a meeting.txt which which I will slap inside my secret.jpg

2.Add the files you want to hide into a new RAR archive
Open Command Prompt

3.Go to the folder where your files are located, in this case 'C:\hidden'
Type 'copy /b secret.jpg + meeting.txt.rar lizard.jpg' where secret.jpg is the original picture, meeting.txt.rar is the file to be hidden, and lizard.jpg is the file which contains both.

4.Test the JPG by opening it, and verifying it still opens. If it does, try opening the file with WinRar!

5.The completed RAR file!

The link to the original page:
http://www.thetechtray.net/2007/05/30/hiding-files-in-jpegs