HN user

Calzifer

251 karma
Posts1
Comments97
View on HN

3) Google is biased towards sites that cover a topic earlier than others.

I’ve seen pages that are still top 3 for a particular competitive query years later, simply because they were one of the first to write about it.

Reason why I still always get the Java 8 docs for any search. Annoying.

Process substitution and calling it file redirect is a bit misleading because it is implemented with named pipes which becomes relevant when the command tries to seek in them which then fails.

Also the reason why Zsh has an additional =(command) construct which uses temporary files instead.

Or is there some particular criteria an init system needs to satisfy to be included, that systemd doesn't satisfy but the others do?

Reading the first sentence on that page was to much?

"Init Freedom is about restoring a sane approach to PID1 that respects portability, diversity and freedom of choice."

systemd fails on the portability criteria.

Apart from that, why should they invest there limited time to include systemd? Devuan is Debian without systemd. If you want systemd install Debian.

Data centers are built with redundant network connectivity, backup power, and fire suppression. [...] The question is their relative frequency, which is where the data center is far superior.

Well, I remember one incident were a 'professional' data center burned down including the backups.

https://en.wikipedia.org/wiki/OVHcloud#Incidents

I know no such incident for some basement hosting.

Doesn't mean much. I'm just a bit surprised so many people are worried because of the server location and no one had mentioned yet the quite outstanding OVH incident.

I was curious if they optimized the download. Did it download the 'optimized' ~150 GB and wasting a lot of time there or did it download the ~20 GB unique data and duplicated as part of the installation.

I still don't know but found instead an interesting reddit post were users found and analyzed this "waste of space" three month ago.

https://www.reddit.com/r/Helldivers/comments/1mw3qcx/why_the...

PS: just found it. According to this Steam discussion it does not download the duplicate data and back then it only blew up to ~70 GB.

https://steamcommunity.com/app/553850/discussions/0/43725019...

It is apparently also hard to maintain over time. I heavily customized my Firefox and Thunderbird and it is annoying how often GUI components which should be equal (e.g. toolbar buttons in different places) look the same* but have multiple different CSS rules.

Some widgets, or rather the repeated reinventions of widgets in HTML+CSS, use variables and the next equally looking widget has none, or other variables with the same values.

From an outsider perspective it looks like a mess.

* or almost the same with minimal, likely unintended, differences like one button has a slight border when hovered but another button right next to it has none

I understand that search bar position is not changeable by theming,

It is changeable. With enough dedication you can go a long way just with CSS.

In this case it is even rather easy because the "unified toolbar" the thing containing the search box, the menu bar (if shown) and the tab bar are three elements in the same flex box. They can be reordered by setting the order property.

Only downside in this case is that (if client side decoration is not disabled in the settings) the window buttons (close, minimize) are also part of the unified toolbar and would end (without further fixes) below the tab bar.

As a quick (and dirty) experiment I moved the tab bar left to the search bar in the same row just with:

  #titlebar {
    flex-direction: row;
    > unified-toolbar { order: 2; width: 50vw; }
    #tabs-toolbar { order: 1; width: 50vw; }
  }

And a hacky way which often works good enough is to reposition and hardcode stuff with position:absolute/fixed/sticky.

Finally Thunderbird's own customization dialog can be used to fill the empty space around the search bar. By default it has a spacer left and right but that is easy to change even without custom CSS.

Also

it is also not possible to theme the settings areas.

I don't see a reason why this should not work. If by settings area the author means the settings page which in modern Thunderbird is more or less a web page in the content area, it should be stylable with userContent.css instead of userChrome.css.

The hard part is to find the right @-moz-document selectors for each individual content page.

Don't know what exactly PostCSS is but with a JavaScript addon it would probably be wiser to inject the custom css directly into the shadow dom instance if possible and avoiding such hacks.

Also, by the way, when JavaScript addons get involved: userChrome.css is applied quite unfortunate in the css cascade. It gets low priority that is why they are usually full of !important rules. With JavaScript it is possible to add custom css instead as so called author stylesheet which makes it easier to override default styles. (never tried it myself)

https://old.reddit.com/r/FirefoxCSS/comments/msoqte/how_can_...

Also, note that some areas of ThunderBird are rendered outside of the influence of userChrome.css in a "Shadow DOM" - as such, it is not possible to fully theme all elements of Thunderbird.

With some limitations it is possible to restyle Shadow DOM elements. It is just a lot harder to select the right element if it is inside a shadow dom.

