signature – Can Block-version signalling still be implemented and how to do that with the current code base?

There is a generation of softforks used the block header’s nVersion field for signalling (up to the year 2015). Each of those used a subsequent version numbers (BIP34 used version 2; BIP66 used version 3; BIP65 used version 4).

Whenever 750 out blocks number N-1000..N-1 (so 75%) had the proposal’s version number of higher, block N would be subject to the proposal’s rules. Whenever 950 out of blocks number N-1000..N-1 (so 95%) did, the next block would be required to also signal for it – resulting in a final lock-in.

I want to build a simple bitcoin version for myself and want to sign another version for the block that I mine. In the past what the developer had to do was changing the CURRENT_VERSION of block into a new number (like BIP34:

But the code base has changed now so I’m not sure what I need to do if I want the same thing, can anybody tell me what to do? I think I need to change VERSIONBITS_TOP_BITS into a new number but I believe that may be not the correct way.

naming – Pattern name to compare previous raw values to current values

I find myself applying a certain pattern again and again and I assume I am not the first one. I am looking for a name.

In the environment I find myself in we get updates to values via an external interface. Based on those updates, we have to produce certain effects. Practically, our effects not only depend on the current value, but also on the history.
For example, we might observe a traffic light, and if it turns red without passing yellow in between, we warn.

class TrafficLight {
    boolean red
    boolean yellow
    boolean green
    // TrafficLight part of interface -- cannot add methods

updateTrafficLight(TrafficLight current) {
    if (roadClear &&
        log.warn( "switched from plain green to red without yellow in between!" ) // example effect
    roadClear = && !current.yellow && !
   // 50 more effects, might be organized in methods / classes

The main problem are flags like roadClear which extract some information from an update. Those flags are read on the next update. With the 50 other effects, the state becomes untractable and every little refactoring might introduce bugs because the sequence of setting the (previous)state and reading it might be shuffled.

These TrafficLight updates are well logged, part of the specification and analysed by external suppliers. So I often find myself refactoring this into mostly pure stateless functions that compare the previous update and the current value like this:

compareTrafficLight(TrafficLight previous, TrafficLight current) {
    if (isRoadClear(previous) &&
        log.warn( "switched from plain green to red without yellow in between!" ) // example effect

boolean isRoadClear(TrafficLight trafficLight) {
    return && !trafficLight.yellow && !

Does this bundling of current and previous value (and avoid other state) have a name?
It might be worth noting that it gives rise to a container Diff<T>. Instead of Diff, there might be an accepted name. Diff has map (Functor) and flatMap (Monad).

Diff<T> {
    T getPrevious()
    T getCurrent()

macos – Customise bash or zsh to show git branch, working directory and current user

Could someone give me the code of how to make bash and zsh to show something like thisenter image description here

The first thing(black) is the current user of the computer. The second thing(blue) is the working directory and the 3rd thing(yellow) shows the git branch. The hex for 2nd one is #0568F1 and for the 3rd it is #e5e410. There is no need for the triangle shaped thing at the end but it would be good if you include it too.

PS: I’m using mac Big Sur and iTerm. I’m sorry if this seems obvious but I’m an absolute noob at terminal configuration.

customization – Get All Results From Other Users That Share The Same Custom User Meta As Current User

I am pretty new to extending wordpress and trying to get my head around using Mysql and PHP to fetch data into a html table and print it on a wp page.
What i have so far is fetching all form data to display a pass or fail by matching the result from a score and max_score column in the table wp_testing_data

This is the tricky part that i just cannot find any details of how to make the query.
If the current user visits the page with the html table output, i want it to only display entries from other users that have the same site_id in the wp_usermeta table as the current user

In theory, the user viewing the page has a site_id entry in the wp_usermeta table of DE49.
Now i want to only show the pass or fail results table if the results are from other users with the site_id value equal to the current users site_id value.
The site_id will be unique to a group of users, so putting the actual result (DE49) as the target isn’t the answer. It needs to be dynamic to the user viewing the page at that time (current user).
Basically, you can only see the results from members of your own group. In this case the group is stored in the site_id column of the wp_usermeta table.
I can get all results using the following, but cannot figure out only getting results from users with a matching meta value.

global $wpdb;
$result = $wpdb->get_results( "SELECT f_name, l_name, date, IF(score = max_score, 'PASSED','FAILED') AS score 
FROM wp_testing_data, wp_usermeta
WHERE wp_usermeta.meta_key = 'site_id'
AND wp_usermeta.meta_value = 'DE49'");

echo "<style>";
echo "body {font-family: Arial;}";

echo ".table_container { padding: 10px 12px 0px 12px;  border: 1px solid #ccc;  }";
echo ".table_container th { background-color:lightblue; color:#000; font-weight:bold; border-left: 1px solid white;}";
echo "</style></head>";
echo "<body>";

echo "<div class="table_container"><table>";
echo "<tr><th style="padding-left:10px;">First Name</th><th>Last Name</th><th>Date</th><th>Score</th></tr>";
foreach ($result as $row) {
    echo "<tr><td>" . $row->f_name. "</td><td>" . $row->l_name . "</td><td>" . $row->date . "</td><td>" . $row->score. "</tr>";
echo "</table></div>";


Any guides or rough ideas would be greatly appreciated and thanks for taking the time to read my post.

views – Get the user’s current language code

How can I get the user’s current language code in a view as a raw value, for example en or fr-ca?

This isn’t for filtering content. I need the raw value of the users’ current language to pass into a URL for a third-party tool. I added a custom text field. Then placed in some Twig code. The code is just failing to the fallback else value.

Based on other forum posts, I tried this code.

{% if language.getId() == 'en' %}
{% elseif language.getId() == 'es-us' %}
{% elseif language.getId() == 'en-us' %}
{% else %}
{% endif %}

I get failed.

{% if language == 'en' %} 
{% elseif language == 'es-us' %}
{% elseif language == 'en-us' %}
{% else %}
{% endif %}

I still get failed.

{% if == 'en' %}
{% elseif == 'es-us' %}
{% elseif == 'en-us' %}
{% else %}
{% endif %}

I still get the same output.

php – Validator and Sanitizer for HTML 5 attribute regex according to current HTML living standard

According to an HTML 5 attribute name is defined like this:

Attribute names must consist of one or more characters other than
controls, U+0020 SPACE, U+0022 (“), U+0027 (‘), U+003E (>), U+002F
(/), U+003D (=), and noncharacters. In the HTML syntax, attribute
names, even those for foreign elements, may be written with any mix of
ASCII lower and ASCII upper alphas.

Creating a class which can handle or sanitize HTML 5 attribute names I have ended up with the following code – especially the following regex:

class AttributeNameValidator
    public const ATTRIBUTE_NAME_MATCHER = "/(sx{0000}x{0020}x{0022}x{0027}x{003E}x{002F}x{003D}x{200B}-x{200D}x{FDD0}-x{FDEF}x{FEFF}(:cntrl:))+/u";

     * Checks if a given string is a valid HTML attribute name.
     * @param string $attributeName
     * @return bool: True if the given attribute name is a valid HTML attribute name.
    public static function isAttributeNameValid(string $attributeName): bool
        return (bool)preg_match(self::ATTRIBUTE_NAME_MATCHER, $attributeName);

     * Sanitizes a string to be a valid HTML5 attribute name.
     * @param string $attributeName
     * @return string
     * @throws NonSanitizeableException
    public static function sanitizeAttributeName(string $attributeName): string
        $sanitizedAttributeName = preg_replace(self::ATTRIBUTE_NAME_MATCHER, '', $attributeName);
        if(!$sanitizedAttributeName) {
            throw new NonSanitizeableException("Failed to sanitize attribute name");
        return $sanitizedAttributeName;

My manual tests seem to work well still I am not sure if the regex exactly matches the standard or if I have forgotten something. Is there still something to improve?