News aggregator

Tillate.com Blog: Unit test practice at tilllate.com

PHPDeveloper.org - 1 hour 42 min ago

Silvan Muhlemann has posted about the unit testing that tillate.com does for their releases - the whole process from start to finish.

For now over three years we are working with unit tests. I'd like to share some of those experiences. As we have two frameworks in place for our website, I can compare two different strategies for unit tests.

He talks about their choice of SimpleTest, their test monitoring, CruiseControl and their "if it doesn't pass, you can't release it" mentality to keep their site as bug free as possible.

Categories: Resources

Matthew Turland's Blog: PHP 5.2 and SQL Server 2000 on Windows XP

PHPDeveloper.org - 5 hours 19 min ago

Matthew Turland has posted about his experience working with a Windows XP system trying to get PHP 5.2 and SQL Server 2000 to play nicely together:

Recently at work, I was tasked with finding a method to retrieve data from a third-party SQL Server 2000-based system into our own MySQL-based application. It's worth noting that both system are behind their own firewalls and I was trying to bear security in mind as I did this.

Some highlights of his work included using GoToAssist to get to the system, using EMS SQL Manager to work with the SQL server itself and some of the PHP code he "threw at it" to grab the info he needed from the database (with the PDO drivers).

Categories: Resources

SPL Datastructures updated

Planet PHP - 5 hours 54 min ago

Here is some news about data structures available in SPL:

  • There finally is documentation for SplDoublyLinkedList, SplStack and SplQueue.
  • "New" classes: SplHeap (abstract), SplMaxHeap, SplMinHeap and SplPriorityQueue, documentation of those classes is in progress.

Here is an example of a simple but task scheduler using SplPriorityQueue:

<?php $q = new SplPriorityQueue; $q->insert('a', 1); $q->insert('b', 4); // ... $q->insert('z', 2); foreach($q as $task) {     // .. process task ..     echo $task."\n";     // ... add new tasks ..     if ($task == 'b') {         $q->insert('c', 3);     } } /* Output:  * b  * c  * z  * a  */ ?>

This implementation is really efficient as the underlying data structure of SplPrioritiyQueue is a Heap, which allows insertions and extractions in O(log2(N)).

Categories: News

Padraic Brady's Blog: Zend Framework Blog Tutorial - Part 7: Authorisation with Zend_Acl & Styling

PHPDeveloper.org - 6 hours 13 min ago

Padraic Brady is up to part seven of his blog creation (with the Zend Framework) series, tracking his development paths and though processes along the way. This new part of the seres looks at using Zend_Acl for user management and changing up some of the style of the site.

We previously covered how to authenticate an author to the blog, but we still have nothing ensuring only authenticated authors can access the new Administration Module. This is the domain of Zend_Acl, an implementation of an Access Control List system which limits access to resources by the roles assigned to a user.

He starts by helping you understand access control lists including roles and privileges. He plans out the different roles that he wants the application to have first (always a good first step) and then implements them in a class extending the Zend_Acl component. He wraps this all in a front controller to make it easy to use.

He also tosses in a bit there at the end about CSS and styling to handle the forms for login and the administration piece of the blog he created earlier.

Categories: Resources

Sebastian Bergmann's Blog: PHP Has No Culture of Testing

PHPDeveloper.org - 7 hours 24 sec ago

Sebastian Bergmann has pointed out something obvious to anyone that's ever tried to work with unit tests in PHP - there's just not that much support for it. The software is there and waiting to be used, but too many developers just don't take advantage of it.

Maybe it took the PHP community a little longer to realize the importance of testing. But now that we know how to build applications that "just work", are fast and scalable, as well as secure, a big topic in the PHP community right now is to implement processes and use techniques that help us assure that the software works correctly throughout the its lifecycle.

He points to some comments made at a recent panel discussion about PHP and testing, the proliferation of frameworks for the language and the things that have no name that developers use every day to make their code "just work".

Categories: Resources

SaniSoft Blog: Help! vendor() is deprecated.

PHPDeveloper.org - 7 hours 53 min ago

On the SaniSoft blog today, Tarique Sani has a quick hack for CakePHP users needing to transition over from the deprecated vendor() call - import().