I found a workaround (don't remember where I found it) which I use extensively in my personal userChrome.css.

The basic concept (afair) is that you can write selectors which match inside the shadow dom as long as they do not need to "cross" the shadow dom "boundary".

A good starting point for me is often to select by tag and part attribute, e.g. image[part="icon"] { ... }

Now the trick to style a particular instance of a web component (shadow dom instance) is to use variables and defaults.

With a selector which targets the "root element" of the shadow dom I set variables for any value I want to change and with a selector which is fully inside the shadow dom I add styles using the variable (which is then only defined for that particular instance) or a default which effectively cancels my custom style anywhere else.

As concrete example the dialog to create new calendar events has a drop down box to select the calendar where each entry is prefixed with a dot with calendar color. The menulist has a shadow dom and the menupopup another. I styled those dots as squares (for fun and because I think the modern web is to round). So to set the variables on the "outside" I have:

  menulist#item-calendar {
    --parthack-boxmarker-radius: 0;
    --parthack-boxmarker-image-size: 1em;
    --parthack-boxmarker-border: inset 0 0 0 1px color-mix(in srgb, black 20%, transparent);
  }
and to apply it
  menuitem.menuitem-iconic > hbox.menu-iconic-left > image.menu-iconic-icon {
    border-radius: var(--parthack-boxmarker-radius) !important;
    width: var(--parthack-boxmarker-image-size, revert-layer) !important;
    height: var(--parthack-boxmarker-image-size, revert-layer) !important;
    box-shadow: var(--parthack-boxmarker-border, none);
  }
(the variable prefix "parthack" has no special meaning; it just evolved because I initially used it to hack styles onto shadow dom elements over the part attribute)

Now this will change only the icons only in the menulist with id 'item-calendar' and leave others unchanged. Whether I use revert-layer as default or something else depends on what style the element has by default and try and error.

Bash is slower than other POSIX compatible shells but once you start running external commands for any substring or replace operation you loose much of this performance edge since forking is comparable slow.

