w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How to figure out the 'Public DNS Name' from within an Amazon EC2 instance?
Take a look here, but use public-hostname instead of instance-id.

Categories : Windows

Instance variables set in callbacks being set multiple times
Try this def set_attributes if third_party_attribute.nil? self.third_party_attribute = <MAKE THIRD PARTY FUNCTION CALL> end end Notice that the condition is if third_party_attribute.nil? instead of self.third_party_attribute.nil? Refer this

Categories : Ruby On Rails

How do I restrict my chrome app from being opened multiple times (so just one instance)?
Create the window with an id and as a singleton. See the chrome.app.window documentation. E.G. modify the hello world sample to create the window with chrome.app.window.create('index.html', { id: "", // Even an empty string is sufficient. singleton: true,

Categories : Google Chrome

How to reproduce figure through a previously saved figure handle?
If the graph is still open, you can get the Xdata, Ydata and Zdata by using: XYZCell=get(get(get(h,'currentaxes'),'children'),{'xdata','ydata','zdata'}); Or if you don't want a cell: XData=get(get(get(gcf,'currentaxes'),'children'),'xdata'); YData=get(get(get(gcf,'currentaxes'),'children'),'ydata'); ZData=get(get(get(gcf,'currentaxes'),'children'),'zdata'); If the graph is closed, h is useless - as far as I'm aware there is no way to reform a graph from a closed figure handle. Why not use save your variables first? I1=d1; I2=d2; I3=d3; scatter3(d1,d2,d3,'.');

Categories : Matlab

change figure size and figure format in matplotlib
The first part (setting the output size explictly) isn't too hard: import matplotlib.pyplot as plt list1 = [3,4,5,6,9,12] list2 = [8,12,14,15,17,20] fig = plt.figure(figsize=(4,3)) ax = fig.add_subplot(111) ax.plot(list1, list2) fig.savefig('fig1.png', dpi = 300) fig.close() But after a quick google search on matplotlib + tiff, I'm not convinced that matplotlib can make tiff plots. There is some mention of the GDK backend being able to do it. One option would be to convert the output with a tool like imagemagick's convert. (Another option is to wait around here until a real matplotlib expert shows up and proves me wrong ;-)

Categories : Python

Unable to save matplotlib.figure Figure, canvas is None
One of the things that plt.figure does for you is wrangle the backend for you, and that includes setting up the canvas. The way the architecture of mpl is the Artist level objects know how to set themselves up, make sure everything is in the right place relative to each other etc and then when asked, draw them selves onto the canvas. Thus, even though you have set up subplots and lines, you have not actually used the canvas yet. When you try to save the figure you are asking the canvas to ask all the artists to draw them selves on to it. You have not created a canvas (which is specific to a given backend) so it complains. Following the example here you need to create a canvas you can embed in your tk application (following on from your last question) from matplotlib.backends.backend_

Categories : Python

Can't figure out how to get rid of a graphic when I figure hit a button
Rather than creating the objects to be painted within the paintComponent method itself, maintain a collection of objects that are to be rendered and loop through that collection each paintComponent call. Then "destroying" the P2 object is done by simply removing from the collection.

Categories : Java

Running only one instance of an application,(Quit new instance and Display old instance or give Focus)
What you need to do is to add this to your main class: [DllImport("user32.dll")] static extern bool SetForegroundWindow(IntPtr hWnd); Then you need to obtain a reference to the process that is already running, and then call the SetForegroundWindow method like this: SetForegroundWindow(SameProcess.MainWindowHandle); You do not need to kill the current process like you are currently doing, just return after focusing the other process' main window as shown above This is a full working example: [DllImport("user32.dll")] static extern bool SetForegroundWindow(IntPtr hWnd); /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { var currentProcess = Process.GetCurrentProcess(); foreach (Process p in Process.GetP

Categories : C#

certain div styles unresponsive
Try adding position:absolute;top:100px; (or however many pixels are needed) to your button's CSS to move it to the location you want it. Try this: #services .get-started { clear: both; font-family: nevis-webfont; padding:8px 18px; background:#52c0a3; color:#fff; border: 1px solid #fff; font-size: 14px; -webkit-border-radius: 2px; -moz-border-radius: 2px; border-radius: 2px; position:absolute; top:100px; }

Categories : HTML

Qt on OSX Unresponsive widgets
So you're all aware this was fixed by upgrading to Qt 5.1.0 beta. I cannot explain why it just works when using a new version and not with an older version. My own code between the two is identical.

Categories : C++

Unresponsive accelerometer data
I have fixed all accelerometer issues by switching from using UIAccelerometer to CMMotionManager. I am still unsure why what caused the issue but getting the accelerometer data from CMMotionManager seems to have resolved any problems.

Categories : Iphone

Unresponsive UI when launching a Task
Here is how I accomplish it. Basically, I start a new task, and put a listener on that task for successful completion. The costingService is an interface hibernate connection (via glassfish) to a MS SqlServer DB. The listProducts method on that interface returns all of the products in the database. loadTask contains the results of the database query when the task completes. The pricingProductTableList is the ObservableList of the query results, and the pricingProductTable is the TableView that displays the data. Here's the code: private ObservableList<Product> getProductList() { logger.info("Entering {}.getProductList", this.getClass().getName()); if (costingService == null) { return null; } final Task<ObservableList> loadTask = new Task<Ob

Categories : Java

Android Studio becoming unresponsive
I have found that closing and restarting Android Studio solved that problem. In my case it became sluggish after about one week of intensive use without ever closing it. At first I thought it was because my app had grown too complex... The problem is probably caused by some memory leak inside Android Studio. After a restart it became ligthning-fast again.

Categories : Android

ActionbarSherlock unresponsive in Android 2.3.3
Actually I found out I already asked this question some time ago and theres a workaround to be found as an answer.

Categories : Android

multiprocessing with wxPython is unresponsive
Make absolutely sure that there is no GUI interaction in the thread - nor direct thread interaction in the GUI. The GUI can call setter functions in the thread that change member values that the thread checks periodically and the thread can cause GUI results by posting events, with additional data. One of the lovely features of wxPython is that custom events can carry any type of data for you. As one of the features of Queue is that if the slots are full it will hang and while your GUI is acting on things like menu clicks you will not be servicing your queue I suspect you are overflowing - you should be catching the Full exception and doing something like discarding the data and setting a data lost flag.

Categories : Python

c# application becomes unresponsive when loading an image
I think your problem is here: for (long i = startpos; i < startpos + length; i = i++) It should be: for (long i = startpos; i < startpos + length; i++) i=i++ is not actually incremeting the variable You can find why here: i = i++ doesn't increment i. Why?. Thanks to @RenniePet for the link.

Categories : C#

How can one find out more information when a JVM becomes unresponsive to SIGQUIT?
You can't, this is why it's called "hang". JVM process is unresponsive due to internal issues (e.g. infinite loop, deadlock...), so it won't respond. This could be due to a bug in the JVM implementation. You can try to debug the JVM to find out what's happening. HotSpot is GPL so you can get the source code as well. If you suspect something in your code is causing this hanging (for example, JVM always hangs when you perform a specific operation), you can paste it so we can take a look.

Categories : Java

Submit button becomes unresponsive after modifying DOM
In my autocomplete_init method I have $(document).click(hide_list), and the method hide_list was not returning anything (nor was it preventing default or stopping propagation). I added return true to this method and the problem was fixed.

Categories : Jquery

NodeJS using node-serialport sometimes becomes unresponsive
I had an issue with my code in that the serialport.write command would fail after 3 attempts. It looked like the issue was that my serialport.write function waits for a response after the write . However I also have some synchronous code..(console.log) which cannot be executed as the callback response function will not run until the action triggered by the serialport is ran. This seems to confuse nodejs, seems you cannot mix async callbacks and sync code in the same routine global.serialPort.write("a", function(err, results) { console.log('results ' + results); }); console.log('completed'); Removing that last line meant that routine worked. Take a look at your code and see if you have that mixture

Categories : Node Js

Why is MongoDB unresponsive during a load test?
Fixed it: sudo sysctl net.ipv4.tcp_tw_reuse=1 Then, restart mongo. Alternatively, you can add it to /etc/sysctl.conf (so it will be run on reboot): net.ipv4.tcp_tw_reuse=1 Then run this to reload (without having to reboot) sudo sysctl -p /etc/sysctl.conf This "fix" will disable the timewait state for TCP sockets (server-wide). So, it's really not a fix at all. However, until mongo reduces their timewait state using SO_LINGER, a large number of server sockets will pool up in the TIME_WAIT state and remain unusable for new connections. You can see the count of connections in TIME_WAIT with this: netstat -an | grep TIME_WAIT | wc -l With that, I was able to see it fail at around 28k TIME_WAIT connections. Using this kernel flag: sysctl net.ipv4.ip_local_port_range="18000 65535"

Categories : Mongodb

Javascript Unresponsive Script Error
Sounds like the problem is that there's too much data to present. You can try using a speedier browser (Chrome usually works pretty fast), limiting the data, or trying another charting library. Limiting the data is probably the most likely one to work. If you need to show all the data, the best way to go about it would be to only load partial data and then if the user for example scrolls the chart, load the missing data. Another way to present more data at the same time would be to calculate averages for the data on server. For example, if the ticker data is from every second, you could pre-calculate hourly or even daily averages on the server. This generally allows you to show a relatively accurate chart without causing performance problems, and many libraries also support dynamically

Categories : Javascript

C# Form is unresponsive when scanning for files
You need to use a BackgroundWorker or something similar. Your form is unresponsive because your doing the main job in the same thread as the user interface, that's why it's not responding. If you want to update your user interface during the process of searching for files, you'll also need to use Invokes to change values

Categories : C#

Unresponsive script error in all browsers
You had used the RECURSION here.. The function changeTextAdd is called by itself at the line of $(".awp_class_horizantal span").html(''); $(".awp_class_horizantal").click(function() { changeTextAdd(this.id); // Here is your Recursion of the same function }); And the click event Handler is Rebound Infinitely inside the function.. Please check and go through about "Recursions"

Categories : Jquery

gedit unresponsive how to save my file?
gedit will create a backup file called filename~ in the same folder as the edited file. It will contain the contents before last save. If you have saved the file during edit it may contain at least a part of the contents

Categories : Linux

while loop unresponsive java when receiving option
Whenever something returns -1 it usually means that the object is not existing or it is not there. Are you sure that you did not forget to initialize the Object/Variable you need? In debug mode, Netbeans do a lot of work for you(even initializing something) which is not done when code is compiled and executed without IDE.

Categories : Java

Printing a report make Apache unresponsive
buf.close() is missing; input.close() not needed then. At the moment a bit unsure whether stream.close() not is contra-indicated - but it works. You could try con.close(). Tip: response.setHeader("Content-Length", String.valueOf(rtf.length())); Files.copy(rtf.toPath(), stream); The last is a Java 7 utility to copy a file to a stream, replacing the byte wise reading, which even with BufferedInputStream is not optimal.

Categories : Java

Chrome sometimes becomes unresponsive on clicking a button on my website
I would firstly start looking at your server logs to verify that this is a client based problem rather than bad parameters. Then verify that HTML/JS is correctly formed and has no errors. Lastly I suggest to you to use Chrome Developer Tool (Right click) and to choose the profiling tab to collect JS CPU Profiling.

Categories : Java

cocos2d unresponsive scene after opening for the second time
I have had something similar, there were two solutions I found: Quick and Dirty is to create the preferences scene instance as you need it (lazy loading), this will reduce memory of keeping it around unless you need it, but you will have to initialize it each time, however it should be new clean copy each time, and if the user doesn't click preferences every time probably faster to load the whole game. Make sure the preferences scene cleans itself up before it disappears, this especially means stop all Scheduled selectors or interval timers and remove delegates and touch events.

Categories : IOS

Server unresponsive during long running script
This explains threading in iis6 & 7. In essence, a new thread deals with each new incoming request. Therefore having a individual page sleep for some amount of time will have no effect on the processing of other pages. I tested this using 2 pages. page.aspx: <%@ Page Language="C#" %> <%=DateTime.Now.ToString() %> index.aspx: <%@ Page Language="C#" %> <%=DateTime.Now.ToString() %> <% System.Threading.Thread.Sleep(10000); %> Having called index.aspx, page.aspx can be called repeatedly & returns the current time every request, whilst the first request to index.aspx is sleeping. If something is causing requests to block on your server, it could be a shared resource used across your site. in the example above, if index.aspx requested exclusive acces

Categories : PHP

Ajax setInterval causing browser to be unresponsive
The request might take more than 3 seconds to execute thus stacking the requests until the browser cannot handle it all and crash... Instead of using an interval, you should use a timeout that will execute the request 3 seconds AFTER the last one finished. Here: <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>Ajax - one variable test</title> <style> body{ font-size: 12px; font-family: Arial;} </style> <script src="http://code.jquery.com/jquery-1.10.2.js"></script> </head> <body> <ol id="variable1"><var1></ol> <script> function doRefresh() { $.ajax({ url:"ajax_v00.html", success:function(data){ $("#variable1").html(data); setTimeout(do

Categories : Jquery

“Unresponsive Script" on close of Windows Form
Try using GeckoPreference to set dom.max_script_run_time to a larger value than default or to 0 to disable it. GeckoPreferences.User["dom.max_script_run_time"] = 0; Ensure you do this after your call to Xpcom.Initialize.

Categories : C#

Android Traceview - It holds the Answers to my Unresponsive App... I think
I find Traceview can be boiled down into a couple simple concepts: Those concepts are not the best, IMHO. Sort by "EXCL CPU TIME" to determine exactly how much usage each individual method is using in isolation In particular, this concept is fairly lousy IMHO. Yes, this is useful data. However, you then need to work back up the call stack to try to figure out what is triggering this. Sometimes, it will directly be your code. Sometimes, it will be something else that you recognize that is part of the framework (e.g., onDraw() of a View). Just knowing that some random method is taking up a bunch of time does you no good until you identify what is triggering that method to be invoked in the first place. If I run a Traceview, and if I find the top hogs of resources are all syste

Categories : Android

Link Scraping with requests, bs4. Getting Warning: unresponsive script
The issue might be either long loading times of a site, or a cycle in your website links' graph - i.e. page1 (Main Page) has link to page2 (Terms of Service) which in turn has link to page1. You could try this snippet to see how long it takes to get a response from a website (snippet usage included). Regarding your last question: I'm pretty sure requests doesn't parse your response's content (except for .json() method). What you might be experiencing is a link to a resource, like <a href="http://www.example.com/very_big_file.exe">Free Cookies!</a> which you script would visit. requests have mechanics to counter such case, see this for reference. Moreover, the aforementioned technique allows checking Content-Type header to make sure you're downloading pages you're interested i

Categories : Python

Regular link with padding unresponsive in mobile browsers
Ok, got it figured out. It was actually because there was a JQuery-based slider, on a different part of the page, that had a touchenabled setting (which allows the user to go through the slider by swiping). This was affecting the button's response to touch. Once that touch setting was turned off, the buttons everywhere respond as normal. Thanks for all the help and suggestions. You guys rock.

Categories : CSS

Azure cloud service becomes unresponsive when instances are removed?
This is expected behavior when you scale down from 2 instances to 1 as you are no longer in the SLA-backed world. This is also expected behavior if the RoleEnvironmentChanging event of your WebRole sets e.Cancel to "true" which forces instance-reboots during a scaling event. Otherwise, scale-down actions should not cause interruptions to your site

Categories : Azure

Tomcat 6.0.28 Unresponsive Because of Blocked Threads During Soak Test
you need to provide more information like what is your application doing during processing, and are you creating any threads of your own. if you create threads faster than they can process whatever it is they are doing you clearly will run into issues under load

Categories : Java

Zurb Foundation "th" thumbnail images within block grid unresponsive
it shouldn't overflow. http://foundation.zurb.com/docs/components/thumbnails.html are you using sass or just working on top of their css?

Categories : CSS

How to address unresponsive redraws and controls with setInterval and HTML5 Canvas
Welp, I rewrote the application using window.requestAnimationFrame and I no longer have this problem. The code is up on my Github if anyone wants to see the full solution. In brief, I removed all of the intervals and replaced the entire game loop. When an animation effect is needed, I turn a flag on corresponding with the event. The renderer checks this conditional and renders the effect if the flag is on, turning the flag off again when it's done.

Categories : Javascript

Place a timeout on calls to an unresponsive Flask route (updated)
Not entirely sure if I'm right about all this, but my understanding is that if the thread (or greenthread) handling the request does the network call in it's own "foreground", and that call times out, the borken pipe is pretty much going to happen. But what you can do is spin off a fully-separate thread that does the network request, then call Thread.join() with a timeout in your request-handling code. http://docs.python.org/2/library/threading.html#threading.Thread.join At that point, call Thread.isAlive() (still in your request-handling code path) and if True, the network call didn't return in time, and you return your error state. If it's False - and you'll need to have the "worker" thread update some (thread-safe) data structure with the response data - you get that response data an

Categories : Python

Firefox scrollbar unresponsive to click using overflow auto and pointer-events none
(as seen in https://bugzilla.mozilla.org/show_bug.cgi?id=880671) the mozilla team fixed it : http://hg.mozilla.org/mozilla-central/rev/f8bf18dceb1c so it's fixed on the nightly.

Categories : CSS



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