<?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>iamstuffed.com &#187; Programming</title>
	<atom:link href="http://iamstuffed.com/blog/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://iamstuffed.com/blog</link>
	<description></description>
	<lastBuildDate>Fri, 16 Apr 2010 01:36:58 +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>Debugging JNI code in Java using GDB</title>
		<link>http://iamstuffed.com/blog/2009/02/13/debugging-jni-code-in-java-using-gdb/</link>
		<comments>http://iamstuffed.com/blog/2009/02/13/debugging-jni-code-in-java-using-gdb/#comments</comments>
		<pubDate>Fri, 13 Feb 2009 18:40:25 +0000</pubDate>
		<dc:creator>iamstuffed</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[debug]]></category>
		<category><![CDATA[gdb]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[jni]]></category>

		<guid isPermaLink="false">http://iamstuffed.com/blog/?p=125</guid>
		<description><![CDATA[Lately, I&#8217;ve had to debug JNI code used by my Java Web Start application.  Some of the issues I&#8217;ve dealt with did not show up until the code was combined and used in the resulting application.  The following was how I used GDB to debug the code.
First, start the application as usual.  I [...]]]></description>
			<content:encoded><![CDATA[<p>Lately, I&#8217;ve had to debug JNI code used by my Java Web Start application.  Some of the issues I&#8217;ve dealt with did not show up until the code was combined and used in the resulting application.  The following was how I used GDB to debug the code.</p>
<p>First, start the application as usual.  I was debugging a java web start application, so my command will be slightly different, but the debugging procedure will work regardless of what java program you are running.  At the command line, you can type the following to launch the jnlp file:</p>
<p><code>javaws &lt; location of jnlp file &gt;</code></p>
<p>The jnlp file can be local or a remote file, just as long as it references and loads the code you are debugging.  After it loads, the process ID needs to be found.  Usually, I&#8217;ll just look at all the java processes running and can figure out which one is the application I&#8217;m interetesd in:</p>
<p><code>pa aux | grep java</code></p>
<p>Once the process ID has been identified, gdb can be launched and attached to the running process:</p>
<p><code>gdb -p &lt; PID &gt;</code></p>
<p>This starts gdb and attaches to the java program.  At this point, the execution blocks until you do something with it.  Just type &#8220;continue&#8221; and run the program as usual.  When or if the program causes a segmentation fault, the debugger will block; you can then do a backtrace and see exactly what file and what line caused the issue.</p>
]]></content:encoded>
			<wfw:commentRss>http://iamstuffed.com/blog/2009/02/13/debugging-jni-code-in-java-using-gdb/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Text2D class</title>
		<link>http://iamstuffed.com/blog/2008/06/10/text2d-class/</link>
		<comments>http://iamstuffed.com/blog/2008/06/10/text2d-class/#comments</comments>
		<pubDate>Wed, 11 Jun 2008 00:20:00 +0000</pubDate>
		<dc:creator>iamstuffed</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Bug]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Java3D]]></category>

		<guid isPermaLink="false">http://iamstuffed.com/blog/2008/06/10/text2d-class/</guid>
		<description><![CDATA[At work, I&#8217;ve been working on a new Java3D project.  Java3D has been great so far, and I&#8217;ve gotten a simple visualization program up and running in two weeks.  Today, I had to figure out how to determine the actual width of a Text2D object.  Creating a BoundingBox with the Text2D object&#8217;s getBounds() method doesn&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>At work, I&#8217;ve been working on a new Java3D project.  Java3D has been great so far, and I&#8217;ve gotten a simple visualization program up and running in two weeks.  Today, I had to figure out how to determine the actual width of a Text2D object.  Creating a BoundingBox with the Text2D object&#8217;s getBounds() method doesn&#8217;t actually help, since it seems the dimensions are always a power of two.  I needed the actual width (the height can be calculated by multiplying the font size by the the rectangle scale factor), but the bounds returned didn&#8217;t give the the value I needed; it was close, but I needed to position the text to create an annotated axis.</p>
<p>My solution?  I had to rewrite the Text2D class.  I read a forum that mentioned this as a solution, but it didn&#8217;t give the code or how to do it.  If you go to the Java3D website (https://java3d.dev.java.net), you can browse the source code.  The Text2D class is located in the j3d-core-utils subproject.  I just copied the source file, added two private variables (height and width), created accessor methods getWidth and getHeight, and stored the height and width when it is calculated in the setupImage method.  Just change the package name and you can use the new class the same way the regular Text2D class is used.</p>
<p>What I don&#8217;t understand is, why didn&#8217;t Sun or the community in general do this?  It&#8217;s a really simple fix.  How do people even use the class if they can&#8217;t accurately determine how much space the actual text uses?  I&#8217;ll post the code (with the simple modifications) tomorrow.</p>
<p><a href='http://iamstuffed.com/blog/wp-content/uploads/2008/06/text2d.java'>Text2D.java</a></p>
]]></content:encoded>
			<wfw:commentRss>http://iamstuffed.com/blog/2008/06/10/text2d-class/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Compiling Firebird 2.1.0 for OSX using Mono 1.2.6</title>
		<link>http://iamstuffed.com/blog/2008/02/22/compiling-firebird-210-for-osx-using-mono-126/</link>
		<comments>http://iamstuffed.com/blog/2008/02/22/compiling-firebird-210-for-osx-using-mono-126/#comments</comments>
		<pubDate>Sat, 23 Feb 2008 03:24:01 +0000</pubDate>
		<dc:creator>iamstuffed</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Firebird]]></category>
		<category><![CDATA[Mono]]></category>
		<category><![CDATA[OSX]]></category>

		<guid isPermaLink="false">http://iamstuffed.com/blog/2008/02/22/compiling-firebird-210-for-osx-using-mono-126/</guid>
		<description><![CDATA[I&#8217;m thinking of doing a project with C#, and I&#8217;d like to use an embeddable database, so I browsed the interweb and found this interesting project: http://www.firebirdsql.org/.  I think this project is one reason Firefox had to change it&#8217;s name a second time.
The source distribution for Firebird 2.1.0 has a solution file for building [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m thinking of doing a project with C#, and I&#8217;d like to use an embeddable database, so I browsed the interweb and found this interesting project: <a href="http://www.firebirdsql.org/">http://www.firebirdsql.org/</a>.  I think this project is one reason Firefox had to change it&#8217;s name a second time.</p>
<p>The source distribution for Firebird 2.1.0 has a solution file for building on Windows, and a couple makefiles to build at the command line.  The only makefile that might have worked, NETProvider/build/linux/makefile contains odd errors that do not allow me to compile the sources successfully.  This is the first error:<br />
<code><br />
make<br />
makefile:40: *** multiple target patterns.  Stop.<br />
</code></p>
<p>First, I&#8217;m not sure why it&#8217;s in there, but it contains a start and end div tag.  I&#8217;m pretty sure that&#8217;s not allowed in a makefile, so you can just remove the start and end tag.  Inside the makefile, there are several make rules that span multiple lines, and they are not &#8220;continued&#8221; properly.  The simplest fix is to remove the newlines for each of the rules that span more than one line.  For example:<br />
<code><br />
COMMON_RESOURCES =<br />
-resource:${RESOURCES}/isc_error_msg.resources...<br />
</code><br />
Needs to be changed to:<br />
<code><br />
COMMON_RESOURCES = -resource:${RESOURCES}/isc_error_msg.resources...<br />
</code><br />
This has to be repeated for SCHEMA_RESOURCES, and the newlines need to be removed from PROVIDER_FLAGS, PROVIDER_TESTS_FLAGS, the compile line of the UnitTests.dll rule, and the copy command that spans two lines.</p>
<p>Next, move the all: rule down to the targets section.  I&#8217;m not sure why it&#8217;s so high in the makefile.</p>
<p>If you run make at this point, you&#8217;ll receive an error:<br />
<code><br />
error CS1566: Error reading resource file `../../source/FirebirdSql/FirebirdSql/Data/Schema/FbMetaData.xml'<br />
</code></p>
<p>The SCHEMA_RESOURCES variable has an extra FirebirdSql in the path to FbMetaData.xml.  You need to remove it.</p>
<p><code><br />
error CS2001: Source file `../../source/FirebirdSql/Data/UnitTest/*.cs' could not be found<br />
</code><br />
This error exists because that path should point to UnitTest<em><strong>s</strong></em>.  Change the PROVIDER_TESTS_SOURCES variable.</p>
<p>Since i don&#8217;t have nunit.framework.dll, I had to compile it and install it.  I&#8217;m sure you can figure it out with google.  I loaded the nunit_VS2005.sln file into Monodevelop and only compiled the nunit.framework.dll assembly, and installed it using <code>gacutil -i nunit.framework.dll</code>.</p>
<p>Next, <code>-reference:System.Transactions.dll</code> needs to be added to the PROVIDER_TESTS_FLAGS variable.  Also, <code>-reference:System.Configuration.dll</code> needs to be added to the same variable to fix the <code>error CS0103: The name `ConfigurationManager' does not exist in the current context</code> messages.</p>
<p>After running make again, I got <code>error CS3002: Return type of `FirebirdSql....BuildConnectionStringBuilder()' is not CLS-compliant</code> and two other similar messages.  Because I&#8217;m not a C# expert, I just googled it, and placed <code>[CLSCompliantAttribute(false)]</code> above all the offending methods in the BaseTests.cs file.  You&#8217;ll also have to do the same for the offending method in FbConnectionTest.cs.  I&#8217;m not worried if it&#8217;s compliant or not, since I just want to use it with C#.</p>
<p>After all this, it finally complies!  Unfortunately, when I try to install it using the gacutil, it refuses:<br />
<code>Failure adding assembly to the cache: Attempt to install an assembly without a strong name.</code></p>
<p>I added <code>-keyfile:FirebirdSql.Data.FirebirdClient.snk</code> to the end of the FirebirdClient.dll compile command, and everything compiled and installed fine.  I haven&#8217;t tested the library to tell if it works, but that&#8217;ll be another post.</p>
<p><a href="javascript:void(0)"> 			Modified makefile</a></p>
]]></content:encoded>
			<wfw:commentRss>http://iamstuffed.com/blog/2008/02/22/compiling-firebird-210-for-osx-using-mono-126/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
