StackOverflow.com

VN:F [1.9.22_1171]
Rating: 8.5/10 (13 votes cast)

Random snippets of all sorts of code, mixed with a selection of help and advice.

Learning JavaScript Deeply Using MDN — Need Guidance

31 January 2026 @ 4:43 am

I want to learn JavaScript in depth, and I strongly prefer reading documentation rather than watching video tutorials. I’ve decided to learn JavaScript mainly from MDN Web Docs, but I’m confused about where to begin: JavaScript Guide: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide Learn Web Development → Core → Scripting: https://developer.mozilla.org/en-US/docs/Learn_web_development/Core/Scripting My goal is to gain strong conceptual and internal understanding of JavaScript, not just surface-level usage. My questions: Which of these two paths should

SwiftUI .searchable: search text not shown when search is inactive

31 January 2026 @ 3:59 am

What I’m building I’m using .searchable(text:isPresented:...) for a network-backed search (not live filtering). Flow: 1. User taps the iOS 26 bottom-bar search control 2. Search UI is presented (I also show a custom “search screen” overlay while searching) 3. User types a query 4. User hits Search → I dismiss search and run a network call (show loading/error/results) 5. I expect the query string to remain visible in the main UI as the “current search” Issue While the search UI is active, the query displays correctly (the text field shows the bound value). But after I dismiss search, the inactive iOS 26 bottom-bar search UI does not render the existing query — it shows only the prompt/placeholder, even though the binding still contains the query. struct SearchTextVisibilityExample: View { @State private var searchText = "" @State private var

C implicit const casting (in dereferencing order) should be permitted but isn't

31 January 2026 @ 3:56 am

After looking around online and only really finding one post which addresses this issue (from 17 years ago), I'm starting to wonder why such a glaring oversight is still in the C language. For context, I have a function to print some text, which naturally takes in a ⁨const char *const *⁩ as one of its arguments (meaning the provided text will not be modified in any way by the function). I am then passing a ⁨char **⁩ as argument, yet the compiler (gcc 13.3.0) warns of an incompatible pointer type conversion. I understand that a cast from ⁨char **⁩ to ⁨const char **⁩ is illegal (well, you'd need explicit casting) because you could illegally store a const and then write to it with a ⁨char *⁩. But adding consts in the order of dereferencing cannot generate issues; you're basically only restricting your access! So, why is this seemingly fixed in C++ and some C compilers (i.e

Which thread should I call SceneKit's node manipulation APIs?

31 January 2026 @ 3:31 am

In Apple's SceneKit sample code (download here: https://developer.apple.com/library/archive/samplecode/scenekit-2017/Introduction/Intro.html#//apple_ref/doc/uid/TP40017656), we have: @implementation AAPLGameViewController - (void)viewDidLoad { self.gameController = [[AAPLGameController alloc] initWithSCNView:self.gameView]; } @end @implementation AAPLGameController - (instancetype)initWithSCNView:(SCNView *)scnView { [self addFriends:3]; [self setupPlatforms]; } - (void)addFriends:(NSUInteger)count { friend.position = ... [friends addChildNode:friend]; } - (void)setupPlatforms { SCNAction *moveAction = [SCNAction moveBy:SCNVector3Make(alternate * PLATFORM_MOVE_OFFSET, 0, 0) duration:1/PLATFORM_MOVE_SPEED]; moveAction.timingMode = SCNActionTimingModeEaseInEaseOut; [node runAction:[SCNAct

Regarding the issue that variables cannot be obtained using @forward in CSS preprocessor Sass

31 January 2026 @ 3:30 am

I defined variables in the variables.scss file, and then referenced these variables in the sidebar.scss file, but I can't access them. Can someone tell me what's going on. //variables.scss @use 'sass:meta'; $theme:light !default; $style: ( light:( theme-border-color: #eaebf1, theme-hover-color: rgba(241,241,244,0.8), ), dark:( theme-border-color: red, theme-hover-color: black, ) ); //sidebar.scss @forward '@/assets/style/variables.scss' with ($theme:light !default); @use '@/assets/style/variables.scss' as *; @use 'sass:map'; .menu-left { width: 80px; height: 100vh; position: relative; user-select: none; border-right: 1px solid map.get(map.get($style , $theme), 'theme-border-color'); } and then ,The Sass compiler will report an error

Python Use while loop to escape complex if statements

31 January 2026 @ 3:05 am

I have used the following Python 'pattern' for some time when faced with complex nested 'if' statements. But, I have not seen this directly discussed anywhere online. Am I missing something obvious or am I safe in continuing with its use.. bOnce: bool = True bAct: bool = False while (bOnce): bOnce = False if (self.isEmpty()): break # end_if if (self._iIndex >= self._count): # log message break # end_if # perform action here or elsewhere bAct = True # end_while if (bAct): ... The example code is only an example by a camal coder. I have just seen gjones's reply to a post, almost an answer.

Python MissForest Users will have to perform categorical features encoding by themselves

31 January 2026 @ 2:59 am

I'm trying to use missforest in python to impute missing values in a data set but I'm having issues with the categorical values. In the original documentation it gives the example : categorical=["sex", "smoker", "region", "children"] # Default estimators are lgbm classifier and regressor mf = MissForest(categorical=categorical) mf.fit(x=train) But when I try to actual use it like this inside of a class im making: from missforest import MissForest from sklearn.ensemble import RandomForestRegressor, RandomForestClassifier mf = MissForest( clf=RandomForestClassifier(n_jobs=-1), rgr=RandomForestRegressor(n_jobs=-

Dynamic SQL is the only way I can see making this work - Questions on using dynamic SQL

31 January 2026 @ 2:53 am

The below snowflake stored procedure (SP1) and call works and returns exactly what I'm looking for. The SP is simply returning any duplicates based on my input of table and fields. Notice that I'm passing two fields in the second argument. I understand that using dynamic SQL is bad practice, this SP being a good example in that it is susceptible to sql injection. If dynamic SQL isn't used, how could this be written so that multiple fields can be passed in the second argument? I am able to write it using bind variables, but with only one value being passed in the second argument (SP2 below). I tried using an array, but couldn't find a way to make that work. SP1: CREATE OR REPLACE PROCEDURE TWOCHECKDUPE(tablename varchar, fieldcheck varchar) RETURNS TABLE () LANGUAGE SQL AS DECLARE rs RESULTSET; stmt VARCHAR; BEGIN stmt := 'SELECT count(1), '||:fieldcheck||' from '||:tablename||' group by '||:fieldcheck||' having count(1) > 1'

How to obtain a table from an online pdf in R

31 January 2026 @ 1:22 am

I have a problem I have this link pdf_data and I want to download therein the pdf entitled "New index of apartment prices by age" I downloaded this pdf in my working directory and saved it with the name "name" and then I run library(RCurl) library(tabulapdf) library(pdftools) txt <- pdf_text("name.pdf" ) lines <- lapply(txt, function(t) readLines( textConnection(t)) ) It seems to be working. Yet, I was wondering if it is possible to extract the table from that pdf using directly the online pdf, that is, just the link, without having to download the pdf. Any code provided is greatly appreciated!¬ Many many thanks

tvOS Picker not showing checkmark for selected item

30 January 2026 @ 10:29 pm

I've been trying to put together a Picker for a tvOS app and I can't get the item in the list that's currently selected to show a checkmark. I've tried everything I could think of: accents, color (to be sure the check wasn't the same color as the bg), making sure the ID matches, a List instead of a Form, UI debugger to see if it's there (it's not), nothing works. The tag and type match (OptionType), and the app knows what was selected because if you select the selected row, nothing happens, but doesn't show a check on the row of the selected item. Below is a minimal example. If anyone has any clue, I'd appreciate the help. Thanks. import SwiftUI import Combine enum OptionType: String, CaseIterable, Identifiable { case option1 = "Option 1" case option2 = "Option 2" case option3 = "Option 3" case option4 = "Option 4" case option5 = "Option 5" var id: String { rawValue } } class My