How do you test running time of VBA code?

Unless your functions are very slow, you’re going to need a very high-resolution timer. The most accurate one I know is QueryPerformanceCounter. Google it for more info. Try pushing the following into a class, call it CTimer say, then you can make an instance somewhere global and just call .StartCounter and .TimeElapsed Option Explicit Private … Read more

Unit Testing C Code [closed]

One unit testing framework in C is Check; a list of unit testing frameworks in C can be found here and is reproduced below. Depending on how many standard library functions your runtime has, you may or not be able to use one of those. AceUnit AceUnit (Advanced C and Embedded Unit) bills itself as … Read more

Best way to compare 2 XML documents in Java

Sounds like a job for XMLUnit http://www.xmlunit.org/ https://github.com/xmlunit Example: public class SomeTest extends XMLTestCase { @Test public void test() { String xml1 = … String xml2 = … XMLUnit.setIgnoreWhitespace(true); // ignore whitespace differences // can also compare xml Documents, InputSources, Readers, Diffs assertXMLEqual(xml1, xml2); // assertXMLEquals comes from XMLTestCase } }

Python Selenium wait for several elements to load

First and foremost the elements are AJAX elements. Now, as per the requirement to locate all the desired elements and create a list, the simplest approach would be to induce WebDriverWait for the visibility_of_all_elements_located() and you can use either of the following Locator Strategies: Using CSS_SELECTOR: elements = WebDriverWait(driver, 20).until(EC.visibility_of_all_elements_located((By.CSS_SELECTOR, “ul.ltr li[id^=’t_b_’] > a[id^=’t_a_’][href]”))) Using … Read more

How to avoid “StaleElementReferenceException” in Selenium?

This can happen if a DOM operation happening on the page is temporarily causing the element to be inaccessible. To allow for those cases, you can try to access the element several times in a loop before finally throwing an exception. Try this excellent solution from darrelgrainger.blogspot.com: public boolean retryingFindClick(By by) { boolean result = … Read more

How can one check to see if a remote file exists using PHP?

You can instruct curl to use the HTTP HEAD method via CURLOPT_NOBODY. More or less $ch = curl_init(“http://www.example.com/favicon.ico”); curl_setopt($ch, CURLOPT_NOBODY, true); curl_exec($ch); $retcode = curl_getinfo($ch, CURLINFO_HTTP_CODE); // $retcode >= 400 -> not found, $retcode = 200, found. curl_close($ch); Anyway, you only save the cost of the HTTP transfer, not the TCP connection establishment and closing. … Read more