Tuesday, October 27, 2009

TinyMCE: Nothing In Textarea

If you want to get the value of the <textarea> through some method other than just hitting "Submit", you're dealing with some kind of <iframe> jiggery-pokery. A good old-fashioned Prototype $(editor_id).value won't get the job done; in this instance, you need tinyMCE.get(editor_id).getContent().

Monday, October 26, 2009

How To Use Bundler With Rails

gem rails, :only => :bundler

via @carllerche and @patmaddox

Saturday, October 24, 2009

Alternate Programming Business Model: Driving Affiliate Traffic With Shareware

I've written recently about how I think consulting is a terrible business model. Given that it's basically the business I've always been in, I started to look into other business models and find out what my alternatives might be. Out of curiousity, I bought an ebook on affiliate marketing.

Since Ruby programmers love meta crap, I'll introduce affiliate marketing the meta way: if you click this link and buy the PDF, I'll get a commission. That's affiliate marketing - basically, driving traffic, selling stuff, and getting a commission. (I'm not actually expecting to see a lot of people buy this thing, but a) if I'm going to link, I might as well use an affiliate link, and b) the FTC set up some new rules about that, so I'm mentioning it out of legal paranoia.)

Anyway, most of these things are pretty cheesy. This one was written by some kind of surfer guy, so I thought what the hell. I know a woman who does Internet marketing full-time - she gets paid to blog about yoga - and another who offers an affiliate program for her business, where she teaches actors how to be financially self-sufficient. So I've seen a little bit of this affiliate marketing world, and by its standards, this surfer guy seems unusually chill. He also gives away a lot of detailed information, which I took to be a "good karma" type thing. Anyway if I get into explaining it I'll want to do a whole review, and I'm too tired for that right now. Maybe later.

What surprised me, and why I'm blogging this: a chapter on the guy's "secret weapon" for generating lots of traffic (traffic is a big deal to affiliate marketers). Basically, the secret weapon is downloadable applications. This includes shareware, freeware, and Web apps repurposed to run within dedicated browsers and thereby become equivalent, as far as a nontechnical user is concerned, to downloadable desktop apps.

On the one hand, this struck me as a weird potentially-revolutionary business model for programmers: building stuff for people to give away to drive traffic to their affiliate marketing programs. On the other hand, there's nothing that revolutionary about it. It's essentially what many of us already do for a living. We build stuff for entrepreneurs to give away to drive traffic to their "hey Mr. VC, buy me out" programs. But it's scaled down much, much smaller than is usually the case.

It matches the thing I said in my Archaeopteryx presentations: that Internet startups can be not only too cheap to fund - from the traditional VC perspective, where any business launch requires millions upfront - but also too small to see. If I make some shareware, license it to somebody in exchange for a portion of their affiliate marketing earnings, I have in a sense successfully launched an Internet startup, even though it's not at all what people mean when they use the term. This is an "Internet startup" that you could in theory launch with one programmer in his or her spare time, although I have no idea if there's any real money there.

When you look at the fiction people have generated about robots, a lot of it revolves around the idea of giant robots. What's the reality? The reality is that tiny robots can do a lot, and robot price gets out of control quickly if you make the robot big. A robot the size of a computer mouse costs about as much; a Lego Mindstorms NXT kit costs around $300; a Lynxmotion hexapod costs around $700, not counting brains or sensors; and anything bigger than a hexapod gets you into crazy money really fast. Technology tends toward miniaturization.


Lynxmotion hexapod

A corporation is kind of like a robot, although that's a huge separate topic. Point is, a lot of people think the Internet is here to make our corporate overlords more powerful than ever before, and give them even more gigantic empires. (And by "a lot of people" I mean those corporate overlords themselves, and their minions.) But I think long-term, it's going to have the opposite effect, and that (among other things) the Internet may make software businesses much, much smaller than they are (and they're already smaller than they've been in the past).

This is the other reason I find affiliate marketing interesting. Every indication is that these businesses are extremely small. But that's another rant, and I'm tired. Anyway, if you're curious, here's the ebook link again. It's an interesting read, even if it isn't free (assuming you find these sort of micro-entrepreneurial phenomena interesting).

