Thoughts

The Pig Head and Football Ragu

January 2nd, 2010  |  Published in Errata, Food, Thoughts

So a few weeks ago, I went to The Meat Hook to pick up a beef roast for Christmas dinner. Brent helped me pick out a nice 8 lb. roast (which he then layered with fat and tied nicely — something I don’t think I quite fully appreciated until the roast came out of the oven), and then we got down to business. I’ve been following The Meat Hook on Twitter for a while now, and these guys aren’t just dealing with your ordinary bits. They’re cranking out stuff like chorizo-stuffed duck hearts, goose rillettes, lamb belly and bahn mi dogs. That’s right, they took a Vietnamese sandwich and turned it into a sausage. HOT.

Compared to these guys, I’m clearly Mr. Amateur Newbie, so I gave Brent my 10 second charcuterie resume, and asked him to surprise me with whatever he’s got in the meat locker. He came out first with some pig’s skin, rolled it up, wrapped it up and handed it to me. I thought that might be all, but then he went back in the locker and emerged with a pig’s head.

Pig's head from @themeathook Yup, a whole head. They had already taken the cheeks out to make guanciale, but there was still plenty of meat left, so I headed for the checkout with a beef roast in one hand and a pig’s head in the other. It was going to be an interesting weekend.

I’d never cooked a pig’s head before, so I figured I’d play it safe and start with the basics, namely head cheese, which isn’t really cheese at all, more like a meat jelly terrine. I used the recipe in my copy of Fergus Henderson’s The Whole Beast: Nose to Tail Eating. And since it’s not every day that you get a whole pig’s head, I also decided to make the Crispy Pig Ear salad from the book. Both the head cheese and the crispy ears turned out pretty good considering it was my first attempt making them, but what really turned out amazing was the recipe I made with the roll of pig’s skin.

Brent told me how you could slow cook thin ribbons of pig skin in a tomato sauce and after a few hours just before the skin completely falls apart, you end up with the most delicious porky ragu you could ever want. So I gave that a shot, and it turned out awesome. Here’s a pic of the final three dishes, and below is the recipe I hacked together for the ragu.

Pigskin Ragu, crispy pig ears and head cheese.

Pigskin Ragu with handmade pappardelle, alongside Crispy Pig Ears and Head Cheese.

Pigskin Ragu (if the name weirds you out, you can also call it Football Ragu)

Ingredients

  • 1 fennel bulb
  • 2-3 medium sized leeks
  • 1 large can (28 oz.) of whole, peeled tomatoes
  • 1 roll of pigskin (about 1/2 lb.)
  • olive oil
  • salt, pepper and whatever other fresh green italian herbs you have on hand (e.g. parsley, thyme, rosemary)

Directions

Thinly slice the pig’s skin into strips about 1/8″ wide and 1″ long. Saute in a pan with a little olive oil over medium heat for a few minutes just to heat them through and to brown the outside a little. Now open the can of tomatoes and strain off all of the tomato juice into the pan with the pig’s skin. Add a little bit more water if the pigskin isn’t fully covered. Turn the heat down to low and let this simmer for about an hour.

Meanwhile, thinly slice the fennel bulb and leeks. Saute in a stock pot with a little bit of olive oil on medium heat for about 5 minutes until they’ve sweated some. Coarsely chop the canned tomatoes, and then add them to the pot. Turn the heat down to very low and let simmer. You don’t want the pigskin or the tomato mixture to boil, so just keep them low and slow for the next hour.

After an hour of simmering, pour the pigskin/tomato juice mixture into the pot with the leeks, fennel and tomato. Add whatever fresh herbs you want and stir everything together. Continue to simmer for another hour, tasting and seasoning as you like, just be careful that if you simmer the sauce much longer the pig skin will start to completely melt. Personally, I stopped cooking the ragu just before this melting point so that there was still some texture to the finished ragu. But if you don’t like that, just keep simmering and the texture will melt away, but the flavor will remain.

Once the ragu is done, serve with your favorite pasta. In my case, I just threw together some handmade pappardelle using the 3:2 Pasta Dough from the Ratio iPhone App. Delicious.

Happy Birthday Bar Code

October 7th, 2009  |  Published in Errata, Mobile, Thoughts

A lot of people find this blog because of my articles on mobile bar codes, so I thought I would mention Google’s spotlight today celebrating the 57th birthday of the bar code. In case you miss Google.com today, here’s a screenshot.

Pretty sweet.

Ovi Store download stats

July 13th, 2009  |  Published in Thoughts

So my simple Morse Code widget has been in the Ovi Store for almost two months now. It’s free, and I didn’t spend too much time developing it, but the Ovi Store finally got their Reporting system back up and running, so I thought I would share some stats on how the app is doing.

  • As of this writing, the widget has been downloaded 10,582 times.
  • The widget has been download from 130 different countries.
  • The top 10 countries that downloaded the widget are UK, USA, India, Australia, France, Finland, Brazil, Singapore, Netherlands and Turkey.
  • These 10 countries only accounted for 62% of downloads.
  • 65% of the downloads are coming from four devices – E71, N95 8GB, N95 and N96.

How is this comparing to other developers out there?

Using Minify to optimize your Nokia WRT widgets

May 3rd, 2009  |  Published in Development, Mobile, Nokia, S60, Thoughts

Recently, I’ve been playing around with Minify. For those who’ve never heard of it, Minify is a simple HTTP content server built as a PHP5 application. It’s placed in a folder on your server, and then either using a querystring or mod_rewrite, it will dynamically merge and minify CSS and JS files as they are served up to a user’s browser. This allows you to develop using multiple CSS or JS files with comments and clear visual formatting, but when they are delivered to your users via a browser, they get minified and optionally merged making your site load and render faster in the user’s browser.

While Minify is meant to run on a webserver, I thought it could also work as a handy offline tool for optimizing Nokia WRT widgets. Since WRT widgets are just zipped folders of Javascript, HTML and CSS, Minify seems like a simple step you could include in the widget packaging process of your workflow before testing and deploying.

I wasn’t sure how much savings Minify would give the average WRT widget, so as a quick test I batch processed the contents of the STEW sample widget from Forum Nokia using Minify running on a local webserver. The resulting files were bundled as a new widget, and here’s a comparison of the two.

  Size of all Files WGZ size
Forum Nokia version 122.4K 83.0K
Minified version 106.3K 78.2K
Difference 13.2% smaller 5.8% smaller

The savings aren’t gigantic, but they’re significant enough that you should seriously consider adding this step before deploying a widget. I’d also be curious to see if anyone has done comparisons about whether or not Minify affects how much memory is consumed at run-time in the browser.

I might do some more work on automating this process or creating a tool that minifies widgets automatically for you, but ideally, I think this should be something automatically built into widget IDEs like Aptana.

How are other developers out there currently optimizing their widgets for release on Ovi Store?

Legislators’ web pages containing earmarks

April 11th, 2009  |  Published in Development, Politics, Thoughts

Over on Taxpayers for Common Sense, they’ve been doing a good job of keeping up with how well House members are complying with new rules about posting earmarks and appropriations to their websites.

The webpage on taxpayer.net gives some insight into their process, but unfortunately, their Excel spreadsheet only uses legislator’s names. This is fine for most individual projects, but if you want to mashup the data across multiple data sources, then ideally you need a common identifier like a GovTrack ID or a BioGuide ID.

Anyway, I took a quick stab at writing an Excel macro which attempted to figure out people’s bioguide IDs. Here’s the results:

Database of FY2010 Earmark Requests (with BioGuide IDs, version 8)

Note that this work was done with version 8 of the Taxpayer.net database, so if they continue to release new versions of their spreadsheet, this representation might be a bit behind.

The Digital Transparency Index

