Having an ADC-select account, I have access to the latest release builds of Tiger.
On Easter-Sunday, I decided to do something usefull with my tiger-seed and downloaded the Dashboard SDK.
Being used to PHP, it took some frustrating tries with javascript, but some hours later I was looking at my first widget.
It basically uses Curl to fetch PHP generated content over a HTTPS connection.
Shown are the last five lines of a access-log from a webapplication.
It works like a charm and refreshes every time dashboard shows up, or with the command+r keycombo.
If Tiger is released and the NDA is lifted, I’ll probably post the widget for download…untill then, some screenshots:

the front, some content blurred for privacy reasons

and the backside, i simply love the animation :)
Posted by:
Merlijn on Tuesday, 29 of March , 2005 at 17:25
Tags:
dashboard,
PHP,
widget Categories:
Coding,
OS X
Comments:
be the first (opens in a pop-up window)
Add this post to
del.icio.us or
digg it
With the latest discovery of some remote vulnerabilities in mysql and PHP, I had to upgrade my production server.
And to be clear, I don’t like updates.
Esp. not on mission critical apps. Updates tend to break things, you see:)
But running php 4.3.6 and mysql 4.0.20 was getting…unwise.
Upgrading PHP is easy, with the (imho) great installer of entropy.ch.
installer -verboseR -pkg ~/php-4.3.10.pkg -target /
Don’t forget afterwards to restore your httpd.conf and to edit /usr/local/php/httpd.conf.php to add:
AddType application/x-httpd-php .php
AddType application/x-httpd-php .html
AddType application/x-httpd-php-source .phps
MySQL is somewhat more tricky.
The version supplied by Apple is well…historic.
I like to compile MySQL from source (esp. because that takes 8,5 minute on my Xserve :) and install it to /usr/local/mysql-(version).
After that I create a symlink from /usr/local/mysql-(version) to /usr/local/mysql.
Take some care replacing the apple supplied mysql-binaries with symlinks to the up2date /usr/local/mysql/bin/ counterparts.
After this, upgrading mysql from source is painless.
The most recent upgrade:
# cd /usr/local/src
# gnutar -xzvf mysql-4.1.10a.tar.gz
# cd mysql-4.1.10a
# ./configure --with-openssl \
--prefix=/usr/local/mysql-4.1.10_a \
--localstatedir=/usr/local/mysql-4.1.10_a/data\
--mandir=/usr/local/share/man/\
--with-mysqld-user=mysql
# make
# make install
# cd /usr/local/
# mysqladmin -u root -p shutdown
# cp -R mysql/data mysql-4.1.10_a/data
# chown -r mysql:wheel mysql-4.1.10_a/data
# ln -s /usr/local/mysql-4.1.10_a /usr/local/mysql
# mysqld_safe &
That’s all. If something goes wrong, just restore the symlink to the “old” mysql-(version) and you’re safe.
Be aware of the new password hashing mysql uses from 4.1.1 of. I used the –old-password switch untill I’ve upgraded all my clients.
Posted by:
Merlijn on Sunday, 13 of March , 2005 at 15:57
Tags:
MySQL,
PHP Categories:
OS X
Comments:
be the first (opens in a pop-up window)
Add this post to
del.icio.us or
digg it
This took me some time this morning.
For a secured part of a website I made up a log of both succesfull as failed logins.
I wanted to output the last 20 or so lines, for displaying those on a helpdesk page.
I came up with the following solution and I think it’s a elegant one:
1 <?php
2 $logbuffer = `tail -n 10 /path/to/somelog.log`;
3
4 $log_array = explode(“\n”, $logbuffer);
5
6 foreach ($log_array as $logline) {
7 if (!$logline == ”) {
8 if (ereg(‘error’, $logline)) {
9 echo “<span class=’error’>”.$logline.“</span><hr />”;
10 }
11 else {
12 echo “<span class=’ok’>”.$logline.“</span><hr />”;
13 }
14 }
15 }
16 ?>
17
Posted by:
Merlijn on Friday, 11 of March , 2005 at 20:52
Tags:
PHP Categories:
Coding
Comments:
be the first (opens in a pop-up window)
Add this post to
del.icio.us or
digg it