Categories
Blog

Hacking Firefox bookmarks

I have a few thousand bookmarks in Firefox, many of which are tagged with project_ tags. I use these to bookmark material for future reference on subjects which I want read more about at some future date…

It turns out I’ve now got rather a lot of these project tags, and between them many hundreds of bookmarks. The bookmarks sit there, accumulating, waiting to fulfill their destiny and provide me with sweet, sweet knowledge.

To encourage myself to make some decisions about which are worth pursuing I wanted to get a list of these various project tags, together with a count of how many bookmarks I have saved for each.

Firefox stores bookmarks in a SQLite database called places.sqlite which can be perused with any SQLite capable database manager. I used the SQLite Manager add-on because it does exactly what I needed.

Find tags by pattern

SELECT title 
FROM moz_bookmarks 
WHERE title LIKE 'project_%' 
AND parent = 4

Count bookmarks for a given tag

SELECT tag.title, COUNT(bookmark.fk) 
FROM moz_bookmarks AS tag
JOIN moz_bookmarks AS bookmark 
ON bookmark.parent = tag.id
WHERE tag.title = 'project_javascript' 
AND tag.parent = 4

Find tags and count by pattern

After a few attempts I managed to combine these two into the final query that gives me the numbers I wanted:

SELECT tag.title, COUNT(tag.title)
FROM moz_bookmarks AS tag
LEFT JOIN moz_bookmarks AS bookmark
ON bookmark.parent = tag.id
WHERE tag.title LIKE 'project_%'
AND tag.parent = 4
GROUP BY tag.title
ORDER BY tag.title ASC
Categories
Blog

Learn Linux with this one weird tip

The first HTML I wrote was on the creamy-white PowerMac 5000s at Brighton University in the late ‘90s, but since then, until recently, I’ve only ever used Windows. It’s made a lot of sense for me to transition from Windows to Linux as my primary operating system over the last year and a half.

There are some amazing development tools out there like node & Grunt which are a breeze to install on Mac & Linux, but where Windows support seems marginal to say the least. To quote one tutorial:

…if you use Windows, my apologies but you’re on your own

Switching has at times been pretty tedious, but last week as I SSH’d into a server, grepped an errant line of code and edited the file in Vim I realised that it’s finally paying off. Maybe I’ll even get to grips with the old imposter phenomenon.

So what’s the one weird tip that I came here for?

Make notes, and plenty of ’em. Oh and start an A-Z card index for any useful commands you want to use more than once.

Yes you got a second weird tip for free, you’re welcome.

Categories
Blog

Picasa metadata: Saving face

Last week I started using Picasa’s amazing and spooky face recognition feature to tag faces in my family photo library.

For a library of a few hundred thousand photos this can be a time-consuming process. Picasa does a great job of identifying many faces, but if it’s not certain about a particular face it needs human assistance to choose between two or more possibilities.

Browsing and identifying these unnamed faces is an oddly compelling activity. In fact the whole family has enjoyed helping Picasa sift through its backlog at odd moments during the week.

This isn’t the first time I’ve started the process, but on the previous occasion I lost all my face data when I ran Picasa while the external HDD which stores my photos was switched off. When I ran Picasa having switched the HDD back on it seemed to have lost all the face information and started scanning from scratch. At which point I decided that I could manage without tagging faces for a couple of years.

It’s possible that the latest version of Picasa no longer has this problem, but my paranoia lives on, so I wrote a little batch script launcher which will only run Picasa if the directory I:/photos is available:

@echo off
if exist "I:/photos" (
    start "" "C:Program FilesGooglePicasa3Picasa3.exe"
) else (
    echo Directory I:/photos is not available!
    pause
)

I compiled this batch script into an .exe using ComputerHope.com’s Bat To Exe Converter. This utility allows you to give your exe an icon, so I used another utility Icon Seizer to rip the official Picasa icon from its exe.

Finally I edited the Picasa shortcuts in my Quick launch and Start menus to point to the safe launcher.

And now I can sleep at night.

Well I would be able to if Picasa didn’t still need my help identifying 17,441 unnamed faces…