April 9th, 2009  |  Published in Thoughts

Now that RepresentedBy has launched, I’ve had a little bit of free time to turn my attention back to my last post about digital transparency.

To help keep the conversation going about digital transparency, I’ve setup a website dedicated to the work around the Digital Transparency Index. The goal of this site is to act as one way of measuring online activity and transparency with legislators, and by providing the data in an open format, allow others to mash it up with their data and observe trends in Congress.

It’s still a work in progress (is anything finished these days?), but check it out and let me know what you think.

http://digitaltransparency.appspot.com

Current Digital Transparency Index for Congress

Are digitally transparent legislators less likely to include earmarks?

March 17th, 2009  |  Published in Development, Errata, Thoughts

For the past two months, I’ve been developing RepresentedBy, a Facebook application created for the Sunlight Labs Apps For America competition. During the two months of development, I’ve immersed myself in the online government world and while I’ve been exposed to quite a lot of great work by passionate individuals, I’ve also realized how little of Congress is digitally transparent.

Digitally transparent can mean a lot of things to different people, so in an attempt to quantify that, I’ve developed what I’m calling the DTI, or Digital Transparency Index. This is a number between 0 and 115 that gives you a rough idea of how engaged a legislator is in the digital world. Legislators are scored on the following criteria:

  • 25 points if they have a public facing email address
  • 20 points if their website has a valid RSS feed
  • 10 bonus points if they’ve posted a news item to their RSS feed in the past week, 5 bonus points if they’ve posted a news item to their RSS feed in the past month
  • 20 points if they have an active Twitter account
  • 10 bonus points if all of the tweets on their home page are from the past week, 5 bonus points if all of the tweets on their home page are from the past month
  • 20 points if they have an active YouTube account
  • 10 bonus points if they’ve posted a YouTube video in the past week, 5 bonus points if they’ve posted a YouTube video in the past month

The sad truth is that Congress isn’t as digitally immersed as a lot of us. Out of 115 possible points, the highest score anyone received was an 85. Worst of all, out of 451 active legislators, 209 of them scored a big fat zero, 161 legislators scored low (meaning an index of 35 or less), and only 81 legislators scored 40 or higher.

digital immersion # of legislators
none 209
low 161
medium to high 81

My first assumption was that this gap was an age related issue. The average age of Congress is around 60 years old which isn’t exactly the average age of of your cutting edge Internet user. However, I compared the results of the Digital Transparency Index with the number of years that someone has been in Congress and didn’t notice any obvious trends implying a difference based on age. Here’s a graph showing the results.

The far right of this graph indicates highly engaged digital legislators, and the far left of the graph indicates poorly engaged digital legislators. Aside from the large number of legislators who are not digitally engaged, when you start looking closely at highly engaged digital legislators, there’s not a huge disparity between the number of new, younger legislators engaging digitally and older, veteran legislators engaging digitally.

Next, I wondered if there was a connection between digital transparency and earmarks. Taxpayer.net recently released information about active legislators and the earmarks they have included in the 2009 stimulus package so I compared the amount of solo earmarks included by each legislator with their Digital Transparency Index, and graphed the results:

While there is a disproportionately large number of legislators who are not digitally engaged and who have not sponsored large earmarks, you’ll notice that as digital engagement increases, there becomes fewer and fewer legislators who are sponsoring extremely large earmarks. The only exception to this rule is Nancy Pelosi who has a very large Digital Transparency Index (80), but has also sponsored a large number of solo earmarks ($15,667,000).

Is this a trend? Does being digitally engaged and having real-time communication with your constituents discourage legislators from sponsoring earmarks? Or is it the opposite and legislators who don’t support earmarks on principle are more likely to take that message directly to the people and engage with them digitally?

Here’s a table summarizing my findings.

digital immersion # of
legislators
avg solo
earmarks 2009
avg years
in Congress
none 209 $5,226,898 15.8
low 161 $6,366,649 16.1
medium to high 81 $4,069,291 15.1