One reason why I personally prefer to use Bashisms like ${x//str/replace} or [[ $value =~ $pattern ]] instead of doing the common x=$(echo $x | sed s/str/replace/) which has to launch two processes just for the sake of avoiding Bashism. (or grep -oP ... which is nice but a BASH_REMATCH is often simpler)

A new PNG spec 1 year ago

Just last week I had again some PDFs Okular could not open because of some more uncommon form features.

A new PNG spec 1 year ago

(A)PNG supports semi-transparency. In GIF a pixel is either full transparent or full opaque.

Also while true color gifs seem to be possible it is usually limited to 256 colors per image.

For those reasons alone APNG is much better than GIF.

A PiTest blog post [1] mentions an interesting article [2] on how mutation testing is (or was) used by Google.

If I remember correctly, instead of overwhelming the developer with the full report, CI only presented a hand full of randomly chosen failed mutation tests. The developer then could decide to ignore the result (mutation testing will usually produce some false positives) or extend the tests to kill the mutation.

I used PiTest recently the first time and found it quite useful. As you said, a pretty awesome idea. But definitely not a tool for people who always strive for 100% test coverage.

[1] https://blog.pitest.org/dont-let-your-code-dry/

[2] https://homes.cs.washington.edu/~rjust/publ/mutation_testing...

Arrays are fast and ArrayList is like a fancy array with bound check and auto grows. Only the grow part can be problematic if it has to grow very often. But that can be avoided by providing an appropriate initial size or reusing the ArrayList by using clear() instead of creating a new one. Both is used by OP in this project. Especially since the code copies lists quite often I would expect LinkedList to perform way worse.

And since benchmarking is hard is also has a helper to actually "waste" time. [1] The implementation [2] might give an idea that it is not always trivial to do nothing but still appear busy.

Btw I found most of the jmh samples interesting. IMO a quite effective mix of example and documentation. (and I'm not sure there is even much other official documentation)

[1] https://github.com/openjdk/jmh/blob/master/jmh-samples/src/m... [2] https://github.com/openjdk/jmh/blob/872b7203c294d90c17766d19...

        for(int i=0;i<10000; ++i){

            // do nothing just compute hash again and again.
            hash = str.hashCode();
        }
https://github.com/MayankPratap/Samchika/blob/ebf45acad1963d...

"do nothing" is correct, "again and again" not so much. Java caches the hash code for Strings and since the JIT knows that (at least in recent version[1]) it might even remove this loop entirely.

[1] https://news.ycombinator.com/item?id=43854337

My biggest annoyance with FastCGI is the ambiguity between FastCGI Server, FastCGI Application and FastCGI Proxy in documentation and articles.

To give some examples what I mean:

- Apache can be a FastCGI server (mod_fcgid) and proxy (mod_proxy_fcgi) - Nginx (and most other Webservers I checked) is only a FastCGI proxy

Wikipedia [1] lists both as "Web servers that implement FastCGI". For me it took some time to recognize the difference whether a server speaks the FastCGI protocol or can also host/spawn FastCgi supporting applications which do not daemonize by themself.

For the (probably) most used FastCGI application PHP this is easy because php-fpm is both a FastCGI server and application.

An example for a (Fast)CGI application which is not also a server is MapServer [2] which is listed by Wikipedia as CGI program and by its own documentation with "FastCGI support" or "FastCGI-enabled".

The fact that it is only a FastCGI application and needs an additional FastCGI server to host it is (in my opinion) not clearly communicated.

A common tutorial to combine MapServer with Nginx is to use fcgiwrap or spawn-fcgi as FastCGI server.

Since a FastCGI application can usually also act as CGI application it is easy to miss that the first option is running the application as CGI and only the second as FastCGI where one instance serves more than one request.

For me the main difference is that a FastCGI server will open a socket and can spawn worker processes (which php-fpm does and MapServer does not) and a FastCGI application (the worker process) will accept and handle connections/requests.

A FastCGI proxy translates requests (usually from HTTP to FastCGI protocol) and redirects them to a FastCGI server. It does not spawn processes like Apaches mod_fcgid does.

Due to the simplicity it should be even possible to use systemd as simple FastCGI server. [3] (I have never tried it)

My recommendation if you ever come across an FastCGI application which cannot open a socket / daemonize by itself use Apache mod_fcgid. Even if you already use another Webserver to handle HTTP. From all options I checked it has by far the most useful options to dynamically limit the number of worker processes and respawn them from time to time.

[1] https://en.wikipedia.org/wiki/FastCGI [2] https://en.wikipedia.org/wiki/MapServer [3] https://nileshgr.com/2016/07/09/systemd-fastcgi-multiple-pro...

Why wake up if your condition is not yet met? The wait timeout is the time after it should continue if it was not notified. It is meant to be waken up as soon as possible by a notify. If the value is available almost immediately it will wake up almost immediately whether it is wait(1000) or wait(5000).

That just opens the door for invalid combinations. As others said there is not only "_blank" but other special values like "_top".

  <a target-new-window=true target-top-frame=true target-self=true ...
Now the browser needs to define and document some kind of priority to solve those situations. If you can have only one target anyway why not simply give special targets special values.

I'm late to the party but want to add that "reference date 1875-05-20 defaults to 150 years" explanation makes no sense to me.

Assuming the reference date is correct and unknown birth date is stored as timestamp 0. Since we are before 2025-05-20 at the moment the reported age has to be 149 years, not 150. What I'm missing? Would be very unusual to round up age.

https://en.wikipedia.org/wiki/Session_fixation

In short, in at least one variation, the attacker is able to smuggle in a known (unauthenticated) session token into the victims browser. Once the victim logs in the session token is authenticated and known to the attacker.

The easy countermeasure is to renew the session token on login and not reuse a previously unauthenticated session token. Or your application has no session at all before login.

Great, a few more decades and it might become a usable bugtracker.

What's next on the list? Maybe priority/severity or status/resolution?

I helped on a quite large open source project for some time and loved working with Bugzilla. The announced switch to Github for that project was one reason I lost interest. I even prefer to work with a well administrated(!) Jira over Github issues.

In my opinion it should remain a shell thing. Adding tilde expansion just complicates the implementation of the tool. Now you need to know the current users home directory. And some tools might implement it incomplete so that '~' works but '~name' does not work.

In POSIX shells '~name' expands to the home directory of user 'name'

  $ echo ~bin
  /bin
Now your tool need a way to query home directory for any user including system users. Depending on NSS configuration this is more complicated than just reading /etc/passwd.

All for the rare case that someone passes a file path starting with tilde and wants it to be expanded. IMO, when you provide a file interactively you do so through a shell and tilde expansion is handled by the shell and otherwise just provide the actual file path and do not rely on the tool doing additional expansions.

PS: I mixed up TUI and CLI program a bit in my head. For an interactively used TUI program it might be beneficial to implement tilde expansion (but then it should be as complete as in Shells). A CLI program should not do magic stuff like tilde expansion.