get posts – Why set cookie from URL parameter doesnt work all the time?

I use only “pages” from my WP installation (not posts) and I want to set a cookie based on the existence of a GET parameter in the URL.

I have put the following code in the top of my page.php:

if ( get_query_var('value') ) {

  $value=get_query_var('value');
  setcookie( 'value',$value, time() + 2592000, COOKIEPATH, 'domain.com' );
}

So if I visit url like: www.domain.com/page/?value=1234 I want to have a cookie: value: 1234 set for this domain.

The problem is that this doesn’t work all the time (seems to be working about 70% of the time), and sometimes the cookie is not set.

I have Autoptimize and WP Super Cache plugins enabled, and CF as CDN.

What I tried:
I’m far from expert in WP, but I understand that there is also the option to add a function to functions.php with the same purpose, but I didn’t managed to make it work at all like this.

Does it matter where in the body of page.php I put this code (should it be more down so that it always get executed?), or is there any other way to make sure the code is executed all the time.

I know that there are ways of setting cookie from JS as well, but I would preffer to do it from php.

How do i convert decimal time to hours and minutes?

How do i get the decimal time with scanf and put it in a variable and the print it as hours minutes and secondes in C.

Example:
Input: 1.23h

Output:1h 13min 48sec

backup – Can’t include external drive in Time Machine?

I want to also back up my external drive to another Time Machine drive, but when I want to stop Time Machine from excluding it, I can’t, since it’s not clickable:

Time Machine Preferences Screenshot

Here is some info about the drive I want to back up:

Disk Utility Screenshot

Does it have to be prepared/formatted in a certain way? If so, can I do that without deleting the data on it?

recurrence relation for this n queen problem algorithm . and the time complexity

I am not able to understand how to write a recurrence relation for this n queen problem algorithm down below. Recurrence relation is for n*n board and the time complexity

Algorithm : 8Queen(B) for the eight queens problem
Input : 2-dimensional array B()
Output: All solutions B() satisfying the condition for the eight queens problem
1 for i ← 1, 2,…, n do
2 for j ← 1, 2,…, n do
3 B(i, j) ← 0 ; /* Initialize the board /
4 end
5 end
6 for i ← 1, 2,…, n do
7 B(i, 1) ← 1 ; /
Put the first queen at B(1, j) /
8 QueenSub(B, 2) ; /
Proceed to the second column /
9 B(i, 1) ← 0 ; /
Remove the first queen from B(1, j) */
10 end

:
Algorithm : Subroutine QueenSub(B,J)
Input : 2-dimensional array B(), the number i of column
Output: Each B() that satisfies the conditions of the eight queens problem
1 for I ← 1, 2,…, N do
2 c ← 0 ; /* The number of threatening queens /
3 for k = 1,…,J − 1 do
4 if i − (j − k) > 0 then /
Queens on the left upper diagonal? /
5 c ← c + B( i − (j − k),k);
6 end
7 c ← c + B(i,k) ; /
Queens on the left of B(i, j)? /
8 if i + (j − k)) < 9 then /
Queens on the left lower diagonal? /
9 c ← c + B(i + (j − k), k);
10 end
11 end
12 if c = 0 then /
No queen threatening here /
13 B(i, j) ← 1 ; /
Put a queen at B(i, j) /
14 if i = 8 then /
The last column? /
15 output B() ; /
This is a solution /
16 else
17 QueenSub(B,j + 1) ; /
Proceed to the next column /
18 end
19 B(i, j) ← 0 ; /
Remove the queen from B(i, j) */
20 end
21 end

c# – Breadth first event synchronization based on a frequency or time series

I have an interesting and problem I’m facing. I’m trying to maintain a set of metrics independently based off of a time frequency.

Note: This is a simplification of the problem I’ve omitted pieces of the code the remain brief
I have a simple architecture which looks like so:

public interface INode<TIn, TOut> : IBaseNode
{
    event EventHandler<TOut> Output; 
    void Subscribe(IBaseNode node);
    void OnInput(object sender, TIn input)
}

I have a bunch of nodes which independently subscribe to pieces of data they want to track which can be depicted as so:

enter image description here

All of the events are fired from a parent node in a Breadth First Manner. So the nodes that are further away from the original event will fire after, which means that the Nodes that are further away from the originating node will take longer to fire since they are dependent on the nodes before them provide output. Additionally, since new nodes are coming in, some nodes may fire multiple times before reach other nodes in the chain of events.

