<?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"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Sinax</title>
	<atom:link href="http://www.sinax.be/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sinax.be</link>
	<description>Innovative Software Design</description>
	<lastBuildDate>Mon, 12 Jul 2010 12:00:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Evolving to Python 3</title>
		<link>http://www.sinax.be/2010/07/evolving-to-python-3/</link>
		<comments>http://www.sinax.be/2010/07/evolving-to-python-3/#comments</comments>
		<pubDate>Mon, 12 Jul 2010 12:00:58 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.sinax.be/?p=190</guid>
		<description><![CDATA[Everyone&#8217;s favourite programming language &#8211; yes I am talking about Python &#8211; has been powering software in it&#8217;s trustworthy 2.x series for some years now. It&#8217;s been already over a year since Python 3.0 was released (December 3rd 2008 to be excact), so it&#8217;s about time you took a look this evolution. Plenty of books [...]]]></description>
			<content:encoded><![CDATA[<p>Everyone&#8217;s favourite programming language &#8211; yes I am talking about Python &#8211; has been powering software in it&#8217;s trustworthy 2.x series for some years now.</p>
<p>It&#8217;s been already over a year since Python 3.0 was released (December 3rd 2008 to be excact), so it&#8217;s about time you took a look this evolution.</p>
<p>Plenty of books and websites, but here are my favourite sources for evolving to Python 3:</p>
<ul>
<li>Dive Into Python 3: <a href="http://diveintopython3.org/">http://diveintopython3.org/</a></li>
<li>The official Python 3 documentation: <a href="http://docs.python.org/py3k/">http://docs.python.org/py3k/</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.sinax.be/2010/07/evolving-to-python-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dependency Injection &amp; AOP</title>
		<link>http://www.sinax.be/2010/06/dependency-injection-aop/</link>
		<comments>http://www.sinax.be/2010/06/dependency-injection-aop/#comments</comments>
		<pubDate>Mon, 21 Jun 2010 13:54:59 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.sinax.be/?p=186</guid>
		<description><![CDATA[An excellent introduction to Dependency Injection (DI) and Aspect Oriented Programming (AOP) can be found in the first chapter of the new &#8216;Spring in Action&#8216; book. The first chapter can be downloaded for free and gives an excellent introduction to this powerful new programming approach.]]></description>
			<content:encoded><![CDATA[<p>An excellent introduction to Dependency Injection (DI) and Aspect Oriented Programming (AOP) can be found in the first chapter of the new &#8216;<em><a href="http://www.manning.com/walls4/">Spring in Action</a></em>&#8216; book. </p>
<p>The first chapter can be downloaded for free and gives an excellent introduction to this powerful new programming approach.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sinax.be/2010/06/dependency-injection-aop/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>vSphere SDK &amp; Perl</title>
		<link>http://www.sinax.be/2010/05/vsphere-sdk-perl/</link>
		<comments>http://www.sinax.be/2010/05/vsphere-sdk-perl/#comments</comments>
		<pubDate>Mon, 31 May 2010 15:13:37 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Command & Conquer]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[vmware]]></category>

		<guid isPermaLink="false">http://www.sinax.be/?p=161</guid>
		<description><![CDATA[The vSphere SDK for Perl provides an easy-to-use Perl scripting interface to the vSphere API. Administrators and developers can work with vSphere API objects using vSphere SDK for Perl subroutines. Administrators can use the utility applications included with vSphere SDK for Perl. In addition, the vSphere SDK for Perl includes the Web Services for Management [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>The vSphere SDK for Perl provides an easy-to-use Perl scripting interface to the vSphere API. Administrators and developers can work with vSphere API objects using vSphere SDK for Perl subroutines. Administrators can use the utility applications included with vSphere SDK for Perl. In addition, the vSphere SDK for Perl includes the Web Services for Management component for writing scripts that retrieve CIM data from the ESX/ESXi host using CIMOM, a service that provides standard CIM management functions. The vSphere SDK for Perl also includes subroutines for managing the VMware Credential Store and an example application that illustrates credential store use.</p></blockquote>
<p><a title="vSphere SDK &amp; Perl" href="http://www.vmware.com/support/developer/viperltoolkit/" target="_blank">http://www.vmware.com/support/developer/viperltoolkit/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sinax.be/2010/05/vsphere-sdk-perl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sinax-Framework RSS module</title>
		<link>http://www.sinax.be/2010/05/sinax-framework-rss-module/</link>
		<comments>http://www.sinax.be/2010/05/sinax-framework-rss-module/#comments</comments>
		<pubDate>Tue, 11 May 2010 14:09:58 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[RSS]]></category>
		<category><![CDATA[sinax-framework]]></category>

		<guid isPermaLink="false">http://www.sinax.be/?p=142</guid>
		<description><![CDATA[Coming soon in the Sinax-Framework version 0.04, the RSS module! Keeping it clean and simple is our motto. 1 2 3 4 5 6 &#60;?php include&#40;&#34;sx/rss.inc.php'&#34;&#41;; &#160; $r = new SXRSSChannel&#40;&#34;Sinax RSS 1&#34;, &#34;First Sinax RSS Feed&#34;, &#34;http://www.sinax.be/rss/&#34;&#41;; $r-&#62;addItem&#40;new SXRSSItem&#40;&#34;First RSS Item&#34;, &#34;http://www.sinax.be/firstrssitem/&#34;, &#34;My First RSS item&#34;, &#34;Michael Anckaert&#34;, &#34;2010-05-11&#34;&#41;&#41;; $r-&#62;render&#40;&#41;;]]></description>
			<content:encoded><![CDATA[<p>Coming soon in the Sinax-Framework version 0.04, the RSS module!<br />
Keeping it clean and simple is our motto.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">include</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;sx/rss.inc.php'&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$r</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> SXRSSChannel<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Sinax RSS 1&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;First Sinax RSS Feed&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;http://www.sinax.be/rss/&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$r</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addItem</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> SXRSSItem<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;First RSS Item&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;http://www.sinax.be/firstrssitem/&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;My First RSS item&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;Michael Anckaert&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;2010-05-11&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$r</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">render</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.sinax.be/2010/05/sinax-framework-rss-module/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ubuntu 10.04 &#8211; Switching back the window button layout</title>
		<link>http://www.sinax.be/2010/05/ubuntu-10-04-switching-back-the-window-button-layout/</link>
		<comments>http://www.sinax.be/2010/05/ubuntu-10-04-switching-back-the-window-button-layout/#comments</comments>
		<pubDate>Mon, 03 May 2010 13:53:03 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.sinax.be/?p=116</guid>
		<description><![CDATA[If you&#8217;ve already made the switch to Ubuntu 10.04, the Lucid Lynx you will no doubt have cursed at the switched window button layout (you know, close, minimize and maximize). The how and why of this already famous switch can be read at length on the Ubuntu Forums. I&#8217;d recommend giving the new layout a [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;ve already made the switch to Ubuntu 10.04, the Lucid Lynx you will no doubt have cursed at the switched window button layout (you know, close, minimize and maximize). </p>
<p><a href="http://www.sinax.be/wp-content/uploads/2010/05/lucid-buttons01.png"><img src="http://www.sinax.be/wp-content/uploads/2010/05/lucid-buttons01.png" alt="" title="Lucid Lynx Window Buttton Layout" width="227" height="107" class="alignleft size-full wp-image-117" /></a><span id="more-116"></span></p>
<p>The how and why of this already famous switch can be read at length <a href="http://ohioloco.ubuntuforums.org/showthread.php?t=1423076">on the Ubuntu Forums</a>. I&#8217;d recommend giving the new layout a try, especially with the <a href="http://www.markshuttleworth.com/archives/333">new exciting work</a> being done with the Ayatana indicators.</p>
<p>If you don&#8217;t like the new layout, switching back is quite easy.<br />
Start the <strong><em>Run application</em></strong> dialog by hitting <em>ALT+F2</em> and enter the <em>gconf-editor</em> command to start the Gnome Configuration Editor</p>
<p><a href="http://www.sinax.be/wp-content/uploads/2010/05/lucid-buttons02.png"><img src="http://www.sinax.be/wp-content/uploads/2010/05/lucid-buttons02-300x124.png" alt="" title="Lucid Lynx Window Button Layout" width="300" height="124" class="alignright size-medium wp-image-119" /></a></p>
<p>Then browse to <strong><em>/apps/metacity/general</em></strong> and double click the <strong><em>button_layout</em></strong> key to change the value. The colon &#8220;:&#8221; will determine where the buttons go. Put it on the right and the buttons will be on the left, put it to the left of the buttons and they will be on the right hand side of your windows. You can even put the colon between two buttons to have this effect:</p>
<p><a href="http://www.sinax.be/wp-content/uploads/2010/05/lucid-buttons03.png"><img src="http://www.sinax.be/wp-content/uploads/2010/05/lucid-buttons03-300x29.png" alt="" title="Lucid Lynx Window Button Layout" width="300" height="29" class="aligncenter size-medium wp-image-120" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sinax.be/2010/05/ubuntu-10-04-switching-back-the-window-button-layout/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ubuntu 10.04 released</title>
		<link>http://www.sinax.be/2010/05/ubuntu-10-04-released/</link>
		<comments>http://www.sinax.be/2010/05/ubuntu-10-04-released/#comments</comments>
		<pubDate>Mon, 03 May 2010 13:06:46 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Featured]]></category>

		<guid isPermaLink="false">http://www.sinax.be/?p=110</guid>
		<description><![CDATA[Ubuntu 10.04 aka Lucid Lynx was released! As usual, you can download this spanking new release from the Ubuntu mirrors or follow these instructions to apt-get upgrade your way into this exciting new release!]]></description>
			<content:encoded><![CDATA[<p>Ubuntu 10.04 aka Lucid Lynx was released!</p>
<p>As usual, you can download this spanking new release <a href="http://www.ubuntu.com/getubuntu/download">from the Ubuntu mirrors</a> or follow <a href="https://help.ubuntu.com/community/LucidUpgrades">these instructions</a> to <em><strong>apt-get upgrade</strong></em> your way into this exciting new release!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sinax.be/2010/05/ubuntu-10-04-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Recreate id_rsa.pub</title>
		<link>http://www.sinax.be/2010/04/recreate-id_rsa-pub/</link>
		<comments>http://www.sinax.be/2010/04/recreate-id_rsa-pub/#comments</comments>
		<pubDate>Sat, 10 Apr 2010 16:22:09 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Command & Conquer]]></category>
		<category><![CDATA[Featured]]></category>
		<category><![CDATA[SSH]]></category>

		<guid isPermaLink="false">http://www.sinax.be/?p=85</guid>
		<description><![CDATA[If you ever messed up and lost your SSH public key (~/.ssh/id_rsa.pub) but still have your private key (~/.ssh/id_rsa) you can easily recreate your public key with the following command: -- michael@winston 10-Apr-10 18:15 -- ~:$ ssh-keygen -y &#38;gt; ~/.ssh/id_rsa.pub This will read your private key and recreate the public key. More useful gems in [...]]]></description>
			<content:encoded><![CDATA[<p>If you ever messed up and lost your SSH public key (~/.ssh/id_rsa.pub) but still have your private key (~/.ssh/id_rsa) you can easily recreate your public key with the following command:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #660033;">--</span> michael<span style="color: #000000; font-weight: bold;">@</span>winston <span style="color: #000000;">10</span>-Apr-<span style="color: #000000;">10</span> <span style="color: #000000;">18</span>:<span style="color: #000000;">15</span>
<span style="color: #660033;">--</span> ~:$ <span style="color: #c20cb9; font-weight: bold;">ssh-keygen</span> <span style="color: #660033;">-y</span> <span style="color: #000000; font-weight: bold;">&amp;</span>gt; ~<span style="color: #000000; font-weight: bold;">/</span>.ssh<span style="color: #000000; font-weight: bold;">/</span>id_rsa.pub</pre></div></div>

<p>This will read your private key and recreate the public key.<br />
More useful gems in the <a href="http://linuxmanpages.com/man1/ssh-keygen.1.php">ssh-keygen man page</a> (like changing your passphrase, etc).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sinax.be/2010/04/recreate-id_rsa-pub/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New documentation</title>
		<link>http://www.sinax.be/2010/04/new-documentation/</link>
		<comments>http://www.sinax.be/2010/04/new-documentation/#comments</comments>
		<pubDate>Fri, 02 Apr 2010 09:26:58 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[sinax-framework]]></category>

		<guid isPermaLink="false">http://www.sinax.be/?p=79</guid>
		<description><![CDATA[I&#8217;ve published a preliminary version of the documentation I&#8217;m writing for the Sinax Framework. All new content can be found here: http://www.sinax.be/software/sinax-framework/]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve published a preliminary version of the documentation I&#8217;m writing for the Sinax Framework. All new content can be found here: <a href="http://www.sinax.be/software/sinax-framework/">http://www.sinax.be/software/sinax-framework/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sinax.be/2010/04/new-documentation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sinax-Framework ORM with SXModel</title>
		<link>http://www.sinax.be/2010/03/sinax-framwork-orm-with-sxmodel/</link>
		<comments>http://www.sinax.be/2010/03/sinax-framwork-orm-with-sxmodel/#comments</comments>
		<pubDate>Fri, 12 Mar 2010 10:17:52 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[ORM]]></category>
		<category><![CDATA[sinax-framework]]></category>

		<guid isPermaLink="false">http://www.sinax.be/?p=27</guid>
		<description><![CDATA[I&#8217;ve just uploaded some new work on Sinax-Framework ORM and a new sample for the SXModel class. Defining a model that maps to a database table is fairly straightforward. Simply subclass the SXModel class (or work on an instance) and map the properties of the model to the fields of the database. class Person extends [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve just uploaded some new work on Sinax-Framework ORM and a new sample for the <em>SXModel</em> class.</p>
<p>Defining a model that maps to a database table is fairly straightforward. Simply subclass the <em>SXModel</em> class (or work on an instance) and map the properties of the model to the fields of the database.</p>
<p><span id="more-27"></span></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> Person <span style="color: #000000; font-weight: bold;">extends</span> SXModel <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> __construct<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		parent<span style="color: #339933;">::</span>__construct<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;id&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;persons&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">map</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'firstname'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'first_name'</span><span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">new</span> SXString<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">map</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'lastname'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'last_name'</span><span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">new</span> SXString<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>In the example above we create a model <em>Person</em> that is linked tot the <em>persons</em> table. The constructor of <em>SXModel</em> takes the name of the id field and the table name as arguments. We then map the model property <em>firstname</em> to the table field <em>first_name</em> and specify that it is of <em>SXString</em> type.</p>
<p>Later versions of the Sinax-Framework ORM will make it possible to pass options to your properties, such as required, maximum length, etc.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$p</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Person<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">print</span> <span style="color: #0000ff;">&quot;Getting person object with ID 1: <span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$p</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getById</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">print</span> <span style="color: #0000ff;">&quot; ID: <span style="color: #006699; font-weight: bold;">$p-&gt;id</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">print</span> <span style="color: #0000ff;">&quot; Firstname: <span style="color: #006699; font-weight: bold;">$p-&gt;firstname</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">print</span> <span style="color: #0000ff;">&quot; Lastname: <span style="color: #006699; font-weight: bold;">$p-&gt;lastname</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span></pre></div></div>

<p>The sample above creates a new Person instance and retries the Person object with ID 1. The file <em>persons.sql</em> in the source tree has some sample data and corresponding table structure to work with.</p>
<p>Using the <em>SXModel</em> method <em>isValid()</em> you can check if the model is valid and can be saved to the database. </p>
<h3>Future of Sinax-Framework ORM</h3>
<p>There is of course plenty of work to be done on this ORM implementation. Below is a list of features that I am already working on, feel free to contribute extra ideas.</p>
<ul>
<li>Relationships between models</li>
<li>Extra datatypes with more options</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.sinax.be/2010/03/sinax-framwork-orm-with-sxmodel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SXForm sample</title>
		<link>http://www.sinax.be/2010/03/sxform-sample/</link>
		<comments>http://www.sinax.be/2010/03/sxform-sample/#comments</comments>
		<pubDate>Thu, 11 Mar 2010 11:29:50 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[sinax-framework]]></category>

		<guid isPermaLink="false">http://www.sinax.be/?p=15</guid>
		<description><![CDATA[The forms component of the Sinax-Framework is designed to facilitate working with forms and fields. Below is a sample that you can also find in the Sinax-Framework source tree. It creates a simple form containing three fields, two regular SXTextField and one SXEmailField. The first SXTextField and the SXEmailField are required, the second SXTextField isn&#8217;t. [...]]]></description>
			<content:encoded><![CDATA[<p>The forms component of the Sinax-Framework is designed to facilitate working with forms and fields.</p>
<p>Below is a sample that you can also find in the Sinax-Framework source tree. It creates a simple form containing three fields, two regular SXTextField and one SXEmailField.</p>
<p><span id="more-15"></span></p>
<p>The first SXTextField and the SXEmailField are required, the second SXTextField isn&#8217;t. The method $form->isValid() will check whether all fields in the form are valid. After the form is valid the submitted values are simply echoed to the user.</p>
<p>This short sample demonstrates how easy it is to use the forms component of the Sinax-Framework and amount of work it takes from your hands.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">require</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'sx/forms.inc.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> MyForm <span style="color: #000000; font-weight: bold;">extends</span> SXForm <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> __construct<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		parent<span style="color: #339933;">::</span>__construct<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Verzenden'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addField</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> SXTextField<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Firstname'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'first_name'</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addField</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> SXTextField<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Lastname'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'last_name'</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addField</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> SXEmailField<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Email'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'email'</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;sample@sinax.be&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000088;">$form</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> MyForm<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;h1&gt;SXForm sample: form1.php&lt;/h1&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;p&gt;Required fields: Firstname and email&lt;/p&gt;'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Check for POST method</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'REQUEST_METHOD'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">===</span> <span style="color: #0000ff;">'POST'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #666666; font-style: italic;">// Load post data into the form</span>
	<span style="color: #000088;">$form</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$form</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">isValid</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">// Get object from form</span>
		<span style="color: #000088;">$o</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$form</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getObject</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'I got these values: &lt;br /&gt;'</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'Firstname: '</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$o</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">first_name</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;&lt;br /&gt;&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'Lastname: '</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$o</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">last_name</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;&lt;br /&gt;&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'Email: '</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$o</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">email</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;&lt;br /&gt;&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$form</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">clear</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;There are errors in your submission! Please correct them!&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000088;">$form</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">display</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.sinax.be/2010/03/sxform-sample/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
