Prelude : If you have the time, the patience and the ability to coerce and bribe people efficiently, you can save money by going directly to the passport office and interacting with the peon there. It seems that with good interaction skills, the passport can be had in a weeks time with a bribe of only 1000.
Preparation : If you lack the time, then, be prepared to spend around 4K. The list of documents required would be your
=> ID proof - pan card, Driving licence.
=> Residence proof - electricity bill, voter id card.
=> Age proof - school leaving certificate.
=> References - people who could vouch for you - someone who stays close by.
Step 1 : Look out for ads in newspapers for people who make passports. You can also ask people who hang around ATMs (offereing credit cards or policies). They generally work in association with the passport offices to "easily" get your form filled and application passed. When you are filling the application, remember to write your name and sign. Give all documents - they should not need the original documents (because they have some setup with the passport office). And pay them their "form submission fee" - which is passport fee + agent fee = around 2K. You can bargain. There are also agencies who specialize in making of passport and pan-card.
Step 2 : Followup with the "agent" to get the receipt of submission of application for passport. The actual process of creation of passport starts only after the application is submitted. If your agent has good connections and has greased the palms nicely with the money you have given, then you would get the receipt very fast.
Step 3 : Once the application receipt is in your hand - have another list of documents ready and wait -
=> ID proof
=> Residence proof - which shows residence at the location for more than a year.
=> Age proof
=> Residence proof of past addresses - at least two location where you have stayed earlier.
Step 4 : In 7-15 days time you would get an official from Intelligence department who would come to your house for verification. He would ask for all sorts of documents and keep you running around the house. The point he basically wants to make is that unless you grease his palms, he wont sign and forward the documents further. If you can show him all the documents he asks for, you will have an edge over him and may be able to bargain with him for the bribe money. Ofcourse he would start the bargain at 1K, but if your negotiation skills are good, you can bring him down to 500. Another point he will make is the police department (to whom he will be forwarding your app) can be bargained with - but do not trust him. The less you pay in the process of making him happy - the better.
Step 5 : Again wait for the police official who will come in a week's time. He will carry a file with him with maybe around 100 applications. He will start asking questions about where you have stayed earlier and the time of your stay. If you happen to carry residence proof of past addresses - you can have an edge over him. Else you have to just play along. If he threatens you that your past locations cannot be verified, dont worry - he is just trying to make you nervous - so he could extract more money in the bribe. Ask him gently about "how much would be needed to get the verification done ?" and he might ask for 1000 - again. If you try to bargain - he would say that he could make your application go around police stations for six months and your case will be lost. Dont worry - just bargain gently. If you tell him that the previous intelligence guy asked for the same amount - he would say that the guy had only a single sign to do - and he is supposed to get 3-4 signatures to do. Just play along and if possible, bring him down to 500. Pay him and wait.
Step 6 : Keep on checking the status of your passport online at http://passport.gov.in/. You will get a notification that your passport is on way. Keep a tab on the local post office and your snail-mail box.
Step 7 : A guy from the post may come to deliver the passport - within 15-20 days time. He would ask for "chai-pani". Dont offer him tea. Simply hand him 20-50 rs and get your passport.
The point to note here is that at every stage a hand has to be greased. Even if the details given by you are wrong, you would still get your passport if the hands are greased properly. Only the amount of grease will vary. With the 6th pay commission in force now - you might have hoped that the officials would be less greedy. But it has only lead to increase in the greed of the government officials and now they charge more for than before.
Friday, January 29, 2010
Monday, January 11, 2010
Forking Vs. Threading
What is Fork/Forking?
Fork is nothing but a new process that looks exactly like the old or the parent process but still it is a different process with different process ID and having it’s own memory. Parent process creates a separate address space for child. Both parent and child process possess the same code segment, but execute independently from each other.
The simplest example of forking is when you run a command on shell in unix/linux. Each time a user issues a command, the shell forks a child process and the task is done.
When a fork system call is issued, a copy of all the pages corresponding to the parent process is created, loaded into a separate memory location by the OS for the child process, but in certain cases, this is not needed. Like in ‘exec’ system calls, there is not need to copy the parent process pages, as execv replaces the address space of the parent process itself.
Few things to note about forking are:
Fork is universally accepted than thread because of the following reasons:
Some of the applications in which forking is used are: telnetd(freebsd), vsftpd, proftpd, Apache13, Apache2, thttpd, PostgreSQL.
Pitfalls in Fork:
What are Threads/Threading?
Threads are Light Weight Processes (LWPs). Traditionally, a thread is just a CPU (and some other minimal state) state with the process containing the remains (data, stack, I/O, signals). Threads require less overhead than “forking” or spawning a new process because the system does not initialize a new system virtual memory space and environment for the process. While most effective on a multiprocessor system where the process flow can be scheduled to run on another processor thus gaining speed through parallel or distributed processing, gains are also found on uniprocessor systems which exploit latency in I/O and other system functions which may halt process execution.
Threads in the same process share:
== Process instructions
== Most data
== open files (descriptors)
== signals and signal handlers
== current working directory
== User and group id
Each thread has a unique:
== Thread ID
== set of registers, stack pointer
== stack for local variables, return addresses
== signal mask
== priority
== Return value: errno
Few things to note about threading are:
Pitfalls in threads:
Advantages in threads:
Some of the applications in which threading is used are: MySQL, Firebird, Apache2, MySQL 323
FAQ’s:
1. Which should i use in my application ?
Ans: That depends on a lot of factors. Forking is more heavy-weight than threading, and have a higher startup and shutdown cost. Interprocess communication (IPC) is also harder and slower than interthread communication. Actually threads really win the race when it comes to inter communication. Conversely, whereas if a thread crashes, it takes down all of the other threads in the process, and if a thread has a buffer overrun, it opens up a security hole in all of the threads.
which would share the same address space with the parent process and they only needed a reduced context switch, which would make the context switch more efficient.
2. Which one is better, threading or forking ?
Ans: That is something which totally depends on what you are looking for. Still to answer, In a contemporary Linux (2.6.x) there is not much difference in performance between a context switch of a process/forking compared to a thread (only the MMU stuff is additional for the thread). There is the issue with the shared address space, which means that a faulty pointer in a thread can corrupt memory of the parent process or another thread within the same address space.
3. What kinds of things should be threaded or multitasked?
Ans: If you are a programmer and would like to take advantage of multithreading, the natural question is what parts of the program should/ should not be threaded. Here are a few rules of thumb (if you say “yes” to these, have fun!):
Conclusions:
1. Whether you have to use threading or forking, totally depends on the requirement of your application.
2. Threads more powerful than events, but power is not something which is always needed.
3. Threads are much harder to program than forking, so only for experts.
4. Use threads mostly for performance-critical applications.
source : http://www.geekride.com/index.php/2010/01/fork-forking-vs-thread-threading-linux-kernel/
Fork is nothing but a new process that looks exactly like the old or the parent process but still it is a different process with different process ID and having it’s own memory. Parent process creates a separate address space for child. Both parent and child process possess the same code segment, but execute independently from each other.
The simplest example of forking is when you run a command on shell in unix/linux. Each time a user issues a command, the shell forks a child process and the task is done.
When a fork system call is issued, a copy of all the pages corresponding to the parent process is created, loaded into a separate memory location by the OS for the child process, but in certain cases, this is not needed. Like in ‘exec’ system calls, there is not need to copy the parent process pages, as execv replaces the address space of the parent process itself.
Few things to note about forking are:
- The child process will be having it’s own unique process ID.
- The child process shall have it’s own copy of parent’s file descriptor.
- File locks set by parent process shall not be inherited by child process.
- Any semaphores that are open in the parent process shall also be open in the child process.
- Child process shall have it’s own copy of message queue descriptors of the parents.
- Child will have it’s own address space and memory.
Fork is universally accepted than thread because of the following reasons:
- Development is much easier on fork based implementations.
- Fork based code a more maintainable.
- Forking is much safer and more secure because each forked process runs in its own virtual address space. If one process crashes or has a buffer overrun, it does not affect any other process at all.
- Threads code is much harder to debug than fork.
- Fork are more portable than threads.
- Forking is faster than threading on single cpu as there are no locking over-heads or context switching.
Some of the applications in which forking is used are: telnetd(freebsd), vsftpd, proftpd, Apache13, Apache2, thttpd, PostgreSQL.
Pitfalls in Fork:
- In fork, every new process should have it’s own memory/address space, hence a longer startup and stopping time.
- If you fork, you have two independent processes which need to talk to each other in some way. This inter-process communication is really costly.
- When the parent exits before the forked child, you will get a ghost process. That is all much easier with a thread. You can end, suspend and resume threads from the parent easily. And if your parent exits suddenly the thread will be ended automatically.
- In-sufficient storage space could lead the fork system to fail.
What are Threads/Threading?
Threads are Light Weight Processes (LWPs). Traditionally, a thread is just a CPU (and some other minimal state) state with the process containing the remains (data, stack, I/O, signals). Threads require less overhead than “forking” or spawning a new process because the system does not initialize a new system virtual memory space and environment for the process. While most effective on a multiprocessor system where the process flow can be scheduled to run on another processor thus gaining speed through parallel or distributed processing, gains are also found on uniprocessor systems which exploit latency in I/O and other system functions which may halt process execution.
Threads in the same process share:
== Process instructions
== Most data
== open files (descriptors)
== signals and signal handlers
== current working directory
== User and group id
Each thread has a unique:
== Thread ID
== set of registers, stack pointer
== stack for local variables, return addresses
== signal mask
== priority
== Return value: errno
Few things to note about threading are:
- Thread are most effective on multi-processor or multi-core systems.
- For thread – only one process/thread table and one scheduler is needed.
- All threads within a process share the same address space.
- A thread does not maintain a list of created threads, nor does it know the thread that created it.
- Threads reduce overhead by sharing fundamental parts.
- Threads are more effective in memory management because they uses the same memory block of the parent instead of creating new.
Pitfalls in threads:
- Race conditions: The big loss with threads is that there is no natural protection from having multiple threads working on the same data at the same time without knowing that others are messing with it. This is called race condition. While the code may appear on the screen in the order you wish the code to execute, threads are scheduled by the operating system and are executed at random. It cannot be assumed that threads are executed in the order they are created. They may also execute at different speeds. When threads are executing (racing to complete) they may give unexpected results (race condition). Mutexes and joins must be utilized to achieve a predictable execution order and outcome.
- Thread safe code: The threaded routines must call functions which are “thread safe”. This means that there are no static or global variables which other threads may clobber or read assuming single threaded operation. If static or global variables are used then mutexes must be applied or the functions must be re-written to avoid the use of these variables. In C, local variables are dynamically allocated on the stack. Therefore, any function that does not use static data or other shared resources is thread-safe. Thread-unsafe functions may be used by only one thread at a time in a program and the uniqueness of the thread must be ensured. Many non-reentrant functions return a pointer to static data. This can be avoided by returning dynamically allocated data or using caller-provided storage. An example of a non-thread safe function is strtok which is also not re-entrant. The “thread safe” version is the re-entrant version strtok_r.
Advantages in threads:
- Threads share the same memory space hence sharing data between them is really faster means inter-process communication (IPC) is real fast.
- If properly designed and implemented threads give you more speed because there aint any process level context switching in a multi threaded application.
- .Threads are really fast to start and terminate
Some of the applications in which threading is used are: MySQL, Firebird, Apache2, MySQL 323
FAQ’s:
1. Which should i use in my application ?
Ans: That depends on a lot of factors. Forking is more heavy-weight than threading, and have a higher startup and shutdown cost. Interprocess communication (IPC) is also harder and slower than interthread communication. Actually threads really win the race when it comes to inter communication. Conversely, whereas if a thread crashes, it takes down all of the other threads in the process, and if a thread has a buffer overrun, it opens up a security hole in all of the threads.
which would share the same address space with the parent process and they only needed a reduced context switch, which would make the context switch more efficient.
2. Which one is better, threading or forking ?
Ans: That is something which totally depends on what you are looking for. Still to answer, In a contemporary Linux (2.6.x) there is not much difference in performance between a context switch of a process/forking compared to a thread (only the MMU stuff is additional for the thread). There is the issue with the shared address space, which means that a faulty pointer in a thread can corrupt memory of the parent process or another thread within the same address space.
3. What kinds of things should be threaded or multitasked?
Ans: If you are a programmer and would like to take advantage of multithreading, the natural question is what parts of the program should/ should not be threaded. Here are a few rules of thumb (if you say “yes” to these, have fun!):
- Are there groups of lengthy operations that don’t necessarily depend on other processing (like painting a window, printing a document, responding to a mouse-click, calculating a spreadsheet column, signal handling, etc.)?
- Will there be few locks on data (the amount of shared data is identifiable and “small”)?
- Are you prepared to worry about locking (mutually excluding data regions from other threads), deadlocks (a condition where two COEs have locked data that other is trying to get) and race conditions (a nasty, intractable problem where data is not locked properly and gets corrupted through threaded reads & writes)?
- Could the task be broken into various “responsibilities”? E.g. Could one thread handle the signals, another handle GUI stuff, etc.?
Conclusions:
1. Whether you have to use threading or forking, totally depends on the requirement of your application.
2. Threads more powerful than events, but power is not something which is always needed.
3. Threads are much harder to program than forking, so only for experts.
4. Use threads mostly for performance-critical applications.
source : http://www.geekride.com/index.php/2010/01/fork-forking-vs-thread-threading-linux-kernel/
Friday, December 25, 2009
Gearman with php and mysql
In the earlier post we learned how to push jobs from the client to the worker. What we will try to do here is to use php script - the same worker we developed last time to process queries in the mysql server. That is to use gearman to process requests posted inside mysql client.
We would need the mysql UDFs for gearman which could be downloaded from the gearman.org
http://gearman.org/index.php?id=download#databases
Once you have downloaded the gearman mysql UDFs, untar it and compile it. I am using gearman-mysql-udf version 0.4 and mysql version 5.1.30 installed in path /usr/local/mysql here.
tar -xvzf gearman-mysql-udf-0.4.tar.gz
cd gearman-mysql-udf-0.4/
./configure --with-mysql=/usr/local/mysql/bin/mysql_config --libdir=/usr/local/mysql/lib/plugin/
make
sudo make install
check if the so files have been installed properly
jayant@gamegeek:~$ ls /usr/local/mysql/lib/plugin/
libdaemon_example.a libdaemon_example.so.0 libgearman_mysql_udf.la libgearman_mysql_udf.so.0.0.0 mypluglib.so
libdaemon_example.la libdaemon_example.so.0.0.0 libgearman_mysql_udf.so mypluglib.a mypluglib.so.0
libdaemon_example.so libgearman_mysql_udf.a libgearman_mysql_udf.so.0 mypluglib.la mypluglib.so.0.0.0
You wll see libgearman_mysql_udf.* files here.
Now load the gearman-mysql-udfs into mysql using the following queries
CREATE FUNCTION gman_do RETURNS STRING
SONAME "libgearman_mysql_udf.so";
CREATE FUNCTION gman_do_high RETURNS STRING
SONAME "libgearman_mysql_udf.so";
CREATE FUNCTION gman_do_low RETURNS STRING
SONAME "libgearman_mysql_udf.so";
CREATE FUNCTION gman_do_background RETURNS STRING
SONAME "libgearman_mysql_udf.so";
CREATE FUNCTION gman_do_high_background RETURNS STRING
SONAME "libgearman_mysql_udf.so";
CREATE FUNCTION gman_do_low_background RETURNS STRING
SONAME "libgearman_mysql_udf.so";
CREATE AGGREGATE FUNCTION gman_sum RETURNS INTEGER
SONAME "libgearman_mysql_udf.so";
CREATE FUNCTION gman_servers_set RETURNS STRING
SONAME "libgearman_mysql_udf.so";
check whether they have been properly loaded. log into mysql and run.
Now lets try calling the reverse function we developed in php to process some work from mysql client. For this.
start gearmand if it is not running
gearmand
start the worker
php -q gearmanWorker.php
log into mysql and run the following queries.
select gman_servers_set('127.0.0.1');
SELECT gman_do("reverse", Host) AS test FROM mysql.user;
The output is as below....

