<?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>Bleadof's world of tinkering &#187; Tinkering</title>
	<atom:link href="http://hiutale.org/category/tinkering/feed/" rel="self" type="application/rss+xml" />
	<link>http://hiutale.org</link>
	<description>It's just life, it'll sort itself out</description>
	<lastBuildDate>Thu, 27 May 2010 08:19:56 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>AT&amp;T x86 assembly instruction reference</title>
		<link>http://hiutale.org/2008/11/11/att-x86-assembly-instruction-reference/</link>
		<comments>http://hiutale.org/2008/11/11/att-x86-assembly-instruction-reference/#comments</comments>
		<pubDate>Tue, 11 Nov 2008 16:22:39 +0000</pubDate>
		<dc:creator>Bleadof</dc:creator>
				<category><![CDATA[Assembly]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Studies]]></category>
		<category><![CDATA[Thesis]]></category>
		<category><![CDATA[Tinkering]]></category>

		<guid isPermaLink="false">http://hiutale.org/?p=50</guid>
		<description><![CDATA[The juice of this blog post is here: AT&#038;T x86 assembly instruction reference can be found in the Appendix B. with the the title &#8220;Common x86 Instructions&#8221; from Programming from the Ground Up by Bartlett, J.
The actual process how I came about finding this bit of info was when I was reading Building Secure Software [...]]]></description>
			<content:encoded><![CDATA[<p>The juice of this blog post is here: AT&#038;T x86 assembly instruction reference can be found in the Appendix B. with the the title &#8220;Common x86 Instructions&#8221; from <a href="http://download.savannah.gnu.org/releases/pgubook/ProgrammingGroundUp-1-0-booksize.pdf">Programming from the Ground Up</a> by <a href="http://www.bartlettpublishing.com/">Bartlett, J</a>.</p>
<p>The actual process how I came about finding this bit of info was when I was reading <a href="http://www.amazon.com/Building-Secure-Software-Addison-Wesley-Professional/dp/020172152X">Building Secure Software</a> by <a href="http://www.viega.org/">Viega, J</a> and <a href="http://www.rstcorp.com/gem/">McGraw, G</a> in towards efforts of finishing my bachelor and master thesis on &#8220;Common faults in software which lead to a vulnerability&#8221;. The book is a brilliant as an entry level book for everyone working on software development and trying to think more securely when programming. Although hopefully my master&#8217;s thesis will serve this entry level of thinking secure while programming as well. Anyway, I was reading the <acronym title="Building Secure Software">BSS</acronym> book and on the Stack Overflows chapter there&#8217;s this part where you&#8217;re told to use the <a href="http://gcc.gnu.org/"><acronym title="GNU Compiler Collection">gcc</acronym></a> with -S flag to <a href="http://en.wikipedia.org/wiki/Compiler">compile</a> the <a href="http://en.wikipedia.org/wiki/C_(programming_language)">C</a> code to <a href="http://en.wikipedia.org/wiki/Assembly_language">Assembly</a> language and tweak it. So to be able to tweak it I wanted to understand what were the instructions in the Assembly language. I googled a bit to find AT&#038;T instructions and that didn&#8217;t give me much until I finally found <a href="http://groups.google.com/group/comp.lang.asm.x86/browse_thread/thread/88ce101ae76756ae/c8c20ab2999d412e">a question</a> on  <a href="http://groups.google.com/group/comp.lang.asm.x86/topics">comp.lang.asm.x86 news group</a> which said that one would be in the Programming from the Ground Up book and there it was.</p>
]]></content:encoded>
			<wfw:commentRss>http://hiutale.org/2008/11/11/att-x86-assembly-instruction-reference/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iSync not launching on Leopard 10.5.3.</title>
		<link>http://hiutale.org/2008/06/09/isync-not-launching-on-leopard-1053/</link>
		<comments>http://hiutale.org/2008/06/09/isync-not-launching-on-leopard-1053/#comments</comments>
		<pubDate>Mon, 09 Jun 2008 15:51:11 +0000</pubDate>
		<dc:creator>Bleadof</dc:creator>
				<category><![CDATA[Os X]]></category>

		<guid isPermaLink="false">http://hiutale.org/?p=48</guid>
		<description><![CDATA[I had a problem for a while that I couldn&#8217;t launch iSync normally from /Applications, but it did still did work launching it from /Applications/iSync.app/Contents/MacOS/iSync . I knew this must be an issue for someone else as well so a little digging got me the anwser from the Apple Support discussion with title &#8220;iSync won&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>I had a problem for a while that I couldn&#8217;t launch iSync normally from /Applications, but it did still did work launching it from /Applications/iSync.app/Contents/MacOS/iSync . I knew this must be an issue for someone else as well so a little digging got me the anwser from the <a href="http://discussions.apple.com/thread.jspa?messageID=7321396">Apple Support discussion</a> with title &#8220;iSync won&#8217;t open in 10.5.3.&#8221;.</p>
<dl>
<dt>Fix iSync launching problem</dt>
<dd>
<ol>
<li>Drag iSync from Applications to Desktop.</li>
<li>Drag it back to Applications.</li>
<li>Try launching it normally.</li>
</ol>
</dd>
</dl>
]]></content:encoded>
			<wfw:commentRss>http://hiutale.org/2008/06/09/isync-not-launching-on-leopard-1053/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Great Assembler programming book</title>
		<link>http://hiutale.org/2008/03/14/great-assembler-programming-book/</link>
		<comments>http://hiutale.org/2008/03/14/great-assembler-programming-book/#comments</comments>
		<pubDate>Fri, 14 Mar 2008 11:02:47 +0000</pubDate>
		<dc:creator>Bleadof</dc:creator>
				<category><![CDATA[Assembly]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Thesis]]></category>
		<category><![CDATA[Tinkering]]></category>
		<category><![CDATA[book]]></category>

		<guid isPermaLink="false">http://hiutale.org/2008/03/14/great-assembler-programming-book/</guid>
		<description><![CDATA[I found this brilliantly written Assembler, which I&#8217;m reading for my thesis, book online a while back already but I thought it might worth mentioning now. It&#8217;s called &#8220;PC Assembly Language&#8221; and its author is Paul A. Carter. It can be downloaded in PDF and PostScript so I suppose most of the people can read [...]]]></description>
			<content:encoded><![CDATA[<p>I found this brilliantly written Assembler, which I&#8217;m reading for my thesis, book online a while back already but I thought it might worth mentioning now. It&#8217;s called &#8220;<a href="http://drpaulcarter.com/pcasm/">PC Assembly Language</a>&#8221; and its author is <a href="http://drpaulcarter.com/">Paul A. Carter</a>. It can be downloaded in PDF and PostScript so I suppose most of the people can read it. I don&#8217;t about the accessibility of a PDF or PS so I won&#8217;t say everyone can read it, but the text itself is very clear and easy to understand. It also offers good examples. I think it&#8217;s a bit sad that it&#8217;s written in <a href="http://en.wikipedia.org/wiki/X86_assembly_language">Intel syntax</a>, but I suppose that&#8217;s unavoidable. I&#8217;ve been reading mostly AT&#038;T syntax which is <a href="http://www.w00w00.org/files/articles/att-vs-intel.txt">a bit different</a>, but you get used to Intel syntax fairly fast.</p>
<p>Now I&#8217;m off to a meeting&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://hiutale.org/2008/03/14/great-assembler-programming-book/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ha! I defeated the evil Chinese spam bot!</title>
		<link>http://hiutale.org/2006/07/05/ha-i-defeated-the-evil-chinese-spam-bot/</link>
		<comments>http://hiutale.org/2006/07/05/ha-i-defeated-the-evil-chinese-spam-bot/#comments</comments>
		<pubDate>Wed, 05 Jul 2006 07:20:30 +0000</pubDate>
		<dc:creator>Bleadof</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Tinkering]]></category>

		<guid isPermaLink="false">http://hiutale.org/2006/07/05/ha-i-defeated-the-evil-chinese-spam-bot/</guid>
		<description><![CDATA[I&#8217;m been spammed by this Chinese spam bot. It tries to post on my non-existing guestbook by loading /?guestbook&#038;action=write and generating dummy hits on my wordpress blog front page. Today I decided to stop that.
Ingredients

Apache
Apache mod_rewrite module
.htaccess love

Steps

1. Create, if you don&#8217;t already have, a .htaccess file in your document root (ie. mine is /home/username/public_html/)
2. [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m been spammed by this Chinese spam bot. It tries to post on my non-existing guestbook by loading /?guestbook&#038;action=write and generating dummy hits on my <a href="http://www.wordpress.org">wordpress</a> blog front page. Today I decided to stop that.</p>
<h2>Ingredients</h2>
<ul>
<li>Apache</li>
<li>Apache mod_rewrite module</li>
<li>.htaccess love</li>
</ul>
<h2>Steps</h2>
<ul>
<li>1. Create, if you don&#8217;t already have, a .htaccess file in your document root (ie. mine is /home/username/public_html/)</li>
<li>2. Edit your .htaccess file and add following lines</li>
</ul>
<p><code><br />
  &lt;IfModule mod_rewrite.c&gt;<br />
  RewriteEngine On<br />
  RewriteCond %{QUERY_STRING} ^guestbook&#038;action=write$<br />
  RewriteRule ^index.php$ / [G]<br />
  &lt;/IfModule&gt;<br />
</code></p>
<ul>
<li>3. Save</li>
</ul>
<p>Now you are done and that url returns now 410 error code, which means the resource is gone.</p>
]]></content:encoded>
			<wfw:commentRss>http://hiutale.org/2006/07/05/ha-i-defeated-the-evil-chinese-spam-bot/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Work and ajax</title>
		<link>http://hiutale.org/2006/07/03/work-and-ajax/</link>
		<comments>http://hiutale.org/2006/07/03/work-and-ajax/#comments</comments>
		<pubDate>Mon, 03 Jul 2006 08:01:18 +0000</pubDate>
		<dc:creator>Bleadof</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tinkering]]></category>

		<guid isPermaLink="false">http://hiutale.org/2006/07/03/work-and-ajax/</guid>
		<description><![CDATA[Well, I was asked to do a suggesting text-box for one field in the UI so that it would be easier to type in the info which apparently is the one they make most of the errors. I did it with some script.aculo.us love. It&#8217;s nice that they have pretty good docs.
So basically what you [...]]]></description>
			<content:encoded><![CDATA[<p>Well, I was asked to do a suggesting text-box for one field in the UI so that it would be easier to type in the info which apparently is the one they make most of the errors. I did it with some <a href="http://script.aculo.us/">script.aculo.us love</a>. It&#8217;s nice that they have pretty <a href="http://wiki.script.aculo.us/scriptaculous/show/Ajax.Autocompleter">good docs</a>.</p>
<p>So basically what you have to do is include</p>
<p><code><br />
&lt;head&gt;<br />
    ...<br />
    &lt;script src="scriptaculous/lib/prototype.js" type="text/javascript"&gt;&lt;/script&gt;<br />
    &lt;script src="scriptaculous/src/scriptaculous.js" type="text/javascript"&gt;&lt;/script&gt;<br />
    ...<br />
&lt;/head&gt;<br />
</code></p>
<p>Then add</p>
<p><code><br />
&lt;label for="signum"&gt;Signum&lt;/label&gt;<br />
&lt;input id="signum" name="item[signum]" type="text" /&gt;<br />
&lt;div id="signumhint" class="signumhint"&gt;&lt;/div&gt;<br />
&lt;script type="text/javascript"&gt;<br />
    // &lt;![CDATA[<br />
    new Ajax.Autocompleter("signum","signumhint","AjaxController.php?get=signum", {})<br />
    // ]]&gt;<br />
&lt;/script&gt;<br />
</code></p>
<p>Then add process the request, this is from my AjaxController.class.php draft</p>
<p><code><br />
function handleRequest($post, $get) {<br />
    if(count($post) <= 0 &#038;&#038; count($get) <= 0) {<br />
        return null;<br />
    }<br />
    if($post['item']['signum'] != null) {<br />
        $signums = $this->getSignums($post['item']['signum']);<br />
    }<br />
    $this->makeUnorderedList($signums);<br />
    $this->printList($signums);<br />
}<br />
function makeUnorderedList($results) {<br />
    $unorderedList = Array();<br />
    $unorderedList[] = '&lt;ul&gt;';<br />
    foreach($results as $result) {<br />
        $unorderedList[] = '&lt;li&gt;'.$result.'&lt;/li&gt;';<br />
    }<br />
    $unorderedList[] = '&lt;/ul&gt;';<br />
    return $unorderedList;<br />
}<br />
function printList($unorderedListArray) {<br />
    foreach($unorderedListArray as $item) {<br />
        print $item;<br />
    }<br />
}<br />
</code></p>
<p>You also need to edit your css so that the hints div will look nice. It&#8217;ll be populated data. In here the hints field css looks like this:
</p>
<p><code><br />
.signumhint {<br />
    position: absolute;<br />
    font-size: 0.8em;<br />
    background-color: white;<br />
    left: 8em;<br />
    z-index: 100;<br />
}<br />
.signumhint ul {<br />
    list-style-type:none;<br />
    margin:0px;<br />
    padding:0px;<br />
}<br />
.signumhint ul li.selected { background-color: #ffb;}<br />
.signumhint ul li {<br />
    list-style-type:none;<br />
    display:block;<br />
    margin:0;<br />
    padding:0;<br />
    height:32px;<br />
    cursor:pointer;<br />
}<br />
</code></p>
<p>And voila, you&#8217;re good to go.</p>
<p><a class="imagelink" href="http://hiutale.org/wp-content/uploads/2006/07/magazine-item-info.png" title="Ajax screenshot"><img id="image38" src="http://hiutale.org/wp-content/uploads/2006/07/magazine-item-info.thumbnail.png" alt="Ajax screenshot" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://hiutale.org/2006/07/03/work-and-ajax/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Oracle instant client basic, PHP &gt;= 4.3.9 and Centos</title>
		<link>http://hiutale.org/2006/06/21/oracle-instant-client-basic-php-439-and-centos/</link>
		<comments>http://hiutale.org/2006/06/21/oracle-instant-client-basic-php-439-and-centos/#comments</comments>
		<pubDate>Wed, 21 Jun 2006 11:39:18 +0000</pubDate>
		<dc:creator>Bleadof</dc:creator>
				<category><![CDATA[Jyväskylä University Library]]></category>
		<category><![CDATA[Tinkering]]></category>
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://hiutale.org/2006/06/21/oracle-instant-client-basic-php-439-and-centos/</guid>
		<description><![CDATA[Whoop-di-fucking-doo!, I didn&#8217;t know that getting Oracle database connectivity in PHP 4.3.9 could be this hard to get working. Here are the tricks.

Find oracle-instantclient-basic-10.2.0.2-1 as RPM.
Find php-oci8-4.3.9-3 as RPM.
Install them, restart apache and you&#8217;re done.

Sounds easy? Well it&#8217;s not. Reason: those packets were hard to find in the first place. Why? Apparently oracle doesn&#8217;t want [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Whoop-di-fucking-doo!</strong>, I didn&#8217;t know that getting Oracle database connectivity in PHP 4.3.9 could be this hard to get working. Here are the tricks.</p>
<ul>
<li>Find oracle-instantclient-basic-10.2.0.2-1 as RPM.</li>
<li>Find php-oci8-4.3.9-3 as RPM.</li>
<li>Install them, restart apache and you&#8217;re done.</li>
</ul>
<p>Sounds easy? Well it&#8217;s not. Reason: those packets were hard to find in the first place. Why? Apparently oracle doesn&#8217;t want the instant client to be found as rpm. Most of the howtos you&#8217;re told to compile PHP from tarball and that&#8217;s just not the way you want it to be done. Anyhow I succeeded and now i can use AdoDB to connect oracle database. You know that oci8 is working when you check phpinfo() for oci8 module enabled</p>
]]></content:encoded>
			<wfw:commentRss>http://hiutale.org/2006/06/21/oracle-instant-client-basic-php-439-and-centos/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>PHP4 OOP and references</title>
		<link>http://hiutale.org/2006/06/12/php4-oop/</link>
		<comments>http://hiutale.org/2006/06/12/php4-oop/#comments</comments>
		<pubDate>Mon, 12 Jun 2006 10:32:27 +0000</pubDate>
		<dc:creator>Bleadof</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tinkering]]></category>

		<guid isPermaLink="false">http://hiutale.org/2006/06/12/php4-oop/</guid>
		<description><![CDATA[So today I decided check PHP4 OOP quirks. So now I know for sure how my code is going to behave. I wasn&#8217;t really sure how the PHP4 behaves with references so I did a test.

class ReferenceTest {

  var $reference;

  function ReferenceTest() {
    $this->reference = new Reference();
  }

  [...]]]></description>
			<content:encoded><![CDATA[<p>So today I decided check PHP4 OOP quirks. So now I know for sure how my code is going to behave. I wasn&#8217;t really sure how the PHP4 behaves with references so I did a test.</p>
<pre>
class ReferenceTest {

  var $reference;

  function ReferenceTest() {
    $this->reference = new Reference();
  }

  function getReference() {
    return $this->reference;
  }

  function &#038;getReferenceReference() {
    return $this->reference;
  }
}

class Reference {

  var $var;

  function Reference() {
    $this->var = "";
  }

  function setVar($var) {
    $this->var = $var;
  }

  function getVar() {
    return $this->var;
  }

  function &#038;getVarReference() {
    return $this->var;
  }

}

$rt =  new ReferenceTest();
$ref = $rt->getReference();
$ref->setVar("bar");
$ref2 =&#038; $rt->getReferenceReference();
$ref2->setVar("baz");
$ref3 =&#038; $rt->getReferenceReference();
$varRef =&#038; $ref3->getVarReference();
$varRef = "baf";
$ref3->setVar("foo");

print "ref:".$ref->getVar()."&lt;br/&gt;";
print "ref2:".$ref2->getVar()."&lt;br/&gt;";
print "ref3:".$ref3->getVar()."&lt;br/&gt;";
</pre>
<p>Do you know what is the output? <a href="http://hiutale.org/public/reference-test.php">Here&#8217;s the anwser.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://hiutale.org/2006/06/12/php4-oop/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Last.fm love \o/</title>
		<link>http://hiutale.org/2006/06/09/lastfm-love-o/</link>
		<comments>http://hiutale.org/2006/06/09/lastfm-love-o/#comments</comments>
		<pubDate>Fri, 09 Jun 2006 06:14:29 +0000</pubDate>
		<dc:creator>Bleadof</dc:creator>
				<category><![CDATA[Jyväskylä University Library]]></category>
		<category><![CDATA[Tinkering]]></category>
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://hiutale.org/2006/06/09/lastfm-love-o/</guid>
		<description><![CDATA[I presume that I&#8217;m not the only one who has noticed the lovely features of the Last.fm player&#8230; It&#8217;s so cool that you&#8217;re able to listen your favorite music still at work and not actually being forced to bring the music with you or start streaming from home.
At the moment I&#8217;m subscribed because they&#8217;ve been [...]]]></description>
			<content:encoded><![CDATA[<p>I presume that I&#8217;m not the only one who has noticed the lovely features of the <a href="http://www.last.fm/downloads.php">Last.fm player</a>&#8230; It&#8217;s so cool that you&#8217;re able to listen your favorite music still at work and not actually being forced to bring the music with you or start streaming from home.</p>
<p>At the moment I&#8217;m subscribed because they&#8217;ve been messing around with my charts. This means I&#8217;ve more radios available than as a normal user. I&#8217;ve been mostly listening my personal radio but sometimes it&#8217;s nice to hear something new and I listen my neighbour radio. Fun \o/</p>
<p>Now some work&#8230; Started to poke around some on the old system. It&#8217;s totally crappy. There&#8217;s a lot of things which could easily go to <a href="http://thedailywtf.com/">The Daily WTF</a>, but I can&#8217;t be bothered to submit them. I think I&#8217;m suggesting that we throw the old system to trash and do a proper one with <a href="http://www.php.net/manual/en/language.oop.php">OO PHP</a>. Would be nice to actually just use <a href="http://www.python.org">Python</a> but I guess it&#8217;s not possible.</p>
<p>We&#8217;ll see what happens&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://hiutale.org/2006/06/09/lastfm-love-o/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP4 and error handling&#8230;</title>
		<link>http://hiutale.org/2006/04/27/php4-and-error-handling/</link>
		<comments>http://hiutale.org/2006/04/27/php4-and-error-handling/#comments</comments>
		<pubDate>Wed, 26 Apr 2006 21:30:56 +0000</pubDate>
		<dc:creator>Bleadof</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tinkering]]></category>

		<guid isPermaLink="false">http://hiutale.org/2006/04/27/php4-and-error-handling/</guid>
		<description><![CDATA[I&#8217;m working on a project at the moment. Doing stuff for company called Boogie Beat Oy. I&#8217;m doing a whole rewrite for their system-of-a-thingie&#8230; I decided to start using proper OOP-style. Pretty interesting thing to do with a language which I&#8217;ve used only for procedural programming. So I stumbled upon some of the problems which [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m working on a project at the moment. Doing stuff for company called <a href="http://www.boogiebeat.fi">Boogie Beat Oy</a>. I&#8217;m doing a whole rewrite for their system-of-a-thingie&#8230; I decided to start using proper <a href="http://en.wikipedia.org/wiki/Object-oriented_programming">OOP</a>-style. Pretty interesting thing to do with a language which I&#8217;ve used only for <a href="http://en.wikipedia.org/wiki/Procedural_programming">procedural programming</a>. So I stumbled upon some of the problems which <a href="http://en.wikipedia.org/wiki/Php#Support_for_objects">PHP4</a> has with objects and <a href="http://en.wikipedia.org/wiki/Exception_handling">error handling</a>.</p>
<h2>set_error_handler(&#8220;yourErrorHandlerFunction&#8221;)</h2>
</p>
<p>I&#8217;m used to do objects with <a href="http://en.wikipedia.org/wiki/Java_programming_language">Java</a> and<a href="http://en.wikipedia.org/wiki/Exception_handling#Exception_support_in_programming_languages">Java&#8217;s way of handling errors</a> which is quite nice and flexible.</p>
<p>In PHP4 the built in way of raising errors is:</p>
<p><code>trigger_error("Error message", E_USER_ERROR)</code></p>
<p>This is not the actual problem but the:</p>
<p><code><br />
function my_errror_handler($errno, $errstr, $errfile, $errline, $errcontext) {<br />
    switch($errno) {<br />
        case E_USER_ERROR:<br />
            ...<br />
    }<br />
}<br />
$old_error_handler = set_error_handler("my_error_handler");<br />
</code></p>
<p>Which would be just brilliant if you could say&#8230;</p>
<p><code><br />
$old_error_handler = set_error_handler("$object->errorHandler");<br />
</code></p>
<p>&#8230;and when you can&#8217;t. You&#8217;re basically bound to do like this:</p>
<p><code><br />
require('Object.class.php');<br />
$object = new Object();<br />
function __errorHandler($errno, $errstr, $errfile, $errline, $errcontext) {<br />
    global $object;<br />
    $object->errorHandler($errno, $errstr, $errfile, $errline, $errcontext);<br />
}<br />
$oldErrorHandler = set_error_handler("__errorHandler");<br />
</code></p>
<p>Which is kind of sucky way of doing things&#8230; Basically what I&#8217;ve done is that my errorHandler will store all of the errors in an Array and I can just ask for the errors when I need to get them and it&#8217;ll return an Array of the errors. So I can easily foreach the errors in a <a href="http://smarty.php.net/">Smarty</a> template and not have to worry about the errors been print out anywhere or anytime they are triggered.</p>
<p>Took me some time to figure out a way to point to the function of this errorHandler class I wrote. This implementation is a hack but it works! It makes it easy to localize the errors if wanted because you can modify the errorHandling as you wish&#8230;</p>
<p>Here&#8217;s few documents where you can find more information about the error handling in PHP4</p>
<ul>
<li><a href="http://www.zend.com/zend/spotlight/error.php">Zend &#8211; Error handling in PHP</a></li>
<li><a href="http://fi.php.net/manual/en/function.set-error-handler.php"> php.net &#8211; Function: set_error_handler</a></li>
</ul>
<p>Oh well, that&#8217;s about it&#8230; Probably more about this later&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://hiutale.org/2006/04/27/php4-and-error-handling/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Webcollage XScreenSaver</title>
		<link>http://hiutale.org/2005/09/22/webcollage-xscreensaver/</link>
		<comments>http://hiutale.org/2005/09/22/webcollage-xscreensaver/#comments</comments>
		<pubDate>Thu, 22 Sep 2005 11:16:24 +0000</pubDate>
		<dc:creator>Bleadof</dc:creator>
				<category><![CDATA[Tinkering]]></category>
		<category><![CDATA[Ubuntu Linux]]></category>

		<guid isPermaLink="false">http://hiutale.org/?p=8</guid>
		<description><![CDATA[*grins* This one took some time today&#8230; It has dependencies which aren&#8217;t told you before you run it from the console *shrug*. This is how I got it to work in Ubuntu Breezy Badger (installed the preview, but now I&#8217;ve updating  it from the devel repo):

At first, it uses /usr/dict/words as its default source [...]]]></description>
			<content:encoded><![CDATA[<p>*grins* This one took some time today&#8230; It has dependencies which aren&#8217;t told you before you run it from the console *shrug*. This is how I got it to work in Ubuntu Breezy Badger (installed the preview, but now I&#8217;ve updating  it from the devel repo):</p>
<ul>
<li>At first, it uses /usr/dict/words as its default source for search words: In Ubuntu the one is in /usr/share/dict , but no it&#8217;s not the words file you are looking for. It&#8217;s either /usr/share/dict/british-english , /usr/share/dict/american-english or what ever language you want it to use.</li>
<li>You can set this one from the System->Preferences->Screensaver->Select WebCollage screensaver->Settings&#8230;->Advanced >>->Command line
  </li>
<li>It propably says: webcollage -root . Replace it with: webcollage -root -dictionary /usr/share/dict/british-english (or whatever language you want it to use).</li>
<li>After this click OK</li>
<li>Then go to System->Administration->Synaptic Package Manager
  </li>
<li>Install <strong>netpbm</strong> and <strong>libjpeg-progs</strong> packages</li>
<li>There you should be set to go if you have internet connection <img src='http://hiutale.org/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  Now you can just click preview and if images start to appear, you were succesful.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://hiutale.org/2005/09/22/webcollage-xscreensaver/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
