<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" gd:etag="W/&quot;DkYFQ3g9cSp7ImA9WxBbE04.&quot;"><id>tag:blogger.com,1999:blog-4258917775183647693</id><updated>2010-03-11T20:01:52.669+01:00</updated><title>bVirtual.nl</title><subtitle type="html">Because IT's virtually everywhere...</subtitle><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://bvirtual.nl/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://bvirtual.nl/" /><author><name>Bram</name><uri>http://www.blogger.com/profile/03582493763972417462</uri><email>noreply@blogger.com</email></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>16</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/Bvirtualnl" /><feedburner:info uri="bvirtualnl" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><entry gd:etag="W/&quot;DEcHRHs9eip7ImA9WxBWFUU.&quot;"><id>tag:blogger.com,1999:blog-4258917775183647693.post-6592699236976432915</id><published>2010-02-08T00:38:00.002+01:00</published><updated>2010-02-08T00:40:35.562+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-02-08T00:40:35.562+01:00</app:edited><title>CakePHP in Subversion: ignore the tmp dir</title><content type="html">&lt;p&gt;Here is the one-liner I use to let Subversion exclude my projects tmp dir, I fetched it somewhere from the net... I thought I'd share it with you :)&lt;/p&gt;
&lt;pre&gt;svn propset svn:ignore "*" tmp -R&lt;/pre&gt;
&lt;p&gt;You should run it from your app folder :)&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4258917775183647693-6592699236976432915?l=bvirtual.nl' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/meHzBuhkc_laFX5OGsNPQ2g9JNI/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/meHzBuhkc_laFX5OGsNPQ2g9JNI/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/meHzBuhkc_laFX5OGsNPQ2g9JNI/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/meHzBuhkc_laFX5OGsNPQ2g9JNI/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/Bvirtualnl/~4/VhdHNn__MSs" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://bvirtual.nl/feeds/6592699236976432915/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=4258917775183647693&amp;postID=6592699236976432915" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4258917775183647693/posts/default/6592699236976432915?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4258917775183647693/posts/default/6592699236976432915?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Bvirtualnl/~3/VhdHNn__MSs/cakephp-in-subversion-ignore-tmp-dir.html" title="CakePHP in Subversion: ignore the tmp dir" /><author><name>Bram</name><uri>http://www.blogger.com/profile/03582493763972417462</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="06890736463378479887" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://bvirtual.nl/2010/02/cakephp-in-subversion-ignore-tmp-dir.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkcGRX86eyp7ImA9WxBWFUU.&quot;"><id>tag:blogger.com,1999:blog-4258917775183647693.post-6055579088206787967</id><published>2010-02-08T00:06:00.001+01:00</published><updated>2010-02-08T00:07:04.113+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-02-08T00:07:04.113+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="cakephp" /><category scheme="http://www.blogger.com/atom/ns#" term="programming" /><category scheme="http://www.blogger.com/atom/ns#" term="php" /><category scheme="http://www.blogger.com/atom/ns#" term="coding" /><title>Linking models in a CakePHP plugin</title><content type="html">&lt;p&gt;Last weekend I finally found the solution to a problem I was facing for a couple of days. I was trying to add data to a model in my plugin from the main app. The problem was that the data validation of that model did not work in the main app, while it worked from within the plugin.&lt;/p&gt;
&lt;p&gt;After looking at this problem and asking on #cakephp on Freenode, the user rich97 eventually figured out what my problem was.&lt;/p&gt;
&lt;p&gt;In my plugin I have two models which have a relationship, one for Articles and one for the Comments on that article. The problem was the definition of the relationships. I was refering to the correct className but without a refering to the plugin it is in, like this: &lt;i&gt;'className'=&gt; 'SystemComment'&lt;/i&gt; while I ofcourse should mention the plugin too, like this: &lt;i&gt;'className'=&gt; 'System.SystemComment'&lt;/i&gt; (with System being the name of my plugin).&lt;/p&gt;
&lt;p&gt;Below you see the models with the correct className references.&lt;/p&gt;
&lt;b&gt;Articles Model&lt;/b&gt;
&lt;pre&gt;&amp;lt;?php
class SystemArticle extends SystemAppModel {
   /* ... */
   var $hasMany = array(
       'SystemComment' =&gt; array(
           'className'     =&gt; 'System.SystemComment',
           'foreignKey'    =&gt; 'article_id',
           'dependent'=&gt;true
       )
   );
}
?&amp;gt;&lt;/pre&gt;
&lt;b&gt;Comments Model&lt;/b&gt;
&lt;pre&gt;&amp;lt;?php
class SystemComment extends SystemAppModel {
   /* ... */
   var $validate = array(
       'email' =&gt; array(
           'rule' =&gt; array('email', true),
           'message' =&gt; 'Please supply a valid email address.'
       ),
       'comment' =&gt; array('notempty')
   );

   var $belongsTo = array(
       'SystemArticle' =&gt; array(
           'className' =&gt; 'System.SystemArticle',
           'foreignKey' =&gt; 'article_id'
       )
   );
}
?&amp;gt;&lt;/pre&gt;

Thanks rich97! :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4258917775183647693-6055579088206787967?l=bvirtual.nl' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/4JqHgq1JTLCAjm_338vYgMAi21Y/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/4JqHgq1JTLCAjm_338vYgMAi21Y/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/4JqHgq1JTLCAjm_338vYgMAi21Y/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/4JqHgq1JTLCAjm_338vYgMAi21Y/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/Bvirtualnl/~4/skNv_jlo9us" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://bvirtual.nl/feeds/6055579088206787967/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=4258917775183647693&amp;postID=6055579088206787967" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4258917775183647693/posts/default/6055579088206787967?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4258917775183647693/posts/default/6055579088206787967?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Bvirtualnl/~3/skNv_jlo9us/linking-models-in-cakephp-plugin.html" title="Linking models in a CakePHP plugin" /><author><name>Bram</name><uri>http://www.blogger.com/profile/03582493763972417462</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="06890736463378479887" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://bvirtual.nl/2010/01/linking-models-in-cakephp-plugin.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkQHQ349cSp7ImA9WxBXEEU.&quot;"><id>tag:blogger.com,1999:blog-4258917775183647693.post-8473196783965983621</id><published>2010-01-21T13:12:00.008+01:00</published><updated>2010-01-21T14:25:32.069+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-01-21T14:25:32.069+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="stylesheet" /><category scheme="http://www.blogger.com/atom/ns#" term="cakephp" /><category scheme="http://www.blogger.com/atom/ns#" term="programming" /><category scheme="http://www.blogger.com/atom/ns#" term="php" /><category scheme="http://www.blogger.com/atom/ns#" term="css" /><category scheme="http://www.blogger.com/atom/ns#" term="coding" /><title>Cakestyle: Drop-in replacement for the default CakePHP stylesheet (cake.generic.css)</title><content type="html">&lt;p&gt;Cakestyle is a stylesheet that is designed to be used with the default CakePHP configuration.&lt;/p&gt;
&lt;p&gt;Just place the updated stylesheet in app/webroot/css/ and off you go.&lt;/p&gt;
&lt;p&gt;The stylesheet is found &lt;a href="http://github.com/beeman/cakestyle"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Of course things are made more clear with &lt;a href="http://github.com/beeman/cakestyle/tree/master/screenshots"&gt;some screenshots&lt;/a&gt;, so here we go:&lt;/p&gt;
&lt;p&gt;This is the default CakePHP screen after installation, with this Cakestyle:
&lt;img src="http://github.com/beeman/cakestyle/raw/master/screenshots/cakestyle-thumb.png" /&gt;&lt;/p&gt;
&lt;p&gt;Compared to the default layout it looks way better, but i may be biased ;) :
&lt;img src="http://github.com/beeman/cakestyle/raw/master/screenshots/cake-default-thumb.png" /&gt;&lt;/p&gt;
&lt;p&gt;If you have any additions or comments, they are more then welcome!&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4258917775183647693-8473196783965983621?l=bvirtual.nl' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/I34B-FbsZN3m0kOr-s8hY94IaRc/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/I34B-FbsZN3m0kOr-s8hY94IaRc/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/I34B-FbsZN3m0kOr-s8hY94IaRc/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/I34B-FbsZN3m0kOr-s8hY94IaRc/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/Bvirtualnl/~4/7WmB35KGswk" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://bvirtual.nl/feeds/8473196783965983621/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=4258917775183647693&amp;postID=8473196783965983621" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4258917775183647693/posts/default/8473196783965983621?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4258917775183647693/posts/default/8473196783965983621?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Bvirtualnl/~3/7WmB35KGswk/cakestyle-drop-in-replacement-for.html" title="Cakestyle: Drop-in replacement for the default CakePHP stylesheet (cake.generic.css)" /><author><name>Bram</name><uri>http://www.blogger.com/profile/03582493763972417462</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="06890736463378479887" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://bvirtual.nl/2010/01/cakestyle-drop-in-replacement-for.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Ck8MR3s9cSp7ImA9WxNbFkg.&quot;"><id>tag:blogger.com,1999:blog-4258917775183647693.post-5098672862847729118</id><published>2009-11-19T14:38:00.006+01:00</published><updated>2009-11-19T18:14:46.569+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-11-19T18:14:46.569+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="javascript" /><category scheme="http://www.blogger.com/atom/ns#" term="note to self" /><category scheme="http://www.blogger.com/atom/ns#" term="programming" /><category scheme="http://www.blogger.com/atom/ns#" term="regular expressions" /><category scheme="http://www.blogger.com/atom/ns#" term="coding" /><title>Javascript Regular Expression to test the last character in string</title><content type="html">&lt;p&gt;Today my colleague &lt;a href="http://www.bleedyellow.com/blogs/martin/"&gt;Martin&lt;/a&gt; asked me to look over his shoulder at a small problem he was facing, he was building a Search function in his application but got stuck with certain input.&lt;/p&gt;
&lt;p&gt;If the search string ended on a character like ")" or a space (and maybe other non-alphanumeric characters), the search function returned nothing, even though it should have some matches.&lt;/p&gt;
&lt;p&gt;We decided that the easiest way to solve this would be to delete all the faulty characters from the end of the string. This had to be done in (Server-side) JavaScript.&lt;/p&gt;
&lt;p&gt;I came up with the following function: (and check below for the updated version)&lt;/p&gt;
&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;
function testString(input){
    var regex = /[a-zA-Z0-9]$/;
    if(input.match(regex)){
        var match = input;
    } else {
        var nomatch = input.substring(0,input.length-1);
        var match = testString(nomatch);
    }
    return match;
}
&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;What it does is the following:
&lt;ul&gt;&lt;li&gt;We first define our regular expression&lt;/li&gt;
&lt;li&gt;If this matches our input string, we will just return it&lt;/li&gt;
&lt;li&gt;If it does not match our input string, we strip the last character off the string, and test it again.&lt;/li&gt;
&lt;/ul&gt;&lt;/p&gt;
&lt;p&gt;This recursive test will continue as long as the regex is not macthed.&lt;/p&gt;
&lt;p&gt;To test this functionality you can run the function like this:&lt;/p&gt;
&lt;pre&gt;document.write(testString("This is a string that end with some special chars &amp; $ !!! ) "));&lt;/pre&gt; Which will output: &lt;b&gt;"This is a string that end with some special chars"&lt;/b&gt;.
&lt;p&gt;Maybe someone enjoys this code, so I thought I'll share it :)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Update&lt;/b&gt; as my other colleague &lt;a href="http://blog.turabdin.nl/"&gt;Marcus&lt;/a&gt; points out, there is a way more elegant way to implement this, making it so that is does not need to recurse. The updated code is below. Thanks Marcus :)&lt;/p&gt;
&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;
function testString(input){
    while (!input.match(/[a-zA-Z0-9]$/))  {
        input = input.substring(0, input.length-1);
    }
    return input;
}
&amp;lt;/script&amp;gt;

