jwz - My first Palm Pre app! [entries|archive|friends|userinfo]
jwz

  www.jwz.org
  userinfo
  archive
  rss

Links
[»| [DNA Lounge] [Blog] [iCal] ]
[»| [DNA Lounge Legal Defense Fund] ]
[»| [WebCollage] [LJ WebCollage] ]

My first Palm Pre app! [Mon, 22-Jun-2009 4:36 PM]
Previous Entry Add to Memories Tell a Friend Next Entry
[Tags|, , , ]
[music |Scraping Foetus Off the Wheel -- Descent into the Inferno]

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!

linkReply

Comments:
[User Picture]From: [info]teferi
Tue, 23-Jun-2009 12:44 AM (UTC)

(Link)

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...
[User Picture]From: [info]jwz
Tue, 23-Jun-2009 4:04 PM (UTC)

NPAPI

(Link)

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?
[User Picture]From: [info]teferi
Tue, 23-Jun-2009 5:51 PM (UTC)

Re: NPAPI

(Link)

Christ. I fucked that up but good.

http://predev.wikidot.com/application-framework suggests that you reference the plugin via an <object> tag with (one of) the plugin's content-type(s) (either statically or inserted via DOM prodding. The /etc/palm/browser.conf quoted at http://predev.wikidot.com/tidbits suggests that the plugin directory is /usr/lib/BrowserPlugins .

I don't have a Pre, but I'm very interested in getting one once they come out with a GSM version. How do you like the SDK so far?
[User Picture]From: [info]polpo
Tue, 23-Jun-2009 6:38 PM (UTC)

(Link)

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.
[User Picture]From: [info]poly_scott
Tue, 23-Jun-2009 1:25 AM (UTC)

(Link)

FAIL

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.
[User Picture]From: [info]evan
Tue, 23-Jun-2009 1:45 AM (UTC)

(Link)

Select was to put Contra into two-player mode. It wasn't part of the code.
[User Picture]From: [info]gthing
Tue, 23-Jun-2009 9:28 PM (UTC)

(Link)

Well in that case neither was "start" since it was to actually start the game.

My thought was that palm did it this way to imply that they didn't have any friends.
[User Picture]From: [info]lafinjack
Tue, 23-Jun-2009 2:33 AM (UTC)

Not to mention that "fail" is inherently fail.

(Link)

Fail-fail.
From: [info]gryazi
Tue, 23-Jun-2009 1:50 AM (UTC)

Like a sharp stick in the eye...

(Link)

http://cluecc.sourceforge.net/ 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:
http://jsmsxdemo.googlepages.com/jsmsx.html
[User Picture]From: [info]tkil
Tue, 23-Jun-2009 3:01 AM (UTC)

Re: Like a sharp stick in the eye...

(Link)

...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.
[User Picture]From: [info]krick
Tue, 23-Jun-2009 2:25 AM (UTC)

(Link)

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.
[User Picture]From: [info]yazmeya
Tue, 23-Jun-2009 5:56 AM (UTC)

(Link)

why, restaurant service workers around the world have been delighting in this fact for ages!
[User Picture]From: [info]gregv
Tue, 23-Jun-2009 4:09 AM (UTC)

(Link)

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.
[User Picture]From: [info]jwz
Tue, 23-Jun-2009 4:14 AM (UTC)

(Link)

Ah, apparently you also have to sign it before that trick works!
[User Picture]From: [info]kyhwana
Tue, 23-Jun-2009 6:17 AM (UTC)

(Link)

Useful for americans, I suppose :)
[Error: Irreparable invalid markup ('<insert [...] tipping,>') in entry. Owner must fix manually. Raw contents below.]

Useful for americans, I suppose :)
<insert rant about tipping, here>
From: [info]xei4e
Tue, 23-Jun-2009 5:46 PM (UTC)

(Link)

I think Canada has this mandatory tip thing too. Weird countries.
[User Picture]From: [info]barbedwirekiss
Tue, 23-Jun-2009 6:49 AM (UTC)

(Link)

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.
[User Picture]From: [info]jwz
Tue, 23-Jun-2009 4:05 PM (UTC)

(Link)

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.
[User Picture]From: [info]felis_concolor
Tue, 23-Jun-2009 4:19 PM (UTC)

(Link)

You made it onto engadget. Or rather, your image did... sans-credit.
[User Picture]From: [info]caroline_blind
Tue, 23-Jun-2009 8:34 PM (UTC)

(Link)

Mole wants to know if you can write him up a "Cylon Detector" Ap for the Pre. PWEEZ?
[User Picture]From: [info]dzm6
Tue, 23-Jun-2009 10:15 PM (UTC)

(Link)

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 ...
[User Picture]From: [info]billymeltdown
Tue, 23-Jun-2009 9:01 PM (UTC)

(Link)

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!
[User Picture]From: [info]tecknicaltom
Wed, 24-Jun-2009 2:49 AM (UTC)

suggestion

(Link)

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.
[User Picture]From: [info]mhat
Wed, 24-Jun-2009 6:50 AM (UTC)

re: pennies

(Link)


People get butt-hurt over the stupidest things.
[User Picture]From: [info]cdavies
Wed, 24-Jun-2009 8:33 AM (UTC)

(Link)

You know, I'm not sure people who actually use tip calculators have thee right to call anyone else a cheapskate weirdo.
[User Picture]From: [info]jwz
Wed, 24-Jun-2009 1:56 PM (UTC)

(Link)

I'm not cheap, I'm just bad at arithmetic!
[User Picture]From: [info]vordark
Wed, 24-Jun-2009 1:12 PM (UTC)

(Link)

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. ;)
[User Picture]From: [info]alexeilebedev
Mon, 27-Jul-2009 4:15 AM (UTC)

(Link)

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!