The baffling situation involving Express 3.0 + Hogan

September 13th, 2012

It seems like almost no one really understands how to get Express 3.0 partials working with Hogan, a new remarkably fast template system developed by Twitter.

Here’s the secret sauce:

And an example of how to use it:

Problems with MySQL data-dir on Ubuntu 10.04?

March 13th, 2012

If you are having trouble modifying your MySQL configuration under Ubuntu (primarily, MySQL hangs/doesn’t start), the problem is apparmor. Do “service apparmor stop” and then “chmod -x /etc/init.d/apparmor”; restart MySQL and it should work.

The problem is that AppArmor tries to limit the folders that MySQL can access, and therefore when you change the data-dir in mysql.conf, mysqld_safe cannot properly start.

Strange dream: Indonesian food

November 8th, 2011

Ever since my last girlfriend and I broke up around a month ago I seem to be prone to strange dreams. I guess my subconscious mind is doing backflips of some sort and I won’t allow myself to interpret these thoughts while awake. I had been posting the dreams to Twitter but I don’t think that’s the right venue for them - the length restriction on posts makes it impossible to really delve into the little things, the tiny bits of dirt on every detail, that make dreams terrifying and wonderful.

It was Christmas Day and she and I were going shopping for something at the last minute. We went to Hialeah (why?) or was it the north end of Broward? The store we pulled up to closed the gate on my face. Everything else was closed except, in the same strip mall, an Asian restaurant. It said something like “Indonesia, Cuban cuisine” on the sign.

The menu was baffling. It was in English but the words didn’t make sense: “Bipbap ngipesch”, “Krggrgr”, etc. A group of Asian people were ordering fluently and we made some guesses.

When their food came, the ex started eating it. I yelled at her that that was their food. She didn’t care.

Out of frustration I went to the restroom to clear my thoughts. It was filthy. When the toilet flushed, small crabs scurried everywhere from the base of the toilet. The owner came in to try to clean it up.

When I came back our food had arrived. All manner of strange bright colors: some kind of ground up hummus-like item was intense nuclear green. A dry bean-based thing in shades of red, brown, orange. A plate of pistachios in salt as an appetizer. Everything was salty, spicy, gross. No meat or noodles or bread or anything else recognizable. Poor person food for the third world.

While this was going on it began storming outside. Not a heavy storm, just consistently annoying rain running in sheets down the window. I had a weather app on my phone (I never have those in reality) that told me the weather could be described as “Hialeah sunny” (which makes no sense).

This dream disturbed me greatly and I don’t know why. I woke up very upset.

Beautified, unminified version of the FBJS source

October 20th, 2010

Useful for Facebook app hackers: the FBJS code, unminified.

How to request additional permissions during an FBJS Ajax call

October 20th, 2010

Here’s something we learned with FANBLDR, our Facebook Page Maker. If you do an Ajax call in FBML+FBJS, you can use the requireLogin=1 attribute to request permissions. These will then be sent to the
receiving script via POST. However, what if you need extra permissions? Try this:

