![](https://img-blog.csdnimg.cn/20210511192715387.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
Java
Java
physicist4AI
自然语言处理三大顶会审稿人 zhihu.com/people/guotong1988
展开
-
【java/scala】regex/正则,保留英文和空格
【代码】【java/scala】regex/正则,保留英文和空格。原创 2024-06-20 11:37:12 · 82 阅读 · 0 评论 -
Java, Comparator, 报错 Comparison method violates its general contract!
用这段java代码可以复现这个报错。原创 2024-03-29 17:54:07 · 110 阅读 · 0 评论 -
Spark, import java in scala, 报错 NoClassDefFoundError: Could not initialize class
在scala文件里import一个java文件,报错。很可能是import的这个java文件里的。里的代码的初始化问题。原创 2024-02-28 14:03:48 · 91 阅读 · 0 评论 -
报错 lambda expressions are not supported in -source (use -source to enable lambda expressions)
【代码】lambda expressions are not supported in -source 1.5 (use -source 8 to enable lambda expressions)原创 2024-02-28 11:19:59 · 40 阅读 · 0 评论 -
【java performance】避免在循环条件中使用复杂表达式
在不做编译优化的情况下,在循环中,循环条件会被反复计算,如果不使用复杂表达式,而使循环条件值不变的话,程序将会运行的更快。例子:import java.util.Vector;class CEL {void method (Vector vector) {for (int i = 0; i ; // ... }}原创 2014-02-21 15:36:46 · 3372 阅读 · 1 评论 -
IDEA的maven配置不生效,还是很多不能import,刷新pom使生效
重新让pom文件刷新生效原创 2023-01-01 17:49:09 · 582 阅读 · 0 评论 -
javacc 6 生成 C++
cmd> java -cp C:\javacc-6.0\bin\lib\javacc.jar jjtree _.jjt cmd> java -cp C:\javacc-6.0\bin\lib\javacc.jar javacc _.jjoptions {JAVA_UNICODE_ESCAPE = true;OUTPUT_LANGUAGE = "c++";NAMESPACE = "adde翻译 2015-03-20 11:06:14 · 1594 阅读 · 0 评论 -
javacc笔记5
void TypeDecl() : {Token t;}{|t= { jjtThis.name = t.image; } ("[]")?}}refer to current token as "t" and current AST node as "jjtThis"the text of the current token (t.原创 2013-05-24 09:27:39 · 925 阅读 · 2 评论 -
javacc 生成的文件 解析
jj_la变量:lookahead的计数器,检查下jj_la个token是否匹配原创 2013-11-18 16:43:33 · 1297 阅读 · 1 评论 -
javacc笔记4
SKIPSimply throw away the matched string (after executing any lexical action).MOREContinue (to whatever the next state is) taking the matched string along. T his string will be a prefix of the new mat原创 2013-05-22 08:50:52 · 1029 阅读 · 2 评论 -
javacc笔记
WHAT IS LOOKAHEAD?The job of a parser is to read an input stream and determine whether or not the input stream conforms to the grammar.原创 2013-05-20 08:00:31 · 1113 阅读 · 7 评论 -
javacc ()? ()* ()+
()? 一个或没有 ()* 一个或多个 ()+没有或多个原创 2015-03-27 11:35:03 · 743 阅读 · 0 评论 -
javaparser, Java 1.5 Parser and AST
https://code.google.com/p/javaparser/原创 2013-12-03 15:23:07 · 3040 阅读 · 0 评论 -
javacc笔记2
void basic_expr() : {} { "(" expr() ")" // Choice 1 | "(" expr() ")" // Choice 2 | "new" // Choice 3 }The choice determination algorithm works as follows: if (next token is ) {原创 2013-05-20 08:30:26 · 910 阅读 · 3 评论 -
javacc使用
http://download.csdn.net/detail/guotong1988/5267165Path加上D:\javacc-5.0\binjjtree *.jjtjavacc *.jj原创 2013-04-17 11:22:46 · 1344 阅读 · 0 评论 -
javacc 两张图
Figure 1.1 The token manager converts a sequence of characters to a sequence of Token objects.Figure 1.2 The parser analyzes the sequence of tokens.翻译 2013-06-08 14:28:01 · 856 阅读 · 0 评论 -
javacc 计算器 实例
options { STATIC=false;}PARSER_BEGIN(calculator)import java.io.PrintStream ;public class calculator { double previousValue = 0.0 ; public static void main(String args[]) throws ParseExce转载 2013-05-07 18:15:51 · 1395 阅读 · 0 评论 -
javacc笔记3
void Input() : {} { "a" BC() "c" } void BC() : {} { "b" [ "c" ] }有两种输出可能,如果: void BC() : {} { "b" [ LOOKAHEAD( { getToken(1).kind == C && getToken(2).kind != C } )原创 2013-05-22 08:24:08 · 841 阅读 · 0 评论 -
JJTree笔记
JJTree defines a Java interface Node that all parse tree nodes must implement. The interface provides methods for operations such as setting the parent of the node, and for adding children and retriev原创 2013-06-08 12:09:05 · 987 阅读 · 3 评论 -
GWT, HTTP ERROR: 503
servlet删掉web.xml没用的servlet原创 2014-08-01 14:56:34 · 1257 阅读 · 0 评论 -
GWT com.google.gwt.user.client.rpc.StatusCodeException: 404 <html>
修改web.xml的servlet配置原创 2014-07-18 15:31:32 · 2337 阅读 · 1 评论 -
GWT 设置TextBox输入时的字体大小
css文件里.searchFormInputBox {font-size:26px;height: 35px;border: 2px groove white}原创 2014-07-16 16:25:12 · 1639 阅读 · 0 评论 -
GWT 把FileUpload控件替换为一个按钮实现
外面加上 native void jsClickUpload(Element pElement) /*-{pElement.click(); }-*/;原创 2014-07-17 15:19:36 · 1466 阅读 · 0 评论 -
GWT添加媒体显示
http://code.google.com/p/bst-player/downloads/list下载bst-player-api-2.0.3.jar下载core-player-provider-2.0.jar SimplePanel panel = new SimplePanel(); AbstractMediaPlayer playe原创 2013-07-11 14:36:45 · 1208 阅读 · 1 评论 -
GWT工程添加横向的Progressbar
使用smartgwt.jar原创 2013-07-10 13:57:51 · 1074 阅读 · 0 评论 -
GWT 批量上传
import gwtupload.server.UploadAction;import gwtupload.server.exceptions.UploadActionException;import gwtupload.shared.UConsts;import java.io.File;import java.io.FileInputStream;import ja原创 2014-07-30 20:40:27 · 1706 阅读 · 1 评论 -
*.gwt.xml
--> --> --> -->原创 2013-05-23 10:30:55 · 1676 阅读 · 0 评论 -
GWT 使用HTML纯代码
HTMLPanel原创 2014-07-21 17:23:22 · 1459 阅读 · 0 评论 -
GWT,AbsolutePanel
要设置 setWidth("300px"); setHeight("300px");原创 2014-07-11 16:14:10 · 1210 阅读 · 0 评论 -
GWT 图表 GChart 实例
First download the jar from the project home page http://code.google.com/p/gchart/Put it under war/WEB-INF/lib and add the gchart.jar to your classpathCreate a Web Application project called it G原创 2013-05-21 11:02:40 · 1828 阅读 · 0 评论 -
报错:package javax.mail does not exist
package javax.mail does not existpackage javax.mail.internet does not existcannot find symbolsymbol: class PasswordAuthenticationsymbol: class Authenticator原创 2022-09-30 11:22:10 · 1282 阅读 · 0 评论 -
ClassNotFoundException: fastjson.TypeReference 以及 NoClassDefFoundError: fastjson/TypeReference
pom.xml配了,不是一个常规的ClassNotFoundException / NoClassDefFoundError可以绕过:JSON.parseObject(inputString, new TypeReference<List<SomeClass>>() { });改为(List<SomeClass>) JSON.parseObject(inputString);...原创 2022-05-19 17:48:36 · 413 阅读 · 0 评论 -
spark,scala调用java代码,报错 NoClassDefFoundError + ClassNotFoundException
在pom.xml文件的<build>里要加上<sourceDirectory>src/main/scala</sourceDirectory><testSourceDirectory>src/test/scala</testSourceDirectory>原创 2022-05-18 09:09:47 · 531 阅读 · 0 评论 -
KL divergence 的 Java 实现
public static final double log2 = Math.log(2); /** * *Note*: If any value in <tt>p2</tt> is <tt>0.0</tt> then the KL-divergence * is <tt>infinite</tt>. Limin changes it to zero instead of infinite. */原创 2022-02-19 09:10:12 · 204 阅读 · 0 评论 -
Java-Python的完全对齐的tokenizer(字级别)
python侧:def tokenize(textString): split_tokens = [] for i in range(len(textString)): split_tokens.append(textString[i]) return split_tokensdef convert_by_vocab(char2id, split_tokens): output = [] for token in split_tokens: if原创 2021-08-03 11:37:13 · 201 阅读 · 0 评论 -
maven报错 Could not find artifact jdk.tools
export JAVA_HOME=/your/java/home/再执行maven的指令原创 2021-05-28 22:02:26 · 806 阅读 · 0 评论 -
maven报错 Perhaps you are running on a JRE rather than a JDK?
export JAVA_HOME=/your/java/home/原创 2021-05-28 21:39:43 · 164 阅读 · 0 评论 -
java scala print不输出 / 刷print缓存
println("!!!")System.out.flush() // NEW"STOP".toInt原创 2021-05-11 16:55:28 · 285 阅读 · 0 评论 -
Java的 String.split 还是挺慢的
改用StringUtils.splitimport org.apache.commons.lang3.StringUtils;原创 2021-04-30 15:22:37 · 513 阅读 · 1 评论 -
java/scala正则匹配英文句号
object ScalaTest { def main(args: Array[String]): Unit = { println("ABC...".replaceAll("\\.", "")) println("ABC…………".replaceAll("…", "")) }}原创 2020-02-11 10:37:23 · 741 阅读 · 0 评论