Archive | webdesign RSS feed for this section

“goeie code” een mythe ?

28 Jan

Deze post gaat over een leuk dilemma in het ontwikkelen van projecten, meer bepaald het schrijven van code. Iedereen die al eens geprogrammeerd heeft aan een groter project (neen ik heb het niet over de myspace pagina van jouw neefje’s reggae band) kent het dilemma “goeie code” vs “snelle code”. Bij elk groter project komt er een bepaald moment waar je moet kiezen : de snelle (& dirty) oplossing of tijd investeren in de perfecte code ? Er zijn zeer weinig projecten waar de duurzame oplossing, maar vaak komt het hierop neer “if it works, it works”, niets is minder waar.

Elke die-hard developer weet dat de wereld beter zou worden van “goeie code”. Applicaties (in mijn geval web applicaties) zouden niet alleen doen wat ze horen te doen, ze zouden ook nog eens sneller zijn ! Het project process zou vlotter verlopen, en het eindresultaat zou voldoen aan alle eisen vooropgesteld in de analyse, right ? Spijtig genoeg is de realiteit anders.

Het eindresultaat is niet altijd afhankelijk van tijd/resources, er zijn ook andere factoren.

Ik heb in het verleden al aan tal van internet applicaties gewerkt, en altijd had ik de beste intenties voor de realisatie van het project. Altijd ! Beginnend met de analyse, alle actoren en processen zo goed mogelijk in kaart brengen en begrijpen hoe al die zaken uiteindelijk moeten samenwerken. Het resultaat was (meestal) duidelijke en gedocumenteerde code die gestructureerd, onderhoudbaar, leesbaar en uitbereidbaar was…tenminste toch tot de klant zich besloot te “moeien” :-)

Indien je al aan grotere projecten gewerkt hebt ken je zeker deze regel : “klanten weten nooit wat ze willen”. Zelfs als ze beweren van wel. Na het tonen van de eerste demo zijn ze verbaast en enthousiast zodat ze onmiddelijk idee’en beginnen te opperen om de applicatie “nog beter” en “nog cooler” te maken. Nu dit is niet echt een probleem zolang je de klant onder controle hebt (analyse document, project specificaties), maar dit niet het geval is : “let the bad code in” ! :-)

Op 90% van de reeds gerealiseerde projecten kwam er een moment waarop we keuzes moesten maken. Mogelijk kan er uit de eerste demo maar één voorstel van functionaliteit komen wat de klant geintegreerd wil zien. De kans is groot dat net deze functionaliteit zal botsen met alles wat je daarvoor al hebt geschreven. Daarom is het extreem moeilijk om “goeie code” te behouden. Het vereist oefening, ervaring en skill om dingen te schrijven die flexibel genoeg zijn om te voorzien aan de toenemende eisen van de klant.

Digital Base v3 – Launch

14 Dec

I am proud to announce we launched our new website. On this website you’ll find a detailed portfolio & more about us. Although there is still alot of work todo (optimise css/xhtml, w3c validation, content correction). Check out our site in english & dutch

DigitalBase is hiring

16 May

Digital Base is looking for young skilled Belgian (dutch speaking) web developers. If you want to work in a small team on various projects (medium to large business) in a relaxed & friendly environment send your CV to me at snk00sj@digitalbase.eu Before you do that, make sure you have the following qualifications :

  • under 30 years/old
  • native or perfect dutch speaking
  • decent knowledge of english
  • good social skills
  • excellent PHP knowledge
  • good OOP knowledge
  • close/around Leuven (office @ leuven)
  • basic knowledge of version management systems (cvs, svn)

Make sure to mention your references and/or degrees.

Talk to you soon

Working on existing PHP applications

10 Jan

We’ve all been there before, you’ve been hired to finish / work on someone elses work, and you encounter some very strange behaviour. If you’re working on a small website, going through the code should provide you with the necessairy information to solve this issue, however, if the application is somewhat bigger (multiple components, databases, caching, dynamic code building, multiple objects …) it’s always nice to know exactly what code is being executed on a certain moment.

Imagine you have found the exact page / function / action where it’s going wrong, and you are trying to debug it. Commercial companies offer solutions like Zend Platform / Zend Studio to debug, view stacktraces, variable watches & alot more…and i am mostly using Zend Studio for that too, but at this moment in time, Zend does not offer a windows library for Zend Platform that supports PHP 5.2.0, neither did they release a fix for Zend Studio 5.5 to build inspectation data over a Samba share…So let’s do the same thing using XDebug, afterall the world still spins without Zend.
Make sure to get the right windows or linux module for your php version from www.xdebug.org and use the installation instructions to get it running, make sure to check phpinfo to see if the xdebug is loaded. When everything is installed, we’ll start by profiling a certain action to find out what exactly the page/action is doing. Make sure to adapt your php.ini with the following configuration :

zend_extension_ts=”c:/apache/php/ext/php_xdebug-2.0.0rc2-5.2.1.dll”

[xdebug]
xdebug.remote_autostart=1
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.profiler_append=0
xdebug.profiler_enable=1
xdebug.profiler_enable_trigger=1
xdebug.profiler_output_dir=c:/temp/
xdebug.profiler_output_name=profile

After that restart your apache, and open the page you want to analyse. As soon as you send a request to the webserver it will create a file in the c:/temp (or whatever path you defined). For me it generated a file (c:/temp/cachegrind.out.5808). This file contains alot of information what exactly php was doing on your request. Call it a stack trace. This file is human readable but does not give an immidiate overview, that’s why i would suggest to use a program to analyse the cachegrind. To my knowledge, the best program to-do that is KCacheGrind, the downside is that is a KDE program, so if you are using windows you would need alot of hacks, just to get KCacheGrind running, thats why there is a windows port (with less features) available called WinCacheGrind. If you open WinCache use the File>Open File dialog and relocate to the cachegrind.out file (for me c:/temp/cachegrind.out.5808), depending on the size of your file, wincachegrind will start analysing and give you a visual representation of the stack trace of your action.

Note that all pages you visit from now (untill de-activating the module in php.ini) will get ‘profiled’ and generate a cachegrind file. As this is filesystem intensive, i would suggest commenting the above php.ini section as soon as you’re done and restart your webserver.

Propel / Pager / Datagrid – Part II

9 Jan

In my previous post, i talked about the writing of a custom datagrid for propel usage. The required features for this datagrid would be :

  • easy configuration
  • multi sortable columns (ascending & descending)
  • search features
  • add actions to one or multiple records (icon + action)
  • sizeable columns
  • go to page x
  • ability to change rows per page

So since my last post, 2 weeks have passed and i am proud to say we’ve finished a large part of the code. Now we are still having problems with the javascript to allow the user to change his column width in multiple browsers, IE seems to refuse some of the javascript code. I am still looking into that.

P.S. : I have been getting several e-mails with code requests. Untill i am really done i won’t give out the code. If you think you can help me with the javascript resizing issue though, you can always drop me an e-mail.

Propel / Pager / Datagrid

15 Dec

Because we are using propel in most of our larger projects, it’s very common we need a datagrid for the listing of the objects. A year ago we made a datagrid with the most important features combined with an ajax approach (sorting, filtering…), for the ajax functionality we wrote our own javascript function calls, what led to alot of unmanageable code, both javascript and php.

As time moved on, this loading of the datagrid became slower and slower (due to increasing objects, about 9000 records with multiple joined tables). This was mainly because the old datagrid first loaded all objects, and then sorted the entire array by the columns as defined by the user….don’t tell me..i know ! This is a bad approach, that means all records get looped, and if you are using propel that would mean for each of those 9000+ records an object is created…that’s crazy…(it has some advantages though)…

So now i finally found some time to do a total rewrite of this datagrid, combined with the power of the propel pager, propel criteria & the php/ajax framework xajax, i came up, faster then expected, with a powerfull scalable datagrid that only loads the visible records. All switchpages, sorting & filters call a corresponding ajax function. These functions change the criteria in the object and reload the datagrid. I’ll elaborate on this later, by showing you some code and perhaps an online example.

Zend Studio Performance

8 Dec

