text:
Q: React Router with deeper paths I am trying to get an example with React Router running.
My example has the 3 following routes:

*

*(works in browser) http://0.0.0.0:8081/one

*(fails in browser) http://0.0.0.0:8081/one/two

*(fails in browser) http://0.0.0.0:8081/one/two/three
All routes work with Link, but only 1. works when typing the url in the browser. When typing i.e. the 2. route in the browser, the browser console responds the following error:

GET http://0.0.0.0:8081/one/app.js net::ERR_ABORTED 404 (Not Found)

Main App class:
import * as React from 'react';
import { BrowserRouter, Switch, Route, Link } from 'react-router-dom';
import { One } from './One';
import { Two } from './Two';
import { Three } from './Three';

export class App2 extends React.Component<{}, {}> {
    public render() {
        return <BrowserRouter>

                    <Link to='/one'>One</Link>

                    <Link to='/one/two'>Two</Link>

                    <Link to='/one/two/three'>Three</Link>

            <Switch>
                <Route path='/one/two/three' component={Three} />
                <Route path='/one/two' component={Two} />
                <Route path='/one' component={One} />
            </Switch>
        </BrowserRouter>;
    }
}

Class named One:
import * as React from 'react';

export class One extends React.Component<{}, {}> {
    public render() {
        return
One
;
    }
}

Class named Two:
import * as React from 'react';

export class Two extends React.Component<{}, {}> {
    public render() {
        return
Two
;
    }
}

Class named Three:
import * as React from 'react';

export class Three extends React.Component<{}, {}> {
    public render() {
        return
Three
;
    }
}

Command to run the app in development mode:
"scripts": {
    "develop": "webpack-dev-server --mode development --open --port 8081 --host 0.0.0.0 --config webpack.dev.config.js"
}

The Webpack configuration webpack.dev.config.js:
const path = require('path');
const HtmlWebPackPlugin = require('html-webpack-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');

const htmlPlugin = new HtmlWebPackPlugin({
    template: "./src/index.html",
    filename: "./index.html"
});

module.exports = {
    entry: "./src/index.tsx",
    output: {
        filename: "app.js",
        path: path.resolve(__dirname, "dist")
    },

    // Enable sourcemaps for debuggin webpack's output.
    devtool: "source-map",

    resolve: {
        // Add '.ts', and '.tsx' as resolvable exteensions.
        extensions: [".ts", ".tsx", ".js", ".json"]
    },

    module: {
        rules: [
            // All files with a '.ts' or '.tsx' extension will be handled by 'awesome-typescript-loader'.
            { test: /\.tsx?$/, loader: "awesome-typescript-loader" },

            // All output '.js' files will have any sourcemaps re-processed by 'source-map-loader'.
            { enforce: "pre", test: /\.js$/, loader: "source-map-loader" },

            {
                test: /\.css$/,
                use: [
                    { loader: "style-loader" },
                    { loader: "typings-for-css-module-loader", options: { modules: true, namedExport: true, camelCase: true, localIdentName: "[name]_[local]_[hash:base64]" }}
                ]
            },

            {
                test: /\.scss$/,
                exclude: /\.global.scss$/,
                use: [
                    { loader: "style-loader" },
                    { loader: "typings-for-css-modules-loader", options: { modules: true, namedExport: true, camelCase: true, localIdentName: "[local]" }},
                    { loader: "postcss-loader", options: { plugins: function () { return [ require("autoprefixer") ]; }}},
                    { loader: "sass-loader" }
                ]
            },

            {
                test: /\.scss$/,
                include: /\.global.scss$/,
                use: [
                    { loader: "style-loader" },
                    { loader: "css-loader" },
                    { loader: "postcss-loader", options: { plugins: function () { return [ require("autoprefixer") ]; }}},
                    { loader: "sass-loader" }
                ]
            }
        ]
    },

    devServer: {
        historyApiFallback: true,
        disableHostCheck: true
    },

    plugins: [
        new CleanWebpackPlugin({
            cleanAfterEveryBuildPatterns: ['dist']
        }),
        htmlPlugin
    ]
};

I use the following versions:

*

*Node v13.7.0

*"@types/react": "16.9.11",

*"@types/react-dom": "16.9.4",

*"@types/react-router-dom": "5.1.2",

*"react": "16.11.0",

*"react-dom": "16.11.0",

*"react-router-dom": "5.1.2",

*"typescript": "3.7.4",

*"webpack": "4.41.2",

*"webpack-cli": "3.3.10",

*"webpack-dev-server": "3.9.0"

I tried to follow the examples here.
Why does only the 1. route work? Why don't the other routes 2. and 3. work?
Edit 1:
Trying to use exact does not work either. The result is the same as the above mentioned:
import * as React from 'react';
import { BrowserRouter, Switch, Route } from 'react-router-dom';
import { One } from './One';
import { Two } from './Two';
import { Three } from './Three';

export class App2 extends React.Component<{}, {}> {
    public render() {
        return <BrowserRouter>
            <Switch>
                <Route exact path='/one' component={One} />
                <Route exact path='/one/two' component={Two} />
                <Route exact path='/one/two/three' component={Three} />
            </Switch>
        </BrowserRouter>;
    }
}

Edit 2:
Trying to change the order does not work either. The result is the same as the above mentioned:
import * as React from 'react';
import { BrowserRouter, Switch, Route } from 'react-router-dom';
import { One } from './One';
import { Two } from './Two';
import { Three } from './Three';

export class App2 extends React.Component<{}, {}> {
    public render() {
        return <BrowserRouter>
            <Switch>
                <Route path='/one/two/three' component={Three} />
                <Route path='/one/two' component={Two} />
                <Route path='/one' component={One} />
            </Switch>
        </BrowserRouter>;
    }
}

A: Simply: the most specific route goes first. Just reverse your order.
As with most routers each one is checked in sequential order for a match.
Edit 1: evidence https://reacttraining.com/react-router/web/guides/primary-components
Edit 2: Your 404 error indicates to me that the issue is not the router but the server. Did you build the server or is webpack-dev-server a premade server for serving while you develop? I think you'll find that if you go to /one and click a  to /one/two it will actually work.
Edit 3: Your webpack Dev server config needs something. I don't have experience with this, but here's a doc webpack.js.org/configuration/output/#outputpublicpath that I think should help.
As suggested in the comments: The final solution is adding publicPath: '/' to output in the Webpack config.

A: Try to use exact in your <Route/>
Because your paths always start with /one, react router only matches that part, if you want go deeper, you have to tell him exact(ly) what you want.
<Route exact path='/one' component={One} />
<Route exact path='/one/two' component={Two} />
<Route exact path='/one/two/three' component={Three} />

Here's the link to the docs


text:
Q: Log to filesystem or database? I'm using LAMP and have full access to server configuration and setup.
I am very confused about which is the best method to simply log some data to.
I want to log things like this:

*

*Analytics (server side with PHP) of every visitor.

*When creating a new user, store id number so an email and SMS message can be sent later in a Cron Task (saves from sending the email/SMS during the users' request).

*Number of page views of certain 'articles'. Increment once per visit to that page.

As you can see they are all simple insert/add actions that all can be processed later by a Cron Task.
The application needs to be scalable for the future.
These are my options (and what I have learned):
(1) Database (MySQL). People say don't use this for logging data like above.
(2) Use file_get_contents() WITHOUT a file lock. I'm told this can cause data corruption.
(3) Use file_get_contents() WITH a file lock but I believe this either results in missed data as file_get_contents returns false and doesn't add the data if the lock is in force -OR- it results in PHP having to wait for the lock to release. I don't think MySQL has to wait to do multiple inserts.
Which is the best option? Does it make a difference if I'm handling tens of requests per seconds compared to thousands of requests per second, or would I use the same option?

redpajama_set_name: RedPajamaStackExchange


text:
Q: @QuarkusMain not executed in @QuarkusTest We are using a custom main class with @QuarkusMain annotation. This does not seem to be called when @QuarkusTest annotation is used to run tests. The problem is that we are then missing some common initialization in the tests (timezone, camel integration etc.)
When we uncomment @QuarkusMain and rely on the auto-generated main class which quarkus provides by default, the whole context (including camel) is initialized properly and works out of the box, but obviously we are now missing our customizations.
Is there any way to run @QuarkusTests with @QuarkusMain? Is it not working by design or would this be a bug?
Quarkus version: 2.1.3.Final, quarkus-junit5


text:
Q: how to get two toggle hide/show buttons to take up the same space in a body? Sorry for the poorly worded title. I have two buttons that show/hide pictures. The first button shows 4 images, the second button shows 1 image. If the first button is toggled off (hidden), and the second button is toggled on (showing) the one image appears below where the first 4 images would be if they were showing. How do I get it so that it takes up the same space where those four images would go so it's not sitting at the bottom of the page?
https://codepen.io/anon/pen/YrJPdp
Note when you click the second button while the first one is toggled off, the image is all the way at the bottom of the page.
Here is my js:
// button 1
document.getElementById("ate-multistage").style.visibility = "hidden";
document.getElementById("atl-axial").style.visibility = "hidden";
document.getElementById("atm-multiturn").style.visibility = "hidden";
document.getElementById("tank-bottom-valve").style.visibility = "hidden";
document.getElementById("ball-valve").style.visibility = 'hidden';

function pic1() {
  var x = document.getElementById("ate-multistage");

  if (x.style.visibility === "hidden") {
    x.style.visibility = "visible";
  } else {
    x.style.visibility = "hidden";
  }
}
function pic2() {
  var x = document.getElementById("atl-axial");

  if (x.style.visibility === "hidden") {
    x.style.visibility = "visible";
  } else {
    x.style.visibility = "hidden";
  }
}
function pic3() {
  var x = document.getElementById("atm-multiturn");

  if (x.style.visibility === "hidden") {
    x.style.visibility = "visible";
  } else {
    x.style.visibility = "hidden";
  }
}
function pic4() {
  var x = document.getElementById("tank-bottom-valve");

  if (x.style.visibility === "hidden") {
    x.style.visibility = "visible";
  } else {
    x.style.visibility = "hidden";
  }
}

//button 2
function pic5() {
  var x = document.getElementById("ball-valve");

  if (x.style.visibility === "hidden") {
    x.style.visibility = "visible";
  } else {
    x.style.visibility = "hidden";
  }
}

A: Use display: none and display: block instead of visibility: hidden and visibility: visible. That ensures that the hidden elements do not take up any space when rendered.

The visibility CSS property can show or hide an element without affecting the layout of a document (i.e., space is created for elements regardless of whether they are visible or not). - From MDN

Here's the updated codepen:
https://codepen.io/Nisargshah02/pen/oGaxao?editors=0010


text:
Q: Union and group two collections without any common field How to get all requests of a user grouped and order by create date? Please give mongodb compass aggregation in order to export c# code or codes that be suitable for c#.
My database is MongoDB. I use $group and $push it's work but only for a collection. I cant union the other collection.
The data is here:
    PaymentRequestCollection:
    [
      { _id: 1, createDate: "2022-01-10T19:43:57.625Z", UserId: 5, amount: 24 },
      { _id: 2, createDate: "2022-01-12T16:43:57.625Z", UserId: 14, amount: 34},
      { _id: 3, createDate: "2022-01-12T12:43:57.625Z", UserId: 8, amount: 20 },
      { _id: 4, createDate: "2022-01-10T15:43:57.625Z", UserId: 14, amount: 54 },
    ]

    JobRequestCollection:
    [
      { _id: 24, createDate: "2022-01-12T11:43:57.625Z", UserId: 14, jobTitle: "team leader", subscriptionId: 52 },
      { _id: 25, createDate: "2022-01-10T17:43:57.625Z", UserId: 14, jobTitle: "front-end developer", subscriptionId: 52 },
      { _id: 26, createDate: "2022-01-18T13:43:57.625Z", UserId: 8, jobTitle: ".net back-end developer", subscriptionId: 10 },
    ]

    SubscriptionCollection:
    [
      { _id:10, title: "some title 1" },
      { _id:52, title: "some title 2" }
    ]

Expected result for user with id 14:

    [
       {
       "key": "2022-01-10",
           "group": [
               {
                   "requestType": "PaymentRequest",
                   "amount": "54"
               },
               {
                   "requestType": "JobRequest",
                   "jobTitle": "front-end developer",
                   "subscription": {
                       "title": "some title 2"
                   }
               },
           ]
       },
       {
       "key": "2022-01-12",
           "group": [
               {
                   "requestType": "PaymentRequest",
                   "amount": "34"
               },
               {
                   "requestType": "JobRequest",
                   "jobTitle": "team leader",
                   "subscription": {
                       "title": "some title 2"
                   }
               },
           ]
       }
    ]

Thanks


text:
Q: Workaround to combine multiple properties to create unique constraint in Neo4J Based on previous cybersam answer on the following link How to create unique constraint involving multiple properties in Neo4J

I need to apply his answer on my use case.
CREATE CONSTRAINT ON ( city:City ) ASSERT city.cityName IS UNIQUE
CREATE CONSTRAINT ON ( city:City ) ASSERT city.regionIdentifier IS UNIQUE
That means combine these both properties as group (cityName,regionIdentifier)
CITY PROPERTIES
<id>:3
cityName:BLANKEMPTYVIDE1009
description:BLANKEMPTYVIDE1009
id:3
identifier:3374991009
region:BLANKEMPTYVIDE1009
regionIdentifier:100
zip:3374991009

The same thing should apply by combining these three properties on (sectorname,description,regionIdentifier)
CREATE CONSTRAINT ON ( sector:Sector ) ASSERT sector.description IS UNIQUE
CREATE CONSTRAINT ON ( sector:Sector ) ASSERT sector.regionIdentifier IS UNIQUE
CREATE CONSTRAINT ON ( sector:Sector ) ASSERT sector.sectorName IS UNIQUE
SECTOR PROPERTIES
<id>:2
city:BLANKEMPTYVIDE1002
cityIdentifier:3374991002
description:BLANKEMPTYVIDE1002_BLANKEMPTYVIDE1002
id:2
identifier:3374991002
region:BLANKEMPTYVIDE1002
regionIdentifier:100
sectorName:BLANKEMPTYVIDE1002_BLANKEMPTYVIDE1002
zip:BLANKEMPTYVIDE1002_BLANKEMPTYVIDE1002


text:
Q: select which network used for internet access
Possible Duplicate:
How to stop wifi disconnection when eth0 link becomes ready?

I have got two active network connections on my system:

*

*mobile broadband, DHCP to connect to internet via my ISP

*ethernet static IP for local subnet in home network

Whenever the ethernet connection is active, I lose my internet connection.
Ubuntu seems to be prefering the ethernet port for internet access...
How can I setup my system to always use the mobile broadband for web access?
Thanks for any help.

A: My guess would be, that your static network sets the default gateway. That way, all your internet traffic gets then routed to some other machine without connection to the internet.
Have a look what
route

tells you. If the default gateway is set to s.th. different than your ISP's IP try:
route del default gw
route add default gw <IP of your ISP>

If that doesn't help, it would be useful to know your exact configuration of the two interfaces and the output of route.


text:
Q: Drop a Dependent View in redshift? I wonder ive landed myself up in an unusual problem of dropping all views and tables.
Tables dont have any primary key or foreign key relationship by default just that joined data has been shown through view. But after creating the view of joined tables i am unable to drop any view or table. I have tried both the ways to first drop table then view or vice versa nothing helped but the error shows cascade error even if theres no primary key or foreign key i know thats due to joined tables in view but how to drop them.

A: There are a couple of ways you can go - force the drop of the table or view where all dependent views will also be dropped OR map out the view dependencies.
For the first option just add CASCADE to the drop but be warned that more will be dropped than the table or view you list in the command.  So be sure this is really what you want to do.
The second option will take a little SQL but luckily someone has already written it (awslabs).  https://github.com/awslabs/amazon-redshift-utils/blob/master/src/AdminViews/v_view_dependency.sql  This SQL (as a view or as stand alone SQL) will list out the dependencies of which views are dependent on other views or tables.  You should be able to unwind things with this information.


text:
Q: ReSharper running all tests using Machine Specifications I'm trying to debug a specific MSPEC test, but it seems ReSharper is running all the tests. My session only contains the one test, but breakpoints get triggered and I can clearly see in the stacktrace they're from another test.
After running, the session still displays just the single test I'm trying to run. I also noticed this when not debugging, for example when running a specific test which would get delayed because of other longer running tests.
Using R# Ultimate 2016.2.2 and Machine.Specifications.Runner.Resharper 1.6.0-beta5. I tried different variations, starting a fresh session by adding the test, using Run Test, using Debug Test and still the same behavior - while the session window only shows the one test after running, it's clearly running more than just the one I want.
Am I missing something or is this a bug?

A: Fixed,
My BaseSpec now have a Establish and not a simple constructor, now I can debug test by test, not all


text:
Q: Updating MySQL row headers from dictionary key (Python) I've compiled the below script in Python 2.x which to recursively search a directory and for each JPEG found, parse out the metadata and place it into a dictionary. At present, the output is simply printed to console:-
import os
import fnmatch
import pyexiv2

matches = []
dict1 = {}

# The aim of this script is to recursively search across a directory for all
# JPEG files. Each time a JPEG image is detected, the script used the PYEXIV2
# module to extract all EXIF, IPTC and XMP data from the image. Once extracted
# the key (ie. "camera make" is generated and it's respective value
# (ie. Canon) is then added as the value in a dictionary.

for root, dirnames, filenames in os.walk('C:\Users\XXX\Desktop'):
  for filename in fnmatch.filter(filenames, '*.jpg'):
      matches.append(os.path.join(root, filename))

for entry in matches:
    metadata = pyexiv2.ImageMetadata(entry)
    metadata.read()
    keys = metadata.exif_keys + metadata.iptc_keys + metadata.xmp_keys
    for key in keys:
        dict1[key] = metadata[key].raw_value

    print entry
    print str(dict1)

What I am looking to do is output the results to a MySQL DB. Now, my problem is that I don't have an indefinite list of the metadata headers and indeed I have struggled to locate one and so, for my table row headers, I am looking to compare each value in the dictionary key (ie. date taken, make, model etc...) and if it doesn't exist in the table, for it to be added to my table as a header and for the EXIF data (the key value) to then be entered into the respective columns. I've had a play with MySQL through Python previously but never to compare row headers and dynamically create new ones from variables.
Can anybody point me in the right direction?

A: Instead of adding new data keys as new columns in MySQL table, create a fixed single table with three columns file, data_name, data_value and then you can have dynamic data per file.
You can then easily query the table e.g.
select file from file_data where data_name = 'Serial' and data_value = 'ABCDE'

For multiple field matching you can do a self join e.g.
SELECT * from data t1 JOIN data t2 on t1.file_name = t2.file_name and t1.data_name = "data1" and t1.data_value="value1" and t2.data_name = "data2" and t2.data_value="value2"

Alternatively you can just keep on appending columns to MySQL table dynamically e.g
ALTER TABLE data ADD Serial VARCHAR(60);

You can get the existing columns name using
SHOW COLUMNS FROM `data`;

So every-time you see a new data field add it as column.


text:
Q: Postgresql raises 'data directory has wrong ownership' when trying to use volume I'm trying to run postgresql in docker container, but of course I need to have my database data to be persistent, so I'm trying to use data only container which expose volume to store database at this place.
So, my data container has such Dockerfile:
FROM ubuntu

# Create data directory
RUN mkdir -p /data/postgresql

# Create /data volume
VOLUME /data/postgresql

Which I run:
docker run --name postgresql_data lyapun/postgresql_data true

In my postgresql.conf I set:
data_directory = '/data/postgresql'

Then I run my postgresql container in such way:
docker run -d --name postgre --volumes-from postgresql_data lyapun/postgresql

And I got:
2014-07-04 07:45:57 GMT FATAL:  data directory "/data/postgresql" has wrong ownership
2014-07-04 07:45:57 GMT HINT:  The server must be started by the user that owns the data directory.

How to deal with this issue? I googled a lot to find some information about using postgresql with docker volumes, but I didn't found anything.
Thanks!

A: Ok, seems like I found workaround for this issue.
Instead of running postgres in such way:
CMD ["/usr/lib/postgresql/9.1/bin/postgres", "-D", "/var/lib/postgresql/9.1/main", "-c", "config_file=/etc/postgresql/9.1/main/postgresql.conf"]

I wrote bash script:
chown -Rf postgres:postgres /data/postgresql
chmod -R 700 /data/postgresql
sudo -u postgres /usr/lib/postgresql/9.1/bin/postgres -D /var/lib/postgresql/9.1/main -c config_file=/etc/postgresql/9.1/main/postgresql.conf

And replaced CMD in postgresql image to:
CMD ["bash", "/run.sh"]

It works!

A: You have to set ownership of directory /data/postgresql to the same user, under which you are running your postgresql binary. For example, in Ubuntu it is usually postgres user.
Then you have to use this command:
chown postgres.postgres /data/postgresql

A: A better way to solve that issue, assuming your postgres images is named "postgres" and that your backup is ./backup.tar:
First, add this to your postgres Dockerfile:
VOLUME  ["/etc/postgresql", "/var/log/postgresql", "/var/lib/postgresql"]

Then run:
docker run -it --name postgres -v $(pwd):/db postgres sh -c "tar xvf /db/backup.tar --no-overwrite-dir" && \
docker run -it --name data --volumes-from postgres busybox true && \
docker rm postgres && \
docker run -it --name postgres --volumes-from=data postgres

You don't have permission issues since the archive is extracted by the postgres user of your postgres image, so it is the owner of the extracted files.
You can then backup your data using the data container. The advantage of this solution is that you don't chmod/chown every time you run the image.

A: This type of errors is quite common when you link a NTFS directory into your docker container. NTFS directories don't support ext3 file & directory access control.
The only way to make it work is to link directory from a ext3 drive into your container.
I got a bit desperate when I played around Apache / PHP containers with linking the www folder. After I linked files reside on a ext3 filesystem the problem disappear.
I published a short Docker tutorial on youtube, may it helps to understand this problem: https://www.youtube.com/watch?v=eS9O05TTFjM


text:
Q: полиморфные переменные разбирали такой код в университете:
Класс Car:
public class Car {
    public void drive() {
        System.out.println("Машина едет");
    }
}

Класс Bmw:
public class Bmw extends Car {
    @Override
    public void drive() {
        System.out.println("Бмв едет");
    }
}

Класс Mercedes:
public class Mercedes extends Car {
    @Override
    public void drive() {
        System.out.println("Мерседес едет");
    }
}

Класс Audi:
public class Audi extends Car {
    @Override
    public void drive() {
        System.out.println("Ауди едет");
    }
}

Класс Main:
public class Main {
    public static void main(String[] args) {
        Car bmw = new Bmw();
        bmw.drive();
        Car mercedes = new Mercedes();
        mercedes.drive();
        Car audi = new Audi();
        audi.drive();
    }
}

Это я понимаю: Набор методов, которые можно вызвать у переменной, определяется типом переменной. А какой именно метод какая реализация вызовется, определяется типом/классом объекта, ссылку на который хранит переменная.
А кроме этого есть ли преимущества делать тип ссылочной переменной класс родитель? И вообще почему больше всего примеров где тип ссылочной переменной родитель?

A: Очень часто используется при реализации полиморфизма. Чаще всего Car это вообще абстрактный класс или интерфейс. И тогда при передачи объекта в методы другого объекта, например в метод toWash класса СarWash используется ссылка по типу Car так как автомойке не обязательно (даже скорее не нужно) знать какой марки автомобиль необходимо помыть, действия все равно будут происходить одинаковые (намочить, запенить, смыть и тд.). Тем самым происходит избавление от дублирования кода (иначе вы бы создавали множество методов toWash с разными по типу принимаемыми параметрами Audi, BMW и тд, но с одинаковым телом).


text:
Q: Getting text from a forms input. Javascript I have a lot more code, so this might not look very clean. I am trying to grab some text out of the email input and put in where the p tag is. It doesn't seem to be working. Can someone assist?
 <form class="modal-content" action="#" style="margin-top:10%;">

     Email
     <input id="emailIn" type="email" placeholder=" example@gmail.com" name="email" required>

     <button type="submit" onclick="myFunction()" class="signupbtn">Sign Up</button>

 </form>

A: Do small Changes in your code ,


text:
Q: how do i make a small overlay at the bottom right corner with z-index 5? i need a small overlay to display at the bottom right corner of the page
i can't get the position right
div#overlay {
z-index: 5;
float: right;
}

A: div#overlay { position:absolute; bottom:0; right:0; }

Something like this? z-index is useless without the element having a position of absolute/fixed/relative.


text:
Q: Expanding a data frame with a column that adds no information I've got a data like below:
ex <- structure(list(data = structure(c(16983, 16983, 16983, 16983,
16983, 16983, 16983, 16983, 16983, 16983, 16983, 16983, 16983,
16983, 16983, 16983, 16983, 16983, 16983, 16984, 16984, 16984,
16984, 16984, 16984, 16985, 16985, 16985, 16985, 16985, 16985,
16986, 16986, 16986, 16986, 16986, 16986, 16987, 16987, 16987,
16987, 16988, 16988, 16988, 16988, 16988, 16989, 16989, 16989,
16989), class = "Date"), media = c("Newspapers", "Newspapers",
"Newspapers", "Newspapers", "Magazines", "Magazines", "Magazines",
"Outdoor", "Outdoor", "Outdoor", "Outdoor", "Outdoor", "Outdoor",
"Radio", "Radio", "Radio", "Radio", "Radio", "Radio", "Radio",
"Radio", "Radio", "Radio", "Radio", "Radio", "Radio", "Radio",
"Radio", "Radio", "Radio", "Radio", "Newspapers", "Magazines",
"Radio", "Radio", "Radio", "Radio", "Radio", "Radio", "Radio",
"Radio", "Radio", "Radio", "Radio", "Radio", "Radio", "Newspapers",
"Newspapers", "Magazines", "Radio"), brand_short = c("Brand A",
"Brand B", "Brand C", "Brand D", "Brand E", "Brand C", "Brand D",
"Brand A", "Brand E", "Brand B", "Brand F", "Brand C", "Brand D",
"Brand A", "Brand E", "Brand B", "Brand F", "Brand C", "Brand D",
"Brand A", "Brand E", "Brand B", "Brand F", "Brand C", "Brand D",
"Brand A", "Brand E", "Brand B", "Brand F", "Brand C", "Brand D",
"Brand C", "Brand E", "Brand A", "Brand E", "Brand F", "Brand C",
"Brand A", "Brand E", "Brand F", "Brand C", "Brand A", "Brand E",
"Brand B", "Brand F", "Brand C", "Brand A", "Brand C", "Brand A",
"Brand A"), label = c("ntv0_Newspapers_Brand A", "ntv0_Newspapers_Brand B",
"ntv0_Newspapers_Brand C", "ntv0_Newspapers_Brand D", "ntv0_Magazines_Brand E",
"ntv0_Magazines_Brand C", "ntv0_Magazines_Brand D", "ntv0_Outdoor_Brand A",
"ntv0_Outdoor_Brand E", "ntv0_Outdoor_Brand B", "ntv0_Outdoor_Brand F",
"ntv0_Outdoor_Brand C", "ntv0_Outdoor_Brand D", "ntv0_Radio_Brand A",
"ntv0_Radio_Brand E", "ntv0_Radio_Brand B", "ntv0_Radio_Brand F",
"ntv0_Radio_Brand C", "ntv0_Radio_Brand D", "ntv0_Radio_Brand A",
"ntv0_Radio_Brand E", "ntv0_Radio_Brand B", "ntv0_Radio_Brand F",
"ntv0_Radio_Brand C", "ntv0_Radio_Brand D", "ntv0_Radio_Brand A",
"ntv0_Radio_Brand E", "ntv0_Radio_Brand B", "ntv0_Radio_Brand F",
"ntv0_Radio_Brand C", "ntv0_Radio_Brand D", "ntv0_Newspapers_Brand C",
"ntv0_Magazines_Brand E", "ntv0_Radio_Brand A", "ntv0_Radio_Brand E",
"ntv0_Radio_Brand F", "ntv0_Radio_Brand C", "ntv0_Radio_Brand A",
"ntv0_Radio_Brand E", "ntv0_Radio_Brand F", "ntv0_Radio_Brand C",
"ntv0_Radio_Brand A", "ntv0_Radio_Brand E", "ntv0_Radio_Brand B",
"ntv0_Radio_Brand F", "ntv0_Radio_Brand C", "ntv0_Newspapers_Brand A",
"ntv0_Newspapers_Brand C", "ntv0_Magazines_Brand A", "ntv0_Radio_Brand A"
), var1 = c(2, 3, 2, 1, 6, 1, 2, 0, 0, 0, 0, 0, 0, 451, 6, 468,
921, 800, 258, 36, 14, 546, 1316, 749, 264, 36, 15, 608, 918,
1097, 265, 1, 1, 25, 4, 3, 1129, 25, 4, 3, 981, 46, 5, 552, 4,
989, 1, 1, 1, 65), var2 = c(9240, 41030, 146280, 45000, 792500,
151900, 115483, 302125, 4034, 555326, 2661, 5806, 48268, 473789,
60340, 237996, 484655, 415685, 338373, 6185, 39760, 149848, 315474,
210416, 159881, 5577, 24150, 100646, 174513, 317148, 106100,
98280, 164450, 3730, 17990, 160, 941389, 3726, 18060, 152, 765857,
14152, 34790, 354024, 862, 872216, 6240, 16450, 1870, 20458)), class = c("tbl_df",
"tbl", "data.frame"), row.names = c(NA, -50L))

I want to have rows for all combinations of data, media and brand_short filling var1 and var2 with 0 if a combination was absent in data. I also would like to preserve label variable, which - as you can notice - is created using media and brand_short. I know there's tidyr::complete function designed specifically for that, but I'm having troubles with appropriate call. The one I have tried:
ex %>% complete(data, nesting(media, brand_short, label), fill = list(var1 = 0, var2 = 0))

doesn't produce for all brands or produce additional, unwanted labels:
ex %>% complete(data, media, nesting(brand_short, label), fill = list(var1 = 0, var2 = 0))

How can I make my data frame to have for any specific date all media and brand_short combinations (so 24 rows for every date), but not combining with label?

A: You're overthinking it. You don't need to nest anything because you want all possible combinations of data,media and brand_short. label should not be included. To update the label, use a mutate statement afterwards.
ex %>% complete(data,media,brand_short,fill=list(var1=0,var2=0)) %>%
mutate(label=paste('ntv0',media,brand_short,sep='_'))
# A tibble: 168 x 6
   data       media      brand_short label                    var1   var2
   <date>     <chr>      <chr>       <chr>                   <dbl>  <dbl>
 1 2016-07-01 Magazines  Brand A     ntv0_Magazines_Brand A      0      0
 2 2016-07-01 Magazines  Brand B     ntv0_Magazines_Brand B      0      0
 3 2016-07-01 Magazines  Brand C     ntv0_Magazines_Brand C      1 151900
 4 2016-07-01 Magazines  Brand D     ntv0_Magazines_Brand D      2 115483
 5 2016-07-01 Magazines  Brand E     ntv0_Magazines_Brand E      6 792500
 6 2016-07-01 Magazines  Brand F     ntv0_Magazines_Brand F      0      0
 7 2016-07-01 Newspapers Brand A     ntv0_Newspapers_Brand A     2   9240
 8 2016-07-01 Newspapers Brand B     ntv0_Newspapers_Brand B     3  41030
 9 2016-07-01 Newspapers Brand C     ntv0_Newspapers_Brand C     2 146280
10 2016-07-01 Newspapers Brand D     ntv0_Newspapers_Brand D     1  45000
# ... with 158 more rows


text:
Q: Linq join with COUNT I have 2 tables, Forums and Posts.
I want to retrieve all Forums fields with a new extra field: count all post that belong to this forum.
I have this for now:
var v =(from forum in Forums
    join post in Posts on forum.ForumID equals post.Forum.ForumID
    select new
    {
        forum, //Need to retrieve all fields/columns from forum
        PostCount = //count all post that belong to this forum with a condition: count it only if post.Showit==1

    }
    ).Distinct()

*

*The join must be Left join: if there are no post that belongs to some forum, the forums fields should be retrieved but PostCount field should be 0.

