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:
- 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.
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.
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!
document.write( 0.1 + 0.2 );
document.write( '<br />' );
document.write( 0.1 + 0.2 === 0.3 );
Well, not exactly the result I’ve expected.
However, the issue is absolutely not unknown neither new: many languages (including C) have similar issues due to the approximate representation of floating point numbers in memory (leaving the deep explanation to others).
For the impatient: you’ve got two options here.
First: use the .toFixed() method, for example:
( 0.1 + 0.2 ).toFixed( 2 )
It works fine when you don’t really need the floating point calculations, which is absolutely fine for money calculations for example.
The second option? Well, I should offer a nice GPL JS library which does the trick. The bad news is that I’m not aware of one, so should you find a solution, feel free to post it in the comments!
It seems that Sun is serious about providing PHP support in the NetBeans, a 10-years-old Java IDE.
However, besides many of the cool features already included there’s a showstopping shortage for many PHP devheads: NetBeans does not support the all-time favourite Smarty template library, which provides the foundations for zillions of web sites out in the cloud.
Though NetBeans does cool source highlighting and much more even when there’s PHP and HTML mixed together in a single file, Smarty support is entirely missing – I’m sure it will make many developers turn away from NetBeans in the first round, unless the support arrives soon.
As a comment says in the NetBeans issue tracker, “Officially there will not be any framework supported in NB 6.5“.
I agree that adding a framework means much more work than adding a syntax highlighter from the NB viewpoint (that’s why a separate plugin project has been established for Drupal), though even such a support could help a lot in the first round.
Fortunately we’re not entirely lost – there are two things you can do:
- first, you can add your Smarty extension (eg.
Tools > Options > Miscellaneous > Files
and set the MIME type to
PHP files (text/x-php5)
This step adds at least basic HTML and PHP formatting – it seems to be the most you can achieve right now.
- and vote to the appropriate issue in the bug tracker of NetBeans right now! You’ll need to do a short one-minute registration for that, but if you’re devoted to using both Smarty and NetBeans that’s not that much.