我正在使用装饰器来改变$exceptionHandler
行为,将日志发送到服务器.我的问题是异常的stackatrace似乎没用,只显示堆栈的一部分.例如:
语法错误:令牌'undefined'不是表达式[expression here]的列NaN处的主表达式.
Run Code Online (Sandbox Code Playgroud)at Error (native) at throwError (http://localhost:8080/angular/angular.js:6674:62) at primary (http://localhost:8080/angular/angular.js:6918:9) at unary (http://localhost:8080/angular/angular.js:6900:14) at multiplicative (http://localhost:8080/angular/angular.js:6883:16) at additive (http://localhost:8080/angular/angular.js:6874:16) at relational (http://localhost:8080/angular/angular.js:6865:16) at equality (http://localhost:8080/angular/angular.js:6856:16) at logicalAND (http://localhost:8080/angular/angular.js:6847:16) at logicalOR (http://localhost:8080/angular/angular.js:6839:41)
有没有办法配置AngularJS来显示更多的堆栈?如果我查看Chrome控制台,我可以看到更多堆栈,并获取文件名,但不能在异常处理程序中.
即使我更改Error
限制,我也看不到原始文件:
Error.stackTraceLimit = Infinity;
Run Code Online (Sandbox Code Playgroud) 让我们说我有一个procedure
叫myproc
.这是一个复杂的过程,我不能允许两个实例同时执行proc.
其实我这样做使用dbms_application_info.set_module
:
procedure start_process is
begin
dbms_application_info.set_module('myproc', 'running');
end;
Run Code Online (Sandbox Code Playgroud)
并在运行过程之前验证:
select 'S'
from v$session v
where v.module = 'myproc'
and v.action = 'running';
Run Code Online (Sandbox Code Playgroud)
在数据库级别,有更好的方法来检查这个吗?
不应该String
使用特定的格式化DateTimeFormatter
进行解析LocalDateTime.parse()
吗?
测试
DateTimeFormatter formatter = ISODateTimeFormat.dateTimeNoMillis()
LocalDateTime ldt = new LocalDateTime()
String val = ldt.toString(formatter)
System.out.println(val) //2013-03-26T13:10:46
// parse() throws java.lang.IllegalArgumentException: Invalid format: "2013-03-26T13:10:46" is too short
LocalDateTime nldt = LocalDateTime.parse(val, formatter)
Run Code Online (Sandbox Code Playgroud) 例如,检查以下查询;
$query = "SELECT * FROM users WHERE user='{$_POST['username']}';
Run Code Online (Sandbox Code Playgroud)
什么用途?
在字符串上下文中,我确实理解它解决的问题.
我可以做像$ animal ="cat"echo"{$ animal} s"这样的东西.//输出猫
但在我上面发布的SQL中,我只是不明白.以下不一样好吗?
$query = "SELECT * FROM users WHERE user='$_POST['username']' AND password='$_POST['password']'";
Run Code Online (Sandbox Code Playgroud)
那么,使用{和}获取方便的地方?欣赏SQL上下文中的任何示例?
在Swing应用程序中,在两个视图之间发送数据(交互)的最佳方法是什么?
看一下SCJP 6学习指南中的耦合会议,它说:
所有重要的OO应用程序都是许多类和接口协同工作的组合.理想情况下,OO系统中对象之间的所有交互都应该使用对象各自类的API,换句话说,契约.
如果我理解这是正确的,更好的方法是为每个视图创建接口(契约),如果需要,使用此接口方法来检索数据.这是一个好方法吗?花很多时间创建大量接口来说明视图所暴露的内容是否合适?
我认为另一种方法是使用类来保存视图的数据(模型).在这种情况下,直接访问这个模型类是一个好方法吗?
提前致谢.
我正在使用Twitter Bootstrap开发一个项目,并使用屏幕阅读器玩JavaScript组件.
当我触发模态对话框时,Jaws跳过模态进入页面中的下一个链接.
有没有办法实现可访问的模式?
我认为另一种解决方案是将静态页面设置为模态的功能,并在用户使用屏幕阅读器时重定向到此页面.如果用户使用屏幕阅读器,我能以某种方式检测到吗?
javascript accessibility modal-dialog twitter-bootstrap jaws-screen-reader
Groovy具有向现有类添加方法的功能,我发现了一些 有趣的类.
然后我发现我需要自定义我的Grails引导程序来加载它们,所以我添加:
def init = { servletContext -> addExtensionModules() }
def addExtensionModules() {
Map<CachedClass, List<MetaMethod>> map = [:]
ClassLoader classLoader = Thread.currentThread().contextClassLoader
try {
Enumeration<URL> resources = classLoader.getResources(MetaClassRegistryImpl.MODULE_META_INF_FILE)
for (URL url in resources) {
if (url.path.contains('groovy-all')) {
// already registered
continue
}
Properties properties = new Properties()
InputStream inStream
try {
inStream = url.openStream()
properties.load(inStream)
GroovySystem.metaClassRegistry.registerExtensionModuleFromProperties(properties,
classLoader, map)
}
catch (IOException e) {
throw new GroovyRuntimeException("Unable to load module META-INF descriptor", e) …
Run Code Online (Sandbox Code Playgroud) 我正在尝试测试maven-war-plugin的叠加功能.基本上我需要合并两个战争项目.
所以我将战争定义为依赖:
<dependency>
<groupId>my.group.id</groupId>
<artifactId>my-legacy-war-project</artifactId>
<version>${project.version}</version>
<type>war</type>
</dependency>
Run Code Online (Sandbox Code Playgroud)
然后配置叠加层:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<overlays>
<overlay>
<groupId>my.group.id</groupId>
<artifactId>my-legacy-war-project</artifactId>
<targetPath>legacy</targetPath>
</overlay>
</overlays>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
但Maven无法构建这个项目,抱怨这种依赖:
[错误]无法执行目标org.apache.maven.plugins:maven-war-plugin:2.3:项目my-project上的爆炸(默认):overlay [id my.group.id:my-legacy-war-project]不是项目的依赖项. - > [帮助1]
叠加层应该与Maven 3.0.5一起使用?为什么构建抱怨声明的依赖?
我在配置了夏令时的机器上使用Spring MVC(America/Sao_Paulo Time Zone).在我的表单类中,我使用注释DateTimeFormat来配置我的Date的输出:
public class JustificativaOcorForm {
...
@NotNull
@DateTimeFormat(pattern="yyyy-MM-dd")
private Date dataMarcacao;
...
}
Run Code Online (Sandbox Code Playgroud)
在调试时我得到的日期是16/10/2011(日/月/日),这是白天时间的开始,但是Spring将它转换为2011-10-15.为什么?
2011-11-04 16:35:31,965 [http-8080-Processor25] DEBUG org.springframework.core.convert.support.GenericConversionService - Converting value Sun Oct 16 00:00:00 BRST 2011 of [TypeDescriptor @javax.validation.constraints.NotNull @org.springframework.format.annotation.DateTimeFormat java.util.Date] to [TypeDescriptor java.lang.Long]
2011-11-04 16:35:31,965 [http-8080-Processor25] DEBUG org.springframework.core.convert.support.GenericConversionService - Converted to 1318730400000
2011-11-04 16:35:32,010 [http-8080-Processor25] DEBUG org.springframework.core.convert.support.GenericConversionService - Converted to '2011-10-15'
Run Code Online (Sandbox Code Playgroud)
我看到了这个问题:Spring中的@DateTimeFormat产生了一天一天的错误
但是Spring 3使用了Joda-Time,我的classpath中有joda-time-2.0.jar所以我不知道为什么会这样,以及我如何解决它.
[编辑]
我已经测试了创建LocalData对象,并找到了一些东西:
LocalDate ld = new LocalDate( new SimpleDateFormat("dd/MM/yyyy").parse("16/10/2011").getTime() );
System.out.println( new SimpleDateFormat("dd/MM/yyyy HH:mm:ss Z z").format( ld.toDate() ) ); …
Run Code Online (Sandbox Code Playgroud) 我正在获取groovyx.net.http.HttpResponseException: Not Found
并希望查看来自的日志HTTPBuilder
。我正在将Groovy 2.1.9与一起使用groovyConsole
。
因此,我检查了该博客文章,其中提到有关添加log4j.xml
到的信息groovy.home/conf/
。我做到了,这是我的文件:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
<appender name="console" class="org.apache.log4j.ConsoleAppender">
<param name="Target" value="System.out" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{ISO8601} %-5p %c{1} - %m%n" />
</layout>
</appender>
<category name="groovyx.net.http">
<priority value="DEBUG" />
</category>
<!-- Use DEBUG to see basic request/response info;
Use TRACE to see headers for HttpURLClient. -->
<category name="groovyx.net.http.HttpURLClient">
<priority value="INFO" />
</category>
<category name="org.apache.http"> …
Run Code Online (Sandbox Code Playgroud) java ×4
groovy ×2
jodatime ×2
angularjs ×1
date-parsing ×1
dst ×1
exception ×1
grails ×1
grails-2.2 ×1
groovy-2 ×1
httpbuilder ×1
javascript ×1
logging ×1
maven ×1
maven-3 ×1
modal-dialog ×1
mysql ×1
oracle ×1
php ×1
plsql ×1
spring-mvc ×1
swing ×1
war ×1