The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 2,470 other followers

Archive for January 20th, 2021

Don’t use global state to manage a local problem – The Old New Thing

Posted by jpluimers on 2021/01/20

The 20081211 article [WayBack] Don’t use global state to manage a local problem – The Old New Thing reminds me of a process I went through with a programming team a few years ago.

A lot of their source base came from the procedural era: global variables and global methods. No classes. No methods on records.

Taking them to the level of reference counted immutable instances that used dependency injection as an architectural design was a long journey.

Early in their journey, they would create a lot of methods on classes and records at the class level.

Then they started introducing instances that were basically singletons.

Finally they made real instances that could have more than one available at run-time. These would still create other instances when they needed, often through a few singletons that were still left (for instance session state, database connection state, etc).

Then they introduced caches and pools to keep things alive longer than as to speed up things. It also highly complicated life-time management.

Finally they backed down, and started hooking up things through dependency injection.

A lot of the above caused global state to be used for solving local problems.

It was a tough, but fun time, to get them on the right path, tickling them with the right puzzles at the right time to steer them through their journey..

–jeroen

Posted in Conference Topics, Conferences, Development, Event, Software Development | Leave a Comment »

HTML table border styles

Posted by jpluimers on 2021/01/20

I always get confused when I see this kind of HTML:

<td style="border: 1px black; border-style: none solid solid;">

This raises questions like:

  • When less than 4 borders are mentioned, which borders are solid, and which borders are none?
  • What is the order of 0…4 borders?

Luckily these links helped me:

  1. [WayBack] w3schools: CSS border-style property
  2. [WayBack] w3schools: CSS Borders
  3. [WayBack] border-style – CSS: Cascading Style Sheets | MDNThe border-style CSS property is a shorthand property that sets the line style for all four sides of an element’s border.

The first two made me find the last one, which is best as it has a CSS demo button (that also works on the WayBack link), a list of examples, and even better, answers the above questions with the “border-style” list below.

I rephrased their list into a table emphasising the clock-wise order:

The number of values determine the sides affected; thinking clock-wise is easiest to get it:

# values affected sides example top right bottom left
1 all: top, right, bottom, left solid solid solid solid solid
2 top & bottom, right & left none solid none solid none solid
3 top, right & left, bttom dotted none solid dotted none solid none
4 top, right, bottom, left double dotted solid none double dotted solid none

Their list:

The border-style property may be specified using one, two, three, or four values.

  • When one value is specified, it applies the same style to all four sides.
  • When two values are specified, the first style applies to the top and bottom, the second to the left and right.
  • When three values are specified, the first style applies to the top, the second to the left and right, the third to the bottom.
  • When four values are specified, the styles apply to the toprightbottom, and left in that order (clockwise).

Each value is a keyword chosen from the list below.

then it continues with a table showing the outcome of the various line style values you can put in:

<line-style>
Describes the style of the border. It can have the following values:

none
Like the hidden keyword, displays no border. Unless a background-image is set, the calculated value of border-top-width will be 0, even if the specified value is something else. In the case of table cell and border collapsing, the none value has the lowest priority: if any other conflicting border is set, it will be displayed.
hidden
Like the none keyword, displays no border. Unless a background-image is set, the calculated value of border-top-width will be 0, even if the specified value is something else. In the case of table cell and border collapsing, the hidden value has the highestpriority: if any other conflicting border is set, it won’t be displayed.
dotted
Displays a series of rounded dots. The spacing of the dots is not defined by the specification and is implementation-specific. The radius of the dots is half the calculated border-top-width.
dashed
Displays a series of short square-ended dashes or line segments. The exact size and length of the segments are not defined by the specification and are implementation-specific.
solid
Displays a single, straight, solid line.
double
Displays two straight lines that add up to the pixel size defined by border-width or border-top-width.
groove
Displays a border with a carved appearance. It is the opposite of ridge.
ridge
Displays a border with an extruded appearance. It is the opposite of groove.
inset
Displays a border that makes the element appear embedded. It is the opposite of outset. When applied to a table cell with border-collapse set to collapsed, this value behaves like groove.
outset
Displays a border that makes the element appear embossed. It is the opposite of inset. When applied to a table cell with border-collapse set to collapsed, this value behaves like ridge.

–jeroen

Posted in CSS, Development, HTML, HTML5, Software Development, Web Development | Leave a Comment »

grep for Delphi .dproj file containing copy commands for certain DLLs

Posted by jpluimers on 2021/01/20

I always forget the syntax, so this quick grep helps me finding the lines in Delphi .dproj files that have the right copy statements for getting certain DLLs in the output directory.

Those are very useful to copy for instance the FastMM or OpenSSL DLLs from a central location.

[WayBack] GNU grep (which shows filenames and supports UTF-8 and UTF-16):

grep -inS copy *.dproj | grep -i ssl | grep -i dll | grep -v amp

Good old Borland grep:

grep -ind copy *.dproj | grep -i ssl | grep -i dll | grep -v amp

The amp trick excludes any lines having amp in them, incuding the &amp; lines that are duplicated by the IDE throughout the .dproj file to keep build configurations linked correctly.

Related:

–jeroen

Posted in Delphi, Development, Software Development | Leave a Comment »

 
%d bloggers like this: