问:
Is it possible to prevent Prettier Visual Studio Code extension from indenting the head and body HMTL elements?
So, I've been using the deprecated Beautify formatting extension for VS Code for a while now, and recently decided to make the switch to Prettier. I've been struggling to find a solution to the indentation issue and I was wondering if it was even possible?

Prettier indents the  as well as the , Beautify does not do this and it's the actual look I prefer. At the moment, the work around that I found was to just set Beautify as my formatter for HTML files, while using Prettier for everything else. Ideally, if I could do all of this with just one formatter it'd be great.

Prettier:

```<code><!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Title</title>
        <link rel="stylesheet" href="./style.css" />
    </head>
    <body>
        <p>Content</p>
    </body>
</html>
</code>```

Beautify:

```<code><!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Title</title>
    <link rel="stylesheet" href="./style.css" />
</head>
<body>
    <p>Content</p>
</body>
</html>
</code>```

My current editor settings are as follows:

```<code>"editor.defaultFormatter": "esbenp.prettier-vscode",
  "editor.formatOnPaste": true,
  "editor.formatOnSave": true,
  "editor.tabSize": 4,
  "prettier.arrowParens": "avoid",
  "prettier.singleQuote": true,
  "prettier.trailingComma": "none",
  "prettier.semi": false,
  "prettier.htmlWhitespaceSensitivity": "ignore",
  "[html]": {
    "editor.defaultFormatter": "HookyQR.beautify"
  },
  "html.format.extraLiners": " ",
</code>```

Body:
So, I've been using the deprecated Beautify formatting extension for VS Code for a while now, and recently decided to make the switch to Prettier. I've been struggling to find a solution to the indentation issue and I was wondering if it was even possible?

Prettier indents the  as well as the , Beautify does not do this and it's the actual look I prefer. At the moment, the work around that I found was to just set Beautify as my formatter for HTML files, while using Prettier for everything else. Ideally, if I could do all of this with just one formatter it'd be great.

Prettier:

<!DOCTYPE html>

        <meta charset="UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Title</title>
        <link rel="stylesheet" href="./style.css" />

Content

Beautify:

<!DOCTYPE html>

    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Title</title>
    <link rel="stylesheet" href="./style.css" />

Content

My current editor settings are as follows:

"editor.defaultFormatter": "esbenp.prettier-vscode",
  "editor.formatOnPaste": true,
  "editor.formatOnSave": true,
  "editor.tabSize": 4,
  "prettier.arrowParens": "avoid",
  "prettier.singleQuote": true,
  "prettier.trailingComma": "none",
  "prettier.semi": false,
  "prettier.htmlWhitespaceSensitivity": "ignore",
  "[html]": {
    "editor.defaultFormatter": "HookyQR.beautify"
  },
  "html.format.extraLiners": " ",


来源: stackexchange

问:
CS1503 Only For Non-Zero Values
I'm getting a compile error CS1503 (cannot convert from typeA to typeB), but only when I give a non-zero value. Why does this not happen when using zero?

For example, only the .AddDays(7 - rangeEnd.DayOfWeek) below gives this error.

```<code>                //start on sunday
                var rangeStart = new DateTime(reportingMonth.Year, reportingMonth.Month, 1);
                rangeStart = rangeStart.AddDays(0 - rangeStart.DayOfWeek);

                //end on saturday
                var rangeEnd = new DateTime(reportingMonth.Year, reportingMonth.Month, 1).AddMonths(1).AddDays(-1);
                rangeEnd = rangeEnd.AddDays(7 - rangeEnd.DayOfWeek);
</code>```

I'm running .net framework 4.7.1.

ContentLicense: CC BY-SA 4.0

Title: CS1503 Only For Non-Zero Values

Body:
I'm getting a compile error CS1503 (cannot convert from typeA to typeB), but only when I give a non-zero value. Why does this not happen when using zero?

For example, only the .AddDays(7 - rangeEnd.DayOfWeek) below gives this error.

                //start on sunday
                var rangeStart = new DateTime(reportingMonth.Year, reportingMonth.Month, 1);
                rangeStart = rangeStart.AddDays(0 - rangeStart.DayOfWeek);

                //end on saturday
                var rangeEnd = new DateTime(reportingMonth.Year, reportingMonth.Month, 1).AddMonths(1).AddDays(-1);
                rangeEnd = rangeEnd.AddDays(7 - rangeEnd.DayOfWeek);

I'm running .net framework 4.7.1.


问:
i having issues with eas build. always stuck on run gradle
Android build failed:
Gradle build failed with unknown error. See logs for the "Run gradlew" phase for more information.

**any solution? **

the same as in this forum but I also haven't found the answer
https://github.com/expo/eas-cli/issues/1496

WARNING:Software Components will not be created automatically for Maven publishing from Android Gradle Plugin 8.0. To opt-in to the future behavior, set the Gradle property android.disableAutomaticComponentCreation=true in the gradle.properties file or use the new publishing DSL.

Error: Gradle build failed with unknown error. See logs for the "Run gradlew" phase for more information.

try
expo doctor
expo doctor --fix-dependencies

but not fixed


问:
community toolkit - autocompletebox - change error Template (indicator)
Is there a solution how to change the default error template (indicator) so that the error message is displayed immediately below the text field and not only when the mouse is moved over the red symbol?

I have been looking for this issue for a long time, but could not find anything on this issue, except the following post, which did not help me either:

Style AutoCompleteBox Error Indicator


问:
% Processor Utility counter returning over 100%
I'm working in an application that needs to monitor CPU usage on Windows 10. I'm using PerformanceCounter and counter % Processor Utility. When the CPU usage in Windows Task Manager gets 100%, PerformanceCounter returning more than 100% (like 120, 170%).
PerformanceCounter cpuUsage = new PerformanceCounter("Processor Information", "% Processor Utility", "_Total", true);

Searching i've found that sometimes it's normal processor utility return more than 100%. But task manager don't show values higher than 100%.
I want to know if is there a way to "convert" processor utility return into a 100% scale? what is the highest value that the processor utility can achieve? is the maximum processor utility return limit associated with the number of cpu cores?


问:
how to ensure data is not null before passing it as props?
I have created a generic component to be used in 2 cases. 1 case when dealing with single piece of data the other when dealing with an array of data. I am trying to plot this data on a react leaflet map. Right now it works for my landingPage component which deals with the single plots of data.
Previously I had it also working for my array of data before I was passing props to generic component to render. The issue is when I try to load the page responsible for displaying the map with the array of data it returns null when the getInitPosition() function is called as the props data seems to be null when component is rendered but not null after it, I checked this through logging to console. I am confused as to how it works in the single component and not the array of data component as the calls to retrieve the data are very similar. Can anyone see where I am going wrong. It seems to be that although my polyineArray is set with correct values I then print out the polylines state to check if it is set after the call to setPolylines(polylineArray) but it seems to be empty and I do not know why?

Map array of data component:

```<code>import react from 'react';
import { useState, useEffect} from 'react';
import { MapContainer, TileLayer, Popup, Polyline} from 'react-leaflet';
import axios from 'axios';
import polyline from '@mapbox/polyline';
import MapComp from './MapComp';

function Mapp() {

    const [activities, setActivities] = useState([]);
    const [polylines, setPolylines] = useState([]);
    const [isLoading, setIsLoading] = useState(true);

useEffect(() => {
    setActivitieData();

}, [])

useEffect(() => {
    if(activities.length) {
        setPolylineArray();
        setIsLoading(false);
    }

}, [activities])

  const getActivityData = async () => {
    const response = await axios.get(
      "http://localhost:8800/api/"
    );

    return response.data;
  };

    const setActivitieData = async () => {
    const activityData = await getActivityData();
    setActivities(activityData);
  };

  const setPolylineArray = () => {
    const polylineArray = []
    for(let i = 0; i < activities.length; i++) {
        const polylineData = activities[i].map.summary_polyline;
        const activityName = activities[i].name;
        const activityType = activities[i].type

        polylineArray.push({positions: polyline.decode(polylineData), name: activityName, activityType: activityType });
    }   // should push activity type as well
    setPolylines(polylineArray);
    //setIsLoading(false);
    console.log("Polyline array = ", polylineArray);
    console.log("polylines = ", polylines) // this seems to be empty????
}

    return (
        !isLoading ?
        <MapComp activityData={{polylines}} />
        : <div><p>Loading...</p></div>
    )

}

export default Mapp;
</code>```

single data plotting component which works:

```<code>import react from 'react';
import { useState, useEffect } from 'react';
import Card from './Card';
import axios from 'axios';
import polyline from '@mapbox/polyline';

function LandingPage() {

    const [cardActivites, setCardActivities] = useState([]);
    const [polylines, setPolylines] = useState([]);
    const [cards, setCards] = useState([]);

useEffect(() => {
    setActivitieData();

}, [])

useEffect(() => {
    if(cardActivites.length) {
        setPolylineArray();
        activityCards();
    }

}, [cardActivites])

  const getActivityData = async () => {
    const response = await axios.get(
      "http://localhost:8800/api/"
    );

    return response.data;
  };

    const setActivitieData = async () => {
    const activityData = await getActivityData();
    setCardActivities(activityData);
  };

    const setPolylineArray = async () => {

    const polylineArray = []

    // right now activites refers to our button to show all activites
    // we will eventually be using global state in redux
    // for now we have a different state for card activties
    for(let i = 0; i < cardActivites.length; i++) {
        const polylineData = cardActivites[i].map.summary_polyline;
        const activityName = cardActivites[i].name;
        const activityType = cardActivites[i].type

        polylineArray.push({positions: polyline.decode(polylineData), name: activityName, activityType: activityType });
    }   // should push activity type as well
    setPolylines(polylineArray);
    console.log("Polyline array = ", polylineArray);
}

  const activityCards = async () => {
    // set up polyline array
    setCards(polylines.map((polyline, i) => {

      return <Card key={i} activityData={{polyline}}/>
    }))
    console.log("cards = ", cards);
    //return <Card activityData={{polylines}}/>

  }

    return (
        <div>
            <p>cards</p>
            {cards}
        </div>
    )

}

export default LandingPage;
</code>```

generic component: import react from 'react';

```<code>import { MapContainer, TileLayer, Popup, Polyline} from 'react-leaflet';
import polyline from '@mapbox/polyline';
import { useEffect, useState } from 'react';

function MapComp(props) {

    function getInitPosition() {
        console.log("props activity data = ", props);
        if(!Array.isArray(props.activityData)) {
            return [props.activityData.positions[0][0],props.activityData.positions[0][1]];

        }
        else {
            return [props.activityData.poylines.positions[0][0],props.activityData.poylines.positions[0][1]];
        }
    }

    return (
         <MapContainer center={getInitPosition()} zoom={15} scrollWheelZoom={false} style={props.style}>
            <TileLayer attribution='© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
                url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
            />

                {!Array.isArray(props.activityData) && <Polyline positions={props.activityData.positions} >
                    <Popup>
                        <div>
                            <h2>{"Name: " + + props.activityData.name}</h2>
                        </div>
                    </Popup>
                </Polyline>
                }

            {Array.isArray(props.activityData.polylines) && props.activityData.polylines.length > 1 &&

                props.activityData.polylines.map((activity, idx) => (
                    <Polyline key={idx} positions={activity.positions}
                        <Popup>
                            <div>
                                <h2>{"Name: " + activity.name}</h2>
                            </div>
                        </Popup>
                    </Polyline>
                ))}

        </MapContainer>
    )
}

export default MapComp;
</code>```

