Monday Jul 28, 2008

Newsflash: Alphabet Abused for Marketing Purposes (Again)

Here's another promising contest for [US American] mobile developers with great ideas but no money. :-) Write an original app that runs on the Samsung Instinct phone, and submit it to the Sprint Instinct Contest: The winner gets $20,000!

No clue how useful the device (or the network) is; but even if you don't have the actual phone, it says here, the Sprint WTK includes an Instinct emulator that works together with the NetBeans IDE for Mobility, so you can also take part as dry-swimmer. If you're just generally curious, check out a sample app (zip file) and a Getting Started With Sprint + NetBeans IDE guide to see what it's like. Have fun!

PS: ... Why is this thing called Instinct? Not by any chance because i-N-stinct will always sort right before i-P-hone, hmmm? I wonder how long it will take until somebody releases a mobile device called IOTA, just for the fun of it sorting nicely between the other two squabblers... :-P (Reminds me of the rumour that Nintendo allegedly trademarked the whole aii-bii-cii in preparation for its Wii project. ;-) Aw man, I wanted to do that!)

Wednesday Jun 04, 2008

Attack of the Killer Pixels

(I always wanted to write a blog entry with that title.)

Did you see Swarm, the game that won the Swedish Mobile game award? The Game awards had an extra category for mobile games created with the NetBeans Mobility pack, especially the NetBeans Mobile Game Builder.

Swarm may look simple next to the other games, but be reminded that the other screenshots are taken from fullscreen Xboxes and Windows PCs, while Swarm is a tiny mobile game on a phone screen. (I just think it is mean to depict them next to each other. ;-P)

Anyway, the screenshot doesn't do the gameplay justice: You are on your way through a maze heading for targets, but you don't control a character or vehicle, you control a swarm of pixels. The challenge is to steer the cloud. For instance if you go around a corner too fast, some of the pixels may fall behind and disconnect from the group. Is it worth going back for them to catch up, or are you running out of time and you just must deliver the pixels that you have? Interesting idea! I also kind-a liked the subtle running gag that makes up the game's background-story - you will see. :)

Install it on your phone, or download the JAR/JAD files and play the game in a mobile emulator in NetBeans. (For Mac OS, this is how to install a Java ME SDK and emulator on a Mac.) Open the JAD file to run the game. I haven't gotten far yet, I wonder what happens in higher levels? Tell us if you find out, and have fun!

Wednesday Feb 06, 2008

Have Mercy With Unreal Developers and Gimme a Suite! Please?

Reading this new NetBeans Intro on Forum.Nokia.Com makes me want to continue with my poor little Java ME game... :-) The main reason that it's on hold is just as silly as that I need to clearly define the game resources and rules. Basic stuff like what "cards" you can or cannot play, and how many points you get, I never really defined that, argh... The Java part I can handle. ;)

Another article about the different SDKs is available too, including a video, which for some reason is an exe file, what the hey? Oh I remember, all real Java ME developers use Windows. :( But I, I am only an unreal developer, I just write silly buggy stuff over the weekend, my phone doesn't do Symbian, and I use Linux, bad luck for me. :(

Wasn't there something like a Nokia PC Suite for Linux somewhere, does anybody know what became of it? Because, if you use PC Suite, you can directly send the application from Netbeans to your test phone, via Bluetooth or USB - spiffy. But well, only on Windows, it seems.

Thursday Feb 22, 2007

The Sideeffects of Sun SPOTs

Once a fellow student introduced me to the big secret how sysadmins really work so efficiently: If a user asks you a question, start typing frantically on your linux box. Do a quick telnet 666, then you go "Aah!" and read out loud what the detected cause of their problem was. (And then you go back to playing CounterStrike.) I got curious and connected to the telnet port, and the BOFH oracle told me:

The cause of the problem is: Electromagnetic disturbances caused by sun spot activity.

We laughed and for a while it was a running gag to reply "Sun spots" to every why-question. ("Dude why d'you frag me??" - "Uuuh. Sun spots?")

But it's a fact. Now that Martin Grebac showed us a real Sun SPOT, I completely understand how activities involving them causes disturbances in your work. :-o

As you all know, Sun SPOTs are black. Also, they are cuboid, and about as big as a computer mouse, but about twice as heavy I'd say. What distinguishes them from sun spots (black, big, round, wavy) is that SPOTs have built-in WIFI, a row of LEDs, and of course sensors. With its sensors a SPOT can detect temperature, light and 3D acceleration (i.e. which way it is moving in 3D space). Throw a couple in your room, and bang, wireless sensor network. More advanced users throw them into a twister and shoot a movie about it.

The interesting thing of course is, that SPOTs are programmable in Java. Instead of TinyOS, SPOTs come with a JVM which runs code written for Java ME CLDC, and you write and deploy your app the same way that you do for a mobile phone (e.g. using NetBeans). You extend the main class from MIDlet and use a board object that has accessors like getTemperature() etc, and setters and getters like getLEDs() and led[1].setRGB(...), to give you an idea.

Marting showed us some examples that will be included in the box when it is available in stores: For instance, when you switch a SPOT on for the first time, there may be a demo program running that lights a light in the row of LEDs depending on which way you shake the SPOT -- a nice effect to demonstrate the 3D accelerometer. :-) If you switch on the second SPOT of a set, it recogizes the first one, and Martin showed how you can sync them so the wandering LED light seems to ping pong from one SPOT over to the other. :-D Hours of fun! Perfect gift for a geek! If only they were already for sale... :-/

