I am having a database in .dbf (FoxPro) format.
How to retrieve data from FoxPro using Java?
If the data can be migrated to MySQL, How to do the conversion?
I need to find the value of ncr- the number of ways of selecting r objects out of n.
if i first find the numerator then the denominator. i get an exception.
i am using java.
how to do it for example for 44 C 42
Hi all! I'm making an android program that retrieves content of a webpage using HttpURLConnection. I'm new to both Java and Android.
Problem is: Reader reads whole page source, but in the last while iteration it doesn't append to stringBuffer that last part.
Using debbuger I have determined that, in the last loop iteration, string buff is created, but stringBuffer just doesnt append it.
I need to parse retrieved content. Is there any better way to handle the content for parsing than using strings. I've read on numerous other sites that string size in Java is limited only by available heap size.
Anyone know what could be the problem. Btw feel free to suggest any improvements to the code.
Thanks!
URL u;
try {
u = new URL("http://feeds.timesonline.co.uk/c/32313/f/440134/index.rss");
HttpURLConnection c = (HttpURLConnection) u.openConnection();
c.setRequestProperty("User-agent","Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; InfoPath.1; .NET CLR 2.0.50727)");
c.setRequestMethod("GET");
c.setDoOutput(true);
c.setReadTimeout(3000);
c.connect();
StringBuffer stringBuffer = new StringBuffer("");
InputStream in = c.getInputStream();
InputStreamReader inp = new InputStreamReader(in);
BufferedReader reader = new BufferedReader(inp);
char[] buffer = new char[3072];
int len1 = 0;
while ( (len1 = reader.read(buffer)) != -1 )
{
String buff = new String(buffer,0,len1);
stringBuffer.append(buff);
}
String stranica = new String(stringBuffer);
c.disconnect();
reader.close();
inp.close();
in.close();
Is it possible to upload single files to the Appengine installation instead of the full project every time. This question is related to the Java version of Appengine.
I'm having trouble finding a regular expression that matches the following String.
Korben;http://feeds.feedburner.com/KorbensBlog-UpgradeYourMind?format=xml;1
One problem is escaping the question mark. Java's pattern matcher doesn't seem to accept \? as a valid escape sequence but it also fails to work with the tester at myregexp.com.
Here's what I have so far:
([a-zA-Z0-9])+;http://([a-zA-Z0-9./-]+);[0-9]+
Any suggestions?
Is it true that the only configuration file I need to bother with is pom.xml ?
It seems to me that Java guys live xml more than any other stuff,is that true?
Could someone provide an example of how to dynamically create an image in Java, draw lines et cetera on it, and then draw the image so that areas not painted will remain transparent in the drawing process?
I need to run some method in Swing application in separate thread. What is the difference between using SwingWorker and SwingUtilities.invokeLater. Which one should I use to run a thread in Swing application? I couldn't find exact info in the tutorial at
http://java.sun.com/docs/books/tutorial/uiswing/concurrency/index.html
I'm learning Java for a course this month, and this question is just one I thought of that I'd like to know.
What are the main differences between these two? I know KVM is targeted for mobile devices, correct?
I know this is probably possible using Streams, but I wasn't sure the correct syntax.
I would like to pass a string to the Save method and have it gzip the string and upload it to Amazon S3 without ever being written to disk. The current method inefficiently reads/writes to disk in between.
The S3 PutObjectRequest has a constructor with InputStream input as an option.
import java.io.*;
import java.util.zip.GZIPOutputStream;
import com.amazonaws.auth.PropertiesCredentials;
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3Client;
import com.amazonaws.services.s3.model.PutObjectRequest;
public class FileStore {
public static void Save(String data) throws IOException
{
File file = File.createTempFile("filemaster-", ".htm");
file.deleteOnExit();
Writer writer = new OutputStreamWriter(new FileOutputStream(file));
writer.write(data);
writer.flush();
writer.close();
String zippedFilename = gzipFile(file.getAbsolutePath());
File zippedFile = new File(zippedFilename);
zippedFile.deleteOnExit();
AmazonS3 s3 = new AmazonS3Client(new PropertiesCredentials(
new FileInputStream("AwsCredentials.properties")));
String bucketName = "mybucket";
String key = "test/" + zippedFile.getName();
s3.putObject(new PutObjectRequest(bucketName, key, zippedFile));
}
public static String gzipFile(String filename) throws IOException
{
try {
// Create the GZIP output stream
String outFilename = filename + ".gz";
GZIPOutputStream out = new GZIPOutputStream(new FileOutputStream(outFilename));
// Open the input file
FileInputStream in = new FileInputStream(filename);
// Transfer bytes from the input file to the GZIP output stream
byte[] buf = new byte[1024];
int len;
while ((len = in.read(buf)) > 0) {
out.write(buf, 0, len);
}
in.close();
// Complete the GZIP file
out.finish();
out.close();
return outFilename;
} catch (IOException e) {
throw e;
}
}
}
Hello,
I'm using the JMS API to send messages to a Websphere MQ server.
The application that pulls the messages i create want's me to set up the ApplicationID field
in the MQMD structure to constant value.
I could not find a way in the JMS API to access the MQMD structure
The question: Is there a way doing this? if yes then how? If no, then is my only option
is to use the MQ java API, instead of JMS API?
Thanks
Can I bind a table name in a Java Prepared Statement?
i.e.
PreparedStatement pstmt = aConn.prepareStatement("SELECT column FROM ? ");
pstmt.setString(1, "MY_TABLE");
Nope, no I can't. New question, anyone know how to delete a question?
I have a small server application I wrote in Java running on my web server. The client application I wrote can connect to the server and it receives data, but the server does not receive any data sent by the client. Any idea what the problem could be? The two communicate fine on my local machine.
A short question: My eclipse project is set to use the "sun-java-6-openjdk"-supplied JDK library, but I cannot Ctrl-click to view source (no source attached), as I can do out-of-the-box on Windows. How do I make this work?
hi.
I'm wondering if any of you have some ideas of a small application i can work on , just to get familiar with any of the Ajax Frameworks specially if it's related to Java like JMaki or ECHO 2
thanks .
Hi,
I have a regex like the following:
.{0,1000}(?!(xa7|para(graf))$)
using Java.
I was expecting that it would cause the following text to fail:
blaparagraf
because paragraf is found at the end
Hi everyone,
I would like to know how can I generate a random pre-master key PMK in java? (related in key exchange and authentication)
Is it similar with other randam key generating? What particularly is a pre master key?
Thanks,
Sebby.
I have an array of strings plus one additional string. I want to use this string and values of array to get a set of string. Then I want to order the set of string alphabetically and extract the string which is the first in the list. What is the easiest way to do it in Java?
Hi everyone, I am trying to run a python script through an application I've written. I found some pages which say that this piece of code is doing it, but I can't figure it out.
http://code.google.com/p/android-scripting/source/browse/android/AndroidScriptingEnvironment/src/com/google/ase/locale/LocaleReceiver.java
Can someone explain what is going on and how I can edit that to run an arbitrary script file in my project directory?
Given a harddrive with 120GB, 100 of which are filled with the strings of length 256 and 2 GB Ram how do I sort those strings in Java most efficiently?
How long will it take?
hi.
I'm wondering if any of you have some ideas of a small application i can work on , just to get familiar with any of the Ajax Frameworks specially if it's related to Java like JMaki or ECHO 2
thanks .
Hi, how do i order a given set of colors from the rainbow in VIBGYOR order. say i input the seven colors in the following order { red, blue, green, yellow, indigo, violet, orange} and i should print the output as {violet, indigo, blue, green, yellow, orange, red}, irrespective of the order i give the output should be as above. Can someone suggest me about implementing this in java program?
Thanks,
-Vijay
Hi Guys
How can I write a java application with Pocket Pc?
could you please suggest me an IDE and JDK for PPC?
Thanks a lot ...
My PPC : Xperia X1
My OS : WindowsMobile 6.1
My Cpu : 528 Mhz