我找到了这个较旧的讨论:有没有人使用Swing的"swingx"扩展?,但我想知道SwingLabs,SwingX的当前状态.一堆下载地址等都被破坏了,例如:
https://swingx.dev.java.net http://swinglabs.org/projects.jsp上的第一个链接
https://swingx.dev.java.net/files/documents/2981/153005/swingx-1.6.2-bundle.zip最新稳定下载
等等...
这只是一个替换新域名的问题,还是甲骨文摧毁了这些活动?
我有一个数据集(user, product, review),并希望将其提供给mllib的ALS算法.
该算法需要用户和产品为数字,而我的是String用户名和字符串SKU.
现在,我获得了不同的用户和SKU,然后在Spark之外为他们分配数字ID.
我想知道是否有更好的方法来做到这一点.我想到的一种方法是编写一个自定义RDD,基本上枚举1到n,然后在两个RDD上调用zip.
解压缩android上的文件似乎非常慢.起初我以为这只是模拟器,但在手机上似乎是一样的.我尝试过不同的压缩级别,并最终降级到存储模式,但仍需要很长时间.
无论如何,一定有理由!还有其他人有这个问题吗?我的解压缩方法如下所示:
public void unzip()
{
try{
FileInputStream fin = new FileInputStream(zipFile);
ZipInputStream zin = new ZipInputStream(fin);
File rootfolder = new File(directory);
rootfolder.mkdirs();
ZipEntry ze = null;
while ((ze = zin.getNextEntry())!=null){
if(ze.isDirectory()){
dirChecker(ze.getName());
}
else{
FileOutputStream fout = new FileOutputStream(directory+ze.getName());
for(int c = zin.read();c!=-1;c=zin.read()){
fout.write(c);
}
//Debug.out("Closing streams");
zin.closeEntry();
fout.close();
}
}
zin.close();
}
catch(Exception e){
//Debug.out("Error trying to unzip file " + zipFile);
}
}
Run Code Online (Sandbox Code Playgroud) 我对(Rhino)脚本引擎和相关类的生命周期和并发语义感兴趣.特别:
Bindings应该是线程安全的?ScriptEngine.eval(...)?CompiledScript实例Invocable.getInterface(...)?C#的LinkedList的RemoveFirst()和RemoveLast()操作是否有一些惯用的,性能或设计哲学的原因是没有返回删除的值?
现在,如果我想阅读并删除第一个值,我相信咒语是:
LinkedList<string> list = ...;
...
string removed = list.First.Value;
list.RemoveFirst();
Run Code Online (Sandbox Code Playgroud)
在Java中,它将是:
LinkedList<String> list = ...;
...
String removed = list.removeFirst();
Run Code Online (Sandbox Code Playgroud)
别误会我的意思; 我并不是说Java更好.只需将Node公开为公共构造,C#的LinkedList就有了更多的可供性.我想了解设计选择.
我需要打印数字,通过增加字体大小和重量来强调中间的一些数字.在下面的例子中,456强调.

使用的字体和两种尺寸是用户可配置的.
当前代码使用三次调用来完成此操作Graphics.DrawString(...).
我遇到的问题是,对于大多数字体,我看到的456是1像素的问题(相对于灰线,其他数字的位置比其他数字高):

我在帖子的底部为各种字体添加了一些调试转储(Bob Powell公式).其他技术产生了类似的结果.
为了在共同基线上打印文本,需要计算特定基线的基线偏移量Font.我尝试过使用三种技术:
首先,MSDN的代码:http://msdn.microsoft.com/en-us/library/xwf9s90b(v=vs.80).aspx
ascent = fontFamily.GetCellAscent(FontStyle.Regular);
ascentPixel = font.Size * ascent / fontFamily.GetEmHeight(FontStyle.Regular)
Run Code Online (Sandbox Code Playgroud)
其次,代码来自:使用GDI +,沿着共同基线对齐文本(用几种不同的字体绘制)的最简单方法是什么?
最后,Bob Powell的帖子代码:http://www.bobpowell.net/formattingtext.htm
这是我的绘制方法:
private void DrawOnBaseline(Graphics g, string text, FontWithBaseline fwb, Brush brush, float x, float y) {
g.DrawString(text, fwb.Font, brush, x, y - fwb.Baseline, StringFormat.GenericTypographic);
}
Run Code Online (Sandbox Code Playgroud)
当FontWithBaseline简单地联系起来,其各自的基准计算一个字体:
public class FontWithBaseline {
private Font m_font;
private float m_baseline;
public FontWithBaseline(Font font) {
m_font …Run Code Online (Sandbox Code Playgroud) 我使用的是scala 2.9.3和scalatest_2.9.3-1.9.2.我在使用匹配器断言字符串不包含子字符串时遇到问题:
import org.scalatest.FlatSpec
import org.scalatest.matchers.ShouldMatchers._
class Learning extends FlatSpec {
behavior of "..."
it should "..." in {
val msg = "Upload successful"
msg should include ("successful") // compiles
msg should not include ("error") // does not compile
}
}
Run Code Online (Sandbox Code Playgroud)
奇怪的是,当我扩展时org.scalatest.FunSuite,编译错误消失了.这是怎么回事?
报告的编译错误是:
[ant:scalac] Learn.scala: error: value include is not a member of org.scalatest.matchers.ShouldMatchers.ResultOfNotWordForLengthWrapper[java.lang.String]
[ant:scalac] serialized should not include ("error")
[ant:scalac] ^
[ant:scalac] one error found
Run Code Online (Sandbox Code Playgroud) 对于读取XML,Java 1.5中内置了SAX和DOM.您可以使用JAXP而不需要了解有关哪些解析器可用的详细信息...那么,在Java 1.5及更早版本中编写 XML文档的规则是什么?
理想情况下,只需几行代码就可以进行无变化的读写操作.
我在应用程序范围内存储数据.我想在每小时后清除这些数据.实际上使用它作为缓存一小时.实现这个的最佳方法是什么?之前我们使用会话范围来存储这些数据,并且在会话到期后它过去会过期.由于此数据在整个应用程序中是唯一的,因此我们希望将其存储在应用程序范
我想知道何时调用Storm Spout上的各种方法.
我看了ISpoutjavadoc,这给了我以下心智模型:
"instantiated" -- open(...) -----> "activated"
"activated" -- deactivate() --> "deactivated"
"deactivated" -- activate() ----> "activated"
"activated" -- close() -------> "shutdown"
"deactivated" -- close() -------> "shutdown"
Run Code Online (Sandbox Code Playgroud)
但我不确定何时IComponent.declareOutputFields(...)被召唤.之前还是之后open(...)?何时需要声明输出流和字段?内declareOutputFields(...)?或者可以保留对它的引用并在OutputFieldsDeclarer以后定义它们?如果是这样,它可以在一个单独的线程上吗?
我发现了这个相关的问题(测试风暴螺栓和喷口),但答案似乎没有指出任何设计原则或规格.
java ×5
c# ×2
lifecycle ×2
.net ×1
android ×1
apache-spark ×1
apache-storm ×1
api-design ×1
caching ×1
collections ×1
concurrency ×1
gdi+ ×1
jsp ×1
matcher ×1
rhino ×1
scala ×1
scalatest ×1
swing ×1
swingx ×1
unzip ×1
xml ×1