Monthly Archives: November 2012

n7player hits v2.0

As I’ve mentioned previously, n7player is one of the coolest music players in the android world. Been a fan of it since its beta stages, I was elated to find out that n7player 2.0 has been released yesterday.

The most noticeable improvement is the better playlist management options. It’s now even _fun_ to move the songs back and forth in the playlist. Now it’s possible to save custom playlists as well. There are improvements in the equalizer and there’s a Genre mode of which I’m not much of a fan. Perhaps it’s time to tag the missing genres in my library. That ain’t easy.

Note that the free version works for only 14 days. They’ve reduced the price of the unlock key now, at $2.

New in Gmail: attachments up to 10GB

So I’ve finally got Gmail’s Insert Files using Drive feature, which lets you attach files from your Google Drive into mails. Drive gives you 5GB of cloud storage for free, so now you can attach files with size up to 5GB. Earlier the maximum size of an attachment was 25MB. To check if you’ve got the feature by now, click on Compose and see if there’s a Drive icon in the toolbar.

This is much easier than uploading to somewhere else, like Dropbox, and emailing the link, since you can do everything within Gmail. Still, I’m in favor of Dropbox for cloud storage. Drive is just for attachments and Google Docs.

Find and replace by font color

I was emailing some documents to the Kindle and it turned out that some sections of gray colored text in these documents are not readable. The solution is to change the color of the gray text to black. One option is to select all text and set the text color to black. But I wanted to change only the color of gray text (i.e. keep the red, green text as is). How does one do that? How do you find text with some color and replace them with another?

The in-built Find and Replace functionality in both Microsoft Word and LibreOffice Writer can do this. If you use Microsoft Word, press Ctrl+H to invoke the Find and Replace dialog box. While the cursor is on the Find what text box, click on More. To the bottom of the dialog, a Format button will appear. Click on it and choose the font style you want to find. Now go to the Replace with text box and repeat the same to choose the style you want to replace with. Finally press Replace All.

Click to enlarge

If you have several documents that need this operation, you don’t have to choose styles again and again coz Word saves the last Find and Replace parameters. The method is almost the same with LibreOffice Writer.

Bookmarklets for bulk deleting items from Kindle

I got my Kindle 4 a few days back. Other than for reading books, it’s ideal for reading long articles and blog posts you come across in the web. You can even direct RSS feeds to the Kindle. All items you send to the device (other than by transferring directly from the PC) get stored in your Amazon account. You can view these documents in the Manage Your Kindle page. As days go by, this list of items become too long. And you want to delete them.

Amazon doesn’t let you select several items or all of them at once. You have to go through the tedious process of clicking Actions, then clicking Delete from Library and answering ‘Yes’ for each item.

Luckily, there are bookmarklets to help you avoid the mess. For example, the Check and Delete bookmarklet adds checkboxes in front of each item and you can check the items you want to delete and press Delete. There’s also this MDKI bookmarklet which lets you specify the titles of the items and delete them. The former option is more convenient in most cases. You’ll be able to modify the MDKI bookmarklet to select all items from a given author (i.e., source) and delete them.

Beware though, if you delete any item from the library, it’s gone. Even purchased items.

Keeping the Git directory and the working tree separate

When you clone/init a repo, the .git directory is created inside your working tree. This colleague of mine wanted to check-in the source code to a legacy versioning system other than git. Normally the .git directory gets pushed as well, since it’s inside the working tree.

Normal structure

But he didn’t want to push the .git dir as well. He wanted something like this:

Required structure

If you look at the git-clone man page, there’s this option called --separate-git-dir which lets you assign a custom directory as the .git dir. The syntax is:

git clone git://path.to.repo newdir --separate-git-dir=somedir

But in this case, my colleague didn’t want to clone again. He had local branches galore and all. So I tried out the git-clone mentioned above and checked what really happens. It turns out that git creates a file called .git inside the working tree that looks like this:

gitdir: /home/thameera/path/to/git/dir

Gotcha! Now what we need to do is move my friend’s .git directory to a separate location and create a file called .git that has the path to the git dir as above. It works!

ShortcutFoo

As you may have guessed from the name, ShortcutFoo lets you master keyboard shortcuts in various apps including Vim, Emacs, Eclipse, Git, Excel, Visual Studio and many more. It first lets you learn the shortcuts, then presents drills and a practice mode to master them. So you actually use the shortcuts, instead of just memorizing them. Clever idea.

The downside is, only a few shortcut bundles in each app is free. To unlock the rest, you’ll have to pay a one-time fee of $8.99. That’s too high. I may subscribe one day if I happened to learn Emacs or some crazy text editor other than Vim. But no thanks for now.

Why the ‘Foo’ anyway? Shouldn’t it have been ‘Fu’?

We don’t want any more Twitter clients – Twitter

The Next Web has an article about the Windows 8 Twitter client Tweetro. Tweetro has become so popular among the users that it has had to face the wrath of Twitter.

Thank you for reaching out to get clarification on our developer policies. As you know, we discourage developers from building apps that replicate our core user experience (aka “Twitter clients”).

It’s like when you introduce someone to your circle of friends and then that someone becomes more popular than you in the circle, so you become jealous and want that someone out. Ugh.

Gmail with Thunderbird

I’d been dealing with my work-related mail with Mozilla’s Thunderbird for a few weeks. For the personal Gmail account, it was the good old webapp. For a change I hooked the Gmail account with Thunderbird to see how things would go. It had trouble authenticating the Google account, but then remembered about the 2-step verification so created an application-specific password to make it work.

The experience is better than I’d imagined. It’s quite handy being able to open mail in tabs. There are hundreds of add-ons to choose from. Especially, the Conversations add-on is a must. It’s smarter than Gmail’s conversation view. For example, if you get code broken into separate git patches like [PATCH 1/7], [PATCH 2/7] etc, they appear as separate threads in gmail. But this add-on groups all related patches to a single tree of conversation with branches. Clever! Guess I’d be sticking with this for the foreseeable future.

Processing music tags with Python

I was looking for the optimal way to traverse the directory tree with Python and found out that os.walk is the answer. To put this into practice, I wrote the following script which traverses the music library and finds out which MP3s haven’t been properly tagged. In other words, it will print the full paths of all MP3s that have any of the artist, album or title tracks missing. In my case, 502 of the 10466 songs had bad tags.

[sourcecode language=”python”]
#!/usr/bin/python

import os
import id3reader

rootdir = "/home/thameera/Music"
processed = 0
bad = 0

for thisDir, subdirList, fileList in os.walk(rootdir):
for fname in fileList:
if fname[-3:] == ‘mp3’:
processed += 1
fullPath = os.path.join(thisDir, fname)

try:
id3r = id3reader.Reader(fullPath)
except:
bad += 1
print "Error extracting id3 info from %s" % fullPath
continue

if None in (id3r.getValue(‘performer’), id3r.getValue(‘album’), id3r.getValue(‘title’)):
bad += 1
print fullPath

print "%d MP3s processed. Found bad tags in %d of them" % (processed, bad)
[/sourcecode]

It uses the id3reader library to parse the tags. I don’t think it’ll work if you have files with other formats, like wma or flac.

This script can be further expanded to ignore certain directories, output only one entry per each directory that has bad tags, check for other tags as well, check if the artist tag does not match the name of the parent directory, etc, etc.

Fixing bad sectors

Something went wrong and my work laptop running Windows 7 turned off without suspending when the lid was closed. Turned it back on to find that everything’s darn slow and the hard disk light is lit all the time. Shut it down and restarted a several times with the same result. Booting with a CD or a USB wasn’t an option since this is a locked machine. Some googling suggested that chkdsk would be a good idea.

So I typed in cmd at the start menu, right clicked and chose Run As Administrator. Even though I don’t have admin access, it’s possible to run an app ‘as administrator’. Then typed in chkdsk /r to the prompt and pressed Enter. The /r flag would let chkdsk locate bad sectors and try to recover readable information. It wasn’t able to run the scan then and there coz I’d booted the OS with the same hard disk, but offered to schedule the check for the next time the system restarts. Restart the machine and chkdsk would run for several hours depending on the hard disk size/speed. It took nearly 4 hours in my case and several bad sectors were recovered. After this Windows would boot without a hitch.