问:
Typescript error No overload matches this call with styled-components
I have a piece of code below that gives the following error

No overload matches this call.   Overload 1 of 2, '(component:
AnyStyledComponent): ThemedStyledFunction<any, any, any, any>', gave
the following error.
Argument of type 'typeof InlineSVG' is not assignable to parameter of type 'AnyStyledComponent'.
Type 'typeof InlineSVG' is not assignable to type 'StyledComponent<any, any, any, never>'.

```<code>import SVG from 'react-inlinesvg';
import styled from 'styled-components';
import { px } from 'styled-minimal';

import { Icons } from 'types';

interface Props {
  name: Icons;
  width?: number;
}

const IconWrapper = styled(SVG)`
  display: inline-block;
  line-height: 0;

  svg {
    height: auto;
    max-height: 100%;
    width: ${({ width }) => width};
  }
`;

function Icon({ name, width = 20 }: Props) {
  return (
    <IconWrapper
      height="100%"
      src={`${process.env.PUBLIC_URL}/media/icons/${name}.svg`}
      width={px(width)}
    />
  );
}

export default Icon;
</code>```

Cant we pass anything in the styled-components?

new to typescript but how do you guys find out what should we have here as I couldn't understand much from just the error message itself.

I know there is something wrong with the type assigned, but then how do i find what exactly should be type? Did a google but couldnt understand much

Body:
I have a piece of code below that gives the following error

No overload matches this call.   Overload 1 of 2, '(component:
AnyStyledComponent): ThemedStyledFunction<any, any, any, any>', gave
the following error.
Argument of type 'typeof InlineSVG' is not assignable to parameter of type 'AnyStyledComponent'.
Type 'typeof InlineSVG' is not assignable to type 'StyledComponent<any, any, any, never>'.

import SVG from 'react-inlinesvg';
import styled from 'styled-components';
import { px } from 'styled-minimal';

import { Icons } from 'types';

interface Props {
  name: Icons;
  width?: number;
}

const IconWrapper = styled(SVG)`
  display: inline-block;
  line-height: 0;

  svg {
    height: auto;
    max-height: 100%;
    width: ${({ width }) => width};
  }
`;

function Icon({ name, width = 20 }: Props) {
  return (
    <IconWrapper
      height="100%"
      src={`${process.env.PUBLIC_URL}/media/icons/${name}.svg`}
      width={px(width)}
    />
  );
}

export default Icon;

Cant we pass anything in the styled-components?

new to typescript but how do you guys find out what should we have here as I couldn't understand much from just the error message itself.

I know there is something wrong with the type assigned, but then how do i find what exactly should be type? Did a google but couldnt understand much


来源: stackexchange

问:
How to pass value from thymeleaf enum in JavaScript
I want to create a dropdown list, user have two option, based on his option show him appropriate form. So if user have Expense and Income element and select Expense show him form to populate expense while hide Income form. That so far looks like this:

Enum:

```<code>public enum TransactionType {

EXPENSE("Expense"),
INCOME("Income");

private final String displayName;

TransactionType(String displayName) {
    this.displayName = displayName;
}

public String getDisplayName() {
    return displayName;
}
}
</code>```

This is how I populate dropdown list with those two values:

```<code><select id="payment_type" name="payment_type" th:field="${transaction.transactionType}">
    <option
            th:each="transactionType : ${transactionType}"
            th:value="${transactionType}"
            th:text="${transactionType.displayName}"
    ></option>
</select>
</code>```

That works fine. Now I have form for example like this <form id="Expense"> and another <form id="Income">

And this is JavaScript:

```<code>$('#payment_type').on('change', function() {
var val = $(this).val();
$('#Expense').hide();
$('#Income').hide();
$('#' + val).show();
});
</code>```

I think my main problem is passing those ENUM variables into JavaScript, I found some tutorials how to do this but on that examples I'm manually setting value of elements in dropdown list like:

```<code><option value="Income">Income transaction</option>
</code>```

While as I show already, With ENUM is like this:

```<code>  <option
            th:each="transactionType : ${transactionType}"
            th:value="${transactionType}"
            th:text="${transactionType.displayName}"
    ></option>
</code>```

And that value from option is being passed in JavaScript, but here I don't know how to pass value from ENUM list inside JavaScript, so actually JS get user selected element and process what need to be done.

Any example or advice how to achieve this? I tried to find something but all answers are for as I said when I set value manually in <option value="">

ContentLicense: CC BY-SA 4.0

Body:
I want to create a dropdown list, user have two option, based on his option show him appropriate form. So if user have Expense and Income element and select Expense show him form to populate expense while hide Income form. That so far looks like this:

Enum:

public enum TransactionType {

EXPENSE("Expense"),
INCOME("Income");

private final String displayName;

TransactionType(String displayName) {
    this.displayName = displayName;
}

public String getDisplayName() {
    return displayName;
}
}

This is how I populate dropdown list with those two values:

<select id="payment_type" name="payment_type" th:field="${transaction.transactionType}">
    <option
            th:each="transactionType : ${transactionType}"
            th:value="${transactionType}"
            th:text="${transactionType.displayName}"
    ></option>
</select>

That works fine. Now I have form for example like this <form id="Expense"> and another <form id="Income">

And this is JavaScript:

$('#payment_type').on('change', function() {
var val = $(this).val();
$('#Expense').hide();
$('#Income').hide();
$('#' + val).show();
});

I think my main problem is passing those ENUM variables into JavaScript, I found some tutorials how to do this but on that examples I'm manually setting value of elements in dropdown list like:

<option value="Income">Income transaction</option>

While as I show already, With ENUM is like this:

  <option
            th:each="transactionType : ${transactionType}"
            th:value="${transactionType}"
            th:text="${transactionType.displayName}"
    ></option>

And that value from option is being passed in JavaScript, but here I don't know how to pass value from ENUM list inside JavaScript, so actually JS get user selected element and process what need to be done.

Any example or advice how to achieve this? I tried to find something but all answers are for as I said when I set value manually in <option value="">


问:
High-level, functional or object-oriented language or platform with isolation from OS
I'm searching for a language which gives some basic features like the most popular languages like Python, C#, JavaScript, so math operations, string manipulation, object access and transformations, serialization, but has something like isolated execution environment by default, so you cannot access OS layer directly or easily with the language.

If talking about mentioned - let's take C# - you can access OS with .NET Framework. JavaScript executed on Node - spawn function, Python - os.system or subprocess.call etc.

How about a language in which you cannot do this by default - we are not considering exploits here or other hacking approaches, just pure language, but maybe there is a special language in which it's hard to make some exploits by default.

The other option maybe there is a special platform for existing language which prevent OS access.


问:
How can I create multiple NextAuth user account types similiar to Upwork's Client/Freelancer accounts?
How can I create multiple NextAuth user account types similiar to Upwork's Client/Freelancer accounts?

I'm building a web application and I want a distinct separation between the type of account a user can create.

I'm starting with the a Prisma adaptation of the main NextAuth Schema (provided by NextAuth) and I want to authenticate with Google OAuth.

```<code>datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")
}

generator client {
  provider        = "prisma-client-js"
}

model Account {
  id                 String  @id @default(cuid())
  userId             String
  type               String
  provider           String
  providerAccountId  String
  refresh_token      String?  @db.Text
  access_token       String?  @db.Text
  expires_at         Int?
  token_type         String?
  scope              String?
  id_token           String?  @db.Text
  session_state      String?

  user User @relation(fields: [userId], references: [id], onDelete: Cascade)

  @@unique([provider, providerAccountId])
}

model Session {
  id           String   @id @default(cuid())
  sessionToken String   @unique
  userId       String
  expires      DateTime
  user         User     @relation(fields: [userId], references: [id], onDelete: Cascade)
}

model User {
  id            String    @id @default(cuid())
  name          String?
  email         String?   @unique
  emailVerified DateTime?
  image         String?
  accounts      Account[]
  sessions      Session[]
}

model VerificationToken {
  identifier String
  token      String   @unique
  expires    DateTime

  @@unique([identifier, token])
}
</code>```

