Is the EU too big as a startup ecosystem?

The other day I attended an event in Rome where Greg Horowitt discussed how the Rainforest model for fostering a healthy startup ecosystem could apply to Italy. It was a fairly interesting presentation and discussion, but I was a little disappointed by the lack of any reference to the bigger European context (and market).

Curious to know if this was just because the organizers were only interested in the Italian specific case – the conference title was “The Italian Rainforest” – or for other, more profound reasons, I asked Horowitt what he thought about a possible “EU-wide rainforest”.

His answer was that, above a certain size, the transaction costs become too big for an ecosystem to work, and that the EU was, in his opinion, above that size. I then asked about Italy’s size: the Italian population is 1.5 times that of California, and around 20 times that of Silicon Valley+San Francisco. During the conference Horowitt had said that the very different Italian regions should work to create their own ecosystems to leverage their different strengths, but his answer was that in Italy’s case it would make sense to work for an Italian rainforest.

This made me think. The 27-states European Union is home to 500 million people. Obviously, the EU could never be the “Next Silicon Valley” – just like the whole USA couldn’t be a “Silicon Valley”. But would the transaction costs really be too high? Are the problems that startups in the different EU states have to face so much different? Wouldn’t it help if we started thinking in terms of a EU startup ecosystem, thus creating a cross-pollination of experiences, solutions, talents – and, why not, some EU level lobbying?

I don’t have a definitive answer yet. But, from the many discussions I follow about EU startups, I see a lot of common problems, and the transaction costs are getting lower every day: At least among innovative startups throughout Europe, English is already the lingua franca; we have very cheap and frequent flights connecting most of the EU; Internet communication options are getting better and better every day; regulations are converging more and more.

And, most important of all, only at the EU level our startups could have a home market able to rival in size the one US startups have privileged access to, with all the advantages in terms of economies of scale and publicity this brings. No matter how well we develop our national ecosystems, no single EU nation could create one that could compare in size not just to the US, but also to China, Japan, and soon India, Russia and Brasil.

So, no matter how difficult it could be, and even if there are no guarantees that a EU rainforest could work, EU startups should start thinking at a EU level, and at least try to find ways to turn the EU single market, and the EU common institutions, to their advantage. The only alternatives are to settle for also-ran ecosystems, or move to the US.

I thank Horowitt very much for the insights he shared with us and for taking the time to answer me, but I hope EU startups will prove him wrong.

Never get lost in Hacker News threaded comments again

Did you ever get lost in HN threaded comments, unable to understand which parent a comment was answering to? This happens a lot to me, especially when threads become long… and most interesting.

Being appreciative of threaded comment systems in general, many times I wondered if there was a simple solution to that problem. Comments folding is useful, but it answers a different problem. But what if you could just visualize the parent a given comment was answering to, without having to scroll up and down all the time?

Having some time on my hands, I created a Chrome extension to do just that. Install it and, when a comment is answering to a parent that isn’t right above, a “show parent” menu item will appear. Hover your mouse pointer over it and the parent comment will be shown right above the child.

This is a feature I would have liked to see in threaded comment systems for a long time, but never saw it before (maybe I just didn’t pay enough attention). Hope I’m not the only one to find it useful!

PS: You might also be interested in my other little HN Chrome extension, Hacker News: Mark All Read.

Hacker News: Mark All Read Source Code Released

TL;DR: I just released under an MIT license the source code of the Hacker News: Mark All Read Chrome extension. You can find the code on github.

Background: I often thought about open sourcing many of the little projects I create from time to time, but until now I never went on with it. The reason: I’ve got pretty strong perfectionist tendencies against which I’m always struggling, and releasing unpolished code that I’ve quickly hacked up to solve some practical little problem doesn’t bode well with those tendencies.

But with this one I got many feature requests that I already know I won’t have time to implement. So I decided to publish the code anyway and see what happens. Just consider it what it is: A quick hack I created in one afternoon, and polished just a little bit the day after. Have fun with it!

PS: I thought about it and decided not to release the “artwork”, because having more extensions on the Chrome market with the same look would be confusing. The extension works anyway as it is, but if you add a button icon in an “images” folder it will look better.

To discuss on HN: link

Save Time On Hacker News: Mark All Read

Hacker News is and incredibly useful resource for hackers and startuppers. In true hacker style, its usability is pretty basic though.

In the myriad of widgets and extensions that hackers created to improve that usability, I’ve never find the one I wanted most: An optimal way to know which titles I already scanned and didn’t find interesting enough to open. So that, when I reload the home page, I don’t have to scan them again.

This is why I created Hacker News: Mark All Read. It is a (free) Chrome extension that solves exactly that problem, in a very simple way: After you scanned all the titles, you can click the “mark all read” button, and all news items will appear as if you visited the link.

