Random snippets of all sorts of code, mixed with a selection of help and advice.
Using Chainlink VRF on Ethereum Mainnet with an already deployed Proxy contract
10 November 2025 @ 3:28 pm
We need to use the Chainlink VRF (fullfillRandomWords) with a contract that's using a Proxy.
Here is our contract: https://etherscan.io/address/0xdaafb1e51517920cf42da549f83a190a8f6a194b
Your support through the Discord channel has confirmed that our request was sent correctly. The issue happened when your VRF tried to fulfill our request (https://etherscan.io/tx/0xf6176b08f9abc0038e4c76fa1662acc68ea6f8d3177198aa618b9e9044799f8d)
We've received feedback to look into the documentation (https://github.com/smartcontractkit/chainlink/blob/contracts-v1.3.0
How do I programmatically get the file size of a file when selected from the file browser on your Android phone?
10 November 2025 @ 3:24 pm
I'm using this code to select a file from the file browser on my Android app:
activityResultLauncher = registerForActivityResult(
new ActivityResultContracts.StartActivityForResult(),
result -> {
if(result.getResultCode() == RESULT_OK && result != null)
{
profileAddIV.setEnabled(false);
progressBarProfileImage.setVisibility(View.VISIBLE);
ExecutorService executor = Executors.newSingleThreadExecutor();
Handler handler = new Handler(Looper.getMainLooper());
executor.execute(() -> {
boolean hasError;
Uri uploadfileuri = result.getData().getData();
InputStream inputStream = null;//You can get an inputStream using any IO API
File file = new File(result.getData().toString());
int fil
ngx-extended-pdf-viewer fails to load after clicking button in Angular popup
10 November 2025 @ 3:21 pm
I’m using ngx-extended-pdf-viewer in my Angular project to display a PDF inside a popup (modal).
The viewer works fine initially, but when I click the button to open the popup, it fails to load or throws an error.
TableView doesn't stretch in VBox in JavaFX
10 November 2025 @ 3:16 pm
I have two TableView in a VBox. I need the first one to grow and take all available space, while the second one should not expand. This is my current code:
public class TestFx extends Application {
@Override
public void start(Stage primaryStage) {
ObservableList<TestItem> data1 = FXCollections.observableArrayList();
ObservableList<TestItem> data2 = FXCollections.observableArrayList();
for (int i = 1; i <= 30; i++) {
data1.add(new TestItem("Item " + i, "Value " + i));
}
for (int i = 1; i <= 5; i++) {
data2.add(new TestItem("Item " + i, "Value " + i));
}
TableView<TestItem> table1 = createTable("Type Table (30 rows)", data1);
TableView<TestItem> table2 = createTable("Base Table (5 rows)", data2);
VBox container = new VBox();
VBox.setVgrow(t
String not recognized as a valid DateTime
10 November 2025 @ 3:14 pm
I'm receiving this date and time in US format from an upstream server I have no control over and can't change: 12/16/2024 11:30:23 AM
I am trying to convert it to UK format using PowerShell:
[DateTime]::ParseExact('12/16/2024 11:30:23 AM',"dd/MM/yyyy", $null)
However I'm getting:
MethodInvocationException: Exception calling "ParseExact" with "3" argument(s): "String '12/16/2024 11:30:23 AM' was not recognized as a valid DateTime."
What am I doing wrong?
Cpp auto-detect the file to read hex values and raw binary content
10 November 2025 @ 3:11 pm
I am trying to create a function that can auto-detect hex values and raw binary from an input file. The input is created using openssl
openssl rand -hex 32 > aes256.key
I created below function to read this file and auto-detect whether its hex value or raw binary.
std::vector<unsigned char> readBytesFromFile(const std::string &file_path) {
// First, try reading as text to check if it's hex
std::ifstream text_file(file_path);
if (!text_file) {
throw std::runtime_error("Failed to open file " + file_path);
}
std::string content((std::istreambuf_iterator<char>(text_file)),
std::istreambuf_iterator<char>());
text_file.close();
// Remove whitespace/newlines to get clean hex string
std::string cleaned;
for (char c : content) {
if (!std::isspace(static_cast<unsigned char>(c))) {
How can I set the the inner text of a span object in Python test code? [closed]
10 November 2025 @ 3:08 pm
In Django template I have
<span id="account-email">{% account_email %}</span>
I want to set this in a behave test using Playwright
I have in a Behave step
self.wait_for_element('#account-email')
element = self.get_element('#account-email')
How to set inner text in the step?
Unity 6 - Android - HTTPListener
10 November 2025 @ 3:05 pm
I am trying to create an HTTP listener in my game application to be run on Android.
I have created this script that receives API requests from the network and do some stuff in the game.
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Net.NetworkInformation;
using System.Net.Sockets;
using System.Threading;
using UnityEngine;
public class NetworkAPIManager : MonoBehaviour
{
private HttpListener listener;
private Thread listenerThread;
void Start()
{
listener = new HttpListener();
listener.Prefixes.Add("http://localhost:7000/");
listener.Prefixes.Add("http://127.0.0.1:7000/");
string ip = GetIP(ADDRESSFAM.IPv4);
Debug.Log(ip);
listener.Prefixes.Add("http://" + ip + ":7000/");
listener.AuthenticationSchemes = AuthenticationSchemes.Anonymous;
listener.Start();
Create tabs for html
10 November 2025 @ 2:58 pm
I have a structured html
<section data-mw-section-id="1">
<h2 id="English">Do</h2>
<section data-mw-section-id="2">
<h3 id="Etymology_1">Etymology 1</h3>
<p id="m">Something</p>
<p id="m">Something</p>
<section data-mw-section-id="4">
<h4 id="Pronunciation">Pronunciation</h4>
<p id="m">Something</p>
</section>
<section data-mw-section-id="5">
<h4 id="Verb">Verb</h4>
<p id="m">Something</p>
</section>
<section data-mw-section-id="12">
<h4 id="Noun">Noun</h4>
<p id="m">Something</p>
Error: Plugin [id: 'com.android.application', version: '8.13.0'] was not found in any of the following sources
10 November 2025 @ 2:58 pm
I'm getting this error when I try to sync my Android project in Android Studio:
Plugin [id: 'com.android.application', version: '8.13.0', apply: false] was not found in any of the following sources:
Here’s my top-level build.gradle file:
plugins {
alias(libs.plugins.androidApplication) apply false
alias(libs.plugins.kotlinAndroid) apply false
}
And here’s my gradle/libs.versions.toml file:
[versions]
agp = "8.13.0"
kotlin = "1.9.10"
[plugins]
androidApplication = { id = "com.android.application", version.ref = "agp" }
kotlinAndroid = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
I also tried version 8.11.1, but it gave the same error. Version 8.9.2 isn’t found either.
I already tried
Cleaning and rebuilding the project
Invalidating caches and restarting
Checking intern