In Upwork's setup you can create an account as a "Client", which let's you hire freelancers, or you can create an account as a "Freelancer", which lets you take gigs; both are under the same authentication provider but you can easily switch. The separation or the ability to create two types of accounts under the same Authentication details.

How do I edit the schema to support this?

Body:
How can I create multiple NextAuth user account types similiar to Upwork's Client/Freelancer accounts?

I'm building a web application and I want a distinct separation between the type of account a user can create.

I'm starting with the a Prisma adaptation of the main NextAuth Schema (provided by NextAuth) and I want to authenticate with Google OAuth.

datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")
}

generator client {
  provider        = "prisma-client-js"
}

model Account {
  id                 String  @id @default(cuid())
  userId             String
  type               String
  provider           String
  providerAccountId  String
  refresh_token      String?  @db.Text
  access_token       String?  @db.Text
  expires_at         Int?
  token_type         String?
  scope              String?
  id_token           String?  @db.Text
  session_state      String?

  user User @relation(fields: [userId], references: [id], onDelete: Cascade)

  @@unique([provider, providerAccountId])
}

model Session {
  id           String   @id @default(cuid())
  sessionToken String   @unique
  userId       String
  expires      DateTime
  user         User     @relation(fields: [userId], references: [id], onDelete: Cascade)
}

model User {
  id            String    @id @default(cuid())
  name          String?
  email         String?   @unique
  emailVerified DateTime?
  image         String?
  accounts      Account[]
  sessions      Session[]
}

model VerificationToken {
  identifier String
  token      String   @unique
  expires    DateTime

  @@unique([identifier, token])
}

In Upwork's setup you can create an account as a "Client", which let's you hire freelancers, or you can create an account as a "Freelancer", which lets you take gigs; both are under the same authentication provider but you can easily switch. The separation or the ability to create two types of accounts under the same Authentication details.

How do I edit the schema to support this?


问:
How can I send a list of videos from Node.js to React.js?
In my Node backend, I have an endpoint where I get a few videos from where I have them stored in Google Cloud, then return these videos as the response. Here is my code for that:

```<code>app.get("/getGalleryVideos", async (req, res) => {
  const [files] = await bucket.getFiles(bucketName, { prefix: req.query.user });
  const fileNames = files.map((file) => file.name);

  const sumFiles = [];
  for (let i = 0; i < fileNames.length; i++) {
    await bucket
      .file(fileNames[i])
      .download()
      .then((data) => {
        sumFiles.push(data);
      });
  }
  res.json(sumFiles);
});
</code>```

Then when I receive these videos as the response in the React frontend, I want to convert them into a format that they can be used as the source for HTML video tags. For now I am just trying to get one video to work so when I receive the response as a list, I just take the first item and work with that. Here is my code for that:

```<code>function getGalleryVideos() {
    var user = "undefined";
    if (typeof Cookies.get("loggedInUser") != "undefined") {
      user = Cookies.get("loggedInUser");
    }
    axios({
      method: "get",
      url: `http://localhost:3001/getGalleryVideos`,
      params: {
        user: user,
      },
      timeout: 100000,
    }).then((res) => {
      console.log("res");
      console.log(res);
      console.log("res.data");
      console.log(res.data);
      console.log("res.data[1]");
      console.log(res.data[1]);
      console.log("res.data[1][0]");
      console.log(res.data[1][0]);
      console.log("res.data[1][0].data");
      console.log(res.data[1][0].data);

      const vid = new Blob(res.data[1][0].data, { type: "video/mp4" });

      console.log("vid");
      console.log(vid);
      console.log("url");
      console.log(URL.createObjectURL(vid));
      setVideo(URL.createObjectURL(vid));
    });
  }
</code>```

Now this is what I receive in the React frontend console when I make this request:

But if I navigate to the URL that I printed in the console, the video isn't there:

Now I'm not sure why this is happening, but one thing I have noticed is my prints in the console show that the size of the buffer before I convert it to a blob, is 773491 and then after I convert it, it is 1987122 which seems quite far off.

Please help explain how I can fix this, or provide a different way I can send these videos over so that I can display them.

Body:
In my Node backend, I have an endpoint where I get a few videos from where I have them stored in Google Cloud, then return these videos as the response. Here is my code for that:

app.get("/getGalleryVideos", async (req, res) => {
  const [files] = await bucket.getFiles(bucketName, { prefix: req.query.user });
  const fileNames = files.map((file) => file.name);

  const sumFiles = [];
  for (let i = 0; i < fileNames.length; i++) {
    await bucket
      .file(fileNames[i])
      .download()
      .then((data) => {
        sumFiles.push(data);
      });
  }
  res.json(sumFiles);
});

Then when I receive these videos as the response in the React frontend, I want to convert them into a format that they can be used as the source for HTML video tags. For now I am just trying to get one video to work so when I receive the response as a list, I just take the first item and work with that. Here is my code for that:

function getGalleryVideos() {
    var user = "undefined";
    if (typeof Cookies.get("loggedInUser") != "undefined") {
      user = Cookies.get("loggedInUser");
    }
    axios({
      method: "get",
      url: `http://localhost:3001/getGalleryVideos`,
      params: {
        user: user,
      },
      timeout: 100000,
    }).then((res) => {
      console.log("res");
      console.log(res);
      console.log("res.data");
      console.log(res.data);
      console.log("res.data[1]");
      console.log(res.data[1]);
      console.log("res.data[1][0]");
      console.log(res.data[1][0]);
      console.log("res.data[1][0].data");
      console.log(res.data[1][0].data);

      const vid = new Blob(res.data[1][0].data, { type: "video/mp4" });

      console.log("vid");
      console.log(vid);
      console.log("url");
      console.log(URL.createObjectURL(vid));
      setVideo(URL.createObjectURL(vid));
    });
  }

Now this is what I receive in the React frontend console when I make this request:

But if I navigate to the URL that I printed in the console, the video isn't there:

Now I'm not sure why this is happening, but one thing I have noticed is my prints in the console show that the size of the buffer before I convert it to a blob, is 773491 and then after I convert it, it is 1987122 which seems quite far off.

Please help explain how I can fix this, or provide a different way I can send these videos over so that I can display them.


问:
Error while checking for service account using Lookup Function
{{- if not (lookup "v1" "ServiceAccount" "{{.Release.Namespace}}" "{{ .Release.preinstall }}" ) }}
<< another service account >>
{{- end }}

While using lookup function for checking that if service account is already present it will not create another service account with same functionality as earlier they were created simultaneously but even after using the lookup function they are created simultaneously and if using the index function or providing the name as a variable $namespace:= {{.Release.Namespace}} and $service:= {{ .Release.preinstall"}}) } it is giving the error as nil pointer.

Can anyone please help with the use of lookup function and what is the error in using it


问:
What causes strange FolderClosedException on fetching mail via IMAP and how to resolve it?
Fetching some (not all) mails in a folder, I encounter strange FolderClosedException after almost excactly two minutes. It looks like the connection freezes after calling MimeBodyPart::getContent. I suppose it is thrown because of some timeout on the server side.

The affected mails are automatically forwarded from an Office365 mailbox to this IMAP server and have the same MIME structure. I can not tell what server this is.

My runtime is a JakartaEE 8 web app hosted in WildFly 17.0.1.Final running with JRE 11.0.7+10.

No special code. It just loops through all mails in the folder, checks flags and subject, processes MIME structure and downloads relevant attachments.

try (Store store = session.getStore();) {
    store.connect(user, password);
    Folder folder = store.getFolder(folderName);
    ...
    folder.open(Folder.READ_WRITE);
    try {
        for (Message message : folder.getMessages()) {
            if (message.isSet(Flags.Flag.SEEN)) {
                continue;
            }
            message.getSubject();
            ...
            Object content = message.getContent();
            if (content instanceof Multipart) {
                ...
                Multipart multipart = (Multipart) content;
                for (int index = 0; index < multipart.getCount(); ++index) {
                    ...
                    Object partContent = multipart.getBodyPart(index).getContent();
                }
            }
        }
    } finally {
        folder.close(false);
    }
}
```
<pre class="lang-shell prettyprint-override"><code>2023-01-02 14:15:10,079 INFO  [stdout] (EJB default - 8) DEBUG: JavaMail version 1.6.2
2023-01-02 14:15:10,079 INFO  [stdout] (EJB default - 8) DEBUG: successfully loaded resource: /META-INF/javamail.default.address.map
2023-01-02 14:15:10,079 INFO  [stdout] (EJB default - 8) DEBUG: getProvider() returning javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Oracle]
2023-01-02 14:15:10,079 INFO  [stdout] (EJB default - 8) DEBUG IMAPS: mail.imap.fetchsize: 16384
2023-01-02 14:15:10,079 INFO  [stdout] (EJB default - 8) DEBUG IMAPS: mail.imap.ignorebodystructuresize: false
2023-01-02 14:15:10,079 INFO  [stdout] (EJB default - 8) DEBUG IMAPS: mail.imap.statuscachetimeout: 1000
2023-01-02 14:15:10,079 INFO  [stdout] (EJB default - 8) DEBUG IMAPS: mail.imap.appendbuffersize: -1
2023-01-02 14:15:10,079 INFO  [stdout] (EJB default - 8) DEBUG IMAPS: mail.imap.minidletime: 10
2023-01-02 14:15:10,079 INFO  [stdout] (EJB default - 8) DEBUG IMAPS: closeFoldersOnStoreFailure
2023-01-02 14:15:10,079 INFO  [stdout] (EJB default - 8) DEBUG IMAPS: trying to connect to host "XXX", port 993, isSSL true
2023-01-02 14:15:10,220 INFO  [stdout] (EJB default - 8) * OK [CAPABILITY IMAP4rev1 CHILDREN ENABLE ID IDLE LIST-EXTENDED LIST-STATUS LITERAL- MOVE NAMESPACE QUOTA SASL-IR SORT SPECIAL-USE THREAD=ORDEREDSUBJECT UIDPLUS UNSELECT WITHIN AUTH=LOGIN AUTH=PLAIN] IMAP server ready XXX
2023-01-02 14:15:10,220 INFO  [stdout] (EJB default - 8) DEBUG IMAPS: AUTH: LOGIN
2023-01-02 14:15:10,220 INFO  [stdout] (EJB default - 8) DEBUG IMAPS: AUTH: PLAIN
2023-01-02 14:15:10,220 INFO  [stdout] (EJB default - 8) DEBUG IMAPS: protocolConnect login, host=XXX, user=XXX, password=<non-null>
2023-01-02 14:15:10,220 INFO  [stdout] (EJB default - 8) DEBUG IMAPS: AUTHENTICATE PLAIN command trace suppressed
2023-01-02 14:15:10,298 INFO  [stdout] (EJB default - 8) DEBUG IMAPS: AUTHENTICATE PLAIN command result: BJF0 OK AUTHENTICATE completed
2023-01-02 14:15:10,298 INFO  [stdout] (EJB default - 8) BJF1 CAPABILITY
2023-01-02 14:15:10,314 INFO  [stdout] (EJB default - 8) * CAPABILITY IMAP4rev1 CHILDREN ENABLE ID IDLE LIST-EXTENDED LIST-STATUS LITERAL- MOVE NAMESPACE QUOTA SASL-IR SORT SPECIAL-USE THREAD=ORDEREDSUBJECT UIDPLUS UNSELECT WITHIN APPENDLIMIT=140000000
2023-01-02 14:15:10,376 INFO  [stdout] (EJB default - 8) * CAPABILITY IMAP4rev1 CHILDREN ENABLE ID IDLE LIST-EXTENDED LIST-STATUS LITERAL- MOVE NAMESPACE QUOTA SASL-IR SORT SPECIAL-USE THREAD=ORDEREDSUBJECT UIDPLUS UNSELECT WITHIN APPENDLIMIT=140000000
2023-01-02 14:15:10,376 INFO  [stdout] (EJB default - 8) BJF1 OK CAPABILITY completed
2023-01-02 14:15:10,376 INFO  [stdout] (EJB default - 8) DEBUG IMAPS: connection available -- size: 1
2023-01-02 14:15:10,376 INFO  [stdout] (EJB default - 8) BJF2 SELECT INBOX
2023-01-02 14:15:10,392 INFO  [stdout] (EJB default - 8) * 45 EXISTS
2023-01-02 14:15:10,392 INFO  [stdout] (EJB default - 8) * 1 RECENT
2023-01-02 14:15:10,392 INFO  [stdout] (EJB default - 8) * FLAGS (\Answered \Flagged \Deleted \Seen \Draft $Forwarded)
2023-01-02 14:15:10,392 INFO  [stdout] (EJB default - 8) * OK [PERMANENTFLAGS (\Answered \Flagged \Draft \Deleted \Seen $Forwarded \*)] Unlimited
2023-01-02 14:15:10,392 INFO  [stdout] (EJB default - 8) * OK [UNSEEN 45] Message 45 is first unseen
2023-01-02 14:15:10,392 INFO  [stdout] (EJB default - 8) * OK [UIDNEXT 50] Predicted next UID
2023-01-02 14:15:10,392 INFO  [stdout] (EJB default - 8) * OK [UIDVALIDITY 1667372338] UIDs valid
2023-01-02 14:15:10,392 INFO  [stdout] (EJB default - 8) BJF2 OK [READ-WRITE] SELECT completed
2023-01-02 14:15:10,392 INFO  [stdout] (EJB default - 8) BJF3 FETCH 1 (FLAGS)
2023-01-02 14:15:10,408 INFO  [stdout] (EJB default - 8) * 1 FETCH (FLAGS (\Seen))
2023-01-02 14:15:10,408 INFO  [stdout] (EJB default - 8) BJF3 OK FETCH completed
.
.
.
2023-01-02 14:15:11,236 INFO  [stdout] (EJB default - 8) BJF47 FETCH 45 (FLAGS)
2023-01-02 14:15:11,251 INFO  [stdout] (EJB default - 8) * 45 FETCH (FLAGS (\Recent))
2023-01-02 14:15:11,251 INFO  [stdout] (EJB default - 8) BJF47 OK FETCH completed
2023-01-02 14:15:11,251 INFO  [stdout] (EJB default - 8) BJF48 FETCH 45 (ENVELOPE INTERNALDATE RFC822.SIZE)
2023-01-02 14:15:11,329 INFO  [stdout] (EJB default - 8) * 45 FETCH (RFC822.SIZE 12511 INTERNALDATE "02-Jan-2023 13:12:56 +0000" ENVELOPE ("Mon, 2 Jan 2023 14:12:51 +0100 (CET)" {102}
2023-01-02 14:15:11,329 INFO  [stdout] (EJB default - 8) =?UTF-8?Q?XXX?=
2023-01-02 14:15:11,329 INFO  [stdout] (EJB default - 8)  =?UTF-8?Q?XXX?= ((NIL NIL "XXX" "XXX")) ((NIL NIL "XXX" "XXX")) ((NIL NIL "XXX" "XXX")) ((NIL NIL "XXX" "XXX")(NIL NIL "XXX" "XXX")) ((NIL NIL "XXX" "XXX")(NIL NIL "XXX" "XXX")) NIL NIL "XXX"))
2023-01-02 14:15:11,392 INFO  [stdout] (EJB default - 8) BJF48 OK FETCH completed
2023-01-02 14:15:11,392 INFO  [stdout] (EJB default - 8) BJF49 FETCH 45 (BODYSTRUCTURE)
2023-01-02 14:15:11,408 INFO  [stdout] (EJB default - 8) * 45 FETCH (BODYSTRUCTURE (("TEXT" "plain" ("charset" "us-ascii") NIL NIL "7BIT" 87 1 NIL NIL NIL NIL)("APPLICATION" "octet-stream" ("name*" "UTF-8''XXX") NIL NIL "BASE64" 2524 NIL ("attachment" ("filename*" "UTF-8''XXX")) NIL NIL) "mixed" ("boundary" "----=_Part_6_175725035.1672665171185") NIL NIL NIL))
2023-01-02 14:15:11,470 INFO  [stdout] (EJB default - 8) BJF49 OK FETCH completed
2023-01-02 14:15:11,470 INFO  [stdout] (EJB default - 8) BJF50 FETCH 45 (BODY[1]<0.87>)
2023-01-02 14:17:11,664 ERROR [stderr] (EJB default - 8) javax.mail.FolderClosedException
2023-01-02 14:17:11,664 ERROR [stderr] (EJB default - 8)    at javax.mail.api@1.6.2//javax.mail.internet.MimeBodyPart.getContent(MimeBodyPart.java:685)
.
.
.
2023-01-02 14:17:11,696 ERROR [stderr] (EJB default - 8)    at org.jboss.threads@2.3.3.Final//org.jboss.threads.JBossThread.run(JBossThread.java:485)
2023-01-02 14:17:11,696 INFO  [stdout] (EJB default - 8) DEBUG IMAPS: IMAPStore cleanup, force false
2023-01-02 14:17:11,696 INFO  [stdout] (EJB default - 8) DEBUG IMAPS: IMAPStore cleanup done
</code>```

Setting mail.imaps.partialfetch=false the problem persists but yields a little different ouput with some message.

2023-01-05 17:15:11,663 INFO  [stdout] (EJB default - 6) BUU52 FETCH 47 (BODY[1])
2023-01-05 17:17:11,859 ERROR [stderr] (EJB default - 6) javax.mail.FolderClosedException: * BYE JavaMail Exception: java.io.IOException: Connection dropped by server?
2023-01-05 17:17:11,874 ERROR [stderr] (EJB default - 6)    at javax.mail.api@1.6.2//javax.mail.internet.MimeBodyPart.getContent(MimeBodyPart.java:685)
```

This tightens my assumption with the timeout on the server side. The question is: What is causing the freeze and how to resolve it? Any hints or suggestions to inspect this in more detail are welcome.

Body:
Fetching some (not all) mails in a folder, I encounter strange FolderClosedException after almost excactly two minutes. It looks like the connection freezes after calling MimeBodyPart::getContent. I suppose it is thrown because of some timeout on the server side.

The affected mails are automatically forwarded from an Office365 mailbox to this IMAP server and have the same MIME structure. I can not tell what server this is.

My runtime is a JakartaEE 8 web app hosted in WildFly 17.0.1.Final running with JRE 11.0.7+10.

No special code. It just loops through all mails in the folder, checks flags and subject, processes MIME structure and downloads relevant attachments.

try (Store store = session.getStore();) {
    store.connect(user, password);
    Folder folder = store.getFolder(folderName);
    ...
    folder.open(Folder.READ_WRITE);
    try {
        for (Message message : folder.getMessages()) {
            if (message.isSet(Flags.Flag.SEEN)) {
                continue;
            }
            message.getSubject();
            ...
            Object content = message.getContent();
            if (content instanceof Multipart) {
                ...
                Multipart multipart = (Multipart) content;
                for (int index = 0; index < multipart.getCount(); ++index) {
                    ...
                    Object partContent = multipart.getBodyPart(index).getContent();
                }
            }
        }
    } finally {
        folder.close(false);
    }
}

2023-01-02 14:15:10,079 INFO  [stdout] (EJB default - 8) DEBUG: JavaMail version 1.6.2
2023-01-02 14:15:10,079 INFO  [stdout] (EJB default - 8) DEBUG: successfully loaded resource: /META-INF/javamail.default.address.map
2023-01-02 14:15:10,079 INFO  [stdout] (EJB default - 8) DEBUG: getProvider() returning javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Oracle]
2023-01-02 14:15:10,079 INFO  [stdout] (EJB default - 8) DEBUG IMAPS: mail.imap.fetchsize: 16384
2023-01-02 14:15:10,079 INFO  [stdout] (EJB default - 8) DEBUG IMAPS: mail.imap.ignorebodystructuresize: false
2023-01-02 14:15:10,079 INFO  [stdout] (EJB default - 8) DEBUG IMAPS: mail.imap.statuscachetimeout: 1000
2023-01-02 14:15:10,079 INFO  [stdout] (EJB default - 8) DEBUG IMAPS: mail.imap.appendbuffersize: -1
2023-01-02 14:15:10,079 INFO  [stdout] (EJB default - 8) DEBUG IMAPS: mail.imap.minidletime: 10
2023-01-02 14:15:10,079 INFO  [stdout] (EJB default - 8) DEBUG IMAPS: closeFoldersOnStoreFailure
2023-01-02 14:15:10,079 INFO  [stdout] (EJB default - 8) DEBUG IMAPS: trying to connect to host "XXX", port 993, isSSL true
2023-01-02 14:15:10,220 INFO  [stdout] (EJB default - 8) * OK [CAPABILITY IMAP4rev1 CHILDREN ENABLE ID IDLE LIST-EXTENDED LIST-STATUS LITERAL- MOVE NAMESPACE QUOTA SASL-IR SORT SPECIAL-USE THREAD=ORDEREDSUBJECT UIDPLUS UNSELECT WITHIN AUTH=LOGIN AUTH=PLAIN] IMAP server ready XXX
2023-01-02 14:15:10,220 INFO  [stdout] (EJB default - 8) DEBUG IMAPS: AUTH: LOGIN
2023-01-02 14:15:10,220 INFO  [stdout] (EJB default - 8) DEBUG IMAPS: AUTH: PLAIN
2023-01-02 14:15:10,220 INFO  [stdout] (EJB default - 8) DEBUG IMAPS: protocolConnect login, host=XXX, user=XXX, password=<non-null>
2023-01-02 14:15:10,220 INFO  [stdout] (EJB default - 8) DEBUG IMAPS: AUTHENTICATE PLAIN command trace suppressed
2023-01-02 14:15:10,298 INFO  [stdout] (EJB default - 8) DEBUG IMAPS: AUTHENTICATE PLAIN command result: BJF0 OK AUTHENTICATE completed
2023-01-02 14:15:10,298 INFO  [stdout] (EJB default - 8) BJF1 CAPABILITY
2023-01-02 14:15:10,314 INFO  [stdout] (EJB default - 8) * CAPABILITY IMAP4rev1 CHILDREN ENABLE ID IDLE LIST-EXTENDED LIST-STATUS LITERAL- MOVE NAMESPACE QUOTA SASL-IR SORT SPECIAL-USE THREAD=ORDEREDSUBJECT UIDPLUS UNSELECT WITHIN APPENDLIMIT=140000000
2023-01-02 14:15:10,376 INFO  [stdout] (EJB default - 8) * CAPABILITY IMAP4rev1 CHILDREN ENABLE ID IDLE LIST-EXTENDED LIST-STATUS LITERAL- MOVE NAMESPACE QUOTA SASL-IR SORT SPECIAL-USE THREAD=ORDEREDSUBJECT UIDPLUS UNSELECT WITHIN APPENDLIMIT=140000000
2023-01-02 14:15:10,376 INFO  [stdout] (EJB default - 8) BJF1 OK CAPABILITY completed
2023-01-02 14:15:10,376 INFO  [stdout] (EJB default - 8) DEBUG IMAPS: connection available -- size: 1
2023-01-02 14:15:10,376 INFO  [stdout] (EJB default - 8) BJF2 SELECT INBOX
2023-01-02 14:15:10,392 INFO  [stdout] (EJB default - 8) * 45 EXISTS
2023-01-02 14:15:10,392 INFO  [stdout] (EJB default - 8) * 1 RECENT
2023-01-02 14:15:10,392 INFO  [stdout] (EJB default - 8) * FLAGS (\Answered \Flagged \Deleted \Seen \Draft $Forwarded)
2023-01-02 14:15:10,392 INFO  [stdout] (EJB default - 8) * OK [PERMANENTFLAGS (\Answered \Flagged \Draft \Deleted \Seen $Forwarded \*)] Unlimited
2023-01-02 14:15:10,392 INFO  [stdout] (EJB default - 8) * OK [UNSEEN 45] Message 45 is first unseen
2023-01-02 14:15:10,392 INFO  [stdout] (EJB default - 8) * OK [UIDNEXT 50] Predicted next UID
2023-01-02 14:15:10,392 INFO  [stdout] (EJB default - 8) * OK [UIDVALIDITY 1667372338] UIDs valid
2023-01-02 14:15:10,392 INFO  [stdout] (EJB default - 8) BJF2 OK [READ-WRITE] SELECT completed
2023-01-02 14:15:10,392 INFO  [stdout] (EJB default - 8) BJF3 FETCH 1 (FLAGS)
2023-01-02 14:15:10,408 INFO  [stdout] (EJB default - 8) * 1 FETCH (FLAGS (\Seen))
2023-01-02 14:15:10,408 INFO  [stdout] (EJB default - 8) BJF3 OK FETCH completed
.
.
.
2023-01-02 14:15:11,236 INFO  [stdout] (EJB default - 8) BJF47 FETCH 45 (FLAGS)
2023-01-02 14:15:11,251 INFO  [stdout] (EJB default - 8) * 45 FETCH (FLAGS (\Recent))
2023-01-02 14:15:11,251 INFO  [stdout] (EJB default - 8) BJF47 OK FETCH completed
2023-01-02 14:15:11,251 INFO  [stdout] (EJB default - 8) BJF48 FETCH 45 (ENVELOPE INTERNALDATE RFC822.SIZE)
2023-01-02 14:15:11,329 INFO  [stdout] (EJB default - 8) * 45 FETCH (RFC822.SIZE 12511 INTERNALDATE "02-Jan-2023 13:12:56 +0000" ENVELOPE ("Mon, 2 Jan 2023 14:12:51 +0100 (CET)" {102}
2023-01-02 14:15:11,329 INFO  [stdout] (EJB default - 8) =?UTF-8?Q?XXX?=
2023-01-02 14:15:11,329 INFO  [stdout] (EJB default - 8)  =?UTF-8?Q?XXX?= ((NIL NIL "XXX" "XXX")) ((NIL NIL "XXX" "XXX")) ((NIL NIL "XXX" "XXX")) ((NIL NIL "XXX" "XXX")(NIL NIL "XXX" "XXX")) ((NIL NIL "XXX" "XXX")(NIL NIL "XXX" "XXX")) NIL NIL "XXX"))
2023-01-02 14:15:11,392 INFO  [stdout] (EJB default - 8) BJF48 OK FETCH completed
2023-01-02 14:15:11,392 INFO  [stdout] (EJB default - 8) BJF49 FETCH 45 (BODYSTRUCTURE)
2023-01-02 14:15:11,408 INFO  [stdout] (EJB default - 8) * 45 FETCH (BODYSTRUCTURE (("TEXT" "plain" ("charset" "us-ascii") NIL NIL "7BIT" 87 1 NIL NIL NIL NIL)("APPLICATION" "octet-stream" ("name*" "UTF-8''XXX") NIL NIL "BASE64" 2524 NIL ("attachment" ("filename*" "UTF-8''XXX")) NIL NIL) "mixed" ("boundary" "----=_Part_6_175725035.1672665171185") NIL NIL NIL))
2023-01-02 14:15:11,470 INFO  [stdout] (EJB default - 8) BJF49 OK FETCH completed
2023-01-02 14:15:11,470 INFO  [stdout] (EJB default - 8) BJF50 FETCH 45 (BODY[1]<0.87>)
2023-01-02 14:17:11,664 ERROR [stderr] (EJB default - 8) javax.mail.FolderClosedException
2023-01-02 14:17:11,664 ERROR [stderr] (EJB default - 8)    at javax.mail.api@1.6.2//javax.mail.internet.MimeBodyPart.getContent(MimeBodyPart.java:685)
.
.
.
2023-01-02 14:17:11,696 ERROR [stderr] (EJB default - 8)    at org.jboss.threads@2.3.3.Final//org.jboss.threads.JBossThread.run(JBossThread.java:485)
2023-01-02 14:17:11,696 INFO  [stdout] (EJB default - 8) DEBUG IMAPS: IMAPStore cleanup, force false
2023-01-02 14:17:11,696 INFO  [stdout] (EJB default - 8) DEBUG IMAPS: IMAPStore cleanup done

Setting mail.imaps.partialfetch=false the problem persists but yields a little different ouput with some message.

2023-01-05 17:15:11,663 INFO  [stdout] (EJB default - 6) BUU52 FETCH 47 (BODY[1])
2023-01-05 17:17:11,859 ERROR [stderr] (EJB default - 6) javax.mail.FolderClosedException: * BYE JavaMail Exception: java.io.IOException: Connection dropped by server?
2023-01-05 17:17:11,874 ERROR [stderr] (EJB default - 6)    at javax.mail.api@1.6.2//javax.mail.internet.MimeBodyPart.getContent(MimeBodyPart.java:685)

This tightens my assumption with the timeout on the server side. The question is: What is causing the freeze and how to resolve it? Any hints or suggestions to inspect this in more detail are welcome.


问:
Magento 1.9 / OpenMage: Built In Mechanismm To Pre-select Bundle or Configurable Product Options
After reading this thread which appears to be discussing adding configured bundle products to the cart (using URL params), I remembered one of my clients asking me recently if it was possible for their sales associates to send clients a link (via email for example) to a bundle product that's preconfigured.

The use case is that a client could be on the phone asking about a specific bundle or configurable product. When the sales associate sends a link, they then have to confusingly explain to the client that they need to select some options.

What would be better is if the sales associate could send a link with preconfigured bundle (and or configurable) options preselected using URL parameters.

I'm a developer and so I'm happy to write something. But has anything like this been done before? Perhaps an old 1/2 finished extension or any pointers to save some time?


问:
Button to add new build not available in appstore
After many searches I did not find a solution to the matter.

I'm publishing an app developed in flutter on the appstore. After loading in xcode the compilation is not available in appstoreconnect.
This is happening for new builds.

I started trying in December and so far I haven't found a solution.

Below the appstoreconnect image without the button for new compilation available.


问:
What is the recommended best practice for managing airflow logs?
We started to implement Airflow for task scheduling about a year ago, and we are slowly migrating more and more tasks to Airflow. At some point we noticed that the server was filling up with logs, even after we implemented remote logging to S3. I'm trying to understand what the best way to handle logs is, and I've found a lot of conflicting advice, such as in this stackoverflow question from 4 years ago.

Implementing maintenance dags to clean out logs (airflow-maintenance-dags)

Implementing our own FileTaskHandler

Using the logrotate linux utility

When we implemented remote logging, we expected the local logs to be removed after they were shipped to S3, but this is not the case. Local logs remain on the server. I thought this might be a problem with our configuration but I haven't found any way to fix that. Also, remote logging only applies to task logs, but process logs (specifically scheduler logs) are always local, and they took up the most space.

We tried to implement maintenance dags, but our workers are running from a different location to the rest of airflow, particularly the scheduler, so only task logs were getting cleaned. We could get around this by creating a new worker that shares logs with the scheduler, but we prefer not to create extra workers.

We haven't tried to implement either of the other two suggestions yet. But that is why I want to understand, how are other people solving this, and what is the recommended way?


问:
How to make event listener run asynchronously in events module of Node without using setImmediate() or process.nextTick()?
In my API I want to execute long running function call in background and I dont want to use any task queue like RabbitMQ.

I am trying to run long running function using events module of Node. But EventEmitter calls all listeners synchronously in the order in which they were registered. This ensures the proper sequencing of events and helps avoid race conditions and logic errors.EventEmitter calls all listeners synchronously in the order in which they were registered. This ensures the proper sequencing of events and helps avoid race conditions and logic errors.

const express = require('express')
var events = require('events');

var eventEmitter = new events.EventEmitter();

eventEmitter.on('scream', ()=>{
    setImmediate(longRunningFunction)
});

const app = express()
const port = 3000

function longRunningFunction() {
    let count = 0
    for (let i=0; i<1000000000; i++) {
        count++
    }
    console.log('done')
    return count
}

app.get('/', (req, res) => {
  let start = Date.now()
  eventEmitter.emit('scream');
  let end = Date.now()
  res.send(`Hello World!: ${end-start}`)
})

app.listen(port, () => {
  console.log(`Example app listening on port ${port}`)
})
```

How to make event listener run asynchronously in events module of Node without using setImmediate() or process.nextTick() ?

Body:
In my API I want to execute long running function call in background and I dont want to use any task queue like RabbitMQ.

I am trying to run long running function using events module of Node. But EventEmitter calls all listeners synchronously in the order in which they were registered. This ensures the proper sequencing of events and helps avoid race conditions and logic errors.EventEmitter calls all listeners synchronously in the order in which they were registered. This ensures the proper sequencing of events and helps avoid race conditions and logic errors.

const express = require('express')
var events = require('events');

var eventEmitter = new events.EventEmitter();

eventEmitter.on('scream', ()=>{
    setImmediate(longRunningFunction)
});

const app = express()
const port = 3000

function longRunningFunction() {
    let count = 0
    for (let i=0; i<1000000000; i++) {
        count++
    }
    console.log('done')
    return count
}

app.get('/', (req, res) => {
  let start = Date.now()
  eventEmitter.emit('scream');
  let end = Date.now()
  res.send(`Hello World!: ${end-start}`)
})

app.listen(port, () => {
  console.log(`Example app listening on port ${port}`)
})

How to make event listener run asynchronously in events module of Node without using setImmediate() or process.nextTick() ?


问:
Create hierarchy table/dataframe in Spark or SQL
I have the following dataframe that contains all the data I need.
The thing is, each child can be found in the parent column with their own children

1000584 is Top level

4003773 is Level 1

1252665 is Level 2

*1321212 is Level 3

What I want to achieve is this:


问:
How to format or convert numbers in DataGridView and Report so that the output results are the same in vb.net
Dear All Master,

How to format or convert numbers in DataGridView and Report so that the output results are the same in vb.net.
if I set the Alignment loop to MiddleCenter then the output report format number does not change then I change it to alignment to middleright so that it changes the output format in the report. There may be other solutions so that I can format or convert datagridview perfectly.

Thanks

```<code>Desired Result in datagridview and report
Prop1        Prop2
1         120,000.00
2         130,000.00
3              22.50
</code>```

before click button preview in form

after click button preview in form

result preview report

```<code>Public Class Form1
    Private Sub fillDataGridView1()
        Dim list As New List(Of Data)()
        list.Add(New Data With {
          .Prop1 = 1,
          .Prop2 = 120000
      })
        list.Add(New Data With {
          .Prop1 = 2,
          .Prop2 = 130000
      })
        list.Add(New Data With {
          .Prop1 = 3,
          .Prop2 = 22.5
      })

        DataGridView1.Columns.Add("Prop1", "Prop1")
        DataGridView1.Columns("Prop1").DataPropertyName = "Prop1"
        DataGridView1.Columns.Add("Prop2", "Prop2")
        DataGridView1.Columns("Prop2").DataPropertyName = "Prop2"
        DataGridView1.Columns("Prop2").HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
        DataGridView1.Columns("Prop2").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
        DataGridView1.Columns("Prop2").DefaultCellStyle.Format = "N2"
        DataGridView1.DataSource = list
    End Sub

    Private Class Data
        Public Property Prop1() As Integer
        Public Property Prop2() As Double
    End Class

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        KtReport1.Clear()
        For Each c As DataGridViewColumn In DataGridView1.Columns
            If c.ValueType Is GetType(Double) Then
                c.DefaultCellStyle.Format = "N2"
                c.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight
            End If
        Next c
        KtReport1.AddDatagridView(DataGridView1)
        KtReport1.ShowPrintPreviewDialog()
    End Sub
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        fillDataGridView1()
    End Sub

End Class
</code>```

REPORT AFTER CHANGE TO N2

Body:
Dear All Master,

How to format or convert numbers in DataGridView and Report so that the output results are the same in vb.net.
if I set the Alignment loop to MiddleCenter then the output report format number does not change then I change it to alignment to middleright so that it changes the output format in the report. There may be other solutions so that I can format or convert datagridview perfectly.

Thanks

Desired Result in datagridview and report
Prop1        Prop2
1         120,000.00
2         130,000.00
3              22.50

before click button preview in form

after click button preview in form

result preview report

Public Class Form1
    Private Sub fillDataGridView1()
        Dim list As New List(Of Data)()
        list.Add(New Data With {
          .Prop1 = 1,
          .Prop2 = 120000
      })
        list.Add(New Data With {
          .Prop1 = 2,
          .Prop2 = 130000
      })
        list.Add(New Data With {
          .Prop1 = 3,
          .Prop2 = 22.5
      })

        DataGridView1.Columns.Add("Prop1", "Prop1")
        DataGridView1.Columns("Prop1").DataPropertyName = "Prop1"
        DataGridView1.Columns.Add("Prop2", "Prop2")
        DataGridView1.Columns("Prop2").DataPropertyName = "Prop2"
        DataGridView1.Columns("Prop2").HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
        DataGridView1.Columns("Prop2").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
        DataGridView1.Columns("Prop2").DefaultCellStyle.Format = "N2"
        DataGridView1.DataSource = list
    End Sub

    Private Class Data
        Public Property Prop1() As Integer
        Public Property Prop2() As Double
    End Class

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        KtReport1.Clear()
        For Each c As DataGridViewColumn In DataGridView1.Columns
            If c.ValueType Is GetType(Double) Then
                c.DefaultCellStyle.Format = "N2"
                c.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight
            End If
        Next c
        KtReport1.AddDatagridView(DataGridView1)
        KtReport1.ShowPrintPreviewDialog()
    End Sub
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        fillDataGridView1()
    End Sub

End Class

REPORT AFTER CHANGE TO N2


问:
Convert android deep link phone call saved as a shortcut into html anchor
Tl;Dr: I need to open deep link connected to a phone call from html page on Android. It MUST be the deep link, not the "tel:..." Url.

I've made simple mobile-friendly html page, with openstreetmap, showing gates around my residential block. Any gate could be opened by calling specific phone number, so, I've added map points, each having open link, that get opened by my android calling app (Google Phone), and gives ability to open the gate which is near me (on the map).

This solution is simple and workable, but it requires too many interactions, also, from time to time, after Google phone got open from the tel: link, the phone number isn't entered in the dialer (some kind of bug).

With specific command in Google Phone menu, I've created desktop shortcuts with the same numbers, and they are making the call by a single finger tap.

Now, I want to combine this two methods, as shortcut on Android desktop should be using some kind of deep link to the call app, but I don't know how to get the link that is used in shortcut.

Are there any tools/methods to see the actual deep links used to create shortcut, and use it in my html application to make it open immediately without opening Google call app dialer?

Googled a lot, tried different tools but no luck


问:
How can I keep the application running when I close the EEL window?
I need to make it so that when the EEL window closes, the program can continue working in the background.</p>


问:
UIContextMenu not appearing when UITableViewCell also contains a UIButton
I am creating a simple to do list app and the UITableViewCell has a checkmark button in it along with a title. When clicking the checkmark button, the done status changes and the cell UI updates.

I also would like to utilise the long press gesture within the UITableViewCell to have a ContextMenu appear. Everything seems to be working, however when a user long presses over the checkmark button, the ContextMenu doesn't appear.

I assume there are competing gestures (ie the UIButton and the cell's Long Press), but I'm having trouble figuring out how to support both at the same time. I've created the test code below to simplify the issue. In storyboard the cell has a single button on it. When long pressed, the context menu does not appear (as I need it to).

I know there's a solution somewhere!

```<code>class TableViewController: UITableViewController {

    override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return 10
    }

    override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        return tableView.dequeueReusableCell(withIdentifier: "cellTest", for: indexPath)
    }

    override func tableView(_ tableView: UITableView, contextMenuConfigurationForRowAt indexPath: IndexPath, point: CGPoint) -> UIContextMenuConfiguration? {

        let actions = [UIAction(title: "Delete", image: UIImage(systemName: "trash"), attributes: .destructive, handler: { action in
            return
        })]

        return UIContextMenuConfiguration(actionProvider: { _ in
            return UIMenu(options: .displayInline, children: actions)
        })

    }

}
</code>```

Body:
I am creating a simple to do list app and the UITableViewCell has a checkmark button in it along with a title. When clicking the checkmark button, the done status changes and the cell UI updates.

I also would like to utilise the long press gesture within the UITableViewCell to have a ContextMenu appear. Everything seems to be working, however when a user long presses over the checkmark button, the ContextMenu doesn't appear.

I assume there are competing gestures (ie the UIButton and the cell's Long Press), but I'm having trouble figuring out how to support both at the same time. I've created the test code below to simplify the issue. In storyboard the cell has a single button on it. When long pressed, the context menu does not appear (as I need it to).

I know there's a solution somewhere!

class TableViewController: UITableViewController {

    override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return 10
    }

    override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        return tableView.dequeueReusableCell(withIdentifier: "cellTest", for: indexPath)
    }

    override func tableView(_ tableView: UITableView, contextMenuConfigurationForRowAt indexPath: IndexPath, point: CGPoint) -> UIContextMenuConfiguration? {

        let actions = [UIAction(title: "Delete", image: UIImage(systemName: "trash"), attributes: .destructive, handler: { action in
            return
        })]

        return UIContextMenuConfiguration(actionProvider: { _ in
            return UIMenu(options: .displayInline, children: actions)
        })

    }

}


问:
Automatically deleted_by null in larave eloquent query
All tables of my websites have a common field named 'deleted_by'. For Database query I use eloquent. I want when I write a query (like Category::all();),I want it will automatically like Category::where('deleted_by',null)->all()/get(); I want to mean that all query automatically will be 'where('deleted_by',null)'. Example:- categories(table name) have two row, see below.

|name | deleted_by |....
| --- | --------   |....
|cat1 | null       |....
| --- | --------   |....
|cat2 | yes        |....
| --- | --------   |....

when I wirte  a query 'Category::all()' it return first row because (It is deleted_by = null).

Have any solution??

Thanks.

Have any solution??

Thanks.


问:
HealthKit: Send data from Bluetooth LE heart rate monitor to healthkit when app is closed
I am working with a BLE peripheral that tracks heart rate. I can sync the data to HealthKit when the app is running and it is working fine.

I would like to send the heart rate to HealthKit without user opening the app. It is mentioned in the documentation that the direct import of data is possible from Bluetooth LE heart rate monitors to HealthKit.

Link : https://developer.apple.com/documentation/healthkit/hksource?language=objc

Any help would be greatly appreciated.


问:
How to refresh a mutex key while command scripts is running? [Laravel Framework]
My English is not good enough.I will try to explain it carefully;

emmm I wrote a command to keep running for updating data. And it will run in a high frequency;

So I set it run erveryMinute In the kernel.php config file;  In order not to run it repeatedly. I set the withoutOverlapping property like this

```<code>$schedule->command('testCommand', ['syncData'])->everyMinute()->withoutOverlapping(120);
</code>```

But while I kill the processor OR restart docker;  The mutex key will stay And the schedule job will not run in the time;  So I have to exec  'php artisan schedule:calear-cache' to delete the mutex key;

Here my Question is : How to refresh mutex key in the testCommand.php file while this command is running. So that I can set a short withoutOverlapping time like

```<code>$schedule->command('testCommand', ['syncData'])->everyMinute()->withoutOverlapping(3);
</code>```

So while the command is running, the mutex key of the command will stay alive. while the command is down. It will release by the Laravel Rules.  But when the docker OR system break down. It will still restart the command in 3*60 seconds (mutex key expired time) ;

Try to set laravel Command Job running like Supervisor；

expecting: Set a short mutex key expired time and refresh it while command is running.

Body:
My English is not good enough.I will try to explain it carefully;

emmm I wrote a command to keep running for updating data. And it will run in a high frequency;

So I set it run erveryMinute In the kernel.php config file;  In order not to run it repeatedly. I set the withoutOverlapping property like this

$schedule->command('testCommand', ['syncData'])->everyMinute()->withoutOverlapping(120);

But while I kill the processor OR restart docker;  The mutex key will stay And the schedule job will not run in the time;  So I have to exec  'php artisan schedule:calear-cache' to delete the mutex key;

Here my Question is : How to refresh mutex key in the testCommand.php file while this command is running. So that I can set a short withoutOverlapping time like

$schedule->command('testCommand', ['syncData'])->everyMinute()->withoutOverlapping(3);

So while the command is running, the mutex key of the command will stay alive. while the command is down. It will release by the Laravel Rules.  But when the docker OR system break down. It will still restart the command in 3*60 seconds (mutex key expired time) ;

Try to set laravel Command Job running like Supervisor；

expecting: Set a short mutex key expired time and refresh it while command is running.


问:
How to create a linear plots using streamlit?
I am using streamlit to build a calculator.

One of the functions needs to convert points [x,y] and make from these points a linear plots graph.

```<code>elif temp == "linear_plot":
    a = {
        "num1": num1, "num2": num2}
    result = requests.post(f"{backendURL}/linear_plot", json=a).json()

    # chart_data = pd.DataFrame(
    #np.random.randn(20, 5),
    # columns=['a', 'b', 'c', 'd', 'e'])
    # st.line_chart (chart_data)
</code>```

I tried to use st.line_chart but it works differently because my points are imported by json file using requests action.
I am expecting that these points will show on a graph on the web when I click "Calc result"

Body:
I am using streamlit to build a calculator.

One of the functions needs to convert points [x,y] and make from these points a linear plots graph.

elif temp == "linear_plot":
    a = {
        "num1": num1, "num2": num2}
    result = requests.post(f"{backendURL}/linear_plot", json=a).json()

    # chart_data = pd.DataFrame(
    #np.random.randn(20, 5),
    # columns=['a', 'b', 'c', 'd', 'e'])
    # st.line_chart (chart_data)

I tried to use st.line_chart but it works differently because my points are imported by json file using requests action.
I am expecting that these points will show on a graph on the web when I click "Calc result"


问:
facebook audience in network timer set on interestial ad splash sacreen
Hello friends  i am using facebook audience network in my flutter app when splash sacreen  is load it show interestial ad  after splash sacreen the load app content which work fine .But  here i am facing some issue when app is load it stuck splash sacreen untill  ads is not load. facebook audience network interestial ads takes some time  to  load.because its too much heavy ads second issue if someone is turn on their data connection but they don't have data its still stuck on splash sacreen because they request to server load ads .Now what i want ads must show after some interval for example when user open app it shows ad only one time and next load after 1 hour when app open  again not show interestial ads everytime to my user. second issue if ads is not loading in 5 second it will go to my app content .third issue if data connection is on user don't have any data it also must load app content</p>
```<code>import 'dart:async';
import 'package:bibleapp/Booknames.dart';
import 'package:facebook_audience_network/ad/ad_interstitial.dart';
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';

class splashsacreen extends StatefulWidget {
  @override
  _splashsacreenState createState() => _splashsacreenState();
}
class _splashsacreenState extends State<splashsacreen> {
  @override
  showinterestial(){
    FacebookInterstitialAd.loadInterstitialAd(

       placementId: "IMG_16_9_APP_INSTALL#2312433698835503_2650502525028617",
        listener: (result, value) {

        try{
          if(result ==InterstitialAdResult.LOADED){
            FacebookInterstitialAd.showInterstitialAd(delay: 1);
            print('showing ads');
          }
          else if(result==InterstitialAdResult.ERROR){
            Navigator.pushReplacement(context, MaterialPageRoute(builder: (context) => Booknames()));
          }
          else if(result == InterstitialAdResult.DISMISSED || value["invalidated"] == true){
            Navigator.pushReplacement(context, MaterialPageRoute(builder: (context) => Booknames()));
          }
          else{
            Navigator.pushReplacement(context, MaterialPageRoute(builder: (context) => Booknames()));
          }
        }
        catch(e){
          print('Error');
        }
        }
    );
  }
  void initState() {
    super.initState();
    Timer(Duration(seconds: 2), (){
      showinterestial();
    }
    );
  }

  @override
  void dispose() {
    super.dispose();
    if(FacebookInterstitialAd!=null){
      FacebookInterstitialAd.destroyInterstitialAd();
    }
  }

  @override
  Widget build(BuildContext context) {
    return Material(
      child: Container(
        color: Colors.teal,
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          crossAxisAlignment: CrossAxisAlignment.center,
          children: [
            Container(
                height: 260,
                child: Image.asset('images/logo.png'
            )),
            SizedBox(height: 10,),

            Text('کلا مِ خُدا',style: GoogleFonts.notoNastaliqUrdu(
              fontSize: 26,
              color: Colors.white,
              fontWeight: FontWeight.bold
            ),),

          ],

        ),
      ),
    );
  }
}
</code>```

Body:
Hello friends  i am using facebook audience network in my flutter app when splash sacreen  is load it show interestial ad  after splash sacreen the load app content which work fine .But  here i am facing some issue when app is load it stuck splash sacreen untill  ads is not load. facebook audience network interestial ads takes some time  to  load.because its too much heavy ads second issue if someone is turn on their data connection but they don't have data its still stuck on splash sacreen because they request to server load ads .Now what i want ads must show after some interval for example when user open app it shows ad only one time and next load after 1 hour when app open  again not show interestial ads everytime to my user. second issue if ads is not loading in 5 second it will go to my app content .third issue if data connection is on user don't have any data it also must load app content

import 'dart:async';
import 'package:bibleapp/Booknames.dart';
import 'package:facebook_audience_network/ad/ad_interstitial.dart';
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';

class splashsacreen extends StatefulWidget {
  @override
  _splashsacreenState createState() => _splashsacreenState();
}
class _splashsacreenState extends State<splashsacreen> {
  @override
  showinterestial(){
    FacebookInterstitialAd.loadInterstitialAd(

       placementId: "IMG_16_9_APP_INSTALL#2312433698835503_2650502525028617",
        listener: (result, value) {

        try{
          if(result ==InterstitialAdResult.LOADED){
            FacebookInterstitialAd.showInterstitialAd(delay: 1);
            print('showing ads');
          }
          else if(result==InterstitialAdResult.ERROR){
            Navigator.pushReplacement(context, MaterialPageRoute(builder: (context) => Booknames()));
          }
          else if(result == InterstitialAdResult.DISMISSED || value["invalidated"] == true){
            Navigator.pushReplacement(context, MaterialPageRoute(builder: (context) => Booknames()));
          }
          else{
            Navigator.pushReplacement(context, MaterialPageRoute(builder: (context) => Booknames()));
          }
        }
        catch(e){
          print('Error');
        }
        }
    );
  }
  void initState() {
    super.initState();
    Timer(Duration(seconds: 2), (){
      showinterestial();
    }
    );
  }

  @override
  void dispose() {
    super.dispose();
    if(FacebookInterstitialAd!=null){
      FacebookInterstitialAd.destroyInterstitialAd();
    }
  }

  @override
  Widget build(BuildContext context) {
    return Material(
      child: Container(
        color: Colors.teal,
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          crossAxisAlignment: CrossAxisAlignment.center,
          children: [
            Container(
                height: 260,
                child: Image.asset('images/logo.png'
            )),
            SizedBox(height: 10,),

            Text('کلا مِ خُدا',style: GoogleFonts.notoNastaliqUrdu(
              fontSize: 26,
              color: Colors.white,
              fontWeight: FontWeight.bold
            ),),

          ],

        ),
      ),
    );
  }
}


问:
I cannot install the last version of spatstat.utils
I am trying to install the latest version of spatstat.utils, which is 3.0.1. However, I don't know why I get the version 2.3.0.
I attach an screenshot with the error message

Is there any way of telling R that the latest version should be installed?


问:
Uncaught Error : Call to a member function isHtml() on string while using phpmailer library
I've been using the phpmailer library for a while now to send emails.

```<code>require '../class/class.phpmailer.php';
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Mailer = "smtp";
//$mail->SMTPDebug  = 1;
$mail->SMTPAuth   = TRUE;
$mail->SMTPSecure = "";
$mail->Port       = port;
$mail->Host       = "my _server";
$mail->Username   = "user@domain.com";
$mail->Password   = "password";

$mail->IsHTML(true);
$mail->AddAddress("$destination");
$mail->SetFrom("user@domain.com");
$mail->Subject = "Subject";
$content = "content.....";
$mail->MsgHTML($content);
if(!$mail->Send()) {
 // echo "Error while sending Email.";

} else {
  //echo "Email sent successfully";
}
</code>```

Since yesterday I can no longer send them and I have this message

"PHP Fatal error : Uncaught Error : Call to a member function isHtml() on string"

Body:
I've been using the phpmailer library for a while now to send emails.

require '../class/class.phpmailer.php';
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Mailer = "smtp";
//$mail->SMTPDebug  = 1;
$mail->SMTPAuth   = TRUE;
$mail->SMTPSecure = "";
$mail->Port       = port;
$mail->Host       = "my _server";
$mail->Username   = "user@domain.com";
$mail->Password   = "password";

$mail->IsHTML(true);
$mail->AddAddress("$destination");
$mail->SetFrom("user@domain.com");
$mail->Subject = "Subject";
$content = "content.....";
$mail->MsgHTML($content);
if(!$mail->Send()) {
 // echo "Error while sending Email.";

} else {
  //echo "Email sent successfully";
}

Since yesterday I can no longer send them and I have this message

"PHP Fatal error : Uncaught Error : Call to a member function isHtml() on string"