If you want to see where your legislator falls on either of these graphs, then check out RepresentedBy, a Facebook application I’m creating which includes this information and personalizes it to your specific district.

Finally, I hope to develop the Digital Transparency Index some more, so if you have any comments or suggestions on how to improve it, then please include them in the comments.

RepresentedBy Facebook app launches public beta

March 5th, 2009  |  Published in Development, Errata, Releases, Thoughts

My last entry about Google AppEngine and Facebook Applications was written during the development of RepresentedBy, a Facebook application which is still in a rough beta state, but has finally been opened up to the general public.

The goal of RepresentedBy is to:

  • To increase civic engagement.
  • To increase personal awareness of the legislators representing you in Congress and how they are voting on important issues.
  • To share information about your representatives with your friends, and to encourage civic engagement among your peers.
  • To provide an open source learning template for Facebook applications developed with Google App Engine.

The app is still in beta, but once it’s ready for release sometime in late March, then the source code will be made available. In the meantime, please check out the application and let me know what bugs you find, and any problems that you encounter.

Google AppEngine and Facebook Applications – 10 Things I wish I had known

March 1st, 2009  |  Published in Development, Errata, Thoughts

For the past six weeks, I’ve spent some of my spare time learning about Python, Google AppEngine and how to create Facebook applications with them. In a few weeks, I’ve learned a thing or two the hard way and thought I would share some lessons learned to save other developers from beginner’s frustration.

1. Never exceed 1000

When working with AppEngine, it’s good practice never to exceed 1000 in anything you’re doing. You name it, this rule applies. For example:

  • Your application can’t have more than 1000 files.
  • Each file can’t exceed 1000K (this includes third party libraries).
  • Each page needs to render in under 10000ms.
  • Database queries might not return more than 1000 results.
  • Each data structure in memory shouldn’t exceed 1000K
  • Each object stored in memcache can’t exceed 1000K
  • and so on….

Before you choose to build an app with AppEngine, make sure you can accomplish what you want to do within these limitations. It might make sense to only use AppEngine for part of the whole project (e.g. AppEngine for processing and Amazon S3 for storage).

(**UPDATE** Google recently upped some of these AppEngine limits, but not for everything)

2. AppEngine forces your code to scale out, not up

When I first heard about cloud computing and scalable infrastructures, I thought it meant giant supercomputing clusters which can handle massive amounts of processing and calculations.

AppEngine isn’t like this at all. It’s designed from the ground up to be scalable, but it achieves this by doing hundreds of thousands of small tasks instead of tens of really big tasks. And your source code needs to embrace this philosophy. If your script needs to spend time processing thousands of records, you should re-think why it has to be one script instead of ten smaller ones.

Switching my brain to architect for AppEngine was the hardest part of AppEngine development, but once I got into the groove, it makes total sense. I’ve really enjoyed building my applications from the ground up with scalability in mind. I might not be as open minded if I had to port and existing application to AppEngine, but luckily, I haven’t had to do that yet. ;)

3. Use DynDNS to develop AppEngine/Facebook apps locally

AppEngine imposes a daily quota of 250 deployments to their server. This limit seems reasonable, but often you’ll need to test your Facebook applications in Facebook itself. And if you’re tweaking CSS or troubleshooting bugs, then you can use up your quota quickly if you have to deploy a new app each time you want to test a change in Facebook. If you use up all your deployments for the day, then you can’t upload anymore and have to stop development until the quota resets in 24 hours.

This has happened to me twice now, and after the second time, I found a great thread in the Developing for Facebook + Google App Engine group describing a solution for using DynDNS or similar service to give a domain name to your local PC, then pointing your Facebook app at your local computer. That way you can test the application on Facebook.com using your local AppEngine devserver. Trust me, this is worth the setup time.

4. Be prepared to dig in, tweak and modify Python libraries

