knightly

Yearly Archives: 2008

PHP 5.2.7 release pulled back

Last week PHP 5.2.7 was released. And i have it running here on my dev box. But this weekend the 5.2.7 version was pulled of the download page. Due to a serious security bug concerning magic_quotes. Even when enabled it remains off. The advice for now is to stick with 5.2.6 and wait for the 5.2.8 release.

So this will not be seen on a lot of systems i figure :)

PHP 5.2.7 (cli) (built: Dec  5 2008 11:18:04)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies
with Xdebug v2.0.3, Copyright (c) 2002-2007, by Derick Rethans

* Update

According to a post from Ilia on php.net. The 5.2.8 version is released. And solves the previous named problem. Everybody is ad viced to upgrade the 5.2.7 version.

Subversion cross platform errors

Yesterday my colleague was complaining he couldn’t do a normal check out of one of the projects in Subversion. At first i thought it was just something wrong with his local settings. Because i could do the check out just fine. Today when i was thinking about this problem. I quickly realized we are on two different platforms. He works on Windows while I’m on Linux.

And since i had to do some Photoshop work today. I took the chance to install Subversion on my Windows partition. When i did a checkout of the failing project. I ran into the same problems as my colleague did before. Two different errors were preventing me from making a complete checkout. The first error:

svn: In directory ‘path/to/some/images’
svn: Can’t copy ‘path/to/some/images/image.JPG.svn-base’ to ‘path/to/some/image.JPG.tmp’: No such file or directory

Is caused by multiple files with the same name. At  least to windows it looks like this. Because image.jpg and image.JPG are two different files on Linux. On windows however these two files are one and the same. This causes Subversion to choke. After manually deleting all duplicates from the repositorie it self the problem dissapeared.

The second error was something like:

svn: Working copy ‘/some/path/\ ‘ is missing or not locked

This one was actually pretty obvious. A file name with an illigal character. I wonder how it got in the repository. The folder name causeing the problems was a folder called ‘\ ‘. Which was empty. After removing this. I could do a complete checkout again.

Making permanent changes to resolv.conf under Ubuntu.

At work we have a local dev box. This box is running Ubuntu 8.04 and some tools we need for developing. Nothing special. This box get’s it’s IP address from the DHCP server that runs on the router. And this caused some problems because we are running a local DNS server for the dev box. Mainly to use internal domains for testing.

To make this work we changed the resolv.conf to use the new local DNS server. This works fine wouldn’t it be for Ubuntu changing the file back to it’s original settings on every DHCP request. So every 900 sec the file gets overwritten. To solve this the first time i simply made the file read only. This however caused some problems with the DHCP client requesting an IP address over and over again. This caused the load on the dev box to rise….

Further inspection showed that it’s the dhclient-script the overwrites the resolv.conf file. I tried commenting out parts of the dhclient-script. But this just created more problems. So i did a search on the Ubuntu package list. And found a promising program called resolvconf. This program takes over from resolv.conf. And with this program installed it’s possible to make permanent changes without creating any problems.

After installing the package and doing a search for resolvconf. I found a directory in /etc which had a resolv.conf inside. This seemed to be the template used for overwriting the original resolv.conf. After changing this file all problems were resolved.

/etc/resolvconf/run/resolv.conf

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND — YOUR CHANGES WILL BE OVERWRITTEN
search example.com
domain example.com
nameserver xxx.xxx.x.xx

*Update

After googling some more. I think i found a better way to solve this problem. And probably the only way to solve this. No need to install any extra software. Just edit the dhclient config file.

change the following lines in /etc/dhcp3/dhclient.conf

supersede domain-name “example.com”
prepend domain-name-server xxx.xxx.xxx.1, xxx.xxx.xxx.2

Programming Community Index for November 2008

Just for fun;

This morning i’ve received an message from the Delphi community to get the Delphi programming language at the top. To get a glance of the position of your preferred programming language please follow this link;

http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html

Last week i did some research about running threads from within delphi in a asynchronous way meaning a webservice call is made from the client, the webservice picks it up sending true or false back to the client indicating that the call has been made, processing the call and fires a OnDone event to the client containing the response.

Doing webservices this way allowes the client to continue working without waiting for the response. Within the .NET webservice techniques it is allready possible to execute webservices this way (SOAP version 1.2). The lastest delphi versions 2005+ allready support those features but Delphi 7 doesn’t.

I’m allready able to start a new trhead from within the call method and process a large amount of data using a cache system. The only bit i’m stuck with is to post back the OnDone event to the client.

Ubuntu 8.10 NVidia driver trickery

I was up early last Sunday. just couldn’t sleep anymore. So i decided to do a fresh OS install on my main workstation. One or two weeks ago i updated my Ubuntu 8.04 to the latest 8.10 Interpid. This went without real big problems. And the system was running stable. Besides at the office i did some clean installs of Ubuntu 8.10. And there were no real problems to name.

So i thought what the hell. Let’s do a clean install here at home also. I created a backup of my important files. and downloaded the new .iso image (couldn’t find the previous downloaded one). And started of the install. It was nice weather and i thought if i finish this fast. I can go and enjoy a nice Sunday.

