How to merge folders while renaming the files within them them in windows 10?

Right now I have a folder that contains subfolders numbered 1-600. Within each of these subfolders is a collection of around 20 images that are all numbered starting from 001. I want to merge these subfolders into one big folder which would have all of the images with their numbering along with the number of the folder they are in as well (for instance the 6th image in the 145th folder might be named something like "(145) 006". Is there any way I can do this on windows 10?

powershell – How to merge multiple excel files and update the merged file’s worksheet names as excel files?

Can somebody please help me to resolve this:

This is my requirement:

I have few excel files (It will vary) in a folder: D:ScriptTest
Eg: the name of the files are ExcelA, ExcelB, ExcelC etc
It has worksheets like this: A1 (for ExcelA), B1(for ExcelB), C1(for ExcelC) etc
Here I want to merge all those different excel sheets to one excel sheets (Lets say the merge file name is ‘Final.xlsx’)
Condition: Instead of getting the worksheets as its actual names (A1, B1, C1), I want to get it updated with excel file names.

Meaning : Final.xlsx should have merged 3 worksheets with the names: ExcelA, ExcelB, ExcelC

How to merge multiple PDF files into one PDF magento 2 Programitically?

$fileName = $shipmentNumber.".pdf";
error_log("fileName: ". $fileName);

            echo  $this->_downloader->create(
                $fileName,
                @file_get_contents($filepath)
            );

hard drive – How to merge empty partitions to main partition without data loss in main in macOS?

I tried to install Windows in my MacBook Pro (13-inch, Mid 2012) having macOS Mojave. Tried without the bootcamp assistant as directed in the link –
https://fgimian.github.io/blog/2016/03/12/installing-windows-10-on-a-mac-without-bootcamp/

But after re creating the partition as mentioned in the link above, and after the starting of the installation, an error popped up saying – “We couldn’t create a new partition or locate an existing one.”
Upon trying to find out a possible solution, I came across –

‘We couldn’t create a new partition or locate an existing one’ from bootcamp


As I was stuck, the last link having lots of successful results made me understand that I need to have all the partitions combined back to one. Reset the PRAM, and then do the same steps.

To get all the partitions to one, I deleted the ones that showed during the Windows Installation, and formatted them, as the unformatted ones, did not show up in the macOS.

But even after the formatting, the partitions did not show as active in the “Disk Utility”, and showed error either upon mounting, restoring or Erasing.

I am tired of trying to install Windows, as there is some or the other error. I have somehow preserved my MacOS thankfully.

I just want to know how can I get back all the partitioned drives into the main drive as free space.

The combined screenshot of the partitions is below :
enter image description here

And About This Mac shows the storage as below :
enter image description here

I still have the Windows 10 bootable USB.Do I need to delete(and format) partitions from there first?
Any help is greatly appreciated.

How can I merge between two software architectures in software design?

I need to know what types can be merged together like can I merge MVC and layered architecture? so please can someone list what types can be merged together, and an example on how to merge.

Can I even merge software architecture?

sql server – Can I simplify this MERGE statement w.r.t. WHEN MATCHED conditions?

I’m using SQL Server (SQL Server 2016 and Azure SQL) and I have this MERGE statement which uses a rather gnarly WHEN MATCHED condition to only update rows where values are actually different.

This is done for two reasons:

  1. The table has a rowversion column that will change when an UPDATE operation is performed, even if all of the values are the same. The rowversion values are useful for reducing client-activity (the application uses rowversion for optimistic concurrency).
  2. The table is also a Temporal Table, and SQL Server’s implementation of Temporal Tables will add copies of live data to the History table whenever an UPDATE is performed, even if no values are actually changed.
CREATE PROCEDURE UpsertItems
    @groupId int,
    @items   dbo.ItemsList READONLY -- This is a table-valued parameter. The UDT Table-Type has the same design as the `dbo.Items` table.

WITH existing AS    -- Using a CTE as the MERGE target to allow *safe* use of `WHEN NOT MATCHED BY SOURCE THEN DELETE` and apparently it's good for performance.
(
    SELECT
        groupId,
        itemId,
        a,
        b,
        c,
        d,
        e,
        f,
        -- etc
    FROM
        dbo.Items
    WHERE
        groupId = @groupId
)
MERGE INTO existing WITH (HOLDLOCK) AS tgt
USING
    @items AS src ON tgt.itemId = src.itemId
WHEN MATCHED AND
(
    -- This part is painful, but unfortunately these are all NULLable columns so they need the full `x IS DISTINCT FROM y`-equivalent comparison:

    ( ( tgt.a <> src.a OR tgt.a IS NULL OR src.a IS NULL ) AND NOT ( tgt.a IS NULL AND src.a IS NULL ) )
    OR
    ( ( tgt.b <> src.b OR tgt.b IS NULL OR src.b IS NULL ) AND NOT ( tgt.b IS NULL AND src.b IS NULL ) )
    OR
    ( ( tgt.c <> src.c OR tgt.c IS NULL OR src.c IS NULL ) AND NOT ( tgt.c IS NULL AND src.c IS NULL ) )
    OR
    ( ( tgt.d <> src.d OR tgt.d IS NULL OR src.d IS NULL ) AND NOT ( tgt.d IS NULL AND src.d IS NULL ) )
    OR
    ( ( tgt.e <> src.e OR tgt.e IS NULL OR src.e IS NULL ) AND NOT ( tgt.e IS NULL AND src.e IS NULL ) )
    OR
    ( ( tgt.f <> src.f OR tgt.f IS NULL OR src.f IS NULL ) AND NOT ( tgt.f IS NULL AND src.f IS NULL ) )
    -- etc
)
THEN UPDATE SET
    tgt.a = src.a,
    tgt.b = src.b,
    tgt.c = src.c,
    tgt.d = src.d,
    tgt.e = src.e,
    tgt.f = src.f,
    -- etc
WHEN NOT MATCHED BY TARGET THEN INSERT (
    groupId,
    itemId,
    a,
    b,
    c,
    d,
    e,
    f,
    -- etc
)
VALUES (
    src.groupId,
    src.itemId,
    src.a,
    src.b,
    src.c,
    src.d,
    src.e,
    src.f,
    -- etc
)
WHEN NOT MATCHED BY SOURCE THEN DELETE

OUTPUT
    $action AS (Action),

    inserted.groupId AS Ins_groupId,
    deleted .groupId AS Del_groupId,
    inserted.itemId  AS Ins_itemId,
    deleted .itemId  AS Del_itemId,
    inserted.a       AS Ins_a,
    deleted .a       AS Del_a,
    inserted.b       AS Ins_b,
    deleted .b       AS Del_b,
    inserted.c       AS Ins_c,
    deleted .c       AS Del_c,
    inserted.d       AS Ins_d,
    deleted .d       AS Del_d,
    inserted.e       AS Ins_e,
    deleted .e       AS Del_e,
    inserted.f       AS Ins_f,
    deleted .f       AS Del_f,
    -- etc
;

As you can see, this is quit the pain to maintain!

I already use tools like T4 to automate generating the repetitive parts of this query, but the sheer… scale and pain of this MERGE statement makes me feel like I’m doing something very wrong (because software is meant to light-the-way via the Pit of Success, so if one is encountering difficulties trying to do the right thing you’re probably doing it wrong), but I can’t think or see a better way of accomplishing this (BULK INSERT notwithstanding, but for the purposes of this question that’s not a possibility).

I know this statement can be simplified in other RDBMS which support x IS DISTINCT FROM y (which replaces the horrible-but-necessary NULL-safe checks in the WHEN MATCHED AND, but SQL Server still doesn’t support it.

Another pain is the lack of DRY in SQL in general – and the difficulty of implementing a DRY database in SQL Server (e.g. there’s no support for Deferred Constraints or Table Inheritance so you can’t implement the Subclass Table Pattern, which means needless repetition of data-design in multiple tables and weaker constraints) – but that’s another topic. I’m just frustrated with how backward SQL programming seems today compared to the many time-saving and keypress-saving features in modern languages like Kotlin and TypeScript.

Fantasy time:

I’d love to be able to do something like this, and not have to do with any gotchas (like how MERGE is unsafe by default without an explicit HOLDLOCK – that’s crazy!):

MERGE INTO
    dbo.Items AS tgt
WHERE
    tgt.groupId = @groupId
FROM
    @items AS src
ON
    tgt.itemId = src.itemId
WHEN MATCHED AND DIFFERENT THEN UPDATE ( automap )
WHEN NOT MATCHED BY TARGET THEN INSERT ( automap )
WHEN NOT MATCHED BY SOURCE THEN DELETE
OUTPUT ALL;

(Where automap would be an amazing feature in SQL Server that automatically maps source and destination columns by name and throws a compile-time error if it cannot automatically map columns to each other), and OUTPUT ALL would output all $action, inserted, and deleted values with different column names – using the same column names but with inserted and deleted values in adjacent rows).

uploads – Merge Multisites with Shared Network Media Library

So have a multisite setup which no longer needs to be a multisite but I’m left with a bit of a mess since I used Network Media Library plugin to host images for all sites on the network. I’ll try to break it down:

  • started out with WP multisite
  • created two sites on the network
  • installed Network Media Library
  • site #1 hosted the media library
  • both sites hosted posts
  • (about a year and a lot of posting goes by)
  • pulled site #1 out of multisite to be hosted independently
  • left with multisite running site #2 but still pulling it’s media from site #1

What I want to do now is combine site #2 which contains all my posts with site #1 which contains only media. My concerns are:

  • if I merge tables there will be ID conflicts (some posts will have same ID as attachments)
  • if I use import function to bring images into posts site then images will be given new IDs and post thumbnail relations will all break
  • if I use import function to bring posts into images site then post IDs would change which can’t happen because we use the ID in the post URL

The best idea I have so far is to somehow…

  • use the WordPress import function to import all the attachments into the posts site
  • log old and new IDs into a new table in the DB as the process works
  • then iterate over all the posts switching old for new IDs in the post_meta _thumbnail_id fields
  • ideally then be left with one site which contains all the posts and attachments so I can reduce the install down to regular non-multisite.

There’s tens of thousands of posts on these combined sites so performing these functions is no small feat and really not sure where to start so I wonder if anyone has any experience of a process like this or ideas for alternative solutions.

Thanks for reading.

sql server – T-SQL Merge not updating in explicit transaction

We have the following code in a stored procedure which has a merge statement and an update statement to a different table in an explicit transaction. The merge update does not update any data in the inventory.gtin table but the update statement below it works and data is updated in the import.file_data table when the stored procedure is called in a batch job. But, when the stored procedure is executed manually, the merge works fine and updates/inserts data. Is this a bug in the merge statement?

DECLARE @targetVendorCode nvarchar(20)
DECLARE gtin_cursor CURSOR FOR  

        SELECT DISTINCT aVendorCode
        FROM #fileData fd


    OPEN gtin_cursor   
    FETCH NEXT FROM gtin_cursor INTO @targetVendorCode
    WHILE @@FETCH_STATUS = 0   
    BEGIN   

    BEGIN TRANSACTION;

    MERGE (inventory).(gtin) AS target  
    USING (SELECT * FROM #fileData WHERE ngtin IS NOT NULL AND aVendorCode = @targetVendorCode ) AS source
    ON (target.(ngtin) = source.(ngtin))
    WHEN MATCHED AND ( ( source.createDateTime > COALESCE(target.fileCreateDateTime,'04/02/1982') ) OR source.(status) = 'override' ) THEN
        UPDATE SET 
        (skuId) = source.(skuId),  
        (lastUpdateFileId) = source.(fileId),  
        (vendorCode) = COALESCE(source.(aVendorCode),source.(vendorCode)),  
        (lastUpdateDateTime) = source.(lastUpdateDateTime),     
        (fileCreateDateTime)= source.createDateTime
    WHEN NOT MATCHED BY TARGET THEN 
        INSERT (
                (skuId),
                (lastUpdateFileId),
                (vendorCode),
                (lastUpdateDateTime),
                (fileCreateDateTime)
                )  
        VALUES (
                source.(skuId),
                source.(fileId),
                COALESCE(source.(aVendorCode),source.(vendorCode)),
                source.(lastUpdateDateTime),
                source.createDateTime
                ) 
            ;           
        SELECT @action = '({"type":"distribute","actionDateTime":"' + CONVERT(VARCHAR(19), GETUTCDATE(), 120) + '","insertDateTime":"' + CONVERT(VARCHAR(19), GETUTCDATE(), 120) + '","referenceId":' + TRY_CAST(@fileId AS NVARCHAR(20)) + '})'

        UPDATE fd SET (status) = 'processed',(modifiedDateTime) = GETUTCDATE(),(modifiedUserName) = SYSTEM_USER FROM (import).(file_data) fd WHERE fileId = @fileId


    IF @@TRANCOUNT > 0
    BEGIN
        COMMIT TRANSACTION;
    END
    ELSE
    BEGIN
        ROLLBACK TRANSACTION;
    END

    FETCH NEXT FROM gtin_cursor INTO @targetVendorCode
    END   

    CLOSE gtin_cursor   
    DEALLOCATE gtin_cursor

how do I merge the tabs of two open Preview windows if I have more than two open?

This is doable in Safari, but I don’t know how to do it for Preview.

Runtime Error – String e Merge Sort em C

Estou resolvendo um exercício de Merge Sort em C, submeto em plataforma automática (BOCA). Ele roda certinho na máquina, mas na submissão apresenta RUNTIME ERROR (acredito que seja algo relacionado com o String, já que outro exercício usando inteiros deu certo). Já revisei o código muitas vezes, mas não encontro o problema.
inserir a descrição da imagem aqui
inserir a descrição da imagem aqui

//gcc  E3.c -lm -o E3.exe

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

void imprime(char *vetor){
    printf("%sn",vetor);
}

void preenche(char *vetor, int tamanho, int esq, int dir){
    int fim_e = dir-1,i;
    char *aux = NULL;
    aux = malloc(tamanho);

    for(i=0;esq<=fim_e && dir<tamanho;i++){
        if(vetor(esq) <= vetor(dir)){
            aux(i) = vetor(esq);
            esq++;
        }else{
            aux(i) = vetor(dir);
            dir++;
        }
    }
    //imprime(aux,2);
    //printf("i = %dn",i);

    for(;esq<=fim_e;esq++,i++){
        aux(i) = vetor(esq);
    }
    for(;dir<tamanho;dir++,i++){
        aux(i) = vetor(dir);
    }
    for(i = 0;i<tamanho;i++){
        vetor(i) = aux(i);
    }
    free(aux);

    imprime(vetor);
}

int main(){

    int n,m,t;


    char *string = NULL;

    string = malloc(20000);

    scanf ("%s", string);

    scanf("%d", &n);
    scanf("%d", &m);

    t = n+m;

    preenche(string,t,0,n);

    return 0;
}