Well, gives us more time to refresh our memory on threading and to come up with something wicked to use these cuties for.... Hmmmm-- Huh, what? Why am I plotting plans and not working, you ask? As I said: Sun Spots!

Thursday Feb 08, 2007

What if my Only Cam is Inside my Mobile?

How can you shoot a movie of your mobile with your mobile? Mirrors? And then win whatever it is they are giving away in this contest. Ah. PlayStation. Hmmm. Any good playstation games out there that are worth resuming my half finished mobile game and shooting a movie of it? Splinter Cell sounds good. (BTW does anybody have a copy of thief the dark project he want to sell for a buck? Write me. I need it for... research purposes.) But probably you can only win prizes for video taping something useful anyway. Bah. Useful applications are way overrated.

In the good old days, at the MacHack (oh sorry, I mean "ADHOC"), I remember, useful was the worst rating you could get at the contest. People submitted entries to the hack contest such as a plugin that uses the web cam to look at colored plates you hold up, and if the plate's green, it scrolls your text editor page up, and if the plate is red, it scrolls down or so. My favorite hack was this JPG network sniffer game (I forgot the name), did I mention it before? It goes like that: A group of persons hangs out in the same LAN in talking distance. Then the one whose turn it is googles for a search term in the image search. While his machine is downloading the images, the other participants use the tool to scan the network traffic for images and look at them: They get a more or less random assortment of image search results (possibly from other LAN users too) -- and to win they must guess what the search term was, based on what they see! Hilarious. :)

