JSON Diffs and their role
Working on a CouchDB related Project. Made a submodule that will be used in it.
https://github.com/vasumahesh1/jsondiff-viewer
Diffs? Why?
CouchDB relies on eventual consistency. Conflicts are bound to come up and It’s essential for us (at StoreDock) to understand how the document grew out in the revision tree. Unfortunately there is no such module/app that enables viewing of Diffs between revisions and conflicts. So, I decided to make one.
Cheers
Apollo 11 Source Code
Apollo 11 guidance computer (AGC) source code is available on Github. :D
https://github.com/chrislgarry/Apollo-11
Discord Bots
Been addicted to Discord bots for a while. Decided to make a framework in JS which can help make discord bots modular. Till now every bot has its own implementation. There should be a wrapper over npm/node for Discord js based bots. It would be so awesome if Bots have an interface to implement and that’s all.
Till then:
https://github.com/vasumahesh1/discord-gist-bot
Made a simple bot that listens for Gist links, and outputs them in Markdown if needed. :D
Error Codes .... and gocb
GoCB is Couchbase’s official SDK in golang. Since StoreDock’s Warehouse is Couchbase, We are able to get awesome sub-second queries to the database. This is solely done from Javascript. But however recently we faced a bottleneck.
Javascript was slower in performing a Task (In this case it was creating a snapshot of a certain doc we use called Daily Aggregation Doc). As the name suggests it runs daily and this is where javascript took over 30mins to process 130,000 such docs. The entire process involved:
- SQS Push of 130K Objects
- SQS Receive Msg of 130K messages
- Couchbase 2 Reads and 1 Write per message (conditional write, but 99% of the time it was a write)
These 3 steps took over 30mins for a 6 workers in JavaScript consuming over 700-800MB (Since other services are also running)
Solution
Move to another home. So, we thought, If twitch.tv processes 10 billion messages per day on golang. It would be better to move such a repetitive operation to GoLang. Luckily couchbase has an official library called gocb.
But what’s the catch?
Well… Couchbase fails to deliver a stable SDK in my opinion. If we look at the godoc. Couchbase’s simple Get operation is returning a Golang error which is nothing but a string. There is literally no error code or error id :(
This makes it very hard as we have to rely on that string.
GO SDK:
bucket.Get(”DocumentID”)
returns “Key not found.” as error
NodeJS SDK:
bucket.Get(”DocumentID”)
returns { code: 11, error: “Key not found.“ } as error
Pro tip: Always return Error Codes.
Wanna see how we return error codes? :D This is how a StoreDock Error looks like:
Apart from:
err.code
We have something called:
subCodes
Sub Codes provide an abstract view on the flow of error. In the above code it says that there was a conflict in inserting and the document already exists. Hence the entire operation was errored because of that.
Officially a contributor to Electron
Recently contributed to github’s electron project. I changed a few segments of code in JavaScript that communicated with Blink (Chrome’s Printer). Basically Electron was limiting the sizes of Pages through JS. I removed that capability and provided a way to generate custom size PDFs apart from the standard sizes.
Sure it’s a small step but feels great to contribute to such an awesome project!
Concept Game: Paper Plane Trials
A concept game I made in the weekend (I am crappy at designing so bare with me). It's based on the same concept of "time modification" that I was experimenting earlier.
This was my concept game used in Michigan State University's Coursera Course.
A little more tilt.
Added a few more stuff to make it more versatile. There is a difference between this and the previous post.
First Post:
The Time & Position were Continuous. i.e The Drag was gradual. The speed used to change gradually based how much longer you held the button.
This Post:
The Position is divided into 3 finite steps. Specified by Tilt Level (yeah .. Tilt) as 0, 1, 2 . This gives a lot of control over the type of drag, and I can customize mechanics based on the tilt of the arrow.
Like for eg, the most elementary mechanic would be game speed based on Tilt. so for Tilt 2 or -2 (for left hand side) the drag would be a lot. The drag / speed transition is still gradual with the only difference being that speed is now divided into slabs based on tilt level.
Adding discrete steps makes the game a little more simple both for developer and for the user. I think this is a right step in the direction.
Tinkering with Game Speed
Experimenting with the ability to slow down the game time. It is very common in games which use some
sort of force resistance (like air drag, water’s buoyant force). The following GIF shows how we can slow the generation speed of random obstacles also.
ESL One Manila 2016
It was completely unexpected that Wings ESports would win the ESL One Manila. Never would have guessed in a hundred years!
Sunday was just an epic day for some high quality Dota games. :)