Random snippets of all sorts of code, mixed with a selection of help and advice.
Calculating number of patches, patch sizes, and probability from epiphy::sadie output in R
5 December 2025 @ 4:33 am
I'm using the epiphy package output (object sadie_d1) to investigate spatial patterns of diseased plants. The summary(sadie_d1) returns clustering indices and permutation results, but it does not provide:
patch sizes
number of patches
p values for indices of clustering for patches and gaps.
This the output I have:
Call:
sadie.data.frame(data = d1[, c("x", "y", "infected_plants")],
nperm = 999, threads = 2)
First 6 rows of clustering indices:
x y i cost_flows idx_P idx_LMX prob
1 1 1 1 -1.984876 -1.1957035 NA NA
2 1 2 3 -1.368189 -1.1349948 NA NA
3 1 3 4 1.000000 0.8133815 NA NA
4 1 4 5 1.000000 0.7113903 NA NA
5 1 5 2 -1.045661 -0.6927521 NA NA
6 1 6 5 1.000000 0.6742557 NA NA
Summary indices:
What replaces the deprecated page.type method in playwright?
5 December 2025 @ 4:30 am
The deprecated page.type(selector, text, options) method has been replaced by page.keyboard.type(text, options). In most cases, you'll want to use locator.fill when typing, but sometimes this doesn't work and you need to manually send text directly into the page. For these edge cases, page.keyboard.type is not deprecated as of December 2025 and can be used safely.
TypeScript:
await this.page.keyboard.type('Hello, Playwright!');
Java:
page.keyboard().type("970-867-5309");
Python:
page.keyboard.type("Goodbye, Playwright!")
How to detect Spark application failure in SparkListener when no jobs are executed?
5 December 2025 @ 4:28 am
I have a class that extends SparkListener and has access to SparkContext. I'm wondering if there is any way to check in onApplicationEnd whether the Spark application stopped because of an error or exception in the logic, or if the application simply completed all its processing.
I'm looking for a solution that doesn't require any changes to the Spark job code.
Context:
I'm one of the committers for OpenLineage. Its integration for Spark uses OpenLineageSparkListener, which implements the following methods: onApplicationStart, onApplicationEnd, onJobStart, onJobEnd. Based on the information from the objects in these methods and some context, we emit OpenLineage messages.
The problem is that while jobs have a success/failure status, the application itself doesn't.
For
WooCommerce How to Display Stripe Based on PostCode
5 December 2025 @ 4:20 am
In WordPress 6.9 version and WooCommerce version 10.3.6,
I want to display the Stripe based on the shipping zone.
Shipping zone 1 consists of Post code 3000
Shipping zone 2 consists of Post code 4000.
ex:
Post Code 3000 should display Stripe.
Post Code 4000 or any other postcodes should hide Stripe.
Currently, I am using woocommerce_available_payment_gateways webhook to display.
add_filter('woocommerce_available_payment_gateways', 'payment_gateways_based_on_chosen_shipping_method');
function payment_gateways_based_on_chosen_shipping_method($available_gateways)
{
$shouldReturnAll = true;
if( is_checkout() && ! is_wc_endpoint_url() && WC()->cart ) {
$shouldReturnAll = false;
}
if($shouldReturnAll){
return $available_gateways;
}
$chosen_shipping_methods = (array) WC()->session->get('chosen_shipping_methods');
$insideSelectiveDe
sudo ubuntu-drivers autoinstall fails due to missing dependencies for nvidia drivers
5 December 2025 @ 4:20 am
Unfortunately, I recently broke my installation of NVIDIA drivers and so I had been purging them for reinstallation. However, after purging, running sudo ubuntu-drivers autoinstall raises an error about missing dependencies.
After installing the listed dependency, the same error still shows up.
More explicitly, the process for purging and reinstalling nvidia packages was as follows:
sudo apt remove --purge nvidia-* cuda-* libnvidia-*
sudo apt autoremove
sudo apt autoclean
reboot
sudo ubuntu-drivers autoinstall
The final step yielded the error
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
linux-modules-nvidia-580-open-6.
For loop skipping the last index in each row of my 2D list
5 December 2025 @ 4:01 am
Basically what i'm trying to do is loop through the whole list and have each "-" symbol be replaced with a number that indicates the number of "#" symbols next to them similar to minesweeper with this being the code i'm using to perform the horizontal check.
It sort of works but for some reason it skips the last index in a row (the far right side) and I can't figure out what i'm doing wrong with it. At first I thought it might be the -1 I added to the second for loop but I get an error saying it's out of range when I do. I also tried seeing if it might have had something to do with the conditional statement to skip over the hash symbols but I was still having the same issue.
board = [["-", "#", "-"],
["#", "#", "-"],
["-", "-", "#"]]
for row in range(0, len(board)):
for col in range(0, len(board[
Forcing A Web Page To Reload From The Server When Accessed
5 December 2025 @ 3:53 am
On my website, morikoboshi.com, I regularly update many of the pages. On certain pages, I'd like them to load from the server each time, not from the cache. I'm looking for the new content, not the previous content, to be loaded each time a page is accessed.
Would the following code be an effective way to do this?
<meta http-equiv="Cache-Control" content="no-store, no-cache, must-revalidate">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="0">
Any advice would be much appreciated.
How to Generate a Zip with password in flutter | dart
5 December 2025 @ 3:43 am
Which package dependency is best for generating zip file protected with password in flutter (dependency site: pub.dev, file: pub.yaml). I used archive, flutter_archive, native_zip but all of them does not supporting the password protected zip file generation. They only give zip file and making it accessible by anyone.
MATLAB scatteredInterpolant: Why are input points not returned exactly (Approximating vs. Exact)?
5 December 2025 @ 3:28 am
I have a math question, not really an antenna or electronics question, though knowing a little about antenna arrays might help in thinking about the question. Mainly that antenna arrays are often designed to focus energy in a particular direction, but they are not perfect and have lower levels of energy which spread throughout a sphere or hemisphere.
The Goal: I am interpolating a set of 106 2D Radome Loss Factor (RLF) maps to 19,440 RLF maps at new beam pointing directions. This is essentially scattered data interpolation using the (Theta, Phi) look angles as the independent variables (X, Y), and the RLF map values as the dependent variable (Z). I can increase the 106 directions to 212 because the results are symmetrical over the "center axis." This creates a dense output (360 Phi directions x 54 Theta directions).
The Problem (Lack of Exactness): If I query the interpolant
long wait of BrowserContext.new_page
5 December 2025 @ 3:25 am
After running the test on playwright+ pytest, the browser opens immediately, but then the page is blank for 18-25 seconds. Based on the traces, I realized that the entire time was spent processing the BrowserContext.new_page which is base method of PW. What could be wrong?enter image description here