我忙着用常春藤弄湿我的脚.我在我的本地PC上运行了一个现有的nexus存储库,以及一个现有的ant构建脚本.
两者都很好.
部分构建脚本有一些文件可以从网络共享中检索我们的第三方jar文件(log4j,xmlbeans,junit,pdf等等) - 最好是笨拙的.
我想使用ivy的依赖机制从nexus存储库中检索这些文件并在构建中使用它.每个3rdparty lib都有一个名称和一组任意文件(jar,dll,license.dat,xml等).
由于我们有大量的这些第三方库,每个lib都有多个文件 - 手动上传到nexus不是一个选项 - 我需要一些我可以用来获取一组文件,给它们一个lib名称,一个版本号和将结果上传到nexus.然后我需要能够从常春藤中检索这个.
我设法让上传部分工作,但撤销过程不起作用.使用我们的xmlbeans lib作为起点,我创建了以下ivy.xml文件
<ivy-module version="1.0">
<info organisation="thirdparty_tools" module="xmlbeans" status="integration">
<publications>
<artifact name="jsr173_api" type="jar" ext="jar"/>
<artifact name="saxon-dom" type="jar" ext="jar"/>
<artifact name="saxon-xpath" type="jar" ext="jar"/>
<artifact name="saxon" type="jar" ext="jar"/>
<artifact name="xbean" type="jar" ext="jar"/>
<artifact name="xbean_xpath" type="jar" ext="jar"/>
<artifact name="xmlpublic" type="jar" ext="jar"/>
</publications>
</ivy-module>
Run Code Online (Sandbox Code Playgroud)
然后将一些蚂蚁脚本发布到nexus:
<ivy:resolve/>
<ivy:publish <ivy:publish resolver="thirdparty" forcedeliver="true" update="true" revision="${version}" overwrite="true">
<artifacts pattern="[artifact].[ext]"/>
<ivy:publish/>
Run Code Online (Sandbox Code Playgroud)
这一切都很好.它将所有jar文件发布到预期目录中的nexus.
当我尝试在我的构建中使用它时遇到麻烦.我为我的构建创建了以下ivy.xml文件:
<ivy-module version="1.0">
<info organisation="myCompany" module="GLB_Data"/>
<dependencies>
<dependency org="thirdparty_tools" name="xmlbeans" rev="2.2.0"/>
</dependencies>
</ivy-module>
Run Code Online (Sandbox Code Playgroud)
然后当我运行我的构建时 - 它找不到任何东西: …
C#noob在这里.简单的问题,但在网上查看所有内容,我似乎正在这样做.但任何人都可以告诉我为什么这段代码不起作用:
string testDateString = "2/02/2011 3:04:01 PM";
string testFormat = "d/MM/yyyy h:mm:ss tt";
DateTime testDate = new DateTime();
DateTime.TryParseExact(testDateString, testFormat, null, 0, out testDate);
// Value of testDate is the default {1/01/0001 12:00:00 a.m.}
Run Code Online (Sandbox Code Playgroud)
但只是从字符串日期删除AM/PM和格式中的"tt"按预期工作?
string testDateString = "2/02/2011 3:04:01";
string testFormat = "d/MM/yyyy h:mm:ss";
DateTime testDate = new DateTime();
DateTime.TryParseExact(testDateString, testFormat, null, 0, out testDate);
// Value of testDate is the expected {2/02/2011 3:04:01 a.m.}
Run Code Online (Sandbox Code Playgroud) 我试图解决使用PostGIS找到n个最近邻居的问题:
初始点:
问题:在由id(geoname.geonameid)表示的表geoname中找到给定Point的n个(例如5个)最近邻居.
可能的方法:
受http://www.bostongis.com/PrinterFriendly.aspx?content_name=postgis_nearest_neighbor的启发,我尝试了以下查询:
"SELECT start.asciiname, ende.asciiname, distance_sphere(start.geom, ende.geom) as distance " +
"FROM geoname As start, geoname As ende WHERE start.geonameid = 2950159 AND start.geonameid <> ende.geonameid " +
"AND ST_DWithin(start.geom, ende.geom, 300) order by distance limit 5"
Run Code Online (Sandbox Code Playgroud)
处理时间:约60秒
还尝试了一种基于EXPAND的方法:
"SELECT start.asciiname, ende.asciiname, distance_sphere(start.geom, ende.geom) as distance " …Run Code Online (Sandbox Code Playgroud) 说我有一个对象:
var names = ["john", "jane", "al", "mary", "zane" ... 1000+ Names]
Run Code Online (Sandbox Code Playgroud)
我想创建一个自动建议来搜索这些名称.
这样做最有效的方法是什么?我读过创建trie或三元数据结构是最好的,但我不确定如何在js中实现这些.
有什么想法吗?
使用CoreData时,以下多列索引谓词非常慢 - 26,000条记录需要大约2秒钟.
请注意,这两列都已编制索引,并且我有目的地使用>和<=而不是beginwith进行查询,以使其快速:
NSPredicate *predicate = [NSPredicate predicateWithFormat:
@"airportNameUppercase >= %@ AND airportNameUppercase < %@ \
OR cityUppercase >= %@ AND cityUppercase < %@ \
upperText, upperTextIncremented,
upperText, upperTextIncremented];
Run Code Online (Sandbox Code Playgroud)
但是,如果我运行两个单独的fetchRequests,每列一个,然后我合并结果,那么每个fetchRequest只需1-2个百分之一秒,并且合并列表(已排序)大约需要1/10第二.
这是CoreData如何处理多个索引的错误,还是这个预期的行为?以下是我的完整优化代码,它运行速度非常快:
NSFetchRequest *fetchRequest = [[[NSFetchRequest alloc] init]autorelease];
[fetchRequest setFetchBatchSize:15];
// looking up a list of Airports
NSEntityDescription *entity = [NSEntityDescription entityForName:@"Airport"
inManagedObjectContext:context];
[fetchRequest setEntity:entity];
// sort by uppercase name
NSSortDescriptor *nameSortDescriptor = [[[NSSortDescriptor alloc]
initWithKey:@"airportNameUppercase"
ascending:YES
selector:@selector(compare:)] autorelease];
NSArray *sortDescriptors = [[[NSArray alloc] initWithObjects:nameSortDescriptor, nil]autorelease];
[fetchRequest setSortDescriptors:sortDescriptors];
// use …Run Code Online (Sandbox Code Playgroud) 当我将它们托管在Rackspace cloudfiles服务器上时,似乎无法使用html5视频标签播放视频.
在常规主机上完美运行,但只要我将视频与rackspace cdn url相关联,Chrome就会冻结(完全冻结,网站用户界面完全被阻止 - 过了一段时间Chrome会弹出一条消息说"以下页面已变得反应迟钝bla bla bla ").
视频文件很好,因为它与我链接到常规主机时相同.
对请求进行了一些间谍活动,我最初认为问题是webm文件默认服务于application/octet-stream mime-type.我向机架空间寄出了一张票,他们给了我一种在上传文件时强制mime类型的方法.这样做,文件现在正确发送为视频/ webm ..但Chrome仍然冻结.
知道这里可能出现什么问题吗?
编辑:使用iheartvideo,从rackspace加载视频会触发MEDIA_ERR_SRC_NOT_SUPPORTED.本地Web服务器的相同视频完全正常(??)
编辑2:在最新主流镀铬的Mac和Windows上都会发生
编辑3:卷曲 - 我的结果:
Rackspace(没有工作):
HTTP/1.1 200 OK
Server: nginx/0.7.65
Content-Type: video/webm
Last-Modified: Thu, 24 Feb 2011 23:45:12 GMT
ETag: 7029f83b241aa691859012dfa047e20d
Content-Length: 20173074
Cache-Control: public, max-age=900
Expires: Fri, 25 Feb 2011 01:32:11 GMT
Date: Fri, 25 Feb 2011 01:17:11 GMT
Connection: keep-alive
Run Code Online (Sandbox Code Playgroud)
Web服务器(工作)
HTTP/1.1 200 OK
Date: Fri, 25 Feb 2011 01:17:51 GMT
Server: Apache
Last-Modified: Thu, 24 …Run Code Online (Sandbox Code Playgroud) 我真的坚持这个.我在SQL方面有广泛的背景,但我刚刚开始了一项新工作,他们更喜欢使用LINQ进行简单查询.所以本着学习的精神,我试着重写这个简单的SQL查询:
SELECT
AVG([Weight] / [Count]) AS [Average],
COUNT(*) AS [Count]
FROM [dbo].[Average Weight]
WHERE
[ID] = 187
Run Code Online (Sandbox Code Playgroud)
为清楚起见,这是表模式:
CREATE TABLE [dbo].[Average Weight]
(
[ID] INT NOT NULL,
[Weight] DECIMAL(8, 4) NOT NULL,
[Count] INT NOT NULL,
[Date] DATETIME NOT NULL,
PRIMARY KEY([ID], [Date])
)
Run Code Online (Sandbox Code Playgroud)
这是我想出的:
var averageWeight = Data.Context.AverageWeight
.Where(i => i.ID == 187)
.GroupBy(w => w.ID)
.Select(i => new { Average = i.Average(a => a.Weight / a.Count), Count = i.Count() });
Run Code Online (Sandbox Code Playgroud)
Data.Context.AverageWeight是由SQLMetal生成的Linq To SQL对象.如果我尝试averageWeight.First()我得到一个OverflowException.我使用SQL事件探查器来查看LINQ生成的参数化查询是什么样的.重新缩进,如下所示:
EXEC sp_executesql N' …Run Code Online (Sandbox Code Playgroud) 在Cobertura中,我无法报告断言声明的条件路径.这是一个已知的限制吗?
我有一个JUnit测试,期望抛出AssertionError,并且它正确传递.问题是Cobertura报告断言分支没有被覆盖.
经过更多调查,我发现正在检测到部分分支覆盖范围.问题是:
assert data != null;
Run Code Online (Sandbox Code Playgroud)
和Cobertura报道的报道为:
条件覆盖率75%(3/4)[每种条件50%,100%].
Cobertura期待的不同分支条件是什么?
我正在创建一个数独游戏,但是当我按下按钮时它会崩溃游戏.这是我的代码:
FPSudoku.java:
package org.example.fpsudoku;
import android.app.Activity; import
android.os.Bundle; import
android.content.Intent; import
android.view.View; import
android.view.View.OnClickListener;
public class FPSudoku extends Activity
implements OnClickListener{
@Override public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
View newButton = findViewById(R.id.new_game_button);
newButton.setOnClickListener(this);
View aboutButton = findViewById(R.id.how_to_play_button);
aboutButton.setOnClickListener(this);
View exitButton = findViewById(R.id.exit_game_button);
exitButton.setOnClickListener(this);
}
public void onClick(View v) {
switch (v.getId()) {
case R.id.how_to_play_button:
Intent i = new Intent(this, Howtoplay.class);
startActivity(i);
break;
}
}
}
Run Code Online (Sandbox Code Playgroud)
Howtoplay.java
package org.example.fpsudoku;
import android.app.Activity; import
android.os.Bundle;
public class Howtoplay extends
Activity { @Override …Run Code Online (Sandbox Code Playgroud) 有人可以告诉我如何使用NSScanner解析一个ics文件?(Iphone App)
例如:如果.ics文件位于此URL http://www.ibz.com/data/12345.ics(不是真正的URL !!!)
我如何首先将.ics文件保存到我的iPhone应用程序中
然后我将如何使用NSScanner解析.ics文件?
请提供代码示例..
c# ×2
objective-c ×2
.net ×1
algorithm ×1
android ×1
ant ×1
assert ×1
cobertura ×1
cocoa-touch ×1
core-data ×1
datetime ×1
freeze ×1
html5 ×1
html5-video ×1
icalendar ×1
iphone ×1
ivy ×1
java ×1
javascript ×1
linq ×1
nexus ×1
nsscanner ×1
overflow ×1
postgis ×1
postgresql ×1
search ×1
sql ×1
sudoku ×1