<?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>LogikDevelopment &#187; Tricks</title>
	<atom:link href="http://www.logikdev.com/category/tricks/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.logikdev.com</link>
	<description>&#34;Il n&#039;y a pas de problème, il n&#039;y a que des solutions. L&#039;esprit de l&#039;homme invente ensuite le problème.&#34; André Gide</description>
	<lastBuildDate>Tue, 20 Dec 2011 12:25:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Use ServerXMLHTTP through a proxy</title>
		<link>http://www.logikdev.com/2010/07/07/use-serverxmlhttp-through-proxy/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=use-serverxmlhttp-through-proxy</link>
		<comments>http://www.logikdev.com/2010/07/07/use-serverxmlhttp-through-proxy/#comments</comments>
		<pubDate>Wed, 07 Jul 2010 19:22:17 +0000</pubDate>
		<dc:creator>smoreau</dc:creator>
				<category><![CDATA[Tricks]]></category>
		<category><![CDATA[VBScript]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[proxycfg tool]]></category>
		<category><![CDATA[ServerXMLHTTP]]></category>

		<guid isPermaLink="false">http://www.logikdev.com/?p=647</guid>
		<description><![CDATA[The other day, I was trying to use the ServerXMLHTTP object. For information, this object was created to allow you to establish server-to-server HTTP connections. The code I firstly wrote looked like the following: with sURL the URL to call and sParams the parameters to send with the URL. The problem was that oXMLHTTP.responseText didn&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>The other day, I was trying to use the <strong>ServerXMLHTTP</strong> object. For information, this object was created to allow you to establish server-to-server HTTP connections.</p>
<p>The code I firstly wrote looked like the following:</p>
<pre class="brush: vb; title: ; notranslate">
Dim oXMLHTTP
Set oXMLHTTP = Server.CreateObject(&quot;MSXML2.ServerXMLHTTP&quot;)
oXMLHTTP.open &quot;POST&quot;, sURL, false
oXMLHTTP.setRequestHeader &quot;Content-Type&quot;, &quot;application/x-www-form-urlencoded&quot;
oXMLHTTP.send sParams
Response.Write oXMLHTTP.responseText
</pre>
<p>with <code>sURL</code> the URL to call and <code>sParams</code> the parameters to send with the URL.</p>
<p>The problem was that <code>oXMLHTTP.responseText</code> didn&#8217;t return anything. Or to be exact, it returned an empty string, which was obviously not the expected response&#8230; <img src='http://www.logikdev.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p>After some investigation, it appeared that the problem was because the server was seating behind a proxy. All this is good and well, but the question now is how to tell the application to use the proxy?<br />
<br/><br />
First of all, the ServerXMLHTTP object has a <code>setProxy</code> method:<br />
<a href="http://msdn.microsoft.com/en-us/library/ms760236(v=VS.85).aspx">http://msdn.microsoft.com/en-us/library/ms760236(v=VS.85).aspx</a><br />
So I tried to add the following line to the previous code:</p>
<pre class="brush: vb; title: ; notranslate">
oXMLHTTP.setProxy 2, &quot;myProxyServer:80&quot;, &quot;&quot;
</pre>
<p>Unfortunately, this didn&#8217;t fix the problem. It looks like this line is simply ignored. If somebody knows why, please tell me! <img src='http://www.logikdev.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /><br />
<br/><br />
So the solution I finally adopted was to configure the proxy through the <strong>proxycfg</strong> tool.<br />
There are two ways of using this tool:</p>
<ul>
<li>Import the proxy settings from the current user&#8217;s Microsoft Internet Explorer manual settings using the command <code>proxycfg.exe -u</code></li>
<li>Configure the proxy settings manually using the command <code>proxycfg -p myProxyServer:80</code></li>
</ul>
<p>This last solution works for me and I hope it will help a few people. <img src='http://www.logikdev.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
<br/><br />
<strong>PS:</strong> I found the following page when writing this article: <a href="http://support.microsoft.com/kb/289481/">http://support.microsoft.com/kb/289481/</a>. It would have been so good to find it during my investigation but anyway.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.logikdev.com/2010/07/07/use-serverxmlhttp-through-proxy/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>limitToList attribute prevents flashing</title>
		<link>http://www.logikdev.com/2010/03/02/limittolist-attribute-prevents-flashing/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=limittolist-attribute-prevents-flashing</link>
		<comments>http://www.logikdev.com/2010/03/02/limittolist-attribute-prevents-flashing/#comments</comments>
		<pubDate>Tue, 02 Mar 2010 18:56:36 +0000</pubDate>
		<dc:creator>smoreau</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Tricks]]></category>
		<category><![CDATA[Ajax]]></category>
		<category><![CDATA[flash/twinkle]]></category>
		<category><![CDATA[limitToList]]></category>
		<category><![CDATA[RichFaces]]></category>

		<guid isPermaLink="false">http://www.logikdev.com/?p=395</guid>
		<description><![CDATA[If you have some elements (or even the whole page) that flash/twinkle using RichFaces, it probably means that these elements are AJAX-rendering. The question is by whom and how to fix it? A lot of tags in RichFaces can AJAX-render elements such as: On the above example, the JavaScript function updateName will AJAX-render the element which [...]]]></description>
			<content:encoded><![CDATA[<p>If you have some elements (or even the whole page) that flash/twinkle using RichFaces, it probably means that these elements are AJAX-rendering. The question is by whom and how to fix it?</p>
<p>A lot of tags in RichFaces can AJAX-render elements such as:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;a4j:form&gt;
    &lt;a4j:jsFunction name=&quot;updateName&quot; reRender=&quot;showname&quot;&gt;
        &lt;a4j:actionparam name=&quot;param1&quot; assignTo=&quot;#{userBean.name}&quot;  /&gt;
    &lt;/a4j:jsFunction&gt;
&lt;/a4j:form&gt;
</pre>
<p>On the above example, the JavaScript function <code>updateName</code> will AJAX-render the element which has the ID <code>showname</code>.</p>
<p>In some cases, you would have some elements that would AJAX-render without asking them to do so!<br />
I still didn&#8217;t figure it out why. <img src='http://www.logikdev.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' />  (if anybody has an idea, please don&#8217;t hesitate to tell me!)</p>
<p>But, I found a way to prevent this!<br />
You simply can add the following attribute to your tag:</p>
<pre class="brush: xml; light: true; title: ; notranslate">limitToList=&quot;true&quot;</pre>
<p>You even can add it to the tags that don&#8217;t have a <code>reRender</code> attribute.<br />
For example:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;a4j:form&gt;
    &lt;a4j:poll id=&quot;poll&quot; interval=&quot;1000&quot; limitToList=&quot;true&quot; /&gt;
&lt;/a4j:form&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.logikdev.com/2010/03/02/limittolist-attribute-prevents-flashing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why GROUP_CONCAT returns BLOB?</title>
		<link>http://www.logikdev.com/2010/02/11/why-group_concat-returns-blob/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=why-group_concat-returns-blob</link>
		<comments>http://www.logikdev.com/2010/02/11/why-group_concat-returns-blob/#comments</comments>
		<pubDate>Thu, 11 Feb 2010 19:11:46 +0000</pubDate>
		<dc:creator>smoreau</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Tricks]]></category>
		<category><![CDATA[blob]]></category>
		<category><![CDATA[group_concat()]]></category>
		<category><![CDATA[group_concat_max_len]]></category>
		<category><![CDATA[varchar]]></category>

		<guid isPermaLink="false">http://www.logikdev.com/?p=340</guid>
		<description><![CDATA[Last week, when using the GROUP_CONCAT() function on a MySQL database, I got an unexpected result. Indeed, instead of getting my result as VARCHAR types, I got it as BLOB types! For information, a BLOB is a binary large object that can hold a variable amount of data: http://dev.mysql.com/doc/refman/5.0/en/blob.html Because BLOB values are treated as binary [...]]]></description>
			<content:encoded><![CDATA[<p>Last week, when using the <code>GROUP_CONCAT()</code> function on a MySQL database, I got an unexpected result. <img src='http://www.logikdev.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p>Indeed, instead of getting my result as <code>VARCHAR</code> types, I got it as <code>BLOB</code> types! For information, a <code>BLOB</code> is a binary large object that can hold a variable amount of data:<br />
<a href="http://dev.mysql.com/doc/refman/5.0/en/blob.html" target="_blank">http://dev.mysql.com/doc/refman/5.0/en/blob.html</a><br />
Because <code>BLOB</code> values are treated as binary strings, it is not easy to use. This is why we would prefer to have <code>VARCHAR</code> values.</p>
<p>So the question is how to get around this frustrating problem?</p>
<p>The answer is, for once, very simple! <img src='http://www.logikdev.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /><br />
You simply need to:</p>
<ul>
<li>Open your my.ini or my.cnf file;</li>
<li>Change the value of the <code>group_concat_max_len</code> system variable to 512 (no &#8216;k&#8217; suffix);</li>
<li>Restart the mysql service</li>
</ul>
<p>To verify if the value has been successfully updated, execute the following command in your mysql client:</p>
<pre class="brush: sql; light: true; title: ; notranslate">
mysql&gt; show variables like &quot;%concat%&quot;;
+----------------------+-------+
| Variable_name        | Value |
+----------------------+-------+
| group_concat_max_len | 512   |
+----------------------+-------+
1 row in set (0.00 sec)
</pre>
<p>Note that you cannot set the value of <code>group_concat_max_len</code> to less than 1Kb using the MySQL Administrator GUI. Which means that the only way to set this system variable to 512 (which is less than 1Kb) is to edit your MySQL configuration file as described above.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.logikdev.com/2010/02/11/why-group_concat-returns-blob/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Deploy your app to the root context</title>
		<link>http://www.logikdev.com/2010/01/06/deploy-your-app-to-the-root-context/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=deploy-your-app-to-the-root-context</link>
		<comments>http://www.logikdev.com/2010/01/06/deploy-your-app-to-the-root-context/#comments</comments>
		<pubDate>Wed, 06 Jan 2010 20:10:49 +0000</pubDate>
		<dc:creator>smoreau</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Tricks]]></category>
		<category><![CDATA[root context]]></category>
		<category><![CDATA[Tomcat]]></category>

		<guid isPermaLink="false">http://www.logikdev.com/?p=243</guid>
		<description><![CDATA[This is an easy trick which I am sure most of you already know. Let&#8217;s take a Java application called MyAddressBook. Its generated war file could be called myaddressbook.war. By default, when you deploy this web application to Tomcat, the URL to access it will be http://localhost:8080/myaddressbook/. And if you point a domain name such [...]]]></description>
			<content:encoded><![CDATA[<p>This is an easy trick which I am sure most of you already know.</p>
<p>Let&#8217;s take a Java application called MyAddressBook. Its generated war file could be called <code>myaddressbook.war</code>.</p>
<p>By default, when you deploy this web application to Tomcat, the URL to access it will be <em>http://localhost:8080/myaddressbook/</em>. And if you point a domain name such as &#8216;addressbook.com&#8217; to this server, the URL would be <em>http://addressbook.com/myaddressbook/</em>.</p>
<p>I don&#8217;t know for you but I don&#8217;t like to systematically have the subfolder &#8216;myaddressbook&#8217; after my domain. But maybe I am too picky! <img src='http://www.logikdev.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>The idea is to deploy our application in the Tomcat root context.<br />
You have two ways of doing this:</p>
<ul>
<li>Define a <code>ROOT.xml</code> file in your <code>conf/Catalina/localhost</code> folder, or;</li>
<li>Rename your war file to <code>ROOT.war</code>.</li>
</ul>
<p>Note that the case is important, it has to be ROOT in <strong>UPPERCASE</strong>! <img src='http://www.logikdev.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Once this is done, you will be able to call your application via the URL <em>http://localhost:8080/</em><br />
or <em>http://addressbook.com/</em>.  Way better! <img src='http://www.logikdev.com/wp-includes/images/smilies/icon_cool.gif' alt='8-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.logikdev.com/2010/01/06/deploy-your-app-to-the-root-context/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Be careful of SKIP_COMMENTS</title>
		<link>http://www.logikdev.com/2009/12/01/be-careful-of-skip_comments/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=be-careful-of-skip_comments</link>
		<comments>http://www.logikdev.com/2009/12/01/be-careful-of-skip_comments/#comments</comments>
		<pubDate>Tue, 01 Dec 2009 20:25:33 +0000</pubDate>
		<dc:creator>smoreau</dc:creator>
				<category><![CDATA[Tricks]]></category>
		<category><![CDATA[Facelets]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[old browsers]]></category>
		<category><![CDATA[SKIP_COMMENTS]]></category>

		<guid isPermaLink="false">http://www.logikdev.com/?p=147</guid>
		<description><![CDATA[In the early days, we used to hide JavaScript code from old browsers that do not support JavaScript. The way of doing this was to put a one-line HTML-style comment without the closing characters immediately after the opening &#60;script&#62; tag and put //--&#62; at the end of the script. For example: However if you are [...]]]></description>
			<content:encoded><![CDATA[<p>In the early days, we used to hide JavaScript code from old browsers that do not support JavaScript.<br />
The way of doing this was to put a one-line HTML-style comment without the closing characters immediately after the opening <code>&lt;script&gt;</code> tag and put <code>//--&gt;</code> at the end of the script.</p>
<p>For example:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;script type=&quot;text/javascript&quot;&gt;
&lt;!--
alert('Test');
//--&gt;
&lt;/script&gt;
</pre>
<p>However if you are using this trick with the initialization parameter <code>facelets.SKIP_COMMENTS</code> set to <strong>true</strong>, the code between <code>&lt;!--</code> and <code>//--&gt;</code> won&#8217;t even be sent to the client!<br />
It simply means that the code above won&#8217;t open an alert window because it has been skipped during the page rendering.</p>
<p>Here is what the client will receive:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;script type=&quot;text/javascript&quot;&gt;
&lt;!--
//--&gt;
&lt;/script&gt;
</pre>
<p><br/>You have two solutions to avoid this situation:</p>
<ol>
<li>Set the <code>SKIP_COMMENTS</code> parameter to false (the default is true). This can&#8217;t really hurt, your page will just be heavier depending on how much HTML comments you put on your page;</li>
<li>No need to hide the JavaScript code as all browsers are now supporting it and over 99.9% of users have it enabled &#8211; this is the solution I chose.</li>
</ol>
<p>For information, below is the code to put in your web.xml file to set the <code>SKIP_COMMENTS</code> parameter to false:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;context-param&gt;
    &lt;param-name&gt;facelets.SKIP_COMMENTS&lt;/param-name&gt;
    &lt;param-value&gt;false&lt;/param-value&gt;
&lt;/context-param&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.logikdev.com/2009/12/01/be-careful-of-skip_comments/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

