30 ms·
Have you ever hurt yourself from your own code?
- mths 5y agoI recently looked back on some old projects of mine, it was rather painful.
- A4ET8a8uTh0 5y agoNot directly related. I recently read some of the English work I did as a kid. It was painful to read. Still, this is how we learn. We make some ridiculously bad choices and we hope to learn from those. I guess what I am saying is: if you are looking at past work and feeling bad/embarrased, likely you have gotten better.
- wging 5y agoOof. I didn't realize "harm" was meant so literally. At least it was a one-time thing, though... right? I read "had several thousand WAV audio files that I generated" and expected to read something of the form "I corrupted several thousand important data files irreversibly".
- its_nikita 5y agoHaha yeah. I've definitely "harmed" myself in the form of time lost from deleting files/messing something up on my computer, but I think this was the only time I've actually experienced physical pain from my own bad code.
- ghostpepper 5y agoA few years ago, I ordered the cheapest six-axis robotic arm from ebay for about $100 that came with basically no software or motor-driver boards, so I did it all from scratch with a PCA9685 board, a basic kernel driver and some very hacky scripts from user space. One day I had some friends over for a glass of wine, and wanted to show off my creation. I invited them into my "lab" and placed my wine glass down on the desk so I could type a few commands with both hands. My rudimentary software had some motion smoothing once it was up and running, but upon initialization, if the arm was significantly displaced from where it had been when it was turned off, the PWM board would instruct the motor to immediately "be" in a position that required the arm to travel clear across the desk in effectively as little time as possible. In this case, where it had been previously happened to be where my wine glass was now, and the flimsy aluminum at high speed was enough to shear the stem from the glass and explode the bulb. Luckily the wine didn't get in any sensitive electronics, but I learned a valuable lesson about the difference between messing around with hardware vs software.
- its_nikita 5y agoThat's a good story. Yeah I feel like there must be soo many more opportunities to physically damage/harm something from robotics than software alone.
- LeifCarrotson 5y agoAnything with an actuator, really. I'm a controls engineer, we work with all kinds of hazards and it's my responsibility to run the risk assessment that makes sure no minimum-wage operator gets harmed because of our machine. People are the squishiest, weakest, most sensitive part of just about any shop, so there's a lot of risks to assess! One key observation, though, when working with code is that the machine becomes so close to predictable that it's more dangerous than if it were unpredictable. A cordless handheld drill is hardly a tool that most people would call 'hazardous'. You turn the trigger, the thing rotates, grab the chuck and you can likely stall it. But that much energy in something driven by code is extremely dangerous, it's waiting for any of who knows how many conditions to take off, a common one is that putting your hands in/on something that seems to be not moving can 'make' a sensor and the machine will take off. There are definitely two kinds of safety domains, one applies to manually operated tools where the operator of, say, a knife is responsible for their own safety - if they cut themselves, they're at fault, not the knifemaker. There's another kind of safety engineering where if the machine takes off 'by itself' while an operator is in the way it's the machine designer's fault for not stopping that from happening, the operator can't be expected to know what's going on. The latter should become more common as computers continue to permeate everything we use - that cordless drill is no longer controlled by the operator with a trigger switch that connects power to a DC motor, it's a brushless motor driver with an analog input sensing the position of the trigger and the EMF of the motor, and the charge state of the batteries, and who knows what else. Bump a sensor and it might take off, you don't know why it does what it does. I'll continue to make my automated cells as safe as I can, but don't trust code that's not so simple you can be confident of how it works.
- dharmab 5y ago> A cordless handheld drill is hardly a tool that most people would call 'hazardous'. You turn the trigger, the thing rotates, grab the chuck and you can likely stall it. But that much energy in something driven by code is extremely dangerous, it's waiting for any of who knows how many conditions to take off, a common one is that putting your hands in/on something that seems to be not moving can 'make' a sensor and the machine will take off. A friend needed a valve cover gasket changed on his Honda, and his wife needed to use the car for her Uber runs that night. He came over and instead of our usual hand tools I put a socket adapter on my 20V drill to speed up disassembly. I handed the drill to him and told him "start on the lowest torque setting, and move up in small steps." I turned around to grab more tools from the toolbox. A minute later, I heard a loud noise. I turned to see the car's windshield cracked and a shocked look on my friend's face. My friend was used to his renter's power drill. He hadn't anticipated how much torque a modern contractor's drill outputs and set the torque to the maximum setting. On the third valve cover bolt, the drill had caught on the bolt head and spun my friend around, smashing the battery into the windshield. There's a piece of paper taped to me toolbox called "List of things <friend's name> may not attempt unsupervised." It gained a couple of entries that day...
- Laremere 5y agoI have. Back in early days of Oculus, I was using one of the development kits (DK2?, maybe DK1) and making something in Unity. The Oculus had one screen, with lenses over the left and right halves. To give depth perception, it renders a view for each eye, and shows them in a vertical split screen. Some script had a bug, and none of that happened; Instead it simply stretched a normal view across both screens. I put the headset on, and quickly noticed things weren't working right. I was walking around, trying to figure out what the issue was. Trying walking back any forth looking at a wall in front of me, I felt terrible pain. Something about the left and right eyes seeing movement in different directions across their entire field of view really breaks the brain. It was very sharp and localized too. The brain's perception system is weird.
- enchiridion 5y agoWhoa that's interesting! Glad you're alright. Where was the pain?
- ecpottinger 5y agoFor me it was in the back of the neck.
- jshmrsn 5y agoI’m not an expert on the topic, so just asking: Is it possible you had a minor seizure?
- scotty79 5y agoI had weird experience with valve index. I somehow miscalibrated it and the floor wasn't level. I spent maybe 20 seconds in VR with skewed floor and it felt horribly wrong. And the whole evening my sense of ballance and perception was broken not to be the point of falling over but the real world around me felt wrong. Only after I slept my brain fixed itself.
- TeMPOraL 5y agoI had a similar early experience with Oculus Quest. I downloaded a "ISS tour" game, where you played as an astronaut, and had the full freedom of movement microgravity affords you. The "advanced mode" of the game allowed you to move around by grabbing handles or pushing off things. This kind of unconstrained motion is notoriously hard on VR players, and I felt a bit uneasy the whole time when I was navigating this way, but then I made a mistake. I wanted to rotate myself, so I instinctively grabbed two handles and made a sideways hand motion, sending myself into a fast spin. I almost puked, and even after taking the VR headset off, I kept feeling nauseous for the rest of the day. Like in your case, my brain fixed itself when I fell asleep, and I woke up feeling fine.
- cozzyd 5y agoSounds like endianness is now a safety issue. As for me... I've certainly made it so things that shouldn't be hot to the touch are hot to the touch.
- adenozine 5y agoI'm not sure if you ever write rage comments, just laced with profanity and nonsense, complaining about the situation at hand... I've written my fair share, I used to work with a lot of perl and bash, and I'd come across some disgusting ideas that had made their way into scripts and utilities. Naturally, finding some of that crap after an hours long search for some bugged behavior, it can be very frustrating and irritating to find out that it all stemmed from someone doing an easy task in a stupid way! I once had someone leave me a message on my desk phone referring to one of these comments verbosely, and I happened to be listening to my messages on speakerphone as the day was almost over and we were all doing our little ritual tasks before we walked out the doors for the evening. So, this comment starts being read and all my neighbors are packing up their lunchboxes or tidying papers on desks, etc. As the message went on, I could hear the silence enveloping me, because of course it was wildly heinous, and I just froze up and let it play out. It wasn't that I couldn't have jumped over there and hung up the phone but it was so casual that it just caught me off guard that someone would read that awful crap I wrote right into my voicemail! I remember the end being sorta like "anyhow, that's not a very good practice, so don't write them like that anymore". I don't really even remember exactly what happened next other than leaving with my tail between my legs. I don't think anybody mentioned it to me. I guess it seemed worse in the moment of it. This was well over 20 years ago now, I was basically brand new to everything. That was a turning point, thankfully enough. Reading open source has exposed me to a LOT of different commenting practices. I don't really think about it often enough, but the human on other side is always the most important consideration.
- arionhardison 5y agoYes, I setup a DDP to figure out how I can make my own TNF blockers using nutrient intake optimization.... yada yada yada. Immunomodulators and the immune system are really complex and now I have 2 detached retinas.
- ed25519FUUU 5y agoCan you explain more about what you did and why?
- arionhardison 5y agotl;dr - too much modafinil. Yes, I have Crohn's and I do not like to take the meds or listen to the doctors. This is NOT AT ALL SOMETHING I RECOMMEND, PLEASE DO NOT ATTEMPT IT. Crohn's is an auto-immune disease and the main class of drugs that is used to treat Crohn's like mine (long term) are called TNF inhibitors or TNF blockers. TNF alpha triggers the production of several immune system molecules, including interleukin-1 and interleukin-6. I realized I can track this with basic inflammatory marker test, I also realized that I could use diet to impact my markers. So instead of taking what is referred to as a Biologic e.g.: Adalimumab, Certolizumab etc... I started using NIO to try and get the same effect. I got a pill making machine, and learned how to make supplements but they were not working well enough so I knew I needed something stronger. Then I found this article: https://pubmed.ncbi.nlm.nih.gov/32311496/ https://pubmed.ncbi.nlm.nih.gov/32311496/ I think it was on HN but I do not remember for sure. I order some modafinil and worked it into my mixture. I do not manually create my mixtures because I do not want to know which version I am on, I want my symptoms to go away and that should be the trigger to tell me if its working. So I have a 14 vile setup with an audrino all wired into my press and based on my food diary (e.g.: nutrient intake) it decides how much of what should go into a run. e.g.: how much burdok, tumeric, serrapeptase etc... I got something wrong and ended up adding far too much to a run of pills, I didn't realize this until i started ti see floaters in my eye and I checked to see how much moda was left and it was far less than should have been left. Then i did some reading and a side effect of taking too much moda can be detached retnas, since I have all the symptoms: Floaters, stars and peripheral flashes I am assuming that based on the timing I now have detached retnas, I also found my mistake and essentially no matter where my markers were I was getting about 600mg of moda per day. Which is far more than should be taken. This was for about a 1 month period. I have fixed the issue now and I have a much more sophisticated pipeline but I will have to get this fixed. NOTE: I am not a doctor, I have no college education or anything like that. I just like bio-hacking and decided to pursue my moonshot during the pandemic. I can explain more or provide pics and vids to explain further if you like, email in profile. I am currently writing up a 100% independent non peer reviewed case study to document everything I have done and the results.
- null0pointer 5y agoIs there a reason why you might want to mix endianness within a file format? Wouldn't it just be extremely error prone as demonstrated in the article?
- its_nikita 5y agoYeah I was kind of confused about this when I was reading through the spec trying to figure out what went wrong. I wanted to touch on this in the blog post, but I wasn't able to find a good resource explaining the advantage for mixing endianness in a file format.
- cratermoon 5y agoBecause Microsoft.
- imoverclocked 5y agoWell IBM+Microsoft but really... because 90s and x86.
- AnIdiotOnTheNet 5y agoBecause the important thing about those fields is that they aren't really big endian at all, they're clearly ASCII characters. Why the spec you have decided to say they were big endian is beyond me.
- JonathonW 5y agoThe WAV format is not mixed-endian; everything that’s actually a number is little-endian. The fields the diagram in the article marks as “big endian” are ASCII text— four-byte strings with specific content (“RIFF” for the first ChunkID, “WAVE” for the Format, etc.). If you wanted to treat those as integers in your code, you’d need to treat them as big-endian so their byte order doesn’t get reversed, but they’re really four-byte sequences, not numbers.
- AnIdiotOnTheNet 5y ago
- gfodor 5y agoIf you work in VR odds are you’ve made yourself vomit via code at least once.
- sterlind 5y agoI made a janky AR rig with a webcam taped to an Oculus DK2 as part of a hackathon. My code ran at 15fps. after taking off the goggles, my vision was 15fps.
- sp332 5y agoIf anyone has trouble with normal (not-obviously-broken) VR, I recommend Yoga for Building VR Tolerance. https://web.archive.org/web/20190813004505/http://elevr.com:80/yoga-for-building-vr-tolerance/ https://web.archive.org/web/20190813004505/http://elevr.com:... The research organization ran out of funding but IMO they had some groundbreaking stuff. Thank goodness for the Internet Archive at least.
- castis 5y agoI've been slowly building a homemade quadcopter over the last few years. One of the first times I tested it out it with all 4 motors it immediately headed my direction and caught me in the ankle before I could get out of the way. Nothing a bandaid couldn't fix but it sure sucked. It's tethered to a test-stand now.
- ehershey 5y agoI enjoyed this. In particular the drawn diagram and: > Look at an audio file's waveform before playing it at max volume. That’s always good advice.
- ja27 5y agoNot exactly but I've been mashed, crushed, cut, scraped, shocked (static), etc. many times by the FIRST robotics team robot I mentored as code ran haywire.
- liamkinne 5y agoOne time I got run over by my FRC robot causing me to shout a profanity around a bunch of probably very disappointed adults at the competition. Not my proudest moment... The story is we were testing some autonomous code I wrote and it stopped moving because it was hanging waiting for on some sensor data. Without remembering to disable the robot first, I walked over to it and found the sensor wasn’t plugged in properly. Plugging it in, the code started running again and proceeded to drive up and on to me... Nowadays that I work with industrial robot arms (specifically ones with 24,000 RPMs of death on the end of them) I am very aware of how important safety practices are knowing how easy it is to slip up.
- jmchuster 5y agoI usually think of this more in terms of "what's the reasonable worst thing that can happen, and then be prepared to compensate for it". e.g. - could cause this one page to fail to display - be ready to roll back, open the page asap once deployed - could bring down the entire website - be ready to roll back, maybe try running this during off hours - could delete the entire database - be ready with a backup to restore, maybe make sure your whole team is oncall at the time - could cause ear damage - maybe play it with the headphones sitting next to you first
- frankus 5y agoI’ve gradually developed the same instincts around mechanical and home improvement tasks. “How could this five-minute task turn into a multi-hour nightmare?” Examples could be spilling a poorly placed can of paint all over the carpet, or having a nearly unobtainable fastener fall somewhere inaccessible (or where it can do damage).
- cratermoon 5y agoI accidentally fork-bombed the machine I was working on.
- labster 5y agoLuckily, they were able to land the plane in Minsk.
- userbinator 5y agoMistake #1: Should not have had my volume that loud. I always keep the volume low enough that a full-amplitude noise wouldn't be anywhere near physically painful to listen to, but then again most of the stuff I listen to is ultra-compressed already... Of course, the actual bug is that the audio is in units of samples, which are only 1 byte in the case of mono 8-bit format, so treating the file as being 8bps mono when it could be 16bps mono, 8bps stereo (far more subtle difference in the case of byte misalignment), 16bps stereo, or any of a number of other formats is always going to lead to cases where this could occur.
- Jorengarenar 5y agoI once wanted to run my Bash script (for archiving photos) through ShellCheck. I will never know, but I had to do something terribly wrong, as it started to remove my root directory... Thankfully, didn't had root privileges, so "only" resulted in nuking my home folder.
- devoutsalsa 5y agoI once copied a Terraform directory & changed all the confit values to match the new environment I wanted to spin up. Unfortunately I forgot to remove the Terraform state files. So running “terraform apply” did a great job of spinning up the new environment, right after it tore down the old one.
- paxys 5y agoPhysically no, but the amount of emotional pain endured from reading my code cannot be quantified.
- tobmlt 5y agoAre you my old advisor? If so, you are correct as usual, sir. ;)
- imoverclocked 5y agoA long time ago in a university far-far away, I stayed up for several days straight writing code for an aerial robotics platform. I was so focused on writing this code that even my dreams were trying really hard to be expressed in perl. I woke up extremely tense and in a sweat because I couldn't figure out how to express a strong emotion in perl. As for the harm, well ... that code led to a marriage which catastrophically failed. Lesson learned: keep code and emotions away from each other.
- Turing_Machine 5y agoNot my own code, exactly, but back in the day I was trying to get a balky dot-matrix print head working and accidentally sent power to it while I was holding it. I had a row of dots tattooed on the ball of my thumb for a year or two afterward.
- cassonmars 5y agoI once programmed an arduino driving multiple solenoids with felting needles at pretty high speeds (wool felting uses needles to push wool fibers together into shapes), all pointing to the same target area, at slightly different timings. In the perfect case, it worked really well. Felting needles however bend and break with heavy use, leading to colliding felting needles projecting toward my hand. Ouch.
- renewiltord 5y agoI learned that you could pipe anything to any device. Decided thirteen-year-old me was an avant-garde artist who would pipe my hard-drive to my speakers and create beautiful works. Was that just a `cat /dev/hda1 > /dev/snd` or something like that? Incomprehensible shrieking. Later that year, someone posted about the thing that would become the Internet phenomenon called 'Anonymous'. I am certain that idea was birthed from the wailing portal of hell I summoned that day.
- 8note 5y agoI've melted a table once. Was testing a heat controller, and had the debugger left on. When the laptop the debugger was running turned off, it also stopped the code from running on the microcontroller, leaving the heater on without adding any new controls. It was a good learning to make sure there's a watch dog circuit, and that the microcontroller is much less trustworthy than the fpga
- HeyLaughingBoy 5y agoI've done this debugging a system with a pneumatic controller on one of the threads. Hit a breakpoint with the compressor still running and after a minute, hoses start blowing off. It happened often enough that we learned to not use hose clamps since losing a hose connection was a safe failure point. However, I've read about the same thing happening to a couple guys testing a tank turret rotation controller. Controller is paused at a breakpoint, but a hardware counter is still accepting error pulses. Start running again and the error built up enough to command a full speed slew, sending the engineer who was sitting on the turret slamming into the wall, breaking a few bones.
- geocrasher 5y agoI can think of two examples. The first is somebody else's that I helped them with, and the second is mine. Context: Mid-2000's snack-sized hosting company with less than 10 employees. A customer with a dedicated server called in one day. I knew him well, and he I. It was that kind of company and I loved it. Anyhow, he called in and said "I've been hacked!" I asked him to explain the problem and he said that his server wasn't working right and wouldn't reboot. I looked into it, and a ton of things were missing from the file system. /bin, /boot, /dev, etc. Gone. So I did a restore of the server and got it back online. He called me up an hour or two later "I've been hacked again!" Same problem. Same solution. An hour later he called me up, sheepish. "I think it might be ME. Every time I think it's happening every time I run this command." I managed to get him to email me the command he was running, verbatim (he was copy/pasting it into the shell) and it looked like this: rm -rf /home/user/file; rm -rf /home/otheruser/directory; rm -rf /home/foo/thing; rm -rf / home/bar/otherthing; rm -rf /home/didyouseeit/thing3 The other harm was my own. I was budding system administrator tasked with designing and deploying dedicated servers (this is before VPSs were a thing, and way before cloud computing). I challenged myself to learn Perl because the greybeard admin (who cut his teeth on PDP-11's) was a master at it and I could benefit from his tutelage. But I didn't. Instead I got the SAM's book on Perl and started learning. Having an interest in security, I decided that I'd write a simple Intrusion Detection System for our dedicated server products. I don't have the code, but it's irrelevant. A the time one of the bigger problems was servers getting rooted due to various exploits. The attacker would rewrite /bin/ls with their own version that hid their executables. The solution (obviously right?) is to look at the md5sum of /bin/ls, and if it changes, the server must be rooted, right? So I wrote code that would shut down sshd, close the port, and display a message via `wall` that said something very much like: System Modification Detected! Shutting down system and alerting security staff. YOU HAVE BEEN CAUGHT! BUH BYE! I was very pleased with myself. I couldn't understand why the aforementioned greybeard didn't revel in my brilliance. sigh I deployed the script on a cron job and felt very satisfied with my good work. Until a call came in. "Yeah, I ran a yum update, got some message about being caught, and now I can't get into my system." Yeah that's right. I'd hard coded the md5sum for /bin/ls and had no means of updating it. I've since forgotten Perl but I never forgot this lesson: Take everything into account. Spend less time coding and more time thinking about what you're building and how it'll affect others. Since then I've written several utilities that are/were in use at the hosting companies I work(ed) for and I saved people countless time, effort, and trouble. But it sure didn't start out that way!
- trevortheblack 5y agoNot exactly, no. But I've gone long stretches where a compiler error demands 10 push-ups.
- deleted 5y ago[deleted]
- kosma 5y agoI've once started a small fire. I had a software-controlled voltage regulator connected to the printer port (it was for a high-voltage programmer for 8051 chips) and I was writing a Linux driver for it. I accidentally put the chip in backwards... I ran the software and suddenly had a physical manifestation of lp0 on fire on my desk. ;)
- allo37 5y agoI don't know about hurting myself specifically, but at my first job I programmed PLCs. You know, those little computers that control industrial machinery... my code could definitely hurt something (or someone). One example that stands out is a case where we had a heating element to seal plastic bags. It turns out those heating elements get ridiculously hot and only need to touch the bag for a fraction of a second. Naïve me felt that 3-4 seconds was a "reasonable" amount of time for a first attempt...it caught on fire.
- sowbug 5y agoAbout seven years ago I got a bright idea to build a quadcopter. I had experience with little $25-50 drones that bumped around the house with their fragile one-inch propellers, which obviously qualified me to build and pilot something significantly bigger. Off to Aliexpress and Banggood I went. I ordered a carbon-fiber chassis, big strong motors, ESCs, 3-inch propellers, a FrSky receiver, a Devention transmitter, an STM32-based controller, giant li-poly batteries, and all the cables and fasteners I needed. Over the coming weeks the parts trickled in. Finally once the whole kit had arrived, I assembled everything, connected the TTL serial, built the firmware, downloaded it to the controller, and like the brilliant software engineer I am, plugged in the batteries on my bench at home. Nothing happened. Those of you who have blown off fingers wondering why the firecracker under the Coke can hasn't exploded yet can guess what I did next. I examined the chassis closely and began fiddling with the cables and connectors. Again, like the brilliant software NOT HARDWARE engineer that I am. Evidently, I fixed the problem. Which caused four gigantic propellers to begin whirling around my hands and face. And four brushless electric motors to emit their usual high-pitched whine, which today I instinctively hear as them saying to me "You god damned idiot. You are so ours." I was not injured. But that evening, I came close to slicing at least a couple things off my body. I hadn't appreciated the scale of the thing I was building, or the inherent risk in debugging it once I'd slapped it all together. I shelved the project for years, eventually giving it to someone at work who claimed to know his stuff when it came to drones. I hear he's doing fine. Disclaimer: this story isn't about code or my own code. But I think it fits here because I approached dangerous hardware with the "build, run, see what happens" mindset of a software developer.
- 8fGTBjZxBcHq 5y agoPeople are sometimes kind of down on that approach in software, considering it sloppy. Especially in comparison to other engineering disciplines it just looks kinda bad sure. But really I'm pretty sure if for example civil engineers could build a bridge in an hour and load it up consequence-free they'd do it too. The fact that we do it isn't bad at all, but yeah it's easy to not realize when you've exited the realm of consequence-free testing.
- 5y ago
- gizmo686 5y agoBack in college I made a similar mistake. I was taking a class in software security and had a homework assignment to demonstrate a buffer overflow. For extra credit, we could have our exploit play music without invoking exec. My approach to this was fairly straightforward. Using ffmpeg I converted the audio to raw 16bit little-endian PCM. Then I appended this data to the end of my exploit. When my exploit runs, it sets some ioctls on /dev/audio then starts copying the data from the end of the file to /dev/audio causing sound to play. As you might have guessed by reading the article, I had an off-by-one error, causing the music data to be misalligned and loud static to play. Fortunately, my system volume was not particularly high, and I was happy to even get sound to play. I never figured out where I made an off-by-one error, since I had just assumed that the static was caused by an alignment issue that could be "fixed" by adding a 0 byte to the start of the audio data.
- zardaxian 5y agoI was building an underwater mapping GUI, a quick SCUBA dive to do some testing before the weather closed in whilst at sea in the GBR Australia. Dropped to 10 meters, set the datum and started swimming, going well until I crossed into a negative quadrant. My beautiful track went haywire/dead. Then I swam around trying to get back "into" the positive quadrant, I couldn't find it and consequently couldn't get back to the datum. When I surfaced I couldn't see the dive boat! After some time contemplating my life/coding choices for literally jumping in without thorough testing, I heard the Zodiac inflatable buzzing around the rising waves looking for me. Back on the boat I discovered that I had only coded it to work in the positive axis from the datum. In the other axis the location was undefined.
- enchiridion 5y agoHardware projects are so far from my norm, something like this is hard for me to imagine. What kind of devices are involved in scuba tech like that?
- zardaxian 5y agoNot much. A floating GPS antenna on a self tensioner, tablet in a housing. And some buggy code :) Good enough for swim lane mapping and preventing holidays (unsearched areas). Another system we worked with used ultrasonic positioning from beacons, very accurate and covert.
- tclancy 5y agoGreat story and it made me realize that usage of "holiday" is more general than how I thought of it (missing a spot when painting). Which led me to http://www.word-detective.com/2010/12/holiday/ http://www.word-detective.com/2010/12/holiday/
- Hnrobert42 5y agoYou likely already know about inflatable bouys and/or no longer need them, but just in case: https://www.scuba.com/products/scubapro-marker-buoy-orange?variant=36998297616537 https://www.scuba.com/products/scubapro-marker-buoy-orange?v...
- Sniffnoy 5y agoI mean, they should have been removing zero byte-pairs, not zero bytes; removing zero bytes risks shifting whether you're off by one or not!
- its_nikita 5y agoThis would be the case for 16 bit samples (which all of my files were, and most WAV files are nowadays), but for 8 bit samples, it would be correct to remove single zero bytes. Basically I just have to follow the spec more closely
- Sniffnoy 5y agoYes, I was relying on your statement that they were all 16 bits; adjust appropriately otherwise.
- layoutIfNeeded 5y agoAh yes, off-by-one errors when filling a PCM buffer can be loud. Speaking from experience, it’s similarly loud when you accidentally fill an integer PCM buffer with floating point data. My story: I physically broke an indoor bike trainer by writing a mobile app. I was fed up with the rent-seeking subscription-based app that the vendor provided for the machine, and wanted to write a simple app to be able to change the training parameters over Bluetooth. It worked via a standard BLE fitness machine protocol, so I’ve spent a few hours creating a prototype iOS app for interacting with it via the CoreBluetooth framework, based on the free docs from Bluetooth.org. Everything worked wonderfully, up until the point of adding a slider to the UI for changing the “hardness” parameter of the current session. You see, changing the hardness parameter adjusted an electromagnetic braking mechanism inside the machine, and the slider I’ve put on the UI was set to its “continuous” mode, which meant that it was generating a steady stream of change events while dragging, basically at the framerate of the phone (60 fps). The designers of the machine probably didn’t anticipate that someone would be flooding it with 60 “set hardness” commands per second, and the actuator doing the adjustment simply broke from the overload after a few seconds of me dragging the slider… I’m not sure exactly which part broke, but there was a loud crack from inside, and the braking power could no longer be adjusted at all. I could have disassembled the machine, but it wasn’t even mine (it was lent to me by my brother-in-law to try it out), and was still under warranty, so I gave it back and told that it spontaneously broke :^)
- swader999 5y agoMy first ten minute as a lab instructor in a full intro to computing class. I was standing talking and backed up a bit stepping on the leg of my swivel chair. I fell right on my ass hard. Cracked a joke but the whole class of about forty students didn't laugh or say a word. Was rough and I was showing some code at the time and I blame this on the code to this day.
- rcthompson 5y agoI haven't ever hurt myself with my own code, but I have done the reverse. I work on COVID research, and one of the programs I maintain involves pulling the data on all our the COVID patients and vaccine recipients enrolled in our study. One day, it was my turn to get the vaccine, and I also volunteered to enroll in the study myself. However, they were unable to find a vein to take a blood sample, so my enrollment was cancelled. After I received the vaccine, I went back to my home office and continued working on my program, which immediately crashed. I drilled down on the offending database record, looking in the demographic data to see if something was wrong. After staring at it for a few moments, I realized that the demographic data looked... familiar. And then it hit me: my own enrollment record from that day had been left in an inconsistent state in the database that my program was pulling the study data from, due to the failure to collect a blood sample. This resulted in my program crashing on the inconsistent data. So I had to add a special case to my program to handle my own failed study enrollment from earlier that same day.
- robotresearcher 5y agoIn the 90s I implemented a PWM motor controller in asm, for a robot with enough power to accelerate hard on soft grass, outside. Robot was rather over engineered by a team mate who previously worked on automated farm machinery. Tested the microcontroller on the breadboard with an oscilloscope, all looked well: nice PWM shapes. For the first integrated test on the robot, I high-centered it on some bricks so the wheels would turn freely, on the bench. Didn't want to deliver too much torque with wheels up, so asked for 1% PWM duty cycle. The robot leaped into the air, tearing off its umbilicals, hit the floor spinning and generally smashing shit up, including bits of me. Debugging revealed that the output PWM duty cycle was inverted when commanded <2%, so my 1% command was 99% power. My breadboard tests had never gone below 3%, which I guessed was the minimum to overcome stiction on soft ground. Poor robot. The chunks out of my hands were the price I paid to learn to test important corner cases.
- MauranKilom 5y agoOuch. I'm curious what would cause the PWM output to invert under such condition? Was there a special case built in for <2% that was coded incorrectly, or did it emerge from something else?
- robotresearcher 5y agoMy timing bug, if I recall correctly. I was very inexperienced. I got better but never great at that kind of development.
- xondono 5y agoPWM periods and on-time are implemented in the time domain in hardware, so my guess would be issues with integer algebra. Some hardware implementations are notoriously weird on edge cases. Some manufacturers built PWM modules so 0 setting on the on-time register means “no signal”, while for others it means “minimal on-time” (no signal is achieved by turning off the module). The other bad handled case is when going above period (if period is set at 210 clocks but on time is set to 250). Some implementations wrap around, some get locked in “always on”.
- tehwebguy 5y agoNot physically but once I did a find & replace across a folder of PHP files but didn’t specify filetype, ended up replacing a few characters in a Flash .FLA that was part of the same project, corrupting it. Had to start nearly from scratch, I would say that hurt.
- scrps 5y agoNot sure if this qualifies as my own code but I have a highly modified 3D printer, I had upgraded to more modern trinamic stepper drivers which have sensorless homing and I had forgotten to set a sane value for the torque limit to let the drivers know when it had hit the axis' limit when I ported over my existing firmware config and like an idiot decided to use my finger to test it... I learned that day even small stepper motors have finger crunching torque and that under sudden intense pain you will forget where the power switch you've operated 1000s of times is located.
- GuB-42 5y agoIt didn't happen to me personally, but I worked on a flight simulator. Not the fancy kind which moves around but it still used hardware from the real cockpit, including the stick and its actuators. And if the controller is not properly initialized, the stick will slam left and back, hitting the leg of the guy in the pilot seat. For men, it can be much worse... Another bench had a real aircraft gun mounted on a turret that is also controlled by software. No ammunition of course, but it is still a big metal pipe swinging around at great speed, thankfully, that one was fenced because that's the kind of thing that can easily break bones, maybe even kill you on a bad hit.
- deleted 5y ago[deleted]
- alexc05 5y agoI wrote a layoff database for Nortel Networks from ~1998 to 2001. The way I got my notice of termination was while I was running some tests on the production database and needed a "negative" so I searched for a userid that was not present in the database: my own. When I saw my name in the list I called my manager and asked him what was going on. He said "Alex, why don't you head on home for the day and I'll call you there" I wouldn't say "hurt" though. Nortel went bankrupt and I got a great severance package.
- prox 5y agoOuch... and what are the odds!
- yaitsyaboi 5y agoWhat are the odds of being laid off if your boss asks you to write something called a layoff database?
- flear 5y ago"Why me?" "You're more than qualified for this task."
- deleted 5y ago[deleted]
- bryanrasmussen 5y agonormally I'd think not very high, at least until the first round of layoffs are done and any potential bugs with the database/application have been worked out.
- inopinatus 5y agoWriting the tool to fire yourself is definitely a level up from merely being asked to train your replacement.
- Agathos 5y ago
- rottc0dd 5y agoHi, I think I have mentioned this before in HN too. I am not from CS background and just learnt the trade as I was doing the job, I mean even the normal stuff. We have a project that tries reify live objects into human readable form. Final representation is so complicated with lot of types and the initial representation is less complicated. In order to make it readable, if there is any common or similar data nodes, we have to compare and try to combine them i.e. find places that can be made into methods and find the relevant arguments for all the calls (kind of). Initial implementation did the transformation into the final form first, and then started the comparison. So, the comparison have to deal with all the different combinations of the types we have in final representation now, which made the whole thing so complex and has been maintained by generation of engineers that nobody had clear idea how it was working. Then, I read about hashmap implementation later (yep, I am that dumb) and it was a revelation. So, we did following things: 1. We created a hash for skeleton that has to remain the same through all the set of comparisons and transformation of the "common nodes", (it can be considered as something similar to methods or arguments) and doing the comparison for nodes with matching skeletal hashes and 2. created a separate layer that does the comparison and creating common nodes on initial primitive form and then doing the transformation as the second layer (so you don't have to deal with all types in final representation) and 3. Don't type. Yes. Data is simplest abstraction and if your logic can made into data or some properties, please do yourself a favor and make them so. We found lot of places, where weird class hierarchies can be converted into data properties. That did not just speed up the process, but resulted in much more readable and understandable abstractions and code. I do not know, if this is widely useful but it helped in one project. There is no silver bullet, but types were actual problem for us and so we solved it this way. Edit : new lines and some typos
- qdot76367 5y agoAs the project lead of buttplug.io, I will simply say: Yes.
- devoutsalsa 5y agoI was hoping to find this comment.
- GuB-42 5y agoI guess it means the test passed.
- rkagerer 5y agoI've done something like that as well while working on audio firmware. Think about how many times you hit compile and there were mistakes vs. perfect code? To err is human nature, that's why it's so important to set up safety nets for ourselves when dealing with dangerous things. Wear your digital PPE :-).
- geocrasher 5y agoThis thread would be incomplete without a link to the Therac-25: https://en.wikipedia.org/wiki/Therac-25 https://en.wikipedia.org/wiki/Therac-25 TL;DR: Software race condition caused radiation doses several hundred times higher than intended, killing several patients.
- fullstop 5y agoWe studied that case in my college classes, and I decided to never work in a field with such risks.
- goodpoint 5y agoThe thread is about "Have you ever hurt yourself from your own code?" ...otherwise: https://en.wikipedia.org/wiki/Boeing_737_MAX https://en.wikipedia.org/wiki/Boeing_737_MAX
- SavantIdiot 5y agoI built a TENS unit with an Teensy and decided to skip a current sensor. Real switching power supplies regulate current too, not just voltage (a low Ohm shunt across one of the stages to an opamp that tells the PWM circuit to slow down the n-fet input pulses, in addition to the voltage feedback power gate). The funny part is: I didn't shock myself, I punched myself. I had the electrodes connected to my pectoral muscle and I was adjusting the levels while holding up my arm with my hand to the side of my head. A random current change translated to a huge voltage boost, the pectoral twitched hard, and BLAMMO, punched myself in the bridge of the nose. At least I think that's what happened. Could have been changing skin conductivity, but I like to think my Teensy code hurt me. (I eventually removed the MCU and just used two comparitors with a voltage-controlled duty cycle oscillator... much easier.)
- theriddlr 5y agoFortunately it didn't penetrate through your pectoral muscle and reach your heart.
- sdenton4 5y agoMistake #0: Working at the wrong level of abstraction. There are perfectly good library functions (in python, and I assume in C) for loading a wav file into a simple array of values, and writing an array back into a new wav file... Load the data, skip the zeros, and write.
- jdswain 5y agoDid something similar to OP. I was writing a controller for a streaming system and managed to accidentally set the volume to 100. This was with speakers not headphones. I had to pull the power plug to stop it. Just about gave me a heart attack. The bug was a feedback loop in the volume control code that somehow ramped the volume up without any way to stop it. After that I always tested with a physical volume control later in the audio chain, with the volume set to a medium level.
- theli0nheart 5y ago> Look at an audio file's waveform before playing it at max volume. This is important, but more broadly, practice good sound hygiene: wear headphones them around your neck until you know for a fact that it's safe to put them on your ears. Additionally, never play "new" sounds without remembering to set audio output to a tiny fraction of normal and increasing it after the sample is deemed safe. Musicians have this drilled into them because it involves their daily work, but this is good advice for everyone. Damage to ear drums can be permanent.
- tgv 5y agoAlso: put a limiter on your audio bus if you're exposed to such risks regularly. Don't play sounds directly, but open them from a host program that can apply VST/AU/... effects, and make sure there's a (brick-wall) limiter at the end.
- fart32 5y agoAnd if you have been exposed to a very loud noise, to the point where your ears are ringing (probably not from headphones, but like starting a loud bike in a garage or gun fire), go to hospital, as soon as possible. They can give you medicaments and prevent permanent damage (tinnitus).
- ehnto 5y agoI have tinnitus. You don't want tinnitus. Silence is no longer a possibility for me. I got it messing about on computers and with loud cars in my teens, so unfortunately it was just a dumb kid thing that will last a lifetime. I hate to guess how many kids are giving themselves tinnitus right now. It's just not possible to communicate the seriousness of long term problems to kids, they have no context for what long term really means yet.
- 12ian34 5y agoSorry to hear that, but I appreciate your words of warning. I go to loud clubs / live music a lot (pre covid) and despite knowing I should probably wear earplugs, I don't. Perhaps club revival post-lockdown is the time for me to begin.
- froh 5y ago> Well this was fine by me because I was going to write this program in C, so I didn't really care about safety. this is extra funny if you work in automotive functional safety. the collection of anecdotes in this thread makes me wonder if an intro to functional safety could be standard curriculum. the approach of Nancy Leveson is not only very accessible but also very accessible, freely so: https://g.co/kgs/AJWDuh https://g.co/kgs/AJWDuh http://sunnyday.mit.edu/ http://sunnyday.mit.edu/
- ryanmentor 5y agoI have taught robotics enough to have hurt myself in front of a classroom while demonstrating a safety feature. Nothing serious, everyone has a good laugh. 3D printering has also led to some pinching and burning here and there. Worth it!
- yaur 5y agoI've made the mistake in this article by piping something that wasn't uncompressed audio to /dev/dsp. These days I prefer to work with speakers with a physical volume knob and start it at 0 with unknown sources... you just never know what the yahoos upstream are sending you.
- pjerem 5y agoI’ve not been physically hurt but lessons were learnt : A friend of mine once gave me an old computer (I don’t remember exactly but it was some random Compaq running Windows 98 and this happened in ~2010). I installed some distro in it but tbh, it was barely usable. I decided it was a great opportunity to see with my own eyes what would happen when you intentionally « sudo rm -rf /* ». Well, no surprise, it erases everything. Conscientiously. Recursively. Including the mounting point of the USB hard drive where I stored my hobbies projects. Including the network share of my other computer’s /home. No real harm if you don’t account the dehydration from sweating.
- rochak 5y agoSo much for curiosity. I still believe it must have been worth it though :)
- eCa 5y agoSimilar lesson a decade earlier: Linux seems interesting, how to install on my Windows machine? First step: Run fdisk. Done. The most painful part was the hundreds of photos I just had finished scanning. At least I got quite good at scanning photos..
- busymom0 5y ago> Including the network share of my other computer’s /home. TIL network shares also get deleted in recursive deletions.
- teddyh 5y agoThere’s a reason that modern ‘rm’ has a “--one-file-system” option.
- Nextgrid 5y agoUnlike on Windows where each drive has its own letter (so I don't think it's possible to create a path including all drives), in Linux the filesystem originates from "/" and any additional drives or network shares are "mounted" into folders within that parent filesystem, so recursively deleting everything from the parent would also affect everything else.
- Yenrabbit 5y agoI tried to automate mouse moves, keystrokes and screenshots to take a higher-res picture of an area in Google Earth. Something went wrong and it got out of control. My attempts to stop the script were futile as the automated mouse steered me away from the code window. The spinning, gyrating earth rapidly made me seasick - had to close my eyes and fumble my way to the power off button. Stretching 'hurt' but it was a memorable code fail nonetheless :)
- SSchick 5y agoReverse engineered a shock collar's protocol in order to control it via programmable SDR antenna. Implemented a basic HTTP server that'd dispatch commands with a simple access control and permission system, messed up the rate limiting, big mistake. PS: I don't have a dog.
- sprkwd 5y agoanymore...
- thih9 5y agoIt's extremely easy to hurt yourself with audio, it almost feels like cheating. Just regular audio work provides plenty of opportunities to do that. Here's a random note from Supercollider, a platform for audio synthesis [1]: > CAUTION: macOS system volume doesn’t effectively limit audio applications’ maximum volume. Extra care has to be put in working on this platform, especially with headphones, because programs can produce unexpectedly loud sounds regardless of system volume settings, potentially causing ear damage. [1]: https://supercollider.github.io/download https://supercollider.github.io/download
- vvillena 5y agoAfter such one experience, I've never played with audio while wearing headphones unless there's a physical volume control in the signal chain.
- jan_Inkepa 5y agoThe macOS system volume behaviour is ridiculous. I ... had a really bad time once with puredata. I...it's really unpleasant to remember. I also generally amn't entitled with open source software, but reporting this as an issue to the people at puredata (dsp software), recommending that they put in their own software cap in the pipeline was met with the response that I could always do that myself in my scripts as I'm writing them if I cared about it. For me (as someone who's made audio software), user's physical safety of this avoidable kind must be high priority, and it's more or less unconscionable to leave things like this to chance.
- carstenhag 5y agoOh Apple... On the iPhone, using earphones, the volume is limited (afaik because of a EU law). On Mac, none of that is the case. I was in a teams called, tried to make it quiter with the touchbar but accidentally set the volume to 80% (insted of 10-15 where it's usually at). My ears hurt for an hour. Thanks Apple for that useless Touchbar.
- severak_cz 5y agothis is when developing audio I have several precautions in place: 1) system volume level pretty down (usually 30%) 2) headphones volume in the middle 3) when testing something really broken I have my headphones not on the ears but on the neck
- sgtnoodle 5y agoOh yeah, plenty of flesh wounds. No serious injuries that I can remember, though. Maybe that means it was a head injury? :-) More importantly, I don't think I've injured anyone else seriously either. I've worked on embedded software for solar powered race cars, rockets and spacecraft, self driving cars, and most recently UAVs and corresponding high power motorized ground systems. You gotta take safety procedures seriously when testing out electro-mechanical systems strong enough to injure you. One memorable bug discovered in testing in the last few years I labeled "ninja assassin mode"...
- anovikov 5y agoHaha a friend of mine once deleted a key to his Ethereum wallet with more than a million bucks worth of Ethereum on it, due to mistake in his script. That is as "hurt" as it gets :D
- habibur 5y agoWas trying to control a 2 ton weighting diesel generator from my code and a few relays. Didn't go right.
- exikyut 5y agoThis sounds very interesting. What happened?
- BeniBoy 5y agoI think the dumbest way I could have hurt myself was trying to build a DIY laser cutter with a 2W IR laser. The catch is that you don't know wether it's on or not. As they say in the laser community "Don't look into the laser with your remaining eye". The most consistently hurting project was a plotter that printed images with milk (don't ask why), it used a heating part to reveal the drawing. When a paper jam creates a fire you sure want to be near during a print job ! Plus burning my fingers a few times (lost some parts of my fingerprint on one of my thumbs).
- scoutt 5y agoA lot of times... Skin/eyes: experimenting with high-brightness LEDs. These can become pretty hot in no-time. I was trying to do my own LED driver (regulating a PWM signal from voltage/current sensing), on an LED without heatsink. Because of buggy code, it started to burn my table, and by reflex I tried to pull it up with my hand.... Not to mention the countless times a white spot remained in my vision for hours, after looking at such bright LEDs (buggy PWM signal regulation algorithm that kept going from dim to super bright randomly). Ears: every time I write a driver for an amplifier/DAC with headphones output. No matter how many precautions I take. It is going to happen anyway (wrong register configuration, the default volume was too loud, etc.). Also while listening to mic recordings done with a buggy/incomplete software.
- darylyu 5y agoA decade ago I wrote firmware for a printer company. One of the cases we needed to handle was to check if the print head would go back to the home position if I block it with my hand. Being the new guy and wanting to follow instructions I did literally just that. Later on I find out that the QA guy who wrote that test case was just messing with me. The other devs used a pen.
- gmueckl 5y agoBugs like these are the reason why I always turn the volume way down before listening to audio that newly written code generates. And even if you know that you're listing to audio that's OK, try to keep the volume low. Your ears will thank you in the long run. It's easy to have headphone levels to high and slowly damage your ears with long listening sessions.
- andix 5y agoAsk Howard from the Big Bang Theory. He has a nice story to tell about a robot hand ;)
- abyesilyurt 5y agoWhen I was in college, there was a introductory signal processing course. We were using a LabView based FPGA, called myRIO. In one of the labs, we were doing audio processing to filter out noise from the audio and listening on the headset. Towards the end of the session, we were messing up with the code to see what else is possible. Anyways, I accidentally set the gain so high somewhere, while wearing the headphones still and played a tone. I almost got deaf. It still gives me chills to think about it.
- mojuba 5y agoEasily. Got ear infection (!) from an unexpected, very loud random noise in my headphones (just one channel) as a result of a bug in my CoreAudio code. What does CoreAudio do if your floating point audio buffer is filled with random numbers? That's right, it plays random noise at the maximum possible level, bypassing the system volume setting. Why ear infection? I have no idea, but my GP explained that it's quite possible even if the eardrum doesn't get damaged. Which in my case thankfully it didn't.
- severak_cz 5y ago> it plays random noise at the maximum possible level, bypassing the system volume but why bypassing the system volume? It does not make sense to me.
- ahartmetz 5y agoIf the system volume is a multiplier and the float values have large exponents... Small times huge ~= huge. I guess safe volume control should ideally limit the output energy. Energy is proportional to square (or so) of frequency, so ideally it would take that into account as well. That rules out simply hard-clamping sample values because that creates high frequency / energy distortions. Not trivial, especially if low latency is also required.
- mojuba 5y agoExactly and it's not obvious at first. You can easily see that the system doesn't limit the FP audio in Logic Pro: you can in principle crank up the volume all you want. So if the system volume multiplier is, say, 0.1, you can have a buffer with values -10..10 and that will play at maximum volume fine. Everything beyond that will get clipped by the DAC. So random FP noise clipped is still random FP noise at maximum level.
- user-the-name 5y agoI hit this bug just the other night, and I think what caused it was accidentally sending NaNs to the audio API. That bypassed whatever clamping functions were in place, and just produced an ear-piercing shriek. Very unpleasant.
- deleted 5y ago[deleted]
- whitecrow90 5y agothe dog deserves 1000 upvotes
- sirwitti 5y agoIn 2002 I wrote a paper on audio recording for my grammer school graduation and maybe once flipped through it since then. When seeing the graphic of the wav file header I immediately recognized the same graphic I used in that paper. Sometimes it's funny how memory works :) Also interesting for how long content can stick around.
- akx 5y agoReading what OP's goal was, my first thought was "can `sox` do that?". Yes, yes it can, apparently. `sox silence` cuts off silence at the start of a file (or in other places, suitably configured). http://sox.sourceforge.net/sox.html http://sox.sourceforge.net/sox.html (search for `silence`)
- ajuc 5y agoI was working on a software for devices that read stuff for blind people. Basically you put a newspaper on a table and it detects it and reads it aloud to you. We had a feature where user can scan whole books just by turning pages and save them as audiobooks or txt with "audio tags". Basically the device records you saying the title saves it as metadata, and later you can browse the list of books listening to yourself saying their titles. Sadly our hardware had mic near power lines and there was a lot of interference and the volume was pretty low, it was barely usable. So one of my tasks was to boost the volume and remove noise. I tried to write something to this effect, tested a few libraries, and eventually settled on just running sox in the background with several plugins and noise sample collected on our device under different loads. Works like a charm. The best thing - a few years later I google how the devices are doing on the market and I've found a podcast by a blind guy reviewing it, and he mentioned how good the audio tag feature is :) It wasn't the best paying job but no B2B job gives you this kind of feedback.
- cammil 5y agoMy shame is ever present.
- utf_8x 5y agoMy shitty PID controller code left me with a 2nd degree burn on my hand... Does that count?
- ganzuul 5y agoI program CNC lathes in G-code for a living, so yeah. Dodgeing shrapnel is part of the job. A missing dot could cost thousands in repairs and result in loss of life limb. There is usually an aptitude test for machinists. Not everybody can do it fast enough safely.
- cartoonfoxes 5y agoGood machinists are something akin to lion tamers. CNC machine tools inspire a special sort of horror. They're mechanical beasts that growl and groan, ready to lunge at a moments notice with sharpened fangs, and will disembowel you if you let them. Working with a machine that will happily blow itself to pieces with a few errant keystrokes does wonders to focus one's attention. You learn to move carefully and deliberately in their presence. I'm a software developer who has had occasion to program a CNC mill and lathe over the past few years. The relative banality and physically harmless nature of software bugs made in my normal job made the stakes seem so much higher by contrast, when touching machine tools. I partly credit this "culture shock" in helping to keep me safe and the equipment undamaged - apart from a trio of snapped endmills on Day 1 (F100 instead of F10). I can definitely echo that the ability to work safely, quickly, is one thing that sets the pros apart. I'm glad I have the luxury of time that light production affords.
- ganzuul 5y agoI managed to program a 'hard interrupt' into my skull so that before I press the play button I at least have brought into mind what I expect to happen... It usually works. You have to keep a lot of state in mind, and when you run multiple machines at once you do get immersed in the flow and time flies. It is a power trip when you're punching buttons with complete confidence like you're part machine yourself. A quick one to come down from too. :)
- nvmletsdoit 5y agoThere was this time where I wrote shitty code for a imminent super urgent release and I did not think about all implications. I had to work all the week after 10 hours per day just by fixing a lot of data I messed up on several clients. Yeah, I feel I've been there.
- ajuc 5y agoDetecting silence by searching for 0 isn't the best idea, even without endianness bugs. Silence is when the value doesn't change, no matter what it is. Noise is when the values change, the more they change - the louder the sound. So a wav file filled with "ffff" is just as silent as one filled with "0000". And a wav file filled with repeated "00003333" is louder than one filled with repeated "eeeeffff".
- RickJWagner 5y agoYeah, I hurt myself once trying to pick up a new language. It was C#.
- thelastinuit 5y agoIsn’t that literally what a program writer is?
- jakub_g 5y agoWhile at university, late night coding an assembler assignment, I had a bug in my code, and the compiled code would lead to some CPU violation. After running the code, the CPU started making a super loud high frequency noise. The code was a super tight infinite loop, co CTRL-C did not work to make it stop. Hell, even power button of the laptop didn't react! Everything was completely unresponsive. It was middle of night and my laptop was about to wake the whole neighborhood, and the only solution I found quickly was to remove the laptop battery. Luckily I had a removable battery in my laptop back then!
- _pmf_ 5y agoOnly emotionally.
- nargella 5y agoYoutuber Michael Reeves enters chat
- kybernetyk 5y agoYes, I gave myself tinnitus while working on audio code. Turns out debugging audio code and wearing headphones is a bad idea when your code sometimes randomly generates sample value changes from -1.0 to 1.0 :o
- a3w 5y agoDon't use loops. https://github.com/you-dont-need/You-Dont-Need-Loops https://github.com/you-dont-need/You-Dont-Need-Loops They kill people [citation needed] due to off by one errors. N00b.
- pistoriusp 5y agoDoes making yourself sad count?
- TeMPOraL 5y agoNot my code, but somewhat related: I almost hurt myself when my friend used a sonic weapon on me in StarCraft. Back in the ancient days, my friends and I would meet every Saturday and go to an Internet cafe for a few hours of playing multiplayer games over LAN. Mostly StarCraft: Brood War, with a mix of Unreal Tournament and Quake 3 Arena. During the week, we'd all play these games alone, in single player, figuring out new tricks to unleash on each other the next time we met. One of these weeks, I've learned how to properly play Terrans against the Zerg, and was about to demonstrate my knowledge by steamrolling my friend with an army of Marines and Medics[0]. In that game, my friend went for his usual tactic of harassing me with Mutalisks[1] - an effective technique, as long as he avoided the main body of my army. Well, on that day, he wasn't careful enough. At one point, he accidentally flew his entire (by that time pretty big, I think 24+) swarm of Mutalisks straight into my M&M army, which was just staging to launch an attack. My units took about 5 whole seconds to destroy most of his force - but the overlapping audio of dying Mutalisks pretty much saturated my headphones with high-amplitude noise. This was so unexpected that I wasn't able to comprehend what's going on around me (both in-game and in real life) for good 30 seconds, my vision blurred and my head was spinning. Having wasted his entire army, he lost that match. But I keep thinking that this could have been a viable stratagem. If he sacrificed half of his army like this to break my focus, he could've crippled me with the other half. And ever since that day, I kept my headphones at half the volume. -- [0] - M&Ms, aka "bio", was the usual Terran army composition against Zerg players in Brood War. Zerg armies consist mostly of weak but cheap units - compensating individually low DPS and health with quick, mass production. Terran Marines are also cheap and low DPS, but in 2:1 ratio with Medics, they're healed faster than Zerg units can kill them, so a big ball of M&Ms is unstoppable to an inexperienced Zerg player. [1] - Weak, cheap, annoyingly fast flying units. Perfect for distraction, but their low DPS makes them completely useless in a straight fight against Terran "bio" army.
- skciva 5y agoLove this, thanks for sharing. I'm sure I'm not alone in the HN crowd of having fond memories of BW playing days. The sonic weapon, while accidental, feels similar to tactics used to disrupt concentration and logical thinking. E.g. taunting, trolling, cheese strategies, or your opponent getting tilted from something you didn't intend to annoy them with. Often think of how keeping a cool head is incredibly important in games like this, specifically for the pros. IdrA comes to mind as a technically gifted player who was often his own worst enemy due to his temper. He never did crack into the top of the pro scene (hard to do as an American in general) but felt like he really held himself back.
- bradstewart 5y agoAlmost. I was working on a web-controlled, high-intensity LED grow light (~1800watts of LEDs). I was building a UI element which used a single slider to both control the output of the light and show its current position. First attempt had a bug which caused an infinite loop of the UI setting the light to 100%, then the light setting the UI to 0%, and back and forth. The light was on my desk in an otherwise dark room. I (thankfully) don't suffer from epilepsy, but the the rapid, constant changing from incredibly bright to near darkness made me dizzy to the point where I couldn't really move. Luckily a breaker tripped after a few minutes.
- unnouinceput 5y agoBack in mid 90's, as a fresh student barely having a year of programming under my belt but with a burning passion I was doing my summer practice (required by school) to a factory IT center. This factory was making a lot of large industrial stuff but during that period the current contract was to make propellers for big ships. Like 20m high one. And they used AutoCAD in the IT center to design those. For a Japanese client. So the director of said IT center, seeing me how I dabbled in all kind of stuff with latest and greatest technology asks me "can you create a copy protection?". Nowadays I see this kind of question as a job on my freelancer marketplace and I always say to the potential customer "impossible, and if anyone else says otherwise are either incompetent or just want to hustle your money" but back then? my naive brain said "sure I can". The IT center just acquired, at around 4000 USD each, a brand new line of 486 DX2 at a whooping 100 MHz which came with latest and greatest Windows 3.1 for Workgroups. Around 20 of them for all their design engineers to use ACAD at a faster pace. Serious business required serious tools. So I enter the scene with my protection. Which was a wrapper around the protected "exe" that on launch would ask for password, 3 tries and you're out. If password was provided then it would unwrap the good exe and launch it, otherwise the protection would kick in. And oh boy, what a marvelous protection I wrote. First step - overwrite MBR with zeroes, you can guess to what goal. Second step - well, this one is a bit complex. You see back then you could directly access graphic cards DMA channel and write your own graphic driver inside your application because, well, DOS was like that. And poor Win 3.1 was no different either. And because of a physical layout that majority of board back then employed all the same you had an electrolytic capacitor near (like 2 mm only) a pin. Which said pin could go to up 25 KV if you were driving a certain pattern on your graphic card. Which would result in a shortcut between the pin and the capacitor. Which would ignite the resin that was there. Which would set your computer on fire. Third step - restart the PC. So I am there with the director, head of designers and a bunch of other people to test my copy protection. I explain to them in what the protection consist of, and we test it. They wanted to test it on "acad.exe", so I wrap it up in my protection, delete the original and the new exe is launched. All good, password prompt, get in, Autocad is launched, they can do the work in peace. Except the director asks "and if I launch this wrapper tool separately, what happens?". "Nothing, it's just a tool and if you don't supply a parameter will simply exit". So the director does that, except he supplies a bogus parameter, by mistake, and not any parameter but ^U...you know, the combination that a Windows user will see at a command prompt when he does a mistake and presses CTRL+Z (Undo in Windows), because he pressed space and then wanted to back it off..and muscle memory for that action is CTRL+Z. And happily my tool tries to wrap around a file called ^U, but for some reason that file instead to be "not found", because I had this coded, was treated at "launch the protection". So here a little bug, launched my protection on a $4000 brand new machine. Of course MBR was zeroed instantly and then we see some stuff scrambled on the screen (protection no 2) and puff!! we're at BIOS reset. No fire!!! Why? because protection no 2 should've run for 10 seconds to allow the buildup of those 25 KV, but I was lucky because my dead ass brain introduced another bug and I was triggering the reset immediately. I spent the next 3 days, me and the head of designers, rewriting the MBR by copy/paste via eyes and hands, using a hexeditor, by reading the MBR from another 486, and I was lucky since they all had identical configuration. That protection scared off the director, he never use it. And my ass hurt from the stick because $4000 during that time would've been both my parent income for an entire year.
- anoonmoose 5y agoBurned myself many, many times, not realizing that a bug in my code had resulted in way too much power going through something or the other, and then going to touch that something. Got myself an RF burn that way once, too.
- TheCapn 5y agoI feel like Industrial Automation is cheating, especially if you're working with a lot of tradesmen/clients who refuse to follow safety procedures. We were commissioning a rather large food processing facility and had already verified that our PLC->Motor Starter wiring was all valid, but at some point the client decided they're ready to run a production line without testing the Motor Starter -> Motor wiring (bump testing the motors). Normally you'd have people away from the equipment, proper lockout, people with radios verifying operation, all that jazz, but the client decided to go around us and just start turning things on. Well when they went to turn on motor in section A, a drag in section B started due to some mistakes by the electricians. Section B's motor just happened to be straddled by a welder who was standing over it to do some work on an upper walkway when the thing fired up beneath him. Understandably he was pissed. I've never had an injury on the job (thank god) in the 9 years I've been doing this, but there's been a handful of close calls. 100% of the time its because people skip safety procedures and think it'll be fine. The client never did learn their lesson I'm guessing. We went home for the weekend, "Days since last work stopping injury" was reset when we returned Monday. Not sure what happened there.
- schainks 5y agoEvery time I git blame on code that needs to change and realize it's my code. So much for write once, run forever!
- JoelMcCracken 5y agotl;dr I got myself banned from #emacs accidentally because of a bug in my code. One time I was writing a little emacs lisp module to automatically reconnect me to #emacs on freenode, but it was buggy, but it was still in my .emacs at the time, so when i restarted emacs, it started running, and I didnt notice it. fast forward a little bit, i notice the irc buffers open in my list of buffers, and lo and behold, my code was constantly disconnecting/reconnecting in #emacs and it was spamming the channel with those messages. They banned me (briefly) so it would stop. It was just funny to see like a flood of connects/disconnects in the chat log, and people being like "whats going on" and "must be a bug in something".
- deleted 5y ago[deleted]
- sparker72678 5y agoI run a home HVAC thermostat with custom code that has no other hardware fallback. Once, due to a logic error on my part the heater was triggered in the middle of the summer while I was out of town. The internal temp got up to well over 100°F. I was able to have a friend come over and disconnect things for me, but I could have killed a pet, at the least, if not some more sensitive hardware.
- no-s 5y agoback in the early 80’s I wrote 400kLoC in the course of a summer (APL/360, very short lines), printed it all out on green bar fanfold paper. Stashed the printouts in binders on bookshelves, the shelves collapsed and I got nasty bumps and paper cuts. If you meant conceptual injury, I try not to dwell on it, but I once wrote a makefile that “clean”-ed up all the source code, source control, and the backups...just a cut and paste error, but soured my original exuberance about make. For life.
- lmilcin 5y agoI have cut my finger after a bug in a controller I was working on started spinning a motor at a time it was not supposed to.
- _theory_ 5y agoUnsurprisingly, there are very few accounts on here of people killing themselves with their own code.
- Teknoman117 5y agoNot so much myself physically, but I certainly have written code that destroyed my own projects (hurt my wallet). Many years ago I was working on a mobile outdoor hobby robotics project (RoboMagellan) and had two glitches in parallel. One was the software controlling the robot, the other was in a microcontroller in the kill switch mechanism. The main computer was reset by a brown out which also caused the uC listening for inputs from the radio used as the "enable" switch to lock up (with the motors enabled) and I hadn't yet learned about hardware watchdog timers. Drove straight into a river.
- ecpottinger 5y agoHow far back are we allowed to go. Decades ago I had a Original Commodore PET 2001. It could only display white text/characters on a black screen. Foolish me having read a Byte magazine describing how a black & white colour wheel could make you see colours see: https://archive.org/details/byte-magazine-1977-02/page/n45/mode/2up https://archive.org/details/byte-magazine-1977-02/page/n45/m... so I tried to get my PET colour to display colours using this method. Trying different timings, all the while staring at the screen. I did this all day looking at flashing lights all the time. Afterwards it turns out I could not see properly for hours.
- mrlonglong 5y agoOn!y my pride.
- glxxyz 5y agoHopefully the finished code also didn't make Mistake #4: skipping the zero first byte of the first non-zero 16 bit integer. i.e. it should only skip zero words (byte pairs), not zero bytes. This error would probably go unnoticed for a while if it did.
- bacon_waffle 5y agoAt a very "lean" company that made power electronics (modular telecoms rectifiers and 1.5-5kW grid-tied solar inverters), I nominally worked as a test engineer but I wound up doing a fair bit of EE/firmware work on the products too. Above my bench was that typical drop ceiling stuff like in offices worldwide, except mine had little singed bits of semiconductor packages stuck in it from where things had gone wrong in testing and blown up transistors and such. All of us who worked with open electronics (often necessary during development, for probing or whatever) had earmuffs and safety glasses at the ready, and a wood stick for pushing the on/off switch. AFAIK there weren't any real injuries, but there certainly was potential. My favourite near-miss was the result of a dumb EE experiment, not really code: I had built an 8kV surge generator to test against IEC 61000-4-5, and needed to test the generator itself. We spent an afternoon finding interesting components to blow up, at first under a shield, but the good ones would just make a satisfying snap or pop - not too exciting from a kinetic perspective. Then, I noticed a DVD... The surge through the foil in the DVD made one of the loudest bangs I've ever heard - easily louder than a gunshot - the foil vapourised and sent plastic shards all over the office. The surge generator itself was a glorious hack; it used a neon sign transformer to generate the HV, and the main switch was a trigatron I made from a couple doorknobs from a home recyclers in the same industrial park.
- mleonhard 5y agoApple Airpods Pro protect users from over-loudness. iPhone has an option to enable this protection for all headsets, but it doesn't work properly. For example, when answering a FaceTime Audio call with Bose SoundSport, the "call connected" tone often plays at max volume and is staticky. This is with the latest firmware and iOS. macOS has no over-loudness protection. Bose's expensive noise-cancelling headphones do complex audio processing but fail to protect users from over-loudness. I think the company has lost its ability to focus on user needs. Over the last 10 years, only their noise-cancelling function has gotten better, but other aspects of their headphones have gotten worse. Features I want in my next headset: - active noise cancelling - loudness protection - swappable battery - physical buttons - mic windguard - stowable boom mic so I can talk quietly on a call and still be heard - an option to automatically pause music when I take off the headphones and resume when I put them on - an option to automatically enable or increase noise cancelling when the environment becomes noisy and disable it again when in a quiet space - Automatically detect me speaking and pipe my voice through the headset so it feels natural, even when not on a call. - Work properly in extremely noisy environments. When I wear my Bose QC25 noise-cancelling headphones while riding the BART subway in San Francisco, the headphones emit painful crackling sounds when the train noise is very loud. I don't expect the headphones to block extremely loud sounds. They should not make the noise worse. Bose's headquarters is in downtown SF. I expect some of the firmware engineers ride BART every day. Does anyone know why they haven't fixed this in 7 years?
- ffffwe3rq352y3 5y agoI don't understand why this isn't a common thing everywhere??? I'm not a headphone designer but the "loudness protection" seems like it would be trivial to add! For some reason that idea never occurred to me but its a good one.
- 3op 5y agoWas doing research with quad-rotors. Had 10+ stitches from bad tuning of a PD controller (and me not taking proper safety measures).
- Waterluvian 5y agoHacking the bits directly seems like a lot of fun for various problems. A great way to learn the details of a format.
- aaronbrethorst 5y agoI find it a bit grim that the word "Tesla" only appears once in this entire thread, despite 356 comments preceding me.
- stjohnswarts 5y agoI bet most robotics and other embedded people have :) . I once got zapped because of a timer I set on a 50V section (95% of the board was 12V or less) of a circuit and proceeded to forget the timer (for a transistor switcher) was set in my debug version. It was just 50v DC and tiny amperage but still very zappy.
- tekromancr 5y agoI used to have a big CNC router. Like, one that you could mill a whole door on, if you wanted to. One day I thought it would be a cool hack if I could rig up an Xbox controller to send movement commands. Long story short I managed to snap the bit by moving too much after a plunge cut. No safety glasses or anything; but a day or two later I did find some shrapnel from the bit embedded in a piece of foamboard I had near the machine, so that was cool...
- 317070 5y agoThe context is building a robot for a sumo competition in university. By this time I am towards the end of my Phd, and regular strategies don't cut it anymore. We want to show off. Since many of these robots use ultrasound locators based on echolocation to find other robots, we want to eliminate those from detecting us. One of the strategies we wanted to try, was to generate sound at the right frequency ourselves, which should completely ruin those sensors, thus making us invisible for no apparent reason. So I bought a transducer used to clean ships, which was rated for use around the correct frequency. I connected it to a signal generator at an ultrasound frequency and wanted to test its effect on the echo sensor. Now, I am doing this sitting in a noisy lab with a bunch of noisy instruments, robots whirring and computer fans. Some other people in a corner chatting away. I put the transducer in front of the distance sensor, set up the program to print the distance measured, turn on the signal generator, and the whole room goes eerie silent. I turn it off, and luckily the sound comes back immediately. It appears that if you pump 100+ decibels of ultrasound in a room, it actually drowns out other noise! This thing was quite powerful. After all, it was made for cleaning ships from foul. At that point, I do realise I have no idea whether this is a safe thing to do for my hearing (and that of the audience), and shelve the idea. But I remember the split second where I thought I made myself and everyone else in the room deaf.
- mcjkrw 5y agoDid it affect the other people in the room, or were they too far away from it?
- 317070 5y agoIt affected everyone in the room and to a lesser extent the next rooms over if the door was open. Obviously, we did not shelve it right away since there seemed to be no permanent effect. Some people were really creeped out after they had been exposed in my first try. But this is an engineering lab, so soon enough the lab was filled with cowboys wanting to experience it and trying to figure out how it works. Meanwhile, the more safety minded people took a short break and went for some air outside. We stopped after the professor figured out something odd was going on on his floor.
- jakecodes 5y agoI always wanted to make an electric skateboard. After a few successful iterations, I decided to make a really fast one that could replace a car. I built my own lion battery out of ~500 18650s. It could go about 30 miles on a charge. It could go about 50mph. It was a very wide body with huge air filled tires. It could pull 10 of my friends up the steepest hill. It was very powerful because I installed an electric motorcycle engine on it. My one extra stupid move was I didn't account for the battery dying at high speeds. Normally I'd stop well before an empty battery but I only had 3 LEDs of primitive battery indication. And that only measured with voltage. Voltage fluctuates wildly in motorized vehicles. It died while only going about 20mph but up a steep hill. The sudden loss of forward momentum flung me off the board into the pavement where I flipped a few times and scrapped across the pavement for a while. Was a painful lesson.
- otikik 5y agoEvery single line of code is potential future hurt.
- NovemberWhiskey 5y agoI've never hurt myself, but I have set the computer on fire. Context: building an avionics test set with an integrated loads and measurements capability and complex relay switching network to allow different things to be switched to different loads and voltage drops measured. During software/hardware integration testing (first time that the hardware had been driven full speed) we found a bug in the CPLD that resulted in 28V being sunk into a 2A resistive load over a couple of PCB traces specified for 10mA; resulting in a large amount of magic smoke being emitted.
- whiddershins 5y agoOne of the first lessons (often learned the hard way) of any sort of audio processing work is to turn your volume way down before starting any sort of playback.