Monday, July 18, 2011

Why not to go paid on Google



We all love Google but the thing I hate about Google is that they treat their paid customers like freebies too.

Yesterday, I was wondering why Google considers itself a serious contender in telecom services. The reason for this was obviously Google Voice. I was on an important call and ran out of balance. So I topped up $10 before retrying but as usual Google has still not developed a mechanism to automate their transactions. Like it takes them time to upgrade from free to paid email account, similarly you have to wait for long in order to get your calling credit topped up since they manually process your request. I waited for almost 1.5 hours before cancelling my order. Later, I used my cell phone to make the call and now I am seriously looking forward to move from Google Voice to Skype Number.

Google Team, when one wants to use your paid service, they normally want to avail the service right away. If you can’t keep your paid customers satisfied, keep yourself to the free stuff.
Friday, April 22, 2011

Fixing Time Mismatch in PHP, mySQL and Server on CentOS


Recently, I was informed by my development & networks team that there's a timing mismatch on one of our dedicated servers which is affecting cron execution and that they are unable to fix it. Most of our servers don't have Webmin, Kloxo or any other WHM, and we manage them via Putty/Commandline or FTP.

This one had Kloxo/HyperVM installed and even the Time Zone function in the Kloxo wasn't fixing the time offset. Server was showing the correct local time, mySQL was 7 hours behind whereas the PHP was one hour ahead. The fix for all entities wasn't listed at a single source so I had to search from various sources to fix it. 

I normally don't blog about technology but I thought I should publish the fix so if anyone of you ever comes across a similar issue, may be it helps him/her too.

Setting Server Time

Stop ntpd if running
# /etc/init.d/ntpd stop
#
#
sync time with ntp server
# /usr/sbin/ntpdate 10.2.3.9
27 Aug 01:10:56 ntpdate[27008]: adjust time server 10.2.3.9 offset -0.048726 sec
#
#
Keep the original zone file
# cp /usr/share/zoneinfo/Asia/City/usr/share/zoneinfo/Asia/City_orig_YYYYmmDD
#
Make a new zone file
# cat /tmp/Karachi
Rule Country Min Max – Jun 19 04:20:59 1 PKT
Rule Country Min Max – Oct  28 23:59:59 0 PKT
Zone Asia/City+5:00 Country%s
compile the new zone file
# zic /tmp/City
#
See the time has changed
# date
Thu Mar 28 02:05:34 PKT 2011
#
See if ntp daemon is still running
# ps -ef | grep ntp
root 1982 1188 0 Aug18 ? 00:00:05 /usr/sbin/ntpmon
root 1996 1 0 Aug18 ? 00:00:02 /usr/sbin/ntpd -g
root 31246 30980 0 02:06 pts/0 00:00:00 grep ntp


or SIMPLY  

first, make a backup of the existing localtime file. It’s always good practice to make backups of original config files.
# mv /etc/localtime /etc/localtime.bak
Next, create the link:

# ln -s /usr/share/zoneinfo/Asia/Karachi /etc/localtime
Run # date to confirm the correct time.



PHP Time Fix

For checking the php time, put the following code in a file, say test.php

Code:
    $time = time();
    $result = date(”Y-m-d (D) H:i:s”,$time);
    echo “Current date and local time on  server = $result   “;
    ?>
Execute the php script.

Code:
[root@localhost ~]# php -a time.php
    Interactive mode enabled
    Current date and local time on  server = 2011-04-21 (Thu) 18:04:25
To get the server time , issue the following command :

Code:
[root@localhost ~]# date
    Thu Apr 21 17:04:25 PKT 2011
You can see the difference of one hour between the server time and the php time.
For fixing this, you need to install the PECL timezonedb module.

Code:
[root@localhost ~]# pecl install timezonedb
At the end , you might see the following message :

==========================
Build process completed successfully
Installing ‘/usr/local/lib/php/extensions/no-debug-non-zts-20060613/timezonedb.s o’
install ok: channel://pecl.php.net/timezonedb-2009.6
configuration option “php_ini” is not set to php.ini location
You should add “extension=timezonedb.so” to php.ini
==========================

So , add the line ” extension=timezonedb.so” to the php.ini file and restart apache using command /etc/init.d/httpd restart

There shouldn’t be any mismatch in time now. Use the test.php page again to confirm



mySQL Time Fix

Execute the following command on commandline.

mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql

username root didn't allow modification due to security reasons so I used another DB Username. You'll be prompted for DB User Password as well.

 

So this is how I synchronized all clocks on my server. If you want me to write more about similar stuff or the technology challenges we come across daily, do let me know by posting your comments.





Wednesday, February 09, 2011

The Young Unsung Entrepreneur

                                                Images via Google Images. Not of the original kiosk.
 
As I walked into a market last night, I heard a voice “Sir Jee!”. I initially ignored it but then I saw a 18-19 year old boy running towards me. I checked my wallet and cell phone to reassure myself that I am in possession of my stuff and have not dropped anything by chance.

The boy came up to me and I gave him chance to catch up with his breath. “Jee Bhai” was my response to him. “Sir Aapne Mujhe Pehchaana Naheen?” (Didn’t you recognize me?).  I took my memory into test. The face was somewhat familiar but I couldn’t recall him.  “Sorry Yaar Yaad Naheen Aa Raha” (Sorry, I can’t recall).  The story that he later told me was the reason that made a sariyal person like me smile all day.

I think those were last days of October 2010 when a friend stopped his car against a Burger Khokha so we can have a quick dinner instead of going into a fast food chain’s takeaway. This chap who was working for the owner as a road marketer and client handler was weeping. While our burgers were being prepared, I asked him the reason to which he replied that the owner didn’t pay him the committed commission for convincing pedestrians and bringing them in as clients. It didn’t come up as a surprise because that’s a common affair here.  Also he shared his family’s financial situation and I felt really sorry for him.

To be very frank, I didn’t like that burger.  Both fries and burgers were too much oily and didn’t come with an add-on. Moreover the outlet only had the option of Anda Shami Burger and French Fries. I cursed the decision of my friend to eat at this particular spot and was about to move on towards car when I saw him coming towards me in expectation of tip. While handing over the amount, I told him “Dude, this burger is pathetic. You can make a better one using less oil, good vegetables, mayonnaise etc. Also there is no tea/coffee for a caffeine addict like me so I would advise you to establish your own setup as a competitor to give your boss a tough time. Better service and good eatables will give you an edge over him and you can start off initially by saving your daily wage for only 10 days.”

Now the same kid was standing in front of me telling me story how he saved money and only sold 6 burgers on his first day of business with no proper khokha to support his kitchen items. Moreover, how he was bullied by his previous boss and work colleagues while he was establishing his unit near his previous work place. Now he serves three different kinds of burgers, employs two more people at the moment and has brought in his brother as a partner. If his previous boss sells 25 burgers an hour now, he’s selling 30. I took excuse from him for 5 minutes so that I can courier a document. When I came back, he showed me his kiosk and presented me his "outlet’s" two burgers and a pack of french fries with coleslaw. He wasn’t willing to take the money against these items and kept on saying “Sir, aap try tu karein!  Aapse paise kaise le sakte hein hum. Aap tu hamaray ustaad hein.”  (Please Try First. We cannot take money from our teacher), though I didn’t do anything for him. Upon my insistence, he finally took a discounted amount and I came home thinking that people like him should be the guest speakers at Entrepreneurship Summits. We keep on organizing such events to inspire youth but those who want to do just need one comment.

Good Luck Aslam!  Your burgers were delicious and even if they weren’t, it wouldn’t have mattered to me. What mattered to me wasn’t in those burger buns. May you expand this business and life brings many bigger opportunities for you.
Wednesday, February 09, 2011

The power of 8052

                                                       Image Courtesy: liafa.jussieu.fr


9th Feb 2011, 5:04:AM, ROOFExpress Office: When Bao G and Shaban Bhai used to teach us Microprocessor Interfacing & Programming Course, some of us took it as a useless course till I realized its power in my Final Year Project. Tonight, I solved 3 problems on a whiteboard using an 8052 with a Pseudocode, and now I seriously wish to go back to the life of Wires, Boards, Assembly Language and Keil. All my friends including Khurram Siddiqi, Ahmad Raza and others who are teaching this course, the kids in your class can solve many social problems with these small tiny devices provided they are given commercial projects. I would request you to please make this course fun for them.
Wednesday, January 05, 2011

Insanity Prevails

I knew that we are an intolerant nation but today I got to know we are even worse than animals. I declined dozens of lucrative offers in the past just because I wanted to do something for my country and people. Perhaps I was wrong. Our people will never change. Perhaps it’s time for me to pack up my bags and leave this insane place.