问:
Laravel getBag() eroor
I have rest api application, I decide to create a small admin panel.

I need a page where i can to CRUD entity: small table, create form ...

If i have not an error my blade hava on error

Please can you explain me better way to make in

When i set my field not empty and follow request reqirements I get:
Call to a member function getBag() on array

My Blade:

<form class="p-3" method="POST" action="{{ route('industries') }}">
    @csrf

        Name
        <input value="{{ old('name') }}" type="text" class="form-control" id="name" name="name">
        @error('name')

                {{ $message }}

        @enderror

    <button type="submit" class="btn btn-primary">{{ __('Save') }}</button>
</form>
```
<p>My Request</p>
<pre class="lang-php prettyprint-override"><code>use Illuminate\Foundation\Http\FormRequest;

class CreateIndustryRequest extends FormRequest
{
    public function rules(): array
    {
        return [
            'name' => 'required|string|min:2|max:255',
        ];
    }

    public function authorize(): bool
    {
        return true;
    }
}
</code>```

My Controller's method:

public function create(CreateIndustryRequest $request)
{
    return view('industries', [
        'industries' => (new GetAllIndustriesAction)(),
        'errors' => $request->validated()
    ]);
}
```

Title: Laravel getBag() eroor

Body:
I have rest api application, I decide to create a small admin panel.

I need a page where i can to CRUD entity: small table, create form ...

If i have not an error my blade hava on error

Please can you explain me better way to make in

When i set my field not empty and follow request reqirements I get:
Call to a member function getBag() on array

My Blade:

<form class="p-3" method="POST" action="{{ route('industries') }}">
    @csrf

        Name
        <input value="{{ old('name') }}" type="text" class="form-control" id="name" name="name">
        @error('name')

                {{ $message }}

        @enderror

    <button type="submit" class="btn btn-primary">{{ __('Save') }}</button>
</form>

My Request

use Illuminate\Foundation\Http\FormRequest;

class CreateIndustryRequest extends FormRequest
{
    public function rules(): array
    {
        return [
            'name' => 'required|string|min:2|max:255',
        ];
    }

    public function authorize(): bool
    {
        return true;
    }
}

My Controller's method:

public function create(CreateIndustryRequest $request)
{
    return view('industries', [
        'industries' => (new GetAllIndustriesAction)(),
        'errors' => $request->validated()
    ]);
}


来源: stackexchange

问:
RDS - Restore Oracle Database backup with another name / service name in the same instance
I have created a new RDS instance for my Oracle database. It is an instance of homologation.

I backed up my production database by exporting datapump.

```<code>DBMS_DATAPUMP.open( operation => 'EXPORT', job_mode => 'SCHEMA' ...
</code>```

I uploaded my backup file to S3.

Then, I downloaded the backup (exported file) from S3, to the Datapump of the homologation instance.

Now, I'm trying to restore this backup, however, as it is an approval instance, I need to have more than one database, from the same application, that is, in the production environment, my database is called DBSYSTEM, and in my homologation environment, I need to restore this same database with other names in the same instance, like DBSYSTEM1, DBSYSTEM2, DBSYSTEM3...

But here I can't move forward.

```<code>DECLARE
    hdnl NUMBER;
BEGIN
    hdnl := DBMS_DATAPUMP.OPEN(operation=>'IMPORT', job_mode => 'SCHEMA', job_name => null);
    DBMS_DATAPUMP.ADD_FILE( handle => hdnl, filename => 'exp_dbsystem.dmp', directory => 'DATA_PUMP_DIR', filetype => dbms_datapump.ku$_file_type_dump_file);
    DBMS_DATAPUMP.ADD_FILE( handle => hdnl, filename => 'imp_dbsystem.log', directory => 'DATA_PUMP_DIR', filetype => dbms_datapump.ku$_file_type_log_file);
    DBMS_DATAPUMP.METADATA_FILTER( handle => hdnl, name => 'SCHEMA_EXPR', value=> 'IN (''DBSYSTEM'')');
    DBMS_DATAPUMP.METADATA_REMAP( handle=> hdnl, name => 'REMAP_SCHEMA', old_value => 'DBSYSTEM', value => 'DBSYSTEM2');
    DBMS_DATAPUMP.METADATA_REMAP( handle=> hdnl, name => 'REMAP_TABLESPACE', old_value => 'DBSYSTEM_DATA', value => 'DBSYSTEM_DATA2);
    DBMS_DATAPUMP.METADATA_REMAP( handle=> hdnl, name => 'REMAP_TABLESPACE', old_value => 'DBSYSTEM_INDEX ', value => 'DBSYSTEM_INDEX2');
    DBMS_DATAPUMP.START_JOB(hdnl);
END;
</code>```

When executing the above statement, the following is returned:

```<code>Bug report -
ORA-39001: invalid argument value
ORA-06512: in "SYS.DBMS_SYS_ERROR", line 79
ORA-06512: at "SYS.DBMS_DATAPUMP", line 4929
ORA-06512: at "SYS.DBMS_DATAPUMP", line 5180
ORA-06512: in line 5
</code>```

Does anyone have any tips on how to resolve this issue?

ContentLicense: CC BY-SA 4.0

Body:
I have created a new RDS instance for my Oracle database. It is an instance of homologation.

I backed up my production database by exporting datapump.

DBMS_DATAPUMP.open( operation => 'EXPORT', job_mode => 'SCHEMA' ...

I uploaded my backup file to S3.

Then, I downloaded the backup (exported file) from S3, to the Datapump of the homologation instance.

Now, I'm trying to restore this backup, however, as it is an approval instance, I need to have more than one database, from the same application, that is, in the production environment, my database is called DBSYSTEM, and in my homologation environment, I need to restore this same database with other names in the same instance, like DBSYSTEM1, DBSYSTEM2, DBSYSTEM3...

But here I can't move forward.

DECLARE
    hdnl NUMBER;
BEGIN
    hdnl := DBMS_DATAPUMP.OPEN(operation=>'IMPORT', job_mode => 'SCHEMA', job_name => null);
    DBMS_DATAPUMP.ADD_FILE( handle => hdnl, filename => 'exp_dbsystem.dmp', directory => 'DATA_PUMP_DIR', filetype => dbms_datapump.ku$_file_type_dump_file);
    DBMS_DATAPUMP.ADD_FILE( handle => hdnl, filename => 'imp_dbsystem.log', directory => 'DATA_PUMP_DIR', filetype => dbms_datapump.ku$_file_type_log_file);
    DBMS_DATAPUMP.METADATA_FILTER( handle => hdnl, name => 'SCHEMA_EXPR', value=> 'IN (''DBSYSTEM'')');
    DBMS_DATAPUMP.METADATA_REMAP( handle=> hdnl, name => 'REMAP_SCHEMA', old_value => 'DBSYSTEM', value => 'DBSYSTEM2');
    DBMS_DATAPUMP.METADATA_REMAP( handle=> hdnl, name => 'REMAP_TABLESPACE', old_value => 'DBSYSTEM_DATA', value => 'DBSYSTEM_DATA2);
    DBMS_DATAPUMP.METADATA_REMAP( handle=> hdnl, name => 'REMAP_TABLESPACE', old_value => 'DBSYSTEM_INDEX ', value => 'DBSYSTEM_INDEX2');
    DBMS_DATAPUMP.START_JOB(hdnl);
END;

When executing the above statement, the following is returned:

Bug report -
ORA-39001: invalid argument value
ORA-06512: in "SYS.DBMS_SYS_ERROR", line 79
ORA-06512: at "SYS.DBMS_DATAPUMP", line 4929
ORA-06512: at "SYS.DBMS_DATAPUMP", line 5180
ORA-06512: in line 5

Does anyone have any tips on how to resolve this issue?


问:
Can't install modules in another directory
I'm trying to install my local package 'flaskr' in other directory ('flask_tutorial').

my 'flask_tutorial' directory looks like this (there are more files in flaskr but they are not relevant to my question):

```<code>├── vtest
│   ├── flaskr
│   │   ├── __init__.py
│   │   ├── auth.py
│   │   ├── blog.py
│   │   ├── db.py
│   │   ├── schema.sql
│
├── MANIFEST.in
├── setup.py
</code>```

my setup looks like this:

```<code>from setuptools import find_packages, setup

setup(
    name='flaskr',
    version='1.0.0',
    packages=find_packages(),
    include_package_data=True,
    install_requires=[
        'flask',
    ],
)
</code>```

MANIFEST.in looks like this:

```<code>recursive-include vtest\flaskr\templates *.html
recursive-include vtest\flaskr\schema *.sql
recursive-include vtest\flaskr\static *.css
recursive-include vtest\flaskr *sql
</code>```

when I run the command py setup.py install in cmd from flask_tutorial directory,I check build folder where there should be all .py modules,but there are none.
How to solve this?
If I replace to this in setup.py:

```<code>packages=['vtest.flaskr']
</code>```

Then it works,but why it don't work with find_packages()?

Body:
I'm trying to install my local package 'flaskr' in other directory ('flask_tutorial').

my 'flask_tutorial' directory looks like this (there are more files in flaskr but they are not relevant to my question):

├── vtest
│   ├── flaskr
│   │   ├── __init__.py
│   │   ├── auth.py
│   │   ├── blog.py
│   │   ├── db.py
│   │   ├── schema.sql
│
├── MANIFEST.in
├── setup.py

my setup looks like this:

from setuptools import find_packages, setup

setup(
    name='flaskr',
    version='1.0.0',
    packages=find_packages(),
    include_package_data=True,
    install_requires=[
        'flask',
    ],
)

MANIFEST.in looks like this:

recursive-include vtest\flaskr\templates *.html
recursive-include vtest\flaskr\schema *.sql
recursive-include vtest\flaskr\static *.css
recursive-include vtest\flaskr *sql

when I run the command py setup.py install in cmd from flask_tutorial directory,I check build folder where there should be all .py modules,but there are none.
How to solve this?
If I replace to this in setup.py:

packages=['vtest.flaskr']

Then it works,but why it don't work with find_packages()?


问:
How to run tests within a specific context using graphql-java-kickstart?
I am very new to graphql in general and I am managing an application that uses graphql-java-kickstart with springboot. I am trying to write tests for some of my resolvers but I am having problems running them. I have three packages that have associated graphql schemas within the application but I am just trying to test the resolvers from each one independently. I have this test configuration:

```<code>@RunWith(MockitoJUnitRunner.class)
@GraphQLTest
@ComponentScan(basePackages = {
    "feature1-resolvers.package",
    "feature1-root-resolver.package",
})
public class MyResolverTest {

 ...Test code
}
</code>```

I am pointing my test configuration to the feature packages I want to test but when I try to run it, it fetches the schemas for the other features as well. I put breakpoints in the global configuration where the schema paths are defined but with the test configuration it's not getting there and I don't understand why it loads all features' schemas.

I get this error:

No method or field found as defined in schema <unknown>:189 with any of the following signatures (with or without one of [interface graphql.schema.DataFetchingEnvironment] as the last argument), in priority order

where it's trying to build a method for a schema that should not be loaded.

How can I limit where the test looks for graphql schemas? I have looked for documentation or examples but they are very scarce.

Any help would be most welcome.

Body:
I am very new to graphql in general and I am managing an application that uses graphql-java-kickstart with springboot. I am trying to write tests for some of my resolvers but I am having problems running them. I have three packages that have associated graphql schemas within the application but I am just trying to test the resolvers from each one independently. I have this test configuration:

@RunWith(MockitoJUnitRunner.class)
@GraphQLTest
@ComponentScan(basePackages = {
    "feature1-resolvers.package",
    "feature1-root-resolver.package",
})
public class MyResolverTest {

 ...Test code
}

I am pointing my test configuration to the feature packages I want to test but when I try to run it, it fetches the schemas for the other features as well. I put breakpoints in the global configuration where the schema paths are defined but with the test configuration it's not getting there and I don't understand why it loads all features' schemas.

I get this error:

No method or field found as defined in schema <unknown>:189 with any of the following signatures (with or without one of [interface graphql.schema.DataFetchingEnvironment] as the last argument), in priority order

where it's trying to build a method for a schema that should not be loaded.

How can I limit where the test looks for graphql schemas? I have looked for documentation or examples but they are very scarce.

Any help would be most welcome.


问:
Button clickable from a collapsed drawer
Buttons that cannot be clicked due to drawers being collapsed.

Hello everyone, I have a drawer that can be expanded and collapsed. Inside the drawer are two buttons, but they can only be clicked when the drawer is expanded. How can i fix this?

Buttons not clickable
Buttons clickable

Drawer Code:

```<code>import * as React from 'react';
import PropTypes from 'prop-types';
import { Global } from '@emotion/react';
import { styled } from '@mui/material/styles';
import CssBaseline from '@mui/material/CssBaseline';
import { grey } from '@mui/material/colors';
import Button from '@mui/material/Button';
import Box from '@mui/material/Box';
import Typography from '@mui/material/Typography';
import SwipeableDrawer from '@mui/material/SwipeableDrawer';
import estilos from "../sheets/Drawer.module.css";
import InsetList from "../Components/List.js";
import Fab from '@mui/material/Fab';
import MyLocationIcon from '@mui/icons-material/MyLocation';
import PersonPinCircleIcon from '@mui/icons-material/PersonPinCircle';

const drawerBleeding = 90;

const Root = styled('div')(({ theme }) => ({
  height: '100%',
  backgroundColor:
    theme.palette.mode === 'light' ? grey[100] : theme.palette.background.default,
}));

const StyledBox = styled(Box)(({ theme }) => ({
  backgroundColor: theme.palette.mode === 'light' ? '#fff' : grey[800],
}));

const Puller = styled(Box)(({ theme }) => ({
  width: 30,
  height: 6,
  backgroundColor: theme.palette.mode === 'light' ? grey[300] : grey[900],
  borderRadius: 3,
  position: 'absolute',
  top: 8,
  left: 'calc(70% - 15px)',
}));

function Drawer(props) {
  const { window } = props;
  const [open, setOpen] = React.useState(false);

  const toggleDrawer = (newOpen) => () => {
    setOpen(newOpen);
  };

  // This is used only for the example
  const container = window !== undefined ? () => window().document.body : undefined;

  return (
    <Root>
      <CssBaseline  />
      <Global
  styles={{
    '.MuiDrawer-root > .MuiPaper-root': {
      height: `calc(41% - ${drawerBleeding}px)`,
      width:360,
      left: `calc(50% - 180px)`,
      overflow: 'visible',
    },
  }}
/>
      <Box sx={{ textAlign: 'center', pt: 1 }}>
        <Button onClick={toggleDrawer(true)}
        variant="contained"
        >Open</Button>

      </Box>

      <SwipeableDrawer
      sx={{
        margin: "auto",
        width: 360
      }}
        container={container}
        anchor="bottom"
        open={open}
        onClose={toggleDrawer(false)}
        onOpen={toggleDrawer(true)}
        swipeAreaWidth={drawerBleeding}
        disableSwipeToOpen={false}
        ModalProps={{
        keepMounted: true,
        }}
      >

        <StyledBox
          sx={{
            position: 'absolute',
            top: -drawerBleeding,
            borderTopLeftRadius: 20,
            borderTopRightRadius: 20,
            visibility: 'visible',
            right: 0,
            left: 0,
            margin: "auto",
            width: 360
          }}
        >
          <div className={estilos.barra}></div>

          <div className={estilos.tope}>

          <Fab
          className={estilos.Persona}
          size="medium"
          variant="extended"
          color="default">
          <PersonPinCircleIcon sx={{ mr: 1 }} />
          Locate
          </Fab>

          <Fab
          color="default"
          aria-label="add"
          className={estilos.Ubicarte}>
          <MyLocationIcon />
          </Fab>

          </div>

          <div onClick={toggleDrawer(false)}>
          <InsetList
          sx={{ p: 2, color: 'text.secondary' }}/>
          </div>
          <Typography sx={{ p: 2, color: 'text.secondary' }}>3 users</Typography>

        </StyledBox>

      </SwipeableDrawer>
    </Root>
  );
}

Drawer.propTypes = {
  /**
   * Injected by the documentation to work in an iframe.
   * You won't need it on your project.
   */
  window: PropTypes.func,
};

export default Drawer;
</code>```

I tried looking for information from other encoders and also on the MUI page, but couldn't find the solution.

Body:
Buttons that cannot be clicked due to drawers being collapsed.

Hello everyone, I have a drawer that can be expanded and collapsed. Inside the drawer are two buttons, but they can only be clicked when the drawer is expanded. How can i fix this?

Buttons not clickable
Buttons clickable

Drawer Code:

import * as React from 'react';
import PropTypes from 'prop-types';
import { Global } from '@emotion/react';
import { styled } from '@mui/material/styles';
import CssBaseline from '@mui/material/CssBaseline';
import { grey } from '@mui/material/colors';
import Button from '@mui/material/Button';
import Box from '@mui/material/Box';
import Typography from '@mui/material/Typography';
import SwipeableDrawer from '@mui/material/SwipeableDrawer';
import estilos from "../sheets/Drawer.module.css";
import InsetList from "../Components/List.js";
import Fab from '@mui/material/Fab';
import MyLocationIcon from '@mui/icons-material/MyLocation';
import PersonPinCircleIcon from '@mui/icons-material/PersonPinCircle';

const drawerBleeding = 90;

const Root = styled('div')(({ theme }) => ({
  height: '100%',
  backgroundColor:
    theme.palette.mode === 'light' ? grey[100] : theme.palette.background.default,
}));

const StyledBox = styled(Box)(({ theme }) => ({
  backgroundColor: theme.palette.mode === 'light' ? '#fff' : grey[800],
}));

const Puller = styled(Box)(({ theme }) => ({
  width: 30,
  height: 6,
  backgroundColor: theme.palette.mode === 'light' ? grey[300] : grey[900],
  borderRadius: 3,
  position: 'absolute',
  top: 8,
  left: 'calc(70% - 15px)',
}));

function Drawer(props) {
  const { window } = props;
  const [open, setOpen] = React.useState(false);

  const toggleDrawer = (newOpen) => () => {
    setOpen(newOpen);
  };

  // This is used only for the example
  const container = window !== undefined ? () => window().document.body : undefined;

  return (
    <Root>
      <CssBaseline  />
      <Global
  styles={{
    '.MuiDrawer-root > .MuiPaper-root': {
      height: `calc(41% - ${drawerBleeding}px)`,
      width:360,
      left: `calc(50% - 180px)`,
      overflow: 'visible',
    },
  }}
/>
      <Box sx={{ textAlign: 'center', pt: 1 }}>
        <Button onClick={toggleDrawer(true)}
        variant="contained"
        >Open</Button>

      </Box>

      <SwipeableDrawer
      sx={{
        margin: "auto",
        width: 360
      }}
        container={container}
        anchor="bottom"
        open={open}
        onClose={toggleDrawer(false)}
        onOpen={toggleDrawer(true)}
        swipeAreaWidth={drawerBleeding}
        disableSwipeToOpen={false}
        ModalProps={{
        keepMounted: true,
        }}
      >

      </SwipeableDrawer>
    </Root>
  );
}

Drawer.propTypes = {
  /**
   * Injected by the documentation to work in an iframe.
   * You won't need it on your project.
   */
  window: PropTypes.func,
};

export default Drawer;

I tried looking for information from other encoders and also on the MUI page, but couldn't find the solution.


问:
Is it possible to run multiple stages or at least multiple jobs sequentially in the same workspace on the GitLab CI/CD pipeline?
is it possible to run multiple stages, or at least multiple jobs in the same workspace (machine) on the GitLab CI/CD pipeline?

The problem that I'm struggling with is that if I define e.g. 3 stages in the ".gitlab-ci.yml" file, and I want to install OS in 1st stage, in the 2nd stage to do something in that installed OS, and in the 3rd stage to copy some files that are generated in the 2nd stage, it fails even after 1st stage because 2nd stage is not using the same workspace (machine). So, is it possible to somehow force the stage/job to use the same workspace(machine) so it can have access to all binaries from the previous stage, etc? The approach of storing "artifacts" is not a solution because of the time that can be spent on uploading/downloading "artifacts".

Example - .gitlab-ci.yml:

```<code>stages:
    - installOS
    - build
    - copyFiles

image: link

env_setup:
    stage: installOS
    script:
        - install OS commands...

build_code:
    stage: build
    script:
        - build commands...

copy_files:
    stage: copyFiles
    script:
        - coppy commands...
</code>```

I tried to create the structure in the ".gitlab-ci.yml" file as I explained above, but after executing the pipeline, and the commands in the "installOS" stage, the workspace shows the "Cleaning up project directory and file based variables" notification message, which is the main problem, because I don't want to clean up a project directory and variables before I execute the next stage. Once the 1st stage is executed, the 2nd stage starts executing but it fails with the following warning message - "/usr/bin/bash: line 137: command not found" because GitLab created a new workspace for the 2nd stage.

Body:
is it possible to run multiple stages, or at least multiple jobs in the same workspace (machine) on the GitLab CI/CD pipeline?

The problem that I'm struggling with is that if I define e.g. 3 stages in the ".gitlab-ci.yml" file, and I want to install OS in 1st stage, in the 2nd stage to do something in that installed OS, and in the 3rd stage to copy some files that are generated in the 2nd stage, it fails even after 1st stage because 2nd stage is not using the same workspace (machine). So, is it possible to somehow force the stage/job to use the same workspace(machine) so it can have access to all binaries from the previous stage, etc? The approach of storing "artifacts" is not a solution because of the time that can be spent on uploading/downloading "artifacts".

Example - .gitlab-ci.yml:

stages:
    - installOS
    - build
    - copyFiles

image: link

env_setup:
    stage: installOS
    script:
        - install OS commands...

build_code:
    stage: build
    script:
        - build commands...

copy_files:
    stage: copyFiles
    script:
        - coppy commands...

I tried to create the structure in the ".gitlab-ci.yml" file as I explained above, but after executing the pipeline, and the commands in the "installOS" stage, the workspace shows the "Cleaning up project directory and file based variables" notification message, which is the main problem, because I don't want to clean up a project directory and variables before I execute the next stage. Once the 1st stage is executed, the 2nd stage starts executing but it fails with the following warning message - "/usr/bin/bash: line 137: command not found" because GitLab created a new workspace for the 2nd stage.


问:
AWS vpn assign static LOCAL IP address to the remote user?
I have an AWS VPN set up.  I have just tested connecting and disconnecting to my VPN from my PC in my office. Everything works fine, but I noticed that each time I get a different IP address assigned to my remote PC.  For example:

12.0.0.32

12.0.0.147

12.0.0.92
...

I want to have the same local IP address assigned to the PC.  That way, I could set up a firewall rule to direct traffic from a particular domain to a specific port on my remote PC and do testing of some server code while in development mode, without resorting to something like ngrok.

NOTE: I believe my question is different from the many questions I have seen on SO where people want to have a static IP assigned to their VPN (public facing WAN address) or to their load balancer.  This is not what I want.  I just want the AWS side software to assign the same local IP address to my remote PC when I connect to the VPN so I can write the firewall rule to redirect traffic to my remote PC.  By local IP address I mean the IP address assigned to my remote PC as a node on the VPN private subnet.

I am the only user that connects to this VPN sub-net so there is no problem with locking out other users if the same local IP address is assigned to an incoming VPN client connection.

How can I do this?


问:
How to fix : java.lang.RuntimeException: Unknown error at android.os.Process.getProcessGroup(Process.java) occurring only in Android 9 oppo devices
We have been receiving a crash which is one of the top crash having highest event counts in Firebase crashlytics.
the stacktrace does not say much, but it only happens on Android 12 Oppo devices in in the background only.

```<code>Fatal Exception: java.lang.RuntimeException: Unknown error
   at android.os.Process.getProcessGroup(Process.java)
   at android.os.LooperMessageSuperviser.uploadLongTimeMessage(LooperMessageSuperviser.java:63)
   at android.os.LooperMessageSuperviser.endLooperMessage(LooperMessageSuperviser.java:101)
   at android.os.Looper.loop(Looper.java:290)
   at android.app.ActivityThread.main(ActivityThread.java:7225)
   at java.lang.reflect.Method.invoke(Method.java)
   at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:499)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:962)
