Ayla
08/22/2023, 8:24 AMManasseh
08/22/2023, 4:10 PMIshlahul Hanif
08/23/2023, 3:41 AMTauhid Rehman
08/28/2023, 4:06 AMUme Channel
08/31/2023, 4:29 AMYash
09/01/2023, 7:17 PMYash
09/02/2023, 10:38 PMLoïc Lamarque
09/04/2023, 11:30 AMJvmName
annotation. Another one could be to convert these inline value classes to regular ones, but we will lose their performance benefits...
Also, when analyzing the binary code, I notice that using these type of classes narrows our understanding of it: the compiler replaces them by their underlying type. So I'm thinking about their tradeoff on performance and readability. Do you have any thoughts on this?
Thanks!ruither
09/05/2023, 11:51 AMFernando
09/05/2023, 8:26 PMAsaf Peleg
09/06/2023, 4:11 AMput
on each field. Since my data class would need an empty constructor I'd have to set defaults or make all of my fields optional, but neither seems ideal.
Is there some trick or alternative to data classes that I could use or should I just be using a plain old class for this instead?hello
09/06/2023, 1:56 PMfun main() {
GlobalScope.launch {
val client = HttpClient(CIO) {
install(WebSockets) {
pingInterval = 40_000
}
}
println("sendingxxx")
client.wss(host = "<http://example.com|example.com>", path = "/socket/websocket") {
}
}
embeddedServer(Netty, port = 8083, host = "0.0.0.0", module = Application::module)
.start(wait = true)
}
fun Application.module() {
configureSecurity()
configureSerialization()
configureRouting()
}
solonovamax
09/06/2023, 6:24 PMSlackbot
09/07/2023, 2:41 AMUme Channel
09/07/2023, 11:13 AMecho
09/08/2023, 5:33 AMUme Channel
09/12/2023, 12:10 PMAsaf Peleg
09/30/2023, 5:38 AMch.qos.logback.classic.encoder.JsonEncoder
doesn't want to serialize kotlinx.datetime.LocalDateTime
It seems that the underlying encoder uses Jackson and I'm wondering if I have to pass something special to the encoder to make it work? Can't seem to find any info online about that and wondering if someone has run across this before.joel
10/02/2023, 6:10 PMeither
for handler different errorsMod
10/03/2023, 12:52 PMkhan husnain
10/03/2023, 3:31 PMimport org.springframework.http.HttpStatus
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.ControllerAdvice
import org.springframework.web.bind.annotation.ExceptionHandler
import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler
@ControllerAdvice
class GlobalExceptionHandler {
@ExceptionHandler(Exception::class)
fun handleGenericException(ex: Exception): ResponseEntity<Any> {
val errorMessage = "An unexpected error occurred: ${ex.message}"
return ResponseEntity(errorMessage, HttpStatus.INTERNAL_SERVER_ERROR)
}
@ExceptionHandler(value = [ArithmeticException::class])
fun handleArithmeticException(ex: ArithmeticException): ResponseEntity<Any> {
val errorMessage = "An arithmetic error occurred: ${ex.message}"
return ResponseEntity(errorMessage, HttpStatus.INTERNAL_SERVER_ERROR)
}
@ExceptionHandler(RuntimeException::class)
fun handleRuntimeException(exception: RuntimeException): ResponseEntity<Any> {
return ResponseEntity
.status(HttpStatus.INTERNAL_SERVER_ERROR)
.body("abc bab")
}
}
Issue I am facing right now is that when i throw an exception in my controller, it is not invoking the GlobalExceptionHandler, here is the controller code.
package com.example.balancesservice
import org.apache.http.HttpStatus
import org.springframework.http.HttpStatusCode
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RestController
import org.springframework.web.server.ResponseStatusException
@RestController
class HealthController {
@GetMapping("/health")
fun healthCheck(): String {
throw Exception("Div by zero not all")
}
}
Can anyone please guide?blbulyandavbulyan
10/09/2023, 8:51 AMblbulyandavbulyan
10/09/2023, 8:52 AMNihan
10/09/2023, 1:57 PMsimon.vergauwen
10/09/2023, 5:17 PMAsaf Peleg
10/11/2023, 2:34 AMLaurent Thiebaud
10/16/2023, 3:00 PMcontext(Transaction?)
fun doStatementReuseOrCreateTransaction(statement: suspend Transaction.() -> Unit) {
if (this@Transaction == null) {
openTransaction {
statement()
}
} else statement()
}
However as soon as I make the context optional (with the ?
) then intellij is lost and doesn't understand this@Transaction
anymore
is there any way to make it work?Saher Al-Sous
10/17/2023, 11:01 AMSpring Boot
, I loaded the model successfully, and created the needed tensor, but I can't make a call to get the result from the model because of this error:
Caused by: org.tensorflow.exceptions.TFInvalidArgumentException: Expects arg[0] to be float but uint8 is providedI checked the model signature and it was like this:
Method: "tensorflow/serving/predict"
Inputs:
"input_1": dtype=DT_FLOAT, shape=(-1, 299, 299, 3)
Outputs:
"dense_3": dtype=DT_FLOAT, shape=(-1, 41)
Signature for "__saved_model_init_op":
Outputs:
"__saved_model_init_op": dtype=DT_INVALID, shape=()
my tensor details are DT_UINT8 tensor with shape [299, 299, 3]
.
When I changed my tensor data type into float like this:
val imageShape = TFloat32.tensorOf(runner.fetch(decodeImage).run()[0].shape())
val reshape = tf.reshape(
decodeImage,
tf.array(
-1.0f,
imageShape[0].getFloat(),
imageShape[1].getFloat(),
imageShape[2].getFloat())
)
I got this error:
org.tensorflow.exceptions.TFInvalidArgumentException: Value for attr 'Tshape' of float is not in the list of allowed values: int32, int64how can I fix this problem? if someone is curious how I loaded the model, created the tensor and called it, here is the code below Loading the model in `TFServices`:
fun model(): SavedModelBundle {
return SavedModelBundle
.loader("/home/saher/kotlin/Spring/machinelearning/src/main/resources/pd/")
.withRunOptions(RunOptions.getDefaultInstance())
.load()
}
Building the Tensor and calling the model
val graph = Graph()
val session = Session(graph)
val tf = Ops.create(graph)
val fileName = tf.constant("/home/***/src/main/resources/keyframe_1294.jpg")
val readFile = tf.io.readFile(fileName)
val runner = session.runner()
val decodingOptions = DecodeJpeg.channels(3)
val decodeImage = tf.image.decodeJpeg(readFile.contents(), decodingOptions)
val imageShape = runner.fetch(decodeImage).run()[0].shape()
val reshape = tf.reshape(
decodeImage,
tf.array(
-1,
imageShape.asArray()[0],
imageShape.asArray()[1],
imageShape.asArray()[2])
)
val tensor = runner.fetch(reshape).run()[0]
val inputMap = mutableMapOf("input_tensor" to tensor)
println(tensor.shape())
println(tensor.dataType())
println(tensor.asRawTensor())
val result = tfService.model().function("serving_default").call(inputMap)
regardsAndrew O'Hara
10/17/2023, 7:27 PMLoïc Lamarque
10/23/2023, 6:52 PM