Posts

A simple vba macro to import and correct a tab delimited text file

Image
  A simple vba macro to import and correct a tab delimited text file Recently a friend asked me to make a spreadsheet that imported a short tab delimited text file generated as a report from a commercial product and then made some calculations. We tried importing the page with Excel's `Import` menu item, but there were some corrections that had to be made (because of spurious extra tabs in the input text file). By writing a short vba macro, I: Could make this a one button operation Could correct the problems in the text globally before placing items in the cells I decided to share the code in the hope that it might save someone some time and grief in trying other approaches Google search, then hack away I tried to find an excel vba script that placed an item at a time in cells, but I could not find one easily, so I wrote the following Sub RoundedRectangle1_Click() Dim Ret Ret = Application.GetOpenFilename("Text Files (*.txt),*.txt") If Ret <> False Then ...

A lightweight bash Object Oriented function based on jq

Image
  A lightweight bash Object Oriented function based on jq I've developed a tiny function that wraps jq to provide an object oriented coding package that plays nice with BATS and VS code debugging. The function is available on github , and this article explains and supplements the oo_jq code Motivation At one point I decided I was stuck refactoring my team's extensive bash scripts, and I should bite the bullet and get used to it. My main objections to bash were: No debugger No object oriented capabilities No way to implement unit tests So I began searching for bash packages that would fill these gaps. Very quickly I was pleasantly surprised to find a healthy sets of solutions for these short-comings: Visual Studio code has a bash debugger that works quite well BATS testing framework works beautifully bash oo framework provides a heavy weight system I was quickly disappointed in the oo framework because of how slow it was when debugging it in vscode ; I think it was taking...