Live data from Hacker News

Ask HN: What's your "it's not stupid if it works" story?

news.ycombinator.com

51–60 of 510 posts

Re: Ask HN: What's your "it's not stupid if it works" story?

#51
This was a while ago so it probably wouldn’t work today.

I had to get past a captcha for automation and the solution I came up with was to always choose 2. If it was incorrect, just request a new captcha until it passed. For some reason, 2 was the answer most of the time so it actually rarely had to retry anyways

Re: Ask HN: What's your "it's not stupid if it works" story?

#52
I had to connect an old accounting system to a web app with enhanced ui (an operator determines a payment on a visual graph of contracts between companies, plus graphs editor). There were two ways: a separate db with periodic sync, and a direct COM-connection to the old app, which was scriptable through jsCOM library. I chose the latter, tests worked fine.

After a month or so I started to notice that something is wrong with performance. Figured out that every `object.field` access through a COM proxy takes exactly 1ms. Once there’s enough data, these dots add up to tens of seconds.

>_Instead of doing a rewrite I just pushed as much of js logic as possible beyond the COM, so there’s only a constant or little amount of `a.b.c` accesses on my side. Had to write a json encoder and object serialization inside the old app to collect and pass all the data in one go.

The web app was abandoned few months later for unrelated reasons.

Re: Ask HN: What's your "it's not stupid if it works" story?

#53
post #51

This was a while ago so it probably wouldn’t work today. I had to get past a captcha for automation and the solution I came up with was to always choose 2. If it was incorrect, just request a new captcha until it passed. For some reason, 2 was the answer most of the time so it actually rarely had to retry anyways

Definitely wouldn't work today. Nowadays you need to classify like 30 images of bicycles and 20 fire hydrants and pray to god before they accept your answer...

Re: Ask HN: What's your "it's not stupid if it works" story?

#54

I had a GCP Cloud Run function that rendered videos. It was fine for one video per request but after that it slowed to a crawl and needed to shut down to clear out whatever was wrong. I assume a memory leak in MoviePy? Spent a couple of days looking at multiple options and trying different things, in the end I just duplicated the service so I had three of them and rotated which one we sent video renders to and do eac…

This reminds me of a service I recently found that was routinely crashing out and being restarted automatically. I fixed the crash, but it turns out it had ALWAYS been crashing on a reliable schedule - and keeping the service alive longer created a plethora of other issues, memory leaks being just one of them. That was a structural crash and I should not have addressed it.

Oooh, you’ve just reminded me of the email server at my first dev job. It would crash every few days and no one could work out why. In the end someone just wrote a cron job type thing to restart it it once a day, problem solved!

Re: Ask HN: What's your "it's not stupid if it works" story?

#55
Mid 90s, can't remember the tech (VB, C, Java?) In the very last hours before an important demo one of the programs stopped working. Not always, only every second time we run it. No version control, no unit tests. It's obviously some side effect but debugging it before the demo and making changes could make it worse. Maybe it won't even run anymore, anytime. We decide to wrap it into a script that starts it, kills it, runs it again. That worked and made us pass the demo.

Re: Ask HN: What's your "it's not stupid if it works" story?

#56
I wrote it up in a bit more detail[1], so I'm giving away the punch line here, but I used to use some cursed bash wrappers to smuggle my bashrc and vimrc along on ssh sessions to mostly-ephemeral hosts by stashing them in environment variables matching the LC_* pattern allowed by default for pass-through in debian-ish sshd configs.

[1]: https://gitlab.com/-/snippets/2149340

Re: Ask HN: What's your "it's not stupid if it works" story?

#57

I worked at a startup where the core backend was 1 giant serverless Function. For error handling and recovery, the Function ran in a while loop. For all its faults, it worked and it was generating revenue. Enough that the startup got to a sizable Series A. That experience completely changed how I think about writing code at startups.

"on error resume next" never died, it just became serverless!

A customer of mine wraps their Python code into try except pass so it never stops because of errors, it just skips what would have run in the code after the exception. I added some logging so we're slowly understanding what fails and why.

Re: Ask HN: What's your "it's not stupid if it works" story?

#58

Earlier quoted context omitted.

I eventually switched to an ESP32 and added temperature graphing: https://imgur.com/a/VM7nD74 IIRC, I used an RTD that I had left over from a 3D printer upgrade, but an 18B20 would fine as well. A 10K NTC resistor might even be good enough. For what I needed (and I think for what you need), just fixing the sensor to the outside of the pipe [if metal] will give you a usable signal. That sensor was just metal HVAC tape…

The pipes are insulated and I didn't want to cut into that, but maybe a small hole for a sensor wouldn't be too bad. But as you say, timer works good enough and that means little motivation to continue to work on it -- countless other projects await :) BTW I've also tuned the timer to run for longer in the morning to get a hot shower ready. Edit: nice dashboard, what are you using for the chart? I like the vintage lo…

That is another somewhat hacky thing.

I have a mix of shame and pride that the chart (everything in the rectangle) is entirely hand-coded SVG elements emitted by the ESP web request handler.

Re: Ask HN: What's your "it's not stupid if it works" story?

#59
Needed to get data out of a CRM system for specific printed orders - when it was printed, who processed it, what was on the order etc.

The process of authenticating with the CRM was complex and there wasn't a way to get anything at print time and most of the data was stored all over the place.

But I found the printed report knew almost everything I wanted, and you could add web images to the paperwork system. So I added a tiny image with variable names like "{order_number}.jpg?ref={XXX}&per={YYY}" and then one for each looped product like {order_number}/{sku}.jpg?count={X}&text=..." etc. After a few stupid issues (like no support for https, and numbers sometimes being european format) it was working and has remained solid ever since. Live time stamped data, updates if people print twice, gives us everything we wanted just by a very silly method.

Re: Ask HN: What's your "it's not stupid if it works" story?

#60
post #31

Launching a headless browser just to generate some PDFs. Turns out, if you want to turn html+css into pdfs quickly, doing via a browser engine is a "works really well" story.

I wrote a Python package [1] that does something similar! It allows the generation of images from HTML+CSS strings or files (or even other files like SVGs) and could probably handle PDF generation too. It uses the headless version of Chrome/Chromium or Edge behind the scenes.

Writing this package made me realize that even big projects (such as Chromium) sometimes have features that just don't work. Edge headless wouldn't let you take screenshots up until recently, and I still encountered issues with Firefox last time I tried to add support for it in the package. I also stumbled upon weird behaviors of Chrome CDP when trying to implement an alternative to using the headless mode, and these issues eventually fixed themselves after some Chrome updates.

[1] https://github.com/vgalin/html2image

Post reply on HN