Saturday, January 24th, 2009
Seems that some WP developers are fans of refuctoring.
if ( ($fQ=strpos($Fid,'"'))!==false )
$Fname = sanitize_title_with_dashes(substr( $Fid, $fQ+1, strpos($Fid,'"',$fQ+1)-$fQ-1 ));
### wrapped in <p> ?
$p_offset = ($p_close < $p_open) ? $a-(strlen($part_content)-$p_open) : $a;
Argh. Guys, seriously, how about some objects? How about some readable variables? How about instead of nesting function calls and using ugly ternary operators… ugh. Nevermind.
Tags: php, refuctoring, ugly names
Posted in Uncategorized | No Comments »
Saturday, November 29th, 2008
function _getCRServices($data)
{
if (is_array($data)) {
//this is ehmmmm, d*ment requirement from client
$not_cr = array(3006, 2416, 1026, 5604, 3501);
...
}
}
Makes one wonder if there was a demented requirement, or just a demented programming technique.
Tags: hardcoding, php
Posted in Uncategorized | No Comments »
Sunday, September 28th, 2008
According to my search, a lot of people do.
#ugly hack
self.log.info("Running script")
dict={ 'self' : self.model,
'model' : self.model,
'interpreter': self }
exec(self.script,dict)
// Ugly hack
Class.forName("tristero.util.Conduit");
Class.forName("tristero.util.Lock");
Class.forName("tristero.util.PumpListener");
Class.forName("tristero.util.StringUtils");
_label.Show();
_label.Hide(); // Ugly hack!
base.Show();
/*
UGLY UGLY UGLY HACK !!!
*/
QFile inFile(uisFile);
if (!inFile.open(QIODevice::ReadOnly | QIODevice::Text))
return;
QFile outFile("/tmp/temp.ini");
if (!outFile.open(QIODevice::WriteOnly | QIODevice::Text))
return;
QTextStream in(&inFile);
QTextStream out(&outFile);
while (!in.atEnd())
{
QString line = in.readLine();
line.replace("\\","\\\\");
out << line << endl;
}
inFile.close();
outFile.close();
/*
END OF UGLY UGLY UGLY HACK
*/
// ugly, ugly hack
if(adapterUse.getAdapterIfKnown()== SwaRefAdapter.class) {
programElement.annotate(XmlAttachmentRef.class);
} else {
// [RESULT]
// @XmlJavaTypeAdapter( Foo.class )
programElement.annotate2(XmlJavaTypeAdapterWriter.class).value(
adapterUse.adapterType.toType(outline,EXPOSED));
}
Of course, these doesn’t provide fun nor educational value. But one thing is obvious: ugly code is here to stay. Hopefully I’ll be able to find some more entertaining pieces next time.
Tags: c#, java, open source, perl, ugly hack
Posted in Uncategorized, hacks | No Comments »