Lately i noticed Zend Studio wasn’t running as smooth as before. When going into hibernate or logging off, i often notice javaw.exe has crashed, that caused the system not to shut down. To fix this problem i’ve found several solutions, i’ll list those here for future reference :

  • make sure the power settings do not use the option to enable cpu throttling (this seems to be a java issue)
  • try replacing zends jre by JRE 6 (http://java.sun.com/javase/6/download.jsp)
  • disable the OS look&feel in your zend application
  • disable all power management for your video card
  • if you are using a dual monitor setup, make sure the editor & palettes are on the same monitor/display
  • remove the Zend Project cache file : /Documents and Settings/{Win username}/ZDE/config_5.1/caches/
  • expand the heap sizes (to more then 256 MB) the JRE needs for the Studio to function [file: {studiopath}/bin/ZDE.lax]
  • if you have a 64b machine, make sure you have the 64bit java lib
  • try disabling your antivirus for a second and check if performance goes up
  • if you are using an external subversion client (not ZDE’s), make sure your options in ZDE are on CVS. (options > source control). Performance gets a huge boost (integrated svn is causing a problem when using 3th party tools)
  • submit a support ticket (http://www.zend.com/support) (make sure to mention you tried all t he above steps, and provide as much detail as possible, because they won’t fix your problem untill they have everything they are looking for : hardware, software, ZDE.log, description of the project)

Here’s the info I found posted over at the PhpBuilder.com Zend Studio Forum by MStaniszczak (post is no longer there). This item addresses the speed of the java virtual machine, and for those of us running Intel processors, this tends to be faster than the Sun JRE. If you’ve got an AMD processor, this may or may not yield any performance.

Head on over to BEA Systems and get the JRockit 5.0 JRE. Don’t worry about the SDK, unless you’re a Java programmer. It’s about 30 megs, so dial-up beware. After downloading it, extract the exe (right click, extract archive).

After you’ve done that, you should see some files, as well as another archive or zip file named something like win_ia32_jrockit150_04_jre.zip. You’ll want to extract that as well, to it’s own directory or folder (name it jre) , and that’s going to be what we need.

First, make sure the ZDE is not currently running. If it is, exit it. Now, find your installation of the Zend Studio client. It should be something like C:/Program Files/Zend/ZendStudioClient-5.0.0/. You’ll see a directory already named jre. Rename it to jre_old. Copy the directory we created from the archive into the ZendStudioClient-5.0.0/ directory.

For me the HEAP size, in combination with the source control tab (to cvs) did it, as i am using tortoisesvn for version management.

Moving Datacenter

2 Nov

2,5 years ago, when starting my own company, we wanted to offer webhosting to our webdesign customers, that’s why we decided to buy a server, and make use of a ‘colocation’ host for a 1U server. Pretty soon, it became clear we would need another ‘development’ machine to test/debug our applications before going live…So we bought another one…

Because we now had 3U’s space, we decided to look for a larger spot, so we would have more options afterwards. I convinced my cousin’s company to come along, and we decided to rent a 1/2 rack (colocation) in Amsterdam. At that moment we were still hosting gameservers, so we regulary did server updates (new hardware etc)…Now if you know that going to Amsterdam, without traffic, takes about 3hrs (and 3 hours back) by car, you can see that this is a terrible situation, and especially when your hardware malfunctions once in a while…

So at the end of my contract, i decided to move to Belgium with my servers. The prices of colocation in the Netherlands were booming because of energy pricing (that’s what they told me), and the service wasn’t all that either….

Because my network administrator has a small colocation company in Antwerp, Belgium. I decided to give it a go. Important detail is that i don’t profile myself as a webhosting company but i offer webhosting solutions to my webdevelopment clients. This way i do not have to keep 1000+ users in account, and i can guarentee maximum uptime to my clients (i know exactly which modules, dependancies, configuration these clients need).

Now as time is going by, my company has some decent clients that require maximum uptime. Because the location in Antwerp is fully dependant of realroot (a major player on the belgian colo market) we’ve had a few problems. Being dependant of only one company is a major flaw in any case, so i started looking for alternative solutions…And i did, a Brussels based colocation company, this company offers everything i need (multiple power feeds, independant network, own RIPE account), now let’s hope we could stay here for a while…

Writing Killer PHP Applications

31 Oct

Because i still have a quite visited blog (disabled comments though), i will try to post some web development idea’s / articles on a regular base. As a full-time webdeveloper i find it very important to have the right tools. I’ve told you before, as a development machine i am still using a WAMP set-up (Windows, Apache, Mysql, Php), whenever i finish some work on a project, i commit the code changes to a subversion repository (running on a Debian machine). The subversion server accepts connections over secured http to make sure no-one is reading / sniffing. To my opinion, the best tool to handle your svn actions (merge, commit, update) on a Windows platform is TortoiseSVN, they release regular updates, supports almost every svn action and has great documentation.

The most important in my daily development is my IDE, for the last three years i have been using Zend Studio Professional, at this moment i think (and i’m pretty sure), it’s the best PHP IDE Around. It has debugging capabilities, code completion, svn/cvs integration (although i prefer tortoisesvn, see above), but ofcourse it can’t be perfect…(i do expect it to come close for 300$/year).
One thing i don’t like about the Zend IDE (besides the pricing), are the updates. Zend is quite slow on the updates, (they might have too much todo), but as a registered & paying customer, i think some major fixes (Javascript errors in internal browser, Linux Visual Interface, Crashes) in Zend Studio 5.2.0 have a higher priority then deciding to build a new IDE when the current one is not finished (it never is). Nevertheless, this IDE is still the best PHP Editor around, in combination with the Zend Platform (free for developer licences & combined in the Zend Pro licence) you’ve got yourself a kickass debugging system containing the most important features as breakpoints, watches, stacks and output buffering.

Quick Post / Hiring

16 Oct

Hi all, it’s been awhile. I enjoy life as an independant consultant. It’s my second month fully independant (fulltime), and i’m loving it. Infact, new projects are coming in too fast, so we’re hiring.

We are looking for young skilled Belgian (dutch speaking) web developers. If you are interested send your CV to me at snk00sj@digitalbase.eu Before you do that, make sure you have the following qualifications :

  • under 35 years/old
  • native or perfect dutch speaking
  • decent knowledge of english
  • good social skills
  • excellent PHP knowledge
  • basic knowledge of version management systems (cvs, svn)

Make sure to mention your references and/or degrees.

Talk to you soon