问:
How do i evenly position widgets or items in SliverAppBar Flutter?
I have a SliverAppBar and i am trying to position three items in a row:

User Profile Picture

User Account Information

Notification bar widget

But whenever i try to add the User Account Information Widget in the row i either get a render flex error or it gets positions incorrectly and get out of sight.

This is what i've tried and i will give the code snippets my SliverAppBar.

Using a flexibleSpace with a FlexibleSpaceBar() widget and wrapping the title in a row where i then instantiate the 3 widgets.

HomeAccountPicture(),
HomeAccountDetails(),
NotificationsButtonWidget(),

as the child.

I made sure the respective widgets are just wrapped in 'Containers()`

This is my Sliver App Snippet

```<code>class HomeView extends GetView<HomeController> {
  @override
  Widget build(BuildContext context) {
    controller.initScrollController();
    return WillPopScope(
      onWillPop: Helper().onWillPop,
      child: Scaffold(
        body: RefreshIndicator(
            onRefresh: () async {
              Get.find<LaravelApiClient>().forceRefresh();
              controller.refreshHome(showMessage: true);
              Get.find<LaravelApiClient>().unForceRefresh();
            },
            child: CustomScrollView(
              physics: const AlwaysScrollableScrollPhysics(),
              controller: controller.scrollController,
              shrinkWrap: false,
              slivers: <Widget>[
                SliverAppBar(
                  backgroundColor: Color(0xffFFFFFF),
                  expandedHeight: MediaQuery.of(context).size.height * 0.25,
                  elevation: 0.5,
                  //pinned: true,
                  floating: false,
                  iconTheme: IconThemeData(color: Get.theme.primaryColor),
                  centerTitle: true,
                  flexibleSpace: FlexibleSpaceBar(
                    title: Row(
                      crossAxisAlignment: CrossAxisAlignment.center,
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      mainAxisSize: MainAxisSize.max,
                      children: [
                        HomeAccountPicture(),
                        HomeAccountDetails(),
                        NotificationsButtonWidget(),
                      ],
                    ),
                  ),
                  automaticallyImplyLeading: false,

                ),
                SliverToBoxAdapter(
                  child: Wrap(
                    children: [
                      BookingsListWidget(),
                    ],
                  ),
                ),
              ],
            )),
      ),
    );
  }
}

</code>```

This is my expectation

This is what i get

Body:
I have a SliverAppBar and i am trying to position three items in a row:

User Profile Picture

User Account Information

Notification bar widget

But whenever i try to add the User Account Information Widget in the row i either get a render flex error or it gets positions incorrectly and get out of sight.

This is what i've tried and i will give the code snippets my SliverAppBar.

Using a flexibleSpace with a FlexibleSpaceBar() widget and wrapping the title in a row where i then instantiate the 3 widgets.

HomeAccountPicture(),
HomeAccountDetails(),
NotificationsButtonWidget(),

as the child.

I made sure the respective widgets are just wrapped in 'Containers()`

This is my Sliver App Snippet

class HomeView extends GetView<HomeController> {
  @override
  Widget build(BuildContext context) {
    controller.initScrollController();
    return WillPopScope(
      onWillPop: Helper().onWillPop,
      child: Scaffold(
        body: RefreshIndicator(
            onRefresh: () async {
              Get.find<LaravelApiClient>().forceRefresh();
              controller.refreshHome(showMessage: true);
              Get.find<LaravelApiClient>().unForceRefresh();
            },
            child: CustomScrollView(
              physics: const AlwaysScrollableScrollPhysics(),
              controller: controller.scrollController,
              shrinkWrap: false,
              slivers: <Widget>[
                SliverAppBar(
                  backgroundColor: Color(0xffFFFFFF),
                  expandedHeight: MediaQuery.of(context).size.height * 0.25,
                  elevation: 0.5,
                  //pinned: true,
                  floating: false,
                  iconTheme: IconThemeData(color: Get.theme.primaryColor),
                  centerTitle: true,
                  flexibleSpace: FlexibleSpaceBar(
                    title: Row(
                      crossAxisAlignment: CrossAxisAlignment.center,
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      mainAxisSize: MainAxisSize.max,
                      children: [
                        HomeAccountPicture(),
                        HomeAccountDetails(),
                        NotificationsButtonWidget(),
                      ],
                    ),
                  ),
                  automaticallyImplyLeading: false,

                ),
                SliverToBoxAdapter(
                  child: Wrap(
                    children: [
                      BookingsListWidget(),
                    ],
                  ),
                ),
              ],
            )),
      ),
    );
  }
}

This is my expectation

This is what i get


来源: stackexchange

问:
Should you unsubscribe from static self events?
I have multiple MacroPanels which are custom UI elements, I wanted that at a given time only a single one could be active (indicating that a macro is loaded to a hotkey), regardless of the current UI window.

```<code>    internal MacroPanel()
    {
        InitializeComponent();

        MacroPanel.Selected += MacroPanel_Selected;
        this.Disposed += MacroPanel_Disposed;
    }

    private void MacroPanel_Disposed(object? sender, EventArgs e)
    {
        MacroPanel.Selected -= MacroPanel_Selected;
        this.Disposed -= MacroPanel_Disposed;
    }

    private void MacroPanel_Selected(object? sender, EventArgs e)
    {
        if (this == sender)
            return;

        this.BackColor = Color.Yellow;
    }

    internal void SelectPanel()
    {
        this.BackColor = Color.Orange;
        Selected?.Invoke(this, EventArgs.Empty);
    }
</code>```

I achieved the desired behaviour by having a static event inside the MacroPanel that every Macro panel instance listens to.

I know that subscribing to a static event can cause memory leaks.

The question is should MacroPanel instance unsubscribe from its own static
event after disposal?

Would it cause memory leaks or other issues if
I would not unsubscribe from the Selected event?

Is subscribing to the Disposed event a proper way to achieve this or is ther any other
probably more beneficial way?

ContentLicense: CC BY-SA 4.0

Body:
I have multiple MacroPanels which are custom UI elements, I wanted that at a given time only a single one could be active (indicating that a macro is loaded to a hotkey), regardless of the current UI window.

    internal MacroPanel()
    {
        InitializeComponent();

        MacroPanel.Selected += MacroPanel_Selected;
        this.Disposed += MacroPanel_Disposed;
    }

    private void MacroPanel_Disposed(object? sender, EventArgs e)
    {
        MacroPanel.Selected -= MacroPanel_Selected;
        this.Disposed -= MacroPanel_Disposed;
    }

    private void MacroPanel_Selected(object? sender, EventArgs e)
    {
        if (this == sender)
            return;

        this.BackColor = Color.Yellow;
    }

    internal void SelectPanel()
    {
        this.BackColor = Color.Orange;
        Selected?.Invoke(this, EventArgs.Empty);
    }

I achieved the desired behaviour by having a static event inside the MacroPanel that every Macro panel instance listens to.

I know that subscribing to a static event can cause memory leaks.

The question is should MacroPanel instance unsubscribe from its own static
event after disposal?

Would it cause memory leaks or other issues if
I would not unsubscribe from the Selected event?

Is subscribing to the Disposed event a proper way to achieve this or is ther any other
probably more beneficial way?


问:
Run Python script from VBA: Run time 91. Object variable ... not set
The script works. I want to call it from VBA passing two variables, the URL and file name.

I get

run time 91. Object variable or With block variable not set

in the shell line.

This is the URL containing the table to download:

https://jde.erpref.com/?schema=920&table=F4311

This is my VBA code:

Sub Dw_table()

    Dim url As String
    Dim file_name As String
    Dim PythonExe, PythonScript As String
    Dim objShell As Object

    ' Prompt the user to enter the URL and file name
    url = InputBox("Enter the URL of the table:")
    file_name = InputBox("Enter the file name:")

     'paths for exe and script
    PythonExe = """C:\Users\Mario    Rdz\AppData\Local\Programs\Python\Python311\python.exe"""
    PythonScript = "C:\Users\Mario Rdz\PycharmProjects\HelloWorld\JDEREF.py"

    objShell.Run PythonExe & PythonScript & url & file_name

End Sub
```
<p>This is my Python code:</p>
```from bs4 import BeautifulSoup
import requests
import openpyxl
import sys

# Passed arguments from excel VBA
url = sys.argv[1]
file_name = sys.argv[2]`

page = requests.get(url)

#Parse the HTML content of the webpage
soup = BeautifulSoup(page.content, "html.parser")

#Find the table with the ID "columnselectcollection"
table = soup.find(id="columnselectcollection")

#Create a new workbook and add a worksheet
your text`workbook = openpyxl.Workbook()
worksheet = workbook.active

#Create a new workbook and add a worksheet
workbook = openpyxl.Workbook()
worksheet = workbook.active

#Set the values for column headers
worksheet.cell(row=1, column=2).value = "Seq"
worksheet.cell(row=1, column=3).value = "Field"
worksheet.cell(row=1, column=4).value = "Description"
worksheet.cell(row=1, column=5).value = "Data type"
worksheet.cell(row=1, column=6).value = "Edit Type type"
worksheet.cell(row=1, column=7).value = "Lenght"
worksheet.cell(row=1, column=8).value = "Decimals"

#Iterate over the rows of the table and write the data to the worksheet
for row in table.find_all('tr'):
    row_data = []
    for cell in row.find_all('td'):
        row_data.append(cell.text)
    worksheet.append(row_data)

#delete row 2 which is blanks and delete unuseful column 9
worksheet.delete_cols(9)
worksheet.delete_rows(2)

#Save the workbook to an Excel file
workbook.save(f"{file_name}.xlsx")
```

Body:
The script works. I want to call it from VBA passing two variables, the URL and file name.

I get

run time 91. Object variable or With block variable not set

in the shell line.

This is the URL containing the table to download:

https://jde.erpref.com/?schema=920&table=F4311

This is my VBA code:

Sub Dw_table()

    Dim url As String
    Dim file_name As String
    Dim PythonExe, PythonScript As String
    Dim objShell As Object

    ' Prompt the user to enter the URL and file name
    url = InputBox("Enter the URL of the table:")
    file_name = InputBox("Enter the file name:")

     'paths for exe and script
    PythonExe = """C:\Users\Mario    Rdz\AppData\Local\Programs\Python\Python311\python.exe"""
    PythonScript = "C:\Users\Mario Rdz\PycharmProjects\HelloWorld\JDEREF.py"

    objShell.Run PythonExe & PythonScript & url & file_name

End Sub

This is my Python code:

from bs4 import BeautifulSoup
import requests
import openpyxl
import sys

# Passed arguments from excel VBA
url = sys.argv[1]
file_name = sys.argv[2]`

page = requests.get(url)

#Parse the HTML content of the webpage
soup = BeautifulSoup(page.content, "html.parser")

#Find the table with the ID "columnselectcollection"
table = soup.find(id="columnselectcollection")

