我正在玩Java中的Threads.
我在网站上找到以下示例:
public class ThreadTest {
public static void main(String args[]) {
Thread t1 = new Thread(new Thread1());
t1.start();
Thread t2 = new Thread(new Thread2());
t2.start();
}
}
public class Thread1 implements Runnable {
@Override
public void run() {
for (int i = 0; i < 20; i++) {
System.out.println(new java.util.Date());
}
}
}
public class Thread2 implements Runnable {
@Override
public void run() {
for (int i = 0; i < 20; i++) {
System.out.println(i);
}
}
}
Run Code Online (Sandbox Code Playgroud)
预期的结果将是这样的: …
我得到了一些数据:
def data = "# some useless text\n"+
"# even more\n"+
"finally interesting text"
Run Code Online (Sandbox Code Playgroud)
我怎样才能得到那个"有趣的部分"?所以基本上所有的行,不是以#开头.
TF-IDF
并且Cosine Similarity
是文本聚类的常用组合.每个文档由TF-IDF权重的向量表示.
这就是我的教科书所说的.
使用余弦相似度,您可以计算这些文档之间的相似性.
但为什么这些技术一起使用呢?
有什么好处?
可以使用例如Jaccard Similarity吗?
我知道,它是如何工作的,但我想知道,为什么这些技术正是如此.
linguistics data-mining text-mining tf-idf cosine-similarity
我正在尝试将String解析FEBRUARY 2019
为LocalDate
.
这是我的方法:
LocalDate month = LocalDate.parse("FEBRUARY 2019", DateTimeFormatter.ofPattern("MMMM yyyy"));
Run Code Online (Sandbox Code Playgroud)
或者设置Locale.US
:
LocalDate month = LocalDate.parse("FEBRUARY 2019", DateTimeFormatter.ofPattern("MMMM yyyy", Locale.US));
Run Code Online (Sandbox Code Playgroud)
但我得到的是以下异常:
Exception in thread "main" java.time.format.DateTimeParseException: Text 'FEBRUARY 2019' could not be parsed at index 0
Run Code Online (Sandbox Code Playgroud) 我在ButtonGroup中有几个JRadioButtons.
private ButtonGroup radioGroup= new ButtonGroup();
private JRadioButton radio1= new JRadioButton("Red");
private JRadioButton radio2= new JRadioButton("Green");
private JRadioButton radio3= new JRadioButton("Blue");
radioGroup.add(radio1);
radioGroup.add(radio2);
radioGroup.add(radio3);
Run Code Online (Sandbox Code Playgroud)
如何查看选择了哪一个?
随着System.out.println(radioGroup.getSelection())
我只得到这样的事情javax.swing.JToggleButton$ToggleButtonModel@32b3714
.
我已经下载并安装了适用于Windows的XAMPP 5.6.15.
当我点击"包括什么?" 它说它附带MariaDB 10.1.9
.但是在它的根目录中有一个文件夹mysql
,但没有mariadb
.
当我执行时:
echo $_SERVER["MYSQL_HOME"];
Run Code Online (Sandbox Code Playgroud)
我明白了:
\xampp\mysql\bin
Run Code Online (Sandbox Code Playgroud)
所以我认为它仍然带有MySQL而不是MariaDB?
我无法渲染primefaces 的面包屑控件.我正在使用ui:repeat动态构建面包屑.我把它包装在p:breadCrumb标签内的那一刻,我无法在页面上看到控件
以下代码我在我的.xhtml中使用
<p:breadCrumb>
<ui:repeat value="#{conversationScope.trail}" var="bcrumb">
<h:outputLink value="#{bcrumb.url}">
<h:outputText value="#{bcrumb.label}" />
<h:outputText value=">" />
</h:outputLink>
<p:menuitem value="#{bcrumb.label}" url="#{bcrumb.url}" />
</ui:repeat>
</p:breadCrumb>
Run Code Online (Sandbox Code Playgroud)
请建议有没有其他选择?
我想测量,2个不同的程序需要多长时间才能执行1个任务.一个程序使用线程,另一个没有.任务是计数高达2000000.
带线程的类:
public class Main {
private int res1 = 0;
private int res2 = 0;
public static void main(String[] args) {
Main m = new Main();
long startTime = System.nanoTime();
m.func();
long endTime = System.nanoTime();
long duration = endTime - startTime;
System.out.println("duration: " + duration);
}
public void func() {
Thread t1 = new Thread(new Runnable() {
@Override
public void run() {
for (int i = 0; i < 1000000; i++) {
res1++;
}
}
});
Thread t2 …
Run Code Online (Sandbox Code Playgroud) java ×6
mysql ×2
benchmarking ×1
buttongroup ×1
concurrency ×1
data-mining ×1
database ×1
flags ×1
groovy ×1
jradiobutton ×1
jsf ×1
linguistics ×1
localdate ×1
loops ×1
mariadb ×1
primefaces ×1
quicksort ×1
sorting ×1
string ×1
swing ×1
text-mining ×1
tf-idf ×1
xampp ×1