Live data from Hacker News

Have you ever hurt yourself from your own code?

blog.nikitas.link

81–90 of 432 posts

Re: Have you ever hurt yourself from your own code?

#81

I 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!

This 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

Yes, I was relying on your statement that they were all 16 bits; adjust appropriately otherwise.

Re: Have you ever hurt yourself from your own code?

#82
I 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.

Re: Have you ever hurt yourself from your own code?

#83
Hi, 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

Re: Have you ever hurt yourself from your own code?

#84
post #53

About 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…

People 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.

Re: Have you ever hurt yourself from your own code?

#85

A 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…

The "Stuff Made Here" youtube channel was dealing with this recently when making a chainsaw robot. As you can imagine, it was kindof important. He ended up with a combination of a flashing "armed" light and an e-stop switch.

https://www.youtube.com/watch?v=ix68oRfI5Gw&t=732s (12m12s)

Re: Have you ever hurt yourself from your own code?

#87
I'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 :-).

Re: Have you ever hurt yourself from your own code?

#88
post #53

About 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…

There are some pretty gruesome photos on /r/multicopter of fingers sliced like a four year old's hot dog. Spooky stuff!

Re: Have you ever hurt yourself from your own code?

#89
post #53

About 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…

People 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 o…

I wonder how long it will be before we can 3-D print a dam in place.

Re: Have you ever hurt yourself from your own code?

#90
post #80

Earlier quoted context omitted.

Anything 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 become…

> 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 t…

Why would a drill be engineered to put out more torque than a human holding the handle could be expected to counterbalance?
Post reply on HN