24 August 2010 View Comments

Cool Stuff – Icons of the Web

icons of the web

The nmap team put together this image by retrieving the favicon images from the top 288,945 sites (according to Alexa Ranking) and composing the image. The more popular the site is, the bigger the icon in the image. As you can see Google’s the biggest of the lot.
You can take a look at an interactive version of this image on their site, where you can zoom into the image, or search for a particular site’s icon within the big one – http://nmap.org/favicon/

According to their site, the original image’s dimensions are – 37,440 x 37,440 pixels, which is quite a large one.

Posted via email from Vinu’s Random Posts

17 August 2010 View Comments

Getting back to Posterous

It’s been quite a while since my first post on Posterous. Just got the urge today to revive the account and start putting up short posts here. So posts which are too long for Twitter and too short for my blogs will end up here. If you’re interested in that head over to randomstuff.vinuthomas.com to check out what’s I’ve been doing.

Posted via email from Vinu’s Random Posts

13 July 2010 View Comments

HTML5 in brief – Getting Started

HTML5 source code

HTML5 source code

If you’ve been hearing about the buzz about HTML5 and what it is – here’s a brief post and ways to get to know HTML5 better.

HTML5 is the latest version which newer HTML and XHTML documents should confirm with. This version of HTML aims at simplifying and overcome issues with the older HTML4 presented.

The first thing you’ll notice in HTML5 is that the HTML declaration itself is simplified. To declare a HTML document, all you need to do is to declare the document in this way:

< !DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>Sample HTML5 Document</title>
</meta></head>
<body>
This is my first HTML5 document
</body>
</html>

You’ll notice that the standard DOCTYPE declaration which is required in HTML4 is missing here. This is the first in many simplifications which eases up development in HTML5.

There’s simplifications on other tags also. For example HTML5 features a <video> tag which makes it easy to embed videos in your page, without any third party plugins, as simple as this:

 <video src="mymovie.webm" controls>
If you are seeing this, your browser may not be fully HTML5 compliant.
</video> 

There’s still debate about what the default format for HTML5 videos should be, Google in the meanwhile has introduced the WebM format which royalty-free high quality video compression codec for use on the web. This format has eventually gotten the support of Mozilla, Apple, Opera and Google. The newer nightly builds of Firefox and Chrome support this format.

If you are looking at exploring the differences between HTML4 and HTML5, this links should be of help – HTML5 differences from HTML4. Another very useful site for developers who are new to HTML5 is Dive into HTML5. The author of this site explains the basics of HTML5, what’s new with it and how to do stuff with it in a simple way.

To get you started on HTML5, here’s a screencast by Addy Osmani which takes you through the basics in under 5 minutes.

Even though the HTML5 specs are still evolving, and browser support for the new features may time sometime to stabilize, the power of HTML5 is the way to go. The first uses of HTML5 is going to be what is powering the mobile web, since most Smartphones these days are running Webkit browsers which are HTML5 compliant.

I’ll be taking a deeper look into HTML5 in the future posts, so look in the HTML5 section here for updates. Here are the links from this article for your reference:

Image credit – via Wikipedia

Tags:
29 June 2010 View Comments

mysqlind_qc: Client Side Caching for MySQL extensions for PHP

mysqlind_qc: Client Side Caching for MySQL extensions for PHP

Here’s something in the making, a PHP extension which caches MySQL queries irrespective of the extension being used. It’s a plugin for mysqlnd, the native MySQL driver for PHP called  mysqlnd_qc. This currently requires PHP 5.3.3-dev which is still in development.

The extension allows caching buffered queries through mysql_query and mysqli_query. It allows cache-invalidation though TTL or a user defined callback. This extension is still in the protoype stage right now and will evolve as the project progresses.

The Query Cache is implemented as a PHP extension. It is written in C and operates “under the hood” of PHP. During the start up of the PHP interpreter it gets registered as a mysqlnd plugin to replaces selected mysqlnd methods.

At PHP run time it proxies queries send from mysqlnd/PHP to the MySQL server. If a query string starts with the SQL hint (/*qc=on*/) to enable caching of it and the query is not cached (Cache miss), the query cache plugin will record the raw wire protocol data send from MySQL to PHP to answer the query. The query cache records the wire protocol data in its cache medium and replays it, if still valid, on a cache hit.

Note that the query cache does not hold decoded result sets consisting of zvals (C struct representing a PHP variable). It stores the raw wire data of the MySQL client server protocol. In case of a cache hits, mysqlnd still needs to decode the cached raw wire data into PHP variables before passing the result to the user space. This approach has one major advantage: simplicity.

You can get more information and installation instructions over at the MySQLND Query Cache Project page at Mysql Forge.

Check out this slide which gives you more information about this extension:

Enhanced by Zemanta

21 June 2010 View Comments

Free Ebook on the Zend Framework

Free Ebook on the Zend Framework

