Suramya's Blog : Welcome to my crazy life…

September 3, 2009

Sort a file list by Date in Linux (Including Subdirectories)

Filed under: Computer Tips,Linux/Unix Related,Tech Related — Suramya @ 7:35 PM

I use Amarok to play music and I really like it, however my Playlist was created in Winamp/XMMS which I initially thought that Amarok couldn’t read. So all the new music I got since I switched to Amarok was no longer being added to a playlist, I just added the new songs manually then used the select 50 random songs option to play music.

Yesterday I figured out that Amarok does indeed read .m3u files (Winamp Play lists) so I wanted to add all the new music I have to the top of the old playlist. So basically I needed a list of all music in my system sorted by date. If you have been using Linux and are reasonably familiar with it then I think the first thing that came to your mind must have been: “Why can’t we just use ls -lRrt”? That’s pretty much what I thought. But unfortunately this command doesn’t work very well for what I wanted to do.

After playing around for a while I finally managed to get the system to show me a list of all music files in my system sorted in reverse chronological order. The command I used for this is:

find -name "*.mp3" -print0 | xargs -0 stat --format '%Y %n'|sort -r

Now the explanation:

  • find -name “*.mp3” : returns a list of all mp3 files in the current directory and any subdirectory under it.
  • -print0: This tells find to use the ASCII NUL character instead of space to separate the filenames. If we don’t use this then xargs chokes on the spaces in file names.
  • xargs -0: This tells xargs to use the ASCII NUL character instead of space to separate the filenames.
  • stat –format ‘%Y %n’: This runs the stat command on every file returned by find. This command returns the Time of last modification as seconds since Epoch followed by the name of the file.

    e.g.

    suramya@Wyrm:~$ stat --format '%Y %n' unison.log
    1251802152 unison.log

  • sort -r: sorts the list using the first column (the creation time) and displays the result.

——-

Example execution result in my Scripts directory:

suramya@Wyrm:~/bin$ ls -l
total 2648
-rwx------ 1 suramya suramya      77 2009-01-10 04:30 bookfixer.sh
-rwx------ 1 suramya suramya      76 2009-01-10 04:30 cardDesigner.sh
-rwx------ 1 suramya suramya     548 2009-01-10 04:30 change_wan.sh
-rwx------ 1 suramya suramya     478 2009-01-10 04:30 compare_entire_dir.sh
-rwx------ 1 suramya suramya    3462 2009-01-10 04:30 delay.pl
-rwx------ 1 suramya suramya      66 2009-01-10 04:30 EditPlus
-rwx------ 1 suramya suramya      88 2009-01-10 04:30 export_xterm
-rwx------ 1 suramya suramya     203 2009-01-30 04:29 extract.sh
-rwx------ 1 suramya suramya   82558 2009-01-10 04:30 lit2html
-rwx------ 1 suramya suramya     320 2009-01-10 04:30 makedir.sh
-rwx------ 1 suramya suramya      49 2009-01-10 04:30 mapsql
-rwx------ 1 suramya suramya     369 2009-01-15 02:11 MuteUnmute.sh
-rwx------ 1 suramya suramya 2350194 2009-01-10 04:30 pdftohtml
drwx------ 2 suramya suramya    4096 2009-01-10 04:30 Poet
drwx------ 2 suramya suramya    4096 2009-01-10 04:30 Remote
-rwx------ 1 suramya suramya     109 2009-02-08 19:47 resize.sh
-rwx------ 1 suramya suramya      48 2009-01-10 04:30 rootscan
-rwx------ 1 suramya suramya     397 2009-01-10 04:30 S41firewall
-rwx------ 1 suramya suramya     111 2009-02-21 20:15 sync_website.sh
-rwx------ 1 suramya suramya     116 2009-01-10 04:30 text2img
-rwx------ 1 suramya suramya     122 2009-01-10 04:30 uncompress.sh
-rwx------ 1 suramya suramya  180580 2009-01-10 04:30 vcdgear


suramya@Wyrm:~/bin$ find -name "*" -print0 | xargs -0 stat --format '%Y %n'|sort -r
1235227520 ./sync_website.sh
1235227520 .
1234102660 ./resize.sh
1233269990 ./extract.sh
1231965676 ./MuteUnmute.sh
1231542033 ./vcdgear
1231542033 ./uncompress.sh
1231542033 ./text2img
1231542033 ./S41firewall
1231542033 ./rootscan
1231542033 ./Remote/StarFlight
1231542033 ./Remote/Firestorm
1231542033 ./Remote/CyberNibble
1231542033 ./Remote
1231542033 ./Poet/poet.tar.gz
1231542033 ./Poet
1231542033 ./pdftohtml
1231542033 ./mapsql
1231542033 ./makedir.sh
1231542033 ./lit2html
1231542033 ./export_xterm
1231542033 ./EditPlus
1231542033 ./delay.pl
1231542033 ./compare_entire_dir.sh
1231542033 ./change_wan.sh
1231542033 ./cardDesigner.sh
1231542033 ./bookfixer.sh

