Thursday, February 18, 2010

I am not a terrorist

Its been a while since I have written anything. Well I have been very busy with work lately (forums.com to be precise, which will launch soon). More on that in later blog posts; today I want to talk about something else. "My Name is Khan". I am sure most people who follow my posts will know this is the name of the latest movie by Karan Johar starring Shah Rukh Khan and Kajol. And almost anyone who knows me, knows I do not watch many movies, neither do I do celebrity worship. Then why am I writing on a film?

There is enough reason behind it. Not many reasons though, just one solid reason: life. Each film has a message to deliver. And Indian cinema in recent times are very message oriented, less dance/drama, etc. I have watched "Wake up Sid", "Rocket Singh", "3 Idiots", "Ishqiya" in recent past and have thought of writing on all of them. They all had messages. Some love, some honesty and so on. But what eventually got me to write on My Name is Khan is how easily and vividly the film presents the right (or lack of) to live. Do not get me wrong, each of the other movies were wonderful and had clear messages. But love, respect, honesty come only after a 13 year old boy lives to see the age 21 or more.

Our world has become too violent, from within. It is not them (whoever "they" may be). It is us, yes all of us, each and every one stupid human being. Or should I not use that term, since we are not even human enough. I think some alien super-power should come and strip the "human" tag off us. We kill like animals, behave like butchers (even worse, at least they get paid), and then we suspect the other to be a "terrorist". I know this film will not appeal to many, it does not have to; we have already lost so much faith in ourselves that the message may not come clear through. Only time will tell if we will all die at 13 or live to see older years.

Saturday, October 10, 2009

Big Bang at next OCC Kolkata

Hi all,
At the Upper Wood Street CCD we came across a blog post on Venture Woods, informing an Angel Investor Event happening on the 21st of this month.
During this OCC meet we crowd-sourced a template to crowd-source at least one business plan at the next OCC and present it to the event.
So during the next OCC meet at CCD RDB Boulevard (Oct 14) we are providing a platform to crowd-source at least one business plan and subsequently follow through to convert this plan to a venture. Here is the list describing the flow:

- Identifying the domain
- Identifying the pain points & the ideas
- A hand-raise voting of which ideas each individual wants to work for (You can raise your hands for multiple ideas!)
- For each idea that is then being eventually crowdsourced, select a moderator
- Following this, we will give you a proposed flow (which we formulated right now!). Each group can tweak it and carry on with forming their b-plans!

So, that’s it! Let’s meetup on this Wednesday at 2 PM!
We will start off with the crowd-sourcing at 3 PM, and would suggest you to be at CCD RDB Boulevard by 2:30.
If you have any suggestions, just shoot on the mailing list!

Monday, August 31, 2009

Experienced PHP Developer Needed

We need a very experienced PHP developer willing to work full time on a contract basis. This is telecommute work so you can work from anywhere. You will be working on new products mostly on Amazon Web Services platform. Required:

Linux, PHP, MySQL
Amazon Web Services: EC2, S3, SDB, SQS
Using Tarzan AWS PHP library
Experience in JS is a plus (AJAX will be used)

We are looking for experienced developer who can work in a distributed team environment.
Pay is very good to say the least.
We will prefer someone from Kolkata so (s)he can work from my place if needed.

Sunday, August 30, 2009

Open Coffee Club Kolkata: Day 2

Hey Kolkatans,
Kolkata had another splendid OCC, on Sat Aug 29. We did have some glitches, with the Internet not working at the Park Street CCD venue. And since Park Street CCD has much footfall we had to shift out to a bigger CCD. The manager at Park Street suggested a few nearby and then Mitesh and Manish went out searching for one. At last we found the CCD on Upper Wood Street. If you are coming from Park Street (like we did) then just walk across 22 Camac Street (Pantaloons) and you will find a crossing, keep going straight, and you will find a CCD on your right. That will become our permanent CCD venue for South Kolkata. It has a great outdoor arrangement, simple superb for the coming season.

We did have new faces this time and that is great, so the news is spreading. Here are some of the people I remember:
Sanjib Chakraborty
Sumit Datta
Saikat Singha
Mitesh Ashar
Manish Sonkar
Pavan Gupta
Sumana Chakraborty
Prachi Kamalia
Amitabh Choudhury
Ashmita Brahma
Sougata Pal
Bibhash
Anirban Ganguly
Pankaj Bansal

Sorry for having forgotten the last names of a few people. And I can not recollect the guy from BITS. Someone please tweet the name(s).
Instead of the initial venue change, etc. we had a very good time. Me and Mitesh could start on the project he is to work on. I gave Ashmita an introduction to HTML. Prachi, Pankaj and me discussed celeb9.com and then a lot of scaling related stuff.
Well that's from my side. Others will blog their experiences. We are trying to get a basic website up for all such information. But the best way to enjoy OCC is to drop at one of the next OCC. OCC Kolkata takes place twice a week, at a CCD, with Internet available on wi-fi. Venues:

