|
Wheany posted:Does anyone know of a fairly recent and up-to-date JavaFX tutorial/Introduction? I had a brief peek at some tutorials and they were incomplete and/or buggy, but I did notice that there were some pretty cool looking ideas like bindings(?) I'd start here: http://docs.oracle.com/javase/8/javase-clienttechnologies.htm I used the same info about a year and a half ago when I first started working with JavaFX. I'd install Netbeans, if you haven't, to go through the tutorials because anything IDE specific will most likely be referring to NetBeans. Once you're familiar with the basics of JavaFX it shouldn't be that hard to switch over to whatever IDE you're most familiar with. I had no problems transitioning to IntelliJ IDEA or just using those tutorials with it directly.
|
# ¿ Sep 18, 2017 07:10 |
|
|
# ¿ May 9, 2024 07:57 |
|
Pedestrian Xing posted: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. Really shouldn't matter if it's Mac, Windows or Linux. All the major Java dev tools are written in Java and run on all three platforms. The only reason to prefer Windows over Mac or Linux is if you have other Windows apps you need to run. e: Though if you do need to run some Windows apps you could just use Parallels or VMWare Fusion in Mac OS or VMWare Workstation in Linux. I've even used GPU passthrough with VMWare in Linux for gaming and it worked really well.
|
# ¿ May 15, 2018 16:12 |
|
Volguus posted:I have a strong opinion against Macs for the simple reason that I used one for 6 months (company issued laptop) and I have found that I am not able to use that UI. It is unix, once in the terminal pretty much everything is there, but the UI has been designed by drunken monkeys high on cocaine. During my 6 months of using it there haven't been 30 minutes going by without me screaming WTF in frustration to yet another dumb thing that OS did. And being a company issued laptop they didn't let me nuke MacOS and install linux on it. That's the UI. The hardware is good, except the keyboard. It hurts to have to type on that thing for too long (1 hour or so). Not sure if Pedestrian Xing has a preference for or against Mac OSX's UI but you could check out Elementary OS (https://elementary.io/) for a Linux distro that has a similar UI. On the Linux side I'd recommend going with OpenSUSE or Manjaro for dev work. They're generally much more current than Ubuntu based distros.
|
# ¿ May 15, 2018 16:45 |
|
benisntfunny posted:Yuck. It's Frankenstein's monster. WSL + OpenSUSE is the best thing to happen to Windows. It's a great SSH client, great for scripting, etc.. Just horrible if you need anything with a GUI. Yeah, you can use a local XServer but... Ugh.
|
# ¿ May 15, 2018 18:08 |
|
Hey guys, I'm looking for the Java thread... I think I took a wrong turn and ended up in mid '90s usenet.
|
# ¿ May 17, 2018 18:18 |
|
FateFree posted:Man I feel like I'm totally missing something. I've been forced to use IntelliJ at work and I'm having the complete opposite thoughts, it seems so clunky and crappy compared to eclipse (well, compared to STS which is what I have been using specifically). I don't get it! In my experience it's more responsive than Eclipse and it has a working dark theme which helps with eye strain. Last I tried none of the dark theme options for Eclipse worked well in windows, they all had issues of some kind. Ola posted:The one thing that I struggled with in Intellij was Ctrl-Y is delete line, not redo. Lost a few chunks of code before I learned. If you change the keymap to Visual Studio then ctrl+z & ctrl+y function as you'd expect, or you could just remap that command yourself.
|
# ¿ Sep 20, 2018 20:10 |
|
People just pay money to Jetbrains for fun. I mean, that's why I do it.
|
# ¿ Sep 22, 2018 04:12 |
|
I've been doing dev for a long time at a lot of companies from Fortune 100 down to a small <10 person company. You're going to run into most of those problems at any company and it will vary from project to project. I'm sure that there are companies that do it much better than others but they're rare and you likely won't know for sure until your hired and working on a project.
|
# ¿ Mar 10, 2019 16:37 |
|
NuclearEagleFox!!! posted:I don't have a technical question, just a request for recommendations. https://www.baeldung.com/ is a pretty good resource.
|
# ¿ Apr 3, 2019 17:36 |
|
You're going to pick up a lot of outdated info and broken links reading Java posts from 10 years ago. I wouldn't recommend you approach it that way.
|
# ¿ Apr 9, 2019 01:19 |
|
Rubellavator posted:What's a good resource to learning all the stream api and other goodies added in java 8? Most of our codebase was written before java 8 was a thing and one of our new developers has taken it upon himself to refactor a huge chunk of the code using that stuff. Frankly I find it all unintuitive and confusing as hell to read, but I dont want to be that old man programmer just yet. https://www.baeldung.com/java-8-streams I'm not a fan of streams either. They're more difficult to read, meaning a higher cost of maintenance, and performance tests I've seen say they're slower than traditional methods in most cases. Still, it's good to learn regardless. Especially when you work with a streams happy dev.
|
# ¿ May 7, 2019 21:20 |
|
Objective Action posted:4) Basically the benchmarks I've seen have shown that the only real place streams excel is in easily parallelized operations with a lot of data. Which is basically what you're saying here. Outside of that (and perhaps file I/O) they're both slower and more difficult to read and maintain than basic loops. I've seem a lot of streams code and none of it has fallen into either category. In my experience Java devs who love streams are mostly in love with "single line of code" solutions they consider elegant or clever with no consideration for either performance or maintainability. I agree that there are good places to use it but the vast majority of places I've seen it used in are to replace simple loops regardless of the amount of data or operations taking place. I've been programming since the early 90's in Turbo Pascal, C, C++, Delphi, VB, C#, Java, JavaScript, Apex Code, SQL & PL/SQL, shell scripts etc... and generally have no problem looking at code in any language and understanding exactly what's going on and streams have been probably the first thing that that's made me have to research the code I'm reading. I've learned and can parse that poo poo fine now but it adds another barrier to entry for junior devs and it's hard enough finding junior devs that understand basic logic, let alone 5 operations chained on a single line with specialized knowledge required for things like map() vs. flatMap(). RandomBlue fucked around with this message at 06:32 on May 9, 2019 |
# ¿ May 9, 2019 06:30 |
|
Ola posted:This is probably an old and tired topic, but I'm trying to wrap my head around null handling, hope I can get some good tips. So unhandled NullPointerExceptions are bad, that's fine. I've worked a little bit in a university project with Optionals and I felt that while it served as a post-it note that it might be null so you unwrapped it carefully, I had to do a lot more boilerplate, wrapping and unwrapping, instead of just remembering to null-check at some suitable point. Your code should generally break down into 50% tests, 40% null checks/handling and 10% logic.
|
# ¿ May 11, 2019 02:42 |
|
Volguus posted:edit: And oh, forget that lombok thing. Really. It's not 1999, IDEs can do some stuff now. Lombok is still useful because IDEs won't keep your hashCode(), equals() and toString() methods up to date. It also cuts dowb the amount of bullshit boilerplate you have to skim in PRs. Taking a DTO class from 200 lines of code to 30 (for however many DTO classes you've got) is nice. Also not every team member uses the same IDE and has the same functionality/plugins available so if it can be handled by an annotation processor that can work for everyone.
|
# ¿ Sep 7, 2019 20:38 |
|
Volguus posted:Why do you need your equals/hashCode method to be kept up to date? How often do you change the equality criteria for an object? Add/remove fields, sure, but they usually are just fields that have no bearing on the uniqueness of the object. I don't remember the last time when I had a POJO where all the fields went in the equals/hashCode. Maybe for something really trivial with 2-3 members (Point with int x,y would qualify) but other than that an object is made unique by a few important members, not by all. Maybe if you're only comparing objects after they've been persisted and have a unique ID. What about before that point? What if you're comparing a modified object versus an unmodified one or another modified instance? If you want to customize those you still can with Lombok. IMO, if you have a hashCode or equals implementation that doesn't check all publicly settable properties you should have a very good and well documented reason for that.
|
# ¿ Sep 8, 2019 07:30 |
|
Jabor posted:If your thing is mutable you shouldn't be overriding equals/hashcode at all, because object identity is more important. Agreed.
|
# ¿ Sep 9, 2019 06:19 |
|
Zaphod42 posted:I'm not wild about val / var. I shy away from it in C# code too, that feels like something that should stay in javascript and interpreted languages. var in c# is still strongly typed. e: It takes on a type when the variable is initialized. It's implicitly typed: https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/var
|
# ¿ Sep 10, 2019 00:37 |
|
hooah posted:We have a REST service that uses javax.validation.constraints.Pattern to ensure a path parameter is a UUID. Unfortunately, this annotation by default returns any invalid parameter to the client, which our security testing software has flagged a as cross-site accepting vulnerability. Is there any way to configure this annotation to not send the invalid string back? If you're using Spring then add an exception handler for your REST controller: https://www.baeldung.com/exception-handling-for-rest-with-spring e: Nevermind, looks like Pedestrian Xing's answer is the right one. RandomBlue fucked around with this message at 22:11 on Dec 16, 2019 |
# ¿ Dec 16, 2019 22:09 |
|
lifg posted:So I’m team lead for a small project. All the devs know Java, so we’re using Java. Some of them know Spring Boot, and one of them used JHipster in their last project. JHipster is basically a project scaffolding that is based on Spring Boot with several other libraries included. It's a way of quickly bootstrapping a Spring Boot app with commonly used libraries. Spring Boot is a framework that includes everything you need to host a database driven web app and/or web services. There are probably better short descriptions of both. However, your biggest problem is probably going to be learning Java style programming, as that's very different from PHP, Perl, Ruby and (I believe) Python. e: Some good places to start: https://www.baeldung.com/java-tutorial and https://www.baeldung.com/spring-boot - they have tutorials for beginners through advanced Also, if you haven't worked with maven, gradle or whatever build tool is used for the project, you'll need to learn those as well. Maven is the most commonly used and uses an XML based file configuration (pom.xml by default). RandomBlue fucked around with this message at 07:18 on Dec 21, 2019 |
# ¿ Dec 21, 2019 07:08 |
|
Volguus posted:I strongly disagree with that assertion (that hibernate is trash). It can, however, generate in some cases sub-optimal queries. If that's 90% of your use case, then definitely hibernate (or probably any orm) is not appropriate for you and your app. But for 99% of the cases, of the apps out there, the dumb CRUD apps, hibernate saves a shitload of time as it really doesn't do anyone any favors to have to write "select bar from foo where id=5" 100 times. Yeah, it's super easy to use a native query with hibernate for one off stuff you need to optimize. Also you guys are triggering my DBA PTSD with these pseudo-many-to-many relationships stored as an array converted to a string in a column. Please, for the love of god, don't do things like that.
|
# ¿ Mar 13, 2020 01:15 |
|
adaz posted:JDK 14 is out officially. JEP 358: Helpful null pointer exceptions. The future is now!
|
# ¿ Mar 18, 2020 01:20 |
|
adaz posted:1. As other suggested lombok is the _easiest_ way around this and for pure POJOs i think it's fine. @requiredArgsConstructor handles _most_ of my validation concerns for simple pojos Lombok also has an @Builder annotation that makes it super simple: https://projectlombok.org/features/Builder
|
# ¿ Mar 19, 2020 22:47 |
|
Hippie Hedgehog posted:I would check in the generated code, yeah. Yeah, slowing down the build is annoying but wasting 30-60+ minutes trying to figure out why something is broken because someone forgot to update the generated code is worse.
|
# ¿ Apr 9, 2020 22:44 |
|
Jabor posted:No-one cares about your CI builds being ten seconds longer, and your developer incremental builds shouldn't be rebuilding the db classes anyway because it can see that you haven't changed the files that go into generating them. Yeah, my poo poo takes at least 10 minutes right now. I'd easily tack on another 20 seconds to avoid poo poo failing from manual generation let alone having PRs including generated code changes.
|
# ¿ Apr 10, 2020 05:10 |
|
nakieon posted:I... wow. That is a great post. I read this 3 days ago and something just felt off about it.
|
# ¿ Sep 5, 2020 06:50 |
|
F_Shit_Fitzgerald posted:I'm a C++ guy who wants to relearn Java. I've barely touched it since I took a community college course years ago (2008). Is there a good site, ideally not a pay one, where I can re-teach myself Java? Nearly every coding job I've ever seen requires Java and sticking with C++ is probably hurting me in the job market. https://www.baeldung.com/java-tutorial Lots of good, free tutorials on Java and Spring there.
|
# ¿ Sep 23, 2020 17:57 |
|
carry on then posted:I also like how the Java thread is 99% nitpicking. That looks like basic Java 8 to me (doh missed the vars but come on), that introduced streams a long time ago and if you're just going to do: code:
code:
code:
e: Guess it's good that I'm so used to var now that I don't even notice it when reading code now. RandomBlue fucked around with this message at 03:28 on Oct 28, 2020 |
# ¿ Oct 28, 2020 03:17 |
|
carry on then posted:I hope that student learned never to ask questions in the Java thread ever again because this was the opposite of helpful. RandomBlue fucked around with this message at 06:39 on Oct 28, 2020 |
# ¿ Oct 28, 2020 06:35 |
|
Objective Action posted:gently caress var forever. Take that poo poo back to Scala nerds! Strongly typed local variable type inference is actually good most of the time unless you like repeating yourself on the same line: OmgType varName = new OmgType();
|
# ¿ Oct 28, 2020 06:53 |
|
Objective Action posted:Here is a nice Scala example that took fifteen minutes of my life yesterday: I agree that there are times like your example where you shouldn't use var. Any time the return type is non-obvious you shouldn't use it. RandomBlue fucked around with this message at 15:16 on Oct 28, 2020 |
# ¿ Oct 28, 2020 15:13 |
|
Empress Brosephine posted:hello0 java goons i've been going thorugh jetbrains academy which should be renamed brokebrain academy because I am enjoying Java alot, as it reminds me of C# compared to the javascript and php I write in. https://www.baeldung.com/ is really good and has a lot of good basic tutorials and guides for "how do I do X". Start here for basic Java stuff: https://www.baeldung.com/java-tutorial Effective Java is a good book that gets recommended a lot but it's less a java tutorial and more about specific solutions/patterns/best practices.
|
# ¿ Apr 26, 2021 15:51 |
|
JavaFX is the current GUI framework for Java: https://openjfx.io/
|
# ¿ May 1, 2021 18:20 |
|
Objective Action posted:I'm actually working on a project right now that uses JavaFX's WebView as an Electron alternative where the widgets are all Angular/HTML5 and bind back to Java processing code via the JSObject bindings. But then again I am a crazy person. Interesting. Why did you opt for this over Electron with a Java back-end? That's what I'm working on primarily right now.
|
# ¿ May 1, 2021 21:21 |
|
PierreTheMime posted:
IIRC calling this repeatedly like this in a loop is very slow as it's converting the StringBuilder to a string, then to a byte array for every line you're processing in the input file. It'd be faster to get the size in bytes of each input line and increment a temp variable indicating how many bytes have been processed and then check to see if you're going to exceed your buffer size before adding more to the output. Though the most likely culprit is the S3 transfer being slow. You might temporarily change the code so it loads that data into memory before any processing is done so you can separate the download from processing while trying to figure out why it's slow.
|
# ¿ Dec 2, 2021 17:46 |
|
PierreTheMime posted:Edit: That absolutely was the issue. "calling this repeatedly like this in a loop is very slow" is an understatement of the century, the process runtime for 170MB of text is 43 seconds now. Yup, I've had to solve this exact problem before (without S3 being involved) and that was our core issue originally as well.
|
# ¿ Dec 2, 2021 18:53 |
|
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: First, what you're calling a junction table isn't really, as a junction table just contains the ids of the two tables you're joining in a many to many relationship. Instead you have an entity with it's own properties that has many to one relationship with both Recipes and Ingredients and could be referred to a RecipeLineItem or something similar. It does require it's own repository since it's not a junction table (which JPA could handle completely for you if it were via annotations, no repo needed) and the repo should have save methods that just take an instance of that entity as an argument, not individual properties as parameters. These properties all belong on the RecipeLineItem entity, where they will be saved, not as transient properties elsewhere. In the code you linked you're trying to pass all those properties to your repo save method instead of passing an instance of the class to be saved.
|
# ¿ Jan 9, 2022 18:17 |
|
smackfu posted:At least fighting with Spring and JPA is a real job skill. Now try to make Spring Boot start up in an acceptable amount of time.
|
# ¿ Jan 9, 2022 19:36 |
|
Hippie Hedgehog posted:Use a library. Just want to say whenever you're trying to solve a problem you should always look for libraries first. The number of times I've seen poo poo like people rolling their own CSV parser is insane. No you didn't think of everything and no it's not parsing the CSV correctly.
|
# ¿ Mar 2, 2022 18:16 |
|
smackfu posted:Of course, since it is Java, there is probably one library that everyone has used for ten years and that has a terrible API. In my experience there are multiple library options for most common (and not so common) problems in Java. For a lot of common problems, Apache Commons probably has a library for it and in my experience their libraries are decent.
|
# ¿ Mar 2, 2022 21:22 |
|
|
# ¿ May 9, 2024 07:57 |
|
chippy posted:I work somewhere where we have 10 half-baked in-house versions of everything. It's an absolute nightmare. Early on in my time here I asked in Slack what our solution was for persisting data and got literally 7 different answers, and they were all bad. The worst one I ran into was someone rolling their own loving crypto and they got extremely mad when I told them they needed to be using one of the standard libraries, ESPECIALLY for crypto. They took that to mean I thought they were incompetent, which they were but that had nothing to do with whether or not I thought they could write a crypto library on their own. IIRC it was a step above ROT13. This was in the mid 2000's and it was a .NET app, AES (and several other ciphers of course) were built into the framework and easy to use.
|
# ¿ Mar 3, 2022 17:31 |