Archive for the ‘Misc’ Category

Batch Edit EXIF Metadata of Photographs

I spent the past few days exploring the scenic Chamba and Kangra valleys of Himachal Pradesh (More on that later.. time permitting :-)). I have been meaning to do this for a long time and was glad that I was eventually able to cover most of the places as planned. Needless to say, I took hundreds of photographs.. trying to capture the natural beauty that the lovely place has to offer. Much to my chagrin, I found out later that the Date/Time settings of my camera were askew. Well I’m a bit finicky about such things and immediately googled around for various available freeware utilities that can batch modify EXIF metadata of multiple photographs. All I wanted was an application using which I can select a bunch of files and increment/decrement the Date-Time values by some number.

My search led me to a number of options and I finally settled for the combination of “ExifTool + ExifTool GUI”. You can get more details at the following links.

It’s simple.. powerful.. and gets the job done – highly recommend!

Advertisements

Tips: Posting source code in WordPress blogs

I haven’t been too happy with the WordPress blog editor as it doesn’t let me to post source code snippets in my blogs – especially Javascript and XML. Although it allows Java, bash scripts and other code bits to be embedded within the <code> </code> tags, the final display isn’t too visually appealing as you can see below – probably to do with the the default CSS settings.


abhi@hbase2:~$ ls -lthR /opt/hbase/data/
/opt/hbase/data/:
total 16K
drwxrwxr-x 4 hbase hbase 4.0K Oct 30 12:47 users
drwxrwxr-x 4 hbase hbase 4.0K Oct 30 12:00 -ROOT-
-rwxr-xr-x 1 hbase hbase 38 Oct 30 12:00 hbase.id
-rwxr-xr-x 1 hbase hbase 3 Oct 30 12:00 hbase.version

/opt/hbase/data/users:
total 4.0K
drwxrwxr-x 4 hbase hbase 4.0K Oct 30 12:47 a070247328d9deec48d4e3cfa46b33a4

/opt/hbase/data/users/a070247328d9deec48d4e3cfa46b33a4:
total 4.0K
drwxrwxr-x 2 hbase hbase 4.0K Oct 30 12:47 info

/opt/hbase/data/users/a070247328d9deec48d4e3cfa46b33a4/info:
total 0

/opt/hbase/data/-ROOT-:
total 4.0K
drwxrwxr-x 4 hbase hbase 4.0K Oct 30 12:12 70236052

/opt/hbase/data/-ROOT-/70236052:
total 4.0K
drwxrwxr-x 2 hbase hbase 4.0K Oct 30 12:11 info

/opt/hbase/data/-ROOT-/70236052/info:
total 8.0K
-rwxrwxrwx 1 hbase hbase 718 Oct 30 12:11 a913edee0ac34de490c46ee12175dc02
-rwxrwxrwx 1 hbase hbase 714 Oct 30 12:00 c6f09dc3ee6a4150b8e787a747a81707
abhi@hbase2:~$

Luckily I chanced upon the following link http://en.support.wordpress.com/code/posting-source-code/ and it shares some neat tips that one can use.

The [sourcecode] [/sourcecode] tags definitely give a much better look as evident below.

abhi@hbase2:~$ ls -lthR /opt/hbase/data/
/opt/hbase/data/:
total 16K
drwxrwxr-x 4 hbase hbase 4.0K Oct 30 12:47 users
drwxrwxr-x 4 hbase hbase 4.0K Oct 30 12:00 -ROOT-
-rwxr-xr-x 1 hbase hbase   38 Oct 30 12:00 hbase.id
-rwxr-xr-x 1 hbase hbase    3 Oct 30 12:00 hbase.version

/opt/hbase/data/users:
total 4.0K
drwxrwxr-x 4 hbase hbase 4.0K Oct 30 12:47 a070247328d9deec48d4e3cfa46b33a4

/opt/hbase/data/users/a070247328d9deec48d4e3cfa46b33a4:
total 4.0K
drwxrwxr-x 2 hbase hbase 4.0K Oct 30 12:47 info

/opt/hbase/data/users/a070247328d9deec48d4e3cfa46b33a4/info:
total 0

/opt/hbase/data/-ROOT-:
total 4.0K
drwxrwxr-x 4 hbase hbase 4.0K Oct 30 12:12 70236052

/opt/hbase/data/-ROOT-/70236052:
total 4.0K
drwxrwxr-x 2 hbase hbase 4.0K Oct 30 12:11 info

/opt/hbase/data/-ROOT-/70236052/info:
total 8.0K
-rwxrwxrwx 1 hbase hbase 718 Oct 30 12:11 a913edee0ac34de490c46ee12175dc02
-rwxrwxrwx 1 hbase hbase 714 Oct 30 12:00 c6f09dc3ee6a4150b8e787a747a81707
abhi@hbase2:~$

I intend to replace all my <code> </code> tags in past entries with [sourcecode] [/sourcecode] the moment I get some free time. I wonder if there’s a simpler way to do this. Please do drop in a line if you think so :).

Enable Nautilus Toolbar, Statusbar and Sidebar with Tree view

I installed CentOS 5.6 and was a bit uncomfortable with the way the file browser Nautilus was behaving – I couldn’t find the Toolbar, Statusbar or the Sidebar/Sidepane with the folder tree that I have gotten used to over the years. Moreover every time I would double-click on a folder it would open it in a new window – my screen was simply getting cluttered. I tried to enable the Sidepane by pressing ‘F9″ but no luck. After quite a bit of looking around I managed to fix it.

Basically open gconf-editor i.e. press Alt+F2, enter gconf-editor and click on Run.

Run Application

Go to / -> apps -> nautilus -> preferences, select always_use_browser and enable the checkbox as shown below.

Configuration Editor

Now when you open Nautilus you can view the Toolbar, Status bar and the Sidebar with the tree.

Mozilla Thunderbird: Subscribe nested folders and subfolders

Well I’ve been trying to organize my mailbox – basically create folders/subfolders and organize my emails for quite some time now. Today I finally managed to get some time and decided to go ahead with this seemingly simple activity. I’mean how difficult is it to create folders/subfolders and move emails right?

Now I have MS Exchange Server at work which has been IMAP-enabled so that I can access my mailbox from my phone and from Thunderbird (on my Linux box). I organized all my emails in folders and subfolders (nested upto 2-3 levels) using MS Outlook at work and later when I tried to access my mailbox using Thunderbird, I realized that it was not displaying all my folders and subfolders.

So I go to my Mail Account Settings to explicitly subscribe the folders/subfolders. That’s when I found out that it was simply fetching/displaying the top-level folders and the immediate subfolders (nested 1 level). It was not displaying the nested subfolders within other subfolders. So in the example below, only folders X and A were being displayed while B and C were not.

X
 |___ A
      |___ B
           |___ C

So in the time-tested manner I googled for some answer and came across quite a few forums where people have faced the same problem.

http://getsatisfaction.com/mozilla_messaging/topics/imap_sub_sub_folders_do_not_appear_in_subscribe_window

http://www.emaildiscussions.com/showthread.php?t=55577

http://www.emaildiscussions.com/showthread.php?t=55134

http://www.emaildiscussions.com/showpost.php?p=462865&postcount=27

I didn’t find much help till I came across – http://kb.mozillazine.org/IMAP:_advanced_account_configuration

So this is how I fixed the problem:

  • Remove your mail account (e.g. mail.xxx.com) and recreate it just to be on the safe side. You can skip this too.. I just didn’t
  • Right click on your mail account folder and go to the Mail Server Settings i.e.
    Account Settings –> mail.xxx.com –> Server Settings
  • Mozilla Thunderbird Account Settings

  • Now press the button “Advanced” to view the “Advanced Account Settings”. Uncheck the option “Show only subscribed folders” and press “OK“.

    Mozilla Thunderbird Advanced Account Settings

    Now the moment you connect to your mail server, this will fix two things:

    1. You won’t have to explicitly subscribe each folder/subfolder
    2. All folders and nested subfolders get fetched and displayed automatically

WinXP cmd shell window problem

A weird thing kept me occupied my whole saturday and prompted me to write about it so that others facing the same may benefit from the fix.

I was eagerly looking forward to my weekend so that I could try out few things.. testing Java localization features being one of them. Now I did give it a try over the week at work but couldn’t do much. Anyways, my work needed me to execute the following command from a shell.


$ java -jar $JAVA_HOME/demo/jfc/Font2DTest/Font2DTest.jar

Let me tell you about the Operating Systems I use. I use Fedora Linux at work and have Windows XP on my laptop. So on a fine Saturday morning in order to execute the above comand, I tried to invoke the Windows XP cmd shell as follows:

(a)

Start -> Run -> cmd

Now I’ve done this many times in the past but this morning it behaved in a weird manner. The cmd shell window would appear for a brief moment but terminate automatically ! 😦

Well the first thing I did (besides cursing Windows) was to quickly update my virus definitions and scan my system. This didn’t show any virus or infected files. I did a quick google search with the following keywords:


Windows XP, cmd not working
Windows XP, unable to open command prompt
cmd shell terminating automatically

My search didn’t yield any fruitful results so decided to investigate into the problem. I tried to execute the cmd.exe directly i.e.

(b)

I browsed to the C:\WINDOWS\system32\ and double-clicked cmd.exe

– Now this did bring up the window!

(MAKE SURE to unhide system files if you wan’t the windows explorer to show you files under the C:\WINDOWS\system32\ directory i.e. Tools->Folder Options-> UNCHECK Hide System files)

I tried to execute the cmd shell again using approach (a) but found the same problem !

After trying out the above two approaches multiple times, I observed that with

(b) the shell window has the title – C:\WINDOWS\system32\cmd.exe while with
(a) for the brief moment that the window appears, has the title –
C:\WINDOWS\system32\cmd.COM

I found that C:\WINDOWS\system32\ directory has 2 files named cmd – cmd.exe and cmd.com . I renamed cmd.com to cmd.com_ and then tried approach (a)

Voila! This time it did work.

I did a google search to find the cause of the problem and learnt that my system was infected with the WORM_ALCAN.A virus, which somehow wasn’t getting picked by my Anti-Virus utility (Norton). This virus (among various other things) drops the following files in C:\WINDOWS\system32\

  • CMD.COM
  • NETSTAT.COM
  • PING.COM
  • REGEDIT.COM
  • TASKKILL.COM
  • TASKLIST.COM
  • TRACERT.COM



Since .COM files have a higher priority over their .EXE counterparts, it disables the execution of the .EXE files.

I realised that NETSTAT and other files were infected too and needless to say I straightaway removed these .COM malicious files.

Learn more about it at:

http://www.trendmicro.com/vinfo/virusencyclo/default5.asp?VName=WORM_ALCAN.A&VSect=T

Well.. this pretty much brings my Saturday to an end.. I sincerely hope nothing goes wrong tomorrow and I continue with my plans.