</code>```

Any Idea/Suggestion how should i try to resolve this!!

Body:
We have been receiving a crash which is one of the top crash having highest event counts in Firebase crashlytics.
the stacktrace does not say much, but it only happens on Android 12 Oppo devices in in the background only.

Fatal Exception: java.lang.RuntimeException: Unknown error
   at android.os.Process.getProcessGroup(Process.java)
   at android.os.LooperMessageSuperviser.uploadLongTimeMessage(LooperMessageSuperviser.java:63)
   at android.os.LooperMessageSuperviser.endLooperMessage(LooperMessageSuperviser.java:101)
   at android.os.Looper.loop(Looper.java:290)
   at android.app.ActivityThread.main(ActivityThread.java:7225)
   at java.lang.reflect.Method.invoke(Method.java)
   at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:499)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:962)

Any Idea/Suggestion how should i try to resolve this!!


问:
Uncaught (in promise) TypeError: Cannot read properties of null (reading 'start') vue 3 in vuex
```<code>import firebase from 'firebase/compat/app';
import * as firebaseui from 'firebaseui'
import 'firebaseui/dist/firebaseui.css'

const config = {
  apiKey: "",
  authDomain: "",
  projectId: "",
  storageBucket: "",
  messagingSenderId: "",
  appId: "",
  measurementId: ""
};

