Ron McLeod

Marshal
+ Follow

Recent posts by Ron McLeod

Unrelated to the DB question - but if you need a solid tool to verify/refresh/repair media on spinning and solid-state drives, I recommend SpinRite from Gibson Research Corporation.  I have been using it for over 20 years in a commercial IT environment and it has repeatedly saved our butts.

It is not freeware.  The cost is around $90USD, and if used in a commercial or enterprise environment, the author suggests that you buy 5 copies.
If you need a SQL database then Derby or SQLite are probably good choices.  SQLite only runs as embedded (not client-server), and Derby has a driver which allows it to run as embedded.

But since it sounds like your application with be single-user with no concurrency, maybe a key-value store type solution using Java Collections which gets serialized to/from the file system (using JSON/YAML/etc) might be good enough.  It really depends what you are going to be doing with the data, how frequently it changes, how much time you can bear to serialize/deserialize during startup/shutdown, whether the data need to be flushed to the file  system on change and/or periodically, how often the application would be restarted, etc.
Right.  The example that I provided only has one class which could be used to show either evens or odds, depending on what was specified when the instance was created.
2 days ago
Would something like this do what you are wanting?:
2 days ago
The link on Scott's website is for Singapore (not sure why).

For Canada, use this link:
     https://www.wiley.com/en-ca/OCP+Oracle+Certified+Professional+Java+SE+21+Developer+Study+Guide-p-9781394286614

At check-out, the country will be set to Canada:

Swapnil Mishra wrote:I want to concurrently add and remove elements to a TreeSet..


Are you modifying the collection concurrently using multiple threads, or trying to make changes while iterating through the elements?
2 weeks ago
I looked at this a bit more, and found that there are two ways (maybe more) to resolve the host key issue.

Both require that you get the ssh key for the host - for example:
Method 1:
   - Add the key information to your local host's known_hosts file
   - tell Jsch the location of the file:

Method 2:
   - add the key information at on the fly:

I hope this helps.
I haven't spent too long looking at this, but it seems like the problem is that Jsch is not able to find the host key in its repository.

For testing, you can bypass this check, by setting StrictHostKeyChecking to no (probably not a good idea when running in an production environment).

It gave it a quick try, and was able to establish a connection and perform an ls on the remote host:
Here's an alternative using NIO and Streams:
Output from the example file would look like this:
CSV file opened in Excel:
3 weeks ago
The content that you posted looks it has already been processed through something similar to the code you are working with (not only replacing white space with a comma, but also removing ¦ characters).  

Isn't this (below) the type of report that comes from the instrument?  If it is, then I don't think that the code is going to do what you are wanting.

-------------------------------------------------------------------------------------
Leica Geosystems AG --- Digital Level Measurement Report
-------------------------------------------------------------------------------------

-------------------------------------------------------------------------------------
Job name   : 0226ED          
-------------------------------------------------------------------------------------
Operator   : --------        
DNA03      : Instr.Nr.: 343161    
Remarks    : --------         / --------        
Date/Time  : 26.02.2019       /  6:13:39
-------------------------------------------------------------------------------------

-------------------------------------------------------------------------------------
Line Levelling
-------------------------------------------------------------------------------------

