Archive

Archive for September, 2007

2008 PHP Quebec Conference: Call for Speakers

September 16th, 2007 No comments

2008 PHP Quebec ConferencePHP Quebec is pleased to announce the sixth edition of the PHP Quebec Conference. The Conference will take place in Montreal, Canada between March 12 and 14th, 2008. We are looking for speakers willing to share their expertise with Canadian and United States PHP professionals.

The Conference features the PHPLab, where speakers and visitors will try to find solutions to actual business problems. The two days of technical talks will be dedicated to advanced software development techniques with PHP5 and PHP6, XML, web services, databases, etc.

Organizers will prioritize new and original topics in English or French.
For more information, visit the website: http://conf.phpquebec.com

Tags:

AI: Manipulating images in a whole new way

September 7th, 2007 No comments

We are used to cropping and proportional resizing of our images to make them fit. We also spend hours carefully erasing unwanted elements from them. New technology allows content-aware image resizing. Totally genius!

Also download the publication by Shai Avidan and Ariel Shamir: Seam Carving for Content-Aware Image Resizing We might soon see this technology in Adobe products since they recently hired co-creator Shai Avidan.

PS: Photoshop price will go up :-(

Tags:

Refresh form but do not resubmit (PHP)

September 2nd, 2007 4 comments

This question has been asked so many times that most of you don’t want to hear it again. Unfortunately, the solutions that people are proposing are less than ideal.

For those who are new to the concept, a quick explanation is in order. You have a form that you display, validate and act upon (send e-mail, save to database, upload files, etc.) Once this is done, the user might refresh the page and you will end up with duplicate entries.

Bad ideas to handle it are: splitting into multiple files to work around this problem, using the meta-refresh tag, setting unique identifiers and store them in session or in hidden fields, checking for duplicates after resubmission, using javascript…
If you want to know why they are bad, just post a comment and I will give you a detailed explanation of the particular case.

I found a quick and neat way to do it (perhaps I’m not the first, but I feel the need to share it). Append “?submit=true” to your form action and use header(“Location: …”) with the current URL. Thus, once form data has been saved, you will be redirected to the same page without the POST variables. If PHP complains that output was already sent, then you have a bad approach for your output. I usually store all my output in a variable(s) and echo it when everything is okay. More on output in another entry.

Tags: , ,