• cheeser
  • ernimril
  • joed
  • kinabalu
  • lunk
  • ojacobson
  • r0bby
  • ThaDon
  • ricky_clarkson
  • topriddy

« 2019-10-07


2019-10-09 »

Nick Message Date
zalt [zalt!~lambda443@unaffiliated/lambda443] has joined ##java [12:15]
g00s [g00s!~g00s@unaffiliated/g00s] has joined ##java [12:23]
tassee [tassee!] has joined ##java [12:34]
sleepywitch [sleepywitch!] has joined ##java [12:39]
djhworld [djhworld!~djhworld@] has joined ##java [12:40]
moeng00 [moeng00!~moeng@2001:41d0:1:ff97::1] has joined ##java [01:21]
hypc1 [hypc1!~Thunderbi@] has joined ##java [01:24]
rajrajraj [rajrajraj!uid72176@gateway/web/] has joined ##java [01:29]
VegetarianFalcon [VegetarianFalcon!uid258908@gateway/web/] has joined ##java [01:33]
exonity01 [exonity01!uid364582@gateway/web/] has joined ##java [01:34]
g00s [g00s!~g00s@unaffiliated/g00s] has joined ##java [01:36]
rajrajraj [rajrajraj!uid72176@gateway/web/] has joined ##java [01:47]
palasso [palasso!~palasso@unaffiliated/palasso] has joined ##java [01:50]
wyre [wyre!~wyre@unaffiliated/wyre] has joined ##java [01:55]
gareppa [gareppa!~gareppa@unaffiliated/gareppa] has joined ##java [02:07]
YachtRocker [YachtRocker!] has joined ##java [02:19]
acidjnk_new2 [acidjnk_new2!] has joined ##java [02:24]
tracks [tracks!~tracks@2600:1700:ade0:4400:b5b7:33eb:6391:20cb] has joined ##java [02:32]
progart [progart!~kamee@] has joined ##java [02:32]
Tichodroma [Tichodroma!~lutz@fsf/member/Tichodroma] has joined ##java [02:33]
jaziz [jaziz!~jaziz@unaffiliated/jaziz] has joined ##java [02:37]
[[thufir]] [[[thufir]]!~thufir@] has joined ##java [02:37]
hypc1 [hypc1!~Thunderbi@] has joined ##java [02:38]
freedom_ [freedom_!~freedom@] has joined ##java [02:44]
Bebef [Bebef!] has joined ##java [02:48]
tracks [tracks!~tracks@2600:1700:ade0:4400:70df:53f0:20d5:1b88] has joined ##java [02:53]
[[thufir]] [[[thufir]]!~thufir@] has joined ##java [02:56]
KidBeta [KidBeta!~Kidbeta@hpavc/kidbeta] has joined ##java [03:06]
sdu [sdu!] has joined ##java [03:09]
ravenousmoose [ravenousmoose!] has joined ##java [03:11]
wyre [wyre!~wyre@unaffiliated/wyre] has joined ##java [03:12]
KidBeta [KidBeta!~Kidbeta@hpavc/kidbeta] has joined ##java [03:13]
Matthijs [Matthijs!~quassel@unaffiliated/matthijs] has joined ##java [03:21]
Chuguniy [Chuguniy!~Chuguniy@] has joined ##java [03:27]
plitter [plitter!~plitter@] has joined ##java [03:34]
Nicmavr [Nicmavr!~Nicmavr@unaffiliated/nicmavr] has joined ##java [03:34]
Celmor[m] I have a strong feeling I can do this better (assignment in constructor), starting with using Optionals, but is there an even better way since it's a "mere" copy operation? `this.payload = payload == null ? null : Arrays.copyOf(payload, payload.length);` [03:35]
surial how would optionals help here? [03:37]
surial Celmor[m]: to do null handling properly, semantically unroll as first step. [03:37]
hypc1 [hypc1!~Thunderbi@] has joined ##java [03:37]
surial Celmor[m]: so, let's do that! [03:37]
surial Celmor[m]: what does an empty array mean, here? What does null mean, here? Are these meanings the same, or is there a semantic difference? [03:37]
atrament666 [atrament666!] has joined ##java [03:38]
Celmor[m] if I get an empty array I wannt keep an empty array, if I get null I wanna keep null, a simple assignement for the constructor really [03:38]
surial that's.. not doing what I said to do. [03:38]
surial Celmor[m]: you've jumped from 'problem' to 'solution' and are now asking about how to implement the solution. I'm trying to point out that you perhaps happened fully considered the problem yet. [03:39]
surial Celmor[m]: What is the meaning of this.payload == null? What is the meaning of this.payload != null && this.payload.length == 0? Why are these 2 conceptually different? [03:39]
Celmor[m] an empty payload is different from unset payload [03:40]
Celmor[m] empty being an array of length 0 [03:40]
surial If it helps you orient on this question: Dealing with the notion that the array could be null is itself really annoying, and optional wouldn't help (dealing wht an Optional<array[]> is silly on its face, the only real benefit to arrays is speed, and optional is slow, so.. ???? ? why isn't that a list then? - and even if you forget about that bit, having to deal with both an empty array as well as the optional.none is tedious). [03:40]
surial Celmor[m]: okay, so, an unset payload is semantically relevant. Can you store that some other way? A boolean perhaps? [03:41]
Celmor[m] with the difference that it had been initialized and given a payload at least once [03:41]
surial it's fine to decide to store the notion of 'payload hasnt been calculated yet' (as a different semantic meaning to: Payload HAS been calculated; it is empty) as null array vs. the 0-len array referencing 'there is a payload; it is empty'. [03:41]
surial but we're well beyond 'this should be simple but null makes it hard'. you are doing the tricky job of conflating 2 unrelated concepts into a single variable by abusing null as a flag. [03:42]
surial Which is fine, just.. what you wrote is a direct syntactic representation of the semantics of this. an if (well, at ernary operator, but same difference, right?) [03:42]
surial I guess you could go, in your mind: Maybe the job of 'copy this array POINTER, which means: If null, return null, if not null, make a copy and return that', but that's not really a method that ought to exist. Or at least, it should be documented as this weird forky method that does 2 unrelated things. [03:43]
Celmor[m] the only thing the null check here is supposed to do is avoiding the nullpointer error when I'm trying to copy the array... [03:43]
bnyio [bnyio!] has joined ##java [03:43]
surial Right, but you're jumping to the conclusion again. [03:43]
dendazen [dendazen!] has joined ##java [03:43]
surial Stick to semantics and clear that up before you move on to how to get it done syntactically. The job you want is: IF null, do not make a copy and store null, IF NOT null, make a copy. It SOUNDS like you should be able to marry that into a single concept ('make a copy; a copy of null is simply null'), but that's.. not actually correct. [03:44]
surial So, what you have is great! [03:44]
Celmor[m] so what am I supposed to do, the logic is already implemented and working, I only wanna improve readability/code-cleanliness [03:44]
surial this.payload = payload == null ? null : Arrays.copyOf(payload, payload.length); is precisely right. It is not too complicated; semantically you have a fork, your code has 1 fork, all is well. [03:44]
surial Celmor[m]: THat's my point! [03:44]
surial Your code IS as readable and as clean as could be; semantics and syntactically it lines up. [03:44]
bendem that ternary is fine really, adding anything else will be just that, "adding" [03:45]
bendem adding cruft doesn't make cleaner code [03:45]
bendem especially Optional cruft [03:45]
Celmor[m] I'm using that form of ternary multiple times in that classes constrcutors to the point I'm getting code duplication warnings [03:45]
Celmor[m] so I wanted to explore alternatives [03:46]
bendem you could create a helper to handle nulls, I have one somewhere that I tend to include to have a better alternative to Optional. That would look like this.payload = nullSafeGet(payload, Array::copyOf) [03:47]
bendem but I wouldn't write that unless you have to deal with that literally everywhere [03:48]
Celmor[m] how does copyOf get the arrays length in your example? [03:49]
bendem right, payload is a primitive [03:50]
bendem you'd write nullSafeGet(payload, p -> Array.copyOf(p, p.length)) [03:50]
bendem actually, aren't arrays clonable? [03:51]
bendem nullSafeGet(payload, int[]::clone)? [03:51]
bendem I don't know why copyOf doesn't have overloads for same length array tbh [03:54]
bendem I guess people at oracle are aware of it [03:59]
bendem bendem's title: "array clone() vs Arrays.copyOf()" [03:59]
bendem Celmor[m], if you are interested, here is an exerpt of the class in our company toolbet [04:00]
bendem [04:00]
troulouliou_div2 [troulouliou_div2!~troulouli@unaffiliated/troulouliou-div2/x-0271439] has joined ##java [04:01]
nokdoot [nokdoot!~nokdoot@] has joined ##java [04:06]
hypc [hypc!~Thunderbi@] has joined ##java [04:08]
ener2 [ener2!] has joined ##java [04:11]
surial Celmor[m]: I would advise against nullSafeGet and such. This is making your null handling in your code WORSE, by inviting you to conflate the semantics. [04:11]
surial Celmor[m]: if you're getting code dupe warnings, make the forky thing as a method: public <T> T[] cloneArrayOrNull(T[] in) { if (in == null) return null; return Arrays.copyOf(in, in.length); } [04:12]
rohdef [rohdef!~rohdef@] has joined ##java [04:13]
surial Celmor[m]: alternatively, and I tried this before and it didn't seem like you were interested, I would strongly reconsider your semantics, again. What you've written is a constructor with one parameter and that parameter itself ALSO conflates semantics: If you pass null, that's your-api-ese for 'create the object with an as yet not configured payload' and if you pass anything else, it is 'create the object with this payload'. [04:13]
surial This is... bizarre. [04:13]
Celmor[m] thanks [04:13]
surial Why? This is just bad API. [04:14]
surial ONe would presume that your design is such that either [A] payload is a notion that can be set at any time; so, mutable, there is a setter, etc. OR, [B] payload is a notion that must be set on constructor and cannot change, so, immutable. [04:14]
surial In the immutable case, 'as yet unset' is not appropriate, so if I pass null to your constructor it should throw NPE. [04:14]
surial In the mutable case, why have a constructor in the first place? For convenience? Okay, but then also make a no-args one that doensn't set the array, and enforce the notion that IF you call the with-array variant, it MUST be a real payload. [04:15]
Jigsy [Jigsy!~Jigsy@unaffiliated/jigsy] has joined ##java [04:15]
surial this 'null means unset, anything else means it is set' as part of the API is just exporting this implementation detail / hacky move of using a single field to register 2 separate concepts, onto your public API and thus your callers. It's infecting your code with it. [04:15]
surial so: /** Creates a new thingie with an unset payload. */ public MyThingie() {this.array = null;} /** Creates a new thingie with the provided payload */ public MyThingie(@NonNull Foo[] payload) {this.array = Arrays.copyOf(payload, payload.length); } [04:17]
surial that should avoid code dupe warnings. If your code dupe finder tool considers repeated Arrays.copyOf calls in related code 'code duplication', tone that thing down a bit. [04:17]
surial because coding is hard and extremist avoidance of code duplication leads to a forest of tiny utility methods which is a bit spaghetti like. Also bad. [04:17]
ravenousmoose [ravenousmoose!] has joined ##java [04:22]
Jigsy [Jigsy!~Jigsy@unaffiliated/jigsy] has joined ##java [04:32]
KidBeta [KidBeta!~Kidbeta@hpavc/kidbeta] has joined ##java [04:34]
Celmor[m] surial: it's not the only assignement, it has many more in the constructor [04:35]
surial Celmor[m]: you can make a private 'utility constructor' that doesn't throw. [04:36]
surial your public API has 2 constructors; one that does take the array (in which case it must not be null) and one that does not. [04:37]
Jigsy` [Jigsy`!~Jigsy@unaffiliated/jigsy] has joined ##java [04:37]
surial Because now you're conflating implementation details and your API. [04:37]
surial The public bits of your class need to be as logical and simple as you can make them. Once you've mapped that out, HOW you write them is.. implementation detail. You should never intentionally obfuscate your API unless you have extreme proof you must do it (for example, a profiler report that says your workarounds to make an API work are resulting in measurable (as per the profiler report) performance issues). [04:38]
surial having an API with a field whose specification says: "If null it means one thing, and if not null something entirely different" is not as simple as it could be. [04:38]
Celmor[m] The api part simply takes the input and assigns it to the fields of a new DTO (usually from the contents of a db), I have different DTOs if I want the same object but with less information (like if I want to never have the payload but rather only metadata). fetching the payload in the case I wanna have the "full" dto is already an expensive operation [04:41]
dreamreal Celmor[m]: *shrug* do what works for you, but surial's kinda right [04:42]
surial This already sounds like a lot of weirdness in the API for performance utility. Which can be fine, but also worrying about such things as 'code duplication warnings' is a clear mismatch. [04:42]
Celmor[m] if there's null or not means the same thing as for the property of the entity in the db [04:42]
surial So, given all that, and your clear resilience in working on the API (probably justified, don't get me wrong).. it sounds like the answer is: Turn off the overeager code cleanliness checker. [04:42]
Celmor[m] the code duplication warning itself is fine, points me to parts I could potentially make better, just thought that I could improve that particular part with new "syntactic sugar" like Optionals [04:47]
surial Optional.ofNullable(payload).orElse(null); could do it. But this is.. not cleaner code in the slightest; it's worse. Just because your code cleanliness tool may not trigger on it doesn't make it any cleaner. [04:48]
x6e69636f [x6e69636f!4dc15c84@gateway/web/cgi-irc/] has joined ##java [04:49]
surial it also makes a needless object. [04:49]
surial and optional isn't syntactic sugar. optional could have been written in java 1.5. [04:49]
Jigsy` [Jigsy`!~Jigsy@unaffiliated/jigsy] has joined ##java [04:50]
x6e69636f Hi all, I'm not sure what's the proper way to do if I want some subclasses to redefine fields of an inherited abstract class, but still ensure the abstract class getter will return the subclass field value ... (I mean, it's the way I would like to do it but I know that's not possible as is, so what should I do instead ?) [04:50]
bendem xy [04:51]
bendem XY Problem: You have problem X, and you think Y is a good solution, so now you are asking about how to do Y. However, maybe Y is not a good way to solve X. Maybe you should take a step back and tell us about X first. More: [04:51]
KidBeta [KidBeta!~Kidbeta@hpavc/kidbeta] has joined ##java [04:51]
surial x6e69636f: you cannot redefine fields, period. [04:51]
surial x6e69636f: hence, I fully support bendem's analysis: This is an X/Y problem. [04:51]
Celmor[m] what about the usage of optiona in this case? [04:52]
x6e69636f I want to pass an ExcelFileBuilder a list of SheetdBuilder each having a title, a list of columns, and some data to transform into an ExcelSheet ; but the ExcelFileBuilder will receive different kinds of SheetBuilders without knowing their exact type, they all just extend AbstractShieldBuilder [04:53]
surial fucking stupid. [04:53]
hypc1 [hypc1!~Thunderbi@] has joined ##java [04:53]
surial Celmor[m]: seriously. horrible. [04:54]
Celmor[m] well, it's readable at least IMO [04:54]
surial x6e69636f: allright. sounds like whatever class receives them, if there is a utility in restricting to specific subtypes of ASB, that it should be class TheParentOfAllThisStuff<SB extends AbstractShieldBuilder> { ... } [04:54]
surial Celmor[m]: is it? [04:54]
surial Celmor[m]: I think that's the problem. It looks readable, but it is not. [04:55]
Celmor[m] better than a lot of of null checks for each operation [04:55]
Diablo-D3 stares at HN. When the fuck did they become so fucking anti-java [04:55]
surial Diablo-D3: always been. [04:55]
mbooth Diablo-D3: HN is bad for your mental health [04:55]
surial Celmor[m]: if you pass in null to this method, you get an empty optional. If you pass in a non-numeric string, you get an empty optional. [04:56]
surial Celmor[m]: that's fucking insane. [04:56]
x6e69636f surial I'll take a look [04:56]
Celmor[m] that's the point [04:56]
surial that's a dumb as fuck point then. [04:56]
Diablo-D3 I mean, I dont take HN that seriously as it is... anyone see my karma on there? its too fucking high [04:56]
surial That's what I keep trying to tell you. [04:56]
surial These are fine ways to implement dumb things. [04:56]
Celmor[m] point is to assign "null" if id is invalid (not a Long) or null [04:57]
surial If you have the problem: "I wish to take in a string, and then try to parse it as a number. If I cannot, either because null was passed or it isnt a number, then I want the code to continue on as normal, except, iwth a no-value concept. otherwise, continue with that value, and, while youre at it, toss it through some mapping operations".. [04:57]
KidBeta [KidBeta!~Kidbeta@hpavc/kidbeta] has joined ##java [04:57]
surial then yeah this is how to do it. BUt that is a BAD THING TO DO!! [04:57]
surial This approach of 'on error just silently do nothing' will result in code with a bug and you spending 4 hours finding the bug. [04:57]
xa0s_ [xa0s_!] has joined ##java [04:59]
surial Surely someone dong: resolveId("X") is a bug. That should result in an error. An exception, pointing immediately at the offending thing, is the best possible error: That means you will know about the bug, AND be able to know where AND fix it, in a matter of minutes. [04:59]
surial versus that code acting precisely the same as EITHER passing null OR having the mapper fail to resolve OR having the dto map it back to null. [05:00]
Celmor[m] only if you consider it to be an error that this particular field can't be mapped, in my case I simply handle the null in front-end and know that in this case there's no mapping to be found [05:00]
surial Celmor[m]: and to make matters worse, at the very end of all that weirdness, the code unrolls that optional back into a null! [05:00]
surial THat's not handling it well. [05:00]
surial If any non-numeric input always maps to null, why is that fact completely invisible? [05:01]
Celmor[m] well, I could log it, but the application shouldn't collapse because of wrong input [05:01]
surial YOu certainly can't tell from the signatures of any of these methods. You won't be able to tell from exception behaviour. You can only tell by going through it character by chacter and going: Sooo, if you .map(Long::parseLong), then an NFEx would occur and that turns into an empty optional and that gets unrolled back into a null. [05:01]
surial No, but this is the same problem YET AGAIN. This code conflates a ton of semantically separate concerns into one big black hole. [05:02]
surial Start with how you have a String containing an id. That's already fucked up, if ids can only be numeric. [05:02]
Celmor[m] well, it has some javadoc to explain that behavior above [05:02]
surial There are many explanations for why this happens. FOr example, it's an HTML input text field. I sure hope you HTML-side restricted that to numbers, but who knows what broken browsers or hackers do. But the solution is for your code to demand that it is numeric, and if it is not, to just error out then: The user put a non-number in a place where a number is needed. It would be _BAD_ to tell the user: Oh, sure, I didnt find [05:03]
surial anything. IT would be PROPER to tell the user: Hmm, we're not communicating properly or you misunderstand how this application works. You can't put text there. You gotta put a number. [05:03]
surial Celmor[m]: javadoc is a crutch. [05:03]
surial The best method is one that is so obvious from its signature alone that javadoc is superfluous. [05:03]
surial This notion that invalid input (a non-numbers-containing string where the entire code is such that the code doesn't even know what that could possibly mean, other than 'the user done messed up') will be just fine and carries allllll the way into the very innermost bit of this code, and then falls back out the same way a not-found ID would, _THAT_ is the problem with this code. It results in code you think is readable that [05:04]
surial clearly totally isn't. [05:04]
surial That's the worst kind of not readable code: Stealth unreadability. [05:05]
Diablo-D3 obscurity through obscurity [05:06]
Gazooo [Gazooo!~Gazooo@] has joined ##java [05:07]
royal_screwup21 [royal_screwup21!89de72f2@gateway/web/cgi-irc/] has joined ##java [05:08]
surial heh [05:10]
surial Celmor[m]: see how much simpler this code is: - it's shorter and every fork this code can make is matched by a syntactic construct that suggests 'fork'. [05:11]
surial surial's title: "Untitled - Linux.Community" [05:11]
KidBeta [KidBeta!~Kidbeta@hpavc/kidbeta] has joined ##java [05:12]
surial the signatures also belay how it works: My 'resolveId', by looking SOLELY at the method signature, makes it clear that an id turns into a string. If you really wanna go all out, make it: private @Nullable String resolveId(int id) { .... } and the signature explains virtually everything: The only logical leap that the reader of just the signature line has to make, is that an id that isn't found at all results in a null value. [05:13]
surial That's.. fairly obvious to make, I think. [05:13]
surial s/id turns into a string/an id, which must be an integer number, turns into a string, unless it isnt found and then you get null/ [05:13]
mbooth s/belay/belie/ ? [05:19]
Jigsy [Jigsy!~Jigsy@unaffiliated/jigsy] has joined ##java [05:19]
surial yes. [05:19]
Jigsy [Jigsy!~Jigsy@unaffiliated/jigsy] has joined ##java [05:24]
Jigsy` [Jigsy`!~Jigsy@unaffiliated/jigsy] has joined ##java [05:26]
ipee [ipee!] has joined ##java [05:28]
quadsar [quadsar!~quadsar@unaffiliated/quadsar] has joined ##java [05:31]
Celmor[m] surial: thanks for the suggestion. I "can't not" call the mapper if there's an invalid "id" through as the only step before the mapper is the db from which I return the entity and I'd think I shouldn't put any special handling there. my only other option is to log an exception. The frontend gets the output dto from a REST interface and I don't want to get no output because one field can't be resolved but I do agree that [05:34]
Celmor[m] there should be some kind of information somewhere if the pareLong didn't work [05:34]
surial Celmor[m]: great. THen, fix your REST interface entrypoint. [05:34]
surial The REST interface should expect a number for 'id', not a string. If for some reason you have a need to accept strings there, handle it there. Then the ingfection went the wrong way from that end. [05:35]
Celmor[m] fix in what way? there's no input given, just a requst made for the dto [05:35]
surial So, either [A] your REST API should clearly state a number, and only a number, is allowed in the 'id' column. [05:35]
mgrech [mgrech!] has joined ##java [05:35]
surial Apaprently your code reads the JSON you receive and picks up a -STRING-. fix your JSON read to read an int instead. If it's not JSON but straight form fields, upgrade your form-field-reading code; data validation and proper typing of input hsould happen RIGHT at the entrypoint. [05:35]
Celmor[m] I have 2 rest interface, 1 for the frontend which requests the dto by giving a uuid (different from the "id" here) and one I use internally to map the "id" to the resolved name [05:36]
surial so, instead of String id = getParam("id"), it should be: int id = getIntParam("id"), or, if it's jersey, public String webEntrypoint(@Param("id") int id) {}, not String id. [05:36]
Celmor[m] the String isn't read on a REST interface, it's read from a DB [05:36]
surial Celmor[m]: you do get that this resolveId() method accepting a string, that is the design fuckup here, right? [05:36]
Celmor[m] yeah but I can't change that, I have to resolve the string I get from the DB [05:37]
surial Celmor[m]: your private String resolveId(String id) {} method should be private String resolveId(int id) {} instead. [05:37]
Celmor[m] somehow [05:37]
surial WHY IS IT A STRING?? [05:37]
dreamreal Celmor[m]: and what happens if the String isn't actually a number? [05:37]
dreamreal And yes, why is it a string if it's supposed to be a number [05:37]
surial Try to find out, because this kind of i dunno, it doesn't even cross my mind how that is weird ? THAT is why I'm hammering on this entire concept of writing code (The concept of: Fuck it, map all unexpected values to null silently). [05:37]
surial s/null/empty optional [05:37]
KidBeta [KidBeta!~Kidbeta@hpavc/kidbeta] has joined ##java [05:38]
Celmor[m] the only case it wasn't a number which took me a while to troubleshot and is the source of catching the NumberFormatException is when I wrote "null" into the db [05:38]
gareppa [gareppa!~gareppa@unaffiliated/gareppa] has joined ##java [05:38]
dreamreal Celmor[m]: wh... [05:38]
Celmor[m] so there can only be a string in that column of the db if someone messed up that entry there [05:39]
dreamreal why did you write null into the DB [05:39]
dreamreal why is the type in the DB not numeric [05:39]
Celmor[m] cause I wanted to test how my code behaves on "null" (though I meant to set the value to null, not write the string null, the sql tool is kinda stupid) [05:39]
Celmor[m] I didn't design the DB and I can't change it to be numeric after the fact [05:40]
dreamreal you kinda can [05:40]
dreamreal alter table is a thing [05:40]
Celmor[m] so I still have to "parseLong" the existing values somewhere [05:40]
dreamreal you really don't :) [05:40]
dreamreal Celmor[m]: who owns the DB? [05:40]
Celmor[m] the production DB isn't under my control, it's under the control of whoever deployed the software in the first place [05:41]
Celmor[m] and if I alter it after-the-fact, what do you do if there's a non-parsable string in the colum... [05:41]
dreamreal Celmor[m]: so if it's me, I'm first doing some diligence: find out WHO THAT IS, and have them fix the DB [05:42]
dreamreal Celmor[m]: why would there be a non-parseable string in the column? That data would be inaccessible. [05:42]
dreamreal I mean, the conversion should look for nonconvertable values and fix them... somehow [05:42]
dreamreal that might mean removing the data, might mean assigning a new id, I don't know [05:42]
mbooth Celmor[m]: Presumably there is a way to add new features to your app that may require new fields or tables in the database, so you surely must be able to specify a schema change... [05:43]
dreamreal There might be a schema *conversion* but it sounds like it's required, if the schema is wrong [05:44]
mbooth I've never designed a database-driven app that didn't at some point require a schema change to fix a problem or add a feature. In my defence, the future is especially hard to predict :-) [05:45]
petsc [petsc!~petsc@] has joined ##java [05:45]
dreamreal mbooth: "I bet it will happen" [05:45]
mbooth / this should never happen [05:45]
Celmor[m] didn't say it's impossible to change the db schema,, it's just not under our control and changing it only upstream could break it if they don't handle the conversion properly, e.g. if there's a non-parsable string in the column [05:46]
dreamreal so... make sure they do? [05:46]
Celmor[m] I can pass it on but for now all I can change is the code itself so I guess I should handle the NumberFormatException differently [05:49]
dreamreal yeah, I'd ... catch it, and write a log message with some identifying data so that you have logs that you can take to teh DBA with "I TOLD you we needed to fix the freaking db, you moran" [05:49]
dendazen [dendazen!] has joined ##java [05:49]
dreamreal (and throw it as well, because if the data's invalid you're done) [05:50]
dreamreal it's not really a recoverable thing [05:50]
Celmor[m] if I throw an uncaught exception the frontend doesn't get the DTO at all, not just a dto with only that field missing, which is worse [05:50]
dreamreal that sounds like it's what SHOULD happen [05:51]
dreamreal "you asked for datum X, datum X is invalid because our DBA is a moron, here's a 500" [05:51]
dreamreal why would you want to hand around data that wasn't valid? [05:52]
dreamreal that creates an illusion of validity that... well, is illusory [05:52]
dreamreal and yes, I just used illusory as a word, get over it, it's engrish! [05:52]
dreamreal (it's actually english, too, but rare) [05:52]
surial Celmor[m]: because you've decided to deal with non-numeric input deep inside the code (both 'what to do if that db column contains the 4 characters N, U, L, and L, or anything else that doesnt form an integer' as well as the notoin that the type that falls out of your DB/DTO is 'String'), your code is ugly. [05:55]
surial Ugly in the sense of: If I read it, I likely draw the wrong conclusions. In the lucky case where I don't, instead I draw WTF questions. [05:56]
surial Celmor[m]: as dreamreal said, I think it is right to throw errors around (be it exceptions or 500s, whatever goes for 'you get NOTHING!' in whatever side we're on). If you decree that it is not, gievn that this is such a bizarre case, I would call it out in code. explicitly. [05:57]
enoq [enoq!~enoq@2a02:8388:6a87:b080:649f:9456:c1b1:28e4] has joined ##java [05:57]
surial as in: int id; try { id = Integer.parseInt(fromDtoThingie); } catch (NFEx | NullPointerEx e) { /* The DB uses a VARCHAR field where an INTEGER should have been used. We gotta work around that here. If the DB contains invalidated input we will act as the same as if it is an ID we do not have.*/ return whatUsuallyHappensIfNotFound(); } [05:58]
enoq hi, I'm getting a string formatted as "yyyy-MM-dd'T'HH:mm:ssZ" into my controller as Date. Tried to replace Date with LocalDateTime and now I'm getting UnsupportedTemporalTypeException: Unsupported field: OffsetSeconds [05:58]
enoq is LocalDateTime a good idea for that stuff? [05:58]
surial enoq: duh. [05:58]
surial enoq: LDTs don't have offsetseconds. [05:58]
surial enoq: Depends. [05:58]
surial enoq: you've gone too far. [05:59]
surial enoq: you're getting an input. This input represents something, and is in some format. These 2 things are not the same, though it'd be nice if they are related. [05:59]
surial enoq: We've determined the format. But you did not mention the first thing. What does it represent? [05:59]
perrier-jouet [perrier-jouet!] has joined ##java [05:59]
surial If it represents time the way someone would think about it when they, say, write stuff in an agenda, LDT may well be sensible. If it represents 'this is when the server started', LDT would not be appropriate. [06:00]
bendem enoq, Z means UTC, so your timestamp is localised. You need either Zoned/OffsetDatetime, or Instant [06:00]
enoq I'm gonna persist it as "timestamp with time zone" in postgres [06:00]
Celmor[m] thanks for the suggestion, I'm gonna extend the code so it's clear at least [06:00]
surial if it represents 'this is the time of the doctor's appointment last week', LDT is not sensible... unless that's effectively how the system you're getting this info from works. Then it might be. [06:00]
dreamreal Celmor[m]: good [06:00]
surial Celmor[m]: good luck dealing with the, um, 'creative' DBA you got there :) [06:00]
dreamreal and you really should fix the DB [06:00]
surial enoq: you're still not having your head in the right place. [06:00]
Zizzo [Zizzo!] has joined ##java [06:01]
surial enoq: how you format it, how you persist it? Wrong level to be thinking on. Heh, Celmor[m] had the same thing. Jumping to implementation whilst the semantics are still unclear. [06:01]
surial enoq: WHAT is that representing? And possibly WHICH impl details of the semantic process are locked down and not changable by you. Get that clear FIRST, _THEN_ decide all implementation details you DO get to control to fit as best as possible. [06:01]
enoq it's basically a modified timestamp and I can't change the controller API [06:01]
surial How you store this in a DB? How the fuck is that relevant if you don't nkow what the thing you are storing represents? [06:02]
surial enoq: okay, sigh. [06:02]
surial Let me explain to you what 'semantics' mean. [06:02]
surial 'modified timestamp' isn't 'semantic'. [06:02]
surial 'The time of the appointment', THAT is semantics. 'the time the server started'. 'the time the clocks are turned an hour backwards in Amsterdam, in the year 2019'. 'the calculated slot for the 8th time that this agenda event, which is configured to repeat biweekly, is repeated'. [06:03]
surial THOSE are semantic concepts. Which semantic concept is this? [06:03]
enoq last modified timestamp of a resource [06:03]
hypc1 [hypc1!~Thunderbi@] has joined ##java [06:03]
enoq controller API is basically: give me all changes after x [06:03]
surial Alright. Going from the 'root', it's not an LDT. It's a specific point in time. [06:03]
dreamreal so the times aren't relative at all [06:03]
black_ant [black_ant!~antilope@unaffiliated/black-ant/x-1505394] has joined ##java [06:03]
enoq does JPA support Instants? [06:04]
enoq or am I better off just keeping Date then? [06:04]
Vurtatoo [Vurtatoo!] has joined ##java [06:04]
dreamreal yes, it does [06:04]
bendem Instant is a much better time for a point in time unrelated to the user's timezone [06:06]
bendem s/time/type/ [06:06]
enoq ah ok got it: LocalDateTime is your local date and therefore needs a timezone to determine the "real" timestamp [06:06]
enoq if I understood that correctly [06:06]
dreamreal right [06:07]
bendem IMO, you should never use LocalDateTime unless you are in your presentation layer dealing with a single user. It represents the time with regards to the location it runs at without any regards for timezone. As soon as you move or send that value somewhere else, it's unsuitable [06:08]
enoq would you recommend dropping Date in favor of Instant? [06:08]
bendem if you are in backend code, you are dealing with multiple users, possibly in another timezone or not, LocalDateTime cannot represent that [06:08]
bendem I would [06:09]
surial enoq: generally yes. [06:09]
dreamreal I would use LDT because I am an individualist who swims against the stream, I defy you all! ... and I'd use Instant behind the scenes and just never say it out loud [06:13]
dreamreal My cred as an individualist is more important than sanity, obviously [06:13]
dreamreal (^^^ is all sarcastic, if you can't tell) [06:15]
Lengsdorfer [Lengsdorfer!~Lengsdorf@unaffiliated/lengsdorfer] has joined ##java [06:15]
Sc0tty- [Sc0tty-!~Scott@] has joined ##java [06:17]
troulouliou_div2 [troulouliou_div2!~troulouli@unaffiliated/troulouliou-div2/x-0271439] has joined ##java [06:32]
TomyWork [TomyWork!~TomyLobo@] has joined ##java [06:36]
hypc1 [hypc1!~Thunderbi@] has joined ##java [06:37]
ipee [ipee!] has joined ##java [06:38]
royal_screwup21 [royal_screwup21!89de72f2@gateway/web/cgi-irc/] has joined ##java [06:42]
CheckYourSix [CheckYourSix!~quassel@unaffiliated/checkyoursix] has joined ##java [06:52]
DTZUZO [DTZUZO!] has joined ##java [06:56]
kchz [kchz!~dschulz@] has joined ##java [06:56]
nebulae [nebulae!] has joined ##java [07:00]
KidBeta [KidBeta!~Kidbeta@hpavc/kidbeta] has joined ##java [07:04]
kchz [kchz!~dschulz@] has joined ##java [07:16]
jimender2 [jimender2!uid320657@gateway/web/] has joined ##java [07:17]
x6e69636f [x6e69636f!4dc15c84@gateway/web/cgi-irc/] has joined ##java [07:23]
Peste_Bubonica [Peste_Bubonica!~Peste_Bub@unaffiliated/peste-bubonica/x-4612396] has joined ##java [07:23]
waz [waz!~waz@pdpc/supporter/active/waz] has joined ##java [07:23]
DTZUZO [DTZUZO!] has joined ##java [07:35]
wyre [wyre!~wyre@unaffiliated/wyre] has joined ##java [07:36]
nebulae [nebulae!] has joined ##java [07:37]
NoctisShadowzel [NoctisShadowzel!58f0cb25@] has joined ##java [07:38]
VegetarianFalcon [VegetarianFalcon!uid258908@gateway/web/] has joined ##java [07:42]
wyre hi everyone, is there a way to generate javadoc in PDF format? [07:43]
surial wyre: I think there might be a way to produce simplified (i.e. without frames) HTML variants, and there are tools to turn a simple DAG of linked HTML into a PDF. [07:44]
wyre I've tried to convert HTML generated to pdf using HTMLDOC, but I not found the result very aesthetic [07:44]
surial but, as far as _names_ of such tools? Beats me. [07:44]
wyre surial: that simplified forms could be interesting [07:45]
surial wyre: I assume s/aesthetic/lacking in aesthetics. You can configure the HTML emitted by the javadoc tool quite a bit. but I'd start with the 'ixnay on the amesfray' option. [07:45]
wyre (with no frames and navigation bar) [07:45]
surial oh yeah, that navbar's gotta go too. [07:45]
Stummi .oO(why would someone want javadoc as PDF? I don't see any usage in tha) [07:46]
Stummi *that [07:46]
surial For the javadoc we dump to, the ant script will go in and remove the timestamp which the javdaoc t ool shoves in a comment; when the file does not change whatsoever, I don't want the HTML file to change either for a few reasons. YOu could perhaps do something similar, but, using regexes to mess with HTML is a hack that can easily backfire. [07:46]
wyre Stummi: me neither, but it is mandatory for me :) [07:46]
wyre surial: but then ... is there a way to remove the navbar and frames? [07:47]
Stummi wyre, maybe try to find a tool to turn javadoc into markdown or something similar (don't know if that exists). If theres something, from there turning it into PDF should be easier [07:47]
wyre Stummi: I've found this one [07:48]
wyre but I don't know if it is usable in my case [07:48]
Stummi Me neither [07:48]
bendem javadoc has a -nonavbar that's specifically used for pdfs [07:49]
bendem so my guess is, generate html then convert to pdf [07:49]
KidBeta [KidBeta!~Kidbeta@hpavc/kidbeta] has joined ##java [07:50]
bendem [07:50]
Stummi phantomJS would be another thing to look at [07:50]
bendem found the official oracle faq for that: [07:53]
bendem spoilers: all links are broken or outdated [07:53]
bendem html2ps looks ok though [07:54]
dreamreal re [07:54]
gareppa [gareppa!~gareppa@unaffiliated/gareppa] has joined ##java [07:55]
sa02irc [sa02irc!] has joined ##java [07:55]
[twisti] wasnt there a guy here the other day who wanted to turn javadoc into manpages ? [07:57]
BilldaCat [BilldaCat!] has joined ##java [08:00]
tracks_droid [tracks_droid!~androirc@2600:100d:b113:c8a6:0:33:120a:cf01] has joined ##java [08:03]
dreamreal [twisti]: no reference to manpages in the logs for ##java that *I* have [08:04]
[twisti] maybe #java-talk ? [08:04]
dreamreal nor there, I checked all of my logs. Let me try a wider search. [08:05]
dreamreal nothing stands out [08:06]
NoctisShadowzel Hello! I have a template png file in my Java project file. It is a simple white rectangle on a large image, background is transparent. What I want is, I want to paste the identicon my code generates on a specific point on that template, change its white color to %15 lighter color of identicons color, and create a new TIFF image from modified image. [08:06]
NoctisShadowzel But don't touch template. How must I approach this? [08:06]
dreamreal java2d [08:06]
dreamreal Java2D is Java's built-in image manipulation package, included as part of java.awt. It's a pipeline-based image transformation model, and it's surprisingly capable, although it's easy to find more powerful graphics libraries. See for a tutorial. [08:06]
dreamreal actually really easy, barely an inconvenience [08:06]
dreamreal (Someone I know did exactly that for samsung) [08:07]
NoctisShadowzel dreamreal, I hope my idea is still original :D I want to make an security app with it. [08:07]
NoctisShadowzel Whatever, TY I will check it. [08:07]
[twisti] ill have to check when i get home [08:08]
dreamreal NoctisShadowzel: I don't care what your idea is, your QUESTION is easily addressed [08:08]
nokdoot [nokdoot!~nokdoot@] has joined ##java [08:08]
NoctisShadowzel @dreamreal You said; (Someone I know did exactly that for samsung). I said that sentence for that. Whatever, TY again! [08:08]
dreamreal was talking about the use of java2d to overlay and manipulate an image [08:09]
dreamreal given that it's a core tech of java2d, it'd be surprising if there was any originality there [08:10]
NoctisShadowzel To *not* modify original template, must I create an instance of it in code, and modify it directly? [08:11]
dreamreal load the image in code, transform it, overlay it, broadcast it [08:11]
dreamreal what else would you want, exactly? [08:12]
NoctisShadowzel Ah, nothing I suppose.. [08:13]
TheBeastie [TheBeastie!] has joined ##java [08:17]
stryek [stryek!uid332574@gateway/web/] has joined ##java [08:17]
anirban [anirban!~anirban@unaffiliated/apostasy] has joined ##java [08:19]
wyre [wyre!~wyre@unaffiliated/wyre] has joined ##java [08:20]
atrament666 [atrament666!] has joined ##java [08:23]
atrament666 [atrament666!] has joined ##java [08:24]
ipee [ipee!] has joined ##java [08:26]
jamezp [jamezp!~jamezp@redhat/jboss/jamezp] has joined ##java [08:28]
darkxploit [darkxploit!] has joined ##java [08:35]
morenoh11 [morenoh11!] has joined ##java [08:39]
donofrio [donofrio!] has joined ##java [08:40]
TheBeastie [TheBeastie!] has joined ##java [08:46]
x6e69636f surial on this example, the code still prints class A field value instead of B's ... and I don't get why : [08:46]
x6e69636f x6e69636f's title: " - VirtualFickleRotation" [08:46]
x6e69636f [x6e69636f!4dc15c84@gateway/web/cgi-irc/] has joined ##java [08:47]
x6e69636f sorry, deconnection [08:47]
x6e69636f surial did you receive my previous message with example code ? [08:47]
dreamreal x6e69636f: you don't override fields like that, gross [08:48]
x6e69636f dreamreal that was my initial question, how would you do ? [08:48]
dreamreal abstract class A { String getS(); } class B extends A { String getS() { return "B"; } } [08:49]
deathcap [deathcap!~user@unaffiliated/deathcap] has joined ##java [08:50]
golevka6489 [golevka6489!] has joined ##java [08:51]
bendem or just class A { A(String s) { this.s = s; } } class B extends A { B(String s) { super(s); } } [08:51]
x6e69636f dreamreal well, I thought of this but I don't want to force the need for a getter override when you actually could just change one field [08:51]
x6e69636f yes bendem that's what I think I'll do [08:51]
dreamreal x6e69636f: see bendem's solution [08:52]
bendem again, why do you think you need to override *fields* specifically [08:52]
bendem what problem are you trying to solve? [08:53]
x6e69636f well, I'm building a classes that will build specific Excel file sheets, but at least, they will all have a title for example, so they need a title and a buildRows method (plus some other methods that can be quite generic in the abstract class) hence the need to [08:53]
x6e69636f change the title field, for example [08:53]
zeden [zeden!~user@unaffiliated/zeden] has joined ##java [08:54]
bendem right, you can access the title field of the parent class and change it then. Just don't include it in B use t [08:54]
bendem ...he field in A [08:55]
x6e69636f What do you think of this constructor implementation ? is this wrong to have a different constructor in the sub class calling the super constructor ? [08:55]
x6e69636f [08:55]
x6e69636f (and the super constructor would be Super(title, columns, data); ) [08:56]
bendem sure, whatever works [08:56]
x6e69636f ok thanks [08:56]
x6e69636f that makes consensus in my team too [08:57]
x6e69636f but still, in my first example ( I expected Printer<B> to actually print B s field, and not A's ... why doesn't it ? [08:58]
x6e69636f x6e69636f's title: " - VirtualFickleRotation" [08:58]
NeXTSUN [NeXTSUN!~textual@] has joined ##java [09:00]
Tichodroma [Tichodroma!~lutz@fsf/member/Tichodroma] has joined ##java [09:00]
bendem because field access does not go through virtual dispatch [09:03]
bendem the correct way is [09:03]
bendem bendem's title: " - YellowFirsthandComma" [09:03]
waz [waz!~waz@pdpc/supporter/active/waz] has joined ##java [09:04]
runlevel7_ [runlevel7_!~runlevel7@unaffiliated/runlevel7] has joined ##java [09:05]
bendem basically, when you access the field s in Printer, the compiler doesn't know what type toBePrinted is, all it knows, is that it's an instance of A, it generates an instruction to load the field s from class A [09:05]
bendem when you call a method, it's a completely different mechanism (called virtual dispatch, google it, it takes some explaining) [09:05]
x6e69636f ok, but even so I told the compiler that my printer is a Printer<B> ? [09:07]
bendem the code to access s is in Printer, not in Main [09:07]
bendem Printer doesn't about Main [09:07]
bendem also, type erasure means that the runtime doesn't even know that you wrote Printer<B>, all it sees is Printer [09:08]
bendem type erasure [09:08]
bendem bendem, type erasure is the notion that all generics info *FROM INSTANCES* is gone at runtime [the 'String' in List<?> x = new ArrayList<String>();], as well as generics info being irrelevant for method signatures [void foo(List<Integer> x) and void foo(List<String> x) cannot co-exist in the same class, as they have the same classfile signature]. [09:08]
x6e69636f no but it does have a type B attached to it, isn't it ? (I'm learning right now, I'm not advanced enough in Java to actually know the answer) [09:08]
bendem generics only exists to check syntax, they do not influence generated code [09:09]
x6e69636f ok [09:09]
x6e69636f thanks ! [09:09]
bendem x6e69636f, [09:11]
bendem this gives you an idea of what your code looks like after it has been compiled [09:11]
bendem you can see how the main method has lost its generic types [09:12]
x6e69636f yes [09:12]
bendem that's why you can't access B.s if the compiler only knows about A [09:13]
ToastedPhoenix [ToastedPhoenix!~ToastedPh@] has joined ##java [09:20]
LearnAllTheTime [LearnAllTheTime!~LearnAllT@2601:cc:4000:9db0::4801] has joined ##java [09:20]
surial x6e69636f: I told you right at the start: You. cannot. override. fields. period. [09:21]
surial x6e69636f: fields don't 'do' overriding. at all. [09:21]
surial x6e69636f: methods do, though. upgrade your getS() and you're in business. [09:21]
surial s/upgrade/override [09:21]
x6e69636f surial you didn't teach me anything new but you mentioned <? extends A> and I wanted to try, bendem provided a more gentle explanation, but thanks anyway [09:22]
surial x6e69636f: to be specific, your B classes have 2 fields. They are BOTH named 's'. The second one does not override the first; the term 'override a field' is not a thing and has no meaning whatsoever. It, however, has only ONE method named 'getS'. This method overrides the getS in A. B's getS overrides A's getS(); there is no way to run the getS code from A for any given instance B, even if you cast that instance to A. The only [09:23]
surial code that can invoke A's getS is that you can do it from within the code of, by invoking super.getB(). [09:23]
surial x6e69636f: okay. [09:23]
surial well, glad we got it clarified for you. [09:23]
deathcap this place doesn't really do gentle. bluntness gets the point across better most of the time, feelings be damned. :p [09:23]
michele [michele!~eraser@unaffiliated/michele] has joined ##java [09:23]
surial bendem++ [09:23]
surial bendem has a karma level of 55, surial [09:23]
x6e69636f deadbeat yeah, I'm kinda used to it and actually expected rough answers :) [09:24]
x6e69636f IRC gonna IRC [09:24]
deadbeat deathcap: that hl was for you i guess ^^ [09:24]
deathcap I knew who you meant. We've both got death variants in our handles haha. [09:25]
x6e69636f indeed sorry, I failed user completion [09:25]
deathcap Ha, that's fine. I don't have it on my client. Anyway, that's off topic so I'll stop now. [09:25]
bendem it's really too bad that being blunt (that's an understatement) is what people expect from IRC. It's not inevitable [09:26]
deathcap I try not to be. But I'm just so used to it I've developed a thick skin. Ditto for stack overflow, only people are WAY more helpful here. [09:26]
surial bendem: The problem is definitions of being nice and well adjusted for the social interaction environment you've chosen. [09:26]
bendem I don't think so, but I'm not going to argue about niceness with you [09:27]
nahra [nahra!~user@unaffiliated/nahra] has joined ##java [09:28]
surial For example, someone who pops in here and asks a 'stupid' question, in the sense of: It was easily googlable and any java 101 tutorial would have covered it.. even if people ask with 18 different words for 'friend!' and 'thank you!', festooned with emoji hearts ? _I_ still find that somewhat insulting to the channel as a whole. [09:28]
surial Presumably the person who asks thinks it is being _VERY_ nice indeed and would expect a similar abundance of kind words. But to do that, whomever answers this person would have to figure out precisely what kind of answer said asker would prefer and consider 'kind'. [09:29]
ravenousmoose [ravenousmoose!] has joined ##java [09:32]
KeyJoo [KeyJoo!~KeyJoo@] has joined ##java [09:32]
julius [julius!~julius@] has joined ##java [09:34]
AndrewBass parted the channel: [09:35]
sleepywitch [sleepywitch!] has joined ##java [09:42]
ravenousmoose [ravenousmoose!] has joined ##java [09:43]
Jigsy` [Jigsy`!~Jigsy@unaffiliated/jigsy] has joined ##java [09:45]
CookieM [CookieM!] has joined ##java [09:48]
sleepywitch [sleepywitch!] has joined ##java [09:50]
x256 [x256!] has joined ##java [09:52]
errr [errr!~errr@fedora/errr] has joined ##java [09:59]
deathcap Is there a good drop-in replacement for javax.swing.JSlider in SWT? I suspected that Slider would be an alternative's just a scrollbar with no labeling. [10:10]
freeone3000 Slider + Label [10:10]
led_dark_1 [led_dark_1!~Thunderbi@] has joined ##java [10:11]
deathcap Fair. I'm mostly frustrated by the lack of built-in ticks. [10:11]
Rapture [Rapture!] has joined ##java [10:12]
sleepywitch [sleepywitch!] has joined ##java [10:18]
DTZUZO_ [DTZUZO_!] has joined ##java [10:20]
greggerz [greggerz!~greggerz@unaffiliated/greggerz] has joined ##java [10:20]
Rapture_ [Rapture_!] has joined ##java [10:21]
rruizt [rruizt!] has joined ##java [10:21]
dreamreal why not use swing [10:22]
mbooth deathcap: org.eclipse.swt.widgets.Scale ? [10:22]
dreamreal or javafx [10:23]
deathcap Organizational reasons. [10:23]
deathcap I'm stuck on the eclipse platform because I'm converting a Swing app to an Eclipse perspective. [10:23]
dreamreal ah, yeah, you're screwed [10:23]
deathcap yep. [10:23]
dreamreal oh well [10:23]
deathcap I don't like it. [10:23]
dreamreal (Actually, you may not be: I don't know the SWT widget set. I just assume you've looked.) [10:23]
deathcap mbooth hold up I'll check. [10:23]
deathcap Heyyyy!!! I overlooked that one. [10:24]
dreamreal mbooth ++ [10:24]
dreamreal mbooth has a karma level of 14, dreamreal [10:24]
Jigsy [Jigsy!~Jigsy@unaffiliated/jigsy] has joined ##java [10:24]
dreamreal ... assuming it's what they need :) [10:24]
surial mbooth++ are you an eclipse developer? [10:24]
surial mbooth has a karma level of 15, surial [10:24]
deathcap Yeah it looks like it'll do the trick just fine. [10:24]
mbooth surial: I am, but I don't hold that against me ;-) [10:24]
deathcap mbooth ++ [10:25]
deathcap mbooth has a karma level of 16, deathcap [10:25]
kchz [kchz!~dschulz@] has joined ##java [10:26]
deathcap Yeah, this entire process has been...interesting. Given that the entire original program was written as a Clojure program utilizing Swing. [10:27]
deathcap And the target rewrite is Java + SWT. [10:28]
deathcap Just one piece at a time, I suppose. [10:28]
k0tze [k0tze!] has joined ##java [10:31]
hooper [hooper!~hooper@2a01:e0a:191:c7b0:6422:e650:232b:6de9] has joined ##java [10:32]
x6e69636f parted the channel: [10:32]
mindCrime [mindCrime!~mindCrime@] has joined ##java [10:34]
k0tze Hi people, I wish you a nice day. Is it recommendable to use singleton patern everytime it's possible? Is there a disadvantage to use it, when it's not really necessary, except more LOC? [10:36]
Stummi singleton [10:36]
Stummi k0tze, singleton is a controversial pattern where you enforce only one instance of a class. Singletons often make non-trivial programs clunky and difficult to maintain. Read and before implementing one yourself, and consider dependency injection as a modern alternative. [10:36]
Stummi technically, it depends on what you mean by "singleton", but if you have to ask, you probably mean the worst ones anyway [10:37]
dreamreal k0tze: singleton would only add like four or five lines of code anyway [10:38]
dreamreal but consider using a DI framework, they allow precise control of stuff like that [10:38]
Merlin_O [Merlin_O!] has joined ##java [10:38]
zalt [zalt!~lambda443@unaffiliated/lambda443] has joined ##java [10:38]
bendem k0tze, what happens when the assumption that you will never need two instances of a class falls short? You get to rewrite the code using it. If everything is using singletons, you get to rewrite everything. Also, singletons means everything is available everywhere, it makes it harder to track dependencies or separate things. It also makes testing harder since you can't replace components [10:38]
k0tze Stummi, something like that [10:38]
Stummi k0tze, yeah. don't do that [10:39]
Merlin_O The static singleton pattern is evil. Favor dependency injection [10:39]
dreamreal k0tze: why do you ask? I mean, for that class, a singleton is fine (there are better ways to... damn it Stummi) but why? [10:39]
bendem you are all saying singletons are bad, provide some reasoning ffs [10:40]
dreamreal SIngletons are fine. [10:40]
bendem ^ [10:40]
dreamreal I'm not saying they're bad at all. [10:40]
Merlin_O It's not about having one instance [10:40]
dreamreal I'm just trying to figure out k0tze's reasoning for asking. [10:40]
Merlin_O It is about accessing that instance by using a static method of some concrete type [10:40]
k0tze dreamreal, I ask cause I use it in this case, but I don't know it's good or not.. [10:40]
dreamreal k0tze: the way you're doing a singleton THERE is not good [10:41]
dreamreal singletons in and of themselves are fine [10:41]
Merlin_O The Static Singleton Pattern makes your code harder to test, increases coupling, decreases reusability and so forth [10:41]
dreamreal if you need the singleton pattern, you should use DI to get it, usually [10:41]
dreamreal spring beans by default are presented as singletons [10:41]
bendem singletons are tools, you wouldn't use your hammer to screw something. Don't use singletons to avoid tracking instances [10:42]
k0tze dreamreal, but I do not need it really in this case, so i will better remove it? [10:42]
bendem you haven't provided the context in which this class is used [10:42]
Stummi k0tze, actually, this class could completely be a Utility class (as in, no instance at all) [10:42]
dreamreal k0tze: well, in the case of the class you've provided, a chromatic scale's pretty constant [10:42]
dreamreal you're not likely to change it (nonwestern scales aren't chromatic, for example) [10:43]
dreamreal so... eh, this COULD be a singleton, I guess, although I'd say an Enum would be better [10:43]
bendem I'd give that class a single static immutable List<String/* or an enum even */> field, no method [10:43]
bendem but again, context [10:44]
dreamreal and yes, context. TMTOWTDI. [10:44]
k0tze dreamreal, yes it is constant, but i do not like to put it in another class, cause of single responsibility principle. And i need this data in different classes.. [10:44]
dreamreal k0tze: enum! [10:44]
deathcap mbooth, I'm not sure if you're still around. But here's a question for you. I've got my Scale working fine now. But for various reasons, it won't display properly under certain GNOME themes. Is there a way to force the windowing system to respect my foreground/background colors? [10:44]
Stummi public static List<String> CHROMATIC_SCALE = Arrays.asList("C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B"); [10:44]
bendem List.of [10:44]
bendem otherwise your list is still mutable [10:44]
Merlin_O That list is not immutble [10:44]
Merlin_O it can just not be resized [10:44]
k0tze dreamreal, ... [10:45]
bendem k0tze, ... [10:45]
freedom [freedom!~freedom@] has joined ##java [10:45]
k0tze i know enum, but arraylist is fine for me? [10:45]
Merlin_O public static ImmutableSet<String> CHROMATIC_SCALE = ImmutableSet.of(...) [10:46]
bendem Set is not ordered, a scale is [10:46]
Merlin_O If you are using Guava [10:46]
Merlin_O Oh it has to be ordered... never mind sorry. Then use an ImmutableList.of(...) [10:46]
deathcap Enums have compile time performance boosts, and also if you're doing something like listing the chromatic scale you don't want the arraylist to be mutable. [10:46]
Merlin_O What performance boost are you talking about? [10:47]
Merlin_O Also there would be another class to load [10:47]
bendem seeing his code, guava is way overkill Merlin_O... Let's keep with no dependency java for the sake of not losing him [10:47]
progart [progart!~kamee@] has joined ##java [10:47]
deathcap I guess that's true. And I just read that somewhere so I may be talking out of my ass. [10:47]
dreamreal k0tze: *shrug* I don't know what you're doing [10:47]
[twisti] k0tze: putting data like that into a list instead of an enum is like putting a number into a string. you can do it, but its stupid. [10:47]
k0tze Merlin_O, "you don't want the arraylist to be mutable" thats an argument [10:47]
dreamreal bendem: although guava's probably one of those "default libs" everyone would have soon if not already present [10:47]
bendem no talk on performance, let's focus on correctness and java-esque solutions [10:47]
progart [progart!~kamee@] has joined ##java [10:47]
Merlin_O k0tze yeah thats why he should either use guava oder the factory methods in modern java [10:48]
bendem dreamreal, I'm guessing this is a school project, guava ain't gonna be a thing [10:48]
dreamreal bendem: in which case we should back out anyway! [10:48]
mbooth deathcap: Are you hard-coding colours in your view? [10:48]
bendem guava is just irrelevant to his problem. It's just added stuff that he really doesn't need to solve his problem [10:48]
k0tze bendem, it's from my bachelor thesis sometimes ago, i try to refactor all this stuff [10:48]
deathcap You phrase that like I ought not do that. [10:48]
dreamreal sure, I'm not solving his problem because I don't know what it is :) [10:49]
Merlin_O As long as he is using Java9+ he should go for the stdlib anyways [10:49]
dreamreal All I know is that the double-checked locking in his singleton is flawed [10:49]
Merlin_O why even use double checked locking... [10:49]
bendem so, k0tze, what are you using that chromatic scale for? Can you share some code using it? [10:49]
Merlin_O Use initialization on demand holder idiom [10:49]
Merlin_O If the singleton is going to have a static lifetime anyways (lazily created) [10:50]
dreamreal And what other scales do you support, geez [10:50]
mbooth deathcap: You ought not to. It's almost always better to use the colors that the windowing system gives you [10:50]
bendem again, stop introducing complexity to a simple problem guys... [10:50]
Merlin_O [10:50]
Merlin_O Merlin_O's title: "Initialization-on-demand holder idiom - Wikipedia" [10:50]
dreamreal if you're gonna talk music, let's figure it out and do it right :) [10:50]
StucKman [StucKman!] has joined ##java [10:50]
bendem we don't care about double locking at this point [10:50]
k0tze bendem, sure [10:50]
mbooth deathcap: E.g. if you want the color of the background of list widgets, you can use "display.getSystemColor(SWT.COLOR_LIST_BACKGROUND)" [10:50]
deathcap Well I guess I just learned something new, which is "Green Laguna" GNOME theme doesn't display SWT Shell properly. [10:50]
StucKman by any chance the JVM on linux does set it's own ulimis? our system has 100k (!!!) max file limit, but all java processes have only 4096 (???) [10:51]
deathcap dreamreal, I mean I don't think we're going to be representing microtonality, unless we define a class that uses an Enum base note on a chromatic scale and a % deviation in cents from the tonic. [10:52]
kappa1 [kappa1!~kappa@unaffiliated/kappa1] has joined ##java [10:52]
mbooth deathcap: In general GTK themes that are not adwaita are a bit crap, yeah [10:52]
dreamreal deathcap: ew [10:52]
bendem k0tze, alright, in this specific case, what you need is the list of notes in the chromatic scale. I would write that as a static constant using static initialization. [10:52]
kappa1 hi! I have a stream of Map<List<String>, List<MetricOperatorConfig>>. How can I merge this stream into a single Map ? [10:53]
dreamreal deathcap: it'd be better to have notes with pitches, then you could represent the chromatic scale as notes of specific pitches properly; microtones would use different gradiations of pitches, plus this would allow you to simulate instruments (like guitars) whose notes are roughly equivalent but not quite right [10:54]
Merlin_O kappa1 that won't work. Most List implementations do not have a proper hashCode() method [10:54]
deathcap well, since most people in my org are using the default theme, I guess I'll just change mine to Adwaita and go from there. [10:54]
k0tze bendem, static const enum? [10:54]
Merlin_O Meaning that, as long as you do not compare just the List instances, it wont work [10:54]
deathcap dreamreal are we talking pitches as in bass frequencies? like A440? (in my previous, non-programmer life I worked as a piano tuner. It prepared me for tedium extremely well) [10:55]
deathcap *base [10:55]
dreamreal deathcap: yeah [10:55]
kappa1 Merlin_O, what if it is a list of string [10:55]
dreamreal A(440), for example, and the piano is fortunate in that it can represent exact pitches for notes [10:55]
kappa1 or a set [10:55]
dreamreal the guitar is ... close, but particularly at the end of the neck the pitches are not correct unless you have a variegated nut [10:56]
bendem k0tze, [10:56]
bendem bendem's title: " - ExoticRottenSlash" [10:56]
deathcap plus most people who tune guitars by ear are using the 5/7th fret harmonic equivalent. [10:56]
deathcap which is great but isn't strictly equal temperament. [10:57]
dreamreal (or a fanned fretboard, I guess, but I'm not sure fanned fretboards are any better than the variegated nuts) [10:57]
dreamreal deathcap: yeah, guitars with normal nuts/fretboards are not tempered properly and can't be [10:57]
kappa1 stream of Map<List<String>, List<Sting>>. How can I merge them into a single map? [10:57]
bendem kappa1, see how you don't even need an instance of the ChromaticScale class to work with it? [10:57]
bendem k0tze, * [10:57]
deathcap (grabs a fretless bass for the sake of argument, heh) [10:57]
k0tze bendem, perfect! ty for sharing your skills with me :) [10:58]
mbooth kappa1: You already have a single map, no? [10:58]
bendem double bass > frets [10:58]
dreamreal deathcap: fretless guitars of all kinds obviously can cheat :) I wish I still had a fretless bass [10:58]
kappa1 mbooth, no. I have a stream of Maps [10:58]
drewery [drewery!~root@] has joined ##java [10:58]
dreamreal I sold it because I was feeling old and tired and the way I play bass, it was exhausting at the time (play Rush on a fretless and you'll be worn out... or so I was) [10:58]
kappa1 I need to merge them [10:59]
deathcap I had a double bass way back in the day but sold it cause it was just too damn inconvenient to lug around. I've been dabbling in the violin though lately, it's been quite the adventure. I still suck, but at least I can mark the frets with beginners tape as a crutch. [10:59]
dreamreal yeah, I have a viola here myself. The violin is just too damned small for me. [10:59]
dreamreal I truly, truly, TRULY suck at it though [11:00]
deathcap It's my wife's. Her ex got in her for her as a gift wayyyy before I came around but she never learned how to play it beyond proper bow technique. [11:00]
bendem k0tze, note that in java 11, you don't even need static initialization thanks to List factories. (I updated the class to show you) [11:00]
deathcap *it for her [11:00]
mbooth This may be straying off topic, and I don't say that just because I am jealous of people who can play music ;-) [11:00]
hooper Hi all, I come back to you cause my openjdk-8-jre still doesn't work with my debian 9 for this site : , the windows pop up before the vmdisplay is frozen and the control panel of icedtea say " access denied ("" "/usr/bin/xprop" "execute") ? bizarre my level security is set to on, security setting allow all and my jvm says ok at the settings [11:00]
hooper ... ?someone have an idea ? [11:00]
hooper hooper's title: "ProRealTime - Logiciel de bourse, analyse technique & trading" [11:00]
sleepywitch [sleepywitch!] has joined ##java [11:00]
deathcap Oh, we're wayyyy off topic at this point. I'll go back to the message boards. dreamreal come join us haha. [11:01]
dreamreal mbooth: it IS off topic, yes :) [11:01]
StucKman parted the channel: " - Chat comfortably. Anywhere." [11:01]
mbooth hooper: Speak to the prorealtime people -- we can't do tech support for random proprietary software [11:02]
k0tze bendem, is working fine! ty [11:02]
bendem o7 [11:02]
mbooth hooper: There's even a phone number you can ring (how rare!) before 19.00 ;-) [11:05]
waz [waz!~waz@pdpc/supporter/active/waz] has joined ##java [11:06]
mbooth It even says on the website "Si vous n'avez pas l'option d'envoyer un rapport, contactez-nous par email ou par téléphone." [11:06]
TheBeastie [TheBeastie!] has joined ##java [11:10]
Jigsy [Jigsy!~Jigsy@unaffiliated/jigsy] has joined ##java [11:12]
drewery I have bootstrap included separately and its functions and CSS I have bootstrap included separately and its functions and CSSz] has joined ##java [11:13]
drewery 15:06 -!- sdu [] has quit [Remote host closed the connection] [11:13]
drewery ^^^ all unintentional highlighting with terminal picking up on highlighted [11:14]
drewery \ [11:15]
pmercado [pmercado!] has joined ##java [11:16]
bn_work [bn_work!uid268505@gateway/web/] has joined ##java [11:17]
paddyez [paddyez!~paddyez@wikipedia/paddyez] has joined ##java [11:21]
plarsen [plarsen!~plarsen@redhat/jboss/pdpc.professional.plarsen] has joined ##java [11:22]
dreamreal drewery: this sounds like... not java :) [11:26]
waz [waz!~waz@pdpc/supporter/active/waz] has joined ##java [11:27]
iam730 [iam730!] has joined ##java [11:35]
esro [esro!] has joined ##java [11:41]
Sheilong [Sheilong!uid293653@gateway/web/] has joined ##java [11:41]
Gazooo [Gazooo!~Gazooo@] has joined ##java [11:53]
RedSoxFan07 [RedSoxFan07!] has joined ##java [12:06]
tracks_droid [tracks_droid!~androirc@2600:100d:b113:c8a6:0:33:120a:cf01] has joined ##java [12:10]
manualcrank [manualcrank!] has joined ##java [12:12]
rruizt [rruizt!] has joined ##java [12:12]
plitter for preparedstatement, does anyone know a good way of adding a list of values into a single '?' ? [12:16]
progart [progart!~kamee@] has joined ##java [12:17]
deathcap More of an SQL question, but look into a combination of String.format and String.join [12:17]
plitter deathcap: I was there and asked already, they didn't have a good answer for it.... [12:18]
plitter another question would be if we could make multiset for hibernate.... [12:19]
deathcap Cause it's a String formatting question. [12:19]
cheeser it's not a SQL question. it's a JDBC question. [12:20]
plitter there is no jdbc channel.... [12:21]
cheeser that would be ridiculously specific. :) [12:21]
yokel [yokel!~yokel@unaffiliated/contempt] has joined ##java [12:22]
plitter There is a lot of irc things that are very specific :P like tmux or ffmpeg [12:22]
deathcap class FieldValue {String field, value; public FieldValue(String field, String value) {this.field = field; this.value = value;}} and then String.format("select * from blah where %s",Stream.of(fieldValues).map(fv->String.format("%s = '%s'",fv.field, fv.value)).reduce((a,b)->a+", "+b).get()); [12:22]
deathcap or something akin to that. [12:22]
freeone3000 oh no dynamically building a select clause like that is going to cause problems [12:23]
deathcap where field is the name of the field that you want and value is the value you want to select by. [12:23]
deathcap That's a *verrrry* simple example and yeah, there be dragons there. [12:23]
freeone3000 you want to use a preparedstatement there, and generate the statement placeholders and then pass in the list of placeholder replacements. [12:23]
plitter like select foo from bar where val1 in (<<<PLACEHOLDER>>>) and then put in X number of ? for X number of values and then loop through to set? [12:24]
plitter I see your all jumping up and down to say that is a bad idea, but nothing has come up yet, so I'll assume its a good idea and try it :P [12:28]
deathcap I've never used the PreparedStatement class to be honest, so that's why I'm silent. [12:28]
dreamreal plitter: if you're doing it with JDBC that's one of your better choices [12:29]
deathcap but one single SQL call is usually better than several. [12:29]
plitter dreamreal: my other choice is hibernate, but that doesn't seem to support multiset atm, so that is out.... [12:30]
kappa1 I have a stream of HashMap. How can I collect this stream into a single HashMap? I want to combine them with map1.putAll(map2) [12:30]
plitter deathcap: agree on that :) [12:30]
gareppa [gareppa!~gareppa@unaffiliated/gareppa] has joined ##java [12:32]
deathcap,map2)->map1.putAll(map2)).get() [12:35]
deathcap or something like that. [12:35]
orbyt_ [orbyt_!~orbyt@] has joined ##java [12:35]
wyre hi guys, why usually the packages start with com.? [12:36]
deathcap or maybe a bit more complicated.,map2)->{Map newMap = new HashMap(); newMap.addAll(map1); newMap.addAll(map2); return newMap;}).get(); [12:36]
deathcap depends on if you want immutability or not. [12:36]
dreamreal because most commercial entities' domain names are .com domains [12:36]
dreamreal and packages generally follow the owners' domain names in reverse [12:37]
Jigsy [Jigsy!~Jigsy@unaffiliated/jigsy] has joined ##java [12:37]
deathcap kappa1 of course you'll want to use the type signatures but that should do it. [12:37]
O47m341 [O47m341!~Suzeanne@2600:8802:1500:80e:e040:aac9:8384:7c94] has joined ##java [12:38]
clearcut [clearcut!] has joined ##java [12:50]
plarsen [plarsen!~plarsen@redhat/jboss/pdpc.professional.plarsen] has joined ##java [12:54]
clearcut [clearcut!] has joined ##java [12:56]
surial plitter: it's not a bad idea at all, just.. make sure you replace your placeholder with a series of "?, ?" with ? equal to # of elements in the list, and then use .setX() to set them all. [12:56]
surial plitter: More generally, JDBC itself is way too low level and not suitable for writing queries, the API really sucks for any of that. Check out JOOQ or JDBI for takes on making a _NICE_ api to directly write SQL queries in a safe manner, they may support this properly. [12:57]
surial plitter: deathcap's inline idea would open the door for SQL injection so.. don't do that. [12:58]
led_dark_1 [led_dark_1!~Thunderbi@] has joined ##java [12:59]
deathcap If you're 100% what kind of inputs would be going into the function, it'd be alright. But yeah with unsanitized inputs that's not a good idea. [01:01]
cheeser *always* use prepared statements and only inject values and never structural elements in to the query. [01:02]
surial the odds of that are near zero. And if they are currently zero it is STILL a bad idea; I would strongly advise that you NOT write code that, evne if you can 100% prove that it cannot go wrong today, is quite likely to go wrong tomorrow in face of some change request or bugfix; code is a living, breatthing thing. It will change on you. If it is rather easy to imagine that it'll change on you in a way that no test is going to [01:03]
surial find, but which WILL get your DB p0wned by ? don't do that. [01:03]
deathcap ^^^listen to them, don't pay attention to me. [01:03]
deathcap at least regarding SQL. [01:03]
clearcut [clearcut!] has joined ##java [01:10]
Jigsy [Jigsy!~Jigsy@unaffiliated/jigsy] has joined ##java [01:11]
cnsunyour [cnsunyour!~cnsunyour@] has joined ##java [01:12]
progart [progart!~kamee@] has joined ##java [01:13]
Jigsy` [Jigsy`!~Jigsy@unaffiliated/jigsy] has joined ##java [01:14]
Peste_Bubonica [Peste_Bubonica!~Peste_Bub@unaffiliated/peste-bubonica/x-4612396] has joined ##java [01:17]
clearcut [clearcut!] has joined ##java [01:17]
clearcut [clearcut!] has joined ##java [01:18]
knited [knited!~knited@unaffiliated/knited] has joined ##java [01:23]
TheBeastie [TheBeastie!] has joined ##java [01:25]
Sasazuka [Sasazuka!~Sasazuka@unaffiliated/sasazuka] has joined ##java [01:25]
TheBeastie [TheBeastie!] has joined ##java [01:26]
royal_screwup21 [royal_screwup21!89de72f2@gateway/web/cgi-irc/] has joined ##java [01:27]
clearcut [clearcut!] has joined ##java [01:29]
gareppa [gareppa!~gareppa@unaffiliated/gareppa] has joined ##java [01:30]
Sasazuka [Sasazuka!~Sasazuka@unaffiliated/sasazuka] has joined ##java [01:32]
plarsen [plarsen!~plarsen@redhat/jboss/pdpc.professional.plarsen] has joined ##java [01:33]
nav2002 [nav2002!~nav2002@] has joined ##java [01:34]
gareppa [gareppa!~gareppa@unaffiliated/gareppa] has joined ##java [01:34]
gelignite [gelignite!] has joined ##java [01:34]
atrament666 [atrament666!] has joined ##java [01:35]
clearcut [clearcut!] has joined ##java [01:38]
sleepywitch [sleepywitch!] has joined ##java [01:43]
Jigsy [Jigsy!~Jigsy@unaffiliated/jigsy] has joined ##java [01:45]
tracks_droid [tracks_droid!~androirc@2600:100d:b113:c8a6:0:33:120a:cf01] has joined ##java [01:48]
clearcut [clearcut!] has joined ##java [01:50]
clearcut [clearcut!] has joined ##java [01:50]
clearcut [clearcut!] has joined ##java [01:51]
TheJollyRoger [TheJollyRoger!~Peter@gateway/tor-sasl/thejollyroger] has joined ##java [01:51]
waz [waz!~waz@pdpc/supporter/active/waz] has joined ##java [01:55]
drewery [drewery!~root@] has joined ##java [02:03]
greenfructose [greenfructose!~greenfruc@] has joined ##java [02:14]
Nicmavr [Nicmavr!~Nicmavr@unaffiliated/nicmavr] has joined ##java [02:15]
knited [knited!~knited@unaffiliated/knited] has joined ##java [02:15]
gareppa [gareppa!~gareppa@unaffiliated/gareppa] has joined ##java [02:16]
plarsen [plarsen!~plarsen@redhat/jboss/pdpc.professional.plarsen] has joined ##java [02:16]
sa02irc [sa02irc!] has joined ##java [02:19]
xa0s_ [xa0s_!] has joined ##java [02:21]
ravenousmoose [ravenousmoose!] has joined ##java [02:30]
gareppa [gareppa!~gareppa@unaffiliated/gareppa] has joined ##java [02:30]
Rapture [Rapture!] has joined ##java [02:31]
g00s [g00s!~g00s@unaffiliated/g00s] has joined ##java [02:32]
Ferchoc [Ferchoc!~fer@] has joined ##java [02:33]
Ferchoc Hi. I have a function that basically does try { result = service.thirdPartySoap().someFunct(data); return true; } catch (Exception e) { return false; } the caller will call this function with "data" until it returns true. This has worked ok for a while with different thirdPartySoaps. When thirdPartySoap fails for whatever reason, the process retries. Recently, one of those servers fails a lot and for some reason, after many retries, the code never rea [02:40]
Ferchoc ches the catch. The thread just stops [02:40]
ipee [ipee!] has joined ##java [02:41]
Ferchoc Normally, when server returns 500, bad request or timeout, I catch the exception, log the error and can see it in the logs [02:41]
Ferchoc but I don't understand why sometimes it just failes and stops working, I guess is getting stuck in the call to the service "service.thirdPartySoap().someFunct(data)" [02:42]
[twisti] might be blocking [02:42]
Ferchoc is that possible? [02:42]
[twisti] someFunct (or thirdPartySoap(), for that matter) might be stuck in an endless loop or something [02:43]
Ferchoc but shouldn't the client timeout after a while? [02:43]
[twisti] does the client have timeout code that can deal with endless loops or similar stuckage ? [02:44]
Ferchoc no, I guess it was assumed that that would natively timeout, and it was what I thought when saw the code [02:47]
Ferchoc but you're right, I wasn't sure it was a timout, but it is, just that there are two different timeouts [02:50]
Ferchoc if you cannot get to the server at all, you get a timeout exception [02:50]
freedom [freedom!~freedom@] has joined ##java [02:50]
Ferchoc but if you can reach the server but it gets stuck in some loop, then you would never get the timeout, or at least that's not the default behavior [02:51]
Ferchoc will google if can be set up to do timeout in that case too [02:51]
cader So i'm working through a large project and I keep running into assertTrue(!expectedFalseFoo) is there any reason to not refactor all occurences to assertFalse? [03:02]
yawkat no [03:03]
yawkat the question is: is that really worth the gigantic diff [03:03]
cader 1000 occurences [03:03]
cader cader, what does that even *mean*? [03:03]
sbalmos yawkat: Do you want to *look* productive? ;) [03:03]
cader padding the resume with open source [03:04]
newbieG [newbieG!~bhaskar@] has joined ##java [03:17]
rippa [rippa!] has joined ##java [03:18]
Drewery [Drewery!~root@] has joined ##java [03:32]
progart [progart!~kamee@] has joined ##java [03:40]
dendazen [dendazen!~dendazen@] has joined ##java [03:43]
fstd_ [fstd_!~fstd@unaffiliated/fisted] has joined ##java [03:44]
wyre [wyre!~wyre@unaffiliated/wyre] has joined ##java [03:46]
wyre ty, dreamreal :-) [03:49]
dreamreal wyre: What'd I do? [03:50]
wyre the answer about package names [03:50]
plitter surial, cheeser, thanks for the input. I'll check out JOOQ [04:09]
paddyez [paddyez!~paddyez@wikipedia/paddyez] has joined ##java [04:12]
cheeser jooq++ [04:12]
cheeser i mean, if you're stuck with a relational database... :D [04:13]
acidjnk_new [acidjnk_new!] has joined ##java [04:14]
MadLamb [MadLamb!] has joined ##java [04:17]
MadLamb Any guess? [04:18]
ernimril MadLamb, about what? Seems you use 8GB of heap memory, seems like your gc activity is a bit high [04:19]
ernimril MadLamb, but since your max heap is 16 GB that does not look too odd or out of place [04:20]
MadLamb ernimril, its a memory intensive process, but what feels really odd is the CPU behaviour in the left [04:21]
MadLamb the crazy ups and downs [04:21]
ernimril MadLamb, what about io? is your system io starved from time to time? [04:22]
MadLamb it starts normal until certain point (different logic) [04:22]
MadLamb do you mean the down could be io? [04:22]
ernimril MadLamb, yes [04:23]
ernimril MadLamb, waiting for disk tends to take time, when you have to [04:23]
MadLamb hmm [04:23]
MadLamb its a good idea, thanks [04:23]
ernimril MadLamb, now, I do not know what your application does so hard to say [04:23]
MadLamb its supposed to be all in memory [04:24]
ernimril MadLamb, grab some stack traces and see where it spends its time, see if you can hit the time the cpu is down [04:24]
MadLamb thanks [04:26]
kupi [kupi!uid212005@gateway/web/] has joined ##java [04:26]
TechnicianLP [TechnicianLP!~Technicia@2a02:8071:2295:3100:4df1:57cd:be1d:22c1] has joined ##java [04:30]
palasso [palasso!~palasso@unaffiliated/palasso] has joined ##java [04:32]
pioto [pioto!~pioto@unaffiliated/pioto] has joined ##java [04:32]
TechnicianLP Im playing around with classloaders currently: How would i go about getting a List of the methods (or fields) contained in a class i load with said loader without initializing said classes reflection cache (ie without using the reflection api to do so) [04:33]
yawkat asm [04:34]
yawkat but why? [04:34]
TechnicianLP because i want try to disable reflective access in said classloader (sun.reflect.Relection has blacklists but they only work if the cache hasnt been built yet) [04:36]
yawkat application-level sandboxing in java is broken [04:37]
yawkat dont do it [04:37]
yawkat it also plain doesnt work for all reflection. [04:38]
TechnicianLP i know sandboxing doesnt work - i even know a way around that very blacklist [04:38]
TechnicianLP just toying around with stuff until it breaks [04:38]
ernimril TechnicianLP, have you use asm or any other bytecode library? asm is pretty easy to use, but it is also low level [04:45]
TechnicianLP was afraid that would be my only option - might come back to playing with asm at a later date [04:47]
jaziz [jaziz!~jaziz@unaffiliated/jaziz] has joined ##java [04:47]
dreamreal roaster, maybe? [04:49]
ernimril dreamreal, is that not for source? [04:51]
dreamreal hmm, maybe it is [04:51]
dreamreal roaster [04:51]
dreamreal dreamreal, what does that even *mean*? [04:51]
dreamreal yeah, it is [04:52]
ernimril roaster seems to be a wrapper around the eclipse compiler, different usage goal, but no parser of their own [04:55]
ernimril (a bit strange for a project that was previously named "java-parser") [04:56]
dreamreal barbie making your own parser [04:56]
dreamreal <barbie>making your own parser is hard!</barbie> [04:56]
ernimril dreamreal, no it is not, I have done one myself :-) [04:57]
dreamreal It's actually called "humor" [04:57]
yawkat it's not the parsing that's hard, it's the resolving. [04:57]
yawkat actually, both are pretty hard. [04:57]
ernimril dreamreal, not a full compiler yet, but the parser is actually pretty nice and fast :-) [04:58]
ernimril yawkat, resolving? [04:58]
yawkat "what does this symbol refer to" [04:58]
Merlin_O The Java syntax is actually rather easy to parse [04:58]
Merlin_O (grammar) [04:58]
yawkat ehhh [04:58]
ernimril Merlin_O, uh, no. the modern java syntax is quite complex [04:58]
Merlin_O Talking about Java 13 [04:59]
yawkat really depends on what you mean by "easy" [04:59]
Merlin_O Compared to languages like C++ that is [04:59]
ernimril Merlin_O, you need infinite lookahead, you can not lex in a normal sense [04:59]
yawkat Merlin_O: thats more because c++ is ridiculous than because java is easy [04:59]
Merlin_O Well compared to Pythons Grammar, Java is harder to parse. Thats right [05:00]
ernimril yawkat, ok, for me resolving was not hard to implement in the first iteration of parjac I made, I have not gotten that far with parjac2 yet, but I think I can easily port the previous work [05:00]
Merlin_O Infinite Lookahead of tokens in actually not hard to do [05:00]
tang^ conversion question: int -> String: is there any functional difference between String.valueOf(int) and Integer.parseInt(String)? [05:00]
yawkat yes, they do opposite things. [05:01]
Merlin_O Hea [05:01]
Merlin_O Yeah [05:01]
tang^ oh wait... I meant Integer.toString(int) [05:01]
yawkat no, they are identical. [05:01]
yawkat The representation is exactly the one returned by the {@code Integer.toString} method of one argument. [05:01]
tang^ okay [05:02]
Merlin_O Those are easy questions [05:02]
yawkat ernimril: imo method resolution is pretty complicated especially with fun inheritance rules. [05:02]
Merlin_O Nice questions are: How many executions levels are in the modern HotspotVM (TieredCompilation) [05:02]
yawkat and then you have variable captures, etc [05:02]
ernimril yawkat, yep, a lot of work, just not a part that I felt was complicated [05:03]
yawkat fair enough, i guess it's just writing down the jls. [05:03]
Merlin_O Semantical Analysis of a Java Program is interesting... And sometimes painful [05:04]
Merlin_O The JLS is pretty vague in some chapters [05:04]
yawkat not for resolution fortunally. [05:04]
yawkat fortunately. [05:04]
ernimril and when javac and jls disagree then mostly they change the jls ... :-) [05:04]
Merlin_O Just re-read the JMM specs yesterday (17 Threads and Locks) [05:05]
Merlin_O JavaC's Codebase is painful to look at (IMO). More nested classes than translation units. [05:07]
LearnAllTheTime [LearnAllTheTime!~LearnAllT@2601:cc:4000:9db0::4801] has joined ##java [05:09]
yawkat it's amazing that there's something worse than ecj but javac takes the cake. [05:10]
Merlin_O Well I wont even dare look at eclipse code once again in my life [05:11]
ernimril yawkat, feel free to help me complete parjac2 and we can have a nice compiler codebase [05:11]
yawkat haha [05:12]
yawkat my todo list is too long for that. [05:13]
ernimril mine too, but it is a fun pet project [05:13]
Merlin_O ernimril are you indenting with tabs and spaces? The format looks weird when having a tab-width of 2 [05:14]
ernimril Merlin_O, yeah, use 4 or reformat to fit your style [05:14]
ernimril Merlin_O, do you know of earley parsing? [05:15]
Merlin_O Yes [05:16]
dreamreal earley parsing [05:26]
dreamreal dreamreal, what does that even *mean*? [05:26]
dreamreal looks at ernimril and Merlin_O [05:26]
Merlin_O early parsing is an algorithm [05:26]
dreamreal yes, I know. Now teach the bot. [05:26]
Merlin_O for parsing a context-free grammar [05:26]
ernimril [05:26]
ernimril the base is pretty easy to implement [05:27]
Merlin_O I've always seen it as rather esoteric [05:27]
dreamreal sighs [05:28]
ernimril it is not widely used, but not having to care about left or right recursion is pretty good. After trying with javacc and antlr and looking at javac and ecj I just read up and wanted to try some things. It works out well [05:29]
dreamreal earley parser is <reply>The Earley Parser is an algorithm for parsing strings that belong to context free languages. (Java is a contextual language, so it tends to use LL and LR parsers, citation needed.) See for more [05:30]
dreamreal OK, dreamreal. [05:30]
dreamreal ^^ good enough? [05:30]
dreamreal no, earley parser is <reply>The Earley Parser is an algorithm for parsing strings that belong to context free languages. (Java is a contextual language, so it tends to use LL and LR parsers, citation needed.) See for more details, and for other parsers suitable for writing contextual grammars, see ~javacc and ~antlr. [05:30]
dreamreal OK, dreamreal. [05:30]
Merlin_O Gotta go. Its late in Germany Bye [05:32]
Diablo-D3 what languages would you need an earley parser for? [05:35]
tang^ coffee maybe? [05:36]
ernimril Diablo-D3, "need"? it is a general algorithm so it can work on most. I use it for java 11 [05:37]
dreamreal so is that factoid satisfactory? I don't normally write parsers, guys [05:37]
ernimril dreamreal, good enough I guess [05:37]
Diablo-D3 ernimril: as opposed to a traditional parser [05:38]
ernimril Diablo-D3, earley is one of the traditional, check its history. but sure, lalr and ll parsing has been more common [05:38]
Diablo-D3 lets try this again [05:39]
Diablo-D3 what languages are not contextual [05:39]
Jigsy` [Jigsy`!~Jigsy@unaffiliated/jigsy] has joined ##java [05:42]
TechnicianLP parted the channel: "Leaving" [05:42]
waz [waz!~waz@pdpc/supporter/active/waz] has joined ##java [05:46]
iam730 [iam730!] has joined ##java [05:46]
CuriousMind [CuriousMind!cfed936c@gateway/web/cgi-irc/] has joined ##java [05:50]
CuriousMind Hello, is this the place where I can get help with writing servlet code? [05:51]
tang^ probably [05:52]
CuriousMind ok. I am trying to do this homework assignment. I have three tasks to do [05:54]
CuriousMind If I have a question then I'll ask [05:54]
dreamreal note that we will help with *servlets* but not *homework* [05:58]
bf_ [bf_!] has joined ##java [06:04]
waz [waz!~waz@pdpc/supporter/active/waz] has joined ##java [06:13]
nb-ben hi waz [06:13]
CuriousMind [CuriousMind!cfed936c@gateway/web/cgi-irc/] has joined ##java [06:22]
CuriousMind hi dreamreal, I understand [06:22]
sleepywitch [sleepywitch!] has joined ##java [06:43]
CuriousMind I am on my last assignment [06:56]
CuriousMind I am trying to figure out how to get the user string for the different browsers [06:56]
dendazen [dendazen!] has joined ##java [06:56]
CuriousMind user agent string [06:56]
Kol [Kol!] has joined ##java [06:59]
donofrio_ [donofrio_!] has joined ##java [07:00]
cheeser it's ... a header value... [07:00]
CuriousMind cheeser, so I'm literally missing it right? [07:01]
CuriousMind Thank you [07:01]
atslash [atslash!] has joined ##java [07:02]
CuriousMind cheeser: I'm sorry, can you help me? I don't know what I'm doing lol [07:04]
Seldon75 [Seldon75!] has joined ##java [07:04]
Seldon75 gzilla [07:04]
CuriousMind I know I'm grabbing the user agent with this code: String userAgent = request.getHeader("User-Agent"); [07:05]
cheeser and? [07:06]
CuriousMind I'm trying to determine the browser type based off that value "userAgent" :) [07:06]
cheeser "ok." "and?" [07:07]
CuriousMind Hmmmmm [07:07]
CuriousMind Ok so I research things like "mozilla user agent string", "chrome user agent string" and there are so many of them [07:07]
CuriousMind According to my hw, I must get it for Internet Explorer and Firefox [07:08]
ravenousmoose [ravenousmoose!] has joined ##java [07:08]
myke this isn't really a java question [07:08]
myke the user agent string is arb [07:08]
myke arbitrary [07:09]
cheeser basically what myke said. [07:09]
cheeser if you need help with writing the java code, 1) god help you because ffs that's basic and 2) ask [07:10]
CuriousMind the user agent string is arbitrary, ok I see [07:10]
CuriousMind I'm a student please cheeser lol [07:10]
CuriousMind ok, can you please help me write the java code so that I am able to determine if the request is coming from an IE or Mozilla client? [07:11]
cheeser homework [07:12]
cheeser We don't answer homework-style questions here. Homework assignments often intentionally ask you to produce bad code: You generally HAVE to use some mechanism even though it isn't the best tool for the job, and '.. just use this library that does all that in a very nice way!' is usually not acceptable. That makes them VERY frustrating questions. [07:12]
cheeser if you have questions, ask. but if your question is "write the code for me" then the answer is no. [07:12]
CuriousMind ok no problem that's fair [07:13]
quadsar [quadsar!~quadsar@unaffiliated/quadsar] has joined ##java [07:14]
sleepywitch [sleepywitch!] has joined ##java [07:15]
yokel [yokel!~yokel@unaffiliated/contempt] has joined ##java [07:16]
nun [nun!] has joined ##java [07:19]
nokdoot [nokdoot!~nokdoot@] has joined ##java [07:26]
dendazen [dendazen!] has joined ##java [07:33]
c0ns [c0ns!] has joined ##java [07:34]
dendazen [dendazen!] has joined ##java [07:38]
g00s [g00s!~g00s@unaffiliated/g00s] has joined ##java [07:47]
VegetarianFalcon [VegetarianFalcon!uid258908@gateway/web/] has joined ##java [07:47]
ravenousmoose [ravenousmoose!] has joined ##java [07:48]
waz [waz!~waz@pdpc/supporter/active/waz] has joined ##java [08:04]
quadsar [quadsar!~quadsar@unaffiliated/quadsar] has joined ##java [08:08]
Jantz [Jantz!] has joined ##java [08:08]
Bebef [Bebef!] has joined ##java [08:13]
yawkat [yawkat!] has joined ##java [08:19]
cnsunyou1 [cnsunyou1!~cnsunyour@] has joined ##java [08:22]
golevka6489 [golevka6489!~golevka@2604:6000:130e:c780:55f2:a0e4:3110:de8] has joined ##java [08:25]
Jigsy` [Jigsy`!~Jigsy@unaffiliated/jigsy] has joined ##java [08:26]
dendazen [dendazen!] has joined ##java [08:28]
LearnAllTheTime [LearnAllTheTime!~LearnAllT@2601:cc:4000:9db0::4801] has joined ##java [08:41]
hypc1 [hypc1!~Thunderbi@] has joined ##java [08:45]
rruizt [rruizt!] has joined ##java [08:55]
Diablo-D3 hey guys [09:00]
mgrech [mgrech!] has joined ##java [09:00]
Diablo-D3 if something is an app, not a library, not a framework, outside code will never call it [09:00]
Diablo-D3 how much of an asshole would I be if the package for the app was just appname [09:00]
Diablo-D3 not tld.domain.actual.appname [09:01]
dreamreal Diablo-D3: if you're comfortable with it, what does it matter what anyone else thinks [09:02]
cheeser who the fuck would know to care? [09:02]
dreamreal be a java coder! write a Pair! [09:02]
cheeser it's self-contained. just do whatever you want. [09:02]
nav2002 [nav2002!~nav2002@] has joined ##java [09:02]
Diablo-D3 cheeser: thats what Im thinking [09:02]
Diablo-D3 but theres clearly cultural concerns over it [09:02]
dreamreal uhhh. from whom, why do they matter [09:02]
Diablo-D3 like, are there real life examples where someone went with that and never looked back? [09:02]
dreamreal it's your code, do what you want [09:03]
dreamreal sure, I've done stuff like that [09:03]
dreamreal I tend to gravitate to com.autumncode or com.enigmastation just for convention's sake (I don't know if I'll open source what I'm writing) but ... dang, have the courage of your own convictions [09:03]
dreamreal nobody else matters [09:03]
cheeser trust i seek and i find in you [09:04]
Diablo-D3 cheeser: I see what you did there. [09:05]
dreamreal that's "nothing else matters," you moran! [09:05]
Diablo-D3 yes, thus, there, I see what he did [09:06]
sbalmos not even a spoon? [09:06]
dreamreal well, the spoon is the spoon of eating utensils [09:06]
Diablo-D3 we're still supposed to have lowercase package names, though, right? [09:07]
sbalmos dreamreal: I have a whole hierarchy of tools packages, rooted at My most heavily used 2 so far are dreamreal and cheeser [09:07]
dreamreal haha [09:08]
dreamreal sbalmos ++ that was pretty elegant [09:08]
dreamreal sbalmos has a karma level of 86, dreamreal [09:08]
sbalmos D [09:09]
mgrech parted the channel: [09:11]
oats [oats!~hurr@durr/im/a/sheep] has joined ##java [09:26]
oats parted the channel: "WeeChat 2.6" [09:26]
hypc1 [hypc1!~Thunderbi@] has joined ##java [09:44]
ChaiTRex [ChaiTRex!~ChaiTRex@unaffiliated/chaitrex] has joined ##java [09:45]
linext [linext!] has joined ##java [09:47]
Jantz [Jantz!~IceChat9@2407:7000:8d04:100:79b3:a804:4c1e:ce93] has joined ##java [09:55]
sshine [sshine!] has joined ##java [09:57]
sshine parted the channel: [09:57]
polyrob_ [polyrob_!~rob@unaffiliated/mickn] has joined ##java [10:02]
rajrajraj [rajrajraj!uid72176@gateway/web/] has joined ##java [10:05]
yokel [yokel!~yokel@unaffiliated/contempt] has joined ##java [10:11]
hypc1 [hypc1!~Thunderbi@] has joined ##java [10:13]
tristianc_ [tristianc_!] has joined ##java [10:20]
macroprep [macroprep!] has joined ##java [10:22]
zalt hmm, i'm beginning to figure out how to make async code less painful, mostly by having coarse grained error handling, and synchronous callbacks with use of generic interfaces [10:22]
zalt this kind of thing would be practically impossible in java 7 right?, no lambda expressions. [10:23]
zalt i wonder does the transition from java 8 to 11 offer any relevant features? [10:24]
dreamreal java 7 could do it with callbacks fine [10:24]
zalt but you'd need explicit classes right? [10:24]
dreamreal anonymous classes are really common [10:25]
dreamreal new ActionListener() { public void handleEvent(Event event) { ... } } // which is what the lambda ends up being anyway [10:25]
zalt oh, so that's an option in java 7? [10:26]
dreamreal what, the anonymous class? [10:26]
zalt yes [10:26]
dreamreal It's been an option since... like.... java 1.2 [10:26]
dreamreal maybe 1.1 [10:26]
zalt lol [10:26]
zalt my only experience with java 7 is a little bit of android [10:27]
dreamreal which was not java at all [10:27]
zalt i bet java 8 can be used in android right?, but it's not the default iirc [10:27]
dreamreal anyway, g'night [10:27]
zalt >not java at all [10:27]
zalt >inferior android developers [10:31]
zalt >must use java for Real purposes, even though it's the same language, it's not java when used for android or minecraft [10:32]
Nightwing52 [Nightwing52!~Thunderbi@] has joined ##java [10:33]
VegetarianFalcon [VegetarianFalcon!uid258908@gateway/web/] has joined ##java [10:38]
ChaiTRex zalt: I haven't really done Android programming, but the standard libraries Java uses for a lot of things that are included with Java, like Swing, I don't think are usable with Android. [10:38]
ChaiTRex zalt: The included libraries are a pretty important part of Java, and Google throwing them away to start fresh is a reason that Android stuff isn't handled here, it's handled on its own channels. [10:39]
RedSoxFan07 [RedSoxFan07!] has joined ##java [10:41]
fairuz [fairuz!~fairuz@unaffiliated/fairuz] has joined ##java [10:42]
dansan [dansan!] has joined ##java [10:46]
zalt [zalt!~lambda443@unaffiliated/lambda443] has joined ##java [10:52]
Goplat [Goplat!~Goplat@reactos/developer/Goplat] has joined ##java [11:00]
hypc [hypc!~Thunderbi@] has joined ##java [11:04]
hypc [hypc!~Thunderbi@] has joined ##java [11:08]
hypc [hypc!~Thunderbi@] has joined ##java [11:19]
quadsar [quadsar!~quadsar@unaffiliated/quadsar] has joined ##java [11:24]