Czym jest medytacja? Jak medytować? Popularne techniki medytacji.

W codziennym życiu koncentrujemy się na otaczającym nas świecie, gdy jesteśmy w pracy zajmujemy sie pracą, gdy jedziemy autobusem patrzymy na świat za oknem, a gdy rozmawiamy z kimś, to słuchamy go i współuczestniczymy w rozmowie. To normalne zachowanie, dzięki któremu możemy utrzymywać się materialnie, istnieć w społeczeństwie czy też trafić po pracy do domu. Problem zaczyna się, gdy zewnętrznych spraw jest za dużo lub gdy boimy się pomyśleć o sobie.

Gdy brakuje czasu by zastanowić sie nad sobą, by dać sobie chwile wytchnienia, życie często staje się cięższe, co zaś prowadzi do tego, że jest gorzej i tym bardziej nie ma się czasu albo chęci by się nad sobą zastanowić. Błędne koło zamyka się, a efektem jest często rezygnacja, rozgoryczenie, lęki i depresje. Czytelnik na pewno spotkał się z ludźmi wiecznie narzekającymi na świat, na sprawiedliwość i wszytko na co się da narzekać.

How to use Finite State Machine in parsing of assembly language?

Finite State Machine - abstract

Often data must be analyzed chunk by chunk, checked if all of those chunks are valid (if the chunk is valid itself and if it's valid in context of previous chunks) and when some actions must be taken according to each type of this chunks. This can be easily modeled using finite-state machines (FSM).

State Machine has its state and transitions. There is at least one entry state, there may be termination state.

One task can be done by using different FSMs, but of course we should create them as simple as possible. What is nice in those tools, is that they may be easily extended. You may add new states, transitions, split existing state into new ones or nest new FSM into existing state.

Title of this post may confusing to people looking for concepts to build their own compilers or parsers. Shortly, reading them requires parsing code on three levels: lexical, syntactical and semantical, but presented FSMs may be directly applied only in the first case.

In next posts we will explain in details this assembly language and show, how to made its virtual machine, where FSM will be used as a part of it.

How recursive packing of a file changes its size?

How the size of a packed file will change if you will pack it again? How will it change if you do that again and again? Will it be the same, bigger of smaller? I checked this with popular kinds of files and below I will show the results. I used Bash script and R language to check this. Charts shows how the file size changes in each iteration, first bar is the size of original, unpacked file.

How to use regular diode as a photo-element?

There are special diodes, transistors and resistors designed to measure light intensity, sometimes even a regular LED is also used for this task, can be used. I was wondering, if any diode (in a package that doesn't block light rays) could be used? Today I will share the results of my experiments.

How to clean silver by using aluminum foil and salt water?

Silver may be cleaned in a simple way, all we need is a couple of materials that are present in every house. Today I will present this simple cleaning method.

How to clean silver silver by using aluminum foil and sat water
  • Use dish washing liquid and toothbrush to clean jewelry from dirt.
  • Dissolve a spoon of kitchen salt into a glass of hot water.
  • Put aluminum foil into the water, on the top of it put your silver jewelry.
  • Wait 30 minutes, clean silver under current water and let it dry.

Mistakes during checking if a returned value is null

This is a bit modified real word example, found by tool for static analysis. In this code, foo() is a function that returns pointer to std::string or null pointer.

std::cout << foo()->length() << std::endl;

There's obvious bug here: executing length() method on value returned by foo() without checking if this variable is not null. At first it looks that it could be fixed in below way:

if (foo()) {
    std::cout << foo()->length() << std::endl;
}

Unfortunately above code is also invalid because it can't be sure that if a function once returned not null value, then it will returns it next time. This may be fixed in below way, where temporary variable was used to check if length() may be executed on variable retured by foo().

std::string* fooObj = foo();
if (fooObj) {
    std::cout << fooObj->length() << std::endl;
}