Mike Rainville

Ranch Hand
+ Follow
since May 29, 2004
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
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 Mike Rainville

Just did a quick search and this came up first…
https://objectcomputing.com/resources/publications/sett/january-2008-writing-music-in-java-two-approaches

I haven’t tried it, but the article may help you find other search terms.
2 years ago
Is this what you had in mind? The first thing I tried (varying the target object), but it never did exactly what the manual keystrokes did. Essentially, it was always as though I had never used the Control+SPACE at all, though you could see it happening, it had no effect in the end; in some cases the GUI became unstable, or looping rapidly between two states "fibrillation!"


12 years ago
On Windows XP SP 3, in a Swing database application (Eclipselink 2., Oracle jdbc) I call a method that creates a thread at the end of my populateAll() method to hold down the Control key and tap the SPACE BAR twice. This fires the "toggleAndAnchor" of a single column JTable containing a list of names, to repeat the JPA queries that loaded all the tables linked to the names. From a JPA perspective, it's unpredictable how many of the 16 tables will load as each name is selected (the real problem), but pressing control space first to deselect a row, and again to reselect it populates ALL the tables as expected(by rerunning all the queries again, no cache). The JTables populated, one after the other, are made from JPA TypedQuery List<E> results mapped to a JTable using BeansBinding 1.2.1 - They are in JXTaskPanes within JXTaskPaneContainers, and sometimes JSplitPanes.

e.g. See a simple example here:
Beans Binding Via The Road Less Travelled By (Part 1)
By Geertjan on Feb 11, 2008

http://blogs.oracle.com/geertjan/entry/beans_binding_via_the_road

except that BindingGroup is not used (provided byJTableBinding) and my JTables are reused (by unbind()), change the List, then bind()



For now I just want to get this workaround stable enough for a production application. So far, it works, but (1) seriously degrades performance (2) prevents scrolling backward through the name list, and (3) lingers after the application has closed (as though the same keystrokes were being applied to everything in Windows afterwards). Here's the code for the workaround:




Am I missing any shutdown needed by Robot? Is there a bug that leaves events in a Windows queue that should be removed?
Any suggestions welcome.

On the JPA side, has anyone had a problem of too many tables to load at once?
12 years ago

Vaibhav Goel wrote:Hello Mike,

Great!!!
It works fine now. But please tell me two things.
1) Why it does not read space as other paths also contain space?
2) If there was a small space problem, then how come it executes java command?

Thanks,
Vaibhav Goel



1) On Windows XP or OS X, I have never even considered using any blanks, except in a quoted file name; I have no idea why they might work in some cases but not others.
2) You may have had a JRE installed before... (Check the Control Panel for the currently installed versions of Java.)

I'm happy it's working for you now.
13 years ago

Vaibhav Goel wrote:JAVA_HOME = C:\Program Files\Java\jdk1.6.0_23
Path = %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem; C:\Program Files\Windows Imaging\;_%JAVA_HOME%\bin

Regards,
Vaibhav Goel



If there's a space before %JAVA in your path variable, please try removing it. (At the position of the bold underscore above.)
13 years ago
Hi Gil,

The same patterns, as above, a label over a text field, or in other cases, two related text fields and a button, repeat frequently. It's mainly about reducing the number of individual components, by dealing with them at higher levels of abstraction,and encapsulating the interactions that repeat throughout the application.

It's also possible that I could use Tables (JTable, JXTable) to deal with entire database tables, or filtered results, as a single component.

As the first response shows, Swing deals with each item separately, which tends to multiply the number of components rapidly.

Is there a "best" approach for combining standard components so they act as one for most purposes?
15 years ago
If I have common patterns of fields in a Swing application GUI (JFrame),
what's the best approach for combining them into classes? (Links to articles or tutorials re welcome.) The goal is to reduce component count.


e.g. "Full Name " // JLabel
["John Doe" ] // JTextField


[ August 04, 2008: Message edited by: Mike Rainville ]
15 years ago
The more I look at it , the answer is yes...

There appear to be many ways,
of which this would be about what I was looking for
Groovlets (httpServer + Tomcat), and I could even use JSF and EclipseLink JPA, if I wanted.

Over the long haul, I see the JVM on the web server running legacy PHP and Groovy web applications, side by side.

I promise to study Grails, but 2nd edition definitive book won't be out for a while.