Here we have simply said that all functions would be processed by worker running on 127.0.0.1.
We could also set function wise servers - different servers for different functions
SELECT gman_servers_set("192.168.1.1", "sortme");
SELECT gman_servers_set("192.168.1.2", "reverseme");
And multiple servers for the same function.
SELECT gman_servers_set("192.168.1.3:4730,192.168.1.4:4730", "factorialme");
Interesting, right??
Enjoy!!!
We would need the mysql UDFs for gearman which could be downloaded from the gearman.org
http://gearman.org/index.php?id=download#databases
Once you have downloaded the gearman mysql UDFs, untar it and compile it. I am using gearman-mysql-udf version 0.4 and mysql version 5.1.30 installed in path /usr/local/mysql here.
tar -xvzf gearman-mysql-udf-0.4.tar.gz
cd gearman-mysql-udf-0.4/
./configure --with-mysql=/usr/local/mysql/bin/mysql_config --libdir=/usr/local/mysql/lib/plugin/
make
sudo make install
check if the so files have been installed properly
jayant@gamegeek:~$ ls /usr/local/mysql/lib/plugin/
libdaemon_example.a libdaemon_example.so.0 libgearman_mysql_udf.la libgearman_mysql_udf.so.0.0.0 mypluglib.so
libdaemon_example.la libdaemon_example.so.0.0.0 libgearman_mysql_udf.so mypluglib.a mypluglib.so.0
libdaemon_example.so libgearman_mysql_udf.a libgearman_mysql_udf.so.0 mypluglib.la mypluglib.so.0.0.0
You wll see libgearman_mysql_udf.* files here.
Now load the gearman-mysql-udfs into mysql using the following queries
CREATE FUNCTION gman_do RETURNS STRING
SONAME "libgearman_mysql_udf.so";
CREATE FUNCTION gman_do_high RETURNS STRING
SONAME "libgearman_mysql_udf.so";
CREATE FUNCTION gman_do_low RETURNS STRING
SONAME "libgearman_mysql_udf.so";
CREATE FUNCTION gman_do_background RETURNS STRING
SONAME "libgearman_mysql_udf.so";
CREATE FUNCTION gman_do_high_background RETURNS STRING
SONAME "libgearman_mysql_udf.so";
CREATE FUNCTION gman_do_low_background RETURNS STRING
SONAME "libgearman_mysql_udf.so";
CREATE AGGREGATE FUNCTION gman_sum RETURNS INTEGER
SONAME "libgearman_mysql_udf.so";
CREATE FUNCTION gman_servers_set RETURNS STRING
SONAME "libgearman_mysql_udf.so";
check whether they have been properly loaded. log into mysql and run.
mysql> select * from mysql.func;
+-------------------------+-----+-------------------------+-----------+
| name | ret | dl | type |
+-------------------------+-----+-------------------------+-----------+
| gman_do | 0 | libgearman_mysql_udf.so | function |
| gman_do_high | 0 | libgearman_mysql_udf.so | function |
| gman_do_low | 0 | libgearman_mysql_udf.so | function |
| gman_do_background | 0 | libgearman_mysql_udf.so | function |
| gman_do_high_background | 0 | libgearman_mysql_udf.so | function |
| gman_do_low_background | 0 | libgearman_mysql_udf.so | function |
| gman_sum | 2 | libgearman_mysql_udf.so | aggregate |
| gman_servers_set | 0 | libgearman_mysql_udf.so | function |
+-------------------------+-----+-------------------------+-----------+
8 rows in set (0.00 sec)
Now lets try calling the reverse function we developed in php to process some work from mysql client. For this.
start gearmand if it is not running
gearmand
start the worker
php -q gearmanWorker.php
log into mysql and run the following queries.
select gman_servers_set('127.0.0.1');
SELECT gman_do("reverse", Host) AS test FROM mysql.user;
The output is as below....

