What an expert programmer should know about regex internals like DFA & NFA state machines

Kleene Star Closure courtesy of Wiki Commons

Like most programmers, I’ve been using simple regular expressions/pattern matching like “/^Foo(bar).*/” for years, but I admit when I need a complex one like a basic email checker:


  1. I often hacked my way to finding the right regex with Google’s help
  2. I had a very shallow understanding of how it really works

This article explores the fundamentals of regex that solid engineers must know, but also dives into the less known details of how they are implemented…

Everything in software engineering has changed within a decade

Old technology
Photo by Ugi K. on Unsplash.

I was a hands-on technologist 20 years ago, turned to management ten years ago, and am now hands-on again as a consultant. I’m amazed by some changes and surprised by others. Here is a basic rundown of what almost caused my early demise.

Unix Is Back for the Developer (Silver Lining)

In the ‘80s and early ‘90s, a lot of professional software was developed on expensive Unix workstations like a Sun Sparc or NeXT Station. …

Step thru the process of building & training a custom NLP sentiment analyzer.

Could we apply sentiment analysis to Vulcans? Maybe not… Wiki Commons Photo [0]

Do Vulcans express sentiment without emotion? With the power of Machine Learning, we can find out. We shall evaluate famous Spock Quotes using this (yet another) basic guide to Natural Language Processing (NLP) and Sentiment Analysis (SA) methods.

“Once you have eliminated the impossible, whatever remains, however improbable, must be the truth” — Mr Spock & Sherlock Holmes

Research, anecdotal, and personal experience claims teams of 3–8 are the best — but here is what I found

People meeting
Photo by Annie Spratt on Unsplash

I am not sure if he really said that, but he did say:

“If there are n workers on a project, there are (n²-n)/2 interfaces across which there may be communication, and there are potentially almost 2^n teams within which coordination must occur.”

Visually the communication problem is like below (Metcalf’s Law):

The story behind the clever optimization and why it is now just folklore

Photo by ELLA DON on Unsplash

For those who haven’t heard of this code trick/optimization, the premise is, we need to do “1/√x” a whole bunch of times to render 3D graphics and cool shaders. If you didn’t take Vector Calculus, or like me only got a B+, then you may be very fuzzy — maybe this helps (or maybe not):

Part 2 of the “Rust for Old People” Series

Photo by Dean Brierley on Unsplash — I need to spend that much more time on Rust….

Comments from my prior article Rust for Old People — mentioned how I did not really highlight any of the cool features of Rust. Thus I fired up the IDE again and dug thru countless Reddit, StackOverflow, and Quora forum threads to list and code up what I missed (which is A LOT). Warning I’m a relative newbie (noob) in Rust.. I welcome comments/corrections.

Enums — towards a classless society (or language)

What is simple in C or Java is really a core building block of the entire type and error system in Rust. The rabbit hole starts here:

enum Number {

In C or…

I spent $50 on my articles on Facebook Ads, and here is my ROI

Photo by Jp Valery on Unsplash

TLDR; the teaser image gives it away — no it did not work for me, but let me explain the process and analysis in more detail.


Like most writers, I want to expand my readership and figure out how to crack the Medium code. I suppose the key is to write good articles, but as an engineer I’m always looking at shortcuts. I read suggestions to run a few FaceBook ads so I gave it a shot.

The How To Guide

Getting started was not too difficult using Facebook’s Ad tools. …

Media, anecdotal evidence, and hard research into the “geek syndrome” for Engineers — what’s the truth?

Photo by sebastiaan stam on Unsplash

One could argue about stereotypes like lawyers talk too much, doctors have God complex, bankers are jerks, CEOs are ruthless, and software engineers are weird! As a fellow engineer let me analyze this rude but semi-true stereotype.

Why Engineers may seem weird

Most professionals come from a variety of backgrounds while engineers are from a focused narrow group. A few hypothesis follow.

What I learned about building costs in Japan

Photo by Brett Jordan on Unsplash

Needless to say, people in Japan love new things — electronics, cars, and even houses. Most foreigners still have trouble with the idea of a “new house” and “old house” — but that is literally how its viewed and called in Japan. I talk to the realtor and say “I’m looking for an old house / 中古を探してます.”

I spoke to 5 or so housebuilders in Japan. From this experience I am generalizing my findings.

Base Cost Per Sqm / Tsubo

The costs per square meter or tsubo (3.3sqm) vary between home makers but are centered around 1m JPY / tsubo, or 3m JPY / ~$3,000 /…

A collection of good blogs and resources

Photo by Sora Sagano on Unsplash

Random collection of good reads for Japan Real Estate Investors, Renovators, and House Maintainers.

Top Suggestions

FB Group — Building and renovating a house in Japan

A fantastic resource with lots of active builders, investors, building and renovating real estate. Lots of great advice and info sharing. Sorry for FB haters, this is the best forum as of 2021.

Blog — Japan Property Central

A great blog to subscribe to with articles on current trends in real estate, new developments, and a good FAQ on Japan property details like how to get financing, joint ownership options, and advice on negotiating.

Blog — CatForHead

A very detailed blog on various aspects of Japan real estate from 2 seasoned writers whose work…

Doug Foo

Tech Manager by Day, ML Hacker by Night — founder: foostack.ai

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store