w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Event for exiting the screen monitor (with WPF)
You could handle the Window's MouseMove event and check the mouse's position. private void Window_MouseMove(object sender, MouseEventArgs e) { //PrimaryScreenWidth - 1 to account for the cursor itself if (e.GetPosition(this).X >= SystemParameters.PrimaryScreenWidth - 1 || e.GetPosition(this).X <= 1) MessageBox.Show("Edge hit"); } If you're running multiple monitors, you could also handle the MouseLeave event to handle the case where the mouse has moved to the second monitor. private void Window_MouseLeave(object sender, MouseEventArgs e) { MessageBox.Show("Edge hit"); }

Categories : C#

When exiting html5 full screen mode css media queries don't work - safari
Ok, so I did a mockup outside of my app with the same conditions (with none of the other code) and realized this was working in Safari in that test. I was using: $(document).stop(true, true); in an event bound to exiting full screen. Apparently Safari didn't like this. Now that that is removed, it works fine in Safari again.

Categories : CSS

switching screen with libGDX on android is slow, but instant on PC?
Eventually I found out what the problem was... every time the screen changes, it re-loads the same skin and atlas, so I made an AssetManager to handle this, I made it load the assets needed for the main menu while it presents the splash screen, and for the game itself while disposing the menu assets and loading the game assets in a transition page similar to the splash screen.

Categories : Android

as3: mouse_move event in full screen mode and mouseLock on slow mouse movements
There is no bug, but the MouseEvent.movementX/Y (alongside with MouseEvent.localX/Y and MouseEvent.stageX/Y) are somewhat misleading... Although they are Numbers, not ints, there is no such thing like "half pixel", so they always reports int values. The precision you're looking for (e.g.: movementX == 0.75) can't be achieved. I couldn't reproduce the behavior you described at the note ("current mouse movement equals to the previous") and here is a working example of Stage.mouseLock = true and Stage.displayState = StageDisplayState.FULL_SCREEN. Note that if you move the cursor very slowly you'll, eventually, receive an MouseEvent.movementX/Y == 1 (when you moved the cursor enough).

Categories : Actionscript

Text doesn't start centered when calling jquery's show('slow') and hide('slow')
You want the fadeIn and fadeOut functions, not the show and hide. This should do it for you. Just replace the relevant code. =] $("#btnShow").click(function() { $("#loading").fadeIn('slow'); }); $("#btnHide").click(function () { $("#loading").fadeOut('slow'); }); http://jsfiddle.net/cpWaa/

Categories : Jquery

Slow Hibernate/C3P0 handling of non-slow Postgres SELECT
I can't be certain this is the cause of your issue, but I think there's a pretty good shot! You have set maxStatements to a value that is way, way too low for the load you are carrying. Try setting maxStatements to zero (turn Statement caching off), or else try setting maxStatementsPerConnection to 20, which I think is what you may have intended. As is, you've set a global max of 20 PreparedStatements to be shared by up to 20 Connections. That's not likely to yield good performance.

Categories : Java

how to position Views on an Android screen relative to the screen edges using offsets in terms of pixel position on the screen coordinates?
You can put a margin to your element to move it away from the edge. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" <!-- move it to the top left corner --> android:layout_alignParentLeft="true" <!-- move it to the top left corner --> android:layout_marginTop="10dp" <!-- move it 10dp down --> android:layout_marginLeft="10dp" <!-- move it 10dp right --> android:text="@string/hello_world" /> </RelativeLayout>

Categories : Android

Python 3: Why are my while loops exiting?
Your loops are all working, but your zcoord() function only prints one loop. The second time zcoord() is called, z is still greater than 1.0 and the loop won't run, and won't print. If you wanted to create nested loops, then it'd be simpler using integers and divide by 10: for x in range(11): for y in range(11): for z in range(11): print('%.2f' % (x/10.0) + ' %.2f' % (y/10.0) + ' %.2f' % (z/10.0)) This can be collapsed into one loop using itertools.product(): from itertools import product for x, y, z in product(range(11), repeat=3): print('%.2f' % (x/10.0) + ' %.2f' % (y/10.0) + ' %.2f' % (z/10.0))

Categories : Python

Mac OS 10.8: apache exiting with code 1
Just to follow up on this for anyone else that might be encountering this issue, it ended up being something amiss in my Virtual Hosts file. After combing through that, there were some syntax issues going on that was, in turn, causing this issue to happen.

Categories : Osx

Get a variable after exiting a while loop
You have the loop in the wrong place. With the loop the way you have it, it will have an opening form tag for every checkbox. Also a good way to get multiple different checkboxes is to set it up as an array. To do those it would look like this: <form class="form-inline" method="post" action="index.php?page=changeto1"> <?php $reponse = db_query('SELECT * FROM messages WHERE value = 0'); while ($donneesmsg = $reponse->fetch()) : ?> <h5><?php echo $donneesmsg['Pseudo']; ?></h5> <p class="text-center text-align"><?php echo $donneesmsg['Message']; ?></p> <label class="checkbox"> <input type="checkbox" name="valider[<?php echo $donneesmsg['id']; ?>]" value="1"&

