Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 07/13/20 in all areas

  1. David Heffernan

    Open Type Arrays?

    This seems worse than method overloading to me. There you have compile time branching. Here you have to perform runtime type checking.
  2. I my last GExperts related blog post I wrote about the new “Close Exception Notification” expert which I just had added to GExperts. It was a hack that hooked the Exception Notification dialog. This spawned a discussion in the international Delphi Praxis forum and resulted in a rewrite of the expert. It’s now called “Filter Exception” expert and instead of hooking the dialog it directly hooks into the code that shows this dialog. Thus it prevents the dialog from being shown for filtered exceptions. Read on in the blog post.
  3. Vincent Parrett

    Open Type Arrays?

    This all seems like an over complication for little gain. Perhaps the OP could explain better what he is trying to achieve by this? As @David Heffernan said, this is worse than method overloading, and the need for that could be removed in many cases by allowing named parameter passing. IMHO, most uses of GetTypeKind in generic code is just making up for the lack of constraint types on delphi's generics.
  4. Uwe Raabe

    Open Type Arrays?

    And copy the method body in each? Well, it could split that code and put the pieces into the appropriate overload. On the other hand, that is exactly what a developer would do - and that is way more readable and maintainable (at least IMHO).
  5. David Heffernan

    Open Type Arrays?

    You mean with the code from OP?
  6. Mahdi Safsafi

    DDetours v2.2

    Hi, DDetours v2.2 is released. version 2.2(Jun 9, 2020): +Added support for older Delphi version: Now the minimal supported Delphi version is D7. +Added support for FPC. +Added recursive section feature: EnterRecursiveSection/ExitRecursiveSection. +Added param/tag feature for all InterceptCreate functions. +Added GetTrampolineParam function to get user param. +Added GetCreatorThreadIdFromTrampoline function to get thread id that created the hook/trampoline. +Added detection for non valid trampoline pointer. +Added unittest. +Replaced BeginHooks/BeginUnHooks by BeginTransaction. +Replaced EndHooks/EndUnHooks by EndTransaction. +Replaced GetNHook by GetHookCount. +Replaced TDetours<T> by TIntercept<T,U>/TIntercept<T> +Fixed many bugs related to MultiBytesNop. +Fixed wrong displacement value for some branch instructions on x64. +Fixed wrong offset size on x86 for GetJmpType function. +Removed v1 compatibility. +Now the library does not rely on Object. +Code refactoring. https://github.com/MahdiSafsafi/DDetours Some of the above features were planed for v3 that I started working on years ago. But I never get a chance to finish it. What a pity I'm rolling v2.2 instead of v3.2.
  7. Cristian Peța

    Open Type Arrays?

    For this case will work with Variant. procedure DoSomething(const AParam: Variant); begin ShowMessage(AParam); end;
  8. david berneda

    Open Type Arrays?

    Some languages offer union types to do this, for example in Typescript: https://www.typescriptlang.org/docs/handbook/advanced-types.html#union-types
  9. dummzeuch

    Open Type Arrays?

    Not necessarily. The compiler could generate a set of overloaded procedures for this.
  10. Hello, We're glad to announce the release of Resource Builder 4! Resource Builder 4 is the all-in-one solution that includes: Full support for Unicode in resources and RC files. Most precise and fastest RC compiler. Powerful editor for graphic resources and image files such as bitmaps, icons, cursors and other. You can create icons and cursors with any size (up to 1024x1024). Full set of resource editors for almost all resource types: dialogs, strings, menus, accelerators, animated icons and cursors and others. Support for really large resource data and resource files. .NET resources support. and more... Resource Builder web site: https://www.resource-builder.com/ You can download new version from: https://www.resource-builder.com/download-resource-builder/
  11. Stuart Clennett

    Handling MultipartFormData

    @alejandro The demo does not save the file at all. You are required to implement that. However it is quite simple. For example, in the `StoreDataAndFile` method in `Server.Resources.pas` you could use a memory stream to access the Bytes and save to a file if SameText(LParam.FieldName, 'image') and LParam.IsFile then begin Result.FileSize := Length(LParam.AsFile.Bytes); Result.FileName := LParam.AsFile.FileName; // This will save the file lStream := TMemoryStream.Create; try lStream.Write(LParam.AsFile.Bytes, Length(LParam.AsFile.Bytes)); lStream.SaveToFile(TPath.Combine(C_RootPath, TPath.GetFileName(LParam.AsFile.FileName))); finally lStream.free; end; end In this instance, `C_RootPath` is just a folder on the server where uploaded files should be saved, but you could make this dynamic based on user info in the Token for example. Hope this helps
  12. dummzeuch

    DDetours v2.2

    Doesn't compile with Delphi 7, 2005, 2006 and 2007. I have added issues with fixes to github for these. It's mostly that PNativeInt isn't declared for these older Delphi versions. Also doesn't compile with Delphi 2009 due to a different issue, but I have not yet found a fix.
  13. Stefan Glienke

    Varialbe set to nil

    Thats wrong, only the one that had the [weak] attribute needs to be a Weak<T>. If the reference a weak is pointing to is being destroyed the RTL takes care of making any [weak] marked reference nil. Same does Spring with a Weak<T>. With the pointer that does not happen. So if DoSomethingWithInterface2 happens to be called after TMyClass2 was destroyed (possibly not with this example but a common scenario) with the pointer approach you will run into an AV or other bad things if you dont explicitly set those weak reference back to nil which is why Remy made the dtor which did that - however in real code an object usually does not keep track of all the places it might be weak referenced.
×