Monday, December 24, 2007

It's been a while. I have been heads down developing a Mobile Banking application for cell phones. Recently I have been modifying it to run on the new android handset. Because of this I have ran into a few things I would like to remind myself of later.

One sort of unrelated thing is an issue I found when I started to migrate code from 1.5 to 1.6. I thought I had all of my project related code changed over only to have a build script fail. Below is the stack from my console.

The error manifest it self in two ways. the first way is:

class file has wrong version 50.0, should be 49.0

The second way is:

[echo] compile of C:\_brent\workspaces\.....\source\main to C:\_brent\workspaces\.....\webapp\WEB-INF\classes
[javac] Compiling 144 source files to C:\_brent\workspaces\.....\webapp\WEB-INF\classes
[javac] javac: invalid target release: 1.6
[javac] Usage: javac

Not a very good description of what was happening. After double checking my settings I found the issue was with my ant task settings in the window>preferences>ant. I still had the 1.5 tools jar in my settings and need the 1.6 tools jar. Once I changed that it was smooth sailing.

I hope this helps others with the same issue. Happy coding!

Wednesday, June 13, 2007

I know that sometimes I run across stuff that makes me look and feel stupid. Yesterday was one of those days. After searching in all of the wrong places on the web, I found I was not alone. I was trying to create a web service using axis. Simple enough and actually with test cases and everything it didn't take long. What became the issue is I needed to see it work for myself not in a test case but in a browser. Simple enough right? Wrong. For the life of me I could not figure out what the url is to test a soap service. Furthermore I was mentally incapacitated enough I couldn't even describe my issue well enough to find the answer in the oracle of the web Google.

Thanks to xp style paring and my friend Pat we found the answer. The following is taken directly from the apache website so I want to give them credit. The entire doc can be found here

So for those of you searching for a way to do a get against your webservice. Look no further here it is.....

Test a SOAP Endpoint



Now it's time to test a service. Although SOAP 1.1 uses HTTP POST to submit an XML request to the endpoint, Axis also supports a crude HTTP GET access mechanism, which is useful for testing. First let's retrieve the version of Axis from the version endpoint, calling the getVersion method:



http://localhost:8080/axis/services/Version?method=getVersion


This should return something like:


<?xml version="1.0" encoding="UTF-8" ?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>

<getVersionResponse
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<getVersionReturn
xsi:type="xsd:string">
Apache Axis version: 1.1 Built on Apr 04, 2003 (01:30:37 PST)
</getVersionReturn>
</getVersionResponse>
</soapenv:Body>
</soapenv:Envelope>

The Axis version and build date may of course be different.




Test a JWS Endpoint



Now let's test a JWS web service. Axis' JWS Web Services are java files you save into the Axis webapp anywhere but the WEB-INF tree, giving them the .jws extension. When someone requests the .jws file by giving its URL, it is compiled and executed. The user guide covers JWS pages in detail.


To test the JWS service, we make a request against a built-in example, EchoHeaders.jws (look for this in the axis/ directory).



Point your browser at http://localhost:8080/axis/EchoHeaders.jws?method=list.



This should return an XML listing of your application headers, such as


<?xml version="1.0" encoding="UTF-8" ?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<listResponse
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<listReturn xsi:type="soapenc:Array"
soapenc:arrayType="xsd:string[6]"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<item>accept:image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*</item>

<item>accept-language:en-us</item>
<item>accept-encoding:gzip, deflate</item>
<item>user-agent:Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)</item>
<item>host:localhost:8080</item>

<item>connection:Keep-Alive</item>
</listReturn>
</listResponse>
</soapenv:Body>
</soapenv:Envelope>


Again, the exact return values will be different, and you may need to change URLs to correct any host, port and webapp specifics.

Thursday, May 10, 2007

Today I am working with tomcat trying to create a dao using jndi and then writing a test. For those of you that don't know this Tomcat does not allow access from outside the container to the jndi in the way that JBoss does. In order to do this you will need to use a third party tool like Simple-jndi and can be found at: http://www.osjava.org/simple-jndi/.

Fairly simple to use for the most part add it into your project classpath, and set up your jndi for Tomcat in the way the doc says. http://tomcat.apache.org/tomcat-4.1-doc/jndi-datasource-examples-howto.html To make it work correctly you will need to create a few folders and files. One of which is a jndi.properties file. Add the following into this file.

java.naming.factory.initial=org.osjava.sj.SimpleContextFactory
org.osjava.sj.root=file://config/
org.osjava.sj.delimiter=/
org.osjava.sj.space=java:/comp/env

The last line is very important to keep just like it is. If you get the following error when trying to connect this is probably where your issue is.

java.lang.ClassCastException: org.osjava.sj.memory.MemoryContext
at com.yourcompany.util.ServiceLocator.......

Also I am using eclipse and in the root of my project I created a folder I created a folder structure that looks like this [project root]/config/jdbc/

Within that folder I then place a properties file named [jndiName].properties The jndiName is important because Simple-jndi uses the name to look up the properties file. Also for jdbc structure it is important to have the folder structure setup the way I have shown above to ensure it works correctly.

Have fun and it actually works very slick!

Monday, April 30, 2007

Tomorrow I am speaking at the Dynamic Languages User Group in Omaha Ne. For more information please go to http://www.blainebuxton.com/

The talk went well and you can find the presentation notes here --> http://x-celerator.com

Thursday, March 22, 2007

I ran into a problem debugging some code in a project I recently started on. In the past I guess I had taken this for granted since others set up the projects. This group works a bit differently with tests and projects. They manage all of their testing using Ant. A valid way of doing it just not what I am used to. In the past I had used junit test suites.

Sorry, I am getting away from the reason I am writting this post. I was attempting to debug an issue in the java code on a tomcat server. I had made my socket attach to the tomcat project started up in debug mode. When I started to debug my code would not hit the breakpoints I set. The next problem is when I finally found a spot in the code it did stop in the variables were undefined by name (I could not do an inspect on them). The values did show up in the variables tab in the debugger. However, it did not show the actual variable name, but showed them as an args array.

This is an issue with the build not my ide or tomcat or the way I am attaching to the debugger. To fix the issue I had to change the following line in the build script and add the "vars" argument to the javac task in my ant build.



Now I realize this is probably a rookie move but it was easily over looked and it took me some time to figure it out.

Thursday, March 15, 2007

Ok so it has been a few weeks .... Months since I posted anything.
I have found a couple of things of interest this morning and thought I would share.

One is a resource for publishing for those interested. http://www.authorhouse.com

The other:
I just had to post this I don't think there is a better way of putting this. I was recommended to this blog by my Director. Check out the content there is some very good information out here.

Originally posted at
http://www.agilechronicles.com/blog/2007/03/a_few_good_mana.html

And now I give you......

A Few Good Managers

From the movie A Few Good Men...

Development: "You want answers?"
Marketing: "I think we are entitled to them!"

Development: "You want answers?!"
Marketing: "I want the truth!"

Development: "You can't handle the truth!!!
Son, we live in a world that requires software. And that software must be built by people with elite skills. Who's going to build it? You, Mr. Marketing? You, Mr. Sales? You, Mr. Finance? You, Mr. Human Resources? I don't think so.

We have a greater responsibility than you can possibly fathom. You scoff at our open work areas and you curse our big screen monitors. You have that luxury. You have the luxury of not knowing what we know - that while the cost of delivering software may be excessive, it drives revenue and saves money. And my very existence, while grotesque and incomprehensible to you, drives BUSINESS!

You don't want to know the truth because deep down in places you don't talk about at staff meetings... you want me managing the project. You NEED me managing the project!

We use words like refactoring, test-driven development, continuous integration, sprint, velocity, and release planning. We use these words as the backbone of a life spent delivering something. You use them as a punch line!

I have neither the time nor inclination to explain myself to people who rise and sleep under the very blanket of software I provide and then question the manner in which I provide it. I would rather you just said "thank you" and went on your way. Otherwise I suggest you log in to a computer and write some code. Either way, I don't give a damn what you think you're entitled to!"

Marketing: "Did you cut the automated, edit sync [insert favorite feature here] feature?"
Development: "I did the job I was hired to do."

Marketing: "Did you cut the automated, edit sync feature?"
Development: "I delivered the release on time."

Marketing: "Did you cut the automated, edit sync feature?"
Development: "You're g%$#@*& right I did!"

Friday, February 09, 2007

JAVA DESIGN PATTERNS, Behavioral Patterns - Iterator Pattern

As I have been looking for information on Java patterns I ran accross this site which details them very well.

http://www.allapplabs.com/java_design_patterns

JAVA DESIGN PATTERNS, Behavioral Patterns - Iterator Pattern:

Patterns Creational Patterns:
Factory, Abstract Factory, Singleton, Builder, Prototype,

Structural Patterns:

Adapter, Bridge, Composite, Decorator, Facade, Flyweight, Proxy,

Behavioral Patterns:
Chain of Responsibility, Command, Interpreter, Iterator, Mediator, Momento, Observer,
State, Strategy, Template,
Visitor

There are very comprehensive descriptions and examples of these wonderful code tools.

Tuesday, January 30, 2007

Things are going quite well at the moment.

Today I am working on an applet fix for ie7. What a wonderful advance in ie technology. hahahaha

It looks like Microsoft has been doing their best at plagiarizing everyone who is successful in making applications.

Here are some useful links to sites that helped me out.
the following url would not fit on my blog so it is broke into two lines
http://msdn.microsoft.com/library/default.asp
?url=/workshop/author/dhtml/overview/activating_activex.asp

http://capitalhead.com/articles/activating-activex-controls.aspx

Monday, January 15, 2007

Reference for javascript

http://www.javascriptkit.com/jsref/

Thursday, January 04, 2007

Well my friend Blaine has brought an interesting subject to the table today.
Brownian Motion machine

Here is a sample app you can look at to get an idea of how it works.

http://galileo.phys.virginia.edu/classes/109N/more_stuff/Applets/brownian/applet.html

You can even get the source code.