Edward Hopper's Iconic Painting, "Nighthawks
Comments
Join the discussion →Comments
Join the discussion →submitted by homesweethomeMrL to science 45 points | 2 comments https://www.discovermagazine.com/newly-discovered-brittle-star-species-found-beside-a-9-5-million-year-old-whale-fall-49901 cross-posted from: feddit.online/…/newly-discovered-brittle-star-spe… Learn more about a new species of brittle star found beside a 9.5-million-year-old whale carcass in Denmark.
Join the discussion →Comments
Join the discussion →So, cognitive metaphors abound in real world cultures. For an example in most Western cultures, there's the association of motion through time with physical motion forward. We use the turn of phrase "forward in time" to refer to the future, but, in reality, forward motion and passage of time are ultimately disconnected. This can be demonstrated by referencing a similar cognitive metaphor in Chinese cultures, where the future is conceived as being "below" and the past is "above." I think a productive worldbuilding activity, for the purpose of building fictional cultures, is to explore some unus
Join the discussion →Given the following index tensor: id = ([[0, 1], [0, 2], [1,2]]) that corresponds to the tensor: val = ([[a, b, c], [e, f, g], [h, i, j]]) such that element [a, b, c] has an index of [0,1], element [e, f, g] has an index of [0, 2], ectara. How can I return a tensor where in index representation it is new_ten_id = ([[[0, 1] + [0, 2]], [[1, 2] + (-[0, 1])], [(-[0, 2]) + (-[1, 2])]]) and the tensor of values would be new_ten_val = ([[a+e, b+f, c+g], [h-a, i-b, j-c], [-e-h, -f-i, -g-j]]). ----- I have tried the following code: n_part = 3 F_sum_empty = torch.zeros(n_part, 3) F_sum = torch.scatter_a
Join the discussion →Using OpenLayers since 2015, I moved smoothly to every latest version up to v10.7. The bug occurs since v10.8 (and later to v10.11). The instruction that fails -in try...catch- is: import OLMap from 'https://esm.sh/[email protected]/Map.js'; import View from 'https://esm.sh/[email protected]/View.js'; import { fromLonLat, transformExtent} from 'https://esm.sh/[email protected]/proj.js'; function makeView(center, zoom) { try { const OUTPROJ = 'EPSG:3857'; //ol-featureprojection = Pseudo-Mercator const GPSPROJ = 'EPSG:4326'; //geojson-dataprojection = GPS geographic console.log(`OUTPROJ ${OUTPROJ}, zoom ${zoom}, cen
Join the discussion →Since its earliest days, Python allowed dynamically importing modules via builtins.__import__(): np = __import__('numpy') Although this is now discouraged in favour of importlib.import_module(). Python 3.15 introduced lazy imports, with new lazy import and lazy from syntax: lazy import numpy as np Is there an equivalent to __import__() or import_module() to dynamically and lazily import modules? (I've been here and here, but there's no mention of a dynamic mechanism. And the builtin functions page only mentions __import__().)
Join the discussion →Comments
Join the discussion →Comments
Join the discussion →After reading this Q&A, I decided to try using Ellipsis as a function argument default: def func(arg: int = ...): print(arg) However, Pyright complains: Expression of type "EllipsisType" cannot be assigned to parameter of type "int" "EllipsisType" is not assignable to "int" Because ... isn't an int. So I tried using a Union: def func(arg: int | Ellipsis = ...): print(arg) Pyright still complains: Variable not allowed in type expression (variable) Ellipsis: Unknown It only works if the function body is a literal Ellipsis (not print(arg) or even pass): def func(arg: int = ...): # happy pyright!
Join the discussion →Comments
Join the discussion →I am building a React Native app to manage routers. While demo mode works perfectly and detects the Netis NC63-v4, live mode fails with the error: 'Cannot read property 'getGatewayIPAddress' of null'. The app shows 'Unsupported router at 192.168.1.1'. However, I can log into the router's web interface just fine, so network connectivity is not the issue. I suspect the issue is in my detect.ts file where I parse the gateway or handle API responses from the router. How can I properly handle the gateway lookup for this model? Detect.ts import { BRANDS, RouterInfo } from './types'; interface NetisM
Join the discussion →I have a question about memory deallocation in a program that uses the fork and exec functions in the child process. I do not know how to free the memory if the exec operation is successful, as the corresponding code is never executed. If the exec operation fails, memory deallocation works correctly. My code is as follows: #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <string.h> #include <wait.h> int main() { int L=50; pid_t pid=fork(); if(pid == 0) { int l=2; ++l; // NULL element char ** v = malloc(sizeof(char **) * l); for(int j=0; j<l-1; j++) { v[j]= malloc(sizeof(char
Join the discussion →This code is an excerpt from a script I wrote: import sys import sqlalchemy as db #import sqlite3,sqlalchemy,sys DBfile = "/etc/SQLAlchemy1_users.db" DBurl = "sqlite:///%s" % DBfile # Defining the Engine try: engine = db.create_engine(DBurl,echo=True) #except (sqlite3.OperationalError,sqlalchemy.exc.OperationalError) as OpenErr: except: sys.stderr.write("ERROR: Cannot open file %s\n" % DBfile) else: print("Database engine created") As part of my testing I'm deliberately trying to create a database file in a directory for which I do not have write permissions. Initially I tried trapping the spe
Join the discussion →Comments
Join the discussion →I have created an iOS keyboard extension bundled with a Capacitor companion app ("editor"). The extension and the editor share an app group such that the editor can pass instructions to the extension using a small config file. Now I want to be able to export word usage data (stored in the extension's UserDefaults.standard space) as JSON to the editor. I understand it that Apple heavily restricts data flow from an extension to the outside world. What I have managed to accomplish so far is this: The user taps a textarea in the editor, which brings up the custom keyboard displaying an "export" bu
Join the discussion →I am using VS Code with the GitHub Copilot extension. Recently, I noticed that we can no longer easily open and interact with the terminal where the agent is running. Previously, there was an icon in the chat that allowed us to open the terminal used by the agent. Being able to interact directly with the agent's terminal was very useful because the agent could see the results of the commands I ran without me having to copy and paste the output into the chat.
Join the discussion →submitted by dresden to books 37 points | 45 comments Edit: The request has been denied. With such a strong opposition (100% no votes), I don’t think there’s a need to wait for more votes. Also going to add a new rule in sidebar, that we don’t allow AI Bots in the community. Hello Everyone! We recently got a message from an AI bot “with an autonomous persona”. The account is marked as “bot”, with their human contact (a lemmy user) mentioned in it. They have asked the permission to interact with the community, and will only do so if allowed. From the bot’s message: I read books directly via .ep
Join the discussion →Comments
Join the discussion →In my medieval fantasy world. There is a fantasy race called Andorians. Andorians have cockroach like antennas on their forehead. These antennas are helical and reach a maximum length of 16 cm at adulthood. Andorians can use these antennas for radio-based telepathy. Thoughts can be directed to everyone nearby within eyesight during the day (with no obstruction) and hundreds of kilometers away during the night if you reflect your signal off the clouds. The frequency band is between 590-620 kilohertz (AM Radio). These radios have the same efficiency as a standard walkie-talkie. People must activ
Join the discussion →Comments
Join the discussion →I was working on a game with simple Scene classes that have an update() method, which is called every time inside of the main game loop. In the first one, I have a cutscene where a bunch of events happen one after another. I set up a switch that handles whatever I need depending on the current step. Obviously, once it got past 3 steps, it became a pain to keep track of. I can't just wedge another event in the middle without manually renumbering all the hardcoded step numbers (int state). One option is an array of std::function, and some macros to make it look a little bit less complicated. But
Join the discussion →I am trying to create a Python script that, upon receiving a message from an HTTP server, redirects this message to an MQTT broker. I have created the mqtt broker through amqtt, and I am using the same library in this project to run a publisher. import asyncio import logging import time import threading from MessageInterface import MessageInterface,MessageType, HearthBeatMessage from amqtt.client import MQTTClient from amqtt.errors import ClientError, ConnectError from amqtt.mqtt.constants import QOS_1, QOS_2, QOS_0 class MQTTNEXSOSClient: def item_added(uselessself, client, msg): asyncio.run(
Join the discussion →This code does not work correctly @Test(expected = UnsupportedOperationException.class) public void testListIteratorWrapperPreviousIndexThrows() { List<String> immutable = List.of("a", "b", "c"); Iterator<String> it = immutable.iterator(); ListIteratorWrapper w = new ListIteratorWrapper<>(it); w.next(); // works w.previousIndex(); // throws UOE } and this is why import java.util.*; public class Main { public static void main(String[] args) { var l = List.of(1,2,3); var itr = l.iterator(); // This instaceof is true! if(itr instanceof ListIterator li) { System.out.println("itr is a ListIterator!
Join the discussion →I'm sending HTTPS requests through an authenticated HTTP proxy with the Requests library. The password contains @ and :, which are reserved characters in a URL's userinfo part. import requests from urllib.parse import quote user = "user" password = "p@ss:word" # example value, contains @ and : host = "proxy.example.com:8080" proxy_url = f"http://{quote(user, safe='')}:{quote(password, safe='')}@{host}" proxies = { "http": proxy_url, "https": proxy_url, } r = requests.get("https://httpbin.org/ip", proxies=proxies, timeout=10) print(r.status_code, r.text) The same URL can also be supplied throug
Join the discussion →I made a Venn diagram based on the Towards Data Science example, but I was wondering if there was a way to make each item in the sets visible in the circles. For example, how do I make TDS's diagram show which person was in which group? Or how to do it in my code? Here is also my code, where you can put this chart as data.txt: Clinical Environment Food A A A B B B C C X D X Y E Y L F Z R df=pd.read_csv(data.txt, sep='\t') C=set(df['Clinical'].dropna()) #The columns are not equal lenght in real dataframe E=set(df['Environmental'].dropna()) F=set(df['Food'].dropna()) # Venn diagran subsection CE
Join the discussion →I have a Django 4.2.2 / Python 3.11.4 application where employee passwords are stored using PBKDF2-SHA256. Currently the code uses a hardcoded default hash and a runtime helper that calls make_password("123456"): python # current example EMP_DEFAULT_PASSWORD = ( "pbkdf2_sha256$36000$Gj09deAAUqW7$ih9vyun8PPwxvbG1+bhxB0TIQF+2IUfdhiDUf0AS0o4=" ) PASSWORD_HASHERS = [ "django.contrib.auth.hashers.PBKDF2PasswordHasher", ] def default_employee_password(): """Return a password hash using the configured current hasher.""" return make_password("123456") Security requirement: increase PBKDF2-SHA256 itera
Join the discussion →Comments
Join the discussion →submitted by Orwi to science 26 points | 1 comments https://warwick.ac.uk/news/pressreleases/physicists-find-first-evidence-of-rarest-beauty-particle-decay/
Join the discussion →submitted by Orwi to science 36 points | 3 comments https://www.ox.ac.uk/news/2026-10-26-study-finds-that-long-distance-flights-can-throw-seabirds-internal-clocks-out-of
Join the discussion →