Baidyanath
09/13/2021, 12:58 PMMichael Ralston
09/17/2021, 10:38 AMRob Elliot
09/17/2021, 5:03 PMtherealbluepandabear
09/22/2021, 10:45 PMimport kotlin.random.Random
fun main(args: Array<String>) {
val quizCreator = QuizCreator()
quizCreator.makeQuiz()
}
class QuizCreator {
private val quizInstance = Quiz("", listOf())
fun makeQuiz() {
println("Choose quiz name:")
quizInstance.quizName = readLine().toString()
while (true) {
println("New Question? (Y/n)")
if (readLine()?.lowercase() == "y") {
var question = Question(null, null)
println("Question name?")
question.questionText = readLine()
println("Question answer?")
question.questionAnswer = readLine()
quizInstance.questions.toMutableList().add(question)
println(quizInstance.questions[0])
} else {
println("OK")
quizInstance.startQuiz()
break
}
}
}
}
data class Quiz(var quizName: String, val questions: List<Question>) {
fun startQuiz() {
for (question in questions) {
println(question.questionText)
val answer = readLine()
if (answer?.lowercase() != question.questionAnswer?.lowercase()) {
println("Incorrect, the answer was ${question.questionAnswer}")
} else {
println("Correct")
}
}
}
}
data class Question(var questionText: String?, var questionAnswer: String?)
ok so I have this code, and for some reason when running this it's saying that the list of questions is empty:
Choose quiz name:
j
New Question? (Y/n)
y
Question name?
j
Question answer?
j
Exception in thread "main" java.lang.IndexOutOfBoundsException: Empty list doesn't contain element at index 0.
at kotlin.collections.EmptyList.get(Collections.kt:36)
at kotlin.collections.EmptyList.get(Collections.kt:24)
at QuizCreator.makeQuiz(Main.kt:32)
at MainKt.main(Main.kt:5)
Process finished with exit code 1
Justin (Midas) Gilman
09/27/2021, 7:55 PMjava.lang.AbstractMethodError: Receiver class kotlin.jvm.functions.Function1$Subclass0 does not define or inherit an implementation of the resolved method 'abstract java.lang.Object invoke(java.lang.Object)' of interface kotlin.jvm.functions.Function1.
Here's my test:
@Test
fun `attempt 2`() {
val routing = mockk<Routing>(relaxed = true)
val configure = slot<Route.() -> Unit>()
val mockedRoute = mockk<Route>()
every { any<Route>().static(capture(configure)) } answers {
configure.captured.invoke(mockedRoute)
mockedRoute
}
var testObj = ResourcePortalModuleRouter(routing, node)
testObj.attachPortalCoreRoutes()
verify {
mockedRoute.default("index")
}
}
The error is thrown on the every
line, and I don't understand why this isn't workingTiago Nunes
09/29/2021, 10:57 AMAutoRefreshToken
interceptor plugin in my Ktor client (HttpClient
), which is supposed to see if the response is a token time-out error, and if it is, generate a new token and resend the request.
For getting the response, should I intercept the receivePipeline
or the responsePipeline
?Tiago Nunes
09/29/2021, 1:57 PMHttpRequest
?
I want to send a new request in responsePipeline
based on the previous request, with a small difference in the bodyMarcus Brito
10/01/2021, 12:55 PMFranco
10/01/2021, 11:10 PMrunBlocking
to call suspend tunctions for now, but it doesn't sound right 🤔Berkay
10/06/2021, 10:56 AMKartick Vijayakumar
10/13/2021, 5:51 PMjasman arora
10/14/2021, 11:04 AMMarcus Widegren
10/15/2021, 11:46 AMspierce7
10/17/2021, 9:55 PMLuiz Aguiar
10/21/2021, 8:55 PMCharles Jo
10/22/2021, 1:29 AMtherealbluepandabear
10/23/2021, 2:39 AMEmmaG
10/24/2021, 5:31 PMCarlos Rodriguez Bollain
10/26/2021, 10:42 AMDavid Smith
10/27/2021, 9:25 AMGuilherme Gomes Correia
10/29/2021, 9:37 PMChukwukammadu Anizoba
11/03/2021, 6:40 AMKhurram Malik
11/03/2021, 1:26 PMLuiz Aguiar
11/03/2021, 10:16 PMEmil Kantis
11/04/2021, 8:17 AMipolyzos
11/04/2021, 9:06 AMGeert
11/07/2021, 2:26 PMsay "hello"
but when I print this with kotlin it is not working, I also tried afplay /System/Library/Sounds/Ping.aiff
which is working in terminal, but not when using println or logger.info()edrd
11/08/2021, 4:04 PMFolger Fonseca
11/09/2021, 11:13 AMKhurram Malik
11/12/2021, 9:34 AM