instruction stringlengths 0 30k ⌀ |
|---|
I tried this approach:
function is_checkout_block() {
$page_to_check = wc_get_page_id ('checkout');
$content = get_post($page_to_check)->post_content;
return strpos($content, 'block') !== false;
} |
A couple faster options for getting the pairwise differences.
library(Rfast) # for `Dist`
f1 <- function(a) {
# from @jay.sf
b <- strsplit(a, '') |> do.call(what='rbind') |> `mode<-`('numeric')
dist(b, "manhattan") |> as.matrix()
}
f2 <- function(a) {
Dist(
... |
Currently, there is no official support for this. But I sometimes use a shell script to do this.
```
#!/bin/bash
DIRECTORY_TO_WATCH="<package-directory>" # provide the absolute directory
run_command() {
# Get the previous jvm PID and kill it
prevJPID=$(jps | grep '$_init' | awk '{print $1}')
... |
Lets say you wanna present AViewController
1. Simply use self.present(AViewController_object)
2. Use self.presentedViewController.present(AnotherController_object)
This way you actually present in a stack of one another
`self.presentedViewController` is the current controller who presented new controller |
Simply call this method to return your desired DateTime value in String.
String parseTimeStamp(int value) {
var date = DateTime.fromMillisecondsSinceEpoch(value * 1000);
var d12 = DateFormat('dd-MM-yyyy, hh:mm a').format(date);
return d12;
}
Example: if you pass the TimeStamp v... |
{"Voters":[{"Id":698744,"DisplayName":"RSH"},{"Id":9695286,"DisplayName":"Karan"},{"Id":2324154,"DisplayName":"Dan Mullin"}]} |
Hi my dataset is arranged like this:
[](https://i.stack.imgur.com/y95oe.png)
i want to calculate average scores of students arranged againsts state/district like in pivot table
i used the following code
```
piv = pd.pivot_table(df,
... |
lambda function inside pivot table |
|pandas|lambda|pivot-table| |
null |
I used the "create-next-app" to make my new Nextjs project. I selected tailwindcss in the installer, but when I try to run app with npm run dev, Ill get this error:
Module parse failed: Unexpected character '@' (1:0)
> @import 'tailwindcss/base';
| @import 'tailwindcss/components';
| @import 'tail... |
Typescript - transform an object of classes to a union type of these classes |
|typescript|generics|typescript-typings| |
I wanted to learn steganography in java and found a repo on github which seemed simple enough to learn from it: https://github.com/tigerlyb/Steganography-in-Java. I have a problem with the text embedding and extracting - For some reason some characters are incorrectly extracted. I can't figure out the mistake in code s... |
Java steganography wrong output |
|java|steganography| |
null |
Another alternative will be to use a previous version of angular like `17.3.0` since the error might be version specific!
---
Inside the form, the fields must have the two way data binding for `ngModel` for all elements of the form, maybe that is the cause of the issue
...
<div class="input-contai... |
<h2>Updated Answer</h2>
As all modern browsers have support for this now. Saving a large file can be performed as shown below. Using *application/octet-stream* as mime type forces a download.
The code uses window.open to trigger the download, which is blocked inside snippets. This should be used inside a click ev... |
null |
{"Voters":[{"Id":1136211,"DisplayName":"Clemens"},{"Id":3141792,"DisplayName":"BionicCode"},{"Id":397703,"DisplayName":"Richard Gale"}],"SiteSpecificCloseReasonIds":[13]} |
Currently, [rules_ispc][1] only supports the traditional `WORKSPACE` approach. I want to add Bzlmod support to this ruleset. When looking at other rulesets, such as [rules_ruby][2] the final usage of those rules could look like this in `MODULE.bazel` file:
```python
// add this to your MODULE.bazel file
bazel_dep(... |
je veut crée une application en Android studio qui jouent le rôle de recevoir tout les mouvement dans le partie électronique (RFID ,ARDUINO, ESP-01,buzer,led, lcd_I2C,et servomoteur) quand il y a une carte présente sur le RFID ,il y a une notification sur l'appk grâce a la module wifi ESP-01 , mais il y a aussi une bou... |
Recycler View is Not Showing Even After Adding Data in Array List & adapter.notifyDataSetChanged() |
|java|android|android-recyclerview|android-arrayadapter| |
|python|pytorch|model|jit| |
You can splice the concatenated values of the left and right columns.
The following should work:
```js
function concatenateColumns() {
const sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
let range = sheet.getDataRange();
const rows = range.getValues(); // Store a local copy
cons... |
Finally found out the solution as below.
```typescript
import * as session from 'express-session';
import * as passport from 'passport';
app.use(
session({
secret: process.env.SESSION_SECRET,
resave: false,
saveUninitialized: false,
cookie: { maxAge: 36000000 },
}),
);... |
I'm trying to run this [simple introduction to score-based generative modeling](https://colab.research.google.com/drive/1SeXMpILhkJPjXUaesvzEhc3Ke6Zl_zxJ?usp=sharing#scrollTo=8PPsLx4dGCGa). The code is using `flax.optim`, which seems to be moved to `optax` meanwhile (https://flax.readthedocs.io/en/latest/guides/convert... |
pmap was requested to map its argument along axis 0, which implies that its rank should be at least 1, but is only 0 |
|python|neural-network|jax|pmap| |
First you can do a connection test from your client.
tnsping UWBSDBPROD
If this was successful try to connect with sqlplus
sqlplus whatsappdb/whatsapp@orcl
or
sqlplus whatsappdb/whatsapp@10.70.236.30/UWBSDBPROD
If you can connect with sqlplus, than there is a problem with the Laravel configu... |
[Configure external volume][2] describes how to set up the external volume over the existing s3 buckets.
``` sql
CREATE OR REPLACE EXTERNAL VOLUME exvol
STORAGE_LOCATIONS =
(
(
NAME = 'my-s3-us-west-2'
STORAGE_PROVIDER = 'S3'
STORAGE_BASE_URL = 's3://MY_... |
You can pass the data using emit to the table component
In the modal component, define another emit. For that change this line
`const emit = defineEmits(["modal-close"]);`
to this here
`const emit = defineEmits(["modal-close", "submit"]);`.
Then define a function to emit this event and the data. Curre... |
I was working on some rust utilities for the [rust tree sitter bindings](https://docs.rs/tree-sitter/latest/tree_sitter/). Tree sitter essentially parses some code and creates an abstract syntax [`Tree`](https://docs.rs/tree-sitter/latest/tree_sitter/struct.Tree.html). This tree consists of [`Node`](https://docs.rs/tre... |
project using RFID and module ESP-01 connect in android studio |
|java| |
null |
>I can't create indexes with the data and documents uploaded using that deployed embedding model.
***if dataset is in a correct format, we can run the pipeline successfully please recheck the data and the documents with storage container connected.***
Here I also had deployed with my `text-embedding-ada-002` in t... |
null |
I am working on a small server monitoring script, and want to show a pop-up window to the user with a list of services once they are detected to be down. I tried sending this message with `C:\Windows\SysWOW64\msg.exe` but it just gives me a mysterious error message in the PowerShell terminal ("Invalid parameter(s)", I ... |
msg.exe prints "Invalid parameter(s)" |
|windows|powershell| |
`msg.exe` apparently only supports messages <= 255 characters in length. Use [`Popup`](https://learn.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/windows-scripting/x83z1d9f(v=vs.84)) instead:
```ps1
(New-Object -ComObject "Wscript.Shell").Popup("Popup Message", 0, "Popup Title", 0+48... |
**Short answer**: initialize FrmViewCollection.CollectionName in the eventhandler for [Form.Load][1]
**Longer answer**: in winforms separated the construction of a form from showing the form. This has the advantages that you can set properties after construction before the form is shown. Don't use public properties ... |
I am developing a feature in my web application that allows authenticated users to submit comments through a form. The frontend uses jQuery for AJAX requests, and the backend is built with ASP.NET Core. Despite the user being authenticated when loading the page, the AJAX request to the server does not seem to carry ove... |
I am switching from `mssql` (Tedious) to `mssql/msnodesqlv8`, because we need Windows Authentication support in our `Node.js` service.
However after switching, I run into the following issue.
We have a test that checks if there are no race conditions while getting a new id from the database. To make this operatio... |
- `Case: BE` is a literal string.
- `[0-9]` matches any digit from 0 to 9.
- `{8}` specifies that the preceding character (in this case, a digit) should be repeated exactly 8 times.
_Microsoft documentation:_
> [Find.Execute method (Word)](https://learn.microsoft.com/en-us/office/vba/api/word.find.execute?WT.mc... |
I use Laravel to develop backend. PHP dll files and necessary extensions have already been added to the `.ini` file. I use Wamp and PHP version 7.4.33. This is the part of `.ini` file.
```
extension=bz2
extension=curl
;extension=dba
extension=com_dotnet
;extension=enchant
;extension=ffi
;extension=ftp
exte... |
Can someone help me on this. I'm using personal access client to access an APIs in my project. I'm using 'Postman' to test the API but get "Unauthenticated." message i.e 401 errors. I have supply the right token in headers for Authorization i.e. Bearer bytoken.
This is my route :
Route::middleware('auth:api'... |
Laravel 10 - Passport - Personal Access Client |
|laravel|api|postman| |
{"OriginalQuestionIds":[7005644],"Voters":[{"Id":157882,"DisplayName":"BalusC","BindingReason":{"GoldTagBadge":"eclipse"}}]} |
I installed statsmodels using command prompt. Here is what it says when i write `pip3 list`in the command prompt : [](https://i.stack.imgur.com/ny9X8.png)
But when i run `import statsmodels as sm` in spyder, it says "no module named statsmodels".
... |
|javascript|reactjs|next.js|markdown| |
I can't find an example implementation of a logging interceptor for python that measures the time it takes to process a request.
I want to measure how long it takes to process a request on the server side. I tried to write my own logging interceptor without success.
It seems to me that `continuation` doesnt wait... |
Lifetimes and IntoIter in Rust |
|rust|treesitter| |
null |
So we're given this assignment to make a tic-tac-toe game with server-client architecture. My professor wants server to be built using raw sockets (even lower than tcp/udp) and client side to be browser. Is that even possible?!?!. [Assignment Spec](https://i.stack.imgur.com/8Fd6Q.png)
I know in the assignment spec it ... |
Browser connect to raw sockets even possible? |
|python|sockets|raw-sockets| |
null |
A `double**` is an pointer to one or more `double*`, so each row of doubles needs to be in a double array, and each of those separate arrays used as intializers to a `double*` array:
```py
import ctypes as ct
lst = [[1,1,1,1],[2,2,2,2],[3,3,3,3]]
# Equivalent to C double* array[3].
# Decays to double** when pa... |
{"Voters":[{"Id":4267244,"DisplayName":"Dalija Prasnikar"}]} |
I have been working on this tree in PysimpleGUI, suddenly the `insert` method decides to stop working when I give it a list full of data. I debugged nearly everything about it, the function `insert` itself stopped working or adding anything to tree data. Here is code
import PySimpleGUI as sg
... |
An empty line in latex denotes the start of a new paragraph, which is accompanied by a new line. If you don't want your two minipages to end up on two lines, then don't add an empty line between them.
Another problem is that the combined width of your two minipages is 1.47 times the width of a line. Their combined ... |
I need to bind (not authorize with) vkontakte account to user who already register and authorize,but I can't get the current auth user in handler.
This is my controller:
```
class VkAuthController extends Controller
{
public function index(Request $request)
{
if($request->token) {
... |
Passing an addition data to redirect Socialite vkontakte |
|laravel|laravel-socialite|vk| |
null |
|javascript|reactjs|material-ui|jsx| |
For the `conditionalPanel`, you are using a `condition` which relies on `input.wachtwoord_ingevuld`. However, `wachtwoord_ingevuld` is an `output` value which you calculate on the `server` side, not an `input` value.
Hence you have to rewrite your code using `output.wachtwoord_ingevuld`, see the example below which... |
Missing symbols when building UE 5.3.2 based project with libtorch dependency |
|c++|pytorch|unreal-engine5|libtorch| |
I have a table that looks like this:
```sql
Table
id int IDENTITY(1,1) {auto increament}
foreignKeyId int
autoId int {not unique}
```
what i want to have is making that `autoId` field auto increament based on the `foreignKeyId`, so when a row is inserted with lets say `fore... |
Can i create an auto increament field based on a foreign key value? |
|sql|sql-server| |
Assets in src/assets must be imported into the code to be included in the bundle.
You should use it like
// Importing an image asset into the code
import image1 from './assets/image1.webp';
// Using the imported asset
<img src={image1} alt="Image 1" />
If you just want static files to b... |
I am not able to install dbt-core=1.7.9
facing issue after
Successfully built logbook minimal-snowplow-tracker
then shows this message::
Installing collected packages: text-unidecode, pytz, pytimeparse, parsedatetime, logbook, leather, zipp, urllib3, typing-extensions, sqlparse, six, rpds-py, pyyaml, python-sl... |
AJAX Requests from jQuery to ASP.NET Core API Losing Authentication |
|jquery|.net-core|razor| |
null |
In my case,
package you_package_name
import android.content.pm.PackageManager
import android.view.View
import com.facebook.react.ReactPackage
import com.facebook.react.bridge.ReactApplicationContext
import com.facebook.react.bridge.ReactContextBaseJavaModule
import com.facebook.re... |
idx.get_level_values seems to be the fastest.
However, since MultiIndexes are iterables, an easy way would be to use zip:
out = list(zip(*idx))
Output: [('A', 'A', 'B', 'B'), ('C', 'D', 'C', 'D')]
As lists:
out = list(map(list, zip(*idx)))
# [['A', 'A', 'B', 'B'], ['C', 'D', 'C', 'D']] |
We have standard deployment of WSO2 API-Manager with LoadBalancer (HAProxy) with minimal configurations.
Configured/Published only one endpoint with one resource and configured OAuth2 for it.
Logs got flooded with following errors:
```
ERROR {org.apache.synapse.transport.passthru.SourceHandler} - I/O error: Con... |
I would like to call an API (Airflow - for monitoring) from elasticsearch like in this example:
https://www.elastic.co/guide/en/elasticsearch/reference/current/input-http.html#input-http-auth-basic-example
I need to:
1. fetch a list of items from API (/dags) having the specific label and then for each DAG from th... |
Elasticsearch - cascading http inputs from Airflow API |
|http|elasticsearch|airflow| |
We encountered the same issue when updating a legacy project depending on `gulp@3.9.1` to Node.js 12+.
These fixes enable you to use Node.js 12+ with `gulp@3.9.1` by overriding `graceful-fs` to version `^4.2.11`.
If you are using pnpm
--------------------------------------------------------
`pnpm` supports [ove... |
PySimpleGUI tree doesn't Insert data into tree |
|python|tree|pysimplegui| |
null |
I would recommend Bare React Native, Expo CLI is great for quick test projects, but Bare React Native is better for any real app you are developing for production. Pods, git, and Xcode all work much better with Bare React Native than Expo. Expo is nice and convenient to quickly get something going and many tutorials us... |
null |
Use the function
``` C
int set_memory_ro(unsigned long addr, int numpages)
```
use
`#include <linux/set_memory.h>` |
**Potential issue:**
If a Kubernetes Service account is specified within the pod manifest it must exist in the same namespace where the pod is being deployed.
```
spec:
serviceAccountName: KSA_NAME
```
**Diagnosis**
Inspect the logs using the below query at the time the issue happened
```
resource.... |
So, upon reading new updates in .NET 9, I got attracted to this section about Loop optimizations: https://learn.microsoft.com/en-us/dotnet/core/whats-new/dotnet-9/overview#loop-optimizations
As I understand, here's what they explained, consider this snippet of code
static int Sum(int[] arr)
{
in... |
DBT version 1.7.9 not able to install depedency packages |