Wednesday, December 31, 2008

Preoptimization in real life.

So yesterday I went down to my local Subway (we actually have 2, but I don't go to one of them because it's a pain traffic-wise), and got in line. I had plenty of time to decide what I wanted; about two minutes since the small family in front of me was taking their time.

No sweat, even though I picked out what I wanted in about 10 seconds.

I spent the rest of the time thinking about how to phrase the sentence,

"I want a foot-long Subway Club on wheat."

But then I thought to myself, "If I say I want a foot long wheat Subway Club," she'll be able to get the sub bread before I finish speaking. Then I realized that, although that sentence is understandable, it is not very "correct." Would she understand immediately, or would it introduce a further delay in my sub making adventure? On the other hand, even if she did understand it immediately, would she even be able to react in time before I finished the sentence? Was the optimization even worth it?

I totally wasn't paying attention by then, so when she said "What do you want?" I kinda jerked in place and replied,

"Uh, a subway club. On wheat. Foot long wheat."

Tuesday, December 30, 2008

Importing OpenOffice files into Google Documents: Don't.

OR: what to do when Google Docs screws up your formatting (see end)
Seriously, don't do it.

First of all, the file upload size is much too small -- there's some ridiculously small cap, like 500kb. I got a document here, 1.1MB -- all text -- that just can't be imported. So now I got some documents in Google Docs, some documents out.

Secondly, and most importantly, Google Docs totally fucks up imported styles. Witness:

Now dude, I love me some Google Docs, but that just isn't fun. The only way to fix it, as far as I can tell, is to just "rewrite" those particular lines all over again. But I've got an entire document full of them and it ain't pretty business.

If I could do it all over again I'd just do a massive C/P job, which seems to preserve the formatting.

Still, it's not enough to make me give up Google Documents, which is excellent. I just hope they keep better backups than I do.

UPDATE:

I've cleverly deduced that for some parts of the document, Google Docs doesn't have a font set -- eg, you click into a paragraph and the 'font' drop-down is empty. If you select all of the document contents and set the font to something like Veranda for the whole document, it seems to correct the graphical glitches. Of course now the document doesn't look quite right, and it's still missing the linebreaks that the original document had, but at least now it's readable -- and, editable.

Saturday, December 27, 2008

Flex file uploads: no custom HTTP headers for you!

Stubbed my toe on this recently.

For some reason (unexplained, and it seems unlikely that this is an actual security issue) you can't have custom HTTP headers for file uploads in Flex 3.2 (possibly Flash as a whole). They state it in the documentation, to their credit, but it's more of an aside, tucked away at the end of an irrelevant paragraph, than a big red "HEY WE JUST CHOPPED OUT SOME FUNCTIONALITY YOU'D NORMALLY EXPECT TO BE THERE" warning.

For half a minute I thought I was in ruby and said to myself, "I'll just override this and inject the custom headers myself," then I realized where I was and went "D'oh!"

Monday, December 22, 2008

Aptana: Changing Ruby Interpreter on a per-project basis?

Anyone know of a way to change the Ruby Interpreter in Aptana for each individual project?

I've been wanting to give it another test drive and see how the latest version compares, but for the life of me I couldn't make this one simple thing happen. I've got multiple projects in both Ruby and jRuby, so not being able to easily switch is a big big pain.

I got as far as the "build path" bits, but I couldn't make those dance the way I wanted so I gave up and went back to NetBeans 6.5. Which works perfectly, but I'm not a fan of the default directory structure. If you use the "files" view instead of "projects" you lose a lot of functionality. :/

EDIT: "why not post on the Aptana forums?"

Because I forgot my username and password. And you can't get your password without supplying your username for some fucked up reason. So, basically I'm locked out of the forums. :)

"The Chrome."

That's what my mother's started calling The Internet ever sinced I set her up with a copy of Chrome.

She says, "Hey, have you been on The Chrome? Why don't you put The Chrome on dad's laptop, too?"

She misses one feature: auto-fill for forms. She found a toolbar somewhere that did it all by herself, and now she really mimsses it.

That and Hotmail support. She is not happy she has to go back to using "the blue one" for Hotmail.

Thursday, December 18, 2008

ThoughtBot Shoulda -- It Whups the RSpec's ass.

Anyone remember that?!

Heh, heh. Yeah, back when people used WinAMP... I guess they still might. I switched to WMP (gawd, I know), but then to Songbird when it finally stopped sucking (still sucks a little, to be honest).

