There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

programmer_humor

This magazine is from a federated server and may be incomplete. Browse more on the original instance.

Dazawassa , in Not mocking cobol devs but yall are severely underpaid for keeping fintech alive
@Dazawassa@programming.dev avatar

I thought everyone kind of knew this. And then the PCMag article dropped.

frezik , in Programmer tries to explain binary search to the police

I’m a little surprised the police didn’t already know about that method. Seems like they’d encounter enough CCTV footage that’d it’d be standard training.

I once again overestimate the training levels of the police.

rockSlayer ,

They probably do know. They just aren’t meant for protecting your personal property

tiramichu ,

Right.

What they really want to say is “We aren’t interested in investigating your personal theft. Things get stolen all the time and we really can’t be bothered. You are not important to us.”

But they can’t say that, so they instead throw out some excuse that puts the onus back on the other person.

DragonTypeWyvern ,

You dont quite understand.

They aren’t here to protect your property.

Or you, really.

Not unless you have a couple million in assets, then all of a sudden it’s all hands on deck, let’s get this bicycle back.

Vant ,

I’m sorry about your head injury.

Rediphile ,

They can, and do, say that.

Edit: just without the you’re not important to us part.

Cannacheques ,

And Detective Conan Doyle O’Brien really did just let his bro fuck around and watch porn and even bring a stripper into the station during footage reviewing hours. Of course, Stuart was quite shocked to hear he was not invited to the stag do later that weekend

SkepticalButOpenMinded , (edited )

I dunno. “Don’t attribute to malice that which can be sufficiently explained by stupidity.” I can totally believe that the average police officer has not thought this through. “5 hours of footage! We don’t have 5 hours to look for one bike.”

be_excellent_to_each_other ,
@be_excellent_to_each_other@kbin.social avatar

“Don’t attribute to malice that which can be sufficiently explained by stupidity.”

Laticauda ,

I imagine it’s utilized in more “serious” investigations and they just can’t be arsed for theft.

fox ,

For sure they know, it’s just cops are lazy and aren’t paid to solve crimes

BowtiesAreCool ,

It’s a somewhat narrow situation. You won’t always have the object of interest in plain view of a camera. What if it’s behind a door? Well now you do have to scrub through all the footage

roofuskit ,

In the US most their training involves how to be more aggressive veiled as training to be assertive.

nephs , in :q! to quit the Force

