load

CasperJs loads json data from a local file

江枫思渺然 提交于 2019-12-03 12:24:56
Is there any convenient way to load a local JSON file into a variable with CasperJs? I saw someone suggest to use $.getJSON(filename, function() ... I have the following working on CasperJS 1.1-beta1 and PhantomJS 1.9.1 test.json { "test": "hello" } test.js var json = require('test.json'); require('utils').dump(json); casper.echo(json.test); // "hello" The solution proposed by @hexid worked for me with one change, i added a './' before the file address to denote it is a local file. test.json { "test": "hello" } test.js var utils = require('utils'); var json = require('./test.json'); utils.dump

Prevent loading the content of a hidden iframe

不问归期 提交于 2019-12-03 11:12:38
I have many hidden <div> tags, with (display: none) , that I call upon when I want to load a jQuery modal. Each of these <div> tags contain an <iframe> which calls a different page. In order to not make my page load painfully slowly, I am wondering if there is a way to prevent the <iframe> from loading the page, until I call the <div> in the modal? Adil You can load the iframes after html being rendered by giving empty src in html of iframe and later assigning src by jquery / javascript. Html <iframe id="iframe1" ></iframe> Javascript, iframe could be loaded on some action like button click

R - readRDS() & load() fail to give identical data.tables as the original

主宰稳场 提交于 2019-12-03 11:02:05
Background I tried to replace some CSV output files with rds files to improve efficiency. These are intermediate files that will serve as inputs to other R scripts. Question I started investigating when my scripts failed and found that readRDS() and load() do not return identical data tables as the original. Is this supposed to happen? Or did I miss something? Sample code library( data.table ) aDT <- data.table( a=1:10, b=LETTERS[1:10] ) saveRDS( aDT, file = "aDT.rds") bDT <- readRDS( file = "aDT.rds" ) identical( aDT, bDT, ignore.environment = T ) # Gives 'False' aDF <- data.frame( a=1:10, b

How to determine a good value for --load-average using gnu Make?

北城以北 提交于 2019-12-03 10:56:05
In Make this flag exists: -l [load], --load-average[=load] Specifies that no new jobs (commands) should be started if there are others jobs running and the load average is at least load (a floating-point number). With no argument, removes a previous load limit. Do you have a good strategy for what value to use for the load limit ? It seems to differ a lot between my machines. Maxim Egorushkin Acceptable load depends on the number of CPU cores. If there is one core, than load average more than 1 is overload. If there are four cores, than load average of more than four is overload. People often

Is it possible to listen image load event in SVG?

感情迁移 提交于 2019-12-03 10:37:48
Is it possible to listen for an <image> load event in SVG? If yes, how to do this? Yes it's possible. In markup: <image xlink:href="example.png" width="10" height="10" onload="alert('loaded')"/> See jsfiddle . In script: <script> var img = document.createElementNS("http://www.w3.org/2000/svg", "image"); img.addEventListener('load', function() { alert('loaded'); }); // or alternatively: // img.onload = function() { alert('loaded'); } img.width.baseVal.value = 100; img.height.baseVal.value = 100; img.href.baseVal = "example.png"; </script> See jsfiddle . zayquan I found that this would not work

I want to load multiple images very fast on a website, what's the best method?

痴心易碎 提交于 2019-12-03 10:05:13
问题 UPDATE: This question is outdated, please disregard So.. my idea is to load a full manga/comics at once, with a progress bar included, and make sort of a stream, like: My page loads the basic (HTML+CSS+JS) (of course) As done, I start loading the imgs(the URLs are stored on JS var) from my server, one a time (or some faster way) so I can make a sort of progress bar. ALTERNATIVE: Is there a way to load a compresses file with all imgs and uncompress at the browser? ALTERNATIVE: I was also

How to set up a load/stress test for a web site? [closed]

烂漫一生 提交于 2019-12-03 09:19:55
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 6 years ago . I've been tasked with stress/load testing our company web site out of the blue and know nothing about doing so. Every search I make on google for "how to load test a web site" just comes back with various companies and software to physically do the load testing. For now I'm

How to verify background (css) image was loaded?

大城市里の小女人 提交于 2019-12-03 09:08:47
问题 I have the following CSS class .bg { background-image: url('bg.jpg'); display: none; } that I'm applying on a TD tag. My question is how can I tell with JavaScript/jQuery that the background image finished loading? Thank you. UPDATE: added display property. Since my main objective it toggle it into view. 回答1: The only way I know of to do this is to load the image using Javascript, and then set that image as the backgroud. For example: var bgImg = new Image(); bgImg.onload = function(){ myDiv

jqGrid - how to set grid to NOT load any data initially?

安稳与你 提交于 2019-12-03 06:53:25
问题 How can you create a grid but not load any data? If I omit the url option then the loadError callback is triggered. Currently we set url:NoData.json where NoData.json is a static file with no rows in it. Issue is in our loadComplete callback we'd like to dipslay a message if the grid contains no data - except we don't want to display this message on the initial load. Currently we handles this as follows: //jqGrid load complete handler function loadComp(grid) { if (grid.getGridParam("url") !=

Ruby Rake load tasks from a gem

十年热恋 提交于 2019-12-03 05:58:36
i have been trying to include a gem located on github to my current app. The gem has a rake file that i want to able to access from my app. But i keep getting load errors. load 'tasks/deploy.rake' The gem file looks something like that # -*- encoding: utf-8 -*- require 'rake' Gem::Specification.new do |gem| gem.authors = %w(Hello World) gem.email = %w(test@example.com) gem.description = 'test' gem.summary = 'test' gem.homepage = 'https://github.com/..' gem.files = FileList[ 'lib/**/*.rb', 'tasks/deploy.rake', 'README.md' ].to_a gem.name = 'test' gem.require_paths = %w(lib) gem.version = '0.0.1