2012
April 24, 2012
Compile PHP pcntl module on OS X Lion
I had some trouble compiling pcntl PHP module on OS X Lion so I thought I’d share this solution. In fact, you can use these steps to compile any other PHP module.
First download the latest php source from PHP.NET
cd into your php src directory, then:cd ext/pcntl
phpize
./configure --enable-pcntl
When I ran the last step (configure), I got the following error:
‘PHP_FE_END’ undeclared here (not in a function)
To get around the problem, you need to specify your system architecture before configuring your extension:
CFLAGS='-arch x86_64' CXXFLAGS='-arch x86_64' LDFLAGS='-arch x86_64' ./configure --enable-pcntl
Copy compiled modules into PHP extensions:
cp modules/pcntl.so /usr/lib/php/extensions/
Enable the extension:
echo "extension=pcntl.so" >> /etc/php.ini
Marko
TopMarch 14, 2012
MySQL cursors in stored procedures
I’ve wanted to write a few stored procedures in MySQL for a while now, but I found it very fiddly and was unable to come up with one very quickly. Tonight I was determined to read up on MySQL documentation and get one going.
For my reference only, this stored procedure will loop through a recordset and update a single row in a table upon a single row lookup in another table.
DELIMITER // DROP PROCEDURE IF EXISTS sp_test // CREATE PROCEDURE sp_test () BEGIN DECLARE done INT DEFAULT FALSE; DECLARE myid INT; DECLARE cur1 CURSOR FOR SELECT id from table1 WHERE firstname IS NULL; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; OPEN cur1; read_loop: LOOP IF done THEN LEAVE read_loop; END IF; FETCH cur1 INTO myid; UPDATE table1 SET firstname = (SELECT firstname from table2 WHERE id = myid) WHERE id = myid; END LOOP; close cur1; END; //
Once I got the procedure to compile, executing it was as simple as:
call sp_testMarko
TopFebruary 10, 2012
IE6, IE7, IE8, & IE9 on OS X in Virtual Machine
Today I discovered a nice tool on Github which installs free Windows virtual machines using VirtualBox on OS X. The only reason I’d use these virtual machines is to have different versions of Internet Explorer browsers running side by side for testing purposes.
So here’s what you need to do:
1. Download VirtualBox if you don’t have it already.
2. Choose what version of Internet Explorer to install. Then type the following commands in your terminal window:
Install ALL versions of Internet Explorer: IE6, IE7, IE 8, and IE 9curl -s https://raw.github.com/xdissent/ievms/master/ievms.sh | bash
Install Internet Explorer 7 Only
curl -s https://raw.github.com/xdissent/ievms/master/ievms.sh | IEVMS_VERSIONS="7" bash
Install Internet Explorer 8 Only
curl -s https://raw.github.com/xdissent/ievms/master/ievms.sh | IEVMS_VERSIONS="8" bash
Install Internet Explorer 9 Only
curl -s https://raw.github.com/xdissent/ievms/master/ievms.sh | IEVMS_VERSIONS="9" bash
3. Open VirtualBox and launch your virtual machine. You will be prompted to type in account password, which is “Password1″. The password is also in the “Passowd hint” field if you forget it.
Cheers
Top
MarkoJanuary 15, 2012
opendiff and FileMerge on OS X
Today I discovered opendiff tool that’s native to OS X – provided you have installed the Xcode on your system. It allows you to compare 2 directories and perform actions such as merge-left, merge-right etc…
Opendiff simply launches FileMerge OS X utility, which is another one I didn’t know about, and displays differences between 2 selected directories.
The very simple command to compare 2 directories is:
opendiff dir1 dir2
This will then launch FileMerge utility and give you a nice visual representation of differences in your folders:


Marko
Top