const auth = {
  context: null,
  uiConfig: null,
  ui: null,

  init(context) {
    this.context = context;

    firebase.initializeApp(config);
    this.uiConfig = {
      signInSuccessUrl: '/',
      signInOptions: [

        firebase.auth.GoogleAuthProvider.PROVIDER_ID,
      ]
    }
    this.ui = new firebaseui.auth.AuthUI(firebase.auth());

    firebase.auth().onAuthStateChanged((user) => {
      this.context.$store.dispatch('user/setCurrentUser')

      let requireAuth = this.context.$route.matched.some(record => record.meta.requireAuth)
      let guestOnly = this.context.$route.matched.some(record => record.meta.guestOnly)

      if(requireAuth && !user) this.context.$router.push('/auth/login')
      else if (guestOnly && user) this.context.$router.push('/')
    });
  },
  authForm(container) {

    console.log(this.ui);

    this.ui.start(container, this.uiConfig);
  },
  user() {
    return this.context ? firebase.auth().currentUser : null;
  },
  logout() {
    firebase.auth().signOut();
  }
}

export default auth;
</code>```
```<code>     "firebase": "^9.14.0",
        "firebaseui": "^6.0.2",
</code>```
```<code>     "firebase": "^9.14.0",
        "firebaseui": "^6.0.2",
