Jump to content

Search the Community

Showing results for tags 'spring4d'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Delphi Questions and Answers
    • Algorithms, Data Structures and Class Design
    • VCL
    • FMX
    • RTL and Delphi Object Pascal
    • Databases
    • Network, Cloud and Web
    • Windows API
    • Cross-platform
    • Delphi IDE and APIs
    • General Help
    • Delphi Third-Party
  • C++Builder Questions and Answers
    • General Help
  • General Discussions
    • Embarcadero Lounge
    • Tips / Blogs / Tutorials / Videos
    • Job Opportunities / Coder for Hire
    • I made this
  • Software Development
    • Project Planning and -Management
    • Software Testing and Quality Assurance
  • Community
    • Community Management

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Delphi-Version

Found 10 results

  1. Hello, Does spring4D have a similar method as the Python enumerate() method? I feel this should be possible, if the "standard enumerator" that is returned now was wrapped inside an enumerator that returned a record that contained the index and the original <T> itself. In fact, this special record could implement record based conversion methods to convert automatically to both an integer and T. I imagine coding something like this var myColl:=TCollections.CreateList<TSomeClass>; // add some stuff to the list for var curItem in myColl.EnumerateWithIndices do begin // at this point, curItem is really a record, with fields Index, TSomeClass someArrayOfInt[i]:=curItem; // implicit conversion to integer SomeClassList.Add(curItem); // adds the TSomeClass that is returned to another list, implicit conversion to TSomeClass end; Does something like this exist?
  2. Hi there, I convert legacy application to using Spring4D container for dependency injection. For memory leaks using FastMM4. Occasionally appear memory leak in different places and I solve them gradually. The problem is with the use of dependency injections, FatsMM generates very large log file (aka 2GB) and very long time.Some registered class in container not call Destroy (memory leaks in dependency graph). Is there any way to more easily and quickly detect places where there is a memory leak? Any extension for container or different method?
  3. L.S., I have downloaded the String4D repository, and tried to install it in Delphi 12, using the tool "Build.exe". It failed, showing the message "Failed to build the task: Packages\Delphi12\Spring4D.groupproj". What can I do? Please help.
  4. Hi! I have followed the installation manual for Spring4d. Cloned the repository and ran the build.exe, without running tests, with the Update Registry option checked. Units and classes are definitely indexed because I can go to them with ctrl + click, but I am getting these weird errors: 1) Could not compile unit Spring 2) File not found Spring.inc . How can I solve it?
  5. I have many registrations in spring4d container. In DEBUG mode start application OK but in RELEASE before show first SplashScreen I get error: Cannot resolve type: xxxxType Hi can I quickly identify where is problem? Cannot use brakpoints,container logging etc. My xxxxType is very much used accros application and inject in many places.
  6. System.Rtti contains a lesser known, but powerful class TMethodImplementation, which is basically hidden and used in TVirtualMethodInterceptor. Outside this use, it cannot be created directly and it can only be accessed by TRttiMethod.CreateImplementation. I recently discovered that Spring4d extends its use through a helper for TRttiInvokableType, so it can be used with standalone procedures and functions as well as with events. Here is a small console app showing how it can be used: program MethodImplementationTest; {$APPTYPE CONSOLE} {$R *.res} uses System.SysUtils, System.TypInfo, System.Rtti, Spring; type TSimpleProc = function(I: Integer): Integer; procedure ImplCallback(UserData: Pointer; const Args: TArray<TValue>; out Result: TValue); begin WriteLn('From Implementation'); Result := Args[0].AsInteger * 2; end; var Proc: TSimpleProc; begin ReportMemoryLeaksOnShutdown := True; try var RTTIContext := TRttiContext.Create; var RTTIType := RTTIContext.GetType(TypeInfo(TSimpleProc)); var ProcImplementation := (RTTIType as TRttiInvokableType).CreateImplementation(nil, ImplCallback); Proc := TSimpleProc(ProcImplementation.CodeAddress); WriteLn(Proc(2)); ProcImplementation.Free; except on E: Exception do Writeln(E.ClassName, ': ', E.Message); end; ReadLn; end. Output: From Implementation 4 Simple and easy. Spring4D is full of gems. I wish the above functionality was part of the standard library. I can think of many uses: Python4Delphi contains a unit MethodCallback which uses complex assembly to convert methods into stubs that can be used with external C libraries. It could be rewritten using TMethodImplementation, without assembly code. Also in Python4Delphi, the implementation of Delphi events using python code could be very much simplified and generalized using TMethodImplementation. You can create Delphi functions, procedures and methods, event handlers on the fly that are implemented by python code. Similarly functionality can be provided with other scripting languages.
  7. Using the GroupBy method, I wonder if it possible to "imbricate" GroupBy in Spring4D to generate a "two levels" tree in one pass Some sort of: var GByData : IEnumerable<IGrouping<string,TVariable>>; GByData2 : IEnumerable<IGrouping<string,TVariable>>; begin GByData := TEnumerable.GroupBy<TVariable, string>(IEnumTV, function (const ASVar: TVariable): string begin Result := ASVar.AppName; end); GByData2 := TEnumerable.GroupBy<TVariable, string>(GByData, function (const ASVar: TVariable): string begin Result := ASVar.PrjName; end); end; Thanks a lot, Eddy
  8. Hi, In testing the function TEnumerable.GroupBy<T, TKey>(const source: IEnumerable<T>; const keySelector: Func<T, TKey>): IEnumerable<IGrouping<TKey, T>> in Spring Version Dev 2021/03/24 and Version 1.2.4, I find that a noticeable difference is present if I am not mistaken. The 3rd listbox (in the associated example) does not have the elements in the same order (and is even incorrect in the dev version- maybe because defered execution) depending on the version. In version 1.2.4, the order is "stable", which is an interesting property from my point of view. Will the behavior of the Dev version be the one adopted in the next version? Thanks, Eddy ITreeData.zip
  9. I have problem with one factory. definition TSQLDataSuiteWorkerMethod = procedure(const aDataSuite : ISQLDataSuite) of object; TSQLDataSuite = class(TInterfacedObject, ISQLDataSuite) [...] public constructor Create(const aTableName: RawByteString; const aSQLKind: TModifyingSQLKind; const aProcessSQL : Boolean = True; const aBeforeWorkerMethod: TSQLDataSuiteWorkerMethod = nil; const aAfterWorkerMethod: TSQLDataSuiteWorkerMethod = nil); reintroduce; end; {$M+} TSQLDataSuiteFactory = reference to function(const aTableName: RawByteString; const aSQLKind: TModifyingSQLKind; const aProcessSQL : Boolean = True; const aBeforeWorkerMethod: TSQLDataSuiteWorkerMethod = nil; const aAfterWorkerMethod: TSQLDataSuiteWorkerMethod = nil): ISQLDataSuite; {$M-} container registration aContainer.RegisterType<TSQLDataSuite>.Implements<ISQLDataSuite>; aContainer.RegisterFactory<TSQLDataSuiteFactory>; resolve in code: fSQLDataSuiteFactory : TSQLDataSuiteFactory; var Data: ISQLDataSuite; begin Data := fSQLDataSuiteFactory('TableName', TModifyingSQLKind.SQLInsert, True, nil, nil); And after last l get exception from Spring4D: Unsatisfied constructor on TSQLDataSuite What have I forgotten? I use in the program dozens of factories, classes and interfaces, all based on the spring container, everything works correctly, only this case I cannot understand. ps. maybe it's worth opening a subforum for Spring4D?
  10. Larry Hengen

    Spring4D Persistence

    I am looking for the best place to ask questions regarding Spring4D's persistence functionality known as Marshmellow. I am starting a SQLLite3 project and would like to know how Spring4D maps the specified types in the Column attribute to SQLLite types. I also have a lazily loaded list owned by another object, call it Parent. When a Parent is created and saved to the database if I then try to add a Child object to the lazily loaded list, I get an error that: 'No delegate has been assigned'. My code looks like the examples I see in the test projects. What am I doing wrong?
×