Showing posts with label load. Show all posts
Showing posts with label load. Show all posts
Sunday, March 5, 2017
How to speed up a folder load in Windows
How to speed up a folder load in Windows
How to Speed Up a Windows Folder that Loads Very Slowly
There is a curious phenomenon many of you have likely come across: even with a fast computer, there are some folders Windows loads with agonizing slowness. Fortunately the fix is simple and the results are immediate.
Why Your Folders Load So Slowly
There is a long standing Windows Explorer feature that dates all the way back to Windows Vista wherein you can tell Windows Explorer what kind of content is in specific folders, in order to optimize how that content is displayed.
For example: you can tell Windows Explorer that a particular folder is where you store your music files, and it will present those files in a way most useful for browsing music (e.g. in detailed list format with column options like file playtime automatically enabled). Even if you never tell Windows Explorer what to do, it automatically defaults some folders to various settings (the Music library folder is, naturally, defaulted to music-type file display) and then uses a feature called Automatic Folder Type Discovery on the rest. The automatic discovery system is a best-guess as to what is in the folder based on the number of files of various types, last files added, and so on.
When it works, its a great feature. When it doesnt work, its a rather annoying bug: when a folder with a large number of files is optimized for pictures, it immediately churns through all the files in the folder, regardless of whether or not the folder is in thumbnail view, in order to check and refresh all the thumbnails for all the files found therein.
Even on a beefy computer with a modern processor, plenty of RAM, and a speedy solid state drive, this process can take anywhere from 10-15 seconds to in excess of a minute depending on how many files are in the folder. On older computers it can even completely lock up Windows Explorer (not just the folder in question).
A prime example of this agonizingly slow file-churn-bug in action is the Windows Downloads folder which, thanks to that whole Automatic Folder Type Discovery feature, is typically set to picture mode on most computers. If we were placing wagers on what brought you to this article, wed happily wager that you came in search of a solution to your Downloads folder taking minutes to load and display the files. Dont worry, we wont judge your cluttered Downloads folder if you dont judge ours.
Fortunately solving the problem is as simple as telling Windows to stop treating the folder like an image gallery.
How to Change Your Folder Optimizations
As long as you know where to look, its easy peasy to change your folder optimizations. First, locate the folder youre having problems with. Typically most people only have one folder that is particularly sluggish, but if you have a whole host of folders that are misbehaving you can take a top-down approach and change the settings for the parent folder to apply the changes to all the subfolders.
Once youve located the folder, simply right-click on either the folder itself in Windows Explorer or, if you have the folder open, on a blank area within the Windows Explorer pane. Select, from the right-click context menu, Properties.
Within the Properties menu, select the Customize tab.
In the customize tab, youll find an entry Optimize this folder for: with a drop down menu. The options in the drop down menu are: General items, documents, pictures, music, and videos. Select General items.
If you wish to apply the changes to all the folders within that folder, select Also apply this template to all subfolders beneath the drop down menu.
Click Apply then OK at the bottom of the Properties menu. Back in the troublesome folder, press F5 to reload the folder.
The changes should take place immediately and the dreaded waiting-for-folder-to-load time should be long gone.
Go to link Download
Sunday, October 30, 2016
How to Load External JavaScript Asynchronously or Dynamically
How to Load External JavaScript Asynchronously or Dynamically
JavaScript makes more easier to manipulate websites, now a days most of the browsers supporting JavaScript codes. When the HTML parser encounters a <script> element, by default, run the script before it can parsing and rendering the document. It is not much problem for inline scripts but if the script source code is in an external file specified with a src attribute, the portions of the document that follow the Script will not appear in the browser until the script has been downloaded and executed.This makes loading of the website much slower, which makes bad user experience for your website and may not also indexing of your website by the search engines.
This Synchronous or blocking script execution is the default only. The <script> tag can have defer and async attributes, which cause scripts to be executed differently. This makes your website loading much faster than before and appears contents of your site by loading at first.
Both the defer and acync attributes are ways of telling the browser that the linked script does not use document.write() and wont be generating document content, and that therefore the browser can continue to parse and render the document while downloading the script. You can use async or defer attributes as the following.
This Synchronous or blocking script execution is the default only. The <script> tag can have defer and async attributes, which cause scripts to be executed differently. This makes your website loading much faster than before and appears contents of your site by loading at first.
Loading JavaScript Asynchronously using async or defer attributes
Both the defer and acync attributes are ways of telling the browser that the linked script does not use document.write() and wont be generating document content, and that therefore the browser can continue to parse and render the document while downloading the script. You can use async or defer attributes as the following.
<script defer src="deferred.js"></script>
<script async src="async.js"></script>
The defer attribute causes the browser to defer execution of the script until after the document has been loaded and parsed and is ready to be manipulated. The async attribute causes the browser to run the script as soon as possible but not to block document parsing while the script is being downloaded. If a <script> tag has both attributes, a browser that supports both will honor the async attribute and ignore the defer attribute. Deferred scripts run in the order in which they appear in the document, while acync scripts run as they load, which means that they may execute out of order.
Here is an example of acync script uses in this blog for Intensedebate comments script source.
You can load and execute scripts asynchronously, even in browsers that do not support the async attribute, by dynamically creating a <script> element and inserting it into the document. Here is an example how to load scripts dynamically.
Here is an example of acync script uses in this blog for Intensedebate comments script source.
<script async=async expr_src=data:post.commentSrc type=text/javascript/>
Loading JavaScript Asynchronously by loading scripts dynamically
You can load and execute scripts asynchronously, even in browsers that do not support the async attribute, by dynamically creating a <script> element and inserting it into the document. Here is an example how to load scripts dynamically.
function loadasync(url){
var head=document.getElementByTagName("head")[0];
var s=document.createElement("script");
s.src=url;
head.appendchild(s);
}
This loadsaync() function finds the <head> tag and attach <script> tag below opening of head tag and loads scripts dynamically. Scripts that are neither included inline within the web page or referenced statically from the web page are loaded into the document and become part of the running JavaScript program.
You can use the following method to execute loadsync() function, when document finished loading.
You can use the following method to execute loadsync() function, when document finished loading.
function loadasync(){ ..................}
request.onreadystatechange=loadasync;
Here is an example of loading JavaScript asynchronously by loading scripts dynamically used in this blog for external scripts from infolinks ads.
I have placed this code at the bottom of HTML codes, i.e. just before </body> tag and have placed the following code where I want to display ads.
<div style=display:none> <div id=adsource-0>
<script type=text/javascript>
var infolinks_pid = 9993182;
var infolinks_wsid = 1;
</script>
<script language=javascript src=http://resources.infolinks.com/js/infolinks_main.js type=text/javascript/>
</div>
</div>
<script type=text/javascript>
source = document.getElementById("adsource-0");
placeholder = document.getElementById("ad-0");
placeholder.appendChild(source);
</script>
I have placed this code at the bottom of HTML codes, i.e. just before </body> tag and have placed the following code where I want to display ads.
<div id="ad-0" align="center"></div>
Loading JavaScript Asynchronously when document finishes loading
You can load and execute scripts asynchronously by using setTimeout(), addEventListner(), and attachEvent(). Most objects that can be event targets have a method named addEventListner(), which allows the registration of multiple listeners.
window.addEventListner("load", function(){.....},false);
request.addEventListner("readystatechange", function(){......},false);
The first argument to this function is the name of the event. For IE8 and earlier, you must use a similar method, named attachEvent().
window.attachevent("onload", function() {.....});
Here is an example which define an onLoad() function that registers a function to be run when the document finishes loading. If the document has already loaded, run it asynchronously.
function onLoad(f){
if(onLoad.loaded)
window.setTimeout(f,0);
elseif (window.addEventListner)
window.addEventListner("load",f,false);
elseif (window.attachEvent)
window.attachEvent("onload",f);
}
onLoad.loaded=false;
onLoad(function(){onLoad.loaded=true;});
In the above script window.attachEvent is used for IE8 and earlier. onLoad.loaded=false; sets a flag that indicates the document is not loaded yet and onLoad(function(){onLoad.loaded=true;}); register a function to set the flag when the document does load.
Related Posts:
- How To Create Simple Image Slideshow Using JavaScript ?
- Image Slideshow with Navigation Buttons Using JavaScript
- How to Create JavaScript Image Slideshow with LInks
- How to Display Date Format in JavaScript?
- How to Create a Digital Clock in JavaScript?
- What are the Different Ways to Redirect Page in JavaScript?
- How to Detect Visitors Browser Using JavaScript?
Go to link Download
Labels:
asynchronously,
dynamically,
external,
how,
javascript,
load,
or,
to
Subscribe to:
Posts (Atom)