new PHP meeting

PHPBelgium is pleased to announce our first meeting in Mons!

Date:  24/06/2009 19:3023:00
Location: ISIMs, Mons, Belgium

The event will be recorded and available in live streaming on this url: www.isims.be/phpbelgium.html

If this link wouldn’t work, more information can be found on the website of CampusNumerique

Schedule:
19:30h Welcome & drink
20:00h PHP & the MVC Pattern – Patrick Allaert
Patrick Allaert is Competence Center Architect at AUSY where he brings 10 years of PHP development experience. Patrick is also known by the community for developing APM as well as evangelizing for Free and Open Source Software
21:00h Break
21:10h PHP 5.3: new features – Davide Mendolia
Davide is a veteran PHP developer working at AUSY as a PHP Software Architect. In his spare time, Davide works on APM too as well as contributing to the PHP project with benchmarking tests
22:00h Quizz to win goodies/conference tickets
22:15h Socializing and networking

Posted in Events, General | Tagged , , , , | Leave a comment

an infinite image carousel

One of my favorite blogs is that of jQuery 4 Designers and this time he created a cool tutorial on how to create one with jQuery.

It has always been a struggle to create a nice carousel but i think this guy managed to create a real cool one. Also one of the most interesting things about this website is that all the code he writes in jQuery also works after disabling JavaScript. Try it!

for more information and other cool tutorials you can visit his website: jQuery4Designers

Posted in General, Javascript, Jquery, Layout | Tagged , | Leave a comment

the future of web development

It is always hard to tell what the future will bring, especially in a world where everything is evolving so quickly. But it’s always good to know what libraries, languages or applications will influence the way we work or the language we code in. There for I took the time to create an overview of what could be interesting in the near and far future.  If you have any remarks or other ideas, I would be happy to hear them in the comments.

HTML 5

Jon Von Tetzchner (director of Opera) recently announced that HTML 5 will replace Flash almost completely. Will it go that far? I don’t think so, but what we will be able to do with it is quite impressive!

  • Extension of the DOM with new elements like: section, audio, video, canvas, etc…
  • New attributes like: ping, charset, async
  • Id, tabindex and repeat for every element

As you can see the HTML 5 will be an expansion of HTML 4 but with rather important differences. We can expect HTML 5 to get its W3C Candidate Recommendation in 2012 but it will be able to use some of the features sooner. One of those is canvas that is already a widely implemented element.

Serge Jespers wrote a post on his weblog as a reaction on what Jon Von Tetzchner said and you can read about it here http://www.webkitchen.be/2009/05/27/adobe-versus-the-open-web/ He is an Adobe platform evangelist and Adobe pays his payckeck every month, but I do think the guy has a point.

JavaScript 2.0

With JavaScript being more popular than ever this is certainly worth taking a look at. John Resig created a slideshow on what will be changed in the 2.0 version and I must say that it looks promising.

PHP 6

A lot of people swear by the use of PHP over other language (like me :-) ) and a lot of other people say that PHP just isn’t sufficient enough. They are probably right because there are some insufficiencies in PHP, but in version 6 a few of those will be reviewed and adjusted. For now v6 is available as a developer snapshot so if you want you can already try it out.

Improved Unicode support.
This was a really necessary to keep up with other languages like JAVA that have a better i18n (internationalization) support, in this way PHP will close up the gap it had and support you with a much broader set of characters.

Namespaces
Namespaces are a way of avoiding name collisions between functions and classes without using prefixes in naming conventions that make the names of your methods and classes unreadable. By using namespaces we can never have the problem that 2 classes with the same name interfere with each other. I’m still wondering if this is the best solution but we’ll have to find out in the future. I’m only struggling with the idea that this only moves the problem to a higher level, as you now have to make sure your namespaces aren’t the same.

XML
XMLReader and XMLWriter will become part of the PHP core, which will make it easier to work with XML in PHP.

Magic_quotes and register_globals will be removed from PHP as they are a huge problem in PHP security.

It is from version 6 required to use tags as the ASP-style tags are no longer supported (<% %>)

Those are the biggest changes, again, just like in JavaScript some of these changes are already implemented in a PHP5.3
So in a nutshell, I do believe that PHP has a superb future in front of it, but that is also because of frameworks like Symfony, CakePhp, Zend, etc.