Can anyone see my issue why polylines isn't being set or how to ensure it is set before passing the data as props?

Body:
I have created a generic component to be used in 2 cases. 1 case when dealing with single piece of data the other when dealing with an array of data. I am trying to plot this data on a react leaflet map. Right now it works for my landingPage component which deals with the single plots of data.
Previously I had it also working for my array of data before I was passing props to generic component to render. The issue is when I try to load the page responsible for displaying the map with the array of data it returns null when the getInitPosition() function is called as the props data seems to be null when component is rendered but not null after it, I checked this through logging to console. I am confused as to how it works in the single component and not the array of data component as the calls to retrieve the data are very similar. Can anyone see where I am going wrong. It seems to be that although my polyineArray is set with correct values I then print out the polylines state to check if it is set after the call to setPolylines(polylineArray) but it seems to be empty and I do not know why?

Map array of data component:

import react from 'react';
import { useState, useEffect} from 'react';
import { MapContainer, TileLayer, Popup, Polyline} from 'react-leaflet';
import axios from 'axios';
import polyline from '@mapbox/polyline';
import MapComp from './MapComp';

function Mapp() {

    const [activities, setActivities] = useState([]);
    const [polylines, setPolylines] = useState([]);
    const [isLoading, setIsLoading] = useState(true);

useEffect(() => {
    setActivitieData();

}, [])

useEffect(() => {
    if(activities.length) {
        setPolylineArray();
        setIsLoading(false);
    }

}, [activities])

  const getActivityData = async () => {
    const response = await axios.get(
      "http://localhost:8800/api/"
    );

    return response.data;
  };

    const setActivitieData = async () => {
    const activityData = await getActivityData();
    setActivities(activityData);
  };

  const setPolylineArray = () => {
    const polylineArray = []
    for(let i = 0; i < activities.length; i++) {
        const polylineData = activities[i].map.summary_polyline;
        const activityName = activities[i].name;
        const activityType = activities[i].type

        polylineArray.push({positions: polyline.decode(polylineData), name: activityName, activityType: activityType });
    }   // should push activity type as well
    setPolylines(polylineArray);
    //setIsLoading(false);
    console.log("Polyline array = ", polylineArray);
    console.log("polylines = ", polylines) // this seems to be empty????
}

    return (
        !isLoading ?
        <MapComp activityData={{polylines}} />
        :

Loading...

    )

}

export default Mapp;

single data plotting component which works:

import react from 'react';
import { useState, useEffect } from 'react';
import Card from './Card';
import axios from 'axios';
import polyline from '@mapbox/polyline';

function LandingPage() {

    const [cardActivites, setCardActivities] = useState([]);
    const [polylines, setPolylines] = useState([]);
    const [cards, setCards] = useState([]);

useEffect(() => {
    setActivitieData();

}, [])

useEffect(() => {
    if(cardActivites.length) {
        setPolylineArray();
        activityCards();
    }

}, [cardActivites])

  const getActivityData = async () => {
    const response = await axios.get(
      "http://localhost:8800/api/"
    );

    return response.data;
  };

    const setActivitieData = async () => {
    const activityData = await getActivityData();
    setCardActivities(activityData);
  };

    const setPolylineArray = async () => {

    const polylineArray = []

    // right now activites refers to our button to show all activites
    // we will eventually be using global state in redux
    // for now we have a different state for card activties
    for(let i = 0; i < cardActivites.length; i++) {
        const polylineData = cardActivites[i].map.summary_polyline;
        const activityName = cardActivites[i].name;
        const activityType = cardActivites[i].type

        polylineArray.push({positions: polyline.decode(polylineData), name: activityName, activityType: activityType });
    }   // should push activity type as well
    setPolylines(polylineArray);
    console.log("Polyline array = ", polylineArray);
}

  const activityCards = async () => {
    // set up polyline array
    setCards(polylines.map((polyline, i) => {

      return <Card key={i} activityData={{polyline}}/>
    }))
    console.log("cards = ", cards);
    //return <Card activityData={{polylines}}/>

  }

    return (

cards

            {cards}

    )

}

export default LandingPage;

generic component: import react from 'react';

import { MapContainer, TileLayer, Popup, Polyline} from 'react-leaflet';
import polyline from '@mapbox/polyline';
import { useEffect, useState } from 'react';

function MapComp(props) {

    function getInitPosition() {
        console.log("props activity data = ", props);
        if(!Array.isArray(props.activityData)) {
            return [props.activityData.positions[0][0],props.activityData.positions[0][1]];

        }
        else {
            return [props.activityData.poylines.positions[0][0],props.activityData.poylines.positions[0][1]];
        }
    }

    return (
         <MapContainer center={getInitPosition()} zoom={15} scrollWheelZoom={false} style={props.style}>
            <TileLayer attribution='© OpenStreetMap contributors'
                url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
            />

                {!Array.isArray(props.activityData) && <Polyline positions={props.activityData.positions} >
                    <Popup>

{"Name: " + + props.activityData.name}

                    </Popup>
                </Polyline>
                }

            {Array.isArray(props.activityData.polylines) && props.activityData.polylines.length > 1 &&

                props.activityData.polylines.map((activity, idx) => (
                    <Polyline key={idx} positions={activity.positions}
                        <Popup>

{"Name: " + activity.name}

                        </Popup>
                    </Polyline>
                ))}

        </MapContainer>
    )
}

export default MapComp;

Can anyone see my issue why polylines isn't being set or how to ensure it is set before passing the data as props?


问:
Datadog query to filter if a string is contained within a tag
I have a parameter, id, that populates a monitor for each id accordingly.  I am trying to filter the query so that it excludes those where "to_redshift" is contained within the id.  Note, "to_redshift" can either be at the prefix, suffix, or somewhere throughout the id itself.  How would I go about doing this?

Here is the current query:

```<code>max(last_1h):airflow.dagrun.duration.success.max{namespace: text} by {id}
</code>```

I have tried

```<code>max(last_1h):airflow.dagrun.duration.success.max{namespace: text,!id:to_redshift*} by {id}
</code>```

but that is only looking for the prefix and is where i'm currently stuck.  Any help is appreciated!

Body:
I have a parameter, id, that populates a monitor for each id accordingly.  I am trying to filter the query so that it excludes those where "to_redshift" is contained within the id.  Note, "to_redshift" can either be at the prefix, suffix, or somewhere throughout the id itself.  How would I go about doing this?

Here is the current query:

max(last_1h):airflow.dagrun.duration.success.max{namespace: text} by {id}

I have tried

max(last_1h):airflow.dagrun.duration.success.max{namespace: text,!id:to_redshift*} by {id}

but that is only looking for the prefix and is where i'm currently stuck.  Any help is appreciated!


问:
Allow iOS app to show up in Mac AppStore?
I am trying to figure out why some iOS apps show up on the Mac app store in the iPhone and iPad Apps menu, and others don't. I recall a while back seeing an option in the dev portal with a checkbox that would allow or not allow an iOS app to show up on the Mac AppStore (silicon chip...).

Does anyone know how to enable an iOS app to show up on the Mac AppStore?


问:
Border/Fill Around Strip Chart Points

Question

I know this question (or similar questions) have been posted, though I cannot seem to find what is going on.

I am doing a strip chart and I have tried using both geom_jitter(position = position_jitter(0.065)) and geom_point(position = position_jitter(0.065)), but I cannot seem to put a border around each of my points.

I have been only able to fill them with a colour, regardless of whether I use fill = or colour =.

Code:

```<code>ggplot(Titanic.Data, aes(x = as.factor(Survive),
                         y = Age,
                         colour = Survive)) +

  geom_jitter(position = position_jitter(0.065)) +

  labs(x = "Survive",
       y = "Age",
       title = "Strip Chart of Age vs Survive") +

  scale_colour_manual(values = c("DarkBlue", "DarkRed")) +

  theme_test() +

  theme(plot.title = element_text(hjust = 0.5,
                                  face = "bold",
                                  size = 18)) +

  theme(legend.position = "none")
</code>```

Graph:

Here is what the graph will look like

Code

The data set is huge, and I do not know how to add the file to this thread so here is a small portion of it.

Titanic Data

Title: Border/Fill Around Strip Chart Points

Body:
Question

I know this question (or similar questions) have been posted, though I cannot seem to find what is going on.

I am doing a strip chart and I have tried using both geom_jitter(position = position_jitter(0.065)) and geom_point(position = position_jitter(0.065)), but I cannot seem to put a border around each of my points.

I have been only able to fill them with a colour, regardless of whether I use fill = or colour =.

Code:

ggplot(Titanic.Data, aes(x = as.factor(Survive),
                         y = Age,
                         colour = Survive)) +

  geom_jitter(position = position_jitter(0.065)) +

  labs(x = "Survive",
       y = "Age",
       title = "Strip Chart of Age vs Survive") +

  scale_colour_manual(values = c("DarkBlue", "DarkRed")) +

  theme_test() +

  theme(plot.title = element_text(hjust = 0.5,
                                  face = "bold",
                                  size = 18)) +

  theme(legend.position = "none")

Graph:

Here is what the graph will look like

Code

The data set is huge, and I do not know how to add the file to this thread so here is a small portion of it.

Titanic Data


问:
Styles imported from node_modules do not work on Vercel (but work on local environment)
I am importing Uppy styles in my component. In the local environment styles are successfully loaded from Uppy module. But when app is deployed to Vercel then the CSS files are not loaded.

What am I missing?

```<code>import Uppy from "@uppy/core";
import { Dashboard } from "@uppy/react";
import "@uppy/core/dist/style.css";
import "@uppy/dashboard/dist/style.css";

export default function UploadPage() {
  const uppy = new Uppy();

  return (
    <Dashboard uppy={uppy} />
  )
}
</code>```

Body:
I am importing Uppy styles in my component. In the local environment styles are successfully loaded from Uppy module. But when app is deployed to Vercel then the CSS files are not loaded.

What am I missing?

import Uppy from "@uppy/core";
import { Dashboard } from "@uppy/react";
import "@uppy/core/dist/style.css";
import "@uppy/dashboard/dist/style.css";

export default function UploadPage() {
  const uppy = new Uppy();

  return (
    <Dashboard uppy={uppy} />
  )
}


问:
Stop fragment refresh when using NavGraph in Bottom Navigation
I am using navigationGraph and bottom navigation.I know that fragments are recreate every time bottomnavigation buttons are clicked in BottomNavigation. If there is already a fragment created  I don't want the fragment to be refreshed in bottomnavigation passes like in other applications(like twitter,instagram etc.).  When I return to MainFragment again, all views are recreated again and unnecessarily pulls data from the database again. Many questions have been asked about this, but none of them worked as I wanted. Any suggestions?

I uploaded a photo. When I go back to MainFragment from other fragments, MainFragment is recreated again .

Main Activity code;

```<code>   override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContentView(R.layout.activity_main)

    navController=findNavController(R.id.main_fragmentContainerView)
    val appBarConfiguration = AppBarConfiguration(
        setOf(
            R.id.mainFragment,
            R.id.searchFragment,
            R.id.userProfileFragment
        )
    )

    bottomNavigationView.setupWithNavController(navController)
    setupActionBarWithNavController(navController,appBarConfiguration)
}

override fun onNavigateUp(): Boolean {
    return navController.navigateUp()||super.onSupportNavigateUp()
}
</code>```

MainFragment

```<code>   override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
    super.onViewCreated(view, savedInstanceState)

        readDatabase()
}
</code>```

Body:
I am using navigationGraph and bottom navigation.I know that fragments are recreate every time bottomnavigation buttons are clicked in BottomNavigation. If there is already a fragment created  I don't want the fragment to be refreshed in bottomnavigation passes like in other applications(like twitter,instagram etc.).  When I return to MainFragment again, all views are recreated again and unnecessarily pulls data from the database again. Many questions have been asked about this, but none of them worked as I wanted. Any suggestions?

I uploaded a photo. When I go back to MainFragment from other fragments, MainFragment is recreated again .

Main Activity code;

   override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContentView(R.layout.activity_main)

    navController=findNavController(R.id.main_fragmentContainerView)
    val appBarConfiguration = AppBarConfiguration(
        setOf(
            R.id.mainFragment,
            R.id.searchFragment,
            R.id.userProfileFragment
        )
    )

    bottomNavigationView.setupWithNavController(navController)
    setupActionBarWithNavController(navController,appBarConfiguration)
}

override fun onNavigateUp(): Boolean {
    return navController.navigateUp()||super.onSupportNavigateUp()
}

MainFragment

   override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
    super.onViewCreated(view, savedInstanceState)

        readDatabase()
}


问:
SQL syntax error on first password setting (docker, wsl2)
I'm currently setting a docker to run a mysql container on my computer. ( I'm a windows user, so I downloaded Docker Desktop, and installed wsl2 with ubuntu diro and it runs ).

The problem is the following : when I try to change the 'root' user password of my localhost, I see

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IDENTIFIED BY 'any-pwd' at line 1

Here is the command line I try to execute : mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'any-pwd';

I've been following this tutorial from the official mysql documentation : https://dev.mysql.com/doc/mysql-installation-excerpt/8.0/en/docker-mysql-getting-started.html

I also tried to "flush priviliege", but I'm still facing an error : You must SET PASSWORD before executing this statement, (I know, that's what I'm trying to do!)

But the "set password" seemed to be a sql piece of code so I tried the following :
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('password');

And you know what, it works! I had this problem because I use the docker mysql image with 5.6 tag, and so I got to use the last sql command, not the first.

Well there is no question, but I post it here if it can help someone one day!


问:
Customizing a complex Apollo gql query at runtime
I've been using @skip and @include directives in a couple of my queries and while they work quite good for 'simply' customisable queries I'm looking for a solution supporting a highly customisable query. I'm talking about ~20 fields, each of them skipped/included by it's own individual flag. While passing 20 boolean arguments to the query and using @include(if: $the_flag) 20 times is theoretically possible I'm looking for a better way of doing that. Like passing a configuration object and including some query parts based on it's fields, or maybe merging the query from stitches based on each flag.

I've read about @graphql-tools/stitch but I'm not sure my solution will benefit this approach with ~20 stitches. Is there any tool or any easy way to create a highly customisable query based on multiple conditions on the fly?


问:
What is causing Postgres error 'Operation not permitted'?
I have been trying to create a Postgres database using the following docker compose file:

```<code>version: '3'
services:
  postgres:
    image: "postgres"
    environment:
      - POSTGRES_USER=root
      - POSTGRES_PASSWORD=root
      - POSTGRES_DB=root
    ports:
      - "5432:5432"
    volumes:
      - ./migration/docker-database-initial.sql:/docker-entrypoint-initdb.d/docker-database-initial.sql

  pgadmin-compose:
    image: dpage/pgadmin4
    environment:
      PGADMIN_DEFAULT_EMAIL: "kaio@mail.com"
      PGADMIN_DEFAULT_PASSWORD: "******"
    ports:
      - "54321:80"
    depends_on:
      - postgres

</code>```

It tries to initialize a table with this script:

create table wikis(
    id serial primary key,
    name varchar,
    bio varchar
);

INSERT INTO wikis(name, bio) VALUES
('Name1', 'Bio1.'),
('Name2', 'Bio2.');
```
<p>After the db is created and connected to the postgres container host, the table is not initialized. I've found this error log during the build process:</p>
```/usr/local/bin/docker-entrypoint.sh: running /docker-entrypoint-initdb.d/docker-database-initial.sql
psql: error: /docker-entrypoint-initdb.d/docker-database-initial.sql: Operation not permitted
```
<p>Expected output:
<img src="https://i.stack.imgur.com/My3nm.png" alt="database table initialized" /></p>
<p>Actual output:
<img src="https://i.stack.imgur.com/VI3bj.png" alt="database table missing" /></p>
<p>I've tried enabling Full Disk Access to my terminal on MacOS Security & Privacy.</p>
<p>Also ran the following chmod commands in the script's directory:</p>
``` ✘ kaiocunha@Kaios-MacBook-Pro  ~/Desktop/projects/git/go/api-go-rest  ↱ master ±  chmod 775 -R migration
chmod: -R: No such file or directory
 ✘ kaiocunha@Kaios-MacBook-Pro  ~/Desktop/projects/git/go/api-go-rest  ↱ master  chmod 775 -R migration/docker-database-initial.sql
chmod: -R: No such file or directory
 ✘ kaiocunha@Kaios-MacBook-Pro  ~/Desktop/projects/git/go/api-go-rest  ↱ master 
```

The whole code can be found here.

Does anyone know why this is happening?

Body:
I have been trying to create a Postgres database using the following docker compose file:

version: '3'
services:
  postgres:
    image: "postgres"
    environment:
      - POSTGRES_USER=root
      - POSTGRES_PASSWORD=root
      - POSTGRES_DB=root
    ports:
      - "5432:5432"
    volumes:
      - ./migration/docker-database-initial.sql:/docker-entrypoint-initdb.d/docker-database-initial.sql

  pgadmin-compose:
    image: dpage/pgadmin4
    environment:
      PGADMIN_DEFAULT_EMAIL: "kaio@mail.com"
      PGADMIN_DEFAULT_PASSWORD: "******"
    ports:
      - "54321:80"
    depends_on:
      - postgres

It tries to initialize a table with this script:

create table wikis(
    id serial primary key,
    name varchar,
    bio varchar
);

INSERT INTO wikis(name, bio) VALUES
('Name1', 'Bio1.'),
('Name2', 'Bio2.');

After the db is created and connected to the postgres container host, the table is not initialized. I've found this error log during the build process:

/usr/local/bin/docker-entrypoint.sh: running /docker-entrypoint-initdb.d/docker-database-initial.sql
psql: error: /docker-entrypoint-initdb.d/docker-database-initial.sql: Operation not permitted

Expected output:

Actual output:

I've tried enabling Full Disk Access to my terminal on MacOS Security & Privacy.

Also ran the following chmod commands in the script's directory:

 ✘ kaiocunha@Kaios-MacBook-Pro  ~/Desktop/projects/git/go/api-go-rest  ↱ master ±  chmod 775 -R migration
chmod: -R: No such file or directory
 ✘ kaiocunha@Kaios-MacBook-Pro  ~/Desktop/projects/git/go/api-go-rest  ↱ master  chmod 775 -R migration/docker-database-initial.sql
chmod: -R: No such file or directory
 ✘ kaiocunha@Kaios-MacBook-Pro  ~/Desktop/projects/git/go/api-go-rest  ↱ master 

The whole code can be found here.

Does anyone know why this is happening?


问:
ATmega 328p behaving weird with a static function
I'm trying to use an ATmega 328p (Arduino Ethernet) to control a Wiznet W5100 Ethernet controller. The libraries I'm using are tested and work, but for me they don't. Here's what I tracked the problem down to:

I'm trying to read two registers, that tell me how many bytes of data have been received by the W5100:

```<code>uint16_t readTest()
{
    uint16_t res = W5100.read(0x0426);
    res = (res << 8) + W5100.read(0x0427);
    return res;
}
</code>```

But even though I'm not sending any data, this function, called from main(), will return 1024 instead of 0. Now comes the weird part: If I add the static keyword like this:

```<code>static uint16_t readTest()
{
    uint16_t res = W5100.read(0x0426);
    res = (res << 8) + W5100.read(0x0427);
    return res;
}
</code>```

Then the function suddently returns 0 as it is supposed to!
Also I could change it to this:

```<code>uint16_t readTest()
{
    return (W5100.read(0x0426) << 8) + W5100.read(0x0427);
}
</code>```

This must be the compiler messing with me. I really don't get it. To compile I use the standard Arduino IDE, the command looks something like this:

```<code>avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=22 -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/libraries/SoftwareSerial -I/home/xc317/sketchbook/libraries/serlcd -I/usr/share/arduino/libraries/SPI -I/usr/share/arduino/libraries/Ethernet -I/usr/share/arduino/libraries/Ethernet/utility /usr/share/arduino/libraries/Ethernet/Server.cpp -o/tmp/build1305752250561284982.tmp/Ethernet/Server.cpp.o
</code>```

What is the reason for this behaviour?

ContentLicense: CC BY-SA 3.0

Body:
I'm trying to use an ATmega 328p (Arduino Ethernet) to control a Wiznet W5100 Ethernet controller. The libraries I'm using are tested and work, but for me they don't. Here's what I tracked the problem down to:

I'm trying to read two registers, that tell me how many bytes of data have been received by the W5100:

uint16_t readTest()
{
    uint16_t res = W5100.read(0x0426);
    res = (res << 8) + W5100.read(0x0427);
    return res;
}

But even though I'm not sending any data, this function, called from main(), will return 1024 instead of 0. Now comes the weird part: If I add the static keyword like this:

static uint16_t readTest()
{
    uint16_t res = W5100.read(0x0426);
    res = (res << 8) + W5100.read(0x0427);
    return res;
}

Then the function suddently returns 0 as it is supposed to!
Also I could change it to this:

uint16_t readTest()
{
    return (W5100.read(0x0426) << 8) + W5100.read(0x0427);
}

This must be the compiler messing with me. I really don't get it. To compile I use the standard Arduino IDE, the command looks something like this:

avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=22 -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/libraries/SoftwareSerial -I/home/xc317/sketchbook/libraries/serlcd -I/usr/share/arduino/libraries/SPI -I/usr/share/arduino/libraries/Ethernet -I/usr/share/arduino/libraries/Ethernet/utility /usr/share/arduino/libraries/Ethernet/Server.cpp -o/tmp/build1305752250561284982.tmp/Ethernet/Server.cpp.o

What is the reason for this behaviour?


问:
Google apps script: UrlFetchApp does not support body inside a request
trying to make a small script that would update stock in my store. This code should be working with yandex market api. They do not accept payload parameter and waiting for 'body' in the request. But at the same time look like URLFetchApp (google apps script) only can send payload and body isn't supported. Is there any way to resolve this?

```<code>function api_request(){
  const url = 'https://api.partner.market.yandex.ru/v2/campaigns/2252398/offers/stocks.json'
  var body =  {"skus": [{"sku": "1", "warehouseId": 355055, "items": [{"type": "FIT", "count": 15, "updatedAt": get_utc_date()}]}]}
  var body = JSON.stringify(body)
  const params = {
    method: 'Put',
    'Content-Type': 'application/json',
    muteHttpExceptions: true,
    //'payload': body,
    'body': body,
    headers: {
      'Authorization': 'OAuth oauth_token="abcd", oauth_client_id="abc"'
    }
  };
  console.log(params)
  var r = UrlFetchApp.fetch(url, params);
  r = JSON.parse(r);
  console.log(r)
}
</code>```

Sending this as request:

```<code>{ method: 'Put',
  'Content-Type': 'application/json',
  muteHttpExceptions: true,
  body: '{"skus":[{"sku":"1","warehouseId":355055,"items":[{"type":"FIT","count":15,"updatedAt":"2022-12-27T20:28:10+03:00"}]}]}',
  headers: { Authorization: 'OAuth oauth_token="abcd", oauth_client_id="abc"' } }
