Digital Base – Blog » Gijs Nelissen

DigitalBase attending Symfony Live 2010

Posted by Gijs Nelissen in All, Programming

banner_squareYou must know by now, Digital Base is using Symfony as the framework of choice for all web development projects.

Therefore all DigitalBase developers will be attending Symfony Live 2010. Monday evening we will travel to Paris by train with a delegation of 4 symfony geeks/fans/enthousiasts.

From the symfony 2010 website :

Sensio Labs is proud to announce that the second symfony live conference will be held February 16-17th in Paris (in English). The symfony live conference is a unique opportunity to meet the symfony community, talk with the symfony core team, and share your experience with the framework. You can even sponsor the event.

The schedule :

symfony schedule

I look forward to the following items, in order of priority

What is important in a PHP editor/IDE ?

Posted by Gijs Nelissen in Programming

I’ve been building websites for a while now. So i could say i am quite experienced although my (programming) knowledge is limited mainly focussed on building php applications. As a developer time is expensive, that’s why i am always looking for ways to speed up the web development process. A good start for fast & secure development is to have the right tools and the right feeling/connection with your editor.

On day-to-day basis i could say 80% of the time i have an open editor somewhere. Based on the amount of time you are “working together” with this piece of software, you could compare it to a marriage (although you shouldn’t trade wives as soon as you meet a younger, smarter and more beautiful girl).

I have a few expectations / requirements for a modern, good working editor

Decent Code Completion / Code Assistance

We all know word completion : auto completion involves the program predicting a word or sentence without the user actually having to type it in completely. This feature is used alot in text messaging (sms), email clients, browsers, search engines etc…

google_image_autocomplete

Autocompletion speeds up the entire process of typing a message, entering an address or, in our case, writing PHP code.

A decent source code editor analyses your source and suggests the function based on the first characters of the variable, function name or object. Most editors these days have code completion although they come in many flavours.

eclipse autocomplete

Larger web applications tend to use alot of classes & files. That’s what it is really important your autocompletion allows you to use an unlimited depth of super- & sub classes (inheritance). For this your IDE should have a decent understanding of the relation between classes. If in some case the code completion does not work for a certain object, you should be able to tell the editor which class your object belongs to, so it will allow you to use the code completion on next occurences of the same object/variable.

Code Documentation / PHPDoc

Another important aspect of code completion is documentation. It is very useful for a programmer to get as much visible feedback as possible about the method/function he is calling. For a php core function this should be a short summary what the function does, for custom methods/functions this would be the description as entered by the one that created the class/method.

eclipse_link

Next to that information it could be useful to show the return type and perhaps some information about the needed arguments. All these things should be integrated in the IDE, readily available when i enter the name of a method/class without opening a seperate manual or the php.net website.

When adding custom classes/methods/functions it is important that you document this code using phpdoc. Eclipse will then pick up this documentation and show it whenever you are using it somewhere else throughout your project.

Syntax Highlighting / Coloring

Code should look good. If you’re spending most of your time looking at code, it’s important to take care of your eyes. A good syntax highlighter highlights the different code to make a clear distinction between actual code, variables & documentation. Marking different type of elements in seperate colors will increase readability and help you understand a function faster.

Syntax highlighting also helps in finding errors in your code. Some editors mark incorrect code (missing delimiter, etc), this comes in handy when you are paying less attention. The editor will immediately show you you are doing something wrong…

Personally i prefer dark editors, many other programmers agree that this is alot better for your eyes. Next to that i find dark color schemes to be alot clearer and more beautiful to look at. TO give you an idea, this is what my eclipse looks like :

screenshot1

Code Bookmarks

When we are writing code it is important to keep track of important locations throughout the project. Code Bookmarks is the easiest way to do it.

A good implementation of bookmarks should allow you to easily switch to next/previous bookmark and give you an overview/listing of the current “bookmarks”.

screenshot3

If you look on the left side, you will see a small flag that marks the current line as being bookmarked.

screenshot7

Once you have these “code bookmarks”, its hard to code without them.

Smart/Quick opening

Now where did i put this code/file again ? Which class defines the foo() method ? Most of you will agree with me that opening the correct resource/file/method takes alot of time. A good editor should allow you to find/open everything you are looking for with a few keystrokes and (more important) without touching your mouse.

