如何在Ruby on Rails中显示有向图?
基本上,我正在为Rails寻找像graphviz这样的东西.
我正在尝试使用GXT(ExtJS + GWT)运行示例应用程序,如教程中所述
http://www.sencha.com/learn/setting-up-your-first-ext-gwt-project-in-eclipse
当我尝试在eclipse中运行应用程序时,我收到错误
Loading modules
com.hello.gxt.HelloGXT
Loading inherited module 'com.extjs.gxt.ui.GXT'
[ERROR] Unable to find 'com/extjs/gxt/ui/GXT.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source?
[ERROR] Line 15: Unexpected exception while processing element 'inherits'
Run Code Online (Sandbox Code Playgroud)
我的构建路径看起来像这样

并且运行配置的构建路径如下所示

以下是来源:https://dl.dropbox.com/u/11776689/2012_09_27_HelloGXT.zip
我该如何解决这个问题?
'更新29.09.2012':前一个错误是固定的,但现在又得到另一个:
Loading modules
com.hello.gxt.HelloGXT
Loading inherited module 'com.sencha.gxt.ui.GXT'
Loading inherited module 'com.sencha.gxt.data.Data'
Loading inherited module 'com.sencha.gxt.core.Core'
[ERROR] Unexpected error while processing XML
java.lang.NoClassDefFoundError: com/google/gwt/core/ext/Generator
at java.lang.ClassLoader.findBootstrapClass(Native Method)
at java.lang.ClassLoader.findBootstrapClassOrNull(Unknown …Run Code Online (Sandbox Code Playgroud) 我需要实现一种方便的方法来确定移动应用程序是否被有效客户使用.我的客户告诉我,如果他们丢失了手机,他们肯定会联系运营商并锁定SIM卡.
因此,将身份验证绑定到SIM卡有效性似乎很自然(只要存在正确的SIM并且未锁定,应用程序就可以运行).然后,在丢失的情况下,客户只需要锁定他或她将要做的SIM卡(因为互联网银行发送SMS以批准交易到移动电话).
我试图读取与SIM卡相关的数据,但它仅适用于某些手机,而不适用于其他手机(有时我会得到空字符串而不是IMEI号码).
如何实现身份验证机制,即
如果不可能,那里有哪些认证选择(除了电子邮件/密码和短信确认的电话号码)?
更新1(2013年8月11日14:17 MSK):一个明显的解决方案是使用电话号码作为登录名和服务器生成的6位数作为密码.
然后,身份验证将如下工作:
您如何看待这个选项?
可以以某种方式改进吗?
负面模式有什么用?
NumberFormat nf = NumberFormat.getPercentInstance(Locale.ITALY);
DecimalFormat df = (DecimalFormat)nf;
df.applyPattern("###,###.###;(###,###.###)");
System.err.println(df.format(-12.45));//output (12,45);
Run Code Online (Sandbox Code Playgroud)
它会在什么情况下有用?不仅仅是一个模块吗?
我想用以下方法测试单例类的行为:
public class SomeSingleton
{
private final static int DEFAULT_VALUE1 = ...;
private final static int DEFAULT_VALUE2 = ...;
private static SomeSingleton instance;
public static void init(int value1, int value2)
{
if (instance != null)
{
throw new IllegalStateException("SomeSingleton already initialized");
}
instance = new SomeSingleton(value1, value2);
}
public static getInstance()
{
if (instance == null)
{
init(DEFAULT_VALUE1, DEFAULT_VALUE2);
}
return instance;
}
}
Run Code Online (Sandbox Code Playgroud)
然后我有一个带有几个测试方法的测试类,它们会init多次调用:
@RunWith(PowerMockRunner.class)
@PrepareForTest(SomeSingleton.class)
public class SomeSingletonTest {
@Test
public void testGetInstanceSunnyDay()
{
[...]
SomeSingleton.init(...); …Run Code Online (Sandbox Code Playgroud) 我需要创建一个基于Apache Tomcat的Web应用程序,它可以通过HTTP(多部分表单POST请求)接收大量(100 MB或更多)文件.
我尝试了Apache Commons Fileupload,它适用于较小的文件(20-40 MB).但它不适用于大文件.
有没有明显的方法来实现大文件上传除外
更新1(03.10.2013):这是我在上传2个文件大约时在服务器端获得的例外情况.总大小120.

我想写一个Vaadin 7应用程序(参见下面的MyVaadinUI),它要求用户输入用户名和密码.
如果它们是正确的,则应出现另一个视图(请参阅下面的MainUI)并占据整个区域(替换登录视图).
我试图在MyVaadinUI.goToMainWindow方法中实现这个转换,但是我得到了错误
java.lang.RuntimeException: Component must be attached to a session when getConnectorId() is called for the first time
at com.vaadin.server.AbstractClientConnector.getConnectorId(AbstractClientConnector.java:417)
at com.vaadin.server.communication.ConnectorHierarchyWriter.write(ConnectorHierarchyWriter.java:67)
at com.vaadin.server.communication.UidlWriter.write(UidlWriter.java:143)
at com.vaadin.server.communication.UidlRequestHandler.writeUidl(UidlRequestHandler.java:149)
at com.vaadin.server.communication.UidlRequestHandler.synchronizedHandleRequest(UidlRequestHandler.java:97)
at com.vaadin.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:37)
at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1371)
at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:238)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
Run Code Online (Sandbox Code Playgroud)
当我运行应用程序并按下按钮.
我该如何解决?
@Theme("mytheme")
@SuppressWarnings("serial")
public class MyVaadinUI extends UI
{
private TextField userNameTextField;
private PasswordField passwordTextField;
@WebServlet(value = "/*", asyncSupported = true)
@VaadinServletConfiguration(productionMode = false, ui = MyVaadinUI.class, widgetset = "ru.mycompany.vaadin.demo.AppWidgetSet")
public static class Servlet extends …Run Code Online (Sandbox Code Playgroud) 假设我有这样一个类:
public class ClassA
{
[...]
protected void methodIWantToTest()
{
[...]
}
[...]
}
Run Code Online (Sandbox Code Playgroud)
当我在IntelliJ Idea 13中编写单元测试时,当我写下类似的内容时,我不会遇到编译器错误:
public class ClassATest
{
@Test
public void test()
{
final ClassA objectUnderTest = new ClassA();
objectUnderTest.methodIWantToTest(); // Why can I access a protected method here?
}
}
Run Code Online (Sandbox Code Playgroud)
methodIWantToTest受到保护.为什么我可以在测试中访问它?
想象一下,我有一个SVN存储库.当它们准备就绪时,我可以对它进行更改.
当我正在处理特定任务时,我想在本地跟踪我的更改.所以我想也许我可以在SVN repo的根目录中创建一个git存储库.
然后,当特定问题的工作完成时,我可以对git进行本地提交并向SVN进行"全局提交"(签到).
问:如果我这样做,SVN方面是否会出现问题?
从理论上讲,它们不应该因为Git只会.git在根目录中创建一个目录而就是它.但我想听听人们自己使用这种方法的问题.
注意:我想在本地使用Git,仅适用于我(没有人应该注意到它).公司范围内向Git的迁移是不可能的.
我有一个Restlet ServerResource,它应该使用参数处理GET请求user.如果user等于某个值,则应返回一些图像,否则发送错误响应(404或403),表示不允许发送者获取图像.
import org.restlet.data.MediaType;
import org.restlet.representation.ObjectRepresentation;
import org.restlet.representation.Representation;
import org.restlet.resource.Get;
import org.restlet.resource.ResourceException;
import org.restlet.resource.ServerResource;
public class GetMap extends ServerResource {
@Get
public Representation getImage() {
final String user = getQuery().getValues("user");
if (user.equals("me")) {
//Read map from file and return it
byte[] data = readImage();
final ObjectRepresentation<byte[]> or=new ObjectRepresentation<byte[]>(data, MediaType.IMAGE_PNG) {
@Override
public void write(OutputStream os) throws IOException {
super.write(os);
os.write(this.getObject());
}
};
return or;
}
return null; // Here I want to send an error …Run Code Online (Sandbox Code Playgroud)