-
Content Count
1237 -
Joined
-
Last visited
-
Days Won
25
Everything posted by David Schwartz
-
TDateTimeHelper from D11 that can be used in D10.4?
David Schwartz replied to David Schwartz's topic in RTL and Delphi Object Pascal
Hmmm ... I didn't know that class helpers are inheritable, but in this case it's a record helper AFAIK, so that's not helpful. Still, it's of general interest and isn't the least bit proprietary, and could easily be made more widely available to all Delphi users rather than locking it into a single release. Yes, I know this is how they've always done things. That doesn't mean they can't change. They're trying to grow their market and user base, so being nicer to existing customers rather than pretending we don't exist would be a great start. (I'm as tired as everybody else of receiving emails inviting me to buy the product as a new customer.) -
TDateTimeHelper from D11 that can be used in D10.4?
David Schwartz replied to David Schwartz's topic in RTL and Delphi Object Pascal
Ahh, thanks for that. 🙂 I don't know if the Community Edition of D11 is available yet or not (the page doesn't say), but if these units are included there, then perhaps they can be used by earlier Delphi licensees? Maybe someone from Embt could get involved and see about making things like this more widely accessible to previous Delphi users? It's not like code mostly copied from other platforms is proprietary to either Delphi or EMBT. If these fail, how about getting access to a copy of the Interface portion of the DateUtils unit, or just the parts that are new in D11? Since I don't know what's there, simply grabbing stuff from some other platform wouldn't be terribly useful. The implementation part seems almost trivial since the methods I've seen can be rewritten using earlier syntax with very little effort. (If they'd make it so class helpers can inherit previous helpers, then they could simply be published as separate units available to every Delphi user.) Finally, if these changes have been ported to FPC or Lazarus, then I can use or adapt them. Does anybody know? -
TDateTimeHelper from D11 that can be used in D10.4?
David Schwartz replied to David Schwartz's topic in RTL and Delphi Object Pascal
Worth it? $900 upgrade to get a few class helpers they copied from Microsoft? Does that seem worthwhile to anybody here? They should make these library upgrades free for all Delphi users. Maybe they've been ported to FPC or Lazarus? If I had a copy of the interface spec, I'd write the implementations myself, as most of them are probably just one or two lines of code. -
moving a class implementation from desktop to server
David Schwartz posted a topic in Network, Cloud and Web
I'm looking for some insights on how people think about this.... I've been building a prototype to test out different things, and have some classes in units that do certain things. Now I'm thinking of moving them out to remote services (on a REST server somewhere). I realize a lot of web services are built from scratch to be that, but I like building a VCL-based app to test everything in one piece, then split it up. Does anybody else do that? I'd like to have minimal changes to the class interfaces (properties and methods), perhaps just by adding security-related details where needed. In my mind, I'd like to be able to sprinkle in a few attributes here and there, then copy the class to a different unit that runs on a REST server, set a flag in each unit, and the local implementation would effectively be stubbed out and replaced with calls to the remote service. I don't know if this would be a function of adding an Interface and some property attributes, or if it needs to work in conjunction with a particular web service (I'm using TMS XData), or something else. I suspect some folks here have actually done this, and I'm curious what they have to say about their effort. -
moving a class implementation from desktop to server
David Schwartz replied to David Schwartz's topic in Network, Cloud and Web
That's what I said in the first place. It still does not address the question I asked. How have YOU gone about splitting up a working class in a single Delphi app so the interface is preserved and the implementation resides at the other end of REST-based HTTP channel? I'm not asking, "is it possible?" or "has it been done?" I _know_ it's possible and HAS been done -- just not by me. I'm looking for people who have actually done it and can offer any insights into what they learned. So what did YOU do and what did YOU learn when you did it? -
Newly released book: Delphi Legacy Projects
David Schwartz replied to Bill Meyer's topic in Tips / Blogs / Tutorials / Videos
-
I do all of my Delphi development inside of VirtualBox on a Mac. I used Parallels for a while, but they switched to a semi-subscription model where they forced you to buy an upgrade every time your OS changed, which was usually every year. I switched to VMWare Fusion, which had much longer paid refresh cycles. I like it, but went to work at a place where they used Oracle's VirtualBox, which was free and open-source, and have been using that now for several years. It gets updated regularly and handles everything I need. The only thing to really watch out for isn't the VM per se, but the Windows registration mechanism that can be annoying if you want to make several copies of a VM to host different versions of Delphi (or whatever) for historical needs. After not using one of these VMs for a while, MS will require you to re-register the OS or it will get very annoying. This is especially problematic if you upgrade a VM b/c the Windows installation will think you just replaced the hardware and want you to re-register it. So don't upgrade / update your historical VMs that are just there for backups.
-
moving a class implementation from desktop to server
David Schwartz replied to David Schwartz's topic in Network, Cloud and Web
Just to be clear, I'm talking about starting out with a normal VCL app with some classes that do specific things, each in their own units, and the resulting EXE works fine. No Windows Services are being used, and the classes are just normal classes, not specifically designed to run as remote services. Now what I want to do is "stretch" the classes out with minimal changes to their interfaces so the implementation part is effectively moved over to a REST-based HTTP service somewhere (not a Windows Service). Initially it would probably be tested under a localhost web server. Perhaps we can call this a form of REFACTORING? I worked with a TDataSet library once (forget the name) where you could build your app on the local machine and it connected to a DB server somewhere. You'd set it up in a DataModule and add your logic there. It had a feature where you could set a flag, add a remote IP address, set up a name and pwd for security, then build another app that ran as a Windows service that used the same DataModule, set a flag in that one to say it was the other side of the connection, running on the appointed IP, and viola! You just moved all of the logic into a middle tier service. (Yes, I know this used a proprietary channel and the remote side ran as a Windows Service. I'm pointing to the CONCEPT, not this specific implementation. I want to use a REST-based HTTP service.) I'm curious if there's any way to do something similar without using a TDataSet? Just JSON going through a REST interface to a remote HTTP service ... or something along that line ? -
Newly released book: Delphi Legacy Projects
David Schwartz replied to Bill Meyer's topic in Tips / Blogs / Tutorials / Videos
You typically don't need to refactor older apps to build them in newer versions of Delphi. But moving a D5 app into something built with D10 and beyond could be quite a challenge, mainly because so many components suffered End-of-Life after D6 or D7, and then again when D10 introduced generics. If all of the 3rd-party component libs the app uses are still available, then you're in luck. If not, you're probably stuck with D5 unless you want to do some major redevelopment -- more than refactoring. -
Delphi beta testing a "premium" privilege?
David Schwartz replied to Brandon Staggs's topic in Tips / Blogs / Tutorials / Videos
Back in the 90's I used to love beta-testing stuff. I'd get free licenses for my efforts. Companies gradually stopped doing that. They made beta testing seem like they were doing certain users a favor by giving them an early look at the code. I tried that for a little while and never felt like anybody cared about anything I reported. It seemed like what we got as "beta" code was a copy of what was sent to manufacturing because nothing I found and reported was ever fixed. With Delphi, it got to the point where I not only stopped wasting my time looking at betas, I won't use any of the .0 releases until at least one patch has been issued. The vast majority of projects I've worked on were often at least one release behind, simply because there was usually nothing added from one major release to the next that added any value that exceeded the risk of having stable code get screwed-up. Last place I was at, there was a guy there for 7 years whose main job was rebuilding everything in the latest updates, doing a tiny bit of refactoring, and running tests for months to determine if it was "safe" to upgrade to the latest Delphi Release. Another group worked with C# and they were constantly upgrading, mostly because of improvements in core parts of the language and support environment. It always seemed to get more upgrades in one release as Delphi got in the past dozen. Of course, they had a whole team of guys working on their code, which was only a fraction of the size of our code base, and much buggier. I've applied for the Delphi betas only to be able to read the "What's New" docs. It became increasingly hard to get any of that data as they started tying it to the license level (price) you had purchased. But working for companies with a dozen or two licences (mainly just Pro), we'd get a conference call with one of the techs who'd go through the entire set of slides discussing new features, and they'd bust their humps to get us the early docs, beta code, and loved it when we'd send them feedback. We got the same treatment as when I was an MVP, but we were just regular customers with a bunch of licenses. And as an MVP, I put in dozens of hours of my time and didn't even get a complimentary license for my efforts. I had to pay for it out-of-pocket just like everybody else once the one-year license I was given to use while promoting Delphi for Embt expired. Now their licensing is so aligned with their financial needs that they look more like a car company than a software company. The past few major releases add more and more stuff that's targeted at enterprise needs and continue to ignore core things that have been ignored for a decade now. I don't know why I should keep paying a license fee for something that continues to keep adding stuff I'll never use while core things that newer languages and platforms keep refining and expanding upon. -
The Delphi Certified Developer // To prepare for the exam
David Schwartz replied to skyzoframe[hun]'s topic in Tips / Blogs / Tutorials / Videos
I suspect Marco Cantu's book would be sufficient. As I recall, most of the stuff on that first test is pretty much "core language" and "common objects". The second one gets into the really hairy stuff that's in the Enterprise Edition that nobody uses except in really large complicated projects. I think you'd have to either be a consultant moving through a lot of large and diverse projects, or work for someone who wants you to learn all of that stuff to teach it to others. I've never worked at a place that used ANY of that stuff, let alone ALL of it. Good luck! -
The Delphi Certified Developer // To prepare for the exam
David Schwartz replied to skyzoframe[hun]'s topic in Tips / Blogs / Tutorials / Videos
I passed the basic certification test without much trouble. I looked over the stuff in the "Master" exam and didn't even bother with it since I don't use most of the stuff that's there. Honestly, I think it's meaningless. Nobody has ever asked about it. I don't know why your family would care. Write a little program that they can relate to, they'll find it far more interesting and ask you to make changes, and you can do that and they'll be impressed. Explain that this is the exact same process programmers follow everywhere. Certification is a kind of "static knowledge" valid at the time you take the test. Stuff you don't use fades away over time. Offer to write some simple things for friends -- not games, but something they'd find useful. Something the certification tests cannot examine is how well you listen, ask questions to clarify, implement what you think was asked (based on written notes they read and approved), then demonstrate what you did while listening generously as they explain everything you "misunderstood". It's a dance of sorts, and you don't want to step on their toes while they flounder around. Belive it or not, this is an INCREDIBLY VALUABLE SKILL that will often be worth more than your programming chops. People have an idea in their head, and no matter how much effort they put into getting it out, maybe written on paper or on a text document or something else, it's rarely very complete. When you begin programming it up, you'll start to find all sorts of things they left out. When you ask them, some will stop and think and give you more details, while others will wave it off and say, "Do whatever you think is best". In my experience, this is the hardest part of building software -- not the "programming" but translating a vague idea trapped inside somebody's head into something that comes close to what they were actually thinking. It will NEVER be EXACTLY RIGHT ... our goal is to get "close enough" so the person or committee will sign-off on it. And sometimes they won't, just because. So you need to learn to document everything so you can show them that you did everything they asked and they approved your work at each step. Certification doesn't mean squat if you can't create and deliver something that someone wants or finds useful. I think that Delphi Cert is the only one I have, and I only took it b/c it was offered for free with one of the Delphi upgrades I got. Whoopee. But I've solved problems at different places I've worked that their whole team of "certified" people couldn't figure out. And boy does that piss people off! Sometimes you just can't win for losing. But that's life. -
Show us your definition of TCardForm. At the top of the example you declared CardForm as a TForm. The compiler is complaining that it can't find TCardForm's definition anywhere. Where is it? Maybe you're missing a unit in the uses clause?
-
This could be a fun little challenge ... I got to wondering what is the shortest bit of code that would let you download a file (mp3 in my case, but any file in the general case) given a URL to a public web site? I'm mainly interested in Windows and WebCore, but solutions for other platforms would be interesting to see as well. function DownloadWebFile( const aURL : string ) : TStream; How many different ways can this be done on each platform? It boggles the mind. Which offers the least amount of Delphi code to accomplish it? (I suspect there are some libraries that have this built-in, but I'm lookng for something that uses low-level APIs, not another library. In my case, I'm calling a REST API and it sends back a URL for an MP3 file, and I need to download it and do something with it.
-
Validate data against a set of rules
David Schwartz replied to karl Jonson's topic in Algorithms, Data Structures and Class Design
I'd start by defining a "Rule" that lets you give some conditions and how to check against them. Some things are simple that only need to look at the data item, while others are going to require related (dependent) data stored elsewhere to be tested for validation. So you may want to stagger the testing, filtering the easy stuff first, then queuing up things that require remote access in a way that can do larger batched queries that can pull down data for local evaluation rather than firing off a bazillion simple queries at the back-end. But if there's no easy way to narrow-down the search set, then you might want to send all of the dependent queries to a stored proc on the back end and let it process them and return a table with the results. I've seen all of these approaches in pratice, and it just depends on the nature of the dataset. I also saw one that was optimized for an initial dataset that eventually outgrew it's initial performance assumptions that was getting slower and slower because of back-end data growth, and nobody wanted to touch it for fear of breaking something. So scaling-up over time should be taken into consideration as well. And maybe there's a way to do it all in the back-end DB, but most of the rules that can be applied to the DB tables and fields are to ensure integrity of data in the DB, not application-facing field validation. I'm not sure how you'd do that other than maybe defining a custom table with triggers and whatnot for field validation, then selecting data to copy into it and see what gets blocked. This is a relatively common thing in DB apps, but I'm not sure if there's much built-in to any DBs that lets you implement it. I've seen some apps where this kind of validation resulted in the largest and most convoluted methods in the entire app, and they were hell to maintain. I've never seen a very elegant solution, TBH. -
Man, you guys are just relentless at splitting hairs! I'm simply trying to uncover options that may not be obvious and are fairly short solutions. What's the point of spending a ton of time coming up with rules for a truly casual inquiry that people are only going to put under a microscope anyway? Trolling implies some kind of agenda (to me, anyway). I just posted this out of curiosity. Lots of great answers, thanks to all. More are still welcome if anybody cares to add any.
-
I have a situation where I've got a form that has a bunch of listboxes on it. I stuffed them full of (static) data and it was convenient to leave the data there. Now I want to move the logic into a formless unit. I saved the contents of these listboxes to flies. But in the end, I'd prefer not to have several files nor even one zip file that the app depends upon. A long time back there was a component whose name escapes me that was a sort of file store to save things like ini and txt files right on a datamodule so they were compiled into the program. In this case, there are about 15 txt files that I'd like to drop into such a component, perhaps inside of a zip file and save the zip file there (to save space). Any ideas on components or ways to accomplish that, other than saving them as a bunch of JSON or CSV text somewhere. BTW, they do get updated periodically, but very infrequently. I've actually been saving the data in TRzTabbedListbox components, and I open the IDE and edit the data in the property editor when I've needed to change anything.
-
RIght, I'd forgotten about that. This data hasn't changed in years. The advantage I see of the on-board storage is it applies Zip compression to the data so it gets shrunk down by 80% or so. I guess I could do that by adding the files into a zip file first than putting that into the .rc file, but it's just an extra step for something that can easily get missed. (But the program won't work without these files, so ...) Also, the compression helps in obscuring the text in case anybody is casually looking at the binary data. But I appreciate the reminder.
-
Could be. It has been a long time since I looked at it.
-
I'm just trying to uncover things like what Fred illustrated two posts above that may be hiding in places few people look. Without looking into Fred's solution, I don't know if it just saves to disk or if I can get back a TMemoryStream, which is what I need in this case. Most components have LoadFromFile / SaveToFile, and it is odd to me that nothing provides a simple GetFromURL and SaveToURL. Some people don't know that LoadFromFile/SaveToFile even exist on so many compnents and they write code to Assign File ... and whatnot instead. I was applying for a job one time and was given a short "programming test" for Delphi. It was pretty simple: load up a CSV file and display it; then delete a column, sort by the 3rd column and display it again. Another requirement was that you must employ a TStringlist in some way. Most people don't know that TStringlists can load and manipulate CSV files directly, and the guy who ended up hiring me said I was one of only a few people who seemed to know that. It's just something they've done for ages, yet very few people know. That's kind of what I'm trying to uncover here.
-
I have a general catch-all component library I use called AddOns that I put stuff like this into. You just need to be sure to change the name of the library in the call to Register so it ends up in that library with the others. It was very easy to do.
-
That's EXACTLY what I was looking for, and it works perfectly! Thanks!
-
Thanks, I know how to do this part. 🙂 the component in question allows you to take files and save them to the form so they're part of the application and don't need to be maintained separately. I'm looking for something similar. it looks like Atilla Kovacs posted something that's exactly what I'm looking for. I'm testing it now.
-
well ... to be most accurate, I guess what I'm thinking is ... starting from a fresh Delphi 4.2.2 install (the version I have), what's the least amount of lines of Delphi source code (probably in a function) that could be used for this. I'm not trying to save memory or have ultra-short variable names, but I've seen some fairly long examples that seemed like overkill for this purpose. Again, I'm calling a REST API call and it's returning a URL to a (mp3) file that I need to download; it's deleted in an hour or so, assuming it was grabbed fairly quickly. My code needs it immediately anyway, so ... I just got curious what the shortest amount of code needed to DL it into a memory stream for further dealings. I'd also accept something in a free component lib. But not dependent on any particular apps in the environment. Windows has Wininet, Mac has something, Linux has something. Whatever may be there. I guess if you could force something like Chrome to be installed, that might simplify things a bit.
-
again, I don't see what this is bringing to the party. It makes a zip file that's separate from the EXE, right?