我刚刚开始使用Play Framework.我已经下载并安装了play并创建了一个示例java应用程序.当我尝试在应用程序目录中启动播放控制台时,它会挂起"正在加载项目定义".
PS C:\dev\play\javatest> play.bat
Getting org.scala-sbt sbt_2.9.1 0.11.3 ...
:: retrieving :: org.scala-sbt#boot-app
confs: [default]
37 artifacts copied, 0 already retrieved (7245kB/283ms)
[info] Loading project definition from C:\dev\play\myFirstApp\project
Run Code Online (Sandbox Code Playgroud)
当我尝试运行Scala应用程序时,我收到有关它等待锁定的消息:
PS C:\dev\play\scalatest> play
[info] Loading project definition from C:\dev\play\test1\project
Waiting for lock on C:\lib\play\repository\.sbt.ivy.lock to be available...
Run Code Online (Sandbox Code Playgroud)
运行Windows 7,JDK 1.7.0_05和Play Framework 2.0.2.有任何想法吗?
我有两个分支,默认和branch1.我们团队中的一个人错误地将branch1合并.branch1中的内容尚未准备好与默认值合并(它包含构建和部署环境的主要返工).
我们做了'hg backout'的实验,退出合并(不确定这是正确的方法).然后从默认情况下删除branch1中的更改,这很好 - 但我们不能使用branch1重新合并.
我们该如何解决这个问题?
我有一个Play Framework 2.0应用程序,我想在Windows Server 2008 R2上部署(生产).如何让它作为服务运行?
windows-server-2008 windows-server-2008-r2 playframework playframework-2.0
我正在尝试让MSDeploy在远程服务器上执行PowerShell脚本.这是我执行MSDeploy的方式:
msdeploy \
-verb:sync \
-source:runCommand='C:\temp\HelloWorld.bat', \
waitInterval=15000,waitAttempts=1 \
-dest:auto,computername=$WebDeployService$Credentials -verbose
Run Code Online (Sandbox Code Playgroud)
HelloWorld.bat包含:
echo "Hello world!"
powershell.exe C:\temp\WebDeploy\Package\HelloWorld.ps1
echo "Done"
Run Code Online (Sandbox Code Playgroud)
HelloWorld.ps1仅包含:
Write-Host "Hello world from PowerShell!"
Run Code Online (Sandbox Code Playgroud)
但是,似乎PowerShell永远不会终止.这是运行msdeploy的输出:
Verbose: Performing synchronization pass #1.
Verbose: Source runCommand (C:\temp\HelloWorld.bat) does not match destination (C:\temp\HelloWorld.bat) differing in attributes (isSource['True','False']). Update pending.
Info: Updating runCommand (C:\temp\HelloWorld.bat).
Info:
Info: C:\temp>echo "Hello world!"
"Hello world!"
C:\temp\WebDeploy>powershell.exe C:\temp\HelloWorld.ps1
Info: Hello world from Powershell!
Info:
Warning: The process 'C:\Windows\system32\cmd.exe' (command line '/c "C:\Users\peter\AppData\Local\Temp\gaskgh55.b2q.bat
"') is still running. Waiting for 15000 …Run Code Online (Sandbox Code Playgroud) 我很想知道其他人如何处理使用官方RabbitMQ java客户端库从错误连接中恢复的问题.我们正在使用它将我们的应用程序服务器连接到我们的RabbitMQ集群,我们已经实现了几种不同的方法来从连接失败中恢复,但是他们感觉不是很正确.
想象一下这个伪应用程序:
public class OurClassThatStartsConsumers {
Connection conn;
public void start() {
ConnectionFactory factory = new ConnectionFactory();
factory.setUsername("someusername");
factory.setPassword("somepassword");
factory.setHost("somehost");
conn = factory.newConnection();
new Thread(new Consumer(conn.createChannel())).start();
}
}
class Consumer1 implements Runnable {
public Consumer1(Channel channel) {
this.channel = channel;
}
@Override
public void run() {
while (true) {
... consume incoming messages on the channel...
// How do we handle that the connection dies?
}
}
}
Run Code Online (Sandbox Code Playgroud)
在现实世界中,我们有数百名消费者.那么如果连接死了怎么办?在上面的示例中,Consumer1无法恢复,当连接关闭时,Channel也会关闭,这是我们无法恢复的状态.那么让我们看看解决这个问题的一些方法:
解决方案A)
让每个消费者拥有自己的连接,并注册连接死亡时触发的事件,然后处理重新连接.
优点:它的工作原理
缺点:
解决方案B)
让每个消费者使用相同的连接并订阅它的连接失败事件.
优点:比解决方案A更少的连接
缺点:由于连接已关闭,我们需要重新打开/替换它.java客户端库似乎没有提供重新打开连接的方法,因此我们必须用新连接替换它,然后以某种方式通知所有消费者这个新连接,他们将不得不重新创建频道和消费者.再一次,我不希望在消费者中看到的许多逻辑最终存在. …
升级到Visual Studio 2012后,我无法再访问任何ApiControllers,引发以下错误:
Server Error in '/' Application.
Method not found: 'Void System.Net.Http.Headers.HttpHeaders.AddWithoutValidation(System.String, System.Collections.Generic.IEnumerable`1<System.String>)'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.MissingMethodException: Method not found: 'Void System.Net.Http.Headers.HttpHeaders.AddWithoutValidation(System.String, System.Collections.Generic.IEnumerable`1<System.String>)'.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be …Run Code Online (Sandbox Code Playgroud) 有没有办法在项目中启用所有JSP文件的编译/验证?我正在做一个大的重构,并希望确保我不会破坏任何JSP文件.
我对下面脚本的行为感到有点困惑:
Test.ps1:
param(
[array]$Value = $(throw "Give me a value")
)
Write-Host $Value
$Value | Get-Member -MemberType Method
$Value.ToUpper()
Run Code Online (Sandbox Code Playgroud)
运行脚本:
PS C:\Temp> .\weird.ps1 test
TypeName: System.String
Name MemberType Definition
—- ———- ———-
…
ToUpper Method string ToUpper(), string ToUpper(System.Globalization.CultureInfo culture)
…
Method invocation failed because [System.Object[]] doesn’t contain a method named ‘ToUpper’.
At C:\Temp\weird.ps1:6 char:15
+ $Value.ToUpper <<<< ()
+ CategoryInfo : InvalidOperation: (ToUpper:String) [], RuntimeException
+ FullyQualifiedErrorId : MethodNotFound
Run Code Online (Sandbox Code Playgroud)
为什么我得到一个MethodNotFound异常?Get-Member清楚地说它是一个字符串.
在我的一台服务器上,命令New-WebSite今天停止工作(昨天工作正常),抛出异常"索引超出了数组的范围".
PS C:\Windows\system32> Import-Module WebAdministration
PS C:\Windows\system32> New-WebSite -Blah
New-Item : Index was outside the bounds of the array.
+ CategoryInfo : NotSpecified: (:) [New-Item], IndexOutOfRangeException
+ FullyQualifiedErrorId : System.IndexOutOfRangeException,Microsoft.PowerShell.Commands.NewItemCommand
Run Code Online (Sandbox Code Playgroud)
有谁知道这可能导致了什么?
在C#中有一个非常方便的东西叫做方法组,基本上不是写:
someset.Select((x,y) => DoSomething(x,y))
Run Code Online (Sandbox Code Playgroud)
你可以写:
someset.Select(DoSomething)
Run Code Online (Sandbox Code Playgroud)
Scala中有类似的东西吗?
例如:
int DoSomething(int x, int y)
{
return x + y;
}
int SomethingElse(int x, Func<int,int,int> f)
{
return x + f(1,2);
}
void Main()
{
Console.WriteLine(SomethingElse(5, DoSomething));
}
Run Code Online (Sandbox Code Playgroud)