<rss version="2.0"><channel><title>RSS feed for InstantSpot site EdomGroup Blog</title><link>http://edomgroup.instantspot.com</link><description>ColdFusion, Java, Computer Science, and the musings of inspired developers...</description><language>en-us</language><copyright>This work is Copyright &#xA9; 2008 by EdomGroup Blog</copyright><generator>RSSVille ColdFusion FeedMaker, version 1.0</generator><pubDate>Thu, 21 Aug 2008 14:49:47 GMT</pubDate><item><title>ColdFusion Flash Forms To Flex 2</title><link>http://edomgroup.instantspot.com/blog/2006/07/01/ColdFusion-Flash-Forms-To-Flex-2</link><description>I&amp;#39;ll start off by saying that when Macromedia (when they were still
Macromedia) released CFMX 7, it was truly amazing. CFMX 7 has a feature
set that I have not seen another application server come close to
matching; Flash forms, pdf generation, XForms, gateways, and the list
goes on. What was equally amazing was the extent to which the CF
community took these features and ran with them. The &lt;a href=&quot;http://www.asfusion.com/&quot;&gt;ASFusion&lt;/a&gt; group did things with Flash forms people thought were impossible. Todd, at &lt;a href=&quot;http://www.cfsilence.com/&quot;&gt;cfsilence.com&lt;/a&gt; developed a &lt;a href=&quot;http://cfsilence.com/blog/client/index.cfm/2006/1/4/Genesis-10-Query-Evalution-Tool-Released&quot;&gt;data source browser, called Genesis&lt;/a&gt;,
that connects to your CF server and allowed you to run SQL against the
data sources. All these things have really helped push ColdFusion as a
valuable resource for web application development. Now Adobe, since
aquiring Macromedia, has gone and done it again by releasing the Flex 2
SDK for free. The &lt;a href=&quot;http://www.adobe.com/devnet/flex/?tab:samples=1&quot;&gt;demos&lt;/a&gt;
are insane and whats more is that now every website, running ColdFusion
or not, can have rich Flash content - that cool admin control panel, or
the great shopping cart. 
&lt;p&gt;
So with all the giving from Adobe and the CF community going around I
decided to post the Ant build script I wrote for automatically
compiling Flex 2 applications from within Eclipse. 
&lt;/p&gt;
&lt;p&gt;
To use the script:  
&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;  		copy the source into a build.xml file in your project folder  	&lt;/li&gt;
	&lt;li&gt;
	edit the properties at the top of the file to point to your sdk install
	directory, debug flash player, the input mxml file and the output swf
	file &lt;/li&gt;
	&lt;li&gt;  		right click the file and choose &amp;quot;Run As&amp;quot; &amp;gt; &amp;quot;External Tools&amp;quot;  	&lt;/li&gt;
	&lt;li&gt;  		create two new &amp;quot;Ant Build&amp;quot; configurations, one called &amp;quot;build&amp;quot;  		and the other called &amp;quot;run&amp;quot;  	&lt;/li&gt;
	&lt;li&gt;  		now in the targets tab of the build configuration make sure  		only the build target is checked  	&lt;/li&gt;
	&lt;li&gt;  		in the targets tab of the run configuration make sure only  		the run target is checked  	&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
Once the setup is done you can run the build commands using the &amp;#39;Alt+Shift+x q&amp;#39;   shortcut.    
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;&amp;lt;?xml version=&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;quot;1.0&amp;quot;&lt;/span&gt;?&amp;gt;&lt;br /&gt;
 &lt;span style=&quot;color: #000080&quot;&gt;&amp;lt;project name=&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;quot;Flex2 build script&amp;quot;&lt;/span&gt; default=&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;quot;build&amp;quot;&lt;/span&gt; basedir=&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;quot;.&amp;quot;&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #000080&quot;&gt;&amp;lt;property name=&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;quot;installdir&amp;quot;&lt;/span&gt; value=&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;quot;/Flex2SDK&amp;quot;&lt;/span&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #000080&quot;&gt;&amp;lt;property name=&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;quot;libdir&amp;quot;&lt;/span&gt; value=&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;quot;${installdir}/lib&amp;quot;&lt;/span&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #000080&quot;&gt;&amp;lt;property name=&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;quot;mxmlc&amp;quot;&lt;/span&gt; value=&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;quot;${libdir}/mxmlc.jar&amp;quot;&lt;/span&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #000080&quot;&gt;&amp;lt;property name=&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;quot;src&amp;quot;&lt;/span&gt; location=&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;quot;customer.mxml&amp;quot;&lt;/span&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #000080&quot;&gt;&amp;lt;property name=&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;quot;swf&amp;quot;&lt;/span&gt; location=&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;quot;customer.swf&amp;quot;&lt;/span&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #000080&quot;&gt;&amp;lt;property name=&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;quot;player&amp;quot;&lt;/span&gt; location=&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;quot;${installdir}/player/debug/SAFlashPlayer.exe&amp;quot;&lt;/span&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #008080&quot;&gt;&amp;lt;target name=&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;quot;init&amp;quot;&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #008080&quot;&gt;&amp;lt;/target&amp;gt;&lt;/span&gt;&lt;br /&gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #008080&quot;&gt;&amp;lt;target name=&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;quot;build&amp;quot;&lt;/span&gt; depends=&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;quot;init&amp;quot;&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #008000&quot;&gt;&amp;lt;antcall target=&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;quot;compile&amp;quot;&lt;/span&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #008080&quot;&gt;&amp;lt;/target&amp;gt;&lt;/span&gt;&lt;br /&gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #008080&quot;&gt;&amp;lt;target name=&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;quot;compile&amp;quot;&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;java jar=&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;quot;${mxmlc}&amp;quot;&lt;/span&gt; fork=&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;quot;true&amp;quot;&lt;/span&gt; failonerror=&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;quot;true&amp;quot;&lt;/span&gt;&amp;gt;&lt;br /&gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;classpath&amp;gt;&lt;br /&gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #ff8000&quot;&gt;&amp;lt;fileset dir=&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;quot;${libdir}&amp;quot;&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #000080&quot;&gt;&lt;span style=&quot;color: #ff8000&quot;&gt;&amp;lt;include name=&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;quot;**/*.jar&amp;quot;&lt;/span&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #ff8000&quot;&gt;&amp;lt;/fileset&amp;gt;&lt;/span&gt;&lt;br /&gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/classpath&amp;gt;&lt;br /&gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;jvmarg value=&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;quot;-Dapplication.home=${installdir}&amp;quot;&lt;/span&gt;/&amp;gt;&lt;br /&gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;jvmarg value=&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;quot;-ea&amp;quot;&lt;/span&gt;/&amp;gt;&lt;br /&gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;jvmarg value=&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;quot;-DAS3&amp;quot;&lt;/span&gt;/&amp;gt;&lt;br /&gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;jvmarg value=&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;quot;-DAVMPLUS&amp;quot;&lt;/span&gt;/&amp;gt;&lt;br /&gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;jvmarg value=&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;quot;-Xms32m&amp;quot;&lt;/span&gt;/&amp;gt;&lt;br /&gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;jvmarg value=&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;quot;-Xmx756m&amp;quot;&lt;/span&gt;/&amp;gt;&lt;br /&gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;jvmarg value=&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;quot;-Dsun.io.useCanonCaches=false&amp;quot;&lt;/span&gt;/&amp;gt;&lt;br /&gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #008000&quot;&gt;&amp;lt;arg value=&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;quot;-incremental&amp;quot;&lt;/span&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #008000&quot;&gt;&amp;lt;arg file=&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;quot;${src}&amp;quot;&lt;/span&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/java&amp;gt;&lt;br /&gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #008080&quot;&gt;&amp;lt;/target&amp;gt;&lt;/span&gt;&lt;br /&gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #008080&quot;&gt;&amp;lt;target name=&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;quot;run&amp;quot;&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #000080&quot;&gt;&amp;lt;exec executable=&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;quot;${player}&amp;quot;&lt;/span&gt; dir=&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;quot;${basedir}&amp;quot;&lt;/span&gt; spawn=&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;quot;true&amp;quot;&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #008000&quot;&gt;&amp;lt;arg value=&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;quot;${swf}&amp;quot;&lt;/span&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #000080&quot;&gt;&amp;lt;/exec&amp;gt;&lt;/span&gt;&lt;br /&gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #008080&quot;&gt;&amp;lt;/target&amp;gt;&lt;/span&gt;&lt;br /&gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;
 &lt;span style=&quot;color: #000080&quot;&gt;&amp;lt;/project&amp;gt;&lt;/span&gt;
