CDN is abbreviation for Content Delivery Network. Hard to believe that like 5 years ago it sounded like a rocket science in WWW. Only huge sites were able to afford it and configure it right. Now things have completely changed and today’s question is: Why you still do not use CDN for your site or blog?

Because of the W3 Total Cache plugin, setting up a CDN for WordPress based site is criminally simple. Thats another one cent in my love WordPress topic. If your website receives more than a few hundred visitors a month, or if your site makes visitors download a lot of data (images, self-hosted javascripts, flash files, etc.), this is a great setup.

There’s also an SEO benefit in using a CDN…at least indirectly. Faster sites get more traffic from Google and Bing than slower sites. By making your site faster, you increase the likelihood Google will refer people to your site.
Continue reading

WordPress has its own cron job implementation that allows you to schedule your posts and events. It was done in a way to be simple and it works in most cases.

WP-Cron is not a real cron job, it only works when a page is loaded. When a page is requested, it will then check the database to see if there is anything scheduled and after displays to your reader.

However, in some situations, the WP-Cron does not work well and this leads to posts that missed publication schedule and events not executed.  May be you have seen the “Missed Schedule” status.

Continue reading

Its right from UI design point of view to show user some kind of progress in case site or application is busy with some internal processing. Especially with AJAX requests, because they take time!

In jQuery its very easy to hook all AJAX requests into one start/stop functions, so there is no need to show and hide progress indicator on each $.ajax request.

I make usage of nice spin.js library, native JavaScript implementation of configurable spinner.

Continue reading

ImageMagic library not without reason is called magic, it can handle image operations like scale,resize,rotate,filter,clip and 1000+ others.

PDF -> JPEG

Here is simple CLI command to extract one page from PDF file and save it as JPEG image

convert -density 300 doc.pdf[160] page.jpg

Where

  • 300 is DPI, more better quality
  • [160] is page number, starting from zero. Can be list [0,1,2] or range [1-10]
  • page.jpg is output file, image type is based on extension

Easy!

Continue reading

CodeIgniter is great framework by its simplicity. But when I moved from CakePHP, I really missed layout pattern.

CodeIgniter documentations offers this way to include non-changing site header and footer

$this->load->view('header');
$this->load->view('template'); 
$this->load->view('footer');

For sure it isn’t flexible and does not show page structure in a clear way. For many years I use layout pattern. Layout describes whole page as a template with blocks for header, menu, content, etc like on figure below. On page rendering these blocks are filled with data.

I found a small code snipped for CI and improved it. You are welcome to try!

Continue reading

Quite often there is a need to parse HTML and extract some values from deep-deep nested tables or so. Most front solution is to use regular expressions but they sucks with nested tags. Other way is to use XPath, which performs much better here, but has not simple syntax to use.

Nowadays almost all PHP developers knows jQuery, which became like a standard in front-end development. Why not to use it for HTML parsing using familiar syntax.

Continue reading