Redis: Migrate Keys From One Instance To Another Based On Pattern Matching [node.js script]

If you work with Redis and a fairly big dataset it’s pretty likely that, at some point, you’re going to fill up all your RAM. This already happened to me more than once with; the easy fix, if the growth is slow enough, is to just add more memory.

Simpsons_Duff_Lite_DryWhen that doesn’t work anymore, the next move – while waiting for Redis cluster – is quite likely going to be using some manual sharding technique. When you do, you’ll probably going to need to split your dataset among more instances.

This is exactly what just happened to me, and I didn’t find any ready recipe or solution to easily split my rather large dataset. So I ended up creating a small node.js script which doesn’t use too much memory and that you can find here:


Facebook Hashtags: When Monetization Clashes With Branding

Considering that my startup CyBranding owns a thriving website named and sells a product called Hashtag Intelligence, you could easily see why hashtags (probably) coming to Facebook is very good news for me. But, as a person very interested in branding, I can’t help questioning this move from the Facebook brand point of view.

For its users, Facebook’s core expectation can be described as “easily sharing with friends and family through the Internet”. It is a very compelling expectation, Facebook owns it in the mind of billions of people, and thus their website has become the most engaging in the World as all the stats about time spent online tell us.

Facebook’s problem is that its core expectation isn’t as easy to monetize with advertising as, for example, Google’s “quickly finding what I need on the Internet”. Or even Twitter’s “publicly sharing on the Internet”, which is much less compelling than Facebook’s to most people, but which has that “publicly” attribute that makes it much more compatible with infotainment and advertising.

Facebook already took many steps towards making itself a better platform for the public sharing and consuming of content – think pages, “follow”, privacy changes, etc. – so adding hashtags, that were integral to Twitter’s success in that space, would only be a logical move in that same direction. The big risk for Facebook here is that this move could actually work – and, if it will work, it will also significantly dilute Facebook’s brand expectation of “sharing with friends”.

Why is that a big risk? Because public and personal don’t mix well; by diluting its core expectation, Facebook would leave the door open to some competitor completely focused on “personal”. This move could very well bring a short and medium-term benefit to Facebook’s bottom line and market capitalization, but, by putting in jeopardy its nearly complete domination of its current, incredibly compelling focus on “friends and family”, it could also sow the seed of its own undoing.

The good news? After all, if the history of branding has something to teach us, Facebook is most likely not going to “become the Internet”, closing us all inside a walled garden. In the world of brands, you just can’t be everything to everybody.

[UPDATE] I just read an article on Time about the “tragic beauty of google“, where the author says that he likes Facebook more because it feels more “warm, personal”. Will it still feel that way if the move toward more public conversations will work?

A Little Cross-Platform Productivity Boost

Sometime it is difficult to concentrate on the task at hand – especially if you are almost always at work, with a day job and a startup on the side. At those times, I find it particularly difficult to resist the temptation to compulsively wander to some interesting websites, like Hacker News or some other online news source.

I already had a little Windows software installed to block a list of distracting websites for a given time when I need it, but I often code on Linux and that program doesn’t work there. That’s how I came across Concentrate for Chrome, a Chrome extension that does that same thing – but works equally well on Windows and Chrome.

If you’re like me, and sometimes being a news-aholic interferes with your being a workaholic, this extension is highly recommended!

Are “Shameless Plugs” Worth It? Some data

I recently published two posts that reached the home page of Hacker News: The first one was the announcement of my ABalytics library for client-side A/B testing; the second one was about a new version Hacker News: Mark All Read, a Chrome extension I wrote to save time on HN.

Both posts are about little projects that I originally built for my own use, and then polished, published and open sourced to give back to the community… and to get some publicity; specifically, with these two posts, I wanted to promote this new blog and the fact that I’m now open for consulting as a way to finance my startup project(s). With the post about ABalytics I didn’t include any direct reference to those other news: I just relied on the curiosity of visitors, and the prominent “Consulting” and “Portfolio” links in the blog menu.

These were the results:

In short, only 0.3% of visitors went on to read about me, and 0.16% read my “Consulting” page.

On the contrary, I ended the post about HNMarkAllRead with a “Shameless Plug” section, detailing the fact that I’m open for consulting projects. This is what happened:

This time, 3% of those who read the post also read my Consulting page – which was directly linked in the post – and 0.4% went on to read the About page. That’s a tenfold increase in clickthrough rate; something that could be expected, considering how much more prominent the link was, but it’s good to have some solid data about it.

And what about the downsides?

That’s very difficult to determine, at least with just two data points. I didn’t have any bad reactions or comments, but there was one possibly alarming sign. The ABalytics post had many less uniques, because it was picked up in the HN home page an hour later than it was posted to HN, and so it never went near the top of the page, but it generated many more social media shares than the other post: 171 (between Twitter, G+, LinkedIn and FB) to 73; that’s a 3.8% vs 0.6% “social media conversion rate” in favor of the post without the plug.

How much was this very big difference in social media reactions a consequence of me being shameless at the end of the post? With just these two data points, it would be impossible to tell – the posts are about very different things. But back in May I published the first announcement of Hacker News: Mark All Read, and – even if I later moved the post from another blog to this one – I was able to recover at least the Twitter shares data for an apple to apple comparison.

