Categories
Computers Gadgets Linux Photography

Moblogging with WordPress and Nokia N82

OK, so despite its flaws, Nokia N82 does have its bright sides. The camera is actually quite good when there is sufficient ambient light around as can be seen in the picture of downtown Dallas below. My point of reference is my normal camera which is a Canon EOS 20D so I have been utterly disappointed by earlier phones with camera function. In low light, however, the supposedly fantastic Xenon flash on the N82 is no match to a proper flash. Ahhh, all these compromises…

Downtown Dallas

The phone also comes with Nokia’s Lifeblog feature and the camera is preconfigured to use the Flickr or Vox online services. That may be very well for most people out there but I am the kind of guy that wants to set up the system myself. So I just had to find a blogging platform that could be interfaced by the Lifeblog application in the phone.

One of the blogging platforms I tried to make work was of course WordPress and I quickly found the lifeblog4wp project and tried it out on various releases of the software but just couldn’t get it to work. Then, early January an update to lifeblog4wp was uploaded to the project’s web page on SourceForge and I tried it out on a clean installation of the latest version of WordPress. Lo and behold – it worked!

So for anyone out there who has, like me, been frustrated about the problems of moblogging from Nokia N82 using lifeblog4wp – use WordPress 2.3.2 and the version of the script uploaded on 2008-01-05. Then just follow the instructions within the lifeblog.php file.

Categories
Computers Linux

Blocking spam to postfix postmaster

RFC822 from way back in 1982 stipulates that any SMTP mail server system must accept mail for postmaster@<domain> so that someone may send email to the administrator of the email system without knowing any personal email addresses.

When setting up my postfix server I set up DNS Blacklists (DNSBL) to block email being sent from known open relays to minimise the number of spam. This was a great success and I now very rarely receive any spam to my personal address. However, a year or so back I noticed that email were coming in to the postmaster address, past any spam checks. I quickly learned that postfix by default disables any blocks for the postmaster address and when I searched the Internet it looked as if a recompilation of postfix was necessary.

Then, eventually, I found that if the value address_verify_sender is set to something else than postmaster@<domain> DNSBL could again be enabled for the postmaster alias. The value address_verify_sender is used when the mail server verifies the sender. It can be set to null but that will probably lead to problems since many mailservers will not accept it. The solution is simple – I created another alias in /etc/aliases and set the same alias to address_verify_sender in /etc/postfix/main.cf.

Now DNSBL is in place for postmaster@<domain> but it is disabled for the address used for verification. However, that address is not as easily guessed and doesn’t get any spam. Legitimate email to postmaster@<domain> still gets through so I don’t feel that this is in violation to RFC822.

Categories
Gadgets

Nokia N82 disappointments

Nokia N82

I remember back when I had a Nokia 8210 how it seemed so much more intuitive than the competition. The menu structure was logic and the software seemed very consistent.

Since then I have had a number of phones from Sony Ericsson as well as a couple with various versions of Windows Mobile. Late last year it was time to change phone again and this time I had noticed the very promising Nokia N82 which had more or less everything I would want from a phone:

  • All modern bands – including HSDPA
  • 5 MP camera
  • Wi-Fi
  • Built-in GPS
  • Ability to synchronise with the Exchange server at work
  • Support for Mac OS X

In the media the phone was said “to have it all”. I was sold. The phone arrived a week before Christmas but since then the gloria over this particular model has waned due to the following shortcomings (which, I assume, are not specific to N82 but should apply to any N-series phone using Symbian Series 60) :

  • Incoming mail alerts or number of unread emails are not show on the standby display. Apparently, this is an E-series feature. So much for “has it all”.
  • The phone can’t even multitask! Come on Nokia, this is 2008! Instead, I have to wait until the phone has synced IMAP accounts before I can read even messages already on the phone.
  • It is not possible to create “access point groups” so that the phone could automatically decide between WiFi and mobile connections for applications. Again, this is an E-series feature (why?). The result is a constant fiddling back and forth in the various applications.
  • The address book stays on the most recently displayed person even if it was hours since I used the phone. I could accept (even like) it if it did it for a minute or so since you might want to call another number for the same person if you don’t get a response on the first number. Most of the time, though, I will want to call a different person when I pick up the phone again and then I have to start by pressing “back”. Totally unnecessary and poorly designed Nokia.
  • All meeting requests default to zero minutes. I would prefer it if I could set a specific default time so I don’t have to enter the end time.
  • Having GPS in the phone is great but it feels a little bit cheap to ask for extra for the navigation (especially since Google Maps has a mobile application available for free).
  • The GUI is inconsistent about how applications are exited. Usually one presses the right button until one exits the application but sometime one has to press the left button and select “exit”.
  • The calculator can’t do math. 2+3*4 equals 14 but the phone (like all cheap calculators) has no knowledge of operator precedence.

