EzDevInfo.com

load interview questions

Top load frequently asked interview questions

Load image from resources area of project in C#

I have an image in my project stored at Resources/myimage.jpg. How can I dynamically load this image into Bitmap object?


Source: (StackOverflow)

How to create a CPU spike with a bash command

I want to create a near 100% load on a Linux machine. It's quad core system and I want all cores going full speed. Ideally, the CPU load would last a designated amount of time and then stop. I'm hoping there's some trick in bash. I'm thinking some sort of infinite loop.


Source: (StackOverflow)

Advertisements

Open source Tool for Stress, Load and Performance testing [closed]

Possible Duplicate:
How do you stress test a web application?

Currently I have configured a project with cc.net, watin and nunit and now I want to do stress, load, and performance testing of my .net projects. Any idea which opensource tool should I use or cani achive it with same working tools and if yes then how?


Source: (StackOverflow)

jQuery: loading css on demand + callback if done

i want to load css files on demand (by eg. running a xmlhttp request which returns the css files to be loaded) for example: style1.css, style2.css ..

so - is there a way in jQuery (or a plugin) to this:

  • bulk-loading several files + adding all those css-files into the dom
  • when finished loading: firing a callback (like alerting "all stylesheets are finished loaded!");

the idea is: loading html via xmlhttp, loading +adding required css-files, then - after anything is finished, display that html.

any ideas? thx


Source: (StackOverflow)

Genymotion error at start 'Unable to load virtualbox'

I've installed the genymotion+virtualbox package on Windows 7 64-bit and everything goes fine... But when I start Genymotion it presents me an error message Unable to load virtualbox.

VirtualBox is installed and I'm able to start it manually... I've tried to install the packages separately, updated virtualbox to 4.2.16 but nothing worked...

I've already read genymotion FAQ but it din't help me out.


Source: (StackOverflow)

Capture iframe load complete event

Is there a way to capture when the contents of an iframe have fully loaded from the parent page?


Source: (StackOverflow)

Fade in each element - one after another

I am trying to find a way to load a JSON page to display my content, which I currently have. But I am trying to fade in each element one after another? Is anyone familiar with a way to do that?

Fade in each element with a slight delay?

Here is an example of my code, I am using the jquery framework.

CODE: http://pastie.org/343896


Source: (StackOverflow)

jquery callback after all images in dom are loaded?

How can I fire an event when all images in the DOM are loaded? I've googled a lot. I've found this, but it doesn't seem to work:

jQuery event for images loaded


Source: (StackOverflow)

How do I load an url in iframe with Jquery

I want to load an iframe on click, this is what I have so far:

$("#frame").click(function () { 
      $('this').load("http://www.google.com/");
    });

It doesn't work. This is the complete code: JS Bin


Source: (StackOverflow)

Waiting for image to load in Javascript

I'm making an Ajax call which returns me some info including an image path. I prepare all those informations in my HTML which will be displayed as a kind of popup. I just toggle the visibility of by popup div from hidden to visible.

To set the position of my popup div, I have to calculate depending on the height of the image. So, I have to wait for the image to load to know its dimension before setting position and switching visibility to visible.

I tried tricks with recursion, setTimeout, complete img property, while loop... without success.

So, how can I do this. Maybe I should return dimensions in my Ajax call.


Source: (StackOverflow)

How can I use jQuery "load" to perform a GET request with extra parameters?

I'm reading the jQuery load documentation and it mentions that I can use load to perform a GET request by passing in extra parameters as a string. My current code with my parameters as key/value pair is:

$("#output").load(
    "server_output.html",
    {
        year: 2009,
        country: "Canada"
    }
);

The above works fine but it's a post request. How can I modify the above to perform a GET request while still using load?


Source: (StackOverflow)

Can script.readyState be trusted to detect the end of dynamic script loading?

I use dynamic script loading to reduce the duration of the initial page load. To ensure that the functions and objects defined by a script are accessible, I need to ensure that the script has been fully loaded.

I have developed my own Javascript library to this end, and thus did quite a lot of research on the subject, studying how it's done in different libraries. During a discussion related to this issue, Kyle Simpson, the author of LABjs, stated that:

LABjs (and many other loaders) set both "onload" and "onreadystatechange" on all script elements, knowing that some browsers will fire one, and some will fire the other...

You can find an example of this in the current version of jQuery as of this writing, v1.3.2:

// Attach handlers for all browsers
script.onload = script.onreadystatechange = function(){
    if ( !done && (!this.readyState ||
    this.readyState == "loaded" || this.readyState == "complete") ) {
        done = true;
        success();
        complete();

        // Handle memory leak in IE
        script.onload = script.onreadystatechange = null;
        head.removeChild( script );
    }
};

That's the state of the art, but during the analysis of a strange behavior in Opera 9.64, I came to the conclusion that, using this technique, the onload callback got fired too early.

I will post my own findings in answer to this question, and would like to gather further evidence and feedback from the community.


Source: (StackOverflow)

PhoneGap for iPhone: problem loading external URL

I'm writing an application for iPad using PhoneGap and I would like to load an external URL without triggering Safari or using internal web browser like ChildBrowser.

I'm using the PhoneGap iPad/iPhone sample project and I tried different approaches. In the onBodyLoad() function I added:

window.location.href('http://www.wordreference.com'); 

but this line opens the link using a new Safari window.From that point is not possible to come back in PhoneGap

Afterwards, I tried with an AJAX request substituting the content of the page using document.write

function loadHTML(url, timeout) {
if (timeout == undefined)
    timeout = 10000;
var req = new XMLHttpRequest();
var timer = setTimeout(function() {
    try {
        req.abort();
    } catch(e) {}
    navigator.notification.loadingStop();
},timeout);
req.onreadystatechange = function() {
    if (req.readyState == 4) {
        if (req.status < 300) {
            clearTimeout(timer);

            var html = req.responseText;
            //just a debug print   
    alert(html);
    document.write(html);

        }
        navigator.notification.loadingStop();
        delete req;
    }       
};          
req.open('GET', url, true);
req.send();
}

Now, calling from inside onBodyLoad():

loadHTML('http://www.wordreference.com',10000); 

Opens the link in the PhoneGap Container,which is fine. The point is that I want to load a dynamic page written in Python

loadHTML('http://www.mysite.com/cgi-bin/index.py',10000)

At this point Safari is not called but a black page in the PhoneGap container is displayed!! I want to point out that the link is perfectly working if I type it in Safari( I cannot report it for privacy issues).

Could be it a problem related to some kind of needed permission???

I found something similar relative to PhoneGap for BlackBerry and the proposed solution was to modify a config.xml file with

<access subdomains="true" uri="http://www.mysite.com/" />

I tried to add this tag directly in my index.html but it doesn't work.

Is there any similar approach for iPhone??

Thanks a lot


Source: (StackOverflow)

JavaScript load a page on button click

I am trying to do a very simple task here, I would like to be able to click a button on a page and have it take me to another page. I have tried window.location.href, and a bunch of other things and it does nothing. I have tried different platforms and different browsers, all with the same result.

I know that it can call a function but I just cannot get the new page to load. Also this is all in my local file system and both pages live at the same level (but I have also tried to load an external page like www.apple.com).

Any thoughts?

Thanks Patrick


Source: (StackOverflow)

Elastic Load Balancing in EC2 [closed]

It's been on the cards for a while, but now that Amazon have released Elastic Load balancing (ELB), what are your thoughts on deploying this solution for a high-traffic web application?

Should we replace HAProxy or consider ELB as a complimentary service in front of HAProxy?


Source: (StackOverflow)