Posts Tagged ‘bug’

Amazon PHP SDK v1.4.7 set_region bug for EC2: DNS names not properly resolved

Saturday, December 3rd, 2011

Version 1.4.7 of the Amazon PHP SDK added the new Oregon region (along with the United States government private GovCloud region) but introduced a bug rendering the whole library useless as it cannot resolve the correct DNS names.

Prior to v1.4.7, the AmazonEC2 library used these constants (in /usr/share/php/AWSSDKforPHP/services/ec2.class.php):

    /*%******************************************************************************************%*/
    // CLASS CONSTANTS

    /**
     * Specify the default queue URL.
     */
    const DEFAULT_URL = 'ec2.amazonaws.com';

    /**
     * Specify the queue URL for the US-East (Northern Virginia) Region.
     */
    const REGION_US_E1 = 'us-east-1';

    /**
     * Specify the queue URL for the US-West (Northern California) Region.
     */
    const REGION_US_W1 = 'us-west-1';

    /**
     * Specify the queue URL for the EU (Ireland) Region.
     */
    const REGION_EU_W1 = 'eu-west-1';

    /**
     * Specify the queue URL for the Asia Pacific (Singapore) Region.
     */
    const REGION_APAC_SE1 = 'ap-southeast-1';

    /**
     * Specify the queue URL for the Asia Pacific (Japan) Region.
     */
    const REGION_APAC_NE1 = 'ap-northeast-1';

And the code used to reconstruct the DNS entry was

    /**
     * This allows you to explicitly sets the region for the service to use.
     *
     * @param string $region (Required) The region to explicitly set. Available options are <REGION_US_E1>, <REGION_US_W1>, <REGION_EU_W1>, or <REGION_APAC_SE1>.
     * @return $this A reference to the current instance.
     */
    public function set_region($region)
    {
        $this->set_hostname('http://ec2.'. $region .'.amazonaws.com');
        return $this;
    }

With the upgrade to v1.4.7, those constants were changed to a FQDN, while the set_region() function was not changed at all:

    /*%******************************************************************************************%*/
    // CLASS CONSTANTS

    /**
     * Specify the queue URL for the United States East (Northern Virginia) Region.
     */
    const REGION_US_E1 = 'ec2.us-east-1.amazonaws.com';

    /**
     * Specify the queue URL for the United States West (Northern California) Region.
     */
    const REGION_US_W1 = 'ec2.us-west-1.amazonaws.com';

    /**
     * Specify the queue URL for the United States West (Oregon) Region.
     */
    const REGION_US_W2 = 'ec2.us-west-2.amazonaws.com';

    /**
     * Specify the queue URL for the Europe West (Ireland) Region.
     */
    const REGION_EU_W1 = 'ec2.eu-west-1.amazonaws.com';

    /**
     * Specify the queue URL for the Asia Pacific Southeast (Singapore) Region.
     */
    const REGION_APAC_SE1 = 'ec2.ap-southeast-1.amazonaws.com';

    /**
     * Specify the queue URL for the Asia Pacific Northeast (Tokyo) Region.
     */
    const REGION_APAC_NE1 = 'ec2.ap-northeast-1.amazonaws.com';

    /**
     * Specify the queue URL for the United States GovCloud Region.
     */
    const REGION_US_GOV1 = 'ec2.us-gov-west-1.amazonaws.com';

So, for instance, if you were using REGION_US_W1 before,
the old SDK would resolve the url to ‘http://ec2.us-west-1.amazonaws.com’ using set_region()

As of v1.4.7, REGION_US_W1 was changed to
‘ec2.us-west-1.amazonaws.com’
so now set_region() builds the url as the non very pretty
‘http://ec2.ec2.us-west-1.amazonaws.com.amazonaws.com’

and triggers this PHP fatal error

PHP Fatal error:  Uncaught exception 'RequestCore_Exception' with message 'cURL resource: Resource id #62; cURL error: Couldn't resolve host 'ec2.ec2.us-west-1.amazonaws.com.amazonaws.com' (6)' in /usr/share/php/AWSSDKforPHP/lib/requestcore/requestcore.class.php:824
Stack trace:
#0/usr/share/php/AWSSDKforPHP/sdk.class.php(1185): RequestCore->send_request()

