Info

Login

Channels

APIs

Credits

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

« 2021-05-05

2021-05-06

2021-05-07 »

Nick Message Date
hussam [hussam!~hussam@unaffiliated/hussam] has joined ##java [12:07]
cixx [cixx!~user@vmi489242.contaboserver.net] has joined ##java [12:37]
shailangsa [shailangsa!~shailangs@host217-35-224-169.range217-35.btcentralplus.com] has joined ##java [12:54]
sa02irc [sa02irc!~mbax@155-079-043-212.ip-addr.inexio.net] has joined ##java [01:06]
SwiftMatt [SwiftMatt!~Objective@2601:282:4300:3e:c180:7e68:d2ac:be83] has joined ##java [01:17]
xuxx [xuxx!~jouts@109.41.176.95.rev.sfr.net] has joined ##java [01:31]
xuxx I'm stuck with Maven, I added a dependency to commons.codec to have the Hex class. But I have ClassNotFoundException with I start my java app [01:33]
xuxx I think it's a known problem from my research but I can't find a solution for me [01:33]
pieguy128 [pieguy128!~pieguy128@bras-base-mtrlpq5031w-grc-47-67-70-101-46.dsl.bell.ca] has joined ##java [01:58]
recursiveNode [recursiveNode!~recursive@ip-86-49-255-227.net.upcbroadband.cz] has joined ##java [02:02]
darkstardev13 [darkstardev13!~darkstard@2601:1c2:300:c8a0::b865] has joined ##java [02:04]
DasBrain [DasBrain!~DasBrain@unaffiliated/dasbrain] has joined ##java [02:05]
davidv7_ [davidv7_!~davidv7@BSN-143-127-16.dynamic.siol.net] has joined ##java [02:20]
Matthijs [Matthijs!~quassel@unaffiliated/matthijs] has joined ##java [02:25]
AmVarPG [AmVarPG!~amvarpg@pool-100-36-155-137.washdc.fios.verizon.net] has joined ##java [02:27]
ge0rgios [ge0rgios!~george@unaffiliated/anaphaxeton] has joined ##java [02:41]
orbyt_ [orbyt_!~orbyt@172.92.4.78] has joined ##java [02:44]
Jantz [Jantz!~IceChat95@2407:7000:8d04:100:9547:b136:6ca4:53c] has joined ##java [02:52]
Jantz_ [Jantz_!~IceChat95@118-93-31-67.dsl.dyn.ihug.co.nz] has joined ##java [03:33]
orbyt_ [orbyt_!~orbyt@172.92.4.78] has joined ##java [03:40]
MatthijsH [MatthijsH!~quassel@unaffiliated/matthijs] has joined ##java [03:53]
CombatVet [CombatVet!~c4@gateway/tor-sasl/combatvet] has joined ##java [03:59]
mbooth classpath [03:59]
mbooth xuxx, The classpath tells Java or the compiler which jar files and folders to search for classes and resources. Use the -cp/-classpath run-time options to specify the classpath (does NOT work with -jar!). Also see http://bit.ly/15InVZQ [cheeser's blog], http://bit.ly/19MnH5C [oracle.com], or http://bit.ly/2aJ5MoG for more information. [03:59]
DunceCotus [DunceCotus!01986acd@1.152.106.205] has joined ##java [04:03]
xuxx mbooth: I don't have a jar file [04:05]
xuxx mbooth: it uses maven central repo [04:05]
aquijoule_ [aquijoule_!~richbridg@213-225-10-171.nat.highway.a1.net] has joined ##java [04:06]
dpl [dpl!~dpl@77-121-78-163.chn.volia.net] has joined ##java [04:10]
hendursaga [hendursaga!~weechat@gateway/tor-sasl/hendursaga] has joined ##java [04:12]
_lucifer xuxx: show us the pom file [04:19]
xuxx _lucifer: ok wait [04:20]
mbooth xuxx: You do have the jar file, maven downloads all deps to your local repository [04:21]
xuxx I have 4 dependencis [04:22]
xuxx I works with 2 of them [04:22]
xuxx and the other fail [04:22]
xuxx http://ix.io/3lVL [04:22]
[twisti] how do they 'fail' ? [04:23]
[twisti] maybe pastebin the source file you are trying to compile and the actual error [04:23]
xuxx [twisti]: NoClassFoundError [04:23]
xuxx Ok I did a bad reporting jobs [04:23]
LKoen [LKoen!~LKoen@140.170.9.109.rev.sfr.net] has joined ##java [04:23]
xuxx I will do something clearer sorry [04:23]
[twisti] just pastebin the whole error [04:23]
xuxx https://bpa.st/QOMQ [04:31]
xuxx [twisti] [04:31]
xuxx [twisti]: https://bpa.st/UCKA [04:32]
xuxx with the code [04:32]
[twisti] for what its worth, that looks INCREDIBLY outdated [04:35]
[twisti] wait, my bad, thats just sonatype being stupid [04:35]
xuxx [twisti]: I think it is ^^ [04:36]
[twisti] its from 2014, and the latest version is from august 2020 [04:36]
xuxx [twisti]: for apache commons ? [04:36]
[twisti] commons-codec [04:36]
xuxx [twisti]: yes I tried to change version [04:37]
[twisti] https://search.maven.org/artifact/commons-codec/commons-codec has a list of versions [04:37]
[twisti] [twisti]'s title: "Maven Central Repository Search" [04:37]
xuxx At the beginning I took the lates but I thought that my problem could be related to the version [04:37]
mbooth xuxx: That does not look like output from mvn compile? [04:37]
[twisti] but it says that class is in since 1.1, and you have 1.10, so that shouldnt be the problem [04:37]
xuxx mbooth: mvn compile works [04:37]
xuxx it's when I execute that I have this error [04:37]
mbooth xuxx: And what command are you running? [04:37]
xuxx mbooth: I go in the target/classes [04:38]
xuxx and do [04:38]
xuxx java Main [04:38]
mbooth xuxx: So you are not specifying classpath [04:38]
[twisti] how would that work ? youre not supplying a class path [04:38]
mbooth You need to include all your run-time deps on the classpath [04:38]
mbooth As I said earlier :-/ [04:38]
mbooth classpath [04:39]
mbooth xuxx, The classpath tells Java or the compiler which jar files and folders to search for classes and resources. Use the -cp/-classpath run-time options to specify the classpath (does NOT work with -jar!). Also see http://bit.ly/15InVZQ [cheeser's blog], http://bit.ly/19MnH5C [oracle.com], or http://bit.ly/2aJ5MoG for more information. [04:39]
[twisti] mbooth++ [04:39]
[twisti] mbooth has a karma level of 79, [twisti] [04:39]
xuxx [twisti]: but ok [04:39]
xuxx why for the first 2 dependency when I do that it works ? [04:40]
xuxx And it only fail for the apache one [04:40]
[twisti] xuxx: what makes you think those would work ? [04:40]
xuxx [twisti]: I tried [04:40]
[twisti] can you show something you tried that worked ? [04:40]
mbooth If it does work, it's probably because you don't reference any classes from your other deps [04:40]
xuxx k [04:40]
[twisti] what youre getting is a runtime error, not a compile error. runtime errors appear in the order the code is actually run, and the code you showed is trying to run that dependency as the first one, so thats why you get the error about that one [04:42]
xuxx [twisti]: Yes but without the apache one, I can run code with the 2 first dependency [04:42]
xuxx Let me show you [04:42]
[twisti] presumably, if you changed line 19 from "byte[] appletAIDBytes = Hex.decodeHex(appletAIDString.toCharArray());" to "byte[] appletAIDBytes = null", you would then get an error about AID missing [04:42]
perrier-jouet [perrier-jouet!~perrier-j@modemcable012.251-130-66.mc.videotron.ca] has joined ##java [04:42]
xuxx [twisti]: wait it fails now, yesterday it worked [04:43]
xuxx Or I was crazy [04:43]
[twisti] ) [04:43]
mbooth uhuh [04:43]
RonaldsMazitis2 [RonaldsMazitis2!50e8a2e2@gateway/web/cgi-irc/kiwiirc.com/ip.80.232.162.226] has joined ##java [04:43]
[twisti] its possible that yesterday you had code that contained those classes, but wasnt actually run, so you never noticed it wouldnt have worked [04:43]
xuxx [twisti]: yes I had the lib in a lib/ folder [04:44]
mbooth Hey that's my theory "If it does work, it's probably because you don't reference any classes from your other deps" [04:44]
xuxx I removed it when I saw that there is a central repo [04:44]
xuxx mbooth: yes you are right [04:44]
xuxx I'm sorry [04:44]
[twisti] for what its worth, you can do `mvn exec:java -Dexec.mainClass="Main"` (without the `s) to use mavens dependency configuration [04:45]
xuxx hmm [04:45]
xuxx [twisti]: ok ! I try that [04:45]
mbooth Or your IDE ;-) [04:45]
xuxx mbooth: I don't have one [04:45]
mbooth ... [04:45]
xuxx mbooth: I'm connected to a rpi with ssh so I just have a terminal [04:45]
[twisti] mainClass might not be right, you seem to be using the default package (which you shouldnt), and i dont quite remember if thats the right way to reference classes in default [04:45]
[twisti] but ... why ? [04:46]
mbooth xuxx: You can do remote development with an IDE.... [04:46]
xuxx mbooth: Ok, I will check then I didn't knew that [04:46]
xuxx know* [04:46]
xuxx mbooth: is it easy to do ? [04:47]
mbooth xuxx: Yes, simplest way is probably to use sshfs, but Eclipse has plugins to enable development of code on a remote machine too, like RSE [04:51]
mbooth xuxx: Eclipse supports remote debugging out-of-the-box, too [04:52]
mbooth (As does every IDE in the world, I imagine) [04:52]
ge0rgios [ge0rgios!~george@unaffiliated/anaphaxeton] has joined ##java [04:52]
mbooth xuxx: Here's FAQ for Eclipse RSE https://wiki.eclipse.org/TM_and_RSE_FAQ [04:52]
mbooth mbooth's title: "TM and RSE FAQ - Eclipsepedia" [04:53]
mbooth Important section is maybe "How can I use a remote workspace over SSH?" [04:53]
mbooth I'm sure IntelliJ has similar, but you'd need to ask intelliJ folks [04:54]
mbooth Think I scared em off? [04:56]
xuxx mbooth: ty dude !! [04:59]
acidjnk_new2 [acidjnk_new2!~acidjnk@p200300d0c72b9513e05ff4b2b19e02c9.dip0.t-ipconnect.de] has joined ##java [05:05]
olle [olle!~olle@i577BC827.versanet.de] has joined ##java [05:15]
olle Imagine you have a class Rectangle with methods draw(surface), toString(), save(dbConnection) and area(). Which methods would you prefer to move to a separate class, and why? [05:16]
olle (There are other shapes too, like Point and Circle) [05:16]
olle Rectangle has two properties: Point bottomLeft, Point topRight. [05:16]
dabukalam [dabukalam!~dabukalam@unaffiliated/dabukalam] has joined ##java [05:16]
dec0d3r [dec0d3r!~dec0d3r@2001:8003:4860:b200:2e33:764e:2cb7:eba5] has joined ##java [05:20]
Lengsdorfer [Lengsdorfer!~Lengsdorf@unaffiliated/lengsdorfer] has joined ##java [05:22]
DunceCotus well area() and save(dbConnection) could be useful for other shapes [05:24]
DunceCotus draw too but might need more specificity for each shape, I dunno [05:25]
olle DunceCotus: Assume we want to preserve polymorphism. At least some kind of. [05:26]
unsyncing [unsyncing!~unsyncing@185.242.5.66] has joined ##java [05:37]
[twisti] really none of those methods should be moved away, because only rectangle itself will know how to implement any of them properly. of course, this sounds like a text book question from 30 years ago; this day and age, you would use a framework, any framework, to save you from having to write save(dbConnection) at all [05:46]
olle [twisti]: sure, but it could be any type of method that depends on an effectful class. [05:48]
olle [twisti]: people answer that question *very* differently. [05:48]
olle Most people on PHP-land recommended to move out everything that depends on a "service class"/effectful class like draw, save to db, etc [05:49]
bolovanos [bolovanos!~bolovanos@unaffiliated/bolovanos] has joined ##java [05:52]
[twisti] its kind of an academic design question for teaching, in reality you probably wouldnt design that way at all [05:54]
olle Well, the reality is class cohesion vs module cohesion :) [05:54]
[twisti] the conceptual idea/math background of a rectangle, drawing things and saving things to databases arent really concepts you tend to clump together in a real software project [05:55]
olle And encapsulation [05:55]
olle E.g. if Point (x, y) should not be accessible from the outside [05:55]
olle Or only readonly [05:55]
[twisti] absolutely immutable, no question asked [05:55]
zikani03 [zikani03!~zikani03@41.75.123.113] has joined ##java [05:56]
olle Yes, but immutable vs completely private [05:56]
olle Or package private [05:57]
olle [twisti]: How would you split save/draw/etc from Point or Rectangle while keeping polymorphism? [05:57]
olle Like drawing a list of shapes. [05:57]
[twisti] i find that question hard to answer in any useful way because i guess it just doesnt sound like actual software one would design. my answers would depend on why im having rectangles in the first place, and why i want to draw them [05:59]
olle ^^ [05:59]
olle Could be a plotting tool, for example [05:59]
[twisti] like, are these primitives for a grafics library where im going to have millions of them ? part of a math/geometry program where i want to reason about specific polyhedrons or whatever ? [05:59]
olle Assuming performance is not that important [06:01]
KidBeta [KidBeta!~Kidbeta@hpavc/kidbeta] has joined ##java [06:01]
callq [callq!~callq@157.41.89.159] has joined ##java [06:05]
[twisti] the breadth of field is also a concern - for drawing shapes, for example, i would probably in reality forgoe object oriented design completely. drawing is sort of complicated, and there usually arent that many shapes youd want to support. i would, if the goal is primitives or close to it, have the drawing code in a single method, or at most a single class. i would spread the drawing code if the goal was a software that supported drawing many exotic [06:11]
[twisti] and strange shapes like flattened multidimensional stuff [06:11]
[twisti] this is a topic you might also want to bring to ##programming, as it has very little to do with java [06:12]
olle True [06:12]
olle Just fun to see how the different communities react :) [06:12]
olle Asked in #haskell before [06:12]
_lucifer ? [06:13]
olle It's also about having a sound base to build on, keep adding new methods (and possibly data, if you want the point to be 3D for some reason later) [06:23]
olle And new shapes, of course [06:23]
Acru [Acru!c2a6b949@194-166-185-73.adsl.highway.telekom.at] has joined ##java [06:24]
dreamreal morning [06:27]
dreamreal olle: this feels very very academic [06:27]
dreamreal suffering [06:27]
dreamreal Suffering-oriented programming: make it work, make it pretty, make it fast - in that order. http://nathanmarz.com/blog/suffering-oriented-programming.html [06:27]
dreamreal This feels like you're focusing on point #2, which is actually WAY WAY WAY WAY WAY less important than point #1 [06:27]
Acru Hey, I am currently creating a service with two threads, where one thread is creating a document with data the second thread is fetching. What is the best way to wait for data which is not yet present? A latch? Or using a queue for communication and blocking until we get the correct data? [06:28]
dreamreal semaphore or a queue, sure [06:28]
olle I'm working on a web app from 2003. We have lots of technical debt and need a way forward, with clear motivations for all decisions. dreamreal [06:28]
olle It's indeed "working" [06:28]
dreamreal olle: I'm sure you do. Yet this still feels like it's focusing on the wrong things in the process. [06:28]
olle What would be the correct thing in your opinion? [06:29]
dreamreal I don't know, because I'm not there. Let's be real: you could be perfectly correct in how you're doing this. It just doesn't feel optimal to me, from here. [06:29]
dreamreal Are you doing a burn-down rewrite, or migration, or... [06:29]
Acru dreamreal I was also thinking maybe a shared memory approach with postgresql triggers? [06:30]
olle dreamreal: new quality guide for the team [06:30]
dreamreal Acru: postgres for sync in a *single* process? [06:30]
olle "What's a good function", "What's a good class", etc etc [06:30]
dreamreal olle: What I think I would do - again, from here, so you have insight I do not - is adopt google's style guide (for example... any would do) and then institute code reviews using the guide as a simple metric [06:31]
Acru dreamreal well it would be 2 processes, the creator and the fetcher if thats what you mean [06:31]
olle dreamreal: that's superficial and already taken care of [06:31]
dreamreal and the tone of the early reviews should be encouraging and inclusive until people "get it" with an iron hand that says "I'm sorry but no" [06:31]
Acru But the more I think about it, the more attractive the queue approach becomes [06:32]
dreamreal olle: that's your best approach, though.. and if you think it's superficial, maybe that's the problem [06:32]
olle Google style guide is crazy vague, honestly ^^ [06:32]
dreamreal Acru: do what works for you. If I had ONE JVM and TWO processes in it, I wouldn't use postgres for this. I'd use a semaphore or an internal queue structure: think "BlockingQueue" [06:32]
dreamreal or even an Executor [06:32]
dreamreal producer uses executor.submit(processDatapoint) [06:33]
Acru I would need some data storage anyways probably, so postgres would already be present [06:33]
[twisti] olle: may i point you towards https://adr.github.io/ for your actual problem ? in short, its a system to record, codify and update software architecture decision [06:33]
[twisti] [twisti]'s title: "Architectural Decision Records | adr.github.io" [06:34]
dreamreal Acru: sure. Again, do what works for you. [06:34]
[twisti] well, s/software// [06:34]
dreamreal [twisti] ++ [06:34]
dreamreal [twisti] has a karma level of 138, dreamreal [06:34]
Acru Ah, Executor could also be interesting, but I think I need to preserve context between invocations [06:35]
dreamreal Acru: so you're feeding a state machine? [06:35]
olle [twisti]: thanks, will check! [06:35]
dreamreal (there's no reason an executor couldn't do that, of course) [06:35]
Acru dreamreal yes [06:35]
Acru Without relying on external storage/storing state itself? [06:36]
computeiro [computeiro!~Wender@189.37.65.202] has joined ##java [06:36]
dreamreal sure, you'd just have in-memory state and the runnables would modify it. They could even maintain state in the database, without using the database as an MQ. [06:36]
Acru And where would the in-memory state be stored? [06:37]
wender [wender!~Wender@191.54.175.33] has joined ##java [06:38]
dreamreal say that statement really slowly [06:38]
dreamreal "What color would the purple flag be?" [06:38]
Acru haha [06:38]
dreamreal D [06:38]
Acru No I mean which thread/object would govern the in-memory state ? [06:38]
dreamreal ah, it'd be external to both producers and consumers and they'd access it as an injected entity somehow [06:39]
dreamreal but note that this is the worst kind of armchair analysis [06:39]
Acru Ah yes, now I see, thank you! [06:39]
dreamreal I have no insight into your actual problem, so it might be that I'm coming up with something abjectly terrible and just have no idea [06:39]
dreamreal no clue about transaction boundaries or speed requirements or persistence or anything on my side of this, while you have access to the actual problem statement [06:40]
dreamreal if the BS I'm handing you helps, that's awesome - and if not, well, no skin off my teeth, you know? So use your brain and do what you think is best, even if I don't like it. I don't matter here. [06:41]
Acru I was just curious which approaches I was missing, so thank you! [06:41]
dreamreal you're welcome. [06:41]
dreamreal I want to remember "where would the in-memory state be stored" though, that made me laugh with delight [06:42]
Acru Glad to hear that ? [06:43]
dreamreal I get the reason for the question - clarifications rock - but it was funny to read, and not in a "my god what an idiot" sense [06:44]
RonaldsMazitis30 [RonaldsMazitis30!50e8a2e2@gateway/web/cgi-irc/kiwiirc.com/ip.80.232.162.226] has joined ##java [06:49]
dreamreal ottinger [06:51]
dreamreal dreamreal, what does that even *mean*? [06:51]
dreamreal ottinger horizon [06:51]
dreamreal The Ottinger Horizon is what you cross over when you decide to set sail on the Incompeten Sea. It means you've tried so hard to be a moron or help vampire or whatever that you're no longer worth the effort of trying to help you. Crossing over the Horizon is often accompanied by a "*plonk*" sound as you become persona non grata. [06:51]
dreamreal (Not targeted at anyone here, was quoting it to someone somewhere else) [07:02]
mitch0 "asking for a friend" :) [07:03]
dreamreal heh [07:03]
dreamreal Actually it was making fun of the person for whom it's named :) [07:04]
zikani03 [zikani03!~zikani03@41.75.123.113] has joined ##java [07:07]
DunceCotus [DunceCotus!01986acd@1.152.106.205] has joined ##java [07:15]
donalsd [donalsd!75c2f0dc@117.194.240.220] has joined ##java [07:16]
hotcoffee [hotcoffee!~hotcoffee@177.34.130.242] has joined ##java [07:26]
GnarlyBob [GnarlyBob!~chris@unaffiliated/gnarlybob] has joined ##java [07:31]
stryek [stryek!uid332574@gateway/web/irccloud.com/x-libzklqiowdfwrxf] has joined ##java [07:42]
adder` [adder`!~adder@unaffiliated/adder] has joined ##java [07:46]
[twisti] yeah, ottinger was a well known channel trolls back in yesteryear of ##java [07:47]
zeden [zeden!~user@unaffiliated/zeden] has joined ##java [07:48]
[twisti] -s [07:48]
StyXman [StyXman!~mdione@grulic/root/StyXman] has joined ##java [07:53]
zikani03 [zikani03!~zikani03@41.75.123.113] has joined ##java [07:57]
computeiro [computeiro!~Wender@189.37.65.202] has joined ##java [07:59]
LaSombra Heh [08:00]
xuxx how can I compare 0x9000 and 0x9000 in java ? [08:00]
[twisti] you dont need to, they are equal [08:00]
[twisti] just replace them with true [08:00]
[twisti] what are you actually trying to do ? [08:01]
xuxx [twisti]: I want this result 0x9000 [08:01]
xuxx I want to do an if condition [08:01]
[twisti] if (true) return "0x9000"; [08:01]
xuxx if I go that I do something else something else [08:01]
[twisti] there you go [08:01]
xuxx [twisti]: no but it's not 0x900 that I got for sure [08:02]
xuxx I want this value [08:02]
[twisti] maybe take a step back and describe what you are trying to do, not how you think you can solve it [08:02]
xuxx But I want to compare 0x9000 to the result returned by a function [08:02]
dreamreal sighs [08:02]
dreamreal if(functionCall()==0x9000) {... } [08:02]
[twisti] if (result == 0x9000) ? [08:02]
dreamreal I think we're missing the part where there's a difficulty [08:03]
yawkat what if the result is over 0x9000 [08:03]
xuxx oh k I want thinking that I was different with hex [08:03]
dreamreal it is not [08:03]
[twisti] yawkat: i believe you are thinking of 0x2328 [08:03]
Acru [Acru!c2a6b949@194-166-185-73.adsl.highway.telekom.at] has joined ##java [08:05]
sa02irc [sa02irc!~mbax@155-079-043-212.ip-addr.inexio.net] has joined ##java [08:07]
ofir does the standard require that runtime implementation serialize (lock) static class initializers? (such that if there are multiple threads that want to instantiate a class, it is guaranteed that the code will be called just once) [08:08]
ofir want to instantiate an instance of a class* [08:08]
yawkat yes [08:09]
xace [xace!~noname@unaffiliated/xace] has joined ##java [08:09]
ofir thanks [08:10]
dreamreal should be pretty easy to test. I don't know if the standard enforces it, but create a static initializer that increments a value, then runs a lengthy computation, then decrements the value (while tracking its highest value). Create many threads. Run the initialization of the class. If the "highest value" - a semaphore, you know - ever goes above one, then no, locks don't happen. [08:10]
dreamreal Or you could ask yawkat before I finish typing all that out. [08:10]
dreamreal (I wanted to say "yes" but wasn't sure from a standards POV.) [08:12]
dekenevs [dekenevs!~dekenevs@217.138.252.188] has joined ##java [08:21]
StyXman is it possible to trace java executions line by line, like bash -x or python -m trace --trace? [08:21]
dreamreal to some degree, yes [08:21]
dreamreal see gdb, use use a step function in a debugger [08:22]
StyXman no, automatic, I'm still trying to find my rogue listening socket from yesterday [08:22]
dreamreal jdb, not gdb, sorry [08:22]
dreamreal then no [08:22]
dreamreal not really [08:22]
StyXman and unreally? [08:22]
dreamreal you'd have to ask brighter minds than mine. There are ways to turn on interpreted mode or to get debugging editions of the JVM to output information about lines as they execute, but again, I don't know if that addresses what you want. [08:23]
mbooth StyXman: Why not breakpoint on socket creation? [08:23]
dreamreal I don't know what the "rogue listening socket from yesterday" was, so I have no insight. But sockets should be pretty easy to trace. [08:23]
Territoriojoven [Territoriojoven!~Territori@unaffiliated/territoriojoven] has joined ##java [08:24]
Territoriojoven how could I split a string array into a List<Map<String, String> using the stream API ? [08:25]
dec0d3r [dec0d3r!~dec0d3r@2001:8003:4860:b200:2e33:764e:2cb7:eba5] has joined ##java [08:25]
StyXman mbooth: can you point me to info? is that using jdb? can I bp on syscalls? [08:28]
dreamreal Territoriojoven: how would you do it WITHOUT the stream API? [08:29]
ofir I think that for syscalls you'd have to use gdb and "catch syscall" [08:29]
StyXman would it properly support forking processes? [08:29]
ofir gdb -q --args java -cp ... [08:29]
ofir (gdb) catch syscall [08:29]
ofir run [08:29]
StyXman right [08:29]
ofir but that might be too excessive for your execution [08:30]
mbooth Well I was literally thinking of a breakpoint on creation of a java.net.Socket..... [08:30]
mbooth This is a Java programming channel, not a C debugging channel ;-) [08:30]
dreamreal mbooth: and that woudl be the appropriate solution, for that matter: crank up a debugger, set a breakpoint on teh socket constructors [08:31]
mbooth There are probably better avenues for tech support if your problem is with the JDK itself [08:32]
Territoriojoven dreamreal: i guess it would be a more manual process of iterating, creating each map and adding it to the list [08:32]
dreamreal Territoriojoven: well... if you can do it imperatively, a stream is fairly easy [08:33]
Territoriojoven yeah i just dont really understand how to use the collectors methods [08:33]
dreamreal Stream.of(stringArray).map(e -> breakIntoMapOfStringString).collect(Collectors.toList()) or something like that [08:33]
dreamreal I'm surprised to hear of a "rogue socket" because the JVM is used bloody everywhere and it doesn't magically open sockets at whim. It's almost guaranteed to be in client code somewhere. [08:35]
mbooth dreamreal: My thought too [08:36]
ofir on Python I learned to never use raw sockets, twisted for example abstracts away a lot of platform-specific nuances of sockets [08:42]
StyXman ofir: i found info how to do that in jdb, thanks :) [08:42]
ofir StyXman: great, yw =D [08:42]
dreamreal I get the feeling that this is chasing the wrong problem [08:43]
dreamreal it may be the result, you may actually have a "rogue socket" but chasing it this way is the wrong diagnostic approach [08:43]
binarycreations [binarycreations!~rad@44.236.115.87.dyn.plus.net] has joined ##java [08:43]
dreamreal what does your app do? What external dependencies does it use? [08:43]
ofir could be but sometimes one's intuition is correct and you can save some time [08:43]
ofir and it can save one some time* [08:44]
dreamreal if "let's crank up gdb" is the go-to solution, I think "save some time" is already off the board [08:44]
dreamreal "can" and "may" are hilariously different in likelihood at this point [08:44]
ofir my rule of thumb is that if it takes me more than ~20-30 mins of debugging and I can't find something useful, I usually isolate the code in question [08:44]
ofir and try to create a reproducer with the least amount of code [08:45]
dreamreal it's entirely possible that you crank up gdb and zero in on the problem in ten seconds, sure... but the LIKELIHOOD is that it'll be seven hours of painful tracing with "well we might have found a few candidates but the guy driving gdb went off to get hilariously drunk so he wouldn't kill himself" [08:45]
ranran8888 [ranran8888!6d40b154@gateway/web/cgi-irc/kiwiirc.com/ip.109.64.177.84] has joined ##java [08:45]
ofir lol [08:45]
ofir ymmv [08:46]
ofir I ported gdb to a few platforms, feeling pretty comfortable with low-level debugging [08:46]
mbooth interesting [08:46]
mbooth this is all very interesting (not really) but please take it somewhere else. [08:46]
ofir most of the times I get what I need in a few mins for C/C++ code (or Python bindings using C/C++) [08:46]
dreamreal have you ever used it for java? [08:47]
dreamreal jdb [08:47]
dreamreal JDB is a console-based debugger for Java that's only slightly worse than gdb. Don't use it. Using it is like voluntarily rolling around naked on a floor covered with thumbtacks and about 2cm of grain alcohol, but slightly less pleasant. [08:47]
_lucifer info jdb [08:47]
_lucifer jdb was added by: dreamreal on 07 Dec 2017 at 01:03 and has a literal value of: <reply>JDB is a console-based debugger for Java that's only slightly worse than gdb. Don't use it. Using it is like voluntarily rolling around naked on a floor covered with thumbtacks and about 2cm of grain alcohol, but slightly less pleasant. [08:47]
dreamreal ... I'm pretty sure you guessed who wrote it when you first saw it [08:47]
deepy I used jdb remotely once, it was a lot better than nothing and a lot worse than really anything else [08:47]
_lucifer dreamreal ++ (for the superb factoid) [08:47]
_lucifer dreamreal has a karma level of 1, _lucifer [08:47]
dreamreal deepy ++ hahahaha [08:48]
dreamreal deepy has a karma level of 17, dreamreal [08:48]
mbooth _lucifer: Purple prose? Obviously the professional writer wrote it ;-p [08:48]
dreamreal is a big fan of bands like Yes [08:48]
_lucifer lol [08:49]
mbooth Haha the wikipedia definition of purple prose is purple prose [08:49]
mbooth "purple prose is prose text that is so extravagant, ornate, or flowery" [08:50]
mbooth Welcome to the tautology club [08:50]
mbooth interesting [08:50]
mbooth mbooth, this is all very interesting (not really) but please take it somewhere else. [08:50]
dreamreal mbooth: I have a friend who's working on a wiki for a fictional EU - and I created a character who breaks the system. So if he becomes canonical (which is likely) his wiki page is going to be a 500 error ... :) [08:51]
di0_ [di0_!~di0_@unaffiliated/di0-/x-5053590] has joined ##java [08:51]
bolovanos_ [bolovanos_!~bolovanos@unaffiliated/bolovanos] has joined ##java [08:52]
wedr [wedr!~tom_mai78@pool-108-20-128-8.bstnma.fios.verizon.net] has joined ##java [08:55]
StyXman dreamreal: this one I'm looking at is an API, maybe rest, not sure. it uses jetty, but also a pile of deps [08:55]
StyXman around 100 jars in total [08:55]
StyXman dreamreal: I'm open to suggestion on how to chase this [08:57]
dreamreal StyXman: are you? I mean, mbooth gave you a good one [08:57]
StyXman oh, maybe I missed it [08:58]
StyXman 'breakpoint on socket creation'? I think that's exactly what I'm doing [08:58]
dreamreal yeah, IN A DEBUGGER that isn't gdb/jdb :) [08:59]
ScrambledRK [ScrambledRK!~RK@84-115-208-87.cable.dynamic.surfer.at] has joined ##java [08:59]
StyXman it's complicated [09:00]
StyXman look, I'm no java dev, I'm mostly on the ops side, but I need to track this, so I'm doing my best [09:00]
StyXman the devs won't be up for another 5h [09:01]
deepy it's going to be a lot easier with the proper tools [09:01]
StyXman deepy: agreed, but I can't run this thing on my station [09:01]
dreamreal oof [09:01]
StyXman the beast I'm debugging is hard enough to install as it is [09:01]
StyXman dreamreal: yes, yes, sorry [09:01]
dreamreal sounds like you need better developers :/ [09:01]
deepy StyXman: too slow link for remote debugging? [09:01]
dreamreal I'm sympathetic, honestly, or trying to be [09:02]
StyXman dreamreal: I'm not going to say otherwise [09:02]
StyXman deepy: I'm listening [09:02]
deepy https://www.jetbrains.com/help/idea/tutorial-remote-debug.html [09:02]
deepy basically you run the application in one place and then you use the network to have your debugger talk with the JVM [09:02]
StyXman in fact I have it running on lxd containers on my WS [09:03]
deepy which may be the same machine or not [09:03]
StyXman no, that would be too late, the socket is opened at boot time [09:03]
StyXman (I think) [09:03]
StyXman I mena, I think it would be too late [09:03]
deepy then you want suspend=y which means the jvm starts but waits for the debugger [09:03]
StyXman I'm sure the socket is bound at boot time [09:04]
StyXman aha [09:04]
StyXman lemme try just that [09:04]
StyXman you see, I _am_ open top options, I just don't know much about the ecosystem [09:05]
deepy make sure to look into conditional breakpoint as well, I don't know how I debugged without them [09:07]
Feuermagier [Feuermagier!~Feuermagi@2a02:2488:4211:3400:7285:c2ff:fe22:172e] has joined ##java [09:08]
uniquerockrz [uniquerockrz!~Saurav@2409:4060:2108:9878:5c5d:9877:24a1:b67] has joined ##java [09:09]
StyXman 202 jars [09:09]
v01d4lph4 [v01d4lph4!~v01d4lph4@122.160.65.250] has joined ##java [09:10]
StyXman it binds like 6 times, so it's going to be easy to find it [09:10]
plarsen [plarsen!~plarsen@redhat/jboss/pdpc.professional.plarsen] has joined ##java [09:17]
StyXman my classpath is 10k chars big [09:18]
uniquerockrz parted the channel: "Leaving" [09:20]
v01d4lph4 StyXman: Holy moly! 10k for real? [09:20]
StyXman I got it down to 8k+ because I removed all the /../ [09:22]
KidBeta [KidBeta!~Kidbeta@hpavc/kidbeta] has joined ##java [09:25]
FabioP [FabioP!c378570d@host-195-120-87-13.business.telecomitalia.it] has joined ##java [09:31]
MatthijsH [MatthijsH!~quassel@unaffiliated/matthijs] has joined ##java [09:32]
bolovanos__ [bolovanos__!~bolovanos@unaffiliated/bolovanos] has joined ##java [09:33]
Harlin [Harlin!~Harlin@c-24-128-8-53.hsd1.co.comcast.net] has joined ##java [09:33]
Sheilong [Sheilong!uid293653@gateway/web/irccloud.com/x-qwfpakkgqlgnbdyf] has joined ##java [09:34]
deadbeat [deadbeat!~quassel@ipb21b465d.dynamic.kabel-deutschland.de] has joined ##java [09:36]
ofir [ofir!~ofir@pc-sivan12.cs.tau.ac.il] has joined ##java [09:36]
StyXman could be this? [09:37]
StyXman (java.lang.Thread)0x6ff RMI TCP Accept-0 running [09:37]
qwedfg [qwedfg!~qwedfg@194.177.28.176] has joined ##java [09:37]
cheeser RMI? wtf? [09:37]
StyXman stop in java.net.Socket.bind didn't seem to have worked, somehow [09:37]
ChaiTRex [ChaiTRex!~ChaiTRex@gateway/tor-sasl/chaitrex] has joined ##java [09:38]
StyXman I'm asking because I also see (java.lang.Thread)0x66d RMI TCP Accept-19084 [09:38]
StyXman and 19084 is definitely the port we told it to listen for JMX [09:39]
StyXman so it's not JMX, but general RMI? [09:39]
cheeser so don't start up RMI? [09:39]
StyXman I going to go with 'we need iot for JMX' [09:39]
StyXman can I control that other RMI port? [09:40]
cheeser [cheeser!~cheeser@redhat/cheeser] has joined ##java [09:44]
moldorcoder7 [moldorcoder7!~moldorcod@206.166.251.59] has joined ##java [09:44]
cheeser ping [09:44]
cheeser Uh.. wha? [09:44]
cheeser nods. [09:44]
StyXman how can I confirm this is a RMI port? [09:46]
StyXman found the answer https://stackoverflow.com/questions/20884353/why-java-opens-3-ports-when-jmx-is-configured [09:50]
ranran8888 [ranran8888!6d40b154@gateway/web/cgi-irc/kiwiirc.com/ip.109.64.177.84] has joined ##java [09:52]
SwiftMatt [SwiftMatt!~Objective@2601:282:4300:3e:4bc:6890:43c1:a720] has joined ##java [09:54]
hussam [hussam!~hussam@unaffiliated/hussam] has joined ##java [10:04]
Sgeo [Sgeo!~Sgeo@ool-18b9875e.dyn.optonline.net] has joined ##java [10:15]
Harlin [Harlin!~Harlin@c-24-128-8-53.hsd1.co.comcast.net] has joined ##java [10:31]
jamezp [jamezp!~jamezp@redhat/jboss/jamezp] has joined ##java [10:33]
VideoGameEnjoyer [VideoGameEnjoyer!~davidv7@BSN-143-125-59.dynamic.siol.net] has joined ##java [10:42]
v01d4lph4 [v01d4lph4!~v01d4lph4@122.160.65.250] has joined ##java [10:44]
Ingvix [Ingvix!~Ingvix@213.152.188.101] has joined ##java [10:51]
ranran888830 [ranran888830!6d40b154@gateway/web/cgi-irc/kiwiirc.com/ip.109.64.177.84] has joined ##java [10:54]
hnOsmium0001 [hnOsmium0001!uid453710@gateway/web/irccloud.com/x-rzrkmrfbdnosmmdx] has joined ##java [10:59]
yelhamer [yelhamer!~yelhamer@41.103.234.186] has joined ##java [11:00]
yelhamer Hello i'm taking an oop course in uni (we use java) and i'm lookignn for book recommendations (for oop and java), i asked yesterday on #programming and people recommended me "effective java" and this channel. [11:01]
yelhamer so is that book still relevant today or is there a better one i should read instead [11:01]
yelhamer ? [11:01]
mbooth books [11:02]
mbooth yelhamer, Some good java books are listed at https://javachannel.org/java-books/. Also see ~general books [11:02]
yelhamer oh thanks! [11:03]
olle 2/part [11:03]
olle parted the channel: [11:03]
StyXman parted the channel: "http://quassel-irc.org - Chat comfortably. Anywhere." [11:03]
gelignite [gelignite!~gelignite@55d45fdb.access.ecotel.net] has joined ##java [11:19]
cliluw [cliluw!~cliluw@unaffiliated/cliluw] has joined ##java [11:22]
Matthijs [Matthijs!~quassel@unaffiliated/matthijs] has joined ##java [11:24]
Sgeo_ [Sgeo_!~Sgeo@ool-18b9875e.dyn.optonline.net] has joined ##java [11:25]
deadbeat [deadbeat!~quassel@ipb21b465d.dynamic.kabel-deutschland.de] has joined ##java [11:27]
Zapek [Zapek!~zapek@core.zapek.com] has joined ##java [11:28]
yelhamer_ [yelhamer_!~yelhamer@41.103.234.251] has joined ##java [11:39]
Spawns_Carpeting [Spawns_Carpeting!~pi@50-110-90-200.clbg.wv.frontiernet.net] has joined ##java [11:40]
callq [callq!~callq@157.41.70.33] has joined ##java [11:42]
gambl0re [gambl0re!~gambl0re@unaffiliated/gambl0re] has joined ##java [11:47]
sa02irc [sa02irc!~mbax@155-079-043-212.ip-addr.inexio.net] has joined ##java [11:50]
Nightwing52 [Nightwing52!~Thunderbi@67.7.15.187] has joined ##java [11:51]
bolovanos_ [bolovanos_!~bolovanos@unaffiliated/bolovanos] has joined ##java [11:52]
zikani03 parted the channel: [11:54]
DasBrain [DasBrain!~DasBrain@unaffiliated/dasbrain] has joined ##java [11:57]
DasBrain_ [DasBrain_!~DasBrain@unaffiliated/dasbrain] has joined ##java [12:00]
whaley [whaley!~whaley@cpe-24-88-70-100.sc.res.rr.com] has joined ##java [12:02]
SirMangler [SirMangler!~SirMangle@host31-50-223-133.range31-50.btcentralplus.com] has joined ##java [12:03]
salparadise is there a reason to not run with "-XX:+FlightRecorder" seems harmless to me and it might come in handy for diagnostics when you need it on a running process. [12:03]
dreamreal doesn't flightrecorder record a lot of state information about the JVM as it runs? [12:05]
mbooth Well, docs say that "JFR continuously saves information to a circular buffer. Because the overhead is so low, the flight recorder can be always on." [12:06]
mbooth So, go nuts, I guess [12:06]
dreamreal yeah, guess so [12:06]
callq [callq!~callq@157.41.70.33] has joined ##java [12:11]
salparadise mbooth:cool, actually have a link to that doc? :) [12:13]
mbooth salparadise: Google is broken where you live? First result: https://docs.oracle.com/javacomponents/jmc-5-5/jfr-runtime-guide/toc.htm [12:14]
mbooth mbooth's title: "Java Platform, Standard Edition Java Flight Recorder Runtime Guide - Contents" [12:14]
salparadise mbooth: thanks [12:15]
long4mud [long4mud!~u0_a254@rrcs-75-87-43-226.sw.biz.rr.com] has joined ##java [12:17]
ranran8888 [ranran8888!6d40b154@gateway/web/cgi-irc/kiwiirc.com/ip.109.64.177.84] has joined ##java [12:25]
white_shadow [white_shadow!~white_sha@unaffiliated/whiteshadow/x-9072] has joined ##java [12:29]
juuandyy [juuandyy!~juuandyy@90.106.228.121] has joined ##java [12:31]
LKoen [LKoen!~LKoen@140.170.9.109.rev.sfr.net] has joined ##java [12:40]
Betal [Betal!~Betal@unaffiliated/betal] has joined ##java [12:41]
Rashad [Rashad!~textual@2a01:9700:14a8:8d00:6de1:237e:2180:a398] has joined ##java [12:42]
tang^ [tang^!~tang^@2604:3d09:47c:f970:48f4:6068:4a73:79ed] has joined ##java [12:44]
Treefingers [Treefingers!~Glassbox@82.162.189.80.dyn.plus.net] has joined ##java [12:51]
callq [callq!~callq@157.41.70.33] has joined ##java [12:58]
ge0rgios [ge0rgios!~george@unaffiliated/anaphaxeton] has joined ##java [01:00]
MrFlibble [MrFlibble!Rimmer@94.14.182.161] has joined ##java [01:05]
DTZUZU [DTZUZU!~DTZUZO@205.ip-149-56-132.net] has joined ##java [01:12]
whaley [whaley!~whaley@cpe-24-88-70-100.sc.res.rr.com] has joined ##java [01:21]
Jantz [Jantz!~IceChat95@118-93-31-67.dsl.dyn.ihug.co.nz] has joined ##java [01:29]
ge0rgios [ge0rgios!~george@unaffiliated/anaphaxeton] has joined ##java [01:43]
bolovanos__ [bolovanos__!~bolovanos@unaffiliated/bolovanos] has joined ##java [01:52]
Matthijs [Matthijs!~quassel@unaffiliated/matthijs] has joined ##java [01:54]
TimeTrap [TimeTrap!~TimeTrap@2601:44:c280:def:e977:44b9:baad:a0d1] has joined ##java [01:57]
eden [eden!~nanoz@gateway/tor-sasl/nanoz] has joined ##java [02:01]
CombatVet [CombatVet!~c4@gateway/tor-sasl/combatvet] has joined ##java [02:02]
Peste_Bubonica [Peste_Bubonica!~Peste_Bub@unaffiliated/peste-bubonica/x-4612396] has joined ##java [02:09]
wedr I think I went overboard on the @Secured in Spring Security... [02:28]
cheeser heh [02:29]
wedr I have created a total of 57 authorities, each one regulates the 4 CRUD operations for different roles. [02:29]
wedr I'm in a sinkhole. [02:29]
wedr Now my subject matter expert on speccing out the roles and privileges has gone silent. [02:30]
yawkat make sure to write integration tests. using annotations for security is really brittle and if you dont have tests they can break silently [02:30]
wedr Definitely will. It's just a matter of, am I doing this right? [02:31]
VideoGameEnjoyer [VideoGameEnjoyer!~davidv7@BSN-143-125-52.dynamic.siol.net] has joined ##java [02:32]
wedr Oh gosh, I just had a realization. I would need to specifically write 264 integration tests. [02:33]
cheeser yeah. you're probably doing it wrong. :) [02:34]
wedr I don't get this Roles and Authorities thing. What's the point of making users -> roles -> authorities triple-layered security? [02:35]
dreamreal that's not what those mean [02:35]
dreamreal a user has a role, a role has access to certain operations [02:35]
dreamreal "I, as a manager, can do X, while I, as an employee, can do Y" [02:36]
wedr I had set up a system where I can have X roles, and each role can do Y operations, (X1 -> Y1, Y2, Y3), but (X2 -> Y1, Y3). [02:39]
wedr Because I thought authorities are part of the layer below roles. [02:39]
wedr darn... I'm now dreading this... [02:40]
wedr Well, I went and explain what I did to other colleagues, and they said having more privileges is a good thing. [02:41]
wedr So... ugh, 200+ integration tests is a-okay... [02:41]
sa02irc [sa02irc!~mbax@155-079-043-212.ip-addr.inexio.net] has joined ##java [02:45]
VideoGameEnjoyer [VideoGameEnjoyer!~davidv7@BSN-143-120-235.dynamic.siol.net] has joined ##java [02:52]
freeone3000 Usually with an ACL system, you'd set up the ability to create rules, a small number of inherent roles, and then test whether a role properly restricts access. [02:58]
freeone3000 And then, at runtime, actually pull the roles from an external truth source (config file, database, etc) [02:59]
freeone3000 (...active directory...) [02:59]
freeone3000 authorities would be the source of truth in this model. [03:00]
LionBar_ [LionBar_!~l@gateway/tor-sasl/lionbar] has joined ##java [03:04]
hussam [hussam!~hussam@unaffiliated/hussam] has joined ##java [03:08]
gambl0re [gambl0re!~gambl0re@unaffiliated/gambl0re] has joined ##java [03:21]
Jantz_ [Jantz_!~IceChat95@118-93-31-67.dsl.dyn.ihug.co.nz] has joined ##java [03:24]
Jantz [Jantz!~IceChat95@118-93-31-67.dsl.dyn.ihug.co.nz] has joined ##java [03:28]
hussam_ [hussam_!~hussam@unaffiliated/hussam] has joined ##java [03:37]
hussam [hussam!~hussam@unaffiliated/hussam] has joined ##java [03:38]
Matthijs [Matthijs!~quassel@unaffiliated/matthijs] has joined ##java [03:39]
FabioP [FabioP!c378570d@host-195-120-87-13.business.telecomitalia.it] has joined ##java [03:49]
ADG1089 [ADG1089!~aditya@27.58.164.109] has joined ##java [03:55]
dreamreal sbalmos: yo! [04:00]
gambl0re [gambl0re!~gambl0re@unaffiliated/gambl0re] has joined ##java [04:01]
ADG1089 [ADG1089!~aditya@27.58.164.109] has joined ##java [04:07]
acidjnk_new2 [acidjnk_new2!~acidjnk@p200300d0c72b954650e5c2c931fd0d8a.dip0.t-ipconnect.de] has joined ##java [04:49]
bolovanos_ [bolovanos_!~bolovanos@unaffiliated/bolovanos] has joined ##java [04:52]
binarycreations [binarycreations!~rad@44.236.115.87.dyn.plus.net] has joined ##java [05:04]
Feuermagier [Feuermagier!~Feuermagi@213.178.26.41] has joined ##java [05:09]
recursiveNode [recursiveNode!~recursive@ip-86-49-255-227.net.upcbroadband.cz] has joined ##java [05:20]
Jantz_ [Jantz_!~IceChat95@2407:7000:8d04:100:9c3d:9a2e:2bd:925c] has joined ##java [05:20]
dka_ I am trying to download a gif from giphy in java, and post it to twitter [05:24]
dka_ The temporary file written is always corrupted. I took the two first script to download a gif in java I found online, both from different website and equal [05:24]
dka_ what could cause a gif file to be a white square instead of a gif after being downloaded (size not 0) [05:25]
ernimril dka_, bad download code [05:25]
ernimril dka_, if you really want help you should probably pastebin the code... [05:32]
sbalmos dreamreal: yo yo [05:38]
dka_ ernimril, https://gist.github.com/3f178165c6a7023f3610f62afe4b611a [05:51]
dka_ It write the gif here exactly : https://gist.github.com/kopax/3f178165c6a7023f3610f62afe4b611a#file-crontweetbotjob-java-L210 [05:52]
ernimril dka_, ick! [05:53]
ernimril dka_, why use a byte[1] buffer? [05:53]
ernimril dka_, and when you read into a buffer you need to check how much data you got and only write that much [05:54]
ernimril dka_, you also need to close your streams, a try-with-resource is probably what you want if you want to keep that code (instead of using the newer http client) [05:54]
Rashad [Rashad!~textual@2a01:9700:14a8:8d00:6de1:237e:2180:a398] has joined ##java [05:58]
dka_ I've tried the other one which was longer script and closed the streams, and it did not work [06:00]
dka_ do you have a snippet you know it work I can start with [06:00]
ernimril dka_, the HttpClient javadoc has some nice snippets [06:00]
ernimril dka_, BodyHandlers.ofFile could be quite handy for you [06:01]
orbyt_ [orbyt_!~orbyt@172.92.4.78] has joined ##java [06:02]
ernimril dka_, but if you really want to fix your code then create the buffer with some reasonable size (1024? 4096?, ...) add an "int bytesRead;" and assign to that when you do the read and then write that many bytes [06:03]
stupidfox_ [stupidfox_!~stupidfox@gateway/tor-sasl/stupidfox] has joined ##java [06:06]
deebo [deebo!~deebo@stonebay32.com] has joined ##java [06:07]
hotcoffee [hotcoffee!~hotcoffee@177.34.130.242] has joined ##java [06:10]
dka_ Ok, I am still on the javadoc [06:11]
dka_ Is there a lib I can use ? [06:12]
dka_ For downloading? Something simple that doesn't require me to deal with the bytes [06:12]
ernimril dka_, as I told you: BodyHandlers.ofFile [06:12]
dka_ I am still on jdk8 [06:13]
dka_ this seems to come with jdk9 [06:13]
ernimril yes [06:14]
ernimril why are you still on java 8? [06:14]
dka_ Because I am on spring boot 1.5.9 [06:14]
dka_ and it work with java 8 [06:15]
dka_ I tried to upgrade [06:15]
dka_ but it didn't go well, both java and spring [06:15]
dka_ should I be able to upgrade java without spring ? [06:15]
dka_ I rather have a old thing that work than a new think broken [06:15]
ernimril dka_, so fix the buffer size and use the bytesRead, it is easy [06:16]
dka_ and jdk 8 was made long after gif were created, and that project way after I did my first curl / php/ xhr file download line [06:16]
dka_ So I assume this should be trivial, while I am stuck ^^ [06:16]
dka_ It is easy when you know what it mean and what to write [06:16]
ernimril dka_, since this is a channel for developers you should be able to follow the simple directions I gave you. If you can not then hire someone who can [06:18]
dka_ I do front end development, bash, java, javascript, python, frontend, react native mobile etc... [06:19]
dka_ I am a developer as mush as you [06:19]
Xgc [Xgc!~Jon@98.1.122.91] has joined ##java [06:19]
dka_ and I never had to deal with the byte to download a file to be honest [06:19]
dka_ i [06:19]
dka_ I'll google that "v" [06:19]
dka_ dka_, but if you really want to fix your code then create the buffer with some reasonable size (1024? 4096?, ...) add an "int bytesRead;" and assign to that when you do the read and then write that many bytes [06:19]
ernimril dka_, the only way I can be more clear is to write your code and you did not provide a test case (only a code dump) and I am about to go to bed. [06:20]
dka_ http://www.java2s.com/Tutorials/Java/Network/HTTP_Read/Read_a_GIF_from_a_URL_and_save_it_locally_in_Java.htm [06:20]
dka_ that's where I got the 1st snippet [06:20]
dka_ as you can see, same code here : https://www.rgagnon.com/javadetails/java-0060.html [06:21]
dka_ dka_'s title: "Read a GIF or CLASS from an URL save it locally - Real's Java How-to" [06:21]
dka_ and here : http://www.avajava.com/tutorials/lessons/how-do-i-save-an-image-from-a-url-to-a-file.html , at least close [06:21]
dka_ dka_'s title: "How do I save an image from a URL to a file? - Web Tutorials - avajava.com" [06:21]
ernimril dka_, I do not really care where you got some bad code examples from, the example you have is old and bad [06:21]
dka_ I don't really care if it's old or bad code [06:23]
dka_ I want to donwload a gif in java. any code will fit for my use case if it work [06:23]
ernimril dka_, how come you have not even tried to add any of the things I told you to try yet? [06:24]
dka_ I am [06:24]
dka_ byte[] b = new byte[4096]; [06:24]
Spawns_Carpeting [Spawns_Carpeting!~pi@184-15-36-83.dr01.chtn.wv.frontiernet.net] has joined ##java [06:25]
tang^ [tang^!~tang^@2604:3d09:47c:f970:12:b240:1bb4:a10f] has joined ##java [06:27]
dka_ what is a `int bytesRead;` ? [06:28]
ernimril dka_, just that, a local variable [06:29]
dev4449 [dev4449!bc7e5ea7@188.126.94.167] has joined ##java [06:41]
dev4449 parted the channel: [06:42]
dev4449 [dev4449!bc7e5ea7@188.126.94.167] has joined ##java [06:42]
paddyez [paddyez!~Patrick-E@wikipedia/paddyez] has joined ##java [06:43]
dev4449 Hi. Good day. Is it a strict rule and I have to define a class and a method inside that class in order to run a script file with a shebang on Java 11? Can't I write the shebang and start writing Java code like the way we do in python? [06:43]
Spawns_Carpeting [Spawns_Carpeting!~pi@184-14-222-176.dr03.chtn.wv.frontiernet.net] has joined ##java [06:48]
dev4449 Like this I mean: https://pastebin.ubuntu.com/p/bVkW6kB6hC/ [06:51]
dka_ I just tried with 4096 bytes and same issue [06:51]
dka_ I'll try this now : https://www.baeldung.com/java-download-file#2apache-commons-io [06:54]
dka_ dka_'s title: "Download a File From an URL in Java | Baeldung" [06:54]
dka_ I opened the corrupted gif file and it's an html file =/ [07:00]
dev4449 [dev4449!bc7e5ea7@188.126.94.167] has joined ##java [07:00]
gambl0re [gambl0re!~gambl0re@unaffiliated/gambl0re] has joined ##java [07:07]
dka_ that's how you downlaod a giphy from it's url in JS https://gist.github.com/kopax/2cdc166351051e84e0bcb834ce28b00a , why am I getting an HTML while JS can get a gif ? [07:10]
CodeMouse92 [CodeMouse92!~JasonMc92@unaffiliated/codemouse] has joined ##java [07:14]
paddyez [paddyez!~Patrick-E@wikipedia/paddyez] has joined ##java [07:16]
Spawns_Carpeting [Spawns_Carpeting!~pi@184-14-222-176.dr03.chtn.wv.frontiernet.net] has joined ##java [07:24]
dka_ How can I download a gif file using the header 'Accept: image/gif' in jav a/ [07:24]
ricky_clarkson dka_: https://stackoverflow.com/questions/1945336/how-to-set-content-type-on-httpurlconnection/1949572 has some pointers, and other search results for "java open url set content type" may be instructive. [07:32]
dka_ Yes, I am on that one [07:32]
dka_ https://stackoverflow.com/questions/4205980/java-sending-http-parameters-via-post-method-easily/4206094#4206094 [07:32]
ricky_clarkson I'm not opening that right now but looking at the URL, you probably don't care about post [07:34]
dka_ solved [07:36]
dka_ Yes, I care about it , why do you say something that stupid? [07:36]
dka_ i am obviously digging for hours and sharing my research here since more than 2 hours [07:36]
dka_ I obviously care [07:37]
ranran8888 [ranran8888!6d40b154@gateway/web/cgi-irc/kiwiirc.com/ip.109.64.177.84] has joined ##java [07:39]
ricky_clarkson I mean you probably care about get, not post. [07:41]
ricky_clarkson But if you prefer to insult my suggestion, fine, there won't be any more. [07:42]
Matthijs [Matthijs!~quassel@unaffiliated/matthijs] has joined ##java [07:47]
wordsToLiveBy [wordsToLiveBy!~wordsToLi@unaffiliated/wordstoliveby] has joined ##java [07:49]
dec0d3r [dec0d3r!~dec0d3r@2001:8003:4860:b200:2e33:764e:2cb7:eba5] has joined ##java [07:54]
hotcoffee [hotcoffee!~hotcoffee@177.34.130.242] has joined ##java [08:01]
db [db!uid18678@gateway/web/irccloud.com/x-vmhgzwtuomijextl] has joined ##java [08:13]
Spawns_Carpetin- [Spawns_Carpetin-!~pi@184-14-215-171.dr03.chtn.wv.frontiernet.net] has joined ##java [08:21]
Tabmow This is a bit of a generic question, but I'm at a loss currently, I have 4 particular unit tests (executed against a H2 database for data), which are passing under Windows but failing under Linux. I have no idea why nor where to even start looking. I'm not referencing any external files or anything either. [08:26]
bow [bow!~johanf@c-e2b6235c.036-1-6c756c12.bbcust.telenor.se] has joined ##java [08:28]
Tabmow Hmm, I think it is a float precision type issue... [08:45]
CodeMouse92 [CodeMouse92!~JasonMc92@unaffiliated/codemouse] has joined ##java [08:54]
shicks255 [shicks255!~shicks255@181.214.206.104] has joined ##java [09:04]
null1337 [null1337!~WhoAmI@c-73-34-250-51.hsd1.co.comcast.net] has joined ##java [09:40]
tang^^ [tang^^!~tang^@2604:3d09:47c:f970:ec2a:2f40:d6d6:e96b] has joined ##java [09:55]
ejjfunky [ejjfunky!~ejjfunky2@125.163.89.166] has joined ##java [09:57]
cliluw [cliluw!~cliluw@unaffiliated/cliluw] has joined ##java [10:07]
db a float precision type issue? java floats should behave the same on windows and linux, but then you shouldn't really depend on floats in most settings other than if you're, say, processing measurement data or something like that [10:08]
AmVarPG [AmVarPG!~amvarpg@pool-100-36-155-137.washdc.fios.verizon.net] has joined ##java [10:09]
fizzie If java.lang.Math operations are involved, they're not required to behave exactly the same, and I think you might somewhat fairly call that "a float precision type issue" if you're doing exact equality comparisons on the results or something. [10:12]
fizzie Even discounting that, I don't think (non-`strictfp`) basic operations on float are required to behave "the same" either. (JLS: "-- results of all FP-strict expressions must be those predicted by IEEE 754 arithmetic on operands represented using single and double formats. Within an expression that is not FP-strict, some leeway is granted for an implementation to use an extended exponent range to represent [10:16]
fizzie intermediate results; --") [10:16]
db they're not? didn't know that - but surely you shouldn't do exact equality comparisons with floats [10:17]
db ok [10:17]
grnman_ [grnman_!~grnman_@157.245.86.191] has joined ##java [10:22]
Sgeo [Sgeo!~Sgeo@ool-18b9875e.dyn.optonline.net] has joined ##java [10:26]
Tabmow Just to preface this, I'm not a 'developer' per se but just from the research I've been doing and looking at how some similar unit tests are structured, they are definitely trying to assert values a lot more 'precisely' than other values that are working fine. [10:35]
Matthijs [Matthijs!~quassel@unaffiliated/matthijs] has joined ##java [10:36]
Tabmow These unit test in this case we're dealing with pricing so I'm not sure why it is trying to match something down to 8-9 decimals... [10:36]
p[a]ddy [p[a]ddy!~Patrick-E@wikipedia/paddyez] has joined ##java [10:43]
db pricing / money, anything that should be precise, should never be done with floating point numbers. [10:47]
db you'd typically calculate that either in cents using integers, or BigDecimal [10:48]
db with floating point math, you run into issues like that adding 0.01 one hundred times doesn't end up exactly at 1. [10:49]
aquijoule__ [aquijoule__!~richbridg@213-225-0-53.nat.highway.a1.net] has joined ##java [10:51]
Goplat [Goplat!~Goplat@reactos/developer/Goplat] has joined ##java [10:55]
moldorcoder7 [moldorcoder7!~moldorcod@206.166.251.59] has joined ##java [10:56]
callq [callq!~callq@157.41.80.218] has joined ##java [11:36]
Matthijs [Matthijs!~quassel@unaffiliated/matthijs] has joined ##java [11:41]
recursiveNode [recursiveNode!~recursive@ip-86-49-255-227.net.upcbroadband.cz] has joined ##java [11:43]
Tabmow ahh right, I'll pass on that info, thanks. [11:44]