<?xml version="1.0" encoding="UTF-8"?>
<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/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>

<channel>
	<title>Vincent Janelle</title>
	<atom:link href="http://vancouverlinuxguy.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://vancouverlinuxguy.com/blog</link>
	<description>My blog sucks.</description>
	<pubDate>Tue, 19 Aug 2008 19:38:16 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.1</generator>
	<language>en</language>
			<item>
		<title>drupal node validation unique title with locks</title>
		<link>http://vancouverlinuxguy.com/blog/2008/08/19/drupal-node-validation-unique-title-with-locks/</link>
		<comments>http://vancouverlinuxguy.com/blog/2008/08/19/drupal-node-validation-unique-title-with-locks/#comments</comments>
		<pubDate>Tue, 19 Aug 2008 19:38:16 +0000</pubDate>
		<dc:creator>Vincent Janelle</dc:creator>
		
		<category><![CDATA[php]]></category>

		<category><![CDATA[drupal]]></category>

		<category><![CDATA[locking]]></category>

		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://vancouverlinuxguy.com/blog/?p=36</guid>
		<description><![CDATA[
/**
 * Implementation of hook_validate().
 */

function hook_validate($node, &#038;$form) {
  $lock = "SELECT GET_LOCK('hook_validate_lock', 60)";

  $result = 0;
  $count = 0;

  while ( $result != 1) {
    $result = db_query($lock);
    $result = db_result($result);
  }

  // Search for groups of the same title
  $test [...]]]></description>
			<content:encoded><![CDATA[<pre>
/**
 * Implementation of hook_validate().
 */

function hook_validate($node, &#038;$form) {
  $lock = "SELECT GET_LOCK('hook_validate_lock', 60)";

  $result = 0;
  $count = 0;

  while ( $result != 1) {
    $result = db_query($lock);
    $result = db_result($result);
  }

  // Search for groups of the same title
  $test = node_load(array("title" => $node->title));

  if ($test) {
    // We have a winner.
    form_set_error("title", t("Duplicate node title"));
  }

  $unlock = "SELECT RELEASE_LOCK('hook_validate_lock')";
  db_query($unlock);
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://vancouverlinuxguy.com/blog/2008/08/19/drupal-node-validation-unique-title-with-locks/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Wow, call_user_func is slow (testing php class implementations vs call_user_func)</title>
		<link>http://vancouverlinuxguy.com/blog/2008/08/08/wow-call_user_func-is-slow-testing-php-class-implementations-vs-call_user_func/</link>
		<comments>http://vancouverlinuxguy.com/blog/2008/08/08/wow-call_user_func-is-slow-testing-php-class-implementations-vs-call_user_func/#comments</comments>
		<pubDate>Fri, 08 Aug 2008 20:15:09 +0000</pubDate>
		<dc:creator>Vincent Janelle</dc:creator>
		
		<category><![CDATA[Programming]]></category>

		<category><![CDATA[php]]></category>

		<category><![CDATA[object-orientated]]></category>

		<guid isPermaLink="false">http://vancouverlinuxguy.com/blog/?p=28</guid>
		<description><![CDATA[Wrote this little microbench to test php class based implementations as a method of writing modular code.   No idea if it&#8217;s actually a valid test or not.
Results:
float(0.29755711555481)
float(0.87803196907043)
Code below:

Pretty version of this
&#60;?php
interface iTest {
public function getTrue();
public function getFalse();
}
class Foo implements iTest {
public function getTrue() {
return TRUE;
}
public function getFalse() {
return FALSE;
}
}
class Bar implements iTest {
public function getTrue() [...]]]></description>
			<content:encoded><![CDATA[<p>Wrote this little microbench to test php class based implementations as a method of writing modular code.   No idea if it&#8217;s actually a valid test or not.</p>
<p>Results:</p>
<p>float(0.29755711555481)<br />
float(0.87803196907043)</p>
<p>Code below:</p>
<p><span id="more-28"></span></p>
<p><a title="Code sample" href="http://actuality.ca/class.php.html">Pretty version of this</a></p>
<p>&lt;?php</p>
<p>interface iTest {<br />
public function getTrue();<br />
public function getFalse();<br />
}</p>
<p>class Foo implements iTest {<br />
public function getTrue() {<br />
return TRUE;<br />
}</p>
<p>public function getFalse() {<br />
return FALSE;<br />
}<br />
}</p>
<p>class Bar implements iTest {<br />
public function getTrue() {<br />
return TRUE;<br />
}</p>
<p>public function getFalse() {<br />
return FALSE;<br />
}<br />
}</p>
<p>$a = new Foo();<br />
$b = new Bar();</p>
<p>$x = array($a, $b);<br />
$c = 0;</p>
<p>$time_start = microtime(true);<br />
while ( $c &lt; 100000) {<br />
foreach($x as $func) {<br />
if ($func instanceof iTest) {<br />
$func-&gt;getTrue();<br />
$func-&gt;getFalse();<br />
} else {<br />
die(&#8221;Not it&#8221;);<br />
}<br />
}<br />
$c++;<br />
}<br />
$time_end = microtime(TRUE);</p>
<p>var_dump($time_end - $time_start);</p>
<p>function foo1_getTrue() {<br />
return TRUE;<br />
}</p>
<p>function foo1_getFalse() {<br />
return FALSE;<br />
}</p>
<p>function foo2_getTrue() {<br />
return TRUE;<br />
}</p>
<p>function foo2_getFalse() {<br />
return FALSE;<br />
}</p>
<p>$x = array(&#8221;foo1&#8243;, &#8220;foo2&#8243;);<br />
$c = 0;</p>
<p>$time_start = microtime(true);<br />
while ( $c &lt; 100000) {<br />
foreach($x as $func) {<br />
if ( function_exists( $func .&#8217;_getTrue&#8217;) )<br />
call_user_func($func . &#8220;_getTrue&#8221;);<br />
if ( function_exists( $func .&#8217;_getFalse&#8217;) )<br />
call_user_func($func . &#8220;_getFalse&#8221;);<br />
}<br />
$c++;<br />
}<br />
$time_end = microtime(true);<br />
var_dump($time_end - $time_start);</p>
]]></content:encoded>
			<wfw:commentRss>http://vancouverlinuxguy.com/blog/2008/08/08/wow-call_user_func-is-slow-testing-php-class-implementations-vs-call_user_func/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Merging objects in php</title>
		<link>http://vancouverlinuxguy.com/blog/2008/07/30/merging-objects-in-php/</link>
		<comments>http://vancouverlinuxguy.com/blog/2008/07/30/merging-objects-in-php/#comments</comments>
		<pubDate>Wed, 30 Jul 2008 23:30:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Programming]]></category>

		<category><![CDATA[php]]></category>

		<category><![CDATA[object-orientated]]></category>

		<guid isPermaLink="false">http://vancouverlinuxguy.com/blog/?p=26</guid>
		<description><![CDATA[I swear, stdClass in php are just associative arrays without builtin functions to do this crap.
$foo1 = new stdClass();
$foo2 = new stdClass();
$foo3 = new stdClass();
$foo1-&#62;one = &#8220;1&#8243;;
$foo2-&#62;two = &#8220;2&#8243;;
foreach ( $foo1 as $key =&#62; $value ) {
$foo3-&#62;$key = $value;
}
foreach ( $foo2 as $key =&#62; $value ) {
$foo3-&#62;$key = $value;
}
var_dump($foo3);
]]></description>
			<content:encoded><![CDATA[<p>I swear, stdClass in php are just associative arrays without builtin functions to do this crap.</p>
<p>$foo1 = new stdClass();<br />
$foo2 = new stdClass();</p>
<p>$foo3 = new stdClass();</p>
<p>$foo1-&gt;one = &#8220;1&#8243;;<br />
$foo2-&gt;two = &#8220;2&#8243;;</p>
<p>foreach ( $foo1 as $key =&gt; $value ) {<br />
$foo3-&gt;$key = $value;<br />
}<br />
foreach ( $foo2 as $key =&gt; $value ) {<br />
$foo3-&gt;$key = $value;<br />
}</p>
<p>var_dump($foo3);</p>
]]></content:encoded>
			<wfw:commentRss>http://vancouverlinuxguy.com/blog/2008/07/30/merging-objects-in-php/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Cooking with Vince (With other people&#8217;s recipies)</title>
		<link>http://vancouverlinuxguy.com/blog/2008/07/05/cooking-with-vince-with-other-peoples-recipies/</link>
		<comments>http://vancouverlinuxguy.com/blog/2008/07/05/cooking-with-vince-with-other-peoples-recipies/#comments</comments>
		<pubDate>Sat, 05 Jul 2008 22:11:39 +0000</pubDate>
		<dc:creator>Vincent Janelle</dc:creator>
		
		<category><![CDATA[cooking]]></category>

		<guid isPermaLink="false">http://vancouverlinuxguy.com/blog/2008/07/05/cooking-with-vince-with-other-peoples-recipies/</guid>
		<description><![CDATA[Stuffed Peppers Recipe with Rice and Cheese - Recipe for Stuffed Red Bell
Om nom nom.
]]></description>
			<content:encoded><![CDATA[<p><a href="http://southernfood.about.com/od/stuffedpepperrecipes/r/bl30118p.htm">Stuffed Peppers Recipe with Rice and Cheese - Recipe for Stuffed Red Bell</a></p>
<p>Om nom nom.</p>
]]></content:encoded>
			<wfw:commentRss>http://vancouverlinuxguy.com/blog/2008/07/05/cooking-with-vince-with-other-peoples-recipies/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Moved to Slicehost</title>
		<link>http://vancouverlinuxguy.com/blog/2008/07/01/moved-to-slicehost/</link>
		<comments>http://vancouverlinuxguy.com/blog/2008/07/01/moved-to-slicehost/#comments</comments>
		<pubDate>Tue, 01 Jul 2008 20:28:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[dreamhost]]></category>

		<category><![CDATA[slicehost]]></category>

		<category><![CDATA[sucks]]></category>

		<guid isPermaLink="false">http://209.20.77.165/blog/?p=23</guid>
		<description><![CDATA[Giving up on dreamhost, tired of the slow page loads, overloaded databases, etc.
Trying out slicehost for the next few months, seems ok so far since it gives me a playground for my other more interesting things involving java that I want to play with.
]]></description>
			<content:encoded><![CDATA[<p>Giving up on dreamhost, tired of the slow page loads, overloaded databases, etc.</p>
<p>Trying out slicehost for the next few months, seems ok so far since it gives me a playground for my other more interesting things involving java that I want to play with.</p>
]]></content:encoded>
			<wfw:commentRss>http://vancouverlinuxguy.com/blog/2008/07/01/moved-to-slicehost/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Itunes remote</title>
		<link>http://vancouverlinuxguy.com/blog/2008/06/07/itunes-remote/</link>
		<comments>http://vancouverlinuxguy.com/blog/2008/06/07/itunes-remote/#comments</comments>
		<pubDate>Sat, 07 Jun 2008 18:55:51 +0000</pubDate>
		<dc:creator>Vincent Janelle</dc:creator>
		
		<category><![CDATA[applescript]]></category>

		<category><![CDATA[itunes]]></category>

		<category><![CDATA[mac os x]]></category>

		<guid isPermaLink="false">http://vancouverlinuxguy.com/blog/2008/06/07/itunes-remote/</guid>
		<description><![CDATA[Technorati Tags: itunes remote, itunes, applescript
This nifty little application (http://www.delicioussuite.com/technology/deliciousfun/applications/remote_itunes.html) allows you to remotely control remote instances of itunes using remote applescript events (see http://docs.info.apple.com/article.html?path=Mac/10.4/en/mh896.html on how to enable, you&#8217;ll need to make sure your account has a password).
Current limitations like sorting your list doesn&#8217;t work, but if you have a mac mini like I [...]]]></description>
			<content:encoded><![CDATA[<p>Technorati Tags: <a class="performancingtags" rel="tag" href="http://technorati.com/tag/itunes%20remote">itunes remote</a>, <a class="performancingtags" rel="tag" href="http://technorati.com/tag/itunes">itunes</a>, <a class="performancingtags" rel="tag" href="http://technorati.com/tag/applescript">applescript</a></p>
<p>This nifty little application (<a href="http://www.delicioussuite.com/technology/deliciousfun/applications/remote_itunes.html" target="_blank">http://www.delicioussuite.com/technology/deliciousfun/applications/remote_itunes.html</a>) allows you to remotely control remote instances of itunes using remote applescript events (see <a href="http://docs.info.apple.com/article.html?path=Mac/10.4/en/mh896.html" target="_blank">http://docs.info.apple.com/article.html?path=Mac/10.4/en/mh896.html</a> on how to enable, you&#8217;ll need to make sure your account has a password).</p>
<p>Current limitations like sorting your list doesn&#8217;t work, but if you have a mac mini like I do for playing music/video/etc on your television, its a lot easier than flipping over to a VNC connection to hit &#8216;next&#8217;.</p>
]]></content:encoded>
			<wfw:commentRss>http://vancouverlinuxguy.com/blog/2008/06/07/itunes-remote/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Grails AcegiSecurity Create User on BootStrap</title>
		<link>http://vancouverlinuxguy.com/blog/2008/06/05/grails-acegisecurity-create-user-on-bootstrap/</link>
		<comments>http://vancouverlinuxguy.com/blog/2008/06/05/grails-acegisecurity-create-user-on-bootstrap/#comments</comments>
		<pubDate>Thu, 05 Jun 2008 19:01:27 +0000</pubDate>
		<dc:creator>Vincent Janelle</dc:creator>
		
		<category><![CDATA[grails]]></category>

		<category><![CDATA[j2ee]]></category>

		<category><![CDATA[java]]></category>

		<category><![CDATA[AcegiSecurity]]></category>

		<category><![CDATA[groovy]]></category>

		<guid isPermaLink="false">http://vancouverlinuxguy.com/blog/?p=20</guid>
		<description><![CDATA[To create users on startup with a blank database:

import org.codehaus.groovy.grails.web.servlet.GrailsApplicationAttributes
class BootStrap {
def init = { servletContext -&#62;
new Role(description:"Administrators", authority:"ROLE_ADMIN").save();
new Role(description:"User", authority:"ROLE_USER").save();
def ctx = servletContext.getAttribute(GrailsApplicationAttributes.APPLICATION_CONTEXT);
def authService =  ctx.getBean("authenticateService");
def pass = authService.passwordEncoder('aPasswordGoesHere');
def config = authService.securityConfig;
def defaultRole = config.security.defaultRole;
def role = Role.findByAuthority(defaultRole);
def adminRole = Role.findByAuthority("ROLE_ADMIN");
def p = new User(username:"admin"
,passwd:pass
,enabled:true
,email:'test@example.com',
,userRealName:"Default Admin");
role.addToPeople(p);
adminRole.addToPeople(p);
if (p.save())
println("Created default admin");
else {
p.errors.allErrors.each {
println it
}
}
}
]]></description>
			<content:encoded><![CDATA[<p>To create users on startup with a blank database:</p>
<p><span id="more-21"></span></p>
<p>import org.codehaus.groovy.grails.web.servlet.GrailsApplicationAttributes</p>
<pre><span style="color: #888888;">class BootStrap {</span></pre>
<pre><span style="color: #888888;">def init = { servletContext -&gt;</span></pre>
<pre><span style="color: #888888;">new Role(description:"Administrators", authority:"ROLE_ADMIN").save();
new Role(description:"User", authority:"ROLE_USER").save();</span></pre>
<pre><span style="color: #888888;">def ctx = servletContext.getAttribute(GrailsApplicationAttributes.APPLICATION_CONTEXT);</span></pre>
<pre><span style="color: #888888;">def authService =  ctx.getBean("authenticateService");
def pass = authService.passwordEncoder('aPasswordGoesHere');</span></pre>
<pre><span style="color: #888888;">def config = authService.securityConfig;
def defaultRole = config.security.defaultRole;</span></pre>
<pre><span style="color: #888888;">def role = Role.findByAuthority(defaultRole);</span></pre>
<pre><span style="color: #888888;">def adminRole = Role.findByAuthority("ROLE_ADMIN");</span></pre>
<pre><span style="color: #888888;">def p = new User(username:"admin"
,passwd:pass
,enabled:true
,email:'test@example.com',
,userRealName:"Default Admin");</span></pre>
<pre><span style="color: #888888;">role.addToPeople(p);
adminRole.addToPeople(p);</span></pre>
<pre><span style="color: #888888;">if (p.save())
println("Created default admin");
else {
p.errors.allErrors.each {
println it
}
}
}</span></pre>
]]></content:encoded>
			<wfw:commentRss>http://vancouverlinuxguy.com/blog/2008/06/05/grails-acegisecurity-create-user-on-bootstrap/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Using services from bootstrap.groovy in grails</title>
		<link>http://vancouverlinuxguy.com/blog/2008/06/04/using-services-from-bootstrapgroovy-in-grails/</link>
		<comments>http://vancouverlinuxguy.com/blog/2008/06/04/using-services-from-bootstrapgroovy-in-grails/#comments</comments>
		<pubDate>Wed, 04 Jun 2008 22:51:20 +0000</pubDate>
		<dc:creator>Vincent Janelle</dc:creator>
		
		<category><![CDATA[j2ee]]></category>

		<category><![CDATA[java]]></category>

		<category><![CDATA[grails]]></category>

		<category><![CDATA[groovy]]></category>

		<category><![CDATA[services]]></category>

		<guid isPermaLink="false">http://vancouverlinuxguy.com/blog/?p=19</guid>
		<description><![CDATA[I&#8217;m currently writing an application for some upcoming strutta.com functionality using grails.  During development though, I have it setup to recreate my data everytime I restart the server, and then I repopulate from a seperate source.
I do have a controller setup to manually import specific ids from the head end server, but its useful if [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m currently writing an application for some upcoming <a title="Strutta.com Media Inc" href="http://www.strutta.com/" target="_blank">strutta.com</a> functionality using <a title="Grails" href="http://grails.org" target="_blank">grails</a>.  During development though, I have it setup to recreate my data everytime I restart the server, and then I repopulate from a seperate source.</p>
<p>I do have a controller setup to manually import specific ids from the head end server, but its useful if I didn&#8217;t have to do this everything I hit ctrl-c in the wrong window.  Using a services orientated design, you seperate out logic from controllers (and is recommended by the grails guys), but if you need to call this from the bootup, you could follow the instructions on <a title="Grails services design" href="http://grails.org/Services" target="_blank">http://grails.org/Services</a> (which doesn&#8217;t work&#8230;) or you could do:</p>
<pre>import org.codehaus.groovy.grails.web.servlet.GrailsApplicationAttributes

class BootStrap {

  def init = { servletContext -&gt;
    def ctx = servletContext.getAttribute(
GrailsApplicationAttributes.APPLICATION_CONTEXT);
    def ss = ctx.getBean("feedService");

    ss.loadFromFeed();
  }
  def destroy = {
  }
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://vancouverlinuxguy.com/blog/2008/06/04/using-services-from-bootstrapgroovy-in-grails/feed/</wfw:commentRss>
		</item>
		<item>
		<title>links for 2008-04-12</title>
		<link>http://vancouverlinuxguy.com/blog/2008/04/12/links-for-2008-04-12/</link>
		<comments>http://vancouverlinuxguy.com/blog/2008/04/12/links-for-2008-04-12/#comments</comments>
		<pubDate>Sat, 12 Apr 2008 12:34:09 +0000</pubDate>
		<dc:creator>Vincent Janelle</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://vancouverlinuxguy.com/blog/2008/04/12/links-for-2008-04-12/</guid>
		<description><![CDATA[

Amazon S3: Browser-Based Uploads using POST
(tags: amazon s3 post upload aws)


]]></description>
			<content:encoded><![CDATA[<ul class="delicious">
<li>
<div class="delicious-link"><a href="http://doc.s3.amazonaws.com/proposals/post.html">Amazon S3: Browser-Based Uploads using POST</a></div>
<div class="delicious-tags">(tags: <a href="http://del.icio.us/randomfrequency/amazon">amazon</a> <a href="http://del.icio.us/randomfrequency/s3">s3</a> <a href="http://del.icio.us/randomfrequency/post">post</a> <a href="http://del.icio.us/randomfrequency/upload">upload</a> <a href="http://del.icio.us/randomfrequency/aws">aws</a>)</div>
</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://vancouverlinuxguy.com/blog/2008/04/12/links-for-2008-04-12/feed/</wfw:commentRss>
		</item>
		<item>
		<title>links for 2008-04-10</title>
		<link>http://vancouverlinuxguy.com/blog/2008/04/10/links-for-2008-04-10/</link>
		<comments>http://vancouverlinuxguy.com/blog/2008/04/10/links-for-2008-04-10/#comments</comments>
		<pubDate>Thu, 10 Apr 2008 12:36:48 +0000</pubDate>
		<dc:creator>Vincent Janelle</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://vancouverlinuxguy.com/blog/2008/04/10/links-for-2008-04-10/</guid>
		<description><![CDATA[

Installing lighttpd and PHP 5 with FastCGI on CentOS 5 x86_64
(tags: centos php fastcgi lighttpd)


]]></description>
			<content:encoded><![CDATA[<ul class="delicious">
<li>
<div class="delicious-link"><a href="http://ha.nnes.be/index.php/installing-lighttpd-and-php-5-with-fastcgi-on-centos-5-x86_64/">Installing lighttpd and PHP 5 with FastCGI on CentOS 5 x86_64</a></div>
<div class="delicious-tags">(tags: <a href="http://del.icio.us/randomfrequency/centos">centos</a> <a href="http://del.icio.us/randomfrequency/php">php</a> <a href="http://del.icio.us/randomfrequency/fastcgi">fastcgi</a> <a href="http://del.icio.us/randomfrequency/lighttpd">lighttpd</a>)</div>
</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://vancouverlinuxguy.com/blog/2008/04/10/links-for-2008-04-10/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
