<?xml version="1.0" encoding="utf-8"?>
<!-- generator="wordpress/2.0.4" -->
<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/"
	>

<channel>
	<title>jmones! com es, no fas nones?</title>
	<link>http://bloc.jmones.net</link>
	<description>No res, nomes dic el primer que se m'acudeix.</description>
	<pubDate>Sun, 26 Oct 2008 07:36:15 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.4</generator>
	<language>en</language>
			<item>
		<title>I love the STL</title>
		<link>http://bloc.jmones.net/2006/02/04/i-love-the-stl/</link>
		<comments>http://bloc.jmones.net/2006/02/04/i-love-the-stl/#comments</comments>
		<pubDate>Sat, 04 Feb 2006 19:30:13 +0000</pubDate>
		<dc:creator>jmones</dc:creator>
		
	<category>[en]</category>
	<category>Programació</category>
	<category>Formiguer</category>
		<guid isPermaLink="false">http://bloc.jmones.net/?p=209</guid>
		<description><![CDATA[C++ is a great language, specially the STL, templates and generic programming. I love it.
For instance, imagine that you have to wipe some data in vectors after its use. This is common in secure programming, to avoid sensible data to remain in memory longer than really needed.
It&#8217;s very easy, just program your own allocator:

#include &#60;memory&#62;

template [...]]]></description>
			<content:encoded><![CDATA[<p>C++ is a great language, specially the STL, templates and generic programming. I love it.</p>
<p>For instance, imagine that you have to wipe some data in vectors after its use. This is common in secure programming, to avoid sensible data to remain in memory longer than really needed.</p>
<p>It&#8217;s very easy, just program your own allocator:</p>
<pre>
#include &lt;memory&gt;

template &lt;class T&gt;
class wiper_allocator : public std::allocator&lt;T&gt;
{
 public:
  void deallocate(T* p, size_t n) {
    // we set memory to zero and the deallocate it
    (void) memset(p, 0, sizeof(T)*n);
    std::allocator&lt;T&gt;::deallocate(p, n);
  };
};
</pre>
<p>Then, if you are declaring unsigned char vectors this way, for instance:</p>
<pre>
std::vector&lt;unsigned char&gt; my_vector;
</pre>
<p>You must just change it like this:</p>
<pre>
std::vector&lt;unsigned char, wiper_allocator&lt;unsigned char&gt; &gt; my_vector;
</pre>
<p>And it&#8217;s done! Data is automatically wiped on deallocation! You&#8217;ll never forget!</p>
<p>You could also wipe data when object is destroyed, but it&#8217;s a little bit more resource intensive, and some STL libraries (Microsoft&#8217;s for instance) don&#8217;t work well this way.</p>
<p>Of course you can improve this one. For instance, you may want to avoid memset, because disassembler tools usually recognize footprints of common functions. You could use your own inline version to make it safer.</p>
<p>You could also also allocate non-swappable memory, so that sensible data is not paged to disk. But this requires non-c++-standard calls to operating system services.</p>
<p>C++ and the STL are huge subjects, but when you get into them, you&#8217;ll love them too!</p>
]]></content:encoded>
			<wfw:commentRSS>http://bloc.jmones.net/2006/02/04/i-love-the-stl/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>Flirting with monism</title>
		<link>http://bloc.jmones.net/2005/07/04/flirting-with-monism/</link>
		<comments>http://bloc.jmones.net/2005/07/04/flirting-with-monism/#comments</comments>
		<pubDate>Mon, 04 Jul 2005 18:24:48 +0000</pubDate>
		<dc:creator>jmones</dc:creator>
		
	<category>Música</category>
	<category>Petites coses</category>
	<category>[en]</category>
	<category>Formiguer</category>
		<guid isPermaLink="false">http://bloc.jmones.net/2005/07/04/flirting-with-monism/</guid>
		<description><![CDATA[Julian &#8216;Cannonball&#8217; Adderly introducing Josef Erich Zawinul theme Mercy, Mercy, Mercy at the fake club in Chicago which turned out to be at Capitol Records in L.A.:

You know, sometimes we are not prepared for adversity.
When it happens sometimes we&#8217;re caught short.
We don&#8217;t know exactly how to handle it when it comes up.
Sometimes we don&#8217;t know [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://en.wikipedia.org/wiki/Julian_Cannonball_Adderley">Julian &#8216;Cannonball&#8217; Adderly</a> introducing <a href="http://en.wikipedia.org/wiki/Zawinul">Josef Erich Zawinul</a> theme Mercy, Mercy, Mercy at the fake club in Chicago which turned out to be at Capitol Records in L.A.:</p>
<blockquote><p>
You know, sometimes we are not prepared for adversity.<br />
When it happens sometimes we&#8217;re caught short.<br />
We don&#8217;t know exactly how to handle it when it comes up.<br />
Sometimes we don&#8217;t know just what to do<br />
when adversity takes over.<br />
And I have advise for all of us<br />
I got it from my pianist Joe Zawinul who wrote this tune.<br />
And it sounds like what you&#8217;re supposed to say<br />
when you have any kind of problem.</p>
<p>It&#8217;s called Mercy, Mercy, Mercy.
</p></blockquote>
<p><strong>P.S.:</strong> I was about to but tickets for Joe Zawinul at Grec Festival, in Barcelona, but it&#8217;s the same day the company I work for celebrates a dinner with all the workers. What a pity this unfortunate coincidence! Well&#8230; these dinners are fun too! <img src='http://bloc.jmones.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />
</p>
]]></content:encoded>
			<wfw:commentRSS>http://bloc.jmones.net/2005/07/04/flirting-with-monism/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>stegotation (ps&#8217;05 chronicles hidden in a band list)</title>
		<link>http://bloc.jmones.net/2005/05/31/stegotation-ps05-chronicles-hidden-in-a-band-list/</link>
		<comments>http://bloc.jmones.net/2005/05/31/stegotation-ps05-chronicles-hidden-in-a-band-list/#comments</comments>
		<pubDate>Tue, 31 May 2005 00:15:08 +0000</pubDate>
		<dc:creator>jmones</dc:creator>
		
	<category>Altres llengües</category>
	<category>[en]</category>
	<category>Formiguer</category>
	<category>Seguretat</category>
		<guid isPermaLink="false">http://bloc.jmones.net/2005/05/31/stegotation-ps05-chronicles-hidden-in-a-band-list/</guid>
		<description><![CDATA[
L&#8217;esteganografia és l&#8217;art d&#8217;amagar dades en llocs insospitats, de manera que passin desapercebudes. He fet un petit programet que desa informació en l&#8217;ordre dels elements d&#8217;una llista. En una llista de n elements, hi ha n! formes d&#8217;ordenar-los. Per tant, hi caben fins a log2(n!) bits d&#8217;informació. Aquest programa aprofita això per desar una mini-llista [...]]]></description>
			<content:encoded><![CDATA[<div class="other_language_excerpt">
L&#8217;esteganografia és l&#8217;art d&#8217;amagar dades en llocs insospitats, de manera que passin desapercebudes. He fet un <a href="/files/stegotation.py">petit programet</a> que desa informació en l&#8217;ordre dels elements d&#8217;una llista. En una llista de n elements, hi ha n! formes d&#8217;ordenar-los. Per tant, hi caben fins a log2(n!) bits d&#8217;informació. Aquest programa aprofita això per desar una mini-llista dels grups que més m&#8217;han agradat al festival Primavera Sound 2005 (només tenia 68 caràcters i alguns s&#8217;han quedat fora) dins d&#8217;una llista de tots els grups que formaven el cartell.
</div>
<p>I find steganography (hiding information so that it remains unnoticed unless you know it&#8217;s there) a very interesting subject. If you read my blog you already know that.</p>
<p>I thought it would be great to hide data in lists of things. I could permutate the order of elements, so that information is contained in that order. If we have n elements in a list, we have n! permutations of those elements&#8230; so we can hide log2(n!) bits.</p>
<p>I&#8217;ve implemented a little program that does that. It&#8217;s called <a href="/files/stegotation.py">stegotation</a>. The worst part of implementing it was to convert from a binary stream to a mixed-base number (a permutation can be thought as a number that has a mixed-base in all its digits: n, n-1, n-2, &#8230;., 3, 2, 1). I had to do it as in school times: dividing. But the numbers are so big! Fortunately Python comes to the rescue with built-in multi-precision numbers. Great!</p>
<p>The program encodes the data as follows:</p>
<ul>
<li>It compresses the data using zlib.</li>
<li>Prepends a length field (2 bytes).</li>
<li>Pads with random data till we have floor(log2(n!)/8) bytes.</li>
<li>Converts this to a big number.</li>
<li>Converts this to a mixed-base number by dividing by 2, 3, 4, &#8230;.</li>
<li>Encodes these numbers as a word list.</li>
</ul>
<p>Decoding the data is just the same backwards.</p>
<p>I was about to add a password (to derive a symmetric key from it and encrypt data with it using, for instance, a stream cipher), but it would complicate everything if I want you to test it. It&#8217;s very easy to implement if you want.</p>
<p>Ok. Now the example. I have a list of bands that performed in the <a href="http://www.primaverasound.com/">Primavera Sound 2005</a> festival last weekend. It&#8217;s called <a href="/files/bandlist.txt">bandlist.txt</a>. Then I hide a message. It&#8217;s very short (because the list of bands is small), only a enumeration of some bands I liked.</p>
<pre class="source">
stegotation.py hide bandlist.txt chronicle.txt bandlistwithhiddenmessage.txt
</pre>
<p>The resulting list is called <a href="/files/bandlistwithhiddenmessage.txt">bandlistwithhiddenmessage.txt</a>.</p>
<p>To recover the message, you only need to type:</p>
<pre class="source">
stegotation.py recover bandlistwithhiddenmessage.txt recovered.txt
</pre>
<p>I hope that someone will succeed in decoding the data and tells me which bands I liked. <img src='http://bloc.jmones.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRSS>http://bloc.jmones.net/2005/05/31/stegotation-ps05-chronicles-hidden-in-a-band-list/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>Dilbert&#8217;s Salary Theorem</title>
		<link>http://bloc.jmones.net/2005/04/05/dilberts-salary-theorem/</link>
		<comments>http://bloc.jmones.net/2005/04/05/dilberts-salary-theorem/#comments</comments>
		<pubDate>Tue, 05 Apr 2005 14:52:44 +0000</pubDate>
		<dc:creator>jmones</dc:creator>
		
	<category>Ximpleries</category>
	<category>[en]</category>
		<guid isPermaLink="false">http://bloc.jmones.net/2005/04/05/dilberts-salary-theorem/</guid>
		<description><![CDATA[M&#8217;ha arribat això per email via Magoo. És per pixar-s&#8217;hi!

Dilbert&#8217;s Salary Theorem
Engineers, Teachers, Programmers and Scientists can never earn as much salary as business executives and sales people.
This theorem can now be supported by a mathematical equation based on the following three postulates:

Postulate 1: Knowledge is Power (Knowledge=Power)
Postulate 2: Time is Money (Time=Money)
Postulate 3: (as [...]]]></description>
			<content:encoded><![CDATA[<p>M&#8217;ha arribat això per email via <a href="http://barcelonablogs.com/magoo/">Magoo</a>. És per pixar-s&#8217;hi!</p>
<blockquote>
<h4>Dilbert&#8217;s Salary Theorem</h4>
<p>Engineers, Teachers, Programmers and Scientists can never earn as much salary as business executives and sales people.</p>
<p>This theorem can now be supported by a mathematical equation based on the following three postulates:</p>
<ul>
<li><strong>Postulate 1:</strong> Knowledge is Power (Knowledge=Power)</li>
<li><strong>Postulate 2:</strong> Time is Money (Time=Money)</li>
<li><strong>Postulate 3:</strong> (as every Physics student knows) Power = Work/Time</li>
</ul>
<p>It therefore follows: Knowledge = Work / Time<br />
and since Time = Money,<br />
we have: Knowledge = Work / Money</p>
<p>Solving for Money, we get:  Money = Work / Knowledge</p>
<p>Thus, as Knowledge approaches zero, Money approaches infinity, regardless of the amount of Work done.</p>
<p><strong>Conclusion:</strong> The Less you Know, the More you Make</p>
</blockquote>
]]></content:encoded>
			<wfw:commentRSS>http://bloc.jmones.net/2005/04/05/dilberts-salary-theorem/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>Playing with images and MATLAB</title>
		<link>http://bloc.jmones.net/2005/03/18/playing-with-images-and-matlab/</link>
		<comments>http://bloc.jmones.net/2005/03/18/playing-with-images-and-matlab/#comments</comments>
		<pubDate>Fri, 18 Mar 2005 18:44:26 +0000</pubDate>
		<dc:creator>jmones</dc:creator>
		
	<category>Imatge</category>
	<category>[en]</category>
		<guid isPermaLink="false">http://bloc.jmones.net/2005/03/18/playing-with-images-and-matlab/</guid>
		<description><![CDATA[
Us presento el meu gat, Trasto, per jugar amb elements estructurants i operacions morfològiques utilitzant MATLAB. Primer utilitzant elements estructurants plans, després de no plans i, finalment, de formes diferents.

I know I said I wouldn&#8217;t use MATLAB again but Octave instead. I lied. This afternoon I was a little bit bored and began playing with [...]]]></description>
			<content:encoded><![CDATA[<div class="other_language_excerpt">
Us presento el meu gat, Trasto, per jugar amb elements estructurants i operacions morfològiques utilitzant MATLAB. Primer utilitzant elements estructurants plans, després de no plans i, finalment, de formes diferents.
</div>
<p>I know I said I wouldn&#8217;t use MATLAB again but Octave instead. I lied. This afternoon I was a little bit bored and began playing with images and tiny scripts (almost one-liners).</p>
<p>First of all, let me introduce you my cat. It&#8217;s called Trasto, a catalan word that means <em>piece of junk</em>, although in catalan it&#8217;s not as offensive as in English <img src='http://bloc.jmones.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<div class="imagecenter">
<img src="/media/gatoriginal.jpg" alt="Original image of my cat" />
</div>
<p>These are just a few quick experiments. The <em>leit motiv</em> of all is reducing colors of the image (although not much).</p>
<h4>Playing with flat structuring elements</h4>
<p>First of all I played with a disk structuring element. The intention was to make flat homogenous regions of color.</p>
<p>This is my first try:</p>
<pre class="source">
cn=4096;
cs=colorcube(cn);
t=ind2rgb(imerode(rgb2ind(i,cs),strel('disk',3)),cs);
</pre>
<p><code>t</code> looks like this:</p>
<div class="imagecenter">
<img src="/media/gaterodedisk3.jpg" alt="Image with erosion using a disk structuring element" />
</div>
<p>To smooth the image a little bit while presenving homogenous regions I used median filtering:</p>
<pre class="source">
t2(:,:,1)=medfilt2(t(:,:,1),[5 5]);
t2(:,:,2)=medfilt2(t(:,:,2),[5 5]);
t2(:,:,3)=medfilt2(t(:,:,3),[5 5]);
</pre>
<p>This is how <code>t2</code> looks like:</p>
<div class="imagecenter">
<img src="/media/gaterodedisk3median.jpg" alt="Image with erosion using a disk structuring element and median filtering" />
</div>
<p>Now the same image using 1024 colors. Keep in mind that palette of 1024 colors is made using colorcube, which doesn&#8217;t use image data to choose the values, so the resulting image has much less than 1024 colors. We could use some adaptative process to choose them if we wanted to, and we&#8217;d probably see that adjacents colors in the cat would be more similar from each other than they are now (and probably would happen just the opposite in other places).</p>
<div class="imagecenter">
<img src="/media/gaterodedisk3median1024colors.jpg" alt="Image with erosion using a disk structuring element, median filtering and 1024 colors" />
</div>
<h4>And what about non-flat structuring elements?</h4>
<p>Perhaps the image has too much detail to seek homogeneous colors. We could try to use non-flat structuring elements, like <em>ball</em>, and see what we get. For instance, let&#8217;s use <em>ball</em> with radius 2 and height 1.</p>
<pre class="source">
cn=1024;
cs=colorcube(cn);
t=ind2rgb(imerode(rgb2ind(i,cs),strel('ball',2,1)),cs);
</pre>
<div class="imagecenter">
<img src="/media/gaterodeball211024colors.jpg" alt="Image with erosion using a ball structuring element and 1024 colors" />
</div>
<p>We apply median filtering, as before:</p>
<div class="imagecenter">
<img src="/media/gaterodeball21median1024colors.jpg" alt="Image with erosion using a ball structuring element, median filtering and 1024 colors" />
</div>
<p>Using greater height values we can get funny things (for instance radius 5 and height 5) due to saturation:</p>
<div class="imagecenter">
<img src="/media/gaterodeball551024colors.jpg" alt="Image with erosion using a ball structuring element with radius 5 and height 5 and 1024 colors" />
</div>
<p>And with median filtering:</p>
<div class="imagecenter">
<img src="/media/gaterodeball55median1024colors.jpg" alt="Image with erosion using a ball structuring element with radius 5 and height 5, median filtering and 1024 colors" />
</div>
<h4>Texturing the image using shaped structuring elements</h4>
<p>What happens if we use a cross as a structuring element?</p>
<pre class="source">
cs=2048; t=ind2rgb(imerode(rgb2ind(i,colorcube(cs)), 
[1,0,0,0,1; 
 0,1,0,1,0; 
 0,0,1,0,0; 
 0,1,0,1,0; 
 1,0,0,0,1]), 
colorcube(cs));
</pre>
<div class="imagecenter">
<img src="/media/gatcrossstructuringelement.jpg" alt="Image with erosion using a cross-shaped structuring element" />
</div>
<p>Reducing the number of colors the effect is much more visible:</p>
<div class="imagecenter">
<img src="/media/gatcrossstructuringelement256colors.jpg" alt="Image with erosion using a cross-shaped structuring element and 256 colors" />
</div>
<p>We obviously don&#8217;t use median filtering here because we would eliminate the texturing effect of the crosses.</p>
<p>If we use horizontal lines as structuring elements,</p>
<pre class="source">
cs=256; t=ind2rgb(imerode(rgb2ind(i,colorcube(cs)), 
[1,1,1,1,1,1,1]), 
colorcube(cs));
</pre>
<p>, we get:</p>
<div class="imagecenter">
<img src="/media/gathorzlinestructuringelement256colors.jpg" alt="Image with erosion using a horizontal line structuring element and 256 colors" />
</div>
<p>Since my cat is called Trasto I&#8217;ll use T-shaped structuring elements:</p>
<pre class="source">
cs=256; t=ind2rgb(imerode(rgb2ind(i,colorcube(cs)), 
[0,0,1,1,1,0,0; 
 0,0,0,1,0,0,0; 
 0,0,0,1,0,0,0; 
 0,0,0,1,0,0,0; 
 0,0,0,1,0,0,0; 
 1,0,0,1,0,0,1; 
 1,1,1,1,1,1,1]), 
 colorcube(cs));
</pre>
<div class="imagecenter">
<img src="/media/gattshapedstructuringelement256colors.jpg" alt="Image with erosion using a T-shaped structuring element and 256 colors" />
</div>
<p><strong>Note:</strong> I didn&#8217;t realize when I saved all the images to JPEG format using <code>imwrite</code> that MATLAB has the default quality setting for JPEG very low. So you&#8217;ll see the &#8220;water&#8221; effect of JPEG in images. This is specially true for last images, crosses, lines and T should be all homogeneous.</p>
]]></content:encoded>
			<wfw:commentRSS>http://bloc.jmones.net/2005/03/18/playing-with-images-and-matlab/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>RSS feeds for any category</title>
		<link>http://bloc.jmones.net/2005/03/18/rss-feeds-for-any-category/</link>
		<comments>http://bloc.jmones.net/2005/03/18/rss-feeds-for-any-category/#comments</comments>
		<pubDate>Fri, 18 Mar 2005 15:39:07 +0000</pubDate>
		<dc:creator>jmones</dc:creator>
		
	<category>Meta</category>
	<category>[en]</category>
		<guid isPermaLink="false">http://bloc.jmones.net/2005/03/18/rss-feeds-for-any-category/</guid>
		<description><![CDATA[
He afegit feeds RSS per cadascuna de les categories i també categories pels posts en llengües diferents al català. Així, si algú no entén el català pot seleccionar només el que li interessa. O si algú només vol veure el que escric sobre les festes que fem pot fer-ho també.

I&#8217;ve followed Pere&#8217;s path to include [...]]]></description>
			<content:encoded><![CDATA[<div class="other_language_excerpt">
He afegit feeds <abbr>RSS</abbr> per cadascuna de les categories i també categories pels posts en llengües diferents al català. Així, si algú no entén el català pot seleccionar només el que li interessa. O si algú només vol veure el que escric sobre les festes que fem pot fer-ho també.
</div>
<p>I&#8217;ve followed <a href="http://bits.quintanasegui.com/arxius/2005/03/18/one-feed-per-category/">Pere&#8217;s path</a> to include <abbr>RSS</abbr> feeds for any category in this site, and also included categories for non-catalan languages which I&#8217;ve used in my posts till now: English, French and Spanish.</p>
<p>So, for instance, now you can see all posts I&#8217;ve written in English using:<br />
<a href="http://bloc.jmones.net/categories/altres-llengues/en/">http://bloc.jmones.net/categories/altres-llengues/en/</a>.</p>
<p>Or get its corresponding RSS feed to use your favourite aggregator:<br />
<a href="http://bloc.jmones.net/categories/altres-llengues/en/feed">http://bloc.jmones.net/categories/altres-llengues/en/feed</a>.</p>
]]></content:encoded>
			<wfw:commentRSS>http://bloc.jmones.net/2005/03/18/rss-feeds-for-any-category/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>Are experts wrong?</title>
		<link>http://bloc.jmones.net/2005/03/09/are-experts-wrong/</link>
		<comments>http://bloc.jmones.net/2005/03/09/are-experts-wrong/#comments</comments>
		<pubDate>Wed, 09 Mar 2005 02:33:24 +0000</pubDate>
		<dc:creator>jmones</dc:creator>
		
	<category>Programari lliure</category>
	<category>Cultura</category>
	<category>Filosofia barata</category>
	<category>Ciència</category>
	<category>[en]</category>
		<guid isPermaLink="false">http://bloc.jmones.net/2005/03/09/experts-are-biased/</guid>
		<description><![CDATA[
Utilitzant per primera vegada un programari de gestió de projectes me n&#8217;he adonat que no funciona de la manera que esperava, essent un neòfit de la matèria. La consulta posterior a la llista de correu del programa em fa pensar en quantes vegades els novells en un camp concret tenen idees diferents degut a que [...]]]></description>
			<content:encoded><![CDATA[<div class="other_language_excerpt">
Utilitzant per primera vegada un programari de gestió de projectes me n&#8217;he adonat que no funciona de la manera que esperava, essent un neòfit de la matèria. La consulta posterior a la llista de correu del programa em fa pensar en quantes vegades els novells en un camp concret tenen idees diferents degut a que no estan esbiaixats. També em pregunto si es pot confiar sempre en els experts.
</div>
<p>I&#8217;ve just begun using <a href="http://www.imendio.com/projects/planner/">Imendio Planner</a> (formerly known as Mr. Project) for project management at work. I&#8217;ve never used such kind of software before so I don&#8217;t really know how people usually work with it, but I <strong>do</strong> have some idea of what I need.</p>
<p>The program, though, works somewhat differently as I expected (if you are curious about the specific problem I have with it just scroll to the bottom of this post). I talked about it with Albert (a coworker), <a href="http://nirvanis.org">David</a> and <a href="http://bits.quintanasegui.com">Pere</a> and they all agreed with me that the program would be much more useful with that feature.</p>
<p>Afterwards I <a href="http://lists.imendio.com/pipermail/planner/2005-March/000547.html">posted a question</a> to the planner mailing list exposing this issue. People at the mailing list were very kind and commented possible solutions and workarounds. </p>
<p>After a few emails from different people, a poster <a href="http://lists.imendio.com/pipermail/planner/2005-March/000555.html">wrote</a> (I reproduce it here for your convenience since this email comes from a public mailing list):</p>
<blockquote><p>
&lt;rant&gt;<br />
It&#8217;s funny that what&#8217;s perfectly obvious to someone new to project management is ignored by most experts.</p>
<p>I have to agree with Josep that any tool that does project management has to make resource constraints a first-order problem, and not an afterthought. I&#8217;ve yet to see any widely used tool that does this; Primavera, MS Project, etc don&#8217;t do it, they all require you to go through hoops to do resource leveling and most of the time you end up having to create artificial temporal dependencies such as the suggestion given to Josep. These dependencies are at best a workaround, but in practice they can be detrimental to the project because they obscure the possibility of doing tasks in parallel by the &#8220;simple&#8221; addition of resources to a task, in practice, as the project progresses you figure out that the link is artificial and often end up doing the task in<br />
parallel anyway, thereby throwing your hands in the air and saying: &#8220;screw this project plan&#8221;, or even worse, spending another couple of hours redoing the whole thing (and then an hour&#8217;s meeting explaining the &#8220;new and improved&#8221; project plan to the team.</p>
<p>Which is why there exist better methodologies than Critical Path analysis (yeah, I know, I repeat myself) such as Critical Chain management, that take into account resource constraints from the beginning.<br />
&lt;/rant&gt;
</p></blockquote>
<p>To be honest, several people replied to him with good arguments. My intention is not to assess which view is right. Probably it is not, but it could be, at least potentially, one of those situations in which &#8220;experts are biased&#8221; because of too much experience, or too many preconceptions, &#8230;</p>
<p>Experts often are right, but be aware because there are several cases in which they could in fact be wrong: </p>
<ul>
<li>Experts can be biased because of experience, academic knowledge, and so on&#8230;</li>
<li>Sometimes experts don&#8217;t question opinions of other experts because it could turn out that they were wrong.</li>
<li>Sometimes an expert achieves so much reputation that colleagues don&#8217;t even think he/she could be wrong.</li>
<li>Even worse, experts tend to elect other experts just because they hold the same opinions as themselves.</li>
<li>Experts could have obscure reasons to be wrong on purpose (possibly, of course).</li>
<li>Experts may be corrupt.</li>
<li>(if you can imagine more reasons please comment on it)</li>
</ul>
<p>So trust experts, but also trust yourself.</p>
<h4>Technicalities</h4>
<p>The problem I had is that my project had tasks which didn&#8217;t have any logical connection between them and which were assigned to the same work resource (a person).</p>
<p>The software schedules these tasks concurrently, which is not wrong for me, but it calculates time to complete both tasks by looking independently which one will end up later. This would mean that the worker would have to work twice as fast, or 16 hours a day (instead of eight).</p>
<p>In my opinion, the program could either schedule them sequentially by calculating which tasks means a harder constraint to the project as a hole (because of possibly having dependent tasks) or just do something less intelligent, like assigning half the resource to each task and double the duration for both. There are more strategies that the program could adopt but these two come up immediately.</p>
<p>Proposed solutions were:</p>
<ol>
<li>Addition of a dependency between the two tasks. I didn&#8217;t like this much because this dependency only arises because of the resource problem, but it&#8217;s not a real dependency. If I decided to assign one of those tasks to another resource I would need to manually remove that dependency.</li>
<li>Assigning half the resource to each task manually. The problem with this is that it&#8217;s difficult to implement in a case as simple as having to tasks, A and B, which need an amount of work of 5 and 8 hours. Since I would assign half the resource to each, that would mean working 10 days on both concurrently, and working 6 more days (only half-time) to task B.</li>
</ol>
<p>I&#8217;m possibly overlooking something but this feature looked as something obvious to all people I&#8217;ve talked to about it. Please don&#8217;t hesitate to comment on this.</p>
]]></content:encoded>
			<wfw:commentRSS>http://bloc.jmones.net/2005/03/09/are-experts-wrong/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>How to make a photo look as a drawing (the silly way)</title>
		<link>http://bloc.jmones.net/2005/03/02/how-to-make-a-photo-look-as-a-drawing-the-silly-way/</link>
		<comments>http://bloc.jmones.net/2005/03/02/how-to-make-a-photo-look-as-a-drawing-the-silly-way/#comments</comments>
		<pubDate>Wed, 02 Mar 2005 22:20:31 +0000</pubDate>
		<dc:creator>jmones</dc:creator>
		
	<category>Imatge</category>
	<category>[en]</category>
		<guid isPermaLink="false">http://bloc.jmones.net/?p=35</guid>
		<description><![CDATA[I&#8217;ve been asked to explain how I converted the photo of our friend singing and playing her guitar into something that barely resembles a handmade drawing. This isn&#8217;t, of course, anything original and a lot of image editors have a function to do it, but I prefer it to follow the longest path because I&#8217;m [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been asked to explain how I converted the photo of our friend singing and playing her guitar into something that barely resembles a handmade drawing. This isn&#8217;t, of course, anything original and a lot of image editors have a function to do it, but I prefer it to follow the <em>longest path</em> because I&#8217;m a masochist.</p>
<p>To do this I used MATLAB with Image Processing Toolbox functions. There&#8217;s also a free software counterpart (<a href="http://www.octave.org">GNU Octave</a>) that has a lot of <a href="http://octave.sourceforge.net/index/image.html">image processing functions</a> in the <a href="http://octave.sourceforge.net">Octave Forge</a> project, but I thought I would need grayscale dilation and erotion, thus I decided to use the propietary MATLAB (hey! it won&#8217;t happen again! I promise). This probably will run well in Octave though, if we consider the subtle differences in <code>imread</code> behaviour (it doesn&#8217;t return a MxNx3 matrix, but 3 matrices, one for each color plane instead), and handle the fact that <code>imresize</code> function is missing (perhaps <code>interp2</code> could work as a replacement for this task).</p>
<p>First of all you can see the original image (resized to a smaller size) here:</p>
<div class="imagecenter">
<img src="/media/asoriginal.jpg" alt="Original image" />
</div>
<div class="separator"></div>
<p>I&#8217;ll focus on the amplifier and the mixing desk which are on the right so I can include the images without having to resize them:</p>
<div class="imagecenter">
<img src="/media/asdetail.jpg" alt="Detail of the amplifier and the mixing desk in the original image" />
</div>
<div class="separator"></div>
<p>The first step was to open the original image and convert it to grayscale:</p>
<pre class="source">
%% Read original image
i=imread('campaneta.jpg');

%% Convert it to grayscale
a=rgb2gray(i);
</pre>
<div class="imagecenter">
<img src="/media/asgrayscale.jpg" alt="Detail of the mixing desk in the original image as a grayscale image" />
</div>
<div class="separator"></div>
<div class="left_column">
Afterwards I resized the resulting image to a size easier to handle (half in each direction):</p>
<pre class="source">
%% Resize it to a more usable format
b=imresize(a,.5,'bicubic');
</pre>
</div>
<div class="right_column_centered">
<img src="/media/asmiddlesize.jpg" alt="Detail of the mixing desk in the original image resized to a smaller size" />
</div>
<div class="separator"></div>
<div class="left_column">
Since the original image was taken from a digital camera I used a basic contrast stretching. Probably some kind of filtering would help increase quality of the final result (in addition to the filtering that bicubic resizing already does):</p>
<pre class="source">
%% Adjust contrast
d=imadjust(b);
</pre>
</div>
<div class="right_column_centered">
<img src="/media/ascontrast.jpg" alt="Image after contrast stretching" />
</div>
<div class="separator"></div>
<p>Then I used four different methods to obtain the edges of the image (Canny, Sobel, Roberts and zero crossing detection):</p>
<pre class="source">
%% Get edges using 4 different methods
bw1=edge(d,'canny');
bw2=edge(d,'sobel');
bw3=edge(d,'roberts');
bw4=edge(d,'zerocross');
</pre>
<div class="separator"></div>
<p>You can see the results of these operations here:</p>
<table class="centered">
<tr>
<td>
<img src="/media/ascanny.png" alt="Canny edge detection" /><br />
Canny
</td>
<td>
<img src="/media/assobel.png" alt="Sobel edge detection" /><br />
Sobel
</td>
</tr>
<tr>
<td>
<img src="/media/asroberts.png" alt="Roberts edge detection" /><br />
Roberts
</td>
<td>
<img src="/media/aszerocross.png" alt="Zero crossing edge detection" /><br />
Zero crossing
</td>
</tr>
</table>
<div class="separator"></div>
<div class="left_column">
After that I combined the edges into one image. The trick is to sum all results and then normalize (and I actually negate the image to obtain a white background). This way, the places where all edge detectors get an edge are black, and pixels become brighter depending on how many edge detectors get an edge in it.</p>
<pre class="source">
%% We sum all edges and then
%% normalize it and negate it
bwr=1-(double(bw1)+double(bw2)+
        double(bw3)+double(bw4))/4;
</pre>
</div>
<div class="right_column_centered">
<img src="/media/asedgeresult.png" alt="All edge detection added" />
</div>
<div class="separator"></div>
<div class="left_column">
It can be seen that some pixels are unconnected. Perhaps a closing morphological operation could be used here to solve this (or, even better, before combining the images). I simply resized the image because I needed a smaller one, and the bicubic operation did the trick.
</div>
<div class="right_column_centered">
<img src="/media/assmallsize.png" alt="All edge detection added and resized" />
</div>
<p><br clear="all" /></p>
<pre class="source">
%% resizes image to 300 pixel-width, its final size
prefinal=imresize(bwr,300/744,'bicubic');
</pre>
<div class="separator"></div>
<div class="left_column">
Now you can see that the image is too much bright. That can be solved simply by using a contrast stretching operation.
</div>
<div class="right_column_centered">
<img src="/media/asresultstretch.png" alt="All edge detection added and resized and contrast stretched" />
</div>
<p><br clear="all" /></p>
<pre class="source">
%% auto-stretches image contrast
final=imadjust(prefinal);
</pre>
<div class="separator"></div>
<p>This is how the whole image looks like.</p>
<div class="imagecenter">
<img src="/media/asresult.png" alt="The whole resulting image"  />
</div>
<div class="separator"></div>
<p>There&#8217;s only one thing left: drawing a border to the image, because leaving all those lines open doesn&#8217;t look very good. After that <code>imwrite</code> saves the image to disk.</p>
<pre class="source">
%% 1 pixel wide black border
s=size(final);
final(1,:)=0;
final(s(1),:)=0;
final(:,1)=0;
final(:,s(2))=0;

%% write result to disk
imwrite(final, 'neverland_fairy.png');
</pre>
<p>The result doesn&#8217;t look bad (if you take into account that this is automatable and doesn&#8217;t need any hand-editing), don&#8217;t you agree? </p>
<div class="imagecenter">
<img src="/media/asresultborder.png" alt="The whole resulting image with a thin black border" />
</div>
<p>Perhaps it would be nice to try to stick with only one edge detector method and play with its threshold. If you want to give it a try, please tell me how does that work.</p>
<h5>Hey&#8230; why don&#8217;t you do it the easy way?</h5>
<p>Errr&#8230; yes&#8230; Just do this (I&#8217;ve translated the menu labels from Catalan to English so they could be slightly different; but you are smart enough to find them):</p>
<ul>
<li>Open the file in <a href="http://www.gimp.org">the Gimp</a>.</li>
<li>Filters/Edge detection/Gaussian</li>
<li>Radius 1: 10; Radius 2: 1, Normalize and Invert.</li>
<li>Image/Mode/Grayscale</li>
<li>Image/Scale</li>
<li>Width: 300px, Cubic interpolation.</li>
<li>Layers/Colors/Levels</li>
<li>Set central level to 0.13</li>
</ul>
<p>Well this is what you&#8217;ll get. Looks nicer, doesn&#8217;t it? This is just because the threshold of the edge detector is set much lower. Using graphical programs lets you choose the best-looking settings very quickly. But the first way was much more fun!</p>
<div class="imagecenter">
<img src="/media/asnicer.jpg" alt="Easier and nicer method using The Gimp" />
</div>
]]></content:encoded>
			<wfw:commentRSS>http://bloc.jmones.net/2005/03/02/how-to-make-a-photo-look-as-a-drawing-the-silly-way/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>Certainty of change</title>
		<link>http://bloc.jmones.net/2005/02/20/certainty-of-change/</link>
		<comments>http://bloc.jmones.net/2005/02/20/certainty-of-change/#comments</comments>
		<pubDate>Sun, 20 Feb 2005 15:25:52 +0000</pubDate>
		<dc:creator>jmones</dc:creator>
		
	<category>Societat de la Informació</category>
	<category>Filosofia barata</category>
	<category>[en]</category>
		<guid isPermaLink="false">http://bloc.jmones.net/?p=16</guid>
		<description><![CDATA[A few days ago I was talking to my uncle, who works in the advertising bussiness as a creative. He explained me that now they face the problem that people are getting used to novelties being introduced all the time which sometimes mean somewhat of a sociological change; so companies are forced to reinvent their [...]]]></description>
			<content:encoded><![CDATA[<p>A few days ago I was talking to my uncle, who works in the advertising bussiness as a creative. He explained me that now they face the problem that people are getting used to novelties being introduced all the time which sometimes mean somewhat of a sociological change; so companies are forced to reinvent their products again and again. Perhaps you&#8217;ve seen that ad of a new tv and dvd brand that says that everybody says new to sell, that&#8217;s exactly the idea.</p>
<p>I have always read that humans are reluctant to changes, at least to their ideas and habits. It like feeling safe because we know how things work. Now changes would be the constant thing that never changes (this sounds as one of <a href="http://slate.msn.com/id/2081042/">Rumsfeld&#8217;s poems</a>). We can&#8217;t wait for new exciting gadgets that will save us time and help us fill all this time we just saved; we have all kind of objects made in countries we&#8217;ll never visit and we are very close to people from all around the globe (well&#8230; err&#8230; we&#8217;ll keep the axis of evil out of this) while I don&#8217;t even know the name of my neighbours, and I&#8217;ve lived 4 years and a half in the same building which I know could be some kind of pathology, perhaps I&#8217;ll book an appointment with an specialist. We produce cheaper and everything becomes less and less useful. We still have bars for the moment&#8230; but waiters are getting so unprofessional that coffee tastes better at home. We get bored easily and we reuse things we don&#8217;t remember from the 60s or the 70s because they look so new again.</p>
<p>I think it can be argued that we expected a lot of these objects in advance, and they feel so much as an improvement! We had read SciFi books and knew scientists and technicians were working on it.</p>
<p>But what if it were true? Most of the sociological changes technology has produced were unexpected. Will conservatives ever advocate for the &#8220;constant change&#8221;?</p>
<p>How many times do you listen to the albums you download? How many songs do you have? How many music records did you listen to before you had Internet?</p>
<p>How many people do you regularly keep contact with? Where are they located?</p>
<p>How many times do you travel each year?</p>
<p><strong>Note:</strong> please <strong>DO</strong> tell me all mistakes you can find in this post. I really want to improve my english outside the boring technical domain.  </p>
]]></content:encoded>
			<wfw:commentRSS>http://bloc.jmones.net/2005/02/20/certainty-of-change/feed/</wfw:commentRSS>
		</item>
	</channel>
</rss>
