?

Log in

No account? Create an account
Comment Hack for appinfo.json
pokemon
unwiredben
I really like JSON.  It's easy to write, easy to parse, and more compact than XML, and it works great as a way to pass around method parameters and return values.  However, it has a big flaw -- there is no way to write a comment in a JSON file.  The // and /* */ syntax used by JavaScript isn't supported, so many JSON parsers will reject files that have them.

Every application on Palm webOS comes with an appinfo.json file that describes key information like it's title, where it's icon lives, and it's application ID.  For some samples I'm doing, I'd like to write some comments in appinfo.json so people know where to change the values for their application.  However, I spotted a way out.  Deep in our documentation, we note that this file can contain other JSON attributes beyond what we specify.  So, I realized that no one has to use those elements, and if you name them something ridiculous like "// c1", they're unlikely to ever conflict with an application's use.  So now, I can write things like

{
   "// c1": "The next attribute, id, defines the permanent ID for your program. Change it!",
   "id" : "com.palmdts.example",
   ...
}

without invoking the wrath of the JSON parsers.

Palm Blogging Moves to Official Site
pokemon
unwiredben
So, I had a bunch of fellow developer relations people basically jump me this morning, say they like what I've been posting, but that it really should go on the official Palm developer blog.  I'm cool with that, so effectively immediately, I'll be moving my Palm webOS-related posts over to http://developer.palm.com/blog.  I'm going to be reposting the first part of my series there, and we're getting the FAQ that I posted in part 2 turned into official Plug-In Development Kit documentation.  The true second part, the one that actually comes with code, should go up on Thursday -- I've been really busy this week with a secret project that you all should learn about soon. :)

Plugin Development Kit, Part 2: FAQs
pokemon
unwiredben
Before I jump into my sample code, there are some frequently asked questions about the current 1st beta of the Palm webOS Plugin Development Kit (PDK) that I wanted to collect here.

Note: this FAQ is about the first release of the PDK.  This is not the final version of things that will ship on device.

(Update 1: clarified camera and microphone access to indicate that you can mix Mojo and PDK to get access to images)

(Update 2: this FAQ is now an official Technical FAQ and hosted at developer.palm.com.  Go there for the up-to-date version.)

Read more...Collapse )

webOS and the Plugin Development Kit, Part 1
pokemon
unwiredben
So, I'm finishing my fourth week with the webOS developer relations team.  It's been a really fun and busy ride,  I've been asserting my presence on the developer forums and many questions have been answered.

However, I really need to be writing and making sample code.  This will help avoid questions and help a lot of people.  I'm going to be doing both of those here, with the final product getting polished and put up on the Palm Developer Site eventually.  Consider these posts a working draft.

Our Plugin Development Kit (PDK from here onward) is a set of tools and libraries for making native applications on webOS.  Most apps now are written like websites; they have HTML, JavaScript, CSS, and images, and they run inside the special version of WebKit we call LunaSysManager.  Native apps, in contrast, are actual compiled code.  They're originally written in C or C++, compiled down to ARM machine language, and run directly on the device.  WebKit is still there, but it mostly stays out of the way and just gives the PDK app a window to draw in.

We've got three APIs that are used for PDK apps.  The first is SDL (Simple Directmedia Library).  Our current release is based on SDL 1.2.  This API gives you drawing surfaces, 2D primitives, image loading, fonts, events, timers, network access, accelerometer (via joystick APIs), touch screen (via mouse APIs).  It's well described at the libsdl.org website.

The second API is PDL (Palm Direct Library, perhaps?).  This gives access to some system services like screen orientation, the location system and the device ID number.  It also has calls that allow your plugin to register methods that can be called from JavaScript.  The reference for this is online.

The final API is Open GL ES.  We support both version 1.1 and 2.0, although not both in the same program.  Open GL ES 1.1 has a fixed-function pipeline and works well for a lot of 2D and 3D applications, while ES 2.0 uses a programmable shader system which is more complicated for simple programs, but very powerful in its ability to shift vertex transformation and shading into the GPU.  I'm still learning the Open GL way, but I hope to blog about my experience getting some GL ES 2.0 sample code running on the device.

