-
Content Count
1237 -
Joined
-
Last visited
-
Days Won
25
Everything posted by David Schwartz
-
Delphi 11.3, Android 13, External Storage Schism
David Schwartz replied to a topic in Cross-platform
Have you considered using an external store accessed via a URI? That would have the advantage of users being able to move from one device to another and have their data follow them. If you read the tea leaves, vendors are making things harder and harder to create mobile apps that follow a usage model similar to traditional desktop apps. That's forcing the data to be saved remotely. That does make it challenging to operate without internet access. But internet access is becoming pretty much ubiquitious these days, esp. for low-security needs. Just encrypt the data and save it as a blog somewhere and manage it via an in-memory DB. (Probably needs versioning and other stuff to prevent corruption, but that shouldn't be too difficult.) -
Best practices for working with a DB accessed via REST API?
David Schwartz replied to David Schwartz's topic in Databases
I'm also working with Web Core. My needs are actually quite simple right now -- I need to be able to store stuff that might otherwise go into an INI file for saving user state data. A web app requires that data to be saved in a single, remotely-accessible place, because the user can run the web app from any device anywhere, and that data needs to follow them around. The ideal place would be wherever the rest of the user profile data is being stored. But I can't find anybody that provides user / member management that lets you add your own fields or even a single blob to save stuff that's invisible to their UI. I've been looking at TMS Sphinx, but it's like having to completely reinvent the wheel. Right now I'm building an MVP and I want something as turn-key as possible. The most common suggestion I've been getting is to use Wordpress. Ugh. No thanks! Even the Memberful folks suggested that. So far, there are solutions I've found on one end that offer member management that have REST APIs but cannot be used to save a few additional user-specific data items that aren't visible to users; and on the other end there are platforms that let me save whatever I want (they're a general DB) but I'd need to build all of the member management, auth, payment processing, and security stuff into it. There's even AirTable, which is quite comprehensive, but it started out life as an easy-to-use drag-n-drop GUI-based web DB tool, and the REST API was added as an afterthought. Everything in the DB has to be added from the UI side and it doesn't look well-suited for saving user-specific state data from a middle-tier service. -
Best practices for working with a DB accessed via REST API?
David Schwartz replied to David Schwartz's topic in Databases
All great points. To me, I'm looking for what amounts to an embedded DB with a REST API to handle security issues better than you get by just using a raw IP:port# protocol, which is what pretty much every DB server in the world does. They all have UIs of various types, but none of them are tightly coupled the way I've found in my search for a solution. The vendors seem to start with a nice web-based UI drag-n-drop designer and then slap a REST API onto the side to make it accessible by code. But they ALL are tightly coupled to their doggone UI. WTF? MySQL has no UI -- but there are plenty of tools that let you connect to it and manage it via a nice UI, the most common and well-known of which is probably phpMyAdmin. But look how many fancy UI-based tools exist that let you connect to any number of DBs that don't rely or depend on any UI parts of those DBs that might exist. The market for them exploded in the 90's because of Y2K and it's still quite healthy -- only now this tech is referred to as "ETL" support. So why is REST support for DBs always viewed as an "add-on"? And why is it mostly just half-assed in terms of what it supports? That 3rd one in particular about swagger is an especially great point, but I can't figure out why so few vendors actively embrace it. It's not unlike SOAP, and SOAP requires a special compiler to take the WSDL specs and generate an interface unit for it in your language du jour. Swagger 3.0 is complete enough that there should be tools that read the swagger file and generate an interface unit for it in whatever language you want. They even have a list on their site with tools for a few dozen different languages, but ... Delphi ain't one of them. Hello EMBT? Don't you think Delphi is a useful enough platform for building REST interfaces to warrant vendor-sponsored support for a swagger tool? (TMS' Wagner Landgraf built something last year that's posted on github as open source, but they're just a 3rd-party tool vendor. I'm still pretty new to REST stuff, but from where I stand, I've come to two conclusions: TObject and/or RTTI should support toJSON and fromJSON in the same way that they support the abliity to read and write DFM files to serialize and deserialize objects, and it should not be done in a way that's VCL-specific You should be able to point to a swagger spec using something that's shipped "in the box" and have it create a robust class definition from it that can ingest data from that API and return PODOs, even if it's all just a bunch of Variant fields to handle ambiguous field definitions There are at least a half dozen tools in the C# / .NET world that do the latter. I only know of one for Delphi (Wagner's). I see this as a necessary part of the support needed to work with embedded REST-based DBs, but not sufficient. The authentication and security part is also necessary, but completely unrelated -- how to you read a swagger spec and generate a fully-compliant auth layer? Is it even possible? At least SOAP -- as ugly and inefficient as it may be -- has a standardized security protocol you can implement (AFAIK). -
Best practices for working with a DB accessed via REST API?
David Schwartz replied to David Schwartz's topic in Databases
TBH, I'm unclear how good of an understanding I have of this topic! I have what seems like a common use-case, and yet none of the vendors I've found with products that come close to what I need actually support it directly. Also, their documentation is either incomplete, disjointed, or lacks any sort of complete use-case description. If vendors in the market can't clearly document and explain their own models and don't support a straightforward use-case, then it makes me wonder what the heck I'm missing. It leaves me with more questions than answers, which is why I thought I'd ask about it. -
This could be as simple as doing a basic HTTP GET request for the html page. But if there's any javascript in it that generates content, then you need to have it loaded into the browser's DOM and search that, which can be quite a PITA. Similar effort in whatever browser you're using. If you want an example of how convoluted it can be, issue a simple query to Google and see what you get back. You'll see very little HTML code that's visible in the browser, and the stuff in the browser is generated in a variety of different ways, making it really hard to reconstruct what actually appears on the browser's screen. Google has raised the art of obfuscation to another level!
-
PowerPoint has a feature where you can "animate" the presentation of text being displayed on a slide. They have a few dozen options to choose from, with lots of variations. Spinning, dropping down, moving up, sliding from left or right, imploding / exploding, stuff like that. What libraries exist that will let you do that when displaying large text on a Delphi form (on a Canvas)?
-
Is this something built into the VCL functions? If not, what libs will do it? I'm just looking for an assortment of things to smooth the transition between displaying one phrase on-screen, then the next.
-
Why would you create a bunch of non-modal forms (or other resources) and not keep references to them on a list of some kind? You're just begging for what amounts to memory leaks when those forms get hidden and forgotten. I worked on a system once that let people sign-on and they could open non-modal windows and other resources like DB connections, while doing their work. Everything they created was put on a list. When they signed-out (or a timer triggered it automatically), all of their resources got deleted. I've seen very few situations where non-modal windows got created and stuck around for very long; but when there was a chance of longer-term persistence, there would always be a list that kept track of them.
-
The software industry has moved to the Web, why?
David Schwartz replied to Skrim's topic in General Help
If Einstein was diagnosed today, he'd be considered just another person with "high-functioning autism" that qualifies for "reasonable accommodations" by any employer because he had a officially diagnosed "mental disorder". So I don't know why YOU would want to be screened. Or anybody else over 30. It really doesn't sound very appealing, does it? There are probably thousands of Einsteins in the world who are doing incredible work and have never been screened for Asperger's or autism. In fact, it's estimated that there are around one million Americans over 30 who have Asperger's and have never been screened. This isn't a disease. It's not really even a "disorder". I'd say it's a GIFT. Except too many people get stuck on the "disorder" part, and the weird behaviors, and prefer to avoid us. The BEST reason to get screened is because they put you through a battery of IQ tests that measure cognitive abilities on several different dimensions -- more than just the one number that the MENSA test doles out, which is sort of an average of all of them combined. Oddly, most people are more comfortable talking about "mental disorders" than "IQ". Go figure. π -
The software industry has moved to the Web, why?
David Schwartz replied to Skrim's topic in General Help
I'm guessing you weren't around when Windows 3.0 came on the scene, or even Windows 3.1. People said the exact same thing when comparing it to DOS, which was exactly what you see in a (DOS) Command Shell today on Windows, or the Terminal on Macs. Given how much stuff is moving into the browser, the most surprising thing to me is how horribly bad web browsers are at leaking memory. Or that nobody has figured out how to organize the damn things so we don't need so many windows and tabs open all the time. I have a Mac Mini with 36 GB of RAM, and about every 4-6 weeks it runs out of memory (due to browser leaks) and spontaneously reboots. As the fragmented memory accumulates, the entire system slows down. It's like driving a car with a steady oil leak that's ignored because the mechanics are so busy adding new features to it and racing around town testing it -- eventually it just dies and everybody keeps scratching their head and mumbling, "Boy, we sure didn't see THAT coming!" REALLY? That's part of the performance issue. But the other part, IMO, is that devs have gone overboard in terms having too much stuff on a page polling external servers with inefficient queries, instead of just caching a bunch of data and waiting for something to deal with. I worked on a regular Delphi app at one place that did that, and it was just slower than crap. My team spent about 6 months redesigning it to reduce the number of queries it sent to the back-end, as well as improving the indexing. When it was originally written, there wasn't much data being manipulated; but over a decade of use, some customers had nearly a million records in their DB that weren't indexed efficiently, and these pages were just constantly hitting the back-end with SQL queries that returned HUGE result sets when they only needed a couple of records. You'd tab from one field to the next and it would send a request then get back 50k records when it just needed a single integer. I suspect that's what a big part of web-based front ends are doing today. -
The software industry has moved to the Web, why?
David Schwartz replied to Skrim's topic in General Help
Very astute observation. Do a little research on autism and Asperger's if you're interested in understanding it better. I was diagnosed two years ago and am still learning about it and how it affects how I interact with the world. Autism is a genetic condition that affects about 2.5% of the population, and about 20% of that is on the "Asperger's" end of the spectrum. So it's not exactly rare, but not easily recognized. More to your point, there's something in my mind that seems to make me feel that I'm constantly misunderstood, and I have lots of evidence of that, so I over-compensate. Psychologist said it's "normal" for how my brain works and is never go away, so I gave up trying to "fix" it. The easiest way to think of it is that people with Asperger's are relatives of Mr. Spock and have some Vulcan heritage. Observant Star Trek fans might recall that Kirk got along well with Spock, but McCoy had a really hard time dealing with him. I'm pretty sure his character was modeled a lot after someone with Asperger's. And there's no need to apologize. Just consider that there's a common believe most people have that says, "Everybody thinks the same way I do." Even a lot of certifiably crazy people think that. It's not true. In fact, most people do tend to think alike. That's called "neuro-typical". But a lot of people are what's called "neuro-divergent", including those with autism, and our brains just don't seem to be wired the same as most "neuro-typicals". -
need help accessing XData service inside of a Win10 VM on Mac host
David Schwartz replied to David Schwartz's topic in General Help
Well, I want to be able to reach into the service inside of the VM. I also want to be able to access the service running on the VPS server hosted elsewhere. Is there anything that discusses this subject anywhere? -
need help accessing XData service inside of a Win10 VM on Mac host
David Schwartz posted a topic in General Help
I have a VirtualBox VM running Win10 that is my Delphi dev environment. It runs on my Mac. The VM networking is using Bridging. I have an XData service that I can access within the VM using localhost. I have a port and root folder opened up in the firewall (using the TMS app to do that). I want to start testing it remotely. I tried to get it to run on an external Win VPS, with no luck. Not sure why. So I though I'd see if I can access it simply from the host environment outside of the VM. The IP of the VM seems to be 192.168.12.168 with the Gateway at 192.168.12.1. I can ping the gateway and it responds as expected. But pinging the .12.168 IP just gets me timeouts. I'm not sure where to go from here. Suggestions are invited. π -
The software industry has moved to the Web, why?
David Schwartz replied to Skrim's topic in General Help
A few years back, everything shifted to a "mobile-first" approach. That required companies to keep their existing staff to maintain existing software while hiring new teams for each mobile platform they want to target. it's not like you can use one code base and just put in $IFDEFS! Android and iOS are totally different environments and typically use different programming languages and toolsets. So they now have THREE dev teams instead of one. Then someone says, What about Macs? And what about Linux? Well, browser-based apps solve that problem for the most part. It requires a different programming paradigm and the problems being cited are what happens when people familiar with desktop programming paradigms carry them over to web-based apps -- the results are not very good. Back in the 80's and 90's, some Really Big Companies hired big consulting firms to advise them on how to best migrate their paper-based systems over to online systems. After spending 6- and 7-figures on these guys, what they got back, predictably enough, was "just turn all of your paper forms into online forms and everything will be fine." Yeah, right. It took these industries more than a decade to correct the problems THAT bad advice caused. You cannot carry forward an existing paradigm to a new platform that requires a different paradigm and expect it to work the same; it just won't. But that's what everybody seems to do. I mean ... even though everybody SAYS "we're now mobile-first", in reality, there are features they're paranoid of including in mobile apps for security reasons, so most mobile apps are not as fully-functional as their desktop brothers -- or even, OMG, full web-based apps! Look how many vendors interact with us consumers ASSUMING we're using a mobile app, and if we're using their web app instead, they have no idea what to suggest! There are features missing from mobile apps that can only be set on their main site's web app ... and in some cases, vice versa. Why can't you run their web apps on your mobile devices? Well, there's that paradigm-shift they haven't figured out how to deal with yet. Their main web apps are designed to replace their DESKTOP apps, not run on mobile devices. I had a bank account that had a web app and a mobile app that was also a web app, but it was different from their main one. WalMart bought them up as an in-house bank and one day their main web app suddenly looked just like their mobile app! All kinds of features had disappeard that were previously only available on their main web app. All they had to say about it was, "we've made our services easier and more accessible for all of our users." Web apps require a different usage paradigm than desktop apps, and the industry is still trying to figure out what that is. In the mean time, they're sticking to what they know and using the older desktop app paradigm, as ill-fitting as it is at times. (A big one they haven't figured out yet is how to get the benefits of "hovering the mouse cursor over something" to see some meaningful information. You cannot do that with a touch-screen, and nobody has implemented a consistent approach to providing this feature.) But at the end of the day, browser-based apps represent a single common platform that pretty much all computing devices can access now and in the future, regardless of their CPU, OS, and physical UI characeristics. We've been through these kinds of paradigm shifts in the past, and the only real surprise to me is why people always expect them to be painless and not require any changes. -
need help accessing XData service inside of a Win10 VM on Mac host
David Schwartz replied to David Schwartz's topic in General Help
Does the TMS HTTP Config tool handle everything needed for dealing with the Windows firewall? (Do I even need the firewall running inside of the VM?) I have the XData service set to watch on http://+:80/xyz and added an entry in the HTTP Config tool for that. Is there more that might be needed? From what I have read, Bridged mode on VirtualBox is the recommended way of accessing something inside of the VM from the outside. They say NATting will work but requires jumping through hoops. My remote VPS is another story... Obviously something isn't configured propertly in both instances, but I'm just unclear how many layers of things are present and how to figure which one(s) may not be working properly. -
OAuth2 bearer token example?
David Schwartz replied to Lars Fosdal's topic in Network, Cloud and Web
Maybe you need to find less paranoid services to work with. π π π -
New blog post: Leveraging ChatGPT to generate a Delphi class along with CRUD code from a table schema
David Schwartz replied to Darian Miller's topic in Tips / Blogs / Tutorials / Videos
In my mind, a "professional" is simply someone who gets paid for their time and effort. I think you're confusing skill level with compensation. College Professors write lots of high-quality code, but often do it for no additional compensation. And there are plenty of people fresh out of a "bootcamp" who get paid to write code who barely know what they're doing. While I do agree with your point to a certain extent, there are plenty of problems that don't require much context to reach a viable solution. In my experience, 30%-50% of most coding involves moving data from here to there -- ETL if you will. That kind of thing can be done by a robot that has no understanding of the larger context. It's self-contained, and if you spend too much time on it, you're wasting your time. For example, the code to move things in one direction looks like this: aaa := bbb; while the code to copy the other way looks like this: bbb := aaa; Show me something that will take two classes with 5, 10, or 100 fields and generate the code for Assign methods both ways, especially if some of the members are records or objects themselves? This kind of stuff is B-O-R-I-N-G and SHOULD BE AUTOMATED, IMHO, but I don't know of anything that does it. If you then inject a data transfer in between, like aaa --> send --> rcv --> aaa and the data transfer might be JSON or an array, or Base64 encoding, with or without encryption/decryption ... again, it's a lot of work, and totally mechanical. The problem with this extremely common coding pattern is that it does not lend itself to anything we have in our current toolboxes. Copy-and-paste is out; regular expression search-and-replace won't work; and writing something that's general enough is just awfully complicated unless there's a lot more meta-data available from the compiler or IDE. Most vendors I know refuse to provide access to that level of meta-data even though their compilers gather it regularly and the IDEs often make use of it. So if something like ChatGPT can do it, I'm all for that. This is not something that needs to be "optimal" since there's not much to optimize; it needs to be done quickly and easily updated. I've been playig around wiht ChatGPT and am really surprised at how quickly it can generate useful code for specific needs. It might not compile or run properly right off the bat, but there's both "bones" and a lot of viable "meat" on them. I'd typically reorganize things before using it, but it's like having someone write a draft of an article and then using that material as the basis for a more complete article. That kind of thing is done all the time in the written world (magazines, books, ad copy, web sites, etc.). From what I've seen so far, ChatGPT is far more skilled than your basic intern at writing code that solves a specific problem, as long as you can describe what you want clearly. I would not expect the results to be drop-in ready. However, the time it takes to go from "problem statement" to "working code" is WAY SHORTER than doing it all yourself by hand. And THAT is where the VALUE lies here. -
Yes, it reminds me of the learning curve involved with learning object-oriented programming. I find that authentication is one thing, but I'd prefer to be able to use a framework that has the DB and everything in place so I don't have to create all of that infrastructure. It's kind of like buying a lock and having to build your own doors and mechanisms to work with it. I'd rather have an entire doorframe and door with a lock already installed and a safe persistent store where users can register, you can collect money (once or on a recurring basis) and set the different membership levels if you want more than one. THAT seems like it would make for a valuable SaaS solution someone could offer. And generaing a complete Docker container sounds like a great idea as well. I'm in the process of trying to deploy my first rev of my back-end to a Windows host and it's not working as expected. Probably networking issues. Windows has lots of layers that I'm not familiar with -- I've aleays had IT people to help deal with that crap. Too many moving parts ... it needs to be simplified. π
- 21 replies
-
- vcl
- devexpress
-
(and 2 more)
Tagged with:
-
New blog post: Leveraging ChatGPT to generate a Delphi class along with CRUD code from a table schema
David Schwartz replied to Darian Miller's topic in Tips / Blogs / Tutorials / Videos
I spent an hour or so playing with it. There are definitely some limitations and drawbacks. I was trying to get it to generate some code I could use, but it kept giving me stuff that would not compile. I told it "not xyz" and it just kept apologizing and then showing xyz in the code anyway. Instead of repeating "NOT xyz" I said, "Try a different approach" and that got it unstuck. What surprised me was the variety of approaches it took when I asked it to regenerate the answer. Saying it's "not how a professional solves a problem" is disengenuous at least -- I've seen far worse coding in tons of production code! I think it's great as a learning tool, to see how certain problems might be solved. I mean, it showed quite a range of solutions! I also think it could be great for generating code to do imports and exports to/from classes ... I think it's called "ETL" stuff? There's a LOT of basic boilerplate code that needs to be generated whenever you're working with data tables and you need to get the field values into and out of some other collection of things. It's really boring and repetative stuff to code; it's too complex to do with regex in an editor, and requires knowledge of what's in the source and destination to get everything matched-up correctly. This sort of thing is the bane of my work a lot of times. If this is something that can solve this type of problem easily, then I'm all for it! I plan to explore this usage further. I had it generate code to save and load a class to JSON. Because I used an array previously, it generated toArray and fromArray methods that were different from what I did, but equally useful. I found it interesting that it made an assumption that the contents of the array were in a specific order (based on the ordering of fields in the class) and created methods that assumed each field was always present. My approach was to use name=value pairs and look for a given name to see if it was there and then use the value from it. I told ChatGPT to take that approach and it did. But trying to get smaller refinements didn't work well. One time I asked it about javascript and then the next attempt it displayed some code in javascript. Something interesting there was the use of a string as the discriminant in a case statement, which Delphi doesn't support (sadly), and it was half the size of the Delphi code. (Are there ANY contemporary languages used today, other than Dephi, that do NOT support strings in case statements?) -
New blog post: Leveraging ChatGPT to generate a Delphi class along with CRUD code from a table schema
David Schwartz replied to Darian Miller's topic in Tips / Blogs / Tutorials / Videos
It seems it's free with limitations, and you can upgrade now for $20 / mo. -
OAuth2 bearer token example?
David Schwartz replied to Lars Fosdal's topic in Network, Cloud and Web
This might help. It took me a while to track down. Using the REST Debugger, just put "Bearer " in front of the token and select OAuth2. When you get it working, click the option to copy the components and paste the result onto your form. One of the components it creates is this component, which is in the REST.Authenticator.OAuth unit: You set the TokenType to ttBEARER, set the Access Token, and tell it the name of the parameter, and I think that's it. -
LOL! When I first heard about TMS WEB Core, I thought, hmmm ... maybe Tim finally caught somebody's attention. But alas, TMS was working with another team entirely.
- 21 replies
-
- vcl
- devexpress
-
(and 2 more)
Tagged with:
-
restricting floating point range
David Schwartz replied to Dave Novo's topic in RTL and Delphi Object Pascal
There's always the InRange function https://docwiki.embarcadero.com/Libraries/Alexandria/en/System.Math.InRange function InRange(const AValue, AMin, AMax: Integer): Boolean; function InRange(const AValue, AMin, AMax: Int64): Boolean; function InRange(const AValue, AMin, AMax: UInt64): Boolean; function InRange(const AValue, AMin, AMax: Single): Boolean; function InRange(const AValue, AMin, AMax: Double): Boolean; function InRange(const AValue, AMin, AMax: Extended): Boolean; -
I learned long ago that Irony and sarcasm don't come across in a written media like this. So don't blame me cause I don't know you well enough to tell the difference. Heck, I have a hard enough time when some of my friends are being sarcastic! π
- 21 replies
-
- vcl
- devexpress
-
(and 2 more)
Tagged with:
-
New blog post: Leveraging ChatGPT to generate a Delphi class along with CRUD code from a table schema
David Schwartz replied to Darian Miller's topic in Tips / Blogs / Tutorials / Videos
I gave it a class and asked it to generate code needed to move data to and from a JSON message and it did a bang-up job. But it stopped at one point in the toJSON function. I just asked: can you just show the ToJSON function and ... it did! So that's one way to get past this limitation. if it gives you a list of methods and stops at some point, just ask for them individually.