Anyway, for newer Rails projects, I've completely replaced RSpec with Shoulda. It's nice, clean, readable, doesn't add anything extra to the Rails folder hierarchy, and best of all, it is filled with sweet-as-hell macros that take a lot of pressure off'a my tired fingers.

For non-Rails projects (I do those too!), they offer a gem, but I haven't used it yet.

It seems like every day that something exciting and awesome happens in the Ruby / Rails area, and everyone moves up to the next big thing... but I think that's because the next big thing is better than the thing you happen to be using at the moment.

Wednesday, December 17, 2008

SaaS RailsKit: I've hit my first WTF, and I don't think it will be my last.

(an hour in)

WTF #1: the way the database is boot-strapped.
WTF #2: "accounts.full_domain" -- ?! Yay for adding, requiring, and building code around things that not every SaaS app is going to need!
WTF #3: rdoc, motherfuckers. Get some.

Update:

Ugh. This thing was clearly modelled around 37signal-style SaaS. I can probably use most of it and just use dummy values to satisfy the bits that won't be used, but still.

Tuesday, December 16, 2008

"She's dead, Jim."

Awhile ago if you had asked me about free, super-easy Rails hosting, I would have blown your mind by mentioning Heroku -- cloud-based Rails hosting. FREE cloud-based Rails hosting.

Lately, though, I'm not so sure.

Check out the Heroku Google Group. There are a lot of complaints there, and no one from Heroku is talking. Seeing "my website has been down for 4 days," and then seeing another say "mine too" without any response from the Heroku team is enough to put you on edge. But, maybe these issues are getting handled, and they back-and-forth just isn't taking place on the group. If so, maybe Heroku should think about having their own ticket system or something in place, because as it stands now, all the unaswered complaints are casting a bad light on the service as a whole.

All that considered, if you're looking for an extremely easy way to deploy a trivial little app, Heroku might be for you. I've got my own VPS, but lord knows using Heroku would be a lot easier... but I'll wait until they come out of beta for that.

Monday, December 15, 2008

Using jQuery with Dojo?

Can someone come up with a really good reason for me not to use jQuery with Dojo?

Because the way I see it, jquery + jquery-ui is pretty fantastic, so throwing in dojo when I need something a bit more powerful (dojox.gfx anyone?) seems like it could be a good fit.

Dojo seems to keep their stuff locked tight in the "dojo" namespace, so I don't see any collisions happening, but I've given it just a glance.

Saturday, December 13, 2008

Rails Plugin developers: *PLEASE* don't use Prototype's $() syntax in your plugins!

One of the very first things I like to do when starting a project from scratch in Rails is to throw out Prototype and bring in jQuery via jRails. Look, I love me some Rails, but I hate me some Prototype -- it's like someone spilled their goddamn Java over my sparkling Ruby somehow.

Not cool, man.

Anyway, the thrust of this post is about not using Prototype's shorthand syntax when developing plugins that include UI elements. I name no names, but a few plugins take for granted that you'll be using Prototype throughout your project, and so use $() with reckless abandon. That's fine and all except when you're not using Prototype everywhere, and are trying to use jQuery's sweet ass $() shorthand instead.

I realize that jQuery comes with a no-conflict mode for situations like this, but it'd be cooler if plugins kept themselves as abstract as possible, or just stuck to Rails Javascript generating code instead.

Thursday, December 11, 2008

Feeling stuck? Self-loathing? Shoe-gazing?

Think life can't get any worse?

Have a good read through the Black Hat SEO forum.

If you're in a REALLY bad mood, time-travel back to the last time Google nuked a swatch of spammers from their index and read through the complete hysterical narrative.

I mean, I was feeling pretty crappy earlier, but when you read about some guy about to go homeless because Dreamhost busted their account for spamming, well, you know, it puts things in perspective.

I guess if you're a sadist you'll enjoy the fact that most of these people spend 2-3x the effort making 1/3rd the money most people make doing a regular job, but whatever.

Wednesday, December 10, 2008

Flex / Adobe AIR == Ninja / Pirate

I didn't know, until I downloaded Tour De Flex, just how badass this technology was.

Browsing through the sample demos, I realized you could really build a regular desktop application using these technologies. I mean, I've hammered-out plenty of C# applications that could have easily been Flex + Adobe AIR applications if they had been around back then.