Next time, we explore some basic SDL-based sample code.

My Merit Badges
pokemon
unwiredben


In going through some old clothes, I recently found my sashes and neckerchiefs from my Boy Scout days. I was in Varnell's Troop 67 from the time I graduated from Webelos to the middle of high school. I made Eagle when I was 14, about as fast as was possible, mostly through the constant prodding and help of my dad. My Eagle project was renovating a room at the old Varnell school to be the town's first library; the group cleaned out the room, redid the floor, put up shelves, and got the initial collection of donated books together.

One of the sashes was my merit badge sash. To earn the various ranks in Scouting, you have to fulfill some rank-dependent requirements, but you also have to earn a certain number of merit badges. Some ranks have specific badges you need, while others are based on your own interests.

Here's my list, first the ones required for Eagle:
  • Camping
  • Citizenship in the Community
  • Citizenship in the Country
  • Citizenship in the World
  • Communication
  • Emergency Preparedness
  • First Aid
  • Personal Management
  • Swimming
These were the elective badges that I needed to get to 21 earned for Eagle:
  • Environmental Science
  • Safety
  • Fishing
  • Scholarship
  • Firemanship (now called Fire Safety)
  • Coin Collecting
  • Fingerprinting
  • Computers
  • Basketry
  • Electricity
  • Public Health
  • Public Speaking
I remember getting a lot of the Eagle-required badges while at Camp Sidney Dew the one summer I went to Scout camp. That's where most of the requirements for Basketry, Camping, Swimming, and Safety were done. Fishing was something my dad loved to do, so it was a natural. I also had a coin collection with him, so getting that badge was easy. I think we had a detective come to the troop and lead a fingerprinting workshop and the same thing with a local fireman. The public health badge was probably due to my aunt Kaye who worked as a blood technician, and public speaking was associated with my work on the debate team in high school.

In looking back on this list, I'm actually quite surprised how relevant a lot of this was. I don't really like camping that much, but I apparently did a bit of it then. I recently found a stash of electronics part I had when I was in high school; I didn't do much with them then, but the books I picked up are proving useful now that I'm actually building gadgets and PC boards.

Scouting was a big influence on my life, and even though it has had it's share of issues over the years, I hope one day I'll be able to be active in it again with my own kids.

Heading Back to Palm
pokemon
unwiredben

If you've not seen my Twitter feed, you may not know that on Monday, I'm returning to a position with Palm. I'm heading back to be part of their Developer Relations group, reporting into the dynamic team of Ben and Dion of ajaxian fame that Palm brought in last summer to shake things up with webOS.

It was a hard decision to leave Mozilla; they've been very good to me over the last year, and I feel pretty happy about the 1.0 release of Firefox for Maemo (aka Fennec) that came out in January. I'll miss the fun chats on IRC and the visits to their offices in Toronto and Mountain View.

However, in the last year I found that my real passion lies in communication and teaching. I'd had a blast with my classes at NYC Resistor, and I've loved working with developers in past positions at Metrowerks, PalmSource, and Palm. Being the expert in an online forum suits me very well. With that background, I'm looking forward to evangelizing the webOS platform, and I hope that I'll be able to assist some people in writing great native apps and plugins on the Palm Pre and Pixi phones.

Wish me luck! I'll be posting details on my new Palm webOS developer blog as soon as it is ready to go.
Tags: , ,

Quick note on native Android debugging
pokemon
unwiredben
This is for reference by future programmers using Google to find out something on this topic.

When using gdbserver with the Android 2.0.1 emulator to debug native command line applications, you can get into a situation where it won't stop the child application, instead letting it run to its death before setting up the debug connection to gdb.  I wasn't able to figure out why this was happening, but rebooting the emulator allowed for the correct operation again.  When you start getting communication errors from gdb, a reboot is a good call as other things may be hosed.

Delicious Spicy Spaghetti Squash
pokemon
unwiredben
The first time I had spaghetti squash was as a kid; it was mushy and too sweet and just didn't work for me.

