object-oriented – simple architecture with Swift Combine

I took out code, components and changed names, but hopefully this is enough to get the idea.
For your information, I can't change the super class from Event (MyOperation) and EventExecutor (MyQueue).

Major classes

  1. StateStepper – does all the work. A publisher (combine). When an event completes, StateObj is output for streaming
  2. Manager – manages the workflow, listens for state transitions / emissions via StateStepper and executes the next event.
  3. EventExecutor – is a queue. Executes an event in the queue when super.start () is called. There is an executor for each event
  4. Event – Executes a single asynchronous task. Responsible for handling, saving results and moving errors. There is a status that represents each event.
  5. Config – Provides shared data between events, clients, and all data specific to the current session. Better name for that would be Session, or Environment.

Code smell

  1. StateStepper's approach? I basically want this to control the sequence of events.
  2. Handle state. States that I used are arbitrary, but basically there is an event, an EventExecutor and a state, all of which are related. So what's a more sophisticated way to manage status and get the next event? I think in my case is it easy?
  3. Approval of the configuration for all events, executors and managers.
  4. Config contains stateStepper so that all events can be sent for streaming, but apparently should only belong to the manager.
  5. Workaround to provide a declarative API for Event and EventExecutor. Instead of overwriting and calling start (), I offer a method to return Subject.
  6. The event is responsible for sending statusObj, stateObj and stateObj to stateStepper after completion. Code is messy here.
  7. Troubleshooting: You need to understand how the combine handles it. Events should end with a stream that contains an optional error.
  8. Implementation of start Method in DownloadEvent.

Class config {
var stateStepper: PassthroughSubject
var stateObj: StateObj
var statusObj: StatusObj
var client: client // network client
var subscriptions = Set ()
}}

// Stored in realm db when event completes
// Used in `stateStepper` stream.
class StateObj: RealmObj {
    // state when last event completed. also required in payload of events.
    var state: State?
    var uuid: String?
}


// Represents data,status,progress that needs to be saved
// convenient way to share data across related/dependent events
class StatusObj: RealmObj {
    var payload: Data
    var modifiedDate: Int?
}

// extension realm CRUD API for statusObj & StateObj
extension RealmObj {
    func save() {
    }
}

enum State {
    case Idle
    case CheckStatus
    case Download
    case Confirm
}

class Manager {

    var config: Config

    func start() {
        config.stateStepper
            .map { self.nextEvent($0) }
            .map { event.execute() }
            .sink(receiveCompletion: { (completion) in
                    // did complete
                }) { (error) in
                    // handle error. if nil, event completed successfully
            }.store(in: &config.subscriptions)
    }

    // Provides arg for `nextEvent` to retreive next event based on state of last completed event.
    func nextEvent(_ stateObj: StateObj?) -> EventExecutor? {
        switch (stateObj.state) {
        case .Idle:
            return CheckStatusEventExecutor(config: config)

        case .CheckStatus:
            return DownloadEventExecutor(config: config)

        case .Download:
            return ConfirmEventExecutor(config: config)

        default:
            return nil
        }
        return nil
    }
}

Class DownloadEventExecutor: MyQueue {

private var config: Config
private var event: Event!

init(config: Config) {
    self.config = config
    super.init()
}

override func start() {
    // super.start() invokes the next event in the queue.
    //  would perform task here, but need to return Publisher.
    super.start()
}

// manager calls this method
func execute() -> PassthroughSubject {
    event = DownloadEvent(queue: self, config: config)
    let result = event.enqueueEvent()
    start() // normally manager would call start, but want to provide stream. so this instead. I suppose i could call super.start() here.
    return result
}

}}

Class DownloadEvent: MyOperation {

var subject = PassthroughSubject()
var queue: Queue
var config: Config

init(queue: Queue, config: Config) {
    self.queue = queue
    self.config = config
    super.init(queue:queue, config: config)
}

override func start() {
    asyncTask()
        .map { self.parse(data:$0) }
        .map { self.handleResponse(isValid:$0) }
        .sink(receiveCompletion: { (completion) in
            self.subject.send(completion: completion)
        }) { (error) in
            // need to send error actually, but only param is data..
            self.subject.send(Data())
    }.store(in: &config.subscriptions)
}

// EventExecutor calls this method
func enqueueEvent() -> PassthroughSubject {
    queue.enqueue(self)
    // subject will emit values when asyncTask completes (sink).
    return subject
}


private func asyncTask() -> PassthroughSubject {
    return config.client.asyncTask(payload: config.statusObj.payload) // scenario: payload retrieved and stored from prior event
}

private func parse(data: Data?) -> Bool {
    // parse data  ..
    return true
}

// need to return same type of publiisher.
private func handleResponse(isValid: Bool) -> MyError? {
    guard isValid == true else {
        return MyError.parsingFailure
    }
    // task has completed. save state/last completed task.
    config.stateObj.save()
    // scenario: if I retrieved data back from async task, save it in status obj
    config.statusObj.value = isValid
    config.statusObj.save()
    // ** Critical
    // this will emit state when last event (self) completed, causing next event to execute.
    // I dont think this is a good place for this..
    config.stateStepper.send(config.stateObj)
    return nil
}

}}

Sortable administration columns, which are sorted from user-defined fields, do not combine Com Search and dropdown filter

I am developing a plugin that essentially consists of a CPT that lists certificates (several) for their respective customers (user role). I've done everything that should be done:
– The CPT "Certificates"
– The user role "customer"
– The taxonomy "company"
– Carbon fields for custom fields (via Composer dependency)
– I have created the field that connects the customer with their respective company, since we have the field for the assignment when creating posts / certificates.
– I have created the rules (filter – pre_get_posts) in order to only list contributions from the company to which the user customer is connected.
– AND THE MOST DRAMATIC OF EVERYTHING – I chose the WP Admin interface myself to show this, and now I'm having problems with filtering, such as:
– – It is impossible to combine filters and search fields with columns. Sortable order from custom fields. Only sortable title columns work with search and filter combinations.

I think this decision to use the ADMIN user interface made me very complicated. I'm considering creating a separate page and getting it through WP's REST API with JS.
Or is it possible to combine the filters in the ADMIN user interface? Both options work for me. I would like someone's help because I don't know much about SQL and how I could combine these filters.

In the pictures I show an example for the ADMIN view, in which all certificates are shown:
List of certificates in the administrator view

|

The combination of dropdown filters with search and column order of the title works perfectly:
Search, dropdown and title column sortable

|

But when I try to sort by the other columns, everything disappears. see:
Combination doesn't work

|

If I order without using the search combination, it works normally.

The main code is here:

dnd 5e – Can you combine Simulacrum with Sequester?

There is nothing in the way the spells work that prevents this. You create a simulacrum of yourself and then probably someone else sequester on you you're ready for. This allows a simulacrum of yours to do what you ordered. There are some important ways that a simulacrum is not you. It cannot regain magic slots and has half of your maximum hit points. It is a construct in which so many forms of healing do not work. It cannot learn for you or reach a level and it will not go to 0 and save death, but will immediately die at that point.

So what can you do instead of using two 7th level spells and 6500 gp? Fortunately, there is a spell specifically for what you describe (or at least almost): clone. This 8th level spell only costs you 3000 gp (2000 of which are reusable) and leaves full, actual roaming ready with a nice, fresh backup in case something goes wrong.

Algebraic Number Theory – Can I Combine Grid (Group) and Minkowski's Theorem with Crystallography?

I study computer science and am interested in materials science. Unfortunately, I'm just a layperson in math and physics. but I want to understand them better so that I can use them more freely and efficiently when I think about problems and solutions for ideas that I have.

Right now I'm trying to do something with sets in grids in R2 that meet Minkowski's theorem (symmetrical to the origin, convex and limited). The idea I was thinking about was to use it for some kind of structural analysis of crystal structures.

I was wondering if you could use this with something like tight ball packing, but I can't connect the dots in my head. or maybe there are simply no points to connect. So it would help me a lot if I could get feedback. Please don't hold back.

dnd 5e – Combine Flash of Genius and Psi Bolstered Knack?

Flash of Genius partially reads:

If you or another creature you can see within 30 feet of you do a skill check or a save throw, you can use your reaction to add your intelligence modifier to the throw.

It's pretty easy. You burn your reaction to add your intelligence modifier for testing.

