Remy Porter

Computers were a mistake, which is why I'm trying to shoot them into space. Editor-in-Chief for TDWTF.

Feb 2016

Hero on the Half Shell

by in CodeSOD on

Melissa’s co-worker needed to write some Python code to kill an external process. There are some third-party modules, like psutil that can solve that problem, but companies like Initech tend to put lots of obstacles along the path of bringing third-party code into your applications.

Without third-party tools, you’re stuck “shelling out”. Using built-in Python functions like os.system or the subprocess module. This lets you run commands like ps and kill from inside of your Python program. It’s inelegant, but it works just fine. There’s certainly nothing wrong with it.


Thrilling Tales of Software Development: The Eighth Man

by in Feature Articles on


Authorized Users

by in CodeSOD on

“Hey, since Jack quit, you could add Jane to the investigation users?”

William M supported one piece of a large, complicated intranet application used by auditors as part of investigations into “events” within the organization. The overall audience is small, and the purpose of the application is mostly to document the process of the investigation. Since it’s so niche, it doesn’t even have a screen for managing user accounts- the users raise a ticket and rope in developers to manage it.


Safely Configured

by in CodeSOD on

Configuration files are, well… files. File operations are “risky”- there’s a lot of reasons why they might fail, and we have to be prepared to handle those execptions.

For example, maybe you’ve written an application that reads a configuration file at launch. If, for some reason, it failed to load that config, you’d need to deal with that. If the configuration were just some minor settings, you might choose to fallback to some reasonable defaults. If, on the other hand, the configuration contained important security settings, you would probably want to quit the application, or maybe fallback into some “safety” mode.


Overpowered

by in Feature Articles on

Mike had a different perspective on wiring and cable management- because he worked at a factory which made wires and cables. It was the early–90s, and he was in charge of babysitting a couple of VAXes and their massive, 85lb hard drives. It was an easy job: the users knew the system and needed very little support, the VAXes were practically unstoppable, and the backup battery system could keep the entire thing running for over an hour.

The computers supported HR and accounting, which meant as the year ticked towards its end, Mike had to prep the system for its heaviest period of use- the year end closing processes. Through the last weeks of December, his users would be rushing to get their reports done and filed so they could take off early and enjoy the holidays.


Keeping Regular

by in CodeSOD on

Regular expressions can create new problems. Like an industrial drill, they’re extremely powerful- and potentially destructive. They’re expensive, they’re cryptic, but can be extremely concise.

For example, Jessica is reimplementing some C# code written by another developer. This developer was never interested in being concise, and instead favored being “clever”. For example, this developer had an array of strings, and needed to remove any non-word-characters from each string.


The Abstractions Conference: Pittsburgh

by in Announcements on

Back when we were setting up The Daily WTF: Live, I gave a shout-out to the Pittsburgh tech community group, Code & Supply. They’ve been a great way to network with local developers, dev-opsers, designers, and more, ranging from the seasoned vets to those just cutting their teeth on IT. I’m a huge fan of their events, and I only wish I could make it to more of them.


Freelanced

by in Feature Articles on

Being a freelancer is hard. Being a freelancer during the downturn after the Dot-Com bust was even harder. Jorge was in that position, scrambling from small job to small job, fighting to make ends meet, when one of his freelance clients offered him a full-time gig.

Carol, the customer, said “Jorge, we’re really short-handed and need help. We’d like you to start on Monday. You know PHP, right?”


High Performance Memory Allocation

by in CodeSOD on

Jamie has a co-worker who subscribes to the “malloc is slow” school of thought. Now, for most programs, it’s fine, but Jamie works on a high-performance computing system operating in a massively parallel configuration, so there are portions of their application where that philosophy is completely valid.

In this case, however, the code Jamie’s co-worker wrote is in their message handling layer. There’s really no reason to pool buffers there, as the performance gain is practically non-existent based on the frequency of buffer allocation. That doesn’t change Jamie’s co-worker’s opinion though- malloc is slow.