This week's book giveaway is in the Spring forum.
We're giving away four copies of Pro Spring MVC with WebFlux: Web Development in Spring Framework 5 and Spring Boot 2 and have Marten Deinum & Iuliana Cosmina on-line!
See this thread for details.
Win a copy of Pro Spring MVC with WebFlux: Web Development in Spring Framework 5 and Spring Boot 2 this week in the Spring forum!

Bill Ceglia

Ranch Hand
+ Follow
since Dec 13, 2001
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Bill Ceglia

I am having a difficult time getting one or more timers to use one or more timertasks. I need to start multiple tasks and depending on the situtation restart one or more of the tasks. However, when I attempt to do this it seems as though the task never restarts or has been killed for some reason? I use the cancel() method to stop the task and then create a new task and schedule it on a existing timer, is this correct? Does anyone have an example of multiple timers and multiple timertasks being used where they are started, stopped, and restarted? If not what is a alternative beside managing time myself? Any help would greatly be appreciated!
Thank You,
Bill
18 years ago
Don't bother, I figured it out.
18 years ago
I am opening a StreamConnection using the Connector.open() method. I saw were you can set a timeout boolean value for the connection to close after a certain amount of time? How does this work?
18 years ago
The following code opens a connetion to the serial port on an i85s phone, reads from it, and then closes the connection.
sc = (StreamConnection)Connector.open(ConnectParams, Connector.READ);
if(sc != null)
{
is = sc.openInputStream();
is.read(bytearrayin);
is.close();
sc.close();
}
This routine is called every so often in a timer, the problem I am having is the first time through everything works fine but when the routine executes the second time or more it gets an error "Close Indication on open()". This says to me that the close is not working correctly or there is some other error happening???
19 years ago
Is it possible to start a MIDlet, which spawns a thread, then return control to the phone so the user can operate the phone normally, but still have the thread running in the background? If so can you provide reference material or examples?
I am using CodeWarrior and JDK1.2.2 to develop my MIDlet but when I try and access certain classes errors come back stating the class was not found?
Code example below:
import java.io.*;
import java.util.*;
FileReader fis = new FileReader(filename);
When I compile the program it says Class FileReader not found, do I have to specify a path other than the import or do I need to do something else???
19 years ago
Is it possible to retrieve the phone number, of the phone a MIDlet is running on? If so what would be a way to do that?
19 years ago
Is there a String to Long function in the J2ME API, I have not seen one and was curious if one existed? If not, what is the best procedure to perform this?
19 years ago
I thought I had made it clear by stating it was an array of bytes and that would mean one byte after another. There are no delimiters or I would have tried to use those. So, I guess the question remains how to take an array of bytes and place it into a class, similar to taking an array of bytes and doing a memcpy into a structure in C?!
19 years ago
Below is the class and the code to perform the recv of the data. The data coming in is a array of bytes which are all int values to be placed in the class. If I can copy them directly into the class elements that would be fine, how do you do that? The data coming in is being recvd byte by byte so I need to store it somewhere and then convert it into a int, I think?!
public class ConfigurationInformation
{
int nPingRate = 660;
int nReportInterval = 10;
int nVelocity = 70;
int nDwellTime = 30;
};
StringBuffer recvcfg = new StringBuffer();
int ch;
// Open the input stream and read.
is = sc.openInputStream();
while((ch = is.read()) != '\0') {
recvcfg.append((char) ch);
}
19 years ago
I have a class with elements in it that are all int's. I have recvd bytes into a StringBuffer from a InputStream and now want to get that StringBuffer copied into the class? The problem is I don't see anyway to convert or copy a StringBuffer into the class? In C you could use a memcpy to copy an array of bytes into a structure, is there some way of doing that in Java? Should I recv the bytes and store them in a ByteArray and then convert those some how? What do you recommend is the best way to recv the data in order to get it into the individual int elements of the class?
19 years ago
Ok, that worked perfect! Thank You Rob and Rikard, I greatly appreciate the help and your efforts!
19 years ago
I am using JDK1.2.2, the CodeWarrior debugger only works with this version and nothing newer, so that's why I'm not using JDK1.3.1.
19 years ago
I have tried, by cut and paste method, and I still receive the same results?! The System.out.println statement prints exactly what I stated previously, I never see the bytes converted from their decimal value to an ASCII character??? When the System.out.println prints it displays in a dos window, used in the CodeWarrior debugger, and shows "java.io.ByteArrayOutputStream@8810684" for both print statements. I don't know what else to tell you except what I see.
19 years ago