Archive for April, 2012

I Joined the Dark Side

Back in 2010 I was really looking forward to the upcoming MeeGo phones by Nokia, but alas, it was not to be. My five-year-old phone started dropping its connection now and then for no apparent reason, so it was time to upgrade. Unfortunately all the phones out there seemed to be either mini-tablets or otherwise not living up to my requirements, but a few weeks after I’d stopped looking I almost accidentally came across the Sony Ericsson xPeria ray. It combined two features very important to me: it is not a small tablet and it has a nice resolution, resulting in nigh 300 PPI. Can I get the latter on desktop monitors please, instead of that paltry 1080p HD that seems to be popular right now?

I intend to document some of the apps I’ve installed and why, and perhaps also why I quickly uninstalled some others. To that extent it’s more of a public note to self, but who knows — it might just help to someone else.

Sense Analog Clock Widget
Because none of the other clock widgets were big enough. Call me old-fashioned, but I like a big clock to be the first thing I see. The weather, system info and configurable click actions are a nice touch.
K-9 Mail
The default e-mail client was alright, but not really any better than what my old SE s500i gave me over half a decade ago. Besides, it’s mostly just the default client with some bells and whistles.
K9 Mail Unread Count Icon
Unlike the default e-mail client, K-9 Mail doesn’t display the number of unread messages in its icon. This widget takes care of that.
Keyboard from Android 2.3
I like the default Android 2.3 keyboard better than the one Sony Ericsson included. You can choose your preferred keyboard by long-pressing on a text-input field. Among the advantages are that it’s easier to type symbols and you can change languages by a simple swipe on the space bar. Besides, it has a speech recognition button built-in so you don’t necessarily have to type on the screen.
AndFTP
I tried a few FTP programs. Most were lacking in the SFTP department. However, I think it may not ask before it overwrites files.
Dropbox
Heck, it’s useful. Besides, they give you 500MB of extra free storage.
ArchiDroid
I need to extract files sometimes. Duh.
OI File Manager and Open Manager
I haven’t decided which one I like better, but it’s preposterous that something like this wasn’t included by default. Did I mention my feature phone came with a basic file manager?
Barcode Scanner
Very straightforward. It scans those funky QR code blocks without any fluff.
QR Bookmarklet
This one actually isn’t for my phone, but for my regular browser. I saved it among my bookmarklets and gave it the nickname “qr”. Now if I want to open any page on my phone, I can just type “qr” and use Barcode Scanner.
Opera Mobile and Opera Mini
Are any other browsers even in the same league? Mobile for Wi-Fi, Turbo for when a real browser might be required on the go, and Mini for true data saving. Also consider Firefox. The default Webkit browser is bearable, but basically awful. Note that while Opera Mobile supports options like site preferences, adding them is a bit of a pain due to the lack of a simple interface.
Battery Widget
I like a big battery indicator — and the little one it adds to the notification bar has an actual number so you know what’s going on.
Screebl Beta
The best argument for those motion sensors yet. It disables or holds back the screen timeout while the phone is in your hand and can speed it up when you lay it down.
Timeriffic
Again, it seems like this should be included by default. Set your phone up to stfu at night and whenever else you don’t want it to ring. You can also change some other settings if you want, but for me it makes more sense to turn e.g. Wi-Fi on manually.
OpenOffice Document Reader
LibreOffice is my preferred office application after HTML + CSS rendered to PDF with Prince. I may want to look up something in one of my documents on the go.
wifi AutoSyncAutoToggle widget
I don’t really want my phone wasting CPU or data on syncing unless I’m on WLAN. This takes care of that. Don’t forget to tell your applications to obey this setting. Other applications, most notably Google Play Store, don’t necessarily live by this setting, but sport options like “update or sync over Wi-Fi only.”
SD Tools
I don’t know if I’d recommend installing it per se, but benchmarking the speed might interesting for comparison.
Maps With Me
It’s a lot like Google Maps, except it’s based on OpenStreetMaps and offline. There are more OSM apps out there, but most I’ve tried seem to be less fluid, uglier, or default to turning the GPS on. I’m just looking at having a decent 2D map just in case — I’ve got an actual GPS with a bigger screen (albeit sadly with a much lower PPI value) for driving. Surprisingly, although I also gave a few commercial applications a try, their 2D maps didn’t seem nearly as usable as the Google Maps or Maps With Me varieties. The commercial apps have loads of POIs though, which might sometimes be useful.
Aard Dictionary
In a similar vein, I’ve now got The Collaborative International Dictionary of English and the entirety of Wikipedia on my phone. It’s not only useful for when you don’t want to use data: it’s actually really, really fast. There are more dictionaries available, or you can make your own. The only downside I can think of is that SVGs (which presumably shouldn’t take too much extra space) are missing from the files.

