我很抱歉提出这样的问题,我知道以前也有过这样的问题,但我的情况相当......愚蠢。我拥有的是一个项目管理系统,我想显示所有运行良好且由 Symfony 自动生成的项目。在 ProjectController 的同一个控制器中,我做了另一个动作。我想列出所有已完全完成的存档项目。首先,我只是简单地复制粘贴了代码和注释,并更改了函数的路由和名称。这是我的indexAction功能
/**
* Lists all project entities.
*
* @Route("/", name="project_index")
* @Method("GET")
*/
public function indexAction()
{
$em = $this->getDoctrine()->getManager();
$projects = $em->getRepository('AppBundle:Project')->findAll();
return $this->render('project/index.html.twig', array(
'projects' => $projects,
));
}
Run Code Online (Sandbox Code Playgroud)
这很简单。现在这是我的archiveAction功能,它是相同的
/**
* Lists all project entities.
*
* @Route("/archive", name="project_archive")
* @Method("GET")
*/
public function archiveAction()
{
$em = $this->getDoctrine()->getManager();
$projects = $em->getRepository('AppBundle:Project')->findAll();
return $this->render('project/index.html.twig', array(
'projects' => $projects,
));
}
Run Code Online (Sandbox Code Playgroud)
到目前为止,我什至没有过滤项目,而是做与我在indexAction函数中所做的完全相同的事情,并记住两个函数都在同一个控制器中。这是我在尝试显示所有存档项目时收到的错误 -
未找到 AppBundle\Entity\Project 对象。
索引操作工作正常并显示所有项目,但是如果我更改路由并更改函数名称并保持所有内容相同并且它们在同一个控制器中 …
如何使用变量执行 graphQL 查询/变异?我正在使用这个客户端: https: //github.com/graphql-dotnet/graphql-client
我正在尝试执行以下操作:
mutation customerCreate($input: CustomerCreateInput!) {
customerCreate(input: $input) {
userErrors {
field
message
}
customer {
id
}
}
}
Run Code Online (Sandbox Code Playgroud)
变量:
{
"input": {
"email": "user@example.com",
"password": "HiZqFuDvDdQ7"
}
}
Run Code Online (Sandbox Code Playgroud)
我的代码:
var request = new GraphQLRequest();
request.Query = @"mutation customerCreate($input: CustomerCreateInput!) {
customerCreate(input: $input) {
userErrors {
field
message
}
customer {
id
}
}
}";
request.OperationName = "customerCreate";
request.Variables = new
{
email = "user@example.com",
password = "HiZqFuDvDdQ7"
};
var client = new GraphQLClient("https://kitkatco.myshopify.com/api/graphql"); …Run Code Online (Sandbox Code Playgroud) 我的客户端代码调用 API,并且尝试从响应标头获取返回的 ETag 值。如果我使用 Fiddler,我可以看到响应包含 ETag 标头,如果我使用 Postman 进行 API 调用,我可以看到 ETag 标头,但无论我采取什么方法尝试检索代码中的标头,我返回的都是无效的。
API 调用本质上是:
// create request object
var request = new HttpRequestMessage(HttpMethod.Get, url);
// add authorization header
request.Headers.Authorization = new AuthenticationHeaderValue("bearer", await GetBearerToken());
// send request
HttpResponseMessage response = await _client.SendAsync(request);
Run Code Online (Sandbox Code Playgroud)
邮递员的回应是;
我花了几个小时搜索并尝试网络上的示例,但无论我尝试什么,我都无法获取 ETag 标头。
使用下面的示例代码,我确实获得了返回的 Postman 响应标头中所示的前 2 个标头,但没有获得 ETag 标头/值。
String allResponseHeaders = Enumerable
.Empty<(String name, String value)>()
.Concat(
response.Headers
.SelectMany(kvp => kvp.Value
.Select(v => (name: kvp.Key, value: v))
)) …Run Code Online (Sandbox Code Playgroud) 以下代码更改array变量中的元素。我期待着改变,sortedArray但它同时也改变了。我从来没有array在任何等号的左侧。我从未设置array为任何值,但当我观看时,我在调试器中看到它的变化。
static int[] SortArray(int[] array)
{
int[] sortedArray = array;
while (!IsSorted(sortedArray))
{
for (int i = 0; i < array.Length-1; i++)
{
if( sortedArray[i] > sortedArray[i + 1])
{
sortedArray[i] = array[i + 1];
sortedArray[i + 1] = array[i];
}
}
}
return sortedArray;
}
Run Code Online (Sandbox Code Playgroud)
SortArray调用该方法之前,array为 (8, 3, 1, 6, 4),方法完成后,array为 (1, 1, 1, 4, 4)。
我在SQL方面相当缺乏经验,这似乎是一件容易的事,但我不知道如何去做.
基本上我想从表A中选择一行,其中字段"someField"在预定的集合"someSet"中,但我希望它单独查找集合中的每个值.例如,假设"someSet"包含5,6,9,3.我会使用类似这样的查询:
SELECT * FROM A WHERE someField IN (5, 6, 9, 3) LIMIT 1
Run Code Online (Sandbox Code Playgroud)
但是,我希望它首先查找5,然后是6,然后是9,如果还没有找到行,则最后查找3.写作单独的查询它看起来像这样:
SELECT * FROM A WHERE someField = 5 LIMIT 1
(if no results returned)
SELECT * FROM A WHERE someField = 6 LIMIT 1
(if no results returned)
SELECT * FROM A WHERE someField = 9 LIMIT 1
(if no results returned)
SELECT * FROM A WHERE someField = 3 LIMIT 1
Run Code Online (Sandbox Code Playgroud)
显然使用4个查询(理论上是无限查询)并不是很优雅,有没有办法将它变成单个查询?
我在goddady上托管我的域名,并且我试图在数据库中散列密码.但是,它会抛出错误:
MySQL said:
#1305 - FUNCTION dbname.SHA2 does not exist
Run Code Online (Sandbox Code Playgroud)
这是我用来在数据库中插入数据的命令.
insert into `dbname`.`tbl_members` values ('1', 'admin', SHA2('password', 224));
Run Code Online (Sandbox Code Playgroud)
当我在本地服务器上执行它时,这完全正常.
我需要在我的iPhone应用程序中通过APNS使用通知.
但是当我阅读规范时,我看到可以在APNS端更改令牌,我必须更新提供者端的令牌才能接收通知.
但是,当Provider创建Notification并将其传递给APNS时会发生什么,并且此时令牌已经被更改?
我会收到旧令牌的通知吗?是否会通知提供商令牌已过期?
我是否应该这样解决,注册后我会更新我的提供商,并提供"你可以发送通知"信息并在应用程序运行时制作NSTimer作业以更新此状态吗?
根据这个:http: //developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/IPhoneOSClientImp/IPhoneOSClientImp.html#//apple_ref/doc/uid/TP40008194-CH103-SW2
谢谢
我是合同开发人员,有一个应用程序可以通过客户的企业帐户分发.我和其他客户一起使用过Enterprise帐户,但出于某种原因,我添加到此客户端的钥匙串中的"iPhone Distribution"证书没有出现在Xcode Organizer中.
当我为应用程序导入mobileprovision时,Xcode抱怨没有有效的密钥对.
客户已将我添加到他们的帐户; 只有创建企业分发证书的开发人员才能将其导入到钥匙串中吗?如果我创建一个新的分发证书(不是配置文件),这是否会使现有证书无效(我没有使用的其他应用程序使用?)
我有一个列名为"州/省"的数据库.所有查询和数据传输都能正常工作.但是在dropdownlist控件的"SelectedValue"属性中,绑定表达式会引发错误.
当我通过删除斜杠符号编辑列名称时,它运行良好.
所以在列名中使用斜杠不是一种正确的命名方式吗?
是否可以加载在web.config文件中注册的用户控件,而不是在aspx文件中?
这是我要做的一个例子.在我的aspx中:
的Index.aspx
<%@ Register TagPrefix="module" TagName="ModExample" Src="~/controls/example.ascx" %>
Run Code Online (Sandbox Code Playgroud)
index.cs
protected void Page_Load(object sender, EventArgs e)
{
controls_example exmp = LoadContent("controls/example.ascx") as controls_example;
myContentPanel.Controls.Add(exmp);
}
Run Code Online (Sandbox Code Playgroud)
我必须在页面中注册我的用户控件,否则ASP不会知道"controls_example"是什么.但是,我知道您可以将web.config更改为如下所示:
<configuration>
<system.web>
<pages>
<controls>
<add tagPrefix="module" tagName="ModExample" src="~/controls/contentModule.ascx"/>
<add assembly="Subtext.Web.Controls" namespace="Subtext.Web.Controls" tagPrefix="module"/>
</controls>
</pages>
</system.web>
</configuration>
Run Code Online (Sandbox Code Playgroud)
所以,这是问题所在.如何在web.config文件中注册后创建"controls_example"类型的变量?
我需要: