The author of this article is hilarious. Here are some choice quotes:
>At one point, we wanted a command that would print a hundred random lines from a dictionary file. I thought about the problem for a few minutes, and, when thinking failed, tried Googling. I made some false starts using what I could gather, and while I did my thing—programming—Ben told GPT-4 what he wanted and got code that ran perfectly.
How the fuck does that take you multiple attempts, require you to Google shit, and then eventually take so long that your incrementally less r-slurred friend has to get ChatGPT to do it?
>when I was in high school I went to the Borders bookstore in the Short Hills mall and bought “Beginning Visual C++,” by Ivor Horton. It ran to twelve hundred pages—my first grimoire. Like many tutorials, it was easy at first and then, suddenly, it wasn't. Medieval students called the moment at which casual learners fail the pons asinorum, or “bridge of asses.” The term was inspired by Proposition 5 of Euclid's Elements I, the first truly difficult idea in the book. Those who crossed the bridge would go on to master geometry; those who didn't would remain dabblers. Section 4.3 of “Beginning Visual C++,” on “Dynamic Memory Allocation,” was my bridge of asses. I did not cross.
Out of curiosity I looked up the table of contents of this book: https://catdir.loc.gov/catdir/toc/ecip063/2005032051.html
Contents
1\. Programming with Visual C++ 2005
2\. Data, Variables, and Calculations
3\. Decisions and Loops
4\. Arrays, Strings, Pointers, and References
Thats right, this guy got filtered right after the chapter that explains if
and for
statements ![:marseylaughpoundfist: :marseylaughpoundfist:](https://i.rdrama.net/e/marseylaughpoundfist.webp)
Theres more r-sluration just after this paragraph as well, where he struggles to write a Hello World program and frames it as an epic intellectual struggle:
>I remember the moment things began to turn. I was on a long-haul flight, and I'd brought along a boxy black laptop and a CD-ROM with the Borland C++ compiler. A compiler translates code you write into code that the machine can run; I had been struggling for days to get this one to work. By convention, every coder's first program does nothing but generate the words “Hello, world.” When I tried to run my version, I just got angry error messages. Whenever I fixed one problem, another cropped up. I had read the “Harry Potter” books and felt as if I were in possession of a broom but had not yet learned the incantation to make it fly. Knowing what might be possible if I did, I kept at it with single-minded devotion.
The rest of the article is equally braindead, it looks like hes a CRUD front end dev or something. He brags about some of his high-octane
"craftsmanship"
here :
>A few months ago, I came home from the office and told my wife about what a great day I'd had wrestling a particularly fun problem. I was working on a program that generated a table, and someone had wanted to add a header that spanned more than one column—something that the custom layout engine we'd written didn't support. The work was urgent: these tables were being used in important documents, wanted by important people.
This really makes the rest of the articles pseudointellectual posturing extra hilarious to me.
This isn't really drama but I thought it was funny, so there ![:marseysunflower: :marseysunflower:](https://i.rdrama.net/e/marseysunflower.webp)
Theres a hackernews discussion but I don't think any of them read the article (or maybe they are all equally
) because almost nobody is pointing out how retarded this article is.
https://news.ycombinator.com/item?id=38257094
Jump in the discussion.
No email address required.
Jump in the discussion.
No email address required.
Isn't this like literally 2 lines in C#?
Jump in the discussion.
No email address required.
Jump in the discussion.
No email address required.
Jump in the discussion.
No email address required.
Selecting random lines with uniform probability requires processing the entire file to know how many entries there are
Jump in the discussion.
No email address required.
You have to read through the whole file, but you don't need to slurp the entire thing into RAM to do it. I think you could read it line by line and keep or drop each individual line according to some random probability.
Jump in the discussion.
No email address required.
How do you choose that probability, given that you don't know the number of lines beforehand? If you choose wrong, you'll significantly favor lines at the start or end of the file, and if it's not fast, you'll be generating random numbers for every single line.
Short of loading the whole file into memory, which for a dictionary is probably fine, you're looking at streaming through the whole file twice, once to count newlines and once to randomly select items.
Jump in the discussion.
No email address required.
You added the requirement of uniform probability, not in the original spec. Are you a product owner?
For most files types, you could probably ballpark the number of lines by looking at the size on disk (especially if you know what the data is) and that would get you close enough.
Jump in the discussion.
No email address required.
This is a p0 business requirement it has to select words properly, our customers rely on only the best. Please do the needful, this will come up during your performance review![:marseymad: :marseymad:](https://i.rdrama.net/e/marseymad.webp)
Jump in the discussion.
No email address required.
More options
Context
More options
Context
More options
Context
More options
Context
https://en.wikipedia.org/wiki/Reservoir_sampling
Jump in the discussion.
No email address required.
More options
Context
strictly speaking you could just keep a list of (offset, length) pairs, randomly select N of them, then seek around the file to read the actual data out. It's technically two reads but as long as the number of lines you're pulling is low it probably won't matter, and worst case you've scanned the file twice (which is likely still in the OS cache).
Jump in the discussion.
No email address required.
More options
Context
More options
Context
More options
Context
pfft
cat words.txt | sort -R | tail -100
Jump in the discussion.
No email address required.
pfft
sort -R words.txt | head -100
Jump in the discussion.
No email address required.
Jump in the discussion.
No email address required.
More options
Context
More options
Context
More options
Context
why would you import in the function
Jump in the discussion.
No email address required.
Because I wrote it in ipython and copied what I did, and I forgot to include it until I already started the def.
Jump in the discussion.
No email address required.
More options
Context
That's not PIP37 compliant.![:marseysoylentgrin: :marseysoylentgrin:](https://i.rdrama.net/e/marseysoylentgrin.webp)
Jump in the discussion.
No email address required.
More options
Context
More options
Context
More options
Context
shuf -n 100 <FILE>
is probably the shortest way, you don't even need to code itJump in the discussion.
No email address required.
Using POSIX compliant programs and/or BASH doesn't count. It MUST be in an approved language like javascript or javascript and it must be the lowest big O notation. We're going forward with other candidates.![:marseydisagree: :marseydisagree:](https://i.rdrama.net/e/marseydisagree.webp)
Jump in the discussion.
No email address required.
The
shuf
command isn't even POSIX though.Jump in the discussion.
No email address required.
More options
Context
BASH programs are real programs.![:marseyindignant: :marseyindignant:](https://i.rdrama.net/e/marseyindignant.webp)
Jump in the discussion.
No email address required.
They are but codecels don't understand. They just compile dey kode in dey IDE, install interpreters and lie.
Jump in the discussion.
No email address required.
Jump in the discussion.
No email address required.
XARGS ISN'T SAFE
You need to use a rewrite in a safe language with input sanitation.
Jump in the discussion.
No email address required.
More options
Context
More options
Context
More options
Context
More options
Context
More options
Context
More options
Context
I'm thinking you could do it in three lines of PowerShell
Follower of Christ
Tech lover, IT Admin, heckin pupper lover and occasionally troll. I hold back feelings or opinions, right or wrong because I dislike conflict.
Jump in the discussion.
No email address required.
More options
Context
It's arguably far more work in old standard C++ but it's still simple.
Jump in the discussion.
No email address required.
More options
Context
Googling how to generate random numbers is impossible
Jump in the discussion.
No email address required.
More options
Context
More options
Context
Please
be respectful Chiobu
thank you ![:marseybottom: :marseybottom:](https://i.rdrama.net/e/marseybottom.webp)
Jump in the discussion.
No email address required.
Jump in the discussion.
No email address required.
what does this mean why does my drink
say duckshit im scared
![:marseysad: :marseysad:](https://i.rdrama.net/e/marseysad.webp)
Jump in the discussion.
No email address required.
because you're drinking duck poop
Jump in the discussion.
No email address required.
They...they shat in my tea? And peed in my coke???
Jump in the discussion.
No email address required.
More options
Context
More options
Context
More options
Context
More options
Context
More options
Context
More options
Context
lol. yikes
Jump in the discussion.
No email address required.
More options
Context
This is who tells you that tech is too white and too male
Jump in the discussion.
No email address required.
More options
Context
Sometimes I get a bit of imposter syndrome and think I'm a shitty programmer, which I probably am, but compared to these fricks I'm doing just fine.
Jump in the discussion.
No email address required.
Same with operations until you see sexy Indian dudes and code bootcamp people spinning up expensive, insecure infrastructure based on what a medium.com post told them. They're all overconfident, though.
Jump in the discussion.
No email address required.
More options
Context
More options
Context
https://pvs-studio.com/en/blog/posts/0952
Nobody has ever debunked the concept of a "Google" programmer.
Jump in the discussion.
No email address required.
More options
Context
I am in DevOps so I can't really comment regarding asking language models for help with programming.
ChatGPT is still quite shit, the only time it or other language models are useful and truthful are when:
THEY'RE WAY TOO AGREEABLE, it's like sometimes they can't say “no, you can't do that with xyz”, and since they're soulless strings of code, they don't have muh human intuition and suggest something else so sometimes they blatantly make shit up. Literally 0 capability to R&D on what's the best tool to do x
Jump in the discussion.
No email address required.
It works pretty well to make boilerplate and explain certain concepts and edge cases. It can help with a lot of "am I r-slurred?" situations, especially when you can look up the term or concept to double check. Smart people use ChatGPT 4 to speed up their work. Dumb people use it as a crutch.
It does like referencing outdated libraries or docs at times....
Jump in the discussion.
No email address required.
More options
Context
I sometimes write code in Python and have ChatGPT translate it to Go for the few times I need to edit a dependency within my company. It's useful but needs to be watched like a diligently stupid intern.
Jump in the discussion.
No email address required.
More options
Context
ChatGPT is pretty great at writing tests with lots of repetitive boilerplate tbh.
Jump in the discussion.
No email address required.
More options
Context
More options
Context
It looks like 4.3 is Pointers where is exactly where people with IQs less than 110 just fail.
Jump in the discussion.
No email address required.
Jump in the discussion.
No email address required.
More options
Context
More options
Context
This makes me unreasonably angry. I have to write well crafted libraries and then the people like this guy at my company suggest brain-dead changes because they can't imagine even the most basic design principles
Jump in the discussion.
No email address required.
Jump in the discussion.
No email address required.
Compared to someone who can't even get some random entries in a dictionary? Yup
I'm not doing anything amazing, it's literally like "do this to hook up diagnostics in a way that will keep DevOps happy"
Jump in the discussion.
No email address required.
Not cutting corners will make DevOps slightly less unhappy.![:marseymad: :marseymad:](https://i.rdrama.net/e/marseymad.webp)
Stop fricking making tickets.![:marseyraging: :marseyraging:](https://i.rdrama.net/e/marseyraging.webp)
Jump in the discussion.
No email address required.
More options
Context
More options
Context
More options
Context
More options
Context
Ma'sha'Allah you are a shining example of how a gay Muslim should approach his life. You are so wise at such a young age and carry a huge burden. May Allah bless you and grant you good in this life and the next. Feel free to PM me if you ever want to talk, I've never had a gay friend before and I feel that it could benefit us both In'sha'Allah.
Snapshots:
https://catdir.loc.gov/catdir/toc/ecip063/2005032051.html:
ghostarchive.org
archive.org
archive.ph (click to archive)
https://news.ycombinator.com/item?id=38257094:
ghostarchive.org
archive.org
archive.ph (click to archive)
Jump in the discussion.
No email address required.
More options
Context
I used gpt4 for some lengthy shell scripts and unless I'm super verbose and specific in what I want and know what the frick variables are this thing is not replacing programmers that actually have to write for projects that isn't grade school level assignments
Jump in the discussion.
No email address required.
More options
Context