-
Content Count
1237 -
Joined
-
Last visited
-
Days Won
25
Everything posted by David Schwartz
-
how to recognize cards drawn from a deck?
David Schwartz replied to David Schwartz's topic in General Help
I have no problem with licensing libraries, unlike a lot of programmers today. I draw the line at royalties on a per-use basis, however. A quick glance at this library tells me it's designed to be trained from a bunch of samples in order to classify and/or recognize unseen examples based on common features extracted from the samples. I only have a single example of each card. If you hold up the Ace of Spades, there's only one of them and it should not be confused by whether it's red or black, or a Club, Diamond, or Heart. I want to train it on all of the cards in the deck so it recognizes any given card from that deck that's held up to the camera. Noise might be present in terms of variances in color tint and hue, brightness, contrast, and orientation, but the same details are unchanged and not fuzzy nor ambiguous. -
Dynamic array used as a queue. Memory fragmentation?
David Schwartz replied to A.M. Hoornweg's topic in RTL and Delphi Object Pascal
What you want is a circular buffer that points to buffers in a memory pool if they're all the same size, or pools of different sizes if they vary. The pool pre-allocates (static) buffers that are re-used, so no fragmentation occurs. Memory fragmention is not your biggest issue, it's atomic reads and writes, or test-and-sets to avoid corruption and gridlock from race conditions. -
Embedded javascript engine in Delphi
David Schwartz replied to duzzell's topic in Network, Cloud and Web
Have you looked at TMS WEB Core? You can write your code in Dephi and it transpiles it into JS. You can use pretty much any 3rd-party JS lib. I use HTTP for I/O, but you could use JS just as easily. And the language has been extended to support async requests in-line. -
how to recognize cards drawn from a deck?
David Schwartz replied to David Schwartz's topic in General Help
Anything like that in just Delphi? -
Avoid parameter evaluation
David Schwartz replied to Maxime Janvier's topic in RTL and Delphi Object Pascal
Yup, you're right about Simula vs. Modula. I learned LISP in college. I found it to be a very strange language, but it helped me really understand recursive programming. It probably did support a lot of things, including anonymous functions, but we didn't get that far in the class. I wouldn't hold it up as an exemplar for much of anything other than an interesting experiment at the time. It was an interpreter that took very few resources and let you create programs by defining rabbit holes to go down. Unlike most other languages, iteration was much harder to do than recursion. But I guess it was a good learning tool for a few things, given what was available at the time. -
What is the best way to accomplish this?
David Schwartz replied to alank2's topic in Network, Cloud and Web
What comes to mind for me is a simple publish/subscribe model with a lightweight notification mechanism like MQTT. It would keep the overhead miminal and could easily be kept out-of-band relative to the actual data channels. -
Avoid parameter evaluation
David Schwartz replied to Maxime Janvier's topic in RTL and Delphi Object Pascal
Nope, as Remy pointed out, they weren't actually supported until Java 7 or 8. I remember reading a bunch of stuff back when Java 8 was released about how difficult it was for them to get the anonymous methods working, and they weren't even supported as "first class objects". They were improved in the next version and the syntax was simplified significantly. I was at some tech event shortly after Java 8 was released, and I happened to talk with the SW Dev Mgr who coordinated a rather large team of Java devs at a local company, and asked him what version of Java they were using. He admitted they has finally just switched over to Java 6 about 6 months earlier, and it took them a couple of years to do that. I asked what their plans were to migrate to Java 8. He said the architecture of their overall system was unable to handle it, and they had started on a mission to completely rebuild the system from scratch that could track newer Java releases. I played with Java for about a week and quickly got disgusted with it. I don't know who thought it would be a Good Idea to put Configuration Management stuff into a programming language, but I think it was a truly insane idea. That was what the aforementioned manager was referring to, because their system got boxed-in and the architecture calcified because of so much of that and how inflexible it was. Even Delphi does a better job at that than Java does! Delphi has supported lambdas and closures as "first class objects" since they were first introduced, or maybe the following update. (I wasn't paying much attention at the time.) -
Avoid parameter evaluation
David Schwartz replied to Maxime Janvier's topic in RTL and Delphi Object Pascal
I'm still using D10.4.2, and it has trouble dealing with inline vars that have been in C++ since it was released in 1985. -
Avoid parameter evaluation
David Schwartz replied to Maxime Janvier's topic in RTL and Delphi Object Pascal
IIRC, Smalltalk was the first language that popularized the notion of 'classes' and OOP, although classes were first implemented in Modula which never really got much traction. Both Modula and Smalltalk were way ahead of their time. -
Avoid parameter evaluation
David Schwartz replied to Maxime Janvier's topic in RTL and Delphi Object Pascal
Delphi is a few decades behind contemporary language features today. The last several language additions have been around since the 90's. I'm not sure how far into the 2000's they are yet. I think I'll be long dead before they catch up with the more popular language features that most languages already support today in 2024. I mean ... hey ... the only thing added in D12 was multi-line string literals. WOOT! WOOT! I'm not moving off of D10.4.2 until they start focusing on real language improvements. Given how many emails I'm getting lately trying to urge people to get back onto maintenance plans, I'm guessing the user base is shrinking ... maybe because nobody wants to use a language that's still stuck in the 90's when most contemporary languages are still evolving quite steadily. I think Delphi introduced anonymous methods and closures before Java did. But since then, Java has updated them with nearly every release, and they look nothing like they did initially. I can't think of anything that has changed with Delphi's syntax. -
I have a list of company names + phone# / city / state. I want to find their main website URL and/or a google business page? What tools are available to do this (without any programming needed)?
-
I've had to deal with several variations of that over time. Are there web-hooks in place that call the system to hand over each JSON packet? Or are they just dumped in chunks into a file, accessible by something like FTP? Or do you have to poll a system periodically for new data that has accumulated? 60k records per day isn't that big of a deal. And text is quite easy to compress, especially if there's a limited lexicon involved. Then there's the backing store, where it really depends on the total lifetime of that data, what the half-life of searches is (so you know when you can flush it out to secondary storage with low likelihood of needing the majority of it), and tuning the DB to optimize the queries that come in. In America, certain types of records need to be kept for a legally-defined minimum length of time, like 7 years for corporate and financial records. Most of it isn't ever looked at, but it needs to be kept online and backed-up in case of audits or lawsuits. Just figure out how to compress the crap out of it and stash it away so it's easy to retrieve when needed. The point is, your job is to make sure the recent data is quickly accessible, while the older data is on slower more massive drives but still accessible in a reasonable amount of time. (A subpoena for data might give a month or more to provide it, which should be plenty of time to deal with slower backing stores, or even mag tapes.) Do NOT try to make 100% of it accessible "instantly". The client might have some temporal requirements, but make sure they're reasonable.
-
Just with Delphi? Do you use other languages with frameworks that provide a cleaner solution? I've only used Delphi. Prior to that I spent most of 15+ years doing embedded systems programming, and they never used DBs for performance reasons. It was pretty low-level C and C++. Frameworks were fairly primitive back then. And there were lots of Delphi apps I worked on that were essentially embedded systems, like stand-alone kiosks, that had content created externally and manually installed -- no DBs were used here either.
-
Yeah, it often is. What if you're not using DB-aware controls? The OP didn't sound like he was. As I said, the DB-aware controls add a lot of buffering and logic to simplify this. If you just have any random form that's got edits and grids and checkboxes and whatnot on it, and they are NOT DB-aware controls, then what do you do? Like, say, you have a form that displays data returned from an HTTP GET request as a JSON packet that consists of an array of objects, and you want to scroll through the objects as if they're records in a table? I'm genuinely curious. This wide disparity between forms that are used for interacting with DBs that have DB-aware controls on them vs. those that don't -- because you're not using DB -- has always perplexed me with Delphi. I've seen at least a half-dozen different solutions used over the years for the latter case, none of which were particularly elegant. Sometimes I asked the developer why he didn't just use an in-memory table and DB-aware controls, and the excuse was usually that it "added too much overhead to the app". OTOH, there have been numerous situations where I got rid of a bunch of code that did this and replaced it with an in-memory table and DB-aware controls, and the performance actually improved.
-
Variable might not have been initialized
David Schwartz replied to shineworld's topic in Delphi IDE and APIs
Look for the code that causes FileIndex to be set, and then look above it for something that might cause that line to not execute. You're lucky in this case that these are three lines in a row. Sometimes several of these kinds of initializations are set at the top of a proc and the warning isn't issued until much farther down in the body of the proc. -
I've generally found it's easier to make one form to ADD a NEW item, and another to VIEW / EDIT the item (either object instances or DB records). But it can depend what's in the form. I've often tried using one for all three, but I often end up with so much code that does one thing for Adding and another for Viewing / Editing that it's just too much of a headache. One way around that is to Insert a new record with default values, then open it in Edit mode. But the problem with that is if the user Cancels out of the form, then you have to be sure to delete the added record. If there's a possibility that someone might issue a query that attempts to access that record, then you'll need a field that maintains a state flag saying it's temporary. If something throws an exception and blows out of the Edit process but doesn't delete the temp item, that can create all sorts of headaches. The areas that cause trouble are fields that are references to chunks of data from elsewhere, fields that contain indices that point to items in a lookup table, along with field validation read errors, among others. To address some of these disparities, adding a new record can require data fields that are flagged as "required" but their data hasn't been selected yet by the user. You have to treat those fields as "required but empty" which is technically an error condition. So you have to put code around that to guard it from throwing an error while tabbing into or out of such a field, because for NEW records it's NOT an error. See my point? Using DB-aware fields figures out a lot of this stuff. But to make it work, you need to add field validations to check this stuff when they click Post on a NEW form. But wait ... those field validation routines now have to figure out if it's Add or View or Edit as well and take appropriate action. So you end up simply shifting that logic from one place to another place. It would be nice to bury it inside of a class, making the objects self-validating, but that's a whole nuther can of worms! Using one form for Adding and another one for Viewing / Editing eliminates all of that selection logic and is a lot easier to maintain. It's also simpler than dealing with inserting a temp object / record first then Editing it because you don't have to deal with deleting the temp if the user cancels the edits or an exception is raised. BTW, the difference between View and Edit is that View sets all of the fields to read-only, and going into Edit mode turns off all of the ones that the user can edit (ie, applies permissions). A copy of the data needs to be kept when you go into Edit mode so you can compare which fields changed and only update them, or restore the field values if they Cancel the Edit after making some changes. Again, DB-Aware controls can do this automatically, but using lists of objects this way may not provide the same logic.
-
As I said, the trial version is free, but it only runs inside of the IDE. I'll use free code samples to build proof-of-concept prototypes. Not for production code. But production libs that are free to run inside of the IDE are usually quite adequate for proof-of-concept prototypes, and that also means I can usually reuse much of the code I wrote to work with them.
-
TMS Cloud Pack is the best I know of. (There are a few varieties of it.) There's a free trial that works when running inside of the IDE if it's just for your own use. Only you can place a value on your own time. Far too many programmers undervalue their time and refuse to pay for stuff that costs less than a day's earnings, some less than one hour's earnings. Also, if you're building a solution that's going to put money into your pocket (by selling to clients), then why should someone pay you for something of value if you don't see the value in the work others do? You pay people to prepare food for you; you pay for electricity delivered to your house; you pay for water, sewer, and garbage collection; you pay for clothes that people make; you pay for food that people farm; you pay for music, for movies, for popcorn; you even pay $1 or more for a bottle of water where the bottle costs more than the water inside of it; but you won't pay for software that people write? Let's say it took someone a week to build each of the interfaces in TMS VCL Cloud Pack -- it's probably more than a month, with all of the testing, support, and other stuff they've got invested, none of which you're going to provide by rolling your own -- and you don't think it's worth it to save yourself a month or more of your time by paying $200 USD or so to have a solution ready-to-go in 5 minutes? Do you only earn $200 per month? Is that how LITTLE you value your time -- that you'd "spend" 200 hours of your time in order to "save" $200? That works out to a whopping $1 per hour that you value your programming skills at. This whole notion of "software should be free" baffles the hell out of me. It's like when the CEO of Spotify said recently, "Very little effort goes into making music." Then he raised his subscription rate. Yeah, like that took him a few thousand hours to do. It will actually put a few hundred million dollars into his pocket, while not adding a penny of income to the artists who he's hardly paying for the "very little effort" they put into their artistry. I paid for a college degree in Math and Computer Science. I've spent 40+ years honing my skills, and untold thousands of dollars on tools, hardware, and services. I charge a lot for my time as a software developer, because I believe I deserve it. If someone would rather hire someone from India at $2/hr that's fine by me. You get what you pay for. But I've ALWAYS found it FAR CHEAPER to pay for software that has hundreds if not thousands of hours of work behind it than trying to do it myself from scratch. People PAY ME TO BUILD STUFF FOR THEM! Why would I want to charge them for the time it takes me to re-invent something from scratch that I can buy that's already working, debugged, and production-ready? Spending $200 for a software library that probably has over 1000 hours of work put into it is a SCREAMING DEAL in my mind. (Would it surprise you to learn that I have a TMS ALL-ACCESS PASS license?) BTW, did you write your own Delphi compiler and IDE?
-
I looked and didn't see this. Thanks for pointing it out.
-
This looks awesome, long awaited option for Delphi. What Delphi versions does this support?
-
What do you think of "Local Global variables"
David Schwartz replied to Tommi Prami's topic in RTL and Delphi Object Pascal
Whenever I'm tempted to do this, I look very hard at the likelihood that the code I'm dealing with could be moved into a class. If it's only used once, right there, then I may just leave it as-is. But maybe with a bit more abstraction it could be more useful. That said, it's not something I ever think of doing very often because it's a form of encapsulation that's mostly used in classes. -
In ChatGPT4, have you tried setting the 'temperature' setting to zero? That's supposedly a setting to moderate how much / little it exercises its own "creativity".
-
iOS: XCode 15: MADDA - Make Delphi Debugging again - after 01.May 2024
David Schwartz replied to Rollo62's topic in Cross-platform
This is exactly why I've chosen to go with TMS WEB Core as it runs in pretty much any web browser. It does not lock you into any particular hardware or OS version. If you need something specific, you can get a cheap machine and use it to build a REST service that the web app can call directly, or indirectly through your app's main service. There's also Crossover, which is a WINE-based containerized solution for running a Windows app in other environments that looks and runs as a native app. It's ok for one-offs, but publishers will need to see if its cost justifies the results. -
iOS: XCode 15: MADDA - Make Delphi Debugging again - after 01.May 2024
David Schwartz replied to Rollo62's topic in Cross-platform
There's also the problem that XCode upgrades may be required that cannot be installed without upgrading the OS. I stopped upgrading my MacOS a while back b/c it seemed like each time it would lock me out of apps that cost me a lot to update themselves to continue using -- if that was even an option. I have a 2014 Mac MIni running Mojave b/c there are several 32-bit apps that I use but can't update, and the next OS doesn't support any 32-bit apps. I have another one (2018) that's running Catalina and I won't update it either b/c of other things that break and will be expensive to update -- no free updates for these things. This is the machine I use to do my Delphi work on, inside of a VirtualBox VM, and now I can't even upgrade that to the latest version, although they seem to be supporting older versions pretty well. And with the switch to M-series chips, there's a BUNCH of apps I can no longer upgrade b/c they ALL require the latest version of the OS to run. XCode updates all seem to be tied to a specific version of the OS, and they don't maintain backward compatibility for older versions when they add new features to it. Which is why I'm mainly interested in working with TMS WEB Core to build web apps that run inside of web browsers and are not dependent on hardware or OS issues. -
WebUI framework: Technical preview. Part 1.
David Schwartz replied to Alexander Sviridenkov's topic in I made this
That looks pretty slick.