instruction stringlengths 0 30k ⌀ |
|---|
Find the largest numer for array after operation |
|java|algorithm| |
```
static ArrayList<Integer> LinearSearch(int[] arr,int index,int target) {
ArrayList<Integer> iList = new ArrayList<>();
if(index == arr.length){
return iList;
}
if(arr[index] == target){
iList.add(index);
}
ArrayList<Integer> temp =... |
Advanced SQL will include Basic and **Tansact** SQL
Part 1: Basic Selection Queries
Part 2: Aggregate Functions SQL
Part 3: String Functions SQL
Part 4: Conditional Queries
Part 5: Combining Data Queries
Part 6: Window Functions
Part 7: Ranking Functions
Part 8: Data Insertion ... |
null |
i am trying to get application context for showToast but not able to get it here is my kind, kindly help
```
package com.coding.APPNAVIGATION.MenuAndNavigationDrawer.Utils
import android.app.Application
import android.content.Context
open class MainApplication : Application() {
override fun on... |
lateinit property appContext has not been initialized to get Application Context for ShowToast |
|android|kotlin|android-studio|kotlin-multiplatform|gradle-kotlin-dsl| |
null |
I'm codding an app that open json file and according it content fill interface with grid of squares. Base UI I made in QT Designer and it looks like that.
[![enter image description here][1]][1]
Everything worked good. And I wanted make improvement, such as adjust width window according to content. And after that U... |
Adjust window size according content in QScrollArea in PyQt6 |
|python-3.x|qt-designer|pyqt6| |
i am trying to get application context for showToast but not able to get it here is my code, kindly help
```
package com.coding.APPNAVIGATION.MenuAndNavigationDrawer.Utils
import android.app.Application
import android.content.Context
open class MainApplication : Application() {
override fun on... |
My answer is not the exactly the solution you are looking for, but it solved mine.
I wanted to do the same thing you want because when I retrieved the url of a video in minio, the url with docker service name did not work on the local browser.
I could not find a way to make it localhost, but I realized the servic... |
You can create a global variable `let app = {...}` and store all program data in there (this is how I usually organize programs). Then, store the state of your items under `app.data.checkboxState` or somewhere like that.
Below is an example program showing how to apply that:
<!-- begin snippet: js hide: false con... |
The official Interactive Brokers API is only offered through their Github site and not the Python Package Index (PyPI) because it's distributed under a different license. You can however build a wheel from the provided source code and then install the wheel. These are the steps, follow them precisely for the most updat... |
If you want a dark border followed by a lighter border, then
use `static let dark_blue_2 = Color.blue.opacity(0.3)` and
add `.padding(4)` after your `.stroke(ThemeColors.dark_blue_2, lineWidth: 8)`
to adjust the location of the inner lighter border as shown in the example code:
struct EventMatcherCardBo... |
In svelte I had same issue and solved by destroying chart with onDestroy
import { onDestroy } from 'svelte';
onDestroy(()=>{
chart.destroy();
}); |
Endeavor to both TRIM and apply IN and OUT fades to a number of MP3 files using ffmpeg. Specifically trimming off a [400mS] length from the start, followed by a [400mS] fade up to full volume, then a [400mS] fade down at the conclusion of the recording. My obstacle is making the fade out function correctly.
Have em... |
I've been reading about Linux's various `SCHED_*` scheduling algorithms (which can be specified for a given thread/process via a call to [sched_setscheduler()][1]), and there is a good amount of information about how they work, but I haven't been able to find much about why each of them was created.
For example ther... |
I have a GitHub action that does a conditional execution of a job where it builds and runs the tests for a project only if there was a change in one specific directory of the code. Seems like a common thing to do. I used this as a reference: https://github.com/marketplace/actions/paths-changes-filter
**Problem** it... |
One of the components (PartSlot) in my project is rendered active or inactive based on one of the props it receives. It influences component's style, animations and behaviour, and while style and onClick tags do accept new values when prop isActive changes to `true`, the animations don't start working.
Animations wo... |
What are the motivating use-cases for each of Linux's SCHED_* scheduling algorithms? |
|c|linux|scheduling| |
I have the following problem:
I have the URL to a picture 'HTTP://WWW.ROLANDSCHWAIGER.AT/DURCHBLICK.JPG' saved in my database. I think you see the problem here: The URL is in uppercase. Now I want to display the picture in the SAP GUI, but for that, I have to convert it to lowercase.
I have the following code fro... |
While both other answers show valid solutions, I believe both the question being asked and the two solutions somehow miss the point of using `Layouts`.
Basically, `Layouts` are made to bring together `Items` that have an implicit size (`implicitHeight`/`implicitWidth`). `Layout.preferredWidth`/`Layout.preferredHeigh... |
Framer Motion animation not working after state change |
|reactjs|frontend|framer-motion| |
Found the answer – you have to set up Ngrok first https://developer.atlassian.com/platform/forge/tunneling/?_ga=2.206551187.129054678.1710258805-1599633662.1710258805#providing-credentials-for-ngrok |
I am attempting to create an incremental counter in an ID column based on several conditions being met in 2 other columns and then "resetting" those conditions being met to ascertain the next increment of ID. This is time series data so order does matter (I have not included the time stamp column).
I will... |
|omnet++|inet| |
My data is instrument reads and instrument baselines. The baseline data is punctual and typically does not extend to the "ends" of the dataset (i.e. first and last rows). Therefore i want to make a function that looks at the baseline column, and copies the values of the earliest and latest baselinepoints to the very f... |
How do i properly refer to data.frame cells in functions |
|r|dataframe|function|cell| |
null |
Not sure if this is still relevant but for those that land here... I was facing the same issue.
Here's the solution: `https://graph.facebook.com/v19.0/{creative_id}?fields=object_story_spec&access_token={access_token}`
A good way to go about it is:
1) Get the list of your creative ids: `https://graph.facebook... |
null |
It can be done in single animation starting at "`0` rotation" without stacking and without negative delay, and you were pretty close to that. (Welcome to SO, by the way!)
You just had the easing functions set one frame later, but the progression (`ease-out` - `ease-in-out` - `ease-in`) was correct.
For the POC de... |
This is initially a JS project from free code camp, but to put it on my portfolio website, I want to make it interactive.
I have tried setting the variables to state and being passed down through props, but the variables will only but initially mutated once, and the display will not update further than that. Here is... |
A compact solution: *array_walk()* processes every row of the main array, the callable receives the sub-array as reference, removes the last element, calculates the product of all remaining elements using *array_reduce()* and assigns it as the last element of the sub-array.
```php
<?php
$mainArray = [
[4, 3... |
### `Point` class
Let's start with a point class, in proper Java style:
```java
class Point {
private int[] components;
public Point(int... components) {
this.components = components;
}
public int getDimension() {
return components.length;
}
public int getComponent... |
I'm trying to call .ToString() on the editor to get the friendly text for a rule. Either I'm not configured correctly or perhaps there's a bug, hence why I'm reaching out.
When calling .ToString(), the result looks like:
**Check if Products contain and Medical.NetworkType_BuiltInNetwork is "Y"**
However, it sh... |
Calling .ToString() on editor not returning enum name |
|rule-engine|business-rules|codeeffects| |
null |
As far as I know and read the official documentation, updates will only be triggered if the value is different.
> The set function that lets you update the state to a different value and trigger a re-render.
However, after my testing in version 18.2, there is a situation that triggers repeated rendering.[enter ... |
I have 4 storage class variables that are set by default to false , then set one of them in inputs to "true" . Looking for a way to validate that only one of 4 storage classes variable is set to "true".
variable "sc1_default" {
default = "false"
}
variable "sc1_default" {
default ... |
Terraform valdiate that one of N variables is set to "true" |
|validation|terraform| |
```
x = c(1, 2, 2, 3, 3, 3, 4, 4, 5)
x.tab = table(x)
plot(x.tab, xlim = c(0, 10), xaxp=c(0, 10, 10))
```
(Unfortunately, I do not have enough reputation to post image, but received graph has only tick marks 1 to 5, instead of intended 0 to 10)
Why does R just ignore xaxp? I understand that I could factor x t... |
The suggestion you've received above is a good starting point. It gives a high-level overview of the task at hand, the deep learning approach to take, and touches on the need for labeled data. However, there are additional insights and details that could help clarify the path forward and provide a more actionable guide... |
please help
Bad PCD format error
I would like to know whats wrong with PCD file.
I have given the header to the PCD file
header = "# .PCD v.7 - Point Cloud Data file format
VERSION .7
FIELDS x y z data
SIZE 4 4 4
TYPE F F F
COUNT 1 1 1
WIDTH 0
HEIGHT 1
VIEWPOINT 0 0 0 1 0 0 0
POINTS 0
DATA bin... |
Analyzing data: PCD file. Problem: Bad PCD format |
|python| |
null |
I assume that you have table something like that:
CREATE TABLE OCCUPATIONS (
Name VARCHAR(255),
Occupation VARCHAR(255)
);
SELECT CONCAT(Name, '(', LEFT(Occupation, 1), ')')
FROM OCCUPATIONS
ORDER BY Name;
SELECT CONCAT('There are a total of ', COUNT(*), ' ', LOWER(Occu... |
Why does useState trigger rendering with the same value |
|javascript|reactjs|react-hooks| |
null |
Make sure to have angular.json in the folder where you try to build serve etc.
Maybe it's one level up because of a misplaced npm install. |
I'm migrating from `or-tools` to Google's Cloud Fleet Routing API (Optimization AI API). So far, the client libraries are not the best, nor do they have good documentation. Looking through the REST documentation (https://cloud.google.com/optimization/docs/), it's very unclear to me how I add reload points to offload ca... |
what I want is to make the TextPanel disabled if `payStub` has a value, and not be disabled if `payStub` does not have a value,
In my react code, I have the following:
const [payStub, setPayStub] = useState(() => {
if (isNewPayStub) {
return get(user, 'stub', '')... |
Ideally you should follow the answer by @Leeroy Hannigan, But if you just have to get your version working, I just created a function (with nodejs18) in AWS console , renamed file from index.mjx to index.js and copy pasted the below code, I was able to get past the error you have described(changed exports.handler in yo... |
Well after 4 hours I realised I was missing the semi colon at the end of the <Text> ....Expense Screen</Text> for each of them. |
I've written a unit test to limit a methods line count, but its reporting back incorrect results and failing for everything?
I may not have got some of the math right or detection and was wondering where I went wrong?
I'm looping through all *.cs files, then through each line, marking the start of a method (decla... |
Limiting method length? |
|c#| |
{"Voters":[{"Id":4712734,"DisplayName":"DuncG"},{"Id":466862,"DisplayName":"Mark Rotteveel"},{"Id":1431,"DisplayName":"Juha Syrjälä"}]} |
I am scraping messages about power plant unavailability and converting them into timeseries and storing them in a sql server database. My current structure is the following.
* `Messages`: publicationDate datetime, messageSeriesID nvarchar, version int, messageId identity
The primary key is on `(messageSeries... |
Unable to install ‘audio.whisper’ package from GitHub in RStudio despite correct Rtools installation |
|openai-whisper|rtools|remotes| |
null |
I’m going to recommend a slightly different approach that I think gets at the functionality you are looking for.
First, as noted by others, an interface is a Typescript language feature not a Javascript language feature. It’s used for static type checking during compile time, and that’s ir; there is no object or cl... |
I want to click on the checkbox. Tried different methods. But not working. Any solution?
@FindBy(xpath="//label[@for='Tnc']")
Still its not getting the exact element of check box. Instead it is clicking on the Terms and Coniditions hyperlink and opening the pop up page.
I wanted to click on the Chcekbox. |
Not able to identify the checkbox element ::before and ::after in Selenium |
|java|selenium-webdriver|pseudo-element| |
null |
I'm trying to use a constexpr constructor in C++17 with a lambda that uses `std::tie` to initialize fields in a class from a tuple.
The code is similar to this:
```
#include <tuple>
enum class Format {
UINT8,
UINT16
};
struct FormatInfo {
const char* name = nullptr;
int maxVal = 0;
... |
Using lambda function in constexpr constructor |
As far as I know and read the official documentation, updates will only be triggered if the value is different.
> The set function that lets you update the state to a different value and trigger a re-render.
However, after my testing in version 18.2, there is a situation that triggers repeated rendering.[enter ... |
Well after 4 hours I realised I was missing the semi colon at the end of the Text component for each of them. |
After updating to version 5.10.2 as suggested by Filip I was getting an PackageReferenceId error which later on was addressed by creating new protected containers first then adding the data instead of just passing arrays to them. The code below is a little more detailed than what is available in github:
require_... |
null |
I am new to Docker, and I have the Dockerfile below which Azure Pipelines is using to build an image and push it to an Azure Container Registry.
// Dockerfile
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS... |
test Stage is Being Skipped |
|azure-devops|dockerfile| |
To work with an `SDDL` (Security Descriptor Definition Language) you first need to know the structure.
From [MS Learn - Security Descriptor String Format](https://learn.microsoft.com/en-us/windows/win32/secauthz/security-descriptor-string-format)
> The format is a null-terminated string with tokens to indicate ea... |
Is it possible to do some recursion(?) in typescript to call same Columns type but with different generic type N instead of T? Please consider example below.
```
type Column<T> = {
render: (item: T, rowIndex: number) => React.ReactNode;
};
```
**Generic Type N here is only for example purposes.** I want to t... |
SQL Server Data Model and Insert Performance |
Your output:
```lang-none
this is thread 1
this is thread 2
main exists
thread 2 exists
thread 1 exists
thread 1 exists
```
Before I see that *"it prints "thread 1 exists" twice."*, I see that it prints after "main exists": This behavior can lead to unpredictable results.
--
First, you should array y... |
{"OriginalQuestionIds":[63808813],"Voters":[{"Id":16791505,"DisplayName":"Paolo"},{"Id":17562044,"DisplayName":"Sunderam Dubey"},{"Id":1431,"DisplayName":"Juha Syrjälä"}]} |
I currently work on a chrome extension designed to scrape pdf files from specific websites, modify them (splitting them in multiple file, remove sensitive information from them etc.) and rendering them on the fly. For this I want to use pdf-lib for the pdf manipulation and pdfjs-dist for rendering. I use webpack to bun... |
Importing pdf.js in a chrome extension setting: "Uncaught SyntaxError: Unexpected token 'export'" |
|webpack|google-chrome-extension|pdfjs-dist| |
null |
I am working on a microservice application developed in C# ASP.NET Core targeting .NET 6.0 framework. During security checks on my application, the security team identified an issue regarding "Improper Error handling."
The recommendation from the security team is that the application should not expose any detailed e... |
**Resolved: Docker build error "failed to solve: the Dockerfile cannot be empty"**
After further investigation, I realized that the issue was caused by not saving the changes made in my code editor (VS Code) before attempting to build the Docker image.
It turns out that the Docker build process requires the Dock... |
I have the following problem:
I have the URL to a picture 'HTTP://WWW.ROLANDSCHWAIGER.AT/DURCHBLICK.JPG' saved in my database. I think you see the problem here: The URL is in uppercase. Now I want to display the picture in the SAP GUI, but for that, I have to convert it to lowercase.
I have the following code fro... |
{"Voters":[{"Id":340478,"DisplayName":"6006604"},{"Id":466862,"DisplayName":"Mark Rotteveel"},{"Id":1431,"DisplayName":"Juha Syrjälä"}]} |
Hi I've found a Pine Script V5 indicator that loops through a list of csv price levels input by the user & plots horizontal lines. Is it poss to set an alert at the point of plotting each level in the loop to alert me when price crosses each level? TIA
Pine Script V5 - In my loop of setting a horizontal line, tried ... |