<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/1.5" -->
<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>Hazel Nuts</title>
	<link>http://www.hazelsoft.com</link>
	<description>This is a professional blog of the founder, owner and the only employee of Hazelsoft, an innovative software company.</description>
	<pubDate>Tue, 20 Jul 2010 14:29:52 +0000</pubDate>
	<generator>http://wordpress.org/?v=1.5</generator>
	<language>en</language>

		<item>
		<title>A programming gem</title>
		<link>http://www.hazelsoft.com/2005/06/14/a-programming-gem/</link>
		<comments>http://www.hazelsoft.com/2005/06/14/a-programming-gem/#comments</comments>
		<pubDate>Tue, 14 Jun 2005 22:32:49 +0000</pubDate>
		<dc:creator>LL</dc:creator>
		
	<category>Programming</category>
		<guid>http://www.hazelsoft.com/2005/06/14/a-programming-gem/</guid>
		<description><![CDATA[While being a little offset because of some private matters, I began to learn (in what's left of my free time) a new programming language.

The language is Ruby, developed by a single japanese guy. It seems to be something between Smalltalk and Perl - with quite simple syntax, full object orientation, exception handling and what [...]]]></description>
			<content:encoded><![CDATA[	<p>While being a little offset because of some <a href="http://www.hazelsoft.com/private/galeria.php?galeria=jest">private matters</a>, I began to learn (in what&#8217;s left of my free time) a new programming language.</p>
	<p>The language is <a href="http://www.ruby-lang.org/en/">Ruby</a>, developed by a single japanese guy. It seems to be something between Smalltalk and Perl - with quite simple syntax, full object orientation, exception handling and what not.</p>
	<p>First impressions -  the syntax is still a bit disturbing for me, some concepts are unfamiliar, some things seem to be overly complicated - but generally nicer than Perl, and closer to shell scripts than Python. Promising.</p>
	<p>Some additional resources can be found on <a href="http://www.rubycentral.com/">Ruby Central</a>. Another thing worth taking a look is <a href="http://www.rubyonrails.org/">Rails</a>, a open-source web framework written entirely in Ruby.</p>
	<p>For the moment however, I&#8217;ll stick with <a href="http://www.python.org/">Python</a> as a scripting language of choice - but you never know&#8230;
</p>
]]></content:encoded>
			<wfw:commentRSS>http://www.hazelsoft.com/2005/06/14/a-programming-gem/feed/</wfw:commentRSS>
	</item>
		<item>
		<title>One of the reasons I don&#8217;t like Oracle</title>
		<link>http://www.hazelsoft.com/2005/05/28/one-of-the-reasons-i-dont-like-oracle/</link>
		<comments>http://www.hazelsoft.com/2005/05/28/one-of-the-reasons-i-dont-like-oracle/#comments</comments>
		<pubDate>Sat, 28 May 2005 23:00:52 +0000</pubDate>
		<dc:creator>LL</dc:creator>
		
	<category>Programming</category>
	<category>Disappointments</category>
		<guid>http://www.hazelsoft.com/2005/05/28/one-of-the-reasons-i-dont-like-oracle/</guid>
		<description><![CDATA[Have you ever worked with clobs (or blobs, doesn't matter) in your database? Well, I did. And while it generally poses no problems in any database I know, in Oracle it is cumbersome at best. Would you expect this to work?

[SQL]INSERT INTO table (id, clob_col) 
		VALUES (1, 'A very long line...');[/SQL]

Hmm, I would. For some [...]]]></description>
			<content:encoded><![CDATA[	<p>Have you ever worked with clobs (or blobs, doesn't matter) in your database? Well, I did. And while it generally poses no problems in any database I know, in Oracle it is cumbersome at best. Would you expect this to work?</p>
	<div class="syntax_hilite">
<div id="sql-2">
	<div><span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color:#008800; font-weight:bold;">&#40;</span>id, clob_col<span style="color:#008800; font-weight:bold;">&#41;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">VALUES</span> <span style="color:#008800; font-weight:bold;">&#40;</span><span style="color:#800000;">1</span>, <span style="color: #ff0000;">'A very long line...'</span><span style="color:#008800; font-weight:bold;">&#41;</span>;</div>
	</div>
</div>
	<p>Hmm, I would. For some misterious reasons it works everywhere - but not in Oracle! If the line is longer than 2499 characters (in version 8.something, maybe it's different in other versions), all you get is a friendly error message. What to do? Write a program, say, in Java. There is about 2.7 million ways to do it, of which this is one of the easiest:</p>
	<div class="syntax_hilite">
<div id="java-1">
	<div>
<span style="color:#FF6600;">//say we already have a connection and a statement object</span><br />
<span style="color:#FF6600;">//this is needed. I don't know why.</span><br />
connection.<span style="color: #006600;">setAutoCommit</span><span style="color:#008800; font-weight:bold;">&#40;</span><span style="color: #000000; font-weight: bold;">false</span><span style="color:#008800; font-weight:bold;">&#41;</span>;<br />
<span style="color:#FF6600;">//insert row with empty clob</span><br />
statement.<span style="color: #006600;">executeQuery</span><span style="color:#008800; font-weight:bold;">&#40;</span><span style="color: #ff0000;">"insert into table(id, clob_col) "</span>+<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">"values (667, EMPTY_CLOB()) "</span>;<br />
<span style="color:#FF6600;">//get the Clob object back from DB</span><br />
<a href="http://www.google.com/search?q=allinurl%3Aresultset+java.sun.com&#038;bntl=1"><span style="color:#666699; font-weight: bold;">ResultSet</span></a> rs = stat.<span style="color: #006600;">executeQuery</span><span style="color:#008800; font-weight:bold;">&#40;</span><span style="color: #ff0000;">"select clob_col "</span>+<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">"from table "</span>+<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">"where id = 667&nbsp; for update"</span><span style="color:#008800; font-weight:bold;">&#41;</span>;<br />
rs.<span style="color: #006600;">next</span><span style="color:#008800; font-weight:bold;">&#40;</span><span style="color:#008800; font-weight:bold;">&#41;</span>;<br />
<a href="http://www.google.com/search?q=allinurl%3Aclob+java.sun.com&#038;bntl=1"><span style="color:#666699; font-weight: bold;">Clob</span></a> c = rs.<span style="color: #006600;">getClob</span><span style="color:#008800; font-weight:bold;">&#40;</span><span style="color:#800000;">1</span><span style="color:#008800; font-weight:bold;">&#41;</span>;<br />
<span style="color:#FF6600;">//and finally - this is it!&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><br />
<span style="color:#008800; font-weight:bold;">&#40;</span><span style="color:#008800; font-weight:bold;">&#40;</span>oracle.<span style="color: #006600;">sql</span>.<span style="color: #006600;">CLOB</span><span style="color:#008800; font-weight:bold;">&#41;</span>c<span style="color:#008800; font-weight:bold;">&#41;</span>.<span style="color: #006600;">putString</span><span style="color:#008800; font-weight:bold;">&#40;</span><span style="color:#800000;">1</span>, <span style="color: #ff0000;">"OMG"</span><span style="color:#008800; font-weight:bold;">&#41;</span>;<br />
<span style="color:#FF6600;">//commit the whole thing&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><br />
conn.<span style="color: #006600;">commit</span><span style="color:#008800; font-weight:bold;">&#40;</span><span style="color:#008800; font-weight:bold;">&#41;</span>;<br />
&nbsp;</div>
	</div>
</div>
	<p>So much fun...
</p>
]]></content:encoded>
			<wfw:commentRSS>http://www.hazelsoft.com/2005/05/28/one-of-the-reasons-i-dont-like-oracle/feed/</wfw:commentRSS>
	</item>
		<item>
		<title>Leave your mark</title>
		<link>http://www.hazelsoft.com/2005/05/24/24/</link>
		<comments>http://www.hazelsoft.com/2005/05/24/24/#comments</comments>
		<pubDate>Tue, 24 May 2005 15:42:08 +0000</pubDate>
		<dc:creator>LL</dc:creator>
		
	<category>Thoughts</category>
		<guid>http://www.hazelsoft.com/2005/05/24/24/</guid>
		<description><![CDATA[
(click to see full picture) 

The painting has been done on the wall near the entrance of the main subway station in Warsaw. This is the third attempt- the first one was silly, the second outrageous, and this one... I don't know what to think of it. Looks nice, but I guess that every owner [...]]]></description>
			<content:encoded><![CDATA[	<div class="img-centering"><a href="http://www.hazelsoft.com/wp-content/images/metro/big.jpg"><img src="http://www.hazelsoft.com/wp-content/images/metro/small.jpg" alt="" width="370" height="64" /></a></div>
	<p>(click to see full picture) </p>
	<p>The painting has been done on the wall near the entrance of the main subway station in Warsaw. This is the third attempt- the first one was silly, the second outrageous, and this one... I don't know what to think of it. Looks nice, but I guess that every owner of anything bigger than a waterproof marker will just crave to leave his mark. Let me be the first one:</p>
	<div class="img-centering"><img src="http://www.hazelsoft.com/wp-content/images/metro/wtf.jpg" alt="" width="300" height="206" /></div>
]]></content:encoded>
			<wfw:commentRSS>http://www.hazelsoft.com/2005/05/24/24/feed/</wfw:commentRSS>
	</item>
		<item>
		<title>BibCenter available for download</title>
		<link>http://www.hazelsoft.com/2005/05/21/bibcenter-available-for-download/</link>
		<comments>http://www.hazelsoft.com/2005/05/21/bibcenter-available-for-download/#comments</comments>
		<pubDate>Sat, 21 May 2005 23:38:46 +0000</pubDate>
		<dc:creator>LL</dc:creator>
		
	<category>Software</category>
		<guid>http://www.hazelsoft.com/2005/05/21/bibcenter-available-for-download/</guid>
		<description><![CDATA[First version of BibCenter- a bibliographical reference manager- is available for download. It currently features:


	database- driven information storage
	a BibTeX compliant information set
	export to BibTeX file
	customizable additional fields


Get the software it in the downloads section. ]]></description>
			<content:encoded><![CDATA[	<p>First version of <strong>BibCenter</strong>- a bibliographical reference manager- is available for download. It currently features:</p>
	<ul>
	<li>database- driven information storage</li>
	<li>a BibTeX compliant information set</li>
	<li>export to BibTeX file</li>
	<li>customizable additional fields</li>
	</ul>
	<p>Get the software it in the <a href="http://www.hazelsoft.com/downloads">downloads</a> section.
</p>
]]></content:encoded>
			<wfw:commentRSS>http://www.hazelsoft.com/2005/05/21/bibcenter-available-for-download/feed/</wfw:commentRSS>
	</item>
		<item>
		<title>Processing rev. 90 available</title>
		<link>http://www.hazelsoft.com/2005/05/19/processing-rev-90-available/</link>
		<comments>http://www.hazelsoft.com/2005/05/19/processing-rev-90-available/#comments</comments>
		<pubDate>Thu, 19 May 2005 23:52:09 +0000</pubDate>
		<dc:creator>LL</dc:creator>
		
	<category>Programming</category>
		<guid>http://www.hazelsoft.com/2005/05/19/processing-rev-90-available/</guid>
		<description><![CDATA[A new revision of Processing (beta version) is available with some new features like full screen graphics, a more complete renderer and better opengl support.

Get the latest revision at http://processing.org/download/. ]]></description>
			<content:encoded><![CDATA[	<p>A new revision of Processing (beta version) is available with some new features like full screen graphics, a more complete renderer and better opengl support.</p>
	<p>Get the latest revision at <a href="http://processing.org/download/">http://processing.org/download/</a>.
</p>
]]></content:encoded>
			<wfw:commentRSS>http://www.hazelsoft.com/2005/05/19/processing-rev-90-available/feed/</wfw:commentRSS>
	</item>
		<item>
		<title>Java BBCode parser</title>
		<link>http://www.hazelsoft.com/2005/05/19/java-bbcode-parser/</link>
		<comments>http://www.hazelsoft.com/2005/05/19/java-bbcode-parser/#comments</comments>
		<pubDate>Thu, 19 May 2005 23:44:53 +0000</pubDate>
		<dc:creator>LL</dc:creator>
		
	<category>Programming</category>
		<guid>http://www.hazelsoft.com/2005/05/19/java-bbcode-parser/</guid>
		<description><![CDATA[I assembled a simple BBCode parser in Java. It might be useful, e.g. in a custom bulletin board. It is still a bit incomplete, but will probably improve over time.

You can download it in the downloads section. ]]></description>
			<content:encoded><![CDATA[	<p>I assembled a simple BBCode parser in Java. It might be useful, e.g. in a custom bulletin board. It is still a bit incomplete, but will probably improve over time.</p>
	<p>You can download it in the <a href="http://www.hazelsoft.com/downloads">downloads</a> section.
</p>
]]></content:encoded>
			<wfw:commentRSS>http://www.hazelsoft.com/2005/05/19/java-bbcode-parser/feed/</wfw:commentRSS>
	</item>
		<item>
		<title>Three pointers on personal data in databases</title>
		<link>http://www.hazelsoft.com/2005/05/17/some-pointers-on-personal-data-in-databases/</link>
		<comments>http://www.hazelsoft.com/2005/05/17/some-pointers-on-personal-data-in-databases/#comments</comments>
		<pubDate>Tue, 17 May 2005 11:45:57 +0000</pubDate>
		<dc:creator>LL</dc:creator>
		
	<category>Programming</category>
		<guid>http://www.hazelsoft.com/2005/05/17/some-pointers-on-personal-data-in-databases/</guid>
		<description><![CDATA[Pointer 1
	
A mistake commonly made by database designers, is to represent name or surname with single columns. This approach, however easy and natural, clearly breaks the first normal form, because the relations in the database become non- singular when multiple names occur. This makes searching more	difficult, because many combinations and '%'s  have to be [...]]]></description>
			<content:encoded><![CDATA[	<h2>Pointer 1</h2>
	<p>A mistake commonly made by database designers, is to represent name or surname with single columns. This approach, however easy and natural, clearly breaks the <a href="http://www.answers.com/first%20normal%20form">first normal form</a>, because the relations in the database become non- singular when multiple names occur. This makes searching more	difficult, because many combinations and '%'s  have to be used.</p>
	<p>Consider for example, a person with 3 names - "William Henry Bob", and a search string "William Bob".	In the "popular" approach, the name of the person is put into single column, say we call it "name". The SQL query will look something like this:</p>
	<div class="syntax_hilite">
<div id="sql-3">
	<div><span style="color: #993333; font-weight: bold;">SELECT</span> * <span style="color: #993333; font-weight: bold;">FROM</span> people <br />
&nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">WHERE</span> name <span style="color: #993333; font-weight: bold;">LIKE</span> <span style="color: #ff0000;">'%William%'</span> <br />
&nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">OR</span> name <span style="color: #993333; font-weight: bold;">LIKE</span> <span style="color: #ff0000;">'%Bob%'</span>;</div>
	</div>
</div>
	<p>Simple, but very consuming for the database. You need to run a full table scan, which is not very good when the database is big.</p>
	<p>Instead, apply the normalization procedure required by the first normal form:</p>
	<div class="img-centering"><img src="http://www.hazelsoft.com/wp-content/images/normalization.gif" width="350" height="176" alt="normalization step" /></div>
	<p>Now, the SQL query will look somewhat like:</p>
	<div class="syntax_hilite">
<div id="sql-4">
	<div><span style="color: #993333; font-weight: bold;">SELECT</span> * <span style="color: #993333; font-weight: bold;">FROM</span> people <span style="color: #993333; font-weight: bold;">WHERE</span> id <span style="color: #993333; font-weight: bold;">IN</span> <span style="color:#008800; font-weight:bold;">&#40;</span><br />
&nbsp; &nbsp;<span style="color: #993333; font-weight: bold;">SELECT</span> people_id <span style="color: #993333; font-weight: bold;">FROM</span> people_names <span style="color: #993333; font-weight: bold;">WHERE</span> names_id <span style="color: #993333; font-weight: bold;">IN</span> <span style="color:#008800; font-weight:bold;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #993333; font-weight: bold;">SELECT</span> id <span style="color: #993333; font-weight: bold;">FROM</span> names <span style="color: #993333; font-weight: bold;">WHERE</span> name <span style="color: #993333; font-weight: bold;">IN</span> <span style="color:#008800; font-weight:bold;">&#40;</span><span style="color: #ff0000;">'Bob'</span>,<span style="color: #ff0000;">'William'</span><span style="color:#008800; font-weight:bold;">&#41;</span> <br />
&nbsp; &nbsp;<span style="color:#008800; font-weight:bold;">&#41;</span><br />
<span style="color:#008800; font-weight:bold;">&#41;</span>;</div>
	</div>
</div>
	<p>This query seems to be a bit more complicated, but - not surprisingly - runs a lot faster.</p>
	<h2>Pointer two</h2>
	<p>Because of various errors, names or surnames in the database can be misspelled. A simple search with exact matching is obviously not able to find the misspelled words.</p>
	<p>A partial solution of this problem is phonetic indexing. A phonetic index is a coded word hash based on the way a word sounds rather than the way it is spelled (eg. SMYTH or SMITH sound the same, while being spelled differently). There is a couple of phonetic algorithms:</p>
	<ul>
	<li>The original <a href="http://www.nara.gov/genealogy/soundex/soundex.html">soundex</a> algorithm has been 	invented by O'Dell and Russell in 1918. A variation called "American soundex" has been used by the U.S. census archives. This algorithm is very simple, thus not very accurate;</li>
	<li>The <a href="http://www.answers.com/main/ntquery?method=4&#038;dsid=2222&#038;dekey=Metaphone&#038;gwp=8&#038;curtab=2222_1">metaphone</a> algorithm, developed by Phillips,  is more accurate and more complicated;</li>
	<li>The <a href="http://www.avotaynu.com/soundex.html">Daitch- Mokotoff soundex</a> has been developed by the Jewish genealogists in 1985. It had to be done because the two above algorithms are both based on English language and don't work very well for Slavic or Germanic  surnames (eg. Levine vs. Lewin).</li>
	</ul>
	<p>Both the soundex and metaphone algorithms are part of <a href="http://www.php.net">PHP</a> standard library. There also exist freely available implementations in Java at  <a href="http://jakarta.apache.org/commons">Jakarta</a>. Of course many other realisations	can be found on the internet.</p>
	<h2>Pointer three</h2>
	<p>The longest surname I know in Polish language is "Brzęczyszczykiewicz", which is 20 characters long. In a database, I assume 24 chars for surnames and 18 for names.
</p>
]]></content:encoded>
			<wfw:commentRSS>http://www.hazelsoft.com/2005/05/17/some-pointers-on-personal-data-in-databases/feed/</wfw:commentRSS>
	</item>
		<item>
		<title>No activity</title>
		<link>http://www.hazelsoft.com/2005/05/16/no-activity/</link>
		<comments>http://www.hazelsoft.com/2005/05/16/no-activity/#comments</comments>
		<pubDate>Mon, 16 May 2005 20:21:32 +0000</pubDate>
		<dc:creator>LL</dc:creator>
		
	<category>Software</category>
		<guid>http://www.hazelsoft.com/2005/05/16/no-activity/</guid>
		<description><![CDATA[I'm killing my brain cells with Addicting Games. ]]></description>
			<content:encoded><![CDATA[	<p>I'm killing my brain cells with <a href="http://www.addictinggames.com/">Addicting Games</a>.
</p>
]]></content:encoded>
			<wfw:commentRSS>http://www.hazelsoft.com/2005/05/16/no-activity/feed/</wfw:commentRSS>
	</item>
		<item>
		<title>Spreading the word - badly</title>
		<link>http://www.hazelsoft.com/2005/05/13/spreading-the-word-badly/</link>
		<comments>http://www.hazelsoft.com/2005/05/13/spreading-the-word-badly/#comments</comments>
		<pubDate>Fri, 13 May 2005 19:31:56 +0000</pubDate>
		<dc:creator>LL</dc:creator>
		
	<category>Software</category>
	<category>Disappointments</category>
		<guid>http://www.hazelsoft.com/2005/05/13/spreading-the-word-badly/</guid>
		<description><![CDATA[This almost looks like a sabotage: http://funnyfox.org/

OMG. Is Microsoft behind this? ]]></description>
			<content:encoded><![CDATA[	<p>This almost looks like a sabotage: <a href="http://funnyfox.org/">http://funnyfox.org/</a></p>
	<p>OMG. Is Microsoft behind this?
</p>
]]></content:encoded>
			<wfw:commentRSS>http://www.hazelsoft.com/2005/05/13/spreading-the-word-badly/feed/</wfw:commentRSS>
	</item>
		<item>
		<title>Won&#8217;t play with Scrabble</title>
		<link>http://www.hazelsoft.com/2005/05/12/wont-play-with-scrabble/</link>
		<comments>http://www.hazelsoft.com/2005/05/12/wont-play-with-scrabble/#comments</comments>
		<pubDate>Thu, 12 May 2005 22:52:13 +0000</pubDate>
		<dc:creator>LL</dc:creator>
		
	<category>Programming</category>
	<category>Disappointments</category>
		<guid>http://www.hazelsoft.com/2005/05/12/wont-play-with-scrabble/</guid>
		<description><![CDATA[I just bought the "Official Polish Scrabble Dictionary". Partly because of hope that this dictionary would be in an open format, so I could use it to write some funny stuff. No, it isn't. Forlorn hope. ]]></description>
			<content:encoded><![CDATA[	<p>I just bought the <a href="http://www.pfs.org.pl/New_look/Slownik/Osps.html">"Official Polish Scrabble Dictionary"</a>. Partly because of hope that this dictionary would be in an open format, so I could use it to write some funny stuff. No, it isn't. Forlorn hope.
</p>
]]></content:encoded>
			<wfw:commentRSS>http://www.hazelsoft.com/2005/05/12/wont-play-with-scrabble/feed/</wfw:commentRSS>
	</item>
	</channel>
</rss>