There’s a lot of great Python code libraries out there, but much of it doesn’t work with AppEngine because of AppEngine’s unique webapp framework. You can get most libraries to work with AppEngine by adding a line or two of custom code, but you have to be willing to dig into the code and fix it.

For instance, I’m using the Google YouTube API, and in order for it work with AppEngine, you need to override the http_request_handler like this:

import gdata.service
import gdata.urlfetch
gdata.service.http_request_handler = gdata.urlfetch

Another example is custom template tags. You need to register your custom tags with AppEngine’s framework:

register = webapp.template.create_template_register()

And then in each of your individual scripts you need to register the library. So for a library named ‘customtags’ it would be:

webapp.template.register_template_library('customfilters')

w00kie has a good blog entry talking about this in more detail, but don’t expect a lot of existing Python libraries to be completely plug-n-play with AppEngine.

5. There is never too much error detection

When a user visits your URL on Facebook, Facebook will call the URL on AppEngine, AppEngine will use its framework to get data from the Internet, from its DataStore, and from Memcache, then return the result to Facebook which processes the FBML and displays the content to the user.

Unfortunately, just about anything can go wrong. I’ve had Facebook authentication fail even though you’re logged in, I’ve had Facebook give up on waiting for AppEngine to render its page, I’ve had AppEngine throw errors when doing a simple urlfetch, and I’ve had third party APIs suddenly stop responding. These errors are rare and normally not reproducible, but you still don’t want your user trying to figure out what an "ApplicationError 5" means. , So write your code to handle lots of exceptions.

6. FBJS is your friend and is key to achieving scalability in Facebook apps on AppEngine

The home page of my Facebook app is a beast. The content you see on the home page comes from more than 30 URLs on 10 different domains and third party APIs. Waiting for AppEngine to download and render this content takes forever, but I was able to pull it off by breaking up the page into five separate pieces. There’s a shell page, and then within that shell page there are four modules which each use FBJS to make a separate AJAX call to AppEngine to retrieve and display their own content.

I’ve learned the hard way that putting all your code in one page can take forever to render and consume lots of CPU, and FBJS helps reduce spread the page load out across multiple scripts.

7. Debugging FBJS is a real pain

While FBJS helps you scale out, debugging FBJS is a real pain. First, it only warns you of syntax errors, so if you have a logical error your script fails without warning. Facebook doesn’t report errors to the browser or allow you to use alerts, so the only solution I’ve found so far is to comment out your JS code one line at a time until you find the trouble spots. I would only advise doing this if you’re developing locally, otherwise you’ll quickly run into your quota limit for daily uploads to AppEngine.

8. If you’re retrieving external content, memcache is your best friend

As I mentioned earlier, the home page of my Facebook app gets most of its content from external URLs. For each URL, you fetch its content, process it into a native Python object (list or dict), and then render the content out via a template. This can eat up your CPU hours, reduce your response time, and make users give up on you.

Using memcache fixes all this. Memcache can store native Python objects, so once you’ve parsed a URL’s content in a native format, store the native object directly in memcache and retrieve it next time a user needs content from that URL

9. Use cron jobs to keep memcache current

Using memcache speeds up response time for all users except your first user. Since you shouldn’t be treating your first user any differently than the others, it’s worth setting up a script that keeps memcache refreshed with external content. This way all users will benefit from the speedup of memcache.

In my Facebook application, I’m retrieving content from a pool of around 3,000 different URLs, so I have set up a script that randomly picks 3-5 of these URLs, retrieves their content, and stores the result in memcache. I’ve also setup a cron job to call this caching script every minute or so and it’s sped up the average response time of the page, because the server never has to go out and retrieve 30 URLs of content at once. Also, if you are using third party APIs that put a limit on your usage, this is a great way to ensure you stay under those limits.

Right now, I’m executing the cron job from my own webserver, but AppEngine has said that cron support is on their roadmap, so hopefully in the future you’ll be able to support this entirely from within your AppEngine setup.

