Weblogger.el – Blogging from within Emacs

This is my first post from within Emacs. Thanks to Akarsh for
informing me about this wonderful mode. Guess the frequency of posts
will increase from now. Lets wait and watch. Btw, it is so peaceful to
be able to blog without the interface that wordpress provides. :)

Published in:  on December 19, 2008 at 6:08 am Leave a Comment

Converting text to image :: PHP

The following code contains a function which uses the gd library in php to convert a given text into an image. This was needed in order to prevent bots from reading email ids displayed on a website. There are a lot of scripts available readily which will display an image when the text is passed as a get variable to the php file. I was unable to use this because there was no point including the email id as get variable, making it simple for a spam bot to gather information.
The tricky part is to capture the output of the function imagegif( ) so that it does not hit the browser screen.

A more readable code

<?php

function convert_text_image($text_input)
{
$my_img = imagecreate( 290, 18 );
$background = imagecolorallocate( $my_img, 255, 255, 255 );
$text_colour = imagecolorallocate( $my_img, 0, 0, 0 );
imagestring( $my_img, 4, 0, 0, $text_input,$text_colour );
ob_start(); // This prevents the imagegif function from outputting to the browser.
imagegif($my_img);
$img_out = ob_get_contents(); // This gets the raw data of the image.
ob_end_clean(); // Clear all output till now
$img_out = chunk_split(base64_encode($img_out)); // Encodes the data so that we can display this as a raw image on the browser.
$string = "\"data: image/gif;base64,".$img_out."\"";
echo "";
imagedestroy( $my_img ); //Free resources.
}

$text = "example@example.com";
convert_text_image($text);
?>

Published in:  on September 19, 2008 at 5:26 pm Leave a Comment

Tour De CC

The very first day of almost very IITian’s life here (IITM) begins with the trip with your branch mates and faculty advisor to the 3 important buildings on campus, namely the Computer center, Library and the Workshop. I still remember my first trip to CC in which we were shown from far away that these are the servers which help people perform computations and host websites. This building has had a rather passive role in my life from then until recently (read few months ago) when I was asked to take up the task of ‘redesigning’ the IITM website.

From then on life has been punctuated with frequent visits to the CC for various reasons, but the latest one was rather different. We ( Ramanathan, myself and the team) were almost done with the new site and had requested for a new machine. While I was returning happily after the fact that the our G slot was canceled reached my ears, Prof. Vijayaraghavan called and enquired if I would be able to drop in to take a look at the server that was assigned. I was more than happy to say yes, and so made my way to the CC.

The computer was supposedly one blade on the HP Proliant servers. Within a few minutes I had all the details about the server, but both of us had not really seen the server. So Prof.Vijayaraghavan requested Mr. P Y Sreekumar ( A rather popular name among students familiar with working of CC) whether he could show us the server and thats how it all started.

Once the protocol of opening locks were completed we entered the server room, although I had been there a few times before the work was mainly confined to the servers to which we had access to and were was comfortably oblivious to the presence of a number of rack servers which were in plain view. PYS started by showing us which was ‘our’ server. It was a rather disappointing to see, that the rectangular box was the all powerful webserver with a lot features which he explained patiently. To my surprise he did not stop with that but also told us details of what are the servers/services offered by other blades on that server. He also let us have a peek at the (frequently failing) smail system. When enquired about the cause for such frequent failures he said that it was due to some electrical problems they had to do some rewiring and that was the reason they had the LAN cut last saturday (23 August). We also discussed about the hardware specifications and the possibility of installing Debian GNU/Linux on the server and parted our ways for lunch.

Published in:  on August 29, 2008 at 9:20 pm Leave a Comment

Kaatru Vanga Ponaen, Oru Kavidhai Vaangi Vandhen

The title of the post literally means I went to get some (fresh) air and ended up coming back after getting (read acquiring) a poem.
Something similar just happened. I came here intending to post about getting the students server better organised, but what caught my eye is the fact that the blockquote in this theme is not very noticeable and I could not help but do something about it. The quickest solution that occurred to me was to edit the CSS ( I wonder what I would have tried if I had not been exposed to CSS before… ). Unfortunately wordpress does not let you do that without “buying” an upgrade. The next thing that struck my mind to upload an image of a “double quote”. This was pretty quick and I had the image on the blog. Only thing remaining was to take away the ‘unnecessary’ html. So that was how the quotation mark appeared on the very first post (below) of mine!

Published in:  on August 8, 2008 at 7:25 pm Leave a Comment

Hello world!

qouteNecessity is the mother of all inventions

Yes! This blog is a result of a need to document anything important that i do. I intend to use it more or less as a “log book” of my activities.

Published in:  on June 29, 2008 at 6:47 pm Leave a Comment