GDB Hex Display

I always forget how useful that is, so writing it here:

x (for "examine") examines memory in several formats

x/nfu addr
x addr

n, f, and u are optional parameters that specify how much memory to display and how to format it;
addr is an expression where to start displaying memory. 

n, the repeat count
Decimal integer; the default is 1. It specifies how much memory (counting by units u) to display.

f, the display format
One of the formats used by print, 's' (null-terminated string), or 'i' (machine instruction). The default is 'x' (hexadecimal) initially. The default changes each time you use either x or print.

u, the unit size
The unit size is any of
    b - bytes.
    h - half words (two bytes).
   w - words (four bytes). This is the initial default.
   g - giant words (eight bytes).



Template for mastering the obvious

Title:What we learned from Google/Facebook/Twitter/<insert other big name that gives you a boner>”: state something obvious.

Overview: Describe in at least 100 words anything everybody knows. Don’t forget to combine here a mentoring attitude with clever hints on a tremendous importance of this obvious thing. Pretend that you are an elite knowledge worker, who earned this privilege of really understanding this obvious thing in multiple elegant brain-storming sessions with the same high quality bright intelligent people, or in a stressful, but extremely rewarding agile environment with a multi-million client.

How is works: Describe in at least 200 words what everybody knows about how this obvious thing works. Don’t spare any well known detail. Insert a “clean” looking diagram, because nothing complements an obvious thing better than a useless trivial diagram that pictures the obvious.

Describe how this obvious thing saves lots of time and money. Provide some useless numbers you pulled out of your ass to prove it.

Describe how this obvious thing promotes the openness. Again, about 200 words will do. Don’t lose your focus: state that this is obvious that openness is awesome, but you are writing about a different obvious thing.

Describe how this obvious thing is good for teams. Everybody knows that anything obvious that is useful is done by teams, and only sore losers do obvious things on their own. That is why Microsoft Office and Linux kernel rule, and Git sucks.

Add something about how this obvious thing is good for something that has a word “social” in it. It will look smart and modern (only smart and modern people understand what “social” things are). Any social reference will do, except the “national-socialist” one. Also avoid references to U.S.S.R. (Union of Soviet Socialist Republics) because there is still plenty of people around who used live in that shit.

In conclusion: make something up about how this obvious thing shapes our “culture” in a positive manner and at the same time our “culture” shapes that obvious thing. Less sense you make is better because nobody is going to read that far.


What we learned from Google: code reviews aren’t just for catching bugs



After a few hours of searching for a new software for this web site I’ve decided to stick with this software and update its design: self hosted WordPress and WordPress 2016 theme.

I want to keep it self hosted, with some anti-spam protection and a decent set of plugins.

While I still do software for living I don’t really have time to write this software on my own: I seriously considered coding it from scratch, well, maybe with some open source libraries.

Setup for GitHub

Fresh Linux installation, setup for GitHub:

> ssh-keygen -t rsa -b 4096 -C ""
(add it to GitHub profile)
> gpg --gen-key
(RSA, 4096)
> gpg --list-keys
pub   4096R/C077F67D 2016-05-03
> gpg --armor --export C077F67D
(add it to GitHub profile)

> git config --global "github-username"
> git config --global ""

> git config --global push.default simple

> git config --global checkout
> git config --global alias.b branch
> git config --global alias.c commit
> git config --global status
> git config --global alias.stage 'add -A'
> git config --global alias.unstage 'reset HEAD --'
> git config --global alias.last 'log -1 HEAD'
> git config --global alias.visual '!gitk'
> git config --global 'log --oneline --decorate'
> git config --global alias.ll 'log --oneline --decorate --graph --all'
> git config --global alias.r 'remote -v'

> git config --list
(review it all)

No Wired

After many years being a subscriber I’m cancelling my “Wired” magazine subscription.

I don’t want to pay for articles for people who never grow up and live in a bubble with Silicon Valley as a centre of the Universe.

Also it’s annoying to browse ads for cigarettes and $5K watch – both items represent a life style that doesn’t attract me since I graduated from high school.

WordPress and Jetpack

Yes, WordPress seems to start following the global trend: “shove to your users throat whatever the executive dickheads decided”.

I’m talking about that bloated junk Jetpack.

The reason I choose self-hosting is precisely for that: to avoid this kind of modern social-media socialist style user management.

No, I won’t install it, never.

Please No Hungarian Notation

One of the old die-hard hobbies is Hungarian notation and using it results in horrendously unreadable code:

var dlg = oData as FormEditAlarms;
Color nForeColorConnected = SystemColors.WindowText;
var l = new List<ServerData>();
ServiceHostTreeNode(string strText, int nImageIndex, int nSelectedImageIndex)

So why using it? Why?!

Let’s look at advantages of Hungarian notation:

  1. The symbol type can be seen from its name.
    In all modern IDEs hovering the mouse over a variable shows its declaration that clearly states the type. And this does not matter in dynamically types computer languages.
    If you use vim more often than Eclipse (me too) then I’m going to ask you: why do you need to know a symbol type? I suppose it matters so you’d declare a proper type variable or a parameter to manipulate with it, right?
    So if your symbol name is text, you would try assign it to an integer? And pass selectedImageIndex as a parameter of a vector type?
    My point is: a proper name gives a clear indication on what a symbol is, including its type.
    This advantage is false.
  2. The formatting of variable names may simplify some aspects of code refactoring.
    Really?! May? Or may not?
    This advantage is questionable and therefore cannot be true.
  3. Multiple variables with similar semantics can be used in a block of code.
    This implies that variables with different type but the same semantic need be distinguished by its type. Alright, name them differently. But it does not mean that all other variables must follow this notation.
  4. Variable names can be easy to remember from knowing just their types.
    What is easier to remember: nImageIndex or imageIndex? tv_list or treeViewList? strText or text?
    Some cryptic abbreviated word or a familiar and recognizable term?
  5. It leads to more consistent variable names.
    This one is really pulled out of the Mariana Trench. It does not!!!
    oData and oServerData are consistent, right? Wrong! serverData and serverData are.
  6. Inappropriate type casting and operations using incompatible types can be detected easily while reading code.
    How about using the compiler warnings for that? Too high-tech?

Enough said.

Don’t use Hungarian notation. It has NO advantages. And makes your code unreadable.

Sloppy vs Right

Every time I join an existing project I have to do one of the most frustrating things in my profession: reading and making sense of other developer’s code.

This is where I always see a reflection of one of the oldest false dichotomies: sloppy coding vs. “right” one.

It goes like this: one cannot write “right” code fast enough for a given time frame, that’s why it is sloppy: bad design, too generic (or misleading) names for abstractions, “spaghetti” style of routines etc.

Why this dichotomy is false?

Because it justifies unprofessionalism.

In our profession, despite its seemly overwhelming complexity, there is a limited set of corner-stone principals and skills (definition of this set is out of scope of this post).

One who does not possess, use and master (to some viable extend) this set is easily recognizable by someone who does.

Reading somebody’s code is one of the ways to recognize it. Unfortunately it means that sloppy code made it into production, and people behind it (developers and managers alike) made reading it one of the most frustrating things in my profession.