The install went without problems. And after rebooting it booted up fine. First thing i did was run an update through synaptic. Installed the new kernel and a whole lot of other packages. Did a reboot. And everything was still fine and dandy. Now it was time to install the Nvidia driver. I used the Restricted Hardware manager in Ubuntu to select the NVidia 177 driver. Which did the job before the install. And rebooted the machine after the install was complete.

When it booted backup. I was surprised to see a tty screen. and not the GDM i expected :). The error message on the screen stated no screens found. So i logged in and checked the xorg.conf file. Which had a pretty default setup. So i thought running nvidia-xconfig would solve the problem. This generated the same xorg.conf. After rebooting a few times and trying to change the xorg.conf file. I was getting a bit frustrated.

In my hurry i by accident removed my backup partition. So i was getting more frustrated every minute. I do have to say i have a dual Head system. With two PCI-e video cards. And for some strange reason nvidia-xconfig didn’t find the correct hardware. And running nvidia-settings from command line is not possible. So i was stuck. Removing the nvidia-glx driver and the rest of the nvidia-177 files. Got me back in X. Running a very low resolution.

Googling revealed i was not the only one with this problem. But there were no real solutions. At least none that worked on my system. So i decided to reinstall Ubuntu 8.04. Updated the whole damn system. Installed the nvidia-glx-new driver. And got everything to work. After this i did a distupdate to 8.10. And everything kept working. This was weird. I was happy the system is up and running again. But i wasn’t satisfied.

I made a backup of my xorg.conf file. And again did a complete new install of Ubuntu 8.10. After the install i updated to the new kernel. And after a reboot installed the nvidia-177 driver. But this time before i rebooted i copied my old xorg.conf file over the one generated by nvidia-xconfig. Rebooted the machine. Everything worked.

Conclusion. nvidia-xconfig doesn’t create a correct xorg.conf file. I got two different errors from the nvidia driver at boot up. One saying “no screens found’ The other one saying “Device is not PCI” or something like that.

I’ll add my xorg.conf file here. Maybe it’s of any use

# nvidia-settings: X configuration file generated by nvidia-settings
# nvidia-settings: version 1.0 (buildd@vernadsky) Thu Jun 5 09:26:53 UTC 2008

# xorg.conf (X.Org X Window System server configuration file)
#
# This file was generated by dexconf, the Debian X Configuration tool, using
# values from the debconf database.
#
# Edit this file with caution, and see the xorg.conf manual page.
# (Type “man xorg.conf” at the shell prompt.)
#
# This file is automatically updated on xserver-xorg package upgrades *only*
# if it has not been modified since the last upgrade of the xserver-xorg
# package.
#
# If you have edited this file but would like it to be automatically updated
# again, run the following command:
# sudo dpkg-reconfigure -phigh xserver-xorg

Section “ServerLayout”
Identifier “Default Layout”
Screen 0 “Screen0″ 0 0
EndSection

Section “Module”
Load “glx”
EndSection

Section “ServerFlags”
Option “Xinerama” “0″
EndSection

# commented out by update-manager, HAL is now used
#Section “InputDevice”
# Identifier “Generic Keyboard”
# Driver “kbd”
# Option “XkbRules” “xorg”
# Option “XkbModel” “pc105″
# Option “XkbLayout” “us”
#EndSection

# commented out by update-manager, HAL is now used
#Section “InputDevice”
# Identifier “Configured Mouse”
# Driver “mouse”
# Option “CorePointer”
#EndSection

Section “Monitor”
Identifier “Configured Monitor”
EndSection

Section “Monitor”
Identifier “Monitor0″
VendorName “Unknown”
ModelName “Iiyama PL2201W”
HorizSync 30.0 – 80.0
VertRefresh 55.0 – 75.0
EndSection

Section “Device”
Identifier “Configured Video Device”
Driver “nvidia”
Option “NoLogo” “True”
EndSection

Section “Device”
Identifier “Videocard0″
Driver “nvidia”
VendorName “NVIDIA Corporation”
BoardName “GeForce 8600 GT”
BusID “PCI:1:0:0″
EndSection

Section “Screen”
Identifier “Default Screen”
Device “Configured Video Device”
Monitor “Configured Monitor”
DefaultDepth 24
EndSection

Section “Screen”
Identifier “Screen0″
Device “Videocard0″
Monitor “Monitor0″
DefaultDepth 24
Option “TwinView” “1″
Option “TwinViewXineramaInfoOrder” “DFP-0″
Option “metamodes” “DFP-0: nvidia-auto-select +0+0, DFP-1: nvidia-auto-select +1680+0″
EndSection

Still here

It’s been a while since i blogged last time. But i’m still here. And still planning to continue this blog. I just need to make some time to write. And time is not something that comes cheap latley :)

Some months ago i move to my new appartment. But i’m still working on it. It probably would have been better if i completed it completly befor emoving there. But it has to be done. So it takes up a lot of my time.