Categories : PHP

Exiting an application gracefully?
If you have no other design change choices then what you may need is a JVM shutdown hook, which can be added to run a piece of code when System.exit is called. Shutdown Hooks are a special construct that allow developers to plug in a piece of code to be executed when the JVM is shutting down. This comes in handy in cases where we need to do special clean up operations in case the VM is shutting down. You can add a shutdown hook as mentioned here: Runtime.getRuntime().addShutdownHook(Thread) Read more about shutdown hooks here: http://java.dzone.com/articles/know-jvm-series-2-shutdown Word of Caution: We must keep in mind is that it is not guaranteed that shutdown hooks will always run. If the JVM crashes due to some internal error, then it might crash down without

Categories : Java

ShowDialog exiting on certain events
I see such options: don't allow exiting the login dialog (unless together with closing along the whole application) if user exists the login dialog disable the whole main form (set Enabled = false on it's crucial controls and the whole form). Probably except the main menu when you can exit the application or invoke the login dialog again

Categories : C#

Exiting a while loop at EOF using scanf in C
The below code is a simplification of your I/O issues. " %lf " supplies 3 scanf() format directives: 1) white-space 2) double specifier, 3) white-space. The first white-space directive is not needed as the %lf allows for optional leading whitespace. The 2nd white-space directive causes problems as it consumes the Enter key, waiting for additional input. "%lf" supplies 1 scanf() format directives: double specifier This consumes optional leading white-space, including any previous , then scans for and hopefully decodes a double. A (Enter key) following the number is left in the input buffer for the next input (the next scanf()). Now as to why your control Z is failing. It appears your console is consuming the ^Z and performing a "suspend job". My console, instead of giving the

Categories : C

Process often exiting prematurely
Eventually, unable to solve the primary issue, I ended up using NetOffice: NetOffice.WordApi.Application wordApp = new NetOffice.WordApi.Application(); wordApp.Visible = true; NetOffice.WordApi.Document doc = wordApp.Documents.Open(path); which solved the premature closing.

Categories : C#

