Installing Doctrine2 using PEAR


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

Was giving me errors like:
Package "pear.doctrine-project.org/DoctrineORM" dependency "pear.symfony.com/Console" has no releases
Package "pear.doctrine-project.org/DoctrineDBAL" dependency "pear.symfony.com/Console" has no releases
doctrine/DoctrineORM requires package "pear.symfony.com/Console" (version >= 2.0.0)
doctrine/DoctrineORM requires package "pear.symfony.com/Yaml" (version >= 2.0.0), installed version is 1.0.6
doctrine/DoctrineDBAL requires package "pear.symfony.com/Console" (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:
/usr/share/php/.registry/
/usr/share/php/.channels/.alias
/usr/share/php/data
/usr/share/doc/php5-common/PEAR/Archive_Tar/docs
/usr/share/doc/php5-common/PEAR

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 pear.doctrine-project.org
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 pear.doctrine-project.org/DoctrineORM

et viola! it did!
Attempting to discover channel "pear.symfony.com"...
downloading channel.xml ...
Starting to download channel.xml (811 bytes)
....done: 811 bytes
Auto-discovered channel "pear.symfony.com", 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://pear.doctrine-project.org/DoctrineCommon-2.3.0
install ok: channel://pear.symfony.com/Console-2.1.3
install ok: channel://pear.symfony.com/Yaml-2.1.3
install ok: channel://pear.doctrine-project.org/DoctrineDBAL-2.3.0
install ok: channel://pear.doctrine-project.org/DoctrineORM-2.3.0

Now lets test.
sudo pear list -c pear.doctrine-project.org

Results in:
Installed packages, channel pear.doctrine-project.org:
======================================================
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

Usage:
 [options] command [arguments]
Options:
 --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
 dbal:import Import SQL file(s) directly to Database.
 dbal:run-sql Executes arbitrary SQL directly from the command line.
 orm
 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.

Ittefaq-jobs.com | The most friendly job portal of Bangladesh


Its been a while I was not writing any posts to this blog. I am here today to talk about the Job Poral we are working with for quite a while. You may know that ittefaq being the pioneering Daily of Bangladesh has been the prime source of job advertisements in the past. But it was not up-to-date with the technology advancement of this modern times. Ittefaq decided to go for the online presence and its overhauling their main portal as well. We (Bullseyelogic) are partnered with Ittefaq Group of Publications to develop and look after their job portal. As the CTO and Project manager of my team I can tell that my boys have done a great job and we can bravely proclaim its been a great pleasure to work on this project. And the features are pretty attractive compared to any other job poratals in Bangladesh.

Our site is hosted at the wonderful RackspaceCloud. And we have developed it using the Codeigniter Framework.

I’ll present here some of the videos I have made for the ease of our visitors. After watching these videos you’ll definitely like to sign up to our site. And take the opportunity to be with the promising job portal.

Watch the above to get a primer about the Employer registration and Control Panel.

Job Seeker view.

Watch the primer for the interactive CV-Builder.

 

Follow Ittefaq jobs on twitter & Facebook

PHP শেখার সহজ উপায়গুলো জেনে নিন


অনেকেই অনেক দিন ধরে পিএইচপি বই নিয়ে গুতোগুতি এদিক ওদিক দৌড়িয়েছেন। কিন্তু পিএইচপি শেখা আর হয়ে উঠছে না, তাইনা?

আপনাদের চিন্তা মাত করতে এবার দিচ্ছি বেশ কিছু টিউটোরিয়ালের ঠিকানা।

একটা ব্যাপার মনে রাখতে হবে। কম্পিউটারের যেকোনো ভাষা শেখার সাথে সাথে তা অনুশীলন বাধ্যতামূলক। শেখার সময় সহজ মনে হলেও তা ফলিত আকারে নিজে অনুশীলন না করলে মনে থাকবে না এবং আয়ত্তে আসবে না।

আসুন কয়েকটি ঠিকানা থেকে জেনে নেই কী করে তাড়াতাড়ি পিএইচপি শেখা যাবে

‌১. ভিডিওhttp://www.phpvideotutorials.com/free
http://killerphp.com
Click This Link

শেষের লিঙ্কটিতে দুনিয়ার আরো অনেক কিছু পাবেন টিউটোরিয়াল হিসেবে।

২. http://php.net এটাই পিএইচপি’র বাড়ী এখান থেকে ম্যানুয়ালটি নামিয়ে নিন। আর এর বেসিক, মিডলেভেল বা এডভান্সড সব তথ্যাদি এখানেই পাবেন।

৩. যারা পিএইচপি নিয়মিত অনুশীলন করছেন তাদের এটা বেশ কাজে লাগতে পারে http://widgets.opera.com/widget/5288/
এটি হচ্ছে পিএইচপি ম্যানুয়ালের উইজেট।

আরো অনেক অনেক লিঙ্ক আছে… কিন্তু সব আপনার দরকার নেই.. আগে শুরু করে দিন পরে নিজেই খুঁজে নিতে পারবেন।

ওহ হ্যাঁ ইংরেজী শেখা কিন্তু বাধ্যতামূলক.. তা’নাহলে কাচাই থেকে যাবেন যেকোনো প্রোগ্রামিংএ। আর Wrox বা অন্য প্রকাশনীর একটি অন্তত বই হাতের কাছে সবসময়।

পুনশ্চ: নেটে পাওয়া লিঙ্কগুলো নেটেই বুকমার্ক করে রাখুন। টুইটার বা ফ্রেন্ডফীড ব্যবহার করে। ফেসবুকেও লিঙ্ক শেয়ার করতে পারেন। বর্তমানে প্রসিদ্ধ এবং প্রতিষ্ঠিত প্রোগ্রামারদের ব্লগ পড়ুন। নিজেও যা কিছু শিখবেন ব্লগ করে ফেলুন(কপি/পেস্ট করে নয়, মৌলিক লিখে)। জ্ঞান ছড়ালে বাড়ে :

সবার জন্য বিশেষ প্রয়োজনীয় আর্টিকেলস
এই মাত্র পেলাম PHPArch মে ২০০৯ সংখ্যাটি ফ্রি দিচ্ছে ওরা http://phparch.com/c/magazine/issue/97 তাড়াতাড়ি সংগ্রহ করে নিন। :)

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
    error_reporting(0);
    $primary_url="https://lenin9l.wordpress.com/"; //original url of your wordpress blog
    $secondary_url='http://savvycoders.com/'; //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');
    $doc->loadhtmlfile($data_url);
    $data = $doc->saveHTML();
    $tags=$doc->getElementsByTagName('a');
    foreach($tags as $tag){
        $href = $tag->getAttribute('href');
        $href_new = str_replace($primary_url, "$secondary_url", $href);
        $data = str_replace($href,$href_new,$data);
    }

    $form_tags=$doc->getElementsByTagName('form');
    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

পিএইচপি ৫ এবং ৬ এর উল্লেখযোগ্য বৈশিষ্ট্যগুলো


পিএইচপি৫ এর মূল ফিচার সমূহ:

১. পিইচপি৫ লিমিটেড টাইপ হিন্টিং সমর্থন করে।
২. অবজেক্ট ওরিয়েন্টেড কনসেপ্ট পুরোপুরিভাবে সমর্থন করে।
৩. এক্সপ্লিসিট কনস্ট্রাক্টর ও ডেস্ট্রক্টর, অবজেক্ট ক্লোনিং করা, ক্লাস অ্যাবস্ট্রাকশন, ভ্যারিয়েবল এর স্কোপ বা পরিধি/ব্যাপ্তী, ইন্টারফেস ইত্যাদি যুক্ত হয়। এছাড়াও পিএইচপি ৫ এ অবজেক্ট ম্যানেজমেন্ট অনেক উন্নত করা হয়েছে।
৪. Try/Catch Exeption Handling: এরর বা ভুল হলে তা কিভাবে মোকাবেলা করবে প্রসিডিউর মূলক প্রোগ্রামে প্রোগ্রামারের নিজস্ব উদ্ভাবিত পদ্ধতিতে বেশিরভাগ ক্ষেত্রেই ভুল থেকে যাবার সম্ভাবনা থাকে। সি++, সি# ও জাভা এর মতো উন্নত প্রোগ্রামিং ভাষায় এগুলো এই ট্রাই-ক্যাচ এর জাল ফেলে ব্যতিক্রম/অন্যথা সুন্দরভাবে ম্যানেজ করা যায়।
৫. এক্সএমএল ও ওয়েব সার্ভিসের উন্নত সংস্করণ: libxml2, simpleXML(parsing and manipulating XML) SOAP and Web Services.
৬. SQLite এর নেটিভ সাপোর্ট যা খুবই শক্তিশালী ডাটাবেজ সার্ভার (এতে ফাইল বেজড ডাটাবেজ সংরক্ষণ সুবিধা আছে)।
৭. উন্নত অবজেক্ট ওরিয়েন্টেড নিয়ন্ত্রণ সুবিধার কারণেই শক্তিশালী পিএইচপি ফ্রেমওয়ার্কগুলো তৈরী করা সম্ভব হয়েছে। যেমন- কেক-পিএইচপি এবং জেন্ড ফ্রেমওয়ার্ক।

পিএইচপি৬ এর মূল ফিচার সমূহ:

এটি মুক্তি পাবার কথা ছিল ২০০৭ এর শেষের দিকে। তবে ২০০৯ এর প্রথম দিকে রিলিজ পাবার সম্ভাবনা বেশি।
১. ইউনিকোড এটিতে নেটিভ সাপোর্ট পাচ্ছে।
২. নিরাপত্তার দিকে জোর দেয়া হয়েছে।
৩. ভাষাভিত্তিক অনেক ফিচার ও কনস্ট্রাক্ট যুক্ত হয়েছে। foreach() কনস্ট্রাক্ট এখন বহুমাত্রিক অ্যারের জন্যও কাজ করবে। ৬৪বিট এর ইন্টিজার টাইপ যুক্ত করা হয়েছে। লেবেলযুক্ত break

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