Rama Krishna

Ranch Hand
+ Follow
since Oct 16, 2007
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Rama Krishna

Hibernate allows us to specify default connection isolation modes

For read-uncommited, or Connection.TRANSACTION_READ_UNCOMMITTED, you can set hibernate property as (?):
<prop key="hibernate.connection.isolation">1</prop>

How is this different from specifying "with ur" by adding an interceptor or modifying the hibernate core classes as per:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-3644?

Thanks
Krishna

William Brogden wrote:

are these open source JMS cross programming language compatible or we better write our own socket communication code ?



It is my understanding that JMS and MQ series are compatible since IBM was a big contributor during development of the API. In any case, I would certainly try JMS first.

Using messaging will also handle "simultaneous" query problems since presumably the utility you are trying to work with will only accept messages at a rate it can handle. Also of course you could have multiple clients using the same mechanism.

Bill



Awesome, started looking into Apache ActiveMQ, as it seems to support directly both Java (OpenWire wire protocol) and C (Stomp wire protocol) based clients, as both producers and consumers, using TCP protocol.

There seem a ton of projects using ActiveMQ
http://activemq.apache.org/projects-using-activemq.html

Are there any cross-language clients based example some one can suggest or a place we can start looking into, especially to configure the C side of the producer/consumer?

Thanks Bill
14 years ago

William Brogden wrote:

Wonder why byte-order is important.


here is a nice discussion of the significance of byte order.

How much of what kind of data does the C program take as input?

Ditto for what it puts out?

IF the C has to run as a separate program, hiding the details of this sort of inter-app communication is what SOAP and RPC was invented for. Maybe the brokerage has implemented a SOAP or RESTful interface like Amazon, Google and many others.

On the other hand, is there some reason you can't have the C code loaded as a library by Java and talk to it with Java Native Interface methods?

Bill



Figured out that Strings and socket communication in some cases do not have this problem which is good as we can now communicate by exchanging java POJOs/C STRUCTS formatted as String/XML likes.

They say that they have an XML based API but that only using MQ series and we were interested in open source solutions only. We are now looking at open source JMS options to queue incoming and outgoing messages, are these open source JMS cross programming language compatible or we better write our own socket communication code ?

Underestimated JNI, right now looking at limitations of JNI, because as long as you have one entry point into the C code and vice-versa, that is all you need. Could not find related example base anywhere though.

Thanks
Rama
14 years ago

There is nothing C specific or Java specific about socket communication, just opening sockets and sending bytes according to the well documented APIs. The only thing to watch out for is byte-order.


I know and can quickly design a thread safe handling of java - java socket communication. However, I will not be able to serialize/deserialize my java POJOs as it is C on the other side, so have to consider another common format similar to String/XML bytes (parse/format) that both can understand. Wonder why byte-order is important.


You have apparently concluded that the API the C program is using to talk to the brokerage service is too complex to duplicate in java.


That is true, they gave a pretty big static library and two header files to start with. The goal therefore is to re-use it and as you said, socket communication makes sense.


What interface does the C program present for RMI-IIOP or any other communication technique?

You will certainly be better off using the highest level API that is well documented.


None, they only gave us their C API and that is it. We will have to figure out how to call their API from our Java application.

I was therefore wondering if there were any examples where they have discussed cross language socket communication.
14 years ago
Any examples of Java - C programming language socket communication?
14 years ago

William Brogden wrote:"to do what?" why make the socket call to the brokerage service of course!

Bill



The C API does the communication with the brokerage firm, so I was not sure whether you meant socket communication with C API or the brokerage itself. Rather than re-writing their whole API again in Java, you meant communicate with the C API via JAVA using socket communication rather than RMI-IIOP?

But then using socket communication, I have to serialize, deserialize in a common protocol/standard or is there a simpler way to achieve this. Again, could you guide me to a location to get started?

Thanks
Krishna
14 years ago

William Brogden wrote:Since you say "web application" let me raise the question of multiple "simultaneous" requests.

If you have a single instance of the C program running, what will you do if additional requests come in?

If you let multiple requests access the C program, is the C api designed to handle this? Any instance variables that might get confused?

You might be better off writing your socket stuff in Java.

Bill



Not sure how C program would handle multiple requests or multi-threading, if there is no easy way, I can always queue them from a common Java class that does the calling.

