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

« 2019-07-11


2019-07-13 »

Nick Message Date
rruizt [rruizt!] has joined #kotlin [12:04]
DTZUZO [DTZUZO!] has joined #kotlin [12:18]
sbalmos [sbalmos!] has joined #kotlin [12:29]
vigilancer [vigilancer!~developer@unaffiliated/vigilancer] has joined #kotlin [12:31]
kostrifon [kostrifon!~kostrifon@] has joined #kotlin [12:45]
glosoli [glosoli!~glosoli@unaffiliated/glosoli] has joined #kotlin [01:00]
kostrifon [kostrifon!~kostrifon@] has joined #kotlin [01:15]
glosoli [glosoli!~glosoli@unaffiliated/glosoli] has joined #kotlin [01:19]
DiabloD3 [DiabloD3!] has joined #kotlin [01:30]
Diablo-D3 [Diablo-D3!] has joined #kotlin [01:41]
serafeim good morning [01:43]
Diablo-D3 [Diablo-D3!] has joined #kotlin [01:51]
jusss I met a strange question, I wrote a simple socket client and server, both use Charsets.UTF_8, and the server can get a bytes array like [B@1075dc0 but it failed to convert to String [01:55]
jusss I tried String(bytesarray) and bytesarray.toString(Charsets.UTF_8) [01:56]
jusss the client is on windwos 10, and server is on gentoo, jdk8 [01:57]
Bombe What does ?failed? mean? [02:03]
jusss Bombe: it shows ?? [02:11]
Bombe show us [02:11]
Bombe Paste the code (and any errors) in a pastebin where we can see it. See ~pastebin for options. Also see ~testcase for good examples as to how to help us help you quickly diagnose and solve problems. [02:11]
jusss Bombe: [02:12]
jusss and "??".toByteArray(Charsets.UTF_8) is [B@d3c617 [02:14]
Ladicek [Ladicek!~lthon@] has joined #kotlin [02:15]
jusss but on the server, it received [B@1075dc0 [02:15]
DTZUZO [DTZUZO!] has joined #kotlin [02:16]
Bombe An array?s toString() does not return a representation of the content of the array. [02:18]
Bombe And[]) is not guaranteed to fill the array or generally return more than one byte. If you are expecting multiple bytes you need to make sure you read them all before proceeding. [02:20]
jusss Bombe: and String() ? [02:20]
Bombe What about String()? [02:21]
jusss Bombe: String(aByteArray) is ok? [02:21]
jusss or is there readLine method? [02:21]
jusss or other better read data from socket method ? recv() ? [02:22]
Bombe Depends on what you want. If you can live with the platform?s default encoding, String(byte[]) is okay. Generally you should specify a charset which you are doing which is good and should not be the problem. [02:22]
jusss windows 10 and gentoo [02:23]
Bombe No, you kind of need to know when to stop reading and start processing. [02:23]
jusss and I did point the Charsets.UTF_8 [02:23]
jusss Bombe: that's so raw [02:23]
jusss we're living in 2019 [02:23]
Bombe It?s really not. How should read() know you?re done? [02:23]
jusss Bombe: read \r\n? [02:24]
jusss and kotlin still keep .flush() [02:24]
Bombe You can wrap it in a BufferedReader which offers readLine(), sure. [02:24]
Pitel [Pitel!] has joined #kotlin [02:24]
Bombe flush() doesn?t have anything to do with that. [02:24]
jusss Bombe: and sock.outputStream.write(msg.toByteArray(Charsets.UTF_8)) this write method will send what as end sign? [02:25]
Bombe jusss, what end sign? [02:26]
jusss Bombe: like EOF stuff, [02:26]
Bombe Why would it do thit? [02:26]
jusss so let receiver know when it ends? [02:27]
Bombe Your mental model of how this stuff works is pretty flawed. :) [02:27]
Bombe If you want to send a signal like that you have to do that yourself. [02:27]
jusss oh, I see, I should design it by myself [02:28]
Bombe write() can not simply add stuff it fancies. [02:28]
shrewdu [shrewdu!~root@] has joined #kotlin [02:28]
jusss I write("ok\r\n"), then I can read it and use "\r\n" as a end of line [02:28]
Bombe Yes, that?s a perfectly valid way to do that. :) [02:29]
Bombe (I?d cut it down to ?\n? only, the ?\r? doesn?t add any value.) [02:29]
jusss I never think this before, send() and recv() is very simple in python [02:30]
jusss does this socket object has send and recv in kotlin? [02:30]
Bombe What do the docs say? [02:30]
Bombe javadoc [02:31]
Bombe Bombe, I know of the following APIs: JDK; JavaEE; guava [02:31]
Bombe javadoc Socket [02:31]
Bombe Bombe: [JDK:] [02:31]
jusss Bombe: another question, how I can know an object's type? [02:31]
Bombe javadoc Object [02:32]
Bombe Bombe: [JDK: java.lang.Object] [02:32]
jusss type(3) will return Int in python, what about kotlin? [02:32]
jusss javadoc Coroutine [02:32]
jusss I have no documentation for Coroutine [02:32]
Bombe Java/Kotlin doesn?t have a function for that but each object has a getClass() method. [02:33]
jusss Bombe: why kotlin doesn't have it own docs? [02:33]
jusss even there's kotlin native [02:33]
Bombe However, needing that is a good sign that you?re doing either something very specialized or something very wrong. :) [02:33]
jusss and kotlin js [02:33]
Bombe Kotlin does have its own docs, javabot just doesn?t know them. [02:34]
jusss but kotlin's socket docs point to java [02:34]
Bombe Sure, why not? It?s the same library, Kotlin doesn?t have its own Socket. [02:34]
jusss I know repeat to build something tools or libraries is not good, but kotlin should have it own docs even it uses java's libraries [02:35]
jusss but kotlin is not java [02:35]
jusss you can not expect copy you kotlin code and run it in java [02:35]
Bombe The library doesn?t care. [02:35]
jusss but the syntax care [02:36]
Bombe Yes, you can. [02:36]
Bombe Kotlin and Java both get compiled to byte code. [02:36]
liefer [liefer!] has joined #kotlin [02:36]
Bombe The JVM runs this byte code and doesn?t give a shit about where it came from. [02:36]
jusss Bombe: have you tried convert kotlin to java? [02:36]
jusss Bombe: through compile to bytecode then decompile to java? [02:36]
Bombe And the JVM also includes the library, like Socket, and String, and everything else in Java. [02:37]
jusss and lots of errors will show up [02:37]
Bombe You are confusing a lot of things here. [02:37]
jusss but the other hand, convert java code to kotlin is so easy [02:37]
jusss yes, I am [02:38]
glosoli [glosoli!~glosoli@unaffiliated/glosoli] has joined #kotlin [02:43]
Lengsdorfer [Lengsdorfer!~Lengsdorf@unaffiliated/lengsdorfer] has joined #kotlin [03:15]
kostrifon [kostrifon!~kostrifon@] has joined #kotlin [03:27]
yawkat jusss: you can call kotlin code from java, and vice-versa. no conversion involved. [03:37]
jusss yawkat: why java's socket is so primitive, no send() and recv() [03:52]
jusss why string in kotlin no slice like [::-1] ? [03:54]
jesusfreke yes, please enlighten us about the design decisions that went into something you had no involvement in designing. [03:55]
jusss I don't understand why your docs even don't have a simple example, make us beginner have to search something on stackoverflow! [03:56]
jesusfreke "your docs"? [03:56]
jusss [03:56]
jusss jusss's title: "String - Kotlin Programming Language" [03:56]
jusss no a fuc single example [03:57]
jesusfreke Those are my docs. I'm pretty sure those aren't yawkat's docs. [03:57]
jesusfreke err [03:57]
jesusfreke those aren't my docs. haha [03:57]
jesusfreke you seem to be directing these questions in a accusatory way, to people to have no basis in making the decisions that you are being accusatory about [03:58]
jusss I just want to do a simple string concat and slice, It takes me a half hour I still don't know what a shit docs tring to tell me [03:58]
jusss it is so simple to do that in other languages [03:59]
yawkat javadocs are not tutorials [03:59]
yawkat they are reference material [03:59]
jusss so it should not to have examples? [04:00]
yawkat correct, javadocs do not typically have examples, not in the stdlib and not in libraries. [04:00]
jusss and does it have a official tutorial? [04:00]
yawkat for what specifically? strings or sockets? [04:01]
jusss everything it has [04:01]
yawkat tutorial [04:01]
yawkat The Oracle tutorial for Java is probably your best starting point, at . Skip the Netbeans bits. Another option: - has a list of others as well. [04:01]
yawkat [04:01]
yawkat yawkat's title: "Reference - Kotlin Programming Language" [04:01]
jusss I always wonder if developers have known java as well, why does kotlin exist? [04:03]
yawkat because the language is better. [04:03]
yawkat the java libraries are fine, so why change them? [04:03]
jusss yawkat: if kotlin is a language, why its docs point to java's ? [04:04]
jusss so it can prove that java is a better language? [04:04]
yawkat because kotlin still depends heavily on java libraries. [04:04]
yawkat to develop kotlin on the jvm, you need to know how to use java libraries. and presumably you need to know some java as well. [04:05]
jusss I can use java if I don't know kotlin at all, but I can not use kotlin if I don't know java, what ironic! [04:05]
yawkat pretty much, yes. [04:05]
yawkat lots of kotlin users are/were java developers. [04:06]
jusss does kotlin have list/set/dict comprehesion, decorator, generator, those features those modern languages have? [04:15]
jusss I saw that kotlin has coroutine, and java doesn't [04:16]
jusss and kotlin's coroutine is related with Promise/Future ? [04:16]
yawkat yes, kotlin has some of those features. [04:17]
yawkat no, coroutines are not related to promises or futures, though they can be used to implement them. [04:17]
jusss and I also saw kotlin has a static type system, and does it have typeclass ? [04:18]
yawkat no. [04:19]
jusss and I saw kotlin say coroutine libraries are stable now, and when it will make it as buit-in or called std lib? [04:19]
yawkat im not sure if they ever will be in the stdlib - the stdlib is meant to be light. [04:19]
jusss if kotlin's coroutine doesn't to do with Promise/Future, then what's the meaning of exist? [04:20]
jusss it can not be flattern, can not be cancel, can not be append [04:20]
yawkat coroutines are a nicer way to implement state machines. what you do with them is up to you. [04:20]
jusss even javascript the front language has Promise now, I don't understand a language like java/kotlin why still not have it [04:21]
Bombe Because the language designers didn?t put it in. [04:22]
jusss it's too difficult to implement to kotlin? [04:22]
yawkat jusss: that is an entirely different statement. [04:22]
Bombe And especially JavaScript shouldn?t be taken as an example for anything. [04:23]
jusss all those features other modern langues have, and kotlin is design as a moder language? [04:23]
yawkat facepalms [04:23]
yawkat do you have an actual question? [04:23]
Bombe jusss, do you actually have any problems we can help you with? [04:23]
Bombe Because right now you?re only ranting and we don?t care about that. [04:24]
jusss yes [04:24]
jusss I don't know why String(a_byte_array, Charsets.UTF_8) not work on gentoo, but it works on windows 10 [04:24]
yawkat it works on both. [04:25]
yawkat show us [04:25]
yawkat Paste the code (and any errors) in a pastebin where we can see it. See ~pastebin for options. Also see ~testcase for good examples as to how to help us help you quickly diagnose and solve problems. [04:25]
Bombe It works. [04:25]
Bombe Your problem will be that the byte arrays are not the same. [04:26]
jusss I post it before, [04:26]
Bombe You never print them in a way that allows you to see what?s going on. [04:26]
Bombe Use Arrays.toString() to get a representation of the actual content. [04:26]
yawkat you are also using streams incorrectly. you need to actually use the return value of read. [04:27]
jusss Bombe: [04:27]
jusss I heard your sugestion,and put "1" as a sing of end, but why the "c.length" is 1017, even I just send a 4 character string [04:28]
Bombe jusss, that? doesn?t contain anything of what we talked about. [04:28]
yawkat jusss: because your array is that big. [04:28]
yawkat youre converting the entire array to a string. [04:28]
jusss ok [04:29]
jusss yawkat: actually this code is not I wrote, I just copy java code to intellij, and intellij trans to kotlin [04:30]
padf00t [padf00t!~julius@2a02:168:7e12:2:b145:ab2d:4c77:7841] has joined #kotlin [04:30]
yawkat okay, then the java code was probably wrong. [04:30]
jusss DataInputStream inStream=new DataInputStream(serverClient.getInputStream()); [04:30]
kostrifon [kostrifon!~kostrifon@] has joined #kotlin [04:38]
macroprep [macroprep!~smallvill@2405:7f00:8a0c:900:ed90:31cd:cb3b:ef05] has joined #kotlin [04:47]
Diablo-D3 [Diablo-D3!] has joined #kotlin [04:51]
glosoli [glosoli!~glosoli@unaffiliated/glosoli] has joined #kotlin [05:09]
Tazmain [Tazmain!~Tazmain@unaffiliated/tazmain] has joined #kotlin [05:20]
rruizt [rruizt!] has joined #kotlin [05:59]
glosoli [glosoli!~glosoli@unaffiliated/glosoli] has joined #kotlin [06:29]
macroprep [macroprep!~smallvill@2405:7f00:8a0c:900:98cf:b344:93f5:c48] has joined #kotlin [06:44]
lankanmon [lankanmon!] has joined #kotlin [07:02]
padf00t [padf00t!~julius@2a02:168:7e12:2:b145:ab2d:4c77:7841] has joined #kotlin [07:09]
Tazmainain [Tazmainain!~Tazmain@unaffiliated/tazmain] has joined #kotlin [07:10]
jusss val size = [07:19]
jusss val recvMsg:String = String(aob, Charsets.UTF_8) [07:19]
jusss how I can do ByteArray slice on aob? [07:19]
jusss aob[0:size] on kotlin? [07:19]
jusss I saw that slice method, but I don't understand why it aob.slice(0..size) is wrong? [07:20]
yawkat use sliceArray [07:23]
yawkat also, 0 until size, because .. is inclusive [07:23]
yawkat also, read may terminate before the input has been fully read, so calling it outside a loop is almost always wrong [07:24]
yawkat also, just use an inputstreamreader instead of decoding it yourself. [07:24]
jusss yawkat: fun ByteArray.sliceArray(indices: IntRange): ByteArray, I don't know what IntRange looks like? [07:29]
yawkat 0..4 is an intrange. [07:30]
jusss and 0..size ? [07:30]
jusss or 0..$size? [07:30]
jusss 0 until size? [07:30]
yawkat all intranges [07:31]
yawkat [07:31]
yawkat yawkat's title: "Ranges and Progressions - Kotlin Programming Language" [07:31]
jusss val size =; val recvMsg:String = String(aob.sliceArray(0 until size), Charsets.UTF_8) [07:34]
jusss this should be right? [07:34]
yawkat well except for the two other things i said earlier. [07:36]
jusss I don't know how to use inputstreamreader [07:40]
jusss for that [07:40]
kostrifon [kostrifon!~kostrifon@] has joined #kotlin [07:57]
MassDebates [MassDebates!~MassDebat@unaffiliated/massdebates] has joined #kotlin [08:04]
kostrifon [kostrifon!~kostrifon@] has joined #kotlin [08:37]
Arimil [Arimil!] has joined #kotlin [08:59]
javabot [javabot!~javabot@unaffiliated/javabot] has joined #kotlin [09:17]
argo [argo!~argo@unaffiliated/argo] has joined #kotlin [09:23]
macroprep_ [macroprep_!~smallvill@2405:7f00:8a0c:900:98cf:b344:93f5:c48] has joined #kotlin [09:47]
argo [argo!~argo@unaffiliated/argo] has joined #kotlin [10:23]
Suchorski [Suchorski!~regex@unaffiliated/suchorski] has joined #kotlin [10:35]
Suchorski [Suchorski!~regex@unaffiliated/suchorski] has joined #kotlin [10:36]
kostrifon [kostrifon!~kostrifon@] has joined #kotlin [10:42]
OtakuSenpai [OtakuSenpai!~OtakuSenp@unaffiliated/neel] has joined #kotlin [10:47]
Diablo-D3 [Diablo-D3!] has joined #kotlin [11:21]
Diablo-D3 [Diablo-D3!] has joined #kotlin [11:32]
zutat [zutat!5d83b521@unaffiliated/zutat] has joined #kotlin [11:38]
Diablo-D3 [Diablo-D3!] has joined #kotlin [11:42]
zutat [zutat!5d83b521@unaffiliated/zutat] has joined #kotlin [11:51]
kostrifon [kostrifon!~kostrifon@] has joined #kotlin [12:24]
orbyt_ [orbyt_!~orbyt@] has joined #kotlin [12:30]
padf00t [padf00t!~julius@2a02:168:7e12:2:b145:ab2d:4c77:7841] has joined #kotlin [12:37]
vbgunz_ [vbgunz_!vbgunz@gateway/vpn/privateinternetaccess/vbgunz] has joined #kotlin [12:42]
DiabloD3 [DiabloD3!] has joined #kotlin [12:42]
jcnmark6 [jcnmark6!] has joined #kotlin [12:48]
Diablo-D3 [Diablo-D3!] has joined #kotlin [12:52]
Diablo-D3 [Diablo-D3!] has joined #kotlin [01:03]
maturelobster [maturelobster!] has joined #kotlin [01:29]
Diablo-D3 [Diablo-D3!] has joined #kotlin [01:33]
Diablo-D3 [Diablo-D3!] has joined #kotlin [01:43]
esro [esro!~esro@] has joined #kotlin [03:15]
|Agent_ [|Agent_!~|] has joined #kotlin [03:21]
|Agent_ Studying up on Kotlin. I have a Swift background, so the contrast is interesting. [03:22]
|Agent_ There do seem to be some similarities. [03:23]
|Agent_ ? And differences, naturally. [03:24]
dreamreal okay. [03:43]
|Agent_ [|Agent_!~|] has joined #kotlin [03:45]
rruizt [rruizt!] has joined #kotlin [04:09]
demeg0 [demeg0!] has joined #kotlin [06:32]
horribleprogram [horribleprogram!~horriblep@unaffiliated/nightcoder] has joined #kotlin [06:36]
horribleprogram I don't care much about Kotlin but I figured I might as well learn it instead of Groovy for expressing Gradle builds [06:37]
cheeser ok... [06:37]
horribleprogram I can't seem to find ANY docs really on using Kotlin for Gradle [06:37]
cheeser why bother saying such things? [06:37]
cheeser "hi. i don't really care for 'your' language but I have to learn it anyway." [06:38]
horribleprogram cheeser: you're right and I'll take the loss here, I should have just asked "Any docs for using Gradle with Kotlin" [06:38]
cheeser it seems unnecessarily ... i dunno antagonistic? dismissive? douchey? [06:38]
horribleprogram cheeser: WAIT i didn't mean it like that tho :P [06:39]
horribleprogram it came off like thata [06:39]
horribleprogram this is why we need brain to brain communication, this language barrier is causing a lot of problems. :D [06:40]
cheeser i ... would not want that either. [06:41]
horribleprogram lmfao [06:43]
horribleprogram cheeser: you've done gradle right/ [06:43]
orbyt_ "expressing Gradle builds" what do you mean by this? [06:44]
horribleprogram orbyt_: that's my point, idk if the gradle language itself is written in Kotlin or kotlin is used within the blocks [06:44]
horribleprogram dependencies { ... } block has a bunch of implementation 'string literals...' [06:46]
cheeser did you do a google search for gradle and kotlin? [06:46]
cheeser or just come here to ask first? [06:46]
horribleprogram maybe implementation is a function that takes a string lliteral as an arugment, and the syntax is that [06:46]
orbyt_ Gradle uses a Groovy like language [06:46]
orbyt_ It's not Kotlin [06:46]
cheeser you can write gradle scripts using kotlin [06:47]
horribleprogram ^ [06:47]
orbyt_ You can write a task in Kotlin that gets invoked by Gradle [06:47]
cheeser you can write gradle scripts using kotlin [06:47]
orbyt_ not by default [06:48]
orbyt_ you need the language specific dsl [06:48]
cheeser well, no one said *that* [06:48]
cheeser he's asking how. kind of. [06:48]
Renari [Renari!] has joined #kotlin [06:48]
horribleprogram orbyt_: how do you specify this? [06:48]
cheeser gradle kotlin [06:48]
cheeser cheeser, what does that even *mean*? [06:48]
orbyt_ horribleprogram [06:49]
orbyt_ orbyt_'s title: "GitHub - gradle/kotlin-dsl: Kotlin language support for Gradle build scripts" [06:49]
cheeser google gradle kotlin [06:49]
cheeser horribleprogram, [06:49]
cheeser seriously, horribleprogram. how many times do you need to be told? [06:49]
horribleprogram in horribleprogram's defence, most of the links from that google page are a purple color [06:50]
horribleprogram meaning I clicked them and read them [06:50]
horribleprogram cheeser: we're not all geniuses [06:50]
cheeser the 2nd and 3rd links both lead to what you (at least on my search) [06:50]
cheeser this is not genius level activity. it's a basic, fundamental skill for anything remotely involving the internet. [06:51]
horribleprogram cheeser: the only misconception was the difference between Using Gradle to build a Kotlin project, and writing Gradle scripts in kotlin [06:53]
horribleprogram cheeser: last Q [06:55]
horribleprogram groupId:artifactId:version is a fully qualified dependency in the Maven repo? [06:56]
cheeser ... yes ? [06:57]
horribleprogram kk [06:59]
horribleprogram thanks guys, have a good friday [07:00]
horribleprogram parted the channel: [07:00]
Bombe Did he refer to himself in the 3rd person? [07:03]
DTZUZO [DTZUZO!] has joined #kotlin [07:08]
|Agent_ [|Agent_!~|] has joined #kotlin [07:29]
ziyourenxiang_ [ziyourenxiang_!~ziyourenx@unaffiliated/ziyourenxiang] has joined #kotlin [08:03]
yawkat [yawkat!] has joined #kotlin [08:21]
cheeser Bombe: that's the least of his trangressions [08:21]
Bombe Yes but all that other stuff we already know about, this one is new. [08:22]
cheeser ) [08:22]
Diablo-D3 [Diablo-D3!] has joined #kotlin [08:43]
Diablo-D3 [Diablo-D3!] has joined #kotlin [08:54]
Lengsdorfer [Lengsdorfer!~Lengsdorf@unaffiliated/lengsdorfer] has joined #kotlin [09:28]
rruizt [rruizt!] has joined #kotlin [10:22]
kostrifon [kostrifon!~kostrifon@] has joined #kotlin [11:00]
macroprep [macroprep!~smallvill@2405:7f00:8a0c:900:2593:9420:8c56:7cfb] has joined #kotlin [11:07]
DTZUZO [DTZUZO!] has joined #kotlin [11:39]