Line  : LINE00001        Method: BF        
=====================================================================================
Date  : 26.02.2019       Time  : 06:18:49
Staff1: --------         Staff2: --------        
=====================================================================================
¦     PointID    ¦Backsight ¦  Intmdt  ¦Foresight ¦ delta H  ¦ Distance ¦ Pt Height ¦
-------------------------------------------------------------------------------------
¦Start PtID      ¦          ¦          ¦          ¦          ¦          ¦           ¦
¦B26             ¦          ¦          ¦          ¦          ¦          ¦   582.7263¦
¦                ¦          ¦          ¦          ¦          ¦          ¦           ¦
¦B26             ¦   5.84220¦          ¦          ¦          ¦    124.24¦           ¦
¦1               ¦          ¦          ¦   3.45202¦  +2.39019¦    123.91¦   585.1165¦
¦1               ¦   5.99359¦          ¦          ¦          ¦     73.47¦           ¦
¦M2              ¦          ¦          ¦   2.41742¦  +3.57617¦    120.08¦   588.6927¦
¦M2              ¦   4.43532¦          ¦          ¦          ¦     44.83¦           ¦
¦              P1¦          ¦   3.82759¦          ¦  +0.60773¦     77.07¦   589.3004¦
¦              M1¦          ¦   2.43419¦          ¦  +2.00113¦    129.85¦   590.6938¦
¦2               ¦          ¦          ¦   4.18279¦  +0.25254¦    126.56¦   588.9452¦
¦2               ¦   6.29322¦          ¦          ¦          ¦     30.13¦           ¦
¦              M3¦          ¦   3.73870¦          ¦  +2.55452¦     39.23¦   591.4997¦
¦3               ¦          ¦          ¦   1.07662¦  +5.21660¦     64.17¦   594.1618¦
¦3               ¦   5.33935¦          ¦          ¦          ¦     34.29¦           ¦
¦              P2¦          ¦   2.82358¦          ¦  +2.51577¦     59.53¦   596.6776¦
¦4               ¦          ¦          ¦   2.07683¦  +3.26252¦     58.24¦   597.4243¦
¦4               ¦   6.33206¦          ¦          ¦          ¦     39.11¦           ¦
¦5               ¦          ¦          ¦   1.28898¦  +5.04308¦     68.21¦   602.4674¦
¦5               ¦   5.60334¦          ¦          ¦          ¦     32.78¦           ¦
¦              P3¦          ¦   2.10250¦          ¦  +3.50084¦     63.91¦   605.9682¦
¦6               ¦          ¦          ¦   1.64382¦  +3.95952¦     65.29¦   606.4269¦
¦6               ¦   5.83322¦          ¦          ¦          ¦     39.46¦           ¦
¦              M6¦          ¦   2.83305¦          ¦  +3.00017¦     44.78¦   609.4271¦
¦7               ¦          ¦          ¦   0.98366¦  +4.84957¦     55.94¦   611.2765¦
¦7               ¦   5.14413¦          ¦          ¦          ¦     34.30¦           ¦
¦8               ¦          ¦          ¦   2.47878¦  +2.66535¦     41.84¦   613.9418¦
¦8               ¦   6.23389¦          ¦          ¦          ¦    112.76¦           ¦
¦B30             ¦          ¦          ¦   3.20561¦  +3.02828¦    105.65¦   616.9701¦


Example report downloaded from RPLS.com
3 weeks ago
What error messages are you seeing?

I tried what I believe is your code after your changes, and it compiled clean.

I ran it with D:\M_SOUTH ECON.asc containing this:
and got output to D:\M_SOUTH ECON OUT.txt containing this:
3 weeks ago

Jiri Nejedly wrote:


It looks like the (20) in the exception is the last command received (see source below).  According to rfc4253, message #20 is SSH_MSG_KEXINIT; used during the SSH protocol key exchange process (and unexpected in this case).
com.jcraft.jsch.UserAuthNone       Copyright (c) 2002-2018 ymnk, JCraft,Inc. All rights reserved.
3 weeks ago
I'm guessing that client and server sides have negotiated to use an authentication scheme other than username/password.

Looking at the source, Jsh is using these schemes by default:
config.put("PreferredAuthentications",
   Util.getSystemProperty("jsch.preferred_authentications",
       "gssapi-with-mic,publickey,keyboard-interactive,password")
);


Try specifying password authentication with:
session.setConfig("PreferredAuthentications", "password");

Also, the second parameter in Session#getSession() is hostname, but your variable named is url.  Make sure this just contains just the hostname part (fqdn or IP address).

The source code for 0.1.72 can be found here: jsch-0.1.72
3 weeks ago
Please post the stack trace for the exception, and which version you were using.
3 weeks ago
Since you don't use the index for anything else, you could simplify the code a bit by using an enhanced for loop:
1 month ago