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

« 2019-07-10


2019-07-12 »

Nick Message Date
lucid-lullaby [lucid-lullaby!~lucid-lul@] has joined ##java [12:07]
deavmi [deavmi!~deavmi@] has joined ##java [12:10]
indistylo [indistylo!~aruns_@] has joined ##java [12:10]
indistylo [indistylo!~aruns_@] has joined ##java [12:13]
indistylo [indistylo!~aruns_@] has joined ##java [12:18]
indistylo [indistylo!~aruns_@] has joined ##java [12:24]
djhworld [djhworld!~djhworld@] has joined ##java [12:39]
Diablo-D3 [Diablo-D3!] has joined ##java [12:44]
indistylo [indistylo!~aruns_@] has joined ##java [12:49]
Diablo-D3 [Diablo-D3!] has joined ##java [12:55]
indistylo [indistylo!~aruns_@] has joined ##java [01:09]
exonity01 [exonity01!uid364582@gateway/web/] has joined ##java [01:11]
indistylo [indistylo!~aruns_@] has joined ##java [01:12]
syrius [syrius!] has joined ##java [01:19]
indistylo [indistylo!~aruns_@] has joined ##java [01:19]
rruizt [rruizt!] has joined ##java [01:24]
indistylo [indistylo!~aruns_@] has joined ##java [01:33]
errr [errr!~errr@fedora/errr] has joined ##java [01:52]
OnceMe [OnceMe!~OnceMe@unaffiliated/onceme] has joined ##java [02:05]
led_dark_1 [led_dark_1!~Thunderbi@] has joined ##java [02:08]
errr [errr!~errr@fedora/errr] has joined ##java [02:08]
g00s [g00s!~g00s@unaffiliated/g00s] has joined ##java [02:13]
jusss java -cp .:java-naoqi-sdk- HelloWorld is ok, [02:15]
jusss but java -cp java-naoqi-sdk- HelloWorld is not [02:15]
jusss why this current directory is must be contained in -cp ? [02:15]
selckin because its probably where HelloWorld.class is [02:16]
jusss selckin: yes, HelloWorld.class is in the current direcotry [02:16]
forgottenone [forgottenone!~forgotten@] has joined ##java [02:17]
jusss selckin: does jdk for linux dependency linux's libraries? [02:20]
jusss if I can have jdk7 on gentoo, which kernel is 2.6, can I have jdk12 or jdk8 ? [02:21]
selckin no clue [02:21]
troulouliou_div2 [troulouliou_div2!~troulouli@unaffiliated/troulouliou-div2/x-0271439] has joined ##java [02:26]
surial jusss: I think your question is: "Why does java not include the current working dir as classpath by default"? [02:28]
surial jusss: the answer is: Because it doesn't ,and it would be fucking stupid if it did. [02:28]
surial jusss: The 'it doesn't' is fact, as in, it just doesn't. I'd refer to a spec but weirdly, the java VM executable's parameters don't have one. funny oversight, that. [02:29]
surial jusss: the 'would be stupid' is informed opinion. But, perhaps one word will be sufficient to make you see the light: "Security". [02:29]
puppy_za [puppy_za!uid277586@gateway/web/] has joined ##java [02:30]
palasso [palasso!~palasso@unaffiliated/palasso] has joined ##java [02:33]
odinsbane It does include . by default. [02:34]
odinsbane I just doesn't include it if you tell it otherwise. [02:34]
ipe [ipe!] has joined ##java [02:36]
surial odinsbane: that's misleading. If you are gonna go with that alternate interpretation of default. [02:41]
surial odinsbane: It _IS_ . by default, just . [02:41]
Markow [Markow!~ejm@] has joined ##java [02:41]
jusss fine [02:44]
Nicmavr [Nicmavr!~Nicmavr@unaffiliated/nicmavr] has joined ##java [02:48]
TlrDr97 [TlrDr97!] has joined ##java [03:00]
enoq [enoq!] has joined ##java [03:03]
z147d [z147d!~z147@gateway/tor-sasl/z147] has joined ##java [03:10]
HumanG33k [HumanG33k!~HumanG33k@] has joined ##java [03:12]
minos_ [minos_!] has joined ##java [03:14]
z147d [z147d!~z147@gateway/tor-sasl/z147] has joined ##java [03:18]
neo4 [neo4!] has joined ##java [03:19]
odinsbane [03:19]
odinsbane odinsbane's title: "How Classes are Found" [03:19]
surial odinsbane: well, it's not a spec perse but nice that they wrote it down someplace. [03:23]
surial odinsbane: As I thought: java.exe doesn't mix and match. It has a hierarchy of stuff it looks at for CP, the LAST of which is 'I got bupkis so "." it is'. [03:23]
odinsbane jusss: There must be some dependency on the native libraries. If it works on that 'certified system' then you should be able to get by with the associated libs. [03:24]
odinsbane odinsbane's title: "Oracle JDK 8 and JRE 8 Certified System Configurations" [03:24]
odinsbane surial: 9+ are going to have some wierd module level inclusions to. [03:28]
surial do they? [03:29]
surial I think there's no difference there; the module stuff is all bootcp oriented which has always stood separate from -cp. As in, you can't use -cp to make 'java.lang.String' disappear on you. [03:30]
minos_ [minos_!] has joined ##java [03:38]
TomyWork [TomyWork!~TomyLobo@] has joined ##java [03:39]
TomyWork is anyone aware of a tool designed to look for text in files in a jar file? [03:39]
surial TomyWork: unzip, strings [03:40]
acidjnk [acidjnk!] has joined ##java [03:42]
AugustusCaesar24 [AugustusCaesar24!] has joined ##java [03:46]
Chuguniy [Chuguniy!~Chuguniy@] has joined ##java [03:49]
troulouliou_div2 [troulouliou_div2!~troulouli@unaffiliated/troulouliou-div2/x-0271439] has joined ##java [03:51]
esro [esro!~esro@] has joined ##java [04:01]
bruhbruh [bruhbruh!] has joined ##java [04:02]
jusss odinsbane: there's no gentoo on that article, but jdk7 works on gentoo [04:13]
gbobby [gbobby!~raltnoede@LINBIT/gbobby] has joined ##java [04:14]
minos_ [minos_!] has joined ##java [04:17]
Diablo-D3 [Diablo-D3!] has joined ##java [04:25]
Diablo-D3 [Diablo-D3!] has joined ##java [04:35]
LaSombra I wrote one [04:41]
LaSombra Not opensource though [04:41]
LaSombra You can do it using the JDK Zip facilities [04:42]
esro [esro!~esro@] has joined ##java [04:43]
neo4 what is going on here? I'm a new to java, why it is used for? [04:44]
neo4 I know javascript css and html :) [04:44]
neo4 java is like javascript [04:44]
LaSombra Well, they are both programming languages [04:45]
selckin javascript [04:45]
selckin Java is to JavaScript as ham is to hamster ( Try ##javascript. [04:45]
Diablo-D3 [Diablo-D3!] has joined ##java [04:46]
mbooth neo4: Java and Javascript are both curly-bracket languages. That's about all they have in common... [04:46]
LaSombra TomyWork: Something like this, [04:46]
LaSombra LaSombra's title: " - encrypted pastebin" [04:46]
ricky_clarkson var x = "hello"; works in both :) [04:47]
surial LaSombra: for future reference, you can put 'throws IOException' on methods, you know. [04:48]
surial LaSombra: catch (IOException e) { LOG.error("Unable to close reader!");} good god man. Let me count the ways... [04:48]
LaSombra surial: I could but why? Honest question. [04:49]
surial because you've written horrific error handling code and the source of that is presumably because you didn't want to put 'throws IOException' on this. [04:50]
surial your error handler is to write a useless log message that breaks the rules (in that they end in !), and to just keep trucking. So if something goes wrong I/O, wise, you get 18 messages in the log, the one that is the least significant (unable to close the reader) having the biggest 'OMFG shit is WRONG!!!!one!!!' by having an exclamation point in there. In general, if things go wrong the code just silently returns making it [04:51]
surial impossible for callers to do anything about it other than 'welp, the app silently isn't doing anything... mabbe I check the log' and then booom, 30 lines. [04:51]
surial even though all that happened is, I dunno, you yanked your USB stick out or whatnot. [04:51]
odinsbane jusss: If you want to check before trying it out, then you need to look at the libraries your gentoo has (eg libc, gtk etc.) and compare to a similar distro on the list. Another thing you can do is to look for the build instructions. [04:51]
surial LaSombra: here's a simple set of rules anyone can remember: [04:51]
odinsbane jusss: The easiest way, is to just download the openjdk and see if it works. [04:51]
surial LaSombra: [1] Logging, printing or ignoring an exception is not 'handling it'. [04:52]
surial LaSombra: [2] If you don't want to, or don't know how to handle an exception, either [A] declare it thrown onwards, or [B] wrap it in a runtimeexception. [04:52]
surial There is no rule [3]. That's it. [04:52]
LaSombra surial: Fair enough. Thanks for the pointers. [04:52]
surial you'll find this cleans up your code considerably, cleans up your logs, streamlines debugging (because if things break that you weren't expecting, the entire code stream is unrolled and you get an error message right in your face. FOr unexpected things that's better than silently doing the wrong thing and spamming the log or worse, having nothing logged / limited data logged). [04:53]
surial LaSombra: take for example line 38 in your paste. [04:53]
jusss odinsbane: I'm working on an old gentoo, which kernel is 2.6, and the third development from some packages are using jdk7 to create dependency package, I wonder can I use jdk 8 or 12 to instead of that jdk7, they provide jar package which is compiled by jdk7 I think [04:53]
surial LaSombra: you log a useless message ("something is wrong".. yeah, great), a path (useful, though with the new file API this will generally also be in the message. Still, good idea, that), and then.. the MESSAGE of the exception. [04:54]
etraga [etraga!339e7a77@] has joined ##java [04:54]
surial LaSombra: exceptions have at least 5 properties: The type (maybe it's FileNotFoundException, you don't know), the message, the stack trace, the causal chain, and the suppressed set. [04:54]
jusss some companies, [04:54]
surial the suppressed set is rarely useful but the rest? VERY useful. [04:54]
LaSombra surial: Something closer to line 52 then [04:54]
surial and by writing htis log statement you've taken 3 of the 4 useful aspects of that exception.. and flushed em down the toilet. [04:54]
surial 52 and 38 are equally bad. [04:54]
surial what's slightly better is: [04:55]
etraga Hello! I've an issue with maven exec plugin. I want to build an Angular app with npm and this plugin. I put this in my "pom.xml" : [04:55]
surial LOG.error("Error reading file {}", path, e); [04:55]
etraga <execution> <id>npm build:prod (compile)</id> <goals> <goal>exec</goal> </goals> <phase>compile</phase> <configuration> [04:55]
etraga <executable>npm</executable> <arguments> <argument>run</argument> <argument>build:prod</argument> <argument>\-\-app</argument> <argument [04:55]
etraga >myapp</argument> <argument>\-\-output-path</argument> <argument>${project.basedir}/webresources/frontend/</argument> </arguments> </configuration> </execution> [04:55]
surial etraga: don't paste here, please read the rules first. [04:55]
surial pastebin [04:55]
surial etraga, Please paste your code and any errors online. For runnable main-classes, try . For general code and errors, use for instance or [04:55]
etraga Yes sorry [04:55]
surial try agai, using a pastebin site. [04:55]
etraga [04:56]
surial Note 3 things here: [1] errors shold not end in exclamation marks or dots or any other punctuation, [2] they should be as short as feasible. 'something is wrong' is not adding any utility, the error level already coneys that. [3] you can pass an exception (the entire thing) as argument AFTER filling in the {}s. [04:56]
surial LaSombra: ^^ [04:56]
surial But better STILL is to just throw what you gotta throw. It is entirely reasonable for a method called 'checkFile' to be declared as 'throws IOException'. [04:56]
combatvet_ [combatvet_!~c4@gateway/tor-sasl/combatvet] has joined ##java [04:56]
etraga Maven exec plugin ignore arguments with "--" like "--app" and command executed is wrong. Anyone has an idea? [04:57]
LaSombra surial: Hmmm, OK [04:57]
odinsbane jusss: why don't you just download the jdk you want to try? [04:58]
LaSombra surial ++ [04:58]
LaSombra surial has a karma level of 530, LaSombra [04:58]
LaSombra surial: Thanks again [04:58]
jusss odinsbane: yeah, I just tried it, and it worked [04:58]
jusss but I don't know if there're some future questions [04:59]
surial LaSombra: in fact, I'd even go with LOG.error("reading file {}", path, e); - both 'reading' is useful (versus, say, 'closing', 'enumerating' etc.) as is which file it is, probably, you can't be sure the exception includes this name. error would be superfluous (you're already logging this at the error level, you can tell your log engine to include it in the log file or whereever it goes if you want to see it). error messages are [04:59]
surial a bit of an art form, which is another reason to default to jsut throwing them: It's hard to keep writing code for cases you just don't care about, and often the 'well, if the user pulls the USB stick, what the heck were they expecting?' kind of acse IS code you just don't care about. We're all human :) [04:59]
LaSombra ) [05:01]
magz__ [magz__!] has joined ##java [05:01]
LaSombra surial: I have very little faith in default error messages but I see I committed a sin writing poor ones [05:01]
surial The generator of the ex knows more than you do. [05:02]
surial so trust their type, message, and stack trace to be completed. just add what the generator did not know. [05:02]
LaSombra Good point [05:03]
matsurago [matsurago!~matsurago@240b:10:b3a1:1700:e59f:3ee7:6456:b1ec] has joined ##java [05:03]
reynir [reynir!~reynir@unaffiliated/reynir] has joined ##java [05:17]
martiansoul [martiansoul!6f5d7832@] has joined ##java [05:23]
martiansoul what is the expression for once in a week cron job? [05:24]
martiansoul in spring-boot? [05:24]
indistylo [indistylo!~aruns_@] has joined ##java [05:29]
Lengsdorfer [Lengsdorfer!~Lengsdorf@unaffiliated/lengsdorfer] has joined ##java [05:30]
shmoon [shmoon!] has joined ##java [05:35]
shmoon Recommendations for XML parsing in Java ? What should I use ? How should I do it ? [05:35]
jusss String in java 7 is unicode or bytecode ? [05:38]
jusss or neither? [05:39]
puppy_za UTF-16? [05:40]
immibis [immibis!] has joined ##java [05:40]
odinsbane jusss: [05:41]
deebo shmoon: object binding or streaming based on usage [05:44]
NorthwestVegan [NorthwestVegan!~Northwest@gateway/tor-sasl/northwestvegan] has joined ##java [05:44]
dreamreal jusss: why are you wondering abotu java *7*? [05:44]
deebo not sure if theres some object binding streaming api [05:44]
dreamreal shmoon: what are you trying to do? [05:45]
jusss dreamreal: 'cause some companies I work on provide jdk7 development [05:45]
dreamreal martiansoul: what timer are you using [05:45]
dreamreal jusss: that's a shame [05:45]
jusss dreamreal: see this [05:45]
jusss jusss's title: "Java SDK Aldebaran documentation" [05:45]
DTZUZU [DTZUZU!] has joined ##java [05:46]
puppy_za well better than Java 1.3 or lower :p [05:46]
dreamreal still a bit of a shame [05:46]
indistylo [indistylo!~aruns_@] has joined ##java [05:54]
pandaadb [pandaadb!~pandaadb@] has joined ##java [05:55]
indistylo [indistylo!~aruns_@] has joined ##java [05:59]
DTZUZU [DTZUZU!] has joined ##java [06:01]
pandaadb_ [pandaadb_!~pandaadb@] has joined ##java [06:03]
unleaded [unleaded!~digiberk@unaffiliated/digiberk] has joined ##java [06:08]
miguelanxo [miguelanxo!512ee1ef@] has joined ##java [06:09]
miguelanxo Hi there [06:09]
dreamreal hi [06:09]
miguelanxo maybe offtopic question: I just reinstalled windows 10 and from this computer cannot download a XLSX generated from a servlet with any browser, but can with CURL or from any other windows 10 machine [06:10]
dreamreal that's more a tech support question for that specific machine. It's not java at all. [06:11]
miguelanxo code hasn't been touched in months: any clue of what could be happening? firefox debugger says 1.9MB downloaded but then complains about some random.part file not being downloaded [06:11]
dreamreal sounds like there's not an xslx handler installed. [06:11]
dreamreal but could be entirely different. If it works on other machines, it's not going to be the servlet. [06:11]
miguelanxo which channel could be appropiate to diagnose something like that? [06:12]
dreamreal dunno, firefox or microsoft office somehow, but probably some firefox-related thing [06:13]
immibis cannot download is different from cannot open [06:14]
miguelanxo well, youi know the dialog that lets you choose opening or downloading in ff? it opens, but then an error dialog opens too so I cannot interact with the download/open dialog [06:15]
dreamreal what does the error dialog say? [06:16]
miguelanxo "No se pudo guardar C:\Users\MIGUEL~1\AppData\Local\Temp\WmOn4HF_.xlsx.part porque no se pudo leer el archivo origen." [06:16]
miguelanxo that translates to "Cannot read that file because it cannot read from the source file" [06:16]
dreamreal thank you - I was about to open google translate :) [06:17]
dreamreal but that sounds like something's up with the filesystem: the directory, maybe? a read-only file by that name already? [06:17]
miguelanxo that random name is autogenerated [06:18]
dreamreal still, not a java problem. It's going to be localized *on that machine*. The generating servlet isn't going to be ABLE to make it so the consumer can't read from a file. [06:18]
dreamreal miguelanxo: just because it's random doesn't mean it's unique! But the problem still is related to the filesystem and not the servlet [06:18]
miguelanxo yeah I know. I was asking if maybe someone had experienced this, but tnx anyway [06:18]
immibis miguelanxo: perhaps there was an error downloading it over the network. [06:20]
immibis wireshark might be overkill, but have you tried wireshark? [06:20]
miguelanxo well, I will :D silly me not trying as this is over HTTP so not encrypted :P [06:21]
miguelanxo will report [06:21]
dreamreal good luck! [06:21]
immibis i'm expecting a TCP reset, or something like that [06:22]
ricky_clarkson miguelanxo: Maybe you need to set a different TEMP directory in the Windows environment variables list. If you can reproduce it on another computer there may be something weird about the HTTP response headers. [06:29]
pandaadb__ [pandaadb__!~pandaadb@] has joined ##java [06:30]
ricky_clarkson miguelanxo: I speak Spanish non-natively - the error message looks a bit Google Translate-y to me (not sure how you feel about it) - if you set the computer to English you might get a better one. [06:30]
waz [waz!~waz@pdpc/supporter/active/waz] has joined ##java [06:33]
DTZUZU [DTZUZU!] has joined ##java [06:39]
miguelanxo [miguelanxo!512ee1ef@] has joined ##java [06:39]
miguelanxo Hi again [06:39]
forgottenone [forgottenone!~forgotten@] has joined ##java [06:40]
miguelanxo wireshark came out ok. I even exported the wireshark captured file and md5sum says its the original [06:40]
miguelanxo also, I managed to select "save by default" in firefox by downloading a previous, non-java generated xlsx and clicked "do this action by default" [06:41]
rwheadon [rwheadon!~rwheadon@2600:1700:17a0:58ef:c99f:458d:bec9:92c3] has joined ##java [06:41]
miguelanxo and now it's clear that it's some kind of weird xlsx handler issue, as firefox keeps complaining but downloads the file ok to a ".part" file while creating a 0 byte sized correct file [06:42]
martiansoul [martiansoul!6f5d7832@] has joined ##java [06:42]
immibis that's what firefox does. when the download finishes it renames the .part file to the final filename [06:42]
immibis so apparently your server is not indicating that it's done sending the file [06:43]
forgottenone [forgottenone!~forgotten@] has joined ##java [06:43]
miguelanxo curl downloads ok, but also complains about that (even in the win10 machine that works ok with brosers) [06:43]
immibis what does the complaint say? [06:44]
miguelanxo CURL: transfer closed with outstanding read data remaining [06:44]
miguelanxo error (18) [06:44]
immibis okay, so your server is sending an incorrect Content-Length [06:44]
immibis (probably) [06:44]
immibis or a chunked encoding without a terminating chunk [06:45]
miguelanxo it may well be, as I did that part myself [06:45]
miguelanxo weird that it worked of so far [06:45]
immibis your server is saying there's more data then it's closing the connection [06:46]
immibis so fix that [06:46]
martiansoul 05 11 * * * [06:49]
martiansoul i want to convert this into a 6 field cron expression for spring-boot which means run at 11:05 [06:50]
martiansoul how can i do that? [06:50]
dreamreal What are the six fields in spring boot's cron? [06:50]
indistylo [indistylo!~aruns_@] has joined ##java [06:52]
ranbox2d [ranbox2d!a0b18213@] has joined ##java [06:59]
perrier-jouet [perrier-jouet!] has joined ##java [07:01]
Cahaan [Cahaan!~Cahaan@] has joined ##java [07:05]
pandaadb_ [pandaadb_!~pandaadb@] has joined ##java [07:07]
DrDonkey [DrDonkey!~DrDonkey@unaffiliated/drdonkey] has joined ##java [07:07]
DrDonk3y [DrDonk3y!~DrDonkey@unaffiliated/drdonkey] has joined ##java [07:08]
DTZUZO [DTZUZO!] has joined ##java [07:14]
z147 [z147!~z147@gateway/tor-sasl/z147] has joined ##java [07:22]
raj [raj!raj@unaffiliated/cypha] has joined ##java [07:27]
indistylo [indistylo!~aruns_@] has joined ##java [07:31]
shmoon dreamreal: Just need to parse a config file and do a bunch of operations based on that in am application. [07:33]
shmoon DOM looks good. [07:34]
DiabloD3 [DiabloD3!] has joined ##java [07:36]
dreamreal why not use jackson and read in a configuration object? [07:37]
dreamreal Or use Spring or something like that? [07:37]
indistylo [indistylo!~aruns_@] has joined ##java [07:40]
Diablo-D3 [Diablo-D3!] has joined ##java [07:46]
macroprep [macroprep!~smallvill@2405:7f00:8801:d00:5159:504b:27f0:cc7d] has joined ##java [07:49]
indistylo [indistylo!~aruns_@] has joined ##java [07:52]
esro [esro!~esro@] has joined ##java [07:56]
Diablo-D3 [Diablo-D3!] has joined ##java [07:57]
indistylo [indistylo!~aruns_@] has joined ##java [07:58]
outZoNe [outZoNe!~outzone@] has joined ##java [08:02]
outZoNe ?? [08:02]
outZoNe hi [08:02]
dreamreal hi [08:04]
shmoon dreamreal: Yeah didn't know jackson had xml as well. I am using it for jSON. Any idea how I can use jackson-xml without creating a POJO ? [08:04]
dreamreal blinks [08:05]
cheeser have you seen the package/website name? [08:05]
outZoNe here you can speak in Russian [08:05]
outZoNe ? [08:05]
cheeser nyet [08:05]
dreamreal you could always use the parse tree, but ... you'd be better off with the POJO [08:05]
outZoNe cheeser: uraaaa [08:06]
dreamreal shmoon: note that jackson's github is <-- note "fasterJSON" [08:08]
dreamreal dreamreal's title: "GitHub - FasterXML/jackson: Main Portal page for the Jackson project" [08:08]
outZoNe cheeser: /LEAVE [08:08]
cheeser nein [08:08]
matsurago I thought it is because JSON is a "faster XML" [08:10]
rwheadon [rwheadon!] has joined ##java [08:10]
dreamreal JSON just turns out to be a lot more pleasant than SGML [08:10]
donofrio [donofrio!] has joined ##java [08:10]
dreamreal not necessarily *better* - ask anyone who's had to futz around with json-schema - but definitely more terse [08:11]
indistylo [indistylo!~aruns_@] has joined ##java [08:11]
shantaram [shantaram!uid207478@gateway/web/] has joined ##java [08:21]
zeden [zeden!~user@unaffiliated/zeden] has joined ##java [08:27]
HumanG33k [HumanG33k!~HumanG33k@] has joined ##java [08:35]
visualshock [visualshock!9b374335@gateway/web/cgi-irc/] has joined ##java [08:38]
indistylo [indistylo!~aruns_@] has joined ##java [08:41]
TimeTrap [TimeTrap!~TimeTrap@2601:44:c280:def:1c56:3171:42b6:d972] has joined ##java [08:47]
Squarism Anyone has some goto method of performing post-applicationContext-loaded tasks? [08:48]
Squarism (where method doesnt refer to java methods) [08:48]
LaSombra What's that? Spring? [08:48]
Squarism yeah [08:49]
dreamreal Squarism: spring has lifecycle mechanisms already [08:49]
dreamreal i.e., there're standard "go-to methods" for this [08:49]
cheeser goto considered evil [08:50]
Squarism dreamreal, ah ok. Remember something? [08:50]
cheeser ? [08:50]
Squarism lol [08:50]
cheeser google spring lifecycle [08:50]
cheeser [08:50]
Squarism never misses a chance [08:50]
dreamreal [08:51]
cheeser Squarism: my hope is someday you'll figure out how to do research on your own [08:51]
Squarism cheeser, believe me. I use google a lot. But you allways get perfect hits directly allways? [08:51]
dreamreal Squarism: [08:51]
cheeser i do. [08:51]
Squarism Some questions [08:52]
Squarism For some questions there quite a high probability that someone else know the exact answer [08:52]
LaSombra I sense a spelling issue might be the reason [08:52]
dreamreal Squarism: surprisingly, typing YOUR ORIGINAL QUERY into google actually gives some pretty relevant answers [08:52]
cheeser i'm *shocked* to hear that, dreamreal [08:52]
cheeser just ... flabbergasted [08:53]
indistylo [indistylo!~aruns_@] has joined ##java [08:53]
dreamreal discombobulated? [08:53]
LaSombra Gobsmacked really [08:53]
cheeser flummoxed! [08:53]
dreamreal flibbertigibbeted? [08:53]
cheeser bewildered even [08:53]
LaSombra This Google thing is spiffing [08:53]
dreamreal LaSombra: I bet if they keep it running it might get popular [08:53]
dreamreal might make hundreds, even thousands, of dollars [08:53]
Squarism Amuses me you love to spend time on heckling people. Gotto be fulfilling [08:53]
cheeser for repeat offenders, especially [08:54]
LaSombra Stop talking nonsense dreamreal. How can you possible monetize such an amazing tool? [08:54]
dreamreal Squarism: we're being pretty gentle, though. Seriously, typing what you typed into IRC actually gets you most of the way on google. [08:54]
dreamreal refine that original sentence once or twice and you'll get some super-high-quality and perfectly relevant information. [08:54]
dreamreal ... as long as you refine it in the right direction, I guess [08:55]
LaSombra Maybe using Google instead of DuckDuckGo or Yahoo or Yandex might be good practice, no? [08:55]
shantaram Ecosia? [08:55]
shantaram The tree thing? [08:55]
dreamreal "I refined it by adding alyssa milano and samsung galaxy and yoko ono's left buttock to the search. But it's worser now!" [08:55]
LaSombra lol [08:56]
Squarism Ill explain. I actually though about doing it. But too many times these google sessions can lead to 5 different methods. Some that are plain wrong and some that require quite a deal of reading to get to the point. [08:56]
dreamreal I'm afraid to search for yoko ono's left buttock. What if I... find it [08:56]
LSCody [LSCody!] has joined ##java [08:56]
dreamreal Squarism: the official spring docs actually cover what you're asking [08:56]
cheeser well, god forbid you expend any effort on your own part, Squarism. you might learn something about the various pros and cons of different approaches. [08:56]
dreamreal so you could always... you know... look for those, or limit the search [08:56]
LaSombra I take left buttock over groin mole any time [08:56]
dreamreal shudders. But no matter what body part it is, it'd still be yoko ono [08:57]
dreamreal "yoko ono's leftmost incisor! AAARRRRGH" [08:57]
Squarism cheeser, you just get a hardon stepping on people to elevate your failing ego [08:57]
dreamreal Squarism: actually, no [08:57]
Zarthus Wait, quite a bit of reading is a deterrent? [08:57]
Zarthus Do you know IRC is a text protocol :| [08:57]
kicked Squarism (but if you're going to be upset about people trying to help you help yourself, here, have a kick) [08:57]
cheeser Squarism: you really don't know me so stuf and write your code [08:57]
LaSombra Zarthus: StackOverflow-generation [08:57]
macroprep_ [macroprep_!~smallvill@2405:7f00:8801:d00:5159:504b:27f0:cc7d] has joined ##java [08:58]
LaSombra If it's not a one-liner it takes too long or is too complicated [08:58]
waz [waz!~waz@pdpc/supporter/active/waz] has joined ##java [08:58]
mbooth LaSombra: I got bored reading your reply, can you summarise it in three words? [08:58]
cheeser LaSombra: tl;dr [08:58]
Squarism [Squarism!~someone@] has joined ##java [08:59]
dreamreal cheeser: s/stuf/stfu/ # crikey that was confusing for a bit [08:59]
cheeser dreamreal: get stfud [08:59]
cheeser D [08:59]
LaSombra mbooth, cheeser: tl... 1line... fcuk [08:59]
dreamreal giggles in rather unmanfully [08:59]
dreamreal ... fashion [08:59]
Zarthus Reminds me of a recent conversation I saw where we were making fun of people using enter for punctuation, at some point someone said "can you reduce your messages to fit on my 0-width terminal please" [08:59]
dreamreal mbooth: "do it 4me" [08:59]
mbooth dreamreal ++ # Thanks. Why use many word when few do trick. [09:02]
mbooth dreamreal has a karma level of 5, mbooth [09:02]
dreamreal man, you're wordy [09:03]
cheeser mbooth: i loved that episode [09:07]
greggerz [greggerz!~greggerz@unaffiliated/greggerz] has joined ##java [09:08]
wathek [wathek!] has joined ##java [09:08]
dmlloyd *sigh* [09:09]
dmlloyd generics [09:09]
EmmaT [EmmaT!] has joined ##java [09:10]
qwedfg [qwedfg!~qwedfg@] has joined ##java [09:16]
indistylo [indistylo!~aruns_@] has joined ##java [09:18]
plarsen [plarsen!~plarsen@redhat/jboss/pdpc.professional.plarsen] has joined ##java [09:27]
indistylo [indistylo!~aruns_@] has joined ##java [09:39]
adder [adder!~adder@gateway/tor-sasl/adder] has joined ##java [09:51]
waz_ [waz_!~waz@pdpc/supporter/active/waz] has joined ##java [09:52]
Necro^Byte [Necro^Byte!~kvirc@] has joined ##java [09:54]
dez [dez!uid92154@fedora/deSouza] has joined ##java [09:59]
sbalmos96 [sbalmos96!424ddf44@] has joined ##java [10:00]
sbalmos1 [sbalmos1!~sbalmos@2605:a000:1304:8078:e598:de79:5ee8:c61b] has joined ##java [10:01]
raj [raj!raj@unaffiliated/cypha] has joined ##java [10:08]
macroprep [macroprep!~smallvill@2405:7f00:8801:d00:c4db:f7c9:ab2:a3b5] has joined ##java [10:11]
RedSoxFan07 [RedSoxFan07!] has joined ##java [10:22]
plarsen [plarsen!~plarsen@redhat/jboss/pdpc.professional.plarsen] has joined ##java [10:23]
RoriconKnight [RoriconKnight!~RoriconKn@] has joined ##java [10:24]
macroprep [macroprep!~smallvill@2405:7f00:8801:d00:c4db:f7c9:ab2:a3b5] has joined ##java [10:24]
manualcrank [manualcrank!] has joined ##java [10:26]
v01d4lph4 [v01d4lph4!~v01d4lph4@] has joined ##java [10:31]
v01d4lph4 [v01d4lph4!~v01d4lph4@] has joined ##java [10:31]
LSCody [LSCody!] has joined ##java [10:36]
Markow [Markow!~ejm@] has joined ##java [10:40]
mindCrime [mindCrime!~mindCrime@] has joined ##java [10:44]
ravenousmoose [ravenousmoose!~ravenousm@] has joined ##java [10:46]
RoriconKnight [RoriconKnight!~RoriconKn@] has joined ##java [10:46]
esro [esro!~esro@] has joined ##java [10:54]
jamezp [jamezp!~jamezp@redhat/jboss/jamezp] has joined ##java [10:57]
tang^ [tang^!~tang^@] has joined ##java [11:01]
raj [raj!raj@unaffiliated/cypha] has joined ##java [11:02]
rippa [rippa!] has joined ##java [11:07]
impermanence [impermanence!c01c0124@gateway/web/cgi-irc/] has joined ##java [11:14]
Renari [Renari!] has joined ##java [11:18]
pygmypuppy [pygmypuppy!] has joined ##java [11:19]
plarsen [plarsen!~plarsen@redhat/jboss/pdpc.professional.plarsen] has joined ##java [11:19]
raztoki [raztoki!~a0sle@unaffiliated/a0sle] has joined ##java [11:20]
RoriconKnight [RoriconKnight!~RoriconKn@] has joined ##java [11:22]
wathek hi guys, is it normal that my memory consumption when I open an xls file that contains approx. 40000 rows I have a 3.7GB of memory consumption? here's my code: I'm using org.apache.poi:poi-ooxml:3.17 library [11:25]
progart [progart!~kamee@] has joined ##java [11:25]
mohsen_1 [mohsen_1!uid289573@gateway/web/] has joined ##java [11:26]
dreamreal how large is the base file [11:27]
progart [progart!~kamee@] has joined ##java [11:27]
progart [progart!~kamee@] has joined ##java [11:28]
kicked progart (Banned: please fix your connection. you're bouncing in and out. this ban will expire after 2h) [11:28]
wathek dreamreal, almost 7MB [11:28]
dreamreal How complex is the sheet? [11:28]
wathek dreamreal, no macros no formulas [11:29]
Sasazuka [Sasazuka!~Sasazuka@unaffiliated/sasazuka] has joined ##java [11:29]
wathek dreamreal, it's just approx 40k lines [11:29]
freeone3000 that'd be something to look at. [11:30]
dreamreal hmm, seems a little odd. Just 40k lines of data? no formulas, no crossreferences? it *sounds* pretty memory-intensive, but I'd have to profile. Ask the POI support forums. [11:30]
raj_ [raj_!raj@unaffiliated/cypha] has joined ##java [11:31]
wathek dreamreal, yes that's why I'm confused [11:32]
dreamreal ask the POI support forums [11:32]
wathek ok thanks [11:32]
LunarJetman [LunarJetman!LunarJetma@] has joined ##java [11:33]
gdrc wathek: please don't crosspost questions [11:42]
z147 [z147!~z147@gateway/tor-sasl/z147] has joined ##java [11:43]
CookieM [CookieM!] has joined ##java [11:50]
rawblem [rawblem!~rob@redhat/jboss/rawblem] has joined ##java [11:51]
rawblem hey all: what does it mean when an httpurlconnection has a contentLength of 0? [11:51]
rawblem [11:51]
rawblem rawblem's title: "Untitled - Modern Paste" [11:51]
rawblem the url here can clearly be gotten via wget and it downloads a zip... but when im getting the content length, it's 0. [11:52]
rawblem i believe a -1 means unknown and we should download until finished, but what does a 0 signify? [11:52]
rawblem does a 0 signify that the server didn't set the header? or does -1 signify that? [11:54]
igeni [igeni!] has joined ##java [11:59]
waz [waz!~waz@pdpc/supporter/active/waz] has joined ##java [11:59]
orbyt_ [orbyt_!~orbyt@] has joined ##java [12:01]
forgottenone [forgottenone!~forgotten@] has joined ##java [12:02]
ernimril rawblem, you are getting a 301 moved back, 0 means no content in the response [12:05]
ernimril rawblem, wget follows redirects (unless told not to) [12:05]
ernimril rawblem, try "HEAD -E http://download..." if you have the HEAD program [12:06]
karab44 [karab44!~karab44@unaffiliated/karab44] has joined ##java [12:06]
mattfly [mattfly!~matheus@] has joined ##java [12:07]
neo4 [neo4!] has joined ##java [12:08]
rawblem ernimril, thanks so much. yeah dumb mistake on my part [12:14]
falconfox [falconfox!] has joined ##java [12:14]
rawblem i should have noticed that [12:14]
rawblem @ernimril, in general should we treat a <= 0 as 'read it all / unknown' ? right now i was hard-coding against -1 [12:14]
iam730 [iam730!~iam730@] has joined ##java [12:15]
ernimril rawblem, unknown content length should not really be set [12:16]
freeone3000 0 means 0. [12:16]
ernimril rawblem, but both any server and java http urlConnection can do silly things [12:16]
ernimril rawblem, Many http responses have no body and then the response ought to have Content-Length: 0 [12:17]
TomyWork [TomyWork!~TomyLobo@] has joined ##java [12:21]
rawblem alright... i guess i'll try to fix this at the source and fix the changed url. I'm already following redirects but if i get a -1 content length, i read until the end of the stream, whereas if i get a defined content length, i read that many bytes. Since this is redirecting, but i get a 0 content length, my code gets confused how to handle it [12:22]
rawblem guess i'll just update the urls ;) [12:23]
ernimril rawblem, not sure why you need to care, the inputstream you get from a httpurlconnection will have the correct number of bytes in it any way. You could do a "read until end of stream" if you want. [12:25]
ernimril rawblem, You could also call setFollowRedirects?(true) to have the 301 handled automatically [12:25]
ranbox2d [ranbox2d!a0b3c0b2@] has joined ##java [12:39]
ranbox2d how do you add to a generic arraylist? [12:39]
ranbox2d [12:39]
cheeser screenshots [12:40]
cheeser please don't take screenshots of your code. Use a paste site instead (ask me about ~pastebin) [12:40]
ranbox2d only answer i found was to specify a parent for the generic object [12:40]
ranbox2d here's the code [12:40]
ranbox2d [12:40]
cheeser don't mix arrays and generics [12:40]
dreamreal and that's the right answer, or don't supply a generic in the first place [12:40]
ranbox2d lol it's a bit of a mess, the output is an arraylist of an arraylist, and the input is an array of arraylists of arraylists [12:42]
dreamreal well, are the lists homogenous? [12:42]
ranbox2d of integers or strings sometimes? [12:42]
dreamreal Are they of the same type? [12:42]
ernimril ranbox2d, the problem is that your input is of <?> [12:42]
ranbox2d i'll see if i can be more specific there i guess [12:43]
dreamreal You can always pass in a type [12:43]
dreamreal generics [12:43]
dreamreal For a tutorial on generics, please see . Also, is a great in-depth resource. [12:43]
ernimril ranbox2d, start by making that a <T>, your output seems to be of List<List<T>> [12:43]
ernimril ranbox2d, so a better signature is probably "<T> public static List<List<T>> combine(List<T> ... args)" [12:44]
dreamreal ^^^ [12:44]
indistylo [indistylo!~aruns_@] has joined ##java [12:54]
ranbox2d ArrayList<ArrayList<int[]>> out = new ArrayList(new ArrayList<int[]>()); [12:56]
ranbox2d out.size() is zero? [12:56]
cheeser tias [12:56]
cheeser Try it and see. You learn much more by experimentation than by asking without having even tried. [12:56]
ranbox2d yes i tried it, i was about to ask why is it zero :P [12:56]
cheeser also, don't mix arrays and generics like that. it's gross and buggy. [12:56]
cheeser why wouldn't it be? [12:56]
ranbox2d isn't it supposed to be an arraylist of one empty Arraylist [12:57]
cheeser did you add anything to it? [12:57]
ranbox2d the empty arraylist? i guess? [12:57]
ranbox2d it's initialized with it [12:57]
cheeser oh, i see. misparsed what you wrote. [12:57]
Wilfredor [Wilfredor!~Wilfredor@unaffiliated/the-photographer/x-0861727] has joined ##java [12:57]
ranbox2d it works if i add it in a different line [12:58]
ranbox2d ArrayList<ArrayList<int[]>> out = new ArrayList(); out.add(new ArrayList<int[]>()); [12:58]
ranbox2d this and the line i wrote above are different then [12:58]
Wilfredor goof [12:58]
cheeser oh, it's because that contructors adds the contents of the pass ed in list to the new list. [12:58]
cheeser so you made a list and added everything from an empty list to it. [12:58]
ranbox2d makes sense, thanks [12:58]
cheeser read the constructor docs [12:59]
ranbox2d yep i understood :P my bad [12:59]
indistylo [indistylo!~aruns_@] has joined ##java [01:03]
kicked indistylo (Banned: please fix your connection. you're bouncing in and out. this ban will expire after 24h) [01:03]
palasso [palasso!~palasso@unaffiliated/palasso] has joined ##java [01:05]
jesmon [jesmon!~user@] has joined ##java [01:16]
indistylo [indistylo!~aruns_@] has joined ##java [01:19]
kicked indistylo (Banned: please fix your connection. you're bouncing in and out. this ban will expire after 24h) [01:19]
v01d4lph4 [v01d4lph4!~v01d4lph4@] has joined ##java [01:19]
raj_ [raj_!raj@unaffiliated/cypha] has joined ##java [01:21]
palasso [palasso!~palasso@unaffiliated/palasso] has joined ##java [01:21]
Nicmavr [Nicmavr!~Nicmavr@unaffiliated/nicmavr] has joined ##java [01:28]
wreed [wreed!~wreed@] has joined ##java [01:38]
wreed im trying to write an annotation processor (with java poet), and for obvious reasons i cannot access the Class of the object I am processing. I am wondering if there are work arounds to not having access to this as I want the parameter of a method to be the class I am processing. If I just use some template approach instead of java poet maybe I can get away with not having the actual class [01:39]
yawkat javapoet offers non-class methods everywhere. [01:41]
yawkat you can pass a TypeName or a Type for example. [01:41]
Markow [Markow!~ejm@] has joined ##java [01:46]
wreed so after obtaining the class string and package string i can just use something like ClassName.get(packageName, className) [01:47]
wreed let me try [01:47]
wreed for some reason its no longer generating the file but if i just print it out instead it generates. thats strange but it is at least working. thanks yawkat [01:52]
Sasazuka [Sasazuka!~Sasazuka@unaffiliated/sasazuka] has joined ##java [01:53]
pioto [pioto!~pioto@unaffiliated/pioto] has joined ##java [01:55]
tomboy64 [tomboy64!~tomboy64@gateway/tor-sasl/tomboy64] has joined ##java [02:01]
v01d4lph4 [v01d4lph4!~v01d4lph4@] has joined ##java [02:04]
waz [waz!~waz@pdpc/supporter/active/waz] has joined ##java [02:09]
v01d4lph4 [v01d4lph4!~v01d4lph4@] has joined ##java [02:19]
MrRothstein [MrRothstein!a1457a0e@] has joined ##java [02:25]
v01d4lph4 [v01d4lph4!~v01d4lph4@] has joined ##java [02:25]
Lengsdorfer [Lengsdorfer!~Lengsdorf@unaffiliated/lengsdorfer] has joined ##java [02:27]
waz [waz!~waz@pdpc/supporter/active/waz] has joined ##java [02:29]
vbgunz Hello fellas, quick question. I just got to chapter 8 of ThinkJava and something that just kind of hit me is, why when defining main, I start it with (String[] args) but when defining my own methods that require a string I just say (String args) ... what's the [] doing in main? [02:33]
Maldivia [] is array [02:34]
surial vbgunz: wow, you're.. a bit ahead of the curve then. That's usually covered in one of the first lessons. [02:34]
ustedes arrays [02:34]
ustedes vbgunz, arrays is [02:34]
palasso [palasso!~palasso@unaffiliated/palasso] has joined ##java [02:34]
waz [waz!~waz@pdpc/supporter/active/waz] has joined ##java [02:34]
surial vbgunz: And everyone else already answered :) [02:34]
ustedes surial: he's reading Thinking in Java, so I am not surprised [02:34]
vbgunz oh [] is like a string array? because I understood strings to be immutable? [02:34]
surial vbgunz: um, that's as related to each other as guns and grandmas are. you're very confused. [02:35]
dreamreal vbgunz: errrr... string array and strings being immutable are completely unrelated [02:35]
surial vbgunz: A String[] is an array of strings. Say, {"Joe", "Dan", "Mary"} [02:35]
dreamreal String[] is an array of strings, String is a single string reference [02:35]
ustedes tij [02:35]
ustedes ustedes, tij is Thinking in Java, by Bruce Eckel. See - the free 3rd edition is missing information about Java 5 and 6. it's also misguiding and outdated. don't waste your time with it. [02:35]
surial vbgunz: it's like a list. a bag of strings. could be 0 of em. could be 80000. [02:35]
ustedes bibles [02:35]
ustedes vbgunz, bibles is The Java Tutorials - , Josh Bloch's "Effective Java" and Brian Goetz' "Java Concurrency In Practice" [02:35]
vbgunz got it [02:35]
surial ah, yeah eckel. I remember reading a few things, going: Wow, what an idiot, and then later realizing he's written quite a few books. [02:36]
ustedes vbgunz: read in that order. ditch TIJ [02:36]
surial that was back in my judgemental days. [02:36]
dreamreal he's like schildt except smarter [02:36]
ustedes I haven't seen TIJ mentioned in here for years [02:36]
dreamreal The biggest problem eckel has is that he wrote TIJ and left it [02:36]
surial vbgunz: if I pass as args to your java app, say: java -jar yourapp.jar foo bar baz [02:36]
ustedes I had thought we managed to successfullyi squash it [02:36]
dreamreal ustedes: alas, no [02:36]
surial vbgunz: then, given: public static void main(String[] args) {}... you could do: [02:36]
dreamreal headfirst java is the same way [02:36]
surial vbgunz: System.out.println(args.length); // would print 3 [02:36]
vbgunz I know what list are and I know java (I belive) allow you to restrict the contents of list to a certain type, so String[] is an array of strings and String (alone) is a single string object [02:36]
dreamreal were allowed kathy sierra to be harassed and lost a good resource [02:37]
surial vbgunz: System.out.println(args[0]); // would print foo [02:37]
surial vbgunz: System.out.println(args[1]); // would print baz [02:37]
dreamreal vbgunz: note that a list and an array are very different [02:37]
surial vbgunz: args[0] = "hello!"; // sure, this is legal. strings are immutable. arrays aren't. [02:37]
surial vbgunz: for (String a : args) System.out.print(a + " "); // would print foo bar baz [02:37]
vbgunz gotcha, I haven't gotten to arrays yet, I'm on chapter 8 which is literally titled "arrays" [02:37]
vbgunz haha, maybe had I just waited to complete this chapter [02:37]
code_zombie [code_zombie!~code_zomb@2605:a601:aa1:da00:c72:6060:ddea:6720] has joined ##java [02:38]
vbgunz I just try to google and ask on something that are unclear (nothing ground breaking), just trying to squeeze in a little more info is all [02:38]
surial As has been told, the channel advice is to find a nice cozy fireplace, get yourself a good book (which TIJ is not), then toss TIJ in that fireplace and set it alight. [02:38]
vbgunz thank you fellas, you guys are always awesome :) [02:38]
jesmon vbgunz: basically the '[]' suffix is notation for an array data structure. It works for any type in java: int[], byte[], Double[], Object[], etc [02:39]
vbgunz jesmon: that right there is gold [02:39]
vbgunz I just haven't seen those but I appreciate the heads up [02:39]
dreamreal hah, that's sort of like the historians in "It" - "Oh, you found sanderson? And burned it? Good!" [02:39]
vbgunz actually the book I'm reading is "Think Java by Allen B Downey & Chris Mayfield", it's an Oreilly book [02:41]
surial vbgunz: as a followup: arrays are extremely primitive and mostly suck. You use them to write collection APIs, except there is no need as java's already done this: java.util.ArrayList and company. [02:41]
surial vbgunz: if you have arrays or primitive types (so, say, int[]), those can make sense. byte[] especially. [02:41]
surial vbgunz: But String[]? Don't ever do that. It's unfortunate java's app launch concept requires one, but that should be the only one you ever make. [02:41]
surial vbgunz: in particular, do not ever mix them with generics. List<String>[] // an attempt at an array of lists of strings. Think 2D grid <-- this is a bad idea and basically doesn't work at all. [02:42]
funeral [funeral!~Funeral@2a01:79d:3e82:4b8c:a393:7879:435f:9c81] has joined ##java [02:42]
progart [progart!~kamee@] has joined ##java [02:43]
surial arrays have broken equality, broken toString, are inherently mutable and thus require defensive copying or are inherently spaghetti, cannot be resized _AT ALL_, and don't work with generics. [02:43]
vbgunz surial: yeah, the other day I came in here asking about generic syntax because I saw it and didn't know what was happening. thanks for the heads up [02:43]
surial every single lsat issue is something that java.util.List doesn't suffer from. [02:43]
ernimril I would not say that equality is broken for arrays, it has basic Object equality [02:44]
Cyp__ [Cyp__!~Cyp_@2a05:f6c7:2883::2] has joined ##java [02:44]
vbgunz ustedes: thanks for the links. the mindview link I think is broken but my "Think Java" book is not "Thinking in Java" [02:49]
dreamreal vbgunz: what version of java does it cover? [02:50]
vbgunz dreamreal: not exactly sure, I'm on openjdk 11 and so far it's all good. I got the 2nd edition updated in 2017 april [02:51]
vbgunz [02:51]
vbgunz vbgunz's title: "Think Java - O'Reilly Media" [02:51]
vbgunz am just literally wrapping up on the exercises in chapter 7 [02:52]
Cahaan [Cahaan!~Cahaan@] has joined ##java [02:52]
dreamreal well, having it work with 11 doesn't tell me much, on the surface - books for java 1.2 would probably work with java 11 :) [02:53]
vbgunz that's nice, no wonder javas been around forever. nice when things don't break [02:55]
cheeser that's the idea. [02:55]
cheeser brian goetz deserves a medal. [02:55]
cheeser eyes dmlloyd [02:55]
cheeser D [02:55]
ernimril vbgunz, java has not been around forever, it is from 1995/1996, pretty young compared to some other languages [02:55]
dreamreal There'd be a few things that might break - particularly if the really old code used names like "enum" - but overall it's pretty much compatible [02:55]
vbgunz I think the book is good. when I approach the end I bring my questions here and so far, I learned from here <generics>, (cast) and when to use new on primitive vs reference types. these things are probably in the book but clearing those questions up here is appreciated [02:56]
cheeser or assert! [02:56]
dreamreal the book doesn't say what version of java it targets - but it DOES refer to drjava, which is a terrible thing [02:57]
cheeser haha. wow. [02:57]
vbgunz haha [02:57]
surial vbgunz: there are aspects of 'is this a good book' that a learner could opine meaningfully about; heck, for some a pro might not have the proper context to evaluate. [02:57]
dreamreal see page 9 [02:57]
vbgunz I didn't even bother to look to deep into it, I like intellij idea, it's pretty fine [02:57]
dreamreal vbgunz: idea is great, yeah [02:58]
surial vbgunz: but there are A LOT of aspects of 'is this a good book' that a learner would have zero clue. You simply do not have the knowledge or experience to judge things like: "Is this how java is written these days?" "Will this style result in maintainable code?" "Is this way of working likely to result in security leaks?" etc. [02:58]
dreamreal it's just not a good sign when a book says "bluej is ok, drjava is IN!" <-- both of those editors are pretty much poison for real programmers [02:58]
surial vbgunz: for the vast majority of those 'a pro would know' things, we're telling you: Book sucks, dude ;P [02:58]
dreamreal surial: think java? or thinking in java? [02:58]
surial TIJ [02:58]
dreamreal Well, he's reading "Think Java," not TIJ [02:59]
vbgunz it's not thinking in java, it's just Think Java [02:59]
surial geez. I've been on the wrong page huh. [02:59]
surial [20:34:52] <ustedes> surial: he's reading Thinking in Java, so I am not surprised [02:59]
dreamreal I don't see anything in the book that particularly recommends it, but apart from the drjava thing, it seems vaguely okay [02:59]
surial also: vbguns: [snip] I just got to chapter 8 of ThinkJava [snip]. [02:59]
dreamreal surial: yeah, ustedes got it wrong [02:59]
surial g book java ThinkJava [02:59]
surial [02:59]
vbgunz dreamreal: yeah, I know what you mean, I kind of trust oreilly and so far I got a lot cleared up. I'm familiar with programming but just not how java does it. it's clearing up some concepts for me [03:00]
dreamreal surial: [03:00]
dreamreal ^^^ legal download [03:00]
dreamreal hmm, we should get the bot to echo titles of PDFs, too [03:00]
vbgunz ha [03:00]
vbgunz I got my book from humble bundle [03:01]
mindCrime [mindCrime!~mindCrime@] has joined ##java [03:01]
vbgunz haha [03:01]
dreamreal vbgunz: nothing wrong with that [03:01]
surial okay. checking for common fuckups. [03:01]
surial fuckup one: Scanner. Book: fucked it up. [03:01]
ustedes woops [03:01]
dreamreal surial: page 9, drjava! [03:01]
dreamreal I haven't gotten very far in the book, I was mostly trying to see what version of java it covered [03:01]
surial yeah that's, what, 20 fuckup points right there? [03:01]
ustedes I actually read the python book from that series when I taught myself to program [03:01]
ustedes derive from that what you will in terms of the quality of those books :D [03:02]
dreamreal surial: eh, it's not trying to teach great *java* [03:02]
vbgunz the only thing I think drjava does that I don't think the community edition of idea supports are stack diagrams, that keeps coming up here and there [03:02]
dreamreal and the reasons that it gets scanner wrong aren't entirely relevant for the target audience [03:02]
surial Scanner's behaviour between nextLine and nextX() is confusing to newbies. [03:02]
dreamreal yes [03:02]
dreamreal but so what [03:02]
gareppa [gareppa!~gareppa@unaffiliated/gareppa] has joined ##java [03:02]
surial I don't require a book to explain it, though I will check if the style they advocate tends to lead to that confusion. Also, if they DO explain it, I check said explanation. [03:03]
dreamreal sure, but ... again, so what [03:03]
dreamreal that's worrying about a very very very small thing in the grand scheme of java [03:03]
vbgunz the book does use Scanner quite a bit [03:03]
dreamreal and... [03:03]
surial In this case, the book [A] chose to explain it, [B] chose to do so INCREDIBLY poorly, by calling it a 'bug' (it isn't), by not even TRYING to suggest a solution, AND by not doing the proper thing which is to explain scanner in the right way: That being the way where this behaviour is now no longer confusing to you. [03:03]
surial So, it's not about code style. This is didactically a shit approach. [03:04]
dreamreal sighs. Yes. It's not a great thing. [03:04]
surial Most java tutorials fuck this up. They either tell you to use .nextInt() and .nextLine() with absolutely no mention whatsoever of the wierd interaction, and between this channel and some other java starters I am 100% confident in saying: The world has proven beyond all reasonable doubt that Joe Q. Average Java Learning is >75% chance to fuck it up if you don't explain this properly. [03:04]
surial Or, they try to explain it (rare; usually those do it well, but this one fucked THAT up), or, they try to give you a 'dont think about it and I wont explain, or will explain very succintly. Mostly, I will give you this formulaic incantation that just fixes it), and then proceeds to give a stupid incantation. [03:05]
surial stupid, as in: That won't actually take away all issues, it's abuse of the API, and just adds to the confusion probably because the AUTHORS didn't get it either. [03:06]
vbgunz surial: here's something I got I can recall from Scanner (from the book). if you call say nextInt, Scanner stops at \n. if by chance I wanted the next text string, I'd have to call it twice (forgot the exact method). the idea being it's something to watch out for [03:06]
surial and blameably (I'm making it a word, ha!) stupid because there is a solution that is simpler, shorter, fits the correct explanation, is idiomatic, is not API abuse, and works for all cases. [03:06]
surial see? [03:06]
surial I say it here, comes out there. [03:06]
surial vbgunz: that's wrong. [03:06]
dreamreal surial: while I wouldn't use Scanner for examples myself (and I didn't), if I *did* I'd consider whether the explanation done properly was worth it when first encountered. I'd ... certainly try to do it properly, and handwave the reasons why ("you're not ready, okay?") but that doesn't mean that every author approaches it the same way [03:06]
surial vbgunz: the book didn't even say it, but it implied it so much you drew the wrong conclusion from it. [03:06]
surial dreamreal HATES it when I jump to conclusions, and the fact that I tend to jump to the right one 9 out of 10 times presumably just, I dunno, keeps him up at night perhaps. Point being, the book fucked this up. [03:07]
dreamreal I don't see what Scanner actually offers new programmers myself [03:07]
dreamreal surial: I wasn't complaining about the conclusion. [03:07]
surial vbgunz: here's the secret sauce: Scanner is used to read tokens, and in addition, everytime you grab a token, YOU tell scanner what kind of data you expect the token to contain. [03:07]
vbgunz surial: I actually don't like that idea but probably cause I'm trying to keep it moving [03:07]
surial vbgunz: so .nextInt() does not mean: Read me an int. [03:07]
surial It means, like all .nextX() calls: read me a token.. and then PARSE it as an int. [03:07]
surial If the next token in the queue is not an int, that method correctly crashes. .nextInt(), after all, means: I expect the inputstream to give me an int now. If it doesn't, that's what exceptions are for. [03:08]
surial vbgunz: when you want to read an entire line's worth, that's.. just not waht scanner does. Yeah I know, there's .nextLine(). Forget it. Don't ever use that method, it's stupid. [03:08]
surial vbgunz: here's what you really want: You want a token, but, you want to consider the lot, from start to finish, until the newline char to be the token. [03:08]
surial vbgunz: so.. TELL TEH SCANNER THIS! scanner.useDelimiter) [03:09]
surial scanner.useDelimiter("\n") and VOILA. [03:09]
vbgunz haha [03:09]
vbgunz dreamreal did say java is easy [03:09]
vbgunz haha [03:09]
dreamreal scanner [03:09]
dreamreal java.util.Scanner is a tool read specific types of input ('a number', 'a word'). A common mistake is to use nextLine(). Don't. Use .useDelimiter("\n") + .next(). See for examples and a full explanation. [03:09]
dreamreal Java *is* easy - user input is not [03:09]
surial will get you the whole thing. want the user to enter a name? A full name, spaces are fine, and input is done only when they hit enter? Great. That's what most people want, for any input scanner processes. So all you have to do is tell the scanner: Hey, bud, tokens end when you see a newline (versus the default which is: Anytime any whitespace of any sort shows up). [03:09]
surial vbgunz: this 'it reads tokens' explanation works, for all cases, with no surprises, ever, because THAT IS WHAT SCANNER IS. [03:10]
surial A token reader. [03:10]
dreamreal blog [03:10]
dreamreal surial, this channel is not your personal blog. Take it back to your tumblr, where your ideas will be read by thousands of hungry followers. The next revolution will be led by YOU! Just like the last one. [03:10]
surial if you think the right way to read, say, a full name using scanner, is by using .nextLine() you done fucked up and you don't understand how to use it. [03:10]
dreamreal ... except the ~scanner entry was, in fact, written by you. Refer to it. Save everyone the time! [03:10]
surial no damnit! The scanner revolution is NOW! Hear ye hear ye and gather thine pitchforks. [03:10]
dreamreal It's already been done and documented. By you. [03:11]
surial dreamreal: fair point, that. [03:11]
vbgunz thank you, I will remember that before you yelled at me to get off the lawn, you taught me a valuable lesson. I mean it, a litte facetious but thanks, I appreciate the explanation :) [03:11]
surial vbgunz: in defense of your shitty book there, this one particular point so happens to get screwed up by most books. So, you know - yeah authors got a fail on that one, but evidently 'get scanner right' is a tough nut to crack :P [03:11]
dreamreal vbgunz: note the ~scanner factoid, which actually says all this, except in static glory where it can be referred to more conveniently :) [03:11]
dreamreal surial: "get input right" is nontrivial [03:12]
dreamreal it's not just scanner [03:12]
cheeser and without the hyperbole [03:12]
MachinShin parted the channel: [03:12]
surial dreamreal: indeed. Which only makes the 'it tokenizes. it gives you tokens. Thats where its capabilities end' approach so much the better. If you have input needs and you have a hell of a time translating it to a token-based notion that feels like it'll program well, then.. scanner isn't what you wanna be using. [03:13]
dreamreal vbgunz: anyway, from the looks of it, Think Java seems... tolerable? Not very good, but tolerable. [03:13]
surial and if it DOES token well, then.. scanner is virtually guaranteed to be a perfectly fine option. [03:13]
dreamreal vbgunz: I don't know which humble bundle you bought - I didn't see it, I think - but consider some of ORA's other, more targeted books. Also consider Apress and Manning for sources. Avoid packt; some of their offerings are very good, but most of their stuff is absolute rubbish, because their editorial process sucks. [03:14]
vbgunz I don't plan to stop here with this book but did just need to start and without realizing it, I bought the java bundle a while back and just had the book sitting here [03:15]
dreamreal vbgunz: *nod* [03:15]
vbgunz it was the Java O'reilly Bundle [03:15]
dreamreal well, if you end up confused by something, blame the book [03:15]
dreamreal again, I didn't see it, so I don't know what it had [03:15]
dreamreal a lot of the humble bundle things are pretty worthwhile, but they mix in some less-valuable stuff sometimes [03:16]
vbgunz would you guys then say ~bibles is a good place to get started next? outside of now? [03:18]
dreamreal bibles [03:18]
dreamreal dreamreal, bibles is The Java Tutorials - , Josh Bloch's "Effective Java" and Brian Goetz' "Java Concurrency In Practice" [03:18]
dreamreal that's pretty good, yeah [03:18]
dreamreal I think it'd be interesting for ##java to actually put together its own introduction ... but I can't see it actually working in practice :) [03:20]
cheeser i've thought about writing some actually [03:20]
dreamreal well, I know an editor... [03:21]
vbgunz you guys are fabulous, I'll be here but I got to put this down and finish up, thank you all for your patience [03:21]
surial A slight tweak on this notion: Someone should (yeah, this is real easy to say. slightly harder to do) make a decent enough java tutorial, and this channel should then endeavour to write some notes or straight up wiki that thing. Partly to make it better, but mostly to reflect common newbie errors. which, presumably, this channel'd know. [03:21]
cheeser dreamreal: Laura? i worked with her on my kotlin videos. she's great. [03:21]
dreamreal cheeser: *nod* [03:21]
dreamreal I know more editors than her, too! [03:21]
surial so, you know, a communally written one seems like a daft plan to put in practice, but if someone really owns it and this channel's responsibility goes no further than to write notes about approaches that fail and whenever they send a newbie to a page based on the notion of 'yeah this, just read this and you now know' (and I guess: They read it and still didn't get it...) ? that seems doable for the chanenl [03:22]
yawkat soap [03:22]
yawkat SOAP stands for Simple Object Access Protocol. Except it's not simple but complicated and not about objects but RPC and hence should be called CRAP. See for more info. SOAP client tutorial: [03:22]
Lightsword anyone know how to identify what would be causing a java.lang.OutOfMemoryError error in travis when running junit5 tests? for example [03:23]
Lightsword Lightsword's title: "Travis CI - Test and Deploy with Confidence" [03:23]
dreamreal hmm, what topics would such an intro need to cover.... [03:23]
cheeser Lightsword: using too much memory, typically. [03:23]
surial Lightsword: a memory leak or an app that needs grievous amounts of it. [03:23]
surial Lightsword: I don't think junit5 has a built in memory leak designed in there on purpose and on by default. It MIGHT have a bug, but, junit5 is rather popular. The odds that you found it are... Well, you tell me. Do ya feel lucky, punk? :P [03:24]
Lightsword yeah, I'm assuming something like that but I haven't been able to reproduce locally to get a trace [03:24]
freeone3000 Lightsword: Run with a lower -Xmx. [03:24]
surial yup, easy. [03:24]
Lightsword the tests in travis are being run with -Xmx4G [03:25]
surial yes, and you are having trouble reproducing the OOM. [03:25]
surial Lightsword: so reduce it. [03:25]
freeone3000 right, so run it with that value locally. [03:25]
waz [waz!~waz@pdpc/supporter/active/waz] has joined ##java [03:26]
MrRothstein [MrRothstein!a1457a0e@] has joined ##java [03:26]
Lightsword so java.lang.OutOfMemoryError doesn't mean the OS itself is fully out of memory right? just that java hit its internal limit? [03:27]
MrRothstein parted the channel: [03:27]
MrRothstein [MrRothstein!a1457a0e@] has joined ##java [03:27]
freeone3000 Exactly. [03:27]
surial oh, wait. [03:27]
surial hold on. [03:27]
surial Lightsword: you're running -Xmx4g right? [03:27]
surial Lightsword: are you also running -Xms4g? [03:27]
freeone3000 you'll *also* get it if Java can't actually allocate the amount it asks for. [03:28]
Lightsword [03:28]
Lightsword Lightsword's title: "jPOS/.travis.yml at master jameshilliard/jPOS GitHub" [03:28]
surial because, well, that [03:28]
Lightsword travis is just running with -Xmx4G [03:28]
surial Lightsword: here's a simple rule of thumb: For predictable java performance (which DEFINITELY applies on ALL server purposes pretty much), you ALWAYS want matching -Xmx and -Xms. [03:28]
surial Lightsword: so, that's probably your problem right here. Update that export JAVA_OPTS and mke it: -Xmx4G -Xms4G [03:28]
Lightsword so -Xmx4G -Xms4G requires how much OS memory? [03:29]
surial -Xmx sets the MAXIMUM. Java won't allocate that much until it needs to, and, yeah, if it can't, you'd get an OOME. -Xms sets the MINIMUM. [03:29]
freeone3000 Lightsword: A little over 4G. [03:29]
surial By setting min and max to the same value, the VM will immediately alloc that much and will, after that first big malloc, never malloc or free anything ever again. The OS is no longer invovled at all, and any OOME is now solely due to java. [03:29]
surial Also, by doing it that way, you know your param does stuff. You can start a JVM with -Xmx12391023G and it'll start. Obviously, it'll fail even if you have an app that needs merely 12381000 gigs of mem because you don't have that much. It maxes the -Xmx thing mostly useless. [03:30]
surial -Xms on the other hand and now you get an instant on VM boot fatal error: Nope, that kinda memory just isn't available. [03:30]
freeone3000 (it's still helpful for non-server apps because the formula is pretty broken on modern computers - it assumes that 30% of RAM is a "reasonable value"!) [03:30]
kupi [kupi!uid212005@gateway/web/] has joined ##java [03:30]
surial if you don't have 4GB to spare, great. Go with -Xms3g -Xmx3g. [03:30]
Lightsword travis apparently has 7GB memory [03:31]
freeone3000 perfect. [03:31]
kupi hi [03:33]
kupi anyone knows how to use java.sql.Types with jdbi? [03:33]
cheeser anyone [03:33]
cheeser Chances are someone has, so why not just ask your question and save some time? If someone knows the answer and wants/has time to help, perhaps they will. [03:33]
Lightsword hmm, didn't help [03:35]
Lightsword Lightsword's title: "Travis CI - Test and Deploy with Confidence" [03:35]
surial Lightsword: I did help. We just eliminated 'the OS itself didn't have 4GB to spare' as a cause. [03:36]
cheeser do they run locally? [03:36]
surial Lightsword: which was also a variable between that system and your hardware. [03:36]
Lightsword yeah, never had any memory errors locally [03:36]
surial Lightsword: So now that you have eliminated it, run it on your box, and use -mx2G -ms2G [03:36]
Lightsword surial, instead of -Xmx4G -Xms4G or in addition to? [03:37]
Lightsword I'm doing this locally: [03:44]
Lightsword JAVA_OPTS="-mx2G -ms2G" ./gradlew jpos:assemble jpos:check --info [03:44]
freeone3000 The first X is not optional. [03:45]
Lightsword so I should be doing this right?: [03:46]
Lightsword JAVA_OPTS="-Xmx4G -Xms4G" ./gradlew jpos:assemble jpos:check --info [03:46]
sbeex [sbeex!51ddef9a@gateway/web/cgi-irc/] has joined ##java [03:46]
IRCNew [IRCNew!] has joined ##java [03:46]
Lightsword oh, and sometimes travis errors with "Exception in thread "pool-1-thread-1" java.lang.OutOfMemoryError: Java heap space" [03:47]
IRCNew I'm running into my first CORS problem with tomcat. Basically I'm writing JS to access my tomcat server which the tomcat [03:48]
IRCNew docs state to put filters in. which I have put into the web.xml but that is not working [03:49]
sbeex I work on a project with a backend which in one part consume data from kafka (broker) and produce/consume data from a REST api too. The problem is now that I have many many many logs messages like its spamming the console... I think to splitting the logs into one log for http.log (api) and one for (kafka.log) but as a second idea I think about havi [03:49]
sbeex ng error logs appening and then warn logs too in their own files and info (rotating overriding) that way it do not grow over time... is it a good pratice? do you have other solutions to suggest? links ? [03:49]
MR-D05 [MR-D05!~textual@] has joined ##java [03:49]
MR-D05 If i remove the overridden hashCode function here I get false. Where does that function get called? [03:50]
dreamreal Set.add() [03:50]
dreamreal and Set.contains() [03:51]
dreamreal MR-D05: basically, you need both equals() and hashCode() [03:51]
MR-D05 just by instantiating the object? [03:51]
dreamreal no [03:51]
dreamreal add() uses hashcode to detect presence, contains() does too [03:51]
MR-D05 ah [03:51]
dreamreal line 41 doesn't find one, so it gets added... but line 42 tried to find one by hashcode and fails [03:52]
ericek111 [ericek111!] has joined ##java [03:52]
sbeex hi dreamreal ! what a long time I havent "seen" you [03:54]
dreamreal this is almost surely incorrect. and in any event it's irrelevant. [03:54]
dreamreal you just haven't NOTICED me. [03:56]
sbeex ) [03:56]
sbeex glad to see you are fine [03:56]
MR-D05 so with both overridden functions line 41 doesn't find it and adds it, then line 42 is able to see what line 41 did [03:59]
dreamreal MR-D05: errr.... not quite, but sort of [03:59]
MR-D05 ok [03:59]
dreamreal basically, line 42 says "let me look for the element based on where it SHOULD be, using hashCode() to find that" [03:59]
dreamreal "it's not there? Then nope, this set doesn't contain it." Therefore, if you don't have a consistent hashCode(), contains() won't do what you expect it to. [04:00]
dreamreal if it finds an object at the right hash, it will THEN call equals() to make sure it's the right object (as hashcodes might not be unique, or elements might be slotted in the same bucket even with different hashcodes.) [04:01]
MR-D05 ok [04:02]
MR-D05 if i don't override hashCode, then can I cast Circle to an Object and have this work [04:03]
dreamreal try it and see. [04:03]
RedSoxFan07 [RedSoxFan07!] has joined ##java [04:03]
dreamreal (and then go look up what casting does in Java: it does NOT convert.) [04:04]
snickers [snickers!~textual@] has joined ##java [04:05]
MR-D05 yeah I tried this [04:11]
MR-D05 got false [04:11]
freeone3000 sbeex: Log ingestion shouldn't be done manually by humans! You need to identify what you actually want out of your logs, then log specifically those metrics to an ingestion service. [04:11]
freeone3000 console logging is for, like, debugging when you can't be bothered to attach a debugger. [04:11]
sbeex well when you do 3rd level support its usually not possible to debug so having valuable logs helps [04:11]
sbeex freeone3000 do you know some open source loggers ingestion services ? [04:12]
dreamreal elk [04:12]
dreamreal dreamreal, what does that even *mean*? [04:12]
dreamreal hmm [04:12]
sbeex kibana ? [04:12]
dreamreal elasticsearch, logstash, kibana stack [04:12]
sbeex okay [04:13]
sbeex but in order to use it in an efficient manner I would have to have kind of a UUID [04:13]
sbeex for each transactions rights? [04:13]
sbeex otherwise I will just have a... big fat logs reader [04:13]
sbeex which mix all my components logs together [04:13]
freeone3000 you need to pare down what you actually log first [04:13]
freeone3000 like, what are you looking for? [04:14]
jamiejackson [jamiejackson!d03a471f@gateway/web/cgi-irc/] has joined ##java [04:14]
sbeex we have multiple logs [04:14]
sbeex some are audit ones [04:14]
sbeex some are errors and warnings errors need human intervention [04:14]
sbeex warn need dev team attention [04:14]
MrRothstein MR-D05 what were you hoping the cast would do? [04:15]
MrRothstein how bad is it to implement a prometheus counter metric without instrumenting the code, but instead get a count out of db between last scrape and now? [04:16]
MrRothstein they're not answering on the prometheus channel... i'm looking for a spring boot exporter example where it's not part of the app itself... [04:17]
MrRothstein since spring boot is java, this is a java question... right? [04:19]
z147 [z147!~z147@gateway/tor-sasl/z147] has joined ##java [04:20]
MR-D05 MrRothstein I was hoping it would implement Object's hashCode and equals functions [04:21]
dreamreal MR-D05: casting objects does not change the type of the object at all. [04:21]
MR-D05 ok [04:21]
dreamreal String foo="bar"; Object o=(Object)foo; // o still points to an object of type String [04:21]
MrRothstein source [04:22]
MrRothstein MrRothstein, what does that even *mean*? [04:22]
dreamreal Even if it used Object.hashCode() it wouldn't do what you expected, unless you were expecting it to still give you "false" [04:22]
dreamreal MrRothstein: is there a ... problem creating hashCode()? [04:23]
dreamreal sorry, MR-D05 [04:23]
kgrimes2 [kgrimes2!] has joined ##java [04:23]
MrRothstein MR-D05 but what are you hoping to accomplish? you can get Object implementations of equals and hashCode by commenting both out of your class [04:24]
dreamreal but they're not likely to be what you want, they're not intrinsically useful [04:24]
Sheilong [Sheilong!uid293653@gateway/web/] has joined ##java [04:25]
MR-D05 so the return of Object's hashCode is not particularly useful [04:25]
dansan [dansan!] has joined ##java [04:25]
dreamreal nor is Object.equals() particularly useful. Again: what are you trying to accomplish? [04:25]
MR-D05 I want to understand why it is necessary to override these functions [04:26]
MrRothstein not particularly... but i think it's more useful than a broken implementation of those methods [04:26]
MrRothstein MR-D05 it will help if you look into how hashsets work [04:27]
dreamreal MR-D05: it's necessary only if you are checking equality or using hashing algorithms in the standard lib [04:27]
bluezone [bluezone!uid104970@gateway/web/] has joined ##java [04:27]
paddyez [paddyez!~paddyez@wikipedia/paddyez] has joined ##java [04:29]
jesmon [jesmon!~user@] has joined ##java [04:37]
freeone3000 'cause there's no better way of checking identity than identity available to Object. [04:38]
MrRothstein82 [MrRothstein82!] has joined ##java [04:38]
MrRothstein13 [MrRothstein13!a1457a0e@] has joined ##java [04:39]
MrRothstein [MrRothstein!a1457a0e@] has joined ##java [04:41]
waz [waz!~waz@pdpc/supporter/active/waz] has joined ##java [04:44]
immibis [immibis!] has joined ##java [04:46]
g00s [g00s!~g00s@unaffiliated/g00s] has joined ##java [04:48]
kgrimes2 [kgrimes2!] has joined ##java [04:49]
hassoon [hassoon!hassoon@gateway/shell/firrre/x-nnmrbdhmbtuyvsoo] has joined ##java [04:50]
progart [progart!~kamee@] has joined ##java [05:16]
noodlepie [noodlepie!~phillip@] has joined ##java [05:22]
conan [conan!] has joined ##java [05:49]
ranbox2d [ranbox2d!a0b18213@] has joined ##java [05:53]
VegetarianFalcon [VegetarianFalcon!uid258908@gateway/web/] has joined ##java [05:53]
g00s [g00s!~g00s@unaffiliated/g00s] has joined ##java [05:54]
javango [javango!~javango@] has joined ##java [05:56]
ranbox2d hi, i was just curious if there was a better way to achieve what i'm doing here : [05:58]
dreamreal what are you trying to achieve there? [05:58]
ranbox2d i have a 2d array, i'm just trying to filter out zero values, and create a new uneven array with only indices [05:59]
dreamreal why are you creating a raw type in line 9 [05:59]
Maldivia dreamreal: it's not raw, there is <> there [05:59]
dreamreal and I dunno, it looks like it should work [05:59]
ranbox2d well, it's an arraylist of arraylists [05:59]
ranbox2d yes yes it works [05:59]
dreamreal Maldivia: bleagh you know what I mean [05:59]
ranbox2d i was really just curious, i'm not the most knowledgable person in java [06:00]
Maldivia ranbox2d: to answer your question: Yes [06:00]
ranbox2d is there a better/cleaner/idk way to achieve this? [06:00]
ranbox2d well, can i have any hints on where to look to do so? :) [06:01]
Maldivia ranbox2d: so you just need to count the number of non-zero values in each array? [06:01]
ranbox2d yes [06:01]
Maldivia and getTimeMatrix is an int[][] ? [06:01]
ranbox2d i mean, not just count them i guess, i do need that output the way it looks like [06:01]
ranbox2d yep [06:02]
Maldivia well, the output seems weird -- I would have expected the output to be [[0,1,3],[0,3],[0,1,2,3]] [06:02]
ranbox2d no, it doesn't care about which indices [06:02]
Maldivia then why have the array at all, and not just count the number of non-zero values? [06:03]
ranbox2d i need the output to look that way because later i need to run a few permutations on it [06:03]
Maldivia it could be "one-lined" if you really wanted :D [06:03]
ranbox2d i mean, by all means, as long as it's more efficient because it just ticked me the wrong way that i have to use an arraylist, declare new empty one every top loop, etc.. [06:04]
Maldivia [06:07]
ricky_clarkson That's not likely to be more efficient, and it seems to lose the original non-zero data. [06:09]
knited [knited!~knited@unaffiliated/knited] has joined ##java [06:10]
ranbox2d i don't understand what you mean by "lose original non-zero data", my code does that too, i don't need that data in my output [06:11]
ricky_clarkson I see, I thought you wanted [[1, 0, 10]] to give [[1, 10]], i.e., keep the non-zero data. Whoops. [06:12]
Maldivia ranbox2d: well, your code is actually wrong, doens't work for your input :D [06:14]
Maldivia but yes, the Stream version is (of course) slower [06:15]
led_dark_1 [led_dark_1!~Thunderbi@] has joined ##java [06:17]
ranbox2d i may have reversed lengths in the paste, sorry [06:18]
ranbox2d [06:18]
ranbox2d Streams look like they'd be interesting for doing multiple array manipulations i guess [06:18]
ranbox2d thanks again though :) if there isn't anything stupid inefficient i'm doing i guess i shouldn't worry [06:19]
Maldivia ranbox2d: well, depends what your getTimeMatrix() is doing [06:20]
Maldivia if it's returning a field or if it's generating it anew, or [06:20]
ranbox2d i thought about caching that too i guess [06:20]
ranbox2d it's returning a private field from another class [06:20]
freeone3000 I can't help but think of this as a numerical matrix operation. [06:20]
iamNOTadog [iamNOTadog!~nicey@2804:7f4:c780:9aa:8fa2:f686:d5eb:bf41] has joined ##java [06:20]
Maldivia ranbox2d: <-- this one is about 25% faster than yours in a micro benchmark :D [06:22]
Maldivia basically the same code, just removing some unnecessary things :) [06:23]
Maldivia basically keeping the reference to the arrays and the lists etc [06:24]
ranbox2d that's true, foreach is also probably a lot better than [i][j] every time [06:25]
ranbox2d thanks a lot [06:26]
Maldivia well, it also removed the assumption that the inner arrays are all of the same length [06:27]
Diablo-D3 [Diablo-D3!] has joined ##java [06:27]
Maldivia the JIT is a LOT better at optimizing code that uses enhanced for loop over an array, or something that explicitly checks against the length of the array, than one that uses a constant of field [06:29]
Maldivia because it can detect the array.length call, and by doing so, it knows that there can never be array index out of bounds, so it can remove all those checks [06:29]
Maldivia in your case - int jb = state.getTimeMatrix()[0].length; -- the JIT cannot verify that jb is actually the length of all the arrays, thus it needs to do index-out-of-bounds checks for everything [06:30]
ranbox2d hmmm, i did that because i thought caching those 2 values would be better than .getTimeMatrix() every loop [06:32]
ranbox2d i believe what you're saying though, makes a bit more sense i guess [06:33]
dreamreal ranbox2d: optimize when you need to. Get the code working first. [06:33]
Maldivia ranbox2d: well, YOU know that your array is all of the same length... the JIT doesn't [06:33]
Maldivia and trying to optimize based on your knowledge can sometimes lead to slower code, because the JIT is not equipped to make the same conclusions :D [06:34]
ranbox2d @dreamreal : i know premature optimization way too well :D but i was just trying to ask once about anything obvious about just this snippet, made me itch too much [06:35]
ranbox2d @Maldivia : yeah noted, i'll start considering this in the future [06:36]
Maldivia ranbox2d: a quick JMH benchmark -- your code: "237,860 10,099 ns/op" with my changes: "166,018 5,156 ns/op" [06:36]
Maldivia if in doubt, profile, benchmark, etc :D [06:37]
dreamreal ranbox2d: *nod* [06:37]
Diablo-D3 [Diablo-D3!] has joined ##java [06:37]
ranbox2d i'm forced to pull out the profilers and benchmarks once i'm done anyways, "for research" and whatnot, so for now it's just by eye [06:39]
mib_mib [mib_mib!] has joined ##java [06:44]
impermanence [impermanence!c01c0125@gateway/web/cgi-irc/] has joined ##java [06:45]
mib_mib hi all - i have a data structure like: List<? extends Collection<MyObject>> listOfMyObjects = ....; now, i am trying to do listOfMyObjects.set(0, new ArrayList<MyObject>()); however, this doesn't work, since it says that the ArrayList isn't of type ? extends Collection<MyObject>; how can i i achieve this? [06:45]
iamNOTadog parted the channel: [06:46]
Maldivia mib_mib: List<? extends X> basically makes your list readonly [06:47]
Maldivia List<Collection<MyObject>> should work fine though, if that's what you really want [06:47]
mib_mib i thought it would, but i had a method that took List<Collection<MyObject>> as a parameter, yet i couldn't pass it a List<ArrayList<MyObject>> [06:48]
Maldivia correct [06:49]
mib_mib which i thought was odd since of course it implements the collection interface [06:49]
mib_mib why is that then? [06:49]
Maldivia if you could assign a List<List> to a List<Collection> -- what's from stopping you to add a Set to the list? [06:49]
mib_mib right you are just saying that they all need to be the same type of collection? [06:50]
mib_mib or? [06:50]
Maldivia you can assign a List<List> to a List<? extends Collection>, but as you've figured out, then it's basically read-only [06:50]
mib_mib inotherwords, i need to do something like Collection myCollection = new ArrayList(); ? [06:50]
mib_mib and then use that? [06:51]
mib_mib Maldivia what do you mean by 'basically' [06:51]
Maldivia you can still add null, but nothing else [06:51]
Maldivia and can also remove by index [06:51]
mib_mib i guess i can edit the underlying objects as well [06:51]
mib_mib the underlying collection, that is probably easier then i suppose [06:52]
mib_mib but its just not going to be as performant [06:52]
Maldivia what are you trying to do? [06:52]
mib_mib just remove elements from an arraylist is all [06:53]
mib_mib or, rathre, remove elements depending on the underlying collection [06:53]
Maldivia but why have a List of different Collection types to begin with? [06:53]
mib_mib anyway - generics are pretty confusing isuppose [06:53]
mib_mib oh - well, there is the possibility to pass in different types (set, list, etc) [06:54]
ranbox2d [ranbox2d!a0b18213@] has joined ##java [06:54]
mib_mib frankly it just saves a lot of verbosity [06:55]
cixx [cixx!~user@] has joined ##java [06:56]
cixx hi. [06:56]
wreed [wreed!~wreed@2603:3024:1c0d:5500:488e:33f5:4bf9:26be] has joined ##java [06:56]
cixx i have a jar and 2 .so files to connect a system. these are dependent each other and they should be in same folder [06:57]
cixx i want to install these to my local maven repo and i do for just one jar file [06:57]
cixx but how can i install all of them as package or group? [06:57]
Maldivia mib_mib: is there any other things you need to do in that method, besides adding new empty entries of the correct type? [07:00]
mib_mib Maldivia basically, i need to edit the underlying collections, removing elements. I could get those collections i suppose, and use removeIf(....) but removeIf is slow(er) I beleive than .stream().filter().collect() and then reassigning [07:01]
mib_mib this is across a large amount of objects [07:01]
Maldivia well, how do you know what to collect ot? [07:02]
Maldivia to* [07:02]
mib_mib collecting to a list is sufficient [07:02]
mib_mib it just needs to be any iterable [07:02]
Maldivia and what if your input is a List<Set<Foo>> [07:02]
mib_mib converting it to a list is fine [07:03]
Maldivia how is that fine, if you want to add it back to the List [07:03]
mib_mib right - thats the issue, but i guess this isn't supported [07:04]
Maldivia it can be though [07:04]
mib_mib i'd like to have a list of general things that can be iterated [07:04]
orbyt_ [orbyt_!~orbyt@] has joined ##java [07:04]
mib_mib i thought List<Collection> was the way, but then it turned into List<? extends Collection> [07:04]
Maldivia if you add a 2nd argument to your method that takes a supplier on how to create the colelction type, it can work [07:05]
mib_mib and now i'm not quite sure [07:05]
unleaded [unleaded!~digiberk@unaffiliated/digiberk] has joined ##java [07:05]
mib_mib Maldivia example? [07:05]
Maldivia mib_mib: [07:06]
mib_mib Maldivia ah interesting! i see this now [07:08]
mib_mib i did see this link that seems similar: [07:08]
mib_mib mib_mib's title: "Generic Methods (The Java Tutorials > Bonus > Generics)" [07:08]
mib_mib but wasn't sure the best way to apply it [07:08]
mib_mib seems like you've figured it out, thanks! [07:08]
mattfly parted the channel: [07:11]
waz [waz!~waz@pdpc/supporter/active/waz] has joined ##java [07:14]
Maldivia mib_mib: that being said, I would expect removeIf to be faster [07:14]
Maldivia ArrayList.removeIf is highly optimized [07:19]
progart [progart!~kamee@] has joined ##java [07:23]
cixx [cixx!~user@] has joined ##java [07:25]
waz [waz!~waz@pdpc/supporter/active/waz] has joined ##java [07:25]
waz [waz!~waz@pdpc/supporter/active/waz] has joined ##java [07:28]
LunarJetman2 [LunarJetman2!LunarJetma@] has joined ##java [07:35]
waz [waz!~waz@pdpc/supporter/active/waz] has joined ##java [07:44]
dansan [dansan!] has joined ##java [07:45]
Diablo-D3 [Diablo-D3!] has joined ##java [07:54]
AugustusCaesar24 [AugustusCaesar24!] has joined ##java [07:56]
sb35 [sb35!~sb35@] has joined ##java [08:11]
jdfthetech [jdfthetech!] has joined ##java [08:23]
waz [waz!~waz@pdpc/supporter/active/waz] has joined ##java [08:28]
RazielZ [RazielZ!~Raziel@unaffiliated/raziel] has joined ##java [08:29]
RedSoxFan07 [RedSoxFan07!] has joined ##java [08:30]
javango [javango!~javango@] has joined ##java [08:30]
yawkat [yawkat!] has joined ##java [08:31]
Diablo-D3 [Diablo-D3!] has joined ##java [08:32]
iam730 [iam730!~iam730@] has joined ##java [08:39]
waz [waz!~waz@pdpc/supporter/active/waz] has joined ##java [08:41]
DiabloD3 [DiabloD3!] has joined ##java [08:43]
TimeTrap [TimeTrap!~TimeTrap@2601:44:c280:def:1c56:3171:42b6:d972] has joined ##java [08:59]
db [db!uid18678@gateway/web/] has joined ##java [09:02]
jusss [jusss!~user@unaffiliated/jusss] has joined ##java [09:02]
realtime_ [realtime_!~sabbath@unaffiliated/realtime] has joined ##java [09:05]
abf_ [abf_!~abf@2601:404:c101:234::a1e9] has joined ##java [09:09]
lucid-lullaby [lucid-lullaby!~lucid-lul@] has joined ##java [09:11]
impermanence [impermanence!c01c0140@gateway/web/cgi-irc/] has joined ##java [09:20]
dj_pi [dj_pi!] has joined ##java [09:22]
Jantz [Jantz!] has joined ##java [09:31]
waz [waz!~waz@pdpc/supporter/active/waz] has joined ##java [09:31]
ldiamond [ldiamond!~ldiamond@unaffiliated/ldiamond] has joined ##java [09:36]
ldiamond I got 3 jps processes taking 100% each [09:36]
ldiamond not sure what jps does and why it's taking all that cpu [09:37]
buttsanchez [buttsanchez!] has joined ##java [09:48]
cheeser google java jps [09:55]
cheeser ldiamond, [09:55]
ldiamond Well, sure it shows java processes [09:56]
ldiamond but since when does that take 100% of my cpu? [09:56]
cheeser \_(?)_/ [09:56]
kgrimes2 [kgrimes2!] has joined ##java [09:57]
ldiamond I just killed them but still, wtf [09:57]
ldiamond mining bitcoins on my servers for oracle? [09:57]
cheeser yes. that's probably it. *facepalm* [09:58]
t2mkn [t2mkn!~t2mkn@] has joined ##java [10:05]
sl33k [sl33k!] has joined ##java [10:13]
sl33k [sl33k!] has joined ##java [10:15]
mohsen_1 [mohsen_1!uid289573@gateway/web/] has joined ##java [10:15]
rwheadon [rwheadon!] has joined ##java [10:18]
Sasazuka [Sasazuka!~Sasazuka@unaffiliated/sasazuka] has joined ##java [10:18]
AugustusCaesar24 [AugustusCaesar24!] has joined ##java [10:23]
tasse [tasse!] has joined ##java [10:28]
Kol [Kol!] has joined ##java [10:30]
LSCody [LSCody!] has joined ##java [10:32]
thanatos [thanatos!] has joined ##java [10:41]
hypc [hypc!~Thunderbi@] has joined ##java [10:48]
CombatVet [CombatVet!~c4@gateway/tor-sasl/combatvet] has joined ##java [10:49]
DCTWD [DCTWD!] has joined ##java [10:50]
tomboy64 [tomboy64!~tomboy64@gateway/tor-sasl/tomboy64] has joined ##java [10:50]
NorthwestVegan [NorthwestVegan!~Northwest@gateway/tor-sasl/northwestvegan] has joined ##java [10:56]
VegetarianFalcon [VegetarianFalcon!uid258908@gateway/web/] has joined ##java [11:00]
Goplat [Goplat!~Goplat@reactos/developer/Goplat] has joined ##java [11:05]
p[a]ddy [p[a]ddy!~paddyez@wikipedia/paddyez] has joined ##java [11:08]
impermanence [impermanence!c01c012f@gateway/web/cgi-irc/] has joined ##java [11:09]
ZDisorder [ZDisorder!~shiranpur@unaffiliated/shiranpuri] has joined ##java [11:26]
marklite [marklite!] has joined ##java [11:26]
Diablo-D3 [Diablo-D3!] has joined ##java [11:30]
kgrimes2 [kgrimes2!] has joined ##java [11:31]
zeden [zeden!~user@unaffiliated/zeden] has joined ##java [11:34]
buttsanchez [buttsanchez!] has joined ##java [11:37]
forgottenone [forgottenone!~forgotten@] has joined ##java [11:37]
Jantz [Jantz!] has joined ##java [11:44]
sbalmos [sbalmos!~sbalmos@2605:a000:1304:8078:6d40:43c2:61fd:7eaa] has joined ##java [11:48]
vbgunz [vbgunz!] has joined ##java [11:48]
fstd_ [fstd_!~fstd@unaffiliated/fisted] has joined ##java [11:53]
Jantz [Jantz!~IceChat9@2407:7000:8d04:100:61fd:1770:94ac:d6d4] has joined ##java [11:57]
veegee [veegee!] has joined ##java [11:59]