EzDevInfo.com

pause

Perl authors upload server PAUSE: menu

Pause execution until any button pressed in swift

How can i pause execution until any button pressed in Swift 2?

--pause execution

if abuttonpressed == true { x = x +10

--continue execution }

else {

--continue execution }


Source: (StackOverflow)

Auto pause vimeo video when scrolling

I have loaded a vimeo video in my banner as a background banner but my problem is when scrolling it always play. Itried to pause it when scrolling with this code:

    <script type="text/javascript">
 $(document).ready(function(){
  $('#vmeo1')[0].play();
});

$(document).on("scroll",function(){
  if($(document).scrollLeft()>1){      
     $('#vmeo1')[0].pause();
   }
   else
   {
     $('#vmeo1')[0].play();
   }
});
</script>

but seems not working. Any help would be appreciated.


Source: (StackOverflow)

Advertisements

pause a running batch file if user presses a key. Opposite of normal pause function?

I have sections of a batch file that pause and wait until a user presses a key.

But what if i want the ability to pause the batch file while it is running on my own free will?

The batch file creates a user input variable:

SET /P userInput= enter something here

Later in the process i may want to update that user variable. but it will be at unexpected times.

Can i interrupt the batch file process, then update the variable, with out stopping or closing the entire batch process?

Basically, the idea is that the batch file is creating unique file names and sometimes i need to update its naming structure. being able to stop the program and just change that variable would be great.

so program starts:

Set /p userInput : something entered

does stuff..
does stuff..

//User hits  a key and program pauses
//prompt for userInput variable again:

Set /p userInput : something new

// then continue as normal

does stuff..
does stuff..

etc..

Maybe its possible to CALL a subroutine via keyboard press while the batch is running as another option?

Thanks for reading!!


Source: (StackOverflow)

Spritekit - Keep the game paused when didBecomeActive

I have a pause system with a function and a button and it works perfect, i know when the app enters background it automatically pauses and when it comes back it automatically unpauses itself, my problem is that I don't know how to keep it paused when it becomes active again.

func applicationWillResignActive(application: UIApplication) {

    NSNotificationCenter.defaultCenter().postNotificationName("Pause", object: nil) // tried here
}        


func applicationDidBecomeActive(application: UIApplication) {

    NSNotificationCenter.defaultCenter().postNotificationName("Pause", object: nil) // tried here
}

I tried on both those methods separately but the game keeps running, sometimes it shows my Pause menu (a layer above the gameplay) and still run in the background. So what is the correct way to achieve this ?


Source: (StackOverflow)

I get error on system line C++

I have a very simple program written in C++, see it here:

#include <iostream>
using namespace std;
int main()
{
cout<<"Simple message"<<endl;
system("msg * test message");
return 0;
}

When I try to compile this script using command: g++ 1.cpp -o test.exe, I get error:

1.cpp: In function 'int main()':
1.cpp:6:29: error: 'system' was not declared in this scope
  system("msg * test message");
                         ^

I checked code, but I can't find the reason of this error, should I change the compiler or is there mistake in in this code?


Source: (StackOverflow)

How do I access the methods of the video when using Videogular?

I have a video that I want to pause after it reaches X seconds.

  • I can play the video
  • I can listen to the currentTime through:

    <videogular data-vg-update-time="someFunction($currentTime,$duration)" ...> </videogular>

  • I can catch the time I'm looking for in a controller:

    var controllers = {};
    controllers.SomeController = function($scope){
        $scope.someFunction($currentTime, $duration){
            // this is a total hack method to catch current time
            // stay in school or you'll write code like this
            if(Math.round($currentTime) === 6){
                // RIGHT HERE. I know the API must be exposing the video obj
                // but I haven't been able to figure out how to catch it.
                // 
                // var foo =  document.getElementsByTagName('video');
                // foo.pause();
            }
        }
    }
    myApp.controller(controllers);
    

Now, clearly there's a better way to come at this problem. It smells terrible that I'm dropping out of angular to evaluate currentTime, and to try to identify to video object. In part, I'm struggling because the object is created through a directive baked into Videogular. My controller+partial looks like:

