w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Localhost web pages take for ever to load with Vagrant... even if all other networking is fine
First I'd recommend using a different base box if you really need to customize the VM. Last time I tried using that box the VirtualBox customizations (vb.customize on your Vagrantfile) were not being applied correctly. You can double check that by installing the htop package and look into how many CPUs and memory it displays. Another thing you might try is enabling NFS shared folders for your project root, check out this link for some numbers and in case you are willing to try it out, just add config.vm.synced_folder '.', '/vagrant', id: "vagrant-root", nfs: true to your Vagrantfile Hope it helps :)

Categories : Ruby On Rails

Check a Boolean value from database at the start of an app then load terms and condition page if false, load menu page if true
I solved this problem by creating a new JavaScript file which runs when a html page lodes (start of the <head> tag Which opens the database Runs the SQL query to find the value Opens the relevant page depending on the result It still displays the page (half a second at most) when I load the page, but it does what I want Here is the code: try { db = openDatabase('cuopioid', '1.0', 'cupioids application database', 2 * 1024 * 1024); } catch (e) { // Error handling code goes here. if (e == INVALID_STATE_ERR) { // Version number mismatch. alert("Invalid database version."); } else { alert("Unknown error " + e + "."); } } checkTerms(); function checkTerms(tx) { db.transaction(function(tx) { tx.

Categories : Javascript

Keep vagrant database data after vagrant destroy
It depends on the RDBMS you use. For MySQL on Ubuntu, you can simply backup (tar or rsync to a remote host) the /var/lib/mysql folder (when mysql is NOT running) and its configuration files /etc/mysql. For PostgreSQL it is similar, the database files are normally under cd /usr/local/pgsql/data. Refer to File System level backup NOTE: avoid using the default vboxsf to share large number of files between guest and host because it has known performance issues.

Categories : Ubuntu

Automatically chdir to vagrant directory upon "vagrant ssh"
You can add cd /vagrant to your .bashrc and it will run the command when you ssh. The /bashrc you want is in /home/vagrant (the user you login as when you vagrant ssh.) You can just stick the new line at the bottom of the file.

Categories : Bash

Nodejs on heavy load
First, I'm not sure how you have a clock speed of 13.6ghz for a single thread. I'd assume your CPU has multiple cores, or your mobo supports multiple processor sockets, and 13.6 is simply a sum. (8.2GHz was a world record that was set July 23rd, 2013.) Secondly, I'd ask yourself why the disconnect is happening. Are you watching processor load - is a single thread maxing out its processor allocation (i.e. 100% usage on a single core)? How's your RAM consumption; is it climbing, and has the OS offloaded memory onto the page file/swap partition - could there be a memory leak? Is your network bandwidth capped? Has it reached its maximum capacity? My high-level recommendations are: Make sure your application is non-blocking. This means using asynchronous methods whenever possible. By des

Categories : Node Js

how to load an image from url into buffer in nodejs
Use the request library. request('<s3imageurl>', function(err, response, buffer) { // Do something }); Also, node-image-headers might be of interest to you. It sounds like it takes a stream, so it might not even have to download the full image from S3 in order to process the headers. Updated with correct callback signature.

Categories : Javascript

JQuery Function not firing on page load it works only after i refresh page or re-visit the same page again
Well I got the general gist of your question but the entire question description is pretty confusing so I'll try to just help you out where I think it counts. var leftbar = $(".pg-left-bar").height(); var rightbar = $(".pg-right-bar").height(); if (leftbar >= rightbar) { $(".pg-right-bar").css({ "height": leftbar + "px" }) }else{ $(".pg-left-bar").css({ "height": rightbar + "px" }) } I omitted your magic numbers and the other code to make the change apparent but I think your issue was due to the lack of "px" being concatenated to the ends of your css declarations. If this isn't the issue would you mind showing a full example.

Categories : Javascript

NodeJS load test poor performance (EADDRNOTAVAIL)
As robertklep suggested, this is a problem of the SO running out virtual ports when opening too many outgoing connections. Follow his link for a detailed explanation. When I increased the ports as the article says I still got the problem. With a some more googling I found out about problems with garbage collector and node network objects. It seems a good idea (when you need many many outgoing connections) to manually handle garbage collector. Check out this post.

Categories : Node Js

Load a javascript object from file in nodejs, parse error
You have 3 ways to do what you want: Change the extension of the file to .json Export the content as a node.js module: module.exports = /* the object */ Read and parse it as a json file: fs.readFile('path/to/file', function (content) { var queries = JSON.parse(content.toString()); });

Categories : Javascript

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

A hover event I have does not work after an ajax load, it only works on initial page load
.bind('event'...) triggers (.hover is an alias to that statement) bind only to existing elements. If you generate new elements in your code they will be unaffected. To rectify this, use the new .on statement: $('body').on( // No error, we bind the handler to the DOM body. 'mouseover', '.like', // This is the selector that reacts to your handler. function(){ blagh; } );

Categories : Jquery

load ajax response data to a page element as inner-html with j query load method
when you use jquery and change html of DOM(Document object modal) then in view source these html which come from (ajax ,load and any method in jquery or javascript) it not seen in view source in view source we see only which html come on page load by server side language like php,,net,java not by client side language like javascript see GOOGLE PLAY in this all the html come by ajax see in console for best result see in firefox with firebug

Categories : PHP

jQuery Image load error not being called after page load
It would appear that jQuery has issues recognizing new elements on the page, so the way I fixed this was instead of deleting and adding images to the page, I just edited the existing SRC of images when doing changes, which strangely enough, the jQuery error function responds perfectly to. Here's the refresh function I ended up coming up with for all interested: function refreshImages() { var images = 10; for(var i = 0;i < images;i++) { var url = getImgUrl(); $('#thumb' + i).attr('src',url); if(i == 0) { $('#fullimage').attr('src',url); $('.thumb').css('border','2px solid white'); } } resize(); }

Categories : Javascript

vagrant on windows need a second vagrant up
This can be a few things... the easiest way to tell the exact problem is to see what the VM itself is stalling on by running it in gui mode. config.vm.provider "virtualbox" do |v| v.gui = true end It could be stuck at the grub prompt or something... it could also just be a bad image... perhaps try a different Vagrant base box.

Categories : Windows

Load scripts after page load - Firefox extension
If you want to detect page load and not application load, you should do it like this (this first part should be in your main overlay file): // do not try to add a callback until the browser window has // been initialised. We add a callback to the tabbed browser // when the browser's window gets loaded. window.addEventListener("load", function (event) { // Add a callback to be run every time a document loads. // note that this includes frames/iframes within the document gBrowser.addEventListener("load", load(event), true); }, false); Reference from here I added the event to the load function because the event fires not only on the load itself, but also on other elements, so you have to validate that you are doing it only once (reference here ): function load(event) { if (eve

Categories : Javascript

Randomly load different JavaScript between each page load using loadExternalHTMLPage
You can always use eval() to execute the content you downloaded ... :) (not recommended). Or you can modify the html page on server to include the random script you want before serving the page to the user (you don't state platform) since it's anyways changed at page load.

Categories : Javascript

Android: Load an HTML page and then load another after few seconds
Best practice is using the Timer/TimerTask for the update. Use Timer.scheduleAtFixedRate(/* Your TimerTask reloading the url */, 0, 2000) or something similar. https://developer.android.com/reference/java/util/Timer.html https://developer.android.com/reference/java/util/TimerTask.html

Categories : Android

How to load a modal on Page-Load only if user has NOT logged in
Check if they're logged in, and if not, use PHP to load the modal functions and file. If not, don't load it. PHP controls what appears on the client side. For example, in the head section of the PHP file for the page, you could have a line that calls the script based on a variable $logged_in that you somehow determine the value of with sessions or whatever: <?php if ( ! $logged_in){ echo '<script type="text/javascript" src="http://www.mysite.com/javascript/mymodal.js"></script>'; } ?> You could do the same for echoing the click functions, etc..

Categories : PHP

What event is fired on page load / hash load
try doing: $(document).on('pageinit', '#show_protocol', function(){ //your code here }); instead of $(document).ready(function() { ... }); use $(document).bind('pageinit') Reference:: jQuery Mobile Events

Categories : Jquery

How set start page in nodejs
You will need to return different files, depending on the path that was requested. On the 'request' handler you are getting a ClientRequest object, which has a path property. Use this information to return the correct files (index.html, the CSS or JS files...). An example request callback could be: function onRequest(req, res) { var path = req.path; fs.readFile('../public' + path, function(err, contents) { if (err) { res.writeHead(500); res.end(err); return; } res.end(contents); }); } This is still very basic, you will probably want to handle non-existent files with a 404 result code, return the correct Content-Type headers the different file kinds (text/html, text/css, etc). Update: as minitech recommends, the path should be checked for ../, which

Categories : Node Js

Access function in a JS page from another JS page on page load
Scripts are loaded asynchronously, so you never know which file will load first. Most probably one with less bytes. If you want to load scripts in order you provide, use library like requirejs.

Categories : Jquery

how to load magnific popup on page load
If you're using jQuery you could just listen for the window load event and then call the open method for your Magnific Popup like so: (function($) { $(window).load(function () { // retrieved this line of code from http://dimsemenov.com/plugins/magnific-popup/documentation.html#api $.magnificPopup.open({ items: { src: 'someimage.jpg' }, type: 'image' // You may add options here, they're exactly the same as for $.fn.magnificPopup call // Note that some settings that rely on click event (like disableOn or midClick) will not work here }, 0); }); })(jQuery);

Categories : Javascript

Load Rails After Static Page Load
You're question is extremely vague, but here is the direction you need to go Remove the content from your view Add a spinner gif to the view in Javascript once DOM is ready, send API request to fetch this slow information Make the gif spinner disappear Inject your information into the page This is basically a Javascript question, not Rails.

Categories : Jquery

Load Map with bubbles on page load in android
Possibly your points are overlaps with each other. Especially if you create GeoPoints from integers with small difference like 11,1 and 12,2 and 13,3 this will couse overlaped overlay items Have a look at here package org.osmdroid.util.GeoPoint when you use GeoPoint(final int aLatitudeE6, final int aLongitudeE6) Your value will not be multiplyed with 1E6(which is 1.000.000) So there is no place difference between this two points on MapView GeoPoints(11,1) and GeoPoints(12,2)

Categories : Android

How to call function on page load in jquery mobile and how to pass data from one page to another
Proper way to initialize function on a page load is: $(document).on('pageinit', '#index', function(){ }); Working example: http://jsfiddle.net/Gajotres/PMrDn/ Regarding passing data from one page to another, there are several solutions, you can find them in my blog ARTICLE. Just search for the chapter called: Data/Parameters manipulation between page transitions. You will also find working examples. Basically there are 3 main approaches: Pass data from page 1 to page 2 directly. It requires several HTML pages, it will not work with one HTML containing several pages. Store data into some global javascript variable (the easiest solution). Store data into localstorage EDIT : There's one more thing. If you are using several HTML pages you need to be careful with your javascript. W

Categories : Javascript

angular single page app, videoJS ready function only fires on page load
Do you see any other errors in console? The issue might be related to the fact, that the player was not properly disposed. See, for example, these discussions: https://github.com/videojs/video.js/issues/189 http://help.videojs.com/discussions/problems/1284-firefox-error-with-elvjs_getproperty I am not an angular expert, but when you go back and forth between views, the player won't be disposed automatically.

Categories : Javascript

Django - troubleshooting slow page load times for a comments page
As I understand this is related to avatar image and not SQL queries. Working with remote storages like S3 is a bit slow. But it should not hamper the user experience as you have faced above. I didn't get what you are using to get 'avatar' image, but I would suggest to use some third party packages like. Easy_thumbnails - It is really nice and has lots of options. I recently shifted to this you. In case of remote storages, you could pregenerate avatars with celery and serve saved thumbnail sorl-thumbnail - I used this for my previous project. It doesn't have option to pregenerate, so first request is slow. But once thumbnail is created, next request will be fast. It has smart caching. I tried to fork it here to use with celery https://github.com/neokya/sorl-thumbnail-async I hope it

Categories : Django

jQuery .load stops video embedded in page / reloads whole page
I looked at the page and the #content div appears to include the embedded video, which you are hiding and showing in the js. You want to only hide and show the #liveracingblog div The following change should work: $.ajaxSetup( { cache: false, beforeSend: function() { $('#liveracingblog').hide(); $('#loading').show(); }, complete: function() { $('#loading').hide(); $('#liveracingblog').show(); }, success: function() { $('#loading').hide(); $('#liveracingblog').show(); } }); Also I notice that a huge amount of records are being

Categories : PHP

JQuery in Rails is failing after linking from another page, works on page load
I'd guess that this is Turbolinks related. From the fine manual: Events With Turbolinks pages will change without a full reload, so you can't rely on DOMContentLoaded or jQuery.ready() to trigger your code. Instead Turbolinks fires events on document to provide hooks into the lifecycle of the page. AFAIK, Rails4 enables turbolinks by default (and you have it in your application.js) so $(function() { ... }) won't always fire when changing pages. You could try binding to page:load instead: $(document).on('page:load', function() { setInterval(rotateQuotes, 5000); }); You might want to bind to page:before-change to clean things up as well. Alternatively, you could disable Turbolinks if you don't care about it.

Categories : Jquery

How can I create a link to page and load specific content in iframe on that page
you'd have to add an iframe to http://xxx.xxx.com/page like this: <iframe src="http://xxx.yyy.com/anotherpage"></iframe>

Categories : HTML

Finding controls on load events of a page that is inherited from Master page
if you are trying to find control inside the master page you should this.Master.FindControl("controlName"). Other case is with you are inside master page and want to find a control inside a page so you should ContentPlaceHolder1.FindControl("controlName"). Please also check: How to access content page controls from master page in asp.net Nested Masterpages and .FindControl

Categories : C#

page load with child grids taking too much of time in loading the page
You need to provide all of your code before we can provide an accurate answer. For example: Where SubItemBL is defined? Also try to see what line is the exact bottleneck. Is it bl.FetchForCategory(aDataSet, Category, RowId); or grdSubItems.DataBind(); If above line is the bottleneck, note that Gridview binding to a datasource with large number of data is indeedslow. how large is your data?

Categories : C#

Using jQuery to load page into a div element and remove current loaded page
Try cleaning the previous content. See if this works: $(document).ready(function() { $("#content-loaded").load("index.php"); $('.about').click(function(evt) { $("#content-loaded").empty(); $("#content-loaded").load("about.php"); evt.preventDefault(); }); //.... });

Categories : Jquery

Launch Bootstrap Modal on Page Load, Contingent on Previous Page Button Click
You could pass a querystring parameter to Page B. Page A <a href="pageB?openModal=true">Go to Page B</a> Page B if (window.location.search.indexOf('openModal') != -1) { $("#modal").modal('show'); }

Categories : Javascript

Technique to enable smooth page changing and prevent the browser redrawing for each page load
Well, although ASP.NET implements AJAX, and partial change of pages (through updatepanels for example) there's always a postback to the server with everything you do in .NET. Basically, there's always that "blank screen", but you probably don't see it in some cases, when the server answers quickly or you browser treats the HTML quicker for any reason. The only possibility I know to avoid full postbacks is to get out of the .NET logic and do AJAX request yourself by writing client code only. But this possibly comes with other problems (like the controls you may add this way not being "known" by your server code, for example).

Categories : HTML

use variable in aspx page load from event raised in ascx, and build dynamic buttons on page
I think I see what you're doing that is causing your problem. To be sure I understand, though... you have built a custom control (an .ascx) that you are adding to your web form dynamically by adding it to a placeholder control. However, when the user interacts with the custom control, the event is not getting raised to the parent. I think that you've got a good start here, but I'd like to give a recommendation on a slightly different way to approach this. It might also clean up your code a little and keep you from having to build the control twice in one page lifetime. First, change your "BuildCrumbs" sub to the following (you'll probably need to change the "Dim mybtn2" line to match the details of your project): Private Sub BuildCrumbs(IsNewControl As Boolean) Dim mybtn2 As Peop

Categories : Asp Net

load part of page when cash page in server side
you need to add AJAX request that will run once on document-ready to get rating from PHP page and update the rating $(document).ready( function(){ $('#productvote-20').load('Rating.php?productId=1'); }) And in that PHP file, you need to output this.. but don't cache that page <input type='checkbox' name='vote' value='1' /> <input type='checkbox' name='vote' value='2' /> <input type='checkbox' name='vote' value='3' /> <input type='checkbox' name='vote' value='4' /> <input type='checkbox' name='vote' value='5' />

Categories : PHP

how to change title of aspx page dynamically on page load
In your master page, mention the header as <head><title>@ViewBag.Title</title></head>. Conveniently set the Title property on all your other pages, like: @{ ViewBag.Title = "My new title"; }

Categories : C#

How do I load a php include into a page with ajax whilst the page is loading
If you're using jQuery, you could you use one of their ajax calls to load your html from include.php. For example you could use the load() function. For example: <div id="content"></div> <script> $(document).ready(function() { $("#content").load("/yourpath/include.php"); }); </script>

Categories : PHP

how to activate particular tab on the basis of previous page in second html page load
This should do the job: <script> $(function() { $("#tabs").tabs(); var search = document.URL.split('?')[1]; switch (search) { case "error": $("#tab1 > a").click(); break; case "suspect": $("#tab2 > a").click(); break; } }); </script> <div id="tabs"> <ul class="nav nav-tabs" id="myTab"> <li id="tab1" class="active"><a href="#error"data-toggle="tab"> Error</a></li> <li id="tab2"><a href="#suspect" data-toggle="tab" >Suspect </a></li> </ul> <div class="tab-pane in active" id="error"> Error </div> <div class="tab-pane" id="s

Categories : Javascript



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