</code>```

And getting this response:

```<code>{ error: { code: 400, message: 'Required request body is missing' },
  errors:
   [ { code: 'BAD_REQUEST',
       message: 'Required request body is missing' } ],
  status: 'ERROR' }
</code>```

When payload used - getting the same response.

Any ideas please? :)

I've tried to use body / payload, getting the same response

Body:
trying to make a small script that would update stock in my store. This code should be working with yandex market api. They do not accept payload parameter and waiting for 'body' in the request. But at the same time look like URLFetchApp (google apps script) only can send payload and body isn't supported. Is there any way to resolve this?

function api_request(){
  const url = 'https://api.partner.market.yandex.ru/v2/campaigns/2252398/offers/stocks.json'
  var body =  {"skus": [{"sku": "1", "warehouseId": 355055, "items": [{"type": "FIT", "count": 15, "updatedAt": get_utc_date()}]}]}
  var body = JSON.stringify(body)
  const params = {
    method: 'Put',
    'Content-Type': 'application/json',
    muteHttpExceptions: true,
    //'payload': body,
    'body': body,
    headers: {
      'Authorization': 'OAuth oauth_token="abcd", oauth_client_id="abc"'
    }
  };
  console.log(params)
  var r = UrlFetchApp.fetch(url, params);
  r = JSON.parse(r);
  console.log(r)
}

Sending this as request:

{ method: 'Put',
  'Content-Type': 'application/json',
  muteHttpExceptions: true,
  body: '{"skus":[{"sku":"1","warehouseId":355055,"items":[{"type":"FIT","count":15,"updatedAt":"2022-12-27T20:28:10+03:00"}]}]}',
  headers: { Authorization: 'OAuth oauth_token="abcd", oauth_client_id="abc"' } }

And getting this response:

{ error: { code: 400, message: 'Required request body is missing' },
  errors:
   [ { code: 'BAD_REQUEST',
       message: 'Required request body is missing' } ],
  status: 'ERROR' }

When payload used - getting the same response.

Any ideas please? :)

I've tried to use body / payload, getting the same response


问:
Import "django.urls" could not be resolved from source
```<code>from django.urls import path
from . import views

urlpatterns = [
    path("" , views.index, name="index")
]

</code>```

django.urls part

Import "django.urls" could not be resolved from source

I tried everything but it didn't work

Body:
from django.urls import path
from . import views

urlpatterns = [
    path("" , views.index, name="index")
]

django.urls part

Import "django.urls" could not be resolved from source

I tried everything but it didn't work


问:
How to dynamically add columns in Dataframe Spark by using a config.ini file parameters
I am learning to use Pyspark and at work I have been assigned a task that I can not solve for now.

There is a config.ini file where there are a series of configurations for spark as well as for the tables, routes and files that we are going to use.

With a structure like this for the rest of the values for example:

```<code>[paths]
path_file_orig=/Sources/dimension/revenues

[sep]
delimiter_coma = ,
delimiter_pipe = |

[tables]
table_name = nyse
partition_name = partition_date
</code>```

One of the many problems I have is that I am asked to add in this config.ini the parameters of a new ingest to be performed.

We are going to get a file with fixed width and where each column has a width.

I am suggested that the config.ini file should have something like:

column_name, length, type

Because that file in the future can grow in size of columns and it is required that the dataframe is dynamic, that it takes from that config.ini file the names, the widths and that's it.

I was reading about how to load a file with a fixed width

```<code>df = spark.read.text("/tmp/sample.txt")
df.select(
    df.value.substr(1,3).alias('id'),
    df.value.substr(4,8).alias('date'),
    df.value.substr(12,3).alias('string'),
    df.value.substr(15,4).cast('integer').alias('integer')
).show()
</code>```

taken from this question

But how do I generate the dataframe if the name and width of the columns come in the configuration file?

I was reading too some dynamic generation here but it doesn't take it from a file, it takes it from the same columns that the dataframe already has: example

Also, I'm missing how should I include the name and width of the columns in the config.ini because as I put at the beginning, I saw that the config file comes directly with the key and value.

When I invoke them, I put:

```<code>import configparser

conf = configparser.ConfigParser()
conf.read(config_file)
</code>```

and from there the variables are set

```<code>source_file_path = conf.get('paths','source_file_path')
path_file_dest_one_path = conf.get('paths','path_file_dest_one_path')
del_option_test_one = conf.get('sep','delimiter_coma')
</code>```

But in the case of the columns of the new ingest, as they are dynamic (in the config.ini), how do I configure them to take all the ones that come?

Body:
I am learning to use Pyspark and at work I have been assigned a task that I can not solve for now.

There is a config.ini file where there are a series of configurations for spark as well as for the tables, routes and files that we are going to use.

With a structure like this for the rest of the values for example:

[paths]
path_file_orig=/Sources/dimension/revenues

[sep]
delimiter_coma = ,
delimiter_pipe = |

[tables]
table_name = nyse
partition_name = partition_date

One of the many problems I have is that I am asked to add in this config.ini the parameters of a new ingest to be performed.

We are going to get a file with fixed width and where each column has a width.

I am suggested that the config.ini file should have something like:

column_name, length, type

Because that file in the future can grow in size of columns and it is required that the dataframe is dynamic, that it takes from that config.ini file the names, the widths and that's it.

I was reading about how to load a file with a fixed width

df = spark.read.text("/tmp/sample.txt")
df.select(
    df.value.substr(1,3).alias('id'),
    df.value.substr(4,8).alias('date'),
    df.value.substr(12,3).alias('string'),
    df.value.substr(15,4).cast('integer').alias('integer')
).show()

taken from this question

But how do I generate the dataframe if the name and width of the columns come in the configuration file?

I was reading too some dynamic generation here but it doesn't take it from a file, it takes it from the same columns that the dataframe already has: example

Also, I'm missing how should I include the name and width of the columns in the config.ini because as I put at the beginning, I saw that the config file comes directly with the key and value.

When I invoke them, I put:

import configparser

conf = configparser.ConfigParser()
conf.read(config_file)

and from there the variables are set

source_file_path = conf.get('paths','source_file_path')
path_file_dest_one_path = conf.get('paths','path_file_dest_one_path')
del_option_test_one = conf.get('sep','delimiter_coma')

But in the case of the columns of the new ingest, as they are dynamic (in the config.ini), how do I configure them to take all the ones that come?


问:
implicit entry/start for main executable
I am rather new to C and have been following a book on C algorithms. A small section has provided details on adding a node to the beginning.

For example:

```<code>Algorithm:ADD_BEG (HEAD, ITEM)
1. [Create the new node]
a) Allocate memory for NEW node.
b) IF NEW = NULL then Print: “Memory not Available” and Return
c) Set NEW→DATA = ITEM
d) Set NEW→LINK = HEAD
2. [Make the HEADER to point to the NEW node]
Set HEAD = NEW
3. Return
</code>```

Here is what I have attempted:

```<code>#include <stdlib.h>
#include <stdio.h>

typedef struct node {
    int DATA;
    struct node * LINK;
} node_t;

node_t add_beg(struct node* head, int item){
    node_t* new =  NULL;
    new = (node_t *)malloc(5*sizeof(node_t));
    if (new == NULL){
        printf("Memory not available");
        return *new;
    }
    new ->DATA = item;
    new ->LINK = head;

    head = new;
    return *head;
}
</code>```

Output:

```<code>gcc -o exercise_1 exercise_1.c

Undefined symbols for architecture x86_64:
  "_main", referenced from:
     implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
</code>```

What does the error refer to?

Body:
I am rather new to C and have been following a book on C algorithms. A small section has provided details on adding a node to the beginning.

For example:

Algorithm:ADD_BEG (HEAD, ITEM)
1. [Create the new node]
a) Allocate memory for NEW node.
b) IF NEW = NULL then Print: “Memory not Available” and Return
c) Set NEW→DATA = ITEM
d) Set NEW→LINK = HEAD
2. [Make the HEADER to point to the NEW node]
Set HEAD = NEW
3. Return

Here is what I have attempted:

#include <stdlib.h>
#include <stdio.h>

typedef struct node {
    int DATA;
    struct node * LINK;
} node_t;

node_t add_beg(struct node* head, int item){
    node_t* new =  NULL;
    new = (node_t *)malloc(5*sizeof(node_t));
    if (new == NULL){
        printf("Memory not available");
        return *new;
    }
    new ->DATA = item;
    new ->LINK = head;

    head = new;
    return *head;
}

Output:

gcc -o exercise_1 exercise_1.c

Undefined symbols for architecture x86_64:
  "_main", referenced from:
     implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

What does the error refer to?


问:
Remote host closed error in wkhtmltopdf using python
I am trying to convert websites with many "foreign" objects.
This is my code:

```<code>path_to_wkhtmltopdf = "C:\\Program Files\\wkhtmltopdf\\bin\\wkhtmltopdf.exe"
config = pdfkit.configuration(wkhtmltopdf=path_to_wkhtmltopdf)
options = {'page-size': "letter", 'no-print-media-type': True}
...
    pdfkit.from_url(link, output_path=output_path, configuration=config, options=options)
