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.

Simulating JAKA moveJ does linear joint position interpolation capture the real path?

29 December 2025 @ 7:39 pm

I am working on simulating JAKA robot moveJ commands in PyBullet to validate whether a set of joint poses is collision-free before executing them on the real robot. I have a list of joint poses, for example pose1, pose2, pose3. I generate the intermediate trajectory using a linear interpolation in joint space: def linear_interpolation(p1, p2, n_points): p1 = np.array(p1, dtype=np.float32) p2 = np.array(p2, dtype=np.float32) points = [((1 - t) * p1 + t * p2).tolist() for t in np.linspace(0, 1, n_points)] return points I also calculate the number of interpolation points per segment based on joint speed limits, in order to approximate timing: def compute_segment_steps(p1, p2, joint_speed_limits, step_time, safety_factor=1.2): delta = np.abs(np.array(p2) - np.array(p1)) T_segment = np.m

Prevent Python Textual from retaining content in screens

29 December 2025 @ 7:22 pm

I'm not sure why this is happening, but I'm guessing it's something that I'm missing versus a bug in the library. I'm yielding a container that we populate ListView, Label, and Button widgets into later as a result of searching: with textual.containers.Vertical(): self._search_container_widget = \ textual.containers.Horizontal( id='movie-results-container') yield self._search_container_widget That's fine. An ListItem is selected and we will navigate away. If we navigate back, this container is nonempty, with all of the widgets we've previously added to it. We were popping the screen prior to pushing the next. We began uninstalling the screen as well, but it hasn't made a difference. The compose() and on_mount() methods seem to only be called once for the initial render, so we can't proactively delete any of that content upon load, either. What am I missing? Any suggestions?

Changing column values based on values of separate columns

29 December 2025 @ 7:09 pm

I'm trying to figure out how to change values in a column (Age), based on the values of two separate columns (Species and Length). I have a dataset of fish lengths, with all of them designated either "yoy" (young of year) or "adult". these designations aren't great for the analyses I'm trying to do so I would like to assign new age designations based on the lengths and species of the sampled fish. For example if I have a dataset like this: #random sample dataframe set.seed(1) df <- data.frame( Species = rep(c("rainbow", "coho", "brown"), times = 20), Length_in = sample(1:15), Age = rep(c("yoy","adult"), times = 30)) Species Length_in Age 1 rainbow 10 yoy 2 coho 7 adult 3 brown 9 yoy 4 rainbow 5 adult 5 coho 12 yoy 6 brown 13 adult 7 rainbow 15 yoy 8 coho 6 a

SignInWithPassword has exceeded quota limits

29 December 2025 @ 7:08 pm

I was developing an Android app using Firebase, but I end up with an error message that says: 2025-12-28 10:26:29.681 10326-10326 MainActivity com.tritongames.shoppingwishlist D Sign in failed 2025-12-28 10:26:29.682 10326-10326 RecaptchaCallWrapper com.tritongames.shoppingwishlist E Initial task failed for action RecaptchaAction(action=signInWithPassword)with exception - This project's quota for this operation has been exceeded. [ Exceeded quota for verifying passwords. ] 2025-12-28 10:26:29.686 10326-10875 LocalRequestInterceptor com.tritongames.shoppingwishlist W Error getting App Check token; using placeholder token instead. Error: com.google.firebase.FirebaseException: No AppCheckProvider installed. I've tried to use Gemini's advice with searching for the quota exceeded on Google Cloud IAM Quotas & System Limits, but I've never found anything. I'm still testing the project (not published), I should be able to shut o

Building a Vue3 component library: Components lose template-reactivity in Consumer-project

29 December 2025 @ 7:04 pm

Context I am creating a library of vue3 components and I am testing the build output in another consumer-project. The specific vue3-component takes data from a service-callback and is not updated through props. This works great when the component is added directly to the consuming project. But it breaks when I build it with vite and install / use it via npm in another project. Just like for user: https://github.com/vitejs/vite/issues/14846 Observations I initially had the same error of this user: onMounted is called when there is no active component instance to be associated with. However once I fixed it, the component does render but only as if it were tagged with v-once and does not upda

Is there a better way to get the length of runs in a list in haskell?

