This week's book giveaway is in the Java in General forum.
We're giving away four copies of Java by Comparison (eBook) and have Simon Harrer, Jörg Lenhard, Linus Dietz on-line!
See this thread for details.
Win a copy of Java by Comparison (eBook) this week in the Java in General forum!

Steve Dyke

Ranch Hand
+ Follow
since Nov 16, 2004
Cows and Likes
Cows
Total received
1
In last 30 days
0
Total given
0
Likes
Total received
7
Received in last 30 days
1
Total given
11
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Steve Dyke

I have a date(string) in the form of 4/6/2018 I need to change it to 040618.

this code does not do what I was hoping for:



Output is: Tue Jan 18 00:20:00 CST 5
1 week ago
I was able to make it work by placing an "/" at the end of the 'from' and 'to' paths.
2 weeks ago
The follow code only copies the directories but not the directory content.



Example of console output:

[4/3/18 7:09:47:548 CDT] 00000085 SystemOut     O SupplierDrawingList: file://gvsvr03/Drawings/Release PDF/VendorPrintsSpecsTestReports/AMSAFE/HISTORY/1027
[4/3/18 7:09:47:548 CDT] 00000085 SystemOut     O SupplierDrawingList: smb://corp.zodiac.lan;srv.drawchg6zsus:Webabc6!@sgai-fs02/qmsattachments$/SupplierDocuments/AM-SAFE INC/HISTORY/1027
2 weeks ago

Dave Tolls wrote:Well (and I missed this earlier), line 6 is only printing out smbToFile, and not smbFile.
So each time round the loop, for each file in the directory, it is simply printing the directory (smbToFile) name and not the file in the directory (smbFile).



Thanks so much for pointing this out. This solved my issue, for now anyway(lol).
4 weeks ago

Prasad Saya wrote:Could you give some example data for the following code:



There are 368 sub directories in the parent folder do I get 368 of the following:

[3/22/18 10:11:02:136 CDT] 0000009d SystemOut     O SupplierDrawingList: drawings_PATH: file://gvsvr03/Drawings/Release PDF/VendorPrintsSpecsTestReports/
[3/22/18 10:11:02:363 CDT] 0000009d SystemOut     O SupplierDrawingList: Directory Name: VendorPrintsSpecsTestReports/
[3/22/18 10:11:02:364 CDT] 0000009d SystemOut     O SupplierDrawingList: Directory Name: VendorPrintsSpecsTestReports/
[3/22/18 10:11:02:364 CDT] 0000009d SystemOut     O SupplierDrawingList: Directory Name: VendorPrintsSpecsTestReports/
[3 ....

For example, if you have System.out.println(smbToFile) what does it print? If smbFile is a directory with some files/directories in it what gets printed on lines 6, 10 in the above code.

4 weeks ago
The following will only display the coded directory and not the sub directories.

4 weeks ago

Bear Bibeault wrote:And this folder is at the root of the web app?



It is in the WebContent folder of my project. I have tried to place it out side of this folder and then not even the dialog screen will appear.

Bear Bibeault wrote:Does that file, indeed, exist in your web app?



Thanks for your response. Yes it is in the file structure of the JavaScriptSpellCheck folder.
In my web app I need to use a spell checker on a jqGrid input prompt(before the Submit fires).

I have downloaded the JavaScriptSpellCheck files. Copied unzipped folder into the WebContent folder of my web app.

Added the following into the index.jsp:


Added this code in the beforeSubmit function of my jsp file:



When I run the code the SpellCheck dialog box pops up with no words included and the following error appears in console.

java.io.FileNotFoundException: /JavaScriptSpellCheck/core/Default.ashx

Carey Brown wrote:I was taking your original post literally; you were given a String and wanted to generate an optimized String. So this is the framework I came up with. To hold a range of int's you need to track a min and a max and when you go to output the optimized string, if min == max, just output min, else output min-max.



Thanks for all the help.

Here is the code I came up with:



This is my output:

InvoiceSerialNumberData: S/N: 012434073-012434080,012434082-012434083,012434085
InvoiceSerialNumberData: S/N: 012434086-012434095
InvoiceSerialNumberData: S/N: 012434097
InvoiceSerialNumberData: S/N: 012434098-012434099
InvoiceSerialNumberData: S/N: 012434102-012434103
InvoiceSerialNumberData: S/N: 012434104-012434106
InvoiceSerialNumberData: S/N: 012434108
InvoiceSerialNumberData: S/N: 012434109
2 months ago

Carey Brown wrote:Do you expect that the parent string will also include xxx-yyy blocks?



No, the parent is a list of individual Serial#'s.

This is my code for getting the Serial#'s, my code so far:


2 months ago

Carey Brown wrote:What are the "rules" for translating one string to another?



If the next Serial# is not sequential then use comma as separator and start new block(123-124)
2 months ago
I have a need to create sub strings from a main string.

Am looking for ideas and or direction. These are Serial#'s that will go on a report.

The parent string:
012434073,012434074,012434075,012434078,012434079,012434081,012434082,012434083,012434084,012434085,012434086

What I need is to change this to:
012434073-012434075,012434078-012434079,012434081-012434086

Thanks for any help.
2 months ago

Dave Tolls wrote:Can you see the host name in the headers for the request?
If not then it isn't available.
I don't think there's any requirement at all to send it.



How can I view the header content?
Is there a reliable way to get the computer name of the client when a request is made using a web application.

The following always returns the IP address and not the name.