Archive for the ‘PHP’ category

Web scraping with PHP and XPath

February 17th, 2009

When I was writing about how I use web scraping, I was still hadn’t tried using Xpath (shame on me). sssscripting blog responded to my article with very good and rich post about all sorts of different techniques for scraping (with Ruby examples) and after reading this post in Kore Nordmann blog I finally decided [...]

In one of my projects, we need to send emails to our suppliers with new orders as Excel spreadsheets. We used to do it by hand, but when you have 10 suppliers and you make 200 products orders per week, after some time you are just tired of creating Excel spreadsheets, mailing them and so [...]

Static images have correct headers – Apache sends them by default. Different story is with all dynamic generating content – if you don’t send correct headers user’s browser will load it every time. It’s not always good, because generated thumbnails doesn’t change every time and should be cached in browser’s cache. If you want to [...]

Sssssssscripting blog yesterday wrote about writing your own web crawler (in Ruby) and I immediately remember that I have done similar projects in past. Only difference is, I had developed web scrappers which were used to monitor e-commerce websites market. Believe me, when you run online shop, having ability to look at rivals prices in [...]

Parallel processes in PHP

February 12th, 2009

When I was coding Ray-Tracer project for my Computer Science studies in university, I ran into using Haskell parallel map function (map calls function for all list elements). Ray-Tracer runs reflections, shadows, ray-casts, etc. detection for every single pixel in scene and since everything is mathematical calculations, it’s paralleling is almost trivial.
Parallel map functions does [...]

Spam-safe email links

February 10th, 2009

There are thousands of ways to protect your email from being read by a spam bot. Complex ones uses images or Flash to display email as graphics, other uses JavaScript to dynamically create email anchors. I always try to use simple and still powerful methods, which both work as expected and are easy to implement, [...]

Versioning is essential for source code control and there is fabulous amount of possible benefits. One of the possibilities is to let your source code know and make decisions using it’s version (revision) number.
For example, if you change your CSS code, you want users to get it immediately and not after their browser cached version [...]

“JavaScript packing” is method for reducing JavaScript files size by removing all unnecessary data (obfuscating) and compressing it’s contents. Most popular is Dean Edward’s packer, which transforms JavaScripts into something like this:

eval(function(p,a,c,k,e,r){…

To start with, it’s very easy to have dynamically packed files (no one wants to pack them by hand, packed versions are only useful [...]

Zend Optimizer and PHP comments

February 4th, 2009

Zend Optimizer is nice product, but I can’t make it work with PHP’s Reflection. Reflection is very good functionality which allows script to read and extract information from it-self’s source code. For example, Zend_XmlRpc_Server component checks functions signatures (which are phpdoc comments) to determine if given parameter(s) is valid type, etc.
I have been using Zend [...]