问:
How to move photo to the left in Flutter Stack Widget?
I've been trying things out for a while and finally got my Stack aligned and positioned the way I want.  Now I'm having trouble with the positioning; not sure if its due to some misplaced alignment parameters.  The stack should have the photo appropriately placed on the left without going over the elevated  button.

```<code>Center(
                        child: Row(
                          mainAxisAlignment: MainAxisAlignment.center,
                          crossAxisAlignment: CrossAxisAlignment.center,
                          children: [
                            Stack(
                              alignment: Alignment.center,
                              children: [
                                ElevatedButton(
                                style: ButtonStyle(
                                backgroundColor: MaterialStateProperty.all(Colors.amberAccent),),
                                        onPressed: () {
                                          Navigator.of(context).pushNamed("/widget");
                                          WebView.player = adAddresses.isEmpty == true
                                              ? 'https://myfavkpop-shop.myshopify.com/'
                                              : adAddresses[adIndex].toString();
                                          WebView.webviewTitle = 'MyFavKPop Shopping';
                                        },
                                        child: Column(
                                          children: [
                                            Padding(padding:  EdgeInsets.all(3.0)),
                                            Row(
                                              mainAxisAlignment: MainAxisAlignment.center,
                                              mainAxisSize: MainAxisSize.min,
                                              children: <Widget>[
                                                SizedBox(width: 70,),
                                                new Flexible(
                                                  fit: FlexFit.loose,
                                                  child: new Text(
                                                    adTitles.isEmpty == true
                                                        ? 'MyFavKPop Shop'
                                                        : adTitles[adIndex],
                                                    softWrap: true,
                                                    maxLines: 3,
                                                    textScaleFactor: 0.8,
                                                    style: TextStyle(
                                                        color: Colors.black,
                                                        fontSize: 35.00,
                                                        fontFamily: 'Chewy'),
                                                    textAlign: TextAlign.center,
                                                  ),
                                                ),
                                                Padding(padding:  EdgeInsets.all(5.0)),
                                                Image.asset('assets/ad.jpg',
                                                scale: 35,)
                                              ],
                                            ),
                                            Padding(padding:  EdgeInsets.all(3.0)),
                                          ],
                                        )
                                      ),
                                Positioned(
                                  //top: 20,
                                  //left: 80,
                                  child: CircleAvatar(
                                      radius: 50.0,
                                      backgroundImage: new NetworkImage(adImages
                                                  .isEmpty ==
                                              true
                                          ? 'https://cdn.shopify.com'
                                          : adImages[adIndex])),
                                )
                              ],
                            )
                          ],
                        ),
                      ),
</code>```

答:
So what i think you should no use the elevated button as it is not customisable, you can rather use the gesture detector with child as a container where you can decorate it as per your needs. and then you can add a row for container so that you can have a image first and then the text.
I have just added rough sketch you can customise it as per your needs.

As i am still confused that you want the image inside the button or to the left of the button.

Check out the example that i have created :

```<code>import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key, required this.title}) : super(key: key);

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Column(
        children: [
          Row(
            children: [
              CircleAvatar(
                radius: 50.0,
                backgroundImage: NetworkImage('https://cdn.shopify.com'),
              ),
              // here you can have your elevated button.
              GestureDetector(
                onTap: () {
                  /// Do your on press evernts over here.
                },
                child: Container(
                  decoration: BoxDecoration(
                    color: Colors.amberAccent,
                  ),
                  padding: EdgeInsets.all(5.0),
                  child: Flexible(
                    fit: FlexFit.loose,
                    child: new Text(
                      'MyFavKPop Shop',
                      softWrap: true,
                      maxLines: 3,
                      textScaleFactor: 0.8,
                      style: TextStyle(
                          color: Colors.black,
                          fontSize: 35.00,
                          fontFamily: 'Chewy'),
                      textAlign: TextAlign.center,
                    ),
                  ),
                ),
              ),
            ],
          ),
        ],
      ),
    );
  }
}

</code>```

Body:
I've been trying things out for a while and finally got my Stack aligned and positioned the way I want.  Now I'm having trouble with the positioning; not sure if its due to some misplaced alignment parameters.  The stack should have the photo appropriately placed on the left without going over the elevated  button.

Center(
                        child: Row(
                          mainAxisAlignment: MainAxisAlignment.center,
                          crossAxisAlignment: CrossAxisAlignment.center,
                          children: [
                            Stack(
                              alignment: Alignment.center,
                              children: [
                                ElevatedButton(
                                style: ButtonStyle(
                                backgroundColor: MaterialStateProperty.all(Colors.amberAccent),),
                                        onPressed: () {
                                          Navigator.of(context).pushNamed("/widget");
                                          WebView.player = adAddresses.isEmpty == true
                                              ? 'https://myfavkpop-shop.myshopify.com/'
                                              : adAddresses[adIndex].toString();
                                          WebView.webviewTitle = 'MyFavKPop Shopping';
                                        },
                                        child: Column(
                                          children: [
                                            Padding(padding:  EdgeInsets.all(3.0)),
                                            Row(
                                              mainAxisAlignment: MainAxisAlignment.center,
                                              mainAxisSize: MainAxisSize.min,
                                              children: <Widget>[
                                                SizedBox(width: 70,),
                                                new Flexible(
                                                  fit: FlexFit.loose,
                                                  child: new Text(
                                                    adTitles.isEmpty == true
                                                        ? 'MyFavKPop Shop'
                                                        : adTitles[adIndex],
                                                    softWrap: true,
                                                    maxLines: 3,
                                                    textScaleFactor: 0.8,
                                                    style: TextStyle(
                                                        color: Colors.black,
                                                        fontSize: 35.00,
                                                        fontFamily: 'Chewy'),
                                                    textAlign: TextAlign.center,
                                                  ),
                                                ),
                                                Padding(padding:  EdgeInsets.all(5.0)),
                                                Image.asset('assets/ad.jpg',
                                                scale: 35,)
                                              ],
                                            ),
                                            Padding(padding:  EdgeInsets.all(3.0)),
                                          ],
                                        )
                                      ),
                                Positioned(
                                  //top: 20,
                                  //left: 80,
                                  child: CircleAvatar(
                                      radius: 50.0,
                                      backgroundImage: new NetworkImage(adImages
                                                  .isEmpty ==
                                              true
                                          ? 'https://cdn.shopify.com'
                                          : adImages[adIndex])),
                                )
                              ],
                            )
                          ],
                        ),
                      ),

Body:
So what i think you should no use the elevated button as it is not customisable, you can rather use the gesture detector with child as a container where you can decorate it as per your needs. and then you can add a row for container so that you can have a image first and then the text.
I have just added rough sketch you can customise it as per your needs.

As i am still confused that you want the image inside the button or to the left of the button.

Check out the example that i have created :

import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key, required this.title}) : super(key: key);

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Column(
        children: [
          Row(
            children: [
              CircleAvatar(
                radius: 50.0,
                backgroundImage: NetworkImage('https://cdn.shopify.com'),
              ),
              // here you can have your elevated button.
              GestureDetector(
                onTap: () {
                  /// Do your on press evernts over here.
                },
                child: Container(
                  decoration: BoxDecoration(
                    color: Colors.amberAccent,
                  ),
                  padding: EdgeInsets.all(5.0),
                  child: Flexible(
                    fit: FlexFit.loose,
                    child: new Text(
                      'MyFavKPop Shop',
                      softWrap: true,
                      maxLines: 3,
                      textScaleFactor: 0.8,
                      style: TextStyle(
                          color: Colors.black,
                          fontSize: 35.00,
                          fontFamily: 'Chewy'),
                      textAlign: TextAlign.center,
                    ),
                  ),
                ),
              ),
            ],
          ),
        ],
      ),
    );
  }
}


来源: stackexchange

问:
Error commiting response java.io.IOException: Broken pipe at sun.nio.ch.FileDispatcher.write0(Native Method)
I encounter this error after a number of https requests. Anyone have any idea what could be the reason? It seens to be related to SSL. But previously it was working fine. I really don't understand what could have caused this issue

Error commiting responsejava.io.IOException: Broken pipe  at
  sun.nio.ch.FileDispatcher.write0(Native Method)   at
  sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:29)   at
  sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:104)  at
  sun.nio.ch.IOUtil.write(IOUtil.java:75)   at
  sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:302)    at
  com.sun.enterprise.server.ss.ASOutputStream.write(ASOutputStream.java:120)    at
  com.sun.net.ssl.internal.ssl.OutputRecord.writeBuffer(OutputRecord.java:283)  at
  com.sun.net.ssl.internal.ssl.OutputRecord.write(OutputRecord.java:272)    at
  com.sun.net.ssl.internal.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:666)    at
  com.sun.net.ssl.internal.ssl.AppOutputStream.write(AppOutputStream.java:59)   at
  org.apache.coyote.http11.InternalOutputBuffer.commit(InternalOutputBuffer.java:602)   at
  com.sun.enterprise.web.connector.grizzly.ProcessorTask.action(ProcessorTask.java:721) at
  org.apache.coyote.Response.action(Response.java:188)  at
  org.apache.coyote.Response.sendHeaders(Response.java:380) at
  org.apache.coyote.tomcat5.OutputBuffer.doFlush(OutputBuffer.java:357) at
  org.apache.coyote.tomcat5.OutputBuffer.close(OutputBuffer.java:318)   at
  org.apache.coyote.tomcat5.CoyoteResponse.finishResponse(CoyoteResponse.java:528)  at
  org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:192)   at
  com.sun.enterprise.web.connector.grizzly.ProcessorTask.doProcess(ProcessorTask.java:604)  at
  com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:475)    at
  com.sun.enterprise.web.connector.grizzly.ProcessorTask.doTask(ProcessorTask.java:426) at
  com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:281)  at
  com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:83

