iPhone FrozenBubble

Posted 5 months ago at 8:27 pm. 0 comments

My port of FrozenBubble to the iPhone has finally been approved, after about two weeks of waiting.  There were some interesting coding hoops to jump through, as this was a port of a javascript version which already worked in mobile Safari (thanks Glenn Hanson!), and I was converting it to run completely local/embedded in an AppStore application.

Had to hack the javascripts a bit to load everything from the same directory, as the bundle in iPhone apps seems to be flat.  Or it’s flat if you don’t unflatten it, or something.  No biggie.

Mobile Safari likes to have “bouncing” when you scroll past the end of a web page, even a short one, so gotta turn that off.  And gotta turn off the action menu if you hold your finger down.  And a few hacks to get sounds working.  Most of it came from http://www.codingventures.com/?p=31 - thanks fellow iPhone hacker!

Lots of little tweaks to make it feel like a native app, like using the accelerometer for tilt-based aiming.  The animation isn’t the best, due to poor little iPhone’s javascript engine breathing hard, but it’s pretty darn good for what it is.  And fun!

Firefly eBook Now Available on the iPhone!

Posted 5 months, 1 week ago at 8:50 pm. 0 comments

I’ve read a lot of books by Steven Brust, mostly his Vlad Taltos series.  I stumbled across his website at some point when I was in the midst of serious Firefly withdrawal, after having just finished watching all the TV episodes and then Serenity for a capper.  I had been searching for more Firefly stories to gobble up, and had found the graphic novels on Amazon (which seem to rock so far!) and found out that Steven Brust had written a novel in the Firefly universe.

I contacted Steven to see about making a free iPhone app version of his book, and he said to go for it.  I started by looking around for any open source ebook readers I could use as a base.  The best one seemed to be iphonetextreader, but like all the others I could find, it was made back before the SDK was available and used a bunch of unsupported API calls.  I downloaded it and tried to strip out all the unofficial calls, but it wasn’t looking good.

Time to start over.  What was I trying to do?  Get the book onto the iPhone.  Stanza is a free ebook reader on the iPhone, but their catalogs of ebooks aren’t open for adding new items.  Yes, you can find a somewhat hidden place to download from a URL, but typing in a URL by hand, and from memory (no copy & paste on the iPhone), um, blows.

But hey!  Stanza, having been made by some smart folks, has a protocol handler for doing direct downloads!  All you need to do is make a stanza:// link to a “.epub” version of the book and it will fire up Stanza (assuming you click the link on your iPhone) and install it!  Sweet!  It took a few tries to get a reasonable looking epub version (I didn’t much like calibre, Stanza Desktop did alright for conversion) and that was it.

So that’s the punchline, click here if you are on an iPhone and have Stanza installed, and enjoy some Firefly goodness.  Steven will have it up on his website soon, too.

iPhone Invalid Binary Error – Fixed?

Posted 5 months, 2 weeks ago at 1:45 pm. 2 comments

The dreaded binary error has bitten me…

“The binary you uploaded was invalid. The signature was invalid, or it was not signed with an Apple submission certificate.”

Okay, in one case, it was actually valid, as I had been using an icon file that wasn’t named Icon.png and wasn’t 57×57.  Thanks to Sean for helping me with that.

But today, it was totally bogus.  I made a trivial change for a resubmit of my PrivateWeb app, and the binary was rejected.  Clean the project & rebuild, still hosed.  Restart XCode, still hosed.  Go to the finder and remove every folder from my project’s build directory and then build again – and it WORKED???  WTF?!

Ahem.  I’m glad it worked, but seriously…  There’s something buggy in XCode land.

iPhone AppStore Open For Apps That Vibrate

Posted 6 months ago at 8:49 pm. 0 comments

After Apple started letting in fart apps recently, it was only a matter of time…   Flatulence was criteria 5 on the Unofficial App Store Rejection Criteria list.  With farting given the all-clear, I figured more of those criteria would start to open up.  And apparently vibration is now acceptable!

30 Second Massage is now in the AppStore.  It’s not searchable yet, but the direct link to it works.  Game on!

Oracle with Java – update your JDBC driver now!

Posted 6 months, 4 weeks ago at 6:38 pm. 0 comments

