Jump to content

dummzeuch

Members
  • Content Count

    3020
  • Joined

  • Last visited

  • Days Won

    108

Posts posted by dummzeuch


  1. I just came across this code:

    var
      I: Integer;
    begin
      for I := 0 to Collection.Count - 1 do
        if TListColumn(Collection.Items[I]).WidthType <= ColumnTextWidth then Break;
      Changed(I <> Collection.Count);
      WriteCols;
    end;

    Is it just me or does anybody else think this is wrong?

     

    Or is the value of a for loop variable after a loop explicitly defined nowadays? I always thought that's compiler dependent and should not be relied on.


  2. They say that documentation is the worst part of programming and I mostly agree with that. Nevertheless I have taken the time to add a page about the Uses Clause Manager expert to the GExperts help because that topic was completely missing. I hope I covered all the topics. There is no help button on the form yet. I’ll look into that later.

    There is also an updated chm file as well as a printable manual in PDF format.

    • Like 2

  3. 40 minutes ago, Uwe Raabe said:

    The help gives some information

    You're apparently assuming that I read the help before using MMX. I didn't. I installed it and started to explore what it can do (and watched part of your video on YouTube). Reading the docs (help) is so 1990ies ...

    Since at the same time I also started to use Delphi 12 in anger I didn't know what caused these bookmarks. It could have been one of the many flaws of that new IDE. Also the bookmarks have become more visible in Delphi 12 than they were n 10.2 so having them turn up all the time became more annoying.


  4. On 9/11/2024 at 10:28 AM, Uwe Raabe said:

    BTW, also since I took over MMX there has been no one sending any usage report (perhaps it just works on my tests but not in the wild), so I don't have any numbers of what people use most or least. While I would not drop any features based on such numbers, they would give me some hints of MMX features that may just be unknown and lack some promotion.

    Hm, I just tried that but since I am not using Outlook but Thunderbird it failed to generate the email. But since I am only starting to use MMX, that won't have told you much anyway.

     

    btw: I found theses automatically dropped bookmarks annoying, especially since I didn't know what created them. Thanks to Peter's question I know now how to disable them and did.


  5. 22 hours ago, pyscripter said:

    In the latest commit, multiple connections are handled in separate threads. So, Multiple Connections on LocalForward · Issue #11 · pyscripter/Ssh-Pascal is fixed.  Seems to work fine, but could you please test it? 

    I found my bug: I had for testing purposes changed the RemoteHost to one that requires different credentials, so log on failed.

    Now, having changed that back, the tunneling Remote Desktop works as expected. So your change works for me too.

     

    Thanks a lot!

     

    As for parallel connections:

    The unmodified LocalForward demo works for two different browsers in parallel. But after closing the second browser I get ESshError "LibSSh2 error: Unable to send channel-open request (-7), on API "libssh2_channeld_direct_tcpip_ex" in SshTunnel, line 170. This then happens every time I try to connect to http://localhost:12345/success.txt So there still seems to be something amiss.

     

    • Like 1

  6. 11 hours ago, Stefan Glienke said:

    Which - fun fact - does not happen on the method call (unless it's a virtual method) but when accessing any member inside of it. You could still have some method which does not access any member and it will not AV at all.

    I have actually been using this "feature" when I needed an event handler but didn't have an object ready, by declaring a local variable of a simple class type declared just for this purpose, setting it to nil (just to shut up the compiler) and assigning its method to the event. That method simply doesn't do anything that requires self to have a value, so it works fine (it also must not be virtual). No constructor/destructor calls required and also no memory leak created. 

    Alternatively one could create a plain procedure with the right signature, assign that to the code pointer of a TMethod record, leave the data pointer unassigned or set it to nil, and assign that record to the event using appropriate type casting. But that somehow feels hackier than the nil object instance.


  7. 45 minutes ago, JonRobertson said:

    That's an odd opinion, considering that a "pointer variable" or object reference with a nil value still results in an Access Violation if used before it is assigned a valid (allocated) memory reference.

    
    var MyForm: TForm := nil;
    MyForm.Show;

     

    But you can easily check for nil, while that's not possible for "uninitialized". And you can also easily spot them in the debugger.

    Also, referencing a non-initialized object reference does not necessarily result in an access violation, while referencing nil definitely does.


  8. 1 hour ago, Rollo62 said:

    You could check 

    https://symless.com/synergy

    Works like a charm for me, at fair costs 

    There is also Mouse Without Borders, now part of Windows Power Toys, which has a similar functionality, but is Windows only.

    But as Alberto just clarified: He needs a different functionality, so this won't help.

     

    Regarding KVM switches: I found them a bit too pricey for just a convenience so I do the same as Anders and use the multiple input ports of my monitor(s) to connect my computers and switch between them using the monitor's on screen menu. My keyboard has two USB ports so I connect the mouse to the keyboard and just need to plug in the keyboard's USB cable into the computer I am currently using. (A separate USB hub would offer the same "convenience" at much less cost than a KVM switch). Also, I can have one of my monitors show the display of one computer and the other the display of the second one, if I need that. I don't know whether KVM switches allow that nowadays.

     

    Of course that always depends on the use case: If you want to switch frequently, a KVM switch may be worthwhile. But then maybe Remote Desktop or Synergy / Mouse Without Borders could be a better solution.

    • Like 1
    • Thanks 1

  9. 11 minutes ago, DelphiUdIT said:

    I, and not only me, have noticed that the instability of the IDE is mainly due to (in my case ONLY to) third-party components installed in the IDE.

    For a long time now I have been trying to use third-party components (there are few that I install now) only at runtime. And where a graphical surface defined in the FORM is needed, I "hook" them to invisible TPanels placed at design time.

    Of course, not always it's possible but when it is that save me about those issues probably.

    I can understand why you do that, but it kind of defeats the purpose of a form designer.

    I hope you filed bug reports for the offending components.


  10. 7 hours ago, pyscripter said:

    @dummzeuch Please see my latest commit.  TSshTunnel.ForwardLocalPort has been refactored and can now handle multiple connections sequentially.  So your use case may be working.  Could you please test.  

    I'll test your changes as soon as I am awake properly and had breakfast.

     

    edit: It seems to work.

    I can connect to the web server using multiple browser instances sequentially without restarting the LocalForward demo. I haven't looked at the code yet.

     

    I'll try to change my Remote Desktop forwarding tool to use your new code.

    edit: Nope, doesn't work. After logon, while the Remote Desktop confirmation dialog is being shown An exception "Windows socket error: An existing connection was forcibly closed by the remote host (10054), API 'recv'" occurs in SshTunnel, Line 170, which aborts the listening the thread. Afterwards of course no further connections are being accepted.

    7 hours ago, pyscripter said:

    I will also see whether the connections can be handled in parallel.  Is there a use case for that?  Can you have multiple connections simultaneously on the same port?

    A web server has multiple connections on the same port, doesn't it? So does ssh itself. Or a database server.

    A simple use case would be if you want to test some page on a web server using different browsers in parallel.


  11. 13 hours ago, pyscripter said:

    @dummzeuchI have updated the build scripts and the binaries which do not need OpenSSL.

     

    Could you please try the new binaries and see whether you still get the error you mentioned?  These binaries work well with ssh-agent password-less authentication, whilst the Php ones don't.

    I just tried sshexec on my home Linux "server" and it worked now. It also automatically took my ssh key from Pageant.

     

    13 hours ago, pyscripter said:

    Also would it be possible to post a test project that requires multiple connections, so that I can have a go at fixing the issue?

    Hm, I just tried to simply request a web page through the tunnel twice in a row, but apparently the browser keeps the connection open even if I close that tab. I had to wait for a timeout. for a request to fail. But closing the whole browser window rather than just the tab worked. The connection will be closed and when retrying in a new window the request will fail.

     

    • Like 1

  12. 2 hours ago, pyscripter said:

    Probably not.  When you add commits to the same branch, the commits are added to the PR.  If you want to have separate PRs you need different branches for each change. Anyway your changes have been merged and you are listed as a contributor.

    I used 3 different branches, but I guess the mistake was merging those changes into my master branch and creating new branches for the other changes from my master branch which already contained the changes from the first branch. I'll try it differently next time.

     

    Thanks for merging.


  13. 23 hours ago, pyscripter said:

    A Pull Request implementing an alternative design that resolves this issue would be much appreciated.

    I have submitted 3 pull requests (none solving that problem yet), but I have been doing something wrong: The branches from which I created the pull requests contain more commits than expected.


  14. Basically the problem I am facing here is the same as issue#11 reported on GitHub, only that I have two connections one after another and the person who opened that issue has them in parallel.

     

    And that's rather difficult to fix based on the current structure because TSshTunnel.ForwardLocalPort is executed completely in one thread.

    In order for this to work, there must be one thread that calls select on ListenSock and then starts another thread whenever there is a connection to the socket and let that thread handle the forwarding from it until that connection is closed. The original thread must then again call select on ListenSock.

    This would handle multiple connections serially and in parallel.

    • Like 1

  15. Turns out that reading from the local socked returned an error with error code 10054 "An existing connection was forcibly closed by the remote host" and raised an ESocketError exception. I never saw that exception because I had disabled the exception notification for this exception type in the debugger (because it happens every few seconds when debugging a IDE plugin without connection to the elc server).

     

    So I figured that the remote desktop client closes the socket after login and then tries to open a new connection, but since the thread exits after that exception it cannot connect. And guess what: I just restarted the program again before clicking "Yes" and I've got a working remote desktop session now.

     

    So the solution in this case is to start listening for a connection again after the previous one was closed. I'll try that later.

     


  16. 3 hours ago, Charlie Heaps said:

    Dumb question - why would it NOT be a good idea for variables to be initialized by Delphi (e.g. to zero/blank/false) both locally and globally.  I have always found it strange that they are not.  What would it break if Embarcadero changed this? Or would it slow down code?

    It would indeed slow down the code. But I doubt that it would make much of a difference nowadays except under very special circumstances..


  17. 13 hours ago, pyscripter said:

    @dummzeuch I have pushed a couple of fixes to SshTunnel.pas (issues found by Copilot!).  Could you please check whether they make a difference?  One of them might:  

     

    SocketOption := 1; // Initialize SocketOption

    Unfortunately the problem persists. I'll have a deeper look into it later. Thanks a lot.

×