<?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>Unreal Expectations &#187; uncategorized</title>
	<atom:link href="http://unrealexpectations.com/blog/category/uncategorized/feed/" rel="self" type="application/rss+xml" />
	<link>http://unrealexpectations.com/blog</link>
	<description>That actually worked??!??</description>
	<lastBuildDate>Sun, 04 Dec 2011 09:02:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.3</generator>
		<item>
		<title>XMPPFramework / iOS / libidn / -all_load failure</title>
		<link>http://unrealexpectations.com/blog/2011/12/xmppframework-ios-libidn-all_load-failure/</link>
		<comments>http://unrealexpectations.com/blog/2011/12/xmppframework-ios-libidn-all_load-failure/#comments</comments>
		<pubDate>Sun, 04 Dec 2011 09:02:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[uncategorized]]></category>

		<guid isPermaLink="false">http://unrealexpectations.com/blog/?p=238</guid>
		<description><![CDATA[<p>As I integrated the XMPPFramework it requires the libidn library for a couple of methods it uses.  The latest version of libidn that the XMPPFramework included as of this writing is 1.15.</p>
<p>Unfortunately, this version seems incompatible with the &#8220;Other Linker Flag&#8221; -all_load that other libraries seem to want to use.  The all_load linker flag appears [...]]]></description>
			<content:encoded><![CDATA[<p>As I integrated the <a href="https://github.com/robbiehanson/XMPPFramework">XMPPFramework</a> it requires the <a href="http://www.gnu.org/s/libidn/">libidn</a> library for a couple of methods it uses.  The latest version of libidn that the XMPPFramework included as of this writing is 1.15.</p>
<p>Unfortunately, this version seems incompatible with the &#8220;Other Linker Flag&#8221; -all_load that other libraries seem to want to use.  The all_load linker flag appears be a work around for a linker bug that pops up when object files within a static library only contain a category and no classes.</p>
<p>From the source: <a href="http://developer.apple.com/mac/library/qa/qa2006/qa1490.html">http://developer.apple.com/mac/library/qa/qa2006/qa1490.html</a></p>
<blockquote><p>IMPORTANT: For 64-bit and iPhone OS applications, there is a linker bug  that prevents -ObjC from loading objects files from static libraries  that contain only categories and no classes. The workaround is to use  the -all_load or -force_load  flags. -all_load forces the linker to load  all object files from every archive it sees, even those without  Objective-C code. -force_load is available in Xcode 3.2 and later. It  allows finer grain control of archive loading. Each -force_load option  must be followed by a path to an archive, and every object file in that  archive will be loaded.</p></blockquote>
<p>Interestingly, most coding conventions will create header and implementation files for categories that are just the categories; hence exposing the defect.  Some library developers have come up with a simple workaround so that the force_load or all_load flags are not required.  The workaround is a simple macro that is added to the category implementation file that just creates a class so that the bug is not exposed.  Don&#8217;t know if it originated in Three20, but this is <a href="https://github.com/facebook/three20/pull/406">first place</a> I came across it.  RestKit also <a href="https://github.com/RestKit/RestKit/issues/239">implemented</a> the macro.</p>
<p>Unfortunately, other library developers have not yet implemented this, and still require the all_load flag to be used.</p>
<p>The use of the all_load flag has been causing the XMPPFramework&#8217;s use of libidn to fail to link.  In part this appears to be the use of older libidn that is included as fat binary,  static library.  Use of the all_load flag often causes this linker error:</p>
<blockquote><p>Undefined symbols for architecture i386:<br />
&#8220;_libintl_bindtextdomain&#8221;, referenced from:<br />
_idna_strerror in libidn.a(strerror-idna.o)<br />
_pr29_strerror in libidn.a(strerror-pr29.o)<br />
_punycode_strerror in libidn.a(strerror-punycode.o)<br />
_stringprep_strerror in libidn.a(strerror-stringprep.o)<br />
_tld_strerror in libidn.a(strerror-tld.o)<br />
&#8220;_libintl_dgettext&#8221;, referenced from:<br />
_idna_strerror in libidn.a(strerror-idna.o)<br />
_pr29_strerror in libidn.a(strerror-pr29.o)<br />
_punycode_strerror in libidn.a(strerror-punycode.o)<br />
_stringprep_strerror in libidn.a(strerror-stringprep.o)<br />
_tld_strerror in libidn.a(strerror-tld.o)<br />
&#8220;_libiconv&#8221;, referenced from:<br />
_str_cd_iconv in libidn.a(striconv.o)<br />
_mem_cd_iconv in libidn.a(striconv.o)<br />
&#8220;_libiconv_open&#8221;, referenced from:<br />
_str_iconv in libidn.a(striconv.o)<br />
&#8220;_libiconv_close&#8221;, referenced from:<br />
_str_iconv in libidn.a(striconv.o)<br />
ld: symbol(s) not found for architecture i386<br />
clang: error: linker command failed with exit code 1 (use -v to see invocation)</p></blockquote>
<p>The iconv errors can be fixed because the iOS framework includes libiconv.a.  It does not include libintl.a.  After downloading version 1.25 of libidn and getting it to install on iOS 5.0, I was able to get rid of errors related to intl.</p>
<p>Here are the commands I used to compile libidn.1.25 and create a fat binary with arm6, arm7, and i386 architecture files.</p>
<p><pre><code>
$ ./configure --host=arm-apple-darwin --disable-shared CC=/Developer/Platforms/iPhoneOS.platform/Developer/usr/llvm-gcc-4.2/bin/llvm-gcc-4.2 CFLAGS=&quot;-arch armv7 -fmessage-length=0 -pipe -std=c99 -Wno-trigraphs -fpascal-strings -O0 -Wreturn-type -Wunused-variable -Wunused-value -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk -fvisibility=hidden -gdwarf-2 -mthumb -miphoneos-version-min=4.0 &quot; CPP=/Developer/Platforms/iPhoneOS.platform/Developer/usr/llvm-gcc-4.2/bin/llvm-cpp-4.2 AR=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ar
$ make clean
$ make
$ cp lib/.libs/libidn.a libidn-arm7.a

$ ./configure --host=arm-apple-darwin --disable-shared CC=/Developer/Platforms/iPhoneOS.platform/Developer/usr/llvm-gcc-4.2/bin/llvm-gcc-4.2 CFLAGS=&quot;-arch armv6 -fmessage-length=0 -pipe -std=c99 -Wno-trigraphs -fpascal-strings -O0 -Wreturn-type -Wunused-variable -Wunused-value -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk -fvisibility=hidden -gdwarf-2 -mthumb -miphoneos-version-min=4.0 &quot; CPP=/Developer/Platforms/iPhoneOS.platform/Developer/usr/llvm-gcc-4.2/bin/llvm-cpp-4.2 AR=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ar
$ make clean
$ make
$ cp lib/.libs/libidn.a libidn-arm6.a

$ ./configure --host=i686-apple-darwin --disable-shared CC=/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/llvm-gcc-4.2/bin/llvm-gcc-4.2 CFLAGS=&quot;-arch i386 -fmessage-length=0 -pipe -std=c99 -Wno-trigraphs -fpascal-strings -O0 -Wreturn-type -Wunused-variable -Wunused-value -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -fvisibility=hidden -gdwarf-2 -mthumb -miphoneos-version-min=4.0 &quot; CPP=/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/llvm-gcc-4.2/bin/llvm-cpp-4.2 AR=/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/ar
$ make clean
$ make
$ cp lib/.libs/libidn.a libidn-i386.a

$ lipo -create libidn-i386.a libidn-arm6.a libidn-arm7.a -output libidn.a
</code></pre></p>
<p>After importing the new libidn,a, I still received the linking errors with libiconv.  Added that to the library link list and afterwards all worked.</p>
]]></content:encoded>
			<wfw:commentRss>http://unrealexpectations.com/blog/2011/12/xmppframework-ios-libidn-all_load-failure/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Multiple Language Meta Descriptions / One Page</title>
		<link>http://unrealexpectations.com/blog/2011/05/multiple-language-meta-descriptions-one-page/</link>
		<comments>http://unrealexpectations.com/blog/2011/05/multiple-language-meta-descriptions-one-page/#comments</comments>
		<pubDate>Tue, 17 May 2011 22:53:41 +0000</pubDate>
		<dc:creator>mleo</dc:creator>
				<category><![CDATA[uncategorized]]></category>

		<guid isPermaLink="false">http://unrealexpectations.com/blog/?p=228</guid>
		<description><![CDATA[<p>During a post implementation design review today, the design and implementation failed to meet the basic one requirement of the enhancement.  The requirement was to ensure the site in question would respond to Katakana characters when searched through google.co.jp.   The english title of the site is returned quite high, but when using [...]]]></description>
			<content:encoded><![CDATA[<p>During a post implementation design review today, the design and implementation failed to meet the basic one requirement of the enhancement.  The requirement was to ensure the site in question would respond to Katakana characters when searched through google.co.jp.   The english title of the site is returned quite high, but when using the Katakana characters it fails.</p>
<p>The site in question is english only and so it mostly makes sense that it fails in google search results for Katakana.  So the requirement was how to make the site appear utilizing Katakana.  </p>
<h2>Technical Solution<br />
</h2>
<p>The developer went off and designed and implemented a solution.  The solution relied upon the Accept-Language header in HTTP request to load a resource file and return a Katana localized version of the title and description if the preferred language is Japanese.   Logically, seems to make sense.  Change the default language on the browser and get the localized content.  </p>
<p>Except there is a hole in the solution you can drive a bus through.  When the googlebot crawler indexes sights it doesn&#8217;t have different crawlers for google.com versus google.co.jp versus other localized google sites.  It has a single googlebot that indexes pages and doesn&#8217;t provide a language header.  With the change, google would not appear to have interpreted the page in any way different, which is the case because it doesn&#8217;t get any different HTML.</p>
<p>From the Google Webmaster <a href=" http://googlewebmastercentral.blogspot.com/2010/03/working-with-multi-regional-websites.html?showComment=1268645770595#c7824467655005356998">Blog</a> we know content negotiation is bad.</p>
<blockquote><p>@Simon Content negotiation is bad because search engines will only be able to see one of the versions (and might never see the other one). Also, many users (including me) don&#8217;t like it when they click on a search result that is not shown in the same language as their query (and the snippet) (actually, I personally don&#8217;t just not like it, it makes me quite mad <img src='http://unrealexpectations.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> ).
</p></blockquote>
<h3>SEO Solution</h3>
<p>Examining that the technical delivery failed, I backed up from there on the original solution concept.  </p>
<p>The solution concept was to just add the Katana characters after the title and as a second description.  According the the following <a href="http://www.seoptimise.com/blog/2011/04/google-test-multiple-meta-descriptions-work-as-expected-social-search-does-not.html">information</a> who experimented upon other results found, as expected, that google ignores multiple meta-description tags.  It points to other article about partial success in google summaries using more relevant sentence from multi line description.</p>
<p>So the point of this is to try and see how multi languages will work in context of a description.  Will update with results.</p>
<h3>Update 1</h3>
<p>The first launch failed miserably because the theme is not setting or pulling in the meta title or description fields.</p>
]]></content:encoded>
			<wfw:commentRss>http://unrealexpectations.com/blog/2011/05/multiple-language-meta-descriptions-one-page/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using YAML as Response Format for Services in Spring</title>
		<link>http://unrealexpectations.com/blog/2010/03/using-yaml-as-response-format-for-services-in-spring/</link>
		<comments>http://unrealexpectations.com/blog/2010/03/using-yaml-as-response-format-for-services-in-spring/#comments</comments>
		<pubDate>Tue, 02 Mar 2010 19:26:20 +0000</pubDate>
		<dc:creator>mleo</dc:creator>
				<category><![CDATA[uncategorized]]></category>

		<guid isPermaLink="false">http://unrealexpectations.com/blog/?p=89</guid>
		<description><![CDATA[<p>Recently, we were developing an iPhone application where the iPhone developer was insistent on utilizing YAML as the response format for service calls.  This seemed odd given the prevalence of JSON as a response format and an already built library for parsing and handling JSON within Objective C that works with the iPhone SDK. [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, we were developing an iPhone application where the iPhone developer was insistent on utilizing <a href="http://www.yaml.org/">YAML</a> as the response format for service calls.  This seemed odd given the prevalence of JSON as a response format and an already built <a href="http://code.google.com/p/json-framework/">library</a> for parsing and handling JSON within Objective C that works with the iPhone SDK.  The other advantage to JSON is there is another <a href="http://spring-json.sourceforge.net/">project</a> that has built a JSON view resolver for converting model/domain objects into JSON.   The advantage with YAML is that it inherently supports circular references and can resolve them during serialization and deserialization.  While domain objects can have circular references in design, I try to keep them minimal and out of the model objects to ensure most serialization techniques work easily.</p>
<p>I couldn&#8217;t quickly find any YAML Spring View support so went about working through my own.  Using the source of the JSON Spring View project as baseline I was quickly able to build out a <em>baseline</em> view handler.  I say <em>baseline</em> because I haven&#8217;t fully unit tested the code as yet.  </p>
<p><strong>YamlView Class</strong><br />
This makes use of the <a href="http://jyaml.sourceforge.net/">jyaml</a> library. </p>
<p><pre><code>
public class YamlView extends AbstractView {
    private static final String DEFAULT_YAML_CONTENT_TYPE = &quot;application/yaml&quot;;

    public YamlView() {
        super();
        setContentType(DEFAULT_YAML_CONTENT_TYPE);
    }

    /**
     * Creates a YAML String from the model values.
     */
    @SuppressWarnings(&quot;unchecked&quot;)
    protected final String defaultCreateYaml(Map model) {
        return Yaml.dump(model);
    }

    /**
     * Creates a Yaml String from the model values.
     */
    @SuppressWarnings(&quot;unchecked&quot;)
    protected String createYaml(Map model, HttpServletRequest request, HttpServletResponse response) {
        return defaultCreateYaml(model);
    }

    @SuppressWarnings(&quot;unchecked&quot;)
    @Override
    protected void renderMergedOutputModel(Map model, HttpServletRequest request, HttpServletResponse response)
            throws Exception {

        response.setContentType(getContentType());
        writeYaml(model, request, response);
    }

    @SuppressWarnings(&quot;unchecked&quot;)
    protected void writeYaml(Map model, HttpServletRequest request, HttpServletResponse response) throws Exception {
        
        String yaml = createYaml(model, request, response);
        response.getWriter().write(yaml);
        
    }
}
</code></pre></p>
<p><strong>Configuration: applicationContext.xml</strong><br />
In one of the Spring configuration files where the web presentation layer is set.<br />
<pre><code>
...
  &lt;bean name=&quot;xmlViewResolver&quot; 
        class=&quot;org.springframework.web.servlet.view.XmlViewResolver&quot; 
        p:order=&quot;3&quot; 
        p:location=&quot;classpath:xmlViews.xml&quot; /&gt;        
...
</code></pre><br />
The order is in place because this configuration file has multiple ViewResolvers.  The xmlViews.xml then has the configuration:<br />
<pre><code>
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;beans xmlns=&quot;http://www.springframework.org/schema/beans&quot;
  xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
  xmlns:context=&quot;http://www.springframework.org/schema/context&quot;
  xmlns:p=&quot;http://www.springframework.org/schema/p&quot;
  xsi:schemaLocation=&quot;http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd&quot;&gt;

    &lt;bean name=&quot;jsonView&quot; class=&quot;org.springframework.web.servlet.view.json.JsonView&quot;/&gt;

    &lt;bean name=&quot;yamlView&quot; class=&quot;com.example.web.view.YamlView&quot;/&gt;
    
&lt;/beans&gt;
</code></pre></p>
<p>And finally, the usage within a controller:</p>
<p><pre><code>
public class ExampleController extends AbstractCommandController {
...
  @Override
  protected ModelAndView handle(HttpServletRequest request,
      HttpServletResponse response, Object command, BindException bindException)
      throws Exception {
    
...
    String viewType = &quot;jsonView&quot;;
    if (request.getRequestURI().endsWith(&quot;.yaml&quot;)) {
      viewType = &quot;yamlView&quot;;
    }
    
    return new ModelAndView(viewType, model);
  }  
...
}

</code></pre></p>
<p>It really is amazing the little amount of custom code required these days to get great results.</p>
]]></content:encoded>
			<wfw:commentRss>http://unrealexpectations.com/blog/2010/03/using-yaml-as-response-format-for-services-in-spring/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

