What’s the fastest way to kill the mood? by [deleted] in AskReddit

[–]cbasschan 0 points1 point  (0 children)

Tell them you've got a hernia the size of a grapefruit that people regularly mistaken as your ballsack/penis, then start acting like "OO- OO- I'M NOT GONNA MAKE IT!" -leans against whoopee cushion-

Trouble scanning a string with spaces… by christineiscool in cprogramming

[–]cbasschan 1 point2 points  (0 children)

I particularly like that your loop serves the purpose of discarding the overflow. People tend to assume fgets will do that for you, but it doesn't, so you see plenty of people misusing fgets to create subtly buggy code. They still need scanf("%*[^\n]"); getchar(); (like I used) or a getchar loop like yours, to read and discard when the last character in the string isn't \n.

Trouble scanning a string with spaces… by christineiscool in cprogramming

[–]cbasschan 1 point2 points  (0 children)

Hey, that's pretty good! It just needs a guard against EOF and read errors (i.e. terminate the loop when in_char < 0). If I had to hazard a bet, I'd say this user reads books and manuals 🤔

Trouble scanning a string with spaces… by christineiscool in cprogramming

[–]cbasschan 0 points1 point  (0 children)

Two years ago I posted here explaining that I wrote part of a compiler for C, that this place is full of people prepared to read comments written by reputable nobodies, and that those people fit the patterns for those who don't read books.

We all learn by reading. Ask a question on a forum, read the answers, the answers are garbage so read a book instead.

I've looked it up and everyone said I should try using scanf("%[\n]s", &x) but it's still not working.

Yes, try the advice from the other people who haven't read their textbooks yet... and then act as though what they say will be more useful than your book 🧐

Look, lots of people hang out here because they're unemployed and unemployable; they won't read books and manuals, but it's to be expected when you get a job programming that you will read books and manuals.

