Category: Projects

  • Maemo Emulation

    For those of you looking to kick it oldskool when the Nokia 770 comes out, there might be a few open source projects that fit the bill. Frodo 4.1b, a Commodore 64 emulator, and Atari800 built and ran without modification on the x86 Maemo development environment. Frodo chewed through almost all of the CPU on my Athlon XP 2500+, so getting that to run on the actual device might be a bit iffy. I saw some .asm files in the Atari800 source, which may be the downfall of Atari800 on Arm.

    We’ll see though. I tried a few more modern emulators (gameboy, nes, snes, etc) but nothing looked like it was going to be easy to get work at first glance. Here are a few screenshots of what I was able to get running this evening:

    Atari800 on Maemo x86
    Atari800 on Maemo x86
    Frodo C64 Emulator on Maemo x86
    Frodo (C64 emulator) on Maemo x86

  • GKrellM on Maemo!

    GKrellM running in Maemo

    This totally rocks! I’ve been tinkering around with Maemo this evening and I’ve been hunting around for apps to run on it. After a few misses I decided to try GKrellM. I was amazed when it “just worked,” compiled and ran in my Maemo x86 scratchbox! If you’d like to play for yourself, grab the source (I used 2.2.7), unpack it, run make, then go to the src dir and run run-standalone.sh ./gkrellm

    I haven’t set up an Arm environment using QEMU yet to test it there, but that’s next.

    Update: Here are some more screenshots showing how maemo handles the configuration dialogs.

    GKrellM Config: right click
    When you right click on the top of the GKrellM window.
    GKrellM Config: main config menu
    The main configuration menu.
    GKrellM Config: license dialog
    License dialog.

    Update: GKrellM isn’t quite as happy running on ARM under QEMU:

    GKrellM on Arm: not so happy
    Not so happy.
    GKrellM on Arm: menus
    No fonts in the menus.
    GKrellM on Arm: after restarting
    After running af-sb-init.sh restart.

    I’m told that changing to the ARM target while still running the X session is just asking for trouble. Oops! I’m not sure if the display issue is due to QEMU or if it will be a problem on an actual device. If anyone gets a chance to run it on a real live device I’d love to hear how it goes. Here’s the error I get over and over when running GKrellM on SDK_ARM using QEMU 0.6.1:

    (gkrellm:4068): Pango-CRITICAL **: pango_context_load_font: assertion `pango_font_description_get_size (desc) != 0' failed

  • Hello, Maemo!

    Hello, Maemo!

    Woohoo! After some help from the fine folks in #maemo on irc.freenode.net (special thanks to czr), I’m up and running the Maemo SDK. The biggest gotcha is that Maemo is expecting a 16 bit color depth and dies a horrible death if you try to run Xnest in 24 bit mode. This can be rectified by editing /etc/X11/xorg.conf (if you’re running XOrg) and changing DefaultDepth to 16 under the Screen section. If you’re feeling adventurous, Xephyr allows you to run a 16 bit window in a 24 bit environment.

    Maemo still complains a bit when I run af-sb-init.sh start, but clicking on the title bar actually does stuff rather than crash. Next step is to get one of the sample apps to compile. Thanks again to the crew in #maemo for helping me out!

  • The Nokia 770 and Maemo: Totally Amazed

    There’s been tons of coverage of the Nokia 770 and the open source Linux platform Maemo that goes with it. Everyone is excited, with reason, but I don’t think that the significance of the 770 and the platform have sunk in yet.

    We’re talking about a Linux based tablet with good resolution (800×480) running a custom GTK-based UI similar to Series 90 on a device with Wi-Fi and Bluetooth, 64 megs of ram, 128 megs of flash memory, and about a 3 hours battery life. The size is right too. Nokia have also been working with open source developers to adapt gstreamer for their uses, and the development environment is right there for you, enjoy.

    I’m really excited by this page detailing porting gaim to maemo. The port isn’t trivial, but it’s not far from it looks like a lot of the effort went in to making it look and behave better rather than getting it to actually run. Here’s a screenshot that just knocked my socks off:

    Gaim on Maemo

    I have been (sort of) following these instructions and now have a (sort of) working maemo environment up and running. I’m psyched to see Python (2.3.3) as well as Perl (5.8.4) in the development environment. I hope that both of these end up on the device or at least installable as an option. I’d also really like to see Mono or Java running on this little thing.

    I’m going to go tinker a bit more with the development environment (which uses scratchbox) and see if I can’t figure out what I’ve done wrong on the X side of things. It also looks like you can use QEMU to run apps compiled for ARM.

    Related reading:

    I get some nasty messages when I run af-sb-init.sh start and end up with the following almost (but not quite) working environment:

    Almost Maemo

    I used install.sh and then followed the installation instructions from there. I used this tarball as the rootstrap since I couldn’t find the file mentioned in the docs. I’ve got a shell, which is better than nothing, but I’m still working on a working X session…

  • Tab Clutter del.icio.us Dump (Using Ruby)

    In honor of cleaning out the tab clutter brought on by Crash Recovery, here is a del.icio.us dump of a bunch of tabs that I posted and cleared out this evening:

    I used Rubylicious to download and display the links. I’m a Pythonic kinda guy, so Ruby synax still throws me, but I’m excited that I can throw together a list of links in just a few lines of (ugly) Ruby:


    #!/usr/bin/ruby
    # a hack that loads the gem path stuff correctly on my Ubuntu box
    require 'rubygems'
    require 'rubilicious'
    r = Rubilicious.new('your_username', 'your_password')
    puts '<ul>'
    # Get 40 entries and write them as an unordered list
    recent_links = r.recent(nil, 40).map { |post| puts '<li><a href="' +
    post['href'] + '">' + post['description'] + '</a>: ' +
    post['extended'] + '</li>'}
    puts '</ul>'

    I still have a lot of Ruby syntax to learn, but aside from syntax errors in my head, Ruby has been awesome. I’ve still only done some basic tinkering with Ruby and Rails, but I hope to have time to do more in the future.

  • Prepping for Orange Code Camp

    Code Camp 2005

    I’m heading down to Sarasota, Florida later this morning for Orange Code Camp. I’m going to be covering the event for Orange as well as posting an article or two on All About Symbian and if I have any keystrokes left in me, hopefully a post or two in my weblog.

  • Python for Series 60 App: QuoteGrab

    Introduction

    I had 15-20 minutes to kill Wednesday night before class, so I wrote the first fully functional version of this little hack/app. It first prompts the user for a stock ticker symbol (like NOK, AAPL, YHOO). For now it expects your stock ticker symbol to be in uppercase. After the input is received, it grabs a .gif image from Yahoo! Finance, then displays the image using appuifw.content_handler. Once you are viewing the image you can zoom in, zoom out, and view the image fullscreen.

    After I got the basic app working, I took a few minutes here and there over the last few days to work in some basic exception handling. I wasn’t able to catch a TypeException error thrown from content_handler, so I have it checking if content was downloaded successfully before launching content_handler.

    Screenshots

    Quotegrab asking for a stock to look up Initial Content_handler view of the downloaded graph Zooming in using the content_handler controls Zoomed all the way in

    The first screenshot is asking for a stock ticker symbol to look up. The second is the initial zoom level when content_handler is called on the downloaded graph. The third screenshot is zoomed in a bit using the content_handler controls. The last screenshot is a fullscreen view of the graph.

    Requirements

    • A Series 60 phone, 3650 or newer (tested on N-Gage and 6630)
    • Python for Series 60
    • GPRS network access (not just WAP access)

    Download

    quotegrab.py

    Installation

    Download quotegrab.py and transfer it to your phone using Bluetooth, IR, email, or other means. When you open in from your inbox, it will prompt you for installation. If you have an MMC card reader or N-Gage, you can place it in /system/apps/python/my on your MMC.

    License

    QuoteGrab is licensed under a BSD-style license.

    TODO

    While a complete running app, this 62 line Python program does one thing, once, and does it pretty well. I would like to widen the scope of this app in the future to allow you to download and view the graph of the stock over 5 days, 3 months, or any other length of time that Yahoo! Finance offers. I would also like to add the ability to download and display basic stock information such as current price, change, and other vital stats. It would also be really awesome to be able to link to Yahoo! mobile for more information.

  • Rapid Python for Series 60 Development

    Right now I’m writing Python for Series 60 apps on my Ubuntu laptop and testing with a Nokia N-Gage (the infamous taco). The taco is an excellent (and inexpensive) development/testing platform for Python for Series 60 because it offers a USB connection that once connected allows you full access to the contents of the MMC. After a few rounds of navigating to the right spot on the MMC and then dragging my .py file using Nautilus, I decided to automate the process a bit. Here’s a little bash script (I call it py2phone) that has made my life quite simple:

    #!/bin/bash
    cp $1 /media/usbdisk/system/apps/python/my
    sudo umount /dev/sda1

    It copies the first command line argument to the correct spot on the MMC and then handles the umount command so that I can immediately disconnect the USB cable and test on the device. I usually copy to the device after running through it using the PDIS Series 60 compatability library, which helps me find stupid syntax errors before copying to the device. The comatability library sits on top of wxPython and implements most of the basic appuifw functions. I would really like to stub out content_handler to acknowledge the call rather than stacktrace, but other than that the compatability library absolutely rocks for debugging before transfering to the device.

    Here’s my development cycle, which when I’m fixing, tweaking or experimenting, can last all of a few seconds:

    1. Edit file.py file (I’m currently using GEdit for syntax highlighting)
    2. run python file.py at the command line to run through the app on the laptop
    3. ./py2phone file.py
    4. Unhook USB cable, test app on device

    The next step is to automate this process further by extending my little bash to handle the test call, ask if everything went okay, and then conditionally copying the file to the phone and unmounting the device.

  • Useful Python for Series 60 App: Dict2Go

    Over the past few weeks I’ve been on the lookout for pure python modules that run on Python for Series 60. I have managed to make use of a few cryptography modules (including Rijndael, DES, and Blowfish) as well as parse tag soup using BeautifulSoup.

    While I was able to highlight some pure python packages and modules that worked well on Series 60, I really wanted to put together a quick simple app that was actually useful. After searching around for modules and services that would be great to access from a mobile device, I fell in love with John Goerzen’s dictclient.py. The module is a consise and well documented client that speaks the dict protocol.

    Using Goerzen’s module, I have put together a simple GUI using the native widgets provided by appuifw. I was able to knock out the app in a little under an hour or so first by prototyping using the wxPython-based PDIS Series 60 Compatability library on my Linux laptop. From there a few iterations of tweak, test, tweak on my N-Gage (which is great for this type of thing because of the USB cable). Until my GoPhone SIM shows up tomorrow I’m without non-WAP data, so Gustaf was kind enough to test and send me a few stacktraces before I fixed a stupid typo or two in my code.

    Screenshots

    Dict2Go Input Dict2Go Results

    Installation

    To use Dict2Go, you will need Python for Series 60 installed on your phone. If you have a 3650, 3600, N-Gage, or N-Gage QD you will want to snag PythonForSeries60_1stEd_SIS.zip. For newer phones (6600, 6620, 6630, 7610, etc) you are looking for PythonForSeries60_2ndEd_SIS1.0.1.zip. You will also need a way to put the library file dictclient.py in your Python libs directory. Christopher Schmidt sent in a much easier way to install dictclient.py:

    For installing the dictclient.py, you can just send the file to your phone and install it as a Library module using the standard Python installer. There’s no reason to use Fexplorer or an MMC reader for that.

    My way (the Taco way) is still an option, though it’s much harder than it could be. You can copy the files using an MMC card reader (or your N-Gage) or by transfering the file to your phone and using FExplorer. If you have installed Python on your MMC (which you should have), put dictclient.py in E:/System/libs. One the library is in place, you can either place dict2go.py in E:/System/apps/Python/my or just transfer it to your phone and install it from your inbox.

    Download

    Note: this is a quick but functional hack. I think that it’s quite useful in its current form, but I have lots of plans to make it more fault-tolerant and user friendly as well as add more features and functionality. With that out of the way, there are a few ways to download Dict2Go:

    License

    Dict2Go is released under the GPL, version 2 or greater, as is the dictclient.py library that does all of the hard work. A copy of the license can be found in the zip files and tarballs.

    ToDo

    As I’ve said before, this is a quick hack, but I like it. The dict server is currently hardcoded to talk to dict.org, but that can be changed by editing the source if you really want to. Dict2Go also grabs the first definition it finds. I hope to make both of these configurable in the future. I also have lots of plans for UI improvements including a main app loop so that you can look up as many words as you want until you are done. I will do my best to get new stuff out the door as quickly as possible.

  • Minor Python For Series 60 2.0 Update

    Sweet! I just saw the release fly by my aggregator and thought I would let everyone know: There’s a new Python for Series 60 release for 2.0SDK phones available at Forum Nokia. This looks like a small update for newer phones (6600, 7610, 6630). The only change in the release notes that I can see involves invoking an install dialog when downloading python files from the web rather that running them directly.

    While this is a minor update, it’s forward progress. Hopefully the enhancements and extensions that have been demoed will work their way through the release process as quickly as possible.

  • More Python for Series 60 Crypto: Rijndael

    Rijndael on Series 60

    During my search for pure python Nirvana I came across Bram Cohen‘s rijndael.py. It can work with strings of length 16, 24, or 32. Here’s the sample code that ran successfully (albeit slowly) on my Taco:

    # Make sure rijndael.py is in your libs dir
    from rijndael import rijndael
    # key must be 16, 24, 32 characters long
    key = 'sixteencharacter'
    r = rijndael(key, 16)
    # must encode/decode in the chosen blocksize
    print 'Encoding/Decodingnusing Rijndael...'
    plaintext = 'themonkeygoeswoo'
    ciphertext = r.encrypt(plaintext)
    print r.decrypt(ciphertext)

    It took its sweet time to run, but isn’t much more painful than waiting for import urllib, so it’s not the end of the world. It requires copy and string, which I’m not sure are in the Nokia distribution, but it works just fine if you dump the Python 2.2.2 source libraries in to your libs directory.

    Add this one to your mobile cryptography toolbelt.

  • Python for Series 60 Crypto: DES

    Pure Python DES module

    Speaking of pure python crypto, it looks like PyDES works perfectly too. This one will probably require bits of the Python 2.2.2 source in order to run though. Specifically it’s looking for binascii and time. All in all it’s quite lightweight and seems more responsive in both import time and encrypt/decrypt time as compared to blowfish.py. It’s still very slow compared to a native implementation, but should be fast enough for inclusion in Python for Series 60 apps.

    DES and 3DES are available from this module. I can’t seem to find a reference to what license it is released under, so you might want to track down the author before writing an application around it.

    Here’s the code for the demo above (taken from an example that ships with PyDES):

    import pyDes
    k = pyDes.des("DESCRYPT", pyDes.CBC, "")
    print "Encrypting/Decrypting DES"
    d = k.encrypt("Please encrypt my string")
    print "Decypted string: " + k.decrypt(d)
    k = pyDes.triple_des("MySecretTripleDesKeyData")
    print "Encrypting/Decrypting 3DES"
    d = k.encrypt("Encrypt this sensitive data", "*")
    print "Decypted string: " + k.decrypt(d, "*")

  • Blowfish in Your Pocket

    Blowfish on Python for Series 60

    After finding out how well BeautifulSoup worked on my N-Gage, I decided to try to find more modules that “just worked” on Python for Series 60. First up is blowfish.py, a project by Michael Gilfix. The file itself is not available directly from the author within the US, but Google cache can help with that.

    The module is pure python, with absolutely no module dependencies. I have only tested it on the MMC with the full Python distribution on it, but this one (in theory) should work on a stock .SIS install without any addition python modules in your libs directory. It’s definitely not fast by any stretch of the imagination, but it may be a good building block if you want to add some crypto to your mobile application.

    Here is the code that is being executed in the screen shot above:

    import blowfish
    key = 'hey, look over there!'
    print 'generating the fish'
    fish = blowfish.Blowfish(key)
    print 'Plaintext:'
    text = 'testtest'
    print text
    print 'Encrypting...'
    crypted = fish.encrypt(text)
    print 'Encrypted.'
    # Printing encrypted chars causes barf
    print 'Decrypting...'
    decrypted = fish.decrypt(crypted)
    print 'Decrypted:'
    print decrypted

    
    

  • Mobile Screen Scraping with BeautifulSoup and Python for Series 60

    BeautifulSoup 2 BeautifulSoup 3

    I haven’t had enough time to work up a proper hack for this, but I though I would pass along an interesting discovery that I made the other day before heading out to PyCon. After hearing about how great BeautifulSoup is at scraping HTML and making it easy to get little bits from it that you need, I thought I’d have a go at running it on my taco. You know what? It worked. I was expecting it to barf on import, but no, it chugged along just fine.

    Now unfortunately BeautifulSoup won’t work out of the box with the standard .SIS install of Python for Series 60. It relies only on SGMLParser, string, and types, but those three libraries have some dependencies themselves. Here is what BeautifulSoup requires according to modulefinder.py running on my Debian box:

    • array
    • copy_reg
    • markupbase
    • re
    • sgmllib
    • sre
    • sre_compile
    • sre_constraints
    • sre_parse
    • string
    • strop
    • sys
    • types

    These dependencies can be easily taken care of by dropping the python modules from the source distro in the appropriate libs directory on the drive you installed Python on.

    One reason that BeautfulSoup “just works” on Series 60 is that the author strives to keep imports to a minimum and that the author srives to keep BeautifulSoup backwards compatible all the way back to Python 1.5.2. There are probably many modules out there like BeautifulSoup that are designed to be backwards compatible and platform independent that should work just fine on Series 60. As I find them, I will definitely point them out. I also hope to do some hacking on a few screen scraping apps that use BeautifulSoup and appuifw to present web data using native widgets.

  • In Search of a Javascritpt WYSIWYG HTML Editor that Doesn\’t Suck

    The title says it all. I’m looking for a Javascript-based What-You-See-is-What-You-Get HTML editor that doesn’t suck. I fell in love with HTMLArea when I bought my copy of Radio back in 2001. I’ve since used HTMLArea 2 which is pretty decent but is IE only. Until recently I had been tracking the HTMLArea 3 pre-releases which worked in both IE and Mozilla and were beginning to deal with things like copy/paste content from newer versions of Microsoft Office products that embed all that nasty XMLish markup. The other day I went to htmlarea.com to see if there was a new beta release only to find that the lead contributor had mothballed the project:

    htmlarea 2 and 3 have been discontinued. They were free wysiwyg editors that were distributed on this site. Visit the directory to find similar products.

    What a bummer. The source is still in CVS, and I’m hoping that a leet Javascripter will take over the project, because HTMLArea 3 seemed pretty darn stable and quite near release. I’ve looked quickly at a bunch of possible replacements, but each one seems to have a showstopper. RTE is quite good for when you need a small, simple, compact editor, but it has its quirks. For instance, it’s an editable iframe instead of a layer over textarea, so there are some limits to the script-fu you can do with it. Don’t get the post title wrong, RTE does not suck at all, but it has its limitations.

    And so I ask you, dear reader, what the heck are you using these days for something like this? While I take the time to look closer at the lists of editors that I’ve glossed over before, I’d love to hear from you. Feel free to drop me a line (matt at ooiio dot com) or take a look at my JavascriptWyswiygHtmlEditors page and add your two cents. Please help, I’m at my wits end!

  • Research and Development

    I was joking with a friend about Fortran Server Pages and how silly that would be the other day. A quick google search didn’t reveal anything, although it did unearth some Fortran CGI from the FCC (with source code). While investigating further, I found myself arriving at the R&D sections of a few different companies. I thought I’d collect my findings for you:

    This isn’t an exhaustive list by any means, but there are a lot of amazing research projects, downloadable software, and amazing papers on the other end of those links. If you have some free time, you should look around a few of them.

  • /me is back.

    It’s been a long couple of months and I apologize for the hiatus. It’s a long story for another day, but lets put it this way, I’m back! I’ve moved from Radio Userland to WordPress. I promise that I’ll share my (semi-painful and procrastination-ridden) migration process in due time.

    The .css that is currently driving the site is Dots by Alex King, which I’m currently tweaking. I’ve still got some random bits that I need to find and url rewrite to fit the new engine, but I’ve done my best to keep the old permalinks. If you find something that’s whacky, please drop me a line at matt at the domain ooiio.com. Thanks!

  • Java Certified Codemonkey

    Well, not quite, though I did pass my Java Certified Programmer exam this afternoon.  I’ve spent a fair amount of my free time over the last month studying with this book by Kathy Sierra and Bert Bates.  I picked it up from bookpool at a great price in early June but put the afterburners on in the past week or two.  The tone of the book got to me at times, but what can I say, it allowed me to fill in the gaps and pass the test.

  • Emulated Cross Platform Development

    I managed to coax Xcode on to my new emulated Mac this afternoon.  I’m excited to finally have OSX as a viable (yet slow) development environment.  Building the above sample project took longer than it would have if OSX were running natively, but it’s not, so I’ll cope with it.

    I’ve been experimenting with some binary versions from CVS by Richard Goodwin and the SDL builds by apophis.  They have been a little faster but there’s usually something useful broken at any given time (which is to be expected).  It looks like 0.3.0 will have some major improvements when it comes out.  I’m most excited about the idle code which should save my poor laptop from flooring it the whole time it is emulating.

    Update:

    The latest 0.3.0-pre from CVS is significanlty faster than 0.2.0.  Right now it doesn’t seem to be handling CDs properly, but I’ll just switch back to 0.2.0 if I need to load something from CD.  Another big advantage of 0.3.0-pre is that it has the idle code baked in.  This means that when my virtual mac isn’t doing anything it’s not hammering the processor in my laptop.  It’s much better than 0.2.0, where the bottom of my laptop approaches the temperature of the sun.

  • Serving XHTML-MP With Apache

    So I’m on a bit of a kick this morning.  I wanted to play around with 3GPP on my mobile phone, so I needed to be able to serve XHTML-MP content.  The first thing I did was add a few MimeTypes to the .htaccess folder of my mobile content directory, and tell Apache to use index.xhtmlmp as its index file:

    AddType application/vnd.wap.xhtml+xml .xhtmlmp
    AddType video/3gpp .3gp
    DirectoryIndex index.xhtmlmp

    Then I created a really simple index file, and called it index.xhtmlmp.  I know that .xhtmlmp is an ugly extension.  I’ll do my best to find out if there is a standard extension (or a best practice even) and use that.  For now, here’s an index file:

    <?xml version="1.0" charset="iso-8859-1"?>
    <!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN"
    "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
     <head>
      <title>Matt Croydon::XHTML-MP</title>
     </head>
     <body>
      <a href="tea.xhtmlmp">Testing 3GPP in XHTML-MP</a>
     </body>
    </html>

    That’s about all you need to start serving XHTML-MP content from Apache.

    Right now my XHTML-MP content resides at http://postneo.com/mobile/  Luckily you don’t have to worry about typing index.xhtmlmp, as Apache serves that up for you.  Right now it only holds a link to my tea movie.  It works fine on my 3650, YMMV.