Sunday, January 12, 2020

Iterator

Excerpt from https://davidwalsh.name/es6-generators

Iterators are a special kind of behavior, a design pattern actually, where we step through an ordered set of values one at a time by calling next(). Imagine for example using an iterator on an array that has five values in it: [1,2,3,4,5]. The first next() call would return 1, the second next() call would return 2, and so on. After all values had been returned, next() would return null or false or otherwise signal to you that you've iterated over all the values in the data container.

New Web APIs

Friday, November 29, 2019

Difference between Dynamic Programming & Divide And Conquer

https://en.wikipedia.org/wiki/Dynamic_programming

There are two key attributes that a problem must have in order for dynamic programming to be applicable: optimal substructure and overlapping sub-problems. If a problem can be solved by combining optimal solutions to non-overlapping sub-problems, the strategy is called "divide and conquer" instead.[1] This is why merge sort and quick sort are not classified as dynamic programming problems.

RSA Encryption Algorithm


Wednesday, November 27, 2019

An educated mind

Aristotle famously stated that the mark of an educated mind is the ability to entertain a thought without accepting it.

Intro to B-Trees

Monday, October 28, 2019

Tail-Recursion, Tail-Call Optimization

https://stackoverflow.com/questions/33923/what-is-tail-recursion
https://stackoverflow.com/questions/310974/what-is-tail-call-optimization

Examples done after reading the answers in the 1st link above:

// 
//////////// Sum till n ////////////
//

// - normal recursion
function sumTo(n) {
  return (n == 0 ? 0 : (n+sumTo(n-1)));
}
var result = sumTo(10);
console.log(result);

// - tail recursion
function sumTo2(n) {
  return sumTo2_aux(n, 0);
}
function sumTo2_aux(n, acc) {
  return (n == 0) ? acc : sumTo2(n-1, acc+n);
}
var result2 = sumTo2(10);
console.log(result2);


//
//////////// Factorial ////////////
//

// - normal recursion
function factorial(n) {
  return (n == 1 ? 1 : n * factorial(n-1));
}
var factorial_result1 = factorial(10);
console.log(factorial_result1);

// - tail recursion
function factorial2(n) {
  return factorial2_aux(n,1);
}
function factorial2_aux(n, acc){
  return (n == 1 ? acc : n * factorial2_aux(n-1, acc));
}
var factorial_result2 = factorial2(10);
console.log(factorial_result2);

//

Thursday, October 24, 2019

Firebase related

Data Structures related

Uninstall Mongo old version and Install new version

1) backup data

mkdir mongodb-dump-oct24-2019
cd mongodb-dump-oct24-2019
mongodump

Above will create a folder called 'dump' within 'mongodb-dump-oct24-2019' folder.

2) Uninstall existing version of mongodb
https://medium.com/@rajanmaharjan/uninstall-mongodb-macos-completely-d2a6d6c163f9

3) Install new version
https://stackoverflow.com/questions/57856809/installing-mongodb-with-homebrew

brew tap mongodb/brew  
brew install mongodb-community@4.0
4) brew link --force mongodb-community@4.0
brew services start mongodb-community@4.0
5) Restore data
cd mongodb-dump-oct24-2019
mongorestore

Sunday, September 22, 2019

'less' related

To search for 1st occurrence from top of file:
less +/FATAL log/production.log

To search for 1st occurrence from bottom of file:
less +?"Processing by" log/production.log


Linux - Tools, System Administration Basics

Monday, September 16, 2019

Thursday, August 29, 2019

Open Source related - 'Funding' Experiment Recap

Very interesting and thought-provoking article about Funding for OSS
https://feross.org/funding-experiment-recap/
However the comments section also includes this very valid comment from Mjölnir :
There were numerous valid concerns like the ones I'm raising now. You've only cherry-picked the most positive ones and used them to support your arguments. Yes there was an inundation of responses and I'm sure it's not easy to be at the receiving end of so much derision but there were TONS of valid concerns and dismissing the VAST majority of people in the ecosystems with such a flagrant disregard for conflicting opinions does not bode well
More comments over here - https://www.reddit.com/r/programming/comments/cwwe8c/recap_of_the_funding_experiment_ferossorg/


Thursday, August 22, 2019

Seated-Meditation vs Seated-Programming

"It's thought that KungFu was developed by the early Chinese monks as a way to stay fit enough for hours of seated meditation."




Seated Programming/Studying is not very different from Seated-Meditation.
Hence, the need for being extremely fit for hours of seated-meditation applies to seated-studying/programming as well.

Monday, August 19, 2019

mysql2 gem problems on Mac

https://github.com/brianmario/mysql2/issues/1005

commented on 26 Oct 2018

