How to connect to an existing database with sqlite3 3.6.20

If you have the later versions of sqlite, then using the command line client sqlite3 to open a .db file is easy, and is available on the 1st page of a web search, which is that you get into the commandline with sqlite3 command and then type “.open </path/to/filename>” and connect to a specific exisiting database.

But in version 3.6.20 – when you do a .help – you will notice that there is no .open command. And when you type  “.open </path/to/filename>” , sqlite3 will politely respond with the message – ‘Error: unknown command or invalid arguments: “open”. Enter “.help” for help’

The solution is to pass the .db file name as a command line argument – i.e. you do a ‘sqlite3 </path/to/filename.db>’ to connect to an existing database.

This is a version specific post. Other environment details – CentOS 6.4 (final) and SQLite was the version bundled with Python 2.6.6 .

Posted in How To... | Tagged , | Leave a comment

How To get php5-mcrypt enabled / php5-mcrypt installed but not working Ubuntu 14.04

Hi! Yes this blog is alive, and the author is alive too.

Recently while dealing with some encryption code in php, I faced this problem – I had checked out code that a colleague had written and was making some changes.  While running it, the code wouldn’t work as long as the encryption part of the code was included.  Comment it out and the rest of the pieces were working fine. And digging deeper, I realized that probably, encryption modules where not installed yet – because the code was failing exactly at

 mcrypt_module_open(MCRYPT_RIJNDAEL_128, ”,’cbc’, ”);

I did the following to fix this:-

Environment – Ubuntu 14.04 – Nginx+php5-fpm with Nginx connecting to php5-fpm via unix socket

With a little help from Ubuntu Forums - Ran this command

 dpkg –get-selections | grep php

And got this as the output -

php5-common install
php5-curl install
php5-fpm install
php5-json install
php5-mysql install

 This command lists the modules/libraries installed in our systems – and this clearly showed that the php5-mcrypt module was not even present.

I did

sudo apt-get install php5-mcrypt

and after the installation,

sudo service php5-fpm restart

But this still dint work. Finally the fix mentioned in this link worked for me - https://bugs.launchpad.net/ubuntu/+source/php-mcrypt/+bug/1241286

and a sudo service php5-fpm restart

And it finally worked.

Posted in How To..., Uncategorized | Tagged , | Leave a comment

Linklog – Low level Parsing,Lexing Grammars

Found this via @ravi_mohan today – He was trying to find books/articles on low level lexing and parsing of grammars and found this from his network – Seems to be worth reading – But currently I am unable to do so – Looking for inputs from people already done so.

Link is – Parsing Expression Grammars

Posted in linklog | Leave a comment

Linklog – Personal Hadoop Sandbox cluster by Hortonworks

Found link this via a sponsored/promoted tweet on twitter today -

http://hortonworks.com/products/hortonworks-sandbox/

Right now, I am not able to take this for a test ride. Looking forward to inputs on how good this is to get one’s hands dirty with Hadoop in general.

Go ahead and comment away! :)

Posted in linklog, What is.. | Tagged , | Leave a comment

Blending Features in Canvas HTML5

Reblogging this from Adobe website as a means to easily find the link again -

Summary of the post – Adobe has added some specs to the canvas api which will improve the way colors and backgrounds get blended. This is in addition to the blending capabilities provided by CSS(3)

For detailed understanding, click away -

http://blogs.adobe.com/webplatform/2013/01/28/blending-features-in-canvas/

Posted in How To..., linklog | Leave a comment

BookNotes – Chapter1 Using Memcached by Josef Finsel

Shring key takeaways from the first chapter of the Using memcached throu this blog post. Purpose is for me to recapitulate my learning and for you to get the highlights.

Before starting to read is book, I would recommend readin the following links – these will refresh the memory with the scope and context of words like  events and servers: -

http://blog.soemarko.com/post/1396596544/event-driven-approach

http://www.wangafu.net/~nickm/libevent-2.1/doxygen/html/

The key takeaways are -
1. Memcached is a NameValue Pair cache only and NOT a persistent data store of any sort.
2. The max size of Name/key is 250 chars, max size of values that can be stored is 1 MB.
3. Can be installed on both linux/unix and Windows servers.
Quote
Running the server under Windows as a service only allows one one instance. If you want to run multiple instances you will need to actually run memcached multiple times with different port addresses. This can be done by adding keys to the Registry or by using a tool such as AutoRuns[1] to do that for you.
Unquote
4. 4 commands for add, update and remove data, and a detailed statistics command
5. Works on a server client basis, so for raw interactions with a trial memcached sever use telnet as a client

That, in short, is the highlights of this chapter.

For detailed reading head to http://pragprog.com/book/memcd/using-memcached

Posted in BookNotes | Tagged | Leave a comment

What is Celery task queue, where do i use it and how do I use it?

As you start going beyond the landing page and the login/logout screen of the latest coolest app that you are building, you realize that the app needs to do a lot more set of things other than querying the database and building dandy HTML views around it. :)   And that is when you realize the need for an assistant of sorts, to whom you can throw all the extra load and continue working on your html views :)

This is where Celery the task queue comes into the picture. The Celery homepage and the associated Wikipedia page will only say this much -

Celery is an asynchronous task queue/job queue based on distributed message passing. It is focused on real-time operation, but supports scheduling as well.

But where the hell do I use it? What are typical usecases where Celery comes into the picture? So instead of writing a blogpost all over again, sharing this slide share link, that I found particularly useful in answering these questions that bogged me -

And this one with a little more technical details as to how the tasks are dealt with

So click through the above and get enlightened. And share your experience in the trenches with Celery.

Posted in library watch, What is.. | Tagged , | 2 Comments