Steve
04/28/2020, 5:53 PMvoben
04/29/2020, 2:17 AM!!
?.
huehnerlady
04/29/2020, 7:02 AMjvmTarget
that version 1.3.72 seems to support Java13, but when I try it out I get the error “Unsupported class file major version 57”, which made me wonder if it was supported after all? 🤔Tom Carton
04/29/2020, 9:44 AMChat Mobile Application
as such:
- a server in Kotlin
- clients using KotlinMultiplatform/Kotlin-native
I want to use sockets to exchange encrypted messages (using a simple xor for instance) in the common/shared part using Posix.
Each client displays all the messages and can send new message to the server.
The server serves all the clients with any message it received.
Nothing fancy on that side...
And the main thing I am trying to demonstrate with all this, is how I could share the maximum of code between platforms using Kotlin-native
and have clients code only responsible for the UI. Period.
So I tried to use Coroutines
to have a background thread listening to incoming messages.
These messages could come from socket (in order to be dispatched to the UI) or from UI (in order to be dispatched to socket).
But sounds like it doesn't work like this as my application often get stuck or the coroutines stop running.
I tried to use a heartbeat to wakeup the coroutines or some time-out to prevent getting stuck but this is clearly black magic and doesn't succeed anyway.
Do you have any idea or insight to point out on what I should rather do? or on what I am doing wrong?
Thank you!Chilli
04/29/2020, 9:29 PMinit start
and after a few seconds, displays Test running process exited unexpectedly.
Any idea what might it be?
str is String
used is MutableSet<String>poohbar
04/30/2020, 1:41 PMentity::class
Yevhenii Nadtochii
04/30/2020, 2:04 PMinterface Action
class Outer(doer: Doer = this.Doer()) : Action by doer { //'this' is not defined in this context
inner class Doer : Action
}
or
interface Action
class Outer : Action by Doer() { //Constructor of inner class Doer can be called only with receiver of containing class
inner class Doer : Action
}
Nicolò
04/30/2020, 9:36 PMAlex Kuznetsov
05/01/2020, 8:01 PMevery { <http://myThing.do|myThing.do>() } returns 1 andThenThrows Exception("No way!") andThen 3 andThen 4
the line gets too wide, is there a way to continue it:
every { <http://myThing.do|myThing.do>() } returns 1
andThenThrows Exception("No way!")
andThen 3
andThen 4
TIA!Sudhir Singh Khanger
05/04/2020, 12:47 PMprivate fun twoSome(nums: IntArray, target: Int): IntArray {
val returnArray: IntArray = intArrayOf()
var initialVal = nums[0]
for (num in nums) {
if (initialVal + num == target) {
returnArray[0] = initialVal
returnArray[1] = num
break
}
initialVal = num
}
return returnArray
}
Why am I getting ArrayIndexOutOfBoundsException
when assigning a value to the returnArray
?voben
05/06/2020, 2:25 PMŁukasz Patro
05/11/2020, 9:59 AM[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.635s
[INFO] Finished at: Mon May 11 11:52:50 CEST 2020
[INFO] Final Memory: 7M/231M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.jetbrains.kotlin:kotlin-maven-plugin:1.3.72:compile (compile) on project untitled: Execution compile of goal org.jetbrains.kotlin:kotlin-maven-plugin:1.3.72:compile failed: Unable to load the mojo 'compile' in the plugin 'org.jetbrains.kotlin:kotlin-maven-plugin:1.3.72' due to an API incompatibility: org.codehaus.plexus.component.repository.exception.ComponentLookupException: org/jetbrains/kotlin/maven/K2JVMCompileMojo : Unsupported major.minor version 52.0
It builds fine with JDK 8. pom.xml
is very simple:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="<http://maven.apache.org/POM/4.0.0>" xmlns:xsi="<http://www.w3.org/2001/XMLSchema-instance>" xsi:schemaLocation="<http://maven.apache.org/POM/4.0.0> <http://maven.apache.org/maven-v4_0_0.xsd>">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>untitled</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>org.example untitled</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<kotlin.version>1.3.72</kotlin.version>
<kotlin.code.style>official</kotlin.code.style>
</properties>
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib</artifactId>
<version>${kotlin.version}</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>src/main/kotlin</sourceDirectory>
<testSourceDirectory>src/test/kotlin</testSourceDirectory>
<plugins>
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<version>${kotlin.version}</version>
<executions>
<execution>
<id>compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>test-compile</id>
<phase>test-compile</phase>
<goals>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
It seems that kotlin-maven-plugin
do not support Java before version 8...Cupi Vo
05/12/2020, 12:40 AMAnton
05/12/2020, 2:31 PMfun <R>myFunc(block: () -> R): R
{
println("starting)
try
{
return block()
}
finally
{
println("end")
}
}
As in the example above, I would like to do some things before the functions run, and some things after. An example would be to measure the execution time. Appreciate any help!Kevin
05/13/2020, 6:14 PMinclude
of the support activity layout on the main activity file.
the next thing i want to do, is that i want to be able to interact with the support activity, which is the basic interaction was only a show/hide elements. i was thinking that i should be able to do this by using visibility = View.GONE
or visibility = View.VISIBLE
on the textview element, but no matter what i do, everytime i click on the textview, it results in the app crashing.
i'm quite stuck on this part, do anyone have any idea or insight on where do i wrong? or what should i do?
thank you!still-dreaming-1
05/13/2020, 8:10 PMMauricio Barbosa
05/13/2020, 8:36 PMclass UserApiClient(private val rxJavaBasedApi) {
suspend fun getUser(): User = withContext(<http://Dispatchers.IO|Dispatchers.IO>) {
rxJavaBasedApi.getUser().blockingGet()
}
}
Or there's a better approach?Kevin
05/14/2020, 3:48 PMvar isColorChanged: Boolean? = true;
fun changeScreenClick(view: View) {
if(isColorChanged==true){
view_menu_1.resources.getColor(R.color.Yellow)
}
else{
view_menu_2.resources.getDrawable(R.drawable.background_box)
}
}
Thank you!Karlo Lozovina
05/16/2020, 10:31 PMkotlinx.serialization
, just can't figure out how to deserialize to LocalDateTime
Ananiya
05/17/2020, 7:51 AMval l = listOf(d1, d2, d3 ,d4 ,d7)
. how do i select the last element in the list but i cannot use l[5]
or l.get(5)
because they may change the list length in any time ?Mark
05/17/2020, 12:19 PMsupra
05/18/2020, 5:49 AMwhen (func()) {
in S -> println("$it in S")
null -> println("null")
else -> println("$it not in S")
}
Mark
05/18/2020, 6:55 AMbodiam
05/18/2020, 10:52 AMreturn doubleArrayOf(base, tokenSort, tokenSet).max()!!.toInt()
And I'd like to get rid of the !!
here, especially since I know this call will never return null. Any suggestions on how to do this?Hixie
05/19/2020, 3:32 AMfrogger
05/19/2020, 10:55 AMoverride fun extractAuthentication(map: MutableMap<String, *>)
e.g. when I want to add a list the compiler says: “Required Any? found List<String>”Joshua Akinsola
05/20/2020, 10:49 AMRaj Trivedi
05/20/2020, 11:15 AMJP
05/20/2020, 2:42 PMfold
? Or is a normal for
loop the only option?Joshua Akinsola
05/20/2020, 3:36 PM