How to display gauge progress refer to HTTP connection time taken
Hi,
I would like to know how can I display the gauge progress depend on the HTTP connection time taken.
I have the source code below but it can't show the gauge progress parallel to the HTTP connection working.
That's kind of those who solve me this problem.
Source code:
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import java.io.*;
import javax.microedition.io.*;
import java.util.*;
public class HttpExample extends MIDlet implements CommandListener
private Gauge gauge;
private Command exit, start;
private Display display;
private Form form;
long AUD, CAN;
public HttpExample()
display = Display.getDisplay(this);
exit = new Command("Exit", Command.EXIT, 1);
start = new Command("Start", Command.EXIT, 1);
form = new Form("");
gauge = new Gauge("Updating Currency Rate", false, 100, 0);
form.append(gauge);
form.addCommand(exit);
form.addCommand(start);
form.setCommandListener(this);
display.setCurrent(form);
public void startApp() throws MIDletStateChangeException
display.setCurrent(form);
public void pauseApp()
public void destroyApp(boolean unconditional)
public void commandAction(Command command, Displayable displayable)
if (command==exit)
destroyApp(false);
notifyDestroyed();
else if(command==start)
Updater updater = new Updater(this);
updater.start();
class Updater implements Runnable
private HttpExample MIDlet;
public Updater(HttpExample MIDlet)
this.MIDlet=MIDlet;
public void run()
try
transmit();
catch (Exception error)
System.err.println(error.toString());
public void start()
Thread thread = new Thread(this);
try
thread.start();
catch (Exception error)
private void transmit() throws IOException
StreamConnection connection=null;
InputStream in= null;
StringBuffer buffer=new StringBuffer();
try
connection=(StreamConnection) Connector.open("http://www.geocities.com/cyfan118/index.html");
in=connection.openInputStream();
int ch;
while ((ch=in.read())!=-1)
gauge.setValue(gauge.getValue() + 1);
buffer.append((char)ch);
String line=new String(buffer.toString());
int p=line.indexOf("AUD");
int p1=line.indexOf("CAN");
String a=line.substring(p+4,p+7);
String b=line.substring(p1+4,p1+7);
AUD=Long.parseLong(a);
CAN=Long.parseLong(b);
buffer=new StringBuffer();
catch (IOException error)
Alert alert=new Alert("Error","Cannot connect",null,null);
alert.setTimeout(Alert.FOREVER);
alert.setType(AlertType.ERROR);
display.setCurrent(alert);
}
This code looks like it should work to update the progress during the connection but it is not going to start updating the guage until it has made the connection and is downloading data. If you want to show something on the screen during the time the program is doing Connector.open() you are going to need to have the update code in yet another thread or timer.
Similar Messages
-
What happend if we keep http connection time out as 0
what happend if we define http connection time out as 0 or less than 1 ..pls give reply.
i am seriously struck up with some problem
depending on this our enhancement is dependedAre you still facing the same issue ? This majorly relates to network problem or probably some issue on server end , have you tried to contact your host ?
Thanks,
Sanjit -
How do i use an alredy open HTTP connection belong to aother class
When my apps logs in the User by checking that the username and password are correct against the server then there has been a connection opened to perform this task.
Then the user is returned to the Main Menu.
After that they can send some data to the server.
Class 1 handles the sending of Username and Password.
And has already opened a HTTP connection.
Class 2 that will send more data to the server will need to open a connection if there is not one already open.
How do i check if there is an open connection?
Do i need to check?
Can both classes use the same connection? As its to the same server and same php script.
Thanks for you help on this (once again :-/ )
BrianendPointURL = "http://www.druidev.com/php/verification_script.php";
try
c = (HttpConnection)Connector.open(endPointURL);
c.setRequestMethod(HttpConnection.POST);
c.setRequestProperty("IF-Modified-Since", "20 Jan 2001 16:19:14 GMT");
c.setRequestProperty("User-Agent","Profile/MIDP-1.0 Configuration/CLDC-1.0");
c.setRequestProperty("Content-Language", "en-CA");
c.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
os = c.openOutputStream();
String name = "string=name=";
String password_tmp = "#password=";
String end ="#";
String num_origin ="#num_origin=";
String num_destination= "#num_destination=";
String t1 = name.concat(Start.current_Username); String t2 = password_tmp.concat(Start.current_Password);
String t3 = t1.concat(t2);
String t4 = t3.concat(num_origin);
String t5 = t4.concat(phoneNum1);
String t6 = t5.concat(num_destination);
String t7 = t6.concat(phoneNum2);
String Final_str = t7.concat(end);
byte postmsg[] = Final_str.getBytes();
for(int i=0;i<postmsg.length;i++)
os.write(postmsg);
is = c.openDataInputStream();
int ch;
while ((ch = is.read()) != -1)
b.append((char) ch);
I am not using flush etc.
I need to update a phone book that is downloaded to the phone(MIDlet) once the User is verified.
The user can edit the phonebook on the phone then each change needs to be sent back to the php script on the server.
Can i have a loop for the number of updates i need to do then just loop through the code?
Or will i need to repeat the whole above operation for every update i need to make.
E.g. 5 edits? -
For the last few days HTTP and HTTPS connections on one computer on my LAN usually time out or fail to load completely. This also affects Internet Explorer on the same machine, but email, FTP, etc. seem to be working normally. The URLs that do not load in the browsers ping normally, and load normally on another machine on the same LAN. Running Firefox in Safe Mode does not help.
A possible cause is security software (firewall) that blocks or restricts Firefox without informing you about that, possibly after detecting changes (update) to the Firefox program.
Remove all rules for Firefox from the permissions list in the firewall and let your firewall ask again for permission to get full unrestricted access to internet for Firefox.
See [[Server not found]] and [[Firewalls]] and http://kb.mozillazine.org/Firewalls -
How to display test progress in customized OI progress bar??
Hi all
From the deaf silence of group for my previous question should i assume it is not possible to store/process the user configuration deatails in database instead of .ini file??
also please clarify me the following questions.
1. Is it possible to display the test progress in customized OI (like shown in the figure)
i used the method to get the number of steps.
axExecutionViewMgr.GetCaptionText(CaptionSources.CaptionSource_NumberOfSteps,true,""); ( but it returns null i used it in precommand event of appln. mgr.)
but the teststand should provide a event so that i can update the progressbar value according to number of steps/ steps completed in UI right??
2. The functionality of ABORT will abort the current execution. but when i say restart it should restart from step that is being aborted. but the current restart functonality provided in test stand restart from very first step of sequence. is there any way to achieve this?.
3. I try to run sequence file programmatically using the following code
NationalInstruments.TestStand.Interop.API.Engine eg= axApplicationMgr.GetEngine ();
NationalInstruments.TestStand.Interop.API.SequenceFile s =eg.NewSequenceFile ();
s.Path ="D:\\Program Files\\National Instruments\\TestStand 3.1\\Examples\\Demo\\CreateDeleteUsers\\CreateDeleteUsers.seq";
eg.NewExecution (s,"CreateDeleteUsers.seq",null,true,0,null,null,null);
but it show the following error
An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in TestExec.exe
Additional information: Unknown function or sequence name 'CreateDeleteUsers.seq'.
have i anything missed in the code??
Thanks in Advance
Srini
Attachments:
exec.jpg 43 KBRe 2. Restarting from the middle is not a feature that currently exists. To implement it yourself, you would have to create a step or callback that reads a persisted version of the results, variables, current step group/index, and anything else you need to restore and applies it to newly started execution. You would have to arrange to persist all these items when you terminate, either with a special step/callback or with special code in a OI application that you write.
This is probably not a feature that can be implemented in just a few of lines of code. It could be a simple or difficult project, depending on how much state you need to restore, whether you support restarting from within subsequence, whether you try to restore the system state by rerunning setup and cleanup groups, etc.
Re 3. Your code does not work because although you change the path of the new empty file, it is still a new empty file. To load a file, call ApplicationMgr.OpenSequenceFile. You can then execute it with a command object. Example:
this.axApplicationMgr.OpenSequenceFile(fileName);
// run the current sequence
this.axSequenceFileViewMgr.GetCommand(CommandKinds.CommandKind_RunCurrentSequence).Execute(true);
// run an execution entry point (Test UUTs is typically at index 0 and Single Pass is typically at index 1)
this.axSequenceFileViewMgr.GetCommand(CommandKinds.CommandKind_ExecutionEntryPoints_Set, 1).Execute(true);
Alternatively, you could create an execution with ApplicationMgr.GetEngine().NewExecution, passing in the SequenceFile that the OpenSequenceFile method returns. If you are modifying/creating an OI application, I recommend reading Chapter 9 of the TestStand Reference manual if you haven't already. -
How to display all validator messages at the same time?
Hi Guys,
I have a form with validators attached to a couple of my input boxes. I tried to write validators which are reusable in other parts of my app ie. social security number check etc. I also then customized the messages and it all works fine.
But when I submit the form it displays the messages one at a time, in other words every validator is performed and if there was an error the form is rendered. I believe this is how it should behave and that's fine.
But what if I want all validators to be performed when I submit the form?Then all messages are displayed at the top of the page and the user can make all his changes and try again. This makes more sense to me.
So my question is whether there is a way to force the page to perform all validators when the page is submitted and then display all error messages in a h:messages tag?
Cheers and thanks alot
p.s. i know about and use the hidden input field validator hack which does all validations, but if I do it that way I duplicate the code which does the social security check for all applicable forms.Strange, I was under the impression that all validators were run by default. In my JSF apps, all the validators run and output their errors without any special confguration to make this happen.
I wonder why yours are just running one at a time? Could you show some of your JSP code, and the hidden field validator code?
CowKing -
I have a 5th gen nano, and I play it often on a aux. speaker. I would like the album artwork to display at all times while playing it here. Right now it plays for a few seconds on each song, and then goes blank. Can this be changed?
The artwork turns black or the screen's backlight turns off? If the backlight turns off, simply disable the backlight timer, but keep in mind this will significantly reduce your iPod's playback time and battery life.
B-rock -
Hi all,
in my application i send a request to a server and then wait for the response and once i get the response i process it. in a case where any exception occurs at the server side and i don't receive a response back, my application hangs at the
httpConnection.openInputStream();
i want to give a time out for the connection ie, if the application does not recieve any response within the specified time i want to close the connection. What can i do for that?
please help.In the Connector's construction method there's a boolean value you can specify that you want the connection to have a timeout value for that connection. As far as I know, the actual timeout value is device dependent.
-
PPR Report ,How to display Label with TOTAl
Hi,
How Can i display PPR Report ,How to display Label with TOTAl like
[http://apex.oracle.com/pls/apex/f?p=267:30:]
Thanks
Edited by: 805629 on Jan 6, 2011 3:34 AMHi,
For PPR Report:
Select "Yes" in "Enable Partial Page Refresh" item of "Layout and Pagination" region in Report Attributes of that report.
For display Label with TOTAL:
Use "Break Formatting" region in Report Attributes of that report.
Regards,
Kartik Patel
http://patelkartik.blogspot.com/
http://apex.oracle.com/pls/apex/f?p=9904351712:1 -
CProjects Roles, HTTP Connection, RABAX_STATE error
Hi All,
1. Which are the standard cProjects Roles to be maintained ? Where we can have that list ?
2. How to maintain or say configure the HTTP connection for cProjects (steps for doing it)?
3. Getting the termination type error : RABAX_STATE, how to resolve it ?
Points for userful information.
Thanks and regards,
NishitHi
Answer to your 1 question is given below
The following single roles are delivered with cProjects:
SAP_CPR_PROJECT_ADMINISTRATOR :Create projects (project definitions).
SAP_CPR_TEMPLATE_ADMINISTRATOR :Create, change, read, and delete all templates in cProjects.
SAP_CPR_USER :Use cProjects, but no authorization to perform any activities in a particular project. To do this users need project-specific authorizations, which can be distributed either directly or through their assignment to a role.
The following composite roles are delivered with cProjects:
SAP_CPR_DECISON_MAKER :cProjects decision maker. Contains the role SAP_CPR_USER.
SAP_CPR_INTERESTED :cProjects interested party. Contains the role SAP_CPR_USER.
SAP_CPR_MEMBER :cProjects team member. Contains the role SAP_CPR_USER.
SAP_CPR_PROJECT_LEAD :cProjects project manager. Contains the role SAP_CPR_PROJECT_ADMINISTRATOR and SAP_CPR_USER
SAP_CPR_TEMPLATE_RESPONSIBLE :cProjects template responsible. Contains the roles SAP_CPR_TEMPLATE_ADMINISTRATOR and SAP_CPR_USER
Edited by: Yogesh Pande on Dec 18, 2008 5:38 AM
Edited by: Yogesh Pande on Dec 18, 2008 5:41 AM
Edited by: Yogesh Pande on Dec 18, 2008 5:43 AM -
TMG Proxy not connecting internal HTTPS connection
Dear All,
I am working government org, and there are many internal HTTP and HTTPS sites which is going/thought to proxy tmg(2010) server.internal clients are able to connect to http sites but they are not connect to https sites and all server application are come
to internal intranet network
i am trying to add https access rule and some basic troubleshooting but governmant clients not able to open internal application https sites.
my question is that is that possible?
if possible how to make a rule or redirect https connection?
Thanks for advancedHi,
Pelase check the article below.
In some business scenarios, internal clients protected by Microsoft Internet Security and Acceleration (ISA) Server 2004 may require access to secure Internet Web sites. This scenario can be configured as follows:
Configure a tunneled Secure Sockets Layer (SSL) end-to-end secure HTTP (HTTPS) connection between the internal client and the external Web site.
Configure clients to request the external Web site using Hypertext Transfer Protocol (HTTP), and then redirect the request from the ISA Server computer to the site using HTTPS.
Configuring Internal Client Acess to Web Sites over SSL
https://technet.microsoft.com/en-us/library/cc302568.aspx
Best Regards,
Joyce
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected] -
How to display response of http request as a web page in ABAP?
Hi all,
In ABAP, we can use class <b>cl_http_client</b> to send a http requst and then got the response data as a XSTRING variable. Usually, the response data is the html source of a web page. How to display this web page within dynpro?
I found we can use class <b>cl_gui_html_viewer</b> to display the web page of a URL or data in SAP web respository. Is there any way of using it to load response data in cl_http_client and display that web page?
Thanks a lot.Welcome to SDN.
1. use http_client->response->get_cdata( ).
to get the response data in string format instead of xstring format.
2. use FM CONVERT_STRING_TO_TABLE to covert the string to table of type W3HTML
3. use method
data: l_doc_url(255) type c.
call method html_control->load_data
exporting
type = 'text'
subtype = 'html'
importing
assigned_url = l_doc_url
changing
data_table = html_table.
call method html_control->show_data
exporting
url = l_doc_url.
to load the html content and show it in cl_gui_html_viewer
Regards
Raja -
how i display mac app store downloading progress bar ? please help ?
it does not respond every time i hit download button,nothing appers
-
How to display progress while CF is busy
Dear all:
My site has to perform some 30 CFIF logics on an estimated
average of 30,000 entries, subsequent to a form submission. That's
600,000 subsequent processes.
To avoid Request TimeOut, I staggered the process. The form
submits to Page1, which runs only 10 of the 30 CFIF, and does so in
CFLOOP batches of 100. Upon completion of the first 100, a
CFLOCATION reloads Page1 for the next 100 entries. When it has
completed all 30,000 entries ( = 300 times a CFLOCATION, followed
by a CFLOOP with a loop count of 100x), it CFLOCATION to Page2,
where it follows the same procedure, but this time on CFIF routines
11 to 20. And after that to Page3, where CFIF routines 21-30 are
completed and a CFLOCATION generates the results page.
ALL OF THIS WORKS BEAUTIFUL AND PRETTY FAST TOO. Done under
60 seconds or so. BUT.... 60 seconds to a PC user, online, is a
long time.
All this time, the form submit page is visible. Any dynamic
gif or flash freezes and the progress bar in the bottom of the
browser is showing that it is eager to display the next page. Then,
after 60 seconds the results page sohws up.
QUESTION: Is there a way to display a progress bar or
something like that? I tried IFRAME, but that doesn't work. I
syspect a FRAMESET probably will but I do not want a frameset. And
a popup would work too but I do not want a popup either ;-)
Don't spend hours on it, just let me know if you know a
trick.
Thanks so much!
HansHave you played with <cfflush...>
It allows incremental delivery of content to the client. You
could
theoretically output something in each loop and|or
cflocation. Using
<cfflush..> this output will be delivered to the
browser while the
processing continues.
P.S. Are you aware of the <cfsetting
requesttimeout="seconds"> property
that would allow you to eliminate the <cflocations...>
you used to avoid
the timeout. Just set it to 60 seconds or whatever you need
to run the
request.
Also if you have access to the enterprise CF server there are
async
gateways that could off load the processing to separate
requests not
tying up the one the user is using at all. This can also be
done with a
<cfhttp...> with a timeout="0" parameter. But more
sophisticated
methods to deliver the final product would need be be
developed with
these solutions. -
In the AIUserSuite there is not a way to display the progress bar, seached everywhere and found nothing.
Please help!minimum99 wrote:
Is that something you can share?
I'm afraid not. Even if I were allowed to, it wouldn't be much use -- it's built on a ton of internal stuff
I think you're on the right track with just doing it manually. Throwing up a simple progress window isn't too bad; the only pain is in the flags, to make it semi-modal. The rest is very straight forward.
Maybe you are looking for
-
To Do items showing 'On My Mac' -- how do I get rid of it?
For some reason my To Do list shows two sublists, On My Mac and my email account name. I have set all To Dos to show up in my email account by default (in Preferences > Composing > Create Notes and To Dos) but 'On My Mac' won't go away. Any ideas?
-
Hi Group We have BW 2.1 installed at the moment just for reporting purposes. We are in the process of migrating the reporting to another software. In 3 months we will fully complete the migration to the new reporting software. Thus we will not be usi
-
How are VIs stored in 2010 .exe files?
Using the 8.x file structure, the VI's were all packaged such that you could access them with <Path>\<Application.exe>\<VIName.vi>. I just converted a project using 2010 and am trying to use the new file layout. However, it seems that the VIs are in
-
Novell Client for Linux causes Excel/Crossover to lock on file open
When using Microsoft Office with Crossover, if I access a mounted NetWare drive using Novell Client for Linux it causes the office Open dialog to lock. The same action with an NCPFS mount works ok. Of course I understand if having Office/Crossover wo
-
I found out by removing the ThinkPad manager driver (not the ThinkPad power manager), this solves the problem when the T400 goes into Hibernation or standby/sleep mode, but does not completely shut down afterwards. Apparently there's some kind of con