OK, that exactly is probably not a suitable game for the contest, I'm just saying, if it's fun for the users, do it, even if it's objectively useless. (I'm an employee and not allowed to take part. Bah.) :-(

Friday Aug 25, 2006

Happy Birthday

Hm. What would you pick as a birthday present: Just something you can buy anywhere -- or something personal, unique, individual? Just a bunch of files on a storage medium -- or an actual spiffy object you can carry around with you?

Sounds like an easy choice? What if the spiffy object is the buy-off-the-shelf item, and the bunch-a-files is the unique individual hand-hacked item? Still easy? Hm...

Luckily, the question sorted itself out. My brother performed the Freundian slip of getting his unloved mobile stolen in a country where it does not even work(!). My mysterious bunch-a-files was targeted to be used on that phone. No phone? No phone-related birthday files. :-P So (to everyone's big relief) I gotta go with birthday present solution number two: A booooring iPod Nano.

What will happen to the poor carefully custom-made bunch-a-files? Will they be cruelly deleted? What if he buys a new phone (or gets one for his birthday), wouldn't they work on the new one too? Well, probably not. Nobody in their right mind uses midi NTH themes on a modern phone if you can have real tones and real graphics... Yep, that would have been my great birthday present idea. Custom theme files for his Nokia phone. =-)

Before they grow stale, I thought I just upload them here and donate them to the public domain. Whaddaya think?

Have fun...

Sunday Jul 30, 2006

How Much RAM Does Your Mobile Have?

TastePhone is a useful Java ME application that displays virtually everything that can be detected about your phone. Most people vaguely know what version of CLDC and MIDP their phone supports -- But have you ever wondered how fast you phone would be if it was a PC?

Now I know my phone's (Nokia 6822) Java virtual processor speed is 0.7 Mhz, which allegedly is equivalent to a PIII at 12.6MHz! :-D My RAM heap is 512kb, of which 466kB are free after startup, and it can read and write about 0.370 MB/sec from and to memory. The screen supports 4096 colors, and TastePhone gives you an overview of which keys are used for what in a mobile game (like UP, DOWN, FIRE, etc).

It has some minor bugs, such as claiming my time zone offset is -3600000 (oops, my Time Lord identity has been revealed!); and it also says my phone does not support audio and video recording, which is does, admittedly in bad quality, does that not count? :-P

Still a pretty useful piece of software if you're programming for the Java ME platform and need more detailed benchmarks than what the brochure at the store gives you, not only about RAM and speed, but all that crazy stuff like whether you can use PointerEvents, PointerMotionEvents, RepeatEvents, or whether the device can run a Midlet in the background or supports a double buffered screen. This app detects more features than I knew existed...

Sunday Jul 16, 2006

More Nokia Theme Silliness? This way

Hi and welcome to my new readers. Yes, I mean you guys who google for "free Nokia NTH theme download". \*waves!\* Let's get started. Today's topic is science fiction. After much popular demand by my one reader (who prefers to remain anonymous) I hacked us a Doctor Who theme for S40 Nokias. Oh and (hold on to your mobile!) while I was at it, I made a third one, for Firefly/Serenity fans.

Tadaa: Groovy little DIY themes for Series 40 Nokias

Dr Who
The choice was clear: I went for the ninth doctor, Christopher Eccleston and some Daleks. Don't you agree the theme music is just brilliant? I watched the first black&white Dr Who episode, from the Sixties, and it had the exact same theme! Talking about timeless.

Yupp. Cowboys with spaceships. Unsurprisingly, the tune has a slight country touch. But not too much. (Your mobile renders boths banjos and fiddles as beeps anyway, so don't worry about your reputation).

Tori's Winter
That's the first one from last week again, for completeness' sake. Tori Amos, 'Little Earthquakes' art, and the Winter tune. No science fiction here, sorry.

How to install? There are two ways:

  • Either, download the NTH files to your hard drive under Windows. Use a cable or Bluetooth to access your phone's memory in the Nokia Phone Browser: drop the NTH files into the Themes folder. That's the safest and cheapest method.

  • Or, if you feel like making experiments, you can go the Phone's Web menu, select Download links > Theme Downloads > Options > New Downlaod Link > Enter Address, and enter to access a direct download page for various files. Note that your provider will charge you for GPRS (even though the files are free!), also some phones (or providers?) have download limits that will prevent you from successfully downloading! Hypothetically, it works with WAP/wml too, but I can't test it and I don't know whether our server even handles WAP/wml requests.

Please drop me a note whether it works for you.

Thursday Jun 29, 2006

Hack Your Own Nokia Theme

Thanks to Adam Freeman to point out in a comment that it's possible to create themes for Nokia phones with Nokia Theme Studio. But if you just want a quick and primitive Series 40 theme (a wallpaper, a screensaver animation, one highlight color, plus a midi ringtone) there's an even easier way: [Note: I am again using the Linux commandline and the Windows GUI in parallel here, don't let that confuse you.]

  1. Use PC Suite to view your phone's file system in the Windows Explorer ("My Computer"). Go to the Gallery > Themes directory. Nokia themes are stored as \*.nth files.

  2. Copy any Nth file to your harddrive as a template. Open it with a decompression tool (WinZip, GnuZip) — Nth is actually just a renamed Zip file, as the Linux file command reveals:
    > file YellowLace.nth 
    YellowLace.nth: Zip archive data, at least v2.0 to extract

  3. OK, you unzipped it and get four files. The theme's contents are in common formats (gif, jpg, midi and xml) and just ask for you hacking them.

    $ unzip YellowLace.nth 
    Archive:  YellowLace.nth
      inflating: theme_descriptor.xml    
      inflating: Worldly.MID             
      inflating: YellowLace.gif          
      inflating: YellowLace.jpg 

    The gif file is a graphic animation the size of an S40 screen which is used as the screensaver. The jpg file is a static wallpaper image of the same size for the background. The .MID file is a (seemingly normal) midi music file. More about the midi file later.

  4. The theme_descriptor.xml is a very short xml file that can be opened and edited in a plain text editor. You don't need to know much to be able to read XML: It's just key-value pairs.
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE theme PUBLIC "-//NOKIA//DTD THEME 1.0//EN" "theme.dtd">
    <theme name="Yellow Lace" version="1.0">
      <wallpaper   src="YellowLace.jpg"/>
      <screensaver src="YellowLace.gif"/>
      <ringtone    src="Worldly.MID"/>
      <colorscheme color="gray"/>

OK, now that we know the format, the hacking part is easy.

  1. Replace the midi, jpg and gif files by a midi song, a wallpaper and an animation of your own choice.
    • Make sure the size of the gif and jpg graphics fit your phone's screen (128x128). Compress the graphics, the less diskspace the files take, the better.
    • Reduce the jpg's contrast and increase it's brightness. Choose an image with few colors and not to many fuzzy details. Otherwise the wallpaper will look like something that rhymes with French pancakes.
    • Create a sequence of square gif files (image01.gif, image02.gif...) and turn them into a gif animation loop; in Linux, you'd e.g. use Image Magick for that:
      $ convert -scale 128x128 image\*.gif
      $ convert -delay 200 -loop 10 image\*.gif animation.gif
    • There are countless archives where you can download any midi song for free. Here's the catch: They are all plain run-of-the-mill MIDI -- but Nokia phones use SP MIDI. The SP MIDI format includes a header with priority information for sound channels, so a limited low-end device can skip playing low-priority channels. I used trial versions of two Windows tools, PsmPlayer to crop the long midi file and save it as SP MIDI, and MMSguru's MIDIscale to assign priorities. You can skip the priorities if your midi only has 4 channels or so. You can skip cropping if your midi file is short and starts with the main motive right away.
  2. Then, open the xml file in a plain text editor and replace the file name values by your files' names. Set the theme name to your theme's name. I don't know what colors exactly you can enter in the colorscheme field, but it takes plain words like orange and blue, just don't be too creative.
  3. Zip the four files into an archive. Make sure they are not in a folder in the archive. Rename the zip file 's suffix to nth.
  4. Copy you theme into the mounted phones Gallery > Themes folder...

That's it. :-) So just for example... \*digging around on my harddrive for images and midis\*... try this ... say... Nokia S40 "Tori Amos" theme. The Tori-in-a-crate sequence from the Little Earthqukaes cover art is too tempting for a 128x128 screensaver. The music is Winter: Perfect ringtone, since it uses only two channels, has no fancy instruments that the phone could distort, no percussion, just a straight but intelligent tune. If you have a S40 Nokia, try it and tell me whether it works for you. If you don't have a Nokia -- tsk, who cares? Download it, unzip it and listen to the midi while watching the animation in a webbrowser. ;-D

Soooo, what's next? I have 3 more midis for themes, Babylon 5, Firefly, Doctor Who, and one more tune I cannot put a name on. (Then there's also MacGyver, Knight Rider, Mission Impossible... But everybody has those midis already.) If you want one, this is your chance to vote, otherwise I pick one.

Saturday Jun 24, 2006

Installing a JAR File on a Phone (Part 2)

Ah, I wanted to tell you about my Windows adventure, just for completeness' sake. As you might have noticed from my recent blog entries, I am switching between Linux, Windows and MacOS a great deal (It certainly doesn't hurt to be "platform-independent" as a living being too, hence the cryptic title of this whole blog).

So, this time, it's Java ME in Windows. Or rather, Bluetooth in Windows. Like MacOS X, Windows has a proper out-of-the-box Bluetooth setup, and the phone's PC-software works well directly after installing. (My trick is -- I only use Windows when I have to. This way it doesn't get misconfigured or over-worked or fragmented or whatever its problem is. So the three times or so I needed to use Windows, it worked pretty decently.)

I had already 'paired' my mobile with my notebook earlier, so Windows recognizes it immediately when I activate Bluetooth. That's why after installation, the first Nokia PC Suite wizard immediately recognized all Bluetooth enabled devices and mounted the Nokia phone in the 'My Computer' window. I dug around a bit on the device, and came up with the brilliant idea to backup all those wacky Nokia Themes and Cliparts I never use to my harddrive, and then delete them from the phone. >:-D Well, three Themes turned out to be undeletable (the Delete menu item was grayed out), but that's OK, I have now almost 1.8 MB of free space on my mobile. (Gosh that reminds me of our Mac LC days. "1.8 MB! Who'd ever need so much space!?") If you're the guy who creates Themes at Nokia: I regret to tell you I did not like them at all, except maybe for the yellow+red one, which was kind of okay-ish. (is there a way to create your own themes? Maybe I can copy and hack one of the existing ones... Hmmm...)

As another aside, one of the Nokia 6822's weeknesses really is its small amount of disk space, so deleting unused items helps a lot. Its second weekness, by the way, is its small screen, only 128\*128 (color). It's enough to work with, but current devices are of course better equipped in both aspects.

Back to installing JAR files via Bluetooth in Windows: It's really not so exciting. After you established the connection to the phone (note the coffee bean thing in the system tray? That's the Nokia menu, if you need it), the first thing you notice is, you can't just drag and drop the JAR to the phone in the explorer. Instead you need to click the last button of the PC Suite setup Wizard, and it opens a nice interface with several tasks, one of which is Installing Applications --

-- But! If you now go back and look at your JAR file in the Explorer, you notice that ta-daa, its file icon has changed to four colorful squares. I don't know whether that's good or bad. But anyway, if you double-click the JAR now, PC Suite immediately suggests to install it on the mobile device via Bluetooth -- that's it. (Sounds user-friendly, but this could be a bummer if I ever wanted to do anything else with JAR files later. Like. Execute them?) The mobile app silently appears in a directory on the phone without any further interaction or dialog on the phone's side. I assume this is because you paired the PC and the phone, meaning the phone trusts you to only send secure files. (Good luck, phone. I wrote that sample app. How secure can it be?) And also note that, even though you know the application you sent is a game, it does not appear under Applications > Games, but under Applications > Collection, where all general applications are stored on Nokia phones.

Oh hey, and while you're in Application > Collection menu: If you're not into stock options, you can totally save another couple of KBs by deleting the 'Portfolio' application! If you're the guy who pre-installs applications at Nokia: Don't get me wrong, I appreciate Nokia providing us with sample applications, and I know the phone was targeted for businessmen, etc etc, I'm not complaining. I am just... customizing it. =-)

Sunday Jun 18, 2006

Installing a JAR File on a Phone (Part 1)

OK, say I have, like, a totally super Java ME application. Admittedly, it doesn't do much: It generates a game map and you can walk throught it one-way, but nothing exciting happens. The project compiles and runs with the NetBeans Mobility Pack default phone emulator, and there's a JAR file in the project's dist directory that contains the complete application (even a JAD info file if I needed it). Perfect. Now, I want to see what the app looks like on my mobile phone. But... how does it get there? =-(

The easiest method is Bluetooth file transfer (or of course a direct USB cable, but I have none). I know how to receive files with Bluetooth in Linux, but I can't send them, since I am missing the sending part on the notebook's side... Of course there's the Nokia PC Suite for that. Alas, it's for Windows only.

Before I install PC Suite, I have another idea: MacOS has an Apache webserver... Can't I just go online, write down my temporary IP address, switch on the webserver, drop the JAR file into /Library/WebServer/Documents/, and... use the mobile's webbrowser to download the JAR file? I'd need to pay a fee to establish the GPRS connection, but I only want to try it once anyway...

Well 'once', that's what they all say. Of course the first try fails -- the mobile's browser opens the JAR file as text?! (In retrospect, did I use the wrong menu? My Nokia has an extra menu item for installing applications from a URL, but I used the general browser.) So first I need to make sure my webserver assigns the JAR the correct mime type.

Depending on your webserver, you need to find the mimetype configuration settings: For Apache on MacOS this is for instance /private/etc/httpd/mime.types. You need administrator privileges to edit this file. Add these two lines, one for the type and one for the suffix

text/        jad
application/java-archive        jar

Don't forget to restart the webserver to activate the change. In MacOS you restart Apache via the Apple Menu > System Preferences > Sharing by stopping and restarting Personal Web Sharing.

And... Yes, the second download attempt works! (This time, I also made sure to use the mobile's Web > Download menu item instead of Web > Go To Address.) The phone offers me now to install and run the JAR file, if I trust it. Oh my, how exciting!

Result? The game runs! Yay! Only... my game screen is bigger than the mobile's actual screen.. :-( The lower half of the map is cut off... Lukas' tip for resizing the emulator screen works fine (thanks!), but I will bother with optimizing the size settings tomorrow. \*yawn\* In part 2 we will see how far I'll get with the PC Suite and Bluetooth. At least I know now my app works. :-) :-) :-)

Saturday Jun 10, 2006

Mobile Phones, Space Aliens and Dinosaurs

Many will agree that it's more motivating to learn a new programming language by either implementing something immediately useful (like Ramon Ramos' modules) — or something immediately funny. So during JavaOne I bought this nice book J2ME Games with MIDP2 by Carol Hamer. (J2ME is now renamed to Java ME by the way.) Have a look at the reviews, and I think you will totally agree with the comments stating that Java ME games are one of the last areas where you still can write a complete game on your own without a team of designers and storyboard specialists.

Some words about the book: It assumes you already know Java and just shows the differences and mentions best practices. The content itself is solid and useful, even if it's often annoying to read dozens of pages of source code with only a few jotted-down comments between the lines.
Speaking of which, you can download the source code and the sample projects can be imported into NetBeans IDE with the Mobility Pack installed. When you create a new project, select Mobile > Import Wireless Toolkit Project, and there you are. The first game (Maze) works right away, the tumbleweed game however has a fixed screensize and does not run on the emulator because the emulator's screen is too big... Go figure. I can't just comment out the screen size test to make it run, and I have not yet found out if I can change the emulators screensize (anybody know?), and I don't want to rewrite the whole thing to make one little sample file fit. I'd rather spend the time on writing my own game.

So on Sunday I just took the maze game as a skeleton and started playing with the javax.microedition.lcdui libraries. One of the big differences between Java SE and ME is: On Mobiles, you don't use swing libraries. The alternative, LCDUI, is very limited, but well, it's not called microedition for nothing. When you use New > Visual MIDlet to create a MIDlet, you'll get to see the Mobility Pack's famous visual designer. If you drop a PNG image file into the the same directory with the MIDlet, you can select and display it, e.g. on a splashscreen. There's still a lot to find out for me.

My game-to-be can already draw some pretty fancy lines and colored rectangles to their correct positions on the screen, and I already have a class that contains the randomized game map in an int[][] array. (I needed to use some crazy g.drawString(Integer.toString(myMaze.getTileFromMaze(i,j)),20+i\*17,30+j\*17,g.TOP|g.LEFT); line just to print the array to the screen and test whether it was correctly generated. Is there no easier way to do System.out.println()? Need to investigate.) Map generation probably still needs some optimizing (it runs in zero time on the emulator. On a 1.6 Ghz CPU... But how many Ghz does my mobile phone have? You see what I mean.) I also found out that there is no filled polygon routine in javax.microedition.lcdui.Graphics, but you can replace that by drawing lines, and filling the space in between with several fillTriangle()s.
Now nothing can stop me, Muahahahaha! 8-) The greatest mobile card game ever! Including first-person 3D racing! And space aliens! And dinosaurs!! All at the same time! Or maybe not. ;-) Let's see what I come up with. :-P

Thursday Jun 08, 2006

I Used a Linux Tool and it Worked

I am as shocked as you to report this outrageous heresy. My Linux laptop can receive files. Via Bluetooth. From my mobile phone. And I didn't get to configure anything! Nothing! What is Fedora 3 thinking to pull a MacOS on me?! ;-o

Come on! I was looking forward to hours of RTFMing hcitool, hciconfig and bluez... days of downloading iffy drivers and updates... weeks of configuring and tweaking /etc/bluetooth/\*.conf... And now that! I didn't even had to ... recompile the kernel! What world are we living in?

What's outrageous about all that? Well obviously, if I had known that earlier, I could have worked in Linux during JavaOne instead of rebooting to Windows all the time to copy over a file from my mobile to the harddrive!! Which I did quite frequently, since I was using the phone as a typewriter during sessions. (Nope, no T9 craziness. I got myself a cheap used Nokia 6822 for that purpose. Yeah baby: Full keyboard! Pretty tiny keyboard, I admit, but, worked for me.)

And all that was made possible by some anonymous developer (let's call him Edd Dumbill) who equipped my Fedora with a fully working Bluetooth setup without telling me! Well, apart from putting two big menu items that say Bluetooth File Sharing and Bluetooth Manager into the root menu. But who's using GUI menus anyway? You are? Oh. =-) Well, anyway.

