I rebuilt my website from scratch. The code is so much better now. I'll push the code to GitHub later.
Ciya.
Another awesome developer.
We're so much better now
2013-05-08 08:09
The World That The Children Made
2012-10-13 01:06
deadmau5 - The Veldt (ft. Chris James)
"Happy Life, with the machines
Scattered around the room
Look what they made, they made it for me
Happy Technology"
The Veldt is a short story written by Ray Bradbury.deadmau5 has been working on a song based on that story and invited his fans via Twitter\r\nto send him some suggestions, and that''s how he found Chris James,who produced his own vocal rendition of the song. Joel Zimmerman (deadmau5'' name IRL) was impressed with the lyrics making reference to the original story and decided to include Chris'' vocals in the track.
The album is called "Album Title Goes Here".
Enjoy.,
Algorithm to flip a number
2012-03-16 01:23
The task was to write an algorithm to be able to reverse the order of the digits of a 3-digit number. Easy stuff, I know.
First, let's suppose the number is 256.
256 can be written this way:
256 = 2*10^2 + 5*10^1 + 6*10^0
One can simply reverse the order of the powers of 10 (10, because the numeral system is base 10):
652 = 6*10^2 + 5*10^1 + 2*10^0
Now, we only need to find out the digits of units, tens and hundreds.
It's not difficult to find out that:
256 div 100 will give you the hundreds digit,
256 mod 100 will give you the units and tens digits (56), the result div 10 will give you the tens digit. Finally,
256 mod 10 gives you the units digit.
"Div is division in which the fractional part (remainder) is discarded". Mod gives the remainder. [see "div" and "mod" on
freepascal wiki]
Now, let's write all that - here's a simple C/C++ function:
don't forget that :
% is the mod operator for integers.
/ is the div operator for integers.
// a first approach of the algorithm ..
// reversing 3 digits
int reverse3Digits( int number )
{
int units, tens, hundreds;
hundreds = number / 100;
tens = (number%100) / 10;
units = number % 10;
return(units*100 + tens*10 + hundreds);
}
... But what about an integer of arbitrary length ?
Let's take for example 1024:
1 = 1024 div 10^3 0 = (1024 mod 10^3) div 10^2 2 = (1024 mod 10^2) div 10^1 4 = 1024 mod 10^1
( Okay it took me some time, I admit ^^' )
We notice that a digit of an integer can be calculated like this:

d_k : the digit
which position is k. (units digit is position 0)
N : the given number;
B : the numeral system (in our case, base 10);
Now, it's possible to find out an arbitrary digit of an integer.
The function reverseDigits() becomes:
// the final function
int reverseDigits( int number )
{
int n, k, result = 0;
// count the number of digits
for ( n=1; number%pwr(10,n) != number; n++ );
// reassemble the digits, but in the reversed order
for ( k=0; k<n; k++ ) {
result += ((number%pwr(10,k+1))/pwr(10,k)) * pwr(10,(n-k-1));
}
return result;
}
// a function that returns a^b
// simple, that's why i'll only write its prototype
int pwr( int a, int b );
That's all (:
.,