The home of Kotlin

mort,
@mort@fosstodon.org avatar

I really like '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'

Crell,
@Crell@phpc.social avatar

and are lightyears better than for , at least in the quality of their output. It actually reports something useful, unlike KTLint.

Dear flipping god, how do people work with tools this bad?

sven,
@sven@phpc.social avatar

@Crell we (the PHP community) are very spoiled when it comes to tooling. It’s so good!

Crell,
@Crell@phpc.social avatar

Having tasted extension functions in , I really really want them in . I am not sure how that would be even feasible, though. 😞

henrikjernevad,
@henrikjernevad@mastodon.social avatar

@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,
@Crell@phpc.social avatar

@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
@koje71@darmstadt.social avatar

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.

Eine Kugelbahn für Android in der Entwicklung

Gleisplan,
@Gleisplan@mastodon.social avatar

@koje71

schön

mort,
@mort@fosstodon.org avatar

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 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 . I do have it in however.

mort,
@mort@fosstodon.org avatar

@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,
@ekuber@hachyderm.io avatar

@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
@koje71@darmstadt.social avatar
Crell,
@Crell@phpc.social avatar

Another day, another way in which the / ecosystem is weaker/worse than the ecosystem.

I'm kind of tired of finding these.

Crell,
@Crell@phpc.social avatar

@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,
@adam_turcsan@phpc.social avatar

@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,
@hamoid@genart.social avatar

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 and 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,
@hamoid@genart.social avatar

Small improvements in the layout of my Thumbnailer IntelliJ Idea plugin.

dkandalov,
@dkandalov@mastodon.social avatar

In case you want to try an alternative JSON (de)serialization library for , 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,
@svenjacobs@androiddev.social avatar
Crell,
@Crell@phpc.social avatar

@svenjacobs Is there a summary of what's new enough to justify a 2.0?

Crell,
@Crell@phpc.social avatar

is to as is to .

Up to you if that's a complement or an insult.

julianwki,
@julianwki@chaos.social avatar

@Crell Yes and well... no. 🤓 Kotlin and TS both are probably the superior language. But Kotlin > TS in my opinion.

Crell,
@Crell@phpc.social avatar

@julianwki I made no comparison between Kotlin and TS as languages. Just to their respective ecosystem roles.

ethauvin,
@ethauvin@mastodon.social avatar
caritos,
@caritos@mastodon.social avatar

Experimenting with with as the backend.

kerfuffle,
@kerfuffle@mastodon.online avatar

@caritos
How are you finding it thusfar? What is the alternetive you're comparing it to?

henrikjernevad,
@henrikjernevad@mastodon.social avatar

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 (for backend development).

thejtoken,
@thejtoken@hachyderm.io avatar

@underlap @henrikjernevad Impresionante, just to check a little bit your Spanish 😉

underlap,
@underlap@fosstodon.org avatar
hamoid,
@hamoid@genart.social avatar
gunstick,
@gunstick@mastodon.opencloud.lu avatar

@hamoid is this just the classic Amiga demo with 2 sets of concentric circles?
At 40s mark https://youtu.be/5aXsrYI3S6g

hamoid,
@hamoid@genart.social avatar

@gunstick You just revealed where I come from XD

aleks,
@aleks@hachyderm.io avatar

Fixed that pesky bug by… running everything synchronously!

Concurrency is hard, let's go shopping…

aleks,
@aleks@hachyderm.io avatar

…meanwhile, that new 16-core CPU I just bought.

Alex_Zhukovich,
@Alex_Zhukovich@androiddev.social avatar

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,
@jonyoder@mstdn.social avatar

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 code.

Think about it. It's starting getting real. SQUEEEE!!!

Nothing to show just yet, but I'm getting close.

koje71, German
@koje71@darmstadt.social avatar

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

Eine Lernkarten App in der Android Entwicklungsumgebung

ubo,
@ubo@social.tchncs.de avatar

@InJedemFall Ach, ich kann alles tragen. Meine geradezu überirdische Schönheit überstrahlt sowieso alles andere.

@RonRevog @koje71 @BrauchC

RonRevog,
@RonRevog@social.tchncs.de avatar

@ubo @InJedemFall @koje71 @BrauchC

Ich kann auch alles tragen. Meistens nach dem Einkaufen.

ArmouredWizard,
@ArmouredWizard@dice.camp avatar

Yet another plea for information:
Are there any resources out there that deal with writing data to multiple tables?

I 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,
@ArmouredWizard@dice.camp avatar

@rivetgeek where a Transaction is a group of hand-coded SQL to be executed together?

(It me! I'm trashing the data!)

rivetgeek,
@rivetgeek@dice.camp avatar

@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,
@ArmouredWizard@dice.camp avatar

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...
bocops,
@bocops@fosstodon.org avatar

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,
@ArmouredWizard@dice.camp avatar

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?

ArmouredWizard,
@ArmouredWizard@dice.camp avatar

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,
@ArmouredWizard@dice.camp avatar

@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,
@ArmouredWizard@dice.camp avatar

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!

rivetgeek,
@rivetgeek@dice.camp avatar

@kevin @ArmouredWizard Yeah totally. A GM may have multiple groups though and might have some thing with characters shared between them or something.

ArmouredWizard,
@ArmouredWizard@dice.camp avatar

@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,
@ArmouredWizard@dice.camp avatar

...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,
@bocops@fosstodon.org avatar

@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,
@bocops@fosstodon.org avatar

@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
@koje71@darmstadt.social avatar

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.

Ein unfertiges Spiel in einer Android Entwicklungsumgebung.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • Kotlin
  • GTA5RPClips
  • DreamBathrooms
  • thenastyranch
  • magazineikmin
  • tacticalgear
  • cubers
  • Youngstown
  • mdbf
  • slotface
  • rosin
  • osvaldo12
  • ngwrru68w68
  • kavyap
  • InstantRegret
  • JUstTest
  • everett
  • Durango
  • cisconetworking
  • khanakhh
  • ethstaker
  • tester
  • anitta
  • Leos
  • normalnudes
  • modclub
  • megavids
  • provamag3
  • lostlight
  • All magazines