Some quick testing with JMeter showed me that under some serious load on my webapp (100 Tomcat threads, 300 queries a second, some with multi-table joins), the Oracle 11 JDBC driver performs much better than the Oracle 9 JDBC driver, even against a 9i database.  This isn’t a set of benchmarking results, which I know Oracle doesn’t like anyone to talk about, it’s just comparing old vs new Oracle drivers.

The takeaway, go get an updated JDBC driver, now!  Even if you’re running against Oracle 9i or 10g for the database, the new driver will give you a performance boost.  For free!

TowerSmash for the iPhone

Posted 8 months, 2 weeks ago at 8:57 pm. 0 comments

For a hobby project, my brother Alex and I wrote a game for little kids called TowerSmash.  I wanted to write a game, well really more of a toy, that was truly meant for little kids.  So  many “kid games” on the iPhone seem to have little buttons all over the place and levels that load and things you can and can’t touch and scores and bleeps and then boom the game is over.  Um, did we have fun yet?

I wanted something that was open-ended, and that kids could just play with.  What sprang to mind was how all kids seem to endlessly ask grownups to build towers out of wooden blocks so that they can smash them down using cars or their hands or whatnot.  So that’s what we built.  A toy where it’s easy to create towers of blocks and watch them tumble if they’re not balanced, and then easy to throw shiny balls at the blocks to knock them off the table and off the screen.

Get it from the AppStore – $1.99

Wide Finder 2 in Java

Posted 1 year ago at 10:05 pm. 0 comments

I wanted to give WF2 a decent shot in Java, to see how it compares to the funky OCaml / Scala / Ruby versions that other people were making. It runs pretty well, about 15 minutes, and isn’t that complex. Okay, I did make it a single class file just to be simpler, but OO purists won’t like it :-) It’s a hack, a test, just to see how well it will run.

Notes from my big run with it…

nohup time ~bratton/jdk1.6.0_06/bin/java -d64 -XX:+UseConcMarkSweepGC -Xmx13000m -Xms13000m -cp . egb.MTNIOStats 40 128 /wf1/data/logs/O.all > nohup.30T.128k.out &

real 15:33.9
user 6:02:50.9
sys 8:36.0

Let’s see…

UseConcMarkSweepGC is a good thing. UseParallelGC sounds like it would be good with lots of cores, but it kept killing the VM about 70% through.

I went with a gigantomous heap, just because :-) I don’t really need it all, but as the queues get bigger, it’s nice to have. It probably would run fine with much, much less.

Java6 does much better than Java5. I’m using a locally-installed version since the /usr version wasn’t working. You need to unpack the 32bit sparc9 binaries first, then unpack the 64bit binaries on top of that. Have to use -d64 to get a heap bigger than 3G.

The -server JIT flag didn’t make any difference in processing time for me.

Interestingly, NIO block read size didn’t matter that much from 32k up to 4M, and neither did the number of threads, whether 25, 30, 35, 40, 50, 60, or even 90. Wacky! Not too much overhead in terms of context switching…

My app design has a single thread doing all the IO, simple reads, and then it hands the ByteBuffers to a separate blocking queue for each worker thread, to avoid any lock overhead. I think that’s probably irrelevant now, and that locking would be nanoseconds, so maybe I’ll redesign it, but it works fine.

My biggest problem is that my worker threads are for the most part waiting on IO to get more data to process. And the reduce phase at the end is not very long, 64 seconds, and it’s actually single threaded for now because shrinking 64 seconds to 64/5 seconds isn’t going to drop me from 15 minutes to 7 minutes :-P

And okay, my results are off by .01% or something, but I haven’t re-run since I updated my parser to handle spaces in URLs. Close enough for me, not close enough for some other WF2ers. :-) It all depends on your business domain what your accuracy needs to be.

