Stack Overflow Questions
2,904 FOLLOWERS
Stack Overflow is the largest, most trusted online community for developers to learn, share their programming & technical knowledge, ask questions and build their careers. It is empowering the world to develop technology through collective knowledge.
Stack Overflow Questions
9h ago
Consider the following:
I have a database with Parents and Children. The Parent and Child tables both have a column called "Type". Each parent has a bunch of hundreds of children. I know ahead of time what children "Type" values I am interested in, but this is depending on the parent "Type" value.
So basically I want to create a construct like this and run it as part of the SQL.
var myQueryDatas = new[] {
new QueryData(){ParentType=1, NeedsChildTypes=new[]{101,142,105}}
new QueryData(){ParentType=2, NeedsChildTypes=new[]{106,110,120,232}};
I want to get Parent instances with populate ..read more
Stack Overflow Questions
9h ago
I'm trying to build a login using gatsby and I want to use a context to store the token and use it in other pages, the build was running fine before I added the context but once I added the context the build started to fail, the most confusing thing is that I get zero errors in development.
LoginForm.js
import React, {useContext} from "react";
import {Formik, Field, Form, useFormikContext} from "formik";
import * as Yup from "yup";
import PrimaryButton from "../Button";
import { Link, navigate } from "gatsby";
import FormInput from "./inputs/FormInput";
import ErrorMessage from "../ErrorMessa ..read more
Stack Overflow Questions
9h ago
I encountered this problem writing tests.
How to test that the exception ZeroDivisionError gets raised in the function:
def foo():
try:
res = 1/0
except ZeroDivisionError:
pass
This is an example modeling more complex use cases where the exception could be raised by some argument/external reasons but needs to be handled by the code.
import pytest
def test_foo():
with pytest.raises(ZeroDivisionError):
foo()
this does not work because the exception is handled by the except clause and not re-raised ..read more
Stack Overflow Questions
9h ago
I have a Blazor application which is type of WebAssembly hosted model, this is an extra option when creating a Blazor WebAssembly project though Microsoft Visual Studio.
This has an effect that there are three projects one client, one server and another one shared. The client is downloaded into the machine for rendering while server stays inside infrastructure to be able to execute server side services.
If this Blazor app is running on a pod inside a Kubernetes cluster and we identify that we need to scale out, scaling out this pod by increasing the replicas will be enough or do we need to c ..read more
Stack Overflow Questions
9h ago
I wrote myself an adjustable clock using a counter. The main clock is running at 200MHz and the adjustable clock can be set to 100MHz, 50MHz, 25MHz and so on. It is just for testing purposes and I want to keep it in my application along side with the possibility to run the main clock as the adjustable clock too.
module adjustable_clock (
input wire clk,
input wire [7:0] divisor,
output reg clk_out
);
integer counter = 0;
always @ (posedge clk) begin
counter <= counter + 1;
if (counter >= divisor - 1) begin
counter <= 0;
end
clk_out <= (counter ..read more
Stack Overflow Questions
9h ago
"I am developing a crash detection application and I am wondering if it is possible to include an automated voice feature when a call is initiated. Essentially, in the event of a crash, the app would automatically call the user's preferred contacts, and an automated voice talks asking for help if the user is unable to speak ..read more
Stack Overflow Questions
9h ago
I'm working on an existing c# application using Microsoft Visual Studio Professional 2022. In the debugger I can see:
Microsoft.Win32.RegistryKey rootPath = Microsoft.Win32.RegistryKey.LocalMachine.OpenSubKey("SOFTWARE\\CompanyName\\ConfigFiles");
if ( rootPath != null ) {
path = rootPath.GetValue("Root").ToString();
}
In the debugger when stepping over the call to OpenSubKey I can see that rootPath is returned as NOT null and it then makes the call to GetValue, however I've launched regedit as Administrator and I have looked for:
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\CompanyName\ConfigF ..read more
Stack Overflow Questions
9h ago
I have two bash scripts that execute some an awk script. It's supposed to filter out blocked users:
testawk.sh:
#!/usr/bin/bash
awk_script_file=$(cat << 'EOF'
$0 ~ "User " user ".* blocked"
{
print
}
EOF
)
# Run awk through bash to get file globbing to work
bash -c "awk -v user='${user}' '${awk_script_file}' ${file}"
testawk2.sh:
#!/usr/bin/bash
awk_script_file=$(cat << 'EOF'
$0 ~ "User " user ".* blocked" {
print
}
EOF
)
# Run awk through bash to get file globbing to work
bash -c "awk -v user='${user}' '${awk_script_file}' ${file}"
You can see that literally th ..read more