пятница, 28 декабря 2012 г.
пятница, 21 декабря 2012 г.
IDEA12 can't run osgi config
IDEA-97769 IDEA12 can't run osgi config
Actually only this stops me from switching to idea12 even after purchasing Ultimate by their doomsday discount ($50)
Actually only this stops me from switching to idea12 even after purchasing Ultimate by their doomsday discount ($50)
пятница, 30 ноября 2012 г.
Why is Erlang slower than Java?
Why is Erlang slower than Java on all these small math benchmarks?
Despite many answers and interest the question is still open - why?
Erlang HiPE is also compiled to native, compact data types (not min 32/64 bit sizes as in java), no threading overhead (actors)... And still java7 is faster from x10 to x100 in that benchmarks.
Why? dynamic typing, slow GC or poor native compiling?
Despite many answers and interest the question is still open - why?
Erlang HiPE is also compiled to native, compact data types (not min 32/64 bit sizes as in java), no threading overhead (actors)... And still java7 is faster from x10 to x100 in that benchmarks.
Why? dynamic typing, slow GC or poor native compiling?
суббота, 6 октября 2012 г.
scala vs java8
Despite all bold promises from Oracle, java8 will be still much inferior to Scala:
http://www.infoq.com/articles/java-8-vs-scala (e.g. traits vs virtual methods - can't be compared)
In all of this java8 will be released no earlier than mid-2013 and scala "certainly won't be sitting still between now and 2013"(c)
(c) from comments:
"Notwithstanding the nice new features in Java 8, Scala seems (in my opinion) to remain significantly more concise and clean than Java."
"Remeber even if its java 8, it still just java. Don't expect too much."
"the Scala folks are delighted that Java 8 will have lambdas, since that will ultimately result in attention to performance of such code, and perhaps even to how it is represented in classfiles. Scala will likely benefit from the resulting improvements."
http://www.infoq.com/articles/java-8-vs-scala (e.g. traits vs virtual methods - can't be compared)
In all of this java8 will be released no earlier than mid-2013 and scala "certainly won't be sitting still between now and 2013"(c)
(c) from comments:
"Notwithstanding the nice new features in Java 8, Scala seems (in my opinion) to remain significantly more concise and clean than Java."
"Remeber even if its java 8, it still just java. Don't expect too much."
"the Scala folks are delighted that Java 8 will have lambdas, since that will ultimately result in attention to performance of such code, and perhaps even to how it is represented in classfiles. Scala will likely benefit from the resulting improvements."
воскресенье, 9 сентября 2012 г.
how-to-create-mutable-java-lang-string
2012, 17 years since java born: how-to-create-mutable-java-lang-string
понедельник, 3 сентября 2012 г.
четверг, 9 августа 2012 г.
Job
HH: Senior Java Developer for R&D (Highload):
Крупнейший оператор рекламного рынка ищет опытных java разработчиков на свои highload проекты по созданию и развитию low-latency (<50ms) рекламных платформ нового поколения.
Прежде всего необходим достойный опыт с JavaSE (сore) и многопоточностью (без этого - no hire).
Далее неплохо будет уметь готовить Netty, Spring, OSGI, NIO, работать с SEDA архитектурами и NoSQL хранилищами данных.
Очень приветствуется опыт с системами DataGrid (например, Hazelcast или Infinispan)
Совсем идеально — если у вас будет опыт работы с highload, low-latency java приложениями, масштабируемыми на N>10 нод в кластере.
Применение (понимание) таких фреймворков и паттернов как Netty, Disruptor, опыт тюнинга GC, а также опыт с JNA/JNI (для переписывания критичных участков на cpp) или sun.misc.Unsafe (!).
Если с высокими нагрузками опыта нет, но есть многолетний опыт в java enterprise (Spring, Hibernate, Swing, Oracle, JMS/Tibco, EJB etc.) — нестрашно, научим!
Проекты новые, динамично развиваются, современные технологии, TDD применяется, legacy код отсутствует, релизы — часто!
....
p.s. Вопросы можно задавать здесь =)
Крупнейший оператор рекламного рынка ищет опытных java разработчиков на свои highload проекты по созданию и развитию low-latency (<50ms) рекламных платформ нового поколения.
Прежде всего необходим достойный опыт с JavaSE (сore) и многопоточностью (без этого - no hire).
Далее неплохо будет уметь готовить Netty, Spring, OSGI, NIO, работать с SEDA архитектурами и NoSQL хранилищами данных.
Очень приветствуется опыт с системами DataGrid (например, Hazelcast или Infinispan)
Совсем идеально — если у вас будет опыт работы с highload, low-latency java приложениями, масштабируемыми на N>10 нод в кластере.
Применение (понимание) таких фреймворков и паттернов как Netty, Disruptor, опыт тюнинга GC, а также опыт с JNA/JNI (для переписывания критичных участков на cpp) или sun.misc.Unsafe (!).
Если с высокими нагрузками опыта нет, но есть многолетний опыт в java enterprise (Spring, Hibernate, Swing, Oracle, JMS/Tibco, EJB etc.) — нестрашно, научим!
Проекты новые, динамично развиваются, современные технологии, TDD применяется, legacy код отсутствует, релизы — часто!
....
p.s. Вопросы можно задавать здесь =)
пятница, 27 июля 2012 г.
android.util.Log#wtf ))
funny android developers: android.util.Log#wtf
"What a Terrible Failure: Report a condition that should never happen. The error will always be logged at level ASSERT with the call stack..."
вторник, 24 июля 2012 г.
Ubuntu x64, avd device creation error
in order to use android sdk in ubuntu (12.04) x64 you need to install x32 java libraries (~270mb), otherwise: Error: Failed to create the SD card
вторник, 10 июля 2012 г.
netty 3.5.1 bundle in Felix 3.2.1 osgi Container = ClassNotFoundException
netty 3.5.1 started in osgi (felix 3.2.1):
If you debug and dig into netty source code - you'll find more descriptive exception: java.lang.ClassNotFoundException: sun.misc.Unsafe not found by org.jboss.netty
The problem seems that osgi container doesn't normally expose sun.misc.* internals, so the application cannot find it, though it's Oracle Jdk 1.6 with this stuff inside.
Looking further to the source code - you'll find the workaround: -Dorg.jboss.netty.tryUnsafe=false
p.s. issue discussion on the netty github tracker
... [org.jboss.netty.util.internal.QueueFactory] - Unable to instance LinkedTransferQueue, fallback to LegacyLinkedTransferQueue java.lang.NoClassDefFoundError: Could not initialize class org.jboss.netty.util.internal.LinkedTransferQueue at org.jboss.netty.util.internal.QueueFactory.createQueue(QueueFactory.java:53) ~[na:na] at org.jboss.netty.channel.socket.nio.AbstractNioWorker.(AbstractNioWorker.java:111) ~[netty-3.5.1.Final.jar:na] at org.jboss.netty.channel.socket.nio.NioWorker. (NioWorker.java:44) ~[netty-3.5.1.Final.jar:na] at org.jboss.netty.channel.socket.nio.NioWorkerPool.createWorker(NioWorkerPool.java:34) ~[netty-3.5.1.Final.jar:na] at org.jboss.netty.channel.socket.nio.NioWorkerPool.createWorker(NioWorkerPool.java:26) ~[netty-3.5.1.Final.jar:na] at org.jboss.netty.channel.socket.nio.AbstractNioWorkerPool. (AbstractNioWorkerPool.java:58) ~[netty-3.5.1.Final.jar:na] at org.jboss.netty.channel.socket.nio.NioWorkerPool. (NioWorkerPool.java:29) ~[netty-3.5.1.Final.jar:na] at org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory. (NioClientSocketChannelFactory.java:149) ~[netty-3.5.1.Final.jar:na] at org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory. (NioClientSocketChannelFactory.java:114) ~[netty-3.5.1.Final.jar:na] ...
If you debug and dig into netty source code - you'll find more descriptive exception: java.lang.ClassNotFoundException: sun.misc.Unsafe not found by org.jboss.netty
The problem seems that osgi container doesn't normally expose sun.misc.* internals, so the application cannot find it, though it's Oracle Jdk 1.6 with this stuff inside.
Looking further to the source code - you'll find the workaround: -Dorg.jboss.netty.tryUnsafe=false
p.s. issue discussion on the netty github tracker
среда, 27 июня 2012 г.
четверг, 7 июня 2012 г.
Bazaar + Intellij IDEA = ?
После столь стремительного фидбека по поводу git в идее, очень удивляет ситуция с bazaar в идее. Плагин - уже не работает сначала этого года - запрос дифа между 2 ревизиями в истории например (аналогично падает на коммите и видимо много где еще):
- баг на это конечно есть, прошло уже полгода...
Плагин видимо чисто опенсорсный, поддерживаемый парой человек, иначе не понимаю как это объяснить. Проблема в том, что он единственный, другого плагина в идее к bzr вроде как нет (
rg.emergent.bzr4j.intellij.BzrFileRevision.loadContent()[B: org.emergent.bzr4j.intellij.BzrFileRevision.loadContent()[B java.lang.AbstractMethodError: org.emergent.bzr4j.intellij.BzrFileRevision.loadContent()[B at com.intellij.openapi.vcs.history.FileHistoryPanelImpl$TreeNodeOnVcsRevision.loadContent(FileHistoryPanelImpl.java:1353) at com.intellij.openapi.vcs.history.VcsHistoryUtil.loadRevisionContent(VcsHistoryUtil.java:145) at com.intellij.openapi.vcs.history.VcsHistoryUtil.showDiff(VcsHistoryUtil.java:81) at com.intellij.openapi.vcs.history.FileHistoryPanelImpl$13.run(FileHistoryPanelImpl.java:642) at com.intellij.openapi.progress.impl.ProgressManagerImpl$TaskRunnable.run(ProgressManagerImpl.java:469) at com.intellij.openapi.progress.impl.ProgressManagerImpl$2.run(ProgressManagerImpl.java:178) at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:218) at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcess(ProgressManagerImpl.java:169) at com.intellij.openapi.progress.impl.ProgressManagerImpl$8.run(ProgressManagerImpl.java:378) at com.intellij.openapi.application.impl.ApplicationImpl$6.run(ApplicationImpl.java:434) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662) at com.intellij.openapi.application.impl.ApplicationImpl$1$1.run(ApplicationImpl.java:145)
- баг на это конечно есть, прошло уже полгода...
Плагин видимо чисто опенсорсный, поддерживаемый парой человек, иначе не понимаю как это объяснить. Проблема в том, что он единственный, другого плагина в идее к bzr вроде как нет (
среда, 30 мая 2012 г.
Git + Intellij IDEA
какая же крутая поддержки git в идее: все летает, все под рукой, просто и удобно, на своих местах, очень юзабельно.
Вызов любой сложной дорогостоящей операции - секунда, две в худшем случае.
p.s. svn, perforce-ы и иже с ними - как страшный сон =)
Вызов любой сложной дорогостоящей операции - секунда, две в худшем случае.
p.s. svn, perforce-ы и иже с ними - как страшный сон =)
вторник, 22 мая 2012 г.
maven bugs
все-таки windows для java разработки не тру, даже под cygwin: maven + git + cygwin = пара часов поисков веселого бага - MRELEASE-581 Git relative pathing broken with release plugin
суббота, 19 мая 2012 г.
пятница, 18 мая 2012 г.
yet another gotcha this week )
when running scp task from ant (1.8) script - you need place jsch-0.1.48.jar to ant classpath (via IDE e.g.), otherwise you'll get "class org.apache.tools.ant.taskdefs.optional.ssh.Scp was not found" (SO).
And in case of running it from maven - instead of standart form:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.7:run (default) on project ...
ildException has occured: Problem: failed to create task or type scp
[ERROR] Cause: the class org.apache.tools.ant.taskdefs.optional.ssh.Scp was not found.
[ERROR] This looks like one of Ant's optional components.
[ERROR] Action: Check that the appropriate optional JAR exists in
[ERROR] -ANT_HOME\lib
[ERROR] -the IDE Ant configuration dialogs
[ERROR]
[ERROR] Do not panic, this is a common problem.
[ERROR] The commonest cause is a missing JAR.
[ERROR]
[ERROR] This is not a bug; it is a configuration problem
[ERROR]
[ERROR] around Ant part ...<scp ....
[ERROR] -> [Help 1]
And in case of running it from maven - instead of standart form:
you'll need to add the following dependencies:maven-antrun-plugin 1.7 deploy .... run
otherwise you'll get in maven smth like that:maven-antrun-plugin 1.7 org.apache.ant ant-jsch 1.7.0 com.jcraft jsch 0.1.48 deploy .... run
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.7:run (default) on project ...
ildException has occured: Problem: failed to create task or type scp
[ERROR] Cause: the class org.apache.tools.ant.taskdefs.optional.ssh.Scp was not found.
[ERROR] This looks like one of Ant's optional components.
[ERROR] Action: Check that the appropriate optional JAR exists in
[ERROR] -ANT_HOME\lib
[ERROR] -the IDE Ant configuration dialogs
[ERROR]
[ERROR] Do not panic, this is a common problem.
[ERROR] The commonest cause is a missing JAR.
[ERROR]
[ERROR] This is not a bug; it is a configuration problem
[ERROR]
[ERROR] around Ant part ...<scp ....
[ERROR] -> [Help 1]
faced gotcha
you must use special openssh format key when running scp from ant: http://netpenthe.wordpress.com/2007/02/02/jschexception-invalid-privatekey-ant-scp/
ну дела...
такой баг нашли: http://stackoverflow.com/questions/10620680/why-volatile-in-java-5-doesnt-synchronize-cached-copies-of-variables-with-main
слабо верится что только сейчас всплыло ведь jsr133 вышла аж в 2004 году, думаю поломали просто.
слабо верится что только сейчас всплыло ведь jsr133 вышла аж в 2004 году, думаю поломали просто.
четверг, 17 мая 2012 г.
суббота, 28 апреля 2012 г.
вторник, 17 апреля 2012 г.
GoodBuy Enterprise, Welcome HighLoad!
I've been working in DB Russia Development Center almost 6 years, different projects, different teams - from ERP corporate systems to proprietary trading platfoms and financial exchanges...
Now the story is over (well, tired of enterprise intrabank legacy monsters, time to new challenges etc.) and luckily I found small russian startup-like project developing highload app.
So hope to get a lot of hands-on exp with such cool technologies as Netty, Cassandra, Hadoop and real high scalability )
Now the story is over (well, tired of enterprise intrabank legacy monsters, time to new challenges etc.) and luckily I found small russian startup-like project developing highload app.
So hope to get a lot of hands-on exp with such cool technologies as Netty, Cassandra, Hadoop and real high scalability )
четверг, 29 марта 2012 г.
ordered high throughput message monitor
Consider we have some high-throughput message listener, say processing more than 1000 messages per sec and there is a task to add some checks on each message like latency or correct ordering checks.
The task is quite common in remote messaging systems with failover functionality: e.g. you can miss a few messages when your messaging system is failovered or get stale ones due to some network issues or bugs in your messaging system itself.
Latency checks are OK - just compare operation between 2 timestamps eventually.
The problem is with ordering checks as surely we'll have some race-conditions here but using locks/synchronization will most likely kill performance and scalability.
So we need some kind of non-blocking algorithm - sure CAS atomics will help us.
Let's specify the requirements, we need:
-track for missed messages (when get forward ones)
-ignore the stale messages (when get old)
The task is quite common in remote messaging systems with failover functionality: e.g. you can miss a few messages when your messaging system is failovered or get stale ones due to some network issues or bugs in your messaging system itself.
Latency checks are OK - just compare operation between 2 timestamps eventually.
The problem is with ordering checks as surely we'll have some race-conditions here but using locks/synchronization will most likely kill performance and scalability.
So we need some kind of non-blocking algorithm - sure CAS atomics will help us.
Let's specify the requirements, we need:
-track for missed messages (when get forward ones)
-ignore the stale messages (when get old)
No more words, let's just code it:
вторник, 7 февраля 2012 г.
how to save static fields in android junit tests?
if you have "extends ActivityInstrumentationTestCase2" android junit tests then their static fields will be cleared out after each method run (if you call super.tearDown()), the problem is with android.test.ActivityTestCase#scrubClass()
Non static fields will be cleared by default JUnit implemention, so you should not get any regression issues here ))
p.s. +SO question
protected void scrubClass(final Class<?> testCaseClass) throws IllegalAccessException { final Field[] fields = getClass().getDeclaredFields(); for (Field field : fields) { final Class fieldClass = field.getDeclaringClass(); if (testCaseClass.isAssignableFrom(fieldClass) && !field.getType().isPrimitive()) { try { field.setAccessible(true); field.set(this, null); } catch (Exception e) { android.util.Log.d("TestCase", "Error: Could not nullify field!"); } if (field.get(this) != null) { android.util.Log.d("TestCase", "Error: Could not nullify field!"); } } } }-which is called from android.test.ActivityInstrumentationTestCase2#tearDown(). Just override it with empty method:
@Override protected void scrubClass(Class testCaseClass) { // ignore }-and you'll save your static variables!
Non static fields will be cleared by default JUnit implemention, so you should not get any regression issues here ))
p.s. +SO question
четверг, 2 февраля 2012 г.
faced gotcha: puzzle with google account in android emulator
When creating your device in AVD - if you select configuration by android version like android 2.2 - you 'll fail to add google account on it ))
Only if you select device configuration by Google API Version (like API Level 8) - you'll get an ability to have google/gmail sign-on on you emulator. Quite a funny.
- related SO question.
Only if you select device configuration by Google API Version (like API Level 8) - you'll get an ability to have google/gmail sign-on on you emulator. Quite a funny.
- related SO question.
Подписаться на:
Сообщения (Atom)