# Archive for January, 2013

### On Marmalade and PlayBook development

So… The Marmalade promotion is ending in a few hours. I’m still waiting for my app to get approved through QA, so we’ll see what happens. Cutting it a bit close, but that’s life.

Mainly because my workaround for Marmalade Web not working was to use WebWorks, which… I was only recently told didn’t actually satisfy the T&C of the promotion. So one ‘quick’ app in Marmalade Quick/Lua later, and I hoping to be able to keep the PlayBook.

But OH MY GOD, Marmalade. If you were trying to get me to use your stuff for anything, you have utterly failed at it.

First off, the SDK itself. Er… WTF? I was under the impression that Marmalade Web was part of the SDK. But it doesn’t support the cross-platform nature of the actual SDK, despite BB10 probably having the best HTML5 development toolkit out there? (I know of nothing on Android/iOS that allows you to take a bunch of HTML files, and throw them up as a full app.) Sketchy at best, considering I would have thought there’d be at least some half baked support.

Which leads me to my second point – really crappy code. One example: The publisher in Quick doesn’t sign packages that you request to be published. (leaving aside that yhat hotfix fixes… what, exactly? And how do I download it?)

The inability to sign stuff is really strange, because you’ve got the Test deployment down to a science, requiring author IDs and stuff I had to extract from the debug token bar file. I didn’t have to enter my author ID when publishing stuff from WebWorks. Why can’t you handle this stuff? YOu’ve chained together umpteen dozen other programs, surely you can handle this one.

(For the record, I ended up manually signing the generated unsigned bar file. After correcting the fact that it still set the dev mode flag to ‘true’ in the application manifest.)

My third point is really my second point rehashed – strange error messages:

C:\Marmalade\6.2\s3e\makefile_builder\mkb.py --use-temp-extension --verbose=1 C:\Users\kyl191\Documents\testcards\Testcards Lua.mkb_temp --non-interactive --no-make --no-ide --buildenv=WEB --builddir publish_build --use-prebuilt --deploy-only error: Specified input file not found: c:/Users/kyl191/Documents/testcards/Testcards Lua.mkb_temp FAILED (error code=2)

I got this when trying the recommended workaround of ‘use the full marmalade 6.2 to sign packages’. As you can see, they have very enlightening error messages. Trivia: That mkb filename was autogenerated. I didn’t select it. The actual filename was Testcards Lua.mkb. Copy and pasting the mkb file and appending _temp like it expected ended up with M6.2 just hitting a folder not found error this time.

Another example: The default project file hits a a file not found error when you try to run it in the simulator. I fixed it by commenting out, of all things, a Facebook library for Android. I ticked the QNX box in the deployment screen, Quick. WTF are you including a Facebook library for a completely different platform?! (Yes. They have an actual Facebook library. Thank you very much for giving us all of 3 methods. You get a half-star because you’re in beta, I’d expect more later, but I’m looking forward to leaving you altogether.)

And fourthly, the docs don’t match what’s actually done. Small things I can understand. But stuff like the contents section referencing node.h, only for the main text of the page to have an entry node.height instead? Mhmm. Fun stuff.

And finally, some of the decisions are TDWTF worthy. The main one that I butted heads with? Guess where the (0,0) pixel actually is.

Most programmers would think upper left, since that’s pretty much the standard. Not in Quick. Oh, no. Here, we have the bottom-left corner be (0,0). Why?

I don’t know, and I don’t care. As soon as my app passes QA, their admin people sort out what’s happening with the PlayBook and everything looks good, I’m done.

That uninstall button has never looked so tempting.

### Nginx & php-fpm configuration

Edit: Everything below is pretty much superseded by a new post.

php-fpm: /var/lib/php/session was owned by root:apache, so php-fpm couldn’t create session files. Fix was chgrp nginx /var/lib/php/session. For some reason, after doing  yum update, /var/lib/php/session was changed back to root:apache, but that was only noticed on one system so far, haven’t observed it on others, but also haven’t looked for it.

nginx: By default, index.php files aren’t though of as index files. Fix is to add ‘index.php’ to the ‘index index.html’ line.

Alternatively, autoindex.

### I’m glad I went

I went to an outdoor music festival thing (Igloo Fest) in Montreal today,  on the recommendation of a friend.

I almost didn’t go. But I’m glad I did.

