Programmers Should Automate More
shubhamjain.co
shubhamjain.co
I would love to automate my image capturing workflows, my tax filing, my invoicing, my calendaring, my contacts, and SO many other things. But most tools are not scriptable. They are sealed, proprietary binaries that I can't interact with.
Conversely, I love tools like the shell, Emacs, and programming tools in general, because I can automate them. I can automate testing, compiling, generating reports... And if something is not built-in, these tools provide hooks and APIs to extend their functionality for my particular use cases.
In fact, we can already see the impact of smartphone-only students on their ability to grasp and automate complex workflows. The fact that mobile apps are largely non-composable and non-programmable seems to seriously limit students' abilities in general digital problem solving.
> In fact, we can already see the impact of smartphone-only students on their ability to grasp and automate complex workflows. The fact that mobile apps are largely non-composable and non-programmable seems to seriously limit students' abilities in general digital problem solving.
Computers became so easy to use that no one learns how to use them. It's no wonder grandma always opens that attachment with an exe extension, file extensions have been hidden for as long as she's used computers, she doesn't know what the convey.
Teaching kids to code is the latest fad but I think the majority of them would be much better served learning some basic bash scripting and related unix tools.
http://stackoverflow.com/questions/2050505/way-to-run-excel-...
http://stackoverflow.com/questions/27613878/list-of-perl-com...
Python with PyWin32 is great for this, the Word doc part anyway. I've got several scripts the create modify or read Excel and Word docs for a number of different purposes: tracking my mileage, automating creation of new users (now done with Powershell though), converting and uploading documents to a web server. VBA/VBScript can do some of these things too, but Python is a much more capable and sane language to use. Powershell is another great automation choice too.
Someone else spoke about Python for Windows. That I have used with Excel but not Word. I imagine it would work pretty well, though.
In some respects I think the apparent lack of automation in GUI comes down to the methods by which it's accomplished feeling too crude to take seriously. Even ordinary "power user" apps like Excel are so in-depth already and support so many workflows that it's hard to figure out the efficient path for what you want to do.
(Things like GUIs try to put a top on our data. Like owning the customer. And we always want to do more than the person who sealed it shut thought of)
Start factoring "is this thing automatable?" in to your tooling decisions. The problem will resolve itself.
Making Emacs a Lisp interpreter turned out to be a great idea. Too bad they didn't use Scheme or Common lisp.
It self referencing and you can add your own changes to it to automate you specific tasks.
When you build tools, try to add options to make my tools more flexible and amenable to scripting. Options like -z, to separate records on STDOUT with NULL, or having a trailing -- read input from STDIN, make tools much easier to script.
Using a UNIX shell is like a poor man's REPL without access to the OS internals.
OS prior to UNIX already explored similar ideas by producing temporary files into cards, paper tape, tape and magnetic cores.
Using a multi pass Algol compiler was an exercise in patience with the card data being fed into the multiple stages, effectively doing pipes via paper.
Also UNIX pipes were influenced by the way pipes were designed in Multics.
Streams, meaning dealing everything as bytes were just innovative in that UNIX provided no alternative, many of the previous OSes used to provide pure binary access (streams) and structured file access (records).
/me goes off to read the change logs
Around the 30th or so time I have to do it, there's no point to automating any further. But I've learned that automating to the point where you can put it on a cron job is usually just not worth it. You haven't yet squeezed out all the failure cases. If you could have completely scripted it and put it on a cron job you would have done it at the beginning.
Usually when I find myself doing this, I'm doing it in response to emails that have been sent with spreadsheets. It's a huge time pit to automate that the first time you get one. You just don't know what they're going to keep sending you each month, and you feel like such an asshole nagging them about it. Just make a note in your procedure, and use an error to detect the case when you finally script it.
It's searching files with an ease that you start question yourself why windows search is so fucking retarded
I have 1.3 million files on my C: drive, and it can find any of them (or any matching subset) as fast as I can type.
It has a ton of options, but I have most of them on the defaults. Here are the ones I like to customize in Tools/Options:
In General, turn on "Check for updates at startup". ("Start Everything at system startup" should be on by default.)
In View, turn on "Show row mouseover".
In Keyboard, set "New window Hotkey" to Win+Alt+F (or any other key combo you like, but this one is pretty convenient).
And related to the current topic, Everything does have a CLI and an SDK.
Other good options are Keypirinha (with a python powered calculator) or Wox + Everything. Although Wox solution uses easily 150K memory.
Now I use osx and sadly finding files seems to be an unsolved problem...
So far I've only found Greenshot that is cross-platform and let you choose where to save the screenshot (It's also open source).
It does have a really sexy UI though, almost as good as Capto!
We even have Emacs where everything is configured with elisp. The current problems come from building on the wrong foundations. The whole desktop paradigm and OS paradigm needs to be rebooted, and sure as hell the impetus will not come from Microsoft, Apple or Google, who seem to be entrenching sub par practices.
[1] https://addons.mozilla.org/en-US/firefox/addon/imacros-for-f...
Usually though I never regret it - once it is done. But at the time putting a day or two dent in my schedule makes me pretty cross.
Two other effects which are often large:
First: suppose a task takes an hour and I do it once a month. If I can automate it so that it takes a few seconds, I don't just save an hour a month, I also have the option of doing it much more frequently.
Second: once a task has been automated it can become a building block for other tasks which I previously wouldn't have considered.
It's also about: decreasing errors, allowing for stuff to happen when operators are not around, ensuring testability and reproducible behaviors, scaling up processes.