答:
I don't know about sun.nio.ch.  but...

This is a standard annoying error you get sometimes in Java web apps.  You get this error when requesting a URL and then either hitting stop in your browser or clicking away to another url.  The app is complaining that it wasn't able to send you the complete response.

OwnerDisplayName: Dick Song

ContentLicense: CC BY-SA 3.0

OwnerDisplayName: Marcus Leon

ContentLicense: CC BY-SA 2.5


问:
Animation deprecated iOS 15
I was trying to make the button go easeInOut but not sure how to do it. I was watching a tutorial but it's out of date and I'm a beginner. Can someone show what the code would look like when implemented?

.animation(.easeInOut(duration:0.25))

```<code>import SwiftUI

typealias OnboardingGetStartedAction = () -> Void

struct OnboardingView: View {

    @Environment(\.presentationMode) private var presentationMode

    let item: OnboardingItem

    let limit: Int
    let handler: OnboardingGetStartedAction

    @Binding var index: Int

    internal init(item: OnboardingItem,
                  limit: Int,
                  index: Binding<Int>,
                  handler: @escaping OnboardingGetStartedAction) {
        self.item = item
        self.limit = limit
        self._index = index
        self.handler = handler
    }

    var body: some View {
        VStack {
            Spacer()

            Image(systemName: item.sfSymbol ?? "")
                .padding(.bottom,50)
                .font(.system(size:120, weight: .bold))

            Text(item.title ?? "")
                .font(.system(size: 32, weight: .bold))
                .multilineTextAlignment(.center)
                .padding(.bottom,2)
                .foregroundColor(.primary)

            Text(item.content ?? "")
                .font(.system(size: 12, weight: .semibold))
                .multilineTextAlignment(.center)
                .padding(.horizontal, 50)
                .foregroundColor(.secondary)

            Button(action: {
                presentationMode.wrappedValue.dismiss()
                handler()
            }, label: {
                Text("Get Started")
            })
                .font(.system(size: 18, weight: .bold))
                .foregroundColor(.white)
                .padding(.horizontal,25)
                .padding(.vertical,10)
                .background(Color.red)
                .clipShape(Capsule())
                .padding(.top, 50)
                .opacity(index == limit ? 1 : 0)
                .allowsHitTesting(index == limit)
                .animation(.easeInOut(duration:0.25))
        }
        .padding(.bottom, 150)
    }
}

struct OnboardingView_Previews: PreviewProvider {
    static var previews: some View {
        //dummy data just to see if this works
        OnboardingView(item: OnboardingItem( title: "Dummy Data!", content: "Dummy Data!", sfSymbol: "building.columns.fill"),
                       limit: 0,
                       index: .constant(0)) {}
    }
}
</code>```

答:
.animation(.easeInOut(duration:0.25)) was deprecated in iOS 15.0 because it trigger animation on every small changes for example: on changing button title when user click button will trigger animation, so it would look strange to users, so to handle this case Apple introduce a new parameter named value .animation(.easeInOut(duration:0.25), value: shouldAnimate), that will animate your view only when the value parameter is changed

You can run below code to see how it is working

```<code>import SwiftUI

struct OnboardingView: View {

    @State private var shouldAnimateButton: Bool = false
    @State private var buttonTitle = "Scale Up"

    var body: some View {
        Button(buttonTitle) {
            shouldAnimateButton.toggle()
            buttonTitle = shouldAnimateButton ? "Scale Down" : "Scale Up"
        }
        .padding()
        .foregroundColor(.white)
        .background(.red)
        .scaleEffect(shouldAnimateButton ? 2.0 : 1.0)
        .animation(.easeOut(duration: 0.3), value: shouldAnimateButton)

    }
}

struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        OnboardingView()
    }
}
</code>```

ContentLicense: CC BY-SA 4.0

Title: Animation deprecated iOS 15

Body:
I was trying to make the button go easeInOut but not sure how to do it. I was watching a tutorial but it's out of date and I'm a beginner. Can someone show what the code would look like when implemented?

.animation(.easeInOut(duration:0.25))

import SwiftUI

typealias OnboardingGetStartedAction = () -> Void

struct OnboardingView: View {

    @Environment(\.presentationMode) private var presentationMode

    let item: OnboardingItem

    let limit: Int
    let handler: OnboardingGetStartedAction

    @Binding var index: Int

    internal init(item: OnboardingItem,
                  limit: Int,
                  index: Binding<Int>,
                  handler: @escaping OnboardingGetStartedAction) {
        self.item = item
        self.limit = limit
        self._index = index
        self.handler = handler
    }

    var body: some View {
        VStack {
            Spacer()

            Image(systemName: item.sfSymbol ?? "")
                .padding(.bottom,50)
                .font(.system(size:120, weight: .bold))

            Text(item.title ?? "")
                .font(.system(size: 32, weight: .bold))
                .multilineTextAlignment(.center)
                .padding(.bottom,2)
                .foregroundColor(.primary)

            Text(item.content ?? "")
                .font(.system(size: 12, weight: .semibold))
                .multilineTextAlignment(.center)
                .padding(.horizontal, 50)
                .foregroundColor(.secondary)

            Button(action: {
                presentationMode.wrappedValue.dismiss()
                handler()
            }, label: {
                Text("Get Started")
            })
                .font(.system(size: 18, weight: .bold))
                .foregroundColor(.white)
                .padding(.horizontal,25)
                .padding(.vertical,10)
                .background(Color.red)
                .clipShape(Capsule())
                .padding(.top, 50)
                .opacity(index == limit ? 1 : 0)
                .allowsHitTesting(index == limit)
                .animation(.easeInOut(duration:0.25))
        }
        .padding(.bottom, 150)
    }
}

struct OnboardingView_Previews: PreviewProvider {
    static var previews: some View {
        //dummy data just to see if this works
        OnboardingView(item: OnboardingItem( title: "Dummy Data!", content: "Dummy Data!", sfSymbol: "building.columns.fill"),
                       limit: 0,
                       index: .constant(0)) {}
    }
}

Body:
.animation(.easeInOut(duration:0.25)) was deprecated in iOS 15.0 because it trigger animation on every small changes for example: on changing button title when user click button will trigger animation, so it would look strange to users, so to handle this case Apple introduce a new parameter named value .animation(.easeInOut(duration:0.25), value: shouldAnimate), that will animate your view only when the value parameter is changed

You can run below code to see how it is working

import SwiftUI

struct OnboardingView: View {

    @State private var shouldAnimateButton: Bool = false
    @State private var buttonTitle = "Scale Up"

    var body: some View {
        Button(buttonTitle) {
            shouldAnimateButton.toggle()
            buttonTitle = shouldAnimateButton ? "Scale Down" : "Scale Up"
        }
        .padding()
        .foregroundColor(.white)
        .background(.red)
        .scaleEffect(shouldAnimateButton ? 2.0 : 1.0)
        .animation(.easeOut(duration: 0.3), value: shouldAnimateButton)

    }
}

struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        OnboardingView()
    }
}


答:
You wrote: alignment: Alignment.center, for the Stack. So any non-positioned children would align to the center.

You can change the Stack alignment property to: alignment: Alignment.centerLeft.

Alternatively, you can change the parent Positioned widget, of your CircleAvatar, to say something like left: 20.

Title: How to move photo to the left in Flutter Stack Widget?


问:
Can Multiple Child Component gets a global input param in Angular?
I have a component  with input param as name

```<code> <lib-name [name]="name" > </lib-name>
</code>```

These are called at multiple places in the project.

Now name is a app-constants which is assigned in app-component.

Currently i have to import name in every component ts file to pass it to library component.

Can we globally define this name for the child-component. So that my code will be clean

```<code><lib-name > </lib-name>
</code>```

Note:- Name can change on the basis of signed in user
Also it is a library component, i cannot just directly get the name in the library component.

答:
```<code>@Directive({
    selector: '[appTest]'
})
export class TestDirective {
    constructor(private lib: LibComponent) {
        this.lib.name = "Some Name";
    }
}
</code>```

And use this directive

```<code><lib-name appTest> </lib-name>
</code>```

Body:
I have a component  with input param as name

 <lib-name [name]="name" > </lib-name>

These are called at multiple places in the project.

Now name is a app-constants which is assigned in app-component.

Currently i have to import name in every component ts file to pass it to library component.

Can we globally define this name for the child-component. So that my code will be clean

<lib-name > </lib-name>

Note:- Name can change on the basis of signed in user
Also it is a library component, i cannot just directly get the name in the library component.

Body:
@Directive({
    selector: '[appTest]'
})
export class TestDirective {
    constructor(private lib: LibComponent) {
        this.lib.name = "Some Name";
    }
}

And use this directive

<lib-name appTest> </lib-name>


问:
How do I stop my nodejs server for test purposes?
my nodejs module starts a server on a specific port, I am wondering if it is a way to stop the execution of that server in my mocha test:

Let's assume that myserver.js contains something like:

```<code>myserver = http.Server(app);
....
process.on('SIGTERM', ()=>{ ... });
</code>```

and in my mocha test, If I do something like this: in order to load my class:

```<code>   it(' starts the execution and then stop the server() {
     require('../myserver.js');

     ????
    }
</code>```

How can I stop the execution from test case?

I was wondering if I could send a SIGTERM message to that process, but I should discover the pid of that process first, maybe it is not worth to do that.

I assume that I could export from my module a function that is then used from other modules in some specific circumstances, like the one I want to test, in order to stop the overall execution.

答:
In case you need to send the command a SIGTERM signal, you need to handle that with the process signal handler:

Note: process does not require a “require”, it’s automatically available.

const express = require('express')

const app = express()

app.get('/', (req, res) => {
  res.send('Hi!')
});

const server = app.listen(3000, () => console.log('Server ready'));

process.on('SIGTERM', () => {
  server.close(() => {
    console.log('Process terminated');
  });
});
```
<blockquote>
<p>What are signals? Signals are a POSIX intercommunication system: a notification sent to a process in order to notify it of an event that occurred.</p>
</blockquote>
<p><code>SIGKILL</code> is the signals that tells a process to immediately terminate, and would ideally act like <code>process.exit()</code>.</p>
<p><code>SIGTERM</code> is the signals that tells a process to gracefully terminate. It is the signal that’s sent from process managers like <code>upstart</code> or <code>supervisord</code> and many others.</p>
<p>You can send this signal from inside the program, in another function:</p>
<pre class="lang-js prettyprint-override"><code>process.kill(process.pid, 'SIGTERM')
</code>```

Or from another Node.js running program, or any other app running in your system that knows the PID of the process you want to terminate.

Body:
my nodejs module starts a server on a specific port, I am wondering if it is a way to stop the execution of that server in my mocha test:

Let's assume that myserver.js contains something like:

myserver = http.Server(app);
....
process.on('SIGTERM', ()=>{ ... });

and in my mocha test, If I do something like this: in order to load my class:

   it(' starts the execution and then stop the server() {
     require('../myserver.js');

     ????
    }

How can I stop the execution from test case?

I was wondering if I could send a SIGTERM message to that process, but I should discover the pid of that process first, maybe it is not worth to do that.

I assume that I could export from my module a function that is then used from other modules in some specific circumstances, like the one I want to test, in order to stop the overall execution.

Body:
In case you need to send the command a SIGTERM signal, you need to handle that with the process signal handler:

Note: process does not require a “require”, it’s automatically available.

const express = require('express')

const app = express()

app.get('/', (req, res) => {
  res.send('Hi!')
});

const server = app.listen(3000, () => console.log('Server ready'));

process.on('SIGTERM', () => {
  server.close(() => {
    console.log('Process terminated');
  });
});

What are signals? Signals are a POSIX intercommunication system: a notification sent to a process in order to notify it of an event that occurred.

SIGKILL is the signals that tells a process to immediately terminate, and would ideally act like process.exit().

SIGTERM is the signals that tells a process to gracefully terminate. It is the signal that’s sent from process managers like upstart or supervisord and many others.

You can send this signal from inside the program, in another function:

process.kill(process.pid, 'SIGTERM')

Or from another Node.js running program, or any other app running in your system that knows the PID of the process you want to terminate.


问:
JSON Array to model using Alamofire
I'm creating a UITableView that will display this response in every cell.
The problem is, I do not know how to parse this response to the model.

Here is the response from the api

```<code>[
"electronics",
"jewelery",
"men's clothing",
"women's clothing"
]
</code>```

Here is the code for the the ViewController

```<code>class HomeViewController: UIViewController {

    @IBOutlet var tableView: UITableView!
    var category: [Category] = []
    override func viewDidLoad() {
        super.viewDidLoad()

        tableView.delegate = self
        tableView.dataSource = self

        guard let url = URL(string: "\(Constants.url.baseUrl)\(Constants.url.category)") else {
            return
        }

        AF.request(url).responseDecodable(of: [Category].self) { response in
            guard let categories = response.value else {
                return
            }
            DispatchQueue.main.async { [weak self] in

                self?.tableView.reloadData()
            }

        }

    }

}

extension HomeViewController: UITableViewDataSource, UITableViewDelegate {
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        print("category count", category.count)

        return category.count
    }

    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        guard let cell = tableView.dequeueReusableCell(withIdentifier: Constants.identifiers.categoryTableViewCell) as? CategoryTableViewCell else{
            return UITableViewCell()
        }
        cell.configureTableViewCell(with: self.category[indexPath.row])
        return cell

    }

}
</code>```

Here is my model

```<code>struct Category: Codable {
}
</code>```

I would greatly appreciate any help. Thank you in advanced!

答:
Here is the answer to your problem...

So your model class will look something like this :

```<code>import Foundation
struct Category: Codable {

    enum CodingKeys: String, CodingKey {

    }

    init(from decoder: Decoder) throws {
        let values = try decoder.container(keyedBy: CodingKeys.self)
    }

}
</code>```

Now you can use this as one of the three following ways to parse the data :

1.Using Codable Mapping :

```<code>let url = URL(string: "http://www.google.com")
let task = URLSession.shared.dataTask(with: url!) { (data, response, error) in
let jsonDecoder = JSONDecoder()
let responseModel = try jsonDecoder.decode(Category.self, from: data!)

}
task.resume()
</code>```

2.Using ObjectMapper

```<code>// Convert JSON String to Model
let responseModel = Mapper<Category>().map(JSONString: JSONString)

// Create JSON String from Model
let JSONString = Mapper().toJSONString(responseModel, prettyPrint: true)
</code>```

3.Using Dictionary Mapping

```<code>let url = URL(string: "http://www.google.com")
let task = URLSession.shared.dataTask(with: url!) { (data, response, error) in

    let someDictionaryFromJSON = try JSONSerialization.jsonObject(with:
    data, options: .allowFragments) as! [String: Any]
    let category = Category(someDictionaryFromJSON)

}
task.resume()
</code>```

Title: JSON Array to model using Alamofire

Body:
I'm creating a UITableView that will display this response in every cell.
The problem is, I do not know how to parse this response to the model.

Here is the response from the api

[
"electronics",
"jewelery",
"men's clothing",
"women's clothing"
]

Here is the code for the the ViewController

class HomeViewController: UIViewController {

    @IBOutlet var tableView: UITableView!
    var category: [Category] = []
    override func viewDidLoad() {
        super.viewDidLoad()

        tableView.delegate = self
        tableView.dataSource = self

        guard let url = URL(string: "\(Constants.url.baseUrl)\(Constants.url.category)") else {
            return
        }

        AF.request(url).responseDecodable(of: [Category].self) { response in
            guard let categories = response.value else {
                return
            }
            DispatchQueue.main.async { [weak self] in

                self?.tableView.reloadData()
            }

        }

    }

}

extension HomeViewController: UITableViewDataSource, UITableViewDelegate {
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        print("category count", category.count)

        return category.count
    }

    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        guard let cell = tableView.dequeueReusableCell(withIdentifier: Constants.identifiers.categoryTableViewCell) as? CategoryTableViewCell else{
            return UITableViewCell()
        }
        cell.configureTableViewCell(with: self.category[indexPath.row])
        return cell

    }

}

Here is my model

struct Category: Codable {
}

I would greatly appreciate any help. Thank you in advanced!

Body:
Here is the answer to your problem...

So your model class will look something like this :

import Foundation
struct Category: Codable {

    enum CodingKeys: String, CodingKey {

    }

    init(from decoder: Decoder) throws {
        let values = try decoder.container(keyedBy: CodingKeys.self)
    }

}

Now you can use this as one of the three following ways to parse the data :

1.Using Codable Mapping :

let url = URL(string: "http://www.google.com")
let task = URLSession.shared.dataTask(with: url!) { (data, response, error) in
let jsonDecoder = JSONDecoder()
let responseModel = try jsonDecoder.decode(Category.self, from: data!)

}
task.resume()

2.Using ObjectMapper

// Convert JSON String to Model
let responseModel = Mapper<Category>().map(JSONString: JSONString)

// Create JSON String from Model
let JSONString = Mapper().toJSONString(responseModel, prettyPrint: true)

3.Using Dictionary Mapping

let url = URL(string: "http://www.google.com")
let task = URLSession.shared.dataTask(with: url!) { (data, response, error) in

    let someDictionaryFromJSON = try JSONSerialization.jsonObject(with:
    data, options: .allowFragments) as! [String: Any]
    let category = Category(someDictionaryFromJSON)

}
task.resume()


