The Laplace Demon posted:I don't think it's possible to get around needing the index. This is the kind of thing I've written or seen for these problems: I like it. I'm left to wonder if this will incur less overhead than the data-copy version. EDIT: gently caress YEAH. A nice performance boost with this. Thanks, all. Jo fucked around with this message at 22:12 on Feb 4, 2017 |
|
# ? Feb 4, 2017 22:03 |
|
|
# ? Jun 3, 2024 06:09 |
|
Wheany posted:I have decided to use https://github.com/visad/visad/blob/master/core/src/visad/Delaunay.java, with its lovely 1998 vintage code. It works and all, but holy poo poo this is the spaghettiest code I have seen ever. There is no way of lifting just one class from out of that mess. By using the Delaunay class I suddenly need to have a dozen custom awt components and bespoke collections and
|
# ? Feb 5, 2017 12:43 |
|
Wheany posted:There is no way of lifting just one class from out of that mess. By using the Delaunay class I suddenly need to have a dozen custom awt components and bespoke collections and Success! I ran coverage on the class for the use case I have and then just deleted all branches and methods that were not touched 3 Classes remain, one of them is a pointelss extension of Exception and I can easily combine the base Delaunay class and DelaunayWatson that extends it.
|
# ? Feb 5, 2017 14:39 |
|
Having a problem with Maven. My code builds correctly on my main machine. But same codebase on other machines, I get a compilation error with HttpServletResponse. My company is JUST NOW getting to dependency management The code works as it is now for our application. It's just failing on build for my 2nd machine and for others. There is an older version of javax.servlet:javax.servlet-api (we use 3.1, the dependency uses 2.3) that is used by another jar and I have tried adding it as an exclusion in the offending dependency, but that does not work We're passing in: method(HttpServletResponse res, ...) and it fails on first line of the method: "res.setCharacterEncoding("UTF-8");" Any thoughts? I've been stuck on this for over a day and really haven't been able to find an answer on Stackoverflow etc. (the exclusion one was promising, but ultimately didn't work) code:
|
# ? Feb 8, 2017 21:39 |
|
Are you sure the older JAR went away when you were excluding it? And that no other dependencies were sneaking in old versions? (Whee, dependency hell!)
|
# ? Feb 8, 2017 22:07 |
|
Does either your local machine or the other one have a maven install with a customized settings.xml file in the maven conf directory? For instance, if they point to different remote repositories, things may fail. It's an easy to forget thing that can cause maven to fail managing your dependencies. EDIT: If that's not it, this is how you can figure out version conflicts in maven dependencies: https://maven.apache.org/plugins/maven-dependency-plugin/examples/resolving-conflicts-using-the-dependency-tree.html Carbon dioxide fucked around with this message at 22:28 on Feb 8, 2017 |
# ? Feb 8, 2017 22:26 |
|
It's weird. I commented out the dependency on a whim and ran mvn install. Build Successful. Uncommented the dependency and built. Build Successful. It's some weird circular dependency. The library causing the issue is some very old RSS lib (yarfraw) that's from 2008. I checked out the code to perhaps fix things, but everything fails to build. I've tried several tags and the main trunk. I don't know who thought using this was a good idea (it was our CTO). So I'm going to replace since it's only used in two small places. One place for parsing date time which java 8 can now do natively. The other is just basic reading.
|
# ? Feb 9, 2017 00:19 |
|
geeves posted:Having a problem with Maven. My code builds correctly on my main machine. But same codebase on other machines, I get a compilation error with HttpServletResponse. My company is JUST NOW getting to dependency management geeves posted:It's weird. I commented out the dependency on a whim and ran mvn install. Build Successful. Usually this is exactly the problem and fix for me. You ran "mvn install" locally. Now you have a different version of the lib installed in your local Maven repository. Boom, compiles for you but nobody else. Or otherwise - somehow you have a different version of this lib in your Maven cache from everyone else, that's what it comes down to. Dumb idea: you can set up a Maven reactor project. You have parent project A which compiles modules B and C and D. C depends on B, so the reactor will compile B and then sub it into C. Problem though - this means you are compiling everything every time, and if B's tests aren't insignificant that can potentially be a huge build time. Also, if D depends on C (B -> C -> D) then you have no way to build just C in isolation - your only unit you can build successfully by itself is "A" so compiling A will compile B and C and D too. This can also be a problem if D is huge. Partial fix of this problem - you set up a local artifact repository inside the repo, and have Maven install to that repository when it does its thing. This is also how you replicate the traditional "libs" folder via Maven. Since it needs to know what each jar file actually is - so that it can manage your dependencies. There is no difference between Maven Central and something you install into a repo with "mvn install:install-file -DlocalRepositoryPath". One is accessible over http: //, one is accessible over file: //, that's the only distinction that Maven's abstraction will draw. https://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html Now you get an additional problem, because Maven will "helpfully" set up a cache inside your homedir ("~/.m2" on Linux, "/Users/geeves/.m2/" on Windows). Somebody else pushes a new version of your custom-built dependency jarfile and some code changes. But Maven won't check the repositories until the cache expires - not even the local repositories. gently caress you Maven, this is a terrible coding decision. To fix it, delete your ".m2" folder and you will redownload everything. Better fix of this problem - you really need to set up an artifact repository like Nexus or Artifactory. This is basically your own version of MavenCentral that holds your private jars and stuff. You can even have it cache stuff from MavenCentral so you don't have to redownload everything slowly from the internet every single time. https://www.sonatype.com/nexus-repository-sonatype https://www.jfrog.com/open-source/ Now we hit an additional additional problem. The "contract" of Maven dependencies is the groupId, artifactId, and version of the package matching if and only if the jar is exactly the same. As far as Maven is concerned, if those things match then the jars are interchangeable. Which is why Maven is deciding to cache poo poo in the first place. So now, every time some idiot compiles the jar with something that breaks the main code then it breaks for everyone who uses the artifact repository server. Fix: if you are compiling every time then what you actually have is a "SNAPSHOT" build. For example, instead of building version target "2.0.0" you should use "2.0.0-SNAPSHOT". Also, set these config files to force them to always be rebuilt. http://stackoverflow.com/questions/2358965/maven-automatic-snapshot-update Further tip: don't ever set your project up to compile configuration (DB server target, etc) into your jar files. You always always do something like JNDI instead of that. Otherwise, what happens when someone installs the jar and your production server suddenly boots up with test-server configuration? I'm not going to say that I'm totally guilt-less here, but if you're going to do it, don't ever compile to the same jar-file target filename. Different filenames for different builds, it doesn't help the Maven problem but it will help your sanity. Deploying "myapp-prod.war" to Tomcat will only ever deploy to "webapps/myapp-prod/" unless you get frisky with the web.xml. And you always always do a "mvn clean package" or "mvn clean war:war" or something, you never never never do a "mvn clean install" on something that might produce a different output based on profiles/configuration/git branch/etc. Otherwise I guarantee you will get hosed by this down the road. It may be tomorrow, it may be 2 years, but your clock is ticking buddy. If your new guy does it then you get to have a long and productive explanation of the Maven lifecycle and how you will respect it. Paul MaudDib fucked around with this message at 00:54 on Feb 9, 2017 |
# ? Feb 9, 2017 00:47 |
|
Paul MaudDib posted:Lots of good stuff. Thank you for that reply. We actually did install Artifactory for this jar (and about 20 others) that have no MVN equivalent. I'll do the later mvn commands you suggested when the next developer tests this out (or I'll blow away my local mvn repo on the machine which I had trouble with and start from scratch again). Does Gradle handle weird things like this any better?
|
# ? Feb 9, 2017 02:57 |
|
geeves posted:Thank you for that reply. We actually did install Artifactory for this jar (and about 20 others) that have no MVN equivalent. I'll do the later mvn commands you suggested when the next developer tests this out (or I'll blow away my local mvn repo on the machine which I had trouble with and start from scratch again). Like everything, it makes it's own tradeoffs and stupid loving decisions.
|
# ? Feb 9, 2017 20:46 |
|
What library for conversion between DTO and Entity objects would you recommend?
|
# ? Feb 14, 2017 11:10 |
|
Boz0r posted:What library for conversion between DTO and Entity objects would you recommend? Not sure if anything better has come along but I previously used Orika without any problems: https://orika-mapper.github.io/orika-docs/
|
# ? Feb 14, 2017 13:17 |
|
CPColin posted:(Whee, dependency hell!) I figured out most of this garbage. Unfortunately my company has a massive amounts of technical debt, including hibernate loving 3. Christ. I'm half tempted to quit than deal with code:
Edit: figured it all out. So many exclusions - I've never really had to use those before, thankfully. Now struts isn't reading properties, but that's easier to deal with. geeves fucked around with this message at 23:31 on Feb 15, 2017 |
# ? Feb 15, 2017 21:03 |
Why does the GC log have to be so annoying to parse. I'm trying to write a logstash pattern for it, what a fuckin' pain! I found an existing one online but god drat it is complicated: https://github.com/Mortinke/logstash-pattern/blob/master/logstash/etc/logstash/patterns/gc
|
|
# ? Feb 17, 2017 20:04 |
|
fletcher posted:Why does the GC log have to be so annoying to parse. I'm trying to write a logstash pattern for it, what a fuckin' pain! They don't make monitoring applications for this sort of thing so you don't have to manually parse it all an then do something with results from logstash later?
|
# ? Feb 17, 2017 20:57 |
|
I have some code that doesn't compile in IntelliJ, but our ant script works fine. I don't get it.code:
|
# ? Feb 20, 2017 13:08 |
|
That's odd. If you decompile the bytecode, what did it actually turn into?
|
# ? Feb 20, 2017 15:30 |
|
Boz0r posted:I have some code that doesn't compile in IntelliJ, but our ant script works fine. I don't get it. What java version are you using in the ide and what in the ant? i have seen issues where ant is using java 6 or 7 and ide is using 8 (or vice versa)
|
# ? Feb 20, 2017 15:33 |
|
Boz0r posted:I have some code that doesn't compile in IntelliJ, but our ant script works fine. I don't get it. Your IntelliJ classpath isn't the same as your Ant classpath somehow. Unlike Maven, Ant build files are not a declarative "project" file, they are like a makefile and you need to keep your IDE's project file in sync with them. When you run "build" it's actually IntelliJ compiling it via its own build script - not running the Ant script.
|
# ? Feb 21, 2017 06:00 |
|
Anyone used Lanterna before? Or any AWT/Swing stuff? I'm just trying to dip my toes into Lanterna for a personal project, but the documentation is poo poo. I'm doing OK except I can't figure out how to make the font size change. Everything is super big (1/4 of my 1440p screen, so like 720p). What I'm trying is this: code:
Paul MaudDib fucked around with this message at 06:06 on Feb 21, 2017 |
# ? Feb 21, 2017 06:03 |
|
Boz0r posted:I have some code that doesn't compile in IntelliJ, but our ant script works fine. I don't get it. Yeah, that's weird. While the JVM spec allows methods to differ only by return type, Java definitely does not, so with the type erasure, those two should clash.
|
# ? Feb 21, 2017 06:11 |
|
In unrelated news, at work I'm working on converting a legacy app that pre-generated database IDs at object creation, so basically Hibernate doesn't know what the gently caress because it sees everything as detached. saveOrUpdate is broken, persist is broken, one-to-many collections are broken, and we're piling more and more dirty hacks on top of the legacy dirty hacks because "what we had worked before!" and the tech lead doesn't want to touch anything because we have a big mass of spaghetti code and no tests. I'm pushing hard for high-level integration testing using a container instance of the DB schema that we can set up and knock down almost instantly, and running tests by passing request parameters into the Struts actions and then parsing the output with something like TagSoup for targeted outputs. Like a form of Selenium testing that doesn't take hours to run. Then we can start delving down into the core code and cleaning it up into something testable. Also, since it's Oracle-based, there's tons of DB quirks. Otherwise I'd propose SQLite. The tech lead thinks it'll all just somehow work out with some bailing wire and lots of tester time. But I know we're gonna break everything all the time unless we get automated tests. Right now you have no idea what you'll be passed, every action is passing in a totally different mix of object states- transient, persistent, detached, illegal combinations thereof (detached objects that don't exist in the database!), or something that Hibernate shouldn't touch, and there's like 50 actions and several hundred views. Paul MaudDib fucked around with this message at 06:20 on Feb 21, 2017 |
# ? Feb 21, 2017 06:12 |
|
TheresaJayne posted:What java version are you using in the ide and what in the ant? I think ant is using java 6, but I've tried using 6, 7 and 8 in IntelliJ, none of which compiles it.
|
# ? Feb 21, 2017 09:36 |
|
Paul MaudDib posted:In unrelated news, at work I'm working on converting a legacy app that pre-generated database IDs at object creation, so basically Hibernate doesn't know what the gently caress because it sees everything as detached. saveOrUpdate is broken, persist is broken, one-to-many collections are broken, and we're piling more and more dirty hacks on top of the legacy dirty hacks because "what we had worked before!" and the tech lead doesn't want to touch anything because we have a big mass of spaghetti code and no tests. All of my domain objects have pre-generated ids because it solves a bunch of problems and allows you to use the id as the only field in equals/hashcode (My ids are UUIDs). But, I also use a version column that doubles as optimistic lock protection and a hint to hibernate whether the object has been saved before or not.
|
# ? Feb 21, 2017 12:58 |
|
FateFree posted:All of my domain objects have pre-generated ids because it solves a bunch of problems and allows you to use the id as the only field in equals/hashcode (My ids are UUIDs). But, I also use a version column that doubles as optimistic lock protection and a hint to hibernate whether the object has been saved before or not. There are times when UUIDs are required for ids, but usually an auto-incrementing number is perfectly fine. Plus, UUIDs only offer 99.99999999% guarantee of uniqueness, while the auto-incrementing number provides 100%. Plus, if you're using a sequence (and you're prefetching a bunch of numbers in advance), it is slightly faster than generating a new UUID for each object. Why would you go with UUID? What's the advantage that I'm missing here?
|
# ? Feb 21, 2017 14:21 |
|
UUIDs can be generated offfline, make replication dead easy, and make keys truly unique, even between disparate applications. They should be your default choice for keys unless you're absolutely certain about the scope of your project. Edit: this is assuming your database actually has a proper type for UUIDs and you're not just dropping them in a chat column.
|
# ? Feb 21, 2017 14:31 |
|
You don't need a single source of truth for the ID which can be useful in distributed contexts.
|
# ? Feb 21, 2017 14:32 |
|
I have no real experience with making GUIs, and I'm learning javaFX stuff in this class I'm taking. It seems simple enough at first, fxml make perfect sense from my experience with html. But I cannot figure out how to make elements center properly. Google just tells me to use the setAlignment(Pos.CENTER) method, and it doesn't do anything. I've got a StackPane, which is coded in the fxml file, and in my code I create an AnchorPane and add it to the StackPane with stackPane.getChildren().add(anchorPane). But no matter what I do, anchorPane always just shows up in the top left of the stackPane. My understanding was that setAlignment(Pos) for containers set the alignment of the children, so I have stackPane.setAlignment(Pos.CENTER), but it doesn't help. What stupidly obvious thing am I missing? I have System.out.println telling me the size of stackPane, so I know that it's the width of the stage. My appologies if there's a seperate thread for javaFX bullshit, I didn't see one. edit: I have also tried StackPane.setAlignment(anchorPane, Pos.CENTER), which also does nothing. edit2: Thanks for being my rubber ducky. I never figured out how to center an AnchorPane, but I did determine that using another StackPane was going to be more appropriate for what I am doing, and it works just fine. Thanks. Snak fucked around with this message at 19:24 on Feb 21, 2017 |
# ? Feb 21, 2017 18:36 |
|
UUIDs can also be expensive to index, due to their size and being non-sequential
|
# ? Feb 22, 2017 01:45 |
|
Sedro posted:UUIDs can also be expensive to index, due to their size and being non-sequential Sequential can be expensive to insert, because of locking and sharding. (Depending on the system of course.)
|
# ? Feb 22, 2017 08:00 |
|
Volguus posted:Plus, UUIDs only offer 99.99999999% guarantee of uniqueness, If you generate 46 trillion of them.
|
# ? Feb 22, 2017 08:05 |
|
sarehu posted:If you generate 46 trillion of them. Heh, in theory that's correct. However, when you take into account the fact MAC addresses are not always unique, that system's time is not always in sync, that UUID generation algorithms are not always perfect, that number quickly shrinks to more earthly values.
|
# ? Feb 22, 2017 12:27 |
|
Well no true Scotsman generates UUIDs with a higher than 0,00000001% chance of collision after generating 46 trillion of them.
|
# ? Feb 22, 2017 12:36 |
|
Though I don't know anything that has better guarantees for uniqueness and is easy to come by.
|
# ? Feb 22, 2017 14:48 |
|
BabyFur Denny posted:Though I don't know anything that has better guarantees for uniqueness and is easy to come by. Authoritative DB polled for each required unique value! Mmo from the 00s I was on had a desktop under an engineers desk that would listen on a tcp socket, return an integer and update its internal count. Completely unique and ghetto af. The tools would just ping it whenever they needed a unique Id that was unique across all designers and branches.
|
# ? Feb 22, 2017 17:37 |
|
Apparently if you have a one-to-one Hibernate relationship, and you define it as lazy, it doesn't actually make it lazy. Because there is no way to give you a pointer that might need to be null if the other side of the relationship doesn't exist. (I think that's the reason.) So every time you fetch the parent, it fetches the child in a separate query. I feel like that deserves a warning or something. And there's no easy fix to it either.
|
# ? Feb 25, 2017 15:03 |
|
smackfu posted:Apparently if you have a one-to-one Hibernate relationship, and you define it as lazy, it doesn't actually make it lazy. Because there is no way to give you a pointer that might need to be null if the other side of the relationship doesn't exist. (I think that's the reason.) So every time you fetch the parent, it fetches the child in a separate query. What about defining it as many-to-one with "insert=false update=false" and the key column also being the ID column?
|
# ? Feb 25, 2017 17:02 |
|
Paul MaudDib posted:maven builds etc. Wanted to thank you again for this and give a small update on this in case anyone else finds it helpful: I basically wrote our own build script that incorporates all the options we may need for Maven and what each build needs. I wrote a script that uses the git log / status to find out what changed and what needs built with each build and took Maven out of the decision tree. As for the caching issue mentioned, I've found that adding "-U" works 99% of the time, but with some random issue I downloaded an apache directory structure html file instead of a POM file from maven central in reference to sonatype. It was bizarre. But deleting /.m2/repostory/affected/path took care of it. (Didn't need to delete my whole .m2/repo) After 99% of our problems were solved, we found one major one last week for which I don't have an answer of why, but a solution when it comes down to Environment vs. Gradle vs Maven. We have our Common library (db connection, etc. shared among apps) and our Application WAR. Both the Common Lib and WAR have resources/package*.properties files. For the last 18+ months we've used an unholy alliance between Gradle and Ant and never used Gradle for full dependency management because reasons outside of my control and doing (ie: I wasn't involved). During the cutover on Friday week we hit a snag. In our QA environment, with Maven builds promoted from Jenkins (running on Ubuntu 14), we started getting properties / ResourceBundle errors in our Application (from the WAR build) that were rooted in our Common Lib ("This property could not be found, etc.) causing all sorts of issues. These didn't present themselves in builds locally on our own machines (MacOS). So we built a WAR from our local machines and uploaded that WAR file to QA directly from my laptop. It worked perfectly as we expected. But the build from Jenkins (on Ubuntu) did not. Late Friday, my boss said with all other options exhausted at the moment, "Common and App both have the same file name structure when it comes to properties files, they're all 'package.properties'. - What IF something is going on in the classpath?" So in Common, I changed the properties file name from something like package_es.properties to common_es.properties (for each language) and it solved our issue. It makes sense to me when I think about it: why "common/src/main/resources/package.properties" would interfere with "app/src/main/resources/package.properties" but why Gradle forgave this vs Maven (depending on environment) I do not. After working nearly nonstop on converting our app to Maven the last few weeks, I don't care as long as it works. But I would like to know if anyone has an answer. tl:dr - in each of your libs, it might be a good idea to have a unique name for your properties files so you don't have collisions in your classpath.
|
# ? Feb 27, 2017 04:30 |
|
Anyone here have experience working with CORBA? I'm just starting out with it, and I'm having some trouble. My program is a very, very basic auction house program that, ideally, allows users that are not the seller to bid on the item and the seller to sell it, as well as various functions to check the status of the auction. My problem is that, while the program is successfully storing all of the information about the auction to the server, and I get the same information every time I access it across different clients, I'm getting weird false values whenever I try to check if the current user is the seller or the high bidder - which right now means just checking their name string against the auction.seller and auction.highBidder strings in the server. Anyone know what might be up? These functions work: code:
code:
There's other functions that I haven't tested yet because they depend on the user being the seller. Is this some specific property of CORBA that I'm running into, or is it more likely I've simply messed up the logic somewhere? Everything else is just helper files generated by idlj, a very simple server program to pass values to and back from these functions, and a very simple client function to let them put in a userID and access these functions.
|
# ? Mar 5, 2017 06:29 |
|
|
# ? Jun 3, 2024 06:09 |
|
Does it work with currAuction.seller.equals(userID) instead?
|
# ? Mar 5, 2017 06:43 |