<?xml version="1.0" encoding="UTF-8"?>

<rss version='2.0' 
     xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule"
     xmlns:doap="http://usefulinc.com/ns/doap#"
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">

    <channel>
        <!-- This XML Feed shows details for the page Gotchas 
             and everything recently tagged Gotchas -->
        <creativeCommons:license>http://creativecommons.org/licenses/by-sa/2.5/
          </creativeCommons:license>
        <title>Gotchas on SWiK</title>
        <doap:name>Gotchas</doap:name>
        <doap:description></doap:description>
        <description></description> 
	  <!-- see doap:description for full description -->
        <link>http://swik.net/Gotchas</link>
        <doap:homepage></doap:homepage>
        
        <pubDate></pubDate>
        <lastBuildDate></lastBuildDate>
            
        <item>
            <title>[from fuzzyfrog] Java gotchas - OWASP</title>
            <link>http://swik.net/User:jeyrb/del.icio.us%2Fnetwork%2Fjey/%5Bfrom+fuzzyfrog%5D+Java+gotchas+-+OWASP/cc49m</link>
            <description></description>
            
            <pubDate>Fri, 29 Aug 2008 09:59:49 -0700</pubDate>
        </item>
            
        <item>
            <title>Two for the price of one</title>
            <link>http://swik.net/MySQL/Planet+MySQL/Two+for+the+price+of+one/ccw0p</link>
            <description>&lt;p&gt;Haven&amp;#8217;t done any sneaky puzzles in a while. How would you accomplish this?&lt;/p&gt;
&lt;pre&gt;mysql&gt; CREATE TABLE t1 (id int);
Query OK, 0 rows affected (0.08 sec)

mysql&gt; INSERT INTO t1 VALUES (1);
Query OK, 1 row affected (0.02 sec)

mysql&gt; SELECT COUNT(*) FROM t1;
+----------+
| COUNT(*) |
+----------+
|        2 |
+----------+
1 row in set (0.00 sec)&lt;/pre&gt;</description>
            
            <pubDate>Tue, 19 Aug 2008 11:35:00 -0700</pubDate>
        </item>
            
        <item>
            <title>Git Error: trailing whitespace, indent SP followed by a TAB, unresolved merge conflict | Its all about RubyOnRails(ROR)</title>
            <link>http://swik.net/git/del.icio.us+tag%2Fgit/Git+Error%3A+trailing+whitespace%2C+indent+SP+followed+by+a+TAB%2C+unresolved+merge+conflict+%7C+Its+all+about+RubyOnRails%28ROR%29/cctjj</link>
            <description>Was gettng the whitespace trailing error. Removed the pre-commit file from the .git folder of the project and then could run git commit -m &amp;quot;message&amp;quot; correctly. This happens on my machine only</description>
            
            <pubDate>Mon, 18 Aug 2008 10:05:49 -0700</pubDate>
        </item>
            
        <item>
            <title>Kiwi Grails: Grails with Jboss and log4j</title>
            <link>http://swik.net/JBoss/del.icio.us+tag%2Fjboss/Kiwi+Grails%3A+Grails+with+Jboss+and+log4j/cav06</link>
            <description></description>
            
            <pubDate>Sun, 20 Jul 2008 10:46:13 -0700</pubDate>
        </item>
            
        <item>
            <title>James Lorenzen&#039;s Blog: Grails: Lessons Learned</title>
            <link>http://swik.net/Hibernate/del.icio.us+tag%2Fhibernate/James+Lorenzen%27s+Blog%3A+Grails%3A+Lessons+Learned/cav00</link>
            <description></description>
            
            <pubDate>Sun, 20 Jul 2008 10:46:07 -0700</pubDate>
        </item>
            
        <item>
            <title>Grails and Eclipse: Not So Groovy &quot; Brain Flush</title>
            <link>http://swik.net/Eclipse/del.icio.us%2Ftag%2Feclipse/Grails+and+Eclipse%3A+Not+So+Groovy+%22+Brain+Flush/b7348</link>
            <description></description>
            
            <pubDate>Mon, 23 Jun 2008 07:04:45 -0700</pubDate>
        </item>
            
        <item>
            <title>James Lorenzen&#039;s Blog: How to create a release using the maven2 release plugin</title>
            <link>http://swik.net/Maven/del.icio.us%2Ftag%2Fmaven/James+Lorenzen%27s+Blog%3A+How+to+create+a+release+using+the+maven2+release+plugin/b7k7t</link>
            <description></description>
            
            <pubDate>Mon, 16 Jun 2008 03:20:59 -0700</pubDate>
        </item>
            
        <item>
            <title>Can&#039;t get courier daemon to login mysql? - Ubuntu Forums</title>
            <link>http://swik.net/Postfix/del.icio.us%2Ftag%2Fpostfix/Can%27t+get+courier+daemon+to+login+mysql%3F+-+Ubuntu+Forums/b5zbe</link>
            <description>Got it to work, whitespace at the end of the config lines....ergh</description>
            
            <pubDate>Wed, 28 May 2008 07:09:43 -0700</pubDate>
        </item>
            
        <item>
            <title>GFWiki: TroubleshootingGuide</title>
            <link>http://swik.net/GlassFish/del.icio.us%2Ftag%2Fglassfish/GFWiki%3A+TroubleshootingGuide/b3rsx</link>
            <description></description>
            
            <pubDate>Tue, 18 Mar 2008 11:43:07 -0700</pubDate>
        </item>
            
        <item>
            <title>J2EE and JEE News, Solutions and Tips</title>
            <link>http://swik.net/Hibernate/del.icio.us+tag%2Fhibernate/J2EE+and+JEE+News%2C+Solutions+and+Tips/b1p2a</link>
            <description></description>
            
            <pubDate>Thu, 24 Jan 2008 09:01:00 -0800</pubDate>
        </item>
            
        <item>
            <title>SHOW VARIABLES Shows Variables MySQL Does Not Know About</title>
            <link>http://swik.net/MySQL/Planet+MySQL/SHOW+VARIABLES+Shows+Variables+MySQL+Does+Not+Know+About/bzxmv</link>
            <description>The listing of Dynamic System Variables on the MySQL Reference Manual&amp;#8217;s page is supposed to show those variables you can change on-the-fly.
