TIL (about the Dark Arts of HTML)
-
@Bulb said in TIL (about the Dark Arts of HTML):
A command pattern using introspection
A what now?
/me checks wikipedia page
wikipedia said:
This information includes the method name, the object that owns the method and values for the method parameters.
Yeah... no. That's one possible implementation of the command pattern, and a rather shitty and pointless one IMHO.
-
@ixvedeusi said in TIL (about the Dark Arts of HTML):
@Bulb said in TIL (about the Dark Arts of HTML):
A command pattern using introspection
A what now?
/me checks wikipedia page
wikipedia said:
This information includes the method name, the object that owns the method and values for the method parameters.
Yeah... no. That's one possible implementation of the command pattern, and a rather shitty and pointless one IMHO.
Ah, yes, it was the Wikipedia one I wondered why the hell one would need for anything.
-
@Carnage said in TIL (about the Dark Arts of HTML):
the Wikipedia one
As I see it, more or less any design involving an interface which has a
DoIt()
function (where its requirement doesn't say what exactly it will do) is an instance of the command pattern.
-
@ixvedeusi We had this same thing, a "command" pattern of classes implementing execute and undo methods for an undo stack. The discussion made me wonder if this is what's meant by the "command pattern" but the Wikipedia entry is too long and those GoF patterns always seem overly convoluted.
-
@ixvedeusi said in TIL (about the Dark Arts of HTML):
@Carnage said in TIL (about the Dark Arts of HTML):
the Wikipedia one
As I see it, more or less any design involving an interface which has a
DoIt()
function (where its requirement doesn't say what exactly it will do) is an instance of the command pattern.That makes pretty much any generic interface a command pattern then? I do see the use of those.
-
@topspin said in TIL (about the Dark Arts of HTML):
those GoF patterns always seem overly convoluted.
They are, and in large part because Java does not—or did not at the time—have simpler abstractions common in other languages to build them on.
@Carnage said in TIL (about the Dark Arts of HTML):
That makes pretty much any generic interface a command pattern then? I do see the use of those.
Not any. I'd say the distinguishing feature is that you collect the parameters pertaining to some request to an object and then execute the operation at a later point (from a queue, or wrapped in the undo/redo logic or such). E.g. a callback is also a generic interface but I wouldn't call that one a command pattern.
-
@Carnage said in TIL (about the Dark Arts of HTML):
That makes pretty much any generic interface a command pattern then? I do see the use of those.
Not really, no; I was afraid this explanation might be misconstrued in this way. The particularity of the command pattern is that literally
DoIt()
would be an actual, acceptable name for that function.In most generic interfaces this is not the case, there every function has a specific purpose, and you would really want the function name to reflect that purpose. With the command pattern, the purpose is encoded not in the function name, but in the identity of the object. One object might implement
DoIt()
to add an additional line on a document, another implementation might renumber its pages (to stick with the "undo" application). The command object would encapsulate all information needed to perform that operation, including the information what that operation actually is.
-
@Bulb said in TIL (about the Dark Arts of HTML):
@topspin said in TIL (about the Dark Arts of HTML):
those GoF patterns always seem overly convoluted.
They are, and in large part because Java does not—or did not at the time—have simpler abstractions common in other languages to build them on.
@Carnage said in TIL (about the Dark Arts of HTML):
That makes pretty much any generic interface a command pattern then? I do see the use of those.
Not any. I'd say the distinguishing feature is that you collect the parameters pertaining to some request to an object and then execute the operation at a later point (from a queue, or wrapped in the undo/redo logic or such). E.g. a callback is also a generic interface but I wouldn't call that one a command pattern.
@ixvedeusi said in TIL (about the Dark Arts of HTML):
@Carnage said in TIL (about the Dark Arts of HTML):
That makes pretty much any generic interface a command pattern then? I do see the use of those.
Not really, no; I was afraid this explanation might be misconstrued in this way. The particularity of the command pattern is that literally
DoIt()
would be an actual, acceptable name for that function.In most generic interfaces this is not the case, there every function has a specific purpose, and you would really want the function name to reflect that purpose. With the command pattern, the purpose is encoded not in the function name, but in the identity of the object. One object might implement
DoIt()
to add an additional line on a document, another implementation might renumber its pages (to stick with the "undo" application). The command object would encapsulate all information needed to perform that operation, including the information what that operation actually is.Got it, thanks. :)
-
@Bulb said in TIL (about the Dark Arts of HTML):
They are, and in large part because Java does not—or did not at the time—have simpler abstractions common in other languages to build them on.
Wasn't the orignal GoF book based on C++ code (not that that invalidates your point, just ing)?
As an aside, I find it kind of ironic how the GoF patterns are always treated as normative gospel, even though they were originally more of a taxonomy; the introduction to the book even explicitly said something along the lines of "These are not recommendations, but simply patterns we have repeatedly encountered in the wild, we just thought we'd write them down so you can recognize them if you encounter them."
-
@ixvedeusi I find that ironic too, and I use them the original way myself. I also often call something some pattern because it logically kind of is, but there is no trace or reference of it in the actual code as in, say, Python, it uses some construct that Java does not have, but is more natural in that context in Python (often involving closures).
-
@ixvedeusi It's a trait of programmers in large groups. Anything approximating something you can cargo cult is turned into gospel.
-
TIL if two adjacent HTML elements have margin:20px, the margin between them will be 20px, not 40px.
-
@anonymous234 said in TIL (about the Dark Arts of HTML):
TIL if two adjacent HTML elements have margin:20px, the margin between them will be 20px, not 40px.
Yeah, margins can overlap. Padding doesn't, if memory serves. Was going to use that for @Zenith 's challenge, but haven't gotten around to it yet.
-
@anonymous234 said in TIL (about the Dark Arts of HTML):
TIL if two adjacent HTML elements have margin:20px, the margin between them will be 20px, not 40px.
It's been that way since the dawn of time. It is pretty complicated, too.
-
@Bulb said in TIL (about the Dark Arts of HTML):
It is pretty complicated, too.
I'd be pretty surprised if anything related to CSS wasn't.
-
@anonymous234 and it's being used, too. Negative margins are pretty common e.g. in bootstrap…
…my experience with it was that it is really fragile. There are some classes, e.g. for columns, and if you use them the intended way they mostly work, but if you use them slightly wrong, elements get blown up all over the screen and you have absolutely no idea where the mistake is.
-
@Bulb said in TIL (about the Dark Arts of HTML):
but if you use them slightly wrong, elements get blown up all over the screen and you have absolutely no idea where the mistake is
I hate to repeat myself but... I'd be pretty surprised if anything related to CSS wasn't like that.
-
@anonymous234 When I reworked some parts of the layout to flexboxes it mostly did what I expected—and it was the first time I ever used them and did it because it was the obviously easiest choice the resident frontend developer apparently never heard of. Generally when I write the classes, I mostly do understand what is going on. But the Bootstrap ones are ugly hacks relying on things to add up just the right way.
-
@Bulb said in TIL (about the Dark Arts of HTML):
@anonymous234 When I reworked some parts of the layout to flexboxes it mostly did what I expected—and it was the first time I ever used them and did it because it was the obviously easiest choice the resident frontend developer apparently never heard of. Generally when I write the classes, I mostly do understand what is going on. But the Bootstrap ones are ugly hacks relying on things to add up just the right way.
And now CSS Grid is even easier and works better (with fewer weirdnesses) than flexbox. They're both useful, just for different things.
Grid is good for the overall layout of the page. Flexbox handles layouts for things of varying widths and layout within a grid element.
-
@Benjamin-Hall IIRC they have no overlap at all. Flexbox is the only thing that can 1. make something expand to whatever space is left after placing the fixed-size elements and 2. align any element vertically (in tables it only works for text IIRC), which were the things I needed.
-
TIL "Captain", of Space Debris fame, was/is part of Poets of the Fall, of Late Goodbye fame.
Good musicians gonna good music.
-
@Bulb said in TIL (about the Dark Arts of HTML):
@Benjamin-Hall IIRC they have no overlap at all. Flexbox is the only thing that can 1. make something expand to whatever space is left after placing the fixed-size elements and 2. align any element vertically (in tables it only works for text IIRC), which were the things I needed.
AFAIK both of these can be done with grid; for 1. you'd need need to define an appropriate "row template" or sizing constraints on each element. Vertical alignment is more or less the same between flex and grid I think (they basically just copied the flex alignment properties into the grid spec).
But if these are the only things you need, flex is definitely the better choice.
-
@ixvedeusi Yeah, grid is the cannon. It's not appropriate for shooting sparrows.
They are basically similar to vbox/hbox and table layouts of Qt or Gtk. For the simpler things you use vbox/hbox, that is flex, for the huge stuff table, that is grid (you'd use table if it wasn't so crappy).
-
@Bulb said in TIL (about the Dark Arts of HTML):
for the huge stuff table, that is grid (you'd use table if it wasn't so crappy).
Yeah, the addition of grid layout finally turned the common "don't use tables for layout" mantra from idealistic bullshit into actual good advice. Only took them what... 10 years or so?
-
In computing, the Halloween Problem refers to a phenomenon in databases in which an update operation causes a change in the physical location of a row, potentially allowing the row to be visited more than once during the operation. This could even cause an infinite loop in some cases where updates continually place the updated record ahead of the scan performing the update operation.
The potential for this database error was first discovered by Don Chamberlin, Pat Selinger, and Morton Astrahan in 1976, on Halloween day while working on a query that was supposed to give a ten percent raise to every employee who earned less than $25,000. This query would run successfully, with no errors, but when finished all the employees in the database earned at least $25,000, because it kept giving them a raise until they reached that level.
-
@ixvedeusi said in TIL (about the Dark Arts of HTML):
Yeah, the addition of grid layout finally turned the common "don't use tables for layout" mantra from idealistic bullshit into actual good advice
In general, if people keep doing things a certain way instead of what you think is the "right" way despite your advice, it means their way is easier and you need to improve the "right way".
-
TIL that milt (fish sperm) is considered a delicacy in several parts of the world. Why don't I ever see that as an option for topping at the local sushi restaurants?
Also TIL that sushi is supposed to be eaten with hands and not chopsticks. No more having to bother with them!
-
@Atazhaia said in TIL (about the Dark Arts of HTML):
Also TIL that sushi is supposed to be eaten with hands and not chopsticks. No more having to bother with them!
https://www.sushifaq.com/basic-sushi-experience-information/how-to-eat-sushi-sushi-etiquette/
It is OK to eat nigiri-zushi (sushi) with your hands. Sashimi is only to be eaten with your chopsticks. Pick up the nigiri-zushi and dip the fish (neta) into your shoyu, not the rice (which will soak up too much shoyu).
TIL. Quite interesting.
-
@Atazhaia said in TIL (about the Dark Arts of HTML):
sushi
Technically, sushi is a rice dish. Sashimi is any food served and eaten raw.
-
@anonymous234 said in TIL (about the Dark Arts of HTML):
@ixvedeusi said in TIL (about the Dark Arts of HTML):
Yeah, the addition of grid layout finally turned the common "don't use tables for layout" mantra from idealistic bullshit into actual good advice
In general, if people keep doing things a certain way instead of what you think is the "right" way despite your advice, it means their way is easier and you need to improve the "right way".
What does this tell us about the Wooden Table approach?
Or the slightly more common phenomenon of people sending you screenshots embedded in MS Word instead of just the picture itself?
-
@Atazhaia said in TIL (about the Dark Arts of HTML):
Why don't I ever see that as an option for topping
I doubt the fish would like you doing that.
-
@topspin said in TIL (about the Dark Arts of HTML):
Or the slightly more common phenomenon of people sending you screenshots embedded in MS Word instead of just the picture itself?
Some people just can't be taught.
-
@boomzilla said in TIL (about the Dark Arts of HTML):
@topspin said in TIL (about the Dark Arts of HTML):
Or the slightly more common phenomenon of people sending you screenshots embedded in MS Word instead of just the picture itself?
Some people just can't be taught.
you just aren't willing to use a sharp enough stick.
or teeth. teeth work too.
-
@topspin said in TIL (about the Dark Arts of HTML):
Or the slightly more common phenomenon of people sending you screenshots embedded in MS Word instead of just the picture itself?
One that I see far too often is a screenshot of the results from an SQL query, rather than just copying the results from SQL Developer into the email as text.
-
@loopback0 One of our software packages we develop and sell requires me to generate license files for it, otherwise it doesn't work on customer systems. There's sort of an "about" window that has all the relevant info I need to create a license, along with a big "Copy to Clipboard" button. It involves some nasty GUID-looking things I need to enter into our license generator on my end, and if I get a single character wrong, the license won't work on the system.
Do you know how many people click the "Copy to Clipboard" button and send me an email with the required information in text format that I can copy-paste into the license generator? It's almost 0%. And do you know how many people completely ignore the "Copy to Clipboard" button and instead take a screenshot and send me a bitmap image, requiring me to read and hand-type a pile of GUID's into the license generator? It's almost 100%.
I should add "I Hate Users" to my signature. Or change it to a big, long bulleted list.
-
@mott555 you should email back that the image got corrupted or stripped out by your mail servers and could they please use the copy to clipboard feature.
-
@boomzilla doesn’t sound passive aggressive enough but probably more effective than what I’d reply.
-
@topspin it would definitely get there after the fifth or sixth time they tried resending the screenshot.
-
@boomzilla The response is usually something like, "Sorry, I'm not at the workstation anymore and I'm about to get on a flight/I'm on break/I left for the day. Can you please just type it all in by hand? I need the license ASAP so I can forward it on to one of my coworkers and they can get to work."
-
@mott555 said in TIL (about the Dark Arts of HTML):
@boomzilla The response is usually something like, "Sorry, I'm not at the workstation anymore and I'm about to get on a flight/I'm on break/I left for the day. Can you please just type it all in by hand? I need the license ASAP so I can forward it on to one of my coworkers and they can get to work."
"Like I said, I didn't get the screenshot, so I am unable to transcribe it."
-
@topspin said in TIL (about the Dark Arts of HTML):
@anonymous234 said in TIL (about the Dark Arts of HTML):
@ixvedeusi said in TIL (about the Dark Arts of HTML):
Yeah, the addition of grid layout finally turned the common "don't use tables for layout" mantra from idealistic bullshit into actual good advice
In general, if people keep doing things a certain way instead of what you think is the "right" way despite your advice, it means their way is easier and you need to improve the "right way".
What does this tell us about the Wooden Table approach?
Or the slightly more common phenomenon of people sending you screenshots embedded in MS Word instead of just the picture itself?
Good question.
The wooden table approach tells us that (some) people are more comfortable with the digital-to-physical and physical-to-digital approaches than with just digital-to-digital.
But physical metaphors break down useless for anything non-trivial. If you took this 3D environment here and tried to do any real work with it you'd just reinvent Windows.
Why? Either because they can't handle any form of change (pretty likely), or because they've been bitten by the complexity of the digital world. A paper page is a paper page, you can see how it looks like. An email or a word file or even a PDF file can break in various ways because file formats are hard. So their mind defaults to thinking in paper.
What can we learn from that? That file formats should "just work" and not break (you don't say) and that people understand "physical" logic better than "computer" logic.
Big woop, we've known that since the 70s. It's why we have the "desktop metaphor" .
Now the MS Word screenshot approach. Why do people do it, and are they wrong in doing it? Let me ramble on this for a while.
First, screenshots in the pre-Windows 7 era started their life in the clipboard. You needed somewhere to paste them. To save them as an image and attach the image you needed to open MS Paint, paste, save, close, open email, attach, find file. (BLEH. Why can't we paste into a file directly?) What if they didn't know that? Well, they could have pasted into the email client of course, but what if the one they used (any webmail client) didn't support that? Word is the remaining choice. I think in that case it's mostly justified.
What if the email client supports pasting images but people still use Word? Well, Word is the one interface they know, and maybe they're too stupid to extrapolate that to other programs.
But, people like Word because it's a "blank canvas" where everything is allowed. You can paste images, make them bigger, smaller, flip them, rotate them, add a border, add text around it, you name it, Word will never tell you no. It's the ideal interface. In fact Word almost resembles... that "physical" desktop interface I just showed earlier
So I think that's what it boils down to. Word lets you manipulate things around a page, thus that blank canvas becomes their "comfort zone" where things are easier to understand. Other programs all have their own rules, talking about "attached files" and other indecipherable geek stuff.
-
@anonymous234 or, in short, people are too lazy/stupid to learn the tools they get paid to do their job with.
-
@anonymous234 said in TIL (about the Dark Arts of HTML):
If you took this 3D environment here and tried to do any real work with it you'd just reinvent Windows.
I remember a program that captured Windows apps and 3d-ized them. Wonder what happened to it... It was kinda cool because it would physically raise recognized controls like buttons out of the window a bit.
Unwieldy though, since there was no VR and mouse-and-keyboard controls for manipulating 3d objects wa (and still is to large extent) rather finicky...
-
@anonymous234 said in TIL (about the Dark Arts of HTML):
(BLEH. Why can't we paste into a file directly?)
I could swear that was a thing back in Windows 95. It would make scraplets or whatever, and was basically a file describing whatever happened to be in the clipboard at the time...
Really wondering why Microsoft got rid of it, actually.
-
@Tsaukpaetra said in TIL (about the Dark Arts of HTML):
@anonymous234 said in TIL (about the Dark Arts of HTML):
(BLEH. Why can't we paste into a file directly?)
I could swear that was a thing back in Windows 95. It would make scraplets or whatever, and was basically a file describing whatever happened to be in the clipboard at the time...
Really wondering why Microsoft got rid of it, actually.
Nobody really used it.
If I remember correctly it was some weird OLE format (but I repeat myself) that also described which program it was created with.
-
@topspin said in TIL (about the Dark Arts of HTML):
@Tsaukpaetra said in TIL (about the Dark Arts of HTML):
@anonymous234 said in TIL (about the Dark Arts of HTML):
(BLEH. Why can't we paste into a file directly?)
I could swear that was a thing back in Windows 95. It would make scraplets or whatever, and was basically a file describing whatever happened to be in the clipboard at the time...
Really wondering why Microsoft got rid of it, actually.
Nobody really used it.
If I remember correctly it was some weird OLE format (but I repeat myself) that also described which program it was created with.If it is the thing I remember, it was the absolute #1 way of making Windows 95 crash horribly.
-
@topspin said in TIL (about the Dark Arts of HTML):
@Tsaukpaetra said in TIL (about the Dark Arts of HTML):
@anonymous234 said in TIL (about the Dark Arts of HTML):
(BLEH. Why can't we paste into a file directly?)
I could swear that was a thing back in Windows 95. It would make scraplets or whatever, and was basically a file describing whatever happened to be in the clipboard at the time...
Really wondering why Microsoft got rid of it, actually.
Nobody really used it.
If I remember correctly it was some weird OLE format (but I repeat myself) that also described which program it was created with.Raymond Chen said it was removed as part of Windows Vista in this "Windows Confidential" feature article:
So the shell team asked the product support group to call up the group's logs to see how many people called with questions about scraps. The theory was that a popular feature gets support calls and unpopular features don't (because nobody is using them).
The answer came back from the product support group. In the past year, the group received a total of four calls. And all of them were of the form, "I created this strange file. What is it and how do I get rid of it?"
-
@JBert Funny enough, part of it has kinda returned, I can paste images in the clipboard in Explorer and they become bitmaps file....
Similarly, text becomes a .txt file:
That's all I've been able to produce so far, I'm sure there's other things you can put on the clipboard...
-
@Tsaukpaetra said in TIL (about the Dark Arts of HTML):
Funny enough, part of it has kinda returned
Well, you know how Windows has been going back in time: back to flat design, reinventing Active Desktop and then there's this. And finally...
-
TIL C# has static constructors. On one hand, I'm glad it does because it's exactly what I need right now - on the other hoof, I dread what abominations have been created by its abuse.