Here’s a very good e-book on the Zend Framework called Zend Framework: Surviving The Deep End by Pádraic Brady. You can access this book from it’s site at www.survivethedeepend.com. It’s not yet available in print or download, but the author does mention that there’s a print book coming out in the near future.
Here’s a top level Table of contents of the subjects covered in this book:

1. Introduction
2. The Architecture of Zend Framework Applications
3. The Model
4. Installing The Zend Framework
5. A Not So Simple Hello World Tutorial
6. Standardise The Bootstrap Class With Zend_Application
7. Handling Application Errors Gracefully
8. Developing A Blogging Application
9. Implementing The Domain Model: Entries and Authors
10. Setting The Design With Zend_View, Zend_Layout, HTML 5 and Yahoo! User Interface Library
A. Creating A Local Domain Using Apache Virtual Hosts
B. Performance Optimisation For Zend Framework Applications
C. Copyright Information
If you’re already working on the Zend Framework, take a look at the section on Performance optimizations for apps built on the Zend Framework, which has some useful tips.

8 June 2010 View Comments

Free online Security scanner – ZeroDayScan

Free online Security scanner – ZeroDayScan

ZeroDayScan in an online scanner which can scan your site for the following issues:

  • Detects Cross Site Scripting attacks (XSS)
  • Detects Hidden Directories and Backup Files
  • Looks for Known Security Vulnerabilities
  • Searches for SQL Injection Vulnerabilities
  • Automatically detects zero day bugs
  • Performs Website Fingerprinting

Once the service finishes scanning your site for issues and vulnerabilities, it emails you a PDF with what they found for your site.

In order to prevent sensitive security reports like this going out to others, ZeroDay scan asks you to add a text file with some security text to be added to your site. This ensures you can scan only sites which you have control over.

Check out this service at www.zerodayscan.com

Reblog this post [with Zemanta]

27 May 2010 View Comments

Create RESTful Webservices in minutes with FRAPI

Create RESTful Webservices in minutes with FRAPI

Planning on starting a project with REST webservices? You’ve gotta check out this new framework called FRAPI. This API framework built in PHP eases development of REST webservices, by allowing you to add actions, responses and even create users and assign API keys to them for accessing the services you create. Here’s a video showing an overview of FRAPI and how simple it is to deploy and manage webservices.

This project is still quite new and their documentation is down to the bare minimum. They do have the required documentation for you you’ll need to get your hands dirty with FRAPI. First you’ll have to download the sources and set it up on your own. One you’ve downloaded the files and setup the directory permissions, you’ll also have to make the Apache Virtual host settings to get FRAPI to start working.

