Introduction to Postgres Wire Protocol Postgres uses Message based protocol to comunicate between clients( for eg. psql) and DB server. I will try to summarize some aspects of the protocol.
Current version is 3.0 Supports TCP/IP and Unix domain sockets (IPC Sockets). Each connection goes through 3 phases - Startup Phase Normal Phase Termination Phase Startup Phase Client opens connection by sending startup message. The structure of a startup message is as follows - 4 byte 4 bytes Length of message Protocol Version Message Data like username, database name etc Server checks the message data from above and also its own config files, to determine the response, which can be one of the following - A success response (AuthenticationOk) An error response (ErrorResponse) Authentication related messages( like AuthenticationMD5Password) Protocol negotiation response (NegotiateProtocolVersion) If the response was AuthenticationOk then server sends some more messages, but the most important of them is ReadyForQuery message.
Introduction Kafka is an event streaming platform, which provides following functionalities
publish and subscribe events store events indefinitely process and analyze events Event An event has 3 main properties
key value timestamp Each event is a part of a stream, which stores its sequence for hundreds of years. They are encoded commonly using AVRO by Kafka Clients
Streams and KTables Streams KTables Provides immutable Data Provides mutable data Supports only inserts for new data Supports insert, update and delete Both are concepts of Kafka’s processing layer, which work on “raw” data in topics.
Iterables and Looping For looping over iterables, ES6 provides us with for of loop For looping over an object, Use Object.keys or .values in for of loop. Also, can use a for in loop where it iterates of enumarable properties. It will however iterate on keys not value of objects. Symbols New primitive added in ES6 Always unique Useful for keys with same names but different values Not enumarable Classes Just a wrapper around prototype inheritence.
Understanding Scope The scope of a variable controls where it can be accessed from in the program. It can be of
Global Scope Function scope Block scope ( if / for etc ) Variable defination Variables can be defined with var, const and let keywords.
var keyword is function scoped let and const keyword are block scoped. this keyword Different from how other languages use this.
number string boolean undefined null Symbol Objects Objects can store a collection of data types, which are then called properties. Each property has a key and value key is of string data types value can be of any data type. If a value is a functon, its called as a method Equality in Objects == or === only tests if both operands are same objects.
Scala’s unified type system Any is the super type Defines methods like - equals, hashCode, toString AnyVal represents value types. Double Float Long Int Short Byte Char Unit - Only one instance can be there - () Boolean AnyRef represent refernce types like List Nothing is subclass for all value types. Null is subclass for all reference types. Should not be used in Scala code.
Significant points of Scala Developed by Martin Odersky in 2004. Is MultiParadigm - a blend of Functional and Object Oriented Paradigms Is statically typed Heavily uses Java libraries Encourages use of immutable data structures Basics Expressions are computable statements. For example 1+1
Values are names for results for expressions. Example val x = 1 + 1
These are immutable Variables are mutable names for expression results.
Animations Animations have always amazed me. Beautiful still images are brought to life, objects are set in motion, etc, all mainly depending how the animators imagined and implemented it, probably using a animation tool.
While my wife was making illustrations (portfolio), I decided to try my hands on some animations using Adobe After Effects. You can check it out here
Video Editing While this was fun, I also wanted to work on my Video Editing skills.
Recently I had to do a bit of reading on building Indexes in Postgres. Intrestingly I found some striking features about indexing types in Postgres
Extensions Postgres has a collection of extensions/modules. These are basically set of functions. One such module is pg_trgm. Quoting from the documentation- “pg_trgm provides functions and operators for determining the similarity of ASCII alphanumeric text based on trigram matching, as well as index operator classes that support fast searching for similar strings” Documentation