Every Wednesday at the CCD below RDB Boulevard (Big Cinemas), Salt Lake Sector V. (Google Map)
Every Saturday at the CCD, No 1, Upper Wood Street (close to Pantaloons, 22 Camac St.) (Google Map)
Both start at around 2PM and continue till 9-10 PM. So you can pour in after office. Remember to bring in your laptops, mobile devices, notepad. Meet, discuss, work! Oh and drink coffee (not free :P).

Wednesday, August 26, 2009

Open Coffee Club Kolkata: Day 1

Hello Kolkatans,
I am glad to make this blog on what happened yesterday at our first attempt to bring people to a CCD. That does not sound out of the ordinary right? Well there is a twist. Cafe Coffee Day @ RDB Boulevard Salt Lake Sector V was buzzing with people, many of whom even I have never met. About 7 laptops, wifi, coffee, music and more. If I remember clearly about 15+ people poured in and went back with an experience which will bring them back many more times. Do not believe me? Well ask them. Here are the names I remember in the order I remember they came in:

Sumit Datta (pixlie )
Saikat Singha (pixlie)
Prashant Verma (Salt Lake Software)
Pallav Nadhani (InfoSoft Global)
Sumana Chakroborty (pixlie)
Sougata Pal (KonectIt)
Bibhash (consultant/freelancer)
Samiran Ghosh (Cognizant)
Mitesh Ashar (freelancer)
Nitesh Ambuj (E Force)
Pankaj (E Force)
Abishek Rungta (Indus Net Technologies)
Ashmita Brahma (freelancer)
Nikita Poddar (Cognizant)
Debashish Mohanty (Cognizant)

What came out of this? Well Sumana got freelance creative writing work! Yay! I came out with the name for a venture that Pallav and Abishek are coming up with. Its a secret... shhhh. But we will have a good party at one of the future OCC where they have promised to sponsor a (huge) cake. Lovely! Me and Mitesh discussed a new project he will be working on with me. We had some serious work done, awesome fun and I had my lunch (chicken burger) at 5 PM!

So what are you waiting for? Pour into the coming OCC @ CCD Park Street, Sat 29 Aug. 11 AM onwards. (opposite KFC). You are welcome to come in anytime after 11AM. Bring your laptops, blackberrys / iphones or even your notepad. Sit and draw if you want. Its up to you. Kolkata meets, discusses, shares and gets work done. Oh btw in the next OCCs I will be looking out of freelance programmers, PHP and JS. Others are also looking out of talent. Many content work coming in... so creative writers, bloggers should join in! Lets ROCK Kolkata! (and get a lot of work done over coffee).

Related: Open Coffee Club introduction post

Note: We are looking out for some mobile broadband company to sponsor the events broadband connection. Currently we are running on something I use, plugged into my wireless router. But we need a better solution. So sales heads from the fiercely competitive mobile/broadband companies, here is your chance to prove your product.

Tuesday, August 25, 2009

Open Coffee Club Kolkata

Hello fellow Kolkatans,
Wednesday, August, 26th, 2009 we are kicking off Open Coffee Club in Kolkata.
You may already be aware of OCC. Its simply bringing your work to a casual place, work, meet people, share, get work done, make contacts. Having a common place for everyone to meet is important. The original concept is geared more towards entrepreneurs but we want to keep it wider in meaning and appeal.
So any working professional, entrepreneur, consultant or anyone interested can join in.
Kolkata is way less active in these aspects and we want to change that. I hope you will find it as interesting as we imagine it to be.

The plan and place:
We wanted to have one date and place, but Kolkata traffic is a mess and moreover Kolkata has a distinct North and South :) Thus we decided on two place, two dates:
Every Wednesday at the CCD below RDB Boulevard (Big Cinemas), Salt Lake Sector V. (Google Map)
Every Saturday at the CCD, No 1, Upper Wood Street (close to Pantaloons, 22 Camac St.) (Google Map)
Both start at around 2PM and continue till 9-10 PM. So you can pour in after office.


You are requested to carry mobile internet options if you have one. We are trying to arrange for internet, but there may be issues.
Please inform your friends in and around Kolkata about this. Lets rock Kolkata!
Read more on Open Coffee Clubs: http://www.opencoffeeclub.org/
Why a fixed venue? Read: http://localglobe.blogspot.com/2007/02/opencoffee-club.html

(Please note that in the original email to my friends I had mentioned the date as August 25th. The mistake is regretted.)

Saturday, June 20, 2009

Import MySQL dump with PHP on webhosts

