vba – Forms are sometimes extremely slow to respond

My project has grown for a year and now comprises of 19 standard modules, 7 class modules 11 forms. Some of the forms appear to freeze when called but, in fact, they are just slow to respond, taking a couple of minutes, regardless of what is clicked, e.g. just a change of focus or triggering an event procedure. The forms act normally again when reloaded (not to be confused with restarting Excel; I mean closing the form, waiting for it to respond, and then opening the same form again).

The problem first cropped up with a form that displays a PDF in a separate window. Then the malaise spread to other forms, even very simple ones, like the one that enters a date, not every time but too often. And recently – after I added 4 more classes (2 collections of collections) – simple reloading shortens the response time of the form calling Acrobat significantly but doesn’t cure it completely. The response time is reduced from minutes to seconds.

I have come to the conclusion that the problem is caused by memory management. VBA, I argue, is unable to hold the entire code at its fingertips and delay is caused by moving parts of it from the front to the back burner or the opposite direction. The larger the project the more code there is to move around memory. The form calling Acrobat Reader is leading the way because it is calling another app (Acrobat).

It’s a Win10 64-bit machine with Inspiron 3670 processor with 8GB installed RAM (7.83 GB usable). I’m running Excel 365 and it’s normal that an Internet browser should be open at the same time (currently Edge) plus a stock trading web based app which is probably large. However, I haven’t experienced any difference in the behaviour of my Excel VBA forms due to other applications being open at the same time. The problem appears contained within Excel, probably within this one workbook.

There aren’t a lot of data in my workbook. All sheets add up to less than 1000 rows * 15 columns on average. My program has a large number (perhaps 120) public enumerations. All public procedures are in standard or class modules. Forms are unloaded and destroyed when they go out of use. Classes are intentionally preserved but I judge their demand upon memory to be the tip of the iceberg.

Below is the the procedure that calls the form that calls Acrobat.

Sub FileTradeNotes()

    Dim Form    As mKSKFiling

    With ActiveWindow
        .Top = 50
        .Left = 200
        .Width = 990
        .Height = 630
    End With

    SetApplication False, True
    Set Form = New mKSKFiling
    With Form
        If .Tag > 0 Then
            .Show vbModal
        End If
    End With
    Unload Form
    Set Form = Nothing
    SetApplication True
End Sub

SetApplication disables events, screen updating and calculations. The Initialize event procedure runs fast. The slowness of response starts only after the form is loaded and fully displayed. Nevertheless, it might be the GetActiveWindow API that is causing the problem.

Private Sub UserForm_Initialize()
    ' NIC 003 09 Jan 2021

    Dim Arr         As Variant
    Dim R           As Long
    WinHnd = GetActiveWindow
    If GetKSKmail(Mail) Then Me.Tag = UBound(Mail) + 1
    ReDim NewFn(NfnTop - 1)
    Arr = Lists.Range("OrderValidations").Value
    With CbxAct
        For R = 2 To UBound(Arr)
            .AddItem Arr(R, 1)
        Next R
        .ListIndex = 0
        NewFn(NfnAct) = .List(0)
    End With
    Arr = Split("Sell - Buy +")                 ' NtrShort & NtrLong
    With CbxTrade
        For R = 0 To UBound(Arr) Step 2
            .AddItem Arr(R)
            .List(.ListCount - 1, 2) = Arr(R + 1)
        Next R
        .ListIndex = NtrLong
    End With
    CtlEvents = True
    Arr = Split("OrderAcknowledgement,OA,Debit Note,DR,Credit Note,CR,Statement,ST", ",")
    With CbxType
        For R = 0 To UBound(Arr) Step 2
            .AddItem Arr(R)
            .List(.ListCount - 1, 2) = Arr(R + 1)
        Next R
        .ListIndex = 0
        NewFn(NfnType) = .List(0, 2)
    End With
End Sub

I’m not familiar with APIs. This is, in fact, my first attempt to work with them. Therefore I also append below the procedure where they feature big. It’s called when the OK button is clicked or another button on the form that controls the document displayed in the Acrobat window.

Private Function CloseReaderDC(Optional ByVal MailIdx As Integer) As Boolean
    ' NIC 003 11 Feb 2021

    Dim WinCap      As String
    Dim Wnd         As LongPtr
    If MailIdx Then
        WinCap = AcrobatWindowID(Mail(MailIdx))
        Wnd = FindWindow(vbNullString, WinCap)
        ' this command quits the app instead of closing the document
        If Wnd Then SendMessage Wnd, WM_CloseClick, 6038, ByVal 0&
        WinCap = AcrobatWindowID
        Wnd = FindWindow(WinCap, vbNullString)
        If Wnd Then SendMessage Wnd, WM_CLOSE, 0, ByVal 0&
    End If
    If Wnd Then
        CloseReaderDC = True
        Msg.InfoBox "CantClose", 0, vbCritical, WinCap
    End If
