The Most Absurd Thing You've Ever Coded/Built



  • @Zerosquare said in Perl Guru:

    I think we need a "the most absurd thing you've ever coded/built" thread if there isn't one already.

    I'll start off with a weak one. I wasn't an administrator on my computer at my first programming job. I was therefore unable to change the screensaver timeout (even by changing the registry), which was set at 15 minutes. So I made my own screensaver launcher to launch the screensaver after a minute. I ran this as a service.



  • You want one? Here's two:

    1. I once wrote a script that scrapes a dead (as in, completely inactive) site every hour.

    2. I also once wrote a userscript that automatically hides the various "New contributor" banners across StackExchange sites (including StackOverflow).



  • Well, since this thread was forked from a Perl thread, I'll write about my Perl/Tk GUI project, if I can figure out how to describe it without doxing myself.

    Background: There exists a ray-tracing renderer, which used to be quite popular (but which seems to have lost much of its popularity as other renderers have caught up to, and possibly surpassed, its capabilities). The input for this renderer is a Turing-complete scripting language, which describes the various objects, lights and effects that make up the scene to be rendered. For an animation, the script is interpreted from scratch for each video frame; one of the inputs to the script is the time (as either the video frame number or elapsed time in seconds) for the frame being rendered, so you can use if or other conditional logic in your file to control parts of the scene. You can also compute time-dependent functions to, say, move an object in the scene along a path or make lights fade on or off. Relevant to my project, the language includes an include syntax, so you can split a scene into multiple files.

    I was trying to create some scenes with a lot of complicated lighting effects, which is a lot of scripting to write by hand. (Nowadays, you could keyframe a lot of the effects in something like Blender, which could then generate the file for the external renderer, but 10+ years ago, not so much.) For years I've been fascinated with theatrical lighting, and I'm fairly familiar with how theatrical lighting controllers work. So it seemed to me to be logical and reasonable to write a helper program that would work like a theatrical lighting board, record the lighting changes (cues), and output those to a file in the renderer's language.

    I wrote one. It works the same way an IRL theatrical lighting controller does (except that it's fully scripted, so there's no need for features to override the pre-programmed cues in real time, as an IRL controller has; it also adds some features that an IRL controller can't do, like controlling the position of lights in the scene (IRL controllers can control the direction of "smart" lights, but they can't pick them up and move them across the stage)). It has a GUI with buttons and sliders, just like an IRL controller. (To limit (somewhat) the intimidating visual complexity of the controller, you can set it to just the number of buttons and sliders needed to control the number of lights you need. You can also hide some of the complexity of individual light controls; you can hide the position controls if you don't need to move lights around, and you can hide color controls if you don't need them, and see only a single brightness slider for each light.)

    The output file is text, performance isn't critical (99.9% of the time it's waiting for user interaction), and I wanted it to be portable to at least the main computing platforms, so I wrote it in Perl. With a full GUI in Tk. IIRC, the Tk interface is OO, so I wrote the whole application in OO Perl. Good separation of core, GUI, and I/O concerns; I/O was designed so that the renderer output module could easily be replaced with output to a different renderer (assuming it supported similar lighting effects). Fully documented using pod2html, and at least a good start on a user guide/reference manual. For a project that never got to even an alpha release.

    The portion of the project I implemented worked great, but three things remained unimplemented, one of them critical. One feature required implementing a custom GUI control; I never got around to that. The renderer output was incomplete, but supported a lot of the controller features. Critically, saving and loading the application's own state (it's native format was basically .ini) was very incomplete; you could create a scene and write it out to the renderer file, but you couldn't save it for further editing. Only a few of the very basic settings were saved. This made it somewhat less than ideal for actual use.

    I should add that at some point in the project, I thought about writing it in a less crazy language than Perl. I considered writing it in Java for portability and easier user installation (since the Java runtime is already installed on most systems). But that would have required customizing the GUI controls — the default Java/Swing slider control is ugly, while the Tk slider is exactly the look I wanted, right out of the box — and :kneeling_warthog:.


  • BINNED

    @HardwareGeek Povray?
    Also, that sounds way too professional, where’s the WTFs? 😉


  • Banned

    I've had the rubber cover on mouse wheel rip apart once, which resulted in very inconsistent scroll behavior - the scroll would trigger several times and sometimes in the wrong direction. I wrote a program that rate-limited scroll wheel messages system-wide. It didn't work well.



  • @topspin said in The Most Absurd Thing You've Ever Coded/Built:

    where’s the WTFs?

    Writing a GUI application in Perl; isn't that enough of a :wtf:? Also, having committed that :wtf:, abandoning a nearly working project so close to completion.



  • @Gąska said in The Most Absurd Thing You've Ever Coded/Built:

    I wrote a program that rate-limited scroll wheel messages system-wide.

    Why did you :doing_it_wrong: up your mouse wheel? 🚎



  • @HardwareGeek said in The Most Absurd Thing You've Ever Coded/Built:

    @topspin said in The Most Absurd Thing You've Ever Coded/Built:

    where’s the WTFs?

    Writing a GUI application in Perl; isn't that enough of a :wtf:? Also, having committed that :wtf:, abandoning a nearly working project so close to completion.

    Not as bad as writing a GUI application in Lua.


  • Considered Harmful

    I wrote a bot that does this.


  • 🔀

    I agree with whatever pie_flavor just said.


  • Discourse touched me in a no-no place

    @HardwareGeek said in The Most Absurd Thing You've Ever Coded/Built:

    One feature required implementing a custom GUI control; I never got around to that.

    Custom GUI controls are quite a lot of work, especially to do right. Drawing (and redrawing) is easy enough, but setting up all the various event bindings so that everything responds correctly to mouse and keyboard events is a total ballache. In all GUI toolkits. It's just very very difficult to remember to cover everything that needs to be handled because there's just so many ways in which non-trivial controls can be interacted with when you look across the whole gamut of how users work. It's this sort of thing which is why programmers are typically told to not create their own components if possible.


  • Discourse touched me in a no-no place

    @levicki said in The Most Absurd Thing You've Ever Coded/Built:

    How were you able to change the screensaver? :wtf: Any domain admin worth their salt would have prevented screensaver change too when defining timeout.

    He probably wasn't doing. He's likely just running it as a normal program (trivial enough; that's all they are, with the file extension changed to .SCR) and the information about inactivity time is trivially available in the Windows API.


  • Discourse touched me in a no-no place

    @HardwareGeek said in The Most Absurd Thing You've Ever Coded/Built:

    abandoning a nearly working project so close to completion

    You'd done the first 90% of the work, so you just had to do the second 90%…


  • Banned

    @_P_ said in The Most Absurd Thing You've Ever Coded/Built:

    @Gąska said in The Most Absurd Thing You've Ever Coded/Built:

    I wrote a program that rate-limited scroll wheel messages system-wide.

    Why did you :doing_it_wrong: up your mouse wheel? 🚎

    It was posting too many messages!



  • @discobot said in The Most Absurd Thing You've Ever Coded/Built:

    I agree with whatever pie_flavor just said.

    When are we going to see @discobot says I agree with whatever @discobot just said.?


  • 🚽 Regular

    @discobot say selfagree


  • 🔀

    @zecc I agree with whatever @discobot just said.



  • @dkf said in The Most Absurd Thing You've Ever Coded/Built:

    programmers are typically told to not create their own components if possible.

    Except in web dev.


  • Discourse touched me in a no-no place

    @marczellm said in The Most Absurd Thing You've Ever Coded/Built:

    @dkf said in The Most Absurd Thing You've Ever Coded/Built:

    programmers are typically told to not create their own components if possible.

    Except in web dev.

    That's one of the basic problems with web dev, right there.



  • @_P_ said in The Most Absurd Thing You've Ever Coded/Built:

    Not as bad as writing a GUI application in Lua.

    I did that when I was a student for analyzing and visualizing some results. It's actually much worse - I had found this JVM-based Lua interpreter. Being JVM-based meant that you could call standard Java functions from Lua. Guess where the GUI components came from? Yes- this was a Lua script doing some light signal/data analysis (mainly because I was fucking tired of dealing with Matlab's shit), visualizing the results in the full glory of AWT-based widgets.


  • Discourse touched me in a no-no place

    @cvi said in The Most Absurd Thing You've Ever Coded/Built:

    the full glory of AWT-based widgets

    AWT is butt-ugly. It was butt-ugly when it debuted, and hasn't looked better at any point since. (Swing looks a lot better, especially with a good theme, yet the fact that it's built on AWT still shows through in a few places in how widgets malfunction under some circumstances.)


  • Banned

    @dkf said in The Most Absurd Thing You've Ever Coded/Built:

    @marczellm said in The Most Absurd Thing You've Ever Coded/Built:

    @dkf said in The Most Absurd Thing You've Ever Coded/Built:

    programmers are typically told to not create their own components if possible.

    Except in web dev.

    That's one of the basic problems with web dev, right there.

    Only one of them.


  • Considered Harmful

    @dkf I don't know if saying it's built on AWT is accurate. AWT is handles around system GUI components; Swing is fully Java and only skinned to look native.


  • Discourse touched me in a no-no place

    @pie_flavor said in The Most Absurd Thing You've Ever Coded/Built:

    I don't know if saying it's built on AWT is accurate.

    I do. The majority of Swing components are just drawn directly in Java, yes, but the rest of the system still very strongly borrows from AWT. (There's a few which are directly subclassed from standard AWT, being the ones that have real windows that can be drawn on under the covers; they're obviously required so that the output can be sent somewhere!)

    Yes, I've written GUI apps in both AWT and Swing. I wouldn't class those apps as absurd though. Just horrible. Working with AWT is horrible. Working with Swing is less horrible, but still pretty bad.



  • @dkf said in The Most Absurd Thing You've Ever Coded/Built:

    @marczellm said in The Most Absurd Thing You've Ever Coded/Built:

    @dkf said in The Most Absurd Thing You've Ever Coded/Built:

    programmers are typically told to not create their own components if possible.

    Except in web dev.

    That's one of the basic problems with web dev, right there.

    The whole discipline is about coding cross-platform GUIs in an (arguably) badly designed language, embedded in (and intertwined with) a Hyper Text Media Language document.

    You think?



  • @acrow said in The Most Absurd Thing You've Ever Coded/Built:

    @dkf said in The Most Absurd Thing You've Ever Coded/Built:

    @marczellm said in The Most Absurd Thing You've Ever Coded/Built:

    @dkf said in The Most Absurd Thing You've Ever Coded/Built:

    programmers are typically told to not create their own components if possible.

    Except in web dev.

    That's one of the basic problems with web dev, right there.

    The whole discipline is about coding cross-platform GUIs in an (arguably) badly designed language, embedded in (and intertwined with) a Hyper Text Media Language document.

    You think?

    What's the alternative then? qt? laughs in UWP

    At least electron is better than those choices. 🐠


  • Notification Spam Recipient

    I had to write an IP lookup to prevent people who have changed their browser agent to goggle's crawler from accessing paywalled content. It turned out to be less than 2% of users.


  • Banned

    @DogsB I'm more surprised that it's more than 1%.


  • Notification Spam Recipient

    @Gąska said in The Most Absurd Thing You've Ever Coded/Built:

    @DogsB I'm more surprised that it's more than 1%.

    IP addresses are a nebulous thing. We also discovered we would probably delete anything older than a month. It cost more to host it than advertising brought in for it.


  • Banned

    @DogsB a month? Sounds rather extreme. Just how much content do you generate that it's such a problem?


  • Notification Spam Recipient

    @Gąska said in The Most Absurd Thing You've Ever Coded/Built:

    @DogsB a month? Sounds rather extreme. Just how much content do you generate that it's such a problem?

    I worked for a news website. The content is only interesting for a few hours after publication. There is a severe drop-off after a day for most of the content.



  • I once built a piece of software with the following parts:

    • A custom DSML for plain text. This let me input test questions and answers, marked-up for various types of questions and answers.
    • A set of Python scripts to randomize the input and spit out a properly-formatted LaTeX document (basically randomizing the order of the questions and answers and choosing between variants of the same question and filling a template) using string substitution.
    • A build script to convert those LaTeX files into PDFs with the proper names, along with a key for the multiple choice questions.

    Worked pretty well, but got abandoned because the other teachers prefer Word documents they can edit, as LaTeX is a bit too arcane for them.


  • BINNED

    @Benjamin-Hall said in The Most Absurd Thing You've Ever Coded/Built:

    as LaTeX is a bit too arcane

    e7f57217-8042-4372-a128-5c9cc97af15f-image.png


  • ♿ (Parody)

    A Magic the Gathering game in MS Access. I only ever implemented a few cards: simple creatures and direct damage spells, I think.


  • Banned

    @boomzilla I always wanted to make a MtG-like video game. It sounds very fun to code up.



  • @Benjamin-Hall Oh, heh, that reminds me of another ridiculous thing I ended up putting together in Lua (I avoid the word "coding" on purpose).

    We had to hand in yearly financial reports for a small sports association that I was a part of. Our yearly financial data could largely be summarized on a single A4 sheet, plus a few receipts. We were a daughter organization of a bigger umbrella-org, and the parent org demanded a somewhat more detailedredundant financial report. Said report was preferably produced by a very expensive suite of very shitty software aimed at medium-to-large companies with an actual economy department. Worse, the software (and the reports) were filled with a crapton of jargon and abbreviations that none of us really had any clue about. But, in essence, this software turned our one-page table into about 50 pages worth of dead trees, in a process that took us multiple long evenings over the duration of two weeks (not to mention that we had to redo the whole thing later, because -being clueless- we fucked something up somewhere which made the auditors unhappy).

    The year thereafter I was thoroughly dreading going through that whole ordeal again. At which point I decided that it was certainly easier to just write a Lua script that parses our 1-page table, and spits out a bunch of LaTeX that creates a report that looks almost exactly like the 50 pages worth of dead trees generated by $expensive software. Took me a single evening, and as an added bonus, when we inevitably had to redo the report because of some fuckup, it took about 10 minutes to adjust the output a bit.

    (Fun fact, the year after that, I forgot to adjust the small footer on each page that contained the year of the report. I don't think anybody ever caught that one.)



  • @cvi that's the best use of automation effort. Dealing with needless bureaucratic red tape. Since the output doesn't matter at all, only the form, it's susceptible to mindless machine munging. And saves lots of pain and annoyance on the part of the humans (since machines can't get annoyed).



  • I don't know if it's the most redonkulous thing I've ever written but it's definitely up there in recent memory

    /**
    * Given database structure of:
    * 
    * table patterns
    *     id identity(1,1)
    *     pattern CHAR(4) -- Filled with all 4 digit hex values
    *     matches CHAR(4) -- Filled with all 4 digit hex values that differ in one or fewer bits from `pattern`
    *
    * table fingerprint
    *     id identity(1,1)
    *     widget reference(widget.id)
    *     perceptualData NVARCHAR(2048) -- Typically no bigger than 256 characters for most widgets
    *     hexPrefixA CHAR(4)
    *     hexPrefixB CHAR(4)
    *     hexPrefixC CHAR(4)
    *     hexPrefixD CHAR(4)
    *
    * table comparison
    *     id identity(1,1)
    *     left reference(fingerprint.id)
    *    right reference(fingerprint.id)
    *    distance DECIMAL(15,9)
    */
    
    const data = await (db('fingerprint as left')
        .select([
            'left.id',
            'right.id',
            'left.perceptualData',
            'right.perceptualData'
        ])
        .join('patterns as p1', 'patterns.pattern', 'left.hexPrefixA')
        .join('patterns as p2', 'patterns.pattern', 'left.hexPrefixB')
        .join('patterns as p3', 'patterns.pattern', 'left.hexPrefixC')
        .join('patterns as p4', 'patterns.pattern', 'left.hexPrefixD')
        .join('fingerprint as right', function () {
            this.on('p1.matches', '='. 'right.hexPrefixA')
                .andOn('p2.matches', '='. 'right.hexPrefixB')
                .andOn('p3.matches', '='. 'right.hexPrefixC')
                .andOn('p4.matches', '='. 'right.hexPrefixD')
        })
        .leftJoin('comparison', function () {
            this.on('comparison.left', '=', 'left.id')
                .andOn('comparison.right', '=', 'right.id')
        })
        .whereNull('comparison.id')
        .andWhere('left.id', '<', 'right.id')
        .orderBy(['left.id', 'right.id'])
        .limit(10000))
        // I'd go on but.... you know this is enough... there are like six more queries like this along with data processing that takes over 600 lines total....
    


  • @DogsB Apparently this is officially supported by Google, which kind of shocks me because I thought they wanted to discourage that kind of thing?



  • @_P_ said in The Most Absurd Thing You've Ever Coded/Built:

    1. I also once wrote a userscript that automatically hides the various "New contributor" banners across StackExchange sites (including StackOverflow).

    StackExchange has some pretty large and obtrusive banners. The "X is a new contributor - please be nice to him" banners are quite small and discreet. Is it that the idea of being nice to someone is repugnant to you, or just that being told to be nice to someone is repugnant?



  • @anonymous234 said in The Most Absurd Thing You've Ever Coded/Built:

    @DogsB Apparently this is officially supported by Google, which kind of shocks me because I thought they wanted to discourage that kind of thing?

    😕 Why would they want to discourage sites protecting themselves against fraudulent Google impersonators?



  • I have written a shader and a ray tracer entirely in perl. They both worked great, though performance was a little lackluster. IIRC it took ~30minutes to compute the course test image set, most my classmates had it done in <30 seconds with their C++ code (a few used other languages, but I don't recall their timings).



  • @Dragoon I have to wonder, is it faster or slower than this?



  • @Mason_Wheeler

    It would be hard to be slower than LINQ IME.


  • Java Dev

    I wrote a C program to help me cheat on hangman.



  • A piece of code that took an excel file as input, and generated another excel file with the exact same data, only laid out slightly different. In java.
    Because the system I was working on at the time was generating the first excel, and importing the second excel, and they were not in the same format. I told the Powers That Be that it would be better, faster and more maintainable, and quicker to develop to just make the system hand over the data over a REST interface from one subsystem to another but noooo. That was dangerous apparently. Better create excels.



  • I suppose the statute of limitations has expired on this. My previous job was with a GIS firm, and some of you old-timers probably remember my constant anti-Apple rants from that time period. I was charged with building an offline GIS application to allow map editing on iPad 1's without an Internet connection. I explained that it was a terrible idea, but that fell on deaf ears because customers wanted it. We had existing solutions that would work fine on laptops, but the iPad was the coolest new thing so we had to support it.

    I made it "work," for a suboptimal definition of "work". I had a local SQLite database, complete with a full entity-value-attribute-whatever you call it antipattern necessary to implement a database-in-a-database so the app could work with any dataset without a predefined schema. I had on-the-fly compression and decompression because iPads were only had 16 GB of storage or whatever with no SD card slots or USB storage drivers, and a typical geodatabase was quite a bit larger than that. (Our other solutions also had a few dual-socket servers with many many GB of RAM to handle geodatabase operations...and I needed to make it work on an iPad 1...and I was the only one who thought that this was perhaps a bad approach)

    Sure, the iPad often got too hot to hold, it burned through about 1% of its battery life every thirty seconds, and the application was extremely slow because its sucky processor was trying to deal with a ~30 GB compressed EAV relational-database-inside-a-relational-database hosted on the device's slow soldered-in flash storage, but it worked.

    One of the lowest points of my professional career. I don't believe we sold any instances of that version of the app because it just wasn't possible to do well on the available technology.


  • BINNED

    @_P_ said in The Most Absurd Thing You've Ever Coded/Built:

    @acrow said in The Most Absurd Thing You've Ever Coded/Built:

    @dkf said in The Most Absurd Thing You've Ever Coded/Built:

    @marczellm said in The Most Absurd Thing You've Ever Coded/Built:

    @dkf said in The Most Absurd Thing You've Ever Coded/Built:

    programmers are typically told to not create their own components if possible.

    Except in web dev.

    That's one of the basic problems with web dev, right there.

    The whole discipline is about coding cross-platform GUIs in an (arguably) badly designed language, embedded in (and intertwined with) a Hyper Text Media Language document.

    You think?

    What's the alternative then? qt? laughs in UWP

    At least electron is better than those choices. 🐠

    For values of “better” equal to “worse than all of them”?!



  • @boomzilla said in The Most Absurd Thing You've Ever Coded/Built:

    A Magic the Gathering game in MS Access. I only ever implemented a few cards: simple creatures and direct damage spells, I think.

    I don't suppose you still have that? I would like to see some screen captures at the least.



  • I once wrote a web crawler in PHP because I couldn't figure out how to warm up the page cache of the CMS I was using without actually visiting all of the FE pages. It was beyond horrible.


Log in to reply