RSSAmplifier

Blog

Doctrina

doctrina.orgRSS feed ↗31 posts

Latest posts

Why You Shouldn't Trust Successful People's Advice

Why You Shouldn't Trust Successful People's Advice It seems sensible to model oneself on traits that are displayed by successful people. And while this is not inherently incorrect, there is a problem when traits of less successful are ignored. This video dispels the myth about only trusting successful people's advice …

Greek Lemon Chicken And Potatoes

Ingredient 1 kilogram chicken wings 1 tablespoon kosher salt 1 teaspoon freshly ground black pepper 1 teaspoon dried rosemary 1 rounded tablespoon dried oregano pinch of cayenne 6 cloves of garlic , finely minced 1/2 cup fresh lemon juice 1/2 cup olive oil 3 russet potatoes , cut in quarters …

Thai Pineapple Chicken Curry

Ingredients 1 table-spoon olive oil 2 chicken breasts, cubed 1 table-spoon grated ginger 2 cloves garlic, crushed 2 table-spoons red curry paste ½ cup chicken broth 1 teaspoon sugar ½ teaspoon ground turmeric ½ cup bamboo shoots 4 kaffir lime leaves 1.5 table-spoons fish sauce 2 cups freshly diced …

Hollandaise Sauce

Ingredients 1 large egg yolk 4 tablespoons cold unsalted butter, cubed 2 tablespoons cold water 1 tablespoon fresh lemon juice (you can always add more to taste) Method Take all ingredients, put it in a metal bowl, and whisk while heating over medium heat (see video).

Thai Turkey Skillet

Ingredients 3 lb turkey or chicken mince 4 large red peppers, sliced 1.5 table-spoons of ground ginger 3 teaspoons crushed red pepper flakes 9 cloves of crushed garlic 9 table-spoons natural peanut butter 6 table-spoons lime juice 6 table-spoons soy sauce 3 table-spoons sesame oil 1.5 cups chopped …

Big O Notation

Introduction Definition Big O notation concerns functions defined on the positive integers : A function \(T(n)\) is said to be big O of \(f(n)\) if eventually, ( for all sufficiently large values of \(n\) ), \(T(n)\) is bounded above by a constant multiple of \(f(n)\) Formal Mathematical Definition $$ T …

The CAP Theorem

CAP Theorem The CAP Theorem L1 defines constraints of a distributed system. Here is a concise very well explained video about the topic. Also, read about how the CAP rules have changed L2 since Eric Brewer first published the theorem. Links https://en.wikipedia.org/wiki/CAP_theorem http://www.infoq …

The Archer's Paradox

The Archer's Paradox Really interesting video explaining how an arrow, fired from a bow, is able to hit it's mark with the bow being in the way.

The Car Differential

A Car Differential When turning a corner, one wheel must necessarily turn faster than the other wheel. This is achieved by each wheel being independent to the other wheel. Both wheels are able to work together in harmony by being connected to the differential L1 . This video explains how it …

Maximum Amount Of Nodes Of A Certain Height

Introduction Given a binary tree with \(n\) nodes, there can be at most \(\left\lceil \frac{n}{2^{h+1}} \right\rceil\) nodes with height \(h\) . Here follows a proof 1 . Background Knowledge Tree Height In a binary tree, height of a node is defined as the number of edges …

Const Liffy Pattern For C++

Introduction Immutable state has many advantages L1 . Unfortunately, C++ is designed to easily mutate state. My colleague Vincent Lascaux shared a code snippet that tries to alleviate this problem by attempting to avoid normal variables in favor of using constants that are always initialized. I decided to name his pattern …

Maximum Height Of A Red-Black Tree

Introduction My friend and colleague, Dominik Messinger L1 was fortunate to learn about abstract data structures in high school 1 . After chatting to him one day, the topic of red-black trees came up. He studied AVL trees L2 in depth at high school, but did not do the same for …

Do Not Go Gentle Into That Good Night

Do Not Go Gentle Into That Good Night By Dylan Thomas L1 Do not go gentle into that good night, Old age should burn and rave at close of day; Rage, rage against the dying of the light. Though wise men at their end know dark is right, Because their …

The Starting Node Of A Cycle In A Linked List

Introduction Given a singly linked list L1 that has a cycle, how can one determine the first node in the cycle? Using the image above as an example, the aim would be to find the orange node. Algorithm Use two iterators, but make one move at twice the speed of …

Merge Sort And Inversions

Merge Sort Merge sort is the classic divide and conquor algorithm, and is used as a canonical example for explaining the topic. It is quite easy to implement (specially in Python) but I wanted to see a C implementation. Google found me some stack overflow L1 links as well as …

