Manipulating ckeditor data with jQuery

I'm working on a project that utilizes CKeditor and need to manipulate the data it contains.  Since I'm familiar with jQuery and it's fairly efficient at doing that sort of thing, rather than figuring out how CKeditor manipulates things internally, I wanted to, at least to get started, access things in jQuery.  There isn't a lot of information out there on the best way to do that.  Here's what I figured out – it seems to work pretty well:

    var editor = theeditor();
    var contents = $("<div id='specialwrapperthing'>" + editor.getData() + "</div>");

    .... hack away with jQuery ....
    editor.setData(contents.html());

Basically, you just wrap up what the editor hands you in terms of the data, hack away on it, and then put the HTML back into the editor.

Random github idea: show pull requests on the network

Another day, another "which ^(&^%*&*^&()* version should I use?!" with github:

https://github.com/gramos/easy-fckeditor/network

Github is nice, but very, very often all the forks are the very model of a modern major paradox of choice.

Which one should I use?   Which one is best?  Do the forks exist because 1) the original author stopped bothering? 2) because the forkers just wanted to be 'cool' and have their own fork? 3) because the forkers don't have a clue about open source and don't attempt to submit their patches back?  Who the hell knows, in most cases.   This is frustrating.

I had a random idea that might help some: if the 'network' view were able to show you, at a glance, the amount of interaction between different forks: pull requests accepted and rejected.

At least we'd get an idea of what sort of community is forming around the project, and also have an idea whether the forkers and/or the authors are good open source citizens or not.

Of course, as my friend Salvatore says, "pull requests are not conversations", but it's better than nothing.

Rails Application Templates

Thanks to some friends on twitter, I recently discovered RailsWizard which is a very handy way of generating new Rails applications with the "right" things included.

I liked what it did a lot, so I took the generated file and saved it as a github gist:

https://gist.github.com/829521

Which provides me with a very handy starting place for new Rails projects.  This is a great way to get some of the housekeeping out of the way before we start: ensure we're using jQuery, add some gems that I always use like exception_notifier and will_paginate, and so on.

The UnderPerformingStocks.com sale – halfway in

A few weeks ago, I had an "out-there" idea to try creating and selling a site at the same time.   So far, it's not exactly raking in a major amount of cash:

www.underperformingstocks.com is For Sale on Flippa!

At $100 with a couple of bids, it doesn't look like I'll be able to retire on it!  That said, I haven't spent a great deal of time on it, and part of the idea of the experiment was to limit the amount of time the 'new idea' would distract me from other things.  I did hope to receive a few more "audience requests" in terms of what to build on Flippa.com, though.  Hopefully, things will heat up a bit during the final two weeks of the auction, but I don't think "flipping" web sites is really a business I want to be in.  It's been fun to see how much you can build with how little, though, what with all the widgets and API's out there these days.

Since I'm a coder at heart, I also released some Ruby code that utlizes Google's stock screener API: https://github.com/davidw/google-screener – it's under the Apache license, and is kind of neat to play around with, I think, and is what I use to fetch information for the site.

Book Review: Start Small, Stay Small, A Developer’s Guide to Launching a Startup

I tend to be a sucker for business books, to the point where I created (and later sold) a site to discuss them. Part of the motivation for creating that site was that a lot of them tend to contain one good idea, and an inordinate amount of fluff. 

This book does not – it's good material that could not easily be summarized because it's full of information.  I think it's actually one of the more relevant books I've ever read in that, for my situation, the idea behind it really speaks to me.

I work as a consultant during the days, and I like it a lot.  Rather than working on the same old thing year after year, I get to meet new people, new clients, new situations, and help them out, which is motivating.  However, consulting has its downsides too, in that it doesn't create a great deal of long-term value.  Once you've finished up a project, it's on to the next one, or no money comes in.

I'm also a bit older and more set in my ways: I did my time in the California Bay Area, and I don't relish going back and working like mad on a "Real Startup" with VC backing, crazy hours, and having the thing consume my life.

The idea behind "Start Small, Stay Small" is to find and create really niche products: stuff that will earn you some extra money as a developer, but also niches that are small enough to not really be interesting to larger companies that need a lot of income to justify a forray into a particular market segment.  This, then, becomes your 'competitive advantage': Microsoft, or even 37 Signals, simply isn't going to chase after a market that is worth 20,000 dollars a year.  And yet for someone working on their own, if you manage to set up something that brings in that money, and mostly automate it so that it's not a second job, it's a tidy extra bit of money.  Several projects like that might even be enough to live on, depending on your lifestyle.