innodb_data_home_dir is listed there as a dynamic variable, but it is not one, and trying to change it on-the-fly doesn&amp;#8217;t work: 

mysql&gt; set global innodb_data_home_dir=&quot;/data/mysql/data&quot;;
ERROR 1193 (HY000): Unknown system variable &#039;innodb_data_home_dir&#039;

mysql&gt; set session innodb_data_home_dir=&quot;/data/mysql/data&quot;;
ERROR [...]</description>
            
            <pubDate>Tue, 08 Jan 2008 13:28:56 -0800</pubDate>
        </item>
            
        <item>
            <title>Taking UFS new places safely with ZFS zvols - Multiple Threads : Phil Harman&#039;s Weblog</title>
            <link>http://swik.net/zfs/del.icio.us%2Ftag%2Fzfs/Taking+UFS+new+places+safely+with+ZFS+zvols+-+Multiple+Threads+%3A+Phil+Harman%27s+Weblog/bo060</link>
            <description>things to know before running UFS on a ZVOL</description>
            
            <pubDate>Thu, 04 Oct 2007 04:02:31 -0700</pubDate>
        </item>
            
        <item>
            <title>Multiple Threads : Phil Harman&#039;s Weblog</title>
            <link>http://swik.net/zfs/del.icio.us%2Ftag%2Fzfs/Multiple+Threads+%3A+Phil+Harman%27s+Weblog/bonb6</link>
            <description>things to know before running UFS on a ZVOL</description>
            
            <pubDate>Mon, 01 Oct 2007 17:21:02 -0700</pubDate>
        </item>
            
        <item>
            <title>HOWTO Avoid Being Called a Bozo When Producing XML</title>
            <link>http://swik.net/XML/del.icio.us%2Ftag%2Fxml/HOWTO+Avoid+Being+Called+a+Bozo+When+Producing+XML/bljbf</link>
            <description></description>
            
            <pubDate>Sun, 02 Sep 2007 15:31:11 -0700</pubDate>
        </item>
            
        <item>
            <title>Views and Social Engineering</title>
            <link>http://swik.net/MySQL/Planet+MySQL/Views+and+Social+Engineering/bdypu</link>
            <description>&lt;pre style=&quot;background-color: #EEEEEE;&quot;&gt;
CREATE TABLE secretData (
	secretValue int COMMENT &#039;If this goes over 5, WWIII will start&#039;
);

CREATE SQL SECURITY DEFINER VIEW censoredData AS
SELECT * FROM secretData WHERE secretValue 
&lt;p&gt;&amp;lt;telephone&amp;gt; ring ring&lt;/p&gt;
&lt;p&gt;&amp;lt;sysadmin&amp;gt; &amp;#8220;Hello?&amp;#8221;&lt;/p&gt;
&lt;p&gt;&amp;lt;evilFiend&amp;gt; &amp;#8220;I&amp;#8217;d like to create an insertable view on some tables I already have rights to. I don&amp;#8217;t know just yet what I&amp;#8217;ll use for my select statement.&amp;#8221;&lt;/p&gt;
&lt;p&gt;&amp;lt;sysadmin&amp;gt; &amp;#8220;Ok. I&amp;#8217;ll set it up so you can do what you&amp;#8217;d like.&amp;#8221;&lt;/p&gt;
&lt;pre style=&quot;background-color: #EEEEEE;&quot;&gt;
CREATE SQL SECURITY INVOKER VIEW evilFiendsView AS SELECT 1;
GRANT SELECT, INSERT, ALTER ON test.evilFiendsView TO &#039;evilFiend&#039;@&#039;%&#039;;
&lt;/pre&gt;
&lt;p&gt;&lt;img src=&quot;http://www.gardenmob.com/snidely-whiplash.jpg&quot; alt=&quot;Evil Fiend&quot; width=&quot;100&quot; style=&quot;margin-left: 10px;&quot;/&gt;&lt;/p&gt;
&lt;p&gt;evilFiend connects to the server, while twiddling the end of his handlebar mustache.&lt;/p&gt;
&lt;pre style=&quot;background-color: #EEEEEE;&quot;&gt;
ALTER VIEW evilFiendsView AS
SELECT * FROM censoredData WITH LOCAL CHECK OPTION;

INSERT INTO evilFiendsView VALUES (42);
&lt;/pre&gt;
&lt;p&gt;Muhahaha!&lt;/p&gt;</description>
            
            <pubDate>Wed, 11 Jul 2007 15:28:47 -0700</pubDate>
        </item>
            
        <item>
            <title>snoyes: Messing with LAST_INSERT_ID()</title>
            <link>http://swik.net/MySQL/Planet+MySQL/snoyes%3A+Messing+with+LAST_INSERT_ID%28%29/bdhzb</link>
            <description>&lt;p&gt;Time for another MySQL Community Quiz:&lt;/p&gt;
