|
Volmarias posted:You may wish to file a bug to eclipse.org about this. The only advantage you can get by installing IntelliJ is that once you pay them a boatload of money you have a leg to stand on when you yell at them to fix their own bugs yesterday. With Eclipse the only thing you can do is to ask nicely.
|
# ? Nov 12, 2015 14:33 |
|
|
# ? Apr 19, 2024 12:21 |
|
The free version is just fine for Jaba
|
# ? Nov 12, 2015 16:34 |
|
NinetySevenA posted:I have a strange problem with Eclipse. e: Still happens even without the space. Yep, that's a bug. carry on then fucked around with this message at 16:55 on Nov 12, 2015 |
# ? Nov 12, 2015 16:52 |
|
NinetySevenA posted:I have a strange problem with Eclipse. Wow that's hosed. At first I thought you were typing (System.in;) and I was gonna say well, that's weird behavior but just don't do that. But you're not, you're typing (system.in); and its deleting the paren. That's a bug for sure. Honestly I have most of the automatic paren stuff in eclipse turned off. I don't mind typing them but the automatic stuff is too inconsistent, there's some weird behaviors in there.
|
# ? Nov 12, 2015 18:51 |
|
We're migrating our Web tools off of an old VM running JVM 1.6.0 onto a newer one running 1.7.0_79. One of our tools uses myBatis to generate large INSERT queries that are used as part of hourly data ETL. It's a MySQL server, and we're connecting through a JDBC javax.sql.DataSource. On the OLD server, with JVM 1.6, a series of inserts totaling ~10,000 rows only takes about 10 seconds, but on the NEW one it takes like 3 or 4 minutes! What the hell? I've been looking into this issue for like 10+ hours this week, tweaking different dependencies/includes, and I have no loving idea. We only recently narrowed it down to the JVM itself, after many test cases on different VMs, different networks, and different Tomcat versions. What changed between JVM versions that would make a query slow down so much?
|
# ? Nov 12, 2015 20:59 |
|
have you tried skipping straight to 1.8 instead
|
# ? Nov 13, 2015 04:53 |
|
So you can take a working application, change JAVA_HOME and it breaks? That's hard to believe
|
# ? Nov 13, 2015 06:07 |
Is it using addBatch & executeBatch? Have you tried profiling with the different java versions to see what it's spending time doing?
|
|
# ? Nov 13, 2015 08:54 |
|
When behavior like this happened to me before (version X behaved one way, version Y was completely different) it was due to the fact that the lower version had a "bug" that I was unknowingly taking advantage of. Got fixed in the more recent versions, and my application was no longer behaving as expected. To your problem, the only reason that comes to my mind for taking that long to insert that many queries would be that is doing each insert within a transaction, while before it was probably grouping all inserts in a transaction. Beginning and committing a transaction can take a long time. Are you controlling the transaction properly? Are you letting the JDK/libraries control that? Other than that ... I have no other explanation.
|
# ? Nov 13, 2015 14:21 |
|
Digging up some old poo poo, because I've been too absorbed with work lately. Zaphod42 posted:Syntactic sugar is any little tricks of the programming language which let you do more with less and keep things really clean. Things like auto-boxing. Interesting, once again I made up my own wonky definition; I thought that SS referred strictly to syntax short cuts that the developers put in just to make your life easier. Like concatenating Strings with the plus sign (stringOne + " " + stringTwo), instead of having to call the String.Concatenate Method multiple times. I see your point, though. Cicero posted:I'm going to try teaching programming to a couple of friends. I'm an Android dev, so assuming this doesn't fail miserably, I'm gonna start with plain Java (command line + Notepad++) and then transition to Android Studio. Does anyone have any recommendations as far as books go? I've been doing this for the last two months. While the official Java Tutorial trail is great, it's dense, and hard to navigate. I like to use it in conjunction with this guy's tutorial, it often helps me understand a topic better when I've read BOTH treatments. http://tutorials.jenkov.com/java/index.html Also, I'm a big fan of the Sams Teach-yourself books. The "Java in 24 Hours" starts off REALLY slow if you already know how to program (it doesn't get into Objects until chapter 10!!!), but it gave me a lot of contextual information about how Java is used, and how it's evolved. http://www.amazon.com/gp/product/0672337029
|
# ? Nov 15, 2015 15:22 |
|
Squashy Nipples posted:Interesting, once again I made up my own wonky definition; I thought that SS referred strictly to syntax short cuts that the developers put in just to make your life easier. By Zaphod's definition convenience methods would be considered syntactic sugar. Except they're actually methods and have nothing to do with syntax.
|
# ? Nov 16, 2015 03:55 |
|
I usually think of syntactic sugar as "another, easier/shorter way of doing something in the syntax of the language specifically." Isn't String concatenation (usually) just syntactic sugar for a StringBuilder, for instance?
|
# ? Nov 16, 2015 04:05 |
|
carry on then posted:I usually think of syntactic sugar as "another, easier/shorter way of doing something in the syntax of the language specifically." Isn't String concatenation (usually) just syntactic sugar for a StringBuilder, for instance? Pretty much. Under the hood, string concatenation via + creates a StringBuilder from the first string, then appends the rest of the strings in that statement, then returns toString from that builder. That's why you see the typical low-end interview question of quote:Why is this wrong? The reason is that for every iteration through that loop, you're creating a new StringBuilder out of the current value of resultString, instead of just creating one and constantly appending to it. In addition to being generally suboptimal, it can cause memory thrashing. For example, consider the case where resultSet contains a million strings of 10 chars. How large is the returned string, and how much memory did you just take up to get there? Rather than making your own StringBuilder like a caveman, you let the language do the hard work for you. Similarly, foreach really just iterates over an Iteratable's Iterator, rather than having you do the CS freshman work of making that iterator yourself, or writing yet another for(int i = 0; i < foo.size(); i++). If you wrote the code to iterate over the iterator yourself, you'd likely end up with the same bytecode. Volmarias fucked around with this message at 06:29 on Nov 16, 2015 |
# ? Nov 16, 2015 06:25 |
|
Volmarias posted:If you wrote the code to iterate over the iterator yourself, you'd likely end up with the same bytecode. See yeah, this is what I think of when it's syntactic sugar. An easier way to do a common syntactical operation in the code that just gets compiled down to the other way.
|
# ? Nov 16, 2015 06:36 |
|
Is there a better way than this of matching objects to a group of known objects?Java code:
|
# ? Nov 16, 2015 17:25 |
Squashy Nipples posted:Also, I'm a big fan of the Sams Teach-yourself books. The "Java in 24 Hours" starts off REALLY slow if you already know how to program (it doesn't get into Objects until chapter 10!!!), but it gave me a lot of contextual information about how Java is used, and how it's evolved. Sweet, glad to hear you like those
|
|
# ? Nov 16, 2015 19:33 |
|
baka kaba posted:Is there a better way than this of matching objects to a group of known objects? Hmm, I'm not sure I understand the point of it. Here's what I understand: matchesA1 becomes preceding[X] when preceding[X] equals A1. Now ... if preceding[X] equals A1 why not just say: matchesA1 = A1? Or ... simply use A1. Since you call equals on them and since you assign one to the other, it must be true that matchesA1, preceding[X] and A1 are equivalent and even equal. Or, if this is a unit test (presumably from the fail method), and just want to check if whatever you put in you got back, you can also do: code:
|
# ? Nov 16, 2015 21:50 |
|
Data Graham posted:Sweet, glad to hear you like those Why, which one did you write?
|
# ? Nov 16, 2015 21:51 |
Rather not say for reasons, but I wrote a couple and tech edited several others. No Java ones though.
|
|
# ? Nov 16, 2015 22:32 |
|
Volguus posted:Hmm, I'm not sure I understand the point of it. Here's what I understand: Yeah it's a unit test - basically I'm writing two different structures into a database and making sure I get the same two back, and I'm not assuming anything about the ordering so I need to match them to their appropriate source objects There's a bit more after that (some assertions to make sure each object's related structure is correct - they each represent a different test case) which is why I'm assigning them to a variable, but I was just wondering about the matching problem really. The map idea seems like a good fit for larger collections, I was just wondering if there was a slick solution to it The 'just use A1' thing is a good idea, but I'm checking things not covered by my equality test (they're nodes and I'm checking the tree, maybe this is a horror) which is why I want to keep the original around. Also Hamcrest is not a name I'm making friends with baka kaba fucked around with this message at 22:49 on Nov 16, 2015 |
# ? Nov 16, 2015 22:43 |
|
baka kaba posted:Yeah it's a unit test - basically I'm writing two different structures into a database and making sure I get the same two back, and I'm not assuming anything about the ordering so I need to match them to their appropriate source objects If it's a unit test, horror or not it doesn't matter (...much), as long as you keep each test very small. Make 100 test methods if you need to, but each of them should test only one little thing. In setup put some values in, then in the test methods you can: - get values, do i have one with id 1? cool, pass - get values, do i have one with id 2? cool, pass - get the value with id 1,does it have property X equals "Y"? pass - get the value with id 2,does it have property X equals "Z"? pass ...... and so on and so forth. And the test DB is a memory DB, therefore nothing remains in there. Clear it after each test if needed.
|
# ? Nov 17, 2015 04:01 |
|
Has anyone used Google Web Tools? My Eclipse version is Mars, but the most recent version for the eclipse plugin Google has is Luna. Will that work? Do I need to change anything?
|
# ? Nov 17, 2015 20:56 |
|
Do you mean Google Web Toolkit? If so, I've never had issues using a newer version of eclipse with an older plugin. I think where you'd run into issues is if you tried to use a newer plugin (GWT-Luna) with an older version of eclipse (Kepler).
|
# ? Nov 17, 2015 23:08 |
|
Yep, sorry. That's what I was thinking of. Thanks. It seems like it's working with the older version of the toolkit, thankfully.
|
# ? Nov 17, 2015 23:43 |
|
baka kaba posted:Yeah it's a unit test - basically I'm writing two different structures into a database and making sure I get the same two back, and I'm not assuming anything about the ordering so I need to match them to their appropriate source objects Why not use Collections and do something like this code:
|
# ? Nov 18, 2015 19:57 |
|
Volguus posted:If it's a unit test, horror or not it doesn't matter (...much), as long as you keep each test very small. Make 100 test methods if you need to, but each of them should test only one little thing. In setup put some values in, then in the test methods you can: Yeah it kinda is set up like that, I have a test to add stuff and get their IDs, and then try to pull those IDs back out. This is a test that goes deeper and checks other objects have been attached. I don't think it's doing too much for a single test, it's just getting two objects and checking each has the right structure - I just need to identify which is which first. I was just wondering about the matching problem FieryBalrog posted:Why not use Collections and do something like this Well with Sets you can just do .equals() if they're meant to contain the same objects! But the point is matching the initial objects to the created ones so I can test each appropriately. I'd probably just do something with a map and make sure every entry is mapped to its equivalent (and only for existing entries) if it was a bigger bunch of objects, I was just curious if there's a library or a special collection or something that's suited to it. It's always good to look around and see what's hiding out there
|
# ? Nov 18, 2015 21:02 |
|
I have a web application where one of the requirements is to allow the main .css file to be changed through a UI (running a tomcat server). How can I go about doing this? Can I simply copy the contents into a textarea, and let them submit it back to a controller where I overwrite the original css file? I imagine the war would need to be exploded to do this, but are there any other reasons it might not work?
|
# ? Nov 24, 2015 05:17 |
|
FateFree posted:I have a web application where one of the requirements is to allow the main .css file to be changed through a UI (running a tomcat server). How can I go about doing this? Can I simply copy the contents into a textarea, and let them submit it back to a controller where I overwrite the original css file? I imagine the war would need to be exploded to do this, but are there any other reasons it might not work? Frankly I would fight against such requirement. All the components of the site should be under version control and the site ought to be built from what's submitted there. How else can you offer any guarantees (or just peace of mind) about things working if you don't know what's actually running in live?
|
# ? Nov 24, 2015 07:28 |
|
FateFree posted:I have a web application where one of the requirements is to allow the main .css file to be changed through a UI (running a tomcat server). How can I go about doing this? Can I simply copy the contents into a textarea, and let them submit it back to a controller where I overwrite the original css file? I imagine the war would need to be exploded to do this, but are there any other reasons it might not work? First you should figure out what's the actual requirement. "modify css through a UI" is not a requirement. What do they actually want?
|
# ? Nov 24, 2015 07:33 |
|
How do you guys feel on using the super keyword for calling a method, even though the current class doesn't override the method?
|
# ? Nov 24, 2015 09:54 |
|
I've never seen anyone do it before, and conceptually I'm not a huge fan of the idea. It's either entirely pointless (if no-one ever overrides that method in the future), or it's surprising to whoever does override that method later (because now the class has an inconsistent idea of what that method does). What scenario are you considering?
|
# ? Nov 24, 2015 10:11 |
|
Nothing specific, there was just someone who used it a bunch of times in some code I was bug fixing, and I thought it was dumb.
|
# ? Nov 24, 2015 10:14 |
|
FateFree posted:I have a web application where one of the requirements is to allow the main .css file to be changed through a UI (running a tomcat server). How can I go about doing this? Can I simply copy the contents into a textarea, and let them submit it back to a controller where I overwrite the original css file? I imagine the war would need to be exploded to do this, but are there any other reasons it might not work? What I would do would be to save the contents of what they're modifying in the database and just inject that into the page (after the real main.css has been loaded) into a style element. Then you don't have to worry about modifying anything on disk, and can even be injected on a per-user basis if anyone would want that.
|
# ? Nov 24, 2015 13:51 |
|
Sedro posted:It's a dumb requirement, but no you don't modify the war. Store the modified css in your database/filesystem/wherever your application stores things, and serve the original file if the modified copy doesn't exist. They want an application that they can deploy on separate servers/databases for different clients and have a different look and feel for each one, meaning logo and color schemes. So I was basically going to build an admin area to let them upload the logos and change the color scheme. I can easily have a backup or revert to default if they hose it but the question is if I store it in the database, I doubt I would want to serve it up from the database each time right? Even if it was cached, I figured the better approach would be to modify the file on change so its served up semi-statically. Edit - I guess another approach is to construct the css out of a jsp file and store the colors as simple properties in a db. FateFree fucked around with this message at 13:54 on Nov 24, 2015 |
# ? Nov 24, 2015 13:52 |
|
Boz0r posted:How do you guys feel on using the super keyword for calling a method, even though the current class doesn't override the method? It's definitely a code smell; you typically only ever want to use that when overriding a method to call the parent implementation to get its behavior before adding your own. If you don't want a method to be overridden further, you should make it final. I can't think of any good reason to want to do this, except for maybe some weird introspection stuff. Seeing a method call super for another method should set off big alarm bells, since it's explicitly ignoring behavior set by subclasses. If the person who wrote this didn't leave comments as to why, track them down if you can and ask what in the world they were thinking. Good odds are that they weren't.
|
# ? Nov 24, 2015 14:17 |
|
Yeah, that person stopped before I got hired.
|
# ? Nov 24, 2015 15:06 |
|
Boz0r posted:How do you guys feel on using the super keyword for calling a method, even though the current class doesn't override the method? Its like using the this keyword on everything but worse.
|
# ? Nov 26, 2015 22:55 |
|
Edit: nm
|
# ? Nov 27, 2015 02:36 |
|
Zaphod42 posted:Its like using the this keyword on everything but worse. At work if we don't add this. its a sonar violation and we are ordered to fix it. same with a default constructor that calls Super, because the client cant get that it is implicit.
|
# ? Nov 27, 2015 08:21 |
|
|
# ? Apr 19, 2024 12:21 |
|
Does anyone have a recommendation of a book to learn java for a complete newbie?
EpicCareMadBitch fucked around with this message at 13:47 on Nov 27, 2015 |
# ? Nov 27, 2015 13:40 |