tag:blogger.com,1999:blog-26623627811269413912024-02-20T07:36:41.216+01:00A Curious AnimalBla, bla, bla, ... blog, blog, blog, ...Antonio Santiagohttp://www.blogger.com/profile/05354117103226692378noreply@blogger.comBlogger96125tag:blogger.com,1999:blog-2662362781126941391.post-19724698005748498122009-04-09T20:05:00.001+02:002009-04-09T20:06:44.815+02:00New domain !!!Hi all,<br /><br />I have changed to the new domain: <a href="http://acuriousanimal.orggeo.net">http://acuriousanimal.orggeo.net</a>. I hope to have some time to move some post to the new site.Antonio Santiagohttp://www.blogger.com/profile/05354117103226692378noreply@blogger.com2tag:blogger.com,1999:blog-2662362781126941391.post-77773721134025873422009-02-26T08:16:00.002+01:002009-02-26T08:19:08.533+01:00Working with tilesToday I found this very educative posts at <a href="http://weblogs.java.net/blog/malenkov/">Sergey Malenkov's Blog</a>, and I would like to put a reference to them in my blog:<br /><ul><li><a href="http://weblogs.java.net/blog/malenkov/archive/2009/02/triangular_tile_1.html">Triangular tile map</a></li><br /><li><a href="http://weblogs.java.net/blog/malenkov/archive/2009/02/square_tile_map_1.html">Square tile map</a></li></ul>Antonio Santiagohttp://www.blogger.com/profile/05354117103226692378noreply@blogger.com0tag:blogger.com,1999:blog-2662362781126941391.post-44006016270248388622009-02-26T07:50:00.004+01:002009-02-26T07:59:23.366+01:00Design Patterns Explained With Java and Uml2<a title="View Design Patterns Explained With Java and Uml2 2008 on Scribd" href="http://www.scribd.com/doc/9973578/Design-Patterns-Explained-With-Java-and-Uml2-2008" style="margin: 12px auto 6px auto; font-family: Helvetica,Arial,Sans-serif; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none; display: block; text-decoration: underline;">Design Patterns Explained With Java and Uml2 2008</a> <object codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" id="doc_742804989840754" name="doc_742804989840754" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" align="middle" height="500" width="100%"> <param name="movie" value="http://d.scribd.com/ScribdViewer.swf?document_id=9973578&access_key=key-q3to9tqcopl0kani92e&page=1&version=1&viewMode=list"> <param name="quality" value="high"> <param name="play" value="true"> <param name="loop" value="true"> <param name="scale" value="showall"> <param name="wmode" value="opaque"> <param name="devicefont" value="false"> <param name="bgcolor" value="#ffffff"> <param name="menu" value="true"> <param name="allowFullScreen" value="true"> <param name="allowScriptAccess" value="always"> <param name="salign" value=""> <param name="mode" value="list"> <embed src="http://d.scribd.com/ScribdViewer.swf?document_id=9973578&access_key=key-q3to9tqcopl0kani92e&page=1&version=1&viewMode=list" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" play="true" loop="true" scale="showall" wmode="opaque" devicefont="false" bgcolor="#ffffff" name="doc_742804989840754_object" menu="true" allowfullscreen="true" allowscriptaccess="always" salign="" type="application/x-shockwave-flash" align="middle" mode="list" height="500" width="100%"></embed> </object> <div style="margin: 6px auto 3px auto; font-family: Helvetica,Arial,Sans-serif; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none; display: block;"> <a href="http://www.scribd.com/upload" style="text-decoration: underline;">Publish at Scribd</a> or <a href="http://www.scribd.com/browse" style="text-decoration: underline;">explore</a> others: <a href="http://www.scribd.com/browse/eBooks/Internet-Technology?style=text-decoration%3A+underline%3B">Internet & Technolog</a> <a href="http://www.scribd.com/browse/eBooks/?style=text-decoration%3A+underline%3B">eBooks</a> <a href="http://www.scribd.com/tag/java" style="text-decoration: underline;">java</a> <a href="http://www.scribd.com/tag/Design%20Patterns" style="text-decoration: underline;">Design Patterns</a> </div>Antonio Santiagohttp://www.blogger.com/profile/05354117103226692378noreply@blogger.com0tag:blogger.com,1999:blog-2662362781126941391.post-53391060742335949442009-02-06T08:03:00.004+01:002009-02-06T08:17:20.021+01:00GTD lightweigh but effective toolsSome time ago I started reading about GTD "philosophy". GTD is easy to follow and effective in your day by day. In my case it helps me a lot at work, improving my organization and the problem resolution. Like other methodologies the difficult isn't in the methodology itself but in ourself, that is, we now what are the "right steps" but forgot to follow them.<br /><br />Here I point three little tools can help with your day by day (applying GTD):<br /><ul><li><a href="http://monkeygtd.tiddlyspot.com/#MonkeyGTD">MonkeyGTD</a></li><li><a href="http://www.dcubed.ca/Welcome_to_d-cubed.html">d3</a><br /></li><li><a href="http://nathanbowers.com/gtdtw/">GTDTiddlyWiki</a></li></ul>All three are based on the <a href="http://en.wikipedia.org/wiki/TiddlyWiki">TiddlyWiki</a> (imagine a HTML page that modifies itself). In the case of 'd3' you have an util calendar to put your reminders.Antonio Santiagohttp://www.blogger.com/profile/05354117103226692378noreply@blogger.com0tag:blogger.com,1999:blog-2662362781126941391.post-39487460206340301172009-01-13T08:08:00.002+01:002009-01-13T08:11:07.262+01:00Simply the truthHere I would like to put a copy of a post read from <a href="http://http://www.navegapolis.net/content/view/850/62/">Navegapolis</a> (Spanish), but contains a link to a <a href="http://www.youtube.com/watch?v=IyNPeTn8fpo#t=13m55s">video</a> with an speaking of Ken Schwaber.<br /><br /><span style="font-style:italic;">Si tienes un equipo de ingenieros excelentes, que utilizan excelentes herramientas, trabajan con prácticas de ingeniería correctas, comprenden perfectamente el negocio del cliente, disponen de los recursos que necesitan y no se les interrumpe en su trabajo... Puedes trabajar con scrum: tendrás un incremento de software al final de cada iteración.<br /><br />De todas formas, scrum también funciona con idiotas. Puedes tener un grupo de idiotas, no hace falta ni que hayan ido a la escuela, ni que sepan de informática o de ingeniería del software. Un grupo que se odien entre ellos, no comprendan el negocio del cliente y trabajen con herramientas traperas... también produciran incrementos periódicos... de mierda.<br /><br />Está bien, porque sabes lo que tendrás al final de cada iteración.<br /></span>Antonio Santiagohttp://www.blogger.com/profile/05354117103226692378noreply@blogger.com0tag:blogger.com,1999:blog-2662362781126941391.post-91616794832502779032009-01-12T20:50:00.000+01:002009-01-12T20:51:16.144+01:00Amazon WebServices and... sort your params !!!A couple of weeks ago I start working with Amazon Web Services. Very, very powerful. I just work with a few features like EC2 and S3 but I love it. There are APIs in most language (Java, PHP, ...) to use the Amazon WS.<br /><br />Anyway, this post is a reminder for all of you that want to implement an API for AWS in some other language (like me and CFML).<br /><br />Extracted from <a href="http://docs.amazonwebservices.com/AWSEC2/2008-08-08/DeveloperGuide/">http://docs.amazonwebservices.com/AWSEC2/2008-08-08/DeveloperGuide/</a> I copy the sentence that solve my headache:<br /><br /><span style="font-style:italic;"><span style="font-weight:bold;">Sort the query parameters (not URL-encoded) without using case-sensitively.</span></span><br /><br />When you invoke some AWS action the params must be sorted by its name.<br /><br />Be happy and read the doc.Antonio Santiagohttp://www.blogger.com/profile/05354117103226692378noreply@blogger.com0tag:blogger.com,1999:blog-2662362781126941391.post-43812648566631567642008-12-13T18:42:00.002+01:002008-12-13T18:47:28.023+01:00Heavyweight + LightweightToday seems a good day for many Java developer.<br />Via <a href="http://weblogs.java.net/blog/richunger/archive/2008/12/heavyweightligh.html">Rich Unger's Blog</a> I found the problem with havyweight and lightweight components is solved in <a href="http://blogs.sun.com/SDNProgramNews/entry/java_se_6_update_121">Java6u12</a> and also Java6u12 early access is availably too.<br />I must test it in the <a href="http://theballoonproject.blogspot.com/">Balloon project</a>, nice to merge WWJ with NetBeans platform.Antonio Santiagohttp://www.blogger.com/profile/05354117103226692378noreply@blogger.com0tag:blogger.com,1999:blog-2662362781126941391.post-56608497537808241942008-12-02T07:50:00.002+01:002008-12-02T08:03:33.244+01:00Working with rollbacks in JPAFirst examples you could see about JPA shows you how easy is to work with it. Don't misunderstand me, I like JPA, we (the developers) need a standard in the ORM world.<br />What I mean is when you really start working in a project using JPA discover you must understand fine the standard and the ORM engine implementing it (in my case TopLink).<br /><br />Previously, in another post I put a couple of links on how to detach entities, here I would like to point to another post, from David Van Couvering's blog, talking about <a href="http://weblogs.java.net/blog/davidvc/archive/2007/04/jpa_and_rollbac.html">transaction rollbacks</a>.Antonio Santiagohttp://www.blogger.com/profile/05354117103226692378noreply@blogger.com0tag:blogger.com,1999:blog-2662362781126941391.post-50946850505459424572008-11-26T17:23:00.002+01:002008-11-26T17:36:10.755+01:00Databases: thinking differentToday I read another great article from Martin Fowler's web page <a href="http://martinfowler.com/bliki/DatabaseThaw.html">DatabaseThaw</a>.<br />In these days it seems there is no place to databases philosophy other than relational and the RDBMS titans.<br />I would like to note one database in "the dark side" commented in the above article, <a href="http://neo4j.org">neo4j</a>, a graph oriented database.Antonio Santiagohttp://www.blogger.com/profile/05354117103226692378noreply@blogger.com0tag:blogger.com,1999:blog-2662362781126941391.post-2798371152382232782008-11-25T21:24:00.003+01:002008-11-25T21:42:21.687+01:00Detach an entity from JPA persistence context<span style="font-weight:bold;">1 - Previously</span><br />Ok, you have designed a great domain model and then translete it to a database or, also much probably, have designed a great database and then generated the corresponding entity classes.<br /><br /><span style="font-weight:bold;">2 - Now</span><br />You have some GUI to get user input data. Easy. You create a new domain object (customer, product, bill or whatever else) and persist it through your favourite JPA engine.<br />Now you have some GUI that lists the available objects in your domain (again customer, product, bill or whatever else. I good idea could be obtain that objects in the way of domain object, I suppose for that reason you create a model, then you can change properties in some of that objects and store (persist) again those changes, so called merge changes.<br /><span style="font-weight:bold;"><br />3 - The question</span><br />Here comes the question. How can you detach an object from the persistence context? If you could get a dettached object you could modify its properties, then if the user agrees persist its new state or leave unchaged otherwise.<br /><br /><span style="font-weight:bold;">4 - The solution (or better say 'some of the solutions')</span><br /><a href="http://stackoverflow.com/questions/31446/detach-an-entity-from-jpaejb3-persistence-context">Detach an entity from JPA/EJB3 persistence context</a>Antonio Santiagohttp://www.blogger.com/profile/05354117103226692378noreply@blogger.com36tag:blogger.com,1999:blog-2662362781126941391.post-42728132377916075452008-11-23T12:20:00.002+01:002008-11-23T12:24:13.334+01:00Where is Java plug-in under Java 6u10?I think I'm not the first who downloads the last Java6 update 10 release and maybe those I was surprised.<br />I just download the 64bits Linux version and when trying to configure the Java plugin in Firefox I found (or better say) I didn't find the plugin file.<br />Looking a bit I found <a href="http://forums.java.net/jive/thread.jspa?threadID=51822&tstart=0">this post</a>. It seems the 64 bits plugin version is still in development :(Antonio Santiagohttp://www.blogger.com/profile/05354117103226692378noreply@blogger.com0tag:blogger.com,1999:blog-2662362781126941391.post-31870994250581798922008-11-02T19:42:00.006+01:002008-11-09T10:38:18.781+01:00Ubuntu scream !!!Probably I should be worried about my mental health if I make a Roschard's test, but the first time a see the new Ubutu Intrepid background I saw:<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://wiki.ubuntu.com/Artwork/Incoming/Intrepid/Earthenibex_wallpaper?action=AttachFile&do=get&target=earthenibex-edit-preview.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 500px; height: 300px;" src="https://wiki.ubuntu.com/Artwork/Incoming/Intrepid/Earthenibex_wallpaper?action=AttachFile&do=get&target=earthenibex-edit-preview.jpg" border="0" alt="" /></a><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://69.90.174.250/photos/display_pic_with_logo/169228/169228,1221174931,1.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 300px; height: 175px;" src="http://69.90.174.250/photos/display_pic_with_logo/169228/169228,1221174931,1.jpg" border="0" alt="" /></a><br /><br />an sreaming skull !!!Antonio Santiagohttp://www.blogger.com/profile/05354117103226692378noreply@blogger.com0tag:blogger.com,1999:blog-2662362781126941391.post-75785838686015999012008-09-28T11:55:00.005+02:002008-09-28T12:12:51.997+02:00HTML&Applet reminderIt was painful but necessary to explain this history. Someone can think I'm a newbie and maybe he/she is right.<br /><br />Many people has knowledge about HTML but ,like me, not everydoby is updated about what tags are in use and what are deprecated.<br /><br />I started working in a simple HTML using DreamWeaver like this:<br /><pre name="code" class="html"><br /><!--<br /><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><br /><html xmlns="http://www.w3.org/1999/xhtml"><br /><head><br /><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><br /><title>Documento sin título</title><br /></head><br /><br /><body><br /></body><br /></html><br />--><br /></pre><br /><br />As you can see, the basic template includes a DTD line specifying XHTML1.0.<br /><br />My problem comes when I tried to add an APPLET to the page. I spent near an hour comparing my code with other pages: maybe my applet 'codebase' is wrong? maybe the libraries needed by the applet has a wrong path? ...<br /><br />Finally I found the problem. Here is a copy&paste extracted from <a href="http://www.w3schools.com/">w3schools<br /></a>:<br /><blockquote>The applet element was deprecated in HTML 4.01.<br />The applet element is not supported in XHTML 1.0 Strict DTD.</blockquote>Antonio Santiagohttp://www.blogger.com/profile/05354117103226692378noreply@blogger.com0tag:blogger.com,1999:blog-2662362781126941391.post-89324891157592409322008-09-26T22:41:00.000+02:002008-09-26T22:41:45.704+02:00Swing Application Framework & Beans BindingThis is a short post related to two Java project that can be very useful.<br /><br />Swing Application Framework (<a href="https://appframework.dev.java.net/">https://appframework.dev.java.net</a>) is <span style="font-style: italic;">a small set of Java classes that simplify building desktop applications</span>. I recommned it because it can be viewed as a set of good practices programming with Java. Also take a look at <a href="http://java.sun.com/developer/technicalArticles/javase/swingappfr/">this article</a>.<br /><br />On the other hand, lately working with NetBeans I make use fo <a href="https://beansbinding.dev.java.net">BeansBinding</a>. It could be a bit confusing at the begining but to work with tables and bind values to DB tables, Lists or other objects, is very powefulAntonio Santiagohttp://www.blogger.com/profile/05354117103226692378noreply@blogger.com0tag:blogger.com,1999:blog-2662362781126941391.post-86972633071364997852008-08-09T23:00:00.001+02:002008-08-09T23:01:52.683+02:00Visual words definitionToday I know the existence of this amazing page: <a href="http://www.visuwords.com">Visuwords</a>.<br />I think it is one of the most original things I can see in many time.Antonio Santiagohttp://www.blogger.com/profile/05354117103226692378noreply@blogger.com0tag:blogger.com,1999:blog-2662362781126941391.post-30504679868303594582008-08-07T22:25:00.007+02:002008-08-07T22:55:31.317+02:00Using JAXB to generate KML Java classesSome days ago I write a post about using JAXB with the KML's XSD file.<br />Due to a comment I would like to write more explicitly how I generated the Java files.<br /><br />First of all, what you need is the <a href="http://code.google.com/apis/kml/documentation/kmlreference.html">XSD files</a> which defines the KML syntax (<a href="http://schemas.opengis.net/kml">http://schemas.opengis.net/kml</a>).<br />Also, you need the <tt>xjc</tt> utility, included in the JDK6 (or download the JAXB project files).<br /><br />Uncompress the XSD zip file and go into the uncompressed folder. Execute:<br /><tt>xjc -xmlschema -verbose -extension ogckml22.xsd</tt><br />and get an error similar to this:<br /><tt><br />[ERROR] Two declarations cause a collision in the ObjectFactory class.<br />line 1058 of file:kml_files/ogckml22.xsd<br /><br />[ERROR] (Related to above error) This is the other declaration.<br />line 255 of file:kml_files/ogckml22.xsd<br /><br />[ERROR] Two declarations cause a collision in the ObjectFactory class.<br />line 350 of file:kml_files/ogckml22.xsd<br /><br />[ERROR] (Related to above error) This is the other declaration.<br />line 261 of file:kml_files/ogckml22.xsd<br /></tt><br /><br />The problem is there are two <span style="font-style: italic;">scale</span> elements defined, one like 'scale' and the other with upper case 'Scale'. And the same for the <span style="font-style: italic;">snippet</span> element.<br />By default, JAXB uses case insensitive which will produce duplicated class names.<br /><br />To resolve this there are some solutions. One is to <a href="http://ssklogs.blogspot.com/2006/07/jaxb-class-customization.html">customize the JAXB</a> specifying the class name to be generated for some elements. The later is a workaround (that I used) that consist to change the name for one of the duplicated elements. <br />In line 255 change:<br /><pre name="code" class="xml"><br /><element name="scale" type="double" default="1.0"></element><br /></pre><br />by<br /><pre name="code" class="java"><br /><element name="LiteralScale" type="double" default="1.0"></element><br /></pre><br /><br />and in line 1391 chage:<br /><pre name="code" class="java"><br /><element ref="kml:scale" minoccurs="0"></element><br /></pre><br />by<br /><pre name="code" class="java"><br /><element ref="kml:LiteralScale" minoccurs="0"></element><br /></pre><br /><br />The same for the <span style="font-style: italic;">snippet</span> element.<br /><br />Now you can re-execute the <span style="font-style: italic;">xjc</span> command and a set of Java classes will be generated. The only difference is the change in the <span style="font-style: italic;">scale</span> element which produces a different class name.Antonio Santiagohttp://www.blogger.com/profile/05354117103226692378noreply@blogger.com15tag:blogger.com,1999:blog-2662362781126941391.post-13738932728240047382008-07-27T17:06:00.003+02:002008-07-27T17:15:27.328+02:00Eastwood ChartsToday, via <a href="http://www.jroller.com/dgilbert/">Dave Gilbert</a>'s blog, I know the existence of <a href="http://www.jfree.org/eastwood/">Eastwood Charts</a>.<br /><br />If you know about <a href="http://code.google.com/apis/chart/">Google Chart API</a>, Eastwood are the same thing but based in the powerful <a href="http://www.jfree.org/jfreechart/index.html">JFreeChart</a> library. <a href="http://www.jfree.org/eastwood/samples.html">Here is a comparison</a>.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.jfree.org/eastwood/images/demo1.png"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px;" src="http://www.jfree.org/eastwood/images/demo1.png" border="0" alt="" /></a><br /><br />The interesting part of Eastwood is it can be used as a servlet installed on your own server and thus you don't need to send your data to Google.Antonio Santiagohttp://www.blogger.com/profile/05354117103226692378noreply@blogger.com0tag:blogger.com,1999:blog-2662362781126941391.post-24594769261106675942008-07-27T15:13:00.003+02:002008-07-27T15:17:48.336+02:00Remove too much files...Sometimes (in Linux) if you try to delete all files in a directory (that contains a lot files) you get an: <br /><pre>> rm -rf * <br />Argument list too long</pre><br />Via DZone I found this <a href="http://blog.trendics.com/linux/argument-list-too-long-message-in-linux/">tip</a> to avoid this problem. Basically it used <tt>find</tt> command to get the list of interested files and remove it one by one.Antonio Santiagohttp://www.blogger.com/profile/05354117103226692378noreply@blogger.com0tag:blogger.com,1999:blog-2662362781126941391.post-21417976988584428122008-07-18T20:08:00.002+02:002008-07-18T20:13:39.872+02:00JAXB for KMLYesterday, I take a look at <a href="http://code.google.com/apis/kml/documentation/">KML 2.2</a> specification.<br />To avoid create a million of classes to parse XML (KML) documents I put on my hands <a href="https://jaxb.dev.java.net/">JAXB</a>. After a while to resolve a duplicate element name (due to case insensitive in JAXB), finally I get a bunch of classes representing the KML element types.<br /><br />After a couple of little test it seems is all right and now I need to spend some time (that I haven't) to integrate KML2.2 support into <a href="http://http://theballoonproject.blogspot.com/">Balloon</a> ;)Antonio Santiagohttp://www.blogger.com/profile/05354117103226692378noreply@blogger.com5tag:blogger.com,1999:blog-2662362781126941391.post-29406726772865265992008-07-17T21:35:00.002+02:002008-07-17T21:39:20.538+02:00Design PatternsToday I would like to point to this post <a href="http://blog.cumps.be/design-patterns-command-pattern/">Design Patterns - Command Pattern</a>. <br />Via <a href="http://www.dzone.com">DZone</a> I can see David Cumps is written a series of post about <a href="http://en.wikipedia.org/wiki/Design_pattern_(computer_science)">design patterns</a>.<br />Very interesting for all programmers.Antonio Santiagohttp://www.blogger.com/profile/05354117103226692378noreply@blogger.com0tag:blogger.com,1999:blog-2662362781126941391.post-45064627059434753362008-07-10T22:18:00.000+02:002008-07-10T22:19:10.408+02:00QuoteEveryone is as God has made him, and oftentimes a great deal worse.<br /><span style="font-style:italic;">Miguel de Cervantes</span><br /><span style="font-style:italic;">Spanish adventurer, author, & poet (1547 - 1616)</span>Antonio Santiagohttp://www.blogger.com/profile/05354117103226692378noreply@blogger.com0tag:blogger.com,1999:blog-2662362781126941391.post-54948496615904243822008-06-27T19:47:00.003+02:002008-08-07T22:54:52.365+02:00Working with timeIt can seem trivial but sometimes working with time can become a real headache.<br />Here I present a short code snippet showing one common but confusing situation: <br /><span style="font-style:italic;">if you create two different Calendar objects and print it getting its Date and using 'println()' method they can seem the same.</span><br /><br />Please read code comments which clarifies every situation.<br /><br /><pre name="code" class="java"><br />import java.util.Calendar;<br />import java.util.TimeZone;<br /><br />public class utc {<br /><br /> /**<br /> * @param args<br /> */<br /> public static void main(String[] args) {<br /> Calendar c1 = Calendar.getInstance(TimeZone<br /> .getTimeZone("Europe/Madrid"));<br /><br /> Calendar c2 = (Calendar) c1.clone();<br /> c2.setTimeZone(TimeZone.getTimeZone("UTC"));<br /><br /> // Print Calendars. By default the toString() Calendar method is called<br /> // and gets a String version of the objects.<br /> // As you can see the String version shows the time zone of the Calendar.<br /> System.out.println("Cal1: " + c1);<br /> System.out.println("Cal2: " + c2);<br /><br /> // Print the Date objects of each Calendar.<br /> // Here the toString method of the Date objects are invoked and this method<br /> // by default translates the Date to the default system timezone. Thus both Dates<br /> // seems equal.<br /> System.out.println("Cal1: " + c1.getTime());<br /> System.out.println("Cal2: " + c2.getTime());<br /><br /> // Finally we get the value of HOUR, MINUTE and SECOND of each calendar and<br /> // prints it on the screen.<br /> int h1 = c1.get(Calendar.HOUR_OF_DAY);<br /> int m1 = c1.get(Calendar.MINUTE);<br /> int s1 = c1.get(Calendar.SECOND);<br /><br /> int h2 = c2.get(Calendar.HOUR_OF_DAY);<br /> int m2 = c2.get(Calendar.MINUTE);<br /> int s2 = c2.get(Calendar.SECOND);<br /><br /> System.out.println("Cal1: " + h1 + ":" + m1 + ":" + s1);<br /> System.out.println("Cal2: " + h2 + ":" + m2 + ":" + s2);<br /> }<br />}<br /></pre>Antonio Santiagohttp://www.blogger.com/profile/05354117103226692378noreply@blogger.com0tag:blogger.com,1999:blog-2662362781126941391.post-85468665386083567182008-06-15T18:29:00.003+02:002008-06-15T18:39:29.579+02:00Why I like EJB3...Today I would like to put a link to an <a href="http://blog.adam-bien.com">Adam Bien</a> post: <a href="http://java.dzone.com/news/why-i-like-ejb-30-and-really-l">Why I Like EJB 3.0 And Really Like EJB 3.1</a>, that is a summary of EJB3 benefits.<br />You can achieve the same with other technologies, but EJB3 offers you the whole pack.Antonio Santiagohttp://www.blogger.com/profile/05354117103226692378noreply@blogger.com0tag:blogger.com,1999:blog-2662362781126941391.post-23334466810537679222008-05-14T16:14:00.002+02:002008-05-14T16:23:23.918+02:00Using JPA in a web applicationI usually work creating my entity data model classes using JPA and creating session beans (or stateless/web services beans) in an EJB module to acces this data. Later, I create a web/desktop application to access entities through the previous module.<br /><br />But sometimes you need/want to do a more quickly/ugly job working with entities directly from your web application. For those (like me today ;)) I put here this link to a JEE5 blueprint named: <a href="https://blueprints.dev.java.net/bpcatalog/ee5/persistence/webonlyapp.html">Design Choices in a Web-only Application Using Java Persistence</a>.<br />Among other things, It talks about using container or application managed entity managers.Antonio Santiagohttp://www.blogger.com/profile/05354117103226692378noreply@blogger.com1tag:blogger.com,1999:blog-2662362781126941391.post-54968037443488734192008-04-26T20:15:00.005+02:002008-04-26T20:33:38.327+02:00Obfuscating a NetBeans Java application projectSome time ago I found a couple of posts talking about how obfuscating a NetBeans RCP module (<a href="http://blogs.sun.com/geertjan/entry/obfuscation">here</a> and <a href="http://wiki.netbeans.org/DevFaqModuleObfuscation">here</a>).<br /><br />Getting some parts of the ant targets presented in the previous post, this one present a simple target that allows to obfuscate a normal java library.<br /><br />For this, you need to have installed the obfuscator <a href="http://proguard.sourceforge.net/">ProGuard</a>.<br /><br />Take into account I am talking about obfuscating a Java library. This implies the obfuscation is lighter than if you obfuscate a closed application, that is, all public methods and interfaces must maintain its name (if not you can call your library methods anymore).<br /><br />Open your build.xml Java application file and paste this target:<br /><br /><pre name="code" class="xml"><br /> <target name="-post-jar"><br /> <property name="proguard.jar.path" value="/path/to/proguard.jar"/><br /> <property name="java.home.path" value="/path/to/java/home"/><br /> <br /> <taskdef resource="proguard/ant/task.properties"<br /> classpath="${proguard.jar.path}" /><br /> <br /> <echo message="Obfuscating ${dist.jar}..."/><br /> <mkdir dir="${build.dir}/obfuscated"/><br /> <proguard printmapping="${build.dir}/obfuscated/${application.title}.map"<br /> renamesourcefileattribute="SourceFile" ignorewarnings="true"><br /> <br /> <!-- Specify the input jars, output jars, and library jars. --><br /> <injar file="${dist.jar}" /><br /> <outjar file="${build.dir}/obfuscated/BalloonWindCore_JavaSE.jar" /><br /> <br /> <libraryjar path="${javac.classpath}" /> <br /> <libraryjar file="${java.home.path}/jre/lib/rt.jar" /><br /> <br /> <!-- Keep some useful attributes. --><br /><br /> <keepattribute name="InnerClasses" /><br /> <keepattribute name="SourceFile" /><br /> <keepattribute name="LineNumberTable" /><br /> <keepattribute name="Deprecated" /><br /> <keepattribute name="*Annotation*" /><br /> <keepattribute name="Signature" /><br /> <br /> <!-- Preserve all public classes, and their public and protected fields and methods. --><br /><br /> <keep access="public"><br /> <field access="public protected" /><br /> <method access="public protected" /><br /> </keep><br /> <br /> <br /> <!-- Preserve all .class method names. --><br /><br /> <keepclassmembernames access="public"><br /> <method type ="java.lang.Class"<br /> name ="class$"<br /> parameters="java.lang.String" /><br /> <method type ="java.lang.Class"<br /> name ="class$"<br /> parameters="java.lang.String,boolean" /><br /> </keepclassmembernames><br /> <br /> <!-- Preserve all native method names and the names of their classes. --><br /><br /> <keepclasseswithmembernames><br /> <method access="native" /><br /> </keepclasseswithmembernames><br /> <br /> <!-- Preserve the methods that are required in all enumeration classes. --><br /><br /> <keepclassmembers extends="java.lang.Enum"><br /> <method access="public static"<br /> type="**[]"<br /> name="values"<br /> parameters="" /><br /> <method access="public static"<br /> type="**"<br /> name="valueOf"<br /> parameters="java.lang.String" /><br /> </keepclassmembers><br /> <br /> <!-- Explicitly preserve all serialization members. The Serializable<br /> interface is only a marker interface, so it wouldn't save them.<br /> You can comment this out if your library doesn't use serialization.<br /> With this code serializable classes will be backward compatible --><br /><br /> <keepnames implements="java.io.Serializable"/><br /> <keepclassmembers implements="java.io.Serializable"><br /> <field access ="final"<br /> type ="long"<br /> name ="serialVersionUID" /><br /> <field access ="!static !transient"<br /> name ="**"/><br /> <field access ="!private"<br /> name ="**"/><br /> <method access ="!private"<br /> name ="**"/><br /> <method access ="private"<br /> type ="void"<br /> name ="writeObject"<br /> parameters="java.io.ObjectOutputStream" /><br /> <method access ="private"<br /> type ="void"<br /> name ="readObject"<br /> parameters="java.io.ObjectOutputStream" /><br /> <method type ="java.lang.Object"<br /> name ="writeReplace"<br /> parameters="" /><br /> <method type ="java.lang.Object"<br /> name ="readResolve"<br /> parameters="" /><br /> </keepclassmembers><br /> <br /> <!-- Your application may contain more items that need to be preserved;<br /> typically classes that are dynamically created using Class.forName --><br /><br /> </proguard><br /> </target><br /></pre><br /><br />Special attention to these couple of lines:<br /><pre name="code" class="xml"><br /> <property name="proguard.jar.path" value="/path/to/proguard.jar"/><br /> <property name="java.home.path" value="/path/to/java/home"/><br /></pre>Antonio Santiagohttp://www.blogger.com/profile/05354117103226692378noreply@blogger.com1