End Function

My question is where to look for a solution.

Should I perhaps not make procedures private whenever possible? Is it wrong to let forms refer to public procedures in standard code modules? Should I remove comments? Or should I look for ways to split my workbook into several self-contained, interlinked units? Or, perhaps, is VBA just out of its depth on a project of this size?

Logically, if a process that takes a fraction of a second is executed 1000 times slower (within seconds) VBA may be shifting code execution within memory. But the time that takes can only be extended another 1000-fold (to take minutes) if the processor churns in useless loops. Something must cause such loops and something else must end them. I may be able to discourage the former and prompt the latter. Any suggestions?

Shinjiru doesn’t respond to any emails

So, long story short, there is a website that posts works without the respective authors permission or even knowledge. The hosting provider of this site is shinjiru.com.my

I have tried to contact them, send many emails to any adress I could find: abuse@shinjiru.com.my, abuse@shinjiru, contactus@shinjiru.com.my

They never replied. It’s very frustrating when someone consciously and intentionally takes your work and post on their website as their own. And it’s depressing when you can’t do nothing about it. Shinjiru, have some human decency and answer finally, would you?

server takes too long to respond


Clients don’t seem to be able to execute links off my server anymore.

For example, I sent my son a link. He tried it and gets the too long to respond message. If he uses a redirection to a resource on the server I purchase from Yahoo, its the same message.

But, sitting at my server, the link I sent my son in the Sent folder works and so does the redirection. My down and up speeds were greater than 40 and 20 MBS respectively.

There is nothing in the error log and no accesses from anyone external is shown. The KeepAliveTimeout Apache httpd.conf parameter is set at 100. No Apache changes have been made and Apache has been rock solid for a long time. I did move from cell phone/hotspot internet connectivity to router/WIFI connectivity (Spectrum) recently.

My son just got another message – ‘The server is online but is not responding to connection attempts’.

Any help will be appreciated on what might be going on or how to troubleshoot.



unity – How do I respond to clicks in editor mode?

It’s working fine in run time but I wonder if there is a way to make it work also in editor mode ?
I tried to add to the top of the script :


Because I want it to work on both run time and eidtor.

private void Update()
        if (Input.GetMouseButtonDown(0))
            RaycastHit hit;
            Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);

            if (plane.GetComponent<MeshCollider>().Raycast(ray, out hit, Mathf.Infinity))
                GameObject cube = Instantiate(prefabToSpawn);

                cube.transform.position = hit.point;
                cube.transform.localScale = new Vector3(50, 50, 50);

I removed the code from the update and created for testing a public method :

This is in the mono script :

public void SpawnThroughPlane()
        if (Input.GetMouseButtonDown(0))
            RaycastHit hit;
            Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);

            if (plane.GetComponent<MeshCollider>().Raycast(ray, out hit, Mathf.Infinity))
                GameObject cube = Instantiate(prefabToSpawn);

                cube.transform.position = hit.point;
                cube.transform.localScale = new Vector3(50, 50, 50);

Than created editor script :
The editor script is in Assets/Scripts/Editor

using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;

public class SpawnObjectsEditor : Editor
    private void OnSceneGUI()
        SpawnObjects spawn = (SpawnObjects)target;

        Event e = Event.current;
        if (e.type == EventType.MouseDown)

But the editor script is not working at all I tried to add a break point in the editor script but it seems like the editor script is not active :

Even if I’m going back to the editor the break point is not working.

Break point is not working and the script it self the editor script is not working at all even if it's in the Editor folder in the assets

c# – InputSystem “Invoke Unity Event” don’t respond to input

I was making the Input Systen code for my game.
I was about to test it and I realized that the controls don’t respond.

Here is how I’ve configured my PlayerInput component:

My PlayerInput Component configuration

And here is how I’ve set up the Input Action Asset for the Start action:

My Input Action Asset set up

In the function that refers to the Start action I’ve set up a Debug message, but it doesn’t pop up and my code inside this function doesn’t execute.

My StartGame function is:

    public void StartGame(InputAction.CallbackContext value) {
        Debug.Log("Input Recieved");
        // Game Code Here

Someone knows why it isn’t responding to input?

windows – System.Net.Sockets.SocketException (10060): A connection attempt failed because the connected party did not properly respond after a period of time

I have a functionality to call rest services from my web application. I am doing this in c#.net code

My Code

using (var client = new HttpClient()) {

var byteArray = Encoding.ASCII.GetBytes(“abc:defg!”);

client.DefaultRequestHeaders.Authorization = new
AuthenticationHeaderValue(“Basic”, Convert.ToBase64String(byteArray));

client.DefaultRequestHeaders.Add(“CSRF_NONCE”, a.NonceValue);

var message = await
null); }