Facebook.showPermissionDialog('publish_stream', function() {
var ajax = new Ajax();
ajax.requireLogin = 1;
ajax.responseType = Ajax.RAW;
ajax.onerror = function(data) {
permissionDialog = new Dialog().showMessage(’Error posting’, ‘Unknown error. Try again later.’, ‘OK’);
ajax.ondone = function(data) {
if (data == ‘ok’) {
// hide the form and tell ‘em thanks
} else {
permissionDialog = new Dialog().showMessage(’Error posting’, data, ‘OK’);
return false;
};, q);
return false;
return false;

Let us know if it works out, and check out our new blog too: FANblog.

How a Facebook app can change its own tab name

August 28th, 2010

The mysterious admin.setAppProperties holds all the secrets.

How to determine who installed your Facebook app in a tab

August 27th, 2010

As any Facebook developer knows, Facebook has some restrictive ideas about permissions and what apps should be allowed to do on your behalf or even know about you. One consequence of this is that Facebook avoids giving you any information about the user who is interacting with your app in a tab. The session data you are given will contain the page’s id (known as profile_id in the decoded signed_request value) but not the user’s id. The user’s id is available when people interact with your app outside of a page tab, but that doesn’t help when it’s in a tab.

Aside: New developers, always remember that Facebook gives you more or less access to the platform depending on how the app is being used. If your code doesn’t seem to work when running in a tab, try running it directly through the canvas at[app-name]/. If it works there, you probably have some permissions weirdness going on.

So, how do you determine the user id of the person who installed your Facebook app as a tab on their fan page?

There are three ways to do this that I’m aware of. If I missed anything, let me know.

  1. Some confusing combination of access permissions, session keys, and and page.isAdmin. I have no idea how to get this working reliably from a tab without requesting extended permissions. If anyone does, please give me a specific example.
  2. Maintain a table of installed app state, called something like app_installs. In there, track page ids that have installed the app, saving all the information you can find about them. Create a setup or edit page, and put that in the Edit URL field of your Application Settings. When your app is loaded, check that app_installs table to see if a record already exists for the page id (profile_id in signed_request). If it doesn’t, instruct the user to click the Edit Page link, then find your app and click Edit. Your app will run in canvas, as the user who admins the page, with both the profile_id and user_id variables available to you! Store this information, update the app_installs table, and you’re good to go! This might also be a good place to do some queries against the page and user FQL tables and store the information in your local table.
  3. Basically the same as above, but use an <fb:visible-to-owner>>a href="[encoded_secure_edit_url]">Click here to finish setting up the app</a></fb:visible-to-owner> construct to build a secure edit URL (perhaps based on a session key or md5'd profile_id/APP_SECRET combination). Facebook will only show this link to the page admins, and then you will be able to get the rest of the user information after the click.

Hope this helps some struggling Facebook App developers!

The evils of fb:tabs

August 25th, 2010

The <fb:tabs> and <fb:tab-item> FBML tags are very handy to use in your Facebook apps if you want to maintain the Facebook appearance. Unfortunately, they also have weird target behavior that causes the user to leave your application’s frame - if it’s an FBML canvas tab app, and you want to keep your app inside the tab for layout reasons, this is bad news.

To fix it, consider emulating the appearance of Facebook’s <fb:tabs> using CSS.. read on for our solution.

Read the rest of this entry »

Incoming: Facebook App Developer tips

August 25th, 2010

I’m doing a lot of Facebook App development lately, and I’m finding the internet to be sorely lacking in good resources for a lot of this stuff. So on this blog in the coming weeks I’m going to feature a few tips for the greater good of the web.

The dog that funk built

March 20th, 2008

Editor’s note: This is actually a very old post, from around May of 2005 if I recall. I’m making it live now because it was too painful to make live before, but the attic needs to be swept out from time to time.

I’m writing this even though Coco St. Coco doesn’t read my site that often. I don’t think he’s really feeling the whole blogging craze. I’m hoping that maybe they have internet cafes in doggy heaven and they don’t filter the websites of atheists.

I don’t know if this is an obituary. You’ve been gone for almost a week. You could come back but a part of me lost hope. I stopped leaving the back door open in case you found your way home. It’s locked now. All the flyers we put up — hundreds of them — have fallen down cuz of these torrential rains. Did the rains keep you in the bushes, under cars, causing us to not spot you as we wandered the blocks of this new neighborhood endlessly, such a poor way to familiarize myself with it.

You were the only A+ on the list of things I own. For two years, you were my best friend. You understood me more than anyone, which is to say you didn’t understand me at all, which is still more than anyone. The stairs in this big new house — the one that freaked you out so bad you had to run away — aren’t the same without the sounds of your little claws clittering up ahead of me, ten times faster though you’re ten times smaller.

My favorite memory of you is from early on. We went to Green Streets in The Grove and you ate so much bread and veal (so cruel) and so much other shit. You ate more than your own weight. When we got up to leave, you ran into the restaurant and to the horror of everyone around took a big shit right inside the door. An act of pure uncaring defiance. Those are the moments I remember most.

I don’t know if you’re dead or if you’re bringing the same joy to another family that you brought to mine. In any case, I love you and I will never forget you. I’ll keep some food around in case you decide to come home.