MTNIOStats.java – file name capitalization may be munged – thanks WordPress! :-(

Apache Derby Data Corruption

Posted 1 year, 7 months ago at 8:44 pm. 0 comments

It saddens me to say, but after a year of fiddling with Apache Derby, working around its quirks, making a custom statement cache so that it’s not so frickin’ slow, that it’s finally time to call it quits and move on to something else.

Data corruption… Over the past year, I have been using Derby as an embedded database inside of Fubario. I’ve been running it on Windows2000, WindowsXP, and OSX 10.4. On all of these OSes, some are laptops, some are desktop machines on all the time, I’ve had varied data corruption scenarios occur, even under relatively little load.

I will admit, I haven’t done a good job keeping records of each kind of data corruption, probably because of foolish optimism that when a big point release of Derby came out it would have solved the problems with the prior version. But alas, every release has had various things go wrong. I’ve had entire databases corrupt so that Derby would refuse to startup, or even an interesting “poison table” corruption where everything was fine until I issue a query against a particular table that was corrupt, at which point Derby went out to lunch.

And when I say little load, I mean pretty much the databases were idling 24×7, with maybe a few thousand rows in them. And to think that I switched to Derby specifically to get more reliability than I had been having with hsqldb or its shiny new cousin h2

So where am I now? I’ve built a custom flat-file store for Fubario for storing encrypted backup files. It’s pretty simple, really, with a few key characteristics of secret sauce that make it perfect for Fubario and it’s really tiny in terms of amount of code, because it doesn’t have to do very much at all. I’m also using h2 again for storing maybe tens of properties or something like that, miniscule really, probably could use properties in a flat file, but I’m just reusing the sql-driven classes that had been talking to Derby.

I’m done with the 20 second startup and shutdown times.

I’m done with these random and varied and all peculiar data corruption scenarios.

I’m done with foolish optimism? Maybe.

Fubario Badges

Posted 1 year, 8 months ago at 8:34 pm. 0 comments

How much you back up isn’t usually an “in your face!” kind of moment, but hey, why not?!

Learn more at fubario.com

Library Search Engines, Web 2.0 and Web 0.1b

Posted 1 year, 9 months ago at 7:19 pm. 2 comments

The electronic catalogs for my nearby public libraries are pretty basic. They are the same boring Horizon Information Portal websites that provide the basics but sifting through the results is clumsy. And searching another library at the same time? Forget it.

Enter WorldCat. Searching a library is, dare I say it, fun again! Everyone can add reviews to library items ala Amazon, it automatically shows you nearby libraries that have the item using guesstimated location based on your IP, and they make money by providing links to Amazon if you’re too lazy to go get the book from a library yourself. Very well done… I’m jealous.

I still wish I could find my library search engine that I made back at UIUC in 1994. It was the capstone project for, of all things, CS411 Database Systems. The professor was dating/engaged/married to Eric Bina who was the co-creator of Mosaic with Marc Andreessen. And so apparently she liked the idea of making her databases class build a web application. I was fine with it, really, because Mosaic was pretty cool, although I found myself always keeping 2 windows open and dragging links from one to the other so I wouldn’t lose my place while I wandered about. Kind of a kludgy coping mechanism before the era of tabbed browsing.

I came up with the idea for my team of 3 to build a web interface to the UIUC library system, which was a mainframe beast, maybe 3270 but I’m not sure. Luckily one of the guys on my team had build the TCPSETUP program for Doom, so he was good at making socket programs and so he built a library for talking to the mainframe. I built out the perl-based webapp which took care of sessions, form-processing, calling the library to talk to the mainframe, rendering the search results, etc. The other guy, um, didn’t do anything.

Even though I didn’t have a name for it (usability) I worked hard to make the webapp easy, even fun, to use. You typed in a search by author or title and would get back a list of results all nicely lined up with information about each match. Click on a book to see more details, and best of all, get a form where you could put in your school ID and the library would send the book to your dorm room! For real!

Every team presented their final projects during the last week of class. Other teams had built basically useless apps, all were clunky, didn’t make sense, whatever. We presented ours to applause, actually, but apparently our professor was not impressed. “It looks too easy”, she said. That was the goddamn point! The back-end work to screenscrape multiple greenscreens for every page view was nutso stuff, and yes, the front end looked smooth & clean. She gave us a B. And that was when I knew that all those people who had told me that “grad school was when you start doing real work, no more theory crap like undergrad classes” were out of their minds. I had worked my ass off to build something real, and got a frakkin’ B for my troubles.

Postscript – a few weeks after this class ended, the webmaster for UIUC heard about my library webapp and asked if she could install it on the library website. It became the official library web search engine running at UIUC for the next several years. Yeah, that sounds like B-level work to me… Adios, grad school!