tag:blogger.com,1999:blog-73326812024-03-07T18:43:03.720-08:00def prattleOnce into java;
I am now taking the leap;
into functionalTravhttp://www.blogger.com/profile/16003716758884119356noreply@blogger.comBlogger65125tag:blogger.com,1999:blog-7332681.post-51482674583810198622010-06-18T16:26:00.000-07:002010-06-18T16:26:25.858-07:00Why Use A Messaging Service for P2P ConnectivityI think it is preferable for a client to directly call an X service (REST, SOAP, internal, external, whatever) so as to leave out the added complexity of writing to a queue. However I think there are some valid reasons to use a Messaging Service.<br />
<br />
1. Lazy error handling. Most messaging systems are rock solid these days and the only reason they go down is for system reboot. X services may not be rock solid and may have a considerable amount of down time. Instead of having to add extra handling for the downtime cases, write to the message service. When the X service comes back up, the message queue will deliver. However, "Lazy" is the key here. If time allows, code error handling in the client.<br />
<br />
2. Throttling. This is related to lazy error handling in that if a service becomes too congested, it can stop accepting requests. Write to a message service and the X service will control its own destiny. One obvious consequence of this is that the X service may never catch up. If the X service can handle the load, or it can be clustered to handle the load then call the X service directly.<br />
<br />
3. Event triggers. If multiple X services need to react to a single client event. It is easier for the X services to listen for events than for the one client to contact each X service individually. In my opinion, this is truly the only valid reason to use a messaging service.Travhttp://www.blogger.com/profile/16003716758884119356noreply@blogger.com1tag:blogger.com,1999:blog-7332681.post-69237734753001832382010-02-12T10:28:00.000-08:002010-06-18T16:38:53.770-07:00Option is IterableEvent though the method exists doesn't exist on the Option class, there is an implicit conversion from Option to Iterable. Exists is a useful method when processing the value contained within option.<br />
<br />
<pre class="code">def isBefore (a: Option[Int], b: Option[Int]): Boolean = {
a.exists(x => b.exists(x < _))
}
println("5 is before 3 :" + isBefore(Some(5), Some(3)))
println("3 is before 5 :" + isBefore(Some(3), Some(5)))
println("5 is before none: " + isBefore(Some(5), None))
println("3 is before none: " + isBefore(None, Some(3)))
</pre>
Produces
<pre class="code">5 is before 3 :false
3 is before 5 :true
5 is before none: false
3 is before none: false
</pre>Travhttp://www.blogger.com/profile/16003716758884119356noreply@blogger.com0tag:blogger.com,1999:blog-7332681.post-11786923697431500892010-02-11T10:04:00.000-08:002010-02-11T10:04:00.680-08:00Do not use 64bit JDK when coding in ScalaI recently upgraded to 64 bit Ubuntu Linux to make use of the 6 gigs of RAM by boss had bought me. I used the Synaptic package manager to install the JDK because I enjoy the work being done for me.<br />
<br />
My machine felt faster and really powerful, except that the multi module maven build, using the <a href="http://scala-tools.org/mvnsites/maven-scala-plugin/">maven scala plugin</a> when from 4 minutes to a whopping 8 minutes.<br />
<br />
What this boils down to is that the 64 bit JDK does not support client mode (-client), only server mode. Since <i>scalac</i> is pretty short lived, it is really hindered by the startup cost of server mode. Scala builds times double and triple.<br />
<br />
This was easy to remedy. Even though 64 bit Ubuntu does not have the 32 bit packages, one can grab the 32 bit binaries from java.sun.com, and they will work just fine.Travhttp://www.blogger.com/profile/16003716758884119356noreply@blogger.com0tag:blogger.com,1999:blog-7332681.post-44137902303411791012008-06-03T15:47:00.000-07:002008-06-03T15:59:19.296-07:00git in continuumGit is available in continuum. There may be other ways to do this, but this is how I was able to get it working.<br /><br />1. download Maven SCM source: 'svn co http://svn.apache.org/repos/asf/maven/scm/trunk maven-scm"<br />2. build the project "cd maven-scm" "mvn install"<br />3. install the git providers module "cd maven-scm-providers/maven-scm-providers-git/" "mvn install"<br />4. download continuum source: 'svn co http://svn.apache.org/repos/asf/continuum/trunk/ continuum"<br />5. edit the 'continuum-webapp/pom.xml' and add the maven scm git project:<br /><br /> <dependency><br /> <groupId>org.apache.maven.scm</groupId><br /> <artifactId>maven-scm-provider-git-commons</artifactId><br /> <version>1.1-SNAPSHOT</version><br /> </dependency><br /> <dependency><br /> <groupId>org.apache.maven.scm</groupId><br /> <artifactId>maven-scm-provider-gitexe<<artifactId><br /> <version>1.1-SNAPSHOT</version><br /> </dependency><br /><br />6. build the continuum project "mvn install"<br />7. run continuum "cd continuum-webapp" "mvn jetty:run"Travhttp://www.blogger.com/profile/16003716758884119356noreply@blogger.com4tag:blogger.com,1999:blog-7332681.post-76151286959901306172008-03-20T10:11:00.000-07:002008-03-20T10:12:07.445-07:00Expected :success, but was zeroI was having an issue with the rails plugin, http authentication, which<br>resulted in the error message Expected response to be a <:success>, but<br>was <0>.<p>This seems to be the result of a before_filter returning false.Travhttp://www.blogger.com/profile/16003716758884119356noreply@blogger.com0tag:blogger.com,1999:blog-7332681.post-1159893159894781662006-10-03T09:32:00.000-07:002006-10-03T09:32:39.900-07:00IE, Back button, AJAX and DHTML. Solution - exploit onload.<p class="mobile-post">Most people know about the back button feature when developing heavy<br />AJAX web sites. That is not what this is about.</p><p class="mobile-post">I created a simple web page to save favorite things. An image titled<br />"Save" or "Remove" appears on the screen depending if a favorite can be<br />saved or is saved. When pressed, a simple AJAX request is sent the<br />server and the images are swapped if the request is successful. I want<br />the appropriate button to appear no matter how one navigates to the<br />page. Unfortunately, in Internet Explorer, if I navigated away from the<br />screen and then 'back' to the page, all the images reverted back how<br />they were initially loaded -- all DOM changes are forgotten. Firefox<br />will display the latest DOM, so there are no problems here.</p><p class="mobile-post">After playing around a little bit, I noticed that IE also runs the<br />'onload' function when you navigate 'back' to it and so I exploited<br />this. The onload runs an AJAX call to retrieve ones favorites and then<br />changes the image to the appropriate image. Since I used get requests,<br />I also had to append a time stamp to the end of the URL just before<br />'open' to avoid IE caching.</p><p class="mobile-post">The advantage of doing this is that it works. The disadvantage is that<br />the logic is in the javascript and not the JSP.</p>Travhttp://www.blogger.com/profile/16003716758884119356noreply@blogger.com0tag:blogger.com,1999:blog-7332681.post-1145910172645030922006-04-24T11:57:00.000-07:002006-04-24T14:04:10.330-07:00Odd error in oracle portal for the google godsHere is the error I was getting:<br /><br />Portlet X responded with content-type text/plain when the client was requesting content-type text/html<br /><br />.... some garbled stuff here ....<br /><br />ate: Mon, 24 Apr 2006 20:12:18 GMT<br />Server: Oracle-Application-Server-10g/10.1.2.0.2 Oracle-HTTP-Server<br />Connection: close<br />Transfer-Encoding: chunked<br />Content-Type: text/vnd.oracle.mobilexml<br /><br /><br />There seems to be something in the <fmt:formatdate> tag that caused this. We are using jakarta standar.jar version 1.0. I don't have time to reasearch this right now, instead I made this a scriptlet that uses SimpleDateFormat. (Yes, I feel that this workaround is a cop-out, but that's the way it has to be.</fmt:formatdate>Travhttp://www.blogger.com/profile/16003716758884119356noreply@blogger.com0tag:blogger.com,1999:blog-7332681.post-1133392584096561462005-11-30T13:05:00.000-08:002005-11-30T15:16:24.140-08:00AbstractMethodError with oc4jThe AbstractMethodError I received with OC4J and EJB Session Beans.<br /><br />We have this fairly screwed up development envirnment where there is only one OC4J instance for 5 developers which is really what caused this problem.<br /><br />Someone would deploy the application, and before starting the application I would upload my version of the jar file which contains the EJB classes. Apparently , Oracle creates the wrapper classes which implement the remote interface at deployment, not when the OC4J instance is started and therefor my personal EJB classes was not having its additional methods wrapped.<br /><br />Solution: Do not modify EJB classes once they are deployed.Travhttp://www.blogger.com/profile/16003716758884119356noreply@blogger.com0tag:blogger.com,1999:blog-7332681.post-1118789500219875272005-06-14T15:40:00.000-07:002005-06-14T15:52:42.376-07:00How often do you use final?I ran across a Source Code Scanner called <a href="http://pmd.sourceforge.net/">PMD</a> in the last Dr Dobbs issue. There are two rules that seem to generate a lot of warnings. They are LocalVariableCouldBeFinal and MethodArgumentCouldBeFinal (<a href="http://pmd.sourceforge.net/rules/optimizations.html">http://pmd.sourceforge.net/rules/optimizations.html</a>)<br /><br />In the terms of Method Arguments and local varaibles, I found that the final modifyer means that the variable will not be reassigned.<br /><br />I find that pretty much all my MethodArguments should be final and a majority of my Local Variables should be final. Unfortunately, defining everything as final takes extra work (all that typing) and also causes some code clutter.<br /><br />Any comments on how strictly I should use the final modifier?Travhttp://www.blogger.com/profile/16003716758884119356noreply@blogger.com98tag:blogger.com,1999:blog-7332681.post-1114546806481367432005-04-26T12:45:00.001-07:002005-04-26T13:20:06.483-07:00Object Oriented QuestionLets say I have some interfaces which make up a framework:<br /><br />public interface Gum {<br /> public String getFlavor();<br />}<br /><br />public interface Package {<br /> public Gum getGum();<br />}<br /><br />public interface<br /><br />There are no setter methods because the values may be set/retrieved different ways.<br /><br />And I have a particular implementation<br /><br />public class GumImpl implements Gum{<br /> private String flavor;<br /> public String getFlavor() { return this.flavor; }<br /> public void setFlavor(String flavor) { this.flavor = flavor; }<br />}<br /><br /><br />public class PackageImpl implements Package{<br /> private GumImpl gum;<br /> public GumImpl getGum(){return this.gum;}<br /> public void setGum(GumImpl gum){ this.gum = gum; }<br />}<br /><br /><br />First of all, notice that I am returning GumImpl from my PackageImpl.getGum and the interface defines that Package.getGum() should return a Gum type. To me, this seems appropriate because that classes that interact with the implementation shouldn't have to deal/cast to the from the interface to the implementation.<br /><br />Does anyone have an opinion if changing the method signature to return a subclass like this is appropriate?<br /><br />I am having problems using various tools with this approach such as Spring and Netbeans. Spring will complain that the PackageImpl is read-only.Travhttp://www.blogger.com/profile/16003716758884119356noreply@blogger.com9tag:blogger.com,1999:blog-7332681.post-1113519368643269782005-04-14T15:48:00.000-07:002005-04-14T15:56:08.643-07:00Loading an XSL Stylesheet in JavaJust a friendly reminder that if you are using an XSL Stylesheet which contains xsl:include elements that are relative to the including stylesheet and you wish to load it as a javax.xml.transform.stream.StreamSource, you should not load it using the StreamSource constructor that takes as a java.io.Reader or java.io.InputStream. You should load it using the File or SystemId (URL) constructor.<br /><br />The reason is, that if you load it as a Reader or an InputStream object, the object in charge of resolving the included elements does not know relative path.Travhttp://www.blogger.com/profile/16003716758884119356noreply@blogger.com1tag:blogger.com,1999:blog-7332681.post-1111705094928861402005-03-24T10:08:00.000-08:002005-03-24T14:58:14.930-08:00XSL Stylesheet BuildingI have a complex XML schema and the HTML output is supposed to display all schema elements. I started to hand edit it using <a href="http://www.oxygenxml.com/">Oxygen </a>but it is taking way too long. Does anyone know of an application to help generate an arbitrary XSL from a schema.<br /><br /><span class="down" style="display: block;" id="formatbar_CreateLink" title="Link" onmouseover="ButtonHoverOn(this);" onmouseout="ButtonHoverOff(this);" onmousedown="CheckFormatting(event);FormatbarButton('richeditorframe', this, 8);ButtonMouseDown(this);"></span>Travhttp://www.blogger.com/profile/16003716758884119356noreply@blogger.com1tag:blogger.com,1999:blog-7332681.post-1111597900684758692005-03-23T09:01:00.000-08:002005-03-23T09:11:40.686-08:00Advancing the XML:DB api for XML databasesThe XML:DB initiative for XML databases <a href="http://xmldb-org.sourceforge.net">project</a> has been around for some time now and is starting to be noticed again. I am tasks with advancing the <a href="http://xmldb-org.sourceforge.net/xapi/index.html">XAPI</a> (API For XML Databases). There are lots of suggestions and I am open to more.Travhttp://www.blogger.com/profile/16003716758884119356noreply@blogger.com0tag:blogger.com,1999:blog-7332681.post-1090869488599024462004-07-26T12:10:00.000-07:002004-07-26T12:18:08.600-07:00Looking at NCDC linksNCDC had a lot of good links. Our first reaction was that they probably had many high level links in the metadata. So I checked it out...
<br />
<br /> 288/597 have NOAA Server More Info links(not FGDC compliant), and they were low level
<br /> 128/597 have NOAA Server Preview links (not FGDC compliant) and they are low level.
<br /> 140/597 have NOAA Server Obtain links (not FGDC compliant) and they are low level.
<br /> 314/597 have Online linkage URLs and they are low level.
<br /> 475/597 have Network resource name but ~390 of them point to http://www.ncdc.noaa.gov
<br />
<br /> Also note that 88 record have recently migrated from NGDC to NCDC where all of the obove links were filled out.
<br /> Travhttp://www.blogger.com/profile/16003716758884119356noreply@blogger.com1tag:blogger.com,1999:blog-7332681.post-1090868255799349422004-07-26T11:57:00.001-07:002004-07-26T11:58:09.146-07:00Fixed a bug from charlesFixed a bug reported by charles which resulted in another bug being found in the Blue Angle libraries.
<br />Travhttp://www.blogger.com/profile/16003716758884119356noreply@blogger.com0tag:blogger.com,1999:blog-7332681.post-1090868342801883082004-07-23T11:58:00.000-07:002004-07-26T11:59:30.050-07:00Components in ComponentsFinally received a bug fix that allows for saving a record that has components in components.
<br />Travhttp://www.blogger.com/profile/16003716758884119356noreply@blogger.com0tag:blogger.com,1999:blog-7332681.post-1090437401632376922004-07-21T09:35:00.000-07:002004-07-21T12:17:52.680-07:00dictionaryWorked with John Relph to figure out that the record set did not specify a dictionary to use. Need to add that to the documentatioin.
<br />Travhttp://www.blogger.com/profile/16003716758884119356noreply@blogger.com0tag:blogger.com,1999:blog-7332681.post-1090015200927385292004-07-16T14:45:00.000-07:002004-07-16T15:00:00.926-07:00back to the search functionalityTom Wanuga tells me the BMSRecordSearchFilter.FIELD_USER_UID takes the responsibility of searching for an owner uid.
<br />
<br /> I have now sent them a bug report because pushing a BMSOperator with FIELD_USER_UID does not work.
<br /> Travhttp://www.blogger.com/profile/16003716758884119356noreply@blogger.com0tag:blogger.com,1999:blog-7332681.post-1090012966709301152004-07-16T14:21:00.000-07:002004-07-16T16:17:46.100-07:00Working with digesterI am getting this error:
<br />
<br /> java.lang.NoSuchMethodException: No such accessible method: addLink() on object: gov.noaa.mm.validate.HttpLinkValidation
<br />
<br /> But there seems to be an addLink public method on HttpLinkValidation.
<br />
<br /> I was using "*/element" instead of "root/element". I changed it to not use the * and it works. I guess I just don't quite understand the *.
<br />Travhttp://www.blogger.com/profile/16003716758884119356noreply@blogger.com11tag:blogger.com,1999:blog-7332681.post-1089909327699890172004-07-15T09:26:00.000-07:002004-07-16T14:13:05.170-07:00How to upgrade to nmmr 4.x. I am working on adding a section to the developers docs on how to upgrade to NMMR 4.x.
<br />Travhttp://www.blogger.com/profile/16003716758884119356noreply@blogger.com0tag:blogger.com,1999:blog-7332681.post-1089846610612693342004-07-14T16:08:00.001-07:002004-07-15T07:54:25.520-07:00Meetings all day today.Met with Tino, Doug, Amy, Ted, Ken, and Karen. We discussed class metadata architacture and submition agreements.
<br />
<br />Then I met with John Carone and talked about HDF and THREADS.Travhttp://www.blogger.com/profile/16003716758884119356noreply@blogger.com0tag:blogger.com,1999:blog-7332681.post-1089846640187838902004-07-14T16:08:00.000-07:002004-07-15T07:54:04.730-07:00Small amount of metadata documentationI updated some pages at <a href="http://www.ngdc.noaa.gov/metadata">http://www.ngdc.noaa.gov/metadata</a>
<br />such as the extensions page. I also tidied up the index page.Travhttp://www.blogger.com/profile/16003716758884119356noreply@blogger.com0tag:blogger.com,1999:blog-7332681.post-1089846482829267122004-07-14T16:05:00.001-07:002004-07-14T16:08:02.830-07:00Meetings all day today.Met with Tino, Doug, Amy, Ted, Ken, and Karen. We discussed class metadata architacture and submition agreements.
<br />
<br />Then I met with John Carone and talked about HDF and THREADS.Travhttp://www.blogger.com/profile/16003716758884119356noreply@blogger.com0tag:blogger.com,1999:blog-7332681.post-1089846466437364602004-07-14T16:05:00.000-07:002004-07-14T16:07:46.436-07:00Meetings all day today.Met with Tino, Doug, Amy, Ted, Ken, and Karen. We discussed class metadata architacture and submition agreements.
<br />
<br />Then I met with John Carone and talked about HDF and THREADS.Travhttp://www.blogger.com/profile/16003716758884119356noreply@blogger.com0tag:blogger.com,1999:blog-7332681.post-1089759515825157132004-07-13T15:58:00.000-07:002004-07-13T15:58:35.826-07:00NMMR MeetingHad a meeting with Tino, Amy, Doug and Ken. Talked about the NMMR and such. I thought it went well.Travhttp://www.blogger.com/profile/16003716758884119356noreply@blogger.com0