code

Save login info in a cookie using CURL (PHP)

At work I was using a simple script that connected to a secure API, logged in and saved the result. This seems simple enough and is fast enough when calling it a few times, however one of the tasks I was then assigned was actually running this script for different values over 60,000 times! Each call (including the logging in) would take a little over a second, so calling it 60,000 times would take a while. It was then decided…

Read More

LOLCODE!

I’m sure most people by now know about the whole Lolcat phenomena, however, for those still living under a rock: A Lolcat, or LOLCAT, is an image combining a photograph, most frequently a cat, with a humorous and idiosyncratic caption in (often) broken English—a dialect which is known as “Kitty Pidgin”,[1] “lolspeak”, or Lolcat. Lolcat or Kitty Pidgin has been around for a while now, and has been made popular by sites like I Can Has Cheezburger?…however in spite of…

Read More

Getting Rid Of The Default Gravatar

I’ve been playing around with WordPress 2.5 and a new theme on the blog over the last few days, and must say that I am quite impressed with all the new bells and whistles. One of the newer inbuilt features, Gravatar has been especially interesting. The Gravatar site has this to say when defining a gravatar A gravatar, or globally recognized avatar, is quite simply an avatar image that follows you from weblog to weblog appearing beside your name when…

Read More

Dealing with MySQL’s ‘table is full’ error

Chances are that if you are dealing with adding really large amounts of data into a MySQL table, you might encounter the infamous table is full error. According to the official MySQL reference manual, MySQL tables (MYISAM only) have size limits and these limits are determined by OS constraints. For Win32 w/ FAT/FAT32 Systems (and other 32 Bit Systems) the limit is 2GB/4GB. It may sound like a lot, but trust me, it does not take long before you have…

Read More

Add a Print Stylesheet to your Blog

The other day I went to print out one of my posts, and was quite surprised at how it turned out (Check the screenshot below). This would simply not do. There may not be a lot of people wanting to print any of my posts but I still would like the page to print properly. Back in the olden days of the wild wild web, the solution would have been to create a separate page meant for printing; but with…

Read More

Hide your Email Address Using Microformats

Heres a little tip to hide your email address on your site, so that it is only visible to people with microformat readers. Suppose I wanted to advertise an email ‘kunaal@somedomain.com’, normally you would not put that on your website for fear of getting your email inbox choked with spam. Here is another little trick to hide your email address from everyone without a microformat reader. Normally, you would write your email address using microformats as so – Kunaal Ramchandani…

Read More

How to create Bookmarklets

This is actually a pretty neat little trick. For a while now, when I am working on simple JavaScript functions, I have been using my browsers address bar to speed things up. For those not aware, one can actually type simple or complex JavaScript commands in the address bar of most modern browsers (It works in Mozilla and I.E at least) for a quick simple calculator, you can try pasting this in the address bar javascript:eval(567 * 234); Now to…

Read More

Using .htaccess to password protect a directory

I came across this issue a few days ago, I was required to create a secure area on a web server where I could upload large files. The directory where these files were uploaded should be password protected so that only someone authorised can access it, and as a further protection, the directory should have its directory listings display turned off. Client Side password protection like using Javascript is not very good, because it can be disabled Figured this might…

Read More