|
Any recommendations for a printing library? I want to take an image file, a dynamic printer address, and have it print with minimal configuration.
|
# ¿ Aug 9, 2017 13:33 |
|
|
# ¿ May 9, 2024 15:38 |
|
Anyone have strong opinions on Mac vs Windows for java dev? New job is asking which I want. I've always used Windows but if there's some tool that works better on Mac I'm not opposed to switching.
|
# ¿ May 15, 2018 15:41 |
|
I like NetBeans, I think most people use IntelliJ.
|
# ¿ May 22, 2018 22:12 |
|
That sounds like something you should let the DB handle as long as it's indexed properly. If it has to be done in memory, make some kind of Map structure so you're not searching over and over. Also possibly Streams if it doesn't have to be done in a specific order?
|
# ¿ May 30, 2018 16:54 |
|
Trip report: Mac pretty good so far, having a lot harder time adjusting to IntelliJ from Netbeans. My macros...
|
# ¿ Jun 11, 2018 22:30 |
|
Java Readers intentionally ignore the existence of a BOM in a string/file which is annoying. Commons-io has a BOMInputStream that will deal with it.
|
# ¿ Jun 18, 2018 17:46 |
|
Can't remember who recommended Key Promoter X but it's helped a ton in switching to IntelliJ.
|
# ¿ Sep 21, 2018 14:48 |
|
I have a friend who has done a Java bootcamp and wants to learn more OO stuff. What's a good mid-beginner Java book/course?
|
# ¿ Oct 16, 2018 01:26 |
|
Commons FieldUtils is great for any reflection stuff.
|
# ¿ Nov 3, 2018 01:18 |
|
Work has asked me to start doing technical interviews for Java developers. Has anyone encountered any good basic Java language questions? For example, in one interview another dev asked how the candidate would implement a queue style interface using two stacks. Looking for 5-15 minute questions that can be done with a whiteboard.
|
# ¿ Jun 13, 2019 18:10 |
|
Sorry, I should have been more specific. At this stage, we know they have at least FizzBuzz-level coding ability. This is more about seeing their problem solving abilities in action. Questions with no one best answer are great as well as more straightforward implementation ones.Ola posted:And don't punish wrong answers over right attitudes and a keen, problem solving mind. We're allowed to give hints and getting it wrong isn't a DQ.
|
# ¿ Jun 14, 2019 03:12 |
|
Custom message parameter in the annotation?
|
# ¿ Dec 16, 2019 22:06 |
|
I like the fluent pattern for POJOs with a lot of fields. Lombok and IntelliJ can both generate them.
|
# ¿ Mar 19, 2020 19:42 |
|
Splinter posted:I would think a Builder would be the way to go if you have that many constructor parameters. Fluent setters is an improvement over trying to get the ordering of that many constructor parameters correct, but that leaves open the possibility that a client won't set everything that needs to be set before the object is used. Builder gives you the fluent benefit of not having to get the constructor parameter ordering correct, and can ensure an object is in a valid state before it can be used. It also allows for making the object immutable, which isn't possible using a fluent setter approach. This is very true - fluent pattern does tend to make state validation difficult. Side note: I've started using JSR 305 annotations in all my new code and really like them. Specifically, I'm using Spring's @Nullable/@NonNull meta-annotations. Pedestrian Xing fucked around with this message at 20:35 on Mar 19, 2020 |
# ¿ Mar 19, 2020 20:33 |
|
Anyone have experience with Project Reactor and Netty? I'm trying to write a proxy that can do streaming decryption + download of large files to avoid buffering them. Netty's HTTP client gives me a Flux of ByteBuf's of arbitrary size and I need to turn that into a Flux of byte[]'s of a fixed size for decryption. Not sure what operation I'm looking for - it needs to consume every ByteBuf like map(), but each input could result in 0-N outputs. This is my first foray into reactive programming, so I might be missing something simple.
|
# ¿ Apr 13, 2020 22:30 |
|
Pedestrian Xing posted:Anyone have experience with Project Reactor and Netty? I'm trying to write a proxy that can do streaming decryption + download of large files to avoid buffering them. Netty's HTTP client gives me a Flux of ByteBuf's of arbitrary size and I need to turn that into a Flux of byte[]'s of a fixed size for decryption. Not sure what operation I'm looking for - it needs to consume every ByteBuf like map(), but each input could result in 0-N outputs. This is my first foray into reactive programming, so I might be missing something simple. I did finally figure this out, the answer is Flux<T>'s flatMapConcurrent(Function<T, Flux<T>>) method. It has to return a Flux, but it can have 0..N members. Hughlander posted:No but I have experience with Netty, and I'd just use a Pipeline to decrypt the stream before it got to Project Reactor, unless you must use their encryption. Thanks, I did look into this. Ultimately, since I'm building on Spring Cloud Gateway, I'm not the one constructing the HTTPClient and processing the output separately seemed easier.
|
# ¿ Apr 15, 2020 04:06 |
|
Kilson posted:Use a thread pool (ExecutorService or something like that - there are several different versions of the class depending on what you need exactly) If you want to go a little farther, you can have the API call trigger a Spring ApplicationEvent, a JMS message, or something like Kafka. The first two are doable purely within Spring and the latter two allow you to scale out more easily.
|
# ¿ Jun 3, 2020 05:58 |
|
smackfu posted:This is nonsense, right? Yes, it will either return a trimmed string or throw an NPE. I assume they meant to do this: code:
code:
|
# ¿ Jun 9, 2020 02:48 |
|
Anyone have experience with event sourcing in Java? Looking at using it as the data model for a new project. Biggest draw is the built-in audit functionality since the data is legal stuff.
|
# ¿ Jun 16, 2020 06:44 |
|
Tony Danza posted:I just finished up a project using Axon framework. The reason we were using it was not for the auditing benefits but the letting our project listen to events happening in other projects and then reason out an understanding of it's own. It was nice to do something different. Thanks for the recommendation! After evaluating a few options, I think I've decided to write my own simple framework. Realistically, we don't need full-blown event sourcing so much as snapshot functionality. Took some inspiration from Axon's Spring integration about how to do the API.
|
# ¿ Jun 21, 2020 21:13 |
|
I know Spring supports it through JDBC/Redis but it wouldn't be terribly hard to do yourself.
|
# ¿ Jul 9, 2020 02:34 |
|
Guildenstern Mother posted:
You probably don't want to use == on Strings (or Objects in general).
|
# ¿ Jul 10, 2020 00:35 |
|
Yeah, Spring and Micronaut and similar frameworks abstract REST stuff away to nothing. Had to refactor some legacy Servlet code recently and it was painful.
|
# ¿ Jul 23, 2020 20:56 |
|
You can create static internal classes if you want.
|
# ¿ Nov 16, 2020 18:48 |
|
256 in production? Yikes. I think our dev env services run on 512 heap and 2-4GB in prod but we also use AOP heavily which has significant heap usage impact. If you're really memory constrained, something like micronaut might be better.
|
# ¿ Nov 22, 2020 06:25 |
|
i vomit kittens posted:Putting a unique constraint on the keys was my first thought, and probably something I should have done in the first place. I guess I'd have to be pretty careful about how I handle the error it would generate though because I don't want: Unfortunately, trapping constraint exceptions in Spring is a massive pain in the rear end - if you're using @Transactional, you can't catch them inside your service class, they have to be caught and turned into the appropriate HTTP response at the controller level.
|
# ¿ Mar 23, 2021 04:42 |
|
Argyle Gargoyle posted:We have a JSP-based website and we've wasted days trying to connect it properly, via servlet, to our individually locally-hosted Oracle databases. Are you using raw JDBC or an ORM? Are there any logs coming out of the driver?
|
# ¿ Apr 8, 2021 02:28 |
|
Paul MaudDib posted:had some potentially leaking connections that we think might be related to it (it’s either that or hikaripool it seems - we have threads that wait and can’t get connections until after timeout) Is this related to the "clock skew detected" error messages? WRT @Transactional, if you need fine-grained control you might be better using a TransactionTemplate. Does the same thing but let's you control the boundaries instead of them being fixed to the entry and exit of a proxied method.
|
# ¿ Oct 5, 2021 08:55 |
|
Maybe experiment with a larger buffer size on your Reader? Default is 8kb which might be triggering a lot of new HTTP connections.
|
# ¿ Dec 2, 2021 17:26 |
|
Guildenstern Mother posted:So I'm trying to write a spring controller that will add a recipe to my sql db. Ingredients are unique and don't contain a recipeId and its all tied together in a junction table that looks kinda like this: Is this using Spring Data JPA? If so, I think you would set up your IngredientJunction (entity) class with the id field as a standard ID and then recipe/ingredient/unit would each be a field of that entity type. Things like amount and prep notes would be standard @Column fields. You would set the relation up using @ManyToOne/@OneToMany annotations. At save time, it might look like this: code:
Guildenstern Mother posted:If each ingredient is coming back from the form with notes about measurement, quantity and prep notes could I make those transient properties in ingredients so that while they're there to be entered into the junction table they're not stored as part of the main ingredient entry or is that going to screw everything up? A general best practice is to use DTO classes for things like requests and responses - you don't want to pass entities around. It can break in a lot of subtle ways as well as setting you up for unintended data disclosure.
|
# ¿ Jan 9, 2022 05:14 |
|
Somebody in this forum (can't remember which thread) once said that all recursive algorithms can also be expressed as a while(true) loop with a manual break condition and it really made them way easier to approach.
|
# ¿ Sep 10, 2022 00:25 |
|
Anyone have strong opinions on getting the Oracle Java 17 cert? Is it worth it if I already have a strong resume (aiming for senior/principal level)? If anyone has taken it, how much study should I plan to do?
|
# ¿ Oct 3, 2022 01:31 |
|
H2 also has a handful of weird incompatibilities with T-SQL that make it a pain in the rear end to use as a test DB. Thankfully there's testcontainers now.
|
# ¿ Oct 11, 2022 02:08 |
|
Janitor Prime posted:I really dislike teaching newbies the streaming APIs, what was wrong with doing it the old fashioned way with for loops. I feel like stuff was so much simpler to reason about. They definitely lead to some antipatterns at times. I see stream-filter-findFirst to get an entity by ID (inside a loop) frequently instead of building a Map<ID, entity> once.
|
# ¿ Nov 30, 2022 02:56 |
|
I don't know VSCode specifically but most IDEs allow you to right click a dependency and download sources/docs. Most libraries also have their Javadocs and use guides online if you search.
Pedestrian Xing fucked around with this message at 21:37 on Apr 22, 2023 |
# ¿ Apr 22, 2023 21:33 |
|
LostMy2010Accnt posted:Still having issues with my maven pom file; it's new to me but I've not had luck building it, just importing dependencies for the project. Also working on why log4j2 isn't logging either; I think it might have something to do with where I have it in the project directory. If any of these are causing you issues, then don't sweat looking into this. Appreciate it, thanks. Your log4j2.xml should be under src/main/resources. What errors are you seeing with the pom?
|
# ¿ Sep 15, 2023 13:46 |
|
|
# ¿ May 9, 2024 15:38 |
|
LostMy2010Accnt posted:Ah I just had in source, thank you for catching that. Not seeing errors with pom more that: 1) I'm just trying to learn how to use it; 2) Eclipse is acting really odd whenever I try to modify it at times (Weird spacing, freezes, etc.). Turn off any kind of auto-import or sync your IDE might be doing on pom.xml modification and trigger it manually when you make a change.
|
# ¿ Sep 17, 2023 00:21 |