w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
Executing Fabric python code on windows 7
Fabric requires Python version 2.5 or 2.6. Fabric has not yet been tested on Python 3.x and is thus likely to be incompatible with that line of development. It's not so simple to install Fabric on Windows, because it uses some specific C libs that needs to be compiled. Try next in Windows: pip install fabric # Failed! easy_install fabric # Failed again! But if you don't want to install Visual Studio or Cygwin and compile the C code so I will consider another way, more simple. As I have figured out, Fabric needs next Python libs to be installed on Windows: PyCrypto PyWin32 Both requires compilation OR may be installed from the pre-built binary packages (my choice!): PyCrypto: click here PyWin32: click here Download and install these two and you will be finally able to do: pip inst

Categories : Windows

Executing Tkinter Code Successfully (Python 2.7)
It appears that you have some indentation issues. Python isn't free form, so you need to pay attention to indentation: from Tkinter import * class App(Frame): def __init__(self, master): Frame.__init__(self, master) self.grid() self.create_widgets() def create_widgets(self): self.entryLabel = Label(self, text="Please enter a list of numbers (no commas):") self.entryLabel.grid(row=0, column=0, columnspan=2) self.listEntry = Entry(self) self.listEntry.grid(row=0, column=2, sticky=E) self.entryLabel = Label(self, text="Please enter an index value:") self.entryLabel.grid(row=1, column=0, columnspan=2, sticky=E) self.indexEntry = Entry(self) self.indexEntry.grid(row=1, column=2) self.

Categories : Python

Emacs Org Mode: Executing simple python code
There are two ways of getting the result of a source block - output and value. You mixed them up, hence the troubles. First block is fine. To fix the second block: #+begin_src python :results value return 1+1 #+end_src To fix the third block: #+begin_src python :results output print 1+1 #+end_src When output mode is value you must return. Just putting it there like you did with 1+1 won't do. In the third one you want the result to be printed output, but your default session setting is value(mine defaults to output btw). And this bit about org-confirm-babel-evaluate is kind of irrelevant to the question. I just have it set to nil.

Categories : Python

jquery code not executing from script, but executing from dev panel
The click handler you've shown is bound to any ".maintypedata img" elements that exist when that code runs. But, the img elements in question are appended to the document dynamically after the "Bamboo" option is clicked. So you need to either run that .click() code after the elements are appended (which is what you were doing by running it from the console) or change it to work as a delegated event handler: $(".maintypedata").on("click", "img", function() { console.log("test"); if(open == false) { var src = $(this).attr("src"); $(".popup").html("<img src='"+src+"'/>"); open = true; $(this).addClass("selected"); $(".popup").slideFadeToggle(function() { });

Categories : Javascript

Python thread timer, not executing or executing instantly
You lost all the indentation in your code snippet, so it's hard to be sure what you did. The most obvious problem is responseTimer.start. That merely retrieves the start method of your responseTimer object. You need to call that method to start the timer; i.e., do responseTimer.start(). Then it will produce the output you expected, with a delay of about 2 seconds before the final "timeout!" is printed.

Categories : Python

