I might be a little behind the times here but I learned about Lighthouse today. It’s from Google, which is regrettable, but I might check it out some time.
Today I read The End of OS X. I particularly liked the bit about the Unix philosophy:
- Make each program do one thing well. To do a new job, build afresh rather than complicate old programs by adding new “features”.
- Expect the output of every program to become the input to another, as yet unknown, program. Don’t clutter output with extraneous information. Avoid stringently columnar or binary input formats. Don’t insist on interactive input.
- Design and build software, even operating systems, to be tried early, ideally within weeks. Don’t hesitate to throw away the clumsy parts and rebuild them.
- Use tools in preference to unskilled help to lighten a programming task, even if you have to detour to build the tools and expect to throw some of them out after you’ve finished using them.
Today I had cause to read about Operator Precedence in PHP. I think I will consider availing myself of the ‘and’ and ‘or’ keywords in future, I haven’t used them myself, although I have seen them before.
It’s very important to remember that PHP caches results of file-system functions. Details are here.
While reading What tools made you better programmer I came across a link to Error Handling in a Correctness-Critical Rust Project which included these two tidbits:
almost all (92%) of the catastrophic system failures are the result of incorrect handling of non-fatal errors explicitly signaled in software.
in 58% of the catastrophic failures, the underlying faults could easily have been detected through simple testing of error handling code.
So in my version of salt, v2017.7.4 (Nitrogen), I was getting this error when I tried to use the file_tree ext_pillar:
Failed to load ext_pillar file_tree: must be str, not bytes
So I monkey patched my version of /usr/lib/python3/dist-packages/salt/pillar/file_tree.py, changing the file from binary to text:
contents = '' try: # 2020-05-15 jj5 - changed 'rb' to 'r', will only work with text files... with salt.utils.fopen(file_path, 'r') as fhr: buf = fhr.read(__opts__['file_buffer_size']) while buf: contents += buf buf = fhr.read(__opts__['file_buffer_size']) if contents.endswith('\n') \ and _check_newline(prefix, file_name, keep_newline): contents = contents[:-1]