QuestionId
stringlengths
8
8
AnswerId
stringlengths
8
8
QuestionBody
stringlengths
91
22.3k
QuestionTitle
stringlengths
17
149
AnswerBody
stringlengths
48
20.9k
76390268
76390820
Correct way to check redis key's type in lua script. I'm trying to wrap my head around redis lua scripting and I can't find the correct way to check what type the key has. Here is what I've tried: 127.0.0.1:6379> SET test_key test_value OK 127.0.0.1:6379> GET test_key "test_value" 127.0.0.1:6379> EVAL 'local type = red...
How can I correctly check the type of a Redis key in Lua scripting?
I've found the answer here: Using the TYPE command inside a Redis / Lua Script Short answer is that in lua scripts redis.call("TYPE", key) returns not string but lua table with key "ok" which holds string value of the type. So to check the type of the key you should compare like this: if redis.call("TYPE", key)["ok"] =...
76392221
76392309
I am currently using Redis as a vector database and was able to get a similarity search going with 3 dimensions (the dimensions being latitude, longitude, and timestamp). The similarity search is working but I would like to weigh certain dimensions differently when conducting the search. Namely, I would like the simila...
How can I prioritize dimensions in a Redis vector similarity search?
You can re-weight the vector to make certain dimensions longer than others. You're using an L2 distance metric. That uses the standard Pythagorean theorem to calculate distance: dist = sqrt((x1-x2)**2 + (y1-y2)**2 + (z1-z2)**2) Imagine you multiplied every Y value, in both your query and your database, by 10. That wou...
76388796
76390832
I am trying to build a library using this C++ code: #include <pybind11/pybind11.h> namespace py = pybind11; PyObject* func() { return Py_BuildValue("iii", 1, 2, 3); } PYBIND11_MODULE(example, m) { m.def("func", &func); } But when I tried to run this Python 3 code: import example print(example.func()) It gi...
Why pybind11 can not recognize PyObject* as a Python object and how to fix it?
So, first off, what are you trying to do with your function? Making a raw python API call (Py_BuildValue, https://docs.python.org/3/c-api/arg.html#c.Py_BuildValue) is strongly discouraged, that is why you are using PyBind11, to handle that for you. What are you trying to do with this line? Py_BuildValue("iii", 1, 2, 3)...
76391978
76392317
I'm trying to shade a scatter plot based on time of day, but my data is in datetime format. Getting either time of day or hours past 00:00 would work. I tried to get just the time from datetime, but I got the following error. TypeError: float() argument must be a string or a number, not 'datetime.time' Ideally, I'll ...
How to get time from datetime into a string/number for a colormap
I figured it out and it was actually very simple. Instead of above_aligned["timestamp"].dt.time, I just used above_aligned["timestamp"].dt.hour.
76390504
76390835
Is it possible to access a public domain e.g. foo.bar.com from an AWS ECS task running on a private subnet? It is convenient for me that the task is running on a private subnet since it can be easily accessible from other ECS tasks running on the same private subnet (same AZ, VPC and region). I am reading different con...
AWS ECS Task on private subnet connectivity
You have to create a NAT Gateway and add a route in the route table for your subnet. Without a NAT Gateway (or NAT instance, but those are considered obsolete), you cannot connect to the public internet from your private subnets.
76391183
76392333
In the following PowerShell code, functions hour00_numbers and hour01_numbers create two arrays, that contain numbers matching a specific regex. function hour00_numbers { foreach ($event in $filter00) { $hour00Numbers = @() $hour00Numbers += [regex]::Matches($event.Source.Summary -replace ' ', '9 *[...
compare two PowerShell arrays only if they both contain values
Aside from the problem you've reported, your code has a few other issues: Use of global variables to pass values into (and out of) functions - e.g. $filter00, $filter01 and $matchingNumbers01. It's hard to reason about these in isolation because they depend on program state that exists outside their scope. Duplicatio...
76388777
76390883
I am trying to retrieve the meta data for a given links (url). I have implemented the following steps: $url = "url is here"; $html = file_get_contents($url); $crawler = new Crawler($html); // Symfony library $description = $crawler->filterXPath("//meta[@name='description']")->extract(['content']); Doing so, I manage t...
PHP function file_get_contents($url) returns special characters
I have solved the issue by adding the following parameters to file_get_contents functions: private const EMBED_URL_APPEND = '?tab=3&object=%s&type=subgroup'; private const EMBED_URL_ENCODE= 'CM_949A11_1534_1603_DAG_DST_50_ÖVRIGT_1_1'; $urlEncoded= sprintf($url.self::EMBED_URL_APPEND, rawurlencode(se...
76390329
76390859
I have data plotted as points and would like to add density plots to the graph. The marginal plot solutions from ggExtra or other packages are not giving the freedom that I'd like and so want to generate the density plot at the same time as the ggplot. df = data.frame(x = rnorm(50, mean = 10), y = runi...
Change x or y position of density plot
you can shift the position with position_nudge: ## using your example objects: ggppp + geom_density(mapping = aes(y = y , col = id), position = position_nudge(x = 12), inherit.aes = FALSE ) + geom_density(mapping = aes(x = x, col = id), position = positio...
76391826
76392344
I'm trying to create a Snackbar in my Android Java application. It has an action, displayed as Cancel, that should stop (or return) the parent method. I tried this: snackbar.setAction("Cancel", v -> { return; }); But Android Studio told me that 'return' is unnecessary as the last statement in a 'void' method showing...
Lambda expression returns parent method
NB: This answer applies generally to UI frameworks/java, not android in particular. What you want to do here makes fundamentally no sense. The setAction method is telling the snackbar object: Hey, whenever the "Cancel" event occurs, run this code. Don't run it now, run it later. Maybe a year later, when the user bother...
76380894
76391234
I'm working on a GWT application using Domino/UI, Nalukit and the Javascript plugin FullCalendar v6. I made a custom popup to modify and delete an event but when I validate the form, my calendar refreshes and all the event in my week view disappear. Demo of the app running I used the native function gotoDate to change ...
FullCalendar in GWT : How to refresh calendar while keeping events
Solved my issue by loading the events in a callback and refetching them in my refreshCalendar method : @Override public void refreshCalendar() { if (lastModifiedEvent != null) moveToLastEventModifiedDate(); else mainCalendar.refetchEvents(); } /** * Use the last modifi...
76390427
76390861
My goal is to evaluate a basic symbolic equation such as ad(b + c) with my own custom implementaions of multiply and addition. I'm trying to use lambdify to translate the two core SymPy functions (Add and Mul) with my own functions, but I cant get them recognised. At this stage I'm just trying to get Add working. The c...
Can SymPy Lambdify translate core functions like Add and Mul?
With sympy, addition is an operation. Hence, I'm not sure if it's possible to achieve your goal by passing in custom modules... However, at the heart of lambdify there is the printing module. Essentially, lambdify uses some printer to generate a string representation of the expression to be evaluated. If you look at la...
76388602
76391241
xero developer api not authorizing i generated the access_token from the endpoint postman screen shot for access token when i try to get xero item i am getting screen shot for item end point this endpoint should give the item with identifier 96d14376-4b75-4b4a-8fd3-b1caab075ab3 in the response also when i try this one ...
Why am I unable to retrieve a Xero item by identifier with a valid access token from Postman?
Looking at the logs relating to the instance id in the error screen shot, the access token does not include the accounting.settings scope. Please can you go through the OAuth 2.0 process from the very beginning, making sure the scope is in the authorisation call. When you add a new scope to a call you need to go throug...
76388769
76391245
I have a use case where I have to call two different methods in a reactive pipeline Java 8 on a post-API call. 1st Method: will insert data in a master table and will return the pk of that table insertion. 2nd Method: this method will insert data in the mapping table which will use the pk received from 1st method. I tr...
Call Different Method in reactive pipeline
You can easily do it using the map or flatMap operator, depending on what type of repository you have - reactive or not reactive. Here is examples for both cases: public class YourService { private final YourRepository repository; private final YourReactiveRepository reactiveRepository; void doAction() { ...
76384653
76390867
I need to sort a dataframe based on the order of the second row. For example: import pandas as pd data = {'1a': ['C', 3, 1], '2b': ['B', 2, 3], '3c': ['A', 5, 2]} df = pd.DataFrame(data) df Output: 1a 2b 3c 0 C B A 1 3 2 5 2 1 3 2 Desired output: 3c 2b 1a 0 A B C 1 5 2 3 2 2 3 1 So the column...
Sort pandas dataframe columns on second row order
With the help of pyjedy and Stingher, I was able to resolve this issue. One of the problems was due to my input. The input consisted of lists instead of dictionaries, so I needed to transform it. As a result, I had indexes for rows and across the top for columns. Consequently, selecting elements from the list required ...
76392302
76392348
I'm having a problem to combine list of lists of tuples, and the main problem comes from different sizes of those tuples. I'm also trying to do it "pythonic" way, which isn't very easy. What I actually have is a list of objects, having coordinates given in tuple. Objects (let's say: lines) always have start and end as ...
Combine list of lists of tuples with different lengths
A solution with zip and *-unpacking of the variable-length path element is reasonably clean: from pprint import pprint start=[ (3,5), (23,50), (5,12), (51,33), (43,1)] end = [(23,19), (7,2), (34,4), (8,30), (20,10)] path=[[(10,7),(14,9),(18,15)], [], [(15,7)], [(42,32),(20,31)], [(30,7)]] who...
76382247
76392356
I'm new to Blade and tried to use anonymous components for sections that I will use frequently. The problem is that when I'm trying to pass down data to the component, it won't show anything. Here is my Code: Controller: public function edit(Workingtime $workingtime) { $user = User::find(Auth::id()); $w...
Blade: anonymous component doesn't show when passing data
In workingtime-edit.blade.php you need to remove the spaces around the = for the attribute you are setting: <x-workingtime-timeline :workingtimeArray="$workingtime_array"/> I think this is a limitation of Laravel's parsing of component attributes, since this is not a general requirement of HTML attributes.
76388523
76391330
I am trying to add a new category to an email item using Exchange WEB Services but when I run the code, existing categories disappear and the category I added becomes the only category. For example an email has categories X and Y and after I add my category Z to this mail item, X and Y disappears and only category for ...
How can I prevent existing categories from disappearing when I add a new category to an email item using Exchange Web Services in C#?
The line EmailMessage message = EmailMessage.Bind(exchange,msgid, BasePropertySet.IdOnly ); only requests the message id. You need to request categories. See if BasePropertySet.FirstClassProperties brings categories in. If not, explicitly request categories.
76389988
76390898
I'm building a react app with vite and I'm deploying it with docker. When deploying the container, npm run build runs but does nothing, even doing it inside the container manually won't work. I get this output but the actual build does not happen: $ npm run build > frontend@0.0.0 build > tsc && vite build $ Thing is...
npm run does not work as expected on a docker container
Your Compose file has volumes: blocks that replace all of the image content with content from named volumes. This apparently works the first time you run the container, since Docker copies content from the image into an empty volume; but if you rebuild your application, the volume will not get updated, and the old con...
76387981
76391438
My file has a .z.json-extension and can be found here. The content of the file is "7ZQ7a8MwFIX/i2Yn3IekK3nv3EIztCkdQslgSpySuFPwf6+USMZZbiGzFyODPs7RuY+LeTmeu6E79qb9uJhNd9ifh93hx7SGgHgFbkVhg7Z10kJcB+YAIFvTmKd+OHX7s2kvBvPnddgNv+nXPPeb0+7rO115M+1KPGFj3vMJbTptTeuAx8aQAnkrcIMi51OGMENWg4TjDQrRuwJRghBUqTBJoZ9T2qu8g6IVyVOhJFOaw...
How to read and translate a filename.z.json file
That is Base-64 encoded raw deflate data. You need to decode the Base-64 to binary, and then use zlib to inflate it. The result is 2278 bytes of json.
76391843
76392387
Take the following series: import pandas as pd s = pd.Series([1, 3, 2, [1, 3, 7, 8], [6, 6, 10, 4], 5]) I want to convert this series into the following array: np.array([ [ 1., 1., 1., 1.], [ 3., 3., 3., 3.], [ 2., 2., 2., 2.], [ 1., 3., 7., 8.], [ 6., 6., 10., 4.], [ 5., 5., 5...
Cast pandas series containing list elements to a 2d numpy array
Assuming all list elements have the same length (as indicated), what about using masks and numpy.repeat? s2 = pd.to_numeric(s, errors='coerce') m = s2.isna() out = np.repeat(s2.to_numpy()[:, None], 4, axis=1) out[m] = np.array(s[m].tolist()) Output: array([[ 1, 1, 1, 1], [ 3, 3, 3, 3], [ 2, 2, 2...
76385124
76390930
I have converted a sklearn logistic regression model object to an ONNX model object and noticed that ONNX scoring takes significantly longer to score compared to the sklearn.predict() method. I feel like I must be doing something wrong b/c ONNX is billed as an optimized prediction solution. I notice that the difference...
ONNX performance compared to sklearn
Simply converting a model to ONNX does not mean that it will automatically have a better performance. During conversion, ONNX tries to optimize the computational graph for example by removing calculations which do not contribute to the output, or by fusing separate layers into a single operator. For a generic neural ne...
76392330
76392389
I have a Node table with a ParentID column, which refers to a NodeID that is its parent. I want to make sure no Node can refers to itself (i.e. a Node's ParentID cannot its own NodeID), so I tried adding a check constraint CHECK(NodeID != ParentID). However, I got this error: Error Code: 3818. Check constraint 'node_ch...
How can I make sure a SQL record's column doesn't refer to its own primary key?
Use a trigger: mysql> create table node ( id int auto_increment primary key, parentid int, foreign key (parentid) references node (id) ); mysql> delimiter ;; mysql> create trigger no_self_ref after insert on node for each row begin if NEW.parentid = NEW.id then signal sqlstate '45000' message_text = 'no se...
76380833
76391584
ActivityResultLauncher<PickVisualMediaRequest> pickImage = registerForActivityResult(new ActivityResultContracts.PickVisualMedia(), uri -> { if(uri==null) { //URI always NULL here } else { //Never reached } }); pickImage.launch(new PickVisualMediaRequest.Builder()...
Android PhotoPicker returns NULL URI
Apparently, PhotoPicker (or ActivityResultLauncher in general) fails if onActivityResult() is also Overridden in the Activity. I removed that and now PhotoPicker is returning a valid URI.
76384047
76390948
I know this question has been asked many times however, none of the solutions have worked for me. I am trying to dockerize my angular app and node js backend using nginx. What I have done is that I have created a docker-compose file. It has three services and nginx. 1: space-frontend 2: space-api 3: mongodb I am callin...
host not found in upstream with nginx docker compose
So guys problem was that we have to run every container on same network. networks: - node-network I had to define this in my every service. Then it ran without any problem. Thank you for everyone who helped :)
76389362
76390959
Can't update username of existing RDS cluster Updating the masterUsername and masterUserPassword in the serverless.yml file for my postgresql database results in the password being updated but not the username. i.e. I can only access the db with the old username and new password. I am using the serverless framework to ...
How can I update the master Username and password of and existing AWS RDS cluster using the serverless-framework?
I understand you want to update the MasterUsername property on an existing RDS instance that you created with Serverless Framework. Serverless Framework uses AWS CloudFormation. According to the AWS CF docs, the MasterUsername property cannot be updated on an existing RDS instance. Any attempt will result in a resource...
76392138
76392427
I would like to open a font file and modify eg the usWeightClass and save it in a different location – using Rust: https://github.com/googlefonts/fontations I am already able to load a file, read data from the font, but I am not able to modify and save it. I expect, that it should work somehow with WriteFont (but I don...
How do I modify a font and save it with Rust 'write-fonts'?
I haven't worked with this library or with fonts in general yet, but after a little digging in the documentation, this seems to work: use read_fonts::{FontRead, FontRef, TableProvider, TopLevelTable}; use write_fonts::{dump_table, tables::os2::Os2, FontBuilder}; fn main() { { let font_data = std::fs::read(...
76392283
76392432
I see syntax for if pass but not finding syntax for if elif pass: List comprehension with else pass Basically if condition: something elif condition something else pass
List comprehension in Python for if, elif, pass?
Use an if at the end of the list comprehension (a filter) in order to completely exclude an item from the list. For example, if you wanted to do this as a list comprehension: result = [] for i in range(10): if i % 2: result.append("two") elif i % 3: result.append("three") else: pass...
76390270
76391014
VS Code error hi-lighting can offer quite a bit of clutter during code edits with its squiggles and colorization. It is a useful horn but once the problem is noticed it can become a nuisance that even makes it difficult to perceive the text and fix the problem. I don't think this feature was intended to get in the way....
how do temporarily turn of vs-code error highlighting
you can use the extension When File Add this setting to your workspace settings.json "whenFile.change": { "byLanguageId": { "rust": { "whenDirty": { "editorError.foreground": "#ff000020", "editorWarning.foreground": "#ff000020", "editorInfo.foreground": "#ff000020" ...
76388820
76391781
As you can see in C# Unity container, we can configure a container (a list of dependency and object creation policy) from a file, and it is very good when, I want change a dependency (backend for interface) in the runtime environment without need to upload my project again, or in a dockerise paradigm, I do not need to ...
How can the ASP.NET built-in DI read dependencies from a file at runtime?
While you could have a hard time making the new service provider compatible with Unity, consider switching to Autofac. Autofac can replace the builtin .NET Core's container and also it supports loading configuration from a file.
76392223
76392509
I have problem working with unicode strings, wchar_t type. In my program I'm getting input as wchar_t and I'm supposed to XOR it and write it to file and read it back and print it to command line. This is my code, const unsigned int XORKey = 0xff; size_t XORit(const wchar_t* value, wchar_t* xorred) { size_t leng...
How can I XOR wchar_t input, write it to a file, and read it back in C?
Here ... printf("Un-XOR'ed\n\t"); for (int i = 0; i < samplelen; i++) { printf("%02X ", unxorred[i] ^ XORKey); } printf("\n"); ... you print out the decoded values without storing them. When you then ... printf("%ls", unxorred); ... you are printing the data as read back from the file,...
76390597
76391091
I have a few dataframes, let's call them rates, sensors with "session_start", "value_timestamp" (timestamps) and "value" (float) columns. I want to add an "elapsed" column, which I've done successfully using the following code: def add_elapsed_min(df): df["elapsed"] = ( df["value_timestamp"] - df["session_start"]...
What's the idiomatic way to add a calculated column to multiple data frames?
Although I cannot create your warning in Pandas 1.5.3 and considering using .loc does not suppress the warning for you, one other option is to use df.insert instead. def add_elapsed_min(df): elapsed = (df["value_timestamp"] - df["session_start"].min()) / 60.0 df.insert(df.shape[1], 'elapsed', elapsed) for df in [r...
76388425
76392087
I was reading the documentation here https://developer.shopware.com/docs/guides/plugins/plugins/storefront/add-custom-javascript but cannot find a mention on how to make usage of environment variables in a javascript plugin. Currently I tried to put a .env file at the root of my plugin in custom/apps/MyPlugin/.env and...
Javascript plugin and environment variables
Here's one way to do it... First create a custom webpack.config.js at src/Resources/app/storefront/build. Also in that build directory run npm install dotenv, as you will need it to parse your .env file. Your webpack.config.js could then look like this: const fs = require('fs'); const dotenv = require(`${__dirname}/nod...
76388652
76392101
I have an interface on PyQt5, in which, by pressing the Start button, a graph is built, which I made using PyQtGraph. Three lines are drawn on the chart. Green and blue have a y-axis range of 0 to 200, while red has a range of 0 to 0.5. How can I make different scales for different lines, as well as designate two value...
Different scales for PyQtGraph chart axis in PyQt5
Check out the MultiplePlotAxes.py example. To add another axis on the right change the setup_graphs function and add update_views: def setup_graphs(self): pen_ipd_1 = pyqtgraph.mkPen(color='green', width=4) pen_ipd_2 = pyqtgraph.mkPen(color='blue', width=4, style=Qt.DashDotLine) pen_iopd = p...
76389456
76391095
I have a dictionary where jumps happen in its keys. How can I find the key in between each group where the value is minimum? For example, I have myDict = { 0.98:0.001, 1.0:0.002, 1.02: 0.0001, 3.52:0.01, 3.57:0.004, 3.98: 0.005, 4.01: 0.02, 6.87: 0.01, ...
Finding keys with the minimum values in each group in a dictionary with jumps (Python)
Here is a solution, supposing the dictionary is sorted in ascending order according to key (explanations in the comments of the code): def main(): d = { 0.98: 0.001, 1.0: 0.002, 1.02: 0.0001, 3.52: 0.01, 3.57: 0.004, 3.98: 0.005, 4.01: 0.02, 6.87: 0.01, 6.90: 0.02, 6.98: 0.001, 7.0: 0.02 ...
76391230
76392528
Consider the following quarto document: --- title: "Untitled" format: pdf --- ```{python} #|echo: false #|result: 'asis' import pandas as pd df = pd.DataFrame({'A': ['foo', 'foo', 'foo', 'bar', 'bar', 'bar'], 'B': ['one', 'one', 'two', 'two', 'one', 'one'], 'C': ['dull', 'dull', 'shiny', 'shiny', 'dull', 'du...
Change the font size of the output of python code chunk
I can suggest two approaches to do this, use whatever suits you! Option 01 Code chunk outputs are wrapped inside the verbatim environment. So to change the font size for a single code chunk, one option could be redefining the verbatim environment to have a smaller font size just before that code chunk and then again re...
76387093
76392720
Can't update variables inside data in Vue I'm creating a project using Vue 3 as frontend. In Dashboard.vue, a GET request will be sent to backend with token in header, in order to let the backend identify user's identity, then Vue will receive the response with a json including info like this: {'uid': 'xxx', 'username'...
Why does Vue.js not update variables inside data
The issue is asynchronous execution. In require_get, you update this.temp in the .then() callback, which is only called when the Promise has resolved. In get_user_info, you are calling require_get and then immediately (synchronously) trying to read the data. Because it is fetched and set asynchronously, it is not yet p...
76387206
76392909
Is it possible to resolve SASS contained in a workspace library using an approach that is similar to resolving ts files from an application within the same workspace? For context I'll setup a real workspace as follows: ng new theme-workspace --create-application=false cd theme-workspace ng g library theme mkdir projec...
Resolving a library projects SASS files from an application in the same workspace?
Currently this is not supported, but there is a feature request for it.
76389947
76391113
I'm using the plugin avenc_jpeg2000, from gst-libav module, combined with videotestsrc and filesink plugins for encoding a raw picture to a JPEG2000 picture: gst-launch-1.0 videotestsrc num-buffers=1 ! avenc_jpeg2000 ! filesink location=/tmp/picture-ref.jp2 This pipeline works and produce a 31.85 KiB (32,616) file. e...
How to increase the compression ratio of a JPEG2000 file with "avenc_jpeg2000" GStreamer encoder?
For lossy compression, you can increase the value of the quantization. First, set the encoding type of the encoder to "Constant Quantizer" and then, find an appropriated quantizer value. In my case, to produce a 15 KiB file, I used the following pipeline: gst-launch-1.0 videotestsrc num-buffers=1 ! avenc_jpeg2000 pass=...
76392182
76392541
I am creating a Composable which is responsible for showing notifications to users. Every time the user goes to that Composable, I want to execute a query which will clear the notification count. I only want to execute that query when the Composable has appeared, not every time the Composable is recomposed due to confi...
How to execute code every time a Composable is shown (and execute only once)
Use LaunchedEffect (link) LaunchedEffect(Unit) { // Actions to perform when LaunchedEffect enters the Composition } It takes one or more key parameters that are used to cancel the running effect and start a new one. Since you need to execute your code only once use something immutable as a key like Unit or true.
76387490
76393307
I've tried to create a simple web page that uses the Bootstrap (version 5.3.0) Collapsible and I cannot get it to work no matter what I try. All I want is a Collapsible that 'holds' a few links in it which are shown when you click it. But when that didn't work I simplified it to just a list of strings (code shown below...
What needs to be done to make the Bootstrap 5.3.0 Collapsible button show in this simple web page?
Try adding .navbar selector to the parent container: right-header navbar, because it's actually coming from that class (--bs-navbar-toggler-icon-bg), not the icon, the hamburger is actually a variable defined in .navbar, so by adding it to the parent it becomes accessible: .navbar-toggler-icon { background-image: v...
76389994
76391123
I have a Blazor server app (.Net6) with windows authentication on a Win 2019 Server with IIS. But the username and password dialog is just coming when I open the web page from the google chrome browser directly on the server where the Blazor app is running. When I try to open the page from another PC in the same domain...
I have a Blazor server app with windows authentication. But the username and password dialog is just coming when page is opened from the server side
The reason you are not prompted for a username and password when accessing the Blazor server app from another PC in the same domain is likely due to the integrated Windows authentication and the Single Sign-On (SSO) capabilities of the browser and the server. Here's a brief explanation of how this works: Integrated Wi...
76392367
76392557
When using the package googlesheets4 is there any method for writing data to a sheet skipping the first row so that the data being written to a sheet starts at row 2? I am hoping to leverage something similar to when you read a sheet and utilize ex. skip = 2 to read data starting at the 3rd row I have tried the followi...
Write to Google sheet skipping 1st row
skip=n is only for read_excel() in the googlesheets4 library to start at a specified range, you'd use range_write(). This is similar to the startRow=n in the xlsx library. range_write(ss = "google_sheet_url", data = df, range = "B1", sheet = "test")
76382024
76393367
I am trying to use a "freely" created string as a key for an object. interface CatState { name: string, selected: boolean, color: string, height: number } interface DogState{ name: string, selected: boolean, race: string, age: number, eyeColor: string } export interface Animals { ...
TypeScript is unable to infer type properly from a typed string variable
In order for this to work you need to make selectAnimal generic. You might think it should be able to deal with an animal input of a union type, but the compiler isn't able to properly type check a single block of code that uses multiple expressions that depend on the same union type. It loses track of the correlation...
76390577
76391128
I'm deploying a new kubernetes cluster on a single node (Ubuntu 22.04) The problem is I frequently get this error when running any kubectl commands (hostnames changed) The connection to the server k8cluster.example.com:6443 was refused - did you specify the right host or port? After I installed kubernetes (via apt inst...
Kubernetes: Frequently unable to communicate with kublet api (connection refused)
It seems I was having the same problem as mentioned in this question Unable to bring up kubernetes API server The solution here worked for me containerd config default | tee /etc/containerd/config.toml sed -i 's/SystemdCgroup = false/SystemdCgroup = true/g' /etc/containerd/config.toml service containerd restart servi...
76392163
76392619
I'm trying to make a stamina meter for my game that depletes as you sprint and once it hits zero you have to wait for it to charge up again before sprinting, I don't know what I should do to fix the code and don't know where I went wrong, thanks. float moveSpeed = 5f; float sprintSpeed = 8f; float maxStamina = ...
How can I create a stamina meter that depletes as I sprint and recharges after waiting in Unity using C#?
Encapsulate and simplify your logic so its easier to read and to maintain. You need to introduce a few variables that will help you keep things clean and more readable. Additionally, when unsure, write things as if you would talk in a conversation so that they make sense. For example, you wouldn't be able to sprint if ...
76381814
76393564
How to share a variable from one test (it) to another when the domains are different? I've tried in countless ways, with Alias, Closure, Environment Variable, Local Storage, even with Event Listener, but when the next test is executed, these variables are cleared from memory. The point is that I need to obtain the ID o...
How to share a variable in Cypress from one test (it) to another when the domains are different?
When the test runner changes domains the whole browser object is reset, so any variables written to browser memory are lost closure variables aliases env var (Cypress.env). That leaves you with fixture (disk storage) or task-related pseudo data store (see bahmutov/cypress-data-session). For fixture, the code would be...
76389708
76391170
From the below data- col5 is holding the no of fruits to be distributed among plates from col1 to col4(4plates). Each time find the min from the plates(col1 to col4) add 1 fruit and reduce the fruit from col5 and repeat this process till col5(fruits becomes zero). Below is some sample code to find the min and add 1 fru...
spark DF multiple Iterations on Rows
Since each row is independent, then I think it is easier to iterate within the mapping function of each row until you get the final result, so that you don't have to iterate over the whole df multiple times. import spark.implicits._ val data = Seq( (1, 2, 3, 4, 3), (6, 7, 8, 1, 2), (2, 4, 6, 8,...
76391470
76392625
I am running this script Invoke-Expression $expression -ErrorAction SilentlyContinue The variable $expression may not have a value sometimes. When It's empty, I get the error Cannot bind argument to parameter 'Command' because it is null. How can I avoid seeing the error? I want to execute Invoke-Expression regardle...
Powershell: -ErrorAction SilentlyContinue not working with Invoke-Expression
First, the obligatory warning: Invoke-Expression (iex) should generally be avoided and used only as a last resort, due to its inherent security risks. Superior alternatives are usually available. If there truly is no alternative, only ever use it on input you either provided yourself or fully trust - see this answer...
76390816
76392656
Is there a possibility to find an element by ID with an wildcard? I have something like this: stat = GC.FindElementByXPath("//*[@id='C29_W88_V90_V94_admin_status']").Value stat = GC.FindElementByXPath("//*[@id='C26_W88_V90_V94_admin_status']").Value stat = GC.FindElementByXPath("//*[@id='C29_W88_V12_V94_admin_status']"...
VBA Selenium Dynamic ID (Wildcard)
This code is tested in Excel VBA using Selenium. Option Explicit Sub sbXPathContains() Dim driver As ChromeDriver Set driver = New ChromeDriver Dim sURL As String sURL = "https://davetallett26.github.io/table.html" Call driver.Start("edge") driver.get (sURL) driver.Window.Maximize sbDela...
76390331
76391176
When I visit the Firebase Firestore Index page, it shows an issue as "Oops, indexes failed to load!". I inspect the error and it shows 429. When I view indexes through GCP, it shows as Failed to load indexes: Request throttled at the client by AdaptiveThrottler. We're in the Firebase Blaze plan and I do not see any quo...
Firebase Firestore Indexes issue: Oops, indexes failed to load
firebase here That looks off indeed. I can't reproduce myself, but I asked around and will post an update here when I hear back. 7:57 AM PT: Engineering has acknowledged the problem, and is identifying potential causes. 8:12 AM PT: The problem may be isolated to databases in Europe. 9:23 AM PT: This only affects ind...
76388475
76393618
According Ada2012 RM Assertion_Policy: 10.2/3 A pragma Assertion_Policy applies to the named assertion aspects in a specific region, and applies to all assertion expressions specified in that region. A pragma Assertion_Policy given in a declarative_part or immediately within a package_specification applies from the...
Ada2012: Assertion_Policy
And if I define the pragma Assertion_Policy at Root package specification, it will affect to the whole package hierarchy right? No. What your bolded text means is that (a) the pragma is placed immediately in a specification, like so: Pragme Ada_2012; -- Placed "immediately". Pragma Assertion_Policy(Che...
76391482
76392685
I want to plot some functions with their gradients using the ggplot2 package in r. p = 3 n0 = 100 z0 = seq(0.01, 0.99, length = n0) AB0 = matrix(rbeta(600,4,1), nrow = n0) library(ggplot2) ab.names=c(paste("g",1:p,sep=""),paste("g' ",1:p,sep="")) pl0=ggplot(data.frame(ab = c(AB0), ID = rep(ab.names, each = n0), Z = z0...
in ggplot2, print an expression in the facet_wrap
the labeller argument to facet_wrap might come in handy, if you set it to "label_parsed". Example: d <- data.frame(x = rnorm(2), y = rnorm(2), ID = c(paste0('g~', 1:2), paste0('g~nabla~', 1:2) ) ) d |> ggplot(aes(x, y)) ...
76389930
76391235
I have a Postgresql table column which's type is numeric(20,4). When I play with the data through rails console, ActiveRecord display the values in scientific notation. All I can think of adding attribute :column_name, :float to the related modal, but not sure if there will be any side effects because of it. So the que...
Easy to read scientific notation on Rails console
You can monkeypatch specifically BigDecimal class specifically for console development.rb console do class BigDecimal def inspect to_f end end end
76389774
76391268
I have one seperate database for saving logs I have middleware that saves every request with response public function handle($request, Closure $next, $logType) { $response = $next($request); CreateLog::dispatch($request, $response, $logType)->onQueue(config('queue.queues.logging')); return ...
Laravel auth()->id() not working in prod server
you need to double check multiple things: what session driver are you using? what is the queue driver are you using? is your middleware runs after session and auth middleware runs ( based on the configuration in kernal.php ) based on your question and the problem is happening only on production so probably your issue...
76394054
76394106
I'm trying to create a blind auction as part of my class, and I'm trying to get the max value. Here is the code, I tried to use the max() function but I get this error: File "Day_9_Blind_Auction.py", line 30, in <module>print(max(data))TypeError: '>' not supported between instances of 'dict' and 'dict' import os data...
How can I get the maximum bid value in a blind auction?
You are trying to apply the max() function to a list of dictionaries. The error message is telling you that you haven't specified how to tell when one dictionary is "greater than" another. It is possible to add a definition for the '>' operator that would allow it to compare dictionaries, but it's probably better if ...
76389312
76391303
Currently, when i need to access my customer's PayPal merchant account (to manage IPNs or to update notifications preferences for examples), i login to the account using his credentials and his 2FA (asking him the SMS code). Is there a feature similar to Stripe Team which allows team members to access a PayPal merchant...
How can I securely manage my client's PayPal merchant account as a web developer freelancer?
Typically you should only need to obtain API credentials to integrate with, which for current solutions are in the developer dashboard. Other account settings and operations in the account are not something web developers need access to, other than maybe some initial setup tweaks to the website preferences page. To the...
76391544
76392695
why below code run in the development mode? it should only run in production mode Here is the running scripts in package.json "build-watch-dev": "vite build --mode development --watch", import { useStore } from '@/store'; import { register } from 'register-service-worker'; export function registerSW() { if (import...
import.meta.env.PROD runs in development mode
The --mode flag overrides the value of import.meta.env.MODE. import.meta.env.PROD is effectively a boolean result of process.env.NODE_ENV === 'production' You could try changing your conditional to something like: if (import.meta.env.MODE !== 'development') { Or you could look at setting NODE_ENV to development.
76394111
76394119
So im trying to make a typescript file for a network and there are three files involved. a _Node.ts, Edge.ts, and a Graph.ts These three files look like so: _Node.ts interface _Node { data: any; neighbours: number[]; } class _Node { constructor(data) { // this data is an arbitrary thing with which I can crea...
Typescript class made up of an array of other classes gives an error
You're looking for this.edges.length as specified by https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/length size is not a valid property or function
76384590
76391320
Help me figure out what I'm doing wrong? I need to get the number of comments in 24 hours in the relation one-to-many table. class Comment(Base): __tablename__ = 'comments' id = Column(Integer, primary_key=True) task_id = Column(Integer(), ForeignKey('tasks.id'), nullable=False) post_link = Column(Strin...
Sqlalchemy count of records in the relation of one to many
async def get_comments_for_day(): start_day = datetime.utcnow() - timedelta(hours=24) async with get_async_session() as session: stmt = ( select(func.count(Comment.id), Task) .select_from(Task) .join(Comment, Task.id == Comment.task_id, isouter=True) .wher...
76389324
76391414
I have a tag column in the active admin index page like tag_column :result, interactive: true, sortable: false in my model I have a enum for result as enum result: { winner: 0, first_runner_up: 1, second_runner_up: 2} In the index page when I click on drop down the selection options are being dispalyed as winner fir...
How to change the tag column selection option
I suggest you break the rules out to a hash.. then you will be free to validate against them later WINNER_OPTIONS = { winner: { title: "Winner" }, second: { title: "First Runner Up" }, third: { title: "Second Runner Up" } RESULT_ENUMS = WINNER_OPTIONS .keys .with_index .to_h enum result:...
76390202
76391507
Let's assume I have a table users with a JSON column "foo". Values of that column look like this: "{ field1: ['bar', 'bar2', 'bar3'], field2: ['baz', 'baz2', 'baz3'] }" where field1 and field2 are optional, so column value may look like this: "{}" I want to move values 'bar2' and 'bar3' from field1 to field2 for all r...
How can I move specific values from one field in a JSON column to another in PostgreSQL?
Using a series of subqueries with jsonb_array_elements select jsonb_build_object('field1', coalesce((select jsonb_agg(v.value) from jsonb_array_elements(u.foo -> 'field1') v where v.value#>>'{}' not in ('bar2', 'bar3')), '[]'::jsonb), 'field2', (u.foo -> 'field2') || (select jsonb_agg(v.value) ...
76391464
76392770
As far as what I understand: WorkerService is the new way to define a Windows Service (app that run as as service). By default, using the contextual menu on the project, the type of configuration file associated to a WorkerService is stil a xaml file: "App.config". See: How to: Add an application configuration file to...
How to add a list of specific object in a configuration file for a WorkerService
Yes, you can, Like this: appsettings.json { "Logging": { "LogLevel": { "Default": "Information", "Microsoft": "Warning", "Microsoft.Hosting.Lifetime": "Information" } }, "AllowedHosts": "*", "MyConfigObject": [ { "Prop1": "1", "Prop2": "2" }, { "Prop1": "1...
76391280
76392775
So I'm getting Uncaught Error: when using a middleware builder function, an array of middleware must be returned This is my code import { configureStore, compose, combineReducers, applyMiddleware } from "@reduxjs/toolkit"; import thunk from "redux-thunk"; const rootReducer = combineReducers({}); const middlew...
redux tookit when using a middleware builder function, an array of middleware must be returned
configureStore from redux-toolkit (RTK) works differently from the redux createStore function. The middleware property accepts an array of middleware to install and RTK handles applying them. See configureStore /** * An array of Redux middleware to install. If not supplied, defaults to * the set of middleware return...
76390228
76391647
I have a this code: import logging import json import os from azure.cosmos import CosmosClient import azure.functions as func url = os.environ["ACCOUNT_URI"] key = os.environ["ACCOUNT_KEY"] client1 = CosmosClient(url, key) client = CosmosClient.from_connection_string(os.environ["CosmosDBConnStr"]) database_name = "dm...
upsert_item into cosmosdb via python
You are missing the id in the Upsert content. A document's identity is defined by the combination of id and Partition Key value, if you don't specify the id then Upsert will always behave as a Create operation. Because you are getting the items through a query, just add the id: query = "SELECT c.id, c.version,c.name,c....
76381180
76394128
I get two different intercept values from using the statsmodels regression fit and the numpy polyfit. The model is a simple linear regression with a single variable. From the statsmodels regression I use: results1 = smf.ols('np.log(NON_UND) ~ (np.log(Food_consumption))', data=Data2).fit() Where I recieve the following...
Different intercept values for linear regression using statsmodels and numpy polyfit
This is because you are using different linear models in the first and second regressions. In the first regression, you take logs of both the dependent and independent variables, while in the second regression, you are not, and additionally, you are multiplying y by 100. In order to get the same results as the first re...
76390103
76391730
I am new to MongoDB and trying to get multiple documents using ObjectId Below I have mentioned the demo data format. db={ "store": [ { "_id": ObjectId("63da2f1f7662144569f78ddd"), "name": "bat", "price": 56, }, { "id": ObjectId("63da2f1f7662144569f78ddc"), "name": "ball", "price": 58, }, { "id": Obj...
I want get documents using ObjectId, but it's not getting that document
For your case, you can simply wrap the payload from client in a $map to convert them into ObjectIds with $toObjectId db.store.aggregate([ { $match: { $expr: { "$in": [ "$id", { "$map": { // your payload from client here "input": [ ...
76392245
76392789
I have an issue I cannot seem to fix. I have a function that takes a file and converts it to an array using the first row as the keys: function parseCSVToArray($filePath) { $csvData = []; if (($handle = fopen($filePath, "r")) !== false) { $keys = fgetcsv($handle); // Get the first row as keys ...
PHP Issue with array not printing the first element of the array
Your file likely has a UTF8 Byte Order Mark [BOM] at the beginning which is throwing off the first key. While a BOM isn't necessary at all for UTF8, some programs still add it as a "hint" that the file is UTF8. If you var_dump($keys[0], bin2hex($keys[0]) you'll likely see that the first key's is longer than what is vis...
76392254
76392834
Whenever I subscribe to a collection of documents, I'm able to extract the changes to the documents, given that the listener returns DocumentChange. This way I can understand whether a given doc was created, modified or deleted. How to get the DocumentChange when subscribing to a single document in the collection? The ...
Firestore subscribed document change type
The DocumentSnapshot contains everything you need to know about that one document. Either it exists() with data, or it does not. You can check this state with each new snapshot for that one document, and react to that any way you like. Since you are not performing a query with variable set of results, there is no ne...
76394114
76394144
These are the ttk.radiobuttons I am using: def radioButtonGen(self): self.var = tk.IntVar() self.arithButton = ttk.Radiobutton(self, text = "Arithmetic Series", variable = self.var, value = 1, command = lambda: self.buttons.seqChoice("arithmetic")) self.geomButton = ttk.Radiobutton(self, tex...
Is it possible to deselect a ttk.Radiobutton?
Use the associated tkinter variable to deselect them: self.var.set(0)
76392055
76392839
library(stringr) string <- string <- c("pat1 hello333\n pat2 ok i mean pat1 again pat2 some more text pat1") I want to match all strings that start with pat1 and end with pat2. > str_extract_all( string, regex( "pat1.+pat2", dotall=TRUE ) ) [[1]] [1] "pat1 hello333\n pat2 ok i mean pat1 again pat2" This...
How to match multiple occurrences of strings given a start and end pattern in R?
Change .+ to .+? to have non greedy match. library(stringr) str_extract_all(string, regex("pat1.+?pat2", dotall=TRUE))[[1]] #[1] "pat1 hello333\n pat2" "pat1 again pat2" You can use gregexpr and regmatches with pat1.*?pat2 or in case they should be on a word boundary with \\bpat1\\b.*?\\bpat2\\b. Where .*? matches ev...
76390407
76391800
I'm working on a GTKmm application(a simple text editor, as an exercise), in which I have a notebook to which I want to add a tab. The notebook shows, but the newly added tab doesn't. I'm doing it in the following way: void MainWindow::AddTabToNotebook() { Gtk::Box box; notebook->append_page(box); noteboo...
How can I programmatically add a tab to a GTKmm notebook in C++?
The problem is that: The Gtk::Notebook does not take ownership of the widget you are adding. The widget you are adding is local to your callback (and hence destroyed when leaving it). I was able to make your example work by adding a widget (here a Gtk::Label) attribute to your window (so it outlives the callback): cl...
76385362
76391913
I'm currently teaching myself how to use a headless CMS (CrafterCMS) with Next.js. I have the following simple content type in CrafterCMS studio (just a title and a text): And the respective code: export default async function TestPage() { const model = await getModel('/site/website/test/index.xml'); return ( ...
Dragging fields in CrafterCMS Studio
On CrafterCMS, you can drag & drop mainly 3 things: Repeating group items Component item references from an Item Selector control with a "Components" datasource Media items into a media control (image or video) The simplest way of achieving what you describe, would be to change your model to wrap with a repeat group ...
76394140
76394152
import random lst1 = [] lst2 = [] n = int(input('Step a: How many numbers in each list? ')) for i in range(0, n): number1 = random.randint(1, 15) number2 = random.randint(1, 15) lst1.append(number1) lst2.append(number2) count = 0 if lst1[i] > lst2[i]: count += 1 print(f'{numbe...
Python: Comparing two lists using a for-loop, how do I print the results correctly?
Try creating a third list to store the comparison results and then printing the contents only at the end with another loop: import random lst1 = [] lst2 = [] comparison_results = [] n = int(input('Step a: How many numbers in each list? ')) for i in range(n): number1 = random.randint(1, 15) number2 = random.r...
76391153
76392845
Been experimenting with polars and of the key features that peak my interest is the larger than RAM operations. I downloaded some files to play with from HERE. On the website: First line in each file is header; 1 line corresponds to 1 record.. WARNING total download is quite large (~1.3GB)! This experiment was done on ...
Python Polars: Lazy Frame Row Count not equal wc -l
It's usually helpful to declare the size of downloads in cases like this. For any readers, the total size is 1.3 GB The smallest file is https://s3.amazonaws.com/amazon-reviews-pds/tsv/amazon_reviews_us_Personal_Care_Appliances_v1_00.tsv.gz at 17.6 MB I tried pandas to debug this, it cannot read any of these files:...
76389541
76391919
I'm developing Google Apps Script locally. I used the clasp push --watch command for pushing updated code to the original Apps Script as per the documentation. https://www.npmjs.com/package/@google/clasp#push The problem is that when I update the code of any one file, it uploads the whole file. I have attached the scre...
How to upload only updated files in Google Apps Script using clasp?
It seems this behavior is expected based on the documentation: Warning: Google scripts APIs do not currently support atomic nor per file operations. Thus the push command always replaces the whole content of the online project with the files being pushed. clasp push replaces code that is on script.google.com and cla...
76389283
76391945
private void ProcessedImage() { try { if (FileUpload1.HasFile) { int length = 192; int width = 192; using (Bitmap sourceImage = new Bitmap(FileUpload1.PostedFile.InputStream)) { using (Bitma...
How to retrieve an image from database and show it in asp image box with a click of a button?
Ok, first up, even vs2010 used lots of JavaScript, and in fact came with a bootstrap main menu, had the JavaScript "helper" library jQuery installed. And in fact, YOUR above code even uses JavaScript here: Response.Write("<script>alert('Saved Succefully')</script>"); So, to be clear? You have full use of JavaScript, ...
76394222
76394267
I am new to java , how do I compile packages in Intelij This is my directory It is running perfectly in Main.java To compile , I first ran javac people/People.java Then I compile javac Main.java, it returns Main.java:8: error: package com.amigoscode.people does not exist Main.java package com.amigoscode; // Press Shi...
How to compile Packages in java
First, navigate to the src directory using terminal. Then execute the command below to compile the People.java. javac com/amigoscode/people/People.java Now, to compile the Main.java execute the command below. javac com/amigoscode/Main.java This should work fine.
76389911
76391974
I'm using CMake in, so far as I can tell, the same way as I always use it. The problem is that now include_directories($(CMAKE_SOURCE_DIR)/server/include) results in my header files not being found. When instead I use include_directories($(CMAKE_CURRENT_SOURCE_DIR)/server/include) they are found. i.e. $(CMAKE_CURRENT...
CMake CMAKE_SOURCE_DIR and CMAKE_CURRENT_SOURCE_DIR to set same path, but only latter 'works'
$(FOO) is not the correct syntax to refer to the cmake variable FOO. You need to use ${FOO} instead. Neither of the uses of include_directories should work, unless the build system interprets the path $(CMAKE_CURRENT_SOURCE_DIR)/server/include. Note that you're using the proper syntax for the message commands. The mess...
76392241
76392975
I'm a beginner programmer Rails. I'll start with a problem: I'm using Devise to work with users, and I tried to enable mail confirmation. It doesn't work, unfortunately. If possible, please help! My error: Net::SMTPAuthenticationError in Devise::ConfirmationsController#create 535-5.7.8 Username and Password not accepte...
How to fix '535-5.7.8 Username and Password not accepted. Learn more at' error in Devise mail confirmation?
This is related to ActionMailer configuration rather than Devise. From the documentation authentication should be set to one of the following :plain, :login or :cram_md5 The following is an excerpt taken from the relevant section in the documentation linked to above and is the explanation of the available options and w...
76389742
76392034
I have two keys to different github account and there is the config ~/.gitconfig: [user] name = example email = example@example.com [pull] rebase = true [rebase] autoStash = true [filter "lfs"] clean = git-lfs clean -- %f smudge = git-lfs smudge -- %f process = gi...
why .gitconfig [includIf] override the default config
The syntax for includeIf should be (see the docs): [includeIf "gitdir/i:/Users/example/Documents/github_2/"] path = </path/to/includeFile> The syntax [includeIf "gitdir/i:/Users/example/Documents/github_2/"] [core] sshCommand = "ssh -i ~/.ssh/github2_key" actually means [includeIf "gitdir/i:/Users/example...
76385174
76392131
I have a tricky TypeScript question. Let say I have this Icon component with the prop size. Size can be "2", "4", "6". I map these values to predefined tailwind classes. So I type it like type SizeValues = '2' | '4' | '6'; function Icon({size = '4'}: {size: SizeValues}) { const sizeMap = { '2': 'w-2 h-2', ...
How can I define a type in TypeScript that's a string that only should contain words from a predefined list
First, we need to extract sizeMap into the global scope, and const assert it to let the compiler know that this is immutable constant and restrict it from widening types: const sizeMap = { '2': 'w-2 h-2', '4': 'w-4 h-4', '6': 'w-6 h-6', 'md:2': 'md:w-2 md:h-2', 'md:4': 'md:w-4 md:h-4', 'md:6': 'md:w-6 md:h...
76394256
76394286
I've never actually ran into this problem before, at least not that I'm aware of... But I'm working on some SIMD vector optimizations in some of my code and I'm having some alignment issues. Here's some minimal code that I've been able to reproduce the problem with, on MSVC (Visual Studio 2022): #include <stdio.h> #inc...
Why does __m128 cause alignment issues in a union with float x/y/z?
alignof(your_union) is 16 when it includes a __m128 member, so compilers will use movaps or movdqa because you've promised them that the data is aligned. Otherwise alignof(your_union) is only 4 (inherited from float, so they'll use movups or movdqu which has no alignment requirement. It's still alignment undefined beha...
76390159
76392137
I am calling nsExec::ExecToStack to get the output of a powershell command. Based on the result, I will either do nothing, or install a windows feature. I seem to get the result I expect from the powershell command, but the if/then logic is not doing what I expect. Here's the code: DetailPrint "======================...
Am I using NSIS nsexec::ExecToStack Output correctly?
It was just a CR/LF at the end of the PowerShell output. By changing my statement to: ${If} $InstallState == "Installed$\r$\n" Worked like it should. It's always something simple in the end.
76389426
76392179
How to let know developers automatically that this "bits/shared_ptr.h" is internal to standard library (gcc and clang). #include <bits/shared_ptr.h> // some code using std::shared_ptr The best would be to also inform <memory> should be used instead. This <bits/shared_ptr.h> is just an example - I mean - how to warn ...
Is there a way to warn C++ developers when they accidentally include internal implementation headers of std library?
It seems like include-what-you-use does what you want. It has a mapping of what names are supposed to come from what header, and it seems to know which headers are internal. For example, when including <bits/shared_ptr.h> https://godbolt.org/z/cvq7354K6: #include <bits/shared_ptr.h> std::shared_ptr<int> x; It says to...
76392017
76393019
I have a PowerBI report with a line chart that shows average costs over a time period. The time period is based on a date that is set to use a date hierarchy for the year and the month. When I open the report the line chart does not display correctly. The lines are incorrectly flat. If I change the date from a date h...
How can I fix incorrect flat lines on my PowerBI line chart with a date hierarchy?
Clicking on the double arrow icon to expand the next level by default resolved my issue.
76384859
76392236
I haven't kept up with changes to GCP's load-balancing, and they've introduced a new kind of global L7 load-balancer, and the ones which I am used to are now termed "classic". I am not able to find ways to create these new style of load-balancers using gcloud CLI. Is there a way to do this?
Create Global HTTPS load-balancer with gcloud
Just to mark the question answered, I will post @John_Hanley's reply here: Set the flag like this: gcloud gcloud compute backend-services create --load-balancing-scheme=EXTERNAL_MANAGED
76394247
76394291
I have a JSON file in the below format [ { "name": "John", "team": "NW", "available": true }, { "name": "Dani", "team": "NW", "available": true }, { "name": "Lyle", "team": "NW", "available": false }, { "name": "Dean", "team": "W", "available": true }, { "name": "Lyle", "team": "W", "available": true }, { "...
Create unique pair of elements in a list based on some attribute of the class/object
To confirm, when running you first, Check if the agent is available. Find a matching agent from a different team (From the map of agents) And if a match is found, add the pair of agents to the list of pairs and mark both agents in the EntrySet, otherwise mark the agent as unmatched. Correct? If so, it sounds like you...
76390788
76393048
I have a tree structure with multiple different projects in Visual Studio Code (VS Code). Each project is in a separate folder within the tree structure. Is there a way to make one of these folders the current workspace folder ad hoc, so that I can easily run the configuration specific to that folder? Is there a way to...
How can I temporarily set a folder as the workspace in VS Code to run specific configurations?
Is there a way to make one of these folders the current workspace folder ad hoc, so that I can easily run the configuration specific to that folder? As far as I'm aware, the easiest you'll get is using File: Open File... (if you've never opened the folder / workspace) before, or using File: Open Recent... (these are ...
76391976
76393123
I have a dataset that looks like this. To give some context, there can multiple user groups (odd number of people in it). Each of the groups can contain multiple users in it. So, within each and every group, I needed to select pairs of users in such a fashion that, A person must not be repeated in any of the pairs, unt...
Generate a set of non repeating pairs of users in multiple groups
updated answer Using your code here, but applying it per group: def combine(s): users = s.tolist() n = int(len(users) / 2) stages = [] for i in range(len(users) - 1): t = users[:1] + users[-i:] + users[1:-i] if i else users stages.extend([f'{a}-{b}' for a,b in zip(t[:n], reversed(t[...
76390308
76392296
The DSpace OAI-PMH repository exposes an endpoint /hierarchy for API v6, which provides the logical structure of how communities, sub-communities and collections are related. This is documented at https://wiki.lyrasis.org/pages/viewpage.action?pageId=104566810#RESTAPIv6(deprecated)-Hierarchy As v6 will be deprecated, i...
Is there an equivalent of the /hierarchy API endpoint for DSpace 7.x?
There is no exact replacement in DSpace 7 REST API. But you can retrieve the same information as follows: Start from the "Top level Communities" search endpoint here: https://github.com/DSpace/RestContract/blob/main/communities.md#search-methods This will retrieve all the communities at the top of that hierarchy T...
76392027
76393168
So, I might not have the right terminology to describe this problem, which made searching for it tricky, but I hope my example helps clear it up. Context: I'm using query data selectors in react-query to preprocess query results and attach some properties that I need globally in the application. I'm running into an iss...
TypeScript array intersection type: property does not exist when accessed in Array.forEach, Array.some, etc, but accessible within for loop
This is considered a design limitation of TypeScript. Intersections of array types behave strangely and are not recommended. See microsoft/TypeScript#41874 for an authoritative answer. It says: Array intersection is weird since there are many invariants of arrays and many invariants of intersections that can't be sim...
76390991
76393253
I have a list of items, each item has a date value: [ { "Date Merged": "6/1/2023 3:46:53 PM", "PR ID": "470" }, { "Date Merged": "5/30/2023 2:44:25 PM", "PR ID": "447" } ] I want to get only the PRs of the items with dates that happened in May. I think I can grab the 'PR ID' values with: map(at...
From a list, how to get only the items with dates within a certain time period?
Given the data prs: - Date Merged: 6/1/2023 3:46:53 PM PR ID: '470' - Date Merged: 5/30/2023 2:44:25 PM PR ID: '447' Q: "Get the PRs with dates that happened in May." A: There are more options: Quick & dirty. The test match "succeeds if it finds the pattern at the beginning of the string" res...
76389963
76392419
I created a memory dump of an application with procdump -ma abc.exe. The application access various files. I run !handle 0 f FILE and get over 100 file handles. When I get a specific handle address, I run the following command !handle 000000000000161c f which results in: 0:000> !handle 000000000000161c f Handle 0000000...
WinDbg | Application memory full dump - Show file path of file handle
For post-mortem debugging (crash dump analysis), there's no way, except if you have a kernel dump (I can't tell you how to do that then). Windows will close handles of a process that terminated. !handle combined with !handleex There is handleex on Github. Combine !handle and !handleex to get nice information. .foreach ...
76389602
76392485
I'm using a library that uses SKTypeface.FromFamilyName internally to render font on the screen. However, as I found out if the text to display is japanese, korean or chinese, it just prints squares. I tried to add a custom font to my project but I was not able to make SKTypeface.FromFamilyName return anything but NULL...
How to get SKTypeface.FromFamilyName to return a font for Japanese, Korean, Chinese (Android + iOS, Xamarin.Forms)
Alright, I found a solution for this. This seems to work for me: string fontFamily; switch (Thread.CurrentThread.CurrentUICulture.TwoLetterISOLanguageName.ToLower()) { case "ja": fontFamily = SKFontManager.Default.MatchCharacter('あ').FamilyName; break; case "ko": fontFamily = SKFontMana...
76391957
76393265
I have the following code where the useSearchResults function (it's a React hook, but it doesn't matter) initializes the state based on the argument. config.state can be anything defined in SearchResultsState or a function that returns anything defined in SearchResultsState. The state returned by useSearchResults is de...
Function return type depending on argument type
If you want a function's return type to depend on its argument type then you either need to overload it with multiple call signatures, or generic in some number of type parameters. Overloads only work if you have a relatively small number of ways you want to call the function, while generics are more appropriate to re...
76389562
76392514
I have two columns where I want to highlight differences I want to see if the letter in Column A exists in Column B - it should be case-sensitive, because there are C and c in column A If there is a match I want the row preferably turn green - otherwise a OK / NOT OK in column C Thank you in advance
Excel 2016 - compare two columns for match
Copy this Sub to the Worksheet code pane. For this open the Developer tab and click Visual Basic. In the left pane select the worksheet where your datas are, and doubleclick it. Insert the code. Private Sub Worksheet_Change(ByVal Target As Excel.Range) If Target.Column = 1 And InStr(1, Target.Offset(0, 1).Value, Target...
76382415
76393313
Covariance not estimated in SciPy's Curvefit Here's my dataset: frequency (Hz) brightness (ergs/s/cm^2/sr/Hz) brightness (J/s/m^2/sr/Hz) float64 float64 float64 34473577711.372055 7.029471536390586e-16 7.029471536390586e-19 42896956937.69582 1.0253178228238486e-15 1.0253178228238486e-18 51322332225.44733 1.35...
Why does my Python code using scipy.curve_fit() for Planck's Radiation Law produce 'popt=1' and 'pcov=inf' errors?
A lot of problems here, including that your variables were swapped, you're needlessly redefining physical constants, and your expression was highly numerically unstable. You need to use exp1m instead: import matplotlib.pyplot as plt import numpy as np from scipy.constants import h, c, k from scipy.optimize import curve...
76387822
76394313
I have a snowflake table that has VARCHAR column containing input from api. I have 300+ columns to be flattened and one of them has input like below for a particular row. I need to parse the values from the below (please refer output) and store it as a single row for a particular input row. The number of elements insid...
Snowflake Flatten and parsing values
This won't produce the nested JSON, but it should I believe pick-out the values you want, and from there you should be able to form the JSON from it: SELECT t.value:active::BOOLEAN AS active , ARRAY_AGG(t.value:urls) WITHIN GROUP (ORDER BY seq) AS urls , SPLIT_PART(t.value:displayName::STRING, ',', 1) AS...
76394361
76394377
For instance, I'm writing a Mongoose utility method, and I'm wanting to return a value after the async methods resolve. This is a highly simplified example. const testConnect = () => { let msg; mongoose.connect(mongoServer.getUri()) .then(() => { msg ="Connection success!"; }) ...
A more organic way to resolve and return a resolved promise from a JavaScript/Node function than using Promise.resolve?
What you're attempting to do won't work because your asynchronous operation is non-blocking so you will do return Promise.resolve(msg); before there's even a value in msg. It's almost always a warning sign when you're assigning higher scoped variables inside of a .then() or .catch() handler and then trying to use thos...
76384965
76392645
What's the behavior of git push --force when no upstream branch exists? Will I get something like fatal: The current branch branch_name has no upstream branch, as would happen with a normal push, or would the upstream branch be "forcefully" created?
Behavior of `git push --force` when no upstream branch exists
--force does not change the behaviour of git push without an upstream set (when no push.default and push.autoSetupRemote config is set) empirically with git 2.40.0. $ git checkout -b dev/test Switched to a new branch 'dev/test' $ git push fatal: The current branch dev/test has no upstream branch. To push the current br...