Live data from Hacker News

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

news.ycombinator.com

431–440 of 510 posts

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

#431

We have a production service running for years that just mmaps an entire SSD and casts the pointer to the desired C++ data structure. That SSD doesn't even have a file system on it, instead it directly stores one monstrous struct array filled with data. There's also no recovery, if the SSD breaks you need to recover all data from a backup. But it works and it's mind-boggingly fast and cheap.

Sounds fragile, C++ compilers are permitted to do struct padding essentially as they please. A change in compiler could break the SSDstruct mapping (i.e. the member offsets).

C++ arrays, on the other hand, are guaranteed not to have padding. That's essentially what memory-mapped IO gives you out of the box.

https://stackoverflow.com/a/5398498

http://www.catb.org/esr/structure-packing/#_structure_alignm...

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

#432
post #175

Earlier quoted context omitted.

I'm confused. Was SQLite for the migration?

Probably IPC.

What I meant is that doesn't make sense for the Python version because multiprocessing has its own mechanisms for doing that. Same for the post-migration Rust binary.

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

#433
post #210

Not my idea or implementation. Our startup built a plugin for Microsoft Outlook. It was successful, and customers wanted the same thing but for Outlook Express. Unfortunately, OE had no plugin architecture. But Windows has Windows hooks and DLL injection. So we were able to build a macro-like system that clicked here and dragged there and did what we needed it to. The only problem was that you could see all the actio…

Early versions of iOS did this too. You’d tap an app icon and the app would appear instantly in its prior state … but it was just a saved screenshot that iOS displayed while the app was actually loading.

Really it still does, in a way. The ”apps” in the app switcher work that way. Even if the app is still live in memory, it’s not rendering to the switcher all the time. And if it was killed, then the pic is all that’s left.

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

#434
post #420

Earlier quoted context omitted.

After all this time I don’t remember what the bug was. We did have boxes locally that we tested on of course. But somehow this got out. It might’ve been something that only showed up under certain configurations. It might’ve been something that just should have been caught under normal circumstances and wasn’t for some reason. It may have been something that worked fine tested off-hardware until some bug in packaging…

> I know what I’m doing, it will be fine I don't think anyone is truly a programmer until they've learnt the hard way the outcome of "what could go wrong"! Thanks for the update, happy holidays mate!

Sure! I’ve learned that lesson the hard way a couple of times myself.

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

#435
post #203

Earlier quoted context omitted.

User profiles are actually stored like https://eksisozluk1999.com/biri/{{username} }. "/@{{username}}" also redirects to "/biri/{{username}}". You shouldn't need numbers at all. The numbers are only at the end of topic titles. They are title id's (sequential integers assigned when they're created) to disambiguate conflicting Latinized forms of Turkish words.

back in 1999 or so, I wrote an online shopping site this way, all the data stored as text files (one per category, with many items in my case ... I was 18 years old and had no idea about databases). The site ran smoothly for almost a year until the customer used "*" in the name of a product... which was the character by which all the product data in the text files data was split...

Weird. In the same year (1999), I did pretty much the same thing (because strtok really made it easy to split a string) also for client input fields.

Only, I used the ASCII FS character (the Field Separator character) and everything worked brilliantly.

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

#436
post #393
post #373

Earlier quoted context omitted.

So, I've occasionally played around with a language that pretty nearly does this. Mumps is a language developed in 1967, and it is still in use in a few places including the company where I work. The language is old enough that the first version of it has "if" but no "else". When they added "else" later on it was via a hack worthy of this post: the "if" statement simply set a global variable and the new "else" statem…

That global persistence model across executions is very fascinating. If you don't mind, could you explain what line of work this is and how it helps the use case? I have encountered similar concepts at my old job in a bank, where programs could save global variables in "containers" (predates docker IIRC) and then other programs could access this.

https://www.oit.va.gov/Services/TRM/StandardPage.aspx?tid=64...

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

#437
I worked for an education technology company that made curriculum for K-8. There are long sales cycles in this space and different departments of ed have different rules. Think "vote every 4 years because our books are out of date or just old". The technology wave came fast and most of this curriculum from incumbent providers was formatted to fit in a book with maybe some of the most cutting edge people having a large InDesign file as the output.

The edtech company I worked for was "web first" meaning students consumed the content from a laptop or tablet instead of reading a book. It made sense because the science curriculum for example came with 40+ various simulations that helped explain the material. A large metropolitan city was voting on new curriculum and we were in the running for being selected but their one gripe was that they needed N many books in a classroom. Say for a class of 30 they wanted to have 5 books on backup just in case and for the teachers that always like a hardcopy and don't want to read from a device.

The application was all Angular 1.x based that read content from a CMS and we could update it in realtime whenever edits needed to be made. So we set off to find a solution to make some books. The design team started from scratch going page by page seeing how long it would take to make a whole book in InDesign but the concept of multiple editing doesn't really exist well in this software. Meanwhile, my team was brainstorming a code pipeline solution to auto-generate the book directly from the code that was already written for the web app.

