April 4th, 2009
April 2nd, 2009
REST advocates to use HTTP for CRUD fully exploiting the verbs defined in the protocol specification:
POST to Create
GET to Read
PUT to Update
DELETE to Delete
Nothing strange about that. But how do we handle server-side data validation ?
Server-side validation cannot be replaced by client-side but it complements it. Client-side we can f.i. verify if an E-mail address is compliant with the SMTP rules but we cannot verify if the address is already registered in our database.
HTTP provides the error codes 4xx to indicate that something has happened:
400 Bad Request
The request could not be understood by the server due to malformed syntax. The client SHOULD NOT repeat the request without modifications.
and specifically:
409 Conflict
The request could not be completed due to a conflict with the current state of the resource. This code is only allowed in situations where it is expected that the user might be able to resolve the conflict and resubmit the request. The response body SHOULD include enough information for the user to recognize the source of the conflict.
But how do we include enough information?
Inspired by the error validation model used in Spring MVC (Errors) I suggest that together with the 409 the server includes a response that may look like the following (assuming we are using xml):
Since the client can hold a reference to the object used for the POST/PUT operation, we may not need to include the invalid model in the response. The client should be able to show to the user an appropriate form with the validation errors.
Of course the errors tag could be extended to include more information to handle all the different cases but I thing that the idea is right (again, take a look at the Errors class in Spring MVC for an example of how to handle all kind of validation errors)
March 19th, 2009
I Just published on github a tool to concatenate JavaScript and CSS files on the fly to speed up the development process when using large code base. Check the project page
January 28th, 2009
I have been looking for you for ages.
I wanted to know all of your secrets, not just guess them from the POM reference or from the maven official documentation, which is very poor in same cases.
Where have you been?
Finally I found you, Maven Definitive Guide!
January 22nd, 2009
January 21st, 2009
I just got my Corsair Value Select 1GB DDR1 400Mhz PC3200 (VS1GSDS400/EU) memory module and installed on my ReadyNas NV+. I’ve run the memory test twice and it works like a charm.
Unfortunately my SqueezeCenter is not much faster…, but this is an other story :-(
January 10th, 2009
I got a new macbook (alu) and since I once happened to overwrite a file because the default file system for OS X is case-insensitive, I thought I would be smart in reformatting the hard-disk before installing anything and changing the partition to case-sensitive (use DiskUtility to do so just after booting from the Leopard cd).
Unfortunately, it proved to be a bad choice since many applications are not written for a case-sensitive filesystem (see Adobe Photoshop Elements, f.i.). That pissed me off! Probably an ordinary Mac user will have an happy life with a case-insensitive fs but since I have a linux background it seems very unnatural to me.
Nevermind, I tried to find a way to convert my fs to case-insensitive without having to reinstall everything. I first tried restoring with a TimeMachine backup, after having reformatted the disk case-insensitive but the backup restored the whole partition as case-sensitive.
The solution seemed to be to fully reinstall OS-X from scratch and when it prompts for restoring data from TimeMachine choose all options and do a restore (You can also do this though Migration Assistant).
Now I’m “happily” back to a case-insensitive filesystem and can install my Photoshop….sigh
November 19th, 2008
When using png images as background, you need to apply a trick to make Internet Explorer 6 to display the background as transparent:
I realized though that if Internet Explorer caching setting is set to Every visit to the page, the png file is dowloaded multiple times if you have the same picture more than once in the same page and, in some cases, even ofter if you are doing some DOM manipulation.
The solution is to add the Cache-Control header to the http response serving the png.
In apache, you can for instance do it using the following directive:
after having loaded the module “headers”.
See this nice post on how to do htaccess Caching
November 5th, 2008
The Swedish company ÅF has been looking for consultants.
To gain some visibility they built a flash based website on which you could solve some programming exercises. Besides getting a wider spread of candidates, they surely succeeded making the “job application” more interesting.
They said they were going to offer a job to the first 100 in the list and give out some prices.
I was not looking for a job but I could not resist the temptation and I had to spend a few hours solving the problems. At the end I got to the 120th place (too bad…they will not offer my a job which I could have refused :-)
For those who are curious, at the end, to get into the list, it was not a matter of being able to solve the problems but to solve them fast. Surely the guy who got into the first place succeeded in automating the procedure somehow.
You can see the list on www.welcometothelist.com
October 23rd, 2008
After working last year at Eniro maps to introduce the “utsikt” images (images taken from an airplane at a 45° angle), we have today successfully launched the integration of Eniro maps on Hemnet, Sweden largest site for real-estate.
During the project I acted as a javascript programmer and as a scrum master together with Torsten Ek as projekt leader and the cordination of Johan Ljung.
I also introduced a lot of javascript unit testing, it was pretty cool!
« Previous Page — Next Page »