问:
Twitter embed in a Chrome Extension with Manifest V3
I'd like to know if it's still possible to embed a Twitter Timelines in a Chrome Extension with a Manifest v3.

I tried to use from the Twitter docs :

```<code><a class="twitter-timeline" href="https://twitter.com/TwitterDev?ref_src=twsrc%5Etfw">Tweets by TwitterDev</a> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
</code>```

But I get errors :

```<code>Refused to load the script 'https://platform.twitter.com/widgets.js' because it violates the following Content Security Policy directive: "script-src 'self'". Note that 'script-src-elem' was not explicitly set, so 'script-src' is used as a fallback.
</code>```
```<code>Refused to load the script 'https://platform.twitter.com/widgets.js' because it violates the following Content Security Policy directive: "script-src 'self' 'wasm-unsafe-eval'". Note that 'script-src-elem' was not explicitly set, so 'script-src' is used as a fallback.
</code>```

The problem if I understood correctly is that with manifest v3 it's not possible to use external scripts.

What are the possible solutions to embed a Twitter Timeline in a Chrome Extension ?

Thanks !

Body:
I'd like to know if it's still possible to embed a Twitter Timelines in a Chrome Extension with a Manifest v3.

I tried to use from the Twitter docs :

Tweets by TwitterDev

But I get errors :

Refused to load the script 'https://platform.twitter.com/widgets.js' because it violates the following Content Security Policy directive: "script-src 'self'". Note that 'script-src-elem' was not explicitly set, so 'script-src' is used as a fallback.

Refused to load the script 'https://platform.twitter.com/widgets.js' because it violates the following Content Security Policy directive: "script-src 'self' 'wasm-unsafe-eval'". Note that 'script-src-elem' was not explicitly set, so 'script-src' is used as a fallback.

The problem if I understood correctly is that with manifest v3 it's not possible to use external scripts.

What are the possible solutions to embed a Twitter Timeline in a Chrome Extension ?

Thanks !


来源: stackexchange

问:
Maui Shell Uri Navigation, Multiplate pages on stack and backwards navigation
I am developing a warehouse management application using Maui.
At the moment, I am using the GoToAsync method to navigate between pages, however, I have encountered a problem.

The structure of my pages:

Main menu with several buttons, select the first one:

Location ->

search location ->(after scanning the code)
3.List of products on the location ->(after selecting the product)
4.List with operations to perform (each one displays a different page) -> select the first one
5.Move the product to another location
etc.
Depending on the button selected in point 4, a different number of pages can be put on the stack, for example, after selecting the operation in point 5, 3 or 4 or 5 more pages can be put on the stack.

This is how I register my pages:
      Routing.RegisterRoute(nameof(MenuPage), typeof(MenuPage)); Routing.RegisterRoute(nameof(ProductSearchPage), typeof(ProductSearchPage)); Routing.RegisterRoute(nameof(ProductListPage), typeof(ProductListPage)); Routing.RegisterRoute(nameof(ProductDetailsPage), typeof(ProductDetailsPage));

So as you can see I don't create a hierarchy of Uri addresses e.g. Page1/Page2/Page3 because, pages like the code finder, or the product list can be accessed from different places in the program.

What I'm trying to do is go back to one of the pages set aside on the stack. In the example given above, I would like each operation selected in item 4 to, in effect, backtrack me to the list of products from level 3. I am unable to determine this using GoToAsync("../../../...") because I do not know how many pages have been set aside.

I would also like to mention that a page like a search engine or a list sends a message about the selected code or item has a list, and this is handled on one of the pages on the stack ( that is why I do not know how many pages I have to backtrack)

I tried GoToAsync(Page3) however it takes me to a new instance of that page, and additionally puts another page back on the stack.
Any ideas how I could approach such an issue?
Is Shell Uri navigation the right mechanism for this type of project?

ContentLicense: CC BY-SA 4.0


问:
Victory Charts - Combine more than two containers in createContainer
Is it possible to combine more than two containers in createContainer, or do it some other way?

Right now, I'm using createContainer("zoom", "voronoi"), but I would to add the cursor on mouseover. The problem is that if I switch to createContainer("zoom", "cursor") I lose the tooltip I'm using when moving around the graph.

Does anyone have a solution or is it currently not feasible to do this?


问:
iOS SwiftUI WidgetKit: My widgets don’t show up in the ‘Add Widgets’ section
I developed an app with 10 widgets but some iPhone, iPad or macOS users report that my widgets or the "App Name" don't appear in the widgets list when they tried to add the widgets of my app.

There's no way I can replicate the problem, but the number of the users that report this issue is growing up every day.

It’s not clear if the problem is caused by the iPhone model, a crash on the widget preview or other factors.

My widgets previews are built reading static data, so this data is the same in every conditions.

I suggest my users to do the following steps:

Start the app and go to check again if "App name" appears among widget List

Close every app and restart the device; then start the app and
go to check again if "App name" appears among widget List

Temporarily change system language and turn on Bold Text and go to check again if "App Name" appears among widget List

Uninstall and reinstall the app, start the app and go to check again if "App Name" appears among widget List

But all users who have tried these steps say that the app still does not appear in the list of widgets.

The following code is the one I use inside the main widgets swift file called TodayWidgetExtension:

```<code>import WidgetKit
import SwiftUI

struct PlaceholderView : View {
    var body: some View {
        Text("loading")
    }
}

//MARK: - Main widget bundle configuration
@main
struct WidgetBundle: WidgetBundle {
    @WidgetBundleBuilder
    var body: some Widget {

//MARK: - 1
        Widget1Large() //IntentConfiguration
        Widget1Medium() //StaticConfiguration
        Widget1Small() //StaticConfiguration
        if #available(iOSApplicationExtension 16.0, *) {
            Widget1Accessory() //StaticConfiguration
        }

//MARK: - 2
        Widget2Large() //StaticConfiguration

//MARK: - 3
        #if !targetEnvironment(macCatalyst)
        Widget3Medium() //StaticConfiguration
        #endif

//MARK: - 4
        Widget4Large() //StaticConfiguratio

//MARK: - 5
        Widget5Medium() //IntentConfiguration

//MARK: - 6
        Widget6Large() //IntentConfiguration
        Widget6Medium() //IntentConfiguration

    }
}

struct todaywidgetextension_Previews: PreviewProvider {
    static var previews: some View {
        PlaceholderView()
            .previewContext(WidgetPreviewContext(family: .systemSmall))
    }
}
</code>```

The only thing that I've noticed debugging the widgets extension is that, even if I don't add any of them to my iPhone screen, Xcode tells me that widgets occupied 20mb of memory (the limit for widgets is 30mb). I tried removing all the widgets from the above code leaving only one (Widget1Small for example), but Xcode continues to tell me that 20mb of memory are still occupied.

I hope that someone can help me.
Thank you.

Body:
I developed an app with 10 widgets but some iPhone, iPad or macOS users report that my widgets or the "App Name" don't appear in the widgets list when they tried to add the widgets of my app.

There's no way I can replicate the problem, but the number of the users that report this issue is growing up every day.

It’s not clear if the problem is caused by the iPhone model, a crash on the widget preview or other factors.

My widgets previews are built reading static data, so this data is the same in every conditions.

I suggest my users to do the following steps:

Start the app and go to check again if "App name" appears among widget List

Close every app and restart the device; then start the app and
go to check again if "App name" appears among widget List

Temporarily change system language and turn on Bold Text and go to check again if "App Name" appears among widget List

Uninstall and reinstall the app, start the app and go to check again if "App Name" appears among widget List

But all users who have tried these steps say that the app still does not appear in the list of widgets.

The following code is the one I use inside the main widgets swift file called TodayWidgetExtension:

import WidgetKit
import SwiftUI

struct PlaceholderView : View {
    var body: some View {
        Text("loading")
    }
}

//MARK: - Main widget bundle configuration
@main
struct WidgetBundle: WidgetBundle {
    @WidgetBundleBuilder
    var body: some Widget {

//MARK: - 1
        Widget1Large() //IntentConfiguration
        Widget1Medium() //StaticConfiguration
        Widget1Small() //StaticConfiguration
        if #available(iOSApplicationExtension 16.0, *) {
            Widget1Accessory() //StaticConfiguration
        }

//MARK: - 2
        Widget2Large() //StaticConfiguration

//MARK: - 3
        #if !targetEnvironment(macCatalyst)
        Widget3Medium() //StaticConfiguration
        #endif

//MARK: - 4
        Widget4Large() //StaticConfiguratio

//MARK: - 5
        Widget5Medium() //IntentConfiguration

//MARK: - 6
        Widget6Large() //IntentConfiguration
        Widget6Medium() //IntentConfiguration

    }
}

struct todaywidgetextension_Previews: PreviewProvider {
    static var previews: some View {
        PlaceholderView()
            .previewContext(WidgetPreviewContext(family: .systemSmall))
    }
}

The only thing that I've noticed debugging the widgets extension is that, even if I don't add any of them to my iPhone screen, Xcode tells me that widgets occupied 20mb of memory (the limit for widgets is 30mb). I tried removing all the widgets from the above code leaving only one (Widget1Small for example), but Xcode continues to tell me that 20mb of memory are still occupied.

I hope that someone can help me.
Thank you.


问:
Ffmpeg rebroadcast icecast stream and disconnect on silence
Currently, I'm using a combination of the Windows version of butt and VLC Media Player in order to rebroadcast an icecast stream from a remote icecast server to my local icecast server, whilst disconnecting whenever a certain duration of silence is detected.

I would really prefer if there would be an easier way to do this on linux from the command line, so that it can run 24/7 without me having to constantly fix the VLC stream player every so often.

I need a way for if silence is detected on the stream, it disconnects the relay and will reconnect whenever audio is detected again.

As I've said before, I've been successfully using butt and VLC Media Player on Windows to do this, however would prefer a linux alternative.


问:
Angular [CDK v12+] cant find a proper replacement for "enter" deprecated function in drag and drop CDK
```<code>this.placeholder.enter(
  drag,
  drag.element.nativeElement.offsetLeft,
  drag.element.nativeElement.offsetTop
);
</code>```

error: Property 'enter' does not exist on type 'CdkDropList'

I wish to transfer this functionality to the latest CDK version without losing the functionality.

when i switch back and forth between version i notice that the behavior of cdkDropListEnterPredicate is not working as its use to.

in v9 cdkDropListEnterPredicate is calling the functions every pixel but for v 12 the behavior has changed.

to see the error in action go to the package.json and change the from "@angular/cdk": "9.1.2" to: "@angular/cdk": "12.2.13".I have tried to use dragRef and dropListRef but failed.

```<code>      this.placeholder._dropListRef.enter(
            drag._dragRef,
            drag.element.nativeElement.offsetLeft,
            drag.element.nativeElement.offsetTop
        );
</code>```

Body:
this.placeholder.enter(
  drag,
  drag.element.nativeElement.offsetLeft,
  drag.element.nativeElement.offsetTop
);

error: Property 'enter' does not exist on type 'CdkDropList'

I wish to transfer this functionality to the latest CDK version without losing the functionality.

when i switch back and forth between version i notice that the behavior of cdkDropListEnterPredicate is not working as its use to.

in v9 cdkDropListEnterPredicate is calling the functions every pixel but for v 12 the behavior has changed.

to see the error in action go to the package.json and change the from "@angular/cdk": "9.1.2" to: "@angular/cdk": "12.2.13".I have tried to use dragRef and dropListRef but failed.

      this.placeholder._dropListRef.enter(
            drag._dragRef,
            drag.element.nativeElement.offsetLeft,
            drag.element.nativeElement.offsetTop
        );


问:
Allow dirty reads of rows changed by certain transaction
I have a transaction which changes data in Sql Server 2008 database.
Is there are any way to allow reading of dirty data for concurrent transactions?

I know I can avoid blocking of tables on database level by using of the following code:

```<code>ALTER DATABASE AdventureWorks
    SET READ_COMMITTED_SNAPSHOT ON;
</code>```

But I want to allow dirty reads of rows changed only by one certain transaction.
Is that possible?

ContentLicense: CC BY-SA 3.0

Body:
I have a transaction which changes data in Sql Server 2008 database.
Is there are any way to allow reading of dirty data for concurrent transactions?

I know I can avoid blocking of tables on database level by using of the following code:

ALTER DATABASE AdventureWorks
    SET READ_COMMITTED_SNAPSHOT ON;

But I want to allow dirty reads of rows changed only by one certain transaction.
Is that possible?


问:
Minimum normal form of a relation with all prime attributes
If all the attributes of a relation are prime (part of a candidate key), which normal form would it be at least? 1NF, 2NF, 3NF or BCNF.

The question was already solved in slides as BCNF, but I don't understand why BCNF and not 3nf.


问:
Why is there a shift in the calendar number on click or selection?
When I open the datepicker, the selected date is shifted to the left. Searching at the CSS level and inspecting the HTML, couldn't find the error. There is a suspicious behavior during the click, a before appears whereas on the example of material, there is nothing.

I want to fix and understand this bug. Has anyone ever faced this kind of problem?


问:
Invalid datetime format: 7 ERROR: invalid input syntax for type date in laravel
I am getting the error in the title when retrieving records from postgres using laravel's query builder.

The source code is below.

```<code>AvailableReservationDatetime::query()
            ->select(DB::raw('
            available_date
            ,array_agg(available_time) available_times
        '))
            ->whereNotExists(function($query) {
            $query->select(DB::raw(1))
                ->from('reservations')
                ->where('reservation_date', 'available_date')
                ->whereBetween('available_time', ['reservation_time', 'end_time']);
        })
            ->groupBy('available_date')
            ->get();
</code>```

The error is in both arguments of the where function in the callback function within the whereNotExist function.

For your information, the middle SQL is as follows.

```<code>select available_date ,array_agg(available_time) available_times from "available_reservation_datetimes" where not exists (select 1 from "reservations" where "reservation_date" = available_date and "available_time" between reservation_time and end_time) group by "available_date"
</code>```

Curiously, when the above SQL is executed directly in postgres without laravel, the records are successfully retrieved.

Why does this happen? I assume it has something to do with the functionality of laravel.

I would like to add that the query can be executed successfully if the type is converted as follows.

```<code>AvailableReservationDatetime::query()
            ->select(DB::raw('
            available_date
            ,array_agg(available_time) available_times
        '))
            ->whereNotExists(function($query) {
            $query->select(DB::raw(1))
                ->from('reservations')
                ->whereRaw('CAST(available_date AS DATE) = CAST(reservation_date AS DATE)')
                ->whereRaw('CAST(available_time AS TIME) BETWEEN CAST(reservation_time AS TIME) AND CAST(end_time AS TIME)');
            })
            ->groupBy('available_date')
            ->get();
</code>```

Body:
I am getting the error in the title when retrieving records from postgres using laravel's query builder.

The source code is below.

AvailableReservationDatetime::query()
            ->select(DB::raw('
            available_date
            ,array_agg(available_time) available_times
        '))
            ->whereNotExists(function($query) {
            $query->select(DB::raw(1))
                ->from('reservations')
                ->where('reservation_date', 'available_date')
                ->whereBetween('available_time', ['reservation_time', 'end_time']);
        })
            ->groupBy('available_date')
            ->get();

The error is in both arguments of the where function in the callback function within the whereNotExist function.

For your information, the middle SQL is as follows.

select available_date ,array_agg(available_time) available_times from "available_reservation_datetimes" where not exists (select 1 from "reservations" where "reservation_date" = available_date and "available_time" between reservation_time and end_time) group by "available_date"

Curiously, when the above SQL is executed directly in postgres without laravel, the records are successfully retrieved.

Why does this happen? I assume it has something to do with the functionality of laravel.

I would like to add that the query can be executed successfully if the type is converted as follows.

AvailableReservationDatetime::query()
            ->select(DB::raw('
            available_date
            ,array_agg(available_time) available_times
        '))
            ->whereNotExists(function($query) {
            $query->select(DB::raw(1))
                ->from('reservations')
                ->whereRaw('CAST(available_date AS DATE) = CAST(reservation_date AS DATE)')
                ->whereRaw('CAST(available_time AS TIME) BETWEEN CAST(reservation_time AS TIME) AND CAST(end_time AS TIME)');
            })
            ->groupBy('available_date')
            ->get();


问:
AttributeError: ' msearch NoneType' object has no attribute 'split'
this is my routes.py file python

```<code>@app.route('/' )
def w_search():
   searchword = request.args.get('q')
   products = AddProduct.query.msearch(searchword, fields=['title'], limit=3)
   return render_template('search.html')
</code>```

and this is my html page

  <form method="GET" action="{{url_for('w_search')}}">

    <input class="form-control me-2" type="search" placeholder="Search" aria-label="Search"  name="q">
    <button class="btn btn-outline-success mt-3" type="submit">Search</button>

  </form>

```
```search = Search()
search.init_app(app)
```

i am trying to search my data but its giving me an error of 'NoneType' object has no attribute 'spli

Body:
this is my routes.py file python

@app.route('/' )
def w_search():
   searchword = request.args.get('q')
   products = AddProduct.query.msearch(searchword, fields=['title'], limit=3)
   return render_template('search.html')

and this is my html page

  <form method="GET" action="{{url_for('w_search')}}">

    <input class="form-control me-2" type="search" placeholder="Search" aria-label="Search"  name="q">
    <button class="btn btn-outline-success mt-3" type="submit">Search</button>

  </form>

search = Search()
search.init_app(app)

i am trying to search my data but its giving me an error of 'NoneType' object has no attribute 'spli


问:
(Chart.js) Bar chart context.element.height is NaN at initial render
I'm using chart.js and vue-chartjs. (vue version is 2.6)

I want the gradient background color bar chart to match the height of each individual bar.

What I want to achieve like this:
expected results image

I came across this stackoverflow question when I was researching solutions, and wrote the backgroundColor property of datasets with Option Context as follows.

datasets: [
  {
    label: "Data One",
    backgroundColor: (context) => {
      console.log("element", context.element)
      console.log("y", context.element.y)
      console.log("height", context.element.height)

      if (!context.element.y || !context.element.height) {
        return;
      }
      const { ctx } = context.chart;
      const { y, height } = context.element;
      const background_1 = ctx.createLinearGradient(
        0,
        y,
        0,
        y + height
      );

      background_1.addColorStop(0.4, "#55BBDD");
      background_1.addColorStop(1, "#C8E8F6");

      return background_1;
    },
    data: [40, 20, 12, 39, 10, 40, 39, 80, 40, 20, 12, 11],
  },
],
```

Also, I have a codesandbox sample here.

Maybe the first visit will not cause any problems.
But If you reload your browser inside codesandbox, all bars will be black.
And also I'm having the same problem with my own vue app.

unexpected results image

As you can see, console.log("height", context.element.height) outputs NaN at initial render.
So !context.element.height is always true and returns so never goes down.

If you hover each bar, only hovered bar changes to gradient backgroundColor correctly.

Do you have any idea to fix this?

Thank you.

Body:
I'm using chart.js and vue-chartjs. (vue version is 2.6)

I want the gradient background color bar chart to match the height of each individual bar.

What I want to achieve like this:
expected results image

I came across this stackoverflow question when I was researching solutions, and wrote the backgroundColor property of datasets with Option Context as follows.

datasets: [
  {
    label: "Data One",
    backgroundColor: (context) => {
      console.log("element", context.element)
      console.log("y", context.element.y)
      console.log("height", context.element.height)

      if (!context.element.y || !context.element.height) {
        return;
      }
      const { ctx } = context.chart;
      const { y, height } = context.element;
      const background_1 = ctx.createLinearGradient(
        0,
        y,
        0,
        y + height
      );

      background_1.addColorStop(0.4, "#55BBDD");
      background_1.addColorStop(1, "#C8E8F6");

      return background_1;
    },
    data: [40, 20, 12, 39, 10, 40, 39, 80, 40, 20, 12, 11],
  },
],

Also, I have a codesandbox sample here.

Maybe the first visit will not cause any problems.
But If you reload your browser inside codesandbox, all bars will be black.
And also I'm having the same problem with my own vue app.

unexpected results image

As you can see, console.log("height", context.element.height) outputs NaN at initial render.
So !context.element.height is always true and returns so never goes down.

If you hover each bar, only hovered bar changes to gradient backgroundColor correctly.

Do you have any idea to fix this?

Thank you.


问:
How do I record time to results in ImageJ from MicroManager
I don't really know the first thing about programming. I am trying to record the intensity of Fluo-4 (fluochrome) over time from regularly stimulated cardiomyocytes as a yz plot.

Furthermore, I am using MicroManager, which is built on ImageJ and can be scripted to in BeanScript, which resembles java. After a lot of trial and error, I have the following script:

```<code>import ij.*;

numberOfImages = 25;

//the image window must be already open in the GUI (press "Snap Image" at least once) before running this script

IJ.run("Set Measurements...", "integrated redirect=None decimal=3");

for (int i=0; i < numberOfImages; i++)
{
images = mm.live().snap(true);
img = images.get(0);
IJ.run("Measure");
IJ.timeStamp = getTime();
IJ.setResult("Time", i, timeStamp);
Thread.sleep(10);
}
</code>```

My problem is that the two lines to record the time works in ImageJ (if you remove the "IJ." part) but not in BeanScript through MicroManager.

Without those two lines, the script works, except the duration of each for loop varies by some milliseconds, which is what I am trying to account for by recording the time. How do I solve this?

In the script manager window of MicroManager, I get the following error message.

Line 14: evaluation error : Sourced file: inline evaluation of: ``import ij.*;  numberOfImages = 25;  //the image window must be already open in t . . . '' : Field access: bsh.ReflectError: No such field: timeStamp

Body:
I don't really know the first thing about programming. I am trying to record the intensity of Fluo-4 (fluochrome) over time from regularly stimulated cardiomyocytes as a yz plot.

Furthermore, I am using MicroManager, which is built on ImageJ and can be scripted to in BeanScript, which resembles java. After a lot of trial and error, I have the following script:

import ij.*;

numberOfImages = 25;

//the image window must be already open in the GUI (press "Snap Image" at least once) before running this script

IJ.run("Set Measurements...", "integrated redirect=None decimal=3");

for (int i=0; i < numberOfImages; i++)
{
images = mm.live().snap(true);
img = images.get(0);
IJ.run("Measure");
IJ.timeStamp = getTime();
IJ.setResult("Time", i, timeStamp);
Thread.sleep(10);
}

My problem is that the two lines to record the time works in ImageJ (if you remove the "IJ." part) but not in BeanScript through MicroManager.

Without those two lines, the script works, except the duration of each for loop varies by some milliseconds, which is what I am trying to account for by recording the time. How do I solve this?

In the script manager window of MicroManager, I get the following error message.

Line 14: evaluation error : Sourced file: inline evaluation of: ``import ij.*;  numberOfImages = 25;  //the image window must be already open in t . . . '' : Field access: bsh.ReflectError: No such field: timeStamp


问:
Most efficient way to create a Map based on a List, where key is n element, and value is n+1, using Stream API or Guana, Apache Commons etc
I have a list of Strings in exact strict order, which I need to convert to a Map, where key is always going to be an even index, starting from 0 and value is going to be the next element, so list is going to look something like this: [key,value,key,value]. By condition my list has fixed even size, but just to handle case where there is no pair either key or value may be null. It is easy to achieve using standard for loop and put elements based on if condition.

But I am looking for more sophisticated (and short) way to achieve that. Maybe there is some option to group elements by two, and than put them into map as key and value correspondingly. Or maybe some existing solution.

I am grateful for any help.

Here is a piece of code I work with:

```<code>Resource resourceFile = applicationContext.getResource(ALPHA2_MAPPING_CSV);

    var csvRows = CSVReaderUtil.parseFromCSV(resourceFile);

    var alpha3AndAlpha2List = csvRows
        .stream()
        .flatMap(row -> row.getCells().stream())
        .filter(cell -> cell.getHeader().equals("Alpha-2 code") || cell.getHeader().equals("Alpha-3 code"))
        .toList();
</code>```

Body:
I have a list of Strings in exact strict order, which I need to convert to a Map, where key is always going to be an even index, starting from 0 and value is going to be the next element, so list is going to look something like this: [key,value,key,value]. By condition my list has fixed even size, but just to handle case where there is no pair either key or value may be null. It is easy to achieve using standard for loop and put elements based on if condition.

But I am looking for more sophisticated (and short) way to achieve that. Maybe there is some option to group elements by two, and than put them into map as key and value correspondingly. Or maybe some existing solution.

I am grateful for any help.

Here is a piece of code I work with:

Resource resourceFile = applicationContext.getResource(ALPHA2_MAPPING_CSV);

    var csvRows = CSVReaderUtil.parseFromCSV(resourceFile);

    var alpha3AndAlpha2List = csvRows
        .stream()
        .flatMap(row -> row.getCells().stream())
        .filter(cell -> cell.getHeader().equals("Alpha-2 code") || cell.getHeader().equals("Alpha-3 code"))
        .toList();


问:
Refresh indicator doesn't load new post data and doesn't update cache in Flutter
I need that new articles available will be visible in the news page after pull to refresh gesture, but this doesn't happen, and the cache system doesn't update the news page.
I am using File to get Temporary Directory and create a cache, I just need that when I refresh new articles will be showed up on the news page.
How can I solve this issue?
Thank you in advance

Fetch and caching data

```<code>class ApiNewsPage {
  final String url = newsJsonLink;
  Future<List?> getNewsArticles() async {
    String nameDB = "articledata.json";
    var dir = await getTemporaryDirectory();
    File file = File(dir.path + "/" + nameDB);

    if(file.existsSync()) {
      print("Loading Articles from cache");
      var jsonDB = file.readAsStringSync();
      List response = json.decode(jsonDB);
      return response;
    } else {
        var response = await http.get(Uri.parse(url));
        if (response.statusCode == 200) {
          //await File(nameDB).exists();
          var jsonResponse = response.body;
          List newArticles = json.decode(jsonResponse);
          //File(nameDB).deleteSync(recursive: true);
          /// save json in local file
          file.writeAsStringSync(jsonResponse, flush: true, mode: FileMode.write);
          print("Fetching new articles from internet");
          return newArticles;
        }
    }
  }
}

// Create new db
class NewArticlesPage {
  final String url = newsJsonLink;
  Future<List?> updateArticles() async {
    try {
      var response = await http.get(Uri.parse(url));
      if (response.statusCode == 200) {
        print("Fetching new articles from internet");
        return jsonDecode(response.body);
      } else {
        return Future.error("Impossibile ricevere i dati, prova a controllare la connessione");
      }// ignore: non_constant_identifier_names
    } catch (SocketException) {
      return Future.error("Impossibile caricare gli articoli");
    }
  }
}

</code>```

News page to be updated

```<code>class _NewsPageState extends State<NewsPage> {
  /// News service
  final ApiNewsPage categoryNews = ApiNewsPage();
  late bool isLoading;
  /// Start Refresh indicator upload new articles function
  final NewArticlesPage updateArticles = NewArticlesPage();
  ScrollController scrollController = ScrollController();
  //final List<ArticleModel> _posts = [];
  //
  @override
  void initState() {
    super.initState();
    refreshArticles();
  }
  /// Call this when the user pull down the screen
  Future<void> refreshArticles() async {
    Future.delayed(const Duration(seconds: 2), () {
      setState(() {
        updateArticles.updateArticles();
        print("Uploading new articles");
        //_posts.add();
      });

      return  updateArticles.updateArticles();
    });
  }

  /// End Refresh indicator upload new articles function
  ///
  ///
  @override
  Widget build(BuildContext context) {
    return RefreshIndicator(
        displacement: 0,
        color: assofacileMainColor,
        backgroundColor: Colors.white,
        onRefresh: refreshArticles,
        child: Container(
          child: FutureBuilder<List?>(
              future: categoryNews.getNewsArticles(),
              builder: (context, snapshot) { // AsyncSnapshot
                if (snapshot.hasData) {
                  if (snapshot.data?.length == 0) {
                    return const NoArticle();
                  }
                  return ListView.builder(
                    controller: scrollController,
                    itemCount: snapshot.data?.length++,
                    physics: const AlwaysScrollableScrollPhysics(),
                    itemBuilder: (context, i) {
                      return Card(
                        margin: const EdgeInsets.all(8),
                        elevation: 5,
                        shadowColor: Colors.black26,
                        color: Colors.white,
                        child: InkWell(
                          child: ClipRRect(
                            borderRadius: BorderRadius.circular(10),
                            child: Column(
                              mainAxisSize: MainAxisSize.min,
                              children: [
                                SizedBox(
                                  height: 190,
                                  width: double.infinity,
                                  child:
                                  Image(
                                    image: AdvancedNetworkImage(
                                      snapshot.data![i]["_embedded"]['wp:featuredmedia'][0]["media_details"]["sizes"]["medium"]["source_url"],
                                      useDiskCache: true,
                                      cacheRule: const CacheRule(maxAge: Duration(days: 1)),
                                    ),
                                    fit: BoxFit.cover,
                                  ),

                                // Title article
                                Column(
                                  children: [
                                    Padding(
                                      padding: const EdgeInsets.only(left:16, top: 16, bottom: 16),
                                      child: Row(
                                        children: [
                                          Expanded(
                                            child: Text(
                                              snapshot.data![i]["title"]["rendered"]
                                                  .replaceAll("’", "'")
                                                  .replaceAll("<p>", "")
                                                  .replaceAll("</p>", ""),
                                              style: const TextStyle(
                                                fontSize: 18,
                                                fontWeight: FontWeight.w600,
                                                fontFamily: "Raleway",
                                              ),
                                              overflow: TextOverflow.ellipsis,
                                              maxLines: 2,
                                              //softWrap: false,
                                            ),
                                          ),
                                        ],
                                      ),
                                    )
                                  ],
                                ),
                              ],
                            ),
                          ),
                          onTap: () {
                            Navigator.push(
                              context,
                              MaterialPageRoute(
                                builder: (context) => ArticlePage(data: snapshot.data?[i]),
                              ),
                            );
                          },
                        ),
                      );
                    },
                  );
                } else if (snapshot.hasError) {
                  return const NoInternet();
                } else {
                  /// Shimmer
                  return ShimmerEffect();
                }
              }
          ),
        ),
    );
  }
}
</code>```

Body:
I need that new articles available will be visible in the news page after pull to refresh gesture, but this doesn't happen, and the cache system doesn't update the news page.
I am using File to get Temporary Directory and create a cache, I just need that when I refresh new articles will be showed up on the news page.
How can I solve this issue?
Thank you in advance

Fetch and caching data

class ApiNewsPage {
  final String url = newsJsonLink;
  Future<List?> getNewsArticles() async {
    String nameDB = "articledata.json";
    var dir = await getTemporaryDirectory();
    File file = File(dir.path + "/" + nameDB);

    if(file.existsSync()) {
      print("Loading Articles from cache");
      var jsonDB = file.readAsStringSync();
      List response = json.decode(jsonDB);
      return response;
    } else {
        var response = await http.get(Uri.parse(url));
        if (response.statusCode == 200) {
          //await File(nameDB).exists();
          var jsonResponse = response.body;
          List newArticles = json.decode(jsonResponse);
          //File(nameDB).deleteSync(recursive: true);
          /// save json in local file
          file.writeAsStringSync(jsonResponse, flush: true, mode: FileMode.write);
          print("Fetching new articles from internet");
          return newArticles;
        }
    }
  }
}

// Create new db
class NewArticlesPage {
  final String url = newsJsonLink;
  Future<List?> updateArticles() async {
    try {
      var response = await http.get(Uri.parse(url));
      if (response.statusCode == 200) {
        print("Fetching new articles from internet");
        return jsonDecode(response.body);
      } else {
        return Future.error("Impossibile ricevere i dati, prova a controllare la connessione");
      }// ignore: non_constant_identifier_names
    } catch (SocketException) {
      return Future.error("Impossibile caricare gli articoli");
    }
  }
}

News page to be updated

class _NewsPageState extends State<NewsPage> {
  /// News service
  final ApiNewsPage categoryNews = ApiNewsPage();
  late bool isLoading;
  /// Start Refresh indicator upload new articles function
  final NewArticlesPage updateArticles = NewArticlesPage();
  ScrollController scrollController = ScrollController();
  //final List<ArticleModel> _posts = [];
  //
  @override
  void initState() {
    super.initState();
    refreshArticles();
  }
  /// Call this when the user pull down the screen
  Future<void> refreshArticles() async {
    Future.delayed(const Duration(seconds: 2), () {
      setState(() {
        updateArticles.updateArticles();
        print("Uploading new articles");
        //_posts.add();
      });

      return  updateArticles.updateArticles();
    });
  }

  /// End Refresh indicator upload new articles function
  ///
  ///
  @override
  Widget build(BuildContext context) {
    return RefreshIndicator(
        displacement: 0,
        color: assofacileMainColor,
        backgroundColor: Colors.white,
        onRefresh: refreshArticles,
        child: Container(
          child: FutureBuilder<List?>(
              future: categoryNews.getNewsArticles(),
              builder: (context, snapshot) { // AsyncSnapshot
                if (snapshot.hasData) {
                  if (snapshot.data?.length == 0) {
                    return const NoArticle();
                  }
                  return ListView.builder(
                    controller: scrollController,
                    itemCount: snapshot.data?.length++,
                    physics: const AlwaysScrollableScrollPhysics(),
                    itemBuilder: (context, i) {
                      return Card(
                        margin: const EdgeInsets.all(8),
                        elevation: 5,
                        shadowColor: Colors.black26,
                        color: Colors.white,
                        child: InkWell(
                          child: ClipRRect(
                            borderRadius: BorderRadius.circular(10),
                            child: Column(
                              mainAxisSize: MainAxisSize.min,
                              children: [
                                SizedBox(
                                  height: 190,
                                  width: double.infinity,
                                  child:
                                  Image(
                                    image: AdvancedNetworkImage(
                                      snapshot.data![i]["_embedded"]['wp:featuredmedia'][0]["media_details"]["sizes"]["medium"]["source_url"],
                                      useDiskCache: true,
                                      cacheRule: const CacheRule(maxAge: Duration(days: 1)),
                                    ),
                                    fit: BoxFit.cover,
                                  ),

                                // Title article
                                Column(
                                  children: [
                                    Padding(
                                      padding: const EdgeInsets.only(left:16, top: 16, bottom: 16),
                                      child: Row(
                                        children: [
                                          Expanded(
                                            child: Text(
                                              snapshot.data![i]["title"]["rendered"]
                                                  .replaceAll("’", "'")
                                                  .replaceAll("
", "")
                                                  .replaceAll("
", ""),
                                              style: const TextStyle(
                                                fontSize: 18,
                                                fontWeight: FontWeight.w600,
                                                fontFamily: "Raleway",
                                              ),
                                              overflow: TextOverflow.ellipsis,
                                              maxLines: 2,
                                              //softWrap: false,
                                            ),
                                          ),
                                        ],
                                      ),
                                    )
                                  ],
                                ),
                              ],
                            ),
                          ),
                          onTap: () {
                            Navigator.push(
                              context,
                              MaterialPageRoute(
                                builder: (context) => ArticlePage(data: snapshot.data?[i]),
                              ),
                            );
                          },
                        ),
                      );
                    },
                  );
                } else if (snapshot.hasError) {
                  return const NoInternet();
                } else {
                  /// Shimmer
                  return ShimmerEffect();
                }
              }
          ),
        ),
    );
  }
}


问:
Mediawiki Page is not fully rendered, but Sourcecode is complete in Editor?
around a week ago, I started to create a Wiki for my Unreal Project.
Now I stumbled across a problem...

My Pages are not showing up correctly.. They miss many parts of the code.
See this:

Even the Table of Content shows more Headers than just "The Node".. But they are not rendered..

This is the whole Page Code:

```<code>== The Node ==
{| style="width:100%;"
| {{#widget:IFrameInventoryAddToInventory}}
|-
| <small>Blueprint example rendered using the [https://blueprintue.com blueprintue.com] renderer under an explicit license grant.</small>
|}

== Description ==
{|
| width="80px"|'''''Server only!''''' || This Function is only running if the caller has authority or is the server!
|}
{|
| width="80px"|'''''Tooltip''''' || Adds an item to the Inventory. If no space is available, it returns the rest of the quantity.
|}

== Input ==
{| class="wikitable" style="width:100%;"
! Pin !! Type !! Info
|-
| width="64px"|
{|
| [[Datei:UE Icon Pin AActor.png|center]]
|-
| <div style='text-align:center;'>Target</div>
|}
| width="64px" align="center"|UAC_Inventory
| width="60%"|The target inventory, the item is added to.
|-
|-
| width="64px"|
{|
| [[Datei:UE Icon Pin FName.png|center]]
|-
| <div style='text-align:center;'>Add Name</div>
|}
| width="64px" align="center"|FName
| width="60%"|The name of the item, that should be added. This name needs to be equal to the UDataTable row name of this item and should be case-sensitive!
|-
| width="64px"|
{|
| align="center"|[[Datei:UE Icon Pin Integer.png]]
|-
|  align="center"|<div style='text-align:center;'>Add Quantity</div>
|}
| width="64px" align="center"|Integer
| width="60%"|The quantity of the item, to be added to the inventory content.<br>The Quantity is clamped between 1 and 999.
|-
| width="64px"|
{|
| [[Datei:UE Icon Pin AActor.png|center]]
|-
| <div style='text-align:center;'>From Inventory</div>
|}
| width="64px" align="center"|UAC_Inventory
| width="60%"|An origin inventory, the item is taken from.
|-
| width="64px"|
{|
| [[Datei:UE Icon Pin Integer.png|center]]
|-
| <div style='text-align:center;'>From Inventory Index</div>
|}
| width="64px" align="center"|Integer
| width="60%"|The index of a content slot, the item is removed from at the FromInventory.
|-
| width="64px"|
{|
| [[Datei:UE Icon Pin AActor.png|center]]
|-
| <div style='text-align:center;'>From Item</div>
|}
| width="64px" align="center"|ATheTavern_Actor_ItemBase
| width="60%"|The item, the quantity is removed from, when adding to target inventory.
|-
| width="64px"|
{|
| [[Datei:UE Icon Pin Integer.png|center]]
|-
| <div style='text-align:center;'>From Item Index</div>
|}
| width="64px" align="center"|Integer
| width="60%"|The index of a content slot, the item is removed from at the FromItem.
|}

== Return ==
{| class="wikitable" style="width:100%;"
! Pin !! Type !! Info
|-
| width="64px"|
{|
| [[Datei:UE Icon Pin Exec.png|center]]
|-
| <div style='text-align:center;'>Inv Success</div>
|}
| width="64px" align="center"|Exec
| width="60%"|Exec fired when adding an item was successfully.
|-
| width="64px"|
{|
| [[Datei:UE Icon Pin Exec.png|center]]
|-
| <div style='text-align:center;'>Inv No Server</div>
|}
| width="64px" align="center"|Exec
| width="60%"|Exec fired when the item can not be added, because the Caller is not server or has authority.
|-
| width="64px"|
{|
| [[Datei:UE Icon Pin Exec.png|center]]
|-
| <div style='text-align:center;'>Inv No DT</div>
|}
| width="64px" align="center"|Exec
| width="60%"|Exec fired when the item can not be added, because no UDataTable could be loaded.
|-
| width="64px"|
{|
| [[Datei:UE Icon Pin Exec.png|center]]
|-
| <div style='text-align:center;'>Inv Not Existing</div>
|}
| width="64px" align="center"|Exec
| width="60%"|Exec fired when the item can not be added, because the item is not existing in the UDataTable.
|-
| width="64px"|
{|
| [[Datei:UE Icon Pin Exec.png|center]]
|-
| <div style='text-align:center;'>Inv Full</div>
|}
| width="64px" align="center"|Exec
| width="60%"|Exec fired when the item can not be added, because the Inventory is full. This may change the content of From Inventory or From Item, but leaves a rest.
|-
| width="64px"|
{|
| [[Datei:UE Icon Pin Exec.png|center]]
|-
| <div style='text-align:center;'>Inv No Storage</div>
|}
| width="64px" align="center"|Exec
| width="60%"|Exec fired when the item can not be added, because the target inventory is not meant to be used as storage.
|-
| width="64px"|
{|
| [[Datei:UE Icon Pin FName.png|center]]
|-
| <div style='text-align:center;'>Rest Name</div>
|}
| width="64px" align="center"|FName
| width="60%"|The item name forwarded.
|-
| width="64px"|
{|
| [[Datei:UE Icon Pin Integer.png|center]]
|-
| <div style='text-align:center;'>Rest Quantity</div>
|}
| width="64px" align="center"|Integer
| width="60%"|The rest of the adding process forwarded. This value may be different from the AddQuantity.
|-
| width="64px"|
{|
| [[Datei:UE Icon Pin FText.png|center]]
|-
| <div style='text-align:center;'>Message</div>
|}
| width="64px" align="center"|FText
| width="60%"|A debug message that can be printed.
|}

</code>```

The page "widget:IFrameInventoryAddToInventory" is just a page holding an iframe:

```<code><iframe src="https://blueprintue.com/render/3fj7mfv8/" scrolling="no"</iframe>
</code>```

Because I want to show the Blueprint Nodes inside the Page.

Any idea why this happens?
Mediawiki is 1.39.1

Edit fyi:
I enabled debugging.. with:

```<code>error_reporting( -1 );
ini_set( 'display_errors', 1 );
$wgShowExceptionDetails = true;
$wgDebugToolbar = true;
$wgShowDebug = true;
$wgDevelopmentWarnings = true;
</code>```

But the Page shows nothing.. no error, no warning, no info.. just nothing.. While all other Pages do show me debugging text at the bottom.

Body:
around a week ago, I started to create a Wiki for my Unreal Project.
Now I stumbled across a problem...

My Pages are not showing up correctly.. They miss many parts of the code.
See this:

Even the Table of Content shows more Headers than just "The Node".. But they are not rendered..

This is the whole Page Code:

== The Node ==
{| style="width:100%;"
| {{#widget:IFrameInventoryAddToInventory}}
|-
| Blueprint example rendered using the [https://blueprintue.com blueprintue.com] renderer under an explicit license grant.
|}

== Description ==
{|
| width="80px"|'''''Server only!''''' || This Function is only running if the caller has authority or is the server!
|}
{|
| width="80px"|'''''Tooltip''''' || Adds an item to the Inventory. If no space is available, it returns the rest of the quantity.
|}

== Input ==
{| class="wikitable" style="width:100%;"
! Pin !! Type !! Info
|-
| width="64px"|
{|
| [[Datei:UE Icon Pin AActor.png|center]]
|-
|
Target

|}
| width="64px" align="center"|UAC_Inventory
| width="60%"|The target inventory, the item is added to.
|-
|-
| width="64px"|
{|
| [[Datei:UE Icon Pin FName.png|center]]
|-
|
Add Name

|}
| width="64px" align="center"|FName
| width="60%"|The name of the item, that should be added. This name needs to be equal to the UDataTable row name of this item and should be case-sensitive!
|-
| width="64px"|
{|
| align="center"|[[Datei:UE Icon Pin Integer.png]]
|-
|  align="center"|
Add Quantity

|}
| width="64px" align="center"|Integer
| width="60%"|The quantity of the item, to be added to the inventory content.
The Quantity is clamped between 1 and 999.
|-
| width="64px"|
{|
| [[Datei:UE Icon Pin AActor.png|center]]
|-
|
From Inventory

|}
| width="64px" align="center"|UAC_Inventory
| width="60%"|An origin inventory, the item is taken from.
|-
| width="64px"|
{|
| [[Datei:UE Icon Pin Integer.png|center]]
|-
|
From Inventory Index

|}
| width="64px" align="center"|Integer
| width="60%"|The index of a content slot, the item is removed from at the FromInventory.
|-
| width="64px"|
{|
| [[Datei:UE Icon Pin AActor.png|center]]
|-
|
From Item

|}
| width="64px" align="center"|ATheTavern_Actor_ItemBase
| width="60%"|The item, the quantity is removed from, when adding to target inventory.
|-
| width="64px"|
{|
| [[Datei:UE Icon Pin Integer.png|center]]
|-
|
From Item Index

|}
| width="64px" align="center"|Integer
| width="60%"|The index of a content slot, the item is removed from at the FromItem.
|}

== Return ==
{| class="wikitable" style="width:100%;"
! Pin !! Type !! Info
|-
| width="64px"|
{|
| [[Datei:UE Icon Pin Exec.png|center]]
|-
|
Inv Success

|}
| width="64px" align="center"|Exec
| width="60%"|Exec fired when adding an item was successfully.
|-
| width="64px"|
{|
| [[Datei:UE Icon Pin Exec.png|center]]
|-
|
Inv No Server

|}
| width="64px" align="center"|Exec
| width="60%"|Exec fired when the item can not be added, because the Caller is not server or has authority.
|-
| width="64px"|
{|
| [[Datei:UE Icon Pin Exec.png|center]]
|-
|
Inv No DT

|}
| width="64px" align="center"|Exec
| width="60%"|Exec fired when the item can not be added, because no UDataTable could be loaded.
|-
| width="64px"|
{|
| [[Datei:UE Icon Pin Exec.png|center]]
|-
|
Inv Not Existing

|}
| width="64px" align="center"|Exec
| width="60%"|Exec fired when the item can not be added, because the item is not existing in the UDataTable.
|-
| width="64px"|
{|
| [[Datei:UE Icon Pin Exec.png|center]]
|-
|
Inv Full

|}
| width="64px" align="center"|Exec
| width="60%"|Exec fired when the item can not be added, because the Inventory is full. This may change the content of From Inventory or From Item, but leaves a rest.
|-
| width="64px"|
{|
| [[Datei:UE Icon Pin Exec.png|center]]
|-
|
Inv No Storage

|}
| width="64px" align="center"|Exec
| width="60%"|Exec fired when the item can not be added, because the target inventory is not meant to be used as storage.
|-
| width="64px"|
{|
| [[Datei:UE Icon Pin FName.png|center]]
|-
|
Rest Name

|}
| width="64px" align="center"|FName
| width="60%"|The item name forwarded.
|-
| width="64px"|
{|
| [[Datei:UE Icon Pin Integer.png|center]]
|-
|
Rest Quantity

|}
| width="64px" align="center"|Integer
| width="60%"|The rest of the adding process forwarded. This value may be different from the AddQuantity.
|-
| width="64px"|
{|
| [[Datei:UE Icon Pin FText.png|center]]
|-
|
Message

|}
| width="64px" align="center"|FText
| width="60%"|A debug message that can be printed.
|}

The page "widget:IFrameInventoryAddToInventory" is just a page holding an iframe:

<iframe src="https://blueprintue.com/render/3fj7mfv8/" scrolling="no"

Because I want to show the Blueprint Nodes inside the Page.

Any idea why this happens?
Mediawiki is 1.39.1

Edit fyi:
I enabled debugging.. with:

error_reporting( -1 );
ini_set( 'display_errors', 1 );
$wgShowExceptionDetails = true;
$wgDebugToolbar = true;
$wgShowDebug = true;
$wgDevelopmentWarnings = true;

But the Page shows nothing.. no error, no warning, no info.. just nothing.. While all other Pages do show me debugging text at the bottom.


问:
Cloud Run service killed with moderately-sized request body
A Cloud Run service crashes when it receives a request body above some limit between 1mb and 10mb and the server does not read the body.

I created and deployed a Cloud Run service in go, using the Quickstart example.

If I make a POST request with a 10mb JSON body, the service is killed and the client receives a generic 500 response. I expect a 200 since I don't see any documented limits that apply.

Interestingly, if I update the sample code to read the request body in its entirety (io.ReadAll(r.Body)), then everything works as expected.

However, I'd like to be able to reject large requests with a 413 status without having to read the entire body.

This isn't specific to go; I experience the same behavior with the Node.js example.


问:
iOS: i want to fetch data from NFC tag and open App Clip
i want to fetch data from NFC tag and open App Clip

i preferred link for NFC data reader but still my issue was not solve

output like:

```<code>NFC Ready: false
Error Domain=NFCError Code=2 "Missing required entitlement" UserInfo={NSLocalizedDescription=Missing required entitlement}
2023-01-04 18:46:48.525435+0530 TapnClip[11544:7498529] [Default] Error requesting calls from host: Error Domain=NSCocoaErrorDomain Code=4097 "connection to service named com.apple.callkit.callcontrollerhost" UserInfo={NSDebugDescription=connection to service named com.apple.callkit.callcontrollerhost}
Message from debugger: Terminated due to signal 9
can anyone help me to solve issue
</code>```

Thank you for support!

Body:
i want to fetch data from NFC tag and open App Clip

i preferred link for NFC data reader but still my issue was not solve

output like:

NFC Ready: false
Error Domain=NFCError Code=2 "Missing required entitlement" UserInfo={NSLocalizedDescription=Missing required entitlement}
2023-01-04 18:46:48.525435+0530 TapnClip[11544:7498529] [Default] Error requesting calls from host: Error Domain=NSCocoaErrorDomain Code=4097 "connection to service named com.apple.callkit.callcontrollerhost" UserInfo={NSDebugDescription=connection to service named com.apple.callkit.callcontrollerhost}
Message from debugger: Terminated due to signal 9
can anyone help me to solve issue

Thank you for support!


问:
Replacing variable in if function using else if
I have a navbar and in the mobile version I need a button for the menu (hamburger icon).

```<code>function navigation() {
   $menu_name = 'mobile_nav'; // specify custom menu slug
   if (($locations = get_nav_menu_locations()) && isset($locations[$menu_name])) {
      $menu = wp_get_nav_menu_object($locations[$menu_name]);
      $menu_items = wp_get_nav_menu_items($menu->term_id);

      $menu_list = '<div id="nav-links">' ."\n";
      $menu_list .= "\t\t\t\t". '<div id="nav-links-mobile">' ."\n";
      foreach ((array) $menu_items as $key => $menu_item) {
         $title = $menu_item->title;
         $title_id = strtr(utf8_decode($title), utf8_decode('àáâãäçèéêëìíîïñòóôõöùúûüýÿÀÁÂÃÄÇÈÉÊËÌÍÎÏÑÒÓÔÕÖÙÚÛÜÝ'), 'aaaaaceeeeiiiinooooouuuuyyAAAAACEEEEIIIINOOOOOUUUUY');
         $title_id = strtolower($title_id);

         $url = $menu_item->url;
         $menu_list .= "\t\t\t\t\t". '<div class="'. $title_id .'"><a href="'. $url .'"><div><p>'. $title .'</div></p></a></div>' ."\n";
      }
      $menu_list .= "\t\t\t". '</nav>' ."\n";
   } else if (str_contains($title, 'material-symbol-outline')) {
         $icon = explode(' ',trim($title));
         $icon = $icon[1];
         $menu_list .= "\t\t\t\t\t". '<div><span class="material-symbol-outline">'. $icon .'</span></div></a></div>' ."\n";
      }
   echo $menu_list;
}
</code>```

I need to replace line 21 with line 15, if variable $title contains 'material-symbol-outline'.

I tried changing the order of the statements but it comes out with an unexpected else statement.

Body:
I have a navbar and in the mobile version I need a button for the menu (hamburger icon).

function navigation() {
   $menu_name = 'mobile_nav'; // specify custom menu slug
   if (($locations = get_nav_menu_locations()) && isset($locations[$menu_name])) {
      $menu = wp_get_nav_menu_object($locations[$menu_name]);
      $menu_items = wp_get_nav_menu_items($menu->term_id);

      $menu_list = '
' ."\n";
      $menu_list .= "\t\t\t\t". '
' ."\n";
      foreach ((array) $menu_items as $key => $menu_item) {
         $title = $menu_item->title;
         $title_id = strtr(utf8_decode($title), utf8_decode('àáâãäçèéêëìíîïñòóôõöùúûüýÿÀÁÂÃÄÇÈÉÊËÌÍÎÏÑÒÓÔÕÖÙÚÛÜÝ'), 'aaaaaceeeeiiiinooooouuuuyyAAAAACEEEEIIIINOOOOOUUUUY');
         $title_id = strtolower($title_id);

         $url = $menu_item->url;
         $menu_list .= "\t\t\t\t\t". '

'. $title .'

' ."\n";
      }
      $menu_list .= "\t\t\t". '' ."\n";
   } else if (str_contains($title, 'material-symbol-outline')) {
         $icon = explode(' ',trim($title));
         $icon = $icon[1];
         $menu_list .= "\t\t\t\t\t". '
'. $icon .'

' ."\n";
      }
   echo $menu_list;
}

I need to replace line 21 with line 15, if variable $title contains 'material-symbol-outline'.

I tried changing the order of the statements but it comes out with an unexpected else statement.


问:
How to get a specific cell from a table on a webpage into google sheets?
I am trying to get the total distance (23,596) cell from the Away Games table fom this webpage into google sheets:

https://www.pro-football-reference.com/teams/nwe/2022_travel.htm

I am not able to import the cell properly using either IMPORTXML or IMPORTHTML

I looked at source code of the page and tried to specify the class and/or the tagging of the specific cell but I wasn't able to get the right cell.

These are two examples of what I tried

```<code>=IMPORTXML("https://www.pro-football-reference.com/teams/nwe/2022_travel.htm", "[@id="total_mileage"]")
=IMPORTXML("https://www.pro-football-reference.com/teams/nwe/2022_travel.htm", "//td[@class='right iz']")
</code>```

For everything I tried, I either got an error or an "NA" result.

Body:
I am trying to get the total distance (23,596) cell from the Away Games table fom this webpage into google sheets:

https://www.pro-football-reference.com/teams/nwe/2022_travel.htm

I am not able to import the cell properly using either IMPORTXML or IMPORTHTML

I looked at source code of the page and tried to specify the class and/or the tagging of the specific cell but I wasn't able to get the right cell.

These are two examples of what I tried

=IMPORTXML("https://www.pro-football-reference.com/teams/nwe/2022_travel.htm", "[@id="total_mileage"]")
=IMPORTXML("https://www.pro-football-reference.com/teams/nwe/2022_travel.htm", "//td[@class='right iz']")

For everything I tried, I either got an error or an "NA" result.


问:
Laravel logging gets timeout if the logstash service is down
I have a Laravel application that sends log data to Logstash on an AWS EC2 instance. Recently, the EC2 instance went down, and I noticed that the Laravel application started prompting timeouts when I tried to log and it affects the whole application. Is there a way to configure Laravel or Logstash to handle timeouts or connection failures, or do I need to handle this in my log shipping solution?

```<code>Failed connecting to tcp://XX.XXX.XX.XX:5044 (111: Connection refused)
</code>```

how can i handle that timeout ?

Body:
I have a Laravel application that sends log data to Logstash on an AWS EC2 instance. Recently, the EC2 instance went down, and I noticed that the Laravel application started prompting timeouts when I tried to log and it affects the whole application. Is there a way to configure Laravel or Logstash to handle timeouts or connection failures, or do I need to handle this in my log shipping solution?

Failed connecting to tcp://XX.XXX.XX.XX:5044 (111: Connection refused)

how can i handle that timeout ?


问:
Having the same error but unable to solve it
I'm pretty new at android development, and I'm trying to fetch data from Realtime Database into recycler view in a fragment. I've seen pretty much every tutorial how to do it but it simply wont work. Below I'll put the source code.

main fragment (where i need to fetch the data)

```<code>package hr.ferit.tomislav.lucic5.tl5_projekt

import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.google.android.material.floatingactionbutton.FloatingActionButton
import com.google.firebase.database.*

private lateinit var transactions : ArrayList<Transaction>
private lateinit var recyclerView : RecyclerView
private lateinit var adapter: TransactionAdapter
private lateinit var loadingData : TextView
private lateinit var dbRef : DatabaseReference

class MainFragment : Fragment() {

    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        // Inflate the layout for this fragment
        val view = inflater.inflate(R.layout.fragment_main, container, false)
        return view
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        val newTransaction = view.findViewById<FloatingActionButton>(R.id.addBtn)
        recyclerView = view.findViewById(R.id.recyclerview)
        recyclerView.layoutManager = LinearLayoutManager(context)
        recyclerView.setHasFixedSize(true)
        loadingData = view.findViewById(R.id.tvLoadingData)

        transactions = arrayListOf<Transaction>()

        getTransactionData()

        newTransaction?.setOnClickListener {
            val homeFragment = AddTransactionFragment()
            val transaction = fragmentManager?.beginTransaction()
            transaction?.replace(R.id.mainFrame,homeFragment)
            transaction?.addToBackStack(null)
            transaction?.commit()
        }
    }

    private fun updateDashboard(){
        var balance = view?.findViewById<TextView>(R.id.balance)
        var expense = view?.findViewById<TextView>(R.id.expense)
        var budget = view?.findViewById<TextView>(R.id.budget)

        val totalAmount = transactions.map { it.amount.toInt() }.sum()
        val budgetAmount = transactions.filter { it.amount.toInt() >0 }.map{it.amount.toInt()}.sum()
        val expenseAmount = totalAmount - budgetAmount

        balance?.text = "$ %.2f".format(totalAmount)
        budget?.text = "$ %.2f".format(budgetAmount)
        expense?.text = "$ %.2f".format(expenseAmount)

    }
    private fun getTransactionData(){
        recyclerView.visibility= View.GONE
        loadingData.visibility = View.VISIBLE

        dbRef = FirebaseDatabase.getInstance().getReference("transactions")

        dbRef.addValueEventListener(object: ValueEventListener {
            override fun onDataChange(snapshot: DataSnapshot) {
                transactions.clear()
                if (snapshot.exists()) {
                    for (tranSnap in snapshot.children) {
                        val tranData =
                            tranSnap.getValue(Transaction::class.java)
                        transactions.add(tranData!!)
                    }
                    val mAdapter = TransactionAdapter(transactions)
                    recyclerView.adapter = mAdapter

                    recyclerView.visibility = View.VISIBLE
                    loadingData.visibility = View.GONE

                }
            }

            override fun onCancelled(error: DatabaseError) {
                TODO("Not yet implemented")
            }

        })
    }
}
</code>```

adapter

```<code>package hr.ferit.tomislav.lucic5.tl5_projekt

import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView

class TransactionAdapter(private val trList:ArrayList<Transaction>) :
    RecyclerView.Adapter<TransactionAdapter.ViewHolder>() {

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
        val itemView = LayoutInflater.from(parent.context).inflate(R.layout.transaction_layout,parent,false)
        return ViewHolder(itemView)
    }
    override fun onBindViewHolder(holder: ViewHolder, position: Int) {
        val curTransaction = trList[position]
        holder.amount.text = curTransaction.amount
        holder.label.text = curTransaction.label
    }
    override fun getItemCount(): Int {
        return trList.size
    }

    fun addItem(transaction: Transaction){
        trList.add(0, transaction)
        notifyItemInserted(0)
    }

    class ViewHolder(itemView: View): RecyclerView.ViewHolder(itemView){

        val label : TextView = itemView.findViewById(R.id.label)
        val amount : TextView = itemView.findViewById(R.id.amount)

        }
    }

</code>```

data class for Transaction

```<code>package hr.ferit.tomislav.lucic5.tl5_projekt

data class Transaction (
    var label: String,
    var amount: String,
    var description: String
)

</code>```

I don't know what can I do else.. it's always the same error Class hr.ferit.tomislav.lucic5.tl5_projekt.Transaction does not define a no-argument constructor. If you are using ProGuard, make sure these constructors are not stripped. That happens after i try to add a new transaction:

```<code>package hr.ferit.tomislav.lucic5.tl5_projekt

import android.annotation.SuppressLint
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Button
import android.widget.ImageButton
import androidx.core.widget.addTextChangedListener
import com.google.android.material.textfield.TextInputEditText
import com.google.android.material.textfield.TextInputLayout
import com.google.firebase.auth.FirebaseAuth
import com.google.firebase.database.FirebaseDatabase
import com.google.firebase.database.ktx.database
import com.google.firebase.ktx.Firebase

class AddTransactionFragment : Fragment() {
    private lateinit var database : FirebaseDatabase
    @SuppressLint("MissingInflatedId")
    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        val view = inflater.inflate(R.layout.fragment_add_transaction2, container, false)
        val addBtn = view.findViewById<Button>(R.id.addTransactionBtn)
        val titleInput = view.findViewById<TextInputEditText>(R.id.titleInput)
        val amountInput = view.findViewById<TextInputEditText>(R.id.amountInput)
        val descriptionInput = view.findViewById<TextInputEditText>(R.id.descriptionInput)
        val titleLayout = view.findViewById<TextInputLayout>(R.id.titleLayout)
        val amountLayout = view.findViewById<TextInputLayout>(R.id.amountLayout)
        val closeBtn = view.findViewById<ImageButton>(R.id.closeBtn)
        var recyclerAdapter : TransactionAdapter
        var database = Firebase.database.reference
        val userId = FirebaseAuth.getInstance().currentUser!!.uid

        titleInput.addTextChangedListener {
            if(it!!.count() > 0)
                titleLayout.error = null
        }

        amountInput.addTextChangedListener {
            if(it!!.count() > 0)
                amountLayout.error = null
        }
        addBtn.setOnClickListener{
            val title = titleInput.text.toString()
            val description = descriptionInput.text.toString()
            val amount = amountInput.text.toString()

            var transactionToAdd = Transaction(
                label = titleInput.text.toString(),
                description = descriptionInput.text.toString(),
                amount = amountInput.text.toString()
            )
            val list = ArrayList<Transaction>()
            recyclerAdapter = TransactionAdapter(list)
            if(title.isEmpty()) {
                titleLayout.error = "Please enter a valid title"
            }
            if(amount.isEmpty()) {
                amountLayout.error = "Please enter a valid amount"
            }
            else{
                database.child("transactions").push().setValue(transactionToAdd)
                .addOnSuccessListener {
                    recyclerAdapter.addItem(transactionToAdd)
                    var homeFragment = MainFragment()
                    val transaction = fragmentManager?.beginTransaction()
                    transaction?.replace(R.id.mainFrame,homeFragment)
                    transaction?.commit()
                }
                }
            }

        closeBtn.setOnClickListener{
            var homeFragment = MainFragment()
            val transaction = fragmentManager?.beginTransaction()
            transaction?.replace(R.id.mainFrame,homeFragment)
            transaction?.commit()
        }

        return view
    }

}
</code>```

I tried everything, basically every tutorial I found on youtube but nothing helped. I don't know what's the problem, I get that it is something to do with the data class and the constructor but im unable to solve it.

Body:
I'm pretty new at android development, and I'm trying to fetch data from Realtime Database into recycler view in a fragment. I've seen pretty much every tutorial how to do it but it simply wont work. Below I'll put the source code.

main fragment (where i need to fetch the data)

package hr.ferit.tomislav.lucic5.tl5_projekt

import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.google.android.material.floatingactionbutton.FloatingActionButton
import com.google.firebase.database.*

private lateinit var transactions : ArrayList<Transaction>
private lateinit var recyclerView : RecyclerView
private lateinit var adapter: TransactionAdapter
private lateinit var loadingData : TextView
private lateinit var dbRef : DatabaseReference

class MainFragment : Fragment() {

    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        // Inflate the layout for this fragment
        val view = inflater.inflate(R.layout.fragment_main, container, false)
        return view
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        val newTransaction = view.findViewById<FloatingActionButton>(R.id.addBtn)
        recyclerView = view.findViewById(R.id.recyclerview)
        recyclerView.layoutManager = LinearLayoutManager(context)
        recyclerView.setHasFixedSize(true)
        loadingData = view.findViewById(R.id.tvLoadingData)

        transactions = arrayListOf<Transaction>()

        getTransactionData()

        newTransaction?.setOnClickListener {
            val homeFragment = AddTransactionFragment()
            val transaction = fragmentManager?.beginTransaction()
            transaction?.replace(R.id.mainFrame,homeFragment)
            transaction?.addToBackStack(null)
            transaction?.commit()
        }
    }

    private fun updateDashboard(){
        var balance = view?.findViewById<TextView>(R.id.balance)
        var expense = view?.findViewById<TextView>(R.id.expense)
        var budget = view?.findViewById<TextView>(R.id.budget)

        val totalAmount = transactions.map { it.amount.toInt() }.sum()
        val budgetAmount = transactions.filter { it.amount.toInt() >0 }.map{it.amount.toInt()}.sum()
        val expenseAmount = totalAmount - budgetAmount

        balance?.text = "$ %.2f".format(totalAmount)
        budget?.text = "$ %.2f".format(budgetAmount)
        expense?.text = "$ %.2f".format(expenseAmount)

    }
    private fun getTransactionData(){
        recyclerView.visibility= View.GONE
        loadingData.visibility = View.VISIBLE

        dbRef = FirebaseDatabase.getInstance().getReference("transactions")

        dbRef.addValueEventListener(object: ValueEventListener {
            override fun onDataChange(snapshot: DataSnapshot) {
                transactions.clear()
                if (snapshot.exists()) {
                    for (tranSnap in snapshot.children) {
                        val tranData =
                            tranSnap.getValue(Transaction::class.java)
                        transactions.add(tranData!!)
                    }
                    val mAdapter = TransactionAdapter(transactions)
                    recyclerView.adapter = mAdapter

                    recyclerView.visibility = View.VISIBLE
                    loadingData.visibility = View.GONE

                }
            }

            override fun onCancelled(error: DatabaseError) {
                TODO("Not yet implemented")
            }

        })
    }
}

adapter

package hr.ferit.tomislav.lucic5.tl5_projekt

import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView

class TransactionAdapter(private val trList:ArrayList<Transaction>) :
    RecyclerView.Adapter<TransactionAdapter.ViewHolder>() {

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
        val itemView = LayoutInflater.from(parent.context).inflate(R.layout.transaction_layout,parent,false)
        return ViewHolder(itemView)
    }
    override fun onBindViewHolder(holder: ViewHolder, position: Int) {
        val curTransaction = trList[position]
        holder.amount.text = curTransaction.amount
        holder.label.text = curTransaction.label
    }
    override fun getItemCount(): Int {
        return trList.size
    }

    fun addItem(transaction: Transaction){
        trList.add(0, transaction)
        notifyItemInserted(0)
    }

    class ViewHolder(itemView: View): RecyclerView.ViewHolder(itemView){

        val label : TextView = itemView.findViewById(R.id.label)
        val amount : TextView = itemView.findViewById(R.id.amount)

        }
    }

data class for Transaction

package hr.ferit.tomislav.lucic5.tl5_projekt

data class Transaction (
    var label: String,
    var amount: String,
    var description: String
)

I don't know what can I do else.. it's always the same error Class hr.ferit.tomislav.lucic5.tl5_projekt.Transaction does not define a no-argument constructor. If you are using ProGuard, make sure these constructors are not stripped. That happens after i try to add a new transaction:

package hr.ferit.tomislav.lucic5.tl5_projekt

import android.annotation.SuppressLint
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Button
import android.widget.ImageButton
import androidx.core.widget.addTextChangedListener
import com.google.android.material.textfield.TextInputEditText
import com.google.android.material.textfield.TextInputLayout
import com.google.firebase.auth.FirebaseAuth
import com.google.firebase.database.FirebaseDatabase
import com.google.firebase.database.ktx.database
import com.google.firebase.ktx.Firebase

class AddTransactionFragment : Fragment() {
    private lateinit var database : FirebaseDatabase
    @SuppressLint("MissingInflatedId")
    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        val view = inflater.inflate(R.layout.fragment_add_transaction2, container, false)
        val addBtn = view.findViewById<Button>(R.id.addTransactionBtn)
        val titleInput = view.findViewById<TextInputEditText>(R.id.titleInput)
        val amountInput = view.findViewById<TextInputEditText>(R.id.amountInput)
        val descriptionInput = view.findViewById<TextInputEditText>(R.id.descriptionInput)
        val titleLayout = view.findViewById<TextInputLayout>(R.id.titleLayout)
        val amountLayout = view.findViewById<TextInputLayout>(R.id.amountLayout)
        val closeBtn = view.findViewById<ImageButton>(R.id.closeBtn)
        var recyclerAdapter : TransactionAdapter
        var database = Firebase.database.reference
        val userId = FirebaseAuth.getInstance().currentUser!!.uid

        titleInput.addTextChangedListener {
            if(it!!.count() > 0)
                titleLayout.error = null
        }

        amountInput.addTextChangedListener {
            if(it!!.count() > 0)
                amountLayout.error = null
        }
        addBtn.setOnClickListener{
            val title = titleInput.text.toString()
            val description = descriptionInput.text.toString()
            val amount = amountInput.text.toString()

            var transactionToAdd = Transaction(
                label = titleInput.text.toString(),
                description = descriptionInput.text.toString(),
                amount = amountInput.text.toString()
            )
            val list = ArrayList<Transaction>()
            recyclerAdapter = TransactionAdapter(list)
            if(title.isEmpty()) {
                titleLayout.error = "Please enter a valid title"
            }
            if(amount.isEmpty()) {
                amountLayout.error = "Please enter a valid amount"
            }
            else{
                database.child("transactions").push().setValue(transactionToAdd)
                .addOnSuccessListener {
                    recyclerAdapter.addItem(transactionToAdd)
                    var homeFragment = MainFragment()
                    val transaction = fragmentManager?.beginTransaction()
                    transaction?.replace(R.id.mainFrame,homeFragment)
                    transaction?.commit()
                }
                }
            }

        closeBtn.setOnClickListener{
            var homeFragment = MainFragment()
            val transaction = fragmentManager?.beginTransaction()
            transaction?.replace(R.id.mainFrame,homeFragment)
            transaction?.commit()
        }

        return view
    }

}

I tried everything, basically every tutorial I found on youtube but nothing helped. I don't know what's the problem, I get that it is something to do with the data class and the constructor but im unable to solve it.


问:
How to execute custom code when any outgoing HTTP request is initiated in .Net 4.5 console application
I have a c# console application running on .Net 4.5 framework. It has many outgoing HTTP POST and GET calls to various servers. Now I want to log the outgoing requests in my database with some custom code.

The project is already live so I do not want to touch the code of each and every http calls.

Is there any global trigger that I can implement in c# console application in .Net framework 4.5 that will execute on all the outgoing requests?


问:
Configure a second x-axis with matplotlib in logscale
I am trying to do a plot with a second x-axis on matplotlib but with a logarithmic scale.

I managed to add a second x-axis on a plot with a linear scale using the example below:

```<code>import numpy as np
import matplotlib.pyplot as plt

x_axis =  np.linspace(0,100, 100)
yvalues = x_axis**3

new_tick_locations =  np.array([20,40,60,80,100])
second_x_axis = new_tick_locations**2

fig = plt.figure()
ax1 = fig.add_subplot(111)
ax1.plot(x_axis,  yvalues)
ax1.axvline(x = 60, color = 'black', linestyle = 'dotted')
ax1.set_xlabel("first x axis")
ax1.set_ylabel("yvalues")
SecondAxis = True
if(SecondAxis):
    ax2 = ax1.twiny()
    ax2.set_xlim(ax1.get_xlim())
    ax2.set_xticks(new_tick_locations )
    ax2.set_xticklabels(second_x_axis)
    ax2.set_xlabel("second x axis")
Logscale = False
if(Logscale):
    ax1.set_xscale("log")
    ax1.set_yscale("log")
plt.show()
</code>```

Here, my second x-axis is defined as the square of my x-axis and we retrieve on the plot that for x =60 we have second_x =3600.

However, if I now set the "Logscale" variable in my code to "True" I get the following result:

Where the values of my second x-axis do not match the ones of my first x-axis.

Does anyone know how to fix this problem?

Body:
I am trying to do a plot with a second x-axis on matplotlib but with a logarithmic scale.

I managed to add a second x-axis on a plot with a linear scale using the example below:

import numpy as np
import matplotlib.pyplot as plt

x_axis =  np.linspace(0,100, 100)
yvalues = x_axis**3

new_tick_locations =  np.array([20,40,60,80,100])
second_x_axis = new_tick_locations**2

fig = plt.figure()
ax1 = fig.add_subplot(111)
ax1.plot(x_axis,  yvalues)
ax1.axvline(x = 60, color = 'black', linestyle = 'dotted')
ax1.set_xlabel("first x axis")
ax1.set_ylabel("yvalues")
SecondAxis = True
if(SecondAxis):
    ax2 = ax1.twiny()
    ax2.set_xlim(ax1.get_xlim())
    ax2.set_xticks(new_tick_locations )
    ax2.set_xticklabels(second_x_axis)
    ax2.set_xlabel("second x axis")
Logscale = False
if(Logscale):
    ax1.set_xscale("log")
    ax1.set_yscale("log")
plt.show()

Here, my second x-axis is defined as the square of my x-axis and we retrieve on the plot that for x =60 we have second_x =3600.

However, if I now set the "Logscale" variable in my code to "True" I get the following result:

Where the values of my second x-axis do not match the ones of my first x-axis.

Does anyone know how to fix this problem?


问:
How to pass on app.config settings of a DLL through a xUnit testserver.dll.config?
I have the following code structure:

xUnit tests

These use features from my.dll

The my.dll uses a third party logger.dll

If I use the my.dll outside of xUnit's testserver.dll, then I can just add a my.dll.config with the following contents:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">

    </sectionGroup>
  </configSections>

  <assemblySettings>
    <add key="Hostname" value="127.0.0.1"/>
    <add key="Port" value="1234"/>
  </assemblySettings>

  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6"/>
  </startup>

  <applicationSettings>
    <Thirdparty.Logger.Properties.Settings>
      <setting name="LogPath" serializeAs="String">
        <value>C:\log\dir</value>
      </setting>
    </Thirdparty.Logger.Properties.Settings>
  </applicationSettings>
</configuration>

```
<p>And within <code>my.dll</code>'s constructor, I can read them like follows, which works just fine.</p>
<pre class="lang-cs prettyprint-override"><code>AssemblySettings settings = new AssemblySettings();
var host = settings["Hostname"];
var port = settings["Port"];
</code>```

Also the LogPath is passed on to logger.dll, which is closed source to me, but the logger.dll can definitely read the value passed on as LogPath.

Now, I have been successfully able to pass on the logger.dll's settings through xUnit as well using a testserver.dll.config file, which looks like follows:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">

    </sectionGroup>
  </configSections>

  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6"/>
  </startup>

  <applicationSettings>
    <Thirdparty.Logger.Properties.Settings>
      <setting name="LogPath" serializeAs="String">
        <value>C:\log\dir</value>
      </setting>
    </Thirdparty.Logger.Properties.Settings>

    <MyDll.Properties.Settings>
        <setting name="Hostname" serializeAs="String">
            <value>127.0.0.1</value>
        </setting>
        <setting name="Port" serializeAs="String">
            <value>1234</value>
        </setting>
    </MyDll.Properties.Settings>
  </applicationSettings>
</configuration>

```
<p>And also in this case, the <code>LogPath</code> is successfully passed on, but the settings for <code>my.dll.config</code> are not. The <code>AssemblySettings</code> instance is <code>null</code>:</p>
<pre class="lang-cs prettyprint-override"><code>AssemblySettings settings = new AssemblySettings();
// settings == null
</code>```

What am I doing wrong?
Assembly.GetCallingAssembly().FullName in the constructor of AssemblySettings evaluates to "MyDll, Version=6.1.0.0, Culture=neutral, PublicKeyToken=null", but the returned instance is null.

Body:
I have the following code structure:

xUnit tests

These use features from my.dll

The my.dll uses a third party logger.dll

If I use the my.dll outside of xUnit's testserver.dll, then I can just add a my.dll.config with the following contents:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">

    </sectionGroup>
  </configSections>

  <assemblySettings>
    <add key="Hostname" value="127.0.0.1"/>
    <add key="Port" value="1234"/>
  </assemblySettings>

  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6"/>
  </startup>

  <applicationSettings>
    <Thirdparty.Logger.Properties.Settings>
      <setting name="LogPath" serializeAs="String">
        <value>C:\log\dir</value>
      </setting>
    </Thirdparty.Logger.Properties.Settings>
  </applicationSettings>
</configuration>

And within my.dll's constructor, I can read them like follows, which works just fine.

AssemblySettings settings = new AssemblySettings();
var host = settings["Hostname"];
var port = settings["Port"];

Also the LogPath is passed on to logger.dll, which is closed source to me, but the logger.dll can definitely read the value passed on as LogPath.

Now, I have been successfully able to pass on the logger.dll's settings through xUnit as well using a testserver.dll.config file, which looks like follows:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">

    </sectionGroup>
  </configSections>

  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6"/>
  </startup>

  <applicationSettings>
    <Thirdparty.Logger.Properties.Settings>
      <setting name="LogPath" serializeAs="String">
        <value>C:\log\dir</value>
      </setting>
    </Thirdparty.Logger.Properties.Settings>

    <MyDll.Properties.Settings>
        <setting name="Hostname" serializeAs="String">
            <value>127.0.0.1</value>
        </setting>
        <setting name="Port" serializeAs="String">
            <value>1234</value>
        </setting>
    </MyDll.Properties.Settings>
  </applicationSettings>
</configuration>

And also in this case, the LogPath is successfully passed on, but the settings for my.dll.config are not. The AssemblySettings instance is null:

AssemblySettings settings = new AssemblySettings();
// settings == null

What am I doing wrong?
Assembly.GetCallingAssembly().FullName in the constructor of AssemblySettings evaluates to "MyDll, Version=6.1.0.0, Culture=neutral, PublicKeyToken=null", but the returned instance is null.


问:
Device Autoplay settings can be MS Intunable?
Looking for a PowerShell script for enabling registry settings for cloud devices to enable device Autoplay setting as default "Open Folder to view files(File Explorer)". I believe we can wrap it with win32 / LoB and push it to all devices then.

As you are aware No such settings are available with MS Intune currently, only way is to use a Powershell script.

Really Appreciated that if someone can share the script.


问:
The session between Django and database
I wrote the database settings of PostgreSQL in settings.py as shown below :

# "settings.py"

DATABASES = {
    'default':{
        'ENGINE':'django.db.backends.postgresql',
        'NAME':'postgres',
        'USER':'postgres',
        'PASSWORD':'admin',
        'HOST':'localhost',
        'PORT':'5432',
    }
}
```
<h3><<strong>Questions</strong>>:</h3>
<ol>
<li>When starting Django server as shown below, does the session between Django and PostgreSQL start and keep connected without disconnected?</li>
</ol>
<pre class="lang-none prettyprint-override"><code>kai@DESKTOP-QVRCPAL MINGW64 ~/django-project/ (main)
$ python manage.py runserver 0.0.0.0:8000
Watching for file changes with StatReloader
Performing system checks...
</code>```

When reloading Django server by changing file contents, does the session between Django and PostgreSQL disconnect and connect again?

C:\Users\kai\django-project\store\views.py changed, reloading.
Watching for file changes with StatReloader
Performing system checks...
```
<ol start="3">
<li>When stopping Django server with <code>CTRL + C</code> as shown below, does the session between Django and PostgreSQL disconnect?</li>
</ol>
<pre class="lang-none prettyprint-override"><code>kai@DESKTOP-QVRCPAL MINGW64 ~/django-project/ (main)
$
</code>```

Are there any ways to check the session between Django and PostgreSQL connects and disconnects in Django?

Title: The session between Django and database

Body:
I wrote the database settings of PostgreSQL in settings.py as shown below :

# "settings.py"

DATABASES = {
    'default':{
        'ENGINE':'django.db.backends.postgresql',
        'NAME':'postgres',
        'USER':'postgres',
        'PASSWORD':'admin',
        'HOST':'localhost',
        'PORT':'5432',
    }
}

<Questions>:

When starting Django server as shown below, does the session between Django and PostgreSQL start and keep connected without disconnected?

kai@DESKTOP-QVRCPAL MINGW64 ~/django-project/ (main)
$ python manage.py runserver 0.0.0.0:8000
Watching for file changes with StatReloader
Performing system checks...

When reloading Django server by changing file contents, does the session between Django and PostgreSQL disconnect and connect again?

C:\Users\kai\django-project\store\views.py changed, reloading.
Watching for file changes with StatReloader
Performing system checks...

When stopping Django server with CTRL + C as shown below, does the session between Django and PostgreSQL disconnect?

kai@DESKTOP-QVRCPAL MINGW64 ~/django-project/ (main)
$

Are there any ways to check the session between Django and PostgreSQL connects and disconnects in Django?