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

« 2019-03-13


2019-03-15 »

Nick Message Date
Android_ how do i fix this [12:15]
Android_ 2:13 PM Error running 'Unnamed': Class 'MainKt' not found in module 'untitled2' [12:15]
kostrifon [kostrifon!~kostrifon@] has joined #kotlin [12:31]
djhworld [djhworld!~djhworld@] has joined #kotlin [12:37]
Diablo-D3 [Diablo-D3!] has joined #kotlin [01:27]
glosoli [glosoli!~glosoli@unaffiliated/glosoli] has joined #kotlin [02:02]
Android [Android!] has joined #kotlin [02:03]
padrepio [padrepio!] has joined #kotlin [02:25]
glosoli [glosoli!~glosoli@unaffiliated/glosoli] has joined #kotlin [02:38]
Tazmain [Tazmain!~Tazmain@unaffiliated/tazmain] has joined #kotlin [02:54]
glosoli [glosoli!~glosoli@unaffiliated/glosoli] has joined #kotlin [03:00]
Ladicek [Ladicek!~lthon@] has joined #kotlin [03:08]
raoul11_ [raoul11_!~raoul11_@unaffiliated/raoul11] has joined #kotlin [03:11]
taylorrr [taylorrr!~taylorrr@unaffiliated/taylorrr] has joined #kotlin [03:16]
glosoli [glosoli!~glosoli@unaffiliated/glosoli] has joined #kotlin [03:28]
Tazmain [Tazmain!~Tazmain@unaffiliated/tazmain] has joined #kotlin [03:28]
Pitel [Pitel!] has joined #kotlin [03:30]
ppareit [ppareit!] has joined #kotlin [03:36]
kostrifon [kostrifon!~kostrifon@] has joined #kotlin [03:54]
padrepio [padrepio!] has joined #kotlin [04:02]
Android how do i create an array class [04:04]
padrepio [padrepio!] has joined #kotlin [04:30]
ppareit [ppareit!] has joined #kotlin [04:55]
Android do i just create it with class array<T> {} [05:14]
Android how do i fix this [05:15]
Android Error:(15, 5) Kotlin: Type inference failed: Not enough information to infer parameter T in constructor LibJSON<T>() Please specify it explicitly. [05:15]
Android LibJSON().Test_Lib() [05:15]
Bombe Well, you are persistent. You?re not making progress but you won?t let go. [05:20]
Bombe I am not sure whether that is good, though. [05:21]
Android i have this [05:24]
Android class LibJSON<T> { // declare an array with <T> [05:24]
beaky [beaky!~beaky@2a03:b0c0:0:1010::17cf:7003] has joined #kotlin [05:26]
Bombe Yes, but we can agree that pretty much everything you have is crap because you have no idea what you?re doing so you keep piling tidbits on it that also don?t do what you want. [05:29]
Bombe So let?s take a step back and ask: what do you want? [05:29]
Addax LibJSON sounds... uh... [05:37]
ppareit [ppareit!] has joined #kotlin [05:41]
Android i want an array of classes [05:48]
Addax var array=arrayOf<Class<Any>>() [05:52]
Addax why do you want an array of classes? [05:52]
kapil____ [kapil____!uid36151@gateway/web/] has joined #kotlin [05:55]
Android cus i need it to be able to... nest itself [05:56]
Addax Okay, you're not even trying to answer my question, it's all good [05:56]
Addax If you were to try to tell us the actual task you're trying to accomplish, I imagine with a channel of experienced programmers someone would have valid and viable pointers for you, but... you do you [05:59]
flamebeard [flamebeard!~flamebear@] has joined #kotlin [06:00]
Android Addax: i did [06:02]
Android [19:52] <Addax> why do you want an array of classes? [06:02]
Android [19:56] <Android> cus i need it to be able to... nest itself [06:02]
Addax Nope, that's a technical reason for a specific programming choice. It's not what you're trying to DO. [06:03]
Android im trying to make a library for creating and manipulating JSON Objects [06:03]
Addax "I'm trying to build a data model for some JSON I have to process." <-- that's .. pretty technical too, but at least represents a task [06:03]
Addax why are YOU trying to make such a library? Such libraries - and fantastic ones - already exist. [06:04]
Android such as? [06:04]
ppareit [ppareit!] has joined #kotlin [06:04]
Addax jackson. gson. [06:05]
Android i already use those [06:05]
Addax hell, at a base level, even org.json, even though nobody should ever use it [06:05]
Addax okay. How are they insufficient for what you're trying to do? [06:05]
Android i guess my class, at the moment, is more like a wrapper for gson [06:07]
Android to simplify gson's functions [06:07]
Addax This is too vague for me to be able to help you, I think [06:07]
Addax good luck, and I mean that with all sincerity [06:07]
Android at the moment is is very basic [06:08]
Android it is* [06:08]
Android eg [06:09]
glosoli [glosoli!~glosoli@unaffiliated/glosoli] has joined #kotlin [06:09]
Addax I'm pretty task-focused, personally [06:10]
Addax "GSON doesn't serialize lists as arrays, so I am trying to fix that" or whatever [06:10]
Android i eventually hope to make it able to construct a JSON string as an object simply by something like, for example... [06:11]
Addax something like... var sourceDataObject: SourceData = mapper.readValue(jsonString, // maybe? [06:12]
Android val obj_root = LibJSON(); val obj_user = LibJSON(); obj_user.new_value("John Doe", "name"); obj_user.new_value(4192, "experience"); obj_root.new_value(obj_user, "user") [06:15]
Android to create ' { "user": { "profile": { "name": "John Doe", "experience": 4192 } } }' [06:15]
Addax val profile=mutableMapOf<String, Any>(); root["name"]="John Doe"; root["experience"]=4192; [06:16]
Addax val user=mutableMapOf<String, Any>(); user["profile"]=root; val json=mutableMapOf<String, Any>(); json["user"]=user; [06:17]
Addax val outputJSON = mapper.writeValueAsString(json) [06:17]
Android forgot about the profile lol [06:18]
Addax the only time any library comes into play is the last element, and that's ASSUMING you don't want to do the sane thing: data class Data(val user: User); data class User(val profile:Profile); data class Profile(val name:String, val experience:Int) [06:19]
Addax with THAT, you'd have: val outputJSON=mapper.writeValueAsString(dataReference) // with a val data:Data(...) somewhere [06:19]
Addax much smarter to do it that way, and you still don't have to have your own lib [06:20]
Android its too complex for me ;-; [06:20]
Addax WHY? [06:21]
Addax What part of it is too complex for you? [06:21]
Addax data class Profile(val name:String, val experience:Int) // is THIS too complex for you? [06:22]
Bombe Writing your own JSON library is way more complex than using an existing one. [06:22]
Bombe That?s pretty much _why_ libraries exist in the first place. [06:22]
Addax by many, many orders of magnitude [06:23]
Android all the funtions and arguments and stuff, for example, mutableMapOf<String, Any>(); and mapper.writeValueAsString(dataReference) [06:23]
Addax Android: yes, IGNORE all the mutableMapOf() crap [06:23]
Addax look at the data classes [06:23]
Addax you have a class structure: a root object that contains a user, which contains a profile [06:23]
Addax right? [06:24]
Android yes [06:24]
Addax so... let's build this up logically [06:24]
Android but i cannot have pre defined classes [06:24]
Addax ... [06:24]
Android as i need to generate the object dynamically [06:24]
Addax then it's maps of maps, which is what you're doing anyway [06:24]
Addax Why do you need to generate this dynamically? [06:25]
Addax Why do you not have a model in place? [06:25]
Android cus im intending to work with Proteus, which takes a JSON Object and does whatever to turn it into a xml which it loads or whatever magic it does lol " ProteusView view = proteusLayoutInflater.inflate(<layout>, <data>); container.addView(view.getAsView());" [06:27]
Android Android's title: "GitHub - flipkart-incubator/proteus: Proteus : A JSON based LayoutInflater for Android" [06:27]
Addax oh, we're back to this. [06:27]
Addax okay, I'm out [06:27]
Addax Android: for future reference: I'd have LED OFF with proteus. "I'm trying to build a data model for use with proteus, which has a very flexible data structure that I don't know how to define well." Would have saved me a lot of time. I was trying to figure out what problem you were trying to solve. You just cost me about $120 USD. Thanks, mate. [06:28]
Addax Serves me right. :( [06:29]
Android anyway, imma just find a way to bind =... no that would not work as it the entire format NEEDS to be in a JSONObject [06:29]
Addax yeah, good luck [06:30]
henbruas [henbruas!~henbruas@unaffiliated/henbruas] has joined #kotlin [06:30]
Android in which i can already do with bind_object... so i just MIGHT be able to get make this work [06:30]
Addax some day you'll realize you could (and should) do all this with maps of objects [06:31]
Addax it's kinda gross, but that's what happens when you don't have a data model and need to, well, model [06:33]
Addax I'm betting proteus DOES have a data model - UIs have representations of structure, after all - but eh, you have more insight about your project than I do [06:34]
Android Addax: probably [06:36]
Android does <Any> need to be used if you want a variable to support more than one type [06:36]
waz [waz!~waz@pdpc/supporter/active/waz] has joined #kotlin [06:36]
Android for example, String or Int [06:36]
Addax because type structures [06:38]
Addax A String is an Any, an Int is an Any, a String is not an Int, an Int is not a String [06:38]
Addax you would need the reference to be able to handle String, Int, Double, and other structure (which would be maps or other classes themselves) [06:38]
Android Any * [06:40]
Android Addax: ok [06:40]
Android for example, if i want my function to only accept a String or an Int, eg ("a") or (5), would there be a better way to do this other than Any and (if X is VALUE_TYPES) [06:43]
Android if (X* [06:43]
Addax Don't do the "I'll correct this with Foo *" thing, it's very unclear given how unclear everything is from you [06:44]
Addax well, you tell me: what type would match all of String, Int, Double, and whatever other types you would want to use [06:44]
Android eg fun F(v: Any) { if (v is String) { ... } else if (v is Int) { ... } else { throw Exception("Invalid type") } } [06:46]
Addax so you want it to accept ONLY Int and String? [06:47]
Android yes [06:47]
lankanmon [lankanmon!] has joined #kotlin [06:47]
Addax why not just overload F then? [06:48]
Addax fun F(v:Int) { } fun f(v:String) [06:49]
Android o.o [06:49]
Android welp the kotlin docs offers very little about overloading... [06:51]
Addax They're not trying to teach you basic programming concepts on the JVM or otherwise [06:52]
Android where would i learn stuff like that from [06:53]
Addax tutorial [06:53]
Addax 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. [06:53]
Android isnt java seperate from kotlin? [06:55]
Addax yes, but java concepts are very core to kotlin [06:56]
Android like C is seperate from C++ [06:56]
Addax and if you try to do C++ without some basic C concepts you'll fuck that up too [06:57]
Android ok [06:59]
Android would this be a good book? [07:01]
Android Android's title: "Books/Java-8-in-Action-Lambdas-Streams.pdf at master JavaNeed/Books GitHub" [07:01]
Addax I dunno, never read it [07:01]
Addax ooh, I'm reporting that asshat [07:02]
Android what book would you suggest [07:02]
Android why 0.0 [07:02]
Addax piracy? [07:02]
Addax done. [07:04]
Android lol [07:05]
Addax That is uncool of whoever that is. [07:05]
Addax I know a lot of those authors. I wonder how much royalty money has just been pissed away... [07:06]
Android billions [07:06]
Addax not likely [07:06]
Addax those publishers don't pay that much [07:06]
Android lol [07:06]
Addax but that makes the losses even more significant [07:07]
Android anyway, what book would you suggest [07:07]
Addax for what [07:07]
Android JAVA and JVM [07:08]
jaysonsantos [jaysonsantos!] has joined #kotlin [07:08]
Addax I dunno, look for a general java book, or do the java tutorial [07:08]
Android ok [07:08]
cheeser it's Java or java. not JAVA. JAVA was Sun's stock ticker and Sun is dead. [07:14]
Android i know [07:21]
Android this has tons of books 0.0 [07:28]
Android Android's title: "GitHub - PlamenStilyianov/Java: java" [07:28]
cheeser illegal copies [07:29]
Addax yep, reporting that guy too [07:29]
Addax keep 'em coming [07:29]
raoul11_ \: [07:30]
Addax dude, there are authors IN THIS CHANNEL [07:30]
raoul11_ with the online flux of piracy, doubt that will make a dent [07:31]
Addax nope. But surrendering won't help. [07:31]
cheeser indeed. [07:32]
waz [waz!~waz@pdpc/supporter/active/waz] has joined #kotlin [07:33]
Addax Android: why don't you look on amazon for recommendations and highly rated books and... you know... buy them [07:34]
Addax I know it's hard to think of spending YOUR hard-earned money on something created by some neckbeard just going clicky clicky on a keyboard somewhere but... [07:36]
Addax if you're really that hard up, well, the java tutorial on is *free* by design and intent, use it and other such resources. Don't steal from someone else, even if it's easy. [07:42]
t2mkn [t2mkn!~t2mkn@] has joined #kotlin [07:58]
kostrifon [kostrifon!~kostrifon@] has joined #kotlin [08:02]
vigilanc1 [vigilanc1!~developer@unaffiliated/vigilancer] has joined #kotlin [09:15]
t2mkn [t2mkn!~t2mkn@] has joined #kotlin [09:16]
taelore [taelore!~taylorrr@unaffiliated/taylorrr] has joined #kotlin [09:24]
orbyt_ [orbyt_!~orbyt@] has joined #kotlin [09:28]
Tazmain [Tazmain!~Tazmain@unaffiliated/tazmain] has joined #kotlin [09:51]
taelore [taelore!~taylorrr@unaffiliated/taylorrr] has joined #kotlin [10:08]
glosoli [glosoli!~glosoli@unaffiliated/glosoli] has joined #kotlin [10:08]
t2mkn [t2mkn!~t2mkn@] has joined #kotlin [10:11]
Crash1hd [Crash1hd!~Crash1hd@unaffiliated/crash1hd] has joined #kotlin [10:15]
greggerz [greggerz!~greggerz@unaffiliated/greggerz] has joined #kotlin [10:48]
jpdery [jpdery!] has joined #kotlin [10:49]
t2mkn [t2mkn!~t2mkn@] has joined #kotlin [10:53]
t0th_- [t0th_-!~t0th_-@2001:1284:f013:370f:51fa:d40:7b3c:bebb] has joined #kotlin [10:58]
t0th_- hi [10:58]
t0th_- how i can compare 2 lists? [10:58]
cheeser list1 == list2 [10:58]
KeyJoo [KeyJoo!~KeyJoo@] has joined #kotlin [12:46]
Dejan [Dejan!~dejan@unaffiliated/dejan] has joined #kotlin [12:48]
orbyt_ [orbyt_!~orbyt@2607:f598:b1b2:fc00::1771] has joined #kotlin [12:50]
funeral [funeral!] has joined #kotlin [12:53]
chaosruler [chaosruler!~chaosrule@unaffiliated/chaosruler] has joined #kotlin [12:58]
orbyt_ [orbyt_!] has joined #kotlin [01:03]
esro [esro!] has joined #kotlin [01:22]
esro [esro!] has joined #kotlin [01:38]
orbyt_ [orbyt_!~orbyt@] has joined #kotlin [01:42]
kapil____ [kapil____!uid36151@gateway/web/] has joined #kotlin [01:47]
waz wonder how long to he figures out that bug in his code [01:51]
orbyt_ [orbyt_!~orbyt@] has joined #kotlin [02:26]
vikikas [vikikas!~vikas@2a02:1205:5035:8020:25e2:9b92:ea2b:1935] has joined #kotlin [02:35]
freeone3000 [freeone3000!~kamoricks@Syncleus/dev/freeone3000] has joined #kotlin [02:36]
freeone3000 Say I have 'data class Foo(val beans: Int, val secretWord: String)'. I then have: val myFoos: List<Foo>. I want to do: myFoos.groupingBy { foo -> foo.beans }.eachCount().maxBy { it.value }, to get the Foo with the most beans, and find the secret word thereby. However, after the groupingBy stage, I have a Map<Int, Int> at the .eachCount() stage, as opposed to am Map<Foo, Int> as expected. [02:37]
freeone3000 Sorry, the Foo with the number of beans equal to the mode of the beans. [02:38]
freeone3000 Anyway. I want to do a groupingBy() and then get the thing I grouped by back out after the transform. Any way to do this? [02:39]
yawkat well what foo would it pick, theres multiple for a single int key [02:40]
freeone3000 Don't care. [02:41]
freeone3000 I could specify separate aggregate functions for each non-grouped column in the select in the group by, but there's no affordance to do that? [02:42]
yawkat could group by Foo(it.beans, "") [02:43]
freeone3000 yawkat: That gives me "" for secretWord in the result, for obvious reasons. [02:43]
freeone3000 I want the chosen output to actually be in the input, I just don't care which item of the input gets chosen. [02:44]
yawkat yes :D [02:44]
yawkat ah okay [02:44]
freeone3000 I could loop over the input array *again* and pick the first Foo whose beans count matches the mode. [02:44]
yawkat could map the map from Int->[Foo] to Foo->[Foo] [02:44]
yawkat yea [02:44]
yawkat pita [02:44]
Diablo-D3 [Diablo-D3!] has joined #kotlin [02:54]
orbyt_ [orbyt_!~orbyt@] has joined #kotlin [02:56]
Diablo-D3 [Diablo-D3!] has joined #kotlin [03:33]
zutat [zutat!5d857497@gateway/web/freenode/ip.] has joined #kotlin [03:35]
waz [waz!~waz@pdpc/supporter/active/waz] has joined #kotlin [03:40]
rohdef [rohdef!] has joined #kotlin [03:47]
orbyt_ [orbyt_!~orbyt@] has joined #kotlin [03:53]
Android is it true that arrays cannot be expanded nor shrunk? [04:19]
freeone3000 Yes. You want a List. [04:21]
Android ok [04:22]
orbyt_ [orbyt_!~orbyt@] has joined #kotlin [04:49]
Android if i want to overload a function that is... say 400 lines long, do i need to duplicate it for each supported type [04:50]
Android so if i support 10 types, i will have 4,000 lines of a single function total [04:50]
Android give or take a few lines depending on the type [04:51]
Bombe Overloaded functions are functions like every other so anything that?s valid for other functions is also valid for overloaded functions. [04:52]
Android for example, if it requires different return types for various functions in order to work correcty for each supported type [04:54]
Android would it be better to use Any and checking if x is supported type sp its maybe 450 lines of code total instead of 4000+ [04:56]
Android so* [04:56]
Bombe It would be better to use an existing JSON library. [04:57]
Android not saying that any of my functions are 400 LOC nor that i want to support 10 types lol [04:58]
ChrisLane [ChrisLane!] has joined #kotlin [05:13]
Android why do i get Function 'f' without a body must be abstract for [20:49] <Addax> fun F(v:Int) { } fun f(v:String) [05:45]
freeone3000 Android: Your second function has a body. [05:53]
Android where [05:54]
freeone3000 Android: It needs to have one. [05:56]
Android ;-; [05:56]
Android how can i reduce the LOC needed in this as much as possible [05:59]
Android as i need 16 of them total for all As* return's of getAsJsonPrimitive [06:01]
Android which is 160 LOC total [06:01]
orbyt_ [orbyt_!~orbyt@] has joined #kotlin [06:54]
orbyt_ [orbyt_!~orbyt@] has joined #kotlin [07:37]
Crash1hd [Crash1hd!~Crash1hd@unaffiliated/crash1hd] has joined #kotlin [08:01]
orbyt_ [orbyt_!~orbyt@] has joined #kotlin [08:24]
ziyourenxiang [ziyourenxiang!~ziyourenx@unaffiliated/ziyourenxiang] has joined #kotlin [08:44]
waz [waz!~waz@pdpc/supporter/active/waz] has joined #kotlin [08:51]
taelore [taelore!~taylorrr@unaffiliated/taylorrr] has joined #kotlin [08:52]
t2mkn [t2mkn!~t2mkn@] has joined #kotlin [09:04]
t2mkn [t2mkn!~t2mkn@] has joined #kotlin [10:34]
ChrisLane [ChrisLane!] has joined #kotlin [10:49]
kostrifon [kostrifon!~kostrifon@] has joined #kotlin [11:38]