My first Palm Pre app!

I wrote a restaurant tip calculator, since there wasn't one.

It was relatively painless, though the documentation is pretty spotty.

Since Palm isn't yet letting people upload things to the App Catalog, here's how you install this:

  1. Email yourself a link to the .ipk file. Don't mail the file itself as an attachment: just send yourself an email with the URL in it. You can do that by clicking here.
  2. Open that mail message on your Pre, and click the link.

  3. That will appear to have done nothing, but it did! Go to the first page of the Launcher, and you'll see that the new application has been installed.

Dear Lazyweb, I have several questions.

  1. How do I get it into the Palm App Catalog?
  2. How do I give a button a different background color, while still having it look like a standard Pre button?

  3. Native code, man. I need it. How do I do it? I seriously doubt I can do a port of Dali Clock using only Javascript and the <canvas> tag.

Update: Oh, the email I've been getting. Look, it only does whole numbers because if you insist that your tip be accurate to the penny you are a cheapskate weirdo. Here in the Colonies, we use paper money, not coins. If your bill is $44.22, just enter $45. Don't go all Scrooge McAsperger's on us, ok?

Update 2: Holy shit! The intardwebs have a new cesspool, I see!

Tags: , , , , ,

28 Responses:

  1. teferi says:

    From reading the unofficial Pre dev wiki, it seems that the way they got the PalmOS emulator to use native code was via a NPAPI plugin. I sure as hell hope they provide a better API for third-party apps...

    • jwz says:

      Well, that's basically how it works with Mac Dashboard apps, too. That's how I did the dashboard Dali Clock (though it's not NPAPI, the plugins are all swaddled in XML instead). Has anyone published how you actually do that on the Pre, though? Like, where does the .so go and how do you reference it?

    • polpo says:

      The NPAPI stuff is wrapped in a C++ class called AdapterBase which also has some virtual functions for input event handling such as keypresses, touchscreen taps, moves, etc. Run nm | c++filt on any of the .so files in /usr/lib/BrowserPlugins to see what I'm talking about. Then you have to worry about how to draw, which I think nobody has figured out yet.

  2. poly_scott says:


    The Konami Code should have select, and then start! At least, it did on my NES.

    Plus, watch this, it's about that code, it's funny, and it's my friends band.

  3. gryazi says: is probably one of many projects that can target the javascript machine.

    This is not what you're looking for, but I guess I should be the ghost of Christmas future here: They're clearly trying to do something arch-independent, so investing a lot of effort to game it might be 'fun' but counterproductive. Particularly if they do survive long enough to license it out to other manufacturers on other hardware.

    On the other hand, <canvas> will be the bottleneck but even the WTF of C compiled to js may be Good Enough these days. So learning how to put up with this strange new world will be an adventure in its own right.

    As a further example, there are some true nutjobs out there:

    • tkil says:

      ...even the WTF of C compiled to js may be Good Enough...

      I read that as "Win-To-Fail [ratio]", instead of as the more common meaning.

      Probably means I've been on the net a wee bit too long.

  4. krick says:

    I see that you correctly calculate the tip on the pre-tax amount. Well done. A lot of people screw that up and use the post-tax total.

  5. gregv says:

    Right now the way to install apps outside of the App Catalog is to e-mail yourself a link to the .ipk. Kinda kludgy, but I'm assuming there will be a supported way at some point. I vaguely recall them saying everything wouldn't be required to go through the App Catalog.

  6. kyhwana says:

    Useful for americans, I suppose :)

  7. So you email yourself a link, which you click on.

    Nothing appears to happen (big big problem there!)

    Then you find the app has installed itself????

    That sounds like one MAJOR security hole to me.

    The way people will just randomly click on links without checking their destination, this worries me. What if it had been a self-replicating exploit, a virus or somesuch that goes through your inbox and just mails itself on with a "Hey buddy. I found this great website. Click here".

    With NO indication that it has done anything, or even a request for confirmation "Do you want to install this app?" this is a pretty big security hole I think.

    • jwz says:

      Yeah, it's pretty hokey. I assume it's a bug that this works at all, and they'll "fix" that eventually. Let's just hope they add a sane way of distributing apps before then.

  8. You made it onto engadget. Or rather, your image did... sans-credit.

  9. Mole wants to know if you can write him up a "Cylon Detector" Ap for the Pre. PWEEZ?

    • dzm6 says:

      Last I checked the dude works as a radiologist. Surely he already has access to some form of Cylon detector gizmo?

      Yeah, OK, probably not very portable, but ...

  10. Nice stuff, dude ;-)

    I don't have the answers to your queries, but I'd love to see them posted over at Stack Overflow, I imagine things will turn up for you!

  11. tecknicaltom says:

    no, I'm not gonna suggest a decimal point. And I don't have a palm so this makes no difference to me and I haven't seen how the app works. But the thing I've always wanted out of the tip calculator on my cell phone was for a screen after I've entered in the subtotal where it would show me the tips and totals for different percentages. For instance, I can see that 15% is w and 18% is x and 20% is y and 23% is z, and then make a judgment call based on how good the service was.
    And the post almost made me start working on a dali clock port in pure js. almost.

  12. mhat says:

    People get butt-hurt over the stupidest things.

  13. cdavies says:

    You know, I'm not sure people who actually use tip calculators have thee right to call anyone else a cheapskate weirdo.

  14. vordark says:

    Wow. I was thinking about dicking around with the SDK once it's really out, but looking at that thread in "Update 2" kind of makes me want to never deal with those people at all.

    P.S. You have the best fans. ;)

  15. I always wondered this about tip calculators: why do they have so many fields and options, such as the tax field? Isn't the whole premise of these apps that you're so drunk by the end of the meal/evening at the bar that you need help figuring out a tip and can't be trusted to take the pre-tax amount times two? All that precision, and the final result is still 1.5% off (because it divided 74 by 3 and got 25).

    Here is my unsolicited opinion: why not allow only one field to be entered, the amount on the check. Then, automatically display several tip amounts and corresponding totals. That's what computers are for!