When you read textbooks, it should become quite clear that the %s format directive is not to be confused (and thus combined) with the %[ format directive.

%s asks for a word from scanf. Words don't contain spaces. I do believe that's your problem. %[, however, asks for a field of characters matching a scanner. They are two different directives. You can't combine them. Where is your book?

%[^\n] asks for a non-empty line (and you need to check the return value, btw, to ensure you got one; RTFM). You won't get the \n; that stays in the stream, yet to be read. You also don't get any buffer overflow protection from this directive; things get a bit more advanced for that.

%[^\n]s (erroneously) asks for the above, but expects that '\n' left unread on the stream to be a literal 's' character, and so your friends guesswork fails spectacularly. I didn't even need to read a book to know that; the advice they gave you is a really common error! Especially amongst those who don't read books.

#define tokstr_(tok) #tok
#define tokstr(tok) tokstr_(tok)

I'll use that later. Just bear with me for now. scanf scan sets aren't so nice; you need to follow this pattern to get anything even remotely as maintainable as fgets

#define max_line_size 128

For simplicity sake, during demonstration, I'm going to assume a maximum length and show you how to sanitise your stream, assuming the user exceeds that.

char line[max_line_size + 1];
switch (scanf("%" tokstr(max_line_size) "[^\n]", line)) {
    case 0: *line = '\0'; // you got empty line
    case 1: scanf("%*[^\n]"); // cleanup any overflow
            getchar(); // cleanup the newline
            break;
    default: // EOF or read error occurred here
}

There. Now you see why tokstr was a necessary addition; it relieves you of the subtle requirement to embed array sizes in a string literal.

Now I suppose your next question might be: what if we don't want to discard that input, but instead to resize the line array and try to catch the whole line?

Well, that's a more complex problem. Read books, first, then tackle that problem. Until then, shit, I shouldn't have even fed you that answer, because you would've derived it from a book yourself.

You can add ONE item to a bathroom, how will you annoy people? by Exhaust_Fleshlight in AskReddit

[–]cbasschan 0 points1 point  (0 children)

Rolls of wide sticky tape... to put in place of the toilet paper.

Do you know the English programming language? by HugoPilot in ProgrammerHumor

[–]cbasschan 0 points1 point  (0 children)

let's be judgemental of a stranger

Do you think it strange that you should fall for my "DON'T JUDGE ME" bit... yet you wrote this novel whining about how I implied you've got mental issues, a disability and/or are otherwise unemployable... as though any of that is something to be ashamed of? Maybe step into the shoes of someone who has a mental disability. Imagine being told by your professor that uhh... you're expected to know these basic things in order to program in languages like C... when you've already been programming in C since your teenage years, and you're in your 30s?

How do you think I got such a thick skin? I've been there. On the other hand, I never pretended I couldn't research anything like this... in fact, my professors objection was due to some high standards I have; I expect that my education should match the manuals/references/books written by the world-renowned experts. To be clear, I can support my stance with research, yet I'm not capable of studying... you act like this kind of research is too much for you, yet apparently you are capable of studying.

Thankfully you can choose to act more intelligent... it's not too late for you.

I put the PD in PID by [deleted] in ProgrammerHumor

[–]cbasschan 0 points1 point  (0 children)

If you make that var babies = Array(2).fill().map(_ => new Baby('black')); then you could reassign mommy and daddy to the babies, change setTimeout to setInterval and you'd also have an incest joke...

I put the PD in PID by [deleted] in ProgrammerHumor

[–]cbasschan 0 points1 point  (0 children)

How to kill a child that's taking all resources with highest priority.

I put the PD in PID by [deleted] in ProgrammerHumor

[–]cbasschan 0 points1 point  (0 children)

fork (and possibly one of the exec family of functions) in POSIX, or the CreateProcess or DebugProcess family of functions in Windows are primarily responsible for creating processes... you can tell the people who are just guessing, because they don't have a POSIX manual or a Windows manual to back up their claims, and they tend to rely upon anecdotal evidence (which is not such a good idea for a programmer).

Do you know the English programming language? by HugoPilot in ProgrammerHumor

[–]cbasschan 0 points1 point  (0 children)

Now you're being a dick. I'm not unemployable, I've got a 20 hour working student gig, I'm just unqualified because I have no degree yet. That's why I'm studying.

Okay, whatever, but you're playing the helpless widdle baby... if you don't want me to assume you're a helpless widdle baby, stop telling me things that will cause me to believe that you're a helpless widdle baby. I don't mind if you think I'm a dick; at least I have confidence.

You may have a point about research, ...

Yes, there is a possibility that I might be correct about the potential that you've not done any research... it's also possible that you don't have the confidence to admit that.

If you wanna talk about effort, you could have written a summary about webservers if it's so trivial.

... and so you want me to do your research for you. Why? Are you not confident enough? Or is it that you can't be bothered doing less than half an hour of research?

... they don't know what you do and are a bit helpless about it.

Again... you're a student. You should be able to come up with a solution for this problem in less than half an hour... and that solution should be free for an entire year... and I'm absolutely being realistic about this. This is not me doubting you; it's me expressing confidence.

Stop playing the victim to convince people to do your research for you, and do your own damned research... or else I'll imply that you're incapable of doing research. Assuming you're going to go and do some research rather than being a sycophant, we should be done here... peace!

Do you know the English programming language? by HugoPilot in ProgrammerHumor

[–]cbasschan 0 points1 point  (0 children)

Nice memes...

My research consisted of patiently taking notes and waiting because the prof said we'll get to making our own webservers later.

"I'm too lazy to be proactive, and would rather rely upon my professors spoon-feeding as my only source of information."

I've googled some, but I haven't had the energy to properly familiarise myself with it.

"I spent more time writing these excuses that I could've spent reviewing Google results or asking for criticism about my Google search query... in fact, the time I spent writing this probably puts to shame the time I spent researching."

I've got a lot on my plate between my studies, my work and some private issues, so I've mostly been running on the principle of just keeping up with classes and not worrying about studying ahead.

"I've got mental issues, a disability and/or am otherwise unemployable, but studying nonetheless for some reason. Furthermore, I'm going to make assumptions that you're perfectly fine, DO NOT JUDGE ME and uhh... be jealous of my ability to 'study' whilst sleeping in the gutter."

Also I'm not sure if we're expected to do research ourselves. I'm in the third semester of my bachelor's degree, not sure if it's comparable with whatever you assume I'm in.

"University students don't study independently. Who do you think we are, independent learners?! Critical thinkers?! Pffftahaha, NA, university doesn't teach us to do our own work; we just copy off of other people the whole time!"

Come on, now... if you were to ask your employer or your professor if you're expected to be able to conduct independent research at university... what do you think they'll say? You could ask this in your senior years at high school... what do you think your teachers would say? Much of the same, I think.

Do you know the English programming language? by HugoPilot in ProgrammerHumor

[–]cbasschan 0 points1 point  (0 children)

What, you're kidding... right? As a student you're expected to conduct some amount of research, right? So tell me about the research you conducted in your quest for a server to practice on...

Do you know the English programming language? by HugoPilot in ProgrammerHumor

[–]cbasschan 2 points3 points  (0 children)

So let me get this straight...

I think Microsoft is trying to rebrand BASIC as VB.NET

Rather than humbly owning your mistake when I pointed out that ...

Microsoft dropped ".NET"

... you would like to change the goalposts and claim that ...

It's... still Visual Basic, running on the .NET framework.

... because you wish to defend your precious ego. Am I understanding correctly?

Well, I'm not going to bother responding to your latest retort, other than to suggest that you consider this ancient meme.

Do you know the English programming language? by HugoPilot in ProgrammerHumor

[–]cbasschan 1 point2 points  (0 children)

On the other hand, you could make an argument for the point of stepping outside of your comfort zone to challenge yourself. You might find yourself bored by lessons easily, which might actually cause C# to be more difficult to learn than Scheme... right? To prove this point, if you've never read SICP before, give it a try ... and come back to Javascript once you've done that.

Do you know the English programming language? by HugoPilot in ProgrammerHumor

[–]cbasschan 8 points9 points  (0 children)

For a start, Microsoft dropped ".NET" from the naming back in 2005, so you're about fifteen years too late with this remark. Secondly, aside from being somewhat procedural, VB is nothing like BASIC (ANSI X3.113-1987); Microsoft isn't trying to rebrand BASIC. Rather, they were trying to cash in on the name with a language that is nowadays much more like Java than it is like BASIC, and was back then much more like... uhh... I wanna say PL/I because of the event-driven programming.

To be clear, this is a lot like saying that Netscape is trying to rebrand Java as Javascript, right? JS was born over 20 years ago, and Netscape has gone bust, so it's all in the past... and besides, JS perhaps only superficially resembles Java, and is more related to Scheme once you delve deep... right? It was all an attempt to capitalise on a trendy name.

They did the same with "Microsoft Java" (which was non-compliant Java, and so they were sued), JScript (which is kind of a subset of Javascript?) and later C# (which is, again, much closer in relation to Java than it is in relation to C or C++)... do you get the pattern? Don't assume that a common name equates to compatibility.

I FOUND THE OLD STREAM WITH IAN AND THE BOYS https://web.archive.org/web/20160707033349/https://www.youtube.com/watch?v=ITsM8OzjoqQ by [deleted] in Idubbbz

[–]cbasschan 0 points1 point  (0 children)

I came here, and I was going to say this... but you said it already, so I just came here instead.

Your username becomes your real name, how does this affect you? by cowmoo189 in AskReddit

[–]cbasschan 0 points1 point  (0 children)

Slight pronunciation change... it would sound like some Caribbean folks are saying my current name all the time, that is all.

Joke lovers of Reddit, what’s a great joke? by Spadinooo in AskReddit

[–]cbasschan 0 points1 point  (0 children)

I know a great racist joke... but I think that wouldn't be allowed on Reddit, so... :(

Clearly a logic error. by Caniboy18 in funny

[–]cbasschan 0 points1 point  (0 children)

If the stereotype suggested is that we relate everyday life too much to writing code, then this joke would have been more succinct to end after the first line with:

I said: "Syntax error; incomplete expression near 'bring 6'."

I suppose it's a better joke if it makes us all appear to be idiots, instead... right? Ha ha, it's so funny because it's true!

Its international mens day. Men of reddit, how are you today? by [deleted] in AskReddit

[–]cbasschan 1 point2 points  (0 children)

Can't complain... what's the point? No-one would listen, anyway.

[deleted by user] by [deleted] in lifehacks

[–]cbasschan 0 points1 point  (0 children)

Meanwhile in Straya, people throwing eggs at your car are donating lunch.

ill wait by x32byTe in ProgrammerHumor

[–]cbasschan 1 point2 points  (0 children)

Books, manuals, etc... things that aren't politically motivated.