How to let the program to to show the Gui Code before executing the next line of code in GWT?
You can set the label to the loading text, then you use the GWT Scheduler (http://www.gwtproject.org/javadoc/latest/com/google/gwt/core/client/Scheduler.html) Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { for (int i = 0; i < cities.length; ++i) { citiesOracle.add(cities[i]);} infoLabel.setText("data was loaded"); } } }); JavaScript (in a browser) is single threaded, so your label changed is queued to be updated after the click event. Using the Scheduler makes the browser able to process the label change before the loop. EDIT: This resource gives a better example how to use the Scheduler to execute long, CPU intensive processing, without triggeri

Categories : Gwt

working in python console while executing a boost::python module
You have two options: start python with the -i flag, that will cause to drop it to the interactive interperter instead of exiting from the main thread start an interactive session manually: import code code.interact() The second option is particularily useful if you want to run the interactive session in it's own thread, as some libraries (like PyQt/PySide) don't like it when they arn't started from the main thread: from code import interact from threading import Thread Thread(target=interact, kwargs={'local': globals()}).start() ... # start some mainloop which will block the main thread Passing local=globals() to interact is necessary so that you have access to the scope of the module, otherwise the interpreter session would only have access to the content of the thread's scope.

Categories : Python

More compact "if...else if" when executing same code
If value of that variable changes between I call triggerControls() and function's execution (microsecond?) No. While your script is executing, nothing else will change that variable - JavaScript is single-threaded. Unless triggerControls does something asynchronous and expects the value to be the same in a future turn of the event loop, everything is fine. I could've written both scenario checks in one if just by using || as I am executing the same function. Except for being messy and making the code largely unreadable why shouldn't I do just that? I don't see a reason not to do that. It's not messy to avoid repetition (but dry), and I wouln't consider it unreadable. You even might use the ternary operator to shorten (and optimise) it: if (controlsVisibility ? currentScro

Categories : Javascript

What happens when we try to set the register of the currently executing code?
According to the Intel manual, you get an "undefined opcode" exception: mov — Move { Protected Mode, Real-Address Mode, Virtual-8086 Mode, 64-Bit Mode} Excpetions #UD If attempt is made to load the CS register.

Categories : Assembly

error while executing following c# code
If you read the error, it tells you the problem: OleDbCommand upcmd = new OleDbCommand( "delete from CompanyDetails where [CompanyID] not in " + "(Select [CompanyID] from EmployeeDetails where [CompanyID] = @cmpID)", conn); You had a ( but no matching ) at the end.

Categories : C#

PHP include not executing code
Is your tracking script echo "<!-- This is the file -->"; or is it <?php echo "<!-- This is the file -->"; ?> Because without the php tags, there's a good chance that your require call actually makes PHP go "this is not actually a PHP file and as such I cannot require it" but with the error/warning repressed due to whatever error reporting settings are active when you run the code.

Categories : PHP

Executing code when a tab is shown
Try it in SelectedIndexChanged event , private void yourTabControl1_SelectedIndexChanged(Object sender, EventArgs e) { textBox1.SelectionStart = textBox1.Text.Length; textBox1.ScrollToCaret(); textBox3.SelectionStart = textBox3.Text.Length; textBox3.ScrollToCaret(); textBox2.SelectionStart = textBox2.Text.Length; textBox2.Focus(); }

Categories : C#

$.post not executing at certain places in code
$.post is asynchronous as has been stated in the comments but even then you are calling $.post to your server multiple times without having changed any of the parameters of it. This means you are queuing up multiple duplicate ajax requests to your server which may return different responses depending on when they are processed. This will result in inexplicable results in some cases. to simplify your current code you could do $.post('loadData.php',{fileName : 'box1.xml'}, function(xml) { for(var i = 0; i < $("#canvas .active[target]").length; i++){ $('#galleryStatus2').append(xml); debugger; } } ); This will call the php script once and then populate $('#galleryStatus2') with the xml as many times as there are $("#canvas .active[target]

Categories : Jquery

Executing code when a function is complete
Use a callback? function executeMyAnimationFunction(complete){ $('div').animate({ height: '1px' }, 500, complete); } Call it like this: executeMyAnimationFunction(function(){ console.log('animation complete'); }); Or if you insist on using promises: executeMyAnimationFunction(){ var dfd = $.deferred(); $('div').animate({ height: '1px' }, 500, function(){ dfd.resolve(); }); return dfd.promise(); } executeMyAnimationFunction().done(function(){ console.log('animation complete'); });

Categories : Javascript

JavaScript code not executing in browser
2 things, one is definitely breaking things and the other is just a syntax error. You are missing: <script type="text/javascript" src="jscript.js"></script> in MyIndex.html. Include it right after the <script>...</script> tag that includes jQuery*. This tells the browser where your JavaScript file is, just like including your stylesheet in that link element. The }(); should be }); in the 4th line of your jscript.js file. *Note: You could instead include your jscript.js file right after your <div ID="contact">Hello</div> before the end of your body tag. Either place will work, you simply must place it after the jQuery. But including it within the body tag after all your HTML elements speeds up the rendering of the page slightly, because the brows

Categories : Javascript

