7 – Adding a prefix and suffix

I’m on a project that involves me having to add a prefix and suffix to the admin toolbar (to the highest level, div#admin-menu; the admin_menu_toolbar module is enabled) on a Drupal 7 site. The goal would be to wrap the administration menu with another tag. I’ve been looking around for preprocesses and hooks but there’s nothing I can find.

Is there a way to achieve this?

Lua: Adding underlines to a string

Say I have a string
local s = "Hello world"
And I want to add underlines to it
Anyway I want the result string to be:
H͟e͟l͟l͟o͟ ͟w͟o͟r͟l͟d͟

How would I do this?

structured text – StructuredText client on a PLC, adding a C# server

This is ST code running on a PLC, apparently it’s a client, that connects to a server running in Labview.
I need to create a tcp server in c# to talk to it. Any chance of breaking down what’s happening here?

// Start sequence when Trigger changes to TRUE.

IF ( (Enable=TRUE) AND (DoTCP=FALSE) AND (_Eip_EtnOnlineSta=TRUE) ) THEN
    DoTCP:=TRUE;
  
IF (TCP_Conn_Status = _CLOSED) OR (TCP_Conn_Status = _CLOSE_WAIT) OR (TCP_Conn_Status = _CLOSING)  THEN //(TCP_Conn_Status <> _ESTABLISHED) THEN
    Stage := 1; //try connect if not estabilished yet
ELSE
    Stage:=2;   //only check status, avoid open another port and lose sync.     
END_IF;

SktTCPConnect_instance(Execute:=FALSE);  // Initialize instance.
SktClearBuf_instance(Execute:=FALSE);  // Initialize instance.
SktGetTCPStatus_instance(Execute:=FALSE);  // Initialize instance.
SktTCPSend_instance(  // Initialize instance.
    Execute:=FALSE,
    SendDat:= dummy_dat(0));  // Dummy
SktTCPRcv_instance(  // Initialize instance.
    Execute:=FALSE,
    RcvDat :=dummy_dat(0));  // Dummy
SktClose_instance(Execute:=FALSE);  // Initialize instance.
END_IF;

IF (DoTCP=TRUE) THEN

CASE Stage OF
        
    1:  // Request a connection.
        SktTCPConnect_instance(
            Execute   :=TRUE,
            SrcTcpPort:=UINT#0,  // Local TCP port number: Automatically assigned.
            DstAdr    :=IP_Address,  // Remote IP address
            DstTcpPort:=Remote_Port,  // Destination TCP port number
            Socket =>TCP_Conn_WkSocket);  // Socket     
            
        IF (SktTCPConnect_instance.Done=TRUE) THEN
            Stage:=INT#2;  //check TCP status               
        ELSIF (SktTCPConnect_instance.Error=TRUE) THEN
            error_ID := (SktTCPConnect_instance.ErrorID);
            //TCP_Conn_Status := _CLOSED;
            IF (error_ID = WORD#16#2008) THEN //never lock error to else state
                Stage:=INT#6; //errorID=2008 - Socket Communications Resource Overflow
            ELSE
                Stage:=INT#2;  // always check TCP status
            END_IF; 
                    
        END_IF;
        

    2: //request status
        SktGetTCPStatus_instance(
            Execute:=TRUE,
            Socket :=TCP_Conn_WkSocket);  // Socket
                        
        IF (SktGetTCPStatus_instance.Done) THEN
            TCP_Conn_Status := SktGetTCPStatus_instance.TcpStatus;
            IF (TCP_Conn_Status <> _ESTABLISHED) THEN //(TCP_Conn_Status = _CLOSED) OR (TCP_Conn_Status = _CLOSE_WAIT) OR (TCP_Conn_Status = _CLOSING) THEN
                Stage:=INT#0;   //go to end
            ELSE
                Stage:=INT#3;   //continue normal flow
            END_IF;
                                                
        ELSIF (SktGetTCPStatus_instance.Error=TRUE) THEN
            error_ID:=(SktGetTCPStatus_instance.ErrorID);
            Stage:=INT#20; // Error end
        END_IF;
            
    3:   //  sending message
        Payload_local:= Payload_Client_IN;  
                    
        Msg_size_byte := CRC_size_byte + ToAryByte(Payload_local,_LOW_HIGH,SendSocketDat(0)) + UINT#2;  ////payload size + CRC (bytes)
        Msg_size:= ToAryByte(Msg_size_byte,_LOW_HIGH,SendSocketDat(0));     //replace first two bytes with payload  + CRC size 
        Msg_size_byte :=ToAryByte(Payload_local,_LOW_HIGH,SendSocketDat(2));    //replace rest of the array with palyload as bytes
        
        Payload_CRC_send := AryCRCCCITT(SendSocketDat(0),(Msg_size_byte+Msg_size),WORD#0,_LOW_HIGH);        //calculates (size +payload) CRC
        Msg_size_CRC :=ToAryByte(Payload_CRC_send,_LOW_HIGH,SendSocketDat(Msg_size_byte+Msg_size)); //append CRC as bytes to the end of the array
        
        SktTCPSend_instance(
            Execute:=TRUE,
            Socket :=TCP_Conn_WkSocket,  // Socket
            SendDat:= SendSocketDat(0),// TCP_Message_Send(0),  // Send data
            Size   := Msg_size_byte+Msg_size+Msg_size_CRC); // msg payload + payload size + CRC 16
            
        IF (SktTCPSend_instance.Done=TRUE) THEN
            Stage:=INT#4;  // go to read buffer
            SktTCPSend_instance(  // reinitialize instance.
                Execute:=FALSE,
                SendDat:= dummy_dat(0));
            SktTCPRcv_instance( //reset instance
                Execute:=FALSE,
                RcvDat :=dummy_dat(0));
            
        ELSIF (SktTCPSend_instance.Error=TRUE) THEN             
            error_ID:=( SktTCPSend_instance.ErrorID);               
            IF (error_ID =  WORD#16#2006) THEN // OR error_ID = WORD#16#2003) THEN
                Stage:=INT#5;  // time out - clear buffer only
            ELSE
                Stage:=INT#30;  // Error end
            END_IF;
                                    
        END_IF;
        
                            
    4:  // Request receiving message size only
        SktTCPRcv_instance(
            Execute:=TRUE,
            Socket :=TCP_Conn_WkSocket,  // Socket
            TimeOut:=UINT#10,  // Timeout time: 1 x (0.1 sec)
            Size   :=UINT#2,  // Receive data size
            RcvDat := RcvSocketDat(0));  // Receive data
     
        IF (SktTCPRcv_instance.Done=TRUE) THEN              
            Stage:=INT#41;  // Normal end
            SktTCPRcv_instance( //reset instance
                Execute:=FALSE,
                RcvDat :=dummy_dat(0));
                            
        ELSIF (SktTCPRcv_instance.Error=TRUE) THEN              
            error_ID:=(SktTCPRcv_instance.ErrorID);             
            IF (error_ID =  WORD#16#2006) THEN // OR error_ID = WORD#16#2003) THEN
                Stage:=INT#5;  // time out - clear buffer only              
            ELSE
                Stage:=INT#40;
            END_IF;
            
        END_IF;
        
    41: // Request receiving payload
        
        AryByteTo (RcvSocketDat(0),UINT#2,_LOW_HIGH,Msg_size_byte_send);    //convert byte array to message size
        
        SktTCPRcv_instance(
            Execute:=TRUE,
            Socket :=TCP_Conn_WkSocket,  // Socket
            TimeOut:=UINT#10,  // Timeout time 10 x 0.1s - 1sec
            Size   :=Msg_size_byte_send,  // Receive data size
            RcvDat := RcvSocketDat(2));  // Receive data
     
        IF (SktTCPRcv_instance.Done=TRUE) THEN
            Stage:=INT#5;  // normal end
            
            Payload_CRC_receive_recalc:= AryCRCCCITT(RcvSocketDat(0),Msg_size_byte_send,WORD#0,_LOW_HIGH);  //calculate CRC from received message (add size, but exclude CRC on the payload)
            AryByteTo(RcvSocketDat(Msg_size_byte_send),UINT#2,_LOW_HIGH,Payload_CRC_receive);
            IF (Payload_CRC_receive = Payload_CRC_receive_recalc) then
                payload_received:=AryByteTo(RcvSocketDat(2),Msg_size_byte_send - UINT#2,_LOW_HIGH,Payload_Server_OUT);  //convert array of bytes to dta type, excluding msg size and CRC
            END_IF;
            
        ELSIF (SktTCPRcv_instance.Error=TRUE) THEN              
            error_ID:=(SktTCPRcv_instance.ErrorID);             
            IF (error_ID =  WORD#16#2006) THEN // OR error_ID = WORD#16#2003) THEN
                Stage:=INT#5;  // time out - clear buffer only              
            ELSE
                Stage:=INT#410;
            END_IF;
            
        END_IF;
        
        
     5:  // Clear receive buffer.
        SktClearBuf_instance(
            Execute:=TRUE,
            Socket :=TCP_Conn_WkSocket);  // Socket
     
        IF (SktClearBuf_instance.Done=TRUE) THEN
            Stage:=INT#0;  // check connection
        ELSIF (SktClearBuf_instance.Error=TRUE) THEN
            error_ID:=(SktClearBuf_instance.ErrorID);
            Stage:=INT#50;  // Error end
        END_IF;
 
    6:  // Request closing.
        SktClose_instance(
            Execute:=TRUE,
            Socket :=TCP_Conn_WkSocket);  // Socket
                            
        IF (SktClose_instance.Done=TRUE) THEN 
            Stage:=INT#0;  // Normal end
            TCP_Conn_Status:= _CLOSED;
        ELSIF (SktClose_instance.Error=TRUE) THEN
            error_ID:=(SktClose_instance.ErrorID);
            IF (SktClose_instance.ErrorID = WORD#16#2007) THEN//errrorID = 2007 --> Socket Handle Out of Range(closed)
                Stage:=0;
                //TCP_Conn_Status:= _CLOSED;
            ELSE
                Stage:=INT#60;  // Error end
            END_IF;
            
        END_IF;
        
    0:  // Normal end
        DoTCP  :=FALSE;
        Done:= TRUE;
        
        SktTCPSend_instance(  // reinitialize instance.
            Execute:=FALSE,
            SendDat:= dummy_dat(0));
        SktTCPRcv_instance( //reset instance
            Execute:=FALSE,
            RcvDat :=dummy_dat(0)); 
            
    ELSE  // Interrupted by error.
        IF (error_ID = WORD#16#2003 OR error_ID = WORD#16#2008) THEN //Socket Status Error
                //Stage:=UINT#2;    //force reopen
                //error_ID:=WORD#16#0;
                TCP_Conn_Status:= _CLOSED;
                //TCP_Conn_Status:= TCP_Conn_Status;
        END_IF;             
            DoTCP  :=FALSE;//use FALSE to reset states, use TRUE to trap error during debug
            Done := FALSE;              
            SktTCPSend_instance(  // reinitialize instance.
                Execute:=FALSE,
                SendDat:= dummy_dat(0));
            SktTCPRcv_instance( //reset instance
                Execute:=FALSE,
                RcvDat :=dummy_dat(0));
        //END_IF;               
END_CASE;
END_IF;

sql server – Creating Temporal table without adding DateTime columns

I’m an SQL server DBA and new to Temporal tables. We have the following issue:
As part of implementing temporal tables mechanism , there’s a need to add to datetime columns (so DWH will have the ability to investigate only last modified columns).

  1. 1st problem is that our R&D are trying to avoid from altering table structure (adding columns) as it is a sensitive and big table.

  2. 2nd problem is that the original table contains MODIF DATE column.
    This column is being updated at the datetime value of the update transaction beginning time warriors I need the COMMIT time.(gaps are critical)

enter image description here

My question:

Is there a possibility to turn the original table to Temporal one , without adding columns and only by using the CREATION date and MODIF date built-in columns?

Will appreciate any support here!

Building Huffman tree adding one letter at a time versus building it from two ends

I entered ‘abcde’ in this Huffman encoding generator and hit play and saw it build 2 separate trees first for the shortest and then for the longest encoding. How would it be if one added one character at a time? When do you begin with building from both ends?

Adding Weather Sealing to Mirrorless Camera

I am on the hunt, to move from my D850 to a mirrorless system.

The problem is, no system appears to be no system as good as my D850, for my style of Landscape / Cityscape photography.

The Z7 would be great, but the lens support for my Tamron lenses and a lack of affordable direct replacements (15-30 f2.8, 70-200 f2.8) or similar is sort of a deal breaker.

Canon’s dynamic range is sort of concerning, although after using the EOS R briefly (in store) it was a great second choice.

Sony, is currently my top choice, but the problem is weather sealing.

I shoot out on backbacking trips (hence wanting a lighter system). Trips can also include trips abroad can include being out in the snow, the rain forest, the dessert, in a kayak going between islands or on a beach with spray. My Nikon’s have survived all of these things. I need the next system to do the same.

Which brings me to the question:

In Japan I’ve seen a lot of shooters with “Camera armor”. It’s primary purpose is to protect the paint and chrome bits of the camera. But I’m wondering if a thing exists that is more or less a weather sealing silicon sleeve for the camera?

Is it possible to add weather sealing to a camera?

I’d like to exclude anything that:

  1. restricts the system to a single lens (like under water kits).
  2. Adds significant weight or bulk
  3. Is just a fancy bag that would interfere with using the camera (viewfinder, with gloves etc.)

Binance Announces Adding 5 Trading Pairs

Binance has announced that it will add new trading pairs to popular cryptocurrencies recently. Frontier (FRONT) and BakeryToken (BAKE) are among these currencies, which had a significant breakthrough yesterday.
Here are the new trading pairs:
FROT / BTC,
EASY / BTC,
CAKE / BTC,
CAKE / USDT
BAKE / BUSD
What do you think about these innovations?

matrix – Problem with the Table function when adding together

I am a newbie, I have a problem with the Table. Can anyone explain to me understand?
For example> I did the expression Qk1, Qk2 with table function such : Qk1=Table(A((i+1,1)).B,{i,0,4), Qk2=Table(C((i+1,1)).D,{i,0,4) and then make Qk=Qk1+Qk2.

When I call again Qk to calculate another expression Mk=Qk((i+1,1)).X, it only understands that Qk is Qk1 if I change Qk((i+1,1)) to Qk((i+1,2)) it understands that Qk now is Qk2.

For clearly:
Results from Qk1={a,b,c,d}, and Qk2={e,f,g,h} => Qk={a+e,b+f,c+g,d+h}
When calculating Mk=Qk((i+1,1)).X the result is Mk={ax,bx,cx,dx} while Mk=Qk((i+1,2)).X the result is Mk={ex,fx,gx,hx}.
Following logically,It should be Mk={(a+e)x,(b+f)x,(c+g)x,(d+h)x}

boot – Can’t install windows after adding another stick of ram

So, I have a MSI Bazooka MAX(wifi) MB and a 32gb 3600mhz cl18 2×16 kit of g.skill trident z rgb memory. When I got the last of my computer components, I didn’t put in the second stick of ram in its slot correctly, after doing this i installed ubuntu, and tested out my new computer for a few minutes, then I realized I only had 16gb of ram and not 32, I reseated my ram, and in the bios, it was picking up the 32gbs fine, but ubuntu kept bugging and crashing every time I opened up more than too tabs in Brave Browser, I kept getting a memory error. I eventually gave up and tried to install windows, around 6 times… I got a 16gb USB stick with the correct formatting, get the setup from Microsoft, and ran the installation. After it finishes installing. My computer turns off and on a few times, then gives a error, its different each time, so I can give the specific one. When I gave up on windows, I decided to install PopOS a distro of Linux based on ubuntu, and currently, its working completely fine and I’ve had no problems so far. There are still a lot of programs I need that are windows only though, so if you have any idea what’s going on and/or why its happening, I would really appreciate your advice. Thanks!

Full PC Specs:
CPU: Ryzen 5 3400g
MB:  MSI Bazooka b450 max(WIFI)
RAM: G.Skill TridentZ RGB 3600mhz cl18 2x16gb
GPU: N/A
PSU: EVGA b5 80+ bronze 650w psu

8 – Edit Field in Custom Content by adding #states property

I have custom content and there are fields, for example field “dog_name”. I declared those fields in .yml files. I have a question – is it possible to edit them programmatically and add to them #states property? I need one field showing after choose particular option in other field. I found how to do it with forms, but i need to do it with fields. I know that Drupal has conditional module, but I need to implement it without any external modules.