HipHop for PHP from Facebook hit the streets several days ago resulting in dozens of posts about the technology. Let’s see what the PHP community says:
- Marco Tabini enlists the HipHop features and encourages using it
- the echolibre blog talks about possible security/buffer overflow implications, and mentions similar available solutions
- Ilia Alshanetsky provides an excellent and thorough overview: he goes into technical details and also practical usage. Though 99.9% of PHP deployments out there do not share the same challenges as Facebook (massive, continually evolving code base and equally massive traffic), [HipHop is also] an incredibly impressive technical achievement, [...] a very helpful development for PHP community in general.
- Brandon Savage: benefits are large for producers of large-scale web applications written in PHP and who distribute PHP code to clients directly - but HipHop is not the choice of the every day developer.
- Christian Stocker/LIIP: for most websites (and more so for small ones), PHP’s speed isn’t really the bottleneck, it’s the database or some other external dependency. And for these cases HipHop isn’t the holy grail.
- Vid Luther/ThirdPartyCode: It’s not for you. The number of servers arguments comes into play when you can eliminate > 100 servers. If you’re going from 4 servers to 2, I guarantee you that you’re doing it wrong.
- Sebastian Bergmann: As there is a real build — including a real compilation — with HipHop, best practices such as coding standards and continuous integration will be even more important. [...] Yes, it is not a solution for a problem faced by 99.9% of the PHP deployments out there. But this does not make it less interesting in any way.
- Stuart Herbert “Can HipHop Help The Planet?”: [...] you might not be aware that the power required by each server in a rack is often a major factor in the overall cost of running the servers. [...] Until we can play with HipHop ourselves, it’s impossible to say whether it saves enough CPU cycles to allow us to use less CPUs and therefore less servers. [...] But it sure is nice to hope, isn’t it?
- Lukas Kahwe Smith/Poo-tee-weet: I do not expect that anyone can really get a meaningful return on investment who makes this their business anytime soon. [...] Wouldn’t we expect at least a 2 fold .. or more increase if we could transform our PHP code into a C extension? This approach seems a lot more feasible for the masses. Like we could just drop in a ext/symfony or ext/ZF and thanks to autoloading magic our setup would continue to run unchanged. [...] To me this solution will only matter for the ultra large companies where every single percent of saved CPU cycles matter. For the rest of us I think we need to rely on APC for a bit longer. But maybe with this transformator out there, other people will start working on the much more feasible approach of writing a PHP Code to C extension transformator.
- Stas/PHP 10.0 blog: there are some serious challenges to consider: plugins, modularity, portability, thread-safety, debugging. [...] Danger primary being that the performance is very important in the web world, and it can give an incentive to the PHP community to change PHP in ways that may be better for performance, but would make PHP into being an entirely different language.
- Stefan Priebsch wrote another excellent summary about what to expect: as there’s a functional gap between PHP and HipHop, HipHop will always lag a little behind. You’ll need to adapt strict coding guidelines and more automated tests to make sure your HipHop’d code work as expected. On the server side you may need to compile code for different processor architectures or unify your servers, and also take care of web server features currently handled by Apache or LightTPD (URL rewriting, load balancing, proxying, etc.). You also need to scale your infrastructure together with HipHop to keep up with the increased throughput.

