我开始将SQLAlchemy用于一个新项目,我计划在这个项目中实现类似于此静默提议的审计跟踪:
因为我已经拥有了"有趣"对象的完整历史,所以我在考虑允许用户回滚给定版本,让他们有可能无限制undo.
这可以用SQLAlchemy以干净的方式完成吗?
在内部API(业务逻辑和ORM)中公开此功能的正确方法是什么?
我是一路走来的路user.rollback(ver=42).
我正在考虑在我的Windows桌面上执行一些任务自动化(例如,对大量音乐/文本/照片文件进行分类等).
看看我的主要开发人员专业领域是如何在Unix上使用Perl,我更倾向于坚持使用Perl来编写我需要做的任何业务逻辑,只是为了提高开发效率.
问题是,如果我想在工作之上打一些GUI(在Unix上的ala Perl :: Tk),我的GUI工具包选项是什么,你建议使用哪一个?
请注意,我希望这个问题对其他SO用户来说是一个很好的学习机会,所以我欢迎任何答案,即使他们不一定满足我下面列出的限制/需求,尽管说明你的解决方案如何关联这些考虑因素将非常受欢迎.
我的考虑主要是因为我想要一个快速开发的个人用工具,以节省我现在手动执行的任务的时间.
主要的考虑因素是Perlishness of development - Perl的口号是"轻松的事情应该是容易的,而且应该是可能的事情".特别是第一部分:)
就所使用的组件而言,更喜欢(但不是坚持)尽可能本地化.例如,重新使用Windows的文件打开对话框,而不是使用一些自定义Java对话框.
我更喜欢使用一些学习曲线较小的东西(例如,不需要学习OLE/COM的复杂性),因为这里的目标是快速开发我需要简化生活的工具而不是开发人员教育,我专注于与我的日常工作更相关的领域:).
但是我非常希望在这样做时能够接触到新的/酷的东西,例如,如果建议使用一些基于Monad的GUI组件,我肯定很好奇.
性能很重要(例如,我可能需要显示> 10000个文件的目录列表),但不是最重要的 - 我是一个非常好的GUI设计人员和开发人员,可以随时构建我的应用程序并设计一个GUI,以便在需要时进行扩展. .
我强烈希望(尽管不是坚持)一个不强迫我编译东西的框架.例如,Perl库比我需要编译的自定义Java东西更可取.但是如果框架在所有其他方面都是完美的,那么我就可以使用已编译的解决方案(只要它不需要我购买Visual Studio或其他类似的东西 - 我想构建一个Windows GUI前端供个人使用,不投资成为Windows开发人员).
除了上述限制之外,我非常开放和灵活.一些ActivePerl/Strawberry Perl库,基于MS PowerShell的组件 - 哎呀,如果没有更好的表现我会在我的PC上安装Apache并构建一个Web前端:)
嗨,我正在使用Windows XP和最新版本在这里完成教程
http://binil.wordpress.com/2006/12/08/automated-smoke-tests-with-selenium-cargo-testng-and-maven/
有人可以告诉我标签是什么.
<parallel>true</parallel>
<threadCount>10</threadCount>
Run Code Online (Sandbox Code Playgroud)
当我使用这些标签构建时,我遇到了失败:
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running TestSuite
org.apache.maven.surefire.booter.SurefireExecutionException:
Cannot set option parallel with value
true; nested exception is
java.lang.reflect.InvocationTargetException:
null; nested exception is
org.apache.maven.surefire.util.NestedRuntimeException:
Cannot set option parallel with value
true; nested exception is
java.lang.reflect.InvocationTargetException:
null
org.apache.maven.surefire.util.NestedRuntimeException:
Cannot set option parallel with value
true; nested exception is
java.lang.reflect.InvocationTargetException:
null
java.lang.reflect.InvocationTargetException
at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at
java.lang.reflect.Method.invoke(Method.java:585)
at
org.apache.maven.surefire.testng.conf.AbstractDirectConfigurator$Setter.invoke(AbstractDirectConfigurator.java:117)
at
org.apache.maven.surefire.testng.conf.AbstractDirectConfigurator.configure(AbstractDirectConfigurator.java:63)
at
org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:71)
at
org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:92)
at
org.apache.maven.surefire.Surefire.run(Surefire.java:177)
at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native …Run Code Online (Sandbox Code Playgroud) 我需要从字符串中提取一组包含在两个分隔符之间的字符,而不返回分隔符本身.
一个简单的例子应该是有用的:
目标:提取方括号之间的子字符串,而不返回括号本身.
基本字符串:This is a test string [more or less]
如果我使用以下reg.恩.
\[.*?\]
比赛是[more or less].我只需要more or less(没有括号).
有可能吗?
我刚才回顾了一些看起来像这样的代码
public class ProductChecker
{
// some std stuff
public ProductChecker(int AccountNumber)
{
var account = new AccountPersonalDetails(AccountNumber);
//Get some info from account and populate class fields
}
public bool ProductACriteriaPassed()
{
//return some criteria based on stuff in account class
//but now accessible in private fields
}
}
Run Code Online (Sandbox Code Playgroud)
现在已经添加了一些额外的标准,这些标准需要不在AccountPersonalDetails类中的数据
新代码看起来像这样
public class ProductChecker
{
// some std stuff
public ProductChecker(int AccountNumber)
{
var account = new AccountPersonalDetails(AccountNumber);
var otherinfo = getOtherInfo(AccountNumber)
//Get some info from account and populate class …Run Code Online (Sandbox Code Playgroud) 我已经遇到了一些使用线程模块管理线程的例子(使用Python 2.6).
我想要了解的是这个例子如何调用"run"方法以及在哪里.我什么都看不到.ThreadUrl类在main()函数中实例化为"t",这是我通常期望代码启动"run"方法的地方.
也许这不是使用线程的首选方式?请赐教:
#!/usr/bin/env python
import Queue
import time
import urllib2
import threading
import datetime
hosts = ["http://example.com/", "http://www.google.com"]
queue = Queue.Queue()
class ThreadUrl(threading.Thread):
"""Threaded Url Grab"""
def __init__(self, queue):
threading.Thread.__init__(self)
self.queue = queue
def run(self):
while True:
#grabs host from queue
host = self.queue.get()
#grabs urls of hosts and prints first 1024 bytes of page
url = urllib2.urlopen(host)
print url.read(10)
#signals to queue job is done
self.queue.task_done()
start = time.time()
def main():
#spawn a pool of threads, and …Run Code Online (Sandbox Code Playgroud) 我有一个情况,我有一个名为'主文件'的mySql表,包含6000条记录.
我怎么得到一个错误 Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource
我的代码如下所示.
$sql = "SELECT * FROM Master File";
$results = mysql_query($sql);
//Looping threw the Master File
while($row = mysql_fetch_array($results)){
print_r($row);
}
Run Code Online (Sandbox Code Playgroud) 任何人都可以给我一个简明的定义
我不是在维基百科链接或令人难以置信的细节之后,只是一些简短的信息,关于Unicode的巨大变化是如何以及为什么出现的,以及为什么你应该关心程序员.
如果我创建一个分支:
hg branch branch-A
Run Code Online (Sandbox Code Playgroud)
并承诺:
hg commit -m "improvement A-1"
Run Code Online (Sandbox Code Playgroud)
然后创建第二个分支:
hg branch branch-B
Run Code Online (Sandbox Code Playgroud)
并承诺:
hg commit -m "improvement B-1"
Run Code Online (Sandbox Code Playgroud)
如果我想将我的下一个更改添加到branch-A,我只需输入:
hg branch branch-A
Run Code Online (Sandbox Code Playgroud)
像以前一样承诺:
hg commit -m "improvement A-2"
Run Code Online (Sandbox Code Playgroud) 我想从成员函数中定义类中的属性.下面是一些测试代码,显示了我希望如何工作.但是我没有得到预期的行为.
class Basket(object):
def __init__(self):
# add all the properties
for p in self.PropNames():
setattr(self, p, property(lambda : p) )
def PropNames(self):
# The names of all the properties
return ['Apple', 'Pear']
# normal property
Air = property(lambda s : "Air")
if __name__ == "__main__":
b = Basket()
print b.Air # outputs: "Air"
print b.Apple # outputs: <property object at 0x...>
print b.Pear # outputs: <property object at 0x...>
Run Code Online (Sandbox Code Playgroud)
我怎么能让这个工作?
python ×3
audit ×1
branch ×1
c# ×1
class-design ×1
codepages ×1
constructor ×1
control-flow ×1
java ×1
maven-2 ×1
mercurial ×1
mysql ×1
perl ×1
php ×1
properties ×1
regex ×1
rollback ×1
sqlalchemy ×1
surefire ×1
testng ×1
unicode ×1
utf-16 ×1
utf-8 ×1
windows ×1