c-c-cURL breaker

They did everything except consider their web-space was an API for automation. The playwright sits outside and scrawls the mysterious intonations from the closed boardroom. The next day, some things have changed: scripts, after months of faithful process, smash into HTTP 400s and 500s.

Moving from ASP 2.0 to 4, there is a global config that avoids revalidation with each HTTP request. In scripting terms, I can use the same __VIEWSTATE and __EVENTVALIDATION values from the first GET. Theoretically, that was the case.

It doesn’t work, though. I’m not sure if I’m missing something in the query string, some tiny skip that makes the server hiccup. After dozens of these things launching, I get a bucket from the roof.

More to the crux of that point

It’s easy to feed off enthusiasm. Have a friend or meet a stranger, and he proposes to Make an App. Are partnerships like casual dating; can you work on several free projects at once? After the rush dies down, I want to explain how difficult it is to sustain that idealism. It is not completely being jaded – I do program on Windows predominantly – but it’s impossible to rationalize.

I like old things and I want to learn hard things. I want to investigate foundational technologies and create re-inventions of theoretical constructs. This clashes with every trend to seduce the mind of the Free, and I envy them. Neither of us needs to give in, but one of us is going to rake in money now and forever.

Actually, reading man pages is boring. I do prefer StackOverflow! I like searching for existing answers. I like getting things done. My ideal self wants to C, and I don’t think there’s any stopping the kid from his pile of sugar. Sometimes, a tummyache is the best medicine.

Earning one’s keep

I had a second instance of sweat today: the invisible kind, with the same rising pulse, the sudden intuition mixed with tremulous nausea. The other time was when I realized I had to put down everything and learn software engineering principles. If I didn’t conjure work products secondary to stakeholder use cases and scribble boxes with lines between, I would seek out a piped solution and leave people hanging.

I still don’t know the best way to deploy an application. Java demands the JRE. Tcl has an expensive IDE. AutoIt bears a proprietary banner. Perl rocks, but standalone compilation still needs love. There’s C#, but then I can’t slot in my own opportunity to learn something free. Ideology is creeping up on me – the same that keeps me grounded at home, dreaming big thoughts with small tools.

My strength is clutch mode: in a corner, impossibly burdened, I remember: I am a CS major; I can figure out anything. It brings a calmness, a focus amid the storm. Despite despair, somehow things congeal. Drawing on it is practice, but I’m not sure the stage is the best environment for lasting code.

Apportioned convenience

I am a product of this age: using scripts, leveraging the OS, and staying away from novel data structures, risky problems, and learning paths to take years, yet somehow afloat for one lonely reason: people need a bridge to computers, and I am the translator.

I really need to create a great service. It needs to enable users to schedule their own tasks. Right now, things are too cushy: the reports come in unless they don’t; I fight the same little fires; and everything is just the minimum to fulfill the requirements. If this were the era of mainframes, would I even have this position? Or, like those fortunate sons, would I have no recourse but to learn Z80 assembler?

It’s too easy to stagnate. The bare minimum is close to being solved – has been, in my opinion: when I can readily call up different technologies and whip out a prototype, is that experience or complacence?

Every cubby with a permanent name

In Fortran, data statements define variables initialized at the start of the program. Kernighan includes his code in one mega file listing, and in that context every function contributes its unique share. My assumption is duplicated variable names between functions are not shared; instead, Fortran finds some way to identify them. Also, if a variable has to change value, even making it static isn’t enough; you’ll need to elevate it outside the function and use keyword extern.

That lead me to global vars like

static int getc_lastc = MAXLINE;
static int putc_lastc = 0;

One big assumption is that the EOF marker always proceeds after a newline (\n). That is, the input stream consists of lines of characters terminated by newlines, followed by EOF.

RFC hobbyist

Today I had an opportunity to dig into Tcl and figure out multi-part form encoding for file uploads. Instead, I used one perl function in Mojolicious. This was one of those times when the convenience of one technology over another completely directed the course of development.

