When is a GUI more convenient?
- The GUI encapsulates specific, irreducible operations, as in “user convenience.”
- One mouse click is less “keystrokes” than typing, such as commands with many flags or switches.
- Graphical representation is superior to text-only (or bitmap), as in music composition.
- The view must be refreshed faster than console line output, as in rapid data entry. (What about ncurses?)
As thin as I would like to make the GUI, AutoIt with RunWait() and invisible calls to smaller programs is possible. Using C++, AutoIt becomes the shell “glue” to connect them together. At some level, batch scripts become the user-editable .ini files. Tools discovery through toolchain modification. User becomes programmer.
There is a UNIX idea that a tool can handle standard input; then it can be used in pipes. What stops the repo from getting integrated into larger tools, hidden behind interfaces, brought into the testing fold; its builds automated, its issues tracked; team-bound, dependency-chained, larger than life: where do I then go?
I was approached to start Android development. After the meeting, I promptly set up my most powerful desktop computer with a fresh install and a slew of downloaded tools: NetBeans, cygwin, Android SDK and MySQL. I visited the Java trails and dusted off Brackeen’s “Game Development in Java.” That exercise left me with a workstation very much like my work environment: minimal, clean and focused. The exact ingredients for productivity, the perfect alchemical mixture to ship.
The next meeting, they said the ramp-up was too high. Learning Android and dev-ing apps would be prohibitive. They called it off. I still had my desk setup, so now I type to you with an illuminated keyboard, widescreen monitor and Flash-enabled Firefox: it’s Windows; we get all the good stuff.
Actually I wanted to take it all back down, to retreat to the caves. I still had to work on a cron policy and K&R C. But then again, maybe I don’t. Maybe I can learn C++ and Win32 and SQLite, and push out little MUDs for you.
Why is Mr. Code Co-op so great? He begins “C++ in Action” with encouragement and inspiration. His first lessons are in scope, in object creation and destruction. He has articles on guaranteeing “zero” memory leaks and Win32 message-passing. He worked at Microsoft!
All of these factors make me want to complete his C++ tutorial. If you have some time, go through it too; the two most important topics – besides Win32 – for me are threads and transactions. Those two are worth purchasing the ebook, if they allow me to create novel and expressive forms in code.
Did you know event queue is a problem in Bjarne Stroustrup’s book? Events, those things in Java, which enable an application to avoid polling, to sleep and to wake, is the next level for me. You can poll a database for new messages off the last timestamp and set it to 00:00:01 second granularity with Sleep(5000), but writing an ecosystem that involves sleeping threads is High Arcana for the uninitiated. I don’t want to say it’s “job security,” so I’ll call it “gaining experience for the next job.”
I found a vector back into OOP, and it was through databases. The guy behind Code Co-op wrote an ebook for C++ and tutorials for Win32; I could not ask for more. His writing enabled my paradigm shift, as well as a StackOverflow comment on how C++ was not object-oriented, but had constructs that supported OOP.
Back to the database: the emphasis is on creating tables: the creation is the most important step, the design of the things. After that, the rest of the program appears to follow naturally: CRUD it up, as it were. But there is another place where creation is important, where top-down claims its triumph: in class definitions of an object-oriented language.
Is that not true? You design tables. You design classes. Both are instantiated as populate data: one as row tuples, the other as objects from a blueprint. The deity who breathed life into dust organized his forms thus. The other way – which I like – is to chain together small tools to make complex solutions, experiments and recycled modes for little tasks. Combining both is the way.
In chemistry, dimensional analysis is a means of crossing out terms so that we reach an answer with the desired units, like g/mol. In physics, it could be something like m/s.
I wanted to format an external for OpenBSD. The FAQ 14 was helpful.
- Use disklabel to determine total sectors.
- Use dmesg to identify device name and total HDD capacity.
- Using bc, calculate with total sectors total HDD capacity.
- Now you know how many sectors per MB; multiply by x MB, where x is the size of the partition. If you want a 681 MB partition, it’s 681 the unit.
- In your editor, set up your partition(s) by typing in the rows. Don’t forget offset! If partition d: is offset 63, partition e: offset will be partition d: size plus 63.
In disklabel, why is boundend different from total sectors, and what happens if your offset goes beyond it?
Subtraction is exclusion; did you know that?
I had an epiphany after pushing pixels on x- and y-coordinates of ListView widgets in AutoIt, a combination of what I had already known and a feisty wondering of
widget width = GUI width - margin - x
Because subtraction is exclusion.
Nine, eight and seven are drinking hot cocoa around the fire, and six is in the cold. Nine minus three is the number of numbers excluding six, or three.
Understanding subtraction helps in two (three) other areas: memory allocation, string manipulation, and game programming. The first because K&R subtracts “buffers” from malloc() or some such. String manipulation as in
s = Right(s, Len(s) - InStr(s, ",")) ' get the right side of "A,B"
And in game programming:
[something from "Game Programming All-in-One, 3e]
I set up a CGI script with Apache. That’s nothing big, but it’s a batch file:
echo "Content-Type: text/html"
for /f "delims== tokens=1,2" %%i in ("%QUERY_STRING%") do (
echo %%i = %%j
Regarding httpd.conf: edit <Directory> and <DocumentRoot> directives to point to a friendlier location for an htdocs\ folder. Change ScriptAlias to refer to a cgi-bin\ folder nearby. Your form can look like this:
<form name="input" action="cgi-bin/print-qs.bat" method="get"
Favorite food: <input type="text" name="favefood">
An early limitation is printing within the “page context.” I can’t get AutoIt executables to output ConsoleWrite() statements to the same stream. I can output pure HTML using
but things will get interleaved: anyone could receive a different message based on whose sample-response.html file is sitting there.
This is especially onerous when you’re using a crippled web service as the starting point: how do you store intermediate files for each user without authentication or cookies? cURL in batch scripts uses -b to write cookies collected from the web service; that file could get overwritten by the very next user.
Ah – isn’t there an option to force Apache to run single-threaded? That would be great*. I can’t wait to try this!
Of course I will have to learn perl or Ruby or PHP or something.
Databases reaches a local – or absolute? – maximum for me: a formalized data manipulation language and a formal data storage engine, with account management and TCP/IP built-in, is hard to beat. That may be what our ancestors pined for in their fopen() days, when sacred unguents were breathed with each blessed struct, bespoke pieces to dot-load props.
Now we use strings. I still use integers to encode error messages, because functions communicate best with return values, but strings for feedback, strings for names, strings for descriptions of things, connection strings – those have meaning for someone; I stuff them in simple key-value tables and relay ints to an aggregate.
My current problem space remains navigable to the determined neophyte; I must venture to new places. For me, that path is machine learning. There are certain questions statistics can answer; there are certain answers I wish from a machine. I think I could spend the rest of my career in machine learning, which is both frightening and comforting.
I maintain a certain amount of state in globals: global arrays in the view, environment variables in the OS. With Android or even with OOP, Objective-C or so, there’s hooks in objects where you write your crucial code – the stuff that differentiates your app from everything else, the umpteenth ListView with pixel params to define a little spreadsheet.
Once the API is this huge thing, a framework, you write the documentation to describe how to manipulate things in a Render() override. I haven’t reached that point yet. I still think of fundamentals, of base paths through tangible stacks. But once you understand a framework deep enough, that’s your new thin layer: now it’s not so much trouble to put in the features that give the swipes and pinch; it becomes a meditation between queries and arrays.
In a sense, databases are a natural progression from automation. It’s data entry writ large, on a larger scale – except instead of a form you have a query, and both endpoints are databases: the first your source, the second your own.
I bounce among layers: first between the controller and the data model, the SQL queries matching against the interface, those calls which the GUI will readily press upon to fulfill user services. And then the rest becomes pixel positions, loops to populate the view, and communicating error codes.
Bottom-up development formalizes the hazy point in the controller, when things are vague and uncertain, and you grope function by function to realize a concept. Eventually they reach a tipping point and pile together, and by the middle you’ve grown functions up and constants down: sandwiched therein is the single enchanted flow. The view beckons.
What I’m trying to collect here is the experience of finishing things. Compensation is an end; creation is a means. As much as I ignore the work-verse as I am wont, it is the practice of developing programs that keeps me in production’s stead. Procrastination sleeps, somehow, naps for the near-eight, and wakes with glee by evening’s toll. Yet what I slowly hew toward is the practicum of The Loop: