问:
handshake: unsupported protocol (SSL routines) [asio.ssl:167772418] | [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:997)
I'm trying to write a simpel client-server application with tlsv1.3.

The client is in Python and the server is in C++.
In Python documentation i saw that Python only support tlsv1.3.

So in my server I've set the tls version to 1.3.
In the title the firs error is from VS (C++) and the second one is from Python.

I'm attaching both scripts and I will really aprichate any help I can get. Thank you for your help !

server:

```<code>#include <iostream>
#include <boost/asio.hpp>
#include <boost/asio/ssl.hpp>
#include <boost/thread.hpp>

#define PORT 8080
#define MAX_LEN 1024

using boost::asio::ip::tcp;
namespace ssl = boost::asio::ssl;

void main() {
    boost::asio::io_context ctx;
    std::thread ctx_thread{ [&ctx]() { ctx.run(); } };

    ssl::context ssl_ctx(ssl::context::tlsv13_server);
    ssl_ctx.set_verify_mode(ssl::context::verify_none);

    tcp::acceptor a(ctx, tcp::endpoint(tcp::v4(), PORT));

    std::cout << "waiting for connection..." << std::endl;
    auto socket = a.accept(); // this waits for client to open session
    ssl::stream<decltype(socket)> ssl_stream(std::move(socket), ssl_ctx);
    try {
        ssl_stream.handshake(ssl::stream_base::server);
    }
    catch (const std::exception& e) {
        std::cout << e.what();
    }

    std::cout << "connection establish" << std::endl;
    //char data[MAX_LEN];

    if (ctx_thread.joinable())
        ctx_thread.join();
}
</code>```

client:

```<code>import socket
import ssl
import sys

HOST, PORT = '127.0.0.1', '8080'

# send message to the server, check if the message sent
def send_to_server(channel, message):
    try:
        channel.sendall(str.encode(message))
    except socket.error:
        print("can't send on this channel")
        sys.exit(1)

# receive a message from the server, check if the message received
def receive_from_server(channel):
    try:
        return channel.recv(2048)
    except socket.error as e:
        print("can't receive on this channel")
        print(str(e))
        sys.exit(1)

if __name__ == '__main__':
    context = ssl.create_default_context()
    context.set_ciphers('DEFAULT')
    with socket.create_connection((HOST, PORT)) as sock:
        try:
            with context.wrap_socket(sock, server_hostname=HOST) as ssock:
                print(ssock.version())
        except Exception as e:
            print(e)

</code>```

I've expected client-server application with tls version 1.3,
I got nothing.

Body:
I'm trying to write a simpel client-server application with tlsv1.3.

The client is in Python and the server is in C++.
In Python documentation i saw that Python only support tlsv1.3.

So in my server I've set the tls version to 1.3.
In the title the firs error is from VS (C++) and the second one is from Python.

I'm attaching both scripts and I will really aprichate any help I can get. Thank you for your help !

server:

#include <iostream>
#include <boost/asio.hpp>
#include <boost/asio/ssl.hpp>
#include <boost/thread.hpp>

#define PORT 8080
#define MAX_LEN 1024

using boost::asio::ip::tcp;
namespace ssl = boost::asio::ssl;

void main() {
    boost::asio::io_context ctx;
    std::thread ctx_thread{ [&ctx]() { ctx.run(); } };

    ssl::context ssl_ctx(ssl::context::tlsv13_server);
    ssl_ctx.set_verify_mode(ssl::context::verify_none);

    tcp::acceptor a(ctx, tcp::endpoint(tcp::v4(), PORT));

    std::cout << "waiting for connection..." << std::endl;
    auto socket = a.accept(); // this waits for client to open session
    ssl::stream<decltype(socket)> ssl_stream(std::move(socket), ssl_ctx);
    try {
        ssl_stream.handshake(ssl::stream_base::server);
    }
    catch (const std::exception& e) {
        std::cout << e.what();
    }

    std::cout << "connection establish" << std::endl;
    //char data[MAX_LEN];

    if (ctx_thread.joinable())
        ctx_thread.join();
}

client:

import socket
import ssl
import sys

HOST, PORT = '127.0.0.1', '8080'

# send message to the server, check if the message sent
def send_to_server(channel, message):
    try:
        channel.sendall(str.encode(message))
    except socket.error:
        print("can't send on this channel")
        sys.exit(1)

# receive a message from the server, check if the message received
def receive_from_server(channel):
    try:
        return channel.recv(2048)
    except socket.error as e:
        print("can't receive on this channel")
        print(str(e))
        sys.exit(1)

if __name__ == '__main__':
    context = ssl.create_default_context()
    context.set_ciphers('DEFAULT')
    with socket.create_connection((HOST, PORT)) as sock:
        try:
            with context.wrap_socket(sock, server_hostname=HOST) as ssock:
                print(ssock.version())
        except Exception as e:
            print(e)

I've expected client-server application with tls version 1.3,
I got nothing.


来源: stackexchange

问:
RenderPhysicalModel object was given an infinite size during layout
I got these errors in debug console:

Another exception was thrown: _RenderInkFeatures object was given an infinite size during layout.
Another exception was thrown: RenderPhysicalModel object was given an infinite size during layout.
Another exception was thrown: RenderCustomMultiChildLayoutBox object was given an infinite size during layout.
Another exception was thrown: _RenderInkFeatures object was given an infinite size during layout.
Another exception was thrown: RenderPhysicalModel object was given an infinite size during layout.
Another exception was thrown: _RenderSingleChildViewport object was given an infinite size during layout.
Another exception was thrown: RenderIgnorePointer object was given an infinite size during layout.
Another exception was thrown: RenderSemanticsAnnotations object was given an infinite size during layout.
Another exception was thrown: RenderPointerListener object was given an infinite size during layout.
Another exception was thrown: RenderSemanticsGestureHandler object was given an infinite size during layout.
Another exception was thrown: RenderPointerListener object was given an infinite size during layout.
Another exception was thrown: _RenderScrollSemantics object was given an infinite size during layout.
Another exception was thrown: RenderRepaintBoundary object was given an infinite size during layout.
Another exception was thrown: RenderCustomPaint object was given an infinite size during layout.
Another exception was thrown: RenderMouseRegion object was given an infinite size during layout.
Another exception was thrown: RenderPointerListener object was given an infinite size during layout.
Another exception was thrown: RenderSemanticsGestureHandler object was given an infinite size during layout.
Another exception was thrown: RenderRepaintBoundary object was given an infinite size during layout.
Another exception was thrown: RenderPadding object was given an infinite size during layout.
Another exception was thrown: A RenderFlex overflowed by Infinity pixels on the bottom.
Another exception was thrown: A RenderFlex overflowed by 32 pixels on the bottom.

This is what I got:

[]

I was trying to achieve this design:

This is my code:

homepage.dart

```<code>import 'dart:core';
import 'package:flutter/material.dart';
import 'package:google_nav_bar/google_nav_bar.dart';
import 'package:pomodoro/5.hourglass_animation/countdown_timer/pomodoro_animation.dart';
import 'dart:async';

class HomePageTimerUI extends StatefulWidget {
  const HomePageTimerUI({Key? key}) : super(key: key);

  @override
  State<HomePageTimerUI> createState() => _HomePageTimerUIState();
}

class _HomePageTimerUIState extends State<HomePageTimerUI>
    with TickerProviderStateMixin {
  late TabController _tabController;

  late Timer timer;
  late AnimationController controller;

  String get countText {
    Duration count = controller.duration! * controller.value;
    return controller.isDismissed
        ? '${controller.duration!.inHours.toString().padLeft(2, '0')}:${(controller.duration!.inMinutes % 60).toString().padLeft(2, '0')}:${(controller.duration!.inSeconds % 60).toString().padLeft(2, '0')}'
        : '${count.inHours.toString().padLeft(2, '0')}:${(count.inMinutes % 60).toString().padLeft(2, '0')}:${(count.inSeconds % 60).toString().padLeft(2, '0')}';
  }

  @override
  void initState() {
    super.initState();
    _tabController = TabController(length: 3, vsync: this);
  }

  @override
  void dispose() {
    _tabController.dispose();
    super.dispose();
  }

  void notify() {
    if (countText == '00:00:00') {
      _tabController.animateTo(1, duration: const Duration(milliseconds: 300));
    }
  }

  @override
  Widget build(BuildContext context) {
    return SafeArea(
      child: Scaffold(
        appBar: PreferredSize(
          preferredSize: const Size.fromHeight(55),
          child: DefaultTabController(
            length: 3,
            child: Scaffold(
              appBar: AppBar(
                elevation: 0,
                backgroundColor: Colors.transparent,
                bottom: PreferredSize(
                  preferredSize: const Size.fromHeight(55),
                  child: Container(
                    color: Colors.transparent,
                    child: SafeArea(
                      child: Column(
                        children: <Widget>[
                          TabBar(
                              controller: _tabController,
                              indicator: const UnderlineTabIndicator(
                                  borderSide: BorderSide(
                                      color: Color(0xff3B3B3B), width: 4.0),
                                  insets:
                                      EdgeInsets.fromLTRB(12.0, 12.0, 12.0, 11.0)),
                              indicatorWeight: 15,
                              indicatorSize: TabBarIndicatorSize.label,
                              labelColor: const Color(0xff3B3B3B),
                              labelStyle: const TextStyle(
                                  fontSize: 12,
                                  letterSpacing: 1.3,
                                  fontWeight: FontWeight.w500),
                              unselectedLabelColor: const Color(0xffD7D7D7),
                              tabs: const [
                                 Tab(
                                  text: "POMODORO",
                                  icon: Icon(Icons.work_history, size: 40),
                                ),
                                 Tab(
                                  text: "SHORT BREAK",
                                  icon: Icon(Icons.ramen_dining, size: 40),
                                ),
                                 Tab(
                                  text: "LONG BREAK",
                                  icon: Icon(Icons.battery_charging_full_rounded,
                                      size: 40),
                                ),
                              ])
                        ],
                      ),
                    ),
                  ),
                ),
              ),
              body: TabBarView(
                controller: _tabController,
                children: <Widget>[
                  Center(
                    child: StartPomodoro(end: DateTime.now()),
                  ),
                  const Center(
                    child: Text('short break'),
                  ),
                  const Center(
                    child: Text('long break '),
                  ),
                ],
              ),
            ),
          ),
        ),
        body: Column(children: [
          SizedBox(height:  10,),
          StartPomodoro(end: DateTime.now())
        ]),
      ),
    );
  }
}

</code>```

