Author: hasin

Acessing secured content via PHP and CURL

If you are looking for a solution to access content over SSL, please take a look at this solution. Here i am fetching content from del.icio.us over SSL. the trick is you have to accept SSL certificates by setting CURLOPT_SSL_VERIFYPEER to false.

<?php
// HTTP authentication
$url = “https://api.del.icio.us/v1/posts/all”;
$ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERPWD, “username:pass”);
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false);
$result = curl_exec($ch);
curl_close($ch);
echo htmlspecialchars($result);
?>

I love you OSAlt

I forgot how i got this link but it makes my dream come true. this is a cool site which lists all open source alternatives of commercial software. the whole site is categorized by the type of software. easy navigation increases the usability. I can find what i need within a minute.

Visit the site at OSAlt

Buggy Bug Reporting system on Google????

Well, yes!!! just now I notice the buggy bug reporting system in google groups. Whil posting a message in http://groups.google.com/group/bdosn i got an error message which says


"    Oops

    We're sorry, but we are unable to display this page at this time.
    Please try again in a few moments.
    If you continue to get this error, please contact Google Support. "

When I click on this “support” link it goes to the following url
http://groups.google.com/support/support/bin/request.py?hl=en&contact_type=bugs

but it actually should be
http://groups.google.com/support/bin/request.py?hl=en&contact_type=bugs

Buggy Google

cring cring – i will be back soon

ah, its just a gorgeous eid with all my family members. we made a lot of fun, a lot of old stories. every sister came with their kids. so it was a great fun. i took some ‘josh’ pictures while we were at wonderland.

i am going back to dhaka this 28th. i played reservoir dogs and it took me around 10 hours to complete. fantastic game play but not suitable for young players because of unnecessary gore and excessive violence. the game seems as a limited version of ‘grand theft auto – vice city’ to me. but i really enjoyed all the driving missions, specially when i got a rating of ‘consumate pro’ in these levels. great sight. i enjoyed it.

after finishing the game i started ‘tomb raider – the legend’ and i agree with no doubt, it is one of the finest game in the tomb raider sequel. its simply awesome. specially not-a-lot jump levels but puzzles. the puzzles took quite longer than usual but i enjoyed it too much. i finished the “bolivia” and “peru” level in 6 hr. simply awesome.

Thank you – GrameenPhone

I am a regular mobile user and my favorite service provider is grameenphone, since 2004. Few days ago GP launched their ISP service and now mobile users subscribe to their internet service using any EDGE/GPPRS compatible mobile phone, or GPRS/EDGE modems. I recently subscribed to this service suign my nokia 6020 as modem and thats a cool experience.

Today I am browsing from my hometown, which was once a dream to me. Thank you GP, for giving us this opportunity.

Bring some Ruby/Prototype flavour in your PHP array

You know that in ruby/prototype you can traverse thru each element of array like this Array.each(function(){/*function body*/}). It has also some methods like without(), inspect(), indexOf();last(),  first() and others…. so how about implementing these cool methods in your regular PHP array?? No problem, lets extend the ArrayObject and have some fun. Here is the class.

class ExtendedArrayObject extends ArrayObject {

        private $_array;
        public function __construct()
        {
                if (is_array(func_get_arg(0)))
                $this->_array = func_get_arg(0);
                else
                $this->_array = func_get_args();
                parent::__construct($this->_array);
        }

        public function each($callback)
        {
                $iterator = $this->getIterator();

                while($iterator->valid()) {
                        $callback($iterator->current());
                        $iterator->next();
                }

        }

        public function without()
        {
                $args = func_get_args();
                return array_values(array_diff($this->_array,$args));
        }

        public function first()
        {
                return $this->_array[0];
        }

        public function indexOf($value)
        {
                return array_search($value,$this->_array);
        }

        public function inspect()
        {
                echo “<pre>”.print_r($this->_array, true).”</pre>”;
        }

        public function last()
        {
                return $this->_array[count($this->_array)-1];
        }

        public function reverse($applyToSelf=false)
        {
                if (!$applyToSelf)
                return array_reverse($this->_array);
                else
                {
                        $_array = array_reverse($this->_array);
                        $this->_array = $_array;
                        parent::__construct($this->_array);
                        return $this->_array;
                }
        }

        public function shift()
        {
                $_element = array_shift($this->_array);
                parent::__construct($this->_array);
                return $_element;
        }

        public function pop()
        {
                $_element = array_pop($this->_array);
                parent::__construct($this->_array);
                return $_element;
        }

}

######################################

Now you can use it like this

$newArray = new ExtendedArrayObject(array(1,2,3,4,5,6));

or you can even construct it like this

$newArray = new ExtendedArrayObject(1,2,3,4,5,6);

then you can use these methods

function speak($value)
{
  echo $value;

}

$newArray->each(speak)
$newArray->without(2,3,4);
$newArray->inspect();
$newArray->indexOf(5);
$newArray->reverse();
$newArray->reverse(true); /*for changing array itself*/
$newArray->shift();
$newArray->pop();
$newArray->last();
$newArray->first();

So how is this ExtendedArrayObject, like it?

Regards
Hasin Hayder
http://hasin.wordpress.com

চায়ের কাপ হাতে প্রতিদিন ভাবি – জীবনটা ছাইমাখা আকাশের ছবি

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

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

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

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

আবোলতাবোল

আজকে দিনটাই শুরু হল খুব খারাপ ভাবে, জঘন্য ভাবে, যা সারাদিনের কাজ করার ইচ্ছাটাই নষ্ট করে দেয়ার জন্য যথেষ্ট। প্রচন্ড মেজাজ খারাপ ছিল সারাদিন। মাঝে মাঝে ইচ্ছা করে সব কাজ ফেলে চলে যাই অনেক দুরে যেখানে কোন কাজ থাকবে না।

সামনে আবার তিনদিন ছুটি। এই তিনদিন পেজফ্লেক্সে কাজ করব। সামহোয়্যারইনে ইদানিং কাজ করা কমিয়ে দিয়েছি, উইকলি চারদিন কাজ করছি এখানে আর বাকি তিনদিন পেজফ্লেক্সে।

আমার বই এর কাজ ও প্রায় শেষ। হয়ত নভেম্বরেই রিলিজ হবে। দারুন একটা ব্যাপার হবে। গত কয়েকদিন ধরে বাংলা ব্লগের মডারেশন প্যানেল এর কাজ শেষ করলাম। অনেকদিন পরে একটু ইন্টারেস্টিং একটা কাজ করলাম।

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

গল্প প্রজেক্টের কাজ আস্তে আস্তে ভালই আগাচ্ছে। প্রতিদিন স্বপ্ন দেখছি এটা নিয়ে। কবে যে রিলিজ দিতে পারব।