问:
Remove input value on backspace keyup
I have a small canonical lottery search form comprising of 6 input fields. Currently when the user backspaces once, it will remove the value and move to the previous input field.

I need to split the above process into two steps. Therefore one backspace removes the value, the second backspace moves to previous input field and repeat.

How can I achieve this by adding to my current jquery if/else statement?

$(function() {
$("#target input").keyup(function(event) {
    if ($(this).val().length == 1) {
        $(this).nextAll('input').first().focus();
    } else if ($(this).val().length > 1) {
        var new_val = $(this).val().substring(1, 2);
        $(this).val(new_val);
        $(this).nextAll('input').first().focus();
    } else if (event.keyCode == 8) {
        if ($(this).prev('input')) {
            $(this).prev('input').focus();
        }
    }
});
});```
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<form id="target">
  <input type="number" id="keyword_1" maxlength="1" min="0" max="9" style="width: 35px !important; etter-spacing: 1.5px;">
  <input type="number" id="keyword_2" maxlength="1" min="0" max="9" name="keyword_2" style="width: 35px !important; etter-spacing: 1.5px;">
  <input type="number" id="keyword_3" maxlength="1" min="0" max="9" name="keyword_3" style="width: 35px !important; etter-spacing: 1.5px;">
  <input type="number" id="keyword_4" maxlength="1" min="0" max="9" name="keyword_4" style="width: 35px !important; etter-spacing: 1.5px;">
  <input type="number" id="keyword_5" maxlength="1" min="0" max="9" name="keyword_5" style="width: 35px !important; etter-spacing: 1.5px;">
  <input type="number" id="keyword_6" maxlength="1" min="0" max="9" name="keyword_6" style="width: 35px !important; etter-spacing: 1.5px;">
  <button class="btn btn-info" id="search-ticket" type="submit">Search</button>
</form></code>```

答:
Its working.

$(function() {
  $("#target input").keyup(function(event) {
    if ($(this).val().length == 1) {
      $(this).nextAll('input').first().focus();
    } else if ($(this).val().length > 1) {
      var new_val = $(this).val().substring(1, 2);
      $(this).val(new_val);
      $(this).nextAll('input').first().focus();
    }
  });
  $("#target input").keydown(function(event) {
    if (event.keyCode == 8 && $(this).val().length == 0) {
      if ($(this).prev('input')) {
        $(this).prev('input').focus();
      }
    }
  });
});```
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<form id="target">
  <input type="number" id="keyword_1" maxlength="1" min="0" max="9" style="width: 35px !important; etter-spacing: 1.5px;">
  <input type="number" id="keyword_2" maxlength="1" min="0" max="9" name="keyword_2" style="width: 35px !important; etter-spacing: 1.5px;">
  <input type="number" id="keyword_3" maxlength="1" min="0" max="9" name="keyword_3" style="width: 35px !important; etter-spacing: 1.5px;">
  <input type="number" id="keyword_4" maxlength="1" min="0" max="9" name="keyword_4" style="width: 35px !important; etter-spacing: 1.5px;">
  <input type="number" id="keyword_5" maxlength="1" min="0" max="9" name="keyword_5" style="width: 35px !important; etter-spacing: 1.5px;">
  <input type="number" id="keyword_6" maxlength="1" min="0" max="9" name="keyword_6" style="width: 35px !important; etter-spacing: 1.5px;">
  <button class="btn btn-info" id="search-ticket" type="submit">Search</button>
</form></code>```

Title: Remove input value on backspace keyup

Body:
I have a small canonical lottery search form comprising of 6 input fields. Currently when the user backspaces once, it will remove the value and move to the previous input field.

I need to split the above process into two steps. Therefore one backspace removes the value, the second backspace moves to previous input field and repeat.

How can I achieve this by adding to my current jquery if/else statement?

$(function() {
$("#target input").keyup(function(event) {
    if ($(this).val().length == 1) {
        $(this).nextAll('input').first().focus();
    } else if ($(this).val().length > 1) {
        var new_val = $(this).val().substring(1, 2);
        $(this).val(new_val);
        $(this).nextAll('input').first().focus();
    } else if (event.keyCode == 8) {
        if ($(this).prev('input')) {
            $(this).prev('input').focus();
        }
    }
});
});

<form id="target">
  <input type="number" id="keyword_1" maxlength="1" min="0" max="9" style="width: 35px !important; etter-spacing: 1.5px;">
  <input type="number" id="keyword_2" maxlength="1" min="0" max="9" name="keyword_2" style="width: 35px !important; etter-spacing: 1.5px;">
  <input type="number" id="keyword_3" maxlength="1" min="0" max="9" name="keyword_3" style="width: 35px !important; etter-spacing: 1.5px;">
  <input type="number" id="keyword_4" maxlength="1" min="0" max="9" name="keyword_4" style="width: 35px !important; etter-spacing: 1.5px;">
  <input type="number" id="keyword_5" maxlength="1" min="0" max="9" name="keyword_5" style="width: 35px !important; etter-spacing: 1.5px;">
  <input type="number" id="keyword_6" maxlength="1" min="0" max="9" name="keyword_6" style="width: 35px !important; etter-spacing: 1.5px;">
  <button class="btn btn-info" id="search-ticket" type="submit">Search</button>
</form>

Body:
Its working.

$(function() {
  $("#target input").keyup(function(event) {
    if ($(this).val().length == 1) {
      $(this).nextAll('input').first().focus();
    } else if ($(this).val().length > 1) {
      var new_val = $(this).val().substring(1, 2);
      $(this).val(new_val);
      $(this).nextAll('input').first().focus();
    }
  });
  $("#target input").keydown(function(event) {
    if (event.keyCode == 8 && $(this).val().length == 0) {
      if ($(this).prev('input')) {
        $(this).prev('input').focus();
      }
    }
  });
});

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<form id="target">
  <input type="number" id="keyword_1" maxlength="1" min="0" max="9" style="width: 35px !important; etter-spacing: 1.5px;">
  <input type="number" id="keyword_2" maxlength="1" min="0" max="9" name="keyword_2" style="width: 35px !important; etter-spacing: 1.5px;">
  <input type="number" id="keyword_3" maxlength="1" min="0" max="9" name="keyword_3" style="width: 35px !important; etter-spacing: 1.5px;">
  <input type="number" id="keyword_4" maxlength="1" min="0" max="9" name="keyword_4" style="width: 35px !important; etter-spacing: 1.5px;">
  <input type="number" id="keyword_5" maxlength="1" min="0" max="9" name="keyword_5" style="width: 35px !important; etter-spacing: 1.5px;">
  <input type="number" id="keyword_6" maxlength="1" min="0" max="9" name="keyword_6" style="width: 35px !important; etter-spacing: 1.5px;">
  <button class="btn btn-info" id="search-ticket" type="submit">Search</button>
</form>


问:
Regular expression is not working if json response value contain special character . how to extract the 'sid' value from below mention json
Regular expression is not working if json response value contain special character . how to extract the 'sid' value from below mention json as ""sid"?\s*:?\s*"(\w+)"" is not working as json response contain special character on sid.

0{"sid":"RhANkc9V7-psbnzmJAAGS","upgrades":["websocket"],"pingTimeout":20000,"pingInterval":25000}

答:
Your \w+ meta character matches "word" characters (alphanumeric and underscores, can be also written as [a-zA-Z0-9_] character class)

Dash symbol - won't be captured so you either need to use wildcard characters instead of "word" something like:

```<code>sid"?\s*:?\s*"(.*)"
</code>```

Demo:

Another possible option is removing this starting 0 using JSR223 Post-Processor and the following Groovy code:

```<code>prev.setResponseData(prev.getResponseDataAsString().substring(1),'UTF-8')
</code>```

once done you will be able to use JSON Extractor or JSON JMESPath Extractor

Body:
Your \w+ meta character matches "word" characters (alphanumeric and underscores, can be also written as [a-zA-Z0-9_] character class)

Dash symbol - won't be captured so you either need to use wildcard characters instead of "word" something like:

sid"?\s*:?\s*"(.*)"

Demo:

Another possible option is removing this starting 0 using JSR223 Post-Processor and the following Groovy code:

prev.setResponseData(prev.getResponseDataAsString().substring(1),'UTF-8')

once done you will be able to use JSON Extractor or JSON JMESPath Extractor


问:
Get datetime for USA from local time
I can able to get time of local sql server by GetDate() function. Sql server machine is in india.

Now I want to get the current datetime of USA on same sql server what can I do.

答:
You will get GMT from UTC time (Coordinated Universal Time)</p>

```<code>SELECT SYSUTCDATETIME()
</code>```

Title: Get datetime for USA from local time

Body:
You will get GMT from UTC time (Coordinated Universal Time)

SELECT SYSUTCDATETIME()


问:
Disable Table pagination in material-ui Reactjs
How to hide table pagination in material-UI if the data is empty array ?I couldn't find props that will hide it from documentation of table pagination in reactjs?

pagiantion

答:
Try below solution