startpomodoro.dart

```<code>import 'dart:async';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:pomodoro/5.hourglass_animation/countdown_timer/responsive.dart';

class StartPomodoro extends StatefulWidget {
  const StartPomodoro({super.key, required this.end});

  final DateTime end;

  @override
  State<StartPomodoro> createState() => _StartPomodoroState();
}

class _StartPomodoroState extends State<StartPomodoro>
    with TickerProviderStateMixin {
  final now = DateTime.now();

  List<bool> isSelected = [true, false];
  late Timer timer;
  late AnimationController controller;

  String get countText {
    Duration count = controller.duration! * controller.value;
    return controller.isDismissed
        ? '${controller.duration!.inHours.toString().padLeft(2, '0')}:${(controller.duration!.inMinutes % 60).toString().padLeft(2, '0')}:${(controller.duration!.inSeconds % 60).toString().padLeft(2, '0')}'
        : '${count.inHours.toString().padLeft(2, '0')}:${(count.inMinutes % 60).toString().padLeft(2, '0')}:${(count.inSeconds % 60).toString().padLeft(2, '0')}';
  }

  double progress = 1.0;
  bool LongBreak = true;

  void notify() {
    if (countText == '00:00:00') {}
  }

  @override
  void initState() {
    super.initState();
    controller = AnimationController(
      vsync: this,
      duration: const Duration(seconds: 0),
    );
    controller.addListener(() {
      notify();
      if (controller.isAnimating) {
        setState(() {
          progress = controller.value;
        });
      } else {
        setState(() {
          progress = 1.0;
          LongBreak = true;
        });
      }
    });
  }

  @override
  void dispose() {
    controller.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return SafeArea(
      child: SingleChildScrollView(
        child: Scaffold(
          backgroundColor:
              LongBreak ? const Color(0xffD94530) : const Color(0xff6351c5),
          body: GestureDetector(
            onTap: () {
              if (controller.isDismissed) {
                showModalBottomSheet(
                  context: context,
                  builder: (context) => Container(
                    height: 300,
                    child: CupertinoTimerPicker(
                      initialTimerDuration: controller.duration!,
                      onTimerDurationChanged: (time) {
                        setState(() {
                          controller.duration = time;
                        });
                      },
                    ),
                  ),
                );
              }
            },
            child: AnimatedBuilder(
                animation: controller,
                builder: (context, child) {
                  return Stack(
                    children: <Widget>[
                      Align(
                        alignment: Alignment.bottomCenter,
                        child: Container(
                          color: const Color(0xffD94530),
                          height: controller.value *
                              MediaQuery.of(context).size.height,
                        ),
                      ),
                      Padding(
                        padding: const EdgeInsets.all(8.0),
                        child: Responsive(
                          child: SingleChildScrollView(
                            child: Column(
                              mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                              crossAxisAlignment: CrossAxisAlignment.center,
                              children: <Widget>[
                                Align(
                                  alignment: Alignment.bottomCenter,
                                  child: Align(
                                    alignment: FractionalOffset.bottomCenter,
                                    child: Container(
                                      width: MediaQuery.of(context).size.width,
                                      height: 210,
                                      decoration: const BoxDecoration(
                                        color:
                                            Color.fromARGB(255, 245, 245, 245),
                                      ),
                                      child: Container(
                                        padding: const EdgeInsets.all(20.0),
                                        child: Column(
                                          crossAxisAlignment:
                                              CrossAxisAlignment.start,
                                          children: [
                                            const Text(
                                              "Hyper-focused on... (+add task)",
                                              style: TextStyle(
                                                fontSize: 22.0,
                                                fontWeight: FontWeight.w500,
                                              ),
                                            ),
                                            const SizedBox(height: 16),
                                            Center(
                                              child: Column(
                                                mainAxisAlignment:
                                                    MainAxisAlignment.center,
                                                children: [
                                                  Row(
                                                    mainAxisAlignment:
                                                        MainAxisAlignment
                                                            .center,
                                                    crossAxisAlignment:
                                                        CrossAxisAlignment
                                                            .center,
                                                    children: [
                                                      Center(
                                                        child: Text(
                                                          countText,
                                                          style:
                                                              const TextStyle(
                                                            fontWeight:
                                                                FontWeight.w600,
                                                            letterSpacing: 4,
                                                            fontSize: 65.0,
                                                            color: Color(
                                                                0xff3B3B3B),
                                                          ),
                                                        ),
                                                      ),
                                                    ],
                                                  ),
                                                  Row(
                                                    mainAxisAlignment:
                                                        MainAxisAlignment
                                                            .center,
                                                    crossAxisAlignment:
                                                        CrossAxisAlignment
                                                            .center,
                                                    children: const [
                                                      Center(
                                                        child: Text(
                                                          '      Hours      Minutes      Seconds      ',
                                                          style: TextStyle(
                                                            fontWeight:
                                                                FontWeight.w500,
                                                            letterSpacing: 2,
                                                            fontSize: 20.0,
                                                            color: Color(
                                                                0xff3B3B3B),
                                                          ),
                                                        ),
                                                      ),
                                                    ],
                                                  ),
                                                ],
                                              ),
                                            ),
                                          ],
                                        ),
                                      ),

                                    ),

                                  ),

                                ),
                                SizedBox(height: 150,),
                                 //Spacer(),
                                Column(
                                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                                  crossAxisAlignment:
                                      CrossAxisAlignment.stretch,
                                  children: [
                                    AnimatedBuilder(
                                        animation: controller,
                                        builder: (context, child) {
                                          return const Padding(
                                            padding: EdgeInsets.symmetric(
                                                vertical: 2.0,
                                                horizontal: 0.0),
                                          );
                                        }),
                                    AnimatedBuilder(
                                        animation: controller,
                                        builder: (context, child) {
                                          return Padding(
                                            padding:
                                                const EdgeInsets.symmetric(
                                                    vertical: 2.0,
                                                    horizontal: 0.0),
                                            child:
                                                Container(
                                                  color: const Color(0xffFAFAFA),
                                                  width: MediaQuery.of(context).size.width,
                                                  child: FloatingActionButton.extended(
                                                      backgroundColor:
                                                          const Color(
                                                              0xffFAFAFA),
                                                      onPressed: () {
                                                        if (controller
                                                            .isAnimating) {
                                                          controller.stop();
                                                          setState(() {
                                                            LongBreak = false;
                                                          });
                                                        } else {
                                                          controller.reverse(
                                                              from: controller
                                                                          .value ==
                                                                      0
                                                                  ? 1.0
                                                                  : controller
                                                                      .value);
                                                          setState(() {
                                                            LongBreak = false;
                                                          });
                                                        }
                                                      },
                                                      icon: Icon(
                                                        controller.isAnimating
                                                            ? Icons.pause
                                                            : Icons.play_arrow,
                                                        color: const Color(
                                                            0xff3B3B3B),
                                                      ),
                                                      label: Text(
                                                        controller.isAnimating
                                                            ? "Pause"
                                                            : "Start",
                                                        style: const TextStyle(
                                                            color: Color(
                                                                0xff3B3B3B)),
                                                      )),
                                                ),
                                          );
                                        }),
                                  ],
                                ),

                               ],
                            ),
                          ),
                        ),
                      ),
                    ],
                  );
                }),
          ),
        ),
      ),
    );
  }

  AnimationController _buildClockAnimation(TickerProvider tickerProvider) {
    return AnimationController(
      vsync: tickerProvider,
      duration: const Duration(milliseconds: 750),
    );
  }

  void _animateLeftDigit(
    int prev,
    int current,
    AnimationController controller,
  ) {
    final prevFirstDigit = (prev / 10).floor();
    final currentFirstDigit = (current / 10).floor();
    if (prevFirstDigit != currentFirstDigit) {
      controller.forward();
    }
  }
}

</code>```

I tried to wrap the scaffold widget to SinglChildScrollView to solve the error but no luck, How can I achieve the second screenshot?

Thank you for any help you can offer

ContentLicense: CC BY-SA 4.0

Body:
I got these errors in debug console:

Another exception was thrown: _RenderInkFeatures object was given an infinite size during layout.
Another exception was thrown: RenderPhysicalModel object was given an infinite size during layout.
Another exception was thrown: RenderCustomMultiChildLayoutBox object was given an infinite size during layout.
Another exception was thrown: _RenderInkFeatures object was given an infinite size during layout.
Another exception was thrown: RenderPhysicalModel object was given an infinite size during layout.
Another exception was thrown: _RenderSingleChildViewport object was given an infinite size during layout.
Another exception was thrown: RenderIgnorePointer object was given an infinite size during layout.
Another exception was thrown: RenderSemanticsAnnotations object was given an infinite size during layout.
Another exception was thrown: RenderPointerListener object was given an infinite size during layout.
Another exception was thrown: RenderSemanticsGestureHandler object was given an infinite size during layout.
Another exception was thrown: RenderPointerListener object was given an infinite size during layout.
Another exception was thrown: _RenderScrollSemantics object was given an infinite size during layout.
Another exception was thrown: RenderRepaintBoundary object was given an infinite size during layout.
Another exception was thrown: RenderCustomPaint object was given an infinite size during layout.
Another exception was thrown: RenderMouseRegion object was given an infinite size during layout.
Another exception was thrown: RenderPointerListener object was given an infinite size during layout.
Another exception was thrown: RenderSemanticsGestureHandler object was given an infinite size during layout.
Another exception was thrown: RenderRepaintBoundary object was given an infinite size during layout.
Another exception was thrown: RenderPadding object was given an infinite size during layout.
Another exception was thrown: A RenderFlex overflowed by Infinity pixels on the bottom.
Another exception was thrown: A RenderFlex overflowed by 32 pixels on the bottom.

This is what I got:

[]

I was trying to achieve this design:

This is my code:

homepage.dart

import 'dart:core';
import 'package:flutter/material.dart';
import 'package:google_nav_bar/google_nav_bar.dart';
import 'package:pomodoro/5.hourglass_animation/countdown_timer/pomodoro_animation.dart';
import 'dart:async';

class HomePageTimerUI extends StatefulWidget {
  const HomePageTimerUI({Key? key}) : super(key: key);

  @override
  State<HomePageTimerUI> createState() => _HomePageTimerUIState();
}

class _HomePageTimerUIState extends State<HomePageTimerUI>
    with TickerProviderStateMixin {
  late TabController _tabController;

  late Timer timer;
  late AnimationController controller;

  String get countText {
    Duration count = controller.duration! * controller.value;
    return controller.isDismissed
        ? '${controller.duration!.inHours.toString().padLeft(2, '0')}:${(controller.duration!.inMinutes % 60).toString().padLeft(2, '0')}:${(controller.duration!.inSeconds % 60).toString().padLeft(2, '0')}'
        : '${count.inHours.toString().padLeft(2, '0')}:${(count.inMinutes % 60).toString().padLeft(2, '0')}:${(count.inSeconds % 60).toString().padLeft(2, '0')}';
  }

  @override
  void initState() {
    super.initState();
    _tabController = TabController(length: 3, vsync: this);
  }

  @override
  void dispose() {
    _tabController.dispose();
    super.dispose();
  }

  void notify() {
    if (countText == '00:00:00') {
      _tabController.animateTo(1, duration: const Duration(milliseconds: 300));
    }
  }

  @override
  Widget build(BuildContext context) {
    return SafeArea(
      child: Scaffold(
        appBar: PreferredSize(
          preferredSize: const Size.fromHeight(55),
          child: DefaultTabController(
            length: 3,
            child: Scaffold(
              appBar: AppBar(
                elevation: 0,
                backgroundColor: Colors.transparent,
                bottom: PreferredSize(
                  preferredSize: const Size.fromHeight(55),
                  child: Container(
                    color: Colors.transparent,
                    child: SafeArea(
                      child: Column(
                        children: <Widget>[
                          TabBar(
                              controller: _tabController,
                              indicator: const UnderlineTabIndicator(
                                  borderSide: BorderSide(
                                      color: Color(0xff3B3B3B), width: 4.0),
                                  insets:
                                      EdgeInsets.fromLTRB(12.0, 12.0, 12.0, 11.0)),
                              indicatorWeight: 15,
                              indicatorSize: TabBarIndicatorSize.label,
                              labelColor: const Color(0xff3B3B3B),
                              labelStyle: const TextStyle(
                                  fontSize: 12,
                                  letterSpacing: 1.3,
                                  fontWeight: FontWeight.w500),
                              unselectedLabelColor: const Color(0xffD7D7D7),
                              tabs: const [
                                 Tab(
                                  text: "POMODORO",
                                  icon: Icon(Icons.work_history, size: 40),
                                ),
                                 Tab(
                                  text: "SHORT BREAK",
                                  icon: Icon(Icons.ramen_dining, size: 40),
                                ),
                                 Tab(
                                  text: "LONG BREAK",
                                  icon: Icon(Icons.battery_charging_full_rounded,
                                      size: 40),
                                ),
                              ])
                        ],
                      ),
                    ),
                  ),
                ),
              ),
              body: TabBarView(
                controller: _tabController,
                children: <Widget>[
                  Center(
                    child: StartPomodoro(end: DateTime.now()),
                  ),
                  const Center(
                    child: Text('short break'),
                  ),
                  const Center(
                    child: Text('long break '),
                  ),
                ],
              ),
            ),
          ),
        ),
        body: Column(children: [
          SizedBox(height:  10,),
          StartPomodoro(end: DateTime.now())
        ]),
      ),
    );
  }
}

startpomodoro.dart

import 'dart:async';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:pomodoro/5.hourglass_animation/countdown_timer/responsive.dart';

class StartPomodoro extends StatefulWidget {
  const StartPomodoro({super.key, required this.end});

  final DateTime end;

  @override
  State<StartPomodoro> createState() => _StartPomodoroState();
}

class _StartPomodoroState extends State<StartPomodoro>
    with TickerProviderStateMixin {
  final now = DateTime.now();

  List<bool> isSelected = [true, false];
  late Timer timer;
  late AnimationController controller;

  String get countText {
    Duration count = controller.duration! * controller.value;
    return controller.isDismissed
        ? '${controller.duration!.inHours.toString().padLeft(2, '0')}:${(controller.duration!.inMinutes % 60).toString().padLeft(2, '0')}:${(controller.duration!.inSeconds % 60).toString().padLeft(2, '0')}'
        : '${count.inHours.toString().padLeft(2, '0')}:${(count.inMinutes % 60).toString().padLeft(2, '0')}:${(count.inSeconds % 60).toString().padLeft(2, '0')}';
  }

  double progress = 1.0;
  bool LongBreak = true;

  void notify() {
    if (countText == '00:00:00') {}
  }

  @override
  void initState() {
    super.initState();
    controller = AnimationController(
      vsync: this,
      duration: const Duration(seconds: 0),
    );
    controller.addListener(() {
      notify();
      if (controller.isAnimating) {
        setState(() {
          progress = controller.value;
        });
      } else {
        setState(() {
          progress = 1.0;
          LongBreak = true;
        });
      }
    });
  }

  @override
  void dispose() {
    controller.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return SafeArea(
      child: SingleChildScrollView(
        child: Scaffold(
          backgroundColor:
              LongBreak ? const Color(0xffD94530) : const Color(0xff6351c5),
          body: GestureDetector(
            onTap: () {
              if (controller.isDismissed) {
                showModalBottomSheet(
                  context: context,
                  builder: (context) => Container(
                    height: 300,
                    child: CupertinoTimerPicker(
                      initialTimerDuration: controller.duration!,
                      onTimerDurationChanged: (time) {
                        setState(() {
                          controller.duration = time;
                        });
                      },
                    ),
                  ),
                );
              }
            },
            child: AnimatedBuilder(
                animation: controller,
                builder: (context, child) {
                  return Stack(
                    children: <Widget>[
                      Align(
                        alignment: Alignment.bottomCenter,
                        child: Container(
                          color: const Color(0xffD94530),
                          height: controller.value *
                              MediaQuery.of(context).size.height,
                        ),
                      ),
                      Padding(
                        padding: const EdgeInsets.all(8.0),
                        child: Responsive(
                          child: SingleChildScrollView(
                            child: Column(
                              mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                              crossAxisAlignment: CrossAxisAlignment.center,
                              children: <Widget>[
                                Align(
                                  alignment: Alignment.bottomCenter,
                                  child: Align(
                                    alignment: FractionalOffset.bottomCenter,
                                    child: Container(
                                      width: MediaQuery.of(context).size.width,
                                      height: 210,
                                      decoration: const BoxDecoration(
                                        color:
                                            Color.fromARGB(255, 245, 245, 245),
                                      ),
                                      child: Container(
                                        padding: const EdgeInsets.all(20.0),
                                        child: Column(
                                          crossAxisAlignment:
                                              CrossAxisAlignment.start,
                                          children: [
                                            const Text(
                                              "Hyper-focused on... (+add task)",
                                              style: TextStyle(
                                                fontSize: 22.0,
                                                fontWeight: FontWeight.w500,
                                              ),
                                            ),
                                            const SizedBox(height: 16),
                                            Center(
                                              child: Column(
                                                mainAxisAlignment:
                                                    MainAxisAlignment.center,
                                                children: [
                                                  Row(
                                                    mainAxisAlignment:
                                                        MainAxisAlignment
                                                            .center,
                                                    crossAxisAlignment:
                                                        CrossAxisAlignment
                                                            .center,
                                                    children: [
                                                      Center(
                                                        child: Text(
                                                          countText,
                                                          style:
                                                              const TextStyle(
                                                            fontWeight:
                                                                FontWeight.w600,
                                                            letterSpacing: 4,
                                                            fontSize: 65.0,
                                                            color: Color(
                                                                0xff3B3B3B),
                                                          ),
                                                        ),
                                                      ),
                                                    ],
                                                  ),
                                                  Row(
                                                    mainAxisAlignment:
                                                        MainAxisAlignment
                                                            .center,
                                                    crossAxisAlignment:
                                                        CrossAxisAlignment
                                                            .center,
                                                    children: const [
                                                      Center(
                                                        child: Text(
                                                          '      Hours      Minutes      Seconds      ',
                                                          style: TextStyle(
                                                            fontWeight:
                                                                FontWeight.w500,
                                                            letterSpacing: 2,
                                                            fontSize: 20.0,
                                                            color: Color(
                                                                0xff3B3B3B),
                                                          ),
                                                        ),
                                                      ),
                                                    ],
                                                  ),
                                                ],
                                              ),
                                            ),
                                          ],
                                        ),
                                      ),

                                    ),

                                  ),

                                ),
                                SizedBox(height: 150,),
                                 //Spacer(),
                                Column(
                                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                                  crossAxisAlignment:
                                      CrossAxisAlignment.stretch,
                                  children: [
                                    AnimatedBuilder(
                                        animation: controller,
                                        builder: (context, child) {
                                          return const Padding(
                                            padding: EdgeInsets.symmetric(
                                                vertical: 2.0,
                                                horizontal: 0.0),
                                          );
                                        }),
                                    AnimatedBuilder(
                                        animation: controller,
                                        builder: (context, child) {
                                          return Padding(
                                            padding:
                                                const EdgeInsets.symmetric(
                                                    vertical: 2.0,
                                                    horizontal: 0.0),
                                            child:
                                                Container(
                                                  color: const Color(0xffFAFAFA),
                                                  width: MediaQuery.of(context).size.width,
                                                  child: FloatingActionButton.extended(
                                                      backgroundColor:
                                                          const Color(
                                                              0xffFAFAFA),
                                                      onPressed: () {
                                                        if (controller
                                                            .isAnimating) {
                                                          controller.stop();
                                                          setState(() {
                                                            LongBreak = false;
                                                          });
                                                        } else {
                                                          controller.reverse(
                                                              from: controller
                                                                          .value ==
                                                                      0
                                                                  ? 1.0
                                                                  : controller
                                                                      .value);
                                                          setState(() {
                                                            LongBreak = false;
                                                          });
                                                        }
                                                      },
                                                      icon: Icon(
                                                        controller.isAnimating
                                                            ? Icons.pause
                                                            : Icons.play_arrow,
                                                        color: const Color(
                                                            0xff3B3B3B),
                                                      ),
                                                      label: Text(
                                                        controller.isAnimating
                                                            ? "Pause"
                                                            : "Start",
                                                        style: const TextStyle(
                                                            color: Color(
                                                                0xff3B3B3B)),
                                                      )),
                                                ),
                                          );
                                        }),
                                  ],
                                ),

                               ],
                            ),
                          ),
                        ),
                      ),
                    ],
                  );
                }),
          ),
        ),
      ),
    );
  }

  AnimationController _buildClockAnimation(TickerProvider tickerProvider) {
    return AnimationController(
      vsync: tickerProvider,
      duration: const Duration(milliseconds: 750),
    );
  }

  void _animateLeftDigit(
    int prev,
    int current,
    AnimationController controller,
  ) {
    final prevFirstDigit = (prev / 10).floor();
    final currentFirstDigit = (current / 10).floor();
    if (prevFirstDigit != currentFirstDigit) {
      controller.forward();
    }
  }
}