I cautiously flicked some obscure WLAN switch on my vaio, and also activated my mobile's Bluetooth and made it "visible". I selected the Bluetooth File Sharing from the root menu (which adds a little daemon-thingy to the tray), and I also opened the Bluetooth Manager. (For obvious reasons it complains if you do it the other way round.) I let the Manager GUI scan for devices (equivalent to hcitool scan) and it finds my mobile (and some other stuff with blue teeth). I make my mobile send the file via Bluetooth, and select my laptop from the list as target. A message pops up on my laptop screen telling me it'll just like, dump this like totally blurry Image000.jpg into my homedir if I'm groovy with that, 'kay? — That's it. It's too effin' easy, damnit! How am I supposed to write about Linux hacks if there's nothing to hack?? Yes Edd, I'm looking at you.

Fedora 3 + bluez + hcitool = Bluetooth file transfer! Hurray!

Well, now that I transfered the files from the phone I at least have the official confirmation that the Nokia 6822's camera is as weak as expected. (It said VGA in the specs, no surprise there.) The pic's washed-out and blurry, but it's enough if you need a mugshot to visually accompany a call, I figure. (Or, a wallpaper of a monster that you take from a gremlin calendar. Muhahahaha.) The first sample pic that I spontaneously took this morning was of a military brass band I bumped into on my way to work, complete with big-shot VIPs (old war heros?) next to a tiny war memorial. \*Squinting at picture\* Or at least I think it is.