```<code><TableContainer component={Paper}>
  <Table className={classes.table} aria-label="custom pagination table">
    <TableBody>
      {rows.map((row) => (
        <TableRow key={row.name}>
          <TableCell component="th" scope="row"></TableCell>
          <TableCell></TableCell>
          <TableCell></TableCell>
        </TableRow>
      ))}

    </TableBody>

    // Add below condition to hide pagination when no rows are there
    {
     rows.length > 0 && (
       <TableFooter>
         <TableRow>
           <TablePagination
             .....
             .....
             .....
             .....
             .....
           />
         </TableRow>
       </TableFooter>
     )
   }
  </Table>
</TableContainer>
</code>```

Body:
Try below solution

<TableContainer component={Paper}>
  <Table className={classes.table} aria-label="custom pagination table">
    <TableBody>
      {rows.map((row) => (
        <TableRow key={row.name}>
          <TableCell component="th" scope="row"></TableCell>
          <TableCell></TableCell>
          <TableCell></TableCell>
        </TableRow>
      ))}

    </TableBody>

    // Add below condition to hide pagination when no rows are there
    {
     rows.length > 0 && (
       <TableFooter>
         <TableRow>
           <TablePagination
             .....
             .....
             .....
             .....
             .....
           />
         </TableRow>
       </TableFooter>
     )
   }
  </Table>
</TableContainer>


问:
Yarn install in Docker image
I have written a Docker file and I am installing Yarn in the container. But the yarn install/npm install doesn't seem to work. But when I run the yarn install outside the Docker file, it works completely fine. I have done the required proxy settings and everything but still no success.. Not sure why it's failing.

```<code>FROM nexus.corportation.com:8221/nodejs:latest
ARG SRCDIR

RUN mkdir /home/nodejs/app
RUN chown -R nodejs:nodejs /home/nodejs
#Ensure correct ownership
COPY $SRCDIR /home/nodejs/app/
USER root
RUN chown -R nodejs:nodejs /home/nodejs/app
#our user setup in the base container
USER nodejs

#Now using yarn
RUN /bin/bash -c 'source $HOME/.bashrc;cd app;  yarn install'
ENTRYPOINT ["node", "app/javascript/index.js"]
EXPOSE 8080
</code>```

But I get the following error:

error An unexpected error occurred: "https://nexus.corportation.com:8221/nexus/repository/npm-all/@xyz%2flt-navigator:
  tunneling socket could not be established, cause=getaddrinfo ENOTFOUND http http:80".

This works fine outside Docker. I have tried to set the HTTP proxy along with Docker build but still not working.

答:
Try mentioning the proxy in the docker file.
Check what's the default docker network its using, that network should have access to the repo.
ENV http_proxy
ENV https_proxy
ENV HTTP_PROXY
ENV HTTPS_PROXY</p>

Title: Yarn install in Docker image

Body:
I have written a Docker file and I am installing Yarn in the container. But the yarn install/npm install doesn't seem to work. But when I run the yarn install outside the Docker file, it works completely fine. I have done the required proxy settings and everything but still no success.. Not sure why it's failing.

FROM nexus.corportation.com:8221/nodejs:latest
ARG SRCDIR

RUN mkdir /home/nodejs/app
RUN chown -R nodejs:nodejs /home/nodejs
#Ensure correct ownership
COPY $SRCDIR /home/nodejs/app/
USER root
RUN chown -R nodejs:nodejs /home/nodejs/app
#our user setup in the base container
USER nodejs

#Now using yarn
RUN /bin/bash -c 'source $HOME/.bashrc;cd app;  yarn install'
ENTRYPOINT ["node", "app/javascript/index.js"]
EXPOSE 8080

But I get the following error:

error An unexpected error occurred: "https://nexus.corportation.com:8221/nexus/repository/npm-all/@xyz%2flt-navigator:
  tunneling socket could not be established, cause=getaddrinfo ENOTFOUND http http:80".

This works fine outside Docker. I have tried to set the HTTP proxy along with Docker build but still not working.


问:
Kubernetes on docker for windows, persistent volume with hostPath gives Operation not permitted
I am trying to connect a folder in windows to a container folder. This is for a .NET app that needs to read files in a folder. In a normal docker container, with docker-compose, the app works without problems, but since this is only one of several different apps that we will have to monitor, we are trying to get kubernetes involved. That is also where we are failing.
As a beginner with kubernetes, I used kompose.exe to convert the compose files to kuberetes style. However, no matter if I use hostPath or persistentVolumeClaim as a flag, I do not get things to work "out of the box". With hostPath, the path is very incorrect, and with persistentVolumeClaim I get a warning saying volume mount on the host is not supported.
I, therefore, tried to do that part myself but can get it to work with neither persistent volume nor entering mount data in the deployment file directly.
The closest I have come is that I can enter the folder, and I can change to subfolders within, but as soon as I try to run any other command, be it 'ls' or 'cat', I get "Operation not permitted".
Here is my docker compose file, which works as expected by

```<code>version: "3.8"
services:
    test-create-hw-file:
        container_name: "testcreatehwfile"
        image: test-create-hw-file:trygg
        network_mode: "host"
        volumes:
            - /c/temp/testfiles:/app/files
</code>```

Running konvert compose on that file:

```<code>PS C:\temp> .\kompose.exe convert -f .\docker-compose-tchwf.yml --volumes hostPath -v
DEBU Checking validation of provider: kubernetes
DEBU Checking validation of controller:
DEBU Docker Compose version: 3.8
WARN Service "test-create-hw-file" won't be created because 'ports' is not specified
DEBU Compose file dir: C:\temp
DEBU Target Dir: .
INFO Kubernetes file "test-create-hw-file-deployment.yaml" created
</code>```
```<code>apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    kompose.cmd: C:\temp\kompose.exe convert -f .\docker-compose-tchwf.yml --volumes hostPath -v
    kompose.version: 1.26.1 (a9d05d509)
  creationTimestamp: null
  labels:
    io.kompose.service: test-create-hw-file
  name: test-create-hw-file
spec:
  replicas: 1
  selector:
    matchLabels:
      io.kompose.service: test-create-hw-file
  strategy:
    type: Recreate
  template:
    metadata:
      annotations:
        kompose.cmd: C:\temp\kompose.exe convert -f .\docker-compose-tchwf.yml --volumes hostPath -v
        kompose.version: 1.26.1 (a9d05d509)
      creationTimestamp: null
      labels:
        io.kompose.service: test-create-hw-file
    spec:
      containers:
        - image: test-create-hw-file:trygg
          name: testcreatehwfile
          resources: {}
          volumeMounts:
            - mountPath: /app/files
              name: test-create-hw-file-hostpath0
      restartPolicy: Always
      volumes:
        - hostPath:
            path: C:\temp\c\temp\testfiles
          name: test-create-hw-file-hostpath0
status: {}
</code>```

Running kubectl apply on that file just gives the infamous error "Error: Error response from daemon: invalid mode: /app/files", which means, as far as I can understand, not that the "/app/files" is wrong, but the format of the supposedly connected folder is incorrect. This is the quite weird C:\temp\c\temp\testfiles row. After googling and reading a lot, I have two ways of changing that, to either /c/temp/testfiles or /host_mnt/c/temp/testfiles. Both end up in the same "Operation not permitted". I am checking this via going into the CLI on the container in the docker desktop.

The image from the test is just an app that does nothing right now other than wait for five minutes to not quit before I can check the folder.
I am logged on to the shell as root, and I have this row for the folder when doing 'ls -lA':

```<code>drwxrwxrwx 1 root root      0 Feb  7 12:04 files
</code>```

Also, the docker-user has full access to the c:\temp\testfiles folder.

Some version data:

```<code>Docker version 20.10.12, build e91ed57

Kubectl version
Client Version: version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.5", GitCommit:"5c99e2ac2ff9a3c549d9ca665e7bc05a3e18f07e", GitTreeState:"clean", BuildDate:"2021-12-16T08:38:33Z", GoVersion:"go1.16.12", Compiler:"gc", Platform:"windows/amd64"}
Server Version: version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.5", GitCommit:"5c99e2ac2ff9a3c549d9ca665e7bc05a3e18f07e", GitTreeState:"clean", BuildDate:"2021-12-16T08:32:32Z", GoVersion:"go1.16.12", Compiler:"gc", Platform:"linux/amd64"}

Kompose version
1.26.1 (a9d05d509)

Host OS: Windows 10, 21H2
</code>```

//Trygg

答: Thanks to RadekW, the problem is now solved. The path should be written as /run/desktop/mnt/host/c/PATH/TO/FILE, and in my case: /run/desktop/mnt/host/c/temp/testfiles. If I find any documentation about this, I will add a source.

Body:
I am trying to connect a folder in windows to a container folder. This is for a .NET app that needs to read files in a folder. In a normal docker container, with docker-compose, the app works without problems, but since this is only one of several different apps that we will have to monitor, we are trying to get kubernetes involved. That is also where we are failing.
As a beginner with kubernetes, I used kompose.exe to convert the compose files to kuberetes style. However, no matter if I use hostPath or persistentVolumeClaim as a flag, I do not get things to work "out of the box". With hostPath, the path is very incorrect, and with persistentVolumeClaim I get a warning saying volume mount on the host is not supported.
I, therefore, tried to do that part myself but can get it to work with neither persistent volume nor entering mount data in the deployment file directly.
The closest I have come is that I can enter the folder, and I can change to subfolders within, but as soon as I try to run any other command, be it 'ls' or 'cat', I get "Operation not permitted".
Here is my docker compose file, which works as expected by