</code>```

This is my error code:

```<code>Traceback (most recent call last):
  File, line 15, in <module>
    pdfkit.from_url(link, output_path=output_path, configuration=config, options=options)
  File, line 27, in from_url
    return r.to_pdf(output_path)
  File, line 201, in to_pdf
    self.handle_error(exit_code, stderr)
  File, line 155, in handle_error
    raise IOError('wkhtmltopdf reported an error:\n' + stderr)
OSError: wkhtmltopdf reported an error:
QFont::setPixelSize: Pixel size <= 0 (0)
QFont::setPixelSize: Pixel size <= 0 (0)
QFont::setPixelSize: Pixel size <= 0 (0)
QFont::setPixelSize: Pixel size <= 0 (0)
QFont::setPixelSize: Pixel size <= 0 (0)
QFont::setPixelSize: Pixel size <= 0 (0)
QFont::setPixelSize: Pixel size <= 0 (0)
QFont::setPixelSize: Pixel size <= 0 (0)
QFont::setPixelSize: Pixel size <= 0 (0)
QFont::setPixelSize: Pixel size <= 0 (0)
QFont::setPixelSize: Pixel size <= 0 (0)
QFont::setPixelSize: Pixel size <= 0 (0)
QFont::setPixelSize: Pixel size <= 0 (0)
QFont::setPixelSize: Pixel size <= 0 (0)
QFont::setPixelSize: Pixel size <= 0 (0)
Exit with code 1 due to network error: RemoteHostClosedError
</code>```

I tried adding enable local file access option, and the same error occurred.

Body:
I am trying to convert websites with many "foreign" objects.
This is my code:

path_to_wkhtmltopdf = "C:\\Program Files\\wkhtmltopdf\\bin\\wkhtmltopdf.exe"
config = pdfkit.configuration(wkhtmltopdf=path_to_wkhtmltopdf)
options = {'page-size': "letter", 'no-print-media-type': True}
...
    pdfkit.from_url(link, output_path=output_path, configuration=config, options=options)

This is my error code:

Traceback (most recent call last):
  File, line 15, in <module>
    pdfkit.from_url(link, output_path=output_path, configuration=config, options=options)
  File, line 27, in from_url
    return r.to_pdf(output_path)
  File, line 201, in to_pdf
    self.handle_error(exit_code, stderr)
  File, line 155, in handle_error
    raise IOError('wkhtmltopdf reported an error:\n' + stderr)
OSError: wkhtmltopdf reported an error:
QFont::setPixelSize: Pixel size <= 0 (0)
QFont::setPixelSize: Pixel size <= 0 (0)
QFont::setPixelSize: Pixel size <= 0 (0)
QFont::setPixelSize: Pixel size <= 0 (0)
QFont::setPixelSize: Pixel size <= 0 (0)
QFont::setPixelSize: Pixel size <= 0 (0)
QFont::setPixelSize: Pixel size <= 0 (0)
QFont::setPixelSize: Pixel size <= 0 (0)
QFont::setPixelSize: Pixel size <= 0 (0)
QFont::setPixelSize: Pixel size <= 0 (0)
QFont::setPixelSize: Pixel size <= 0 (0)
QFont::setPixelSize: Pixel size <= 0 (0)
QFont::setPixelSize: Pixel size <= 0 (0)
QFont::setPixelSize: Pixel size <= 0 (0)
QFont::setPixelSize: Pixel size <= 0 (0)
Exit with code 1 due to network error: RemoteHostClosedError

I tried adding enable local file access option, and the same error occurred.


问:
connect to mysql database (xamp) avec reactJS
Can I connect to Database mysql with reactJs?

I want to use  information from mysql database  without developing a back-end.


问:
Add little bit of post-content to password protected post
in my page i have a blog with posts.

I want posts to be password protected, so i did it in basic wordpress settings.
But the problem is, that i want to show for example 100 words from post-content, and then show the password field. And when visitors set the right password, then full post will show. I tryed everything, but nothing works for me.

I tried it by showing post_excerpt, but excerpt is not formatting good.


问:
Can i set the paths in tsconfig for multiple packages in a monorepo?
I'm trying to setup a monorepo from scratch for learning purposes. It seemed to make sense to structure it like so. I installed a lot of dev dependencies in the root which seems to make sense since i did pull the packages out of a single repo, and it seems that I would have to repeat them all in each module.

Eslint and ts seem to play nicely if i use no aliases, however i would like to try to achieve this:

```<code>root/
├─ packages/
|  |
│  ├─ foo/
│  │  ├─ src/
│  │  |  ├─ a.ts
│  │  |  ├─ index.ts
│  │  |  ├─ nested/
│  │  |     ├─ b.ts
│  |  ├─ package.json
|  |
│  ├─ bar/
│  │  ├─ src/
│  │  |  ├─ index.ts
│  |  ├─ package.json
|  |
│  ├─ baz/
│     ├─ src/
│     |  ├─ index.ts
│     ├─ package.json
|
├─ tsconfig.json
├─ package.json
</code>```

If I'm in a module, I want to use ~ for an absolute path "for that module":

```<code>// packages/foo/src/nested/b.ts

import {a} from '~/a'       //<-- want this
// import {a} from '../a'
</code>```

If i import one onf my modules id like to distinguish it with an @

```<code>// packages/bar/src/index.ts

import {a} from '@foo'
</code>```

I'm getting some weird results when playing with this, and at one point it seemed like eslint didn't like the paths that typescript started to understand.

How could i achieve this, or if i'm heading in the wrong direction what would be the right one? I believe i'm using yarn workspaces and nothing else. I'm not even building anything yet, i'm just trying to get vscode to play nicely with this.

Body:
I'm trying to setup a monorepo from scratch for learning purposes. It seemed to make sense to structure it like so. I installed a lot of dev dependencies in the root which seems to make sense since i did pull the packages out of a single repo, and it seems that I would have to repeat them all in each module.

Eslint and ts seem to play nicely if i use no aliases, however i would like to try to achieve this:

root/
├─ packages/
|  |
│  ├─ foo/
│  │  ├─ src/
│  │  |  ├─ a.ts
│  │  |  ├─ index.ts
│  │  |  ├─ nested/
│  │  |     ├─ b.ts
│  |  ├─ package.json
|  |
│  ├─ bar/
│  │  ├─ src/
│  │  |  ├─ index.ts
│  |  ├─ package.json
|  |
│  ├─ baz/
│     ├─ src/
│     |  ├─ index.ts
│     ├─ package.json
|
├─ tsconfig.json
├─ package.json

If I'm in a module, I want to use ~ for an absolute path "for that module":

// packages/foo/src/nested/b.ts

import {a} from '~/a'       //<-- want this
// import {a} from '../a'

If i import one onf my modules id like to distinguish it with an @

// packages/bar/src/index.ts

import {a} from '@foo'

I'm getting some weird results when playing with this, and at one point it seemed like eslint didn't like the paths that typescript started to understand.

How could i achieve this, or if i'm heading in the wrong direction what would be the right one? I believe i'm using yarn workspaces and nothing else. I'm not even building anything yet, i'm just trying to get vscode to play nicely with this.


问:
how to merge video and audio without cmd?
hi I want combine video and audio together I tested packages ffmpeg-python and pymkvbut both use cmd and I dont want that. from host I don't have permission to use cmd

also I used moviepy, it's worked but it's very slow and I can't use that.
Do you have any tips for me?


问:
How to build Selenium .NET6 from source code?
I was thinking about make some modifications on the selenium Source code but when generating the build, multiple errors were thrown. I think I am overlooking some necessary aspect.

In the selenium documentation, it is mentioned that Bazel is used for the build, but also that Bazel cannot do the build for C#. Does anyone know how this is done?


Title: Can't fin fix for: "Error on transforming data: single positional indexer is out-of-bounds" in for loops

Body:
I have this dataframe(below is a sample) with three columns: clientnummer, begindatum(startdate) and einddatum(enddate)

clientnummer    begindatum  einddatum
3   2013-09-17 00:00:00.000 2014-03-16 00:00:00.000
3   2012-11-28 00:00:00.000 2015-04-04 00:00:00.000
4   2016-02-12 00:00:00.000 none
4   2015-09-10 00:00:00.000 2016-03-09 00:00:00.000
4   2015-12-01 00:00:00.000 2016-04-18 00:00:00.000
5   2016-09-01 00:00:00.000 2016-12-11 00:00:00.000
5   2018-02-20 00:00:00.000 2018-08-31 00:00:00.000
5   2017-02-20 00:00:00.000 2018-02-19 00:00:00.000
5   2021-01-01 00:00:00.000 2021-07-25 00:00:00.000
5   2022-01-01 00:00:00.000 2022-06-30 00:00:00.000
5   2018-09-01 00:00:00.000 2020-08-31 00:00:00.000
5   2015-11-17 00:00:00.000 2017-05-31 00:00:00.000

i Want to combine all rows of the same client if it is in the same range of the rows with the same clientnumber above. Where the beginningdate is the lowest and enddate the highest. This also has to account for None values and clients with only one row.

so outcome would be something like:

clientnummer    begindatum  einddatum
3   2013-09-17 00:00:00.000 2015-04-04 00:00:00.000
4   2015-09-10 00:00:00.000 2016-04-18 00:00:00.000
4   2016-02-12 00:00:00.000 none
5   2015-11-17 00:00:00.000 2018-02-19 00:00:00.000
5   2018-02-20 00:00:00.000 2018-08-31 00:00:00.000
5   2018-09-01 00:00:00.000 None
5   2021-01-01 00:00:00.000 2021-07-25 00:00:00.000
5   2022-01-01 00:00:00.000 2022-06-30 00:00:00.000

But im keet getting the error: ERROR:root:Error on transforming data: single positional indexer is out-of-bounds

This is my relevant code:

df_grouped = df_indicaties.groupby('clientnummer')

    #maak een result tabel
    result = pd.DataFrame(columns=['clientnummer', 'begindatum', 'einddatum'])

    for client, groep in df_grouped:
        # Check if the group is empty or has only one row
        if groep.empty or groep.shape[0] == 1:
            result = pd.concat([result, pd.DataFrame({'clientnummer': client, 'begindatum': groep['begindatum'].iloc[0], 'einddatum': groep['einddatum'].iloc[0]}, index=[0])])
        else:
            begindatum_start = groep.iloc[0]['begindatum']
            einddatum_start = groep.iloc[0]['einddatum']

            for i in groep.index:
                n_current = groep.iloc[i]['n_indicatie']
                current_begin = groep.iloc[i]['begindatum']
                current_eind = groep.iloc[i]['einddatum']

                if n_current > 1 and begindatum_start is not None and einddatum_start is not None and current_begin is not None and current_eind is not None:
                    if current_begin >= begindatum_start and current_begin <= einddatum_start:
                        if einddatum_start <= current_eind:
                            einddatum_start = current_eind
                    else:
                        result = result.append({'clientnummer': client, 'begindatum': current_begin, 'einddatum': current_eind}, ignore_index=True)
                        begindatum_start = groep.iloc[i]['begindatum']
                        einddatum_start = groep.iloc[i]['einddatum']
            result = result.append({'clientnummer': client, 'begindatum': begindatum_start, 'einddatum': einddatum_start}, ignore_index=True)
    return result


问:
Python requests.get() seems to only be retrieving Source Code, not the HTML visible on the website
I am trying to scrape pinnacle.com to extract player prop odds into a dataframe that lists the player name, type of bet (points, rebounds, etc.), over odds, and under odds.

I am having trouble accessing the body of the given url that has the span classes that hold all that type of information I need for my dataframe. This is my current code that accesses the url, which seems to only be getting the source code. When I try to find all the  tags or  tags, nothing seems to be returned.

I have been trying to check for the tags I am looking for using the final print statement, and it is returning "None". I have compared the response to the inspect element raw data, and it does not match so I am not sure where I am going wrong.

This is my current code. Any help would be appreciated immensely.

```<code>url = "https://www.pinnacle.com/en/basketball/nba/los-angeles-lakers-vs-orlando-magic/1564389023#player-props"

