Alex Armenteros

Ranch Hand
+ Follow
since May 05, 2010
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Alex Armenteros

What is exactly your question here? you described perfectly what is happening there.

len is the number of bytes read from the source file, that is used by the writer (FileOutputStream) to not write more bytes (which are junk) than it should.

Also thanks about that "FileChannel" class, did not know about that one.
7 years ago
Here i'm asking for your opinion about this code and possible improvements or errors you may see. (only limitation i'm aware of is i can't have multiple methods with the same name on the class), also don't know if this is the correct forum to post this, if not, please move the post accordingly please.

I've developed (i think) a function launcher from a JSON string
The Json string is something like this.

method specifies which method i want to execute, service specifies which class contains that method, and params contains the parameters for the method.

In this case i want to execute a method like this "public Object methodName(Object1 ob, List<Object2> ob)"

The launcher code is something like this.

I hope you find this useful on the future, and thanks in advance for your answers.
7 years ago
After some tries with lots of changes, and still without results

I configured the cipher in a MUCH simpler way like this... (I'm not aiming for security right now, I'm aiming for functionality)

and in JS

Tried decrypting in java and no problem.

Tried decrypting in JS and nothing on the output.

I'll try other places to look for an answer as it seems a problem with cryptoJS library. Thanks for your answers

PS: Used an online tool (dunno if links are allowed in this forum) to test the ciphertext (now I'm using Hex text, instead of base64) and the key and it decrypts perfectly (except the final padding ofc)

PS2: Finally i got it to work... And my final conclusion is that the documentation in crypto-js website is not useful. In decrypt function the ciphertext must be passed like this. "CryptoJS.lib.CipherParams.create({ciphertext: CryptoJS.enc.Hex.parse(texto)})" [Using Hex ciphertext]
8 years ago
It seems cryptoJS uses CBC and Pkcs7 as defaults, going to see if i can change it and I inform all of you.
8 years ago
Already done that, but "javascript dec.toString" returns nothing.

Changed the last java line to:

8 years ago
I'm trying to use tripleDES on a string in Java and decrypt it on javascript using crypto-js (I know there is a similar question but it's the other way around and cannot see the solution there)

As you may see the key is the 24 bytes 123.... (not final value of course)

java code

and in Javascript

Any minimal lead that tells me what i'm doing wrong (surely in javascript)
8 years ago
I think I solved it

I must not call applicationContext.refresh() before adding the configurer so this must be done:

8 years ago
Normally when using XML Beans I use this

But now I need to use Spring Scheduling and I need an ApplicationContext

And it seems the properties are black as this exception appears loading the Hibernate SessionFactory

org.hibernate.HibernateException: 'hibernate.dialect' must be set when no Connection available

Any error on that code snippet?

8 years ago
Anyone knows of an implementation of this library for "nowadays" Asterisks versions (1.8+)?

I searched all through Google and only found that library from 2006 for Asterisk 1.2 that only has some call monitoring functions.
8 years ago
I want to inject a value into an static field and found the workaround with the class MethodInvokingFactoryBean

on xml beans I think I must put this...

<bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<property name="staticMethod" value=""/>
<property name="arguments">
<ref bean="theDAOReference"/>

But I don't understand how or when this method will be called. Enlighten me please.
9 years ago
I already know that but the bad thing is that he is pretty stubborn and won't change his program, We'll try another aproach... Thanks.
I've only seen two problems

a) What sir Docherty has said.

b) remember always that int / int will return an int, so the fraction part of the number is lost even if you "cast" it to double. To solve this make the average operation int /double, double/int or double/double

9 years ago
My partner for some reason (and he won't change his mind) needs for another program (C++ w/o hibernate) a datetime column with the value "0000-00-00 00:00:00" . is there some way to insert/update that value FROM hibernate?
I've already seen that this is caused by a slow browser
9 years ago
I'm having trouble with an application that uses StreamingAMFEndpoint on tomcat.

I use the "kill -3 pid" command to see the tomcat stacktrace and I see lots of threads blocked on the class EndpointPushNotifier

Here is the configuration

The customQueueProcessor only prints a message when more than 10000 messages are present on a queue. But this is not the case.

A thread is blocked for almost 2 hours, and don't seem to be unlocked soon....

when I send a message I use this

Where template is the application spring-flex MessageTemplate

Edit: After looking a bit more... I've seen on which object is the thread waiting and which thread has that object locked.

"Thread-5" prio=10 tid=0x000000004f4bf000 nid=0x7717 waiting for monitor entry [0x0000000040d85000]
java.lang.Thread.State: BLOCKED (on object monitor)
at flex.messaging.client.EndpointPushNotifier.pushMessages(
- waiting to lock <0x00002aaab5018890> (a java.lang.Object)
at flex.messaging.client.FlexClient.directFlush(
- locked <0x00002aaab4ff3448> (a java.lang.Object)
at flex.messaging.client.FlexClient.push(
at flex.messaging.MessageBroker.routeMessageToMessageClient(
at flex.messaging.MessageBroker.routeMessageToService(
at org.springframework.flex.messaging.MessageTemplate.send(

The other thread is writing on a socket but it seems to never end that write.

"http-8080-16-in-streaming-mode" daemon prio=10 tid=0x00002aaaf40ef000 nid=0x1762 runnable [0x0000000043d1f000]
java.lang.Thread.State: RUNNABLE
at Method)
at org.apache.coyote.http11.InternalOutputBuffer.realWriteBytes(
at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(
at org.apache.coyote.http11.InternalOutputBuffer.flush(
at org.apache.coyote.http11.Http11Processor.action(
at org.apache.coyote.Response.action(
at org.apache.catalina.connector.OutputBuffer.doFlush(
at org.apache.catalina.connector.OutputBuffer.flush(
at org.apache.catalina.connector.Response.flushBuffer(
at org.apache.catalina.connector.ResponseFacade.flushBuffer(
at flex.messaging.endpoints.BaseStreamingHTTPEndpoint.streamChunk(
at flex.messaging.endpoints.StreamingAMFEndpoint.streamMessages(
at flex.messaging.endpoints.BaseStreamingHTTPEndpoint.handleFlexClientStreamingOpenRequest(
- locked <0x00002aaab50186e8> (a java.lang.Object)
at flex.messaging.endpoints.BaseStreamingHTTPEndpoint.serviceStreamingRequest(
at flex.messaging.endpoints.BaseStreamingHTTPEndpoint.service(
at flex.messaging.endpoints.StreamingAMFEndpoint$$EnhancerByCGLIB$$d6583184.service(<generated>)
at org.springframework.flex.servlet.MessageBrokerHandlerAdapter.handle(
at org.springframework.web.servlet.DispatcherServlet.doDispatch(
at org.springframework.web.servlet.DispatcherServlet.doService(
at org.springframework.web.servlet.FrameworkServlet.processRequest(
at org.springframework.web.servlet.FrameworkServlet.doPost(
at javax.servlet.http.HttpServlet.service(
at javax.servlet.http.HttpServlet.service(
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
at org.apache.catalina.core.ApplicationFilterChain.doFilter(
at org.apache.catalina.core.StandardWrapperValve.invoke(
at org.apache.catalina.core.StandardContextValve.invoke(
at org.apache.catalina.core.StandardHostValve.invoke(
at org.apache.catalina.valves.ErrorReportValve.invoke(
at org.apache.catalina.core.StandardEngineValve.invoke(
at org.apache.catalina.connector.CoyoteAdapter.service(
at org.apache.coyote.http11.Http11Processor.process(
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(

9 years ago