Monday, June 20, 2005

Think of children in India

I got this nice message from shahnawaz today on my y!.
Speech by Thomas Friedman of The New York Times.... "When we were young kids growing up in America, we were told to eat our vegetables at dinner and not to leave them. Mothers said, 'think of the starving children in India and finish the dinner.' And now I tell my children: 'Finish your maths homework. Think of the children in India who would make you starve, if you don't.'"

Wednesday, June 15, 2005

20 Questions

I got this link from yogesh. Really makes one wonder what kind of stretagy might have been used inside. fuzzy logic ? refinement of possibilities using answers? whatever, it is, really an intelligent work to build up such an intelligent system.

Tuesday, June 14, 2005

Cutting and Joining video clips through mencoder ( mplayer)

to cut, use

mencoder uncut.avi -ss 0:20 -endpos 10 -ovc copy -oac copy -o cut.avi

-ss is for starting position and -endpos is for ending position. Use man pages for more detail.

For joining, I have got this script from somewhere, I never tried it myself though :-)

# $Id: join-avi-files,v 1.3 2004/09/26 16:10:36 thor Exp $
# Tom Moertel
# Usage: join-avi-files outfile.avi in1.avi in2.avi ...
# This program joins the given movie files in1.avi, in2.avi, ...
# and saves the result as outfile.avi. Although the name is
# join-avi-files, this program will join any kind of movies,
# provided that mplayer knows about them and that the movies
# all use the same codecs, resolution, stream rate, etc.

# Copyright (C) 2004 Thomas G. Moertel.
# All rights reserved worldwide.
# This code is licensed under the GNU General Public License, version
# 2 or greater. It is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# General Public License for more details.


# preflight inputs

