<?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>Ugly Code! &#187; Uncategorized</title>
	<atom:link href="http://uglycode.com/category/uncategorized/feed/" rel="self" type="application/rss+xml" />
	<link>http://uglycode.com</link>
	<description>c0ding is seriose busines!!!!1</description>
	<lastBuildDate>Thu, 15 Jul 2010 20:03:01 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>appropriate method name</title>
		<link>http://uglycode.com/2010/07/appropriate-method-name/</link>
		<comments>http://uglycode.com/2010/07/appropriate-method-name/#comments</comments>
		<pubDate>Wed, 14 Jul 2010 11:48:09 +0000</pubDate>
		<dc:creator>analytik</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[.net]]></category>

		<guid isPermaLink="false">http://uglycode.com/2010/07/appropriate-method-name/</guid>
		<description><![CDATA[
Company.Project.Tests.Listeningtool.IntegrationTest.ListeningToolBrandCategoryAndMentionsReportTest.Should_Add_a_Valid_File_And_The_MentionsByBrandAndCategoryReport_Should_Have_Any_Sentiment_Equal_To_Positive&#40;&#41;

Or, if you prefer,

Company
 .Project
  .Tests
   .Listeningtool
    .IntegrationTest
     .ListeningToolBrandCategoryAndMentionsReportTest
      .Should_Add_a_Valid_File_And_The
       _MentionsByBrandAndCategoryReport_Should_Have
        _Any_Sentiment_Equal_To_Positive&#40;&#41;

]]></description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><div class="code"><pre class="asp" style="font-family:monospace;">Company.<span style="color: #9900cc;">Project</span>.<span style="color: #9900cc;">Tests</span>.<span style="color: #9900cc;">Listeningtool</span>.<span style="color: #9900cc;">IntegrationTest</span>.<span style="color: #9900cc;">ListeningToolBrandCategoryAndMentionsReportTest</span>.<span style="color: #9900cc;">Should_Add_a_Valid_File_And_The_MentionsByBrandAndCategoryReport_Should_Have_Any_Sentiment_Equal_To_Positive</span><span style="color: #006600; font-weight:bold;">&#40;</span><span style="color: #006600; font-weight:bold;">&#41;</span></pre></div></div>

<p>Or, if you prefer,</p>

