简短问题:如何修改单个项目List
?(或者更确切地说,struct
存储在List
?中的成员?)
完整说明:
首先,struct
使用以下定义:
public struct itemInfo
{
...(Strings, Chars, boring)...
public String nameStr;
...(you get the idea, nothing fancy)...
public String subNum; //BTW this is the element I'm trying to sort on
}
public struct slotInfo
{
public Char catID;
public String sortName;
public Bitmap mainIcon;
public IList<itemInfo> subItems;
}
public struct catInfo
{
public Char catID;
public String catDesc;
public IList<slotInfo> items;
public int numItems;
}
catInfo[] gAllCats = new catInfo[31]; …
Run Code Online (Sandbox Code Playgroud) 使用最新的Chrome,我注意到事件在鼠标停留在同一位置mousemove
之后mousedown
或之后都会触发.mouseup
我有这种奇怪的行为附加一个事件监听器document.documentElement
.
最新的Firefox上的相同脚本工作正常,问题似乎只在Chrome上.
http://jsbin.com/cefoteleqo/1/
document.documentElement.addEventListener('mousedown', function(event){
console.log('mousedown', event.pageX, event.pageY);
}.bind(this));
document.documentElement.addEventListener('mouseup', function(event){
console.log('mouseup', event.pageX, event.pageY);
}.bind(this));
document.documentElement.addEventListener('mousemove', function(event){
console.log('mousemove <<<<', event.pageX, event.pageY);
}.bind(this));
Run Code Online (Sandbox Code Playgroud)
问题出现在Win 8.1上:
Chrome版本42.0.2311.135 m
Chrome版本44.0.2398.0金丝雀(64位)
我正在尝试通过"Classic"NVP API设置PayPal Express Payment.
尝试使用cURL从我的服务器连接到PayPal-Sandbox,连接会在大约2分钟后停止并超时.
我正在使用来自文档的示例调用:
curl -v --insecure https://api-3t.sandbox.paypal.com/nvp -d "USER=platfo_1255077030_biz_api1.gmail.com&PWD=1255077037&SIGNATURE=Abg0gYcQyxQvnf2HDJkKtA-p6pqhA1k-KTYE0Gcy1diujFio4io5Vqjf&METHOD=SetExpressCheckout&VERSION=78&PAYMENTREQUEST_0_PAYMENTACTION=SALE&PAYMENTREQUEST_0_AMT=19&PAYMENTREQUEST_0_CURRENCYCODE=USD&cancelUrl=http://www.yourdomain.com/cancel.html&returnUrl=http://www.yourdomain.com/success.html"
Run Code Online (Sandbox Code Playgroud)
Shell输出是:
* About to connect() to api-3t.sandbox.paypal.com port 443 (#0)
* Trying 173.0.82.83... Connection timed out
* couldn't connect to host
* Closing connection #0
curl: (7) couldn't connect to host
Run Code Online (Sandbox Code Playgroud)
当我尝试通过PHP执行此操作时,curl
我不会收到任何错误,只是一个空的资源句柄.
我可以轻松地从本地计算机和我可以访问的其他服务器执行请求(并获取正确的数据),因此我猜这是一些服务器端错误配置正在进行.不是服务员,我有点无能为力.
启用cURL并将以下内容记录在phpinfo
:
libcurl/7.21.0 OpenSSL/0.9.8o zlib/1.2.3.4 libidn/1.15 libssh2/1.2.6
Run Code Online (Sandbox Code Playgroud)
openSSL也已启用.此外,我在尝试连接到API的实时版本时遇到了同样的问题.
请参阅下面的代码:
var result = await SignInManager.PasswordSignInAsync(model.UserName, model.Password, model.RememberMe, shouldLockout: false);
switch (result)
{
case SignInStatus.Success:
string UserId = User.Identity.GetUserId();
return RedirectToAction("ClientDetails","Home");
case SignInStatus.LockedOut:
return View("Lockout");
case SignInStatus.RequiresVerification:
return RedirectToAction("SendCode", "Account", new { ReturnUrl = returnUrl, RememberMe = model.RememberMe });
case SignInStatus.Failure:
default:
ModelState.AddModelError("", "Invalid login attempt.");
return View(model);
}
Run Code Online (Sandbox Code Playgroud)
将UserId
始终null
和User.Identity.IsAuthenticated
永远false
.但我可以查看ClientDetails
需要身份验证的View .
我已经看到了很多的使用C#程序[]
,例如[STAThread]
,然后将代码如下.另一个经典的例子是[DLLImport]
.
我知道是什么STAThread
意思,但我的问题是方括号的意义是什么,基本上它们告诉编译器的是什么?
当我在我的目录上执行'git status'时,它显示了一堆看似重复的未跟踪文件.唯一的区别是所有都有前缀._
.例如:我需要添加的一个未跟踪文件将是... app/assets/stylesheets/categories.css
而另一个文件将显示为app/assets/stylesheets/._categories.css
.
有谁知道这是什么一回事?似乎没有关于GitHub的好文档.
我有一个使用Entity Framework的类库项目,它运行良好,直到我将模型移动到一个单独的类库类型项目.
在我将模型移到一个名为Model的单独的类库项目之后,我将app/web.config中的连接字符串更改为如下所示:
<add name="GlobalizationEntities"
connectionString="metadata=res://Model.dll/Models.ResourceGlobalizationModel.csdl|
res://Model.dll/Models.ResourceGlobalizationModel.ssdl|
res://Model.dll/Models.ResourceGlobalizationModel.msl;
provider=System.Data.SqlClient;
provider connection string="
Data Source=MyComputer\sqlexpress;
Initial Catalog=DaDatabase;
Integrated Security=true;
MultipleActiveResultSets=True""
providerName="System.Data.EntityClient" />
Run Code Online (Sandbox Code Playgroud)
(为了便于阅读,我在上面的代码段中包含了换行符.我的代码没有这些换行符.)
现在,我的解决方案结构如下所示:
但是,我FileNotFound
在运行时获得一个异常,其内容如下:
System.IO.FileNotFoundException was unhandled by user code
HResult=-2147024894
Message=Unable to resolve assembly 'Model.dll'.
Source=System.Data.Entity
StackTrace:
at System.Data.Metadata.Edm.MetadataArtifactLoaderCompositeResource.ResolveAssemblyName(String assemblyName, MetadataArtifactAssemblyResolver resolver)
at System.Data.Metadata.Edm.MetadataArtifactLoaderCompositeResource.CreateResourceLoader(String path, ExtensionCheck extensionCheck, String validExtension, ICollection`1 uriRegistry, MetadataArtifactAssemblyResolver resolver)
at System.Data.Metadata.Edm.MetadataArtifactLoader.Create(String path, ExtensionCheck extensionCheck, String validExtension, ICollection`1 uriRegistry, MetadataArtifactAssemblyResolver resolver)
at System.Data.Metadata.Edm.MetadataCache.SplitPaths(String paths)
at System.Data.Common.Utils.Memoizer`2.<>c__DisplayClass2.<Evaluate>b__0()
at System.Data.Common.Utils.Memoizer`2.Result.GetValue()
at System.Data.Common.Utils.Memoizer`2.Evaluate(TArg arg)
at System.Data.EntityClient.EntityConnection.GetMetadataWorkspace(Boolean initializeAllCollections) …
Run Code Online (Sandbox Code Playgroud) 我曾经使用标准的mysql_connect(),mysql_query()等语句来从PHP做MySQL的东西.最近我一直在转向使用精彩的MDB2课程.除此之外,我正在使用预处理语句,所以我不必担心逃避输入和SQL注入攻击.
但是,我遇到了一个问题.我有一个包含几个VARCHAR列的表,指定为非null(即,不允许NULL值).使用旧的MySQL PHP命令,我可以做这样的事情没有任何问题:
INSERT INTO mytable SET somevarchar = '';
Run Code Online (Sandbox Code Playgroud)
但是,现在,如果我有一个类似的查询:
INSERT INTO mytable SET somevarchar = ?;
Run Code Online (Sandbox Code Playgroud)
然后在PHP中我有:
$value = "";
$prepared = $db->prepare($query, array('text'));
$result = $prepared->execute($value);
Run Code Online (Sandbox Code Playgroud)
这会抛出错误" null value violates not-null constraint
"
作为一个临时的解决方法,我检查是否$value
为空,并将其更改为" "
(单个空格),但这是一个可怕的黑客,可能会导致其他问题.
我怎么应该用准备好的语句插入空字符串,而不试图插入NULL?
编辑:通过我的整个代码库是一个太大的项目,找到使用空字符串""的所有地方,并改为使用NULL代替.我需要知道的是,为什么标准MySQL查询将""和NULL视为两个独立的东西(我认为是正确的),但是预处理语句将""转换为NULL.
请注意,""和NULL 不是一回事.例如,SELECT NULL = "";
返回NULL
而不是1
您期望的.
我有一个由Github组织插件创建的Jenkins构建工作.在Jenkinsfile
此构建检出使用的代码checkout scm
,这是很好,因为它无论是建设PR引起的变化或推到主分支时,计算出正确的分支/修订结帐.
我怎么能这样做:
node {
checkout scm
}
Run Code Online (Sandbox Code Playgroud)
结帐子模块?
我有一个Git repo,它是来自另一个Git repo的克隆,它是来自巨型SVN repo的克隆.我们可以从SVN更新其他Git repo并从它提交到SVN,但是与另一个用户一起提交.
我想用我自己的用户直接将我的本地提交发布到SVN repo.
这就是我尝试过的:我手动创建了git-svn
分支,将其添加到.git/config
[branch "master"]
[svn-remote "svn"]
url = https://url/to/svn/trunk/repo_name
fetch = :refs/remotes/git-svn
Run Code Online (Sandbox Code Playgroud)
然后git svn fetch
,下载了32k提交.
但我最终得到了两个不相关的历史:
674c35a
,表示原始克隆点处的SVN repo的状态.master
始终与SVN同步(通过其他Git仓库).dev
有我们目前的发展,应该合并master
(通常被压扁),然后回到SVN回购.fb1b9c7
] 克隆的提交(但只有前一次提交的diff,而不是整个repo作为开始提交).git/origin/master
.我如何告诉Git启动commit(674c35a
)实际上与SVN commit(fb1b9c7
)相同?那么Git可以以某种方式理解master
克隆之后的提交实际上是一样的git-svn
吗?
我试图改变--onto
,如这里所解释的那样,但这不是我想要的(提交不在分支的顶部).
git ×3
c# ×2
php ×2
.net ×1
arrays ×1
asp.net-mvc ×1
attributes ×1
curl ×1
foreach ×1
git-svn ×1
groovy ×1
html ×1
javascript ×1
jenkins ×1
mysql ×1
mysqli ×1
nullable ×1
paypal ×1
reflection ×1