- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
def loop(fahrenheit)
{
//Тело цикла...
match (match (fahrenheit >= 0) { | true => fahrenheit < 300 | false => false })
{
| true => loop(fahrenheit + 20);
| false => ()
}
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+124
def loop(fahrenheit)
{
//Тело цикла...
match (match (fahrenheit >= 0) { | true => fahrenheit < 300 | false => false })
{
| true => loop(fahrenheit + 20);
| false => ()
}
}
Цикл на языке Nemerle. Найдено в одной обучающей статье для начинающих нубов.
+167
switch (columnType)
{
case 'first':
{
className = '.active-tooltip-first';
break;
}
case 'second':
{
className = '.active-tooltip-second';
break;
}
case 'third':
{
className = '.active-tooltip-third';
break;
}
}
Подобных перлов в данном проекте немало. По возможности вычищаю
−146
for section in config.sections():
GROUP_PREFIX = 'group '
if not section.startswith(GROUP_PREFIX):
continue
group = section[len(GROUP_PREFIX):]
if group in seen:
continue
из проекта gitosis
+168
$order->UniqCode = substr(md5(uniqid()),0,3) . rand(10000, 99999);
+162
if(!$_GET['q']) die(header("HTTP/1.0 404 Not Found"));
$_GET['q'] = str_replace('sec/',false,$_GET['q']);
$_GET['q'] = str_replace('/files/',false,$_GET['q']);
pg_query('INSERT INTO download (date,file,ip) VALUES ('NOW()','" . $_GET['q'] . "', '{$_SERVER['REMOTE_ADDR']}')');
принятие запроса из GET и запись в базу
−161
model.issuesSubproduct = subproductId;
subproductId = model.issuesSubproduct;
Two-way binding :D
+144
07.07.2010 14:49:14 com.mchange.v2.c3p0.C3P0Registry banner
INFO: Initializing c3p0-0.9.1.2 [built 21-May-2007 15:04:56; debug? true; trace:
10]
07.07.2010 14:49:15 com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource getPoo
lManager
INFO: Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acqu
ireIncrement -> 5, acquireRetryAttempts -> 0, acquireRetryDelay -> 500, autoComm
itOnClose -> true, automaticTestTable -> connection_test_table, breakAfterAcquir
eFailure -> false, checkoutTimeout -> 0, connectionCustomizerClassName -> null,
connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, d
ataSourceName -> mo0lz2891bvagwh7rwflk|11e1e67, debugUnreturnedConnectionStackTr
aces -> false, description -> null, driverClass -> com.mysql.jdbc.Driver, factor
yClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToke
n -> mo0lz2891bvagwh7rwflk|11e1e67, idleConnectionTestPeriod -> 3600, initialPoo
lSize -> 10, jdbcUrl -> jdbc:mysql://localhost/mysql, maxAdministrativeTaskTime
-> 0, maxConnectionAge -> 0, maxIdleTime -> 0, maxIdleTimeExcessConnections -> 0
, maxPoolSize -> 10, maxStatements -> 0, maxStatementsPerConnection -> 100, minP
oolSize -> 10, numHelperThreads -> 3, numThreadsAwaitingCheckoutDefaultUser -> 0
, preferredTestQuery -> null, properties -> {user=******, password=******}, prop
ertyCycle -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> fa
lse, unreturnedConnectionTimeout -> 0, usesTraditionalReflectiveProxies -> false
]
07.07.2010 14:49:15 com.l2scoria.loginserver.LoginController <init>
INFO: Loading LoginContoller...
07.07.2010 14:49:21 com.l2scoria.loginserver.LoginController <init>
INFO: Cached 10 KeyPairs for RSA communication
Exception in thread "main" java.lang.NullPointerException
at com.l2scoria.util.random.MTRandom.next(MTRandom.java:355)
at java.util.Random.nextDouble(Random.java:438)
at com.l2scoria.util.random.Rnd.nextInt(Rnd.java:55)
at com.l2scoria.loginserver.LoginController.generateBlowFishKeys(LoginCo
ntroller.java:176)
at com.l2scoria.loginserver.LoginController.<init>(LoginController.java:
138)
at com.l2scoria.loginserver.LoginController.load(LoginController.java:10
3)
at com.l2scoria.loginserver.L2LoginServer.<init>(L2LoginServer.java:117)
at com.l2scoria.loginserver.L2LoginServer.main(L2LoginServer.java:61)
LoginServer terminated abnormaly
Send you bug to : http://la2.100nt.ru
LoginServer terminated
Send you bug to : http://la2.100nt.ru
Restart(r) or Quit(q)^CTerminate batch job (Y/N)?
+87
/**
* The Time class is a faster replacement for the java.util.Calendar and
* java.util.GregorianCalendar classes. An instance of the Time class represents
* a moment in time, specified with second precision. It is modelled after
* struct tm, and in fact, uses struct tm to implement most of the
* functionality.
*/
public class Time {
...
/**
* Year. TBD. Is this years since 1900 like in struct tm?
*/
public int year;
...
}
Android 1.5. TBD в публичном API официального SDK - это пять. Ну мы ещё подумаем, как нам нравится, а вы пока просто посмотрите в дебаге! Гы.
+81
if (f.mColor != null) {
int c = -1;
if (f.mColor.equalsIgnoreCase("aqua")) {
c = 0x00FFFF;
} else if (f.mColor.equalsIgnoreCase("black")) {
c = 0x000000;
} else if (f.mColor.equalsIgnoreCase("blue")) {
c = 0x0000FF;
} else if (f.mColor.equalsIgnoreCase("fuchsia")) {
c = 0xFF00FF;
} else if (f.mColor.equalsIgnoreCase("green")) {
c = 0x008000;
} else if (f.mColor.equalsIgnoreCase("grey")) {
c = 0x808080;
} else if (f.mColor.equalsIgnoreCase("lime")) {
c = 0x00FF00;
} else if (f.mColor.equalsIgnoreCase("maroon")) {
c = 0x800000;
} else if (f.mColor.equalsIgnoreCase("navy")) {
c = 0x000080;
} else if (f.mColor.equalsIgnoreCase("olive")) {
c = 0x808000;
} else if (f.mColor.equalsIgnoreCase("purple")) {
c = 0x800080;
} else if (f.mColor.equalsIgnoreCase("red")) {
c = 0xFF0000;
} else if (f.mColor.equalsIgnoreCase("silver")) {
c = 0xC0C0C0;
} else if (f.mColor.equalsIgnoreCase("teal")) {
c = 0x008080;
} else if (f.mColor.equalsIgnoreCase("white")) {
c = 0xFFFFFF;
} else if (f.mColor.equalsIgnoreCase("yellow")) {
c = 0xFFFF00;
} else {
try {
c = XmlUtils.convertValueToInt(f.mColor, -1);
} catch (NumberFormatException nfe) {
// Can't understand the color, so just drop it.
}
}
Исходники Android 1.5, Html.java:636 .
Неудивительно, что Html.fromHtml() тормозит так, что юзать для списков вообще нельзя, даже один раз.
+74
public static int indexOf(String str, String... array) {
return ArrayUtils.indexOf(array, str);
}