<?xml version="1.0" encoding="ISO-8859-1"?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<copyright>Copyright 1998-2010 Tweakers.net</copyright>
		<pubDate>Wed, 17 Mar 2010 22:14:09 GMT</pubDate>
		<lastBuildDate>Wed, 17 Mar 2010 22:14:09 GMT</lastBuildDate>
		<docs>http://tweakers.net/reviews/76</docs>
		<description>Tweakblogs.net is de weblog service van Tweakers.net, de grootste hardwaresite en techcommunity van Nederland.</description>
		<image>
			<link>http://tweakblogs.net/</link>
			<title>Tweakblogs.net</title>
			<url>http://tweakimg.net/g/if/logo.gif</url>
			<height>60</height>
			<width>60</width>
			<description>Tweakblogs.net</description>
		</image>
		<language>nl-nl</language>
		<link>http://drm.tweakblogs.net</link>
		<title>drm&#39;s tweakblog</title>
		<webMaster>frontpage@tweakers.net</webMaster>
		<item>
			<title>Twig, the next generation template engine for PHP</title>
			<link>http://drm.tweakblogs.net/blog/3538/twig-the-next-generation-template-engine-for-php.html</link>
			<description>I&#39;ve been using Smarty 2 for about 7 years, and, while Smarty 3 is still in beta, Twig just popped up in the scene. Notable Smarty opposer Fabien Potencier was apparently converted by this template engine, so Twig must either be magic, or excellent, or both.