And yes, my window manager has a MacOS 9 theme; and yes, my mobile phone's name is set to Help let me out — You've got a problem with that? :-P I must have typed that line into the name field during JavaOne when I realized I had never actually tried Bluetooth file transfer and had no clue what to do at first. Hey... It just occured to me that this method (changing your phone's Bluetooth name) could be a great means of close-range communication. Muahahahah... Admittedly, it's likely to wear out the battery, rescanning takes a sec or two, and you only have 20 or so characters per 'message'... still, you don't pay any SMS fees, and can chat simultaneously with several bluetooth users within range... Try it now while you still think it's funny! ;-)

Monday May 22, 2006

Your Mobile Wants You To Know This

Java ME, here I come. ;-) Yesterday after coming home JavaOne, I talked to a nice Swiss business man and he spontaneously gave me his old Motorola, simply because he just had bought a new one! :-o (And no, it wasn't stolen, he had the cables and original Software on CD and all.) And as we all know, having a "set" of devices (I just bought a Nokia last week) to test apps on is the first step to Java ME development... :-)

At least that's what Rodney Aiglstorfer (?) said at his Java ME Troubleshooting session at JavaOne 2006. He did not only reveal his secrets of the trade (see below) but also made me aware of the differences in the USA and European markets: Neither did I know that a lot of Americans use mobile phones without SIM cards, nor that SIM card phones are refered to as "GSM". Probably in Europe nobody talks about this distinction because there is only one system, as opposed to the USA where you choose between GSM and CDMA.

Asia and Europe are already huge markets for Mobile applications, and the USA is about to catch up: Looks like good business perspectives for professional Java ME developers. Here are some interesting items form the JavaOne JavaME Troubleshooting session:

Debugging and Testing

  • The big Java ME development secret: "Run once, test everywhere". If you are a professional Mobile developer this literally means purchasing and testing each device, or at last device family.
  • Workflow secret: The first 90% of testing is done on emulators. Then you test the app on a device family (e.g. S60 phones) and then on a random selection of individual devices. Members of a "device family" in this sense do not have to be from the same manufacturer, you cluster them by features that are important to your kind of application.
  • JUnit test secret: Only the GUI should need human testing - all other tests should be done automatically. Use ME4SE as MIDP library when running JUnit tests.
  • Debugging secret: For most developers, the only way to debug mobile apps is using System.out.println() ... You can also write your own logfile to the Record Management System (RMS).
  • Tip 1: I want to pipe in that NetBeans Mobility Pack comes with a debugger, e.g. for Siemens and Sony Ericsson devices!
  • Tip 2: Declare a final static boolean and use it as a debug print switch -- in the deployment version, staticly false if-statements will be automatically stripped out by the compiler.
  • Tip 3: is a remote device testing company who can provide you with test results of your application on any number of devices.

Java ME Tools

  • For Java ME development you need the Sun Wireless Toolkit WTK. Some tools even offer artificial clockspeed delay etc to simulate the response (or lack thereof) of slow devices.
  • There are still people out there developing sucessfully with only emacs + ant. :-) Other alternatives are the NetBeans and Eclipse IDEs.
  • Java programming on Blackberry is quite a pain in the neck. Recommendation: NetBeans Mobility Pack or the Blackberry IDE.
  • MacOS as a development platform is unfortunately lacking many emulators. On MacOS, the speaker himself uses Eclipse + ME4SE (from

Increasing the target group

  • Use MIDP 1.0 instead of 2.0 when possible.
  • Make sure your app's JAR files are as small as possible, this means 30kb-100kb.
  • Avoid requiring special device or carrier APIs, bluetooth, 3D libraries, etc just because they are cool.

Java ME networking secrets:

  • Only http is widely supported.
  • Put each network request in separate thread to prevent lock-ups!
  • Download webdata in chunks - it's faster and can be canceled; only tiny amounts of data should be fully downloaded in one piece.
  • Note that the length of a stream of data is unknown in advance, the EOF is only marked by a -1.
  • Closing a connection is often the cause of a crash.
  • Some carriers cash webcontent -- if up-to-date data is needed, add a random number argument to the URL to make it appear new to the caching server.
  • Carriers can control and change http headers, so you can't trust them.

Java ME imaging secrets:

  • Use PNG file format for images. Note that MIDP 1.0 does not support transparency for PNG. There are various PNG formats, you need to try which is best.
  • If you have lots of images, use tiled maps instead of several individual files to improve performance!
  • Always double-buffer.

XML parsing secrets:

  • Use a pull parser (with buffering, and while-switch-case), it's faster.
  • Recommendation: WBXML + KXML parser.

Data storage secrets:

  • Use the Record Management Store (RMS)'s RecordStore API for persistant data storage.
  • Don't forget that a MIDlet cannot necessarily access all of the theoretically available memory!
  • The definition of the MIDlet-Data-Size attribute varies from device to device (can refer to a hard or soft size limit!) -- so don't trust the API, always test.

Unsorted Java ME secrets:

  • If you plan to develop premium services for carriers, be aware they don't pay well, some even require you to pay fees. On the other hand, premium SMS is becoming a common means of downloading pay-to-use content to your mobile phone and it's already a promising market in Europe.
  • Certify (sign) your app, otherwise your app will display an annoying dialogue with each connect.
  • The fewer classes your app uses, the better: Fewer classes means more free heap space, which means less crashes.
  • Depending on the device, the pauseApp() method sometimes pauses, and sometimes exits!
  • The speaker listed Sony-Ericsson and Nokia as examples of good mobile device manufacturers, and Sprint and Cingular as examples of good carriers.

Monday May 08, 2006

I'm Not Stupid, I'm a Digital Ghost

Ever played Tron? Live? In 3D? In a city? I just read an article titled Intelligente Experimente stating "mobile games don't have to be stupid!" It's German, but I'll translate it for you. :-) Coz this is cool, listen to that:

Starting August 2006, the south-west German city of Regensburg (that's near Munich) offers her tourists a new treat: The pervasive exploration game REXplorer invites visitors to discover the city's history with the aid of a mobile phone. Worldwide, this is the first mobile game of its kind that will be permanently installed in a city. The game was developed by scientists from two technical universities, RWTH Aachen (Germany) und ETH Zürich (Switzerland) in cooperation with Nokia.

Explorers are equipped with an artificially intelligent device, a modified GPS mobile phone. Their mission: Assist local scientists in researching mysterious phenomena in Regenburg's Old Town! The device guides them to interesting locations and lets them get in touch with local spirits. [I'm not kidding you, that's what it says.] RWTH's Tico Ballagas, who was responsible for the game's implementation, explains: "When an explorer arrives at certain locations, the mobile device displays an increasing heart beat. Making certain gestures gets the explorer in contact with a local spirit. The spirit speaks via the mobile's loudspeakers to tell a story about the history of this location, and asks the visitors to perform a task for him."

The device may for example lead players to an old tower, where the ghost of a Jewish merchant tells his story. The spirit asks them to go to the synagogue for him and bring him a photograph. In search of the synagogue however, the visitors learn it was destroyed decades ago. There's nothing else to do than taking a picture of the memorial that was raised in the synagogue's place. The quest is solved (and the ghost can rest again) as soon as they upload the photograph to their team's blog. The team with the most mysteries solved wins. At the end of the day, the blog remains as a personal souvenir.

Some pervasive games are already available for free, others can be downloaded for a small fee, or are pre-installed on modified mobiles that are lent to tourists. Mobile games of this kind often need a mobile device equipped with a camera, a wide display, and GPS. The fly catching game Skeeter uses the built-in camera to interpret the player's gestures as game moves. In the 3D game Tron, the GPS locates the player in the real world, and walking through the city leaves lines on the map on the mobile's display — cross another player's line during the game and you lose...

LOL. Isn't this great? And now the best thing -- It happens to be the case I need to buy a new cell phone... (My old one is dual-band only, which would be sub-optimal for staying in contact during NetBeans Day and JavaOne). Of course, my new one will support MIDP 2.0... And just by chance I happen to know where I can get a nice Mobility Pack... ;-) I'm not gonna start right away with the GPS stuff, ;-) but I suddenly feel very tempted to write something, anything, myself that I can run on the new phone... Stay t00ned for the first episode of "I crashed my cell with tetris but it was worth it" (hopefully) soon on this channel!


NetBeans IDE, Java SE and ME, 3D Games, Linux, Mac, Cocoa, Prague, Linguistics.


« April 2014

No bookmarks in folder