Skip to content

Tag: java

ODBC connection to Access database in 64-bit Windows

I am using this tutorial to create a database connection from a java application to a Microsoft Access 2010 database. The tutorial creates a system dsn in windows, and then connects to that system dsn using the following line of java code: The problem is that, when I click the link to add a new system dsn at:…

When to use ** (double star) in glob syntax within JAVA

Directly from this Java Oracle tutorial: Two asterisks, **, works like * but crosses directory boundaries. This syntax is generally used for matching complete paths. Could anybody do a real example out of it? What do they mean with “crosses directory boundary”? Crossing the directory boundary, I i…

Run Handler messages in a background thread

I want to run some Runnable in a background thread. I want to use Handler because it’s convenient for delays. What I mean is Where runnable should be run in background Thread. Is it possible to create such Handler? Is there a “background” Looper somewhere or how can I create it? P.S. I know …

Calculation of Diffie–Hellman public key slow

hi i’m trying to implement a Diffie–Hellman key exchange but the calculation for 100000 already takes several seconds. I won’t know hoch much time it would take for a 256bit number. Is it so slow because of the implementation of BigInteger or am i off the track? Answer the problem is that g.pow(se…

Connection refused on remote IP, but accepted on local IP

As the title says, I have my server running on a local machine, I tested and debugged it and it worked perfectly (server is written in java as well). But when I tried to test it with my remote IP (instead of 192.168.0.113 I used 146.255.x.x), and the server didn’t receive anything, while the client has …

How to get the weekday of a Date?

I want to get the day of week from the Java Date object when I have an array of Date in String with me. Does anyone know the answer to this? Answer You can get the day-integer like that: If you need the output to be “Tue” rather than 3, instead of going through a calendar, just reformat the string…

Check and extract a number from a String in Java

I’m writing a program where the user enters a String in the following format: I need to check that there is a number in the String and then extract just the number. If i use .contains(“\d+”) or .contains(“[0-9]+”), the program can’t find a number in the String, no matter wh…