This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import jakarta.validation.Valid | |
import org.apache.logging.log4j.LogManager | |
import org.springframework.data.annotation.Id | |
import org.springframework.data.relational.core.mapping.Column | |
import org.springframework.data.relational.core.mapping.Table | |
import org.springframework.data.repository.CrudRepository | |
import org.springframework.http.ResponseEntity | |
import org.springframework.stereotype.Repository | |
import org.springframework.stereotype.Service | |
import org.springframework.transaction.annotation.Transactional |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package nl.sourcelabs; | |
import com.hexadevlabs.gpt4all.LLModel; | |
import java.nio.file.Path; | |
import java.time.LocalDateTime; | |
public class Gpt4allJavaExample { | |
private String modelPath = "/Users/soudmaijer/gpt4all/models/ggml-gpt4all-j-v1.3-groovy.bin"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package nl.sourcelabs.springbootcamel | |
import org.apache.camel.CamelContext | |
import org.apache.camel.builder.RouteBuilder | |
import org.springframework.boot.autoconfigure.SpringBootApplication | |
import org.springframework.boot.runApplication | |
import org.springframework.context.annotation.Bean | |
@SpringBootApplication | |
class SpringBootCamelApplication { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun using_with() { | |
val stringBuilder = StringBuilder() | |
stringBuilder.append("Hello") | |
stringBuilder.append(", Kotlin!") | |
print(stringBuilder.toString()) | |
} | |
fun using_also(a: Int): Int { | |
val b = a * 10 | |
if (b > 100) print(">100") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.IOException | |
fun bar() { | |
throw IOException() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package nl.sourcelabs.kotlinflowboot.server | |
import kotlinx.coroutines.delay | |
import kotlinx.coroutines.flow.flow | |
import org.springframework.boot.autoconfigure.SpringBootApplication | |
import org.springframework.boot.runApplication | |
import org.springframework.http.MediaType | |
import org.springframework.web.bind.annotation.GetMapping | |
import org.springframework.web.bind.annotation.RestController |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import kotlinx.coroutines.async | |
import kotlinx.coroutines.delay | |
import kotlinx.coroutines.runBlocking | |
suspend fun loadImage200(name: String) { | |
delay(2000) // simulate slow behaviour | |
} | |
fun loadImage404(name: String) { | |
throw RuntimeException("Image not found: $name") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import kotlinx.coroutines.Deferred | |
import kotlinx.coroutines.GlobalScope | |
import kotlinx.coroutines.async | |
import kotlinx.coroutines.coroutineScope | |
import kotlinx.coroutines.delay | |
import kotlinx.coroutines.runBlocking | |
fun main() { | |
lateinit var a: Deferred<Nothing> | |
lateinit var b: Deferred<Unit> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import kotlinx.coroutines.GlobalScope | |
import kotlinx.coroutines.async | |
import kotlinx.coroutines.delay | |
import java.lang.Thread.sleep | |
fun main() { | |
val a = GlobalScope.async { throw RuntimeException() } | |
val b = GlobalScope.async { delay(2000).also { println("I leaked!") } } // Will not be printed! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import kotlinx.coroutines.GlobalScope | |
import kotlinx.coroutines.async | |
import kotlinx.coroutines.delay | |
import java.lang.Thread.sleep | |
fun main() { | |
val a = GlobalScope.async { throw RuntimeException() } | |
val b = GlobalScope.async { delay(2000).also { println("I leaked!") } } // Will not be printed! |
NewerOlder