Dale DeMott

Ranch Hand
+ Follow
since Nov 02, 2000
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 Dale DeMott

Does anyone know of a site or list of sites similar to PluralSite.com? Preferably a site that has training with full videos and content.

Thanks
Once I cleaned it up and got my head around the logic it fell together much nicer. All is working now.

See code in JSFiddle.

http://jsfiddle.net/ddemott/5k396/38/
So with my code I'm looking to take a value out of a checkbox and put it into a text field. The code is in JSFIDDLE. See the link below. I use the latest JQuery as well.

http://jsfiddle.net/ddemott/MUU3z/

The problem I'm having is I can't seem to get the checkbox value go into the input field. It pops up in the alert but won't go into the field. I'm obviously missing something. Here's the code snippet.



Here's the code. As you can see I look to see how many checkboxes were checked. If there was only ONE checkbox checked then I popup up the value in an alert. But when I try to put x into the field of 'returnValue' it doesn't change the input field. If you go to jsfiddle you'll see this code execute when you click a single room.

Below is all of the code (without the script tags)



and the HTML

So here's the deal. I can easily create a zip file using Apache's compression API. That's all good. The problem I'm having is suppressing the directory structure when its zipped. How make a zip file w/the following requirements? Inside the zip I need the file to have no directory structure and only be in a list. The files however need to be zipped from a directory.

Here's a more complete picture of what I'm trying to do. I have the following directory structure and list of files...



after I zip up the files and everything, I get a zip file called



Now when I open the zip I want to only find the files at the root level.



Note that the files are in the base directory. There are lots of examples out there of how to zip up a bunch of files however none of them show me how to suppress the directory structure. Also I don't have the rights to the root directory so I can't simply move the files to the root and re-zip from there. I have to zip them from the directory structure I'm in. One other thing, I've noticed that pkzip has the features to do something like this, unfortunately I can't copy pkzip onto this server. I can only use the standard unix files and public APIs.

Thanks,

Dale

7 years ago
So I'm working to get some JMS code to work locally. Doing a typical message send and message received. My code needs to get the JNDI configured so I can get a look up working. I'm looking to get the JNDI lookup to work however I'm not sure how to setup the JNDI config for MyEclipse and TomCat locally. The exception I'm getting is as follows...

[code]
Exception in thread "main" javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:645)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:325)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at pointToPoint.AsyncReceiver.main(AsyncReceiver.java:22)
[/code]

my code for the listener is as follows..

[code]
import javax.jms.ExceptionListener;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.Queue;
import javax.jms.QueueConnection;
import javax.jms.QueueConnectionFactory;
import javax.jms.QueueReceiver;
import javax.jms.QueueSession;
import javax.jms.Session;
import javax.jms.TextMessage;
import javax.naming.InitialContext;

public class AsyncReceiver implements MessageListener, ExceptionListener {
public static void main(String[] args) throws Exception {
// get the initial context
InitialContext ctx = new InitialContext();

// lookup the queue object
Queue queue = (Queue) ctx.lookup("queue/queue0");

// lookup the queue connection factory
QueueConnectionFactory connFactory = (QueueConnectionFactory) ctx
.lookup("queue/connectionFactory");

// create a queue connection
QueueConnection queueConn = connFactory.createQueueConnection();

// create a queue session
QueueSession queueSession = queueConn.createQueueSession(false,
Session.AUTO_ACKNOWLEDGE);

// create a queue receiver
QueueReceiver queueReceiver = queueSession.createReceiver(queue);

// set an asynchronous message listener
AsyncReceiver asyncReceiver = new AsyncReceiver();
queueReceiver.setMessageListener(asyncReceiver);

// set an asynchronous exception listener on the connection
queueConn.setExceptionListener(asyncReceiver);

// start the connection
queueConn.start();

// wait for messages
System.out.print("waiting for messages");
for (int i = 0; i < 10; i++) {
Thread.sleep(1000);
System.out.print(".");
}

// close the queue connection
queueConn.close();
}

public void onMessage(Message message) {
TextMessage msg = (TextMessage) message;
try {
System.out.println("received: " + msg.getText());
} catch (JMSException ex) {
ex.printStackTrace();
}
}
public void onException(JMSException exception) {
System.err.println("an error occurred: " + exception);
}
}
[/code]

TIA

