I am Hack Sparrow
Captain of the Internets.

Archive for Database

MySQL Pagination

The secret to paginating MySQL results lies in the LIMIT clause of its SELECT command. We'll learn how to paginate results using PHP and Node.js, in order to understand better we'll work with data from a sample table. Create a new database named learnmysql and run this query on it (we are creating a table named songs and populating it some sample data to work on): [code] CREATE TABLE `songs` ( ...

Install Redis on Ubuntu and Mac

Redis caught your interest and want to try it on your Mac or Ubuntu? Excellent! Installing Redis is almost similar in Mac and Ubuntu. wget does not come installed by default on Mac, so install wget first if you are on Mac. And here we go: [code] $ wget http://redis.googlecode.com/files/redis-2.4.8.tar.gz $ tar -zxvf redis-2.4.8.tar.gz $ cd re ...

MongoDB with Node.js

MongoDB and Node.js belong to the same league - new age Web technologies that are shaking up the world of Web development. Both of them are revolutionary alternatives to the traditional technologies like MySQL and PHP. Combining Node.js and MongoDB could be the very best option for your next website or app. Now the question is how do you use MongoDB with Node.js? Node.js has a huge collection of excellent module for many many purposes; naturally there ...

Mongoskin Tutorial with Examples

Mongoskin is probably the most developer-friendly MongoDB driver for Node.js at the moment - it is asynchronous and has a clean looking structure. But its docs are not that developer-friendly (the effort is much appreciated though) - no good examples or explanation; probably because English isn't the author's first language. After realizing that the Mongoskin docs may ...

MongoDB – Add Users and Authenticate

Before you add users to databases, you need to add admins to the MongoDB server. If the server is not running with the --auth option, all you have to do is call the db.addUser() function on the admin database. If it is running with the --auth option, you need to select the admin database and identify yourself as a valid admin. [code] > use admin > db.auth('root', 'w00t') ...