Why does Windows 10 add files to the desktop in columns, but selects files in rows?

When I save files to the Desktop, it automatically stacks them in columns. Meaning, each added file is placed underneath the previous until it reaches the bottom. Then it wraps, and starts stacking files in a new column.

When selecting files using the keyboard, files get selected in rows. For example, if you have 5 columns of files, select (single-click) a file in the bottom of the last column, then on the keyboard press Shift+Up, it will highlight not just the file above, but the entire row beneath it.

Since files get added in columns, I expected the selection to follow the columns, meaning Shift+Up in the previous scenario would only add the above file to the selection. I can’t imagine why the current way would make sense. I feel like this is bad design.

Is this bad design, or is there a UX principle behind this decision?

Is there somewhere else this behavior can be seen?
(I checked MacOS (Catalina), and using Shift and arrows keys just selects individual files in the direction of the arrow keys you press; it doesn’t attempt to select rows nor columns.)

Searching Multiple Columns From Single Source Sheet in Google Sheets

I have a Sheet where I have all of my data entered. I have been able to filter the information to other sheets no issues when only searching in one column. I am having issues when trying to search 2 columns at the same time.

On the Source Page, I have my date listed under the following headers: Player Name (A), OVR (B), Series (C), Primary (D), Secondary (E), Bats (F), Throws (G), How To Acquire (H), Team of Card (I) & Teams Played For (J).

For most sheets, I have been able to use the following formulae:
=SORT(FILTER(Cards!1:1000,SEARCH(“Giants”,Cards!J1:J1000)),2,false,1,true)

My issue comes from when I try to search both Primary and Secondary at the same time. I was able to use a query that searched both columns but am unable to do using SEARCH.

windows – batch script create columns based on amount of files

I have a .txt-File which should be extended based on how many files there are in a folder.
The .txt-File looks like this:

---------------------------------------------------------------------------
File 1
---------------------------------------------------------------------------

File-Name...............:
File-Size...............:

---------------------------------------------------------------------------
File 2
---------------------------------------------------------------------------

File-Name...............:
File-Size...............: 

---------------------------------------------------------------------------
File x
---------------------------------------------------------------------------

File-Name...............:
File-Size...............: 

---------------------------------------------------------------------------

For further explanation of my question, let’s define one set of strings as one collumn:

---------------------------------------------------------------------------
File X
---------------------------------------------------------------------------

File-Name...............:
File-Size...............:

---------------------------------------------------------------------------

Now I want to a batch-Script to check for the amount of files inside the directory and
create copies of the collumn based on the amount of inside the directory to a local .txt-file.
It should also replace X with an ascending number.

This is my code so far:

@echo off

for /f %%A in ('dir /a-d-s-h /b ^| find /v /c ""') do set cnt=%%A
echo %CNT%

... //This is the lone where I want to copy the collumns based on the amount files

echo * >>test.txt //this is where I want to save it as a string

mysql – Checking if entities match an id in on relation where it could show up in either of two columns

The problem

I’m trying to make a page for a website (with PostgreSQL database) that allows the owner of a group to add new members from their friends list.

Given the owner_id of a Group its group_id I need to retrieve only the user_ids from users who are both friends with the owner, and not in the group.

The relations being queried

I need to use the following relations

  • UserFriend: Stores two user_ids to connect those two users from the User relation to each other as friend.
  • UserGroup: Stores a user_id and group_id to connect the Group relation to its members in the User relation.

The two relations are described as follows:

UserFriend

  Column   |  Type   | Collation | Nullable | Default 
-----------+---------+-----------+----------+---------
 user_id_a | integer |           | not null | 
 user_id_b | integer |           | not null | 

UserGroup

  Column  |  Type   | Collation | Nullable | Default 
----------+---------+-----------+----------+---------
 user_id  | integer |           | not null | 
 group_id | integer |           | not null | 

My attempt so far with example data

For example, given the data below, I want to find all users that are friend with user 3, and not in group 3.

SELECT user_id_a, user_id_b FROM UserGroup UG, UserFriend UF 
    WHERE (UF.user_id_a = 3 AND UF.user_id_b != UG.user_id)
       OR (UF.user_id_b = 3 AND UF.user_id_a != UG.user_id)
       AND UG.group_id = 3 GROUP BY user_id_a, user_id_b;

Expected Result

 user_id_a | user_id_b 
-----------+-----------
         1 |         3

Even better if it could just show something like

 possible_members 
------------------
                3

Actual Result

 user_id_a | user_id_b 
-----------+-----------
         1 |         3
         3 |         2
         3 |         4

Example data

UserFriend

 user_id_a | user_id_b 
-----------+-----------
         1 |         2
         1 |         3
         1 |         4
         3 |         4
         3 |         2

UserGroup

 user_id | group_id 
---------+----------
       1 |        1
       2 |        1
       3 |        1
       4 |        1
       1 |        2
       2 |        3
       3 |        3
       4 |        3

Analysis

I’m fairly certain that the issue has something to do with the way I’m handling the fact that the user_id I’m trying to match could be in either column of UserFriend, but I’m not sure how to fix it. I’ve also tried using JOINs without any luck.

r – Find rows that contain the same values across two or three columns

I want to find rows that contain the same values across two or three columns. Here is an example dataset:

replicate(3, {sample(1:3)})
     (,1) (,2) (,3)
(1,)    3    3    2
(2,)    2    1    1
(3,)    1    2    3

For this dataset, the first and the second row have duplicated values (i.e., 3 and 1) and therefore I want to extract and dispose them and later just keep the rows with the non-duplicated values (i.e., the third row in this case).