Android is certainly usable, but ultimately it’s too Apple-ish for my tastes. It’s also a bit annoying that by default everything’s set up to use data all the time. I understand that connectivity is a big factor of the device, but it’s no wonder people complain about low battery life if their phones are synchronizing all kinds of things every few minutes. If I’m on the go I can live with checking for new e-mail manually to conserve both data usage and battery life. Ultimately, while I’m happy with my new phone, I hope real GNU/Linux will be available before I have to buy a new one again.

Comments (1)

Using WordPress Excerpts in Meta Description

For a long time I’ve been aware of the fact that few, if any, WordPress themes seemed to do anything with the META element’s description feature. I never bothered to look into a solution, especially since I never used to add excerpts to my posts half a decade ago. However, I’ve bothered to do so ever since I started notifying people about updates on Twitter. It already makes the search results much more readable if you’re looking for something in the archives of this site, and I figured I should do the same for search engines.

Some uneventful searching later I found what I was looking for, but it definitely wasn’t right for me: I’ve got a huge volume of posts without any excerpts, so printing empty descriptions no matter what would be silly at best, and besides there are more descriptions out there than merely those of posts. After all, categories and even my site itself have a description as well. The comment by Matthew Slyman was much more to my liking, which I then customized as follows:

<?php
$desc;
if ( is_single() ) {
	$desc = get_the_excerpt();
}
elseif ( is_page() ) {
	$desc = get_the_excerpt();
}
elseif ( is_category() ) {
	$desc = category_description();
}
elseif ( is_home() ) {
	$desc = get_bloginfo('description');
}
$desc = htmlspecialchars(trim(strip_tags($desc)));
if (!empty($desc)) {
	echo '<meta name="description" content="';
	echo $desc;
	echo '"/>';
}
?>

Add the whole thing anywhere in your HEAD element in header.php. If excerpts seem to be missing from pages, there’s a simple solution. If you want to reuse the code above for some reason, wrap some sort of function around it and stick it in functions.php. Enjoy.

Comments

OCR Text in PDF with Tesseract

Since I had some scanned PDFs which I wanted to change into plain text, I looked into OCR solutions for Linux: as it turns out there are some pretty good options. I decided to go with Tesseract; you’ll need to install one or more language packs along with it. Unfortunately it only handles TIF files as input, so I needed a simple shell script to automatically convert PDFs to TIFs. This is what you’ll need to install:

aptitude install tesseract-ocr tesseract-ocr-eng tesseract-ocr-nld imagemagick

You might notice ImageMagick in there, which is just useful to have. Heck, even if you’re not interested in OCR you should install it right now and read the manual. In any case, it’s used in the shell script I wrote to assist my OCR-ing. I picked up a script from the Ubuntu Forums, but for some reason it was wasting CPU cycles and disk space with useless conversions to an intermediary format: ImageMagick can convert PDF straight to TIF.

#!/bin/bash
#ocrpdftotext
# Simplified implementation of http://ubuntuforums.org/showthread.php?t=880471

# Might consider doing something with getopts here, see http://wiki.bash-hackers.org/howto/getopts_tutorial
DPI=300
TESS_LANG=nld

FILENAME=${@%.pdf}
SCRIPT_NAME=`basename "$0" .sh`
TMP_DIR=${SCRIPT_NAME}-tmp
OUTPUT_FILENAME=${FILENAME}-output@DPI${DPI}

mkdir ${TMP_DIR}
cp ${@} ${TMP_DIR}
cd ${TMP_DIR}

convert -density ${DPI} -depth 8 ${@} "${FILENAME}.tif"
tesseract "${FILENAME}.tif" "${OUTPUT_FILENAME}" -l ${TESS_LANG}

mv ${OUTPUT_FILENAME}.txt ..
rm *
cd ..
rmdir ${TMP_DIR}

This may not suit your needs, but I think as a starting point it’s a step up from what the Ubuntu forums gave me.

Comments (2)