"You might be better off writing your socket stuff in Java." to do what?
14 years ago
I need to leverage a C API that communicates with a brokerage firm using socket communication. The forum suggests using RMI-IIOP to communicate with C API. Should be able to handle the call backs too as asynchronous, i.e., their C API should have a call back functionality, be able to call an onEvent method of some eventHandler class on Java JVM side with minimal changes or modifications on the C side because of the lack of understanding or time spent learning C (IDL ?).

Is using RMI-IIOP to provide stubs on either end to make asynchronous calls the best bet?

There are beautiful RMI plugins for eclipse IDE (Genady) to quickly develop RMI based communication between JVMs, trying to run RMI examples based on security policies and RMI servers using command prompt attributes/flags is a pain. Are there similar tools to start quickly writing these stubs or for that matter, anything for Spring to quickly host or invoke Remote methods via IIOP? Where can I get started?

Thanks
Krishna
14 years ago
Commit set is pretty handy, but I would like to know a good place where ANT or UNIX based scripts are discussed to deal with CVS commands.


I think your best bet is to write a UNIX type script to parse the output of the CVS command.

Is it possible to get statistics of how many files and who have committed what on a day to day basis in CVS or am I asking for too much?
Is there a means to know exactly what files have been comitted and also files committed by person or date in Eclipse configured CVS (WinCVS)?

I have always known and used the tag application by date date1 and then on date2, I can get the complete source code from CVS with the tag date1 and always compare with tag date2 to get the difference, but I want to get all files committed by a person and if possible by/within date or time period. Is there a solution to the problem of controlling what is being committed to a CVS branch or trunk via Eclipse CVS and is it possible to get statistics of how many files and who have committed what on a day to day basis in CVS or am I asking for too much?

Thanks
Rama
Great, I never knew you could replace a string so easily that way.

The following string fails the query constructed by = signs, my query contains only = sign.

String s = "where name = '123 =' or name is null and name = ' name=' ;";
s = s.replaceAll("[^\\s']++(?=\\s*+(?:=|\\bis\\b))", "aliasObjectName.$0");

I ended up using \w++(?=\s*=)(?=[^']*(?:'[^']*'[^']*)*$) from another forum:



Result:
(name='asf', after replacement, (name='asf'
( name = 'name' or name is null), after replacement, ( aliasObjectName.name = 'name' or name is null)
(name is null), after replacement, (name is null)
name = ' name = ', after replacement, aliasObjectName.name = ' name = '
( name='' and name like '%name%'), after replacement, ( name='' and name like '%name%')
(name = 'name='), after replacement, (aliasObjectName.name = 'name=')
15 years ago
Henry, I think I knew what Rob was suggesting, when ever the regular expression (?<!') went into the CODE tags, it would become (?><!') there is no problem if you show that >< symbol as < in the CODE tags, I exactly see what I want to show and must be the same when others show too!

Rob Prime wrote:That's because the start should be (?<!'), without the >.



you meant lesser than sign right, meaning negative look behind because I don't see the greater than sign in your above quote.

That still misses things like "name is null" or "name like '%name'" but that's because you're simply not looking for "is" or like.
In the end I think that regular expressions are not the way to solve this issue, because it will be hard to find a regular expression for all solutions. I tried "(?<!')(\\w+)(\\s*)(?==|is|like|in)" but that still failed for cases "name = ' name = '" and "name = 'name='" - because the second occurrences in fact match as well. Your real requirement is "replace any field" which can be translated roughly as "replace anything that is not a string literal or operator".



This regular expression does not match even those that the regular expression (\w+\s*)(?==) matched Are you saying there is no solution to this problem via regular expressions?

I am able to search for words (may or may not have spaces) ending with '=' sign, all I want to add is that such words followed by '=' sign should not have a single quotation marks before (spaces could be allowed)

But the regular expression fails!

Any other solutions to this problem?>
15 years ago
Oops, fails all test cases



Result:

(name='asf', after replacement becomes, (name='asf'
( name = 'name' or name is null), after replacement becomes, ( name = 'name' or name is null)
(name is null), after replacement becomes, (name is null)
name = ' name = ', after replacement becomes, name = ' name = '
( name='' and name like '%name%'), after replacement becomes, ( name='' and name like '%name%')
(name = 'name='), after replacement becomes, (name = 'name=')


The regular expression (?<!')(\\w+)\\s*(?==) fails as well.>
15 years ago
so it should be more like



suggesting negative look behind without ' single quotation marks, but this fails the test case too. I am missing something more here.>
15 years ago