My book on “Facebook Application Development” has been announced. I have co-authored this book with Dr. Mark Alexander Bain and it is scheduled to be published by May 2008.
Author: hasin
I would love to be a baby sitter
Well, it may sound funny but this is what I want to be after 6 years. I am quite planned about my future and I will definitely retire from my regular web app dev job after 6 years. Beside this I love kids, love talking to them and love to see them growing up đ
so I am going to be a baby sitter after 6 yrs and I am sure, I will do good đ
WorldTimeEngine – How about making your own in PHP?
I recently came by this site WorldTimeEngine where users can search the local time of any place using the name, street address or just latitude and longitude. Since that time I was thinking how easily you can make your own. As long there are some good people over there (For Geocoding API) – its a not a big deal, you know? Lets have a look at the following PHP code.
<?
$place = "Bucharest";
$geodata = getGeoCode($place);
print_r($geodata);
echo getTime($geodata['lat'],$geodata['lng']);
function getTime($lat, $lng)
{
$url = "http://ws.geonames.org/timezone?lat={$lat}&lng={$lng}";
$timedata = file_get_contents($url);
$sxml = simplexml_load_string($timedata);
return $sxml->timezone->time;
}
function getGeoCode($address)
{
$_url = 'http://api.local.yahoo.com/MapsService/V1/geocode';
$_url .= sprintf('?appid=%s&location=%s',"orchid_geocode",rawurlencode($address));
$_result = false;
if($_result = file_get_contents($_url)) {
preg_match('!<Latitude>(.*)</Latitude><Longitude>(.*)</Longitude>!U', $_result, $_match);
$lng = $_match[2];
$lat = $_match[1];
return array("lat"=>$lat,"lng"=>$lng,"address"=>$address);
}
else
return false;
}
?>
Changing the variable “$place” to “Bucharest”,”Dhaka”, “Toronto” and “Oslo” gives me the following result
Array
(
[lat] => 44.434200
[lng] => 26.102955
[address] => Bucharest
)
2008-03-01 08:41
Array
(
[lat] => 23.709801
[lng] => 90.407112
[address] => Dhaka
)
2008-03-01 12:42
Array
(
[lat] => 43.648565
[lng] => -79.385329
[address] => Toronto
)
2008-03-01 01:42
Array
(
[lat] => 59.912280
[lng] => 10.749980
[address] => Oslo
)
2008-03-01 07:43
Nice, Huh?
29th Feb, 2012
What will happen this day in 2012?
Afif will be almost 6yrs old
His sister will be 3 yrs old
I will code in PHP10 and Python 5
I will still be young like today
I will hold a MySQL DBA Cert
I will be writing a book on Python
I will be having a car
No one in my family will be using windows anymore
I will write a blog post titled “29th Feb, 2016”
I will still be singing “Like a rolling stone”
And Finally
I will be preparing more for the self retirement in 2015
Getting Dell BCM4328 Wifi Card Working on Ubuntu 7.10
After trying,searching and crying for more than one month, I finally get it working today in my laptop (Dell Inspiron 6400) đ – I am one of the happiest ever in this world right now :D. here’s how to. All the credit goes to “kayvortex”
Model of my wifi card is “Broadcom BCM4328 802.11a/b/g/n (rev 01)”
Steps
1. Install Ndiswrapper Common and Ndiswrapper Utils (You can do it using synaptic)
2. Download The Driver from ftp://ftp.dell.com/network/R151517.EXE and unzip it somewhere. You will see a folder named DRIVER
3. Execute the following commands
sudo ndiswrapper -i /download_directory/DRIVER/bcmwl5.inf
sudo ndiswrapper -l
sudo modprobe ndiswrapper
4. Then, set ndiswrapper to load on startup:
sudo ndiswrapper -m
gksudo gedit /etc/modules
and add the following module to the list
ndiswrapper
5. Restart (This is a must)
Now you can use Fn+F2 to turn on your wifi đ )
Virutal Interview, Are you interested?
I can do one thing to help you out there đ – if you are confident on PHP, JS and web application development – or if you want to see how a real interview actually takes place, I can take your interview for 30 minutes. You can just hide your name, designations if you want. I wouldn’t ask your real name or any private info for sure. I can send you the report right after your interview and using that you can understand where do you lack.
If you are interested for a 30 minutes interview over messenger – drop me a mail to [email protected]. Please note that you can hide your id for sure. I am sure it will help you to upgrade yourself (myself too :D)
On the way back to Dhaka – Seminar on "Current Job Trends"
Right now I am in the train on the way back to Dhaka. Got some free minutes in hand to write a post focusing things happened this week.
Last couple of days were simply awesome. I came to Rajshahi to present a seminar on “Current Job Trends” in “Rajshahi University of Engineering and Technology (RUET)” to help students to get a basic overview of current job market. Beside that I also focussed to the thngs they should be prepared before going to interview. To describe the overall feedback – it was amazing. I was surprised by their engagement and enthusiasm. It seems like they were waiting for such a seminar for a long time. Special thanks goes to faculty of computer science and engineering for arranging that. Professor Dr. Shahiduzzaman helped a lot to make it happen. Definitely thanks also goes to Sarwar Sattar (Stalin) and Murad, faculty of the department for their incredible help. Rana (05 CSE) – thank you too.
You can download the slides from here http://javapark.net/hasin/RecentJobTrends.pdf.tar.gz
The seminar went great (well, I am saying ‘great’ based on the feedback I’ve got) – I will soon post some pictures of this seminar. After the end of this seminar, Professor Dr. Shahiduzzaman invited me to attend the farewell program of 03 batch. I feel honored to be invited in such a program. And I didnt miss the chance.
Beside these official programs, I also went to Naogaon to visit the house of my in-laws parents. The reception was beyond my imagination. I always like this cordiality of village peoples. Thats why I want to spend my life after 35 in such a place.
I will try to arrange such seminars in different universities to increase the awareness.
Unexpected return value from Facebook FQL.query via PHP REST Lib
While working with FQL I suddenly found a bug in one of our applications. The method which we used to count number of friends of a specific user who has added that application was returning 1 when there is no friend actually installed itāĨ¤ Using the following FQL you can easily find that. (FQL doesn’t support “count” – so you cant use it)
SELECT uid FROM user WHERE has_added_app = 1 AND uid IN (SELECT uid2 FROM friend WHERE uid1 = {$userid})
The PHP code may look like the following one
function getTotalFriends($userid)
{
global $facebook, $mysql;
$Users = $facebook->api_client->fql_query("SELECT uid FROM user WHERE has_added_app = 1 AND uid IN (SELECT uid2 FROM friend WHERE uid1 = {$userid})");
$NumberOfUsers = count(trim($Users));
return $NumberOfUsers;
}
So what would you expect when there is no friend who has added this application? Definitely the FQL query should return an empty array. So that counting elements of that array tells you that you have “0” friends. But actually it returns a white space. What’s the difference between an empty array and a white space? l
count(array()) returns 0
count (” “) returns 1
So even when you dont have any friends, your method actually returns you “1”. The return result is not expected. What does your common sense says? Either the method should return false or an empty array. Not a white space.
Here’s the correction
function getTotalFriends($userid)
{
global $facebook, $mysql;
$Users = $facebook->api_client->fql_query("SELECT uid FROM user WHERE has_added_app = 1 AND uid IN (SELECT uid2 FROM friend WHERE uid1 = {$userid})");
$NumberOfUsers = is_array($Users)?count($Users):0;
return $NumberOfUsers;
}
āĻāĻāύā§āĻĄā§āĻ āĻāĻžā§āĻž āĻāĻ āĻŽāĻžāϏ+
āĻāĻŽāĻŋ āĻāĻ āĻŦāĻāϰā§āϰ āĻāĻāĻĻāĻŽ āĻļā§āϰā§āϤ⧠āĻāĻŽāĻžāϰ āϞā§āϝāĻžāĻĒāĻāĻĒ āĻĨā§āĻā§ āĻāĻāύā§āĻĄā§āĻā§āϰ āĻļā§āώ āĻāĻŋāĻšā§āύāĻāĻŋāĻ āĻŽā§āĻā§ āĻĢā§āϞā§āĻāĻŋāĨ¤ āĻŦā§āĻļ āĻ āύā§āĻāĻĻāĻŋāύ āĻŽā§āϝāĻžāύāĻĄā§āϰāĻŋāĻāĻž āĻŦā§āϝāĻŦâāĻšāĻžāϰ āĻāϰāĻžāϰ āĻĒāϰ āĻŽāύ⧠āĻšāϞ āĻ āύā§āϝāĻāĻŋāĻā§ āĻā§āϰāĻžāĻ āĻāϰ⧠āĻĻā§āĻāĻž āϝā§āϤ⧠āĻĒāĻžāϰā§āĨ¤ āĻāĻŦā§āύā§āϤ⧠āĻāύā§āϏāĻāϞ āĻāϰ⧠āĻāĻŽāĻŋ āϰā§āϤāĻŋāĻŽāϤ āĻŽā§āĻā§āϧāĨ¤āĻĻāĻžāϰā§āύ āĻāĻāĻāĻžāϰ āĻĢā§āϰā§āύā§āĻĄāϞāĻŋ āĻāύā§āĻāĻžāϰāĻĢā§āϏ, āĻĄā§āĻŦāĻŋā§āĻžāύā§āϰ āĻļāĻā§āϤāĻŋāĻļāĻžāϞ⧠āĻĒā§āϝāĻžāĻā§āĻ āĻŽā§āϝāĻžāύā§āĻāĻžāϰ āĻāĻŦāĻ āĻĻāĻžāϰā§āύ āϏāĻŦ āĻāĻĒā§āύ āϏā§āϰā§āϏ (āĻāĻŦāĻ āĻā§āϞā§āĻ āϏā§āϰā§āϏāĻĄ) āĻĒā§āϝāĻžāĻā§āĻā§āϰ āĻŦāĻĻā§āϞāϤ⧠āĻāĻāĻŦāĻžāϰā§āϰ āĻāύā§āϝāĻ āĻŽāύā§āĻ âāĻšā§āύāĻŋ āϝ⧠āĻāĻāύā§āĻĄā§āĻā§ āĻāϰ āĻĢā§āϰāĻžāϰ āĻĻāϰāĻāĻžāϰ āĻāĻā§āĨ¤ āĻāĻāĻžā§āĻž āĻāĻāύā§āĻĄā§āĻā§ āĻāĻŽāĻžāϰ āĻā§āĻŦāĻ āĻĢā§āĻāĻžāϰāĻŋāĻ āĻā§ā§āĻāĻāĻŋ āϏāĻĢāĻāĻā§ā§āϝāĻžāϰ āĻāĻŋāϞ (āϏā§āĻā§āϞā§āĻ āĻĢā§āϰāĻŋ) āϝā§āĻā§āϞā§āϰ āϞāĻŋāύāĻžāĻā§āϏ āĻĒā§āϰā§āĻ āĻāĻŽāĻŋ āĻĒāĻžāĻāύāĻŋ – āϤāĻžāĻ āĻā§āĻžāĻāύ āĻāύā§āϏāĻāϞ āĻāϰ⧠āύāĻŋā§ā§āĻāĻŋ āϏā§āĻā§āϞ⧠āĻāĻžāϞāĻžāύā§āϰ āĻāύā§āϝāĨ¤ āύāĻŋāĻā§ āĻāĻŽāĻžāϰ āĻĢā§āĻāĻžāϰāĻŋāĻ āĻĒā§āϝāĻžāĻā§āĻ āĻā§āϞā§āϰ āĻāĻāĻāĻž āϞāĻŋāϏā§āĻ āĻāϰāϞāĻžāĻŽ – āĻāĻžāϰ⧠āĻāĻžāĻā§ āϞāĻžāĻāϤā§āĻ āĻĒāĻžāϰā§āĨ¤
āĻĢāĻā§āĻļāĻĒā§āϰ āĻŦāĻŋāĻāϞā§āĻĒ âāĻšāĻŋāϏā§āĻŦā§ āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻāϰāĻāĻŋ āĻāĻŋāĻŽā§āĻĒāĻļāĻĒ
āĻāϞāĻžāϏā§āĻā§āϰā§āĻāϰā§āϰ āĻŦāĻŋāĻāϞā§āĻĒ āĻāĻāĻāϏā§āĻā§āĻĒ
āϏāĻŋāĻĄāĻŋ/āĻĄāĻŋāĻāĻŋāĻĄāĻŋ āϰāĻžāĻāĻ āĻāϰāĻžāϰ āĻāύā§āϝ āĻā§āĻĨā§āϰāĻŋāĻŦāĻŋ (k3b)
āĻāĻĒā§āύ āĻ
āĻĢāĻŋāϏ – āĻāĻŽāĻžāϰ āĻā§āĻžāϰā§āĻĄ āĻĒā§āϰāϏā§āϏāĻŋāĻ, āϏā§āĻĒā§āϰā§āĻĄāĻļāĻŋāĻ āĻāĻŦāĻ āĻĒā§āϰā§āĻā§āύā§āĻā§āĻļāύ āϤā§āϰā§āϰ āĻāĻžāĻā§
āĻĢāĻžāĻāϞāĻāĻŋāϞāĻž āĻāĻŽāĻžāϰ āĻāĻžāϞ āϞāĻžāĻā§ āύāĻž – āϤāĻžāĻ āĻāϏāĻāĻĢāĻāĻŋāĻĒāĻŋāϰ āĻāύā§āϝ āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻāϰāĻŋ āĻāĻāύāĻāϏāϏāĻŋāĻĒāĻŋ (WinSCP) āĻāĻŦāĻ āϏāĻžāϧāĻžāϰāύ āĻāĻĢāĻāĻŋāĻĒāĻŋāϰ āĻāύā§āϝ āĻā§āĻāĻžāϞ āĻāĻŽāĻžāύā§āĻĄāĻžāϰ
āĻāĻŋāĻĄāĻŋāĻ āĻĻā§āĻāĻžāϰ āĻāĻžāĻā§ āĻāĻŋāĻāϞāϏāĻŋ āĻĒā§āϞā§ā§āĻžāϰ
āĻāĻžāύ āĻļā§āύāĻžāϰ āĻāύā§āϝ āϰāĻŋāĻĻāĻŽāĻŦāĻā§āϏ
āĻā§āϝāĻžāĻ āĻāϰāĻžāϰ āĻāύā§āϝ āĻĒāĻŋāĻāĻŋāύ
āĻŦā§āϰāĻžāĻāĻāĻžāϰ âāĻšāĻŋāϏā§āĻŦā§ āĻāĻŋ āĻāĻāĻ āĻāϰāĻŋ āϤāĻž āĻāĻŋ āĻāĻŦāĻžāϰ āĻŦāϞāĻž āϞāĻžāĻāĻŦā§? āĻ
āĻŦāĻļā§āϝāĻ āĻĢāĻžā§āĻžāϰāĻĢāĻā§āϏ āĻāĻŦāĻ āĻ
āĻĒā§āϰāĻž
āĻĄāĻžāĻāύāϞā§āĻĄ āĻ
ā§āϝāĻžāĻāϏā§āϞāĻžāϰā§āĻāϰ âāĻšāĻŋāϏā§āĻŦā§ āĻŽāĻžāϞā§āĻāĻŋāĻā§āĻ (Multiget)
āĻā§āĻĄāϞā§āĻāĻžāϰ āĻāύā§āϝ āĻāĻŋāύāĻŋ (Geany), āĻā§āύā§āĻĄ āϏā§āĻā§āĻĄāĻŋāĻ, āύā§āĻāĻŦāĻŋāύāϏ āĻāĻŦāĻ āĻāϏāĻĒāĻŋāĻā§āĻ āĻāĻāĻĄāĻŋāĻ (SPket IDE)
āĻāĻāϞāĻŋāĻļ āĻā§ āĻāĻāϞāĻŋāĻļ āĻĄāĻŋāĻāĻļāύāĻžāϰā§āϰ āĻāύā§āϝ āĻāĻāĻ āĻāϰāĻŋ āĻāĻžāϞāĻŋāĻāĻā§ (Jalingo)
āĻĒā§āĻāĻŽā§āĻāĻžāϰ âāĻšāĻŋāϏā§āĻŦā§ āϏā§āĻā§āϰāĻžāĻāĻŦāĻžāϏ
āϏāĻŋāĻāĻâāĻāĻāĻŽ (CHM) āĻĢāĻžāĻāϞ āĻĒā§āĻžāϰ āĻāĻžāĻā§ āĻāĻā§āϏāϏāĻŋāĻāĻāĻāĻāĻŽ (xCHM)
āĻĒāĻŋāĻĄāĻŋāĻāĻĢ āĻĢāĻžāĻāϞ āĻĒā§āĻžāϰ āĻāύā§āϝ āĻāĻāĻŋāύā§āϏ (Evince)
āĻŽāĻžāĻāĻāϏāĻāĻŋāĻāĻāϞ āĻāĻŋāĻāĻāĻāĻ āĻĢā§āϰāύā§āĻāĻāύā§āĻĄ âāĻšāĻŋāϏā§āĻŦā§ āĻāϏāĻāĻŋāĻāĻāϞ āĻā§ā§āĻ (SQLYog)
āĻāϰ āĻāĻāύā§āĻ āĻāĻāύā§āĻĄā§āĻā§ āĻĢā§āϰāĻž āĻšāĻŦā§ āύāĻž āĻāĻŽāĻžāϰ đ – āĻāĻĢāĻŋāĻĢ (āĻāĻŽāĻžāϰ āĻā§āϞā§) āĻ āĻā§āĻāĻŦā§āϞāĻž āĻĨā§āĻā§āĻ āϞāĻŋāύāĻžāĻā§āϏā§āĻ āĻāĻžāĻ āĻāϰāĻŦā§ āĻāύāĻļāĻžāϞā§āϞāĻžāĻšāĨ¤
Hacking SlideShare.net using PHP
Duh! you really believed that tricky title? come on!
But hey, wait. Here’s something I’ve found for you!
I am a big fan of slideshare becoz of their fantastic presentation sharing service and also the display. but it also hurts me when I can’t download some of these awesome slides available there for my offline reading. So I just spent some time today analyzing the HTTP requests made by the player available in slideshare using LiveHTTPHeader extension and found a way to download any presentation you want! There are many slides available in slideshare where you see that “Download not available” – But as long you have some knowledge on web-scrapping, that doesn’t matter at all.
Look at the following PHP code which gives you a list of URLs of the slides from any slideshow in slideshare.net – whether the presentation is available to download or not! for example the presentation on “Ajax and PHP” by John Coggeshall is not available to download. The url is of that presentation is http://www.slideshare.net/coogle/ajax-and-php
<?php
$slideshowUrl="http://www.slideshare.net/coogle/ajax-and-php";
$slideshowPageContent = file_get_contents($slideshowUrl);
$pattern = "~doc=([\w-]+)~";
preg_match($pattern,$slideshowPageContent,$matches);
$xmlurl = "http://s3.amazonaws.com/slideshare/{$matches[1]}.xml";
$sxml = simplexml_load_file($xmlurl);
foreach ($sxml->Slide as $slide)
echo $slide['Src']."<br />";
?>
The output will be something like this
https://s3.amazonaws.com:443/slideshare/ajax-and-php-1194421981517706-1-slide-1.swf
https://s3.amazonaws.com:443/slideshare/ajax-and-php-1194421981517706-1-slide-2.swf
https://s3.amazonaws.com:443/slideshare/ajax-and-php-1194421981517706-1-slide-3.swf
https://s3.amazonaws.com:443/slideshare/ajax-and-php-1194421981517706-1-slide-4.swf
https://s3.amazonaws.com:443/slideshare/ajax-and-php-1194421981517706-1-slide-5.swf
https://s3.amazonaws.com:443/slideshare/ajax-and-php-1194421981517706-1-slide-6.swf
https://s3.amazonaws.com:443/slideshare/ajax-and-php-1194421981517706-1-slide-7.swf
..........
https://s3.amazonaws.com:443/slideshare/ajax-and-php-1194421981517706-1-slide-40.swf
I am sure you are going to love me! đ