instruction stringlengths 0 30k ⌀ |
|---|
`rand()` generates a random integer. The range of this random integer depends on the implementation of the `rand()` function in your programming environment. Usually, it generates a random number between 0 and a large maximum value (such as `RAND_MAX` in C/C++).
(a + 1) is added as the right operand of the modulus o... |
Here is a way:
```r
library(shiny)
library(DT)
library(htmltools)
dat <- iris
js <- c(
"function(){",
" var $th = $(this.api().table().header()).find('tr:eq(1)').find('td:first');",
" var column = this.api().column(0);",
" var select = $('<select multiple=\"multiple\"><option value=\"\">... |
null |
Pytest runs all files of the form `test_*.py` or `*_test.py` in the current directory and its subdirectories.
More generally, it follows standard test [discovery rules][1].
[1]: https://docs.pytest.org/en/7.1.x/explanation/goodpractices.html#test-discovery |
{"OriginalQuestionIds":[6355787],"Voters":[{"Id":4108803,"DisplayName":"blackgreen"}]} |
I would like to understand if it is possible to parallelize the following nested loop (using OpenMP in Fortran).
To give some background information, I am doing this to initialize a sparse matrix. It turns out that the matrix-vector multiplication is very fast, thanks to the sparse BLAS library. The bottleneck in t... |
I have a set of constraints:
Lane(l0) == True,
Lane(l1) == True,
OnComingLane(l1) == True,
LaneMarking(m1) == True,
LaneMarking(m0) == True,
SolidWhiteLine(m1) == True,
SolidWhiteLine(m0) == True,
leftConnectedTo(l0, m0) == True,
Driver(v0) == True,
Vehicle(v1) == T... |
This should probably be considered an implementation detail of the `json` package, and also it might be a Python version thing. In any case, it becomes crucial with your implementation:
- The `dump()` function internally calls the `iterencode()` method on your encoder (see lines 169 and 176 [in the actual source cod... |
When testing the composite function using Vitest, I get the error
[enter image description here](https://i.stack.imgur.com/AQmKa.png)
in the function I simply declare
const redirectTo = useRouteQuery("redirectTo");
I would like to solve the problem with useRouteQuery |
# When the project had one data source, native queries ran fine, now when there are two data sources, hibernation cannot determine the schema for receiving native queries, non-native queries work fine.
**application.yaml**
```
spring:
autoconfigure:
exclude: org.springframework.boot.autoconfigure.jdbc.D... |
Problem with native queries when there are two data sources in the project |
|java|spring|postgresql|spring-boot|hibernate| |
null |
@Vaseltior's solution is good and worked for me. A slight change to not have to wrap the non-preview path, just put this at the top.
```
if [ $ENABLE_PREVIEWS == "YES" ]
then
echo "Skipping the script because of preview mode"
exit 0
fi
``` |
Interesting, I tried the following snippet and Stata 17 behaviour is the same as expected:
```stata
sysuse auto
browse mpg turn make length price if length>10 & rep78 == 2
```
This opens the editor with the varlist as specified in the command, not as ordered in the original dataset.
It would be helpful if y... |
The solution for the code is provided below:
import pandas as pd
df1 = pd.DataFrame({'user_id':['A','A','A', 'B','B','B', 'D','D','D', 'E','E'],
'Category':['ABC','ABC','ABC','ABC','ABC','ABC','XYZ','XYZ','XYZ','XYZ','XYZ'],
'counts':[3,3,3,2,2,1,2,1,2,2,2]})
def... |
# When the project had one data source, native queries ran fine, now when there are two data sources, hibernation cannot determine the schema for receiving native queries, non-native queries work fine.
**application.yaml**
```
spring:
autoconfigure:
exclude: org.springframework.boot.autoconfigure.jdbc.D... |
Running the following code:
```
#!/usr/bin/env perl
use 5.038;
use Test2::Mock;
use Time::HiRes;
my($mock) = Test2::Mock->new(
class => 'Time::HiRes',
override => [
gettimeofday => sub { return 1; },
]
);
my($foo) = Time::HiRes::gettimeofday;
say $foo;
```
results in this ... |
I have a list of elements. Each of them has a button. When you click on it, the description assigned to each element expands. Each element has a separate description.
Currently, when I click on the description, regardless of the element, it shows me the same description.
```
export class myComponent {
elements:... |
Goto:
1. Tool->SDK Manager and Apply SDK command line toolkit.
[![enter image description here][1]][1]
[1]: https://i.stack.imgur.com/8rhog.png |
If it is the initial value, then referencing its historical value will return `NaN`.
You can use `fixnan()` to replace `NaN` values with previous nearest non-NaN value, or `nz()` to replace `NaN` values with zeros (or given value) in a series.
Here is a demonstration:
//@version=5
indicator("My script... |
Hello I am trying to do the background action in react native. I already tested a lot of libreries and no one is not working.
Now I am trying to do background task using the Headless JS.
I am using React-Native-CLI
``` javascript
import React from 'react';
import {AppRegistry, Button} from 'react-native';
i... |
Headless JS is not working in React Native |
|react-native| |
null |
I have version 1.7.8.11 and I cannot select carriers in the payment preferences, they appear with a double dash instead of the checkbox.
[![enter image description here][1]][1]
[1]: https://i.stack.imgur.com/LT2ym.png
I have uninstalled the carriers several times and reinstalled them but there is no way. I a... |
You can even crawl it. Chrome also get `410` error code:
[![enter image description here][1]][1]
[1]: https://i.stack.imgur.com/L96ys.png
Continue your stuff like if it was `200` code.
-- Edit --
Look at this code it works well for your page :
```
$context = stream_context_create(array(
'ht... |
I'm trying to create this program and only developed a partial of the code and need help with the rest.
PROGRAM 6: Crazy 8s Game
Write a program that reads a set of three different numbers. Then by subtracting off tens, determine if any of the values ends in an eight. Continue looping as long as one of the number... |
Program 6 Crazy 8 Game |
|assembly|hla| |
null |
SwiftUI is smart enough to know which parts of the view need to be redrawn when observed data changes. So assigning an updated version of a `Post` object to the same index in the `posts` array, will only cause the views that depend on the changed data to be rerendered.
```
class PostManager: ObservableObject {
... |
I make two OOT block in gnuradio for udp tx/rx, with the itemsize 188 for input/output, rx block recieve udp ts stream and do packetFragmentation, and tx block do defragmentation then transmit udp stream to VLC, it and work success as the flowgraph below (ffmpeg -\> gnuradio udprx -\> gnuradio -\> VLC) :
 =
FirebaseAnalytics.getInstance(context)
|
|asp.net-core|visual-studio-2022|.net-8.0| |
You need to find all installed app from
HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall
Here is the sample code:
private string FindByDisplayName(RegistryKey parentKey, string name)
{
string[] nameList = parentKey.GetSubKeyNames();
for (int i = 0; i < nameList.Length; i... |
"Prototype mismatch" warning with Test2::Mock |
|unit-testing|perl|warnings| |
Use the below function instead to generate new poses. You can change it from random if you like to.
def random_camera_pose(radius=2.0):
theta = np.random.uniform(0, 2* np.pi) # theta is the angle with the z-axis
rot_z = np.array([
[np.cos(theta), -np.sin(theta), 0, 0],
[np.sin(the... |
`SecureRandom` initialises itself differently everytime you instantiate it. I.e., it will also create a different sequence of random values each time. Even if you initialise SALT with a fixed initial value, in the next step you overwrite it again by calling `random.nextBytes(SALT)`. Either don't do that or instantiate ... |
|python|python-3.x|python-multiprocessing|pydantic|multiprocessing-manager| |
I have figured it out, I used CardView inside of the ScrollView, which kept the images the same no matter the screen size. I also used a LinerLayout for my buttons so they would stay at the bottom of the image!
`<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.c... |
{"Voters":[{"Id":14991864,"DisplayName":"Abdul Aziz Barkat"},{"Id":2530121,"DisplayName":"L Tyrone"},{"Id":16217248,"DisplayName":"CPlus"}],"SiteSpecificCloseReasonIds":[13]} |
You may consider this solution that would with any version of `awk`:
```sh
printf '%s\n' "${arr[@]}" |
awk -F, '
{
for(i=1; i<NF; ++i) {
row[$i] = ($i in fq ? row[$i] ", " : "") $NF
++fq[$i]
}
}
END {
for (k in fq) print fq[k], k ":", row[k]
}' | sort -rn -k1
3 test: meta, amazon, ... |
You can always try compounding statements:
cb.sum(functionListToAdd.get(0), cb.sum(functionListToAdd.get(1), functionListToAdd.get(2))) |
I'm developing a MAUI app with .NET 8 targeting Android.
Everything works well with the default theme @style/Maui.SplashTheme in my **MainActivity.cs**.
But I need to edit the theme and add some configuration, because my **DatePicker's dialog** doesn't show well the dialog buttons (OK/Cancel):
[![enter image d... |
Checkbox not visible in restrictions by carriers in Prestashop 1.7 payment preferences |
|prestashop-1.7| |
I have a web site that has a fairly wide main menu of five items. This works fine on a desktop display, and on a mobile device this changes to have the menu displayed as a hamburger menu. However, on an iPad landscape display the full menu is displayed, messing up the UI.
In WordPress how and where do I set when a... |
(flutter doctor --android-licenses) when I write this code I get the following error
[[enter image description here]
(https://i.stack.imgur.com/euRv7.png)](https://i.stack.imgur.com/JO5KM.png)
I downloaded sdk command line tools and it still gives the same error
I also edited the system environment variables inst... |
I get a sdk error when trying to install flutter |
|android|arp|nt| |
null |
merge function in kaggel |
I am trying to use NextAuth (v5) with the MongoDB adapter following the documentation here: https://authjs.dev/reference/adapter/mongodb
I am using Node v 20.11.0
But I am getting the following error:
Server Error
Error: The edge runtime does not support Node.js 'stream' module.
Learn More: https://nextjs.o... |
Segmented picker in iOS - handle tap on already selected item |
|ios|swift|swiftui|picker| |
When I define a molecule with qiskit's PyscfDriver, it has a certain number of (spatial) orbitals. In this example, I define a NaH molecule and get an object with 10 spatial orbitals. I would like to reduce this number by reducing some orbitals from the active space. I intend to use the FreezeCoreTransformer as in
... |
When you want to use the `isEqualTo` operation to match a timestamp, you'll have to match the exact timestamp that is stored in the database. To make that feasible, you'll need to ensure that you store the timestamp with 0 milliseconds **and 0 microseconds** too.
For example:
```
DateTime now = DateTime.now();
Da... |
null |
I have a project in which i downloaded lidar 3D point cloud data from semantckitti. I want to perform Semantic Segmentation on the data using U-Net. I converted the 3d point cloud data into 2D using spherical conversion and saved the original point cloud data which was in (.bin format) into numpy arrays with dimens... |
How to input multi-channel Numpy array to U-net for semantic segmentation |
|deep-learning|point-clouds|semantic-segmentation|lidar|unet-neural-network| |
null |
I understand that your protocol interception handler recursively invokes itself because the `net.request` leads to another invocation of the same protocol. You could avoid this by inserting a special header that ends the recursion:
```js
if (req.url.includes("special url here") &&
!req.headers["x-request-interce... |
I use a COUNTIF function to count and increment the number of instances of an ID in excel.
Id_Treatment_Count ID
1 769334
1 769345
2 769345
1 769376
3 769345
In Excel, I would get the above using =COUNTIF($B$2:B2,B2)... |
My react app is running on **apache2** and is placed inside **cPanel's directory public_html**. My backend **nodejs server** is also inside the same public_html directory **but its running on linux**, My frontend works fine but its not fetching data from server. I have updated the virtualHost inside this direcotry **"/... |
Alma Linux 8 cant connect my react app with nodejs server |
|reactjs|node.js|linux|apache|deployment| |
null |
null |
null |
null |
null |
null |
im downloading a video and storing it using async storage and filesystem, i want to play that video by accessing it from async storage and using the path or the downloaded video, i want to play in expo av, it has an option of uri: videourl.
I also tried require but even that doesn't work. What else can i do?
trying... |
I'm downloading a video from its url that is coming from the server. Im downloading it locally and storage it in file system. How to play in expo Av? |
|expo|expo-av| |
null |
{"Voters":[{"Id":7177346,"DisplayName":"freeflow"},{"Id":6600940,"DisplayName":"Storax"},{"Id":8162520,"DisplayName":"Mayukh Bhattacharya"}],"SiteSpecificCloseReasonIds":[13]} |
I want to write a function that returns several configuration settings from a settings store. Settings can be of several types, some have parameters, some hold strings, some hold arrays like so:
```typescript
type StringSetting = 'outputPath' | 'fileName'
type StringSettingWithParam = 'emailAddress' | 'homeDirectory... |
How to solve OutOfMemoryError in Android Kotlin when reading large file? |
null |
I'm using nestjs with typeorm. For my audit log I have created typeorm subscriber but I cant able to inject my service in to it.
When I call the function from the service im getting error `TypeError: Cannot read properties of undefined` also when I do console `console.log(this.activityLogService);` in subscriber hoo... |
Nest JS TypeORM inject service |
|mysql|typescript|nestjs|typeorm| |
null |
I'm using ups API for tracking packages for many years now. Works fine.
Now I'm trying to get the Proof of Delivery image, but can't seem to find how to do this.
In the UPS PDF document there seems to be something called "Signature Tracking", but not a word on how to implement/call this signature tracking.
Up ... |
How to get Proof of Delivery Image via UPS API? |
|ups| |
IN MbedTls with RSA in a C-programm encryption/decryption works when using separate buffers (for plainText, cipherText, and decryptedText, i.e. the content of plainText and decryptedText is the same), but not when using just one buffer to perform in-place encryption/decryption as i get gibberish/not correctly encrypted... |
Strongly typed object output with same keys as input |
|typescript| |
The issue with your code is that you get the last message of the channel, which was sent by the bot.
A simpler solution would be to store the message ID, and use that ID to delete the message
```
@Override
public void onMessageReceived(MessageReceivedEvent event) {
event.getChannel().sendMessage(event.getJumpUr... |
Update:
You can simply use `(name ='')` as order by clause which will return 1 if name is empty other wise 0.
select * from comments order by (name ='')
If you have `null` as well then you can use:
select * from comments order by (NULLIF(name,'') is null)
Here `NULLIF(name,'')` will convert empty str... |
I'm not a fan of using `@Param <> ColumnName` syntax for something like this; if either value is `NULL` then this expression will resolve the UNKNOWN, which *isn't* TRUE, and so the row *isn't* affected. The more complete version would be:
```sql
WHERE (@Param <> ColumnName
OR (@Param IS NULL AND ColumnName IS N... |
On Windows, follow the steps below:
1) Windows button + R
2) type "services" and press Enter,
3) Find "MongoDb", right click and select "Start"
4) Go back to MongoDBCompass, and try again to connect to localhost. |
Sorry but I am new to Netlogo, here is my problem:
I have created polar bears, who have better chances to survive on ice than on dirt. I am wondering which effect the ice dirt ratio has on the lifespan of the polar bears.
For that I need a list of the polar bears age before they die and create a histogramm with it.... |
I need the age of my agents before they die to create a list and histogram |
|list|histogram|netlogo| |