Thursday, 28 January 2010

Android can do games!

Check this out.

Wednesday, 27 January 2010

Android First App: Bezier Curve (2)

A fancier version.
I have created my Android Market account, paid the fee... now I will polish this simple first app and upload it to the market.
I already have another idea for my next app: A Password Manager. I know there are quite a few around, but security wise, only trust yourself. I will also provide a desktop version (Web Started).


Tuesday, 26 January 2010

Monday, 25 January 2010

Android

I have never had the chance to look at Android closely - being too busy at work, or just not sleeping because of the kids, or simply because I enjoy golf so much.
However, I decided it was time to put an end to this - and decided today to write my first Android application.

So far, after my 2 hours of experience, I must say I have been very impressed by the simplicity of the development life-cycle. In 2 hours, I had my first Android app running via the emulator: a Bezier Curve animation; which I intend to place for free on the Android Market.

I am the owner of a HTC Magic, running Android 1.6 (47% of market share); and it just took me 10 minutes to find out how to upload my application on the phone - running native.

Very impressed, indeed.

Thursday, 21 January 2010

Nexus One and multi-touch

This is how to enable it, at your own risk.

Standard Deviation at n+1

I faced a little problem recently @ work: the need to generate real time standard deviation for millions of data (streamed continuously).

So the idea is to find a recurrence relationship for the standard deviation. From the initial Wiki formula, and after 5 lines of easy maths, you end up with:



From that you see that you just need to store the previous standard deviation, the sum of xi, and the sum of the xi square. You just have to initialize with two values, and after that, you calculate the new standard deviation on the fly for the new xi.

Looks like this in Java


public class StandardDeviation {
private double sumXis = Double.NaN, sumXis2 = Double.NaN;
private double n = Double.NaN;
private double stdev2 = Double.NaN;
private double result = Double.NaN;

public StandardDeviation() {
}

public double stdDev(final double[] xs) {
final int length = xs.length;
n = length;

double sdx1 = 0.0;
double sdx2 = 0.0;
for(int i = 0; i < length; i++) {
sdx1 += xs[i] * xs[i];
sdx2 += xs[i];
}
sumXis = sdx2;
sumXis2 = sdx1;
sdx2 = sdx2 * sdx2;

final double std2 = (length * sdx1 - sdx2) / (length * (length-1));
stdev2 = std2;
final double std = Math.sqrt(std2);

result = std;

return std;
}

public double stdDev(final double xs) {
final double stdev2n1 = (n * (n - 1.0) * stdev2 + n * xs * xs + sumXis2 - 2 * xs * sumXis)
/ (n * (n + 1));

sumXis += xs;
sumXis2 += xs * xs;
stdev2 = stdev2n1;
n += 1;

final double result = Math.sqrt(stdev2n1);

this.result = result;

return result;
}

public double getResult() {
return result;
}
}

Maths formulas in your blog

Wanna display nice formulas in your blog like this one:



Well, just go to this nice online equation editor.

Monday, 4 January 2010

"Travailler plus, pour gagner plus, pour consommer plus, est dépassé"

Nice interview from Jacques Marseille.

I like this part:

" Aujourd'hui, on essaie de la (la Finance, ndlr) discipliner mais il faut se rappeler la phrase d'Isaac Newton, en 1720 lorsqu'il avait investi dans une entreprise, qui avait fait faillite : "Je sais mesurer le mouvement des corps, pas la folie des hommes." En dépit des efforts, nous ne changerons pas grand-chose. "

Blog Archive