-
Лучший говнокод
- В номинации:
-
- За время:
-
-
+161.4
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
//проверка на браузер
var brname=navigator.appName, BrVer='';
if(brname.substring(0,2)=="Mi")
BrVer='E';
//реализация
function showElement(elName)
{
if(BrVer!='E') return; //не осёл? и пошли нафиг!
for (i = 0; i < document.all.tags(elName).length; i++)
{
//блаблабла
}
}
типа выпадающее меню. типа только для IE.
Ad_Astra,
12 Октября 2009
-
+56.4
- 1
if (tlb[i].VPN2 == 0x70000000) return; //uh uhh right ...
Из исходника pcsx2 (эмулятор PS2):
http://code.google.com/p/pcsx2/source/browse/trunk/pcsx2/COP0.cpp?r=1970
Thomas_55,
06 Октября 2009
-
+107.9
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
if l<9
then
if r<10
then
s:= inttostr(l)
else
s:= '10'
else
if l<99
then
if r<100
then
s:= inttostr(l)
else
s:= '100'
else
if l<999
then
if r<1000
then
s:= inttostr(l)
else
s:= '1000'
else
if l<9999
then
if r<10000
then
s:= inttostr(l)
else
s:= '10000'
else
if l<99999
then
if r<100000
then
s:= inttostr(l)
else
s:= '100000'
else
if l<999999
then
if r<1000000
then
s:= inttostr(l)
else
s:= '1000000'
else
if l<9999999
then
if r<10000000
then
s:= inttostr(l)
else
s:= '10000000'
else
if l<99999999
then
if r<100000000
then
s:= inttostr(l)
else
s:= '100000000'
else
if l<999999999
then
if r<1000000000
then
s:= inttostr(l)
else
s:= '1000000000';
Нашёл в своём решении какой-то олимпиадной задачи. Долго пытался вспомнить, в каком состоянии был...
Сан Саныч,
05 Октября 2009
-
+137.3
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
private ArrayList GetSubscribers(string condition)
{
ArrayList subscribers = new ArrayList();
ArrayList lst = new user_category_notification().Factory.GetItems(condition, "user_category_notification.id_user");
ArrayList distinc_lst = new ArrayList();
ArrayList distinc_lst_ids = new ArrayList();
ArrayList lst_ids = new ArrayList();
for (int i = 0; i < lst.Count; i++)
{
lst_ids.Add(((user_category_notification) lst[i]).id_user);
}
for (int i = 0; i < lst_ids.Count;i++ )
{
if (distinc_lst_ids.Contains(lst_ids[i])) continue;
else
{
distinc_lst.Add(lst[i]);
distinc_lst_ids.Add(lst_ids[i]);
}
}
foreach (user_category_notification _un in distinc_lst)
{
user _current = (user)new user().Factory.GetByID(_un.id_user);
subscribers.Add(_current);
}
return subscribers;
}
Филтрация :)
bugotrep,
02 Октября 2009
-
+146.1
- 1
function move($oldname, $newname, $context=null) { retrurn rename($oldname, $newname, $context); }
greevex,
30 Сентября 2009
-
+66.6
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
package parseit;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class MysqlConn {
private volatile static Connection instance;
private MysqlConn() {
}
public static Connection getInstance() {
try {
if (instance == null) {
synchronized (MysqlConn.class) {
if (instance == null) {
instance = DriverManager.getConnection("jdbc:mysql://***:3306/******?user=******&password=*******");
}
}
}
} catch (SQLException ex) {
}
return instance;
}
}
Объясните почему System.out.println(MysqlConn.getInstance ()); выводит null
5838151,
30 Сентября 2009
-
+83.5
- 1
- 2
- 3
for (Person p : c) {
return p;
}
yvu,
28 Сентября 2009
-
+95.6
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
try
{
foreach (Control con in Parent.Parent.Parent.Parent.Parent.Parent.Controls)
{
if (con.Name == "numbersPanel")
{
((NumbersPanel)con).sender = (TextBox)sender;
break;
}
}
}
catch
{
}
Отыскал в коде winforms приложения гениальнейший способ поиска контрола по имени.
Теперь Parent.Parent.Parent.Parent придет за мной!
tonic,
24 Сентября 2009
-
+66.8
Классика консоли CS
Сан Саныч,
24 Сентября 2009
-
+159.6
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
class SomeClass {
...
public function get_stop_words(){
$stem_stop_words = array();
....
return $stem_stop_words;
}
...
}
//далее в коде:
$someClass = new SomeClass();
if($someClass->connect()){
$someClass->stem_stop_words = $someClass->get_stop_words();
....
}
ООП не для нас. Причем $this->stem_stop_words не объявлена в классе.
VermiVermi,
23 Сентября 2009