Posted in: PHP, emerging technologies, performance, web development.
“At some stage in your career, it’s likely you’ll be asked by a client to design a HTML email. [...] Building an email is not like building for the web. While web browsers continue their onward march towards standards, many email clients have stubbornly stayed put. Some have even gone backwards.”
Rock Solid HTML Emails is a really useful article from David Greiner, co-founder of Campaign Monitor, aimed to help with HTML and CSS while creating rich e-mail content.
The article is part of the “24 ways to impress your friends” series, which is an advent calendar blog for web professionals. If you like the advent article idea, be sure to check out Performance Advent and PHP Advent too!
Posted in: e-mail, mail clients.
Tagged: CSS · direct marketing · e-mail · e-mail marketing · HTML · HTML e-mail · quirks · rich e-mail · tips · tricks
There are many developers who prefer using ENUM in MySQL, which seems to be a viable choice many times. However it’s important to take care as…
- ENUM requires a rebuild of the table when adding a value to the middle of the set.
- ENUM values are ordered in the order they’re added to the database
- ENUM values do in the database what should be done in the model.
ENUM could be useful for columns that had data that would always fit into one particular set of values. For example gender would be one such field that might be served well with an ENUM.
As Brandon says: “The bottom line is that ENUM has its place, but should be used sparingly. The model should enforce the constraints, not the database; the model should handle interpreting raw data into useful information for your views, not the database.”
via Why You Should Replace ENUM With Something Else – Brandon Savage
Posted in: MySQL, databases.
Tagged: data type · database · enum · MySQL
Dmitry Baranovskiy, the creator of the Raphaël and gRaphaël JavaScript libraries has serious criticism against the Google Closure JS library.
According to Dmitry:
- “It’s a JavaScript library written by Java developers who clearly don’t get JavaScript.”
- poorly optimized loops and unoptimized switch statements
- memory caching with unlimited size: “I’m not sure what this pattern is called in Java, but in JavaScript it’s called a ‘memory leak’.”
- Closure Library cannot coexist with any JavaScript code that adds features to
Object.prototype.
- Java-inspired type confusions
- Closure’s graphics classes are modeled around the HTML5 canvas API, which is about what you’d expect from a JavaScript API designed by an HTML standards body. In short, it’s repetitive, inefficient, and downright unpleasant to code against.
The truth is, developers will switch to Closure because it bears the Google name, and that’s the real tragedy here. Like it or not, Google is a trusted name in the development community, and it has a responsibility to that community to do a little homework before deciding a library like Closure deserves public exposure.
via SitePoint Blogs: Google Closure: How not to write JavaScript.
Posted in: JavaScript, emerging technologies, performance, web development.
Tagged: API · google closure · HTML5 canvas · java · JavaScript · memory leak · object · optimization · poor optimization · prototype · unoptimized
Interested in simulating XP’s Active Desktop without Active Desktop? We’ve had taken the challenge!
Why?
One of our clients wanted a central web application running on the desktop which provides nearly realtime business information for more than a hundred users in a company. After some discussion with the company’s IT staff we’ve chosen Active Desktop as all the PCs run Windows XP which supports this technology. Desktop locking also helps preventing users from disabling the application (you wouldn’t how users stick to their favourite background images!
Continue reading →
Posted in: JavaScript, Uncategorized, emerging technologies, operating systems.
Tagged: active desktop · adobe air · autohotkey · minimize all · scf · Shell Command File · show desktop · sidebars · widgets · windows vista · windows xp
Brandon Savage has some great tips regarding coding OOP:
- “Use Objects. Lots of Objects”
- “Use Interfaces To Make APIs Predictable”
- Use Dependency Injection”
- “Composition Over Inheritance”
- “Create Loosely Coupled Classes”
As you can see it’s absolutely not rocket science nor these are new invetions: these rules simply help to avoid typical OOP pitfalls and keep your applications well structured.
Posted in: PHP, web development.
Google released Closure, the library and toolset that powers Docs and other Google products.
Closure includes:
- Closure Compiler - removes dead code and rewrites and minimizes what’s left, checks syntax, variable references and types, and warns about common JavaScript pitfalls.
- Closure Library - a JS library with widgets, controls, lower-level utilities for DOM manipulation, server communication, animation, data structures, unit testing, rich-text editing, and more.
- Closure Templates - a templating system
via Ajaxian
Posted in: JavaScript, emerging technologies, web development.
Tagged: closure · compiler · framework · Google · JavaScript · library · template
Brandon Savage compiled a good summary of application performance tips. Definitely not the difference between using single and double quotes in your code: these are easy to implement and effective (=”micro”) methods to improve responsiveness of your code, like:
- Caching
- Eliminate Any Sort Of Logged Errors
- Enable Output Buffering For Everything
- Make Use Of A Content-Delivery Network
- Determine What Data Doesn’t Need To Be Real-Time
- Consider Using An Autoloader
Read more about “Micro” Optimizations That Matter at BrandonSavage.net.
Posted in: PHP, performance.
Tagged: autoloader · caching · cdn · content-delivery network · error logging · optimization · output buffering · performance · php · real-time data
Running CRON jobs is not an easy task if you want to do it perfectly: fortunately we’re doing it similarly as it’s recommended by the Percona guys:
- prevent running multiple copies using file locks
- watch for errors
- store historical run times (use logging)
Further details and code sample in Watch out for your CRON jobs at MySQL Performance Blog.
Posted in: PHP, performance.
Tagged: background · cron · error handling · exclusive · job · locking · logging
Do you have some image resizing PHP code out in the wild? You’d better prepare yourself: your code may break anytime if you don’t pay attention to the memory limit settings of PHP. (God, it could already did!)
Take care of the plenty megapixel images and avoid trouble now!
How many memory do you really need? Find it out for yourself! The dotsamazing.com labs proudly presents the hot’n’sexy PHP memory limit calculator for image resizing! Check it and process images like a pro.
Should you have any questions regarding image resizing and memory allocation, feel free to ask in the comments!
Posted in: PHP, web development.
Tagged: allocation · bytes · calculator · cmyk · height · htaccess · image resizing · imagecopyresampled · imagecreate · imagecreatefromjpeg · ini_get · ini_set · megapixel · memory_limit · php · rgb · width