With that in mind, the authors, Rob Walling and Mike Taper, delve into the details of how to go about doing so.  The whole thing is done under the assumption that you don't have a lot of time or money to throw at things that don't bring in concrete results in relatively short order.

Various subjects discussed in detail include how to find a niche, how to create a sales web site, how to measure market demand, conversion rates, how to productively outsource less critical portions of your business, and much more.  They also discuss what sorts of numbers to look at for various aspects of the business, and anchor the discussion with real numbers for many things, rather than just giving you a hand-wavy phrase that's not that useful in the real world. 

It's not a 'timeless' book as all the concrete numbers and techniques reference technologies, sites, and the market dynamics of 2011, but after all, that's part of what makes it good.   Other things I didn't like so much were being sold on their for-pay "micropreneur community", and the relatively high price of the book but I think it's worth it given the real advice you get.  If you don't like marketing, and think that products succeed or fail on their merits alone, of course the book will leave you cold, but of course you're wrong about that anyway!

Parallelized web site creating and selling – underperformingstocks.com

I often have ideas for little web sites, stuff I just get the urge to create for the fun of it.  Some of them have done rather well, like langpop.com but even that doesn't make any money, and, sadly, as I age, that is becoming a more important factor in life.

So I decided to try a little experiment.  I was thinking some about "value" stocks, and fiddling around with Google's stock screener, and thought of the idea of a site that highlights underperforming stocks: http://underperformingstocks.com – so far so good – I went ahead and registered the domain, and put together the beginnings of a Rails application.  At the same time though, I decided I have enough things to do in my evenings and weekends, so I decided that it might be interesting to start selling the site at the same time I'm building it.

I'm not really sure how it will work out: perhaps people will see that there's not much there and not bid for it.  Perhaps someone likes the idea behind it and is willing to buy on that.

My idea, in any case, is to keep working on it as the auction progresses.  As an additional twist, there are obviously a lot of features that could be added to the site, so I'll prioritize work on features suggested by users who have bid on the site.  Here's the auction listing on Flippa.com:

www.underperformingstocks.com is For Sale on Flippa!

Edit: I'll also be posting updates to the twitter account I created for the project: http://twitter.com/#!/underpstocks

The Kindle and Book Sharing

I'm very pleased with the Kindle; all of a sudden, I can quickly, easily, and fairly cheaply buy lots of English language books that otherwise I would have had to order (not cheap, not quick).  Furthermore, they're not cluttering up my house, either!  Not that I view books as clutter, but sooner or later we're going to have to move out of the apartment we're in, and the less I have to haul around, the better.

However, the fact that it's not easy to share the books with my wife is starting to annoy me.  I could always give her the Kindle itself to read something, but that would deprive me of not only that book, but all the others I have as well.  Indeed, the difficulty of the problem lies in the difference between digital goods and physical goods.

Real books are:

  • "Rivalrous": if you're reading it right now, I can't very easily read it myself.  Copying the book would be slow and tedious even with a good photocopier, and the copy likely wouldn't be as pleasant to read.
  • "Excludable": it's pretty well established that you can't just walk out of a book store with the book without paying for it.  Libraries are something of an exception to this rule, but there are limitations there as well.
  • Relatively cheap to produce, in terms of marginal costs, but those costs are still certainly not zero.

Ebooks are:

  • Non-rivalrous: well, without "digital rights management" or DRM, they would be.  You could make as many copies as you wanted without the original copy losing anything, or without the copies being in any way 'less' than the original.
  • Excludable only because of DRM.  Once a DRM-free version is out there, it's very difficult to keep only paying customers from getting their hands on it.
  • Have virtuall zero marginal costs: copying an ebook is extremely cheap in terms of resources.

Setting aside the costs and benefits to society of DRM, intellectual property, and so on, let's take the point of view of Amazon, book publishers and authors, who all want to maximize their income, and of readers, who want as much freedom as possible, and also, for the sake of argument, believe that paying for books leads to more money for authors, which leads to more books.

I think the trick is to try and make the ebook market as similar as possible to that for real books.  For instance, if you had the freedom to resell an ebook quickly and easily, the price would likely start dropping quickly, as people started selling their "used" copies of books they didn't want to keep.  This would be good for the consumer, but potentially quite bad for authors, as fewer new copies would be sold.   Sure, we have used book stores, but the practical limitations involved, and the fact that real books show some wear and tear, mean that there's still an incentive to buy new books.  On the other hand, an ebook ought to be a bit cheaper than a real book if it's something you'd consider reading and then selling, because you no longer have that option, so the lack of freedom should be priced in to the original price.

