Heisenbug: The true story of undefined behavior, Part 2

CommentNode’s position problem

In the previous part, we’ve discussed the problem that was presented in RedBaron. Today I want to show you my old work, my old little investigation about another strange bug(or feature?) in Baron.
Baron is a part of RedBaron library, literally, RedBaron relies on Baron Full Syntax Tree which it’s giving for next manipulations.
Baron had a problem with CommentNode’s position in the FST tree.
This bug broke RedBaron’s nodes recognition.

Below I’ll tell you a story about it and start from examples.
Let’s roll sleeves up and get down to business.

Continue reading


Heisenbug: the true story of undefined behavior, part 1

One day I was developing a program to work with a python source code. A kind of analyzer for the static code analysis. I found a library Redbaron and wanted conduct some research to understand its capabilities.No so fast cowboy I wrote a lot of python code in Pycharm created by the JetBrains. After my tests via pytest I’ve got the first bug. I’ve got the same problem like in #119 (Really, Is it a problem of IDE by the JetBrains?).

After debugging, I found some solutions, patches, and hacks.

Next, I’m telling you, dear reader, a story about a difference between hacks, patches, and solutions.

And Yeah, It hasn’t been a problem of IDE. Continue reading

Unexpected Journey – Migration by Aptik

Recently I faced with a problem: how to migrate my data from my laptop to another machine. Because my OS is an Ubuntu, I wanted to recreate the environment and copy the home directory with all configuration files. It sounds like a trivial task…

At first, I have been thinking about simple copying files and configurations. But I wouldn’t want to do a lot of work to install all packages that I have after that. Some kinds of administrator’s job are not for me. You know, it’s not for me. I don’t have so much patience.

I needed a quick solution, without a pain and stolen time. Ok, I started to search a tool that would simplify my boring routine with that. After few seconds I found Aptik.

Aptik is a tool to backup\restore and migrating system settings and data to the fresh installed OS or after re-installing\upgrading. Seems that is what I need. But a version of OS on my laptop is lower than on another machine. 15.10 vs 16.04. I didn’t know, this would be a problem or not. Fine, let’s go I said to myself.


sudo apt-add-repository -y ppa:teejee2008/ppa
sudo apt-get update
sudo apt-get install aptik

After that, I opened Aptik via superuser(it’s asking you about that). Oh, It could save all : ppas, themes, packages, installed software, application settings and etc. Mamma mia perfecto!


I selected a path to my backup directory on external hard drive and clicked backup for parts which I wanted. Ok, I installed Aptik onto another machine and plugged a hard drive with saved backups. For that moment all steps were correct . I didn’t see any errors.

And on a remote machine, I got a first interesting thing. All software sources were restored correctly but download packages were not. Ok, looks OS versions is not compatible backward. (Seriously?) When I had been restoring Themes Unity had broken. Oh, man. It wasn’t funny. I reinstalled Unity.

Application Settings and Installed Software were restored correctly. At the first look…

As I recognized later some software were not installed. I have been installed it manually. Some icons were broken. I don’t know why, but Aptik didn’t save my Icons correctly. When I copied one manually, an application was opened normally, yeah looks like I was right.

Two days of copying and restoring were unforgettable. Why we can’t create a system like a VCS(git)? Just commit changes into the control system and pulling on another.

Hey, boy, do you hear something about rsync? My dev folder with all sources and projects that I have I synchronized via rsync:

rsync -ravh --progress -e ssh /home/user/Dev remote:/home/user/Dev

I already had a connection between my laptop and remote desktop in another terminal when I had been synchronizing folder. But anyway it doesn’t matter. The key for the remote machine was in .ssh/known_hosts – that was significant.

Remember! Your system is under potential risk by rsync. Do not use it for production, please, be careful and do not compromise your security.

But, anyway, thank you Aptik, this tool saved me a lot of time.

A further journey I will be in manual mode to restore my environment on new machine

Silver bullet is a myth

Computer Viruses: Programmer’s View

 Sometimes ago I had finished the book about computer viruses and anti-viruses. This short article is just a summary of my recordings. Moreover, it is a translate from Russian to English(the book is in the Russian). I’ve got a lot of fun. Great work of the author, thanks a lot for it. ( Климентьев К.Е. “Компьютерные вирусы и антивирусы: взгляд программиста” – link to order).

