I am using XYZ geoLocation IP details provider API and it giving output in below format { "ipAddress": "66.XXX.YY.XXX", "network": "66.XXX.YY.Z/AB", "timezone": "America/Chicago", "country": { "name": "United States", "isoCode": "US" } } Using "timezone" of the above details I need to get the UTC offset details.
My websiite using hls.js player to play the stream with multi text tracks (HLS). I want to remove the default black ground of text tracks, make it transparent. It works on windows. But not on macOS (Safari, Chrome, Edge). I have tried setting background-color to transparent or rgba(0,0,0,0) but it not helps. I have make demo on codesandbox: https://codesandbox.io/p/sandbox/rmggsv?file=%2Findex.html%3A1%2C1-85%2C1 https://rmggsv.csb.app/ My website is simple as below: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <title>Custom background Vide Cue</title> <script src="https://
The conditional ? : operator in Java is right-associative. So the expression a<b ? c<d ? 1 : 2 : 3 ; is evaluated as a<b ? (c<d ? 1 : 2) : 3 ; Does this mean that the expression (c<d ? 1: 2) is evaluated first or is the boolean a<b evaluated and the expression (c<d ? 1: 2) is only evaluated afterwards iff a<b is true? In other words: assume c<d is true, is the evaluation then: a<b ? 1: 3; or a<b ? (c<d ? 1 : 2) : 3 ;
To be clear, I'm not suggesting anyone actually should import pkg.__init__ directly. This is to understand potential pitfalls if someone decides to convert a module-only distribution into a package, because the current typing specifications cannot bundle static typing information with module-only distributions. So, when someone converts project/ distributed.py into project/ distributed/ __init__.py a third party user can do this: import distributed.__init__ # and/or import distributed.__init__ as distributed I'm already aware of the following if you import distributed.__init__: Both distribute
I was curious and wondering how many registers are on an x64 processor. I know there are 16 general purpose registers available to the user, but there are supposedly general purpose alias registers unavailable to the user that the CPU constantly uses when you reference the available 16 general purpose registers in assembly. I searched all around and can't seem to find an answer on here or the internet, so any answers are much appreciated.
So I am doing some SQL aggregation transformations of a dataset and there is a certain condition that I would like to do, but not sure how. Here is a basic code block: le_test = spark.sql(""" SELECT Country, ROUND(MIN(Life_Expectancy)) AS Min_LE, ROUND(AVG(Life_Expectancy)) AS Avg_LE, ROUND(MAX(Life_Expectancy)) AS Max_LE, ROUND(MAX(Life_Expectancy) - MIN(Life_Expectancy)) AS LE_range FROM le_cleaned GROUP BY Country """) This dataset has countries split up by years (over the course of about two decades), hence the aggregation. What I want to do is an additional column based on the difference
I recently had an interview where I was asked to show how to prevent race conditions in C or C++ between two threads operating on shared data. I used a mutex as follows : pthread_mutex_t mutex; int shared_var = 0; void thread1() { pthread_mutex_lock(&mutex); // Lock the mutex if (shared_var == 3) { // do something, then decrement shared_var shared_var--; } pthread_mutex_unlock(&mutex); // Unlock the mutex } void thread2() { pthread_mutex_lock(&mutex); // Lock the mutex shared_var++; pthread_mutex_unlock(&mutex); // Unlock the mutex } Then I was asked to do this in a lockless way using atomic v
I have a Python list containing integers. The definition of my event: Look at each element of the list and check if that element is greater than a specified number, say S. If before that element, there is a zero, then the Event is recorded. That zero may not be immediately before, however after occurrence of similar past event. I have this list for S = 6: List = [3, 5, 6, 0, 2, 5, 6, 8, 3, 0, 7] There are 2 such events at indices 7 and 10. What is an efficient method to achieve this? A for loop for a large list may not be efficient.
I am trying to calculate the employee labor cost per case at my company in Google Sheets. At my company, a client calls in saying they want to buy flowers from us. At this point, we open a case for the client and assign one of our employees as the case owner. The case owner works with the client for a couple days to get them exactly what they want, then ships the flowers out and closes the case. I want to know how much this employee is costing our company. If we pay that employee $20/hour, how much money are they costing our company for a given case? If this employee was assigned just 1 case a
With this HTML: #tx1, #tx2 { visibility : hidden; } <span id="ttt"> <span id="tp1">s<span id="tx1">P</span></span><span id="tp2">o<span id="tx2">T</span></span> </span> I get this: "s o" Not what I expected which is this: "so"
I'm confused with the difference between Credential Manager and Windows Vault. Windows says Credential Manager lets users store credentials relevant to other systems and websites in the secure Windows Vault Credential Locker is a service that creates and maintains a secure storage area on the local computer that stores user names and passwords the user saved from websites and Windows 8 apps. Credential Locker is accessed through Credential Manager in Control Panel as part of the local User Account management feature. Credential Manager uses the Credential Locker, formerly known as Windows Vaul
I have a list of points (x,y) that constitute a polyline, each point also has a value (m). I want a polygon which is the buffer of the polyline with variable distance m. So at each point, the polygon is 2×m wide (if not overlapping), perpendicular to the direction of the polyline at that point. A recipe is: Divide up linestring into segments. For each segment: buffer the 2 end points, each point with it's value Take the convex hull of the buffers Union all convex hulls. I am looking for a solution that is computationally faster than implementing these steps naively using the corresponding shap
The sortf function from Chapter 12 of the book "On Lisp" originally used get-setf-method, which is currently unavailable in a recent SBCL by default. Therefore, get-setf-expansion was used instead of get-setf-method in a modified version of sortf. However, the modified sortf does not work, because get-setf-expansion returns the same symbol with the fixed name #:NEW1 rather than a symbol created from gensym. The problem of the same symbol name results in different macro expansions between two versions of sortf. For example, when executing (macroexpand-1 '(sortf > x (aref ar (incf i)) (car lst))
I'm not a Python specialist, so bear with me. I'm trying to replace a Perl HTML::TokeParser based parser that I use for template foreign language translation to use Python html.parser. Here's the prototype code which nearly gives me what I want. import deepl from html.parser import HTMLParser class MyHTMLParser(HTMLParser): def handle_starttag(self, tag, attrs): result = '<' + tag + '>' print('start ' + str(result)) for attr in attrs: print(" attr:", attr) def handle_endtag(self, tag): result = '</' + tag + '>' print('end ' + str(result)) #print("End tag :", tag) def handle_data(self, data): s
I am plotting a pandas data frame with 4 columns. Either one or two of the four columns may have Nan or the entire column may be missing. In my code below, I get the error TypeError: unhashable type: 'Series' In the below code, commenting out the first two plots gives plots 3 and 4. Including either of plots 1 and 2 leads to the above error indicated for the line if x_col in df.columns and y_col in df.columns: I do not understand the example given in lib/python3.12/site-packages/pandas/core/indexes/base.py", line 5358 My problem is the definition of the function I adapted from an SO post. In t
I am plotting a pandas data frame with 4 columns. Either one or two of the four columns may have Nan or the entire column may be missing. In my code below, I get the error TypeError: unhashable type: 'Series' import pandas as pd import matplotlib.pyplot as plt import numpy as np import datetime fig, ax = plt.subplots(figsize=(10, 10)) data = {'x': [1, 2, 3,4, 5, 6], 'y': [4, 5, 6, 7, 8, 9],'a': [1, 3, 2, 3, 2, 1], 'b': [0, 0, 0, 0, 0, 0]} df = pd.DataFrame(data) #Convert day numbers to dates #**************************** days = {} for i in range(0, 6): days[i] = (datetime.datetime(1999, 10, 1)
I'm trying to create a chart, that looks like a Ridgeplot (for examples see this and this), but has smoothed Area charts with a categorical x-axis as a basis. Why standard Ridgeplot libraries don't work: Ridgeplots are usually used to display densities, which means you have a numerical x-axis. That's why in Plotly ridgeplots are considered as a variation of a violin plot. Do you have any suggestions how this could be implemented?
I'm working on a small tool in C# and using .Net MAUI. Part of it is loading a website and parsing a list of items from that site. I can load and parse the elements, but the site has a "load more" button instead of pages for the item list. Thus, I need to push that button via code until all elements are loaded and hence get the full html for parsing. Based on what I found online I tried using angleSharp b = ( IHtmlElement )document.GetElementsByClassName("theClassName").First(); b.DoClick(); as well as the MAUI WebView component myWebview.EvaluateJavaScriptAsync(@" var button = document.queryS
I'm working on a multilingual Laravel 12 app. All my routes are grouped under a {locale} prefix, like this: Route::prefix('{locale}') ->group(function () { Route::get('/activities/{activity}', [ActivityController::class, 'show']) ->name('activities.show'); }); In my Localization middleware, I set the locale and define URL defaults: <?php namespace App\Http\Middleware; use Closure; use Illuminate\Http\Request; use Illuminate\Support\Facades\App; use Illuminate\Support\Facades\URL; use Symfony\Component\HttpFoundation\Response; /** * Middleware to set the application's locale based on URL parame
I have a problem with executing the code after submitting. The case should be very simple, but I don't understand why it doesn't work. I have a form on the page 24: Default buttons: And default settings for them (ex.create): DML created by default works fine. As I press "CREATE" button, default DML execute: [ Trying to call any other processing, regardless of the server-side condition, never works. For example: Processing -> Execute Code -> insert into test(test) values ('test'); commit; The above case has the same server side condition as DML which works I've tried various methods: no server-
I'm attempting to use Massif to profile heap usage of an application. I'm running with the --pages-as-heap=true option and am confused by some output I'm seeing. Specifically I'm seeing allocation by free - I did not think free should be causing any memory to be allocated. Here's some partial output, sensitive / irrelevant stuff elided from the middle: 1| ->35.94% (2,952,790,016B) 0x656C2A2: new_heap (in /usr/lib64/libc.so.6) 2| | ->35.94% (2,952,790,016B) 0x656CF2A: arena_get2.part.0 (in /usr/lib64/libc.so.6) 3| | ->35.94% (2,952,790,016B) 0x656F6B0: tcache_init.part.0 (in /usr/lib64/libc.so.
I'm currently taking a Numerical Analysis course, where we use Octave for a bunch of exercises. The teacher instructed us to use Octave with the GUI to make it easier for us, and I have no difficulty with that. We have sequences of exercises to write some parts out and code some matrix operations, etc to learn Octave and the course material at the same time. In the past, I've used Jupyter notebooks (and even straight .py files) to alternate some writing/comments with Python code for this sort of computing + math course. I'd like to do this, but apparently when I save files, I can only save the
I am migrating a Spring Boot application from version 2.6.6 to 3.5.0, and upgrading the JDK from 17 to 21. Previously, I was using the graphql-kickstart dependency, but I have replaced it with the built-in Spring Boot GraphQL dependency. There’s something I was able to do with graphql-kickstart that I can’t do with the new dependency. Previously, I had the following setup: file.graphqls myFunction(dateField: String): OutputDTO file.java public OutputDTO myFunction(Date dateField) { ... } After migrating Spring Boot and the GraphQL dependency, my Java code now looks like this: @QueryMapping pub
How can I serve OpenGVLab/InternVL3-1B with vLLM? I tried running: conda create -y -n vllm312 python=3.12 conda activate vllm312 pip install vllm vllm serve OpenGVLab/InternVL3-1B --trust_remote_code but I get the "ValueError: Failed to apply InternVLProcessor" error upon initialization: (EngineCore_DP0 pid=6370) ERROR 10-16 19:45:28 [core.py:708] File "/home/colligo/anaconda3/envs/vllm312/lib/python3.12/site-packages/vllm/multimodal/processing.py", line 1080, in call_hf_processor (EngineCore_DP0 pid=6370) ERROR 10-16 19:45:28 [core.py:708] raise ValueError(msg) from exc (EngineCore_DP0 pid=63
I’m building a scraper to monitor the Meta (Facebook) Ads Library for new ads as soon as they start running. From inspecting network requests, I see that the Ads Library web app uses a GraphQL endpoint: POST https://www.facebook.com/api/graphql/ x-fb-friendly-name: AdLibrarySearchPaginationQuery The request body looks like this (sanitized example): text doc_id=7268381195839281 variables={ "search_input": { "q": "ganancias", "country": "PA", "ad_type": "ALL", "active_status": "ACTIVE", "media_type": "ALL", "search_type": "KEYWORD_UNORDERED" }, "count": 30 } The response includes search_results_
Does anyone know if I can nest the schedule inside an object like so: { "$schema": "https://docs.renovatebot.com/renovate-schema.json", { "description": "Schedule to run daily at night", "schedule": ["* 20-23,0-6 * * *"] } "timezone": "Europe/London", ... } Because I saw in the documentation they use: { "description": "Schedule daily before 4 AM", "schedule": ["* 0-3 * * *"] } but it's probably referring to the top level config braces... I tried to configure scheduling for Renovate but I think that nesting is not allowed.
I’m developing an MQL5 Expert Advisor that should connect to a local TCP server (127.0.0.1:5001). The server is running and responds correctly to Telnet. In MetaTrader, I added 127.0.0.1:5001 in Options → Expert Advisors → Allow WebRequest for listed URLs. Firewall is disabled, and the port is free. My MQL5 code is: int socket; int OnInit() { socket = SocketCreate(); if(socket == INVALID_HANDLE) { Print("SocketCreate failed"); return(INIT_FAILED); } if(!SocketConnect(socket, "127.0.0.1", 5001)) { Print("SocketConnect failed with error: ", GetLastError()); return(INIT_FAILED); } Print("Connecte
We use the mspace feature of Doug Lea's Malloc (dlmalloc). We have an mspace with 250 MB of objects and free all the objects. After calling mspace_trim() the size is 150 MB. We were hoping for much smaller. When I look at mspace_trim() I do not see it freeing large and small bins. Is there a way to force freeing bins so we can get back more memory?
I have added the following code to my WordPress site using the Code Snippets plugin. The code is intended to display a "View Product" link in addition to the "Add to Cart" button for WooCommerce. The code works on the main Shop page and on product category/tag archive pages. The Issue The "View Product" link does not appear for Related Products, Cross Sells, or Handpicked Products. I need the link to appear for all items wherever product cards are displayed on the website. This is the code currently implemented: /** * @snippet Add ‘View Product’ button before ‘Add to Cart’ in WooCommerce * @co
I am trying to set up a reverse proxy using a Cloudflare Worker to serve content from two different hosting providers under a single domain. main domain is pointed to WebFlow and sub domain is being used for wordpress. Suppose Main domain is abc.com and I want that when someone try to access URL like abc.com/service-page it should open wordpress. I tried cloudflare's worker to achieve that but its not working at all. addEventListener("fetch", event => { event.respondWith(handleRequest(event.request)); }); async function handleRequest(request) { const url = new URL(request.url); const pathname