# Make a GET request to the webpage
response = requests.get(url)
content = response.text

# Parse the HTML content
soup = BeautifulSoup(content, "html.parser")
print(soup.span)
</code>```

Body:
I am trying to scrape pinnacle.com to extract player prop odds into a dataframe that lists the player name, type of bet (points, rebounds, etc.), over odds, and under odds.

I am having trouble accessing the body of the given url that has the span classes that hold all that type of information I need for my dataframe. This is my current code that accesses the url, which seems to only be getting the source code. When I try to find all the  tags or  tags, nothing seems to be returned.

I have been trying to check for the tags I am looking for using the final print statement, and it is returning "None". I have compared the response to the inspect element raw data, and it does not match so I am not sure where I am going wrong.

This is my current code. Any help would be appreciated immensely.

url = "https://www.pinnacle.com/en/basketball/nba/los-angeles-lakers-vs-orlando-magic/1564389023#player-props"

# Make a GET request to the webpage
response = requests.get(url)
content = response.text

# Parse the HTML content
soup = BeautifulSoup(content, "html.parser")
print(soup.span)


问:
How to "paint" a path robot covered in a Gazebo world?
I have a robot, it is a simple 2-wheeled+caster wheel diff drive robot. It works as a vacuum cleaner: moves over the "world", leaving behind a band of "clean carpet".

My question is, how can I paint this path that robot covered, in a different color, so it can be easily seen?

I would provide my ideas, but I have none: no idea how to do it right.

I use ROS2, Python and Gazebo.

Thank you.


问:
Jupyter extension jupyter_scheduler fail to create job
After installing the Jupyter extension jupyter_scheduler (1.2.0) with pip on my JupyterHub server following the docs, it is impossible to create a schedule for a notebook.

On creation of a job it shows the message "Unexpected error occurred during creation of job."

Error during job creation

I verified that both the jupyter_scheduler server extension and the @jupyterlab/scheduler prebuilt lab extension are indeed enabled. No error message is shown and all looks OK to me.

Any idea how to find more info about the "Unexpected error" in log files or elsewhere is more than welcome.


问:
Integrating Wordpress BuddyPress fully with QTranslate-XT
I hope to receive some helpful pointers to solve an issue with BuddyPress and Qtranslate-XT plugins for Wordpress. I have tried to ask for help on GitHub (qtranslate-xt) and on the BuddyPress forums, but it seems there is little interest in making BuddyPress multilingual.
Groups, Group Types, and Member Profile fields do not register for language switching buttons of qtranslate-xt in the backend. I am an absolute novice concerning integrating a plugin with qtranslate-xt so and all my attempts to add respective filters to the respective i18n-config.json failed.
Thus, I have given up in this regard but would really appreciate some hints on how I could fix the one element that is not working on the frontend: directory listings of group and member types.
Instead of showing only the current language for a displaying the type, the directory listing (e.g. on ../members/type/test/) shows the entry in all languages with tags (e.g., [:en]Test[:de]Versuch[:], see screenshot).

Screenshot: BuddyPress failing to integrate with QTranslate-XT

The respective text is generated in the group or members loop via the functions bp_current_group_directory_type_message or bp_current_member_type_message. For example, see the entry in bp-members-template.php

`

```<code>function bp_get_current_member_type_message() {
        $type_object = bp_get_member_type_object( bp_get_current_member_type() );

        /* translators: %s: member type singular name */
        $message = sprintf( __( 'Viewing members of the type: %s', 'buddypress' ), '<strong>' . $type_object->labels['singular_name'] . '</strong>' );

        /**
         * Filters the current member type message.
         *
         * @since 2.3.0
         *
         * @param string $message Message to filter.
         */
        return apply_filters( 'bp_get_current_member_type_message', $message );
    }
</code>```

`

I have tried adding a matching filter into the i18n-config.json but it does not work.

`

```<code>{
  "vendor": {
    "plugins/buddypress": "1.0"
  },
  "front-config": {
    "all-pages": {
      "filters": {
        "text": {
          "bp_get_activity_action": "20",
          "bp_get_activity_content_body": "20",
          "bp_get_activity_content": "20",
          "bp_get_current_member_type_message": "20"
        }
      }
    }
  }
}
</code>```

`

If someone has any ideas how to solve this issue, would be much appreciated!

Body:
I hope to receive some helpful pointers to solve an issue with BuddyPress and Qtranslate-XT plugins for Wordpress. I have tried to ask for help on GitHub (qtranslate-xt) and on the BuddyPress forums, but it seems there is little interest in making BuddyPress multilingual.
Groups, Group Types, and Member Profile fields do not register for language switching buttons of qtranslate-xt in the backend. I am an absolute novice concerning integrating a plugin with qtranslate-xt so and all my attempts to add respective filters to the respective i18n-config.json failed.
Thus, I have given up in this regard but would really appreciate some hints on how I could fix the one element that is not working on the frontend: directory listings of group and member types.
Instead of showing only the current language for a displaying the type, the directory listing (e.g. on ../members/type/test/) shows the entry in all languages with tags (e.g., [:en]Test[:de]Versuch[:], see screenshot).

Screenshot: BuddyPress failing to integrate with QTranslate-XT

The respective text is generated in the group or members loop via the functions bp_current_group_directory_type_message or bp_current_member_type_message. For example, see the entry in bp-members-template.php

`

function bp_get_current_member_type_message() {
        $type_object = bp_get_member_type_object( bp_get_current_member_type() );

        /* translators: %s: member type singular name */
        $message = sprintf( __( 'Viewing members of the type: %s', 'buddypress' ), '' . $type_object->labels['singular_name'] . '' );

        /**
         * Filters the current member type message.
         *
         * @since 2.3.0
         *
         * @param string $message Message to filter.
         */
        return apply_filters( 'bp_get_current_member_type_message', $message );
    }

`

I have tried adding a matching filter into the i18n-config.json but it does not work.

`

{
  "vendor": {
    "plugins/buddypress": "1.0"
  },
  "front-config": {
    "all-pages": {
      "filters": {
        "text": {
          "bp_get_activity_action": "20",
          "bp_get_activity_content_body": "20",
          "bp_get_activity_content": "20",
          "bp_get_current_member_type_message": "20"
        }
      }
    }
  }
}