version: "3.8"
services:
    test-create-hw-file:
        container_name: "testcreatehwfile"
        image: test-create-hw-file:trygg
        network_mode: "host"
        volumes:
            - /c/temp/testfiles:/app/files

Running konvert compose on that file:

PS C:\temp> .\kompose.exe convert -f .\docker-compose-tchwf.yml --volumes hostPath -v
DEBU Checking validation of provider: kubernetes
DEBU Checking validation of controller:
DEBU Docker Compose version: 3.8
WARN Service "test-create-hw-file" won't be created because 'ports' is not specified
DEBU Compose file dir: C:\temp
DEBU Target Dir: .
INFO Kubernetes file "test-create-hw-file-deployment.yaml" created

apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    kompose.cmd: C:\temp\kompose.exe convert -f .\docker-compose-tchwf.yml --volumes hostPath -v
    kompose.version: 1.26.1 (a9d05d509)
  creationTimestamp: null
  labels:
    io.kompose.service: test-create-hw-file
  name: test-create-hw-file
spec:
  replicas: 1
  selector:
    matchLabels:
      io.kompose.service: test-create-hw-file
  strategy:
    type: Recreate
  template:
    metadata:
      annotations:
        kompose.cmd: C:\temp\kompose.exe convert -f .\docker-compose-tchwf.yml --volumes hostPath -v
        kompose.version: 1.26.1 (a9d05d509)
      creationTimestamp: null
      labels:
        io.kompose.service: test-create-hw-file
    spec:
      containers:
        - image: test-create-hw-file:trygg
          name: testcreatehwfile
          resources: {}
          volumeMounts:
            - mountPath: /app/files
              name: test-create-hw-file-hostpath0
      restartPolicy: Always
      volumes:
        - hostPath:
            path: C:\temp\c\temp\testfiles
          name: test-create-hw-file-hostpath0
status: {}

Running kubectl apply on that file just gives the infamous error "Error: Error response from daemon: invalid mode: /app/files", which means, as far as I can understand, not that the "/app/files" is wrong, but the format of the supposedly connected folder is incorrect. This is the quite weird C:\temp\c\temp\testfiles row. After googling and reading a lot, I have two ways of changing that, to either /c/temp/testfiles or /host_mnt/c/temp/testfiles. Both end up in the same "Operation not permitted". I am checking this via going into the CLI on the container in the docker desktop.

The image from the test is just an app that does nothing right now other than wait for five minutes to not quit before I can check the folder.
I am logged on to the shell as root, and I have this row for the folder when doing 'ls -lA':

drwxrwxrwx 1 root root      0 Feb  7 12:04 files

Also, the docker-user has full access to the c:\temp\testfiles folder.

Some version data:

Docker version 20.10.12, build e91ed57

Kubectl version
Client Version: version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.5", GitCommit:"5c99e2ac2ff9a3c549d9ca665e7bc05a3e18f07e", GitTreeState:"clean", BuildDate:"2021-12-16T08:38:33Z", GoVersion:"go1.16.12", Compiler:"gc", Platform:"windows/amd64"}
Server Version: version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.5", GitCommit:"5c99e2ac2ff9a3c549d9ca665e7bc05a3e18f07e", GitTreeState:"clean", BuildDate:"2021-12-16T08:32:32Z", GoVersion:"go1.16.12", Compiler:"gc", Platform:"linux/amd64"}

Kompose version
1.26.1 (a9d05d509)

Host OS: Windows 10, 21H2

//Trygg


问:
Can I automatically create a table in PostgreSQL from a csv file with headers?
I'm running PostgreSQL 9.2.6 on OS X 10.6.8. I would like to import data from a CSV file with column headers into a database. I can do this with the COPY statement, but only if I first manually create a table with a column for each column in the CSV file. Is there any way to automatically create this table based on the headers in the CSV file?

Per this question I have tried

COPY test FROM '/path/to/test.csv' CSV HEADER;

But I just get this error:

ERROR:  relation "test" does not exist

And if I first create a table with no columns:

CREATE TABLE test ();

I get:

ERROR:  extra data after last expected column

I can't find anything in the PostgreSQL COPY documentation about automatically creating a table. Is there some other way to automatically create a table from a CSV file with headers?

答:
Automatic creation seems to be pretty easy with Python+Pandas

Install sqlalchemy library in your Python environment
pip install SQLAlchemy==1.4.31

```<code>import pandas as pd
from sqlalchemy import create_engine
engine = create_engine('postgresql://username:password@localhost:5432/mydatabase')
df=pd.read_csv('example.csv')
df.to_sql('table_name', engine)
</code>```

Body:
Automatic creation seems to be pretty easy with Python+Pandas

Install sqlalchemy library in your Python environment
pip install SQLAlchemy==1.4.31

import pandas as pd
from sqlalchemy import create_engine
engine = create_engine('postgresql://username:password@localhost:5432/mydatabase')
df=pd.read_csv('example.csv')
df.to_sql('table_name', engine)


问:
Clip a UIView with a circle path Swift iOS
I'm trying to clip my camera preview (UIView) inside a circle path but the mask I seems to not clip my view.

```<code>        let preview = cameraController!.previewLayer
        preview.translatesAutoresizingMaskIntoConstraints = false
        _view.translatesAutoresizingMaskIntoConstraints = false

        let path = UIBezierPath(arcCenter: CGPoint(x: _view.frame.size.width/2, y: _view.frame.size.height/2),
                                radius: _view.frame.size.width/2.5,
                                startAngle: CGFloat(0).toRadians(),
                                endAngle: CGFloat(360).toRadians(),
                                clockwise: false)

        path.reversing()
        let shapeLayer = CAShapeLayer()
        shapeLayer.path = path.cgPath
        shapeLayer.fillColor = UIColor.clear.cgColor
        shapeLayer.strokeColor = UIColor.blue.cgColor
        shapeLayer.lineWidth = 5
        preview.layer.mask = shapeLayer
        preview.layer.addSublayer(shapeLayer)
        preview.clipsToBounds = true

        _view.addSubview(preview)
</code>```

What I am missing here ?

答:
Most of the set up was fine, just changed a few things to get it working:

```<code>func maskPreview()
{
    // No change from your code
    let path = UIBezierPath(arcCenter: CGPoint(x: view.frame.size.width/2,
                                               y: view.frame.size.height/2),
                            radius: view.frame.size.width/2.5,
                            startAngle: CGFloat(0).toRadians(),
                            endAngle: CGFloat(360).toRadians(),
                            clockwise: false)

    // Removed this, not sure it was needed
    // Add it back if needed
    //path.reversing()

    // No change
    let shapeLayer = CAShapeLayer()
    shapeLayer.path = path.cgPath

    // This should not be transparent since we need
    // the camera preview to be seen through here
    shapeLayer.fillColor = UIColor.white.cgColor

    // No change
    shapeLayer.strokeColor = UIColor.blue.cgColor
    shapeLayer.lineWidth = 5

    // No change
    previewView.layer.mask = shapeLayer

    // You do not need to add the shape layer as a sublayer
    // after defining it as your mask
    // previewView.layer.addSublayer(shapeLayer)

    // No change
    previewView.clipsToBounds = true
}
</code>```

End result

Update to discuss about the mask layers color

The documentation for mask defines this behavior that the alpha channel determines what content, if any will be allowed to show.

mask

An optional view whose alpha channel is used to mask a view’s
content.

Discussion

The view’s alpha channel determines how much of the view’s
content and background shows through. Fully or partially opaque pixels
allow the underlying content to show through but fully transparent
pixels block that content.

The fill color is not the circle color as you rightly pointed out. You could change this and it would not matter as long as it is not clear color. It determines whether the mask renders the underlying view or not.

To actually add some color to this, I believe you cannot do it directly through the mask layer and you would need an intermediary layer.

Body:
I'm trying to clip my camera preview (UIView) inside a circle path but the mask I seems to not clip my view.

        let preview = cameraController!.previewLayer
        preview.translatesAutoresizingMaskIntoConstraints = false
        _view.translatesAutoresizingMaskIntoConstraints = false

        let path = UIBezierPath(arcCenter: CGPoint(x: _view.frame.size.width/2, y: _view.frame.size.height/2),
                                radius: _view.frame.size.width/2.5,
                                startAngle: CGFloat(0).toRadians(),
                                endAngle: CGFloat(360).toRadians(),
                                clockwise: false)

        path.reversing()
        let shapeLayer = CAShapeLayer()
        shapeLayer.path = path.cgPath
        shapeLayer.fillColor = UIColor.clear.cgColor
        shapeLayer.strokeColor = UIColor.blue.cgColor
        shapeLayer.lineWidth = 5
        preview.layer.mask = shapeLayer
        preview.layer.addSublayer(shapeLayer)
        preview.clipsToBounds = true

        _view.addSubview(preview)

What I am missing here ?