To fix the error, modify set_region to:

    public function set_region($region)
    {
        //$this->set_hostname('http://ec2.'. $region .'.amazonaws.com');
        $this->set_hostname('http://'.$region);
        return $this;
    }

——————————————————————
Update 12/07/2011:
Version 1.4.8 of the PHP SDK corrects the bug.

Upgrade to the latest Microsoft Advertising SDK for Windows Phone 7 to avoid application crashes

Thursday, February 10th, 2011

Microsoft provides an ad control to integrate in Windows Phone applications.

The first version of the SDK, namely 2.1.9130.1 released on Sept.29 2010, has a critical bug that crashes your whole application when the ads are set to auto rotation.

You know you’re affected if your application unexpectedly crashes with an “Element is already the child of another element.” error message:

System.InvalidOperationException was unhandled
  Message=Element is already the child of another element.
  StackTrace:
       at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
       at MS.Internal.XcpImports.Collection_AddValue[T](PresentationFrameworkCollection`1 collection, CValue value)
       at MS.Internal.XcpImports.Collection_AddDependencyObject[T](PresentationFrameworkCollection`1 collection, DependencyObject value)
       at System.Windows.PresentationFrameworkCollection`1.AddDependencyObject(DependencyObject value)
       at System.Windows.Controls.UIElementCollection.AddInternal(UIElement value)
       at System.Windows.PresentationFrameworkCollection`1.Add(UIElement value)
       at Microsoft.Advertising.Mobile.UI.AdFrameManager.CreateNewFrame(FrameworkElement[] controls)
       at Microsoft.Advertising.Mobile.UI.AdFrameManager.DisplayNextFrame(Boolean newAd)
       at Microsoft.Advertising.Mobile.UI.AdFrameManager.ResumeFrameRotation()
       at Microsoft.Advertising.Mobile.UI.AdControl.ActivateAdControl()
       at Microsoft.Advertising.Mobile.UI.AdControl.OnParentSelectionChanged(Object sender, SelectionChangedEventArgs e)

The workaround so far was to disable auto rotation:

xmlns:ad="clr-namespace:Microsoft.Advertising.Mobile.UI;assembly=Microsoft.Advertising.Mobile.UI"

<ad:AdControl AdModel="Contextual" AdUnitId="123" ApplicationId="123456" RotationEnabled="False" />

On December 8th 2010, Microsoft released an update to the SDK, version 2.1.11120.1

This update seems to have fixed the problem and can be downloaded here.

If you’re running ads in your apps on WP7, please do upgrade to the latest version as you may not even be aware of this bug.

Microsoft showed a lack of communication about this update:

1/ The blog post announcing the update doesn’t describe what the update consists of, and which bugs it fixes

2/ The download page does not have any changelog of overview describing what bug fixes and features are included in the update

In contrast, the Windows Phone Developer Tools January 2011 Update download page does have an Overview section summarizing the important changes.

3/ No email or communication was sent to the PubCenter users.

As a PubCenter member I receive updates on how great PubCenter is, that it represents 33.8% of U.S search queries with the partnership with Yahoo! and other communications explaining how to use PubCenter.

4/ No message in the “What’s New” section of the PubCenter advertises the update.

The last message I have from this section dates back to September.

How come, with at least 4 different communication channels listed above, I’m not alerted when something really important happens, like an update to a buggy SDK?

Did I completely miss it?
Or was it an intentional silent update to avoid admitting an embarrassing bug?

A search on “Element is already the child of another element” in the PubCenter forums yields nothing.

The same search on the Windows Phone 7 developer forums returns 2 main threads:

One with a user (Momenta aka Matt Dotson) posting a workaround on December 18th, 10 days after the release of the SDK update, so obviously he was not aware of the update either.

Another thread started on November 16th with user as far as Jan. 23rd posting they encounter the problem before a Microsoft employee (Mark Chamberlain) suggests using the latest Advertising SDK:

Are you folks using the latest Advertising SDK?

http://www.microsoft.com/downloads/en/details.aspx?FamilyID=b0f00afc-9709-4cc2-ba2c-57728db6cbd6

I found an internal email thread suggesting that it is the cure for the issue (Element is already the child of another element)

Hope this helps,
Mark

Obviously I was not the only one not knowing about the update.