&lt;/p&gt;
</description><pubDate>Sat, 01 Jul 2006 16:39:29 GMT</pubDate><guid>http://edomgroup.instantspot.com/blog/2006/07/01/ColdFusion-Flash-Forms-To-Flex-2</guid><category>Flex 2</category></item><item><title>Java performance analysis - a real life example</title><link>http://edomgroup.instantspot.com/blog/2006/06/01/Java-performance-analysis--a-real-life-example</link><description>For my thesis I&amp;#39;m writing a Java program that parses two text files
(representing satellite images) and performs some analysis on them. The
two files are 128 MB and each was taking ~33 seconds to parse. The
analysis takes only a fraction of that time, then the results are
written back to an output file. 
&lt;p&gt;
Thinking this was very slow, since the files should be pretty much
sequential access off the disk and the read-ahead-buffer would have
cached the next block, I decided to dig a little. I rewrote the parsing
algorithm in C since it&amp;#39;s easier to manage the low-level IO. I used the
file stream functions (fopen,fread,fclose) provided by stdio. When I ran the program it took ~10 seconds.    
&lt;/p&gt;
&lt;p&gt;
This was insane. Java does have more overhead due to its garbage
collection, HotSpot optimizer, and object memory management but it
should not be a magnitude of 3x slower. After a few minutes looking at
the Java implementation I realized I had forgotten to instantiate a BufferedReader. I immediately jumped to the documentation and there it was, each call to the read method of the FileReader blocks until data is available. If no BufferedReader
is supplied this means a context switch for each call. No wonder Java
was taking so long. Adding the buffering I reran the algorithm and wow,
13 seconds. Not to bad for a &amp;ldquo;boated&amp;rdquo; language. 
&lt;/p&gt;
&lt;p&gt;
Figuring I had more places in my program which could be optimized I
began looking. The first place I went was to one of the main methods,
the one which did the analysis on each image. The logic was pretty
simple, find the next pattern in the given image, see if it exists in a
lookup table, if so update its statistics or create a new key and add
it as a new entry. The data structure I was using for the lookup table
was a simple HashMap
object. When writing that section of the program I was still relatively
new to the Java language and just went with what I&amp;#39;d used in other
languages, an associative array. 
&lt;/p&gt;
&lt;p&gt;
I did a little analysis with some System.out.println
statements and found that on average there was a 14,000 : 15 ratio
between reads and writes on the lookup table. Knowing this ratio was
pretty stable (I wasn&amp;#39;t going to get anywhere near 50% writes) I
decided a better data structure would be something with read time of
O(n) or less, instead of O(h(k)) where h(k) was the hash function on
the key. This meant an array would be best, but I didn&amp;#39;t want the
hassle of managing the size of the array as new patterns where found.
Java had to have something for this. After a little searching I found java.util.concurrent.CopyOnWriteArrayList. This was exactly what I needed. After a little tweaking the new code ran in 1/3 the time.    
&lt;/p&gt;
&lt;p&gt;
After this I wrote some small timed programs to examine the running time of the HashMap data structure and the CopyOnWriteArrayList. What I found was as the mutations  approached 25% the CopyOnWriteArrayList&amp;#39;s
performance slowed at an exponential rate. Finally, I couldn&amp;#39;t evaluate
the performance because the tests were taking too long. On the other
hand, the HashMap data structure had a fairly constant performance time irrelevant on the read/write ratio. 
&lt;/p&gt;
</description><pubDate>Fri, 02 Jun 2006 03:43:25 GMT</pubDate><guid>http://edomgroup.instantspot.com/blog/2006/06/01/Java-performance-analysis--a-real-life-example</guid><category>Java</category></item></channel></rss>