Random snippets of all sorts of code, mixed with a selection of help and advice.
Error while sending mail in java (Spring Boot)
18 May 2026 @ 4:44 am
I am trying to send email using Spring Boot with Gmail SMTP, but I am getting the following exception:
org.springframework.mail.MailSendException: Mail server connection failed.
Failed messages: jakarta.mail.MessagingException: Exception reading response;
nested exception is:
java.net.SocketException: Connection reset
application.yml
spring:
mail:
host: smtp.gmail.com
port: 587
username: [email protected]
password: your_app_password
properties:
mail:
smtp:
auth: true
starttls:
enable: true
required: true
connectiontimeout: 5000
timeout: 5000
writetimeout: 5000
debug: true
Mail Service Code
private final JavaMailSender javaMailSender;
@Value("${app.mail.from}")
private String fromEmail;
public void sendMail(EmailRequest request) {
try {
System.out.println(
Proton "WebClients" MonoRepo clone yarn install fail
18 May 2026 @ 4:19 am
When i try to clone the "ProtonMail/WebClients" github repo and "yarn install" I get to the Fetch Step where after some time I get an error that says "connect ETIMEOUT 185.70.42.66:443" and then the install fails. I have tried pinging, invokewebrequest, and even increasing timeout but still the fetch times out.
Error:
➤ YN0001: │ RequestError: connect ETIMEDOUT 185.70.42.66:443
at ClientRequest.<anonymous> (C:\Users\Administrator\AppData\Local\node\corepack\v1\yarn\4.13.0\yarn.js:146:14258)
at Object.onceWrapper (node:events:631:26)
at ClientRequest.emit (node:events:521:24)
at c.emit (C:\Users\Administrator\AppData\Local\node\corepack\v1\yarn\4.13.0\yarn.js:141:22975)
at emitErrorEvent (node:_http_client:109:11)
at TLSSocket.socketErrorListener (node:_http_client:593:5)
at TLSSocket.emit (node:events:509:28)
at emitErrorNT (node:internal/streams/destroy:170:8)
at emitErrorCloseNT (node
coordinate proximity for likert scale analysis (php)
18 May 2026 @ 4:08 am
this is a project in php but i am happy with any suggestions, regardless of language. the coding is less the issue than a missing piece in logic i am struggling with.
users answer a series of 7-point likert scale questions (from strongly against to strongly support with center neutral).
each question is assigned a specific point on a two-axis cartesian grid. the grid is 20x20 (10x10 in four quadrants around a central axis at (0,0)) but the size is unimportant.
the desired result is plotting a single point (x,y) of best fit, which should be a relatively easy concept. if the scale (s) was from 0-3, that would be relatively easy. just a weighted average of all the answers where each point was treated as (sx,sy) and an average was taken based on total sum(s). that would give a point of best fit allowing for 0.
where the scale is -3 to +3, a different problem arises and that scaling approach doesn't work because there's no opposite (x,y) to assign the negative
Looking for Open source business apps - NextJS React TypeScript MUI MongoDB
18 May 2026 @ 3:40 am
Kindly help me to spot some active open source business applications projects built with the stack : NextJS React TypeScript MUI MongoDB.
Business applications, what I meant is that - Financial accounting, Sales, Purchase, Employee payroll, Production or an ERP - enterprise resource planner - suite.
Thanks
What are the best practices for high-speed differential pair routing in 4-layer PCBs
18 May 2026 @ 2:26 am
I'm designing a 4-layer PCB for a DDR3 memory interface and want to follow best practices for differential pair routing to ensure signal integrity.
My stack-up is: Top (Signal) → GND Plane → PWR Plane → Bottom (Signal). The differential pairs are for DDR3 clock signals, which require 100Ω differential impedance.
I'd like to know the industry-standard best practices for this scenario, including:
Recommended trace width and spacing calculations, considering the FR-4 dielectric constant.
How to handle vias on differential pairs to avoid impedance discontinuities.
The minimum recommended distance from differential pairs to other high-speed signals or noise sources.
Whether to use length matching on the same layer or via stitching, and what the maximum allowed skew is.
Common pitfalls (like reference plane splits) that should be avoided.
Any references or standard d
What's the reason why the waken signal cannot be lost by using an RMW operation compared to a pure load?
18 May 2026 @ 2:17 am
Consider this example:
#include <iostream>
#include <thread>
#include <atomic>
extern void block_wait();
extern void wake();
int main(){
std::atomic<int> counter = 0;
std::jthread t1([&](){
if(counter.fetch_sub(1,std::memory_order::relaxed) == 0){ // #0
block_wait(); // #1
}
});
std::jthread t2([&](){
if(counter.fetch_add(1,std::memory_order::relaxed) == -1){ // #2
wake(); // #3
}
});
}
In this example, block_wait and wake don't introduce data-race, and their functions are implied by their names. block_wait blocks the thread and waits for a wake signal to unblock the thread. wake wakes the thread that is blocked.
If #0 reads 0, #2 will be guaranteed to read -1 and execute wake() to wake #1. However, if we c
How do I sanitize input for generating PDFs in a web application?
18 May 2026 @ 2:10 am
I'm building a web application using Node.js. The application allows users to generate PDFs based on input data. I'm looking at pdf-lib, pdfkit and pdfmake to generate PDFs. However, from what I've found, it seems to me that none of these libraries provide input sanitization capabilities to prevent vulnerabilities like code injection. What are the best practices for sanitizing user input when generating PDFs? I tried to search online but I couldn't find anything specific other than general recommendations that I should be sanitizing input. Are there any libraries that make it easier to follow these best practices?
CMake fails to locate libteem.so
18 May 2026 @ 12:22 am
I am using Ubuntu 26.04 to build a CMake package using ccmake.
I used apt to install the libteem-dev package.
When configuring the build, CMake failed to locate the shared object libraries libteem.so*.
There were some CMake files in /usr/lib/Teem-1.12.0.
CMake was configuring to look for the libraries in /usr/lib/Teem-1.12.0.
However, libteem.so* were in /usr/lib.
Copying libteem.so* to /usr/lib/Teem-1.12.0 solved the problem.
If I edited the configuration variable to point to /usr/lib in ccmake, it would be overwritten back to /usr/lib/Teem-1.12.0 when configuring.
Why was CMake configuring to look in the wrong place?
Is there a more elegant solution to this problem than simply copying the .so files to the expected location? Off the top of my head, I think a symlink could be more
Top-level module is left unconnected?
17 May 2026 @ 11:45 pm
I tried to pass a parameter to the test bench, but I got an error:
The port 'tb_if' of top-level module 'test' whose type is interface 'dut_if' is left unconnected. It is illegal to leave the interface ports unconnected.
Please make sure that all the interface ports are connected.
Here is my code:
interface dut_if(input logic clk);
logic [7:0] data;
logic valid;
logic ready;
// Clocking block for the testbench (Driver/Monitor)
default clocking cb @(posedge clk);
default input #1step output #2ns;
output data, valid;
input ready;
endclocking
// Modport to restrict the testbench to using the clocking block
modport tb (clocking cb);
endinterface
module test (dut_if.tb tb_if);
logic clk;
dut_if vif(.clk(clk));
initial begin
clk = 0;
forever #5 clk = ~clk;
end
initial begin
// Synchronize to the clocking event
@(tb_if.cb);
// Drive signals throug
write a program C++ with private member data only 5 examples with statements
17 May 2026 @ 9:06 pm
I Want to write a C++class with private members. I am unsure how to correctly declare them and access them via member functions . cloud something provide a detailed example that shows how to set and get private variables inside a class.