And the install badges for AIR applications? It is, literally, out of this world. I haven't seen an install system look and feel so fluid since 3-4 years ago when I was looking at mockups of web-based Linux package installers (Autopackage?).

The big "killer" is the lack of a freely available IDE. Since Flex's MXML can be done by hand, and ActionScript is basically Javascript with a few nice add-ons, you don't really need anything advanced -- a nice text editor can do wonders. But since Flex has to be combiled into a SWF, it makes web-style development harder: kiss the iterative "code, refresh page, repeat" process goodbye.

Still, all in all, it looks like a pretty solid set of technologies, and the development process is fairly similar to web design / programming. Could be an extremely valuable asset to pick up in the future.

Tuesday, December 09, 2008

zomg, are you sure?

Recently heard during development of an API:

"we don't need error codes" (paraphrased).

Thursday, December 04, 2008

Fun experiences with JavaFX.

UPDATE: Yes, I updated to Java 6 Update 10 after #1.

Had a peek at some JavaFX demos earlier -- have been evaluating XUL, Flash, and Silverlight lately, looking for a good, free, easy to target platform for enriching some sites. You know, giving them some *umph*. You know, a richer experience for those who can afford it (someone cue rimshot!).

Here's how JavaFX played out:

  1. Crashed the browser when I visited a JavaFX applet running an older version of Java (1.6 update 7). The *WHOLE* browser. All of it. Thanks, Sun.
  2. Viewing the demos on javafx.com, they all repeatedly bitched about needing to use an "older" version of Java. Hit cancel, dialog pops up again -- FOREVER.
  3. Jarring, incredibly annoying browser-wide freeze for about 6 seconds while Java sloughed itself into memory.
So far, typical Java.

After I got the JavaFX demos up-and-running, they looked OK, but the demos aren't really reassuring.

XUL's a good'un, but that's only for Firefox browsers. However, for an intranet setting, XUL would win out completely. Some Firefox plugins are freaking *awesome* -- and they're all pure XUL + Javascript.

The whole javascript + svg + css + etc combo is in theory great but in reality minor browser differences are a big 'go fuck yourself.'

Silverlight actually looks really good in the respect that it can be driven by JS and written with plain XML, but it's a downer, same as XUL, for people not running Windows and IE7. Yeah, they say there's Mac and Firefox support, but I haven't found a good sample that works aside from Netflix's Instant Viewing (that only ran in Firefox, by the way).

Wednesday, December 03, 2008

Google Friend Connect vs Facebook Connect

Which should you use?
VS MODE

Google Friend Connect is really just a handful of widgets that let viewers have a "presence" on your site. Basically, within these widgets, Google / Yahoo users can talk to each other, discuss articles on the site, share pictures, etc, etc.

This is the solution you want if you're looking to add a "no touch" social networking angle to your site: you just drop in the widget code where you want it to appear, and off you go. The sites using Google Friend Connect right now are pretty lackluster looking; the best integration you'll find is Billboard for The People. This is programming-free social networking at its laziest.

Facebook Connect on the other hand, is for people who really want to dig in deep and have a much more fluid integration story. TechCrunch (see this story) is doing it right -- you can connect your Facebook account to TechCrunch, and never have to enter your name / email / website ever again. You even get the option of publishing your comment to your profile, if you feel it's good enough. There's probably oodles more they could do, but I'm not much of a man for oodles, so I'll pretend I never said that.

Since TechCrunch can perform deep integration using Facebook Connect, when you leave a comment as a Facebook user, the end result is fluid: the only difference anonymous comments and authenticated comments is the Facebook profile picture that shows up. It's got a funny blue 'F' in the lower right corner. Can't miss it.

SHORTER VS

Use Google Friend Connect if you've got a blog or regular static website and just want to slap on some pretty regular social networking features.

Use Facebook Connect if you need or want much better integration with your current site flow.

C'mon, Firefox, what's the deal?

Look, Firefox, I love you, man, but I've been using Chrome recently and the way you compare in speed is just BS.

I mean, I only had two tabs open and you were using 400MB -- WTF?

And, I closed you about 2 minutes ago, and only now has the firefox.exe actually gone away -- although it was fun watching the "memory countdown" so to speak.

Seriously, bro, if Chrome offered even a sliver of the add-ons you did, I might be using it on a more permanent basis.