Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Saturday, September 18, 2010

How to run custom scripts at Linux startup?

It is a good idea to make your own scripts at the Linux start up. Here I am explaining the things with a simple example. I want to make a directory in desktop named 'folder' in each start up. If it is deleted, a new 'folder' is created in the same place in the next start up. Here is what I did.
first make a new script- here 'my_own_script'. Open the file in gedit and add the following:
#! /bin/bash
# chkconfig: 345 40 60
mkdir /home/tom/Desktop/folder
You need to change to the correct path in 3rd line. Here 345 means different run levels and 40 and 60 are the order for start and stop. save the file in /etc/init.d .
Then open terminal and execute this command:
chkconfig --level 345 my_own_script on
Then restart you computer and you can see a directory named 'folder' on your desktop in each start up. For more details, use:
man chkconfig
The mkdir command can be replaced by your own custom scripts. This worked on my PC powered with fedora 12. I found in linux forums that, it will work on Redhat/CentOS/Mandriva.
Start up programs are sometimes irritating and delay start up. So if you want to turn off your script from next start up, use command:
chkconfig --level 345 my_own_script off

Saturday, January 16, 2010

Swathanthra Malayalm Computing

Note:- Malayalam is the mother tongue of Kerala (India). I don't know people other than keralites interested in it.

