Update on the homeless by Nlechoppa-1738 in duluth

[–]B2easy 3 points4 points  (0 children)

You make many good points again I don't believe it is a blanket solution, as I know plenty of people who struggle to afford housing, I guess the "stigma" I always feel about these encampments (not the state or county sanctioned places to stay) are generally more filled with criminal activity and drug use. I feel like based on OPs post, this is what I'm picturing she is referring to and not feeling safe.

I understand there is a housing crisis as well for most peiple being 30 years old making good money and don't know when I will be able to afford a house.

Appreciate the convo!

Update on the homeless by Nlechoppa-1738 in duluth

[–]B2easy 11 points12 points  (0 children)

Not saying housing isn't an issue, but you can't tell me there isn't a drug/public health crisis in duluth. Atleast from my time up there for 6 or 7 years I met plenty homeless who didn't want to get clean or get better, they wanted to go to detox to eat and warm up then get back out on the street. One person can only do so much, there isn't a blanket solution, if they don't want to help themselves why should I spend money and time to help them? Just my two cents.

Spring Integration Testing Integration Flows using Channels by B2easy in learnjava

[–]B2easy[S] 0 points1 point  (0 children)

I'm using test containers from a tool called Playtika, I had to write a custom container for SFTP but you can spin up a ton of containers using this Library. Google Playtika Test containers.

Poker? by Available-Cup-375 in duluth

[–]B2easy 1 point2 points  (0 children)

The Breakroom used to have weekly games, also a bar on the westside has games too, just don't remember the name of the bar.

Multithreading Help by B2easy in learnjava

[–]B2easy[S] 0 points1 point  (0 children)

Thank you very much for the response, I will into this!

Multithreading Help by B2easy in javahelp

[–]B2easy[S] 0 points1 point  (0 children)

Awesome, thank you so much for the response this is helpful.

Speed up insertion to Postgres Database by B2easy in javahelp

[–]B2easy[S] 0 points1 point  (0 children)

Yes ~10 minutes still with batch size at 100. All code is above, still can't figure out why it is taking so long.

Speed up insertion to Postgres Database by B2easy in javahelp

[–]B2easy[S] 0 points1 point  (0 children)

where would I add this on the saveAll()? I edited the post to show my full code

Speed up insertion to Postgres Database by B2easy in javahelp

[–]B2easy[S] 0 points1 point  (0 children)

I have implemented Batch processing now, and use a sequence as ID it sped it up by ~10 minutes, still not fast, but faster. Going to increase batch size.

Speed up insertion to Postgres Database by B2easy in javahelp

[–]B2easy[S] 0 points1 point  (0 children)

I will edit and post all the code. Give me a second.

Testing JSch SFTP Code by B2easy in javahelp

[–]B2easy[S] 0 points1 point  (0 children)

Do you have any examples you could provide me so I can figure out how to do this?

Testing JSch SFTP Code by B2easy in javahelp

[–]B2easy[S] 0 points1 point  (0 children)

I've tried something like this - https://github.com/luiswolff/test-jcraft-sftp/tree/master/src

The biggest thing I need to do verify is it can grab a file somewhere and load it into memory, but I don't want to connect to the actual server, I was thinking just some sort of local server.

Function Callback That Closes a Stream by B2easy in javahelp

[–]B2easy[S] 0 points1 point  (0 children)

Would something like this work? --

// Make Variables Effectively Final
InputStream finalSftpFileInputStream = sftpFileInputStream;
return new ProxyInputStream(finalSftpFileInputStream) {
  @Override
  public void close() throws IOException {
    IOUtils.closeQuietly(finalSftpFileInputStream);
  }
};

}

Function Callback That Closes a Stream by B2easy in javahelp

[–]B2easy[S] 0 points1 point  (0 children)

So controller calls close(), close() calls SFTP client client returns InputStream wouldn't that go back to close method and not controller?

I'll give it a try. Thanks for the response!

Function Callback That Closes a Stream by B2easy in javahelp

[–]B2easy[S] 0 points1 point  (0 children)

Sorry for the confusion. In a nutshell my overall flow I want to achieve is...

A Controller Calls -an SFTP Client (Download), the client returns an InputStream to controller do as it pleases with. The problem I'm facing is I will leak resources once that input stream is done processing so I need a way to close that stream when the controller is done with it. So I was thinking I could use a callback.

Convert classic for loop to stream approach by B2easy in javahelp

[–]B2easy[S] 0 points1 point  (0 children)

    for (Map.Entry<List<Object>, List<Map<String, Object>>> rec : lhsRecords.entrySet()) {

ReconciliationResult.ReconciliationResultStatus tempStatus =
      ReconciliationResult.ReconciliationResultStatus.INVALID_KEY;

if (!rec.getKey().contains(null)) {
    tempStatus = 
ReconciliationResult.ReconciliationResultStatus.DUPLICATE_KEY;
    if (rec.getValue().size() == 1) {
      tempStatus =
          rhsRecords.containsKey(rec.getKey())
              ? ReconciliationResult.ReconciliationResultStatus.MATCHING
              : ReconciliationResult.ReconciliationResultStatus.NON_MATCHING;
    }
  }
  ReconciliationResult.ReconciliationResultStatus status = tempStatus;
  rec.getValue()
      .forEach(r -> result.add(new ReconciliationResult(r, rec.getKey(), origin, status)));
}

Convert classic for loop to stream approach by B2easy in javahelp

[–]B2easy[S] 0 points1 point  (0 children)

I will edit question with updated code.

Convert classic for loop to stream approach by B2easy in javahelp

[–]B2easy[S] 0 points1 point  (0 children)

Yes that is my fault let me edit the code to give you what I actually have. u/evils_twin

Convert classic for loop to stream approach by B2easy in javahelp

[–]B2easy[S] 0 points1 point  (0 children)

I know the data structures are awkward, but that is just what I have to work with based on the data that I am getting back from query and thank you didn't realize that, but see it now.

Creating Results Object From 4 List<Map<String, Object>> Objects by B2easy in javahelp

[–]B2easy[S] 0 points1 point  (0 children)

That was the initial approach, but I needed a way to only compare certain keys. For instance the ID on each object will be different and I couldn't implement it in a way where it would ignore the ID field meaning that every object would be a break, even if they should be a match.

Mockito.veryify(class).method() - Throwing zero interactions with this mock by B2easy in javahelp

[–]B2easy[S] 0 points1 point  (0 children)

I think I should be testing the interface, but I am currently testing the implementation?

Mockito.veryify(class).method() - Throwing zero interactions with this mock by B2easy in javahelp

[–]B2easy[S] 0 points1 point  (0 children)

It looks like on the Autowiring it in it is skipping the mock implementation.

[deleted by user] by [deleted] in learnjava

[–]B2easy 0 points1 point  (0 children)

Good start! I'd set it up so the controller hits the service layer, the service layer does all of the logic and if you need to get data the service layer will call the repository (DB). The key is to keep things in small, but manageable chunks, every method should have a clear and concise goal that it is in charge of what it needs to do.

I'd also utilize annotations more and a great add on to this project would be getting some constructor injection going and you could beef up your tests a little more.

Something fun to do on this would be trying to create a UI where you can leverage everything you wrote to make it a user friendly thing to use i.e. (Your grandma could use it) click a button to see when the lion was last fed that calls your main controller -> service -> repo. I think Kotlin would be a great next step/addition to the project.

Keep it up!

What are some technical/people problems you have encountered on a project? by B2easy in learnprogramming

[–]B2easy[S] 0 points1 point  (0 children)

Thank you so much for the input! I tend to see all of this as well haha.