News for hackers. Stuff that matters.
Re:Do you have a problem? Write a compiler by rob74 on Thursday October 03, 2019 @12:56AM (#21143864)
Want to hammer a nail into a wall? Build a robot to do it! If you have lots of spare time, of course...
Re:Do you have a problem? Write a compiler by taneq on Thursday October 03, 2019 @01:22AM (#21143981)
I've actually come to the conclusion over the years that automation is a form of optimisation, and that all of the rules of optimisation apply in full force.

Do you need to process a list of 10,000 things, once a day, forever? Then you do need to automate.

Do you need to process a list of 100 things, once? Just roll up your sleeves and start typing (or get someone else to do it). The chances that you could come up with something remotely reusable in less than the two minutes it'd take to do manually are slim to none, yet I have often seen people spend a couple of hours coding up a script to do a 15 minute non-recurring job.

Re:Do you have a problem? Write a compiler by chousuke on Thursday October 03, 2019 @02:50AM (#21144387)
Sometimes it helps to automate small things anyway, as practice. I've noticed that as I become more practiced with automation, even the small things take less time (and are less prone to error) than doing things manually.

It's also possible to do partial automation, where you just automate what's easy and finish up manually.

Re:Do you have a problem? Write a compiler by gitgud on Thursday October 03, 2019 @03:05AM (#21144449)
On the flip-side, people who rarely automate things, become accustomed to manually doing things and increasingly miss opportunities to automate/script their workflow...
Re:Do you have a problem? Write a compiler by lilyball on Thursday October 03, 2019 @03:16AM (#21144503)
I get your point, but a benefit of coding the script is it's frequently easier to verify the script is correct then to verify that the repeated operation you did by hand on the large list was done correctly for every entry.
Re:Do you have a problem? Write a compiler by xmprt on Thursday October 03, 2019 @03:27AM (#21144553)
100% agree. Also, if you need to add additional steps to your processing or make small changes to what you're doing then processing the 100 items again will be pretty fast compared to if you had done it manually.
Re:Do you have a problem? Write a compiler by ahmedalsudani on Thursday October 03, 2019 @01:31AM (#21144016)
Macros, regex, awk are the tools to quickly automate text processing. It literally takes less than two minutes in most cases once you’re proficient.
Re:Do you have a problem? Write a compiler by fastball on Thursday October 03, 2019 @02:03AM (#21144167)
Honestly the amount of time I've saved just by throwing stuff into a text editor with multi-cursor support is kinda unbelievable.
Re:Do you have a problem? Write a compiler by rmetzler on Thursday October 03, 2019 @06:41AM (#21145496)
Yes, this is the right thing to do very often, especially for one time tasks.

It’s not the thing you should do if you need to do it repeatedly, like once a day or even once a month.

This all depends on a lot of circumstances, and its hard to calculate time for implementing a script vs doing it by hand for a future you don’t know yet.

Re:Do you have a problem? Write a compiler by rdc12 on Thursday October 03, 2019 @07:09AM (#21145659)
I often do a similar thing using emacs macros (I assume most good editors have a similar feature)
Re:Do you have a problem? Write a compiler by sinstein on Thursday October 03, 2019 @02:54AM (#21144405)
Step 1 - Let me try using command line magic to transform this data Step 2 - ?? Step 3 - Create a scratch file in IDEA and some cursor + regex magic and I am done!
Re:Do you have a problem? Write a compiler by rmetzler on Thursday October 03, 2019 @06:49AM (#21145545)
And those regexes are the first part of an awk script or something similar which will save time when you want to do this repeatedly.

And when your awk script grows into something that doesn’t produce the final output, but has to be run in another interpreter first in order to produce the final result, then you created your custom language.

Re:Do you have a problem? Write a compiler by taneq on Thursday October 03, 2019 @01:42AM (#21144066)
Oh sure, if it's absolutely trivial then bash it (hah) through some shell scripts or even just do it on the command line. I'm talking more about things that are slightly more complicated and will need a bit more effort than find & replace.
Re:Do you have a problem? Write a compiler by aidenn0 on Thursday October 03, 2019 @12:41PM (#21148943)
I was consulting with a customer, and we hit a point where they needed to check a change into source-control. They were using a VCS that I'd not used before, so I asked how to do it. The answer was "Oh, let me get Tim, he's the one who knows how to check stuff in." It took 5 minutes or so to find Tim, and then a few minutes of him moving through the "interestingly designed" GUI of their VCS he was able to get it checked in, and then another couple of minutes he was able to enter a description into their change-tracking system to pend for code review (required to merge into their mainline branch).

I overnighted a book from amazon on the VCS and process management tools they were using, read it the following night, and the next day took about 15 minutes to talk to Tim and then another 30 minutes writing a perl script that prompted for the 4 bits of information they needed and automated the check-in and change-review request. Total billable time spent on this 45 minutes. Time saved by having this script around the 2 weeks I was with the customer at least 2 hours (10 minutes of my time were wasted every time a change needed to be submitted previously!).

Every time I visited that customer in the future, the group was still using that script I wrote. Also every time the manager wanted me to assure him I wouldn't waste time by writing a script like that because that's not what they were paying me for.

Re:Do you have a problem? Write a compiler by taneq on Thursday October 03, 2019 @07:53PM (#21153509)
> Also every time the manager wanted me to assure him I wouldn't waste time by writing a script like that because that's not what they were paying me for.

It eternally baffles me (although no longer, sadly, surprises me) how often this happens. Clear evidence of a simple change which dramatically improves efficiency and therefore profits, and someone complains and tries to prevent it ever happening again because "that wasn't what I specifically wanted to do right then."

Re:Do you have a problem? Write a compiler by TeMPOraL on Friday October 04, 2019 @01:14AM (#21154972)
> Total billable time spent on this 45 minutes.

Should've added the time spent on book to billable time (though I guess your manager would approve of that even less than they approve of scripts, given the description). In a few similar situations I've managed to get approval of my manager to bill the time I spent on such emergency learning, because let's be honest, I'm not speed-reading a book on an obscure piece of tech for fun.

Re:Do you have a problem? Write a compiler by pjbk on Thursday October 03, 2019 @01:44AM (#21144083)
Or just wait till we have a distributed problem recognizer or single-conscience general AI: solved and automated once, replicated and reused forever.
Re:Do you have a problem? Write a compiler by yesbabyyes on Thursday October 03, 2019 @04:06AM (#21144733)
As usual Randall Munroe has the answer: https://xkcd.com/1205/
Re:Do you have a problem? Write a compiler by Pinus on Thursday October 03, 2019 @01:44AM (#21144084)
"Tell me, Gaston, this machine, how do you attach it to the wall?"

https://twitter.com/joel_kienast/status/859412383650938880

Re:Do you have a problem? Write a compiler by kd0amg on Thursday October 03, 2019 @10:42AM (#21147553)
Might still be useful if you're placing enough nails in the right arrangement, sort of like railroad track laying machines.
Re:Do you have a problem? Write a compiler by samirsd on Thursday October 03, 2019 @02:16AM (#21144230)
this is brilliant
Re:Do you have a problem? Write a compiler by z3phyr on Thursday October 03, 2019 @02:50AM (#21144385)
Want to hammer _a_ nail on your wall? Do it yourself. Want to hammer nails on your wall all day everyday? Build a robot to do it, and do something else
Re:Do you have a problem? Write a compiler by boomlinde on Thursday October 03, 2019 @04:05AM (#21144726)
If you build a robot you'll be better at building robots. Personal growth vs product.