+131
- 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
module Main:
program factorial:
algorithm factorial:
description of the algorithm:
factorial of n is the algorithm that calculates the product of all the positive integers less than or equal to n.
end of description of the algorithm.
example of usage of the algorithm:
var1 is equal to call algorithm with parameter n which is equal to 5;
begin of a comment:
var1 is now1 120 = 5*4*3*2*1.
end of a comment.
end of example of usage of the algorithm.
description of author of the algorithm:
name: John.
surname: Smith.
date of writing of the algorithm: 2009.
end of description of author of the algorithm.
properties of the algorithm:
callable from other modules.
callable from this module.
can be used in expressions.
end of properties of the algorithm.
parameters of the algorithm:
data n: type is positive integer.
end of parameters of the algorithm.
variables of the algorithm:
data res: type is positive integer.
data now1: type is positive integer.
end of variables of the algorithm.
initialization of the variables of the algorithm:
res is equal to 1.
now1 is equal to n.
end of initialization of the variables of the algorithm.
begin of the algorithm:
cycle: while now1 is not 1, repeat:
res is equal to multiply res by now1.
now1 is equal to subtract 1 from now1.
end of cycle.
result of the algorithm is res
end of the algorithm.
algorithm main:
description of the algorithm:
main algorithm that shows the factorial of the inputted number.
end of description of the algorithm.
example of usage of the algorithm:
end of example of usage of the algorithm.
description of author of the algorithm:
name: John.
surname: Smith.
date of writing of the algorithm: 2009.
end of description of author of the algorithm.
properties of the algorithm:
callable from the system.
end of properties of the algorithm.
parameters of the algorithm:
data arguments: type is array of strings.
end of parameters of the algorithm.
variables of the algorithm:
end of variables of the algorithm.
initialization of the variables of the algorithm:
end of initialization of the variables of the algorithm.
begin of the algorithm:
call algorithm writeInteger with parameter str which is equal to
call algorithm factorial with parameter n which is equal to
call algorithm readInteger without parameters.
result of the algorithm is 0.
end of the algorithm.
Небольшой ответ набирающему популярность WCT. Новый язык программирования LOOOONG:
- Отступы обязательны.
- Все блоки в функциях ("алгоритмах") обязательны.
- блоки нужно записывать именно в таком порядке.
- Имена параметров необходимо помнить, когда вызываешь "алгоритм".
- Ключевых слов ОЧЕНЬ МНОГО.
miscff,
22 Августа 2014
+157
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
<?
session_start();
if ($service_log == 1) {
header ("Content-Type: application/octet-stream");
header ("Content-Length: ".filesize("files_tech/".$dn));
header ("Content-Disposition: attachment; filename=".$dn);
readfile("files_tech/".$dn);
}
?>
alchy,
22 Августа 2014
+157
- 1
- 2
- 3
- 4
- 5
- 6
- 7
function detect_overlap(l1,l2,r1,r2,t1,t2,b1,b2) {
if (b1<t2) { return false; }
if (t1>b2) { return false; }
if (r1<l2) { return false; }
if (l1>r2) { return false; }
return true;
}
DeRain,
21 Августа 2014
+78
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
public class ComponentProvider implements ObjectProvider {
@SuppressWarnings("unchecked")
@Override
public <T> T provide(final Class<T> objectType, final AnnotationProvider annotationProvider,
final ObjectLocator locator) {
return objectType.getName().startsWith(
locator.getService(SymbolSource.class).valueForSymbol(FXSymbols.FX_PACKAGE)) ? locator.getService(
ComponentLocator.class).isComponentValid(objectType.getName()) ? (T) locator.getService(
ComponentInstantiatorSource.class).newInstance(objectType.getName()) : null : null;
}
}
и в конце грустное : null : null;
Lure Of Chaos,
21 Августа 2014
+62
- 1
- 2
wchar_t c1 =
(wchar_t)LOWORD(::CharUpperW((LPWSTR)(DWORD_PTR) MAKELONG(*i1, 0)));
Шиндовс, штроки, штрадания
http://llvm.org/bugs/show_bug.cgi?id=20712
roman-kashitsyn,
21 Августа 2014
−161
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
// RangeError: Error #2006: The supplied index is out of bounds.
// at flash.display::DisplayObjectContainer/getChildAt()
// at com.pt.utils::CustomSWFLoaderUtil$/isCorrectCustomSWF()[/var/lib/jenkins/workspace/<secret>/src/com/pt/utils/CustomSWFLoaderUtil.as:23]
private static function isCorrectCustomSWF(swf:SWFLoader):Boolean
{
if (swf &&
swf.content &&
swf.content is ContentDisplay &&
(swf.content as ContentDisplay).getChildAt(0) &&
(swf.content as ContentDisplay).getChildAt(0) is MovieClip &&
((swf.content as ContentDisplay).getChildAt(0) as MovieClip).numChildren == 1)
return (swf.content.getChildAt(0) is MovieClip);
else
return false;
}
Ну не фарт!
wvxvw,
21 Августа 2014
+143
- 1
- 2
- 3
- 4
- 5
http://vk.com/proger_girl?z=photo-34196141_334770895%2Falbum-34196141_00%2Frev
http://vk.com/tproger?w=page-30666517_48155477
http://vk.com/search?c%5Bq%5D=wct&c%5Bsection%5D=auto&w=wall172535832_2076
WCT - оно везде!
kegdan,
21 Августа 2014
+101
Кто делает выгрузка в таком формате???
xml? json? так лучше, епта
Cascader,
21 Августа 2014
+153
- 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
function parse(input) {
var options = arguments.length > 1 ? arguments[1] : {},
peg$FAILED = {},
peg$startRuleFunctions = { grammar: peg$parsegrammar },
peg$startRuleFunction = peg$parsegrammar,
peg$c0 = peg$FAILED,
peg$c1 = null,
peg$c2 = [],
peg$c3 = function(initializer, rules) {
. . .
peg$c142 = { type: "other", description: "whitespace" },
peg$c143 = /^[ \t\x0B\f\xA0\uFEFF\u1680\u180E\u2000-\u200A\u202F\u205F\u3000]/,
peg$c144 = { type: "class", value: "[ \\t\\x0B\\f\\xA0\\uFEFF\\u1680\\u180E\\u2000-\\u200A\\u202F\\u205F\\u3000]", description: "[ \\t\\x0B\\f\\xA0\\uFEFF\\u1680\\u180E\\u2000-\\u200A\\u202F\\u205F\\u3000]" },
peg$currPos = 0,
peg$reportedPos = 0,
peg$cachedPos = 0,
peg$cachedPosDetails = { line: 1, column: 1, seenCR: false },
peg$maxFailPos = 0,
peg$maxFailExpected = [],
peg$silentFails = 0,
peg$result;
. . . // + 3К строк бреда до конца функции
История моих мытарств и жалких метаний:
Меня попросило начальство радикально улучшить формат в котором приложение хранит данные. Думал я, думал, и решил, что YAML ка нельзя лучше подходит для задачи (нужно хранить описание слайдов презентации, т.е. много текста и довольно схематичная графика, все это желательно бы иметь возможность комфортно редактировать в текстовом виде, создавать заготовки и т.д.).
Шаг первый: поиск готового YAML парсера, врезультате обнаружились две штуки для АС3. Один - клон Ява парсера, в котором по класу на токен. Я не шучу. Проект заброшен 5 лет назад. Второй: заброшен 4 года назад, все в одном файле, парсится регулярками и магией, какие-то комментарии имеются, но они только свидетельствуют о несостоятельности писавшего коментарии.
Подумал: если нет нормального парсера, может есть генератор парсеров?
Шаг второй: поиск обнаружил одну попытку написать клон ANTLR, но очень ограниченную, и не работающую.
Думаю: ну бля, если все так херово, может с ж.скрипта портирую чего-нибудь простенькое, PEG как раз должен подойти.
И тут я нашел это.
wvxvw,
21 Августа 2014
−163
- 1
- 2
- 3
- 4
- 5
Стр = Строка(Формат(ТекущаяДата(), "ДФ=гггг"))
+ Формат(ТекущаяДата(), "ДФ=ММ")
+ Формат(ТекущаяДата(), "ДФ=дд")+"_";
Стр = Стр + СтрЗаменить(Строка(Формат(ТекущаяДата(), "ДЛФ=В")),":","");
Мусьё знает толк. Очердной туроператор склеил ласты =)
safer_bwd,
20 Августа 2014