I would like to talk about common technologies that use in some viruses, such as Win32.Zmist andWin32.MetaPHOR and etc. I am not a malware guy and don’t want to describe all stuff about internals, but just rewrite some concepts of those two from the book and other sources. Because viruses just use approaches of those two. Look:

  • RPME – Real Permutation Engine
  • UEP – Unknown Entry Point (same as EPO) : this method inserts first commands (entry point of a virus) inside of the middle of an original program.
  • ETG – Executable Trash Generator : this method generates trash commands to hide original commands of a virus inside of a program.
  • MistFall – mixing code of program and virus
  • disassembler – this creates disassembly code of a program.

Let’s explore some principles.

Continue reading

Code-Fu: The way to be better or Mystery of Code Mastery

What is a code-fu? Is there a code-fu?

Код-фу – это довольно странная штука. Вроде бы разработка, хакерство, процесс творческий. Однако существуют каноны, которые приняты индустрией. И, так называемая, правильная вещь, порой отсутствующая в некоторых людях напрочь, не всегда совпадает с этими канонами.(Определение “правильной вещи” можно посмотреть в The Original Hacker’s Dictionary или прочитать в книге Hackers: Heroes of the Computer Revolution ).

Continue reading

Economy of Brains или Мир, который сходит с ума

        Наше завтра это то, чего на самом деле не существует. Хотя бы потому, что с точки зрения физики определяется вероятностным переходом из состояние “сейчас” в состояние “завтра”. С точки зрения времени “сейчас” это и есть “завтра”, которое еще не наступило.

        Технологический прогресс цифровой эры, новый информационный век переходящих пост-индустриальных обществ, заставляет по-новому смотреть на этот удивительный мир, в котором перемешивается Хаксли и Оурэлл.

        Прогресс, как средство искусственно-естественного отбора, не остановить. Мы можем хотеть этого или нет, но будущее настанет – с нами или без нас. Ему, в смысле будущему, по-большому счету все равно.

Continue reading

The Importance Of Playing

Перечитываю одну замечательную книгу : Surely You’re Joking, Mr. Feynman! и нахожу, в который раз уже, параллели с собой. Ввиду того, что испытываю полный burn out – депрессию и все в таком духе, для меня советы вполне актуальны и важны. Самоанализ вполне себе вещь. Но специалист лучше.

И вот главная по мне цитата, таки выгорающим людям, от которых остается пепел:

But when it came time to do some research. I couldn’t get to work. I was a little tired; I was not interested; I couldn’t do research! …

And then I thought to myself, “You know, what they think of you is so fantastic, it’s impossible to live up to it. You have no responsibility to live up to it!”…

Then I had another thought; Physics disgusts me a little bit now, but I used to enjoy doing physics. Why did I enjoy it? I used to play with it. I used to do whatever I felt like doing – it didn’t have to do with whether it was important for the development of nuclear physics…

So I get this new attitude … I’m going to play with physics, whenever I want to, without worrying about any importance whatsoever.
Within a week I was in the cafeteria and some guy, fooling around, throws a plate in the air. …

I had nothing to do, so I start to figure out the motion of the rotating plate…
And before I knew it (it was a very short time) I was “playing” – working, really – with the same old problem that I loved so much, that I had stopped working on when I went to Los Alamos; my thesis-type problems; all those old-fashioned wonderful things.
It was effortless. It was easy to play with these things. It was like uncorking a bottle: Everything flowed out effortlessly. …

There was no importance to what I was doing, but ultimately there was. The diagrams and the whole business that I got the Nobel Prize for came from that piddling around with the wobbling plate.

Поэтому начинаем пожалуй “играть”. Не заботясь особо о том, какое мнение составлено о нас. Насколько к нам “предъявляют” и насколько эти “загоны” осаждают нас. Мы не виноваты, что их ожидания такие – это их ошибка, но едва ли наша ответственность.

Just Playing!

Ten reasons to be a research software engineer

Данная статья является отчасти вольным переводом со следующего ресурса и несет в себе скорее просветительско-познавательный контекст. Когда я пытался понять куда мне двигаться, что все тлен и безысходность – то начал копать в сторону, а что мне интересно, что мне по душе. Где я могу реализовать свой потенциал, может быть стоит менять область? И результатом изысканий стали десятки просмотренных страниц, частью которых я спешу поделиться, но четко выраженных в представленной ссылке, однако обо всем по порядку…

Continue reading

DO whatever the hell you want

Не думаю, что заголовок данного поста будет прямо отражать то, что я попытаюсь тут изложить. Но в принципе это не так уж и критично. Суть главное будет подмечена точно и емко – делай то, что хочешь делать. Как это касается разработки? А очень просто. Читаем далее…

Continue reading