w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Java: reconnect disconnected network share
To map a drive from a command prompt, and have it remain after a reboot, is to make it persistent.No need to write a java program. [NET USE computernameshare -p] Or, right click on My Computer, click map network drive, choose the location, and make sure "Reconnect at logon" Hope this would help you

Categories : Java

Regex causing abnormally high CPU use in C#
This regex looks well designed, and I can't see anywhere you can improve it if your're going for 100% accuracy. However you can test if something simplier that will probably always work improves results. d{1,3}.d{1,3}.d{1,3}.d{1,3}:d{1,5} Obviously this could catch something that isn't right like 999.999.999.999:999. But you have to ask yourself if unrealistic input like that might occur. If this does improve performance, and you're reasonably sure you won't have crazy input like my example, then use it and use your more accurate regex to cull the list.

Categories : C#

Share A High Resolution Image
Please try below code : + (UIImage*)imageWithImage:(UIImage*)image scaledToSize:(CGSize)newSize; { UIGraphicsBeginImageContext( newSize ); [image drawInRect:CGRectMake(0,0,newSize.width,newSize.height)]; UIImage* newImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return newImage; } specify your new size as (850,850) and pass your original image, but make sure your height and width ratio of original image should be same as converted image ratio. Hope it will works for you.Thanks EDIT : For Capturing screenshot of your view follow below code : - (UIImage*)captureView:(UIView *)yourView { CGRect rect = [[UIScreen mainScreen] bounds]; UIGraphicsBeginImageContext(rect.size); CGContextRef context = UIGraphicsGet

Categories : Objective C

Numpy way to determine the value(s) in an array which is causing a high variance
Suppose this is your data: In [19]: import numpy as np In [167]: x = np.array([164, 202, 164, 164, 164, 166], dtype=np.uint16) Here is a boolean array indicating which values in x are more than 1 standard deviation away from the mean: In [170]: abs(x-x.mean()) > x.std() Out[170]: array([False, True, False, False, False, False], dtype=bool) We can use the boolean array as a so-called "fancy index" to retrieve the values which are more than 1 standard deviation away from the mean: In [171]: x[abs(x-x.mean()) > x.std()] Out[171]: array([202], dtype=uint16) Or, reverse the inequality to get the data with the "outliers" removed: In [172]: x[abs(x-x.mean()) <= x.std()] Out[172]: array([164, 164, 164, 164, 166], dtype=uint16)

Categories : Python

SQL Server 2012 Always on has high logcapture wait type
Don't troubleshoot problems on your server by looking at total waits. If you want to troubleshoot what is causing you problems, then you need to look at current waits. You can do that by either querying sys.dm_os_waiting_tasks or by grabbing all waits (like you did above), waiting for 1 minute, grabbing all waits again, and subtracting them to see what waits actually occurred over that minute. See the webcast I did for more info: Troubleshooting with DMVs That aside, HADR_LOGCAPTURE_WAIT is a background wait type and does not affect any running queries. You can ignore it.

Categories : Sql Server

oracle row contention causing deadlock errors in high throughtput JMS application
A deadlock implies that each thread is trying to update multiple rows in a single transaction and that those updates are being done in a different order across threads. The simplest possible answer, therefore, would be to modify the code so that messages within the same transaction are applied in some defined order (i.e. in order of the primary key). That would ensure that you would never get a deadlock though you'd still get blocking locks while one thread waits for another thread to commit its transaction. Taking a step back, though, it seems unlikely that you would really want many threads updating the same row in a table when you can't predict the order of the updates. It seems highly likely that would lead to lots of lost updates and some rather unpredictable behavior. What, exac

Categories : Multithreading

What's causing fb autologin on android, and how to "wait" for user login?
I suppose best thing to do is save a Boolean on SharedPreferences that check for "Logged" or "Not Logged" and onCreate check for that, obviuosly faster than check through internet.. When you log first time and log goes right (id login_success) if(login_success) { SharedPreferences settings = getSharedPreferences("key", MODE_PRIVATE); SharedPreferences.Editor editor = settings.edit(); editor.putBoolean("bool_login",true); editor.commit(); } Now when you create your activity, in onCreate method check for this value: onCreate() { if(getSharedPreferences("key",MODE_PRIVATE).getBoolean("bool_login",false)) { //True only if bool_login is true //hide your box for login } Hope that clarify

Categories : Android

High rate of object creation/destruction - Garbage collector too late causing slow downs x64
The main disadvantage of calling GC.Collect is that you might burn more CPU than you need to. You also prematurely promote objects to higher generations. In your case it is a CPU/memory tradeoff that you can safely take. You might also consider limiting the amount of memory that your process can use. Windows can impose such a limit with Job Objects. You can enlist your process into a limited Job and Windows will deny the CLR memory. The CLR will then collect to make room.

Categories : Dotnet

Wait for everything to load, except for ONE object? (via window.load() and jQuery)
Not really sure what you are after, but this might help: You can try out the :not()-selector, or filter out the vimeoplayer via .not() :not()-selector: http://api.jquery.com/not-selector/ .not(): http://api.jquery.com/not/ /J.

Categories : Jquery

High CPU load on ORMLite query
The resulting data is about 9kB in total. Is there anything wrong with the code? I don't immediately see any problems with your code. I'd make sure that userId is in an index if you have a large table but I suspect that isn't the issue. @DatabaseField(index = true) private String userId; You might also want to add an index to the foreign UserDTO field in the event table if that table is large but again I don't think the performance problem is on the Sqlite end unless your databases are large. One query optimization that you could try is to use another WHERE constraint when getting the events instead of the join: QueryBuilder<EventViewDTO, Long> eventQb = eventDao.queryBuilder(); // the "userDto" needs to be changed to whatever the foreign field name is data.eventViews =

Categories : Android

Java High-load NIO TCP server
Your logic around writing is faulty. You should attempt the write immediately you have data to write. If the write() returns zero it is then time to register for OP_WRITE, retry the write when the channel becomes writable, and deregister for OP_WRITE when the write has succeeded. You're adding a massive amount of latency here. You're adding even more latency by deregistering for OP_READ while you're doing all that.

Categories : Java

High-load java server
I do not think that Idea 3 would be over engineering, and I'd hit that road. Building @MessageDriven Bean "adapter" that handles incoming socket connections in the onMessage method is easy to develop and from there you're in the well scaling EE world. You your case, you might even want to rely on UDP. See following example: http://www.apprigger.com/2011/06/javaee-udp-resource-adapter-example/ But from my point of view there are other important reasons to go this way. Some pointers: 1.) As you've already mentioned. Building an own Socket Server handling threads and requests is a lot of work, and at the end you might build your own little "application server". 2.) Don't be afraid of using an application server. Of course people tend to call such a platform "overhead". Though when I did

Categories : Java

AWS EC2 Instances with Load Balancing during very high traffic
Reserved instances are there to save money for those instances you regularly run. I would suggest using reserved instances for your 'master'. The only advantage of keeping that one on-demand is the advantage that you could scale up or down as soon as your constant flow of traffic changes up or down. Make sure you choose the right use for your reserved instance; an 'always-on reserved instance' should have an heavy-use reserved purchase. Those 'peak instances' do best as an on-demand instance.

Categories : Amazon

AWS : S3FS AMI and load balancer high I/O Issue
I would like to recommend to take a look at the new project RioFS (Userspace S3 filesystem): https://github.com/skoobe/riofs. This project is “s3fs” alternative, the main advantages comparing to “s3fs” are: simplicity, the speed of operations and bugs-free code. Currently the project is in the “testing” state, but it's been running on several high-loaded fileservers for quite some time. We are seeking for more people to join our project and help with the testing. From our side we offer quick bugs fix and will listen to your requests to add new features. Regarding your issue: I'm not quite sure how does S3FS works with cached files, but in our project we try to avoid performing additional I/O operation. Please give it a try and let me know how RioFS works for you !

Categories : Amazon

Unique index on PostgreSQL text column - can it cause high CPU load?
For my personal views: yes; the unique index on a text a column is hurting the performance,especially when many INSERTS/UPDATES happen on the table. If your query does not need the unique index, I suggest you drop the unique index.

Categories : Database

show only one series data in High charts in start of drawing/load
I think I found solution visible: false in series, updated my jsfiddle series: [{ name: 'MyHiddenLine', data: [1,2,3], visible: false },

Categories : Javascript

syntax error near unexpected token `fi' - High load Notification mail
I don't really get the same error than you but you can already test this solution: if [ `uptime | awk '{ print$11 }' | cut -d. -f1` -gt 1 ]; This condition try to compare a float with an integer. I would make this test with an extended test command. And you can forget semicolon if you don't put then keyword on the same line than your condition : if [[ `uptime | awk '{ print$11 }' | cut -d. -f1` > 1 ]] then mail -s "$SUBJECT" $TO < /tmp/load exit fi

Categories : Bash

nodejs HTTP server can't handle large response on high load
Right now all strings are first converted to Buffer instances. This can put a heavy load on the garbage collector to cleanup after each request. Running your application with --prof and examining the v8.log file with tools/*-tick-processor and you may see that. There is work being done to correct this so strings are written out to memory directly then cleaned up when the request is complete. It has been implemented for file system writes in f5e13ae, but not yet for other cases (much more difficult to implement than it sounds). Also converting strings to Buffers is very costly. Especially for utf8 strings (which are default). Where you can, definitely pre-cache the string as a Buffer and use it. Here is an example script: var http = require('http'); var str = 'a'; for (var i = 0; i <

Categories : Node Js

VB wait webpage load
You just need to keep track of which page is loading. You can do this with a Static variable. When the first one completes (the documentcompleted event fires) then load the next one: Private Sub Button1_Click 'Load the first page LoadNextPage End Sub Private Sub WebBrowser1_DocumentCompleted(sender As Object, e As WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted 'When the current page has finished loading - load the next page LoadNextPage End Sub Private Sub LoadNextPage Static page As Integer = 0 'set to page number we are loading 'increment the page count page += 1 'Load the appropriate page Select Case page Case 1 WebBrowser1.Navigate("page1") Case 2 Label1.Text = "Loaded 1 now loa

Categories : Dotnet

Adding rails apps to nginx avoiding high load time on 1st access
Unicorn sounds like it might be a better fit for your deployment scenario. You can keep nginx up front, but instead of loading rails itself, it will just connect to a unicorn Unix socket. Further, you can reload your application with new code gracefully, while nginx stays up and Unicorn swaps out backend quietly.

Categories : Ruby On Rails

How to wait for an activity to fully load?
Use a Handler to post a Runnable, like so: public class WaitScreen extends Activity { private Runnable task = new Runnable() { public void run() { Toast.makeText(getApplicationContext(), "Spinner complete!", Toast.LENGTH_LONG).show(); Intent i = new Intent("emergency.app.NEWACTIVITY"); startActivity(i); } }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.waitscreen); Handler handler = new Handler(); handler.postDelayed(task, 5000); } } The Runnable task will execute after 5 seconds. http://developer.android.com/reference/android/os/Handler.html

Categories : Android

I am not able to wait in testcomplete for page element to load
The best approach to wait until a dynamic page is ready is to wait for a specific object on this page. For example, this can be the first object you need to work on the page. This approach is described along with a couple of other approaches in the Waiting For Web Pages help topic.

Categories : Vbscript

Wait Till WebBrowser Load? (VB 2010)
You have to add the DocumentCompleted Event Handler and trigger any code from the corresponding method. That is: Private Sub startBrowser() AddHandler WebBrower1.DocumentCompleted, AddressOf WebBrowser_DocumentCompleted WebBrower1.Navigate("http://...") End Sub Private Sub WebBrowser_DocumentCompleted(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) 'CALL ALL YOUR CODE FROM HERE End Sub ---- UPDATE WHOLE WEBBROWSER If you open a new project and paste this code (and add the TextBoxes/RichTextBox to your form), it would work without any problem: Public Class Form1 Friend WithEvents webBrowser0 As New WebBrowser Friend WithEvents tabs As New TabControl Friend WithEvents tabPage0 As New TabPage Private Sub Fo

Categories : Vb.Net

Javascript Wait for Ajax Content Load
You should use the onreadystatechange for this. Check this http://www.w3schools.com/ajax/ajax_xmlhttprequest_onreadystatechange.asp

Categories : Javascript

How to wait to load a Crystal Reports File On ASP.NET C#?
With Crystal in ASP.Net, I load reports in the Page_Init not the Page_Load event. Also, the closing and disposing cleanup is handled in the Page_Unload event. I noticed that the first report after the web application starts takes a considerable amount of time to load This is the Crystal runtime. After the first load, everything is fine. This will also happen after IIS shuts down the web application after idle time. The only thing you can do about that is to warm up the crystal runtime. One option is to do this in your application at start up. Even it means calling a dummy blank crystal report at Application_Start from your global.asax.

Categories : C#

More efficient way to wait for all images to load in jQuery
You could do something like this to avoid having your function run multiple times. jQuery(document).ready(function($) { var nrOfImages = $("img").length; $("img").load(function() { if(--nrOfImages == 0) { // Function goes here } }); });

Categories : Javascript

Making sure I have a timeout set while using watir to wait for page load
You can specify the Timeout value in parentheses after the wait statement: Watir::Wait.until(60) { browser.text.include? 'Hello' } Watir::Wait.until(60) { browser.div(:id => "mainDiv").exists? }

Categories : Ruby

Wait for element to load when testing an iOS app using Appium and Ruby?
I use this solutions in appium java: Thread.sleep(1000); WebDriverWait wait = new WebDriverWait(driver, 30); wait.until(ExpectedConditions.elementToBeClickable(By.name("somename")));

Categories : IOS

webdriver sendKeys doesnt not wait for page to load
Whenever you do .click() on a button or link an internal method something like "waitTillPageLoads()" is called and hence webdriver waits until the next page is loaded completely. I have experienced a scenario where it waited for almost 10-15 minutes for the page to load because web app was too slow. Wierd it sounds i know. however sendKeys() doesn't wait. Because sendkeys is not used for clicking purpose rather it used for entering keys. I guess there must be some strong reason for you to do href.sendKeys(Keys.ENTER); And if you still want to go with this approach you can implicitly you can wait for element of next page using implicit wait WebDriverWait wait = new WebDriverWait(webDriver, 5); wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("xpath"))); Please no

Categories : Java

How to wait until query finishes to load Collection View
Parse has a number of different methods to fetch or refresh an object which take a completion handler parameter. The block passed in as the completion handler will be invoked when the fetch/refresh is complete. Show your view controller from that block. (Also, you might want to display an activity indicator of some sort before you start the fetch and stop/hide the activity indicator in the completion handler as well).

Categories : IOS

how to wait for some event to complete in jmeter load tests
This is described in this tutorial if you mean you have an intermediate loading screen: http://www.sourcepole.ch/2011/1/4/waiting-for-a-page-change-in-jmeter Otherwise you have nothing to do, JMeter will wait for response.

Categories : Asp Net Mvc

Wait for image full load on ajax action
Update I think you have to try this trick found here : $("<img />", { src:"thelinkofyourimage"}).appendTo("div#to_load").fadeOut(0).fadeIn(1000); Have a look to this fiddle : http://jsfiddle.net/qYHCn/.

Categories : Javascript

Custom App.config section causing configuration load error
The configSections element must be the first child of the configuration element. Try this: <?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> <section name="ErrorEmailer" type="EmailTester.ErrorEmailer" /> </configSections> <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /> </startup> <ErrorEmailer> <SmtpServer address="mail.smtphost.com" /> <FromAddress address="from@host.com" /> <ErrorRecipients> <ErrorRecipient address="example@example.com" /> <ErrorRecipient address="example@example.com" /> </ErrorRecipients> </ErrorEmailer> </configuration> Furthermore, you need to put the namespa

Categories : C#

Facebook Share Dialog does not display thumbnails one first load
Facebook displays a cached image. It does so the first time the share is submitted or when Facebook crawler finds og:image tag on your page. According to Facebook docs at https://developers.facebook.com/docs/sharing/best-practices#pre-cache-images "Some of our Social Plugins render an image when someone is interacting with them. The image is based on the og:image on the page, or other images on the page if the og:image isn't set. Before the social plugin can render an image Facebook's crawler has to see the image at least once. For sites where pages change frequently (e.g. ecommerce) the first person who clicks on these plugins won't see a rendered image."

Categories : Facebook

Extjs 4.1 wait for stores to load in window for multiple comboboxes
I have resolved the issue. The store for the combobox was requesting only 25 records at a time. Not all of the records were loaded. and therefore the id was not being found and the displayField's value was being set to the valueField. Changing the server side code to ignore start/limit solved the problem. From the store's documentation: If this store is buffered, this can ONLY find records which happen to be cached in the page cache. This will be parts of the dataset around the currently visible zone, or recently visited zones if the pages have not yet been purged from the cache

Categories : Extjs

jQuery/JavaScript wait for page to load, but no shorter than specified time
You certainly don't need $(window).load... within the setTimeout function. In fact, putting it within the timeout will ensure that it never executes since the window.load event will have already fired before you assign it your function to fadeOut the overlay. I've adjusted my code based on your feedback. The basic principle is to determine how long it took to get everything ready and then reduce the timeout based on the time already elapsed. This way your fastest connections will still get a delay while your slowest connections will execute the fadeout immediately. Live Demo //Put this line in a script tag as high up on the page as possible window.timeInMs = Date.now(); Instead of document.ready which executes after the document is loaded, use window.load which executes after the

Categories : Javascript

Azure Could Computing high availoability vs NEO4J high availability?
The short answer is probably yes. Windows Azure provide you infrastructure that allow you to build high availability system, it won't make any system high available by magic. As NEO4J is state-full, each node (with only one node Azure don't give you any SLA, you instance will be down) will need to share some state and the way to do it will be dependent on how NEO4J is working. So you will need to rely on NEO4J mechanism to do it. I don't know how NEO4J is working but you won't be able to skip designing an high available architecture around NEO4J using Windows Azure infra. Cloud may be a magic buzz word that can make things append on management level, but when we are on hard real world level Harry magic wand doesn't exist.

Categories : Neo4j

jQuery / AJAX - loading content into modal window, how to wait until load() is finished?
$.load doesn't support promises, so you'll just have to pass in the callback function as an argument: $(box).load(url, function () { $(box).slideDown(300); });

Categories : Jquery

quicksand sorting price values low to high / high to low
val() gives you a string, so > and < comparisons are lexographical (not numeric). Try wrapping the values in parseInt() or parseFloat(). Make sure to add appropriate error handling as well.

Categories : Jquery

Django ecommerce website huge product page initial load time (wait)
I think these lines in product_view are not correct product = get_object_or_404(Product.unmoderated.select_related(),pk=product_id) variation = get_object_or_404(ProductVariation.objects.select_related(),pk=variation_id) Change it to product = get_object_or_404(Product,pk=product_id) variation = get_object_or_404(ProductVariation,pk=variation_id) The .select_related() will try to prefetch and load all objects and their related objects, which will be resource consuming.

Categories : Python



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