Selenium IDE typeKeys does not fire event

You may have an input on a form that fires an onblur, onFocus, onChange, onKeyUp, onKeyDown, etc event that doesn’t get fired as it should. Use the “fireEvent” command in selenium ide after entering the value.

Selenium IDE typeKeys missing dot, period, or decimal

I discovered a bug in the Selenium IDE today where I needed to use the typeKeys command and the value included a period. The period would be stripped out for some reason. The solution is to break the command into two separate commands. First, use the “type” command and include the period or dot in the value (nick@gmail.). Then, create another command on the same input and use the “typeKeys” command to add the rest of the value (com).

How to modify paypal subscription

In short, you don’t.  I searched high and low for this simple feature and apparently it does not exist.  I contacted Paypal and asked where the functionality was.  Their response:

“Once existing subscriptions are in place they can not be changed. You
must close the existing transaction then create a new one for the proper
amount.”

Microsoft CRM iframe cookies not getting set

The sales team for my employer uses Microsoft CRM to track their leads and customers…. aside from our internal application my team develops in PHP. I won’t get into how CRM magically appeared one day, but now it’s something I get to attempt to integrate with.

Anyway, for each “account”, they have a tab and iframe that points to linkedin.com that automatically searches linkedin for the customer’s name. The user is required to log into linked in the first time to create a session. My task was to create another tab and iframe that points to our internal application. Easy right? Well, the problem was you couldn’t log in. After a couple hours of some debugging, playing around with CRM, I found that no cookies where being set after submitting the login form. After a crap ton of googling, I came across the answer here http://www.aspnetresources.com/blog/frames_webforms_and_rejected_cookies.aspx .

The solution, for PHP, is to add a header for the P3P privacy policy like so
header(’P3P:CP=”IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT”‘);

Now that you’ve gotten this far, hopefully your site doesn’t have a lot of JavaScript and dynamic content as it may not function properly within the iframe.

Easy caching for PHP

I just implemented this cache class
http://www.phpguru.org/static/Caching on one of my sites.

The product detail page
ALR Hyperdrive 3.0 has eight or ten queries that run every time to pull the product info, nutrition info, reviews, manufacturer info, category info, etc…  This cache class provides the ability to store either output cache (html) or data cache (query results) in a file.  Each time the page is loaded, we’ll first check if there is a cached file of the output before running all the queries.  If there is a cache file, we’ll grab it and display.  If not, we’ll run the queries as usual and then save the output to a file.  We’re able to set an expiration on the cache file so it automatically refreshes itself in case the content has changed.

Example for caching output

    if (!OutputCache::Start("myGroup", "myID", 600)) {
 
        // Generate some output (as you do)...
 
        OutputCache::End();
    }

Example for caching data structures and query results

    if (!$data = DataCache::Get("myGroup", "myOtherID")) {
 
        $result = $db->query("SELECT BIG_ASS_QUERY()");
 
        DataCache::Put("myGroup", "myOtherID", 600, $result);
    }
 
    // Do something useful with $result

The page on my site ALR Hyperdrive 3.0 took on average 9 seconds from the time I clicked the refresh button until it was completely loaded.  I added the few lines of code for output caching on the page so it would skip all product related queries and it then averaged 7.5 seconds per page load and database processing and bandwidth in the meantime.  I was hoping the pages would load in two or three seconds, but this is a great improvement for the little effort it took.