- 1
- 2
- 3
- 4
- 5
while($record = $sql->GetResultAssoc())
{
echo $tpl['main_table_item']->FillTemplate(array("%counter" => $counter, "%fio" => $record['fio'], "%phone" => $record['phone'], "%status" => statusToStr($record['status'])));
$counter++;
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+151.2
while($record = $sql->GetResultAssoc())
{
echo $tpl['main_table_item']->FillTemplate(array("%counter" => $counter, "%fio" => $record['fio'], "%phone" => $record['phone'], "%status" => statusToStr($record['status'])));
$counter++;
}
самопальное шаблонное двигло. выводит данные из базы в табличном виде.
−129.2
def true_or_nil bool
!!bool || nil
end
+135.9
StiReport report = // создание отчета StimulSoft Reporter
// . . . . .
// . . . . .
string tempfilename = System.Guid.NewGuid().ToString() + ".tmp";
report.ExportDocument(StiExportFormat.Word2007, tempfilename); //позволяет конвертировать отчет только в поток
FileStream stream = new FileStream(tempfilename, FileMode.Open);
byte[] reportFile = new byte[stream.Length];
stream.Read(reportFile, 0, (int)stream.Length);
stream.Close();
File.Delete(tempfilename);
if (reportFile.Length > 0)
if (MessageBox.Show("Зберегти друковану форму?", "Запит", MessageBoxButtons.OKCancel) == DialogResult.OK)
WriteToDB(reportFile, "Документ.docx");
+144.6
curEl.change(function (e) {
switch(current_c){
case '1': l = 0.001; break;
case '2': l = 0.001; break;
case '3': l = 1 ; break;
}
switch(curEl.val()){
case '1': l2 = 0.001; break;
case '2': l2 = 0.001; break;
case '3': l2 = 1 ; break;
}
convfrom = parseFloat((curr[current_c]/curr[curEl.val()]) *from.val() * (l/l2));
convto = parseFloat((curr[current_c]/curr[curEl.val()])*to.val()*(l/l2));
if(from.val()!='') from.val(convfrom);
if(to.val()!='') to.val(convto);
from.focus();
});
+156.3
final class HelperCurrency {
public function format($number, $currency = '', $value = '', $format = TRUE) {
/*** .... some code .... ***/
if ($value) {
$value = $value;
} else {
$value = $this->currencies[$currency]['value'];
}
if ($value) {
$value = $number * $value;
} else {
$value = $number;
}
/*** .... some code .... ***/
if ($format) {
$decimal_point = $this->language->get('decimal_point');
} else {
$decimal_point = '.';
}
if ($format) {
$thousand_point = $this->language->get('thousand_point');
} else {
$thousand_point = '';
}
/*** .... some code .... ***/
}
}
класика от OpenCart v. 1.3.2
+77.3
// Год и месяц редактируются как Double, а хранятся в базе как два инта
if (aValue == null) {
current.setStartMonth(0);
current.setStartMonth(0);
} else {
current.setStartMonth(Integer.parseInt(aValue.toString().split(".")[0]));
current.setStartMonth(Integer.parseInt(aValue.toString().split(".")[1]));
}
Программисты клиента и базы стоят один другого
−129.8
For intAtts As Integer = 5 To strParams.Length - 1
Select Case (intAtts + 1) Mod 3
Case 0
'--- Set where to find the attachments
Select Case strParams(intAtts).ToUpper
Case "TASKVIEW"
strAttach = CType(Me.Parent, ctlTaskViewTemplate).ctlDocNavigator.ContainerID.ToString & ","
Case "WORKITEM"
strAttach = WorkItem.WorkItemContainer.ToString & ","
Case "CASE"
strAttach = BFECase.CaseContainerID.ToString & ","
End Select
Case 1
'--- Set the relative path of where to find the attachments
strAttach = strAttach & strParams(intAtts) & ","
Case 2
'--- Set the type of document used to find the attachments
strAttach = strAttach & strParams(intAtts)
arrAttachments.Add(strAttach)
strAttach = ""
End Select
Next intAtts
вот и попробуй пойми что в этих массивах по какому принципу лежит
+77.5
//devPin и pin - массивы байт, а сравниваем мы их так :
if (Utils.bytesToHex(devPin).equals(Utils.bytesToHex(pin))) {
....
:)))
+151.9
if ($startTime == $endTime || $endTime < $startTime) {
Написал, ужаснулся и тут же переписал
+151.2
<?=trim(base64decode(trim($_GET['zzz'])))?>
Ну как-то вот так