Dreams of Thought

Are dreams thoughts… or are thoughts dreams..

RSS Feed

Monthly Archives: June 2009

Michael Jackson is no more

0 Comments

Michael Jackson is no more.

Paramedics were called to the singer’s home around midday local time on Thursday after he stopped breathing.

He was pronounced dead two hours later at the UCLA medical centre. A spokesman for the centre said the star died of a suspected heart attack.

There’s hardly a human begin in the world who would not have heard of this man. I didn’t really grow up listening to a lot of what we call “western music”, but even for me as a child he was a legend. Who does not know of the moonwalk and all those moves that he made so famous. He was a musical genius no doubt, but he was famous for more than that. He will be remembered for generations to come not just as a musician but the controversies surrounding him, the causes he championed and for the sheer story of his life.

At this moment, I believe it’s important that we recognise the great things MJ did as a musician and human being. We recognise him for the causes he championed. We listen to the message in his life. When this man goes down in history, let us remember the value he gave us.

Rest In Peace, MJ.

Filed under music
Jun 25, 2009

How to join split files

0 Comments

This is sort of a follow-up to my previous post which talked about how you can use the split command in Linux to create split files which can be joined with hjsplit on Windows. My theory is that hjsplit does the same thing split does – which is just take the file and split it into the required number of pieces. No special headers or padding or compression or stuff. If that’s true, it should be easy as a pie to join the files split with hjsplit

To join files split with split, what I would do is use cat. Like this :
$cat xaa xab xac xad xae > debian-testing-i386-DVD-1.iso

Here xaa, xab, xac, xad and xae are the split files and debian-testing-i386-DVD-1.iso is the file after the join. I believe this should work fine for split files got from hjsplit too. Since I’m too lazy to go try it out in my friend’s Windows machine, I’ll leave it here at that. Do let me know if anyone’s tried it :)

Filed under Linux
Jun 24, 2009

hjsplit and linux split

2 Comments

The other day I had to fit in a 4.4 GB file (A Debian testing dvd iso image, if you want to know) on a 4 GB thumb drive. This, of course, is not possible. So I had to split the file into chunks, transfer them twice, take them to my friend’s windows machine and use hjsplit to join the files. How did I split the file so hjsplit could read it, when I didn’t use the linux version of hjsplit?

It looks like hjsplit splits its files by just cutting them into pieces. This is exactly what is done by the split command. Which is probably why I could use the linux split to split the file into a format hjsplit could join.

You could use a command similar to this one if you want to try it out :

$ split -b900M -d /home/anirudh/downloads/debian/debian-testing-i386-DVD-1.iso debian-testing-i386-DVD-1.iso.

the ‘-b’ option is used to specify the size of each chunk – 900 MB in this case. ‘-d’ means the output should be numeric (000,001,002…). Now we specify the large file and a prefix to attach to the generated filenames (note the dot at the end). This command will generate files :

debian-testing-i386-DVD-1.iso.000

debian-testing-i386-DVD-1.iso.001

debian-testing-i386-DVD-1.iso.002

debian-testing-i386-DVD-1.iso.003

debian-testing-i386-DVD-1.iso.004

Now this should be relatively easy to join with hjsplit. Do some renaming if required.

 

Edit :

meaculpa has noted that split starts renaming its files with 000 and not 001 as required by hjsplit. Please check his comment below for the solution.

As a follow up to this post, I had written another on how to join the split files in linux. You can check it out as well.

Filed under Linux
Jun 23, 2009

Intel 8085 microprocessor simulator

0 Comments

My friend Arun created an Intel 8085 microprocessor simulator as a hobby project sometime in his college. It’s written with php and javascript.

If you’re into 8085 programming, do try it out and let me/Arun know.

http://labs.kitiyo.com/8085/free-online-assember-simulator-8085.html

Jun 23, 2009

Useful vim commands

2 Comments

