Friday, December 21, 2007

Messenger status quotes

  1. Well behaved gals hardly ever make history.
  2. There are only 10 types of people in this world: Those who understand binary and those who don't.
  3. Girls spoil every romance by trying to make it last forever.
  4. Of all the things I've lost, I miss my mind the most.
  5. If you are going through hell, keep going.
  6. Let Me Be Me.
  7. If there is a way, I will find one…If there is none, I will make one…
  8. To be trusted is a greater compliment than to be loved.
  9. Life is like a taxi. The meter just keeps a-ticking whether you are getting somewhere or just standing still.
  10. A Ship is always safe at the shore - but that is NOT what it is built for.
  11. Bullshit might get you on the top, but it won't keep you there.
  12. The happiest people in the world are not those who have no problems,but those who learn to live with things that are less than perfect.
  13. Life isn't about finding yourself, its about creating yourself.
  14. There are times when silence has the loudest voice.
  15. There is no perfect life but we can fill it with perfect moments.
  16. The bottom line is that people are never perfect, but love can be.We waste time looking for the perfect lover, instead of creating the perfect love.

Monday, December 17, 2007

फायरफोक्स के महत्वपूर्ण plugins

फायरफोक्स के महत्वपूर्ण plugins जो आपको ज़रूर पसंद आएंगे, इस प्रकार हैं :
१: ब्राउजर सींक
२: विज्ञापन रोको

Sunday, December 16, 2007

कार्यालय मे काम करते समय घर पे नीगाह कैसे रखे.

यह एक आम समस्या हो गई है की हम लोग सुबह सुबह कार्यालय चले जाते हैं और घर पर ताला लगना पड़ता है। इन परिस्थियों मे घर की सुरक्षा एक चीनता का विषय बन गयी है। इस सप्ताहांत मे मेरे पास काफी समय था तो मैंने सूचा की क्यों न इसी दीशा मे कुछ कार्य कीया जाय।
मेरे घर पर Airtel का इंटरनेट है, और मे चाहता था की कैसे ही मेरे कमरे मे कोई हरकत हो तो मेरे कंप्यूटर मे लगा केमरा उसकी तस्वीर खीच ले। यह करने के लिए मैंने एक LinkSys - DSL Modem with Router खरीदा। अपने Linux डेस्कटॉप पर motion नामक सॉफ्टवेयर डाला और चला दीया।

Wednesday, December 5, 2007

An SQL Update query question ?

A friend of mine yesterday asked me an SQL update question the question is like this..
lets say we have a table called t1 with the following structure
mysql> desc t1;
+-------+------------+
| Field | Type |
+-------+------------+
| a | varchar(2) |
| b | varchar(2) |
+-------+------------+
I inserted some sample data into the table after which the table looks like
mysql> select * from t1;
+------+------+
| a | b |
+------+------+
| aa | bb |
| aa | bb |
| aa | bb |
| aa | bb |
| aa | bb |
| aa | bb |
+------+------+
Now the question is that using one sql update query you shuffle the data of column a to column b and the table should look like
mysql> select * from t1;
+------+------+
| a | b |
+------+------+
| bb | aa |
| bb | aa |
| bb | aa |
| bb | aa |
| bb | aa |
| bb | aa |
+------+------+

I thought about this overnight but failed to find a solution, this morning he told me that we can do it the following way.

mysql> update t1 as az, t1 as bz set az.a=bz.b, bz.b=bz.a;
Interesting, isint it.

Marble tile or marble statue

This morning while coming to my office as usual I was listing to radio (my fav shows timeout and matchless music hour on AIR Rainbow), the RJ on the program told an interesting piece of stuff, would like to share over here. she said I tell you a story and tell let me know what would you like to be a marble tile or a marble statue.
Once there was a beautiful marble statue and people in huge number from around the world used come to see and admire its beauty.
One day the marble tiles all around the statue said to the statue
Tiles : statue this is unfair people do not recognize us, they rather step on us to admire you. we should also be given some recognition.
Statue : Tiles do you remember that we are from the same cave.
Tiles : Yes, and this is what makes me even more angry, that we are made out of the same cave still so much disparity.
Statue : Do you remember when the craftsmen started work on you you resisted on his tools.
Tiles : yes, because I didn't like them, he was trying to carve me out, I never let him do that.
Statue : I on the other hand let him use the tools on me, and he was able to comfortably carve the structure what he wanted, and this is the reason what we have difference in status.
Moral of the story is that god made us similar when we were born, but during our early days some of us resisted and escaped from hard work, for which we pay later.

Tuesday, December 4, 2007

MySQL stored procedures

I've been using PHP and MySQL since quite some time now, recently got a chance to go deeper into stored procedures side of it. I am on my way to learn them and at this point of time I feel I was missing a lot by not knowing them, I could have optimized my previous projects to a good level had I known stored procedures before.
People who have worked on advanced databases like Oracle must have been used to use the stored procedures, but people working on MySQL didn't had the privilege of using them and it was only after version 5 that MySQL introduced Stored procedures.
Who should learn them: LAMP developers specially, and all those who are interested in optimizing MySQL database.
If you are keen to know why should you learn them: When you using stored procedures you can considerably reduce the network traffic between PHP and MySQL or to be more generic between the application and the database.
HOW ???
consider a simple example, in one of your PHP pages you make a query to the database and fetch record ID's based on a selection criteria then you use those IDs as input to fetch more records from some other table. this is what we generally do in most of such cases, however if we see closely that the output of first query was of no use to PHP and it was just to get data so that subsequent queries could be formed. I know what you must be thinking, "we could have used where clause in query..." agreed. but there are cases where you use output of one or more than one query to form a finally query and then execute it. at times also performing some simple operations on the intermediate output. Now consider another scenario where in you create a stored program inside the MySQL database, you give input to it, it carries out all the intermediate steps (queries) to derive to the finally result/result-set and then returns it to PHP, this time we have saved a considerable amount of data exchange between PHP and MySQL, hence speeding up the application.
that was one advantage. Another is that the business logic can be made abstract to the application, the programmers make standard procedure calls to access the data, without getting into details about the query. the Queries can be written be domain experts. this introduces a sense of stability and security enhancement also.
If you are interested in reading more about the same, O'Reilly - MySQL Stored procedure programming is a book that you should be looking for.