Use of vendor() function to load third party libs in CakePHP has been deprecated for some time now... It has been replaced with the more generic App::import() the usage is simple.

There's also a little trick you'll need to know for files with underscores (drop it and replace with an uppercase) and how to get it to be a bit more flexible and recognize vendor files in subdirectories or ones differently named.

Categories: Resources

Synchronizing Drupal Modules with Adobe AIR

Zend Devzone - 8 hours 26 min ago

Whether you’re an enterprise developer working in a large shop or setting up a blog for yourself, you’ve almost certainly been tasked with keeping your development code in sync with some type of stable release. Whether a project is big or small, you still need to ensure that the core code you work with remains consistent. This article will walk you through the development of an Adobe AIR and AJAX application used to synchronize the modules of a site developed in Drupal, the popular free and open-source content management system used in thousands of sites across the Internet.



Categories: News

Synchronizing Drupal Modules with Adobe AIR

Planet PHP - 8 hours 26 min ago

Whether you’re an enterprise developer working in a large shop or setting up a blog for yourself, you’ve almost certainly been tasked with keeping your development code in sync with some type of stable release. Whether a project is big or small, you still need to ensure that the core code you work with remains consistent. This article will walk you through the development of an Adobe AIR and AJAX application used to synchronize the modules of a site developed in Drupal, the popular free and open-source content management system used in thousands of sites across the Internet.



Categories: News

PHP in Action Blog: I want enums in PHP

PHPDeveloper.org - 8 hours 47 min ago
I want Enums in PHP

That's how this new post on the PHP in Action blog starts this morning. The one thing that he wants is enumeration support in PHP. He shows how it can currently come close with a "roles" system:

Useful examples I've encountered in web programming are states or stages in a process and user roles. Another kind of example is one I used in PHP In Action: an authorization system with three fixed roles or categories of user: regular, webmaster and administrator.

He sets up an example class that sets constants for the different access levels rather than just relying on strings to handle it (which, as he points out, could very easily be misspelled and not throw any kind of error) .

Categories: Resources

Database Management with phpMyAdmin

Planet PHP - 8 hours 47 min ago

This is part one of the quick review of the book “ for Effective MySQL Management” and the phpMyAdmin software.
This article/review is not just another review about phpMyAdmin, but more some information about features I haven’t used during the last years of PHP/MySQL web development.

About phpMyAdmin

PMA is a full featured tool to administrate your MySQL database server via a web browser. While the functions are almost unlimited, it’s also a powerful tool to maintain the database content even for less experienced users.

It’s already a year ago (or more) that I got the book “Mastering phpMyAdmin” as a present/reward for contributing some snippets on weberdev.com. Finally I found the time to read (most of) the book during a vacation. The book is great for webmasters using phpMyAdmin (PMA) the first time and also more advanced users. The book covers the installation, basic database interactions using PMA like simple INSERT or SELECT commands and also advanced features like the relational system provided by the phpMyAdmin software. (more…)

Categories: News

Developer Tutorials Blog: Testing PHP with the interactive shell

PHPDeveloper.org - 9 hours 31 min ago

Akash Mehta shares a helpful hint in this new post to the Developer Tutorials Blog today - testing out PHP code via the command line PHP binary.

Thankfully, PHP provides the interactive shell, allowing you to test out PHP interactively with immediate feedback. Here's how to take advantage of this mature feature of PHP.

With the help of the "-a" flag on the command line, the PHP binary will hand you an environment where you can code PHP and instantly see the results. He does mention a few quirks that make it different than working with PHP through a web server, namely moving in and out of code blocks and remembering to finish out with a semi-colon when the line is done.

Categories: Resources

I dont give you a damn, if

Planet PHP - 10 hours 58 min ago
You came to an interview for “PHP Developer” and you said you dont know the name “Rasmus Lerdorf”. You’ve used MySQL for a long time and didn’t even hear about “Michael Monty” and though “jQuery” is your “favorite JS framework” for a long time, but “John Resig, who is he?” Fuck Off! The reason behind writing this [...]
Categories: News

The D3 arrived. Part II: Pros and cons

Planet PHP - 11 hours 23 min ago
Unpacking the box—and being happy! The Nikon D3 is just an unbelieveable camera—or toy for that matter. Anyway it just feels right. A bit heavy maybe but, well.

