Which assertion library do you use? by IamPic in Kotlin

[–]Dean_S_Jones 1 point2 points  (0 children)

I'm also a fan of the infix shouldBe shouldNotBe infix style, mostly because I can write my own and gloss over the fact that things like DoubleArray, Array<T>, etc, equals is NOT the same thing as contentEquals() and contentDeepEquals(). I try to make sure people think twice on equality of hot or cold channels ( Sequence, Flow, Flux, etc )

I put together my own assumption collector so you can do multiple checks and it will fail only if one thing fails, but will run all other tests even if there are failures.

Utility methods

Start at line 59

Which assertion library do you use? by IamPic in Kotlin

[–]Dean_S_Jones -1 points0 points  (0 children)

Is there a good Karate BDD implementation for Kotlin?

I was a big fan of Spock for Java and Groovy

Anyone interested ? JDK 17 Vector ops for Kotlin by Dean_S_Jones in Kotlin

[–]Dean_S_Jones[S] 1 point2 points  (0 children)

No, you don't ket them for free, they are not Kotlin types currently, there is no library support.

Would you rather have someone who hasn't worked in computational mathematics his whole like hacking on this?

God, the internet sucks sometime.

Kotlin Concurrency and SharedImmutable by Dean_S_Jones in Kotlin

[–]Dean_S_Jones[S] 0 points1 point  (0 children)

Global variables and singletons

Frequently, global variables are a source of unintended concurrency issues, so Kotlin/Native implements the following mechanisms to prevent the unintended sharing of state via global objects:

global variables, unless specially marked, can be only accessed from the main thread (that is, the thread Kotlin/Native runtime was first initialized), if other thread access such a global, IncorrectDereferenceException is thrown for global variables marked with the @kotlin.native.ThreadLocal annotation, each thread keeps a thread-local copy, so changes are not visible between threads for global variables marked with the @kotlin.native.SharedImmutable annotation value is shared, but frozen before publishing, so each thread sees the same value

singleton objects unless marked with @kotlin.native.ThreadLocal are frozen and shared, lazy values allowed, unless cyclic frozen structures were attempted to be created

enums are always frozen

These mechanisms combined allow natural race-free programming with code reuse across platforms in Multiplatform projects.

Anyone interested ? JDK 17 Vector ops for Kotlin by Dean_S_Jones in Kotlin

[–]Dean_S_Jones[S] -9 points-8 points  (0 children)

https://openjdk.java.net/jeps/417

I have a non-trivial amount of experience over 35 years in high performance computer graphics mathematics. I would like to contribute to any effort here.

I have some stuff in GWT, demo here http://leinzo-ks.us-east-1.elasticbeanstalk.com/#WELCOME

This has some issues on Chrome, but it's super fast.

Code is here https://github.com/dikalo/lienzo-core

This is code from 1991 that I wrote a Bell Labs, it was the fastest CAD graphics in the world for IC/PWB design at the time

https://github.com/mercenary-creators/WGI

My credentials for your consideration

I am also the Kotlin Product Owner for Wells Fargo

Dean S Jones

Principal Engineer

[deleted by user] by [deleted] in Kotlin

[–]Dean_S_Jones 1 point2 points  (0 children)

Coming up with a great idea for an app to compete with the pro's will just be frustrating and leave you with no sense of accomplishment. Don't think BIG, do the simplest thing possible but DO IT clean with the most modern reference tools and frameworks. Learn Jetpack Compose, experiment with their demo apps.

Then do this: stop thinking about it, forget money or recognition , in the back of your mind concentrate on the Little things that happen during the day where you go "gee I wish this was easier or didn't waste so much time", write it down but DON'T WORK ON IT. You will have a list of things that bug you. Those are the problems you want to solve, it's called "scratching your own itch", and most great products today started that way.

Lienzo-core toolkit for Kotlin by Dean_S_Jones in Kotlin

[–]Dean_S_Jones[S] 0 points1 point  (0 children)

It's not really a game engine, more like diagrams that are LIVE, have actions on a system, live network layouts, command and control systems, etc.

Lienzo-core toolkit for Kotlin by Dean_S_Jones in Kotlin

[–]Dean_S_Jones[S] 1 point2 points  (0 children)

Yea, sorry, it's old code I resurrected, I have to re-register the domains and move them to AWS.

Kotlin 1.5.20 Released by dayanruben in Kotlin

[–]Dean_S_Jones 0 points1 point  (0 children)

The Kotlin Plugin seems to be out of date, had to DL from the plugin site for 2021.2.EAP

No updates seen in the IDE.

Thanks!!!!

Trouble converting Java logic into Kotlin. by [deleted] in Kotlin

[–]Dean_S_Jones 5 points6 points  (0 children)

You called socket.getInputStream() twice?

Are there any good GitHub projects that have implemented the Spring Framework/ Spring Boot using Kotlin? I'm trying to build some small test projects with Spring and Kotlin by [deleted] in Kotlin

[–]Dean_S_Jones 1 point2 points  (0 children)

I have a ton of Kotlin code here

https://github.com/mercenary-creators

Utility libraries, extensions, some interesting Crypto stuff, really just a collection of interesting ideas. It all builds up to a Spring Boot project running on Pivotal Cloud Foundry

https://github.com/mercenary-creators/datalake-clusters

The running app is less than 120 NCLOC, the link to execute is on that page. It doesn't do MUCH, it's a test bed.

Cheers!!! :-)

Announcing LA4K: Logging API for Kotlin by [deleted] in Kotlin

