Search Results

Search found 6694 results on 268 pages for 'wait states'.

Page 9/268 | < Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >

  • Getting list of states/events from a model that AASM's

    - by Jason Nerer
    Hi, I successfully integrated the most recent AASM gem into an application, using it for the creation of a wizard. In my case I have a model order class Order < ActiveRecord::Base belongs_to :user has_one :billing_plan, :dependent => :destroy named_scope :with_user, ..... <snip> include AASM aasm_column :aasm_state aasm_initial_state :unauthenticated_user aasm_state :unauthenticated_user, :after_exit => [:set_state_completed] aasm_state : <snip> <and following the event definitions> end Now I would like to give an administrator the possibility to create his own graphs through the AASM states. Therefore I created two additional models called OrderFlow and Transition where there order_flow has many transitions and order belongs_to order_flow. No problem so far. Now I would like to give my admin the possibility to dynamically add existing transitions / events to an order_flow graph. The problem now is, that I do not find any possibility to get a list of all events / transitions out of my order model. aasm_states_for_select seems to be the correct candidate, but I cannot call it on my order model. Can anyone help? Thx in advance. J.

    Read the article

  • Matlab GUI: How to Save the Results of Functions (states of application)

    - by niko
    Hi, I would like to create an animation which enables the user to go backward and forward through the steps of simulation. An animation has to simulate the iterative process of channel decoding (a receiver receives a block of bits, performs an operation and then checks if the block corresponds to parity rules. If the block doesn't correspond the operation is performed again and the process finally ends when the code corresponds to a given rules). I have written the functions which perform the decoding process and return a m x n x i matrix where m x n is the block of data and i is the iteration index. So if it takes 3 iterations to decode the data the function returns a m x n x 3 matrix with each step is stired. In the GUI (.fig file) I put a "decode" button which runs the method for decoding and there are buttons "back" and "forward" which have to enable the user to switch between the data of recorded steps. I have stored the "decodedData" matrix and currentStep value as a global variable so by clicking "forward" and "next" buttons the indices have to change and point to appropriate step states. When I tried to debug the application the method returned the decoded data but when I tried to click "back" and "next" the decoded data appeared not to be declared. Does anyone know how is it possible to access (or store) the results of the functions in order to enable the described logic which I want to implement in Matlab GUI?

    Read the article

  • Differentiate Between UITableView Editing States?

    - by Josh Kahane
    I have been looking at trying to differentiate between editing states in my UITableView. I need to call a method only when in editing mode after tapping the edit button, so when you get your cell slide in and you see the little circular delete icons but NOT when the user swipes to delete. Is there anyway I can differentiate between the two? Thanks. EDIT: Solution thanks to Rodrigo Both each cell and the entire tableview has an 'editing' BOOL value, so I loop through all the cells and if more than one of them is editing then we know the whole table is (the user tapped the edit button), however if only one is editing then we know that the user has swiped a cell, editing that individual one, this lets me deal with each editing state individually! - (void)setEditing:(BOOL)editing animated:(BOOL)animated { [super setEditing:editing animated:animated]; int i = 0; //When editing loop through cells and hide status image so it doesn't block delete controls. Fade back in when done editing. for (customGuestCell *cell in self.tableView.visibleCells) { if (cell.isEditing) { i += 1; } } if (i > 1) { for (customGuestCell *cell in self.tableView.visibleCells) { if (editing) { // loop through the visible cells and animate their imageViews [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:0.4]; cell.statusImg.alpha = 0; [UIView commitAnimations]; } } } else if (!editing) { for (customGuestCell *cell in self.tableView.visibleCells) { [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:0.4]; cell.statusImg.alpha = 1.0; [UIView commitAnimations]; } } }

    Read the article

  • Wait for a single RabbitMQ message with a timeout

    - by Evgeny
    I'd like to send a message to a RabbitMQ server and then wait for a reply message (on a "reply-to" queue). Of course, I don't want to wait forever in case the application processing these messages is down - there needs to be a timeout. It sounds like a very basic task, yet I can't find a way to do this. I've now run into this problem with both py-amqplib and the RabbitMQ .NET client. The best solution I've got so far is to poll using basic_get with sleep in-between, but this is pretty ugly: def _wait_for_message_with_timeout(channel, queue_name, timeout): slept = 0 sleep_interval = 0.1 while slept < timeout: reply = channel.basic_get(queue_name) if reply is not None: return reply time.sleep(sleep_interval) slept += sleep_interval raise Exception('Timeout (%g seconds) expired while waiting for an MQ response.' % timeout) Surely there is some better way?

    Read the article

  • ajax: don't wait for response, but check for it periodically

    - by dnagirl
    I have a PHP process that takes a long time to run. I don't want the AJAX process that calls it to wait for it to finish. When the PHP process finishes it will set a field in a database. There should be some kind of AJAX polling call to check on the database field periodically and set a message. How do I set up a jQuery AJAX call to poll rather than wait? Does the PHP script have to do anything special?

    Read the article

  • Angularjs wait until

    - by Diolor
    I have: $scope.bounds = {} And later in my code: $scope.$on('leafletDirectiveMap.load', function(){ console.log('runs'); Dajaxice.async.hello($scope.populate, { 'west' : $scope.bounds.southWest.lng, 'east': $scope.bounds.northEast.lng, 'north' : $scope.bounds.northEast.lat, 'south': $scope.bounds.southWest.lat, }); }); The bounds as you can see at the begging they are empty but they are loaded later (some milliseconds) with a javascript library (leaflet angular). However the $scope.$on(...) runs before the bounds have been set so the 'west' : $scope.bounds.southWest.lng, returns an error with an undefined variable. What I want to do is to wait the bounds (southWest and northEast) to have been set and then run the Dajaxice.async.hello(...). So I need something like "wait until bounds are set".

    Read the article

  • Can't get YUI animations to wait until the first has finished

    - by Andy Cairns
    Hi there, I have 3 animations that run when I load my page. A header descends from the top and a footer ascends from the bottom. Also, my main logo goes from fully transparent to fully opaque. I'm using the YUI framework for the animations. My problem is that they all happen at the same time. I'd like the header & footer animations to go at the same time but the logo to wait until the others have finished. setTimeout doesn't appear to work (the animation triggers immediately). I've also tried a while loop to wait until the currentFrame = a certain number but my loops seem to stop everything from working. Any help would be gratefully received. Thanks Andy

    Read the article

  • C# how to wait for a webpage to finish loading before continuing

    - by MD6380
    I'm trying to create a program to clone multiple bugs at a time through the web interface of our defect tracking system. How can I wait before a page is completely loaded before I continue? //This is pseudo code, but this should give you an idea of what I'm trying to do. The //actual code uses multi-threading and all that good stuff :). foreach (string bug in bugs) { webBrowser.Navigate(new Uri(url)); webBrowser.Document.GetElementById("product").SetAttribute("value", product); webBrowser.Document.GetElementById("version").SetAttribute("value", version); webBrowser.Document.GetElementById("commit").InvokeMember("click"); //Need code to wait for page to load before continuing. }

    Read the article

  • Wait for tasks to get completed in threadpool.

    - by Alien01
    Hello I have created a thread pool in C++ which stores all tasks in a queue. Thread pool start n number of threads which takes tasks from queue , process each task and then delete tasks from queue. Now , I want to wait till all tasks get completed. Checking for empty queue for completion of tasks may not work as , task can be given to each thread and queue can be emptied but still the tasks can in processing mode. I am not getting idea how to wait for all the tasks completion.This is a design problem. Any suggestions?

    Read the article

  • jQuery wait for ajax call to be over before continuing

    - by Flo
    Hi all, I have a problem with a jQuery ajax call. I need to wait for the call to be finished in order to return a value. However, the script seems to jump ahead and not wait for the call to be over. my function then returns "undefined". I have tried to use the .ajax() method and set the value of async to false, but this would not work either. I could I get my function to return the value that I could through the ajax call? Thank you! Here is the code: function get_rsrce_name(){ jQuery.post( '<?php echo admin_url( 'admin-ajax.php' ); ?>', { action :'my_action', option_rsrce : 'option_rsrce' }, function( data ) { output = data.option_name; }, "json" ); return output; }

    Read the article

  • threading.Event wait function not signaled when subclassing Process class

    - by user1313404
    For following code never gets past the wait function in run. I'm certain I'm doing something ridiculously stupid, but since I'm not smart enough to figure out what, I'm asking. Any help is appreciated. Here is the code: import threading import multiprocessing from multiprocessing import Process class SomeClass(Process): def __init__(self): Process.__init__(self) self.event = threading.Event() self.event.clear() def continueExec(self): print multiprocessing.current_process().name print self print "Set:" + str(self.event.is_set()) self.event.set() print "Set:" + str(self.event.is_set()) def run(self): print "I'm running with it" print multiprocessing.current_process().name self.event.wait() print "I'm further than I was" print multiprocessing.current_process().name self.event.clear() def main(): s_list = [] for t in range(3): s = SomeClass() print "s:" + str(s) s_list.append(s) s.start() raw_input("Press enter to send signal") for t in range(3): print "s_list["+str(t)+"]:" + str(s_list[t]) s_list[t].continueExec() raw_input("Press enter to send signal") for t in range(3): s_list[t].join() print "All Done" if __name__ == "__main__": main()

    Read the article

  • Wait until a webpage finished loading to load the next one in a list

    - by envy
    Hi! I'm using PyQT webView to visit some webpages I have stored on a dictionary the code is something like this: def loadLink(self, url): manager = QNetworkAccessManager() request = QNetworkRequest(QUrl(url)) self.ui.webView.load(QUrl(visitar)) def readUnreadLinks(self): print "Links to read: " + str(len(self.unreadLinks)) for link in self.unreadLinks: print "link-> " + str(link) self.loadLink(link) the problem is it doesn't wait until finished loading the web page and starts loading the next one. I want to load a webpage, wait until it finished loading and then load the next one. Thanks, this is driving me crazy :)

    Read the article

  • wait for ajax request then finish the rest ( jQuery )

    - by user1725155
    I have a peace of jquery code: var new = checkCP(somedata); if(new=="hi"){ alert("Welcom"); } function checkCP(jsData){ $.ajax({ type: "POST", url: "Process.php", data: jsData, dataType: "json", success: function(data){ if(data.match==1) return "hi"; else return "bye"; } }); } I don't know why the welcome alert never show up . I checked everything , even on PHP file the result is 1 but apparently before It wait for ajax respond it passes the if(new=="hi"){ alert("Welcom"); } So is there anyway to wait for ajax respond then read the rest of codes in jQuery ? Thanks.

    Read the article

  • C# Spawn Multiple Threads for work then wait until all finished

    - by pharoc
    just want some advice on "best practice" regarding multi-threading tasks. as an example, we have a C# application that upon startup reads data from various "type" table in our database and stores the information in a collection which we pass around the application. this prevents us from hitting the database each time this information is required. at the moment the application is reading data from 10 tables synchronously. i would really like to have the application read from each table in a different thread all running in parallel. the application would wait for all the threads to complete before continuing with the startup of the application. i have looked into BackGroundWorker but just want some advice on accomplishing the above. Does the method sound logical in order to speed up the startup time of our application How can we best handle all the threads keeping in mind that each thread's work is independent of one another, we just need to wait for all the threads to complete before continuing. i look forward to some answers

    Read the article

  • Wait window in a windows application

    - by Vinodtiru
    I basically need to show a wait window to the user. For this i have put two seperate window forms in the application. the first form is the main form with a button. The second one is a empty one with just a label text. On click of the button in Form1 i do the below Form2 f = new Form2(); f.Show(); Thread.Sleep(2000); f.Close(); My idea here is to show the wait window to the user for 2 second. But when i do this the Form 2 is not completely loaded because of which the label in it is blank. Please let me know your inputs on this.

    Read the article

  • Java Thread wait() => blocked?

    - by Chris
    According to http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Thread.State.html calling wait() will result a thread to go in BLOCKED state. However this piece of code will result (after being called) in a Thread in WAITING State. class bThread extends Thread { public synchronized void run() { try { wait(); } catch (InterruptedException e) { e.printStackTrace(); } } } Have I got something wrong? Can anybody explain this behaviour to me? Any help would be appreciated!

    Read the article

  • How should I smooth the transition between these two states in flex/flashbuilder

    - by Joshua
    I have an item in which has two states, best described as open and closed, and they look like this: and And what I'd like to do is is smooth the transition between one state and the other, effectively by interpolating between the two points in a smooth manner (sine) to move the footer/button-block and then fade in the pie chart. However this is apparently beyond me and after wrestling with my inability to do so for an hour+ I'm posting it here :D So my transition block looks as follows <s:transitions> <s:Transition id="TrayTrans" fromState="*" toState="*"> <s:Sequence> <s:Move duration="400" target="{footer}" interpolator="{Sine}"/> <s:Fade duration="300" targets="{body}"/> </s:Sequence> </s:Transition> <s:Transition> <s:Rotate duration="3000" /> </s:Transition> </s:transitions> where {body} refers to the pie chart and {footer} refers to the footer/button-block. However this doesn't work so I don't really know what to do... Additional information which may be beneficial: The body block is always of fixed height (perhaps of use for the Xby variables in some effects?). It needs to work in both directions. Oh and the Sine block is defined above in declarations just as <s:Sine id="Sine">. Additionally! How would I go about setting the pie chart to rotate continually using these transition blocks? (this would occur without the labels on) Or is that the wrong way to go about it as it's not a transition as such? The effect I'm after is one where the pie chart rotates slowly without labels prior to a selection of a button below, but on selection the rotation stops and labels appear... Thanks a lot in advance! And apologies on greyscale, but I can't really decide on a colour scheme. Any suggestions welcome.

    Read the article

  • WDS "No response" only when notify and wait for approval

    - by Cylindric
    I have a WDS server setup for use with MDT2010, and everything was working fine until this morning. Now, whenever I try to boot from LAN, I get an error: Downloaded WDSNBP... Architecture: x64 WDSNBP started using DHCP Referral. Contacting Server: 10.50.10.12 (Gateway: 0.0.0.0) No response from Windows Deployment Services server. Launching pxeboot.com My PXE Response Policy setting on the WDS is set to this: [ ] Do not respond to any client computer [ ] Respond only to known client computers [o] Respond to all (known and unknown) client computers [X] For unknown clients, notify administrator and respond after approval The odd thing is that if I clear the approval option (so any computer gets a response) it works fine. I have delegated permissions on the AD OU to the computer object WDS is running on, but that doesn't seem to have helped. As it works without approval, I can only assume my DHCP options are fine and this is some sort of AD permission problem. (Server is Windows Server 2008 SP2)

    Read the article

  • Script to wrap around an application and wait for app to finish

    - by JohnyV
    I need a vb script that will wrap around an applcation which will stay open until the application finishes. I want to be able to call the following command "setup.exe /qb /I Autocad2010.ini /language en-us" But I need the vb script to stay running until the setup has finished. Is there anyone out there that can assist with this. Much appreciated in advance

    Read the article

  • Long wait until POST...

    - by Wesley
    Here are the specs to put things into context: ECS P4VXASD2+ (V5.0) motherboard Intel Pentium 4 Northwood 2.8 GHz (512 KB L2, 533 MHz FSB) 2x 512 MB PC2100 DDR266 RAM 128 MB NVIDIA GeForce FX 5200 AGP WD Caviar SE 80 GB IDE HDD Gigabyte CD-RW drive OKIA 300W ATX PSU So, everytime I try to boot up this computer, it takes at least 10-15 seconds before it will POST. All my other machines will post within 1-2 seconds, but this one takes a particularly long time. I've read suggestions from a Google search to swap the CMOS battery, check BIOS settings, and double check CMOS jumper. Still after follow those, it takes a while to POST. What else could be causing a long delay before POSTing?

    Read the article

  • Wait for linux machine to be rebooted

    - by Theo
    I have a small script to install on my remote machine an update. I would like to reboot the machine remotely and if it is rebooted, continue with some more commands. What I currently do is: ssh root@myMachine << COMMANDS_ISSUED ###... Tasks init 6 COMMANDS_ISSUED sleep 180s ssh root@myMachine << POST_REBOOT_COMMANDS ###.... More stuff POST_REBOOT_COMMANDS Is there a more elegant way to do it? Like pinging the machine all 5 seconds up to a maximum of 4 minutes? I play with a few linux machines which have different boot up times and if my script would continue immediately after reboot, this could safe quite some time for me. (Note: I don't want to parallelize execution over all machines as I want to see for each machine if everything worked fine)

    Read the article

  • AsyncTask, inner classes and Buttons states

    - by Intern John Smith
    For a musical application (a sequencer), I have a few buttons static ArrayList<Button> Buttonlist = new ArrayList<Button>(); Buttonlist.add(0,(Button) findViewById(R.id.case_kick1)); Buttonlist.add(1,(Button) findViewById(R.id.case_kick2)); Buttonlist.add(2,(Button) findViewById(R.id.case_kick3)); Buttonlist.add(3,(Button) findViewById(R.id.case_kick4)); Buttonlist.add(4,(Button) findViewById(R.id.case_kick5)); Buttonlist.add(5,(Button) findViewById(R.id.case_kick6)); Buttonlist.add(6,(Button) findViewById(R.id.case_kick7)); Buttonlist.add(7,(Button) findViewById(R.id.case_kick8)); that I activate through onClickListeners with for example Buttonlist.get(0).setActivated(true); I played the activated sound via a loop and ifs : if (Buttonlist.get(k).isActivated()) {mSoundManager.playSound(1); Thread.sleep(250);} The app played fine but I couldn't access the play/pause button when it was playing : I searched and found out about AsyncTasks. I have a nested class PlayPause : class PlayPause extends AsyncTask<ArrayList<Button>,Integer,Void> in which I have this : protected Void doInBackground(ArrayList<Button>... params) { for(int k=0;k<8;k++) { boolean isPlayed = false; if (Buttonlist.get(k).isActivated()) { mSoundManager.playSound(1); isPlayed = true; try {Thread.sleep(250); } catch (InterruptedException e) {e.printStackTrace();}} if(!isPlayed){ try {Thread.sleep(250);} catch (InterruptedException e) {e.printStackTrace();} } } return null; } I launch it via Play.setOnClickListener(new PlayClickListener()); with PlayClickListener : public class PlayClickListener implements OnClickListener { private Tutorial acti; public PlayClickListener(){ super(); } @SuppressWarnings("unchecked") public void onClick(View v) { if(Tutorial.play==0){ Tutorial.play=1; Tutorial.Play.setBackgroundResource(R.drawable.action_down); acti = new Tutorial(); Tutorial.PlayPause myPlayPause = acti.new PlayPause(); myLecture.execute(Tutorial.Buttonlist); } else { Tutorial.play=0; Tutorial.lecture.cancel(true); Tutorial.Play.setBackgroundResource(R.drawable.action); } } } But it doesn't work. when I click on buttons and I touch Play/Pause, I have this : 07-02 11:06:01.350: E/AndroidRuntime(7883): FATAL EXCEPTION: AsyncTask #1 07-02 11:06:01.350: E/AndroidRuntime(7883): Caused by: java.lang.NullPointerException 07-02 11:06:01.350: E/AndroidRuntime(7883): at com.Tutorial.Tutorial$PlayPause.doInBackground(Tutorial.java:603) 07-02 11:06:01.350: E/AndroidRuntime(7883): at com.Tutorial.Tutorial$PlayPause.doInBackground(Tutorial.java:1) And I don't know how to get rid of this error. Obviously, the Asynctask doesn't find the Buttonlist activated status, even if the list is static. I don't know how to access these buttons' states, isPressed doesn't work either. Thanks for reading and helping me !

    Read the article

  • Why doesn't my NamedPipeServerStream wait??

    - by Frank Fella
    I'm working with a NamedPipeServerStream to communicate between two processes. Here is the code where I initialize and connect the pipe: void Foo(IHasData objectProvider) { Stream stream = objectProvider.GetData(); if (stream.Length > 0) { using (NamedPipeServerStream pipeServer = new NamedPipeServerStream("VisualizerPipe", PipeDirection.Out, 1, PipeTransmissionMode.Byte, PipeOptions.Asynchronous)) { string currentDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string uiFileName = Path.Combine(currentDirectory, "VisualizerUIApplication.exe"); Process.Start(uiFileName); if(pipeServer.BeginWaitForConnection(PipeConnected, this).AsyncWaitHandle.WaitOne(5000)) { while (stream.CanRead) { pipeServer.WriteByte((byte)stream.ReadByte()); } } else { throw new TimeoutException("Pipe connection to UI process timed out."); } } } } private void PipeConnected(IAsyncResult e) { } But it never seems to wait. I constantly get the following exception: System.InvalidOperationException: Pipe hasn't been connected yet. at System.IO.Pipes.PipeStream.CheckWriteOperations() at System.IO.Pipes.PipeStream.WriteByte(Byte value) at PeachesObjectVisualizer.Visualizer.Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) I would think that after the wait returns everything should be ready to go. If I use pipeServer.WaitForConnection() everything works fine, but hanging the application if the pipe doesn't connect is not an option.

    Read the article

  • playframework auto-test Jenkins CI wait for completion?

    - by notbrain
    I am trying to set up Jenkins CI for a playframework.org application but am having trouble properly launching play after the auto-test command is run. The tests all run fine, but it seems as though my script is launching both play auto-test and play start --%ci at the same time. When the play start --%ci command runs, it gets a pid and everything, but it's not running. FILE: auto-test.sh, jenkins runs this with execute shell #!/bin/bash # pwd is jenkins workspace dir # change into approot dir cd customer-portal; # kill any previous play launches if [ -e "server.pid" ] then kill `cat server.pid`; rm -rf server.pid; fi # drop and re-create the DB mysql --user=USER --password=PASS --host=HOSTNAME < ../setupdb.sql # auto-test the most recent build /usr/local/lib/play/play auto-test; # this is inadequate for waiting for auto-test to complete? # how to wait for actual process completion? # sleep 60; wait; # Conditional start based on tests # Launch normal on pass, test on fail # if [ -e "./test-result/result.passed" ] then /usr/local/lib/play/play start --%ci; exit 0; else /usr/local/lib/play/play test; exit 1; fi

    Read the article

  • java url connection, wait for data being sent through the outputstream

    - by Mateu
    I'm writting a java class that tests uploading speed connection to a server. I want to check how many data can be send in 5 seconds. I've written a class which creates a URL, creates a connection, and sends data trough the outPutStream. There is a loop where I writte data to the stream for 5 seconds. However I'm not able to see when data has been send (I writte data to the output stream, but data is not send yet). How can I wait untill data is really sent to the server? Here goes my code (which does not work): URL u = new URL(url) HttpURLConnection uc = (HttpURLConnection) u.openConnection(); uc.setDoOutput(true); uc.setDoInput(true); uc.setUseCaches(false); uc.setDefaultUseCaches(false); uc.setRequestMethod("POST"); uc.setRequestProperty("Content-Type", "application/octet-stream"); uc.connect(); st.start(); // Send the request OutputStream os = uc.getOutputStream(); //This while is incorrect cause it does not wait for data beeing sent while (st.getElapsedTime() < miliSeconds) { os.write(buffer); os.flush(); st.addSize(buffer.length); } os.close(); Thanks

    Read the article

< Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >