Yahoo! smiles in Pidgin

I didn’t like pidgin for it’s smilies and didn’t use it. I use yahoo messenger and gtalk separately. But later i came to know that i can use yahoo smilies to pidgin. So, i switched to pidgin with my yahoo, gtalk and msn accounts.
Firstly i used yahoo smilies that i found here. But this smilies of yahoo 8.1. But it’s a bit old smilies. So i made a new smiley pack
for pidgin that is used in yahoo 9. I used some code to convert the yahoo smiley code’s to the new theme pack. I parsed the yahoo messenger’s
smiley xml file. That was a chance to purse the xml file and write e new blog post, ha ha ha ha.

I opened my Yahoo’s xml file from here C:\Program Files\Yahoo!\Messenger\Media\Smileys\emoticons.xml

I wrote the code to parse the file and get the file name with it’s corresponding code.

<?php
echo "Name=Yahoo!<br>\n";
echo "Description=Yahoo 9.0 smileys<br>\n";
echo "Icon=4.gif<br>\n";
echo "Author=Tareq Hasan<br>\n";

echo "<br>[default]";

$load = simplexml_load_file('emoticons.xml');
echo "<pre>";

foreach($load->emoticon as $key)
{
echo $key['id'].".gif";
echo "\t";
foreach($key->shortcuts->shortcut as $symbol)
{
echo $symbol." ";
}
echo "<br>";
}
echo "</pre>";
?>

This code generates the following file

Name=Yahoo!
Description=Yahoo 9.0 smileys
Icon=4.gif
Author=Tareq Hasan

[default]

1.gif    :) :-) (-: (:) :)
2.gif    :( :-( :(
3.gif    ;) ;-) ;)
…………….
…………….
113.gif    :-bd
114.gif    ^#(^
115.gif    :bz

—————————————————————————–

Then i copied the *.gif files to a new folder. I copied the text, generated by the code to a file named “theme” with no extension.
Then compressed the folder in tar.gz format. Now it’s ready for a smiley theme package. So easy :D .

Download Yahoo 9 smiley (611)

Playing with twitter JSON using PHP

Now twitter is playing a major roll to our day. Many of us is using twitter. Now lets play something with it. Today i will use JSON to play with twitter LOL.

Lets play with our statuses. If you are using twitter, then your status url is http://twitter.com/status/user_timeline/YOUR_USERNAME.json. So if your twitter id is tareq_cse then the url will be http://twitter.com/status/user_timeline/tareq_cse.json. Now i will add a extra parameter here and this is count. This url shows the last 20 status update of yours. So if i need only 5 update then? Then we will add a count variable there. So the url will be http://twitter.com/status/user_timeline/tareq_cse.json?count=5

Now come to the php code.

<?php
$json = file_get_contents("http://twitter.com/status/user_timeline/tareq_cse.json?count=10", true); //getting the file content
$decode = json_decode($json, true); //getting the file content as array

echo "<pre>";
print_r($decode);
echo "</pre>";
?>

Now run the code and see. You will get output like this

Array
(
    [0] => Array
        (
            1 => is digging wordpress
            [in_reply_to_user_id] => 
            [user] => Array
                (
                    [notifications] => 
                    [time_zone] => Dhaka
                    [description] => A blogger, microblogger and learner
                    [following] => 
                    [utc_offset] => 21600
						...............
						...............
                    [profile_text_color] => 666666
                    [location] => Rajshahi, Bangladesh
                    [id] => 15842888
                    [profile_background_image_url] => http://static.twitter.com/images/themes/theme9/bg.gif
                    [profile_link_color] => 2FC2EF
                )

            [favorited] => 
            [in_reply_to_screen_name] => 
            [truncated] => 
            [created_at] => Sun May 03 20:56:00 +0000 2009
            [id] => 1689697302
            [in_reply_to_status_id] => 
            1 => TwitterFox
        )
)

Now get some usefull data from this. If we need the last 10 twitter update write the code

<?php
$json = file_get_contents("http://twitter.com/status/user_timeline/tareq_cse.json?count=10", true);
$decode = json_decode($json, true);

echo "<pre>";
$count = count($decode); //counting the number of status
for($i=0;$i<$count;$i++){
echo $decode[$i]1."<br>";
}
echo "</pre>";
?>

Lets pull some userdata

<?php
$json = file_get_contents("http://twitter.com/status/user_timeline/tareq_cse.json?count=10", true);
$decode = json_decode($json, true);

echo "<img src=\"".$decode[0][user][profile_image_url]."\"</img><br>"; //getting the profile image
echo "Name: ".$decode[0][user][name]."<br>"; //getting the username
echo "Web: ".$decode[0][user][url]."<br>"; //getting the web site address
echo "Location: ".$decode[0][user][location]."<br>"; //user location
echo "Updates: ".$decode[0][user][statuses_count]."<br>"; //number of updates
echo "Follower: ".$decode[0][user][followers_count]."<br>"; //number of followers
echo "Following: ".$decode[0][user][friends_count]."<br>"; // following
echo "Description: ".$decode[0][user][description]."<br>"; //user description
?>

Following this method, you can pull any data by analyzing the first output

যে কোন সাইটে দেখান বাংলা তারিখ

আপনারা জানেন, পানবিবির জন্যে আমি বাংলা তারিখের একটা এক্সটেনশন বানিয়েছি। তারপর চিন্তা করলাম যে কোন সাইটে লাগানোর ব্যবস্থা করলে মন্দ হয় না। তাই, সব ওয়েব সাইটে যাতে বাংলা তারিখ দেখানো যায় সেই জন্যে আজ একটা জাভাস্ক্রিপ্ট উইজেট বানালাম। শুধু যেকোন পাতায় নিচের কোডটুকু পেস্ট করে দিন। ব্যস, আপনার সাইটে বাংলা তারিখ দেখুন।

<script type="text/javascript" src="http://tareq.wedevs.com/bangla_date_widget.php">
</script>

উদাহরণঃ