Body:
Most of the set up was fine, just changed a few things to get it working:

func maskPreview()
{
    // No change from your code
    let path = UIBezierPath(arcCenter: CGPoint(x: view.frame.size.width/2,
                                               y: view.frame.size.height/2),
                            radius: view.frame.size.width/2.5,
                            startAngle: CGFloat(0).toRadians(),
                            endAngle: CGFloat(360).toRadians(),
                            clockwise: false)

    // Removed this, not sure it was needed
    // Add it back if needed
    //path.reversing()

    // No change
    let shapeLayer = CAShapeLayer()
    shapeLayer.path = path.cgPath

    // This should not be transparent since we need
    // the camera preview to be seen through here
    shapeLayer.fillColor = UIColor.white.cgColor

    // No change
    shapeLayer.strokeColor = UIColor.blue.cgColor
    shapeLayer.lineWidth = 5

    // No change
    previewView.layer.mask = shapeLayer

    // You do not need to add the shape layer as a sublayer
    // after defining it as your mask
    // previewView.layer.addSublayer(shapeLayer)

    // No change
    previewView.clipsToBounds = true
}

End result

Update to discuss about the mask layers color

The documentation for mask defines this behavior that the alpha channel determines what content, if any will be allowed to show.

mask

An optional view whose alpha channel is used to mask a view’s
content.

Discussion

The view’s alpha channel determines how much of the view’s
content and background shows through. Fully or partially opaque pixels
allow the underlying content to show through but fully transparent
pixels block that content.

The fill color is not the circle color as you rightly pointed out. You could change this and it would not matter as long as it is not clear color. It determines whether the mask renders the underlying view or not.

To actually add some color to this, I believe you cannot do it directly through the mask layer and you would need an intermediary layer.


问:
SQL: Insert all records from one table to another table without specific the columns
I want to insert all the record from the back up table foo_bk into foo table without specific the columns.

if i try this query

```<code>INSERT INTO foo
SELECT *
FROM foo_bk
</code>```

i'll get error "Insert Error: Column name or number of supplied values does not match table definition."

Is it possible to do bulk insert from one table to another without supply the column name?
I've google it but can't seem to find an answer. all the answer require specific the columns.

答:
This is a valid question for example when wanting to append newly imported rows from an imported csv file of the same raw structure into an existing table which may have DB constraints set up such as PKs and FKs.

I would simply do the following, for example:

```<code>INSERT INTO roles select * from new_imported_roles_from_csv_file
</code>```

I also like this when if any new rows violate uniqueness during this operation, the INSERT will fail, not insert anything and in away 'protect' the target table from bad inbound data.

Body:
I want to insert all the record from the back up table foo_bk into foo table without specific the columns.

if i try this query

INSERT INTO foo
SELECT *
FROM foo_bk

i'll get error "Insert Error: Column name or number of supplied values does not match table definition."

Is it possible to do bulk insert from one table to another without supply the column name?
I've google it but can't seem to find an answer. all the answer require specific the columns.

Body:
This is a valid question for example when wanting to append newly imported rows from an imported csv file of the same raw structure into an existing table which may have DB constraints set up such as PKs and FKs.

I would simply do the following, for example:

INSERT INTO roles select * from new_imported_roles_from_csv_file

I also like this when if any new rows violate uniqueness during this operation, the INSERT will fail, not insert anything and in away 'protect' the target table from bad inbound data.


问:
Simplifying a SQL query
I've been using below query to get the desired value and it gives me the correct output, but is there any way to simplify this query?

```<code>SELECT (
(SELECT count(DISTINCT user_id)
FROM table1
WHERE date between '2022-01-01' and '2022-01-20'
AND page_urlpath like '%accountc/upgrade%'
AND page_urlpath like '%success%'
AND app_id = 'rapper') +
(SELECT count(DISTINCT user_id)
FROM table1
WHERE date between '2022-01-01' and '2022-01-20'
AND page_urlpath like '%/upgrade/personal/success/%'
AND app_id = 'rapper') +
(SELECT count(DISTINCT user_id)
FROM table1
WHERE date between '2022-01-01' and '2022-01-20'
AND page_urlpath like '%/upgrade/team/success/%'
AND app_id = 'rapper') +
(SELECT count(DISTINCT user_id)
FROM table1
WHERE date between '2022-01-01' and '2022-01-20'
AND page_urlpath like '%/upgrade/desktop/personal/success/%'
AND app_id = 'rapper') +
(SELECT count(DISTINCT user_id)
FROM table1
WHERE date between '2022-01-01' and '2022-01-20'
AND page_urlpath like '%/upgrade/desktop/team/success/%'
AND app_id = 'rapper')
) as total
</code>```

All the columns are in a single table.

答:
Use a single pass query with conditional aggregation:

SELECT
    COUNT(DISTINCT user_id) FILTER (
        WHERE page_urlpath LIKE '%accountc/upgrade%' AND
              page_urlpath like '%success%' OR
              page_urlpath LIKE '%/upgrade/personal/success/%' OR
              page_urlpath LIKE '%/upgrade/team/success/%' OR
              page_urlpath LIKE '%/upgrade/desktop/personal/success/%' OR
              page_urlpath LIKE '%/upgrade/desktop/team/success/%'
    ) AS total
FROM table1
WHERE
     app_id = 'rapper' AND
     date BETWEEN '2022-01-01' AND '2022-01-20';
```
<p>In case you are on an older version of Postgres which doesn't support <code>FILTER</code>, use conditional aggregation with <code>CASE</code>:</p>
<pre class="lang-sql prettyprint-override"><code>SELECT
    COUNT(DISTINCT
        CASE WHEN page_urlpath LIKE '%accountc/upgrade%' AND
                  page_urlpath like '%success%' OR
                  page_urlpath LIKE '%/upgrade/personal/success/%' OR
                  page_urlpath LIKE '%/upgrade/team/success/%' OR
                  page_urlpath LIKE '%/upgrade/desktop/personal/success/%' OR
                  page_urlpath LIKE '%/upgrade/desktop/team/success/%'
             THEN 1 END) AS total
FROM table1
WHERE
     app_id = 'rapper' AND
     date BETWEEN '2022-01-01' AND '2022-01-20';
</code>```

Title: Simplifying a SQL query

Body:
I've been using below query to get the desired value and it gives me the correct output, but is there any way to simplify this query?

SELECT (
(SELECT count(DISTINCT user_id)
FROM table1
WHERE date between '2022-01-01' and '2022-01-20'
AND page_urlpath like '%accountc/upgrade%'
AND page_urlpath like '%success%'
AND app_id = 'rapper') +
(SELECT count(DISTINCT user_id)
FROM table1
WHERE date between '2022-01-01' and '2022-01-20'
AND page_urlpath like '%/upgrade/personal/success/%'
AND app_id = 'rapper') +
(SELECT count(DISTINCT user_id)
FROM table1
WHERE date between '2022-01-01' and '2022-01-20'
AND page_urlpath like '%/upgrade/team/success/%'
AND app_id = 'rapper') +
(SELECT count(DISTINCT user_id)
FROM table1
WHERE date between '2022-01-01' and '2022-01-20'
AND page_urlpath like '%/upgrade/desktop/personal/success/%'
AND app_id = 'rapper') +
(SELECT count(DISTINCT user_id)
FROM table1
WHERE date between '2022-01-01' and '2022-01-20'
AND page_urlpath like '%/upgrade/desktop/team/success/%'
AND app_id = 'rapper')
) as total

All the columns are in a single table.

Body:
Use a single pass query with conditional aggregation:

SELECT
    COUNT(DISTINCT user_id) FILTER (
        WHERE page_urlpath LIKE '%accountc/upgrade%' AND
              page_urlpath like '%success%' OR
              page_urlpath LIKE '%/upgrade/personal/success/%' OR
              page_urlpath LIKE '%/upgrade/team/success/%' OR
              page_urlpath LIKE '%/upgrade/desktop/personal/success/%' OR
              page_urlpath LIKE '%/upgrade/desktop/team/success/%'
    ) AS total
FROM table1
WHERE
     app_id = 'rapper' AND
     date BETWEEN '2022-01-01' AND '2022-01-20';

In case you are on an older version of Postgres which doesn't support FILTER, use conditional aggregation with CASE:

SELECT
    COUNT(DISTINCT
        CASE WHEN page_urlpath LIKE '%accountc/upgrade%' AND
                  page_urlpath like '%success%' OR
                  page_urlpath LIKE '%/upgrade/personal/success/%' OR
                  page_urlpath LIKE '%/upgrade/team/success/%' OR
                  page_urlpath LIKE '%/upgrade/desktop/personal/success/%' OR
                  page_urlpath LIKE '%/upgrade/desktop/team/success/%'
             THEN 1 END) AS total
FROM table1
WHERE
     app_id = 'rapper' AND
     date BETWEEN '2022-01-01' AND '2022-01-20';


问:
How to fix unrecognized tag in settings xml?
I have setting.xml

