Tag: Web Development
The great web technology shootout – Round 2: PHP deserves a helping hand
by Seth on Sep.21, 2009, under F/OSS, Web Development
[A lot of the information below is out of date. Please see the new framework shootout page for the latest benchmarks.]
[This post is the continuation of a series. Please read Round 1 first if you are just now joining us.]
In Round 1, PHP was looking like quite the tortoise of the group. However, if you’re familiar with some of the core differences between Python & PHP, you’ll know that Python has been “cheating” slightly.
Let me explain: By default, Python compiles each script into bytecode on its first execution, allowing this bottleneck to be skipped on subsequent runs. PHP, however does not perform this type of optimization by default (in the 5.x line at least), so the PHP interpreter must re-compile each file every time it is run. As you can imagine, this can give PHP (without an accelerator) a huge disadvantage when compared to languages such as Python.
With this in mind, I have decided to take Round 2 to focus solely PHP. This will hopefully provide a clear picture of the benefits of PHP bytecode caching (at least when it comes to page-views — the memory benefits are a whole other story), and give you an idea of PHP’s performance with the help of an accelerator.
There are many PHP accelerators available, but I have chosen APC for use here (mostly due to its inclusion in the upcoming PHP 6 core). (continue reading…)
Making TurboGears and Authorize.net play nice together
by Seth on Jul.18, 2009, under Python, Web Development
I recently had to wire up an Authorize.net form for a TurboGears project I’m building, and since I’m a bit new to custom form validation in TG I had quite a bit of trouble figuring out the “right” way to do it.
The goal was to get the form to go through two layers of validation before passing:
- Use the validation packages provided by TG (tw.forms and formencode)
- If the first layer of validation passes, try to run the authorize.net charge. If this returns a response code of 1 (approved) then all validation has passed. Otherwise, invalidate the form and flash the authorize.net error.
tw.forms and formencode are awesome packages, but at first glance there didn’t seem to be “one obvious way” to do things. I found the documentation and tutorials to be scant at best, and eventually went to the TurboGears mailing list for help. In spite of the fact that I’d probably give TurboGears a “C” at best for its documentation (not to mention the availability of “verbose” tutorials), the folks on the mailing list and IRC channel (when it’s actually active) seem to be quite helpful.
Eventually (and with additional help from Google’s source code search) I was able to hack together something that worked as planned, and was overjoyed to observe chained validators in action. Below is some example code provided for your hacking pleasure. To download the full example file, see the links at the bottom of the post. (continue reading…)
Firefox extensions (a.k.a. stuff I can’t live without!)
by Seth on Jun.13, 2009, under F/OSS
Note: A few months ago when I started drafting this post, Firefox v3.0 had just been released and I was enjoying it immensely. I started this post with a rant against IE (still included) and a call to Sarafi users to “get with the movement”. Well, a lot has changed since then. Safari 4 is really slick, Google did the unthinkable and released a browser of their own, and Internet Explorer 8 actually likes web standards. So, I am finally publishing this post with a few slight updates and edits.
I’ve been playing around with Mozilla’s latest release, and I’ve got to say: Firefox is where it’s at! If anyone out there is still using Internet Explorer, you deserve anything that comes to you by way of malware, adware, spam, viruses, etc. Seriously, get with the times and install a real browser! And to you Apple/Mac users out there: Yeah, Safari is nice, but don’t let pride keep you from branching out of familiar territory.
One of the great thing about Firefox is its add-ons, and I’ve decided it’s time to dedicate a post to a few of my personal favorites: (continue reading…)