I needed to create a script that runs a regression test. I intended to schedule this with a cron job. However, I found that sometimes, my cron jobs would collide with each other.
So, I looked to Linux’ lockfile command to create a file lock as a semaphore.
Here’s the incantation:
[cc_bash]
# if we’re already running, exit
if ! lockfile -r 0 regression.lock; then
echo “regression.sh already running in area $1”
exit 1
fi
./tools/regression.py
rm -f regression.lock
[/cc_bash]
In this case, lockfile is set with a retry count of 0 -r 0. However, I can chose to make this a retry of 1000 (for example).
One can specify a timeout period (for example 60 seconds) with -s 60. Note, however, that this timeout period starts when the lockfile was last modified/created, and it forces the removal of the lockfile. This helps prevent zombie processes that were killed before they could remove their lockfile.
The default vim has a matchpairs option which matches pairs of single bytes.
However, I have a file which has a lot of nested conditions, and the language requires begin/end pairs for multi-line conditionals. I know I have more begin statements than end statements. So, I need help from vim in matching these up.
As it turns out, there’s a matchit macro in $VIMRUNTIME/macros that lets you extend the % command to match more complex expressions (including regular expressions). It also exists here. Install instructions are included on the vim.org page. Basically, you unzip in your ~/.vim directory and then and run a helptags command.
I’ve been thinking about building an ATOM-based dual-core PC for a while now.
I have the portwell single-core, but I’ve been thinking it might be fun (sort of) to build an enclosed system with a dual-core ATOM, power supply, and a few USB hard drives (because I already have them, that’s why). I’d take a page (pun intended) from the book of Google and enclose the system using Lego blocks.
I got the Buffalo WHR-HP-GN. I have it sitting around 10 feet away from my HP PC and it’s connected to my router using 100 Mb/s Ethernet. I just ran a speed test using TTCP, and I get from 2674 KB/s to 3700 KB/s. So, I’m doing about 10x better. Of course, the Linksys is sitting considerably farther away from the HP PC than the Buffalo is. However, 1) the Linksys can’t act as an access point, so it can’t work where the Buffalo is, and 2) I’ve now fixed the problem and don’t care to move routers around.
Original Post
I’ve had it with my Linksys. I’ve run two performance tests using TTCP. I generally run the receiver on my FreeBSD machine (for which a port exists). From my gigabit wired Dell Desktop (circa 2004) I get 30830 KB/s throughput. However, from my late-2009 model HP Desktop connected via 802.11n, I only get 365 KB/s. You read that right. I’ve noticed that the wireless drops down to 13 MBps when the computer is actually doing something; otherwise, it claims a 135 Mbps connection.
This could be the HP’s 802.11n card, but I have a feeling it is the WRT110N router. Besides, I’m pretty pissed that Linksys’ latest firmware has an advertising service (when a site doesn’t exist, it points you at a ad/search page). In the case of the WRT110N, you cannot disable it.
So, I’m looking around for a new router. After a hiatus, Buffalo is back on the market. I’m looking at their plethora of 802.11n offerings. The $90 WZR-HP-G300NH has 64 MB of ram and 32 MB of flash available. It also has a USB port for NAS if I want that. The other option would be to use my old Linksys WRT with Tomato or something (and disable wireless on it) and buy a cheaper Buffalo 802.11n to use as an access point.
The fourth option which I’m seriously contemplating is to run gigabit cable around my house (literally on the outside), through the attic, and to the HP computer. However, when I add up two cables (12.50 each) and a gigabit router ($35), I end up at $60, which isn’t that much away from the wireless router (and it saves me having to tool around the attic, which is definitely worth $30 to me). Plus, there’s also a Wii next to the HP that needs wireless anyway.
I’m looking at the $60 WHR-HP-G300N and the $40 WHR-HP-GN. Both of these are dd-wrt compatible. However, it seems that the G300N doesn’t support WDS. So, it looks like the WHR-HP-GN is the best value. I can spend $50 more to get the WZR-HP-G300NH, but I don’t think the extra RAM, USB, and gigabit Ethernet ports are worth it.
I’ve been a fan of TiddlyWiki for a long time now. It’s an HTML file that contains self-editing powers. You download this file, load it in your web browser, and it presents a note-taking application where the notes are stored within that same HTML file (very portable).
I really like this functionality, but I’d like to have it stored somewhere central (a web server for example), so that I don’t have to worry about syncing this file. From looking around, it seemed like TiddlyWeb was a good (albeit possibly over-kill) solution. It works as a server-side TiddlyWiki implementation, but it’s more general: it presents an API that can manage general blobs of information (tiddlers). I got this set up.
Unfortunately, it’s got some database error (at least with FreeBSD 8 + MySQL). Every time I add a catalog (my eMusic collection for example), it cuts out at 95 songs. (I have over 1000 songs in my eMusic folder.)
Guess I’ll wait until it’s release ready.
Don’t get me wrong: I love the work the ampache folks are doing. I just want to document for myself why I stopped attempting to use the svn trunk of Ampache.
I’d rather run nginx and PHP5-FPM on my FreeBSD machine (to server Ampache). I’m not sure if this is possible, but I figured it’s worth a try. The idea is to use less memory and speed things up. apparently, when you use mod_php in Apache, it means that Apache loads php for every request. It’s apparently better to use FastCGI with Apache. In this case, I’d like to replace Apache with NginX, for which I need the FPM (FastCGI process manager) patch of PHP.
There’s a FreeBSD port, but it’s not in the official FreeBSD ports collection.
> cd /usr/ports/lang
> sudo wget http://php-fpm.org/downloads/freebsd-port/php-5.2.10-fpm-0.5.13.tar.gz
> sudo tar zxvf php-5.2.10-fpm-0.5.13.tar.gz
x php5-fpm/
x php5-fpm/files/
x php5-fpm/Makefile
x php5-fpm/distinfo
x php5-fpm/pkg-descr
x php5-fpm/pkg-plist
x php5-fpm/files/php-fpm.sh.in
x php5-fpm/files/patch-scripts::phpize.in
x php5-fpm/files/patch-TSRM_threads.m4
x php5-fpm/files/patch-Zend::zend.h
x php5-fpm/files/patch-Zend_zend_list.c
x php5-fpm/files/patch-Zend_zend_list.h
x php5-fpm/files/patch-ext_standard_array.c
x php5-fpm/files/patch-ext_standard_basic_functions.c
x php5-fpm/files/patch-ext_standard_dns.h
x php5-fpm/files/patch-ext_standard_image.c
x php5-fpm/files/patch-php.ini-dist
x php5-fpm/files/patch-php.ini-recommended
x php5-fpm/files/patch-main::php_config.h.in
x php5-fpm/files/patch-main_SAPI.c
x php5-fpm/files/patch-acinclude.m4
x php5-fpm/files/patch-configure.in
I’m not sure what zend multibyte nor what mail header patch are, but I figured it can’t hurt much to get them.
I got a bunch of warnings that look like
ext/pdo_pgsql/config.m4:108: warning: AC_CACHE_VAL(pdo_inc_path, …): suspicious cache-id, must contain _cv_ to be cached
ext/pdo_pgsql/config.m4:108: the top level
I ignored them (for now).
After that was done, I deinstall’ed my previous php5:
cd ../php5
sudo make deinstall
===> Deinstalling for lang/php5
===> Deinstalling php5-5.3.2
pkg_delete: package ‘php5-5.3.2′ is required by these other packages
and may not be deinstalled (but I’ll delete it anyway):
php5-mysql-5.3.2
php5-session-5.3.2
php5-iconv-5.3.2
ampache-3.5.4
php5-exif-5.3.2
pecl-fileinfo-1.0.4
php5-filter-5.3.2
php5-gd-5.3.2
php5-hash-5.3.2
php5-imap-5.3.2
php5-json-5.3.2
php5-mbstring-5.3.2
php5-mcrypt-5.3.2
php5-openssl-5.3.2
php5-pdo-5.3.2
php5-pdo_sqlite-5.3.2
php5-posix-5.3.2
php5-simplexml-5.3.2
php5-sqlite-5.3.2
php5-tokenizer-5.3.2
php5-xml-5.3.2
php5-xmlreader-5.3.2
php5-xmlwriter-5.3.2
php5-extensions-1.4
php5-zlib-5.3.2
[preparing module `php5’ in /usr/local/etc/apache22/httpd.conf]
I then went back and install’ed php with fpm:
> cd php5-fpm
> sudo make install
Unfortunately, a php-cgi –v failed with:
PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/local/lib/php/20060613/bz2.so’ – Cannot open “/usr/local/lib/php/20060613/bz2.so” in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/local/lib/php/20060613/ctype.so’ – Cannot open “/usr/local/lib/php/20060613/ctype.so” in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/local/lib/php/20060613/dom.so’ – Cannot open “/usr/local/lib/php/20060613/dom.so” in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/local/lib/php/20060613/mysql.so’ – Cannot open “/usr/local/lib/php/20060613/mysql.so” in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/local/lib/php/20060613/session.so’ – Cannot open “/usr/local/lib/php/20060613/session.so” in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/local/lib/php/20060613/iconv.so’ – Cannot open “/usr/local/lib/php/20060613/iconv.so” in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/local/lib/php/20060613/exif.so’ – Cannot open “/usr/local/lib/php/20060613/exif.so” in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/local/lib/php/20060613/fileinfo.so’ – Cannot open “/usr/local/lib/php/20060613/fileinfo.so” in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/local/lib/php/20060613/filter.so’ – Cannot open “/usr/local/lib/php/20060613/filter.so” in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/local/lib/php/20060613/gd.so’ – Cannot open “/usr/local/lib/php/20060613/gd.so” in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/local/lib/php/20060613/hash.so’ – Cannot open “/usr/local/lib/php/20060613/hash.so” in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/local/lib/php/20060613/imap.so’ – Cannot open “/usr/local/lib/php/20060613/imap.so” in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/local/lib/php/20060613/json.so’ – Cannot open “/usr/local/lib/php/20060613/json.so” in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/local/lib/php/20060613/mbstring.so’ – Cannot open “/usr/local/lib/php/20060613/mbstring.so” in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/local/lib/php/20060613/mcrypt.so’ – Cannot open “/usr/local/lib/php/20060613/mcrypt.so” in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/local/lib/php/20060613/openssl.so’ – Cannot open “/usr/local/lib/php/20060613/openssl.so” in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/local/lib/php/20060613/pdo.so’ – Cannot open “/usr/local/lib/php/20060613/pdo.so” in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/local/lib/php/20060613/pdo_sqlite.so’ – Cannot open “/usr/local/lib/php/20060613/pdo_sqlite.so” in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/local/lib/php/20060613/posix.so’ – Cannot open “/usr/local/lib/php/20060613/posix.so” in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/local/lib/php/20060613/simplexml.so’ – Cannot open “/usr/local/lib/php/20060613/simplexml.so” in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/local/lib/php/20060613/sqlite.so’ – Cannot open “/usr/local/lib/php/20060613/sqlite.so” in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/local/lib/php/20060613/tokenizer.so’ – Cannot open “/usr/local/lib/php/20060613/tokenizer.so” in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/local/lib/php/20060613/xml.so’ – Cannot open “/usr/local/lib/php/20060613/xml.so” in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/local/lib/php/20060613/xmlreader.so’ – Cannot open “/usr/local/lib/php/20060613/xmlreader.so” in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/local/lib/php/20060613/xmlwriter.so’ – Cannot open “/usr/local/lib/php/20060613/xmlwriter.so” in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/local/lib/php/20060613/zlib.so’ – Cannot open “/usr/local/lib/php/20060613/zlib.so” in Unknown on line 0
This is because the version of php5-extensions was built with php 5.3. So, I had to deinstall and reinstall it. Unfortunately, the php5-extensions port somehow got unsynchronized from the individual extensions. So, I had to manually deinstall and reinstall. In this case, I used pkg_delete to deinstall:
Curiously, php52-extensions didn’t work. Instead, I got:
> cd php52-extensions/
> sudo make install clean
Password:
===> php52-extensions-1.3 cannot install: doesn’t work with PHP version : 5 (Doesn’t support PHP 4 5).
*** Error code 1
Stop in /usr/ports/lang/php52-extensions.
Somehow, php5-extensions seems to be working. I’m crossing my fingers that I’m not mixing versions of php (5.2 vs 5.3). I’ll keep you posted when the build is finished…
… Nope, didn’t work. I’ll probably go back to plain old PHP5:
/usr/ports/textproc/php5-dom/work/php-5.3.2/ext/dom/attr.c: In function ‘zim_domattr___construct’:
/usr/ports/textproc/php5-dom/work/php-5.3.2/ext/dom/attr.c:65: error: ‘zend_error_handling’ undeclared (first use in this function)
/usr/ports/textproc/php5-dom/work/php-5.3.2/ext/dom/attr.c:65: error: (Each undeclared identifier is reported only once
/usr/ports/textproc/php5-dom/work/php-5.3.2/ext/dom/attr.c:65: error: for each function it appears in.)
/usr/ports/textproc/php5-dom/work/php-5.3.2/ext/dom/attr.c:65: error: expected ‘;’ before ‘error_handling’
/usr/ports/textproc/php5-dom/work/php-5.3.2/ext/dom/attr.c:67: error: ‘error_handling’ undeclared (first use in this function)
*** Error code 1
1 error
*** Error code 1
Stop in /usr/ports/textproc/php5-dom.
*** Error code 1
Stop in /usr/ports/lang/php5-extensions.
*** Error code 1
Stop in /usr/ports/lang/php5-extensions.
… Or, I’ll install using the individual ports for each of the php52 extensions.
AAC+ (also called HE-AAC) is a method to lower the bit rate of AAC (LC-AAC) while maintaining the audio fidelity. There’s a really good paper from the makers of AAC+ here.
Seeing how I just set up ampache, and I have low upstream bandwidth, I decided to get AAC+ going. It was a little bit tricky, but works very well now.
For a while, I’ve been wondering when Apple will finally ditch the put-storage-in-the-iPod-and-sync-to-your-computer model and just let you keep a library of music in the cloud and stream it. I thought that day was here when Apple bought Lala. It hasn’t come. (Yet.)
For a long time, I’ve been using my 8GB nano and using smart playlists to let the computer figure out which songs should be on there. It worked fine. Now, I have an embarrassment of riches with a 16GB Palm Pre Plus.
Except, due to a few years of eMusic and an addiction to AmieStreet, I still have way more music than I can fit on it. Remember: the smart playlist thing only works if you can rate songs. I tried out MediaMonkey and DoubleTwist. They worked okay, except neither one seemed to have smart playlists. Even if they did, there really wasn’t a way to rate songs on the Pre and have it notify MediaMonkey/DoubleTwist of the new ratings, so that I could create a smart playlist that would favor me (i.e. favor songs that I like).
For a while, I’ve noticed a Palm Pre app called Ampache Mobile. I shrugged it off as the usual tech rabbit-hole that I go down, where I spend months trying to figure something out and it never works.
Except, this time it worked, and very well, I might add.
If you have a lot of files you’re not going to check in, git’s default behavior of showing untracked files can get cluttersome (new word I just made up).
Doing the following suppresses this behavior:
git config status.showUntrackedFiles no
In the git-config man page, it shows it as case-sensitive, but I tried it all lowercase and it works.
Now, by default, git status won’t show untracked files. You can show untracked files with a -u switch. Git thoughtfully lets you know this possibility with a line at the end of the status output.