Readit News logoReadit News
DannyB2 commented on Parsing Integers in C   daniel.haxx.se/blog/2025/... · Posted by u/8organicbits
piker · a month ago
"I think we in the curl project as well as more or less the entire world has learned through the years that it is usually better to be strict when parsing protocols and data, rather than be lenient and try to accept many things and guess what it otherwise maybe meant."

Found this explicit rejection of the Robustness principle[1] fascinating. It comes after decades of cURL operating in the environment that was an ostensible poster child for the benefits of the principle--i.e., HTML over HTTP.

[1] https://en.wikipedia.org/wiki/Robustness_principle

DannyB2 · a month ago
Being liberal in what you accept is fine, as long as what you accept is precisely documented. But then, is that actually "being liberal"?

Better advice is to not do something unexpected -- even if that unexpected result is clearly documented, but someone did not read it.

DannyB2 commented on Solving Every Sudoku Puzzle (2006)   norvig.com/sudoku.html... · Posted by u/djoldman
johnfn · a month ago
I've seen this article every now and then, and it's always fun to read. Something jumped out at me this time, though:

> As computer security expert Ben Laurie has stated, Sudoku is "a denial of service attack on human intellect". Several people I know (including my wife) were infected by the virus, and I thought maybe this would demonstrate that they didn't need to spend any more time on Sudoku.

Ah, yes... remember the halcyon days of 2006, when something as benign as Sudoku was considered to be a "denial of service attack on human intellect"?

DannyB2 · a month ago
It was a denial of service attack, not in the sense of soaking up my brain cells solving puzzles, but in causing me to devise and program my own solver. (In Java, text console only.) Once I wrote a solver, I felt as if I had solved all puzzles.

Then I got interested in devising puzzles with multiple solutions. Not too difficult. But making a few puzzles with two solutions was fun.

Experiment_203(

   " 1 . . | 2 . 8 | . . 9 "+
   " . 8 . | . . . | . 3 . "+
   " . . 7 | . 1 . | 2 . . "+
   //------+-------+--------
   " 4 . . | 1 2 3 | . . 6 "+
   " . . 2 | 4 5 6 | 9 . . "+
   " 6 . . | 7 8 9 | . . 4 "+
   //------+-------+--------
   " . . 6 | . 4 . | 8 . . "+
   " . 2 . | . . . | . 7 . "+
   " 9 . . | 8 . 2 | . . 1 "
  ),
// Solution #1. Found in 0 days 00:00:00.004.

// 245 boards examined so far.

   1 6 5 | 2 3 8 | 7 4 9
   2 8 4 | 6 9 7 | 1 3 5
   3 9 7 | 5 1 4 | 2 6 8
   ------+-------+------
   4 7 9 | 1 2 3 | 5 8 6
   8 3 2 | 4 5 6 | 9 1 7
   6 5 1 | 7 8 9 | 3 2 4
   ------+-------+------
   7 1 6 | 3 4 5 | 8 9 2
   5 2 8 | 9 6 1 | 4 7 3
   9 4 3 | 8 7 2 | 6 5 1


// Solution #2. Found in 0 days 00:00:00.001.

// 287 boards examined so far.

   1 6 5 | 2 3 8 | 7 4 9
   2 8 4 | 9 6 7 | 1 3 5  // <-- 9 6 7 instead of 6 9 7
   3 9 7 | 5 1 4 | 2 6 8
   ------+-------+------
   4 7 9 | 1 2 3 | 5 8 6
   8 3 2 | 4 5 6 | 9 1 7
   6 5 1 | 7 8 9 | 3 2 4
   ------+-------+------
   7 1 6 | 3 4 5 | 8 9 2
   5 2 8 | 6 9 1 | 4 7 3  // <-- 6 9 1 instead of 9 6 1
   9 4 3 | 8 7 2 | 6 5 1


   2 total solutions found.
   304 total boards examined.
   Total time 0 days 00:00:00.041.
Then I got to looking at difficult puzzles on the web. Apparently AI escargot is the world's most difficult. (And the site http://www.aisudoku.com/index_en.html says I can't publish the board). So I'll only publish the stats of applying my solver to it.

  Solution #1.  Found in 0 days 00:00:00.029.
  3,906 boards examined so far.

  1 total solutions found.
  7,832 total boards examined.
  Total time 0 days 00:00:00.085.

DannyB2 commented on Why aren't smart people happier?   theseedsofscience.pub/p/w... · Posted by u/zdw
DannyB2 · 2 months ago
Ignorance is bliss?
DannyB2 commented on The fastest way to detect a vowel in a string   austinhenley.com/blog/vow... · Posted by u/ingve
DannyB2 · 6 months ago
Assume use of 8 bit characters. Declare a constant 256 entry array pre-filled with all False except for the five (or six) vowel characters. This is baked into the code and not initialized at runtime.

Now for each character c in the input string, simply do an array index and see if it is true (a vowel) or not. This avoids either five conditionals, or a loop over the string 'aeiou'. The vowel test is constant time regardless of the character value.

DannyB2 commented on Show HN: Samchika – A Java Library for Fast, Multithreaded File Processing   github.com/MayankPratap/S... · Posted by u/mprataps
sidcool · 7 months ago
It would be even more amazing if it had tests. It's already pretty good.
DannyB2 · 7 months ago
Should the tests include some 10 GB files?
DannyB2 commented on English Multinyms   people.sc.fsu.edu/~jburka... · Posted by u/myroon5
DannyB2 · 9 months ago
For: call, caul, col

Wot about: cawl ?

DannyB2 · 9 months ago
Peaking Peeking Peking
DannyB2 commented on English Multinyms   people.sc.fsu.edu/~jburka... · Posted by u/myroon5
DannyB2 · 9 months ago
For: call, caul, col

Wot about: cawl ?

DannyB2 · 9 months ago
For this one: cense, cents, scents, sense

Please add: Since

DannyB2 commented on English Multinyms   people.sc.fsu.edu/~jburka... · Posted by u/myroon5
DannyB2 · 9 months ago
For: call, caul, col

Wot about: cawl ?

DannyB2 · 9 months ago
boar, Boer, boor, bore

How about adding: Bohr

DannyB2 commented on English Multinyms   people.sc.fsu.edu/~jburka... · Posted by u/myroon5
DannyB2 · 9 months ago
Another one from my list that is missing is:

Cents Scents Sense Since

DannyB2 · 9 months ago
Data: Captain, the censors have detected incoming copyright infringement notices.

Riker: Shields up!

DannyB2 commented on English Multinyms   people.sc.fsu.edu/~jburka... · Posted by u/myroon5
DannyB2 · 9 months ago
For: call, caul, col

Wot about: cawl ?

DannyB2 · 9 months ago
Kneel Neal Neil

Knight Night Nite

Knot Naught Not

Lager, Lauger (a last name), Logger

Macs Mac's Macks Maks Max

Tends Tens Tins

Threw Through Thru

Ware Wear (clothing), Wear (diminished by use) We're Where

Your You're Yore

u/DannyB2

KarmaCake day2224May 18, 2016
About
If one of the production server's power supply has caught fire, best practice is to schedule a meeting to determine whether DevOps should fix this, or the software team should issue a software patch to correct the problem in order that we can close this ticket as quickly as possible.
View Original