How about running a XPath expression from Java?
Pretty straight forward right, oh wait NAMESPACE!!!!
Here's a example on how to create your xpaht parser and the more complex Name Space Context.
Let's start with the NameSpaceContextImpl
Now the actual Xpath parser imple:
Hope it helps guy!!!
Haven't you always find your self googling the same old thing you used to do always when coding? Well that's what ForgettableDev is for: a compound of really stupid stuff that we always forget HOW TO DO and it takes hours to find.
viernes, 17 de abril de 2015
The famous Jar Hell issue
So I reckon I'm not the first one to have this problem. I'm certainly not the one who will tell you how to solve it BUT!!!!
Here is a really small example about using the JHades tool
Why am I posting this?
Because the example in the home page is a little bit outdated and if you search JHades for the maven dependency the first 4 links you hit get it wrong.
Maven Dependency
Java Code
You should place this in some place that you are sure it'll get run during building.
If you have issues during tests. Just create a test where the test method has this code.
Hope this helps!
Here is a really small example about using the JHades tool
Why am I posting this?
Because the example in the home page is a little bit outdated and if you search JHades for the maven dependency the first 4 links you hit get it wrong.
Maven Dependency
Java Code
You should place this in some place that you are sure it'll get run during building.
If you have issues during tests. Just create a test where the test method has this code.
Hope this helps!
viernes, 5 de diciembre de 2014
Change Maven Default JDK in MAC
Long time no see!!!!!
So I thought of type this one down before I forgot about it.
Now that Oracle start releasing at an increased rate I reckon it may be useful.
Soooo how to change the jdk maven uses to build you app:
1. Locate/create the file .mavenrc in your home
2. add the following line to it:
export JAVA_HOME=/Library/Java/JavaVirtualMachines/${actual_jdk_version}/Contents/Home
At the time of me writing this that placeholder value was: jdk1.7.0_51.jdk
Hope it helps you!
So I thought of type this one down before I forgot about it.
Now that Oracle start releasing at an increased rate I reckon it may be useful.
Soooo how to change the jdk maven uses to build you app:
1. Locate/create the file .mavenrc in your home
2. add the following line to it:
export JAVA_HOME=/Library/Java/JavaVirtualMachines/${actual_jdk_version}/Contents/Home
At the time of me writing this that placeholder value was: jdk1.7.0_51.jdk
Hope it helps you!
jueves, 2 de enero de 2014
The Freaking Command key
Hi all, long time no see HAPPY 2014.
So as this new year is starting I'm already having problems, I'm a mac user basically cause I don't have to pay for the Mac hehe.
Any way every once in a while the Command key in my keyboard stops working which makes me crazy!!!!!
So here I found a really nice fix:
If you type "killall Dock" into the command line in Terminal, it restarts the Dock.
This is, the Dock was causing the command key not to work.
As usual it wasn't me how find this out here is the link to the forum where I found the solution.
I hope it helps someone else.
So as this new year is starting I'm already having problems, I'm a mac user basically cause I don't have to pay for the Mac hehe.
Any way every once in a while the Command key in my keyboard stops working which makes me crazy!!!!!
So here I found a really nice fix:
If you type "killall Dock" into the command line in Terminal, it restarts the Dock.
This is, the Dock was causing the command key not to work.
As usual it wasn't me how find this out here is the link to the forum where I found the solution.
I hope it helps someone else.
martes, 17 de septiembre de 2013
Analyzing Threads
Hi there,
So I could take the time to write something about how to analyze threads right?
Thing is there is are tons of data around this out there, so instead of that I'll only share this post from dZone I've find:
http://architects.dzone.com/articles/how-analyze-java-thread-dumps
It is actually brilliant not only gives you context but it shows you how to read the dumps and gives you a hint on some patters.
The other thing I've got to share is a profiling tool I've been checking out (didn't know it existed) and it quite nice:
http://www.yourkit.com/
The tool allows you to hock to a VM and check what's going on in regards to CPU usage, thread count, memory (and it generations) etc.
It's really quite descriptive but it comes with a catch, you have to pay for it. Then again it has a trial period.
Well that's all folks!!!
So I could take the time to write something about how to analyze threads right?
Thing is there is are tons of data around this out there, so instead of that I'll only share this post from dZone I've find:
http://architects.dzone.com/articles/how-analyze-java-thread-dumps
It is actually brilliant not only gives you context but it shows you how to read the dumps and gives you a hint on some patters.
The other thing I've got to share is a profiling tool I've been checking out (didn't know it existed) and it quite nice:
http://www.yourkit.com/
The tool allows you to hock to a VM and check what's going on in regards to CPU usage, thread count, memory (and it generations) etc.
It's really quite descriptive but it comes with a catch, you have to pay for it. Then again it has a trial period.
Well that's all folks!!!
martes, 16 de julio de 2013
GIT rever to a particular commit
That stupid little silly thing we always forget how to do, right?
So how, HOW many times did you find your self having to do such thing due to, lets say, a less than brilliant coworker eh?
In my case, usually the less than brilliant coworker is me!!!
And I always forget how to do this, so this is how
git reset --hard d7517455bb118142bf12d08628a780d5372da045
It doesn't get easier than this.
In a near future (that is when I have time) I plan to post a summary of all this GIT stuff.
Hope it helps guys and girls....
Who am I laying to we know no girls read this :P
martes, 21 de mayo de 2013
The Secret language of WSDL - The entry point
Hi there, if you like me has to deal with a lot of service definition you'll be wise if you read how that WSDL actually works.
If you, like me, are to lazy to actually learn all that you may want to read this post.
So this post series (at least I hope to create a series out of this) will try to sum up the main thing one should know about how to read from a WSDL.
We will start by the main thing, at least for me, the ENTRY POINT.
So what to I mean by Entry Point.
For me it's just the Java class that will actually allow you to access all the operations defined in the service definition.
Where is this defined in a WSDL, easy just look for this tag:
<wsdl:service name="UserServiceImplService">
<wsdl:port binding="tns:UserServiceImplServiceSoapBinding" name="UserServiceImplPort">
<soap:address location="https://fake.service.provider.com/Some-path-dev/services/admin/UserService"/>
</wsdl:port>
</wsdl:service>
Now this portion of the WSDL will basically describe the entry point of some service.
Once you run your wsdl2java tool to generate the Java code, what class should I look for?
Well for starters I'll go with: UserServiceImplService
Which is the value of the name parameter in the wsdl:node service.
This class will allow you to access the proxy class (which is no other than the port), this proxy class will expose all the operations that are defined to be accessible for this service.
How do I find this port/proxy class?
Well..... try looking for: UserServiceImplPort
Which is no other than the value of the name parameter in the node: wsdl:port
This has worked out for me in the past I hope it helps you!
BTW do thank my good friend the Master of CXF Gustavo
Cheers
If you, like me, are to lazy to actually learn all that you may want to read this post.
So this post series (at least I hope to create a series out of this) will try to sum up the main thing one should know about how to read from a WSDL.
We will start by the main thing, at least for me, the ENTRY POINT.
So what to I mean by Entry Point.
For me it's just the Java class that will actually allow you to access all the operations defined in the service definition.
Where is this defined in a WSDL, easy just look for this tag:
<wsdl:service name="UserServiceImplService">
<wsdl:port binding="tns:UserServiceImplServiceSoapBinding" name="UserServiceImplPort">
<soap:address location="https://fake.service.provider.com/Some-path-dev/services/admin/UserService"/>
</wsdl:port>
</wsdl:service>
Now this portion of the WSDL will basically describe the entry point of some service.
Once you run your wsdl2java tool to generate the Java code, what class should I look for?
Well for starters I'll go with: UserServiceImplService
Which is the value of the name parameter in the wsdl:node service.
This class will allow you to access the proxy class (which is no other than the port), this proxy class will expose all the operations that are defined to be accessible for this service.
How do I find this port/proxy class?
Well..... try looking for: UserServiceImplPort
Which is no other than the value of the name parameter in the node: wsdl:port
This has worked out for me in the past I hope it helps you!
BTW do thank my good friend the Master of CXF Gustavo
Cheers
Suscribirse a:
Entradas (Atom)