To implement shuffle play, it is not necessary to actually shuffle filenames in memory. Just generate a random number modulo the number of files, and then play that file. That way your program can shuffle play any number of files, no worries about running out of memory.
By the way, the Roku box has a "media player" app in it by default, and it cannot shuffle play more than a handful of files. Completely useless.
BTW, Windows Media Player is the winner, as it "just works". Just point it at the root directory of the music files, turn on shuffle play, and it works, and doesn't crash.
That's random play, not shuffle play. Random play can repeat songs before all songs are played. Shuffle play will play all songs exactly once before any repeats occur. Random play "puts the card back into the deck" before dealing the next one.
You are correct, and that matters if it is a small number of music files. If it is a large number of files, the difference in user experience is irrelevant. But not needing to remember what was already played keeps the player memory footprint small.
Except "small" is very large because this runs face first into the birthday problem so the average distance between duplicates grows to the square root of the number of files.
Hell even actual shuffling is not necessarily enough to "feel" right for human psyche, famously despite the ipod doing actual shuffling[0] users complained because tracks of the same artist / album could still cluster over shuffling an entire library, so they implemented "smart shuffle" to skew the shuffle and break up clusters. An other option is to weight the random pick by how far back a track was last played, or how little it's been played overall. This has the advantage of favouring less played tracks across listening sessions.
[0] and frankly if the ipod was able to do actual shuffling back in 2005 the memory footprint is just a lazy excuse
To get into Marine boot camp, there's a minimum strength test.
To get into college, there's the SAT test with a minimum score.
To get a high paying software job, there's the leetcode test.
These are gates meant to filter out the obviously unqualified candidates. Unqualified candidates waste the time of the candidate and the company. The real interview comes after that.
I think the complaint is that the test has nothing to do with the job.
It's like "to get into Marine boot camp, there's a minimum crochet requirement".
Solving leetcode problems has nothing to do with commercial coding. It's an unrelated hoop that we make folks jump through, because it's easy to measure. It's like measuring developer productivity by LoC written.
Yes, it'll measure how much time the candidate spent preparing for the interview, and how well they can jump through hoops. But it'll also deter the actual people you want in the team, the folks who know that leetcode has nothing to do with commercial coding, and see the leetcode test as a sign that your organisation has no clue and a bad management culture.
I heard similar arguments about the SAT as a college entrance requirement. Lots of universities dropped it, including MIT. They found out that SAT scores really did correlate strongly with success at the university, and reinstituted the requirement.
It also reminds me of the "EE"s who carry around a card in their wallet with:
V = IR
I = V/R
R = V/I
written on it.
> But it'll also deter the actual people you want in the team
All the FAANG companies do leetcode testing, so you can write off the high paying jobs.
A friend of mine wanted a job at a FAANG company. He knew there'd be first a leetcode interview, and complained that he'd have to spend 3 weeks studying for it. I said those three weeks would be the best investment he'd ever make.
So he did the three weeks, passed the leetcode, passed the interviews, and now makes 400k.
When I was 10 or 11, I asked my dad what MIT was looking for in a student application. He (an MIT alum) told me. I picked out the things I could do (being captain of the football team was never going to work for me), applied to MIT, and got rejected. But Caltech, Dartmouth and Johns Hopkins did admit me.
I'll never understand why proponents of the "grindset" mentality get into automation. If you want to grind for that kind of money just go into sales, it's way easier and they give you an office with a door.
I wholeheartedly agree with this, and I always thought leetcode questions and tech interviewing in general was broken, but as a filter for unqualified candidates, they were pretty effective. Which really matters when you have hundreds of candidates to sift through.
The biggest problem, of course, is that they also filtered qualified candidates (I personally got filtered out multiple times and I'd like to believe I was qualified!) But it is an understandable compromise whenever there is an extreme asymmetry in the volume of candidates and volume of interviewers, and the fix for that is simple: you study for the test (as you pointed out.)
Note also that as grandparent comment indicates, this test is a necessary but not sufficient condition; it's just to get your foot in the door for a deeper evaluation.
If you're willing to go to any college at all, I think you'll find one that will take you, no matter the score.
If my Googling is correct, you will have chances to retake the strength test. Even if they only give you one try, you know exactly what is tested and can train to the point of near-certainty that you will pass, if your body is capable of it at all. (By contrast, leetcode doesn't care if you could learn a problem, it fails you for not figuring it out on a particular day with a particular interviewer.)
The best jobs can set an arbitrary high bar that loosely correlates with what they want, but it doesn't mean anyone who fails is unqualified to have any software job.
And if the test is dancing in a monkey outfit while the examiner throws bananas at you like in Zoolander, it's just "fair game", right?
People don't like Leetcode because it's insulting to treat them like freshmen that know nothing but algorithms that relate poorly to the job at hand; can't judge them on coding prowesses, for most of them, indeed.
> People don't like Leetcode because it's insulting to treat them like freshmen that know nothing
I have a friend who is a tech recruiter. There are an awful lot of frauds trying to land programming jobs. Hiring a fraud can cost a company a great deal of money. It shouldn't be any more insulting than applying for an accounting job and the employer does a routine background check to ensure that the candidate is not an embezzler, and not a drug addict.
I worked for a company that hired a coke addict. What a financial disaster that turned out to be.
If the bar is as low as complete fraud, the hiring company could save 30+ minutes of engineer time & pay by having HR first verify an accredited degree or work experience. Then do a leetcode as next round if you want.
Having a history of embezzlement or fraud is not in the same ballpark as struggling to whip up a DSA solution. One is a crime and one is a competence issue at best.
> by having HR first verify an accredited degree or work experience
Too many frauds have managed to get degrees. I've worked with many of them. Degree'd engineers who cannot use a calculator, who cannot do basic geometry, etc.
I used to go to stackoverflow to resolve issues with git. The trouble was, I'd get 15 answers, all different, all saying "this might work", "try this", "try that".
Now I just ask google, and I get a straightforward "do this", and it works.
That's largely because the OP couldn't clearly describe a specific situation to ask about (the question underlying the problem, but also a clearly recognizable, reproducible example); and solving your problem might depend on things that are different in your setup vs. the OP's.
That's the thing, though. Stack Overflow is not and never was intended to solve your problem, nor to solve the OP's problem. It was intended to answer questions. It was your responsibility, both as someone posting a question and as someone reading the Q&A later, to adapt knowledge to your circumstances. That's why they're called questions and answers, and are not called problems and solutions.
People who use a web site to get a solution to a problem are looking for a help desk, or a forum. Stack Overflow was specifically created to be not that, and that choice was specifically motivated by the frustration people had with trying to search those kinds of sites for information, and the frustration that experts had with trying to help people (for free) in that kind of environment.
The Jungle is famously about horrifying working conditions back in the day and was critical for gaining public support for legislation and regulations. "Capitalism" didn't improve the working conditions; regulations did.
Fire codes have been very beneficial, but they don't move the needle on overall life expectancy. Nor have historical communist societies shown any particular interest in workplace safety.
Besides, free markets do not allow imprisoning workers in a factory (or anywhere else).
There’s a pretty active ecosystem of ESP32 projects for HVAC systems. I’ve been working on a few that add Apple Home and Matter support with a local web interface for basic and advanced features. The web interface exposes things Apple Home or Matter protocols don’t represent well. Vane positions, different modes (dry, fan only), equipment diagnostics, remote sensor control, and even peer to peer communication for fully offline control (no WiFi needed). Plus it gets me a control path independent of the home automation stack. There’s a lot you can put on the device itself these days.
With another project, based on the ESP32-S3, I was able to cram grafana style scrubbable charts, full activity log, refrigerant circuit diagram, equipment topology, etc. I'm pretty excited for the ESP32-S31 since it's a nice jump up in performance.
Shelly switches are great for this. For example, I have one behind a regular wall light switch for the front porch. The physical wall switch always toggles, but the local on-device script turns it on (if it’s not on) at sunset, and off (if it’s on) at 10:30pm. All configurable from the local web server. Only needs ntp (your choice) in case of restart after power failure.
Local web interfaces are great, yes. And it's pretty cool for me when devices have them. But they don't meet the no network requirement for people around me. Gotta have direct control of things. I mean, the landscaper isn't going to connect and use a web browser to adjust the sprinklers.
1. shuffle play does not work
2. crashes if there are more than N songs
3. does not find songs in subdirectories
All of these are trivial to fix. I do not understand the programmers who make the firmware.
reply