I have a class in VB.NET. The definition of this class is re-defined according to need. For example: TR as char(2), F1 as Char(10) then later TS as Char(2) F1 as float. I want to define one class and be able to define 2 derived classes C1 and C2 respectively with the field definitions I mentioned above. Is it possible in VB.NET?
I designed Turing machine that accepts the input over the language: {a^i b^j | j is divisible by i, i ≥ 2, j ≥ 2} This Turing machine should accept and reject the stings as following: aabbbb | Accept bab | Reject aabbbb | Accept aabbbbbbbb | Accept aaaabbbbbbbbb | Reject aaabbbbb | Reject Here is the transition diagram that I draw in JFLAP. After trying so many times, I am still unable to get the desired output:
I am using stripe for payment purposes. Here the thing is that I am passing my stripe key and oauth token to the view in following way: The controller part return view($filepath, [ 'stripe_key' => $this->getApiKey($project), 'oauth_token' => $project->stripe_oauth_token, ]); and inside my view i am using it as @if( !empty($oauth_token) ) const stripe = Stripe("{{ $stripe_key }}", { stripeAccount: "{{ $oauth_token }}" }); @else const stripe = Stripe("{{ $stripe_key }}") @endif How can I secure it in terms that they can be use as well as not shown in the client side. Currently i did was to encod
I'm using Visual Studio Code for website development, HTML, CSS, Javascript and PHP. I'm trying to find a way to start the PHP Server automatically when I load Visual Studio Code. It is just cumbersome to click PHP Server: Server project the first time then click PHP Server: Open file in browser every other time.
I'd like to know what would be the permission of a mutable parameter of a function which holds a mutable reference, and how would the permissions change if the parameter is holding a non-mutable reference? fn mod_string(mut name: &mut String) { *name = "B".to_string(); } For this piece of code, what would be the permissions for name variable in terms of R, O, W, F, as mentioned in the Rust Book? I'm just playing around to get a better understanding of ownership, references and permissions. I'm learning Rust from the experimental Rust Book.
My job runs daily and I want to start a task on the second working day of the month. I can set up another job and use cron pattern 0 0 0 2W ? MON-FRI but I want to keep everything in the same job. A combination of {{job.start_time.day}} and {{job.trigger.time.is_weekday}} in if/else conditions still runs if the first day of the month is a Sunday. How do I check if the current day is the second day, a weekday, and if the previous day is also a weekday? On a month where the second working day is between Tuesday and Friday it works. On a month where the second working day is between Saturday and
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
When sending a prompt with a schema/json schema, I'd like to ensure that some values would be always present with a default if they are not mentioned in the prompt. Both Gemini API and Vertex API accept Schema and JSON Schema, but I couldn't find in the docs how default values are treated. Note: I am using google.genai sdk and pydantic for simplicity, but the idea is the same for a REST call and for the Vertex API. In the example below, I'm setting the default values: flag = False, op = "all" and min_value = 42. But default values are not present in the required field of the schema (Foo.model_
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