instruction
stringlengths
0
30k
Site made in DW almost done; can't get it to center with wrapper
In my R code I have a dataset where column "Groups" shows which observations belong to different groups. I would like to assign a unique color to each group. For example, I can then use these colors in a leaflet map. However, there is problem which I do not understand: when creating the colorFactor, some values get wrong colors. Here is an example. I define colors in the top (I have more colors than I will need in this specific dataset, but the idea is that once the size of the dataset is known, the same number of different colors is taken). Then I create a dataset (where a problem arises) and add a column with the associated colors. Some of the colors turn out to be wrong, and I would like to understand why. ``` #Define distinct colors (first one is NA color) MyColors = c("#808080","red", "green", "yellow", "orange", "violet", "palegreen4","wheat2","mediumpurple1", "turquoise2", "steelblue", "yellowgreen","tan3","tomato", "palevioletred", "maroon1", "springgreen2" , "brown","violetred","coral2") #Create a dataset where the problem arises MyTest=c(NA,NA,"Group94",NA,NA,"Group193", NA, "Group275", NA, NA, NA, "Group381", NA, "Group435", NA, "Group475", "Group507", NA, "Group193", "Group558", "Group572", "Group94", "Group572","Group650","Group475","Group558","Group684",NA, "Group381", NA, "Group715","Group435","Group715",NA,"Group507","Group684","Group275","Group650") MyTest=as.data.frame(MyTest) colnames(MyTest)="Groups" #Define the colors: MyDomainColors=MyTest %>% select(Groups) %>% distinct() %>% arrange() MyDomainColors=as.vector(MyDomainColors[,1]) MyPal <- colorFactor(MyCol[1:length(MyDomainColors)], domain = MyDomainColors, ordered = TRUE) #Add color as a separate column MyTest=MyTest %>% mutate(MyColor=MyPal(MyTest$Groups)) ``` Here I have 13 different groups, so the code takes 13 first colors (which are in the first row in the screenshot below): [![enter image description here][1]][1] Then MyDomainColors looks like this: [![enter image description here][2]][2] So, my logic is that the first 13 colors should be matched with the elements of MyDomainColors, i.e. NA being "#808080", Group94 being red, etc. And it works until palegreen which should be associated with Group475. But here is what I get: [![enter image description here][3]][3] Group 475 gets #AB82FF which is purple. It looks like it simply skipped palegreen and wheat2. Also, I get the following warning: [![enter image description here][4]][4] I do not understand the warning either. So, what is wrong here? [1]: https://i.stack.imgur.com/Gfth7.png [2]: https://i.stack.imgur.com/UiiHf.png [3]: https://i.stack.imgur.com/bZgqV.png [4]: https://i.stack.imgur.com/PDHgo.png
Wrong matches between colors and values when defining colorFactor
Upgrade pip pip install --upgrade pip If using pip3 pip3 install --upgrade pip If pip is not in PATH python -m pip install --upgrade pip python3 -m pip install --upgrade pip For Windows py -m pip install --upgrade pip Upgrade setuptools and wheel pip install --upgrade setuptools wheel pip3 install --upgrade setuptools wheel python -m pip install --upgrade setuptools wheel python3 -m pip install --upgrade setuptools wheel py -m pip install --upgrade setuptools wheel
I'm using: `\b(?<=,)http.*?(?=,)\b` The issue come when I try to use it on: Something,https://stackoverflow.com/questions/ask/,Anotherthing While it works on: Something,https://stackoverflow.com/questions/ask,Anotherthing So if the / is places before the delimiter the expression seem to skip it. Please help me it's been an entire day that I'm stuck on this. I tried to change it like: `\b(?<=,)http.*[\/],(?=,)\b` but it doesn't work nor it works `\b(?<=,)http.*\/,(?=,)\b` I want it to select any link until the , delimiter even if the comma is anticipated by /. Thanks for any help. I'm a noob sorry if it's easy.
Regex skipping delimiter is there is / before it
|regex|regex-lookarounds|
null
I followed the recommendations from the best answer and also used a YouTube video that helped me set up the connection between Google Cloud Storage and Snowflake. (www.youtube.com/watch?v=4SBNUNMotRY) The most important point is creating the integration: CREATE OR REPLACE STORAGE INTEGRATION gcs_int TYPE = EXTERNAL_STAGE STORAGE_PROVIDER = 'GCS' ENABLED = TRUE STORAGE_ALLOWED_LOCATIONS = ('gcs://bucket'); GRANT USAGE ON INTEGRATION gcs_int TO ROLE name; After establishing the connection, you need to create a table into which the data will be loaded, and then simply copy it: COPY INTO raw_chikago_taxi_trips (column_names) FROM 'gcs://bucket' STORAGE_INTEGRATION = gcs_int FILE_FORMAT = (type = 'CSV' skip_header = 1 FIELD_OPTIONALLY_ENCLOSED_BY = '"' TIMESTAMP_FORMAT = 'YYYY-MM-DD HH24:MI:SS UTC'); This is how I implemented the recommendations and configured the connection between GCS and Snowflake.
I'm using: `\b(?<=,)http.*?(?=,)\b` The issue come when I try to use it on: Something,https://stackoverflow.com/questions/ask/,Anotherthing While it works on: Something,https://stackoverflow.com/questions/ask,Anotherthing So if the / is places before the delimiter the expression seem to skip it. Please help me it's been an entire day that I'm stuck on this. I tried to change it like: `\b(?<=,)http.*[\/],(?=,)\b` but it doesn't work nor it works `\b(?<=,)http.*\/,(?=,)\b` I want it to select any link until the , delimiter even if the comma is anticipated by /. Thanks for any help. I'm a noob sorry if it's easy.
I have been struggling with this issue as well when trying to set up a VSCode remote development container (docker compose build but should not make a big difference) with x11 support. My requirements were as follows: - No `network_mode: host` or `--net=host` respectively - No `X11UseLocalhost no` I ended up spinning up a daemonized `socat` process on the remote host at devcontainer initialization, tunneling the TCP x11 traffic from port 6XXX used for x11 with SSH to an x11 UNIX socket that I share with my container. Solution is best described in a commit: https://github.com/flxtrtwn/devious/pull/16/commits/c6a233eb7312ca606f9d53a102bea8c1f8282578
I tried this code not working searched all resources please help. It seems like the URL redirection is handled by JavaScript without an <a> tag or an onclick event. ``` import time from selenium import webdriver from selenium.webdriver.chrome.options import Options from selenium.webdriver.common.by import By def SCHLproject(query): chrome_options = Options() chrome_options.add_argument("--headless") chrome_options.add_argument("--disable-gpu") driver = webdriver.Chrome(options=chrome_options) url = f"https://www.truemeds.in/search/{str(query)}" print(driver.page) driver.get(url) ele = driver.find_element(By.CLASS_NAME, "sc-452fc789-2 eIXiYR") ele.click() print(driver.current_url) SCHLproject("naxdom") ```
{"Voters":[{"Id":8034901,"DisplayName":"brombeer"},{"Id":4369919,"DisplayName":"N69S"},{"Id":839601,"DisplayName":"gnat"}]}
I'm currently in grade 11 (standard 9) and learning the Delphi Programming Language using Delphi 6 and Delphi 7. Are there any sites where I could access additional learning material?
To those proficient in javascript, does this code resemble something workable or should I pack it in? ``` var doc = app.activeDocument; for (var i = 0; i < doc.artboards.length; i++) { doc.artboards.setActiveArtboardIndex(i); var artboard = doc.artboards[i]; var itemsOnArtboard = []; for (var j = 0; j < doc.pageItems.length; j++) { var item = doc.pageItems[j]; if (artboard.artboardRect.toString() == item.visibleBounds.toString()) { itemsOnArtboard.push(item); } } if (itemsOnArtboard.length > 1) { var group = doc.groupItems.add(); for (var k = 0; k < itemsOnArtboard.length; k++) { itemsOnArtboard[k].moveToEnd(group); } } } ``` I was expecting Illustrator to cycle through each art board and grouping the contents from each board until it finally reached the last board. The code seemed to take, beach ball spun for a bit, but no result.
Used AI to generate an Adobe Illustrator v28.3 script that groups the contents of each individual artboard. Can't get it to work
|javascript|adobe|adobe-illustrator|
null
When I ran `ng new`, I didn't pay much attention and enabled SSR (Server-Side Rendering), which requires activating cloud functions. In summary, SSR rendering is not compatible with the Firebase Spark plan.
{"Voters":[{"Id":3929826,"DisplayName":"Klaus D."},{"Id":3001761,"DisplayName":"jonrsharpe"},{"Id":839601,"DisplayName":"gnat"}]}
we have recently set up rootless docker alongside our existing docker but ran into problems injecting host GPUs into the rootless containers. A workaround was presented in a Github [issue](https://github.com/NVIDIA/nvidia-container-toolkit/issues/85) (toggling no-cgroups to switch between rootful and rootless) with a mention of a better solution coming as a experimental feature in Docker 25, that feature being Nvidia OCI. This is a mirror of Github [Issue](https://github.com/NVIDIA/nvidia-container-toolkit/issues/434) from the [nvidia-container-toolkit](https://github.com/NVIDIA/nvidia-container-toolkit) page. The exact setup can be found there. We have set up the yaml file and confirmed the CDI devices: ``` sudo nvidia-ctk cdi generate --output=/etc/cdi/nvidia.yaml ... INFO[0000] Found 5 CDI devices nvidia.com/gpu=0 nvidia.com/gpu=1 nvidia.com/gpu=2 nvidia.com/gpu=4 nvidia.com/gpu=all ``` OCI injection works fine for the regular Docker (26.0) instance: ``` $ docker run --rm -ti --runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=nvidia.com/gpu=all ubuntu nvidia-smi -L GPU 0: NVIDIA A100-SXM4-40GB (UUID: GPU-b6022b4d-71db-8f15-15de-26a719f6b3e1) GPU 1: NVIDIA A100-SXM4-40GB (UUID: GPU-22420f7d-6edb-e44a-c322-4ce539cade19) GPU 2: NVIDIA A100-SXM4-40GB (UUID: GPU-5e3444e2-8577-0e99-c6ee-72f6eb2bd28c) GPU 3: NVIDIA A100-SXM4-40GB (UUID: GPU-dd1f811d-a280-7e2e-bf7e-b84f7a977cc1) ``` but produces the following errors for the rootless (25.0.2) version: ``` $ docker run --rm -ti --runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=nvidia.com/gpu=all ubuntu nvidia-smi -L docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: could not apply required modification to OCI specification: error modifying OCI spec: failed to inject CDI devices: unresolvable CDI devices nvidia.com/gpu=all: unknown. ``` **Note:** That OCI support is still experimental in Docker 25 and requires `export DOCKER_CLI_EXPERIMENTAL=enabled` Does anyone have experience with this usecase? Does rootless docker offer a way to select the install version? The script currently still installs v25 and i have found no release notes for rootless docker specifically.
I have a react component and in this component I have a table with dynamically show data and also other html content. I want also page break concept each loop. When I render the page it showing in the form of pdf like inside iframe. And also I want converted pdf blob link. I have write a component with necessary html content with dynamically show data. I am using react render pdf component but it only worked html tag not html tag with react code like js code that I dynamically shown data . I want to convert same like pdf of react component
Convert React Components into PDF
|reactjs|pdf-generation|html-to-pdf|openhtmltopdf|pdf-rendering|
null
I want to create a simple user management database using *async* SQLALchemy 2.0 with the following idea: * A user should have only **one** role in one project * A user can have different roles in different projects * A user can be part of multiple projects (which may have thousands of documents) Here is what I have: ```python class User(db.Model): __tablename__ = 'user' id = db.Column(db.Integer, primary_key=True) username = db.Column(db.String(60), index=True, unique=True) user_project_roles = relationship('UserProjectRoleLink', back_populates='user') class Project(db.Model): __tablename__ = 'device' id = db.Column(db.Integer, primary_key=True) project_name = db.Column(db.String(60), unique=True) user_project_roles = relationship('UserProjectRoleLink', back_populates='project') documents = relationship('Document', back_populates='project') # thousands of documents class Document(db.Model) __tablename__ = 'device' id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(60), unique=True) text =db.Column(db.String(60)) project = relationship('Project', back_populates="documents") class Role(db.Model): __tablename__ = "role" id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(60), unique=True) user_project_roles = relationship('UserProjectRoleLink', back_populates='role') class UserProjectRoleLink(db.Model): user_id = Column(Integer, ForeignKey('user.id'), primary_key=True) project_id = Column(Integer, ForeignKey('project.id'), primary_key=True) role_id = Column(Integer, ForeignKey('role.id'), primary_key=True) user = relationship('User', back_populates='user_project_roles') role = relationship('Role', back_populates='user_project_roles') project = relationship('Project', back_populates='user_project_roles') ``` So whenever I select a user (select(User).where(User.id == id)), the UserProjectRoleLink is a table where `user_id`, `role_id` ,`project_id` are loaded, while the relationships including (the circular) user relationship is not loaded. How can I load the role details as well as the project details within the same select but not loading the thousands of documents ? in my Rest api, I would like to repond for example with a user reponse like: ```json { "id": 234, "username": "JohnDoe", "project_roles":[ { "project_name":"Project 1", "project_id": 1, "role:"Admin", "role_id": 1 }, { "project_name":"Project 2", "project_id": 2, "role:"User", "role_id": 2 } ] } ``` How can I preload all project and role relationships (and not just iterating through each one and dynamically load it (expensive)) but not the user realtionship as it would throw a recursion error ? Also from the project side, I would like to query, which user has access to a particular project with which roles projectResult: ```json { "id":2, "project_name":"Project 1", "users":[ { "user_id": 234, "user_name": JohnDoe, "role":"Admin", "role_id: "1", } ] } ``` I have played around with `joinedLoading` options but I don't know how to load each `user_project_roles` effictively as (when coming from the user) I get a list of `user_project_roles` <br> I also thought about `secondary joins` but no luck
|centering|
null
Trying to parse C# isn't for the faint-hearted. Luckily, there's already a compiler you can use from a [NuGet package][1] :-) So, I had a go at using [Roslyn][2] for the first time, and it's fairly easy to accomplish what you want: ``` Install-Package Microsoft.CodeAnalysis.CSharp ``` Then, you can parse the C# code and analyze methods using `CSharpSyntaxWalker` (I found an example [here][3]): ```csharp var code = File.ReadAllText(filePath); var tree = CSharpSyntaxTree.ParseText(code); var root = tree.GetRoot(); var walker = new MethodWalker(); walker.Visit(root); class MethodWalker : CSharpSyntaxWalker { public override void VisitMethodDeclaration(MethodDeclarationSyntax node) { var lineSpan = node.GetLocation().GetLineSpan(); var start = lineSpan.StartLinePosition.Line; var end = lineSpan.EndLinePosition.Line; var count = end - start + 1; // including declaration Console.WriteLine($"Method found: {node.Identifier.ValueText}, number of lines: {count}"); base.VisitMethodDeclaration(node); } } ``` Also [this post][4] gives a few more examples of walking the syntax tree, as well as creating an analyser. I think the right approach, as already mentioned in the question comments, is by writing your own analyzer. However, you should also be able to use it within unit tests. (Obviously, nobody is suggesting this is a _unit test_ but I get it; sometimes you have to be pragmatic and use the tools you have and understand best.) [1]: https://www.nuget.org/packages/Microsoft.CodeAnalysis.CSharp/ [2]: https://learn.microsoft.com/en-us/dotnet/csharp/roslyn-sdk/ [3]: https://joshvarty.com/2014/07/26/learn-roslyn-now-part-4-csharpsyntaxwalker/ [4]: https://medium.com/pvs-studio/creating-roslyn-api-based-static-analyzer-for-c-c0d7c27489f9
**input1** import pandas as pd import numpy as np np.random.seed(0) data = {'item': np.random.choice(['skirt', 'shirt', 'coat'], 6), 'size': np.random.choice(['S', 'M', 'L', 'XL'], 6)} df1 = pd.DataFrame(data) df1: item size 0 skirt S 1 shirt XL 2 skirt L 3 shirt S 4 shirt S 5 coat S when i sort by `size` df1.sort_values('size') out: item size 2 skirt L 0 skirt S 3 shirt S 4 shirt S 5 coat S 1 shirt XL The data is sorted by the `size` column, and when the values of the `size` column are the same, the rows that were originally higher remain higher. --- **input2** import pandas as pd import numpy as np pd.options.display.max_rows = 6 np.random.seed(0) data1 = {'item': np.random.choice(['skirt', 'shirt', 'coat'], 1000000), 'size': np.random.choice(['S', 'M', 'L', 'XL'], 1000000)} df2 = pd.DataFrame(data1) df2 item size 0 skirt M 1 shirt L 2 skirt M ... ... ... 999997 coat S 999998 shirt S 999999 skirt L [1000000 rows x 2 columns] df2 has 1M rows when i sort by `size` df2.sort_values('size') out: item size 999999 skirt L <- why top? 645704 shirt L 645714 shirt L ... ... ... 822256 coat XL 699230 coat XL 400737 skirt XL [1000000 rows x 2 columns] I don't know why `999999 row` is at the top in `df2`. Shouldn't the existing order be followed if `size` is the same?
I am new to rust and have this fundamental doubt: let x = String::from("hello world"); let y = &x; println!("y: {}", y); println!("value of x is: {}", *y); I understand that ```y``` is a reference to the value hello world stored in heap. But why do ```y``` print the value of ```x``` and not the memory location of ```y```. If this is the expected behavior, why do we need to deference and access the value of a variable using ```*``` because ```&x``` already gives the value of the variable?
Expected behavior while printing reference and dereference of a variable
|rust|
Can log2 be substituted with ln in logDice association measure in R?
We are using the youtube api to upload multiple videos to channels we have permissions to. When uploading a batch of videos via the api it results in "uploadLimitExceeded" exception. The message says "The user has exceeded the number of videos they may upload". It is unclear what limit exactly is exceeded. In the google cloud console the only user related quota we have is "Queries per minute per user" and its 180k. So if a video insert is 1600 it means the quota should be 112 videos per user per minute however when tried to upload 81 videos, only 10 succeeded and all the rest failed with the "uploadLimitExceeded" exception. What am I missing here?
Video insert results in "uploadLimitExceeded" exception
|youtube-api|youtube-data-api|
null
|docker|visual-studio-code|docker-desktop|
null
null
null
null
{"Voters":[{"Id":6361531,"DisplayName":"Scott Boston"},{"Id":9473764,"DisplayName":"Nick"},{"Id":5468463,"DisplayName":"Vega"}],"SiteSpecificCloseReasonIds":[11]}
When managing sessions using spring-session-data-redis, I think the session ID is returned in a cookie named SESSION. (https://spring.pleiades.io/spring-session/reference/guides/boot-redis.html) I would like to perform some processing using the session ID returned by a cookie, but I don't know how to obtain this session ID. I referred to the following article, but it seems that the value in redis and the value returned by cookie are different values ​​due to base64 encoding, so I wonder if it is not enough to simply get the value in redis. I thought. https://qiita.com/tttol/items/4a50ed1452488d5e6548 To be honest, this is my first time using spring-session, so I'm not sure if I understand the above. Could you please tell me how to obtain the session ID? I searched on google but couldn't find it.
How to get the session ID returned by cookie with spring-session-data-redis
|java|spring-boot|redis|spring-session|
null
I need to do a project at the undergraduate level. I will design an embedded system project using the Pynq Z1/Z2 FPGA board. So, I need to use both the PS and PL. Can you suggest a project for me? Let it be something easy to moderate level, as I am not very experienced. I really can't think of anything. The project won't involve PCB or any camera module. Could you also specify in the suggested project which part will be done through PS and which part will be done through PL? What I have in mind is to invert the colors of the video transferred from the HDMI output of the laptop to the HDMI input of the FPGA and then display it on an external monitor throught HDMI Out port of FPGA. The board Pynq Z2 has HDMI In and HDMI Out ports. I plan to use the PS for transferring the video into the FPGA, the PL for inverting the colors, and again the PS for reflecting it onto an external monitor. Is that correct?
I was studying convolutional neural networks, and creating a module. While using nn.conv2d, I can't figure out exactly how to specify my out_channels. I understand that it is the number of filters that are going to be used. For a black and white picture, (meaning in_channels to be 1), if I put 8 output_channels, does it mean that I will get 8 different feature maps?
The meaning of an out_channel in nn.Conv2d pytorch
|pytorch|conv-neural-network|
null
i am here to ask about the problem about this function that calculates the sum at a given depth in a tree, it is working in all cases but the last level, the compiler is giving me this : `[Done] exited with code=3221225477 in 0.309 seconds` and this is my code and everything you need(there is more other functions and stuff but i think this is enough): ```#include <stdio.h> #include <stdlib.h> #include <math.h> typedef int element; typedef struct node{ element e; struct node * left; struct node * right; }node; typedef node * tree; int isEmpty(tree a){ return a==NULL; } element root(tree a){ return a->e; } tree left(tree a){ return a->left; } tree right(tree a){ return a->right; } int max(int x,int y){ return x>y?x:y; } int sumAtBis(tree a, int n, int i){ if(i==n){ if(isEmpty(a)) return 0; else return root(a); } return sumAtBis(left(a),n,i+1)+sumAtBis(right(a),n,i+1); } int sumAt(tree a, int n){ return sumAtBis(a,n,0); } int testSumAtBis(tree a, int n, int i){ return sumAt(a,n)==0?1:0; } int testSumAt(tree a, int n){ return testSumAtBis(a,n,0)==0?1:0; } int main(){ node g={-1,NULL,NULL}; node f={1,NULL,NULL}; node e={0,&f,&g}; node d={0,NULL,NULL}; node c={1,&d,&e}; node b={-1,NULL,NULL}; node a={1,&c,&b}; tree v; v=&a; sumAt(v,3); return 0; } ``` i tried printing the value of i at each level when but it also gives an error so i can't know, also i tried to ask Copilot and Gemini but they didn't help
{"Voters":[{"Id":7885772,"DisplayName":"Krypton"},{"Id":272109,"DisplayName":"David Makogon"},{"Id":9214357,"DisplayName":"Zephyr"}],"SiteSpecificCloseReasonIds":[18]}
I am encountering an issue with getting the estimation fee on Tron. Currently, I am using the `https://nile.trongrid.io/wallet/estimateenergy` endpoint on the Nile testnet, but I need to transition to the mainnet for estimation. However, this endpoint does not work on the mainnet. Is there an alternative method to obtain the estimation gas fee on the Tron mainnet?
Gas Estimation Fee on Tron Mainnet
|blockchain|web3js|tron|
null
i am here to ask about the problem about this function that calculates the sum at a given depth in a tree, it is working in all cases but the last level, the compiler is giving me this : `[Done] exited with code=3221225477 in 0.309 seconds` and this is my code and everything you need(there is more other functions and stuff but i think this is enough): ``` #include <stdio.h> #include <stdlib.h> #include <math.h> typedef int element; typedef struct node{ element e; struct node * left; struct node * right; }node; typedef node * tree; int isEmpty(tree a){ return a==NULL; } element root(tree a){ return a->e; } tree left(tree a){ return a->left; } tree right(tree a){ return a->right; } int max(int x,int y){ return x>y?x:y; } int sumAtBis(tree a, int n, int i){ if(i==n){ if(isEmpty(a)) return 0; else return root(a); } return sumAtBis(left(a),n,i+1)+sumAtBis(right(a),n,i+1); } int sumAt(tree a, int n){ return sumAtBis(a,n,0); } int testSumAtBis(tree a, int n, int i){ return sumAt(a,n)==0?1:0; } int testSumAt(tree a, int n){ return testSumAtBis(a,n,0)==0?1:0; } int main(){ node g={-1,NULL,NULL}; node f={1,NULL,NULL}; node e={0,&f,&g}; node d={0,NULL,NULL}; node c={1,&d,&e}; node b={-1,NULL,NULL}; node a={1,&c,&b}; tree v; v=&a; sumAt(v,3); return 0; } ``` i tried printing the value of i at each level when but it also gives an error so i can't know, also i tried to ask Copilot and Gemini but they didn't help
SQLAlchemy: efficient relationship loading in 3-way many-to-many relationship
|python|database|sqlalchemy|
null
Why does the first test pass and the second one fail? ```java import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo; import com.github.tomakehurst.wiremock.junit5.WireMockTest; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import reactor.core.publisher.Mono; import reactor.test.StepVerifier; import org.springframework.http.HttpStatus; import org.springframework.web.reactive.function.client.ClientResponse; import org.springframework.web.reactive.function.client.WebClient; import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; import static com.github.tomakehurst.wiremock.client.WireMock.get; import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; @WireMockTest public class GenericTest { int port; String responseBody; @BeforeEach void setUp(WireMockRuntimeInfo info) { port = info.getHttpPort(); responseBody = "response-body"; ResponseDefinitionBuilder response = aResponse() .withStatus(HttpStatus.OK.value()) .withBody(responseBody); stubFor(get("/test").willReturn(response)); } @Test void test1() { Mono<String> bodyMono = WebClient.builder() .baseUrl("http://localhost:%d".formatted(port)) .build() .get() .uri("/test") .retrieve() .bodyToMono(String.class); StepVerifier.create(bodyMono) .expectNext(responseBody) .verifyComplete(); } @Test void test2() { Mono<ClientResponse> responseMono = WebClient.builder() .baseUrl("http://localhost:%d".formatted(port)) .build() .get() .uri("/test") .exchangeToMono(Mono::just); StepVerifier.create(responseMono.flatMap(r -> r.bodyToMono(String.class))) .expectNext(responseBody) .verifyComplete(); } } ``` ```lang-none java.lang.AssertionError: expectation "expectNext(response-body)" failed (expected: onNext(response-body); actual: onComplete()) ``` I need to assert on a `ClientResponse` specifically. It has an expected status and headers, but the body is always empty (even though it shouldn't). I tried calling `releaseBody()` first, but it doesn't help ```java // passes StepVerifier.create(responseMono.flatMap(ClientResponse::releaseBody)) .verifyComplete(); // still fails StepVerifier.create(responseMono.flatMap(r -> r.bodyToMono(String.class))) .expectNext(responseBody) .verifyComplete(); ```
public EmailSender emailSender; public EmployeeImpl employeeImpl; @BeforeEach public void setUp() { emailSender= Mockito.mock(emailSender.class); // Manually create an instance and set mocks employeeImpl= new EmployeeImpl (emailSender); }
I have a SSIS package which is importing multiple Excel file to SQL server but in my excel file there are some null rows on top and it is different in different file for example one excel file has first 5 rows null and data start from 6th row but one of my excel has first 9 rows null and data start from 10th row so is there any method to skip rows according to to null rows dynamically I tried select * from [sheet$A7:H] but it is working for only one excel file I don't want to write code for every file separately is there any way to do co dynamically
What are the sorting order of a Pandas dataframe?
|pandas|
Tensorflow 2.3.0 is still available, but TF 2.3.0 was released for Python 3.5-3.8. From the versions displayed to you, it seems that you are using Python 3.9. So, to install this specific version you need to downgrade the Python version. Another option is to use a newer version of TF that supports your current Python version. The information about the build configurations for Tensorflow can be found [here][1] and you can also check the wheels for the version 2.3.0 at [this link][2] which will indicate Python 3.5-3.8. [1]: https://www.tensorflow.org/install/source_windows#tested_build_configurations [2]: https://pypi.org/project/tensorflow/2.3.0/#files
I'm encountering an issue in Code::Blocks where attempting to build C++ code results in the error message "Error: id returned 5 exit status," even when there are no syntax errors present in the code. Here's an example: ``` #include <iostream> int main() { std::cout<<"hello world"; } ``` Even for this simple code snippet, the same error occurs. The full "rebuild all" log is here ```none -------------- Clean: Release in GraphicsC++ (compiler: GNU GCC Compiler)--------------- Cleaned "GraphicsC++ - Release" -------------- Build: Release in GraphicsC++ (compiler: GNU GCC Compiler)--------------- g++.exe -Wall --verbose -fexceptions -O2 -Iinclude -c C:\Users\ALEX\Documents\GraphicsC++\main.cpp -o obj\Release\main.o g++.exe -o bin\Release\GraphicsC++.exe obj\Release\main.o --verbose - s ..\..\..\..\Windows\SysWOW64\glu32.dll Using built-in specs. COLLECT_GCC=g++.exe Target: x86_64-w64-mingw32 Configured with: ../../../src/gcc-8.1.0/configure --host=x86_64-w64- mingw32 --build=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 -- prefix=/mingw64 --with-sysroot=/c/mingw810/x86_64-810-posix-seh-rt_v6- rev0/mingw64 --enable-shared --enable-static --disable-multilib -- enable-languages=c,c++,fortran,lto --enable-libstdcxx-time=yes -- enable-threads=posix --enable-libgomp --enable-libatomic --enable-lto - -enable-graphite --enable-checking=release --enable-fully-dynamic- string --enable-version-specific-runtime-libs --disable-libstdcxx-pch - -disable-libstdcxx-debug --enable-bootstrap --disable-rpath --disable- win32-registry --disable-nls --disable-werror --disable-symvers --with- gnu-as --with-gnu-ld --with-arch=nocona --with-tune=core2 --with- libiconv --with-system-zlib --with- gmp=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with- mpfr=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with- mpc=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with- isl=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with- pkgversion='x86_64-posix-seh-rev0, Built by MinGW-W64 project' --with- bugurl=https://sourceforge.net/projects/mingw-w64 CFLAGS='-O2 -pipe - fno-ident -I/c/mingw810/x86_64-810-posix-seh-rt_v6- rev0/mingw64/opt/include -I/c/mingw810/prerequisites/x86_64-zlib- static/include -I/c/mingw810/prerequisites/x86_64-w64-mingw32- static/include' CXXFLAGS='-O2 -pipe -fno-ident -I/c/mingw810/x86_64- 810-posix-seh-rt_v6-rev0/mingw64/opt/include - I/c/mingw810/prerequisites/x86_64-zlib-static/include - I/c/mingw810/prerequisites/x86_64-w64-mingw32-static/include' CPPFLAGS=' -I/c/mingw810/x86_64-810-posix-seh-rt_v6- rev0/mingw64/opt/include -I/c/mingw810/prerequisites/x86_64-zlib- static/include -I/c/mingw810/prerequisites/x86_64-w64-mingw32- static/include' LDFLAGS='-pipe -fno-ident -L/c/mingw810/x86_64-810- posix-seh-rt_v6-rev0/mingw64/opt/lib - L/c/mingw810/prerequisites/x86_64-zlib-static/lib - L/c/mingw810/prerequisites/x86_64-w64-mingw32-static/lib ' Thread model: posix gcc version 8.1.0 (x86_64-posix-seh-rev0, Built by MinGW-W64 project) COLLECT_GCC_OPTIONS='-Wall' '-v' '-fexceptions' '-O2' '-I' 'include' '- c' '-o' 'obj\Release\main.o' '-shared-libgcc' '-mtune=core2' '- march=nocona' C:/Program Files/CodeBlocks/MinGW/bin/../libexec/gcc/x86_64-w64- mingw32/8.1.0/cc1plus.exe -quiet -v -I include -iprefix C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/ - D_REENTRANT C:\Users\ALEX\Documents\GraphicsC++\main.cpp -quiet - dumpbase main.cpp -mtune=core2 -march=nocona -auxbase-strip obj\Release\main.o -O2 -Wall -version -fexceptions -o C:\Users\ALEX\AppData\Local\Temp\ccF1iSDG.s GNU C++14 (x86_64-posix-seh-rev0, Built by MinGW-W64 project) version 8.1.0 (x86_64-w64-mingw32) compiled by GNU C version 8.1.0, GMP version 6.1.2, MPFR version 4.0.1, MPC version 1.1.0, isl version isl-0.18-GMP GGC heuristics: --param ggc-min-expand=100 --param ggc-min- heapsize=131072 ignoring duplicate directory "C:/Program Files/CodeBlocks/MinGW/lib/gcc/../../lib/gcc/x86_64-w64- mingw32/8.1.0/include/c++" ignoring duplicate directory "C:/Program Files/CodeBlocks/MinGW/lib/gcc/../../lib/gcc/x86_64-w64- mingw32/8.1.0/include/c++/x86_64-w64-mingw32" ignoring duplicate directory "C:/Program Files/CodeBlocks/MinGW/lib/gcc/../../lib/gcc/x86_64-w64- mingw32/8.1.0/include/c++/backward" ignoring duplicate directory "C:/Program Files/CodeBlocks/MinGW/lib/gcc/../../lib/gcc/x86_64-w64- mingw32/8.1.0/include" ignoring nonexistent directory "C:/mingw810/x86_64-810-posix-seh-rt_v6-rev0/mingw64C:/msys64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../include" ignoring duplicate directory "C:/Program Files/CodeBlocks/MinGW/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/8.1.0/include-fixed" ignoring duplicate directory "C:/Program Files/CodeBlocks/MinGW/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/include" ignoring nonexistent directory "C:/mingw810/x86_64-810-posix-seh-rt_v6-rev0/mingw64/mingw/include" #include "..." search starts here: #include <...> search starts here: include C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++ C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/x86_64-w64-mingw32 C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/backward C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include-fixed C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/include cc version 8.1.0 (x86_64-posix-seh-rev0, Built by MinGW-W64End of search list. GNU C++14 (x86_64-posix-seh-rev0, Built by MinGW-W64 project) version 8.1.0 (x86_64-w64-mingw32) compiled by GNU C version 8.1.0, GMP version 6.1.2, MPFR version 4.0.1, MPC version 1.1.0, isl version isl-0.18-GMP GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: 82f0c9785fd37a38ba7b7f8357369a82 COLLECT_GCC_OPTIONS='-Wall' '-v' '-fexceptions' '-O2' '-I' 'include' '-c' '-o' 'obj\Release\main.o' '-shared-libgcc' '-mtune=core2' '-march=nocona' C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64- mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/as.exe -v -I include -o obj\Release\main.o C:\Users\ALEX\AppData\Local\Temp\ccF1iSDG.s GNU assembler version 2.30 (x86_64-w64-mingw32) using BFD version (GNU Binutils) 2.30 COMPILER_PATH=C:/Program Files/CodeBlocks/MinGW/bin/../libexec/gcc/x86_64-w64- mingw32/8.1.0/;C:/Program Files/CodeBlocks/MinGW/bin/../libexec/gcc/;C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64- mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ LIBRARY_PATH=C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/;C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/;C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/;C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64- mingw32/8.1.0/../../../../lib/;C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/;C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../ COLLECT_GCC_OPTIONS='-Wall' '-v' '-fexceptions' '-O2' '-I' 'include' '-c' '-o' 'obj\Release\main.o' '-shared-libgcc' '-mtune=core2' '- march=nocona' Using built-in specs. COLLECT_GCC=g++.exe COLLECT_LTO_WRAPPER=C:/Program\ Files/CodeBlocks/MinGW/bin/../libexec/gcc/x86_64-w64-mingw32/8.1.0/lto- wrapper.exe Target: x86_64-w64-mingw32 Configured with: ../../../src/gcc-8.1.0/configure --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 -- prefix=/mingw64 --with-sysroot=/c/mingw810/x86_64-810-posix-seh-rt_v6- rev0/mingw64 --enable-shared --enable-static --disable-multilib --enable- languages=c,c++,fortran,lto --enable-libstdcxx-time=yes --enable- threads=posix --enable-libgomp --enable-libatomic --enable-lto --enable- graphite --enable-checking=release --enable-fully-dynamic-string --enable- version-specific-runtime-libs --disable-libstdcxx-pch --disable-libstdcxx- debug --enable-bootstrap --disable-rpath --disable-win32-registry -- disable-nls --disable-werror --disable-symvers --with-gnu-as --with-gnu-ld --with-arch=nocona --with-tune=core2 --with-libiconv --with-system-zlib -- with-gmp=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with- mpfr=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with- mpc=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with- isl=/c/mingw810/prerequisites/x86_64-w64-mingw32-static --with- pkgversion='x86_64-posix-seh-rev0, Built by MinGW-W64 project' --with- bugurl=https://sourceforge.net/projects/mingw-w64 CFLAGS='-O2 -pipe -fno- ident -I/c/mingw810/x86_64-810-posix-seh-rt_v6-rev0/mingw64/opt/include - I/c/mingw810/prerequisites/x86_64-zlib-static/include - I/c/mingw810/prerequisites/x86_64-w64-mingw32-static/include' CXXFLAGS='-O2 -pipe -fno-ident -I/c/mingw810/x86_64-810-posix-seh-rt_v6- rev0/mingw64/opt/include -I/c/mingw810/prerequisites/x86_64-zlib- static/include -I/c/mingw810/prerequisites/x86_64-w64-mingw32- static/include' CPPFLAGS=' -I/c/mingw810/x86_64-810-posix-seh-rt_v6- rev0/mingw64/opt/include -I/c/mingw810/prerequisites/x86_64-zlib- static/include -I/c/mingw810/prerequisites/x86_64-w64-mingw32- static/include' LDFLAGS='-pipe -fno-ident -L/c/mingw810/x86_64-810-posix- seh-rt_v6-rev0/mingw64/opt/lib -L/c/mingw810/prerequisites/x86_64-zlib- static/lib -L/c/mingw810/prerequisites/x86_64-w64-mingw32-static/lib ' Thread model: posix gcc version 8.1.0 (x86_64-posix-seh-rev0, Built by MinGW-W64 project) COMPILER_PATH=C:/Program Files/CodeBlocks/MinGW/bin/../libexec/gcc/x86_64-w64-mingw32/8.1.0/;C:/Program Files/CodeBlocks/MinGW/bin/../libexec/gcc/;C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ LIBRARY_PATH=C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/;C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/;C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/;C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../lib/;C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/;C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../ COLLECT_GCC_OPTIONS='-o' 'bin\Release\GraphicsC++.exe' '-v' '-s' '-shared-libgcc' '-mtune=core2' '-march=nocona' C:/Program Files/CodeBlocks/MinGW/bin/../libexec/gcc/x86_64-w64-mingw32/8.1.0/collect2.exe -plugin C:/Program Files/CodeBlocks/MinGW/bin/../libexec/gcc/x86_64-w64-mingw32/8.1.0/liblto_plugin-0.dll -plugin-opt=C:/Program Files/CodeBlocks/MinGW/bin/../libexec/gcc/x86_64-w64-mingw32/8.1.0/lto-wrapper.exe -plugin-opt=-fresolution=C:\Users\ALEX\AppData\Local\Temp\ccXKJKe8.res -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lmoldname -plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt -plugin-opt=-pass-through=-lpthread -plugin-opt=-pass-through=-ladvapi32 -plugin-opt=-pass-through=-lshell32 -plugin-opt=-pass-through=-luser32 -plugin-opt=-pass-through=-lkernel32 -plugin-opt=-pass-through=-liconv -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lmoldname -plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt --sysroot=C:/mingw810/x86_64-810-posix-seh-rt_v6-rev0/mingw64 -m i386pep -Bdynamic -o bin\Release\GraphicsC++.exe -s C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib/crt2.o C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/crtbegin.o -LC:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0 -LC:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc -LC:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib -LC:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../lib -LC:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib -LC:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../.. obj\Release\main.o ..\..\..\..\Windows\SysWOW64\glu32.dll -lstdc++ - lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt -lpthread -ladvapi32 -lshell32 -luser32 -lkernel32 -liconv -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/x86_64- w64-mingw32/8.1.0/crtend.o collect2.exe: error: ld returned 5 exit status Process terminated with status 1 (0 minute(s), 0 second(s)) 1 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ``` I've tried various troubleshooting steps such as granting full control permissions to the entire Code::Blocks folder for all users and temporarily disabling my antivirus software. However, none of these solutions resolved the issue. Interestingly, I discovered that running Code::Blocks as an administrator and then using the file manager to navigate to the .cpp file, followed by building and running the code, works fine. However, this workaround doesn't apply when opening a project that includes external libraries. I'm using the default GNU GCC compiler in Code::Blocks. Initially, I attempted to resolve the issue by granting full control permissions to the entire Code::Blocks folder for all users and temporarily disabling my antivirus software. However, these efforts did not resolve the error. My expectation was that these troubleshooting steps would rectify the issue and allow me to build C++ code without encountering the "Error: id returned 5 exit status" message. I appreciate any suggestions or insights on how to resolve this issue. Thank you!
I am very mad right now So, I have this simple program ``` #include <windows.h> #include <iostream> #include <stdint.h> int main() { WCHAR Filestring[MAX_PATH] = L"\0"; OPENFILENAMEW ofn = { 0 }; ofn.lStructSize = sizeof(ofn); ofn.lpstrFile = Filestring; ofn.nMaxFile = MAX_PATH; if (GetOpenFileNameW(&ofn)) { } return 0; } ``` This is my "simple reproducible example" When I run this in my visual studio, it crashes at GetOpenFileNameW. Why? I don't know. But when I run the application from the file path instead of debugging, its fine and it opens the dialog like's its supposed to. I realized its an issue with my situation rather than the code so I completely reinstaled windows! After, it worked after I tested it. 5 hours later, I'm getting the same error. Here is my error: [![enter image description here][1]][1] [1]: https://i.stack.imgur.com/ahxC1.png Anyone know what to do? This code used to work, because I just grabbed it from an earlier project that just worked until very recently for no reason.
Issue with GetOpenFileName while debugging
|c++|winapi|
I am trying to create a whack a mole type of game in java but when I run my program the images do not show up. Here is my code so far and I will add the images as well. I am also fairly new to coding so this might be an easy fix but idk. (https://i.stack.imgur.com/43340.gif) (https://i.stack.imgur.com/NmPys.gif)[This is what I see when I run my program](https://i.stack.imgur.com/OHB5f.png) import java.awt.*; import java.awt.event.*; import java.util.Random; import javax.swing.*; public class hellokitty { int screenWidth = 700; int screenHeight = 800; JFrame frame = new JFrame("Catch Hello Kitty!"); JLabel textL = new JLabel(); JPanel textP = new JPanel(); JPanel boardP = new JPanel(); JButton[] board = new JButton[9]; ImageIcon kittyIcon; ImageIcon kuroIcon; JButton currentKittyTile; JButton currentKurTile; Random r = new Random(); Timer setKittyTimer; Timer setKuroTimer; hellokitty(){ //frame.setVisible(true); frame.setSize(screenWidth, screenHeight); frame.setLocationRelativeTo(null); frame.setResizable(false); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLayout(new BorderLayout()); textL.setFont(new Font("Comic Sans MS", Font.PLAIN, 70)); textL.setHorizontalAlignment(JLabel.CENTER); textL.setText("Score: 0"); textL.setOpaque(true); textP.setLayout(new BorderLayout()); textP.add(textL); frame.add(textP, BorderLayout.NORTH); boardP.setLayout(new GridLayout(3,3)); boardP.setBackground(Color.pink); frame.add(boardP); Image KittyImg = new ImageIcon(getClass().getResource("./kitty.gif")).getImage(); kittyIcon = new ImageIcon(KittyImg.getScaledInstance(150, 150, java.awt.Image.SCALE_SMOOTH)); Image KuronomiImg = new ImageIcon(getClass().getResource("./kuronomi.gif")).getImage(); kuroIcon = new ImageIcon(KuronomiImg.getScaledInstance(150, 150, java.awt.Image.SCALE_SMOOTH)); for (int i = 0; i < 9; i ++){ JButton tile = new JButton(); board[i] = tile; boardP.add(tile); // tile.setIcon(kuroIcon); tile.setFocusable(false); } setKittyTimer = new Timer(1000, new ActionListener() { public void actionPerformed(ActionEvent e) { if (currentKittyTile != null) { currentKittyTile.setIcon(null); currentKittyTile = null; } int num = r.nextInt(9); JButton tile = board[num]; currentKittyTile = tile; currentKittyTile.setIcon(kittyIcon); } }); setKuroTimer = new Timer(1500, new ActionListener() { public void actionPerformed(ActionEvent e){ if (currentKurTile != null){ currentKurTile.setIcon(null); currentKurTile = null; } int num = r.nextInt(9); JButton tile = board[num]; currentKurTile = tile; currentKurTile.setIcon(kuroIcon); } }); setKittyTimer.start(); setKuroTimer.start(); frame.setVisible(true); } }
Need Help Extracting Redirect URL from a div Element with Specific Class Name in Python Selenium
|python|selenium-webdriver|web-scraping|
Welcome to fabulous SO and thank you for the interesting question! First, from the standpoint of `ScopedValue` usage you code is, in my opinion, quite correct. I wasn't able to understand what are `bindingsSnapshot` variable and `ScopedValueMap` class in your code, but if you declare `TRACER_SCOPED_VALUE` constant like private static final ScopedValue<String> TRACER_SCOPED_VALUE = ScopedValue.newInstance(); , create a `Carrier` with a value in `decorate` method, not in the `Runnable` ScopedValue.Carrier carrier = ScopedValue.where(TRACER_SCOPED_VALUE, "Long live SO!"); , then upon the execution of the task you would be able to retrieve this value: String value = TRACER_SCOPED_VALUE.get(); So, I believe, it fulfills your goal of propagating a state (`TRACER_SCOPED_VALUE`) from "a thread" (the one which executes `ServiceImpl.xxx`, Executor's `submit`, and Decorators' `decorate`) to "a virtual thread", started by Executor. The following snippet demonstrates sharing a value between a thread that submits a task to an `Executor` and a thread that executes this task: import org.springframework.core.task.SimpleAsyncTaskExecutor; import org.springframework.core.task.TaskDecorator; ... private static final ScopedValue<String> SCOPED_VALUE = ScopedValue.newInstance(); private static class ScopedValueDecorator implements TaskDecorator { public Runnable decorate(Runnable runnable) { final ScopedValue.Carrier carrier = ScopedValue.where(SCOPED_VALUE, "Long Live SO!"); System.out.println(Thread.currentThread().getName() + " maps " + carrier.get(SCOPED_VALUE)); return () -> { carrier.run(runnable); }; } } public static void main(String[] args) { try (SimpleAsyncTaskExecutor executor = new SimpleAsyncTaskExecutor("scope-value-")) { executor.setTaskDecorator(new ScopedValueDecorator()); executor.submit(() -> { System.out.println(Thread.currentThread().getName() + " retrieves " + SCOPED_VALUE.get()); }); } } Note that the usage of virtual threads is not required; `SimpleAsyncTaskExecutor`, however, does not pool the threads and platform threads could be too expensive. As for MDC, (`BasicMDCAdapter`, `LogbackMDCAdapter`) it uses `ThreadLocal`, not `ScopedValue` in a currently available latest version. `ThreadLocal` and `ScopedValue`, although targeting similar problem, are _technically_ unrelated things. So, an answer to > how count MDC work for ScopedValue up to now is "MDS doesn't". EDIT: It does not until you go ahead and implement [your own `MDCAdapter`](https://stackoverflow.com/a/78195317/2366397). An example of such implementation is discussed in [Logback: availability of MDCs in forks created inside a StructuredTaskScope](https://stackoverflow.com/questions/78142173/logback-availability-of-mdcs-in-forks-created-inside-a-structuredtaskscope/)
I followed the recommendations from the best answer and also used a YouTube video that helped me set up the connection between Google Cloud Storage and Snowflake. (www.youtube.com/watch?v=4SBNUNMotRY) The most important point is creating the integration: CREATE OR REPLACE STORAGE INTEGRATION gcs_int TYPE = EXTERNAL_STAGE STORAGE_PROVIDER = 'GCS' ENABLED = TRUE STORAGE_ALLOWED_LOCATIONS = ('gcs://bucket'); GRANT USAGE ON INTEGRATION gcs_int TO ROLE name; After establishing the connection, you need to create a table into which the data will be loaded, and then simply copy it: COPY INTO table_name (column_names) FROM 'gcs://bucket' STORAGE_INTEGRATION = gcs_int FILE_FORMAT = (type = 'CSV' skip_header = 1 FIELD_OPTIONALLY_ENCLOSED_BY = '"' TIMESTAMP_FORMAT = 'YYYY-MM-DD HH24:MI:SS UTC'); This is how I implemented the recommendations and configured the connection between GCS and Snowflake.
Rootless Docker OCI: error modifying OCI spec: failed to inject CDI devices: unresolvable CDI devices nvidia.com/gpu=all: unknown
|docker|nvidia|nvidia-docker|rootless|
null
{"Voters":[{"Id":5468463,"DisplayName":"Vega"},{"Id":2395282,"DisplayName":"vimuth"},{"Id":10008173,"DisplayName":"David Maze"}],"SiteSpecificCloseReasonIds":[18]}
![enter image description here](https://i.stack.imgur.com/Y9f1w.png) ![enter image description here](https://i.stack.imgur.com/Bu9pW.png) ``` <DataGridPremium initialState={{ columns: { columnVisibilityModel: { actions: false, }, }, }} rows={productList} columns={columns} pageSize={10} autoHeight disableRowSelectionOnClick="true" localeText={customizeDataGrid()} slots={{ toolbar: () => ( <GridToolbar showQuickFilter csvOptions={{ fileName: 'Ürün Listesi', delimiter: ';', utf8WithBom:true, }} printOptions={{ disableToolbarButton: true, }} excelOptions={{ fileName: "Ürün listesi", includeHeaders: true, }} /> ) }} /> ``` As you scroll the table with the scroll bar in Mui DataGrid, the filtering screen in the table becomes distorted. I tried to do it via mui datagrid-root but it didn't work.
#cat libCap.def ``` headers = sys/capability.h headerFilter = sys/* compilerOpts.linux = -I/usr/include linkerOpts.linux = -L/usr/lib -lcap ``` when i run `runDebugExecutableNative --stacktrace` , it output that: e: /home/adlyq/.konan/dependencies/x86_64-unknown-linux-gnu-gcc-8.3.0-glibc-2.19-kernel-4.9-2/x86_64-unknown-linux-gnu/bin/ld.gold invocation reported errors The /home/adlyq/.konan/dependencies/x86_64-unknown-linux-gnu-gcc-8.3.0-glibc-2.19-kernel-4.9-2/x86_64-unknown-linux-gnu/bin/ld.gold command returned non-zero exit code: 1. output: /usr/lib/libcap.so: error: undefined reference to '\__isoc23_strtoul', version 'GLIBC_2.38' /usr/lib/libcap.so: error: undefined reference to 'lstat64', version 'GLIBC_2.33' /usr/lib/libcap.so: error: undefined reference to 'fstat64', version 'GLIBC_2.33' FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':linkDebugExecutableNative'. > Compilation finished with errors how can i fix it
use libcap but: undefined reference
|kotlin-native|
null
I have a blazor app that's running on container. Seems to have an issue on domain level because on Domain A it's working but on Domain B it's not. WebSocket is allowed on both domains as per checking on the console. Domain A: I can see this on the network of my devtools for Domain A ![Blazor WebSocket request on Network devtools ](https://i.stack.imgur.com/KZ92G.png) but not on Domain B. No other error messages displayed on the console as well. Is there a way for blazor to not use websocket? I'm not using WASM btw, my rendermode is Interactive SSR
On windows 10 or 11, you can run the command `winget install ezwinports.make` in the command line or powershell to quickly install it. Than you can use the command `make`. p.s.: You might have to add `C:\Program Files (x86)\GnuWin32\bin` to the windows environmental variable `PATH` to enable quick access to the command (thanks for the `JobaDiniz` on this note). There is no need to install choco anymore.
Skip null rows in SSIS of excel file
|ssis|ssis-2012|
null
|sql|mysql|pivot-table|
I have a Streamlit application called PredictaApp that allows users to upload a CSV file and perform various data analysis and preprocessing tasks on the uploaded dataset. One of the tasks is imputing missing values in the dataset, which is handled by the DataImputer class in the missing_data module. predicta.py-> ``` class PredictaApp: def __init__(self): self.df = None ``` ``` def handle_sidebar(self): st.sidebar.title("Predicta") st.sidebar.markdown("---") CustomTheme.set_theme() uploaded_file = st.file_uploader("Upload CSV", type=["csv"]) if uploaded_file is not None: self.df = pd.read_csv(uploaded_file) ``` ``` elif selected_option == "Impute Missing Values": if self.df is not None: impute = missing_data.DataImputer(self.df) self.df = impute.imputer() ``` missing_data.py-> ``` class DataImputer(PredictaApp): def __init__(self, data): super().__init__() if not isinstance(data, pd.DataFrame): raise ValueError("Input data must be a pandas DataFrame.") self.data = data self.logger = logging.getLogger(__name__) self.logger.setLevel(logging.INFO) self.logger.addHandler(logging.StreamHandler()) ``` ``` def drop_missing(self, axis=0): try: original_shape = self.data.shape self.data.dropna(axis=axis, inplace=True) if self.data.shape == original_shape: return None else: return self.data except Exception as e: self.logger.error("An error occurred while dropping missing values: %s", str(e)) raise ``` I want that when I do some modification in missing_data.py that also modify the original df. The issue I'm facing is that when I switch between different options (e.g., Data Explore, Impute Missing Values, Detect Outlier, etc.) in the Streamlit application, the modifications made to the DataFrame in the previous option are not preserved. Specifically, when I impute missing values using the DataImputer class and then switch to a different option, the original unmodified DataFrame is loaded again, overwriting the changes made by the imputation process. I want to ensure that the modifications made to the DataFrame in one option (e.g., Impute Missing Values) are carried over to the other options (e.g., Detect Outlier, Select ML Models, etc.), so that subsequent operations are performed on the modified DataFrame, rather than the original unmodified DataFrame. In summary, the problem statement is: "How to preserve the modifications made to the DataFrame across different options in the Streamlit application, specifically after imputing missing values using the DataImputer class." I tried modifying the `imputer` method in the `DataImputer` class to return the modified DataFrame, and then assign it back to `self.df` in the `PredictaApp` class. I expected this to ensure that the modifications made to the DataFrame in the `DataImputer` class would be reflected in `self.df` in the `PredictaApp` class, and subsequent operations on the DataFrame would use the modified data across different options. However, even after making these changes, when I switched to a new option in Streamlit, the original unmodified DataFrame was being loaded again, overwriting the modifications made in the previous option.
The `onKeyUp` event fires when the [key is released][1]. The fact that you see a lowercase in the event handler indicates that at the time you ***released*** the key you no longer had the shift key pressed. The fact that you see a capital letter appear in the input is a separate behavior. This is based on the key (or combination of keys) that were pressed which can be determined by the `onKeyDown` handler. So even though it feels like you released the shift key before pressing the next character, the shift key's `onkeyup` event did not fire before the character's `onkeydown` event so that leads to a capital letter. To confirm this you can change your event handler to `onKeyDown` and see that a capital letter is printed always matching what the input displays [1]: https://www.w3schools.com/jsref/event_onkeyup.asp
You're running the action in another thread. The app then thinks its finished and disposes what the thread needs - Its not about a delay. You could do: private async void asynchronous () { ProjectItemsEvents_AfterAddProjectItems(); } This will however be marked as a warning since it doesn't use await. If there is no async stuff in "ProjectItemsEvents_AfterAddProjectItems" private async void asynchronous () { await Task.FromResult(ProjectItemsEvents_AfterAddProjectItems()); }
How to Upload a Large File to MinIO
It can be done in single animation starting at "`0` rotation" without stacking and without negative delay, and you were pretty close to that. (Welcome to SO, by the way!) You just had the easing functions set one frame later, but the progression (`ease-out` - `ease-in-out` - `ease-in`) was correct. For the POC demo I've changed the "thing" to resemble a pendulum, because I think it is slightly more illustrative for this purpose: <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-css --> @keyframes swing { /* Starting at the bottom. */ 0% { transform: rotate(0turn); color: red; animation-timing-function: ease-out; } /* From the bottom to the right cusp: start full speed, end slow (ease-out). */ 25% { transform: rotate(-0.2turn); color: blue; animation-timing-function: ease-in-out; } /* From the right cusp to the left cusp: start slow, end slow (ease-in-out). */ 75% { transform: rotate(0.2turn); color: green; animation-timing-function: ease-in; } /* From the left cusp to the bottom: start slow, end full speed (ease-in). */ 100% { transform: rotate(0turn); color: yellow; animation-timing-function: step-end; } /* Back at the bottom. Arrived here at the full speed. Animation timing function has no effect here. */ } div { animation: swing; animation-duration: 3s; /* `animation-timing-function` is set explicitly (overridden) in concrete keyframes. */ animation-iteration-count: infinite; animation-direction: normal; /* `reverse` still obeys "reversed" timing functions from *previous* frames. */ animation-play-state: running; transform-origin: center top; margin: auto; width: 100px; display: flex; flex-direction: column; align-items: center; pointer-events: none; &::before, &::after { content: ''; background-color: currentcolor; } &::before { width: 1px; height: 100px; } &::after{ width: 50px; height: 50px; } } #reset:checked ~ div { animation: none; } #pause:checked ~ div { animation-play-state: paused; } <!-- language: lang-html --> <meta name="color-scheme" content="dark light"> <input type="checkbox" id="pause"><label for="pause">Pause animation</label>, <input type="checkbox" id="reset"><label for="reset">Remove animation</label>. <div></div> <!-- end snippet --> I must admit it never occurred to me that we can set different timing functions for each key frame, so such naturally looking multi-step animation with "bound" easing types is in fact achievable. Big takeaway for me is also information that easing function of the last (`to` / `100%`) key frame logically doesn't have any effect. Personally I'd go most probably with terser animation with only two key frames, `..direction: alternate` starting paused, and having negative delay shifting it's initial state to the middle, similar to that proposed in other answer here.
I have a ksqldbcluster with 2 nodes. Sometimes i might receive an alert from grafana(which i monitor the cluster) that some queries are in error state. When i check the show queries i see that a number of queries have 1 PERSISTENT running and 1 ERROR. I restart first the second ksqdb docker instance. Sometimes is fixed sometimes is not. If is not i restart the first ksqldb docker instance and then is fixed. Any ideas? {version: '3' services: ksqldb-server: container_name: ksqldb-server hostname: ksqldb.xxxxxxx network_mode: host image: confluentinc/ksqldb-server:latest environment: KSQL_HOST_NAME: ksqldb.xxxxxxxx KSQL_BOOTSTRAP_SERVERS: xxxxxx:9093 KSQL_SECURITY_PROTOCOL: SSL KSQL_LISTENERS: http://xxxxxx:8088,https://xxxxxx:8443 KSQL_KSQL_SCHEMA_REGISTRY_URL: http://xxxxxxxx-as.net:8081,http://xxxxxx:8082 KSQL_SSL_CLIENT_KEY_STORE_LOCATION: /etc/kafka/secrets/ksqldb.keystore.jks KSQL_SSL_CLIENT_KEY_STORE_PASSWORD: xxxxxx KSQL_SSL_CLIENT_TRUST_STORE_LOCATION: /etc/kafka/secrets/ksqldb.keystore.jks KSQL_SSL_CLIENT_TRUST_STORE_PASSWORD: xxxxxxx KSQL_SERVER_ID: id1 KSQL_STREAMS_NUM_STANDBY_REPLICAS: 1 # Corrected property name KSQL_LOG4J_ROOT_LOGLEVEL: "ERROR" KSQL_QUERY_PULL_ENABLE_STANDBY_READS: true KSQL_HEARTBEAT_ENABLE: true KSQL_QUERY_PULL_THREAD_POOL_SIZE: "30" KSQL_LAG_REPORTING_ENABLE: true KSQL_INTERNAL_LISTENER: http://xxxxxxx:8080 KSQL_SSL_TRUSTSTORE_LOCATION: /etc/kafka/secrets/ksqldb.truststore.jks KSQL_SSL_TRUSTSTORE_PASSWORD: xxxxxx KSQL_SSL_KEYSTORE_LOCATION: /etc/kafka/secrets/ksqldb.keystore.jks KSQL_SSL_KEYSTORE_PASSWORD: xxxxxxx KSQL_JMX_OPTS: -Dcom.sun.management.jmxremote -javaagent:/etc/kafka/secrets/jmx_prometheus_javaagent-0.17.2.jar=4000:/etc/kafka/secrets/ksql.yaml ports: - 8088:8088 - 4000:4000 - 8443:8443 volumes: - /ksqldata/data:/var/lib/ksqldb-server/data - /ksqldata/newssl/:/etc/kafka/secrets/ ksqldb-cli: image: confluentinc/ksqldb-cli:latest container_name: ksqldb-cli entrypoint: /bin/sh tty: true # Corrected indentation telegraf: image: telegraf restart: always volumes: - ./telegraf.conf:/etc/telegraf/telegraf.conf:ro - /var/run/docker.sock:/var/run/docker.sock ~ } When restarting ksqldb instance the issue is resolved. Maybe i am missing something in my parameters or how to fix the error?
My Goal is to click Submit Button(Here in Korea) of URL below. "https://datacentersupport.lenovo.com/us/ko/warrantylookup#/". The VBA source code puts "j30a7xlg" using Sendkeys sucessfully. After that, to click button, I tried with css selector without success. The error image is attached. I also tried with xPath below. but failed. ```vba chd.FindElementByXPath("//*[@id='app-standalone-warrantylookup']/div/div[2]/div/div/div[2]/button and text()='제출']").Click ``` So Please advise or code for how to click the button. If need more info,let me know. ```vba Private BR_wty As New Selenium.ChromeDriver Sub ChromeExe(ByVal c As ChromeDriver, ByVal URL As String) c.Get URL End Sub Sub Scrape_WTYMY1() 'warranty Dim URL As String, i As Integer URL = "https://datacentersupport.lenovo.com/us/ko/warrantylookup#/" Call ChromeExe(BR_wty, URL) Dim chd As New Selenium.ChromeDriver '//Local var Set chd = BR_wty Application.ScreenUpdating = False chd.FindElementByClass("button-placeholder__input").SendKeys "j30a7xlg" 'Q1: how to click button ERROR (image for Run-time error 11) chd.FindElementByCss("#app-standalone-warrantylookup > div > div.warranty-lookup__content > div > div > div.basic-search__content > button").Click Application.Wait Now() + TimeSerial(0, 0, 10) Application.ScreenUpdating = True End Sub ``` [![enter image description here][1]][1] Any VBA code(draft) or advice will be helpful for my goal. [1]: https://i.stack.imgur.com/JByqe.png