I am trying to make a pixel-based simulation, and am having some performance issues. I thought I could use numbas JIT-compilation to speed it up, but when I run the code it runs ~14% slower. This is the code: @jit(nopython=True) def update(pixels): new_pixels = [1 for _ in range(grid_size[0]*grid_size[1])] for y in range(grid_size[1]): for x in range(grid_size[0]): pixel = pixels[x + y*grid_size[0]] u = pixels[x + (y-1)*grid_size[0]] if y-1 >= 0 else 0 d = pixels[x + (y+1)*grid_size[0]] if y+1 < grid_size[1] else 0 if pixel in [1, 4, 9]: # if pixel is air, smoke or steam if u == 2: # if up is
I installed Python 3.13 in C:/_dev/ folder. I have created a Python virtual environment in another folder and installed Django, then I generated a Django project and an application. I wanted to make a custom User model. When I typed class CustomUser(AbstractBaseUser), AbstractBaseUser was not suggested and imported. When I pressed Ctrl+. on AbstractBaseUser nothing was suggested too. from django.db import models # Create your models here. class CustomUser(AbstractBaseUser): // from django.contrib.auth.models import AbstractBaseUser pass I changed package index depths both in workspace and user
I have a layover at Dublin airport and because I will be reaching midnight I believe it will be cold and many shops closed or all of them. I am carrying an under seat bag. What is best way to have a sleep/nap? What should I carry/buy? Edit: The layover is for 13 hours.
I'm testing the new lazy imports in Python 3.15. I have a module called example.py: print("Module executed") value = 42 And this code in main.py: lazy import example print("Checking module") print(hasattr(example, "value")) print(example.value) I want to check whether the module has already been executed without causing it to execute. The problem is that hasattr() accesses the module's attributes, which appears to trigger the lazy import. I also considered checking sys.modules: import sys lazy import example print("example" in sys.modules) But I'm not sure whether this is a reliable way to che
I have some legacy HTML code (actually created by a Python script) that I am maintaining that prompts the user to enter various fields in a table. Then, upon Submit, those fields are written to a MongoDB database. One of the fields is a file name. The file name entry field uses an input type="file". When the data (file name) is pulled from the form, the file starts uploading. I don't need the file, just the file name. Some of the files selected are many gigabytes long and with a slow server connection, cause the page to hang for several minutes until finished. How do I prompt for a file withou
I'm experimenting with an async cache where multiple callers requesting the same key share one running task. Most things seem to work fine, but I'm not sure how to handle it when a key gets invalidated before the original fetch has finished. Here's a simplified version of what I'm working with: import asyncio cache = {} pending = {} versions = {} async def fetch(key, version): await asyncio.sleep(1 if version == 0 else 0.2) return f"{key}-v{version}" async def get_data(key): version = versions.get(key, 0) if key in cache: return cache[key] if key not in pending: pending[key] = asyncio.create_t
To make flying comfortable for my handicapped mom and dad, I always buy them business class. As I can't afford business class for 3 people, I sit in economy. I am my mom's primary caretaker. My mom depends on me to inject her prescription medications. During all our flights, I always get up from my economy class seat, walk up to business class a few times to tend to my mom, inject her meds, and assist her such as the lavatory. This has never raised an issue. Nobody bats an eye to this, probably as "airlines operating in Canada must accommodate passengers with disabilities to eliminate undue ob
I have a world somewhat similar to cyberpunk 2077 in terms of implant tech: advanced sense augmentation, computational brain implants, weapons in arms, etc. However it is attempting to be somewhat more realistic, and so they do need (sometimes significant) power. Batteries charged at home or in public places might be ok for average people with non-essential implants, but for soldiers with artificial hearts or people with livers replaced with dialysis machines there would need to be some way to harvest energy from the human body. The only sources I could find here are bio-enzymatic fuel cells a
Screenshot 1: Screenshot 2: On iPadOS 27.2 (& Xcode 27.2), Apple's apps in full screen have a menubar that appears integrated into the app - for example, in Notes or Mail, the colour of the sidebar continues to the very top of the screen whether the menubar is visible or not. My SwiftUI app in full screen has a coloured sidebar but its colour stops at the menubar which always appears as a white strip across the full width of the screen. It's also odd, and surely relevant, that if my app is not full screen, then a thin white strip appears along the entire width of the top edge of my app's windo
I've an Angular/Node.js. I would like to implement an application to give my coworker the ability to book a work room. I would like the possibility to display all the room availabilities for each day and to have to possibility to book a room for an hour, more, to be able to repeat for a time period. How to do that and with which component?
A trope I've seen before in stories is of someone who got kidnapped as a child and raised as the child of the kidnapper, without knowing of this, only to find out as a teenager/adult. In this case the situation I'm working with is that the child as a teenager ends up in the hospital, where somehow it's found out the person they assume is their mother isn't actually related to them. However, I don't know if there are any sort of routine medical tests that would actually discover a lack of biological relation, or if there are specific medical situations (injuries or illnesses) which involve stan
I made custom class for filterable JComboBox. I tried with 10000 items and it works pretty well (nothing is laggy) although I won't even need that much items for my usecase. Then I tried implementing highlighting of a matching term. Idea is to match string that I'm typing in textfield to part of item and to highlight that matching part. I implemented it and it works but the problem is that it is laggy (takes a lot of time to open popup and to highlight items) when combobox has apx. 1000 items and more. How can I improve speed so that it is not laggy? FilterableComboBox import javax.swing.*; im
I am currently testing additionalOverflowItems with the expectation that it behaves as follows: Keep UIBarButtonItem instances visible directly on the toolbar as icons whenever there is sufficient space. Only move items into the overflow menu when there isn't enough screen real estate. In iOS 26, additionalOverflowItems behaves exactly as described above. However, in iOS 18, the system tends to aggressively move all UIBarButtonItem instances into the overflow menu regardless of available space. Is this change in layout behavior documented anywhere? Can we rely on iOS 26 and future releases mai
I understand this is incredibly incomprehensibly far into the future so any surviving civilization that made it through the degenerate era would be so far ahead of us they would come across as godlike. But if protons do indeed decay could any intelligence no matter who they think they are within the laws of physics become independent of baryonic matter and exist as only leptons and no Baryonic form at all I always thought of post biological life as being baryonic even if post organic.
My Azure Data Lake Storage folder contains Parquet files (snappy compressed) from Kafka Connect. I made a shortcut from the Azure Data Lake Storage to Fabric Lakehouse and work on the files in Fabric Notebook, using Spark. I combine the many small files to a few bigger files. I tried reading the small files into df, repartitioned it and writing into snappy compressed Parquet (attempt #1). I also tried grouping the small files into my desired size, then read the group and coalesce into 1 (attempt #2). The small files are 9GB, but the target files of both approaches up to 21GB. What do I do wron
I am trying to create an Azure Policy to track the "Send scan results to Log Analytics" Microsoft Defender for Storage setting, and unfortunately, having a lot of trouble finding information on the correct policy rule evaluation paths. Desired Behavior: I'd like the policy to track that the "Send scan results to Log Analytics" option is enabled and that a log analytics workspace has been selected. I'm seeking help on the correct invocation of detail type and existence condition aliases to get this to work. This is what I have so far: "policyRule": { "if": { "field": "type", "equals": "Microsof