<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
     <link rel="stylesheet" href="http://www.siafoo.net/css/code.css" type="text/css" title="styled"/>
     <title>Random Developments</title>
     <link href="http://www.siafoo.net/user/stou/blog/feed" rel="self"/>
     <link href="http://www.siafoo.net/user/stou/blog"/>
     <id>tag:siafoo.net,2007-12-02:/user/stou/blog</id>
     <updated>2010-07-21T13:33:44-07:00</updated>
     <entry>
       <title>Crapps Be Gone</title>
       <id>tag:siafoo.net,ce9d3237-7d21-5e64-b55f-a94e839d666a</id>
       <link href="http://www.siafoo.net/user/stou/blog/2010/07/21/Crapps-Be-Gone"/>
       <updated>2010-07-21T13:33:44-07:00</updated>
       <author>
           <name>Stou S.</name>
       </author>
       <content type="html">
       <![CDATA[
            <p>Every AT&amp;T mobile phone (except the iPhone) comes with a ton of crappy AT&amp;T branded applications (henceforth known as crapps or crapplets).  These crapplets generally don't add any functionality to your phone since they either duplicate exiting [better] solutions (e.g. AT&amp;T Maps ) or are generally useless (Mobile TV).  My new Android powered <a class="reference external" href="http://www.samsung.com/us/consumer/mobile/mobile-phones/at-t-phones/SGH-I897ZKAATT/index.idx?pagetype=prd_detail&amp;returnurl=">Samsung Captivate</a> came with a bunch of them too:</p>
<blockquote>
<a class="reference external image-reference" href="http://www.siafoo.net/image/200/info"><img alt="http://www.siafoo.net/image/200" src="http://www.siafoo.net/image/200" /></a>
</blockquote>
<p>Since I have always hated the fact that I could not remove these apps from my phone I decided to root it and remove them.  This is what you can do to free yourself:</p>
<div class="note">
<p class="first admonition-title">Note</p>
<p class="last">There's probably an easier / better way to do this...</p>
</div>
<div class="warning">
<p class="first admonition-title">Warning</p>
<p class="last">If you brick your phone (which is unlikely)... it's not my fault.</p>
</div>
<ol class="arabic simple">
<li>Root your phone.  It took me less than 5 minutes to root my  (AT&amp;T's Galaxy S variant) using instructions found on the internets.</li>
<li>Launch the super user application (Ninja icon)</li>
</ol>
<p>There are two ways to continue: With the <a class="reference external" href="http://developer.android.com/sdk/index.html">Android SDK</a> and without.</p>
<p>If you have the <a class="reference external" href="http://developer.android.com/sdk/index.html">Android SDK</a>:</p>
<ol class="arabic" start="3">
<li><p class="first">Connect your phone to your computer and open a shell into the phone using the <tt class="docutils literal">adb shell</tt> command.</p>
</li>
<li><p class="first">(optional) Make a backup of the files using the File Explorer feature of the <a class="reference external" href="http://developer.android.com/guide/developing/tools/ddms.html">Dalvik Debug Monitor</a> (<tt class="docutils literal">ddms</tt>:</p>
<blockquote>
<a class="reference external image-reference" href="http://www.siafoo.net/image/201/info"><img alt="http://www.siafoo.net/image/201" src="http://www.siafoo.net/image/201" /></a>
</blockquote>
</li>
<li><p class="first">Type <tt class="docutils literal">su</tt> in the shell and you should see the Superuser Request box on your phone.</p>
<blockquote>
<a class="reference external image-reference" href="http://www.siafoo.net/image/204/info"><img alt="http://www.siafoo.net/image/204" src="http://www.siafoo.net/image/204" /></a>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal">cd /system/app</tt> and delete the application packages you don't want, such as <em>AT&amp;T Maps</em>, <em>AT&amp;T Navigator</em>, <em>YP Mobile</em>, <em>What</em>, <em>IM service</em>, and <em>MobiTV</em> using the usual shell command <tt class="docutils literal">rm</tt>.</p>
</li>
</ol>
<p>If you don't have the SDK:</p>
<ol class="arabic" start="3">
<li><p class="first">Get <a class="reference external" href="http://code.google.com/p/connectbot/">Connectbot</a> the Android SSH client</p>
<blockquote>
<a class="reference external image-reference" href="http://www.siafoo.net/image/198/info"><img alt="http://www.siafoo.net/image/198" src="http://www.siafoo.net/image/198" /></a>
</blockquote>
</li>
<li><p class="first">Connect to a <tt class="docutils literal">local</tt> <tt class="docutils literal">root</tt> session:</p>
<blockquote>
<a class="reference external image-reference" href="http://www.siafoo.net/image/199/info"><img alt="http://www.siafoo.net/image/199?w=250" src="http://www.siafoo.net/image/199?w=250" style="width: 250px;" /></a>
</blockquote>
</li>
</ol>
<div class="note">
<p class="first admonition-title">Note</p>
<p class="last">Connectbot and Swype have some issues together (i.e. backspace doesn't work) so you should switch your input to another keyboard until this is fixed.</p>
</div>
<ol class="arabic" start="5">
<li><p class="first">Type <tt class="docutils literal">su</tt> in the shell and you should see the Superuser Request box:</p>
<blockquote>
<a class="reference external image-reference" href="http://www.siafoo.net/image/203/info"><img alt="http://www.siafoo.net/image/203" src="http://www.siafoo.net/image/203" /></a>
</blockquote>
</li>
<li><p class="first"><tt class="docutils literal">cd /system/app</tt> and delete the application packages you don't want, such as <em>AT&amp;T Maps</em>, <em>AT&amp;T Navigator</em>, <em>YP Mobile</em>, <em>What</em>, <em>IM service</em>, and <em>MobiTV</em> using the usual shell command <tt class="docutils literal">rm</tt>.</p>
<blockquote>
<a class="reference external image-reference" href="http://www.siafoo.net/image/205/info"><img alt="http://www.siafoo.net/image/205" src="http://www.siafoo.net/image/205" /></a>
</blockquote>
</li>
</ol>
<p>Some crapps lead to web address but those still live in <tt class="docutils literal">/system/app</tt> you just have to use something like <a class="reference external" href="http://www.metago.net/astro/fm/">AStro File Manager</a> to figure out what is what:</p>
<blockquote>
<a class="reference external image-reference" href="http://www.siafoo.net/image/206/info"><img alt="http://www.siafoo.net/image/206" src="http://www.siafoo.net/image/206" /></a>
</blockquote>
<p>On my Captivate <em>AT&amp;T Family Map</em> was called <tt class="docutils literal"><span class="pre">androidlauncher2.1-61x612010_06_11t15_49.apk</span></tt> and <em>AT&amp;T Hotspots</em> was called <tt class="docutils literal">WISPr_v41.apk</tt></p>
<p>Anyway eventually you end up with something like this:</p>
<blockquote>
<a class="reference external image-reference" href="http://www.siafoo.net/image/202/info"><img alt="http://www.siafoo.net/image/202" src="http://www.siafoo.net/image/202" /></a>
</blockquote>
       ]]>
       </content>
     </entry><entry>
       <title>OpenCL screen corruption</title>
       <id>tag:siafoo.net,ce9d3237-7d21-5e64-b55f-a94e839d666a</id>
       <link href="http://www.siafoo.net/user/stou/blog/2010/07/16/OpenCL-screen-corruption"/>
       <updated>2010-07-16T13:49:21-07:00</updated>
       <author>
           <name>Stou S.</name>
       </author>
       <content type="html">
       <![CDATA[
            <p>One of the things I've been working on lately involves smooth particle hydrodynamics (SPH) with OpenCL... anyway last night I tried to simulate 100k particles on my GeForce 9800 (and naive memory management)... it ran out of resources and crashed resulting in total and massive screen corruption:</p>
<a class="reference external image-reference" href="http://www.siafoo.net/image/197/info"><img alt="http://www.siafoo.net/image/197?w=600" src="http://www.siafoo.net/image/197?w=600" style="width: 600px;" /></a>
<p>Everything still worked and I could use the KDE 4.4 with compositing and everything but the whole screen was speckled.  The problem only cleared up after I rebooted the machine (i.e. restarting X did nothing).</p>
       ]]>
       </content>
     </entry><entry>
       <title>Python bindings for OpenCL</title>
       <id>tag:siafoo.net,ce9d3237-7d21-5e64-b55f-a94e839d666a</id>
       <link href="http://www.siafoo.net/user/stou/blog/2010/06/03/Python-bindings-for-OpenCL"/>
       <updated>2010-06-03T01:16:52-07:00</updated>
       <author>
           <name>Stou S.</name>
       </author>
       <content type="html">
       <![CDATA[
            <p>A Google query for &quot;OpenCL python bindings&quot; makes it seem that the only option for using OpenCL from Python is the <a class="reference external" href="http://python-opencl.next-touch.com/">Python-OpenCL</a> library.  However the better option, and the one listed on the <a class="reference external" href="http://www.khronos.org/developers/resources/opencl/">Khronos OpenCL resource page</a>, is <a class="reference external" href="http://mathema.tician.de/software/pyopencl">PyOpenCL</a>.</p>
<p>I tried Python-OpenCL but it didn't actually work and there is no documentation... even the auto-generated docs point to missing pages.  PyOpenCL on the other hand seems fairly active, well documented, works, and uses <a class="reference external" href="http://www.boost.org/doc/libs/release/libs/python/doc">Boost::Python</a>.  Anyway save yourself an hour and <strong>use</strong> <a class="reference external" href="http://mathema.tician.de/software/pyopencl">PyOpenCL</a>.</p>
       ]]>
       </content>
     </entry><entry>
       <title>Finally! OpenCL drivers in RPM Fusion</title>
       <id>tag:siafoo.net,ce9d3237-7d21-5e64-b55f-a94e839d666a</id>
       <link href="http://www.siafoo.net/user/stou/blog/2010/03/31/Finally-OpenCL-drivers-in-RPM-Fusion"/>
       <updated>2010-03-31T22:58:49-07:00</updated>
       <author>
           <name>Stou S.</name>
       </author>
       <content type="html">
       <![CDATA[
            <p>Today an <a class="reference external" href="http://rpmfusion.org/">RPM Fusion</a> update brought the 195.36.15 NVIDIA driver and with it the OpenCL and CUDA libraries and headers that I have been waiting months to use under Linux.  My desperation for OpenCL was so powerful that I even tried using the binaries provided by NVIDIA... which didn't end well.</p>
<p>Anyway here's a screenshot of the NBody demo</p>
<a class="reference external image-reference" href="http://www.siafoo.net/image/194/info"><img alt="http://www.siafoo.net/image/194?w=500" src="http://www.siafoo.net/image/194?w=500" style="width: 500px;" /></a>
<p>NVIDA's has a bunch of other cool samples on their <a class="reference external" href="http://developer.nvidia.com/object/opencl.html">OpenCL portal</a></p>
<p>To be honest at some point in the last month I had working OpenCL but I have no idea if it was due to the NVIDIA binary installer or if the OpenCL shared library accidentally slipped into RPM Fusion... but then the library vanished.  Hopefully it will stay around until I have time to play with it.</p>
       ]]>
       </content>
     </entry><entry>
       <title>Blender 2.5 No module named encodings.utf_8</title>
       <id>tag:siafoo.net,ce9d3237-7d21-5e64-b55f-a94e839d666a</id>
       <link href="http://www.siafoo.net/user/stou/blog/2010/03/25/Blender-2-5-No-module-named-encodings-utf_8"/>
       <updated>2010-03-25T20:55:08-07:00</updated>
       <author>
           <name>Stou S.</name>
       </author>
       <content type="html">
       <![CDATA[
            <p>I haven't used <a class="reference external" href="http://www.blender.org/">Blender</a> for months but since I am in need of some 3D graphics for a presentation I decided it was a good time to try out the new <a class="reference external" href="http://www.blender.org/development/release-logs/blender-250/">2.5</a> version.  Building blender from source is usually quite painless so after following the <a class="reference external" href="http://wiki.blender.org/index.php/Dev:2.5/Doc/Building_Blender/Linux/Fedora_12/Scons">Fedora 12 guide</a> (and using the pre-built Python 3.1 rpms) I was surprised to discover that running the binary caused an error:</p>
<pre class="literal-block">
found bundled python: /home/stou/src/blender-svn/install/linux2/.blender/python
Fatal Python error: Py_Initialize: can't initialize sys standard streams
ImportError: No module named encodings.utf_8
</pre>
<p>The problem was the existence of the empty <tt class="docutils literal"><span class="pre">blender-svn/install/linux2/.blender/python</span></tt> directory... maybe it was causing blender to think that it should use the bundled version of python3.1 instead of the system default one.  Who knows, deleting the directory (<tt class="docutils literal">rm <span class="pre">-rf</span> <span class="pre">/home/stou/src/blender-svn/install/linux2/.blender/python</span></tt>) fixed the problem:</p>
<a class="reference external image-reference" href="http://www.siafoo.net/image/193/info"><img alt="http://www.siafoo.net/image/193?w=500" src="http://www.siafoo.net/image/193?w=500" style="width: 500px;" /></a>
<p>Oh and the relevant lines of my <tt class="docutils literal"><span class="pre">user-config.py</span></tt> file are:</p>
<pre class="literal-block">
BF_PYTHON=&quot;/usr/lib64/python3.1&quot;
BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib-dynload'
BF_PYTHON_VERSION = '3.1'
BF_PYTHON_INC = '/usr/include/python${BF_PYTHON_VERSION}'
BF_PYTHON_BINARY = '/usr/bin/python${BF_PYTHON_VERSION}'
</pre>
<p>By the way if you run blender but none of the tools show up:</p>
<a class="reference external image-reference" href="http://www.siafoo.net/image/192/info"><img alt="http://www.siafoo.net/image/192?w=500" src="http://www.siafoo.net/image/192?w=500" style="width: 500px;" /></a>
<p>you are missing the <tt class="docutils literal">.blender</tt> directory</p>
       ]]>
       </content>
     </entry><entry>
       <title>Fn</title>
       <id>tag:siafoo.net,ce9d3237-7d21-5e64-b55f-a94e839d666a</id>
       <link href="http://www.siafoo.net/user/stou/blog/2010/02/10/Fn"/>
       <updated>2010-02-10T21:11:09-08:00</updated>
       <author>
           <name>Stou S.</name>
       </author>
       <content type="html">
       <![CDATA[
            <p>Ever since I got my first laptop, nearly a decade ago, I have attempted to awaken it from suspended mode by randomly taping on the Fn, Ctrl, Alt, or Shift keys. It always annoyed me that the system would come out of stand by after a random time interval (no I am not getting a Mac) but since I rarely put it to sleep without shutting the screen this did not pose such a problem.  Lately my machine has been suspending itself while sitting opened next to me so I've had to endure the annoying non deterministic awakenings more and more every day.</p>
<a class="reference external image-reference" href="http://www.siafoo.net/image/187/info"><img alt="http://www.siafoo.net/image/187" src="http://www.siafoo.net/image/187" /></a>
<p>Anyway today I figured out that the whole time I simply had to hold down the <tt class="docutils literal">Fn</tt> key and the machine would come out of stand by like magic.</p>
       ]]>
       </content>
     </entry><entry>
       <title>Protocol Buffers and Eclipse</title>
       <id>tag:siafoo.net,ce9d3237-7d21-5e64-b55f-a94e839d666a</id>
       <link href="http://www.siafoo.net/user/stou/blog/2010/01/29/Protocol-Buffers-and-Eclipse"/>
       <updated>2010-01-29T20:45:26-08:00</updated>
       <author>
           <name>Stou S.</name>
       </author>
       <content type="html">
       <![CDATA[
            <p>One of my current projects involves sending data to a remote server using Google's <a class="reference external" href="http://code.google.com/p/protobuf/">Protocol Buffers</a>.  PBs let you define your data using a <em>simple</em> definition language which is then compiled into language specific (C++, Java, Python) load/store classes using the protocol compiler, <tt class="docutils literal">protoc</tt>.  This approach saves oodles of time but presents the slight annoyance of having to compile the <tt class="docutils literal">.proto</tt> files whenever they change.</p>
<p>While <a class="reference external" href="http://www.eclipse.org/">Eclipse</a> automagically compiles all of my Java code it doesn't support PBs &quot;out of the box&quot; (or in any way actually) so every time I modify the PB definition file I must compile it by hand.  After the fourth instance of changing the <tt class="docutils literal">.proto</tt> file &quot;for the last time&quot; it become obvious that a better solution was needed.  Using a shell alias, <tt class="docutils literal">make</tt> file, or an ant build script all seemed like poor solutions.  Then it hit me, Eclipse <strong>must</strong> have support for external tooling.</p>
<p>Sure enough one could use an external program as a project Builder like this:</p>
<p>In the project properties dialog under Builders select <strong>New</strong></p>
<a class="reference external image-reference" href="http://www.siafoo.net/image/178/info"><img alt="http://www.siafoo.net/image/178?w=420" src="http://www.siafoo.net/image/178?w=420" style="width: 420px;" /></a>
<p>then <strong>Program</strong></p>
<a class="reference external image-reference" href="http://www.siafoo.net/image/179/info"><img alt="http://www.siafoo.net/image/179?w=225" src="http://www.siafoo.net/image/179?w=225" style="width: 225px;" /></a>
<p>which will open a dialog where you can enter information about the executable (eg. <tt class="docutils literal">protoc</tt>) and the necessary arguments to run it.</p>
<a class="reference external image-reference" href="http://www.siafoo.net/image/180/info"><img alt="http://www.siafoo.net/image/180?w=290" src="http://www.siafoo.net/image/180?w=290" style="width: 290px;" /></a>
<p>In the <strong>Build Options</strong> tab make sure to select <strong>During auto builds</strong> (<strong>After clean</strong> is also a good idea I believe) and to also specify the resource to monitor, that is your <tt class="docutils literal">.proto</tt> file by...</p>
<a class="reference external image-reference" href="http://www.siafoo.net/image/181/info"><img alt="http://www.siafoo.net/image/181?w=290" src="http://www.siafoo.net/image/181?w=290" style="width: 290px;" /></a>
<p>...clicking <strong>Specify Resource</strong> and finding your <tt class="docutils literal">.proto</tt> file.</p>
<a class="reference external image-reference" href="http://www.siafoo.net/image/182/info"><img alt="http://www.siafoo.net/image/182?w=305" src="http://www.siafoo.net/image/182?w=305" style="width: 305px;" /></a>
<div class="warning">
<p class="first admonition-title">Warning</p>
<p class="last">Make sure that your PB builder is at the very top of the builder list (or at least before the Java Builder) or else you'll always be compiling the previous version.</p>
</div>
<p>After 25 hair-pulling-minutes of trying to figure out WHY?! <tt class="docutils literal">protoc</tt> doesn't like your arguments you will notice that it requires both the full path to the <tt class="docutils literal">.proto</tt> file and the same path passed to the <tt class="docutils literal"><span class="pre">-I</span></tt> parameter.</p>
<p>That is all.  Please enjoy <a class="reference external" href="http://code.google.com/p/protobuf/">Protocol Buffers</a> and the <a class="reference external" href="http://www.eclipse.org/">Eclipse</a> external builders responsibly.</p>
       ]]>
       </content>
     </entry><entry>
       <title>eBook reader</title>
       <id>tag:siafoo.net,ce9d3237-7d21-5e64-b55f-a94e839d666a</id>
       <link href="http://www.siafoo.net/user/stou/blog/2010/01/21/eBook-reader"/>
       <updated>2010-01-20T22:18:30-08:00</updated>
       <author>
           <name>Stou S.</name>
       </author>
       <content type="html">
       <![CDATA[
            <p>One of my relatives today asked me about eBook readers... although I sort of look at them as a gimmick I had recently investigated the capabilities of the <a class="reference external" href="http://www.amazon.com/gp/product/B0015TG12Q?ie=UTF8&amp;tag=siafoo-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=B0015TG12Q">Kindle</a>, <a class="reference external" href="http://en.wikipedia.org/wiki/Sony_Reader">Sony Reader</a> and the <a class="reference external" href="http://www.barnesandnoble.com/nook/">Nook</a>.  (While Wikipedia has a <a class="reference external" href="http://en.wikipedia.org/wiki/List_of_e-book_readers">whole list of</a> readers, it seems that these three are the main contenders).</p>
<p>I explained that they are better off reading books the old fashioned way and then donating these books to the library or the local thrift store.</p>
<p>But I started thinking: &quot;Hmm these things would be decent for reading papers. Like if I could browse <a class="reference external" href="http://scholar.google.com/">Google Scholar</a> and/or read the <a class="reference external" href="http://arxiv.org/">arXiv</a>, maybe even subscribe to RSS feeds... then I'd buy one&quot;.  It seems though that I already poses such a device: my computer(s).</p>
<p>Actually if I could get licenses to read all of my existing texts...</p>
       ]]>
       </content>
     </entry><entry>
       <title>Google Docs</title>
       <id>tag:siafoo.net,ce9d3237-7d21-5e64-b55f-a94e839d666a</id>
       <link href="http://www.siafoo.net/user/stou/blog/2010/01/21/Google-Docs"/>
       <updated>2010-01-20T19:42:00-08:00</updated>
       <author>
           <name>Stou S.</name>
       </author>
       <content type="html">
       <![CDATA[
            <p>Ever wondered how to write an equal sign <tt class="docutils literal"><span class="pre">=</span></tt> inside a cell in Excel or Google Docs?  Type an apostrophe character before hand like: <tt class="docutils literal"><span class="pre">'=</span></tt> and have the cell formating be set to <em>Normal</em>.  There, I just saved you 30 minutes... now go post some code.</p>
       ]]>
       </content>
     </entry><entry>
       <title>rpm SPEC file comments are like my vestigal tail: useless</title>
       <id>tag:siafoo.net,ce9d3237-7d21-5e64-b55f-a94e839d666a</id>
       <link href="http://www.siafoo.net/user/stou/blog/2010/01/09/rpm-SPEC-file-comments-are-like-my-vestigal-tail-useless"/>
       <updated>2010-01-09T00:02:15-08:00</updated>
       <author>
           <name>Stou S.</name>
       </author>
       <content type="html">
       <![CDATA[
            <p>Just in case you are wondering... <tt class="docutils literal">rpm</tt> SPEC file comments do absolutely nothing... at all.</p>
<pre class="literal-block">
%install
#%makeinstall
make install DESTDIR=$RPM_BUILD_ROOT
</pre>
<p>try it:</p>
<pre class="literal-block">
CMake Error at cmake_install.cmake:41 (FILE):
  file INSTALL cannot copy file
  &quot;/home/stou/rpmbuild/BUILD/generatorrunner-0.3.3/build/libgenrunner.so.0.3.3&quot;
  to &quot;/usr/lib64/libgenrunner.so.0.3.3&quot;.
</pre>
<p>How do you like that? Did you just waste 2 hours of your life?  Well maybe you shouldn't expect things to work as documented.  Best of all... <a class="reference external" href="http://www.siafoo.net/user/david">someone</a> knew about this but failed to mention it  (but I am not bitter).</p>
       ]]>
       </content>
     </entry><entry>
       <title>Archimedes's writing under X-Ray</title>
       <id>tag:siafoo.net,ce9d3237-7d21-5e64-b55f-a94e839d666a</id>
       <link href="http://www.siafoo.net/user/stou/blog/2009/10/05/Archimedes-s-writing-under-X-Ray"/>
       <updated>2009-10-05T13:21:45-07:00</updated>
       <author>
           <name>Stou S.</name>
       </author>
       <content type="html">
       <![CDATA[
            <p>Each week the department (like most departments) hosts a colloquium, a not-so-technical hour and a half long seminar with topics spanning the whole range of physics... from pure theory to applications in various fields.  Because physics can be applied to anything (like <a class="reference external" href="http://physics.clarku.edu/~akudrolli/preprints/stability2.pdf">stability of sand castles</a>), as an undergrad I once heard a talk on how airplanes actually fly (no it's not really Bernoulli's principle) and one where Doug Osheroff gave an account of his involvement with the <a class="reference external" href="http://en.wikipedia.org/wiki/Space_Shuttle_Columbia_disaster">Columbia accident investigation board</a>.</p>
<p>Today however was the first colloquium that had anything to do with the Classics. <a class="reference external" href="http://www.archimedespalimpsest.org/imaging_experimental4.html">The project</a> involved bombarding the parchment from an old prayer book (made of a recycled Archmedien text) with X-Ray's from a synchrotron at SLAC in order to trigger <a class="reference external" href="http://en.wikipedia.org/wiki/X-ray_fluorescence">X-Ray flourescence</a> in the ink and allow the researchers to read the over-written text and gain a better understanding of Archimede's theories.  While I am not much into <em>The Classics</em> this project is very very cool and the talk was excellent.</p>
       ]]>
       </content>
     </entry><entry>
       <title>Wooo Hooo</title>
       <id>tag:siafoo.net,ce9d3237-7d21-5e64-b55f-a94e839d666a</id>
       <link href="http://www.siafoo.net/user/stou/blog/2009/07/07/Wooo-Hooo"/>
       <updated>2009-07-07T02:39:14-07:00</updated>
       <author>
           <name>Stou S.</name>
       </author>
       <content type="html">
       <![CDATA[
            <p>For the past 2 hours I have been trying to get <a class="reference external" href="http://www.riverbankcomputing.co.uk/software/pyqt/intro">PyQt4</a> and <a class="reference external" href="http://www.vtk.org/">VTK</a> to work together.  Sure there is a VTK+PyQt4 example and also plenty of PyQt documentation but when I would try to embed the VTK widget inside my application window I would get garbage and the terminal would be flooded with millions of:</p>
<pre class="literal-block">
X Error: BadWindow (invalid Window parameter) 3
  Major opcode: 3 (X_GetWindowAttributes)
  Resource id:  0x380000e
X Error: GLXBadDrawable 146
  Extension:    135 (Uknown extension)
  Minor opcode: 5 (Unknown request)
  Resource id:  0x380000e
X Error: GLXBadDrawable 146
  Extension:    135 (Uknown extension)
  Minor opcode: 5 (Unknown request)
  Resource id:  0x380000e
</pre>
<p>After examining the code for the <cite>QVTKRenderWindowInteractor.py</cite> widget I decided to try subclassing it from the Qt OpenGL widget (the way the wxPython equivalent does it) instead of the plain vanilla QWidget... but it still didn't work... so I went back to default implementation and kept trying to find the problem.  I fixed a silly bug in my code and things started to crash in a different way (progress!).  Another couple of interweb searches uncovered a <tt class="docutils literal"><span class="pre">QVTKRenderWindowInteractor.py</span></tt> version that, like <a class="reference external" href="http://www.siafoo.net/snippet/315">my version</a>, used <tt class="docutils literal"><span class="pre">QGLWidget</span></tt> as its base class, so I switched back to my version and everything started <strong>working</strong>.</p>
<a class="reference external image-reference" href="http://www.siafoo.net/image/172/info"><img alt="http://www.siafoo.net/image/172?w=400" src="http://www.siafoo.net/image/172?w=400" style="width: 400px;" /></a>
<p>The result is that the interface was faster than the wxPython version (maybe because I am running KDE), and <a class="reference external" href="http://www.siafoo.net/blog/RandomDevelopments/2009/07/06/Goodbye-wxPython">fit all my requirements</a>.  But to my horror I discovered that PyQt is GPL (Qt is LGPL which led to the confusion) and my code is [New] BSD... I <em>really really</em> dislike the GPL (<a class="reference external" href="http://neuroimaging.scipy.org/site/doc/manual/html/faq/johns_bsd_pitch.html">why?</a>) and spent a while searching the internet to see if using GPL python libraries is ok with BSD code.  I even asked in <tt class="docutils literal"><span class="pre">#python</span></tt> and received a very out of character for <tt class="docutils literal"><span class="pre">#python</span></tt> but typically unhelpful IRC reply of &quot;Ask your lawyer&quot;.  Anyway as it turns out the <a class="reference external" href="http://doc.trolltech.com/4.4/license-gpl-exceptions.html">Trolltech GPL exception</a> allowed me to <em>dodge the GPL bullet</em>.</p>
       ]]>
       </content>
     </entry><entry>
       <title>Goodbye wxPython (?)</title>
       <id>tag:siafoo.net,ce9d3237-7d21-5e64-b55f-a94e839d666a</id>
       <link href="http://www.siafoo.net/user/stou/blog/2009/07/06/Goodbye-wxPython"/>
       <updated>2009-07-06T16:00:49-07:00</updated>
       <author>
           <name>Stou S.</name>
       </author>
       <content type="html">
       <![CDATA[
            <p>The project I have been working on for the past week or so is based on wxPython (+AUI) and VTK.  Unfortunately the documentation for wxPython, when it comes to all but the most basic things, is minimal... at best... and the bugs seem plentiful (in wxAUI at least).</p>
<p>This has led me to waste several hours on annoying things like sizers not growing when they should and random crashes because I have composting on (wtf right?)... which has made me loose trust in wxPython as a toolkit and I really want... no I <strong>need</strong> this program to be rock solid.  Also reading the <a class="reference external" href="http://saya-videoeditor.blogspot.com/2009/01/its-official-were-moving-to-qt4.html">saya blog</a> made me realize I am not the only one having problems with wxAUI.</p>
<p>I don't want to imply that wxPython is garbage or anything... it's nice for creating quick and simple GUIs but the severe lack of actual documentation (especially at the fringes) has forced me to evaluate Qt as a possible replacement.</p>
<p>In the principle of <em>measure twice, cut once</em> before jumping into porting code I need to evaluate:</p>
<ol class="arabic simple">
<li>Event Model</li>
<li>Common dialogs (e.g. Color Selection, File Open/Save)</li>
<li>Existence of advanced 3rd party widgets (e.g. Scintilla)</li>
<li>Ease of writing custom widgets (like: <a class="reference external" href="http://www.siafoo.net/snippet/122">wxPython Transfer Function Widget</a>)</li>
<li>Existence of Qt ports of example code the app uses (like Python console)</li>
<li>Ease of integration with 3rd party toolkits (e.g. VTK)</li>
<li>Documentation</li>
</ol>
<p>I should also start porting from the bigger pieces (VTK integration) to see if Qt is just as slow as wxAUI when it comes to VTK.  Hmm maybe I'll write an article about it... and finally get a Siafoo ranking higher than David.</p>
<p>One could actually use the wxWidgets documentations with wxPython but when it comes to wxAUI there is basically no docs... at all. Yes I could actually post on mailing lists and support forums but that implies waiting for hours or even days for a response.  Anyway I still like and will probably use wxWidgets (and wxPython) in the future... just not for this project.</p>
       ]]>
       </content>
     </entry><entry>
       <title>If windows sucks so much...</title>
       <id>tag:siafoo.net,ce9d3237-7d21-5e64-b55f-a94e839d666a</id>
       <link href="http://www.siafoo.net/user/stou/blog/2009/06/26/If-windows-sucks-so-much"/>
       <updated>2009-06-25T17:13:25-07:00</updated>
       <author>
           <name>Stou S.</name>
       </author>
       <content type="html">
       <![CDATA[
            <p>Why does it only take 15 seconds to boot up... versus the nearly 3 minutes it takes me to load Fedora (my default environment)? And why oh why... does my ext4 partition have to be checked every <tt class="docutils literal"><span class="pre">X</span></tt> number of mounts... what's the point of the journaling?  Ughh... do you know how long it takes to verify a 1TB partition?</p>
<p>Anyway, every time I upgrade the OS I loose between 3 hours and 3 months of productivity.  When F9 came out it took months for the proprietary nvidia drivers to start working with the X.org 1.5 server... so I stopped upgrading instantly.  F10 posed no problems for me so I planned to do a clean install (and get rid of all of the crap left over from years of upgrading through yum... ) of F11 soon after it came out (even jigdoed the DVD and played with the Preview version on VirtualBox) but clean installs suck down even more productivity, so I procrastinated on it for a while...</p>
<p>Last night the update-status icon in the system tray (no clue what program creates that) popped up and asked me if I wanted to update my distribution... so I clicked <em>Yes</em>.  It downloaded all the required packages and after a reboot it started the installation procedure... it worked flawlessly.  Except I lost 2+ hours because my beta version of KDE didn't work with F11... but that's my fault.  I guess I won't be doing a clean install this version =/</p>
<p>Then I lost another hour (or two) because I couldn't find the window decorator theme I like (I had forgotten what it's called)... It has been years since I cared enough to customize the appearance of my computer (beyond a wallpaper) but I really hate the little lines in the titlebar of the default KDE 4 decorator and also how bubbly and 3Dish of the default plasma theme is:</p>
<a class="reference external image-reference" href="http://www.siafoo.net/image/164/info"><img alt="http://www.siafoo.net/image/164?w=600" src="http://www.siafoo.net/image/164?w=600" style="width: 600px;" /></a>
<p>Normally one can use KDE's <em>Get Hot New Stuff</em> to download plasma widgets, desktop wallpapers, and other random stuff through the interface of the control panel itself... but window decorators are actual binaries so they must be installed from source (or RPMs).  After about an hour I found the theme on the <a class="reference external" href="http://software.opensuse.org/search?baseproject=Fedora%3A10&amp;p=1&amp;q=kde4-windeco-domino">OpenSUSE site</a>... it's really nice of OpenSUSE to build RPMs for other distros.  Anyway the window decorator theme is apparently called Domino and along with the <em>Glassfied</em> plasma theme my environment looks something like this:</p>
<a class="reference external image-reference" href="http://www.siafoo.net/image/165/info"><img alt="http://www.siafoo.net/image/165?w=600" src="http://www.siafoo.net/image/165?w=600" style="width: 600px;" /></a>
<p>Note how much cleaner everything looks.... it's even better with compositing enabled... (these are obviously VirtualBox screenshots and I don't care enough to get compositing working under them)</p>
       ]]>
       </content>
     </entry><entry>
       <title>Ahhh, it was working all along...</title>
       <id>tag:siafoo.net,ce9d3237-7d21-5e64-b55f-a94e839d666a</id>
       <link href="http://www.siafoo.net/user/stou/blog/2009/05/23/Ahhh-it-was-working-all-along"/>
       <updated>2009-05-23T02:54:55-07:00</updated>
       <author>
           <name>Stou S.</name>
       </author>
       <content type="html">
       <![CDATA[
            <p>While building the tree generator I needed to figure out the bounding box for the tree.  The problem is that each branch is rotated
and translated using Ri calls so that the nurbs tubes themselves are always drawn at <tt class="docutils literal"><span class="pre">(0,0,0)</span></tt> in the <tt class="docutils literal"><span class="pre">Z</span></tt> direction.</p>
<p>Translation was easy but the rotation naturally requires the use of <a class="reference external" href="http://www.siafoo.net/snippet/303">the rotation matrix</a>...
ok that's not really that complicated but doing it <em>right</em>, and thus allowing for rotations around an arbitrary axis, requires that
all three rotation matrices (i.e. along X, Y, Z) are added... again that's not that difficult but since there are a lot of terms things
can get out of control quickly:</p>
                        <div id="1" class='code'>
                            <a class='toggle_linenos' href='#'>
                                #&#8202;'s
                            </a>
                            <div class="highlight"><pre><span class="lineno">1</span><span class="n">m_Bounds</span><span class="p">[</span><span class="mi">0</span><span class="p">][</span><span class="n">i</span><span class="p">]</span> <span class="o">=</span> <span class="n">x</span><span class="o">*</span><span class="p">(</span><span class="n">uX</span><span class="o">*</span><span class="n">uX</span><span class="o">*</span><span class="p">(</span><span class="mi">1</span> <span class="o">-</span> <span class="n">c</span><span class="p">)</span> <span class="o">+</span> <span class="n">c</span><span class="p">)</span>    <span class="o">+</span> <span class="n">y</span><span class="o">*</span><span class="p">(</span><span class="n">uX</span><span class="o">*</span><span class="n">uY</span><span class="o">*</span><span class="p">(</span><span class="mi">1</span> <span class="o">-</span> <span class="n">c</span><span class="p">)</span> <span class="o">-</span> <span class="n">uZ</span><span class="o">*</span><span class="n">s</span><span class="p">)</span>  <span class="o">+</span> <span class="n">z</span><span class="o">*</span><span class="p">(</span><span class="n">uX</span><span class="o">*</span><span class="n">uZ</span><span class="o">*</span><span class="p">(</span><span class="mi">1</span> <span class="o">-</span> <span class="n">c</span><span class="p">)</span> <span class="o">+</span> <span class="n">uY</span><span class="o">*</span><span class="n">s</span><span class="p">);</span><br /><span class="lineno">2</span><span class="n">m_Bounds</span><span class="p">[</span><span class="mi">1</span><span class="p">][</span><span class="n">i</span><span class="p">]</span> <span class="o">=</span> <span class="n">x</span><span class="o">*</span><span class="p">(</span><span class="n">uX</span><span class="o">*</span><span class="n">uY</span><span class="o">*</span><span class="p">(</span><span class="mi">1</span> <span class="o">-</span> <span class="n">c</span><span class="p">)</span> <span class="o">+</span> <span class="n">uZ</span><span class="o">*</span><span class="n">s</span><span class="p">)</span> <span class="o">+</span> <span class="n">y</span><span class="o">*</span><span class="p">(</span><span class="n">uY</span><span class="o">*</span><span class="n">uY</span><span class="o">*</span><span class="p">(</span><span class="mi">1</span> <span class="o">-</span> <span class="n">c</span><span class="p">)</span> <span class="o">+</span> <span class="n">c</span><span class="p">)</span>     <span class="o">+</span> <span class="n">z</span><span class="o">*</span><span class="p">(</span><span class="n">uY</span><span class="o">*</span><span class="n">uZ</span><span class="o">*</span><span class="p">(</span><span class="mi">1</span> <span class="o">-</span> <span class="n">c</span><span class="p">)</span> <span class="o">-</span> <span class="n">uX</span><span class="o">*</span><span class="n">s</span><span class="p">);</span><br /><span class="lineno">3</span><span class="n">m_Bounds</span><span class="p">[</span><span class="mi">2</span><span class="p">][</span><span class="n">i</span><span class="p">]</span> <span class="o">=</span> <span class="n">x</span><span class="o">*</span><span class="p">(</span><span class="n">uX</span><span class="o">*</span><span class="n">uZ</span><span class="o">*</span><span class="p">(</span><span class="mi">1</span> <span class="o">-</span> <span class="n">c</span><span class="p">)</span> <span class="o">-</span> <span class="n">uY</span><span class="o">*</span><span class="n">s</span><span class="p">)</span> <span class="o">+</span> <span class="n">y</span><span class="o">*</span><span class="p">(</span><span class="n">uY</span><span class="o">*</span><span class="n">uZ</span><span class="o">*</span><span class="p">(</span><span class="mi">1</span> <span class="o">-</span> <span class="n">c</span><span class="p">)</span> <span class="o">+</span> <span class="n">uX</span><span class="o">*</span><span class="n">s</span><span class="p">)</span>  <span class="o">+</span> <span class="n">z</span><span class="o">*</span><span class="p">(</span><span class="n">uZ</span><span class="o">*</span><span class="n">uZ</span><span class="o">*</span><span class="p">(</span><span class="mi">1</span> <span class="o">-</span> <span class="n">c</span><span class="p">)</span> <span class="o">+</span> <span class="n">c</span><span class="p">);</span><br /></pre></div>
                        </div>
                        <p>Anyway so I implemented it and it worked <em>on the first try</em>, using a single branch rotated 90 degrees.  But when I tested it
with a branch at 45 degrees instead of seeing a 45 degree rotated box inscribing the branch-tube I had a huge flat pizza box:</p>
<a class="reference external image-reference" href="http://www.siafoo.net/image/158/info"><img alt="http://www.siafoo.net/image/158" src="http://www.siafoo.net/image/158" /></a>
<p>I checked the matrix and found a small bug in one of the terms but fixing it had no effect... arghh wtf?!?!  So I checked the maths three more
times using independent sources (<a class="reference external" href="http://mathworld.wolfram.com/RotationMatrix.html">MathWorld</a>,
<a class="reference external" href="http://en.wikipedia.org/wiki/Rotation_matrix#Axis_of_a_rotation">Wikipedia</a>, and <a class="reference external" href="http://www.kwon3d.com/theory/transform/rot.html">another website</a>)
even looked at my linear algebra and physics textbooks... it was correct.  Finall after I tried several different angles it dawned
on me it's a <strong>bounding box</strong> which by definition is composed of the min/max coordinates along each axis so its sides always line up with the world axis...
and as such the thing  <strong>is</strong> supposed to look like a pizza box... what a waste of 15 minutes.</p>
<p>Morals (choose one):</p>
<ol class="arabic simple">
<li>Know what the correct output looks like because it may look wrong... but be right.</li>
<li>If you expect your code to produce incorrect results you'll believe it has... even when it's right.</li>
<li>When you think the output is wrong make sure it actually <strong>is</strong> before looking for problems.</li>
</ol>
       ]]>
       </content>
     </entry>
</feed>