Most things feel just as they should be and there is hardly anything wrong with the camera. So I spend a few days shooting, collecting all the things I do not like. Here goes:

1) First of all, Nikon obviously tried to give the D3 a superior strap compared to the D200 or the D300. To me it is just too broad; the old one was much better. So the first thing after buying the Nikkor 24-120/VR was a new strap!



2) I even read the book (aka manual)—but Nikon indeed removed my favorite pre-shutter mirror-flipping mode. Of course, the D3 has a mode where you can flip the mirror with first pushing on the shutter release button and then taking the shot with a second push. But what about the nice mode where you just press once and the camera waits a split of a second? It is an awesome feature, it usually gave me one additional stop.

3) Nikon still refuses to care for its customers. I mean you can now add some crappy signing to the pictures. But hey, I still cannot claim the camera to be mine. That's unbelievable. The EXIF standard has both author and copyright tag (though sadly combined in one tag). And of course the camera does not ask me to point it to my PGP or whatever key. Without that what is the signing good for? I guess it makes people that have no clue feel better. For all the rest, this is useless becasue you can always get rid of this signing, post-process the picture and re-create it. And of course this includes changing the author and copyright info some software adds for you. Photokina is ahead, if I have time for it I will once again ask about this insanity.

4) There is no ISO setting below 100, not even with stupid filtering in the camera. Not that I personally will ever miss it though.

5) The HDMI output is pretty poor. On preview it uses the thumbnails, in other words it has very low resolution and the output simply looks crappy. Hey, I have a 46" screen and I would expect that people buying a D3 and use the HDMI would use nothing smaller. Now it gets a bit better when changing to a slide show. However there is no 1080p mode and the 720p mode looks in my opinion a tad bit better than the 1080i mode. Either way, not worth buying an HDMI cable. This said, it does not really matter that the camera allows neither 1920x1080 nor 3840x2160 resolution.

6) When doing a firmware update, you have to upload the firmware files separately to exactly one CF card. When using both CFs, the camera simply refuses to accept any firmware file and when finding both it always selects the same one. At least the order in which you do the update does not matter. Well so far it does not.

7) Once again the focus points are all around the center of the sensor. They only spread so much that you get about one focus point per golden cut. Meaning one probably uses about 9 focus points. As a tip for Nikon, if the corner focus points are used extremely often, then that is probably based on the fact that people are missing points closer to the edges.

8) The function button still cannot do everything. And of course it cannot do pre-shutter mirror-flipping. Simply becasue the mode is gone (see 2).

9) The camera does not allow to add a 'normal playback' mode as Caitlin called it. Meaning you cannot set the camera to show some information while having at least one screen without any data (over-exposure areas, focus points, etc.).

10) The view finder is really awesome. But the rubber, the eyepiece you put, well, to your eye, is simply bad. So the next things I ordered was a DK-17M and a DK-19.

Now all of the above are really minor complaints. And there is a hell lot of good things to mention. Just to mention a few highlights:

1) The re

Truncated by Planet PHP, read more at the original (another 4445 bytes)

Categories: News

The D3 arrived. Part I: Now I need a new lens

Planet PHP - May 11, 2008 - 1:05pm
The camera change from Nikon D200 to Nikon D3 with its sensor size change from APS-C aka DX to full frame aka FX unfortunately made the purchase of a new all rounder lens imminent. And so I switched from 'AF-S DX VR Zoom-NIKKOR 18-200mm f/3.5-5.6G IF-ED' to 'AF-S VR Zoom-NIKKOR 24-120mm f/3.5-5.6G IF-ED'.



The picture was shot using the 'AF-S VR Micro-NIKKOR 105mm f/2.8G IF-ED' on the D3 and post-processed with Adobe Lightroom 2.0 beta and Corel Paint Shop Pro XI.

Both lenses have a UV filter mounted. The 18-200/VR has a B&W filter while the 24-120/VR has a Hoya filter. Both lenses come with VR and share the same aperture range, that is f/3.5 to f/5.6. Also the wide range is very compareable as the 18mm on the DX camera turns into 27mm on 36mm film, while the 24mm are already correct in terms of 36mm film equivalent, when mounted on the D3.

