如梦初醒的夏天

文章 评论 浏览 28

如梦初醒的夏天 2025-02-20 21:50:16

使用条件聚合:

SELECT owner,
       SUM(CASE rarity WHEN 2 THEN 10 WHEN 3 THEN 100 ELSE 1 END) count
FROM usercards
WHERE `group` LIKE '%$group%' AND customCard = 0
GROUP BY owner
ORDER BY count DESC;

Use conditional aggregation:

SELECT owner,
       SUM(CASE rarity WHEN 2 THEN 10 WHEN 3 THEN 100 ELSE 1 END) count
FROM usercards
WHERE `group` LIKE '%$group%' AND customCard = 0
GROUP BY owner
ORDER BY count DESC;

SQL查询:乘数count()如果另一个值= x

如梦初醒的夏天 2025-02-20 19:01:00

如果您在项目中使用Typscript,请确保存在tsconfig.json文件。否则,手动或运行此命令来创建此文件:

npx tsc --init

If you are using TypScript in your project, make sure the tsconfig.json file exists. Otherwise, create this file manually or by running this command:

npx tsc --init

ReactJS-找不到模块:错误:可以解决' app'

如梦初醒的夏天 2025-02-20 09:29:04

提取无法检查文件系统。它是提出HTTP请求的API。

如果要在Web服务器上检查文件系统,请编写Web服务进行此操作。您可以使用fetch与该网络服务进行交互。

fetch cannot inspect a file system. It is an API for making HTTP requests.

If you want to inspect a file system on a webserver, then write a web service to do so. You can use fetch to interact with that web service.

如何使用fetch列出文件夹中的文件?

如梦初醒的夏天 2025-02-20 08:37:30

我也是因为我在同一路线上使用了多个中间件,所以我使用了全局中间件,然后在子路由中应用了另一个中间件。因此,这引起了混合。

What caused this too me was because I was using multiple middleware on the same route, I was using global middleware and then applied another middleware in sub route. so this caused conflits.

如何解决Multer错误:表格的意外结束?

如梦初醒的夏天 2025-02-18 06:42:20

它的逻辑很简单:如果字符是小写,则将其转换为相应的大写,否则将其按原样包含。

def uppercase(seq):
    lowers = 'abcdefghijklmnopqrstuvwxyz'
    uppers = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
    result = ''
    for x in seq:
        if x in lowers:
            result += uppers[lowers.index(x)]
        else:
            result += x
    return result

seqs = 'Hello, How Are You?'
uppercase(seqs)
 # HELLO, HOW ARE YOU?

The logic of this is simple: if the character is lowercase, convert to the corresponding uppercase, otherwise, include it as is.

def uppercase(seq):
    lowers = 'abcdefghijklmnopqrstuvwxyz'
    uppers = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
    result = ''
    for x in seq:
        if x in lowers:
            result += uppers[lowers.index(x)]
        else:
            result += x
    return result

seqs = 'Hello, How Are You?'
uppercase(seqs)
 # HELLO, HOW ARE YOU?

在不使用.upper()的情况下,如何将列表的内容转换为upper?

如梦初醒的夏天 2025-02-18 02:42:35

尝试:

brew install hdf5
export HDF5_DIR=/opt/homebrew/opt/hdf5
pip install --no-binary=h5py h5py
pip install tensorflow-macos

这对我有用。

Try:

brew install hdf5
export HDF5_DIR=/opt/homebrew/opt/hdf5
pip install --no-binary=h5py h5py
pip install tensorflow-macos

This worked for me.

无法在Mac上设置TensorFlow

如梦初醒的夏天 2025-02-17 21:20:36

afaik以获取用户诸如姓名,电子邮件等的信息。您可以在生成JWT令牌时添加这些索赔。

以生成访问令牌,您有多个身份验证流,例如< strong> 授权代码流< /a> , ropc流 隐式流量

要添加您需要使用令牌返回的索赔,您可以进行以下设置:

转到Azure Portal -&gt; Azure Active Directory-&GT;应用注册 - &GT;您的应用程序 - &gt;令牌配置 - &gt;添加可选索赔

“

当您通过 json Web令牌-JWT.IO 您可以找到所需的用户信息。

要知道如何生成访问令牌,您可以参考 所以线程 我以前解决了它。

AFAIK To get the user's information like name, email etc. you can add these claims while generating the JWT token.

To generate access token, you have multiple authentication flows such as Authorization code flow, ROPC flow, Implicit flow.

To add the claims that you need to return with the token, you can make settings like below:

Go to Azure Portal -> Azure Active Directory -> App Registrations -> Your app -> Token configuration -> Add optional claims

enter image description here

When you decode the token via JSON Web Tokens - jwt.io you can find the user information that you need.

To know how to generate access token, you can refer SO Thread which I solved it before.

如何使用“身份管理系统”?

如梦初醒的夏天 2025-02-17 20:44:16

lamctaintegration具有和数量的IntergrationResspons,您可以在响应模式中添加代码。

const integrationResponse: IntegrationResponse = {
  statusCode: "200",
  contentHandling: ContentHandling.CONVERT_TO_TEXT
  allowTestInvoke: true,
  proxy: false,
  integrationResponses: [
  {
     statusCode: "200",
     responseTemplates: {
     "application/x-www-form-urlencoded": `
    #if ($context.httpMethod == "POST")
    ....rest of that code translation

`

LamdaIntegration has and array of intergrationResponses, which you can add code inside responseTemplates.

const integrationResponse: IntegrationResponse = {
  statusCode: "200",
  contentHandling: ContentHandling.CONVERT_TO_TEXT
  allowTestInvoke: true,
  proxy: false,
  integrationResponses: [
  {
     statusCode: "200",
     responseTemplates: {
     "application/x-www-form-urlencoded": `
    #if ($context.httpMethod == "POST")
    ....rest of that code translation

`

AWS Apigateway更改为Lamdarestapi,Suporting代理和自定义模型(表格/UrlenCoded)

如梦初醒的夏天 2025-02-16 20:42:53

您可以做这样的事情(RHS =右侧):

x1 = ['Apples:Red', 'Apples:Green', 'Bananas:Yellow', 'Grapes:Purple', 'Grapes:Green']

x2 = ['Green', 'Yellow']


list_new = []
for substring in x1:
    rhs = substring.split(":")[1]
    if rhs in x2:
        list_new.append(substring)

>>> list_new
['Apples:Green', 'Bananas:Yellow', 'Grapes:Green']

You can do something like this (rhs = right-hand side):

x1 = ['Apples:Red', 'Apples:Green', 'Bananas:Yellow', 'Grapes:Purple', 'Grapes:Green']

x2 = ['Green', 'Yellow']


list_new = []
for substring in x1:
    rhs = substring.split(":")[1]
    if rhs in x2:
        list_new.append(substring)

>>> list_new
['Apples:Green', 'Bananas:Yellow', 'Grapes:Green']

检查列表中的字符串部分是否存在于另一个列表中

如梦初醒的夏天 2025-02-16 16:39:19

工作代码

我无法使用tcpdf 6.4.4:

composer.json

{
    "require": {
        "tecnickcom/tcpdf": "^6.4"
    }
}

test.php

require_once __DIR__ . "/vendor/autoload.php";

// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);

$pdf->AddPage();

//Cell($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=0, $link='', $stretch=0, $ignore_min_height=false, $calign='T', $valign='M')
$pdf->Cell(20, 10, 'Click here', 1, 0, 'L', false, 'https://example.com', 1, false, 'T', 'C');
$pdf->Output('example_004.pdf', 'I');

输出

“

您能告诉我您正在使用的库的哪个版本?

Working code

I cannot reproduce the issue with using tcpdf 6.4.4:

composer.json

{
    "require": {
        "tecnickcom/tcpdf": "^6.4"
    }
}

test.php

require_once __DIR__ . "/vendor/autoload.php";

// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);

$pdf->AddPage();

//Cell($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=0, $link='', $stretch=0, $ignore_min_height=false, $calign='T', $valign='M')
$pdf->Cell(20, 10, 'Click here', 1, 0, 'L', false, 'https://example.com', 1, false, 'T', 'C');
$pdf->Output('example_004.pdf', 'I');

Output

Can you tell me which version of the library you are using?

如何使用单元格方法在PDF上使用TCPDF添加链接?

如梦初醒的夏天 2025-02-16 07:05:15

我能够以这种方式工作。不知道为什么我必须这样黑客。丑陋,但有效。

* eval
"""
var tokResponse = karate.call('functions/oauth2.feature')
var emptyResponse = {tokResponse: ''}
if (tokResponse) {
  karate.set('oauth', tokResponse)
} else {
  karate.set('oauth', emptyResponse)
}
"""

I was able to get it to work this way. Not sure why I had to hack it like this. Ugly but it works.

* eval
"""
var tokResponse = karate.call('functions/oauth2.feature')
var emptyResponse = {tokResponse: ''}
if (tokResponse) {
  karate.set('oauth', tokResponse)
} else {
  karate.set('oauth', emptyResponse)
}
"""

难以在空手道中获取功能文件的有条件调用

如梦初醒的夏天 2025-02-16 00:55:55

首先,您不能使用ontapesture导航到另一个view

初始化器的结果未使用

是由于使用ontapesture导航到另一个view引起的。

幸运的是,您的问题有一个解决方案。在您的第二个foreach循环中,将代码替换为以下代码。

NavigationLink {
    LandmarkDetail(landmark: landmark)
} label: {
    LandmarkRow(landmark: landmark)
}
.swipeActions(edge:.trailing){
    Button{
        print("fav")
    } label:{
        Label("favourite",systemImage: "star.circle.fill")
    }            
}

Firstly, you can't use onTapGesture to navigate to another View.

Result of initializer is unused

is caused by using onTapGesture to navigate to another View.

Fortunately, there is a solution for your problem. Inside your second ForEach loop, replace your code with the code below.

NavigationLink {
    LandmarkDetail(landmark: landmark)
} label: {
    LandmarkRow(landmark: landmark)
}
.swipeActions(edge:.trailing){
    Button{
        print("fav")
    } label:{
        Label("favourite",systemImage: "star.circle.fill")
    }            
}

初始化器的结果是未得到的

如梦初醒的夏天 2025-02-15 16:39:32

两者都将使用HILT创建一个视图模型实例,但区别在于,以下该实例是为了创建片段的视图模型,您不能在可组合的屏幕中使用它:

val viewModel: XViewModel by viewModels()

第二个是新的,并且随附了JetPack Compose,您可以在可组合的屏幕中使用它,它将创建一个视图模型实例,只要您的屏幕在导航堆栈中:

val viewModel = hiltViewModel<XViewModel>() 

Both will create a view model instance using hilt but the difference is that this one below is for creating view model for a fragment, you can't use it in a composable screen:

val viewModel: XViewModel by viewModels()

And the second one is new and comes with jetpack compose, you can use it inside a composable screen and it will create a view model instance that will stay alive as long as your screen is in navigation stack:

val viewModel = hiltViewModel<XViewModel>() 

hiltviewModel&lt; viewModel&gt;()vs viewModels()

如梦初醒的夏天 2025-02-15 11:13:52

要获得想要的东西,您需要 collect collect 操作员 value channge

Channel
    .fromFilePairs( '/path/to/files/*.vcf.gz{,.tbi}' )
    .collect { sample, indexed_vcf -> [ indexed_vcf ] }
    .map { 
        def fmeta = [ "id": "test" ]

        [ fmeta, it*.first(), it*.last() ] 
    } 
    .view()

给您一个 “ noreflow noreferrer”> 详细信息,但通常您不需要将索引文件与实际VCF文件分开。如果要直接将此通道用作过程输入,我的首选是更改输入声明,以便我可以使用类似的内容:

Channel
    .fromPath( '/path/to/files/*.vcf.gz{,.tbi}' )
    .collect()
    .map { 
        def fmeta = ["id": "test"]

        [ fmeta, it ]
    } 
    .view()

To get what you want, you'd need the collect operator which gives you a value channel:

Channel
    .fromFilePairs( '/path/to/files/*.vcf.gz{,.tbi}' )
    .collect { sample, indexed_vcf -> [ indexed_vcf ] }
    .map { 
        def fmeta = [ "id": "test" ]

        [ fmeta, it*.first(), it*.last() ] 
    } 
    .view()

It's difficult to say without the details, but usually you don't need to separate out the index files from the actual VCF files. If this channel is to be used directly as process input, my preference would be to alter the input declaration so that I could use something like this instead:

Channel
    .fromPath( '/path/to/files/*.vcf.gz{,.tbi}' )
    .collect()
    .map { 
        def fmeta = ["id": "test"]

        [ fmeta, it ]
    } 
    .view()

NextFlow:将FREF FREFEPAIRS的输入转换为元组(MAP,LIST_PAIR_1,LIST_PAIR_2)

如梦初醒的夏天 2025-02-15 08:06:51

对于那些有兴趣的人,我弄清楚了。
我必须更改所有列名称:
证人1个证人1_name
证人1job to viness1_job
等。

然后我跑了这个:

cleandata <- pivot_longer(mddata, cols = -c(Coder, Bill), 
                    names_to = c("Witness", ".value"),
                    names_pattern = 'Witness(\\d)_(.*)') %>%
  drop_na(Name)

它给了我这一点:

Coder    Bill    Witness   Name         Job

Joe       123       1       Fred          Plumber
Joe       123       2       Bob           Coach
Karen     122       1       Sally         Barista
Karen     122       2      Helen         Translator
Harry     431       1       Lisa          Swimmer

足够接近我想要的东西

For those interested, I figured it out.
I had to change all the column names like this:
Witness1Name to Witness1_Name
Witness1Job to Witness1_Job
etc.

Then I ran this:

cleandata <- pivot_longer(mddata, cols = -c(Coder, Bill), 
                    names_to = c("Witness", ".value"),
                    names_pattern = 'Witness(\\d)_(.*)') %>%
  drop_na(Name)

And it gave me this:

Coder    Bill    Witness   Name         Job

Joe       123       1       Fred          Plumber
Joe       123       2       Bob           Coach
Karen     122       1       Sally         Barista
Karen     122       2      Helen         Translator
Harry     431       1       Lisa          Swimmer

Close enough to what I wanted

R清洁,将数据格式水平更改为垂直,重复一些数据

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文