9/19/2013

How to fix "Could not find or load main class org.apache.cassandra.tools.NodeCmd"

After upgrading Cassandra from 1.2.9 to 2.0 and Java from 1.6 to 1.7 (because Cassandra 2.0 does not work with Java 1.6 anymore), I got the following error while running nodetool: Could not find or load main class org.apache.cassandra.tools.NodeCmd
I could not find anything so here is a quick fix: nano `which nodetool`
/* replace */
for include in "`dirname "$0"`/cassandra.in.sh" \
/* with */
for include in "$HOME/.cassandra.in.sh" \

And then nodetool should work like a charm.

Update: The same trick works when cassandra-cli throws Error: Could not find or load main class org.apache.cassandra.cli.CliMain
9/17/2013

RedisTree - load & save Trees to Redis using sets

Today I answered this question on Stackoverflow on Getting hierchical data from redis with node.js. What was interesting with this one was that the implementation had to use Redis Set to build and save a tree. RedisTree offers an asynchronous implementation for storing and loading trees from Redis.

Usage


Tree format


Try it!

npm install redistree

... or view it on Github

9/10/2013

How I "hijacked" Topsy private search api to remove my first 5000+ tweets

[Update] This article was only a proof of concept oriented towards developers. Please don't ask for help in order to use this script because it may not work at all.


When my cofounder at Bringr told me that Topsy new search engine was able to look at every tweet published since 2006 I immediately tried to search my username to see my first tweets.

What a horrible sight, my first tweets from 2007 were disastrous, both in grammar and in content. In France, we like to think that we believe in what I would translate as the right to be forgotten (Le droit à l'oubli), in short it's the right be protected from search engine indexing things we posted years ago. Because sometimes we publish things online that we'll regret some years later (just look at all those kids that share too much of their personal lives on Twitter or Facebook).

So while I was playing with Topsy, I looked at the network exchange and discovered Topsy own search api.

Topsy private api
The endpoint:

http://otter.topsy.com/search.js?q={query}&offset=10&perpage={10-5000+}&window=a&sort_method=-date&apikey={apikey}

What's awesome about this endpoint is that perpage parameter allows to request more than 5000 tweets with just one call! I quickly wrote a (Java)Script (got it?) to download all those tweets and remove each one of them thanks to Twitter API own API. And it worked.

As usual the script is available on Github. Just edit the config.js file and run it. You'll need to create your own Twitter application and copy/paste your consumer_key/secret and access_token/secret.

Since Topsy does not require a login I wonder if they use the same apikey for everyone, don't hesitate to post your own observation on this matter!

git clone git@github.com:FGRibreau/twitterremover.git
cd twitterremover
npm install
vim config.js
node destroyThemAll


Oh, one last thing, because it's a private API you have no guarantee that this endpoint will work forever so don't build anything serious on it :).

Thanks for reading that far! If you liked it you may like what I share on

NB: Another way to achieve the same result would be to request a Twitter archive and then write a script to read it... but that would take all the fun away!
9/02/2013

How to make Play Framework 2 work with Supervisord and Monit

Let say you just developed an application called myapp with Play Framework 2. The application is located in /dir/to/myapp
Before going further run play clean compile stage to build the app production jar, then configure supervisord and monit like so
... et voila!

NB: Out of the box Play! will create a RUNNING_PID file into myapp/ but of course you can change its location with -Dpidfile.path.
« »
 
 
Made with on a hot august night.
http://bit.ly/1II1u5L