JavaScript Lecture: Cryptography In The Browser

I was recently asked to lecture the local Toronto JavaScript meetup about Cryptography in the browser. Here are my lecture slides. Apparently, there is a video of my talk that will be put up. When I get, I will link to it over here. Enjoy, and I would grateful for …

Mathematical Nonsense - Inifinte Sum Series

The following fact for infinite series crops up all the time: $$ r\neq 1, 1+r+r^2+r^3+\ldots +r^k = \frac{r^{k+1}-1}{r-1} $$ Proof The proof is by induction: Base Case: k=1 For the base case, where k=1, the left hand side …

The Master Method

The Master Method The master method is a way to analyse the worst case running times of a recursive function. Assume the recursive function is of the following form: $$ T(n) = a\cdot T\left(\frac{n}{b}\right) + O(n)^d$$ Where: a is the number of subproblems created …

Cryptographic Hash VS MAC: What You Need To Know

Introduction A MAC ( message authentication code L1 ) plays a vital role in the world of cryptography. It ensures message integrity and combats active attacks 1 . A MAC is often confused with a cryptograhic hash (i.e. SHA256). I think it was an unfortunate choice of words to use cryptographic hash …

Mathematical Nonsense - Logarithm Equality

It's been many years since I was first taught logarithms L1 . So when looking at a proof that hinged on the fact that \(a^{log_b n} = n^{log_b a}\) , I thought that the proof was wrong. Actually, it was my fault: \(a^{log_b n}\) is indeed equal to \(n^{log_b …

Base64 With OpenSSL C API

OpenSSL has the ability to perform Base64 L1 encodings and decodings. There seems to be many queries for working examples on how to use this functionality. Unfortunately, the example L2 on the OpenSSL site is quite obtuse, and every other example I have come accross does not work. So here …

Scrypt Authentiction For Node

Scrypt For NodeJS node-scrypt is a native node C++ wrapper for Colin Percival's scrypt key derivation L1 utility. What Is Scrypt? Scrypt is an advanced crypto library used mainly for key derivation L1 (i.e. password authenticator). More information can be found here: Tarsnap blurb about scrypt L2 - Colin Percival …

Upstart With Python VirtualEnv

I thought I would write this very short blog article to help anyone who would who wants to launch a uwsgi L1 server that refers to a python script in a virtual environment via upstart. In order to run a uwsgi L1 server that runs a python script that in …

Plugin For Pelican To Enable Latex

Latex Plugin For Pelican This plugin allows you to write mathematical equations in your articles using Latex. It uses the MathJax Latex JavaScript library to render latex that is embedded in between $..$ for inline math and $$..$$ for displayed math. It also allows for writing equations in by using \begin{equation …

JavaScript: Why Understanding Scope And Closures Matter

When first learning how to program, a fundamental aspect is to learn about scope. Many languages copy the C syntax for scope, including JavaScript. But while these language copy the C rules for scope, JavaScript does not. This results in frustration and potentially problematic code. JavaScript instead implements scope in …

JavaScript: Function Invocation Patterns

JavaScript has been described as a Functional Oriented Language (this as opposed to Object Oriented Language). The reason is because functions in JavaScript do more than just separate logic into execution units, functions are first class citizens that also provide scope L1 and the ability to create objects. Having such …

Javascript: Object Prototypes

This post discusses JavaScript objects with emphasis on its prototype linkings. After reading this post, you should understand the following: Object creation in JavaScript. Prototype linkings. What Object.prototype and Function.prototype are used for. Douglas Crockford's L1 wonderful book JavaScript: The Good Parts L2 does a fanastic job of …

Why RSA Works: Three Fundamental Questions Answered

This is part two of a series of two blog posts about RSA ( part 1 L1 explains how RSA works). This post examines why RSA works as it does by answering three fundamental questions: Why opposite keys must be used. Why RSA is correct . Why the inverse of a key …

How RSA Works With Examples

Introduction This is part 1 of a series of two blog posts about RSA ( part 2 L1 will explain why RSA works). In this post, I am going to explain exactly how RSA public key encryption works. One of the 3 seminal events in cryptography L2 of the 20th century …

The 3 Seminal Events In Cryptography

Cryptography is the art/science of keeping a secret. This need has been present since prerecorded human history, but we have some very famous early examples such as the Caesar Cipher L1 . Yet these early examples were very easy to break. It took until the twentieth century for cryptography to …

Upstart With NodeJS And NVM

Yet another very short blog article to help anyone who wants to setup an upstart process that runs a NodeJS L1 app under nvm L2 . Unlike the uwsgi setup L3 , there is no specific argument switch to give Node that will make it use nvm environment variables. In fact, since …