With symfony

Three year after i got first project on symfony. While there are always be a discussion for real value for frameworks in php comparison to core scripts. But i think when we talk about strong oops and design pattern level programming then we got best of these found in frameworks.
Symfony is one of very strong and yes complex framework in php.
It support various features like mvc, url rewriting, orm, configuration based architecture, various security features, 3rd party and user plugins.
I am most impressd with its yml based configurations. Which is overridable between different layer of architecture. So application level configuration can be overrude at module level and also on action level. Strong OOPS based architecture make code reuse easy.
It have some complexties like command line based module, models etc generation. But that all part are going easier after you doing it more times.
Well but one thing which is good and annoying both is hydration which is complex and make sometime more tough to work on complex queries.
But as my experience on working on cms like drupal is not much enjoying, it is more enjoying to play with oops and orm concepts on framework.
Well for today just that, i will dig more into symfony in incoming days.

CMS usability. A core programmer view

After a long gap i am return to blog. Last time i am here talking about synfony and linux. Now i working on drupal cms for since last six months.
It is always a question in front of a php person if using a cms compared to framework or core programming is good approach.
While cms are good RAD tools. You can make applications in few days/week which will take month to complete using core or even framework.
Cms are also very rich through their plugin system. So  customizaton is easier if using fine plugins.
They have the advance cache management.
But not all things was cms is not right. They are very unflexible to their architecture. Customization is not always easy. Some time small functionality requires big work to done.
They used database for load all content which includes html also. So even small application have big db space.
Caching is just not a feature but a requirement even into development period. This can be a advantage of frameworks which can work without caching in development mode as they use only required db space.

So in case of complex projects it is not always wise decision to use cms. But project have requiring good content management and little customization are better suitable to cms.

Tata Photon on Ubunu

Well I using Tata plug2surf for my laptop since 2 years. First in mandriva 2007, 2008 and 2009 in my desktop. When I have a laptop then I installed ubuntu jaunty on this and configure tata plug2surf. For Both distribution plug2surf work fine. however it is too slow comparison to new broadband plans in market. But for few reasons I stayed with it till now.

When Tata launch the Photon with speed in Mbs. Its my time to check it. For my goodness One of my friend purchase the stick and installed on his vista machine. But when He tried on his fedora things not going smoother. Then he want assist on this matter. I tried with plug2surf way, But it not worked. Then I go for further assistement first on google then on ILUGD (Indian linux group delhi), And after some wait I got solution which I tried on my Ubuntu.

Now i am going to give the description how I set it all (I am very thankful to Mr. Varad gupta which assist me on ilugd mailing ).

First check whether your system have following package or not.

Modprobe, depmod, modeswitch.

On Ubuntu jaunty first two package is default installed while I have to download and installed third package.

There are a big reason to install this. One of my friend tell me about difference between 2 of Tata’s products plug2surf and photon. Plugsurf default detected as USB modem in linux So there is no need for so much steps for nstall modem. While Photon is not detected as modem, So first we need to taken this step. First There should be modeswitch-usb package should be installed on your linux system. I get deb package from


i) First, check  data card vendor and product by lsusb command.

@@ Output look like a below lines and first high light word is vendor
and second is product.
# lsusb
Bus 002 Device 002: ID eb1a:5060 eMPIA Technology, Inc.
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 004: ID 148f:2573 Ralink Technology, Corp. RT2501USB Wireless Adapter
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 004: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
Bus 003 Device 003: ID 1b7d:0700

Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

After plugin the device I found one extra entry (second last row in above output)
ii) Now, load usbserial module by the help of below modprobe and depmod

@@ Again replace vendor and product with your vendor and product,,
# sudo modprobe usbserial vendor=0x1b7d product=0x0700
# sudo depmod -a

iii) Now change device mode to USB by usb_modeswitch command

# sudo usb_modeswitch -v 0x1b7d -p 0x0700 -d 1
# sudo usb_modeswitch -v 0x1b7d -p 0x0700 -H 1

iv) Check usb device location by command

# sudo wvdialconf /etc/wvdial.conf

I get ttyACM1 detected as USB device,

Edit, dailer configuration, You only have to change Username and

Password parameters. Replace first XXXXXXXXXX with username and second XXXXXXXXXX with your passowrd ( it also may be same as Username ).
# vim /etc/wvdial.conf
[Dialer Defaults]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Stupid Mode = 1
Modem Type = USB Modem
ISDN = 0
Phone = #777
New PPPD = yes
Modem = /dev/ttyACM1
v) Finally, start dial,,,,
# sudo wvdial

Note : – Because most commands require root user level permission, So i used sudo in commands, You can choose your options depend on your distribution.

Alas ! virtualbox OSE not have USB

I installed virtualbox OSE on my ubuntu zaunty, and then setup two machines fedora & pcbsd. Now yesterday I checked that there are no usb detected in my VM. I yahooed (:)) the net for usb connect and found that there are no support for usb in OSE edition and you have to install non OSE edition for that.

Well I were believing that companies making open source software dont restricted their software for some feature (that is problem for non open source software like shareware/freeware for windows), But is seems Sun (or Oracle may be) not interested in providing full fledge open source virtual server solution. They behave same as their counterparts companies making shareware for windows. After all usb support in VM is basic need for any machine for today’s computers.

Relational v/s Object Sql Model in PHP

Im confusing about using relational or object model for database in programming languages. while relational model is tradional, simpler, fast and easy. But It is very bad practice for frameworks where good coding standards are requirement. Object Model is good in this case but it make developer life more complex. and most of object model also lack of completeness for all sql statements in general. One example is UNION statment which is not an easy in Object Model to implement. and Also performing subquery using OM is also a big challenge.

Let see an example For Sql Query

Relational Model :

$q = “SELECT id, name FROM tbl_test WHERE id=1”;
$query = mysql_query($q);
$row = mysql_fetch_row($query);

Relational Model :(Using Symfony Framework)

$c = new Criteria();

$c->add(TestPeer::ID, 1);

$RS = TestPeer::doSelectRS($c);
Now you can see the elegantness but complexity of OM.