hacks and kludges

Stumbling through or-tools

The other day I pip installed google's or-tools and started madly optimizing every facet of my life, using constraint programming. Er, well, actually I've been futzing about solving toy problems and trying to figure out how to use or-tools?.

tags: python, or-tools, constraint programming,

Working around a mapping bug in cartopy

I recently discovered a bug in how I was generating choropleth maps with cartopy. Basically the add_geometries() function for adding shapes to matplotlib maps was not mapping the correct face colours to the correct geometry.

tags: python, mapping, cartopy,

Making and unmaking spreadsheets

One unfortunate thing about using excel for coding at work is the difficulty in version controlling spreadsheets. Excel files are big binary blobs and, unlike the source files for most programming languages which are text files, cannot be easily diffed. This raises all sorts of issues with the maintainability of the spreadsheets and the macros that are embedded in them. I hacked together a simple solution to this problem in powershell, for newer versions of Excel (I have Excel 2013 on my work computer and it works there!)

tags: excel, vba, powershell,

Numerical Methods and Excel VBA

I'm a big fan of using circular references and other tricks to get excel to solve equations numerically and automatically. Nobody likes constantly clicking through the solver or using goal seek when the spreadsheet could just solve itself. However circular references can be a hassle, especially for the uninitiated.

tags: excel, vba,

Scraping html tables in excel part 2: first blood

Last time I dealt with VBA I came up with a horrible kludge for getting html into my excel spreadsheet. After noodling around I have found a better way.

My first attempt at copying the contents of an HTMLTable into an excel spreadsheet was slow as molasses. It took literal …

tags: excel, vba,

HTML Scraping with Excel and VBA

Because I was a bad person in a past life, and I need to be punished, I work in a place where the one and only tool for doing calculations is excel, and my data source is a cryptic enterprise intranet that uses activex for everything and does not have …

tags: excel, vba, suicidal ideation,

Least squares fitting to a differential equation

Recently, in a class on process modeling, I had the task to fit some model parameters using some experimental data for a CSTR. The model for the CSTR being used was a set of nonlinear differential equations. I looked at the answer given and I don't like it, it uses …

tags: matlab, curve fitting,

Excel trick: circular references

I am not a big fan of using excel for doing complicated engineering calculations. I have spent way too much of my life trying to find the mistake another's convoluted spreadsheet, it is all to easy to make "spaghetti code" in a spreadsheet.

That said I'm now going to talk …

tags: excel, pipe flow,

when an energy balance doesn't

This is just a funny quirk that came up recently in some simulations that caused some consternation before the problem was nailed down. The root is one of those little details that you ignore until it turns into a big detail.

So, I have this big flowsheet in VMGSim, a …

tags: VMGSim, thermodynamics,

Distillation towers in VMGSim

I've been spending my days noodling around in VMGSim recently, and I figured now was the time to talk about how I get my towers to converge. Some of my peers have a hell of a time getting their towers to converge, and I think it boils down to a …

tags: VMGSim, distillation, thermodynamics,

Getting by without matlab

Matlab is a key part of any engineers education, at least in these parts. Matlab is the workhorse in most classes I've taken for everything from statistics and regressions to control theory. However matlab costs money.

So as a broke-ass student you have the option of hoping that your school …

tags: matlab, octave,


Page 1 / 1