&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4258917775183647693-5098672862847729118?l=bvirtual.nl' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/YJ33zCrJi82Gb5-8WSXah5aR0I8/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/YJ33zCrJi82Gb5-8WSXah5aR0I8/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/YJ33zCrJi82Gb5-8WSXah5aR0I8/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/YJ33zCrJi82Gb5-8WSXah5aR0I8/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/Bvirtualnl/~4/SP0XBqZgR_s" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://bvirtual.nl/feeds/5098672862847729118/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=4258917775183647693&amp;postID=5098672862847729118" title="4 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4258917775183647693/posts/default/5098672862847729118?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4258917775183647693/posts/default/5098672862847729118?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Bvirtualnl/~3/SP0XBqZgR_s/javascript-regular-expression-to-test.html" title="Javascript Regular Expression to test the last character in string" /><author><name>Bram</name><uri>http://www.blogger.com/profile/03582493763972417462</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="06890736463378479887" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">4</thr:total><feedburner:origLink>http://bvirtual.nl/2009/11/javascript-regular-expression-to-test.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Ck8MRHo9fyp7ImA9WxNUFEo.&quot;"><id>tag:blogger.com,1999:blog-4258917775183647693.post-556638277515940089</id><published>2009-11-05T00:25:00.006+01:00</published><updated>2009-11-06T02:28:05.467+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-11-06T02:28:05.467+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="cakephp" /><category scheme="http://www.blogger.com/atom/ns#" term="howto" /><category scheme="http://www.blogger.com/atom/ns#" term="tutorial" /><category scheme="http://www.blogger.com/atom/ns#" term="programming" /><category scheme="http://www.blogger.com/atom/ns#" term="php" /><title>Easy trees with Tree Behavior in CakePHP</title><content type="html">&lt;p&gt;This tutorial shows how to use the &lt;a href="http://book.cakephp.org/view/91/Tree"&gt;Tree Behaviour&lt;/a&gt; in CakePHP.&lt;/p&gt;
&lt;p&gt;The only requirement is a working CakePHP application. You can refer to &lt;a href="http://bvirtual.nl/2009/07/quick-guide-on-setting-up-cakephp.html"&gt;this post&lt;/a&gt; to help you get one.&lt;/p&gt;
&lt;h2&gt;Step 1: Create the table in your database&lt;/h2&gt;
&lt;p&gt;First we need to create a table to store our tree. To keep things a bit generic we create a simple table called 'Nodes'. There are various ways to extend this table with other functionality or data, but that is beyond the scope of this tutorial.&lt;/p&gt;
&lt;p&gt;Run the following SQL code to create a table called &lt;b&gt;Nodes&lt;/b&gt;:&lt;/p&gt; 
&lt;pre&gt;CREATE TABLE `nodes` (
  `id` int(11) NOT NULL auto_increment,
  `name` varchar(255) NOT NULL,
  `parent_id` int(11) default NULL,
  `lft` int(11) default NULL,
  `rght` int(11) default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;&lt;/pre&gt;
&lt;p&gt;The Tree Behaviour needs at least the fields parent_id, lft and rght, and they should all use type int().&lt;/p&gt;
&lt;h2&gt;Step 2: Create the model&lt;/h2&gt;
&lt;p&gt;To use table in the application we have to create the model. In this case the file will be &lt;b&gt;app/models/node.php&lt;/b&gt;.&lt;/p&gt;
&lt;pre class="source-code"&gt;&lt;code&gt;&amp;lt;?php

class Node extends AppModel {
    var $name = 'Node';
    var $actsAs = array('Tree');
}

?&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The model Node is defined as any other model in CakePHP. With the line &lt;b&gt;var $actsAs = array('Tree');&lt;/b&gt; we tell CakePHP to use this model as a tree.&lt;/p&gt;
&lt;h2&gt;Step 3: Create the controller&lt;/h2&gt;
&lt;p&gt;The controllers task is to take care of handling the data (adding, showing, updating, deleting, and more). At first we will create a controller with 2 functions, one called 'index' to display the tree and the other called 'add' to add items to the tree. The controller will be &lt;b&gt;app/controllers/nodes_controller.php&lt;/b&gt;. 
&lt;pre class="source-code"&gt;&lt;code&gt;&amp;lt;?php

class NodesController extends AppController {

    function index() {
        $nodelist = $this-&amp;gt;Node-&amp;gt;generatetreelist(null,null,null,&amp;quot; - &amp;quot;);
        $this-&amp;gt;set(compact('nodelist'));
    }

    function add() {
        if (!empty($this-&amp;gt;data)) {
            $this-&amp;gt;Node-&amp;gt;save($this-&amp;gt;data);
            $this-&amp;gt;redirect(array('action'=&amp;gt;'index'));
        } else {
            $parents[0] = &amp;quot;[ No Parent ]&amp;quot;;
            $nodelist = $this-&amp;gt;Node-&amp;gt;generatetreelist(null,null,null,&amp;quot; - &amp;quot;);
            if($nodelist) {
                foreach ($nodelist as $key=&amp;gt;$value)
                    $parents[$key] = $value;
            }
            $this-&amp;gt;set(compact('parents'));
        }
    }
}

?&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The index function is pretty straightforward, it uses the generatetreelist function to generate a formatted tree, and return it in an array.&lt;/p&gt;
&lt;p&gt;The Add function is a bit more complex. It first checks if it received any data. If it did, it saves the data to the database and then redirects to the index again. If the add function did not receive any data, it will create the array needed to populate the 'Parent' select box in our Add screen (see below).&lt;/p&gt;
&lt;h2&gt;Step 4: Create the views&lt;/h2&gt;
&lt;p&gt;We now create 2 view files in the folder &lt;b&gt;app/views/nodes/&lt;/b&gt;, which needs to be created first.&lt;/p&gt;
&lt;p&gt;The file &lt;b&gt;app/views/nodes/index.ctp&lt;/b&gt; is used to display the tree:&lt;/p&gt;
&lt;pre class="source-code"&gt;&lt;code&gt;&amp;lt;?php

echo $html-&amp;gt;link(&amp;quot;Add Node&amp;quot;,array('action'=&amp;gt;'add'));

echo &amp;quot;&amp;lt;ul&amp;gt;&amp;quot;;
foreach($nodelist as $key=&amp;gt;$value){
    echo &amp;quot;&amp;lt;li&amp;gt;$value&amp;lt;/li&amp;gt;&amp;quot;;
}
echo &amp;quot;&amp;lt;/ul&amp;gt;&amp;quot;;

?&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In the above code we first create a link to our 'add' functionality. After that we start a new Unordered list and fill it with the data from the tree.&lt;/p&gt; 
&lt;p&gt;For adding new items to the tree we will use the file &lt;b&gt;app/views/nodes/add.ctp&lt;/b&gt;&lt;/p&gt;
&lt;pre class="source-code"&gt;&lt;code&gt;&amp;lt;?php

echo $html-&amp;gt;link('Back',array('action'=&amp;gt;'index'));

echo $form-&amp;gt;create('Node');
echo $form-&amp;gt;input('name',array('label'=&amp;gt;'Name'));
echo $form-&amp;gt;input('parent_id',array('label'=&amp;gt;'Parent'));
echo $form-&amp;gt;end('Add');

?&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;First there is a link back to the index. After that a new HTML Form of the type Node is create. It then add two fields, one for the Node name, the other to select the parent of the new node. The last function add the submit button with the text 'Add'.&lt;/p&gt;

&lt;hr/&gt;
&lt;p&gt;You should now be able to show your tree, and add nodes to it. Actually you first need to add a node because there is nothing to display yet. In the next step we will add some more functionality to it, but this seems a good moment to check if it all works so far :) ...&lt;/p&gt;
&lt;hr/&gt;
&lt;h2&gt;Step 5: Adding more functionality&lt;/h2&gt;
&lt;p&gt;In this step we will add the posibility to edit and delete the nodes, as wel as move them up and down. We do this by adding some links to the Index page, add the edit view and add some functions to the controller.&lt;/p&gt;
&lt;p&gt;First we update the file &lt;b&gt;app/views/nodes/index.ctp&lt;/b&gt; so it looks like this:&lt;/p&gt;
&lt;pre class="source-code"&gt;&lt;code&gt;&amp;lt;?php