```<code><settings
        xmlns="http://maven.apache.org/SETTINGS/1.0.0"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
    <mirrors>
        <mirror>
            <id>Nexus.Codehaus Snapshots</id>
            <name>Nexus Mirror of Codehaus Snapshots</name>
            <url>http://build/nexus/content/repositories/codehaus-snapshots</url>
            <mirrorOf>Codehaus Snapshots</mirrorOf>
        </mirror>
        <mirror>
            <id>Nexus</id>
            <name>Nexus Public Mirror</name>
            <url>http://nexus.other.com/content/groups/public</url>
            <mirrorOf>Nexus</mirrorOf>
        </mirror>
    </mirrors>

    <server>
        <id>TomcatServer</id>
        <username>admin</username>
        <password>password</password>
    </server>

    <profiles>
        <profile>
            <id>quickBuild</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <properties>
                <maven.test.skip>true</maven.test.skip>
                <pmd.skip>true</pmd.skip>
                <checkstyle.skip>true</checkstyle.skip>
                <findbugs.skip>true</findbugs.skip>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <configuration>
                            <source>${java.version}</source>
                            <target>${java.version}</target>
                            <debug>true</debug>
                            <debuglevel>lines,vars,source</debuglevel>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>some</id>
                                <phase>none</phase>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>findbugs-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>some2</id>
                                <phase>none</phase>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-pmd-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>some3</id>
                                <phase>none</phase>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-checkstyle-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>some4</id>
                                <phase>none</phase>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>jaxws-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>some5</id>
                                <phase>none</phase>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>repository-profile</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <repositories>
                <repository>
                    <id>maven2-repository.dev.java.net</id>
                    <name>Java.net Repository for Maven</name>
                    <url>http://download.java.net/maven/2/</url>
                    <layout>default</layout>
                </repository>
            </repositories>
        </profile>
    </profiles>
</settings>
</code>```

At start of maven build I have a message:

```<code>[WARNING]
[WARNING] Some problems were encountered while building the effective settings
[WARNING] Unrecognised tag: 'server' (position: START_TAG seen ...</mirrors>\r\n\t\r\n\t<server>... @31:10)  @ D:\directory\.m2\settings.xml, line 31, column 10
[WARNING]
</code>```

I do not undestand why? As I understand server tag and mirrors are valid (I think so because plugins and dependency resolving works). How I can fix this?

答:
Here is an overview of the top elements under settings:

```<code><settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd">
  <localRepository/>
  <interactiveMode/>
  <offline/>
  <pluginGroups/>
  <servers/>
  <mirrors/>
  <proxies/>
  <profiles/>
  <activeProfiles/>
</settings>
</code>```

You can easily find top elements information from  https://maven.apache.org/settings.html

Body:
I have setting.xml

<settings
        xmlns="http://maven.apache.org/SETTINGS/1.0.0"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
    <mirrors>
        <mirror>
            <id>Nexus.Codehaus Snapshots</id>
            <name>Nexus Mirror of Codehaus Snapshots</name>
            <url>http://build/nexus/content/repositories/codehaus-snapshots</url>
            <mirrorOf>Codehaus Snapshots</mirrorOf>
        </mirror>
        <mirror>
            <id>Nexus</id>
            <name>Nexus Public Mirror</name>
            <url>http://nexus.other.com/content/groups/public</url>
            <mirrorOf>Nexus</mirrorOf>
        </mirror>
    </mirrors>

    <server>
        <id>TomcatServer</id>
        <username>admin</username>
        <password>password</password>
    </server>

    <profiles>
        <profile>
            <id>quickBuild</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <properties>
                <maven.test.skip>true</maven.test.skip>
                <pmd.skip>true</pmd.skip>
                <checkstyle.skip>true</checkstyle.skip>
                <findbugs.skip>true</findbugs.skip>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <configuration>
                            <source>${java.version}</source>
                            <target>${java.version}</target>
                            <debug>true</debug>
                            <debuglevel>lines,vars,source</debuglevel>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>some</id>
                                <phase>none</phase>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>findbugs-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>some2</id>
                                <phase>none</phase>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-pmd-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>some3</id>
                                <phase>none</phase>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-checkstyle-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>some4</id>
                                <phase>none</phase>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>jaxws-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>some5</id>
                                <phase>none</phase>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>repository-profile</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <repositories>
                <repository>
                    <id>maven2-repository.dev.java.net</id>
                    <name>Java.net Repository for Maven</name>
                    <url>http://download.java.net/maven/2/</url>
                    <layout>default</layout>
                </repository>
            </repositories>
        </profile>
    </profiles>
</settings>

At start of maven build I have a message:

[WARNING]
[WARNING] Some problems were encountered while building the effective settings
[WARNING] Unrecognised tag: 'server' (position: START_TAG seen ...</mirrors>\r\n\t\r\n\t<server>... @31:10)  @ D:\directory\.m2\settings.xml, line 31, column 10
[WARNING]

I do not undestand why? As I understand server tag and mirrors are valid (I think so because plugins and dependency resolving works). How I can fix this?

Body:
Here is an overview of the top elements under settings:

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd">
  <localRepository/>
  <interactiveMode/>
  <offline/>
  <pluginGroups/>
  <servers/>
  <mirrors/>
  <proxies/>
  <profiles/>
  <activeProfiles/>
</settings>

You can easily find top elements information from  https://maven.apache.org/settings.html


问:
Filtering Data in Multiple Tables with the Filter Function (Excel)
I'm trying to return data from multiple tables based on a date. Each table has employee schedules with different tasks and I'd like to join these on a master output sheet that is dynamic with a formula.

```<code>=IF(A27=I27,FILTER(Employee 1,(Employee 1[Day]=D27)*(Employee 1[Name]=A27),"NA"),IF(A27=I28,FILTER(Employee 2,(Employee 2[Day]=D27)*(Employee 2[Name]=A27),"NA")
</code>```

The above formula works if I toggle the employees name in a drop down list, but I'd like to have a "All" option that pulls in all of the employee names into the filter.

Something like this (the syntax is not correct):

```<code>=FILTER(Employee 1,Employee 1[Day]=D27),FILTER(Employee 2,(Employee 2[Day]=D27)))
</code>```

Here is a photo of the summary I'm trying add a "all" option in the drop down.
[1]enter image description here

Any help would be greatly appreciated. Thank you in advance!

答:
Very 1st of All, You are not allowed to use space in table names So, i changed your table names from Employee 1 and Employee 2 To Employee_1 and Employee_2
Now You can Use this formula to get the required result

```<code>=LET(name1,I27,name2,I28,tabname1,Employee_1[Name],tabname2,Employee_2[Name],daycheck1,Employee_1[Day]=D27,daycheck2,Employee_2[Day]=D27,x, FILTER(Employee_1,(daycheck1)*(tabname1=name1)), y, FILTER(Employee_2,(daycheck2)*(tabname2=name2)),rows1, COUNTIFS(tabname1,name1,Employee_1[Day],D27), rows2, COUNTIFS(tabname2,name2,Employee_2[Day],D27),myrows, SEQUENCE(rows1+rows2),cols,(IFERROR(COLUMNS(x),COLUMNS(y))),mycols, SEQUENCE(1,cols),IF(A27=I27,x,IF(A27=I28,y,IF(A27="All Employees",IF(myrows<=rows1, x, INDEX(y, myrows-rows1, mycols)),"NA"))))
</code>```

Hope this works for you

Body:
I'm trying to return data from multiple tables based on a date. Each table has employee schedules with different tasks and I'd like to join these on a master output sheet that is dynamic with a formula.

=IF(A27=I27,FILTER(Employee 1,(Employee 1[Day]=D27)*(Employee 1[Name]=A27),"NA"),IF(A27=I28,FILTER(Employee 2,(Employee 2[Day]=D27)*(Employee 2[Name]=A27),"NA")

The above formula works if I toggle the employees name in a drop down list, but I'd like to have a "All" option that pulls in all of the employee names into the filter.

Something like this (the syntax is not correct):

=FILTER(Employee 1,Employee 1[Day]=D27),FILTER(Employee 2,(Employee 2[Day]=D27)))

Here is a photo of the summary I'm trying add a "all" option in the drop down.
[1]enter image description here

Any help would be greatly appreciated. Thank you in advance!

Body:
Very 1st of All, You are not allowed to use space in table names So, i changed your table names from Employee 1 and Employee 2 To Employee_1 and Employee_2
Now You can Use this formula to get the required result

=LET(name1,I27,name2,I28,tabname1,Employee_1[Name],tabname2,Employee_2[Name],daycheck1,Employee_1[Day]=D27,daycheck2,Employee_2[Day]=D27,x, FILTER(Employee_1,(daycheck1)*(tabname1=name1)), y, FILTER(Employee_2,(daycheck2)*(tabname2=name2)),rows1, COUNTIFS(tabname1,name1,Employee_1[Day],D27), rows2, COUNTIFS(tabname2,name2,Employee_2[Day],D27),myrows, SEQUENCE(rows1+rows2),cols,(IFERROR(COLUMNS(x),COLUMNS(y))),mycols, SEQUENCE(1,cols),IF(A27=I27,x,IF(A27=I28,y,IF(A27="All Employees",IF(myrows<=rows1, x, INDEX(y, myrows-rows1, mycols)),"NA"))))

Hope this works for you