That first announcement generated 39 tweets, out of 8,986 uniques: 0,42%. Considering just the Twitter reactions to the latest post – the one with the plug – the rate is 0,49%. No noticeable change caused by my being shameless.

So, the bottom lines is: If what you want is to get your portfolio in front of your blog readers, closing your posts with a shameless plug looks definitely worth it (at least according to this very little sample). After all, the readers are getting your content for free, it’s only fair that they cut you some slack :)

Save Even More Time On Hacker News

Some months ago I published a Chrome extension I had developed for myself to save time on HN; it allowed you to “mark as read” the news items that you already read or scanned.

The Chrome store tells me that 770 users are using it weekly, so I decided to take the time to update it with some more features that I’ve been experimenting with lately and found very useful.

Mark comments as read

The new feature I found most useful is the ability to also mark comments as read.

Using the orange button, you can mark all comments in the page as read. If you do so, those comments will appear with a slightly darker background, so when you reload the page you can easily spot the new ones – I found this a real time saver!

If you want to find the new comments even faster, you can check the “Hide read comments” option. This mode can be a little confusing, as you lose the context for the comment, but sometimes I found it useful anyway.

Follow comments for a news item

Sometimes, even if you already read an item and its comments, you want to follow the discussion as it develops, or be notified if a discussion starts at all. Instead of just leaving the comments page open, you can now tick the “Follow comments” checkbox (see picture above); when you do so, the news item will be shown in the home page even if it was marked as read and you are hiding read items.

Most importantly, if there are new comments since you marked all comments as read for that item, that will be shown with a green text in the home page. This can also be a good time saver – if you resist the urge to follow too many discussions, at least.

Collapse comment threads

This is a pretty obvious feature, but it helped me save time when, for example, the first comment for an item is something contentious that generated a long thread I’m not interested in. Just click the little “-” symbol to the left of the root of the thread, and the thread will collapse.

You can also collapse all thread with the “‐‐” to the left of the “Follow comments” checkbox. “+” and “++”, of course, will respectively expand one thread and all threads.

Show parent comment

I left the fanciest feature last; I don’t use it very often, but when I do I find it incredibly useful.

I like threaded comments, but sometimes you just get lost in them: You read a long sub-thread, then you find a comment answering something, but you can’t understand what it’s answering to. How can you find that out? Enters “show parent”.

With this feature, when a comment is part of a thread, but not the first answer to its parent, a “show parent” link appears. You can hover your mouse pointer on that link, and the mysterious parent is shown right above it. I really like this solution because it is non-intrusive and (in my opinion) solves a real pain of threaded comments. The only serious limitation I see is that it wouldn’t work well on touch screens, but if somebody wants to adopt it for that use case, it could become a touch-to-toggle.

Wow! How much do I need to pay for all this?

Nothing! You can get the extension for free from the Chrome store.

Other browsers? It’s open source

I packaged this as a Chrome extension because it’s just too convenient. If you want to use it on some other browsers, though, you’re free to get the source code on github and adapt it any way you want. Happy hacking!

Shameless plug

Did you like this project? Do you need somebody to help you develop your web app or idea? I just started to be open for consulting projects. If you need an expert at translating ideas into software solutions, from requirements analysis to full stack development, check out what I could do for you here.

ABalytics.js: Client-side A/B Testing With Google Analytics

I recently wanted to conduct a little bit of A/B testing on a project of mine, so I went exploring – yet again – the free options.

There are lots of very good server-side solutions, but what I wanted was one that I didn’t need to configure on the server, and that could be integrated into Google Analytics, where I already track my websites performances. I found on the web some how-tos about the use of GA custom variables for A/B testing, but no ready-made libraries to do so.

So I created my own javascript library; it is so simple that I decided to implement it without any external dependencies, so that if in the future I want to use it without jQuery (which I usually use) I’ll be able to do so. And it is so simple that it was easy to give a minimum polishing and make it ready to publish, to give it back to the community.

These are the main features:

  • Easy to set up
    • You just list the possible variants, the randomization is handled automatically
    • You just mark the html elements you want to test on with a class, the substitution is automatic
    • No need to set anything up server side, all the results are stored on Google Analytics
  • Consistent user experience: The selected variant is stored in a cookie, so the user will see the same one when coming back
  • No external dependencies: Pure javascript, you just need to include GA
  • Flexible: You can conduct multiple, independent experiments at the same time. Each experiment will use a custom variable slot

I’m releasing the library with an MIT license, and you can find it – with basic instructions on how to use it – on Github. Enjoy!

A new home for my technical, startup-related, and personal posts

A little more than one year ago I started a blog about my then-latest website, Soon after launching it, I started publishing more and more posts that weren’t directly related to that website, but more about technical and startup-related subjects in general.

That arrangement didn’t feel the best to me, so I decided to split that blog in two, moving all not-hashtagify related posts to a new personal blog, the one you’re reading now. That’s why you might find here some posts that you already read elsewhere: This one is the first post I published directly on, and all older ones come from

So, if you get that weird deja-vu sensation while reading some older post here, don’t worry: It’s perfectly normal to feel that way while you’re caught right in the middle of a reconfiguration of the Matrix!

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.