This way, when you reload the page, you can immediately see what is new. It works across different pages (home, new submissions, second page etc.). And you can hide the news you marked as read, for super-fast scanning of the new news.

You can install the extension from the Chrome web store. If you have any comment… please do comment :)

Update: I also released the source code.

OpenVZ howto addendum: Migrating your virtual machines to a new server

As I wrote some time ago, creating your own OpenVZ infrastructure is very easy, and it can save you a lot of money compared to the usual VPS providers. But it also has other advantages.

Hashtagify uses redis to store all its data in memory, which is great for performance, but… it requires a lot of RAM. So it happened that I almost finished my 24GB, right when I learned about a new great offer for a 32GB server which costs 33% less than my 24GB one. Moving to it means that I’m going to get back my 150€ of activation costs in just 5 months, while at the same time having 8GB more. Great!

This is why I bought a new server and decided to move all my virtual machines to it from the old one. It turned out to be quite easy, but I had to find the instructions in different places, so I’ll post here how I did it for both my future reference and for anybody else having the same problem.

First of all, you have to install OpenVZ: I did it just following my previous howto.

Then, you can migrate your machines. I thought I would need to back them up and then restore them in the new server, but I found out there is a more direct and much faster way to do it: The vzmigrate command.

To use it, you first need to enable password-less ssh login from the old server to the new one (this is because vzmigrate uses the ssh protocol to move the files). First, generate your public and private keys if you didn’t already:

ssh-keygen -t rsa

It is important that you create it with no passphrase. Then, move the public key to your new server, like this:

scp /root/.ssh/id_rsa.pub root@XX.XX.XX.XX:./id_rsa.pub

Now log into the new server and do

cd .ssh/
touch authorized_keys2
chmod 600 authorized_keys2
cat ../id_rsa.pub >> authorized_keys2
rm ../id_rsa.pub

After this, in the old server check that everything is ok with:

ssh -2 -v root@XX.XX.XX.XX

If everything is ok, you whould be logged in without being asked for a password. You can log out

exit

and start migrating your machines. For each machine, for example the one with id 101, you do:

vzmigrate -r no XX.XX.XX.XX 101

This will take a pretty long time, depending on how big the virtual machine and how fast the net between the two servers are. There is no progress indicator, but you can get an idea how it is proceeding by checking the original size of the machine and the size of the copied one, by using the command

du -hs /vz/private/101

on the old and the new server respectively (this of course only if you mapped the openvz data directory to /vz as shown in the original howto.

When the command finishes, the new machine is ready… but only if you could move the VM IP from the old to the new server. In my case that wasn’t possible, so I had to ask for new IPs on the new server. You can assign the new IP, and remove the old one, like this:

vzctl set 101 –ipadd NEW.NEW.NEW.NEW –save
vzctl set 101 –ipdel OLD.OLD.OLD.OLD –save

So, now you’re really good to go:

vzctl start 101

And that’s it!

Cheers

Update CSS rules with 5 lines of CoffeeScript

I recently (ie, today) had to find a way to update a CSS rule dynamically in javascript. jQuery, my library of choice, doesn’t offer this functionality – and I really wonder why – so I looked around a little and found how to do it with plain javascript.

As I’m actually using CoffeeScript, I decided to rewrite it in that language and make it a generic function; it could be useful to others, so, there you go:

@updateCSS = (selector, styles) ->
  for sheet in document.styleSheets
      for rule in sheet.cssRules || sheet.rules || []
        if rule.selectorText == selector
          for style, value of styles
            rule.style[style] = value

You can also find an usage example (and play with it yourself) on jsfiddle. Enjoy :)

The European Tech Scene in Blogging

I’ve been too focused on my work on hashtagify pro lately – the first beta isn’t far, by the way – to notice it when it came out, but this article about the European tech blogging scene is very interesting.

The long and the short of it is that we in Europe should blog more in English, to make it easier to create a European tech community and a more interesting scene to report on. Incidentally, that’s why I started blogging in English for hashtagify, so I just have to agree. I’m also seeing more conversations in English between Europeans, eg on Google+, so I hope we’re headed in the right direction.

Writing in English isn’t as easy as I’d like it to be, but the good signals – both those cited in the article, and those which I can see for myself – make me even more resolute. Let’s all keep our efforts up.

Is the open source/internet singularity coming?

Many have heard about the idea, popularized by Ray Kurzweil, that a technological singularity is coming. In a nutshell, the idea is that as the power of computers is growing exponentially, at some point it will bring about an artificial intelligence that will overtake human intelligence, reinforce itself and change everything beyond any (human) imagination.