Here we have simply said that all functions would be processed by worker running on 127.0.0.1.
We could also set function wise servers - different servers for different functions
SELECT gman_servers_set("192.168.1.1", "sortme");
SELECT gman_servers_set("192.168.1.2", "reverseme");
And multiple servers for the same function.
SELECT gman_servers_set("192.168.1.3:4730,192.168.1.4:4730", "factorialme");
Interesting, right??
Enjoy!!!
Using gearman to distribute your work...
Gearman is a system to farm out work to other machines, dispatching function calls to machines that are better suited to do work, to do work in parallel, to load balance lots of function calls, or to call functions between languages.
How does gearman work? Well, a gearman powered app consists of a client, a worker and a job server. The client creats a job and sends it to the job server. The job server finds a suitable worker and sends the job to the worker. Once the job is done, the worker sends the response back to the client via the job server. There are client and worker APIs available for gearman for different languages which allow the app to communicate with the job server.
Too heavy is it... Lets check how this thing actually runs.
Download gearman daemon from http://gearman.org/index.php?id=download
You would need the "Gearman server and library" - the one written in c. And a php extension which we will use to create and communicate with our workers.
I am using gearmand version 0.11, gearman extension for php version 0.60 and php version 5.3 here.
extract the gearmand server and install it using
./configure
make
sudo make install
extract the php extension for gearman and install it using
phpize
./configure
make
sudo make install
Enable the extension in php.ini. Add the following line in php.ini
extension=gearman.so
To check if the extension has been enabled run
php -i | grep -i gearman
And you will see something like
gearman
gearman support => enabled
libgearman version => 0.11
Now lets write some scripts and check how this works
Create a php client :
Create a php worker :
To test the process
start the gearmand server
gearmand
start the worker
php -q gearmanWorker.php
And send jobs to the worker
php -q gearmanClient.php
The output is as below
How does gearman work? Well, a gearman powered app consists of a client, a worker and a job server. The client creats a job and sends it to the job server. The job server finds a suitable worker and sends the job to the worker. Once the job is done, the worker sends the response back to the client via the job server. There are client and worker APIs available for gearman for different languages which allow the app to communicate with the job server.
Too heavy is it... Lets check how this thing actually runs.
Download gearman daemon from http://gearman.org/index.php?id=download
You would need the "Gearman server and library" - the one written in c. And a php extension which we will use to create and communicate with our workers.
I am using gearmand version 0.11, gearman extension for php version 0.60 and php version 5.3 here.
extract the gearmand server and install it using
./configure
make
sudo make install
extract the php extension for gearman and install it using
phpize
./configure
make
sudo make install
Enable the extension in php.ini. Add the following line in php.ini
extension=gearman.so
To check if the extension has been enabled run
php -i | grep -i gearman
And you will see something like
gearman
gearman support => enabled
libgearman version => 0.11
Now lets write some scripts and check how this works
Create a php client :
<?php
# Create our client object.
$client= new GearmanClient();
# Add default server (localhost).
$client->addServer();
echo "Sending job\n";
# Send reverse job
$result = $client->do("reverse", "Hello World");
if ($result)
echo "Success: $result\n";
?>
Create a php worker :
<?php
# Create our worker object.
$worker= new GearmanWorker();
# Add default server (localhost).
$worker->addServer();
# Register function "reverse" with the server.
$worker->addFunction("reverse", "reverse_fn");
while (1)
{
print "Waiting for job...\n";
$ret= $worker->work();
if ($worker->returnCode() != GEARMAN_SUCCESS)
break;
}
# A much simple reverse function
function reverse_fn($job)
{
$workload= $job->workload();
echo "Received job: " . $job->handle() . "\n";
echo "Workload: $workload\n";
$result= strrev($workload);
echo "Result: $result\n";
return $result;
}
?>
To test the process
start the gearmand server
gearmand
start the worker
php -q gearmanWorker.php
And send jobs to the worker
php -q gearmanClient.php
The output is as below