Friday, October 23, 2009

Doctor McNinja



In the glorious tradition of Scud The Disposable Assassin and Rex Mantooth, Kung-Fu Gorilla.

Friday, October 16, 2009

ignoring attempt to close foo with bar

Given:



When:



Then:



It's pretty easy, when running a ton of specs or tests, to see giant strings of dots interrupted by bizarre, enigmatic shit like this:

.........................................................................
...............................................................................
.........................................................................ignori
ng attempt to close form with br
opened at byte 12093, line 245
closed at byte 13454, line 282
attributes at open: {"class"=>"new_piece", "action"=>"/p", "method"=>"post", "id"=>"new_piece"}
text around open: "loader'></iframe>\n <form action=\"/p\" cl"
text around close: "x\" value=\"1\" />\n </br>\n <input nam"
...


It never tells you where it came from and never interferes with a spec completing. For years I thought it came from Hpricot. Nope. It comes from here:

/Library/Ruby/Gems/1.8/gems/actionpack-2.3.3/lib/action_controller/vendor/html-scanner/html/document.rb

In this arcane back alley there lurks a parser from the dark days before Treetop, just waiting for the day when a lazy blogger will quit talking shit and write some fucking code. (Or, alternatively, waiting for the day when an inspiring blogger will motivate one of his heroic readers to learn Treetop (which is awesome) and replace the old Rails HTML parser with a better one.) Until that day, you have to deal with its idiosyncrasies, one of which is overzealous warnings about HTML (indeed I think even XHTML) correctness.

It's easy to kill those warnings. Either use the verbosity special variable $-v as in this example, or run your test like this:

ruby -W0 test/whatever_test.rb

Obviously however this breaks with rake test:whatevers, and I have no idea if it works in any sense at all with RSpec. So the short-term hack: $-v reassignment FTW.

(Update: of course, the smart thing is to couch these hacks in before(:each) blocks, for RSpec, or setup and shutdown methods, for test/unit.)

Wednesday, October 14, 2009

Wednesday, October 7, 2009

Attempting Blog Hiatus

I've written a lot of negative posts lately, and I'm not enjoying it. I'm going to see how long I can restrain my alleged graphomania. I'm going to attempt similar restraint on Twitter, with the exception of my daily mp3 @djgoatboy account.

Douglas Crockford Is The Pope, Apparently

YUI sits in judgement over us all.



You can find multiple examples of Yahoo using the term evil as if it were an agreed-upon technical term with a firmly defined meaning. I believe it's very unwise for programmers to blur the line between opinion and fact, but this goes beyond unwise. This moves into the territory of those crazy religious fanatics who won't let their kids read Harry Potter because it contains images of witchcraft.


Photoshop making boobs bigger? That's magic! Photoshops worship Satan!

It's one thing to say "I disagree with this design decision" and a whole different ball of wax to say "our official corporate policy is that particular language features are evil."



Unfortunately, I can't put any real weight behind a call to civility, at this point. I've spent too much time telling Obie to shut the fuck up and trying to summon an angry mob to lynch Chad Fowler. But declaring something evil implies a claim to moral authority, and I think Yahoo's claim has no real weight to it either. YUI, as a framework, is already kind of unfriendly to newbies; damning us for our heathen ways doesn't do a whole lot to roll out the welcome mat.

Against my better judgement, I'm using YUI for a project right now. If you're wondering about my experience with it, I'm going to say check with some more knowledgable client-side people, but my personal opinion is that as a YUI newbie, you should show YUI the same friendly, open mind that YUI shows you.

Tuesday, October 6, 2009

Here's What Annoys Me The Most

The thing I hate about being a programmer is the endless parade of flaky entrepreneurs and clueless middle managers. I've worked for so many companies - more than 30 - and seen so many people making the same mistakes. These companies out there, they're looking for programmers? That's all they want? Sticking me in a box and having me churn out monkey code that anybody could do is a ridiculous waste of my time, and a foolish thing to pay me for. If I'm charging by the hour, why not have me tell you if I've ever seen more than 10 companies go under after doing exactly what you're doing? I mean it's your hour, one way or the other, you paid for it.