echo $html-&amp;gt;link(&amp;quot;Add Node&amp;quot;,array('action'=&amp;gt;'add'));

echo &amp;quot;&amp;lt;ul&amp;gt;&amp;quot;;
foreach($nodelist as $key=&amp;gt;$value){
    $editurl = $html-&amp;gt;link(&amp;quot;Edit&amp;quot;, array('action'=&amp;gt;'edit', $key));
    $upurl = $html-&amp;gt;link(&amp;quot;Up&amp;quot;, array('action'=&amp;gt;'moveup', $key));
    $downurl = $html-&amp;gt;link(&amp;quot;Down&amp;quot;, array('action'=&amp;gt;'movedown', $key));
    $deleteurl = $html-&amp;gt;link(&amp;quot;Delete&amp;quot;, array('action'=&amp;gt;'delete', $key));
    echo &amp;quot;&amp;lt;li&amp;gt;[$editurl&amp;#124;$upurl&amp;#124;$downurl&amp;#124;$deleteurl] $value&amp;lt;/li&amp;gt;&amp;quot;;
}
echo &amp;quot;&amp;lt;/ul&amp;gt;&amp;quot;;

?&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The part that loops trough the nodelist is changed here. We define 4 URL's for the needed actions, and put them all in front of the Node name, seperated by a pipeline character. This is not the most elegant solution, but it will get the job done.&lt;/p&gt;
&lt;p&gt;Next we add a view for the edit functionality by creating the file &lt;b&gt;app/views/nodes/edit.ctp&lt;/b&gt;:&lt;/p&gt;
&lt;pre class="source-code"&gt;&lt;code&gt;&amp;lt;?php

echo $html-&amp;gt;link('Back',array('action'=&amp;gt;'index'));

echo $form-&amp;gt;create('Node');
echo $form-&amp;gt;hidden('id');
echo $form-&amp;gt;input('name');
echo $form-&amp;gt;input('parent_id', array('selected'=&amp;gt;$this-&amp;gt;data['Node']['parent_id']));
echo $form-&amp;gt;end('Update');

?&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This view is mostly the same as add.ctp. Two differences: the edit view needs a hidden field called 'id', and the parent_id selectbox has a 'selected' parameter, which selects the right parent when in Edit mode.&lt;/p&gt;
&lt;p&gt;In the last step we add four functions (edit, delete, moveup, movedown) to the Controller, &lt;b&gt;app/controllers/nodes_controller.php&lt;/b&gt;, so it will look like this:&lt;/p&gt;
&lt;pre class="source-code"&gt;&lt;code&gt;&amp;lt;?php

class NodesController extends AppController {

    function index() {
        $nodelist = $this-&amp;gt;Node-&amp;gt;generatetreelist(null,null,null,&amp;quot; - &amp;quot;);
        $this-&amp;gt;set(compact('nodelist'));
    }

    function add() {
        if (!empty($this-&amp;gt;data)) {
            $this-&amp;gt;Node-&amp;gt;save($this-&amp;gt;data);
            $this-&amp;gt;redirect(array('action'=&amp;gt;'index'));
        } else {
            $parents[0] = &amp;quot;[ No Parent ]&amp;quot;;
            $nodelist = $this-&amp;gt;Node-&amp;gt;generatetreelist(null,null,null,&amp;quot; - &amp;quot;);
            if($nodelist)
                foreach ($nodelist as $key=&amp;gt;$value)
                    $parents[$key] = $value;
            $this-&amp;gt;set(compact('parents'));
        }
    }

    function edit($id=null) {
        if (!empty($this-&amp;gt;data)) {
            if($this-&amp;gt;Node-&amp;gt;save($this-&amp;gt;data)==false)
                $this-&amp;gt;Session-&amp;gt;setFlash('Error saving Node.');
            $this-&amp;gt;redirect(array('action'=&amp;gt;'index'));
        } else {
            if($id==null) die(&amp;quot;No ID received&amp;quot;);
            $this-&amp;gt;data = $this-&amp;gt;Node-&amp;gt;read(null, $id);
            $parents[0] = &amp;quot;[ No Parent ]&amp;quot;;
            $nodelist = $this-&amp;gt;Node-&amp;gt;generatetreelist(null,null,null,&amp;quot; - &amp;quot;);
            if($nodelist) 
                foreach ($nodelist as $key=&amp;gt;$value)
                    $parents[$key] = $value;
            $this-&amp;gt;set(compact('parents'));
        }
    }

    function delete($id=null) {
        if($id==null)
            die(&amp;quot;No ID received&amp;quot;);
        $this-&amp;gt;Node-&amp;gt;id=$id;
        if($this-&amp;gt;Node-&amp;gt;delete()==false)
            $this-&amp;gt;Session-&amp;gt;setFlash('The Node could not be deleted.');
        $this-&amp;gt;redirect(array('action'=&amp;gt;'index'));
    }

    function moveup($id=null) {
        if($id==null)
            die(&amp;quot;No ID received&amp;quot;);
        $this-&amp;gt;Node-&amp;gt;id=$id;
        if($this-&amp;gt;Node-&amp;gt;moveup()==false)
            $this-&amp;gt;Session-&amp;gt;setFlash('The Node could not be moved up.');
        $this-&amp;gt;redirect(array('action'=&amp;gt;'index'));
    }

    function movedown($id=null) {
        if($id==null)
            die(&amp;quot;No ID received&amp;quot;);
        $this-&amp;gt;Node-&amp;gt;id=$id;
        if($this-&amp;gt;Node-&amp;gt;movedown()==false)
            $this-&amp;gt;Session-&amp;gt;setFlash('The Node could not be moved down.');
        $this-&amp;gt;redirect(array('action'=&amp;gt;'index'));
    }
}

?&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The first part of the edit function works much like the add function, it checks on received data and tries to save it. When there is no data received, it checks if there is a paramater called ID. If not it dies with an error message. If the parameter is given it fetches the node data, and gets the data needed to populate the 'Parent' select box, just like in the Add screen&lt;/p&gt;
&lt;p&gt;The rest of the three functions are almost identical, and don't need any matching views as the code will redirect to the index page anyway. All these functions check if the parameter ID is passed, and dies with an error if not. If the parameter is given it selects the right node and runs the action.&lt;/p&gt;
&lt;h2&gt;Done!&lt;/h2&gt;
&lt;p&gt;This should be it, you should now have a tree created in CakePHP, with complete Create, Read, Update and Delete functionality (and even more)... &lt;/p&gt;&lt;p&gt;Good luck using this code, and please use the comments if you have any questions about it.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4258917775183647693-556638277515940089?l=bvirtual.nl' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/kEckBqV3LuHZMV7Ygox0eUwv4sw/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/kEckBqV3LuHZMV7Ygox0eUwv4sw/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/kEckBqV3LuHZMV7Ygox0eUwv4sw/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/kEckBqV3LuHZMV7Ygox0eUwv4sw/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/Bvirtualnl/~4/AWeBpR_iwz8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://bvirtual.nl/feeds/556638277515940089/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=4258917775183647693&amp;postID=556638277515940089" title="4 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4258917775183647693/posts/default/556638277515940089?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4258917775183647693/posts/default/556638277515940089?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Bvirtualnl/~3/AWeBpR_iwz8/easy-trees-with-tree-behavior-in.html" title="Easy trees with Tree Behavior in CakePHP" /><author><name>Bram</name><uri>http://www.blogger.com/profile/03582493763972417462</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="06890736463378479887" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">4</thr:total><feedburner:origLink>http://bvirtual.nl/2009/11/easy-trees-with-tree-behavior-in.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEEDQX89fSp7ImA9WxNUE0o.&quot;"><id>tag:blogger.com,1999:blog-4258917775183647693.post-4837998327006254278</id><published>2009-10-31T23:40:00.007+01:00</published><updated>2009-11-05T00:17:50.165+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-11-05T00:17:50.165+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="java" /><category scheme="http://www.blogger.com/atom/ns#" term="xml" /><category scheme="http://www.blogger.com/atom/ns#" term="programming" /><category scheme="http://www.blogger.com/atom/ns#" term="android" /><title>Variable in Android's strings.xml</title><content type="html">&lt;p&gt;Today I was wondering how to create a variable in strings.xml, a file used in Android application development.&lt;/p&gt;
&lt;p&gt;It is actually very simple. :)&lt;/p&gt;
&lt;p&gt;First define a string in the strings.xml file (usually &lt;span style="font-weight: bold;"&gt;res/values/strings.xml&lt;/span&gt;).&lt;/p&gt;
&lt;pre&gt;&amp;lt;string name="unread_messages"&amp;gt;You have %d unread messages&amp;lt;/string&amp;gt;&lt;/pre&gt;
&lt;p&gt;This string has a variable &lt;span style="font-weight: bold;"&gt;%d&lt;/span&gt; that will be replaced in the next step.&lt;/p&gt;
&lt;p&gt;In the Java code the string is fetched with the getString method and the variable is replaced with the right content using Java's &lt;a href="http://java.sun.com/javase/6/docs/api/index.html?java/util/Formatter.html"&gt;String formatter&lt;/a&gt;.&lt;/p&gt;
&lt;pre&gt;String message = String.format(getString(R.string.unread_messages), 10);&lt;/pre&gt;
&lt;p&gt;The output will be &lt;span style="font-style: italic;"&gt;You have 10 unread messages&lt;/span&gt;... :)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Update:&lt;/b&gt; As Romain Guy points out in the comments it is even simpler, documented &lt;a href="http://d.android.com/reference/android/content/Context.html#getString%28int,%20java.lang.Object...%29"&gt;here&lt;/a&gt;:&lt;/p&gt;
&lt;pre&gt;String message = getString(R.string.unread_messages, 10);&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4258917775183647693-4837998327006254278?l=bvirtual.nl' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/LEK6H7RMGW9rXV5EF_MeYlxr6sA/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/LEK6H7RMGW9rXV5EF_MeYlxr6sA/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/LEK6H7RMGW9rXV5EF_MeYlxr6sA/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/LEK6H7RMGW9rXV5EF_MeYlxr6sA/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/Bvirtualnl/~4/C1Yx8dsNZUc" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://bvirtual.nl/feeds/4837998327006254278/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=4258917775183647693&amp;postID=4837998327006254278" title="3 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4258917775183647693/posts/default/4837998327006254278?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4258917775183647693/posts/default/4837998327006254278?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Bvirtualnl/~3/C1Yx8dsNZUc/variable-in-androids-stringsxml.html" title="Variable in Android's strings.xml" /><author><name>Bram</name><uri>http://www.blogger.com/profile/03582493763972417462</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="06890736463378479887" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">3</thr:total><feedburner:origLink>http://bvirtual.nl/2009/11/variable-in-androids-stringsxml.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0ANQH48eCp7ImA9WxJaEkg.&quot;"><id>tag:blogger.com,1999:blog-4258917775183647693.post-6084986881572433376</id><published>2009-08-03T01:16:00.006+02:00</published><updated>2009-08-03T01:29:51.070+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-08-03T01:29:51.070+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="linux" /><category scheme="http://www.blogger.com/atom/ns#" term="centos" /><category scheme="http://www.blogger.com/atom/ns#" term="memory" /><category scheme="http://www.blogger.com/atom/ns#" term="swap" /><category scheme="http://www.blogger.com/atom/ns#" term="oracle" /><title>Add more swap space to a running Linux system</title><content type="html">&lt;p&gt;Today I was trying to install Oracle XE to a Centos 5 installation using &lt;a href="https://fedorahosted.org/spacewalk/wiki/OracleXeSetup"&gt;this guide&lt;/a&gt;. While installing the packages i noticed that the Oracle XE Database was unable to install. The error message was quite clear:
&lt;blockquote&gt;&lt;pre&gt;This system does not meet the minimum requirements for swap space.  Based on
the amount of physical memory available on the system, &lt;b&gt;Oracle Database 10g
Express Edition requires 1024 MB of swap space. This system has 509 MB
of swap space.  Configure more swap space on the system and retry the installation.&lt;/b&gt;
error: %pre(oracle-xe-univ-10.2.0.1-1.0.i386) scriptlet failed, exit status 1
error:   install: %pre scriptlet failed (2), skipping oracle-xe-univ-10.2.0.1-1.0&lt;/pre&gt;&lt;/blockquote&gt;My solution was to adding some temporary swap space to this system, which is really easy to do:&lt;/p&gt;
&lt;p&gt;Step 1. Create an empty file called /swapfile from about 600MB
&lt;blockquote&gt;&lt;pre&gt;root@host:~# &lt;span style="font-weight: bold;"&gt;dd if=/dev/zero of=/swapfile bs=1024000 count=600&lt;/span&gt;
600+0 records in
600+0 records out
614400000 bytes (614 MB) copied, 5.85153 seconds, 105 MB/&lt;/pre&gt;&lt;/blockquote&gt;Step 2. Format the new file to make it a swap file
&lt;blockquote&gt;&lt;pre&gt;root@bootux:~# &lt;span style="font-weight: bold;"&gt;mkswap /swapfile&lt;/span&gt;
Setting up swapspace version 1, size = 614395 kB
&lt;/pre&gt;&lt;/blockquote&gt;Step 3. Enable the new swapfile. Only the swapon command is needed, but with the free command you can clearly see the swap space is made available to the system.
&lt;blockquote&gt;&lt;pre&gt;root@bootux:~# &lt;span style="font-weight: bold;"&gt;free -m | grep Swap&lt;/span&gt;
Swap:          509          0        509
root@bootux:~# &lt;span style="font-weight: bold;"&gt;swapon /swapfile&lt;/span&gt;
root@bootux:~# &lt;span style="font-weight: bold;"&gt;free -m | grep Swap&lt;/span&gt;
Swap:         1095          0       1095
&lt;/pre&gt;&lt;/blockquote&gt;Installation can now continue :)&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4258917775183647693-6084986881572433376?l=bvirtual.nl' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Dj48Ns3So8wiQm2KiJzaosrLWz0/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Dj48Ns3So8wiQm2KiJzaosrLWz0/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/Dj48Ns3So8wiQm2KiJzaosrLWz0/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Dj48Ns3So8wiQm2KiJzaosrLWz0/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/Bvirtualnl/~4/_SM-TpB4S0Q" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://bvirtual.nl/feeds/6084986881572433376/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=4258917775183647693&amp;postID=6084986881572433376" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4258917775183647693/posts/default/6084986881572433376?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4258917775183647693/posts/default/6084986881572433376?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Bvirtualnl/~3/_SM-TpB4S0Q/add-more-swap-space-to-running-linux.html" title="Add more swap space to a running Linux system" /><author><name>Bram</name><uri>http://www.blogger.com/profile/03582493763972417462</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="06890736463378479887" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://bvirtual.nl/2009/08/add-more-swap-space-to-running-linux.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUQNQ388fyp7ImA9WxJbGUQ.&quot;"><id>tag:blogger.com,1999:blog-4258917775183647693.post-1151666279804387902</id><published>2009-07-31T00:15:00.011+02:00</published><updated>2009-07-31T01:43:12.177+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-07-31T01:43:12.177+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="cakephp" /><category scheme="http://www.blogger.com/atom/ns#" term="mysql" /><category scheme="http://www.blogger.com/atom/ns#" term="howto" /><category scheme="http://www.blogger.com/atom/ns#" term="php" /><title>Quick guide on setting up a CakePHP project</title><content type="html">&lt;h4&gt;Create the database&lt;/h4&gt;&lt;p&gt;First we create a database called authcake. Rename it as needed, but be sure to change it in the examples below.
&lt;/p&gt;&lt;pre&gt;user@host:~$ &lt;span style="font-weight: bold;"&gt;mysql -u root -p&lt;/span&gt;
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 385
Server version: 5.0.67-0ubuntu6 (Ubuntu)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql&gt; &lt;span style="font-weight: bold;"&gt;create database authcake;&lt;/span&gt;
Query OK, 1 row affected (0.00 sec)

mysql&gt; &lt;span style="font-weight: bold;"&gt;GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER&lt;/span&gt;
-&gt; &lt;span style="font-weight: bold;"&gt;ON authcake.*&lt;/span&gt;
-&gt; &lt;span style="font-weight: bold;"&gt;TO 'authcake'@'localhost' IDENTIFIED BY 's3cr3t';&lt;/span&gt;
Query OK, 0 rows affected (0.00 sec)

mysql&gt; &lt;span style="font-weight: bold;"&gt;exit&lt;/span&gt;
Bye&lt;/pre&gt;&lt;p&gt;&lt;/p&gt;&lt;h4&gt;Download CakePHP&lt;/h4&gt;&lt;p&gt;Next we download the latest CakePHP from &lt;a href="http://cakephp.org/"&gt;http://cakephp.org/&lt;/a&gt;. The version used in this example is &lt;span style="font-style: italic;"&gt;1.2.3.8166 Stable&lt;/span&gt; and the file  &lt;span style="font-weight: bold;"&gt;cake_1.2.3.8166.tar.gz&lt;/span&gt; is placed in the homedir.&lt;/p&gt;&lt;h4&gt;Extract download&lt;/h4&gt;&lt;p&gt;CakePHP will be installed in the &lt;span style="font-style: italic;"&gt;~/public_html/authcake&lt;/span&gt; directory, which is served using &lt;span style="font-style: italic;"&gt;mod_userdir&lt;/span&gt;. The directory will be available at the URL http://yourhost/~username/authcake . Of course it is possible to install it to another location, but be sure to change the locations in the commands below accordingly.&lt;/p&gt;&lt;p&gt;Make sure &lt;span style="font-style: italic;"&gt;mod_rewrite&lt;/span&gt; is working and that the &lt;span style="font-style: italic;"&gt;AllowOverride&lt;/span&gt; property for &lt;span style="font-style: italic;"&gt;~/public_html&lt;/span&gt; is set to &lt;span style="font-style: italic;"&gt;All&lt;/span&gt;.
&lt;/p&gt;&lt;pre&gt;user@host:~$ &lt;span style="font-weight: bold;"&gt;cd ~/public_html&lt;/span&gt;
user@host:~/public_html$ &lt;span style="font-weight: bold;"&gt;tar xvzf ~/cake_1.2.3.8166.tar.gz&lt;/span&gt;
cake_1.2.3.8166/
..........
.  SNAP  .
..........
user@host:~/public_html$ &lt;span style="font-weight: bold;"&gt;mv cake_1.2.3.8166/ authcake&lt;/span&gt;
user@host:~/public_html$ &lt;span style="font-weight: bold;"&gt;cd authcake/&lt;/span&gt;&lt;/pre&gt;&lt;p&gt;&lt;/p&gt;&lt;h4&gt;Configure Database&lt;/h4&gt;&lt;p&gt;Rename the default database config and change the values to match those on your system.
&lt;/p&gt;&lt;pre&gt;user@host:~/public_html/authcake$ &lt;span style="font-weight: bold;"&gt;mv app/config/database.php.default app/config/database.php&lt;/span&gt;
user@host:~/public_html/authcake$ &lt;span style="font-weight: bold;"&gt;vi app/config/database.php&lt;/span&gt;&lt;/pre&gt;&lt;p&gt;&lt;/p&gt;&lt;h4&gt;Update Configuration&lt;/h4&gt;&lt;p&gt;Change the setting Security.salt in the core.php file
&lt;/p&gt;&lt;pre&gt;user@host:~/public_html/authcake$ &lt;span style="font-weight: bold;"&gt;vi app/config/core.php&lt;/span&gt;&lt;/pre&gt;&lt;p&gt;&lt;/p&gt;&lt;h4&gt;Set Permissions&lt;/h4&gt;&lt;p&gt;The &lt;span style="font-style: italic;"&gt;tmp&lt;/span&gt; dir needs write permissions. Use chmod -R 777 only in development environments. In production environments the owner of the files need to be the user running the webserver.
&lt;/p&gt;&lt;pre&gt;user@host:~/public_html/authcake$ &lt;span style="font-weight: bold;"&gt;cd app/&lt;/span&gt;
user@host:~/public_html/authcake/app$ &lt;span style="font-weight: bold;"&gt;chmod -R 777 tmp/&lt;/span&gt;
user@host:~/public_html/authcake/app$ &lt;span style="font-weight: bold;"&gt;cd ..&lt;/span&gt;&lt;/pre&gt;&lt;p&gt;&lt;/p&gt;&lt;h4&gt;The CakePHP installation should now ready and available.&lt;/h4&gt;&lt;p&gt;The result in the browser should look like this:

&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_dOPiDrNTpYo/SnIeZhU058I/AAAAAAAAAS0/5KfH_RbnPqs/s1600-h/cakephp.png"&gt;&lt;img style="cursor: pointer; width: 320px; height: 179px;" src="http://3.bp.blogspot.com/_dOPiDrNTpYo/SnIeZhU058I/AAAAAAAAAS0/5KfH_RbnPqs/s320/cakephp.png" alt="" id="BLOGGER_PHOTO_ID_5364383529942968258" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4258917775183647693-1151666279804387902?l=bvirtual.nl' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/973hB4QX8lPq7BX9tD2ajCJ-woA/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/973hB4QX8lPq7BX9tD2ajCJ-woA/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/973hB4QX8lPq7BX9tD2ajCJ-woA/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/973hB4QX8lPq7BX9tD2ajCJ-woA/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/Bvirtualnl/~4/BJGLpVI3nHc" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://bvirtual.nl/feeds/1151666279804387902/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=4258917775183647693&amp;postID=1151666279804387902" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4258917775183647693/posts/default/1151666279804387902?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4258917775183647693/posts/default/1151666279804387902?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Bvirtualnl/~3/BJGLpVI3nHc/quick-guide-on-setting-up-cakephp.html" title="Quick guide on setting up a CakePHP project" /><author><name>Bram</name><uri>http://www.blogger.com/profile/03582493763972417462</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="06890736463378479887" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/_dOPiDrNTpYo/SnIeZhU058I/AAAAAAAAAS0/5KfH_RbnPqs/s72-c/cakephp.png" height="72" width="72" /><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://bvirtual.nl/2009/07/quick-guide-on-setting-up-cakephp.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEYMQnw-cSp7ImA9WxJUE0w.&quot;"><id>tag:blogger.com,1999:blog-4258917775183647693.post-5914082516885595448</id><published>2009-07-10T21:58:00.007+02:00</published><updated>2009-07-11T14:43:03.259+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-07-11T14:43:03.259+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="linux" /><category scheme="http://www.blogger.com/atom/ns#" term="tmpfs" /><category scheme="http://www.blogger.com/atom/ns#" term="ubuntu" /><category scheme="http://www.blogger.com/atom/ns#" term="swap" /><title>Easily create a RAM-disk in Linux</title><content type="html">This command creates a 2GB RAM-disk and mounts it to /tmp/space.
&lt;pre&gt;$ mkdir /tmp/space
$ sudo mount -t tmpfs tmpfs /tmp/space -o size=2G,nr_inodes=200k,mode=01777&lt;/pre&gt;
You should now have an extra 2GB storage device.
&lt;pre&gt; $ df -h | grep space
$ tmpfs                 2.0G     0  2.0G   0% /tmp/space&lt;/pre&gt;
You access the temporarily device by it's mountpoint /tmp/space. Needless to say, once you unmount this volume (for instance, with a reboot), the data on it will be gone. Use with care! :)

Tested on Ubuntu, should work with any 2.4 or 2.6 kernel...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4258917775183647693-5914082516885595448?l=bvirtual.nl' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/tyMWvo0OeFmamWJi3qvYlPrkdKA/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/tyMWvo0OeFmamWJi3qvYlPrkdKA/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/tyMWvo0OeFmamWJi3qvYlPrkdKA/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/tyMWvo0OeFmamWJi3qvYlPrkdKA/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/Bvirtualnl/~4/SCUSuoZWxNA" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://bvirtual.nl/feeds/5914082516885595448/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=4258917775183647693&amp;postID=5914082516885595448" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4258917775183647693/posts/default/5914082516885595448?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4258917775183647693/posts/default/5914082516885595448?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Bvirtualnl/~3/SCUSuoZWxNA/easily-create-ram-disk-in-linux.html" title="Easily create a RAM-disk in Linux" /><author><name>Bram</name><uri>http://www.blogger.com/profile/03582493763972417462</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="06890736463378479887" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://bvirtual.nl/2009/07/easily-create-ram-disk-in-linux.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkQESX09eCp7ImA9WxRWEk8.&quot;"><id>tag:blogger.com,1999:blog-4258917775183647693.post-689713037244951501</id><published>2008-10-28T10:05:00.010+01:00</published><updated>2008-10-28T21:05:08.360+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-10-28T21:05:08.360+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="linux" /><category scheme="http://www.blogger.com/atom/ns#" term="note to self" /><category scheme="http://www.blogger.com/atom/ns#" term="memory" /><title>Clearing Linux' Memory Cache</title><content type="html">Note to self: Here are some commands you can use to clear the memory cache on a Linux system.

The following command sequence will do the following:
- display the memory stats
- flush filesystem buffers
- drop cached memory
- display the memory stats again
&lt;blockquote&gt;
$ free
$ sudo sync
$ sudo echo 3 | sudo tee /proc/sys/vm/drop_caches
$ free
&lt;/blockquote&gt;
Or, if you like one-liners:
&lt;blockquote&gt;
free; sudo sync; sudo echo 3 | sudo tee /proc/sys/vm/drop_caches; free
&lt;/blockquote&gt;
This is the ouput that i got. The values in bold are my commands, if you look at the underlined values, you will see the memory drop.
&lt;blockquote&gt;&lt;pre&gt;
linux01:~ $ &lt;b&gt;free&lt;/b&gt;
             total       used       free     shared    buffers     cached
Mem:       2061568    &lt;u&gt;2029968&lt;/u&gt;      &lt;u&gt;31600&lt;/u&gt;          0     429284    1247252
-/+ buffers/cache:     353432    1708136
Swap:      1036152        104    1036048
linux01:~ $ &lt;b&gt;sudo sync&lt;/b&gt;
linux01:~ $ &lt;b&gt;sudo echo 3 | sudo tee /proc/sys/vm/drop_caches&lt;/b&gt;
3
linux01:~ $ &lt;b&gt;free&lt;/b&gt;
             total       used       free     shared    buffers     cached
Mem:       2061568     &lt;u&gt;724828&lt;/u&gt;    &lt;u&gt;1336740&lt;/u&gt;          0        340     392092
-/+ buffers/cache:     332396    1729172
Swap:      1036152        104    1036048
&lt;/pre&gt;&lt;/blockquote&gt;
I tested this on SLES10 and Centos5 and Ubuntu8.04. My Ubuntu 6.06 and 7.10 boxes do not seem to have the file /proc/sys/vm/drop_caches .