if [ $# -lt 2 ]; then
echo Usage: $(basename $0) outfile.avi in1.avi in2.avi ... 1>&2
exit 1;

# shift the output file from the command line


# as a safety precaution, make sure the output file doesn't already exist

[ -f "$outfile" ] && {
echo "$outfile already exists; aborted." 1>&2;
exit 2;

# create a temporary directory in which to do our work

tmpdir=$(mktemp -d join-avi-files-XXXXXXXXXX)
[ -d "$tmpdir" ] || { echo "can't make tmp dir" 1>&2; exit 3; }
mkdir "$tmpdir/in" || { echo "can't make in dir" 1>&2; exit 3; }
mkdir "$tmpdir/out" || { echo "can't make out dir" 1>&2; exit 3; }

# make sure the temporary directory is cleaned up

cleanup() { rm -rf "$tmpdir"; }
trap cleanup 1 2 3 5 13 15

# massage each input file into valid form

for infile in "$@"; do
echo === SCANNING INPUT: $infile ===
base=$(basename "$infile")
mencoder -idx "$infile" -ovc copy -oac copy -o "$tmpdir/in/$counter-$base"
counter=$(( $counter + 1 ))

# merge the massaged input files

echo === WRITING OUTPUT: $outfile ===

outbase=$(basename "$outfile")
cat "$tmpdir/in/"* > "$tmpdir/$outbase"
mencoder -noidx -ovc copy -oac copy -o "$outfile" "$tmpdir/$outbase"

# clean up and exit with success

echo Done!

exit 0

Quotes Collection

Here is the quotes that i liked and collected. none of them are mine :-) but i just liked them.
* " Everything is OK at the end, if it's not OK, it's not the END. "
* " An alcoholic has been lightly defined as a man who drinks more than his own doctor. "
* " A mind stretched by a new idea never goes back to its original dimensions. "

* " Stability is not achieved by immobility: try to sit on an immobile bicycle! "
* " Luck favours those who don't believe in it. "
* " An expert is someone who takes a subject you understand and makes it sound confusing. "

* " Where there's a will there are five hundred relatives. "
* " Always remember that you are absolutely unique. Just like everyone else.. "
* " Death is hereditary. "

* " God is real, unless declared integer. "
* " Two wrongs don't make a right, but three rights make a left. "
* " In a country of free speech, why are there phone bills?? "
* " I would like to change the world, but they won't give me the source code! "
* " #define question (bb || !bb ) -- by Shakesphere "

* " On the other hand... you have different fingers! "
* " When you come to a fork in the road, take the 'right' path, else you must take the path that is 'left'. "
* " If you can stay calm, while all around you is chaos..then you probably haven't completely understood the seriousness of the situation. "

* " A person who truely loves u and knows u, is someone who sees the pain in ur eyes while EVERYONE else still believes in the smile on ur face "
* " Windows not found: (C)heer, (P)arty, (D)ance? "
* " How many of you believe in telekinesis? Raise my hands.. "

* " I do know everything, just not all at once. It's a virtual memory problem. "
* " For every problem there can be multiple solutions, and the simplest one is usually neglected....! "
* " Never interrupt your enemy when he is making a mistake. "

* " A psychologist is a man who watches everyone else when a beautiful girl enters the room. "
* " A common rule of thumb, Too clever is dumb! "
* " If swimming is good for your figure, explain whales to me. "

* " Windows NT encountered the following error: The operation completed successfully. "
* " The best Windows accelerator is that which works at 9.81m/s2 "
* " Gates' Law: Every 18 months, the speed of software halves. "

* " Your mouse has moved. Windows NT must be restarted for the change to take effect. Reboot now? [ OK ] "
* " Double your disk space - delete Windows! "
* " Linux, DOS, Windows NT -- The Good, the Bad, and the Ugly. "

* " Efficiency is intelligent laziness. "
* " The nice thing about Windows is - It does not just crash, it displays a dialog box and lets you press 'OK' first. "
* " 47.5% of all statistics are made up on the spot. "

* " To Guess Something Is Easy, To Guess Something Wrong Is Expensive. "
* " The one who says it cannot be done should never interrupt the one who is doing it. "
* " If our brain would be simple enough for us to understand it, we would be too dumb to understand it. "

* " Speak less to people whom you love most....B'coz if they cant understand your silence....They can never understand your words. "
* " I refuse to believe in a risk-free society where the thrill of living is traded for the safety of existence. "
* " I might change my mind.. If someone offers me his instead. "

* " Remedy for hard times : Salt Water : be it sweat, tears or sea. "
* " manzilein unhi ko milti hai jinke sapno me jaan hoti hai, pankho se kuchh nahi hota, honslo se udan hoti hai. "
* " The worst part of life is to wait. The best part is to have someone worth waiting for. "

* " Live as if you were to die tomorrow, Learn as if you were to live forever. "
* " The surest sign that intelligent life exists elsewhere is that it has never tried to contact us. "
* " When I was born, I was so surprised I couldn't talk for a year and a half. "

* " It's so simple to be wise. Just think of something stupid and don't say it. "
* " Always put worry in its proper place, i.e. OUT OF YOUR LIFE. "
* " It is not as difficult to apologize as it is to live with a guilty conscience. "

* " Teachers are those who help us in resolving problems which, without them, we wouldn't have. "
* " Mind is consciousness which has put on limitations. You are originally unlimited and perfect. Later you take on limitations and become the mind. "
* " Once you make a decision, the universe conspires to make it happen. "

* " I Never forget a face, but in your case i'll be glad to make an exception. "
* " Everyone has a photographic memory. Some just don't have any film. "
* " There are two ways to write error-free programs. Only the third one works. "

* " A true friend never gets in your way, unless you happened to go down. "
* " Its better to lose your pride for someone you love, than to lose that someone you love for your useless pride "
* " Map out your future... but do it with pencil. "

* " Always upgrade your processor to the fastest avaliable so that you can reboot windows faster. "
* " Excellence is not a destination; it is a continuous journey that never ends. "
* " If you aim for nothing, that's exactly what you'll hit: nothing. "

* " I'm a nobody, nobody is perfect, and therefore I'm perfect. "
* " Sometimes I need what only you can provide: your absence. "
* " Since light travels faster than sound, people appear bright Until you hear them speak. "

* " It is better to burn out than to fade away. "
* " I was an atheist until I knew I was GOD. "
* " I am not sincere, even when I say I am not. "

* " Impossible = I m possible "
* " Believe that you can't be beaten and you won't "
* " A moments insight is sometimes worth a life's experience "

* " In matters of style, swim with the current,In matters of principle, stand like a Rock "
* " It doesn't take a lot of strength to hang on,but it does take a lot to let go "
* " Life is not measured by the breathe you take,But by the moments that takes your breathe away "

* " You don't love a woman because she is beautiful,But she is beautiful because you love her "
* " Before : dream about IIT in sleep,After : dream about sleep in IIT "
* " Ever wondered why it is called 'common' sense when few seems to have it? "

* " If debugging is an art to remove bugs from the program, then programming must be an art to insert them. "
* " Diamond is just a piece of coal, with a bit more endurance. "
* " I have got no is always alone at the top. "

* " I have the simplest choice, I am always satisfied with the best. "
* " If you try, you risk failure; if you don't you ensure it. "
* " I was born genius, but education ruined me. "

* " Err and err and err again but less and less and less. "
* " Marriage is not a word, it's a sentence.... a life sentence. "
* " There is never a wrong time to do a right thing. "

* " Like a spring beginnings of all things are small. "
* " My brain has two parts : left has nothing right in it, right has nothing left in it. "
* " Horrible ( complex ) answers are most probably the wrong answers. "

* " A thousand lions led by a donkey can be defeated by a thousand donkeys led by a lion. "

Sunday, June 12, 2005

Plane faresearch

found this link on cse.mtech2, it's handy to get an idea of airfares. i
may need it sometime :-)

