我试图在我的Ubuntu 8.10中安装php5-xsl(XSLT)包,但我收到一条错误消息.我想我需要更新apt-get的存储库?提前谢谢:) - 马克
我的语法:
sudo apt-get install php5-xsl
Run Code Online (Sandbox Code Playgroud)
错误信息:
W: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/p/php5/php5-xsl_5.2.6-2ubuntu4.1_i386.deb
404 Not Found
Run Code Online (Sandbox Code Playgroud) 当我发现没有直接的方法对IList <T>进行排序或执行二进制搜索时,我感到非常惊讶.就像有一些静态方法来对数组进行排序和执行二进制搜索一样,我认为使用类似于IList <T>的静态方法会非常有用.
目前:
class Array
{
static Sort<T>(T[] array);
static int BinarySearch<T>(T[] array, T item);
}
Run Code Online (Sandbox Code Playgroud)
我希望他们会补充:
class List
{
static Sort<T>(IList<T> list);
static int BinarySearch<T>(IList<T> list, T item);
}
Run Code Online (Sandbox Code Playgroud)
我瞥了一眼.NET Framework 4.0 Beta SDK,但似乎仍然没有解决这个问题的方法.
我知道我可以通过创建一个扩展方法来解决这个问题,该方法检查它是否是List <T>然后使用List <T>实例进行排序/搜索; 但是,如果它不是List <T>的实例,那么我必须执行一个副本(对于非常大的列表很臭).我知道我可以做到这一切,但为什么呢?他们故意遗漏这个功能有什么理由吗?
为了尝试在.NET 4.0 Framework中实现这一点,我通过Microsoft的Connect程序创建了一个建议.如果你像我这样对这个问题感到沮丧,那就投票吧,也许它会被添加.
https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=474201
在过去的几年里,我一直在努力研究单元测试数据库代码以及随之而来的所有痛苦.我发现这个现有的帖子我发现很有启发性:
接受的答案的作者建议,模拟整个数据库层以验证生成的SQL可能很有用.几个月前,当我第一次阅读答案时,我没有想太多,但最近我发现了SQL生成错误,错误分配字段等导致的一些错误.我确实意识到JDBC相当臃肿并且容易出错,但是在这一点上切换到不同的东西不是一种选择.
有问题的应用程序是数据源的批处理器,直接使用JDBC而不是ORM.除了实际的实现之外,所有JDBC代码都被分成不同的DAO对象,其中每个对象都有自己的接口和存根.这使我能够实现业务层的良好测试覆盖率,但数据库层的测试几乎不存在.
是否存在JDBC(java.sql)接口的现有存根实现,可以将其注入DAO类并用于验证生成的SQL并可能发回一些预编程的结果?
当我使用Python解释器运行它时,我的python程序(Python 2.6)工作正常,它连接到Oracle数据库(10g XE)而没有错误.但是,当我使用py2exe编译它时,可执行版本在调用cx_Oracle.connect()时失败并显示"无法获取Oracle环境句柄".
我没有高兴地试过以下事情:
ORACLE_HOME以及PATH我的测试用例:
testora.py:
import cx_Oracle
import decimal # needed for py2exe to compile this correctly
def testora():
"""testora
>>> testora.testora()
<cx_Oracle.Connection to scott@localhost:1521/orcl>
X
"""
orcl = cx_Oracle.connect('scott/tiger@localhost:1521/orcl')
print orcl
curs = orcl.cursor()
result = curs.execute('SELECT * FROM DUAL')
for (dummy,) in result:
print dummy
if __name__ == '__main__':
testora()
Run Code Online (Sandbox Code Playgroud)
build_testora.py:
from distutils.core import setup
import py2exe, sys
sys.argv.append('py2exe')
setup(
options = {'py2exe': {
'bundle_files': 2,
'compressed': True …Run Code Online (Sandbox Code Playgroud) 假设我有一个类如
class c {
// ...
void *print(void *){ cout << "Hello"; }
}
Run Code Online (Sandbox Code Playgroud)
然后我有一个c的向量
vector<c> classes; pthread_t t1;
classes.push_back(c());
classes.push_back(c());
Run Code Online (Sandbox Code Playgroud)
现在,我想创建一个线程 c.print();
以下是给我以下问题: pthread_create(&t1, NULL, &c[0].print, NULL);
错误输出:无法将'void*(tree_item :: )(void)'转换为'void*()(void)'以将参数'3'转换为'int pthread_create(pthread_t*,const pthread_attr_t*,void*()(void),void*)'
我的应用程序的辅助线程的运行循环如下.它有一个嵌套的控制循环.
我的代码不会故意在未发布的池中留下任何自动释放的对象,但我不知道操作系统在做什么.
在主线程中,cocoa围绕运行循环的每次传递包装自动释放池.
在这个辅助线程中,我相信最接近的等价物是通过内部循环.
所述内自动释放池包装每次通过内循环.
在中间的水池环绕的内循环,使创建并自动释放在这个级别的对象不会保持,直到应用程序终止.
该外泳池包装整个runloop.
如何确定所有这些池的创建和发布对我的代码速度有何影响.
如何确定所有三个池是否必要或过度杀伤?
代码和解释:
- (void)processLoop
{
NSAutoreleasePool * outerPool = [[NSAutoreleasePool alloc] init];
[processCondition lock];
//outer loop
//this loop runs until my application exits
while (![[NSThread currentThread] isCancelled])
{
NSAutoreleasePool *middlePool = [[NSAutoreleasePool alloc];
if(processGo)
{
//inner loop
//this loop runs typically for a few seconds
while (processGo && ![[NSThread currentThread] isCancelled])
{
NSAutoreleasePool *innerPool = [[NSAutoreleasePool alloc]; init];
//within inner loop
//this takes …Run Code Online (Sandbox Code Playgroud) 我使用jQuery.而且我不希望在我的应用程序上进行并行AJAX调用,每个调用必须在开始之前等待之前的调用.怎么实现呢?有帮助吗?
更新如果有XMLHttpRequest或jQuery.post的任何同步版本,我想知道.但顺序!=同步,我想要一个异步和顺序的解决方案.
我有一个程序,位置管理器设置如下:
self.locationManager = [[CLLocationManager alloc] init];
[locationManager startUpdatingLocation];
locationManager.delegate = self;
locationManager.distanceFilter = kCLDistanceFilterNone;
locationManager.desiredAccuracy = kCLLocationAccuracyNearestTenMeters;
Run Code Online (Sandbox Code Playgroud)
我需要精度到十米以内,然而,需要几次调用didUpdateToLocation委托方法才能找到准确度的位置.如何延迟调用此方法或仅指示何时达到所需的准确度以继续执行程序.
现在它尝试继续返回的第一个位置.即使是第二次位置更新也不如预期的那么准确.
提前致谢!
如果我的标记看起来像这样:
<button id="button-1" class="nice">
<button id="button-2" class="nice">
<button id="button-3" class="nice">
Run Code Online (Sandbox Code Playgroud)
我定义了以下jQuery:
$(".nice").click(function () {
// something happens
});
Run Code Online (Sandbox Code Playgroud)
建立了多少个事件监听器?1还是3?
如果我有1000个按钮而不是3个按钮,我应该使用事件委托吗?
如果这些类在标记中包含大量元素,那么在性能方面是不是最好定义对元素类的jQuery调用?
我正在使用SQL Server 2005(可能在不久的将来使用SQL Server 2008)为网站创建一个新数据库.作为一名应用程序开发人员,我见过很多数据库使用integer(或bigint等)表格的ID字段来用于关系.但最近我也看到了使用unique identifier(GUID)作为ID字段的数据库.
我的问题是,一个人是否优于另一个人?将integer字段是查询和连接等快?
更新:为清楚起见,这是表中的主键.
iphone ×2
jquery ×2
objective-c ×2
.net ×1
ajax ×1
autorelease ×1
c# ×1
c#-4.0 ×1
c++ ×1
cx-oracle ×1
gps ×1
java ×1
javascript ×1
jdbc ×1
location ×1
oracle ×1
pthreads ×1
py2exe ×1
python ×1
sequential ×1
sql ×1
sql-server ×1
t-sql ×1
tdd ×1
ubuntu-8.10 ×1
unit-testing ×1
xslt ×1