</code>```

here i am using Firebase UI.but i get error this.ui.start(container, this.uiConfig) this line .what the problem of ui start and how to solve this problem?

here i am using Firebase UI.but i get error this.ui.start(container, this.uiConfig) this line .what the problem of ui start and how to solve this problem?

Body:
import firebase from 'firebase/compat/app';
import * as firebaseui from 'firebaseui'
import 'firebaseui/dist/firebaseui.css'

const config = {
  apiKey: "",
  authDomain: "",
  projectId: "",
  storageBucket: "",
  messagingSenderId: "",
  appId: "",
  measurementId: ""
};

const auth = {
  context: null,
  uiConfig: null,
  ui: null,

  init(context) {
    this.context = context;

    firebase.initializeApp(config);
    this.uiConfig = {
      signInSuccessUrl: '/',
      signInOptions: [

        firebase.auth.GoogleAuthProvider.PROVIDER_ID,
      ]
    }
    this.ui = new firebaseui.auth.AuthUI(firebase.auth());

    firebase.auth().onAuthStateChanged((user) => {
      this.context.$store.dispatch('user/setCurrentUser')

      let requireAuth = this.context.$route.matched.some(record => record.meta.requireAuth)
      let guestOnly = this.context.$route.matched.some(record => record.meta.guestOnly)

      if(requireAuth && !user) this.context.$router.push('/auth/login')
      else if (guestOnly && user) this.context.$router.push('/')
    });
  },
  authForm(container) {

    console.log(this.ui);

    this.ui.start(container, this.uiConfig);
  },
  user() {
    return this.context ? firebase.auth().currentUser : null;
  },
  logout() {
    firebase.auth().signOut();
  }
}

export default auth;

     "firebase": "^9.14.0",
        "firebaseui": "^6.0.2",

     "firebase": "^9.14.0",
        "firebaseui": "^6.0.2",

here i am using Firebase UI.but i get error this.ui.start(container, this.uiConfig) this line .what the problem of ui start and how to solve this problem?

here i am using Firebase UI.but i get error this.ui.start(container, this.uiConfig) this line .what the problem of ui start and how to solve this problem?


问:
Problem with importing firestorage xcode 12
It's frustrating each step I do I fall

I'm trying to connect to firestorage using xcode 12 but at the exact moment I impor firestorage I receive a set of errors. It works ok with FirebaseAuth

I'm attaching a screen to show the error because I don't know how to fix them

I add firebase using
https://github.com/firebase/firebase-ios-sdk.git


问:
Tieit Forms for download functionality
How can I implement download functionality in tieit forms(Corresponding brochures download using custom field ACF)?

I couldn't find the solution?

Title: Tieit Forms for download functionality


问:
SpringBoot API mapping working fine in local but not for Docker port
I'm not able to connect to spring boot API when using container port (8080) but is working fine when connected to local port (8080). I get Whitelabel Error Page for docker (http://localhost:9090/api/categories) and proper response for local port (http://localhost:8080/api/categories).
In container logs, I see following -

No mapping for GET /api/categories

Following is my dockerfile -

```<code>FROM openjdk:17-alpine
EXPOSE 8080
ADD target/spring-boot-ecommerce.jar spring-boot-ecommerce.jar
ADD https://github.com/ufoscout/docker-compose-wait/releases/download/2.7.3/wait /wait
RUN chmod +x /wait
ENTRYPOINT ["java", "-jar", "spring-boot-ecommerce.jar"]
</code>```

I have following in docker-compose -

```<code>ports:
  - '9090:8080'
</code>```

Controller -

```<code>@RestController
@CrossOrigin(origins = "http://localhost:4200")
@RequestMapping("/api/categories")
public class CategoryController{
  ...
}
</code>```

[UPDATE] - In local, I'm hitting API like shown below -

For Docker port -

Controller method is like this -

```<code>@GetMapping()
public ResponseEntity<?> getAllCategories() {
 ...
}
</code>```

Body:
I'm not able to connect to spring boot API when using container port (8080) but is working fine when connected to local port (8080). I get Whitelabel Error Page for docker (http://localhost:9090/api/categories) and proper response for local port (http://localhost:8080/api/categories).
In container logs, I see following -

No mapping for GET /api/categories

Following is my dockerfile -

FROM openjdk:17-alpine
EXPOSE 8080
ADD target/spring-boot-ecommerce.jar spring-boot-ecommerce.jar
ADD https://github.com/ufoscout/docker-compose-wait/releases/download/2.7.3/wait /wait
RUN chmod +x /wait
ENTRYPOINT ["java", "-jar", "spring-boot-ecommerce.jar"]

I have following in docker-compose -

ports:
  - '9090:8080'

Controller -

@RestController
@CrossOrigin(origins = "http://localhost:4200")
@RequestMapping("/api/categories")
public class CategoryController{
  ...
}

[UPDATE] - In local, I'm hitting API like shown below -

For Docker port -

Controller method is like this -

@GetMapping()
public ResponseEntity<?> getAllCategories() {
 ...
}


问:
Combining Rxjava with Webflux
I would like to know the way to combine Rxjava with Webflux in springboot. I am working on an application in which I am using Rxjava and I need to make implementation changes, from Single to Mono and from Mono to Single, I would like to know if anyone has any documentation on this, I think I have read that this was possible but when I search I can't find any references . Greetings.</p>

Title: Combining Rxjava with Webflux


问:
How to Fix Could not find the include file "./partials/header.ejs"
I tried replace everything but it doesn't work. Please help me. I am currently student want to be a professional back-end programmer someday.</p>
```<code>Error: C:\Users\ADMIN\Desktop\Thesis project\File_Sharing_System-master\Views\layout\layout.ejs:3
    1| <!DOCTYPE html>
    2| <html lang="en" class="h-100">
 >> 3|   <%- include('./partials/header.ejs') %>
    4|
    5|   <body>
    6|     <%- body -%>

Could not find the include file "./partials/header.ejs"
    at getIncludePath (C:\Users\ADMIN\Desktop\Thesis project\File_Sharing_System-master\node_modules\ejs\lib\ejs.js:185:13)
    at includeFile (C:\Users\ADMIN\Desktop\Thesis project\File_Sharing_System-master\node_modules\ejs\lib\ejs.js:311:19)
    at include (C:\Users\ADMIN\Desktop\Thesis project\File_Sharing_System-master\node_modules\ejs\lib\ejs.js:701:16)
    at eval (eval at compile (C:\Users\ADMIN\Desktop\Thesis project\File_Sharing_System-master\node_modules\ejs\lib\ejs.js:673:12), <anonymous>:12:17)
    at layout (C:\Users\ADMIN\Desktop\Thesis project\File_Sharing_System-master\node_modules\ejs\lib\ejs.js:703:17)
    at tryHandleCache (C:\Users\ADMIN\Desktop\Thesis project\File_Sharing_System-master\node_modules\ejs\lib\ejs.js:274:36)
    at Object.exports.renderFile (C:\Users\ADMIN\Desktop\Thesis project\File_Sharing_System-master\node_modules\ejs\lib\ejs.js:491:10)
    at renderFile (C:\Users\ADMIN\Desktop\Thesis project\File_Sharing_System-master\node_modules\ejs-mate\lib\index.js:298:7)
    at C:\Users\ADMIN\Desktop\Thesis project\File_Sharing_System-master\node_modules\ejs-mate\lib\index.js:353:7
    at tryHandleCache (C:\Users\ADMIN\Desktop\Thesis project\File_Sharing_System-master\node_modules\ejs\lib\ejs.js:280:5)
    at Object.exports.renderFile (C:\Users\ADMIN\Desktop\Thesis project\File_Sharing_System-master\node_modules\ejs\lib\ejs.js:491:10)
    at View.renderFile [as engine] (C:\Users\ADMIN\Desktop\Thesis project\File_Sharing_System-master\node_modules\ejs-mate\lib\index.js:298:7)
    at View.render (C:\Users\ADMIN\Desktop\Thesis project\File_Sharing_System-master\node_modules\express\lib\view.js:135:8)
    at tryRender (C:\Users\ADMIN\Desktop\Thesis project\File_Sharing_System-master\node_modules\express\lib\application.js:657:10)
    at Function.render (C:\Users\ADMIN\Desktop\Thesis project\File_Sharing_System-master\node_modules\express\lib\application.js:609:3)
    at ServerResponse.render (C:\Users\ADMIN\Desktop\Thesis project\File_Sharing_System-master\node_modules\express\lib\response.js:1039:7)
