<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/1.5.1-alpha" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
>

<channel>
	<title>Woshiadai Dev Notebook</title>
	<link>http://woshiadai.blogsome.com</link>
	<description>happy coding ;-)</description>
	<pubDate>Wed, 11 Nov 2009 18:17:18 +0000</pubDate>
	<generator>http://wordpress.org/?v=1.5.1-alpha</generator>
	<language>en</language>

		<item>
		<title>set up PHP and Apache on Snow Leopard</title>
		<link>http://woshiadai.blogsome.com/2009/11/11/set-up-php-and-apache-on-snow-leopard/</link>
		<comments>http://woshiadai.blogsome.com/2009/11/11/set-up-php-and-apache-on-snow-leopard/#comments</comments>
		<pubDate>Wed, 11 Nov 2009 07:39:09 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
		
	<category>PHP</category>
	<category>Mac</category>
		<guid>http://woshiadai.blogsome.com/2009/11/11/set-up-php-and-apache-on-snow-leopard/</guid>
		<description><![CDATA[	It took me quite some trouble to get imagick working on the snow leopard.&nbsp;
	First, I tried to install xampp and mamp, which are two easy ways to get PHP, apache, mysql up and running. I used to have no issue with xampp, but the snow leopard has problems with locally complied imagick.so in xampp. So, [...]]]></description>
			<content:encoded><![CDATA[	<p>It took me quite some trouble to get imagick working on the snow leopard.&nbsp;</p>
	<p>First, I tried to install xampp and mamp, which are two easy ways to get PHP, apache, mysql up and running. I used to have no issue with xampp, but the snow leopard has problems with locally complied imagick.so in xampp. So, I tried mamp as well, imagick simply does not work and kept getting me &quot;cannot find Imagick class&quot; error.</p>
	<p>So, I had to try to use the PHP and apache that ships with snow leopard. I simply followed the instructions in <a href="http://blog.xeonxai.com/category/tools/apache/" target="_blank">this blog post</a> and it worked out well for the most part. </p>
	<p>The only problem I am having is with the userdir apache module. Using the userdir module, you can just drop web applications to /Users/&lt;username&gt;/Sites. But no matter how hard I tried, I just could not get this working and had to give up.</p>
	<p>UPDATE: found <a href="http://www.macosxhints.com/article.php?story=200906100223537" target="_blank">this post</a> saying the permission denied problem is related to the user permission of _www. Apache runs as _www under _www group that need to have access to /Users/&lt;username&gt;/Sites. I&#8217;ve added xr to everyone on that directory, not sure why it is still not working. If you want to give it a try you can do it.&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://woshiadai.blogsome.com/2009/11/11/set-up-php-and-apache-on-snow-leopard/feed/</wfw:commentRss>
	</item>
		<item>
		<title>upgrading to snow leopard</title>
		<link>http://woshiadai.blogsome.com/2009/10/31/upgrading-to-snow-leopard/</link>
		<comments>http://woshiadai.blogsome.com/2009/10/31/upgrading-to-snow-leopard/#comments</comments>
		<pubDate>Sat, 31 Oct 2009 04:58:07 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
		
	<category>Apple</category>
	<category>Mac</category>
		<guid>http://woshiadai.blogsome.com/2009/10/31/upgrading-to-snow-leopard/</guid>
		<description><![CDATA[	Finally, I decided to do the upgrade. It was not as smooth as it looks, especially that I turned on 64 bit as default. Normally, SL runs in 32 bit mode, you need to hold 6 and 4 keys during the boot process to get into 64 bit mode. But you can also change the [...]]]></description>
			<content:encoded><![CDATA[	<p>Finally, I decided to do the upgrade. It was not as smooth as it looks, especially that I turned on 64 bit as default. Normally, SL runs in 32 bit mode, you need to hold 6 and 4 keys during the boot process to get into 64 bit mode. But you can also change the config to run it as default, instruction is <a href="http://www.overclock.net/mac/564147-how-enable-64-bit-default-os.html" target="_blank">here</a>.</p>
	<p>Most of the applications still runs fine, here is a few exceptions that I encountered and luckily all of them have solutions so far. <a href="http://snowleopard.wikidot.com/" target="_blank">Here</a> is a list of compatibility check for SL, note that it is not the default 64 bit mode.&nbsp;</p>
	<p>1. menumeter: This is a small monitoring tool that I use every day, to check network, CPU, memory usage. Good thing is it displays info on the menu bar. Old installation not working anymore, just <a href="http://snowleopard.wikidot.com/" target="_blank">get the latest</a> and reinstall.</p>
	<p>2. delicioussafari: This is a plugin for Safari that saves and opens your delicious online bookmarks. To fix the issue, just <a href="http://delicioussafari.com/" target="_blank">get the latest and reinstall</a>. The new version even has a new BMW-like button <img src='http://woshiadai.blogsome.com/wp-images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> &nbsp;</p>
	<p>3. macfuse: This is a handy tool to help mount various file systems. Here is <a href="http://rackerhacker.com/2009/08/28/fix-macfusion-on-snow-leopard/" target="_blank">the fix for 32 bit SL mode</a>, however it did not work for 64 bit mode. You can use <a href="http://groups.google.com/group/macfuse/msg/f7de55623e8b8f57?" target="_blank">this pre-compiled dmg</a> for 64 bit mode. It runs great for me. You can also roll your own following the instructions <a href="http://www.5dollarwhitebox.org/drupal/node/97" target="_blank">here</a>.</p>
	<p>4. TextMate: It has <a href="http://wiki.macromates.com/Troubleshooting/SnowLeopard" target="_blank">lots of issues</a> with SL, especially due to the upgrade of Ruby. First, try to get the latest release possible. But still, I am having issues with&nbsp;<span class="Apple-style-span">⌘R. </span>Textmate blog has some workarounds and I have not tried them yet, hopefully they will fix the problems in the next release.</p>
	<p>5. MacPorts: This is another thing that caused many headache until I found <a href="http://www.libertypages.com/clarktech/?p=743" target="_blank">this nice blog</a> that suggests a fresh install. It worked all fine. However, occasionally, some ports will still report error of unmatched architecture. This blog also covers &quot;Upgrading to Snow Leopard Part 1 to 7&quot;, talking about <a href="http://www.libertypages.com/clarktech/?p=719" target="_blank">python</a>, <a href="http://www.libertypages.com/clarktech/?p=751" target="_blank">mysql</a> and other upgrade <a href="http://www.libertypages.com/clarktech/?p=736" target="_blank">tips</a>, very handy! He also talks about <a href="http://www.libertypages.com/clarktech/?p=777" target="_blank">building 32 bit packages using arch and lipo</a>.</p>
	<p>6. VMWare Fusion: The old 2.x version even won&#8217;t start in 64 bit and asks you to restart SL in 32 bit. So, you need to get the latest <a href="http://www.vmware.com/products/fusion/" target="_blank">Fusion 3.0</a>. The upgrade is not free.</p>
	<p>After a week of being little white mouse running 64 bit SL. I&#8217;d say maybe running 64 bit does cause more issues than benefits. But we can debate over it. <a href="http://arstechnica.com/apple/reviews/2009/08/mac-os-x-10-6.ars/5" target="_blank">Here</a> is a good intro if you are interested.</p>
	<p>The best part for me is that I got back 12G free space, very interesting. It seems to be a combination of using 1000 for 1024 in calculation and cut the new OS installation size.</p>
	<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://woshiadai.blogsome.com/2009/10/31/upgrading-to-snow-leopard/feed/</wfw:commentRss>
	</item>
		<item>
		<title>Subversion and SSH setup in Netbeans 6.7 RC3 on Mac OS X</title>
		<link>http://woshiadai.blogsome.com/2009/06/26/subversion-setup-in-netbeans-67-rc3/</link>
		<comments>http://woshiadai.blogsome.com/2009/06/26/subversion-setup-in-netbeans-67-rc3/#comments</comments>
		<pubDate>Fri, 26 Jun 2009 06:18:13 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
		
	<category>Java</category>
	<category>PHP</category>
	<category>Apple</category>
	<category>Mac</category>
		<guid>http://woshiadai.blogsome.com/2009/06/26/subversion-setup-in-netbeans-67-rc3/</guid>
		<description><![CDATA[	Netbeans has been making a lot of progress since version 6 and the latest 6.7 RC3 is even better. For those Eclipse fans, I strongly suggest that you check out Netbeans. It feels much faster and consumes less memory. The plugins are more organized and easy to manage (I think the plugin management in Eclipse [...]]]></description>
			<content:encoded><![CDATA[	<p>Netbeans has been making a lot of progress since version 6 and the <a href="http://download.netbeans.org/netbeans/6.7/rc/">latest 6.7 RC3</a> is even better. For those Eclipse fans, I strongly suggest that you check out Netbeans. It feels much faster and consumes less memory. The plugins are more organized and easy to manage (I think the plugin management in Eclipse is really messy).</p>
	<p>The PHP plugin for Netbeans is out of beta and it is quite user friendly and versatile. So, I decided to switch from PDT to Netbeans for my PHP development.</p>
	<p>Netbeans comes with Subversion support. However, it is not so smooth to set up Subversion over SSH on Mac OS X due to the ssh-askpass problem. This is a Mac OS X issue, not a Netbeans issue. </p>
	<ol>
	<li>Download and install Netbeans 6.7 RC3 (as of June 25, 2009).
</li>
	<li>The subversion that comes with Mac OS X (/usr/bin/svn, 1.4.4 (r25188)) is quite outdated and it has problems working with newer versions of the SVN server, probably due to different format of the metadata. You need to use MacPorts to install a more recent subversion (if you don&#8217;t know how to install MacPorts, check out <a href="http://www.macports.org/install.php">this</a>). Just type this in your terminal: <code>port install subversion</code>, it might take a white. The subversion from MacPorts is installed in /opt/local/bin, so make sure you put /opt/local/bin before /usr/bin in your PATH environment variable.
</li>
	<li>Add SVNROOT and SVN_SSH environment variables to your .bashrc:<br />
<code><br />
export SVNROOT=svn+ssh://your_svn_server/<br />
export export SVN_SSH=/usr/bin/ssh<br />
</code>
</li>
	<li>Launch Netbeans, go to preferences->Miscellaneous->Versioning->Subversion, for &#8220;path to SVN executable file&#8221;, enter /opt/local/bin
</li>
	<li>Now, it seems like everything is ready. However, when you try to do update/diff and other operations, you get error: ssh_askpass: exec(/usr/libexec/ssh-askpass): No such file or directory. I did some Yahoo! search and the problem is that Netbeans wants to communicate with SVN server over ssh without asking your password using ssh-askpass, but it is not available. This is a general ssh issue on Mac OS X.
	<p>I found two solutions: <a href="http://paulofierro.com/archives/506/">solution 1</a> and <a href="http://www.retep.org/2009/04/ssh-askpass-on-osx-105.html">solution 2</a>. I only tried solution 2 and it worked perfectly for me. Here are the simple steps:</p>
	<p>a) download script from here (note that I had to add .jpg since blogsome only supports image upload) and save it in /usr/libexec. Change ssh-askpass script to executable:<br />
<code>wget wget http://woshiadai.blogsome.com/images/sshaskpass.jpg -O ssh-askpass<br />
sudo cp ssh-askpass /usr/libexec/ssh-askpass<br />
sudo chmod a+x /usr/libexec/ssh-askpass<br />
</code><br />
b) add two more environment variables:<br />
<code><br />
export SSH_ASKPASS=macos-askpass<br />
export DISPLAY=:0<br />
</code></p>
	</li>
	<li>Finally, you can use subversion actions from inside Netbeans. You will be asked for password for the first time, then it will be remembered for future activities.
	<p>Enjoy the Netbeans! <img src='http://woshiadai.blogsome.com/wp-images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://woshiadai.blogsome.com/2009/06/26/subversion-setup-in-netbeans-67-rc3/feed/</wfw:commentRss>
	</item>
		<item>
		<title>Screen Sharing</title>
		<link>http://woshiadai.blogsome.com/2009/06/19/screen-sharing/</link>
		<comments>http://woshiadai.blogsome.com/2009/06/19/screen-sharing/#comments</comments>
		<pubDate>Fri, 19 Jun 2009 05:43:36 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
		
	<category>Apple</category>
	<category>Mac</category>
		<guid>http://woshiadai.blogsome.com/2009/06/19/screen-sharing/</guid>
		<description><![CDATA[	I have been using Mac for quite a while, but did not have much time to explore many of its features. Today, I managed to find how to do easy VNC to my linux box using Screen Share application, a hidden treasure.
	First, follow the instructions here to set up the Screen Share application. Somehow I [...]]]></description>
			<content:encoded><![CDATA[	<p>I have been using Mac for quite a while, but did not have much time to explore many of its features. Today, I managed to find how to do easy VNC to my linux box using Screen Share application, a hidden treasure.</p>
	<p>First, <a href="http://www.macworld.com/article/131094/2007/12/screensharepower.html">follow the instructions here</a> to set up the Screen Share application. Somehow I could get the advanced toolbar working.</p>
	<p>Second, you need to set up the VNC server on your linux box. In my case, Redhat Enterprise comes with VNC server installed already. All I need is to configure it properly. <a href="http://www.redhat.com/magazine/006apr05/features/vnc/">Follow this nicely written tutorial </a>to start your VNC server. There are two ways in this tutorial: use the build-in remote desktop setup, or the DIY configuration. I chose the 2nd option since it is much flexible and the first one did not really worked for me.</p>
	<p>Third, connect to your VNC server. In my case, I just typed in hostname:5091 and clicked connect in Screen Sharing, then it starts working, really cool!</p>
	<p>I think you should be able to do the same with a Windows machine running VNC server, but I did not try that.
</p>
]]></content:encoded>
			<wfw:commentRss>http://woshiadai.blogsome.com/2009/06/19/screen-sharing/feed/</wfw:commentRss>
	</item>
		<item>
		<title>ICO image processing with Imagick</title>
		<link>http://woshiadai.blogsome.com/2009/06/18/ico-image-processing-with-imagick/</link>
		<comments>http://woshiadai.blogsome.com/2009/06/18/ico-image-processing-with-imagick/#comments</comments>
		<pubDate>Thu, 18 Jun 2009 05:48:58 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
		
	<category>PHP</category>
	<category>Image Processing</category>
		<guid>http://woshiadai.blogsome.com/2009/06/18/ico-image-processing-with-imagick/</guid>
		<description><![CDATA[	Used to have an issue with Imagick when I convert ICO image into png. Somehow when I create the Imagick object from image content string, the final result is a crappy image. But when I create the Imagick object directly from a file, it works fine, with only the problem of a different size.
	So, I [...]]]></description>
			<content:encoded><![CDATA[	<p>Used to have an issue with Imagick when I convert ICO image into png. Somehow when I create the Imagick object from image content string, the final result is a crappy image. But when I create the Imagick object directly from a file, it works fine, with only the problem of a different size.</p>
	<p>So, I filed a bug (http://pecl.php.net/bugs/bug.php?id=15701), but still got no resolution. </p>
	<p>Got some time recently and did a bit research, found that the problem is with the ICO format: it may contain the same image with different sizes. So, when you convert the format directly, it will not work. It is similar in the case when you try to convert an animated GIF image into JPG or PNG, you get one of the frames instead of an animated image.</p>
	<p>There are two solutions:</p>
	<p>1. use foreach($ico as $im) loop to get one image and just convert that image<br />
2. use flattenImages function before the format conversion</p>
	<p>Note that after the format conversion, the image dimensions might be different from when you directly open the ICO image from a browser or image viewer. You probably need to resize the image manually.</p>
	<p><a href="http://pecl.php.net/bugs/bug.php?id=15701">The bug report</a> has some code snippets if you want to try it out.
</p>
]]></content:encoded>
			<wfw:commentRss>http://woshiadai.blogsome.com/2009/06/18/ico-image-processing-with-imagick/feed/</wfw:commentRss>
	</item>
		<item>
		<title>cachegrind for Mac</title>
		<link>http://woshiadai.blogsome.com/2009/05/19/cachegrind-for-mac/</link>
		<comments>http://woshiadai.blogsome.com/2009/05/19/cachegrind-for-mac/#comments</comments>
		<pubDate>Tue, 19 May 2009 05:36:49 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
		
	<category>PHP</category>
		<guid>http://woshiadai.blogsome.com/2009/05/19/cachegrind-for-mac/</guid>
		<description><![CDATA[	Start to learn how to do profiling and optimization for PHP code. Found Kcachegrind is handy to visualize XDebug data. There are other similar cachegrind tools:
	1. Kcachegrind: you can get it from Macports, check out this if you don&#8217;t know how to get started with Macports. Note this might take a long time to install. [...]]]></description>
			<content:encoded><![CDATA[	<p>Start to learn how to do profiling and optimization for PHP code. Found Kcachegrind is handy to visualize XDebug data. There are other similar cachegrind tools:</p>
	<p>1. <a href="http://kcachegrind.sourceforge.net/html/Home.html">Kcachegrind</a>: you can get it from <a href="http://www.macports.org/ports.php?by=name&#038;substr=kcachegrind">Macports</a>, check out <a href="http://www.macports.org/install.php">this</a> if you don&#8217;t know how to get started with Macports. Note this might take a long time to install. In my case, I also need to install <a href="http://www.macports.org/ports.php?by=library&#038;substr=graphviz">graphviz</a> to see the call graph.</p>
	<p>2. <a href="http://www.maccallgrind.com/">MacCallGrind</a>: this displays the data in a table structure.</p>
	<p>3. <a href="http://code.google.com/p/cachegrindvisualizer/">cachegrindvisualizer</a>: this is a google code project, installed/coded using Adobe AIR, fairly cool UI. If you only need to see the call graph, you probably don&#8217;t need Kcachegrind anymore.</p>
	<p>4. <a href="http://code.google.com/p/webgrind/">webgrind</a>: a Web UI for the cachegrind data, also shows a table-like structure.
</p>
]]></content:encoded>
			<wfw:commentRss>http://woshiadai.blogsome.com/2009/05/19/cachegrind-for-mac/feed/</wfw:commentRss>
	</item>
		<item>
		<title>Transparent gif with smooth edge using Imagick</title>
		<link>http://woshiadai.blogsome.com/2009/04/09/transparent-gif-with-smooth-edge-using-imagick/</link>
		<comments>http://woshiadai.blogsome.com/2009/04/09/transparent-gif-with-smooth-edge-using-imagick/#comments</comments>
		<pubDate>Thu, 09 Apr 2009 23:28:34 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
		
	<category>PHP</category>
	<category>Image Processing</category>
		<guid>http://woshiadai.blogsome.com/2009/04/09/transparent-gif-with-smooth-edge-using-imagick/</guid>
		<description><![CDATA[	If you have a PNG with transparency and then you want to convert it to a GIF with transparency preserved. Since GIF has only 1-bit transparency, the edge will look jacky. However, if you know a color that will be used as solid background color or an average color for a gradient background, you can [...]]]></description>
			<content:encoded><![CDATA[	<p>If you have a PNG with transparency and then you want to convert it to a GIF with transparency preserved. Since GIF has only 1-bit transparency, the edge will look jacky. However, if you know a color that will be used as solid background color or an average color for a gradient background, you can still achieve a smooth edge for the transparent gif.</p>
	<p>Here is how (assuming the original PNG is circle.png, the edge antialias color is RED):<br />
<code><br />
< ?php<br />
$red = new ImagickPixel('red');<br />
$transparent = new ImagickPixel('transparent');<br />
$im = new Imagick('circle.png');<br />
$im->setImageBorderColor($red);<br />
$im->frameImage($red, 0, 0, 0, 0);<br />
$im->paintOpaqueImage($red, $transparent, 0.0); //replacing RED color with transparent color<br />
$im->setImageFormat(&#8217;gif&#8217;);<br />
header(&#8217;Content-Type: image/gif&#8217;);<br />
echo $im;<br />
?><br />
</code>
</p>
]]></content:encoded>
			<wfw:commentRss>http://woshiadai.blogsome.com/2009/04/09/transparent-gif-with-smooth-edge-using-imagick/feed/</wfw:commentRss>
	</item>
		<item>
		<title>Use Imagick to create images with transparent canvas</title>
		<link>http://woshiadai.blogsome.com/2009/04/03/use-imagick-to-create-images-with-transparent-canvas/</link>
		<comments>http://woshiadai.blogsome.com/2009/04/03/use-imagick-to-create-images-with-transparent-canvas/#comments</comments>
		<pubDate>Fri, 03 Apr 2009 06:27:34 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
		
	<category>PHP</category>
	<category>Image Processing</category>
		<guid>http://woshiadai.blogsome.com/2009/04/03/use-imagick-to-create-images-with-transparent-canvas/</guid>
		<description><![CDATA[	update: just found an easier way to create a transparent canvas 
so, you can pretty much ignore all these options listed below now
	
$im = new Imagick();
$im->newImage(100, 200, new ImagickPixel('transparent')); // use this predefined transparent color string
$im->setImageFormat('png32');
//$im->setImageFormat('gif');
//$im->setImageFormat('jpg'); // note that jpg does not support transparency, so you see a default black background

	==== ignore the rest of [...]]]></description>
			<content:encoded><![CDATA[	<p><strong>update: just found an easier way to create a transparent canvas <img src='http://woshiadai.blogsome.com/wp-images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /><br />
so, you can pretty much ignore all these options listed below now</strong></p>
	<p><code><br />
$im = new Imagick();<br />
$im->newImage(100, 200, new ImagickPixel('transparent')); // use this predefined transparent color string<br />
$im->setImageFormat('png32');<br />
//$im->setImageFormat('gif');<br />
//$im->setImageFormat('jpg'); // note that jpg does not support transparency, so you see a default black background<br />
</code></p>
	<p><strong>==== ignore the rest of the post ====</strong></p>
	<p>According to <a href="http://www.imagemagick.org/Usage/canvas/#other">ImageMagick Examples canvas page</a>, there are multiple ways to create a transparent canvas.</p>
	<p>It is a pity that Imagick PHP library lacks enough documentation, so I had to try my luck with it. For example, I want to create a transparent background, then copy an image with transparency on top of it.</p>
	<p><code><br />
< ?php<br />
try<br />
{<br />
	$icon = new Imagick('play.png');</p>
	<p> 	$im = new Imagick();</p>
	<p>// put code here to create the transparent canvas, use options below</p>
	<p>	$im->compositeImage($icon, Imagick::COMPOSITE_COPY, 0, 0);</p>
	<p>	header(&#8217;Content-Type: image/png&#8217;);<br />
	echo $im;<br />
}<br />
catch (Exception $ex)<br />
{<br />
	echo &#8216;Exception: &#8216; . $ex->getMessage() . &#8220;\n&#8221;;<br />
	echo $ex->getTraceAsString();<br />
}<br />
?><br />
</code></p>
	<p>a) setImageOpacity<br />
<code><br />
	$im->newImage(200, 200, '#000000', 'png');<br />
	$im->setImageOpacity(0.0);<br />
</code></p>
	<p>b) paintTransparentImage<br />
<code><br />
	$transparent = new ImagickPixel('#000000');<br />
	$im->newImage(200, 200, '#000000', 'png');<br />
	$im->paintTransparentImage($transparent, 0, 10);<br />
</code></p>
	<p>c) matteFloodfillImage<br />
<code><br />
$transparent = new ImagickPixel('#000000');<br />
$im->newImage(200, 200, '#000000', 'png');<br />
$im->setImageBorderColor($transparent);<br />
$im->matteFloodfillImage(0.0, 0.0, $transparent, 200, 200);<br />
</code></p>
	<p>d) thresholdImage<br />
<code><br />
$im->newImage(200, 200, '#000000', 'png');<br />
$im->thresholdImage(-1, Imagick::CHANNEL_ALPHA);<br />
</code></p>
	<p>e) fxImage<br />
<code><br />
 $im->newImage(200, 200, '#000000', 'png');<br />
 $im = $im->fxImage('0', Imagick::CHANNEL_ALPHA);<br />
</code></p>
	<p><strong>For ImageMagick 6.2.9 12/17/07 Q16, Imagick 2.2.2RC1</strong><br />
a) does not work at all<br />
e) gives the correct result, transparent background for play.png and transparent background for the whole image<br />
others give transparent background for play.png, but black background for the whole image</p>
	<p><strong>For ImageMagick 6.4.9-6 2009-03-25 Q16, Imagick 2.2.2</strong><br />
a) b) gives transparent background for play.png and whole image<br />
c) gives an exception<br />
others give white background for play.png, black background for whole image</p>
	<p><strong>Images (note that you may want to save the images and open it in a viewer with non-white background to see the difference, especially the last two):</strong></p>
	<p>1. Desired ouptput: transparent play button background and transparent canvas:<br />
<img src='/images/transparent.php.png' alt='desired output' /><br />
2. White play button background and black canvas<br />
<img src='/images/transparent.php2.png' alt="white play bg, black canvas"/><br />
3. Transparent play button background and black canvas<br />
<img src='/images/transparent.php3.png' alt="transparent play bg, black canvas"/>
</p>
]]></content:encoded>
			<wfw:commentRss>http://woshiadai.blogsome.com/2009/04/03/use-imagick-to-create-images-with-transparent-canvas/feed/</wfw:commentRss>
	</item>
		<item>
		<title>iPhone</title>
		<link>http://woshiadai.blogsome.com/2009/03/21/iphone/</link>
		<comments>http://woshiadai.blogsome.com/2009/03/21/iphone/#comments</comments>
		<pubDate>Sat, 21 Mar 2009 07:22:03 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
		
	<category>Uncategorized</category>
		<guid>http://woshiadai.blogsome.com/2009/03/21/iphone/</guid>
		<description><![CDATA[	Getting interested in iPhone development after I hacked a 2G iPhone recently. Just ordered Programming in Objective-C 2.0 from Amazon, Objective-C seems to be a quite difficult yet powerful language with a lot of nice OO features.
	Here are two nice tutorials from Cocoa Dev Central:
	1. C Language Tutorial for Cocoa
2. Learn Objective-C

]]></description>
			<content:encoded><![CDATA[	<p>Getting interested in iPhone development after I hacked a 2G iPhone recently. Just ordered P<a href="http://www.amazon.com/Programming-Objective-C-2-0-Developers-Library/dp/0321566157">rogramming in Objective-C 2.0</a> from Amazon, Objective-C seems to be a quite difficult yet powerful language with a lot of nice OO features.</p>
	<p>Here are two nice tutorials from Cocoa Dev Central:</p>
	<p>1. <a href="http://cocoadevcentral.com/articles/000081.php">C Language Tutorial for Cocoa</a><br />
2. <a href="http://cocoadevcentral.com/d/learn_objectivec/">Learn Objective-C</a>
</p>
]]></content:encoded>
			<wfw:commentRss>http://woshiadai.blogsome.com/2009/03/21/iphone/feed/</wfw:commentRss>
	</item>
		<item>
		<title>imagick for XAMPP on Mac Leopard</title>
		<link>http://woshiadai.blogsome.com/2008/12/27/imagick-for-xampp-on-mac-leopard/</link>
		<comments>http://woshiadai.blogsome.com/2008/12/27/imagick-for-xampp-on-mac-leopard/#comments</comments>
		<pubDate>Sat, 27 Dec 2008 07:12:53 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
		
	<category>Web Prog.</category>
		<guid>http://woshiadai.blogsome.com/2008/12/27/imagick-for-xampp-on-mac-leopard/</guid>
		<description><![CDATA[	There are different options to install/use PHP on Mac Leopard: use the default installation, use MacPort to install, or use XAMPP.
	I like the all-in-one bundle XAMPP, it is easy to manage and includes most commonly used options. So, I use it for the most of the time. However, when I need to install imagick, a [...]]]></description>
			<content:encoded><![CDATA[	<p>There are different options to install/use PHP on Mac Leopard: use the default installation, use MacPort to install, or use XAMPP.</p>
	<p>I like the all-in-one bundle XAMPP, it is easy to manage and includes most commonly used options. So, I use it for the most of the time. However, when I need to install imagick, a PHP wrapper for ImageMagick, I got into some troubles.</p>
	<p>First, this package is not available via PEAR or PECL (PECL got into some errors). So, I end up manually compile imagick and copy the imagick.so into XAMPP extension directory. Here is what I did:</p>
	<ol>
	<li>change PATH to use default Leopard PHP installation, i.e. put /usr/bin ahead of XAMPP bin directory in PATH setting</li>
	<li>use MacPort to install ImageMagick (assume you have MacPort installed, Yahoo! it if you did not know how to)</li>
	<li>go to http://pecl.php.net/package/imagick, and find out the latest release</li>
	<li>manually build imagick and copy to XAMPP PHP extension directory (assuming using PHP5)<br />
<code><br />
curl -O http://pecl.php.net/get/imagick-2.2.2RC1.tgz<br />
tar xvfz imagick-2.2.2RC1<br />
cd imagick-2.2.2RC1<br />
phpize<br />
./configure --with-imagick=/opt/local<br />
make<br />
sudo make install (we are using /usr/bin/php, so the imagick.so is created in /usr/lib/php/extensions/no-debug-non-zts-20060613/)<br />
sudo cp /usr/lib/php/extensions/no-debug-non-zts-20060613/imagick.so /Applications/xampp/xamppfiles/lib/php/php5/extensions/no-debug-non-zts-20060613/imagick.so<br />
</code></li>
	<li>edit /Applications/xampp/etc/php.ini, find &#8220;Dynamic Extensions&#8221; block, add<br />
<code>extension=imagick.so</code><br />
6. testing, add this test.php file to /Applications/xampp/htdocs and try it at http://localhost/test.php, you will see this jpg turned 45 degree clockwise (get santa-claus.jpg from <a href="http://www.purseblog.com/images/santa-claus.jpg">here</a>)<br />
<code><br />
< ?php<br />
$img = new Imagick('santa-claus.jpg');<br />
$img->rotateImage(&#8217;#fff&#8217;, 45);<br />
header(&#8217;Content-type: image/jpeg&#8217;);<br />
echo $img;<br />
?><br />
</code>
</li>
	</ol>
	<p><strong>Reference:</strong></p>
	<ul>
	<li><a href="http://davidwinter.me.uk/articles/2008/11/22/php5-lighttpd-and-imagick-on-mac-os-x-leopard/">Install PHP5, lighttpd and Imagick on Mac OSX Leopard</a> (talks about using MacPorts to install these things)</li>
	<li><a href="http://translate.google.com/translate?hl=en&#038;sl=ja&#038;u=http://blog.rakugaki.jp/archives/20081106,32.html&#038;sa=X&#038;oi=translate&#038;resnum=8&#038;ct=result&#038;prev=/search%3Fq%3Dchecking%2BImageMagick%2BMagickWand%2BAPI%2Bconfiguration%2Bprogram...%2Bconfigure:%2Berror:%2Bnot%2Bfound.%2BPlease%2Bprovide%2Ba%2Bpath%2Bto%2BMagickWand-config%2Bor%2BWand-config%2Bprogram%26hl%3Den%26client%3Dsafari%26rls%3Den-us">Mac with PHP / Imagick to install</a></li>
	<li><a href="http://pecl.php.net/package/imagick">PECL::Package::imagick</a></li>
	<li><a href="http://www.imagemagick.org/script/binary-releases.php#macosx">Install ImageMagick on Mac</a></li>
	<li><a href="http://php.oregonstate.edu/manual/en/install.pecl.phpize.php">Compiling shared PECL extensions</a></li>
	</ul>
]]></content:encoded>
			<wfw:commentRss>http://woshiadai.blogsome.com/2008/12/27/imagick-for-xampp-on-mac-leopard/feed/</wfw:commentRss>
	</item>
	</channel>
</rss>
