-
+156
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
// в данном случае count($xls_data) не подойдет, потому что
// он меньше изза того что индексы не всегда по +1 идут
end($xls_data);
list($xls_dataCount,$unused) = each($xls_data);
// тут некоторый код, тоже пахнет
for($i = 3; $i <= $xls_dataCount; $i++){
$row = $xls_data[$i];
if(count($row) == 1 && $estnames[$row[1]])$ename = $row[1];
else{
foreach($years as $yindex => $year)
$data[$ename][$row[1]][$year] = $row[$yindex];
}
}
Сижу и ковыряюсь в говнице, по уши увяз((((
asics,
30 Июля 2010
-
+164
- 1
- 2
- 3
- 4
- 5
- 6
try {
...
} catch ( Exception $O_o ) {
error_log( $O_o->getMessage() );
...
}
Совсем неожиданный эксепшин O_o
eee_qqq,
30 Июля 2010
-
+74
- 1
for (Integer i = 0; i<_pwiList.size(); i++)
Вот к чему приводит бездумное использование классов-обёрток "для унификации". Конечно, оптимизатор может здесь сообразить, но не факт. А если данный фрагмент трактовать буквально, то i++ приведёт к unboxing, увеличению и последующему boxing.
konsoletyper,
30 Июля 2010
-
+75
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
PriceWithInterval pwi = new PriceWithInterval();
pwi.setPrice(p);
pwi.setStart(dateFormat.parse(dateFormat.format(p.getStartDate())).getTime());
Long endTm = dateFormat.parse(dateFormat.format(p.getEndDate())).getTime();
//Больше 50 лет - техническая бесконечность
if (((endTm-pwi.getStart())/1000/3600/24/365)>50)
{
endTm = dateFormat.parse("31.12.9999").getTime();
}
// Где dateFormat объявлен как
new SimpleDateFormat("dd.MM.yyyy");
Вот такое вот масло масляное. Думается, что этот трюк применён здесь для того, чтобы получить начало дня. Чем не устраивает Calendar, неясно. Ну в крайнем случае, можно было целочисленно поделить и умножить на 1000 * 3600 * 24. Ну и вычисление в общем-то константной "технической бесконечности" радует неимоверно.
konsoletyper,
30 Июля 2010
-
+147
- 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
- 72
- 73
- 74
- 75
<?php
require_once 'MDB2.php';
$dsn = "mysql://user:pass@localhost/db";
$mdb2 = & MDB2::singleton($dsn);
if (PEAR::isError($mdb2)) {
die($mdb2->getMessage());
}
class DB {
static private $instance = NULL;
static private $mdb2 = NULL;
private function __construct() {
self::$mdb2 = & MDB2::singleton();
self::$mdb2->exec("SET NAMES utf8");
self::$mdb2->setFetchMode(MDB2_FETCHMODE_ASSOC);
}
static function getInstance() {
if(self::$instance == NULL) {
self::$instance = & new DB();
}
return self::$instance;
}
public function query($sql = false) {
$res = self::$mdb2->query($sql);
if (PEAR::isError($res)) {
die($res->getMessage());
}
if(!$res->numRows()) {
return FALSE;
}
return $res;
}
private function __clone() {
}
}
class Page{
public $limit = 10;
private $conn = FALSE;
function __construct() {
$this->conn = & DB::getInstance();
}
public function getPageList() {
$result = FALSE;
$sql = "SELECT * FROM table LIMIT ".$this->limit;
$res = $this->conn->query($sql);
if($res) {
$result = $res->fetchAll();
}
return $result;
}
}
$p = & new Page();
$nodes = $p->getPageList(25);
print '<pre>'.print_r($nodes, 1).'</pre>';
?>
Дайте, пожалуйста, оценку такой конструкции. Не говнокод ли?
cartman,
29 Июля 2010
-
+63
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
<p>
<strong>
<strong><strong>
<strong><strong><strong>
<strong><strong><strong><strong>
<strong>.... ещё пара сотен открывающихся <strong> ....<strong>
<strong>24.07.2010 - <a href="http://www.korea-dpr.com/ocn"><span class="style34">OCN Articles</span></a> added !<br> </strong></strong>
</strong></strong></strong></strong></strong></strong>
... ещё пара сотен закрывающихся </strong>...
</strong></strong></strong></strong>
</strong></strong></strong>
</strong></strong>
</strong>
</p>
Исходный код официальной страницы КНДР - http://www.korea-dpr.com. Именования стилей "style-какие-то две цифры" прилагаются. Безумный хтмл и прочая тёмная сторона силы.
Rsk,
29 Июля 2010
-
+161
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
function posit(texta, textb)
{
texta = texta + "";
return texta.indexOf(textb+"");
}
function trimme(texta)
{
var trimming = true;
while(trimming == true)
{
if((posit(texta, " ")+1)>0)
{
texta = texta+" ";
texta = texta.substr(0, posit(texta, " "));
}
if((posit(texta, " ")+1) == 0)
{
trimming = false;
}
}
return texta;
}
Тихий ужас
XyHb,
29 Июля 2010
-
+144
- 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
script type="text/javascript" src="/js/jquery.form.js"></script>
<script type="text/javascript">
$(document).ready(function(){
var options = {
target: '#output',
dataType: 'json',
type: 'POST',
success: processJson
};
$('#myForm1').submit(function() {
$(this).ajaxSubmit(options);
return false;
});
});
function processJson(data) {
alert(data.name);
$('#output').html('<p>'+data.name+'</p><p>').append()
}
</script>
<div id="output"></div>
<form action="/pm/send/" id="myForm1" method="post">
Логин получателя: <input type="text" value="{{loginauthor}}" name="whom" id="ValidLogin"/><br/>
Тема: <input type="text" name="title"><br/>
Сообщение: <textarea rows="10" cols="20"
name=text>
</textarea><br/>
<input type="submit" value="Отправить" name="but" style="background: #EFEFEF;"/>
обработчик
....
$arr=array('name'=>$done);
echo json_encode($arr);
пост уходит, но никакой реакции ни алерта ничего, и сам скрипт не срабатывает
dalass,
29 Июля 2010
-
+181
- 1
- 2
//Эта функция потенциальный источник багов. Я гарантирую это.
и дли-и-инная функция с кучей неясностей и без единого комента 0_0
Встретил в проекте
Похоже вместо того чтобы нормально коментировать код писавший это читал лурк...
3.14159265,
29 Июля 2010
-
+64
- 1
reader = new CSVReader(new BufferedReader(new InputStreamReader(new FileInputStream(csvFile), "UTF-8")), Config.getCSVDelimiter());
Хорошо что файл ещё не зазипован...
tinynick,
29 Июля 2010