20190706

neato videos

the whole channel is pretty great

there’s a lot of pushback against oop.

wait… you can just leave the web??

having recently gotten back into C programming, it’s not super hard to make object-oriented style structs and things. and after that, the weird naming conventions and abstraction layers you see in oop code make even less sense.

neato links

https://www.maizure.org/projects/decoded-gnu-coreutils/ – contains diagrams and explanations of how common utilities work under the hood.

https://userinyerface.com/ – crappy ui code samples.

https://heartbeat.fritz.ai/activestereonet-the-first-deep-learning-solution-for-active-stereo-systems-f52ed2c6cd2 – get depth maps from your stereo photos? what about from all those mannequin challenge videos from a couple years ago?

https://picolisp.com/wiki/?guiScripting – picolisp’s shipped-with gui.

https://picolisp.com/wiki/?interfacing – picolisp ffi, in case you want to use gtk instead.

https://bitbucket.org/iromero91/web.l/wiki/Home – url dispatch.

stupid computer tricks

here’s how you make an mvc controller in c:

#define CONTROLLER(fields,setup,validte,submit,view) setup(argc,argv,&fields) || validate(&fields) && submit(&fields) || view(&fields);

and here’s your associated main:

int main (int argc, char *argv[])
{
  MainData fields;
  CONTROLLER(fields,
             setup_main,
             validate_main,
             submit_main,
             view_main);
  return EXIT_SUCCESS;
}

Now you just need to make MainData, setup_main, validate_main, submit_main, view_main.

This definition uses || and && for flow-control, which is dependent on C’s execution model. Short-circuit operators were the cool thing to do in the 1970s, before the invention of “try.”

setup_main handles the “commandline arguments” passed into your controller method. It expects argc, argv to be in scope. You may oneday break out commands from all these controllers, and this enforces “message-passing” as the invokation method.

validate_main returns true if the fields are valid for processing.

submit_main returns true if view_main shouldn’t be called.

view_main only runs if the || is evaluated.

20190630

stupid computer tricks

one of the exciting unix features that has survived the past several decades is the important command to render your terminal useless and force you to start over from last save, ctrl+s.

this default setting is not good, but exciting. strong emotions are evoked whenever switching from inferior operating systems, who program the user’s muscle-memory to hit ctrl+s on save, to places like vim in the terminal, which use <esc>:w.

to eliminate this feature, go to ~/.bashrc:

stty -ixon

turns out ctrl+s also does commandline searching, but only when you turn off the more-important “crash the terminal” feature that’s on by default.

20190627

neato links

http://alumni.cs.ucr.edu/~lgao/teaching/bison.html – lex/yacc prototyping setup. doesn’t actually work in ubuntu, and it’d be great to port to something easier-to-bootstrap from, like tcc.

https://www.gnu.org/software/bison/ – there are much better examples for your future main.y file, main.l file, main.c file, main.h file in here. calc, for example, just to prove it works.

then scrape out calc’s guts, init a repository, and do your prototyping.

blender python prototyping setup

rationale

pretty much the fastest you can get from zero to a blender scripting environment for rapid prototyping.

operations

create file plugin.py

import bpy
class Plugin:
  def __init__(self):
    pass
  def go(self):
    bpy.ops.mesh.primitive_monkey_add(location=(0,0,0))
    pass
  pass
x = Plugin()
x.go()

from the commandline

blender ide.blend

blender launches. delete the default cube.

set the timeline to the text editor pane.

pull the text editor window frame up so you have more room to read and write.

pull down your top window frame so you see the python result pane.

text editor – open – plugin.py

there are buttons to enable syntax highlighting and line numbers.

alt-s to save your script.

alt-p to run your script.

https://docs.blender.org/api/master/ – api documentation

20190701 followup:

https://www.tutorialspoint.com/awk/awk_basic_examples.htm – dae yacc and lex syntax look like awk?