Jump to content

aehimself

Members
  • Content Count

    1053
  • Joined

  • Last visited

  • Days Won

    23

Everything posted by aehimself

  1. Wow, I'm not even 35 yet and being called oldschool 😞 I guess "OK boomer" is next in my bucket list 😄
  2. aehimself

    How to Code SQL IN Statement correctly

    Client - Server architecture, mostly. User opens up the Client and selects which records to process / manipulate. We do have filtering capabilities (so instead of an array of IDs we could send a filter) but it requires critical thinking so users are afraid of it. So we simply send 1-2-5-10k IDs to the Server. An other case would be if you need to fix data corruption in the database.
  3. The bitter-sweet memories are for the archived version of fPrint. I remember my first website I created (it was in the early 2000's though) but browser capabilities did not allow too much freedom (index.html, browserdetect.js, index_ie.html, index_ns.html; anyone? 🙂) and they were kinda similar. The (d)evolution of websites does not apply on it, nor yours. It's the mass: dynamic content loading causing browsers to eat up the memory of NASA's supercomputers, JavaScript attempting to behave like a real programming language, ads, consents, facebook integration with everything so you can't check an article without a profile (or registering), stuff like this. Things were much more simple in the early days.
  4. Ooooooooh, shadows under everything, rough edge of transparent GIFs and default (times?) font... brings back some bitter-sweet memories. I don't like the way webpages are "evolving" but I'm glad we broke free from these designs 🙂
  5. aehimself

    How to make app with tabbed set of VNC windows

    Back in the days when I was a sysadmin we chose mRemote and nothing served us better. The developement stopped but then was forked and continued as mRemoteNG. At the end I just wrote my own tabbed application using TMsRDPClient9NotSafeForScripting for RDP, and for everything else launching the external application and docking it to the tabsheet. I also expanded TPageControl with drag-and-drop rearrangement with tab picture, close buttons, middle-click tab closing and full VCL styling support for the above. Let me know if interested, I can share the code.
  6. aehimself

    How to Code SQL IN Statement correctly

    Be careful with DB engine limitations. I can not count how many times my code failed, because Oracle can't handle more than 1000 entries in a single IN operator. I wrote a method to create the IN statement for me, which breaks the array up to chunks of 900: ( IDFIELD IN (:pVal1, :pVal2, [...], :pVal900) OR IDFIELD IN (:pVar901, :pVar902, ...) )
  7. Please no... 😄 Even at work we agreed that we'll not use inline variable declarations when we upgraded to 10.3.3. In my humble opinion this feature was utterly useless and will make Pascal code harder to read - at least for me, that is.
  8. aehimself

    Rio.1 does not save all layout settings

    The issue is present using the ISO and network installer too but only if you start a project file directly. When launching the IDE and opening the same project the layout is displayed correctly. The strange thing is that if you unpin (collapse?) a sidebar, it will load correctly, but the uncollapsed ones are still too narrow. My two cents are that the problem will be with the .DST file somewhere; it is just a bit large to attempt to debug what is the cause. It's a minor inconvenience, but as it seems only present in my team I'll keep searching online for solutions.
  9. aehimself

    class designation question

    @Kryvich I recently started to use generics myself so I guess I'm far away of harvesting their true potential. I like your solution, though; it's really elegant 🙂
  10. aehimself

    class designation question

    I personally use nr 2 really often. Imagine a simple encoder: TBaseEncoder = Class [...] TEncoderV1 = Class(TBaseEncoder) [...] TEncoderV2 = Class(TBaseEncoder) [...] TEncoderV3 = Class(TEncoderV2) [...] Basically you have a bunch of encoders, containing new methods, improvements, etc. Now let's say you want your application to be backwards compatible and be able to use previous encoders. If you add: TBaseEncoderClass = Class Of TBaseEncoder; ...and define your application as: TMyApplication = Class strict private _myencoder: TBaseEncoder; public Constructor Create(inMyEncoderClass: TBaseEncoderClass); ReIntroduce; End; Constructor TMyApplication.Create(inMyEncoderClass: TBaseEncoderClass); Begin inherited; _myencoder := inMyEncoderClass.Create; End; then you simply can call: TMyApplication.Create(TBaseEncoder); or TMyApplication.Create(TEncoderV3); to create and make your application to use the specified version of your encoder.
  11. aehimself

    Rio.1 does not save all layout settings

    Did that, still no joy; default layout is still getting reverted to the ridiculously narrow side panels whenever I open a project.
  12. aehimself

    Rio.1 does not save all layout settings

    10.3.3 here, and layout is always messed up when I'm starting Delphi with a project. If I simply start Delphi and create a new project (VCL Forms application for example) layout is loaded properly. In the Settings -> IDE -> Saving and Desktop -> Autosave section both is unchecked. I'll try with a fresh install, maybe my previously exported and imported registry has something bad inside it....
  13. aehimself

    Rio.1 does not save all layout settings

    It's a bit old thread, I know - but has this issue been resolved already? Always re-selecting the Default layout when opening a project is getting a bit annoying.
  14. Hello, I started to experiment with Indy (looking for a worthy successor to port some legacy TServerSocket-TClientSocket apps to). As Emba had some issues with Indy lately I decided to wipe it off, pulling an up-to-date version from https://github.com/IndySockets/Indy/ and installing that one. I have a deadlock issue with my hello world app, where it seems that TidIOHandler.ReadFromSource does not return and my project throws a "disconnected" exception upon exiting. Setup is fairly simple: TidTCPServer with defaultport set to 1024, TidTCPClient with host set to 127.0.0.1 and port set to 1024. The whole project contains the following: procedure TForm1.Button1Click(Sender: TObject); begin IdTCPServer1.Active := True; IdTCPClient1.Connect; IdTCPClient1.IOHandler.WriteLn('Hello, world'); end; procedure TForm1.IdTCPServer1Execute(AContext: TIdContext); Var s: String; begin s := AContext.Binding.PeerIP + ': ' + AContext.Connection.IOHandler.ReadLn; TThread.Queue(nil, procedure Begin Memo1.Lines.Add(s) End); end; TCPServerExecute get hits twice. First, it reads "Hello, world" and puts it to the memo correctly. The second time, it goes into the method mentioned above and never returns (can not debug the exact location, as my Delphi is showing the line indicator somewhere random...). Again, this is my first test run of Indy (copied the code from https://stackoverflow.com/questions/31039580/how-can-i-send-and-recieve-strings-from-tidtcpclient-and-tidtcpserver-and-to-cr) and have zero knowledge in the component yet. Am I doing something wrong? What would be the smallest, least complicated solution for me so I can start my learning curve? Thanks!
  15. aehimself

    Delphi 10.3.3 - Indy from 0ba2688b Git "Hello World"

    Good day Remy, I was wondering when you'll show up 🙂 So it seems the way was right from the beginning, I just had no idea Indy is automatically creating a thread for each connection and simply hang them while waiting for data. Sounds logical. To be completely honest I never had much luck with documentations. I prefer the bang-my-head-against-a-brick-wall method, which is a slower learning curve but makes the knowledge to stick around. I smiled on this though: // Sleep is substituted for a long DB or other call Sleep(5000); Some of our DB actions at work take 30+ seconds, especially on a shared test DB or a production database over the Internet. Well, with the very basics covered I can slowly can move to more advanced features (DoS protection, throttling, timeouts and so on) and if I like Indy I might even change the webserver component I'm using to create a REST-like interface. Just one question though. Are all the events of the component are called from within the connections thread context? Where should I prepare locks / synchronizations?
  16. aehimself

    Delphi 10.3.3 - Indy from 0ba2688b Git "Hello World"

    Actually, closing the client socket before exiting does get rid of the exception! I made some further tests, and indeed it seems that it is a debugger issue. Put a breakpoint on s := and press F8. First run it does, second time it does not reach the TThread.Queue line. Now put a breakpoint on both; F8 will step through them nicely. I also think I get the point of the double Execute event... first time is does not read anything from the socket - I guess the context is just being initialized. On the second run text gets read successfully. So it seems the Hello World implementation is working properly, I just hit an other debugger anomaly 😞 Thank you very much for your help! 🙂
  17. aehimself

    Delphi 10.3.3 - Indy from 0ba2688b Git "Hello World"

    While the program is running, it works for me too, I only get an error message when I close it: The strange thing is that ServerExecute gets hit twice only at the first button press, consecutive WriteLn-s trigger the event only once. And let me correct myself - it's not a deadlock, simply a blocking read operation from a socket, which has nothing in the queue. Me thinks, that is.
  18. aehimself

    Delphi 10.3.3 - Indy from 0ba2688b Git "Hello World"

    @Kryvich Thank you for the suggestion, but that will only get rid of an exception "Already connected" if the button is pressed twice during the lifetime of the application. I know it's not a nice and error handling code, it was meant as a test run only. Emba broke Indy's SSL certificate handling somehow (see: https://community.idera.com/developer-tools/b/blog/posts/rad-studio-10-3-3-indy-server-ssl-certificate-patch) and despite having a patch I feel more comfortable using a more up-to-date source. There are no 260, only 250 packages, but they compile and install nicely on 10.3.3. Does the deadlock appear if you run the code above? I had the same experience with the (unpatched) Emba version and the latest Git snapshot version too.
  19. aehimself

    Memory Management with many objects

    I had this issue once on a 32 bit application running on a Windows 2000 test machine with 64-128 MB of RAM (strangely enough, Win2k3 with 128 MB ran the same code perfectly). Solution was easy though - instead of launching and destroying a thread when the work is done and recreating it when needed again, I just left the threads in an empty loop, signaling when I need them to do their job. Took me a couple of days to figure it out, though 🙂
  20. aehimself

    How to use library from Delphi 10.1 DCUs in Delphi 10.3.3?

    This is a ridiculously perfect and simple idea. Fortunately I have source for everything, but I'll keep this in my mind for later!
  21. aehimself

    Null value for T

    Hello all, I'm implementing a custom typed class, e.g.: TMyClass<T> = Class strict protected list: TDictionary<String, T>; public Function Get(Identifier: String): T; End; Function TMyClass<T>.Get(Identifier: String): T; Begin If list.ContainsKey(Identifier) Then Result := list[Identifier] Else Result := ???; End; Question is simple. Is there a default null value for T which I can substitute ??? with? For Strings, it should return '', for numerical values 0, for classes nil and so on. Thanks!
  22. aehimself

    Null value for T

    Is it possible to learn this power? 🙂 To make functions without code? 🙂
  23. aehimself

    Null value for T

    @Dalija Prasnikar Nice, thank you! Exactly what I was looking for 🙂 Just out of curiosity, where it is declared? It says System, but I can not see the implementation. I like to see what I am using 🙂
  24. aehimself

    Dynamic creation of SQL queries

    Hi all, I have an application where I would like the user to be able to "build" what data he wants to see. As I can not expect the user to be an expert in SQL, I need to have an interface where he can just check (or enter) the fields, my program will parse it, generate the necessary SQL query (with proper joins and such), executes it and returns the data. I wrote a small program to "design" the database of the application - it is generating SQL scripts and the code for my custom table-as-an-object implementation - so I have access to all the field and relational information and can output it in any format needed. I already have a prototype which can judge which field in which table to select and a crawler (path finder, basically) which can determine the shortest route between two tables. They seem to be working fine but there's still a lot of work with it (optimizations, beautifying - the usual) which I am soooooo unwilling to do at the moment. So my question is - do I really have to reinvent the wheel? Is there a framework available which can do this for me? And yes, I really hate to redesign working prototypes to production-ready implementations 🙂
  25. aehimself

    Dynamic creation of SQL queries

    @Anders Melander The good thing is that my prototype consists of exactly the same 4 parts; which makes me believe I'm not drifting too far away from the original goal 🙂 My database structure is not large, consists of 10-ish, 11-ish tables, containing only one circular reference until now. It wouldn't even be impossible to hard code (or generate to source, that is) the shortest possible paths an all possible queries, but I am really against these kind of solutions. I was planning to test this idea on a large database (~1500 tables, multiple circular references, standalone tables, etc.) but I need to extract the fields and connections first. As for the concerns yes - I have them in mind. Especially the crawler. While it works well in my scenario but it's unoptimized and I worry about it's performance on more complex structure. That's something which will turn out on the long run. Scoping is already fully supported. I don't have many fields with the same name but yes, I already saw it as a possible problem source. I also have a theory of a mechanism to analyze and learn the more common requests so future ones can be more close to what the user wanted, but this is strictly a theory until now, and won't even start to work on it until I decide to go with my solution or to purchase a component doing this already. And thank you very much for your post, it was tremendously informative!
×