<?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>Java Archives - The Story of David Kaspar</title>
	<atom:link href="https://blog.davidkaspar.com/archives/category/java/feed" rel="self" type="application/rss+xml" />
	<link>https://blog.davidkaspar.com/archives/category/java</link>
	<description>Online journal and ponderings about the Internet, gadgets and photography.</description>
	<lastBuildDate>Tue, 12 Jul 2011 16:27:49 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9</generator>

<image>
	<url>https://blog.davidkaspar.com/wp-content/uploads/2020/05/chubby.gif</url>
	<title>Java Archives - The Story of David Kaspar</title>
	<link>https://blog.davidkaspar.com/archives/category/java</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>JSR 303: Combining custom and standard validators</title>
		<link>https://blog.davidkaspar.com/archives/2011/07/jsr-303-combining-custom-and-standard-validators.php</link>
					<comments>https://blog.davidkaspar.com/archives/2011/07/jsr-303-combining-custom-and-standard-validators.php#respond</comments>
		
		<dc:creator><![CDATA[David Kaspar]]></dc:creator>
		<pubDate>Tue, 12 Jul 2011 16:27:49 +0000</pubDate>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[hibernate validator]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[jsr 303]]></category>
		<category><![CDATA[validation]]></category>
		<guid isPermaLink="false">https://davidkaspar.com/wp/2011/07/12/jsr-303-combining-custom-and-standard-validators/</guid>

					<description><![CDATA[<p>We are using the JSR 303 Bean validation API (Hibernate validator as the implementation) on a project and recently faced a problem. Whenever we were using our own custom validators in combination with standard validators like NotNull and NotEmpty, the standard validators seemed to be ignored. The result was that we were getting NullPointerExceptions in &#8230; <a href="https://blog.davidkaspar.com/archives/2011/07/jsr-303-combining-custom-and-standard-validators.php" class="more-link">Continue reading<span class="screen-reader-text"> "JSR 303: Combining custom and standard validators"</span></a></p>
<p>The post <a href="https://blog.davidkaspar.com/archives/2011/07/jsr-303-combining-custom-and-standard-validators.php">JSR 303: Combining custom and standard validators</a> appeared first on <a href="https://blog.davidkaspar.com">The Story of David Kaspar</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>We are using the <a href="http://jcp.org/en/jsr/detail?id=303">JSR 303 Bean validation</a> API (<a href="http://www.hibernate.org/subprojects/validator.html">Hibernate validator</a> as the implementation) on a project and recently faced a problem.<br />
Whenever we were using our own custom validators in combination with standard validators like NotNull and NotEmpty, the standard validators seemed to be ignored.<br />
The result was that we were getting NullPointerExceptions in our custom validators and sometimes we were getting duplicate error messages for the same invalid field.<br />
I haven&#8217;t poured over all of the JSR 303 documentation in detail so maybe I&#8217;ve missed a recommended best practice but the following code in the default NotBlankValidator gave me a hint.</p>
<pre style='color:#000020;background:#f6f8ff;'>public boolean isValid<span style='color:#308080; '>(</span><span style='color:#003060; '>String</span> s<span style='color:#308080; '>,</span>
ConstraintValidatorContext constraintValidatorContext<span style='color:#308080; '>)</span> <span style='color:#406080; '>{</span>
<span style='color:#200080; font-weight:bold; '>if</span> <span style='color:#308080; '>(</span> s <span style='color:#308080; '>=</span><span style='color:#308080; '>=</span> null <span style='color:#308080; '>)</span> <span style='color:#406080; '>{</span>
<span style='color:#200080; font-weight:bold; '>return</span> true<span style='color:#406080; '>;</span>
<span style='color:#406080; '>}</span>
<span style='color:#308080; '>.</span><span style='color:#308080; '>.</span><span style='color:#308080; '>.</span>
</pre>
<p>Why would you ever return true (i.e. valid) for an input that is null? That doesn&#8217;t make sense until you realise that validation is a *combination* of all constraints.<br />
This means that your validator should only return false for your specific test. If it fails for a chained validation, for example if input is null, it should return true and rely on the NotNull validation to report that error.<br />
You still have to guard for null and empty inputs but return true if they occur rather then returning false.<br />
Hide any required basic validations inside your custom constraint annotation. For example NotBlank does that:</p>
<pre style='color:#000020;background:#f6f8ff;'>...
@NotNull
<span style='color:#200080; font-weight:bold; '>public</span> @<span style='color:#200080; font-weight:bold; '>interface</span> NotBlank <span style='color:#406080; '>{</span>
<span style='color:#308080; '>.</span><span style='color:#308080; '>.</span><span style='color:#308080; '>.</span>
</pre>
<p>The post <a href="https://blog.davidkaspar.com/archives/2011/07/jsr-303-combining-custom-and-standard-validators.php">JSR 303: Combining custom and standard validators</a> appeared first on <a href="https://blog.davidkaspar.com">The Story of David Kaspar</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.davidkaspar.com/archives/2011/07/jsr-303-combining-custom-and-standard-validators.php/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Transforming in Wales</title>
		<link>https://blog.davidkaspar.com/archives/2006/04/transforming-in-wales.php</link>
					<comments>https://blog.davidkaspar.com/archives/2006/04/transforming-in-wales.php#respond</comments>
		
		<dc:creator><![CDATA[David Kaspar]]></dc:creator>
		<pubDate>Sat, 22 Apr 2006 20:05:27 +0000</pubDate>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[wales etl xml enterpriseintegration]]></category>
		<guid isPermaLink="false">https://davidkaspar.com/wp/2006/04/22/transforming-in-wales/</guid>

					<description><![CDATA[<p>I was in a bit of a pickle: a planned training session in Wales (5 hours drive away) but a heavily pregnant wife at home refusing me being away over night. So I squeezed it all into a single day. Up at 4am, in Bangor 8:30am, training session 9 to 5 and back in London &#8230; <a href="https://blog.davidkaspar.com/archives/2006/04/transforming-in-wales.php" class="more-link">Continue reading<span class="screen-reader-text"> "Transforming in Wales"</span></a></p>
<p>The post <a href="https://blog.davidkaspar.com/archives/2006/04/transforming-in-wales.php">Transforming in Wales</a> appeared first on <a href="https://blog.davidkaspar.com">The Story of David Kaspar</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><img decoding="async" alt="wales.jpg" src="http://blog.davidkaspar.com/images/wales.jpg" width="150" height="150" class="framedalignleft"/>I was in a bit of a pickle: a planned training session in Wales (5 hours drive away) but a heavily pregnant wife at home refusing me being away over night.<br />
So I squeezed it all into a single day. Up at 4am, in <a href="http://en.wikipedia.org/wiki/Bangor,_Wales">Bangor</a> 8:30am, training session 9 to 5 and back in London after 10pm with some 540 miles more on the old odometer.<br />
<a href="http://www.etlsolutions.com/">ETL Solutions</a> was demoing their Transformation Manager (TM) application for data transformations with generate Java code.<br />
It turned out to be a very powerful tool both for the initial mapping between a source model and a destination model and for running the transformations.<br />
Supported models are XML schemas (xsd), Document Type Definitions (DTD), partial XML data, Java objects, RDBMS and a multitude of flat files.<br />
Data transformations are a two step process:<br />
1. visually create a mapping between a source model and a destination model and let TM generate Java code to do the transformations<br />
2. Deploy the generated code and integrate into your application with 5-6 lines of code.<br />
The visual mapping included drag-and-dropping of elements between the source and destination. In addition, TM is using a powerful modeling language (SML) for more advanced mappings.<br />
The tool originated from a requirement of migrating data between Oracle databases which is evident from the strong DB support. Included are operations for transaction management and batch operations for optimisation tweaking.<br />
The tool then evolved by supporting additional data models and by the addition of various transformation functions (financial, mathematical and similar).<br />
The only thing I was missing was the support for XSL output when converting between two XML schemas.<br />
I find XSL to be more portable than Java classes but when asked to specify a scenario where our company would not be able to use Java classes for a transformation, I was not able to.</p>
<p>The post <a href="https://blog.davidkaspar.com/archives/2006/04/transforming-in-wales.php">Transforming in Wales</a> appeared first on <a href="https://blog.davidkaspar.com">The Story of David Kaspar</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.davidkaspar.com/archives/2006/04/transforming-in-wales.php/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Mowecam: Mobile Web Camera</title>
		<link>https://blog.davidkaspar.com/archives/2005/07/mowecam-mobile-web-camera.php</link>
					<comments>https://blog.davidkaspar.com/archives/2005/07/mowecam-mobile-web-camera.php#comments</comments>
		
		<dc:creator><![CDATA[David Kaspar]]></dc:creator>
		<pubDate>Mon, 04 Jul 2005 13:15:15 +0000</pubDate>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[mowecam mobile web camera j2me java]]></category>
		<guid isPermaLink="false">https://davidkaspar.com/wp/2005/07/04/mowecam-mobile-web-camera/</guid>

					<description><![CDATA[<p>Update Visit the Mowecam support forum to ask any questions. What is it Mowecam is a J2ME experiment with a camera enabled mobile phone and a publicly accessible web server. The application takes periodical snapshots from the mobile phone camera and posts them to a web server. The latest image is then avaible for inclusion &#8230; <a href="https://blog.davidkaspar.com/archives/2005/07/mowecam-mobile-web-camera.php" class="more-link">Continue reading<span class="screen-reader-text"> "Mowecam: Mobile Web Camera"</span></a></p>
<p>The post <a href="https://blog.davidkaspar.com/archives/2005/07/mowecam-mobile-web-camera.php">Mowecam: Mobile Web Camera</a> appeared first on <a href="https://blog.davidkaspar.com">The Story of David Kaspar</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><u>Update</u><br />
Visit the <a href="http://forum.davidkaspar.com/forum-14.html">Mowecam support forum</a> to ask any questions.<br />
<b>What is it</b><br />
Mowecam is a J2ME experiment with a camera enabled mobile phone and a publicly accessible web server.<br />
The application takes periodical snapshots from the mobile phone camera and posts them to a web server.<br />
The latest image is then avaible for inclusion in a web site, for example a web log (blog).<br />
The usages are the same as for a standard web camera and can include security, watching a party progress, weather, baby monitor and many more.<br />
Mowecam enjoys the freedom of not being dependent on a computer, nor any hard wired Internet connection. If you are within GSM network reach you can start broadcasting photos from your location.<br />
<b>Requirements</b><br />
A modern Java enabled mobile phone with a camera.<br />
The mobile phone needs to support the Mobile Media API (and being able to take snap shots which excludes SonyEricsson T610 and T630).<br />
Mowecam has been developed and tested on SonyEricsson K750. <b>There will be problems on other mobile phone models</b> but many of them can be worked out if you <a href="http://www.davidkaspar.com/blog/contact.php" title="Online contact form">let me know</a>.<br />
<b>Usage</b><br />
First of all download the application to your computer and install it as you normally do. This may be via infrared, Bluetooth or similar. Certain phones require both the jad and the jar file, others require the jar file only.<br />
Due to tighter security in the new J2ME version, you will be asked to confirm when the application is about to take a snapshot and when it is trying to connect to the internet. Check the manual of your phone to find out how to <strong>change the permission settings for Mowecam to &#8220;ask once only&#8221;</strong> (or else it will not be able to send images without you confirming it can go online).<br />
Go to the settings page and enter a unique key. This will later be used to identify your image when you retrieve it via a browser. An email address is often unique and I recommend to use just that. If you are worried about the email address ending up somewhere where you don&#8217;t want it (a spam data base), add a few letters or numbers to it. FYI, the unique keys are not stored anywhere, instead a hash is being used.<br />
The other setting is URL endpoint which is where the mobile phone will post images. Use the provided URL: http://www.davidkaspar.com/mowecam/postimage.php (this is the default URL in the application). If you have your own web server you can instead upload the post image PHP script (below) to your own server and the postage images will stay there.<br />
The refresh rate is in seconds. Please note that each image is around 5KB and will incur costs on your mobile bill unless you are on an unlimited data plan.<br />
Use the following code to include the image in a HTML page: &lt;img src=&#8221;http://www.davidkaspar.com/mowecam/getimage.php? email=[unique_key_here]&#8221;&gt;. Replace [unique_key_here] with the unique key you have provided in the application settings.<br />
<b>License</b><br />
This is the first version of the Mowecam and only binary code is provided (mainly due to the source code being in such a mess).<br />
The code has been developed on Netbeans 4.1 and its excellent j2me development kit.<br />
It is free to use and to distribute as long as this license notice is provided with the binary.<br />
As always with free and beta software it is provide without any warranty and the developer(s) cannot be held responsible for any bad consequences of running the application.<br />
<b>Download latest version</b><br />
<a href="http://www.davidkaspar.com/mowecam/" title="Latest version of Mowecam">Mowecam</a> (This URL should also work for OTA, over the air, installation if you type in the URL in your XHTML capable mobile phone)<br />
<a href="http://code.davidkaspar.com/Mowecam_postImage_v1.0.zip">Mowecam: Post image PHP script v 1.0</a>, released under <a href="http://www.gnu.org/licenses/gpl.txt">GNU General Public License</a>.<br />
<b>Credits</b><br />
The application architecture is inspired by <a href="http://rawsocket.org/midlog/archives/2004_05.php">Midlog</a> made by <a href="http://www.rawsocket.org/">Rawsocket</a>.<br />
The application is using a hash algorithm from <a href="http://www.partow.net/programming/hashfunctions/" title="www.partow.net">www.partow.net</a><br />
The application is using Base64 code from <a href="http://kobjects.org">kobjects.org</a></p>
<p>The post <a href="https://blog.davidkaspar.com/archives/2005/07/mowecam-mobile-web-camera.php">Mowecam: Mobile Web Camera</a> appeared first on <a href="https://blog.davidkaspar.com">The Story of David Kaspar</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.davidkaspar.com/archives/2005/07/mowecam-mobile-web-camera.php/feed</wfw:commentRss>
			<slash:comments>16</slash:comments>
		
		
			</item>
		<item>
		<title>Caching the remote interface of a Stateless Session Bean</title>
		<link>https://blog.davidkaspar.com/archives/2004/09/caching-the-remote-interface-of-a-stateless-session-bean.php</link>
					<comments>https://blog.davidkaspar.com/archives/2004/09/caching-the-remote-interface-of-a-stateless-session-bean.php#respond</comments>
		
		<dc:creator><![CDATA[David Kaspar]]></dc:creator>
		<pubDate>Wed, 01 Sep 2004 15:01:53 +0000</pubDate>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[caching]]></category>
		<category><![CDATA[cluster]]></category>
		<category><![CDATA[j2ee]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[stateful session bean]]></category>
		<category><![CDATA[stateless]]></category>
		<guid isPermaLink="false">https://davidkaspar.com/wp/2004/09/01/caching-the-remote-interface-of-a-stateless-session-bean/</guid>

					<description><![CDATA[<p>We have asked this question several times in our organisation and I have seen it being asked many times in various web forums. I suspect that the reason why there is no correct answer is that it all depends on your environment. Some people report very good results with one approach but the same approach &#8230; <a href="https://blog.davidkaspar.com/archives/2004/09/caching-the-remote-interface-of-a-stateless-session-bean.php" class="more-link">Continue reading<span class="screen-reader-text"> "Caching the remote interface of a Stateless Session Bean"</span></a></p>
<p>The post <a href="https://blog.davidkaspar.com/archives/2004/09/caching-the-remote-interface-of-a-stateless-session-bean.php">Caching the remote interface of a Stateless Session Bean</a> appeared first on <a href="https://blog.davidkaspar.com">The Story of David Kaspar</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>We have asked this question several times in our organisation and I have seen it being asked many times in various web forums.<br />
I suspect that the reason why there is no correct answer is that it all depends on your environment.<br />
Some people report very good results with one approach but the same approach may not be efficient or not even functional somewhere else; such as in a clustered environment.<br />
<u>The options:</u><br />
1. A common basic approach is to store the reference to the remote interface in the http session. Once it has been stored, all clients can quickly access business methods of the stateful session bean. You should use <a href="http://java.sun.com/blueprints/corej2eepatterns/Patterns/BusinessDelegate.html" title="Business delegate pattern">business delegates</a> to communicate with your EJBs.<br />
According to the specification  (EJB spec 2.1FR, section 7.8):</p>
<blockquote><p>There is no fixed mapping between clients and stateless instances. The container simply delegates a client&rsquo;s work to any available instance that is method-ready.</p></blockquote>
<p>This means that even with a single remote interface, the container will delegate what bean instance should serve a client call.<br />
With stateful beans the case is the contrary. A remote interface will always guarantee calls are delegated to the <b>same stateful session bean</b>. This of course is crucial to enable a dialog between a client and a stateful bean.<br />
2. The JNDI lookup of a home interface is the costly part of locating an EJB. As such, storing a reference to the home interface is a second approach.<br />
Because application servers may use the <i>create()</i> method as load balancing trigger this approach may behave better in a clustered environment. Consider using the <a href="http://java.sun.com/blueprints/corej2eepatterns/Patterns/ServiceLocator.html">service locator pattern</a> to collect all your service lookups to a single point.<br />
3. A handle to an EJB has the advantage of being serialisable and valid between multiple JVMs. It seems to be the superior way of storing a reference to an EJB.<br />
It is only possible to acquire a handle to EJBs that implement remote interfaces. With EJB 2.0, you will see that many EJBs implement local interfaces only to improve performance. Only the session facades will be exposing both local and remote interfaces.<br />
<u>Conclusion:</u><br />
To be future proof, it is safest to assume as little as possible about the behaviour of your J2EE server and avoiding short cuts.<br />
This will ensure that your application can move from a testing environment to a full clustered, load balanced production environment or a different j2ee application server.<br />
JNDI lookups of the home interface is the expensive operation so implement a service locator that caches home interfaces. Make sure all of your code is using this single point of looking up EJBs. It will then be possible to change the lookup strategy in the future if needed.<br />
<u>References:</u><br />
<a href="http://www.theserverside.com">The server side</a><br />
<a href="http://java.sun.com/blueprints/corej2eepatterns/Patterns/ServiceLocator.html">Service Locator pattern</a><br />
<a href="http://java.sun.com/products/ejb/docs.html">EJB 2.1 Specification</a></p>
<p>The post <a href="https://blog.davidkaspar.com/archives/2004/09/caching-the-remote-interface-of-a-stateless-session-bean.php">Caching the remote interface of a Stateless Session Bean</a> appeared first on <a href="https://blog.davidkaspar.com">The Story of David Kaspar</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.davidkaspar.com/archives/2004/09/caching-the-remote-interface-of-a-stateless-session-bean.php/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Netbeans 4.0 Beta 1 &#8211; first impressions</title>
		<link>https://blog.davidkaspar.com/archives/2004/08/netbeans-4-0-beta-1-first-impressions.php</link>
					<comments>https://blog.davidkaspar.com/archives/2004/08/netbeans-4-0-beta-1-first-impressions.php#comments</comments>
		
		<dc:creator><![CDATA[David Kaspar]]></dc:creator>
		<pubDate>Tue, 24 Aug 2004 08:45:48 +0000</pubDate>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[beta 1]]></category>
		<category><![CDATA[netbeans 4.1]]></category>
		<category><![CDATA[preview]]></category>
		<category><![CDATA[review]]></category>
		<guid isPermaLink="false">https://davidkaspar.com/wp/2004/08/24/netbeans-4-0-beta-1-first-impressions/</guid>

					<description><![CDATA[<p>The potential is great but I have mixed first feelings. The new Netbeans is (Ant) project oriented a la Eclipse, IntelliJ and others. Point at an Ant build script, and Netbeans will try to pick out source, target and library directories. No more mounting ad hoc mounting of directories, things have to be more organised. &#8230; <a href="https://blog.davidkaspar.com/archives/2004/08/netbeans-4-0-beta-1-first-impressions.php" class="more-link">Continue reading<span class="screen-reader-text"> "Netbeans 4.0 Beta 1 &#8211; first impressions"</span></a></p>
<p>The post <a href="https://blog.davidkaspar.com/archives/2004/08/netbeans-4-0-beta-1-first-impressions.php">Netbeans 4.0 Beta 1 &#8211; first impressions</a> appeared first on <a href="https://blog.davidkaspar.com">The Story of David Kaspar</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>The potential is great but I have mixed first feelings.<br />
<img decoding="async" src="http://www.davidkaspar.com/pics/nb41.jpg" width="150" height="111" alt="Netbeans 4.1 splash" border="0" class="floatleft" />The new Netbeans is (Ant) project oriented a la Eclipse, IntelliJ and others. Point at an Ant build script, and Netbeans will try to pick out source, target and library directories. No more mounting ad hoc mounting of directories, things have to be more organised.<br />
Refactoring has a dedicated menu option. You will be able to rename and move classes around; Netbeans will search all of the code base and reflect the changes.<br />
Multiple build targets is something that has always been lacking. Finally Netbeans 4.0 allows you to define a build target for each source path. Build your Servlets, EJB implementations, interfaces, utilities and etc to different targets.<br />
I know this is just a first beta (the final release is scheduled for December 2004) but there were exceptions all over the place. Possibly because I tried to open two medium to large sized existing projects. Had I started creating a small project from scratch, it would have given NB 4.0b1 a more fair chance.<br />
The J2EE development support preview coming in October will be interesting. Additional exciting coming feature is the <i>Profiler</i>. I have already tried the stand-alone preview and once again it did not manage to profile two of our main projects due to exceptions 🙁<br />
Here is a good document on <a href="http://www.netbeans.org/kb/articles/transition-40.html" title="Netbeans 3.6 to 4.0">how to move from Netbeans 3.6 to Netbeans 4.0</a>.</p>
<p>The post <a href="https://blog.davidkaspar.com/archives/2004/08/netbeans-4-0-beta-1-first-impressions.php">Netbeans 4.0 Beta 1 &#8211; first impressions</a> appeared first on <a href="https://blog.davidkaspar.com">The Story of David Kaspar</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.davidkaspar.com/archives/2004/08/netbeans-4-0-beta-1-first-impressions.php/feed</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>Hello J2ME World</title>
		<link>https://blog.davidkaspar.com/archives/2004/05/hello-j2me-world.php</link>
					<comments>https://blog.davidkaspar.com/archives/2004/05/hello-j2me-world.php#respond</comments>
		
		<dc:creator><![CDATA[David Kaspar]]></dc:creator>
		<pubDate>Wed, 26 May 2004 14:50:48 +0000</pubDate>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[ericsson]]></category>
		<category><![CDATA[j2me]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[JSR]]></category>
		<category><![CDATA[midlet]]></category>
		<category><![CDATA[MIDP]]></category>
		<category><![CDATA[MMAPI]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[photo]]></category>
		<category><![CDATA[sony]]></category>
		<category><![CDATA[sonyericsson]]></category>
		<category><![CDATA[sun]]></category>
		<category><![CDATA[t610]]></category>
		<category><![CDATA[t630]]></category>
		<category><![CDATA[WTK]]></category>
		<guid isPermaLink="false">https://davidkaspar.com/wp/2004/05/26/hello-j2me-world/</guid>

					<description><![CDATA[<p>With my recent upgrade to SonyEricsson T630, a new geek opportunity presented it self: to develop Java applications for my very own mobile. Priceless. Because I am fairly familiar with Java and the fantastic, open source, IDE NetBeans it was easy to develop and deploy my first HelloJ2MEWorld application. NetBeans has an extension module focused &#8230; <a href="https://blog.davidkaspar.com/archives/2004/05/hello-j2me-world.php" class="more-link">Continue reading<span class="screen-reader-text"> "Hello J2ME World"</span></a></p>
<p>The post <a href="https://blog.davidkaspar.com/archives/2004/05/hello-j2me-world.php">Hello J2ME World</a> appeared first on <a href="https://blog.davidkaspar.com">The Story of David Kaspar</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>With my recent upgrade to <a href="http://www.sonyericsson.com/t630/" title="SonyEricsson t630">SonyEricsson T630</a>, a new geek opportunity presented it self: to develop <a href="http://www.getjar.com/" title="Free Java apps and games for mobiles">Java applications</a> for my very own mobile. Priceless.<br />
Because I am fairly familiar with Java and the fantastic, open source, IDE <a href="http://www.netbeans.org">NetBeans</a> it was easy to develop and deploy my first HelloJ2MEWorld application.<br />
NetBeans has an extension module focused on J2ME development. Download it and NetBeans will be able to help you with your Midlets, JARs and obfuscation.<br />
NetBeans is using the Sun J2ME SDK. If you want to be more device specific, I&#8217;d recommend you to download an SDK directly from the mobile maker you are interested in. Two obvious choices are <a href="http://developer.sonyericsson.com" title="SE mobile development site">SonyEricsson</a> and <a href="http://www.forum.nokia.com/main/0,6566,033,00.html" title="Nokia tools">Nokia</a>.<br />
Try out and debug your application on one of the supplied emulators.<br />
The last step is to transfer your application to your mobile. You have a choice between infrared, bluetooth, USB cable and Over-the-air (OTA). Since I am developing on a IR enabled laptop, ir was the best option for me.<br />
First application that came to mind for developing was of course a mobile blogging tool. A quick search on Google returned the just started open source project <a href="http://sourceforge.net/projects/midlog/">MIDLog</a>. So instead of starting from scratch and probably duplicating all work done in MIDLog, I am hoping to contribute to MIDLog.<br />
The J2ME world is crowded with two main MIDP versions, WTK versions and various JSRs (Java Specification Requests). While many exciting features are planned for future version of J2ME, todays devices are very limited.<br />
Example, the T630 supports the &#8220;new&#8221; multimedia API (MMAPI &#8211; JSR 135) but Sony has chosen to support the sound part only. This means that there is no support for image capturing and I suspect this will make it very difficult to develop a mobile blog tool capable of posting images.</p>
<p>The post <a href="https://blog.davidkaspar.com/archives/2004/05/hello-j2me-world.php">Hello J2ME World</a> appeared first on <a href="https://blog.davidkaspar.com">The Story of David Kaspar</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.davidkaspar.com/archives/2004/05/hello-j2me-world.php/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Netbeans 3.6</title>
		<link>https://blog.davidkaspar.com/archives/2004/04/netbeans-3-6.php</link>
					<comments>https://blog.davidkaspar.com/archives/2004/04/netbeans-3-6.php#respond</comments>
		
		<dc:creator><![CDATA[David Kaspar]]></dc:creator>
		<pubDate>Thu, 22 Apr 2004 14:41:09 +0000</pubDate>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[free]]></category>
		<category><![CDATA[ide]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[netbeans]]></category>
		<category><![CDATA[open source]]></category>
		<guid isPermaLink="false">https://davidkaspar.com/wp/2004/04/22/netbeans-3-6/</guid>

					<description><![CDATA[<p>I have been using NetBeans 3.6 for a couple of days now and can say it&#8217;s a very good improvement on the previous version 3.5.1. (NetBeans is a free, open source development tool. Mainly for Java development but also suitable for C/C++) The intention was to wait until end of summer 2004 and release version &#8230; <a href="https://blog.davidkaspar.com/archives/2004/04/netbeans-3-6.php" class="more-link">Continue reading<span class="screen-reader-text"> "Netbeans 3.6"</span></a></p>
<p>The post <a href="https://blog.davidkaspar.com/archives/2004/04/netbeans-3-6.php">Netbeans 3.6</a> appeared first on <a href="https://blog.davidkaspar.com">The Story of David Kaspar</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><img decoding="async" src="http://www.davidkaspar.com/pics/netbeans36.jpg" width="150" height="112" alt="" border="0" class="floatleft" />I have been using NetBeans 3.6 for a couple of days now and can say it&#8217;s a very good improvement on the previous version 3.5.1.<br />
(NetBeans is a free, open source development tool. Mainly for Java development but also suitable for C/C++)<br />
The intention was to wait until end of summer 2004 and release version 4.0 but because of the fierce competition (<a href="http://www.eclipse.org/" title="Eclipse IDE">Eclipse</a>, <a href="http://www.intellij.com/idea/" title="IntelliJ IDEA">IntelliJ</a>, <a href="http://www.borland.com/jbuilder/" title="JBuilder">JBuilder</a> and etc) an intermediate version was released with promises of what is to come.<br />
The most prominent change is that the window system has been completely redone. Away with the clunky and very Java-ish interface. In with a leaner, more native looking and intuitive one.<br />
While I suspect that this enhancement required a lot of work input, the user will not notice too much difference (this is good).<br />
Other useful features include code folding, smart brackets, help with overriding methods, Servlet 2.4 and JSP 2.0 code completion and <a href="http://www.netbeans.org/community/releases/36/Whats_New.html" title="Whats new in 3.6">much more</a>.<br />
In previous versions it was needed to download several modules after an install but they all seem to be included in 3.6: database explorer, XML/XSL support, tasklists and more.<br />
NetBeans 3.6 support J2SDK 1.4.1 and above but prefers 1.4.2 so make sure to update it from <a href="http://java.sun.com/j2se/1.4.2/download.html" title="J2SDK">Sun web site</a>.</p>
<p>The post <a href="https://blog.davidkaspar.com/archives/2004/04/netbeans-3-6.php">Netbeans 3.6</a> appeared first on <a href="https://blog.davidkaspar.com">The Story of David Kaspar</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.davidkaspar.com/archives/2004/04/netbeans-3-6.php/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Validating a DB Connection</title>
		<link>https://blog.davidkaspar.com/archives/2004/04/validating-a-db-connection.php</link>
					<comments>https://blog.davidkaspar.com/archives/2004/04/validating-a-db-connection.php#comments</comments>
		
		<dc:creator><![CDATA[David Kaspar]]></dc:creator>
		<pubDate>Fri, 02 Apr 2004 15:55:19 +0000</pubDate>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[close]]></category>
		<category><![CDATA[connection]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[statement]]></category>
		<category><![CDATA[validate]]></category>
		<guid isPermaLink="false">https://davidkaspar.com/wp/2004/04/02/validating-a-db-connection/</guid>

					<description><![CDATA[<p>You may have been tempted to execute Connection.isClosed() to test whether a connection is live and can be reused. This is however not sufficient as the Sun JDBC API guide states: &#8220;Note that the method Connection.isClosed is guaranteed to return true only when it is called after the method Connection.close has been called. As a &#8230; <a href="https://blog.davidkaspar.com/archives/2004/04/validating-a-db-connection.php" class="more-link">Continue reading<span class="screen-reader-text"> "Validating a DB Connection"</span></a></p>
<p>The post <a href="https://blog.davidkaspar.com/archives/2004/04/validating-a-db-connection.php">Validating a DB Connection</a> appeared first on <a href="https://blog.davidkaspar.com">The Story of David Kaspar</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>You may have been tempted to execute Connection.isClosed() to test whether a connection is live and can be reused. This is however not sufficient as the Sun JDBC API guide states:</p>
<p>&#8220;Note that the method Connection.isClosed is guaranteed to return true only when it is called after the method Connection.close has been called. As a result, a programmer cannot depend on this method to indicate whether a connection is valid or not. Instead, a typical JDBC client can determine that a connection is invalid by catching the exception that is thrown when a JDBC operation is attempted.&#8221;</p>
<p>The only safe way of ensuring that a connection is valid is to execute a tiny query and catch any SQLExceptions thrown. If no exceptions are thrown, you can go on and using that connection.</p>
<p>If any exceptions are thrown, it is safest to close that connection, set the reference to null and create a new connection.</p>
<p>What query to execute?</p>
<p>It would be nice to execute a general (database independent) method like Connection.getMetaData(). Unfortunately I have seen some indication that this may be successful even when a connection is invalid.</p>
<p>To be on the safe side it is best to execute a query like &#8220;SELECT COUNT(*) FROM <dbtable> WHERE 1 = -1&#8243;. We are using SQL server so the table <i>sysusers</i> is a safe bet:</p>
<p><font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">/**</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*&nbsp;A&nbsp;method&nbsp;that&nbsp;tests&nbsp;whether&nbsp;a&nbsp;connection&nbsp;is&nbsp;valid&nbsp;by&nbsp;executing<br />
simple&nbsp;query&nbsp;and&nbsp;catch&nbsp;any&nbsp;exceptions</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#3f5fbf">*/</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#7f0055"><b>private&nbsp;</b></font><font color="#7f0055"><b>boolean&nbsp;</b></font><font color="#000000">connectionIsValid</font><font color="#000000">(Connection dbConn)&nbsp;{</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#3f7f5f">//log.debug(&#34;ENTER&nbsp;connectionIsValid():&nbsp;&#34;+dbConn);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#7f0055"><b>boolean&nbsp;</b></font><font color="#000000">result&nbsp;=&nbsp;</font><font color="#7f0055"><b>true</b></font><font color="#000000">;</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#000000">PreparedStatement&nbsp;psr&nbsp;=&nbsp;</font><font color="#7f0055"><b>null</b></font><font color="#000000">;</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#7f0055"><b>try&nbsp;</b></font><font color="#000000">{</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#3f7f5f">//Prepared&nbsp;statement&nbsp;is&nbsp;used&nbsp;to&nbsp;cache&nbsp;the&nbsp;compiled&nbsp;SQL</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#000000">psr&nbsp;=&nbsp;dbConn.prepareStatement</font><font color="#000000">(</font><font color="#2a00ff">&#34;SELECT&nbsp;COUNT(*)&nbsp;FROM&nbsp;sysusers&nbsp;WHERE&nbsp;1&nbsp;=&nbsp;-1&#34;</font><font color="#000000">)</font><font color="#000000">;</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#000000">psr.executeQuery</font><font color="#000000">()</font><font color="#000000">;</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#000000">}&nbsp;</font><font color="#7f0055"><b>catch&nbsp;</b></font><font color="#000000">(</font><font color="#000000">SQLException&nbsp;e</font><font color="#000000">)&nbsp;{</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#000000">log.debug</font><font color="#000000">(</font><font color="#2a00ff">&#34;Excpetion&nbsp;occured,&nbsp;connection&nbsp;is&nbsp;not&nbsp;valid.&nbsp;&#34;</font><font color="#000000">+e.getMessage</font><font color="#000000">())</font><font color="#000000">;</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#7f0055"><b>try&nbsp;</b></font><font color="#000000">{</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#000000">dbConn.close</font><font color="#000000">()</font><font color="#000000">;&nbsp;</font><font color="#3f7f5f">//dbConn&nbsp;is&nbsp;never&nbsp;null&nbsp;at&nbsp;this&nbsp;point</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#000000">dbConn=</font><font color="#7f0055"><b>null</b></font><font color="#000000">;</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#000000">}&nbsp;</font><font color="#7f0055"><b>catch&nbsp;</b></font><font color="#000000">(</font><font color="#000000">Exception&nbsp;ee</font><font color="#000000">)&nbsp;{</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#3f7f5f">//quite</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#000000">}</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#000000">result&nbsp;=&nbsp;</font><font color="#7f0055"><b>false</b></font><font color="#000000">;</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#000000">}&nbsp;</font><font color="#7f0055"><b>finally&nbsp;</b></font><font color="#000000">{</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#7f0055"><b>try&nbsp;</b></font><font color="#000000">{</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#3f7f5f">//free&nbsp;up&nbsp;resource&nbsp;kept&nbsp;by&nbsp;the&nbsp;test&nbsp;statement</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#7f0055"><b>if&nbsp;</b></font><font color="#000000">(</font><font color="#000000">psr!=</font><font color="#7f0055"><b>null</b></font><font color="#000000">)&nbsp;{</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#000000">psr.close</font><font color="#000000">()</font><font color="#000000">;</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#000000">}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#000000">psr=</font><font color="#7f0055"><b>null</b></font><font color="#000000">;</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#000000">}&nbsp;</font><font color="#7f0055"><b>catch&nbsp;</b></font><font color="#000000">(</font><font color="#000000">Exception&nbsp;e</font><font color="#000000">)&nbsp;{</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#3f7f5f">//quite</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#000000">}</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#000000">}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#3f7f5f">//log.debug(&#34;EXIT&nbsp;connectionIsValid():&nbsp;&#34;+result);</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#7f0055"><b>return&nbsp;</b></font><font color="#000000">result;</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#000000">}</font></p>
<p>The post <a href="https://blog.davidkaspar.com/archives/2004/04/validating-a-db-connection.php">Validating a DB Connection</a> appeared first on <a href="https://blog.davidkaspar.com">The Story of David Kaspar</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.davidkaspar.com/archives/2004/04/validating-a-db-connection.php/feed</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>Netbeans IDE, pros and cons</title>
		<link>https://blog.davidkaspar.com/archives/2003/11/netbeans-ide-pros-and-cons.php</link>
					<comments>https://blog.davidkaspar.com/archives/2003/11/netbeans-ide-pros-and-cons.php#comments</comments>
		
		<dc:creator><![CDATA[David Kaspar]]></dc:creator>
		<pubDate>Thu, 27 Nov 2003 11:48:22 +0000</pubDate>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[environment]]></category>
		<category><![CDATA[integrated]]></category>
		<category><![CDATA[intellij]]></category>
		<category><![CDATA[j2ee]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[jbuilder]]></category>
		<category><![CDATA[netbeans]]></category>
		<category><![CDATA[sun]]></category>
		<category><![CDATA[vss]]></category>
		<guid isPermaLink="false">https://davidkaspar.com/wp/2003/11/27/netbeans-ide-pros-and-cons/</guid>

					<description><![CDATA[<p>NetBeans IDE has been my prefered IDE for the last 1.5 years. The reasons are several. OpenSource software, continuously extended and last but not least, it is free. While it doesn&#8217;t have as many features as some &#163;3,000+ IDEs, it has enough to keep you busy. The features that I find most useful and use &#8230; <a href="https://blog.davidkaspar.com/archives/2003/11/netbeans-ide-pros-and-cons.php" class="more-link">Continue reading<span class="screen-reader-text"> "Netbeans IDE, pros and cons"</span></a></p>
<p>The post <a href="https://blog.davidkaspar.com/archives/2003/11/netbeans-ide-pros-and-cons.php">Netbeans IDE, pros and cons</a> appeared first on <a href="https://blog.davidkaspar.com">The Story of David Kaspar</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><img loading="lazy" decoding="async" src="http://www.davidkaspar.com/pics/netbeans.jpg" width="150" height="174" alt="" border="0" align="right" hspace="10" /><a href="http://www.netbeans.org/" title="Netbeans.org">NetBeans IDE</a> has been my prefered IDE for the last 1.5 years. The reasons are several. OpenSource software, continuously extended and last but not least, it is free. While it doesn&#8217;t have as many features as some &pound;3,000+ IDEs, it has enough to keep you busy.<br />
<img loading="lazy" decoding="async" src="http://www.davidkaspar.com/pics/plus.gif" width="83" height="83" alt="" border="0" align="left" hspace="10" />The features that I find most useful and use every day because they speed up the development.<br />
There is the DB explorer that lets me browse a data base to see the tables, data types, values and lets me execute any queries (including updates).</p>
<p><span id="more-106"></span><br />
The CVS integration is great as it lets your check in and out source files directly from the development environment. I have only tested it together with <a href="http://msdn.microsoft.com/ssafe/" title="Microsoft VSS">Microsoft VSS</a> (what a pain that is btw) but it supports other CVS profiles. While it is handy it can be a bit slow on large directory structures so I tend to use it for single files only. When I want to manipulate large amount of source files, I use the VSS client instead.<br />
NetBeans has good XML and XSL support. It lets you validate your XML documents and you can do XSL transformations right there in the IDE. No XSLT debugging though, so get your self a decent XSL IDE (XML Spy or Xcelerator) for serious XSLT.<br />
Javadocs are always tedious to write but NetBeans makes your life little bit easier. It has a nice JavaDoc GUI where all the important fields are listed. It can also auto correct missing fields for you which again saves time.<br />
<a href="http://ant.apache.org/" title="Ant home">Ant</a> is integrated in a way that you can browse your build.xml files and execute specific targets.<br />
If you ever need to write localised property files NetBeans helps out with that as well. It will display keys and the various localised values in a matrix, making it easier to modify them all at once.<br />
The GUI Editing in NetBeans looks extensive but I have not got around using it since all work has been web related and did not include any AWT or Swing coding.<br />
<img loading="lazy" decoding="async" src="http://www.davidkaspar.com/pics/minus.gif" width="61" height="61" alt="" border="0" align="left" hspace="10" />There are some disadvantages that I have found. I miss a refactoring functionality the most. Other IDE&#8217;s (eg <a href="http://www.intellij.com/idea/" title="IntelliJ IDEA">IntelliJ</a>) have features like &#8220;find usages&#8221; of a method or &#8220;refactor&#8221; that lets you change package and method names across the whole source. With NetBeans, I have to use the &#8220;Find&#8230;&#8221; functionality and manually make any changes.<br />
Large projects often have source code across multiple modules and directories but are built into one single directory structure. One approach that other IDEs take is that they allow you to set up matching patterns on where to build a source. You probably want different directories for Servlets and other front-end classes, libraries and EJBs. NetBeans is very difficult to set up to build to multiple targets. One has to basically manually specify the build directory for each source file&#8230; time consuming.<br />
I also miss J2EE support (templates, wizards). Having grown custom to <a href="http://www.borland.com/jbuilder/" title="JBuilder">Borland JBuilder</a>&#8216;s J2ee support I find some task very repetitive and manual in NetBeans.<br />
Another new and upcoming OpenSource IDE is <a href="http://www.eclipse.org/" title="Eclipse">Eclipse</a>. Some knowledgeable people (<a href="http://bladesys.demon.co.uk/roller/page/sradford/Weblog" title="Sean's blog">Sean</a> and <a href="http://www.raibledesigns.com/page/rd" title="Matt's blog">Matt</a>) have been swearing by it, saying that it is indeed better than NetBeans. I had a brief look at it but because the UI and other crucial details seems to be working differently I did not dare to use it for actual development yet.</p>
<p>The post <a href="https://blog.davidkaspar.com/archives/2003/11/netbeans-ide-pros-and-cons.php">Netbeans IDE, pros and cons</a> appeared first on <a href="https://blog.davidkaspar.com">The Story of David Kaspar</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.davidkaspar.com/archives/2003/11/netbeans-ide-pros-and-cons.php/feed</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>XSLT: Sum of products from multiple nodes</title>
		<link>https://blog.davidkaspar.com/archives/2003/10/xslt-sum-of-products-from-multiple-nodes.php</link>
					<comments>https://blog.davidkaspar.com/archives/2003/10/xslt-sum-of-products-from-multiple-nodes.php#comments</comments>
		
		<dc:creator><![CDATA[David Kaspar]]></dc:creator>
		<pubDate>Fri, 31 Oct 2003 16:53:27 +0000</pubDate>
				<category><![CDATA[Java]]></category>
		<guid isPermaLink="false">https://davidkaspar.com/wp/2003/10/31/xslt-sum-of-products-from-multiple-nodes/</guid>

					<description><![CDATA[<p>The XSL method sum(/foo) sums the value of all foo nodes in current context. If you, however, want to sum the product between two or more nodes the sum(/foo * /bar) is not sufficient as the product does not return a nodeset and thus sum() fails. I found one way to sum products of multiple &#8230; <a href="https://blog.davidkaspar.com/archives/2003/10/xslt-sum-of-products-from-multiple-nodes.php" class="more-link">Continue reading<span class="screen-reader-text"> "XSLT: Sum of products from multiple nodes"</span></a></p>
<p>The post <a href="https://blog.davidkaspar.com/archives/2003/10/xslt-sum-of-products-from-multiple-nodes.php">XSLT: Sum of products from multiple nodes</a> appeared first on <a href="https://blog.davidkaspar.com">The Story of David Kaspar</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>The XSL method <code>sum(/foo)</code> sums the value of all <i>foo</i> nodes in current context. If you, however, want to sum the product between two or more nodes the <code>sum(/foo * /bar)</code> is not sufficient as the product does not return a nodeset and thus sum() fails.<br />
I found one way to sum products of multiple nodes and is to construct a temporary variable with the products, convert that variable to a nodeset and the sum all nodes in that temporary node set.<br />
The function that converts a variable to a nodeset seems to be XSLT specific and the solution below is for Xalan since we are using it in our app. If you are using MSXML you will have to change the namespace but the name of the function is the same.</p>
<p><span id="more-94"></span><br />
<u>XML</u>:<br />
&lt;Order&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;OrderLine&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;Quantity&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;Amount&gt;2&lt;/Amount&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/Quantity&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;Price&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;UnitPrice&gt;25&lt;/UnitPrice&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/Price&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/OrderLine&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;OrderLine&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;Quantity&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;Amount&gt;10&lt;/Amount&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/Quantity&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;Price&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;UnitPrice&gt;2&lt;/UnitPrice&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/Price&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/OrderLine&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;OrderLine&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;Quantity&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;Amount&gt;23&lt;/Amount&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/Quantity&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;Price&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;UnitPrice&gt;6&lt;/UnitPrice&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/Price&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/OrderLine&gt;<br />
&lt;/Order&gt;<br />
<u>XSL</u>:<br />
&lt;?xml&nbsp;version=&quot;1.0&quot;&nbsp;encoding=&quot;UTF-8&quot;?&gt;<br />
&lt;xsl:stylesheet&nbsp;version=&quot;1.0&quot;&nbsp;xmlns:xsl=&quot;http://www.w3.org/1999/XSL/Transform&quot;<br />
&nbsp;&nbsp;&nbsp;&nbsp;xmlns:xalan=&quot;http://xml.apache.org/xalan&quot;&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;xsl:template&nbsp;match=&quot;/Order&quot;&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;root&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;xsl:variable&nbsp;name=&quot;tmpTotal&quot;&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;total_amount&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;xsl:for-each&nbsp;select=&quot;OrderLine&quot;&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;xsl:value-of&nbsp;select=&quot;Quantity/Amount&nbsp;*&nbsp;Price/UnitPrice&quot;/&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/item&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/xsl:for-each&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/total_amount&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/xsl:variable&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;total&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;xsl:variable&nbsp;name=&quot;myTotal&quot;&nbsp;select=&quot;xalan:nodeset($tmpTotal)&quot;/&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;xsl:value-of&nbsp;select=&quot;sum($myTotal/total_amount/item)&quot;&nbsp;/&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/total&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/root&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/xsl:template&gt;<br />
&lt;/xsl:stylesheet&gt;</p>
<p>The post <a href="https://blog.davidkaspar.com/archives/2003/10/xslt-sum-of-products-from-multiple-nodes.php">XSLT: Sum of products from multiple nodes</a> appeared first on <a href="https://blog.davidkaspar.com">The Story of David Kaspar</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.davidkaspar.com/archives/2003/10/xslt-sum-of-products-from-multiple-nodes.php/feed</wfw:commentRss>
			<slash:comments>5</slash:comments>
		
		
			</item>
	</channel>
</rss>
