Recently I was upgrading my websites on Joomla and moved them to PHP 5.3. I noticed too many errors from mod_slick_rss extension coming to PHP log. I’ve fixed them and added some new options:
- Some new CSS classes to further style layoout
- Ability to sort feeds by date or by their original order in the feed
- Header and footer texts to display before and after the feed
- Ability to output item date in the feed in a given format
You can download updated version here.
Recently I had a task to split a given string at capitalized characters, having those saved in PHP. I’ve invented the following solution:
$str = 'TestMyFuncCall';
var_dump(preg_split('/(?=[A-Z])/', $str, null, PREG_SPLIT_NO_EMPTY));
The result is:
I utilize regular expressions assertions here to avoid character loss.
Some evening I was implementing behavorial patterns in my framework’s ORM and I desperately needed something like Ruby mixin or C# extension method or like trait/graft in PHP6+. So I was curious to see how can I implement mixins in PHP. If you don’t know what mixin is, I will tell you at once.
So, I invite you to follow me on paths to implementing mixins in PHP and programming a small library to support them. This article targets beginner and average level programmers. Just be sure you know what OOP is. During the process, I will also make some small mistake about nuances of PHP 5.3 work with classes, will point to it and suggest my solution to it. Good reading!
Continue reading “Practising OOP in PHP5: emulating mixins (Ruby-like)”
Having installed Munin recently on my servers, I started to get emails from cron saying
Fatal error: Could not open "/var/lib/munin/datafile" for writing: Permission denied at /usr/lib/perl5/vendor_perl/5.8.8/Munin.pm line 727.
(process:18039): Pango-WARNING **: Invalid UTF-8 string passed to pango_layout_set_text()
I also got some errors about /var/log/munin/munin-update.log being inaccessible. Somehow these files does not belong to munin:munin, but to rrdcache:rrdcache, so the solution is just to make them chmod 0777 and that should solve the problem.