I use vim at work for most of my text editing purposes. Vim is a very powerful editor. However, it comes with a somewhat steep learning curve. The best place to learn it would be the vimtutor program. It’s got a pretty good “for dummies” approach which is useful if you haven’t used an editor even remotely powerful as this one before. If you’re short of time, the best way to learn it is to just jump in and start using it. Since it’s been around a long time, it has pretty much most features a developer needs. So if you have a need and don’t know how to get it done with vim, then use this site.

To start off using vim, let me give you a very quick and dirty first few steps. To open a file, simply use vim <filename>. You most likely have vi pointing to vim. Plus, most of these commands work with other vi’s anyway. So I’ll be using vi instead of vim henceforth.

Now that you have a file open, you would like to enter some stuff in? The basic thing you need to know about vi is that it has many modes. From the default mode(command mode) you need to press ‘i’ to enter the insert mode. In this mode you can type stuff in and it will show up on the screen. The command mode is where you issue commands to vi (But you can’t enter text). To go back from the insert mode to command mode press the escape key.

Now that you’ve typed some random stuff in, escape to the command mode. Now try pressing ‘:w’ i.e. (shift+;)w. W is for “write”. This saves the file and leaves you still in the editor. If you want to get out of the editor, you type in one more command ‘q’ so it becomes ‘:wq’. In case you want to get out of it without saving, use ‘:q!’. The other way to save and quit is to go to the command mode and hit shift+z+z.

With vi, the traditional way to navigate (in command mode) is to use l,k,j,h keys(right,up,down,left). That’s like the a,w,s,d in gaming. It’s a timesaver for people who are comfortable with it. Vim allows you to use the arrow keys as well, which is a real convenience.

That covers the bare minimum basics for us.

Once you start using vi you start looking for ways to accomplish tasks using it. There is a whole lot of material out there in the World Wide Web which will help you out. Google is your friend, use it :)

I will tell you some of the frequently used options/shortcuts I use with vim.

Going to a specific line : Type in ‘:25′ to go to line number 25 (in command mode). You can open a file at a specific line by typing

$ vi +25 FILENAME

This will open the file and take you to line 25. Now that you’re there, perhaps you would like to delete the next 5 lines? No problem – just hit d5d. The 5 in the middle says 5 and dd is for deleting lines. You will find this a common pattern with most vi commands. Just hitting dd will remove a single line. Similarly you can do d5w to remove 5 words and dw to remove a single word.

Copy paste is a walk in theĀ  park. Hit y7y to copy 7 lines. Now press p to paste. That’s it. Cut paste? Hit d7d and then press p to paste after navigating to where you want to paste it.

The other approach to doing all this is to send a command. Hit ‘:201,225y’ to copy lines from 201 to 225. Similarly ‘:201,225d’ deletes lines from 201 to 225. To jump to a line you can use ‘:25′. This jumps to line number 25.

One useful shortcut when you don’t want to remember the line numbers is the use of markers. I can mark any 2 lines , say line numbers 201 and 225, and perform an action on them by using the name of the markers. Go to line number 201 and hit ‘ma’. This will mark that line with the marker ‘a’. Do the same with line 225 and mark it with ‘b’. Instead of uisng ‘:201,225d’ to delete lines 201 to 225, now you can use the a and b markers to delete the lines thus – “:’a,’bd”.

That was just a small snapshot of the commands that I use on vi. You can use a lot other features, like for instance macros, and enhance your editing experience. This should help you get started though. Let me know if this has been useful. Good luck and happy hacking :)

Filed under Linux, technology
Jun 4, 2009

The most difficult captcha there is

5 Comments

I was browsing through the site of a celebrity recently and came across the contact page. I was shocked to find the captcha there. Take a look yourself and be amazed : http://www.gulpanag.net/contact_gul_panag.php

Why would anyone display the captcha as text ready for a bot passing by to read? (It’s even got a nice class – captchas – wrapping it) Is that some kind of a honeypot? Is that a dummy form? Does the site admin feel lonely because no one sends him/her mail and is hoping to at least read spam?

Jun 2, 2009