Dan Murphy

Ranch Hand
+ Follow
since Mar 29, 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 Dan Murphy

John Kimball wrote:You'd still be relying on a Windows (maybe WINE) client.


That's fine, my objective is to be browser-independent, not OS-independent
11 years ago
Hi,

I have a web application that processes events and audio received from a specialised microphone. The audio is processed by a Java applet that runs in the web page, but other events (microphone connected, microphone disconnected, microphone button pressed) are handled by an ActiveX object.

The ActiveX object traps these events and calls JavaScript code to handle them

Of course a problem with this approach is that it's completely IE dependent. I would prefer to load the ActiveX object within the applet, trap the events there and handle the events either within the applet, or JavaScript code called from the applet. This should then enable me to run the app in any browser that supports applets.

I'm not entirely sure how to go about implementing the solution I've proposed above - I guess I'll need some sort of Java-ActiveX bridge? If anyone can suggest how I might implement this, or propose an alternative solution, I'd be very grateful.

Thanks in advance,
Dan
11 years ago
You may want to change the line:

Good understanding of POOP (Principles of Object Oriented Programming)



as some people might dismiss this advertisement as a joke
11 years ago
Message deleted as developer is no longer available
11 years ago
Hi,

What is the best way to convert either a Writer or an OutputStream to either a Reader or an InputStream? Just to be clear, what I`m looking for is the most efficient way to do *any one* of the following (not *all* of them):

- OutputStream => Reader
- OutputStream => InputStream
- Writer => Reader
- Writer => InputStream

Thanks in advance,
Don
12 years ago
Hi,

I have a class that defines the names of various session attributes, e.g.


I would like to use these constants within a JSP to test for the presence of these attributes, something like:



But I can't seem to get the sytax correct. Also, to avoid repeating the rather lengthy tests above in multiple places, I'd like to assign the result to a local (page-scoped) variable, and refer to that instead. I believe I can do this with <c:set>, but again I'm struggling to find the correct syntax.

Cheers,
Dan
12 years ago
JSP
Hi,

I have a URL in which the parameter values are unencoded, e.g.

http://groceryguide.com?gs=Bad Value

I need to change this to:

http://groceryguide.com?gs=Bad%20Value

Notice that I can't simply pass the whole string to URLEncoder.encode() because I only want to encode the parameter values. Is there a library available that can do this for me?

Cheers,
Dan
12 years ago

Originally posted by amit soni:

DO THIS :
--------
int iVariable1=10;
int iVariable1=20;
int iVariable1=30;

select * from person where age in (?,?,?);
ps.setInt(1,iVariable1); //where 'ps' is ref varible of PreparedStatement
ps.setInt(1,iVariable2);
ps.setInt(1,iVariable3);



That won't work because each time I execute the PreparedStatement the list could have a different number of elements, so I can't simply define a '?' parameter for each item in the SQL string.
[ June 27, 2008: Message edited by: Dan Murphy ]
Hi,

I want to use a prepared statement to execute some SQL like



The actual list of ages will vary from one execution to the next, so the SQL string contains a parameter:



However there doesn't appear to be any method defined on PreparedStatement for setting a parameter to a list of values. Although there is a setArray() method, the array in question is of type java.sql.Array, and I've no idea how to create one of these from a "regular" Java array or Collection.

Any suggestions?

Cheers,
Dan
[ June 26, 2008: Message edited by: Dan Murphy ]
Thanks for the suggestions. I should have mentioned that I'm looking for a generified Set that prohibits nulls, so given that extra requirement, the Apache commons implementation is unsuitable.

Cheers,
Dan
12 years ago
Here's a tutorial that should set you on the right path: http://java.sun.com/docs/books/tutorial/2d/printing/index.html
12 years ago
Hi,

I've been looking through the implementations of the Set interface available in JDK 5 and can't find any that prohibits null values. Does such an implementation exist?

Thanks,
Dan
12 years ago
Yes, the correct functioning of my program depends on these codes, whereas the contract of toString() indicates that the value returned by this method is "for a person to read". Therefore it should be possible be to change the value returned by toString() without breaking anything, which is why I prefer to use the value returned by toString() for logging/debugging purposes only.

More specifically, if I were to use the built-in toString() and valueOf() methods, then my program would no longer work after renaming an element from say YAHOO_MESSENGER to YAHOO_MGR.

[ June 12, 2008: Message edited by: Dan Murphy ]
[ June 12, 2008: Message edited by: Dan Murphy ]
12 years ago
Hi,

I have a large number of Enums that implement this interface:



A typical example is:



As you can imagine these methods are virtually identical in all implementations of CodableEnum. I would like to eliminate this duplication, but frankly don't know how. I tried using a class such as the following



But this turns out to be fairly useless because:

1. An enum cannot extend a class
2. Elements of an enum (SKYPE, GOOGLE_TALK, etc.) cannot extend a class
3. I cannot provide a default implementation of getByCode(), because DefaultCodableEnum is not itself an Enum. I tried changing DefaultCodableEnum to extend java.lang.Enum, but this doesn't appear to be allowed.

Any suggestions?
Thanks,
Dan Murphy

[ June 11, 2008: Message edited by: Dan Murphy ]
[ June 11, 2008: Message edited by: Dan Murphy ]
12 years ago
Hi,

I have a generic class, which has a single type parameter, T. Within a method of this class is it possible for me to instantiate a new instance of T (calling the default constructor), without using reflection?

Cheers,
Dan
12 years ago