iWatch is a perl script that uses inotify to monitor files directories. It’s similar to the watch tool, which can do all sorts of stuff if the files or directories it’s watching are modified or affected in pretty much any way at all.
Install iWatch
apt-get install iwatch
I’ve got this 1 liner in a file to quickly watch my directory and execute a PHP unit test .
#!/bin/bash iwatch -c "phpunit $1" -t '.
php
- I’ve run into a ton of issues working with crons, mostly with the $PATH variable screwing things up. Scripts work when run manually on the command line, but fail when run in cron. Very annoying. I’ve asked a bunch of Linux sys admins how to fix this - and the answer is always “put the full path in your scripts” which to me in unacceptable as it introduces the possibility of human error.
- I’m using PHP53 package from the IUS Community repository. I’ve been trying to get phpunit to install, but it gives an error that it needs DOM install. It took me a little bit to figure this out, but I finally got it working. What you need is the php53-xml package. You can install it using yum install php53-xml or if you’re using puppet package { ["php53-xml"]: ensure => present } And finally, to get it to install, I used the below.
- So, lets assume you’ve got a PHP project where you’re scraping pages and trying parse fields out of the DOM. Up till now, I’ve just used regular expressions because they’re easy. I avoided trying to parse html as xml using SimpleXML because there’s just to many cases where it would fail due to invalid tags. Well, I feel like an idiot. It turns out there’s a great extension built into PHP to do just that, and it’s the DOM extension.
- PHP Quick Profiler This looks like a pretty cool tool to get a good idea of what’s going on in your PHP script without having to install tools like XDebug and Webgrind / KCacheGrind. Apple files patent for browser specific volume I’m not sure how this is anything new, tons of applications have their own volume setting. Quicktime, VLC, Windows Media Player. Chris DeWolfe bails as MySpace CEO Doesn’t seem like such a bad idea to get out now.
- Here’s a quickie - make sure every PHP file in your project parses correctly. find . -name ‘*.php’ -exec php -l {} \; | grep “Errors parsing”
- I’ll keep it short. In the last few days, login on our dev server broke. We hadn’t changed anything related to it, and everything looked good code wise. What we finally figured out was that our session cookie was set to expire 2 days into the future, and our VMWare image had lost 2 days of time. Fix by doing the following: ntpdate ntp.nasa.gov > /dev/null
- I got this today. Solved by restarting the Memcached server. Move along. Edit: this is actually a reoccurring bug we’re seeing with the memcache 2.2.3 stable build on 2 different boxes 2nd Edit: Actually it was a bug in my code. I wasn’t setting the server and ip correctly, there was a typo in my configuration
- If you do any work with single sign on, you’ll be familiar with the concept of exchanging tokens and validating against the authentication server using that token. One of the issues I’ve just run into which resulted in a huge headache is with urlencoding the result of a curl_exec that had a line ending. It’ easy to miss when it’s a longer string and you aren’t paying very close attention. This is a very simple example, and it still takes a second to realize there’s an extra character at the end.
- Let’s get one thing out in the open. Curl is sweet. It does it’s job very well, and I’m absoutely thrilled it exists. If you’re using curl in your PHP app to make web requests, you’ve probably realized that by doing them one after the other, the total time of your request is the sum of all the requests put together. That’s lame. Unfortunately using the curl_multi_exec is poorly documented in the PHP manual.