StackOverflow.com

VN:F [1.9.22_1171]
Rating: 8.5/10 (13 votes cast)

Random snippets of all sorts of code, mixed with a selection of help and advice.

Is Visual Studio 2022 Consolas font really Consolas?

22 May 2026 @ 12:46 pm

I have two Visual Studio installed on my Windows 11 laptop: VS 2015 Professional (14.0.25431.01 Update 3) VS 2022 Professional (17.12.18) On both I have Consolas font set in Text Editor font VS2022 enter image description here VS2015 enter image description here But font is different when I type some text in Text Editor. I also did screenshots and compared them enter image description here Is there a way to have same exact Consolas font as in VS2015 (characters) in VS2022? I don't like this VS2022 font. I tried disabling Smooth option "My Computer/This PC -> Properties -> Advanced System Settings -> Advanced tab -> Performance -> Settings button -> Custom radiobox -> Smooth edges of screen fonts" but whole Windows fonts l

Why it is possible to launch calc.exe, but not notepad.exe when connected to Windows via ssh?

22 May 2026 @ 12:45 pm

In Windows, you can install ssh server (OpenSSH). There is a known problem on Windows, that is you cannot run GUI applications as normal (without quirks). See https://github.com/PowerShell/Win32-OpenSSH/issues/998. If you try to run application "as normal", i.e. just run "notepad.exe" in the command prompt, it will "launch" (the process appears in task manager for some time), but its window does not appear. This happens with every application I tried. But there is one application that behave differently. It is calc.exe. If you connect via ssh, then execute calc.exe, the window of clculator app does appear! Steps to check this: Install OpenSSH for Windows Ensure OpenSSH service is running. Open a Terminal. Run ssh localhost. Run notepad.exe. You wi

Javascript - Uncaught TypeError: can't access property ..., ... is undefined

22 May 2026 @ 12:44 pm

I'm trying to create a dynamic inventory table, where one of its functions is to ping a device to find the device's online/offline status. The idea is that the colour of the IP address in the table should change depending on the result, which I'm trying to achieve by changing the id tag of the element so the CSS rules change. This is the code for the cells containing the IP addresses in my HTML table: <td><input name='ip[$id]' value='$ip' size='15' id='ipDefault'></td> And this is my Javascript code: function ipstatus (index,status) { var ipInput = document.getElementsByName("ip[" + index + "]"); if (!ipInput) return; var isOnline = status === true || status === 1 || status === '1' || status === 'true'; var isOffline = status === false || status === 0 || status === '0' || status === 'false'; //this is

ESP32 Bluetooth webserver

22 May 2026 @ 12:35 pm

I often use ESP32 which expose some web application interface on an WiFi Hotspot or WiFi station to access it. I wonder how to do that with bluetooth too. There is some idea in the internet that Bluetooth does not server HTTP traffic - but my Android phone for example can "tether" to my PC via Bluetooth, thus providing it's internet connection to the PC. In the same way, the ESP32 may be "tethered" to the PC, allowing the PC to access the the ESP32 intranet and access the web app served by it. How to do that?

How to create stable components with entt?

22 May 2026 @ 12:34 pm

i want to pass pointers to (certain) components into a scripting system. the scripting system can handle pointers - so those need to be stable. so i need the pointers to components to be stable. i found instructions that said i neeeded to set a -DENTT_PACKED_PAGE=16384 compiler flag and also #define ENTT_PACKED_PAGE 16384 and then specialise a type trait. parts of that were dumb, so, when it didn't work I did this at the top of entt.hpp ... #define ENTT_PACKED_PAGE 512 #define entt_mark_stable(T) template<> struct entt::component_traits<T> { using in_place_delete = std::true_type; } ... buuttt; that causes compiler errors about the page_size value which is also mentioned in t

Is fast-return possible on Microsoft SQL Server?

22 May 2026 @ 12:28 pm

I've got a query looking for accounts against the user-provided input: SELECT * FROM accounts a WHERE a.dep_id in :depIds AND ( (a.key_identifier IS NULL AND a.name LIKE CONCAT(:searchText, '%')) OR (a.key_identifier IS NOT NULL AND a.hashed_name = :hashedSearchText) OR a.skac LIKE CONCAT(:searchText, '%') ) Often the users don't put any searchText i. e. for such input the query will effectively be --... AND a.name LIKE '%' i.e. every non-nullable string matches. I was thinking of introducing the fast-return statement like: SELECT * FROM accounts a WHERE a.dep_id in :depIds AND ( :searchText IS NULL OR ( (a.key_identifier IS NULL AND a.name LIKE CONCAT(:searchText, '%')) OR (a.key_identifier IS NOT NULL AND a.hashed_name = :hashed

RockyOS/CentOS/RedHat OS - VMWare to OpenStack migration - server too slow (e.g. up to 3x)

22 May 2026 @ 12:13 pm

Instructions on how to speed up a server that is too slow after migrating from VMWare to OpenStack. Disable tuned service. Changing kernel settings. grubby --update-kernel ALL --args "selinux=0 idle=poll intel_idle.max_cstate=0 intel_pstate=disable processor.max_cstate=1 elevator=none" Reboot server Changing read-ahead settings - new systemd file. i) file: /etc/systemd/system/setra.service ii) content (for devices /dev/vda, dev/dm-[0,2]): -- START -- [Unit] Description=Set custom read-ahead for devices After=tuned.service [Service] Type=oneshot ExecStart=/sbin/blockdev --setra 32768 /dev/vda ExecStart=/sbin/blockdev --setra 32768 /dev/dm-0 ExecStart=/sbin/blockdev --setra 32768

No AuthenticationProvider present

22 May 2026 @ 12:07 pm

A user, who changed some of their profile information, can also be impersonating another user during this time. When this is detected, I'd like to continue this impersonation. When I call setIdentity(), it seems impersonation is lost. This led me to believe that I simply need to call impersonate() immediately after. However, this gives me the following error: No AuthenticationProvider present. //set new profile data $this->Authentication->setIdentity($user); //set impersonation from current user $this->Authentication->impersonate($user2);     //No AuthenticationProvider present Note: CakePHP 5.x and Authentication 3.x.

Is it possible to edit/change a resource file within a Jar in Java?

22 May 2026 @ 12:06 pm

I'm building a program in Java that requires some settings files. Can I mark them as resources and then have the program later on edit/modify/store data in them, while the program and the settings files are inside the Jar? I'm new to the language and I don't really know how this JVM works and what can or can't do...

How to create a PyTorch DataLoader from a dictionary?

22 May 2026 @ 12:00 pm

I am trying to create a dataloader for an lstm model in order to predict protein-protein interactions. I have a tsv file with two fasta headers and one label header1 header2 label1 header3 header4 label2 and also a dictionary with headers as keys and fasta sequences as values header1: sequence1 header2: sequence2 I need to create a dataloader such that it takes a header from the tsv file and iterates over the specific sequence in the dictionary, also associating the correct label for a pair of proteins. I have tried this code: class Pairs: def __init__(self, pairs_file, seq_file): self.labels = pd.read_csv(pairs_file, sep='\t') print(self.labels.shape) self.seq_file = seq_file print(isinstance(self.seq_file, dict)) def __len__(self): return len(self.seq_file) def __getitem__(self, item): for key, value in self.seq_file.items(): if