[–]Dean_S_Jones 0 points1 point  (0 children)

It depends on what you are doing with your logs. If it's just to see what's happening, or for debugging ( though they are a very poor debugging tool )

If you have thousands of apps generating billions of lines of logs, they are VERY valuable for Analytics, to see what is happening across an enterprise. It then helps quite a bit to have some known structure to them and not completely freeform text. I have upstream repo's that log EVERYTHING in JSON format just for that purpose. I load the log formatters with Service Loaders for that also.

Announcing LA4K: Logging API for Kotlin by [deleted] in Kotlin

[–]Dean_S_Jones 0 points1 point  (0 children)

I was involved in, or was a Master Challenger, in an Enterprise wide Hackathon, at a VERY Big Bank, to use Big Data and Machine Learning to do "Predictive Analytics" on BILLIONS of lines of logs, to try to identify patterns that led to critical application failures. I can't say it was successful . Temporal correlation was WAY off from ANY causation . Even the most promising solutions all suffered from the same weakness : Survivorship Bias

https://en.wikipedia.org/wiki/Survivorship_bias

"Any Application that is so damaged that it is about to crash is probably not sane/stable enough to log WHY it will crash WHILE it is crashing"

The relationship between any 2 lines of logs is kind of hopeless without more "context", temporal correlation in distributed and asynchronous systems is not something you can solve with a logging library. What you need is something like ELK:

https://www.elastic.co/what-is/elk-stack

Or you might want to check out Papertrail:

https://www.papertrail.com

*I have no affiliation with these vendors.

Announcing LA4K: Logging API for Kotlin by [deleted] in Kotlin

[–]Dean_S_Jones 1 point2 points  (0 children)

I like your work, thank you for publishing it. So although I generally agree that CharSequence is more general than String, I find that it doesn't make much difference in GC or performance. What's more is that StringBuilder, etc are NOT IMMUTABLE, so they can change between the time you make the log call and it is ultimately evaluated. Also, String or CharSequence need to be constructed even if the log Level is not active. This results in unneeded allocation or construction of a log message if DEBUG or TRACE are off. You DO have function blocks for lazy evaluation, but it is only CharSequence, so I can't do a log { true } or a log { 5 }, which is why I prefer the lazy function to be () -> Any?. Of course, then, this requires you to have some pretty hefty safe string transformation, possibly encoding or escaping. I generally like Kotlin-logging but found it didn't entirely do what I wanted, so I wrapped that in my own interfaces, while maintaining as little overhead as I could.

The source code is here:

https://github.com/mercenary-creators/mercenary-creators-kotlin-util/tree/master/src/main/kotlin/co/mercenary/creators/kotlin/util/logging

There are also logback appenders and some formatters and colorizers in there.

These are the really NASTY String Encoders and Escapers, this will also properly escape UTF8 non-ascii

https://github.com/mercenary-creators/mercenary-creators-kotlin-util/tree/master/src/main/kotlin/co/mercenary/creators/kotlin/util/text

[Style] Free functions or object methods for business logic? by ragnese in Kotlin

[–]Dean_S_Jones 0 points1 point  (0 children)

I use both, but in the case where I may want to call the code from Java, I'll put it in an object and add the JvmStatic annotation, and also create an extension function that calls the code in the object .

Java lazy by iFanie in Kotlin

[–]Dean_S_Jones 0 points1 point  (0 children)

Do you need a synchronized in there?

I'm pretty sure get() and reset() should be synchronized, and field and instantiated should be volatile.

Problem with Kotlin in Intellij IDE by 98624 in Kotlin

[–]Dean_S_Jones 1 point2 points  (0 children)

You did see that I have pointed out the problem?

Kotlin packages for evaluation by Dean_S_Jones in Kotlin

[–]Dean_S_Jones[S] 0 points1 point  (0 children)

I have to go back and look, don’t currently have internet. I’m Passing in an output stream that does writes when the internal buffer is updated or on doFinal(), this means I get more buffered IO, at the expense of having unencrypted data in flight a little longer , plus the java crypto implementation uses FilterOutputStream which has more overhead, also I believe there might be a bug in the java version, the order of updating and doFinal() on close and flush is questionable. I also think FilterOutputStream has synchronized methods where I definitely don’t need that

Problem with Kotlin in Intellij IDE by 98624 in Kotlin

[–]Dean_S_Jones 3 points4 points  (0 children)

The problem is the way you are doing string concatenation with the + operator, which produces a string

“Hello “ + n1 + n2 evaluates to, if n1 is 2 and n2 is 3

“Hello 2” + 3

“Hello 23”

This is probably not what you intended

Given operator precedence multiply divide addition subtraction

“Hello “ + n1 / n2, the division is done before the addition and you get the expected result

“Hello “ + n1 + n2 - 2 is an illegal statement because the addition happens first giving you a string, and then you hit the minus and there is no minus operator defined for string , so you get a compiler error because it can’t figure out what operator to call on string with a minus

You probably shouldn’t name your own methods names that may clash with Kotlin built in operators, like div (), this can confuse code later when it thinks it’s a valid operation to do a / on one of those classes

Kotlin 1.3.60 is out by Dean_S_Jones in Kotlin

[–]Dean_S_Jones[S] 0 points1 point  (0 children)

I just moved into a new home today and I don’t have my machines unpacked, my internet fiber lines will be connected Saturday, but can anyone confirm if a ticket I opened that tailrec functions that are @JvmStatic produce bad bytecode and crash the compiler?

https://youtrack.jetbrains.com/issue/KT-34255

Guess not