8 – Why doesn’t file load by URI?

I have a file URI something like private://somefolder/myfile.pdf. Certain users don’t have access to the file so I am trying to change that using hook_file_download($uri). In that code I need to load the file and the examples I have seen suggest:

  $files = Drupal::entityTypeManager()
    ->loadByProperties(('uri' => $uri));

but when I do this, $files is empty.

The file is there, and as an admin I can open the file. Also, if I use this code:

  $files = Drupal::entityTypeManager()
    ->loadByProperties(('fid' => 12345));

it does load the file.

Also, if I strip off the private://somefolder/ and loadBy filename, it also works.

What am I missing here?

Possible answer and bug in core?
Although the $uri which is passed to hook_file_download($uri) is in the format mentioned above (which does not work); if I try to load by uri using this:

private://somefoldermyfile.pdf (note last last slash in Windows format)

then it does work.

google cloud platform – WebSocket handshake fails behind GCloud VPC + load balancer, but not without. How to allow websockets for Serveress behind a VPC?

I have a simple node.js server (running socket.io) deployed on GCloud Cloud Run (ie. “serverless”), and in order to obtain an externally accessible IP, and also share the service with internal services (ie. redis and mysql), I’ve created a VPC and also setup a load balancer to direct traffic to the server.

It all seems to deploy fine and work, and I have an external domain working with the load balancer IP, and also an SSL certificate setup on the domain.

However, if try to connect via websockets, it is giving the error:

“WebSocket is closed before the connection is established.”

The Cloud Run server/load balancer has a Google-managed SSL certificate, on a Google domain.

If I deploy the code as a new service WITHOUT a VPC, and not tied any load balancer or domain/SSL, then Google’s Cloud Run will set it up on its own staging url, with its own SSL, and the same websocket code is connecting fine in that scenario.

However, if I deploy the same code behind the VPC, the site loads, but the websockets won’t connect to the backend.

What needs to happen with the load balancer and VPC to get the websocket handshake through, as in the normal scenario without a VPC?
I’ve been told I have to refer to the actual IP for the websocket connection endpoint, and I am in this case.

The websocket url I’m connecting to is:

