Andrea Raimondi
Members-
Content Count
52 -
Joined
-
Last visited
Everything posted by Andrea Raimondi
-
Hello! Anyone knows of an expert that, given a project group, will automatically toggle all projects to Win32/64 according to what was previously using(i.e, switch to x64 if currently x32 and viceversa).
-
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.
-
Typecasting interfaces to keep code loosely coupled and LiveBinsings
Andrea Raimondi replied to Carlos Tré's topic in Algorithms, Data Structures and Class Design
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. -
As a Delphi expert, do you ever need to refactor or improve your code?
Andrea Raimondi replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
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. -
pre-generic dictionary class
Andrea Raimondi replied to dummzeuch's topic in Algorithms, Data Structures and Class Design
Yo! Use an interface and then create two different implementing classes, one for DXE+ with a TDictionary and another one using some minimal custom list. Then you compile it accordingly. -
Why TList uses a lot more memory than TArray?
Andrea Raimondi replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
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. -
Is Class with 2 'nested' constructors bad design?
Andrea Raimondi replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
Use nested, private classes and expose the whole thing via proper methods. -
ListView Multiple Columns overlapping text
Andrea Raimondi replied to RTollison's topic in General Help
You need to detect the real DPI and then expand the widths etc. Look into MultiMon and ShellScaling units.- 2 replies
-
- listview
- multple columns
-
(and 1 more)
Tagged with:
-
TDataset with non-contiguos fetch-on-demand
Andrea Raimondi replied to Wagner Landgraf's topic in Databases
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 :) -
RTTI usage and edge cases :) Can't use GetType on T
Andrea Raimondi posted a topic in RTL and Delphi Object Pascal
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: 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 -
RTTI usage and edge cases :) Can't use GetType on T
Andrea Raimondi replied to Andrea Raimondi's topic in RTL and Delphi Object Pascal
Yeah, makes sense what you're saying, I'll have a look at this, First thing though I want to make it work 🙂 -
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.
-
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.
-
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.
-
Linux Support on Pro Edition
Andrea Raimondi replied to Alexander Elagin's topic in Delphi IDE and APIs
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. -
Depends on what edition you have. If you have Pro, the main advantage with LiteDAC is that you can then use other providers as well to connect to a remote datababse.
-
Use RAPWare and all your nightmares will be laid to rest.
-
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.
-
Hello! Over the weekend I have posted a survey in various FB Delphi communities about my book's content planning. Here's the link: Survey Please do take it if you want, it's short and sweet: 6 questions. Kind Regards, A
-
Web dashboard application
Andrea Raimondi replied to Davide Visconti's topic in Network, Cloud and Web
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. -
Just find the corresponding style resource. The colour is there.
-
Hello! I have a day job that I enjoy very much, but I'd be interested in extra, short-term assignments. If you got anything that you can't do for whatever reason, please give me a shout,
-
- delphi
- integration
-
(and 1 more)
Tagged with: