Archive for January, 2008

Republicans Ban Left Turns

Thursday, January 31st, 2008

noleftturn.jpgWASHINGTON - A nationwide left turn ban was drafted by an overwhelming majority of 51 to 49 in the Republican controlled senate this evening. It is now at the President’s desk where he is expected to sign it into law.

Like the nationwide law mandating that all French fries be renamed Freedom fries, and the steroids in baseball investigation that took place during President Bush’s terms in office, “this new law was enacted to keep Americans on the right path”, said President Stephen Baldwin. President Baldwin, brother of noted actor Alec Baldwin, rose to power after co-starring in Celebrity Apprentice and successfully running The Breaktrough Ministry and other projects aimed at evangelizing young people using skateboarding, extreme sports, Christian rock concerts, laser light shows, and other activities.

“Left turns invariable take the country, and your car, in the wrong direction,” said minister of Transportation Dan Rodriguez. “This law will save us billions of dollars; it saves UPS millions so why shouldn’t we try the same thing?” he added.

California, with its high number of motorists, is likely to be severely affected by the law. Vice president Schwarzenegger, former governor of that state, dismissed the problem saying: “Left turns are for the wimps. Besides, I’d take a hot latina over a left turn any time”.

Religious groups welcomed the law. A spoke-person for Focus on the Family said: “Now we will have moral certitude about our commute. No more flip-flopping on which way to go: It’s three right turns and you’re in the right direction.” He stated the law would benefit more than just drivers, saying that this law will help stem the “the penetration of homosexuality into the brains of our nation’s youth.” Adding, “now our nation’s kids know that there is only one way, the Right way.”

John Do-over, frequent contributor to Reason Magazine, a libertarian publication, opposed the ban and decried the current endorsement by the federal government about which way one is allowed to turn their car. “In nature, there are no left or right turns,” he said. When asked how libertarians would deal with turns at traffic intersections he said the solution would be a set of symbols denoting which way man, in His natural state, would turn. To maintain impartiality and a level playing field, the system “would be enhanced with automated, cold fusion-powered mechanisms deployed on heavily traffic intersection that allowed some people to turn safe across on-coming traffic.” He said this was not at all like the current left turn signal because, in his proposal, libertarians had come up with it and not you.

SQLite in AIR - Slow writes

Tuesday, January 29th, 2008

143467379_edcdc8a5d5.jpg

Just a quick note on SQLite in AIR and slow writes: using transactions will speed up multiple inserts/updates.

haven’t had a chance to do any performance tuning or testing when using SQLite in AIR.  But just today I finished writing some tests for writing some stuff into a SQL db and noticed that the writes were slow.  I created a little benchmark test project that wrote 55 records total over two tables with a  total of 4 columns of NUMERIC type for each table … nothing fancy.   This is obviously not a thorough analysis and just something quick and dirty, but just writing those 55 records took almost 30 seconds on average.  That’s way too slow.  Specially since I am not using any of the async methods, such a slow write speed will lock up your Flex interface.

Once I wrapped the saves in one transaction the speed went down to an average .4 seconds because the data is committed in one big chunk when you call commit.

There may be other ways to increase the speed. I’ll have to investigate this later. .4 seconds will probably still be too noticeable a hiccup on the interface so I’ll be changing my data store to use async methods.

Just thought I’d put it out there.

Also, if you have an table with an INTEGER PRIMARY KEY AUTOINCREMENT and you keep getting an error that says “Unable to convert Text value to Numeric value” or something to that effect make sure you’ve upgraded to the engineering drop of FB3 from January 14th, 2008.  Apparently that’s a bug in the version before that, but I didn’t find it on the Adobe bug db.

Testing SWFs for Search Engine Visibility: Using Adobe’s Search SDK

Monday, January 21st, 2008

With the recent news about Google possibly using Adobe’s Search SDK to index text in swfs I thought I’d post a quick howto for downloading the sdk and testing out your swfs to see what they look like to the link extractor.

First, download the SDK:

http://www.adobe.com/licensing/developer/

Scroll down to where it says “SEARCH ENGINE SDK”

Click on “Begin the licensing process for the Search Engine SDK” (or click here http://www.adobe.com/cfusion/entitlement/index.cfm?e=search_sdk)

Follow the instructions for signing up and wait for an email.  Once you receive an email it will tell you where to download the sdk.   Download the zip file.  If you’re on windows, extract it to your hard drive.

Use your command line to navigate to this location. I put mine on c:\work\search_sdk\

go into the “windows” directory in that folder: c:\work\search_sdk\windows

Type:

swf2html [name of swf you want to index]

you’ll see an a bunch of HTML showing you links and text in the swf.  Read the README.html file in the archive to find out what exactly the SDK indexes.

I haven’t tried this on linux and I don’t know if it compiles on OSX.

InsideRIA: New O’Reilly site about everything RIA

Monday, January 21st, 2008

A new site dedicated to everything RIA by O’Reilly, with posts from people like Rich Tretola of EverythingFlex.com,  Andre Charland from Nitobi, Andre Trice from Cynergy Systems, and many others.

http://www.insideria.com/

There’s already some good leads there like a post about Google possibly using Adobe’s Search SDK to index swfs.

http://weblogs.macromedia.com/jd/archives/2008/01/google_swf_sdk.cfm

Facebook | Answers - A Django App

Friday, January 18th, 2008

Over the holiday break I took 2 days to try my hand at writing a moderately complex, non-annoying, Facebook app. Facebook Answers is the result of this work. It’s a place where you can ask a question and let the community answer. People can vote other people’s up or down, and you can earn points by answering other folks’ questions.

fb_screen_cap.png

Django is a pleasure to work with. I quickly sketched out the app in a couple of hours, then set to work with Django from scratch. I had the entire app coded up in a day. The only snag was figuring out how to deal with Facebook and sessions. There are two ways your apps show up on a Facebook canvas page: either it is included via an iframe or it is accessed by the Facebook servers and then its content is rendered by Facebook. Courses on Facebook is a good example of the former. If you look at the source for that page you see that it includes content from coursesonfacebook.com with an iframe. In the latter method, the user never accesses your server directly unless you served some sort of media. Facebook|Answers uses the 2nd method. This poses a problem with sessions because, typically, a request is associated with a session based on a cookie stored in your browser. Facebook does not forward cookies to your app. Instead, the only session identifier you get is a request parameter. Django only uses cookies for session handling.

So, I had to write up my own session handling code. I was a bit scared to get into the django innards, but, I gave it a go. I had to code a FacebookSession model, a SessionWrapper, and a FacebookSessionMiddleware which overrode process_request. The details are kinda hairy there. There’s probably a better way to do it but I was going to leave town in a few days and I didn’t want to spend any more time trying to figure this out. I also used pyfacebook, a Python Facebook client library. It made it really easy to communicate with Facebook’s API and to get stuff out of requests.

Once I had it working I took another day to tweak the design and get it to really fit the Facebook look and feel. Facebook tag documentation was not too bad, the hard part is getting a hold of some sort of style guide or css guide for the Facebook design. This would have cut a significant amount of time from all the tweaking I had to do to get stuff to look just right. I think Facebook should provide developers a set of global css definitions we can use and a guide that shows what the definitions actually look like. Maybe this guide exists somewhere, but I couldn’t find it.

All in all I think developing for Facebook wasn’t that much different than developing any other web app. Some things are made even easier if you treat Facebook as a database where you can grab a bunch of data very quickly and figure out some interesting relationships. And fbml markup makes it easy to do stuff that would have taken me a couple of hours or even days to get ready on my own. For example, I can specify conditional view code based on if you have the app installed, if you are a friend of the person who wrote the question. All this is handled with simple fbml tags and I don’t have to do any database lookups on my end.

There’s still some work to do with integrating the app into your profile. I’d like it to show the latest question, if you have answers, and if your friends have questions. And I’d like to provide the user with a way to configure this. I’ll get around to that in a week or so.

Hope you enjoy the app. Tell all your friends about it. If you find any problems, let me know.

Here is the bit of code I wrote up to get the sessions working. I actually didn’t code much of it; I just took the existing session middleware code and modified it to use Facebook’s session id. Why did I not extend? I’m not sure. I must have had a good reason =p It probably won’t work right out of the box and it may not be the best way to do it. ymmv.

util.zip

Facebook | Answers

Django - The Web Framework for Perfectionists with Deadlines

pyfacebook - Python Facebook Library

Tasty Treats in Palo Alto: Mediterranean Wraps

Sunday, January 13th, 2008

If you like falafel with a dash of spiciness and a touch of cool cucumber all wrapped up in a crispy, smoky tortilla and you happen to be in the Palo Alto area then drop by Mediterranean Wraps (

425 S California Ave, Palo Alto, CA). Man, that stuff is good! My wife and I used to eat there frequently when we lived in the Bay Area.

If you have a bit of a sweet tooth like I do then buy yourself a halva bar (crispy nutty bar drenched in chocolate) for desert and wash it all down with a nice cold mineral water or, if you’re feeling up to it, a bottle of ginger bear.

I recently got back from a trip to Portland over the holidays. Sarah and I decided to take the 5 up and down because, even though the coast highway is beautiful to travel on, it adds a couple of hours to your trip.

On our way down we stopped at a friend’s new apartment in San Francisco for the night. And we were going to head right back out to the 5, but at the very last minute we decide that a tasty Mediterranean Wrap was worth 20 extra minutes on the road. We hadn’t been back for over 5 years and it’s still as good as it used to be.

It gets really crowded during lunch, so get there early.


View Larger Map

Once you’re out, head over next door to Know Knew Books and find something to read.