(In code this is defined just as “”, but the GCloud services and I guess socket.io automatically rewrites it to wss://

Again, it all works without the VPC, but behind it it can’t connect.

Could someone please advise what aspect of Google’s networking I should look at to solve this?

bitcoin core – BitcoinCore cant load wallet

tldr: specify a directory not a file and have that folder contain a wallet.dat not a wallet1.dat.

Your error message said

 Warning: Skipping -wallet path that doesn't exist. 
 Failed to load database path'E:bitcoinwallet1.dat'. Path does not exist.

However the help for the program says

Specify wallet path to load at startup. Can be used multiple times to load multiple wallets. Path is to a directory containing wallet data and log files. If the path is not absolute, it is interpreted relative to <walletdir>. This only loads existing wallets and does not create new ones. For backwards compatibility this also accepts names of existing top-level data files in <walletdir>.

(My emphasis).

An example configuration file says

# Specify where to find wallet, lockfile and logs. If not present, those files 
# will be created as new.
# wallet=</path/to/dir>

Your E:bitcoinwallet1.dat is a file not a directory

I can reproduce something similar by copying a valid wallet.dat to wallet1.data in a separate folder with no other Bitcoin files in it

C:> bitcoin-qt -wallet=c:UsersZZZDocumentswallet1.dat

Error message

So I think you could

  • rename wallet1.dat to wallet.dat
  • specify E:bitcoin not E:bitcoinwallet1.dat.

magento2 – Luma-Icons.woff2 => Ensure text remains visible during webfont load

I’m trying to get rid of this lighthouse warning:

Ensure text remains visible during webfont load

Leverage the font-display CSS feature to ensure text is user-visible while webfonts are loading. Learn more.:

Potential Savings
70 ms

Have found some solutions on GG, but none worked.

Anyone knows how to solve this ?

Many thanks.

performance – High average load + low cpu usage + low disk usage + normal network usage + normal memory usage = ok or not?

I see high CPU average load several times a day on my server. For example, 21:20 and 22:45 on the following figure:

enter image description here

However, my CPU, disk, and network are all OK:

  1. Disk

enter image description here

  1. Network

enter image description here

  1. CPU

enter image description here

enter image description here

  1. Memory

enter image description here

  1. Also do not see strange forks

enter image description here

enter image description here

  1. Interrupts also ok

enter image description here

I have read through many posts like this, this and this. But they mostly talk about some issues in network or disk, and my network & disk seems OK.

So what should I do? Or, is this even NOT a problem? Any suggestions will be appreciated!

How To Lazy Load Homepage Blogger

I have managed to lazy load the blog posts. But it doesn't work for the homepage with thumbnail pictures.

I use this code within the body tags:

<script async='async' data-cfasync='false' defer='defer' type='text/javascript'>
const hasSupport = 'loading' in HTMLImageElement.prototype;document.documentElement.className = hasSupport ? 'pass' : 'fail';document.querySelector('span&#39;).textContent = hasSupport;

How do I do it?

Signed up for new host, but cPanel server load looks high. Thoughts?

I just signed up for a new host. The first thing I do before I try them out and bring my websites over is check the server usage. The server… | Read the rest of https://www.webhostingtalk.com/showthread.php?t=1838692&goto=newpost

linux – wkhtmltopdf 0.12.4 does not load javascript

I’m making a html to PDF converter using wkhtmltopdf, in the html I use https: //www.mathjax.org/ to display mathematical formulas *. I’m encountering several problems:
Use Ubuntu 18.04, If installed via the terminal “apt install wkhtmltopdf” the installed version will be wkhtmltopdf 0.12.4 if you download it from the site https: //wkhtmltopdf.org/downloads.html de I agree with the system will be wkhtmltopdf 0.12.6.

The wkhtmltopdf version 0.12.4 converts by loading the javascript with the formulas using the “wkhtmltopdf a.html b.pdf” terminal, however when I try to use the web service in php shell_exec (“wkhtmltopdf a.html -“), no works, shell_exec returns null, ”it cannot run from within the php script” I can run it using shell_exec (“xvfb-run wkhtmltopdf a.html -“), but besides being very slow, I need to generate + 500 PDF at a time I didn’t think it was feasible, I only use the – window-status which is already enough to load the javascript, however when I try to call by the php script it gives Error: QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to ‘/ tmp / runtime-www-data’
qt.qpa.screen: QXcbConnection: Could not connect to display
Could not connect to any X display.

Although it works with the virtual server x “xvfb-run”, this version 0.12.4 has limitations in terms of customization, but the biggest problem is having to call virtual x in every execution.

The version wkhtmltopdf 0.12.6 converts most does NOT load javascript with formulas using the “wkhtmltopdf a.html b.pdf” terminal, runs and converts using shell_exec (“wkhtmltopdf a.html -” ), but does NOT load the javascript, this version can put more details example header / footer, however the main thing is to load the formulas, which does not happen! , I use – windos-status to wait for the page to load, and even if I force – javascript-delay in 2 minutes it doesn’t work.

I also made a service java / spring-boot to run on windows / linux on linux with 0.12.4 works and loads the script, on windows works but does not load the javascript, I tested all the versions I managed to download.

With wkhtmltopdf 0.12.6 I can call through php but it doesn’t load javascript
With wkhtmltopdf 0.12.6 I can call through php but it doesn’t load javascript

With wkhtmltopdf 0.12.4 that CAN’T call using php but loads javascript
With wkhtmltopdf 0.12.4 that CAN’T call using php but loads javascript

My goal is to make wkhtmltopdf 0.12.6 / ubunto load the script, however this version which is the newest seems to have a bug to load the script.

Load full MenuLinkTree regardless of "expanded" checked

When loading a menu, for example using:

$tree = Drupal::menuTree()->load('my-menu-name', new MenuTreeParameters());

Items whose parent does not have the "Expanded" checkbox set in the menu are skipped. Is there a way to load these regardless?

load time – gstatic.com/generate_204 believed to be slowing down my website

We recently are experiencing issues where our website is taking over a minute to load and when looking into the webpagetest results to see what can be causing the issue, a new (we believe it to be new atleast) thing that is displaying and being the clear culprit is after loading the domain, it goes into loading gstatic.com/generate_204 which almost appears to time out everytime, then everything after that loads in.

enter image description here

enter image description here

The CPU utilization seems to be fluctuating the whole time as it tries to load as well so something is going on, I am just not sure exactly what. (The generate_204 may not even be the issue, but it does appear new as we run tests all the time and looks to be whats causing the issue in our eyes)

enter image description here

I am unaware of what this generate_204 is, and when googling it, you see a lot of it being a type of malware or similar that you remove from your computer, but this seems to be on my website (maybe within the files) that is now suddenly trying to load on all pages and destroying its load time.

Does anyone know what this may be, how we could possibly find it and remove it? — And if this may not be the problem, any ideas on better ways to determine the possible culprit?

For reference, the website is a Magento webstore. Thanks!!