As you can see, the ‘sync_website.sh’ script is the latest script in that directory.

Hope you find it useful.

– Suramya

September 1, 2009

Bio-computers – The downsides.

Filed under: Computer Related,My Thoughts — Suramya @ 10:23 PM

Was watching Eureka (Its a TV show, about this town with brilliant scientists) and they had an episode a little while ago where an organic computer got infected with a virus and got transmitted to a person when they used it.

This made me think, this can really happen once organic computers start becoming commonplace. After all human beings are pretty much an organic computer with a pretty face. So it would become possible to send an email attachment to a target group (lets say an enemy country) and infect their bio-computers. Then the virus would copy itself over to the human operator and set itself up as a background process in the human mind (There is more than enough processing power in the human brain for this) and once its set up it could monitor all actions/thoughts etc and keep a log of everything that person does, this data would then be sent back to the creator of the worm/virus to be used as seen fit by them.

The virus could even take over the human and make them do stuff that they wouldn’t normally do (like treason, or espionage) and I don’t think there is an easy way we could detect something like this and prevent it from happening. It reminds me of a novel I read a couple of years ago where humans had chips implanted in their heads to allow them to process/store data and one of the character’s chip got hijacked and they could no longer control their actions. Now the same thing will be possible without any extra hardware implanted in the target.

I guess to counteract this we would have to have an anti-virus program for the human mind: “Scan your brain for virus’s and trojans today”. Before any secret meetings all participents would have to have their brains scanned.

To make things scarier governments could release a worm that let them keep an eye on their subjects and stop any activity they don’t like before it got far. Think “Big Brother” in your head…

Makes you think scared doesn’t it?

– Suramya

August 30, 2009

Heritage/Identity/Self pride… Some thoughts

Filed under: My Thoughts — Suramya @ 10:24 PM

Are we as a country loosing our self identity and are no longer proud of ourselves?

I don’t think so. But thats what some of the people I have talked to have told me. Being proud of one’s heritage is good but being militant about it is not. Take regional languages for example, in the Tamil Nadu Tamil is the dominant language, till 1998 they refused to talk to you if you spoke to them in any language other that Tamil. Now when I went there in 2007 that had changed. They still speak Tamil majority of the time but have stopped being militant about it and actually answer you when you talk to them in English. Does this mean that they are not proud of Tamil anymore? I don’t think so.

One of my friends in college was south-Indian and he used to joke that the south Indian languages sound like you take a box of cornflakes and shake them(He actually spoke pretty good tamil). Does that mean he is not proud of his language? Nope. It means that he had a sense of humor.

When I talk to someone who talks using big complicated words I have a tendency of making fun of the words they use and joking that people don’t understand half the words they use. Is it me being ‘not proud’ of Hindi as a language? I personally don’t think so… but others have told me otherwise. So I wonder…

Does having the ability to joke about something mean that you don’t respect it anymore? Or should you be a person who walks around with a stick up their backside getting upset about stuff that people joke about?

If you don’t have the ability to laugh at yourself then you have lost an important part of being human and you are on the way to believing that everything you do or say is correct and others should follow that. That in my opinion is what creates dictators and/or megalomaniacs.

Am I proud of being Indian? Definitely. But that doesn’t mean that I can’t joke about stuff that Indian’s do… I read Hindi books and novels, infact I have read a few hundred hindi novels. Does that make me a better Indian? If so how? Does preferring to read english novels (Hindi novels don’t usually cover sci-fi/fantasy) make me a person who is not proud of their heritage/culture?

What is the culture of a country? Is the culture we had 20 years ago the true culture of India? What about 40 years or a 100 years ago? Any culture continuiously evolves and attempting to stop the process at a specific time period doesn’t make sense and is not possible. Any person/country/culture that stops evolving will die and will be forgotten.

Just as an example, today if you ask someone to name the traditional dresses for women in India they will tell you Sari and Salwar-Kameej. However 100 years ago, Sari was considered to be something only girls into fashion wore, something that people nowadays have forgotten. Now Sari/Salwar-Kameej are the traditional dresses and Jeans/Skirts are something that girls into fashion wear. So culture changes. People evolve. Deal with it.

I agree that some jokes are bad and in poor taste, but that doesn’t mean that any jokes about that particular topic should be banned. As in all things a balance has to be maintained.

