Posts

Showing posts from January, 2015

Wha is a Call Site in Programming?

Image
A call site is the location, the line of code where a specific function  is called by passing to it its arguments and receiving its return value.

Using the Same Language for Microservices, iOS Apps, and Browser / Web Apps

Image
You're looking for the appropriate language?  Kotlin  might be the language you're looking for! Here you can find some sample projects that show how it can actually be done: Sample iOS app, written in Kotlin, using Maven or Gradle for building   —  this is how it looks Browser app that shows how Kotlin can access HTML's DOM  — this is  how it looks Browser app written in Kotlin that uses HTML5' Canvas  — this is  how it looks Another Browser app that shows how Kotlin can be used to build HTML5 apps   — this is  how it looks …all projects should work out-of-the-box.

Kotlin/JavaScript HTML5 Canvas Example

Image
This is the  source for a simple Kotlin (JavaScript) HTML5 Canvas app  that lets one type a random series of letters. And this is  how it looks like .

Kotlin/JavaScript HTML5 Example for DOM Manipulation

Image
I just published a simple  Kotlin/JavaScript "getting started app"  that  shows the Unicode characters for a specific decimal range. And  this is how it looks like .

Kotlin JavaScript “Hello, World!” Project

Image
 This  GitHub repository  provides you with detailed instructions and an out-of-the-box working sample project to get started with Kotlin and its JavaScript transpilation  capability.

Comparison: Rust vs Go

Image
"They are not meant to be competing languages. They fill different needs, designed with different approaches and excels at different things. If you want to write low-level stuff, something that needs every tiny bit of performance, working directly with the hardware or graphics, and you want to handle the memory. Basically something that you'd use C/C++ to write, something like kernel, driver, graphics library, a big library that exposes a C interface for other languages to call, a game that couldn't work well if there are GC pauses, or something like what Mozilla is building: Servo, a new browser engine. Then go with Rust, just choose Rust, or plain C/C++ for that. I've made the mistake of "fanboyingly" choosing Go for this kind of task and it hurts, it's really stupid and inappropriate, even though Go can definitely do some, it's awkward. On the other hand, if you want to do something like writing a tool, a server, a web application, a network ap

Short Definition: Pessimistic Locking vs Optimistic Locking

Image
In Pessimistic Locking a lock is always applied to a modifiable resource once it is accessed in an — even potentially — modifiable transaction. A lock prevents other requests from modifying the resource as the current transaction proceeds. This is necessary to prevent other requests from modifying a resource whereas the current transaction assumes a certain state that is not given anymore as the resource has already been modified by a faster processing operation. This is the core problem that can also be addressed in a different way. In Optimistic Locking , no lock is applied . Instead once a resource is accessed, its state is temporary saved . After the transaction has modified the resource and is about to commit the modified resource to persistent storage, the resource is read again from persistent storage and compared to the temporary saved state from the beginning of the transaction. If the retrieved state differs from the previously temporary saved state of the

Escape @Value Spring Annotation in Kotlin

Image
If you are using Spring annotations like  Value(" ${repositoryServiceUri} ") in your Kotlin code, you might get compile-time errors like these Error:Kotlin: [Internal Error] org.jetbrains.jet.utils.KotlinFrontEndException: Exception while analyzing expression at (16,14) in /Users/alex/my/project/loxal/rest-kit/src/main/kotlin/net/loxal/soa/restkit/client/RepositoryClient.kt: repositoryServiceUri Error:Kotlin: Compiler terminated with exit code: 2 because the ${blub}  notation is also used by Kotlin for expression and literal resolution. So just add a backslash like Value(" \${repositoryServiceUri} ") and everything is going to be alright.