My dad once told me that he had to find the fuse that corresponded to a particular wire and because we have around 60 fuses in our house, he had to flick one off, run down and check the wire, run back up, flick the next fuse off, and do that quite a lot of times.
In that moment, I got to explain binary search to him and he was genuinely interested. 🙃
I think the old school method was to plug in a stereo and turn the volume up. When you couldn’t hear it then you got the right breaker.
I hook a cheap webcam up to a USB battery pack and load it up on my phone. Then I plug in a light and point the camera at that. It makes it a single trip and doesn’t bother the neighbors.
My friend has some upcoming electrical work in his house, can you explain how to use binary search in this instance so I can tell him?
Oh, well, you switch off half the fuses, then you go check the wire.
Let’s say the wire still has power on it, so now you know that none of the fuses in that half affected it (which you can turn back on now).Then you do the same thing again with the other half of the fuses, i.e. you switch off half of the fuses in that half and go check the wire.
Now, let’s say the wire is dead, so now you know that the fuse you want is in this quarter.So, then you flick off half of the fuses in that quarter and check the wire again, and so on.
With every step, you eliminate half of the remaining fuses, so for 60 fuses, you need at most 6 steps (which is the logarithm for base 2 of 60).
Ah, obvious now, thank you. For some reason
myhis brain couldn’t get to actually turning off half the breakers in one goBinary search requires splitting the search space into two halves, then asking “is it in that half?”
Normally the “is it in that half?” check involves a numerical comparison: test value versus target value. “higher or lower” here gets you to “is it in that half?”
So finding the midpoint seems like a core part of the process, but really that’s just a shortcut in the case of comparable values, that helps you split into two and check membership.
I admit I couldn’t think of that either: just alter half the items and check for effect.
Once you figure out which one it is, label it! I labeled all the breakers in my panel when I moved in to my house, as half of the existing labels were wrong (no idea why).
That’s the case with virtually every breaker box.
Why are so many mislabeled though? It’s not like the loads are being changed every day. I had two breakers labeled “dishwasher” and neither of them were the dishwasher!
I had two breakers labeled “dishwasher”
Electrical work is one of those things that’s not difficult to do as long as you don’t mind it being some level of wrong but relatively hard to do 100% to code right without training. With most of the wrong ways, the project still works, but it’s dangerous and/or hard to maintain. Professional work is expensive, so you end up with a LOT of handyman work that’s poorly labeled, poorly run, poorly designed or some combination of the three.
My best guess would be that at some point, running the dishwasher tripped the breaker. They had space so they added a breaker below it and moved the line to the new breaker. Then it still tripped, so they moved the line at the dishwasher circuit that was already close by.
Either the original line has a fault in it (old aluminum lines can have junction issues over time) or the dishwasher had a short in it, and they either replaced the dishwasher, or the new line they chose didn’t fail.
I keep a spreadsheet with every outlet/light in every room on it and their corresponding breakers. Much easier since breakers often span multiple rooms, sometimes only powering one or two fixtures in each.
Turn off half the breakers. Now you know which half the outlet is on, based on whether or not it has power. Repeat.
For instance, let’s say you have 100 breakers. You turn off the first 50. Your target outlet still has power. So now you have divided the potential number of breakers by half, and you know the breaker is somewhere in 51-100.
So you cut that in half, and turn off 51-75. Your outlet is now dead, so you know it’s somewhere in the 51-75 range that you just turned off; if it were still on, it would be somewhere between 76-100.
So now you reset 51-63, while leaving 64-75 off. It is still dead, so you know it is somewhere between 64-75.
Maybe now you turn on all of the odd breakers, leaving the evens off. It is still dead, so you know it must be 64, 66, 68, 70, 72, or 74. Reset the first three. Your outlet has power now, so it must be one of the first three.
Flip 64 and 66 off. If you get lucky, your outlet still has power and you know it is 68. But you get unlucky, and it is dead. So now you know it must be either 64 or 66.
Flip 64 back on. If it has power, you know it’s 64. If it doesn’t, you know it’s 66.
We just eliminated 99 breakers and found the correct one using only 8 tests. Because each test eliminated half of the potential values, it whittles things down very quickly. We went from 1-100, to 51-100, to 51-75, to 64-75, to the evens between 64-74, to only 64/66/68, to 64/66, and finally landed on 66 as the correct breaker. If we had gotten lucky earlier, we could have done it in 7 instead. If you had simply started with breaker 1, it would have taken 66 trips to the breaker box to figure out.
Where binary search really excels is with large data sets. Even if it had been 1000 breakers instead of 100, it still would have only taken an extra two or three searches to narrow it down.
Turn off half the breakers. See if you still have power where you need to go. That will tell you which half it’s on. Turn off half of those breakers, repeat.
Binary search only works if the fuses were correctly sorted in the same order as the houses though.
I don’t think that’s true, it’s more of a set problem. If you pull half the fuses, and the thing is still on, then you’ve ruled out that half. Then you pull half the remaining fuses, and if it turns off it was one of the new half you pulled. Then you put another half back in, ect .
Ah, I didn’t think of it that way. That indeed would work.
You know, after posting that comment, I really doubted myself, if it really is binary search, because Wikipedia also tells me it needs to be a sorted array.
But yeah, I think that’s only relevant, if your method of checking whether it’s in one half or the other uses
and
<
. As far as I can tell, so long as you can individually identify the fuses, a.k.a. they’re countable, then you can apply binary search.If when you divide your set in two, you can reliably tell which of the two subsets definitely has what you’re looking for, then it’s binary search.
If he can flick it off then it’s a circuit breaker, not a fuse. Fuses have to be pulled, and it’s a real PITA.
Thanks, I changed it. I wasn’t sure, what the correct English word is…
I would have never guessed that you’re not a native English speaker from your writing. Neat!
A fuse and a circuit breaker perform the same function, but a fuse blows out and has to be replaced, whereas a circuit breaker can just be flipped back on. Fuses haven’t been used in household wiring for a long time now, but they’re still used in cars, and for portable things like Christmas lights.
Not a meme
lol
They don’t pay cops to think. In fact, I don’t think they even pay cops to recover stolen bikes.
If this is Cambridge in the UK, both times I reported a bike theft, they confidently told me that they recover and return most stolen bikes. They absolutely do not recover or return most stolen bikes. Bike theft is so rarely sorted out by the police in Cambridge that nearly no one bothers reporting it as everyone knows their bike is gone forever, even if they parked it in good view of a CCTV camera and the frame was engraved with contact details all over.
No they don’t care. It’s why bike thieves are such assholes, there’s barely any money to be made off it at massive inconvenience for the bike owner but they do it because they know 99% no one comes after them.
i bet a bike thief could steal a bile in front of a cop and the cop would simply look the other way
In america at least cops can’t have an IQ that’s too high or they won’t get the job. They want people smart enough to do the capitalist class’s bidding but dumb enough not to question anything.
The official reason is that if you’re too smart, the menial repetitive nature of most police work will get boring and you’ll quit. The rationale being they didn’t want to invest in training if you aren’t going to stick around.
They actually screen for people who do think, and disqualify them from being police officers.
Cops suck at their job, and they hate it if you explain it to them.
I can’t remember a single time in my 40-years-long life where a cop genuinely helped me in any way,
apart from writing a report (full of errors and spelling mistakes) that my insurance demanded.
And I really don’t believe they “make the streets safer” either.My family was victimized in a home invasion that went “get therapy” badly and the cops in their defense did get us in touch with resources and gave us the report of insurance, but they also all but accused me of being a drug addict because I have scars on my arms and had a bowl in my apartment (weed is legal here). They also refused to look at the cut window screen or the footprint on the other side of the window insisting that because the front door was unlocked after the burglar left through it we must’ve left it unlocked and that’s how he entered.
We didn’t like the cops before we were victims of violent crime, but it’s much more pronounced of a dislike afterwards. I’ve heard my entire life that “when you’re victimized by criminals you’ll come to appreciate the cops” and I can’t help but laugh at that sentiment.
Hell in a different instance I got robbed by a guy, got his license plate, phone number, and confession (buying something off the internet, guy took both things and ran, then later messaged asking for sex), and want to know what I’ve never seen since? That money. Like I’m not happy with the guy, but unlike my home invader I don’t even think he needs to be kept away from society, I just wanted my fucking money back.
Got rear ended on the highway. Recorded make and model, rough driver description, and plate number with state, and direction they were heading. Told dispatcher and cops on scene everything, they couldn’t have given less of a fuck.
“We’ll keep a lookout, but really there’s nothing we can do.”
So why am I paying taxes for you welfare queens then? My insurance hotline was far more helpful at next steps and what needs to happen vs ‘shit sucks bro, here’s your case number, you gotta smash F5 on our website until the report gets uploaded. lol no, we wolnt reach out to you’
Depends on the country. Aussie cops are a lot nicer and more useful than many American cops.
Same here. They show up after you get hurt, not before. They are supposed to make us safer, but we have more cops than any country in the world and we are not safer.
Like the old saying goes, “when seconds matter, the police are only minutes away”, except they’re actually more like an hour and a half away for me.
I sold a trailer to a cop once. It wasn’t related to his police activities but I needed to get rid of it and he didn’t haggle.
are you white
“I have determined by thinking really hard that the victim is responsible for the theft of their possessions. Deny all insurance claims”.
kids stole my car
cops gave chase
they crashed the car
ran on foot
cops gave chase
they ran into an abandoned house
cops stopped outside
they walked nonchalantly out of the house
cops did not arrest as they could not be sure it was the same people
literal skyrim npc behavior.
They were chasing running people, those had to still be in the house. Probably doing laps in one of the rooms.
I was pushing a cart full groceries home when two white guys walked right up and started looking in my shopping cart. Exactly at that moment a cop car pulled up beside us.
That’s all they had to do. It was pretty good timing.
Probably nothing would have happened either way, but still. It also occurs to me that the presence of anyone else would have likely had the same effect. Like a prof rolling up on a unicycle, or someone walking their cat, or even a lone horse. Perhaps even a bold raccoon.
Excellent point, it’s not the presence of a cop that stopped them, it’s the presence of another person.
out in these streets. cops make the streets more dangerous by far
In Montreal, I was riding my bike drunk and crashed pretty badly. I broke a tooth and was bleeding out of my mouth. I got up and kept riding home when a cop stopped me who was sitting next to his car monitoring pedestrian traffic. They took out their first aid kit, gave me some gauze, asked if I needed to go to the ER, then let me be on my way.
I feel like that wouldn’t happen in the US. I was still very drunk.
And Montreal cops don’t have that great a reputation, at least from what I’ve heard.
Only interaction I had with one was when they were handing out pamphlets about hiding your (white) headphone cords on the metro. I guess people were stealing iphones
In many states it’s legal to ride a bicycle while drunk, so they probably would. In my state it counts as a DUI so they might arrest you.
Here’s a PDF of the rules per state:
https://bikeleague.org/sites/default/files/bui_full_chart.pdf
Yeah, it probably would. They would be interested in just how and why you got a bloody face. And even US cops carry basic medical supplies like a band-aid.
US cops aren’t the best, but they can and do help with such things.
In the U.S., cops statistically do nothing. They don’t prevent crime, they don’t solve crimes, they’re just a publically funded security firm for local businesses to contract. It would honestly be more surprising if you had a useful interaction with the police.
Even though this is all colloquially known and accepted, don’t think of arguing to lower the police budget in any way. Gotta make sure those buffoons have their surplus army equipment so they can feel safe while they rob and oppress citizens.
This is an innate skill in the days of the internet for anytime you are looking for just the right moment in a video of any kind. 🤔
Well if you’re looking for a moment witch consequences on the video.
Some sorting algorithms shorten this process by only scanning the last 10%.
Man, as someone who worked surveillance for years, I can’t believe that anyone would have a hard time with this.
It was so, so, so, so easy to find when something vanished.
Now, did so and so walk in the building? Yeah, kiss my ass. Not happening.
I worked at a major outdoors retailer with a “gun library” of high-end firearms.
In one of our quarterly steel audits (where we pull all 10,000 guns put hands on them, verify the serials, etc) we discovered a $10,000 rifle was missing.
The thing is, the case it was in obscured the gun itself from the security cameras. It was behind like 6 other guns in a glass case any customer could item and pull the guns out to look at them (guns themselves were trigger-locked of course).
So we had to have the gun library manager sit there and watch 3 month’s of surveillance video of a specific case that was proclaimed opened 20 times an hour in a highly-trafficked area of the store. Because of all the activity, the video had to be watched in real time, and we were open 13 hours a day.
The manager ended up quitting over the boredom combined with stress.
Did they ever find the gun?
No.
Honestly, if your security system didn’t allow you to set motion alerts, that’s a bad system. Basically any modern system will allow you to set motion alerts. You can specify a section (or sections) of the screen that will create a flag in the footage when motion is detected.
My job’s parking garage had a car get broken into, and a musician’s (very expensive) instrument was stolen. We didn’t have a camera pointed directly at the car that was broken into, but we had cameras at every entrance and exit, and on the ramps leading between each floor. Management was expecting to scrub through literal hours of footage. Using some basic motion detection, I set it to flag any time someone came up or went down the specific ramps or stairs that led to the level the car was on. It ended up being like 45 cars.
Then I just did a quick timer, to see how long each person lingered on the floor. Like 40 of the cars came up the ramp from the lower level, then like 30 seconds later went up the next ramp to the next level. So it wasn’t them. Only like five of the cars actually didn’t go to the next level.
And out of those five cars, four had drivers/passengers seen on the stairwells leading back down to the ground floor; They had parked on the same level as the incident, and went downstairs.
Only one car lingered on the same level for about 2 minutes, then quickly left again. At the exit, there was a camera on the gate which pointed into the cars. We got crystal clear footage of the driver, (someone who the musician knew) and the instrument case was very obviously sitting in the passenger seat.
The entire search (it was like 3 days of footage) took like 10 minutes total, simply by being able to whittle down when people were coming and going.
It was a high-tragfic area of a retail store. Motion alert is useless.
Oh god, yeah I’d be out. I would not do that.
Watching surveillance is truly like watching paint dry. Realtime? Yeah, just shoot me.
The only time I ever struggled was when cash went missing and I had to watch sale for sale. Even then, I could fast forward.
I always went for voids and “nosales” first. Nine times out of ten that’s where I’d find the theft. More clever thieves made my life hell though.
I can’t imagine having someone watch 3 months x 13 hours of real-time security footage is worth the 10k, unless the insurance would pay his salary.
But now I know why stores sometimes have their most expensive stuff just sitting there in full view. It’s not just for the customers’ viewing.
Yeah it’s a sunk cost fallacy. 91 days x 13 hours = 1,183 hours. Even assuming the manager is making $10 an hour they wouldn’t recoup the loss unless they found it early.
Ofc no manager makes $10/hour.
Let’s make some assumptions. just picking a retail place with firearms managers and i see cabela’s listed on glassdoor reporting $53-91k. Let’s go with the low end 53k. Let’s also assume 40 hours per week and the manager is doing no more than 20% unpaid hours, so 2080 salary hours + 208 “good worker” hours = 2288 total hours worked in a year. 53k salary / 2288 hours = $23/hour effective pay rate. That’s even before considering the benefits package
$10,000 item / $23 per hour = ~435 hours of real time footage before it is a guaranteed sunk cost. This means finding it within first ~37% of footage. Meanwhile 435 hours would effectively take the manager off the floor for a quarter of the year.
I didn’t need to do math to tell you that this is a task given to someone to make them quit. Manager did something else and this how the company decided to get rid of them.
There’s a similar logic applied to fault finding, start at the middle of the circuit.
If the fault is before that point, start at the quarter point, if it’s after, three quarters, and keep splitting until you find it.
Not just similar, it’s the exact same thing.
He was never interested in finding the bike, he just wanted to “take notes” and go back to his donuts.
My bike was stolen, and I live in a small enough town that the cops actually did go through the footage to find the thief.
He called back 15 minutes later for more details and mentioned he was 15 minutes into the footage.
It sounds dumb, but if the footage was on tape and not easily seekable, then I can see that happening.
It should still at least have a fast-forward option. You go at the highest speed possible until the bike disappears. Then you rewind at a slower speed until it shows up again. Then you can play the tape from there.
I remember marveling at how simple and obvious binary search was when I first learned about it in programming.
Drag has been in exactly this same situation. Stupid pigs.
Also binary search isn’t a sorting algorithm. It’s a search algorithm. It only works on a data set that has already been sorted.
Could you not say that the data set has already been sorted by time?
Drag is implying that. You could also say that the frames are sorted by bike present and not. Assuming the bike isn’t returned before the end of the tape.
Thank you.
Expecting feral hogs to be capable of reason was a mistake.
Police are so f***ing worthless and useless