Beet, Barley, and Black Soybean Soup
For fun I transcribed my girlfriend's recipe into Ruby code that could theoretically execute, given the proper support classes. No I'm not doing much today, why do you ask?
A brief introduction to Ruby, Sinatra, and Haml
Ruby and Sinatra make it ludicrously easy to make a webapp, but getting started, as with any new language or framework, can be daunting. By the end of this part, you'll have a simple template that talks back to you!
Destructors in Ruby? Not quite…
So I was curious to see how destructors work in Ruby, and...they don't. Or rather, the method we do have, ObjectSpace.define_finalizer, is rather restrictive. But it does leave a loophole -- the callback method receives an object_id.
LockNLoad is…locked and loaded?
I've just completed and pushed the initial version of LockNLoad, a Spring-like Inversion of Control container for Javascript, which follows the dependency inversion principle (I think I'm getting all these terms right...). Given the proper configuration, you can simply say LNL.$("my_id") and get a prototype or singleton object or function. Read on for more information.
Cool free hosted tools for your Ruby webapp
Some of these are obvious (i.e. get exceptional, hoptoad), many of these aren't Ruby-specific, but I thought it might be nice to put all these in one place, at least for my sake.
Exception tracking
Get Exceptional limit: 1 app
Hoptoad limit: 1 project, 2 users
Bug tracking:
there's github, of course, if you're already using that...
16bugs limit: 1 project
I'm not including full hosting platforms, like Google Code here, but you could use those, too
One-off emails (i.e. signup)
Sendgrid limit: 200 emails/day
GMail allows 500 emails/day, but doesn't offer all the doodads that Sendgrid does
Mailing list (i.e. newsletter)
Mailchimp limit: 500 subscribers, 3000 emails total a month
Customer Support
SnapABug limit: 10 reports/day
uservoice limit: 100 unique users/month
GetSatisfaction limit: 0 official reps, not hosted on your url
Analytics
There's a ton of options in this space, but I use:
Google Analytics limit: no limits, because it's The Goog
Clicky limit: 1 website, 3000 hits/day
Metrics, Monitoring
New Relic limit: no troubleshooting, optimization, etc
User Avatar Hosting
Gravatar limit: none
Authentication
OpenID
RPX limit: up to 6 providers, instead of 12
Time tracking/invoicing
Harvest limit: 2 projects, 4 clients, 1 user
Help desk thing
Just kidding, couldn't find any free hosted help desk apps
Anything else I'm missing that every webapp needs?
karmic koala finally
So I may have totally hosed my server in the process, requiring me to reimage the thing, but I finally have Ubuntu 9.10 running on it
woot...
Pleasantly Surprised: Windows 7 RAM reporting
It's the little things that show someone's listening at Microsoft that make me happy.
Vista, when it first came out, reported that I had 3.25 gigs of RAM in the System Properties dialog. Bummer, but to be expected when I put 4 gigs of ram into a 32-bit system.
Microsoft later released a "patch" so that instead of reporting how much RAM you had available, it would report how much RAM was /installed/ (aka, 4.00 GB instead of 3.25 GB). I, along with countless other nerds out there, were outraged that we had to download a third-party program to find out how much RAM was actually available.
Windows 7: Installed memory (RAM): 4.00 GB (3.50 GB usable). Huzzah! Don't know where the extra 0.25 GB came from, but at least they're trying, right?
New little discovery -- "progress bar" applications, like copying files, have their progress bar /in the system tray/. How cool is that?
*still writing this post from Ubuntu
*
Debugging unobtrusive javascript in jQuery
So if you work for a large enterprise website like I do, where each page loads dozens or hundreds of kilobytes of javascript, it can be hard to figure out exactly what happens when you click that div and something magically happens, due to the wonders of unobtrusive javascript.
Or, to rephrase the question, "I know how to add event handlers to an object -- how do I enumerate what's already been attached?"
And it's pretty easy, but unfortunately it doesn't use a public API. Anyway, try this in Firebug:
$("#the_button").data("events");
If there are any events on that element, they'll be displayed. The only drawback is...you have to know exactly which element the events are attached to, or guess around a bit.
Enjoy!
IE + AJAX + Redirects
So we made an interesting discovery these past days...IE handles some redirects in AJAX really, really badly.
This table explains:
| Redirect URL | ||
|---|---|---|
| To itself | To another page | |
| FF | Redirect 18-20 times | Didn't test |
| IE | Redirect until you close the browser | Redirect 10 times |
(By "redirect to itself" I mean you have some bug in your logic such that page http://example.com/?page=1 will redirect to itself indefinitely.)
Do you like that "redirect until you close the browser" one? Even if you go to a completely different site, the browser will still be making requests to yours.
Moral of the story: be very careful with redirects with AJAX.
Banks and OAuth support
For fun, I decided to ping all of my financial companies (Bank Of America, CapitalOne, Chase, EmigrantDirect, INGDirect, Vanguard) about their plans for OAuth support. I don't know how many of you use the wonderful service known as Mint, but I like it a lot. Unfortunately, a part of me died when I gave them my username/password for my banking sites. And INGDirect is secure enough that Mint can't even interface with them! Sorta cool.
Anyway, here's what the institutions said: