我正在根据传入的信息使用石英制作复杂的绘图.我唯一无法弄清楚的部分是如何清除我已绘制的线条,矩形等?基本上,我想要删除整个绘图,然后从新数据中再次绘制它.
绝对是一个LINQ新手,但对SQL和C#非常有经验,并想知道这在LINQ中是否可行.如果是这样,我可以在其他地方使用它,但我认为这将是一个很好的起点(并有助于简化/清理一些代码).这可能更通用,但我认为这可能是一个很好的现实生活中的例子,可以帮助解释.
快速背景:我正在做一个个人学习项目,构建一个调度程序,学习Spring.NET/DI,Fluent NHibernate,Quartz.NET,并尝试用TDD来完成我的专长.到目前为止已经学到了一吨.
Quartz.NET IScheduler对象具有这些属性(1)/方法(2)(假设为公共)...
string[] JobGroupNames { get; }
string[] GetJobNames(string groupName)
Trigger[] GetTriggersOfJob(string jobName, string groupName)
Run Code Online (Sandbox Code Playgroud)
假设触发器定义只是......
class Trigger
{
string Name { get; }
}
Run Code Online (Sandbox Code Playgroud)
我有一个类我正在尝试获取一个列表,其中包含如下构造函数(因为它一旦创建就不可变)...
class QuartzJob
{
public QuartzJob(Guid groupId, Guid jobId, IEnumerable<string> triggerNames)
}
Run Code Online (Sandbox Code Playgroud)
目前这就是我处理它的方式......
public IEnumerable<QuartzJob> GetQuartzInfo(IScheduler scheduler)
{
List<QuartzJob> list = new List<QuartzJob>();
foreach (string grp in scheduler.JobGroupNames)
{
foreach (string job in scheduler.GetJobNames(grp))
{
var triggerNames = scheduler
.GetTriggersOfJob(job, grp)
.ToList()
.ConvertAll(t => t.Name);
var qj = new QuartzJob(new Guid(grp), new …Run Code Online (Sandbox Code Playgroud) 我会发布我的代码.对困惑感到抱歉.
StringBuilder texto1 = new StringBuilder("LALALLA");
byte[] x = texto1.toString().getBytes();
try {
Cipher cifrado = Cipher.getInstance("RSA/ECB/PKCS1Padding");
cifrado.init(Cipher.ENCRYPT_MODE, key1.getPublic());
x = cifrado.doFinal(x);
String texto;
texto = new String(x, "UTF-8");
JOptionPane.showInputDialog(publicKey.toString());
String teste = "";
for (int i = 0; i < x.length; i++) {
teste += x[i];
}
jTextPane1.setText(teste);
//cifrado.init(Cipher.DECRYPT_MODE, privatekey);
byte[] y;
// x= texto.getBytes();
//y = cifrado.doFinal(texto.getBytes());
//texto = new String(y,"UTF-8");
jTextPane2.setText(x.toString());
} ...
Run Code Online (Sandbox Code Playgroud)
这是按钮操作中的代码.每次运行此代码时,使用相同的密钥,texto1 on encryption会返回不同的结果,如[B@52a0b1e1或[B@3e55abb3
我一直使用Subversion或CVS进行版本控制,它使用"合并"方法.我的一个朋友对Perforce赞不绝口,它的变更清单和结账方法有多棒.
虽然我确信很多都归结为经验和个人偏好,但我想知道是否有任何研究已经完成哪种版本控制方法更有效?
编辑:澄清一下,我知道Perforce和SVN都允许锁定和合并,但SVN'鼓励'一种自由的编辑和合并方法,而据我所知,Perforce鼓励一种checkout-checkin方法.
有一个奇怪的情况.我在我的企业应用程序中使用Glassfish服务器.在那个应用程序中,我使用的是JSF,Richfaces,Quartz,Jasper Reports和Commons Email.当我构建并部署应用程序到我的开发.计算机,开发和测试服务器,一切正常.但是,当我使用相同的glassfish将应用程序部署到生产服务器时,我无法运行Quartz调度程序.它让我觉得公共收藏有一些问题.我知道某处有冲突,但我无法找到.你能给我一些指点吗?顺便说一下,我正在使用NetBeans 6.5.
这是日志:
[#|2009-02-13T02:00:03.055+0000|WARNING|sun-appserver9.1|javax.enterprise.resource.webcontainer.jsf.lifecycle|_ThreadID=22;_ThreadName=httpSSLWorkerThread-80-4;_RequestID=97d21f45-2489-486c-b8d9-68625776c546;|#{SchedulerController.play}: java.lang.NoSuchMethodError: org.apache.commons.collections.SetUtils.orderedSet(Ljava/util/Set;)Ljava/util/Set;
javax.faces.FacesException: #{SchedulerController.play}: java.lang.NoSuchMethodError: org.apache.commons.collections.SetUtils.orderedSet(Ljava/util/Set;)Ljava/util/Set;
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:107)
at javax.faces.component.UICommand.broadcast(UICommand.java:383)
at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:321)
at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:296)
at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:253)
at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:466)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:317)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:390)
at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:517)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:288)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571) …Run Code Online (Sandbox Code Playgroud) 我试图使用CGContextRef对图像应用一些转换.我正在使用CGContextTranslateCTM,CGContextScaleCTM和CGContextRotateCTM函数,但为了保持简单,我们只关注第一个.我想知道为什么下面的代码会产生完全原始的图像?!我错过了什么吗?
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
CGContextRef g = CGBitmapContextCreate((void*) pixelData,
width,
height,
RGBA_8_BIT,
bytesPerRow,
colorSpace,
kCGImageAlphaPremultipliedLast);
CGContextSetShouldAntialias(g, YES);
CGContextSetInterpolationQuality(g, kCGInterpolationHigh);
CGContextTranslateCTM( g,translateX, translateY );
CGImageRef tempImg = CGBitmapContextCreateImage (g);
CGContextDrawImage( g, CGRectMake (0, 0, width, height), tempImg );
CGContextRelease(g);
CGColorSpaceRelease( colorSpace );
Run Code Online (Sandbox Code Playgroud)
此外,翻译后,如何在这一个上绘制另一个图像,但具有部分透明度(例如alpha = 0.5).
我搜索了很多,但没有找到答案,任何帮助表示赞赏...... :)
请注意,我正在从pixelData创建上下文,并且在翻译后创建tempImg.初始化没有任何问题,因为原始图像当前正在生成,但问题在于我想要的翻译.
我正在尝试通过为我的应用程序手动创建部分UI来绘制iPhone(在本例中为图形).基本上,我想绘制一个带圆角的矩形,一个阴影和一个半透明渐变作为矩形的填充.这是我的photoshop模型的屏幕截图: alt text http://img36.imageshack.us/img36/6097/picture1nvf.png
我已经有了使用CALayer创建一个带阴影的实心圆角矩形,但为了让形状和阴影显示,我必须设置一个背景颜色,这不允许我让我半透明渐变是图层的唯一填充.
我现在一直在研究这个问题,并阅读了整个Core Animation编程指南,但我没有取得任何进一步的进展.我觉得答案就在我的鼻子底下.
我错过了什么?
PSI知道我可能会使用一个图像文件来完成这个,但我正在尝试这样做,因为我想学习,有一天我想用这个做一些更高级的动画.
gradient core-animation core-graphics shadows quartz-graphics
/*
This should always produce 0 as output since all three methods increment(), decrement(), value() are thread safe(synchronized). but it is returning 1
*/
class Counter implements Runnable {
private int c = 0;
public synchronized void increment() {
c++;
}
public synchronized void decrement() {
c--;
}
public synchronized int value() {
return c;
}
public void run() {
try {
this.increment();
Thread.sleep(1000);
this.decrement();
Thread.sleep(1000);
this.increment();
Thread.sleep(1000);
this.decrement();
Thread.sleep(1000);
}
catch (InterruptedException e){
return;
}
}
public static void …Run Code Online (Sandbox Code Playgroud) 在Java中字符串开头找到双引号的正则表达式是什么?
例如,我有这个代码:
if (allLexeme[allLexemeIter].matches("\""))
Run Code Online (Sandbox Code Playgroud)
这适用于字符串," this
因为双引号后面有空格,但不适用于字符串"this