A blog reader asked me if I had plans to release a new 64bit-community wrapper… Indeed I have plans to do so, just did not have time so far to compile a new package. So here it goes:
As always, I don’t guarantee anything, so please note:
Read the rest of this entry
So recently I stumbled across a programming quiz to which I later returned because it somehow fascinated me.
Problem
Finding the first available number (or the smallest missing number) in a list is a common problem in Computer Science (for example for Defragmenting or generating keys) and describes the search for the smallest natural number, which is not part of a set X of natural numbers. X is a set of distinct natural numbers (and being a set, is not ordered).
We are now looking for a function with linear worst-case time complexity O(n).
Example
We define X as a set of distinct natural numbers:
X = {23,9,12,0,11,1,13,7,21,14,5,4,17,19,3,6,2}
So in this set, we find that the number 8 is the first available number (smallest missing number). So running the algorithm over the above set should return 8.
Read the rest of this entry
After fiddling with the NMAKE file and a nudge from a nice commenter, I hereby provide the latest version of the Tanuki Service Wrapper for Windows x64.
As always, I don’t guarantee anything, so please note:
Read the rest of this entry
After quite a long time, Tanuki Software released another two versions of the Tanuki Service Wrapper. I hereby provide a build of the latest version of the wrapper, version 3.5.19.
As always, I don’t guarantee anything, so please note:
Read the rest of this entry
Recently, Tanuki Software released a new version of the Tanuki Service Wrapper (version 3.5.16). I am happy to make a compiled version of the Tanuki Service Wrapper for Windows Server (64-bit) available to you.
As always, I don’t guarantee anything, so please note:
Read the rest of this entry
I always like comments in my blog and someone nicely asked if I could provide a new build for the Tanuki Service Wrapper for Windows x64 (Community Edition). Sure I can! Find the download link below.
As always, I don’t guarantee anything, so please note:
Read the rest of this entry
Due to a a request, I am uploading a more current version of the Tanuki Service Wrapper for Windows x64 (Community edition). I used these instructions to build the wrapper. Find the download link below.
As always, I don’t guarantee anything, so please note:
Read the rest of this entry
For an university assignment, I had to implement a recursive function to calculate the digit sum of a given number. I place my solution here for my own reference:
public static int digitSum(int n) {
if(n < 10)
return n;
else
return n % 10 + digitSum(n / 10);
}
This code can also be found in the GitHub repository that I am keeping for university: ChecksumTool.java
When comparing floating-point numbers (float, double) in Java, we quickly discover that we get roundoff errors. This has to do with the limited precision of Java floating point variables. The following code example shows the problem at hand:
double r = Math.sqrt(2);
double d = r * r - 2;
if (d == 0)
System.out.println("sqrt(2) squared minus 2 is 0");
else
System.out.println("sqrt(2) squared minus 2 is not 0 but " + d);
Theoretically, d
should be 0, but because we have limited precision (see the documentation on primitive data types) there will be a difference:
sqrt(2) squared minus 2 is not 0 but 4.440892098500626E-16
One possibility to circumvent this problem is to define a constant value (the following example uses EPSILON
). We then check if the difference is smaller than that constant value. Since we received a very small number (4.4E-16) above, we can use 1E-14 as the value of our constant:
Read the rest of this entry