*The result set must be distinct (join gives me the full cross...or how it's called)

A: If you connect Forums to Posts in the linqtosql designer, this will create a relationship property that can be queried.
var query =
  from f in db.Forums
  select new
  {
    forum = f,
    PostCount = f.Posts.Count(p => p.ShowIt == 1)
  };

A: I think you want something like:
from forum in Forums
// ForumID part removed from both sides: LINQ should do that for you.
// Added "into postsInForum" to get a group join
join post in Posts on forum equals post.Forum into postsInForum
select new
{
    Forum = forum,
    // Select the number of shown posts within the forum
    PostCount = postsInForum.Where(post => post.ShowIt == 1).Count()
}

Or (as pointed out in the comments) you can put a condition in the Count call - I always forget that's available :)
from forum in Forums
// ForumID part removed from both sides: LINQ should do that for you.
// Added "into postsInForum" to get a group join
join post in Posts on forum equals post.Forum into postsInForum
select new
{
    Forum = forum,
    // Select the number of shown posts within the forum
    PostCount = postsInForum.Count(post => post.ShowIt == 1)
}

Another alternative for the filtering of only "shown" posts would be to do it in the join:
from forum in Forums
join post in Posts.Where(post => post.ShowIt == 1)
    on forum equals post.Forum into shownPostsInForum
select new
{
    Forum = forum,
    // Select the number of shown posts within the forum
    PostCount = shownPostsInForum.Count()
}

I believe all of these are logically correct, but I don't know what the SQL will look like...


text:
Q: Having trouble with writing a recursive function that enforces correct user input via use of `input` and getting the `return` correctly The code is working well now, except when the user attempts to enter a string (or float) instead of an integer when being asked pizza questions.
Ideally I would like for the question to be repeated and not to exit the function.  I assume this is possible with loops but I'm not sure how to go about doing that here.
Otherwise simply hopping out of the function to start from scratch is fine too.  The problem is that when this happens, it ends up still trying to return later information which has now been botched (I don't even know how since they should have updated upon the most recent iterations)
I tried just return as well as return None.
def get_pizza_info(size, meats, veg, quantity):
    try:
        size = int(input("Enter size from 1-3: "))
    except ValueError:
        print("Error, please enter a whole number. ")
        get_pizza_info(size, meats, veg, quantity)
        return None
    try:
        meats = int(input("Enter number of meat toppings "))
    except ValueError:
        print("Error, enter a whole number. ")
        get_pizza_info(size, meats, veg, quantity)
        return None
    try:
        veg = int(input("Enter number of non-meat toppings "))
    except ValueError:
        print("Error, enter a whole number. ")
        get_pizza_info(size, meats, veg, quantity)
        return None
    try:
        quantity = int(input("Enter number of these pizzas "))
    except ValueError:
        print("Error, enter a whole number. ")
        get_pizza_info(size, meats, veg, quantity)
        return None
    if size >= 4:
        size = 3
    if size <= 1:
        size = 1
    if meats <= 1:
        meats = 1
    if veg <= 1:
        veg = 1
    return size, meats, veg, quantity


text:
Q: PostgreSQL BDR issues with replication slots If I may, I would like to write a brief summary of the issue before I add more details to make my question cleaner and clearer:
I have a BDR group running in production, replication works fine in all nodes, but I'm getting errors regarding a replication slot in one of the nodes that I would like to fix without breaking anything else...
More details:
I have a three-node BDR group running on PostgreSQL 9.4, 2 nodes using RedHat7, another using Centos7. The database name is "MCT".
node_sysid         |node_timeline|node_dboid|node_status|node_name |node_local_dsn |node_init_from_dsn |node_read_only|
-------------------|-------------|----------|-----------|----------|---------------|-------------------|--------------|
6363474972929529353|            4|    263746|r          |REDHAT_1  |172.16.5.180   |                   |false         |
6182181726884158214|            2|    623638|r          |REDHAT_2  |192.168.251.30 | 172.16.5.180      |false         |
6197060214704992943|            2|    224093|r          |CENTOS_1  |172.16.5.184   | 172.16.5.180      |false         |

The replication is working perfectly from any node to the rest, but...
All nodes are showing issues with replication slots in their logs:
REDHAT_1:
2020-11-25 13:26:50.051 CET,"postgres","MCT",6607,"192.168.251.30:60463",5fbe4d8a.19cf,1,"idle",2020-11-25 13:26:50 CET,23/0,0,ERROR,55006,"replication slot ""bdr_263746_6182181726884158214_2_16389__"" is already active for pid 6097",,,,,,,,,"bdr (6182181726884158214,2,16389,):receive"

REDHAT_2:
2020-11-25 13:26:36.153 CET,,,2142,,5fbe48a5.85e,1015,,2020-11-25 13:05:57 CET,,0,LOG,00000,"proceso «background worker»: bdr (6182181726884158214,2,16389,)->bdr (6197060214704992943,2, (PID 12152) terminó con código de salida 1",,,,,,,,,""
2020-11-25 13:26:39.375 CET,,,2142,,5fbe48a5.85e,1016,,2020-11-25 13:05:57 CET,,0,LOG,00000,"iniciando el proceso «background worker» «bdr (6182181726884158214,2,16389,)->bdr (6363474972929529353,4,»",,,,,,,,,""
2020-11-25 13:26:39.389 CET,,,12154,,5fbe4d7f.2f7a,1,,2020-11-25 13:26:39 CET,14/0,0,FATAL,XX000,"could not send replication command ""START_REPLICATION SLOT ""bdr_263746_6182181726884158214_2_16389__"" LOGICAL CE4/BD6AF6A8 (pg_version '90410', pg_catversion '201409291', bdr_version '10002', bdr_variant 'BDR', min_bdr_version '700', sizeof_int '4', sizeof_long '8', sizeof_datum '8', maxalign '8', float4_byval '1', float8_byval '1', integer_datetimes '1', bigendian '0', db_encoding 'UTF8', replication_sets '""default""', db_encoding 'UTF8')"": ERROR:  replication slot ""bdr_263746_6182181726884158214_2_16389__"" is already active for pid 6097, sqlstate: 55006",,,,,,,,,"bdr (6182181726884158214,2,16389,): apply"
2020-11-25 13:26:39.390 CET,,,2142,,5fbe48a5.85e,1017,,2020-11-25 13:05:57 CET,,0,LOG,00000,"proceso «background worker»: bdr (6182181726884158214,2,16389,)->bdr (6363474972929529353,4, (PID 12154) terminó con código de salida 1",,,,,,,,,""
2020-11-25 13:26:41.155 CET,,,2142,,5fbe48a5.85e,1018,,2020-11-25 13:05:57 CET,,0,LOG,00000,"iniciando el proceso «background worker» «bdr (6182181726884158214,2,16389,)->bdr (6197060214704992943,2,»",,,,,,,,,""
2020-11-25 13:26:41.165 CET,,,12155,,5fbe4d81.2f7b,1,,2020-11-25 13:26:41 CET,14/0,0,FATAL,XX000,"could not send replication command ""START_REPLICATION SLOT ""bdr_224093_6182181726884158214_2_16389__"" LOGICAL 9B4/F020E568 (pg_version '90410', pg_catversion '201409291', bdr_version '10002', bdr_variant 'BDR', min_bdr_version '700', sizeof_int '4', sizeof_long '8', sizeof_datum '8', maxalign '8', float4_byval '1', float8_byval '1', integer_datetimes '1', bigendian '0', db_encoding 'UTF8', replication_sets '""default""', db_encoding 'UTF8')"": ERROR:  replication slot ""bdr_224093_6182181726884158214_2_16389__"" is already active for pid 2192

CENTOS_1:
2020-11-25 13:26:56.208 CET,"postgres","MCT",2668,"192.168.251.30:55270",5fbe4d90.a6c,1,"idle",2020-11-25 13:26:56 CET,10/0,0,ERROR,55006,"replication slot ""bdr_224093_6182181726884158214_2_16389__"" is already active for pid 2192",,,,,,,,,"bdr (6182181726884158214,2,16389,):receive"

If I run this query:
select
    pg_catalog.inet_server_addr() as server_addr,
    pg_xlog_location_diff(pg_current_xlog_insert_location(),
    flush_location)::int8 as lag_bytes,
    pid,
    application_name,
    client_addr,
    state
from
    pg_stat_replication;

I get this results:
REDHAT_1:
server_addr |lag_bytes|pid |application_name                           |client_addr   |state    |
------------|---------|----|-------------------------------------------|--------------|---------|
172.16.5.180|    21088|6131|bdr (6197060214704992943,2,224093,):receive|172.16.5.184  |streaming|
172.16.5.180|    14440|6097|bdr (6182181726884158214,2,16389,):receive |192.168.251.30|streaming|
172.16.5.180|     3616|6099|bdr (6182181726884158214,2,623638,):receive|192.168.251.30|streaming|

REDHAT_2:
server_addr |lag_bytes|pid |application_name                           |client_addr   |state    |
------------|---------|----|-------------------------------------------|--------------|---------|
172.16.5.184|        0|2191|bdr (6182181726884158214,2,623638,):receive|192.168.251.30|streaming|
172.16.5.184|        0|2192|bdr (6182181726884158214,2,16389,):receive |192.168.251.30|streaming|
172.16.5.184|        0|2203|bdr (6363474972929529353,4,263746,):receive|172.16.5.180  |streaming|

CENTOS_1:
server_addr   |lag_bytes|pid |application_name                           |client_addr   |state    |
--------------|---------|----|-------------------------------------------|--------------|---------|
192.168.251.30|        0|4298|bdr (6182181726884158214,2,16389,):receive |192.168.251.30|streaming|
192.168.251.30|        0|5123|bdr (6197060214704992943,2,224093,):receive|172.16.5.184  |streaming|
192.168.251.30|        0|4313|bdr (6363474972929529353,4,263746,):receive|172.16.5.180  |streaming|

And this query:
select
    slot_name,
    plugin,
    slot_type,
    datoid,
    "database",
    active,
    xmin,
    catalog_xmin,
    restart_lsn
from
    pg_catalog.pg_replication_slots;

REDHAT_1:
slot_name                                |plugin|slot_type|datoid|database|active|xmin|catalog_xmin|restart_lsn |
-----------------------------------------|------|---------|------|--------|------|----|------------|------------|
bdr_263746_6182181726884158214_2_16389__ |bdr   |logical  |263746|MCT     |true  |    |2466301995  |CE4/CDA614E8|
bdr_263746_6182181726884158214_2_623638__|bdr   |logical  |263746|MCT     |true  |    |2466301995  |CE4/CDA614E8|
bdr_263746_6197060214704992943_2_224093__|bdr   |logical  |263746|MCT     |true  |    |2466301995  |CE4/CDA614E8|

REDHAT_2:
slot_name                                |plugin|slot_type|datoid|database|active|xmin|catalog_xmin|restart_lsn |
-----------------------------------------|------|---------|------|--------|------|----|------------|------------|
bdr_224093_6182181726884158214_2_16389__ |bdr   |logical  |224093|MCT     |true  |    |1464775472  |9B4/FED0BCA8|
bdr_224093_6182181726884158214_2_623638__|bdr   |logical  |224093|MCT     |true  |    |1464775472  |9B4/FED0BCA8|
bdr_224093_6363474972929529353_4_263746__|bdr   |logical  |224093|MCT     |true  |    |1464775472  |9B4/FED0BCA8|

CENTOS_1:
    slot_name                                |plugin|slot_type|datoid|database|active|xmin|catalog_xmin|restart_lsn |
    -----------------------------------------|------|---------|------|--------|------|----|------------|------------|
    bdr_623638_6363474972929529353_4_263746__|bdr   |logical  |623638|MCT     |true  |    |546376380   |85C/647FE110|
    bdr_623638_6182181726884158214_2_16389__ |bdr   |logical  |623638|MCT     |true  |    |546376380   |85C/647FE110|
    bdr_623638_6197060214704992943_2_224093__|bdr   |logical  |623638|MCT     |true  |    |546376380   |85C/647FE110|

So, I wonder how I could get rid of that error without breaking anything in the BDR that is currently working on production.
Any thoughts?
Thank you in advance!

A: The underlying issue was a second DB named "OLD" in REDHAT_2 node that was trying to sync with "MCT" in all nodes and was taking the ownership of replication slots so the real "MCT" nodes can't really open a connection.
Taking BDR down in the "OLD" Database and restarting PSQL solved the issue. Thanks


text:
Q: Sequential Files execution I have a master.bat file, which contains:
call file1.bat
call file2.bat

I want file2.bat should not start run until file1.bat completes its execution and generates the output, but in my case file2.bat runs without waiting for file1.bat to complete its execution.
Execution time of files are as follows:
file1.bat= 70 sec
file3.bat= 20 sec

EDIT1
Contents of both batch files are:
file1.bat
@ECHO OFF
setlocal enabledelayedexpansion
SET "keystring1="
(
FOR /f "delims=" %%a IN (
Source.txt
 ) DO (
ECHO %%a|FIND "Appprocess.exe" >NUL
IF NOT ERRORLEVEL 1 SET keystring1=%%a
FOR %%b IN (App1 App2 App3 App4 App5 App6 ) DO (
ECHO %%a|FIND "%%b" >NUL
IF NOT ERRORLEVEL 1 IF DEFINED keystring1 CALL ECHO(%%keystring1%% %%b&SET   "keystring1="

)))>result.txt

GOTO :EOF

file2.bat
@echo off
setlocal enabledelayedexpansion

(for /f "tokens=1,2" %%a in (memory.txt) do (
for /f "tokens=5" %%c in ('find " %%a " ^< result.txt ') do echo %%c %%b
))> new.txt

A: Running another bat / cmd script using "call" actually does wait for that process to finish before going to the next statement. So, there is something else going on within your "file2.bat", or whatever it calls, that is allowing part of that process to continue while the main process believes file2.bat has completed.
You could try using the "Start" command which lets you specify whether or not to wait until whatever you "start" finishes before moving to the next line. By default it goes to the next line without waiting for its process to complete, but you can specify "/wait" and it will not continue until its process has finished. Type "help start" at the DOS / Command prompt for details.
Note: it is usually best to use the "cmd" extension on scripts instead of "bat" as "cmd" scripts always run in a 32-bit space but "bat" scripts sometime run in a 16-bit space.

A: REM File1.bat
REM DO YOUR FILE STUFF

Call file2.bat

and then
REM File2.bat
REM DO YOUR FILE STUFF

Call file3.bat

and theenn
REM File3.bat
REM DO YOUR FILE STUFF
REM Done? or call next file to run


text:
Q: Most efficient way to export DataTable to Excel File (.xlsx) I wanted to know what is the most efficient way to export a DataTable or DataSet to an .xlsx file in terms of speed.
I have tables of 200K rows and looping is useless, so I want to make like a bulk export or something like that.
Anything easy to implement answer my question?
SOLUTION:
I finally used OpenXml by this way, if someone needs it. It exports 100k in about 1 minute:
    private void ExportDataSet(DataSet ds, string destination)
    {
        using (var workbook = SpreadsheetDocument.Create(destination, DocumentFormat.OpenXml.SpreadsheetDocumentType.Workbook))
        {
            var workbookPart = workbook.AddWorkbookPart();

            workbook.WorkbookPart.Workbook = new DocumentFormat.OpenXml.Spreadsheet.Workbook();

            workbook.WorkbookPart.Workbook.Sheets = new DocumentFormat.OpenXml.Spreadsheet.Sheets();

            foreach (System.Data.DataTable table in ds.Tables)
            {

                var sheetPart = workbook.WorkbookPart.AddNewPart<WorksheetPart>();
                var sheetData = new DocumentFormat.OpenXml.Spreadsheet.SheetData();
                sheetPart.Worksheet = new DocumentFormat.OpenXml.Spreadsheet.Worksheet(sheetData);

                DocumentFormat.OpenXml.Spreadsheet.Sheets sheets = workbook.WorkbookPart.Workbook.GetFirstChild<DocumentFormat.OpenXml.Spreadsheet.Sheets>();
                string relationshipId = workbook.WorkbookPart.GetIdOfPart(sheetPart);

                uint sheetId = 1;
                if (sheets.Elements<DocumentFormat.OpenXml.Spreadsheet.Sheet>().Count() > 0)
                {
                    sheetId =
                        sheets.Elements<DocumentFormat.OpenXml.Spreadsheet.Sheet>().Select(s => s.SheetId.Value).Max() + 1;
                }

                DocumentFormat.OpenXml.Spreadsheet.Sheet sheet = new DocumentFormat.OpenXml.Spreadsheet.Sheet() { Id = relationshipId, SheetId = sheetId, Name = table.TableName };
                sheets.Append(sheet);

                DocumentFormat.OpenXml.Spreadsheet.Row headerRow = new DocumentFormat.OpenXml.Spreadsheet.Row();

                List<String> columns = new List<string>();
                foreach (System.Data.DataColumn column in table.Columns)
                {
                    columns.Add(column.ColumnName);

                    DocumentFormat.OpenXml.Spreadsheet.Cell cell = new DocumentFormat.OpenXml.Spreadsheet.Cell();
                    cell.DataType = DocumentFormat.OpenXml.Spreadsheet.CellValues.String;
                    cell.CellValue = new DocumentFormat.OpenXml.Spreadsheet.CellValue(column.ColumnName);
                    headerRow.AppendChild(cell);
                }

                sheetData.AppendChild(headerRow);

                foreach (System.Data.DataRow dsrow in table.Rows)
                {
                    DocumentFormat.OpenXml.Spreadsheet.Row newRow = new DocumentFormat.OpenXml.Spreadsheet.Row();
                    foreach (String col in columns)
                    {
                        DocumentFormat.OpenXml.Spreadsheet.Cell cell = new DocumentFormat.OpenXml.Spreadsheet.Cell();
                        cell.DataType = DocumentFormat.OpenXml.Spreadsheet.CellValues.String;
                        cell.CellValue = new DocumentFormat.OpenXml.Spreadsheet.CellValue(dsrow[col].ToString()); //
                        newRow.AppendChild(cell);
                    }

                    sheetData.AppendChild(newRow);
                }

            }
        }
    }

A: You must be looping through the records, and that's why it's so slow.
Try something like this.
var lines = new List<string>();

string[] columnNames = dataTable.Columns.Cast<DataColumn>().
                                  Select(column => column.ColumnName).
                                  ToArray();

var header = string.Join(",", columnNames);
lines.Add(header);

var valueLines = dataTable.AsEnumerable()
                   .Select(row => string.Join(",", row.ItemArray));
lines.AddRange(valueLines);

File.WriteAllLines("excel.csv",lines);

Or, turn the DataTable into an Excel file.
XLWorkbook wb = new XLWorkbook();
DataTable dt = GetDataTableOrWhatever();
wb.Worksheets.Add(dt,"WorksheetName");

A: Personally I prefer Syncfusion's Excel library just because it's pretty intuitive, well documented and free with the community license.
You can download it here: XlsIO Product Page
And the documentation can be found here: XlsIO Documentation
It's free to use if you claim the free community license.
Here is a code sample for writing a DataTable to an xlsx file. I don't think the size of your table should be a problem at all but I'm not 100% sure, the largest files I've written with this library have about 90k rows with 60 columns and I did not have any issues.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using Syncfusion.XlsIO;
namespace ConsoleApp3
{
    class Program
    {
        static void Main(string[] args)
        {
            DataTable Table = new DataTable();
            Table.Columns.Add("Column1");
            Table.Columns.Add("Column2");
            Table.Columns.Add("Column3");
            Table.Rows.Add("Item1", "Item2", "Item3");

            ExcelEngine ExcelEngineObject = new Syncfusion.XlsIO.ExcelEngine();
            IApplication Application = ExcelEngineObject.Excel;
            Application.DefaultVersion = ExcelVersion.Excel2013;
            IWorkbook Workbook = Application.Workbooks.Create(1);
            IWorksheet Worksheet = Workbook.Worksheets[0];
            Worksheet.ImportDataTable(Table, true, 1, 1);
            Workbook.SaveAs("YourExcelFile.xlsx");
            Workbook.Close();
            ExcelEngineObject.Dispose();

        }
    }
}


text:
Q: Can I use ALTER DATABASE to rename a mysql database? I am using PDO with PHP to create a new database and then a new user with privileges on that database. In case one of them fails, I want to rename the database and user so that they can be deleted later and the names are available.
Is it possible to rename a mysql database using the ALTER DATABASE?

A: Duplicate -- see How do I quickly rename a mysql database (change schema name)
In short, no. MySQL doesn't have a quick/simple way to rename databases. You have to use mysqladmin and mysqldump from the command line. See question above for all the details.

A: To rename MySQL database is not possible using ALTER but you can do it using phpMyAdmin.
After Selecting your database from left panel go to "Operations" then rename the database.
Another way.. go to your data folder on MySQL and rename the folder name of your database.


text:
Q: Is it possible to define a C++ member function who's definition is local to a file and therefore allow multiple versions to coexist I'm trying to make a string class that can convert automatically to and from std::string.
class MyString
{
  MyString(const std::string)
  {
    ...
  }
};

The issue is different compilers can have different layouts of std::string (e.g. Visual Studio 2010 vs 2015). So this constructor or autocast operator must be a function local to each compilation unit, AKA a static function. But you can't simply declare the member as static because the meaning isn't the same.
I know a guaranteed solution is to use a non-member function to do conversions and declare that as static. But would really appreciate a member function.
static MyString StringToMyString(const std::string& s);

A: I've considered forced inlining (even when optimizations are off), symbol aliasing, and symbol versioning and found forced inlining to be the simplest and most portable. __attribute__((alias)), requires the mangled C++ name and symbol versioning only works for shared libs and requires dynamic linker support. Here's an example that has 2 layouts for class My.
#include <stdio.h>
#define NO_INLINE __attribute__((noinline))
#define FORCE_INLINE __attribute__((always_inline))

class My
{
public:
  FORCE_INLINE My(const String& s)
  {
    printf("creating from %s size=%d\n",s.s,(int)sizeof(s));
    Construct(s.s);
  }
  NO_INLINE void Construct(const char* s)
  {
    printf("Construct(%s)\n",s);
  }
};
void LibFunction();
#ifdef CLIENT
int main(int argc,char**argv)
{
  String s;
  s.s="string1";
  My my(s);
  LibFunction();
  return 0;
}
#else
void LibFunction()
{
  String s;
  s.s="string2";
  My my(s);
}
#endif

The output is this and is the same with or without optimizations
creating from string1 size=48
Construct(string1)
creating from string2 size=8
Construct(string2)

I've also investigated how QT deals with multiple layouts. In version 3.3, https://doc.qt.io/archives/3.3/qstring-h.html, it doesn't seem to:
class Q_EXPORT QString
{
    QString( const std::string& );
};

Now, it's no longer a member function, but a private function to each compilation unit, presumably to allow multiple string layouts
class Q_CORE_EXPORT QString
{
  static inline QString fromStdString(const std::string &s);
};


text:
Q: Changing CSS Property From an Array using JS I am currently building a todo app, and from react, I am using CSS to custom my todo items' margin!
The problem is, I only needed the first element to have a margin-top of 110px. Here's what it'll look like when I apply it to every item - link
It's that the todolist items are too separated!
But if I removed the margin of 110px, the item is behind the textbox!
link
Is there a way to change the property of first item? I can delete the margin-top: 110px from the css file, and change the 1st item using JS. My planned function -
function addTodo() {
  setList([...list, value]);
  const firstItem = list.findIndex(0);
}

Thanks!

A: :first-of-type selector in CSS allows you to target the first occurence of an element within its container. Also, another option might be to select first child of the element, you can use :first-child pseudo-class.

A: There are several possibilities to solve this problem. I think the simplest one is to just build a container that contains all list items, and set it's padding-top or margin-top to 110px. The result could look like this:

.frame {
  margin-left: auto;
  margin-right: auto;
  padding: 10px;
  width: 200px;
  border: 1px solid #000;
  text-align: center;
}

.control-button {
  position: absolute;
}

/* this is the container that holds all your items */
.items-container {
  margin-top: 40px; /* in your case, it should be 110px */
}

.item {
  margin-top: 10px;
  border: 1px solid #000;
}

        add item

          This is an item.

          This is another item.

I think this solution is the most simple and flexible one. You can easily add left, right or bottom margins too and you don't have to worry about which items it affects.

A: The simplest solution you can go with is using the :nth-child(n) pseudo class in CSS or :first-of-type.
Try this code:
.item:nth-child(1) {
  margin-top: 110px;
}


text:
Q: Resizing a directx control automatically with the window form size? This app I am making is perhaps going to be deployed on machines with differing screen sizes. Whilst I am setting the form to be maximised by default, the size of the directx control (which I want maximised also) needs to be done manually at present in code which isn't ideal.  I wondered if there is an easy way to have it resize automatically with the size of the form window.
The winform is mazimised with:
this.WindowState = FormWindowState.Maximized;

And the directx control window with:
this.ClientSize = new System.Drawing.Size(1200, 1200);

I thought something like this would work, but it didn't (those properties aren't even available):
this.ClientSize = new System.Drawing.Size(Form.Height, Form.Width);

Sorry I am still very new!

A: On the Form's resize event, you have to call directx device's reset method putting new presentationparameters in. Also, you should use XNA over Managed Directx..


text:
Q: Interact with EBean Model classes in PlayFramework through h2-browser and console Is it possible to interactively execute commands in the Play Console to change the Model of a Play application and see the changes in the in-memory database?
I know that it is possible to browse the in-memory database through the h2-browser command in a Play application.
The steps that I follow are:

*

*Start play console

*Execute h2-browser

*Execute run

*Go to http://localhost:9000 to refresh application and start Database

*Go to http://192.168.56.1:8082/ to connect to the Database

I also know that it is possible to start the console and execute Scala commands. For example, if I have a model entity Person and I execute:
> play console
...
scala> import Models.Person
scala> val john = new Person("john")
scala> john.save()

It raises an exception:
    avax.persistence.PersistenceException: The default EbeanServer has not been defined? This is normally set via the ebean.datasource.default property. Otherwise it should
 be registered programatically via registerServer()
       at com.avaje.ebean.Ebean$ServerManager.getPrimaryServer(Ebean.java:178)
       at com.avaje.ebean.Ebean$ServerManager.access$300(Ebean.java:128)
       at com.avaje.ebean.Ebean.save(Ebean.java:453)
       at play.db.ebean.Model.save(Model.java:91)
...

I think the reason is that it is using a different Play application...is it possible to refer to the application that is running on the other window? Or to execute run on Play in the background and be able to open the console later?

A: I hope you don't need this anymore, but since your question was one of the first result I got when I searched for the same topic, here is the solution, in case other people needs it.
The problem is that when you launch the console you are not using the same instance of the running application, to use Ebean in the scala console just run first your app with this commands:
scala> import play.core._
scala> new StaticApplication(new java.io.File("."))

That's it! Now you can import your Ebean Model, instantiate it and play around with it.
For more information and tips on the Play console I found this post on https://playlatam.wordpress.com


text:
Q: Filter Genserver Termination Logs (translator_inspect_opts?) What is the best way to filter the logging output of a GenServer termination event? It seems like Elixir.Logger allows for :translator_inspect_opts which provide for some configuration here, but I'm not clear on how to handle the following situation:
The default logging output when a Genserver terminates includes the last message received and the state, like so:
10:06:00.165 [error] GenServer #PID<0.378.0> terminating
** (FunctionClauseError) no function clause matching in
Module.handle_info/2 path_to_file.ex:30:
...
Last message: {:DOWN, #Reference<0.1522575658.3956015107.616>,
:process, #PID<0.295.0>, {:function_clause, [{Module.function,
:handle_info, [{#Reference<0.1522575658.3968335873.44738>, {:ok,
#Port<0.84>, #PID<0.363.0>}}]}
State: {%{#Reference<0.1522575658.3956015107.615> => [STATE],
...

In some cases I would like to omit the message and state entirely from the error log, and in some cases I would like to filter out some of the parameters included in each. How can I handle this situation?

A: AFAICT, it is not possible through Logger configuration and it in general looks like an XY problem. Your willingness to omit logs on some {:DOWN, _, _, _, _}, state events hints that you actually want to treat them differently. Just do it—ErlangVM is very friendly.
Implement the following GenServer.handle_info/2 in your GenServer:
@impl
def handle_info({:DOWN, ref, what, pid, reason}, state) do
  ...
end

maybe with different clauses and handle different cases differently.


text:
Q: Windows XP in VM - how to access files whithout activating the VM I have Windows XP in an orderly VM and want yo access it from Windows 7 but every time I start it the XP requests connection to a Microsoft Registration Server - a thing that I cannot do from my computer.
Question : how can I access the file system in the VM without activating it

A: Make a new Windows VM that you can properly license.  Even a trial license is good if you just want to copy the files off and put them somewhere else.  After you have your new VM up and running, power it off, and then add a disk to it.  When you go through the wizard, don't choose new disk, but instead choose to add an already existing disk.  Then navigate to the file that contains the disk for your XP machine.  When you boot up again, you should see the XP disk as a second drive (probably D: or E:).

A: If you want to access the VM's files without powering on the VM and if you're using VMware Workstation (Pro) on a  Windows host, you can choose File > Map Virtual Disks, click the Map button and select the .vmdk file for your Windows XP VM.
If you're on Windows but don't have VMware Workstation (Pro), you should be able to use the vmware-mount command-line tool from the Virtual Disk Development Kit.

A: If your VM is created using VMware. VMware Workstation (not just Player) allows you to mount the image natively as a drive on Windows. Just right-click the image file icon to do so. If you don't have VMware Workstation, you can still use archiving software that support the VMDK format to view or copy out files in read-only mode. For example, 7-Zip supports reading a single VMDK file with NTFS file systems inside (note that it doesn't support split VMDK files yet).


text:
Q: sending an svg string using jquery ajax to mvc controller? I am trying to send an SVG string to the controller but it is null when it reaches the server.
$.ajax({

        type: "GET",
        url: "/chart/GetChartImage",
        data: JSON.stringify({ svgString: svg }),
        dataType: "text",
        contentType: "application/text; charset=utf-8"

    }).done(function (data) {

        debugger

    });

the data being sent:
"{"svgString":"<svg xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" width=\"800\" height=\"400\"><desc>Created with Highcharts 3.0.1</desc><defs><clipPath id=\"highcharts-17\"><rect rx=\"0\" ry=\"0\" fill=\"none\" x=\"0\" y=\"0\" width=\"9999\" height=\"400\"></rect></clipPath><clipPath id=\"highcharts-18\"><rect fill=\"none\" x=\"0\" y=\"0\" width=\"780\" height=\"344\"></rect></clipPath></defs><rect rx=\"5\" ry=\"5\" fill=\"#FFF\" x=\"0\" y=\"0\" width=\"800\" height=\"400\"></rect><g class=\"highcharts-grid\" ></g><g class=\"highcharts-grid\" ><path fill=\"none\" d=\"M 10 316.5 L 790 316.5\" stroke=\"#C0C0C0\" stroke-width=\"1\"  opacity=\"1\"></path><path fill=\"none\" d=\"M 10 247.5 L 790 247.5\" stroke=\"#C0C0C0\" stroke-width=\"1\"  opacity=\"1\"></path><path fill=\"none\" d=\"M 10 178.5 L 790 178.5\" stroke=\"#C0C0C0\" stroke-width=\"1\"  opacity=\"1\"></path><path fill=\"none\" d=\"M 10 109.5 L 790 109.5\" stroke=\"#C0C0C0\" stroke-width=\"1\"  opacity=\"1\"></path><path fill=\"none\" d=\"M 10 40.5 L 790 40.5\" stroke=\"#C0C0C0\" stroke-width=\"1\"  opacity=\"1\"></path><path fill=\"none\" d=\"M 10 384.5 L 790 384.5\" stroke=\"#C0C0C0\" stroke-width=\"1\"  opacity=\"1\"></path></g><g class=\"highcharts-axis\" ><path fill=\"none\" d=\"M 119.5 385 L 119.5 386\" stroke=\"#C0D0E0\" stroke-width=\"1\" opacity=\"1\"></path><path fill=\"none\" d=\"M 194.5 385 L 194.5 386\" stroke=\"#C0D0E0\" stroke-width=\"1\" opacity=\"1\"></path><path fill=\"none\" d=\"M 268.5 385 L 268.5 386\" stroke=\"#C0D0E0\" stroke-width=\"1\" opacity=\"1\"></path><path fill=\"none\" d=\"M 343.5 385 L 343.5 386\" stroke=\"#C0D0E0\" stroke-width=\"1\" opacity=\"1\"></path><path fill=\"none\" d=\"M 418.5 385 L 418.5 386\" stroke=\"#C0D0E0\" stroke-width=\"1\" opacity=\"1\"></path><path fill=\"none\" d=\"M 492.5 385 L 492.5 386\" stroke=\"#C0D0E0\" stroke-width=\"1\" opacity=\"1\"></path><path fill=\"none\" d=\"M 567.5 385 L 567.5 386\" stroke=\"#C0D0E0\" stroke-width=\"1\" opacity=\"1\"></path><path fill=\"none\" d=\"M 642.5 385 L 642.5 386\" stroke=\"#C0D0E0\" stroke-width=\"1\" opacity=\"1\"></path><path fill=\"none\" d=\"M 716.5 385 L 716.5 386\" stroke=\"#C0D0E0\" stroke-width=\"1\" opacity=\"1\"></path><path fill=\"none\" d=\"M 44.5 385 L 44.5 386\" stroke=\"#C0D0E0\" stroke-width=\"1\" opacity=\"1\"></path><path fill=\"none\" d=\"M 10 384.5 L 790 384.5\" stroke=\"#C0D0E0\" stroke-width=\"1\"  visibility=\"visible\"></path></g><g class=\"highcharts-axis\" ></g><g class=\"highcharts-series-group\" ><g class=\"highcharts-series\" visibility=\"visible\"  transform=\"translate(10,40) scale(1 1)\" clip-path=\"url(#highcharts-18)\"><path fill=\"none\" d=\"M 35.45454545454545 303.6 L 72.77511961722489 220.8 L 110.09569377990431 41.4 L 147.41626794258374 331.2 L 184.73684210526315 276 L 222.05741626794259 303.6 L 259.377990430622 262.2 L 296.69856459330146 317.4 L 334.01913875598086 289.8 L 371.3397129186603 303.6 L 408.66028708133973 289.8 L 445.98086124401914 303.6 L 483.3014354066986 276 L 520.622009569378 303.6 L 557.9425837320574 289.8 L 595.2631578947369 303.6 L 669.9043062200957 234.6 L 707.2248803827752 331.2 L 744.5454545454546 234.6\" stroke=\"#2f7ed8\" stroke-width=\"2\" ></path></g><g class=\"highcharts-markers\" visibility=\"visible\"  transform=\"translate(10,40) scale(1 1)\" clip-path=\"none\"><path fill=\"#2f7ed8\" d=\"M 744.5454545454546 230.6 C 749.8734545454546 230.6 749.8734545454546 238.6 744.5454545454546 238.6 C 739.2174545454546 238.6 739.2174545454546 230.6 744.5454545454546 230.6 Z\"></path><path fill=\"#2f7ed8\" d=\"M 707.2248803827752 327.2 C 712.5528803827751 327.2 712.5528803827751 335.2 707.2248803827752 335.2 C 701.8968803827752 335.2 701.8968803827752 327.2 707.2248803827752 327.2 Z\"></path><path fill=\"#2f7ed8\" d=\"M 669.9043062200957 230.6 C 675.2323062200957 230.6 675.2323062200957 238.6 669.9043062200957 238.6 C 664.5763062200957 238.6 664.5763062200957 230.6 669.9043062200957 230.6 Z\"></path><path fill=\"#2f7ed8\" d=\"M 595.2631578947369 299.6 C 600.5911578947369 299.6 600.5911578947369 307.6 595.2631578947369 307.6 C 589.9351578947369 307.6 589.9351578947369 299.6 595.2631578947369 299.6 Z\"></path><path fill=\"#2f7ed8\" d=\"M 557.9425837320574 285.8 C 563.2705837320574 285.8 563.2705837320574 293.8 557.9425837320574 293.8 C 552.6145837320574 293.8 552.6145837320574 285.8 557.9425837320574 285.8 Z\"></path><path fill=\"#2f7ed8\" d=\"M 520.622009569378 299.6 C 525.9500095693779 299.6 525.9500095693779 307.6 520.622009569378 307.6 C 515.294009569378 307.6 515.294009569378 299.6 520.622009569378 299.6 Z\"></path><path fill=\"#2f7ed8\" d=\"M 483.3014354066986 272 C 488.6294354066986 272 488.6294354066986 280 483.3014354066986 280 C 477.9734354066986 280 477.9734354066986 272 483.3014354066986 272 Z\"></path><path fill=\"#2f7ed8\" d=\"M 445.98086124401914 299.6 C 451.3088612440191 299.6 451.3088612440191 307.6 445.98086124401914 307.6 C 440.65286124401916 307.6 440.65286124401916 299.6 445.98086124401914 299.6 Z\"></path><path fill=\"#2f7ed8\" d=\"M 408.66028708133973 285.8 C 413.9882870813397 285.8 413.9882870813397 293.8 408.66028708133973 293.8 C 403.33228708133976 293.8 403.33228708133976 285.8 408.66028708133973 285.8 Z\"></path><path fill=\"#2f7ed8\" d=\"M 371.3397129186603 299.6 C 376.6677129186603 299.6 376.6677129186603 307.6 371.3397129186603 307.6 C 366.01171291866035 307.6 366.01171291866035 299.6 371.3397129186603 299.6 Z\"></path><path fill=\"#2f7ed8\" d=\"M 334.01913875598086 285.8 C 339.34713875598084 285.8 339.34713875598084 293.8 334.01913875598086 293.8 C 328.6911387559809 293.8 328.6911387559809 285.8 334.01913875598086 285.8 Z\"></path><path fill=\"#2f7ed8\" d=\"M 296.69856459330146 313.4 C 302.02656459330143 313.4 302.02656459330143 321.4 296.69856459330146 321.4 C 291.3705645933015 321.4 291.3705645933015 313.4 296.69856459330146 313.4 Z\"></path><path fill=\"#2f7ed8\" d=\"M 259.377990430622 258.2 C 264.70599043062197 258.2 264.70599043062197 266.2 259.377990430622 266.2 C 254.049990430622 266.2 254.049990430622 258.2 259.377990430622 258.2 Z\"></path><path fill=\"#2f7ed8\" d=\"M 222.05741626794259 299.6 C 227.3854162679426 299.6 227.3854162679426 307.6 222.05741626794259 307.6 C 216.72941626794258 307.6 216.72941626794258 299.6 222.05741626794259 299.6 Z\"></path><path fill=\"#2f7ed8\" d=\"M 184.73684210526315 272 C 190.06484210526315 272 190.06484210526315 280 184.73684210526315 280 C 179.40884210526315 280 179.40884210526315 272 184.73684210526315 272 Z\"></path><path fill=\"#2f7ed8\" d=\"M 147.41626794258374 327.2 C 152.74426794258375 327.2 152.74426794258375 335.2 147.41626794258374 335.2 C 142.08826794258374 335.2 142.08826794258374 327.2 147.41626794258374 327.2 Z\"></path><path fill=\"#2f7ed8\" d=\"M 110.09569377990431 37.4 C 115.42369377990431 37.4 115.42369377990431 45.4 110.09569377990431 45.4 C 104.7676937799043 45.4 104.7676937799043 37.4 110.09569377990431 37.4 Z\"></path><path fill=\"#2f7ed8\" d=\"M 72.77511961722489 216.8 C 78.10311961722489 216.8 78.10311961722489 224.8 72.77511961722489 224.8 C 67.44711961722489 224.8 67.44711961722489 216.8 72.77511961722489 216.8 Z\"></path><path fill=\"#2f7ed8\" d=\"M 35.45454545454545 299.6 C 40.782545454545456 299.6 40.782545454545456 307.6 35.45454545454545 307.6 C 30.126545454545454 307.6 30.126545454545454 299.6 35.45454545454545 299.6 Z\"></path><path fill=\"none\" d=\"M 25.454545454545453 303.6 L 35.45454545454545 303.6 L 72.77511961722489 220.8 L 110.09569377990431 41.4 L 147.41626794258374 331.2 L 184.73684210526315 276 L 222.05741626794259 303.6 L 259.377990430622 262.2 L 296.69856459330146 317.4 L 334.01913875598086 289.8 L 371.3397129186603 303.6 L 408.66028708133973 289.8 L 445.98086124401914 303.6 L 483.3014354066986 276 L 520.622009569378 303.6 L 557.9425837320574 289.8 L 595.2631578947369 303.6 L 669.9043062200957 234.6 L 707.2248803827752 331.2 L 744.5454545454546 234.6 L 754.5454545454546 234.6\" class=\"highcharts-tracker highcharts-tracker\" stroke-linejoin=\"round\" visibility=\"visible\" stroke-opacity=\"0.0001\" stroke=\"rgb(192,192,192)\" stroke-width=\"22\"  style=\"\"></path></g></g><text x=\"400\" y=\"25\" style=\"font-family:'lucida grande', 'lucida sans unicode', verdana, arial, helvetica, sans-serif;font-size:10px;color:#274b6d;fill:#274b6d;\" text-anchor=\"middle\" class=\"highcharts-title\" ><tspan x=\"400\">Competitor Trend</tspan></text><g class=\"highcharts-legend\"  transform=\"translate(296,30)\"><rect rx=\"5\" ry=\"5\" fill=\"none\" x=\"0.5\" y=\"0.5\" width=\"208\" height=\"26\" stroke=\"#909090\" stroke-width=\"1\" visibility=\"visible\"></rect><g  clip-path=\"url(#highcharts-17)\"><g><g class=\"highcharts-legend-item\"  transform=\"translate(8,3)\"><path fill=\"none\" d=\"M 0 11 L 16 11\" stroke=\"#2f7ed8\" stroke-width=\"2\"></path><path fill=\"#2f7ed8\" d=\"M 8 7 C 13.328 7 13.328 15 8 15 C 2.6719999999999997 15 2.6719999999999997 7 8 7 Z\"></path><text x=\"21\" y=\"15\" style=\"font-family:'lucida grande', 'lucida sans unicode', verdana, arial, helvetica, sans-serif;font-size:12px;cursor:pointer;color:#274b6d;fill:#274b6d;\" text-anchor=\"start\" ><tspan x=\"21\">European Commission (2261)</tspan></text></g></g></g></g><g class=\"highcharts-axis-labels\" ></g><g class=\"highcharts-axis-labels\" ></g><g class=\"highcharts-tooltip\"  style=\"cursor:default;padding:0;white-space:nowrap;\" visibility=\"hidden\"><rect rx=\"3\" ry=\"3\" fill=\"none\" x=\"0.5\" y=\"0.5\" width=\"16\" height=\"16\" fill-opacity=\"0.85\"  stroke=\"black\" stroke-opacity=\"0.049999999999999996\" stroke-width=\"5\" transform=\"translate(1, 1)\"></rect><rect rx=\"3\" ry=\"3\" fill=\"none\" x=\"0.5\" y=\"0.5\" width=\"16\" height=\"16\" fill-opacity=\"0.85\"  stroke=\"black\" stroke-opacity=\"0.09999999999999999\" stroke-width=\"3\" transform=\"translate(1, 1)\"></rect><rect rx=\"3\" ry=\"3\" fill=\"none\" x=\"0.5\" y=\"0.5\" width=\"16\" height=\"16\" fill-opacity=\"0.85\"  stroke=\"black\" stroke-opacity=\"0.15\" stroke-width=\"1\" transform=\"translate(1, 1)\"></rect><rect rx=\"3\" ry=\"3\" fill=\"rgb(255,255,255)\" x=\"0.5\" y=\"0.5\" width=\"16\" height=\"16\" fill-opacity=\"0.85\"></rect><text x=\"8\" y=\"21\" style=\"font-family:'lucida grande', 'lucida sans unicode', verdana, arial, helvetica, sans-serif;font-size:12px;color:#333333;fill:#333333;\" ></text></g></svg>"}"

the controller:
[HttpGet]
        public ActionResult GetChartImage(string svgString)
        {
            byte[] imageBytes;

            byte[] bytes = new byte[svgString.Length * sizeof(char)];
            System.Buffer.BlockCopy(svgString.ToCharArray(), 0, bytes, 0, bytes.Length);

            //var byteArray = Encoding.ASCII.GetBytes(svg);
            using (var stream = new MemoryStream(bytes))
            {
                var svgDocument = SvgDocument.Open(stream);
                var bitmap = svgDocument.Draw();
                bitmap.Save(stream, ImageFormat.Png);
                imageBytes = stream.ToArray();
            }

            return new FileContentResult(imageBytes, "image/png");
        }

A: try using POST instead of GET, also change the controller attribute to HTTPPOST

A: try:
data: {svgString: svg}

in your ajax settings
I would also use default contentType to preserve url encoding of your svg string.
'application/x-www-form-urlencoded; charset=UTF-8'


text:
Q: Cant see MacBook in Windows Network I'm trying to access my MacBook from a Windows PC over the network. The computer is connected to the router, the MacBook is connected to a WAP, which is connected to a switch, which is connected to the router.
When I click on Network on the PC, the MacBook doesn't show up. It has done previously. Sometimes the Windows computer shows in the Finder sidebar and sometimes it doesn't.
How can I make the MacBook show in Network [Places] on the Windows machine? And how do I make the Windows machine stay in the Finder sidebar?

A: In my experience there is no quickfix way to get windows and mac machines to always be visible in the others networks list.
The best thing you can do is enable Samba filesharing on your mac, then when you want to connect you just type smb://Jonathan's MacBook Pro into the address bar in Explorer (or into the run dialogue).
To Enable SMB sharing on your Mac:

*

*Go to System Preferences > Sharing > File Sharing

*Select Options

*Tick Share files and folders using SMB (Windows)
This has always worked for me with networking windows machines in Mac environments.

A: Another issue is you might not be in the same workgroup. To fix this go to
System Preferences -> Network -> Advanced -> WINS:
Make sure his Windows box is set the same. What OrangeBox suggested must be done as well.

A: I was able to resolve the issue by copying the name given in the NetBIOS Name field in the answer given by rubixibuc and pasting it into a run dialog, typing \\ and then the NetBIOS Name (so in rubixibuc's example the full path would be \\MACBOOKPRO-D04A)
To open the Run dialog, simply type +R

A: Try changing the workgroup name from the iMac and windows PC. I have same problem and after I change the workgroup name it work. Try to ping your iMac check if the connectivity is good. Start - run - cmd - ping and the IP address of your Mac.


text:
Q: Prompt for confirmation for every command I'm writing a pretty ad-hoc install script for some thing. No much control constructs, basically just a list of commands. I'd like the user to confirm each command before it gets executed. Is there a way to let bash do that, without prefixing every command with a shell function name?

A: You could use extdebug:
shopt -s extdebug
trap '
  read -n1 -p "run \"$BASH_COMMAND\"? " answer <> /dev/tty 1>&0
  echo > /dev/tty
  [[ $answer = [yY] ]]' DEBUG

cmd1
cmd2
...

For reference, the zsh equivalent would be:
TRAPDEBUG() {
  read -q "?run \"$ZSH_DEBUG_CMD\"? " || setopt errexit
  echo > /dev/tty
}
cmd1
cmd2
...

More portably:
run() {
  printf %s "run $*? " > /dev/tty
  read answer < /dev/tty
  case $answer in
    [yY]*) "$@";;
  esac
}
run cmd1
run cmd2
run cmd3 > file

Beware that in cmd3 > file, the file will be truncated even if you say n. So you may want to write it:
run eval 'cmd3 > file'

Or move the eval to the run function as in:
run() {
  printf %s "run $*? " > /dev/tty
  read answer < /dev/tty
  case $answer in
    [yY]*) eval "$@";;
  esac
}
run cmd1
run 'cmd2 "$var"'
run 'cmd3 > file'

Another portable one, but with even more limitations:
xargs -pL1 env << 'EOF'
cmd1 "some arg"
cmd2 'other arg' arg\ 2
ENV_VAR=value cmd3
EOF

It only works for commands (ones found in $PATH), and arguments can only be strings (no variable or any shell structure, though xargs understand some forms of quoting), and you can't have redirections, pipes...


text:
Q: How to stack these circles on top of each other in D3.js? Using D3.js, I've been trying to create a jar where circles (representing felt emotions) are stacked on top of each other. Unfortunately, they don't get stacked on top of each other, they simply overlap.
Here's my code:
var circle_counter = 0; // Global variable
var level_counter = 0; // Global variable

var circles = d3
.select("svg")
.selectAll("circle")
.data(data)
.enter()
.append("circle")
.attr("cx", function(d) {
  if (circle_counter < 6) {
    d.cx = 62.5 + circle_counter * 45;
    circle_counter++;
    return d.cx;
  } else {
    level_counter++;
    circle_counter = 0;
    d.cx = 62.5 + circle_counter * 45;
    circle_counter++;
    return d.cx;
  }
})
.attr("cy", function(d) {
  if (level_counter == 0) {
    return (d.cy = 320);
  } else {
    return (d.cy = 320 - level_counter * 20);
  }
})
.attr("r", 20)
.attr("fill", function(d) {
  if (d.main_emotion == "anger") {
    return "red";
  } else if (d.main_emotion == "disgust") {
    return "green";
  } else if (d.main_emotion == "fear") {
    return "black";
  } else if (d.main_emotion == "happiness") {
    return "yellow";
  } else if (d.main_emotion == "sadness") {
    return "blue";
  } else {
    return "orange";
  }
})
.attr("fill-opacity", 0.5)
.attr("stroke", "white")
.attr("stroke-width", 3);

Here's what I'm getting:
Circles overlapping instead of laying on top of each other

And here's what I'm trying to achieve:
Circles laying on top of each other

How do I go about achieving this?
Thanks in advance.
EDIT: I forgot to mention that I feel like the 'circles_counter' and/or the 'level_counter' variables are getting mixed-up somehow, but after numerous attempts at solving this problem, I don't have a clue as to what's wrong with my logic.

A: I am not sure if this is the right way to do it but I could achieve it. Before you use this code please go through the resources provided by D3 and check if there are any better ways.

var data = [
            {main_emotion: 'sadness'},
            {main_emotion: 'happiness'},
            {main_emotion: 'fear'},
            {main_emotion: 'anger'},
            {main_emotion: 'disgust'},
        ]
        var dataSet = [];
        for(let i = 0, len = data.length; i < len; i += 1) {
            for( let j = 0, len1 = data.length; j < len1; j += 1) {
                let newDataSet = {};
                const cx = 60 + (j * 45);
                const cy = 320 - (i * 45);
                newDataSet = {
                    ...data[j],
                    cx: cx,
                    cy: cy,
                }
                dataSet.push(newDataSet);
            }
        }
        var circles = d3
        .select("svg")
        .selectAll("circle")
        .data(dataSet)
        .enter()
        .append("circle")
        .attr("cx", function(d) {
            return d.cx;
        })
        .attr("cy", function(d) {
            return d.cy;
        })
        .attr("r", 20)
        .attr("fill", function(d) {
        if (d.main_emotion == "anger") {
            return "red";
        } else if (d.main_emotion == "disgust") {
            return "green";
        } else if (d.main_emotion == "fear") {
            return "black";
        } else if (d.main_emotion == "happiness") {
            return "yellow";
        } else if (d.main_emotion == "sadness") {
            return "blue";
        } else {
            return "orange";
        }
        })
        .attr("fill-opacity", 0.5)
        .attr("stroke", "white")
        .attr("stroke-width", 3)
    </script>
<script src="https://d3js.org/d3.v5.min.js"></script>
<style>
    body {
        background: #999;
    }
</style>
<svg width=400 height=400></svg>


text:
Q: Could not find org.springframework.boot:spring-boot-starter-velocity I'm new to spring and trying to use velocity with spring boot.
Here is my build.gradle
repositories {
    mavenCentral()
}

plugins {
   id 'org.springframework.boot' version '2.0.4.RELEASE'
}

apply plugin: 'java'
apply plugin: 'eclipse-wtp'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'war'

dependencies {
    compile('org.springframework.boot:spring-boot-starter-web')
    compile('org.springframework.boot:spring-boot-starter-velocity')
    runtime('org.springframework.boot:spring-boot-devtools')
    providedRuntime('org.springframework.boot:spring-boot-starter-tomcat')
    testCompile('org.springframework.boot:spring-boot-starter-test')
}

When I sync by ./gradlew bootRun, it returned error as below.
> Task :compileJava FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all files for configuration ':compileClasspath'.
> Could not find org.springframework.boot:spring-boot-starter-velocity:.

A: Spring Boot 2.0 depends on Spring Framework 5.0. Which dropped support for Velocity. Hence in Spring Boot 2 there is no more support for Velocity.
If you really need Velocity you would have to stick with Spring Boot 1.5. If you can move to something like Freemarker or Mustache you are probably better of using that.

A: Most probably you forgot to include Spring's dependency management plugin.
apply plugin: 'io.spring.dependency-management'
Also make sure that you have specified the Spring Boot version to use:

plugins {
    id 'org.springframework.boot' version '2.0.4.RELEASE'
}

See https://docs.spring.io/spring-boot/docs/2.0.4.RELEASE/gradle-plugin/reference/html/ for more information


text:
Q: A problem on linear operator: what does the bounded operator mean? I'm puzzled in the bounded operator concept. Now I want to ask a simple problem about that.
If $I$ is an indexing set, $\{T_\alpha|\alpha\in I\}$ is a linear bounded operator collection from $X$ to $X_1$, where $X, X_1$ are normed spaces. Based on the above fact, I list some conclusions:

*

*For $\forall T_\alpha,$ there exists a constant $M_\alpha\ge0$, such that $\forall x\in X$,
$$\|T_\alpha x\|\le M_\alpha\|x\|$$ holds.

*For $\forall T_\alpha$, I have $$ \sup_{\alpha}\|T_\alpha x\|\lt \infty. $$
I want to know whether the above two conclusions are right. where is the mistake? Could someone tell?


text:
Q: Reinstall vs Update IPA Files What are the significant difference between reinstalling and updating IPA files?
Does it only matters between retaining user preferences?

A: The only thing that survives a reinstall (I assume you mean deleting and then installing) is the app's keychain values. So all data and preferences are gone. When you delete an app, the app's sandbox is wiped.
With an update, nothing is lost except (possibly) temporary and cache. No data or preferences are lost with an update. The new app is installed and the old version's sandbox is copied to the new app.


text:
Q: Adding dictionaries to Plist programmatically I am trying to add a dictionary to a plist programmatically in the following format:
Root(Dict)
|
StringOfViewID(Dict)
|
ButtonTitle(Dict)
|
String
String
I can successfully do this but I want to keep adding to the ViewID(Dict) more ButtonTitle(Dict) under the same ViewID(Dict).
So far I can only replace the existing.
Something like this:
Root(Dict)
|
StringOfViewID(Dict) - ButtonTitle(Dict)(2)-String String
|
ButtonTitle(Dict)(1)
|
String
String
Here is the code I'm using:
//Initialize and load the plist file here:
[...]
            NSMutableDictionary *data;
            NSMutableDictionary *viewID;
            NSMutableDictionary *buttonName;
            NSArray *keys;
            NSArray *locations;

        // Insert the data into the plist

        NSNumber *xNumber = [[NSNumber alloc] initWithDouble:locationX];
        NSNumber *yNumber = [[NSNumber alloc] initWithDouble:locationY];

        keys = [NSArray arrayWithObjects:@"locationX", @"locationY", nil];
        locations = [NSArray arrayWithObjects:xNumber, yNumber, nil];
        data = [NSMutableDictionary dictionaryWithObjects:locations forKeys:keys];
        buttonName = [NSMutableDictionary dictionaryWithObject:data forKey:myButtonTitle];
        viewID = [NSMutableDictionary dictionaryWithObject:buttonName forKey:@"StringOfViewID"];

        [viewID writeToFile:path atomically:YES];

Thanks

A: Simply load the file first into NSMutableDictionary , make the changes you want to it, then write it back to the file using the same code you use already.
Edit: Regarding the structure you use for editing the list , you can either have an array of button dictionaries
   NSMutableDictionary* oldDictionary=[NSMutableDictionary dictionaryWithContentsOfFile:path];

   // make the new button dictionary
   NSNumber *xNumber = [[NSNumber alloc] initWithDouble:locationX];
   NSNumber *yNumber = [[NSNumber alloc] initWithDouble:locationY];

   NSDictionary*buttonDictionary=@{@"locationX": xNumber,
                                   @"locationY":yNumber,
                                   @"myButtonTitle":myButtonTitle};
   NSMutableArray *buttonsArray = [oldDictionary objectForKey:@"StringOfViewID"];
   //append it to the array
   [buttonsArray addObject:buttonDictionary];
   //replace the old array with the new one
   [oldDictionary setObject:buttonsArray forKey:@"StringOfViewID"];
   //write it back to the file
   [oldDictionary writeToFile:path atomically:YES];

Or a dictionary of buttons dictionaries
    NSMutableDictionary* oldDictionary=[NSMutableDictionary dictionaryWithContentsOfFile:path];

    // make the new button dictionary
    NSNumber *xNumber = [[NSNumber alloc] initWithDouble:locationX];
    NSNumber *yNumber = [[NSNumber alloc] initWithDouble:locationY];

    NSDictionary*buttonLocationDictionary=@{@"locationX": xNumber, @"locationY":yNumber};
    NSMutableDictionary *buttonsDictionary = [oldDictionary objectForKey:@"StringOfViewID"];
    //add it to the dictionary
    [buttonsDictionary  setObject:buttonLocationDictionary forKey:myButtonTitle];//be sure that this is a new button title,or else it will replace the old value with this title.

    //replace the old dictionary with the new one
    [oldDictionary setObject:buttonsDictionary forKey:@"StringOfViewID"];
    //write it back to the file
    [oldDictionary writeToFile:path atomically:YES];

I tried to not change the structure or the keys you are using, and I assumed that StringOfViewID is the key that all the buttons in the current view of interest will have, and other views will have other keys.

A: I would create a class to serve as a data model.  This is a simple implementation - it would probably be cleaner to create a Button object rather than pass multiple parameters and retrieve a dictionary
ViewButtons.h
@interface ViewButtons : NSObject

+(ViewButtons *) viewButtonsWithContentsOfFile:(NSString *)file;

-(void) addButton:(NSString *)buttonName withX:(double) x andY:(double) y toView:(NSString *)viewName;
-(NSArray *)viewNames;
-(NSArray *)buttonNamesForView:(NSString *)viewName;
-(NSDictionary *)buttonWithName:(NSString *)name inView:(NSString *)viewName;
-(void)writeToFile:(NSString *)file;

@end

ViewButtons.m
#import "ViewButtons.h"

@interface ViewButtons ()

@property (nonatomic,strong) NSMutableDictionary *viewButtons;

@end

@implementation ViewButtons

-(id) init {
    if (self=[super init]) {
        self.viewButtons=[NSMutableDictionary new];
    }
    return self;
}

+(ViewButtons *) viewButtonsWithContentsOfFile:(NSString *)file {
    ViewButtons *newViewButtons=[ViewButtons alloc];
    newViewButtons.viewButtons=[NSMutableDictionary dictionaryWithContentsOfFile:file];
    return newViewButtons;
}

-(void) addButton:(NSString *)buttonName withX:(double) x andY:(double) y toView:(NSString *)viewName {
    NSMutableDictionary *viewDict=self.viewButtons[viewName];
    if (viewDict == nil) {
        viewDict=[NSMutableDictionary new];
        self.viewButtons[viewName]=viewDict;
    } else if (![viewDict isKindOfClass:[NSMutableDictionary class]]) {
        viewDict=[viewDict mutableCopy];
        self.viewButtons[viewName]=viewDict;
    }
    NSNumber *xNumber = [NSNumber numberWithDouble:x];
    NSNumber *yNumber = [NSNumber numberWithDouble:y];
    NSDictionary *buttonDict=@{@"locationX":xNumber,@"locationY":yNumber};
    viewDict[buttonName]=buttonDict;
}

-(NSArray *)viewNames {
    return self.viewButtons.allKeys;
}

-(NSArray *)buttonNamesForView:(NSString *)viewName {
    return [self.viewButtons[viewName] allKeys];
}
-(NSDictionary *)buttonWithName:(NSString *)name inView:(NSString *)viewName {
    return self.viewButtons[viewName][name];
}

-(void)writeToFile:(NSString *)file {
    [self.viewButtons writeToFile:file atomically:YES];
}

@end

You can use this class as follows -
ViewButtons *viewButtons=[ViewButtons viewButtonsWithContentsOfFile:buttonFile];
if (viewButtons == nil) {
    viewButtons=[ViewButtons new];
}

[viewButtons addButton:@"MyButton1" withX:0 andY:0 toView:@"MyView"];
[viewButtons addButton:@"MyButton2" withX:1 andY:1 toView:@"MyView"];
[viewButtons addButton:@"MyButton3" withX:0 andY:0 toView:@"MySecondView"];
[viewButtons addButton:@"MyButton4" withX:0 andY:1 toView:@"MyThirdView"];
[viewButtons writeToFile:buttonFile];


text:
Q: Drag and drop UIViews with Box2d (iOS) I recently found a nice tutorial for enabling physics with Box2d for iOS.
http://www.cocoanetics.com/2010/05/physics-101-uikit-app-with-box2d-for-gravity/
I'm just wondering how to implement drag and drop for a UIView. Can anyone provide any direction? Thanks for your time.

A: Well, always keep in mind, that everything in Box2D has to be moved by force (well, it's possible to set position directly, but if you want smooth physics movement, this won't do the trick).
So if you want to move some body accordingly to another body (body moved by touch) the joints are the best way to achieve this and guess what, there is joint type called MouseJoint, which is perfect for this situation (also could be used by multitouch).
b2MouseJointDef def;
def.bodyA=/*background_body*/;
def.bodyB=/*body of dragged view*/;
def.frequencyHz=60.0f;
def.dampingRatio=0.0f;
def.maxForce=x * def.bodyB->GetMass(); //i use this for same applied force depending on mass
def.collideConnected=YES;
def.target.Set(loc.x/PTM_RATIO, (self.bounds.size.height - loc.y)/PTM_RATIO);
bwMouseJoint joint=b2World->CreateJoint(def);

and then set position (target) of mouse joint
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{
     CGPoint loc=[[touches anyObject] locationInView:view];
     joint->SetTarget(b2Vec2(loc.x/PTM_RATIO,(view.bounds.size.height-loc.y)/PTM_RATIO));
}

...note, that this snipper contains undefined "variables" like PTM_RATION (if you don't understand them, check the basic tutorials or docs) and view(which is view containing dragged view), so take it as an idea, not copy&paste example:).
You create one joint (for each touch in multitouch app - but you need to track which touch represent thich mousejoint), and move joint's target to it's location. Because it's joint, the forces are applied to the bodyB appropriately (in fact, mouse joint applies large force, so it's almost like instant dragging).
For more info about joints, take a look at f.e. this tutorial: Box2D 2.1a Tutorial – Part 2 (Joints)
I hope my example is understandable, if any additional questions, don't hesitate to ask:).


text:
Q: Integrating interpolated function with singularities I have the following equations and List of values:
a0 = 0.520;
a1 = 0.902;
b0 = 0.520;
m = 0.13957;
rho[s_] = Sqrt[1 - 4 m^2/s];
step = (2)/20;
si = Table[(i) step, {i, 1, 21}]
ai = Table[{si[[i]], {a0 + a1 si[[i]]}}, {i, 1, 21}];
im = Table[0, {i, 1, 21}];

Now I have to interpolate imto any list of values in my region of interpolation, that is, si.
imi = Interpolation[Table[{si[[i]], im[[i]]}, {i, 1, 21}]];

And now I have to perform the following integral:
Rea =
Table[ai[[i, 2]], {i, 1, 21}] + (1/Pi) Table[
 si[[i]] NIntegrate[imi[sp]/(sp (sp - si[[i]])), {sp, 4 m^2, 2},
   Method -> PrincipalValue, Exclusions -> Thread[si == sp],
   AccuracyGoal -> 8], {i, 1, 21}];

Surprisingly, it says that:

NIntegrate::pvrng: Singular points must be specified in the integration range in order to use PrincipalValue

I don't understand this because I'm already specifying the Exclusions with Thread. Does someone know why does it say so?

A: The error message means you have to put the singularities si in the "integration range," {sp, 4m^2, 2}, which you can do like this:
Rea = Table[
    ai[[i, 2]], {i, 1, 21}] + (1/Pi) Table[
     si[[i]] NIntegrate[imi[sp]/(sp (sp - si[[i]])),
       Evaluate@Flatten@{sp, 4 m^2, si, 2},           (* insert  si  here *)
       Method -> PrincipalValue, AccuracyGoal -> 8], {i, 1, 21}];

Rea
(*
  {{0.6102}, {0.7004}, {0.7906}, {0.8808}, {0.971},  {1.0612}, {1.1514},
   {1.2416}, {1.3318}, {1.422},  {1.5122}, {1.6024}, {1.6926}, {1.7828},
   {1.873},  {1.9632}, {2.0534}, {2.1436}, {2.2338}, {2.324},  {2.4142}}
*)


text:
Q: My script Deallocated vm from powershell started throwing an error from Jule, How to reWrite? I use PowerShell Script to the start azure automation which deallocated vm on name:
$clientID = "..."
$key = "..."

$SecurePassword = $key | ConvertTo-SecureString -AsPlainText -Force
$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $clientID, $SecurePassword

Add-AzureRmAccount -Credential $cred -Tenant "..." -ServicePrincipal

$params = @{"RESOURCEGROUPNAME" = "..."; "VMNAME" = $env:computername}
    Start-AzureRmAutomationRunbook -ResourceGroupName "..." -AutomationAccountName "..." -Name "StopAzureV2Vm" -Parameters $params

but from Jule/22 command Add-AzureRmAccount ... started throw error:
Add-AzureRmAccount : AADSTS1002016: You are using TLS version 1.0, 1.1 and/or 3DES cipher which are deprecated to improve the
security posture of Azure AD. Your TenantID is: 7441e116-ef50-4bf6-a98f-1fa0671ccfb5. Please refer to https://go.microsoft.com/fwlink/?linkid=2161187 and conduct needed actions to remediate the issue. For further questions, please
contact your administrator.
please help rewrite my code for new Requirements?

A: You can follow the below ways to fix the issue:

*

*Add-AzureRmAccount commands are deprecated. Try to use Add-AzureAccount to avoid this error.

*Disable the TLS 1.0 & TLS 1.1 Protocols. Enable the Protocol**TLS 1.2** in client so that we can avoid this issue.

*You can include below script to fix your issue

[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12;

Refer the MSDOC to solve the TLS 1.0 issues