The unfortunate difference is the telephoto range. Here the 200mm DX format turns into 300mm on 36mm film. And that is way more than the 120mm of the FX lens.

Interestingly, the switch does not come with a handling difference - at least not in lens handling. Both lenses nearly look identical and share a more or less identical housing. But as to be expected, the 18-200 goes out much more than the 24-120 does. Sharpness-wise it appears both lenses deliver the same quality. Meaning they do a great everyday job but do not take very sharp pictures. Since even the flowers of both lenses are nearly identical, I had to check the internet to figure out which one belongs on which lens. The HB-35 has broader fins and belongs on the 18-200. The 24-120 is a tad bit wider, so it takes the HB-25 with its smaller fins.

I actually bought the camera and lens in Switzerland where prices are insanely high - though yet much lower than for instance in Germany. So I spent some time searching for shops with reasonable prices. I found digitec in Zürich and ars-imago in Zug, which was not too far away and unlike digitec, where I bought the camera, had the lens in stock.

I had to go twice to digitec because the first time they figured they could not get enough money from my ATM cards. It turned out that my two German ones only allow higher charges in Germany - or they just don't care so that you pay with Credit Card. For that however they happily charge 2.75% extra. That is absolutely ridiculous and of course unacceptable. So I came back the next day after visiting my bank in the morning. And believe me, it really feels strange running around with 6k in cash.

When I decided for the lens and found ars-imago I chose them for one reason. It was the cheapest place with the lens in stock that was reachable by car. There was one shop where I could have ordered the lens on-line. Including charges for shipping I would have paid the same, well there also is the credit card insanity. So I either would have had to wait longer or pay this unbelievable special Swiss insanity extra charge. So I happily drove to Zug after reading that there was the last lens of its kind waiting for me to be picked up. However when I arrived they told me with the typical Swiss smile, that my lens was sold half an hour ago. That means that those idiots sold my lens just after they sent me the confirmation that I can pick up the lens on the same day. They assured me the lens would come next business day which was two days later. So I lost one day for experimenting - dammit! The least thing one would expect now - of course - is that they would give a bit of a rebate for making me drive twice. But nothing - that's Switzerland. Lesson learned, never buy anything from ars-imago again.Blogged with the Flock Browser
Categories: News

A cute search box

Planet PHP - May 11, 2008 - 12:45pm

That's it really. A cute search box that's "self contained" inside a PHP function so it's extremely convenient to display. What can I say? I got bored... [Link]

Categories: News

Unit test practice at tilllate.com

Planet PHP - May 11, 2008 - 3:54am

For now over three years we are working with unit tests. I’d like to share some of those experiences.

As we have two frameworks in place for our website, I can compare two different strategies for unit tests.

In our homemade legacy framework we were using SimpleTest. Mainly because I read PHP|Architect’s Guide to PHP Design Patterns and Simpletest was Jason’s framework of choice.

We have a cron job running which runs all tests every hour. The results of the tests are being shown on a page. The results are also displayed in Nagios.

(more…)

Categories: News

ExtJs - talking forking

Planet PHP - May 11, 2008 - 3:30am

I've started looking at forking ExtJS, after some considerable thought, I'm pretty close to the concluding that forking ExtJS is really option left, to retain the investment I've already made in it..