&lt;p&gt;Everybody knows that LAST_INSERT_ID() returns the value most recently created in an auto_increment column. Fewer of us know that you can pass a value to LAST_INSERT_ID(), and that value will be returned for the next call to LAST_INSERT_ID().  For example,&lt;/p&gt;
&lt;pre&gt;INSERT INTO table (someNonAutoIncrementField) VALUES (LAST_INSERT_ID(42));
SELECT LAST_INSERT_ID();&lt;/pre&gt;
&lt;p&gt;The INSERT inserts &amp;#8216;42&amp;#8242; into the table, and the SELECT returns 42.&lt;/p&gt;
&lt;p&gt;So, here&amp;#8217;s the question: What if we pass an expression to LAST_INSERT_ID and also use an auto_increment field in the same statement?&lt;/p&gt;
&lt;pre&gt;CREATE TABLE test (id int auto_increment primary key, field int);
INSERT INTO test (id, field) VALUES (NULL, LAST_INSERT_ID(42));
SELECT LAST_INSERT_ID();&lt;/pre&gt;
&lt;p&gt;&lt;a href=&quot;javascriptvoid(null);&quot;&gt;Show Answer &amp;#9660;&lt;/a&gt;&lt;/p&gt;
&lt;div id=&quot;SID338817072&quot; style=&quot;display:none;&quot;&gt;
&lt;p&gt;You get the auto_increment field, at least in this case:&lt;/p&gt;
&lt;pre&gt;mysql&gt; INSERT INTO test (id, field) VALUES (NULL, LAST_INSERT_ID(42));
Query OK, 1 row affected (0.08 sec)

mysql&gt; SELECT LAST_INSERT_ID();
+------------------+
| LAST_INSERT_ID() |
+------------------+
|                1 |
+------------------+
1 row in set (0.00 sec)&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;And for a follow up, does it matter if you swap the insertion around?&lt;/p&gt;
&lt;pre&gt;INSERT INTO test (field, id) VALUES (LAST_INSERT_ID(42), NULL);
SELECT LAST_INSERT_ID();&lt;/pre&gt;
&lt;p&gt;&lt;a href=&quot;javascriptvoid(null);&quot;&gt;Show Answer &amp;#9660;&lt;/a&gt;&lt;/p&gt;
&lt;div id=&quot;SID329974528&quot; style=&quot;display:none;&quot;&gt;
&lt;p&gt;Nope.&lt;/p&gt;
&lt;pre&gt;mysql&gt; INSERT INTO test (field, id) VALUES (LAST_INSERT_ID(42), NULL);
Query OK, 1 row affected (0.08 sec)

mysql&gt; SELECT LAST_INSERT_ID();
+------------------+
| LAST_INSERT_ID() |
+------------------+
|                2 |
+------------------+
1 row in set (0.00 sec)&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;The manual warns about mixing LAST_INSERT_ID() and LAST_INSERT_ID(expr). This may fall under that same caveat.&lt;/p&gt;</description>
            
            <pubDate>Sun, 08 Jul 2007 20:20:13 -0700</pubDate>
        </item>
            
        <item>
            <title>snoyes: Views and Social Engineering</title>
            <link>http://swik.net/MySQL/Planet+MySQL/snoyes%3A+Views+and+Social+Engineering/bdhyt</link>
            <description>&lt;pre style=&quot;background-color: #EEEEEE;&quot;&gt;
CREATE TABLE secretData (
	secretValue int COMMENT &#039;If this goes over 5, WWIII will start&#039;
);

CREATE SQL SECURITY DEFINER VIEW censoredData AS
SELECT * FROM secretData WHERE secretValue 
&lt;p&gt;&amp;lt;telephone&amp;gt; ring ring&lt;/p&gt;
&lt;p&gt;&amp;lt;sysadmin&amp;gt; &amp;#8220;Hello?&amp;#8221;&lt;/p&gt;
&lt;p&gt;&amp;lt;evilFiend&amp;gt; &amp;#8220;I&amp;#8217;d like to create an insertable view on some tables I already have rights to. I don&amp;#8217;t know just yet what I&amp;#8217;ll use for my select statement.&amp;#8221;&lt;/p&gt;
&lt;p&gt;&amp;lt;sysadmin&amp;gt; &amp;#8220;Ok. I&amp;#8217;ll set it up so you can do what you&amp;#8217;d like.&amp;#8221;&lt;/p&gt;
&lt;pre style=&quot;background-color: #EEEEEE;&quot;&gt;
CREATE SQL SECURITY INVOKER VIEW evilFiendsView AS SELECT 1;
GRANT SELECT, INSERT, ALTER ON test.evilFiendsView TO &#039;evilFiend&#039;@&#039;%&#039;;
&lt;/pre&gt;
&lt;p&gt;&lt;img src=&quot;http://www.gardenmob.com/snidely-whiplash.jpg&quot; alt=&quot;Evil Fiend&quot; width=&quot;100&quot; style=&quot;margin-left: 10px;&quot;/&gt;&lt;/p&gt;
&lt;p&gt;evilFiend connects to the server, while twiddling the end of his handlebar mustache.&lt;/p&gt;
&lt;pre style=&quot;background-color: #EEEEEE;&quot;&gt;
ALTER VIEW evilFiendsView AS
SELECT * FROM censoredData WITH LOCAL CHECK OPTION;

INSERT INTO evilFiendsView VALUES (42);
&lt;/pre&gt;
&lt;p&gt;Muhahaha!&lt;/p&gt;</description>
            
            <pubDate>Sun, 08 Jul 2007 20:20:06 -0700</pubDate>
        </item>
            
        <item>
            <title>TracOnDreamhost</title>
            <link>http://swik.net/Trac/del.icio.us%2Ftag%2Ftrac/TracOnDreamhost/8m63</link>
            <description>This posting helped me fixed issues i was having after i followed natmaster&#039;s guide to installing trac on Dreamhost.  
