<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>web2.0goodies.com &#187; workarounds</title>
	<atom:link href="http://web2.0goodies.com/blog/category/workarounds/feed/" rel="self" type="application/rss+xml" />
	<link>http://web2.0goodies.com/blog</link>
	<description>Tips, Tricks, and How To's for Web 2.0</description>
	<lastBuildDate>Tue, 03 Jan 2012 05:34:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>vimeo OEmbed service rejects Apache Commons Http Client User Agent</title>
		<link>http://web2.0goodies.com/blog/social-media/vimeo-oembed-service-rejects-apache-commons-http-client-user-agent/</link>
		<comments>http://web2.0goodies.com/blog/social-media/vimeo-oembed-service-rejects-apache-commons-http-client-user-agent/#comments</comments>
		<pubDate>Thu, 24 Feb 2011 19:06:26 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Social Media]]></category>
		<category><![CDATA[workarounds]]></category>

		<guid isPermaLink="false">http://web2.0goodies.com/blog/social-media/vimeo-oembed-service-rejects-apache-commons-http-client-user-agent/</guid>
		<description><![CDATA[Recently I was working on implementing an OEmbed client for work, and I spent a while trying to figure out why an oembed lookup worked in firefox, but not in my Java Service&#8230; The url was:&#160; http://www.vimeo.com/api/oembed.xml?url=http://vimeo.com/17853047&#38;maxwidth=320&#38;maxheight=200&#38;format=xml For whatever reason, everytime I was making the request in my service I was receiving a 404 error.&#160; [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I was working on implementing an OEmbed client for work, and I spent a while trying to figure out why an oembed lookup worked in firefox, but not in my Java Service&#8230;</p>
<p>The url was:&nbsp; http://www.vimeo.com/api/oembed.xml?url=http://vimeo.com/17853047&amp;maxwidth=320&amp;maxheight=200&amp;format=xml</p>
<p>For whatever reason, everytime I was making the request in my service I was receiving a 404 error.&nbsp; I used tamper data in Firefox 3.6 to remove ALL headers except the host header, and it worked&#8230;&nbsp; So, I set the user agent for apache commons HttpClient to a mozilla user agent string instead of the default &#8220;Jakarta Commons-HttpClient/3.1&#8243;&nbsp; Just to verify this was the problem, I used tamper data again to set the User Agent for a request from firefox to &#8220;Jakarta Commons-HttpClient/3.1&#8243; and I received a 404 error&#8230;</p>
<p>The User-Agent string I used is: &#8220;Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101206 Ubuntu/10.04 (lucid) Firefox/3.6.13&#8243;</p>
<p>
<div class="zemanta-pixie"><img class="zemanta-pixie-img" alt="" src="http://img.zemanta.com/pixy.gif?x-id=6a5e4ec9-6a14-8e40-806f-379379ae4f2e" /></div>
]]></content:encoded>
			<wfw:commentRss>http://web2.0goodies.com/blog/social-media/vimeo-oembed-service-rejects-apache-commons-http-client-user-agent/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>nicEdit Firefox center and right align bug patch.</title>
		<link>http://web2.0goodies.com/blog/javascript/nicedit-firefox-center-and-right-align-bug-patch/</link>
		<comments>http://web2.0goodies.com/blog/javascript/nicedit-firefox-center-and-right-align-bug-patch/#comments</comments>
		<pubDate>Wed, 28 Jul 2010 16:54:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[firefox]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[workarounds]]></category>
		<category><![CDATA[wysiwyg editors]]></category>

		<guid isPermaLink="false">http://web2.0goodies.com/blog/javascript/nicedit-firefox-center-and-right-align-bug-patch/</guid>
		<description><![CDATA[If you are using nicEdit on content editable areas instead of the iFrame method, then you may have run across the FireFox bug that prevents you from changing the text alignment on the first line of a content editable element.&#160; As a work around, change the nicCommand method in nicEdit.js (Line 610 or so), to [...]]]></description>
			<content:encoded><![CDATA[<p>If you are using nicEdit on content editable areas instead of the iFrame method, then you may have run across the FireFox bug that prevents you from changing the text alignment on the first line of a content editable element.&nbsp; </p>
<p>As a work around, change the nicCommand method in nicEdit.js (Line 610 or so), to the below.  This code catches the error that firefox throws, inserts a temporary div immediately before the selection, repeats the call that failed (the bug only causes the alignment to fail when it is the very first element in the content editable), and then removes the temporary div.</p>
<pre>
nicCommand : function(cmd, args) {
        if ((cmd == 'justifyright') || (cmd == 'justifyleft') || (cmd ==
        'justifycenter') || (cmd == 'justifyfull')) {
              try {
                 document.execCommand(cmd, false, null);
              }
              catch (e) {
                 //special case for Mozilla Bug #442186
                 if (e &amp;&amp; e.result == 2147500037) {
                    //probably firefox bug 442186 - workaround
                    var range = window.getSelection().getRangeAt(0);
                    var dummy = document.createElement('div');

                     //To restore the range after collapsing for triple click bug...
                     var restoreSelection = false;
                    dummy.style.height="1px;";

                    //find node with contentEditable

                    //Triple Click selection Problem in mozilla, the selection contains the content editable div, which creates a problem for some reason, so we collapse the selection to the end, and then re-select everything...
                    if(range.startContainer.contentEditable == 'true'){
                        window.getSelection().collapseToEnd();
                        restoreSelection = true;
                    }

                    var ceNode = window.getSelection().getRangeAt(0).startContainer;

                    while (ceNode &amp;&amp; ceNode.contentEditable != 'true')
                       ceNode = ceNode.parentNode;

                    if (!ceNode) throw 'Selected node is not editable!';

                    ceNode.insertBefore(dummy, ceNode.childNodes[0]);
                    document.execCommand(cmd, false, null);
                    dummy.parentNode.removeChild(dummy);

                     //RestoreSelection if we changed it...
                     if(restoreSelection){
                        window.getSelection().addRange(range);
                     }
                 } else if (console &amp;&amp; console.log) console.log(e);
              }
           } else {
              document.execCommand(cmd, false, args);
      }
    }
</pre>
<div class="zemanta-pixie"><img class="zemanta-pixie-img" alt="" src="http://img.zemanta.com/pixy.gif?x-id=10a8a059-a566-8e45-9330-fcfb2c7438f2" /></div>
]]></content:encoded>
			<wfw:commentRss>http://web2.0goodies.com/blog/javascript/nicedit-firefox-center-and-right-align-bug-patch/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