I will be a little verbose, if I am telling about my childhood and my mother tongue - Malayalam. It intrude in my words, however I try to hide that. Everything I first heared in Malayalam - stories, poems everything and of course, I first read the Holy Bible in Malayalam. Now what about Malayalm computing?? Now the Open source community offers "Swathanthra Malayalam Computing" for Linux Systems. Just see the Ubuntu malayalam desktop below(this picture is not captured by me. Thanks to http://arunmvishnu.com/).Visit official website of SMC.
You can turn your desktop into full fledged Malyalam desktop if you follow the instructions in the official page. I am not intended to copy the same instructions in the official page.But the following links will be useful:
  • If you can't read anything from SMC, your browser probably haven't the malayalam font installed. I purposefully doesn't added any malayalam words in this post in order to clearly read those who haven't their firefox installed with malayalam plug in. Today onwards, you can easily read any malayalm websites on your firefox. Here is the solution.
  • Mozhi:You can write malyalam articles of your own using Varamozhi. I personally felt a little difficulty in writing malayalam in Mozhi compared to blogger. But Mozhi offers a unique english character bunch to represent a malayalam letter.
  • A guide for malayalam in computer.
  • Download Debian Lenny in malayalam.
  • Have a look at Wikipedia in malayalam.
Some malayalm blogs:
http://berlytharangal.com/
http://karinkallu.blogspot.com/
http://workersforum.blogspot.com/
http://vellezhuthth.blogspot.com/
http://rajvengara.blogspot.com/
http://marjaaran.blogspot.com/
This is a small list and you can see several hundreds  of Malayalam blogs by searching with a keyword something like 'malayalam blogs list' or in this link.

Friday, January 1, 2010

PYRO : Python in hand with Robotics

Python developers all over the world are searching for fields that are not involved python. I recently found a good job by them - a boon for robotics enthusiasts - that is Python Robotics or simply Pyro.

Go to pyro project page

Download Pyro live CD

Many built-in python scripts are there to define the robotic brain and paths. Of course, you can write your own scripts. Anyway, pyro is a wonderful experience.

I encountered a problem while booting from pyro live CD. It seems to be mother board and chipset specific. My problem was, no x start up. It hangs up when displays "Probing/Loading AGP Modules...". I used several knoppix cheat codes to enter into kde desktop. It was successful. Thanks to knoppix developers forum. The boot time cheat code i entered is:

knoppix noagp

If you encounter any such problem, try to search for knoppix boot problems and not for pyro boot problems.

Tuesday, December 29, 2009

Gui front end for parallel port controller in Linux

A graphical front end for the parallel port controller in Linux was my dream and I just satisfied it in my Xmas vacation. I used Qt framework from Nokia. I just put here everything I did. Of course you are allowed to download and use it under GPL (GNU General Public License). You are appreciated to modify source code according to your needs.
Now the program supports only on Linux platforms even though qt frame work is independent of platform. The reason is that, parallel port controlling is directly depend upon the OS you are used. You can easily control your parallel port in MS DOS environment, but things become worse when you try in Windows XP. Since the program calls the ioperm() function, you should have root privileges. Otherwise an abrupt exiting of the program occur. You only need to do the following things:
  • Be root, and start the program by ./parport2. Try to open it from terminal at least for the first time in order to track bugs.
  • Click 'Initialize' to call ioperm(). If you are not root, then the program abruptly exits while you click it.
  • Nothing will be happened at outside while you click in 'Initialize'.
  • You can use 8 switches to turn on or off the output data ports.
  • The current output value in decimal is displayed on lineEdit.
Most probably the executable version will not work in your system unless your system configuration matches with mine. So it is recommended to compile entire program using qt. You need to have qmake installed in your system (qt-dev-tools). The compiling instructions for qt program is beyond the scope of this post.

Download parport.tar.gz (1.4MB)

I tested it in my PC and worked without any problem.
Warning: Take care while you play with parallel port. Very rarely, the after effect may fatal.
Note:- This program is intended for educational purposes only. May not be updated until anyone report a bug or a request to modify.

Saturday, October 17, 2009

Let's do a simple hack!


If you are not aware of the difference between the words 'Hack' and 'Crack', I recommend you to hear what wikipedia says. Anything you want to do in a propitiatory program like MS Windows which is prohibited by license or it is not intended to do so may be called as crack. But the word 'hacking' has a great meaning which is different from 'cracking'. You can do anything on your open source program. If you are trying to crack your Linux OS which is open source, it may be called as 'hacking'. What is I want to say is that, an open source program can't be cracked because, they provide source code and hacking (cracking!) is allowed by license. If you are trying to beat an open source program, surely it will become a part of development. So an open source program can't be beaten. Hacking is intended for fun, especially by applying intellectual skills on something and and allowed by law. If anything you find violating the law, please call it as 'crack' not 'hack'.
If you are a beginner in Linux, like me, this simple hack will really attract you. This hack is done in my pocket slax 6.1.2 which is installed on my USB pen drive. But you can do this in any linux based distro which has a boot splash screen or login screen. The only thing you need to do is,
Navigate to /boot directory. In pocket slax, it is situated in the following path:
system:/media/sda1/boot
Then you can see one or more image files with .png extension. In slax, it is 'slax.png'. Edit this picture with a suitable image editor and change as you like it. For example, type "Hacked by ". It is interesting that you see your name at every boot up. If you are interested, you can put your photograph. But it is recommended that, you should not change the size of the image. Also, you should not change the name of the image. Of course, you should copy the original image.png file to any other directory in order to undo everything you have done.

Saturday, October 10, 2009

Mouse gestures for Mozilla Firefox


Mozilla Firefox one of the leading power of internet browsers, shows its real power and beauty only when the appropriate add on-s are installed. You can download and use them from Firefox add on page. There are a plenty of add-ons available and no need to specify which is good because it greatly depend upon your tastes. Recently I installed an add-on named All-in-one gestures and I feel it very interesting. You can install by clicking 'add to Firefox' button as you usually do while installing add-on. There provision to change the gesture pattern in the 'preferences' mode. Mouse gesture means that, some operations you done in Firefox such as 'back', 'forward', 'refresh' etc can be done simply by moving your mouse. I experienced no problem with both Windows and Linux platforms. There are tons of interesting add-ons like this. It is really fun to experiment with Firefox add-ons.

Friday, September 11, 2009

Make your own animations using Gimp


Hey Gimpers,
Gimp is not only an 'image manipulation' program. You can build your own animations using Gimp. It is very very easy. Just try it. There are plenty of tutorials available on the Gimp official website.
Click here for a nice and intuitive video tutorial.

Friday, August 28, 2009

Slax- A brief review

Yesterday, I found some good stuff on the official website of Slax (It is a simple but very beautiful distro. Yes, it's build up of KDE). Website itself is very cute and everything is simple as like SUSE or Mandriva. I know some real geeks may not like the entire structure of slax, but it will be stunning those who were allured with Microsoft Windows OSs. The simplicity makes everything easy.
One more advantage is that they give a free 30MB online memory which can be easily be used like ordinary disk drives. The memory of 30MB is free for slax users for unlimited period even if you didn't use it for a long time (The info is from the official blog, the unlimited period may be varied. But they didn't commented about it yet). You can use the online memory from any machines that supports slax, or any other OS, even Windows. A 200MB iso file or tar file is to be downloaded in order to make a liveCD or USB. I installed latest version of slax (slax6.1.2) to my SanDisk Cruizer 4GB pendrive and it works fine. A live CD can easily be created, but to do USB installation, you need to work for 2 minutes.
The whole procedure can be done in your windows platform itself. Try this link.
Another fantastic feature I've seen in their website is to run an application without actually installing on our system known as 'activat'ion. Almost all general purpose applications are available as .lzm binary format which is ready for the installation without any dependencies. You can select which software you want to use from modules page. There are three options - first to download (normal download for later installation), secondly 'add to build' which helps to customize your distro before download. If you want to check whether the software listed is good, just do the third method -activate. Then you can use the software as you have installed it in your system, but actually not.

The major advantage is that it is pocket linux (handy) and can be used everywhere. But personally I felt that it has less hardware support compared to Puppy Linux. But I stil like slax because of it's greenish beauty!

Happy slaxing!

Wednesday, August 26, 2009

Linux Demo? What's the hell?

One of the reason why I love linux a lot is that it has no barriers at all. Many programs usually comes as a demo version which will not not be as much handy as a proffessional or full version. Demo versions seems sometimes nasty, and is too dry to wet out appetite. So I hate the word 'Demo' itself.
But what's going on there is the arrival of "Demo Linux". I just wondered for a while and navigated to the official website.
But I found there is nothing to afraid and found some good stuff. How many of you felt boring while repeatedly installing and formating to find a suitable distro. Live CD's reduces this problem to a great extend. But now this problem is greatly dealt by Pendrives (Memory stick). Demo Linux is specially built linux distro to be alive!. That means there is no need of a hard disk at all. A 32MB of RAM is enough to work with it. Hope it will be useful for those people who loves to be small.
Also read about Puppy Linux Slax and Kolibri

Wednesday, July 22, 2009

Teach your computer how to speak!

It is good idea to teach computer to speak!. There a number of programs available for winXP paltform, but here is a unique program "espeak" for your linux. Just enter the command in terminal,

$espeak "Boss, I can speak now"

will work fine. It is useful for some scripts in linux to remind some status of computer to the user like a personal assistant. espeak is not an internal bash command and need to be installed. I simply installed in my Debian from repository.

#apt-get install espeak


The command above will work well with ubuntu systems also. If you are using any other distro, you need to download and install it manually. Click here to know more.

Here is a simple python program which uses espeak as system command. To use it you require python and espeak installed.

#! /usr/bin/python
# File: speak.py

import os
from Tkinter import *

class App:

def __init__(self, master):

frame = Frame(master)
frame.pack()
self.button = Button(frame, text="Click", command=self.activate)
self.button.pack(side=LEFT)


def activate(self):
os.system('espeak "Boss, I can speak now"')
print "Boss, I can speak now"

root = Tk()

app = App(root)

root.mainloop()

Just copy the above program into a new file named speak.py and 'cd' into the directory and enter,

python speak.py


You are free to use this program anywhere since espeak is under GPL.

Friday, June 12, 2009

Play with "cdrom" in Linux

Linux comand shell "bash" is powerful as we know. Here is a fun with bash. You can control your cdrom using 'eject command'. Here is only a simple description. For nore details, you should look at it's man pages.

This is not a project or something serious. just for fun. You can control your cdrom by using this code. This will only work on Linux platform. I did it in fedora core 9. But it will work other disro's also.

!!!!!!!WARNING!!!!!!!!
1)Some procedure described in this article is not a recommended or the hardware devices are intended to work like it. Do it in your own risk.
2)Don't interrupt the way the hardware working (the movement of CD ROM tray by your hand).

