Różdżka, jak ją wykonać i jak się nią posługiwać?

Zasada działania i wykorzystanie różdżek

Różdżki są od wieków wykorzystywane do poszukiwania żył wodnych, które mogą źle wpływać na samopoczucie lub do poszukiwania wody podczas kopania studni. Niektórzy próbują wykorzystywać je również do poszukiwania zaginionych przedmiotów, lub do przepowiadania przyszłości, zastosowania te zostaną również omówione w dalszej części artykułu.

Jak w przypadku każdej koncepcji nie do końca akceptowanej przez tradycyjną naukę, opinie, czy różdżka to użyteczny przedmiot czy bujda są podzielone. Sądzę, że różdżki działają, w ten sposób, że osoba która się nimi posługuje podświadomie wychyla dłońmi tak, by uzyskany wynik był zgodny z prawdą. Skąd osoba wie, jaki powinien być wynik? To już inna historia.

Zazwyczaj różdżki są wykonane albo z drutu, albo z gałązek, dziś skupimy się na tym, jak zbudować różdżkę tego pierwszego typu.

Różdżka i parapsychologia: wykonanie różdżki

Osobiście skłaniam się ku teorii, że ruch różdżki spowodowany jest nieświadomym ruchem dłoni badającego. Skąd bierze się zatem ten ruch, i dlaczego jego efektem jest udzielenie poprawnej odpowiedzi? Jedna z koncepcji zakłada, że podświadomość stara się nam odpowiedzieć na pytanie, które postawiliśmy. Nasza podświadomość jest zaś częścią globalnej "podświadomości" i z niej czerpie potrzebne informacje.

How to hide an image inside another image?

At first glance, there's nothing special on below image..

..but in fact, on this picture is hidden another one:

It was done, by using steganography, the second image was stored on two lowest bits of the pixels. On two bits we may save values from 0 to 7, pixel in the image may have values from 0 to 255, so such small change is not visible to the human eye.

Zipf's law and natural languages

If we count the appearance of words in a sample of (most) human languages, it's visible that they have the Zipf's distribution. It can be used to distinguish human languages (and humans) from texts generated randomly (by spambots). This is presented on below histogram:

Zipf's law in natural languages

Below I will present tools that I made to verify this, first of them is a C++ program used to parse a text and generate a distribution of words that he encountered, second is a R script used to generate diagram from mentioned distribution.

How to distinguish human languages by letter frequency histogram?

How to find without dictionaries a language of a text sample? It can be accomplished by comparing frequencies of letters in a sample and in known languages. For example in polish 'a' letter is about 0.0551146 of all letters, in french it's 0.049458 and in german 0.0434701.

I created a small program in C++ that takes as an argument path to file with unknown language and print, how this language differs from languages that he knowns. The lowest result is the best match. Frequencies of letters in known languages are computed from files in samples directory.

Below is the output for checked sample and this sample (in French):

bash-3.2$ ./a.out test3.txt 
difference between Polish language: 0.0965482
difference between French language: 0.0442431
difference between German language: 0.0945827

A simple trick to avoid "goto" statement

Error handling in C is sometimes done by using goto and labels. One of examples in the Linux kernel:

static struct avc_node *avc_alloc_node(void)
{
    struct avc_node *node;

    node = kmem_cache_zalloc(avc_node_cachep, GFP_ATOMIC);
    if (!node)  
        goto out;

    INIT_RCU_HEAD(&node->rhead);
    INIT_HLIST_NODE(&node->list);
    avc_cache_stats_incr(allocations);

    if (atomic_inc_return(&avc_cache.active_nodes) > avc_cache_threshold)
        avc_reclaim_node();
   
out:
    return node;
}

There's a trick with the usage of do/while construction that allows to write the same without using goto label. The idea is presented on below:

// with goto label
if (!bar()) {
    goto error;
}
someValue = baz();
error:
// with do/while construction
do {
    if (!bar()) {
        break;
    }
    someValue = baz();
} while (0);

Easier error handling by using automatic code generation [Perl interpreter]

Perl interpreter has an interesting mechanism to checks if function arguments have correct values. Below is its example from util.c:

char *
Perl_delimcpy(register char *to, 
      register const char *toend, 
      register const char *from, 
      register const char *fromend, 
      register int delim, I32 *retlen)
{
    register I32 tolen;

    PERL_ARGS_ASSERT_DELIMCPY;

    /* ... */
}

Body of PERL_ARGS_ASSERT_DELIMCPY is in proto.h:

#define PERL_ARGS_ASSERT_DELIMCPY   \
    assert(to); assert(toend); assert(from); assert(fromend); assert(retlen)

What makes those macros interesting, is that they are automatically generated by a perl script (regen.pl). They are created from a data stored in embed.fnc, a sample entry of this file is presented below:

: Used in util.cp
op  |void   |example_function   |NN const char *name|STRLEN len|

The script needs to be executed after any change in embed.fnc.

Interesting and weird.