Dec 1 2010

Missing feature in the iPhone mail client?

Even though the iPhone Mail client is arguably the best mail client on a mobile device, I still feel that it’s missing a crucial feature. Even Nokia phones that didn’t support receiving HTML formatted mail until recently, have had this feature for ages.

I’m talking about scheduled mail downloading. I don’t read mail when I sleep. I also do not want any work-related mail on weekends. On my Nokia, I could easily set it to fetch mail Mon-Fri 8:00–17:00. If I want the same functionality on my iPhone I need to go to the advanced mail settings twice daily to manually switch fetching on or off.

This is such a simple feature, that I’m honestly confused that Apple hasn’t included it in the client. Or am I just missing something?


Nov 27 2010

Spotify iPhone app forgetting how to multitask

Spotify on the iPhone seems to have a weird “feature”, where it forgets how to multitask every once in a while. It plays music fine, but immediately when you lock the screen or background it, it fades out the music and stops.

Sometimes, it starts working by quitting the app from the task switcher and restarting. Most of the times, however, I need to restart my phone to get it working, which is really annoying. So far, Spotify has been by far the #1 reason for rebooting my iPhone.

Strange.


Jan 22 2010

Textile to XHTML converter

A while back, I needed to quickly write some documentation that needed to be in XHTML format. Writing in plain XHTML is a pain, so I decided to write the documentation in Textile and then convert it to XHTML before publishing.

The problem I found was that all Textile converters were made for use in blogs and other online tools. What I needed was a good old-fashioned command line program to convert a given textile file into XHTML.

Fortunately, using Ruby and the excellent RedCloth gem, I could write a small script to accomplish this in a few minutes.

If you have any similar needs, copy the source into a file named textile2html, make it executable (chmod +x) and place it somewhere in your path. Then all you have to do is call textile2html with the textile file as an argument:

$ textile2html documentation.textile
#!/usr/bin/env ruby -wKU
require "rubygems"
require "RedCloth"

if ARGV.size != 1
puts "Usage: textile2html file.textile"
exit
end

# Read input file
textile_string = ""
begin
  input_file = File.new(ARGV[0], "r")
  input_file.each do |line|
    textile_string+=line
  end
  input_file.close
rescue
  puts "Could not read input file."
  exit
end

# Create output file
filename = ARGV[0].gsub(/\.\w+$/, "")
begin
  output_file = File.new("#{filename}.html", "w")
rescue
  puts "Could not create output file."
  exit
end

html_header = <<DOC
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>
DOC

html_header += filename;
html_header += <<DOC
</title>
</head>
<body>
DOC

html_footer = <<DOC
</body>
</html>
DOC

html_output = RedCloth.new(textile_string).to_html
output_file.puts(html_header)
output_file.puts(html_output)
output_file.puts(html_footer)
output_file.close

puts "Done."

Questions? Comments? Post them below.


Jan 3 2010

Converting MKV files for the Xbox 360 or PS3 on a Mac

I use my Xbox 360 for most of my media viewing in the living room. This can sometimes be a hassle since I’m using a Mac, and Microsoft hasn’t exactly made it easy to share media from a mac to an Xbox 306. I use a third party program, Connect360, that easily allows me share media from my computer to my Xbox. In reality, though, the Xbox fails to find my Mac about 75% of the time.

What is more annoying, is that the Xbox 360 doesn’t play Matroska Video containers, even though the video itself is encoded in h.264 or MPEG-4. There are several ways of playing the videos on the Xbox, but unfortunately all of them require converting the video.

HandBrake, previously only a DVD ripper, is an easy tool for converting videos. Unfortunately, HandBrake always transcodes the video, even though the video itself is in a format that is playable by the Xbox 360. This method will work, but the process is very time-consuming. On an upside, the program is free and works very well. Hopefully, they’ll add support for passing through the original video from the MKV container to a MPEG-4 video (m4v) container.

A better solution would be to only package the video in a new container that the Xbox 360 can understand. This process can be done with several tools. Using QuickTime Pro 7, you can export the file to another format passing though the video. You only need to re-encode the audio track, which makes this a much faster process than the Handbrake method. The QuickTime Player X bundled with Snow Leopard seems to have lost this functionality. It should be possible to install the older version of QuickTime, but the Pro license is pretty expensive if this is the only use you’ll have for it.

