小编Ran*_*Lin的帖子

如何让SQL编辑器在Intellij IDEA 13中检查snytax?

回到12,如果我没记错的话,在SQL编辑器中编辑SQL文件时,IntelliJ IDEA会问我使用的是哪种方言,并检查其语法.

但是,使用13中的新数据库工具,默认情况下SQL编辑器不验证任何内容,我只能自动完成关键字.

DatabaseSQL support插件被启用.

我是否需要设置其他任何内容才能使其在SQL编辑器中运行?或其他一些选项,我应该确保它已启用?

sql intellij-idea

5
推荐指数
1
解决办法
7319
查看次数

如何在Grizzly http服务器中设置Jersey的模板基本路径?

使用Apache JerseyGrizzly http服务器,如何设置基本模板路径?

由于我没有使用Servlet容器,因此我使用绝对文件路径分配模板基本路径.但泽西回应了404.

以下是我的项目设置

项目目录:

src
 ?? java
      .....
 ?? resources
    ?? templates
       ?? index.mustache
Run Code Online (Sandbox Code Playgroud)

申请:

public class ExampleApplication extends ResourceConfig {

  public CustomTableApplication() {
    packages("com.example.app");

    setupTemplateEngine();
  }

  private void setupTemplateEngine() {
    property(MvcFeature.TEMPLATE_BASE_PATH, "/templates/");
    register(MustacheMvcFeature.class);
  }
}
Run Code Online (Sandbox Code Playgroud)

控制器:

@Path("/")
public class Index {

  @GET
  @Template(name = "index")
  public String index() {
    return "";
  }
}
Run Code Online (Sandbox Code Playgroud)

我如何创建HttpServer:

HttpServer server = new HttpServer();
NetworkListener listener = new NetworkListener("example", "localhost", 8080);
server.addListener(listener);

ServerConfiguration config …
Run Code Online (Sandbox Code Playgroud)

java jersey grizzly

5
推荐指数
1
解决办法
1939
查看次数

org.openqa.selenium.InvalidElementStateException:无法执行本机交互:无法加载本机事件组件

在将FF9更新为FF10之后,使用Java绑定在Windows 7中使用版本2.15.0和Firefox9时,我遇到了此错误.我尝试在网上建议禁用本机事件,但没有运气.在线搜索了更多解决方案后,我将WebDriver更新到2.17.0版.问题已得到解决,我有时也没有遇到同样的问题.我再次升级到最新版本的WebDriver,2.19.0,问题解决了.现在我在将FF10更新到11之后面临同样的问题.我升级到2.20,但问题占了上风.我禁用了原生事件如下,但我仍然得到错误.

使用Java:

FirefoxProfile profile = new FirefoxProfile(); 
profile.setPreference("webdriver_enable_native_events", false); 
driver = new FirefoxDriver(profile); 
Run Code Online (Sandbox Code Playgroud)

Stacktrace(当我尝试移动鼠标悬停在元素上时):

org.openqa.selenium.InvalidElementStateException: Cannot perform native interaction: Could not load native events component. 
Command duration or timeout: 30.07 seconds
Build info: version: '2.20.0', revision: '16008', time: '2012-02-28 15:00:40'
System info: os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.6.0_31' 
Driver info: driver.version: RemoteWebDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) 
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) 
at java.lang.reflect.Constructor.newInstance(Unknown Source) 
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java: 170) 
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.­java: 123) 
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java: 438) 
at org.openqa.selenium.remote.ExecuteMethod.execute(ExecuteMethod.java: 47) …
Run Code Online (Sandbox Code Playgroud)

java selenium webdriver selenium-firefoxdriver

3
推荐指数
1
解决办法
4685
查看次数

检查String x是否等于String []中的任何字符串

如果用户输入的字符串等于字符串数组中的任何字符串,我试图设置一个布尔值true.

我有即兴创作并提出了这个问题

String[] cancelWords = {"cancel", "nevermind", "scratch that"};
boolean valueEqualsCancel = true;
for(String cancelWord : cancelWords) {
  if(!valueEqualsCancel) break;
  valueEqualsCancel =  valueEqualsCancel && value.equals(cancelWord);
}
Run Code Online (Sandbox Code Playgroud)

valueEqualsCancel事实并非如此.

有小费吗?

java

3
推荐指数
4
解决办法
1万
查看次数

Angular解释{{}}在自定义指令的链接函数内

有没有办法解释具有我的指令作为属性的div的内容:

例如:

 <div my-directive>{{1+1}}</div>
Run Code Online (Sandbox Code Playgroud)

我的链接功能如下所示:

  link = (scope, element, attrs) =>
  interpretedString = element.text()
Run Code Online (Sandbox Code Playgroud)

在这个例子interpretedString 中等于{{1+1}}而不是2

任何帮助?在scope.$eval求值的属性,但是如果我想评价一个指令的文字是什么?

谢谢

directive angularjs angularjs-directive

3
推荐指数
1
解决办法
1105
查看次数

是否有一种解决方法可以从一周的第一天开始制作DateAxis抽奖活动?

当我创建一个需要带周周期的轴的图表时,我遇到了这个问题.

当我设置勾选单位DateAxisnew DateTickUnit(DateTickUnitType.Day, 7),它每7天显示一次勾号.但是,刻度标记的日期不是从一周的第一天开始.您可以在屏幕截图中观察此行为.

青色线05-01 w18(May. 1, Week 18)低于w18(Week 18)刻度线,这是因为刻度线的日期w18实际上是5月2日,即星期三.

这使得图表看起来不正确,因为人们倾向于认为每个刻度被认为是本周的开始.

在检查源代码后,我发现DateAxis剂量不支持这种行为一周(无论如何都没有周类型).

我不能创建另一个,DateTickUnitType因为私有构造函数和correctTickDateForPosition()方法DateAxis也是私有的.我试图覆盖nextStandardDate()但没有满足结果出来.

如何DateAxis从一周的第一天开始绘制刻度线?


这是截图和示例代码

周期中带有DateAxis的图表

需要JFreeChart/JCommon

public class Main extends ApplicationFrame {

  public Main (String title) throws ParseException {
    super(title);
    JPanel chartPanel = createDemoPanel();
    chartPanel.setPreferredSize(new java.awt.Dimension(800, 600));
    setContentPane(chartPanel);
  }

  private static JFreeChart createChart(XYDataset dataset) {
    JFreeChart chart = ChartFactory.createXYLineChart("Week period in DateAxis", "X", "Y", 
        dataset, PlotOrientation.VERTICAL, true, true, …
Run Code Online (Sandbox Code Playgroud)

java jfreechart

2
推荐指数
1
解决办法
3131
查看次数

在命名类型和未命名类型之间进行比较时编译错误

package main

import (
    "fmt"
    "html/template"
)

func main() {
    fmt.Println(template.HTML("test") == "test")

    htmlString := "test"
    fmt.Println(template.HTML("test") == htmlString)
}
Run Code Online (Sandbox Code Playgroud)

http://play.golang.org/p/dON4eLpGN8

文档template.HTML:http: //golang.org/pkg/html/template/#HTML

第一个比较是true.但是,第二次比较产生以下错误:

无效操作:"html/template".HTML("test")== htmlString(不匹配的类型"html/template".HTML和string)

有人可以解释引擎盖下发生的事情吗?

go

0
推荐指数
1
解决办法
118
查看次数