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.

when use oracle's function [to_timestamp] , got a confused problem

8 June 2026 @ 1:10 pm

when i use sql [select to_timestamp('20260608133400','yyyy/mm/dd hh24:mi:ss.ff3') from dual;] this char[20260608133400] is different with this formatter[yyyy/mm/dd hh24:mi:ss.ff3], but it worked ,there is no error ,am i losing something important??? i thought error would happen because the char is different with the format, by the way ,my oracle's NLS_TIMSTAMP_FORMAT is [RR-MM-DD HH24:MI:SSXFF] Can somebody help explain?

Hibernate 4.1.6 Final

8 June 2026 @ 1:02 pm

Friends ,I am learning Hibernate ORM Tool ,In this i learnt from GFG (https://www.geeksforgeeks.org/java/hibernate-get-and-load-method/) There is and Two Types of fetching one is GET and LOAD ,one is eagerly fetch the data from database ,and LOAD fetch only the Proxy Object ,if use that Obj it fetch the real Object from database but in my code LOAD and GET work as same ,I do not know why Let me help to Understand.(I am using lombok to generate the Getter and Setter and Construtors) public class App{ public static void main(String[] args){ Configuration config = new Configuration().configure("hibernate.cfg.xml").addAnnotatedClass(Laptop.class); ServiceRegistry registry = new ServiceRegistryBuilder().applySettings(config.getProperties()).buildServiceRegistry(); Sessio

Connected iPad not recognized in Visual Studio 2026

8 June 2026 @ 12:49 pm

I am working on my Blazor Maui Hybrid App on .NET 10 in Visual Studio 2026 (18.4.3) on a windows machine. Paired it with a Mac (macOS Tahoe 26.5.1), with Xcode Version 26.5 installed. To this Mac I have an iPad (OS 26.5 )connected , which is being recognized by Xcode in the device list. But my Visual Studio doesn't recognize the iPad, so I can't debug my app. .NET Version on both machines: 10.0.100 and 10.0.201 Workloads installed (on both machines the same versions): iOS: 26.4.10259 maui: 10.0.20 maui-ios: 10.0.20 Several reboots and re-pairing took place. Any help would be kindly appreciated since I'm trying to wrap my head around this for days. Thank you.

gradle incremental build generated gRPC java code

8 June 2026 @ 12:47 pm

I am looking for advice on how to apply gradle's incremental build for generated code. To build a gRPC client, I fetch the proto files and successfully apply gradle's protobuf plubin . Consequently, I have java files in my build/generated/sources/proto/main folder. Since it is not necessary, to always re-compile these files, I want to compile them separately. As such, in order to define inputs and outputs val compileGrpc = tasks.register<JavaCompile>("compileGrpc") { description = "Compile auto-generated java-code from proto-files." inputs.files(fileTree("build/generated/sources/proto/main").include("**/*.java")) ou

Direct import of '@angular/localize/init' detected...Include '@angular/localize/init' as a polyfill instead

8 June 2026 @ 12:38 pm

I tried to customize the paginator messages by implementing MatPaginatorIntl: import { $localize } from '@angular/localize/init'; @Injectable() export class PaginationInternationalization implements MatPaginatorIntl { itemsPerPageLabel = $localize`..:`; but got the warning: Direct import of '@angular/localize/init' detected. This may lead to undefined behavior. and Include '@angular/localize/init' as a polyfill instead. I tried to add it to polyfills section in angular.json, to no avail.

object being unspecified state in std::move<typename>() and std::forward<typename>()

8 June 2026 @ 9:34 am

# include <iostream> # include <array> # include <vector> template<size_t size> void print_array_type(int (&array)[size]) { for (int index{ 0 }; index < size; ++index) { std::cout << array[index] << ' '; if ((index + 1) % 10 == 0) { std::cout << '\n'; } } std::cout << '\n'; } template<typename AggregateType> void print_array_type(AggregateType input_aggregate) { for (int index{ 0 }; index < input_aggregate.size(); ++index) { std::cout << input_aggregate[index] << ' '; if ((index + 1) % 10 == 0) { std::cout << '\n'; } } std::cout << '\n'; } int main() { std::vector<int> vec { 10 , 20 , 30 , 40 }; std::array<int , 3> array { 103 , 120 , 430 }; print_array_type<std::vector<int>>(vec); print_array_type<std::array<int, 3>>(array);

If use == to compare strings (of numbers) in Tcl why can't you get back the string using cast as text in SQL?

8 June 2026 @ 7:20 am

I made a mistake of using == to evalaute two strings instead of eq and when I tried to cast a variable that was a string of numbers to text, after such comparison, the result was a string but after conversion to a number. Is there a way write the SQL to correct for this or does Tcl discard the original string value once == is applied? It was rather difficult to figure out the issue because when write the value to stdout, it writes out as the original string; and one might expect that if puts "knows" the string representation then so would cast in the SQL. package require sqlite3 sqlite3 db ":memory:" set id_1 00000 set id_2 00000 puts [db one {select json_object( 'id_1',cast(:id_1 as text), 'id_2',cast(:id_2 as text) )}] # {"id_1":"00000","id_2":"00000"} puts [expr {$id_1 == $id_2}] # 1 puts "id_1 $id_1 id_2 $id_2" # id_1

.NET 10 Minimal API validation throws "Property 'this[]' not found on type 'JsonElement'" when a DTO has a JsonElement member

8 June 2026 @ 6:21 am

On .NET 10 (SDK 10.0.300), enabling the Minimal API validation pipeline with AddValidation() throws an InvalidOperationException at request time when the request DTO contains a System.Text.Json.JsonElement member. The request never reaches the endpoint. Minimal repro: using System.ComponentModel.DataAnnotations; using System.Text.Json; var builder = WebApplication.CreateBuilder(args); builder.Services.AddValidation(); var app = builder.Build(); app.MapPost("/test", (MyRequest request) => Results.Ok()); app.Run(); public class MyRequest { [Required] [MaxLength(10)] public string Name { get; set; } = default!; public JsonElement Payload { get; set; } } .csproj: <Project Sdk="Microsoft.NET.Sdk.Web"> <PropertyGroup>

Per-document user preferences (Cocoa document architecture in MacOS)

7 June 2026 @ 5:02 pm

I'm exploring best practices for per-document user preferences. The app is table-view-centric with less than ten columns so far, and I'm pondering whether to enlist NSUserDefaults for an app that is likely never going to be very intricate. So far, I just want to control which columns are displayed, and what is in their header cells, but on a per-document basis. I already have the infrastructure for generating table columns programmatically and binding them to my NSArrayController instance. The simplest (but I suppose, clunkiest) approach would be to place controls for these preferences on a modal sheet that can be pulled down on any document. My impression is that the kindly choice is not to splash modal views on a document except in emergencies. I'm still working in Cocoa/Objective-C and I just don't know how much of a learning curve I will have to climb to get the NSUserDefaults to do this kind of work for me; I will certainly appreciate any pros-and-cons advice I get.

Spring STOMP not works with both EnableWebSocketSecurity and HeaderHttpSessionIdResolver enabled [closed]

7 June 2026 @ 8:46 am

I did a demo project that integrates Spring Security, Spring Session, Spring Websocket, with the HeaderHttpSessionIdResolver bean enabling HTTP header session ID resolving to avoid cookies, upgraded config of WebSocketConfig extends AbstractSessionWebSocketMessageBrokerConfigurer<Session>, and a simple webpage frontend that utilizing stompjs. The Spring Boot backend rejected STOMP CONNECT request. The DEBUG level log complains about invalid CSRF token. I ran the official Spring demo of spring-session-sample-boot-websocket which is similar to mine, with a bit of Maven migrating successfully, that resolves the session ID from cookies, with CSRF and EnableWebSocketSecurity enabled, on the same Spring Boot version. It seems that the HeaderHttpSessionIdResolver cou