[continued from above...]
[i.e controllers.SomeController = function($sce, $scope){

// this is the angular controller
$scope.attractConfig = {
    sources: [
        {src: $sce.trustAsResourceUrl("/video/myVideo.mp4"), type: "video/mp4"}
    ],
    theme: "/bower_components/videogular-themes-default/videogular.css",
    plugins: {
        poster: "http://www.videogular.com/assets/images/videogular.png"
    },
    autoPlay: true
};

// and this is the HTML partial
<div data-ng-controller="SomeController as controller">
    <videogular data-vg-theme="attractConfig.theme"
            data-vg-auto-play="attractConfig.autoPlay"
            data-vg-update-time="checkAttractTime($currentTime,$duration)"
            data-vg-complete="restartAttract()">
        <vg-media data-vg-src="attractConfig.sources"></vg-media>
    </videogular>
</div>

I fell like I'm 90% of the way there, but I can't figure out how to, say, directly call pause() or play() when the currentTime hits X seconds. I can't figure out how to target the video object, which appears via directive.


Source: (StackOverflow)

SpriteKit - Pause screen doesn't show when didBecomeActive

My pause system works perfectly from inside the game, and also when the app moves to the background and then becomes active again the game stays paused, but my problem now is when it becomes active my pause screen doesn't show.

AppDelegate:

func applicationDidBecomeActive(application: UIApplication) {

    NSNotificationCenter.defaultCenter().postNotificationName("Pause", object: nil)

}

ViewController:

override func viewDidLoad() {
        super.viewDidLoad()

        let scene  = GameScene()
        // Configure the view.
        let skView =  self.view as! MainView

        NSNotificationCenter.defaultCenter().addObserver(skView, selector: "setStayPaused", name: "Pause", object: nil)

        skView.ignoresSiblingOrder = true
        scene.scaleMode = .AspectFill
        scene.size = skView.bounds.size

        skView.presentScene(scene)
    }

MainView (My custom skView):

class MainView: SKView {

    var stayPaused = false as Bool

    override var paused: Bool {
        get {
            return super.paused
        }
        set {
            if (!stayPaused) {
                super.paused = newValue
            }
            stayPaused = false
        }
    }

    func setStayPaused() {
        if (super.paused) {
            self.stayPaused = true
        }
    }
}

GameScene:

  override func didMoveToView(view: SKView) {
     NSNotificationCenter.defaultCenter().addObserver(self, selector: "pauseGame", name: "Pause", object: nil)
}

func pauseGame() {

        if isFirstTime == false { // to make sure that the app did not just get launched

            pauseScreen.hidden = false // doesn't show
            pauseButton.hidden = false // doesn't show
            view?.paused = true
            scene?.paused = true
        }
}

Source: (StackOverflow)

VMware Workstation 12 Suspend VM, disadvantages?

Im working with VMware Workstation 12 and I never Suspend my Virtual Machines, because I don't trust the option to Suspend your Machine. Today I was searching about 2 hours, if there are any disadvantages in supsending your VM, but I couldn't find any.

I just can't belive that there aren't any other disadvantages than losing some little space on your local computer.

Have I missed something, or is suspending really that safe and good to use?

Info: All my VMs are running on Windows 10


Source: (StackOverflow)

How to show progress while uploading file to GCS in Android

I tried this code for uploading file on GCS in android . This code is running perfectly and uploading file on bucket. Now I want to check progress with pause ,resume and internet on/off handling . I search alot on internet but did not find any perfect solution.

Code

CloudStorage.uploadFile("upload-recording", "/storage/sdcard0/Download/images.jpg",this,file);

public static void uploadFile(String bucketName, String filePath,Context context,File file_use)
            throws Exception {

        this_context = context;
        this_file = file_use;
        Storage storage = getStorage();

        StorageObject object = new StorageObject();
        object.setBucket(bucketName);

        File file = new File(filePath);

        InputStream stream = new FileInputStream(file);
        try {
            String contentType = URLConnection
                    .guessContentTypeFromStream(stream);
            InputStreamContent content = new InputStreamContent(contentType,
                    stream);

            Storage.Objects.Insert insert = storage.objects().insert(
                    bucketName, null, content);
            insert.setName(file.getName());

            insert.execute();
        } finally {
            stream.close();
        }
    }

Source: (StackOverflow)

C# pause foreach loop until button pressed

Using C#, I have list of methods (Actions). I then have a method to invoke action using a foreach loop. A button click calls the method which in turn invokes every action in the list in one go. What I am after is for the click to only execute one action per click. Thanks in advance.

private static List<Action> listOfMethods= new List<Action>();

listOfMethods.Add(() => method1());
listOfMethods.Add(() => method2());
listOfMethods.Add(() => method3());
//====================================================================
private void invokeActions()
{
   foreach (Action step in listOfMethods)
   {
       step.Invoke();
       //I want a break here, only to continue the next time the button is clicked
   }
}
//====================================================================
private void buttonTest_Click(object sender, EventArgs e)
    {
        invokeActions();
    }

Source: (StackOverflow)

After long pause, dynamically added items are not there

I have an Android App, where I have a ListView with a custom adapter and some items are static and some are dynamic (loading them from url).

It works perfect, there's no error, but when I pause my App and play with other apps (like surfing in chrome), then when I return to App, the static items are there, but the dynamic items are gone.

EDIT: I'm using volley StringRequest and Gson to load the items from url.


Source: (StackOverflow)

How to make a pause in a procedure and then return value after it?

I'm working on a C# project, want to make a small pause about 2 seconds inside a procedure.

Actually I have tried to use Invoke, but as you know, we can't use it inside a class this kind of procedure.

Here is my code for more details:

public class GenerateFile
{

    public CSPFEnumration.ProcedureResult GenerateFaxFile(string Daftar_No, string Channelno, string NationalCode)
    {
        string script = string.Format(" DECLARE @RC INT " +
                                        " DECLARE @Daftar_No INT = '{0}' " +
                                        " DECLARE @hokm_type_code INT = 100 " +
                                        " DECLARE @Channelno INT = '{1}' " +
                                        " DECLARE @Id_No BIGINT = '{2}' " +
                                        " EXEC @rc = [dbo].[Hokm_with_type] @Daftar_No, @hokm_type_code, @Channelno, @Id_No ",
                                        Daftar_No,
                                        Channelno,
                                        NationalCode);
        try
        {
            IEnumerable<string> commandStrings = Regex.Split(script, @"^\s*GO\s*$",
                                                    RegexOptions.Multiline | RegexOptions.IgnoreCase);
            Connect();
            foreach (string commandString in commandStrings)
            {
                if (commandString.Trim() != "")
                {
                    using (var command = new SqlCommand(commandString, Connection))
                    {
                        command.ExecuteNonQuery();
                    }
                }
            }

            DisConnect();

            string FaxFilePath = InternalConstant.FaxFilePath + "\\" + string.Format("Lhokm{0}.tif", Channelno);


            // I want to make a pause in here without locking UI

            if (File.Exists(FaxFilePath))
                return CSPFEnumration.ProcedureResult.Success;
            else
                return CSPFEnumration.ProcedureResult.Error;

        }
        catch (Exception ex)
        {
            InternalDatabase.GetInstance.InsertToPensionOrganizationException(ex);
            return CSPFEnumration.ProcedureResult.Error;
        }
    }
}

I have tried await too, but I cant return a proper value. because in this procedure if I use await, the value will return before finishing await.

Edit:

And also I dont want to use Thread.Sleep because it will lock UI. Thanks for any helping.


Source: (StackOverflow)

PHP Pause Script If internet Connection is lost

Im creating a page downloading script fed by A database, and sometimes the internet connection will go, is they're anyway to pause the script while the internet is down and continue when its back online?


Source: (StackOverflow)

Cycle2 Carousel - Pause continuous slider on hover

I'm using CYCLE 2 and trying to pause a continuous slider exactly in the moment I hover it, but it only works after the transition animation is complete. How can I fix that?

            Slider.cycle({
                fx: 'carousel',
                carouselVertical: true,
                pauseOnHover: true,
                carouselVisible: quantItens,
                speed: 6000,
                slides: '> *',
                timeout: 1,
                easing: 'linear',
            });

Source: (StackOverflow)

How to pause a loop print in python

I have the following code:

i = 0
numbers = []

while i < 6:
    print ("At the top i is %d" % i)
    numbers.append(i)

    i = i + 1
    print ("Numbers now: ", numbers)
    print ("At the bottom i is %d" % i)


print ("The numbers: ")

for num in numbers:
    print (num)

If I import sleep it will slow it down, but how can I pause it so it proceeds when I want it to?


Source: (StackOverflow)