Posts

Explaining B-Trees: animated video

This video is not owned by me, I just screen casted it and put into video so you can do track by time compared to their flash base which is annoying when you wanted to back track. This video is taken from  http://www.csanimated.com/animation.php?t=B-tree

Using your calculator to validate logarithms with exponents and get result of logarithms

I just stumbled this earlier when I was playing with my calculator and I forgot how to use it, so I remember that logarithms is just a way of a reverse formula of exponents. So I came up with this solution, log 2 (8) = 3 in calculator, press 8 + press x radical symbol(y) + press 3 = 2 log 2 (3) = 1.58496250072116 in calculator press 3 + press x radical symbol(y) + 1.58496250072116 = 2 log 4 (16) = 4294967296 in calculator press 4294967296 + press x radical symbol(y) + 16 = 4 So the formula is, log base (logarithm number) = result or result as the index then radical symbol(logarithm number as the radicand) = base then, base result = logarithm number Now to get the result of a logarithm in calculator, you can use natural logarithm. To calculate it, do, ex. ln(16)/ln(2) = 4 which is equivalent to, log 2 (16) = 4 another ex. ln(65536)/ln(4) = 7.99 = 8 which is equivalent to log 4 (65536) = 8

Using "use strict" in JavaScript

Image
Using Firefox, as of this writing, version 12.0. Here's a tiny part of using "use strict" syntax in JavaScript. without "use strict", var x = 17; var evalX = eval("var x = 42; x"); alert(x === 17);  // results to  false alert(x === 42);  // results to true alert(evalX === 42); // results to true with "use strict", var x = 17; var evalX = eval("'use strict'; var x = 42; x"); alert(x === 17);  // results to true alert(x === 42); // results to false alert(evalX === 42); // results to true To know more about "use strict", read more on Mozilla's page at  https://developer.mozilla.org/en/JavaScript/Strict_mode  or another interesting blog to read at  http://ejohn.org/blog/ecmascript-5-strict-mode-json-and-more/ A tabular view shows what browsers does support strict mode in JavaScript. Taken from  http://caniuse.com/#feat=use-strict , as of this writing, I got this tabular view below, ...

Understanding Anchor point in iOS

Image
Just to take notes for this regarding anchor point in iOS. This is taken from  developer.apple.com Specifying a Layer’s Geometry While layers and the layer-tree are analogous to views and view hierarchies in many ways, a layer's geometry is specified in a different, and often simpler, manner. All of a layer’s geometric properties, including the layer’s transform matrices, can be implicitly and explicitly animated. Figure 1  shows the properties used to specify a layer's geometry in context. Figure 1   CALayer geometry properties The  position  property is a  CGPoint  that specifies the position of the layer relative to its superlayer, and is expressed in the superlayer's coordinate system. The  bounds  property is a  CGRect  that provides the size of the layer ( bounds.size ) and the origin ( bounds.origin ). The bounds origin is used as the origin of the graphics context when you override a layer's drawing met...

Comet - long-polling using Ajax

I just wanted to save this video for any references wanted to understand what Comet is. So what exactly Comet is? Comet is still using AJAX but its just a technique done in the server. It uses timestamp for comparison of updates, then AJAX request will have just to wait until the server will response, so it's the sever will have to push data to the browser. This is a long-polling method and can save traffic than running an AJAX request from time-to-time.

checkout only one file using git

First clone the repo with the following command below, git clone -n git://path/to/the_repo.git --depth 1 The -n option suppresses the default checkout of all files, and the --depth 1 option, which means it only gets the most recent revision of each file Then check out just the file you want like so: Then you can checkout the file that you wanted to get or save to your machine. $> cd the_repo $> git checkout HEAD name_of_file

Building packages in Linux from source

Always remember that when you build packages in Linux, always do consider these packages as its requirement by the compiler to build the package from source. git-core  build-essential libboost-dev  libboost-program-options-dev libboost-thread-dev  libboost-filesystem-dev scons gcc-c++ glibc-devel