Before you knock on "writing code that clicks things" remember that on Windows clicking things is the primary if not solitary interface to most of the system. Even the administrative interfaces are secondary to the visual interface. A lot of programs don't offer an API available to outside processes. The most important thing about any program is correctness: does it work and do what it is supposed to do. The only thi…
Learning to code kept me sane when I was a diplomat
21–30 of 51 posts
Re: Learning to code kept me sane when I was a diplomat
#22I knew nothing about programming, but I had taken an intro stats class that had a few assignments in R. A super simple R script did half of my day's work in seconds (plus some debugging because of course I did next to no error handling).
In retrospect, I've realized that if I knew a thing of two about regular expressions at the time, I would have been able to automate my whole summer internship.
So it goes.
Re: Learning to code kept me sane when I was a diplomat
#23This is a fantastic article and illustrates a HUGE problem in government systems, where data gets aggregated, but not associated.
Re: Learning to code kept me sane when I was a diplomat
#24Luckily there are libraries that are great at interacting with a web page or multiple pages at the same time without needing to actually have a browser instance open. There's selenium and its various scripting environments, which are meant for browser testing but work just fine for many automation tasks: http://www.seleniumhq.org/
And, newer, are headless technologies like phantom.js: http://phantomjs.org/ and Dalek.js: http://dalekjs.com/
This is SO much easier than using Javascript to find purple links on a page, and so much more reliable.
He could have looked up each link on DB1, then used the data to look up the DB2 information.
In any case, what he did saved him hours and hours of time and started him on a lifelong interest in programming.
Also, obligatory relevant XKCD's: http://xkcd.com/1319/ & http://xkcd.com/1205/
Re: Learning to code kept me sane when I was a diplomat
#25Earlier quoted context omitted.
Just to clarify, we weren't accessing any Guyanese databases. And as far as I know, nothing illegal was going on.
How else could you then search for the criminal history of Guyanese citizens? Did the Guyanese government push all their data to the US?
Re: Learning to code kept me sane when I was a diplomat
#26From a class he took in high school, Vik knew that some sort of automation was possible. That spurred some reading and exploration, which led to some success.
Success led to thinking about other opportunities for automation and more exploration of what's possible, which in turn led to more success.
To me, it absolutely doesn't matter that things could have been done in other ways. Nothing to cringe about here. A developer can only use approaches that he/she knows or suspects are possible.
In the day-to-day work of a developer, knowing what's possible is perhaps the most important thing. Anything else can be googled.
Re: Learning to code kept me sane when I was a diplomat
#27Before you knock on "writing code that clicks things" remember that on Windows clicking things is the primary if not solitary interface to most of the system. Even the administrative interfaces are secondary to the visual interface. A lot of programs don't offer an API available to outside processes. The most important thing about any program is correctness: does it work and do what it is supposed to do. The only thi…
For the server versions, Windows finally leaves this path, making PowerShell (that admittedly also takes some getting used to) a first class configuration system. You even can do something in the GUI and then check in a log what PowerShell commands were executed under the hood.
Re: Learning to code kept me sane when I was a diplomat
#28> I decided to write a program that clicked on things. I cringed a little. I'm glad he's learned enough to know now that this is not the right approach.
I cringed too, but then I realized this is probably the best way to start out. It's only a 'problem' because it's a bit more glue code (but less 'figuring things out' time). The only truly cringey part is not knowing about CSV!
Re: Learning to code kept me sane when I was a diplomat
#29today i couldn't do that anymore; i've grown too uptight to try any of those inefficient "solutions". i guess i'd rather give up and admit defeat if there were no APIs or passable hacks (i'd say using phantom.js would be a passable hack) i could work with than solve the problems this way.
i'm usually unable to follow the advice given by the xkcd automatisation timetable described here: http://xkcd.com/1205/ "is it worth the time?" - if a dirty hack is destined to run more often than once, i just have to make it passably elegant, readable and efficient. i'm sure nine out of ten times the effort is pretty much wasted.
i guess i've just grown old.
Re: Learning to code kept me sane when I was a diplomat
#30The article shows an interesting illustration of the disconnect between programmers and normal computer users. Like the author says at the beginning, any experienced developer knows that automating interaction with a GUI is a crazy idea. It's a painful, fragile way to move data around. But to the author and anyone who's done data entry, it's an improvement to their workday that demonstrates the power of programming.…