-Dale
So I'm looking to use the standard MVN command line to create a web project for MyEclipse. I got MyEclipse due to the fact that I love the hot deploy feature. I don't have to keep rebuilding and redeploying in order to see my changes go in. Only problem is that when I use Maven and try to create a web project via the command line, the IDE doesn't recognize the project in the workspace as something I can deploy. I have done the eclipse:eclipse in order to create the '.project. file and have imported it in correctly so its IN MyEclipse however when I click on ADD DEPLOYMENT the IDE does not recognize it as a web project. I'm looking for a solution to this. How do I make it visible to the MyEclipse IDE?

TIA

-Dale
I'm looking to achieve the following task. I need to show several pictures on a site. These pictures will be displayed in rows and columns naturally. This meaning that they should lay from left to right. When the pictures reach the end of the row, they go to the next row. Much like a photo album. That part is easy. Here's the part that gets tricky. Each of these photos need to be able to have another smaller image on top of it when you mouse over it. The picture says Click Me. The idea is that this picture has some type of functionality associtated w/it. What I'm looking to do is lay this whole thing out using CSS. No tables. And also I don't want to change the source of the image on mouseover. If I add photos, I don't want to have to create a 2nd image to mouse over. Also this should be layed out using a css layer and display the 2nd image when its moused over.

Here's what I have...

my css




I've put two of the same picture to see if the images would lay left to right correctly. They just lay on top of each other. I thought absolute would only work w/in the immediate closest div or span tag. When I put absolute in the inner tags to position them, it seems to affect how the outter container is layed out on the page.

TIA
So if this is posted up on a server rather than me running off of my C drive, it should work fine and NOT put up that warning. Correct?
I'm looking to read and write a cookie on my page. Preferably write the cookie on the JSP code and read the cookie on the Servlet to preserve what the preference of the user is. The issue I�m having is this. I need to click on a link and execute some JavaScript in order to write the cookie.

I could do it this way

<a href="http://www.javaranch.com" onklick="alert('here');">test</a>

however when this code executes Internet Explorer ends up warning the user of scripts running. Is there a better way to write this code so this warning doesn�t come up? I�m also looking to have this be �search engine� safe. In other words I want the search engines to still follow the link to the products that are under the link.
So I'm working through a bug and I'm trying to figure out where JavaScript is processed. Is it processed by the client browser or is it processed by the server before it serves it up. The calls that I'm working w/are basically called when the page loads. They are not called by the onLoad function in the body tag.

Second question - Is there a difference between using the onLoad function in the body tag vs. just putting the call in a <script> tag at the bottom of the page and calling it there?
So I'm sifting through some code that I didn't create BUT never the less it might still need to be refactored... Was curious if you saw this as a refactoring and if so then what would you suggest. AND what refactoring smell does it seem like...

I have a couple methods that have very similar signatures. I've created some generic methods because it really doesn't matter what the code is.. just the example matters most. The two methods are as follows...

public void processInvoice(InvoiceData invData)

public void processInvoice(InvoiceData invData, boolean otherParameter)

The first method ends up calling the 2nd with a default value of false... like so...

public void processInvoice(InvoiceData invData){
prcoessInvoice(invData, false);
}

The second method processes the data accordingly but when the conditional data comes up, it checks to see if the boolean is set and processes accordingly� something like this...

...

if (otherParameter!=false){
///do special code...
}

To me this seems like it can be done a better way. Your thoughts...
Sounds OK to me. The question I have is why are you using EJBs? To me I only use EJBs when the need arises. And even then I might not use them if I can find another solution. If you are looking to manage your transactions, you can simply use the JTA (Java Transaction API) to manage them. Is this an internal web app or external? What really pushes the need for using EJBs. Just curious what your argument for using them is.
Some of the settings in MyEclipse are great. I'd have to admit, this is one of my favorite tools to use. I'm by no means an expert in MyEclipse or Eclipse for that matter but I certainly love using it. I'll get to the point, here's the problem I'm having. When I'm coding a standard data bean and I have not put in the getters and setters yet, MyEclipse wants to put in 'final' before my private data. I do NOT want to make it final. How do I turn off this �feature�? Maybe I turned in on by accident, I'm not sure. Could someone show me where this setting is?
Looking over JSTL looks pretty straight forward however I was wondering if there were any good websites out there that anyone could point me to that would make excellent references.
10 years ago
JSP
get posts the data back to the server via the http string and thus can be bookmarked.

get
http://www.mypage.com?parameter=1

post puts the data in the body of the http request and is not visible. The data being posted back to the server can't be bookmarked. also post can store more data while get has a size that is much smaller. each size requirement would be determined by the server.

post
http://www.mypage.com
no data saved in the url string
10 years ago