Programming

# set client body size to 2M #
client_max_body_size 2M;

Totally necessary comment bro!

2 Likes

I’ve had great luck with udemy but I’m not 100% sure they’re the best at learning to code from scratch (not saying they aren’t, just that I don’t know).

If you start to get into Javascript I highly recommend watching this guy’s body of work from start to at least until he starts getting into weird stuff:

Well at least once you’re ready for somewhat advanced concepts.

1 Like

I’m working through Python Crash Course because it has some actual programs that you will work towards that seem non-trivial. I have a background in programming that’s going on 20 years old so I’m skimming a lot of the “beware off by 1 errors” stuff but it doesn’t seem too bad. I have a project I’d like to get to but primarily this is so I can take reading notes with my fountain pens.

Very under-rated, fountain pens, you should check them out.

1 Like

I realize this might be a bit advanced for most of you scrubs, but my daughter made a memory matching game for her high school CS class, if anyone wants to check it out and give feedback. It took some convincing to get her to back off the difficulty levels (I think at first you had Easy difficulty gave you 25 seconds to clear the board). She doesn’t understand Microsoft owes its fortune to making solitaire beatable.

She’s more proud than she wants to let on that she wrote all the code rather than copy/pasting snippets.

1 Like

That’s awesome! Good for her. I also love the self-awareness here:

//i hate this section
onEvent("image1back", "click", function(){
  showElement("image1");
  compare("image1");});
//[repeated 15 more times]

Consider:

const MAX_CARDS = 16;
function setCardCallback (n) {
  onEvent(`image${n}back`, "click", function() {
    showElement(`image${n}`);
    compare(`image${n}`);
  });
}
for (let i = 1; i <= MAX_CARDS; i++) {
  setCardCallback(n);
}
2 Likes

My framework mandates a pencil

2 Likes

That’s great. Reminds me of when I was a first semester programming student and we were accidentally given a homework problem that required loops before we were taught them, I didnt know what a loop was so i wrote this nasty concoction of if/else’s and gotos to solve the problem. Was like 400 lines and i think the loop solution was about 6 lines.

That’s awesome. I honestly went through that for something I could pick out and show her a possibly better approach. Other than Bobman’s example, everything else looks very solid, especially for someone just learning to code. Clear logic, good flow to it, very clear what each function is doing.

I liked that she used a while loop even though it might not have been totally necessary there - because it shows she’s thinking about how to use the different tools. That visual editor is really cool.

Feel free to paste any more stuff or PM me for any code critique or whatever any time.

1 Like

Nice, I’ve seen versions of those games where they made them more difficult by moving the matching pairs farther apart, in addition to reducing the amount of time available. You might mention that to her.

1 Like

She’s stoked, and sharing with her friends what my “programming politics nerd friends” are saying about her code.

1 Like

Tried to open a high interest savings account on line today and the phone number they use for the verification isn’t the phone number you signed up with, it’s some phone number they pull out of Experian or some other database they think is yours. I didn’t even recognize this number, found it in some old records and it looks like a cell number that is at least 8 years old since that is how long I’ve had my current cell number. Trying to straighten it out on the phone and their solution was to send a text to a number that wasn’t me only phone number and then wait 60 days before I could fund the account. Actually it could have been and then I’d have 60 days to fund the account, he sound a bit like Krupke from Big Bang Theory. Needless to say I don’t have a high interest savings account.

Who thought it would be a good idea to grab a random phone number from your past to use for validation?

intern: help -no-verify isn’t working
me: use dash dash no verify
intern: help --no--verify isn’t working
me: :expressionless::expressionless::expressionless:

I mean they don’t teach googling in college?

teacher: Here’s google

student: So, what do I need you for?

teacher: image

I’ve worked with interns before and this reluctance to google always confused me. It’s almost like they think it’s cheating or not allowed.

If I was an intern I’d be googling everything so my tech lead wouldn’t think I’m an idiot/bothering them all the time but what do I know

1 Like

Both of our student interns seem pretty unmotivated. Not sure if they’re interested but we hire student interns all the time. Not these guys though.

If you can’t code-by-google you can’t code.

I learnt a thing in Java today, instead of this:

Thing t = someShitWeDontControl.getAPossiblyNullThing();
if(t != null) {
stuff
}

you can have the (I tthink a little more elegant):

Optional.ofNullable(someShitWeDontControl.getAPossiblyNullThing()).ifPresent(t → {
stuff
});

These are the small wins we take when we spend our days writing fucking Java.

Why does elegant always mean “harder to figure out”?

In java, if(null) doesn’t evaluate to false?

The c way to write it would be if(!possibleNullThing) {
Stuff
}