Win a copy of Java by Comparison (eBook) this week in the Java in General forum!

Jack Bush

Ranch Hand
+ Follow
since Oct 20, 2006
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
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Jack Bush

Dear JPA Specialists,

I need your advice on getting a OneToMany (Employee to Photo) relational mapping using @ElementCollection & @CollectionTable in JPA 2.0. Below is a hypothetical code snippet that I am trying to get all the Photo records persisted without success:



However, only the last photo (afterWorkPhoto) object has been persisted to the Employee entity instead of all 3 photos. I also want the option of going back to add more new (unique) photos for the same employee in the future.

I am running Eclipselink 2.4.1 (JPA 2.0), Java 7 on Windows XP & 7.

Your advice would be much appreciated.

Thanks in advance,

Jack
Hi Joanne,

Thanks for pointing this out and the corrected code snippet below is working properly now:


Thanks,

Jack
5 years ago
Hi Java Experts,

I need to concatenate a string variable to form a full path of a new file to be referenced by later reads but failed to form the complete path due to multiple words with space in the string variable. Below is the code snippet which the full path has failed to materialize:



As a result, could someone advice me on how to concatenate multiple strings where the variable string such as country is made up of more than one word separated by space. It is necessary to use double quotes in general to surround them such as the following example so the operating system knows how to put the full path together:

“C:\United States of America\sports.txt”

I am running JDK 7 on Windows XP & 7 platform.

Your assistance would be much appreciated.

Thanks,

Jack
5 years ago
Hi Robert,

You are absolutely right again. I have over iterated (for loop) the date string format matching without breaking out from it. Below is the correct working code snippet:



I am crystal cleared again on how this simple piece of code works. Apologies for missed spelling John Jai's name.

Thanks again,

Jack
5 years ago
Hi All,

The suggestion by Jon Thai & Rob Spoor does not work when the date of the month is more than 1 digit. For instance where the string date is "22nd December 2011". Below is an enhancement intended to overcome this limitation but failed to work:


The value of publishedDate is null as opposed to 22-12-2911.

Any idea on where the problem is coming from? I am not clear on how line 2 - 7 work.

Thanks,

Jack
5 years ago
Hi Pat,

I can't see anywhere in the program that has implemented the proxy support code in this application. Can you provide or refer to examples of how it is done?

Thanks again,

Jack
Dear Java Experts,

I am trying to apply the same proxy server settings on both Internet Explorer 8.0 & Mozilla Firefox 17.0.1 in Java but not sure how some of them are done such as in the following examples:

Internet Explorer
( i ) Proxy server => Use a proxy server for your LAN (These settings will not apply to dial-up or VPN connections) - checked
=>Bypass proxy server for local addresses – checked
( ii ) => Advanced => Proxy Settings => HTTP: Proxy address to use -127.0.0.1, Port – 8555
( iii ) => Exceptions, Do not use proxy server for addresses beginning with:127.0.0.1;localhost;10.*;192.168.*;127.0.0.1:895;127.0.0.1:896


Mozilla Firefox

( a ) Manual proxy configuration:
HTTP Proxy: 127.0.0.1, Port: 8555
( b ) No Proxy for: localhost, 127.0.0.1

Below is a general working code snippet for setting simple proxy server:



What are the remaining systems properties require to include all remaining browser configured proxy server settings into this Java program?

This is a Java jdk1.7.0_11 on Windows XP & 7 environment.

Your assistance would be much appreciated.

Thanks,

Jack
Thanks Jeff for your clarification, I recognise the differences between FTP URL and HTTP URL and have tried converting the existing HTTP URL http://images.abc.com/img/2012102/15509/2010035044_1_PM.JPG
to ftp://images.abc.com/img/2012102/15509/2010035044_1_PM.JPG in order to download it using FTP but failed to find it. My challenge is either to convert the existing HTTP URL to FTP one, or to
use the right download tool / libraries that could take the HTTP URL. Also not sure how to handle a download failure either. Looks like there are a lot of missing puzzles that needs to be
enlightened on since I am new to download in Java, a little example or reference material goes a long way.

Your patience is very much appreciated.

Many thanks,

Jack
5 years ago
Thank you K. Tsang for your suggestion but need your clarification on whether JSCH FTP can access files via URL HTTP protocol. My experience with FTP in
general is that it requires user authentication compared to URLConnection / ImageIO.

It would be excellent if you could provide / refer to an example which uses JSCH to download URL document.

My Google searches on JSCH have not found sufficient example on how it is use in this context. On the other hand, there are plenty of CURL / libCurl, JavacURL
material but not sure which is a better tool to use.

I am only interested in downloading a few advertisement images (small size JPEG) but needs to validate their existence other additional related files not published,
to avoid bringing down the primary Java application altogether.

Thanks again,

Jack
5 years ago
Dear Java Experts,

I am looking for a way to check for the existence of an image file that reside on the remote webserver. Below is the Java statements that has successfully downloaded
http://images.abc.com/img/2012102/15509/2010035044_1_PM.JPG to my local Windows 7 PC:


However, there are additional images under the same URI available but require checking for their existence prior to downloading them. For instance,

As a result, is it possible to use URLConnection.getContentLength() or other approach to determine its connection status / existence to avoid getting an
IOException in the event that say http://images.abc.com/img/2012102/15509/2010035044_5_PM.JPG does not exist? There may be other ways to achieve the same
objective that I haven't thought of.

Thanks a lot,

Jack
5 years ago
Hi Bear Bibeault & Bill Gorder,

I have found another consultant who is familiar with this technologies to resolve this issue for us.

Thanks for all your help anyhow,

Jack
5 years ago
Hi Bear,

Below is a working pure XHTML page that successfully:



However, the URL redirection failed when placed this file (about.htm) in $HOME/tomcatProd/webapps/reporting-school/WEB-INF/jsps because this Spring application is looking for about.jsp instead of about.htm. As a result, would you know which configuration / property file to change the lookup file name if possible?

Thanks a lot again,

Jack
5 years ago
Hi Bear,

I have no idea what library but isn’t Spring the framework? This application was delivered to us by external developers who are no longer contactable.

Do you have any suggestion on how to redirect a menu called “About us” on the application to an external “About us” page? The content of target about.jsp is incorrect according to your observation. Would a simple HTML redirect URL command be able to achieve this?

Hope this help. I am just as lost due to my limited understanding of how the application was developed.

Thanks again,

Jack
5 years ago
Hi JSP Specialists,

I would like to redirect a menu on web page such as the About menu which essentially points to http://abc.com/reporting-school/about.

The content of $HOME/tomcatProd/webapps/reporting-school/WEB-INF/jsps/about.jsp is as follows:



However, I would like to redirect this About menu to another external website such as http://hobbies.com/about instead but has failed to do so with
the following example:



I am not familiar with JSP or the Apache Tomcat Spring, Solaris 10 development platform, where this application has been developed.

Any assistance would be much appreciated.

Thanks,

jack
5 years ago