Random snippets of all sorts of code, mixed with a selection of help and advice.
How to calculate a control's screen position (in pixels) in WinUI 3
30 December 2025 @ 8:15 am
My goal is to calculate the screen position of the left edge of the Middle block. This is used to position a floating window exactly along the left edge.
The problem is that the value I get when calculating the screen position is not what is expected. This test application shows the calculated position "From Screen" and what the floating windows actual screen positions are when dragged into place.
Calculations of coordinates in the windows application
Below “ControlBlock” is the width of the ControlBlock and “Window Pos” is the screen coordinates calculated with:
//Application window position
var mainWindow = (Application.Current as App)?._window;
PointInt32 windowPos = mainWindow.AppWindow.Position;
//Get monitor from a window
IntPtr hwnd = WinRT.Interop.Window
Calculations of coordinates in the windows application
Below “ControlBlock” is the width of the ControlBlock and “Window Pos” is the screen coordinates calculated with:
//Application window position
var mainWindow = (Application.Current as App)?._window;
PointInt32 windowPos = mainWindow.AppWindow.Position;
//Get monitor from a window
IntPtr hwnd = WinRT.Interop.WindowGitHub Copilot error during student registration
30 December 2025 @ 8:15 am
I'm a student and I'm trying to register for the GitHub Copilot student plan. I've had four previous errors and corrected them. This time, I filled in all the required information and there were no more errors, but I was still rejected for no apparent reason. Could you please help me identify the cause and how to fix this error? Thank you.


Form submission not working on Stack Overflow Ask Question page
30 December 2025 @ 8:06 am
I’m trying to post a new question on the Stack Overflow Ask Question page, but the form does not submit after filling in all required fields.
I have selected the question type, entered a title (more than 15 characters), and written a detailed body (more than 30 characters). However, when I click the submit/post button, nothing happens and no error message is shown.
I’ve tried refreshing the page and using a different browser, but the issue still occurs. I’m not sure if this is a browser-related problem, a JavaScript error, or something else I’m missing in the form requirements.
What could cause the Stack Overflow question form not to submit, and how can I fix it?
How to deploy and run era file in intellij with glassfish server and debug it
30 December 2025 @ 8:04 am
Problem
I successfully deployed a EAR file on GlassFish 4.1 and the application runs correctly.
However, when I try to run the same WAR in debug mode from IntelliJ (by configuring a GlassFish server in IntelliJ and deploying the WAR), the deployment fails with the following error.
Environment
Java: JDK 8
Application type: Java EE (WAR)
Application server: GlassFish 4.1
IDE: IntelliJ IDEA ULTIMATE
OS: Windows
Error message (from IntelliJ / GlassFish logs)
[glassfish 4.1] [WARNING] [AS-DEPLOYMENT-02016]
[javax.enterprise.system.tools.deployment.javaeefull]
Error occurred MultiException stack 1 of 4
java.lang.NoClassDefFoundError: sun/security/util/CurveDB
at sun.security.ec.SunECEntries.putEntries(SunECEntries.java:74)
Uninitialized variable in c++ outputs 0 to the console, not a garbage value, why? [duplicate]
30 December 2025 @ 7:56 am
I mean yes 0 is a possible garbage value but if i recompile the program and run it again it always outputs 0 even in a new terminal. why? i am using mingw gcc btw.
also if i remove the return 0 at the end it still persists
#include <iostream>
int main()
{
int x;
std::cout << x << '\n';
return 0;
}
----------------------------------
output: 0
Angular plugin throws error moment is not a function
30 December 2025 @ 7:48 am
I'm implementing a plugin for displaying gantt chart.
https://github.com/abhishekjain12/ngx-time-scheduler
package.json
"dependencies": {
"@angular/animations": "^16.2.12",
"@angular/cdk": "^16.2.9",
"@angular/common": "^16.2.12",
"@angular/compiler": "^16.2.12",
"@angular/core": "^16.2.12",
"@angular/forms": "^16.2.12",
"@angular/localize": "^16.2.12",
"@angular/platform-browser": "^16.2.12",
"@angular/platform-browser-dynamic": "^16.2.12",
"@angular/router": "^16.2.12",
"@okta/okta-angular": "^6.3.2",
"@okta/okta-auth-js": "^7.13.1",
"@types/moment": &quo
What we can do for css and layout of this website (https://npmexplorer.netlify.app)
30 December 2025 @ 7:33 am
Hey i am 14 year old developer ,
currently i need advice and suggestions for my website npmexplorer,
kindly explore webiste and suggest what we can do in css, js Layout to make it attractive and better ,
please suggest.
How to use an incremental DELETE+INSERT without unique_key?
30 December 2025 @ 6:08 am
I just started a new position in a company, and they're asking me to migrate their old SQL queries to DBT, the problem is that I'm trying to do a DELETE+INSERT on a range of dates without a unique_key or column to do it.
I've been looking for a way to avoid the unique_key to do it, but no luck so far.
Here is the old delete section of the code:
DELETE FROM {{params.db}}.{{params.schema}}.SEGMENTATION_{{params.country}}
WHERE COALESCE(TRANSACTION_DATETIME::date, TLZ_MS_FECHA::date)
BETWEEN {{start_date}} AND {{end_date}};
Returned from Postgres timstamptz always in UTC
30 December 2025 @ 6:06 am
I'm a little confused.
I have a Spring Boot application (Spring Boot version 4.0.1).
There's a simple DDL:
create table foo (
id serial not null primary key,
dt timestamptz not null
);
And an entity:
@Getter
@Setter
@Entity
public class Foo {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
private OffsetDateTime dt;
public Foo() {}
public Foo(OffsetDateTime dt) {
this.dt = dt;
}
}
I've got an API:
@GetMapping
public List<Foo> getAll() {
return repository.findAll();
}
After calling the API I expect a dt field returned in a timezone specified by JVM (or from -Duser.timezone). But it's returned always in UTC.
I tried to use ?serverTimezone in a JDBC connection url, set -Duser.timezone, use explicitly set timezone in Postgr
Assign colors of geom_lines with multiple legends by group in a nested facet_wrap
30 December 2025 @ 5:29 am
As Stefan suggested here, splitting the legend into multiple rows on a nested facet_wrap using legendry::guide_legend_group works well.
However, the colors are inconsistent (e.g., see the left graph below), and I would like to assign them to the geom_lines and respective legends according to the analyzers within each site: shades of green for site x (SX), of blue for site Y (SY), and of orange for site z (SZ).
I can set the colors manually for a given analyte (e.g., the CCC analyte on the right graph below), but the trick is that the number of analyzers varies depending on the analytes (in my real data, there are more than 100 different analytes, distributed differently depending on the analyzers and the sites).
Question: Considering the colors provided for the analyzers (df0$color_analyzer),