To fix for a manual gem install:
brew install openssl
gem install mysql2 -- --with-opt-dir="$(brew --prefix openssl)"
To fix for all bundle installs:
brew install openssl
bundle config --global build.mysql2 --with-opt-dir="$(brew --prefix openssl)"
bundle install

Saturday, August 3, 2019

Web Components

State of Web Components (2019) -
https://medium.com/swlh/the-state-of-web-components-e3f746a22d75

Web Components - The Secret Ingredient Helping Power The Web


Embedded Systems Tutorials

Crash Course in Lisp

Elixir related - Concurrency & Absinthe, Temple HTML library, Elixir + Kubernetes, How Elixir helped improve performance, setup Phoenix + PostgreSQL using docker-compose

https://www.reddit.com/r/elixir/comments/ckihkc/i_thought_concurrency_was_a_big_thing/ - A discussion about concurrency and Elixir libraries like Absinthe.

https://www.mitchellhanberg.com/introducing-temple-an-elegant-html-library-for-elixir-and-phoenix - Introducing Temple: An elegant HTML library for Elixir and Phoenix

https://bbhoss.io/posts/announcing-cainophile/ - a library to assist you in building change data capture (CDC) systems in Elixir. With Cainophile, you can quickly and easily stream every change made to your PostgreSQL database, with no plugins, Java, or Zookeeper required.

https://itnext.io/elixir-plus-kubernetes-part-1-80129eab14f0? - Elixir + Kubernetes

https://selleo.com/blog/how-elixir-helped-me-boost-app-performance - How Elixir Helped Me Boost App Performance

https://medium.com/@ricardo.trindade743/setting-up-phoenix-postgresql-with-docker-compose-for-local-development-afeb4a4ace6c - Setting up Phoenix + PostgreSQL with docker-compose for local development


Sunday, July 28, 2019

Chinese Banking revolution - Use of big data and artificial-intelligence technology to give loans to Small Businesses

 Chinese Banking revolution - Use of big data and artificial-intelligence technology to give loans to Small Businesses:

https://economictimes.indiatimes.com/news/international/business/jack-mas-290-billion-loan-machine-is-changing-chinese-banking/articleshow/70418197.cms

Excerpts:
One uniquely Chinese source of information for banks is the government-administered social credit system, which is being tested in cities across the country as a way to reward good deeds and punish misbehavior. In one potential scenario cited by MYbank President Jin Xiaolong in a recent interview, a small-business owner whose social credit score dropped because he failed to return a borrowed umbrella would find it harder to get a loan. 

But the biggest data trove may come from payments providers like the one operated by Ma’s Ant Financial, the biggest shareholder of MYbank. After obtaining authorization from borrowers, MYbank analyzes real-time transactions to gain insights into creditworthiness. For example, a drop in customer payments at a retailer’s flagship store might be an early indicator that the company’s prospects -- and its ability to repay debt -- are deteriorating. 

The upshot of more information is a loan approval rate at MYbank that’s four times higher than at traditional lenders, which typically reject 80% of small-business loan requests and take at least 30 days to process applications, according to Jin, who plans to double MYbank’s roster of borrowers in three years. He said the Hangzhou-based firm’s operating cost per loan is about 3 yuan, versus 2,000 yuan at traditional rivals. 


Friday, July 19, 2019

Understanding Enough awk to Search Piles of Files and Text

Yes silver bullet by Mark Seemann

https://blog.ploeh.dk/2019/07/01/yes-silver-bullet/
Excerpts:
So it is with technology improvements. Automated testing is available, but not ubiquitous. Git is free, but still organisations stick to suboptimal version control. Haskell and F# are mature languages, yet programmers still program in C# or Java.
....
.... 
If you accept my argument, that order-of-magnitude improvements appeared after 1986, this implies that Brooks' premise was wrong. In that case, there's no reason to believe that we've seen the last significant improvement to software development.
I think that more such improvements await us. I suggest that statically typed functional programming offers such an advance, but if history teaches us anything, it seems that breakthroughs tend to be unpredictable.

Scene.js - Library to Create Timeline-Based Animation

Sunday, June 16, 2019

DevOps Tutorial for Beginners



Intellipaat DevOps course: https://intellipaat.com/devops-certif... In this devops tutorial for beginners video you will learn devops end to end right from what is devops, various devops tools it has like docker, git, jenkins, chef, kubernetes, nagios, puppet, ansible in detail.

https://intellipaat.com/tutorial/devops-tutorial/

how SignalR manages connection between multiple server using a back plane?

Things I Wish Someone Told Me About ASP.NET Core WebSockets (June 5 2018)

.Net related: Blazor

Rust related: Actix & Actix Web framework

OTP -> rust Actix, Phoenix -> actix-web, Ecto -> diesel

https://actix.rs/
https://github.com/actix/actix
https://github.com/actix/actix-web

Followers

Blog Archive