Archive for March 27th, 2007
Dev Shed - March 27th, 2007
When we think of video games we often think of the music and sounds that accompany them. Providing those special effects used to be very difficult. Keep reading to learn how SDL makes this important task very easy….
Rackspace: Save on Web Hosting in March! Start working with The Hosting Experts today and Save - Get Free Setup in March!
Continue Reading ·
PHP Developer - March 27th, 2007
In this new post on Mgccl’s blog today, there’s a response to these benchmarks from John Walsh concerning which is faster - a for loop or a while loop.
In this new post, Mgccl, he points out two other examples that show that a while loop is always faster than a for loop. To help prove the point, he’s also included a screencast where he shows the code he’s using to run the benchmarks (several different tests).
His results, matching the results from the other reports, not only shows that the while loop is faster (still only slightly), but also consumes less memory in the process.
Continue Reading ·
PHP Developer - March 27th, 2007
In this post from his blog, Jacob Santos asks the question “would PHP benefit from JIT compilation?”
JIT (just in time) compilation is, according to Wikipedia, a method for converting, at runtime, code from one format into another, for example bytecode into native machine code. To try to see the benefit of this, Jacob asks four questions in his post (each with their own problems):
- Q: What advantage over opcode caching is gained?
P: A JIT library that works with PHP would have to support all of the architectures that PHP can run on!
- Q: Which JIT library is the best one?
P: A JIT compiler is not going to achieve anything without either storing the results or caching them.
- Q: Wouldn’t writing PHP extensions negate the need for JIT compilation?
- Q: When will I develop and release my implementation?
Check out the comments for some great thoughts from others about this kind of compilation.
Continue Reading ·
PHP Developer - March 27th, 2007
In an article from the Zend Developer Zone by Manuel Lemos, there’s a look at how to avoid cross-site scripting security attacks on a site that allows users to input information via a HTML editor.
HTML editors are great. However, care must be taken to avoid security abuses. An application that uses HTML editors, expects that the submitted HTML content comes correctly formatted and well-formed. That happens when real users use real browsers to edit the content.
However, an attacker may create a program that pretends to be a real browser and submit specially crafted HTML with Javascript that may open security holes.
Manuel talks a bit about what cross-site scripting means in this context and a simple (Javascript) example of how a user could abuse it. His solution? Parse the incoming data (filter it!) and look for potentially harmful tag types. To do this, he recommends the PHP Input Filter class. There’s even a simple example of how to use it included in the post.
Continue Reading ·
PHP Developer - March 27th, 2007
Pádraic Brady has a new post on his blog today along the theme of his recent YAML efforts - this time spotlighting the proposal he’s submitted to the Zend Framework project for a Zend_Yaml component.
So isn’t it time there was something native to PHP to allow everyone work with the YAML format? Well, I think so… So last week I ran off and did some digging, coding, and sacrificed a few white pigeons to the dark gods of inspiration. Once the pigeon blood and other…eh…bits were mopped up, I wrote the proposal for the Zend Framework - read it here. It’s nothing fancy, just a general outline and some sample use cases.
And, according to the proposal:
The interface to Zend_Yaml will be deliberately simple supporting the deserialisation of YAML from either a file resource or a native string. Also supporting will be the serialisation of PHP native types into the YAML format. The default return value will be in the form of an array. Similar to Zend_Json, an option to decode YAML into stdClasses will also be offered for consistency.
Continue Reading ·