http://natmaster.com/articles/installing_trac_0.10.php</description>
            
            <pubDate>Mon, 28 May 2007 07:40:12 -0700</pubDate>
        </item>
            
        <item>
            <title>lessrain blog  » Blog Archive   » Flash: Nasty XML load bug in Internet Explorer</title>
            <link>http://swik.net/XML/del.icio.us%2Ftag%2Fxml/lessrain+blog++%C2%BB+Blog+Archive+++%C2%BB+Flash%3A+Nasty+XML+load+bug+in+Internet+Explorer/6hsj</link>
            <description></description>
            
            <pubDate>Tue, 08 May 2007 12:54:11 -0700</pubDate>
        </item>
            
        <item>
            <title>Access Control Quiz</title>
            <link>http://swik.net/MySQL/Planet+MySQL/Access+Control+Quiz/3sic</link>
            <description>&lt;p&gt;First, the setup:&lt;/p&gt;
&lt;pre&gt;CREATE TABLE `user` (
  `user` varchar(255) DEFAULT NULL,
  `host` varchar(255) DEFAULT NULL,
  `sort` int(11) DEFAULT NULL
);

INSERT INTO `user`
	(`user`, `host`, `sort`)
VALUES
	(&#039;&#039;,&#039;%&#039;,8),
	(&#039;testUser&#039;,&#039;%&#039;,7),
	(&#039;&#039;,&#039;%localhost&#039;,9),
	(&#039;testUser&#039;,&#039;%localhost&#039;,5),
	(&#039;&#039;,&#039;%localhost%&#039;,10),
	(&#039;testUser&#039;,&#039;%localhost%&#039;,6),
	(&#039;&#039;,&#039;localhost&#039;,2),
	(&#039;testUser&#039;,&#039;localhost&#039;,1),
	(&#039;&#039;,&#039;localhost%&#039;,4),
	(&#039;testUser&#039;,&#039;localhost%&#039;,3);&lt;/pre&gt;
&lt;p&gt;Now, the quiz:&lt;/p&gt;
&lt;pre&gt;SELECT * FROM user ORDER BY ___&lt;/pre&gt;
&lt;p&gt;Fill in the blank to get the following output. Difficulty: the `sort` field may not appear anywhere in the query.&lt;/p&gt;
&lt;pre&gt;+----------+-------------+------+
| user     | host        | sort |
+----------+-------------+------+
| testUser | localhost   |    1 |
|          | localhost   |    2 |
| testUser | localhost%  |    3 |
|          | localhost%  |    4 |
| testUser | %localhost  |    5 |
| testUser | %localhost% |    6 |
| testUser | %           |    7 |
|          | %           |    8 |
|          | %localhost  |    9 |
|          | %localhost% |   10 |
+----------+-------------+------+&lt;/pre&gt;</description>
            
            <pubDate>Mon, 16 Apr 2007 15:37:21 -0700</pubDate>
        </item>
            
        <item>
            <title>Capital. Just capital.</title>
            <link>http://swik.net/MySQL/Planet+MySQL/Capital.+Just+capital./0ymt</link>
            <description>&lt;p&gt;Culled from the Certification Study Guide:&lt;/p&gt;
&lt;pre&gt;mysql&gt; SELECT * FROM test;
+----------------+
| data           |
+----------------+
| This is a test |
+----------------+
1 row in set (0.00 sec)

mysql&gt; SELECT UPPER(data) FROM test;
+----------------+
| UPPER(data)    |
+----------------+
| This is a test |
+----------------+
1 row in set (0.03 sec)&lt;/pre&gt;
&lt;p&gt;How&amp;#8217;s that work?&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;javascriptvoid(null);&quot;&gt;Show Answer &amp;#9660;&lt;/a&gt;&lt;/p&gt;
&lt;div id=&quot;SID1699447349&quot; style=&quot;display:none;&quot;&gt;
&lt;pre&gt;
 CREATE TABLE `test` (
   `data` varbinary(255) default NULL
 );
&lt;/pre&gt;
&lt;p&gt;Binary strings are just a list of bytes. They aren&amp;#8217;t characters anymore, so there is no upper or lower case. Remember that when choosing between char/varchar/text and binary/varbinary/blob.
&lt;/div&gt;</description>
            
            <pubDate>Wed, 21 Mar 2007 08:33:47 -0700</pubDate>
        </item>
            
        <item>
            <title>Firefox and Flash SWF selection and focus problems</title>
            <link>http://swik.net/Firefox/del.icio.us%2Ftag%2Ffirefox/Firefox+and+Flash+SWF+selection+and+focus+problems/pmd6</link>
            <description></description>
            
            <pubDate>Sat, 18 Nov 2006 04:25:31 -0800</pubDate>
        </item>
            
        <item>
            <title>Here Be Dragons</title>
            <link>http://swik.net/MySQL/Planet+MySQL/Here+Be+Dragons/mtle</link>
            <description>&lt;p&gt;I have a table of maps:&lt;/p&gt;
&lt;pre&gt;CREATE TABLE map (
	mapName varchar(255),
	mapType ENUM(&#039;continent&#039;, &#039;region&#039;, &#039;country&#039;),
	continent varchar(255) NULL,
	region varchar(255) NULL,
	country varchar(255) NULL
);
INSERT INTO map VALUES
	(&#039;Europe&#039;, &#039;continent&#039;, &#039;Europe&#039;, NULL, NULL),
	(&#039;North America&#039;, &#039;continent&#039;, &#039;North America&#039;, NULL, NULL),
	(&#039;Northern Hemisphere&#039;, &#039;region&#039;, NULL, &#039;Northern Hemisphere&#039;, NULL),
	(&#039;Sweden&#039;, &#039;country&#039;, NULL, NULL, &#039;Sweden&#039;),
	(&#039;Mexico&#039;, &#039;country&#039;, NULL, NULL, &#039;Mexico&#039;);&lt;/pre&gt;
&lt;p&gt;And a table of locations:&lt;/p&gt;
&lt;pre&gt;CREATE TABLE locations (
	locationId int auto_increment primary key,
	continent varchar(255),
	region varchar(255),
	country varchar(255)
);

INSERT INTO locations VALUES
	(NULL, &#039;Europe&#039;, &#039;Northern Hemisphere&#039;, &#039;Sweden&#039;),
	(NULL, &#039;North America&#039;,  &#039;Northern Hemisphere&#039;, &#039;Canada&#039;),
	(NULL, &#039;North America&#039;,  &#039;Pacific Northwest&#039;, &#039;USA&#039;);&lt;/pre&gt;
&lt;p&gt;Obviously, this example is denormalized - in the real world, I&amp;#8217;d use a surrogate key and store continentId, regionId, and countryId. Even then, it&amp;#8217;s not the ideal layout for this application. But that&amp;#8217;s just part of the challenge.&lt;/p&gt;
&lt;p&gt;Here&amp;#8217;s the goal: find the most specific map for each location. By most specific, I mean use a country map if available. If not, use a region map. Use a continent map as a last resort.&lt;/p&gt;
&lt;p&gt;So, the result set should be:&lt;/p&gt;
&lt;pre&gt;+------------+---------------------+
| locationId | mapName             |
+------------+---------------------+
|          1 | Sweden              |
|          2 | Northern Hemisphere |
|          3 | North America       |
+------------+---------------------+&lt;/pre&gt;
&lt;p&gt;Bonus points if it works pre-4.1&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;javascriptvoid(null);&quot;&gt;Hint &amp;#9660;&lt;/a&gt;&lt;/p&gt;
&lt;div id=&quot;SID1229568454&quot; style=&quot;display:none;&quot;&gt;
&lt;p&gt;Note the definition of map.mapType. In particular, the order of the values.&lt;/p&gt;
&lt;p&gt;Then take a gander at &lt;a href=&quot;http://dev.mysql.com/doc/refman/4.1/en/examples.html&quot;&gt;section 3.6&lt;/a&gt; of the manual.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;&lt;a href=&quot;javascriptvoid(null);&quot;&gt;Show Answer &amp;#9660;&lt;/a&gt;&lt;/p&gt;
&lt;div id=&quot;SID454747702&quot; style=&quot;display:none;&quot;&gt;
&lt;pre&gt;SELECT
	locationId,
	m.mapName
FROM
	locations l
	JOIN map m ON (
		l.continent = m.continent
		OR l.region = m.region
		OR l.country = m.country
	)
	LEFT JOIN map m2 ON (
		(l.continent = m2.continent
		OR l.region = m2.region
		OR l.country = m2.country)
		AND CAST(m.mapType AS unsigned) 
&lt;/div&gt;</description>
            
            <pubDate>Mon, 09 Oct 2006 15:24:51 -0700</pubDate>
        </item>
            
        <item>
            <title>Empty Set Equality</title>
            <link>http://swik.net/MySQL/Planet+MySQL/Empty+Set+Equality/l7tv</link>
            <description>&lt;pre&gt;SELECT 1 LIMIT 0;
Empty set (0.00 sec)

SELECT 2 LIMIT 0;
Empty set (0.00 sec)

SELECT NULL LIMIT 0;
Empty set (0.00 sec)&lt;/pre&gt;
&lt;p&gt;Exactly what I&amp;#8217;d expect. So here&amp;#8217;s the question:&lt;/p&gt;
&lt;pre&gt;SELECT &#039;1 = 1&#039; AS equality, (SELECT 1 LIMIT 0) = (SELECT 1 LIMIT 0) AS result
UNION SELECT &#039;1 = 2&#039;, (SELECT 1 LIMIT 0) = (SELECT 2 LIMIT 0)
UNION SELECT &#039;1 = NULL&#039;, (SELECT 1 LIMIT 0) = (SELECT NULL LIMIT 0);&lt;/pre&gt;
&lt;p&gt;What do you think? Are all empty sets created identical?&lt;br/&gt;
&lt;a href=&quot;javascriptvoid(null);&quot;&gt;Show Answer &amp;#9660;&lt;/a&gt;&lt;/p&gt;
&lt;div id=&quot;SID478052851&quot; style=&quot;display:none;&quot;&gt;
MySQL says no.&lt;/p&gt;
&lt;pre&gt;+----------+--------+
| equality | result |
+----------+--------+
| 1 = 1    |      1 |
| 1 = 2    |      0 |
| 1 = NULL |   NULL |
+----------+--------+&lt;/pre&gt;
&lt;/div&gt;</description>
            
            <pubDate>Wed, 27 Sep 2006 10:14:49 -0700</pubDate>
        </item>
            
        <item>
            <title>[#SEC-239] Concerns regarding Acegi ACL support - Spring Framework</title>
            <link>http://swik.net/Acegi/del.icio.us+tag%2Facegi/%5B%23SEC-239%5D+Concerns+regarding+Acegi+ACL+support+-+Spring+Framework/k7wu</link>
            <description>Experienced user listing some of the shortcomings of the current (1.0) Acegi ACL implementation.  A redesign is expected for 1.0.1.</description>
            
            <pubDate>Wed, 13 Sep 2006 08:12:34 -0700</pubDate>
        </item>
            
        <item>
            <title>Order By Puzzle</title>
            <link>http://swik.net/MySQL/Planet+MySQL/Order+By+Puzzle/jzzs</link>
            <description>&lt;p&gt;From a question on Freenode.&lt;/p&gt;
&lt;pre&gt;SELECT * FROM theTable;&lt;/pre&gt;
&lt;pre&gt;+----+----------+
| id | data     |
+----+----------+
|  1 | middle   |
|  2 | first    |
|  3 | showLast |
+----+----------+&lt;/pre&gt;
&lt;p&gt;Fair enough. Let&amp;#8217;s order it by `data`.&lt;/p&gt;
&lt;pre&gt;SELECT * FROM theTable ORDER BY data;&lt;/pre&gt;
&lt;pre&gt;+----+----------+
| id | data     |
+----+----------+
|  3 | showLast |
|  1 | middle   |
|  2 | first    |
+----+----------+&lt;/pre&gt;
&lt;p&gt;What??? Maybe the server didn&amp;#8217;t quite understand.&lt;/p&gt;
&lt;pre&gt;SELECT * FROM theTable ORDER BY data ASC;&lt;/pre&gt;
&lt;pre&gt;+----+----------+
| id | data     |
+----+----------+
|  3 | showLast |
|  1 | middle   |
|  2 | first    |
+----+----------+&lt;/pre&gt;
&lt;p&gt;How did that happen? I assure you I have not switched to some &amp;#8216;reverse order&amp;#8217; collation.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;javascriptvoid(null);&quot;&gt;Show Answer &amp;#9660;&lt;/a&gt;&lt;/p&gt;
&lt;div id=&quot;SID626361459&quot; style=&quot;display:none;&quot;&gt;
&lt;pre&gt;SHOW CREATE TABLE theTable;&lt;/pre&gt;
&lt;pre&gt;CREATE TABLE `thetable` (
  `id` int(11),
  `data` enum(&#039;showLast&#039;,&#039;middle&#039;,&#039;first&#039;)
)&lt;/pre&gt;
&lt;p&gt;Ah. `data` is an enum. ORDER BY on an enum orders by the enum index, not the string. You can order by CONCAT(data) or by CAST(data AS char). Are there better ways?
&lt;/div&gt;</description>
            
            <pubDate>Wed, 23 Aug 2006 08:45:34 -0700</pubDate>
        </item>
            
        <item>
            <title>LAST_INSERT_ID and multi-row inserts</title>
            <link>http://swik.net/MySQL/Planet+MySQL/LAST_INSERT_ID+and+multi-row+inserts/jxy5</link>
            <description>&lt;p&gt;A bit of a quiz to see if you&amp;#8217;re paying attention:&lt;/p&gt;
&lt;p&gt;First, we&amp;#8217;ll set up a couple tables with some auto increment fields:&lt;/p&gt;
&lt;pre&gt;CREATE TABLE t1 (id INT AUTO_INCREMENT, INDEX(id));
CREATE TABLE t2 (id INT AUTO_INCREMENT, refT1 INT, INDEX(id));&lt;/pre&gt;
&lt;p&gt;Next, we&amp;#8217;ll insert a row to one table:&lt;/p&gt;
&lt;pre&gt;INSERT INTO t1 VALUES (NULL);&lt;/pre&gt;
&lt;p&gt;Then, we&amp;#8217;ll see what happens when we insert two rows using LAST_INSERT_ID():&lt;/p&gt;
&lt;pre&gt;INSERT INTO t2 VALUES (LAST_INSERT_ID(), 1), (LAST_INSERT_ID(), 2);&lt;/pre&gt;
&lt;p&gt;What happens here? Did the insert go ok, or did we get an error? What happens if we now issue&lt;/p&gt;
&lt;pre&gt;SELECT * FROM t2;&lt;/pre&gt;
&lt;p&gt;&lt;a href=&quot;javascriptvoid(null);&quot;&gt;Show Answer &amp;#9660;&lt;/a&gt;&lt;/p&gt;
&lt;div id=&quot;SID693198879&quot; style=&quot;display:none;&quot;&gt;
No errors, because we defined the auto_increment field for t2 not as a primary or unique key, but just with index. Remember that LAST_INSERT_ID() only picks up the last value you inserted using NULL, and not explicitly defined values. So we get two copies of the value &amp;#8216;1&amp;#8242; in our id field.&lt;/p&gt;
&lt;pre&gt;+----+-------+
| id | refT1 |
+----+-------+
|  1 |     1 |
|  1 |     2 |
+----+-------+&lt;/pre&gt;
&lt;/div&gt;</description>
            
            <pubDate>Tue, 22 Aug 2006 14:46:01 -0700</pubDate>
        </item>
            
        <item>
            <title> I&#039;ve got my space back : /devices/pseudo/bitbucket@0:bitbucket</title>
            <link>http://swik.net/zfs/del.icio.us%2Ftag%2Fzfs/+I%27ve+got+my+space+back+%3A+%2Fdevices%2Fpseudo%2Fbitbucket%400%3Abitbucket/g12c</link>
            <description></description>
            
            <pubDate>Tue, 11 Jul 2006 18:05:29 -0700</pubDate>
        </item>
            
        <item>
            <title>Using hibernate.hbm2ddl.auto=update and HSQL in Equinox</title>
            <link>http://swik.net/Hibernate/del.icio.us+tag%2Fhibernate/Using+hibernate.hbm2ddl.auto%3Dupdate+and+HSQL+in+Equinox/d033</link>
            <description>I ran into a few issues when upgrading Equinox to use Spring 1.2 RC1 and Hibernate 3. The main problem is that hibernate.hbm2ddl.auto=update does not work with an in-memory HSQL version that allows more than one connection. Since Equinox represents all th</description>
            
            <pubDate>Tue, 23 May 2006 16:46:30 -0700</pubDate>
        </item>
            
        <item>
            <title>Rocky Shoals of Ajax Development</title>
            <link>http://swik.net/User:alex/Alex+Bosworth%27s+Weblog/Rocky+Shoals+of+Ajax+Development/dc2q</link>
            <description>&lt;p&gt;A year ago, I started a list of &lt;a href=&quot;http://www.sourcelabs.com/ajb/archives/2005/05/ajax_mistakes.html&quot;&gt;Ajax&lt;/a&gt; Mistakes that &lt;a href=&quot;http://alexbosworth.backpackit.com/pub/67688&quot;&gt;grew&lt;/a&gt; and eventually &lt;a href=&quot;http://swik.net/Ajax/Ajax+Mistakes&quot;&gt;moved to a collaborative page&lt;/a&gt;, where other people could post or edit what they saw as issues in Ajax development.&lt;/p&gt;


	&lt;p&gt;That list focuses on basic application design mistakes when working with Ajax, such as breaking the back button and using &lt;span class=&quot;caps&quot;&gt;GET&lt;/span&gt; and &lt;span class=&quot;caps&quot;&gt;POST&lt;/span&gt; requests improperly.&lt;/p&gt;


	&lt;p&gt;But the specifics of Ajax development are equally perilous to basic application design. The siren&amp;#8217;s call of the XMLHTTPRequest object can lead many brave scripters to a demise on the rocky shoals of browser limitations and bugs.&lt;/p&gt;


	&lt;p&gt;So in the interests of charting out these limitations and bugs, I&amp;#8217;ve started another list devoted to these limitations, quirks, and bugs. It&amp;#8217;s separated into 3 parts: Basic Browsers, IE, and Firefox.&lt;/p&gt;


	&lt;p&gt;Again, this post will live on in a &lt;a href=&quot;http://swik.net/Ajax/Ajax-Development-Gotchas&quot;&gt;collaborative wiki page&lt;/a&gt; for future updates.&lt;/p&gt;


&lt;h2&gt;Basic Browser quirks and limitations&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;XMLHttpRequest can&amp;#8217;t access remote servers&lt;/strong&gt;. For some odd reason, although there are ways in javascript to send and receive data to remote servers, such as through script or iframe elements, &lt;em&gt;XMLHTTPRequest cannot have a remote server as a target&lt;/em&gt;. This is a basic cross browser security rule that may not be immediately obvious to the newcomer to Ajax development.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Multiple Ajax Requests are not fired in order&lt;/strong&gt;. IE, breaking from a long tradition of ignoring independent standards, chooses to follow the &lt;span class=&quot;caps&quot;&gt;HTTP 1&lt;/span&gt;.1 &lt;a href=&quot;http://www.faqs.org/rfcs/rfc2616.html&quot;&gt;&lt;span class=&quot;caps&quot;&gt;RFC 2616&lt;/span&gt;&lt;/a&gt; to the letter, which means that IE may only have two XMLHTTPRequests open at a time; after which IE will retain an internal queue of requests &lt;em&gt;which will be serviced in no particular order&lt;/em&gt;. Even if the requests are fired in order, the nature of the internet dictates that they will not be received in order, so never write code that assumes xmlhttprequests will be sent in a particular order.
&lt;ul&gt;&lt;li&gt;Firefox also has a similar albeit more liberal limitation in the number of simultaneous xmlhttprequests that may be open; however In Firefox 1.5, the developer may &lt;a href=&quot;http://developer.mozilla.org/en/docs/Changing_the_Priority_of_HTTP_Requests&quot;&gt;modify the priority&lt;/a&gt; of the internal request queue.&lt;/li&gt;&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Asynchronous XMLHTTPRequests responses will arrive in no particular order&lt;/strong&gt;. As implied by the word Asynchronous, XMLHTTPRequest responses may arrive at any time in an unpredictable order that is ignorant of developer intent, happily executing callbacks in the random order in which they eventually wind up on the client.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;XMLHTTPRequest does not requires the use of &lt;span class=&quot;caps&quot;&gt;XML&lt;/span&gt;&lt;/strong&gt;. While Ajax is aptly named when it comes to asynchronous execution, it is poorly named when it comes to &lt;span class=&quot;caps&quot;&gt;XML&lt;/span&gt;. The XMLHTTPRequest object has a useful method called responseText that delivers the straight text of the response, be it &lt;span class=&quot;caps&quot;&gt;XML&lt;/span&gt;, JSON or just simple unadorned text. Using &lt;span class=&quot;caps&quot;&gt;JSON&lt;/span&gt; or simple text can be much faster, easier, and more concise than &lt;span class=&quot;caps&quot;&gt;XML&lt;/span&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Ajax uses &lt;span class=&quot;caps&quot;&gt;UTF&lt;/span&gt;-8&lt;/strong&gt;. Normal forms are sent using the encoding of the parent page. Thus a &lt;span class=&quot;caps&quot;&gt;SJIS&lt;/span&gt; encoded page will default to sending form content encoded in &lt;span class=&quot;caps&quot;&gt;SJIS&lt;/span&gt;. Ajax submitted forms on the other hand will be sent as &lt;span class=&quot;caps&quot;&gt;UTF&lt;/span&gt;-8. If for some strange reason, &lt;span class=&quot;caps&quot;&gt;UTF&lt;/span&gt;-8 is not the character set of choice for the server, this will require a solution such as the server recognizing and translating &lt;span class=&quot;caps&quot;&gt;UTF&lt;/span&gt;-8 responses to a desired character encoding.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Ajax requests are url encoded&lt;/strong&gt;. A bug relating to this can currently be seen on &lt;a href=&quot;http://digg.com&quot;&gt;Digg.com&lt;/a&gt;. Submit a comment to digg, and then edit the comment to include a unicode character. The updated comment, sent via Ajax will be added to the database as the url encoded string: resulting in an odd looking url encoded comment.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;XMLHTTPRequest cannot transmit files&lt;/strong&gt;. In a javascript heavy application, a developer might need to include the ability to send files without completely refreshing the page. XMLHTTPRequest however does not include this ability. Instead, a hidden iframe can be used to send the file, and Javascript can simply inspect the iframe. Ajax techniques can further complement this, for example the open source project &lt;a href=&quot;http://swik.net/Uber-Uploader&quot;&gt;Uber-Uploader&lt;/a&gt; can show a progress bar while uploading a file.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;&lt;a class=&quot;wikilink&quot; href=&quot;http://swik.net/Firefox&quot;&gt;Firefox&lt;/a&gt; quirks or bugs&lt;/h2&gt;
&lt;ol&gt;&lt;li&gt;&lt;strong&gt;Synchronous XMLHTTPRequests lock up Firefox&lt;/strong&gt;. The XMLHTTPRequest method provides a third argument, which defines whether the Ajax requests are submitted synchronously or asynchronously. (&lt;span style=&quot;font-family:monospace;&quot;&gt;xmlhttprequest.open(&amp;#8216;GET&amp;#8217;, &amp;#8216;http://www.mozilla.org/&amp;#8217;, &lt;strong&gt;false&lt;/strong&gt;);&lt;/span&gt;) On Firefox, setting this value to false will submit the xmlhttprequest synchronously and lock up the entire browser.&lt;/li&gt;&lt;/ol&gt;

&lt;h2&gt;IE quirks or bugs&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;XMLHTTPRequest Objects are not reused in IE&lt;/strong&gt;. Unless the abort method is used, XMLHTTPRequest objects in IE won&amp;#8217;t function after the first use, unlike in other browsers such as Firefox. A solution to this is to create a new XMLHTTPRequest object for each connection, although some fear this causes memory leaks, there seems to be no conclusive proof of this, as long as the known closures memory leak issue is avoided, as detailed in the next gotcha.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;IE doesn&amp;#8217;t use cached images when Javascript inserts &lt;span class=&quot;caps&quot;&gt;HTML&lt;/span&gt; with images&lt;/strong&gt;. This is a general Javascript behavior, but with Ajax heavy applications that insert a lot of &lt;span class=&quot;caps&quot;&gt;HTML&lt;/span&gt; snippets, this can lead to a lot of unnecessary image redownloading. The way to solve this is to send all images with proper Cache-Control, ETag, and Last-Modified headers. IE will request images with a &amp;#8216;If-Modified-Since&amp;#8217; header and the server should send back a 304 header which will tell IE not to redownload the image, and use its cached image.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Closures with circular references in IE cause memory leaks&lt;/strong&gt;. It&amp;#8217;s common in Ajax to use closures, however in IE if a closure has a circular reference, it will cause IE to start leaking memory. In Javascript it&amp;#8217;s easy to create closures with circular references, so care should be taken to avoid memory leaks.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Avoiding aggressive caching in IE&lt;/strong&gt; &amp;#8211; even with proper &amp;#8216;no-cache&amp;#8217; headers, IE caches get requests &amp;#8211; this can be solved by changing the get request query string with every request.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;IE corrupts gzipped javascript files&lt;/strong&gt;. Although this is a more general issue with IE&amp;#8217;s handling of gzipped content, in Ajax applications where there is a lot of Javascript, developers may be tempted to gzip their javascript to allow for faster page loading and lowered bandwidth consumption. However IE has a known bug where it cuts off downloads in mid-file, corrupting the javascript file.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;IE doesn&amp;#8217;t cache gzipped Javascript files&lt;/strong&gt;. Adding to IE&amp;#8217;s poor handling of gzipped content is IE&amp;#8217;s lack of support for simultaneous gzip and &lt;a href=&quot;http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html&quot;&gt;ETag&lt;/a&gt; cache headers. Again, this is wider scope than simply Javascript, but it means that even if IE didn&amp;#8217;t corrupt the gzipped javascript, it wouldn&amp;#8217;t cache it anyways.&lt;/li&gt;
&lt;/ol&gt;

	&lt;p&gt;I sometimes make mistakes, or overlook things. If you know of something that I&amp;#8217;ve overlooked or have found something that I&amp;#8217;m wrong about in this post, please contribute your knowledge &lt;a href=&quot;http://swik.net/Ajax/Ajax-Development-Gotchas&quot;&gt;directly to the wiki page&lt;/a&gt; for this list.&lt;/p&gt;


&lt;h2&gt;Further reading&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.bazon.net/mishoo/articles.epl?art_id=958&quot;&gt;more on IE image caching&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://jibbering.com/faq/faq_notes/closures.html&quot;&gt;more on closures&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://blog.metawrap.com/blog/IEClosuresLeaks.aspx&quot;&gt;even more on closures and memory leaks&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://developer.yahoo.com/javascript/howto-proxy.html&quot;&gt;why you need a proxy for cross domain xmlhttprequests
&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://swik.net/Ajax/Places+To+Use+Ajax&quot;&gt;Places to use Ajax&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://support.microsoft.com/default.aspx?scid=kb;en-us;823386&amp;#38;Product=ie600&quot;&gt;
IE Gzip corruption bug&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://channel9.msdn.com/wiki/default.aspx/Channel9.InternetExplorerBugs&quot;&gt;IE Bugs&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
            
            <pubDate>Sun, 30 Apr 2006 23:01:55 -0700</pubDate>
        </item>
                </channel>
</rss>
