Archive for April, 2006

Measure the path

nirav April 26th, 2006

In Logic Builder this time, I am going to ask you to flex your mind muscles a bit to think of the input parameters for the problem, rather than the main solution.

The problem is: How can we measure the path a laser beam has to travel if it wanted to reach from the inner most track to the outer most. ie. from the beginning of the disk to the end. What all parameters will we need to calculate this correctly? Define these parameters and write a program to calculate the length of this path in centimeters.

Magnet April 25th, 2006

स्फुर्ती….
भटकत राहिलो पोटापायी
दरवेशासारखा
मुक्काम दर मुक्काम
शहर शहर
देशात,… परदेशात
तरीही;
एक गीत गुणगुणतेय
अजुनही
थकलेल्या मनात
एक सुगंध दरवळतोय
अजुनही
खोल अंतरात
एक ज्योत तेवतेय
अजुनही
विझलेल्या हृदयात
गावच्या मातीचा एक कण वाहतोय
अजुनहीस्फुर्ती बनुन माझ्या रोमारोमात…

Misc reading for PHP Developer

nirav April 24th, 2006

Here are a few links I got from our PHP team in Magnet.

Yogesh sent a link that talks about Style Manipulation using Javascript.

Deepak said, How will you use AJAX with PHP? With or without xmlhttprequest & javascript? Checkout SmartJax

And Vishal and Samir mentioned a few from Zend. An old yet interesting one is Secure Programming with PHP.

Installing PHP on RHEL 4

nirav April 22nd, 2006

Had to install PHP5 with SOAP support on a server. The server was a fresh RHEL4 edition. It’s been a while I setup PHP on a server and our sys admin was on leave, so I decided to do it.

My experience in installing PHP on a server has been this: no matter how many times I have done it, I will face a new problem every time!

So in tune with that, I faced numerous issues this time as well! The first problem with the situation is that you have to recompile PHP. If you want to add SOAP support (or something similar) to PHP, you will have to recompile PHP (or load a dynamic module). So I downloaded the PHP source code. But I wanted to be sure I have other things set on the machine before I begin.

Problem 2: apxs is not available on the server. This is actually a known trouble starter. Most people don’t have apxs on their installation. And it’s needed for PHP to compile. So this means, I need to get httpd-devel on the server. So I download the latest httpd and httpd-devel RPMs from rpmfind.net. But I forgot there is something called as dependenies too! The newer versions of Apache required newer libraries of a lot of things.

So I did all that - going through dependencies one by one and upgrading / installing / forcing / avoiding dependencies. Yum was not available on the system, and when I tried to RPM Yum, it gave me further dependency problems.

Solution 1: After much frustration, I decided to try some automated method. This point generally comes when you are on the 4th or 5th level of dependency resolution. I tried “up2date“, and well, it worked! I removed all the latest version RPMs I had installed, and got the versions that came with the original setup via up2date. Also added httpd-devel.

Problem 2: Then I wanted to install MySQL. The server had MySQL client libraries, but not the server. This was strange, so I installed the MySQL server via RPM. But the server did not start. Checking the /var/log/messages, I found this:
Apr 21 23:30:07 bigserver kernel: audit(1145680207.552:0): avc: denied { write } for pid=13965 exe=/usr/sbin/mysqld name=mysql dev=dm-4 ino=114815 scontext=root:system_r:mysqld_t tcontext=root:object_r:var_lib_t tclass=dir

Solution: I had never seen a problem like this! So I Googled, and found out that this is something that happens because of the SELinux configuration in RHEL. It’s actually a reported bug on MySQL. I invoked the “system-config-securitylevel” application from the server, and disabled SELinux policy for mysql daemon. That got rid of the error. But the server still wouldn’t start.

Searching more, I found that unless I manually deleted my.cnf and other MySQL files, it would not work. So I deleted the /var/lib/mysql and my.cnf and installed MySQL server again. That made it work!

Problem 3: I knew that if I just took the PHP configure string from phpinfo output, it’s not going to compile. Most of the libraries will not be available and configure will complain about them. So I cleaned the ./configure command and executed it. But oops, it said libmysqlclient was either not present or the version was wrong. Now just a while ago I had installed the latest MySQL server, I checked the lib folder and the library was right there. What could be the problem then? After a bit of hitting around, it struck me that may be the file was indeed wrong version. The file was never replaced in the RPM installation because of the same problem that I faced earlier. So unless I manually remove those files and install MySQL devel again, it would not work. So I did that, and configure worked like an obedient servant after that.

Note: The easiest part in this whole process was the actual PHP compilation. It completed before I could check my emails! The server was pretty fast and the compilation was completed quickly and without a hassle. I did a make install and that set things right.

I am now ready to setup the application on the server and let it roll!

And I am wearing my PHP t-shirt today! :)

Sunshine play’s part in Chat Ids!!!!!!!

Magnet April 21st, 2006

Sun Signs & chat/mail IDs It’s not really tough to guess the signs with the help of chat/mail IDs.

Virgos normally have very straight ones, with just their name and maybe an underscore; Leos are the wackiest. Sagits have self-deprecating ones. Aries: The last place they would want to show their style is the mail or chat ID. So an Arian’s ID is bound to be a piece of his/her name and a number (again their birth date or anniversary). It’s certainly staid, but at least it’s easy to remember. Taurus: Interestingly, Taurans like to tell the world about their profession using their IDS. So xyzjourno, abcprof, 123soft etc are how their ID sound. Many would agree that their IDs are not as adventurous as they are! Gemini: Geminis prefer their family showing its tag. So the surname or their spouse’s name is bound to feature in their ID. In fact, Geminis wont even mind having their spouse’s ID for their own. Cancer: Cancerians can come up with feelings in their IDs also. Happy, lonely, excited etc are words that constantly feature in their IDs. It’s hard to believe emotional cancerians go to this extent to stick to their sign’s stereotypical nature. Leo: Except high-strung and highly vain IDs with Leos. They want to size up their whole attitude in their ID alone. So cooldude, freshcream, fast n furious are some of the IDs that these guys end up with. Virgo: Virgos keep it simple and straight. The name and anything else that it takes to register the ID. Even the numbers in the ID are randomly chosen. So a 16 in a Virgo need not mean it’s his/her birthday, or for that matter the age. It’s just a default one, so to speak. Libra: Even these guys rarely take too much interest or display enthusiasm in registering IDs. If nothing works, they don’t mind having their nicknames or pet names in the ID. Something like jimmy456 is bound to be a Libran’s. Scorpio: They find their IDs rather cathartic. So names of rock bands, cult groups, pop gurus etc featuring in IDs may mean you are writing/talking to a Scorpio. If that’s not happening, they prefer having one that suggests their work profile. Sagittarius: Should someone mistake them to be what they are not, they choose boring and staid ones and sometimes complete anti-thesis to what they are. Yes, there are several Sagits who have IDs like iamaloser@xyz.com Capricorn: They think having it short is the best way to be remembered. So their IDS are shortened version of their original name. Or it’s simply the word they use very often that it becomes an ID. Aquarius: They go for names that have nothing to do with them but instead is one that they’ve always loved. So a Nishant could have an ID as Nirvan because that’s the name he loves. The credo is that you can fool around with the name, so fool around with the ID. Pisces: Pisceans also steadfastly put in their favorite’s name in their ID. So a girl who likes Cherry may have it in her name. A guy in love with a girl may want her name in it. Singles don’t even mind shamelessly shouting out their marital status in the IDs.

Regards

Arnav

« Prev - Next »