我需要将 10 个以上的参数传递给单个批处理文件(shell 脚本),但在第 9 个参数之后它将不起作用(它将从头开始)
代码示例
echo Hello! This a sample batch file.
echo %1 %2 %3 %4 %5 %6 %7 %8 %9 %10 %11 %12 %13 %14 %15 %16
pause
>mybatchdotbat a b c d e f g h i j k l m n o p
Run Code Online (Sandbox Code Playgroud)
任何人都可以为此提供解决方案
给定两个字符串A和B,检查它们是否是字谜.
如果通过重新排列另一个字母可以获得一个字符串,则称两个字符串为字谜.
字谜的例子是
dog, god abac, baac123, 312abab, aaba而dab, baad不是字谜.
输入:
输入的第一行是测试用例T的数量.接着是T行,每行有两个空格分隔的字符串A和B;
OUTPUT
对于每个测试用例,如果是anagrams则打印"YES",否则打印"NO".(不含引号)
约束
`
Sample Input Sample Output
------------------------------------
3 YES
abcd bcda NO
bad daa YES
a1b2c3 abc123 NO
Run Code Online (Sandbox Code Playgroud)
我们应该怎么做 ?
bool anagramChecker(string first, string second)
{
if(first.Length != second.Length)
return false;
if(first == second)
return true;//or false: Don't know whether a string counts as an anagram of itself
Dictionary<char, int> pool = …Run Code Online (Sandbox Code Playgroud) 我正在使用简单的凤凰灵药应用程序。在此应用程序中,我尝试公开一个 REST API 来保存和检索数据。
就我而言,如果主键(电子邮件地址)重复,我的应用程序将引发错误。我需要知道处理这个错误的最佳方法;try-catch 或任何其他更好的解决方案。
这是我的数据保存方法
def post(conn, %{"stooge" => stooge, "name" => name, "email" => email , "password" => password})do
respond = Repo.insert!(%ApiDb.User{name: name, email: email, stooge: stooge, password: password})
json conn, respond
end
Run Code Online (Sandbox Code Playgroud)
样本有效载荷
{
"stooge": "moe",
"name": "Joe",
"email": "p31111ww11eee32111111134@dmain.com",
"password":"asdasd"
}
Run Code Online (Sandbox Code Playgroud)
模型/user.ex
defmodule ApiDb.User do
use ApiDb.Web, :model
schema "users" do
field :password, :string
field :name, :string
field :email, :string
field :stooge, :string
timestamps()
end
@doc """
Builds a changeset based on the `struct` and …Run Code Online (Sandbox Code Playgroud) 使用 AWS CDK TYPESCRIPT 来部署 Beanstalk 应用程序。我能够使用 AWS CDK Typescript 设置 Beanstalk 应用程序,但找不到在现有 VPC 中以高可用性设置它的方法。这是我的 ebstack.ts
#!/usr/bin/env node
import cdk = require('@aws-cdk/core');
import elasticbeanstalk = require('@aws-cdk/aws-elasticbeanstalk');
export class ElbtestStack extends cdk.Stack {
constructor(scope: cdk.App, id: string, props?: cdk.StackProps) {
super(scope, id, props);
//objects for access parameters
const node = this.node;
const appName = 'DEVELOPMENT';
const platform = node.tryGetContext("platform");
const app = new elasticbeanstalk.CfnApplication(this, 'Application', {
applicationName: appName
});
const optionSettingProperties: elasticbeanstalk.CfnEnvironment.OptionSettingProperty[] = [
{
namespace: 'aws:autoscaling:launchconfiguration',
optionName: 'InstanceType',
value: 't3.small', …Run Code Online (Sandbox Code Playgroud) vpc amazon-web-services typescript amazon-elastic-beanstalk aws-cdk
我想在我的聊天应用程序中使用{:redix,"〜> 0.6.1"} hex包,并从监督树开始
{:ok, conn} = Redix.start_link()
{:ok, conn} = Redix.start_link(host: "example.com", port: 5000)
{:ok, conn} = Redix.start_link("redis://localhost:6379/3", name: :redix)
Redix.command(conn, ["SET", "mykey", "foo"])
Run Code Online (Sandbox Code Playgroud)
但是当我尝试将连接开始链接放到子进程时它会出错
children = [
# Start the Ecto repository
supervisor(PhoenixChat.Repo, []),
# Start the endpoint when the application starts
supervisor(PhoenixChat.Endpoint, []),
# Start your own worker by calling: PhoenixChat.Worker.start_link(arg1, arg2, arg3)
# worker(PhoenixChat.Worker, [arg1, arg2, arg3]),
supervisor(PhoenixChat.Presence, []),
#supervisor(Phoenix.PubSub.Redis, [:chat_pubsub, host: "127.0.0.1"])
]
Run Code Online (Sandbox Code Playgroud)
如何启动redix连接并将数据存储到Redis?