I’m looking for a strategy to keep these relatively in sync. Based off their frequency. e.g If the frequency is 3 requests per 1000ms I would like to be sure that All of the PriceMA and the Volume MA values are processed for that specific time frame before doing additional calculations

My intuition say that this should be solved relatively easy by added a Synchronization Node at the end which waits for all subscribed nodes to be complete based off of some requestId e.g:

enter image description here

However seeing as I’ve never done this before, I’m not sure that’s the best strategy, since I want all events which occur within a specific time frame to be processed prior to chains in other time frames.

What is a relatively reliable strategy for handling breadth first synchronization of events?

python – How to increase time efficiency and performance of sudoku solver

How can I decrease the time complexity and increase efficiency, without writing a new algorithm. My solution solves the majority of sudoku puzzles in a fast time, but for some difficult ones it can take over a minute! I have added some of the difficult puzzles below the code.

import numpy as np
from skimage.util import view_as_blocks  # pip install scikit-image

#input: 9x9 numpy array, empty cell = 0 
#output: 9x9 numpy array: if not solution all array entries should be -1
#backtracking depth-first search with constraint propagation




#searches for 0 value in board
def zero_search(sudoku):
    for i in range(len(sudoku)):
        for j in range(len(sudoku(0))):
            if sudoku(i)(j) == 0:
                return (i, j)  # row, col

    return False



#parameters: board, num = inserted value, pos = board position(vector/tuple)
def valid(sudoku, num, pos):
    # Check row
    for i in range(len(sudoku(0))):
        if sudoku(pos(0))(i) == num and pos(1) != i:
            return False

    # Check column
    for i in range(len(sudoku)):
        if sudoku(i)(pos(1)) == num and pos(0) != i:
            return False

    # Check box
    box_x = pos(1) // 3
    box_y = pos(0) // 3

    #y-axis/columns 
    for i in range(box_y*3, box_y*3 + 3):
        #x-axis/rows
        for j in range(box_x * 3, box_x*3 + 3):
            if sudoku(i)(j) == num and (i,j) != pos:
                return False

    return True


def solver(sudoku):
    
    find = zero_search(sudoku)
    if not find:
        return True
    
    else:
        row, col = find

    #check insertion values 1-9
    for i in range(1,10):
        if valid(sudoku, i, (row, col)):
            sudoku(row)(col) = i
            
            if solver(sudoku):
                return True

            sudoku(row)(col) = 0
            
    return False 
    
    
    
def initial_invalid(sudoku):

    # Check row
    for i in range(9):
        dup_lst=()
        for j in range(9):
            if sudoku(j)(i)!=0:
                if sudoku(j)(i) in dup_lst:
                    return True

                else:
                    dup_lst.append(sudoku(j)(i))
     
    #check column
    for i in range(9):
        dup_lst=()
        for j in range(9):
            if sudoku(i)(j)!=0:
                if sudoku(i)(j) in dup_lst:
                    return True

                else:
                    dup_lst.append(sudoku(i)(j))
                    
                    
    

#not needed
def final_valid (sudoku):

    subgrids = view_as_blocks(sudoku, (3, 3))

    sums = (np.sum(subgrids(i)(j)) for j in range(3) for i in range(3))
    if sum(sums) !=405:
        return False
    
    else:
        return True
    
    #row_sum = sudoku.sum(axis=1)
    #if sum(row_sum) != 405:
    #   return False

    #col_sum = sudoku.sum(axis=0)
    #if sum(col_sum) != 405:
    #    return False
        

    
def sudoku_solver(sudoku):

    if initial_invalid(sudoku):
        return np.full((9,9),-1)
        
    if solver(sudoku):
            return sudoku
    else:
        return np.full((9,9),-1)
((0 8 0 4 3 0 0 0 0)
 (0 0 5 0 0 9 0 0 0)
 (6 0 0 0 8 0 0 7 0)
 (0 0 0 0 9 0 0 0 3)
 (0 0 0 8 0 7 0 0 0)
 (9 0 0 0 0 0 0 5 4)
 (0 6 0 0 0 0 0 0 5)
 (0 0 8 0 0 0 4 0 0)
 (0 4 0 0 0 6 0 1 0))


((0 0 2 0 0 0 0 0 4)
 (0 5 0 0 1 3 7 0 0)
 (7 9 0 0 0 0 0 5 0)
 (0 0 9 0 0 0 0 6 0)
 (0 0 0 0 3 0 5 0 8)
 (5 0 7 0 0 0 4 0 0)
 (0 0 0 0 6 0 8 0 0)
 (0 6 0 0 2 7 0 4 0)
 (8 0 0 0 0 0 0 2 0))