</code>```

Body:
I tried replace everything but it doesn't work. Please help me. I am currently student want to be a professional back-end programmer someday.

Error: C:\Users\ADMIN\Desktop\Thesis project\File_Sharing_System-master\Views\layout\layout.ejs:3
    1| <!DOCTYPE html>
    2|
 >> 3|   <%- include('./partials/header.ejs') %>
    4|
    5|
    6|     <%- body -%>

Could not find the include file "./partials/header.ejs"
    at getIncludePath (C:\Users\ADMIN\Desktop\Thesis project\File_Sharing_System-master\node_modules\ejs\lib\ejs.js:185:13)
    at includeFile (C:\Users\ADMIN\Desktop\Thesis project\File_Sharing_System-master\node_modules\ejs\lib\ejs.js:311:19)
    at include (C:\Users\ADMIN\Desktop\Thesis project\File_Sharing_System-master\node_modules\ejs\lib\ejs.js:701:16)
    at eval (eval at compile (C:\Users\ADMIN\Desktop\Thesis project\File_Sharing_System-master\node_modules\ejs\lib\ejs.js:673:12), <anonymous>:12:17)
    at layout (C:\Users\ADMIN\Desktop\Thesis project\File_Sharing_System-master\node_modules\ejs\lib\ejs.js:703:17)
    at tryHandleCache (C:\Users\ADMIN\Desktop\Thesis project\File_Sharing_System-master\node_modules\ejs\lib\ejs.js:274:36)
    at Object.exports.renderFile (C:\Users\ADMIN\Desktop\Thesis project\File_Sharing_System-master\node_modules\ejs\lib\ejs.js:491:10)
    at renderFile (C:\Users\ADMIN\Desktop\Thesis project\File_Sharing_System-master\node_modules\ejs-mate\lib\index.js:298:7)
    at C:\Users\ADMIN\Desktop\Thesis project\File_Sharing_System-master\node_modules\ejs-mate\lib\index.js:353:7
    at tryHandleCache (C:\Users\ADMIN\Desktop\Thesis project\File_Sharing_System-master\node_modules\ejs\lib\ejs.js:280:5)
    at Object.exports.renderFile (C:\Users\ADMIN\Desktop\Thesis project\File_Sharing_System-master\node_modules\ejs\lib\ejs.js:491:10)
    at View.renderFile [as engine] (C:\Users\ADMIN\Desktop\Thesis project\File_Sharing_System-master\node_modules\ejs-mate\lib\index.js:298:7)
    at View.render (C:\Users\ADMIN\Desktop\Thesis project\File_Sharing_System-master\node_modules\express\lib\view.js:135:8)
    at tryRender (C:\Users\ADMIN\Desktop\Thesis project\File_Sharing_System-master\node_modules\express\lib\application.js:657:10)
    at Function.render (C:\Users\ADMIN\Desktop\Thesis project\File_Sharing_System-master\node_modules\express\lib\application.js:609:3)
    at ServerResponse.render (C:\Users\ADMIN\Desktop\Thesis project\File_Sharing_System-master\node_modules\express\lib\response.js:1039:7)


问:
Using Parallel Processing for Dictionary comprehension Using Python and Pandas
How can implement the following the code below using parallel processing for faster processing?</p>
```<code>for i in range(0, len(demand_files)):
     dfs[file_list[i]] = {x:demand_files[i].parse(x) for x in demand_files[i].sheet_names}
</code>```

Body:
How can implement the following the code below using parallel processing for faster processing?

for i in range(0, len(demand_files)):
     dfs[file_list[i]] = {x:demand_files[i].parse(x) for x in demand_files[i].sheet_names}


问:
Typeorm subscribers execute serially rather than in parallel
I have an entity subscriber which listens for insert events on table. The flow in my mind while using subscribers was for it to be independent from the api execution flow. But this seems not to be the case.

I tested it by adding sleep to subscriber function, and sent a request, and the response waited for the subscriber function to finish. But I don't want this, I want the API to return immediately after execution is finished, and subscriber to execute whatever is relevant in the background in parallel.

Is this behavior achievable natively using Typeorm? If it is not, what can I do to achieve this behavior?


问:
How can I troubleshoot RabbitMQ in an Azure Portal?
I have some IOT edge modules running in the Azure. One of the modules is returning an error. I would like to check the Rabbit MQ service and its condition to troubleshoot the error.
But I do not know how to check the Rabbit MQ in Azure. Can any body advise?</p>


问:
Custom Http Response Exception Mapper in Javalin Server
How can we implement a custom exception mapper in the Javalin frame work? The main issue I am having with the default one is that it includes a type field in its json responses that identifies it as a javalin exception. I don't wish to expose this information. It looks as follows:

```<code>{

    "title": "Internal server error.",

    "status": 500,

    "type": "https://javalin.io/documentation#error-responses",

    .....

}
</code>```

The HttpResponseExceptionMapper doesn't seem to be an interface or anything that can be overridden. So I am at a loss, does anyone have any ideas?

Body:
How can we implement a custom exception mapper in the Javalin frame work? The main issue I am having with the default one is that it includes a type field in its json responses that identifies it as a javalin exception. I don't wish to expose this information. It looks as follows:

{

    "title": "Internal server error.",

    "status": 500,

    "type": "https://javalin.io/documentation#error-responses",

    .....

}

The HttpResponseExceptionMapper doesn't seem to be an interface or anything that can be overridden. So I am at a loss, does anyone have any ideas?


问:
How to mask values of selected fields using REGEX in java
I have JSON data as below and want to mask only specific field values.

"contact:[{"key":"mobile", "value":"1234567890"},{"key":"firstName","value":"qwerty"},{"key":"lastName":"value":"cvbnm"}, {"key":"friend":"value":"raj"}]"

O/p:"contact:[{"key":"mobile", "value":"1XXXXX7890"},{"key":"firstName","value":"XXXXXX"},{"key":"lastName":"value":"XXXXX"}, {"key":"friend":"value":"raj"}]"

Here i want to mask only mobile, firstName and lastName.
Could you please let me know what would be the regular expression for masking specific field values here.

I am expecting what would be the Regex for masking specific field values.


问:
How to make a query from a dictionary keyed by column value, the most concise, the better in sqlalchemy
I have a table of assets with categories and status values:

asset id.
asset category
status

1
auto
0

2
auto
50

3
auto
60

4
bike
30

5
bike
14

6
plane
16

I'd like to obtain a dict from it:

```<code>{
 auto: {not_ok: 1, to_watch: 0, ok: 2},
 bike: {not_ok: 0, to_watch: 1, ok: 1},
 plane:{not_ok: 0, to_watch: 0, ok: 1}
}
</code>```

where not_ok, to_watch, and ok are the count of each category when status falls in an interval defined as:
interval = np.linspace(0, max_status_by_category , 4).tolist().
For example, interval_auto = [0.0, 20.0, 40.0, 60.0], interval_bike = [0.0, 10.0, 20.0, 30.0] and so on:

```<code>interval[0]<= not_ok <= interval[1]
interval[1]< to_watch <= interval[2]
interval[2]<   ok <= interval[3]
</code>```

For the moment, what I do is to obtain the maximum status per category:

```<code>q_c = session.query(Assets.asset_category, func.count(Assets.asset_category),
                    func.max(Assets.asset_state)
                    ).group_by(Assets.asset_category).all()
</code>```

Which gives me the name of categories, the number of assets of each category and the maximum status per category.
Then I loop over the list I just obtained, making the intervals per category and requesting the number of ok, to_watch,..... Like:

```<code>q_status = session.query(Assets.asset_category, func.count(Assets.asset_category),
          func.count(func.nullif(and_(Assets.asset_state >= interval[0], Assets.asset_state <= interval[1]), False)),
          func.count(func.nullif(and_(Assets.asset_state > interval[1], Assets.asset_state <= interval[2]), False)),
          func.count(func.nullif(and_(Assets.asset_state > interval[2], Assets.asset_state <= interval[3]), False)),
           ) \
 .group_by(Assets.asset_category).all()
</code>```

Although this works, I'd like to make it more compact and concise. For example:

Is there a way to make the intervals on the fly and obtain the status on a single query??

Let's say I can't make the intervals on the fly, but I can obtain them like before:

```<code>interval = {
auto: [0.0, 20.0, 40.0, 60.0],
bike: [0.0, 10.0, 20.0, 30.0],
plane: [0.0, 5.333333333333333, 10.666666666666666, 16.0]
}
</code>```

Can we make the query to access this dictionary while the query runs? I mean, something like this:

```<code>q_status = session.query(Assets.asset_category, func.count(Assets.asset_category),
          func.count(func.nullif(and_(Assets.asset_state >= interval[Assets.asset_category][0], Assets.asset_state <= interval[Assets.asset_category][1]), False)),
          func.count(func.nullif(and_(Assets.asset_state > interval[Assets.asset_category][1], Assets.asset_state <= interval[Assets.asset_category][2]), False)),
          func.count(func.nullif(and_(Assets.asset_state > interval[Assets.asset_category][2], Assets.asset_state <= interval[Assets.asset_category][3]), False)),
           ) \
 .group_by(Assets.asset_category).all()
</code>```

Which of course doesn't work. I am open to any idea to make this compact and if possible more performant.

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

Body:
I have a table of assets with categories and status values:

asset id.
asset category
status

1
auto
0

2
auto
50

3
auto
60

4
bike
30

5
bike
14

6
plane
16

I'd like to obtain a dict from it:

{
 auto: {not_ok: 1, to_watch: 0, ok: 2},
 bike: {not_ok: 0, to_watch: 1, ok: 1},
 plane:{not_ok: 0, to_watch: 0, ok: 1}
}

where not_ok, to_watch, and ok are the count of each category when status falls in an interval defined as:
interval = np.linspace(0, max_status_by_category , 4).tolist().
For example, interval_auto = [0.0, 20.0, 40.0, 60.0], interval_bike = [0.0, 10.0, 20.0, 30.0] and so on:

interval[0]<= not_ok <= interval[1]
interval[1]< to_watch <= interval[2]
interval[2]<   ok <= interval[3]

For the moment, what I do is to obtain the maximum status per category:

q_c = session.query(Assets.asset_category, func.count(Assets.asset_category),
                    func.max(Assets.asset_state)
                    ).group_by(Assets.asset_category).all()

Which gives me the name of categories, the number of assets of each category and the maximum status per category.
Then I loop over the list I just obtained, making the intervals per category and requesting the number of ok, to_watch,..... Like:

q_status = session.query(Assets.asset_category, func.count(Assets.asset_category),
          func.count(func.nullif(and_(Assets.asset_state >= interval[0], Assets.asset_state <= interval[1]), False)),
          func.count(func.nullif(and_(Assets.asset_state > interval[1], Assets.asset_state <= interval[2]), False)),
          func.count(func.nullif(and_(Assets.asset_state > interval[2], Assets.asset_state <= interval[3]), False)),
           ) \
 .group_by(Assets.asset_category).all()

Although this works, I'd like to make it more compact and concise. For example:

Is there a way to make the intervals on the fly and obtain the status on a single query??

Let's say I can't make the intervals on the fly, but I can obtain them like before:

interval = {
auto: [0.0, 20.0, 40.0, 60.0],
bike: [0.0, 10.0, 20.0, 30.0],
plane: [0.0, 5.333333333333333, 10.666666666666666, 16.0]
}

Can we make the query to access this dictionary while the query runs? I mean, something like this:

q_status = session.query(Assets.asset_category, func.count(Assets.asset_category),
          func.count(func.nullif(and_(Assets.asset_state >= interval[Assets.asset_category][0], Assets.asset_state <= interval[Assets.asset_category][1]), False)),
          func.count(func.nullif(and_(Assets.asset_state > interval[Assets.asset_category][1], Assets.asset_state <= interval[Assets.asset_category][2]), False)),
          func.count(func.nullif(and_(Assets.asset_state > interval[Assets.asset_category][2], Assets.asset_state <= interval[Assets.asset_category][3]), False)),
           ) \
 .group_by(Assets.asset_category).all()

Which of course doesn't work. I am open to any idea to make this compact and if possible more performant.


问:
ASP.NET Core MVC post receiver error 415 if specify [FromBody]
I am developing a controller in ASP.NET Core 6.0 and I want to implement a post consumer that accept binary images.

If I write the signature in this way:

[HttpPost("image/{pv}/{articolo}"),
 Consumes("image/jpeg", new string[] { "image/jpg", "image/png", "image/tiff", "image/tif" }),
 SwaggerResponse(StatusCodes.Status200OK),
 SwaggerResponse(StatusCodes.Status400BadRequest, "nel caso in cui PV o articolo non esistono")]
public async Task<IActionResult> postImage(string pv, string articolo, [FromBody] Stream fileStream)
{
    /* use fileStream to save into disk*/
}
```

The swagger works great:

But If I try it returns error 415 "Unsupported Media Type"

I tried removing [FromBody], the only way to not get 415 is remove the parameter and use Request.Body, but I need the swagger as documentation.

Body:
I am developing a controller in ASP.NET Core 6.0 and I want to implement a post consumer that accept binary images.

If I write the signature in this way:

[HttpPost("image/{pv}/{articolo}"),
 Consumes("image/jpeg", new string[] { "image/jpg", "image/png", "image/tiff", "image/tif" }),
 SwaggerResponse(StatusCodes.Status200OK),
 SwaggerResponse(StatusCodes.Status400BadRequest, "nel caso in cui PV o articolo non esistono")]
public async Task<IActionResult> postImage(string pv, string articolo, [FromBody] Stream fileStream)
{
    /* use fileStream to save into disk*/
}

The swagger works great:

But If I try it returns error 415 "Unsupported Media Type"

I tried removing [FromBody], the only way to not get 415 is remove the parameter and use Request.Body, but I need the swagger as documentation.


问:
The current transaction cannot be committed and cannot support operations that write to the log file. Roll back the transaction in SQL Server
I have an Error log table, We insert error details into this table if there is any exception in stored procedure or trigger.

I can see an entry for an update trigger in this table. But I am not able to understand the root cause of the error.

Is this trigger causing the issue? or some other stored procedure is causing this issue?

Error Message: The current transaction cannot be committed and cannot support operations that write to the log file. Roll back the transaction.

Procedure Name: In the procedure name I get the trigger name

Error Number: 3930
Query to insert into an error log table.

```<code>END TRY
BEGIN CATCH
    INSERT INTO Mas_ErrorLog (ProcedureName, ErrorNumber, ErrorMessage, ErrorSeverity, ErrorState, ErrorLine)
    SELECT Error_Procedure(), Error_Number(), Error_Message(), Error_Severity(), Error_State(), Error_Line()
END CATCH
</code>```

Note: Just to highlight one thing, I can't see an entry for this trigger in other environments databases like Dev, Beta or UAT. It's occurring only in the Production database so I cannot directly make changes and test.

And it's an old log, I cannot reproduce this case, I need to investigate the root cause.

Body:
I have an Error log table, We insert error details into this table if there is any exception in stored procedure or trigger.

I can see an entry for an update trigger in this table. But I am not able to understand the root cause of the error.

Is this trigger causing the issue? or some other stored procedure is causing this issue?

Error Message: The current transaction cannot be committed and cannot support operations that write to the log file. Roll back the transaction.

Procedure Name: In the procedure name I get the trigger name

Error Number: 3930
Query to insert into an error log table.

END TRY
BEGIN CATCH
    INSERT INTO Mas_ErrorLog (ProcedureName, ErrorNumber, ErrorMessage, ErrorSeverity, ErrorState, ErrorLine)
    SELECT Error_Procedure(), Error_Number(), Error_Message(), Error_Severity(), Error_State(), Error_Line()
END CATCH

Note: Just to highlight one thing, I can't see an entry for this trigger in other environments databases like Dev, Beta or UAT. It's occurring only in the Production database so I cannot directly make changes and test.

And it's an old log, I cannot reproduce this case, I need to investigate the root cause.


问:
Twilio usage record for users participating in conversations
I want to display the count of users that are participating in conversation. By participating, I mean all actions that a user can take upon a conversation - create, send/read messages and so on.

I found the pchat-users metric - https://www.twilio.com/docs/usage/api/usage-record (Twilio Conversations -> pchat-users) - but this metric won't do, as it gets increased for each newly created user, despite if the user ever uses any conversation functionality.


问:
Freemarker template(.ftl) FILE Validation
I wish to validate a freemarker template file, if it's valid in terms of content and syntax or not. How can I achieve this? For example, If i save an excel file with .ftl extension, it should not be a valid ftl file, so how can i validate this?

I tried using Template(String,String,Configuration) constructor to catch a parsing error but it is allowing and parsing all the content of the template.


问:
Why when i try to start program it doesnt check venv's libs instead of local lib
Hi everyone i have an project and i created a venv with

python -m virtualenv venv
then i installed requirements for example selenium, pyqt5 etc..
when i want to start my project on powershell i face with this error (venv is activated)

```<code>This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.```

when i try to run with command prompt i also encounter with this error

```from PyQt5.QtCore import pyqtSlot
ModuleNotFoundError: No module named 'PyQt5'```

When i check pip list i can see that all dependencies installed and exist. Why when i try to start program it doesnt check venv's libs instead of local lib. can someone help me. Thanks in advance.
```

Body:
Hi everyone i have an project and i created a venv with

python -m virtualenv venv
then i installed requirements for example selenium, pyqt5 etc..
when i want to start my project on powershell i face with this error (venv is activated)

This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.```

when i try to run with command prompt i also encounter with this error

```from PyQt5.QtCore import pyqtSlot
ModuleNotFoundError: No module named 'PyQt5'```

When i check pip list i can see that all dependencies installed and exist. Why when i try to start program it doesnt check venv's libs instead of local lib. can someone help me. Thanks in advance.


问:
Problem with Gtk Key Controller in Flatpak
I have a problem with the Gtk Key Controller in Flatpak. When I ran my built test application that uses GTK and Libadwaita and Gtk Key Controller for keyboard shortcuts, I found that it doesn't work in Flatpak. When I pressed the Ctrl+S keyboard shortcut, it triggered the action. Unfortunately, however, I could not press the Ctrl+Z keyboard shortcut (exit action) while the action was in progress. Natively it works without any problems.

Permissions:

```<code>- --socket=wayland
- --socket=fallback-x11
- --talk-name=org.freedesktop.Notifications
- --share=ipc
- --socket=pulseaudio
- --device=dri
</code>```

Python:

```<code>keycont = Gtk.EventControllerKey()
keycont.connect('key-pressed', self.keys, self)
self.add_controller(keycont)
def keys(self, keyval, keycode, state, user_data, win):
    if keycode == ord('q'):
        win.close()
    if keycode == ord('s'):
        self.start()
    if keycode == ord('z'):
        self.stop()
    if keycode == ord('h'):
        shortcuts_window = ShortcutsWindow(transient_for=app.get_active_window())
        shortcuts_window.present()
</code>```

Do I need to add additional permissions? Does exists another way to use keyboard shortcuts in Gtk apps?

