linux – Why does this systemd service not run at the right time (loading encryption keys from a network drive which are required for lxc containers)?

In Debian with systemd, I use zfs and lxc. My zfs datasets are encrypted and their keys can be loaded from a network host via my /etc/zfs/zfs-load-key.sh script. My LXC containers are started by lxc.service.

Loading the keys requires the network up and running (otherwise I get the error “no route to host”) but lxc.service requires the keys to be loaded.

Sounds trivial, but isn’t. I created this file /etc/systemd/system/zfs-load-keyfile@.service:

(Unit)
Description=Load %I encryption keys from network host
DefaultDependencies=no
Before=zfs-mount.service lxc.service
After=zfs-import.target network-online.target
Requires=zfs-import.target
Wants=network-online.target

(Service)
Type=oneshot
RemainAfterExit=yes
ExecStart=/etc/zfs/zfs-load-key.sh %I

(Install)
WantedBy=zfs-mount.service lxc.service

and enabled them via:

systemctl enable zfs-load-keyfile@tank-dataset1.service
systemctl enable zfs-load-keyfile@tank-dataset2.service

For for some reason, my LXC containers do not start because the keys were not yet loaded, ALTHOUGH I have Before=... lxc.service!

Why does this service not run at the right time, i.e. after the network is up and before lxc?

How to fix it?

linux – Why does this systemd service not run at the right time?

In Debian with systemd, I use zfs and lxc. My zfs datasets are encrypted and their keys can be loaded from a network host via my /etc/zfs/zfs-load-key.sh script. My LXC containers are started by lxc.service.

Loading the keys requires the network up and running (otherwise I get the error “no route to host”) but lxc.service requires the keys to be loaded.

Sounds trivial, but isn’t. I created this file /etc/systemd/system/zfs-load-keyfile@.service:

(Unit)
Description=Load %I encryption keys from network host
DefaultDependencies=no
Before=zfs-mount.service lxc.service
After=zfs-import.target network-online.target
Requires=zfs-import.target
Wants=network-online.target

(Service)
Type=oneshot
RemainAfterExit=yes
ExecStart=/etc/zfs/zfs-load-key.sh %I

(Install)
WantedBy=zfs-mount.service lxc.service

and enabled them via:

systemctl enable zfs-load-keyfile@tank-dataset1.service
systemctl enable zfs-load-keyfile@tank-dataset2.service

For for some reason, my LXC containers do not start because the keys were not yet loaded, ALTHOUGH I have Before=... lxc.service!

Why does this service not run at the right time, i.e. after the network is up and before lxc?

How to fix it?

javascript – SP2013 Custom List – Date & Time Column

I have created a custom list on which both date and time needs to be captured on two specific fields. To comply with existing custom formatting on the new and edit forms, I need to re-size the three date and time input boxes to be the same total width as one standard input box.

I’m not an experienced coder but have managed this on the new form (see Image 1 below). However, when I apply the same code to the edit form the date input box resizes as it should, but the two time input boxes don’t (see Image 2 below). I can’t figure out why!

I’ve also attached my code snip below. If someone more experienced could let me know if I’ve made a schoolboy error, it will be a big help. Apologies for the poor quality images by the way. Thanks.

Image 1

Image 2

<style>

.ms-dtinput .ms-input {
 width: 180px;
}

</style>

<script type="text/javascript">
    
$(document).ready(function() {
   
$(".ms-dttimeinput").find("select")(0).style.width="80px";
$(".ms-dttimeinput").find("select")(1).style.width="50px";
$(".ms-dttimeinput").find("select")(2).style.width="80px";
$(".ms-dttimeinput").find("select")(3).style.width="50px"
    
    });
    
</script>

memory hardware – A doubt on best media for a time capsule

So, I have some data to a time capsule project of mine. But the thing is, I need to know the best media on long-time scale to use as storage unity. The time range is 120 years. Now, I’ve been thinking about two medias: the average CD-ROM/DVD-ROM and a outdated Vinyl/LP. On the one hand the CD/DVD is a good one, due to its dimensions and information space, but the question remains about the difficulties to read a CD/DVD in 2141. A vinyl LP could be more simple.

So my question is: what is the best media for a time capsule?

time complexity – How to determine which sorting algorithm will yield the optimum performance for an array?

I am presenting with the following arrays:

  1. [‘F’, ‘E’, ‘D’, ‘C’, ‘B’, ‘A’]
  2. [‘C’, ‘A’, ‘B’, ‘D’, ‘E’]

And for each array, I am asked to select which sorting algorithm would yield the optimal performance:

  1. Insertion Sort
  2. Quick Sort
  3. Radix Sort
  4. Merge Sort

I am somewhat confused as to how to go about solving this problem and more generally, figuring out which sorting algorithm is optimal for a specific case. I know that insertion sort works well on small arrays and the radix sort is optimized for sorting strings, but how do I know which sorting algorithm is the best?

customs and immigration – Going to Pakistan in 3 weeks time but my NICOP is expired and my son’s hasn’t arrived yet

Per TIMATIC, the database used by airlines:

Visa required, except for Passengers with an expired Pakistan
Origin Card (POC) or an expired National ID Card for Overseas Pakistanis (NICOP) can obtain a 72 hours landing permit on arrival.

So with a valid British passport and expired NICOP, you can get admitted for 72 hours. How to extend that, I don’t know, but I can’t imagine it not being possible (ask at passport control)

As for your child, they will need a NICOP, or else a visa.

javascript – Get latest time value from nested JSON

This is the response of the API I am hitting and I need to loop through the json and store the value of the latitude and longitude of the latest date-time in a variable. I am using `response.body[0/1].currentLocationLatitude to access the lat and long but I want to store just the latest one.

{
“Response”: {
“statusCode”: 200,
“body”: [
{
“currentLocationLatitude”: 40.7556985,
“currentTime”: “02/Mar/2021:21:00:47 +0000”,
“currentLocationLongitude”: -73.9908044,
},
{
“currentLocationLatitude”: 40.7565656,
“currentTime”: “02/Mar/2021:01:35:28 +0000”,
“currentLocationLongitude”: -73.9912589
}

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?

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