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 8 2010

Nexus One with multitouch coming to Europe?

One of the most disappointing facts in the Nexus One release, besides the fact that it’s not officially coming to Finland, was the lack of multitouch. The big screen on the Nexus One is like made for using multitouch gestures.

Well, fortunately, US patent law doesn’t apply here in Europe. It looks as though the Nexus One will get multitouch support in the units sold in Europe, just like the Droid did.

[via Engadget]


Jan 5 2010

Boxee box announced

Looks like the Boxee Box has finally been announced officially. It features a quite unusual design that I like and supports almost every possible video format you could think of. It’s supposed to go on sale in the first half of 2010 for less than $200. I really hope that they ship this one internationally. The only downside is that I see that it doesn’t seem to have optical output for sound, only HDMI.

Press release

D-LINK DEBUTS BOXEE BOX AT CES 2010; DIRECTLY LINKS INTERNET ENTERTAINMENT SERVICES TO TVs EVERYWHERE

Networking pioneer and popular entertainment software create the best way to get the free entertainment the Internet has to offer with no monthly fee

LAS VEGAS, CES Booth 36232, South Hall, LVCC, Jan. 5, 2010 – D-Link made lots of geeks and early adopters happy today by introducing the revolutionary Boxee Box by D-Link, winner of the CES Best of Innovations award in the Home Entertainment category.

The Boxee Box by D-Link reinterprets what TV should be. The Boxee Box delivers movies, TV shows, music, and photos from a user’s computer, home network, and the Internet to their HDTV with no PC needed. Additionally, Boxee’s core social features make it easy for friends to discover new content from each other through social networks like Facebook, Twitter, and more.

Internet Entertainment
Boxee is a popular PC, Mac, and Linux software program that lets users watch hundreds of thousands of popular TV shows and movies. Instead of sifting through millions of confusing Web sites, when users search on Boxee, TV shows and movies are delivered to them with the click of a remote control. Nearly a million Internet users around the world have already downloaded Boxee to enjoy their online entertainment.

The Boxee Box by D-Link takes the same popular software and offers it up as a great device — the perfect companion to a high definition TV. The Boxee Box by D-Link provides access to more than just traditional TV content. It includes a huge library that spans the Internet, such as university courses, panel discussions, academic lectures, presentations, web-only videos and more from TED, Stanford, FORA.tv, Kid Mango, Next New Networks and others. Boxee also makes it easy for users to add their own favorite entertainment sources with simple RSS or XML feeds available for most online video.

In addition to video content, Boxee users can access great music from sites like Pandora, last.fm, shoutcast, and We are Hunted as well as stunning photos from sites like flickr, Picasa and Facebook.

Personal Entertainment
For entertainment lovers who have built their own collections of digital media stored on their computer hard drive or home network, Boxee automatically identifies their content and downloads relevant cover art, synopses, reviews, subtitles, lyrics and more. This feature turns boring files and folders into beautiful media libraries that make it simple and appealing to navigate a collection of favorite movies, TV shows, and playlists with a simple remote. Furthermore, the Boxee Box by D-Link has extensive format support (see below) which ensures that when users hit the play button, they get instant gratification, with no need to download codecs or drivers. Also, with built-in 802.11n Wi-Fi support, it can transfer files without delay and from longer distances within a user’s home.

Social Features
The Boxee Box by D-Link keeps people connected with social features to help users discover new content from friends, experts, and tastemakers.
The first step to discovery is sharing, and Boxee makes this easy by letting people recommend any playing content to friends. Additionally Boxee automatically uses recommendations from a user’s Twitter and Facebook friends so they can find new content and instantly enjoy it on the big screen. Since anyone can build on top of Boxee’s open App platform, users can craft their own truly custom experience by creating or downloading plug-ins, add-ons, games, and more.

“We are pleased to partner with Boxee and to be the first with such a ground-breaking device,” said Nick Tidd, vice president of sales of D-Link Pan America and vice president of marketing for D-Link North America. “This powerful device with its unique form factor truly leverages Boxee’s service and is the best way for consumers to quickly access the growing volume of Internet content, organize it and stream it to their TVs and home entertainment centers.”

“D-Link’s successful track record in bringing to market, award-winning digital home networking products, and its global marketing, distribution and channel sales capabilities made them a great fit for our first hardware vendor.” stated Andrew Kippen, vice president of marketing for Boxee, “The Boxee Box by D-Link gives consumers what they want – an easy way to watch Internet or personal entertainment in their living rooms with a simple set-top box that costs under $200 and has no monthly fees.”

The Boxee Box by D-Link is scheduled to ship in the first half of 2010 through the company’s vast network of retail and e-tail outlets, and at D-Link’s online store, www.dlinkshop.com.
Supported Codecs & Formats
Boxee can be used to play/view practically all common multimedia formats, including:

VIDEO:
Adobe Flash 10.1
H.264 (MKV, MOV)
VC-1
WMV
MPEG-1
MPEG-2
MPEG-4
AVI
Xvid
Divx
PCM/LPCM
VOB

