todd runstein

Ranch Hand
+ Follow
since Feb 15, 2005
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by todd runstein

Migrate4j is a migration tool for java, similar to Ruby's db:migrate task. Unlike other Java based migration tools, database schema changes are defined in Java, not SQL. This means your migrations can be applied to different database engines without worrying about whether your DDL statements will still work.

This version adds improved usability (simplified syntax), additional schema changes and support for more database products. While migrate4j does not yet have support for all database products, we are actively seeking developers interested in helping fix this situation.

Visit http://migrate4j.sourceforge.net for more information on how migrate4j can simplify synchronizing your databases. To obtain migrate4j, go to http://sourceforge.net/projects/migrate4j and download the latest release. For questions or to help with future development of migrate4j, email us at migrate4j-users AT lists.sourceforge.net (replacing the AT with the "at symbol").
10 years ago
Thanks,

I looked at using Field.getGenericType().toString(), but because I need the java.lang.Number class, that didn't get me very far. I couldn't see a convenient (or reliable) way of getting the correct class from the getGenericType().toString() output.

Todd
10 years ago
I'm using reflection to inspect a collection and want to get the Class of the objects that can be put inside of it. Is this seriously the only way to get the class:

(Class)((ParameterizedType)field.getGenericType()).getActualTypeArguments()[0]
10 years ago
I solved it. I had 2 properties files: Text_Labels.properties and Text_Labels_fr_CA.properties. Simply adding a file named Text_Labels_en.properties (which matches Text_Labels.properties) fixes the problem!
10 years ago
Not sure what I'm doing wrong - this seems very straightforward. I have simple internationalization code and I'm trying to override the Locale being used. However, using the PropertyResourceBundle.getBundle(String, Locale), the Locale seems to be ignored.

Here's the test class:


Here's the TextLabel class:


Pretty straightforward. However, the output generated is:
Locale = en_US
Bundle using
Locale = en_US
Bundle using
Locale = en_US
Bundle using fr_CA

I would expect the last one to say "Bundle using en_US". I'm running the test inside Eclipse 3.3.0 using Sun's 1.5.0.13 JVM. Any ideas why the Locale is being ignored?

Thanks in advance!
10 years ago
Not sure what happened - reinstalled Tomcat and now it's looking good. Sorry for the false alarm.
10 years ago
I'm trying to deploy an application as the default application. I'm able to do this by naming my war ROOT.war and copying it the webapps directory. Unfortunately, this makes the admin and manager apps disappear. I'm able to reinstall the admin application (by downloading it from the Apache site) but haven't figured out how to get the Manager app to continue working.

Any suggestions?
10 years ago
Last night we upgraded our JVM from 1.4 to 1.5. After the upgrade, the
server still works, however we're getting an exception thrown repeatedly:

- Error unregistering mbean
javax.management.RuntimeOperationsException: Object name cannot be null
at
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.isRegistered(
DefaultMBeanServerInterceptor.java:545)
at com.sun.jmx.mbeanserver.JmxMBeanServer.isRegistered(
JmxMBeanServer.java:619)
at org.apache.commons.modeler.Registry.unregisterComponent(
Registry.java:642)
at org.apache.jk.common.ChannelSocket.processConnection(
ChannelSocket.java:706)
at org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java
:866)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(
ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.IllegalArgumentException: Object name cannot be null
... 7 more

We're running Tomcat 5.0, Apache 2.0 with jk_mod against a sybase db. The
only change was the JVM and our webapp compiled in 1.5. Any ideas where to
start looking???

Todd
11 years ago
Any chance you can provide a bit more info?

Message queues are really good for exchanging messages. Databases are really good at storing and retrieving data. ;)
Is your database configured for UTF-8? Some databases use non-Unicode by default (for example, MySql before version 4.1).
11 years ago
Muni,

There are only a few patterns where doing dynamic loading would be your first choice. If you know what class you want to use, call one of it's constructors with "new".

However, if you don't know what class you're going to be using, you could do dynamic loading. For example, maybe you have a "RuleSet" interface. Perhaps you have several classes that implement this and you routinely add more. Perhaps you want to store information in a database (maybe about a Procedure, ManufacturingStep, etc) - you can store the fully qualified classname of the RuleSet that belongs to this record and load the class dynamically using this value. There are, of course, other ways to solve this problem, and other problems that lend themselves to dynamic class loading.

Hopefully that gives you a better idea of where and when you'd use dynamic loading. Assuming you're going through this for learning, here's an idea of how you could use dynamic classloading to call an "apply" method (totally off the top of my head - untested):

-- File rule/set/RuleSet.java


-- File rule/set/BasicRuleSet.java


-- In some other class


Hope that helps!
11 years ago
Perhaps I'm missing something here . . . could you just create a static method that takes two String objects, tries to convert them to dates, and returns the difference (in milliseconds, or whatever you want). That way you don't have to change the rest of your application, but you can do the comparison.

Again, I may be missing something. It seems that my answer is pretty simplistic, so perhaps there more to the problem than I'm reading in your post.
12 years ago
Looks like you don't have the proper permissions set up. What account are you using to connect? Does that account have permissions to the DB? Are you using the correct password?
So, for game 3, would something like this work?

select player_id, max(points) as points
from result where game_id = 3
group by player_id
order by points;

My "order by" statement may not work in your db as is, but does the general idea work? This will list all the players who played game 3, and put them
in order from most points to least. Is that closer to what you're looking for?
While it requires a bit of investment (to learn), the motivation is that you will end up using it again and again. It will allow doing the XML config file for this task, and if you wanted, it could be used to do the Java install (no more bat/zip file - it's all in a professional and easy to use .exe setup file). If you plan on doing other windoze installers in the future, NSIS will be able to handle that too. If you're looking to solve just this problem, there are other options - if you want a tool that will solve this, and any other installer situation (as long as it's targetted for win), NSIS is well worth trying.
12 years ago