Big Omega, Big Theta and Big Omicron.

In code complexity measure,

Big Omega gives us asymptotic lower bound function g(n).
Big Theta gives us asymptotically tight bound function g(n), i.e. both lower and upper bound being c1.g(n) and c2.g(n) respectively.
Big Omicron gives us asymptotic upper bound function g(n).

Most of the time we talk about Big Oh. That is actually Big Omicron.
[The character O is the upper-case Greek letter Omicron, not English letter O]

And surprisingly, when we say, complexity of a code is O(N^2) etc,
we really mean Big Theta! We not only mean, N^2 being the upper bound,
but also we mean, N^2 is the lower bound too. Isn't it?

Ignorance is bliss...

"Where ignorance is bliss, 'tis folly to be wise." -Thomas Gray

Static:Dynamic and Strong:Weak Typing.

Static languages = statically typed language = type is known from program text.
Dynamic languages = dynamically typed language = type is known when program runs.

But, dynamic typing != weak typing.
And static typing != strong typing.

Strong typing = Variables have specific data types. Once you assign a variable to something, it is bound to that type.
Weak typing = Variables are not strictly bound to a given data type. Variable's value can be interpreted differently.

Static typing can also be weak, as in C.
Static typing can also be strong, as in Java.

Java is statically typed and strongly typed.
C is statically typed but weakly typed.
Python is dynamically typed and strongly typed.
PHP is dynamically typed but weakly typed.

A good read: https://prateekvjoshi.com/2014/10/03/static-vs-dynamic-typing/

Dynamically typed languages and maintenance of large code bases.

Dynamically typed languages make it more difficult to maintain large code bases.
Mostly because errors that are caught by a statically typed languages are now not available for free.
Programmer must write test cases to ensure correctness.

A good read: https://softwareengineering.stackexchange.com/questions/221615/why-do-dynamic-languages-make-it-more-difficult-to-maintain-large-codebases

Javascript hoisting

In JavaScript, a name enters a scope in one of four basic ways (and in this order):
1. Language-defined: All scopes are, by default, given the names 'this' and 'arguments'.
2. Formal parameters: Functions can have named formal parameters, which are scoped to the body of that function.
3. Function declarations: These are of the form function foo() {}.
4. Variable declarations: These take the form var foo;.


Function declarations and variable declarations are always moved ("hoisted") invisibly to the top of their containing scope by the JavaScript interpreter.

The assignment portion of the declarations were not hoisted. Only the name is hoisted. Actual assignment to the variable name waits at its own line. This is not the case with function declarations, where the entire function body will be hoisted as well.

While hoisting, if a function name has already been defined, it is never overridden by another variable of the same name. This means that a function declaration takes priority over a variable declaration. This does not mean that an assignment to that variable name will not work, just that the declaration portion will be ignored while hoisting takes place. Since actual assignment to the variable name waits at its own line, after assignment the variable name (and its behavior) hides/overrides the function name.

Example:

1.
function example()
{
foo(); // TypeError "foo is not a function"
bar(); // valid
baz(); // TypeError "baz is not a function"
spam(); // ReferenceError "spam is not defined"
var foo = function () {}; // anonymous function expression (only 'foo' gets hoisted)
function bar() {}; // function declaration ('bar' and the function body get hoisted)
var baz = function spam() {}; // named function expression (only 'baz' gets hoisted)
foo(); // valid
bar(); // valid
baz(); // valid
spam(); // ReferenceError "spam is not defined"
}

2.
<script type="text/javascript">
document.write( f(3) + "<br/>")
var f=function(x) { return x+1; }
function f(x) { return x+2; }
document.write( f(3) + "<br/>")
</script>

This code is equivalent to:

<script type="text/javascript">
function f(x) { return x+2; }
var f; //until assignment this declaration doesn't change behavior of f()
document.write( f(3) + "<br/>")
f=function(x) { return x+1; } //after this assignment, behavior of old f() gets lost
document.write( f(3) + "<br/>")
</script>


Source: http://www.adequatelygood.com/JavaScript-Scoping-and-Hoisting.html

Create iso file from CD/DVD using Linux dd command

# isoinfo -d -i /dev/cdrom | grep -i -E 'block size|volume size'
Logical block size is: 2048
Volume size is: 327867

# dd if=/dev/cdrom of=/path/to/my.iso bs=<block size from above> count=<volume size from above>

Source: https://www.thomas-krenn.com/en/wiki/Create_an_ISO_Image_from_a_source_CD_or_DVD_under_Linux

Almost self printing Javascript program

<script type="text/javascript">
( function f() { document.write( f ) }() )
</script>