Stop returning to executing code
Assuming the problem is really what you described, then there are two things you could do (together) to address it: When you send an ajax request, you store the reference to that request. When you receive another keyup, cancel that ajax request. When you start executing the onEnter handler, set some variable to indicate that auto-suggestions are no longer needed. In the auto-suggest handler, after your ajax returns, only show the suggestions if that variable is not set. Essentially, your code structure would be like this (note that this is pseudocode and is not meant to be copied into your application): var ajaxReq == null; var needSuggestions = true; $('#textfield').on("keyup", function(e) { if(ajaxReq != null) { ajaxReq.abort(); ajaxReq = null; } if(k

Categories : Javascript

executing block of code atomically
I believe that the expected answer was something like this: public class A { public void foo() { // .. some code doSomething(); // the critical part // .. come code } public synchronized void doSomething() { // this is a synchronized method // the critical code } } The execution of doSomething() is not really atomic (Disclaimer: it's very different from atomicity), but the synchronized keyword ensures that only one thread can enter the execution of this method (on one instance). I think that is what they meant instead of atomicity. Here is another question about atomicity in Java. You may find something useful in there.

Categories : Java

Trouble with Code Executing After startActivity()
What you are looking for is startActivityForResult(Intent intent, int requestCode) By calling startActivityForResult(Intent intent, int requestCode), you also need to: @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); switch (requestCode) { case REQUEST_CODE_YOU_USED_IN_STARTACTIVITYFORRESULT: switch (resultCode) { case Activity.RESULT_OK: Log.d(TAG, "Result OK"); // Your code after "that Activity" is finished. break; } break; default: break; } } And then at that Activity, you need to: setResult(RESULT_OK); to let the calling activity know the result.

Categories : Android

code in try / catch blocks not executing
You have to close stream after use using out.close() to force flush before reusing it with in variable. EDIT: (copied from my comment) The file is created when you close it due to buffering caused by BufferedInputStream

Categories : Java

jQuery - How is this code executing without scroll?
Sorry, I can't tell exactly but you might try adding alert('scrolling'); at the top of your event handler to debug. This will pause the page load as soon as the event first fires and give you more clue as to when the page thinks it is being scrolled. This might uncover what's causing it. But yes, you are correct in thinking that a .scroll is not triggered on page load.

Categories : Jquery

In this code, why is the second loop executing slower than the first one?
That difference has no sense, as 6348 / 688721824295 aprox 9-E9. That is, less than a 1-E6 %. Anything could cause the difference, from the OS processing a thread from another process or the antivirus kicking it or a cosmic ray causing interference. It is like asking why car A makes a route in 1 hour and another makes it in 1 hour and 1 millionth of a second.

Categories : Java

Executing code when my form is closed
I think that what you need is not access to the close button, but rather access to the event which is fired when the form is closed. Taken from this previous SO post, what you might need is something like so: void FormClosed(object sender, FormClosedEventArgs e) { // do something useful }

Categories : C#

onreadystatechange results in php code executing twice
Try an else for the if(xmlhttp.readyState == 4 && xmlhttp.status == 200) statement to see if there's another state that the ajax call goes into before readystate 4. Maybe just put alert(xmlhttp.readyState); in the else and see what happens.

Categories : PHP

Executing SAS Code from string in dataset
2 ways to do it: Use call symput in a data step to put it into a macro variable. You then put the macro variable where you want the code to execute. (take into account the caveats of when SAS interprets and executes what) Use call execute in a data step. Note that all the code entered into a call execute is accumulated during the data step and then interpreted and executed immediately after the data step. For call execute, see: http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/viewer.htm#a000543697.htm

Categories : Sas

JavaScript code executing after return
No, the code shouldn't output 2 because variable declarations are hoisted so your code is equivalent to var x = 1; (function() { var x; x = 2; // changes the internal x variable return; x = 3; // does nothing because it's not reached })(); console.log(x); // Outputs the outside x, which is still 1 The line x = 2; only changes the internal x variable which shadows the outside one. The scope of a non global variable is the entire function in which it is declared. From the start of this function to its end.

Categories : Javascript

Executing code after construction of class object
Classes already register what subclasses are defined; call the class.__subclasses__() method to get a list: >>> class Monster(object): ... pass ... >>> class Lochness(Monster): ... pass ... >>> class Yeti(Monster): ... pass ... >>> Monster.__subclasses__() [<class '__main__.Lochness'>, <class '__main__.Yeti'>] .__subclasses__() returns a list of currently still alive subclasses. If you ever would clear all references to Yeti (del Yeti in the module, delete all instances, subclasses, imports, etc.) then it'd no longer be listed when you call .__subclasses__(). Note that in essence, .__subclasses__() is a CPython implementation detail, but the method is present in all Python versions that support new-style classes (2.2 and up,

Categories : Python

Why am I getting a NullPointerException with this code that's executing a prepared statement?
You have this condition: if(r.equals(name.size())) That appears to be problematic since you earlier initialize r as: String r = name.toString(); How can size of an ArrayList ever be equal to the same ArrayList's toString()? I believe this condition is always failing (returning false) and your ps.executeBatch() never gets called.

Categories : Java

Simple code in C++ compiling but not executing in Linux
Because infinite loop, in second for loop you have misspelled == : for(int i=1;i=product;i++) ^ should be == Side note: To minimize such kind of bugs in you code I would suggest you to keep space in expression e.g. an expression i=product should be written as i = product, so that its readable. similarly you should add space after ; and ,.

Categories : C++

Executing simple code on android app before closing
You need to edit your code, like this: @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if ((keyCode == KeyEvent.KEYCODE_BACK)) { if(mWebView.canGoBack()) { mWebView.goBack(); return true; } else { //Your webview doesn't have any history here and you can close your app here. //You can also execute your Airpush code here. airpush.startLandingPageAd(); return true; } } return super.onKeyDown(keyCode, event); } I hope this helps.

Categories : Java

How to know the current OS / platform of the executing code (Android / iOS)
Using reflection, try to retrieve the value of the Monotouch.Version property (and the equivalent for MfA: Android.OS.Build.VERSION). One of the calls will fail, the other should succeed; that's why you have to use reflection. That's for a real runtime check. But as your app is compiled twice, you can fix that value at compile time. #if MONOTOUCH var platform = "iOS" #else var platform = "Android" #endif

Categories : C#

javascript confrmation box, executing code behind only if clicked yes
Try this function Refresh() { var myBoolean = new Boolean(); if (confirm('Are you sure?')) { window.onunload = refreshParent; function refreshParent() { window.opener.location.reload(); return true; } } else {return false;} }

Categories : C#

Code synchronization - prevent a block from executing
Here is a simple way to achieve that. BOOL _firstToAttempt; // in a scope all threads can access ... _firstToAttempt = YES; // before any of the threads start ... // when a thread is ready to download BOOL shouldDownload = NO; @synchronize (self) { if (_firstToAttempt) { _firstToAttempt = NO; shouldDownload = YES; } } if (shouldDownload) [self downloadFile]; Make sure you are using the same object for @synchronize. self might be different objects for different threads depending on your implementation. If that is not convenient just use NSLock.

Categories : IOS

Ruby - Executing same code after most methods in a class
What about this? It has a major drawback which is that your methods must be already defined before calling check_error_code, but it may suit your needs. You could look for inspiration for a better solution in Rails callbacks, or defer the redefinition of each method until that method is added using the method_added hook. Include ErrorCodeChecker and call check_error_code in each class you want to check the error code (as in the last line of the snippet). module ErrorCodeChecker def self.included(base) base.send(:extend, ClassMethods) end def after(result) # this is the method that I'd like to be added to most methods puts "ERROR CODE: #{result[:ec]}" end module ClassMethods def check_error_code(options = {}) check_on = instance_methods(false) - Array(options

Categories : Ruby

php code not executing. Checked config files already
Check your MS SQL Connection and use $_GET['Username'] in place of $_GET(USERNAME) $query = "SELECT COUNT(*) FROM Users WHERE Username='".$_GET['Username']."'";

Categories : PHP

executing perl code from commandline in windows
when you execute: perl -e "$number=30;" perl -e "print $number;" these are two independent processes, so they don't share information. Variable $number won't be available to the second command. The other one: perl -e "$number=30; print $number;" Works because it runs in the same execution, and $number is visible to the next print sentence

Categories : Perl

Linux Shell-Script code is not executing as it should
Two things that are wrong in your program: Line No. 8 - You are calling your array arr[] but later referring it as a[] . Change one of the names to match the other. Line No. 10 - There is no $n in your program. You mean $size. Change this as well. I think your program should work after this.

Categories : Linux

Executing initialization code before java_import in JRuby?
Methods get called when they get … well … called. If you call initialize before you call java_import it will execute first, if you call it after java_import it will execute after java_import. If you want to call initialize before you call java_import, you need to call initialize before you call java_import.

Categories : Ruby

Code stops executing for no apparent reason
I would strongly suggest using windbg to determine what's going on here - if you haven't used it before it can be a bit daunting but there's quite good tutorials (particularly from Tess see here) Once you've got windbg installed get a process dump via task manager when the hang occurs Open the dump file in windbg Then run .symfix c:sos to fix the symbol path Next load sos .loadby sos mscorwks Finally to check for an exception on any thread run .foreach (ex {!dumpheap -type Exception -short}){.echo "********************************";!pe –nested ${ex} } Give this a try & see how you get on

Categories : C#

Executing jQuery dialog associated to class from code behind
I finally figures this one out. It is actually quite simple to achieve. I thought I'd share it, in case anybody else faces the same proble. The final solution is as follows: The javascript functions to initialize/show/hide the dialogs is exactly as shown above Add 2 buttons; each button will raise one of the dialog boxes The HTML to create the DIVs that are used as content for the dialog box is as follows: <div id="ThisIsATest1" class="FadingDialog" title="Dialog Box Example 1"> This is a test </div> <div id="ThisIsATest2" class="FadingDialog" title="Dialog Box Example 2" data-idButton="btnDialog"> This is another test </div> From code behind for each button, use the following sentence: Page.ClientScript.RegisterStartupScript(Me.GetType(), "Popup"

Categories : Jquery

make ant stop executing on exit code 1?
<exec> task has failonerror to make the task to stop the build when the external command exits with an return code indicating error. It also has resultproperty to save the return code to a property so that you can do more conditional checking later. However, it's only of interest when failonerror isn't set to true. See <exec> task's manual: http://ant.apache.org/manual/Tasks/exec.html

Categories : Ant



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