ABN 25 173 915 011 markomedia - web development

markomedia - web development

  • Home
  • Contact
  • Blog

2012

  • markomedia
    • 2012
Share |
  • April 24, 2012

    Compile PHP pcntl module on OS X Lion

    Author
    Marko Tomic

    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

    Top
  • March 14, 2012

    MySQL cursors in stored procedures

    Author
    Marko Tomic

    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_test

    Marko

    Top
  • February 10, 2012

    IE6, IE7, IE8, & IE9 on OS X in Virtual Machine

    Author
    Marko Tomic

    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 9

    curl -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
    Marko

    Top
  • January 15, 2012

    opendiff and FileMerge on OS X

    Author
    Marko Tomic

    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:
    FileMerge
    FileMerge

    Marko

    Top

    Navigation

    • Home
    • Contact
    • Blog

    Archives

    • April 2012
    • March 2012
    • February 2012
    • January 2012
    • December 2011
    • November 2011
    • October 2011
    • September 2011
    • August 2011
    • July 2011
    • May 2011
    • December 2010
    • October 2010
    • September 2010
    • August 2010
    • July 2010
    • June 2010
    • May 2010
    • April 2010
    • February 2010
    • January 2010
    • December 2009
    • November 2009
    • October 2009

    From the blog

    • Compile PHP pcntl module on OS X Lion

    • MySQL cursors in stored procedures

    • IE6, IE7, IE8, & IE9 on OS X in Virtual Machine

    • opendiff and FileMerge on OS X

    • Bandwidth throttling on OS X

    About us

    Marko Tomic - Web professional and an Adobe Certified Expert with over 10 years of commercial experience using variety of technologies.

    Connect

    Facebook icon Twitter icon Email icon RSS icon