FRAPI has the following requirements for it to run:

  • PHP 5.2.2 or later
  • APC: Required for caching of actions, errors, etc.
  • HTTP: (http://pecl.php.net/pecl_http
  • PEAR: (http://pear.php.net)
  • PEAR::HTTP_Request2: This could be replaced by pecl_http however it is used in the bundled ArmChair package which is used to access CouchDB (http://pear.php.net/HTTP_Request2)

Some of the advantages I see after playing around with FRAPI is that it auto-generates the code skeleton for you to work on so you just have to go fill in the blanks to create your service. You also don’t have to worry about transfoming the your data into different formats, FRAPI supports JSON, XML, PHP, and plain text natively. This enables you to make your webservices cross-platform and even power mobile apps. You also don’t have to tweak around with code which handles http requests and responses while creating your webservices.

For more information on this project, head over to their site  getfrapi.com or their project page on github.

Reblog this post [with Zemanta]

18 May 2010 View Comments

Check your server load before you process

Check your server load before you process

Most of us just write applications to be deployed on a webserver without thinking about what to do when the server becomes overloaded. What happens in most cases is that the application would go trying to run itself on every request, and on a heavily loaded system, it just goes on the aggravate the problem, making increasing the load on the server, till finally the server becomes unreachable.

What if you could actually check the server load in your PHP application? Would you think about checking the server load before doing some heavy computational task or database accesses? There’s function in PHP which will allow you to check the load averages on a server.

The sys_getloadavg() in PHP gives you the load averages for your server. You can use this to check the load on your server before processing a request.

$serverload = sys_getloadavg();
print_r($serverload);

The code above gives the output:

Array
(
    [0] => 1.07
    [1] => 0.89
    [2] => 1
)

The output from the code shows the system load averages where [0] is the load averages for the past 1 minute, [1] is for the past 5 minutes and [2] is for the past 15 minutes.

On an ideal server, the load averages on the server shouldn’t go above 3. A load average of more than 15 would mean that the server is already running much lower than normal, and you may not want to add more load to this.

You can use this output to decide whether to serve a process intensive page depending on the server load. Here’s a pseudo-code on how you’d do something like this:

$serverload = sys_getloadavg();
if ($serverload[0]<10)
  {
    // process loads of data now
    some_big_process();
  } else
     {   // Send a 503 header stating that the server is overloaded.
         header('HTTP/1.1 503 Too busy, try again later');
         die('The server is busy at present and cannot process your request.');
      }

You can also run the application in such a way that you can wait till the load on the server decreases to run your process. This is useful if you are running a cron for processing data:

set_time_limit(0);
//set time limit to 0, so PHP's max execution time doesn't interfere with the processing script
$serverload = sys_getloadavg();
//Check load and see if it's low enough to start processing
while ($serverload[0]>5)
{  //Wait for 1 minute to check load again
    sleep(60);
}
// out of the loop - so let's do some processing now!
some_big_process();

To ensure that the script doesn’t run endlessly on a permanently overloaded server, time check in the while loop to auto-end the script it the server load remains high for a certain amount of time.

More reading:
Load & Load Averages on Wikipedia
PHP function – sys_getloadavg

16 April 2010 View Comments

Bangalore PHP Meetup April ’10

Bangalore PHP Meetup April ’10

Just a quick heads up in case you missed out on the announcement. The Bangalore PHP Meetup’s happening this month on the 24th. For a change, I’m not involved much in the organization of this event. Indus Khaithan took care of the venue arragements and Harsha MV’s taken up co-ordinating with the potential speakers and finalizing the talk list. Thanks a ton guys for taking taking the initiative.

Harsha’s put up a tenative list of talks for this month’s event:

  • Developing Facebook Application using PHP by Sriram Kumar
  • Job Queues by Abhinav Lal
  • Zend ACL Component - Bare_Acl by Sudheer Satyanarayana

Here’s the link to this month’s meetup event – www.meetup.com/Bangalore-PHP-Users/calendar/13135127. We’ll keep that page updated with the latest details about the event. If you are planning on coming for this, join our Meetup group and RSVP ‘YES’ to the event.

As always – Please forward that link to your friends who you think would be interested in our group as well.

11 April 2010 View Comments

BSNL 3G – HELP!

BSNL 3G – HELP!

I had picked up a BSNL 3G connection a few weeks back hoping for a faster internet connectivity on the move on my N900. The N900 being a mobile computer, I’m able to do most of the work on that without having to boot up the computer. It’s also an advantage having a fast connectivity on the mobile with the 4-8 hour power cuts  in Bangalore, the UPS doesn’t hold up with WIFI connectivity too long during an outage.

When you get a prepaid connection from BSNL, their initial 120 topup gives 25 MB download free. The call rates also seed reasonable. I was pretty impressed with the speeds I got on the mobile. Here’s the screenshot of the speed test on the N900′s browser:

That’s pretty decent speeds for general surfing, VOIP calls, and IM. Even Skype calls go through without any major breaks in the call. This kind of speeds after the ultra slow Edge speeds on Airtel GPRS was mindblowing.

Now the free usage was coming towards it’s end, and I had to look for ways to top up the balance.  After surfing around the unintuitive BSNL portal, I found that their portal shows data plans for prepaid and postpaid over at http://karnataka.bsnl.co.in/3G/dataplans.htm.

First stop’s their dealer

The dealer I got the connection from had no clue about how to get this done. The BSNL rep who was at the shop also was clueless about 3G data plans. He asked me to call the customer care folks to find out the details.

2nd stop: Customer Care Number

Customer care on the other end just want to end the call as fast as possible. The first time I called customer care, the person hardly heard what I was asking for and told me some instructions to get Blackberry service on the mobile and dropped the line. The next call I got through asked me to SMS some text to a number. When I did so, I just got a reply message that the option I messaged was wrong!

Still getting no where!

I searched for other dealers on the way to office and dropped into one more place – they too were clueless about the 3G data recharge. Next stop, Customer Service centres. I hunted and found their CSC locations and phone numbers from their site. I tried the two locations closest to me, and tried calling up to find how to reach there. No replies on the numbers listed on the site!

Recharge online?

They advertise that you can recharge online on their portal portal.bsnl.in. Well you can, if you have the patience for the site to load up. My luck’s been so good this far, that when I try logging to recharge, I never get past the login screen. Luckily I found another service to recharge my talktime balance for BSNL. Unfortunately, neither BSNL or other recharge portals I’ve checked out, provide data recharges for BSNL’s 3G serviceUnfortunately the other recharge portals I’ve checked out don’t provide data recharges for BSNL’s 3G service.

Update: I did check out the BSNL portal after reading a comment from Uday, using Internet Explorer, the site did go through and I did see a data top-up option. But the payment options don’t include a credit card, you’ll need an account from one of the National Banks to pay on the site. The banks I have accounts in don’t seem to be on the list there.

I still have yet to get the data plan top-up done. If any of you know how to get this done, and a CSC/dealer where the people know how to do this, do let me know by commenting below!  BSNL’s service is good while it runs, when you need help, you’re on your own. Their service is like a do-it-yourself kit where the instructions are missing.

Tags: