- 1
- 2
- 3
- 4
- 5
int rkwifi_set_country_code(char *code)
{
sprintf(code, "%s", "EU");
return 0;
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+136
int rkwifi_set_country_code(char *code)
{
sprintf(code, "%s", "EU");
return 0;
}
Где-то в сырцах драйвера вайфая от RK3188...
+131
http://bolknote.ru/files/dogfight/
Возбуждает
+153
App.ns.SomeClass.prototype = {
addMessage: function(status, msg, timeDelay) {
if (status === false || status === this.STATUS_ERROR) {
status = this.STATUS_ERROR;
delay = timeDelay || 5; // default delay of msg box for error is 5 seconds.
}
if (!timeDelay) {
// 1 character - 1/7 sec
delay = msg.length / 7;
if ((delay < 3) && !(timeDelay)) {
delay = 3;
} else if ((delay > 30) && !(timeDelay)) {
delay = 30;
}
}
// показываем messagebox
}
};
Кручу-верчу, запутать хочу.
+132
procedure tnewthread.checkfiles; // процедура выполняется в потоке
var
i:integer;
status:tstatus;
ptmp:array of char;
temp:string;
len:integer;
fstream:tfilestream;
begin
flist.Clear;
findfiles(findpath);
for i:=flist.Count-1 downto 0 do
begin
status:=s_ok;
try
try
fstream:=tfilestream.Create(flist[i],fmopenread);
fstream.Position:=0;
setlength(ptmp,fstream.size);
fstream.Read(pointer(ptmp)^,fstream.size);
except
status:=s_error;
end;
finally
fstream.free;
end;
temp:=string(pchar(ptmp));
temp:=stringreplace(temp,' ',' ',[rfreplaceall]);
temp:=stringreplace(temp,'>','>',[rfreplaceall]);
temp:=stringreplace(temp,' ',' ',[rfreplaceall]);
temp:=stringreplace(temp,'<','<',[rfreplaceall]);
temp:=stringreplace(temp,'&','&',[rfreplaceall]);
temp:=stringreplace(temp,'"','"',[rfreplaceall]);
temp:=stringreplace(temp,'©',#169,[rfreplaceall]);
temp:=stringreplace(temp,#10,#13#10,[rfreplaceall]);
Len := Length(temp);
try
try
fstream:=tfilestream.Create('C:\1.txt',fmcreate); // заменил в целях теста, не помогает.
fstream.Position:=0;
fstream.WriteBuffer(temp[1], Len); // в этом месте поток вылетает с ошибкой "Range check error"
except
status:=s_error;
end;
finally
fstream.free;
end;
if status=s_ok then
begin
addfileinfo(flist[i]);
shrecyclefile(flist[i]);
end
else
begin
adderrinfo(flist[i]); // синхронизируемся с мемо и добавляем в него красную строчку с именем файла
shmovefile(flist[i],erroroutputpath +'\' + extractfilename(flist[i])); // перемещаем файл в директорию с файлами, при обр. которых произошла ошибка
end;
end;
end;
Процедура для обработки текстовых файлов. Имеем дремлющий поток, залоченный waitsingleobject, который будит
таймерная функция, если в папке есть по крайней мере 1 файл. т.е. одновременно к файлам обращается 1 поток.
При разлочивании поток немедленно начинает заполнять лист именами файлов, после чего начинает прогонять их
через процедуру-обработчик. Но вот беда - возникает ошибка range check error. причем возникает только в доп.потоке -
вне потока все работает нормально. Товарищи ,не подскажете, в чем лажа? (
+161
function foo(id) {
document.getElementById('1').style.display='none';
document.getElementById('46').style.display='none';
document.getElementById('2').style.display='none';
document.getElementById('53').style.display='none';
document.getElementById('55').style.display='none';
document.getElementById('56').style.display='none';
document.getElementById('57').style.display='none';
document.getElementById('58').style.display='none';
if (document.getElementById(id).style.display == "none")
{document.getElementById(id).style.display = "block"}
else
{document.getElementById(id).style.display = "none"}
}
Прислали с бывшей работы.
%%Саша, я таки ушёл.%%
−132
1.TextWindow.WriteLine ("Напиши число от 0 до 9 и я переведу его на английский")
2.Число = TextWindow.ReadNumber()
3.If Число = "0" Then
4.TextWindow.WriteLine ("Zero")
5.ElseIf Число = "1" Then
6.TextWindow.WriteLine ("One")
7.ElseIf Число = "2" Then
8.TextWindow.WriteLine ("Two")
9.ElseIf Число = "3" Then
10.TextWindow.WriteLine ("Three")
11.ElseIf Число = "4" Then
12.TextWindow.WriteLine ("Four")
13.ElseIf Число = "5" Then
14.TextWindow.WriteLine ("Five")
15.ElseIf Число = "6" Then
16.TextWindow.WriteLine ("Six")
17.ElseIf Число = "7" Then
18.TextWindow.WriteLine ("Seven")
19.ElseIf Число = "8" Then
20.TextWindow.WriteLine ("Eight")
21.ElseIf Число = "9" Then
22.TextWindow.WriteLine ("Nine")
23.Else
24.TextWindow.WriteLine ("Не знаю таких больших цифр")
25.EndIf
elseif число=10 then
msgbox "программа бо-бо"
else
msgbox "программа бо-бо"
http://vbbook.ru/small-basic/ysloviya--primeru-small-basic/
+120
http://cs409725.vk.me/v409725134/612b/bo_sT8EuYK4.jpg
+13
//Сегодня QuestionGovno.
//Допустим есть код:
#include <iostream>
using namespace std;
class T{};
struct M{M(T){}};
struct G{G(T){}};
int f(M){return 0;}
bool f(G){return 0;}
int main() {
bool a(f(T()));
return 0;
}
Казалось бы должна быть неоднозначность при компиляции, так как компилятор не знает какую перегрузку f бы выбрать.
И как бы так оно и есть:
http://ideone.com/o21NDg
Логично? Логично.
Но стандарт считает по другому:
http://en.cppreference.com/w/cpp/language/overload_resolution
Смотрите пункт:
Best viable function
F1 is determined to be a better function than F2 if implicit conversions for all arguments of F1 are not worse than the implicit conversions for all arguments of F2, and
...
2) or. if not that, (only in context of non-class initialization by conversion), the standard conversion sequence from the return type of F1 to the type being initialized is better than the standard conversion sequence from the return type of F2
Как мне повторить поведение, которое указано в стандарте?
+65
public class Path {
private String path;
private char winSep = '\\';
private char unixSep = '/';
public void set(String path){
if(!path.endsWith(File.separator)){
path.concat(File.separator);
}
this.path = path;
if(File.separatorChar == winSep && path.charAt(0) == unixSep){
this.path = path.replace(unixSep, winSep).substring(1);
}
}
public String get(){
String path = new String(this.path);
return path;
}
public String getRoot(){
String root = null;
if(File.separatorChar == unixSep){
root = "/";
}
if(File.separatorChar == winSep){
root = this.path.substring(0, this.path.indexOf(winSep)+1);
}
return root;
}
}
в 6 йаве нету класса Path, пришлось самому делать костыль-велосипед. тут где-то ошибочка есть, пока не смотрел.
+130
List<KeyValuePair<string, string>> documentList = GetList();
использование списка пар ключ-значение вместо словаря (Dictionary<string, string>)