`

If someone has any ideas how to solve this issue, would be much appreciated!


问:
react page 404's even when there is content
I am just seeing something weird in my React project when I navigate to a link. For some reason, the page 404's but there is content there(just the req status returned from metatag shows 404) and the browser tab shows the 404 message. The link renders ok, and if I mispell a letter in the link, then I do get an actual 404 page.

And below is the logic to set the browser tab page not found document.title etc:

```<code>const importFactory = (importFunction) => lazy(importFunction);
const requireViews = require.context(
  "views",
  true,
  /^(.*\.(js$))[^.]*$/im,
  "lazy"
);
const viewPaths = requireViews.keys();
const views = {};
viewPaths.forEach((path) => {
  const str = path.replace(/\.\//, "");
  const componentName = str.replace(/\.js/, "");
  views[componentName] = importFactory(() =>
    import(/* webpackChunkName: "[request]" */ `../views/${componentName}`)
  );
});

class App extends React.Component {

  getChildContext = () => ({
    lang: this.state.lang,
    site: this.state.site,
    nav: this.state.nav,
    handleLangSwitch: this.handleLangSwitch,
    modal: this.state.modal,
    toggleModal: this.toggleModal,
    activeNavItem: this.state.activeNavItem,
    toggleSubNav: this.toggleSubNav,
    accessible: this.state.accessible,
    toggleAccessible: this.toggleAccessible,
    toggleNav: this.toggleNav,
    opennav: this.state.opennav,
  });

  constructor(props) {
    super(props);
    let site = props.CONTENT.byTemplate("landing_page")[0];
    let nav = props.CONTENT.childrenById(site.id);
    this.global = props.CONTENT.byTemplate("global_page")[0];
    this.state = {
      accessible: false,
      lang: "en",
      site,
      nav,
      opennav: false,
      modal: null,
      activeNavItem: null,
      popupOpen: false,
    };
    const metaStatus = document.querySelector('meta[name="status"]');
    this.reqStatus = metaStatus ? metaStatus.content : "200";

    this.routes = this.buildRoutes();
    this.pageChangeRoutine(this.reqStatus);
  }

  componentDidMount() {
    // setTimeout(() => {
    //   this.setState(
    //     {
    //       accessible: true,
    //     },
    //     () => {
    //       document.querySelector("html").classList.toggle("accessible");
    //     }
    //   );
    // }, 500);

    if (window.location.search.includes("newsletter")) {
      setTimeout(() => {
        this.setState({
          modal: "newslettermodal",
          popupOpen: false,
        });
      }, APP_CONFIG.loadingDuration + 2001);
    }
    document.addEventListener("lazybeforeunveil", function (e) {
      var bg = e.target.getAttribute("data-bg");
      if (bg) {
        e.target.style.backgroundImage = "url(" + bg + ")";
      }
    });
    // if (this.isValidBrowser()) {
    //   sleep(APP_CONFIG.loadingDuration).then(() => {
    //     this.hideLoader();
    //   });
    // } else {
    //   this.hideLoader();
    // }

    setTimeout(() => {
      this.togglePopup();
    }, APP_CONFIG.loadingDuration + 2000);
  }

  componentDidUpdate(prevProps, prevstate) {
    const {
      location: { pathname },
    } = this.props;
    if (
      prevProps.location.pathname !== this.props.location.pathname ||
      prevProps.location.search !== this.props.location.search
    ) {
      this.pageChangeRoutine(this.reqStatus);
      this.trackPageView(pathname);
    }
    if (prevstate.site.id !== this.state.site.id) {
      this.updateNavItems();
    }
  }

  updateNavItems = () => {
    this.setState({
      nav: this.props.CONTENT.childrenById(this.state.site.id),
    });
  };

  toggleNav = () => {
    this.setState((state) => ({
      opennav: !state.opennav,
    }));
  };

  // toggleSubNav = (id) => {
  //   const { activeNavItem } = this.state;
  //   if (activeNavItem !== id) {
  //     this.setState({
  //       activeNavItem: id,
  //     });
  //   } else {
  //     this.setState({
  //       activeNavItem: null,
  //     });
  //   }
  // };
  toggleSubNav = (id) => {
    const { activeNavItem } = this.state;
    if (activeNavItem !== id) {
      this.setState({
        activeNavItem: id,
      });
    }
    // else {
    //   this.setState({
    //     activeNavItem: null,
    //   });
    // }
  };

  handleLangSwitch = (e) => {
    if (this.state.site.id !== e.id) {
      this.setState(
        {
          site: this.props.CONTENT.byId(e.id),
        },
        () => this.props.history.push(e.path)
      );
    }
  };

  toggleModal = (modalid) => {
    if (this.state.modal !== modalid) {
      this.setState({
        modal: modalid,
      });
    } else {
      this.setState({
        modal: null,
      });
    }
  };

  handleTemplateSwitch = (template) => {
    let pagetemplate = template === "home" ? "landing_page" : template;
    return pagetemplate;
  };

  buildRoutes() {
    const pages = this.props.CONTENT.all;
    const routes = Object.keys(pages).map((key) => {
      const page = pages[key];
      const donotRoute = ["global_page", "neighborhood_cat", "redirect_page"];
      const template = page.template.toLowerCase();
      const Component =
        views[`${this.handleTemplateSwitch(template)}`] || views["default"];
      if (page.path === "/" && page.template === "home") {
        return (
          !donotRoute.includes(page.template) && (
            <Route
              exact
              key={this.state.site.id}
              path={this.state.site.path}
              render={(props) => (
                <LazyBoundary fallback={<div />}>
                  <ErrorBoundary>
                    <Component page={this.state.site} {...props} />
                  </ErrorBoundary>
                </LazyBoundary>
              )}
            />
          )
        );
      }

      return (
        !donotRoute.includes(page.template) && (
          <Route
            exact
            key={page.id}
            path={page.path}
            render={(props) => (
              <LazyBoundary fallback={<div />}>
                <ErrorBoundary>
                  <Component page={page} {...props} />
                </ErrorBoundary>
              </LazyBoundary>
            )}
          />
        )
      );
    });

    const redirectAllElse =
      this.reqStatus == "404" ? this.route404() : this.routeRedirect();

    return [...routes, redirectAllElse];
  }

  route404() {
    return (
      <Route
        path="/"
        key="404"
        render={(props) => {
          const Component = views[`404`];
          return (
            <LazyBoundary fallback={<div />}>
              <ErrorBoundary>
                <Component
                  page={{
                    h1: "404",
                    blurb1: `<p>That page doesn't exist. <a href="/">Back to Home</a>`,
                  }}
                  {...props}
                />
              </ErrorBoundary>
            </LazyBoundary>
          );
        }}
      />
    );
  }

  routeRedirect() {
    return (
      <Route
        path="/"
        key="redirectAllElse"
        render={() => <Redirect to="/" />}
      />
    );
  }

  /*
  Commented out in the event that client wants their site loader back up
  hideLoader() {
    document.querySelector(".site-loader").className += " site-loader--loaded";
  }
  */

  isValidBrowser() {
    return !(browser.msie && parseInt(browser.version) < 11);
  }

  pageChangeRoutine(status) {
    console.log(status);
    if (status == "404") {
      document.title = "Page Not Found";
    } else {
      const pageTitleFromContent = this.props.CONTENT.byPath(
        this.props.location.pathname
      ).pagetitle;

      document.title =
        pageTitleFromContent || this.props.CONTENT.byPath("/").pagetitle;
    }

    window.scrollTo(0, 0);
    this.setState({
      opennav: false,
    });
  }

  trackPageView(page) {
    const { title } = document;
    if (window.ga) {
      ga("send", "pageview", { page, title });
    }
  }

  toggleAccessible = (e) => {
    e.preventDefault();
    this.setState({ accessible: !this.state.accessible }, () => {
      document.querySelector("html").classList.toggle("accessible");
    });
  };

  togglePopup = () => {
    this.setState({ popupOpen: !this.state.popupOpen });
  };

  render() {
    const currentpage = this.props.CONTENT.byPath(window.location.pathname);

    const shareprops = {
      navigation: this.state.nav.filter((p) => p.showinnav),
      site: this.state.site,
      CONTENT: this.props.CONTENT,
      opennav: this.state.opennav,
      viewport: this.props.viewport,
      toggleModal: this.toggleModal,
      toggleNav: this.toggleNav,
      currentpage: currentpage,
    };

    return this.isValidBrowser() ? (
      <div className={`app`}>
        <Suspense fallback={<div>Loading...</div>}>
          {!this.state.accessible && (
            <Popup
              toggle={this.togglePopup}
              open={this.state.popupOpen && !this.state.modal}
            />
          )}
        </Suspense>

        <button
          id="accessible-link"
          tabIndex={1}
          onClick={this.toggleAccessible}
          aria-label="Accessible"
        >
          ACCESSIBLE
        </button>
        <Suspense fallback={<div>Loading...</div>}>
          <CookiePopup />
        </Suspense>
        <Suspense fallback={<div>Loading...</div>}>
          <Header {...shareprops} />
        </Suspense>

        <main>
          <TransitionGroup>
            <CSSTransition
              key={this.props.location.key}
              timeout={500}
              classNames="page-transition"
            >
              <div>
                <Switch location={this.props.location}>{this.routes}</Switch>
              </div>
            </CSSTransition>
          </TransitionGroup>
          <Suspense fallback={<div>Loading...</div>}>
            <ModalContainer
              open={this.state.modal === "newslettermodal" ? true : false}
              toggleModal={() => this.toggleModal(null)}
              render={() => (
                <Suspense fallback={<div>Loading...</div>}>
                  <NewsLetter
                    page={this.global}
                    closePopUp={() => this.toggleModal(null)}
                  />
                </Suspense>
              )}
              modalname="Newsletter Modal"
              modelState={this.state.modal}
            />
          </Suspense>
        </main>
        <Suspense fallback={<div>Loading...</div>}>
          <Footer {...shareprops} />
        </Suspense>
      </div>
    ) : (
      <InvalidBrowser />
    );
  }
}
</code>```

I was just wondering if anyone has any clues or ideas as to what could be causing it. Any help is greatly appreciated!

Body:
I am just seeing something weird in my React project when I navigate to a link. For some reason, the page 404's but there is content there(just the req status returned from metatag shows 404) and the browser tab shows the 404 message. The link renders ok, and if I mispell a letter in the link, then I do get an actual 404 page.

And below is the logic to set the browser tab page not found document.title etc:

const importFactory = (importFunction) => lazy(importFunction);
const requireViews = require.context(
  "views",
  true,
  /^(.*\.(js$))[^.]*$/im,
  "lazy"
);
const viewPaths = requireViews.keys();
const views = {};
viewPaths.forEach((path) => {
  const str = path.replace(/\.\//, "");
  const componentName = str.replace(/\.js/, "");
  views[componentName] = importFactory(() =>
    import(/* webpackChunkName: "[request]" */ `../views/${componentName}`)
  );
});

class App extends React.Component {

  getChildContext = () => ({
    lang: this.state.lang,
    site: this.state.site,
    nav: this.state.nav,
    handleLangSwitch: this.handleLangSwitch,
    modal: this.state.modal,
    toggleModal: this.toggleModal,
    activeNavItem: this.state.activeNavItem,
    toggleSubNav: this.toggleSubNav,
    accessible: this.state.accessible,
    toggleAccessible: this.toggleAccessible,
    toggleNav: this.toggleNav,
    opennav: this.state.opennav,
  });

  constructor(props) {
    super(props);
    let site = props.CONTENT.byTemplate("landing_page")[0];
    let nav = props.CONTENT.childrenById(site.id);
    this.global = props.CONTENT.byTemplate("global_page")[0];
    this.state = {
      accessible: false,
      lang: "en",
      site,
      nav,
      opennav: false,
      modal: null,
      activeNavItem: null,
      popupOpen: false,
    };
    const metaStatus = document.querySelector('meta[name="status"]');
    this.reqStatus = metaStatus ? metaStatus.content : "200";

    this.routes = this.buildRoutes();
    this.pageChangeRoutine(this.reqStatus);
  }

  componentDidMount() {
    // setTimeout(() => {
    //   this.setState(
    //     {
    //       accessible: true,
    //     },
    //     () => {
    //       document.querySelector("html").classList.toggle("accessible");
    //     }
    //   );
    // }, 500);

    if (window.location.search.includes("newsletter")) {
      setTimeout(() => {
        this.setState({
          modal: "newslettermodal",
          popupOpen: false,
        });
      }, APP_CONFIG.loadingDuration + 2001);
    }
    document.addEventListener("lazybeforeunveil", function (e) {
      var bg = e.target.getAttribute("data-bg");
      if (bg) {
        e.target.style.backgroundImage = "url(" + bg + ")";
      }
    });
    // if (this.isValidBrowser()) {
    //   sleep(APP_CONFIG.loadingDuration).then(() => {
    //     this.hideLoader();
    //   });
    // } else {
    //   this.hideLoader();
    // }

    setTimeout(() => {
      this.togglePopup();
    }, APP_CONFIG.loadingDuration + 2000);
  }

  componentDidUpdate(prevProps, prevstate) {
    const {
      location: { pathname },
    } = this.props;
    if (
      prevProps.location.pathname !== this.props.location.pathname ||
      prevProps.location.search !== this.props.location.search
    ) {
      this.pageChangeRoutine(this.reqStatus);
      this.trackPageView(pathname);
    }
    if (prevstate.site.id !== this.state.site.id) {
      this.updateNavItems();
    }
  }

  updateNavItems = () => {
    this.setState({
      nav: this.props.CONTENT.childrenById(this.state.site.id),
    });
  };

  toggleNav = () => {
    this.setState((state) => ({
      opennav: !state.opennav,
    }));
  };

  // toggleSubNav = (id) => {
  //   const { activeNavItem } = this.state;
  //   if (activeNavItem !== id) {
  //     this.setState({
  //       activeNavItem: id,
  //     });
  //   } else {
  //     this.setState({
  //       activeNavItem: null,
  //     });
  //   }
  // };
  toggleSubNav = (id) => {
    const { activeNavItem } = this.state;
    if (activeNavItem !== id) {
      this.setState({
        activeNavItem: id,
      });
    }
    // else {
    //   this.setState({
    //     activeNavItem: null,
    //   });
    // }
  };

  handleLangSwitch = (e) => {
    if (this.state.site.id !== e.id) {
      this.setState(
        {
          site: this.props.CONTENT.byId(e.id),
        },
        () => this.props.history.push(e.path)
      );
    }
  };

  toggleModal = (modalid) => {
    if (this.state.modal !== modalid) {
      this.setState({
        modal: modalid,
      });
    } else {
      this.setState({
        modal: null,
      });
    }
  };

  handleTemplateSwitch = (template) => {
    let pagetemplate = template === "home" ? "landing_page" : template;
    return pagetemplate;
  };

  buildRoutes() {
    const pages = this.props.CONTENT.all;
    const routes = Object.keys(pages).map((key) => {
      const page = pages[key];
      const donotRoute = ["global_page", "neighborhood_cat", "redirect_page"];
      const template = page.template.toLowerCase();
      const Component =
        views[`${this.handleTemplateSwitch(template)}`] || views["default"];
      if (page.path === "/" && page.template === "home") {
        return (
          !donotRoute.includes(page.template) && (
            <Route
              exact
              key={this.state.site.id}
              path={this.state.site.path}
              render={(props) => (
                <LazyBoundary fallback={
}>
                  <ErrorBoundary>
                    <Component page={this.state.site} {...props} />
                  </ErrorBoundary>
                </LazyBoundary>
              )}
            />
          )
        );
      }

      return (
        !donotRoute.includes(page.template) && (
          <Route
            exact
            key={page.id}
            path={page.path}
            render={(props) => (
              <LazyBoundary fallback={
}>
                <ErrorBoundary>
                  <Component page={page} {...props} />
                </ErrorBoundary>
              </LazyBoundary>
            )}
          />
        )
      );
    });

    const redirectAllElse =
      this.reqStatus == "404" ? this.route404() : this.routeRedirect();

    return [...routes, redirectAllElse];
  }

  route404() {
    return (
      <Route
        path="/"
        key="404"
        render={(props) => {
          const Component = views[`404`];
          return (
            <LazyBoundary fallback={
}>
              <ErrorBoundary>
                <Component
                  page={{
                    h1: "404",
                    blurb1: `<p>That page doesn't exist. <a href="/">Back to Home</a>`,
                  }}
                  {...props}
                />
              </ErrorBoundary>
            </LazyBoundary>
          );
        }}
      />
    );
  }

  routeRedirect() {
    return (
      <Route
        path="/"
        key="redirectAllElse"
        render={() => <Redirect to="/" />}
      />
    );
  }

  /*
  Commented out in the event that client wants their site loader back up
  hideLoader() {
    document.querySelector(".site-loader").className += " site-loader--loaded";
  }
  */

  isValidBrowser() {
    return !(browser.msie && parseInt(browser.version) < 11);
  }

  pageChangeRoutine(status) {
    console.log(status);
    if (status == "404") {
      document.title = "Page Not Found";
    } else {
      const pageTitleFromContent = this.props.CONTENT.byPath(
        this.props.location.pathname
      ).pagetitle;

      document.title =
        pageTitleFromContent || this.props.CONTENT.byPath("/").pagetitle;
    }

    window.scrollTo(0, 0);
    this.setState({
      opennav: false,
    });
  }

  trackPageView(page) {
    const { title } = document;
    if (window.ga) {
      ga("send", "pageview", { page, title });
    }
  }

  toggleAccessible = (e) => {
    e.preventDefault();
    this.setState({ accessible: !this.state.accessible }, () => {
      document.querySelector("html").classList.toggle("accessible");
    });
  };

  togglePopup = () => {
    this.setState({ popupOpen: !this.state.popupOpen });
  };

  render() {
    const currentpage = this.props.CONTENT.byPath(window.location.pathname);

    const shareprops = {
      navigation: this.state.nav.filter((p) => p.showinnav),
      site: this.state.site,
      CONTENT: this.props.CONTENT,
      opennav: this.state.opennav,
      viewport: this.props.viewport,
      toggleModal: this.toggleModal,
      toggleNav: this.toggleNav,
      currentpage: currentpage,
    };

    return this.isValidBrowser() ? (
      <div className={`app`}>
        <Suspense fallback={
Loading...
}>
          {!this.state.accessible && (
            <Popup
              toggle={this.togglePopup}
              open={this.state.popupOpen && !this.state.modal}
            />
          )}
        </Suspense>

        <button
          id="accessible-link"
          tabIndex={1}
          onClick={this.toggleAccessible}
          aria-label="Accessible"
        >
          ACCESSIBLE
        </button>
        <Suspense fallback={
Loading...
}>
          <CookiePopup />
        </Suspense>
        <Suspense fallback={
Loading...
}>

        </Suspense>

          <TransitionGroup>
            <CSSTransition
              key={this.props.location.key}
              timeout={500}
              classNames="page-transition"
            >

                <Switch location={this.props.location}>{this.routes}</Switch>

            </CSSTransition>
          </TransitionGroup>
          <Suspense fallback={
Loading...
}>
            <ModalContainer
              open={this.state.modal === "newslettermodal" ? true : false}
              toggleModal={() => this.toggleModal(null)}
              render={() => (
                <Suspense fallback={
Loading...
}>
                  <NewsLetter
                    page={this.global}
                    closePopUp={() => this.toggleModal(null)}
                  />
                </Suspense>
              )}
              modalname="Newsletter Modal"
              modelState={this.state.modal}
            />
          </Suspense>

        <Suspense fallback={
Loading...
}>

        </Suspense>

    ) : (
      <InvalidBrowser />
    );
  }
}