So, as I have a Zip file of 1.1.1 and it explicitly says that the Javascript code is Licensed under LGPL, (not ifs/ no but's) - I'm slowly putting the code into my subversion repo under www.akkbkhome.com/svn/extjs1  (*I'm looking at extjs1.1.1 as I have been using it and tend to prefer it, but there is nothing in the discusion below that precludes anyone helping/leading with the last extjs2 version that was released)

Now if this actually becomes a full fork (most forks fail BTW), It will need a bit of work, so If anyone is interested in helping out. I've no idea where this could go. But this fork ain't changing the license no-more...

The plan

I think there's quite a few things to do here... so Ideas or contributions.. -- feel free to email me, or just comment on this post. - At worst, it could form the brainstorming for anyone else actually doing this. (If you want to comment on if/should this be done - do it on my previous post, otherwise I will delete the comment)

The Code

  •  Tidy up Ext Js's source - see if it can be stored in one file per class, and have a simple classname->filename mapping... (eg. Ext.Dom in Ext/Dom.js) ** started..
    •  Sort out the CSS
    •   If Jack ever released any old CSS/images under a open licence (ext-yui source?) see if that can be used.?
    •   or Go through the classes and see what their requirements are for CSS
    •  Probably in batches - write a short document listing the required classes needed by the batch, enabling someone to contribute a CSS file that works.
    •  Posibly create enough CSS to make enough of it useable (probably with no images)
  •  Document image requirements (see above), then see if other open projects already have images that can be used? - otherwise see if someone want's to contribute themes..
  •  Break up Source into managable packages - Distribute ownership! - GIT or multiple SVN repos??

The Project

  • Build infrastructure
    • Create a command line tool that can compress then merge all the required components (and allows end users to do this)
    • Allows source to be taken from multiple sources (so you can create builds with extensions / or without stuff you don't need)
  • Forums
    • Set up a mailing list! (and archived, with a search feature!) - Anyone know a good hosted one available? - or should I just go off and set the infrastructure here..
    • No more 'premium' ... users! - equal, like open source is supposed to be!
  • Manual
    • Work out how to build a manual from the source!-- While Ext's manual is not bad, take the opportunity this time do it right, and have a bug reporting / user comments on it....
  •  A name??/ - May need some thought...

Truncated by Planet PHP, read more at the original (another 2564 bytes)

Categories: News

Spaces in PHP variable names

Planet PHP - May 11, 2008 - 1:37am

I just found out a very strange PHP feature by browsing the PHP-GTK2 API with the Reflection classes : spaces can be used in some alien places, like variable names.

But the doc says you can't !

Well, try this in PHP 5.2.5, for instance:

read more

Categories: News

I want enums in PHP

Planet PHP - May 10, 2008 - 11:04pm
I want Enums in PHP

I'm currently working about equally in PHP and Java. I can't say I've fallen in love with Java. But Java does have a feature or two that would be useful in PHP. One of them is the Enum (enumeration, that is), which is traditional in some languages and DBMSes (including MySQL) and was introduced in Java 1.5 (or is that 5.0? I'm sure they do that just to expose people like me as Java amateurs).

Enumerations are useful when a variable can have one of a given number of values. Actually useful examples I've encountered in web programming are states or stages in a process and user roles. Another kind of example is one I used in PHP In Action: an authorization system with three fixed roles or categories of user: regular, webmaster and administrator.

If we represent the roles as text strings, we risk getting our tests wrong:

if ($role == 'amdinistrator')...  

The only problem is that the word “administrator” is misspelled, so the test won't work.

This can be solve by representing the values with named constanst instead. Using class constants in PHP 5:

class Role const REGULAR = 1; const WEBMASTER = 2; const ADMINISTRATOR = 3; ...  

Now we can do this instead:

We won't get away with any misspellings here; using an undefined class constant is a fatal error. Compared to global constants, this may be easier to figure out, not least because we know where the constant is defined (inside the Role class) just by looking at it.

This is called the int Enum pattern in the official description of Java Enums. The documentation also lists some problems with this, starting with type safety, which we're not that concerned with in PHP anyway. A more relevant problem is the fact that when you print the value, you just get the number.

But I don't see why you shouldn't use strings for the values:

class Role const REGULAR = 'REGULAR'; const WEBMASTER = 'WEBMASTER'; const ADMINISTRATOR = 'ADMINISTRATOR'; ...  

One PHP-specific problem I didn't mention in the book is the problem that happens with long class names. Since we still don't officially have namespaces in PHP, we will easily end up with nauseatingly long constant names, like this:

It's quite depressing to have to do that a lot. I've tried putting constants in their own class with a shorter name, but I didn't like it much. One thing I tried recently was creating instance methods to return the constant value:

class MyProject_Authorization_RBAC_Role... public function REGULAR { return self::REGULAR } public function WEBMASTER { return self::WEBMASTER } public function ADMINISTRATOR { return self::ADMINISTRATOR }  

Now we can create an instance with a short name and get the values from that:

$roles = new MyProject_Authorization_RBAC_Role; if ($role == $roles->ADMINISTRATOR())...  

All of this just to get shorter names? I little desperate perhaps. So yes, I would like Enums in PHP.

Categories: News
Syndicate content