exiting from javascript function
Replace return false with return and then the console.log after that will be undefined!!! The return exits the function returning undefined. $('#main_submit_button').live('click', function() { check_for_duplicate_rule().done(function(result) { console.log("result from check for duplicate" + result); if (result == 'true') { $('#validation_error').html("A similar rule already exists"); return; } }); //} console.log("i made it this far"); return;//replace return false with return. console.log($('#rule_form').serialize() );//this will be undefined } NOTE:return returns undefined, not false break:for exiting loop

Categories : Javascript

C++ application console not exiting
I'm answering my own question, since nobody else have tried: The problem is that I'm trying to get a frame from the camera using a seperate function. @Aurelius answered the question of sorts, by refering to VideoCapture. By using that function I'm able to cut down the necessary code in the main function - originally I tried to reduce the code in the main function by seperating the framegrabber from the main. Someone more skilled in C++ and OpenCV than myself might be able to give a more correct answer, but here is my solution: #include "opencv2highguihighgui.hpp" #include "opencv2imgprocimgproc.hpp" #include "opencv2corecore.hpp" #include <iostream> #define EXTERNAL_CAM 0 #define BUILT_IN_CAM 1 #define WINDOW_TITLE "Frame" int main() { VideoCapture cap(EXTERNAL_

Categories : C++

Rails S - Exiting and cant figure out why
Austins-MacBook-Pro:omrails silver2002ws6$ /usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:469:in `load': /Users/silver2002ws6/code/omrails/app/models/model.rb:11: syntax error, unexpected keyword_end (SyntaxError) Looks like you may have a syntax error in that file. FYI, having a model named Model is not a good idea. Consider a different name. This particular syntax error may be because you have an extra end somewhere, or are missing an end, or because you have an end but are missing the do. If you post your code we can help more.

Categories : Ruby On Rails

Java getInputStream Read not Exiting
Your server will need to close the connection, basically. If you're trying to send multiple "messages" over the same connection, you'll need some way to indicate the size/end of a message - e.g. length-prefixing or using a message delimiter. Remember that you're using a stream protocol - the abstraction is just that this is a stream of data; it's up to you to break it up as you see fit. See the "network packets" in Marc Gravell's IO blog post for more information. EDIT: Now that we know that you have an expected length, you probably want something like this: int remainingBytes = expectedBytes; while (remainingBytes > 0) { int bytesRead = in.read(buffer, 0, Math.min(buffer.length, remainingBytes)); if (bytesRead < 0) { throw new IOException("Unexpected end of data"

Categories : Java

How to call a web page from android without exiting the app
If you wish to display a web page from within your app, you will need to create a webview. Here is good tutorial

Categories : Android

Pause the user exiting a page
No. This is not possible. At best you can implement an onbeforeunload handler but your options at this point are very limited (you can certainly not 'wait 3 seconds'). Browsers will try to protect the user so this is behavior that browsers enforce and they have incentive to enforce it.

Categories : Javascript

Python: Loop not exiting with "break"
Don't mix tabs and spaces! Here is what I see when pasting your original code into an editor that displays whitespace characters: The arrows are tabs and the dots are spaces, it is very important that you don't mix these because if you do the code that you see might not be what the Python interpreter sees.

Categories : Python

GetLocaleInfo prevents my application from exiting
Second call to GetLocaleInfo overwrites memory, because GetLocaleInfo returns number of chars, and you are using unicode version of Delphi, then you need allocate 2 bytes per char. You can fix it by: GetMem(Buffer, Size * SizeOf(Char)); // SizeOf(Char)==SizeOf(WideChar) on >= D2009

Categories : Windows

exiting setInterval method in javascript
var timerId = setInterval(function(){ if(window.document.drops.isFinished()){ clearInterval(timerId); } },1000); If the if it's not the last thing in the function and you want to "break" the execution, maybe you want to also add a return; statement after the clearInterval.

Categories : Javascript

What is the difference between cancelling and exiting a pthread?
Referring the 1st question in the OP's addendum, verbatim from man pthread_cancel(): When a cancellation requested is acted on, the following steps occur for thread (in this order): Cancellation clean-up handlers are popped (in the reverse of the order in which they were pushed) and called. (See pthread_cleanup_push(3).) Thread-specific data destructors are called, in an unspecified order. (See pthread_key_create(3).) The thread is terminated. (See pthread_exit(3).) The above steps happen asynchronously with respect to the pthread_cancel() call; the return status of pthread_cancel() merely informs the caller whether the cancellation request was successfully queued. After a canceled thread has terminated, a join with that thread using pthread_join(3) obtains

Categories : Linux

Determine where PHP is exiting using code, not debugger
You don't need to add declare(ticks) to all your files. one entry point would be enough: <?php function my_tick() { echo 'tick'; } register_tick_function('my_tick'); declare (ticks=1) { include("lib.php"); echo "1"; test(); } and lib.php: <?php echo "2"; function test(){ echo "3"; } and as you are looking for a code-based solution i assume your sources do provide single entry point.

Categories : PHP

Exiting a function using only basic programming
It's good to have one single return statement in Python (as well as most other languages), but you can have other ones also. Mostly it's about making the code as readable as possible. Here is a sample with one final return in the end: def TargetPlayer(player_number, pHands,sDeck): """User inputs which player they are choosing as the target player, returns target players number""" result = GameOverHands(pHands) if gameoverhands == True: **missing code here** result = gameoverhands else: ShowMessage("TURN: Player " + str(player_number) + ", it's your turn. ") if player_number == 0: ask = raw_input("Who do you want to ask? (1-3) ") while not ask.isdigit() or ask not in "123": etc .... result = "

Categories : Python

Server shutting down when exiting iTerminal
You need to detach the server process from your shell. Your server is a child process of the shell and the system terminates the shell's children when the shell exits. One way to do this is is using nohup and running the process in the background from the shell like this: nohup /your/server/command & nohup becomes the child process and, as its name suggests, it will ignore the hangup (HUP) signal that is normally sent to a child process. The & runs the command in the background so you get a shell prompt back. When you exit the shell the service should still be running as an independent process.

Categories : Amazon

Back button unintentionally exiting app
try this public boolean onKeyDown(int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_BACK: CurrentClass.this.finish(); Intent i = new Intent(CurrentClass.this, MainActivity.class); startActivity(i); return true; default: return false; }

Categories : Java

Talend Open Studio Exiting
Download the source code of your XULRunner package and install it into /usr/local/lib. Open TalendOpenStudio-linux-gtk-x86_64.ini and add the last line as below: for 64 bit machines Code: -vmargs -Xms40m -Xmx500m -XX:MaxPermSize=256m -Dorg.eclipse.swt.browser.XULRunnerPath=/usr/local/lib/xulrunner https://help.talend.com/display/KB/Exception+while+installing+Talend+Studio+on+a+Linux+system Restart your machine

Categories : Java

Exiting a thread that contains a blocking statement in c
Make sure to mask off SIGINT on all your child threads, as signal delivery is to a single, arbitrary thread without the signal masked. This guarantees your "management thread" will get the ctrl-c. Then, use pthread_kill from your management thread to send signals to your other threads using an unmasked signal. This will interrupt your blocking calls and allow you to test flags and such. Read this: http://man7.org/linux/man-pages/man7/signal.7.html especially the section titled: Signal mask and pending signals Use pthread_sigmask to examine and change your thread's signal mask.

Categories : C

Shell script while loop not exiting
There are some quoting issues in your script and the way you are starting the sub shell is invalid syntax. Also you should make sure, that there is no trailing whitespace or other characters: #!/bin/bash status="false"; # quote the "true" while [ "$status" != "true" ] do # use $(...) to start a sub shell status=$(wget -q -O - http://server) # add >> << to make extra space visible. use quotes echo ">>$status<<" echo "Sleeping for 5 sec"; sleep 5; done

Categories : Bash

bash while loop not exiting and not echoing
Your comparison for _$INPUT is a string, then you need ==. If comparing integers, you need -eq. Also double quote the $_INPUT variable for strings if they might contain white spaces or meta characters. #!/bin/bash function exec_do(){ while [[ 1 ]]; do read _INPUT if[ "$_INPUT" == "exit" ]; then break else echo $_INPUT fi done } exec_do

Categories : Linux

How do you save your undo history in VIM after exiting?
You can't. Vims persistent undo was introduced with version 7.3. There exists an unofficial patch to make use of persistent undo using vim 7.2, but several bugs in persistent undo mode have been fixed since the release of vim 7.3

Categories : Vim

Most reliable way of exiting out of a function on a failed try
Generally, always catch specific errors you know will occur. Especially if you catch everything, (That is, except:) you will catch KeyboardInterrupt and make your program not be stoppable by Ctrl+C; SystemExit that is used to kill a thread, and so forth... While catching Exception is slightly better, it will still lose too much context; the exceptional condition that occurs might be other than you expected. Thus always catch IOError, ValueError, TypeError and so forth, by their names. Update There is 1 case where you want to use except Exception; at a top level of a program, or an action where you want to make sure that the whole program does not crash due to an uncaught Exception.

Categories : Python

Python multiprocessing exiting cleanly
Seem to have found a way to do this, but am unsure about whether this is the best approach to take. from daemon import runner from multiprocessing import Process, Queue, Event import telnetlib from django.utils.encoding import force_text from observations.weather.models import WeatherStation import os import signal import errno os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' def read_weather_data(name, ip_address, port, queue, exit): print "Started process to get data for", name client = telnetlib.Telnet(ip_address, port) while not exit.is_set(): response = client.read_until(' '.encode('utf8')) queue.put((name, force_text(response))) print "exit called for", name client.close() def exit_handler(signum, frame): print "exiting..." class

Categories : Python

Prevent text selection from exiting a div
Seems like you might want to be able to click on this div and copy it's text contents to your clipboard. Here is a stackOverflow about copying to clipboard. The best explanation was here.

Categories : Javascript

Why am I receiving a "thread exiting with uncaught exception”?
The error comes from your code line 23 in the SerializacionDeDatos class. You are invoking a method on an object that has not been initialized yet - meaning you created a variable for an object, but did not use the "new" operator to create the object or the initialization returned null. This line could probably the problem if "filename" is not valid. fos = openFileOutput(filename, Context.MODE_PRIVATE); Onfortunately there are no line numbers in your code snippet, so I cannot tell where exactly the error comes from.

Categories : Android

Java concurrency. Block application from exiting
public synchronized void unlockExit(Object o) { l_Exit.remove(o); if (l_Exit.isEmpty()) { l_Exit.notifyAll(); } } You need to be in a synchronized block in order for Object.wait(), Object.notify() or Object.notifyAll() to work. public synchronized void unlockExit(Object o) { synchronized (lock) { l_Exit.remove(o); if (l_Exit.isEmpty()) { l_Exit.notifyAll(); } } } See this question for clarification so as to why.

Categories : Java

Exiting a program after a certain amount of time - Java
The driver class may be modified to adjust the wait time that you are having trouble with. It should look something like this: WebDriver driver = new FirefoxDriver(); driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS); You could adjust the time to whatever you want, but be warned that reducing it too low may cause other issues, for example if the page is simply taking a little longer to load, it will timeout prematurely. Source: WebDriver: Advanced Usage -- Selenium Documentation

Categories : Java

Android - when exiting a WebView, the audio still keeps playing
You should call through to the WebView's onPause() and onResume() from your Activity's onPause() and onResume(), respectively. Pauses any extra processing associated with this WebView and its associated DOM, plugins, JavaScript etc. For example, if this WebView is taken offscreen, this could be called to reduce unnecessary CPU or network traffic. When this WebView is again "active", call onResume(). There's also pauseTimers(), which affects all of the WebViews within your application: Pauses all layout, parsing, and JavaScript timers for all WebViews. This is a global requests, not restricted to just this WebView. This can be useful if the application has been paused.

Categories : Android



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.