It was kind of amusing.

They had a fire, and people were giving out marshmallows on sticks, so I grabbed one and toasted it. And as I was standing there, with thousands of watts of speakers thumping about 100m away, the wind kicks up and I end up squinting through the snow and wood smoke with tears in my eyes.

And then two girls next to me kiss each other. Not making out, just a short kiss, and they both walk off, presumably to get marshmallows.

It took a moment to register.

But then I started laughing to myself.

Simply because it was so absurdly different from what I’d experienced so far.

I was standing in the middle of a crowd (I don’t usually like crowds), toasting a marshmallow (Admittedly, I’ve done that before), squinting against driving snow (a rare experience for me) and wood smoke (more experience, but still rare), watching two people share a semi-intimate moment with each other. (Erm… TV.)

I do not believe I’d ever see any combination of that anytime soon in Singapore (even without the snow).

I can’t put my finger on why it struck me so much. But it did.

The only thing I could think of was that I’ve been isolated, partly by choice, partly by circumstances; and now I’m opening up to new experiences. And the world is going “Oh hey, you know that place you lived in for 18 years? Yeah, well, the world is a whole lot more messy. And dirty. And different. But it’s a whole lot more interesting. Enjoy.”

Hello world.

(Alternate title was The Real World Incorporated – from a TDWTF forum topic about expectations not matching to the world. But then I remembered a line from a song I heard somewhere.)

### Silly Access-Control-Allow-Origin Workarounds

“Origin null is not allowed by Access-Control-Allow-Origin” was the error I was getting when looking at a local html/JS powered page on my desktop, and I tried to do a getJSON request in jQuery.

It’s a well known problem – but also quite annoying, mainly because the fixes were generally of the form “change your endpoint to have a callback”, or “modify your code so it does X, even though that means you have to change Y and Z too”.

So I looked around, and was about to default back to my old plan of dumping everything into an array when I realised that because my JSON is constant, I can just have it as an excessively long string, and use parseJSON to parse it.

And so I ended up with something like this:

data.js consisted solely of var json="[{...}]";

logic.js called $.parseJSON(json) And my main file had <script type="text/javascript" src="mathcards.js"></script> <script type="text/javascript" src="data.js"></script> But it worked. And with only an extra line (the extra script/data.js line – possibly even a net drop since I got rid of the success function), I’m calling it a success. Then again, it’s 12:30 in the morning after the facebook hackathon (which was pretty awesome, even if MathJax broke during my demo because I forgot to include the$ signs for inline math).

Also, JSONLint is my new favorite utility – not only does it validate your JSON, but it also pretty-print formats the long string into a form that looks a lot nicer to save.

### Compiling & publishing BlackBerry WebWorks apps

As part of the Blackberry Playbook promo, I have to publish an app on the BlackBerry App World store.

Ripple was somewhat easy to get up and running. Except for the fact that it didn’t like the launch on Playbook option – it was checking some variable that wasn’t set, so it ended up trying to push C:\path\to\bar\file\undefinedfile.bar. It really concat-ed the term ‘undefined’ into the file path.

So I had to manually install it using the blackberry deploy tool. BlackBerry has a dedicated page, but in short:

PS C:\Program Files\Research In Motion\BlackBerry WebWorks SDK for TabletOS 2.2.0.5\bbwp\blackberry-tablet-sdk\bin> .\blackberry-deploy -installApp -password password -device ip.address.of.playbook C:\path\to\bar\file

Another interesting/odd thing is that I had to sign the app to get it to install on the Playbook. Simply packaging it wasn’t enough – it rejected it with a “app author doesn’t match debug token author” error. (And the other interesting thing I found out was that it appears to upload your app to the BlackBerry servers to get signed. At least, when my connection dropped out for a bit, I got a “www.rim.com” error.)

### Pushing an existing repo to github

Because I’ve had to do it a number of times, and had to look it up each time:

1. Create the repo on github
2. On the desktop/laptop/whatever, in Git Bash, change to the folder with the repo
3. Run:

git remote add origin [email protected]:username/repo.git, then
git branch --set-upstream master origin/master and finally
git pull

And done.

### New Year’s Resolutions 2013

1. Be more awesome
2. Move fast and break things
3. Take more photos with people

(The 4K monitor resolution just has to wait till I move out of the dorm.)