- 1
Govno
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
−156
Govno
+75
try {
try{
BasicFormatKeywordsReader keyRep = new BasicFormatKeywordsReader(new ExcelBook(fileName),keywordName,sheetName);
keyRep.readKeywords(keyword);
} catch (Throwable ex){
throw new TestCaseException("Can't initialize flow",ex);
}
for(Executable executable:keyword.getChildren()) {
executable.execute(getRequest());
}
} catch (TestCaseException ex) {
throw ex;
} catch (Throwable ex){
throw new TestCaseException(ex);
}
Талантливо!
+54
$todayweekday = date("w", mktime(0, 0, 0, date("m"), date("d"), date("Y")));
апофеоз
+134
double erf(double x)
{
const double xbreak = 0.46875;
...
y = fabs(x);
// evaluate erf for |x| <= 0.46875
if (y<xbreak)
{
...
}
// evaluate erfc for 0.46875 <= |x| <= 4.0
else if ((y > xbreak) && (y <= 4.))
{
...
}
// evaluate erfc for |x| > 4.0
else
{
...
}
// fix up for negative argument, erf, etc.
if (x > xbreak)
result = 1 - result;
if (x < -xbreak)
result = result - 1;
return result;
}
> Надо было в свое время — перевел MATLABовский исходник на C (сделано через дробно-рациональные аппроксимации на нескольких отрезках)
http://www.rsdn.ru/forum/alg/1797230.all.aspx
+61
$site->Radio('showin[]', 'ALL_EXCEPT', in_array('ALL_EXCEPT',$showin) or !in_array('ALL_EXCEPT', $showin) )
http://upload.wikimedia.org/wikipedia/ru/math/f/6/d/f6db44e1aa2287204b26130ac9e4fe90.png как бэ
−43
bool ok = (state == 0) ? false : true;
И это пишет человек, пишущий на плюсах уже много лет...
+92
double e1 = (((-Data[65021] + 1.25) / 2) > 0) && (((-Data[65021] + 1.25) / 2) < 6) ? 180 * Math.Acos(((-Data[65021] + 1.25) / 2) / 6.07) / Math.PI : 90;
Просто вычисляется в одну строчку угол. В алгоритме расчета параметров тех.процесса.
−80
Dim centerX As Integer
Dim centerY As Integer
Dim radius As Integer
Private Sub Form_Activate()
centerX = 100
centerY = 100
radius = 50
End Sub
Private Sub Timer1_Timer()
Randomize
Dim x As Integer
Dim y As Integer
Dim i As Integer
Dim diff As Integer
For i = 0 To 100
Me.ForeColor = RGB(200, 0, 0)
x = centerX + (radius * Rnd)
y = centerY + (radius * Rnd)
diff = Sqr(((centerX - x) ^ 2) + ((centerY - y) ^ 2))
If (Abs(radius - diff) < 2) Then
Me.PSet (x, y)
End If
Me.ForeColor = RGB(100, 0, 0)
x = centerX - (radius * Rnd)
y = centerY + (radius * Rnd)
diff = Sqr(((centerX - x) ^ 2) + ((centerY - y) ^ 2))
If (Abs(radius - diff) = 0) Then
Me.PSet (x, y)
End If
x = centerX + (radius * Rnd)
y = centerY - (radius * Rnd)
diff = Sqr(((centerX - x) ^ 2) + ((centerY - y) ^ 2))
If (Abs(radius - diff) = 0) Then
Me.PSet (x, y)
End If
Me.ForeColor = RGB(0, 100, 0)
x = centerX - (radius * Rnd)
y = centerY - (radius * Rnd)
diff = Sqr(((centerX - x) ^ 2) + ((centerY - y) ^ 2))
If (Abs(radius - diff) > 2) Then
Me.PSet (x, y)
End If
Next i
End Sub
Извиняюсь за длину.
История происхождения: в одном древнем ВБ-шном говнопроекте сомнительного происхождения эта вещь выполняла роль постепенной прорисовки "логотипа" в окне "О программе". Отрезал сам сабж.
Вот как работает: http://tinyurl.com/ck3npah
+148
ISQ.Translation.Infra.extractJobIdFromText=function(k){
var d;
var g=k.toLowerCase();
var j=g.indexOf("<"+ISQ.Translation.Infra.jobIdMarkerTag);
if(j===-1){
j=g.indexOf("< "+ISQ.Translation.Infra.jobIdMarkerTag)
}
if(j===-1){
if(ISQ.Widget&&ISQ.Widget.Log){
ISQ.Widget.Log.add("ISQ.Translation.Infra.extractJobIdFromText: Couldnt parse jobIdMarker from text! "+k,ISQ.Widget.Log.statusEnum.RED)
}
return{id:-1,text:k}
}
var b=k.indexOf(">",j);
if(b===-1){
if(ISQ.Widget&&ISQ.Widget.Log){
ISQ.Widget.Log.add("ISQ.Translation.Infra.extractJobIdFromText: jobIdMarker tag is invalid!",ISQ.Widget.Log.statusEnum.RED)
}
return{id:-1,text:k}
}
b+=1;
var h=g.substring(j,b);
var e=h.indexOf(ISQ.Translation.Infra.jobIdMarkerTag);
if(e===-1){
if(ISQ.Widget&&ISQ.Widget.Log){
ISQ.Widget.Log.add("ISQ.Translation.Infra.extractJobIdFromText: jobIdMarker tag is invalid!",ISQ.Widget.Log.statusEnum.RED)
}
return{id:-1,text:k}
}
e+=ISQ.Translation.Infra.jobIdMarkerTag.length;
var f="";
var a;
do
{
if(e>h.length){
break
}
a=h.charAt(e++);
if(a.charCodeAt(0)<48||a.charCodeAt(0)>57){
break
}
f+=a
}
while(true);
d=parseInt(f);
if(isNaN(d)){
if(ISQ.Widget&&ISQ.Widget.Log){
ISQ.Widget.Log.add(
"ISQ.Translation.Infra.extractJobIdFromText: jobIdMarker tag is invalid: could not parse id#",
ISQ.Widget.Log.statusEnum.RED)
}
return{id:-1,text:k}
}
var i;
if(j===0){
i=k.substring(b)
}
else
{
i=k.substring(0,j);
if(b<k.length){
i+=k.substring(b)
}
}
return{id:d,text:i}
};
Закомммммммммммментировал!
+238
JMP $END