Joseph Hallenbeck

Kynda

Years ago I filed to incorporate a limited liability company. I did nothing with it since, but now find that I am at the juncture in my career when I should feel comfortable with taking on and managing client work beyond the stable income of my employer. This is the natural progression of a remote worker, and while I have no plans of leaving my day job, diversification in this age is absolutely necessary.

Kynda Consulting will focus on serving the White Mountain area, by providing website development and hosting at the local level, and bringing economic development to the region by enabling larger clients to outsource work to rural remote freelancers.

Primary services that I will focus on:

  • SMB custom website design, hosting, and maintenance promoting local business and nonprofit interests.
  • Staff augmentation for existing agencies and software products
  • Workflow and business automation to improve the efficiency of client employees and “automate the boring stuff”
  • Consulting services to address client legacy software product issues including feature additions, bug fixes, feature-complete rebuilds, architecture road maps, and security vulnerability audits
  • Consulting services to help existing teams incorporate BDD and DDD techniques into their architecture and testing strategies
  • Exploration into identifying potential SAAS ventures that solve SMB needs
  • Exploration of the production of financially solvent independent games, middleware, or freelance contributions thereof

This venture will be a new and exciting challenge for myself. It will challenge me to demonstrate that I can ship a client project (I can), but also to learn how to land a sale – a skill that I’ve yet to develop and terrifies me.

The Pragmatic Programmer

Continueing my book club notes on the the Pragmatic Programmer by Andrew Hunt and David Thomas.

Chapter 3

  • The best way to store knowledge is in plain text, not binary blobs
  • The drawback to plain text is that it comrpesses poorly, and may be expensive to process. This doesn’t seem particularly relevant with modern computers, but I suppose embeded systems still suffer this drawback.
  • Plaintext helps insure against obsolescence and eases testing
  • Shell beats GUI
  • Get good at one editor until it’s like playing the piano
  • Use source control (yeah we’re doing the obvious now)
  • Embrace debugging as just another form of problem solving
  • Turn your ego off when debugging. This is made possible by focusing on fixing the problem and not assigning blame
  • Avoid panicing when debugging, accept that the bug is possible, resist the urge to fix the symptoms while leaving the cause
  • You can only get so far with automated testing, at times its fastest to simply interview the user
  • Rubber Ducking, attempt to explain the problem to someone else, if it’s a rubber duck
  • Learn a scripting language (or these days, learn a systems language)
  • Have code generators actively monitor and rebuild generated code

Chapter 4

  • We are taught to code defensively and validate against bad input. We should also be defensive against ourselves
  • Design by Contract (DBC). Define a contract of the pre-conditions for a method call and the guranteed post conditions that method promises. Contstraint invariantss to occuring only within the call itself.
  • Be strict with the pre-conditions and make only small promises for the post conditions
  • Crash early, don’t ignore an error or assume the system will resume stability once one occurs
  • Use assertions to guarantee that events that won’t happen can’t happen. Keep assertions in production to detect these “impossible” events during operation (you won’t detect these during a normal test pass anyway)
  • Exceptions should rarely be used as they interupt the program flow.
  • If you remove all the exception handlers, then the code should crash.
  • The routine that allocates a resource is responsible for deallocating it.
February 09, 2018

Shell Notes: Find and Tree

Filed under: Software Development part of Notes

Continuing my deep dive into shell and editor commands to find, useful tools that I’m not taking full advantage. This week is the Find and Tree commands.

Find

Find is used for traversing a tree of files and performing some operation on them. It is one of the core Unix utilities and fairly universal on systems. My big discovery this time is the realization that I can use find for more than just searching for files. I can use find to perform operations on the results. There are multiple actions besides the default -print, e.g. -delete and -exec both open up a world of possiblities that I would have otherwise resorted to piping the results into a loop (or resorted to Python) to resolve.

$ find [-H] [-L] [-P] path... [expression]

The flag -P is the default behavior. -L specifies find to follow symbolic links. -H will follow symbolic links while procesing the command line arguments. The path parameter is required and can use globbing similar to ls or other terminal commands.

find excepts a number of operators for fine tuning our search. ( expr ) forces precedence, ! expr evaluates true if the expression is false, expr1 -a expr2 evaluates expr2 only if expr1 is true, expr1 -o expr2 evaluates as true if either expression is true. For example:

find . -name 'fileA*' -o -name 'fileB*'

Searches the current working tree for a file whose names start with “fileA” or “fileB.”

Example commands:

$ find . -name 'my*' Searches working directory for files starting with “my”
$ find . -name 'my*' -type f As above, but excludes directories and searches only for “regular files”
$ find . -name 'my*' -type f -ls As above, but pipes the results into the ls command.
$ find . ../Done -name 'my*' -type f -ls' As above, but this time we are searching both the working directory and the ../Done directory!
$ find . -name '*md' -o -name '*latex' Find all markdown or latex files in the working directory
$ find . -name '*.md' -type f -exec chmod 664 {} \; Finds all markdown files in the working directory and executes chmod 664 replacing the value {} with the path to the file. Note the required \; at the end of the command and that the command cannot be placed in quotes.
$ find . -type d -empty -delete Deletes all empty directories in the working directory. Note, that the delete option can simply be used as a replacement for the default option of -print. That is, whatever whould hae been returned without the -delete is what would be deleted.
$ find . -iname "*MD" Case insensitive name search
$ find . -size 100k -a -size -500k Find allows for searching by file size.
$ find . -mtime 30 Find all files modified in the last month. We can do -mtime +50 -mtime -100 to find files modified more than 50 days ago and less than 100 days.
$ find . -cmin -60 Find all files modified in the last hour. find . -mmin -1 does the same thing but with an interval of hours.

Tree

While reading on find last week, I stumbled upon tree. Tree is one of those commands that I ocassionally recall, think is really cool. Then completely forget about.

Tree gives you the ability to generate a visualization of the directory tree, much like the old Windows Explorer provided a tree view of your directory.

In simplest usage, you simple call tree, and it outputs a tree representation of the current working directory. If we want to display a different directory, we can provide that for the first argument: tree ~/Documents.

By default, tree displays symbolic links showing where they point towards. However, if the link is a directory, it does not, by default recurse into that directory.

Flags:

-a Display hidden files
-d List directories only
-f Display full paths
-i Don’t indent/show tree lines. Use in conjunction with -f to create a file list
-l That is a lowercase “L,” do recurse into symbolic directories
-P pattern or -I pattern List files that match the pattern, or list files that don’t match the pattern
-u, -g, -p, -s, -h Print the user, group, permissions, size in bytes, or human-readable sizes