The Worst Kind of Programmer

After 25 years of my career I came to understand that one particular type of programmers is the source of many problems in our industry. Here is the story of a project that was nearly destroyed by two such programmers. One of them was leading frontend development, the other – backend. While the rest of the team was slacking off because business requirements were in the works, these two chaps were working hard.

The frontend lead bootstrapped an Angular mono-repository with NX, Rx and other trendy technologies of the moment. The corporate environment did not lend itself easily to NX, but he pushed hard to solve or circumvent infrastructure problems by working with the domain expert. He set up a workflow that, while having Angular as the base framework, bore little resemblance to the official Angular tutorials.

The backend lead was no less motivated to bootstrap the Spring Boot project according to the corporate guidelines while adding a bit of a personal touch in the form of the Vavr library and a highly sophisticated hierarchy of JPA entities with multiple levels of inheritance, discriminators and generators. He then sprinkled it over with a hierarchy of validators based on both Spring Bean Validation and a third-party validation framework and polished with a trendy testing framework.

The rest of the team observed them in admiration.

On coding interviews

I am one of those senior engineers who regularly code and dare I say produce optimal solutions quickly. I still fail at coding interviews, and I attribute it to the gamification fatigue and age.

Please understand me. I have a leetcode account but I can not force myself into solving puzzles in my free time after solving them all day long at work. And puzzles at work are more interesting, because they are real people's problems.

I avoid board games for similar reasons. Whenever I sit in and play, I enjoy being in the flow, the conversation, and the intellectual challenge. But dragging me in is damn hard.

On the other side, I am much more into sports nowadays: running, swimming, skiing and hiking, as if I was making up for my younger years spent in front of a screen.

I feel like I have to carefully choose where to apply my intelligence because I am not as resourceful as I was. But I am wiser.

Would you hire me? No. Would I be a net positive for you business even if I cost double your younger self? Probably yes.

On the winning strategy in a core team

I was once hired for a core team job. Between my hire and the first day, the core team manager resigned and I was reassigned, so I did not have much chance to work with him.

Instead, I landed in a middle of a drama. The previous core team manager was a servant leader, delivering bare minimum and helping on administrative and organizational matters. He was the loosing party, preparing to quit and passing affairs. By virtue of being hired by this guy, I was considered his protégé by the new core team manager.

That new manager was operating by decrees, and his first decrees were naturally targeted at everyone who could have undermined his authority, including me. Instead of helping he was setting standards and mandating bills of materials. Older product teams mostly ignored him, but new ones were suffering. By the time I left, the guy had a promotion.

Lesson learnt? Core teams win by imposing, not helping.

What do to if your website was marked as malicious by an antivirus or security vendor?

Aside from the obvious JavaScript injections and framework exploits, check for

  • multiple redirects
  • \u-encoded JavaScript code
  • broken or too permissive CORS along with suspicious backend name

Then, check different website URLs on Virustotal URL checker and use yaronelh/False-Positive-Center to report false positives.

Enjoy.

How to do a healthcheck in a Docker image without curl?

There is a tendency to strip docker images from wget and curl. Luckily, perl is still available. If you have trouble configuring spring boot healthcheck, think of perl and its IO::Socket module shipped with perl core:

FROM openjdk:11-jre-slim
HEALTHCHECK --start-period=10s --timeout=3s --retries=5 \
 CMD perl -e "use IO::Socket; $sock = IO::Socket::INET->new(Proto => 'tcp', PeerAddr => 'localhost', PeerPort => '8888') or die $@; $sock->autoflush(1); print $sock 'GET /actuator/health HTTP/1.1' . chr(0x0a) . chr(0x0d) . 'Host: localhost:8888' . chr(0x0a) . chr(0x0d) . 'Connection: close' . chr(0x0a) . chr(0x0d) . chr(0x0a) . chr(0x0d); while (my $line = $sock->getline ) { if ($line =~ /UP/) {exit;} }; close $sock; exit 1;"

Using parametric equalizer with software mixer in alsa

The full contents of /etc/asound.conf:

pcm.dsp {
    type plug
    slave {
        format FLOAT
        rate unchanged
        pcm {
            type ladspa
            channels 2
            path "/usr/local/lib/ladspa"
            playback_plugins [{
                label "ladspa_dsp"
            }]
            slave.pcm {
              type plug
              slave.pcm {
                    type dmix
                    ipc_key 1234
                    # Xenix 302USB
                    slave. pcm "front:CARD=CODEC,DEV=0"
                    # built-in
                    #slave. pcm "hw:1,0"
                    bindings {
                        0 0 # from 0 => to 0
                        1 1 # from 1 => to 1
                    }
                }
            }
        }
    }
}
pcm.!default {
        type copy
        slave.pcm "dsp"
}

Composition and fading in French

There is a French expression au jour d'aujourd'hui which means "as of today", however, aujourd'hui itself means "the day of today", because hui is the Old French word for "today" and aujourd' is obviously the concatenated form of "au jour de".

But it does not end there: the Old French word hui evolved from "hoc die", which means "this day" in Latin.

At the end, the best explanation of au jour d'aujourd'hui is

(as-of
   (the-day-of 
     (this (day)))

which is fascinating.

How to render a tree like an HTML table: in a HTML page

This fiddle says it all, but let's go briefly over it.

Whenever you are building a table out of a tree, use <table>, <tr>, <td> tags or their CSS equivalents table, table-row and table-cell and apply display:contents to the elements that you intreleave with the table to preserve your tree without destroying the table layout.

Easy-peasy, but it took me a while to figure it out.

Pages