29 December 2025 @ 7:03 pm

module Trial where import Data.List getRunCount :: (Ord a, Eq a) => [a] -> [(a, Integer)] getRunCount lst = getRunCount' (sort lst) [] where getRunCount' :: Eq a => [a] -> [(a, Integer)] -> [(a, Integer)] getRunCount' [x] cs = case getIdx x cs of Just idx -> take (fromInteger idx) cs ++ [incr idx cs] ++ drop (fromInteger (idx + 1)) cs Nothing -> (x, 1):cs getRunCount' (x:xs) cs = case getIdx x cs of Just idx -> getRunCount' xs $ take (fromInteger idx) cs ++ [incr idx cs] ++ drop (fromInteger (idx + 1)) cs Nothing -> getRunCount' xs $ (x, 1):cs incr :: Integer -> [(a, Integer)] -> (a, Integer) incr i pairs = let (e, c) = pairs!!(fromInteger i) in (e, (c + 1)) getIdx :: Eq a => a -> [(a, In

How to disable accessibility features in a Qt app?

29 December 2025 @ 6:51 pm

The issue: You create an Android Qt C++ app. When the user has any accessibility features enabled, the app lags, it's so slow that it's unusable and finally crashes. In the associated Android log you find entries like that: [2025-12-28 13:42:43.177 Uid(value=10021):11177:11177 W/Qt A11Y] Accessibility: populateNode for Invalid ID [2025-12-28 13:42:43.178 Uid(value=10021):11177:11177 W/Qt A11Y] AccessibilityEvent with empty description The issue is present in Qt bug logs since Qt 5.2 up to Qt 6.8, I'm now using Qt 6.10 and it appeared again. Possible solutions: There was a solution in Qt 6.8 which was rather simple. You use the following code in your C++ main() function to define an environment variable before instantiating your QApplication class: qputenv("QT_ANDROID_DISABLE_ACCESSIBILITY", "1");

Does a ModelSerializer catch "django.core.exceptions.ValidationError"s and turn them to an HTTP response with a 400 status code?

29 December 2025 @ 6:41 pm

Let's say this is my model: from django.core.exceptions import ValidationError class MyModel(models.Model): value = models.CharField(max_length=255) def clean(self): if self.value == "bad": raise ValidationError("bad value") def save(self): self.full_clean() return super().save() And I have this serializer: from rest_framework.serializers import ModelSerializer class MyModelSerializer(ModelSerializer): class Meta: model = MyModel fields = ["value"] And this was my viewset from rest_framework.viewsets import ModelViewSet class MyModelViewSet(ModelViewSet): queryset = MyModel.objects.all() serializer_class = MyModelSerializer My question is: what should happen when a bad

How to set timeout for function execution in postgresql?

29 December 2025 @ 6:10 pm

I've received a task to optimize our function for generating new partitions for a table. Let's say that we have something like this: CREATE OR REPLACE FUNCTION partition_creator(count_days integer, from_relative_today integer) RETURNS void LANGUAGE plpgsql AS $function$ declare -- some fields declaration begin execute 'set role AS_ADMIN;'; execute 'SET local lock_timeout=300000'; for i in 1..count_days loop -- some logic here with selects to pg_class to check if partition with specific name exists already -- and sqls for creating new partitions and indexes for them end loop; end; $function$ ; As you can see, this function will wait for 5 minutes to receive the lock for execution. I need to reduce total execution time to 2 minutes. These time should include lock waiting time and execution time (for example - if the function waits for the lock for 1:30 minutes, then it has only 30 seconds for

How to properly implement global exception handling in ASP.NET Core Web API to return consistent error responses?

29 December 2025 @ 6:06 am

I'm building an ASP.NET Core 8.0 Web API and want to implement global exception handling that returns consistent JSON error responses to clients, regardless of where exceptions occur in my application. Right now, different types of exceptions return different response formats: Business logic exception (my custom exception): { "message": "User not found" } Validation error: { "errors": { "Email": ["Email is required"] } } Unhandled exception (500 error) just returns a generic error page or empty response in production. I want ALL errors to return a consistent format like this: { "statusCode": 404, "message": "User not found", "details": "Additional context here" } What I've tried: 1. Using middleware: public class Ex