我正在尝试使用GWT,我对它很新.在doc之后,我尝试为Eclipse安装GWT插件,但后来我收到一条错误消息:
Cannot complete the install because one or more required items could not be found.
Software being installed: Google Plugin for Eclipse 3.7 3.0.1.v201206290132-rel-r37
(com.google.gdt.eclipse.suite.e37.feature.feature.group 3.0.1.v201206290132-rel-r37)
Missing requirement: Google Plugin for Eclipse 3.7 3.0.1.v201206290132-rel-r37
(com.google.gdt.eclipse.suite.e37.feature.feature.group 3.0.1.v201206290132-rel-r37)
requires 'org.mortbay.jetty.server 0.0.0' but it could not be found"
Run Code Online (Sandbox Code Playgroud)
我试图找到org.mortbay.jetty.server可以解决的问题,但我没有找到.有人知道吗?
Index.html(查看)
<div class="categories_content_container">
@Html.Action("_AddCategory", "Categories")
</div>
Run Code Online (Sandbox Code Playgroud)
_AddCategory.cshtml(PartialView)
<script>
$(document).ready(function () {
$('input[type=submit]').click(function (e) {
e.preventDefault();
$.ajax({
type: "POST",
url: '@Url.Action("_AddCategory", "Categories")',
dataType: "json",
data: $('form').serialize(),
success: function (result) {
$(".categories_content_container").html(result);
},
error: function () {
}
});
});
});
</script>
@using (Html.BeginForm())
{
// form elements
}
Run Code Online (Sandbox Code Playgroud)
调节器
[HttpPost]
public ActionResult _AddCategory(CategoriesViewModel viewModel)
{
if(//success)
{
// DbOperations...
return RedirectToAction("Categories");
}
else
{
// model state is not valid...
return PartialView(viewModel);
}
}
Run Code Online (Sandbox Code Playgroud)
问题:如果操作成功,我希望重定向到另一个页面(类别).但没有动作,没有错误信息.如果操作不成功,它就像我预期的那样工作.
我怎样才能做到这一点?如何使用AJAX帖子路由另一个页面?
问题是:
什么是将多行字符串存储到变量中的JavaScript方法,就像在PHP中一样?
我正在寻找在Javascript中实现的Vi变体.
不幸的是,我已经获得了配置Vim以编写JavaScript代码的所有类型的结果.
我发现的唯一有用的结果是JSVI.
问题:我应该研究其他任何(也许是更现代的)感受吗?
我想声明一个可以从多个C文件访问的常量数组,其内容可以由编译器内联,而不需要在多个编译单元中复制内存.性能在我的应用中至关重要.
图表1:
header.h:
static const int arr[2] = { 1, 2 };
file1.c:
#include "header.h"
void file1() { printf("%d\n", arr[0]); }
file2.c:
#include "header.h"
int file2() { for (int i = 0; i < 2; i++) printf("%d\n", arr[i]); }
Run Code Online (Sandbox Code Playgroud)
在这种情况下,编译器可以替代arr[0]由1file1中.但是,自arr声明以来static const,它的内存在两个C文件中都是重复的.AFAIK C标准要求两个文件中的阵列地址不同.我在Linux下通过打印地址验证了这一点.即使-fmerge-all-constants在gcc中也不会发生链接器合并.
图表2:
header.h:
extern const int arr[2];
file1.c:
#include "header.h"
void file1() { printf("%d\n", arr[0]); }
file2.c:
#include "header.h"
const int arr[2] = { 1, 2 };
int file2() …Run Code Online (Sandbox Code Playgroud) 我有一个关于clone()Java中的方法的快速问题,用于super.clone()继承 - 我clone()从父按钮中一直调用父类中的方法.
该clone()方法应该返回该对象的副本,但是如果我在继承heirachy中有三个类并且调用super.clone()三次,为什么继承heirachy中的最高类(仅在类Object下)得到该类的副本回?
假设我们有三个类:A,B和C,其中A - > B - > C(inherit = - >)
然后super.clone()在C类中调用,调用clone()B调用super.clone(),clone()在A中调用,调用super.clone()'this this Object.clone()被调用'.为什么它不是this从A类返回的对象的副本Object.clone()?这听起来很合乎逻辑.
请采取以下措施:
char buffer[512];
memset(buffer, 0, sizeof(buffer));
sprintf(&buffer[0],"This Is The Longest String In the World that in text goes on and..");
printf("Buffer:%s\r\n",buffer);
Run Code Online (Sandbox Code Playgroud)
我希望能够在多行上创建此字符串,以便于故障排除和编辑.但是,当我使用\命令时,我的输出被看似是标签的东西分开了?
例:
sprintf(&buffer[0],"This Is The\
Longest String In the World\
that in text goes on and..");
Run Code Online (Sandbox Code Playgroud)
产生一个输出:
Buffer:This Is The Longest String In the World that in text goes on and..
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?这只是一种尝试在多行代码中分解字符串的错误方法吗?
我在将MsBuild package + deploy命令分成两个单独的命令时遇到了一些问题.(我需要这样做才能将其他参数传递给MsDeploy).
工作正常的命令如下所示:
msbuild "src\Solution.sln"
/P:Configuration=Deploy-Staging
/P:DeployOnBuild=True
/P:DeployTarget=MSDeployPublish
/P:MsDeployServiceUrl=https://192.168.0.1:8172/MsDeploy.axd
/P:DeployIISAppPath=staging.website.com
/P:AllowUntrustedCertificate=True
/P:MSDeployPublishMethod=WmSvc
/P:CreatePackageOnPublish=True
/P:UserName=staging-deploy
/P:Password=xyz
Run Code Online (Sandbox Code Playgroud)
分离的打包命令如下所示:
msbuild "src\Solution.sln"
/P:Configuration=Deploy-Staging
/P:DeployOnBuild=True
/P:DeployTarget=Package
/P:_PackageTempDir=C:\temp\web
Run Code Online (Sandbox Code Playgroud)
哪个工作正常.但接下来是MsDeploy部分:
msdeploy
-verb:sync
-allowUntrusted
-usechecksum
-source:manifest=
'src\WebProject\obj\Deploy-Staging\Package\WebProject.SourceManifest.xml'
-dest:auto,ComputerName=
'https://192.168.0.1:8172/MsDeploy.axd?site=staging.website.com',
username='staging-deploy',password='xyz',authType='basic',includeAcls='false'
-enableRule:DoNotDeleteRule
Run Code Online (Sandbox Code Playgroud)
失败,WmSvc.log中出现以下错误
wmsvc.exe Error: 0 : Attempted to perform an unauthorized operation.
setAcl/C:\temp\web (Read)
ProcessId=15784
ThreadId=31
DateTime=2011-03-30T14:57:02.4867689Z
Timestamp=3802908721815
wmsvc.exe Error: 0 : Not authorized.
Details: No rule was found that could authorize user 'staging-deploy',
provider 'setAcl', operation 'Read', path 'C:\temp\web'.
Run Code Online (Sandbox Code Playgroud)
(还有几个读/写操作)
它试图访问的路径显然出现了问题(因为它可以正常使用其他方法) - 我不确定它是否正在尝试正确使用iisApp定位,而且目前我认为没有正确的网络.config也将被部署.
我一直试图通过Python上的OpenCV获得单色blob跟踪.下面的代码工作正常,但它找到了所有跟踪像素的质心,而不仅仅是最大blob的质心.这是因为我正在拍摄所有像素的时刻,但我不确定如何进行色彩跟踪.我有点困惑于我需要做什么才能使这个单一的blob跟踪器而不是多blob平均值.
这是代码:
#! /usr/bin/env python
#if using newer versions of opencv, just "import cv"
import cv2.cv as cv
color_tracker_window = "Color Tracker"
class ColorTracker:
def __init__(self):
cv.NamedWindow( color_tracker_window, 1 )
self.capture = cv.CaptureFromCAM(0)
def run(self):
while True:
img = cv.QueryFrame( self.capture )
#blur the source image to reduce color noise
cv.Smooth(img, img, cv.CV_BLUR, 3);
#convert the image to hsv(Hue, Saturation, Value) so its
#easier to determine the color to track(hue)
hsv_img = cv.CreateImage(cv.GetSize(img), 8, 3)
cv.CvtColor(img, hsv_img, cv.CV_BGR2HSV)
#limit all …Run Code Online (Sandbox Code Playgroud)