Win a copy of Java by Comparison (eBook) this week in the Java in General forum!

manuel aldana

Ranch Hand
+ Follow
since Dec 29, 2005
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by manuel aldana

I am having problems with wildcard in JMX. JMXConnectorFactory

I did it with groovy and 1.6.0_22 JDK



No idea why, looking at (reference above should work.

Are there any jmx switches that wildcards can be disabled (mbeans are exported through spring context)?

Thanks.
7 years ago
this is typically the field of dynamic typed languages where there is no static typing and returning by map style is common and straightforward.

for exampl in groovy i would not hesitate to do:


in java on the other hand i would never return a Map<String,Object>. Java is static typed so I wouldn't try to bypass the static typed information by using Object for all variables and casting around later (apart from some reflection magic, which is sometimes necessary).

For Java I would create a dedicated custom return class:
8 years ago
singletons semantics have their place (e.g. inside ioc-containers you often have instances which are immutable and only one instance is necessary and available).

the danger is if you have mutable state singletons. they tend to end in hidden global variables in your app. then if problems occurs analyzation is very tricky and debugging is hell, especially in multithreaded scenarios.

mutable state singletons are an enemy for encapsulation and reasoning about side-effects of code-statements!
sorry, i overread some details (that you want test java-code).

regarding productivity: though i like dynamic typed languages, for my side when testing java-code i also test in java. when using java i use a lot of static-typed-based automated refactorings and also want to let "safe-refactor" my test-code. i once tried to use groovy as test-language but the refactorings often broke my tests. therefore i had to touch them.

there is one exception for integration testing, which are more coarse grained: here i often refer to groovy test scripting (examples 'canoo webtest' or 'soap-ui' groovy integration). they are automation-testtools for webapps and SOAP-api.

I know, IDEs have nothing to do with testing frameworks, but coding test-code in groovy (junit,testng) is best possible and supported on IntelliJ.
8 years ago
the definitely best IDE for groovy support is IntelliJ. the upcoming free open-source edition from IntelliJ is also supporting it.

for creating test-doubles you do not need easy-mock. due to the dynamic nature of groovy there are other alternatives

some links:
http://groovy.codehaus.org/Unit+Testing
http://docs.codehaus.org/display/GROOVY/Groovy+Mocks
8 years ago
i guess you meant maven version 2.1?

1) if you pass to maven command you pass it to the maven run itself. to passthrough the stuff to the surefire plugin you have to configure the surefireplugin. see http://maven.apache.org/plugins/maven-surefire-plugin/test-mojo.html#systemProperties

2) you should reconsider passing property arguments to the as maven run property. first you (and your colleages) get quickly confused if more and more properties are added. better practice is either to code it directly in your test class or use src/test/resources to place property files there.


8 years ago
yes, that is what i am exactly doing right now (loading complete jaxb object and the query java style and filter it afterward)

but i was just interested whether such a lookahead is possible, because it happens quite often that you need some information of xml-children nodes when working on the events and don't want to unnecessarily parse to jaxb objects.

the jaxb-stream style works quite well on my machine. having a monster export file (~900MB) and iterating ~200K items takes only 90 seconds.

reason i used jaxb:
-quite big and complicated schema (couldn't bother to fiddle around with xpath or other queries)
-i need to traverse a lot of data from one xml entry inside java
-xjc to generate jaxb-classes out from xsd was quite smooth
hi,

because I got big xml-files I am using streaming/event style to parse xml entries and let them later transform to jaxb-objects.

a simplified xml example:


here i only want to receive an event for users who are aktive="true".



for that a lookahead would be necessary, but is such a lookahead possible with xml parsing in stream/event style (when getting a start-element-event it does not know about children elements, which is against the "nature" of streaming)?

thanks.
hi,

is there some java library/api which eases development of writing payment connectors (e.g. for credit-card, debit, paypal gateways)?

so far i only found http://jcp.org/en/jsr/detail?id=182, but it seems not be final and also outdated (from year 2004).
8 years ago
i am looking for online resources or a book covering e-payment/billing systems and especially debit-card,credit-card, paypal providers.
and how to approach an implementation of respective connectors which handle transactions with these providers.

i searched quite a lot at amazon or google but could not find any resources giving me good information (which is quite surprising). all of them were more focused on the business and security point of view.

if somebody could point me out to the right book or online tracks i would be glad

thanks.
8 years ago
i recently switched from suse (11) to ubuntu (9.04). main reason was the magnificent support (e.g. http://ubuntuforums.org/) and it handled better hardware out of the box (in my case hp dockingstation).
8 years ago
the configuration you mentioned are the version source/target settings for java itself. the highest released version for java is currently 1.6.
8 years ago

Paul Clapham wrote:

manuel aldana wrote:so can one generally say that count(<columnName>) is faster?



If you need to know for a particular situation then try it and see. If you don't need to know then the question is perhaps not worth asking...



i asked because i use queries like this sometimes and instead of measuring performance everytime i would then use a default count() query approach.
hi,

i am using count() query and having question on performance: is there a difference between using
count(*) and count(<columnName>)? * would select all columns whereas count(<column>) only selects one particular column, so i would guess that the latter is faster (a table with less column entries needs to be created before running count()).

i ran some test scripts and count(<columnName>) seems to faster, but i wouldn't bet on it for i don't know caching and internal tweaking strategies of the server. i also think it is dbms-server product specific.

so can one generally say that count(<columnName>) is faster?
I really like the FutureTask since java 5.0, but what I miss is a method like:


With FutureTask.exceptionOccurred() it would nicely fit to the other future queries like isDone() or isCancelled() and is much better readable as this try/catch construct.

Maybe there is a certain reason why such a exception-query method is missing?

ooops: could moderator please move this to java threads and synchronization.