smallseo.info

pause

Perl authors upload server PAUSE: menu

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)

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)

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)

VB .net Stop loop until Button-press

I'm reading the following JSON. This JSOM is being displayed in a windowsform to evaluate, correct and then send to our SQL database.

The code should read one record at a time - and then pause/stop until Button-click (when the last record has been corrected and send to the SQL database).

My problem is therefore HOW TO pause/stop the code until Button-click

    Try
        Dim request As HttpWebRequest
        Dim response As HttpWebResponse = Nothing
        Dim reader As StreamReader
        Dim URL As String = "http://blabla.kundeside.dk/json?key=t6%$7"

        request = DirectCast(WebRequest.Create(URL), HttpWebRequest)
        response = DirectCast(request.GetResponse(), HttpWebResponse)
        reader = New StreamReader(response.GetResponseStream())

        Dim rawresp As String
        rawresp = reader.ReadToEnd()
        Dim array As JArray = JArray.Parse(rawresp)
        For Each item As JObject In array
            TxtFornavn.Text = item("name").ToString
            TxtAdresse.Text = item("address").ToString
            TxtCPR.Text = item("cpr_nr").ToString
            TxtHCV.Text = item("reg_nr").ToString
            TxtTelefon.Text = item("phone").ToString
            TxtMobil.Text = item("mobile").ToString
            TxtEmail.Text = item("email").ToString
            TxtArbejdstelefon.Text = item("workphone").ToString
            TxtKommune.Text = item("municipality").ToString
            TxtRegion.Text = item("region").ToString
            TxtLand.Text = item("country").ToString
            TxtPostBy.Text = item("city").ToString
        Next

    Catch ex As System.Net.WebException
        MsgBox(ex.ToString)
    Finally

    End Try

Source: (StackOverflow)

Resume and Pause while uploading file to GCS in Android

I tried this code for uploading files on GCS in android . This code is running perfectly and uploading file on bucket. But now I want to upload file in background(from service) with Pause/Resume functionality, which will Pause when internet connection will gone and Resume when internet connection available.. I search alot on internet but did not find any perfect solution.

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)

How to create an in-game pause menu?

I have looked at dialogs & menus, but still have no idea on how to implement them to create a pause screen.

I want to be able to create a pause screen with a custom layout, I do not want to use create another activity or use intents.

I have a method which detects whether the user swipes the screen left or right. Once the user swipes left or right, only then do I want the pause menu to appear.

This is the structure of my code:

   public mainActivity extends AppCompatActivity{
          //onCreate method contains the following statement...
          setContentView(new GamePanel(this));
   }

Now the class which extends SurfaceView

   public class GamePanel extends SurfaceView implements SurfaceHolder.CallBack{

       //Several methods which pertain to the game along with a constructor

       //InnerClass which is used to detect swipes

       class onSwipeTouchListener implements onTouchListener{
             //More fields
             //Nested inner class
             private final class GestureListener extends GestureDetector.SimpleOnGestureListener{
            //More fields

            //The following method is called when the user swipes right
            public void onSwipeRight(){
            //It is within this method I want the pause screen/menu/customlayout to appear.
            }
            }  
      }
}

I have tried the following:

 **//The passAsParameter argument is the Context of the mainActivity.**

 public void showPopup() {

            RelativeLayout layout = (RelativeLayout) findViewById(R.id.pause_layout);
            PopupMenu popup = new PopupMenu(passAsParameter, layout);

            popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
                @Override
                public boolean onMenuItemClick(MenuItem item) {

                    return false;
                }
            });

            popup.getMenuInflater().inflate(R.menu.pause ,popup.getMenu());
            popup.show();
        }

Then I made a call to the showPopup method within the onSwipeRight method, however the desired pause screen did not appear. I have also tried using alert dialogs, nor did the outcome I desired occurred.

The fact that GamePanel is not an activity, increases the difficulty in trying to achieve what I want.

I am genuinely stuck on how to create an in-game pause screen, any help will be greatly appreciated.


Source: (StackOverflow)