instruction stringlengths 0 30k ⌀ |
|---|
I would go for a **lookup array** instead of programming edge-cases.
The reason for this is that when there are edge cases in data handling, you have to see if you can also solve it dynamically. So don't program it in the code. This makes your code less readable and less maintainable. Should (multiple) edge-cases b... |
This worked for me:
.mat-mdc-dialog-surface {
overflow: hidden !important;
}
I just have to inspect to find what style is the background that located overflow. |
I am trying to implement a cookie consent for a website that uses Google Analytics. How can I load Analytics only after the user agrees to the use of cookies? Or, is there another approach I should be taking?
I tried dynamically loading the GA script, but I get gtag undefined afterwards. |
Loading Google Analytics after the user consents to cookie usage |
I'm trying to implement manual authentication in Laravel. However, after entering the correct username and password on my login page, it doesn't redirect to the dashboard page; instead, it returns to the login page.
Controller:
```
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illumina... |
Basic manual authentication in Laravel 11 |
I'm trying to scroll my view to a specific component. I'm using refs to keep track of the components and I'm trying to call the scrollIntoView function to move to the specific ref. The problem I'm running into is that nothing happens when I try and put the call to scrollIntoView inside of a useEffect. The command works... |
Rsync fails with a network error when running via systemd as root |
|linux|rsync|systemd| |
In our case we just disabled SELinux and everything work just fine
not the best solution but it works for us
(We don't have anything else that run on that machine only rsync) |
I have several two-dimensional graphs, each of which has seven unique numerical characteristics that can be used to generate these graphs. I have the ```x``` and ```y``` coordinates of all these graphs, along with their numerical characteristics, in the form of a large number of CSV files. I want to predict the numeric... |
The regression problem of predicting multiple outputs from two-dimensional inputs |
|machine-learning|deep-learning|computer-vision|regression| |
You can use the `rn` ("Rename files in archive") command after you've created the archive:
7z.exe a -r D:\TEST.zip ROOT_FOLDER\*
7z.exe rn D:\TEST.zip ROOT_FOLDER ROOT
The `--help` flag gives you information about available commands:
7-Zip 19.00 (x64) : Copyright (c) 1999-2018 Igor Pavlov : 2019-... |
findAndUpdate not updating value in mongodb? |
|node.js|mongodb| |
I have written following function in jQuery:
<script>
function validateAppliesTo()
{
if ($("#collapseCat_row input:checkbox:checked").length > 0)
{
return true;
} else
{
swal({
title: "",
... |
try to rewrite you `AnyDTO` to:
type AnyDTO = { type: 'Type_A' } & A_DTO | { type: 'Type_B' } & B_DTO;
this way TS should treat `AnyDTO` with `Type_A` and `Type_B` differently.
Please note that you use types union `|`, which converts your interfaces to types, so, theoretically you could use `type` and not ... |
Try this:
self.flatten = nn.Flatten()
self.linear1 = nn.Linear(in_features=hidden_units*7*7, out_features=output_shape))
def forward(self, x:torch.Tensor):
x = self.block_1(x)
x = self.block_2(x)
x = self.flatten(x)
x = self.linear1(x)
return x
If you don't want to add fl... |
This is my `truffle-config.js`
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-js -->
require("babel-register");
const HDWalletProvider = require("truffle-hdwallet-provider");
require("dotenv").config();
module.exports = {
networks: {
... |
mutate(df1, across(everything(), mdy)) %>%
right_join(mutate(df2, Start = mdy(Start)),
by = join_by(Start <= Start , End>Start),
suffix = c('', '_y'))%>%
select(-Start_y, -Course)
Start End Learner
1 2023-10-01 2023-12-31 1
2... |
The raw data clearly shows the currency fields as text, with a $ character included and surrounded by blanks. If you open this CSV file with Excel, Excel will do some built-in interpretation of the values and translate a text containing a $ sign and numbers into a numeric value that it formats as a currency in the Exce... |
I try to install xlwings addin in a conda cmd, but getting this error:
```
>xlwings addin install
xlwings version: 0.29.1
FileNotFoundError(2, 'No such file or directory')
```
I downloaded https://github.com/ZoomerAnalytics/xlwings/releases/download/v0.11.4/xlwings.xlam as suggested here: https://stackoverflow.... |
I have an existing mobile automation framework with 1.x appium code written 7 months back.do we need to upgrade it to appium 2.x so that my scripts won't be failing?
Does Appium stopped supporting desired capabilities n touch actions class in appium 2.x which means since I have code with appium 1.x, my scripts will fa... |
Is it required to upgrade to appium 2.x from appium 1.x if the existing framework is developed in older appium version? |
|selenium-webdriver|mobile|automation|appium-android| |
null |
I have upgraded an ASP.NET MVC project, written in C#, using EF on .NET 4.7.2, to .NET 8.0
I get this error:
> The type or namespace name 'DirectoryServices' does not exist in the namespace 'System' (are you missing an assembly reference?)
I have tried to install `System.ServiceModel.Primitive` and it didn't w... |
Upgraded C#, ASP.NET MVC, EF project from .NET 4.7.2 to .NET 8.0 |
|c#|asp.net-mvc|.net-8.0|.net-4.7.2| |
You can use output option "-"
`
-i - -y -codec:a libmp3lame -b:a 128k -f mp3 -
` |
i got this after updating the plugin to 8.0.0 and the jdk to 17-
com.intellij.openapi.externalSystem.model.ExternalSystemException: Cannot convert string value 'UNIFIED_TEST_PLATFORM' to an enum value of type 'com.android.builder.model.AndroidGradlePluginProjectFlags$BooleanFlag' (valid case insensitive values: APPLIC... |
Serialization in .NET 9 offers more flexibility with customizable JSON output. You can now easily customize indentation characters and their size for more readable JSON files.
var options = new JsonSerializerOptions
{
WriteIndented = true,
IndentationSize = 4
};
string json... |
I'm struggling to find out how to create a flag. My data set looks like this:
```
CPT PRODUCT DATE A B C D etc.
1 A date1 . . . .
1 A date2 . . . .
1 C ... |
Creating a new flag based on multiple conditions on SAS |
|sas|multiple-conditions| |
null |
The `__str__` method should return a string representation of the object. In your case, it returns a tuple, which is incorrect. You need to format the output as a string:
class Card:
def __init__(self, color, number):
self.color = color
self.number = number
... |
I'm downloading a big model. I've changed to a new external data storage device which has a enough space with `export HF_HOME='\blah\blah'`. However when it comes to downloading that model, I get the following error, which appears like the checkpoint is not able to be stored:
OSError: [Errno 28] No space left on... |
Changing location of model checkpoints in Hugging Face |
|huggingface| |
I'm encountering a problem with the ShadcnUI components specifically on iPhone devices where the input zooms in when opening the page on mobile. This issue seems to affect the input behavior, particularly when the page is viewed on an iPhone.
I've attempted to resolve this by including the following meta tag in the ... |
Issue with ShadcnUI components causing input zoom on iPhone |
|html|css|reactjs|next.js| |
null |
Just like we open ***Visual Studio Code*** from command line by typing `code` (or `code .` to open VS Code with the shell's current working directory as the workspace folder).
What is the equivalent command we can use to open ***Visual Studio Code Insiders*** in the current directory?
|
I'm making an inpainting app and I'm almost getting the desired result except the pipeline object outputs a 512\*512 image no matter what resolution I pass in. I'm running this on the CPU, it's the onnx-converted, AMD-friendly version of stable diffusion.
Here's the code I think is relevant:
```
class Cust... |
Since, nobody answered this question, I write my own solution:
In `Sequelize` with `SQLite`, type checking is not enforced by default due to the nature of `SQLite`. However, you can add type validation at the `Sequelize` level.
Here’s an example of how to add a type validation for a `boolean` field:
```js
SOM... |
This is my code in my `+page.server.js`:
```js
export const actions = {
default: async ({request}) => {
const data = await request.formData();
const ln = data.get('lastname');
.....
}
};
export function load() {
if (!db) throw error(404);
return {
todos: db.... |
Using a form variable for filtering a database |
We are [splitting][1] the files into the component.vue, styles.scss and template.html, something like:
<script setup lang="ts">
// Common elements
import Category from '@/components/Elements/Category/Category.vue';
// COMPOSABLES
const localePath = useLocalePath();
// DATA
... |
I have the below pandas DF
[](https://i.stack.imgur.com/RZ7aM.png)
steps to create the DF
```
data=[['1','0','0','0','0'],['2','1','1','0','0|0'],['3','1','1','1','0|1'],['4','2','2','0','0|0|0'],['5','2','2','1','0|0|1'],['6','2','2','2','0|... |
Python Pandas getting hierarchy path till top management |
|python|pandas|dataframe| |
null |
When building pygame (2.5.2) with buildozer (1.5.0) on python (3.10.12) the error attached occurs.
It happens when building pygame for armeabi-v7a.
The command ran was `buildozer -v android debug`
I am following this tutorial: [https://www.youtube.com/watch?v=L6XOqakZOeA](https://stackoverflow.com)
```
fatal... |
Building pygame game with buildozer causes fatal error |
|python|android|build|pygame|buildozer| |
null |
In my R code I have a dataset where column "Groups" shows which observations belong to different groups. I would like to assign a unique color to each group. For example, I can then use these colors in a leaflet map. However, there is problem which I do not understand: when creating the colorFactor, some values get wro... |
React native ticker like non stop animation of images |
|reactjs|react-native|animation|react-hooks| |
null |
You should handle all of the drag drop events via HostListener.
Here is the code:
@HostListener('dragover', ['$event']) public onDragOver(evt: DragEvent) {
evt.preventDefault();
evt.stopPropagation();
}
@HostListener('drop', ['$event']) public onDrop(evt: DragEvent)
{
... |
I am trying to understand why pydantic validation fails here. I was running into this in larger codebase and was able to condense it into small example.
there is `misc_build.py` where pydantic model is defined
`metadata_manager/misc_build.py`
```
from pydantic import BaseModel
from md_enums import MiscBuildTy... |
I'm facing a weird issue not sure, it's related to ```scope``` or `async-await`.
Basically, I've a Background service (singleton), which is registered as:
```services.AddHostedService<JobBackgroundService>();```
the implementation, is simple as below:
public JobBackgroundService(
ILogge... |
|javascript|cookies|google-analytics|cookieconsent| |
null |
I've tried using container queries previously to resolve this but I needed the query to be aware of my React state as well, and I didn't think of the below method until just now. It allows the container query to be aware of state and lets you control everything from CSS, avoiding the double paint issue I had while doin... |
I have a weather app that refreshes asynchronously. While I've never seen it crash myself, I do see about a crash per day in Apple's reports, and not from a specific device. The app does have a good amount of users and it refreshes every few minutes, but I have no idea what kind of percentage send reports to Apple, so ... |
Occasional crash at NSURLSessionDataTask dataTaskWithRequest:completionHandler: |
|ios|objective-c|asynchronous| |
def swap(lst):
l=len(lst)
l2=list(lst)
l3=[]
if l<4:
for i in range(len(l2)):
if i+2<len(l2):
l3.append(l2[i+2])
l3.append(l2[i])
elif l>4:
l4=lst[:4]
l5=lst[4:]
... |
i am trying to make a flutter plugin for the first time i i ran into a problem.
I followed [this](https://docs.flutter.dev/packages-and-plugins/developing-packages) tutorial to set the project up, i opened the ```/example/android/build.gradle``` file in android studio and it loaded and it also opened the ```/android/s... |
Flutter plugin development android src not opening after opening example |
|android|flutter|android-studio|flutter-plugin| |
null |
This is well defined in the [`vectorize`](https://numpy.org/doc/stable/reference/generated/numpy.vectorize.html) documentation:
> If otypes is not specified, then a call to the function with the first argument will be used to determine the number of outputs.
If you don't want this, you can define `otypes` |
In your `dmhWebServer` constructor, you are not initializing the `abh` and `sharedFileSystem` members in the constructor's [member initialization list](https://en.cppreference.com/w/cpp/language/constructor), so the compiler tries to [default-initialize](https://en.cppreference.com/w/cpp/language/default_initialization... |
```
$ echo '1.2.3.4 - BlahA, BlahB, BlahC, 10.11.12.13 - BlahD, BlahE, BlahF, 250.251.252.253 - BlahG, BlahH, BlahI' | sed -r 's/[0-9]+\.[0-9]+\.[0-9]/\n&/g ; s/, *$//g'
1.2.3.4 - BlahA, BlahB, BlahC,
10.11.12.13 - BlahD, BlahE, BlahF,
250.251.252.253 - BlahG, BlahH, BlahI
```
The first sed command inserts ... |
Currently I'm reading the cell format from an Excel sheet using style.getDataFormatString(). My goal is to validate this format and extract the currency symbol from it.
As of now, this is the code (Java) and validations are failing for some currency symbols.
```
public static String getSymbol(String format) {
... |
Stable Diffusion pipe always outputs 512*512 images regardless of the input resolution |
|python|pytorch|onnx|stable-diffusion| |
null |
While installing **Visual Studio Code - Insiders** if you have added the path in the environment variable, then you can fire it from the command line by typing `code-insiders` right away.
The command is bit verbose/long and for which you may want to change it to `code-i` or `codi` for example. In order to rename the c... |
Steps to fix **[error 2147942402 (0x80070002) when launching `ubuntu.exe']** :-
Step 1 : Open command prompt. Then click on down arrow button then click on
settings.
[Click to see image][1]
Step 2 : Select Ubuntu from left panel. Click on Command line option.
[Click to see image][2]
Step 3 : C... |
{"OriginalQuestionIds":[27082001],"Voters":[{"Id":11002,"DisplayName":"tgdavies"},{"Id":286934,"DisplayName":"Progman"},{"Id":5646962,"DisplayName":"Thomas Kläger","BindingReason":{"GoldTagBadge":"java"}}]} |
This is what worked for me on Mac
* Open Visual Studio Code - Insiders.
* Open the Command Palette by pressing Shift+Cmd+P.
* Type "Shell Command: Install 'code-insiders' command in PATH" and select the option that appears.
* Restart terminal for the change to take effect.
Then `code-insiders` worked on the te... |
{"Voters":[{"Id":6752050,"DisplayName":"273K"},{"Id":12002570,"DisplayName":"user12002570"},{"Id":10686048,"DisplayName":"ChrisMM"}],"SiteSpecificCloseReasonIds":[13]} |
I believe your goal is as follows.
- You want to insert the checkboxes when all columns "B" to "D" have the values.
- You want to remove the checkboxes when one of the columns "B" to "D" doesn't have the values.
- You want to know the reason for the issue of `ReferenceError: row is not defined`.
### Modificatio... |
R, wrong matches between colors and values when defining colorFactor |
|r|colors| |
data: {
product_id: $(this).data('index'),
product_quantity: $('#select' + theproductid + ' option:selected').text(),
csrfmiddlewaretoken:"{{csrf_token}}",
action:'post'
},
why in product_quantity where i used option selected i have to put space before option ... |
why i have to put extra space in before write option selected because it show error if i don't ' option:selected' |
|javascript|django|ajax| |
I'm new to Unity3D. I've been going through all the tutorial materials. My question is how I should get started creating - or hopefully importing! - a 3D classroom scene or dojo (i.e. where people train martial arts) scene.
I should add a bit more info. My intention is to create a game within this setting/ambience,... |
I'm using Angular 7 for a system I'm building. And now i need to add an Undo/Redo feature to this application. What I'm looking for is, what are the best practices I should follow to do this? Do I need to use a state management library (NGRX, etc) for efficiency and maintainability? Or would following a simple pattern ... |
This appears to have been caused by my module-info.java file. it kept showing errors and I tried to fix them. ultimately I deleted it and the project works. I do not need modules in this small project. |
I would suggest to install Poetry with the specific Python version that you need via `pipx`.
Steps:
1) Uninstall `poetry`.
2) [Install `pipx`][1].
3) Install `poetry` with the needed Python version.
`pipx install --python python3.12 poetry`
5) Create new environments with `poetry` so that `pyproject.tom... |
I have to work with the learning history of a Keras model. This is a basic task, but I've measured the performance of the Python built-in min() function, the numpy.min() function, and the numpy ndarray.min() function for list and ndarray. The performance of the built-in Python min() function is nothing compared to that... |