My favourite editor (Eclipse) allows you to use ctrl+shift+R to “open resource” and quickly find the file you were looking for.

screenshot8

This means i do not need to touch my mouse or open the “file explorer” to look for the file. Easy & Fast…

I know some people who use “grep -r ‘ methodname()’ to find the location of a method. I personally think this stinks. A good editor should contains some ways to easily open a file/method.

Class Outline

It’s easy to lose track of the variables/methods that are defined in a class. This is where the “outline view” comes in handy. This “outline” view will give you a the overview of every method/variable defined.

screenshot9

Double clicking a method will take you to this method. No search, no scrolling, no touching the mouse. In eclipse there is an even better way. Once inside a class you can use CTRL+O to get a quick outline with autocomplete functionality, finding the method you were looking for never was this easy…

eclipse quick outline

Thanks Eclipse :)

Platform Independance

If you are a regular reader of this blog, you will know we are using several linux flavours in our office. So for us it is very important t he same editor can be used on Windows & Linux platforms. Most “multi-platform” ide’s are based on java (zend, eclipse,…) but there are some other ide’s that have clients for both platforms.

Symfony Plugin for Eclipse : SfDT

Posted by Gijs Nelissen in All

I just found out someone is working on a new symfony plugin for eclipse, there used to be symfoclipse, but closed-source, commercial and no support for Eclipse 3.4. This new plugin works with symfony 1.0, 1.1 and 1.2. The website states it is tested with Eclipse 3.3.2 and PDT 1.0.2 but i did manage to run it on Eclipse 3.4 and PDT 2.x.

So what can this plugin do ?

  • create modules/projects/applications rightfrom within Eclipse
  • convert Clay database to schema.xml/yml
  • run symfony commandline from within eclipse

screenshot11

More information on this plugin :

Good job guys !

using dbFormExtraPlugin for datepicker or datetimepicker

Posted by Gijs Nelissen in All, Programming

For an internal web development project i was looking for a good date picker. I bounced onto sfFormExtraPlugin, but it took me a while to find the correct jquery & jquery UI css & javascript files and set the paths. I decided to create my owner datepicker based on the one in sfFormExtraPlugin (which was based on the jQuery UI Datepicker).

As we already had a plugin containing some of the widgets/validators we are using for some of our webdesign projects, i decided to include those widgets into the existing one named dbFormExtraPlugin, original name, i know…

Installing dbFormExtraPlugin

It’s really this simple, install, publish assets, en clear your cache.

symfony plugin:install dbFormExtraPlugin --release=0.0.5
symfony plugin:publish-assets
symfony cache:clear

sfWidgetFormDateJQuery

This is based on the normal jQuery date picker

class ProjectForm extends BaseProjectForm
{
  public function configure()
  {
 
      $this->widgetSchema['published_at'] = new sfWidgetFormDateJQuery();
  }
}

Should give you something like this

sfwidgetformdatejquery

sfWidgetFormDateTimeDyn

This is based on the dyndatetime project, something i found on google code. From their website :

jQuery has lots of date pickers, but no date- time pickers. This supports date and time, and renders the value to a single field in a configurable format.

Use it like this

class ProjectForm extends BaseProjectForm
{
  public function configure()
  {
      $this->widgetSchema['featured_at'] = new sfWidgetFormDateTimeDyn();
  }
}

Results in a popup, similar to the dynarch calendar picker, including time sliding capabilities !

sfwidgetformdatetimedyn

I still have some work todo on configuration/customisation but it does work (out of the box).
Other installation instructions here. Comments welcome. Leave a message on this post, post a bugticket on the symfony trac or contact us by email.

What i love about Redmine

Posted by Gijs Nelissen in All

I previously told you we moved from Trac to Redmine for project management (issue/ticket tracking, milestones, source control management). In this post i will tell you what i like about Redmine and compare it to our previous Trac setup.

From what i understand from the Trac mailing list & some discussions in some of the ticket comments (by core developers) the main goal of  Trac is to create a stable (and basic) system (or groundlayer) that can be extended by using plugins. Thats a great mission statement…But (and there is a but) if you are managing several Trac installations this vision turns against you rather quickly, below some of the main things i miss in Trac.

Multiple Projects

