Заметки о тестировании, программировании и прочий "поток сознания", который жалко писать "в стол"
пятница, 25 марта 2016 г.
четверг, 24 марта 2016 г.
#1206. Только код. Хеширование строк и использование строк как итераторов
'ДОКУМЕНТ' . 'ДОКУМЕНТ' string:ToUnicode . '--------' . 'ДОКУМЕНТ' string:CodePage . 'ДОКУМЕНТ' string:ToUnicode string:CodePage . '--------' . 'ДОКУМЕНТ' string:Hash . 'ДОКУМЕНТ' string:ToUnicode string:Hash . '--------' . 'ДОКУМЕНТ' string:SmallHash . 'ДОКУМЕНТ' string:ToUnicode string:SmallHash . '--------' . 'ДОКУМЕНТ' string:Hash:New . 'ДОКУМЕНТ' string:ToUnicode string:Hash:New . '--------' . 'ДОКУМЕНТ' string:SmallHash:New . 'ДОКУМЕНТ' string:ToUnicode string:SmallHash:New . '--------' . Hash16Table .for> . '--------' . 'ДОКУМЕНТ' string:Iterator .for> . '--------' . 'ДОКУМЕНТ' string:Iterator .for> ( char:ToString . ) '--------' . 'ДОКУМЕНТ' string:ToUnicode string:Iterator .for> ( char:ToString . ) '--------' .
#1204. Ссылка. VLO Framework
https://sourceforge.net/projects/vloframework/
Description
VLO framework (Visually linked Objects) is a development platform done in Delphi 2010 that allows you to draw TObjects in a TCanvas and link them with connectors.
воскресенье, 20 марта 2016 г.
суббота, 19 марта 2016 г.
среда, 16 марта 2016 г.
#1201. Ни о чём. Начинаю проникаться функциональным подходом
Начинаю проникаться функциональным подходом.
При написании своих шаблонов кодогенерации.
Или скорее - "моей интерпретацией (интертрепацией) функционального подхода".
Всякие там map/reduce и иже с ними.
А также ленивые вычисления и кеширование ранее вычисленного результата.
Без всяких правда "закорючек" и "монад".
Ну и "сам подход": Вход -> Преобразование -> Выход.
Ну и типа работа с коллекциями (filter/map):
При написании своих шаблонов кодогенерации.
Или скорее - "моей интерпретацией (интертрепацией) функционального подхода".
Всякие там map/reduce и иже с ними.
А также ленивые вычисления и кеширование ранее вычисленного результата.
Без всяких правда "закорючек" и "монад".
Ну и "сам подход": Вход -> Преобразование -> Выход.
Ну и типа работа с коллекциями (filter/map):
ARRAY FUNCTION .OperationsNeededElements ARRAY IN anArray anArray .mapToTargetAndValueType> .join> ( anArray .filter> .IsMessage .filter> ( .GetUP "Message ID" 'CM_' SWAP StartsStr ) .map> ( DROP GarantModel::Controls ) ) // .join> .joinWithLambded> anArray ( .Parameters .mapToTargetAndValueType> ) .joinWithLambded> anArray ( .AttributesAndOperations call.me ) .joinWithLambded> anArray .CanRaise .joinWithLambded> anArray .CanRaiseInSet >>> Result ; // .OperationsNeededElements
ARRAY FUNCTION .CommaListWith()
ARRAY IN aList
[
VAR l_WasComma
false >>> l_WasComma
aList .for> (
.WithComma: l_WasComma .KeepInStack
)
] .With() >>> Result
; // .CommaListWith()
ARRAY elem_func ParametersList
Cached:
(
Self .MethodParameters .map> .Name .CommaListWith()
)
>>> Result
; // ParametersList
...
elem_proc OutUses:
STRING IN aUCPrefix
^ IN aUsed
^ IN aLambda
ARRAY VAR l_Used
aUsed DO >>> l_Used
ARRAY FUNCTION .filterUsed>
ARRAY IN anArray
anArray
.filter> (
IN anItem
anItem .UnitName >>> anItem
if ( anItem l_Used array:Has ! ) then
begin
anItem array:AddTo l_Used
true
end
else
begin
false
end
) >>> Result
; // .filterUsed>
'uses' .Out
VAR l_NeedComma
false >>> l_NeedComma
Indented: (
aLambda DO
.map> .UnitProducer
.filterNil>
.filterMixIns>
.filter> ( Self ?!= )
.filter> ( .UnitName Self .UnitName ?!= )
.filter> ( .UnitName 'System' ?!= )
//.map> .UnitName
.filterUsed>
.for> (
IN anItem
anItem .IfDef: ( anItem .UnitName .WithComma: l_NeedComma .Out )
) // .for>
if ( Self .IsElementProxy ) then
begin
Self .UserCode: aUCPrefix ()
end // ( Self .IsElementProxy )
) // Indented:
';' .Out
OutLn
; // OutUses:
...
BOOLEAN elem_func HasFactory
Cached:
(
Self .Operations .filter> .IsFactory .CountIt > 0
)
>>> Result
; // HasFactory
...
BOOLEAN elem_func NeedFinalize
Cached:
(
RULES
( Self IsNil )
false
DEFAULT
(
Self .Attributes
.filter> ( .Target .IsManaged )
.CountIt > 0
OR ( Self .MainAncestor call.me )
)
; // RULES
)
>>> Result
; // NeedFinalize
...
BOOLEAN elem_func InheritsFrom
STRING IN anAncestor
anAncestor :Cached:
(
RULES
( Self .TypeName anAncestor == )
true
DEFAULT
(
Self .Inherits
.filter> ( anAncestor call.me )
.CountIt > 0
)
; // RULES
)
>>> Result
; // InheritsFrom
...
BOOLEAN elem_func IsConstructorsHolder
( Self .MainAncestor IsNil ! )
AND ( Self .Attributes .CountIt <= 0 )
AND ( Self .Operations .filter> ( .IsConstructor ! ) .CountIt <= 0 )
>>> Result
; // IsConstructorsHolder
...
BOOLEAN elem_func InheritsOrImplementsAcceptableForScripts
Cached:
(
RULES
( Self .Inherits .filter> .IsAcceptableForScripts .CountIt > 0 )
true
( Self .Implements .filter> .IsAcceptableForScripts .CountIt > 0 )
true
DEFAULT
false
; // RULES
)
>>> Result
; // InheritsOrImplementsAcceptableForScripts
...
BOOLEAN elem_func SomeAncestorImplements
ModelElement IN anIntf
BOOLEAN elem_func ImplementsLoc
Self .Implements .filter> ( anIntf ?== ) .CountIt > 0 >>> Result
; // ImplementsLoc
anIntf :Cached:
(
RULES
( Self .IsTypedef )
RULES
( Self .IsPointer )
false
DEFAULT
( Self .MainAncestorPrim anIntf call.me )
; // RULES
( Self .Inherits .filter> .ImplementsLoc .CountIt > 0 )
true
( Self .Inherits .filter> ( anIntf call.me ) .CountIt > 0 )
true
( Self .Implements .filter> .IsMixIn .filter> .ImplementsLoc .CountIt > 0 )
true
( Self .Implements .filter> .IsMixIn .filter> ( anIntf call.me ) .CountIt > 0 )
true
DEFAULT
false
; // RULES
)
>>> Result
; // SomeAncestorImplements
...
BOOLEAN elem_func InheritsOrImplementsMixIn
Cached:
(
RULES
( Self .Inherits .filter> .IsMixIn .CountIt > 0 )
true
( Self .Implements .filter> .IsMixIn .CountIt > 0 )
true
DEFAULT
false
; // RULES
)
>>> Result
; // InheritsOrImplementsMixIn
...
BOOLEAN elem_func ImplementsMixIn
Cached:
(
RULES
//( Self .Inherits .filter> .IsMixIn .CountIt > 0 )
// true
( Self .Implements .filter> .IsMixIn .CountIt > 0 )
true
DEFAULT
false
; // RULES
)
>>> Result
; // ImplementsMixIn
...
elem_iterator OtherMixinValuesUses
[empty]
.joinWithLambded> ( Self .Inherits ) ( .MixInValues .mapToTarget> )
.joinWithLambded> ( Self .Inherits ) call.me
>>> Result
; // OtherMixinValuesUses
...
BOOLEAN elem_func NeedsFakeMethod
Cached:
(
RULES
( Self .IsAutoHelper )
true
( Self .Properties .filter> ( .ReadsField ! ) .CountIt > 0 )
true
DEFAULT
false
; // RULES
)
>>> Result
; // NeedsFakeMethod
...
BOOLEAN elem_func IsSimpleClass
Cached:
(
RULES
( Self .IsStereotype st_UseCaseControllerImp )
( Self .Abstraction at_abstract != )
( Self .IsStereotype st_ViewAreaControllerImp )
( Self .Abstraction at_abstract != )
( Self .IsStereotype st_SimpleClass )
true
( Self .IsStereotype st_ObjStub )
true
( Self .IsService )
true
( Self .IsServiceImplementation )
true
( Self .IsScriptKeyword )
true
( Self .IsTestCase )
true
( Self .IsStereotype st_GuiControl )
true
( Self .IsVCMForm )
true
( Self .IsStereotype st_VCMFinalForm )
true
( Self .IsStereotype st_VCMContainer )
true
( Self .IsStereotype st_VCMFinalContainer )
true
DEFAULT
false
; // RULES
)
>>> Result
; // IsSimpleClass
BOOLEAN elem_func IsScriptKeywordsPack
Self .IsStereotype st_ScriptKeywordsPack >>> Result
; // IsScriptKeywordsPack
BOOLEAN elem_func IsUtilityPack
Cached:
(
RULES
( Self .IsStereotype st_UtilityPack )
true
( Self .IsScriptKeywordsPack )
true
DEFAULT
false
; // RULES
)
>>> Result
; // IsUtilityPack
BOOLEAN elem_func IsInterfaces
Cached:
(
RULES
( Self .IsStereotype st_Interfaces )
true
( Self .IsStereotype st_InternalInterfaces )
true
DEFAULT
false
; // RULES
)
>>> Result
; // IsInterfaces
: .FirstElement
ARRAY IN anArray
ModelElement VAR l_Found
nil >>> l_Found
anArray .trunc> ( DROP l_Found IsNil ) .for> ( >>> l_Found )
l_Found
; // .FirstElement
: .SecondElement
ARRAY IN anArray
ModelElement VAR l_Found
nil >>> l_Found
INTEGER VAR l_Index
0 >>> l_Index
anArray .trunc> ( DROP l_Index < 2 ) .for> (
IN anItem
( l_Index 1 == ) ?
( anItem >>> l_Found )
INC l_Index
) // anArray .trunc> ( DROP l_Index < 2 ) .for>
l_Found
; // .SecondElement
суббота, 12 марта 2016 г.
#1199. Ссылка. Что же тут написано? Я совсем забыл английский? Или кто-то со сленгом перебарщивает?
https://plus.google.com/u/0/+PatrickHughes/posts/gwM7X7ujPoD?cfem=1
"Well I'll be a son of a -
I'm finally getting my feet wet with Seattle and I thought I would do some GetIt exploring - my first visit and I've got a question or two.
Lo and behold I see some favorites:
VirtualTree - is this the same as VirtualTreeView originally created by Mike Lischke?
Along with that I see MustangPeak VirtualShellTools and EasyListView Has anyone here used these? I'm assuming since they are listed in GetIt they are functional in Seattle?
What do they mean source-only
What is TurboPack
What are some of your favorites?"
Я совсем забыл английский? Или кто-то со сленгом перебарщивает?
"Well I'll be a son of a -
I'm finally getting my feet wet with Seattle and I thought I would do some GetIt exploring - my first visit and I've got a question or two.
Lo and behold I see some favorites:
VirtualTree - is this the same as VirtualTreeView originally created by Mike Lischke?
Along with that I see MustangPeak VirtualShellTools and EasyListView Has anyone here used these? I'm assuming since they are listed in GetIt they are functional in Seattle?
What do they mean source-only
What is TurboPack
What are some of your favorites?"
Я совсем забыл английский? Или кто-то со сленгом перебарщивает?
пятница, 11 марта 2016 г.
#1198. Скрипты. Добавление методов "на лету"
PROGRAM SetWord.ms.script USES Testing.ms.dict ; : Holder ; // Holder Test&Dump SetWordTest VAR W @ Holder @ . 'A' AddMethod >>> W W pop:KeyWord:Name . W pop:KeyWord:Word . W pop:KeyWord:Word pop:Word:Name . 'X' W pop:KeyWord:Word DO 'Y' Holder -> A 'Z' Holder ->^ 'A' DO @ Holder .AddMethodWithParams: 'B' 'Hello' . Holder -> B @ Holder .AddMethodWithParams: 'C' @ . . Holder -> C @ Holder .AddMethodWithParams: 'D' ( 1 2 3 ) ( . . . ) Holder -> D @ Holder .AddMethodWithParams: 'E' ( 1 2 3 ) ( IN p1 IN p2 IN p3 p1 . p2 . p3 . ) Holder -> E ; // SetWordTest SetWordTestПример использования:
INTERFACE elem_func RegisterServiceImplementationMethod //Cached: ( 'bind' nil MakeFunction DUP VAR l_Boxed pop:WordBox:Boxed >>> l_Boxed l_Boxed -> Stereotype := st_ini::Operation l_Boxed -> Visibility := PrivateAccess l_Boxed -> %SUM := ( 'Регистрация ' Self .TypeName Cat ) //l_Boxed ->^ cUserCodePrefix ^:= ( Self .BindServiceImplementationUC ) l_Boxed .AddMethodWithParams: cUserCodePrefix Self .BindServiceImplementationUC ) >>> Result ; // RegisterServiceImplementationMethod
#1197. Ссылка. www.turbococoa.com. Создание нативных приложений для iOS БЕЗ FireMonkey
https://plus.google.com/105693813343868727274/posts/iegD9p4rLhz
"Hi Delphi people! Good news: Delphi CAN BE USED for true-native app development for iOS/Mac OS. Only small plugin needed www.turbococoa.com. Download for free. Your feedback welcome!"
http://www.turbococoa.com/
"
"Hi Delphi people! Good news: Delphi CAN BE USED for true-native app development for iOS/Mac OS. Only small plugin needed www.turbococoa.com. Download for free. Your feedback welcome!"
http://www.turbococoa.com/
"
Build native application using Delphi directly in Xcode
Design in Xcode. Code in Delphi. Build with TurboCocoa.
Do you want to know, how you can do true-native iOS/Mac OS apps in Delphi? Read our FAQ, watch our video, start your TurboCocoa."четверг, 3 марта 2016 г.
вторник, 1 марта 2016 г.
#1195. Эмуляция for..to
http://blog.marcocantu.com/blog/2016-february-stepping-values-for-loop.html
https://bitbucket.org/lulinalex/mindstream/commits/54a55b7cdfd83633727028150df2b5d8412ac44c
Понятно, что step несложно добавить - в Inc I - написать I := I+ Step
У меня по-моему "несколько лаконичнее" вышло, чем у гуру.
https://bitbucket.org/lulinalex/mindstream/commits/54a55b7cdfd83633727028150df2b5d8412ac44c
Test ForToTest
ARRAY operator to
^@ IN aFrom
^ IN aTo
@ (
OBJECT IN aLambda
INTEGER VAR I
I := ( aFrom DO )
Dec I
( aTo DO I ) - LOOP ( Inc I I aLambda DO )
) FunctorToIterator >>> Result
; // 1to
for ( 1 to 10 ) .
// - печатает числа от 1 до 10
'' .
for ( 1 to 20 ) .
// - печатает числа от 1 до 20
'' .
for ( 0 to 20 ) .
// - печатает числа от 0 до 20
'' .
for ( -1 to 20 ) .
// - печатает числа от -1 до 20
'' .
for ( -1 to 21 ) .
// - печатает числа от -1 до 21
'' .
0 for ( 1 to 10 ) + .
// - суммирует числа от 1 до 10 и печатает результат
'' .
for ( 1 to 10 Reverted ) .
// - печатает числа от 10 до 1
/*{
ARRAY VAR L
1to 10 >>> L
@ . L ITERATE
// - печатает числа от 1 до 10
'' .
@ . 1to 20 ITERATE
// - печатает числа от 1 до 20
'' .
0 @ + L ITERATE .
// - суммирует числа от 1 до 10 и печатает результат
'' .
@ . L Reverted ITERATE
// - печатает числа от 10 до 1}*/
; // ForToTest
ForToTest
Понятно, что step несложно добавить - в Inc I - написать I := I
У меня по-моему "несколько лаконичнее" вышло, чем у гуру.
Подписаться на:
Комментарии (Atom)