Well this is all for now. Its time for me to get off my podium and go read a book.

Cya,

Suramya

August 29, 2009

My Trip to Shimla

Filed under: My Life,Travel/Trips — Suramya @ 11:30 PM

Last week me, Gaurang and Kunal went for a trip to Shimla with Kunal’s Mausa (Mom’s sister’s husband). We had planned on leaving by 6 – 6:30 am on Thursday so I left from Noida at 5:20 am and drove to Gurgoan in my trusty on Maruti 800. (For those of you who don’t know, this car is about 25 years old with no AC). Got there in about an hour and we left from there at 6:35 am.

The road out of Delhi was thankfully not very crowded and even though we all were not really sure where to go but rather had a general idea of the route we made good time and made it past Karnal in about 3 hours. We stopped at a dhabba (Roadside Restaurant) a few miles past that and had breakfast. This set the trend for the rest of the trip which was more of a ‘Foods of India’ than a road trip. By this I mean that we ate and ate ate throughout the trip.

The trip to Shimla took us 10 hours because of the Traffic after Chandigarh and the curvy roads near Shimla so we finally reached there at 4:30 pm. After we got there we rested for a while at Mausa’s place (They stay in Shimla) and then drove back to main Shimla (They stay in New Shimla) and spent a couple of hours walking around on Mall Road. Most of the shops there closed up at 9pm so we were back home by 10 and were off to bed by 11pm.

The next day we got up by 7 and lazed around for a while, then came down for a huge breakfast. After which we relaxed till Mahak (Mausa’s Daughter) came back from School and then went back to Mall Road. Spent pretty much the entire day there and enjoyed the view, food and crowds.

On Sat we decided to drive to Kufri with Mausi and Mahak. On the way there we changed our minds to go to the Hot water springs instead. However when we came to the junction where we had to turn for the springs we saw that the springs were 58 Kms from that point so we went to Kufri instead which was only 7 kms. There wasn’t a lot to see there except the view and horses. Oh, and we also saw a Himalayan Yak there near the parking area. Since there wasn’t a lot to see there we decided that we would make the trip to the hot water springs to check them out.

If you think hilly roads are painful, try traveling on them with three people who get motion sick; one of whom is a 5 year old girl. We were pretty much stopping about every 15 mins because someone or other felt like they were about to throw up. We made it half-way to the springs before we gave up and stopped at Naldhera instead. Spent about an hour over there drinking tea and relaxing in the sun before we drove back.

Once we got back to Shimla we went back to Mall Road again and spent the rest of the day relaxing/walking about over there (plus all the streets/area’s above and below the mall road)

Got back home and crashed, then left home on Sunday morning at 10:30 am after a huge breakfast and got back to Delhi in 8 1/2 hours. Had dinner and Gaurang’s place and crashed. Drove back to Noida on Monday at 6 am so as to avoid the traffic.

In all it was a great trip, very relaxing and very filling. Both Mausi and Mausa fed us like anything but I enjoyed a lot. Hope to do something like this again soon.

Edit (30th Aug 2009): The photos from the trip have been uploaded to Photogallery under Trips -> Shimla Trip (Aug 2009)

– Suramya

August 19, 2009

OS Irritations Part 2

Filed under: My Thoughts — Suramya @ 10:15 PM

Like I said in my last post, I had reinstalled XP on my system because Surabhi and Vinit needed it for some work. After I installed it I went to visit friends over the weekend but gave them access to the PC (Just the windows partition). This was a basic install of XP with no service packs etc installed so Vinit installed Service Pack 2 on the system. Everything seemed to go fine till the system had to reboot, then we would get the boot screen and after that just a blank screen.

After I came back we tried reinstalling XP again but everytime I installed the service pack I would hit the same issue. The funny part is that this system was running Windows XP fine before I had removed the partition. So I know it supports it. In any case after 3-4 attempts we gave up and tried using it without the service pack.

So we were trying to install their software but the system would read the USB drive as a blank disk but when I plugged it in to the laptop I could see the data on it. While this was going on Vinit noticed that my bluetooth dongle was connected to the system so he suggested removing it. Sure enough as soon as I removed the dongle the system started reading the USB drive. Now I am pretty sure if I boot into windows and install the Service Pack it will probably work if I remove the bluetooth dongle.

The other annoying thing was that my Microsoft mouse was having issues in XP, it was really slow and the system had trouble reading the clicks. It got to the point that we started using the keyboard to control the mouse. The same mouse works great on the same system when we boot into XP.

