Alex Armenteros

Ranch Hand
+ Follow
since May 05, 2010
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
2
Received in last 30 days
0
Total given
1
Given in last 30 days
0
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.
6 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.
6 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]
7 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.
7 years ago
Already done that, but "javascript dec.toString" returns nothing.

Changed the last java line to:

7 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)
7 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="foo.bar.SpecificDBUpdates.setDAO"/>
<property name="arguments">
<list>
<ref bean="theDAOReference"/>
</list>
</property>
</bean>

But I don't understand how or when this method will be called. Enlighten me please.
8 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


8 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
8 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(EndpointPushNotifier.java:339)
- waiting to lock <0x00002aaab5018890> (a java.lang.Object)
at flex.messaging.client.FlexClient.directFlush(FlexClient.java:1505)
- locked <0x00002aaab4ff3448> (a java.lang.Object)
at flex.messaging.client.FlexClient.push(FlexClient.java:1080)
at flex.messaging.MessageBroker.routeMessageToMessageClient(MessageBroker.java:1624)
at flex.messaging.services.MessageService.pushMessageToClient(MessageService.java:670)
at flex.messaging.services.MessageService.pushMessageToClients(MessageService.java:598)
at flex.messaging.services.messaging.adapters.ActionScriptAdapter.invoke(ActionScriptAdapter.java:90)
at flex.messaging.services.MessageService.serviceMessage(MessageService.java:318)
at flex.messaging.services.MessageService.serviceMessage(MessageService.java:233)
at flex.messaging.services.MessageService.serviceMessage(MessageService.java:224)
at flex.messaging.MessageBroker.routeMessageToService(MessageBroker.java:1400)
at org.springframework.flex.messaging.MessageTemplate.send(MessageTemplate.java:137)
at dbms.ThreadMonitorV2.run(ThreadMonitorV2.java:169)

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 java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
at org.apache.coyote.http11.InternalOutputBuffer.realWriteBytes(InternalOutputBuffer.java:756)
at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:448)
at org.apache.coyote.http11.InternalOutputBuffer.flush(InternalOutputBuffer.java:318)
at org.apache.coyote.http11.Http11Processor.action(Http11Processor.java:985)
at org.apache.coyote.Response.action(Response.java:183)
at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:325)
at org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:296)
at org.apache.catalina.connector.Response.flushBuffer(Response.java:549)
at org.apache.catalina.connector.ResponseFacade.flushBuffer(ResponseFacade.java:279)
at flex.messaging.endpoints.BaseStreamingHTTPEndpoint.streamChunk(BaseStreamingHTTPEndpoint.java:1083)
at flex.messaging.endpoints.StreamingAMFEndpoint.streamMessages(StreamingAMFEndpoint.java:238)
at flex.messaging.endpoints.BaseStreamingHTTPEndpoint.handleFlexClientStreamingOpenRequest(BaseStreamingHTTPEndpoint.java:836)
- locked <0x00002aaab50186e8> (a java.lang.Object)
at flex.messaging.endpoints.BaseStreamingHTTPEndpoint.serviceStreamingRequest(BaseStreamingHTTPEndpoint.java:1055)
at flex.messaging.endpoints.BaseStreamingHTTPEndpoint.service(BaseStreamingHTTPEndpoint.java:460)
at flex.messaging.endpoints.StreamingAMFEndpoint$$EnhancerByCGLIB$$d6583184.service(<generated>)
at org.springframework.flex.servlet.MessageBrokerHandlerAdapter.handle(MessageBrokerHandlerAdapter.java:101)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)

8 years ago