Random snippets of all sorts of code, mixed with a selection of help and advice.
Imported DLLs Enum declarations are interpreted as Class
17 May 2026 @ 12:30 am
I am using the latest version of VS2026. I created a Library Class project and imported a set of DLLs. Whenever I try referencing any of the Enum structures in said DLLs I get the following error:
error CS0012: The type 'Enum' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Private.CoreLib, Version=10.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'.
I doubled checked and I am using .NET 10.0 as targeted framework.
You can see in this image how other structures are used with no errors. I've tried looking up this error but everything I found was people not targeting the correct framework or having to update the SDK/NET libraries.
You can see in this image how other structures are used with no errors. I've tried looking up this error but everything I found was people not targeting the correct framework or having to update the SDK/NET libraries.Configuring Spark ThriftServer and Spark Connect Server
17 May 2026 @ 12:08 am
I'm newbee to Spark world.
I have installed single node Spark in my AZ VM.
I want to have both services up and running (Thrift and Connect). It only works when:
Thrift is on and Connect is off
Thrift is off and Connect is on
I think is caused by my wrong configuration. From the screen from my Spark Master UI, I'm guessing that when I start Thrift first, it allocates all available Cores, when Connect is started no cores are available and probably that is the reason why Connect is in Waiting state?
If I start Connect first - it works fine but my Thrift will be in the waiting state
My spark-env.sh contains the following settings:
export JAVA_HOME=/usr/lib/jvm/java-21-openjdk-21.0.7.0.6-1.portable.jdk.x86_64
export SPARK_MASTER_HOST=192.168.2.5
export SPARK_MASTER_PORT=7077
export SPARK_MASTWhy does TypeScript infer string instead of a literal type for object properties, but not for const variables?
16 May 2026 @ 11:22 pm
Here's a TypeScript one that's a strong upvote candidate — it's a real source of confusion, the error message is specific enough to be googled verbatim, and the answer involves a genuinely non-obvious language rule (not just "you have a typo").
Title: Why does TypeScript infer string instead of a literal type for object properties, but not for const variables?
Body:
I'm trying to use a string literal type as a discriminator, but TypeScript keeps widening it to string when I put it inside an object. Here's a minimal example:
type Event =
| { kind: "click"; x: number; y: number }
| { kind: "keypress"; key: string };
function handle(e: Event) { /* ... */ }
// Case 1: works
const k = "click";
handle({ kind: k, x: 0, y: 0 });
// Case 2: works
handle({ kind: "click", x: 0, y: 0 });
// Case 3: fails
const payload = {
Can't build on Win11
16 May 2026 @ 11:15 pm
I've installed your preferred shell, but the script rejects my computer:
{Redacted}@{REDACTED} MSYS ~/limd-build
$ bash ./limd-build-msys2.sh
**** libimobiledevice stack build script for msys2, revision 1.0.3 ****
Unsupported MSYS2 environment. Supported are MinGW64, MinGW32, and UCRT64.
{Redacted}@{REDACTED} MSYS ~/limd-build
$ echo $MSYSTEM_CARCH
x86_64
Device name {REDACTED}
Processor 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz (2.80 GHz)
Installed RAM 16.0 GB (15.8 GB usable)
Graphics card Intel(R) Iris(R) Xe Graphics (128 MB)
Storage 785 GB of 954 GB used
Device ID {REDACT}-{ED}-{RE}-{DA}-{CTEDREDACT}
Product ID {EDR}-{EDA}-{CTE}-{DRE}
System type 64-bit operating system, x64-based processor
Pen and touch Pen and touch support with 10 touch points
Edition Windows 11 Home
Version 25H2
Installed on 2026-04-17
OS build 26200.8457
Serial number {DAC
Make Youtube API order : date go on chronological order
16 May 2026 @ 10:38 pm
Youtube's order: date on search.list gets the result in an antichronological way, making the latest videos appear first. For my project, I would need it to go on chronological order since I want to get results since a specified set date.
My other option would be working in reverse, but that would be a chore.
I am using python
How can I get the list of videos from earliest to latest?
update or bulk update django
16 May 2026 @ 10:32 pm
I was doing a CRUD operation, and I found two ways to update data.
1- update
2- bulk_update
Which one should I use or consider as good practice?
I can do with the both a multiple data updates.
WhatsApp animated stickers flatten to static when shared via custom Android keyboard (Kotlin)
16 May 2026 @ 10:27 pm
I am developing a custom Android keyboard app (KBoard) in Kotlin that allows users to send stickers directly into WhatsApp chats. Static stickers work fine, but animated stickers always appear as static images once they reach the chat.
What I’ve tried:
Exported stickers as animated WebP (512×512 px, transparent, > 500 KB).
Used FileProvider to generate a content:// URI.
Committed content via InputConnectionCompat.commitContent with MIME type "image/webp.wasticker".
Verified that WhatsApp accepts the MIME type and the commitContent call succeeds.
Cleared WhatsApp cache to avoid old flattened versions.
Code snippet:
fun sendAnimatedStickerToWhatsApp(uri: Uri, mimeType: String = "image/webp.wasticker") {
val editorInfo = currentInputEditorInfo ?: return
Button press result not appearing in the frame intended
16 May 2026 @ 10:19 pm
Project contains 3 files
main.py
from customtkinter import *
import tkinter as tk
from tkinter import ttk
from include.frame_select import FrameSelect
from include.frame_main import FrameMain
window = CTk()
window.geometry("600x800+100+100")
window.resizable(1,1)
frame_select = FrameSelect(window)
frame_select.grid(row = 0, column = 0, sticky = N + W)
frame_main = FrameMain(window)
frame_main.grid(row = 0, column = 1, sticky = N + W)
window.mainloop()
frame_select.py (in directory include)
import tkinter as tk
from tkinter import ttk
from customtkinter import *
from include.frame_main import FrameMain
class FrameSelect(CTkFrame):
def __init__(self, master):
super().__init__(master)
self.configure(width=200)
id_label = CTkLabel(self, text = "Source file(s)", font = ("Arial",18,"bold&qu
Differents values for heritability with differents packages
16 May 2026 @ 9:53 pm
I am trying to replicate some h2 (heritability) result using lme4breeding and Gryphon database.
Lamentably I am getting different values with the same model comparing with other packages like Asreml or MCMCglmm:
bwt ~ 1 + (1|id)
0.54 (lme4breeding) vs 0.47 (Asreml and MCMCglmm)
Results for Asreml are in this link:
https://wildanimalmodels.org/docs/tutorials/tutorial-asreml-r-v4/
Database y pedigree data are in:
https://besjournals.onlinelibrary.wiley.com/doi/full/10.1111/j.1365-2656.2009.01639.x
Example:
#------------------------------------------------------
# lme4breeding
#------------------------------------------------------
library(lme4breeding)
library(nadiv)
pheno=read.table(
Using importlib is it possible to modify the incoming source code
16 May 2026 @ 9:49 pm
When using importlib as below is there some way to modify the source code between creating the module and executing (and compiling) it?
import importlib.util
spec = importlib.util.spec_from_file_location(module_name, source_path)
module = importlib.util.module_from_spec(spec)
# <- source code needs to modified here
spec.loader.exec_module(module)
Thanks to databaseTROY for the above code on Compile only if .pyc is out-of-date?
I realise there is method using a CustomSourceLoader class, however this unfortunately doesn't save the compiled code as a .pyc. The idea is to only modify the code and compile a new .pyc if the original source has changed.