#Create a new workbook and add a worksheet
your text`workbook = openpyxl.Workbook()
worksheet = workbook.active

#Create a new workbook and add a worksheet
workbook = openpyxl.Workbook()
worksheet = workbook.active

#Set the values for column headers
worksheet.cell(row=1, column=2).value = "Seq"
worksheet.cell(row=1, column=3).value = "Field"
worksheet.cell(row=1, column=4).value = "Description"
worksheet.cell(row=1, column=5).value = "Data type"
worksheet.cell(row=1, column=6).value = "Edit Type type"
worksheet.cell(row=1, column=7).value = "Lenght"
worksheet.cell(row=1, column=8).value = "Decimals"

#Iterate over the rows of the table and write the data to the worksheet
for row in table.find_all('tr'):
    row_data = []
    for cell in row.find_all('td'):
        row_data.append(cell.text)
    worksheet.append(row_data)

#delete row 2 which is blanks and delete unuseful column 9
worksheet.delete_cols(9)
worksheet.delete_rows(2)

#Save the workbook to an Excel file
workbook.save(f"{file_name}.xlsx")


问:
Unable to get rid of top margin in Bootstrap5 container
I have a simple div container block as below block that leaves a large gap at the top.

```<code><div class="container">
...
</div>
</code>```

I have tried adding different margin options such as mt-0, even mt-n5 (for negative margin), etc. but nothing seems to get rid of the top margin

```<code><div class="container mt-0">
...
</div>
</code>```

Body:
I have a simple div container block as below block that leaves a large gap at the top.

...

I have tried adding different margin options such as mt-0, even mt-n5 (for negative margin), etc. but nothing seems to get rid of the top margin

...


问:
How do I get network resources without SMB1 please?
My network resource programme, using WNetOpenEnumW and WNetEnumResourceW, only works with SMB1 enabled. As this is not the default on W11, it falls over in a heap (or a stack, or something)…
What will do the same job of finding network resources with SMB1 disabled please?
And do you have any ideas on how to get resources which are on the network but do not have the same workgroup (eg Seagate disc units, which are seen OK with Explorer, but not with the above system calls)?
Chester

Haven't found anything to try apart from those system calls, which don't work without SMB1.


问:
Hook the socket connection of an application on windows/macos
I have an application that when it is launched, opens a socket connection to a certain server. I want to change the IP and Port of that socket connection to redirect the connection to my proxy server, in order to retrieve all the packets.

I want to do it on both macos and windows. I know there is function in MacOs that allows to modify the memory of a process so the question would be, how to know where is the socket structure in the memory when the application is running and when do I know when the socket connection is starting ?

And on Windows, I heard about DLL ? But I am really lost on it and I dont really understand it.

Any thoughts ?


问:
Parser error when trying to compile Flashswap smart contract for Binance Smart Chain
I'm getting an error when trying to compile my own custom Flashswap smart contract. After compiling using Hardhat on VS Code, it throws up an error for the Pancakefactory script.

```<code>// SPDX-License-Identifier: MIT

pragma solidity >=0.8.0;

interface IPancakeFactory {
    event PairCreated(address indexed token0, address indexed token1, address pair, uint);

    function feeTo() external view returns (address);
    function feeToSetter() external view returns (address);

    function getPair(address tokenA, address tokenB) external view returns (address pair);
    function allPairs(uint) external view returns (address pair);
    function allPairsLength() external view returns (uint);

    function createPair(address tokenA, address tokenB) external returns (address pair);

    function setFeeTo(address) external;
require(msg.sender == feeToSetter, 'Pancakeswap: FORBIDDEN');
        feeTo = _feeTo;
    }

    function setFeeToSetter(address) external;
require(msg.sender == feeToSetter, 'Pancakeswap: FORBIDDEN');
        feeToSetter = _feeToSetter;
    }
}
</code>```

The error is for the line beneath function setFeeTo(address) external;. The parser error that's thrown up is "Expected identifier but got ( ".

Am I writing the line require(msg.sender == feeToSetter, 'Pancakeswap: FORBIDDEN'); inncorrectly? Is there something missing here or do I need to change where the brackets are?

Body:
I'm getting an error when trying to compile my own custom Flashswap smart contract. After compiling using Hardhat on VS Code, it throws up an error for the Pancakefactory script.

// SPDX-License-Identifier: MIT

pragma solidity >=0.8.0;

interface IPancakeFactory {
    event PairCreated(address indexed token0, address indexed token1, address pair, uint);

    function feeTo() external view returns (address);
    function feeToSetter() external view returns (address);

    function getPair(address tokenA, address tokenB) external view returns (address pair);
    function allPairs(uint) external view returns (address pair);
    function allPairsLength() external view returns (uint);

    function createPair(address tokenA, address tokenB) external returns (address pair);

    function setFeeTo(address) external;
require(msg.sender == feeToSetter, 'Pancakeswap: FORBIDDEN');
        feeTo = _feeTo;
    }

    function setFeeToSetter(address) external;
require(msg.sender == feeToSetter, 'Pancakeswap: FORBIDDEN');
        feeToSetter = _feeToSetter;
    }
}

The error is for the line beneath function setFeeTo(address) external;. The parser error that's thrown up is "Expected identifier but got ( ".

Am I writing the line require(msg.sender == feeToSetter, 'Pancakeswap: FORBIDDEN'); inncorrectly? Is there something missing here or do I need to change where the brackets are?


问:
Stretching problem of UV mapping of the plane with perspective transformations
I'm only learning UV-mapping. I'm learning it in Blender. And I have a question.
If you create a plane (blender will automatically create UV for it) and apply perspective transformations on it (like scaling one of its edges), this will lead to such a problem:
stretching problem of affine texture mapping from wiki

So, how can I achieve the correct version without subdivision or remapping the UV? I've tried using subdivision, and it works perfect (especially if you have one face for one pixel), but in more complex models this will lead to unnecessary complexity. So I'm still searching for the answer. I'm also using texture with resolution of 8x8 pixels and closest interpolation, so simple remapping isn't the answer and I also want my UV to be a perfect square.


问:
Vonage Api Doesn't work, I'm not receiving the sms and it don't return nothing--laravel
I want to allow users to edit phone number in my laravel application, obv making a phone number check with vonage api, I set the vonage keys in .env and I've created a notification following a tutorial and I set method updatephonenumber in a controller

This is notification:

```<code>class OTPNotification extends Notification
{
    use Queueable;

     /**
     * @var $otp
     */
    protected $otp;

    /**
     * Create a new notification instance.
     *
     * @return void
     */
    public function __construct($otp)
    {
        $this->otp = $otp;
    }

    /**
     * Get the notification's delivery channels.
     *
     * @param  mixed  $notifiable
     * @return array
     */
    public function via($notifiable)
    {
        return ['vonage'];
    }

    /**
     * Get the mail representation of the notification.
     *
     * @param  mixed  $notifiable
     * @return \Illuminate\Notifications\Messages\MailMessage
     */
    public function toMail($notifiable)
    {
   /*    return (new MailMessage)
        ->greeting($this->project['greeting'])
        ->line($this->project['body'])
        //->action($this->project['actionText'], $this->project['actionURL'])
       ->line($this->project['thanks']); */
    }

    /**
     * Get the array representation of the notification.
     *
     * @param  mixed  $notifiable
     * @return array
     */
    public function toArray($notifiable)
    {
        return [
            //
        ];
    }

    public function toVonage($notifiable)
    {
        return (new VonageMessage())
        ->from('Help4you')
        ->content('Your verification code is' . $this->otp);
    }
}
</code>```
```<code>  public function updatePhoneNumber(Request $request)
    {
        $basic  = new \Vonage\Client\Credentials\Basic("redacted", "redacted");
        $client = new \Vonage\Client($basic);
        $credentials = $request->only('email',  'password');
        try {
            if (!$token = Auth::attempt($credentials)) {
                return response()->json('credenziali errate');
                //  $errorrMSG=Lang::get('auth.credential_incorrect');
                // return CustomResponse::setFailResponse($errorrMSG, Response::HTTP_NOT_ACCEPTABLE, []);
            }
        } catch (JWTException $e) {
            return response()->json('login fallito');
        }
        $request->validate([
            'telefono' => 'required|unique:users,telefono'
        ]);

        $user = $request->input('telefono');
        $otp = VerificationCode::create([
            'user_id' => Auth::user()->id,
            'otp' => rand(10000, 99999),
            'expired_at' => Carbon::now()->addMinutes(10)
        ]);
         $message = Notification::route($user, $user)->notify(new OTPNotification($otp->otp));
          return $message;

</code>```

when I run api on postman I not receive messages, and $message is empty

Body:
I want to allow users to edit phone number in my laravel application, obv making a phone number check with vonage api, I set the vonage keys in .env and I've created a notification following a tutorial and I set method updatephonenumber in a controller

This is notification:

class OTPNotification extends Notification
{
    use Queueable;

     /**
     * @var $otp
     */
    protected $otp;

    /**
     * Create a new notification instance.
     *
     * @return void
     */
    public function __construct($otp)
    {
        $this->otp = $otp;
    }

    /**
     * Get the notification's delivery channels.
     *
     * @param  mixed  $notifiable
     * @return array
     */
    public function via($notifiable)
    {
        return ['vonage'];
    }

    /**
     * Get the mail representation of the notification.
     *
     * @param  mixed  $notifiable
     * @return \Illuminate\Notifications\Messages\MailMessage
     */
    public function toMail($notifiable)
    {
   /*    return (new MailMessage)
        ->greeting($this->project['greeting'])
        ->line($this->project['body'])
        //->action($this->project['actionText'], $this->project['actionURL'])
       ->line($this->project['thanks']); */
    }

    /**
     * Get the array representation of the notification.
     *
     * @param  mixed  $notifiable
     * @return array
     */
    public function toArray($notifiable)
    {
        return [
            //
        ];
    }

    public function toVonage($notifiable)
    {
        return (new VonageMessage())
        ->from('Help4you')
        ->content('Your verification code is' . $this->otp);
    }
}

  public function updatePhoneNumber(Request $request)
    {
        $basic  = new \Vonage\Client\Credentials\Basic("redacted", "redacted");
        $client = new \Vonage\Client($basic);
        $credentials = $request->only('email',  'password');
        try {
            if (!$token = Auth::attempt($credentials)) {
                return response()->json('credenziali errate');
                //  $errorrMSG=Lang::get('auth.credential_incorrect');
                // return CustomResponse::setFailResponse($errorrMSG, Response::HTTP_NOT_ACCEPTABLE, []);
            }
        } catch (JWTException $e) {
            return response()->json('login fallito');
        }
        $request->validate([
            'telefono' => 'required|unique:users,telefono'
        ]);

        $user = $request->input('telefono');
        $otp = VerificationCode::create([
            'user_id' => Auth::user()->id,
            'otp' => rand(10000, 99999),
            'expired_at' => Carbon::now()->addMinutes(10)
        ]);
         $message = Notification::route($user, $user)->notify(new OTPNotification($otp->otp));
          return $message;

when I run api on postman I not receive messages, and $message is empty


问:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/http/HttpEntity
I am using eclipse luna which is an out-of-date version. I'm having an issue with setting up selenium.I'm using vanilla java, no marven or anything like that.

```<code>public static WebDriver driver;
    public static void main(String[] args) throws JSONException{

             System.setProperty("webdriver.chrome.driver", "C://Program Files//chromedriver//chromedriver.exe");

             WebDriver driver = new ChromeDriver();

             driver.get("www.google.com");
        }
</code>```

I imported JAR files instead of copying in selenium stand-alone. also tried switching the setproperty and driver but it return: java.lang.IllegalStateException: The path to the chromedriver executable must be set by the webdriver.chrome.driver system property

Body:
I am using eclipse luna which is an out-of-date version. I'm having an issue with setting up selenium.I'm using vanilla java, no marven or anything like that.

public static WebDriver driver;
    public static void main(String[] args) throws JSONException{

             System.setProperty("webdriver.chrome.driver", "C://Program Files//chromedriver//chromedriver.exe");

             WebDriver driver = new ChromeDriver();

             driver.get("www.google.com");
        }

I imported JAR files instead of copying in selenium stand-alone. also tried switching the setproperty and driver but it return: java.lang.IllegalStateException: The path to the chromedriver executable must be set by the webdriver.chrome.driver system property


问:
Flutter widget testing: Button tap won't work
I'm using widget testing in Flutter. I'm using the game template from here

https://github.com/flutter/samples/tree/main/game_template

and my test doesn't work as expected:

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

import 'package:escape_team/main.dart';

void main() {
  testWidgets('Main menu can be started', (WidgetTester tester) async {
    // Build our app and trigger a frame.
    await tester.pumpWidget(MyApp(
      inAppPurchaseController: null,
      playerProgressPersistence: null,
      settingsPersistence: null,
    ));

    expect(find.text('PLAY'), findsOneWidget);
    await tester.tap(find.text('PLAY'));
    await tester.pumpAndSettle();

    expect(find.text('MISSION SELECT'), findsOneWidget);
  });
}
</code>```

results in:

```<code>00:00 +0: Main menu can be started
══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════
The following TestFailure was thrown running a test:
Expected: exactly one matching node in the widget tree
  Actual: _TextFinder:<zero widgets with text "MISSION SELECT" (ignoring offstage widgets)>
   Which: means none were found but one was expected
</code>```

However, when I manually tap the 'PLAY' button in my app, the "MISSION SELECT" screen appears. How can I find out what's going on - and wrong?

UPDATE:

I did some more research, I guess it's caused by a JSON that's being loaded by my app before the main menu is started.

```<code>missionLoader
                  .readJson('assets/json/missions_en.json')
                  .then((value) => GoRouter.of(context).go('/play'));
</code>```

This calls

```<code>final String response = await rootBundle.loadString(jsonFile);
</code>```

... and rootBundle file loading isn't supported out of the box in Flutter tests, as I see it?

I tried adding

```<code>WidgetsFlutterBinding.ensureInitialized();
</code>```

to my app's main() method, as well as to the test's main method, but both did not help. Any further leads would be greatly appreciated! Thank you!

Body:
I'm using widget testing in Flutter. I'm using the game template from here

https://github.com/flutter/samples/tree/main/game_template

and my test doesn't work as expected:

import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';

import 'package:escape_team/main.dart';

void main() {
  testWidgets('Main menu can be started', (WidgetTester tester) async {
    // Build our app and trigger a frame.
    await tester.pumpWidget(MyApp(
      inAppPurchaseController: null,
      playerProgressPersistence: null,
      settingsPersistence: null,
    ));

    expect(find.text('PLAY'), findsOneWidget);
    await tester.tap(find.text('PLAY'));
    await tester.pumpAndSettle();

    expect(find.text('MISSION SELECT'), findsOneWidget);
  });
}

results in:

00:00 +0: Main menu can be started
══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════
The following TestFailure was thrown running a test:
Expected: exactly one matching node in the widget tree
  Actual: _TextFinder:<zero widgets with text "MISSION SELECT" (ignoring offstage widgets)>
   Which: means none were found but one was expected

However, when I manually tap the 'PLAY' button in my app, the "MISSION SELECT" screen appears. How can I find out what's going on - and wrong?

UPDATE:

I did some more research, I guess it's caused by a JSON that's being loaded by my app before the main menu is started.

missionLoader
                  .readJson('assets/json/missions_en.json')
                  .then((value) => GoRouter.of(context).go('/play'));

This calls

final String response = await rootBundle.loadString(jsonFile);

... and rootBundle file loading isn't supported out of the box in Flutter tests, as I see it?

I tried adding

WidgetsFlutterBinding.ensureInitialized();

to my app's main() method, as well as to the test's main method, but both did not help. Any further leads would be greatly appreciated! Thank you!


问:
64 bit mode pixel outputting does not work (mov es, ax) vm crashes
So I switched directly to 64-bit mode because it was easier. But I want to output pixels, and the command move es, ax crashes my computer (a key part of the pixel output code). And I realized that there are traces of paging at the start of the code, so now I'm totally confused. I'm trying to make it BIOS-free, multi-platform, and basically compatible with everything. And if the code already has paging set up for me, that would make my life a lot easier. Then I just need to make it compatible with all monitors, have it detect the keyboard and mouse, and I'm all set. (I already programmed a language for it i just didn't want to include it because it's long.)
So here is the code:

```<code>%define FREE_SPACE 0x9000

ORG 0x7C00
[bits 16]
   mov ax,115h ; init 800x600 32bit
   mov     bx,ax
   mov     ax,4f02h
   int     16

Main:
   jmp 0x0000:.FlushCS

.FlushCS:
   xor ax, ax

   mov ss, ax

   mov sp, Main

   mov ds, ax
   mov es, ax
   mov fs, ax
   mov gs, ax
   cld

   call CheckCPU
   jc nlm

   mov edi, FREE_SPACE

   jmp SwitchToLongMode

nlm:

BITS 16

%define PAGE_PRESENT    (1 << 0)
%define PAGE_WRITE      (1 << 1)

%define CODE_SEG     0x0008
%define DATA_SEG     0x0010

ALIGN 4
IDT:
   .Length       dw 0
   .Base         dd 0

SwitchToLongMode:
   push di
   mov ecx, 0x1000
   xor eax, eax
   cld
   rep stosd
   pop di

   lea eax, [es:di + 0x1000]
   or eax, PAGE_PRESENT | PAGE_WRITE
   mov [es:di], eax

   lea eax, [es:di + 0x2000]
   or eax, PAGE_PRESENT | PAGE_WRITE
   mov [es:di + 0x1000], eax

   lea eax, [es:di + 0x3000]
   or eax, PAGE_PRESENT | PAGE_WRITE
   mov [es:di + 0x2000], eax

   push di
   lea di, [di + 0x3000]
   mov eax, PAGE_PRESENT | PAGE_WRITE

.LoopPageTable:
   mov [es:di], eax
   add eax, 0x1000
   add di, 8
   cmp eax, 0x200000
   jb .LoopPageTable

   pop di

   mov al, 0xFF
   out 0x21, al

   nop
   nop

   lidt [IDT]

   mov eax, 10100000b
   mov cr4, eax

   mov edx, edi
   mov cr3, edx

   mov ecx, 0xC0000080
   rdmsr

   or eax, 0x00000100
   wrmsr

   mov ebx, cr0
   or ebx,0x80000001
   mov cr0, ebx

   lgdt [GDT.Pointer]

   jmp CODE_SEG:LongMode

GDT:
.Null:
   dq 0x0000000000000000

.Code:
   dq 0x00209A0000000000
   dq 0x0000920000000000
ALIGN 4
   dw 0

.Pointer:
   dw $ - GDT - 1
   dd GDT

[BITS 64]
LongMode:
   mov ax, DATA_SEG
   mov ds, ax
   mov es, ax
   mov fs, ax
   mov gs, ax
   mov ss, ax

; --------------------------------
mainl0: mov ax,10
   mov bx,10
   mov ecx,00000000111111111111111110001000b ;color
l0: ;edx : y edx : x
mov eax, 800
mov edx, 1
imul edx
add eax, edx
add eax, edx

mov edx, 3
imul edx
add eax, edx

   mov di,ax       ; di = eax % FFFFh (offset)
   mov ax,0A000h   ; es = A000h
   mov es,ax ;crash <----

mov eax,ecx
  stosd

   jmp l0

   hlt
   lol:
jmp lol
[bits 16]

CheckCPU:

   pushfd

   pop eax
   mov ecx, eax
   xor eax, 0x200000
   push eax
   popfd

   pushfd
   pop eax
   xor eax, ecx
   shr eax, 21
   and eax, 1
   push ecx
   popfd

   test eax, eax
   jz nlm

   mov eax, 0x80000000
   cpuid

   cmp eax, 0x80000001
   jb nlm

   mov eax, 0x80000001
   cpuid
   test edx, 1 << 29
   jz nlm

   ret

times 510 - ($-$$) db 0
dw 0xAA55

</code>```

I know that this is long and dry, but I'm really trying to get this as low leveled as possible to make it compatible with everything, and to make it run smoothly.

Body:
So I switched directly to 64-bit mode because it was easier. But I want to output pixels, and the command move es, ax crashes my computer (a key part of the pixel output code). And I realized that there are traces of paging at the start of the code, so now I'm totally confused. I'm trying to make it BIOS-free, multi-platform, and basically compatible with everything. And if the code already has paging set up for me, that would make my life a lot easier. Then I just need to make it compatible with all monitors, have it detect the keyboard and mouse, and I'm all set. (I already programmed a language for it i just didn't want to include it because it's long.)
So here is the code:

%define FREE_SPACE 0x9000

ORG 0x7C00
[bits 16]
   mov ax,115h ; init 800x600 32bit
   mov     bx,ax
   mov     ax,4f02h
   int     16

Main:
   jmp 0x0000:.FlushCS

.FlushCS:
   xor ax, ax

   mov ss, ax

   mov sp, Main

   mov ds, ax
   mov es, ax
   mov fs, ax
   mov gs, ax
   cld

   call CheckCPU
   jc nlm

   mov edi, FREE_SPACE

   jmp SwitchToLongMode

nlm:

BITS 16

%define PAGE_PRESENT    (1 << 0)
%define PAGE_WRITE      (1 << 1)

%define CODE_SEG     0x0008
%define DATA_SEG     0x0010

ALIGN 4
IDT:
   .Length       dw 0
   .Base         dd 0

SwitchToLongMode:
   push di
   mov ecx, 0x1000
   xor eax, eax
   cld
   rep stosd
   pop di

   lea eax, [es:di + 0x1000]
   or eax, PAGE_PRESENT | PAGE_WRITE
   mov [es:di], eax

   lea eax, [es:di + 0x2000]
   or eax, PAGE_PRESENT | PAGE_WRITE
   mov [es:di + 0x1000], eax

   lea eax, [es:di + 0x3000]
   or eax, PAGE_PRESENT | PAGE_WRITE
   mov [es:di + 0x2000], eax

   push di
   lea di, [di + 0x3000]
   mov eax, PAGE_PRESENT | PAGE_WRITE

.LoopPageTable:
   mov [es:di], eax
   add eax, 0x1000
   add di, 8
   cmp eax, 0x200000
   jb .LoopPageTable

   pop di

   mov al, 0xFF
   out 0x21, al

   nop
   nop

   lidt [IDT]

   mov eax, 10100000b
   mov cr4, eax

   mov edx, edi
   mov cr3, edx

   mov ecx, 0xC0000080
   rdmsr

   or eax, 0x00000100
   wrmsr

   mov ebx, cr0
   or ebx,0x80000001
   mov cr0, ebx

   lgdt [GDT.Pointer]

   jmp CODE_SEG:LongMode

GDT:
.Null:
   dq 0x0000000000000000

.Code:
   dq 0x00209A0000000000
   dq 0x0000920000000000
ALIGN 4
   dw 0

.Pointer:
   dw $ - GDT - 1
   dd GDT

[BITS 64]
LongMode:
   mov ax, DATA_SEG
   mov ds, ax
   mov es, ax
   mov fs, ax
   mov gs, ax
   mov ss, ax

; --------------------------------
mainl0: mov ax,10
   mov bx,10
   mov ecx,00000000111111111111111110001000b ;color
l0: ;edx : y edx : x
mov eax, 800
mov edx, 1
imul edx
add eax, edx
add eax, edx

mov edx, 3
imul edx
add eax, edx

   mov di,ax       ; di = eax % FFFFh (offset)
   mov ax,0A000h   ; es = A000h
   mov es,ax ;crash <----

mov eax,ecx
  stosd

   jmp l0

   hlt
   lol:
jmp lol
[bits 16]

CheckCPU:

   pushfd

   pop eax
   mov ecx, eax
   xor eax, 0x200000
   push eax
   popfd

   pushfd
   pop eax
   xor eax, ecx
   shr eax, 21
   and eax, 1
   push ecx
   popfd

   test eax, eax
   jz nlm

   mov eax, 0x80000000
   cpuid

   cmp eax, 0x80000001
   jb nlm

   mov eax, 0x80000001
   cpuid
   test edx, 1 << 29
   jz nlm

   ret

times 510 - ($-$$) db 0
dw 0xAA55

I know that this is long and dry, but I'm really trying to get this as low leveled as possible to make it compatible with everything, and to make it run smoothly.


问:
Decryption using streaming AEAD (google tink)
When I try to decrypt ciphertext using streaming aead primitive as part of google tink, I get the following error: java.io.IOException: No matching key found for the ciphertext in the stream

Below is my code:

```<code>ByteBuffer buffer = ByteBuffer.allocate(1000);
int bytesRead = 0;

StreamingAead saead = keysetHandle.getPrimitive(StreamingAead.class);
ReadableByteChannel ciphertextSource = Channels.newChannel(new ByteArrayInputStream(ciphertext));
ReadableByteChannel decryptingChannel = saead.newDecryptingChannel(ciphertextSource, associatedData);

while(bytesRead < 1000) {
  bytesRead += decryptingChannel.read(buffer);
}
</code>```

The line where the error is shown is: bytesRead += decryptingChannel.read(buffer)

I've already referred here and here but the issue persists. I'm using tink version 1.6.0

Body:
When I try to decrypt ciphertext using streaming aead primitive as part of google tink, I get the following error: java.io.IOException: No matching key found for the ciphertext in the stream

Below is my code:

ByteBuffer buffer = ByteBuffer.allocate(1000);
int bytesRead = 0;

StreamingAead saead = keysetHandle.getPrimitive(StreamingAead.class);
ReadableByteChannel ciphertextSource = Channels.newChannel(new ByteArrayInputStream(ciphertext));
ReadableByteChannel decryptingChannel = saead.newDecryptingChannel(ciphertextSource, associatedData);

while(bytesRead < 1000) {
  bytesRead += decryptingChannel.read(buffer);
}

The line where the error is shown is: bytesRead += decryptingChannel.read(buffer)

I've already referred here and here but the issue persists. I'm using tink version 1.6.0


问:
How do I update a d3 plot in a parent synchronously when a data object is being changed by a series of dropdown and slider child components in React?
I am relatively new to React development and I'm trying to build a dashboard that includes a d3 plot that is rendered in a parent component. I have a series of child components that include dropdown and slider elements that are used to manipulate a data object (based on user input). I want to update the d3 plot in the parent component whenever the data object is updated by the child components. How can I do this in a way that ensures the plot is updated synchronously with the data object? Currently it's lagging by one step - ie. I will change the dropdown, nothing will happen, change it again and then it will reflect what the object was in the previous step. I'm aware this occurs because React is updated asynchronously as re-rendering is an expensive operation.

Here is the skeleton of the code below:

The handleChange function which I pass to all the sliders and dropdowns:

```<code>const Scenario = ({profileData, type, label}) => {
    const [plotType, setPlotType] = useState("waterfall")
    const [fieldValues, setFieldValues] = useState({})

...

...

   const handleChange = (feature, enabled, field, value) => {
        let newFields = { ...fieldValues };
        newFields[feature]["checked"] = enabled;
        newFields[feature]["field"] = field;
        newFields[feature]["value"] = Number(value)

        setFieldValues(newFields)
        };
</code>```

Where I pass the handleChange function to the sliders and dropdowns

```<code>    {
    Object.keys(profileData.categorical).map((feature, idx) =>
        <DropdownContainer feature = {feature}
        featureProfile = {profileData.categorical[feature]}
        handleChange={handleChange}
        />
        )
    }
    {
    Object.keys(profileData.numeric).map((feature, idx) =>
        <SliderContainer feature={feature} featureProfile={profileData.numeric[feature]} handleChange={handleChange}/>
        )
    }
</code>```

An example of the dropdown child component where the parent is being updated:

```<code>            <Select
                id={feature+"--dropdown"}
                onChange={(val) => {
                    handleChange(feature, enabled, field, value)
                }}
                >
                {
                Object.keys(featureProfile).map((x, idx) =>
                    <Option value={idx}>{profile[x].categories}</Option>
                    )
                }
            </Select>
</code>```

Where I update the d3 plot with the fieldValues:

```<code> {plotType === "waterfall" &&
        <WaterfallChart
        featureData={fieldValues}
        margin = {{
        top: 10,
        right: 50,
        bottom: 100,
        left: 50
        }}
        />

    }
</code>```

I've tried to use the useEffect hook to update setFieldValues and have tried some of the other answers listed on SO that outline using callbacks but to no avail. Any help would be greatly appreciated!

Body:
I am relatively new to React development and I'm trying to build a dashboard that includes a d3 plot that is rendered in a parent component. I have a series of child components that include dropdown and slider elements that are used to manipulate a data object (based on user input). I want to update the d3 plot in the parent component whenever the data object is updated by the child components. How can I do this in a way that ensures the plot is updated synchronously with the data object? Currently it's lagging by one step - ie. I will change the dropdown, nothing will happen, change it again and then it will reflect what the object was in the previous step. I'm aware this occurs because React is updated asynchronously as re-rendering is an expensive operation.

Here is the skeleton of the code below:

The handleChange function which I pass to all the sliders and dropdowns:

const Scenario = ({profileData, type, label}) => {
    const [plotType, setPlotType] = useState("waterfall")
    const [fieldValues, setFieldValues] = useState({})

...

...

   const handleChange = (feature, enabled, field, value) => {
        let newFields = { ...fieldValues };
        newFields[feature]["checked"] = enabled;
        newFields[feature]["field"] = field;
        newFields[feature]["value"] = Number(value)

        setFieldValues(newFields)
        };

Where I pass the handleChange function to the sliders and dropdowns

    {
    Object.keys(profileData.categorical).map((feature, idx) =>
        <DropdownContainer feature = {feature}
        featureProfile = {profileData.categorical[feature]}
        handleChange={handleChange}
        />
        )
    }
    {
    Object.keys(profileData.numeric).map((feature, idx) =>
        <SliderContainer feature={feature} featureProfile={profileData.numeric[feature]} handleChange={handleChange}/>
        )
    }

An example of the dropdown child component where the parent is being updated:

            <Select
                id={feature+"--dropdown"}
                onChange={(val) => {
                    handleChange(feature, enabled, field, value)
                }}
                >
                {
                Object.keys(featureProfile).map((x, idx) =>
                    <Option value={idx}>{profile[x].categories}</Option>
                    )
                }
            </Select>

Where I update the d3 plot with the fieldValues:

 {plotType === "waterfall" &&
        <WaterfallChart
        featureData={fieldValues}
        margin = {{
        top: 10,
        right: 50,
        bottom: 100,
        left: 50
        }}
        />

    }

I've tried to use the useEffect hook to update setFieldValues and have tried some of the other answers listed on SO that outline using callbacks but to no avail. Any help would be greatly appreciated!


问:
How do I get the URL for each of my dependencies defined within my build.gradle file
I am trying to have by build.gradle script automatically write a list of download links to the dependencies that my project requires.

I already have the code that will take the URL and download it, and make it available to my program at runtime.

I am trying to minimize the size of my .jar file, and instead, let the program download as any dependencies as possible at runtime so that the filesize of my .jar is as small as possible.

I expect that I will have to do something like this

```<code>tasks.getByName("shadowJar").doFirst {
    def dependenciesFile = file("$projectDir/src/main/resources/.dependencies.properties")
    dependenciesFile.write("dependencies=")
    project.configurations.getByName("compileOnly").allDependencies.forEach {dependency ->
        def URL = //Somehow get the URL from this dependency
        dependenciesFile.append("$URL,")
    }
}
</code>```

Because when you are defining your dependencies, gradle reaches out and downloads them so that they are available to Intellij, it must have some way to resolve strings such as "com.squareup.okhttp3:okhttp:4.10.0" into URLs which it downloads them from
So in my mind, the best solution would be to somehow hook into gradle and have it just figure out the url, or somethin similar

Currently, I am using this code here

```<code>tasks.getByName("shadowJar").doFirst {
    project.configurations.getByName("compileOnly").allDependencies.forEach {dependency ->
        println("${dependency.group}:${dependency.name}:${dependency.version}")

        for (ArtifactRepository repository : project.repositories.asList()) {
            def url = repository.properties.get('url')
            def jarUrl = String.format("%s%s/%s/%s/%s-%s.jar", url.toString(),
                    dependency.group.replace('.', '/'), dependency.name, dependency.version,
                    dependency.name, dependency.version)
            try {
                def jarfile = new URL(jarUrl)
                def inStream = jarfile.openStream();
                if (inStream != null) {
                    println(String.format("%s:%s:%s", dependency.group, dependency.name, dependency.version)
                            + " -> " + jarUrl)
                    return
                }
            } catch (Exception ignored) {
            }
        }
    }
}
</code>```

And it works fine for libraries which are in the maven centeral repository, but for things in other repositories, such as jitpack or codemc, it does not get the URL correctly.

Body:
I am trying to have by build.gradle script automatically write a list of download links to the dependencies that my project requires.

I already have the code that will take the URL and download it, and make it available to my program at runtime.

I am trying to minimize the size of my .jar file, and instead, let the program download as any dependencies as possible at runtime so that the filesize of my .jar is as small as possible.

I expect that I will have to do something like this

tasks.getByName("shadowJar").doFirst {
    def dependenciesFile = file("$projectDir/src/main/resources/.dependencies.properties")
    dependenciesFile.write("dependencies=")
    project.configurations.getByName("compileOnly").allDependencies.forEach {dependency ->
        def URL = //Somehow get the URL from this dependency
        dependenciesFile.append("$URL,")
    }
}

Because when you are defining your dependencies, gradle reaches out and downloads them so that they are available to Intellij, it must have some way to resolve strings such as "com.squareup.okhttp3:okhttp:4.10.0" into URLs which it downloads them from
So in my mind, the best solution would be to somehow hook into gradle and have it just figure out the url, or somethin similar

Currently, I am using this code here

tasks.getByName("shadowJar").doFirst {
    project.configurations.getByName("compileOnly").allDependencies.forEach {dependency ->
        println("${dependency.group}:${dependency.name}:${dependency.version}")

        for (ArtifactRepository repository : project.repositories.asList()) {
            def url = repository.properties.get('url')
            def jarUrl = String.format("%s%s/%s/%s/%s-%s.jar", url.toString(),
                    dependency.group.replace('.', '/'), dependency.name, dependency.version,
                    dependency.name, dependency.version)
            try {
                def jarfile = new URL(jarUrl)
                def inStream = jarfile.openStream();
                if (inStream != null) {
                    println(String.format("%s:%s:%s", dependency.group, dependency.name, dependency.version)
                            + " -> " + jarUrl)
                    return
                }
            } catch (Exception ignored) {
            }
        }
    }
}

And it works fine for libraries which are in the maven centeral repository, but for things in other repositories, such as jitpack or codemc, it does not get the URL correctly.


问:
Why ExecutorService is much faster than Coroutines in this example? [Solved]
Update:

I made 2 silly mistakes!

I submitted only 1 task in the executor service example

I forgot to await for the tasks to finish.

Fixing the test, lead to all 3 examples having around 190-200 ms/op latency.

I created a benchmark comparison using kotlinx-benchmark (uses jmh) to compare coroutines and a threadpool when making a blocking call.

My rational behind such benchmark is

Coroutines will block the underlying thread when making a blocking call.

A Network call is generally blocking ()

In an average service, I need to make a million of network calls.

In such scenario will I get any benefit, if I use coroutines?

The benchmark I create simulates the blocking call using Thread.sleep(10) // 10 ms block and I need to create 1000 of them. I created 3 examples with following results

Dispatchers.io

Used Dispatchers.io, which is the recommended way to handle IO operations.

    @Benchmark
    fun withCoroutines() {
        runBlocking {
            val coroutines = (0 until 1000).map {
                CoroutineScope(Dispatchers.IO).async {
                    sleep(10)
                }
            }

            coroutines.joinAll()
        }
    }

```
<p><strong>Avg time: 188.418 ms/op</strong></p>
<h2>Fixed Threadpool</h2>
<p><code>Dispatcher.IO</code> created <code>64</code> threads (the exact number is nondeterministic statically). So I kept <code>60</code> threads for a comparable scenario</p>
<pre class="lang-kotlin prettyprint-override"><code>    @Benchmark
    fun withExecutorService() {
        val executors = Executors.newFixedThreadPool(60)
        executors.submit { sleep(10) }
        executors.shutdown()
    }

</code>```

Avg time: 0.054 ms/op

Threadpool Dispatcher

Since the results were shocking I decided to use the same threadpool above as the dispatcher as

Executors.newFixedThreadPool(60).asCoroutineDispatcher()

```
<p><strong>Avg time: 206,260 ms/op</strong></p>
<hr />
<h2>Questions</h2>
<ol>
<li>Why are coroutines performing exceptionally bad here?</li>
<li>With <code>limitedParallelism(10)</code> options coroutines performed much better at <code>30ms/op</code>. Default number of threads used by IO are <code>64</code>. Does that mean that coroutine scheduler is causing too many context switches, leading to poor performance. Still the performance is not close to that of threadpools</li>
<li>Am I correct to assume that the network calls are always blocking? Both executor service and coroutines schedules execution over underlying threads while not blocking the main thread, so they are the direct competitors.</li>
</ol>
<p>Notes:
I am running <code>jmh</code> with</p>
<pre class="lang-kotlin prettyprint-override"><code>
@State(Scope.Benchmark)
@Fork(1)
@Warmup(iterations = 50)
@Measurement(iterations = 5, time = 1000, timeUnit = TimeUnit.MILLISECONDS)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
@BenchmarkMode(Mode.AverageTime)
</code>```

The code can be found here

Body:
Update:

I made 2 silly mistakes!

I submitted only 1 task in the executor service example

I forgot to await for the tasks to finish.

Fixing the test, lead to all 3 examples having around 190-200 ms/op latency.

I created a benchmark comparison using kotlinx-benchmark (uses jmh) to compare coroutines and a threadpool when making a blocking call.

My rational behind such benchmark is

Coroutines will block the underlying thread when making a blocking call.

A Network call is generally blocking ()

In an average service, I need to make a million of network calls.

In such scenario will I get any benefit, if I use coroutines?

The benchmark I create simulates the blocking call using Thread.sleep(10) // 10 ms block and I need to create 1000 of them. I created 3 examples with following results

Dispatchers.io

Used Dispatchers.io, which is the recommended way to handle IO operations.

    @Benchmark
    fun withCoroutines() {
        runBlocking {
            val coroutines = (0 until 1000).map {
                CoroutineScope(Dispatchers.IO).async {
                    sleep(10)
                }
            }

            coroutines.joinAll()
        }
    }

Avg time: 188.418 ms/op

Fixed Threadpool

Dispatcher.IO created 64 threads (the exact number is nondeterministic statically). So I kept 60 threads for a comparable scenario

    @Benchmark
    fun withExecutorService() {
        val executors = Executors.newFixedThreadPool(60)
        executors.submit { sleep(10) }
        executors.shutdown()
    }

Avg time: 0.054 ms/op

Threadpool Dispatcher

Since the results were shocking I decided to use the same threadpool above as the dispatcher as

Executors.newFixedThreadPool(60).asCoroutineDispatcher()

Avg time: 206,260 ms/op

Questions

Why are coroutines performing exceptionally bad here?

With limitedParallelism(10) options coroutines performed much better at 30ms/op. Default number of threads used by IO are 64. Does that mean that coroutine scheduler is causing too many context switches, leading to poor performance. Still the performance is not close to that of threadpools

Am I correct to assume that the network calls are always blocking? Both executor service and coroutines schedules execution over underlying threads while not blocking the main thread, so they are the direct competitors.

Notes:
I am running jmh with

@State(Scope.Benchmark)
@Fork(1)
@Warmup(iterations = 50)
@Measurement(iterations = 5, time = 1000, timeUnit = TimeUnit.MILLISECONDS)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
@BenchmarkMode(Mode.AverageTime)

The code can be found here


问:
how to use LWUIT in eclipse for Symbian OS development. how to install LWUIT in eclipse.?
i'm working in eclipse using S60 i want to know how to use LWUIT and eSWT in Symbian OS development?
 what is the difference b/w LWUIT and eSWT.?
 in my view these two are using for GUI. but i need how to work in eclipse do not any structs are using these two.
   please help me.
Than you.</p>

ContentLicense: CC BY-SA 3.0


问:
multiple fingerprints under same profile
I want to make a button in flutter to add new fingerprint to existing or new profile under same authentication account using the fingerprint sensor connected to NodeMCU ESP8266.So, under the authentication account multiple profiles and each profile can store multiple fingerprints.How to do that can someone help?

The fingerprint sensor on the NodeMCU ESP8266 is connected to the Realtime Firebase via Wi-Fi; the fingerprint sensor has 127 IDs, and each ID can store one fingerprint. There are two options: Option 1 is to scan a new fingerprint and save it in any ID from 1 to 127; option 2 is to check to see if the fingerprint matches any of the fingerprints in the database, and if it does, open the door lock.


问:
Facing an error for @klarna/react-native-vector-drawable
FAILURE: Build failed with an exception.

What went wrong:
A problem occurred configuring project ':@klarna/react-native-vector-drawable'.

The project name '@klarna/react-native-vector-drawable' must not contain any of the following characters: [/, , :, <, >, ", ?, *, |]. Set the 'rootProj
ect.name' or adjust the 'include' statement (see https://docs.gradle.org/7.3/dsl/org.gradle.api.initialization.Settings.html#org.gradle.api.initialization
.Settings:include(java.lang.String[]) for more details).

Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.

Get more help at https://help.gradle.org

BUILD FAILED in 7s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbos
e flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! resure@0.0.1 android: react-native run-android
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the resure@0.0.1 android script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

I installed vector-icons,Clean the build but i didnot get any luck to fix it.


问:
Accessible PDF's from Coldfusion 2021
I've been looking everywhere, and can't find a suitable answer. We are generating PDF's on the fly for a job board. People click on a job, and have an option to download a PDF version of the job posting. We currently have everything running just fine with cfdocument, but our client is hoping to get the website to 100% compliant with WCAG 2.1.

Currently, i've tried using cfdocument, then using cfPDF to set things like title, as mentioned by Raymond Camden in ColdFusion 8: Working with PDFs (Part 2) but this doesn't seem to work anymore as the downloaded documents don't keep the set information.

The other issue is the PDF isn't marked as a PDF (apparently a flaw with cfdocument Adobe has no plans to fix).

We've tried cfhtmltopdf, but we require headers and footers for each page, and as many have pointed out on various forums, Adobe's implementation is a joke.

So, my question now is, what is the best route to creating a fully compliant PDF from Coldfusion (3rd party options are a route we are willing to take if needed) Ideally we would want the direct download like CFDocument, but we are not opposed to having a physical file created for each job posting if it means having a compliant PDF.

Our code, after all the body content, looks as follows (again this doesn't set the title, language or tag as PDF, and doesn't allow alt tags on our images for some reason).

```<code><cfheader name="Content-Disposition" value="attachment;filename=filename.pdf">
<cfheader name="Content-Language" value="#session.language.code#" />
<cfdocument name="myPDF" format="pdf" orientation="portrait"  pageType="custom" pageWidth="8.5" pageHeight="10.75" unit="in" localUrl="yes" marginbottom="1.5" margintop="1" marginleft="0.25" marginright="0.25">

***
***
***
***

<cfset PDFinfo=StructNew()>
<cfset PDFinfo.Title="#returnStruct.JobDetails.title#">
<cfset PDFinfo.Language = 'EN-US' />
<CFIF returnStruct.JobDetails.anonymous EQ 0>
    <cfset PDFinfo.Author="#returnStruct.JobDetails.Organization#">
<CFELSE>
    <cfset PDFinfo.Author="Employment Agency Name">
</CFIF>

<cfpdf action="setInfo" source="myPDF" info="#PDFinfo#">

<cfpdf action="write" source="myPDF" name='myPDF' version="1.4">

<cfcontent type="application/pdf" reset="true" variable="#toBinary(myPDF)#">
</code>```

Title: Accessible PDF's from Coldfusion 2021

Body:
I've been looking everywhere, and can't find a suitable answer. We are generating PDF's on the fly for a job board. People click on a job, and have an option to download a PDF version of the job posting. We currently have everything running just fine with cfdocument, but our client is hoping to get the website to 100% compliant with WCAG 2.1.

Currently, i've tried using cfdocument, then using cfPDF to set things like title, as mentioned by Raymond Camden in ColdFusion 8: Working with PDFs (Part 2) but this doesn't seem to work anymore as the downloaded documents don't keep the set information.

The other issue is the PDF isn't marked as a PDF (apparently a flaw with cfdocument Adobe has no plans to fix).

We've tried cfhtmltopdf, but we require headers and footers for each page, and as many have pointed out on various forums, Adobe's implementation is a joke.

So, my question now is, what is the best route to creating a fully compliant PDF from Coldfusion (3rd party options are a route we are willing to take if needed) Ideally we would want the direct download like CFDocument, but we are not opposed to having a physical file created for each job posting if it means having a compliant PDF.

Our code, after all the body content, looks as follows (again this doesn't set the title, language or tag as PDF, and doesn't allow alt tags on our images for some reason).

<cfheader name="Content-Disposition" value="attachment;filename=filename.pdf">
<cfheader name="Content-Language" value="#session.language.code#" />
<cfdocument name="myPDF" format="pdf" orientation="portrait"  pageType="custom" pageWidth="8.5" pageHeight="10.75" unit="in" localUrl="yes" marginbottom="1.5" margintop="1" marginleft="0.25" marginright="0.25">

***
***
***
***

<cfset PDFinfo=StructNew()>
<cfset PDFinfo.Title="#returnStruct.JobDetails.title#">
<cfset PDFinfo.Language = 'EN-US' />
<CFIF returnStruct.JobDetails.anonymous EQ 0>
    <cfset PDFinfo.Author="#returnStruct.JobDetails.Organization#">
<CFELSE>
    <cfset PDFinfo.Author="Employment Agency Name">
</CFIF>

<cfpdf action="setInfo" source="myPDF" info="#PDFinfo#">

<cfpdf action="write" source="myPDF" name='myPDF' version="1.4">

<cfcontent type="application/pdf" reset="true" variable="#toBinary(myPDF)#">


问:
Labelling material-calendarview with Events
I'm trying to use prolificinteractive's material-calendarview to achieve something similar to the image I've attached, which has events added to the calendar. I'm thinking I could do this by creating a custom Span class as shown here in another post.

However, my issue is that DayViewDecorator.decorate doesn't know which date it's currently decorating, so I can't pass specific event names to it. Is there a way I could achieve this using material-calendarview or are there other alternatives? Cheers

What I'm trying to achieve

MainActivity.kt
I thought decorate would be called after shouldDecorate, so I could define calendarDay in shouldDecorate, then call for its corresponding Event value in mapOfCalendarDays. But decorate is actually called first, and only once, before shouldDecorate is called for each day in the Calendar. This results in a crash, though, since calendarDay has not yet been initialized.

```<code>calendarView.addDecorator(object: DayViewDecorator {
    lateinit var calendarDay: CalendarDay

    override fun shouldDecorate(day: CalendarDay?): Boolean {
        return if (mapOfCalendarDays.containsKey(day)) { // check if 'day' is in mapOfCalendarDays (a map of CalendarDay to Event)
            calendarDay = day!!
            true
        } else false
    }

    override fun decorate(view: DayViewFacade?) {
        val event: Event? = mapOfCalendarDays[calendarDay]
        if (event != null) {
            view?.addSpan(AddTextToDates(event.name))
        }
    }
})
</code>```

Event.kt

```<code>data class Event(
    val name: String,
    val date: LocalDate
)
</code>```

AddTextToDates.kt

```<code>class AddTextToDates(text: String): LineBackgroundSpan {

    private val eventName = text

    override fun drawBackground(
        canvas: Canvas,
        paint: Paint,
        left: Int,
        right: Int,
        top: Int,
        baseline: Int,
        bottom: Int,
        text: CharSequence,
        start: Int,
        end: Int,
        lnum: Int
    ) {
        canvas.drawText(eventName, ((left+right)/4).toFloat(), (bottom+15).toFloat(), paint)
    }
}
</code>```

Body:
I'm trying to use prolificinteractive's material-calendarview to achieve something similar to the image I've attached, which has events added to the calendar. I'm thinking I could do this by creating a custom Span class as shown here in another post.

However, my issue is that DayViewDecorator.decorate doesn't know which date it's currently decorating, so I can't pass specific event names to it. Is there a way I could achieve this using material-calendarview or are there other alternatives? Cheers

What I'm trying to achieve

MainActivity.kt
I thought decorate would be called after shouldDecorate, so I could define calendarDay in shouldDecorate, then call for its corresponding Event value in mapOfCalendarDays. But decorate is actually called first, and only once, before shouldDecorate is called for each day in the Calendar. This results in a crash, though, since calendarDay has not yet been initialized.

calendarView.addDecorator(object: DayViewDecorator {
    lateinit var calendarDay: CalendarDay

    override fun shouldDecorate(day: CalendarDay?): Boolean {
        return if (mapOfCalendarDays.containsKey(day)) { // check if 'day' is in mapOfCalendarDays (a map of CalendarDay to Event)
            calendarDay = day!!
            true
        } else false
    }

    override fun decorate(view: DayViewFacade?) {
        val event: Event? = mapOfCalendarDays[calendarDay]
        if (event != null) {
            view?.addSpan(AddTextToDates(event.name))
        }
    }
})

Event.kt

data class Event(
    val name: String,
    val date: LocalDate
)

AddTextToDates.kt

class AddTextToDates(text: String): LineBackgroundSpan {

    private val eventName = text

    override fun drawBackground(
        canvas: Canvas,
        paint: Paint,
        left: Int,
        right: Int,
        top: Int,
        baseline: Int,
        bottom: Int,
        text: CharSequence,
        start: Int,
        end: Int,
        lnum: Int
    ) {
        canvas.drawText(eventName, ((left+right)/4).toFloat(), (bottom+15).toFloat(), paint)
    }
}


问:
VBA Powerpoint: Can i hide shapes randomly on a slide?
you can use VBA to hide shapes: VBA PowerPoint Display and Hide Shapes

But can you hide shapes randomly on a slide (all but one specific)?

I don´t know how to make a random on a

```<code>ActivePresentation.Slides("Slide1").Shapes("Rectangle 1").Visible = False
</code>```

I aspect, that i can hide a random shape on the actual slide by click(the Shape must have to be a visible shape before, so that another start of the code does hide randomly the next visible shape and not the hidden shape again).

Body:
you can use VBA to hide shapes: VBA PowerPoint Display and Hide Shapes

But can you hide shapes randomly on a slide (all but one specific)?

I don´t know how to make a random on a

ActivePresentation.Slides("Slide1").Shapes("Rectangle 1").Visible = False

I aspect, that i can hide a random shape on the actual slide by click(the Shape must have to be a visible shape before, so that another start of the code does hide randomly the next visible shape and not the hidden shape again).


问:
Infix to postfix algorithm, the if statement I wrote is not being called out when it should
```<code>private Scanner sc = new Scanner(System.in);
private String expression;
private String exp[];
private ArrayList<String> post_fix = new ArrayList<>();
Stack<String> ope = new Stack<String>();
    public Model()
    {
        expression = sc.nextLine();

    }

    public void split()
    {

        //splitting the entered expression to array of operators alone and array of the numbers then create Arraylist to combine the operators and numbers together as if it is a string expression  but as an array
        String num[]= this.expression.split("[/+/*/-]");
        String preop[]= this.expression.split("[0-9]+");; // this will give [empty, operator, operator...] therefore we will create another array to fill in the ops excluding empty

        ArrayList<String> op = new ArrayList<>();//I used arraylist because easier
        for(int i = 1; i<preop.length;i++)
        {
            op.add(preop[i]);
        }

        //putting the operands and the operators together in the same array

        ArrayList<String> exp = new ArrayList<>();

        for(int i = 0; i <num.length;i++)
        {
            exp.add(num[i]);
        }
        int count = 0;
        for(int i = 0; i <op.size();i++)
        { //fill the arraylist with numbers then add the operators to it by using number (index of the operator +1 +count)
            exp.add(i+1+count, op.get(i)); //This is why arraylist was used in order to let values to be placed in between
            count++;
            //i+1+count is used because index of the operator is in between two numbers meaning it is after the first index in num array so i+1 and because array keeps increasing, we do +count for the other operators to be placed in
        }

        this.exp = new String[exp.size()]; // we change the arraylist exp to instance array for faster operations later on
        System.out.print("Test to check if expression is converted into array as intented: ");
        for(int i = 0; i<this.exp.length;i++)
        {
            this.exp[i] = exp.get(i);
            System.out.print(this.exp[i]);
        }
        System.out.println();

    }

    public void postfix()
    {

        for(int i = 0; i < exp.length; i++)
        {
            if(i%2 == 0)//since operands are observed to always have even index in the array
            {
                post_fix.add(exp[i]);
                System.out.println(post_fix);
            }
            else
            {
                boolean x = !ope.empty();
                System.out.println("Test of !ope.empty: " + x);
                while(!ope.empty()&& HasHigherPrecedence(ope.peek(), this.exp[i]))
                {
                    post_fix.add(ope.peek());
                    ope.pop();

                }
                ope.push(exp[i]);
                System.out.println("stack_top: "+ ope.peek());
            }

        }
        while(!ope.empty())
        {

            post_fix.add(ope.peek());
            ope.pop();
        }
        System.out.println("Output: " +post_fix);

    }

    public String getPost_fix()
    {
        String temp = "";
        for(int i =0; i < exp.length;i++)
        {
            temp = temp + post_fix.get(i);
        }

        return temp;
    }

    public double evaluate()
    {
        return 0;
    }

    private boolean HasHigherPrecedence(String op1, String op2)
    {
        //op1 is operator 1 at the top of the stack thus associativity highest
        int a_op1 = 1;
        int a_op2 = 0;

        int p_op1 = 0;
        int p_op2= 0;
        //the precedence will be measured with numbers
        String operators[]= {"","+","-","*","/"};
        int precedence[] = {0,1,1,2,2}; //the reason for blank operator and 0 precedence is because the stack initially will be empty
        for(int i = 0; i< operators.length;i++)
        {
            if(op1.equals(operators[i]))
            {
                p_op1=precedence[i];
            }
        }
        for(int i = 0; i< operators.length;i++)
        {
            if(op2.equals(operators[i]))
            {
                p_op2=precedence[i];
            }
        }

        boolean higher_ornot = false;

        if(p_op1 > p_op2)
        {
            higher_ornot = false;
        }
        else if(p_op1 < p_op1)
        {
            higher_ornot = true;
        }
        else if(p_op1== p_op2)
        {
        System.out.println(op1+": "+p_op1);
        System.out.println(op2+": "+p_op2);
            higher_ornot = false; //since associativity of op1 will be higher --> thus higher precedence
        }

        return higher_ornot;
    }

}
</code>```

I am trying to converst user's infix mathmatical expression into a postfix expression in an array that will be evaluated but before evaluation, I faced a problem in the postfix method

while(!ope.empty()&& HasHigherPrecedence(ope.peek(), this.exp[i]))

This specific line is not being called out when the condition should be true, when it is comparing top of the stack which is * to - and * has higher precedence and since stack is not empty thus it should return true thus the function is called. I tested if I have any errors other areas but everything I tested was correct, I really have  no clue how to fix.

I am really clueless even after 1hour and a half staring and trying to trace the code

I am expecting from output to be
[3, 2, 4, *, +, 3, -] which is the postfix expression that technically will be evaluated later

Body:
private Scanner sc = new Scanner(System.in);
private String expression;
private String exp[];
private ArrayList<String> post_fix = new ArrayList<>();
Stack<String> ope = new Stack<String>();
    public Model()
    {
        expression = sc.nextLine();

    }

    public void split()
    {

        //splitting the entered expression to array of operators alone and array of the numbers then create Arraylist to combine the operators and numbers together as if it is a string expression  but as an array
        String num[]= this.expression.split("[/+/*/-]");
        String preop[]= this.expression.split("[0-9]+");; // this will give [empty, operator, operator...] therefore we will create another array to fill in the ops excluding empty

        ArrayList<String> op = new ArrayList<>();//I used arraylist because easier
        for(int i = 1; i<preop.length;i++)
        {
            op.add(preop[i]);
        }

        //putting the operands and the operators together in the same array

        ArrayList<String> exp = new ArrayList<>();

        for(int i = 0; i <num.length;i++)
        {
            exp.add(num[i]);
        }
        int count = 0;
        for(int i = 0; i <op.size();i++)
        { //fill the arraylist with numbers then add the operators to it by using number (index of the operator +1 +count)
            exp.add(i+1+count, op.get(i)); //This is why arraylist was used in order to let values to be placed in between
            count++;
            //i+1+count is used because index of the operator is in between two numbers meaning it is after the first index in num array so i+1 and because array keeps increasing, we do +count for the other operators to be placed in
        }

        this.exp = new String[exp.size()]; // we change the arraylist exp to instance array for faster operations later on
        System.out.print("Test to check if expression is converted into array as intented: ");
        for(int i = 0; i<this.exp.length;i++)
        {
            this.exp[i] = exp.get(i);
            System.out.print(this.exp[i]);
        }
        System.out.println();

    }

    public void postfix()
    {

        for(int i = 0; i < exp.length; i++)
        {
            if(i%2 == 0)//since operands are observed to always have even index in the array
            {
                post_fix.add(exp[i]);
                System.out.println(post_fix);
            }
            else
            {
                boolean x = !ope.empty();
                System.out.println("Test of !ope.empty: " + x);
                while(!ope.empty()&& HasHigherPrecedence(ope.peek(), this.exp[i]))
                {
                    post_fix.add(ope.peek());
                    ope.pop();

                }
                ope.push(exp[i]);
                System.out.println("stack_top: "+ ope.peek());
            }

        }
        while(!ope.empty())
        {

            post_fix.add(ope.peek());
            ope.pop();
        }
        System.out.println("Output: " +post_fix);

    }

    public String getPost_fix()
    {
        String temp = "";
        for(int i =0; i < exp.length;i++)
        {
            temp = temp + post_fix.get(i);
        }

        return temp;
    }

    public double evaluate()
    {
        return 0;
    }

    private boolean HasHigherPrecedence(String op1, String op2)
    {
        //op1 is operator 1 at the top of the stack thus associativity highest
        int a_op1 = 1;
        int a_op2 = 0;

        int p_op1 = 0;
        int p_op2= 0;
        //the precedence will be measured with numbers
        String operators[]= {"","+","-","*","/"};
        int precedence[] = {0,1,1,2,2}; //the reason for blank operator and 0 precedence is because the stack initially will be empty
        for(int i = 0; i< operators.length;i++)
        {
            if(op1.equals(operators[i]))
            {
                p_op1=precedence[i];
            }
        }
        for(int i = 0; i< operators.length;i++)
        {
            if(op2.equals(operators[i]))
            {
                p_op2=precedence[i];
            }
        }

        boolean higher_ornot = false;

        if(p_op1 > p_op2)
        {
            higher_ornot = false;
        }
        else if(p_op1 < p_op1)
        {
            higher_ornot = true;
        }
        else if(p_op1== p_op2)
        {
        System.out.println(op1+": "+p_op1);
        System.out.println(op2+": "+p_op2);
            higher_ornot = false; //since associativity of op1 will be higher --> thus higher precedence
        }

        return higher_ornot;
    }

}

I am trying to converst user's infix mathmatical expression into a postfix expression in an array that will be evaluated but before evaluation, I faced a problem in the postfix method

while(!ope.empty()&& HasHigherPrecedence(ope.peek(), this.exp[i]))

This specific line is not being called out when the condition should be true, when it is comparing top of the stack which is * to - and * has higher precedence and since stack is not empty thus it should return true thus the function is called. I tested if I have any errors other areas but everything I tested was correct, I really have  no clue how to fix.

I am really clueless even after 1hour and a half staring and trying to trace the code

I am expecting from output to be
[3, 2, 4, *, +, 3, -] which is the postfix expression that technically will be evaluated later


问:
bootstrap 4 navbar not squooshing when page is narrowed
I'm so novice I'm not even sure of the terms and definitions.

All was working well, but I clearly broke something.

When I narrow the page completely, it is fine. When I expand completely, it is fine. But a few stages in between, the navbar dropdowns exceed the container and fly out to the right.

I did not alter any of the @media parameter that were prefabbed in this dreamweaver set up.

.nav {
  display: -ms-flexbox;
  display: flex;
  -ms-flex-wrap: wrap;
  flex-wrap: wrap;
  padding-left: 0;
  margin-bottom: 0;
  list-style: none;
}

.nav-link {
  color: #FFCC00!important;
  display: block;
  padding: 0.5rem 1rem;
}

.nav-link:hover, .nav-link:focus {
    color: #33ccff!important;
  text-decoration: none;
}

.nav-link.disabled {
  color: #6c757d;
  pointer-events: none;
  cursor: default;
}

.nav-tabs {
  border-bottom: 1px solid #dee2e6;
}

.nav-tabs .nav-item {
  margin-bottom: -1px;
}

.nav-tabs .nav-link {
  border: 1px solid transparent;
  border-top-left-radius: 0.25rem;
  border-top-right-radius: 0.25rem;
}

.nav-tabs .nav-link:hover, .nav-tabs .nav-link:focus {
  border-color: #e9ecef #e9ecef #dee2e6;
}

.nav-tabs .nav-link.disabled {
  color: #6c757d;
  background-color: transparent;
  border-color: transparent;
}

.nav-tabs .nav-link.active,
.nav-tabs .nav-item.show .nav-link {
  color: #495057;
  background-color: #fff;
  border-color: #dee2e6 #dee2e6 #fff;
}

.nav-tabs .dropdown-menu {
  margin-top: -1px;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.nav-pills .nav-link {
  border-radius: 0.25rem;
}

.nav-pills .nav-link.active,
.nav-pills .show > .nav-link {
  color: #fff;
  background-color: #007bff;
}

.nav-fill .nav-item {
  -ms-flex: 1 1 auto;
  flex: 1 1 auto;
  text-align: center;
}

.nav-justified .nav-item {
  -ms-flex-preferred-size: 0;
  flex-basis: 0;
  -ms-flex-positive: 1;
  flex-grow: 1;
  text-align: center;
}

.tab-content > .tab-pane {
  display: none;
}

.tab-content > .active {
  display: block;
}

.navbar {
  position: relative;
  display: -ms-flexbox;
  display: flex;
  -ms-flex-wrap: wrap;
  flex-wrap: wrap;
  -ms-flex-align: center;
  align-items: center;
  -ms-flex-pack: justify;
  justify-content: space-between;
  padding: 0.5rem 1rem;
}

.navbar .container,
.navbar .container-fluid, .navbar .container-sm, .navbar .container-md, .navbar .container-lg, .navbar .container-xl {
  display: -ms-flexbox;
  display: flex;
  -ms-flex-wrap: wrap;
  flex-wrap: wrap;
  -ms-flex-align: center;
  align-items: center;
  -ms-flex-pack: justify;
  justify-content: space-between;
}

.navbar-custom {
    background-color: #0a0a0a;
}
/* change the brand and text color */

.navbar-custom .navbar-brand,
.navbar-custom .navbar-text {
    color: rgba(243, 203, 4, 1);
}
/* change the link color */
.navbar-custom .navbar-nav .nav-link {
    color: rgba(255,255,255,.5);
}
/* change the color of active or hovered links */
.navbar-custom .nav-item.active .nav-link,
.navbar-custom .nav-item:hover .nav-link {
    color: #33ccff;
}
.navbar-brand {
  display: inline-block;
  padding-top: 0.3125rem;
  padding-bottom: 0.3125rem;
  margin-right: 1rem;
  font-size: 1.25rem;
  line-height: inherit;
  white-space: nowrap;
}

.navbar-brand:hover, .navbar-brand:focus {
  text-decoration: none;
}

.navbar-nav {
  display: -ms-flexbox;
  display: flex;
  -ms-flex-direction: column;
  flex-direction: column;
  padding-left: 0;
  margin-bottom: 0;
  list-style: none;
}

.navbar-nav .nav-link {
  padding-right: 0;
  padding-left: 0;
}

.navbar-nav .dropdown-menu {
  position: static;
  float: none;
}

.navbar-text {
  display: inline-block;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

.navbar-collapse {
  -ms-flex-preferred-size: 100%;
  flex-basis: 100%;
  -ms-flex-positive: 1;
  flex-grow: 1;
  -ms-flex-align: center;
  align-items: center;
}

.custom-toggler .navbar-toggler {
   color: rgba(255, 255, 255, 0.5);
   border-color: #f3cb06;
   background-color: #0A0A0A;
    text-align: center
}

.custom-toggler .navbar-toggler-icon {
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke='rgba(243,203,6,1)' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 8h24M4 16h24M4 24h24'/%3E%3C/svg%3E");
}

/*change toggler color*/

.custom-toggler.navbar-toggler {
    border-color: #ffcc00;
    text-align: center;
}

/*end change toggler color but I need to change the toggler bg color*/

.navbar-toggler {
  padding: 0.25rem 0.75rem;
  font-size: 1.25rem;
  line-height: 1;
  background-color: transparent;
  border: 1px solid transparent;
  border-radius: 0.25rem;
}

.navbar-toggler:hover, .navbar-toggler:focus {
  text-decoration: none;
}

.navbar-toggler-icon {
  display: inline-block;
  width: 1.5em;
  height: 1.5em;
  vertical-align: middle;
  content: "";
  background: no-repeat center center;
  background-size: 100% 100%;```
<pre class="snippet-code-html lang-html prettyprint-override"><code> <div class="container-align align-content-center">

      <div class="container align-content-center"><img src="images/CDBanner.png" alt="" width="100%" class="img-fluid" lass="img-fluid"/></div>
<div class="container-fluid">
      <div class="container-fluid">

    <div class="container">

    <nav class="navbar navbar-expand-sm bg-custom navbar-custom">

  <nav class="navbar navbar-expand-lg custom-toggler" style="background-color: rgb(10, 10, 10);">

    <button class="navbar-toggler custom-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent1" aria-controls="navbarSupportedContent1" aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> </button>

    <div class="collapse navbar-collapse" id="navbarSupportedContent1">
      <ul class="navbar-nav mr-auto">
        <li class="nav-item active"> Home<span class="sr-only">(current)</span> </li>

        <li class="nav-item dropdown"> Posters
          <div class="dropdown-menu" aria-labelledby="navbarDropdown1"> QI Posters Case Studies Posters

          </div>
        </li>
        <li class="nav-item dropdown"> Booklets &  Brochures
          <div class="dropdown-menu" aria-labelledby="navbarDropdown1">Booklets
            Brochures</div>
        </li>
        <li class="nav-item dropdown"> Logos & Illustrative
          <div class="dropdown-menu" aria-labelledby="navbarDropdown1"> Logos Illustrative
          </div>
        </li>
        <li class="nav-item dropdown"> Motion
          <div class="dropdown-menu" aria-labelledby="navbarDropdown1"> Motion 1 Motion 2

            Motion 3
            Motion 4</div>
        </li>
        <li class="nav-item dropdown"> Social Media
          <div class="dropdown-menu" aria-labelledby="navbarDropdown1"> Before & After Ads FaceBook & Instragram
            YouTube Thumbnails</div>
        </li>
        <li class="nav-item dropdown">  Other
          <div class="dropdown-menu" aria-labelledby="navbarDropdown1"> Other Web Site and UI
            T-Shirts</div>
        </li>
        <li class="nav-item"> </li>
      </ul>
    </div>
  </nav>
    </div></code>```

I have been trying to center this navbar. It was centered navigation flying out to rightat one time and I don't know where that went.

But this is not coded the way the bootstrap site advises. I think I'm unwilling to redo it.

navigation expanded beyond container

Body:
I'm so novice I'm not even sure of the terms and definitions.

All was working well, but I clearly broke something.

When I narrow the page completely, it is fine. When I expand completely, it is fine. But a few stages in between, the navbar dropdowns exceed the container and fly out to the right.

I did not alter any of the @media parameter that were prefabbed in this dreamweaver set up.

.nav {
  display: -ms-flexbox;
  display: flex;
  -ms-flex-wrap: wrap;
  flex-wrap: wrap;
  padding-left: 0;
  margin-bottom: 0;
  list-style: none;
}

.nav-link {
  color: #FFCC00!important;
  display: block;
  padding: 0.5rem 1rem;
}

.nav-link:hover, .nav-link:focus {
    color: #33ccff!important;
  text-decoration: none;
}

.nav-link.disabled {
  color: #6c757d;
  pointer-events: none;
  cursor: default;
}

.nav-tabs {
  border-bottom: 1px solid #dee2e6;
}

.nav-tabs .nav-item {
  margin-bottom: -1px;
}

.nav-tabs .nav-link {
  border: 1px solid transparent;
  border-top-left-radius: 0.25rem;
  border-top-right-radius: 0.25rem;
}

.nav-tabs .nav-link:hover, .nav-tabs .nav-link:focus {
  border-color: #e9ecef #e9ecef #dee2e6;
}

.nav-tabs .nav-link.disabled {
  color: #6c757d;
  background-color: transparent;
  border-color: transparent;
}

.nav-tabs .nav-link.active,
.nav-tabs .nav-item.show .nav-link {
  color: #495057;
  background-color: #fff;
  border-color: #dee2e6 #dee2e6 #fff;
}

.nav-tabs .dropdown-menu {
  margin-top: -1px;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.nav-pills .nav-link {
  border-radius: 0.25rem;
}

.nav-pills .nav-link.active,
.nav-pills .show > .nav-link {
  color: #fff;
  background-color: #007bff;
}

.nav-fill .nav-item {
  -ms-flex: 1 1 auto;
  flex: 1 1 auto;
  text-align: center;
}

.nav-justified .nav-item {
  -ms-flex-preferred-size: 0;
  flex-basis: 0;
  -ms-flex-positive: 1;
  flex-grow: 1;
  text-align: center;
}

.tab-content > .tab-pane {
  display: none;
}

.tab-content > .active {
  display: block;
}

.navbar {
  position: relative;
  display: -ms-flexbox;
  display: flex;
  -ms-flex-wrap: wrap;
  flex-wrap: wrap;
  -ms-flex-align: center;
  align-items: center;
  -ms-flex-pack: justify;
  justify-content: space-between;
  padding: 0.5rem 1rem;
}

.navbar .container,
.navbar .container-fluid, .navbar .container-sm, .navbar .container-md, .navbar .container-lg, .navbar .container-xl {
  display: -ms-flexbox;
  display: flex;
  -ms-flex-wrap: wrap;
  flex-wrap: wrap;
  -ms-flex-align: center;
  align-items: center;
  -ms-flex-pack: justify;
  justify-content: space-between;
}

.navbar-custom {
    background-color: #0a0a0a;
}
/* change the brand and text color */

.navbar-custom .navbar-brand,
.navbar-custom .navbar-text {
    color: rgba(243, 203, 4, 1);
}
/* change the link color */
.navbar-custom .navbar-nav .nav-link {
    color: rgba(255,255,255,.5);
}
/* change the color of active or hovered links */
.navbar-custom .nav-item.active .nav-link,
.navbar-custom .nav-item:hover .nav-link {
    color: #33ccff;
}
.navbar-brand {
  display: inline-block;
  padding-top: 0.3125rem;
  padding-bottom: 0.3125rem;
  margin-right: 1rem;
  font-size: 1.25rem;
  line-height: inherit;
  white-space: nowrap;
}

.navbar-brand:hover, .navbar-brand:focus {
  text-decoration: none;
}

.navbar-nav {
  display: -ms-flexbox;
  display: flex;
  -ms-flex-direction: column;
  flex-direction: column;
  padding-left: 0;
  margin-bottom: 0;
  list-style: none;
}

.navbar-nav .nav-link {
  padding-right: 0;
  padding-left: 0;
}

.navbar-nav .dropdown-menu {
  position: static;
  float: none;
}

.navbar-text {
  display: inline-block;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

.navbar-collapse {
  -ms-flex-preferred-size: 100%;
  flex-basis: 100%;
  -ms-flex-positive: 1;
  flex-grow: 1;
  -ms-flex-align: center;
  align-items: center;
}

.custom-toggler .navbar-toggler {
   color: rgba(255, 255, 255, 0.5);
   border-color: #f3cb06;
   background-color: #0A0A0A;
    text-align: center
}

.custom-toggler .navbar-toggler-icon {
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke='rgba(243,203,6,1)' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 8h24M4 16h24M4 24h24'/%3E%3C/svg%3E");
}

/*change toggler color*/

.custom-toggler.navbar-toggler {
    border-color: #ffcc00;
    text-align: center;
}

/*end change toggler color but I need to change the toggler bg color*/

.navbar-toggler {
  padding: 0.25rem 0.75rem;
  font-size: 1.25rem;
  line-height: 1;
  background-color: transparent;
  border: 1px solid transparent;
  border-radius: 0.25rem;
}

.navbar-toggler:hover, .navbar-toggler:focus {
  text-decoration: none;
}

.navbar-toggler-icon {
  display: inline-block;
  width: 1.5em;
  height: 1.5em;
  vertical-align: middle;
  content: "";
  background: no-repeat center center;
  background-size: 100% 100%;

    <button class="navbar-toggler custom-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent1" aria-controls="navbarSupportedContent1" aria-expanded="false" aria-label="Toggle navigation">  </button>

 Home(current)

 Posters

 QI Posters Case Studies Posters

 Booklets &  Brochures

Booklets
            Brochures

 Logos & Illustrative

 Logos Illustrative

 Motion

 Motion 1 Motion 2

            Motion 3
            Motion 4

 Social Media

 Before & After Ads FaceBook & Instragram
            YouTube Thumbnails

  Other

 Other Web Site and UI
            T-Shirts

I have been trying to center this navbar. It was centered navigation flying out to rightat one time and I don't know where that went.

But this is not coded the way the bootstrap site advises. I think I'm unwilling to redo it.

navigation expanded beyond container


问:
How can i put space between 2 Words
I am Working on a Factory System.
I use PHP Word for Generate Price List from a Database
No i Need something like -> Article_Name  (5 Times Tab Space) Price
And what i have is -> Article_Name Price
How can i put the white space between the words

All my PHP Word Code is this:

$image_array = array(
      "widht" => 90,
      "height" => 100
  );

  $phpWortd = new \PhpOffice\PhpWord\PhpWord();
  $phpWortd->setDefaultFontSize(24);
  $phpWortd->setDefaultFontName('calibri');

  $image_section = $phpWortd->addSection();
  $image_section->addImage("./formulare/kahtrin_salon.jpg", $image_array);

  $text_section = $phpWortd->addSection();

  for($i =0; $i < count($query); $i++){
    $text_section->addText($query[$i]['art_name']." ".$query[$i]['art_price']);

  };

  $saveasHTML = \PhpOffice\PhpWord\IOFactory::createWriter($phpWortd, "HTML");
  $saveasHTML->save("./formulare/preise.html");
}
```

I search on Google few Hours an i Read the Documentation of PHP Word a lot of times

Title: How can i put space between 2 Words

Body:
I am Working on a Factory System.
I use PHP Word for Generate Price List from a Database
No i Need something like -> Article_Name  (5 Times Tab Space) Price
And what i have is -> Article_Name Price
How can i put the white space between the words

All my PHP Word Code is this:

$image_array = array(
      "widht" => 90,
      "height" => 100
  );

  $phpWortd = new \PhpOffice\PhpWord\PhpWord();
  $phpWortd->setDefaultFontSize(24);
  $phpWortd->setDefaultFontName('calibri');

  $image_section = $phpWortd->addSection();
  $image_section->addImage("./formulare/kahtrin_salon.jpg", $image_array);

  $text_section = $phpWortd->addSection();

  for($i =0; $i < count($query); $i++){
    $text_section->addText($query[$i]['art_name']." ".$query[$i]['art_price']);

  };

  $saveasHTML = \PhpOffice\PhpWord\IOFactory::createWriter($phpWortd, "HTML");
  $saveasHTML->save("./formulare/preise.html");
}

I search on Google few Hours an i Read the Documentation of PHP Word a lot of times


问:
Hyper-tuning of SVM regressor using Grid search and cuML
I tried tuning the SVM regressor parameters using the code below. However, during the search for the best params, the grid-search model tends to choose the first kernel of the model within the proposed kernels, every time. I tried different combinations to see if I could reach good results.

I attempted to use various cross-validations(3, 5-default, 7).

I used/removed the score function of the GridSearch model, to see if this impact.

I also tried with higher values of the penalty score (see the attached).

Please can anyone confirm this?

And is the kernels' order in the list/Grid params impact the search?

Note: I used the cuML to benefit from using the GPU and to speed up the search.
I can send you the dataset if you want

```<code>from cuml.svm import SVR
from sklearn.model_selection import GridSearchCV
#from sklearn.svm import SVR
from sklearn.metrics import make_scorer, mean_squared_error
from pprint import pprint

# Hyper-tunning for SVM regressor

import numpy as np

base_svr = SVR()
# If you want to use your custom score function, specify the function and use it.
def my_rmse_loss_func(y_true, y_pred):
    return np.sqrt(mean_squared_error((y_true, y_pred)))

scorer = make_scorer(mean_squared_error, greater_is_better=False)#,, squared = False

param_grid_svr = {'C': [0.0001, 0.01, 0.1, 0.9,1, 1.1, 2,3], # I used 10, 100
              'gamma': ['scale', 'auto'],
              'kernel': ['rbf', 'poly', 'sigmoid', 'precomputed','linear'], #,
              'epsilon': [0.01, 0.1, 0.2 ,0.22, 0.3, 1]}
# Create a GridSearchCV object and fit it to the training data with 7 cv

svr_cv = GridSearchCV(base_svr,param_grid_svr, n_jobs = -1 , # Use 4
                         scoring='neg_mean_squared_error', cv = 7 ,verbose=3 ,return_train_score =True  ) # ,refit=True mean_squared_error, scoring='neg_mean_squared_error' ,

# Train the model in GPU

svr_cv.fit(X_train,y_train)

# Predictions
## By using the re-trained model
predictions_RF_regr_tuned= svr_cu.predict(X_test)

</code>```

Body:
I tried tuning the SVM regressor parameters using the code below. However, during the search for the best params, the grid-search model tends to choose the first kernel of the model within the proposed kernels, every time. I tried different combinations to see if I could reach good results.

I attempted to use various cross-validations(3, 5-default, 7).

I used/removed the score function of the GridSearch model, to see if this impact.

I also tried with higher values of the penalty score (see the attached).

Please can anyone confirm this?

And is the kernels' order in the list/Grid params impact the search?

Note: I used the cuML to benefit from using the GPU and to speed up the search.
I can send you the dataset if you want

from cuml.svm import SVR
from sklearn.model_selection import GridSearchCV
#from sklearn.svm import SVR
from sklearn.metrics import make_scorer, mean_squared_error
from pprint import pprint

# Hyper-tunning for SVM regressor

import numpy as np

base_svr = SVR()
# If you want to use your custom score function, specify the function and use it.
def my_rmse_loss_func(y_true, y_pred):
    return np.sqrt(mean_squared_error((y_true, y_pred)))

scorer = make_scorer(mean_squared_error, greater_is_better=False)#,, squared = False

param_grid_svr = {'C': [0.0001, 0.01, 0.1, 0.9,1, 1.1, 2,3], # I used 10, 100
              'gamma': ['scale', 'auto'],
              'kernel': ['rbf', 'poly', 'sigmoid', 'precomputed','linear'], #,
              'epsilon': [0.01, 0.1, 0.2 ,0.22, 0.3, 1]}
# Create a GridSearchCV object and fit it to the training data with 7 cv

svr_cv = GridSearchCV(base_svr,param_grid_svr, n_jobs = -1 , # Use 4
                         scoring='neg_mean_squared_error', cv = 7 ,verbose=3 ,return_train_score =True  ) # ,refit=True mean_squared_error, scoring='neg_mean_squared_error' ,

# Train the model in GPU

svr_cv.fit(X_train,y_train)

# Predictions
## By using the re-trained model
predictions_RF_regr_tuned= svr_cu.predict(X_test)