The easiest way I have found to do the conversion is by using MKVtools. This is a small program, specifically designed to do this task as easy as possible. It uses several open source tools to extract and re-encode the file and comes with presets both for the Xbox 360 and PlayStation 3. While it is possible to use the tools directly, MKVtools really takes the hassle out of the process. The best part is that the program is only $5 and has a fully functional trial.

The resulting mp4 or m4v file should play on the Xbox 360 or PS3 without a problem. The only downside is that you lose the multichannel soundtrack, and have to settle for stereo. For most programs, this really isn’t a big problem in my opinion.

Do you have any better ways of viewing MKV files on a Xbox 360 that I’m unaware of? Please post them in the comments!


Dec 30 2009

My top free apps for Android

Sure, there are a lot of top lists for Android applications. But there is not yet one for my top Android apps. So here are my top 5 (or so) applications for Android:

1. MyTracks

MyTracks is Google’s sports tracking software for Android, much like Nokia Sports Tracker is for S60 devices. With this application you can track your sporting (or other) routes and see statistics over your performance. The application lets you upload routes to Google maps and statistics to a Google Docs spreadsheet for easy analysis.

I really like this application as I bicycle a lot. Being able to measure routes and see average speeds, resting time vs moving time and other statistics really make working out more interesting (and geeky).  It allows you to concentrate on the sports performance without having to worry about pausing the application every time you take a break for instance.

[Image courtesy of Google]

2. Fring

Even though I mostly use Google Talk on my HTC Hero, I occasionally need to contact people without Google Talk accounts. Fring is by far the best application I have found to do this on the Android platform. Fring lets you access contacts on pretty much any imaginable instant messaging network, like MSN, AOL, Yahoo, Skype, as well as its own Fring protocol. To make things even better, the application has support for making Skype calls over 3G and WLAN, which has come in handy while traveling.

[Image courtesy of Fring]

3. Google Maps

I want to mention Google Maps even though it comes with the phone. I use the application almost daily, looking up nearby services or routes to places. The Maps application on the HTC Hero lacks navigation, which would definitely place this application at the top of the list. Once you have gotten used to having a GPS in your pocket, there is no going back.

4. handyCalc

This is probably the best calculator I have found for Android. It allows you to do simple calculations easily, but also supports much more. For instance, it supports solving equations, plotting graphs and converting currency. This application is a must-have for anyone that has to do some more advanced math once in a while and doesn’t like lugging around a Texas Instruments calculator all the time.

5. ConnectBot

ConnectBot is a very handy SSH client for Android. It allows you to easily connect to SSH servers and perform maintenance tasks without having to bring along your laptop everywhere. Combined with the large screen of the Hero, this application is really useful.

[Image courtesy of ConnectBot]

6. Bebbled

The final application on this list is a game. The game is much like Bejewled, and easily as addicting. The major difference is that it supports turning around the device have the blocks move to the “ceiling.” This brings a new dimension to the game and makes it really addictive.

[Image courtesy of Bebbled]

What are your favorite Android Apps? Please share any apps that you have found useful in the comments.


Dec 23 2009

Google wave invitation giveaway

As a present to all readers, I’m handing out 17 invitations to Google Wave. All you have to do to get your invitation is to be among the 17 first non-spambot commenters in this post.

Update: There are still 11 invites left.


Dec 23 2009

Digital TV in Linux

Watching digital tv in Linux with em2880 devices

Note: This post is from my earlier site. I moved it over here because I see that a lot of people are trying to access it without finding it. It is written in 2007, so all content may not be up to date. You can report successes/failures in the comments so I know if it needs to be updated.

I found a really cheap refurbished Pinnacle PCTV USB DVB-T receiver in my local computer store and after googling to make sure it supported Linux I bought it. Here’s how I made it work in Linux.

The USB stick itself is fairly small, although it is just wide enough to block the other USB port on my laptop. It came with a small antenna with a magnetic stand and a tiny remote. The antenna is connected to the USB stick with a regular antenna connector, you can easily connect it to a better antenna if needed.