To the Microsoft Advertising SDK team, could you please be more communicative about your updates and bug fixes?

Developers would greatly appreciate.

——————————————————————

Update 02/11/2011:
MSFT responded favorably to our request for more communication.
Thanks guys for being proactive and listening to your developer community.
MSFT is doing a great job following and supporting their dev community for Windows Phone 7, we’re impressed.

Update 03/24/2011:
Well we’re not impressed anymore: on 02/11 Douglas Robb from Microsoft acknowledged the problem this way:

Thanks for the suggestion. We hear you. Those above me also hear you. When I say ‘those above me’ that means pretty much everybody, so have no fear, the word is out.

And we falsely assumed the next release would be… advertised (pun intended).
It was not: a new version was released on 03/04.
Thanks again to Mark Chamberlain to let the WP7 devs know about it.

We urged them again to correct this situation and hopefully next time have the new release properly advertised.
In the meantime, the only way to tell a new release is out is too… refresh the download page everyday.
Oh so lame in 2011 when they could have used one of those (modern?) communication channels:
- a special email sent just for the release
- the “weekly blog recap” email blast
- “Messages” section of the dashboard
- the pubCenter blog

Even more confusing: Only the XNA version of the SDK was updated, not the Silverlight:

Before installing the latest version (and using the Dec. 08 2010 version):
Microsoft.Advertising.Mobile.UI.dll is at version 2.1.11120.1, filesize 89,912 bytes
Microsoft.Advertising.Mobile.Xna.dll is at version 5.1.0.148, filesize 214,400 bytes

After installing
Microsoft.Advertising.Mobile.UI.dll is at version 2.1.11120.1, filesize 89,912 bytes (NO CHANGE)
Microsoft.Advertising.Mobile.Xna.dll is at version 5.1.0.166, filesize 216,472 bytes

It can be extremely confusing because the download page is now using the version of the XNA DLL and shows 5.1.0.166 as the version number, which is correct for the XNA library only.
Previously this same download page was using the version of the Silverlight DLL (2.1.11120.1) to show the version.

Dear PubCenter, obviously you cannot switch between using the Silverlight version of the DLL and the XNA version.
Either provide 2 different downloads links with their respective version tied to the DLL version and separate the DLLs, or come up with a compounded version number.
Next time you update the Silverlight SDK, your download link will have a version starting in 2.X, don’t you think that will confuse everyone using the latest 5.1.0.166?

Update 03/30/2011:
Microsoft now advertising updates and the changelog.
These are for the Silverlight update of December 8th 2010 and the XNA update of March 4th 2011 (about time to get the changelogs…).
Hopefully next release will be advertised the proper way through different communication channels (blog, emails, newsletter, twitter) along with a much needed changelog.

Update 04/05/2011:
Troy Wood, Portfolio Manager for Windows Phone 7 App Publishers writes:
“Starting with 5.2, both, Silverlight and XNA will use same 5.2.xxxx.y version number.”
Seems the revision problem is fixed for next release.

IE bug: text disappearing randomly behind a picture

Wednesday, January 20th, 2010

Even though the text had a high z-index, it would disappear after few seconds behind the picture it’s supposed to be on, or when you switch to another Windows application then come back on the browser.

This erratic behavior turned out to be when IE doesn’t have a Doctype declared.

CakePHP doesn’t define any Doctype by default, so you need to edit your default layout and include it.

In CakePHP 1.1: edit app/views/layout/default.hthml

In CakePHP 1.1: edit app/views/layout/default.ctp

and add:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

… at the very top, before the html tag.

This happens not even on an old IE6, but on IE8 itself.

IE bug: don’t put extra commas in your JS arrays

Monday, January 18th, 2010

Here’s a simple Javascript array:

var params={
         'uid':uid,
         'comment':'hello',
};

Nothing fancy except that after the ‘hello’ string, there’s an extra comma that should not be there.

Firefox and Chrome don’t care, it still works.

But IE7 hates it, crashes the page and throws and error, with a ludicrous line number in it (did I write that much code?):

Message: Expected identifier, string or number  Line: 225068230

Remove the extra comma and you’re done.

Note that you can see the problem in IE8 also by enabling debugging (hit F12) and set the Document Mode to IE7 Standards.