The unwillingness of Nokia to fulfil the combined needs of those who want to use their phone as an important business tool as well as for pleasure means that my next phone most likely won’t be a Nokia.

Steve, please bring out an iPhone with 3G for the Swedish market!

Categories
Computers Linux

Migrating from Drupal 4.7.3 to WordPress 2.3.2

I used to run this blog on Drupal 4.7.3 and really hadn’t upgraded the software in more than a year. For some reason, the whole blog felt very slow and it took ages to get into the administration pages. It was clearly time for change. The question was whether I should upgrade to Drupal 5 or switch platform altogether. To be honest, I really didn’t actually use any of the more CMS-ish features of Drupal and I have a couple of other sites on WordPress so I thought long and hard about switching to WordPress.

But what about all the previous content? Sure, I hadn’t written that much but there was a little and it is always nice not having to start from scratch. Unfortunately there didn’t seem to be any recommended solution for migrating the content. Some other bloggers had posted MySQL scripts that could take the data from one format to another but it was supposedly very uncertain if it was going to work with my combination of versions. Now, I have no problem whatsoever in writing SQL scripts and do so ever so often in my job – I just felt that there had to be a simpler way. And there was.

It turns out that WordPress has a very nice RSS import feature and I had set up Drupal to provide an RSS feed. I just switched on the setting in Drupal that makes the RSS feed include all the text and not just the teaser but then I had one small issue – Drupal doesn’t let you show more than 30 posts in the RSS feed.

It was time to get dirty and jump into the PHP code. 43% down in the file /modules/system.module there is an array with the number of posts to show. Just stick “, 9999” (or some other large number) at the end of the list and go back to the setting page in Drupal and pick it. Then just save the RSS feed and import it into WordPress. Ta da!

 

Categories
Computers Linux

Making Postfix listen to a secondary port

Some ISPs that I use block outgoing SMTP traffic on port 25. As an example, my mobile operator  Telenor blocks outgoing traffic from my phone on TCP port 25 which means that I couldn’t connect my laptop through their network to send email using SSL-encrypted SMTP via my company’s SMTP server. I can understand their intention but they make it very difficult for people like myself to use external mail servers for outgoing mail. The standard solution to this is to use the submission port (TCP 587) and if there is a fully configurable firewall in front of the mail server it is normally straightforward to make the firewall send traffic on two external ports (25 & 587) to the same internal port.

However, in my case it wasn’t so easy. The firewall could route traffic to internal IP addresses but it couldn’t change the destination port.

After briefly consulting Google, many people talked about having Postfix listen to multiple ports but others warned about the risk of ending up with an open relay. Naturally I didn’t want that so I looked for an easier solution. And there is. Just use iptables to rewrite the port on incoming packets:

iptables -t nat -A PREROUTING -p tcp --dport 587 -j REDIRECT --to-ports 25

To make this stick when the server is rebooted, use iptables-save or similar and apply the rules when the network is activated. The nice thing with this setup is that Postfix is not touched and still only listens to port 25.

Categories
Computers Linux Music

Transcoding FLAC to MP3

Having my entire record collection in a fully lossless format with properly scanned cover art has taken some time. Now that it is done I sometimes want to use the music in players that do not support FLAC or where I want to keep down the size of the files.

I have tried a number of existing solutions but none of them worked the way I wanted. Since I keep my music on a headless server I wanted a non-GUI solution. Also, since my main playing environment is based on Slimserver there are a number of features that give other players some headache – one such thing is that many of my genre tags contain multiple genres, separated by semicolon. I also wanted the tagged file to include the cover art and to work on both Windows Media Player and iTunes.

My current solution is based on a Bash script (attached) and includes the following features:

  • Incremental transcoding so it doesn’t have to run through the entire library (which may well take weeks)
  • Ability to skip a certain folder – in my case I have skipped the compilations for now since iTunes makes it messy otherwise
  • Fixes filenames so that they don’t include any non-ASCII characters

To run the script a rather updated Linux version is needed. I first started writing the script on Ubuntu 6.06 (Dapper) but realised after a while that the reason that I just couldn’t get the Unicode characters in the tags to work was not due to me but some bug in the id3lib. Currently I am running this on Ubuntu 7.10 (Gutsy).

