300 posts on my blog – not a very small number

Confuscius said “It does not matter how slowly you go so long as you do not stop”. Interesting is that I learned about this quote just few minutes ago and when I knew about it, I thought slowly (without stopping) I have published 300 blog entries on this blog.

A few days ago, when I published my latest blog How I have solved the “The plugin generated xxxx characters of unexpected output during activation problem…” I did not notice that it was my 300th published post on this blog. I noticed it later and tweeted about it. Few friends also responded me with congrats. Thanks to all of them.

Today after reading the quote of the Confucius, I thought it is worthy to write a blog about my 300th blog post. Why? What’s the specialty of 300? Continue reading →

How I have solved the “The plugin generated xxxx characters of unexpected output during activation” problem

Recently this problem troubled me a lot. All time I try to activate my plugin, I get the following error:

The plugin generated 1186 characters of unexpected output during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.

After several attempts of debugging, I failed to understand why it is coming. The mysterious thing was that, this error was not coming for all WordPress installations!

Today, I decided to read the core files those are responsible for activating and/or deactivating the plugins. When I was reading wp-admin/includes/plugin.php, I saw a action hook ‘activated_plugin’ is available just before throwing the error. I believed, if I monitor what is happening here, I can know the reason of the error. So I wrote a small function to save the errors like:

Continue reading →

Searching and retrieving yahoo answers in PHP

I am working on an WordPress autobloggin plugin where I had to search yahoo answers site for any keyword and post the answers in WordPress. After checking their site, I see it is very easy now as they provide API for the questions and answers. I do not know when they introduced API for Answers but I do remember during my last check (quite long time ago), they did not have any API and scrapping was the only way.

Their API for searching and getting answers is very simple and easiest! However, for the better handling of my project, I have mad a class to find questions by any given keyword and then retrieve the answers of any specific question by question ID.

How to use?
Continue reading →

Setting Linux as default in rEFIt boot loader

After successfully installing Ubuntu Lucid Lynx on Macbook, I am mostly using it. I only switch to Mac OS to watch movie using the remote control which yet to work on Ubuntu.

However, problem is that Mac OS was default on the rEFIt boot loader. I wanted to make Linux default. After searching the different configuration files, I found what to do.

Boot to Mac OS

Continue reading →

Upgrading Lucid Lynx to Maverick Meerkat

Upgrading Ubuntu to Maverick Meerkat

Wow new Ubuntu, as said on the site perfect Ubuntu 10.10 (Maverick Meerkat) is now out :D. I could not resist myself from upgrading to it even I am using Ubuntu Lucid Lynx on Macbook Pro 7.1. I am upgrading specially to know whether it also works fine on Macbook.

Upgrading Ubuntu is always easy and fun. All you know that. However, if there are someone who does not know it, here it is. Just run the following command from terminal when you are online:

sudo update-manager -d

Then it should automatically detect that a new version is available. Just click on Upgrade button (show on the image above) when it appears. Follow instructions on screen and then sit relax while it is upgrading for you. However, carefully notice the alert (before main phase starts) it provides which includes the packages are going not to be supported anymore, packages that are going to be deleted etc.

Enjoy and pray for me so that it works fine on Macbook :P. I will write detail experience with it later.

Read/Write on Mac OSx partition from Ubuntu

After dual booting with Ubuntu and Mac OS, I could not write on Mac OS partition. However, I must have to find a way to do that as I will move certain things to ext3 partitions to be seamlessly usable by Ubuntu.

While reading online, somewhere I have read that I will need to disable journaling in Mac OS partition to mount it on Ubuntu with writing permission. I wanted to do the same but I saw the Enable/Disable Journaling button is not enabled in Disk Utility. So, after searching I found a command to do that from command line. It is simple.

# diskutil disableJournal /Volumes/Macintosh HD

That’s it. It disabled journaling on that partition. Later on Ubuntu I mounted the drive and I could write on it.

More Info:

Mounting the partition on Ubuntu

sudo mount -t hfsplus /dev/sda2 /media/mac

I’ve installed Ubuntu on my Macbook Pro 7.1

Well, since buying the Macbook Pro, I was trying to install my most favorite operating system (Ubuntu/LinuxMint). I have failed with LinuxMint and other Ubuntu. However, this manual helped meto get Ubuntu Lucid Lynx installed on my Macbook Pro.

Before installation, I run Ubuntu live. After I’ve confirmed that basic things are working, I have started installation process. The installation was seamless though I was worried about the boot loader. Because I already have rEFIt installed. So, I was not sure if grub will overwrite it or not but it didn’t!. However, I am still wondering, as grub is loaded after I select Linux from rEFIt, will it work if I remove rEFIt? The grub is showing both Ubuntu and Mac Os. Continue reading →

Case inSensitive in_array()

You might already know that PHP’s in_array() function matches the string needle case sensitive way. However, today I was needed something that matches in case insensitive way. Before doing it myself, I googled it and I found a ready made solution. It is quite simple. Here it is:

function in_arrayi($needle, $haystack)
{
    foreach ($haystack as $value)
    {
        if (strtolower($value) == strtolower($needle))
        return true;
    }
    return false;
}

Please note that this case-insensitive version is, at least, 5 times slower than in_array().

Seminar on ‘Building Tech Careers’ at DUET

Today I have participated in a seminar arranged by phpExperts and CSE Department, DUET. The journey to DUET was fun! I came with Hasan vy who picked me up from Mohakhali. Then we all (hasin hayder, omi azad, arild) at Jasim Uddin! Then we had a mini race to come faster but Hasan vy was not willing to risk fuel sufficiency. So he entered a CNG refueling station and as a result he fallen back :D.

However, we all reached safely and the session started in time. The seminar covered the following session:

Continue reading →

How to avoid or skip Trash in WordPress

If you come to this post, it is highly possible that yo are already annoyed by the Trash feature of WordPress that was introduced in its version 2.9.

I personally find it very helpful in live sites but I believe no one than me is annoyed most by it on development site. However, WordPress is always sweet and its programmers has longer nose. So they put a configurable option to adjust it.

All you need is to add a line in wp-config.php file. You will need to add a constant like:

define('EMPTY_TRASH_DAYS', 0);

That’s it. The trash button from your WordPress will just elope and your old loving Delete button will come back:).

One more thing, by default WordPress keeps stuffs in trash for 30 days. So if you want to keep the posts in Trash for 3 days, write like:

define('EMPTY_TRASH_DAYS', 3);