java | Ugly Code! https://uglycode.com c0ding is seriose busines!!!!1 Sun, 28 Sep 2008 21:44:41 +0000 en-US hourly 1 https://wordpress.org/?v=5.7.15 Who likes ugly hacks? https://uglycode.com/2008/09/who-likes-ugly-hacks/ https://uglycode.com/2008/09/who-likes-ugly-hacks/#respond Sun, 28 Sep 2008 21:44:41 +0000 http://uglycode.com/?p=3 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 … Continue reading Who likes ugly hacks?

The post Who likes ugly hacks? first appeared on Ugly Code!.

]]>
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.

The post Who likes ugly hacks? first appeared on Ugly Code!.

]]>
https://uglycode.com/2008/09/who-likes-ugly-hacks/feed/ 0