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