AUDIO:
MP3
WMA
WAV
AIFF
FLAC
AAC
DTS
Dolby Digital
Ogg Vorbis

PHOTO:
JPEG
TIFF
BMP
PNG

About D-Link
D-Link is the global leader in connectivity for small, medium and large enterprise business networking. The company is an award-winning designer, developer and manufacturer of networking, broadband, digital electronics, voice, data and video communications solutions for the digital home, Small Office/Home Office (SOHO), Small to Medium Business (SMB), and Workgroup to Enterprise environments. With millions of networking and connectivity products manufactured and shipped, D-Link is a dominant market participant and price/performance leader in the networking and communications market. D-Link Systems, Inc. headquarters are located at 17595 Mt. Herrmann Street, Fountain Valley, CA, 92708. Phone (800) 326-1688 or (714) 885-6000; FAX (866) 743-4905; Internet www.dlink.com.

About Boxee
Boxee is the first “social” media center, whose free, downloadable software and enabled devices are changing the way consumers experience home entertainment. On a computer or on a dedicated device connected to an HDTV, boxee gives users a simple way to bring all their entertainment into one place including personal movies, TV shows, music and photos, as well as streaming content from websites like Netflix, MLB.TV, Pandora, Last.fm, and flickr. Users can also share information about what they’re watching so friends can enjoy it too through legal sources online. Nearly a million people use Boxee to get their entertainment. Learn how you can join them at www.boxee.tv.

D-Link, Boxee Box by D-Link and the D-Link logo are trademarks or registered trademarks of D-Link Corporation or its subsidiaries. All other third party marks mentioned herein may be trademarks of their respective owners. Copyright © 2009. D-Link. All Rights Reserved.


Jan 4 2010

HTC Hero 5 month review

I ordered my HTC Hero in August, right after it was released. As I wrote earlier, my decision to choose an Android phone had been long and I was really happy when I finally got the phone in the mail. I had a Nokia E71 before the Hero, and the difference felt like going from Windows 95 to a new Mac. The E71 had worked well, but it was slow to browse with and had possibly the worst email client ever made. It couldn’t even display HTML email.

User interface

Before getting the Hero, the only touch-screen phones I had tried were the iPhone and the Nokia N97. I really hoped that the Hero could live up to the iPhone that I couldn’t get. Just turning on the phone and seeing the screen, and going through the setup wizard showed that HTC had done a really good job with this phone. They have built a coherent look and feel to the entire experience, called Sense UI. In my opinion, Sense UI is very intuitive. Most functions can be found where you’d think they are. The user interface is really polished and professional looking, unlike the N0kia N97 I had tried earlier.

The initial firmware supplied with the phone was a bit laggy, especially when running many applications. One of my biggest surprises when I moved to Android was that there wasn’t any kind of task manager to kill apps with. Fortunately, there are several applications in the Android Market to help out with this problem. The one I liked the best was Advanced Task Killer Free. It allows you to check applications that you want to kill and then kill them with one tap. The Task Killer remembers which applications you have previously selected, so once you have selected the apps you always want to keep running, you can quickly just tap “Kill all selected apps” and have all the unnecessary apps shut down.

A firmware update came out later and made the phone significantly faster. It eliminated animations from some widgets, like the default clock/weather applet, but made the Hero much more pleasant to use.

What impressed me the most during the setup was that by entering my Google account details, the phone had set up all my contacts and calendar events. Even the correct internet APN was provided,  so I could get to surfing immediately. By entering your Facebook login information, you can have the phone match your contacts to Facebook friends and pull their photos to your contact list.

HTC has extended the number of home screens to seven. All home screens are completely customizable with widgets and icons. Comparing this to the iPhone makes the iPhone’s static grid of icons seem very outdated. For example, my home screen shows me at a glance the time, weather, next calendar appointment and shortcuts to my most used applications.

Browser

The browser on the Hero is WebKit based like the iPhone’s Mobile Safari. This, along with the same screen size, makes most iPhone web apps, like Facebook, work flawlessly on the Hero. Unlike most other Android devices, the HTC Hero has multi touch support with the familiar pinch-to-zoom gestures. The browser is fast and really makes it possible to view full web pages on the phone. Even though the Hero has Flash-support in the browser, it makes browsing a lot slower. This is because most of the Flash content on web pages is ads that don’t add any value to the content. By turning off the Flash plugin from the settings menu, the browser becomes even faster.


Google Maps

Another essential application in a smart phone is the map/navigation app. Google maps works very well on the Hero, even though it still seems to miss a couple of features. One of the missing features is the multi touch support that is used by most other applications on the phone. By not supporting pinch-zooming, the application feels out of place on the phone. Google maps does not either take advantage of the compass in the Hero to orient the map.

What I really miss from Google Maps, though, is navigation support. I hope that the rumored Android 2.1 update will bring navigation support also to the Hero (and to Finland).

One of the uses of Google Maps: finding food.

Email

The Hero comes with two mail clients, which is kind of confusing. One mail client is the default Android Gmail client. In addition to that, HTC have supplied an own email client that supports multiple mailboxes. I needed my phone to check all of my email accounts, so I chose the HTC email client.

