Installing Doctrine2 using PEAR

I was having a some sort of hell trying to install Doctrine via PEAR lately.
$sudo pear channel-discover
$sudo pear install -o

Was giving me errors like:
Package "" dependency "" has no releases
Package "" dependency "" has no releases
doctrine/DoctrineORM requires package "" (version >= 2.0.0)
doctrine/DoctrineORM requires package "" (version >= 2.0.0), installed version is 1.0.6
doctrine/DoctrineDBAL requires package "" (version >= 2.0.0)
No valid packages found
install failed

See, for some unknown reason the versions are not correct for the dependencies. Tried the solutions as stated in this StackOverflow topic for updating PEAR, but didn’t help!

Tried to remove/purge pear. But it didn’t help. Tried to install the Console, Yaml etc separately, also didn’t help.

Then when I tried to purge pear again I got the following error:

Removing php-pear …
Purging configuration files for php-pear ...
dpkg: warning: while removing php-pear, directory '/usr/share/doc/php5-common/PEAR' not empty so not removed
dpkg: warning: while removing php-pear, directory '/usr/share/php/.channels' not empty so not removed

There were some other folders which was reported to be not empty:

So, I removed them all!

Now, I again installed pear.

sudo apt-get install php-pear
Fingers crossed…

Added Doctrine channel: sudo pear channel-discover
And it didn’t say this time that channel is already in registry. Smiling…

Now to fire up doctrine installation, hope this time it works…
sudo pear install -o

et viola! it did!
Attempting to discover channel ""...
downloading channel.xml ...
Starting to download channel.xml (811 bytes)
....done: 811 bytes
Auto-discovered channel "", alias "symfony2", adding to registry
downloading DoctrineORM-2.3.0.tgz ...
Starting to download DoctrineORM-2.3.0.tgz (260,644 bytes)
...done: 260,644 bytes
downloading DoctrineCommon-2.3.0.tgz ...
Starting to download DoctrineCommon-2.3.0.tgz (59,473 bytes)
...done: 59,473 bytes
downloading DoctrineDBAL-2.3.0.tgz ...
Starting to download DoctrineDBAL-2.3.0.tgz (143,996 bytes)
...done: 143,996 bytes
downloading Console-2.1.3.tgz ...
Starting to download Console-2.1.3.tgz (51,354 bytes)
...done: 51,354 bytes
downloading Yaml-2.1.3.tgz ...
Starting to download Yaml-2.1.3.tgz (38,573 bytes)
...done: 38,573 bytes
install ok: channel://
install ok: channel://
install ok: channel://
install ok: channel://
install ok: channel://

Now lets test.
sudo pear list -c

Results in:
Installed packages, channel
Package Version State
DoctrineCommon 2.3.0 stable
DoctrineDBAL 2.3.0 stable
DoctrineORM 2.3.0 stable

Now, try doctrine at terminal:
lenin@office:/usr/share/php/.channels$ doctrine
Doctrine Command Line Interface version 2.3.0

 [options] command [arguments]
 --help -h Display this help message.
 --quiet -q Do not output any message.
 --verbose -v Increase verbosity of messages.
 --version -V Display this application version.
 --ansi Force ANSI output.
 --no-ansi Disable ANSI output.
 --no-interaction -n Do not ask any interactive question.
