Saturday, May 11, 2019

Android: Kotlin first

Kotlin is now Google’s preferred language for Android app development | TechCrunch

"Google today announced that the Kotlin programming language is now its preferred language for Android app developers.

“Android development will become increasingly Kotlin-first,” Google writes in today’s announcement. “Many new Jetpack APIs and features will be offered first in Kotlin. If you’re starting a new project, you should write it in Kotlin; code written in Kotlin often mean much less code for you–less code to type, test, and maintain.”

data: UBER vs JSON => MessagePack

Putting the Squeeze on Trip Data

pareto frontParetoFront
Key conclusions:
  • Simply compressing JSON with zlib would yield a reasonable tradeoff in size and speed. The result would be just a little bigger, but execution was much faster than using BZ2 on JSON.
  • Going with IDL-based protocols, Thrift and Protocol Buffers compressed with zlib or Snappy would give us the best gain in size and/or speed.

...settled on MessagePack with zlib (instead of plain JSON)

A 1 TB disk will now last almost a year (347 days),
compared to a month (30 days) without compression
.

MessagePack: It's like JSON. but fast and small.

"MessagePack is an efficient binary serialization format.
It lets you exchange data among multiple languages like JSON.
But it's faster and smaller.
Small integers are encoded into a single byte,
and typical short strings require only one extra byte in addition to the strings themselves."

Designing Schemaless, Uber Engineering's Scalable Datastore Using MySQL | Uber Engineering Blog




Prettier with VS Code


Prettier · Opinionated Code Formatter

An opinionated code formatter
Supports many languages
Integrates with most editors
Has few options

prettier/prettier-vscode: Visual Studio Code extension for Prettier
@GitHub

1. CMD + Shift + P -> Format Document
OR
1. Select the text you want to Prettify
2. CMD + Shift + P -> Format Selection
Format On Save


// Set the default
"editor.formatOnSave": false,
// Enable per-language
"[javascript]": {
    "editor.formatOnSave": true
}

Automated code formatting with Prettier

Use Prettier in Visual Studio Code - YouTube