Jump to content

David Schwartz

Members
  • Content Count

    1190
  • Joined

  • Last visited

  • Days Won

    24

Everything posted by David Schwartz

  1. David Schwartz

    Dealing with multiple component versions using the same ide

    The problem with this is there are both files on the disk as well as entries in the Registry that need to be changed -- AND kept in sync! MAYBE you could get by just by changing Registry entries if you were really crafty. The safest thing might be to create separate user logins for each Dephi configuration and install on a per-user basis. But that will eat up a HUGE amount of disk space before long. I've seen places I've worked solve it by having virtual machines they'd RDP into that were configured differently, but only one person could be using one machine at any given time.
  2. David Schwartz

    Choosing a Mac

    I'm unclear what sort of configuration you're looking at, but I'll share what I'm doing. I have a couple of Mac Minis that I use, as well as a MacBook Pro. All of them use Intel Core-i7 CPUs. I run Win 10 in a VirtalBox VM that I mainly run on a 2018 Mac Mini. I used to run on the older one (2014) but it's mainly used just for email now. I use multiple Spaces (ie, virtual desktops) and have #10 (ie, <ctrl>-0) configured to run MS RDP to connect to the older Mac Mini. I works fine for my needs. As side note, the Apple equipment all has 1GB Ethernet built-in, and I have a 1GB switch I plug everything into with Cat6 cables. That's a whole lot faster than going through WiFi with my router, and cheaper than buying a much faster router. I have to use RDP to access a remote Windows host and that's slow enough. Trying to connect my machines via my WiFi router is even slower. I have Delphi 10.4.2 installed in that VM, and have used several older versions as well. But the VM gets really bloated when you add multiple Delphi versions to it. I suggest making one Win VM and clone it, installing just one version of Delphi in each one. Then get a Samsung T5 or T7 SSD drive to off-load the VMs you don't need. The T7 might be fast enough to use in place of the built-in SSD. (These things really scream!) I've built software that runs outside the VM on MacOS just to play around, but nothing serious. I've also used CrossOver to host Win apps in MacOS, and it works surprisingly well. (Not for Delphi, but for apps I've built.) It seems a lot easier to deal with once you figure it out. I have a Z: drive set up that lets me access the host's file system and I backup files to it periodically. I also have a large backup drive connected to run Time Machine once a day. I have Dropbox configured in the host, and I use it to move files between computers. I don't run it inside of the VM because that seems redundant. I can easily reach it from Z:/dropbox when needed. I've read that people use a Mac Mini as a test environment, connected to a Windows laptop, but ... why? I used to do my dev work within VirtualBox on my MBP with a larger monitor connected, but it's a 2014 version as well, so the 2018 Mac Mini is generally faster. A newer MBP would probably do everything you need in a laptop. I'm not sure about using an M1 or M2 in the host and how that might affect the VM. Supposedly MS has a version of Windows that runs natively on ARM, and the Mac has an emulator for Intel CPUs that's invisible, but ... you'll have to figure that out yourself. Does D11 have a way to target both Intel and ARM CPUs for MacOS? I don't think D10.4.2 does. CrossOver does support the M1 chip.
  3. David Schwartz

    Delphi's __recovery folder

    I spent an hour on some form design work in Delphi (10.4.2) and then at one point where I started to select several objects on a form holding down the Shift key, it went out-to-lunch. I had to kill it from the Task Manager. I noticed the files for the form I had been working on were in the __recovery folder. But when I reopened Delphi, it showed an hour-old version of the form. I went to the Explorer window that showed the form files, and tried to copy them, but I got an error saying they weren't there. I refreshed the display and they were gone. I even tried to use an app to undelete files, but they were gone. How is this thing supposed to work? I've had it recover files in the past, where it opens a project then asks if I want to recover a file or two, but in this case it never asked. It seems to have just deleted the contents of the __recovery folder.
  4. Yes, I did read the article. I was referring to all of the posts made here in this thread earlier about how chatGPT isn't 100% perfect, so therefore it's a waste of time to even think about using it -- at least, that's my interpretation. If this tool uses chatGPT, then I assume the complaints made earlier about how error-prone chatGPT is (and AI in general) will apply equally to any tool that uses it. I started this discussion by showing some code that, while not impeccible, had a lot of useful stuff in it. I suspect that it's possible to get the same nonsense out of the tool mentioned in that article unless the inputs are highly constrained. ChatGPT happily accepts unconstrained input, and seems to make unfounded inferences that it uses to create nonsense output. Kinda like what most people I know do from time to time. But if the argument is that AI-based systems should protect against stupid questions that will prevent it from spitting out nonsense answers, then it will never give accurate answers 100% of the time. Nor will people ... but that's another story. I didn't write chatGPT, I just entered some queries and got back some stuff that I found interesting and shared here. The folks here say it's worthless nonsense and they don't want to have to worry about double-checking the quality of responses because of that. I'd like to remind everybody that it's possible to write LOTS of code in Delphi that will compile, and might even appear to make sense, but will give random and often unpredictable results, and sometimes even no results at all. Not to mention the long list of documented errors that Delphi has, and they exist as land-mines that will periodically produce unexpected results at best and run-time errors at worst.
  5. There are also the functions in StrUtuils like IndexText/Str and ContainsText/Str
  6. This looks like the same stuff everybody above is saying is too error-prone and therefore should be totally avoided. Most code I write seems to be what I call "plumbing code" -- moving data back and forth between object A to object B -- and it's boring, repetative, and very mechanical. ChatGPT has done a great job writing examples of code like this for me. But like all coders, it's not 100% accurate 100% of the time. Earlier commenters in this thread assert we shouldn't be using it at all if it needs to have it's work constantly checked, and just crank the same mundane code out ourselves. I find this type of coding neither fun or creative. But thanks for pointing out an article that basically reinforces what I said earlier. It's sad that so many people expect 100% perfection before they'll even consider anything like this.
  7. David Schwartz

    IsNullOrWhiteSpace???

    You probably don't need the class name in front. and isn't this form also acceptable: myString.IsNullOrWhiteSpace
  8. David Schwartz

    E2137 Method not used in base class

    Object-Oriented Programming involves three distinct things: Polymorphism, Inheritance, and Encapsulation. It seems you are not grounded in these yet. (Don't feel bad, none of us knew how to walk or talk when we were born, either. There's stuff in life that just needs to be learned. 🙂 ) You didn't show the declaration for the TBaseSkillPanel class, so it's unclear if you're inheriting from something else or not. I could guess it's several things, but I'll not go there. It's either declared like this: TBaseSkillPanel = class or like this: TBaseSkillPanel = class( TForm ) -- or something other than TForm The first one is a standalone class (which in Delphi's world is really implied as saying = class(TObject) ), while the second one is derived from some other class. This is what inheritance refers to -- you're extending the base class by adding more stuff to it and giving that new combined class a different name If you're inheriting from TForm or some other subclass that defines PanelResize, then it needs to have the virtual or dynamic attribute on its declaration to allow you to then say override but it's not required. In this case, the error suggests that there either is NOT a PanelResize method in the base class, or it is not tagged with a virtual or dynamic attribute, meaning the override is misplaced -- in fact, it doesn't belong there. The flip side of this would be where the base class DOES specify virtual and the derived class does NOT specify override on a method with the same name and signature. In this case, the compiler would warn you that the "method in the derived class hides the method of the same name in the base class". Sometimes you want that, in which case instead of override, you need to specify reintroduce to avoid the warning. (This is quite common when you want to use the same method name in the derived class but change its signature, usually by adding more parameters. It's most commonly encountered on constructor Create... methods.) I suspect you think that adding methods in a derived class requires you to include the override attribute. It's only needed if there's a method in the base class with the same name and signature that has virtual or dynamic specified. That's not correct thinking. Also, the use of virtual or dynamic (although dynamic is very rarely used) signifies the possibiity of polymorphism, which is an aspect of inheritance that gives you some rather magical abilities. I suggest you learn about these three topics; they'll help you understand and organize your code much better. They are fundamental to ALL aspects of object-oriented programming, which Delphi embraces quite extensively.
  9. New technology always comes with a lot of "noise". If you're not willing to tolerate that "noise", then you can just stand by and wait while others master the underlying technology while simultaneously figuring out how to reduce the "noise level".
  10. David Schwartz

    your own DB vs. 3rd-party?

    If you're building a web app that needs to save data in a back-end DB, I'm curious about the trade-offs between buiding your own DB using MySQL, MariaDB, SQL Server, etc., versus going with a 3rd-party solution like AirTable, DreamFactory, or something similar. (Suggestions for such services are welcome.) EDIT: I stumblled onto this and they've got a bunch of 3rd-party services that they work with. (I'm pointing it out as a source of info; I don't know anything about the vendor.) https://retool.com/integrations/ Honestly, over the past 20 years or so, I've worked on plenty of apps that rely on back-end DBs of various flavors (namely SQL Server, MySQL, Oracle, and PostgreSQL), but they've all been managed by an IT Dept. In theory, there's not much required. But it seems every one has had one or two major melt-downs per year. I like to focus on what I'm best at and leave other stuff like this to people who understand it more than I do.
  11. David Schwartz

    your own DB vs. 3rd-party?

    Time-to-market is my primary driver right now. I can integrate a 3rd-party API in a day or two. Reinventing what they've already built is just not a luxury I can afford at the moment.
  12. David Schwartz

    your own DB vs. 3rd-party?

    I found one that's great for saving files of various kinds: https://www.filestack.com/
  13. David Schwartz

    Which is the best book to learn Delphi

    Delphi has always maintained a strong commitment to backward compatibility, so pretty much ANY book you find will be useful for learning Delphi. At its core, Delphi is basically Pascal with classes added to it. So you can use pretty much any Pascal book as well, at least for the basics. Pascal was created to help teach programming, and books written for that purpose are far more informative about the language features than any book on Delphi is going to be. (It doesn't help that Pascal hasn't been used to teach programming for 20 years or so now, so basic Pascal books haven't been written in ages. And unless you want to learn Modula, you won't find anything that gets into "Pascal with classes". Dephi's "Object Pascal" is still with us today, but was never widely taught in schools.) So classes add another level of abstraction to basic Pascal. Related to this is Delphi's Run-Time Library, or RTL. But Pascal's UI never went past readln and writeln that worked on terminals of the era. Today they still work inside of a command shell window, and many people use them to demonstrate simple programs. 🙂 The real "magic" that Dephi brought us was Forms! To learn about forms, you have to dive into the Visual Control Library, or VCL, and that's a very specific set of abstractions that let you build GUI-based apps in Windows. Over time, a lot of stuff in the VCL has been moved over to the RTL and expanded upon. And in the past several releases, a ton of things have been hijacked from C# and added to Delphi's libs as "Helper Classes". You're not going to find much of anything that describes them other than just diving into the source code for the RTL and parts of the VCL. Maybe the Help files, although over the years, Dephi's "help" files haven't been particularly "helpful" for newer and more complex topics. From there, you'll get into specific types of classes that are more domain specific, and that's going to be where most books start to diverge. A lot of them will go into DB-specific stuff, and early books talk about things that are pretty much obsolete today -- eg., BDE and frameworks that pre-date the current FireDAC (FD) classes. But a book on Graphics or Games will focus more on using TCanvas and display-specific parts of the VCL as well as mouse, keyboard, and timer events. In other words, as you get into books about more specialized problem domains, they'll focus on different topics. That's where I'd draw the line between "basic" and "advanced" topics. If you're interested in Games, then a book that goes into detail on working with MS SQL Server isn't going to teach you much. A lot of us who've been working with Delphi since D1 have a large collection of books we've acquired over the years, and most of them are still useful, believe it or not. If you want to learn about creating components, there were some books written way back in the 90's that are still ideal for learning the basics, and they're hard to come by as well. A good gauge to use is perhaps the most commonly used thing in all of Delphi -- the basic TStringlist. It has been around forever. It gets a new method or two added here and there, and today it's far more useful and extensive than what it was back in the first release of Delphi. In fact, you could probably write an entire book on ONLY applications of TStringlist. For instance, one thing not many people know is that it can be used to read and write CSV files, and even let you access fields in each record. As you can see from Marco's book, as huge as it is, it could easily be TWICE the size if it included both details on things that have been around forever as well as on newer features. That's why the older books can be valueable -- they get into details on topics that nobody covers today simply to avoid making the books "too big". The topics are just as valid today as they were way back, but a book that included them would be a couple thousand pages long! Besides, you can only learn so much by reading books. I've learned far more over the years by reading code written by others than from books. Other programmers will invariably combine things in ways that you'll never see in books, because books just touch on isolated topics, while programs are more complex combinations of many different things and many levels of abstraction. Learning from books is more of a top-down process, while learning PRACTICAL topics is more of a middle-out process. If you want to challenge yourself to the limit, find something written in another OOP language you're famliar with, like C++, and try rewriting it in Delphi. That will force you to learn more nooks and crannies of the Delphi ecosystem than you'll ever get from any book!
  14. I believe the difference here is whether you're using VCL -- which is ONLY Windows -- or FMX -- of which Windows is ONE OF MANY target platforms that can be selected. That is, with Windows, you can use EITHER VCL or FMX.
  15. David Schwartz

    Combobox1.Items.AddObject(....)

    As Stano said ... there's always StrToInt( Combobox1.Text )
  16. David Schwartz

    Combobox1.Items.AddObject(....)

    Since the same field value (a numerical string) is being used in both places, all this code is doing is saving you a StrToInt conversion later one, and it's not necessary. It makes me think ... who in their right mind would put a bunch of numbers into a ComboBox? I'm guessing you have oversimplified your example. But perhaps not. Assuming not, and given that the ComboBox just has a bunch of numerical strings in it, you just need to say, "Combobox1.Text.AsInteger" to get its numerical VALUE ... when you need it. Why waste memory by doing the conversion earlier and sticking it into the Obect's array? Besides, the values in Objects are NOT Pointers, they're references to TObject instances. So you should cast them to TObjects, not Pointers. That still doesn't make much sense to me. Doesn't the basic TComboBox allow Names and Values to be specified? Or is that just the Raize version? Because that's what I'd use. (If not, then I'd use name=value pairs and a custom OnShow method to only display the Name part and then extract the Value part in the OnSelect handler.)
  17. Again, I think most of you are missing the point. In any workplace scenario, most code written by inexperienced programmers is checked by more experienced programmers. Also, just because the code passes unit tests doesn't mean it's "accepetable" code, although I'm sure there are organiations that would disagree with that. The point is ... ChatGPT seems to generate code somewhat on par with newbie programmers. There's a LOT of useful code it generates, and some that's wrong. It may not compile right off the bat, but that doesn't mean it's 100% useless. I can't speak for anybody else here, but while I know that there are lots of eyeballs on code posted to SO, most of it is short and STILL isn't something that can simply be copy-and-pasted into anything without spending time reviewing it and making it "fit in" with your existing code. That seems to be the "ideal" that everybody is holding up and saying, "Well, when it's as good at programming as I am, then I'll consider it worthwhile." I'd say, well bubba ... when it's THAT good, you and I will be out of work. There are plenty of things on SO where nobody offered up good solutions that ChatGPT can at least help with. Looking for stuff on SO is like going on a Treasure Hunt, and what you get is often no better than what you can get directly from ChatGPT. The thing is, ChatGPT is not just FASTER, but it will invariably get better over time. I've hired supposedly "experienced" devs over the years to write relatively small and highly-specific code units for me, and the quality of their code they sent me was mostly pretty low. Most, I'm assuming, couldn't even solve the problem I gave them b/c they just disappeared after a while. There's also a problem I encounter a lot on SO (among other places) where I'll ask for a solution to X and end up with a bunch of suggestions to redefine my problem to solve Y instead because they don't understand X. At least ChatGPT answers the question without trying to redefine things! And know-it-alls on SO frequently downvote QUESTIONS they don't like and argue about whether they should even be asked. In fact, I find that MOST Delphi questions submitted lately all have negative upvotes ON THE QUESTION ITSELF. This just screams out, "Don't post stupid questions here!" ChatGPT is far less judgmental in that respect, which I think is a Good Thing.
  18. David Schwartz

    VCL and VCL styles - bugs and future

    I'm sorry, but I really don't know what you're going on about. Historically speaking, Borland/Inprise/Codegear/Embt have always maintained a POV where they provide basic components and leave the door open for 3rd-parties to add fancier and more embellished components to the landscape. The thing you're pointing at really is that the Delphi landscape has been abandoned by most 3rd-party providers. Many of them just closed their doors, and many are making components for C#/.NET instead because the market is two or three orders of magnitude larger than for Delphi components. Follow the money and you'll see where the investments are being made. All of this needs to be taken against a backdrop where the entire industry has become far too fragmented, supporting too many different and incompatible platforms: Windows, MacOS, iOS, Android, Linux, and a bunch of smaller ones. VCL itself ONLY works in Windows while the entire world has shifted to a "mobile-first" development imperative, meaning iOS and/or Android. VCL doesn't get you there. So the MARKET has gone in a different direction entirely! Delphi has FMX to address this, but ... IntraWeb was introduced well over a decade ago and it's still hardly being used. I played with FMX in Windows, and I didn't like it. Everywhere I worked was 100% Windows, so I saw no need to waste my time with FMX. Microsoft creates standards mostly by buying up companies and then announcing their solution is the Next Big Thing. They do that pretty much every year or two, and as a developer who lives and breathes what Microsoft says, you'll need to keep shelling out more and more money to buy the SDK for their Next Big Thing, helping fund their ability to buy something else next year. You also have to abandon the time you've invested learning the last umpteen platforms they bought and shoved down everybody's throats, and learn yet another one that's not compatible with any of the previous ones. And don't forget that every 5-7 years they introduce a new version of Windows that deprecates older features that cause older software to break. (Apple has been doing that a lot more lately as well, and it's very expensive to keep up with all of the software they keep breaking.) From my catbird's seat, the future ahead is WEB APPS. And, sorry to say, neither VCL nor FMX will be useful on those shores. Honestly, I can pound stuff out in VCL incredibly fast. But it's really at the end of its life. There are tons of companies maintaining old Delphi apps written in D7 using VCL and fancy components like DevEx grids and whatnot. They're loathe to upgrade them at all, except on the fringes and where changes in laws require them to fix some things. Over the last decade, I can't think of anything that has been added to the Delphi language or the VCL that would add any real value to these old apps build in the D7 era. At least the newer versions of Delphi let you continue matintaining them without anything breaking, unlike most Microsoft tools that pay very little heed to backward compatibility. Give it up! Your comments make me think if the image of the guy standing in Tianamin Square in China trying to stop a brigade of tanks. While I totally agree with your general sentiments, this isn't about the VCL or Embt -- Windows Desktop apps are simply not where companies are investing in new software development efforts, and they haven't been for years. Like I said, follow the money and you'll see where the market is heading. Windows apps ain't it. Whether the future is being driven by mobile apps or web apps or AR/VR or AI or thought control ... NONE of that is reachable by VCL! The VCL is for WINDOWS DESKTOP APPS ONLY! And that is NEVER going to change. The VCL the last general store on a once vibrant Route 66 that has been bypassed by a bigger, faster freeway taking people to other places.
  19. So basically, ChatGPT and similar tools are the computer programming equivalent of Fox Entertainment Network? It seems to work fine for Fox! It has made lots of people very rich telling lies, and the people who are lied to have no problem defending them with their lives. Sadly, there are programmers who cannot tell the difference any more than people who can't tell that pretty much everything talked about on Fox is a lie. This only seems to argue for better and more disciplined unit testing -- unless you're working at an organization that will throw out the tests (votes?) if they don't give the results they want.
  20. I personally don't care. My experience is that most programmers tend to be fairly blunt about stuff anyway, which is how my mind works. But what you're saying points to the Achilles heel in ChatGPT which is that it's egoless, and there's really nobody to blame. So you can cuss and fume and say whatever you want, and nobody is going to care. Over the years, people have used the Bible to support just about every side of every moral issue known to man, and there have been more people slaughtered in the name of "god" over disputes springing from the various interpretations of it than perhaps anything else in history. Nobody knows the true authors, and whomever they were they lived 2000 years ago and certainly aren't around to defend how their words are abused today! What's going to keep that from happening with material generated by AI things like ChatGPT? I've worked with interns over the years, and on a good day they're marginally better than ChatGPT at writing code. For demos and samples, that's fine, but most of the code "isn't ready for prime time", as they say. That doesn't mean it's not instructive. For me, the greatest value I've seen in ChatGPT so far is that it can generate code and transform it (reliably) in ways that's beyond the ability of editors and regex expressions and would otherwise require some rather expert programming to implement. Said another way, it's good at generating what I call "plumbing" code, sort of what ETL covers. It also seems useful for getting a bunch of code that's reasonably useful for implementing an algorithm -- it may not be 100%, but it might take less time to get there than starting completely from scratch. (Of course, that's a matter of personal opinion, but it's a valid use-case.)
  21. I'm curious if anybody has done much interfacing with a DB via a REST API, and can share their insights and "best practices" that might differ from a locally-accessible DB server. I'm building a web app and I want my back-end service to talk with a DB hosted on a remote machine. I see the back-end service scaling up at a different rate than the DB and I want to keep the two independent for a while. My only experience is with DB servers that are hosted locally, either on the same machine or on a machine in a LAN that's on the same IP subnet and behind a firewall. Initially I need to save user-specific state data, as well as some canned audio and video files that are used from time to time. The links to the media files can be sent out directly since they're not protected, but the user-specific data need to be protected. My biggest concern is how to handle versioning of the DB, although being a web app going through my back-end service, there's really only one "user" accessing this DB, which is my back-end service. So what's the best way to handle adding new fields and especially new tables once it's in production? Are there other concerns that would need to be addressed?
  22. David Schwartz

    Best practices for working with a DB accessed via REST API?

    thanks. I'm working with TMS XData and a bit of Aurelius, and Sphinx can handle all of the auth stuff if I want to build it myself. The back-end DB is irrelevant, as Aurelius can connect to pretty much anything.
  23. David Schwartz

    Best practices for working with a DB accessed via REST API?

    You said: I do not. I'm looking for basic principles that rise above implementation issues. I didn't find anything there that was relevant to what I'm looking for, but I appreciate that they seem to ring a bell for you.
  24. Y'all seem to have missed the point -- this is what people are using StackOverflow for most of the time, and most of that code isn't any better than what ChatGPT produces. The biggest difference is there are a bunch of smartypants mods on SO who are constantly flagging crappy code, correcting obvious errors, and making tons of commentary about the code, the poster, and each other's comments. It's interesting how this thread looks so similar to a typical SO post.
  25. The problem isn't the source of the information. It's how the information is being used and framed / portrayed. Anybody who has been following what's going on with the defamation suits from Dominion and Smartmatic against Fox, their management team, and their on-air lying sacks of sh*t, can see how the people running Fox are clearly targeting viewers who have such flawed critical thinking skills that they'll fall for anything the talking heads on Fox say as long as it fits a particular pattern of communication or point of view. I have a friend who's retired, and all he watches on TV is Fox. I called him to ask if he'd make me a small loan for a few days and he said "sure, but I need to get cash." I said, "Why? What's wrong with Zelle?" He said, "Haven't you heard? The IRS is coming after anybody who uses payment things like Zelle for sending more than $600 to ANYBODY! I don't want to deal with the IRS over a stupid loan like this!" I thought, "Oh, boy, I guess this is the latest crock of BS that Fox is scaring people about this week..." He's on Social Security and doesn't even file a tax return because he doesn't earn enough, and yet he's worried about getting audited by the IRS because of nonsense Fox is blathering on about this week to make Biden look bad. It's pretty hard to deal with people who can't even break down the most simple things they hear or read in the media as they may or may not apply to them! Now we've got ChatGPT that is, in all likelihood, far more accurate and less biased than Fox, and yet people are up in arms over the mistakes it seems to be making. Sure, I've found several. But Dominion and Smartmatic are very likely to get default judgments against Fox to the tune of nearly $4 billion for the mountain of evidence their lawsuit discovery processes have shown that Fox exec and talking heads have engaged in a steady practice of telling lies to their viewers in order to boost their ratings and profits. Period. And the people who make the most noise about ChatGPTs errors probably don't even realize Fox is FAR less reliable and truthful -- nor will they even accept that as a possibility. There was a book published in 1976 by Joseph Wesienbaum called "Computer Power and Human Reason". He was the founder of MIT's AI Lab. At one point in the book, he said he was asked by a reporter something like this: "What is it that humans can do that judges, psychologists, and other experts can do that computers cannot do?" His response was, "the question is what we as humans should allow or not allow computers to do that humans do." I have not found that particular quote, but here are some others I found onilne: https://www.goodreads.com/author/quotes/496834.Joseph_Weizenbaum
×