Jump to content

ByteJuggler

Members
  • Content Count

    56
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by ByteJuggler

  1. ByteJuggler

    aItem := nil

    Yes, I was responding primarily to "TItem.Create" in your original post in context with the question "What is the right way of freeing the local class variables?". When applied in context of iterator then obviously the items belong somewhere else already etc. If your only concern is actually warnings about needlessly assigning nil then either don't do that or turn the warning off. (There's a way to disable most warning messages, I don't know off the top of my head whether and how to disable this particular message. Also some version of the Delphi compiler emitted as I recall some warnings or hints not entirely when you'd expect it. What version of Delphi are you using? If this is why you're seeing this, then ... )
  2. ByteJuggler

    aItem := nil

    Normal Delphi objects, using the Windows compiler, does NOT have garbage collection or any kind of automatic memory management like Java, C# etc. This means if you merely assign "nil" to an object reference, the memory pointed to originally by that reference is still allocated in the heap somewhere, but now "lost" -- you've caused a memory leak(!). Normal objects should be disposed of by calling the destructor, e.g. var LMyLocalObj : TSomeClass; begin LMyLocalObj := TSomeClass.Create(...); try //do something with LMyLocalObj finally LMyLocalObj.Free; //or if you prefer FreeAndNil(LMyLocalObj); end; // more code perhaps... end; Setting the reference to nil is a safeguard since if you do not do this then the value of the object reference will point to where the now-freed object used to be. For a while this may still look valid if accidentally used/derefenced, whereas if you reset the reference variable to nil then trying to dereference it will cause an access violation to be raised to alert you to the misuse. If there's no further use of the variable however in the current scope then setting to nil of course is redundant and serves no purpose. You should carefully review and ideally check your programs for memory leaks using for example the memory leak checking features of FastMM or some other tool. (There are several.) All that said, there are forms of automatic memory management available in Delphi on Windows: Interfaces support reference counting based memory management whereby the compiler will automatically free an interfaced object referenced via an interface reference when the enclosing method/function terminates, via code the compiler generates to check the reference count and act when it reaches zero. You should not manually free an interfaced object as this in turn may also cause an exception when the compiler auto-generated code also tries to free the object. This is a so-called "double-free" error. FastMM (or some other tool) can also be employed to help detect this type of mistake. Additionally please note that Embarcadero decided arguably somewhat controversially (in a departure from the behaviour on Windows) to adopt similar semantics for plain objects on the Delphi mobile compilers, this is commonly referred to as ARC ("Automatic Reference Counting", see here). So, when you write Delphi code and compile for a mobile target, then you do not need to explicitly call .Free() or even set to "nil" since the object will be automatically freed when its reference count hits zero. However, because of vaious reasons including not least the runtime cost of ARC and the conflicting semantics between the platforms, it looks like Embarcadero is now going to revert to making the mobile compilers behave the same as on Windows after Delphi 10.3 Rio, see here: http://blog.marcocantu.com/blog/2018-october-Delphi-ARC-directions.html I hope that helps.
  3. ByteJuggler

    Style missing..

    Probably something in the .dproj file. It's worth taking a peek at where "Iceberg" occurs in the old .dproj file vs new ones and making suitable adjustments. Perhaps get rid of the theme specification entirely and then add it back in.
  4. ByteJuggler

    How to identify problem remotely

    My first suggestion would also be madExcept. Aside from that, in the task manager (on Win10) you have two options that might help: "Analyze Wait chain" and "Create dump file". The latter will dump the application image. The image may be inspected with e.g. WinDbg. Here's a bunch of tutorials: https://marc.durdin.net/2015/11/windbg-and-delphi-a-collection-of-posts/ And though it's .Net based and a little old this seems interesting: http://alookonthecode.blogspot.com/2012/02/windbg-101a-step-by-step-guide-to.html And this: http://capnbry.net/blog/?p=18
  5. Relatedly and somewhat in the same vein I read an article yesterday about AirBnB and why they're now moving off of React native, basically too much churn and too many landmines, even if it works really well when it works.
  6. We've been using SVN for many years now, no complaints. We're however planning to migrate to Git at some point, and are already using it in parallel with SVN in several ways. It is perhaps worth it to note that from a size efficiency perspective Git is much more efficient than SVN. The total size of a git repo + working copy files (which remember, includes all the branches and the entire history of the project locally) is typically quite a bit smaller than an SVN checkout (which only contains the working copy and a copy of the pristine files of a single branch with no history.) So any history investigation or switching between branches requires a connection to the remote SVN server, whereas Git does not require this and allows complete freedom to switch branches, create new ones and interrogate the histories offline. This is extremely useful when you want to do some types of work where a connection to your central version control system is not available. To also note: It is entirely possible to use both version control systems sort of independently at the same time, by making each ignore the other's folders. This has benefits as it starts making the notion of "I have a local repository that I can work against" apart from "the remote" clearer. E.g. commit whatever you like, in as small baby steps as you like against your own development git repo, and once ready commit to your "mainline" SVN repo. Meanwhile when upstream updates happen you get practice in merging and learning how to do this properly using git. Eventually this sets you up to simply swap the step that commits to SVN to pushing to a remote Git repo instead. It is also possible to keep a git repo as part of your SVN repo, if needed/wanted/useful. For example, we use and keep third party sources in a dedicated third party SVN repository, and in several cases for ease of updating to ("pulling in") the latest version of the open source project and to have access to the history of these projects, the path of least resistance was to actually commit the git repo into our Subversion repo. To update then is simply a case of pulling from the repo on github, checking if the update breaks anything and then commiting both the source changes and the changes to the git repo to subversion. (One more addition: Another department actually also use Bazaar, it works well but I'd not recommend it as it's essentially dead in terms of development, and the plan is to eventually migrate that to git too. For clients we use the Tortoise* tools.)
  7. This is interesting stuff. What produces the above stats? (As background: Back in when XE5 was released we did some evaluation and based on the admittedly somewhat limited testing we did, concluded that mobile support was [at that time] not good enough to risk a project on. I/we have generally however had the impression in recent releases (since let's just say 10.x) that support was plausibly nowadays "good enough" based on generally favourable anecdotal reports by people with production apps in the Google and Apple app stores. We have therefore been considering revisiting and doing another trial and possibly proceeding with a mobile app development soon. However the above puts a slightly more cautionary spin on things. So your report is useful, thanks, and any further comments are highly appreciated.)
  8. ByteJuggler

    Unit testing for server-side assets

    We do various types of tests (which would categorise I suppose amongst others as smoke tests, integration tests, golden master tests and regression tests) which do verify behaviours by back-end/server side assets like views and stored procedures. We do also directly exercise some server side assets directly in some of the automated tests for behaviour and outputs, we probably don't do nearly enough of this. (We do test bootstrap the entire back-end from scratch.) There are SQL based unit testing frameworks/tools/approaches, we don't yet do this, but we probably should. (https://tsqlt.org/ for example.)
  9. ByteJuggler

    Delete Error With Delphi and Access Table

    Yep, that's also going to be wrong! Missed that! 🙂
  10. ByteJuggler

    Delete Error With Delphi and Access Table

    To add to Dany's answer, you should preferably avoid dynamic SQL generation like above. There's a bunch of reasons for this, including SQL injection attacks, and brittleness (which is to say it's prone to breakage and hard to test) and being slower as it makes it makes it hard for the database to optimise for the general case (as it will all else being equally have to parse and prepare an execution plan for each parameter combination presented to it). Instead use parameterized queries where possible or (for suitable back-end databases) stored procedures.
  11. ByteJuggler

    Illegal characters causing problems and can't be found

    It's not going to be Pos(). I'm slightly wondering what's the content of "IllChar?" Unless that's all characters below 32 you may be missing characters due to them being not in your array, possibly causing trouble. Really, instead of having an array of "Ill characters" and stepping through this repeatedly calling Pos(), I'd probably just step through every character in "ThePN" and check for Char(ThePN) < #32 as all characters below point 32 is non-printable. (This is also slightly more efficient, but that is not any major concern here so I digress.) (Aside, my sympathies. I bled a lot with Paradox and the BDE back in the day. Still have some remnants of the BDE here and there, soon to be all gone... )
  12. ByteJuggler

    Speed up reading multiple text files

    I suspect you're running into something which had me gnashing my teeth in the past... TStringList isn't the most predictable in terms of performance particularly when you set the Sorted property to True ahead of populating it... When you set the Sorted property to True on a TStringList, the stringlist must (of course) maintain the ordering when new strings are Added. To do this, it must determine where to insert the line being added. And to do this it uses a binary search. See: TStringList.AddObject(), and which calls TStringList.Find() before potentially calling InsertItem(). Then see TStringList.Find(). This results in an O(n.log n) time complexity just for reading n lines of text from a single file as opposed to just O(n) without. This is maybe OK, however there's more. TStringList's name and methods implies that it's a list structure when in fact it's not. The underlying datastructure is a contiguous array of strings. This means the actual insert becomes increasingly expensive as the TStringList grows because the Insertions are effectively O(n), even if it uses an fairly efficient copy. See TStringList.InsertItem(). While System.Move() is a pretty quick "block copy" it nevertheless will be increasing as the number of items in the stringlist grows. In a normal linked list the cost of the actual insert once you've found where you want to insert is O(1). Then there's also the growing aspect adding some overhead, e.g. the underlying array have to be enlarged/grown when the number of actual lines matches the capacity of the array and another is inserted. (One might suspect that all this copying and growing may be potentially doing unpleasant things to CPU caches and so on, which also won't be helping performance.) So, the point of this little diatribe is that TStringList's performance behaviour can be a bit different to what one might expect, and you should therefore act accordingly. Given that your lists are already sorted, you should load the data into multiple stringlists without duplicate checking or sorting on which will avoid most of the needless overheads. And then, write a routine to multi-way merge these into a final list. (If you want to get fancy, maybe using a min heap given the varying lengths of the input?) Or, use something else as others have suggested, perhaps. (Maybe we should write a TFastStringList, and while we're at it, make it interfaced, so I can return IFastStringList instances and have them reference counted etc... I digress.)
  13. ByteJuggler

    dotNet framework 4.5 required for Delphi 10.3 Rio

    In case anyone's interested, the same issue reported/discussed here: https://bitbucket.org/sglienke/spring4d/issues/308/buildexe-does-not-build-delphi-103-rio
  14. ByteJuggler

    dotNet framework 4.5 required for Delphi 10.3 Rio

    Also here: https://quality.embarcadero.com/browse/RSP-21670
  15. ByteJuggler

    Web dashboard application

    Hi, To briefly answer you: We're running a production solution for about 18 months now. As of this writing the solution is very stable. I've had continuous up-times in excess of a month. Usually the system is restarted etc not because of some unknown UniGUI problem, but because we've updated the software. And the rare problems we've had has in almost every case turned out to be mistakes in our code, and/or pre-existing problems in code we've reused that have come to light due to UniGUI's multi-session/mutli-user/multi-threaded nature. As for support: The couple of times I've had questions or problems I've mostly been helped pretty rapidly. I cannot complain. With actual suspected bugs, the usual considerations apply as for any software, which is to say if you can give the UniGUI guys a reproducible test case then you tend to get helped much more quickly and eagerly than if you do not. Hope that helps.
  16. ByteJuggler

    Error insight in Rio

    I've searched and it's been reported yesterday already: https://quality.embarcadero.com/browse/RSP-21643
  17. ByteJuggler

    Error insight in Rio

    Looks like the syntax checker/highlighter doesn't support the new inline var syntax properly. See if it's been reported yet and if not report it at quality.embarcadero.com
  18. ByteJuggler

    Migration DbExpress to Firedac , better way ?

    I've used refind to mostly convert an application from BDE to FireDAC. We still also have some modules using DBExpress which remains to be done. I was planning on adapting some of the BDE scripts for this purpose. I have been toying with writing a blog post or something to document some of the lessons learnt. If I find some time I'll have a little look at our DBX modules and whether I can get something going quickly and post so advice for you here. One thing I would say is that I would not advise you to change the structure/architecture of your application when you do this translation. Purely stick the changing the classes over and making any adjustments necessary as a consequence. You can always change/refactor the structure later if you want to.
  19. ByteJuggler

    Web dashboard application

    While Alberto's suggestions are all good and valid, I'd like to make you aware that you could produce something really easily and quickly without needing to know very much using UniGUI. It is however not free. (I have no affiliation with UniGUI other than being a user of UniGUI myself.) Note there is a trial version you could try to see if this would be workable at all. To give you an idea about what you can achieve, see the example from this thread that I've quickly spun up for you on an AWS instance here. The code that does this is on github here. Additionally I've added the "mdemo" demo included with UniGUI which is accessible here. Note I'll probably tear down this cloud VM again in the near future. Finally it would be possible to code up a UI in Javascript without too much fuss using say jQuery and/or Bootstrap (and/or D3 or Google charts or whatever) and then serve up the supporting files and data in one of several ways as already suggested by yourself and/or Alberto, or even just with the stuff included with Delphi, e.g. Webroker, Indy or Datasnap. That sounds simple enough in theory but there's a lot of moving parts and supposes that you know or can pick up enough Javascript and the relevant libraries (jQuery, bootstrap, d3, whatever else) quickly enough. I'm not sure if that's realistic?
  20. ByteJuggler

    New official Embarcadero forums online

    Site is now https. 🙂
  21. ByteJuggler

    New official Embarcadero forums online

    I was biting my tongue about this, but I must agree, it grinds my gears that at least the login page does not use https. (And if you have it for the login page you might as well have it for the entire site.) Passing login credentials in the clear is IMHO simply not acceptable, especially given the ease of procuring even free SSL certificates (https://letsencrypt.org/) these days. I mean, even little me runs my own mail server that has (LetsEncrypt) SSL both for the mail server and the web interface. It's not that hard.
  22. ByteJuggler

    http://community.idera.com/ login woes

    It appears the reset email is now functional. If all of you can retry and confirm that'd be good. 🙂 (But no https? Hmmm.)
  23. ByteJuggler

    http://community.idera.com/ login woes

    I hit "reply" on their email, which came from (and responded to) communications@embarcadero.com. I (somewhat naively optimistically maybe?) thought that since it doesn't say "noreply" it might have a chance of actually getting a response. No luck so far, I'm probably wrong. I've been toying with the idea of directly emailing someone at Embarcadero instead, I may do that but I'll give it some time. One would think someone would notice eventually that their emails aren't being sent out properly... Regarding contact, Marco, Sarina and others have as I recall given out their email addresses in several presentations and webinars in the past (I wrote it down somewhere, not that I can lay my hands on it right now!) so it's nevertheless not exactly a secret or impossible to directly hit someone unrelated up if really required. However I'm loathe to do that for something as trivial and stupid as a broken login. (Perhaps Jim McKeeth would be appropriate if I/we can locate his contact details, I think he's sort of part of the community engagement aspect of Emba.)
  24. ByteJuggler

    http://community.idera.com/ login woes

    Hi, I'm in exactly the same boat. I've emailed them today about the missing password reset email (about 4 hours after I tried the reset page). This was in response to an email they sent me asking me to move my account to their "new" community site. I assume you received the same. Just like you I never received the "reset" email. Curiously, the email to move my account was sent to one of my other addresses, rather than the one actually registered on their current (old) community site. It seems almost to me as if they've sent emails based on out of date data (as I had that email on my community account at one time but do not anymore.) For the record, I also tried registering anew on the new community site, but it "knows" about my identity and current email address and it refused me trying to register from scratch. So until Emba sorts their site out I'll be (like you) locked out. Frustrating.
  25. ByteJuggler

    Push notifications

    I'm shooting from the hip a bit here so my apologies if theres's some way of accomplishing this already etc: One of the things I liked about G+ was the level and way that it "push notified" me about new posts in my circles, particularly the Delph one. I put that in quotes because I'm not referring to true push notifications but the way that ones google "notifications bell" showed when there was updates and the way it then listed new posts in some sort of shorthand form to review. The big problem then with this new forum is kind of the lack of that "gentle" push notifier. There is the "Unread content" button but still one has to actively go and visit the forum and click on that button. I suppose I'm thinking some sort of feature of making new posts more visible on this forum would have been nice. Anyway, just thinking out loud!
×