Sunday, January 25, 2015

Presentations Lessons from Apple

4 Powerful Presentation Lessons from Apple — Prezi Blog (that is from Steve Jobs)

Protocol Buffers: base 128 "varint" encoding

Google's Protocol Buffers data serialization is fast and creates compact files,
compared to text formats (XML, JSON) and some binary serializations.
One of reasons is that metadata are not saved, external schema is required, so it i not self-describing,
and a integer values are stored in compact way: smaller numbers take less space

This technique is called "varint" and is very similar to UTF8 encoding for UNICODE characters,
in this case applied for integer numbers.

Encoding - Protocol Buffers — Google Developers
"Varints are a method of serializing integers using one or more bytes. Smaller numbers take a smaller number of bytes.

Each byte in a varint, except the last byte, has the most significant bit (msb) set – this indicates that there are further bytes to come. The lower 7 bits of each byte are used to store the two's complement representation of the number in groups of 7 bits, least significant group first."

1 (decimal) => 0000 0001 (encoded)

300 (decimal) => 1010 1100 0000 0010 (encoded)
has more bytes (1) first 7 data bits(010 1100) no more bytes(0) second 7 bits(000 0010)
000 0010  010 1100
→  000 0010 ++ 010 1100
→  100101100
→  256 + 32 + 8 + 4 = 300
Another example of decoding; "msb" (most significant bit) indicates if there is more bytes
96 01 = 1001 0110  0000 0001
       → 000 0001  ++  001 0110 (drop the msb and reverse the groups of 7 bits)
       → 1001 0110
       → 128 + 16 + 4 + 2 = 150
Obviously this encoding is good for some numbers and less good for others.
"150" would fit in one byte with all 8 bits ware used, 
but in this case it takes 2 bytes since first (msb) bit is a "continuation" flag.
This technique is useful in particular for "key" part of key/value pairs, 
since usually there is small number of fields for encoding. 

UTF8 encoding has the same issue with multi-byte languages like Japanese, 
where one character takes 3 x UTF8 bytes, or 1 x UTF16 word that is 2 bytes. 
In that case it is 50% less effective to use UTF8.
On the other side, for English language UTF8 takes 1 byte, 
and UTF16 takes 2 bytes, 100% increase.
Windows, .NET, Java, all use UTF16 in memory. 

Windows App Studio

Windows App Studio gets TouchDevelop programming language and web app templates, drops Windows Phone 8.0 | VentureBeat | Dev  
"Microsoft updated Windows App Studio, its free web-based tool designed to let anyone create an app, with support for TouchDevelop, a touch-friendly programming language that includes a physics engine and a user-interface framework for composing forms. The company also added universal Web App Template (WAT) creation — but dropped support for Windows Phone 8.0."

Windows App Studio–Free Tool to create apps in Windows Stores|Microsoft
"The Web App Template in App Studio allows you to create universal Windows apps from mobile websites"
Microsoft’s Windows App Studio and TouchDevelop integrate. Mobile First. Cloud first.

Android Studio 1.0

Android Studio 1.0 | Android Developers Blog
"Android Studio is (now) the official Integrated Development Environment (IDE) from the Android team. It is built on the popular IntelliJ IDEA (Community Edition) Java IDE."
(replacing Eclipse as the standard for Android application development)

Docker containers for Enterprise

Some are predicting that 2015 will be "the year of Docker"

Docker (software) - Wikipedia, the free encyclopedia
Docker uses resource isolation features of the Linux kernel such as cgroups and kernel namespaces to allow independent "containers" to run within a single Linux instance, avoiding the overhead of starting virtual machines.

The technology of containers is not new, Solaris had this 10 years ago, but it is now free and easy.

Docker releases first commercial product - SD Times
After two years of gathering hype and bringing attention to long-neglected Linux containers, Docker announced ... that it will offer Docker Hub Enterprise, its first commercial product offering, in February of 2015. Docker Hub Enterprise is an on-site version of the company’s popular online repository for Docker images.Docker

Getting Started with Docker @ CoreOS
Docker containers can boot extremely fast (in milliseconds!) which gives you unprecedented flexibility in managing load across your cluster.
How To Set Up a Private Docker Registry on Ubuntu 14.04 | DigitalOcean

IoT CPUs: ARM vs Intel

ARM will wrestle Intel to power the Internet of Things (interview) | VentureBeat | Gadgets | by Dean 
"In terms of volume there is no market in the world like mobile. Mobile, which includes tablets, is shipping hundreds of millions of units for us. It’s probably outshipping everything else 10 to 1"
(and most of mobile devices are running on ARM licensed CPU)

"The next biggest market for (ARM) is digital TV and set-top boxes. (ARM) is in 70 percent of the market in GPU-enabled DTV, which is pretty much all TVs now."

"ARM-based servers being shipped in commercial systems, and you do. They’re popular."

"The critical part there is not just the ARM low power, but the fact that we’re enabling diversification. Rather than saying, “The answer is this server or that server,” we say, “Here are our processors. Here’s our technology. Go build what you think you can make a successful product out of.”"

"Intel, the world’s biggest chip maker, is definitely investing heavily to take this (IoT) market for itself. But ARM isn’t about to let that happen, according to Davies."

CPU micro-code standardization is very useful, but with modern compilers, there may be an opportunity to further optimize hardware for specific tasks. Microsoft Research is working on this, and likely are makers of processors. With expected volume of IoT devices, we could expected next generation of processing platform also.