StackOverflow.com

VN:F [1.9.22_1171]
Rating: 9.2/10 (11 votes cast)

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

How to display rounded corners to the DataGrid in WPF?

4 November 2025 @ 7:35 am

I have the code to display rounded corners to the DataGrid. My problem is that it is not displaying rounded corners at the bottom of the DataGrid. How to make it rounded? This is how it looks now This is the code I am trying. <Border BorderThickness="0" Margin="10" CornerRadius="15" Visibility="Hidden" x:Name="brdLiveData" Height="300"> <Border.BitmapEffect> <DropShadowBitmapEffect /> </Border.BitmapEffect> <Grid> <Border x:Name="BDRounded" BorderThickness="0" CornerRadius="15" Background="White"/> <DataGrid x:Name="dgRound" BorderBrush="{x:Null}" HeadersVisibility="Column" ItemsSource="{Binding Items}" AutoGenerateColumns="False"> <DataGrid.

Best practice to handle ESLint 'require' vs 'import' in TypeScript test files without losing coverage

4 November 2025 @ 7:30 am

I am writing test cases in TypeScript, and Codacy/ESLint flags an error when I use require() statements to import modules inside my tests. The linter suggests replacing require() with ES6-style import statements for better type checking and consistency. However, since import statements must be at the top of the file, when I move these imports there and call them inside individual test cases, I encounter multiple errors. After fixing those errors, I notice that the code coverage contributed by those test cases drops significantly compared to when I used require() dynamically. How can I resolve these issues? Is there a recommended way to dynamically import modules in TypeScript tests to avoid lint errors and preserve coverage? Can I use dynamic import() in tests, or should I selectively disable ESLint rules for require in test files? What are the best practices for structuring imports in TypeScript Jest tests to maintain good type safety an

TypeError: Invalid JWK EC key

4 November 2025 @ 7:29 am

Im trying to implement @simplewebauthn/browser package. Here is how I save the credentials. There is no problem on fingperint verification. const publicKeyBase64url = Buffer.from(credential.publicKey).toString('base64url'); await this.db.SavePasskeyCredential( payload.id, publicKeyBase64url, credential.counter, playerId, payload.deviceName || 'Unknown Device', 1 ); I got ERR_CRYPTO_INVALID_JWK error on login const publicKeyBytes = new Uint8Array(Buffer.from(credential.PublicKey, 'base64url')); const opts: VerifyAuthenticationResponseOpts = { response: authenticationResponse, expectedChallenge: receivedChallenge, expectedOrigin: process.env.APP_ORIGIN, expectedRPID: process.env.RP_ID, credential: { id: credential.CredentialId, publicKey: publicKeyBytes, counter: credential.SignCount || 0, transports: credential.transports }, requireUserVerification: true }

pass data to tsx code stored in a variable

4 November 2025 @ 7:26 am

I have tsx stored as a template in a variable like so // file a let v = <div>text</div> This should be used with some context or parameters in other files. // file b import v from a.tsx function f() { return <>{v}</> } v cannot access context(s) in other files. How can v be able to access context or is getting props assigned?

Decompress .zstd file using typescript

4 November 2025 @ 7:15 am

I'm trying to programmatically decompress a .zst file using typescript. This is the code I am using: import { createReadStream, createWriteStream } from 'node:fs'; import { createZstdDecompress } from 'node:zlib'; import { pipeline } from 'node:stream/promises'; import { PathLike } from "fs"; export async function decompress_zstd(input: PathLike, output: PathLike) { const zstdDecompress = createZstdDecompress(); const source = createReadStream(input); const destination = createWriteStream(output); await pipeline(source, zstdDecompress, destination); } decompress_zstd("./data/scratch/lichess_db_puzzle.csv.zst", "./data/scratch/lichess_db_puzzle.csv") .catch((err) => { console.error('An error occurred:', err); process.exitCode = 1; }); This is the file I am trying to decompress (Direct download: https:

JWT Authentication of the Spring boot With the Angular 19 frontend

4 November 2025 @ 7:09 am

I was stucked on the one topic that in the frontend i am switching from the one tab to another , in that how to authenticate that jwt every time with the backend .

gorazor: Can't find layout

4 November 2025 @ 6:58 am

For go i want to use the gorazor template engine. I used code from gorazor repository and from go template benchmark and ran gorazor tpl tpl and got panic: Can't find layout: rzrexmpl/tpl/layout/base [Home]: gorazor tpl tpl gorazor processing dir: tpl -> tpl panic: Can't find layout: rzrexmpl/tpl/layout/base [Home] The project rzrexmpl looks like this rzrexmpl ├─── main.go ├───models | └─── user.go └───tpl ├───helper | ├─── footer.gohtml | ├─── header.gohtml | └─── msg.gohtml ├───layout | └�

Is it a good practice to maintain separate properties for factories, singletons, and instances in the Service Container?

4 November 2025 @ 6:17 am

I'm implementing a simple PHP service container for my personal website blog and want to make sure I'm setting it up correctly. My container has three types of service registration methods: singleton() – for shared instances factory() – for creating new instances each time instance() – for manually providing an existing instance I’m currently storing them in separate properties: class Container { private array $factories = []; private array $instances = []; private array $singletons = []; public function singleton(string $abstract, callable|string $concrete = null): void { $this->singletons[$abstract] = $concrete; } public function factory(string $abstract, callable|string $concrete): void { $this->factories[$abstract] = $concrete; } public function instance(string $abstract,

Is it possible to play sine waves polyphonically using OscillatorNode?

4 November 2025 @ 3:40 am

I wanted to challenge myself in JavaScript and build a synthesizer, and to do this, I need to play multiple notes at once to build a harmonic series to get a unique sound. I've looked over the Mozilla documentation on it, but I can't seem it figure it out. I looked at a post on here that asked a similar question to this, though that question was left without a true answer since, after turning up the gain, the sine waves started getting very distorted.

AddressConverter::convertMany(): Argument #1 ($addresses) must be of type array, null given

4 November 2025 @ 1:11 am

I noticed one newRelic error Magento\Framework\Mail\AddressConverter::convertMany(): Argument #1 ($addresses) must be of type array, null given.