In this article I’ll show you how I first set up the drivers for the tuner, then setting up kaffeine for viewing TV and lastly configuring the remote. The steps should be fairly easy to follow if you’ve used the console before – if not, just copy n paste and you should be fine.

This article is about the Pinnacle PCTV USB Stick DVB-T receiver, but the same steps should work for any device using the em2880 driver. According to the em28xx wiki, these devices should also work:

Digital devices:

  • Pinnacle/800e|Pinnacle HD Pro Stick (North American version, NTSC/ATSC)
  • Kworld 350 U DVB-T
  • Kworld 310 U
  • MSI DigiVox A/D (USB2.0)
  • Hauppauge HVR 950 (NTSC/ATSC)
  • Hauppauge WinTV HVR 900 M/R: 65008/A1C0
  • Terratec Cinergy Hybrid T XS – ZL10353
  • Terratec Cinergy Hybrid T XS – MT352
  • Terratec Cinergy Hybrid T XS France
  • Terratec Prodigy Hybrid T XS
  • Terratec Cinergy T XS – xc3028
  • Terratec Cinergy T XS – mt2060
  • Pinnacle PCTV USB Stick
  • DNT DA2 Hybrid
  • Pinnacle PCTV Hybrid Pro Stick
  • Empire USB 2.0 Pen Dual TV
  • BestBuy Easy TV USB hybrid

Analog devices:

  • Usbgear VD204v9
  • Leadtek Winfast USB II deluxe
  • SIIG AVTuner-PVR
  • Prolink PlayTV USB 2.0
  • Terratec Cinergy 250 USB
  • Pinnacle PCTV USB 2
  • Hauppauge WinTV USB 2
  • MSI VOX USB 2.0
  • Pinnacle Dazzle DVC 90
  • Kworld PVR TV 2800 RF
  • Hercules Smart TV USB 2.0
  • MSI Movie Vox
  • D-Link DUB-T210 TV Tuner
  • Gadmei UTV 330
  • Gadmei UTV 310
  • Supertronindia Supercomp TV USB 2.0

Programs needed

You will need the following programs for this to work, we’ll install everything up front so we can concentrate on the more interesting stuff later.

  • a recent kernel with sources, 2.6.15 and newer should be fine (install kernel-sources in SuSE)
  • Hg from http://www.selenic.com/mercurial/ (in SuSE you should find a package named mercurial)
  • kaffeine with the xine engine (in SuSE, add packman and guru repositories and install kaffeine, libxine and libxine-dvb)
  • lineak with kde plugin (on SuSE, install lineakd, lineakd_kde and lineak_defaultplugin)
  • gcc compiler, is included on most distros by default
  • dvb package (dvb in SuSE)

For Ubuntu (Edgy) you’ll need the following packages:

All should be available from the default repositories, make sure to have the “Universe” repositories enabled (under System>Administration>Software Sources).

  • mercurial
  • gcc
  • build-essential
  • linux-source
  • linux-headers-`uname -r` (the linux headers for your specific kernel version)
  • kaffeine (version 0.8 or above. Other dvb watching applications will work as well but only kaffeine will be covered here)

Otherwise the install works the same as for SuSE.

Downloading and compiling the driver

Some users will need a firmware file to make their devices work, if you see your device listed here follow the directions, if not continue on to installing the driver.

These devices need firmware version 1:

  • Terratec Cinergy Hybrid T XS (french edition)
  • Terratec Cinergy T XS
  • DNT DA2 Hybrid
  • Kworld 350U

These devices need firmware version 2:

  • MSI DigiVox A/D
  • Kworld 310U
  • Terratec Cinergy Hybrid T XS (USB ID=0ccd:005e)

These devices need firmware version 3:

  • HVR 900 B2C0(sticker on the dev.)
  • HVR 900 A1C0
  • Terratec Cinergy Hybrid T XS
  • Pinnacle PCTV Hybrid Pro
  • Pinnacle PCTV Hybrid Pro Stick (320e) (USB ID=eb1a:2881)

These devices need firmware version 4:

  • Pinnacle HD Pro Stick (North American version, NTSC/ATSC)

These firmware files can be obtained from here.

