How to check for endianness using JavaScript
Tag: compsci
Guaranteeing software behaviour
My foremost goal while building software is to build stable self-healing systems with deterministic behaviour. I want to ensure my code continues to work even when unexpected events occur. In the event of unknown unknowns, the expectation is a graceful degradation in the worst case.
The Exclusive OR (XOR) Explained
I recently ran into a code puzzle; the question asked for the finding the unique element in a list of integers given that every integer appears twice except the single special element.
Why you should not use isNaN in JavaScript
Nan literally means Not a Number. Yes, it means that value is not a number and occurs when you try to coerce a non-mathematical value (e.g. string) into a number.
What every programmer should know about types I
the mathematical concept of sets in number theory. The set of integers can be seen as a type - only values such as 1, 2, 3 are integers; decimals (e.g. 1.1) or irrational numbers (e.g. π) aren't members of the integer set.
Why JavaScript has two zeros: -0 and +0
Do you know there are two valid zero representations in JavaScript?
A simple explanation of 1s complement arithmetic
A simple explanation of 1s complement arithmetic - a basis for how computers run.
Understanding Bit masks
Bit masks enable the simultaneous storage and retrieval of multiple values using one variable. This is done by using flags with special properties (numbers that are the powers of 2). It becomes trivial to symbolize membership by checking if the bit at a position is 1 or 0.
Understanding and using Streams in JavaScript
Let's take a scenario from Mathematics, how would you model the infinite set of natural numbers? A list? An Array? Or a Stream? Even with infinite storage and time, lists and arrays do not work well enough for this scenario. Why? Assuming the largest possible integer an array can hold is x, then you've obviously missed out onx + 1. Lists, although not constrained by initialization, need to have every value defined before insertion.
How to implement the Y-combinator in JavaScript
This post provides a very simple step-by-step implementation of the Y-combinator in JavaScript. You should be able to implement the Y-combinator in your language of choice after reading this post; as you'll see - it's that easy.
Understanding Partial Application and Currying
In pure functional languages, functions are not 'invoked', rather a set of arguments is 'applied' to them. Now, if all the arguments are not passed in, then the function is being 'partially' applied. Partial application converts variadic functions (i.e. functions with multiple parameters) into functions of lesser arity by pre-specifying certain argument values.
Understanding Tail Recursion
The biggest advantage of using tail calls is that they allow you to do extensive operations without exceeding the call stack. This makes it possible to do a lot of work in constant space without running into out of memory exceptions; this happens because the frame for the currently executing function is re-used by the newly-executed function call.
Programming Language Type Systems I
Static, dynamic, strongly-typed and/or weakly-typed; the terms we routinely use to describe typing in programming languages. However, these terms (especially the last two) have more to them than is generally assumed.
What Endian are you? Big or little?
Have you read Gulliver's travels? If you have then you must have read about endianness.
Data Structures for Programmers
A good understanding of data structures separates the master programmer from the noob. Some make it possible to get faster solutions to problems; and who doesn't want faster code?
Virtualization
One of the recent trends in IT is virtualization and it has caught on fast. There is hardly any person in computing that has not heard about it. Some are more familiar about its intricacies but everyone doesn't have to be an expert in this seemingly esoteric field to use it. Here is an introduction … Continue reading Virtualization
Cloud Computing, the future of computing?
Cloud computing has been touted to be the future of computing. Trends suggest a move towards web-based software applications and services. The claim has been further strengthened by the emergence of companies offering cloud-based services to computer users. (e.g. Google Docs). The underlying principle of cloud computing is to have servers offering access to computing … Continue reading Cloud Computing, the future of computing?