The villain's Soul Knife flavor from Psi-Bolstered Knack is:

if you fail a skill test with a skill or tool that you know
You can roll your Psionic Talent die and add the number rolled to the check, which can make mistakes a success.

The critical wording here is that you don't have to pass the exam first to use the feature. However, if you fail the exam with the additional Flash of Genius modifier, you can try again with the dice provided by your Psionic Talent Die.

Should I combine 2 of my pages for SEO?

I have a question. I'm trying to arrange a page for the keyword "sexy cowgirl boots". I have a site (https://wehearthandmadeboots.com/womens-cowgirl-boots/) and I don't even register in the top 100 for this or any other keyword I know. I have another site (https://wehearthandmadeboots.com/rhinestone-cowgirl-boots/) that I tried to rank for "Rhinestone Cowgirl Boots" and it ranks 13th and 10th for the first keyword " sexy cowgirl "boots". The keyword "rhinestones" has a larger monthly search volume.

Would it be advisable to merge the pages? Maybe leave the rhinestone page and add the content from the beginning? Or should I leave both of them alone? I'm not sure what else to do when it comes to SEO.
SEMrush

Any ideas, comments, advice would be greatly appreciated.

Thanks a lot,
Thomas

backup – This is the best way to combine data from a number of old hard drives

I have a few old hard drives (about 15 hard drives, average age about 8 years, mostly USB 2, mostly less than one TB). Disks marks at least one of them as faulty, some Input/Output Errors are displayed rsync sometimes shows errors when copying. There are numerous duplicate files.

I want to put everything on them on a new hard drive and then back up to a secondary new hard drive.

  1. Is there an established way to do this or do I have to use hard drive for hard drive? rsync?

  2. Can the method also work if the total data volume before the duplication exceeds the target volume (but not after the duplication)?

SQL Server – How do I combine multiple rows for the same package? (SQL)

I'm doing an order and I'm about to complete it. However, the package balance is shown on several lines and I want to combine the balances for each package type.

IF OBJECT_ID('vwPackageRevenue') IS NOT NULL
    DROP VIEW vwPackageRevenue
GO

CREATE VIEW vwPackageRevenue
AS
SELECT (dbo.packageWH.PNAME) AS 'Package Name'
    ,(COSTPERSON * COUNT(GFirstName)) > AS 'Total Revenue'
FROM dbo.packageWH
JOIN dbo.reservationWH ON > dbo.packageWH.P_ID = dbo.reservationWH.P_ID
JOIN guestWH ON dbo.reservationWH.RNUM >= dbo.guestWH.RNUM
GROUP BY dbo.packageWH.COSTPERSON
    ,dbo.packageWH.PNAME
    ,dbo.guestWH.GFIRSTNAME 
GO

SELECT *
FROM vwPackageRevenue

Any ideas on how to complete that?

join – combine data from multiple tables into a grouped single JSON object: PostgreSQL

I am working on a PostgreSQL database and have to query against the following specifications:

I have a Category Table, a Subcategory Table and a Item Table. Elements may or may not belong to categories or subcategories. The item table has category_id, subcategory_id Attributes, one or both of which can be null. Each category has one preference Attribute. Every subcategory too.

My dilemma is as follows: I have to return a JSON array that consists of categories sorted by preference. The categories must consist of subcategories sorted by preference. The subcategories must contain all of the elements in that particular subcategory. Articles that have one nullSubcategory must be after all subcategories. Articles that have one null Category must follow all categories.

In the beginning I wrote code to solve the problem. Extract a list of categories, extract a list of subcategories, and build a JSON object from the whole. Aside from performance issues, this resulted in very messy code that handled all of the marginal cases involved. I wonder if there is a method based on joins or if this is even possible through queries in PostgreSQL.

tls – Certificate revocation with intermediate certification bodies – combine CRLs?

I use Nginx for client side authentication.
Only the user certificate authority's SSL certificates should have access to the application.

The CA hierarchy:

Root CA
    |
Intermediate CA
    |
User CA

In order to ssl_verify_depth (maximum verification depth) =3

Each certification body has a CRL.

For Nginx I need a CRL document.

Do I have to combine the CRLs of the root CA, the intermediate CA, and the user CA?