I like the interactive mode of the bc command line calculator because it is ubiquitous, but wanted to augment its functionality a bit to add a couple features I liked from another calculator program. I wanted to make modifications to the text I typed before sent to bc and modify the text it outputted. This can be done on standard POSIX shells with mkfifo, but it took me a good while to figure out how to do this with both input and output and get something working nicely without it freezing or leaving artifacts. So I'm sharing how to do this in a bash script.
programming posts
I think the most important benefit of meetups for me personally is the social skills practice. Continue reading post "#1783"
Apparently the ImageMagick -depth option is per channel (color / alpha), not per pixel.
Continue reading post "#1340"
exercism.io meetup
Went to an Akron Code Club meetup this evening. Started working through code ex…
Continue reading post "exercism.io meetup"Abstractions: interfaces as lists, details, and flows
I read a post recently of Dave Rupert lamenting that he can describe any digital interfaces as lists, details, or flows. This is, of course, an abstraction. Abstractions can be useful for reducing complexity and making things understandable. In code, they also can be used to reduce duplication and provide reason for limited responsibility, improving maintainability. But if everything is fit into a small number of buckets, it can certainly make it seem like there is a lack of diversity, a sameness to everything.
With any good abstraction, everything can fit into it with a certain level of mental effort. Some might be more willing to go further than others to make a given classification work. In code, too heavy abstraction can lead to a given abstraction trying to do too much, or conversely, functionality being limited to fit a simple concept of the abstraction.
Continue reading post "Abstractions: interfaces as lists, details, and flows"Globbing files including dot-files
Normally globbing for the wildcard * will find all files in a directory except …
Continue reading post "Globbing files including dot-files"TMLib meets Require JS
I've recently been working on reorganizing, cleaning up, and improving my javas…
Continue reading post "TMLib meets Require JS"PHP Functions: Array as Argument
A while back, I wrote about using the JSONesque literal value parameters in Javascript, like jQuery does. This allows arguments to be passed: with names, in no particular order, all being optional. I set it up so that multiple arguments could be used as well, allowing for existing functions to still work or people who prefer that syntax to have it. I will now write about something similar for PHP.
In PHP, it is not quite as elegant, but almost. An array with key-value pairs is passed as the single argument for named argument mode. So you could call like this:
testFunction(array("arg1"=>"value1","arg3"=>"value3","argCallback"=>"testCallback"));
or with regular arguments:
testFunction("value1",null,"value3","testCallback");
Continue reading post "PHP Functions: Array as Argument"