Tag Archives: dev

dev

Rubber Duck Debugging

Rubber duck debugging is an informal way of debugging code. The method involves a programmer, while trying to find bugs in code (code inspection), keeping a rubber duck or another inanimate object nearby. Line by line, the programmer explains to the duck or other object what each segment of code is supposed to do. During this review, bugs in the application should become apparent. The method is a version of the thinking-aloud method, a procedure recognized as an effective way to speed up problem solving.

https://pl.wikipedia.org/wiki/Metoda_gumowej_kaczuszki

Hyperbolic cosine

Some time ago someone asked me to write my own implementation of the hyperbolic cosine (http://pl.wikipedia.org/wiki/Funkcje_hiperboliczne) based on the Taylor series.

A quick proof-of-concept version:

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

double silnia (double n){
    if (n <= 1) return 1;
    else return silnia(n - 1)*n;
}

double mycosh(double z){
    double result = 1;
    int ilosc_wyr_ciagu = 30;
    int i;
    for (i = 1; i < ilosc_wyr_ciagu; i++){
        result += pow(z, 2*i) / silnia(2*i);
    }
    return result;
}

int main(int argc, char *argv[]) {
    double arg, c1, c2, blad;
    arg = 3.113408;
    c1 = cosh(arg);
    c2 = mycosh(arg);
    blad = abs(c2-c1)/c2;
    printf(" z=%f; cosh(z)=%f; mycosh(z)=%f; blad=%.90f \n", arg, c1, c2, blad);
    system("PAUSE");
    return 0;
}

Android 4.4 with contactless card emulation?

An interesting note about the latest Android 4.4 appeared on one of the blogs:

Instead, Android might be able to emulate credit cards, transit passes, and secure entry badges in a more straight forward way.

Is this the beginning of the end of plastic in the wallet?

http://www.androidpolice.com/2013/10/30/android-4-4-kitkat-will-reportedly-include-nfc-card-emulation-without-secure-element-improved-low-memory-device-support-new-sensors-and-more/