Jump to content

Andrea Raimondi

Members
  • Content Count

    52
  • Joined

  • Last visited

Posts posted by Andrea Raimondi


  1. On 12/18/2019 at 2:39 PM, Dany Marmur said:

    Does anyone know why this property is not published at the TAction level? If so would you please explain.

     

    TIA /D

    My assumption here (which means I may be wrong)  is to discourage you from doing precisely what you're trying to do, i,e. change it at design time.

    With that said, it's a decision that sits quite well with me for the simple reason that it allows me to enable things as I go along, so that at any given point I can, for example, showcase things while still giving off that "unfinished" feel that is so important if you're dealing with upper management/customers/etc. 


  2. On 1/15/2020 at 11:12 PM, Stefan Glienke said:

    Personally I don't like LiveBindings that much - and I gave up on some MVVM-ish approach for Delphi.

    LiveBinding looks very cool at the beginning... until you try something more meaningful 😄

    I mean, Maurizio Del Magno's IORM solution seems to provide a neat MVVM implementation, but I am also in the camp "I don't really like the MVVM approach" as it's usually defined (i.e. chock full of RTTI etc.).

    I'd rather the compiler enforce things than having exceptions at runtime.

     

    But MVVM per se isn't a bad idea: you can do it pretty much the same way ASP.NET core does which isn't bad at all.

    The basic idea is this:

    Say that you have a TUser class with all of its properties (Name, UserStatus, etc.): this is your model.

    Then you have a TLoggedUser class with only the relevant information for the logged user (i.e. a Token, the UserStatus, etc.) and this is one of your ViewModels. You can have as many ViewModels as you need based on one single model. 

    What happens then is that you only deal with ViewModels everywhere else than where you need to deal with the model (which is usually not user-facing). 

    That approach I like and I think is sensible. TMS Aurelius allows you to do something like this by using a MultiModel setup. 


  3. On 2/12/2020 at 8:15 PM, Mike Torrettinni said:

    I've been thinking about this a lot lately: when you achieve 'expert' level and all your code is using classes, UI and logic is split, utility units are nice and organized, no or very little global variables... so, a 'perfect' code, when do you have a need to refactor your code?

    I don't know if I qualify as an "expert", but I find that as my knowledge grows I also come up with new solutions that work much better for the intended (and sometimes changing!) goals. 

    For example, recently, I have come up with a solution to reuse as much UI code as possible between FMX and VCL.

    While it still requires you to use different components (for the two libraries are much too different) there is still a lot you can do to minimise impact.

     

    Thus, I would say that as I gain experience, I find new ways to address new or existing problems which work much better for the goals at hand. 

    This also means I find myself refactoring a lot more than I otherwise would. 

    • Like 2

  4. Try setting "Capacity" to a proper value. 

    What I usually do is to load things in a TList<T> (or other such, for instance TObjectList<T>) then pass it over to an array with .ToArray .

    By setting Capacity, you should be able to improve the memory size. I know because I used this very technique in the high-speed parsing of thousands of lines per text file in a situation where you may have hundreds or thousands of them per day (the format was weird and I can't really delve into the details, NDA). But it absolutely works. 

    If the design allows it, you could even recycle the TList<T> with a clear so that you don't have to allocate many of them. 


  5. Hi!

     

    My guess is that the problem here is that you are trying to force the dataset to do something it wasn't designed for. 

    What you could do is to put a restriction that your users should *also* be using the TMS stuff for record streaming, then you could add some methods such that the server does this and transmits the data to your dataset. 

    Alternatively, you could create a separate query requesting MAX(ID) and using the exact same where and order by and then another one doing a select where the ID is the MAX(ID) you got and finally add this to your current dataset's data. 

    Either way you end up with a mess to maintain though :) 


  6. 3 hours ago, Stefan Glienke said:

    Wrong: TypeInfo(SchemaTemplate)
    Right: TypeInfo(T);

     

    Also fwiw making the entire method generic although you only need the typeinfo of T supports code bloat - it would be better to make it non generic and a small generic overload that just passes down the typeinfo to the non generic one.

    Yeah, makes sense what you're saying, I'll have a look at this, First thing though I want to make it work 🙂 


  7. 4 hours ago, edwinyzh said:

    Are you really, actually serious? You made me laugh, really. 

     

    Anyways, not sure I understand you here, but isn't orangeui.cn the domain? Isn't http:/ /www.orangeui.cn/download.php the download page? 

    By 'who's boss', do you mean the contact info? If so, their contact page provided seven ways you can get in touch with them, with a physical address. 

    The only real issue (for non-Chinese people) of this site is that, it is in Chinese only.

    The download URL is a network disk. Seriously, that's not how you're supposed to do it. Especially not a Baidu disk, but even the others would be problematic. I mentioned GDrive and wasn't pleased with that either. 

    Contact info: none of which leads to the domain.  Now, why is that important? Quite simply,  because - as non Chinese - we have no way to tell which of those methods will be "private" or at least as private as you can be in China. 

    Someone may need help for a commercial application and there has to be a reasonable expectation of privacy, which just isn't there when the Government can access all and any communications easily. 

    The 163.com one is nearly certainly hosted on Chinese servers, which is troubling privacy-wise, especially for those of us in Europe for the reasons mentioned above. I will concede that it's been around for pretty much as long as the internet in China because the numbers in URLs in China have special marketing meaning (for example 888.com was a thing). 

    As for the fact you're laughing at the suggestion, as I said, we have a supposedly "leader of the free world" who is embroiled in a Russia-defined scandal. At this point, I am just not ready to discount anything. 

     

    I can't even download the thing because I don't have a VM to put it on for analysis. If it were on GitHub, for example, I could safely browse the source code and have a poke around, but as it is, I can't. 

     


  8. On 5/10/2019 at 7:26 AM, Sherlock said:

    @Andrea Raimondi"These people" is a term with quite a negative connotation. But I agree with you.

    It is MEANT to have a negative connotation: they are clearly not doing things properly.

    No domain name, no proper download section (it's a GDrive, really!?), no simple way to understand who's boss. 

     

    There is a non-zero chance that this library may be a plant from some Chinese security department to get a foothold in the Delphi developers' community.

    If you think that this is fantasy, keep in mind that in the Oval Office there is somebody who is alleged to have conspired with Russia. 

    All of it screams "this is weird" and I haven''t even downloaded it for this very reason. 


  9. Hello!

     

    I am building a generic CSV importer. 

    The basic idea is to have an importer that I can call like so:

    var MyImporter : TCSVImporter;
         MyData : TMyData;
    
         MyDataList : TList<TMyData>;
    
    begin
    
      MyImporter := TCSVImporter.Create;
      MyDataList := TList<TMyData>.Create;
      MyDataList.Capacity := 1000;
      MyImporter.LoadCSV<TMyData>( FileName, Separator );
    
      while MyImporter.NextLine<TMyData>( MyData ) do
    
        begin
    
           MyDataList.Add( MyData );
    
        end;
    
     MyImporter.Free;
    
    end;

    The problem is that Delphi has become picky over what constitutes a "type". 

    This is the problematic code:

    procedure TCSVSchemaBuilder.BuldSchema<T>(SchemaTemplate: T);
    var AType : TRttiType;
    begin
      FSchemaItems.Clear;
      FNumRequired := 0;
      // Get type
      AType := RTTIContext.GetType(  TypeInfo(SchemaTemplate) );
      // if it's one of the correct types
      if AType.TypeKind in [ tkRecord,tkClass,tkInterface ] then
        begin
          if AType.TypeKind = tkClass then
            BuildSchemaFromClass( AType )
          else if AType.TypeKind = tkRecord then
                 begin
                   if AType.IsRecord then
                     BuildSchemaFromRecord( AType.AsRecord );
                 end
          else
            begin
              // If it's not a record or class, but it's still good, then it must be an interface type!
              BuildSchemaFromInterface( AType as TRttiInterfaceType );
            end;
        end
      else
        begin
          raise EImportSchema.Create('Cannot create schema by type '+AType.Name );
        end;
      if FSchemaItems.Count = 0 then
        raise EImportSchema.Create('Schema is missing critical information. Cannot proceed for '+AType.Name);
    end;

    The error I get is:

    Quote

    [dcc32 Error] BothSides.Import.Core.pas(317): E2019 Object type required

    Which is obviously a load of infamy because I have T there and that should be considered a type. This is especially true if we're saying that generics are done at compile time, an invalid type would have to block compilation. 

    What are your thoughts? Workarounds? Should this be submitted to QC because it is clearly a compiler bug?

     

    Kind Regards,

     

    A


  10. Look, I am all for commercial components where it makes sense, but these people... just no. 

    They need to get a proper website, proper payment providers, etc. What the heck is that? 

    No, no, no, please encourage these people to do the right thing.

    • Like 1

  11. I both agree and disagree at once 🙂

    I know, I do this often! 🙂 But let me explain.

     

    I AGREE:

    Linux should be available for Pro and Community edition

     

    I DISAGREE:

    At the moment, Emba does not have anything "Enterprise-y" for Linux in Enterprise besides Linux itself.

    Is this going to change? I don't know. I have already pointed this out to them as well, so who knows 🙂 

     

    And there is another thing as well: objectively, there are going to be far fewer people who will want a Linux edition of their servers given that a lot of Windows developers already have business arrangements with hosters for Windows machines and many just manage these in-house. Plus, honestly, how many developers used to FOSS will actually pay for Delphi? They will still probably settle for Lazarus and FPC because, hey, free! 

    It's a difficult act to balance methinks which is why I can see both sides of the issue. But I fundamentally agree: it should be available. 


  12. I am very surprised by this question.

    The biggest problem that UPX has is that Windows is blind-sided and memory management for the application at system level becomes a mess.

    The same is true for all other packers, including stuff such as Ice Licence (is that still around!?). 

     

    I have never used that stuff, never felt a need for it.

    • Like 1

  13. Hi!

     

    The beauty of Delphi is that if you design things properly you don't have to settle.

    Start easy with DMVC, which also has demos for Bootstrap to get you started and make sure that your data classes are well separated by the DMVC code.

    Once you have that running, you can really look into alternatives. The only issue would be the events: for that, I would go with push notifications (for example, Kinvey) on all platforms. 

    The reason for this is that you're still going to need them on mobile, so you may just as well use them across the board.

     

    Then again, plan it properly and you can change things around a fair bit.

×