Hit and run victim

I’m officially a hit and run victim. Yesterday I decided to go to work for a few hours to some tidying in my projects. After walking 200 meters I had to cross the street. The tram was in my way, so I stood at the curb waiting for it to pass. When it had passed I took one step out in the road and some jerk drives right over it. This was a crossing with no traffic lights, so the guy should have stopped. I spent a few seconds making sure my foot was working, and once I was sure of that I directed my attention to the car.. which drove off. I got the license plate and I plan on pressing charges later today. I went to see a doctor after the incident, and luckily nothing was broken. I ended up with cruches and a bandage which I’m supposed to use for a week. Can hardly stand on the foot.


If you ever get in this situation and want the name of the bastard that hit you, just SMS the REGNR XX##### to 2282 (In Norway that is.


Generated PDFs over HTTPS with Internet Explorer

Please see my new blog

One of the applications I’ve been working on generates PDF files which the customer can download. I’m using the FPDF and FPDI libraries to import PDFs and create copies with generated contents. This has been really easy to code, and it’s been working flawlessly in both Firefox and Safair. When we started testing under Internet Explorer thing started breaking. The problem was that IE would not let the user download the file. The only feedback we got was error messages like “The file is currently unavailable or cannot be found.  Please try again later.” and “The file could not be stored in cache”. After spending some time debugging I found out that IE has problems with file downloads over HTTPS. Google pointed me to http://in2.php.net/manual/en/function.header.php#74736. The guy in that post spent six hours figuring it out, and he probably saved me six hours as well. The magic required to satisfy Internet Explorers needs:

header(‘Cache-Control: maxage=3600’);
header(‘Pragma: public’);

Spread the message so others can spare some time!

Zend Studio running slowly?

I’ve been working with Zend Studio for six months now, and I’ve been pretty happy with the IDE. There are some minor issues with the auto complete feature, and sometimes it tends to just lock up. When I came to work today Zend just would not cooperate at all. I loaded up a project, and it took 45sec just to browse a folder. Opening a file took 30 seconds more, and typing / selecting text was all done with 5sec delays. I tried restarting the IDE, restarting my workstation, nothing helped. After looking around on the net for a while I saw some Windows users had similar problems, and deleting the Zend cache was apparently a good thing to do. The cache files on Linux is usually stored in /home/user/ZDE/config_x.x/caches (x being the Zend Studio version). After deleting the files in that folder Zend is back and running like never before.

Facelift for Telio!

Telio (my employer) has just gotten a website redesign and new logo that is. The new logo is a bit more slick and nice than the old circles, and the front page for the web is much cleaner and more structured. Design is not my thing, but I think they’ve pulled it off pretty well. Take a look at http://www.telio.ch.

PHP Vikinger this Saturday

This Saturday the annual PHP Vikinger will be held in Skien, Norway. It’s a unconference about PHP and all related. I’ll be attending and so will Knut. Head over to http://phpvikinger.org/ for more information.

Zend Studio auto-completer tip

I just came across a annoying “feature” in Zend Studio. In the project I’m working on I have branches, trunk and export/releases. The workspace I set up in Zend uses the root folder as project directory so I can easily browse all branches and trunk. I’ve been working in trunk all day, adding type hinting and documentation for several classes, but when I got around to actually using the classes the auto-completer didn’t find the additions I had made. After checking around a bit I found out that Zend reads the folders alphabetically, so when I was working in trunk Zend got the auto-completer data from branches. Nice to know.

Ageci token vs PHP

I spent some time figuring out how acegi tokens works and how to use them with Prado in PHP. An acegi token is a hash-key-ish token that you can use to identify yourself with a web service instead of signing on with user-name and password for every page load. The way this works is as follows:

1.) First time, sign in with username and password
2.) Soap server returns a ageci token and sets in in a cookie on the soap client
3.) Grab the token and store it across page requests.
4.) All subsequent calls, set the token in the soap clients cookies.

The token stays the same across the whole session. I’ve experienced two different behaviours when it comes to returning the token. Some services returns the token with each response, while other services only return the token on the first call and sends null in the subsequent calls. There is one exception to the first, and that’s when I encounter soap-faults. The token seems to be null with those no matter what.

It took me some time to get this right. I had never worked with acegi tokens until last week, so I was pretty much blank on the topic. Google didn’t offer much in terms of samples with PHP.

When a user signs on for the first time I connect to the web service in the user login method in the Prado user-manager. I make sure the token is returned and I store it a field in the user object. The token is encrypted, but I do some extra magic to make sure everything is as secure as possible. The token is then serialized and stored with the Prado user object. On page load I make sure to retrieve the token from the current user and set it for the service. This is done in the preRunService method in a custom TApplication class.

It’s been a few days since I got this implemented now, and everything seems to work very well. It’s nice to have the extra layer of security so the user-name and password can be used once and then thrown away.

Backbase – A kickass AJAX framework

I’ve got a upcoming project that requires some complex interaction services and I’m looking around for frameworks that suits my needs. Almost everything I develop gets done using the Prado Framework. The AJAX support in Prado is pretty new (at least for the 3.x version), so I’ll probably need something that offers more in terms of integrated services and controls. Prado supplies some of the underlying features, but I do not have the time to re-invent several wheels. I know that there are plans for new ajax features and controls in Prado 3.1, but I can’t sit around waiting for that.

It’s been quite some time since the first time I heard about the Backbase framework. I’ve never gotten around to take it for a spin, but I’ve spent some time reading the documentation and checking out the samples. The Backbase Travel Demo is especially impressive. The controls and widgets that ships with the package are pretty impressive as well. I hope to get time to give it a spin this weekend. If I do I’ll do a short writeup on my impressions and experiences.

Profile / Personalization module for Prado 3

I’ve made a profile module for Prado that lets you store user preferences etc in a database. I got the idea from the ASP.net Profile classes (visit) . At the moment the module uses SQL-Lite as storage engine, but I plan on adding support for XML and SQL databases. The module overrides PHP’s “magic methods” __get and __set, which makes access to the keys really easy. I’ve submitted this to the Prado TRAC asking them to add it to the framework. The code could use some cleaning.

$this->Profile->SomeSetting = “some value”; // creates the key SomeSetting for the current user ID with the value “some value”
$foo = $this->Profile->SomeSetting; // retrieves the value of SomeSetting for the current user ID

The first version is available here. I plan on refactoring it a bit to make sure it can be used with different kinds of user setups.

2007 PHP-IDE Poll results out!

The results for the 2007 PHP-IDE polls are ready. They are available here. The top three are:

1. Eclipse (at 30%)

2. Simple editors (at 26%)

3. Zend (at 25%, my favorite)

I see that Komodo is at only 3% which is a bit surprising. I plan on evaluating that when I get the time. The extension support there is supposed to be as good as Firefox.

« Older entries Newer entries »