CherryPy and SQLite

Posted: February 20, 2016 in python

I was kind of curious abot how difficult could be to implement a small app with sqlite3 and cherrypy with python of course.

So basically the idea was to get some information from a sqlite database and get a response through a cherrypy exposed method.

The code of this example:

Really easy.


Installing Cylon

Posted: June 19, 2015 in Uncategorized

carlos@carlos-lap:~/Drones/cylon$ ls
carlos@carlos-lap:~/Drones/cylon$ npm --version
carlos@carlos-lap:~/Drones/cylon$ npm install cylon
cylon@1.0.0 node_modules/cylon
└── async@0.9.0
carlos@carlos-lap:~/Drones/cylon$ npm install cylon-ardrone cylon-gpio cylon-i2c
cylon-gpio@0.25.0 node_modules/cylon-gpio

cylon-i2c@0.21.3 node_modules/cylon-i2c

cylon-ardrone@0.19.0 node_modules/cylon-ardrone
└── ar-drone@0.3.3 (simple-debug@1.1.2, buffy@0.0.4)


Gif animation in Android

Posted: May 22, 2015 in Android

After searching some post about how to implement a gif animation in Android my solution goes here:

Seems that my template doesn’t fix well with gist, so here’s an alternative for the code

public void enableLoadingImage() {
		imageSwitcher = (ImageSwitcher) findViewById(;
		ImageView image = (ImageView) findViewById(;
		imageSwitcher.setFactory(new ViewFactory() {
			public View makeView() {
				ImageView myView = new ImageView(getApplicationContext());
				myView.setLayoutParams(new ImageSwitcher.LayoutParams(
						LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
				return myView;
		imageSwitcher.postDelayed(new Runnable() {
			int i = -1;
			public void run() {
				switch (i) {
				case 0:
				case 1:
				case 2:
				case 3:
					i = -1;
				imageSwitcher.postDelayed(this, 1000);
		}, 1000);

Hope this can help someone else.

Setting up mysql for python

Posted: March 31, 2015 in DJango
Tags: ,

OK, after trying to setting up my virtual environment for django I was struggling working with mysql.

What I was getting is after running:

$ pip install MySQL-python

EnvironmentError: mysql_config not found

So basically what was needed was to reinstall mysql again but now for my local environment:

$ sudo apt-get build-dep python-mysqldb

$ pip install mysql-python

And the just run the migration:

$ python migrate
Operations to perform:
  Apply all migrations: admin, contenttypes, auth, sessions
Running migrations:
  Applying contenttypes.0001_initial... OK
  Applying auth.0001_initial... OK
  Applying admin.0001_initial... OK
  Applying sessions.0001_initial... OK

Running correctly.

Just like that , I needed to make a call to an AsynTask in Android, after reading differents threads in stackoverflow about the solutions I found mine doing this:

new GetAsyncTask(this).execute().get(10000,TimeUnit.MILLISECONDS);


This waits for 10 sec doing the request, if time is over just finishes and I catch an Exception to continue with the flow.
Seems that AsyncTask must be used only for Task that won’t consume too much time.


Posted: March 19, 2015 in Uncategorized

I will take a workshop next saturday regarding MongoDB, it has been a while since I just installed and created and application for tweepy, while I was checking its installation in Ubuntu I got the following error:

couldn't connect to server at src/mongo/shell/mongo.js:145

This seems to be a lock issue and if you are running it on Ubuntu you can type the following commands:

sudo rm /var/lib/mongodb/mongod.lock
sudo service mongodb restart

That’s all for now.

Simple as this:


carlos@carlos-lap:~/sinatra$ sudo gem install shotgun
[sudo] password for carlos:
Successfully installed shotgun-0.9
1 gem installed
Installing ri documentation for shotgun-0.9…
Installing RDoc documentation for shotgun-0.9…

And slim

carlos@carlos-lap:~/sinatra$ sudo gem install slim
[sudo] password for carlos:
Successfully installed slim-2.0.2
1 gem installed
Installing ri documentation for slim-2.0.2…
Installing RDoc documentation for slim-2.0.2…

Still playin with Sinatra 🙂