The other problem they seem to be having is with the lending of books.   If you lend a real book, you can only lend it to someone who you see with some frequency, so there's already a big geographical limitation.  Also, while they're reading it, you obviously can't.  You have to have some trust in them, that they'll give it back to you sooner or later, so you won't just loan it to anyone: if you wanted a transaction with more finality, you'd simply sell it.  Currently, Kindle books can only be lent for two weeks, and you can't access it while the other person has it.  I think the latter part of that is fair, but two weeks seems like an arbitrary number.  Remember though, that they don't want you to be able to just give someone a book, with no strings attached and no return-by date, because then you could also sell it, undercutting their store prices, and so on, as above.  So to make lending work, they have to have some "strings attached".  I think "two weeks" is a fairly arbitrary string though. 

What would work better?  Perhaps a way that permanently differentiates the original purchaser from anyone borrowing it.  For instance, a "recall now" button?  This button would, when the original purchaser pressed it, disable it on the borrower's device and reenable it on the buyer's device.  This would prevent secondary markets, or at least limit them, because the 'borrowed' books would be inferior to the originals.  And yet it might still work well for lending; I could lend books to people who trust me without problems.

Interestingly, I became aware of this site the other day: http://www.kindlelendingclub.com/ so it looks like whatever Amazon does, there are going to be tradeoffs involved.

And of course, there is the point of view that all of the costs involved by DRM are too high, but that's a fairly involved discussion in its own right.

What do you think?

Do More Faster: TechStars Lessons to Accelerate Your Startup

I got this to read on my trip to Oregon.  Initially I was a bit dubious, after reading the chapter headings on Amazon.  Indeed, if you read a lot of articles about tech startups, a lot of the material is not particularly novel, and are things that you've already read elsewhere.  If, on the other hand, you're looking for a quick introduction to some of the common ideas behind web/tech startups, it's a pretty good list, written by a variety of people, with a lot of practical advice.  The list of concepts includes "execution, not ideas", "fail fast", get feedback early", "get a co-founder", and a lot of similar advice that permeates discussions of early stage internet companies.

Other people have different tastes, but for me, this passage was a strikingly effective advertisement for living in Boulder, Colorado:

With this as the backdrop, it was natural to make cycling a central part of my work with Everlater's founders, Nate Abbott and Natty Zola. Nate, Natty, and I scheduled regular weekly rides (sometimes several times a week) and while we didn't keep a formal agenda, each ride had a number of topics planned out for us to cover. In this way, we worked through many of the early challenges the business faced as it moved from idea to reality in the course of the summer of 2009. Our typical rides lasted from 60 to 90 minutes during which time we were able to focus on the business without interruption. And while getting some fresh air helps bring perspective, it's hard to avoid thinking about problems in a new way when you're out of the office, surrounded by the beauty of the Boulder foothills while your mind is completely clear.

Startups, cycling, mountains… sign me up!

Another tidbit I found interesting:

We often talk about the Number One startup killer at TechStars—making a product for which there is no interesting market. TechStars accepts just 10 of more than 600 startups that apply and presumably they are among the best. But still, we find that at least one-third of those startups are attempting to build a product that they want, or that no one wants, instead of what the market wants

But wait, I thought "execution is everything", and "ideas are worthless".  It seems like avoiding bad ideas is potentially worth a whole lot of money in wasted time and energy though, no?

The bit about ideas being worthless is a load of crap.  The reason there is no market for ideas is that they are not "excludable".  There was never a market for lighthouses either, the classic example in economics of a public good.  So the government built them, and they were valuable to people operating ships.   Ideas for startups may not have a lot of value compared to people executing them well, but to say they are worthless is hyperbole.

In any case, though, if you're interested in startups, or especially if you happen to be interested in the TechStars program, it's book full of good advice, even if none of it will come as a revalation to anyone who follows that sort of thing regularly.

Rails 3

As a test project, I updated linuxsi.com (in Italian) to Rails 3.  So far, I am not terribly impressed.  It's nice enough, but the upgrade process was quite painful – there's a lot involved in upgrading even such a relatively simple site.

Rails remains the best thing out there, as far as I can tell, in terms of programmer productivity for web projects, but at times it seems like there's a lot of taillight chasing.  Upgrade this. Move to this newer, fancier, shinier system.  Replace that.  Sure, I suppose you can always stick with older versions, but it seems that that is a recipe for simply postponing all of the changes until a later date, when they become even more onerous.  And Ruby gems don't really seem to have a mechanism to separate updates with new features from security updates, so for some things staying with older versions might be a security risk.  And stuff like plugins mostly just sits there where you dumped it into your project, without any real sense of an upgrade path.