A part of me is like, “Be a man: read the RFCs; implement a clean library; share it with the world.” The other part needed to pee and was already browsing through the old code tree with a working implementation. But is that how things will go; if something isn’t easy, I’ll head to the stuff that worked?

Free software is competitive with proprietary software because the best and brightest minds contribute their time and energy to something they believe in. It became hard for me to stay an aspirant when all I could think about was implementing the next feature.

Mad constraints

Figuring out the word-count algorithm was a huge win for me. I combined a mathematical model and intuition to come to the presented solution. This is not indicative of future success, as problem-solving is messy and I am in the honeymoon phase of simple ideas; still, it gave me perspective on handling the “C Answer Book.” That is, my frustration with not matching their code exactly.

The answers can be approached in two ways: first, a week of fruitless struggle followed by a dissection of the solution listing; and second, a comparison of one functioning approach to another. People have finished K&R C without resorting to the answer book, so of course it is also a matter of my having a complex.

Anyway, my policy is to look at the code if I don’t figure it out after a week, pulling out all the stops to understand it, even using StackOverflow. The hope is I will encounter similar problems in other contexts, and by repetitive implementation of like approaches, will establish some facility in it.

As with the word-counting algorithm, I will not continue until the solution becomes internalized and intuitive – that’s the only way for me to retain it long-term.

Counting words

Early on in LaValle’s “Planning Algorithms” (2006), there is a formulation of finite state machines when the state space X is finite. I’ve been drawing circles with arrows since the beginning with this word counting algorithm in K&R C, and I could never figure out the systematic approach to their solution:

if (blank)
  state = OUT
else if (OUT)
  state = IN

Then I was inspired by this book to describe the word-counting as in the explanation in Chapter 2: the state space X is {IN, OUT} and the actions U = {<letter>, <blank>}. So given some input of a letter or blank (newline, tab, or space), we have a function

f(u,x) = u && x = x'

The table of the transition states is then shown to be

f(letter, IN) = IN
f(letter, OUT) = IN
f(blank, IN) = OUT
f(blank, OUT) = OUT

The first conditional is then if (u = blank), which is described by the two latter state transitions: a blank character means we’re out of a word regardless of whether we’re in or out of a word.

The next conditional is distinguishing whether we are transitioning into the first letter of a word from a blank, or if we are transitioning within a word, letter to letter. It is self-evident that, between the first and second transition functions, the conditional “if (state == OUT)” is the only one to let us count words without counting letters within the word.

This is the best explanation I have for the word-counting algorithm. I like it very much.

Snapshot charts to images from workbook

Graphs – or really, charts over a given range – can now be saved out to images and embedded into Outlook. My approach is from Letort, who provides a straightforward method. Mix with Peltier for moving the graphics just so, and you have a handy tool in pure VBA.

I have only the bare frame and a means to produce stacked column charts with a line plot of totals above, sorted by date. This aggregation should find plenty of applications. Boldfacing didn’t generate code from the macro recorder, though.

So, is that the final frontier? Images and tables, <pre> formatted from R, planted into emails and generated automatically. PivotTables made in a similar fashion. As languages go, VBA – really, Microsoft’s support for a vast collection of useful objects – is really kick-ass. Now I have to be one of those developers grateful to them for bread and lodging, which as things go makes me beholden to both proprietary and free software; that is, the shoulders of giants.

Click for words

IT had to start typing a standard-format string to record their efforts. It sounded like a pain, so a simple Java app was put in. Now they can click checkboxes and the string will get copied to the clipboard, ready to paste. Epiphany: suss out the window handle for the data entry widget and insert it directly.

Once they realize I’m “for hire,” will the floodgates open? I’m keen to try automation work with them. I wanted to show that I was helpful, not a threat. Early on, I leaned on them a lot. I think the magical parts are still SMNP and domain configuration. Someday, maybe.

I’m starting to warm to Java, which is unexpected. The initial hurdle must have been Swing and arbitrary graphics panels. After that, it’s as if a whole scene of cake laid itself out on a white sheet.