How to get fields of a Julia object

For v0.7+ Use fieldnames(x), where x is a DataType. For example, use fieldnames(Date), instead of fieldnames(today()), or else use fieldnames(typeof(today())). This returns Vector{Symbol} listing the field names in order. If a field name is myfield, then to retrieve the values in that field use either getfield(x, :myfield), or the shortcut syntax x.myfield. Another useful and … Read more

How to convert a Kotlin data class object to map?

I was using the jackson method, but turns out the performance of this is terrible on Android for first serialization (github issue here). And its dramatically worse for older android versions, (see benchmarks here) But you can do this much faster with Gson. Conversion in both directions shown here: import com.google.gson.Gson import com.google.gson.reflect.TypeToken val gson … Read more

node.js store objects in redis

Since the socket is of type Object, you need to convert the object to a string before storing and when retrieving the socket, need to convert it back to an object. You can use JSON.stringify(socket) to convert to a string and JSON.parse(socketstr) to convert back to an object. Edit: Since the release of version 2.0.0, … Read more

tech