I currently have a JSF application which sets the locale based on a user's choice of language. He gets a dropdown, and when choosing English, I set the locale to en, etc. This works very nice with number formats as well as with the language strings loaded from my ResourceBundle. So for en, I get English words and a . as decimal seperator. For fr, I get French and a , as decimal seperator
我目前有一个JSF应用程序,它根据用户选择的语言设置区域设置。 他得到一个下拉菜单,选择英语时,我将区域设置为en等。这对数字格式以及从我的ResourceBundle加载的语言字符串非常有用。 所以对于en,我会得到英文单词和a。 作为十进制分隔符。 对于fr,我得到法文和a,作为小数分隔符。 但是,现在有一个要求,对于这个网站,数字格式必须始终有一个,作为小数分隔符。 所以,我想保持语言环境固定为fr。 用户仍然必
Is general case of monad expressible in Java 6? Note the words "general case" — it may be possible that general case of monad is not expressible, although many particular cases of monad (ie many specific monads) are expressible. The problem here is (lack of) Higher-kinded generics in Java ; however, I saw that sample Haskell code was really ported to Java using the approach like htt
在Java 6中可以表达monad的一般情况吗? 请注意“一般情况”一词 - monad的一般情况可能是不可表达的,尽管monad的许多特定情况(即许多特定的monad)都是可以表达的。 这里的问题是(缺少)Java中更高级的泛型; 然而,我看到示例Haskell代码是真正使用像https://stackoverflow.com/a/877036/1123502(即public class Fix<F extends Fix<F>> )的方法移植到Java的。 当然,非类型安全的实现(比如使用Object和d
So, I just ran into an interesting problem while using the Scanner class to read contents from files. Basically, I'm trying to read several output files produced by a parsing application from a directory to compute some accuracy metrics. Basically, my code just walks through each of the files in the directory, and opens them up with a scanner to process the contents. For whatever reason,
所以,我在使用Scanner类从文件中读取内容时遇到了一个有趣的问题。 基本上,我试图从目录中读取由解析应用程序生成的几个输出文件,以计算一些准确度度量。 基本上,我的代码只是遍历目录中的每个文件,并用扫描器打开它们以处理内容。 无论出于何种原因,扫描仪都没有读取一些文件(所有UTF-8编码)。 即使这些文件不是空的,scanner.hasNextLine()在第一次调用时会返回false(我打开调试器并观察它)。 我每次都直接
So I am currently modelling a MVC type system, total noob to this pattern and I'm trying to figure out a couple of things but one thing particular I can't figure out how to handle. In my system I create eg a Customer Class & DAO with CRUD functionality which I understand (to an extent ) etc... I have a table in my database that log's data, this table is never accessed by the u
所以我目前正在建立一个MVC类型的系统,总的来说这个模式是noob,我试图弄清楚几件事情,但有一件事我特别想不出如何处理。 在我的系统中,我创建了一个客户类和带有CRUD功能的DAO,我了解(在某种程度上)等... 我在我的数据库中有一个表,记录了数据,这个表从来不会被用户访问,只有他们可以从这个表中的数据查看计算/结果的程度。 我如何在我的设计中表达这一点,我不需要CRUD功能只是返回SQL的结果(例如Select avera
I wrote this simple Java program: package com.salil.threads; public class IncrementClass { static volatile int j = 0; static int i = 0; public static void main(String args[]) { for(int a=0;a<1000000;a++); i++; j++; } } This generate the following disassembled code for i++ and j++ (remaining disassembled code removed): 0x000000
我写了这个简单的Java程序: package com.salil.threads; public class IncrementClass { static volatile int j = 0; static int i = 0; public static void main(String args[]) { for(int a=0;a<1000000;a++); i++; j++; } } 这为i ++和j ++生成以下反汇编代码(其余反汇编代码已删除): 0x0000000002961a6c: 49ba98e8d0d507000000 mov r10,7d
HashSet is based on HashMap. If we look at HashSet<E> implementation, everything is been managed under HashMap<E,Object> . <E> is used as a key of HashMap . And we know that HashMap is not thread safe. That is why we have ConcurrentHashMap in Java. Based on this, I am confused that why we don't have a ConcurrentHashSet which should be based on the ConcurrentHashMap
HashSet基于HashMap。 如果我们看一下HashSet<E>实现,所有东西都在HashMap<E,Object>下进行管理。 <E>被用作HashMap的关键字。 我们知道HashMap不是线程安全的。 这就是为什么我们有Java中的ConcurrentHashMap 。 基于此,我很困惑, 为什么我们没有一个ConcurrentHashSet应该基于ConcurrentHashMap ? 还有什么我失踪? 我需要在多线程环境中使用Set 。 另外,如果我想创建自己的ConcurrentHa
I was reading a lot about different application sizes after installation. EG: Why apk size increase in different android version But something I still do not understand. I have an application (com.onhost.skuska made in LibGDX) and on Android 4.3 . immediately after the installation (eg with no extra data) it takes 17.54 MB and on Android 5.0 , Galaxy S6 it takes 30.73 MB . At first I thoug
我在安装后阅读了大量有关不同应用程序大小的内容。 EG:为什么在不同的Android版本中增加apk大小 但是我仍然不明白。 我有一个应用程序(在LibGDX中制作的com.onhost.skuska)和Android 4.3 。 安装后立即(例如没有额外的数据),它需要17.54 MB ,在Android 5.0上 ,Galaxy S6需要30.73 MB 。 起初我认为它是关于不同的硬件或屏幕分辨率。 我试图在安卓4.3版的S4的Genymotion模拟器上安装该应用程序,它或多或少地是1
What is the best way to do GUIs in Clojure? Is there an example of some functional Swing or SWT wrapper? Or some integration with JavaFX declarative GUI description which could be easily wrapped to s-expressions using some macrology? Any tutorials? I will humbly suggest Seesaw. Here's a REPL-based tutorial that assumes no Java or Swing knowledge. Seesaw's a lot like what @tomje
在Clojure中做GUI的最佳方式是什么? 有没有一个功能的Swing或SWT包装的例子? 还是与JavaFX声明性GUI描述的一些整合,可以使用某种宏观方法轻松包装为s表达式? 任何教程? 我会虚心地建议跷跷板。 这里是一个基于REPL的教程,它假定没有Java或Swing知识。 跷跷板很像@tomjen的建议。 这里是“你好,世界”: (use 'seesaw.core) (-> (frame :title "Hello" :content "Hello, Seesaw" :on-close :e
I'm connecting a device with librxtx-java to Ubuntu. The code previously worked in 10.04, but in 12.04 it can't discover the usb-serial connected to the computer. java.util.Enumeration<CommPortIdentifier> portEnum = CommPortIdentifier.getPortIdentifiers(); while ( portEnum.hasMoreElements() ) { CommPortIdentifier portIdentifier = portEnum.nextElement(); System.out.println(
我将一个带有librxtx-java的设备连接到Ubuntu。 该代码以前工作在10.04,但在12.04,它无法发现连接到计算机的USB串行。 java.util.Enumeration<CommPortIdentifier> portEnum = CommPortIdentifier.getPortIdentifiers(); while ( portEnum.hasMoreElements() ) { CommPortIdentifier portIdentifier = portEnum.nextElement(); System.out.println( portIdentifier.getName() + " - " + getPortTypeName(portId
in my app the main page contains, quite a few images to load on my upload manager activity so it can take a few seconds, depending on how many images there are. i planned on creating a splashscreen to do this loading while displaying an image which is not as bad as the default blank screen with title. i have done this, which should work and does, except the setcontentview() does run but does no
在我的应用程序中,主页面包含了很多可以加载到我的上传管理器活动中的图像,因此可能需要几秒钟的时间,具体取决于有多少图像。 我计划创建一个启动画面来执行此加载,同时显示的图像不像标题的默认空白屏幕那么糟糕。 我已经做到了这一点,这应该工作,除了setcontentview()运行,但不显示。 public class SplashScreen extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { // TODO