Attachments

Categories
Computers Music Windows

CD ripping workflow

Since some time back I have moved my entire music library online in a fully lossless format. The idea of ripping the entire library of CDs did not exactly thrill me – especially since I had ripped most of the records already, but in a non-optimal format.

After having carefully studied all alternatives I settled on using the FLAC format to store the music, the main reasons for this was the open source nature of FLAC. Your mileage may vary and for many a fully managed process using Windows Media Player or iTunes may be a better option – if you can live with your music being locked into the respective format.

My music environment includes multiple Slim devices (one Transporter and one Squeezebox) both driven by SlimServer on a Linux server running 24/7. To use this workflow the following applications are required: Exact Audio Copy, FLAC encoder, MP3Tag. In addition an graphics program is benecifical in order to process the cover art.

The step-by-step process I employ to rip a new CD is:

  1. Use Exact Audio Copy (EAC) to rip the CD (my configuration file can be found below). I don’t like the anglo-saxon way of capitalising every word in the song titles so I change them all manually. I also add multiple genres separated by semicolon which works fine with SlimServer but freaks out iTunes and Windows Media Player.
  2. I make sure to save a copy of the log file from EAC to the same folder as the FLAC files.
  3. For multi-record album (and other complex albums) I use MP3Tag to add DISCNUMBER and other information and rename the files so that each file has a three digit number where the first digit indicates the record within the album set.
  4. I then scan the cover of the record and create a 1080×1080 pixel JPG image which is save in the same folder as the files.
  5. Finally, the files are moved to my Linux server where the attached Perl script is used to generate thumb nails. The script requires the presence of ImageMagick on the system which must be installed separately.

Attachments

Categories
Computers Mac

Text encoding for Mac OS X mail application

This is not really an issue with Mac OS X but rather with the inability of Microsoft Outlook to treat text encodings properly. You are affected by this if you write emails in the mail application on Mac OS X and notice that replies to emails you have sent comes back with the replied text being all garbled. Apparently this stems from a couple of bugs in Microsoft Outlook that prevents it to treat the text encoding properly.

A simple fix to this issue is to set the mail applications to use Unicode encoding for outgoing emails. While this can be done manually for each and every email you send (Message -> Text Encoding -> Unicode (UTF-8)) it is better to change the mail application of Mac OS X to use Unicode as default encoding. To do this, open a Terminal window and type:

defaults write com.apple.mail NSPreferredMailCharset "UTF-8"
Categories
Computers Mac

Ruby on Rails doesn't quite work on Mac OS X

Ruby on Rails is gaining in popularity when it comes to creating web sites. And no wonder, the features within the framework seems ideal for an agile development process. So naturally, I wanted to try it out on my new Macbook Pro.

Since I wanted control on the installation process, I followed the guide on www.rubyonrails.com for OS X. Everything went fine until I got the following error:

dyld: NSLinkModule() error
dyld: Library not loaded: /usr/local/mysql/lib/mysql/libmysqlclient.15.dylib
Referenced from: /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7/lib/mysql.bundle
Reason: image not found

To fix this problem, issue the following command:

sudo install_name_tool -change \
  /usr/local/mysql/lib/mysql/libmysqlclient.15.dylib \
  /usr/local/mysql/lib/libmysqlclient.15.dylib \
  /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7/lib/mysql.bundle

With this change I seem to be having a fully working Rails environment.

Categories
Computers Linux

Upgrade Thinkpad BIOS from Ubuntu

OK, so you have installed Ubuntu or another version of GNU/Linux on your Thinkpad and realise that you need to upgrade your BIOS. The files are available on Lenovo’s web site to create a bootable diskette. The problem is that the application is for Windows.

Not to worry. Just download the BIOS update application, extract the diskette image and use it to create an ISO file that you can then burn to a bootable CD.

> wget ftp://ftp.software.ibm.com/pc/pccbbs/mobiles/spsuiv69.exe
> cabextract spsuiv69.exe
> mkisofs -b IVUJ11US.IMG  -o biosboot.iso IVUJ11US.IMG

Then just burn the file biosboot.iso using your favourite ISO burner. Boot from the CD and follow the on-screen instructions.

Please note that, while this worked for me, I take no responsibility for what happens. There is always the risk of BIOS upgrades going wrong, turning the computer into an expensive paper weight.

css.php