We made a route in the Angular app for the whole entire "book" that was a stupid simple for loop to fetch each chapter and each lesson in that chapter that was rendered out on a stupidly long page. That part was more less straightforward but then came the hard part of trying to style that content for print. We came across Prince XML which fun fact was created by one of the inventors of CSS. We snagged a license and added some print target custom CSS that did things like "add blank page for padding because we want new chapter to start on the left side of the open book". But then came the devops portion that really messed with my head.

We needed a headless browser to render out all of this and then we needed the source with all the images, etc to be downloaded into a folder and then passed to Prince XML for rendering. Luckily we had a ECS pipeline so I tried to get it working in a container. I came up with a hack to wait for the end of the rendering for loop for the chapters/lessons to print something to console and then that was the "hook" for saving the page content to the folder. But then came the mother of all "scratching my head" moments when Chromedriver started randomly failing for no reason. It worked when we did a lesson. It worked when we did a chapter. But it started throwing up a non-descript error when I did the whole book. Selenium uses Chromedriver and Chromedriver is direct from Google and Chromium repo. This meant diving into that C++ code in order to trace it down when I finally found the stack trace. Well yeehaw I found an overflow error in the transport protocol that happens from Chrome devtools as it talks to the "tab/window" it's reading from. I didn't have the time to get to the bottom of the true bug so I just cranked the buffer up to like 2 GB and recompiled Chromium with the help of my favorite coworker and BOOM it worked.

But scaling this thing up was now a nightmare because we had a Java Dropwizard application reading a SQS queue that then kicked off the Selenium headless browser (with the patched Chromedriver code) which downloaded the page but now the server needed a whopping 2 GB per book which made the Dropwizard application a nightmare to memory manage and I had to do some suuuuper basic multiplication for the memory so that I could parallelize the pipeline.

I was the sole engineer for this entire rendering application and the rest of the team assisted on the CSS and styling and content edits for each and every "book". At the end of the day, I calculated that I saved roughly 82,000 hours of work because that was the current pace of how fast they could make a single chapter in a book multiplied by all the chapters and lessons for all the different states because Florida is fucked and didn't want to include certain lines about evolution, etc and so a single book for a single grade but for N many states that all have different "editions".

82,000 hours of work is 3,416.6667 days of monotonous, grueling, manual, repetitive design labor. Shit was nasty but it was so fucking awesome.

Shoutout to John Chen for upstreaming the proper fix.

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

#438
Some 10+ years ago on a small LAN party, we hooked up a tower PC to a projector to show some stats, last few lines of an IRC channel, those kind of things. For some reason, we directly started the application in X (the display system), but at regular intervals, the projector would stop working. Of course! Screen blanking. Having no window manager or other means* of controlling this, the projector would of course keep on displaying our lovely application if we would move the mouse once in a while, or type on the keyboard.

Instead of tasking someone to move the mouse once in a while, we taped a wired, optical mouse to the tower PC at the front. At the time, CD/DVD players were still abundant, so this PC also contained one. We did know about the eject(1) tool, as well as its option to close the tray again (eject -t). From that moment on, the solution for our screen blanking problem was fixed:

  while true; do eject /dev/cdrom; sleep 5; eject -t /dev/cdrom; sleep 30; done;
(this would eject the CD/DVD drive, wait five seconds, then close it again, and wait 30 seconds before starting the same sequence again)

This would cause the optical mouse to detect movement, send this to the PC, and in the end keep the projector on.

* we would later discover the xset(1) tool and its DPMS/screen saver settings. But that would've eliminated the periodic, comedic noise of the CD/DVD drive and the wired mouse bumping on the tower PC, so we kept the while loop intact during the rest of the LAN party.

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

#439

In the early days of Google Chrome, I was tasked with making it work with Windows screen readers. Now, accessibility APIs on Windows were documented, but web browsers used a bunch of additional APIs that were poorly documented. Chrome's design was radically different than Firefox's and IE's, so it was a challenge to implement the APIs correctly. At first I was just trying to get it to work with completely static web…

I had a similar problem with Nvidia drivers. My boss purchased some laptop with 3D glasses and drivers and wanted me to get our custom software working on it for a cool demo.

I read the docs, implemented the right calls, but no matter what I did, I never could get the stereo to kick in. Finally, I renamed our app to doom.exe based on an obscure forum post somewhere, and it immediately worked.

I think the driver had whitelist of games it worked with, and only enabled for them.

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

#440
post #131

I created the most popular Turkish social platform, Eksi Sozluk, using a single plaintext file as its content database back in 1999. It had taken me only three hours to get it up and running without any web frameworks or anything. It was just an EXE written in Delphi. The platform's still up albeit running on .NET/MySQL now and getting banned by Erdogan government for baseless or false reasons (like "national securit…

I hope things go back to normal soon. Good to see you here, Sedat. Cheers.
Post reply on HN