I tried to wrap the scaffold widget to SinglChildScrollView to solve the error but no luck, How can I achieve the second screenshot?

Thank you for any help you can offer


问:
Problems setting correct timeinterval for Expo local Notifications on iOS
I'm setting a notification in React Native for Android and iOS - the code below works fine for Android, but for iOS the timestamp comes out very strange - and the notification does not show as a result

Code (directly from https://docs.expo.dev/versions/latest/sdk/notifications/):

```<code> async function setNewReminder() {

    const trigger = new Date(Date.now() + 60 * 60 * 1000);
    trigger.setMinutes(0);
    trigger.setSeconds(0);

    const identifier = await Notifications.scheduleNotificationAsync({
            content: {
                title: 'Happy new hour!',
            },
          trigger,
    });
    // notificationID.current = `${identifier}`
  }
</code>```

See the iOS timestamp below (trigger.seconds):

LOG  [
  {
    "content": {
      "attachments": [Array],
      "badge": null,
      "body": null,
      "categoryIdentifier": "",
      "data": [Object],
      "launchImageName": "",
      "sound": null,
      "subtitle": null,
      "summaryArgument": "",
      "summaryArgumentCount": 0,
      "targetContentIdentifier": null,
      "threadIdentifier": "",
      "title": "Testing trigger"
    },
    "identifier": "b247c5c6-c6ff-4cbf-a794-3c81dbe7886f",
    "trigger": {
      "class": "UNTimeIntervalNotificationTrigger",
      "repeats": false,
      "seconds": 14489.274579048157,
      "type": "timeInterval"
    }
  }
]
```

When I try the trigger as a non specific date, e.g. 20 seconds in the future, the notification triggers properly.

Could anyone tell me what I'm doing wrong with this timestamp?

Body:
I'm setting a notification in React Native for Android and iOS - the code below works fine for Android, but for iOS the timestamp comes out very strange - and the notification does not show as a result

Code (directly from https://docs.expo.dev/versions/latest/sdk/notifications/):

 async function setNewReminder() {

    const trigger = new Date(Date.now() + 60 * 60 * 1000);
    trigger.setMinutes(0);
    trigger.setSeconds(0);

    const identifier = await Notifications.scheduleNotificationAsync({
            content: {
                title: 'Happy new hour!',
            },
          trigger,
    });
    // notificationID.current = `${identifier}`
  }

See the iOS timestamp below (trigger.seconds):

LOG  [
  {
    "content": {
      "attachments": [Array],
      "badge": null,
      "body": null,
      "categoryIdentifier": "",
      "data": [Object],
      "launchImageName": "",
      "sound": null,
      "subtitle": null,
      "summaryArgument": "",
      "summaryArgumentCount": 0,
      "targetContentIdentifier": null,
      "threadIdentifier": "",
      "title": "Testing trigger"
    },
    "identifier": "b247c5c6-c6ff-4cbf-a794-3c81dbe7886f",
    "trigger": {
      "class": "UNTimeIntervalNotificationTrigger",
      "repeats": false,
      "seconds": 14489.274579048157,
      "type": "timeInterval"
    }
  }
]

When I try the trigger as a non specific date, e.g. 20 seconds in the future, the notification triggers properly.

Could anyone tell me what I'm doing wrong with this timestamp?


问:
PHP optimize woocommerce "Add To Cart" functionality Resource Consumption (DB and RAM) in order to solve 502 Error
I have custom logic that used $woocommerce->cart->add_to_cart($productId, $quantity, $variationId, $attributes) inside for loop (80-250 products), I noticed the add_to_cart usage a lot of DB and RAM Resources, and after that server lost connection and return 502 error.

I increased the PHP timeout in htaccess and in php.ini but still server lost connection and return a 502 error.

The server is shared hosting (4 CPU, 2G RAM, PHP 7.4 ), LiteSpeed.

How I can optimize $woocommerce->cart->add_to_cart in order to solve 502 Error?


问:
What is the Center of a Rectangle2D?
If I have a rectangle with a width of 4 pixels shouldn't its center be at pixel 1.5?

Rectangle2D.Float.getCenterX() returns 2, leaving two pixels to the left of center and one pixel to the right. For the record:

```<code>import java.awt.geom.Rectangle2D;

public class CenterXcoDemo2
{
    public static void main(String[] args)
    {
        Rectangle2D rect    = new Rectangle2D.Float( 0, 0, 4, 4 );
        System.out.println( rect.getCenterX() );
    }
}
</code>```

Title: What is the Center of a Rectangle2D?

Body:
If I have a rectangle with a width of 4 pixels shouldn't its center be at pixel 1.5?

Rectangle2D.Float.getCenterX() returns 2, leaving two pixels to the left of center and one pixel to the right. For the record:

import java.awt.geom.Rectangle2D;

public class CenterXcoDemo2
{
    public static void main(String[] args)
    {
        Rectangle2D rect    = new Rectangle2D.Float( 0, 0, 4, 4 );
        System.out.println( rect.getCenterX() );
    }
}


问:
Creating a Vewport3D camera in XAML is not working
I was trying to create a new Perspective Camera using C# and apply that to my XAML code, but for some reason, when I do it directly in XAML it works fine, but when I do it in C#, it does not work.

Here is the code I got from Microsoft's demonstration: (https://learn.microsoft.com/en-us/dotnet/desktop/wpf/graphics-multimedia/how-to-create-a-3-d-scene?view=netframeworkdesktop-4.8)

```<code><Viewport3D
                        Name="SceneViewViewport"
                        Width="954"
                        Height="659">

                        <!-- Defines the camera used to view the 3D object. -->
                        <Viewport3D.Camera>
                            <PerspectiveCamera Position="0,0,2" LookDirection="0,0,-1" FieldOfView="60" />
                        </Viewport3D.Camera>

                        <!-- The ModelVisual3D children contain the 3D models -->
                        <Viewport3D.Children>

                            <!-- This ModelVisual3D defines the light cast in the scene. Without light, the 3D
                 object cannot be seen. Also, the direction of the lights affect shadowing. If desired,
                 you can create multiple lights with different colors that shine from different directions. -->
                            <ModelVisual3D>
                                <ModelVisual3D.Content>
                                    <DirectionalLight Color="#FFFFFF" Direction="-0.612372,-0.5,-0.612372" />
                                </ModelVisual3D.Content>
                            </ModelVisual3D>
                            <ModelVisual3D>
                                <ModelVisual3D.Content>
                                    <GeometryModel3D>

                                        <!-- The geometry specifies the shape of the 3D plane. In this sample, a flat sheet is created. -->
                                        <GeometryModel3D.Geometry>
                                            <MeshGeometry3D
                     TriangleIndices="0,1,2 3,4,5 "
                     Normals="0,0,1 0,0,1 0,0,1 0,0,1 0,0,1 0,0,1 "
                     TextureCoordinates="0,0 1,0 1,1 1,1 0,1 0,0 "
                     Positions="-0.5,-0.5,0.5 0.5,-0.5,0.5 0.5,0.5,0.5 0.5,0.5,0.5 -0.5,0.5,0.5 -0.5,-0.5,0.5 " />
                                        </GeometryModel3D.Geometry>

                                        <!-- The material specifies the material applied to the 3D object. In this sample a linear gradient
                       covers the surface of the 3D object.-->
                                        <GeometryModel3D.Material>
                                            <MaterialGroup>
                                                <DiffuseMaterial>
                                                    <DiffuseMaterial.Brush>
                                                        <LinearGradientBrush StartPoint="0,0.5" EndPoint="1,0.5">
                                                            <LinearGradientBrush.GradientStops>
                                                                <GradientStop Color="Yellow" Offset="0" />
                                                                <GradientStop Color="Red" Offset="0.25" />
                                                                <GradientStop Color="Blue" Offset="0.75" />
                                                                <GradientStop Color="LimeGreen" Offset="1" />
                                                            </LinearGradientBrush.GradientStops>
                                                        </LinearGradientBrush>
                                                    </DiffuseMaterial.Brush>
                                                </DiffuseMaterial>
                                            </MaterialGroup>
                                        </GeometryModel3D.Material>

                                        <!-- Apply a transform to the object. In this sample, a rotation transform is applied, rendering the
                       3D object rotated. -->
                                        <GeometryModel3D.Transform>
                                            <RotateTransform3D>
                                                <RotateTransform3D.Rotation>
                                                    <AxisAngleRotation3D Axis="0,3,0" Angle="40" />
                                                </RotateTransform3D.Rotation>
                                            </RotateTransform3D>
                                        </GeometryModel3D.Transform>
                                    </GeometryModel3D>
                                </ModelVisual3D.Content>
                            </ModelVisual3D>
                        </Viewport3D.Children>

                    </Viewport3D>
</code>```

Works fine.

Now I put the same code (C#) version, also from Microsoft's demo, and it does not work.

```<code>viewport = (Viewport3D)FindName("SceneViewViewport");

            SceneViewWidth = (float)viewport.Width;
            SceneViewHeight = (float)viewport.Height;

            Setup();
</code>```
```<code>void Setup()
        {
            // Declare scene objects.
            Viewport3D myViewport3D = viewport;
            Model3DGroup myModel3DGroup = new Model3DGroup();
            GeometryModel3D myGeometryModel = new GeometryModel3D();
            ModelVisual3D myModelVisual3D = new ModelVisual3D();
            // Defines the camera used to view the 3D object. In order to view the 3D object,
            // the camera must be positioned and pointed such that the object is within view
            // of the camera.
            PerspectiveCamera myPCamera = new PerspectiveCamera();

            // Specify where in the 3D scene the camera is.
            myPCamera.Position = new Point3D(0, 0, 2);

            // Specify the direction that the camera is pointing.
            myPCamera.LookDirection = new Vector3D(0, 0, -1);

            // Define camera's horizontal field of view in degrees.
            myPCamera.FieldOfView = 70;

            // Asign the camera to the viewport
            viewport.Camera = myPCamera;

            // Define the lights cast in the scene. Without light, the 3D object cannot
            // be seen. Note: to illuminate an object from additional directions, create
            // additional lights.
            DirectionalLight myDirectionalLight = new DirectionalLight();
            myDirectionalLight.Color = Colors.White;
            myDirectionalLight.Direction = new Vector3D(-0.61, -0.5, -0.61);

            myModel3DGroup.Children.Add(myDirectionalLight);

            // The geometry specifes the shape of the 3D plane. In this sample, a flat sheet
            // is created.
            MeshGeometry3D myMeshGeometry3D = new MeshGeometry3D();

            // Create a collection of normal vectors for the MeshGeometry3D.
            Vector3DCollection myNormalCollection = new Vector3DCollection();
            myNormalCollection.Add(new Vector3D(0, 0, 1));
            myNormalCollection.Add(new Vector3D(0, 0, 1));
            myNormalCollection.Add(new Vector3D(0, 0, 1));
            myNormalCollection.Add(new Vector3D(0, 0, 1));
            myNormalCollection.Add(new Vector3D(0, 0, 1));
            myNormalCollection.Add(new Vector3D(0, 0, 1));
            myMeshGeometry3D.Normals = myNormalCollection;

            // Create a collection of vertex positions for the MeshGeometry3D.
            Point3DCollection myPositionCollection = new Point3DCollection();
            myPositionCollection.Add(new Point3D(-0.5, -0.5, 0.5));
            myPositionCollection.Add(new Point3D(0.5, -0.5, 0.5));
            myPositionCollection.Add(new Point3D(0.5, 0.5, 0.5));
            myPositionCollection.Add(new Point3D(0.5, 0.5, 0.5));
            myPositionCollection.Add(new Point3D(-0.5, 0.5, 0.5));
            myPositionCollection.Add(new Point3D(-0.5, -0.5, 0.5));
            myMeshGeometry3D.Positions = myPositionCollection;

            // Create a collection of texture coordinates for the MeshGeometry3D.
            PointCollection myTextureCoordinatesCollection = new PointCollection();
            myTextureCoordinatesCollection.Add(new Point(0, 0));
            myTextureCoordinatesCollection.Add(new Point(1, 0));
            myTextureCoordinatesCollection.Add(new Point(1, 1));
            myTextureCoordinatesCollection.Add(new Point(1, 1));
            myTextureCoordinatesCollection.Add(new Point(0, 1));
            myTextureCoordinatesCollection.Add(new Point(0, 0));
            myMeshGeometry3D.TextureCoordinates = myTextureCoordinatesCollection;

            // Create a collection of triangle indices for the MeshGeometry3D.
            Int32Collection myTriangleIndicesCollection = new Int32Collection();
            myTriangleIndicesCollection.Add(0);
            myTriangleIndicesCollection.Add(1);
            myTriangleIndicesCollection.Add(2);
            myTriangleIndicesCollection.Add(3);
            myTriangleIndicesCollection.Add(4);
            myTriangleIndicesCollection.Add(5);
            myMeshGeometry3D.TriangleIndices = myTriangleIndicesCollection;

            // Apply the mesh to the geometry model.
            myGeometryModel.Geometry = myMeshGeometry3D;

            // The material specifies the material applied to the 3D object. In this sample a
            // linear gradient covers the surface of the 3D object.

            // Create a horizontal linear gradient with four stops.
            LinearGradientBrush myHorizontalGradient = new LinearGradientBrush();
            myHorizontalGradient.StartPoint = new Point(0, 0.5);
            myHorizontalGradient.EndPoint = new Point(1, 0.5);
            myHorizontalGradient.GradientStops.Add(new GradientStop(Colors.Yellow, 0.0));
            myHorizontalGradient.GradientStops.Add(new GradientStop(Colors.Red, 0.25));
            myHorizontalGradient.GradientStops.Add(new GradientStop(Colors.Blue, 0.75));
            myHorizontalGradient.GradientStops.Add(new GradientStop(Colors.LimeGreen, 1.0));

            // Define material and apply to the mesh geometries.
            DiffuseMaterial myMaterial = new DiffuseMaterial(myHorizontalGradient);
            myGeometryModel.Material = myMaterial;

            // Apply a transform to the object. In this sample, a rotation transform is applied,
            // rendering the 3D object rotated.
            RotateTransform3D myRotateTransform3D = new RotateTransform3D();
            AxisAngleRotation3D myAxisAngleRotation3d = new AxisAngleRotation3D();
            myAxisAngleRotation3d.Axis = new Vector3D(0, 3, 0);
            myAxisAngleRotation3d.Angle = 40;
            myRotateTransform3D.Rotation = myAxisAngleRotation3d;
            myGeometryModel.Transform = myRotateTransform3D;

            // Add the geometry model to the model group.
            myModel3DGroup.Children.Add(myGeometryModel);

            // Add the group of models to the ModelVisual3d.
            myModelVisual3D.Content = myModel3DGroup;

            //
            myViewport3D.Children.Add(myModelVisual3D);

            // Apply the viewport to the page so it will be rendered.

            this.Content = myViewport3D;
        }
</code>```

I tried using Microsoft's example, found here: "https://learn.microsoft.com/en-us/dotnet/desktop/wpf/graphics-multimedia/how-to-create-a-3-d-scene?view=netframeworkdesktop-4.8", but nothing changed. The XAML version works as expected, but the C# version only displays an empty screen.

Body:
I was trying to create a new Perspective Camera using C# and apply that to my XAML code, but for some reason, when I do it directly in XAML it works fine, but when I do it in C#, it does not work.

Here is the code I got from Microsoft's demonstration: (https://learn.microsoft.com/en-us/dotnet/desktop/wpf/graphics-multimedia/how-to-create-a-3-d-scene?view=netframeworkdesktop-4.8)

<Viewport3D
                        Name="SceneViewViewport"
                        Width="954"
                        Height="659">

                        <Viewport3D.Camera>
                            <PerspectiveCamera Position="0,0,2" LookDirection="0,0,-1" FieldOfView="60" />
                        </Viewport3D.Camera>

                        <Viewport3D.Children>

                            <ModelVisual3D>
                                <ModelVisual3D.Content>
                                    <DirectionalLight Color="#FFFFFF" Direction="-0.612372,-0.5,-0.612372" />
                                </ModelVisual3D.Content>
                            </ModelVisual3D>
                            <ModelVisual3D>
                                <ModelVisual3D.Content>
                                    <GeometryModel3D>

                                        <GeometryModel3D.Geometry>
                                            <MeshGeometry3D
                     TriangleIndices="0,1,2 3,4,5 "
                     Normals="0,0,1 0,0,1 0,0,1 0,0,1 0,0,1 0,0,1 "
                     TextureCoordinates="0,0 1,0 1,1 1,1 0,1 0,0 "
                     Positions="-0.5,-0.5,0.5 0.5,-0.5,0.5 0.5,0.5,0.5 0.5,0.5,0.5 -0.5,0.5,0.5 -0.5,-0.5,0.5 " />
                                        </GeometryModel3D.Geometry>

                                        <GeometryModel3D.Material>
                                            <MaterialGroup>
                                                <DiffuseMaterial>
                                                    <DiffuseMaterial.Brush>
                                                        <LinearGradientBrush StartPoint="0,0.5" EndPoint="1,0.5">
                                                            <LinearGradientBrush.GradientStops>
                                                                <GradientStop Color="Yellow" Offset="0" />
                                                                <GradientStop Color="Red" Offset="0.25" />
                                                                <GradientStop Color="Blue" Offset="0.75" />
                                                                <GradientStop Color="LimeGreen" Offset="1" />
                                                            </LinearGradientBrush.GradientStops>
                                                        </LinearGradientBrush>
                                                    </DiffuseMaterial.Brush>
                                                </DiffuseMaterial>
                                            </MaterialGroup>
                                        </GeometryModel3D.Material>

                                        <GeometryModel3D.Transform>
                                            <RotateTransform3D>
                                                <RotateTransform3D.Rotation>
                                                    <AxisAngleRotation3D Axis="0,3,0" Angle="40" />
                                                </RotateTransform3D.Rotation>
                                            </RotateTransform3D>
                                        </GeometryModel3D.Transform>
                                    </GeometryModel3D>
                                </ModelVisual3D.Content>
                            </ModelVisual3D>
                        </Viewport3D.Children>

                    </Viewport3D>

Works fine.

Now I put the same code (C#) version, also from Microsoft's demo, and it does not work.

viewport = (Viewport3D)FindName("SceneViewViewport");

            SceneViewWidth = (float)viewport.Width;
            SceneViewHeight = (float)viewport.Height;

            Setup();

void Setup()
        {
            // Declare scene objects.
            Viewport3D myViewport3D = viewport;
            Model3DGroup myModel3DGroup = new Model3DGroup();
            GeometryModel3D myGeometryModel = new GeometryModel3D();
            ModelVisual3D myModelVisual3D = new ModelVisual3D();
            // Defines the camera used to view the 3D object. In order to view the 3D object,
            // the camera must be positioned and pointed such that the object is within view
            // of the camera.
            PerspectiveCamera myPCamera = new PerspectiveCamera();

            // Specify where in the 3D scene the camera is.
            myPCamera.Position = new Point3D(0, 0, 2);

            // Specify the direction that the camera is pointing.
            myPCamera.LookDirection = new Vector3D(0, 0, -1);

            // Define camera's horizontal field of view in degrees.
            myPCamera.FieldOfView = 70;

            // Asign the camera to the viewport
            viewport.Camera = myPCamera;

            // Define the lights cast in the scene. Without light, the 3D object cannot
            // be seen. Note: to illuminate an object from additional directions, create
            // additional lights.
            DirectionalLight myDirectionalLight = new DirectionalLight();
            myDirectionalLight.Color = Colors.White;
            myDirectionalLight.Direction = new Vector3D(-0.61, -0.5, -0.61);

            myModel3DGroup.Children.Add(myDirectionalLight);

            // The geometry specifes the shape of the 3D plane. In this sample, a flat sheet
            // is created.
            MeshGeometry3D myMeshGeometry3D = new MeshGeometry3D();

            // Create a collection of normal vectors for the MeshGeometry3D.
            Vector3DCollection myNormalCollection = new Vector3DCollection();
            myNormalCollection.Add(new Vector3D(0, 0, 1));
            myNormalCollection.Add(new Vector3D(0, 0, 1));
            myNormalCollection.Add(new Vector3D(0, 0, 1));
            myNormalCollection.Add(new Vector3D(0, 0, 1));
            myNormalCollection.Add(new Vector3D(0, 0, 1));
            myNormalCollection.Add(new Vector3D(0, 0, 1));
            myMeshGeometry3D.Normals = myNormalCollection;

            // Create a collection of vertex positions for the MeshGeometry3D.
            Point3DCollection myPositionCollection = new Point3DCollection();
            myPositionCollection.Add(new Point3D(-0.5, -0.5, 0.5));
            myPositionCollection.Add(new Point3D(0.5, -0.5, 0.5));
            myPositionCollection.Add(new Point3D(0.5, 0.5, 0.5));
            myPositionCollection.Add(new Point3D(0.5, 0.5, 0.5));
            myPositionCollection.Add(new Point3D(-0.5, 0.5, 0.5));
            myPositionCollection.Add(new Point3D(-0.5, -0.5, 0.5));
            myMeshGeometry3D.Positions = myPositionCollection;

            // Create a collection of texture coordinates for the MeshGeometry3D.
            PointCollection myTextureCoordinatesCollection = new PointCollection();
            myTextureCoordinatesCollection.Add(new Point(0, 0));
            myTextureCoordinatesCollection.Add(new Point(1, 0));
            myTextureCoordinatesCollection.Add(new Point(1, 1));
            myTextureCoordinatesCollection.Add(new Point(1, 1));
            myTextureCoordinatesCollection.Add(new Point(0, 1));
            myTextureCoordinatesCollection.Add(new Point(0, 0));
            myMeshGeometry3D.TextureCoordinates = myTextureCoordinatesCollection;

            // Create a collection of triangle indices for the MeshGeometry3D.
            Int32Collection myTriangleIndicesCollection = new Int32Collection();
            myTriangleIndicesCollection.Add(0);
            myTriangleIndicesCollection.Add(1);
            myTriangleIndicesCollection.Add(2);
            myTriangleIndicesCollection.Add(3);
            myTriangleIndicesCollection.Add(4);
            myTriangleIndicesCollection.Add(5);
            myMeshGeometry3D.TriangleIndices = myTriangleIndicesCollection;

            // Apply the mesh to the geometry model.
            myGeometryModel.Geometry = myMeshGeometry3D;

            // The material specifies the material applied to the 3D object. In this sample a
            // linear gradient covers the surface of the 3D object.

            // Create a horizontal linear gradient with four stops.
            LinearGradientBrush myHorizontalGradient = new LinearGradientBrush();
            myHorizontalGradient.StartPoint = new Point(0, 0.5);
            myHorizontalGradient.EndPoint = new Point(1, 0.5);
            myHorizontalGradient.GradientStops.Add(new GradientStop(Colors.Yellow, 0.0));
            myHorizontalGradient.GradientStops.Add(new GradientStop(Colors.Red, 0.25));
            myHorizontalGradient.GradientStops.Add(new GradientStop(Colors.Blue, 0.75));
            myHorizontalGradient.GradientStops.Add(new GradientStop(Colors.LimeGreen, 1.0));

            // Define material and apply to the mesh geometries.
            DiffuseMaterial myMaterial = new DiffuseMaterial(myHorizontalGradient);
            myGeometryModel.Material = myMaterial;

            // Apply a transform to the object. In this sample, a rotation transform is applied,
            // rendering the 3D object rotated.
            RotateTransform3D myRotateTransform3D = new RotateTransform3D();
            AxisAngleRotation3D myAxisAngleRotation3d = new AxisAngleRotation3D();
            myAxisAngleRotation3d.Axis = new Vector3D(0, 3, 0);
            myAxisAngleRotation3d.Angle = 40;
            myRotateTransform3D.Rotation = myAxisAngleRotation3d;
            myGeometryModel.Transform = myRotateTransform3D;

            // Add the geometry model to the model group.
            myModel3DGroup.Children.Add(myGeometryModel);

            // Add the group of models to the ModelVisual3d.
            myModelVisual3D.Content = myModel3DGroup;

            //
            myViewport3D.Children.Add(myModelVisual3D);

            // Apply the viewport to the page so it will be rendered.

            this.Content = myViewport3D;
        }

I tried using Microsoft's example, found here: "https://learn.microsoft.com/en-us/dotnet/desktop/wpf/graphics-multimedia/how-to-create-a-3-d-scene?view=netframeworkdesktop-4.8", but nothing changed. The XAML version works as expected, but the C# version only displays an empty screen.


问:
Why is this axios get request not being entered from within this while loop?
```<code>app.get('/api/fighter', (req,res) => {

let userAgent = "";
userAgent = randomUseragent.getRandom();
//set req headers to random user agent
req.headers['user-agent'] = userAgent;

    //for now i will hard code what the req query params would be
    let firstName = "jon"
    let lastName = "jones"
    //step 1 search for fighter to retreive fighter profile url
    let initalUrlToScrape = 'https://www.sherdog.com/stats/fightfinder?SearchTxt='+firstName+'+'+lastName+'&weight=&association=';
    //add more headers to the request
    request(initalUrlToScrape,{headers:{ 'User-Agent': req.headers['user-agent']}},(error, response, html) => {
        if (!error && response.statusCode == 200) {
            const $ = cheerio.load(html);

            let fighterNameFound = $('html.light .new_table tr:nth-child(even):not(.table_head)');
            let fighterNameIndex = $('.new_table td a');
            let nameToCompare = firstName + ' ' + lastName;
            let fighterFound = false;
            let next=0;
            let page = 1;
            while (!fighterFound) {

                console.log(fighterNameIndex[next].children[0].data.toLowerCase());

                if(fighterNameIndex[next].children[0].data.toLowerCase() == nameToCompare.toLowerCase()){
                    fighterNameIndex = fighterNameIndex[next];
                    console.log(fighterNameIndex.attribs.href);
                    break;
                }else if(next==fighterNameFound.length-1){
                    next=0;
                   //axios request for next page. update the fighterNameIndex and fighterNameFound
                     axios({
                        url: 'https://www.sherdog.com/stats/fightfinder?association=&weightclass=&SearchTxt=jon+jones&page=2',
                      }).then(function (response) {
                        response.data.pipe(fs.createWriteStream('ada_lovelace.jpg'))
                      })
                    .catch(error3 => {
                        console.log(error3);
                    });
                }else{
                    next++;
                }
            }
            // for(let x = 0; x < fighterNameFound.length; x++){
            //     // console.log(fighterNameIndex.attribs.href);
            //     // fighterNameIndex = fighterNameIndex[x];
            //     // console.log(fighterNameIndex.attribs.href);
            //     console.log(fighterNameIndex[x].children[0].data.toLowerCase());
            //     //check if the fighter name found is the same as the one we are looking for
            //     if(fighterNameIndex[x].children[0].data.toLowerCase() == nameToCompare.toLowerCase()){
            //         fighterNameIndex = fighterNameIndex[x];
            //         console.log(fighterNameIndex.attribs.href);
            //         break;
            //     }else if(x==fighterNameFound.length-1){

            //     }
            // }
            //  enhancedProfileUrlFoundOnPage = fighterNameIndex.attribs.href;

            //step 2 navigate to fighter profile url and scrape everything
            let profileUrlToScrape = 'https://www.sherdog.com'+enhancedProfileUrlFoundOnPage
             request(profileUrlToScrape, {headers:{ 'User-Agent': req.headers['user-agent']}},(error1, response1, html2) => {

                if (!error1 && response1.statusCode == 200) {
                    const $ = cheerio.load(html2);

                    //find element
                    const fullName = $('.fighter-title h1 .fn');
                    const nickName = $('.fighter-title h1 .nickname, .fighter-title h1 .nickname_empty');
                    const birthCountry = $('.fighter-title .birthplace strong');
                    const fightingOutOf = $('span.locality');
                    const flag = $('.fighter-title .big_flag');
                    const wins = $('div.winloses.win span');
                    const losses = $('div.winloses.lose span');
                    const weightClass = $('body > div.wrapper > div.inner-wrapper > div.col-left > div > section:nth-child(3) > div > div.fighter-info > div.fighter-right > div.fighter-data > div.bio-holder > div > a');

                    //scrape the data
                    const fullnameValue = $(fullName).text();
                    const nickNameValue = $(nickName).text();
                    const birthCountryValue = $(birthCountry).text();
                    const fightingOutOfValue = $(fightingOutOf).text();
                    const flagValue = $(flag).attr('src');
                    const winsValue = $(wins).text();
                    const lossesValue = $(losses).text();
                    const weightClassValue = $(weightClass).text();

                  //push data found to global array
                  data.push({
                    name: fullnameValue,
                    nickname: nickNameValue,
                    country: birthCountryValue,
                    fightingOutOf: fightingOutOfValue,
                    flag: "https://www.sherdog.com"+flagValue,
                    wins: winsValue.replace("Wins",""),
                    losses: lossesValue.replace("Losses",""),
                    weightClass: weightClassValue

                  })
                  res.send(data);
                }
                });
        }
        });

});
</code>```

I am creating a web scraping and i need this while loop present because i need to check each page until the fighter i want is found. In the while loop, as soon as the current array data element is finished i need to request the next page, but the request is skipped. Why is the axios request ignored?

Body:
app.get('/api/fighter', (req,res) => {

let userAgent = "";
userAgent = randomUseragent.getRandom();
//set req headers to random user agent
req.headers['user-agent'] = userAgent;

    //for now i will hard code what the req query params would be
    let firstName = "jon"
    let lastName = "jones"
    //step 1 search for fighter to retreive fighter profile url
    let initalUrlToScrape = 'https://www.sherdog.com/stats/fightfinder?SearchTxt='+firstName+'+'+lastName+'&weight=&association=';
    //add more headers to the request
    request(initalUrlToScrape,{headers:{ 'User-Agent': req.headers['user-agent']}},(error, response, html) => {
        if (!error && response.statusCode == 200) {
            const $ = cheerio.load(html);

            let fighterNameFound = $('html.light .new_table tr:nth-child(even):not(.table_head)');
            let fighterNameIndex = $('.new_table td a');
            let nameToCompare = firstName + ' ' + lastName;
            let fighterFound = false;
            let next=0;
            let page = 1;
            while (!fighterFound) {

                console.log(fighterNameIndex[next].children[0].data.toLowerCase());

                if(fighterNameIndex[next].children[0].data.toLowerCase() == nameToCompare.toLowerCase()){
                    fighterNameIndex = fighterNameIndex[next];
                    console.log(fighterNameIndex.attribs.href);
                    break;
                }else if(next==fighterNameFound.length-1){
                    next=0;
                   //axios request for next page. update the fighterNameIndex and fighterNameFound
                     axios({
                        url: 'https://www.sherdog.com/stats/fightfinder?association=&weightclass=&SearchTxt=jon+jones&page=2',
                      }).then(function (response) {
                        response.data.pipe(fs.createWriteStream('ada_lovelace.jpg'))
                      })
                    .catch(error3 => {
                        console.log(error3);
                    });
                }else{
                    next++;
                }
            }
            // for(let x = 0; x < fighterNameFound.length; x++){
            //     // console.log(fighterNameIndex.attribs.href);
            //     // fighterNameIndex = fighterNameIndex[x];
            //     // console.log(fighterNameIndex.attribs.href);
            //     console.log(fighterNameIndex[x].children[0].data.toLowerCase());
            //     //check if the fighter name found is the same as the one we are looking for
            //     if(fighterNameIndex[x].children[0].data.toLowerCase() == nameToCompare.toLowerCase()){
            //         fighterNameIndex = fighterNameIndex[x];
            //         console.log(fighterNameIndex.attribs.href);
            //         break;
            //     }else if(x==fighterNameFound.length-1){

            //     }
            // }
            //  enhancedProfileUrlFoundOnPage = fighterNameIndex.attribs.href;

            //step 2 navigate to fighter profile url and scrape everything
            let profileUrlToScrape = 'https://www.sherdog.com'+enhancedProfileUrlFoundOnPage
             request(profileUrlToScrape, {headers:{ 'User-Agent': req.headers['user-agent']}},(error1, response1, html2) => {

                if (!error1 && response1.statusCode == 200) {
                    const $ = cheerio.load(html2);

                    //find element
                    const fullName = $('.fighter-title h1 .fn');
                    const nickName = $('.fighter-title h1 .nickname, .fighter-title h1 .nickname_empty');
                    const birthCountry = $('.fighter-title .birthplace strong');
                    const fightingOutOf = $('span.locality');
                    const flag = $('.fighter-title .big_flag');
                    const wins = $('div.winloses.win span');
                    const losses = $('div.winloses.lose span');
                    const weightClass = $('body > div.wrapper > div.inner-wrapper > div.col-left > div > section:nth-child(3) > div > div.fighter-info > div.fighter-right > div.fighter-data > div.bio-holder > div > a');

                    //scrape the data
                    const fullnameValue = $(fullName).text();
                    const nickNameValue = $(nickName).text();
                    const birthCountryValue = $(birthCountry).text();
                    const fightingOutOfValue = $(fightingOutOf).text();
                    const flagValue = $(flag).attr('src');
                    const winsValue = $(wins).text();
                    const lossesValue = $(losses).text();
                    const weightClassValue = $(weightClass).text();

                  //push data found to global array
                  data.push({
                    name: fullnameValue,
                    nickname: nickNameValue,
                    country: birthCountryValue,
                    fightingOutOf: fightingOutOfValue,
                    flag: "https://www.sherdog.com"+flagValue,
                    wins: winsValue.replace("Wins",""),
                    losses: lossesValue.replace("Losses",""),
                    weightClass: weightClassValue

                  })
                  res.send(data);
                }
                });
        }
        });

});

I am creating a web scraping and i need this while loop present because i need to check each page until the fighter i want is found. In the while loop, as soon as the current array data element is finished i need to request the next page, but the request is skipped. Why is the axios request ignored?


问:
Deploy SQL Server Authentication DB to Azure
I recently deployed a .net web api to Azure as a "Web App" using VS Community 2022. Now I need to deploy the sql server authentication db so that I can auth users and create JWT tokens.

The problem is, I can't find how to do this...

I would expect to see "Publish to Azure" for the database, or even better, publish the database with the api as it is a "Connected Service".

So now I have a live api that's inaccessible because I can't authorize users.

Am I missing a setting somewhere that says (wishful thinking) "Publish connected services with project?"

I created a database in Azure, but I can't find out how to publish my auth db (localdb) to it. I would expect a simple "Publish to Azure" when I right click it in the sql server object explorer, but it's not there.

Any help would be greatly appreciated.


问:
updating QByteArray contents via reinterpret_cast
Is it possible to update the contents of a QByteArray using reinterpret_cast or some other QT aliasing trick?

I have a data struct member that is wrapped in a std::unique_ptr (it is typically 12 bytes in length however sometimes it can be larger due to an array trailing field) - I need to be able to update the contents of this struct.

Due to the implicit sharing concepts in QByteArray this is tricky and I cannot find the right set of operations to mutate the underlying mpLastTxHeader member.  The member is declared as:

```<code>//! Last sent header - used as template to send next headers
//! as it should always contain the last sent sequence number & timestamp
std::unique_ptr<QByteArray> mpLastTxHeader;
</code>```

The member function that uses this QByteArray member variable currently makes a deep copy of the previous contents of the QByteArray (it happens to contain an RTP header with the last sent sequence # so this is why I need to mutate and save it before the next use).  Ideally when I call 'rtpHeader->setSeqNum' the underlying mpLastTxHeader should be updated but I do not know how to do this.

```<code>// make a deep copy of the last sent RTP header (containing sequence# & timestamp)
const auto rawHeader = std::make_unique<QByteArray>(*mpLastTxHeader);
const auto rtpHeader = reinterpret_cast<rtp_hdr_t*>(rawHeader->data());
// create the RTP datagrams with incrementing sequence numbers and timestamps
while ((mpAudioCache->size() - mLastReadPos) >= gRAWAudioSize) {
    // reset the marker bit so it doesn't keep getting transmitted
    rtpHeader->m = 0u;
    // increment the sequence numbers
    rtpHeader->setSeqNum(rtpHeader->getSeqNum() + 1);
    // increment timestamp
    rtpHeader->setTimestamp(rtpHeader->getTimestamp() + mTSIncrement);
    // prefix the next block with the next rtp header
    QByteArrayList temp = {
        *rawHeader,
        mpAudioCache->read(gRAWAudioSize)
    };
    mTXBufferList.emplace_back(temp.join());
    mLastReadPos += gRAWAudioSize;
}
</code>```

Body:
Is it possible to update the contents of a QByteArray using reinterpret_cast or some other QT aliasing trick?

I have a data struct member that is wrapped in a std::unique_ptr (it is typically 12 bytes in length however sometimes it can be larger due to an array trailing field) - I need to be able to update the contents of this struct.

Due to the implicit sharing concepts in QByteArray this is tricky and I cannot find the right set of operations to mutate the underlying mpLastTxHeader member.  The member is declared as:

//! Last sent header - used as template to send next headers
//! as it should always contain the last sent sequence number & timestamp
std::unique_ptr<QByteArray> mpLastTxHeader;

The member function that uses this QByteArray member variable currently makes a deep copy of the previous contents of the QByteArray (it happens to contain an RTP header with the last sent sequence # so this is why I need to mutate and save it before the next use).  Ideally when I call 'rtpHeader->setSeqNum' the underlying mpLastTxHeader should be updated but I do not know how to do this.

// make a deep copy of the last sent RTP header (containing sequence# & timestamp)
const auto rawHeader = std::make_unique<QByteArray>(*mpLastTxHeader);
const auto rtpHeader = reinterpret_cast<rtp_hdr_t*>(rawHeader->data());
// create the RTP datagrams with incrementing sequence numbers and timestamps
while ((mpAudioCache->size() - mLastReadPos) >= gRAWAudioSize) {
    // reset the marker bit so it doesn't keep getting transmitted
    rtpHeader->m = 0u;
    // increment the sequence numbers
    rtpHeader->setSeqNum(rtpHeader->getSeqNum() + 1);
    // increment timestamp
    rtpHeader->setTimestamp(rtpHeader->getTimestamp() + mTSIncrement);
    // prefix the next block with the next rtp header
    QByteArrayList temp = {
        *rawHeader,
        mpAudioCache->read(gRAWAudioSize)
    };
    mTXBufferList.emplace_back(temp.join());
    mLastReadPos += gRAWAudioSize;
}


问:
Jupyter Notebook 500 : Internal Server Error
I can't open my jupyter notebook somebody could help me ?

I can't open my jupyter notebook somebody could help me ?


问:
PHP Rest API Structure
Im new to PHP, im building out a Rest Api for a mobile app. There are alot of different ways people implement a Rest API from what ive seen in Youtube and web searches. I have built quite a bit of the api and im starting to see the cracks in the structure of the application specifically around GET, POST, PUT and DELETE. Every call i have is POST because i always need a method name. Sample below (this is one of the smaller ones)

What i need to know specifically is, show each function require its own php file? Seems odd to me because there would be alot of duplicated code but im thinking now that this would aid me in using the correct http methods.

Thanks for looking :)

`

```<code><?php

// headers
header('Access-Control-Allow-Origin: *');
header('Content-Type: application/json');

include_once ("../../config/Database.php");
include_once ("../../config/Mailer.php");
include_once ("../../config/CustomResponseHandler.php");
include_once ("../../models/AdCampaign.php");

$database      = new Database();
$db            = $database->connect();
$adCampaign    = new AdCampaign($db);

$POST = json_decode(file_get_contents('php://input'), true);

switch($POST["method"])
{
    case "DeleteAdCampaign":
        echo $adCampaign->DeleteAdCampaign($POST["adcampaignid"]);
        break;
    case "UpdateAdCampaign":
        echo $adCampaign->UpdateAdCampaign($POST["storeid"], $POST["adcampaignid"], $POST["description"], $POST["imageurl"],
                                           $POST["b64image"], $POST["mimetype"]);
        break;
    case "CreateAdCampaign":
        echo $adCampaign->CreateAdCampaign($POST["storeid"], $POST["description"], $POST["validfrom"], $POST["validto"],
                                           $POST["b64image"], $POST["mimetype"]);
        break;
    case "GetStoreAdCampaigns":
        echo $adCampaign->GetStoreAdCampaigns($POST["storeid"]);
        break;
    case "GetAllAdCampaigns":
        echo $adCampaign->GetAllAdCampaigns();
        break;

    default:
        $response = new CustomResponseHandler();
        $response->returnErrorResponse('','No method found');
        break;
}

?>
</code>```

`

looking for advice, code works fine but may be a poor approach

Title: PHP Rest API Structure

Body:
Im new to PHP, im building out a Rest Api for a mobile app. There are alot of different ways people implement a Rest API from what ive seen in Youtube and web searches. I have built quite a bit of the api and im starting to see the cracks in the structure of the application specifically around GET, POST, PUT and DELETE. Every call i have is POST because i always need a method name. Sample below (this is one of the smaller ones)

What i need to know specifically is, show each function require its own php file? Seems odd to me because there would be alot of duplicated code but im thinking now that this would aid me in using the correct http methods.

Thanks for looking :)

`

<?php

// headers
header('Access-Control-Allow-Origin: *');
header('Content-Type: application/json');

include_once ("../../config/Database.php");
include_once ("../../config/Mailer.php");
include_once ("../../config/CustomResponseHandler.php");
include_once ("../../models/AdCampaign.php");

$database      = new Database();
$db            = $database->connect();
$adCampaign    = new AdCampaign($db);

$POST = json_decode(file_get_contents('php://input'), true);

switch($POST["method"])
{
    case "DeleteAdCampaign":
        echo $adCampaign->DeleteAdCampaign($POST["adcampaignid"]);
        break;
    case "UpdateAdCampaign":
        echo $adCampaign->UpdateAdCampaign($POST["storeid"], $POST["adcampaignid"], $POST["description"], $POST["imageurl"],
                                           $POST["b64image"], $POST["mimetype"]);
        break;
    case "CreateAdCampaign":
        echo $adCampaign->CreateAdCampaign($POST["storeid"], $POST["description"], $POST["validfrom"], $POST["validto"],
                                           $POST["b64image"], $POST["mimetype"]);
        break;
    case "GetStoreAdCampaigns":
        echo $adCampaign->GetStoreAdCampaigns($POST["storeid"]);
        break;
    case "GetAllAdCampaigns":
        echo $adCampaign->GetAllAdCampaigns();
        break;

    default:
        $response = new CustomResponseHandler();
        $response->returnErrorResponse('','No method found');
        break;
}

?>

`

looking for advice, code works fine but may be a poor approach


问:
How to fix undefined references after libtorch custom build?
I've built libtorch from source (as shared objects) with the purpose of slimming it down, but now when I try to link it into an application, I get this:

```<code>error: undefined reference to 'std::invalid_argument::invalid_argument(char const*)'
...
error: undefined reference to 'torch::serialize::OutputArchive::write(std::string const&, at::Tensor const&, bool)'
</code>```

This doesn't happen when I link with the corresponding pre-built libtorch instead. My application links with -lstdc++ -ltorch -ltorch_cpu -lc10. I've noticed that

Some of these undefined references are from std, others from torch. This surprises me - how is it possible I'm missing stuff from std when I'm linking in stdc++?

The pre-built libtorch includes several .so's I don't have, such as glom. None of these seem necessary to my application though, and I don't need to link them in when using pre-built libtorch.

So what might be the reason I'm getting these undefined references, or how can I go about debugging it?

Body:
I've built libtorch from source (as shared objects) with the purpose of slimming it down, but now when I try to link it into an application, I get this:

error: undefined reference to 'std::invalid_argument::invalid_argument(char const*)'
...
error: undefined reference to 'torch::serialize::OutputArchive::write(std::string const&, at::Tensor const&, bool)'

This doesn't happen when I link with the corresponding pre-built libtorch instead. My application links with -lstdc++ -ltorch -ltorch_cpu -lc10. I've noticed that

Some of these undefined references are from std, others from torch. This surprises me - how is it possible I'm missing stuff from std when I'm linking in stdc++?

The pre-built libtorch includes several .so's I don't have, such as glom. None of these seem necessary to my application though, and I don't need to link them in when using pre-built libtorch.

So what might be the reason I'm getting these undefined references, or how can I go about debugging it?