Fortunately, Annelies reintroduced it to my life a couple of years ago, and I attempted my own version last night.  It was really simple and very tasty.  You can make it in about fifteen minutes.
  1. Mince garlic.  Take a few cloves of garlic, chop into little pits, and fry up those bits on medium heat in a skillet in olive oil.  You want little golden crisp pieces, about the same size and crunch as vegan bac'n bits.
  2. Stab the squash.  Take a knife and poke about sixteen slits in the squash.  I did four rows of four.
  3. Microwave the squash on high for four minutes, turn over, go for four minutes again.
  4. open a can of Rotel tomatoes.  You can pick your variety depending on your spice level.  If you don't like spicy, go for diced tomatoes and basil.
  5. Cut the squash in half lengthwise.  Use a fork to scoop out the seeds and throw those away.  Then use the fork to remove the squash flesh.  It will already be stringy, and if you use the fork to scrape out the shell, you'll have plenty of the squash threads.
  6. Put a portion of squash in a bowl, apply black pepper, salt, Rotel, and some of the garlic bits.  Put this back in the microwave for a minute to heat up the sauce.
  7. Enjoy!  You can add some grated cheese too to make it more savory.
I also tried this with some homemade pesto, but I found that creaminess didn't go as well with the slightly sweet squash as the tomato mixture.

Note: using the microwave is key.  It allows the squash to cook nicely inside the shell without getting mushy and gives it a great texture.  I think the time I had it before where I didn't like it was because the squash was cut open and cooked on a stove like noodles.
Tags: ,

More Chumby Exploration
pokemon
unwiredben
So, the Chumby One has been my main hacking activity for the last few weeks. Here are some of the things I've done:
  1. made a viewer for items stored in a drop.io "drop" with my fellow NYC Resistor hacker Eric Skiff. This ended up winning the drop.io hackathon.  This is now documented at http://code.google.com/p/chumby-dropio/.
  2. made a SMS powered doorbell for NYC Resistor. This is a mashup of TextMarks (used to receive a text message with the payload "NYCRDOOR R", Google App Engine (running a couple of Python scripts that implement a simple counter), and a Perl script running on the Chumby (this pings the App Engine scripts looking for a counter change). When it sees the counter change, it plays a doorbell sound quite loudly.
  3. got a audio monitoring script running on the Chumby's web server. You can access this URL from VLC or some other streaming client and listen to what ever is happening near the device.  Details at http://forum.chumby.com/viewtopic.php?pid=26321#p26321.
  4. made a Chumby widget to show the password-protected webcam inside the NYC Resistor space. This required making a proxy on Google App Engine as there's no way in Flash Lite to specify the Authorization header needed to pull down the picture through the normal loadMovie call.
  5. make some simple one frame Chumby widgets using the free SWF Tools. I used this to make a NYC Resistor logo widget that's played from time to time on the device in the space.
  6. mount my music volume over NFS so I can SSH into the Chumby and play music files from the command line. Details at http://forum.chumby.com/viewtopic.php?pid=26346#p26346.
  7. built my own copies of busybox and elinks that give me updated command line utilities and a text-mode web browser on the device. Those are available online at http://drop.io/chumby_utils.
What's next? Get a better text editor than the busybox version of vi onto the device. Make a on-screen clock based on photographs of the MakerBot Watch. Finish getting DOSBox running on the device. Make a Twitter feed reader that lets you put QR Codes on the screen for the links in the messages so you can read the linked page on your smartphone.

Upcoming Chumby Class
pokemon
unwiredben
I've been playing a lot with the Chumby One I got in December... I like it much more than the original Chumby, and it sits nicely on my desk playing widgets under my monitor. It also played a huge role in helping me and my friend Eric Skiff win first place in the drop.io hackathon -- our project was a widget to show photos and voicemails from a user's "drop".

So, I'm taking all this knowledge and giving it back in the form of a class at NYC Resistor in February. It's called "Hacking the Chumby Device", and it's two hours of hands-on Linux and Flash hacking goodness. If you want, you can sign up at http://hackingthechumby.eventbrite.com and if you use code "BENCHUMBY", you'll get $5 off.