我正在尝试使用Maven Failsafe插件来运行此配置的集成测试:
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.7.1</version>
<executions>
<execution>
<id>integration-test</id>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
<execution>
<id>verify</id>
<goals>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.7</version>
<configuration>
<connectors>
<connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
<port>8080</port>
<maxIdleTime>3600000</maxIdleTime>
</connector>
</connectors>
<contextPath>/</contextPath>
<scanIntervalSeconds>3</scanIntervalSeconds>
<scanTargetPatterns>
<scanTargetPattern>
<directory>src/main/webapp/WEB-INF</directory>
<excludes>
<exclude>**/*.jsp</exclude>
<exclude>**/*.html</exclude>
</excludes>
<includes>
<include>**/*.page</include>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
</scanTargetPattern>
</scanTargetPatterns>
</configuration>
<executions>
<execution>
<id>start-jetty</id>
<phase>pre-integration-test</phase>
<goals>
<goal>run-war</goal>
</goals>
<configuration>
<scanIntervalSeconds>0</scanIntervalSeconds>
<daemon>true</daemon>
</configuration>
</execution>
<execution>
<id>stop-jetty</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
一切都很好,直到Jetty在预集成测试阶段开始.然后没有任何事情发生,好像在等待什么.最后一行说:
[INFO] Started Jetty Server
如何让测试在之后开始?我用maven运行maven mvn verify.
我知道如何使用Graphics类型的对象(至少我能够渲染图像)但我总是通过传递从OnPaint方法检索的图形对象来做到这一点.
我想在应用程序打开时显示图像(即在Form_Load方法中),但不知道如何获取我可以使用的Graphics对象的实例?谢谢
我有一个处理程序的服务,必须每5秒在logcat中写入"Hello".但是它没有在logcat上写任何内容......就像服务没有执行一样,我在它上面放了一个断点,调试模式永远不会在断点上停止.
我在我的应用程序的第一个活动中启动了这项服务:
startService(new Intent(GPSLoc.this, MyServiceNotifications.class)); //enciendo el service
Run Code Online (Sandbox Code Playgroud)
我确信代码startService已执行,因为它在启动另一个活动之前被调用,而另一个活动开始.
这是我的服务代码:
public class MyServiceNotifications extends Service {
boolean serviceStopped;
private Handler mHandler;
private Runnable updateRunnable = new Runnable() {
@Override
public void run() {
if (serviceStopped == false)
{
createNotificationIcon();
}
queueRunnable();
}
};
private void queueRunnable() {
// 600000 : cada 10 minutos, comprueba si hay nuevas notificaciones y actualiza la
// notification BAR
mHandler.postDelayed(updateRunnable, 5000);
}
@Override
public IBinder onBind(Intent intent) {
return null;
}
@Override
public …Run Code Online (Sandbox Code Playgroud) 我有以下代码,我基于msdn网站上的Monitor类示例.
private void WebRefresh_Click(object sender, EventArgs e)
{
if (WebRefresh.Enabled)//Only call from button
{
if (System.Threading.Monitor.TryEnter(deployIsRunning))
{
refreshWebVersion();
System.Threading.Monitor.Exit(deployIsRunning);
}
}
else
{
MessageBox.Show("You cannot refresh during a deploy");
}
}
Run Code Online (Sandbox Code Playgroud)
代码在Monitor.Exit()调用上抛出SynchronizationLockException,并显示错误消息:"对象同步方法是从未同步的代码块调用的." 错误的解释是我试图释放一个我不拥有的互斥锁,但我无法进入Exit被调用的代码块,除非TryEnter成功.如何删除此错误?
我试图通过MVC模型将Form发布到控制器中的Save函数中.我也在客户端使用tinymce,这导致基于HTML代码的字符串如此<p> Content text blah blah ...</p>.
问题是我不能发布包含的字符串<p> something </p>但令人惊讶的是,< p > something < / p >这个字符串(在"<"之后带有空格)没有问题.但是,我无法处理这个HTML代码并在每次发布之前创建这些空格.肯定有更好的办法.
那么,我如何通过$ .post方法发布包含HTML代码的字符串?(如果你必须知道,这个项目是一个内容管理系统.所以,我必须将基于HTML的内容文本保存到SQL表中.)我通过调试看到,后期操作甚至没有到达控制器,我认为这是一个唯一的JavaScript问题,我是对的吗?
这是我正在使用的代码:
Javascript
function JqueryFromPost(formId) {
var form = $(formId);
var action = form.attr("action");
var serializedForm = form.serializeArray();
$.post(action, serializedForm, function (data) {
//Getting the data Result here...
});
}
CS代码
[HttpPost]
public JsonResult SaveArticle(ArticleModel model)
{
JsonResult JResult = new JsonResult();
if (ModelState.IsValid)
//I do the saving here ending with "JResult.Data = … 是否真的不可能在jar文件中隐藏某些类?
我希望不允许直接实例化类以使其更灵活.这个罐子里只能看到工厂(或立面).
除了创建两个项目之外,还有其他办法解决这个问题吗?(两个项目:第一个包含类(实现),另一个引用第一个并包含工厂;后面只引用第二个)
在我的一个应用程序中,我有一个这样的代码:
<ProgressBar Grid.Column="0" Grid.Row="0" HorizontalAlignment="Stretch" Height="27" Margin="5,0,5,0" Maximum="{Binding TabuProgressEnd}" Value="{Binding TabuProgress}" />
Run Code Online (Sandbox Code Playgroud)
虽然我在测试这一切都没问题,但是当我的客户端在VS下打开它并运行此代码时抛出异常:
An unhandled exception of type 'System.InvalidOperationException' occurred in PresentationFramework.dll
Additional information: A TwoWay or OneWayToSource binding cannot work on the read-only property 'TabuProgress' of type 'TSPLib.TabuEngine'.
Run Code Online (Sandbox Code Playgroud)
通常我会认为这是某种骗局,但我知道这个家伙不知道编码并使"Mode = OneWay"明确有帮助.不同机器上的默认绑定模式有何不同?
我在mysql数据库中有一个包含3列的表:id,value和tstamp.我的tstamp列采用TIMESTAMP格式,即:2011-01-21 08:32:22
我希望实现的是使用PHP来显示每天总计的细分.我想不出一种查询表的方法,用伪代码:从表组中选择*按天(tstamp的一部分)并从每天的值列中添加所有数字"
这有可能吗?
非常感谢
编辑:
我将这个查询与接受的答案代码组合在一起:
$sql = "select date(tstamp), sum(".$column.") from mash group by date(tstamp)";
$result = mysql_query($sql);
while($row = mysql_fetch_array($result)){
$strXML .= "<set name='".date("G:i:s", strtotime($row["date"])). "' value='".$row["sum"]."' color='AFD8F8' />";
}
Run Code Online (Sandbox Code Playgroud)
如何正确访问$ row中的数组值?
今天我面临一个奇怪的挑战......
这个挑战涉及两个我需要从我的应用程序引用的.NET库.我无法控制其中的两个并且在其中具有相同的命名空间.
所以...
我有foo.dll它包含一个Widget位于Blue.Red.Orange命名空间的类.
我有bar.dll它也包含一个Widget也位于Blue.Red.Orange命名空间的类.
最后,我有我的应用程序需要同时引用foo.dll和bar.dll.这需要在我的应用程序中我需要使用Widget来自的类foo以及Widget来自的类bar
所以,问题是如何管理这些引用,以便我可以确定我使用的是正确的Widget类?
如上所述,我无法控制foo或bar库,它们是什么,不能改变.但我确实可以完全控制我的应用程序.
我想避免在每个新的Debian 6安装上安装bash.所以我需要将所有bash脚本转换为dash.
- 你会怎么做?
- 两种语言有什么区别?
- 你知道任何警告和陷阱吗?
- 是否可以自动执行该任务?