Sources: &lt;a href="http://linuxtidbits.wordpress.com/2008/02/20/purge-memory/"&gt;1&lt;/a&gt; and &lt;a href="http://www.linuxforums.org/forum/linux-newbie/24590-clear-ram-without-rebooting.html"&gt;2&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4258917775183647693-689713037244951501?l=bvirtual.nl' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/XhSZ7FuYUFBsSGTmgGzNoUZC9Ek/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/XhSZ7FuYUFBsSGTmgGzNoUZC9Ek/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/XhSZ7FuYUFBsSGTmgGzNoUZC9Ek/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/XhSZ7FuYUFBsSGTmgGzNoUZC9Ek/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/Bvirtualnl/~4/x7uwx0ynvic" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://bvirtual.nl/feeds/689713037244951501/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=4258917775183647693&amp;postID=689713037244951501" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4258917775183647693/posts/default/689713037244951501?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4258917775183647693/posts/default/689713037244951501?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Bvirtualnl/~3/x7uwx0ynvic/clearing-linux-memory-cache.html" title="Clearing Linux' Memory Cache" /><author><name>Bram</name><uri>http://www.blogger.com/profile/03582493763972417462</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="06890736463378479887" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://bvirtual.nl/2008/10/clearing-linux-memory-cache.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkUBQ349eyp7ImA9WxRWEU8.&quot;"><id>tag:blogger.com,1999:blog-4258917775183647693.post-4957740447621864600</id><published>2008-10-27T18:17:00.002+01:00</published><updated>2008-10-27T18:24:12.063+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-10-27T18:24:12.063+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="linux" /><category scheme="http://www.blogger.com/atom/ns#" term="note to self" /><category scheme="http://www.blogger.com/atom/ns#" term="vmware" /><title>Enable Time Sync from inside a Linux VM</title><content type="html">Note to self: Command to enable VMware Time Synchronisation on a Linux VM without a GUI (with VMware Tools installed):

&lt;blockquote&gt;vmware-guestd --cmd "vmx.set_option synctime 1 0"&lt;/blockquote&gt;

To disable it you have to turn around the last two parameters, like this:

&lt;blockquote&gt;vmware-guestd --cmd "vmx.set_option synctime 0 1"&lt;/blockquote&gt;

If you want to apply a setting that is already current you will get the message:

&lt;blockquote&gt;"Invalid old value"&lt;/blockquote&gt;

This is tested on RedHat Enterprise Linux 5 and SUSE Linux Enterprise Server 10.

Source: &lt;a href="http://kb.vmware.com/kb/1006427"&gt;Timekeeping best practices for Linux&lt;/a&gt; on &lt;a href="http://kb.vmware.com/"&gt;kb.vmware.com&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4258917775183647693-4957740447621864600?l=bvirtual.nl' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/HknFF9oljIgGXU--l_tYXaK_Mb4/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/HknFF9oljIgGXU--l_tYXaK_Mb4/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/HknFF9oljIgGXU--l_tYXaK_Mb4/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/HknFF9oljIgGXU--l_tYXaK_Mb4/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/Bvirtualnl/~4/fVFt5Cd8UR0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://bvirtual.nl/feeds/4957740447621864600/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=4258917775183647693&amp;postID=4957740447621864600" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4258917775183647693/posts/default/4957740447621864600?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4258917775183647693/posts/default/4957740447621864600?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Bvirtualnl/~3/fVFt5Cd8UR0/enable-time-sync-from-inside-linux-vm.html" title="Enable Time Sync from inside a Linux VM" /><author><name>Bram</name><uri>http://www.blogger.com/profile/03582493763972417462</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="06890736463378479887" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://bvirtual.nl/2008/10/enable-time-sync-from-inside-linux-vm.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEQMRXc8eSp7ImA9WxZVEEg.&quot;"><id>tag:blogger.com,1999:blog-4258917775183647693.post-4074514075477552087</id><published>2008-03-20T00:26:00.014+01:00</published><updated>2008-03-20T23:33:04.971+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-03-20T23:33:04.971+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="json" /><category scheme="http://www.blogger.com/atom/ns#" term="prototype" /><category scheme="http://www.blogger.com/atom/ns#" term="php" /><category scheme="http://www.blogger.com/atom/ns#" term="coding" /><title>Prototype + JSON + PHP - I Got It :)</title><content type="html">This week I haven been playing with the great &lt;a href="http://www.cdolivet.net/editarea/"&gt;EditArea&lt;/a&gt;, a webbased sourcecode editor (examples &lt;a href="http://www.cdolivet.net/editarea/editarea/exemples/exemple_full.html"&gt;here&lt;/a&gt;). To fetch the data from my PHP server I decided &lt;a href="http://json.org/"&gt;JSON&lt;/a&gt; would be the way to go, due to it's clean nature. 

I soon ran into trouble parsing the JSON data my PHP server threw at the client. It took me a while to figure out how to do this nicely with &lt;a href="http://www.prototypejs.org/"&gt;Prototype&lt;/a&gt;, but I found out how at &lt;a href="http://www.prototypejs.org/2007/8/15/prototype-1-6-0-release-candidate"&gt;this&lt;/a&gt; page (search for responseJSON, which is the magic keyword...)

On the server side the key is to make PHP send the header "Content-type: application/json", and print the json_decoded data as response. Prototype can fetch this data by doing an Ajax.Request. 

On the client side you can let Prototype make an Ajax.Request to the server, and get the property 'responseJSON' from the object you received. 

Below is a working example. To get it running you need to create these two files, test.html and test.php . You also need the file &lt;a href="http://www.prototypejs.org/assets/2008/1/25/prototype-1.6.0.2.js"&gt;prototype-1.6.0.2.js&lt;/a&gt; in the same directory. I suspect it to work on all Prototype versions from 1.6RC upwards.
&lt;pre class="code0"&gt;&lt;span style="font-weight:bold;"&gt;test.html&lt;/span&gt;
&lt;span class="code1"&gt;&amp;lt;html&amp;gt;&lt;/span&gt;
 &lt;span class="code1"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
  &lt;span class="code1"&gt;&amp;lt;&lt;/span&gt;&lt;span class="code2"&gt;title&lt;/span&gt;&lt;span class="code1"&gt;&amp;gt;&lt;/span&gt;&lt;span class="code3"&gt;Prototype/JSON/PHP test&lt;/span&gt;&lt;span class="code1"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="code2"&gt;title&lt;/span&gt;&lt;span class="code1"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="code4"&gt;&amp;lt;script language="Javascript" type="text/javascript" src="prototype-1.6.0.2.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
  &lt;span class="code4"&gt;&amp;lt;script language="Javascript" type="text/javascript"&amp;gt;&lt;/span&gt;
  &lt;span class="code4"&gt;function LoadFile(id,target){&lt;/span&gt;
      &lt;span class="code4"&gt;new Ajax.Request("test.php?action=load&amp;amp;id="+id, {&lt;/span&gt;
          &lt;span class="code4"&gt;onSuccess: function(transport) {&lt;/span&gt;
              &lt;span class="code4"&gt;var theObject = transport.responseJSON;&lt;/span&gt;
              &lt;span class="code4"&gt;$(target).innerHTML = theObject.text;&lt;/span&gt;
          &lt;span class="code4"&gt;}, method: "get"&lt;/span&gt;
      &lt;span class="code4"&gt;});&lt;/span&gt;
  &lt;span class="code4"&gt;}&lt;/span&gt;
  &lt;span class="code4"&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
 &lt;span class="code1"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
 &lt;span class="code1"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
  &lt;span class="code1"&gt;&amp;lt;a &lt;/span&gt;&lt;span class="code2"&gt;href&lt;/span&gt;&lt;span class="code5"&gt;="javascript:LoadFile(1,'filelist')"&lt;/span&gt;&lt;span class="code1"&gt;&amp;gt;&lt;/span&gt;&lt;span class="code3"&gt;File &lt;/span&gt;&lt;span class="code6"&gt;1&lt;/span&gt;&lt;span class="code1"&gt;&amp;lt;/a&amp;gt; &lt;/span&gt;
  &lt;span class="code1"&gt;&amp;lt;a &lt;/span&gt;&lt;span class="code2"&gt;href&lt;/span&gt;&lt;span class="code5"&gt;="javascript:LoadFile(2,'filelist')"&lt;/span&gt;&lt;span class="code1"&gt;&amp;gt;&lt;/span&gt;&lt;span class="code3"&gt;File &lt;/span&gt;&lt;span class="code6"&gt;2&lt;/span&gt;&lt;span class="code1"&gt;&amp;lt;/a&amp;gt; &lt;/span&gt;
  &lt;span class="code1"&gt;&amp;lt;a &lt;/span&gt;&lt;span class="code2"&gt;href&lt;/span&gt;&lt;span class="code5"&gt;="javascript:LoadFile('third','filelist')"&lt;/span&gt;&lt;span class="code1"&gt;&amp;gt;&lt;/span&gt;&lt;span class="code3"&gt;File &lt;/span&gt;&lt;span class="code6"&gt;3&lt;/span&gt;&lt;span class="code1"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
  &lt;span class="code1"&gt;&amp;lt;div &lt;/span&gt;&lt;span class="code2"&gt;id&lt;/span&gt;&lt;span class="code5"&gt;="filelist"&lt;/span&gt;&lt;span class="code1"&gt;&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
 &lt;span class="code1"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="code1"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre class="code0"&gt;&lt;span style="font-weight:bold;"&gt;test.php&lt;/span&gt;
&lt;span class="code1"&gt;&amp;lt;?php&lt;/span&gt;
&lt;span class="code1"&gt;# Make sure this is the first output.&lt;/span&gt;
&lt;span class="code1"&gt;header(&lt;/span&gt;&lt;span class="code2"&gt;'Content-type: application/json'&lt;/span&gt;&lt;span class="code1"&gt;);&lt;/span&gt;

&lt;span class="code1"&gt;# The list of files.&lt;/span&gt;
&lt;span class="code3"&gt;$files[1]&lt;/span&gt;&lt;span class="code2"&gt;='This is the first file'&lt;/span&gt;&lt;span class="code1"&gt;;&lt;/span&gt;
&lt;span class="code3"&gt;$files[2]&lt;/span&gt;&lt;span class="code2"&gt;='And this the second one!'&lt;/span&gt;&lt;span class="code1"&gt;;&lt;/span&gt;
&lt;span class="code1"&gt;$files[&lt;/span&gt;&lt;span class="code2"&gt;'third'&lt;/span&gt;&lt;span class="code3"&gt;]&lt;/span&gt;&lt;span class="code2"&gt;='This must be the third then...'&lt;/span&gt;&lt;span class="code1"&gt;;&lt;/span&gt;

&lt;span class="code1"&gt;# Get ID and create array.&lt;/span&gt;
&lt;span class="code3"&gt;$id&lt;/span&gt;&lt;span class="code2"&gt;=&lt;/span&gt;&lt;span class="code1"&gt;$_GET[&lt;/span&gt;&lt;span class="code2"&gt;'id'&lt;/span&gt;&lt;span class="code1"&gt;];&lt;/span&gt;
&lt;span class="code1"&gt;$return[&lt;/span&gt;&lt;span class="code2"&gt;'id'&lt;/span&gt;&lt;span class="code3"&gt;]&lt;/span&gt;&lt;span class="code2"&gt;=&lt;/span&gt;&lt;span class="code1"&gt;$id;&lt;/span&gt;
&lt;span class="code1"&gt;$return[&lt;/span&gt;&lt;span class="code2"&gt;'text'&lt;/span&gt;&lt;span class="code3"&gt;]&lt;/span&gt;&lt;span class="code2"&gt;=&lt;/span&gt;&lt;span class="code1"&gt;$files[$id];&lt;/span&gt;

&lt;span class="code1"&gt;# Return the JSON string.&lt;/span&gt;
&lt;span class="code1"&gt;echo json_encode($return); &lt;/span&gt;
&lt;span class="code1"&gt;?&amp;gt;&lt;/span&gt;&lt;/pre&gt;Code formatted with &lt;a href="http://codeconverter.sharpdevelop.net/FormatCode.aspx"&gt;Format Code&lt;/a&gt;.

Note: Make sure you don't send any other text (that includes spaces or newlines) before sending the header with PHP! This will cause errors that sound like: &lt;span style="font-weight:bold;"&gt;"Warning: Cannot modify header information - headers already sent by......"&lt;/span&gt;

Good luck! :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4258917775183647693-4074514075477552087?l=bvirtual.nl' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/XsOSWJ3pd34ZXxdRT_QWHKy9ygo/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/XsOSWJ3pd34ZXxdRT_QWHKy9ygo/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/XsOSWJ3pd34ZXxdRT_QWHKy9ygo/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/XsOSWJ3pd34ZXxdRT_QWHKy9ygo/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/Bvirtualnl/~4/yJnBHwdD21c" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://bvirtual.nl/feeds/4074514075477552087/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=4258917775183647693&amp;postID=4074514075477552087" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4258917775183647693/posts/default/4074514075477552087?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4258917775183647693/posts/default/4074514075477552087?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Bvirtualnl/~3/yJnBHwdD21c/prototype-json-php-i-got-it.html" title="Prototype + JSON + PHP - I Got It :)" /><author><name>Bram</name><uri>http://www.blogger.com/profile/03582493763972417462</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="06890736463378479887" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">2</thr:total><feedburner:origLink>http://bvirtual.nl/2008/03/prototype-json-php-i-got-it.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEMEQXs6eip7ImA9WxZVEEg.&quot;"><id>tag:blogger.com,1999:blog-4258917775183647693.post-1222300068772934506</id><published>2008-03-13T23:45:00.006+01:00</published><updated>2008-03-20T23:33:20.512+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-03-20T23:33:20.512+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="linux" /><category scheme="http://www.blogger.com/atom/ns#" term="lamp" /><category scheme="http://www.blogger.com/atom/ns#" term="appliance" /><category scheme="http://www.blogger.com/atom/ns#" term="virtualization" /><category scheme="http://www.blogger.com/atom/ns#" term="vmware" /><category scheme="http://www.blogger.com/atom/ns#" term="php" /><title>xampp-dsl: A Damn Small LAMP Appliance</title><content type="html">Today I ran across a nice Virtual Appliance that consists of the well-known &lt;a href="http://www.apachefriends.org/en/xampp.html"&gt;xampp&lt;/a&gt; stack (version 1.6.1) installed on top of the tiny Linux distro &lt;a href="http://damnsmalllinux.org/"&gt;Damn Small Linux&lt;/a&gt; (DSL  3.3).

You can get the appliance &lt;a href="http://www.3works.it/download/index.html"&gt;here&lt;/a&gt; . The &lt;a href="http://www.3works.it/download/xampp-1.6.1-dsl-3.3.zip"&gt;download&lt;/a&gt; weighs in at 154MB and the unpacked size is 379MB.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4258917775183647693-1222300068772934506?l=bvirtual.nl' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/YJOUfV2UMsYrojJ_k-zV375nHb0/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/YJOUfV2UMsYrojJ_k-zV375nHb0/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/YJOUfV2UMsYrojJ_k-zV375nHb0/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/YJOUfV2UMsYrojJ_k-zV375nHb0/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/Bvirtualnl/~4/RWz-8vz5RzQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://bvirtual.nl/feeds/1222300068772934506/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=4258917775183647693&amp;postID=1222300068772934506" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4258917775183647693/posts/default/1222300068772934506?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4258917775183647693/posts/default/1222300068772934506?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Bvirtualnl/~3/RWz-8vz5RzQ/xampp-dsl-small-lamp-appliance.html" title="xampp-dsl: A Damn Small LAMP Appliance" /><author><name>Bram</name><uri>http://www.blogger.com/profile/03582493763972417462</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="06890736463378479887" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://bvirtual.nl/2008/03/xampp-dsl-small-lamp-appliance.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DU8NRHg8fCp7ImA9WxZWFEg.&quot;"><id>tag:blogger.com,1999:blog-4258917775183647693.post-7012149900657868730</id><published>2008-03-08T22:55:00.006+01:00</published><updated>2008-03-14T02:24:55.674+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-03-14T02:24:55.674+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="linux" /><category scheme="http://www.blogger.com/atom/ns#" term="qemu" /><category scheme="http://www.blogger.com/atom/ns#" term="virtualization" /><category scheme="http://www.blogger.com/atom/ns#" term="ubuntu" /><title>KQemu on Ubuntu Gutsy Gibbon</title><content type="html">&lt;a href="http://fabrice.bellard.free.fr/qemu/"&gt;QEMU&lt;/a&gt; is an open source processor emulator in which you can run Virtual Machines. It comes with a kernel module called &lt;a href="http://en.wikipedia.org/wiki/QEMU#KQEMU"&gt;KQemu&lt;/a&gt; which accelerates the VM's to 'near native' speeds.

Due to some licensing issues KQemu is not distributed and installed with QEMU, though it is easily available in Ubuntu and a lot of other operating systems.

This message appears when starting QEMU while KQemu is not loaded:
&lt;blockquote style="font-style: italic; font-weight: bold;"&gt;Could not open '/dev/kqemu' - QEMU acceleration layer not activated
&lt;/blockquote&gt;This howto shows how to get KQemu running on Ubuntu 7.10 (Gutsy Gibbon)

First install the following packages:
&lt;blockquote  style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;sudo apt-get install kqemu-source kqemu-common build-essential&lt;/span&gt;&lt;/blockquote&gt;Then run the following commands:
&lt;blockquote  style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;sudo module-assistant prepare kqemu
sudo module-assistant auto-install kqemu&lt;/span&gt;&lt;/blockquote&gt;If everything went right (so no errors occurred) you can load the module with this command:
&lt;blockquote  style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;sudo modprobe kqemu&lt;/span&gt; &lt;/blockquote&gt;Now check if the module is loaded correctly. If you get a line of output starting with the word &lt;span style="font-weight: bold;"&gt;kqemu&lt;/span&gt; it means the module is loaded properly:
&lt;blockquote  style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;lsmod | grep qemu&lt;/span&gt;&lt;/blockquote&gt;To use this module as a user the right permission need to be set:
&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;&lt;blockquote&gt;sudo chmod a+rw /dev/kqemu &lt;/blockquote&gt;&lt;/span&gt;&lt;/span&gt;You QEMU VM's should now run without the warning above and run a whole lot faster!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4258917775183647693-7012149900657868730?l=bvirtual.nl' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/QfnFvjPPozznC0jqIUXXt8t6uNw/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/QfnFvjPPozznC0jqIUXXt8t6uNw/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/QfnFvjPPozznC0jqIUXXt8t6uNw/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/QfnFvjPPozznC0jqIUXXt8t6uNw/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/Bvirtualnl/~4/SbUBg-BJU0o" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://bvirtual.nl/feeds/7012149900657868730/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=4258917775183647693&amp;postID=7012149900657868730" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4258917775183647693/posts/default/7012149900657868730?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4258917775183647693/posts/default/7012149900657868730?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Bvirtualnl/~3/SbUBg-BJU0o/kqemu-on-ubuntu-gutsy-gibbon.html" title="KQemu on Ubuntu Gutsy Gibbon" /><author><name>Bram</name><uri>http://www.blogger.com/profile/03582493763972417462</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="06890736463378479887" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">2</thr:total><feedburner:origLink>http://bvirtual.nl/2008/03/kqemu-on-ubuntu-gutsy-gibbon.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DU4GQH4ycSp7ImA9WxZWFEg.&quot;"><id>tag:blogger.com,1999:blog-4258917775183647693.post-5204900329074630425</id><published>2008-03-07T19:17:00.010+01:00</published><updated>2008-03-14T02:25:21.099+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-03-14T02:25:21.099+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="virtualization" /><category scheme="http://www.blogger.com/atom/ns#" term="windows" /><category scheme="http://www.blogger.com/atom/ns#" term="vmware" /><title>VirtualCenter 2.5 Passthrough Authentication</title><content type="html">&lt;p&gt;Stuart Radnidge from &lt;a href="http://www.vinternals.com/"&gt;vinternals.com&lt;/a&gt; discovered how to do pass-through authentication in VMware VC 2.5.

This means you will automatically log in to VC 2.5 when the Windows workstation credentials are the same as the ones VC is working with (so this works if you authenticate to the same Windows Domain on both platforms.)

The setting is undocumented but is reported to work. You can find the post &lt;a href="http://www.vinternals.com/2008/02/virtualcenter-25-passthrough.html"&gt;here&lt;/a&gt;. This is how it is done:&lt;/p&gt;&lt;blockquote&gt;&lt;span style="font-style: italic;"&gt;To use it, simply add  -passthroughAuth -s vchostname to the end of the shortcut used to launch the VI 2.5 client.&lt;/span&gt;

&lt;span style="font-style: italic;"&gt;By default it uses the Negotiate SSPI provider, however since they have fully implemented the interface you can change that behaviour to use Kerberos by adding the following within the &amp;lt;vpxd&amp;gt; node in the vpxd.cfg file on the VC server:&lt;/span&gt;

&lt;span style="font-style: italic;"&gt;&amp;lt;sspiProtocol&amp;gt;Kerberos&amp;lt;/sspiProtocol&amp;gt;&lt;/span&gt;
&lt;/blockquote&gt;Via &lt;a href="http://www.virtualization.info/2008/03/tech-how-to-enable-passhrough.html"&gt;virtualization.info&lt;/a&gt;.&lt;p&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4258917775183647693-5204900329074630425?l=bvirtual.nl' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/uPX14Dv1mmgUrMPsLUOoLanoJE0/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/uPX14Dv1mmgUrMPsLUOoLanoJE0/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/uPX14Dv1mmgUrMPsLUOoLanoJE0/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/uPX14Dv1mmgUrMPsLUOoLanoJE0/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/Bvirtualnl/~4/oIUXHcPI2Jg" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://bvirtual.nl/feeds/5204900329074630425/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=4258917775183647693&amp;postID=5204900329074630425" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4258917775183647693/posts/default/5204900329074630425?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4258917775183647693/posts/default/5204900329074630425?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Bvirtualnl/~3/oIUXHcPI2Jg/virtualcenter-25-passthrough.html" title="VirtualCenter 2.5 Passthrough Authentication" /><author><name>Bram</name><uri>http://www.blogger.com/profile/03582493763972417462</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="06890736463378479887" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://bvirtual.nl/2008/03/virtualcenter-25-passthrough.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CE4FQHw4cSp7ImA9WxZVEEg.&quot;"><id>tag:blogger.com,1999:blog-4258917775183647693.post-6670695377871935775</id><published>2008-03-02T11:59:00.025+01:00</published><updated>2008-03-20T23:41:51.239+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-03-20T23:41:51.239+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="bash" /><category scheme="http://www.blogger.com/atom/ns#" term="virtualization" /><category scheme="http://www.blogger.com/atom/ns#" term="vmware" /><category scheme="http://www.blogger.com/atom/ns#" term="coding" /><title>Creating VM's in a breeze</title><content type="html">&lt;a href="http://createvm.googlecode.com/"&gt;CreateVM&lt;/a&gt; is a shell script I created to automate the process of creating VMware virtual machines (VM's). It makes it trivial to create one or more VM's with specific conditions.&lt;br /&gt;&lt;br /&gt;At work I used this script to create VM's with static MAC addresses which are known in our DHCP server, and it helped me a lot to instantly have a clean VM while working on unattended OS installations.&lt;br /&gt;&lt;br /&gt;The script is written in bash and runs on any system which supports bash. It depends on vmware-vdiskmanager , which is included in &lt;a href="http://vmware.com/products/server/"&gt;VMware Server&lt;/a&gt; and &lt;a href="http://vmware.com/products/ws/"&gt;VMware Workstation&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;To run the script you first need to download it.&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;&lt;blockquote&gt;wget http://createvm.googlecode.com/svn/trunk/createvm.sh -O createvm.sh&lt;/blockquote&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;Once downloaded you have to flag it executable:&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;&lt;blockquote&gt;chmod +x createvm.sh&lt;/blockquote&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;Now you can run the script. Run it without any parameters to see the options available:&lt;br /&gt;&lt;blockquote  style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;./createvm.sh&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;The script has one parameter that needs to be set, and that is the guest OS you want to run in your VM. To see a list of OS'es that are supported run the script with parameter &lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;-l&lt;/span&gt;&lt;/span&gt; :&lt;br /&gt;&lt;blockquote  style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;./createvm.sh -l&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;To create your first VM decide on which Guest OS you want to run and pass it as the first parameter to the script. In this example I am creating an Ubuntu virtual machine:&lt;br /&gt;&lt;blockquote  style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;./createvm.sh ubuntu&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;To create the same VM with some more memory pass the -r (for ram) parameter with the wanted RAM value:&lt;br /&gt;&lt;blockquote  style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;./createvm.sh ubuntu -r 512 &lt;/span&gt; &lt;/blockquote&gt;&lt;br /&gt;The script will display a summary of what will be created (see &lt;a href="http://2.bp.blogspot.com/_dOPiDrNTpYo/R8qPt9fykkI/AAAAAAAAAEQ/tRcZkuiAbl4/s1600-h/createvm-screenshot.png"&gt;screenshot&lt;/a&gt;). The defaults are displayed here. All the settings displayed here can be manipulated by the command line parameters.&lt;br /&gt;&lt;br /&gt;To see some of the examples of creating Virtual Machines run the following command:&lt;br /&gt;&lt;blockquote  style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;./createvm.sh -ex&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;Any major updates on this script will be displayed here.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_dOPiDrNTpYo/R8qPt9fykkI/AAAAAAAAAEQ/tRcZkuiAbl4/s1600-h/createvm-screenshot.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://2.bp.blogspot.com/_dOPiDrNTpYo/R8qPt9fykkI/AAAAAAAAAEQ/tRcZkuiAbl4/s320/createvm-screenshot.png" alt="" id="BLOGGER_PHOTO_ID_5173105141753221698" border="0" /&gt;&lt;/a&gt;&lt;span style="font-weight: bold;font-size:85%;" &gt;Screenshot of CreateVM running in an xterm.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Links:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://createvm.googlecode.com/"&gt;CreateVM Homepage on Google Code&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://createvm.googlecode.com/svn/trunk/createvm.sh"&gt;Latest version of CreateVM&lt;/a&gt; (trunk)&lt;/li&gt;&lt;li&gt;&lt;a href="http://code.google.com/p/createvm/source/browse/trunk/createvm.sh"&gt;CreateVM source&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4258917775183647693-6670695377871935775?l=bvirtual.nl' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/xSXR4fxwaKmXQ3qt407q34pUhjM/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/xSXR4fxwaKmXQ3qt407q34pUhjM/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/xSXR4fxwaKmXQ3qt407q34pUhjM/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/xSXR4fxwaKmXQ3qt407q34pUhjM/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/Bvirtualnl/~4/E3rBmRTD7Q0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://bvirtual.nl/feeds/6670695377871935775/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=4258917775183647693&amp;postID=6670695377871935775" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4258917775183647693/posts/default/6670695377871935775?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4258917775183647693/posts/default/6670695377871935775?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Bvirtualnl/~3/E3rBmRTD7Q0/creating-vmware-vms-in-breeze.html" title="Creating VM's in a breeze" /><author><name>Bram</name><uri>http://www.blogger.com/profile/03582493763972417462</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="06890736463378479887" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/_dOPiDrNTpYo/R8qPt9fykkI/AAAAAAAAAEQ/tRcZkuiAbl4/s72-c/createvm-screenshot.png" height="72" width="72" /><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">1</thr:total><feedburner:origLink>http://bvirtual.nl/2008/03/creating-vmware-vms-in-breeze.html</feedburner:origLink></entry></feed>