((0 0 0 6 0 0 2 0 0)
 (0 0 0 0 0 9 0 6 0)
 (0 8 0 0 0 5 0 0 3)
 (1 0 0 4 0 0 9 0 0)
 (8 3 0 0 0 0 0 0 0)
 (0 2 0 0 0 6 0 0 0)
 (0 0 0 0 6 0 0 0 0)
 (2 5 0 3 0 7 0 9 0)
 (0 0 1 0 0 0 0 8 4))

windows – Is there a way to make a script to update chromium instead of downloading and extracting it every time

Here is the answer. Open powershell editor and copy and paste this.

Write-Output 'Updating Chromium'
$ProgressPreference = 'SilentlyContinue'
cd $env:userprofileAppDataLocalTemp
Write-Output 'Downloading'
Invoke-WebRequest https://download-chromium.appspot.com/dl/Win_x64?type=snapshots -OutFile 
$env:userprofileAppDataLocalTempChromium.zip
Remove-Item '$env:userprofileLocal Appschrome-win' -Recurse
Write-Output 'Unpacking Files'
Add-Type -AssemblyName System.IO.Compression.FileSystem
function Unzip
{
    param((string)$zipfile, (string)$outpath)

    (System.IO.Compression.ZipFile)::ExtractToDirectory($zipfile, $outpath)
}

Unzip "$env:userprofileAppDataLocalTempChromium.zip" "$env:userprofileLocal Apps"
Remove-Item '$env:userprofileAppDataLocalTempChromium.zip'

$WshShell = New-Object -comObject WScript.Shell
$Shortcut = $WshShell.CreateShortcut("$HomeAppDataRoamingMicrosoftWindowsStart MenuProgramsChrome.lnk")
$Shortcut.TargetPath = "$env:userprofileLocal Appschrome.exe"
$Shortcut.Save()

If there are any problems with the script, let me know

transit – Tocumen international airport (PTY) international connection time

I have the following route below. Can someone tell me if 1.2 hours is enough for taking the connecting flight in Panama? This will be international to international (arriving from GRU and departing to NAS).

From my research, it seems this is a tiny airport with only 2 terminals and the videos online showed that it is virtually empty due to COVID. There will also be no checked in luggage…only luggage will be carry on.

Legend: CMB - Sri Lanka, DXB - Dubai, GRU - Brazil, PTY - Panama, NAS - Bahamas, FPO - Bahamas

                 CMB      DXB      GRU      PTY      NAS      FPO
      03/26      02:55    05:55                                             Emirates
                          09:05    17:20                                    Emirates
      03/27                        01:30    06:24                           Copa
                                            07:48    11:42                  Copa
                                                     15:30    16:15         Bahamas Air

privacy – Can two locations in the same city at the same time have the same IP adress?

Details here depend on your specific ISP setup, but it might well be that multiple customers share the same public IP address. This is called NAT or in case of ISP CG-NAT (carrier grade NAT). It is pretty common for ISP in mobile networks but is also not uncommon with cable or DSL. The main reason is that there is a shortage of public IPv4 addresses so ISP often own less public IPv4 addresses than they have customers.
If this is the case in your specific situation depends on your ISP – thus ask the ISP.

Note that even with one public IP per customer it might well be that these change over time and thus a different customer is assigned an IP one had before. If the ISP assigns a fixed public IP to a customer is again specific to ISP and kind of contract – thus check with your ISP or read the contract.

Should I just change my ISP and get a new IP adress?

Each ISP has a pool of IPv4 they can use and different ISP use different pools. It does not change the general problem though, i.e. that it might be that the IPv4 is shared with others. Ask the new ISP for details.

Is this the ISP’s fault for giving two households the same IP?

Unless a fixed public IP address is explicitly mentioned in the contract their is usually no obligation to assign a fixed IP address to a customer.

Could I be blamed for anything they do online?

Blaming somebody is often done without fully understanding things. This does not mean that they are right nor does this mean that this can result in legal actions against you.

Encrypted communication system without CPU backdoor that is able to resist quantum computers. Would it be used in the future or am I wasting my time? [closed]

This is a proceed I invented. Possibility to send 300 characters at a time. Two devices with camera are necessary, one device has Internet the other device not.

white paper pdf : k o d b i l d (dot) c o m / k b i t