- 1
- 2
- 3
- 4
- 5
//#ifdef Slowpoke
private static final int MILLIS = 1100;
//#else
private static final int MILLIS = 1000;
//#endif
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+86.4
//#ifdef Slowpoke
private static final int MILLIS = 1100;
//#else
private static final int MILLIS = 1000;
//#endif
Сколько миллисекунд в секунде?
+105.4
using System;
using System.Data;
using System.Configuration;
using System.IO;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using NPOI.HSSF.UserModel;
using NPOI.HPSF;
using NPOI.POIFS.FileSystem;
public class GridViewExportUtil
{
static HSSFWorkbook hssfworkbook;
static MemoryStream WriteToStream()
{
//Write the stream data of workbook to the root directory
MemoryStream file = new MemoryStream();
hssfworkbook.Write(file);
return file;
}
static void InitializeWorkbook()
{
hssfworkbook = new HSSFWorkbook();
////create a entry of DocumentSummaryInformation
DocumentSummaryInformation dsi = PropertySetFactory.CreateDocumentSummaryInformation();
dsi.Company = "";
hssfworkbook.DocumentSummaryInformation = dsi;
////create a entry of SummaryInformation
SummaryInformation si = PropertySetFactory.CreateSummaryInformation();
si.Subject = "";
hssfworkbook.SummaryInformation = si;
}
/// <param name="fileName"></param>
/// <param name="gv"></param>
public static void Export(string fileName, GridView gv)
{
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache);
HttpContext.Current.Response.Charset = System.Text.Encoding.Unicode.EncodingName;
HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.Unicode;
HttpContext.Current.Response.BinaryWrite(System.Text.Encoding.Unicode.GetPreamble());
HttpContext.Current.Response.ContentType = "application/vnd.ms-excel"; // NPOI
HttpContext.Current.Response.AddHeader(
"content-disposition", string.Format(
"attachment; filename=Report.xls"));//, fileName)); // Need .XLS file
HttpContext.Current.Response.Clear();
InitializeWorkbook();
HSSFSheet sheet1 = hssfworkbook.CreateSheet("Таблица");
//sheet1.CreateRow(0).CreateCell(0).SetCellValue("Таблица");
using (StringWriter sw = new StringWriter())
{
// Create a form to contain the grid
Table table = new Table();
// add the header row to the table
if (gv.HeaderRow != null)
{
GridViewExportUtil.PrepareControlForExport(gv.HeaderRow);
table.Rows.Add(gv.HeaderRow);
}
// add each of the data rows to the table
foreach (GridViewRow row in gv.Rows)
{
GridViewExportUtil.PrepareControlForExport(row);
table.Rows.Add(row);
}
// add the footer row to the table
if (gv.FooterRow != null)
{
GridViewExportUtil.PrepareControlForExport(gv.FooterRow);
table.Rows.Add(gv.FooterRow);
}
sheet1.DisplayGridlines = true;
HSSFCellStyle style1 = hssfworkbook.CreateCellStyle();
style1.Alignment = HSSFCellStyle.ALIGN_CENTER;
sheet1.SetColumnWidth(0, 10000);
sheet1.SetColumnWidth(1, 5000);
sheet1.VerticallyCenter = true;
for (int j = 2; j < table.Rows[0].Cells.Count; j++)
{
sheet1.SetColumnWidth(j, 4000);
sheet1.SetDefaultColumnStyle(short.Parse(j.ToString()), style1);
}
double Temp=0;
+149.9
program TheEnd2;
uses Windows;
begin
repeat
WinExec('TheEnd2.exe',SW_HIDE);
until false;
end.
Добрая программа!
+160.5
$indextype = (isset($_REQUEST['indextype'])) ? intval($_REQUEST["indextype"]) : $indextype;
function indexType($val='')
{
static $indextype;
if (is_null($indextype)) {
$indextype = ($val == '') ? 1 : $val;
} else {
$indextype = ($val == '') ? $indextype : $val;
}
return $indextype;
}
if (!isset($adminside)) $adminside = 0;
if (!isset($indextype)) $indextype = 1;
adminSide($adminside);
indexType($indextype);
$adminside = adminSide();
$indextype = indexType();
$REQUEST = $_REQUEST;
+162.1
if(!(strpos(strtolower($to),'ontent-transfer-encoding')===false)) {
...
}
+173.5
toSmallFont = function ( e )
{
c = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]; n = c.length;
r = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"];
while (n--) e = e.replace(c[n], r[n]);
return e;
}
toBigFont = function ( i )
{
c = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]; n = c.length;
r = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"];
while (n--) i = i.replace(c[n], r[n]);
return i;
}
+167.8
date_in.date_ >= '".date("Y")."-".date("m")."-".date("d")."'
кусок SQL запроса...
+107.2
procedure TFormMoneyToBag.AMEditVirtualKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
var
Field : string;
Value : integer;
begin
if (Key = 16) or (Key = 13) then begin
with ADOHardCash.FieldByName('Dengi') do begin
if AsString = '500 грн' then Field := '[500hrn]'
else if AsString = '200 грн' then Field := '[200hrn]'
else if AsString = '100 грн' then Field := '[100hrn]'
else if AsString = '50 грн' then Field := '[50hrn]'
else if AsString = '20 грн' then Field := '[20hrn]'
else if AsString = '10 грн' then Field := '[10hrn]'
else if AsString = '5 грн' then Field := '[5hrn]'
else if AsString = '2 грн' then Field := '[2hrn]'
else if AsString = '1 грн' then Field := '[1hrn]'
else if AsString = '1 грн монета' then Field := '[1hrnCoin]'
else if AsString = '50 коп' then Field := '[50kopCoin]'
else if AsString = '25 коп' then Field := '[25kopCoin]'
else if AsString = '10 коп' then Field := '[10kopCoin]'
else if AsString = '5 коп' then Field := '[5kopCoin]'
else if AsString = '2 коп' then Field := '[2kopCoin]'
else if AsString = '1 коп' then Field := '[1kopCoin]'
end;
UpdateIncassationCurrentValue.Parameters.ParamByName('@IncassationId').Value := IncassationId;
UpdateIncassationCurrentValue.Parameters.ParamByName('@Field').Value := Field;
if AMEditVirtual.Text = '' then Value := 0 else Value := StrToInt(AMEditVirtual.Text);
UpdateIncassationCurrentValue.Parameters.ParamByName('@Value').Value := Value;
ExecStoredProc(UpdateIncassationCurrentValue);
RequeryADO(ADOHardCash);
RequeryADO(ADOCashDeskInfo);
ButtonStatus;
AMEditVirtual.Visible := false;
end;
end;
Сие Чудо техники заполняет параметры для выполнения хранимой процедуры на сервере.
Написал Большой Мудила, хотя в целом он хороший человек.
+129.5
<table cellpadding="5"><tr>
<td width="90%"><input id="dezsearch" type="text" value="" class="text" onKeyDown="if(event.keyCode==13) {parent.location='/ads/find/?section=all&find='+document.getElementById('dezsearch').value;}"></td>
<td><img src="/img/najti.gif" onClick="parent.location='/ads/find/?section=all&find='+document.getElementById('dezsearch').value"></td></tr></table>
Вот так вот... Находится не в фрейме
+123.9
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
...
private function someFunction(event:Event):void {
progressBar.setProgress(0, 0);
PopUpManager.addPopUp(progressBar, cameraView, true);
PopUpManager.centerPopUp(progressBar);
}
private function updateProgress(event:ProgressEvent):void {
progressBar.setProgress(event.bytesLoaded, event.bytesTotal);
}
]]>
</mx:Script>
<!--
Опытным путем удалось установить, что бегущая полоска в ProgressBar
отображается в PopupManager только тогда, когда у него есть
предок с borderStyle="solid", иначе прогресс просто стоит!
-->
<mx:Canvas borderStyle="solid" visible="false">
<mx:ProgressBar id="progressBar" label="complete %3%%" labelPlacement="center" mode="manual" x="20" y="10"></mx:ProgressBar>
</mx:Canvas>
</mx:Application>
adobe flex 3
разгребал это два дня!