The initial reason for moving to Redmine was the lack of support for multiple projects in Trac. I know you can hack Trac (see track-hacks) to include multi-project support, but i don’t like hacking. There were several discussions how (and if) Trac should implement multi-project support fact is : there is no “out-of-the-box” solution. I read something about Trac v2.0 supporting this, so i guess we’ll see that in 2015 then..

Redmine does support multiple projects. The integration throughout the entire system is excellent. You can create nested subprojects and move issues/tickets from one project to another. For each project you are able to assign different users and turn certain functionality (milestones, time tracking, source control,..) on and off.

redmine-projects

Batch Issue/Ticket editing

I have to agree Trac ticketing system is very powerful and flexible. Without a doubt Trac is one of the most common and stable tools for project management & issue tracking for a very good reason. You can easily search and filter tickets by severity, project component, version or owner, and then store those. Great.

trac-tickets

What i really miss using Trac is the ability to do a “mass update” (edit/close/move) on several tickets at the same time. This is where the ajax powered “batch edit” feature of Redmine comes in quite handy.

redmine-mass-issue-update

User / Role Management

The user management in Redmine is great ! Besides normal user management it supports (custom) roles. You are able to set different user roles for different projects.

Trac doesn’t support “user management” out-of-the-box. Unlike other bug-tracking systems that simply have a table for storing the users, Trac took the approach of allowing users to leverage the numerous authentication modules available for their web server. This means system administrators are able to hook Trac into something like LDAP, Active Directory, or whatever centralized user system that they already have in place.

So which one is better ?  Difficult question. I am a great supporter of working software out of the box. Not too much configuration, easy to install. This doesn’t mean the software has to be “simple” : flexible and easy-to-configure can go along hand in  hand. That being said i think Redmine took the best approach in having good user management right after installation. If you need something more centralized they still have LDAP support.

A lot of updates/ new features

I am sure Trac is more stable then Redmine. So if you need a stable product, use Trac But as we are a small webdesign company, the stability of the development environment isn’t really that critical to us.

What i am looking for in project management software are new features/idea’s to improve the way our team is working together. I keep an eye on the Redmine timeline/activity to see how other people are using the Redmine platform. Some of their comments/ideas inspire us to change the way we are working or start using a specific feature we haven’t paid attention to.

Anything else ?

Yes, there are some things Trac does alot better. First of all Trac has a large community with multiple core developers, redmine is built around one (maybe a few) persons. Then the source repository browser in Trac is alot more powerful and intuitive.

I have been using Trac for along time now and i have a great deal of respect for all the guys that are working on this rocksolid project. But as i said before, Trac’s strengths is also it’s weakness. By trying to keep the system as lightweight as possible, discussions about possible features mostly result in the “not for core” decision.

PDT 2.0 for Eclipse is out

Posted by Gijs Nelissen in All

If you are into PHP development, this might interest you : PDT 2.0 is out, download it here. Congrats to the PDT team for this great release and the respect of the deadline.

download pdt

If you are wondering whats new, check this page. Have fun with it…

Pimpin our Blog

Posted by Gijs Nelissen in All, graphics

We decided to take some time to “pimp” this blog. We still have a long “todo” list, this is just the start…

A quick before & after :)

Before

Old Blog

New & Improved

screenshot13

A quick list of what we did:

  • integrated search box on top
  • recent posts & comments on top
  • added links to search bar
  • updated general layout & cleaned out some of the css

Do you link the pink ?

Wordpress Coltrane – Upgraded to 2.7

Posted by Gijs Nelissen in General

A new version of wordpress is out, codenamed “Coltrane”. So what’s new ?

  • XMLRPC Comments API : nice api to manage comments through xmlrpc
  • Keyboard shortcuts for comment moderation : use keyboard shortcuts to manage the comments
  • Sticky Posts : ability to “stick” a post to homepage
  • Theme update api, like we do for plugins : new admin theme
  • Dashboard and write box rearranging : ability to decide what you want on homepage
  • One-click plugin installs : better plugin handling, easily install plugins through the web interface
  • Reply to comments from withing dashboard
  • Core updating : auto update feature
  • Batch and inline editing
  • ….

Good work wordpress team ! I decided to upgrade my wordpress at once. Check out the difference !

Previously (Wordpress 2.6)

Old Wordpress admin layout (2.6)

New layout (Wordpress 2.7)

screenshot16

