Skip to main content

Posts

GraphQL

GraphQL



What is GraphQL

It is a specification laid out by Facebook which proposed an alternative way to query and modify data. Think of it is an as a complimentary of REST/RPC.

Now head here and read the original graphQL documentation. It will take 2-3 hours tops but is a worthy read. This will help you build some impressions on it and help contrast against mine below:


Why use GraphQL

Core advantage

Instead of defining custom backend rpc/rest endpoints for every data-shape, graphql allows you to build a more general endpoint which give frontend/mobile engineers freedom and query and play with the data. It might be less efficient, add a bit more complexity (need for things like data-loader), harder to standardize and control client-contracts for. What it looses in complexity and control, it gains in flexibility and freedom - provided your data model is worth of a graphql-ish query How to tell if my data-model graphql-ish?Are there complex relationships between your models? Is there a need …
Recent posts

Backend - Tech refresher 2019

Hello there

As a software engineer, it is important to keep updating your skillsets by learning the latest programming-elements (includes paradigms, patterns, languages, tools and frameworks). This becomes a bit easy if you already working on the cutting edge of something. Even then, it is possible to go too deep and loose breadth.

I've taken upon myself to do a tech refresher every year. The intent is to read, experiment and understand these elements by spending anywhere between 4 days to 4 weeks. The ultimate goal is: "do I know most that I need to know to build a planet-scale backend tech-stack ground up"

I'll write up my learnings in posts to help myself (and maybe others) refer it.

Here is the initial list I'm thinking about:


RedisMySQL, GraphQLAurora, Mesos, KubernetesCadence, SWSCassandra, MangoDB, NoSQL, MySQL, Spanner, S<, DynDBELKFlink, Storm, Samza, SparkHadoop HDFS, Yarn, MapReduceHive, HBaseKafka, ZookeeperNW: http, Tcp, thrift, grpc, yarpc, Terraform,…

Import a list into Wunderlist - MacOS

I was bored on Christmas day and thought I ll read the wiki pages of all the 195 countries in the world. To keep track of the progress, I wanted to create a list of them in my favorite task-app Wunderlist.

A simple search got me the list, but now the problem is to import them into Wunderlist. Being on MacOS, it took me sometime to understand how apple-script + automator work, but at the end, it was trivial. 1. Goto Automator - New - Workflow 2. Add an AppleScript and paste the following
set U to {"Algeria", ... "Zimbabwe"} repeat with i from 1 to number of items in U set X to (item i of U) as text tell application "Wunderlist" activate tell application "System Events" delay 0.25 keystroke "N" using command down delay 0.25 keystroke (X) keystroke return end tell end tell end repeat The above script in Automator types out th…

About me

Hi,

I'm currently working as a software developer in the logistics industry in San Francisco. 
My aim is to impact billions of people's live for the better and make the world a better place.

Cheers,
Vignesh



Go lang: Return True specified Pct% of time

When writing test for state machines, I came across a need for a helper that would all call flow into a path some percentage% of times.

Eg:
func TestSelfDrivingCar_BasicRun(t *testing.T) {
car := NewMockCar(t)
car.Start()
if (/* 50% probability that this will happen */) {
car.SimulateLidarFailure()
} else if /* 25% probability that this will happen */ {
car.SimulateVisionFailure()
} else {
/* 25% probability that this will happen*/
car.SimulateGearBoxFailure()
}
car.VerifySafeTrajectory()
}

You can write a small Go helper like this:
package testutils

import (
"math/rand"
"time"
)

// Odds returns True to pct% number of Check() calls
type Odds interface {
Check() bool
}

// odds returns `true` pct% of times
type odds struct {
randgen *rand.Rand
pct int
}

// NewOdds returns a odds instance with the given percent vaule
func NewOdds(pct int) Odds {
src := rand.NewSource(time.Now().UnixNano())
return &odds{
randg…

[BackTracking] [C++] Permutations of given string

// STRING PERMUTATIONS
void swap(char &a, char &b)
{
a = a^b;
b = a^b;
a = a^b;
}
void _strPermute(char *s, int n, int pos)
{
if (pos == n-1)
{
cout << s << endl;
return;
}
for (int i = pos + 1; i < n; i++)
{
swap(s[pos], s[i]);
_strPermute(s, n, pos + 1);
swap(s[pos], s[i]);
}
}
void printStringPermutations(char *s, int n)
{
if (n < 2) return;
_strPermute(s, n, 0);
}

[TIP] How to unselect all items in Wunderlist

I've been using Wunderlist for some time. It is a great tool especially when it comes to group shopping. I've seen a lot of people posting questions on how to "group unselect" items on wunderlist. It was even on  the "most requested feature-list".

I found a way to do this in 3 super quick steps- so sharing it below:

Press CTRL+A to select all items (Ensure the completed items are hidden - this should be default) and then Press CTRL+D to mark them as completed.
Now all items should be hidden since they are marked as complete. Now click 'Show marked items' to show them all.
CTRL+A to select all and CTRL+D to mark them incomplete.

This has really helped me with my grocery lists since I would need to reset it before the next purchase.