I personally don’t believe that the creation of an AI able to compete (let alone surpass) with human intelligence is near at all. But while working on my latest web project, I noticed just how easier it has become to create incredibly powerful and attractive new software than just a few years ago. And all this thanks to Open Source and the internet.

Increasingly, we see amazing new software libraries, frameworks, programming environments being released as (Free) Open Source on the internet. This makes it progressively easier for other people, even solo developers working from home in their free time, to create great software, and often give something back to the Open Source community.

Not just that; the internet is making it easier and easier to find the best new pieces of software, to get answers to the most difficult programming questions, to circulate ideas and to publish the end results of it all. And to bring this all to even the most isolated programmers, in the remotest parts of the world.

Isn’t this all it’s needed to create an exponential growth of software innovation? I guess it is. And I don’t know what this will bring about, but it is a fact that information technology is disrupting lots of industries, with consequences that are harder and harder to predict – as unfortunately the current economic crisis is showing.

I don’t know if this could be the real technological singularity, even without artificial intelligence in the mix, but it could come damn close.

Javascript async testing tutorial: Jasmine + Rails 3.1 + Coffeescript

I recently wanted to create automated testing for coffeescript code in Rails 3.1, including some async (ajax) code. I had to dig around quite a lot, so I’m writing here what I ended up doing for future reference for myself and others who might need it.

There are many test frameworks for javascript, and the one I chose is Jasmine. Reason why: It is one of the two most used frameworks, and the other one is dependent on jQuery. I’m using jQuery in this project, but I’ll be able to use Jasmine for future projects without jQuery too, so I chose it – I also like its syntax.

You can integrate Jasmin in Rails 3.1 yourself just using the Jasmine gem, but to simplify things with Coffeescript I decided to use a specific gem for the latest version of Rails and its assets pipeline. I couldn’t really choose between test_track and jasminerice, which are both very young, so I went with the first one just based on intuition. Using the other one shouldn’t be very different.

So, I added to my gemfile:

gem "jasmine"

gem "test_track"

and installed the new gems with “bundle”

I then created a spec/javascripts and spec/javascripts/helpers folder in the project tree. As I wanted to be able to easily test jQuery, I downloaded jasmine-jquery.js from github and copied it into spec/javascripts/helpers.

At this point I created the following jasmine.js file om spec/javascripts:

// SUITE :: Jasmine
// SUITE MANIFEST :: spec/javascripts/jasmine.js
// TEST SRC DIR :: spec/javascripts
//
//= require helpers/jasmine-jquery
//
//= require JsonDataSpec

JsonDataSpec is the coffeescript spec file that I was going to create and that will be executed in the test. See the following example

spec/javascripts/JsonDataSpec.js.coffee:

describe "JsonData", ->
  it 'should should have the correct format', ->
    answer = null
    $.getJSON(
      "/controller/get_my_data/",
      (data) ->
        answer = data
    )

    waitsFor ->
      answer

    runs ->
      expect(typeof answer.string).toEqual('string')
      expect(typeof answer.number).toEqual('number')

The secret here is waitsFor -> answer, which will wait until the answer variable gets a non null value – that is, when the ajax call is complete. Only after that the actual test is run.

Last thing, I configured the test_track engine adding this code to routes.rb:

mount TestTrack::Engine => "test"

And that’s it! To use my tests, I just run the server using rails s and access the tests opening http://localhost:3000/test/jasmine in the browser. Smooth and easy.

Happy testing!

Bootstrapping hashtagify pro: How I doubled my workweek productivity

Creating a startup while working a full time job has its pros and cons. Among the pros, you don’t have to use a lot of your time minding your investors (or looking for them), and you can devote your energies to just make the best possible product. Among the cons, progress is slower and it is very difficult to be productive on workdays, when you already spend 8 hours or more on your day job.

But a week ago I read a comment on HN (edit: thanks to raju in the comments for pointing me to the exact link) that inspired me to rethink how I’m organizing myself , and with one simple change I doubled my productivity on workdays. How? Instead of working on hashtagify at nights, after getting home from my day job, I’m starting my day two hours earlier, and doing 2 hours of programming in the morning, before going to work.

I’m usually a night person, and have always been very productive at nights, since when I was just a student. But after eight hours of work, it is difficult to have that kind of focus that you need to program, and the two (or two and a half) hours in the morning have been much more productive than the equivalent time in the evening.

After coming home I still do some lighter work, and don’t go to bed without having scheduled a task to do the next morning; this way when I wake up I don’t have to think what to do and I can be immediately productive.

So, the bottom line is that work on hashtagify pro is proceeding very well: now I’m making as much progress during the workweek as I usually make during weekends, while before I only made major progress outside workdays. This means that soon enough I’ll be able to release the first beta. Stay tuned!