Readit News logoReadit News
Stratoscope commented on Developer's block   underlap.org/developers-b... · Posted by u/todsacerdoti
Martin_Silenus · 3 days ago
Sleep. Best side task for your brain.

How many times has this happened to me?

You struggle with a feature or a bug, you think about it, you weigh the pros and cons for hours... because you don't want to start something that will set you back. You're tired, but you don't want to go to sleep until you've at least made a decision for tomorrow.

Go to sleep. Now.

Then you wake up knowing immediately what to do. You hardly believe it, because it was so hard to find before you sleep. And you do it. And it works. And you know that sleep was the key.

Stratoscope · 2 days ago
I've shared this before, but it seems relevant here:

Several years ago a Facebook recruiter invited me to interview with them. It mostly went well, except I bombed the leetcode algorithm quiz.

The next day, as I expected, they sent me a polite note thanking me for interviewing but they would be moving on with other candidates.

The morning after that, I woke up and before I opened my eyes I saw the complete solution on the back of my eyelids, about 20 lines of code.

I stepped through the code mentally and thought, "Yes! This will work!"

So I ran to my computer and typed the code in to test it. Other than one bug - this was old-school JavaScript and I'd forgotten one var statement, so there was an inadvertent global - it worked perfectly.

Stratoscope commented on The forgotten meaning of "jerk"   languagehat.com/the-forgo... · Posted by u/aspenmayer
andy99 · 6 days ago
I always thought it was the third derivative of position
Stratoscope · 6 days ago
I like to use the example of being a passenger in a car.

• Position is where you are at any moment. If you're not moving, your position doesn't change.

• Velocity is how quickly your position changes. If you are doing 30 MPH on a perfectly straight road with no stops and starts, you may not even notice you're moving until you look out the window.

• Acceleration is how quickly your velocity changes. It's the force that makes you feel like you are being pushed back into your seat, for example when your velocity increases from 30 MPH to 60 MPH.

• Jerk is how quickly the acceleration changes. It's the force that makes your head snap back against the headrest. A good driver will change acceleration slowly to reduce this effect. If there is too much jerk, it may mean that your driver is being a jerk.

Stratoscope commented on Print, a one-line BASIC program   10print.org... · Posted by u/NKosmatos
Stratoscope · 12 days ago
My first summer job was a $2/hour "Night Operator" at Transdata, a Phoenix timesharing company. They shut down their timesharing service at night, so after running a few batch jobs, I had the SDS Sigma 5 all to myself.

We had a few one-card programs, some fun, some useful. A single card held 80 bytes of machine code.

The Sigma 5 had a small speaker on the front panel that you could toggle between two states to move the cone in or out. How often you toggled it determined the pitch of the sound.

One card was called BIRDS. It toggled the speaker to make it sound like several birds chirping at each other.

A more useful one was PRINT. You put it in front of a deck of cards, ran the deck through the card reader, and it would print the deck.

It was a bit slow, because it used a single memory buffer:

  1. Read card 1
  2. Print card 1
  3. Read card 2
  4. Print card 2
  5. Read card 3
  6. Print card 3
  etc.
In other words, at any moment either the card reader or the printer would be operating, not both.

I studied the code and found there were just enough bytes left out of the 80 to implement double buffering by flipping a buffer pointer at each step:

  1. Read card 1 into buffer A
  2. Print card 1 while reading card 2 into buffer B
  3. Print card 2 while reading card 3 into buffer A
  4. Print card 3 while reading card 4 into buffer B
  etc.
Twice as fast!

u/Stratoscope

KarmaCake day24734December 12, 2010
About
Michael Geary: mike@geary.com

LinkedIn: https://www.linkedin.com/in/michaelgeary/

Stack Overflow: https://stackoverflow.com/users/1202830/michael-geary

Photos: https://geary.smugmug.com/ https://www.flickr.com/photos/geary/

One of these days I will figure out which of these sites I like so I can stop paying for two of them!

View Original