+157
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
<?
@$ok=$HTTP_POST_VARS["ok"];
@$user=$HTTP_POST_VARS["user"];
@$pwd=$HTTP_POST_VARS["pwd];
if(!isset($ok))
echo "<form action=.$2.php. method=POST>"
."Name<input type=text name user><br>"
."Password<input type=password name=pwd><br>"
."<input type=submit name=ok value=Войти>"
."</form>";
else
{
if(($user="Demo")&&($pwd=="Demo"))
echo "Wellcome";
else
echo "Access Blocked";
}
?>
Говорят, что это не говнокод.
kal1sha,
14 Июля 2010
+135
- 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
int Xor4Bit_2 (unsigned char data)
{
unsigned char result = data;
while (data != 0)
{
result ^= data & 1;
data >>= 1;
}
result &= 1;
return result;
}
вот как студенты получают xor битов числа
это же нужно так извратить простой рабочий алгоритм
int Xor4Bit_2 (unsigned char data)
{
int result = 0
while (data != 0)
{
result ^= data & 1;
data >>= 1;
}
return result;
}
получил данный код после измышлизмов знакомого студента, перед этим дав ему рабочий вариант, мдя...
ageron,
04 Июля 2010
+170
- 1
- 2
require_once('configure.php');
require('configure.php');
надо быть _увереным_ в своем коде
sogekoder,
05 Июня 2010
+80
- 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
private String nextUTF8Character() throws IOException, CharacterCodingException
{
int iCodePoint = 0;
int byte1, byte2, byte3, byte4;
byte1 = is.read();
if (byte1 == -1)
return null;
// проверяем является ли первый бит нулевым
if ((byte1 & 0x80) == 0)
{
// один байт
iCodePoint = byte1 & 0x7F;
return new String(Character.toChars(iCodePoint));
}
byte2 = is.read();
if (byte2 == -1)
return null;
if ((byte1 & 0xE0) == 0xC0 && (byte2 & 0xC0) == 0x80)
{
// два байта
iCodePoint = ((byte1 & 0x1F) << 6) | (byte2 & 0x3F);
if (iCodePoint > 0x7F)
return new String(Character.toChars(iCodePoint));
else
throw new CharacterCodingException();
}
byte3 = is.read();
if (byte3 == -1)
return null;
if ((byte1 & 0xF0) == 0xE0 && (byte2 & 0xC0) == 0x80 && (byte3 & 0xC0) == 0x80)
{
// три байта
iCodePoint = ((byte1 & 0x0F) << 12) | ((byte2 & 0x3F) << 6) | (byte3 & 0x3F);
if (iCodePoint > 0x7FF)
return new String(Character.toChars(iCodePoint));
else
throw new CharacterCodingException();
}
byte4 = is.read();
if (byte4 == -1)
return null;
if ((byte1 & 0xF8) == 0xF0 && (byte2 & 0xC0) == 0x80 &&
(byte3 & 0xC0) == 0x80 && (byte4 & 0xC0) == 0x80)
{
// четыре байта
iCodePoint = ((byte1 & 0x07) << 18) | ((byte2 & 0x3F) << 12) |
((byte3 & 0x3F) << 6) | (byte4 & 0x3F);
if (iCodePoint > 0x0FFFF)
return new String(Character.toChars(iCodePoint));
else
throw new CharacterCodingException();
}
throw new CharacterCodingException();
}
Мегаоптимизированный код для получения букафф в кодироффке UTFфф-8
По данным профилировщика именно этот фрагмент самый тормозной в моей сетевой проге
Max ID,
20 Мая 2010
+97
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
/// До этой строчки еще больше 1000 строк кода (И это всё в ОДНОЙ процедур)
finally
if Main.RecordCount > 0
then Main.First;
Main.EnableControls;
Panel2.Color:=clLime;
lbTimeSpend.Caption:='Âðåìÿ çàòðà÷åíî:'+TimeToStr(time()-TimeWork);
end;
Exit;
try
if TmpCollect_Skd.IsSelectAll then
begin
Askd_count := TmpCollect_Skd.RxDBGrid1.DataSource.DataSet.RecordCount;
end
/// После этой строки еще более 1000 строк кода всё в этой же процедуре!
Продолжим. Вот так люди используют Exit;
goodron,
28 Апреля 2010
+144.9
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
class SmoothingModeManager
{
public:
SmoothingModeManager(Context* context, Gdiplus::SmoothingMode mode = Gdiplus::SmoothingModeHighQuality);
virtual ~SmoothingModeManager();
protected:
Context* context_;
};
////////////////////////
SmoothingModeManager::SmoothingModeManager(Context* context, Gdiplus::SmoothingMode mode)
: context_(context)
{
context_->getCanvas()->SetSmoothingMode(mode);
}
SmoothingModeManager::~SmoothingModeManager()
{
context_->getCanvas()->SetSmoothingMode(Gdiplus::SmoothingModeNone);
}
Инициализируем класс и контекст со сглаживанием до конца метода.
Altravert,
26 Февраля 2010
+55.3
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
#include<iostream>
#include<math.h>
//#include<csdio>
using namespace std;
void main(){
//char*s1=new char[0]
int i=0;
do
char*s1=new char[0];
cout<<'write s1: ';
cin>>s1[i];
i=i+1;
while (*s1[i]=="\0");
for(int j=1, j==i, j++)
cout<<s1[j];
cout<<endl;
delete []s1;
}
Вот такую поделку мне прислали на проверку с жалобой "не работает".
uncle Lem,
06 Января 2010
+122.4
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
/* sent by Stephan Hughson - 2003 */
/* must be compiled with cc or g++*/
#include <stdio.h>
int main(int t,int _,char*a)
{return!0<t?t<3?main(-79,-13,a+main(-87,1-_,
main(-86, 0, a+1 )+a)):1,t<_?main(t+1, _, a ):3,main ( -94, -27+t, a
)&&t == 2 ?_<13 ?main ( 2, _+1, "%s %d %d\n" ):9:16:t<0?t<-72?main(_,
t,"@n'+,#'/*{}w+/w#cdnr/+,{}r/*de}+,/*{*+,/w{%+,/w#q#n+,/#{l,+,/n{n+\
,/+#n+,/#;#q#n+,/+k#;*+,/'r :'d*'3,}{w+K w'K:'+}e#';dq#'l q#'+d'K#!/\
+k#;q#'r}eKK#}w'r}eKK{nl]'/#;#q#n'){)#}w'){){nl]'/+#n';d}rw' i;# ){n\
l]!/n{n#'; r{#w'r nc{nl]'/#{l,+'K {rw' iK{;[{nl]'/w#q#\
n'wk nw' iwk{KK{nl]!/w{%'l##w#' i; :{nl]'/*{q#'ld;r'}{nlwb!/*de}'c \
;;{nl'-{}rw]'/+,}##'*}#nc,',#nw]'/+kd'+e}+;\
#'rdq#w! nr'/ ') }+}{rl#'{n' ')# }'+}##(!!/")
:t<-50?_==*a ?putchar(a[31]):main(-65,_,a+1):main((*a == '/')+t,_,a\
+1 ):0<t?main ( 2, 2 , "%s"):*a=='/'||main(0,main(-61,*a, "!ek;dc \
i@bK'(q)-[w]*%n+r3#l,{}:\nuwloca-O;m .vpbks,fxntdCeghiry"),a+1);}
Вот результат работы программы(всё не вместилось):
On the first day of Christmas my true love gave to me
a partridge in a pear tree.
On the second day of Christmas my true love gave to me
two turtle doves
and a partridge in a pear tree.
...
On the eighth day of Christmas my true love gave to me
eight maids a-milking, seven swans a-swimming,
six geese a-laying, five gold rings;
four calling birds, three french hens, two turtle doves
and a partridge in a pear tree.
On the ninth day of Christmas my true love gave to me
nine ladies dancing, eight maids a-milking, seven swans a-swimming,
six geese a-laying, five gold rings;
four calling birds, three french hens, two turtle doves
and a partridge in a pear tree.
On the tenth day of Christmas my true love gave to me
ten lords a-leaping,
nine ladies dancing, eight maids a-milking, seven swans a-swimming,
six geese a-laying, five gold rings;
four calling birds, three french hens, two turtle doves
and a partridge in a pear tree.
On the eleventh day of Christmas my true love gave to me
eleven pipers piping, ten lords a-leaping,
nine ladies dancing, eight maids a-milking, seven swans a-swimming,
six geese a-laying, five gold rings;
four calling birds, three french hens, two turtle doves
and a partridge in a pear tree.
On the twelfth day of Christmas my true love gave to me
twelve drummers drumming, eleven pipers piping, ten lords a-leaping,
nine ladies dancing, eight maids a-milking, seven swans a-swimming,
six geese a-laying, five gold rings;
four calling birds, three french hens, two turtle doves
and a partridge in a pear tree.
guest,
28 Июня 2009
+27
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
$res["LIST_PAGE_URL"] = str_replace("//", "/", str_replace("#LANG#", $res["LANG_DIR"],
str_replace("#SITE_DIR#", SITE_DIR,
str_replace("#SERVER_NAME#", SITE_SERVER_NAME,
str_replace("#IBLOCK_ID#", $res["IBLOCK_ID"], $res["LIST_PAGE_URL"])
)
)
)
);
битрикс
guest,
23 Ноября 2008
+1
- 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
Statement stmt1 = null;
ResultSet rs1 = null;
try {
StringBuilder sb = new StringBuilder(2000);
String sql = "";
String ss = "";
String ss_begin = "";
String ss_middle = "";
String ss_end = "";
int xcount = 0;
String XXX_ID = "";
String XXX_NAME = "";
if (c.XLANG_ID == 1) {
sql = sql + " SELECT 99 , 'Исходные' FROM dual union all ";
sql = sql + " SELECT 1 , 'Непарные исходные' FROM dual union all ";
sql = sql + " SELECT 2 , 'Временная' FROM dual union all ";
sql = sql + " SELECT 3 , 'Встречные' FROM dual ";
//sql = sql + " SELECT 4 , 'Непарные встречные' FROM dual ";
} else if (c.XLANG_ID == 2) {
sql = sql + " SELECT 99 , 'Base BPEBs' FROM dual union all ";
sql = sql + " SELECT 1 , 'Base BPEBs unpaired' FROM dual union all ";
sql = sql + " SELECT 2 , 'Temporary BPEB' FROM dual union all ";
sql = sql + " SELECT 3 , 'Generated BPEBs' FROM dual ";
//sql = sql + " SELECT 4 , 'Generated BPEBs unpaired' FROM dual ";
}
stmt1 = this.con.createStatement();
rs1 = stmt1.executeQuery(sql);
while (rs1.next()) {
xcount = xcount + 1;
XXX_ID = rs1.getString(1);
XXX_NAME = rs1.getString(2);
sb = sb.append("<msg>")
.append("<xid>").append(XXX_ID).append("</xid>")
.append("<xname>").append(vtb.budget.osa.tools.Tools.stringToXML(XXX_NAME)).append("</xname>")
.append("</msg>");
}
rs1.close();
stmt1.close();
ss_begin = ss_begin + "<xml id='XML_table1'>"
+ "<tab1>";
ss_end = ss_end
+ "</tab1>"
+ "</xml>";
if (xcount == 0) {
ss_middle = ss_middle + "<msg>"
+ "<xid></xid>"
+ "<xcode></xcode>"
+ "<xname></xname>"
+ "</msg>";
} else {
ss_middle = sb.toString();
}
ss = ss_begin + ss_middle + ss_end;
ss_begin = null;
ss_middle = null;
ss_end = null;
sb = null;
return ss;
}
yamert89,
04 Апреля 2023