And besides that two weeks ago i started my new job here in Amsterdam. And this takes up the rest of my time. Trying to read into a new code base. And trying to understand everything that goes on around the office. It’s a hectic place. But it feels great so far.

Parsing XML CDATA with SimpleXML

I was quite amazed today. When loading a SOAP response into a SimpleXMLElement i noticed some fields were left blank. I should have checked the SOAP response first. But instead told our Delphi guy that the response was not filled correctly. This was not the case :)

When we both saw the SOAP response was in perfect shape. We started to poke around on the PHP side. The strange thing was all tag names were taken from the response correctly. It was just the data that was missing. Then we noticed the data missing was inside CDATA tags.

From a first glance at the PHP manual it it wasn’t clear what was going on. So i did some googleing. And found a good post by David Coallier. This post solved the problem. The example showed how to add an extra LIBXML options to the simplexml_load_String method. Although David provided the solution. I still wanted to make post. Maybe it will help somebody.

    // parsing with CDATA tags using the *_load_string method
    $xml = simplexml_load_string($string, 'SimpleXMLElement', LIBXML_NOCDATA);

    // parsing with CDATA tags using the OO way
    $xml = new SimpleXMLElement($string, LIBXML_NOCDATA);

The LIBXML options that can be passed to the *_load methods and constructor can be found in the php documentation.

It’s pretty damn weird though. I want to parse the CDATA tags inside my XML. And can only do so by providing the NOCDATA option.

Load MOOdalBoxes without clicking links

The MOOdalBox script is a great addition to the mootools library. The interface is pretty slick. And easy to style with just CSS. Răzvan Brateş did a great job here. And every now and then i have to implement one of those MOOdalBoxes in a web application. No problem here.

Until today all MOOdalBoxes i used were triggered by simply clicking a link on a page. But today i needed to load a MOOdalBox window on page load. The screen represented some sort of QuickStart menu. Which can be disabled. I had no idea how to trigger the MOOdalBox from javascript. But once i read through the source. It became clear that it should be as easy as calling:

MOOdalBox.open(url, title, sizes);

This kept giving me the following error:

this.overlay is undefined

Looking through the MOOdalBox source. I noticed the this.overlay property was set inside the init() method. So let’s try that before we call the open() method.

MOOdalBox.init();
MOOdalBox.open(url, title, sizes);

This actually worked. I was pretty happy with the result. untill i opened IE 7 to test the same page. Nothing happened. No error’s and no MOOdalBox. Let’s try something else. Whenever i need to load something on page load in IE i use the window.onload method.

window.onload = function()
    MOOdalBox.init();
    MOOdalBox.open(url, title, sizes);
}

Now the overlay was loaded. But still no MOOdalBox on top of it. I figured it had something to do with the DOM not being fully loaded. But i couldn’t really think of a solution. So of to Google. After a bit of browsing i found somebody with the same problem. And a reply from the original author of MOOdalBox. Add a domready event to make it work.

window.addEvent('domready', loadMOOdal);
function loadMOOdal() {
    MOOdalBox.open('Quickstart/load', '', '700 500');
}

This did it. And my only goal was to make it function properly inside of IE 7. but this also fixes the same problem for IE 6. So a big thanks to Răzvan for creating MOOdalBox and for supplying the fix.

ATP is seeking web developers

For the past three years I’ve been working as a web developer for ATP in the Netherlands. This has been a great experience. And still is. I have the pleasure of working with some really smart people here. Who are always eager to work with the newest technologies. This offers a great learning ground for all of us. The projects have evolved over the years. From simple websites to complex web applications.

Right now we are looking for some experienced web developers to strengthen the team. we are looking for somebody who master the following skills.

  • PHP Specialist (a minimum of 3 years experience)
  • Object oriented experience
  • Good knowledge of XML, SQL, JavaScript en CSS
  • Experienced with web services (SOAP, XML-RPC)
  • You are flexible, pro-active, pragmatic and eager to learn
  • You can work alone or in a team
  • You have good communicative skills in Dutch and English
  • You are able to prioritize in hectic situations

We offer a great working environment. Good secondary working conditions. A year contract with the intention to prolong.

If you are located in the Schiphol / Amsterdam area. And are looking for a good job. take your chance. For more information take a look at atp.nl. If you are interested drop me a line.

Zend Studio Project Outline Missing

Project Outline is a superb feature of Zend Studio for navigating fast through your project and classes.
However once in a while a problem occurs with this project outline when checking out a new project from a SVN repository.

Normally you would browse your repository by using SVN Repositories in the Show View option under Window. Checking out the trunk with Find/Check Out As gives you the option to check out as a PHP Project. Which will enable your Project Outline.

However for some reason I could not get a specific project with the Projecet Outline. Then i checked the .project file created by Zend Studio and noticed 2 differenced.

First the buildspec tag was totally empty. Meaning Zend Studio would not use the Incremental Project Builder and not use the Validation Manager Wrapper. (Does nothing for your project outline)

Second was the natures tag. This tag was also empty. But should have got <nature>org.eclipse.php.core.PHPNature</nature> tag in it for Zend Studio to activate the Project Outline.