10. Once you’ve built an app or two with AppEngine, you’ll either love it or hate it.

I’ve really enjoyed developing apps with AppEngine, but I will admit it’s not for everyone. Anyone needing to do a lot of heavy data processing, or handle incredibly large data sets will experience nothing but frustration with AppEngine. However, for the majority of online projects, it’s a great way to build something scalable quickly, making it ideal for Facebook applications.

My first major Facebook application should be ready for public beta in the next week or two, so I’ll keep you posted about its progress.

Does your US Representative have an RSS feed?

January 22nd, 2009  |  Published in Thoughts

I read earlier this week about a new application contest being sponsored by SunlightLabs called Apps for America. You can read more details on their site, but the idea is to encourage developers to create open source applications that increase awareness and transparency in government. I started thinking about a few ideas for applications, and while the SunlightLabs API provides details for each legislator like website, email, Twitter, and YouTube URLs, what I really wanted to know was my representatives’ RSS or Atom feed.

Turns out, that information isn’t provided by the SunlightLabs API, but that doesn’t mean we can’t find it. As it turns out, there’s a function in the Google AJAX Feed API to submit a general URL and then receive information back if there’s an RSS or Atom feed associated with the URL. So let’s mashup those two services and find our answer.

In this example, I’m going to do it just using Javascript running on a webpage. The webpage will contain a single textarea element named ‘output’ where we’ll display the results.

The Javascript for this is very straightforward. First, we’ll initialize our variables and Google services.

var legislators;
var currentRep = -1;
var sunlightAPIcall = "legislators.getList.json";
// replace this with your full API key for Sunlight Labs

google.load("jquery", "1");
google.load("feeds", "1");

Then using jQuery, we’ll grab the details about ALL the legislators from SunlightLabs and store the result in a variable.

function initialize() {
   $.getJSON(sunlightAPIcall, function (data) {
      if (data.response.legislators && data.response.legislators.length > 0) {
         legislators = data.response.legislators;
         checkNextFeed();
      }
   });
}

Next, we need to check each representative to see if they even have a website.

function checkNextFeed() {
   do {
      currentRep++;
   } while ((currentRep < legislators.length) && (legislators[currentRep].legislator.website == ""));
   document.getElementById("output").value = currentRep + " / " + legislators.length;
   setTimeout(lookupNextFeed,100);
}

If the legislator has a website, then we'll use the Google API to lookup the feed, or if we're at the end of the list, then we'll print out the results.

function lookupNextFeed() {
   if (currentRep < legislators.length) {
      google.feeds.lookupFeed(legislators[currentRep].legislator.website, lookupFeedDone);
   } else {
      outputResults();
   }
}

Once Google is done checking for the feed, it returns the results to our lookupFeedDone() function and we store the result in a new field of the object. Then, we start the process all over for the next legislator.

function lookupFeedDone(result) {
   if (result.url) {
      legislators[currentRep].legislator.feed = result.url;
   } else {
      legislators[currentRep].legislator.feed = "";
   }
   checkNextFeed();
}

Finally, here's the function to print out the results.

function outputResults() {
   var csv = "bioguide_id,website,feed\n";
   for (var i=0; i < legislators.length; i++) {
      csv = csv + legislators[i].legislator.bioguide_id + ","
         + legislators[i].legislator.website
         + "," + legislators[i].legislator.feed + "\n";
   }
   document.getElementById("output").value = csv;
}

So what do the results look like? Well,

  • There are 540 legislators
  • There are 473 legislators with websites
  • There are 109 legislators with data feeds

That's helpful, but it's still pretty sad that only 20% of legislators provide content in a feed format. Perhaps you should send them an email and ask them to update?

In the meantime, here's some links for you:

UPDATE: Turns out some of the feeds are invalid (pointing to htmlfixit.com). Here's the full list of feeds as rendered by the Goog, I'm sure as comments come in, we'll update the list some more: