当我使用Quartz 2的Spring 3时,我收到了以下错误.有谁知道原因?
错误:
Exception in thread "main" org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [org.springframework.scheduling.quartz.JobDetailBean] for bean with name 'job' defined in class path resource [beans.xml]: problem with class file or dependent class; nested exception is java.lang.IncompatibleClassChangeError: class org.springframework.scheduling.quartz.JobDetailBean has interface org.quartz.JobDetail as super class
at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1253)
Run Code Online (Sandbox Code Playgroud)
Spring配置文件:
<bean name="job" class="org.springframework.scheduling.quartz.JobDetailBean">
<property name="jobClass" value="Example.ExampleJob"/>
<property name="jobDataAsMap">
<map>
<entry key="timeout" value="5"/>
</map>
</property>
</bean>
<bean id="simpleTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerBean">
<property name="jobDetail" ref="job"/>
<property name="startDelay" value="1000"/>
<property name="repeatInterval" value="5000"/>
</bean>
public class ExampleJob extends QuartzJobBean { …Run Code Online (Sandbox Code Playgroud) 我正在尝试学习如何CALayer在Mac Objective-C应用程序中使用和实现,但我似乎无法做最基本的事情 - 添加一个新图层并设置其背景颜色/帧大小.任何人都可以看到我的代码有什么问题吗?
CALayer *layer = [CALayer layer];
[layer setFrame:CGRectMake(0, 0, 100, 100)];
[layer setBackgroundColor:CGColorCreateGenericRGB(1.0, 0.0, 0.0, 1.0)];
[self.layer addSublayer:layer];
[layer display];
Run Code Online (Sandbox Code Playgroud)
我把它放在- (void)drawRect:(NSRect)rect我的自定义NSView子类的方法中,但是当我运行应用程序时,它只显示一个空白视图,没有背景颜色或我创建的图层的证据.
嗨我想将一个特定的div更多地移动到右侧,以便左边的div获得更多空间来显示其中的内容.在css中尝试了一些事情,但我知道我做错了什么.
我想getdate()在SQL SERVER中添加2小时的结果.我知道我可以添加一天:
select getdate() + 1
Run Code Online (Sandbox Code Playgroud)
但是如果想要在几个小时内添加,这是如何完成的getdate()?
我正在尝试编写一些在Mac OSX 10.6上启用时丢弃所有键盘和鼠标事件的代码.我的代码以root用户身份运行.我正在采取的方法是创建一个事件点击,丢弃传递给它的所有事件(启用时).事件点击回调函数如下所示:
CGEventRef MyTapCallback(CGEventTapProxy proxy,
CGEventType type,
CGEventRef event,
void *refcon)
{
return CKeyLocker::isEnabled() ? NULL : event;
}
Run Code Online (Sandbox Code Playgroud)
我用来启用和禁用事件tap的代码如下所示:
void CKeyLocker::enable(bool bEnable)
{
if (bEnable == m_bEnabled)
return;
if (bEnable)
{
// which events are we interested in?
CGEventMask evMask = kCGEventMaskForAllEvents;
CFMachPortRef mp = CGEventTapCreate(kCGHIDEventTap,
kCGHeadInsertEventTap,
kCGEventTapOptionDefault,
evMask,
MyTapCallback,
NULL);
if (mp)
{
qDebug() << "Tap created and active. mp =" << mp;
m_enabledTap = mp;
m_bEnabled = true;
}
}
else
{
CGEventTapEnable(m_enabledTap, false);
CFRelease(m_enabledTap);
m_enabledTap …Run Code Online (Sandbox Code Playgroud) 在网上搜索大约4个小时没有得到答案:
如何在具有透明度的路径上绘制阴影?
- (void)drawRect:(CGRect)rect
{
CGContextRef c = UIGraphicsGetCurrentContext();
CGContextSetLineWidth(c, 2);
CGContextSetStrokeColorWithColor(c, [[UIColor whiteColor] CGColor]);
CGContextSetShadowWithColor(c, CGSizeMake(0, 5), 5.0, [[UIColor blackColor]CGColor]);
CGContextSetFillColorWithColor(c, [[UIColor colorWithWhite:1.0 alpha:0.8] CGColor]);
// Sample Path
CGContextMoveToPoint(c, 20.0, 10.0);
CGContextAddLineToPoint(c, 100.0, 40.0);
CGContextAddLineToPoint(c, 40.0, 70.0);
CGContextClosePath(c);
CGContextDrawPath(c, kCGPathFillStroke);
}
Run Code Online (Sandbox Code Playgroud)
我注意到的第一件事,阴影只在中风附近.但到目前为止,这不是问题.路径/ rect后面的阴影仍然可见,这意味着:阴影颜色会影响路径的填充颜色.填充颜色应为白色,而不是灰色.如何解决这个问题?
我正在使用以下代码来模拟鼠标的单击:
void PostMouseEvent(CGMouseButton button, CGEventType type, const CGPoint point)
{
CGEventRef theEvent = CGEventCreateMouseEvent(NULL, type, point, button);
CGEventSetType(theEvent, type);
CGEventPost(kCGHIDEventTap, theEvent);
CFRelease(theEvent);
}
void LeftClick(const CGPoint point)
{
PostMouseEvent(kCGMouseButtonLeft, kCGEventMouseMoved, point);
NSLog(@"Click!");
PostMouseEvent(kCGMouseButtonLeft, kCGEventLeftMouseDown, point);
PostMouseEvent(kCGMouseButtonLeft, kCGEventLeftMouseUp, point);
}
Run Code Online (Sandbox Code Playgroud)
我可以使用基本相同的代码来进行控制点击(右键单击),方法是:
kCGEventLeftMouseDown
kCGEventLeftMouseUp
kCGMouseButtonLeft
他们各自的"正确"事件.该函数看起来像:
void RightClick(const CGPoint point)
{
PostMouseEvent(kCGMouseButtonRight, kCGEventMouseMoved, point);
NSLog(@"Click Right");
PostMouseEvent(kCGMouseButtonRight, kCGEventRightMouseDown, point);
PostMouseEvent(kCGMouseButtonRight, kCGEventRightMouseUp, point);
}
Run Code Online (Sandbox Code Playgroud)
但是,双击怎么样?我尝试发送2个leftclicks并连续两次调用PostMouseEvent()但没有运气.你如何进行双击?
谢谢!
此代码无效:
private void Foo(string optionalString = string.Empty)
{
// do foo.
}
Run Code Online (Sandbox Code Playgroud)
但是这段代码是:
private void Foo(string optionalString = "")
{
// do foo.
}
Run Code Online (Sandbox Code Playgroud)
为什么?因为string.Empty是只读字段,而不是常量,并且可选参数的缺省值必须是编译时常量.
那么,关于我的问题......(好吧,关心)
这就是我必须做的事情:
private const string emptyString = "";
private void Foo(string optionalString = emptyString)
{
// do foo.
if (!string.IsNullOrEmpty(optionalString))
// etc
}
Run Code Online (Sandbox Code Playgroud)
你们如何处理可选的字符串参数?
为什么它们不能使String.Empty成为编译时常量?
我有一个简单的问题,但我自己无法找到答案.
我正在使用EF4 CTP-5 Code First Model和手工生成的POCO.它正在处理生成的SQL中的字符串比较
WHERE N'Value' = Object.Property
Run Code Online (Sandbox Code Playgroud)
我知道我可以使用以下方法覆盖此功能:
[Column(TypeName = "varchar")]
public string Property {get;set;}
Run Code Online (Sandbox Code Playgroud)
这解决了该单个事件的问题并正确生成SQL为:
WHERE 'Value' = Object.Property
Run Code Online (Sandbox Code Playgroud)
但是,我正在处理一个非常大的域模型并遍历每个字符串字段并设置TypeName ="varchar"将非常非常繁琐.我想指定EF应该在整个板上看到字符串为varchar,因为这是该数据库中的标准,nvarchar是例外情况.
想要纠正这个问题的推理是查询执行效率.varchar和nvarchar之间的比较在SQL Server 2k5中非常低效,其中varchar到varchar比较几乎立即执行.
我使用以下伪代码生成PDF文档:
CGContextRef context = CGPDFContextCreateWithURL(url, &rect, NULL);
for (int i = 1; i <= N; i++)
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
CGContextBeginPage(context, &mediaBox);
// drawing code
CGContextEndPage(context);
[pool release];
}
CGContextRelease(context);
Run Code Online (Sandbox Code Playgroud)
它适用于小文档(N < 100页面),但如果文档超过大约400页(它在崩溃之前收到两个内存警告),它会占用太多内存和崩溃.我确保使用Instruments没有泄漏.您对在iOS上创建大型PDF文档有何建议?非常感谢.
编辑:pdf创建在后台线程中完成.
objective-c ×4
c# ×2
macos ×2
.net ×1
c#-4.0 ×1
c++ ×1
calayer ×1
cgeventtap ×1
cocoa ×1
code-first ×1
css ×1
double-click ×1
drawing ×1
events ×1
ios ×1
java ×1
macos-carbon ×1
pdf ×1
shadow ×1
spring ×1
sql ×1
string ×1