Available commands:
 help Displays help for a command
 list Lists commands
 dbal:import Import SQL file(s) directly to Database.
 dbal:run-sql Executes arbitrary SQL directly from the command line.
 orm:clear-cache:metadata Clear all metadata cache of the various cache drivers.
 orm:clear-cache:query Clear all query cache of the various cache drivers.
 orm:clear-cache:result Clear all result cache of the various cache drivers.
 orm:convert-d1-schema Converts Doctrine 1.X schema into a Doctrine 2.X schema.
 orm:convert-mapping Convert mapping information between supported formats.
 orm:ensure-production-settings Verify that Doctrine is properly configured for a production environment.
 orm:generate-entities Generate entity classes and method stubs from your mapping information.
 orm:generate-proxies Generates proxy classes for entity classes.
 orm:generate-repositories Generate repository classes from your mapping information.
 orm:info Show basic information about all mapped entities
 orm:run-dql Executes arbitrary DQL directly from the command line.
 orm:schema-tool:create Processes the schema and either create it directly on EntityManager Storage Connection or generate the SQL output.
 orm:schema-tool:drop Drop the complete database schema of EntityManager Storage Connection or generate the corresponding SQL output.
 orm:schema-tool:update Executes (or dumps) the SQL needed to update the database schema to match the current mapping metadata.
 orm:validate-schema Validate the mapping files.

So, thats it.

Running Lubuntu live CD

I’m using Lubuntu 10.04 Live CD on my home desktop for a couple of weeks now. Have chosen Lubuntu just out of curiosity that its a lightweight version of Ubuntu. But I am using this Live CD for only lazyness’ sake!

The desktop was running with one Ubuntu installation I had on my last laptop which died 😦

Without installing it again I kept using that HDD on my desktop. But as I was carrying the HDD in my laptop’s bag for months the Ubuntu installation got bad sectors most probably. So it cant boot. And for being so busy I cant make time to fix the partition and revive those installations. Instead I am trying to adopt this minimalistic habit of using the least installed softwares and settings.

I use a Nokia 2730c for my home internet as I can use the internet on the go through the phone and I can get connected on my Macbook through its bluetooth internet. I hate wires!

So here’s what I use to get the PC running with my minimalistic settings.

1. Downloaded a copy of FireFox4.0 and downloaded some of the Add-ons like: Echofon, Firebug, Yslow etc.

2. Downloaded the ibus-m17n package with dependencies to another folder. Also some other softwares(minimal LAMP stack) like Skype with dependencies as I regularly need to contact with clients. And kept a file called: m17n there. Content of that file is:
export GTK_IM_MODULE=ibus
export XMODIFIERS=@im=ibus
export QT_IM_MODULE=ibus

4. Kept another file called modem with contents:

5. Another file is called bootstrap with content:
dpkg-reconfigure tzdata
cat m17n >> /home/ubuntu/.bashrc
cat modem >> /etc/wvdial.conf

So, whenever I turn on my laptop I am having to go through these steps:
go to that folder and hit F4 (opens that folder in terminal)
I copy the whole path like:
And apply the command:
sudo -i
then, dpkg -i *.deb
and then,
consecutively running the following two connects me to internet immediately:

This is kind of laziness but I am doing this on purpose on the philosophy that I am not heavily dependent upon too much customizations or softwares. And I wont like to regret much after crashing harddisks 🙂

How do you change MAC Address?

Ever wanted to get a permanent solution for your mac address change? Most of you who use internet via LAN has this problem of setting the mac address from the commandline. You do it every single time 3/4 console commands to get the net ready to use in your Ubuntu. Now go make a file(macset) at your home with any texteditor where u’ll have the following lines. notice 22:11:2F:3B:C5:54 is the Mac address of your LAN. It will vary upon your ISP/local provider. Just write down your own mac there. now do
sudo chmod 0777 macset

on the file and when you turn on your pc

you just type

sudo ./macset

to run your file’s commands as shell script, et voila! 🙂

ifconfig eth0 down
ifconfig eth0 hw ether 22:11:2F:3B:C5:54
ifconfig eth0 up
/etc/init.d/networking restart

You can now check if your MAC has been set properly by applying the follwing command at command line

ifconfig | grep HWaddr

Also read this post

An Alternative proxy script to host your WordprssBlog anywhere else