One of the major drawbacks of Smarty is that it is bloated (think of all those &#38;quot;internal functions&#38;quot; next to the two walruses of classes), renders fairly unreadable source code and is not that well extensible. Some of the syntax choices in smarty aren&#39;t that practical either... How many times have you typed {foreach $items as $value} in a Smarty template? I have about a gazillion times. And who the H thought of that abominable {section ...} thing?). 

Of course, I also need to point out that it is actually quite fast, it makes for an excellent alternative to writing templates in pure PHP, and there has never been any template engine nearly as simple and at the same time powerful as Smarty. Not to mention the fact that it was actually the first one to come with a compiler paradigm. Well, I have used it for such a long time, I think that counts as enough defence.

Ever since PHP is evolving more and more into an object-oriented language, and even more so, the community is gaining more and more good developers, there was bound to be someone to say: &#38;quot;Smarties are for children, real men just gnaw on wood&#38;quot;. So Twig is born. And a prodigy it is. 

The set-up is very straight forward. A solid compiler, with great extensibility. You can hook into the compiler&#39;s syntax tree with your custom nodes, change the syntax by defining delimiters, easily read the generated code, and redesign every part of the engine because of it&#39;s design-by-contract implementation. 

Here are some pointers if you&#39;re used to smarty:
Default delimiters, the $ sign and data types
Default, Twig uses {{ var }} delimiting for variable output, and {% ... %} for control structures. The dollar sign is a goner, so get used to that. There is no difference between an array and an object, so you can write {{ var.property }} for both arrays and objects. A slight difference is that in case var is an object, Twig also checks if the var has a getter for the property in either form property() or getProperty(). 

For-loops and sections
foreach is called for, and sections need to be rewritten to for-loops as well.
code:1
2
3
{% for key, value in items %}
   {{ key }} contains {{ value }}
{% endfor %}Special context-sensitive variables are available in the loop-variable.

modifiers and functions
Twig supports Smarty-style modifiers, though parameters are passed within parentheses: {{ var|modify(&#38;quot;with argument&#38;quot;) }}. Functions are supported as well, and can be implemented by writing extensions to the compiler.

Cool stuff that smarty doesn&#39;t doTemplate inheritance. Define a layout in one and populate the blocks in another template.Macro&#39;s, which are tiny pieces of template code, reusable as a function in the rest of the template. You can store macro&#39;s in external templates, and import them for reuse.Access a parent context reference, which enable you to identify for example which loop variable you want to access in a nested loop, the inner or the outer one.A generic expression parser, which enables you to set and define complex expressions wherever an expression is allowedAnd probably I&#39;m leaving out a whole bunch of other nice features. Read more about it in the Twig documentation, and get inspired. 

I hope a 1.0 version will see the daylight soon. I think it is a very welcome attribution to the community, so let&#39;s thank Armin Ronacher for kick-starting Twig, and Fabien for his conversion to the one true faith: PHP is no longer just a template engine. 

PS: If the first question that comes to mind is Why use a template engine if you&#39;re already using PHP, never mind. There are plenty valid points to use a separate template engine. There a plenty valid points against it too. I don&#39;t really care. Smarty has done the job outstandingly, and as long as the deemed successor compiles into PHP code, I&#39;m happy.</description>
			<author>drm</author>
			<category>7</category>
			<comments>http://drm.tweakblogs.net/blog/3538/twig-the-next-generation-template-engine-for-php.html#reacties</comments>
			<guid isPermaLink="false">http://drm.tweakblogs.net/blog/3538</guid>
			<pubDate>Tue, 09 Feb 2010 19:50:00 GMT</pubDate>
		</item>
		<item>
			<title>VirtualBox is more free than you might think</title>
			<link>http://drm.tweakblogs.net/blog/3517/virtualbox-is-more-free-than-you-might-think.html</link>
			<description>I read a post today at the Zend Framework general mailinglist from Ralf Eggert, having trouble with Internet Explorer 6. As all of us developers know, IE6 is trouble.  Read more &#38;raquo;</description>
			<author>drm</author>
			<category>7</category>
			<comments>http://drm.tweakblogs.net/blog/3517/virtualbox-is-more-free-than-you-might-think.html#reacties</comments>
			<guid isPermaLink="false">http://drm.tweakblogs.net/blog/3517</guid>
			<pubDate>Thu, 04 Feb 2010 23:35:00 GMT</pubDate>
		</item>
		<item>
			<title>HipHop - The talk of the day</title>
			<link>http://drm.tweakblogs.net/blog/3510/hiphop-the-talk-of-the-day.html</link>
			<description>Today I read about HipHop, the talk of the day in the PHP community. It is basically a PHP to C++ compiler, developed by Facebook to have all benefits of compiled binaries (improved performance, more efficient memory management, less overhead), without having to train their PHP developers into C++ developers or do a big round of fire-and-hire. They open sourced it today. Read more &#38;raquo;</description>
			<author>drm</author>
			<category>7</category>
			<comments>http://drm.tweakblogs.net/blog/3510/hiphop-the-talk-of-the-day.html#reacties</comments>
			<guid isPermaLink="false">http://drm.tweakblogs.net/blog/3510</guid>
			<pubDate>Wed, 03 Feb 2010 18:48:00 GMT</pubDate>
		</item>
		<item>
			<title>Ubuntu 9.10  karmic installation... Not so positive.</title>
			<link>http://drm.tweakblogs.net/blog/3475/ubuntu-910-karmic-installation-not-so-positive.html</link>
			<description>So, i thought I&#39;d give Ubuntu a go. After running Debian unstable for a while (with pleasure, I might add), I was in for some new experience. Read more &#38;raquo;</description>
			<author>drm</author>
			<category>1</category>
			<comments>http://drm.tweakblogs.net/blog/3475/ubuntu-910-karmic-installation-not-so-positive.html#reacties</comments>
			<guid isPermaLink="false">http://drm.tweakblogs.net/blog/3475</guid>
			<pubDate>Wed, 27 Jan 2010 23:27:00 GMT</pubDate>
		</item>
		<item>
			<title>Installing IntelliJ WebIDE on GNU/Linux</title>
			<link>http://drm.tweakblogs.net/blog/3347/installing-intellij-webide-on-gnu-linux.html</link>
			<description>IntelliJ is working on probably the best PHP IDE out there. Since I am running Debian unstable at home, here&#39;s how to install it. I think more or less the same routine would work for any other distribution, but others might elaborate on that. Read more &#38;raquo;</description>
			<author>drm</author>
			<category>7</category>
			<comments>http://drm.tweakblogs.net/blog/3347/installing-intellij-webide-on-gnu-linux.html#reacties</comments>
			<guid isPermaLink="false">http://drm.tweakblogs.net/blog/3347</guid>
			<pubDate>Tue, 05 Jan 2010 15:42:27 GMT</pubDate>
		</item>
		<item>
			<title>bash: Getting started, finally...</title>
			<link>http://drm.tweakblogs.net/blog/3285/bash-getting-started-finally.html</link>
			<description>I&#39;ve found bash scripting to be one of the gems I (re)discovered this year. When you&#39;re like me, you like to automate stuff. There&#39;s of course loads of scripting languages available to get it done, but frankly, using bash for lots of filesystem and/or configuration related tasks makes more sense than for example PHP or Python. 

Here are some pointers to get you on track. As always feel free to ask questions. Read more &#38;raquo;</description>
			<author>drm</author>
			<category>7</category>
			<comments>http://drm.tweakblogs.net/blog/3285/bash-getting-started-finally.html#reacties</comments>
			<guid isPermaLink="false">http://drm.tweakblogs.net/blog/3285</guid>
			<pubDate>Thu, 24 Dec 2009 09:15:00 GMT</pubDate>
		</item>
		<item>
			<title>What PHP editor or IDE do you use?</title>
			<link>http://drm.tweakblogs.net/blog/3096/what-php-editor-or-ide-do-you-use.html</link>
			<description>Eclipse PDT is bloating. I have a Intel 2.4 GHz quad core processor, 4G&#39;s of RAM running a 64bit Debian and the latest Eclipse PDT still isn&#39;t as responsive as I&#39;d expect from state of the art software on more or less state of the art hardware. Netbeans unfortunately has the same issues. 

So I was wondering, what are the alternatives? I&#39;ve become quite a fan of the &#38;quot;UNIX principle&#38;quot;, meaning basically that a piece of software should do one thing, and do that one thing very well, with openness to other pieces of software. What, in your honest opinion, is something that fits that goal as a PHP editor? Everything goes, but please try to elaborate </description>
			<author>drm</author>
			<category>7</category>
			<comments>http://drm.tweakblogs.net/blog/3096/what-php-editor-or-ide-do-you-use.html#reacties</comments>
			<guid isPermaLink="false">http://drm.tweakblogs.net/blog/3096</guid>
			<pubDate>Sun, 15 Nov 2009 18:20:45 GMT</pubDate>
		</item>
		<item>
			<title>Don&#39;t fear the MySQL geekness!</title>
			<link>http://drm.tweakblogs.net/blog/3019/dont-fear-the-mysql-geekness!.html</link>
			<description>I have quite often seen people wrestle with easy problems. The trouble is, they don&#39;t really know the ins and outs of systems they work with. Very few times this was unresolvable by a bit more knowledge of how the software is used at a very basic, low level.

The most basic example of this is MySQL. Lots of people don&#39;t really learn SQL, they just get some GUI tool that does the &#38;quot;thinking&#38;quot; (mind the air-quotes) and generate all ALTER and CREATE queries for them in case of a structural change in the database. For productivity, this is fine, sure. However, if the availability of these tools is for some reason jeopardized, becoming somewhat helpless is inevitable. Read more &#38;raquo;</description>
			<author>drm</author>
			<category>7</category>
			<comments>http://drm.tweakblogs.net/blog/3019/dont-fear-the-mysql-geekness!.html#reacties</comments>
			<guid isPermaLink="false">http://drm.tweakblogs.net/blog/3019</guid>
			<pubDate>Mon, 02 Nov 2009 20:43:00 GMT</pubDate>
		</item>
		<item>
			<title>The horror of open source behemoths</title>
			<link>http://drm.tweakblogs.net/blog/3005/the-horror-of-open-source-behemoths.html</link>
			<description>There are a few projects out there that give open source a bad name. I won&#39;t call the project in question by name here, but let&#39;s say some open source web CMS&#39;es scratch a part of my memory which was heavily repressed - with reason.  Read more &#38;raquo;</description>
			<author>drm</author>
			<category>7</category>
			<comments>http://drm.tweakblogs.net/blog/3005/the-horror-of-open-source-behemoths.html#reacties</comments>
			<guid isPermaLink="false">http://drm.tweakblogs.net/blog/3005</guid>
			<pubDate>Thu, 29 Oct 2009 18:03:43 GMT</pubDate>
		</item>
		<item>
			<title>&#34;Segmentation Faulty Tree&#34;</title>
			<link>http://drm.tweakblogs.net/blog/2974/segmentation-faulty-tree.html</link>
			<description>I am trying out Debian GNU/Linux (unstable) on my desktop for a while now, and I am not yet used to apt as a packemanager. I&#39;m sure it&#39;s darn powerful (why else whould Debian run on it, as one of the oldest and most revered distro&#39;s), but it feels like it hides the most simple tasks into different things, like listing installed packages is done with dpkg, finding package names with apt-cache, and installing/removing with apt-get. Hmmm, not really sure why it isn&#39;t just all wrapped in one utility (besides of course the more graphical stuff like aptitude or synaptic). Read more &#38;raquo;</description>
			<author>drm</author>
			<category>1</category>
			<comments>http://drm.tweakblogs.net/blog/2974/segmentation-faulty-tree.html#reacties</comments>
			<guid isPermaLink="false">http://drm.tweakblogs.net/blog/2974</guid>
			<pubDate>Sat, 24 Oct 2009 13:50:50 GMT</pubDate>
		</item>
		<item>
			<title>FreeBSD at the desktop: It didn&#39;t make it</title>
			<link>http://drm.tweakblogs.net/blog/2887/freebsd-at-the-desktop-it-didnt-make-it.html</link>
			<description>It is a sad day. With due pain in my chest, I have decided not to go through with FreeBSD at the desktop. I absolutely love FreeBSD&#39;s basic concepts of clean system setup, clearly dividing kernel, base system and userland, and the best documentation I have ever seen on any open source project. So nothing but &#38;quot;kudo&#39;s&#38;quot; there, and I will keep using it at my home server, and I will keep supporting it for that purpose. But no, right now, it is not the thing as it comes to the desktop. Read more &#38;raquo;</description>
			<author>drm</author>
			<category>1</category>
			<comments>http://drm.tweakblogs.net/blog/2887/freebsd-at-the-desktop-it-didnt-make-it.html#reacties</comments>
			<guid isPermaLink="false">http://drm.tweakblogs.net/blog/2887</guid>
			<pubDate>Sat, 03 Oct 2009 16:28:10 GMT</pubDate>
		</item>
		<item>
			<title>w00t! I made it: FreeBSD + Xorg + Gnome + Compiz Fusion = cool desktop :)</title>
			<link>http://drm.tweakblogs.net/blog/2753/w00t!-i-made-it-freebsd-+-xorg-+-gnome-+-compiz-fusion-=-cool-desktop-).html</link>
			<description>Here&#39;s some joy for me to share, I finally made it today getting FreeBSD with Gnome and Compiz Fusion on a dual screen setup to work exactly as I wanted. And I&#39;ve got the feeling this is gonna make me consider the definite switch to FreeBSD.  Read more &#38;raquo;</description>
			<author>drm</author>
			<category>1</category>
			<comments>http://drm.tweakblogs.net/blog/2753/w00t!-i-made-it-freebsd-+-xorg-+-gnome-+-compiz-fusion-=-cool-desktop-).html#reacties</comments>
			<guid isPermaLink="false">http://drm.tweakblogs.net/blog/2753</guid>
			<pubDate>Mon, 14 Sep 2009 23:21:08 GMT</pubDate>
		</item>
		<item>
			<title>De eeuwige discussie</title>
			<link>http://drm.tweakblogs.net/blog/2562/de-eeuwige-discussie.html</link>
			<description>Semantische of praktische HTML....?

Er wordt al jaren gediscussieerd over &#38;quot;tables vs CSS&#38;quot; om je site te layouten. Ik zag toevallig vanavond weer zo&#39;n topic, en wilde eigenlijk reageren. Het is een blogpost geworden...  Lees verder &#38;raquo;</description>
			<author>drm</author>
			<category>7</category>
			<comments>http://drm.tweakblogs.net/blog/2562/de-eeuwige-discussie.html#reacties</comments>
			<guid isPermaLink="false">http://drm.tweakblogs.net/blog/2562</guid>
			<pubDate>Thu, 20 Aug 2009 20:03:21 GMT</pubDate>
		</item>
		<item>
			<title>How to get a FreeBSD web development box running as a Virtual Machine in Windows</title>
			<link>http://drm.tweakblogs.net/blog/2280/how-to-get-a-freebsd-web-development-box-running-as-a-virtual-machine-in-windows.html</link>
			<description>Why this tutorial?
I want best of both worlds. I want a development server, running on a Windows machine. I am sure I&#39;m not the first to come to this conclusion. Many developers out there go for Mac OS X or Ubuntu systems. I don&#39;t want that. I want PhotoShop, not GIMP, I want to run any given Windows game or app at any time, so there it is. I also don&#39;t want to bother with Windows-specifics for MySQL, PHP, Apache, Python, because the apps are usually going on a Linux or BSD system anyway. Read more &#38;raquo;</description>
			<author>drm</author>
			<category>7</category>
			<comments>http://drm.tweakblogs.net/blog/2280/how-to-get-a-freebsd-web-development-box-running-as-a-virtual-machine-in-windows.html#reacties</comments>
			<guid isPermaLink="false">http://drm.tweakblogs.net/blog/2280</guid>
			<pubDate>Sun, 12 Jul 2009 20:10:06 GMT</pubDate>
		</item>
		<item>
			<title>dpc09: Day 3 - Some more highlights</title>
			<link>http://drm.tweakblogs.net/blog/2051/dpc09-day-3-some-more-highlights.html</link>
			<description>However compelling the title of this blogpost, I attended some great talks today. Not all of them were among the best (anyone who attended the opening keynote would probably agree *ahem* ), but I&#39;ll highlight some of the stuff I heard today  Read more &#38;raquo;</description>
			<author>drm</author>
			<category>7</category>
			<comments>http://drm.tweakblogs.net/blog/2051/dpc09-day-3-some-more-highlights.html#reacties</comments>
			<guid isPermaLink="false">http://drm.tweakblogs.net/blog/2051</guid>
			<pubDate>Sat, 13 Jun 2009 16:20:10 GMT</pubDate>
		</item>
		<item>
			<title>dpc09: Day 2 - My (personal) highlights</title>
			<link>http://drm.tweakblogs.net/blog/2042/dpc09-day-2-my-(personal)-highlights.html</link>
			<description>I&#39;m just gonna pick the highlights today. I have written quite some stuff down about every speaker I heard, but the highlights for me personally were the following.  Read more &#38;raquo;</description>
			<author>drm</author>
			<category>7</category>
			<comments>http://drm.tweakblogs.net/blog/2042/dpc09-day-2-my-(personal)-highlights.html#reacties</comments>
			<guid isPermaLink="false">http://drm.tweakblogs.net/blog/2042</guid>
			<pubDate>Fri, 12 Jun 2009 16:50:00 GMT</pubDate>
		</item>
		<item>
			<title>dpc09: Day 1 - Matthew Weier O&#39;Phinney - Zend Framework tutorial</title>
			<link>http://drm.tweakblogs.net/blog/2032/dpc09-day-1-matthew-weier-ophinney-zend-framework-tutorial.html</link>
			<description>I attended the Matthew Weier O&#39;Phinney talk about Zend Framework. It was an 8 hour (more or less) tutorial on how to use it, mainly focusing on the application design-side of things. I always regret when such a speaker is taunted with a majority of &#38;quot;RTFM&#38;quot; questions and there will always be the wisecrack raising hand and saying &#38;quot;This will generate a Parse error, because you forgot the semi-colon at the end of your statement&#38;quot;. (Are you kidding me....?  ). Well, it&#39;s part of the deal, I suppose.  Read more &#38;raquo;</description>
			<author>drm</author>
			<category>7</category>
			<comments>http://drm.tweakblogs.net/blog/2032/dpc09-day-1-matthew-weier-ophinney-zend-framework-tutorial.html#reacties</comments>
			<guid isPermaLink="false">http://drm.tweakblogs.net/blog/2032</guid>
			<pubDate>Thu, 11 Jun 2009 17:54:00 GMT</pubDate>
		</item>
		<item>
			<title>dpc09: The day before - Dutch PHP Conference</title>
			<link>http://drm.tweakblogs.net/blog/2030/dpc09-the-day-before-dutch-php-conference.html</link>
			<description>Tomorrow (well, technically, today) the Dutch PHP conference starts. I will be attending with two of my colleagues at Zicht, Jelle-Jan and Rik. Jelle and I have registered for the Zend Framework tutorial and Rik has for the Zend Certification program.  Read more &#38;raquo;</description>
			<author>drm</author>
			<category>7</category>
			<comments>http://drm.tweakblogs.net/blog/2030/dpc09-the-day-before-dutch-php-conference.html#reacties</comments>
			<guid isPermaLink="false">http://drm.tweakblogs.net/blog/2030</guid>
			<pubDate>Wed, 10 Jun 2009 22:23:15 GMT</pubDate>
		</item>
		<item>
			<title>Export subversion verschillen tussen twee revisions voor upload</title>
			<link>http://drm.tweakblogs.net/blog/1931/export-subversion-verschillen-tussen-twee-revisions-voor-upload.html</link>
			<description>Subversion (svn) is &#233;&#233;n van de meest wijd verspreide versioning systemen voor source code, en terecht want het is erg flexibel en praktisch opgezet. Zonder dat je verplicht wordt vaste structuren aan te houden in je repositories, en door eenvoudig combinaties van repositories op te zetten m.b.v. svn:externals kan je eigenlijk heel veel kanten op als het gaat om package en library beheer binnen een in development of onderhoud zijnd project. Hier kan ik nog wel eens wat tips voor op een rijtje zetten als daar behoefte aan is.

Ik vroeg me al een hele tijd af of er voor Subversion ook iets beschikbaar was om een soort patch te maken tussen twee verschillende revisions die als een &#38;quot;overwrite&#38;quot; mogen fungeren, wat ongelooflijk handig zou zijn voor het updaten van een FTP-locatie, waar je geen beschikking hebt over svn metadata of zelfs een svn client.

Na afgelopen week toch maar weer eens gezocht te hebben, kwam ik een python scriptje tegen wat in deze behoefte voorziet, onder de naam svnchanged_export.py. Met dit script kun je in een shell op eenvoudige wijze de gewijzigde bestanden uit een repository vissen en die uploaden. Hoewel de deletes natuurlijk niet direct gedaan kunnen worden op basis van deze informatie, zou dit een aardig begin kunnen zijn van een mash-up met een python ftp-client die de wijzigingen direct doorsluist naar een FTP-locatie. 

Je hebt op de bak waar je script gaat draaien een python 2.5 en pysvn installatie nodig, allebei ongetwijfeld beschikbaar in je favoriete packaging systeem. (via apt en FreeBSD ports in ieder geval geen probleem). Op windows heb ik het zelf niet uitgeprobeerd. Let er op dat je weet welke revision je online hebt staan (hou dit bijvoorbeeld bij in een hidden file in de root van je website, of met behulp van consequente tagging waarbij de laatste live revision altijd een tag heeft).

Een aanrader in ieder geval, voor iedereen die niet afhankelijk wil zijn van (vaak trage of zelfs buggy) file-date of filesize comparisons in FTP clients 

PS: Python is sowieso altijd erg veelbelovend als het op handige scripts gaat: de source code is over het algemeen goed te lezen i.t.t. bijvoorbeeld Perl scripts en er is een gigantische codebase beschikbaar voor allerlei toepassingen die ook als losse (zowel source als binary) packages gedistribueerd worden.</description>
			<author>drm</author>
			<category>7</category>
			<comments>http://drm.tweakblogs.net/blog/1931/export-subversion-verschillen-tussen-twee-revisions-voor-upload.html#reacties</comments>
			<guid isPermaLink="false">http://drm.tweakblogs.net/blog/1931</guid>
			<pubDate>Sun, 31 May 2009 13:36:09 GMT</pubDate>
		</item>
		<item>
			<title>MySQL: ENUM&#39;s and booleans</title>
			<link>http://drm.tweakblogs.net/blog/1837/mysql-enums-and-booleans.html</link>
			<description>This is one i ran into a few years back, when an entire project was built on a database using ENUM&#39;s as bools. Unfortunately, it was for me to figure out what caused some weird bugs involved. This is a run-down of what happens when you actually use ENUM&#39;s as (evaluating) bools:

mysql&#38;gt; select &#39;0&#39;=0, &#39;1&#39;=1, 0=&#39;0&#39;, 1=&#39;1&#39;;
+-------+-------+-------+-------+
| &#39;0&#39;=0 | &#39;1&#39;=1 | 0=&#39;0&#39; | 1=&#39;1&#39; |
+-------+-------+-------+-------+
|     1 |     1 |     1 |     1 |
+-------+-------+-------+-------+
1 row in set (0.00 sec)

ENUM&#39;s store strings, right? Let&#39;s use them for booleans. 

CREATE TEMPORARY TABLE t(b ENUM(&#39;0&#39;,&#39;1&#39;) NOT NULL);

Shouldn&#39;t be a problem.

mysql&#38;gt; insert into t(b) values(1), (0);
Query OK, 2 rows affected, 1 warning (0.01 sec)
Records: 2  Duplicates: 0  Warnings: 1

mysql&#38;gt; select * from t;
+---+
| b |
+---+
| 0 |
|   |
+---+
2 rows in set (0.00 sec)
Hmm.... 
mysql&#38;gt; select b,b=1,b=0 from t;
+---+-----+-----+
| b | b=1 | b=0 |
+---+-----+-----+
| 0 |   1 |   0 |
|   |   0 |   1 |
+---+-----+-----+
2 rows in set (0.00 sec)What ...  How ... 

Well....

mysql&#38;gt; truncate t;
Query OK, 0 rows affected (0.00 sec)

mysql&#38;gt; insert into t values(&#39;1&#39;),(&#39;0&#39;);
Query OK, 2 rows affected (0.00 sec)
Records: 2  Duplicates: 0  Warnings: 0

mysql&#38;gt; select * from t;
+---+
| b |
+---+
| 1 |
| 0 |
+---+
2 rows in set (0.00 sec)Phew  

mysql&#38;gt; select b,b=1,b=0 from t;
+---+-----+-----+
| b | b=1 | b=0 |
+---+-----+-----+
| 1 |   0 |   0 |
| 0 |   1 |   0 |
+---+-----+-----+
2 rows in set (0.00 sec)Excuse... what.... what?!  

Let&#39;s see....

mysql&#38;gt; select b,IF(b,1,0),IF(b=1,1,0) from t;
+---+-----------+-------------+
| b | IF(b,1,0) | IF(b=1,1,0) |
+---+-----------+-------------+
| 1 |         1 |           0 |
| 0 |         1 |           1 |
+---+-----------+-------------+
2 rows in set (0.00 sec)
  

mysql&#38;gt; SELECT NOT(b) FROM t;
+--------+
| NOT(b) |
+--------+
|      0 |
|      0 |
+--------+
2 rows in set (0.00 sec)

...

So, to sum up, please use INT&#39;s for bools, not enums. And if you do care to use enum&#39;s for whatever reason, never use numeric values to imply int-to-bool casting in expressions.</description>
			<author>drm</author>
			<category>7</category>
			<comments>http://drm.tweakblogs.net/blog/1837/mysql-enums-and-booleans.html#reacties</comments>
			<guid isPermaLink="false">http://drm.tweakblogs.net/blog/1837</guid>
			<pubDate>Sat, 23 May 2009 10:23:00 GMT</pubDate>
		</item>
	</channel>
</rss>