TIL (about the Dark Arts of HTML)
-
@boomzilla said in TIL (about the Dark Arts of HTML):
this is markdown, sir.
So it includes HTML as a subset?
-
@dkf correct.
I will give +1 points for 2009 Jeff correctly dunking on 2009 PHP devs thinking this is the first, best solution for anything, but minus several million for thinking he is somehow better than those he mocks.
-
@boomzilla said in TIL (about the Dark Arts of HTML):
@Tsaukpaetra said in TIL (about the Dark Arts of HTML):
I once restored a good at Hipchat instance from backup.
@Tsaukpaetra said in TIL (about the Dark Arts of HTML):
I'm surprised grammar guy hasn't said anything yet....
Phone didn't want to spell gigabyte for nothing so I left it.
-
-
-
TIL that the use of fireworks to celebrate Independence Day predates actual independence:
https://youtu.be/R6Ev9m7Qx8I?t=331The topic of the video is that both Thomas Jefferson and John Adams died July 4, 1826, 50 years to the day after the Declaration of Independence.
-
Status: TIR hostnames (and I guess Windows computer names) can't start with a number.
Luckily it wasn't me who was discovering this issue.
Unluckily it took them three days before reaching out about it.
-
TIL that the Curiosity Rover calculated the best focus position for one of its cameras by taking an image, converting the image into a JPEG, and measuring the size of the resulting file. The bigger the JPEG file, the better the focus of the camera.
-
@JBert said in TIL (about the Dark Arts of HTML):
TIL about "the most silent album ever recorded":
EDIT: And for the John Cage fans, the likeness to one of his famous works has been noted in the 'Reception' section.
Ooh, that takes me back. Wrote about it on my music biz blog back in the day.
It was a neat
conexploit until the matter blew up and Spotify put the kibosh on the whole thing. However, the thing that stands out the most in my mind is how... tasty... the name Vulfpeck is.
-
@Placeholder this is also a way to detect some types of steganographed exfiltration.
-
@Placeholder said in TIL (about the Dark Arts of HTML):
TIL that the Curiosity Rover calculated the best focus position for one of its cameras by taking an image, converting the image into a JPEG, and measuring the size of the resulting file. The bigger the JPEG file, the better the focus of the camera.
I'm conflicted about this.
On one hand, it's pretty ingenious.
On the other hand, I would have expected such a project not to rely on hacks like this.
-
@Zerosquare I imagine it's cheaper in terms of code and storage and proving for a good-enough answer than something vastly more sophisticated.
-
@Arantor I don't know the circumstances surrounding this, but it sounds to me like the sort of thing that might be a workaround for a hardware problem. It's kinda hard to fix hardware when it's a few million miles away, so NASA engineers are extremely clever in coming up with hacks that can be implemented with the resources available, like repurposing other hardware or patching code to do things the original programmer never dreamed of.
-
@Tsaukpaetra said in TIL (about the Dark Arts of HTML):
Status: TIR
hostnames (and I guessWindows computer names) can't start with a number.It depends on the operating system. For domain names, RFC-1123 says they totally can start with digits, and I am pretty sure there is a couple of internet domains that do, as well as I am pretty sure docker uses the hexadecimal identifiers as hostnames without any letter, so 10 times out of 16 they start with a digit.
Windows may still not be allowing it for sake of backward compati(de)bility with ancient systems that didn't allow it.
-
@Bulb As I recall 3com was a driver in the hostnames starting with a digit. I also know about 9292ov.nl, and that the Dutch registry specifically reserves all 10-digit numbers under the .nl TLD in case they ever want to do something with phone numbers.
-
@Arantor said in TIL (about the Dark Arts of HTML):
@Zerosquare I imagine it's cheaper in terms of code and storage and proving for a good-enough answer than something vastly more sophisticated.
Yeah, my brother in law works on this stuff and they're severely constrained on lots of fronts (bandwidth most of all) and have to look for clever ways to work around these things.
Not much different, really, than an eye doctor playing with the lenses and asking which one looks better to you...over and over.
-
-
@Placeholder said in TIL (about the Dark Arts of HTML):
TIL that the Curiosity Rover calculated the best focus position for one of its cameras by taking an image, converting the image into a JPEG, and measuring the size of the resulting file. The bigger the JPEG file, the better the focus of the camera.
When the differences between neighboring pixels are maximal, the focus is best. This also leads to lower compression of the image file.
Well, it works or fails with the reproducibility of focus - image - pairs: at work, we use some infrared cameras, and our boss comes up with many splendid ideas on how to achieve a better autofocus than the manufacturer. But when playing too much with the focus of the camera, things are not reliable at all.
-
@Bulb said in TIL (about the Dark Arts of HTML):
For domain names, RFC-1123 says they totally can start with digits, and I am pretty sure there is a couple of internet domains that do
Pretty common in (input is much easier than with simplified chinese characters).
-
Filed under: 888
-
@Zerosquare what a lucky number!
But, actually, the typical WiFi password in Taiwan is88888888
.
-
@BernieTheBernie Better than
12345
or1122334455
...
-
@dkf said in TIL (about the Dark Arts of HTML):
@BernieTheBernie Better than
12345
or1122334455
...Needs stronger verification:
111222333444555.
-
"Alexa, when did Tom Brokaw ..." usually gets an answer.
-
TIL you can do this (C#):
class Program { class X { // Magic method! // Okay, just a regular method with a particular name and signature public void Deconstruct(out int i, out string s, out bool b) { i = 7; s = "Hello world"; b = true; } } static void Main() { X x = new(); (int i, string s, bool b) = x; // ✨ } }
Of course, just because you can doesn't mean you should.
-
@Zecc Hmmh. Could also make the
X
static to remove the need fornew
?
-
You can't make X a static class, or the compiler will complain about a Type not being valid in the context of a deconstructing assignment.
You can't make the method static, or it will complain you can't call it on an instance and should instead qualify it with the type name.
You can write the method as an extension method; ie is a static method in a separate static class, but taking an instance of X as a 'this' parameter.
For all intensive purpoises it looks like a destructuring assigment is just syntax sugar to a call to a Deconstruct method with void return type and out parameters corresponding to what's expected in the LHS.
-
@Zecc Not sure about the more recent versions, but VS 2017 hates deconstructions. It will offer them, pretend to allow them, but then complain about syntax errors and eventually the refactoring provider will crash
-
Even PHP has destructors (though theirs don’t crash) but you can’t return values from them.
-
@Arantor said in TIL (about the Dark Arts of HTML):
Even PHP has destructors (though theirs don’t crash) but you can’t return values from them.
AFAICT, the topic isn’t about destructors but tuple destructuring.
-
@Arantor said in TIL (about the Dark Arts of HTML):
Even PHP has destructors (though theirs don’t crash) but you can’t return values from them.
destructors, deconstructors, it's like top-boots and watches, both stretch.
-
@topspin sure, I was just getting in the cheap “but PHP isn’t that bad” moment. Especially as you can still mess with global state in a PHP destructor, but the “unlike C# it doesn’t crash” was too good not to.
It is also worth noting that PHP has destructuring in the [var, var] = array sense but only if the array is a numeric array and not the weird hash map calling itself an array sense (it has no formal data type of tuples)
-
@Arantor said in TIL (about the Dark Arts of HTML):
“but PHP isn’t that bad”
Young man, we do not use that kind of language here.
-
@Arantor said in TIL (about the Dark Arts of HTML):
but PHP isn’t that bad
PHP isn't that bad. JavaScript has taken the bad flag from it some time ago and ran well ahead with it.
-
@Arantor said in TIL (about the Dark Arts of HTML):
@topspin sure, I was just getting in the cheap “but PHP isn’t that bad” moment. Especially as you can still mess with global state in a PHP destructor, but the “unlike C# it doesn’t crash” was too good not to.
It is also worth noting that PHP has destructuring in the [var, var] = array sense but only if the array is a numeric array and not the weird hash map calling itself an array sense (it has no formal data type of tuples)
Gotta wait for
mysql_real_deconstruct
I guess.
-
@boomzilla does C have deconstructors?
-
@Arantor said in TIL (about the Dark Arts of HTML):
not the weird hash map calling itself an array sense (it has no formal data type of tuples)
Do you mean
<?php $data = [ ["id" => 1, "name" => 'Tom'], ['fnord' => 'arbitrary', "name" => 'Fred', "id" => 2], // tuples whaaa...? ]; foreach ($data as ["id" => $id, "name" => $name]) { echo "id: $id, name: $name\n"; }
?
-
@Arantor said in TIL (about the Dark Arts of HTML):
@boomzilla does C have deconstructors?
And it is defined for three distinct cases, because defining functions for the primitive arrays and structs is not actually possible.
-
@Watson Sort of.
Completely legal:
<?php $data = [1, 2, 3]; $data['foo'] = 'bar'; // Or even $data = [ 1 => 'foo', 'bar' => 'baz', ];
In other languages, these are two separate concepts, the array (a numeric-keyed structure) and a hashmap or dictionary (a string-keyed structure). JS differentiates these between [] and {} for example.
PHP's arrays are simultaneously both and this can fuck you over if you somehow expect one and get traces of the other.
A tuple is a different thing again that is neither of these.
-
@Bulb I don't really follow the naming structure, does C++17 apply to C? Because the mysql connector library is not C++.
-
@Arantor said in TIL (about the Dark Arts of HTML):
@Watson Sort of.
The point being that destructuring PHP arrays works with associative keys as well as numeric ones.
PHP's arrays are simultaneously both and this can fuck you over if you somehow expect one and get traces of the other.
Like if you don't specify which you want, arrays returned for MySQL rows are keyed with both, so you can index the array by both column position and column name. Simply iterating over the array will cause everything to be duplicated. I don't know what happens if you name/alias the columns in the query with numeric names, but it can't be good.
-
@Arantor said in TIL (about the Dark Arts of HTML):
JS differentiates these between [] and {} for example.
Arrays are objects too; you can use string array indices just fine in JS.
-
@Arantor said in TIL (about the Dark Arts of HTML):
In other languages, these are two separate concepts, the array (a numeric-keyed structure) and a hashmap or dictionary (a string-keyed structure). JS differentiates these between [] and {} for example.
> o = {} {} > o[0] = 'zero' 'zero' > o["0"] 'zero' > a = ['zero', 'one', 'two'] [ 'zero', 'one', 'two' ] > a[0] 'zero' > a.length 3 > a[10] = 'ten' 'ten' > a.length 11 > console.log(a) [ 'zero', 'one', 'two', <7 empty items>, 'ten' ] undefined > a['undefined'] = 8; 8 > a[undefined] 8 > a['null'] = 9; 9 > a[null] = 9; > a.length 11 > console.log(a) [ 'zero', 'one', 'two', <7 empty items>, 'ten', undefined: 8, null: 9 ] > a['[object Object]'] = 100; 100 > a[{}] 100 > a.toString() 'zero,one,two,,,,,,,,ten' > a['zero,one,two,,,,,,,,ten'] = a; [ 'zero', 'one', 'two', <7 empty items>, 'ten', undefined: 8, null: 9, '[object Object]': 100, 'zero,one,two,,,,,,,,ten': [Circular] ]
-
@Zecc When your duck-typing has only one leg and a broken wing.
-
I'm noticing I wrote this:
> a = ['zero', 'one', 'two'] [ 'zero', 'one', 'two' ] > a[0] 'zero'
which is obviously expected. I mean this:
> a = ['zero', 'one', 'two'] [ 'zero', 'one', 'two' ] > a["0"] 'zero'
Also
> a['null'] = 9; 9 > a[null] = 9;
should be
> a['null'] = 9; 9 > a[null] 9
Probably everyone understood that, but I just figured I'd self-.
-
@Zecc said in TIL (about the Dark Arts of HTML):
I'm noticing I wrote this:
> a = ['zero', 'one', 'two'] [ 'zero', 'one', 'two' ] > a[0] 'zero'
which is obviously expected. I mean this:
> a = ['zero', 'one', 'two'] [ 'zero', 'one', 'two' ] > a["0"] 'zero'
Also
> a['null'] = 9; 9 > a[null] = 9;
should be
> a['null'] = 9; 9 > a[null] 9
Probably everyone understood that, but I just figured I'd self-.
Oi, no trying to steal a
-
@Arantor said in TIL (about the Dark Arts of HTML):
@Bulb I don't really follow the naming structure, does C++17 apply to C?
C and C++ are different languages that are developing their own ways, except that they share a common subset (that is almost, but not completely, all of older C standard) that allows C++ to call any C functions and define functions that can be called from C.
Because the mysql connector library is not C++.
- I think it isn't. It could internally be in C++ and just present a C interface, but I think it is indeed completely in C.
- But it depends on what you are calling it from. A C function that returns a struct can still be used with the destructuring assignment when called from C++17 or later.
-
-
Life goals!
-
@Zecc
Cat status thread