Thanks in advance for your reply.

Body:
I have a problem with the Gtk Key Controller in Flatpak. When I ran my built test application that uses GTK and Libadwaita and Gtk Key Controller for keyboard shortcuts, I found that it doesn't work in Flatpak. When I pressed the Ctrl+S keyboard shortcut, it triggered the action. Unfortunately, however, I could not press the Ctrl+Z keyboard shortcut (exit action) while the action was in progress. Natively it works without any problems.

Permissions:

- --socket=wayland
- --socket=fallback-x11
- --talk-name=org.freedesktop.Notifications
- --share=ipc
- --socket=pulseaudio
- --device=dri

Python:

keycont = Gtk.EventControllerKey()
keycont.connect('key-pressed', self.keys, self)
self.add_controller(keycont)
def keys(self, keyval, keycode, state, user_data, win):
    if keycode == ord('q'):
        win.close()
    if keycode == ord('s'):
        self.start()
    if keycode == ord('z'):
        self.stop()
    if keycode == ord('h'):
        shortcuts_window = ShortcutsWindow(transient_for=app.get_active_window())
        shortcuts_window.present()

Do I need to add additional permissions? Does exists another way to use keyboard shortcuts in Gtk apps?

Thanks in advance for your reply.


问:
Zeppelin - HTML Table styles not taken into account
We are using Zeppelin (v0.7.3) as a monitoring dashboard in our BigData cluster for some of the services running. It is installed in standalone.
We have the need to export metrics to Prometheus and I saw that the Prometheus exporter is available from v0.9.0. So I downloaded the latest version and installed it.

I exported the notebooks from the old version and imported into the new one. The paragraphs inside work fine but the display is wrong. We use HTML tables to display the results of our paragraphs and it seems that the styles that I am trying to apply to the tables (inside the paragraphs) are overriden somewhere.

For example, I am executing this simple paragraph:

```<code>%sh
# open HTML table
echo -e "%html <table style=width:100% border="2">"

# display table headers
echo -e "<tr>"
echo -e "<th>toto</th>"
echo -e "<th>titi</th>"
echo -e "</tr>"

echo -e "<tr>"
echo -e "<td bgcolor="green">tata</td>"
echo -e "<td bgcolor="red">tete</td>"
echo -e "</tr>"
# close HTML table
echo -e "</table> "
</code>```

In the newer version, the border are not displayed whereas in the older version it is working as expected.

So, is there a configuration somewhere that might cause a conflict or override the style I am trying to apply to the table ?
Are we not using it right ?

Thanks in advance.

Body:
We are using Zeppelin (v0.7.3) as a monitoring dashboard in our BigData cluster for some of the services running. It is installed in standalone.
We have the need to export metrics to Prometheus and I saw that the Prometheus exporter is available from v0.9.0. So I downloaded the latest version and installed it.

I exported the notebooks from the old version and imported into the new one. The paragraphs inside work fine but the display is wrong. We use HTML tables to display the results of our paragraphs and it seems that the styles that I am trying to apply to the tables (inside the paragraphs) are overriden somewhere.

For example, I am executing this simple paragraph:

%sh
# open HTML table
echo -e "%html
"

# display table headers
echo -e "
"
echo -e "toto	"
echo -e "titi	"
echo -e "
"

echo -e "
"
echo -e "tata	"
echo -e "tete	"
echo -e "
"
# close HTML table
echo -e "
 "

In the newer version, the border are not displayed whereas in the older version it is working as expected.

So, is there a configuration somewhere that might cause a conflict or override the style I am trying to apply to the table ?
Are we not using it right ?

Thanks in advance.


问:
Cannot spyOn on a primitive value; undefined given , Angular, Jest
I'm trying to use spyOn to spy on functions. But, I get the error. "Cannot spyOn on a primitive value; undefined given"

is there anything i should add and improve?

below is the code

```<code> public cpfMask(event: any) {
    let newValue = event.target.value;
    const regExp = new RegExp(this.cpfValid);
    this.cpfControl = this.cpfForm.get("cpf");
    const pattern = newValue.replace(/^(\d{3})(\d{3})(\d{3})(\d{2})/, "$1.$2.$3-$4");
    event.target.value = pattern;

     if (!regExp.test(pattern)) {
       event.target.value = newValue.slice(0, -1);
     }
    }
</code>```

Test unit Jest

```<code>    describe('TeamsComponent', () => {
      let component: TeamsComponent;
      let fixture: ComponentFixture<TeamsComponent>;

    beforeEach(async(() => {
      TestBed.configureTestingModule({
       declarations: [ TeamsComponent ]
      })
     .compileComponents();
      }));

      beforeEach(() => {
        fixture = TestBed.createComponent(TeamsComponent);
        component = fixture.componentInstance;
        fixture.detectChanges();
      });

      it('should be created', () => {
        expect(component).toBeTruthy();
      });

       it('should call cpfMask', () => {

       const spy = jest.spyOn(component, 'cpfMask').mockReturnVal(() =>
      {});;
       component.ngOnInit()
       expect(spy).toHaveBeenCalled();

     });

       it('should create', () => {
       const validate = component.cpfMask('111.111.111-11');
       fixture.detectChanges();
       expect(validate).toEqual('437.027.388-94');
     });

      it('should be invalid when string invalid', () => {
       const validate = component.cpfMask('111.111.111-11');
       expect(validate).toEqual({errorCpf: true});
    });

   });
</code>```

The objective is to test the function and validate the cpf document

Body:
I'm trying to use spyOn to spy on functions. But, I get the error. "Cannot spyOn on a primitive value; undefined given"

is there anything i should add and improve?

below is the code

 public cpfMask(event: any) {
    let newValue = event.target.value;
    const regExp = new RegExp(this.cpfValid);
    this.cpfControl = this.cpfForm.get("cpf");
    const pattern = newValue.replace(/^(\d{3})(\d{3})(\d{3})(\d{2})/, "$1.$2.$3-$4");
    event.target.value = pattern;

     if (!regExp.test(pattern)) {
       event.target.value = newValue.slice(0, -1);
     }
    }

Test unit Jest

    describe('TeamsComponent', () => {
      let component: TeamsComponent;
      let fixture: ComponentFixture<TeamsComponent>;

    beforeEach(async(() => {
      TestBed.configureTestingModule({
       declarations: [ TeamsComponent ]
      })
     .compileComponents();
      }));

      beforeEach(() => {
        fixture = TestBed.createComponent(TeamsComponent);
        component = fixture.componentInstance;
        fixture.detectChanges();
      });

      it('should be created', () => {
        expect(component).toBeTruthy();
      });

       it('should call cpfMask', () => {

       const spy = jest.spyOn(component, 'cpfMask').mockReturnVal(() =>
      {});;
       component.ngOnInit()
       expect(spy).toHaveBeenCalled();

     });

       it('should create', () => {
       const validate = component.cpfMask('111.111.111-11');
       fixture.detectChanges();
       expect(validate).toEqual('437.027.388-94');
     });

      it('should be invalid when string invalid', () => {
       const validate = component.cpfMask('111.111.111-11');
       expect(validate).toEqual({errorCpf: true});
    });

   });

The objective is to test the function and validate the cpf document


问:
Is there a way to type the elements of the dictionary that is returned by a serializer?
I use the serializers that come from django-rest-framework to validate many of the request on my app end. I have found thhat is very useful to get the objects on the serializer, but the dictionary the serializer returns with the serializer.validated_data is not typed

This is how I perform the validation:

On views.py

```<code> def post(self, request):
        body_serializer = ExampleSerializer(data=request.data)
        body_serializer.is_valid(raise_exception=True)
        body_data = body_serializer.validated_data

        # to get the object
        object_one = body_data['object_one']

</code>```

On the serializers.py

```<code>class ExampleSerializer(serializers.Serializer):

    field_one = serializers.CharField(required=True, help_text='field_one')
    field_two = serializers.CharField(required=True, help_text='field_two')
    field_three = serializers.CharField(required=True, help_text='field_three')

    def validate(self, attrs):
        object_one:ObjectOne = ObjectExample.objects.get(field=field_one)
        attrs['object_one'] = object_one

        return attrs
</code>```

Is there a way I can type the return dictionary?

Body:
I use the serializers that come from django-rest-framework to validate many of the request on my app end. I have found thhat is very useful to get the objects on the serializer, but the dictionary the serializer returns with the serializer.validated_data is not typed

This is how I perform the validation:

On views.py

 def post(self, request):
        body_serializer = ExampleSerializer(data=request.data)
        body_serializer.is_valid(raise_exception=True)
        body_data = body_serializer.validated_data

        # to get the object
        object_one = body_data['object_one']

On the serializers.py

class ExampleSerializer(serializers.Serializer):

    field_one = serializers.CharField(required=True, help_text='field_one')
    field_two = serializers.CharField(required=True, help_text='field_two')
    field_three = serializers.CharField(required=True, help_text='field_three')

    def validate(self, attrs):
        object_one:ObjectOne = ObjectExample.objects.get(field=field_one)
        attrs['object_one'] = object_one

        return attrs

Is there a way I can type the return dictionary?