In order for the client to display HTML emails, I had to change the maximum message size limit to more than 5kb (text only), which was the default option. I also had to disable Android’s Gmail syncing as I would get two notifications for every Gmail I received.

The mail client itself is quite nice. It displays HTML emails in the same way the browser would, and supports multitouch gestures. It allows you to choose how much mail you want to automatically download and you always have to manually download attachments, so there is no risk that the phone will start downloading huge attachments by itself.

Calendar

The calendar on the HTC Hero uses Google Calendar and automatically syncs events to and from Google Cal. By default, however, it uses a local calendar for some reason. I found it easiest to just hide the local calendar and use my Google calendars instead.

The Calendar application shows each different calendar with the same color coding as on the web. This makes it very convenient to have shared calendars and set up meetings from your phone that will automatically be synced to all those you share your Google calendar with.

Syncing

Syncing the Hero is dead simple. All you have to do is add a contact or calendar appointment, either from the phone or from the web and they will automatically sync over the air. This was a huge improvement form my previous Nokia and Windows Mobile phones that required manual syncing. In my experience, manual syncing = no syncing.

Other applications

There are also a whole lot of other smaller applications included in the phone. The phone will always stay logged on to Google Talk, which is a handy and cheap alternative to SMS for those who have your gtalk username.

The SMS/MMS application collects all messages to one person into a chat-like thread. It makes it simple to keep track of the discussion even if it has been a while since the last message.

Another nice touch on the Hero is that all communication with a contact can be seen from their contact page in the contacts app. It lists all messages and email correspondence you’ve had with that contact in one easy to find location.

In addition to all these apps, you can choose and install from tens of thousands of applications from the Android Market. You can see some of my favorite apps in my earlier post.

Build quality and battery life

The biggest weakness of the Hero is the same weakness that plagues all large-screened smart phones – battery life. During normal use, the battery lasts about a day and a half, but in real life you will want to charge it daily. On a positive note, I’ve never had the battery die on me during a day of usage.

The build quality of the device is fairly solid. I have still not got any scratches on the screen, and the screen stays easily clean as it is oil-repellant. A minor complaint about the build is that the back cover gets a bit loose after being taken off a few times. It squeaks a little if pressed near the volume button.

It was also nice to notice that iPhone headsets worked on the Hero, allowing me to both talk and control music.

Conclusions

I can honestly say that this is the best phone I’ve owned. Even though I got it because I couldn’t buy an iPhone, I’m more than happy with my choice. I wouldn’t trade it for an iPhone anymore, it offers me much more functionality and I like the openness of the Android plattform. Even though the phone is starting to get old in gadget-years, I can easily recommend that you get one if you find one cheap.


Jan 4 2010

Blocking comment spam

Despite the blog being only a few weeks old, I’m already getting a lot of spam in the comments. I have now installed the WordPress Hashcash plugin to prevent spambots from sending comments. The plugin works by requiring the browser to perform a proof-of-work to ensure that it is in fact a browser and not a bot. It also checks that trackback URLs in fact contain a link to the page and that comment IP addresses match.

The plugin should not interfere with any valid comments and allow me to use my time blogging, not filtering through heaps of spam. If it does block your comment, make sure that you have JavaScript enabled in your browser. If it still doesn’t work, send me an email at marcus [at] marcushellberg.com.


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!


Jan 3 2010

3D Movies

I went to see James Cameroon’s Avatar last night in 3D. While the movie itself was good, I feel let down by the technology. I had just read Wilson Rothman’s experiences of watching the movie from the first row, so I knew that front-row seats were something to avoid. Instead, I booked our seats in the center of the back row.

Because I was sitting so far back, I could see a lot of the surrounding wall around the screen. It felt like I was watching the movie through a window. Everything inside the window (screen) was basically like any other movie. Then there was the occasional branch or animal that stuck out of the window at times. It was very hard to get into the movie when objects came out of the screen on top of other people or the walls. The 3D effects were more of a reminder of the fact that I was in a movie theater than something that made the movie more enjoyable.

My second problem with the 3D movie experience was the glasses. The glasses were too heavy and fitted me poorly. They would slide down my nose so I had to readjust them every few minutes. The glasses had an infrared receiver between the eyes, which meant that they lost sync with the movie every time I pushed them back on my nose.

The glasses were pretty big and far from the face to allow persons wearing glasses to use them. In my case, since I don’t wear glasses, the fact that they were so far from my face made them glare form the light of the exit sign behind me.

The last and probably most annoying issue I had with the 3D movie experience was that the frame rate was abysmal. Any fast movement turned into a slide show, which really ruined the movie for me.

I would definitely suggest that you see the movie in 2D if you want to enjoy the movie for what it is instead of distracting yourself with gimmicks. I’ll give 3D movies a second chance, but this time I’ll get a seat somewhere around the 4th or 5th row in center, so that the screen will cover my entire field of vision. Like Wilson, I feel that movie theaters are not trying to enhance the movie experience for their viewers, but instead only want to profit more per showing.