I was just wondering if anyone has any clues or ideas as to what could be causing it. Any help is greatly appreciated!


问:
flutter add searchfield to sqlite data
I am a little new to Flutter and are trying to add a searchfield to output of a piece of script i have from a tutorial.

The data is from a sqlite db and i want to add a searchfield that is looking in the output from the database. Can someone help me a little of where to begin of do you know an example of this kind of question?

code where i want to add it is:

```<code>@override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Joost mag het weten'),
      ),
      body: _isLoading
          ? const Center(
        child: CircularProgressIndicator(),
      )
          : ListView.builder(
        itemCount: _journals.length,
        itemBuilder: (context, index) => Card(
          color: Colors.orange[200],
          margin: const EdgeInsets.all(15),
          child: ListTile(
              leading: Text(_journals[index]['aantal']),
              title: Text(_journals[index]['title']),
              subtitle: Text(_journals[index]['description']),
              trailing: SizedBox(
                width: 100,
                child: Row(
                  children: [
                    IconButton(
                      icon: const Icon(Icons.edit),
                      onPressed: () => _showForm(_journals[index]['id']),
                    ),
                    IconButton(
                      icon: const Icon(Icons.delete),
                      onPressed: () =>
                          _deleteItem(_journals[index]['id']),
                    ),
                  ],
                ),
              )),
        ),
      ),
      floatingActionButton: FloatingActionButton(
        child: const Icon(Icons.add),
        onPressed: () => _showForm(null),
      ),
    );
  }
}
</code>```

Title: flutter add searchfield to sqlite data

Body:
I am a little new to Flutter and are trying to add a searchfield to output of a piece of script i have from a tutorial.

The data is from a sqlite db and i want to add a searchfield that is looking in the output from the database. Can someone help me a little of where to begin of do you know an example of this kind of question?

code where i want to add it is:

@override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Joost mag het weten'),
      ),
      body: _isLoading
          ? const Center(
        child: CircularProgressIndicator(),
      )
          : ListView.builder(
        itemCount: _journals.length,
        itemBuilder: (context, index) => Card(
          color: Colors.orange[200],
          margin: const EdgeInsets.all(15),
          child: ListTile(
              leading: Text(_journals[index]['aantal']),
              title: Text(_journals[index]['title']),
              subtitle: Text(_journals[index]['description']),
              trailing: SizedBox(
                width: 100,
                child: Row(
                  children: [
                    IconButton(
                      icon: const Icon(Icons.edit),
                      onPressed: () => _showForm(_journals[index]['id']),
                    ),
                    IconButton(
                      icon: const Icon(Icons.delete),
                      onPressed: () =>
                          _deleteItem(_journals[index]['id']),
                    ),
                  ],
                ),
              )),
        ),
      ),
      floatingActionButton: FloatingActionButton(
        child: const Icon(Icons.add),
        onPressed: () => _showForm(null),
      ),
    );
  }
}


问:
Using MikroORM with Jest toMatchObject matcher ends with error: TypeError: Cannot redefine property: __helper
Sometimes when using MikroORM entities with Jest (TS) in this way:

```<code>    const ads = await repo.findAll({
        orderBy: {
            providerId: 'asc'
        }
    })

    expect(ads).toMatchObject([
        {
            providerId: 'a',
            title: 'a-changed',
            createdBy: {
                id: firstJobId
            },
            updatedBy: {
                id: secondJobId
            },
            removed: false
        }])
</code>```

it causes this error to be thrown:

Cannot redefine property: __helper TypeError: Cannot redefine
property: __helper

When I try to use  wrap(entity).toPOJO() a reference to another entity is no longer an object but is converted to an id. In my case the createdBy and updatedBy becomes a number.

Is there a way around this problem?

Body:
Sometimes when using MikroORM entities with Jest (TS) in this way:

    const ads = await repo.findAll({
        orderBy: {
            providerId: 'asc'
        }
    })

    expect(ads).toMatchObject([
        {
            providerId: 'a',
            title: 'a-changed',
            createdBy: {
                id: firstJobId
            },
            updatedBy: {
                id: secondJobId
            },
            removed: false
        }])

it causes this error to be thrown:

Cannot redefine property: __helper TypeError: Cannot redefine
property: __helper

When I try to use  wrap(entity).toPOJO() a reference to another entity is no longer an object but is converted to an id. In my case the createdBy and updatedBy becomes a number.

Is there a way around this problem?


问:
perf not displaying source code in annotations, despite symbols being included
In annotations, perf only displays assembly code to me.  However, it does correctly list all the symbols, and the binary is compiled with -g.  Further, file lists the binary as with debug_info, not stripped.

I compile with

```<code> clang -std=c89 -pedantic -g \
        -Wno-attributes \
        -foptimize-sibling-calls \
        -fno-strict-aliasing \
        -DNDEBUG \
        *.c
</code>```

and then record with perf record -g --call-graph dwarf ./a.out [file arg to a.out].  However, when running perf annotate or going into annotation mode from perf report -g, only assembly code is displayed.  I've tried passing --source and -l, but neither seem to change anything.

I'm on Artix, using perf version 6.1.g830b3c68c1fb (perf-6.1-1 in repos).

Body:
In annotations, perf only displays assembly code to me.  However, it does correctly list all the symbols, and the binary is compiled with -g.  Further, file lists the binary as with debug_info, not stripped.

I compile with

 clang -std=c89 -pedantic -g \
        -Wno-attributes \
        -foptimize-sibling-calls \
        -fno-strict-aliasing \
        -DNDEBUG \
        *.c

and then record with perf record -g --call-graph dwarf ./a.out [file arg to a.out].  However, when running perf annotate or going into annotation mode from perf report -g, only assembly code is displayed.  I've tried passing --source and -l, but neither seem to change anything.

I'm on Artix, using perf version 6.1.g830b3c68c1fb (perf-6.1-1 in repos).