The slow down and pacing of yourself

Fortran 77 is pretty specific about its output. I draw a line and split it into boxes, each holding a letter, number or decimal point. That helps me with the FORMAT() calls. Here is what it looks like diagrammed in Excel (but I use paper):

graph-paper - Copy

It takes four notebook-paper lines to sketch out. Between that and flow-chart diagrams, I feel like I am planning programs, designing them, instead of diving straight into coding.

Using %%~ni in batch scripts

If you access files from a subdirectory, the path will include the parent folder. Some typical assumptions of treating the file as just its filename will result in error messages of not being able to “find the specified path.”

for %%I in (sub\*.csv) do (
  set tofile=%%~nI
  set tofile=!tofile:.csv=!.html

  perl parse-it.pl %%I > html\!tofile!
)

If you don’t use the tilde-n initially, the value of !tofile! will be

%cd%\sub\html\<filename>
     ^^^ error

References:

  • set /?

DJ scripts-a-lot

Since I’m able to web-scrape my way to automation, I can mix up different results any which way. One such use case is to record human conclusions for later data mining. After the initial scripts to collect the data, I use perl and regular expressions to parse out the important bits. It’s not so much industrial strength as quick and task-driven, but it is that too.

Tcl for the backend, collecting hidden input tags as well as the user’s input. That can be compiled later into different reports. Once you can produce the raw data, you own the source. If you own the source, you can flush it into Excel and wield VBA like a madman. Treating data as a grid is a killer feature.

Sometimes I entertain the idea that people will “catch up” to my doings, as if I had been a pioneer. The truth is I’ve learned most everything from the Internet, and what I give back is meant to help others. But I don’t think you can land a six-figure job on intuition.

No such user

I wrote one of my first programs for IT. It creates a string that copies to the clipboard. They can paste it into their tickets. Later, a macro automates the report that collects these perfectly-typed strings.

IT folks poke at software for fun, and I should have expected it. “BUG,” read an email, detailing a trivial way to mess up the process. That led to a hundred extra lines to force a sequential process, iterations across JButton arrays, setting enabled(false), and checking global Boolean states.

The first hour was spent futzing with ButtonModel and selection calls. The next was spent placing the groundwork for a procedural solution. The logic to that took half an hour and zero documentation.

Compact Access 2007 database from command-line

Microsoft recommends compacting Access databases “regularly” as this will prevent corruption. If the file is on the network, data loss is inevitable. Mitigating its effects involves a comprehensive strategy centered around damage control, seemingly.

Programmatic compacting can be done with

> start access.exe my-db.accdb /compact

Next challenge: making sure the .laccdb lock file is not present; i.e., your users aren’t using the database meanwhile.

A similar kind of VLOOKUP

Too lazy to record the macro to switch columnsĀ – VLOOKUP() requires the source column to be leftmost – I used INDEX and MATCH instead:

=INDEX('TableArray'!C:C, MATCH(B2, 'TableArray'!D:D))

MATCH() returns the row number and INDEX() returns the value of the intersection between the row number and the column. A neat trick.

Some people have been moving to other jobs. The biggest reason is the new company pays more. I wonder if it’s more for more effort or more for less?