<div class="wp_syntax"><div class="code"><pre class="asp" style="font-family:monospace;">Company
 .<span style="color: #9900cc;">Project</span>
  .<span style="color: #9900cc;">Tests</span>
   .<span style="color: #9900cc;">Listeningtool</span>
    .<span style="color: #9900cc;">IntegrationTest</span>
     .<span style="color: #9900cc;">ListeningToolBrandCategoryAndMentionsReportTest</span>
      .<span style="color: #9900cc;">Should_Add_a_Valid_File_And_The</span>
       _MentionsByBrandAndCategoryReport_Should_Have
        _Any_Sentiment_Equal_To_Positive<span style="color: #006600; font-weight:bold;">&#40;</span><span style="color: #006600; font-weight:bold;">&#41;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://uglycode.com/2010/07/appropriate-method-name/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to use Exceptions</title>
		<link>http://uglycode.com/2010/05/how-to-use-exceptions/</link>
		<comments>http://uglycode.com/2010/05/how-to-use-exceptions/#comments</comments>
		<pubDate>Mon, 03 May 2010 13:55:02 +0000</pubDate>
		<dc:creator>analytik</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[exceptions]]></category>
		<category><![CDATA[magento]]></category>

		<guid isPermaLink="false">http://uglycode.com/2010/05/how-to-use-exceptions/</guid>
		<description><![CDATA[
   $error = false;
   try
   &#123;
    $response = $comm-&#62;sendRequestToPaymentGate&#40;$this&#41;;
   &#125;
   catch&#40;Exception $e&#41;
   &#123;
    $error = $e;
    $response = null;
   &#125;
   // Save the response's values
   $this-&#62;loadEnrollmentResponse&#40;$response&#41;;
  &#125;
&#160;
 [...]]]></description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">   <span style="color: #000088;">$error</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
   try
   <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$response</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$comm</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">sendRequestToPaymentGate</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   <span style="color: #009900;">&#125;</span>
   catch<span style="color: #009900;">&#40;</span>Exception <span style="color: #000088;">$e</span><span style="color: #009900;">&#41;</span>
   <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$error</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$e</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$response</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">;</span>
   <span style="color: #009900;">&#125;</span>
   <span style="color: #666666; font-style: italic;">// Save the response's values</span>
   <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">loadEnrollmentResponse</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$response</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// Save the progress so transaction process can be continued in the future</span>
  <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">save</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$error</span> <span style="color: #339933;">!==</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
   Mage<span style="color: #339933;">::</span><span style="color: #004000;">throwException</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$error</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getMessage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://uglycode.com/2010/05/how-to-use-exceptions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>As much as I love WordPress&#8230;</title>
		<link>http://uglycode.com/2009/01/as-much-as-i-love-wordpress/</link>
		<comments>http://uglycode.com/2009/01/as-much-as-i-love-wordpress/#comments</comments>
		<pubDate>Sat, 24 Jan 2009 12:44:13 +0000</pubDate>
		<dc:creator>analytik</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[refuctoring]]></category>
		<category><![CDATA[ugly names]]></category>

		<guid isPermaLink="false">http://uglycode.com/?p=29</guid>
		<description><![CDATA[Seems that some WP developers are fans of refuctoring.

if &#40; &#40;$fQ=strpos&#40;$Fid,'&#34;'&#41;&#41;!==false &#41;
    $Fname = sanitize_title_with_dashes&#40;substr&#40; $Fid, $fQ+1, strpos&#40;$Fid,'&#34;',$fQ+1&#41;-$fQ-1 &#41;&#41;;


### wrapped in &#60;p&#62; ?
   $p_offset = &#40;$p_close &#60; $p_open&#41; ? $a-&#40;strlen&#40;$part_content&#41;-$p_open&#41; : $a;

Argh. Guys, seriously, how about some objects? How about some readable variables? How about instead of nesting function calls [...]]]></description>
			<content:encoded><![CDATA[<p>Seems that some WP developers are fans of refuctoring.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$fQ</span><span style="color: #339933;">=</span><span style="color: #990000;">strpos</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$Fid</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'&quot;'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">!==</span><span style="color: #009900; font-weight: bold;">false</span> <span style="color: #009900;">&#41;</span>
    <span style="color: #000088;">$Fname</span> <span style="color: #339933;">=</span> sanitize_title_with_dashes<span style="color: #009900;">&#40;</span><span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$Fid</span><span style="color: #339933;">,</span> <span style="color: #000088;">$fQ</span><span style="color: #339933;">+</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> <span style="color: #990000;">strpos</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$Fid</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'&quot;'</span><span style="color: #339933;">,</span><span style="color: #000088;">$fQ</span><span style="color: #339933;">+</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span><span style="color: #000088;">$fQ</span><span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">### wrapped in &lt;p&gt; ?
</span>   <span style="color: #000088;">$p_offset</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$p_close</span> <span style="color: #339933;">&lt;</span> <span style="color: #000088;">$p_open</span><span style="color: #009900;">&#41;</span> ? <span style="color: #000088;">$a</span><span style="color: #339933;">-</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$part_content</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span><span style="color: #000088;">$p_open</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #000088;">$a</span><span style="color: #339933;">;</span></pre></div></div>

<p>Argh. Guys, seriously, how about some objects? How about some readable variables? How about instead of nesting function calls and using ugly ternary operators&#8230; ugh. Nevermind.</p>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://uglycode.com/2009/01/as-much-as-i-love-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hardcoding FTW</title>
		<link>http://uglycode.com/2008/11/hardcoding-ftw/</link>
		<comments>http://uglycode.com/2008/11/hardcoding-ftw/#comments</comments>
		<pubDate>Sat, 29 Nov 2008 18:19:19 +0000</pubDate>
		<dc:creator>analytik</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[hardcoding]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://uglycode.com/?p=18</guid>
		<description><![CDATA[
function _getCRServices&#40;$data&#41;
  &#123;
    if &#40;is_array&#40;$data&#41;&#41; &#123;
      //this is ehmmmm, d*ment requirement from client
      $not_cr = array&#40;3006, 2416, 1026, 5604, 3501&#41;;
      ...
    &#125;
  &#125;

Makes one wonder if there was a demented requirement, or [...]]]></description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> _getCRServices<span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">is_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #666666; font-style: italic;">//this is ehmmmm, d*ment requirement from client</span>
      <span style="color: #000088;">$not_cr</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">3006</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">2416</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1026</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">5604</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">3501</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #339933;">...</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span></pre></div></div>

<p>Makes one wonder if there was a demented requirement, or just a demented programming technique.</p>
]]></content:encoded>
			<wfw:commentRss>http://uglycode.com/2008/11/hardcoding-ftw/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Who likes ugly hacks?</title>
		<link>http://uglycode.com/2008/09/who-likes-ugly-hacks/</link>
		<comments>http://uglycode.com/2008/09/who-likes-ugly-hacks/#comments</comments>
		<pubDate>Sun, 28 Sep 2008 21:44:41 +0000</pubDate>
		<dc:creator>analytik</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[hacks]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[ugly hack]]></category>

		<guid isPermaLink="false">http://uglycode.com/?p=3</guid>
		<description><![CDATA[According to my search, a lot of people do.

#ugly hack
self.log.info&#40;&#34;Running script&#34;&#41;
dict=&#123; 'self' : self.model,
'model' : self.model,
'interpreter': self &#125;
exec&#40;self.script,dict&#41;


// Ugly hack
Class.forName&#40;&#34;tristero.util.Conduit&#34;&#41;;
Class.forName&#40;&#34;tristero.util.Lock&#34;&#41;;
Class.forName&#40;&#34;tristero.util.PumpListener&#34;&#41;;
Class.forName&#40;&#34;tristero.util.StringUtils&#34;&#41;;


_label.Show&#40;&#41;;
_label.Hide&#40;&#41;; // Ugly hack!
base.Show&#40;&#41;;


 /*
UGLY UGLY UGLY HACK !!!
*/
QFile inFile&#40;uisFile&#41;;
if &#40;!inFile.open&#40;QIODevice::ReadOnly &#124; QIODevice::Text&#41;&#41;
return;
&#160;
QFile outFile&#40;&#34;/tmp/temp.ini&#34;&#41;;
if &#40;!outFile.open&#40;QIODevice::WriteOnly &#124; QIODevice::Text&#41;&#41;
return;
QTextStream in&#40;&#38;inFile&#41;;
QTextStream out&#40;&#38;outFile&#41;;
&#160;
while &#40;!in.atEnd&#40;&#41;&#41;
&#123;
QString line = in.readLine&#40;&#41;;
line.replace&#40;&#34;\\&#34;,&#34;\\\\&#34;);
out &#60;&#60; line &#60;&#60; endl;
}
inFile.close();
outFile.close();
/*
END OF UGLY UGLY UGLY HACK
*/


 // ugly, ugly hack
if&#40;adapterUse.getAdapterIfKnown&#40;&#41;== [...]]]></description>
			<content:encoded><![CDATA[<p>According to my search, a lot of people do.</p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#ugly hack</span>
self<span style="color: #339933;">.</span><span style="color: #000066;">log</span><span style="color: #339933;">.</span>info<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Running script&quot;</span><span style="color: #009900;">&#41;</span>
dict<span style="color: #339933;">=</span><span style="color: #009900;">&#123;</span> <span style="color: #ff0000;">'self'</span> <span style="color: #339933;">:</span> self<span style="color: #339933;">.</span>model<span style="color: #339933;">,</span>
<span style="color: #ff0000;">'model'</span> <span style="color: #339933;">:</span> self<span style="color: #339933;">.</span>model<span style="color: #339933;">,</span>
<span style="color: #ff0000;">'interpreter'</span><span style="color: #339933;">:</span> self <span style="color: #009900;">&#125;</span>
<span style="color: #000066;">exec</span><span style="color: #009900;">&#40;</span>self<span style="color: #339933;">.</span>script<span style="color: #339933;">,</span>dict<span style="color: #009900;">&#41;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// Ugly hack</span>
<span style="color: #000000; font-weight: bold;">Class</span>.<span style="color: #006633;">forName</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;tristero.util.Conduit&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">Class</span>.<span style="color: #006633;">forName</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;tristero.util.Lock&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">Class</span>.<span style="color: #006633;">forName</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;tristero.util.PumpListener&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">Class</span>.<span style="color: #006633;">forName</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;tristero.util.StringUtils&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">_label.<span style="color: #0000FF;">Show</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
_label.<span style="color: #0000FF;">Hide</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span> <span style="color: #008080; font-style: italic;">// Ugly hack!</span>
<span style="color: #0600FF;">base</span>.<span style="color: #0000FF;">Show</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"> <span style="color: #ff0000; font-style: italic;">/*
UGLY UGLY UGLY HACK !!!
*/</span>
QFile inFile<span style="color: #008000;">&#40;</span>uisFile<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
<span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #000040;">!</span>inFile.<span style="color: #007788;">open</span><span style="color: #008000;">&#40;</span>QIODevice<span style="color: #008080;">::</span><span style="color: #007788;">ReadOnly</span> <span style="color: #000040;">|</span> QIODevice<span style="color: #008080;">::</span><span style="color: #007788;">Text</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
<span style="color: #0000ff;">return</span><span style="color: #008080;">;</span>
&nbsp;
QFile outFile<span style="color: #008000;">&#40;</span><span style="color: #FF0000;">&quot;/tmp/temp.ini&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
<span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #000040;">!</span>outFile.<span style="color: #007788;">open</span><span style="color: #008000;">&#40;</span>QIODevice<span style="color: #008080;">::</span><span style="color: #007788;">WriteOnly</span> <span style="color: #000040;">|</span> QIODevice<span style="color: #008080;">::</span><span style="color: #007788;">Text</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
<span style="color: #0000ff;">return</span><span style="color: #008080;">;</span>
QTextStream in<span style="color: #008000;">&#40;</span><span style="color: #000040;">&amp;</span>inFile<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
QTextStream out<span style="color: #008000;">&#40;</span><span style="color: #000040;">&amp;</span>outFile<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
&nbsp;
<span style="color: #0000ff;">while</span> <span style="color: #008000;">&#40;</span><span style="color: #000040;">!</span>in.<span style="color: #007788;">atEnd</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
QString line <span style="color: #000080;">=</span> in.<span style="color: #007788;">readLine</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
line.<span style="color: #007788;">replace</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">&quot;\<span style="color: #000099; font-weight: bold;">\&quot;</span>,&quot;</span>\\\\<span style="color: #FF0000;">&quot;);
out &lt;&lt; line &lt;&lt; endl;
}
inFile.close();
outFile.close();
/*
END OF UGLY UGLY UGLY HACK
*/</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"> <span style="color: #666666; font-style: italic;">// ugly, ugly hack</span>
<span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>adapterUse.<span style="color: #006633;">getAdapterIfKnown</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">==</span> SwaRefAdapter.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
programElement.<span style="color: #006633;">annotate</span><span style="color: #009900;">&#40;</span>XmlAttachmentRef.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
<span style="color: #666666; font-style: italic;">// [RESULT]</span>
<span style="color: #666666; font-style: italic;">// @XmlJavaTypeAdapter( Foo.class )</span>
programElement.<span style="color: #006633;">annotate2</span><span style="color: #009900;">&#40;</span>XmlJavaTypeAdapterWriter.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">value</span><span style="color: #009900;">&#40;</span>
adapterUse.<span style="color: #006633;">adapterType</span>.<span style="color: #006633;">toType</span><span style="color: #009900;">&#40;</span>outline,EXPOSED<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Of course, these doesn&#8217;t provide fun nor educational value. But one thing is obvious: ugly code is here to stay. Hopefully I&#8217;ll be able to find some more entertaining pieces next time.</p>
]]></content:encoded>
			<wfw:commentRss>http://uglycode.com/2008/09/who-likes-ugly-hacks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