IMPORTANT: Download the file into /lib/firmware, then extract them with “sudo tar zxvf filename.tar.gz”
Getting and installing the driver

Create a folder somewhere convenient.

mkdir driver

Now, go into that directory and type

hg clone http://mcentral.de/hg/~mrec/v4l-dvb-kernel

Which will download a copy of the driver sources to your directory.

Compiling the driver varies a bit depending on if you had to download the firmware or not. If you had to download it keep reading here, if not skip on to part b.

Compiling:

cd v4l-dvb-kernel/v4l
make
sudo make install

You now need to reboot (bookmark this page so you’ll find it again).

The fun part

Hi and welcome back, I hope the boot didn’t take too long.

If everything has gone well you should be a few short steps away from viewing tv on your computer.

We still need to load the driver we compiled earlier, as root type in the following.

modprobe em28xx

You shouldn’t get any messages, just be returned to the prompt.

Open up kaffeine either from the menu, or from the console by typing ‘kaffeine’. It should recognize that you

have a dvb adapter and ask you for some additional info.

Select your location and check that everything else is in order and then continue.

In kaffeine you have in the menu bar a DVB menu, select channels from that. Now just press scan and hope. If all went well you’ll soon start seeing all the channels that have been found. If you can’t find any channels its most likely because of the tiny little antenna that came with the tuner, either try going to some place with better reception, or plug the antenna cable to a roof-top antenna.

If you’re happy controlling your viewing with a mouse and keyboard, you’re done. If you want to get the remote to work as well stay with me for a little while longer.

Setting up the remote

The remote is just another input device to the system, just like the extra buttons on newer keyboards, so I decided to use lineak for the task.

I used xev to get the different key codes the buttons on the remote are sending, unfortunately not all of them sent anything. I don’t know if this is just something that’s wrong with my remote, or a “feature”.

Anyway, here is the section to that I added to /etc/lineakkb.def:

#### Pinnacle PCTV USB Stick Remote ####

[PCTV]

  brandname = "Pinnacle"

  modelname = "PCTV USB Stick Remote Control"

  [KEYS]

    Mute             = 160

    Record           = 177

    Power            = 222

    Rewind           = 152

    Stop             = 232

    Play|Pause       = 110

    Forward          = 233

    VolumeUp         = 176

    VolumeDown       = 174

  [END KEYS]

[END PCTV]

#### END Pinnacle PCTV USB Stick Remote ####

If you find the missing key codes, please leave a comment and I’ll update this.

Save the lineakkb.def file and as a regular user type:

lineakd -c PCTV

It will create a configuration file for your keyboard in ~/.lineak/ named lineakd.conf

In this file you can set up what you want all the buttons to do, below is a mine as a sample:

 # LinEAK - Linux support for Easy Access and Internet Keyboards

#  Copyright (c) 2001,2002, 2003

#     Sheldon Lee Wen <leewsb@hotmail.com> (Current Maintainer)

#      and Mark Smulders <Mark@PIRnet.nl>

#  http://lineak.sourceforge.net

#

# lineakd configuration file

#

# example key configuration:

#     play    = "xmms --play-pause"

#     eject    = EAK_EJECT

#

# Lineakd supports the following modifier keys:

#    control alt shift mod2 mod3 mod4 mod5

CdromDevice = /dev/cdrom

Display_align = center

Display_color = 0aff00

Display_font = -adobe-helvetica-bold-r-normal-*-*-240-*-*-p-*-*-*

Display_hoffset = 0

Display_plugin = internal

Display_pos = bottom

Display_soffset = 1

Display_timeout = 3

Display_voffset = 50

KeyboardType = PCTV

MixerDevice = /dev/mixer

RAWCommands = 

Screensaver = 

conffilename = /home/marcus/.lineak/lineakd.conf

keystate_capslock = 

keystate_numlock = 

keystate_scrolllock = 

Forward = "dcop kaffeine KaffeineIface posPlus"

Mute = "KMIX_MUTE"

Play|Pause = "dcop kaffeine KaffeineIface pause"

Power = "kaffeine DVB"

Record = "dcop kaffeine KaffeineIface fullscreen"

Rewind = "dcop kaffeine KaffeineIface posMinus"

Stop = "dcop kaffeine KaffeineIface stop"

VolumeDown = "KMIX_VOLDOWN"

VolumeUp = "KMIX_VOLUP"

As you see, I had to put the record button to control full screen toggling, as I couldn’t get the key code for the real full screen button. Please check the lineak documentation for additional commands, as well as typing ‘dcop kaffeine KaffeineIface’ to get a list of all the commands you can send to kaffeine.

To start type

 lineakd&

To start lineak automatically with KDE make a symbolic link like this:

 ln -s /usr/bin/lineakd /home/marcus/.kde/Autostart/

So that’s it, now you should be able to enjoy your favorite tv shows on your computer and control it with the remote (although the effective distance on the remote is probably less than the length of your arm :)

References

The em28xx wiki check this wiki if you have any problems, they are probably solved there.

Lineak documentation


Dec 23 2009

Google Nexus One rumors and walkthough

Lately, there have been a huge buzz around the internet about Google starting to sell their own Android-based handset.  Apparently, Google has given out phones, called Nexus One,  to Google employees for internal testing before the launch. This has resulted in a lot of blurry pictures and descriptions of the new mystery device.

If this is a marketing stunt by Google, which I think it is, its very effective. The device certainly looks good.

Engadget had managed to get their hands on one of the devices and seemed to be very impressed. They noted that the Nexus One has: “… probably the best screen we’ve seen on a smartphone so far.” They were also impressed by the speed of the device, something that has been a major issue for most Android devices so far. Comparing browsing speeds they noted:

When comparing the three phones in loading a webpage over Wi-Fi, the Nexus One loaded first, the iPhone 3GS came in a few seconds later, and the Droid came in a little while after that. This was constant throughout many webpage loads, so it’s indicative of something going on inside with the hardware.

A video walkthough of the interface looks very promising. The interface moves quickly, and the screen seems very spacious compared to my HTC Hero.

The Nexus One is rumored to be sold without contract, for $199 or $99 for existing Google account holders. If this is true and Google sells the phone to Finland, I’m definitely getting one. The low price point seems too low to be true. If it is true, I’m sure that Google will have some ads and/or usage monitoring to recoup the hardware costs.

Reuters reported that the phone should go on sale directly from Google on January 5th. We’ll just have to wait until then and see which rumors are true.


Dec 21 2009

WordPress LaTeX plugin

Now that I have code highlighting working, I thought that I should still look into getting some easy way to display mathematical notation. Turns out that WordPress once again delivered, there are in fact several different LaTeX plugins available.

The plugin I settled for is WP LaTeX, since it allowed me to use  wordpress.com‘s LaTeX server. This was an easier alternative, as Dreamhost does not have dvipng installed. On a side note, I’m impressed that they have LaTeX installed by default.

Now I only have to insert the following to create a nice looking equation:

H(z) = \frac{1}{1-2 cos(2 \pi k / N) z^{-1} + z^{-2}}
H(z) = \frac{1}{1-2 cos(2 \pi k / N) z^{-1} + z^{-2}}

Bonus points for anyone who can identify the transfer function :)


Dec 20 2009

Transferring Gmail to Google Apps with own domain

My hosting plan with Dreamhost had an option of using Google Apps with my own domain. In practice, what I wanted was using Gmail, only with my own domain in the address.

The process of setting up Google Apps with an own domain was straight forward. All I had to do was enable Google Apps for my domain in the Dreamhost admin interface and then sign up for a Google Apps account. I had to upload a HTML-file to the root of my domain to assure that I in fact own the domain.

The big problem I had was that I currently have a Google account that I use both for my HTC Hero and for Gmail. What I really wanted was to be able to migrate that account to my own domain. This was unfortunately not possible as the two accounts are entirely separate.

I could import all of my previous mails from Gmail to the new Gmail through POP, even though it was a big pain. I could also set my old Gmail to forward any new messages automatically to the new address.

I still decided to keep using my Gmail as my primary email address because it is most convenient. The new address will, at least for the time being, stay as a secondary email mainly for this site. It is still very convenient to have an email address with an own domain and still be able to use it from anywhere using the Gmail interface and 7+ GB of storage.