How to achieve that? I have a larger dataset. I appreciate for any help!

Help with Sharepoint List Columns – make cell GREEN if value = “Complete”

If you are using a modern SharePoint list and the status column is a choice, you can simply do the following:

  • Go the the “Column settings” > “Format this column”:

enter image description here

  • Click “Choice pills” > “Advanced Mode”:

enter image description here

Inser the following code:

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "div",
  "txtContent": "@currentField",
  "style": {
    "background-color": "=if(@currentField == 'Complete', '#BAD80B','')"
  }
}

You’ll get this result

enter image description here

If you want a more fancy format, you can use the following code:

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "div",
  "style": {
    "flex-wrap": "wrap",
    "display": "flex"
  },
  "children": (
    {
      "elmType": "div",
      "style": {
        "box-sizing": "border-box",
        "padding": "4px 8px 5px 8px",
        "display": "flex",
        "border-radius": "16px",
        "height": "24px",
        "align-items": "center",
        "white-space": "nowrap",
        "overflow": "hidden",
        "margin": "4px 4px 4px 4px"
      },
      "attributes": {
        "class": {
          "operator": ":",
          "operands": (
            {
              "operator": "==",
              "operands": (
                "($Status)",
                "Complete"
              )
            },
            "sp-css-backgroundColor-greenLight",
            {
              "operator": ":",
              "operands": (
                {
                  "operator": "==",
                  "operands": (
                    "($Status)",
                    ""
                  )
                },
                "",
                "sp-field-borderAllRegular sp-field-borderAllSolid sp-css-borderColor-neutralSecondary"
              )
            }
          )
        }
      },
      "children": (
        {
          "elmType": "span",
          "style": {
            "line-height": "16px",
            "height": "14px"
          },
          "attributes": {
            "iconName": {
              "operator": ":",
              "operands": (
                {
                  "operator": "==",
                  "operands": (
                    "($Status)",
                    "Complete"
                  )
                },
                "",
                {
                  "operator": ":",
                  "operands": (
                    {
                      "operator": "==",
                      "operands": (
                        "($Status)",
                        ""
                      )
                    },
                    "",
                    ""
                  )
                }
              )
            }
          }
        },
        {
          "elmType": "span",
          "style": {
            "overflow": "hidden",
            "text-overflow": "ellipsis",
            "padding": "0 3px"
          },
          "txtContent": "($Status)",
          "attributes": {
            "class": {
              "operator": ":",
              "operands": (
                {
                  "operator": "==",
                  "operands": (
                    "($Status)",
                    "Complete"
                  )
                },
                "",
                {
                  "operator": ":",
                  "operands": (
                    {
                      "operator": "==",
                      "operands": (
                        "($Status)",
                        ""
                      )
                    },
                    "",
                    ""
                  )
                }
              )
            }
          }
        }
      )
    }
  )
}
  • Replace $Status with the name of your column. For example, ff it’s called “Outcome”, then $Status should be replaced with $Outcome

Result

enter image description here

Backup and restore SQL Server database with encrypted columns: what should I backup along with database?

Assume I’ve backed up a SQL Server database with Management Studio, and that database have some encrypted columns. Now I want to restore this database into another fresh-enrolled MSSQL server. To use encrypted columns I had to:

  1. Create database master key;
  2. Create certificate;
  3. Create symmetric key.

Which of those are stored along with backup, and which I should backup manually and restore on the other server manually as well? I see there is SQL statements backup master key, restore master key, backup certificate, create certificate ... from file. So, along with database itself, there are:

  1. Master key;
  2. Master key password;
  3. Certificate;
  4. Certificate private key;
  5. Symmetric key.

So what (and how) should I deal with when I restore my database on a fresh server? Thank you!

functional programming – In Scala, converting CSV into map using first line values as keys and columns values as arrays

I have this format data in CSV :

A,B,C,D
1,2,3,4
5,6,7,8
9,10,11,12

And I need to convert it to map of below format, using lambda expression (no loops)

HashMap<String,mutable.ArrayBuffer(Double)> = new HashMap<>()
("A"->{1,5,9}, "B"->{2,6,10}, "C"->{3,7,11}, "D"->{4,8,12})

Thanks!

sql – Preventing both columns to be true in MySQL

I am using MySQL 5.7.

I have an organisation table. Each organisation has 2 contact method:

  • ContactRepresentative
  • UseBranchSpecificContact

I want to add a constraint to ensure not both of these flags are true (only one of these columns can be true ot thhey can both be false).

MySQL CHECK CONSTRAINT does not work in MySQL 5.7, so I though I can introduce a generated column called ValidContact_virtual and set its value to NULL if both contact methods are true… then I would add a NOT NULL constraint to ValidContact_virtual column:

CREATE TABLE organisation (
    OrganisationId              BIGINT          NOT NULL    AUTO_INCREMENT,
    OrganisationName            NVARCHAR(64)    NOT NULL,
    ContactRepresentative       BIT             NOT NULL DEFAULT 0,
    UseBranchSpecificContact    BIT             NOT NULL DEFAULT 0,
    ValidContact_virtual        BIT GENERATED ALWAYS AS (
        IF(ContactRepresentative = 1 AND UseBranchSpecificContact = 1, NULL, 1)
    ) VIRTUAL NOT NULL,
    
    
    CONSTRAINT PK_Organisation PRIMARY KEY(OrganisationId)
);

I have tried this solution, and it has worked so far… it does not allow adding a new organisation with both contact methods = 1 and it does not allow to update a record and set one of the contact methods to true when the other is already true

If there is an existing record, with both values = 1, then I cannot update that row… the only way to fix it, is to delete that record and add a new one.