I can call it successfully from my local machine but when I try to call it after deploying to the Test server (Windows Server), I get the below error.

System.Net.Http.HttpRequestException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. ---> System.Net.Sockets.SocketException (10060): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken) at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) at System.Net.Sockets.Socket.g__WaitForConnectWithCancellation|283_0(AwaitableSocketAsyncEventArgs saea, ValueTask connectTask, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.DefaultConnectAsync(SocketsHttpConnectionContext context, CancellationToken cancellationToken) at System.Net.Http.ConnectHelper.ConnectAsync(Func3 callback, DnsEndPoint endPoint, HttpRequestMessage requestMessage, CancellationToken cancellationToken) --- End of inner exception stack trace --- at System.Net.Http.ConnectHelper.ConnectAsync(Func3 callback, DnsEndPoint endPoint, HttpRequestMessage requestMessage, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.GetHttpConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken) at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.DiagnosticsHandler.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpClient.SendAsyncCore(HttpRequestMessage request, HttpCompletionOption completionOption, Boolean async, Boolean emitTelemetryStartStop, CancellationToken cancellationToken)

I tried doing the below to make it functional but nothing has worked.


2.Added the below code in the constructor method

ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true;

3.My Test server uses proxy settings in the browser to access the rest services url. So I tried adding Proxy details in my code.

WebProxy proxy = new WebProxy { Address = new Uri($"http://x.x.x.x:xxxx"), }; 
ServicePointManager.Expect100Continue = false; ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12; HttpClientHandler clientHandler = new HttpClientHandler() { AllowAutoRedirect = true, AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip, Proxy = proxy, }; using (var client = new HttpClient(clientHandler))

Any help is much appreciated.

The Possible Reason Why People Don’t Respond To Your Social Media Posts | Proxies-free

Certainly, I have nothing to gather their interest on all of my social media accounts. So I just straight up abandoned trying to promote those pages even more cause they waste me & my colleagues so much time & money. But I still have to stick with them for my main purpose (contact relatives & friends), therefore I could not get rid of them or sell them for extra cash.

What happens if a peer doesn’t respond to "getheaders" or "getdata" on time?

Suppose a node receives the same "inv" message from many peers.

  1. Will the node send "getheaders" requests to all the peers or only one of them?

  2. Does the node keep a timer for getting the "headers" response from the peers? How big
    is the timer?

  3. Suppose the node sends "getheaders" requests to only one of its peers and the timer expires. How many other peers does the node then send "getheaders" requests to? Does the node store a map data structure map<"inv", peer id from which the inv is received> to do this?

Can databases use data structures/algorithms to respond to arbitrary queries?

Let’s say that I am interested in discovering the smallest 5 numbers in a set of numbers.

In SQL, this would work:

select number
from (
    select number, 
        row_number() over(order by number asc) as order_
    from my_table
) ranking
where order_ <= 5;

Alternatively, I could use the Quickselect algorithm (in my language of choice), to solve this problem, returning data in O(N) time.

Is the SQL engine using a similar optimum/near-optimum algorithm to solve this problem? Here is an execution plan in a SQL Server 2017 db:

SQL Server 2017 query execution plan

My interpretation is that it’s taking a brute-force approach (read data, sort, compute order_, filter). With a non-clustered index on number, the table scan switches to an index scan, but otherwise it’s still the same operation.

Are there examples of databases (SQL or otherwise) where

  1. The database is aware of specific patterns of queries and tries to use a data structure/algorithm to respond to the query (similar to how a human would handle it)?
  2. The database provides options for humans to nudge the engine towards specific types of algorithms/data-structures?

What prevents us from being able to describe queries and have a database engine figure out a near-optimal approach to solve the query?

I have a feeling that I am glossing over practical challenges that an RDBMS actually robustly handles. For instance, ACID compliance, handling data that won’t fit in memory etc make it indispensable. Implementing a binary-tree datastructure + traversal on data that doesn’t fit in RAM might be too niche and too complex to be useful in a general setting?

networking – Would a service bound to respond to packets with destination

I posit they might be able to initiate a connection to your server, but they would not get a meaningful response back as the IP address – unless they were already in your LAN and compromised other devices to communicate with 127.x.x.x, breaking all the specs.

If the traffic were to go through a gateway it might depend on the routers in place, but would require hacking all the routers in the path.

This can’t really be a thing. does not leave the local computer. If it does, it can’t go anywhere because its breaking spec.