Jump to content

What is the most horrendous solution you ever came up with?

As the title suggests : what is the most horrendous solution you ever came up with to solve a problem.

 

if you have been programming for a while you certainly have some in your collections , the pieces of code where you tought , "i really shouldnt leave this inhere, this is an atrocity , but it works great! so ..."

 

ill start with a python (but yours can be any language) ones , i have quite many of them but these are the simplest:

 

 

unlike in C, python does not have a bitflip operator , in C we have '~' ,

but it does a different thing in python :

image.png.6a91ae6d2e784d833e59a2af58a75841.png

however if you mess around enough you eventually get to :

image.png.9b6d6a145b66327f142edc4bbb862bb7.png

and if you do some swapping around over strings of the bits  it even works for multibyte binary numbers (eg for a series of input that get all inverted or so)

this one really is 😞 but anyway 🙂

image.thumb.png.cb00edb6a5a6e89357560c3e9f83a9d7.png

 

im looking forward to anything you have came up with that your kinda proud of but really is beter not seen by someone assessing your code 🙂

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

inherited a Redhat 3.1 server running on 16 year old IBM hardware...

all the redundant drives had failed , and when the partition that had /tmp on it died... i was able to keep it alive for 4 more years by using an NFS mount for /tmp

Can Anybody Link A Virtual Machine while I go download some RAM?

 

Link to comment
Share on other sites

Link to post
Share on other sites

Writing if and else for all the test cases that failed, did it for a college homework assigment. Basically when input was x and expected was y but actual output was z, I would just say if input == x, return y rather than fixing the incorrect alogrithm. Did it for all the 20+ test cases that failed. 😂

Sudo make me a sandwich 

Link to comment
Share on other sites

Link to post
Share on other sites

13 hours ago, wasab said:

Writing if and else for all the test cases that failed, did it for a college homework assigment. Basically when input was x and expected was y but actual output was z, I would just say if input == x, return y rather than fixing the incorrect alogrithm. Did it for all the 20+ test cases that failed. 😂

Lol no failed tests, even better than the it works on my machine excuse 😛

Link to comment
Share on other sites

Link to post
Share on other sites

On 2/15/2024 at 3:09 PM, unijab said:

inherited a Redhat 3.1 server running on 16 year old IBM hardware...

all the redundant drives had failed , and when the partition that had /tmp on it died... i was able to keep it alive for 4 more years by using an NFS mount for /tmp

Was that redhat 3.1 (the pre rhel numbering scheme...)? Damn my first distro was redhat 8.0 psyche. Younger people are like what do you mean not hot pluggable, and what is this side interface you are talking about? (I assume since scsi would have been hot pluggable?  I think not sure)

Link to comment
Share on other sites

Link to post
Share on other sites

  • 2 weeks later...

At work, a manager came up with this idea for a process that required hundreds of Outlook email templates. They thought some interns could make them, but they were burning out on it fast, and making a lot of mistakes. The data we were given to make the templates was in Excel. I wrote something in AutoHotKey that would copy the row from Excel, make the templates for that line, then go back to the next line and do it again, over and over, hundreds of times. It was really ugly and I would only have it run for X number of lines at a time, because it seemed like it had a million ways it could go sideways (and did on occasion). When it was running I couldn't touch anything on my computer or it would screw it up, as it was switching windows and using a bunch of keyboard shortcuts to get things done. But it got the job done in a few hours instead of a few weeks of interns, and all the templates were correct, as far as I know (they were used without complaints until the process evolved into something less awful).

 

As far as anyone thought, I was a genius that was able to get this done so fast, but I'd never want them to see how it was done.

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×