I finally got my hands on the Raspberry Pi a few days back. My upcoming plan is to use the Pi as a Node.js server. If you haven’t heard of the open, platform-friendly, inexpensive $35 Linux-powered computing platform known as Raspberry Pi by now, you better do so. Starting with the Auduino, this is surely the start of inexpensive open-source hardware computing. Think of your traditional PC motherboard with integrated graphics, network, sound, HDMI, and keyboard/mouse shrunken down to the size of a deck of playing cards, and you’ll get the idea of what the Raspberry Pi is all about. Driven by an ARM1176JZF 700MHz processor, the Raspberry Pi has 256 megabytes of on-board RAM and hardware-accelerated graphics.
Read More

The Colors module is one of the simpler modules you could use with Node. You can use it to provide different color and style effects to the console.log string output. All of the output that you generate in the Node.js console is of a single color. This can make debugging harder as you cannot easily differentiate the output of one log from another.
Read More

One of this year’s most interesting open source projects has been PhantomJS – a headless WebKit with JavaScript API. It has fast and native support for various web standards: DOM handling, CSS selector, JSON, Canvas, and SVG. I’ve already used it to automatically scrape data from pages and for testing. In this post we will use PhantomJS along with confess.js to analyze web page performance. confess.js currently has two main functions: to provide simple page performance profiles, and to generate a app cache manifests.
Read More

Repo.js is a jQuery plugin that enables you to embed GitHub repositories into any webpage. It works by reading the repository information from GitHub and dynamically building a DOM tree of the directories. The complete hierarchical structure is downloaded in a single go and saved as a DOM structure, making it extremely fast. However file source for each one is retrieved only when clicked. A simple example for the twitter bootstrap repo is shown below.
Read More

Querying MySQL with Node.js

by: Sameer Posted in: nodejs |   ( 4 ) Comments

30 Jun 2012

Node.js is slowly making inroads in normal web development routines. There are a number of modules available for Node to work with almost any requirement you imagine, although the stability of many of them is open to question. Although I’ll surely not switch my development practices to Node from PHP any time soon; for many tasks Node would be a perfect match. For example for one site I use a CRON job to regularly sync remote data to MySQL. Node with its support for asynchronous requests may possibly help me make the data syncing faster.
Read More

In one of my previous posts we saw how we could take webshots of web pages using ‘wkhtmltoimage‘ toolkit. Now we have something more flexible with PhantomJS. PhantomJS is what we call a headless WebKit with JavaScript. It has fast and native support for various web standards: DOM handling, CSS selector, JSON, Canvas, and SVG. You can programmatically access web page content for scraping, monitoring or testing purposes, including webpage features that work with JavaScript, which is not possible using server side languages. For most reasons you can think of it as a browser without a window, where we drive it via JavaScript. Here we are using it to grab the webshots of web pages.
Read More

Automatically extracting attachments from Gmail can be important for reasons where you need to process the attached files periodically with a CRON job. Also it can be useful for automatically archiving important attachments. Below is a simple proof-of-concept plain PHP code, devoid of any object-oriented features that extracts attachments from your Gmail account. It uses PHPs imap extension to access the inbox.
Read More

There is nothing more frustrating than filling a complex web form and just as you are ready to submit it, you accidentally hit refresh, close your window tab or the browser just crashes on you. Only if you could add some kind of auto-save feature to the form to mitigate this problem. Applications like Gmail, WordPress both support the auto-save feature, albeit in a technically different way.
Read More

Protocol Relative URLs

by: Sameer Posted in: html |  

18 Apr 2012

One little gem I recently encountered is protocol-relative URLs. This solves the headaches of the age-old problem of creating URLs which work whether you’re in SSL mode or normal http. For example take the following image :
Read More

PHP 5.4.0 in a nutshell

by: Sameer Posted in: php |   ( 4 ) Comments

6 Apr 2012

Although purists have always sneered upon PHP for being a “patched” language; the evolution of PHP over the years, with new features added in every version, has only increased its popularity. The latest 5.4 release has followed the trend with some major feature additions. The following post describes some important changes in PHP 5.4.
Read More

Sign up for fresh content in your email