Posted in General, html, Javascript, php | Tagged , , , , | 1 Comment

the Type Tool and the Pen Tool

typeThe Type Tool:

A Comprehensive Introduction to the Type Tool written on Tutsplus is a great way to learn about this tool. It is in general, one of the first tools that everybody seems to try out and also one of the easiest to use. But using it means not that you are able to work with it. You might want to read and try out this tutorial to get a more in depth view on the type tool itself and how it works together with other things in Photoshop like shapes, paths and mask tools. The cool thing is that when you are going through this tutorial you have tons of examples that show you the result you should get and what you should start from.

One of the things I always intend to do on Tutsplus is reading the comments of the users; they often link to other tutorials that cover similar content.

go to the tutorial

finalThe Pen Tool

I was always struggling with the pen tool in the first few months of my Photoshop adventure until I found this tutorial. As we all know the best way to learn Photoshop is by trying and creating things with it and this tutorial does that all the way.
Actually there is no reading involved in learning about the Pen tool; you just have to download their psd exercise file and get busy. Follow the guidelines and when you reach the end of the psd you’ll be able to do all basic things you should know. Try it out! And if that isn’t enough, you can always find the explanation in this tutorial too as it covers all functions, shortcuts, cursor types, options and keyboard controls.

go to the tutorial

Try these 2 tuts, you’ll see they are a big help, even after a few months and forgetting some functionalities, these tutorials will be a great help. Enjoy

Posted in General, Layout, photoshop | Tagged , , , , | Leave a comment

Mantis in Eclipse with Mylyn

This is a post especially for those who use Mantis as a bug tracker software and Eclipse as development software. For our PHP and JAVA development we do all the programming in Eclipse and wouldn’t it be easy if Eclipse recognized the bugs we are working? Wouldn’t it be easy if we could just get an automatic link between mantis and the commits we do in subversion (svn).

Well, praise the lord, ’cause there is an open source project out there that does all these things called Mylyn.

Mylyn is a task-focused interface for Eclipse that reduces information overload and makes multi-tasking easy. It does this by making tasks a first class part of Eclipse, and integrating rich and offline editing for repositories such as Bugzilla, Trac, and JIRA. Once your tasks are integrated, Mylyn monitors your work activity to identify relevant information, and uses this task context to focus the user interface on the task-at-hand. This puts the information you need at your fingertips and improves productivity by reducing searching, scrolling, and navigation. By making task context explicit Mylyn also facilitates multitasking, planning, reusing past efforts, and sharing expertise.

tasklist-splash-31
After a quick install and doing the configuration in Eclipse the interface is installed in Eclipse and ready to work with. And it is great! Easy overviews of all the bugs sorted by filter as you personally prefer, great layout to create and manage the bugs, etc.

It communicates quite nice with mantis, it could be a bit faster but let’s not fall over that tiny thing. The cool thing though is when working for a specific bug, all changes will be committed on those files with a reference to that specific bug. This makes it very easy to get see what files where changed for a specific bug.

For example when you commit changed files you will be asked to comment your committed files. Mylyn links your files directly to the current bug you are working on and puts this in the comment area: “fixed issue #178: Change user name to full name” . The number of the issue and the state are first mentioned and the title completes your comment.

In the screenshot you can see how a bug can be inserted or edited in a easy layout and inside the eclipse environment. Click on the image or here to see a larger image
mylyn-31-screenshot

My colleague Toni also installed WebSVN that gives us a super overview on all those changes and files committed in subversion.

If you use Mantis and Eclipse and SVN I highly recommend that you use these two utilities.

Posted in General, Languages, php | Tagged , , , , | 6 Comments

The painfull truth

I don’t think this comic needs a lot of explaining….

picture11

Posted in General | Tagged , , , | Leave a comment

TestFest 2009

Tomorrow on the 9th of may an event called ‘PHP TestFest 2009′ will take place in the offices of Combell. (visit the website)

What is TestFest you ask?

The TestFest is an event that aims at improving the code coverage of the test suite for the PHP language itself. As part of this event, local User Groups (UG) are invited to join the TestFest. These UGs can meet physically or come together virtually. The point however is that people network to learn together. Aside from being an opportunity for all of you to make friends with like minded people in your (virtual) community, it also will hopefully reduce the work load for the PHP.net mentors. All it takes is someone to organize a UG to spearhead the event and to get others involved in writing phpt tests. The submissions will then be reviewed by members of php.net before getting included in the official test suite.

This event will take place in different countries but for the dutch speaking PHP community you can go to these addresses:

Hogeschool Domstad, Koningsbergerstraat 9, 3531 AJ Utrecht,The Netherlandstestfest_big-276x300

And

Combell offices Ghent, Skaldenstraat 121, 9042 Gent, Belgium (more info)

There will be a workshop to get the needed information and then it’s your turn to contribute to the development of the PHP language.

Felix De Vliegher is the mentor for Belgium and did the most tests in 2008 in the whole freaking world. With his experience and vision, this will be a piece of cake, be there or be square…. (maybe I will write about Felix later in our topic interesting people)

For those who will be on this event, have fun!!!!

Posted in Events, General, php | Tagged , , , , , , | 1 Comment

Basic forms with Symfony

SymfonyOur goal is to create a little crud that contains 4 fields

id (auto increment integer)
name (varchar 50)
value (double)
type (0 or 1)

What I will explain is how to change your fields in the form after creation with generation of a module. So we start with a clean module that contains 1 action class and 3 templates (new, edit and index) and 1 partial (form) that is included on the new and edit template.
We created this module not by hand but with the very easy command: symfony propel:generate-module.

Continue reading

Posted in php, Symfony | Tagged , , | Leave a comment

Symfony Form: unsetAllFieldsExcept()

When creating forms in symfony which extends from a Base (ORM) class, you sometimes do not need all fields that Propel/Doctrine generates for you. If you want to remove them you have several ways to do so.

1. Unset the fiels you don’t need.

public function configure() {
  unset($this['field1'], $this['field2'], ... );
}

Simple way to remove the fields you don’t want, but if you change something in your database, which has an impact on that form (new column, foreignkey, etc ), it will be added in the (generated) super class. And if you don’t update the unset function with that extra field, it will be expected in the form. Unless you have unit tests for all your forms this could brake it without knowing it.

2. Override the setup function.

/**
 * @override
 */
public function setup()
  {
    parent::setup();

    $this->setWidgets(...);

    $this->setValidators(...);
  }

Another way is to override the setup function and do your own widgets and validators initialization. This is a good way to only intialize the fields you really need, but you’ll have to do what your ORM generated for you.

3. Use a function which unsets all fields except the one you need (like the enableAllPluginsExcept function).

$this->unsetAllFieldsExcept(array(
      'field1',
      'field2',
      'field3',
      ...));

This would be usefull, because it will remove all fields you do not want to use, and even if new fields are added it will not use them. The drawback is that if you have 20 fields and only need to unset one of them, you’ll have more type work ;) .
Since it does not exist in symfony, I quickly created our own function. This function should be added in the class BaseFormPropel.class:

abstract class BaseFormPropel extends sfFormPropel
{
  public function setup() {
  }

  protected function unsetAllFieldsExcept($fields = array()) {

    $unsetFields = array_diff(array_keys($this->getWidgetSchema()->getFields()), $fields);

    foreach($unsetFields as $value) {
      unset($this[$value]);
    }
  }
}

Which one to use ?
None of them are better. But if you need to reset a majority of the fields the ORM has generated then I would go for the method 2. If you only need to unset the fields you do not want to use then I would use the function unsetAllFieldsExcept().

Which method do/would you use ?

Posted in General, php, Symfony | Tagged , , | 5 Comments

sfWidgetFormInputCheckbox unchecked bug

Ever tried to create a Symfony form with a check box input field, which by default should be unchecked ? No ? Well read on because it’s not that easy :) .

This would be the code to print a check box input field in a Symfony form:

class CheckboxForm extends BaseCheckboxForm {
 public function configure() {
 $this->widgetSchema['field'] = new sfWidgetFormInputCheckbox();
 }
}

When you use the form to create something then by default the check box should be unchecked. And when you use this form for editing, then the check box should be checked if the object you try to edit has already been checked in the past.

If you try this code, you’ll see that the check box will always be checked. Even if you display this form to create a new object. Strange no ?

Continue reading

Posted in General, php, Symfony | Tagged , , , | 13 Comments