Infinite for loop to load images
I hope to load repeat images until user close the browser.
But I find it is hard to use infinite loop to make it.
Is there any other way to do it ??
Thanks a lot
for (;;){ <=================================== ???
//jpeg = (String) session.getValue("JPEG");
//int jpeg_ch = Integer.parseInt(jpeg,10);
session.putValue("JPEG_NO",String.valueOf(jpeg_no));
//int jpeg = (int)((Math.random()*123456789)%16);
%>
<img style="position: absolute; left:<%= x[jpeg_no] %>; top:<%= y[jpeg_no] %>; width: 160; height:120;" Src="http://192.168.10.110:8080/servlet/Servlet?jpeg=<%= jpeg_no %>">
for(;;) is an infinite for loop
while(true) is an infinite while loop
please post your URL so that I can make sure to avoid going to this page. I certainly don't want the page to constantly be loading images forever.
Similar Messages
-
hello there
i'm trying to make a ping program that if the user presses a button
the program pings on a server continusely and print the response
so i used the infinite for loop but when i'm trying to exit the program
it doesn,t exit?how to fix that? here is my code
import java.io.*;
import java.net.*;
import javax.swing.*;
import java.awt.Container;
import java.awt.*;
import java.awt.event.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class ReachableTest2 extends JFrame {
public static void main(String args[]) {
JButton btn=new JButton("Check The Ping");
JFrame frame = new JFrame("Ping Check");
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent ev) {
System.exit(0);
ActionListener actionlistener=new ActionListener() {
public void actionPerformed(ActionEvent evnt) {
if(evnt.getActionCommand().equals("Check The Ping"))
try {
InetAddress address = InetAddress.getByName("212.122.224.10");
System.out.println("Name: " + address.getHostName());
System.out.println("Addr: " + address.getHostAddress());
for( ; ; )
System.out.println("Reach: " + address.isReachable(3000));
catch (UnknownHostException e) {
System.err.println("Unable to lookup ");
catch (IOException e) {
System.err.println("Unable to reach ");
frame.add(btn);
btn.addActionListener(actionlistener);
frame.setSize(250,150);
frame.setVisible(true);
frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
}hi friend ,
i have made some changes to your code ,i hope this might help let me know if it works for you
import java.io.*;
import java.net.*;
import javax.swing.*;
import java.awt.Container;
import java.awt.*;
import java.awt.event.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class test extends JFrame {
public static void main(String args[]) {
JButton btn=new JButton("Check The Ping");
JFrame frame = new JFrame("Ping Check");
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent ev) {
System.exit(0);
ActionListener actionlistener=new ActionListener() {
public void actionPerformed(ActionEvent evnt) {
if(evnt.getActionCommand().equals("Check The Ping"))
ping();
frame.add(btn);
btn.addActionListener(actionlistener);
frame.setSize(250,150);
frame.setVisible(true);
frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
public static void ping()
Runnable r = new pinging();
Thread t = new Thread(r);
t.start();
class pinging implements Runnable {
public pinging()
public void run()
try {
InetAddress address = InetAddress.getByName("212.122.224.10");
System.out.println("Name: " + address.getHostName());
System.out.println("Addr: " + address.getHostAddress());
for( ; ; )
System.out.println("Reach: " + address.isReachable(3000));
catch (UnknownHostException e) {
System.err.println("Unable to lookup ");
catch (IOException e) {
System.err.println("Unable to reach ");
Regards -
How do i use Arrays and For Loops in Loading Multiple Images?
I am struggling to load a sequential array of images to appear like a moving image. So when u click the button the images load one after the other.
The code below is what i have so far, but it fails to do what i seek in that there's only one image loading which is the last image in the array, so either because the images are stacking up atop each other, or because i simply dont understand the basics...
And, i am unclear about what you said kglad, that my solution will be more complicated because i need to preload my image sequence and then use a loop to load it?
import flash.net.URLRequest;
import flash.display.Loader;
var count:int = 0;
var imageArray:Array=["1.jpg","2.jpg","3.jpg","4.jpg","5.jpg","6.jpg","7.jpg",
"8.jpg","9.jpg","10.jpg","11.jpg","12.jpg","13.jpg"];
for(var i:uint=0;i<imageArray.length;i++){
var btn:YourButton=new YourButton();
btn.ivar=i;
addChild(btn);
btn.x=0;
btn.y=0;
btn.addEventListener(MouseEvent.CLICK,clickF);
var ldr:Loader=new Loader();
addChild(ldr);
ldr.x=20;
ldr.y=20;
function clickF(e:MouseEvent){
ldr.load(new URLRequest("D:/flash cs5.5/image_sequence/twirlSeq/"+imageArray[e.currentTarget.ivar]));
function loadComplete(e:Event){
// first process loaded image, then...
count++;
if(count < imageArray.length){
loadCurrentImage(); // load the next image
} else {
// sequencial loading complete, carry on to next activity
function loadCurrentImage(){
ldr.load(imageArray[count]);
ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);create a new fla, add btn and add the code i suggested. test.
var count:int;
var imageArray:Array=["1.jpg","2.jpg","3.jpg","4.jpg","5.jpg","6.jpg","7. jpg",
"8.jpg","9.jpg","10.jpg","11.jpg","12.jpg","13.jpg"];
var ldr0:Loader=new Loader();
ldr0.contentLoaderInfo.addEventListener(Event.COMPLETE,loadCompleteF);
var ldr1:Loader=new Loader();
ldr1.contentLoaderInfo.addEventListener(Event.COMPLETE,loadCompleteF);
btn.addEventListener(MouseEvent.CLICK,clickF);
function clickF(e:MouseEvent):void{
// initialize count
count=0;
// call loadF
loadF();
function loadF():void{
// add one of the loaders to the top of the displaylist and load the next image
addChild(this["ldr"+count%2])
this["ldr"+count%2].load(new URLRequest(imageArray[count]));
function loadCompleteF(e:Event):void{
// increment count
count++;
// check if the last has loaded
if(count<imageArray.length){
// if not clear the content out of the next loader.
if(this["ldr"+count%2].content){
this["ldr"+count%2].unloadAndStop();
// and call loadF so the next loader can load the next image in the array
loadF();
} else {
// if the last has loaded.
// last load completed -
hi
I have the following for loop:
for (TreeMap <String, Integer> i = result; i.size()!=0; i.headMap (i.lastKey()))
{out.println("keyword = " + i.lastKey() + " ; page no. = " + i.get(i.lastKey()));
result is a tree map that contains several strings (the keys) and integers (values).
I need to note that in the process of creating result some values (i.e. strings) were repeated and therefore their values were replaced (run over).
When I run the program it just perform the loop again and again without getting rid of the last value / key pair in i in every iteration.
Can anyone explain why this is?
thanks in advance.hi
I have the following for loop:
for (TreeMap <String, Integer> i = result; i.size()!=0; i.headMap (i.lastKey()))
{out.println("keyword = " + i.lastKey() + " ; page no. = " + i.get(i.lastKey()));
result is a tree map that contains several strings (the keys) and integers (values).I need to note that in the process of creating result some values (i.e. strings) were repeated and therefore their values were replaced (run over).
When I run the program it just perform the loop again and again without getting rid of the last value / key pair in i in every iteration.
Can anyone explain why this is?
thanks in advance. -
Weird problem with loading data from an XML using a for loop
Hi,
I have a strange problem. I have encountered this thing many a times but still don't know the proper workaround for it.
I am trying to load swf file, a video file or an image. They can be present on a local system or on a remote server also. All the entries corresponding to the files to be loaded is made in an XML file. I traverse through the nodes of the XML using a for loop. On the complete event of loader info, example:.
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);
I fill a container with the loaded data.
My problem is when I am using for loop it doesn't works properly but if i use a statement like this:
someFunc()
if(i<arr.length())
... do something...
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);
private function onComplete(e:Event):void
... do something...
i++;
All files are loaded properly.
I think this can be because the for loop processes pretty fast but the content takes time to load, which ultimately leads to some wierd results.
Please let me know how can this thing be done correctly by using a for loop also.You don't want to use a for loop to load several items. The way you almost appear to have it is the proper approach... load a file and use the completion of its loading to trigger loading the next file.
-
Read data from text file one by one using for loop
Dear Forum
I want to read data of single colum of text file inside the for loop one by one(for each iteration value must be replaced by another value of text file).This value is used by a formula inside for loop. also after completion of iterations the values must be plotted on xy graph. How to do it.? please help me.
profraviIt's not very efficient to read a file line by line. Much simpler to read it all at once and then auto-index the results inside a for loop. The image below shows a generic solution to your problem. This assumes that the data in the file is in a single column.
I would also recomend checking ou the learning LabVIEW resources here.
I would aslos suggest that since this type of question is not specific to either NI-Elvis or the LabVIEW SE, you should post similar questions to the LabVIEW board. If you have problems, attaching a sample of the text file would help.
Message Edited by Dennis Knutson on 10-18-2007 09:11 AM
Attachments:
XY Graph From File.PNG 4 KB -
I am loading an image to a movie clip (name container) using
loadMovie but when the image loads the movie clip is resized to the
size of the loaded image, is there a way to prevent that from
happening? I want the movie clip to retain its original size.
Thank you for your help,Loaded images or swf's only inherit position, rotation and
scale. They load
at their original size though. If you want to resize them to
fit a
particular area, you'll need to do that with AS. First you
will need to stop
using loadMovie and use the MovieClipLoader class instead.
You should be
using it anyway, it's better.
Simple example that loads an image from my C: drive into a
clip named 'hold'
var myLoader = new MovieClipLoader();
var lis = new Object();
lis.onLoadInit = function(targ:MovieClip){
targ._width = 83;
targ._height = 119;
myLoader.addListener(lis);
myLoader.loadClip("c:/dm_phillips_2005.jpg", hold);
Dave -
Head Developer
http://www.blurredistinction.com
Adobe Community Expert
http://www.adobe.com/communities/experts/ -
A few selection of websites after fully loading become blank and start an infinite loop of loading. I reinstalled firefox once already and the problem persists. What can I do?
Sorry I do not know what the problem may be. <br />
If no-one comes up with better ideas of what causes this then my questions and suggestions:
What do you mean by an infinite loop ? <br />
The page loads and then goes blank. What exactly happens next, does the page fully load and fully display again before going blank, and repeat this cycle endlessly in the same tab.
You do say the problem persisted in safe-mode and you had looked at the basic troubleshooting article. Buy that you can stop the problem by disabling javascript.
* did you disable all plugins - and did you still get the problem then ?
As you mention disabling javascript stops the problem, have you tried with<br /> Java script enabled but
* block popups ON
* load images automatically OFF
* advanced options - ALL OFF<br /> What happens do you get the problem then or not.
While on this firefox site if I look at the error console Ctrl+Sift+J or Tools -> Error console If I clear the console content and reload the webpage the error console shows only a couple of messages. YouTube home page give a lot of yellow triangle warnings about 200, but no red warnings, do you get red warnings.
You could also try on the problem sites eg YouTube changing the permissions with tools -> Page Info | Permissions
Did you try the Basic Troubeshooting suggestion of making a new profile. (Heeding the warning not to delete settings, otherwise you loose all bookmarks etc) did that help ? -
Spinning/loading image for ajax call
Hi,
Is there any way to display a spinning/loading image (the usual one that you see on many Ajax Websites) before getting the result in the following ajax call?
Thanks.
Andy
<script type="text/javascript">
function getUserList() {
var ajaxRequest = new htmldb_Get(null,&APP_ID.,'APPLICATION_PROCESS=getUsers',0);
ajaxRequest.add('P2_LAST_NAME',html_GetElement('P2_LAST_NAME').value);
ajaxRequest.add('P2_FIRST_NAME',html_GetElement('P2_FIRST_NAME').value);
ajaxResult = ajaxRequest.get();
if (ajaxResult)
{html_GetElement('UserListDiv').innerHTML = ajaxResult}
else
{html_GetElement('UserListDiv').innerHTML = 'null'}
ajaxRequest = null;
</script>the CPU time is on the DB/application server site.
here are the codes (on page 40):
1.) page HTML header:
<script language="JavaScript" type="text/javascript">
<!--
function f_TestOnDemand(){
var get = new htmldb_Get(null,html_GetElement('pFlowId').value,'APPLICATION_PROCESS=40processlong',0);
get.add('P40_TEMP_ITEM',html_GetElement('P40_TEST').value)
get.GetAsync(f_AsyncReturn);
get = null;
function f_AsyncReturn(){
if(p.readyState == 1){
html_GetElement('P40_TEXT_DROP').value = '';
html_ShowElement('AjaxLoading');
}else if(p.readyState == 2){
}else if(p.readyState == 3){
}else if(p.readyState == 4){
html_GetElement('P40_TEXT_DROP').value = p.responseText;
html_HideElement('AjaxLoading');
}else{return false;}
//-->
</script>
2.) on apge footer text:
<div id="AjaxLoading" style="display:none;">..Loading..
<img src="#IMAGE_PREFIX#/processing3.gif" /></div>
3.) onDemand process:
declare
l_counter number;
l_o_name varchar2(2000);
begin
htp.prn('<body>'||chr(10));
for i in 1..5000 loop
htp.prn('<payload id="test'||i||'">'||i||':'||v('P40_TEMP_ITEM')||'</payload>'||chr(10));
end loop;
htp.prn('</body>');
end;
4.) a html region is created with three items : p40_temp_item, p40_test, and p40_text_drop. a SEND button created in the region with URL target "javascript:f_TestOnDemand();"
so the content from P40_TEST does go to P40_TEXT_DROP (with process wrapped info) and the "loading..." is gone also, if I input the text in the P40_TEST field and click "Send" again, it still works, but I can not move to other pages under the same tab set, and at this moment, the CPU is go very higher by the process.
I can not see any leak around these code. it should go back to normal after "Send".
Thank you.
Jim -
PL/SQL block to create temporary table + load via cursor for loop
Assume I have a table that contains a subset of data that I want to load into a temporary table within a cursor for-loop. Is it possible to have a single statement to create the table and load based on the results of the fetch?
I was thinking something like:
Declare CURSOR xyz is
CREATE TABLE temp_table as
select name, rank, serial number from
HR table where rank = 'CAPTAIN'
BEGIN
OPEN xyz
for name in xyz
LOOP
END LOOP
What I see wrong with this is that the table would be created multiple times which is why this syntax is not acceptable. I'd prefer not to have to define the temporary table then load in two sepearte SQL statements and am hoping a single statement can be used.
Thanks!What is the goal here?
If you're just going to iterate over the rows that are returned in a cursor, a temporary table is unnecessary and only adds complexity. If you truly need a temporary table, you would declare it exactly once, at install time when you create all your other tables. You'd INSERT data into the temp table and the data would only be visible to the session that inserted it.
Justin -
Issues with nested for loops - saving images from a camera
Hi all,
I've written a vi. to capture a specific number of images ('Image No') and save these images, outputted to a folder of my choice. Each image is identified sequentially. However, I wish to do a number of iterations ('Run') of this capture sequence, such that the filename of each image would be 'Filename (Run)_(Image No).png', e.g. run 5, image 10 would be 'Filename 5_10.png'. I have tried a nested for loop for this but I receive an error 'Asynchronous I/O operation in progress' (I've attached a printscreen).
Can anyone assist me in solving this problem? I preiously posted this in machine Vision but got no response (http://forums.ni.com/t5/Machine-Vision/Capturing-image-sequences-issues-with-nested-for-loops/m-p/19...). Please find attached my vi.
Kindest regards and thanks,
Miika
Solved!
Go to Solution.
Attachments:
Labview problem.jpg 3841 KB
Image sequence save to file.vi 48 KBMiika,
the problem is not the filenam, but the name of the folder (AHHHHH!). You try to create the same folder in the outer for loop over and over again.... (it is the error message above the '======', not below )
Norbert
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it. -
I have intentionally disabled "Load Images Automatically" so that it is easier to view my desktop remotely via VNC or Remote Desktop. Animations and other graphics kill the performance of these remote viewing apps. However, when I reach a desired web page (the one I really intend to read in full), I want to load all the images ***for that page only***.
I don't think Firefox has that features. It views loading images as a permissions issues toggled on a site-by-site basis rather than a performance issue toggled on a page-by-page basis.
Maybe an add-on would give you a better balance of features? These two popped up in a quick search:
[https://addons.mozilla.org/en-US/firefox/addon/image-block/ Image Block :: Add-ons for Firefox]
[https://addons.mozilla.org/en-US/firefox/addon/imglikeopera/ ImgLikeOpera :: Add-ons for Firefox]
If you try either of these, let us know what you think. -
? on How to Load Variable Within For Loop
Hello,
I'm a PL/SQL newbee so I apologize up front if this is a basic question. In summary, I'm trying to build a field name within a FOR LOOP and also load this field with it's associated data from an input record and finally load the data to the output record and pipe the row. I can successfully build the field name but don't know how to load it with data from the input record.
Here is a sample from the code.
The input table is shown with the 6 different Fnma codes. Instead of checking each code for data, I want to build the field name, load this field name with data from the input record and move the data to the output record.
CURSOR cur_loan(prod_date_in IN DATE) IS
Select
Ln.Ln_No,
Ln.Prod_Date,
Ln.Ln_Fnma_Ftr1_Cd,
Ln.Ln_Fnma_Ftr2_Cd,
Ln.Ln_Fnma_Ftr3_Cd,
Ln.Ln_Fnma_Ftr4_Cd,
Ln.Ln_Fnma_Ftr5_Cd,
Ln.Ln_Fnma_Ftr6_Cd,
from LOAN Ln
where PROD_DATE = '16-FEB-11';
Here is the FOR LOOP that successfully builds the field name in l_feat_code_name. Then I "assume" by moving this field to l_output that l_output will contain the actual data, not the field name. However, it appears to contain the field name instead of the data.
FOR l_To IN 1 .. 6
LOOP
l_feat_code_name := ('l_loan_rec.ln_fnma_ftr'||l_to||'_cd');
l_output := l_feat_code_name;
IF (l_output is not null or
l_output <> ' ') THEN
l_out_rec.Inv_Type := l_Fnma_Cd;
l_out_rec.feat_code := l_output;
l_out_rec.Src_Delete_Flag := l_src_delete_flag_n;
PIPE ROW(l_svc_ln_rec);
END IF;
END LOOP;
How can I move the data itself into the l_out_rec.feat_code output record? Thanks in advance.Hi,
l_output is defined as follows:
l_output varchar2(20) ;
I appreciate your example.
Again, after I build l_feat_code_name it contains the column name from the input record, Ln_Fnma_Ftr1_Cd, ....Ftr2...., .....Ftr3..... and so on up to Ftr6. However, I also need the **data value** of Ln_Fnma_Ftr1_Cd, ....Ftr2...., .....Ftr3..... and so on up to Ftr6. My question is how to get the data value. You see below when I move l_feat_code_name to l_output I'm expecting l_output to contain the **data value**. Instead, when I display it in DBMS_output, it shows the column name.
CURSOR cur_loan(prod_date_in IN DATE) IS
Select
Ln.Ln_No,
Ln.Prod_Date,
Ln.Ln_Fnma_Ftr1_Cd,
Ln.Ln_Fnma_Ftr2_Cd,
Ln.Ln_Fnma_Ftr3_Cd,
Ln.Ln_Fnma_Ftr4_Cd,
Ln.Ln_Fnma_Ftr5_Cd,
Ln.Ln_Fnma_Ftr6_Cd,
from LOAN Ln
where PROD_DATE = '16-FEB-11';
Here is the FOR LOOP that successfully builds the field name in l_feat_code_name. Then I "assume" by moving this field to l_output that l_output will contain the actual data, not the field name. However, it appears to contain the field name instead of the data.
FOR l_To IN 1 .. 6
LOOP
l_feat_code_name := ('l_loan_rec.ln_fnma_ftr'||l_to||'_cd');
l_output := l_feat_code_name;
IF (l_output is not null or
l_output ' ') THEN
l_out_rec.Inv_Type := l_Fnma_Cd;
l_out_rec.feat_code := l_output;
l_out_rec.Src_Delete_Flag := l_src_delete_flag_n;
PIPE ROW(l_svc_ln_rec);
END IF;
END LOOP; -
Apple Mail - Load images for some email addresses automatically
Is it possible in Apple Mail to put some email addresses on a white list so that the images within their emails always load?
I don't want all images to load for every email I get, but I find it an annoyance to have to often load images from contacts I already trust.AppleScript to the rescue! Thank you Linc Davis!!!
Still find it strange Apple doesn't have this built into the Mail interface as an option and have to run a script [grumble]. -
Producer loop and 2 consumer loop for acquisition and process images
Hello everybody,
I'm quite a newbie in Labview 2011 on Windows 7.
Those are what I want to do :
Step 1: When the objects fall with velocity around 2 to 5 m/s, images of these objects will be acquired continuously from PCIe 1433 with Basler spL4096-39kc.
Step 2: The processing of the images continuously in the same time with step 1 will find the datas of the objects in images as colors, patterns and locations. If the patterns and colors at location are as the same sample, the elements in Boolean data array are true.
Step 3: Every 01 millisecond, values from Boolean data array will be read, the valves of nozzle will be opened if the values are true.
My question is what is the best way to do my tasks ? I couldn't find any example of program in Labview and I think I use producer/consumer architecture for step 1 and 2 but I don't know how can I set up producer loop for step 3 and transfer Boolean data array from step 2 to step 3 ?
Thank you for reading and help me !Dear Eric-J,
Thanks for your reply. I want sort the pellets that have 6mm diameter. The pellets were fed in a single layer by a vibratory feeder with a flat-bottom trough, 400mm wide that was supplied with the feeder . The pellets dropped off the end of the feeder onto a chute with 40 parallel U-shaped grooves. Images of these pellets will be acquired continuously. I make the sample from image that was acquired. I use NI Vision for processing of the images. If the patterns and colors of pellets are as the same sample, the elements in boolean data array are true. As you thought, I would like to interpret data every millisecond and open/close a valve based on the boolean array. The air valve sends a burst of air for 2 - 3 milliseconds to an air nozzle that diverts the pellets into the appropriate channel.
What are your ideas for this task ? Could you explain more clearly about "a real time system" and "determinism" for this task ?
Thanks and best regards
Maybe you are looking for
-
I'm very tempted by a refurb HP Smartbuy ZR2740w 27" WQHD display, but it doesn't have a HDMI port. It does have DisplayPort. Since the mid-2011 Mac Mini I have has either HDMI or Thunderbolt to choose from, plus I've just bought an external TB stora
-
What is the best way to set up a review process, without violating the EULA and having a form that is editable by the end user AFTER it is submitted. Basically the process will go like this.. 1. A user will log onto our website and click a link where
-
How can I set up Mavericks Server on a Test Mac without affecting the production server
I have Mountain Lion server running as on an xserve as our main server, it has developed a few issues particularly related to Profile Manager and Certificates. So I was going to use the move to Mavericks as an opportunity to have a fresh start. So I
-
Lightroom 5 to Photoshop cc very slow
I had lighroom 5 and photshop cs6. When going from LR to PS by picking the edit in option, with photoshop already open, my photo appeared in PS very quickly. I then uploaded PS CC and now when using the edit in option to go from LR to PS, it takes
-
Mail box no 3 is on outlook - why cant i have all 3 on bigpond?
Ok have 2 accounts on pc both on bigpond via thunderbird.Bought a lap top for hubbie for his football mainly and he needed email so asked and it ended up on Outlook. All 3 are being paid off one account so why the different platforms?So is this manda