Open your 'cdrom' tray under software control
Try this command

$eject cdrom


It will try to open your cdrom tray. if you have two or more cdrom drives, try

$eject cdrom0


If you havn't any cdrom device, bash will return an error message:

$eject cdrom2
eject: unable to find or open device for: `cdrom2'


You can find your device name ( "cdrom0', 'cdrom1' etc.) from "/media"

Close your 'cdrom' tray under software control
Try this command

$eject -t cdrom


Other useful parameters are there in 'eject'. You can read about it:

$man eject


Writing a bash script
Just entering the command at a time is not convenient. You can write some commands together and execute it when you want.
Open a new file using gedit editor (or any other you want)

$gedit cdromplay


A winow will appear and type what you want. For example, if you want to open and close your cdrom continously three times just print like this:

eject cdrom
eject -t cdrom
eject cdrom
eject -t cdrom
eject cdrom
eject -t cdrom


save it and close.
Then to resolve permission,

$chmode +x cdromplay

Then execute cdromplay

./cdromplay


You can see what I said before.

Do it in your real applications
As you know, we did some rubbish things before. There is no need to do so. But this is useful in some applications like CDburner - It will automatically eject tray after writing a CD ROM or you can control convineiently in a CD ROM player. We can use python to do a GUI application.

# File: cdromplay.py

import os
from Tkinter import *

class App:

def __init__(self, master):

frame = Frame(master)
frame.pack()
self.button = Button(frame, text="Quit", command=frame.quit)
self.button.pack(side=LEFT)

self.hi_there = Button(frame, text="Eject", command=self.say_hi)
self.hi_there.pack(side=LEFT)

def say_hi(self):
os.system("eject cdrom1 -T")
print "boss, cdrom activated"

root = Tk()

app = App(root)

root.mainloop()

As you can see, the above program is the altered version of "Hello World!" program of one famous python tutorial. Don't get upset or confused by the defnition names. The confusion in program code will not affect the real program.Copy and save it or download it from here. You require python to do this. 'cd' to the appropriate directory and run,

$python cdromplay.py


Now you will see a simple widget with a button.


Press button and observe what's happen.



Download cdromplay for python
Download cdromplay bashscript

Watch the video how cdrom is ejected:

Good Luck!