Skip to content

Tag: java

Regex for matching something if it is not preceded by something else

With regex in Java, I want to write a regex that will match if and only if the pattern is not preceded by certain characters. For example: I want to match if bar is not preceded by foo. So the output would be: Answer You want to use negative lookbehind like this: Where (?<!x) means “only if it doesn&…

How to make a copy of a file in android?

In my app I want to save a copy of a certain file with a different name (which I get from user) Do I really need to open the contents of the file and write it to another file? What is the best way …

Validating a Signature of a SOAP Message

Everybody, Hello! This is my request message: I try to validate the <ds:DigestValue>RJhc1ZVjXdUQEIwLTH356p7H0QY=</ds:DigestValue> which is related to the body tag. There are tags like ds:CanonicalizationMethod and ds:Transformswhich are really confusing for me. My question is how to validate the b…

Difference between namespace in C# and package in Java

What is the difference (in terms of use) between namespaces in C# and packages in Java? Answer From: http://www.javacamp.org/javavscsharp/namespace.html Java Packages are used to organize files or public types to avoid type conflicts. Package constructs can be mapped to a file system. may be replaced: There i…

Parsing RTSP stream for live radio

I want to be able to parse the rtsp stream in order to extract data about the radio station, current playing song name, duration etc. I have to do it manually – no libraries. Preferred language is Java but I could work with something else too. Answer Welcome to the world of RFC 2326: Real Time Streaming…

HDF5 in Java: What are the difference between the availabe APIs?

I’ve just discovered the HDF5 format and I’m considering using it to store 3D data spread over a cluster of Java application servers. I have found out that there are several implementations available for Java, and would like to know the differences between them: Java HD5 Interface (JHI5) The Java …