October 23, 2024
Chicago 12, Melborne City, USA
python

Call function within a function but keep default values if not specified

I have two sub functions that feed into one main functions as defined below – Sub function 1 def func(x=1,y=2): z = x + y return z Sub function 2 def func2(a=3,b=4): c = a-b return c Main function def finalFunc(lemons, input1,input2,input3,input4): result = func(input1,input2) + func2(input3,input4) + lemons return result How do i call

Read More
javascript

Fetch is only working when my chrome dev-tool is open why?

I’m encountering an issue where a fetch API call works perfectly when the Chrome DevTools are open, but fails when the DevTools are closed. I’m using React with the useEffect hook to fetch restaurant data from an API, and the problem only occurs when running the application without the DevTools. I’ve tried wrapping my fetch

Read More
pdf

In search of any NPM package which could add password to a pdf file or pdf buffer

I’m generating a PDF from html on a NODE Js backend and i also require to add a password to that file, let me know if anyone has used a particular npm package which could add password to a generated pdf or pdfbuffer. i’ve tried multiple packages like pdftk, qpdf2, pdf-encrypt but nothing worked as

Read More
templates

Issue calling a variadic template constructor

The following code doesn’t work, it fails because it cannot find a constructor with a <int, bool> signature. I know can’t specify explicitely the template parameters in the case of a constructor. Why does it fail template parameter deduction? Is there any way to make it work? I know I can use a template factory

Read More
security

How to securely store RSA private keys

I’m building a chat application which uses RSA encryption for the majority of its encryption needs. I’d like to allow users to log in from anywhere with a username and password, but this means the client doesn’t have immediate access to the private key, meaning it would need to be stored server-side. So my question

Read More
SQL

How to rewrite an nested IFF statement to oracle case when statement

How to rewrite the following nested IFF statement to oracle Case when statement . IIF(IN_RNK = 1, IIF(IN_SUM > 2,IIF(IN_MTR_COVERAGE_NUMBER_A = 'A','ORIGINAL BASE','ORIGINAL RIDER'),IN_MTR_COVERAGE_NUMBER_A), IN_MTR_COVERAGE_NUMBER_A) You need to sign in to view this answers

Read More
CSS

Why don't flex items shrink past content size?

Let’s assume having the following HTML: <div class="main"> <div class="header">Header</div> <div class="middle"> <div class="inner"> <p>Lorem Ipsum</p> <p>Lorem Ipsum</p> <p>Lorem Ipsum</p> <p>Lorem Ipsum</p> <p>Lorem Ipsum</p> <p>Lorem Ipsum</p> <p>Lorem Ipsum</p> <p>Lorem Ipsum</p> <p>Lorem Ipsum</p> <p>Lorem Ipsum</p> <p>Lorem Ipsum</p> <p>Lorem Ipsum</p> <p>Lorem Ipsum</p> <p>Lorem Ipsum</p> <p>Lorem Ipsum</p> </div> </div> </div> Let’s assume having the following CSS: .main {

Read More
C++

What replaces AES_set_decrypt_key and AES_unwrap_key in OpenSSL 3?

The AES_set_decrypt_key and AES_unwrap_key functions are deprecated in OpenSSL 3. I’m maintaining a function which uses them that I’d like to update to use non-deprecated functions: std::unique_ptr<uint8_t[]> rfc3394_key_unwrap(const uint8_t* key, size_t key_len, const void *input, size_t input_len, const void *iv) noexcept { AES_KEY aes_key; AES_set_decrypt_key(key, key_len * 8, &aes_key); const int output_len = input_len -

Read More
jQuery

Why can't I save notes in a multi-entry journal setup using jQuery and AJAX?

I’m working on a web application where users can maintain multiple journal entries on a single page. Each entry allows users to add notes through a Markdown editor. The problem is const notesContent = notesDisplay.find('.markItUp').val(); is returning null when it should be getting the content inside the textarea when clicking save full code: @foreach($notes as

Read More
Android

How are the default version of dependencies for an Android project determined?

What criteria are used to set the versions of the libraries that are automatically added to the dependencies when creating an Android project? like that dependencies { implementation("androidx.core:core-ktx:1.13.1") implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.8.6") implementation("androidx.activity:activity-compose:1.9.2") implementation(platform("androidx.compose:compose-bom:2023.08.00")) implementation("androidx.compose.ui:ui") implementation("androidx.compose.ui:ui-graphics") implementation("androidx.compose.ui:ui-tooling-preview") implementation("androidx.compose.material3:material3") testImplementation("junit:junit:4.13.2") androidTestImplementation("androidx.test.ext:junit:1.2.1") androidTestImplementation("androidx.test.espresso:espresso-core:3.6.1") androidTestImplementation(platform("androidx.compose:compose-bom:2023.08.00")) androidTestImplementation("androidx.compose.ui:ui-test-junit4") debugImplementation("androidx.compose.ui:ui-tooling") debugImplementation("androidx.compose.ui:ui-test-manifest") } I tried the following, but the version of the newly created project

Read More