- 1
- 2
- 3
- 4
private function onClick(e:MouseEvent):void
{
dispatchEvent(new MouseEvent(MouseEvent.CLICK, true, false))
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
−99
private function onClick(e:MouseEvent):void
{
dispatchEvent(new MouseEvent(MouseEvent.CLICK, true, false))
}
Еще один кусочек очень полезного кода. (this для этого обработчика - MovieClip).
+15
#include <iostream>
#include <cxxabi.h>
#include <typeinfo>
int main(void)
{
uint8_t i = 63;
int status;
std::cout << i << std::endl;
char *realname = abi::__cxa_demangle(typeid(i).name(), 0, 0, &status);
std::cout << "Real type of uint8_t is: " << realname << std::endl;
delete (realname);
std::cout << (unsigned int)i << std::endl;
return 0;
}
...нативный 8bit-ый беззнаковый int.
+120
final TextField passwordField = UIFactory.createTextField(loginInfo, null);
passwordField.setWidth(textFieldWidthPx);
// Yes, they really want the password field to be shown openly.
// Don't blame me, I'm just following orders!
Безопасность такая безопасность.
+2
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <iostream>
#include <vector>
#include <string>
using namespace std;
struct user_data{
char user_name[100];
char host_name[100];
}cuser;
char file_path[100000];
int sockfd;
void error(const char *msg){
perror(msg);
exit(0);
}
char s[128];vector<user_data> users;
int main(int argc, char *argv[]){
int portno, n;struct sockaddr_in serv_addr;
struct hostent *server;
char buffer[256];
static char file_name[256];
if (argc < 2) {
fprintf(stderr,"usage %s hostname port\n", argv[0]);
exit(0);
}
portno = atoi(argv[1]);
while(getchar()!='q'){
sockfd = socket(AF_INET, SOCK_STREAM, 0);
if (sockfd < 0)
error("ERROR opening socket");
gethostname(s, 128);
server = gethostbyname(s);
if (server == NULL) {
fprintf(stderr,"ERROR, no such host\n");
exit(0);
}
bzero((char *) &serv_addr, sizeof(serv_addr));
serv_addr.sin_family = AF_INET;
bcopy((char *)server->h_addr,
(char *)&serv_addr.sin_addr.s_addr,
server->h_length);
serv_addr.sin_port = htons(portno++);
if (connect(sockfd,(struct sockaddr *) &serv_addr,sizeof(serv_addr)) < 0)
error("ERROR connecting");
bzero(buffer,256);
n = write(sockfd,buffer,strlen(buffer));
if (n < 0)
error("ERROR writing to socket");
bzero(buffer,256);
n = read(sockfd,buffer,255);
if (n < 0)
error("ERROR reading from socket");
int sf=0;
for(int i=0;i<=strlen(buffer)-1;i++){
if(buffer[i]=='@'){
sf=i;
}
if(sf==0){
cuser.user_name[i]=buffer[i];
} else {
cuser.host_name[i-sf]=buffer[i+1];
}
}
users.push_back(cuser);
cout << cuser.user_name << " hostname: " << cuser.host_name << endl;
printf("Enter file name:\n");
fgets(file_name,255,stdin);
n = write(sockfd,file_name,255);
if (n < 0)
error("ERROR writing to socket");
bzero(file_name,256);
n = read(sockfd,file_path,100000);
if (n < 0)
error("ERROR reading from socket");
printf("\n%s\n",file_path);
memset(file_path,'\0',100000);
close(sockfd);
}
printf("\n\tRegistered users\n");
for(int i=0; i < users.size(); i++)
{
cout << users[i].user_name << " hostname: " << users[i].host_name << endl;
}
close(sockfd);return 0;
}
Регистрация клиента на сервере
+97
SetLength(s,N);
SetLength(Y,N);
SetLength(U,N);
SetLength(Z,N);
SetLength(E,N);
for i:=0 to N do //какбэ на выход за границы даже не смотрим, не в этом суть
begin
SetLength(S[i],M);
SetLength(Y[i],M);
SetLength(U[i],M);
SetLength(Z[i],M);
SetLength(E[i],M);
end;
Переделывал чужой консольный проект под форму, не сразу понял, что происходит.
Так вот, Вы, наверное, думаете, что знаете, как задавать размер динамического массива? Нет, нихрена вы не знаете.
+148
if(type_file=='png'||type_file=='jpg'||type_file=='gif'||type_file=='jpeg'||type_file=='png')
+111
__flash unsigned char keyGenData[256*7]={
1*(1<<0)+1*(1<<1)+1*(1<<2)+1*(1<<3)+1*(1<<4),
1*(1<<0)+1*(1<<1)+1*(1<<2)+1*(1<<3)+1*(1<<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<<3)+1*(1<<4),
0*(1<<0)+0*(1<<1)+0*(1<<2)+0*(1<<3)+0*(1<<4),
1*(1<<0)+1*(1<<1)+1*(1<<2)+0*(1<<3)+1*(1<<4),
1*(1<<0)+1*(1<<1)+0*(1<<2)+1*(1<<3)+1*(1<<4),
0*(1<<0)+1*(1<<1)+1*(1<<2)+0*(1<<3)+1*(1<<4), //"4"
0*(1<<0)+1*(1<<1)+1*(1<<2)+0*(1<<3)+1*(1<<4),
0*(1<<0)+1*(1<<1)+1*(1<<2)+0*(1<<3)+1*(1<<4),
0*(1<<0)+0*(1<<1)+0*(1<<2)+0*(1<<3)+1*(1<<4),
1*(1<<0)+1*(1<<1)+1*(1<<2)+0*(1<<3)+1*(1<<4),
1*(1<<0)+1*(1<<1)+1*(1<<2)+0*(1<<3)+1*(1<<4),
1*(1<<0)+1*(1<<1)+1*(1<<2)+0*(1<<3)+1*(1<<4),
0*(1<<0)+0*(1<<1)+0*(1<<2)+0*(1<<3)+1*(1<<4), //"5"
0*(1<<0)+1*(1<<1)+1*(1<<2)+1*(1<<3)+1*(1<<4),
0*(1<<0)+0*(1<<1)+0*(1<<2)+1*(1<<3)+1*(1<<4),
1*(1<<0)+1*(1<<1)+1*(1<<2)+0*(1<<3)+1*(1<<4),
1*(1<<0)+1*(1<<1)+1*(1<<2)+0*(1<<3)+1*(1<<4),
0*(1<<0)+1*(1<<1)+1*(1<<2)+0*(1<<3)+1*(1<<4),
1*(1<<0)+0*(1<<1)+0*(1<<2)+1*(1<<3)+1*(1<<4),
Нарыл в институте.
Забивают цифры для показывания на светодиодной панельке 5x7 (если присмотритесь, можете увидеть картинку, образуемую нулями). Такой простыни 96 КБ.
+154
$fld_insurance_estimate_sales = $proformadetail[0]['fld_insurance_estimate_sales'];
$fld_insurance_estimate_cost = $proformadetail[0]['fld_insurance_estimate_cost'];
$fld_oceanfright_sales = $proformadetail[0]['fld_oceanfright_sales'];
$fld_oceanfright_cost = $proformadetail[0]['fld_oceanfright_cost'];
$fld_adjustment_oceanfright_sales = $proformadetail[0]['fld_adjustment_oceanfright_sales'];
$fld_adjustment_oceanfright_cost = $proformadetail[0]['fld_adjustment_oceanfright_cost'];
Не, ну extract($proformadetail[0]) просто никак нельзя сделать :)
+1005
unsigned
int
length () {
unsigned
int
number = (this -> number + 1) % 16;
int
second = size - number;
return (second / 16) + (1 % ((second % 16) + 1)) + (1 % (number + 1));
}
Вот такая фигня у нас в коде, работающем в аппаратуре отображения и протоколирования данных на АЭС.
Авторское форматирование сохранено.
Нашли когда оно с новыми конфигами стало падать от деления на ноль при запуске.
−121
if ($movie->{'genre'}=~m/\,+/) {
my @genre = split(',',$movie->{'genre'}) if $movie->{'genre'};
my $genre = join(",", split(',', $movie->{'genre'}, 2));
for (my $i = 0; $i <=1; $i++) {
$genre .= $genre[$i].',' if @genre;
};
$genre =~s/\,$//;
$movie->{'genre'} = $genre if ($genre);
};
На чем-то конкретном внимание заострять не буду.
Код достаточно прост, но довольно неуклюж.