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

« 2021-01-12


2021-01-14 »

Nick Message Date
hypc1 [hypc1!~Thunderbi@] has joined ##java [12:06]
ScrambledRK [ScrambledRK!] has joined ##java [12:24]
zalt_ [zalt_!~devp@unaffiliated/lambda443] has joined ##java [12:38]
dendazen [dendazen!] has joined ##java [12:50]
dendazen [dendazen!] has joined ##java [12:51]
hypc [hypc!~Thunderbi@] has joined ##java [01:52]
Hanii [Hanii!~Hanii@2a00:23c5:c587:6d00:855d:7164:3ab5:4084] has joined ##java [01:52]
lithium [lithium!~lithium@unaffiliated/lithium] has joined ##java [01:53]
code2be [code2be!~code2be@] has joined ##java [02:16]
hypc [hypc!~Thunderbi@] has joined ##java [02:20]
KidBeta [KidBeta!~Kidbeta@hpavc/kidbeta] has joined ##java [02:20]
ADG1089__ [ADG1089__!~aditya@] has joined ##java [03:07]
bosaap [bosaap!] has joined ##java [03:08]
r3m1 [r3m1!~r3m1@] has joined ##java [03:08]
cluelessperson [cluelessperson!~cluelessp@unaffiliated/cluelessperson] has joined ##java [03:15]
LKoen [LKoen!] has joined ##java [03:17]
black_ant [black_ant!~antilope@unaffiliated/black-ant/x-1505394] has joined ##java [03:22]
bosaap [bosaap!] has joined ##java [03:26]
Matthijs [Matthijs!~quassel@unaffiliated/matthijs] has joined ##java [03:26]
[twisti] dreamreal: "introducing" in 2019 seems like an odd choice [03:36]
yawkat [yawkat!] has joined ##java [03:43]
nopf [nopf!] has joined ##java [04:04]
sa02irc [sa02irc!] has joined ##java [04:20]
bolovanos__ [bolovanos__!] has joined ##java [04:27]
sagax [sagax!~sagax_nb@] has joined ##java [04:42]
r3m1 [r3m1!] has joined ##java [04:55]
SirMangler [SirMangler!] has joined ##java [05:04]
mbooth When is Java 16 out? [05:16]
shicks255 [shicks255!] has joined ##java [05:16]
mbooth Ah, the ides of March [05:17]
mbooth ish [05:17]
acidjnk_new [acidjnk_new!] has joined ##java [05:19]
ge0rgios [ge0rgios!~george@unaffiliated/anaphaxeton] has joined ##java [05:26]
georgi0s [georgi0s!~george@unaffiliated/anaphaxeton] has joined ##java [05:29]
bolt [bolt!~r00t@unaffiliated/bolt] has joined ##java [05:29]
SirMangler [SirMangler!] has joined ##java [05:45]
zikani03 [zikani03!~zikani03@] has joined ##java [05:46]
zikani03 parted the channel: [05:49]
SerialSmile [SerialSmile!] has joined ##java [06:04]
xekz [xekz!~kexmex@unaffiliated/kexmex] has joined ##java [06:05]
Maldivia mbooth: yeah, mid march [06:24]
Maldivia mbooth: 3rd Tuesdays of March and September are the release dates for new Java versions [06:24]
ib07 [ib07!] has joined ##java [06:27]
Devastator morning [06:31]
zeden [zeden!~user@unaffiliated/zeden] has joined ##java [06:37]
deebo slightly off topic, but any suggestions for some tool to schedule g eneric events in the thousands in advance? i have a lot of $timestasmp.json that i want to send to a service at $timestamp relative to now(), basically i fetched a lot of query data from our logging system and want to mirror it to a test environment [06:51]
Intrepd [Intrepd!] has joined ##java [06:51]
deebo the rate might go into tens/sec so some sort of polling mechanism might not get enough work time between polls [06:52]
deebo or it would change the traffic shape to a bursty one [06:52]
mbooth quartz [06:52]
mbooth mbooth, quartz is An open source job scheduling system. Jobs can be defined as standard Java components or EJBs. You can find more info at or see for a core java solution. [06:52]
mbooth Maybe? [06:52]
Maldivia deebo: so like capture/replay kind of things? [06:53]
deebo yeah, everything was captured in logstash, i downloaded necessary data from logstash for a period of an hour, and now thinking how to replay the data to another environment reliably without changing the shape of the traffic [06:54]
archer121 [archer121!3d02799f@] has joined ##java [06:57]
plarsen [plarsen!~plarsen@redhat/jboss/pdpc.professional.plarsen] has joined ##java [06:57]
mf7 [mf7!~user@2a02:c7f:ac01:7400:5d41:3b23:b21d:dba3] has joined ##java [07:01]
dreamreal [twisti]: well, ##java gets people who've never used maven, so maybe it's intended to "introduce" readers to the project? [07:05]
dreamreal I mean, they couldn't title it "why don't you already know about maven, you moron"? [07:06]
archer121 We are using SLF4J+Logback, and have set a marker on certain log lines. I want to run a function for each of the log lines which had the marker. From my research I will have to write a custom appender and use the Turbo MarkerFilter to do this. Or is there a better way? [07:06]
archer121 I want to send a custom event to newrelic on such loglines. [07:07]
archer121 but wondering if an "appender" is the right way to go.. :thinking: [07:08]
dreamreal What's the marker? [07:12]
rwheadon [rwheadon!] has joined ##java [07:12]
[twisti] dreamreal: fair enough [07:13]
LKoen [LKoen!] has joined ##java [07:15]
somazero [somazero!] has joined ##java [07:19]
di0_ [di0_!~di0_@unaffiliated/di0-/x-5053590] has joined ##java [07:22]
Peste_Bubonica [Peste_Bubonica!~Peste_Bub@unaffiliated/peste-bubonica/x-4612396] has joined ##java [07:25]
Maldivia archer121: why not just add the newrelic appender? [07:27]
Lope [Lope!~lope@] has joined ##java [07:28]
Lope Bad installation: JAVAWS_HOME not set: No such file or directory [07:28]
Lope Any ideas? [07:28]
[twisti] set JAVAWS_HOME [07:29]
[twisti] next [07:29]
[twisti] Another satisfied customer. Next! [07:29]
Maldivia Lope: JAVAWS_HOME env is not set [07:29]
Maldivia webstart [07:29]
Maldivia JNLP is the "Java Network Launching Protocol", a web-based java app deployment mechanism. It allows apps to run with a normal entry point (i.e., "main()"). See for an overview. Please note that it is no longer supported by Oracle and has been removed by jdk 11. If you still need it see [07:29]
Lope [twisti], Maldivia: Running linux. I tried `export JAVAWS_HOME=/path/to/jre1.8.0_271` [07:30]
Lope I also tried `export JAVAWS_HOME=/path/to/jre1.8.0_271/bin` [07:30]
Klinda [Klinda!~klinda@] has joined ##java [07:30]
Lope I also tried `export JAVAWS_HOME=/path/to/jre1.8.0_271/bin/javaws` [07:30]
Lope Same message for all cases [07:30]
Maldivia Lope: remember, export applies to THAT session (and child sessions), so if you open a console and writes that, and then assumes it will work in a browser, that's not the case [07:31]
Lope Maldivia, oh, I see. how can I resolve that? [07:32]
dreamreal put it in your profile or shell rc [07:32]
[twisti] you can configure it in your profile, but that really depends more on your specific os/variant [07:32]
Maldivia well, usually you have a way to set "global" envs in your profile etc [07:32]
Lope dreamreal, what should the path be? [07:32]
[twisti] so #whateverlinuxdistroyouareusing [07:32]
Lope (which of the above) ? [07:32]
Maldivia path should be the first of the 3 [07:32]
Lope okay thanks [07:33]
Maldivia but really, consider not using javaws :D [07:33]
archer121 Maldivia: For now we don't want to send the entire logs [07:38]
archer121 We already have ELK for logging [07:38]
Maldivia archer121: add the newrelic rependency, add it as an appender, add a filter to that appender, check the logging context if it should be added to newrelic or not? [07:38]
archer121 Awesome idea! [07:39]
archer121 but wait.. this would get sent to logs I guess. Can I create dashboards on top of them like with events? [07:40]
Maldivia so the newrelic log lines you ONLY want in newrelic, and nothing else? [07:40]
archer121 I want to create a dashboard with events that has this particular marker. [07:42]
Maldivia well, that's I assume is a config issue in the newrelic UI [07:42]
archer121 I have not worked on newrelic much, but I could try what you suggested [07:43]
Maldivia <appender ....><encoder class="com.newrelic.logging.logback.NewRelicEncoder"/><filter class="com.test.NewRelicFilter" />.... public class NewRelicFilterextends Filter<ILoggingEvent> { public FilterReply decide(ILoggingEvent event) { if (event.getMessage().contains(MARKER)) return FilterReply.ACCEPT; else return FilterReply.DENY; } } [07:44]
Treefingers [Treefingers!] has joined ##java [07:44]
Maldivia heck, you can even add it directly in the config file if you don't want to make a class for it, considering it's a single one-liner [07:45]
Maldivia <filter class="...EvaluatorFilter"><evaluator><expression>event.getMessage().contains("MARKER")</expression></.... [07:46]
ottoshmidt [ottoshmidt!~ottoshmid@] has joined ##java [07:46]
SirMangler [SirMangler!] has joined ##java [07:51]
Maldivia mbooth: actually, your Java 16 question reminded me, that next week is CPU week [07:56]
archer121 Maldivia thanks, I was checking the docs, sending as logs should work for me [07:56]
sbalmos [sbalmos!] has joined ##java [07:59]
_lucifer [08:01]
_lucifer _lucifer's title: "Denys Makogon: The Best Country for Observing the Northern Lights" [08:01]
_lucifer seems interesting :D [08:02]
Maldivia interesting [08:02]
Maldivia this is all very interesting (not really) but please take it somewhere else. [08:02]
Maldivia D [08:03]
_lucifer its a java talk [08:03]
Maldivia it was a pun on your "seems interesting" :D [08:03]
_lucifer oh ok :) [08:04]
Maldivia also hint -- don't just paste a link without some context, at least if you want people to be interested [08:05]
_lucifer right, thanks! [08:05]
_lucifer its about using java for building data analysis pipelines and a fun experiment [08:06]
bosaap [bosaap!~SimonInHo@2001:1c02:b12:9a00:f0a1:172c:9d30:6705] has joined ##java [08:08]
rzjian [rzjian!~l@] has joined ##java [08:19]
MrFlibble [MrFlibble!Rimmer@] has joined ##java [08:24]
xekz [xekz!~kexmex@unaffiliated/kexmex] has joined ##java [08:31]
dqx [dqx!~dqx@unaffiliated/dqx] has joined ##java [08:39]
dendazen [dendazen!] has joined ##java [08:45]
ADG1089__ [ADG1089__!~aditya@] has joined ##java [08:46]
wedr [wedr!] has joined ##java [08:51]
Teckla If you call .equals() on an Object[], does it, in turn, call .equals() on each element in the array? [09:04]
dreamreal No. [09:04]
Teckla Poo! OK, thanks, dreamreal [09:05]
cheeser Object[] doesn't declare a .equals() so it uses the default one from Object which is just a reference comparison [09:07]
Sheilong [Sheilong!uid293653@gateway/web/] has joined ##java [09:12]
runlevel7 [runlevel7!runlevel7@gateway/vpn/privateinternetaccess/runlevel7] has joined ##java [09:13]
Teckla Ah ha. Thank you, Sir Cheeser. [09:14]
Teckla I should have just checked the source. [09:14]
Teckla whacks self upside the head. [09:14]
Teckla Negative reinforcement. It works! [09:15]
average [average!uid473595@gateway/web/] has joined ##java [09:15]
Maldivia Teckla: Arrays.equals(ar1, ar2) [09:15]
Maldivia Teckla: there is no source for Object[].equals :) [09:15]
cheeser Maldivia: :D [09:15]
cheeser Teckla: arrays are Objects by fiat not by source. [09:16]
Maldivia (and not the car manufacturer Fiat) [09:17]
acidjnk_new [acidjnk_new!] has joined ##java [09:18]
Teckla Maldivia: Ah, thank you... of course [09:22]
sbalmos The all-new 2021 Fiat Object. The hybrid unicorn fart-electric Suburban Assault Vehicle that will quickly become the Object of your Neighbors' Desires. [09:32]
zikani03 [zikani03!~zikani03@] has joined ##java [09:37]
waz [waz!~waz@pdpc/supporter/active/waz] has joined ##java [09:55]
yuljk [yuljk!~yuljk@unaffiliated/yuljk] has joined ##java [09:59]
dreamreal if it's powered by hot air it'll run forever [10:02]
mvm [mvm!] has joined ##java [10:02]
Maldivia dreamreal: it's fart-electric... so, yes, hot air :D [10:04]
dreamreal farts are temperature-neutral, though [10:04]
[twisti] yesterday i learned that apparently, a common french insult is "you fart higher than your ass" [10:04]
cheeser interesting [10:04]
cheeser this is all very interesting (not really) but please take it somewhere else. [10:04]
Sgeo [Sgeo!] has joined ##java [10:06]
darkstardevx [darkstardevx!~darkstard@2601:1c2:300:c8a0::48c8] has joined ##java [10:07]
Devastator [Devastator!~devas@unaffiliated/devastator] has joined ##java [10:15]
gt [gt!~gt@unaffiliated/gtt] has joined ##java [10:16]
LKoen [LKoen!] has joined ##java [10:23]
ChaiTRex [ChaiTRex!~ChaiTRex@gateway/tor-sasl/chaitrex] has joined ##java [10:32]
retroguy8000 [retroguy8000!~retroguy8@] has joined ##java [10:39]
xekz [xekz!~kexmex@unaffiliated/kexmex] has joined ##java [10:50]
seschwar [seschwar!~seschwar@unaffiliated/seschwar] has joined ##java [10:50]
wordsToLiveBy [wordsToLiveBy!~wordsToLi@unaffiliated/wordstoliveby] has joined ##java [10:55]
fax [fax!~quassel@unaffiliated/fax] has joined ##java [10:57]
hypc [hypc!~Thunderbi@] has joined ##java [11:02]
mirrorbird [mirrorbird!~psutcliff@2a00:801:446:b70b:607:9995:9930:4d27] has joined ##java [11:06]
kicked mirrorbird (Banned: this ban will expire after 180d) [11:06]
wordsToLiveBy [wordsToLiveBy!~wordsToLi@unaffiliated/wordstoliveby] has joined ##java [11:09]
zikani03 parted the channel: [11:10]
AcTiVaTe [AcTiVaTe!] has joined ##java [11:19]
xekz [xekz!~kexmex@unaffiliated/kexmex] has joined ##java [11:31]
wordsToLiveBy [wordsToLiveBy!~wordsToLi@unaffiliated/wordstoliveby] has joined ##java [11:32]
Steeve [Steeve!~steve@unaffiliated/steeve] has joined ##java [11:37]
CombatVet [CombatVet!~c4@gateway/tor-sasl/combatvet] has joined ##java [11:44]
moldorcoder7 [moldorcoder7!~moldorcod@] has joined ##java [11:49]
sphinxo [sphinxo!5118c732@] has joined ##java [11:58]
hnOsmium0001 [hnOsmium0001!uid453710@gateway/web/] has joined ##java [11:59]
sphinxo Is there a cleaner pattern for something like: function(String var0, Optional<String> var1, Optional<String> var2, Optional<Integer> var3, Optional<String> var4) {}? [12:02]
dreamreal Cleaner in what way? [12:02]
sphinxo in the real case there are like 8 different argument ( different optional filters ), any subset, or none at all is allowed [12:03]
sphinxo I understood Optional is more intended as a return type and that it's a bit of a code smell to have it as an argument [12:04]
dreamreal optional [12:04]
dreamreal dreamreal, optional is not something you should actually be using. In the words of the guy who added it: "You should almost never use it as a field of something or a method parameter. I think routinely using it as a return value for getters would definitely be over-use." ( ). For useful ways to deal with nulls and more on why not to use optional, [12:04]
dreamreal that's part of it, sure [12:04]
sphinxo damn, so the consensus of the java freenode irc mods/community is to mostly avoid optional? [12:05]
cheeser yes. the Parameter Object pattern [12:05]
cheeser public void function(String var0, Paramters params) { ... } [12:06]
cheeser function("name", new Parameters().var3(someValue)) [12:06]
sphinxo ok, and Parameters should just have nullable values? [12:07]
sphinxo for the ones that aren't passed [12:07]
cheeser concise signature. succinct invocation. params can be added/removed much more easily. [12:07]
cheeser yep [12:07]
cheeser and just call as many methods on Parameters as neeeded to pass the needed values. [12:07]
black_ant [black_ant!~antilope@unaffiliated/black-ant/x-1505394] has joined ##java [12:08]
TideFN [TideFN!~TideFN@2601:cb:8280:9520:528:3079:bb89:83cc] has joined ##java [12:10]
ADG1089__ [ADG1089__!~aditya@] has joined ##java [12:15]
tomboy64 [tomboy64!~tomboy64@gateway/tor-sasl/tomboy64] has joined ##java [12:16]
wordsToLiveBy [wordsToLiveBy!~wordsToLi@unaffiliated/wordstoliveby] has joined ##java [12:17]
sa02irc [sa02irc!] has joined ##java [12:22]
wordsToLiveBy [wordsToLiveBy!~wordsToLi@unaffiliated/wordstoliveby] has joined ##java [12:25]
xekz [xekz!~kexmex@unaffiliated/kexmex] has joined ##java [12:31]
zikani03 [zikani03!~zikani03@] has joined ##java [12:32]
ricky_clarkson sphinxo: Opinions vary. I prefer Optional over nullable fields. You can't .map or .flatMap a null reference. :) [12:37]
cheeser .filter() :) [12:41]
Jantz [Jantz!] has joined ##java [12:45]
TideFN [TideFN!~TideFN@2601:cb:8280:9520:b1df:3638:5934:bec8] has joined ##java [12:59]
SirMangler [SirMangler!] has joined ##java [01:00]
mindCrime [mindCrime!] has joined ##java [01:01]
led1 [led1!~Thunderbi@] has joined ##java [01:05]
yawkat opinions vary between wrong and right [01:09]
yawkat duh [01:09]
TReK [TReK!~UnFaQ@unaffiliated/trek] has joined ##java [01:09]
dendazen [dendazen!] has joined ##java [01:11]
ricky_clarkson Maybe we agree not to use it in parameters, though sometimes even that is useful. [01:11]
Nightwing52 [Nightwing52!~Thunderbi@] has joined ##java [01:12]
Ingvix [Ingvix!~Ingvix@] has joined ##java [01:15]
Suchorski [Suchorski!~regex@unaffiliated/suchorski] has joined ##java [01:24]
deavmi [deavmi!~tbk@2a04:5b81:2010::33] has joined ##java [01:26]
ChaiTRex [ChaiTRex!~ChaiTRex@gateway/tor-sasl/chaitrex] has joined ##java [01:29]
deavmi [deavmi!~tbk@2a04:5b81:2010::33] has joined ##java [01:38]
Teckla I like to send null for Optional to keep my coworkers guessing. [01:51]
Teckla Keeps them on their toes! [01:51]
ernimril Teckla, if they are using Optional they deserve what they get :-) [01:52]
waz [waz!~waz@pdpc/supporter/active/waz] has joined ##java [01:52]
Teckla chuckles [01:52]
ib07 [ib07!] has joined ##java [02:06]
g00s [g00s!~g00s@unaffiliated/g00s] has joined ##java [02:09]
Hallcyon [Hallcyon!] has joined ##java [02:19]
deavmi [deavmi!~tbk@2a04:5b81:2010::33] has joined ##java [02:34]
mtricht parted the channel: "The Lounge -" [02:36]
ADG1089__ [ADG1089__!~aditya@] has joined ##java [02:41]
zikani03 [zikani03!~zikani03@] has joined ##java [02:41]
deavmi [deavmi!~tbk@2a04:5b81:2010::33] has joined ##java [02:52]
acidjnk_new [acidjnk_new!] has joined ##java [02:53]
zeden [zeden!~user@unaffiliated/zeden] has joined ##java [02:56]
Nightwing53 [Nightwing53!] has joined ##java [02:58]
waz [waz!~waz@pdpc/supporter/active/waz] has joined ##java [03:00]
Nightwing52 [Nightwing52!~Thunderbi@2600:100c:b20a:16ab:15a3:8a35:279f:de8f] has joined ##java [03:01]
xekz [xekz!~kexmex@unaffiliated/kexmex] has joined ##java [03:11]
Jantz [Jantz!~IceChat9@2407:7000:8d04:100:11f1:54cb:68ec:641e] has joined ##java [03:13]
deavmi [deavmi!~tbk@2a04:5b81:2010::33] has joined ##java [03:14]
Nightwing52 [Nightwing52!~Thunderbi@2600:100c:b20a:16ab:15a3:8a35:279f:de8f] has joined ##java [03:24]
deavmi [deavmi!~tbk@2a04:5b81:2010::33] has joined ##java [03:32]
Nightwing52 [Nightwing52!~Thunderbi@2600:100c:b20a:16ab:15a3:8a35:279f:de8f] has joined ##java [03:34]
myke [myke!] has joined ##java [03:36]
xekz [xekz!~kexmex@unaffiliated/kexmex] has joined ##java [03:36]
Aquazi [Aquazi!uid312403@gateway/web/] has joined ##java [03:41]
dec0d3r [dec0d3r!~dec0d3r@2001:8003:4824:7000:c786:e7d2:abcd:40ab] has joined ##java [03:49]
xekz [xekz!~kexmex@unaffiliated/kexmex] has joined ##java [03:52]
deavmi [deavmi!~tbk@2a04:5b81:2010::33] has joined ##java [03:52]
callq [callq!~callq@] has joined ##java [03:54]
xekz [xekz!~kexmex@unaffiliated/kexmex] has joined ##java [03:59]
mindCrime [mindCrime!] has joined ##java [04:02]
deavmi [deavmi!~tbk@2a04:5b81:2010::33] has joined ##java [04:07]
firewyre [firewyre!] has joined ##java [04:13]
justmondris [justmondris!c5fd3b9e@gateway/web/cgi-irc/] has joined ##java [04:13]
justmondris hello, if i convert a long url to a sha256 to get an output like 660b38e15626c00bac24a4de8d59be7574febb1520cca6d3fece93ff4828d711, take the first 5 character and convert it to base 64 [04:15]
justmondris what is the chances of collision [04:16]
justmondris ? [04:16]
justmondris for 1 million records? [04:16]
xekz [xekz!~kexmex@unaffiliated/kexmex] has joined ##java [04:17]
langkid1 [langkid1!~langkid1@2604:180:0:ce:5f69:7263::] has joined ##java [04:18]
deavmi [deavmi!~tbk@2a04:5b81:2010::33] has joined ##java [04:20]
Maldivia 5 chars = 1048576 different combinations .. so for 1 million records, I would say a very very very high chance of collision [04:21]
justmondris what extra step can i take to reduce the chance to 1 or zero [04:23]
justmondris ? [04:23]
justmondris while keeping the charter very short [04:23]
justmondris *character [04:23]
Maldivia rule of thumb, if you have N possible values, you need a hash function with a range of N^2 [04:24]
cheeser Maldivia: where'd that number come from? [04:25]
Maldivia cheeser: birthday attack math [04:25]
cheeser 5^36 is enormous [04:25]
Maldivia cheeser: it's 5^16 -- his sha is hex output [04:25]
cheeser ah! [04:25]
cheeser carry on. :) [04:26]
justmondris Maldivia can your explain this please . you need a hash function with a range of N^2 [04:26]
cheeser even that is 152B [04:27]
justmondris or give an example using my 5character short code [04:27]
justmondris *characters [04:27]
Maldivia cheeser: also, it's 16^5 :D [04:27]
cheeser sighs [04:27]
cheeser goes back to bed. [04:27]
Maldivia justmondris: you have a million values, so that's around 2^20 -- so you need a hash range of 2^40 to "avoid" collision [04:28]
Maldivia 2^40 == 16^10 -- so take the first 10 chars of the sha256, and you should be clear -- ASSUMING the sha256 have an even distribution in those bits [04:30]
justmondris that means any hash algorithm i am using should return a 2^40 characters short code? [04:30]
Maldivia no [04:30]
justmondris can you throw more light on it please? [04:31]
Maldivia if you have 1_000_000 different values, you need a hash function that can return a value between (0 .. 1_000_000_000_000) for it to be mostly safe from collisions [04:32]
Maldivia that number is equivalent to 10 hex chars [04:32]
Maldivia or 7 base64 chars [04:33]
justmondris then the url is no longer short [04:33]
justmondris lolol [04:33]
Maldivia 7 chars is not short? [04:33]
cheeser longer than 5! [04:35]
justmondris let me try to re-explain what you have explained so far to be sure i actually understood what you said [04:35]
Maldivia justmondris: -- example, hashing string of the numbers from "0" to "999999" -- no collisions :D [04:39]
justmondris for 7million records, i need a hashing algo that is capable of generating a range of values from 0 to 7M^2 characters and convert the value to base7 [04:40]
justmondris correct [04:40]
justmondris Maldivia i will check the link out [04:40]
Maldivia as a rule of thumb, yes -- of course, there can always be a collision, no matter how big your range is [04:41]
Maldivia but with N^2, the probability of a random collision is very very very small [04:41]
Maldivia or rather, with N^2, the chance of 1 collision is around 40% [04:42]
Diablo-D3 the birthday problem? [04:44]
Maldivia Diablo-D3: [04:44]
Diablo-D3 no, I was asking if that was what as being discussed [04:44]
Maldivia well, you cannot really talk about hash collision without it :D [04:45]
Diablo-D3 yup, very important concept [04:45]
justmondris the link you pasted, what is does it just take the number, convert it to SHA-256 and take the first 7 characters? [04:47]
justmondris so for 1 millions records there will not be collision right [04:47]
justmondris ? [04:47]
Maldivia for THOSE million records, there were no collisions [04:48]
Diablo-D3 a fun thing to do is finding new ways of finding collisions for the existing dataset [04:48]
Maldivia justmondris: but yes, it took a million input strings (from "0" to "999999"), calculated the sha-256 hash digest for them, converted that to base64, and took the first 7 digits of the base64 result [04:48]
TideFN [TideFN!~TideFN@2601:cb:8280:9520:b8ea:fda6:9bfe:9345] has joined ##java [04:49]
Diablo-D3 biggest mistake ever was popular hash impls not also encoding the length of what was hashed into the result [04:49]
Maldivia justmondris: but as with the birthday problem, there is ALWAYS a change of collision -- unless you have a perfect hash, but that requires you to know all possible inputs ahead of time [04:49]
Maldivia Diablo-D3: no [04:50]
Maldivia Diablo-D3: it's trivial to append that, but it should NOT be part of the hash [04:50]
Diablo-D3 Maldivia: yes, there are certainly many ways around it [04:51]
justmondris Maldivia that means the first 7 characters of the base 64 is always unique [04:51]
justmondris when will this not work? [04:51]
Maldivia justmondris: with my example input it was [04:51]
Maldivia justmondris: there may be other example inputs where it's not [04:51]
Diablo-D3 but hilarious when people hash a file, and then you just "wish for more wishes" by appending garbage to your altered file to rotate the hash back into place [04:51]
justmondris this will only work because you are working with a unique set of numbers [04:52]
justmondris like encoding your integer primary key [04:52]
Nightwing53 [Nightwing53!~Thunderbi@] has joined ##java [04:52]
xekz [xekz!~kexmex@unaffiliated/kexmex] has joined ##java [04:52]
justmondris i am still looking for a way to generate a max of 8 digit unique recharge card code [04:53]
justmondris i want to reduce user's stress of loading the card [04:53]
Maldivia justmondris: there you go, same algorithm and a collision: [04:53]
justmondris lolo for just two input? [04:54]
justmondris lololol [04:54]
Maldivia well, a collision is ALWAYS just two inputs [04:54]
Maldivia it's just a matter of finding the correct ones [04:54]
justmondris so how can i achieve my goal of generating a max of 8digit code [04:55]
justmondris even for one billion records? [04:55]
Maldivia database, hash -- if collision +1 [04:55]
Maldivia or rather, while(collision)+1 [04:56]
justmondris so what you mean now is that i should try and make the unique short code field unique and always try to insert the generated 8digit number. if the db operation returns key already exists, add 1 to the 8 digits number to make it 9 digit number and store that number? [04:58]
justmondris correct? [04:58]
Maldivia generate potential unique code, check if it's seen before, if not, repeat until unseen code was generated [04:59]
Maldivia how you want to do the "repeat until unseen code was generated" part is up to you [05:00]
justmondris i understand your explanation but this will make some request slower than others [05:01]
Maldivia yes [05:01]
Maldivia unique is hard [05:01]
justmondris those requests with collision might take longer time [05:01]
justmondris if you encounter like 10 consecutive collision [05:01]
justmondris thanks for you explanation [05:02]
Maldivia justmondris: btw, why use sha256 for this? you want to try to optimize, so the same url gives the same short-link ? [05:06]
justmondris i want a different link [05:07]
Maldivia so why not random? [05:08]
justmondris you mean generate random values [05:08]
justmondris ? [05:08]
justmondris short link [05:08]
justmondris ? [05:08]
Maldivia instead of geenrating line base64(sha256(url)) -- just do base64(random) [05:09]
Maldivia like* [05:09]
justmondris base64(random) this will generate random short line and i can handle collision based on your explanation [05:10]
justmondris of regenerating if collision exists [05:11]
Maldivia byte[] rnd = new byte[8]; ThreadLocalRandom.current().nextBytes(rnd); return Base64.getEncoder().encodeToString(rnd).substring(0, 7); [05:11]
Maldivia if exists, generate a new one [05:11]
Diablo-D3 [04:55:09] <justmondris> so how can i achieve my goal of generating a max of 8digit code [05:15]
Diablo-D3 you're basically asking for a rainbow table? [05:15]
justmondris yeah i understand you explanation but i think the higher the number of total generated values, the higher the chances of collision [05:16]
justmondris and it might get to a stage where all the possible 8 digit numbers have been generated [05:16]
Diablo-D3 yeah, thats if you want random collisions [05:16]
justmondris Diablo-D3 lolol no i am asking for a solution and not an attack [05:17]
Diablo-D3 in the example of sha256, since its considered a perfect hash, you cannot collide for all inputs of 64 bytes or less [05:17]
Jantz [Jantz!] has joined ##java [05:19]
di0_ [di0_!~di0_@unaffiliated/di0-/x-5053590] has joined ##java [05:20]
justmondris but the problem we are trying to avoid is that the generated sha value is too long [05:21]
justmondris and no substring of it is unique [05:22]
Diablo-D3 then use a shorter hash [05:22]
justmondris like [05:22]
justmondris ? [05:22]
cheeser don't use a sha, then. use a UUID or, say, ObjectId (from MongoDB's bson packages) that generate shorter, unique values. [05:22]
Maldivia justmondris: as said, there is no such thing as a perfect hash for arbitrary input [05:22]
justmondris UUID is also very long for a url shortener [05:23]
Diablo-D3 justmondris: if its shorter then 64 bytes, it isnt even worth hashing it [05:23]
cheeser \_(?)_/ [05:23]
justmondris Maldivia yeah [05:23]
Diablo-D3 just assign unique values numbers [05:23]
justmondris like primary key? [05:23]
Maldivia justmondris: use a counter sho.rt/1 sho.rt/2 sho.rt/3 sho.rt/4 :D [05:23]
Diablo-D3 sha256 itself also can be low to no cost on some cpus, the cost is only storing the resulting value, which is *tiny* [05:23]
cheeser predictable urls-- [05:23]
Maldivia ) [05:23]
justmondris yeah that is the problem [05:23]
Diablo-D3 but yes, there are perfect and semi-perfect hashes that are much shorter, and exist for specialty cases [05:24]
Diablo-D3 also, the concept of a url shortener is considered toxic, so if *thats* what you're doing, dont. [05:24]
justmondris why? [05:25]
Maldivia justmondris: make an algorithm, that takes the counter and returns an unique "unpredictable" output.. [05:25]
Diablo-D3 why? breaks the social contract of the internet. [05:25]
Maldivia scale the algorithm to support the number of inputs you expect in its lifetime [05:25]
Diablo-D3 its a subset of the problem of why the cloud is bad, in several ways [05:26]
justmondris lolol [05:26]
Diablo-D3 Maldivia: at that point he might as well figure out how to use cuckoo hashing to solve this, which aint great either [05:26]
ricky_clarkson Diablo-D3: It depends on the context. Yes, it can be used for rickrolling but services can choose to show a summary of what's on the other end of the shortener. [05:26]
Diablo-D3 ricky_clarkson: thats assuming if you trust the middleman [05:26]
Diablo-D3 which is also a huge issue [05:26]
justmondris hmmmmmmmmm [05:27]
Diablo-D3 even google's shortener, which doesnt exist anymore, was outed for doing shady shit at google's behest [05:27]
svm_invictvs [svm_invictvs!~svm_invic@unaffiliated/svminvictvs/x-938456] has joined ##java [05:27]
Diablo-D3 and now, thanks to being dead, a lot of hyperlinks are fucked, even though what they actually pointed to still exists [05:27]
cheeser [05:28]
cheeser cheeser's title: "Long URL Maker - When tiny URLs aren't enough." [05:28]
Diablo-D3 YES [05:28]
Maldivia justmondris: seriously, take any PRNG, generate a sequence of 10 million numbers between 1100000000 and 68700000000 -- remove duplicates, convert to base64 -- now you have a lookup table from index to unique key, that is 6 chars long, and in unpredictable order... profit [05:29]
Diablo-D3 the only reason to run a shortener today is if you want to be a target to help promote spam, piracy, terrorism, and get the blame for it. [05:30]
Diablo-D3 [05:30]
Diablo-D3 theres even this gem [05:30]
justmondris Maldivia i think that will be slow i.e get the next number in the lookup table, delete it and store the long and short code in another table [05:32]
Diablo-D3 you need to step back and ask yourself what is the actual problem you're having it, and why what you're doing it won't solve it [05:35]
justmondris ok [05:36]
justmondris thanks for that advice [05:36]
Maldivia justmondris: Select newest value from database; seed = value; next = myLCG(value); insert into db value = next; [05:39]
Maldivia (and LCG is a function that, given a seed generates the next "random" value based on it, and has a defined period, so it will not generate the same value twice during that period) [05:40]
justmondris okay thanks [05:41]
justmondris alot [05:41]
Maldivia int myLGC(int i) { return i + 1; } <-- this has a period of 2^32.... but with very predictable outcome :D [05:41]
justmondris Select newest value from database you are selecting a value from the lookup table right [05:41]
justmondris ? [05:41]
Maldivia no, value here would be the number you convert to bas64 to present to the user [05:42]
justmondris ok [05:42]
Maldivia this requires no lookup table, since your function IS the lookup table itself [05:43]
justmondris thanks [05:43]
Maldivia but it needs the previous value to calculate the next value [05:43]
xekz [xekz!~kexmex@unaffiliated/kexmex] has joined ##java [05:43]
justmondris okay i will read more on it [05:43]
justmondris LG function? [05:43]
justmondris is that the name [05:43]
justmondris ? [05:43]
Maldivia [05:44]
justmondris thanks [05:44]
immibis [immibis!~immibis@] has joined ##java [05:48]
cluelessperson [cluelessperson!~cluelessp@unaffiliated/cluelessperson] has joined ##java [06:04]
svm_invictvs Is it possible to re-write an exception stack trace? [06:11]
svm_invictvs (without using reflection) [06:11]
Maldivia sure, we do that all the time... :D [06:13]
svm_invictvs who's we? [06:14]
svm_invictvs lol [06:14]
Maldivia using public API - no, not possible [06:16]
Maldivia using reflection -- sure [06:16]
speerman [speerman!speerman@gateway/vpn/mullvad/speerman] has joined ##java [06:16]
Maldivia using other "hacks" -- sure [06:16]
svm_invictvs Isn't there like ... a call like Runtime.getCurrentSTacK() or something? [06:16]
Maldivia new Exception().getStackTrace() [06:17]
Maldivia D [06:17]
svm_invictvs works well enough [06:17]
Maldivia well, what are you trying to do? [06:17]
svm_invictvs Maldivia, I have a network client class I wrote. The server side will kick back a serialized exception (w/ stack trace) where I unpack it and re-throw it. I really want to know what client code caused the error. [06:17]
svm_invictvs Maldivia, And obviously this would be controlled by a debug flag or something where it would't do this in production. [06:18]
Maldivia svm_invictvs: throw new ClientException(client code).initCause(serverException); [06:18]
Maldivia that's how you're supposed to do it :D [06:18]
svm_invictvs ahhhh, yeah [06:18]
svm_invictvs That's why initCause is public [06:19]
svm_invictvs derp [06:19]
Maldivia ok, the above won't work directly, as initCause returns Throwable :D [06:19]
svm_invictvs No, but the procedure makes sense. COnstruct an exception when the request is made, wait for the async response, and if it gets an exception, then tie the two together and throw it. [06:20]
harlin [harlin!] has joined ##java [06:31]
db [db!uid18678@gateway/web/] has joined ##java [06:49]
bolt [bolt!~r00t@unaffiliated/bolt] has joined ##java [07:03]
dmabs [dmabs!~dmabs@unaffiliated/dmabs] has joined ##java [07:19]
firewyre [firewyre!] has joined ##java [07:26]
ib07 [ib07!] has joined ##java [07:30]
pppingme [pppingme!~pppingme@unaffiliated/pppingme] has joined ##java [07:31]
hypc1 [hypc1!~Thunderbi@] has joined ##java [07:35]
led1 [led1!~Thunderbi@] has joined ##java [07:37]
Jantz [Jantz!] has joined ##java [07:38]
AMcBain [AMcBain!] has joined ##java [07:41]
acidjnk_new [acidjnk_new!] has joined ##java [07:57]
fstd_ [fstd_!~fstd@unaffiliated/fisted] has joined ##java [08:01]
AndroidDAW [AndroidDAW!] has joined ##java [08:02]
rzjian [rzjian!~l@] has joined ##java [08:05]
orbyt_ [orbyt_!~orbyt@] has joined ##java [08:36]
Renari [Renari!] has joined ##java [08:48]
Arimil [Arimil!] has joined ##java [08:51]
black_ant [black_ant!~antilope@unaffiliated/black-ant/x-1505394] has joined ##java [09:03]
Goplat [Goplat!~Goplat@reactos/developer/Goplat] has joined ##java [09:12]
svm_invictvs Does IntelliJ let me search the heap by type? [09:14]
MrFlibble parted the channel: [09:19]
cheeser whut? [09:25]
callq [callq!~callq@] has joined ##java [09:25]
TideFN [TideFN!~TideFN@2601:cb:8280:9520:91d9:44e4:e909:db30] has joined ##java [09:25]
svm_invictvs Can I do something like ... find me all instances of ArrayList and let me insepct their state in the debugger? [09:31]
Maldivia svm_invictvs: [09:34]
rzjian [rzjian!~l@] has joined ##java [09:36]
TheBeastie [TheBeastie!] has joined ##java [09:56]
callq [callq!~callq@] has joined ##java [09:58]
dougquaid [dougquaid!dougquaid@gateway/vpn/privateinternetaccess/dougquaid] has joined ##java [10:22]
Jigsy [Jigsy!~Jigsy@unaffiliated/jigsy] has joined ##java [10:24]
Jantz [Jantz!] has joined ##java [10:26]
fachinformatiker [fachinformatiker!~fachinfor@fsf/member/fachinformatiker] has joined ##java [10:56]
xekz [xekz!~kexmex@unaffiliated/kexmex] has joined ##java [11:22]
hypc1 [hypc1!~Thunderbi@] has joined ##java [11:40]
wordsToLiveBy [wordsToLiveBy!~wordsToLi@unaffiliated/wordstoliveby] has joined ##java [11:40]
fachinformatiker [fachinformatiker!~fachinfor@fsf/member/fachinformatiker] has joined ##java [11:53]
wordsToLiveBy [wordsToLiveBy!~wordsToLi@unaffiliated/wordstoliveby] has joined ##java [11:57]