Webhosts like GoDaddy and other similar often limit how much you can import with the online control panel (phpMyAdmin in most cases). So here is a simple PHP script that does this for you. You have to take a mysql dump from your database. Upload it to you host.

Make sure you change the mysql_connect parameters to reflect your database server settings. The following line numbers need change:

  1. line 2: mysql_connect( ) parameters: Database host, username, password.
  2. line 3: mysql_select_db( ) parameters: Database name.
  3. line 4: fopen( ) parameters: path and name of you SQL dump file.
<?php
mysql_connect('host', 'user', 'password');
mysql_select_db('database');
$file = fopen('dump.sql', 'r');
print '<pre>';
print mysql_error();
$temp = '';
$count = 0;

while($line = fgets($file)) {
  if ((substr($line, 0, 2) != '--') && (substr($line, 0, 2) != '/*') && strlen($line) > 1) {
    $last = trim(substr($line, -2, 1));
    $temp .= trim(substr($line, 0, -1));
    if ($last == ';') {
      mysql_query($temp);
      $count++;
      $temp = '';
    }
  }
}
print mysql_error();
print "Total {$count} queries done\n";
print '</pre>';
You may use the code for any purposes

What I have done is simply read the dump line by line. Lines starting with -- or /* are considered comments and left out. Now we need to build full SQL commands which span across many lines in the dump. So we check for the end semicolon (;) and until we find one we just join the lines together to get one SQL statement. Once done we execute it and move on to the next.

If you find any errors please comment. Also if you port this to use PostgreSQL or use other programming languages please share your code's link on this post's comment.

Friday, May 15, 2009

Basic Gentoo on Amazon EC2

Continued from Introduction to Amazon EC2 (Continued...)...

If you have come this far then I can assume you have an Amazon account, Firefox, Elasticfox extension on it. If not, well then you should get them to do this yourself or else just read through! Lets open Firefox and from the Tools menu on top you should see Elasticfox. On clicking it you should see a pretty detailed interface and a dialog box asking you to fill in your Amazon credentials. Go ahead and do that. Basically it needs a name (like a nick name, just for you to refer to that account), the Amazon Key, and Secret. The last two are string that you will find here after you login with your AWS account.

Now if that step is done we should be able to select our new Amazon profile name in Elasticfox (at the very top center in the Elasticfox extension's UI). Done. Now you will see many tabs in Elasticfox. They are Instances, Images, KeyPairs, etc. Right now we are only interested in the KeyPairs tab. Click on it.You should see a blank list unless you already have created a key for yourself. Anyways for our purposes we will use the small green icon which says "Create a new keypair". We will need to give a name for this, say "brainless". What happens now is that Amazon creates a keypair for us, and sends the private part of the keypair. If all goes well Elasticfox will let us save the private part of the keypair (named "id-brainless" if we used "brainless" for the name of the keypair).

Now we have a keypair. If you have no idea about this keypair thing, well just do a search on it, like here. Now in Elasticfox you see the tabs again. This time we need the Images tab. Click on the refresh button in the Images section. It will fetch a list of all images available at that moment. These images are basically like Live CD/DVD mediums. You use them to boot your own instance. Now there is plenty of choice here and you can make your own custom image too. You will notice a small search text box near the refresh button. Type in nginx. You should get an AMI with this AMI ID: ami-6138dd08. Notice that there is a Manifest name, which is pretty explanatory for many AMIs. Same for this one. It should say "ami.yyang.info/gentoo-nginx-php-mysql-06feb2008.manifest.xml", which means it comes with nginx, PHP and MySQL setup.

Now right click on that AMI. You will see a dialog box in Firefox. There are quite a few parameters, but we are right now interested in only a few. They are:

  • Instance Type (basically this defines how powerful a server you need, refer here). We choose m1.small here.
  • Minimum number of instances (in case you want more than one server or instance started at once). We keep this as 1.
  • Maximum number of instances (what is the maximum number of instances that Amazon should try to start at once). We keep this as 1.
  • KeyPair (choose the brainless key here, the one we created just above).
  • Just notice that in the Security Group section there is a "default" group in which this new instance will launch. This is the default parameter. We will come to this part soon.

Now click on Launch and pray! Well not really. Unless something is really wrong or Amazon is out of empty instance slots (very unlikely) you will have a shinny new instance all to yourself, with a fresh Gentoo booting on it as you are reading this!

Now notice the very important thing here. You did not do to a website to sign-up for a new server and got it in a few hours or maybe a day. Rather this is all through an API. In our case Elasticfox is consuming the APIs and we are using the GUI of Elasticfox. Later we will see the actual API and deal with it a bit to get an idea. And at an even later point I intend to blog on how to use Tarzan PHP AWS library to write a small scaling platform for your website. Yes auto scaling! Wallah!!!

Lets not get carried away though. So back to our instance. Where is it? Simple, check the Instances tab. You will notice a new row there with a lot of details. The most important one right now is State which I am sure you understand already. Well it simply tells what state the server is in: running, or pending (booting up), shutting-down, terminated (shutdown complete). Refer here.

Thursday, May 14, 2009

Introduction to Amazon EC2 (Continued...)

Continued from Introduction to Amazon Elastic Compute Cloud (Amazon EC2)...

So now that you have seen the feature lists and have some idea, lets start with the actual process. I will intentionally avoid going through details like EC2 Instance Types, Data Center Availabilities. These are relatively simple issues we can ignore now. We will come back to them maybe later. I will take you through a part by part tutorial of setting up a simple Drupal website on a fresh EC2 small instance. We will also setup WordPress on the same setup. We will deal with the full LAMP stack and our CMS apps including:

We will need a simple set of tools to do all this. If you are on Linux or similar you will not need an SSH client. On Windows you can get PuTTY or Bitvise Tunnelier. On Linux or Windows you will need Elastic Fox, which is an extension for Firefox web browser and helps manage EC2 and related stuff. And before you start you will need an Amazon account. You will need a Credit Card but do not worry, you will be paying only for the stuff you need. So if the installation takes 1 hour on a small EC2 then you are going to pay $0.10 for the server and about similar amount for the data transfer. Pretty cheap right? Heh, you could send me a donation if you want to though :P

So start with getting an account from Amazon WS, getting Firefox (if you do not already have it), install Elasticfox, set up the Amazon Access Key and Secret (you will get both of these under Your Account > Access Identifiers in the top navigation menu).

Now before I jump into action (and Amazon starts billing you), let me explain in plain English what I want to do. Also I am clubbing the tasks up so that I can write them over a few blog posts, taking 2-3 days time. The first time I will do Gentoo/nginx/Drupal. We will come to Debian, Apache, WordPress combo later.

  1. Create an SSH key-pair (from within Elasticfox). Create a small EC2 Instance from an existing AMI of Gentoo (using Elasticfox). Set simple Firewall stuff (using Elasticfox). Continue here...
  2. Login to the Instance (server) using the Public Domain name we see in Elasticfox (which is of course given by Amazon). Install any extra software we need using "emerge".
  3. Setup php-cgi in nginx. Get Drupal, setup nginx configuration for Drupal including rewrite rules (convert from the Apache rules supplied). Done!

Wednesday, May 13, 2009

Introduction to Amazon Elastic Compute Cloud (Amazon EC2)

Continued from Dummies Introduction to Amazon Web Services...

Imagine you need a web server. The hardware and the software, all together. You have a website which is growing in users and you want to make sure that the site grows along with the user numbers, that there is no downtime, and that the website stay as fast. You have a few things to do:

  • Optimize the codes that run your website
  • Optimize your software stack
  • Get a better hosting account or a bigger server hardware
  • Get more servers

Its the last two points we are interested in right now. Getting a better hosting account is easy if you have shared hosting account. If you have a dedicated server or a vds (virtual dedicated server) this is still easy task. But you may have to wait each time you want to upgrade your web server because it takes time to setup. Thus you need to plan ahead and take extra hardware so then when there are abrupt website peaks your site does not stop working.

Now since we are discussing EC2s which are like dedicated pieces of hardware we will assume the website does not run on shared hosting. So we are comparing with dedicated hosts or vds. Now getting extra servers is easy to say, but it costs if you want to predict usage (a digg effect, slashdot) and get extra servers. Also how much usage will you get? These maybe difficult numebrs to predict. It would be a lot easier if you could get servers when you need then, no hassle of installing you full software stack, and get it ready in a few minutes. Seems like the heaven of web serving? Well that is what EC2s are all about.

To start on what EC2s do in detail and how to use them from PHP (and other languages) its good to first read on Amazon's details about them (taken from their EC2 page, I was tired :P).

To use Amazon EC2, you simply:

  • Create an Amazon Machine Image (AMI) containing your applications, libraries, data and associated configuration settings. Or use pre-configured, templated images to get up and running immediately.
  • Upload the AMI into Amazon S3. Amazon EC2 provides tools that make storing the AMI simple. Amazon S3 provides a safe, reliable and fast repository to store your images.
  • Use Amazon EC2 web service to configure security and network access.
  • Choose which instance type(s) and operating system you want, then start, terminate, and monitor as many instances of your AMI as needed, using the web service APIs or the variety of management tools provided.
  • Determine whether you want to run in multiple locations, utilize static IP endpoints, or attach persistent block storage to your instances.
  • Pay only for the resources that you actually consume, like instance-hours or data transfer.

You will find those and other details on this page