React useEffect and localStorage doesn’t set state that is required in child components

I’ve got an app with rudimentary localStorage saving working, but I’m running into a problem when trying to load that data. const defaultSaveState=”default”; const [currentSave, setCurrentSave] = useState(defaultSaveState); useEffect(() => { setCurrentSave(JSON.parse(localStorage.getItem(“save”)) // ‘saved data’ }, []) console.log(currentSave); // outputs ‘default’ This runs in the parent component and the currentSave state is passed to a … Read more

How to check a checkbox with docx

I’m trying to get a checkbox from a table inside a pre-made word doc but I’m having trouble getting it to function. I came across this SO post that has helped me almost get there, but I’m still unabel to fully understand/get it to work. What I have so far: import docx from docx import … Read more

Different result on count(*) when do left join

I have 2 different tables one is product and other count number of quantity in second table. Count(*) gives different result when use left join condition and group by LEFT JOIN ON and GROUP BY is different below is the query. SELECT LEFT( substring_index(dp_ventes_par_segments.ref_article,”https://stackoverflow.com/”,-1),LOCATE(‘-‘, substring_index(dp_ventes_par_segments.ref_article,”https://stackoverflow.com/”,-1)) – 1) as r, COUNT(*) FROM `dp_ventes_par_segments` LEFT JOIN dp_ventes_qty … Read more

Import struct from main package into another package in golang

I have two packages main and test. I’m working on test package and I need to import a struct that is decalared inside main package, but it seems to be impossible! This is my directory structure: root/ ├── test/ │ └── test.go ├── main.go └── go.mod go.mod: module my_project go 1.20 main.go: package main import … Read more

Mysql to Poatgre bit(64) data issue

I have a table in mysql & Postgre: CREATE TABLE IF NOT EXISTS ABC_bit64( PK bigint primary key, x bit(64)); and data for in mysql: PK |X | ——————-+—————————————————————-+ 7049900240000000001|-111011001001001000110011011010101110001001110100000000000000000| when we are trying to migrate the same data to Postgre(same table structure in postgre also), it throws below error: SQL Error [22P02]: ERROR: “-” … Read more

Get data and union with latest snapshot

I have a project for getting the 3 latest snapshots and union them. I have a total of 93 snapshots: For getting the latest snapshot (93), I use this code: DECLARE @CDP_DATE_CURRENT [varchar](50) = (SELECT MAX([CDP_DATE]) FROM [CD].[dbo].[abc]); SELECT * FROM [CD].[dbo].[abc] But how can I get snapshots 92, 91, and 90? As per the … Read more

Build was configured to prefer settings repositories over project repositories but repository ‘Google’ was added by build file ‘build.gradle.kts’

I’ve recently finished making my App and try to adding Ads to it by following this developers.google I added the Google’s Maven repository and Maven central repository in my top-level build.gradle.kts like this: / Top-level build file where you can add configuration options common to all sub-projects/modules. plugins { id(“com.android.application”) version “8.2.1” apply false id(“org.jetbrains.kotlin.android”) … Read more

The GET method is not supported for route api/customer/login. Supported methods: POST. in file

So I received this error in Postman when I tried logout function Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException: The GET method is not supported for route api/customer/login. Supported methods: POST. in file D:\Codes\Laravel\posdjuragan\vendor\laravel\framework\src\Illuminate\Routing\AbstractRouteCollection.php on line 122 AuthController.php <?php namespace App\Http\Controllers; // app/Http/Controllers/AuthController.php use App\Models\Customer; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Hash; use Illuminate\Support\Facades\Validator; use Laravel\Sanctum\Actions\CreateNewApiToken; class AuthController extends Controller { public … Read more

Nest js – Cors error about ‘access-control-allow-origin’

I’m currently developing a reservation system and the authentication I use is JWT and saving it in my cookie. However, I got a error about cors like this. guestinfo:1 Access to fetch at ‘https://localhost:4000/auth/login’ from origin ‘https://localhost:3000’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: The value of … Read more

Styling specific weekday head row in React Daypicker & shadcn/ui

I’m using shadcn/ui’s library for a project and it’s going pretty well so far. However, I have an issue with styling the inner parts of the Calendar component, particularly the weekdays head row. Out of the box, Shadcn’s Calendar component looks like this: I’m trying to style the calendar weekday head row into this: Basically … Read more