问:
Why wherever i open some app, when the first display always no color?
I recently bought a iphone 14 pro, but wherever i open some app like taobao or 拼多多, at first display always no color like below photo, but if swipe to next page. The color return again. Any idea how to solve this issue??
I checked color filter, i didnt turn it on. My other app like youtube or gmail no color issue.
enter image description here

Any solution to share?


问:
How do I ensure that tslib, class-transformer, and @nestjs/platform-socket.io are included in my nx production build?
When I build my nestjs application with nx to ship it to elasticbeanstalk via pulumi, it does not include follwing packages in generated package.json

tslib

class-transformer

@nestjs/platform-socket.io

Is there a way to bundle them correctly or include in package.json?

Here is my project.json

{
  "name": "api",
  "$schema": "../../node_modules/nx/schemas/project-schema.json",
  "sourceRoot": "apps/api/src",
  "projectType": "application",
  "targets": {
    "build": {
      "executor": "@nrwl/webpack:webpack",
      "outputs": ["{options.outputPath}"],
      "options": {
        "target": "node",
        "compiler": "tsc",
        "outputPath": "dist/apps/api",
        "main": "apps/api/src/main.ts",
        "tsConfig": "apps/api/tsconfig.app.json",
        "assets": ["apps/api/src/assets"],
        "tsPlugins": [
          {
            "name": "@nestjs/swagger/plugin",
            "options": {
              "dtoFileNameSuffix": [".entity.ts", ".dto.ts"],
              "controllerFileNameSuffix": [".controller.ts"],
              "classValidatorShim": true,
              "dtoKeyOfComment": "description",
              "controllerKeyOfComment": "description",
              "introspectComments": true
            }
          }
        ],
        "generatePackageJson": true
      },
      "configurations": {
        "production": {
          "optimization": true,
          "extractLicenses": true,
          "inspect": false,
          "fileReplacements": [
            {
              "replace": "apps/api/src/environments/environment.ts",
              "with": "apps/api/src/environments/environment.prod.ts"
            }
          ]
        }
      }
    },
    "zip": {
      "executor": "nx:run-commands",
      "options": {
        "commands": [
          "echo 'web: node main.js' > Procfile",
          "cp -r ../../../libs/shared/prisma .",
          "cp -r ../../../apps/api/.platform .",
          "json -I -f package.json -e 'this.dependencies.tslib=\"^2.0.0\"' && zip -r ../api.zip ."
        ],
        "cwd": "dist/apps/api"
      }
    },

    "serve": {
      "executor": "@nrwl/js:node",
      "options": {
        "buildTarget": "api:build"
      },
      "configurations": {
        "production": {
          "buildTarget": "api:build:production"
        }
      }
    },
    "lint": {
      "executor": "@nrwl/linter:eslint",
      "outputs": ["{options.outputFile}"],
      "options": {
        "lintFilePatterns": ["apps/api/**/*.ts"]
      }
    },
    "test": {
      "executor": "@nrwl/jest:jest",
      "outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
      "options": {
        "jestConfig": "apps/api/jest.config.ts",
        "passWithNoTests": true
      }
    },
    "deploy": {
      "executor": "nx:run-commands",
      "options": {
        "commands": ["nx run api-infrastructure:up"]
      }
    }
  },
  "tags": []
}

```
<p>Here is my <strong>tsconfig.app.json</strong></p>
```{
  "extends": "./tsconfig.json",
  "compilerOptions": {
    "outDir": "../../dist/out-tsc",
    "module": "commonjs",
    "types": ["node", "express", "multer"],
    "emitDecoratorMetadata": true,
    "target": "es2015"
  },
  "exclude": ["jest.config.ts", "**/*.spec.ts", "**/*.test.ts"],
  "include": ["**/*.ts", "../../libs/shared/**/*.ts"]
}

```
<p>And here is my <strong>tsconfig.base.json</strong> (the one in the root)</p>
```
{
  "compileOnSave": false,
  "compilerOptions": {
    "rootDir": ".",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "importHelpers": true,
    "target": "es2015",
    "module": "esnext",
    "lib": ["es2017", "dom"],
    "skipLibCheck": true,
    "skipDefaultLibCheck": true,
    "baseUrl": ".",
    "paths": {
      "@epicode/aws-components": ["libs/aws-components/src/index.ts"],
      "@epicode/shared": ["libs/shared/src/index.ts"],
      "@epicode/shared-ui": ["libs/shared-ui/src/index.ts"],
      "@epicode/types": ["libs/types/src/index.ts"]
    }
  },
  "exclude": ["node_modules", "tmp"]
}
```
<p>I was expecting all dependencies would be bundled if I don't use <code>"generatePackageJson": true</code></p>
<p>Or If I use it they would show up in package.json.</p>
<p>My current workaround is  adding them  into main.ts file</p>
```import 'class-transformer';
import '@nestjs/platform-socket.io';
```

and to package.json
manually before zipping it and deploying it.

Body:
When I build my nestjs application with nx to ship it to elasticbeanstalk via pulumi, it does not include follwing packages in generated package.json

tslib

class-transformer

@nestjs/platform-socket.io

Is there a way to bundle them correctly or include in package.json?

Here is my project.json

{
  "name": "api",
  "$schema": "../../node_modules/nx/schemas/project-schema.json",
  "sourceRoot": "apps/api/src",
  "projectType": "application",
  "targets": {
    "build": {
      "executor": "@nrwl/webpack:webpack",
      "outputs": ["{options.outputPath}"],
      "options": {
        "target": "node",
        "compiler": "tsc",
        "outputPath": "dist/apps/api",
        "main": "apps/api/src/main.ts",
        "tsConfig": "apps/api/tsconfig.app.json",
        "assets": ["apps/api/src/assets"],
        "tsPlugins": [
          {
            "name": "@nestjs/swagger/plugin",
            "options": {
              "dtoFileNameSuffix": [".entity.ts", ".dto.ts"],
              "controllerFileNameSuffix": [".controller.ts"],
              "classValidatorShim": true,
              "dtoKeyOfComment": "description",
              "controllerKeyOfComment": "description",
              "introspectComments": true
            }
          }
        ],
        "generatePackageJson": true
      },
      "configurations": {
        "production": {
          "optimization": true,
          "extractLicenses": true,
          "inspect": false,
          "fileReplacements": [
            {
              "replace": "apps/api/src/environments/environment.ts",
              "with": "apps/api/src/environments/environment.prod.ts"
            }
          ]
        }
      }
    },
    "zip": {
      "executor": "nx:run-commands",
      "options": {
        "commands": [
          "echo 'web: node main.js' > Procfile",
          "cp -r ../../../libs/shared/prisma .",
          "cp -r ../../../apps/api/.platform .",
          "json -I -f package.json -e 'this.dependencies.tslib=\"^2.0.0\"' && zip -r ../api.zip ."
        ],
        "cwd": "dist/apps/api"
      }
    },

    "serve": {
      "executor": "@nrwl/js:node",
      "options": {
        "buildTarget": "api:build"
      },
      "configurations": {
        "production": {
          "buildTarget": "api:build:production"
        }
      }
    },
    "lint": {
      "executor": "@nrwl/linter:eslint",
      "outputs": ["{options.outputFile}"],
      "options": {
        "lintFilePatterns": ["apps/api/**/*.ts"]
      }
    },
    "test": {
      "executor": "@nrwl/jest:jest",
      "outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
      "options": {
        "jestConfig": "apps/api/jest.config.ts",
        "passWithNoTests": true
      }
    },
    "deploy": {
      "executor": "nx:run-commands",
      "options": {
        "commands": ["nx run api-infrastructure:up"]
      }
    }
  },
  "tags": []
}

Here is my tsconfig.app.json

{
  "extends": "./tsconfig.json",
  "compilerOptions": {
    "outDir": "../../dist/out-tsc",
    "module": "commonjs",
    "types": ["node", "express", "multer"],
    "emitDecoratorMetadata": true,
    "target": "es2015"
  },
  "exclude": ["jest.config.ts", "**/*.spec.ts", "**/*.test.ts"],
  "include": ["**/*.ts", "../../libs/shared/**/*.ts"]
}

And here is my tsconfig.base.json (the one in the root)

{
  "compileOnSave": false,
  "compilerOptions": {
    "rootDir": ".",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "importHelpers": true,
    "target": "es2015",
    "module": "esnext",
    "lib": ["es2017", "dom"],
    "skipLibCheck": true,
    "skipDefaultLibCheck": true,
    "baseUrl": ".",
    "paths": {
      "@epicode/aws-components": ["libs/aws-components/src/index.ts"],
      "@epicode/shared": ["libs/shared/src/index.ts"],
      "@epicode/shared-ui": ["libs/shared-ui/src/index.ts"],
      "@epicode/types": ["libs/types/src/index.ts"]
    }
  },
  "exclude": ["node_modules", "tmp"]
}

I was expecting all dependencies would be bundled if I don't use "generatePackageJson": true

Or If I use it they would show up in package.json.

My current workaround is  adding them  into main.ts file

import 'class-transformer';
import '@nestjs/platform-socket.io';

and to package.json
manually before zipping it and deploying it.