-
Content Count
1237 -
Joined
-
Last visited
-
Days Won
25
Everything posted by David Schwartz
-
Using Continue in repeat statement
David Schwartz replied to Kryvich's topic in RTL and Delphi Object Pascal
I would expect it to go to the until statement and evaluate the condition rather than blindly jump to the top. Since both for and while loops have their condition test at the top, and repeat isn't used that often, the green up-arrow is meant to point to the condition, not the top of the loop. While the verbiage of the explanation may seem a bit ambiguous, the "iteration" is always gated by the condition. "until true" and "while true" are not the same, and they can be deceiving to a casual reader! Indeed, I think it fooled you as well. Personally, I'd use this because it's more obvious: while true do begin . . . end; -
I'm looking for something to use as the base of a simple audio editor that can be built to run cross-platform (Win, Mac, maybe Linux). able to set the basic channel settings (mono/stereo, 16/24 bit, sampling rate) single channel (mono or stereo) waveform display ability to record and easily edit (zoom in/out) recordings up to 1 hour a Normalize function would be good to have ability to Save As ... WAV, FLAC, MP3 As I said, pretty simple. (It's for recording audio books.)
-
Database connection as parameter in class creation
David Schwartz replied to baeckerg's topic in Databases
TMS has Aurelius that can generate ORM classes for you. -
Do you consider this type construct to be a smelly code?
David Schwartz replied to Clément's topic in Algorithms, Data Structures and Class Design
I suspect the main reason this occurs as "smelly" is because there are so few reasons to do this kind of thing in Delphi. It's far more common in c/c++ as old-timers think it's perfectly acceptable. if you have a justifiable need to do bit-whacking like this, then I say, do it. I probably wouldn't do it for, say, a mere 5% performance gain, but 50%+ is far more justifiable. It would be nice to see some comments as to what's supposed to be going on because average Delphi coders won't make heads or tails of the code. (I personally have trouble dealing with pointers in Delphi, since I do it so seldom.) And be especially careful to point out any dependencies on assumed sizes of vars, especially integers that can vary depending on the platform. (Better yet, use explicit types that ensure fixed sizes and explain why.) -
I have not encountered this before. Why is it needed? (just curious)
-
IDE Command Line Switch for NOT auto-loading the previous project
David Schwartz replied to PeterPanettone's topic in Delphi IDE and APIs
I think it changed a few releases back and the docs haven't been updated. -
10.3.2 as next or waiting for 10.4?
David Schwartz replied to johnnydp's topic in Delphi IDE and APIs
any guesses when 10.3.2 might be released? Don't they usually start these dog-and-pony shows within a few weeks of release? -
How do you organize units, forms?
David Schwartz replied to Mike Torrettinni's topic in General Help
I prefer to have FormCreate, FormActivate, FormClose, FormDestroy, and related stuff at the top so I can see the main flow. One practice I've seen used in many projects is to have a static procedure at the top that's used to create the form dynamically and initialize things. Otherwise, I try to group methods that are related, so if there are several methods related to a ListView, they'll be grouped close together. Sorting alphabetically can be annoying, especially when people stick a 3-letter prefix on method names to say something about the type of control they're for. -
If you're feeling ambitious, you could write an ObjectPascal interpreter that runs on Apache and acts similar to php. The challenge with that is there are elements in Delphi that have syntax and semantics that only apply to compiled code. An interpreted version of Delphi would need to be a little different. TMS Software has an interpreter that supports both BASIC and ObjectPascal syntax that you could probably use as a base for something. There's also DWScript, as was mentioned earlier. The problem with apps like WP and Drupal is they have not been written (historically speaking) in a very object-oriented manner, due to a bias lots of php coders have against OOP, believing it slows down execution time. Last I checked, Python was much slower than php (and fully OOP), yet it's use is growing extremely fast, so I guess execution speed is more of a religious issue than anything else. Then you've got all of the weird ways people do things OOP-wise with php code that would make most serious Delphi, C++, and C# coders gag.
-
I've been seeing that in 10.2 for a while as well.
-
Do you design each form for separate case, or use common forms for similar design?
David Schwartz replied to Mike Torrettinni's topic in VCL
Google shut down goo.gl recently, and while it's still working, the target file I was pointed at was moved, and you can't change the redirect. So, here ya go: https://www.dropbox.com/s/xfkxm3w0xl6y0ax/CodeRage9_code.zip?dl=0 -
How do you deal with git conflict annotations added to DFM files
David Schwartz posted a topic in General Help
I got a strange compiler error while trying to build some newly updated Delphi code from a colleague -- it said there was an error in the use of a 16-bit resource in a file. Hmmm.... very strange. It turned out it was caused by annotations that git added to highlight merge conflicts during a commit. This is a snippet from one that I found in a DFM file. inherited pnlHelpDog: TPanel <<<<<<< HEAD Left = 1183 ======= Left = 1020 >>>>>>> 091477ff512cddd0288e69e330a1024cd0f011b5 TabOrder = 4 I'm wondering how others deal with this? -
How do you deal with git conflict annotations added to DFM files
David Schwartz replied to David Schwartz's topic in General Help
We have 3 people on our project and two are trying to use git as if it's TFS. I keep telling them they're not using it correctly, but they refuse to listen. They also only use the command-line interfaces. They won't use a GUI. I know they're heading for a train-crash, and this is the first evidence of it. -
How do you deal with git conflict annotations added to DFM files
David Schwartz replied to David Schwartz's topic in General Help
at what point? Is this something that should be resolved during the commit / push process? I'm surprised to see these annotations in source code at all. -
Best/Simplest way to dynamically populate TVirtualStringTree from database
David Schwartz replied to Mark Williams's topic in Algorithms, Data Structures and Class Design
it's done once, and it can be done in the background (separate thread) so as to be almost unnoticeable. -
Do you design each form for separate case, or use common forms for similar design?
David Schwartz replied to Mike Torrettinni's topic in VCL
thanks. Unfortunately, it's a lot of material to squeeze into the allotted time. I had to cut out some stuff, and it was simpler things that I assumed most people would know. I've probably gotten more flack for that than anything. I should probably re-do it and include the detailed stuff I cut out, and go a lot slower. I think it would fit nicely in 90 minutes. Also, in one sense, everything I discuss there is very simple. It's just not obvious, nor is it how things are usually done when you're talking about interfacing with forms. Think of a form as any other type of object, and my discussion will make more sense. -
Best/Simplest way to dynamically populate TVirtualStringTree from database
David Schwartz replied to Mark Williams's topic in Algorithms, Data Structures and Class Design
Yes, that's basically what I meant. ICD10 codes are not "highly sensitive", nor is the data in any of the large queries we cache. Even so, that does not preclude caching data locally. (The problem with ICD10 codes is the copyright issues.) If you're loading this data via a typical TQuery or similar component, then you basically have it all loaded into memory, right? Most such components have SaveToFile and SaveToStream methods. You can usually trap them and do encryption on save and decryption on load. We're using some components from Asta, and they have a cool feature built-in specifically enabling local caching. And you can encrypt the data automatically if you want. As I said earlier, you could also employ something like SQLite as your cache. Yes, it's on the disk as a file, but it's an entire DB, and it also support encryption. What I'm trying to say is ... there are plenty of ways to approach local caching regardless of the sensitivity of your data. -
These are usually just problems in ordering of Free statements within Destructors. Since Interfaces are freed automatically, it's likely complaining that the Interface is being freed before something created within it is getting freed. Alternatively, the Interface is going out-of-scope before it should, and getting destroyed earlier than expected. Try putting breakpoints on all of the Free() and FreeAndNil methods being called in whatever is attached or derived from that Interface.
-
Do you design each form for separate case, or use common forms for similar design?
David Schwartz replied to Mike Torrettinni's topic in VCL
See if my CodeRage 9 presentation gives you any useful ideas: http://w5a.com/u/coderage-9-talk -
Best/Simplest way to dynamically populate TVirtualStringTree from database
David Schwartz replied to Mark Williams's topic in Algorithms, Data Structures and Class Design
Just because it's possible to access remote tables as easily as local tables doesn't mean you MUST do it that way! Pull down your static data and cache it locally. Most medical coding & billing apps require access to an ICD10 table (60k+ records) along with other mostly static data tables that can also be rather large. In one situation, the devs hooked a combobox to a query that scrolled thru the entire list of ICD10 codes, as well as a larger list that did the same thing, both via a live connection. It's a bit clunky. In another situation, the program downloads a couple dozen tables from the server and caches them locally when it starts up. The thing to focus on is the fact that ICD10 codes are only updated once or twice a year, and many of the other tables only grow -- ie., what was there previously doesn't change. So it ends up being pretty simple to download them to local cache files once, then load those into memory tables at program startup. It's WAY faster than pulling the data down from a server every time. You could also use something like SQLite to hold them. Check the server for updates periodically and set up a scheme that lets you only download the new records for tables that do change periodically. -
https://www.git-tower.com
-
Linux Support on Pro Edition
David Schwartz replied to Alexander Elagin's topic in Delphi IDE and APIs
We've got Delphi Enterprise Edition, and I can't seem to get Linux support to work. All the other platforms work, just not Linux. (We don't use anything other than Windows right now, but I was looking at building a Linux demo of some code that's currently running on a Windows server. Can't get Linux support to work.) -
I think this had (has?) something to do with the way an imaging class / component was pulled into GetIt, and it's the result of an ambiguous reference in the code. I removed the offending component and it still kept happening. So I haven't been able to run GetIt for a long time. It would be really nice if there was an alternative way of DLing and installing stuff from GetIt that didn't depend on waiting for the next release to come out before the problem got fixed. What's the point of having something like this if it gets disabled by some random component, then can't be fixed and can't be bypassed? I am not about to spend several hours uninstalling and reinstalling Delphi and two dozen component libs just to fix some weird bug that breaks something I use very rarely.
-
Constructors + Destructors in class helpers?
David Schwartz posted a topic in RTL and Delphi Object Pascal
I'm looking for any kind of discussion about the use of ctors and dtors within class helpers. I've seen stuff that says you cannot put class ctors and dtors in them, as well as examples that DO THAT. I don't want to do that; but I am trying to figure out how they get called if they're normal ctors and dtors. I've read that there are other limitations of things within helpers, but ... where do I find a complete discussion of class helpers? The only thing I've found on Delphi's wiki shows adding properties and methods, not ctors and dtors. SO hasn't turned up much of anything useful either. -
Anon methods passed as event handlers?
David Schwartz posted a topic in RTL and Delphi Object Pascal
The usual way of creating an event handler in Delphi is to double-click the right-hand field in the Events tab of the Object Inspector. This creates a method with the proper signature; when the form is loaded, the OnXyzEvent is assigned the method name: FOnXyzEvent := aForm.XyzEvent; In theory, it should be possible to do something like this for a typical event handler: FOnXyzEvent := procedure(Sender: TObject) begin doSomething; end; However, I have a TpgScript object that has an AfterExecute event with this signature: procedure TpgScriptEx.DoOnAfterExecute(Sender: TObject; SQL: string); begin // end; FScript.AfterExecute := DoOnAfterExecute; // this works fine // but for this, the compiler complains: // [dcc32 Error] myfile.pas(1258): E2010 Incompatible types: 'TAfterStatementExecuteEvent' and 'Procedure' FScript.AfterExecute := procedure (Sender: TObject; SQL: string) begin // end; If I try casting the procedure, I get an Invalid Cast error. This seems like it should be a compiler bug. Is there a workaround for this?