Keep up the good work !

Developer Faster with lightning fast Eclipse

Posted by Gijs Nelissen in Programming

When maintaining & developming large web applications you might notice that eclipse slows up a bit. Building workspace, showing the autocomplete or syntax highlighting might take a while to load. The solution for this is to optimise your eclipse.ini and tell your favourite PHP development IDE to use more memory.

After installing eclipse you open the eclipse.ini in the root. If you followed my previous post, the default settings should be something like this :

-startup
plugins/org.eclipse.equinox.launcher_1.0.101.R34x_v20080819.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.gtk.linux.x86_1.0.101.R34x_v20080805
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
-vmargs
-Xms40m
-Xmx256m

This means eclipse will use in between 40 and 256mb. These default settings will allow you to run Eclipse on a pre historic PII with less then 1GB ram, although i wouldn’t recommend that.

Most of you, especially developers working in a development agency, will have powerful workstations. So lets tell eclipse to use a bit more resources

-startup
plugins/org.eclipse.equinox.launcher_1.0.101.R34x_v20080819.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.gtk.linux.x86_1.0.101.R34x_v20080805
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
-vmargs
-Xms256m
-Xmx1024m
-XX:MaxPermSize=256m

I changed the xms, xmx and xx:maxpermsize settings.

What does it mean ?

  • Xms sets the initial Java heap size
  • Xmx sets the maximum Java heap size
  • XX:MaxPermSize allows for the JVM to be able to grow the PermSize to the amount specified. Initially when the IDE is loaded, the MaxPermSize will still be the default value but will not actually take up that amount until it is needed.

Wordpress : Seperate RSS feed for Category / Author / Tag

Posted by Gijs Nelissen in Programming

As you may have read we migrated this blog to a wordpress one. Yeahyeah, we are not officially wordpressified.

My impression of the core

The default wordpress core holds alot of use’eable functions, but it took me a while to figure out how the thing worked. You need to know that wordpress is not really written very object oriented, so basically its a collection of functions although some “under the hood” core functionality is object oriented.

If i was not convinced wordpress is a serious project with a great future, i wouldn’t have chosen it, so let’s not start the “code quality” discussion.

The problem

Something i was missing after the default drupal installation was an easy way to retrieve the related rss feed based on the page the visitor was accessing. If a visitor was on the “all posts by author X” page, the linked rss feed should only hold those posts. Same for category pages and tag pages.

Getting the information of a tag, author of category is very easy. There are some built in functions like get_category, and get_category_feed_link that will give you this information. The downside is, this information is basically only available inside “the loop“.

The solution

To get the information about the selected category, author or tag i had to jump a few hoops. It’s a combination of core functions and some minor custom code where i had to retrieve the current tag from the queried variables.

Then I created a custom method that returns the most related feed based on the page request. The method will check what type of page the visitor is accessing (category, tag, author or main page) and return the appropriate rss feed.

/**
 * This method will give you the most related rss feed based on the current page request
 *
 * @param $type
 * @return string (feed url)
 */
function get_feed_url($type = "rss2_url") {
 
  if (is_category()) {
    $current = get_the_category();
    $current = $current[0]->cat_ID;
    return $url_rss = get_category_feed_link($current,$type);
  }
 
  if (is_author()) {
    $current = get_query_var('author_name');
    $current = get_userdatabylogin($current);
    $current = $current->ID;
 
    return get_author_feed_link($current,$type);
  }
 
  if (is_tag()) {
    $current = get_query_var('tag');
 
    $formaturl = "/feed/";
    switch ($type) {
      case "rss_url":
        $formaturl = "/rss/";
      break;
      case "atom_url":
        $formaturl = "/atom/";
      break;
 
    }
    return get_bloginfo("url") . "/tag/" . $current . $formaturl;
  }
 
  return get_bloginfo($type);
}

Examples

get_feed_url("rss2_url"); // on page /blog/
 
//returns : http://www.digitalbase.eu/blog/feed/
 
get_feed_url("atom_url"); // on page /blog/category/digitalbase/
 
//returns : http://www.digitalbase.eu/blog/category/digitalbase/feed/atom_url/
 
get_feed_url("rss_url"); // on page /blog/tag/symfony
 
//returns : http://www.digitalbase.eu/blog/tag/symfony/rss/

Enjoy