I suppose I'm being a bit of a Grumpy Old Man, but at times the changes feel a bit gratuitous, and with all the breakage that Rails 3 causes, I would caution against upgrading to it for existing projects – use it for new projects to learn it.  In some ways it seems to be a Ruby web framework that happens to have some compatibility with Rails.  But not 99% – more like 80%, so that you'll spend 80% of your time upgrading that 20%.

As one particular example, if you look at the original rails screencast, he uses <%= form_tag, with the "=".  Subsequent versions of Rails dropped that, so you'd do <% form_tag …. do …  and now, with Rails 3, we're back to <%= form_tag, with the "=" again.  Hrmph!

Hopefully, with a bit of time, I'll see some of the nicer aspects of Rails 3.

Kindle thoughts

I went ahead and got myself a Kindle for my birthday.  Thanks to everyone for their comments in the last post.  Here are my thoughts on it, in no particular order:


I like it a lot.  I was worried that I would not actually enjoy reading with it, or that it would be significantly inferior to real books.  However, I do enjoy reading with it, and I think they have achieved their aim of making it so that it 'just disappears' like a good book does.  It's a very small and light device, even with the leather cover I got for it (always best with a small child in the house), so it's in no way heavy or uncomfortable.  It's relatively more expensive and fragile than a copy of The Economist or a paperback, so I don't sling it around quite so casually, and do try and remember to keep it out of reach of said small child, which makes it a little less worry-free than an actual book.  On the other hand, it's much cheaper than an ipad or samsung galaxy or something like that, so it's not the end of the world if something happens to it, although it would be unfortunate to be without reading material for the time it took to replace it!


The selection of material available for it is ok, but I'm just a bit disappointed – I thought offhand there were more books than there are.  I regularly bump into things I might consider getting if they were available for it, but are not.  On the other hand, there are quite a few books available for it for *free* because they're old and out of copyright.  Stuff you might get for 99 cents at a used book store as a paperback, but it's pretty cool to be able to just zip it right to the device, for nothing at all.

I am not convinced that the economics of it all has settled down yet.  It's pretty absurd, for instance, that The Intelligent Investor costs nearly twice as much for the Kindle version as for the paperback!  Especially since I can never resell it.

I think a lot of the value I get from the device is derived from my situation: living abroad here in Italy, it's expensive and slow to get English language books, and now I can get them *instantly*, which is absolutely wonderful, and will significantly increase my reading.  Also, should we ever move back to the US or elsewhere, it means a few less books to lug along or go through the sorrow of parting with.  Were I in the US in a place with a decent used book store, and sure about staying in the same place for a while, I am not sure I would have bothered.

I find it somehow a bit monotonous to read everything in the same form factor and with the same fonts.  It takes something away from the character of a book, especially a well-done hardback.  Of course, what counts is the content, but the presentation counts for something too, I think.

I really do like the size and shape of the Kindle, and could see the 'smaller tablet' size catching on.  Speaking of which, I'm curious to see how reading devices and tables will intersect.  Clearly, a generic device that can also read books is going to be a lot more popular, but for now e-ink still has a few advantages: it's better for reading – I can stare at it much longer than I can at an LCD screen; also the battery life is much better, meaning I don't have to worry about/fiddle with charging it every day.  Also, in some ways, it's nice not to have the siren-call of the web just a click away…  I think though that at some point, generic devices will likely overtake dedicated readers.  Who knows when, though.


Yes, it does have a browser, however, the screen refresh is so slow that I'd only really consider using it for reading web pages – wikipedia, say, rather than doing much with it.  Still, I think it's nice to have and hope they continue the experiment.


Coming back to the comparison with 'real' books, I don't like the fact that I can no longer finish a book and then hand it to my wife if it's good.  We could get her a Kindle too, but I'm still not sure they have the sharing thing worked out that well.  2 weeks – and then what?  One way to do it might be that you can share it with anyone who you trust with one-click purchases.  That'd limit it to family members or really trustworthy friends.  Although… even there, I regularly loan books to friends, and would like to continue to be able to do so.

Also, like I mentioned in the previous article, I'm leary of a future where my daughter doesn't have a multitude of books to peruse on our bookshelves.  Bookshelves are a great way of making serendipitous discoveries that recommendation engines (those I've used at least) don't really account for.

All in all, I'm very pleased with the Kindle, though, and look forward to seeing what the future holds.