Thanks for all the tips, and I'll keep watching.
(Trying to get the JPA example working with EclipseLink soon ...

Mike

p.s. Thank God, and his creatures , for Groovy
[ July 30, 2008: Message edited by: Mike Rainville ]
15 years ago
I really like JRuby, but I will have to use something more familiar: if Groovy can't work, I will probably have to use an applet and require Java 6 update 10.

I looked at Rails briefly; Grails will be next, but that's totally new. They both require an application server, to the best of my knowledge, though. I might be able to justify Tomcat on the web server, if need be. Java EE has been denied me.

Think of the SwingSet2 applet, but built with Groovy's XMLBuilder as an XHTML page.

Many of the Oracle Forms 6i(client) pages are simple database CRUD, with the occasional dropdown, though the biggest has 14 panels, dialogues, and components: e.g. date with date picker, date interval, and a few other patterns, so components or templates are necessary.

I am trying to produce the equivalent of an XHTML Facelets Java EE application using Groovy and Java SE with EclipseLink JPA and Oracle 11g R1 thing JDBC client, with the Java SE and Groovy installed on an httpServer, and the application in a web browser, like Firefox 3 or Safari.

There are tens of users at most...
[ July 28, 2008: Message edited by: Mike Rainville ]
15 years ago
To clarify: there are many independent applications, some entirely PHP and some Forms 6i. When complete all they will run on the same web server, but independently of each other. They might be started from the same HTML or XHTML page.

I am trying to find a way to script web applications similar to the PHP style, using perhaps MarkupBuilder and EclipseLink, i.e. client server web applications running on J2SE on the web server.

It's a fight to the death for Groovy vs PHP, on PHP's home turf!
[ July 28, 2008: Message edited by: Mike Rainville ]
15 years ago
The key issue is perceived development speed PHP vs Java EE, JSF and/or facelets. Java applet, Groovy, and PHP are the available alternatives.

Adequate PHP experience and manpower are available, but I would prefer to use my years of Java, Swing, JDBC, SQL, and JPA in Groovy, if possible, because it is clearly more readable, and supported by the full power of Java.

I use Eclipse 3.4 and NetBeans 6.1. I have been working intensely with Java for 5 years, and I have programmed in many more languages before that. I am using JPA 1.0 with Java JDK 1.6.0_07 now, for other things.

The PHP and Groovy applications would be independent of each other,
but would they be able to share the same web (http) server, with Java SE 5 or 6, but NO Java application server. The database is Oracle 10g or 11g.


Is it reasonable to consider using EclipseLink 1.0 just released with Groovy? Has anyone tried to make these work together yet?
15 years ago
Can I use Groovy to build hopefully better web applications that run in the same environment with PHP web applications (on an Apache web server with Java SE installed). Would they conflict in any way? Is Groovy stable enough to compete?

I am being asked to abandon Java EE efforts as too costly to develop (Facelets and JPA); the prevailing wisdom is that PHP would be faster to develop, though, in the end harder to maintain.

Would it be possible to use Groovy with EclipseLink for complex database applications?

Thanks for any insight. Web page suggestions are welcome, just point me in the right direction.
So far I found this excellent link:
"Curious Creature" 2007/03/25 Persistence Made Easy with Groovy and JPA
15 years ago
In my program, I solved the ORA-01000 "Too many cursors open" problem by remembering the prepared statements and result sets, and closing them after I was sure they were no longer needed. This was not a new problem. It happened using ojdbc14.jar with Java 5 and 6. I am now using JDK 6 update 6 (latest) with ojdbc6,jar on Oracle 10g R3.

Even though PreparedStatement may close when re-executed, I still had the problem, with at least
16 open cursors, and if there were uncommitted updates, there could have been be many more, and with other background activity on the database... (ours has max cursors set to 300)

I had many result sets that I could not close before they went out of scope. They were wrapped in table models and were frequently being replaced with a new result set. I had queries and updates, both using PreparedStatement's.

The solution was to save a reference to each statement or result set as it was created, in a Queue of mathcing type(ResultSet or PreparedStatement), and to iterate through the saved references, closing each one in turn. That appears to have eliminated the problem, and also improved performance.

For the update statements, I process the PreparedStatements queue, closing each one in turn immediately after commit. For the queries it's done just before I replace all 16 result sets. I used Doug Lea's thread safe Queue in my Swing application.
[ April 27, 2008: Message edited by: Mike Rainville ]
You would want to use connection pooling, where sessions are recycled;
see import oracle.jdbc.pool.OracleDataSource

Mike
There are two types for the generic MAP, one for the key and one for the contents, so your declaration should show both types. If you want to keep the same code, you need to cast to the type of the stored value after getValue( key ). Try this


[ November 13, 2005: Message edited by: Mike Rainville ]
18 years ago