问候,我正在尝试将一些Beanshell脚本放在我的Ant build.xml文件中.我一直遵循Ant手册,但是当我运行Ant时,我一直得到"无法为beanshell创建javax脚本引擎".以下是我主要从Ant手册中的示例编写的测试目标:
<target name="test-target">
<script language="beanshell" setbeans="true">
<classpath>
<fileset dir="c:\TEMP" includes="*.jar" />
</classpath>
System.out.println("Hello world");
</script>
</target>
Run Code Online (Sandbox Code Playgroud)
我的beanshell"bsh-2.0b4.jar"文件在手册推荐的方式上位于脚本任务的类路径中.希望我有正确的文件.我现在正在c:\ TEMP工作.我一直在谷歌搜索并尝试一段时间.任何想法将不胜感激.谢谢.
我的Windows 7机器上的垂直JSlider上的旋钮(具有原生外观)在两个方向上真的很小.不仅是瘦,还有短.替代文字http://img101.imageshack.us/img101/8946/verticalsliderproblemwi.jpg
谁能证实这一点?我应该报告吗?如果是的话,在哪里?谢谢!
以下是示例程序的代码(在屏幕截图中):
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JSlider;
import javax.swing.SwingConstants;
import javax.swing.UIManager;
public class SliderTest
{
public static void main( String[] args )
{
// Set the look and feel to that of the system
try
{ UIManager.setLookAndFeel( UIManager.getSystemLookAndFeelClassName() ); }
catch ( Exception e )
{ System.err.println( e ); }
// Launch the GUI from the event dispatch thread
javax.swing.SwingUtilities.invokeLater( new Runnable()
{
public void run ()
{
JFrame window = new JFrame();
window.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); …Run Code Online (Sandbox Code Playgroud) 我有很多脚本.在进行更改后,我喜欢运行它们以查看是否有任何损坏.我写了一个脚本来循环遍历每个,在新数据上运行它.
在我的循环中,我正在运行powershell.exe -command <path to script>.我不知道这是否是最好的方法,或者两个实例是否彼此完全分开.
在一个干净的PowerShell实例中运行脚本的首选方法是什么?或者我应该说"会话"?
根据参考手册,MySQL客户端具有以下命令:
ego(\ G)发送命令到mysql服务器,垂直显示结果.
...
每个命令都有长短形式.长形式不区分大小写; 简短的形式是.长格式后面可以跟一个可选的分号终止符,但是短格式不应该.[资源]
我只是在命令行客户端和\ G表单工作:
select * from company \G
Run Code Online (Sandbox Code Playgroud)
如果我愿意,我如何使用长"自我"形式?它在命令行客户端中有效吗?我只是想不出来,谷歌没有发现任何事情.
谢谢!
我正在使用String设置XML属性,PowerShell告诉我"只有字符串可以用作设置XmlNode属性的值".这是一个简单的例子.首先,我运行这个:
$xmlDoc = [xml]@"
<root>
<ComponentRef Id="a" />
</root>
"@
$newId = "b"
$length = $newId.Length
Write-Host ("`n`$newId is a string, see: `$newId.GetType().FullName = " + $newId.GetType().FullName + "`n")
Write-Host ("Running `"`$xmlDoc.root.ComponentRef.Id = `$newId`"...`n")
$xmlDoc.root.ComponentRef.Id = $newId
Write-Host ("ComponentRef.Id is now: " + $xmlDoc.root.ComponentRef.Id)
Run Code Online (Sandbox Code Playgroud)
对我来说,输出是:
$newId is a string, see: $newId.GetType().FullName = System.String
Running "$xmlDoc.root.ComponentRef.Id = $newId"...
Cannot set "Id" because only strings can be used as values to set XmlNode properties.
At D:\Build\Tools\mass processing\Untitled4.ps1:14 char:27
+ $xmlDoc.root.ComponentRef. <<<< Id …Run Code Online (Sandbox Code Playgroud) 简而言之,我创建了一个Word VSTO插件,它可以在许多机器上完美运行,但无法仅在一台机器上加载.我不知道问题是在程序集名称中,还是缺少DLL.
如何完成以及错误消息的详细信息如下:
1- IDE:Microsoft Visual Studio社区2013.
2- Office版本安装:2010年适用于所有机器
3-使用的.NET框架:4.0.
4-目标计算机安装了vstor_redist.exe文件.
5-安装VSTO文件的方法是将VSTO复制到程序文件中,然后运行它.这适用于所有机器,即使是那些无法加载添加的机器.
6- Addin有一个色带控件.不知道这是否对此事有任何影响.
7-开发机器:windows 7 64bit
8-测试机器:windows 7 64bit.(即使是无法加载插件的那个)
9-当程序集仅为一台机器加载时,我得到的错误信息是:
Could not load file or assembly 'IDMSWord2010AddinProject, Version=4.3.0.0, Culture=neutral, PublicKeyToken=83105d2b5774c812' or one of its dependencies. The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)
************** Exception Text **************
System.IO.FileLoadException: Could not load file or assembly 'IDMSWord2010AddinProject, Version=4.3.0.0, Culture=neutral, PublicKeyToken=83105d2b5774c812' or one of its dependencies. The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047) …Run Code Online (Sandbox Code Playgroud) 我正在运行TeamCity 5.我有一个特殊的配置,保留了3500多个过去的版本,带有工件,从去年开始.它占用了近7个空间,所以我需要清理旧版本.
配置设置为清除超过30天或5个版本的所有内容.没有任何构建被固定.服务器上的配置都不依赖于工件,即使它们确实存在,我也没有设置"防止依赖项工件清理".其他构建配置清理,但这个特定的配置没有.
谁有关于下一步检查的想法?
我不知道为什么我发现这么难.从特定的注册表项下,我想根据数据(而不是名称)查询某些注册表值,并删除生成的注册表值.
例如:

如何删除此键中包含的任何值,例如"foo".我可以列出注册表值Get-ItemProperty 'HKCU:\Software\Policies\Google\Chrome\RestoreOnStartupURLs',但它将一些垃圾与实际数据混合在一起:
1 : http://foo.example.com
2 : http://bar.example.com
PSPath : Microsoft.PowerShell.Core\Registry::HKEY_CURRENT_USER\Software\Policies\Google\Chrome\RestoreOnStartupURLs
PSParentPath : Microsoft.PowerShell.Core\Registry::HKEY_CURRENT_USER\Software\Policies\Google\Chrome
PSChildName : RestoreOnStartupURLs
PSDrive : HKCU
PSProvider : Microsoft.PowerShell.Core\Registry
Run Code Online (Sandbox Code Playgroud)
我试图管道Where-Object但无法找到有效的查询.然后我需要一个Remove-可以处理结果的cmdlet.有人有主意吗?
我来到了我的PoweShell-fu的边缘.有人可以向我解释为什么这两个函数在管理数组数组时会有不同的行为吗?所有不同的是我是使用$_还是[parameter(ValueFromPipeline=$true)] $input获取管道输入.我希望那些人在这种情况下行事相同.
$pairs = ('a', 'b'), ('c', 'd')
function dollarUnderscoreFunction
{
Process
{
Write-Host "`$_[0] = $($_[0])"
Write-Host "`$_[1] = $($_[1])"
}
}
function pipedParameterFunction([parameter(ValueFromPipeline=$true)] $input)
{
Process
{
Write-Host "`$input[0] = $($input[0])"
Write-Host "`$input[1] = $($input[1])"
}
}
Write-Host "`$pairs:"
$pairs | foreach { Write-Host $_ }
Write-Host "`nRunning dollarUnderscoreFunction`n"
$pairs | dollarUnderscoreFunction
Write-Host "`nRunning pipedParameterFunction`n"
$pairs | pipedParameterFunction
Run Code Online (Sandbox Code Playgroud)
PowerShell v3中的输出:
$pairs:
a b
c d
Running dollarUnderscoreFunction
$_[0] = a
$_[1] = b
$_[0] …Run Code Online (Sandbox Code Playgroud) 我在这里遵循示例代码来了解异步任务.我修改了代码来编写任务工作与主要工作的一些输出.输出将如下所示:

我注意到,如果我删除Wait()调用,程序运行相同,除了我无法捕获任务被取消时抛出的异常.有人可以解释在需要Wait()的幕后发生了什么才能击中catch块吗?
一个警告,Visual Studio调试器将错误地停止Console.WriteLine(" - task work");在行上,并显示消息"OperationCanceledException未被用户代码处理".当发生这种情况时,只需单击继续或按F5查看程序的其余部分.有关详细信息,请参见http://blogs.msdn.com/b/pfxteam/archive/2010/01/11/9946736.aspx.
using System;
using System.Threading;
using System.Threading.Tasks;
namespace ConsoleApplication1
class Program
{
static void Main()
{
var tokenSource = new CancellationTokenSource();
var cancellationToken = tokenSource.Token;
// Delegate representing work that the task will do.
var workDelegate
= (Action)
(
() =>
{
while (true)
{
cancellationToken.ThrowIfCancellationRequested();
// "If task has been cancelled, throw exception to return"
// Simulate task work
Console.WriteLine(" - task work"); //Visual Studio
//erroneously stops …Run Code Online (Sandbox Code Playgroud) c# asynchronous exception-handling .net-4.0 task-parallel-library
powershell ×4
java ×2
.net ×1
.net-4.0 ×1
ant ×1
asynchronous ×1
beanshell ×1
c# ×1
mysql ×1
registry ×1
swing ×1
teamcity ×1
vsto ×1
windows-7 ×1
word-addins ×1