Months ago renowend PHP programmer Hasin Hayder posted a nifty thing of only 10 line proxy. Now this code had been written by Ferdous just after that post had been made. I am using this code to host my blog temporarily. But I felt the need for blogging about it which might help many programmers to better understand the technics. Definitely Hasin bhai’s technic is on the top. But we had a thought in mind that Regular Expressions are a bit costly and on a Conversation with him on Gtalk he said if you can make an alternative to this not using regular expression I am gonna treat you 😛  So, you know this is done for the challenge as well. 😀 Comparing the time of execution it yeilded a bit slower than Hasin bhai’s script. I have added the main proxy syntax highlighted here.

Remember, you need the .htaccess file with this to make it work. Go get the code from Hasin bhai’s original post 🙂

< ?php
    $primary_url=""; //original url of your wordpress blog
    $secondary_url=''; //here the new hosted url should be specified
    $path =array_keys($_GET);
    $data_url = (!empty($path[0]))?$primary_url."/".$path[0]:$primary_url;
    $doc=new domdocument('1.0','UTF-8');
    $data = $doc->saveHTML();
    foreach($tags as $tag){
        $href = $tag->getAttribute('href');
        $href_new = str_replace($primary_url, "$secondary_url", $href);
        $data = str_replace($href,$href_new,$data);

    foreach($form_tags as $tag){
        $action = $tag->getAttribute('action');
        $action_new = str_replace($primary_url, "$secondary_url", $action);
        $data = str_replace($action,$action_new,$data);
    echo $data;

Now Your .htaccess file need to have the following codes:

RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{QUERY_STRING} (.+)
RewriteRule ^(.*)$ index.php?$1&%{QUERY_STRING}

RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1

লিনাক্সে ফাইল সমূহ

অনেকেই পাঠ্যসূচীতে আছে বলেই লিনাক্সটা দু’একবার ইনস্টল করে কাঠখোট্টা এবং জটিল-কঠিন মনে করে একটু কয়েকদিন দেখেই বাদ দিয়ে দেয়। কিন্তু লিনাক্স যে আজকাল খুবই ব্যবহার-বান্ধব(User Friendly) আর সহজ অনেকেই তা জানেনা।
উইন্ডোজ ভিস্তা(বিষ্ঠা?) এবার প্রবলভাবে ফ্লপ মেরেছে। আর ভাইরাস, স্পাইওয়্যার, ট্রোজান, malware ইত্যাকার ব্যাপার আপনার নিত্যসঙ্গী যাদের আছে উইন্ডোজ। তাই বলছি, লিনাক্স ব্যবহার করা শিখুন কম্পিউটার নিরাপদে ও কম ঝামেলায় ব্যবহার করুন।
আজ জানাচ্ছি লিনাক্সে ফাইল সংগঠন কীভাবে সাজানো থাকে তা নিয়ে। Continue reading

উবুন্টু হার্ডি রিলিজ পার্টি মে ১৭, ২০০৮

আমরা অত্যন্ত আনন্দের সাথে জানাচ্ছি যে আমাদের উবুন্টু হার্ডি রিলিজ পার্টি
অনুষ্ঠিত হচ্ছে মে ১৭, ২০০৮ তারিখে।

অনুষ্ঠানটি  হবে

*হাঙ্গরি বাংলাদেশ**
৩/৭ আসাদ এভ্যানিউ, মোহাম্মদপুর, **৫ম তলা।*

এই ঠিকানায়

অনুষ্ঠানটি শুরু হবে ১৭ তারিখ বিকাল ৩টা থেকে চলবে সন্ধ্যা ৬টা পর্যন্ত

পুরা অনুষ্ঠানটিই কয়েকটি সেশনে ভাগ করা থাকবে

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

এব্যাপারে আরও বিস্তারিত জানাবেন রাসেল ভাই

আর কেউ যদি আগ্রহী হন স্বেচ্ছাসেবক হিসেবে আমাদের সাথে কাজ করার জন্য তাহলে
মেইল করুন shahriar at অথবা যোগাযোগ করতে পারেন রাসেল ভাইয়ের সাথে।