In any case the task we needed XP is done so I guess I will be removing the XP installing from my system again. (That will free up 7 GB of space) I will probably install XP using Qemu incase I need it for something but for most part (99.9%) I don’t think I will need it. Although I will probably install Office 2003 using Wine. This is because for certain documents I need to use Word otherwise if I create them using OpenOffice the format looks bad in Word.

Ah well this is all for now. Will post more later.

– Suramya

August 16, 2009

Software/OS Irritations

Filed under: My Life,My Thoughts — Suramya @ 2:20 AM

Today I reinstalled Windows XP on my system because Vinit/Surabhi needed a XP PC for some work. I had it installed till yesterday but it was giving me issues (I had tried to boot to it from within VMWare) so I formatted the partition yesterday night. Install was ok, Most of my hardware wasn’t detected as I need to download and install the drivers for them, but the mouse, keyboard and the screen work which is good enough for what I need it for. I still have to install all the updates and patches etc.

The annoying thing was that the stupid installer overwrote the Bootloader so I couldn’t boot into Linux anymore. I had to boot to Linux using a Live Linux CD and reinstall the grub boot manager. To do it all I had to do was run 3 commands. Now my system is back to normal. 🙂

I am going to look into a creating Windows Live CD. I have read about it on the web. Lets see if I can actually find it and get it to work.

The other thing I was trying to get to work was syncing my Phone Contacts/Calender with my computer/Google. I managed to back up the contacts and calender as files but the sync to Google didn’t work. I guess it might be that I was too impatient and canceled the sync after 5 mins but I don’t know… Will try it again tomorrow. Or I guess I will just install Horde on my system and sync to its LDAP server. That way I will be able to manage/access them using thunderbird. I will just have to see what I feel like tomorrow when I actually start playing with it again.

I installed Opera today on my system, because I needed another browser for streaming music via a proxy. I didn’t want to use firefox because I don’t want all my traffic to go though the proxy. My feelings about the browser can be summed up by two words: It sucks.

The flash file upload at mediafire froze the browser. Then I tried to configure the browser to use a SOCKS proxy and was really surprised to find that Opera doesn’t have support for it. Even IE has support for it… (I think) Not near a windows message so can’t check it. So I am back to using Firefox for everything and will uninstall Opera shortly.

Having said all of that, Opera Mobile is really good. It works for what I need it for. So until Mozilla releases a browser for the mobile I will be using Opera on my phone.

Well this is all for now. Will write more later.

– Suramya

August 15, 2009

Posting to WordPress Blogs from Lifeblog on Nokia Phones

Filed under: Computer Software,Software Releases,Tech Related — Suramya @ 4:45 AM

I have been wanting to have the option to make blog posts directly from lifeblog on my N95 for a while now but so far was unsuccessful because no plugin existed that worked with the latest version of WordPress.

So I downloaded the latest available copy of the plugin from this blog post and modified it to work with the latest version of WordPress.

You can download the latest version of the plugin from the Scripts Directory. This version works with WordPress 2.8.x (I tested it with 2.8.2 and 2.8.4).

Changelog :
Ver 3.5: (15th Aug 2009):

* Plugin is now compatible with WordPress 2.8.x (Tested upto 2.8.4)
* Replaced the SQL queries for categories creation/check with WordPress Functions
* Replaced the SQL queries for user checks with WordPress functions
* Added ability to Enable/Disable Debug Logging by changing one variable

Let me know if you have any questions/issues.

– Suramya

Post from Lifeblog

Filed under: Lifeblog — Suramya @ 3:48 AM
Screenshot

This entry has been posted from lifeblog on my Nokia N95

August 14, 2009

Have faith

Filed under: Humor — Suramya @ 11:08 PM


Faith

Have faith

And then people ask me why I don’t like religious nuts. *roll eyes*

– Suramya

August 11, 2009

Blah blah about my life.

Filed under: My Life — Suramya @ 11:21 PM

As I said in my last post Rakhi was last week and it was fun. Lots of relatives came over to our place and we all really enjoyed. I was planning on posting some of the photos taken then but the cable that connects my camera to the computer has gone MIA (Missing In Action) and the card reader that I have is not working any more… 🙁 So till I get one or the other working you will have to wait for the photos.

I finally transferred my games and pics from my old phone to the current one. I thought I had copied everything using the Nokia Sync but that didn’t copy any of the extra stuff I had installed manually. So first I copied all of it to the memory card and tried copying it to the computer. Unfortunately that didn’t work because the reader was broken. Then I realized that I could talk to the phone using bluetooth, so copied about 40 MB of applications/games to the N95. Yay Me..

The new wireless AP is working great as it gives me wireless access throughout the house instead of just 1/2 of it.

Well this is all for now. Will post more later.

– Suramya

« Newer PostsOlder Posts »

Powered by WordPress