mort, I really like #kotlin's (and others') approach to nullability, where nothing is nullable by default and you mark something as nullable by adding '?' to the type. And the '?.' syntax is nice too. 'foo: Foo? = ...; foo?.doThing()' is nicer than 'foo: Optional<Foo> = ...; foo.map(|it| it.doThing())', and both are miles better than "everything is always implicitly nullable unless annotated with '@NotNull' #plt
Crell,
Crell,
henrikjernevad, @Crell @maxalmonte14 I agree. And I think several languages has shown that the last few years. From the ones I am familiar with, Scala was a surprisingly successful FP/OOP hybrid experiment. Then Kotlin took "the best parts to the masses". But even Java and C# has moved a lot towards FP. And JavaScript is flexible and weird enough to fit both camps.
Crell, @henrikjernevad @maxalmonte14 Most of the guidelines for "good" OOP are borrowed straight from FP, with or without some twisting. Honestly a structurally typed language (Go or Rust) could, with the proper features, easily straddle both sides perfectly.
koje71, German Hab ein bisschen weiter an der Kugelbahn gebastelt und etwas Schnickschnack eingebaut. Es gibt Schalter, die beim Überrollen Barrieren öffnen und einige Bahnelemente sind jetzt festgeschraubt, so dass sie sich nicht mehr verschieben lassen.
Ich überlege mir jetzt noch etwas mehr Schnickschnack 😀
Leider ruckelt es etwas im Android Emulator, aber auf dem Handy selber läuft alles total flüssig.
mort, I can't deal with languages with optional semicolons! I like languages without semicolons, but when they're optional, especially if they feel "C-like", I always end up adding semicolons to some lines even when I try to write in a semicolon-less style. I'm writing some #kotlin now and I decided to just use semicolons consistently because the alternative is seemingly to use them inconsistently.
Strangely, this isn't an issue I have in #golang. I do have it in #rust however.
mort, @ekuber That's correct, and I would've added a caveat if I wasn't limited to 512 characters, but here we are
For a whole lot of blocks in rust (such as if statements and loops not used as expressions), it doesn't make a difference whether the block technically evaluates to something, so the last semicolon there is in practice optional, so I sometimes forget it
ekuber, @mort but it is mandatory in many of those cases: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=32225df0708630a138de26cfba3f4ffb
Thank you for making me double check, because made me realize there's a bug in our logic: https://github.com/rust-lang/rust/issues/124819
koje71, German Die Kugel rollt jetzt wieder, wie sie soll 😀
Crell,
Crell, @adam_turcsan Apparently, it's common (at least in some circles) to have to define database entities as classes... and then also manually write SQL to create the corresponding table/types.
Meanwhile, Doctrine has had auto-migration generation for 15 years?
Apparently there's an IDE plugin to generate migration scripts. Testing it now.
Also, Composer > Gradle, without question.
adam_turcsan, @Crell In my head, Hibernate is the tool that Doctrine got to be in php, so I don't think that it's not a solvable thing... although I personally have no experience with that. However Composer >> most of the package managers :D
hamoid, I'm very happy that I figured out how to place the icons in columns (responsive) and the names under the thumbnails. I find aligning things in Swing even harder than in CSS.
This is in my https://codeberg.org/hamoid/idea-thumbnails plugin which currently works for #OPENRNDR and #Kotlin programs, but would be easy to adapt to other languages / frameworks supported by the Idea IDE.
If anyone uses Idea for creative coding, I'm open for contributions :-) I'm a noob at writing Idea plugins.
hamoid, Small improvements in the layout of my Thumbnailer IntelliJ Idea plugin. #creativeCoding #Kotlin #OPENRNDR
dkandalov, In case you want to try an alternative JSON (de)serialization library for #Kotlin, Kondor https://github.com/uberto/kondor-json by @ramtop is great. No annotation magic, just functions explicitly defining the mapping. No external dependencies. As fast as Jackson.
svenjacobs, First release candidate of #Kotlin 2.0 🎉
Crell, @svenjacobs Is there a summary of what's new enough to justify a 2.0?
Crell, #Kotlin is to #Java as #TypeScript is to #JavaScript.
Up to you if that's a complement or an insult.
julianwki, @Crell Yes and well... no. 🤓 Kotlin and TS both are probably the superior language. But Kotlin > TS in my opinion.
Crell, @julianwki I made no comparison between Kotlin and TS as languages. Just to their respective ecosystem roles.
ethauvin, Kotlin/Wasm — Compile Once Run Everywhere
https://www.youtube.com/watch?v=eEjrlctqTF8&utm_medium=erik.in&utm_source=mastodon
caritos,
henrikjernevad, Inspired by @thejtoken, here is my programming journey:
QBasic -> Visual Basic 1-6 -> Visual Basic .NET -> C# -> PHP -> JavaScript -> Java -> Scala -> Kotlin -> TypeScript
Favorite so far is #Kotlin (for backend development).
thejtoken, @underlap @henrikjernevad Impresionante, just to check a little bit your Spanish 😉
underlap, @thejtoken @henrikjernevad ¿Qué?
hamoid, #SDF (Signed Distance Fields) are common in shaders, but they can also be used in the CPU to create 2D designs for a #penPlotter
gunstick, @hamoid is this just the classic Amiga demo with 2 sets of concentric circles?
At 40s mark https://youtu.be/5aXsrYI3S6g
hamoid, @gunstick You just revealed where I come from XD
aleks, Fixed that pesky #kotlin #coroutines #concurrency bug by… running everything synchronously!
Concurrency is hard, let's go shopping…
aleks, …meanwhile, that new 16-core CPU I just bought.
Alex_Zhukovich, I published an article about a new API for parsing and formatting date and time using the "kotlinx-datetime" library.
https://alexzh.com/date-and-time-formatting-in-kotlin-with-the-datetime-library/
jonyoder, Having one of those "is this real?" moments. Why?
I just finished writing a code test which creates and queues for delivery an end-to-end encrypted email-like message in somewhere around 10-15 lines of #Kotlin code.
Think about it. It's starting getting real. SQUEEEE!!!
Nothing to show just yet, but I'm getting close.
koje71, German Das Design wurde etwas überarbeitet und es gibt jetzt schon ein Latein Wörterbuch mit fast 100 Vokabeln und das Mathe Einmaleins.
Der aktuelle Source Code ist hier: https://github.com/koje71/com.koje.cards
ubo, German @InJedemFall Ach, ich kann alles tragen. Meine geradezu überirdische Schönheit überstrahlt sowieso alles andere.
RonRevog, German @ubo @InJedemFall @koje71 @BrauchC
Ich kann auch alles tragen. Meistens nach dem Einkaufen.
ArmouredWizard, Yet another plea for information:
Are there any resources out there that deal with writing data to multiple tables?
#room #sql #kotlinI have several tables, and need to both insert and update them with data from my UI/Domain Layer.
e.g. a new Scoundrel needs to Insert ScoundrelEntity, and maybe Insert new CrewEntity, and update CrewScoundrelCrossRef.
I need to do this for several Relationships.
I will also need to edit/delete
Is there any info on this?
ArmouredWizard, @rivetgeek where a Transaction is a group of hand-coded SQL to be executed together?
(It me! I'm trashing the data!)
rivetgeek, @ArmouredWizard yes transactions are explicitly defined by BEGIN TRANSACTION, all of the SQL to be executed within the transaction, and COMMIT TRANSACTION. If anything fails during the transaction, the entire thing is rolled back. Transactions are the basis of most database concurrency checking because you can track if a transaction is rolled back and try it again. Granted concurrency isn't a concern for you, but transactions are still the way I know of to guarantee x, y, and z happen.
ArmouredWizard, Latest problem:
Special Abilities are stored as List<String>
Hand-knitted TypeConverter is splitting on comma when retrieved from database (as that is how Lists are stored)
Solutions?
- convert using JSON or some other library
- rewrite Converter
- rebuild schema to make Abilities their own table, linked Many-to-Many (scoundrels have Many Abilities, Abilities can be had by Many Scoundrels). This is probably the better way, long term, but introduces a new layer of complexity...
#room #kotlin
bocops, You could also change how the lists are stored in the first place, using .joinToString(separator = "...") on your list.
Unless you can really find a separator character that will never be used, JSON seems to be the safer bet, though. :)
ArmouredWizard, Whelp, I'm being dumb again, but aren't tutorials meant to assume I'm dumb?
I have my 2 Entity tables, plus a CrossRef table (Scoundrels, Contacts, ScoundrelContactCrossRef)
I can read and write the 2 main tables.
How do I write a new "Scoundrel with associated Contacts" to the 3 tables? I've got it defined in my UI/Domain, and I click SAVE, and... what do I tell ROOM/SQL?
#kotlin #room #sql #code #androidDev
ArmouredWizard, Options I can think of:
- Write 3 Insert statements with interlinked validation/coordination
- Find a ROOM command that does it all
- write a SQL command that does it all
- swear and throw things
ArmouredWizard, @rivetgeek I'd find it easier if I could understand the learning resources.
I cannot seem to find anything at the right level for me, that actually explains things.
ArmouredWizard, Am I being a bit dumb, or is making a database that has more than 1 table a Herculean Labour?
Scoundrels, Crews and Contacts.
A Scoundrel is in 1 Crew.
A Crew has 0+ Scoundrels.
Contacts are known to individual Scoundrels and/or Crews. A Contact has a Rating (Friend/Neutral/Hostile) with each Scoundrel/Crew.
I need to call each and every combination.
How complicated is this meant to be, as I seem to be making a pig's ear of the whole thing!Help!
#code #kotlin #room #androidDev
rivetgeek, @kevin @ArmouredWizard Yeah totally. A GM may have multiple groups though and might have some thing with characters shared between them or something.
ArmouredWizard, @rivetgeek @kevin I think I'll be keeping Scoundrel/Crew as 1-to-many this time.
I'll have other many-to-many relationships, to test my skills, so some variety will be good! :)
ArmouredWizard, ...and I've run into the same problem I hit before...
I have 3 Entities (Scoundrels, Crews, Contacts)
I have "Scoundrel with Crew" working (Each scoundrel is in exactly 1 Crew. A Crew can have 0+ Scoundrels)
I need to add Contacts. Each Contact can be known to many Scoundrels, and Many Crews.
Each Contact also has a Rating ("Friend", "Neutral" or "Hostile") with each relationship.
I'd like to start by building adding Scoundrels/Contacts relationships
bocops, @ArmouredWizard Hmm, perhaps this is an issue with Room, after all.
In that case, it is often useful to keep your model classes and your database entity classes separate. Among other things, makes both of them easier to understand.
For example, your model Scoundrel might have an attribute crew:Crew?, while your database ScoundrelEntity would just have a crewId:String?
You would store and load your entities separately from each other, then build your model representation from that.
bocops, @ArmouredWizard The accepted answer here is written in Java, but hopefully explains how you might get your "model" data from individual database entities: https://stackoverflow.com/questions/44330452/android-persistence-room-cannot-figure-out-how-to-read-this-field-from-a-curso/44424148#44424148
koje71, German Neue Ideen: Das Spiel soll einen Level Editor bekommen, bei dem jeder seine eigenen Levels bauen kann. Per QR Code kann dann das selbst erstellte Level an Freunde und Bekannte weitergegeben werden. Sogar ganz ohne Internet. Da die Level nicht sonderlich kompliziert sind, passen alle Daten in den QR Code selber rein.