Thursday, December 10, 2009
Sql Antipatterns Strike Back
SQL Antipatterns strike back by Bill Karwin
Sql Antipatterns Strike Back
View more documents from Karwin Software Solutions LLC.
Wednesday, December 09, 2009
Using ssh tunneling to tunnel your browser requests.
You will need :
creating the tunnel :
The way to create the tunnel is
ssh -D 8888 <your_username>@<your_machine_ip_or_host>
What this command does is it hands over requests to localhost port 8888 to the server that you have specified. Ofcourse, you will have to login and authenticate yourself for the requests to reach the server. You can do this on whichever server you have access to. Using localhost would be the best.
Configure your browser :
To set socks proxy on firefox go to
Edit->Preferences->Advanced->Network->Settings
Enter socks host as localhost and socks port as 8888. And bingo now your requests are being tunneled from your browser to the ssh server through a ssh tunnel. And from there to the web server.
You can use www.whatismyip.com to check the external ip address of your machine.
You can use foxy proxy extension in firefox to have different proxy settings for different sites.
- A ssh server - a machine with access to the net which has ssh server installed on it. We will use this server to forward our requests. You should have access to the server.
- A ssh client - installed on your machine.
- A web browser - preferably firefox or internet explorer. Most basic browsers do not support socks proxy.
creating the tunnel :
The way to create the tunnel is
ssh -D 8888 <your_username>@<your_machine_ip_or_host>
What this command does is it hands over requests to localhost port 8888 to the server that you have specified. Ofcourse, you will have to login and authenticate yourself for the requests to reach the server. You can do this on whichever server you have access to. Using localhost would be the best.
Configure your browser :
To set socks proxy on firefox go to
Edit->Preferences->Advanced->Network->Settings
Enter socks host as localhost and socks port as 8888. And bingo now your requests are being tunneled from your browser to the ssh server through a ssh tunnel. And from there to the web server.
You can use www.whatismyip.com to check the external ip address of your machine.
You can use foxy proxy extension in firefox to have different proxy settings for different sites.
Sunday, November 29, 2009
A brief on using amazon web services.
Recently we decided to use aws for doing some benchmarks. Why - it is cheaper than getting a system, setting them up and configuring them. But using aws for a long time may prove costly.
So, i went to http://aws.amazon.com and signed up with the service. You need to provide a valid credit card no and your phone no before the services are activated. The UI is quite confusing and at times you are not aware whether you are logged in or not. There might also be a case where you think that you are logged in but you would still be asked your password to access some other service.
The best place to start is the "Your Account" section on the top right hand corner. There are two services which are of interest.
Amazon s3 : Simple storage service
Amazon ec2 : Elastic compute cloud
There are two ways to access these services. All ways are available in the "security credentials" tab on the left hand panel after logging in. One way is to create an access key - which provides a access key id and a secret access key - similar to a username & password. Both need to be passed while communicating with the machines. Another way is to generate a X.509 certificate - it also generates a public and a private key.
S3 is a storage space on amazon. The easiest way to access it is using the s3cmd tool available at http://s3tools.org/s3cmd. You can create your own directory and put and get files from the s3 store. Another way of accessing S3 is by using the firefox extension - elasticfox. Once the keys are in place in elasticfox, it provides an interface similar to fileftp with drag-drop features. It looks cool. S3 could only be used to store and retrieve data. If you are thinking about mounting an s3 drive on an ec2 instance to transfer data - better forget it. It would require you to mount the s3 device using fuse and it might take a lot of time to set it up. And there is another way of storing data for EC2.
EC2 is a virtual machine available for computing. You can start an instance of the virtual machine and run your processing on it. The good thing is that there is no need to install the OS of your choice. All you need to do is simply choose the type of machine and the OS and within seconds, the machine is available. You can simply ssh into the machine and start running your processing on it. The bad thing about ec2 is that it does not store your data. Once your processing is done and you turn off or terminate the machine, there is no way of getting back the machine or the data that was there on the machine. The data is lost in the cloud. Like discussed earlier storing data in S3 and mounting it on EC2 might be an option. But a better option is to create an EBS(Elastic Block Storage) volume and attach it to the EC2 instance.
The way to go about all this is logging in to the AWS management console - which is again on the left hand panel. It gives you a dashboard. First of all try launching an instance. It would ask you for the type of instance you want to launch - so you can launch a 32 bit centos instance or a 64 bit ubuntu instance and all you have to do is choose the related AMI (Amazon Machine Image). But be careful, there are some paid AMIs as well - so something like the RHEL instance might be paid and you will have to pay to launch it.
For creating an EBS, you will have to go to the left hand panel again and create a volume. You have to specify the size and the availability zone. An EBS can only be mounted on an Instance if it is in the same availability zone. So be careful about it. Select the zone, where your instance is running. You can create as large a volume you want because you are charged for the data in the volume and not for the volume size. So, if you create a 100 GB volume and put data of only 5 GB in it, you will be charged only for 5GB. Once the volume is created - attach it to the instance - the option is availabe on the web interface.
Now to access the volume you will need to create a filesystem on it and mount it. So, for example if you have attached the EBS volume at /dev/sdf on the instance currently running simply create a filesystem on it.
ssh -i private_key.pem root@ec2-public-dns-name-for-your-instance.com [login to your ec2 instance]
mke2fs -j /dev/sdf [create ex3 filesystem]
mkdir /mnt/vol
mount /dev/sdf /mnt/vol [mount the volume]
Now you can work on your ec2 machine and store data on /mnt/vol. When you are done, it is better to take a snapshot of your volume using the tools in the amazon web console and then turn off your instance. Next time you need to work, simply mount the EBS volume on a new instance that you have started and all your data is readily available.
Another way of going about it is creating an amazon AMI after you have done setup of your machine - and use the AMI to boot further machines that you would need. You can download amazon ec2 api tools and the amazon ec2 ami tools which can help in creating AMIs and running them.
If you want to setup networking between the multiple instances, you need to do some extra effort. Of course by default all amazon running instances could ssh to each other using their private IPs and public DNSes. But to communicate on other ports, the ports need to be opened up. To do this simply use the "security groups" link on the left hand panel of the AWS management console. Select a group - default if you did not create any other group and open up the ports that you need.
And the most important advice - do not forget to turn down your instance after you are through with it - remember, you are billed by the hour.
So, i went to http://aws.amazon.com and signed up with the service. You need to provide a valid credit card no and your phone no before the services are activated. The UI is quite confusing and at times you are not aware whether you are logged in or not. There might also be a case where you think that you are logged in but you would still be asked your password to access some other service.
The best place to start is the "Your Account" section on the top right hand corner. There are two services which are of interest.
Amazon s3 : Simple storage service
Amazon ec2 : Elastic compute cloud
There are two ways to access these services. All ways are available in the "security credentials" tab on the left hand panel after logging in. One way is to create an access key - which provides a access key id and a secret access key - similar to a username & password. Both need to be passed while communicating with the machines. Another way is to generate a X.509 certificate - it also generates a public and a private key.
S3 is a storage space on amazon. The easiest way to access it is using the s3cmd tool available at http://s3tools.org/s3cmd. You can create your own directory and put and get files from the s3 store. Another way of accessing S3 is by using the firefox extension - elasticfox. Once the keys are in place in elasticfox, it provides an interface similar to fileftp with drag-drop features. It looks cool. S3 could only be used to store and retrieve data. If you are thinking about mounting an s3 drive on an ec2 instance to transfer data - better forget it. It would require you to mount the s3 device using fuse and it might take a lot of time to set it up. And there is another way of storing data for EC2.
EC2 is a virtual machine available for computing. You can start an instance of the virtual machine and run your processing on it. The good thing is that there is no need to install the OS of your choice. All you need to do is simply choose the type of machine and the OS and within seconds, the machine is available. You can simply ssh into the machine and start running your processing on it. The bad thing about ec2 is that it does not store your data. Once your processing is done and you turn off or terminate the machine, there is no way of getting back the machine or the data that was there on the machine. The data is lost in the cloud. Like discussed earlier storing data in S3 and mounting it on EC2 might be an option. But a better option is to create an EBS(Elastic Block Storage) volume and attach it to the EC2 instance.
The way to go about all this is logging in to the AWS management console - which is again on the left hand panel. It gives you a dashboard. First of all try launching an instance. It would ask you for the type of instance you want to launch - so you can launch a 32 bit centos instance or a 64 bit ubuntu instance and all you have to do is choose the related AMI (Amazon Machine Image). But be careful, there are some paid AMIs as well - so something like the RHEL instance might be paid and you will have to pay to launch it.
For creating an EBS, you will have to go to the left hand panel again and create a volume. You have to specify the size and the availability zone. An EBS can only be mounted on an Instance if it is in the same availability zone. So be careful about it. Select the zone, where your instance is running. You can create as large a volume you want because you are charged for the data in the volume and not for the volume size. So, if you create a 100 GB volume and put data of only 5 GB in it, you will be charged only for 5GB. Once the volume is created - attach it to the instance - the option is availabe on the web interface.
Now to access the volume you will need to create a filesystem on it and mount it. So, for example if you have attached the EBS volume at /dev/sdf on the instance currently running simply create a filesystem on it.
ssh -i private_key.pem root@ec2-public-dns-name-for-your-instance.com [login to your ec2 instance]
mke2fs -j /dev/sdf [create ex3 filesystem]
mkdir /mnt/vol
mount /dev/sdf /mnt/vol [mount the volume]
Now you can work on your ec2 machine and store data on /mnt/vol. When you are done, it is better to take a snapshot of your volume using the tools in the amazon web console and then turn off your instance. Next time you need to work, simply mount the EBS volume on a new instance that you have started and all your data is readily available.
Another way of going about it is creating an amazon AMI after you have done setup of your machine - and use the AMI to boot further machines that you would need. You can download amazon ec2 api tools and the amazon ec2 ami tools which can help in creating AMIs and running them.
If you want to setup networking between the multiple instances, you need to do some extra effort. Of course by default all amazon running instances could ssh to each other using their private IPs and public DNSes. But to communicate on other ports, the ports need to be opened up. To do this simply use the "security groups" link on the left hand panel of the AWS management console. Select a group - default if you did not create any other group and open up the ports that you need.
And the most important advice - do not forget to turn down your instance after you are through with it - remember, you are billed by the hour.
Wednesday, November 25, 2009
permutation & combination
Definition:
Permutation:
An arrangement is called a Permutation. It is the rearrangement of objects or symbols into distinguishable sequences. When we set things in order, we say we have made an arrangement. When we change the order, we say we have changed the arrangement. So each of the arrangement that can be made by taking some or all of a number of things is known as Permutation.
Combination:
A Combination is a selection of some or all of a number of different objects. It is an un-ordered collection of unique sizes.In a permutation the order of occurence of the objects or the arrangement is important but in combination the order of occurence of the objects is not important.
Formula:
Permutation = nPr = n! / (n-r)!
Combination = nCr = nPr / r!
where,
n, r are non negative integers and r<=n.
r is the size of each permutation.
n is the size of the set from which elements are permuted.
! is the factorial operator.
Example:Find the number of permutations and combinations: n=6; r=4.
Step 1: Find the factorial of 6.
6! = 6×5×4×3×2×1 = 720
Step 2: Find the factorial of 6-4.
(6-4)! = 2! = 2
Step 3: Divide 720 by 2.
Permutation = 720/2 = 360
Step 4: Find the factorial of 4.
4! = 4×3×2×1 = 24
Step 5:Divide 360 by 24.
Combination = 360/24 = 15
Permutation:
An arrangement is called a Permutation. It is the rearrangement of objects or symbols into distinguishable sequences. When we set things in order, we say we have made an arrangement. When we change the order, we say we have changed the arrangement. So each of the arrangement that can be made by taking some or all of a number of things is known as Permutation.
Combination:
A Combination is a selection of some or all of a number of different objects. It is an un-ordered collection of unique sizes.In a permutation the order of occurence of the objects or the arrangement is important but in combination the order of occurence of the objects is not important.
Formula:
Permutation = nPr = n! / (n-r)!
Combination = nCr = nPr / r!
where,
n, r are non negative integers and r<=n.
r is the size of each permutation.
n is the size of the set from which elements are permuted.
! is the factorial operator.
Example:Find the number of permutations and combinations: n=6; r=4.
Step 1: Find the factorial of 6.
6! = 6×5×4×3×2×1 = 720
Step 2: Find the factorial of 6-4.
(6-4)! = 2! = 2
Step 3: Divide 720 by 2.
Permutation = 720/2 = 360
Step 4: Find the factorial of 4.
4! = 4×3×2×1 = 24
Step 5:Divide 360 by 24.
Combination = 360/24 = 15
Sunday, November 22, 2009
GPG Error: ... : NO_PUBKEY D739676F7613768D
You run an apt-get update and it gives some errors which are difficult to comprehend. The output looks some like this
Fetched 924B in 2s (352B/s)
W: GPG error: http://ppa.launchpad.net karmic Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY D739676F7613768D
W: GPG error: http://ppa.launchpad.net karmic Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 2836CB0A8AC93F7A
W: GPG error: http://ppa.launchpad.net karmic Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 2836CB0A8AC93F7A
What to do... How to remove these errors. Well, some public keys are unavailable due to which these errors are happening. Ok, ok, but how to go about it? How do i fix it?
The easiest way is to get this script. The script does not enable the PPAs that are disabled. But for all enabled PPAs it fetches their keys and installs them
Make the script executable
$ chmod a+x launchpad-update
And run the script
Thats it... Done...
Now if you run sudo apt-get update, you should not get any errors about PUBKEYs...
Fetched 924B in 2s (352B/s)
W: GPG error: http://ppa.launchpad.net karmic Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY D739676F7613768D
W: GPG error: http://ppa.launchpad.net karmic Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 2836CB0A8AC93F7A
W: GPG error: http://ppa.launchpad.net karmic Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 2836CB0A8AC93F7A
What to do... How to remove these errors. Well, some public keys are unavailable due to which these errors are happening. Ok, ok, but how to go about it? How do i fix it?
The easiest way is to get this script. The script does not enable the PPAs that are disabled. But for all enabled PPAs it fetches their keys and installs them
jayant@gamegeek:~/bin$ cat launchpad-update
#! /bin/sh
# Simple script to check for all PPAs refernced in your apt sources and
# to grab any signing keys you are missing from keyserver.ubuntu.com.
# Additionally copes with users on launchpad with multiple PPAs
# (e.g., ~asac)
#
# Author: Dominic Evans https://launchpad.net/~oldman
# License: LGPL v2
for APT in `find /etc/apt/ -name *.list`; do
grep -o "^deb http://ppa.launchpad.net/[a-z0-9\-]\+/[a-z0-9\-]\+" $APT | while read ENTRY ; do
# work out the referenced user and their ppa
USER=`echo $ENTRY | cut -d/ -f4`
PPA=`echo $ENTRY | cut -d/ -f5`
# some legacy PPAs say 'ubuntu' when they really mean 'ppa', fix that up
if [ "ubuntu" = "$PPA" ]
then
PPA=ppa
fi
# scrape the ppa page to get the keyid
KEYID=`wget -q --no-check-certificate https://launchpad.net/~$USER/+archive/$PPA -O- | grep -o "1024R/[A-Z0-9]\+" | cut -d/ -f2`
sudo apt-key adv --list-keys $KEYID >/dev/null 2>&1
if [ $? != 0 ]
then
echo Grabbing key $KEYID for archive $PPA by ~$USER
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com $KEYID
else
echo Already have key $KEYID for archive $PPA by ~$USER
fi
done
done
echo DONE
Make the script executable
$ chmod a+x launchpad-update
And run the script
jayant@gamegeek:~/bin$ sudo ./launchpad-update
Grabbing key 7613768D for archive vlc by ~c-korn
Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /etc/apt/secring.gpg --trustdb-name /etc/apt/trustdb.gpg --keyring /etc/apt/trusted.gpg --recv-keys --keyserver keyserver.ubuntu.com 7613768D
gpg: requesting key 7613768D from hkp server keyserver.ubuntu.com
gpg: key 7613768D: public key "Launchpad PPA named vlc for Christoph Korn" imported
gpg: no ultimately trusted keys found
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)
Already have key 4E5E17B5 for archive ppa by ~chromium-daily
Grabbing key 8AC93F7A for archive backports by ~kubuntu-ppa
Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /etc/apt/secring.gpg --trustdb-name /etc/apt/trustdb.gpg --keyring /etc/apt/trusted.gpg --recv-keys --keyserver keyserver.ubuntu.com 8AC93F7A
gpg: requesting key 8AC93F7A from hkp server keyserver.ubuntu.com
gpg: key 8AC93F7A: public key "Launchpad Kubuntu Updates" imported
gpg: no ultimately trusted keys found
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)
Already have key 8AC93F7A for archive staging by ~kubuntu-ppa
DONE
Thats it... Done...
Now if you run sudo apt-get update, you should not get any errors about PUBKEYs...
Tuesday, November 10, 2009
Bombay & Delhi - very precise article describing both...
He is a large amiable boy who smiles at breasts as if they are acquaintances. He suspects he is good looking, and he probably is, especially when he is quiet. A pretty white girl walks into this London pub and he nudges the elbow of a friend. As his eyes follow her to the far corner, his face assumes a sudden seriousness. He then takes her pictures with his phone camera. He tries to meet the eyes of any woman in the pub so that he can flash a smile. He has heard that white women are broadminded. “I like to hear white women scream under me,” he says. A Bengali sitting beside him says he must become a midwife then. Everybody laughs. He stares at the Bengali who is a much smaller man, and he slaps him a few times. Others now rise and try to drag him away. He growls, not metaphorically but really growls. And he says, “I’m a baaad guy, I’m a baaad guy.” He is, of course, a jat from Delhi whose matrimonial ad had once said, accurately, that he is from a good family. He has travelled the world. He studied briefly in the First World, even. There are thousands like him in Delhi, the natural habitat of a kind.
Delhi is a vast medieval town of indisputable botanical beauty, spectacular red ruins, Sheila Dixit, and other charms. Its women, rumoured to be high maintenance as if there is another kind, take so much care of themselves that one would think the men are worth it (but they make a gesture that suggests puking when asked to confirm). Space is not compressed here. Everything is far from everything else. There are real gardens where you do not see the exit when you stand at the entrance. It has sudden small parks that in Bombay would have been called, ‘Chhatrapati Shivaji Mini Forest’. Homes have corridors, and they are called corridors, not half-bedrooms. Yet, Delhi has a bestial smallness of purpose.
Those men there who drive the long phallic cars, sometimes holding a beer bottle in one hand, there is something uncontrollable about them. Even for a man, it is hard to understand their mutation. What is the swagger about? What is the great pride in driving your father’s BMW, what is the glory in being a sperm? And what is the great achievement in stepping on the accelerator? It is merely automobile engineering—press harder on the pedal and the car will move faster. Why do you think a girl will mate with you for that? It is somehow natural that the contemporary version of Devdas, Anurag Kashyap’s Dev D, would be set in Delhi, where a man can debase himself because life does not challenge him, he has no purpose, whose happiness is a type of sorrow. This motiveless Delhi male, you can argue, can be found in Bombay too, where not all BMWs are hard earned. But that’s not very different from saying Bombay, too, has bungalows.
Like a rich man’s son, Delhi is a beneficiary of undeserved privileges. That is at the heart of Bombay’s contempt for Delhi. Bombay is a natural city, like all great port cities of the world. It was not created. It had to arrive at a particular moment in time, it was an inevitability caused by geography, shipping and shallow waters. Bombay eventually earned its right to be a financial force through the power of enterprise, which created a system that allowed, to some extent, anyone to stake a claim at wealth through hard work. That culture still exists. It is the very basis of Bombay. That is the whole point of Bombay.
But Delhi as a centre of power is an inheritance, a historical habit. An unbearable consequence of this is the proximity of easy funds for various alleged intellectual pursuits which has enabled it to appropriate the status of intellectual centre. It is a scholarship city, a city of think tanks, of men who deal in discourse, debates and policies. And of fake serious women who wear the sari the other way and become leftists, nature lovers and diurnal feminists.
Delhi, often, confuses seriousness with intelligence and humour with flippancy. People will not be taken seriously here if they are not, well, serious. There is much weight attached to the imagined sophistication of talk, of gas. It is a city of talkers. There is always The Discussion. When you are in Delhi, you have to talk, and then they talk, and they appear to be solving an enigma, they seem headed towards achieving some revelation. But then, you realise, they were peeling an onion, an act that leads to more peels and at the heart of it all, there is nothing. Delhi is an onion. It is a void-delivery device.
Of course, all this is a generalisation, but then generalisation is a form of truth. One of the most repulsive images I bear in mind of Delhi is a scene in JNU, when Venezuelan president Hugo Chavez delivered a special lecture. It was like a rock concert and Chavez, who is a scion of the same imbecilic philosophy that once destroyed the great economies of South America, was the star. As students pumped their hands in the air and cheered him for his anti-capitalist calling, I looked at their faces. I knew those faces. They were from homes that once profited from India’s socialist corruption, and then from Manmohan’s revolution. They were hip. They would, of course, later join MNCs and chuckle at their youthful romanticism. That moment in JNU was despicable because it captured a meaningless aspect of Delhi’s fiery intellectuality, and also laid bare the crucial difference between intellectuality, which is borrowed conviction, and intelligence, which is creativity, innovation and original analysis.
It is for the same reason that the greatest misfortune of Indian journalism is that it is headquartered in Delhi. Needless to say, like in any other city, Delhi has astonishingly talented editors, journalists and writers, but there is a Delhi mental condition which is incurable—a fake intensity, a fraudulent concern for ‘issues’, the grand stand. Readers, on the other hand, have many interests today apart from democracy, policies and the perpetual misery of the poor. But the Indian media, based in Delhi, refused to see it until recently and very grudgingly, when The Times of India proved it. It is not a coincidence that The Times Group, the most profitable media organisation in India, is based in Bombay. It is not a coincidence that the game changer came from here. In Bombay it is hard to convert air from either side of your alimentary canal into cash. You have to do something here. You have to work. It is appropriate that the National School of Drama, with its phoney distaste for money, is in Delhi. And commercial cinema is in Bombay.
It must be said though that in recent times Delhi has become somewhat more endearing. This is partly because of Bombay’s own degradation and its loss of modernity, and partly because of a remarkable cultural irony. Bombay’s films were increasingly becoming pointless because, like Delhi has those silver sperms in BMWs, Bombay’s film industry, too, suffers the curse of the privileged lads whose fathers were something. As actors with no real talent they could still survive, but some who did not look so good could do nothing more than remaking movies about love and parental objection. Then two things happened. The flops of the brainless boys from the film families gave opportunities to talent that had arrived from all over the country, including what is called North India. They were waiting, and when they got a chance they created a new kind of commercial cinema in which Bombay was not necessarily the focus. That resulted in the startling revelation here that Bombay is a culturally impoverished, rootless setting compared to Delhi. What films like Oye Lucky! Lucky Oye! and Dev D have achieved as hilarious, poignant and self deprecatory narrations of the North Indian way of life, has changed Hindi cinema, probably forever. So Delhi is being seen a bit differently in Bombay, with some affection too. Though, the best thing about Delhi will always be its winter. When there is this mist. And you do not see its people.
Source : http://www.openthemagazine.com/article/nation/it-s-a-city-of-undeserved-privilege
Delhi is a vast medieval town of indisputable botanical beauty, spectacular red ruins, Sheila Dixit, and other charms. Its women, rumoured to be high maintenance as if there is another kind, take so much care of themselves that one would think the men are worth it (but they make a gesture that suggests puking when asked to confirm). Space is not compressed here. Everything is far from everything else. There are real gardens where you do not see the exit when you stand at the entrance. It has sudden small parks that in Bombay would have been called, ‘Chhatrapati Shivaji Mini Forest’. Homes have corridors, and they are called corridors, not half-bedrooms. Yet, Delhi has a bestial smallness of purpose.
Those men there who drive the long phallic cars, sometimes holding a beer bottle in one hand, there is something uncontrollable about them. Even for a man, it is hard to understand their mutation. What is the swagger about? What is the great pride in driving your father’s BMW, what is the glory in being a sperm? And what is the great achievement in stepping on the accelerator? It is merely automobile engineering—press harder on the pedal and the car will move faster. Why do you think a girl will mate with you for that? It is somehow natural that the contemporary version of Devdas, Anurag Kashyap’s Dev D, would be set in Delhi, where a man can debase himself because life does not challenge him, he has no purpose, whose happiness is a type of sorrow. This motiveless Delhi male, you can argue, can be found in Bombay too, where not all BMWs are hard earned. But that’s not very different from saying Bombay, too, has bungalows.
Like a rich man’s son, Delhi is a beneficiary of undeserved privileges. That is at the heart of Bombay’s contempt for Delhi. Bombay is a natural city, like all great port cities of the world. It was not created. It had to arrive at a particular moment in time, it was an inevitability caused by geography, shipping and shallow waters. Bombay eventually earned its right to be a financial force through the power of enterprise, which created a system that allowed, to some extent, anyone to stake a claim at wealth through hard work. That culture still exists. It is the very basis of Bombay. That is the whole point of Bombay.
But Delhi as a centre of power is an inheritance, a historical habit. An unbearable consequence of this is the proximity of easy funds for various alleged intellectual pursuits which has enabled it to appropriate the status of intellectual centre. It is a scholarship city, a city of think tanks, of men who deal in discourse, debates and policies. And of fake serious women who wear the sari the other way and become leftists, nature lovers and diurnal feminists.
Delhi, often, confuses seriousness with intelligence and humour with flippancy. People will not be taken seriously here if they are not, well, serious. There is much weight attached to the imagined sophistication of talk, of gas. It is a city of talkers. There is always The Discussion. When you are in Delhi, you have to talk, and then they talk, and they appear to be solving an enigma, they seem headed towards achieving some revelation. But then, you realise, they were peeling an onion, an act that leads to more peels and at the heart of it all, there is nothing. Delhi is an onion. It is a void-delivery device.
Of course, all this is a generalisation, but then generalisation is a form of truth. One of the most repulsive images I bear in mind of Delhi is a scene in JNU, when Venezuelan president Hugo Chavez delivered a special lecture. It was like a rock concert and Chavez, who is a scion of the same imbecilic philosophy that once destroyed the great economies of South America, was the star. As students pumped their hands in the air and cheered him for his anti-capitalist calling, I looked at their faces. I knew those faces. They were from homes that once profited from India’s socialist corruption, and then from Manmohan’s revolution. They were hip. They would, of course, later join MNCs and chuckle at their youthful romanticism. That moment in JNU was despicable because it captured a meaningless aspect of Delhi’s fiery intellectuality, and also laid bare the crucial difference between intellectuality, which is borrowed conviction, and intelligence, which is creativity, innovation and original analysis.
It is for the same reason that the greatest misfortune of Indian journalism is that it is headquartered in Delhi. Needless to say, like in any other city, Delhi has astonishingly talented editors, journalists and writers, but there is a Delhi mental condition which is incurable—a fake intensity, a fraudulent concern for ‘issues’, the grand stand. Readers, on the other hand, have many interests today apart from democracy, policies and the perpetual misery of the poor. But the Indian media, based in Delhi, refused to see it until recently and very grudgingly, when The Times of India proved it. It is not a coincidence that The Times Group, the most profitable media organisation in India, is based in Bombay. It is not a coincidence that the game changer came from here. In Bombay it is hard to convert air from either side of your alimentary canal into cash. You have to do something here. You have to work. It is appropriate that the National School of Drama, with its phoney distaste for money, is in Delhi. And commercial cinema is in Bombay.
It must be said though that in recent times Delhi has become somewhat more endearing. This is partly because of Bombay’s own degradation and its loss of modernity, and partly because of a remarkable cultural irony. Bombay’s films were increasingly becoming pointless because, like Delhi has those silver sperms in BMWs, Bombay’s film industry, too, suffers the curse of the privileged lads whose fathers were something. As actors with no real talent they could still survive, but some who did not look so good could do nothing more than remaking movies about love and parental objection. Then two things happened. The flops of the brainless boys from the film families gave opportunities to talent that had arrived from all over the country, including what is called North India. They were waiting, and when they got a chance they created a new kind of commercial cinema in which Bombay was not necessarily the focus. That resulted in the startling revelation here that Bombay is a culturally impoverished, rootless setting compared to Delhi. What films like Oye Lucky! Lucky Oye! and Dev D have achieved as hilarious, poignant and self deprecatory narrations of the North Indian way of life, has changed Hindi cinema, probably forever. So Delhi is being seen a bit differently in Bombay, with some affection too. Though, the best thing about Delhi will always be its winter. When there is this mist. And you do not see its people.
Source : http://www.openthemagazine.com/article/nation/it-s-a-city-of-undeserved-privilege
Subscribe to:
Posts (Atom)