ci(

Mubelotix , in Programmer tries to explain binary search to the police
@Mubelotix@jlai.lu avatar

It would have taken 5 minutes at most

Agent641 ,

But thats 5 minutes of killin’ time they’ll never get back

Valmond ,

Yeah, even if it was from the beginning of dawn. No need to check out tape before the guy parked his bike.

heimchen ,

My Graphics card/ssd wouldn’t be able to handle the skipping of such big files

I_am_10_squirrels ,

On my site’s security nvr, it takes five minutes just to convince it that you want to search a particular camera

andioop , in Programmer tries to explain binary search to the police
groucho , in Programmer tries to explain binary search to the police
@groucho@lemmy.sdf.org avatar

The final project in my instrumentation class was to tune a PID controller for a hot/cold mixing valve. I (CS/ENG) was paired up with an engineering student and a lot of it was throwing parameters in, seeing if weird shit happened, and then turning down or up based on the result. I had a programming final and something else I was supposed to be studying for, so I just started doing a binary search with the knobs. We got the thing tuned relatively fast and my partner acted like I was a wizard.

clericc ,

How do you do a binary search for an open-end scale (are PID params open-end?) and three knobs at the same time when they interdepend in their influence? I need to know since i have a PID tuning on my personal projects plate

groucho ,
@groucho@lemmy.sdf.org avatar

It’s been ages, but we’d done rough calculations for the three controls so we roughly knew what we needed. Our teacher was big on manually tuning instead of just using formulas since he thought just running numbers “lacked artfulness.”

So we grabbed a point and started searching around manually. I think we were just tuning the derivative portion at that point, trying to get a fast response without the system without it going chaotic and noisy.

poVoq , in :q! to quit the Force
@poVoq@slrpnk.net avatar

Looks like they are playing Frets On Fire 🤣

andnekon , in Programposting

At least I have a legacy

lemmesay , in Programmer tries to explain binary search to the police
@lemmesay@discuss.tchncs.de avatar

image transcription:

Afterwards I found a chatroom thread among Cambridge computer scientists, one of whom had also been told that unless he could pin down the moment of theft no one would look at the footage. He said he had tried to explain sorting algorithms to police - he was a computer scientist, after all. You don’t watch the whole thing, he said. You use a binary search. You fast forward to halfway, see if the bike is there and, if it is, zoom to three quarters of the way through. But if it wasn’t there at the halfway mark, you rewind to a quarter of the way through. It’s very quick. In fact, he had pointed out, if the CCTV footage stretched back to the dawn of humanity it would probably have only taken an hour to find the moment of theft. This argument didn’t go down well.

lingh0e , in Programmer tries to explain binary search to the police

A police officer being unable to think in such a fashion is exactly why no one could solve the see-saw riddle on Brooklyn 99.

skydivekingair ,

For those looking for the handout:

person: A B C D E F G H I J K L

round 1: L L L L R R R R — — — -

round 2: L L R R R — — — L R L -

round 3: L R R — — L R — L L — R

drislands , (edited )

This would be easier to parse with a monospaced font. I’m not sure how that works in lemmy so this might take an edit or two…


<span style="color:#323232;">
</span><span style="color:#323232;">round 1: L L L L R R R R — — — -
</span><span style="color:#323232;">
</span><span style="color:#323232;">round 2: L L R R R — — — L R L -
</span><span style="color:#323232;">
</span><span style="color:#323232;">round 3: L R R — — L R — L L — R```
</span>
skydivekingair ,

Cool, thanks. I’m not the best at formatting when using my phone.

Mr_Dr_Oink ,

Oh i get it. So if in round 1 it tilted down on the right. Round 2 it was even then round 3 it tilted down on the right then it was person G and they are heavier. However if it was reversed and tilted on the left then even then left then it was still person G but they are lighter. Because that pattern only occurs once. This is brilliant. Thankyou to you and the person you corrected the formatting of.

Mr_Dr_Oink ,

How do you solve that? I saw a solution in the comments where it says to start with numbering all the people and butting 1234 and 5678 on the see saw, then it says if they weight the same then continue and that seems to work. But if they dont weigh the same it doesnt work and it doesnt say what to do in that case.

NotSoCoolWhip ,

If 1234 and 5678 don’t weigh the same youd need 4 seesaws in some cases

adrian783 ,

you can do it like you weight 6v6 then 3v3 then for the last weighing you weight the 2 out of 3.

or you weigh 4v4 to find out which grouping of 4 the light weight person is in, then do 2v2 and 1v1.

ChairmanMeow ,
@ChairmanMeow@programming.dev avatar

You don’t know if the person is lighter or heavier yet.

Sagifurius ,

That’s not the question. Either the scales balance, and the third is heavier or lighter, or the scales don’t balance and you get both answers, but the question is purposely framed this way

ChairmanMeow ,
@ChairmanMeow@programming.dev avatar

I mean that not knowing it is part of the question, and the proposed solution doesn’t work without knowing if the person is heavier or lighter.

If you know if the person is heavier or lighter, the question becomes trivial.

Sagifurius ,

The question is to figure out who is different, not how they are different. That takes one more step, half the time.

Mr_Dr_Oink ,

The question was to find who doesnt weigh the same and if its heavier or lighter. Watch the clip again.

Sagifurius ,

That’s easy enough to answer, but he really should work on his grammar. In that case you just do 3 groups of three, weigh two of them. If they’re even, the third group is different. Weigh 2 membres of the third group, they’ll either be even or one heavier. Weight the last member against the heavier one from step 2 to see if they’re even or not for your answer.

Mr_Dr_Oink ,

Thats 4 uses of the seesaw. It has to be 3.

Sagifurius ,

That three dude

Mr_Dr_Oink ,

Im sorry when i read weigh two of them i counted it as two separate weighings of two sets of groups. My bad.

What about the 4th group? There are 12 people

Sagifurius ,

Well I meant to write 3 groups of four. Same general thought just adjust the logic somewhat

Mr_Dr_Oink ,

I’ve had a look into it, and it doesn’t work if you try to do it mathmatically. You always need more than 3 gos on the seesaw.

There is a solution in the replies to my original comment that is the actual solution, and it works every time and is much simpler than any grouping method.

It involves assigning a letter to each person and then aligning that with a grid of positions “left” or “right” or “none” on the seesaw. Over the three rounds. So, person A is on the right all three rounds person b is on the right for 2 rounds then on the left for the 3rd round.

You end up with a list of 12 patterns that do not repeat or mirror any other pattern like “LLL” “LLR” “LRR” “LR-” etc. Then you do all three rounds and compare the position the seesaw was in with those patterns.

If the seesaw was down on the left 2 times the down on the right the third time then you look for which person had that pattern in this case it was person B. So they are the one with a different weight and they were heavier.

Equally, if the opposite pattern occurred. It was down on the right 2 times, then down on the left for round, then that is the opposite pattern of person B and does not occur anywhere else, so it was person B, and they were lighter.


<span style="color:#323232;">person:  A B C D E F G H I J K L
</span><span style="color:#323232;">
</span><span style="color:#323232;">round 1: L L L L R R R R — — — -
</span><span style="color:#323232;">
</span><span style="color:#323232;">round 2: L L R R R — — — L R L -
</span><span style="color:#323232;">
</span><span style="color:#323232;">round 3: L R R — — L R — L L — R
</span>
ChairmanMeow ,
@ChairmanMeow@programming.dev avatar

Yes, I’m aware. But with 12 people you can’t simply divvy the groups in threes constantly, because if you weigh and the groups are unequal, then you don’t know in which group the different person is (yet). E.g., weighing ABCD - EFGH can tell you the different person is in IJKL if the groups are even, but if they’re uneven you don’t know in which of the other two groups the different person is.

RoyaltyInTraining ,
@RoyaltyInTraining@lemmy.world avatar

Where is the piped bot when you need it

Venat0r ,

You can just replace the domain of the url with piped.video:

Piped.video/Mgqqzt6Iah4

TheBlue22 , in Programmer tries to explain binary search to the police

Police try to understand anything challenge (100% impossible) (gone sexual) (gone violent)

TerrificTadpole ,

We just give all the tools to solve crimes to people who have no idea how to use them, no biggie.

Madison420 ,

*have a perverse incentive to not know how to use them or to know things about their job generally.

zbyte64 ,
@zbyte64@lemmy.blahaj.zone avatar

Sat on jury duty. We literally said not guilty because the officer was supposed to follow a process for line ups and they didn’t even do the bare minimum. They were like we got out guy

doctorcrimson , (edited )

I once had a friend who was robbed of all kinds of stuff including a PS3, and that the guy was signed into his Netflix changing account profiles the very same day. I told him he can just get a tracking number by calling Playstation and that the active police officer can use it to track them. Thing is, the officer ghosted him for like 8 months despite having everything they needed to immediately find the exact location of the perpetrator actively using the stolen property.

Cihta ,
@Cihta@lemmy.world avatar

They don’t care really. As has been my experience anyway.

I once had my car window smashed, a mix of gear taken…some was expensive, some was personal to me. I felt violated. Called the police, explained, gave S/Ns to what I could, told them exactly who did it. He didn’t give a shit. Actually made me feel like I was wasting his time. I think Seinfeld covered this…

“We’ll let you know if we find anything” “Do you ever find anything?” “No”

But oh, my reg is out of date and the plate scanner picked it up? Boom, they really kick it into gear. So that’s $130… i could just go take care of the tags immediately with a friendly warning but now don’t even want to. And in the end I end up pretty fucked.

If only they put that effort into other things I just might have gotten my linear power amps back. Props to anyone who knows that product.

Pazuzu , (edited ) in Programmer tries to explain binary search to the police

I thought this had to be hyperbole, so I did the math myself. I’m assuming human history is 200,000 years as google says, and we want to narrow this down to the second the bike disappeared. also that the bike instantly vanished so there’s no partially existing bike.

each operation divides the time left in half, so to get from 200k years (6.311×10^12 seconds) to 1 would take ~42.58 divisions, call it 43. even if we take a minute on average to seek and decide whether the bike is there or not it would still be less than an hour of manual sorting

hell, at 60fps it would only take another 6 divisions to narrow it down to a single frame, still under an hour

edit: to use the entire hour we’d need a couple more universes worth of video time to sort through, 36.5 billion years worth to be exact. or a measly 609 million years if we need to find that single frame at 60fps

Moneo ,

Lemmy learns exponential math.

Mostly joking, thanks for doing the math.

MagnoliaMayhem ,

Just watch at 3X!

rckclmbr ,

I regularly bisect commits in the range of 200k (on the low end) for finding causes of bugs. It takes me minutes. Pretty crazy

psud ,

History is about 10k years, the 200k years is mostly pre-history. People didn’t write stuff down until they invented agriculture and needed to track trade between owners, workers, etc

PointAndClique , (edited )
@PointAndClique@hexbear.net avatar

True and interesting to note. OOP says ‘dawn of humanity’ though, not recorded history, so taking 200k as ‘human history’ is also valid.

psud ,

Yeah, I’m used to the narrower meaning of “history”, meaning recorded. I like that definition as it lets you differentiate between it and prehistory.

PointAndClique ,
@PointAndClique@hexbear.net avatar

Definitely a useful distinction.

sukhmel ,

Well, in this case it must have been recorded on video, so could as well start recording before inventing the writing

stockRot ,

Ever heard of a logarithm? If you haven’t, you just reinvented it.

Also, your math is wrong: log base 2 of 200,000 is ~18

CoderKat ,

You did 200k years. You need to do 200k years as seconds (the 6.311e12 they mentioned). Their math is right.

Not sure why you’re acting like they claimed to invent the logarithm, either…

Syldon ,
@Syldon@feddit.uk avatar

A minute to decide if there is a bike in the picture really ?

Pazuzu ,

Takes time to precisely seek to each timestamp, but really I just meant that an hour was reasonable even with a lazy cop doing the search

Deuces ,

As a robot, finding bikes in pictures is really hard, okay

sukhmel ,

They must be really bad at solving CAPTCHA

rekabis ,

Combine AI image/visual-pattern recognition and quantum computing, and this search could be completed before it was even started.

madcaesar ,

We can go deeper!

MsPenguinette , in emacs

My serial killer trait is that I use vi instead of vim cause I’m too lazy to type the extra character. Tho if for some reason, vi tab completed to vim, I’d probably use vim

LinuxSBC ,

Alias?

ekky43 ,

Aliases are just bloat! You can do just fine without them. Heck, why not remove the ASCII conversion and read everything in hex or binary?

It’s all about SPEED and efficiency here!

MsPenguinette ,

I’m in DevOps so I’m in a lot of effemerial systems so in practice, I will run into systems where profile hasn’t been set up. Tho I do like the idea of making sure all systems properly have that aliased cause it’d be serial killer vibes to spend hours of time to make sure that I can save a keystroke.

Tho it’d never make it through PR. Also, wild require explaining to my coworkers that I do this

Spider89 ,

I use nano.

Nano >> vi/vim, emacs

mosiacmango ,

4 letters < 2 letters.

vi forever.

Spider89 ,

Simplicity > Complexity

Prunebutt ,

Not if you need any work done.

BeigeAgenda ,
@BeigeAgenda@lemmy.ca avatar

That’s when you switch to a IDE.

Prunebutt ,

Neovim and emacs are IDEs.

BeigeAgenda ,
@BeigeAgenda@lemmy.ca avatar

Yes, if you can remember the shortcuts…

M-x IDE

netchami ,

You can customize all the shortcuts and create custom ones. I’d recommend utilizing the leader key concept, and centering your keybindings around that. For text editing, just use evil-mode, once you build up muscle memory with those Vim bindings it’s just awesome.

netchami ,

By default they are not, but you can turn them into IDEs. In fact, you can turn them into better IDEs than stuff like IntelliJ or Visual Studio will ever be.

BeigeAgenda ,
@BeigeAgenda@lemmy.ca avatar

Nano is the best when you just need an editor, you can as well use an IDE instead of vi(m) or Emacs.

brodoshmodo ,

Ok but why use nano when micro literally exists

donnachaidh ,

alias v=vim. There, just saved you two keystrokes.

MsPenguinette ,

{vi} = 2 {vim} = 3 {v=vim} = 5

I’d need to run vi at least 5 times to have a net gain in saving keystrokes. I’m typically in effemerial systems created by the users of our env, so rarely am I going to gain those strokes back

But also, why am I trying to apply logic to this? I’ll often cat a file before editing it. This shit is just illogical idiosyncrasies I’ve picked up over the years. I’m probably creating posthoc justifications for insane things I do cause it’s hard to override muscle memory

emptiestplace ,

effemerial is new to me

MsPenguinette ,

Here’s a link I found that might be good if you are interested in more:

cloudnativenow.com/…/ephemeral-idempotent-and-imm…

…medium.com/persistent-and-ephemeral-infrastructu…

There are different levels of effemeriality. The simplest example I use daily would be an autoscaling group in AWS. Especially if you use Spot Instances to save money, thi gs may scale in and out whenever.

So if a development team creates a new autoscaling group and I need to get into an instance to test something, unless I add stuff to their IaC, I’m stuck with their configuration. I need to assume that every time I ssh into one of those instances, it’s a brand new instance. But it’d be a big challenge for me to go to their repo and make a PR to alias a command whenever an instance in that resource is created

Stuff can be even more temporary if it’s something like an ECS task which creates a container with a read only filesystem only when a task is needed to be done. But I don’t want to get too deep in the weeds (or deeper than I already have)

terraform workspace will at least stick around for a while so you might be in and out of the same system multiple times.

Chunk ,

He’s commenting on your misspelling. www.merriam-webster.com/dictionary/ephemeral

MsPenguinette ,

Shit… I’m an idiot

Chunk ,

Nah it’s fine

netchami ,

Vi is totally fine to quickly make small changes to e.g. a config file on a server. I wouldn’t like to program in vi though.

MsPenguinette ,

I do most of my programming in vscode but when I need a cli editor, I use vi

puppy ,

You are missing out! I used to only use vim to edit config files. So I knew my way around (albeit, slowly). I installed the IdeaVim plugin a week ago and learned some new key bindings I wasn’t using. A week in I’m almost faster than before! And it’s only going to get better after I’ve acquired muscle memory (I’m nearly there.) and move on to complex key bindings/sequences. Then it will probably be as if the cursor is directly connected to my mind. I’m hopeful because I’ve seen a mentor of mine do it.

netchami ,

What am I missing out on? I use vi to change values in files on servers. What would you use for that task? Most of my other text-based work like writing Emails, taking notes or programming happens in Emacs.

puppy ,

I don’t think you understood what I said. I started using vim key bindings ALSO in my IDE and my speed improved because of it. I didn’t ask you to stop using vi. I merely suggested that you used MORE of it. If your Emacs setup already use vim keybindings that’s exactly what I’m doing too.

netchami ,

Oh thanks, now I got it. I agree, vi/vim bindings are awesome. I use them everywhere, in Emacs, in my shell, my browser, and in my tiling window manager. When I said, that I wouldn’t want to program in vi, I didn’t mean that because of the keybindings, I meant that because vi just lacks many useful features for programming and you can’t add plugins to it. I have programmed in Neovim for over a year though. Just switched to Emacs, because it has even more features, possibilities and customizability. I will never drop Vim keybindings though.

puppy ,

Awesome! How did you get them in the shell and browser? Now I am also curious.

netchami ,

I use the fish shell. In fish, you can just add fish_vi_key_bindings to your config file and now Vi bindings will be automatically enabled when you start fish. For bash, it’s set -o vi and for zsh it’s bindkey -v. For the browser, you can install plugins like Vimium (Vimium-FF for Firefox) or Tridactyl. I find these to be incredibly useful, I love navigating around websites with j and k or d and u, jumping up with gg and down with G, searching with /, closing tabs with x, reloading websites with r, opening new tabs with t, going back and forward with H and L, etc.

FiskFisk33 ,

vi, not vim.

expr ,

Most all distros alias vi to vim already, so it makes no difference.

MsPenguinette ,

I’ll have to check tomarrow if RHEL and UBI do this.

Did some quick googling and looks like cent has that alias by default but doesn’t do it when root. Which would explain why I do get inconsistent results with vi. I never thought about it in detail besides just knowing that there are some visual changes. Thanks for the info, I’ll be noticing this now that I know!

Chunk ,

You use vi because you are lazy.

I used vi because I am too stupid to close it.

We are not the same.

rekabis , in Programmer tries to explain binary search to the police

“This argument didn’t go down well.”

🤣🤣🤣 LMAO

What an awesome punchline, should have been on its own line for more impact.

rgb3x3 , in Programmer tries to explain binary search to the police

I’m realizing now that this would have been super useful when I worked in Loss Prevention way back when. Wish I had known…

pressanykeynow ,

You can now go back working there with this new secret technique.

coloredgrayscale ,

Even without algorithm knowledge it should be fairly obvious that you can just fast forward several minutes and check if the item has gone missing.

Not the most efficient solution, but beats watching the entire tape in real time.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • [email protected]
  • random
  • lifeLocal
  • goranko
  • All magazines