我有两个Xpath表达式......
//*[@id='gutter']/p[strong[text()='Date:']]/text()
//*[@id='gutter']/p[strong[text()='Time:']]/text()
Run Code Online (Sandbox Code Playgroud)
如何编写一个结合上述两个的xpath表达式,并返回与单独运行上述每个表达式相同的元素?
在试图使用来自clojure的weka时,我试图使用clojure的java互操作特性将这个howto指南从weka wiki 转换为clojure.
到目前为止,这种方法运作良好,除了在一种情况下,clojure反射机制似乎无法找到正确的调用方法 - 我有:
(def c-model (doto (NaiveBayes.) (.buildClassifier is-training-set)))
Run Code Online (Sandbox Code Playgroud)
稍后这将由类的.evaluateModel
方法调用Evaluation
:
(.evaluateModel e-test c-model is-testing-set)
Run Code Online (Sandbox Code Playgroud)
where e-test
是类型weka.classifiers.Evaluation
和,根据他们的api文档,该方法采用两个类型Classifier
和参数Instances
我从clojure得到的是IllegalArgumentException No matching method found: evaluateModel for class weka.classifiers.Evaluation clojure.lang.Reflector.invokeMatchingMethod (Reflector.java:53)
- 我想这是因为c-model
实际上是类型NaiveBayes
,虽然它也应该是Classifier
- 它是,它是,根据instance?
.
我尝试施放cast
无济于事,据我所知,这更像是一种类型断言(并且当然没有问题),而不是真正的魔法施法.是否有另一种方法明确告诉clojure在java互操作方法调用中要转换哪些类型?(请注意,我上面链接的原始指南也使用了来自的显式强制NaiveBayes
转换Classifier
)
完整代码在这里:/ http://paste.lisp.org/display/129250
我的命令行 Ruby 程序的一部分涉及在处理任何命令之前检查是否有互联网连接。程序中的实际检查是微不足道的(使用 Socket::TCPSocket),但我正在尝试在 Cucumber 中测试此行为以进行集成测试。
编码:
def self.has_internet?(force = nil)
if !force.nil? then return force
begin
TCPSocket.new('www.yelp.co.uk', 80)
return true
rescue SocketError
return false
end
end
if has_internet? == false
puts("Could not connect to the Internet!")
exit 2
end
Run Code Online (Sandbox Code Playgroud)
特点:
Scenario: Failing to log in due to no Internet connection
Given the Internet is down
When I run `login <email_address> <password>`
Then the exit status should be 2
And the output should contain "Could not connect to the Internet!" …
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用同一个表中不同行(和不同列)的值来更新表中的行.虽然我的语法没有产生任何结果:这是代码(更新):
UPDATE table1 AS t1 INNER JOIN
(SELECT field_id_46,field_id_47 FROM table1 WHERE entry_id = 36) AS t2
SET t1.field_id_60 = t2.field_id_46, t1.field_id_61 = t2.field_id_47
WHERE t1.entry_id = 45;
Run Code Online (Sandbox Code Playgroud) 我有一个单词列表,每个单词都在自己的行上.这是表格的第一列.我想手工创建第二列.
我现在想使用一些插件,这将在文本周围创建一个ASCII表,所以我有很好的格式(每列中的起始字母应该在一个"垂直线"或我应该能够快速移动到一个快捷方式的正确位置).
是否有这样的vim插件,可以简化编辑这样的表并控制格式?
更新:我正在重新编写Android 3.0之前的兼容性原始帖子.
我正在尝试创建一个简单的通知,除了灯光之外的所有功能都很棒.当通知触发时,我确实关闭了屏幕.使用此弃用的代码声音和振动适用于Android 4.0(Galaxy Nexus)和Android 2.3(HTC EVO).
在4.0 Galaxy Nexus上,灯不起作用.
Notification notification =
new Notification(R.drawable.ic_launcher, "My Ticker!",System.currentTimeMillis());
notification.setLatestEventInfo(context, "My Title", "My Message", pendingIntent);
notification.defaults |= Notification.DEFAULT_SOUND;
notification.defaults |= Notification.DEFAULT_VIBRATE;
//notification.defaults |= Notification.DEFAULT_LIGHTS;
notification.ledARGB = 0xff00ff00;
notification.ledOnMS = 300;
notification.ledOffMS = 1000;
notification.flags |= Notification.FLAG_SHOW_LIGHTS;
notification.flags |= Notification.FLAG_AUTO_CANCEL;
Run Code Online (Sandbox Code Playgroud)我还尝试了不属于v4兼容性库的新API,因此我只能在Galaxy Nexus上测试它.振动和声音再次起作用但不起作用.
Notification.Builder builder = new Notification.Builder(context);
builder.setContentIntent(pendingIntent)
.setSmallIcon(R.drawable.ic_launcher)
.setTicker("My Ticker")
.setWhen(System.currentTimeMillis())
.setAutoCancel(true)
.setDefaults(Notification.DEFAULT_VIBRATE | Notification.DEFAULT_SOUND | Notification.FLAG_SHOW_LIGHTS)
.setLights(0xff00ff00, 300, 100)
.setContentTitle("My Title 1")
.setContentText("My Text 1");
Notification notification = …
Run Code Online (Sandbox Code Playgroud) 我在assets文件夹中有一个文本文件,我需要将其转换为File对象(而不是InputStream).当我尝试这个时,我得到"没有这样的文件"例外:
String path = "file:///android_asset/datafile.txt";
URL url = new URL(path);
File file = new File(url.toURI()); // Get exception here
Run Code Online (Sandbox Code Playgroud)
我可以修改它以使其工作吗?
顺便说一下,我尝试"按示例编写代码",查看我项目中其他位置引用资源文件夹中的HTML文件的代码片段
public static Dialog doDialog(final Context context) {
WebView wv = new WebView(context);
wv.loadUrl("file:///android_asset/help/index.html");
Run Code Online (Sandbox Code Playgroud)
我承认我并不完全理解上述机制,因此我可能无法正常工作.
谢谢!
我是Stack Exchange的新手,我一直在寻找一段时间,没有回答.在我的空闲时间我用Java创建一个matlab/like程序,我注意到我需要创建一种允许用户在程序中创建自己的变量的方法.一个例子是a = 5和b = 3,所以当a + b = 8.我的第一个想法是创建一个文件夹,其中文件可以保存为变量,然后在用户调用特定变量时进行搜索.任何形式的反馈将不胜感激.谢谢!
我想将许多对象推入数组
每个对象都有不同的价值
但是当我把它们推入阵列时
它们的所有值都是相同的
如何解决这个问题呢?
$sql="select password, mail from account";
$result=mysql_query($sql);
$arr=array();
while($row=mysql_fetch_assoc($result))
{
$o->pw=$row['password'];
$o->mail=$row['mail'];
array_push($arr, $o);
}
echo json_encode($arr);
Run Code Online (Sandbox Code Playgroud) 我们正在从CruiseControl.NET迁移到Jenkins,只是为了与合作伙伴保持同步,因此我们没有两个不同的CI脚本.我们正在尝试设置Jenkins做类似于我们CruiseControl所做的事情,它有一个集中的服务器调用远程构建机器上的项目(jenkins中的作业).
我们有多个与单个项目关联的构建机器,因此当我们从集中式CI服务器构建项目时,它将调用远程CI服务器上的项目.远程CI服务器将从集中式CI服务器项目中提取版本.
在CruiseCruise控件中,我们设置了一个可以forceBuild
在远程项目上执行的项目.构建机器上的项目使用a remoteProjectLabeller
来检索版本号,以便它们始终保持同步.
要检索主构建号:
<labeller type="remoteProjectLabeller">
<project>MainProject</project>
<serverUri>tcp://central-server:21234/CruiseManager.rem</serverUri>
</labeller>
Run Code Online (Sandbox Code Playgroud)
要调用远程项目:
<forcebuild>
<project>RemoteBuildMachineA</project>
<serverUri>tcp://remote-server:21234/CruiseManager.rem</serverUri>
<integrationStatus>Success</integrationStatus>
</forcebuild>
Run Code Online (Sandbox Code Playgroud)
到目前为止,在jenkins我使用java web start设置了一个辅助服务器作为奴隶,但我不知道如何让主jenkins调用奴隶上的项目设置.
我可以设置Jenkins来调用奴隶上的项目(作业)吗?
我可以让奴隶从主人那里取出版本号吗?
编辑 -
让我补充一些信息.