Jump to content

John Kouraklis

Members
  • Content Count

    319
  • Joined

  • Last visited

  • Days Won

    5

Everything posted by John Kouraklis

  1. John Kouraklis

    Client Library for FusionAuth?

    Hi @Dan Moore, I ended up writing my own. It does not provide full cover of the API; I only added the calls I needed. I can share it with the community but need to clear it up a bit as at the moment it uses some proprietary code. I only used it for simplicity but it can be replaces with open source. Thanks John
  2. John Kouraklis

    Drag and Drop Component Suite for Delphi 10.4 Sydney

    Interesting...I am going to have a look at it. Sadly it does not support FMX apps
  3. John Kouraklis

    Hints and ShowHint

    @Anders Melander Are you sure ShowHint is inherited from the parent control? Shouldn't it respect the HitTest property?
  4. John Kouraklis

    Your RAD Studio 10.4 Sydney issues

    Yesterday, I got a new one: "The LSP is not running...Attempting to launch it again" or something like this. LSP never came back. I had to restart the IDE
  5. John Kouraklis

    Your RAD Studio 10.4 Sydney issues

    LSP form works...when it works What annoys me is that you first need to save a file before LSP is able to locate the changes--and this may not be what you always want. In all the videos EMBA presented and demonstrated LSP, they used units from the libraries. They never played live in the sense to add variables or procedures and then fire up LSP. In other versions I had CodeInsightPlus by DevJet which is an amazing product. Maybe they should have considered to buy it.
  6. Check this code: var forControl: Integer; forArrayDyn: array of Integer; begin SetLength(forArrayDyn, 10); for forControl := 1 to 10 do forArrayDyn[forControl - 1]:=forControl; for forControl := 0 to Length(forArrayDyn)-1 do begin SetLength(forArrayDyn, 3); Writeln(forArrayDyn[forControl]); end; end. In the second for loop, the size of the forArrayDyn changes from 10 to 3 and yet the for loop is able to access the elements above index 2. Given that for loops evaluate the initial and final values only once at the beginning of the loop, shouldn't this generate an AV? I understand that in memory there are still elements in positions where index >=3 but shouldn't the code break? The set length does affect the array because when I set a breakpoint I can see the change. Thanks!
  7. Hi, I am looking at some older code and I see the author uses the following statement: for i:=0 to Pred(WhateverList.count) do instead of the usual one: for i:=0 to WhateverList.count - 1 do Does it make any real difference or it's just a personal preference? Thanks
  8. John Kouraklis

    IDE Fix Pack 6.5 dev-snapshot 2020-05-17

    @jbg Thanks for the amazing work (as always) May I ask if you can add something in the compilation windows? I think having the Platform and the output directory would be very useful
  9. John Kouraklis

    Difference between Pred and -1

    @Mike Torrettinni Hahaha...yes...my bad 😋
  10. John Kouraklis

    Difference between Pred and -1

    I also use for..in all the time. Don't forget though that in for loops you can not modify the iteration variable. So, if you have a TStringList, this code does not compile: for item in list do item:=item + '123'; In such cases, iterating through the items via index is the only option for num := 0 to list.Count - 1 do list[num]:=list[num] + '123';
  11. John Kouraklis

    Why does this code work when it shouldn't?

    I see. thanks
  12. John Kouraklis

    Global StyleBook component

    You can also create a FormBase, add the stylebook and then inherit all other forms from this one.
  13. Hi people, I'd like some help about user management servers and how they are used in apps. This is a general question that applies to getting access to users either via Active Directory or FB contacts or Google contacts, etc. Say I have a connection to FB or to active Directory and people login in my app using FB or AD credentials. Now, all my users exist on FB or on AD In my app, users do stuff and therefore I need to keep some data as well. So, this means I need to replicate and keep a sunchronised copy of the user database. Is this how it should work? What's the common practice here? Thanks
  14. Hi, I've got a class and it has a property TDictionary<..,..>. I want to use RTTI to access the key and value of the dictionary. I am able to get the property but I can't figure out how to access the key and values. I use this approach: var genericDictionary: TDictionary<TKey, TValue>; propValue: TValue; ... propvalue.ExtractRawDataNoCopy(@genericDictionary); ---> Here I can see in the debugger that genericDictionary has the items and the correct count Then, I get AV when I try to iterate the Keys because TKey is an abstract class. Anyone can help? Thanks
  15. John Kouraklis

    How to iterate a TDictionary using RTTI and TValue

    Thanks Remy--Always good to learn
  16. John Kouraklis

    How to iterate a TDictionary using RTTI and TValue

    Remy, thanks for the explanation and for sharing your knowledge 👍. I admit that even if I had gone all the way down to retrieve the enumerators I would never have thought to Invoke them. I use 10.3.3 and the first instance of TKey in System.Generics.Collections is this: ------> This is line 748 (*$HPPEMIT END OPENNAMESPACE*) (*$HPPEMIT END ' template<typename TKey, typename TValue>'*) (*$HPPEMIT END ' inline __fastcall TPair__2<TKey, TValue>::TPair__2(const TKey AKey, const TValue AValue) :'*) (*$HPPEMIT END ' Key(AKey), Value(AValue)'*) (*$HPPEMIT END ' {}'*) (*$HPPEMIT END CLOSENAMESPACE*) [HPPGEN(HPPGenAttribute.mkNonPackage)] TPair<TKey,TValue> = record Key: TKey; Value: TValue; constructor Create(const AKey: TKey; const AValue: TValue); end; // Hash table using linear probing TDictionary<TKey,TValue> = class(TEnumerable<TPair<TKey,TValue>>) private type TItem = record HashCode: Integer; Key: TKey; Value: TValue; end; TItemArray = array of TItem;
  17. John Kouraklis

    How to iterate a TDictionary using RTTI and TValue

    @Remy Lebeau Wow....Amazing and complicated stuff. So I really need to drill down to the enumerator to get hold of the pairs. Thanks a lot for this!!! You mentioned that it might be unreliable to do this with generics. Do you think the app may crash for more complex dictionaries? Because it doesn't exist. For a dictionary, TKey and TValue are Generic parameters of the TDictionary class. They are not standalone concrete types, like you are thinking of. And out of curiosity, how does the compiler recognise TKey then? It must be from the HPPEMIT directive, right?
  18. John Kouraklis

    How to iterate a TDictionary using RTTI and TValue

    The whole code is part of a serialiser, so the dictionary type is unknown to the RTTI code. In the code above, I replaced TKey with string because I couldn't find the declaration of TKey.
  19. John Kouraklis

    How to iterate a TDictionary using RTTI and TValue

    Ok, now the more important problem as stated in the beginning. In this code, genDict throws an exception although propValue is correct program Project1; {$APPTYPE CONSOLE} {$R *.res} uses System.SysUtils, System.Generics.Collections, System.Rtti; type TObjDic = TObjectDictionary<string, string>; TMClass = class private fMC: TObjDic; public constructor Create; destructor Destroy; override; property MC: TObjDic read fMC write fMC; end; constructor TMClass.Create; begin inherited; fMC:=TObjDic.create; end; destructor TMClass.Destroy; begin fMC.Free; inherited; end; var mc: TMClass; ctx: TRttiContext; rType: TRttiType; rProp: TRttiProperty; propValue: TValue; genDict: TObjectDictionary<string, TValue>; begin mc:=TMClass.Create; rType := ctx.GetType(mc.ClassInfo); rProp:=rType.GetProperty('MC'); // In this code, this may seem redundant but I use this code is part of // bigger codebase propValue:=rProp.GetValue(mc); genDict:=nil; genDict:=propvalue.AsObject as TObjectDictionary<string, TValue>; if Assigned(genDict) then begin for var str in genDict.Keys do begin // For demo var f:=str; end; genDict.Free; end; mc.Free; end.
  20. John Kouraklis

    How to iterate a TDictionary using RTTI and TValue

    I found out that TKey in my code is declared (for unexplained reasons) in Data.DBXCommon with is irrelevant. Maybe that is the cause of the AVs I get. But now I don't seem to be able to declare TKey as data type although I include System.Generics.Collections. How do I declare it in a unit? It is originally declared using $HPPEMIT (Generics.Collections, line 750)
  21. John Kouraklis

    How to iterate a TDictionary using RTTI and TValue

    Hi Remy, I tried that (.AsType....) before as well; I run to the same problem of using TKey which is an abstract class although I can see in the debugger that the object points to the content of the dictionary.]
  22. John Kouraklis

    Just wanted to brag a bit :-)

    Amazing! Do you use any libraries on FMX for the GUI? Looks very responsive
  23. Hi all, I am fiddling with LiveBindings Expression engine and I know how to evaluate expressions, use objects, add custom functions. What I am struggling though is to evaluate logical expressions. For example this type: (3=5) and 8 Anyone knows how to do this? Thanks
  24. John Kouraklis

    LiveBindings and evaluating logical expressions

    @ErikB Hi Erik, just saw your reply. I will have a look at the link; thanks. Yes; I remember. It was a pleasure meeting you. Regards John
  25. John Kouraklis

    Advertising supported delphi desktop application

    I researched a lot this because I wanted to include ads in my desktop app as well. The bottom line is that all the content publishers support only mobile apps. I have seen the link you give before but I am unclear as to whether it works. I doubt TBH. Google ads does not allow desktop apps indeed and they ban your account even if you "fake" a website withing a browser component. I have a app on my desktop (TuneIn) that shows ads from google. In earlier versions, they were using Taboola but now they moved to Google Ads. When I was reaching out people from the ad networks, they all told me that the app is using a few google accounts and cycles them so detection is avoided. They also said that eventually google will figure it. If you download the app, you can click and drag and select all the components in the window; pretty much what you do in a web page. This makes me think that the app is written with some sort of web framework and is mocking a website and thus the ads show normally. One of those people I talked to said that in general revenue from ads in desktop apps is extremely low which in practice makes it a worthless choice unless you have 4-5 million downloads. He suggested to consider other forms of licensing, like freemium, etc.
×