List of NP-Complete Problems

I was just wondering whether the problem that i am stuck up with have any resemblence to any of the NP-Complete problems. The problem that i am encountered with is so close to some of them, however, the difference is, placing one cut in the circuit graph changes the weight of the edges. So unlike some of the NP-Complete problems, I am facing a dynamic problem.

Here goes the link where I found out list of NP complete problem. I dont know whether this is an exhaustive listing or not.

Monday, June 06, 2005

Emergency calls through Nokia handset

I was just going through the newsgroups today. As usual the iitb.general was the last to be read :-). There I found one important information.

For Nokia handsets, 112 is the emergency number. It works even if the keypad is locked or even if SIM is not inserted :-O. this was a very surprising thing to note. However, in the posting it was also mentioned that 100 does not work but when I, I hangup as soon as I heard it ringing.

People should verify the things before posting on to newgroups. Someone might actually try it!!

Exporting sound and display in linux

well, i knew long ago how to export a display from a remote terminal. this helps to get display for graphical applications that one may want to run on remote machines.

At the end where you are sitting (server) the thing that you have to do is

$ xhost +
which will disable access control and any client can connect to the running X server.

at the client side ( where you have remotely logged in )

$ export DISPLAY="servername:terminal"

terminal numbers start from 0.0.
If you are not sure of which terminal you are using just run the following command on the server

$ echo $DISPLAY

which will give you the terminal number that you should be using at the client side.

Alternatively, a very simple method for doing all this in just one shot is that while logging in to a remote machine

# ssh -X remotemachine

this will do all the above mentioned thing for you.

for sound also the procedure is the same.

on server
# artsd -p portnumber -u

you can select any portnumber which is greater than 1024 and not already in use by some another application. -u will disable the access control. for more options
# artsd -h
this will provide you all the available options for arts deamon.

whereas on the client side
# export ARTS_SERVER="servername:portnumber"

you can also provide IP addresses instead of giving names in the environment variables.

If your mplayer still does not produce sound than you should check which audio output mathod it is using. one can specify a particular audio output mathod using

# mplayer -ao arts filename

Now, you can login to remote machines and enjoy the songs/movies etc. :-)