Live data from Hacker News

Ask HN: Weirdest hack that you ever saw in production?

news.ycombinator.com

151–160 of 289 posts

Re: Ask HN: Weirdest hack that you ever saw in production?

#151

I once worked maintenance on a large C++ program used in production by a lot of customers. It was odd in several ways, but the feature that stands out in my mind was the numerous classes that were not defined anywhere in the source code or libraries. If that sounds unlikely to you, it sounded unlikely to me, too. I wasted a lot of time trying to figure out where they were defined. I couldn't ask the original author o…

What’s your opinion of languages that can do stuff like this, dynamically at runtime?

And it’s even better: you can define, augment, redefine or remove classes at runtime.

Re: Ask HN: Weirdest hack that you ever saw in production?

#152

Just recently I had to put together a web-based UI for editing vector graphics (clothing tags) and export them to pdf for printing. In order to avoid writing and maintaining two separate codebases, I re-used the client side code as my rendering code. So I ended up with a server serving the editor frontend, as well as api endpoints that would use puppeteer and headless chrome to make a request (to itself) to load the…

wut. why did you do this? why didn't you just handle all of it in the frontend? jspdf makes PDFs in browser.

Re: Ask HN: Weirdest hack that you ever saw in production?

#153
post #120

I once worked maintenance on a large C++ program used in production by a lot of customers. It was odd in several ways, but the feature that stands out in my mind was the numerous classes that were not defined anywhere in the source code or libraries. If that sounds unlikely to you, it sounded unlikely to me, too. I wasted a lot of time trying to figure out where they were defined. I couldn't ask the original author o…

I have a simple rule about adding "magic" like that- if you can't make it immediately obvious to the readers of the code just what it is the magic is going to do, don't do it. AOP Java lead me to that rule because of too many obscure annotations that did insane things to help one developer avoid some minor nuisance.

I disagree that you shouldn't do it. The way you do it is to add a comment

// This %thing% was generated from %template% using data from %data%.

If your language is too restrictive to add sensible tools, you should write the tools yourself. As with any code, write it in a way such that other people will be able to understand it.

There is no magic, it's just code. I wish people would stop using that word.

Re: Ask HN: Weirdest hack that you ever saw in production?

#154

Right after WinXP came out, I was a sys/win admin at a manufacturing co. Their ERP system was an old VB app that sat on a share drive and everyone opened the same .exe from their respective workstations. The app required a ton of scheduled database and ERP tasks (it used a legacy flat-file db), so the vendor wrapped them all up in a secondary executable that was effectively a non-headless (headful?) daemon (this was…

I looked up ERP software in google images. Holy poor UX, Batman! There's a great market opportunity there for something that doesn't spew out everything at once onscreen.

Re: Ask HN: Weirdest hack that you ever saw in production?

#155
post #133

Earlier quoted context omitted.

I always thought of this bit of code as a great example of applied numerical methods techniques, rather than “Black Magic” The magic constant is derivable from standard methods and one can even choose to optimize other measures of error. http://www.lomont.org/Math/Papers/2003/InvSqrt.pdf

Isn't it what black magic is all about? Unorthodox technique, that you can explain if you try hard enough (in a sense, everything that reliably work could be explained and someone has to came up with in the first place), used by people who don't really understand it. What do you think is a better example?

I would consider “black magic” to be something that works reliably due to some specific and idiosyncratic property of the environment that it operates within. Basically, something that is exceptionally tightly coupled. I think the novel FPGA solutions that genetic algorithms can create fall into this category; they often didn’t work on different boards, or even when the same board was plugged into a different power supply because the solution was overfit.

“A Story About Magic” is black magic in action. http://catb.org/jargon/html/magic-story.html

“The Story of Mel” is not black magic even though no one else understood his program. http://www.catb.org/jargon/html/story-of-mel.html

Re: Ask HN: Weirdest hack that you ever saw in production?

#156
A website that was initially written in VB6 on the back end (I know) had transitioned to C# for new development. So new functionality would be written in C#, but all the old stuff had to still work. On a page built with the new framework, the bulk of the page was going to be C#, but the "chrome" around it- the header, footer, page nav- needed to be generated with the old VB code. It turned out to be nearly impossible to begin in VB6 and call out to C# to generate the page contents, so the solution was to

1. Generate the page chrome 2. Post that HTML into the database 3. Call the new framework 4. Pull the page chrome out of the database 5. Render the page

The worst piece of the VB6 code I ever had the misfortune of working on was an implementation of a questionnaire, which would guide you through several pages of questions and keep track of what the state of the questionnaire was. A particular sequence of actions could crash it consistently, but the code was so incredibly stateful that it was impossible to work out what was going on. To add insult to injury, it didn't happen when debugging, and the VB6 debugger left a lot to be desired anyway.

Re: Ask HN: Weirdest hack that you ever saw in production?

#157

Earlier quoted context omitted.

I've got one of those from "Only on WIndows" series. One of my colleagues uses WIndows and tends to remote in from home. Unfortunately when a cleaner cleans the office after hours she sometimes accidentally hits the CAPS key and he can't log in anymore remotely. His solution was to rip out the CAPS key and cover the hole with duct tape.

I do this, too. The first thing I do when I get a new keyboard is to remove the caps lock key. I never used it in my 20 years of PC usages and I don't get why it's still there. Back in my CounterStrike gaming days I would also remove the Windows key because it would crash the game when accidentally pressed.

I work about 30/70 on Mac and Windows. I have the caps lock key mapped to ctrl on Windows and cmd on Mac since they’re roughly equivalent. Makes switching my muscle memory when I switch my OS far less necessary. No more hitting ctrl-c to copy on Mac and instead sending a SIGKILL to the terminal!

Re: Ask HN: Weirdest hack that you ever saw in production?

#158
post #48

Earlier quoted context omitted.

I did this once. A client wanted a website that mimicked the functionality of a complicated spreadsheet that he had created to calculate quotes for customers and didn't have enough money to pay to have all the logic rewritten in a webserver (not to mention continually updated). I imported the spreadsheet into google sheets, gave him access, and had the webserver paste the values in the spreadsheet via the google shee…

I created a whole project for this! https://github.com/franciscop/drive-db Since you can also hook a Google Form to a spreadsheet, you can do surprisingly advanced things over there.

Not to detract from this project, buy this is a good opportunity to mention Apps Script.

You can do all sorts of interesting things between a form, spreadsheet, and other services including your own. Nobody seems to use it, but internally we do all sorts of gloriously hacky workflows with it.

You can easily script forms/sheets/calendar/Gmail together to create pretty much anything you need.

I use it to send daily email reports of data fed into a spreadsheet.

Re: Ask HN: Weirdest hack that you ever saw in production?

#159
post #144

I worked for a chain of medical clinics in the early 2000s in Florida. Everything was going digital. We had a “remote” office across the street that didn’t have internet access and it was really expensive to have lines installed. I don’t remember what the device was called but it was some sort of satellite dish. Our network admin had ordered them and installed them on the roof tops of both buildings and we could prov…

Sounds like a point-to-point directional wifi radio. They're far from a hack and have been used to great success upwards of 2miles away from each other with 1Gbps throughput, even for small ISPs.

Re: Ask HN: Weirdest hack that you ever saw in production?

#160
post #144

I worked for a chain of medical clinics in the early 2000s in Florida. Everything was going digital. We had a “remote” office across the street that didn’t have internet access and it was really expensive to have lines installed. I don’t remember what the device was called but it was some sort of satellite dish. Our network admin had ordered them and installed them on the roof tops of both buildings and we could prov…

So if I understand correctly, the semi was tall enough that it would interrupt the signal between the two dishes on the roof?
Post reply on HN