instruction
stringlengths
0
30k
null
We are receiving events from event hub and used spark streaming as processing . For testing purpose I have sent 300 events in sequence , I have two streams as I mentioned below but I see some data is missing in both the streams some times first stream is working correctly and second stream is missing to process, first stream is just to append and delete, second stream is aggregation df1.writeStream.queryName(f"display1").format( "delta" ).foreachBatch( lambda dataframe, _: fun1(spark, path,df1) ).trigger( processingTime="30 seconds" ).outputMode( "update" ).start() updated_df = func(spark, df_with_signals) query=updated_df.writeStream.queryName("display2").format( "delta" ).foreachBatch( lambda dataframe, _: fun2(spark, dataframe) ).trigger( processingTime="2 seconds" ).outputMode( "update" )
Events processing missing in spark streaming
|apache-spark|pyspark|spark-streaming|azure-databricks|spark-structured-streaming|
You need to loop your array and nest another loop into the array to see whether you already found the element. ``` #include <iostream> int main() { bool found = false; int array[] = {1, 4, 5, 3, 7, 5, 2, 7}; int length = sizeof(array) / sizeof(array[0]); for (int i = 0; i < length; i++) { found = false; for (int j = 0; (!found) && (j < i); j++) { if (array[i] == array[j]) found = true; } if (!found) std::cout << array[i] << " "; } } ``` You can also create an `std::set` and attempt to `insert` all array elements and print them out whenever it succeeds (which means they are encountered for the first time): ``` #include <iostream> #include <set> int main() { int array[] = {1, 4, 5, 3, 7, 5, 2, 7}; int length = sizeof(array) / sizeof(array[0]); std::set<int> myset; for (int i = 0; i < length; i++) { if (myset.insert(array[i]).second) { std::cout << array[i] << " "; } } } ```
The difference in behavior you're observing is likely due to the size of `long` and `unsigned long` on different platforms. On Windows, the size of long is typically 4 bytes (32 bits), while on many Linux systems, it is 8 bytes (64 bits). This difference in size affects the result of the expression `1L + 1U`. To ensure consistent behavior across different platforms, you can use explicit type casting to specify the desired type. In your case, if you want the result to be of type long, you can cast the result explicitly. Here's an example: #include <typeinfo> #include <cassert> #include <iostream> int main() { // Use explicit type casting to ensure consistent behavior long result = static_cast<long>(1L + 1U); assert(typeid(result) == typeid(long)); std::cout << typeid(result).name(); } This way, you explicitly cast the result of the expression `1L + 1U` to `long`, ensuring that the type is consistent across different platforms. Keep in mind that explicitly casting the result might lead to loss of information if the value exceeds the range of long. Make sure that your code logic can handle such situations appropriately.
|angular|ionic-framework|firebase-authentication|
null
null
Hi In response to your inquiry, here's a sample code from Refinitiv: ``` df = rdp.Search.search(     view = rdp.SearchViews.GovCorpInstruments, filter = f"ParentOAPermID eq '{org_id}'and IsActive eq true and not(AssetStatus in ('MAT'))", # Define the upper limit of rows within our result set.  This is a imposed maximum value. top = 10000,  select = ','.join(properties), navigators = "Currency" ) ``` The maximum amount of data output retrievable from Eikon is capped at 10,000 due to system-imposed limitations. Therefore, setting the parameter top to 20,000 will result in the query failing and yielding an empty data frame. Please visit the article linked [here][1] to check more details. [1]: https://developers.lseg.com/en/article-catalog/article/debt-structure-analysis-on-an-organizational-level
To expand on correct [Answer by rahulmohan][1], I will add some example code. Define our `Item` & `User` classes. ```java record Item( String description ) { } ``` ```java final class User { private final String name; private final List < Item > items; User ( String name , List < Item > items ) { this.name = name; this.items = items; } public String name ( ) { return name; } public List < Item > items ( ) { return items; } public void addItem ( final Item item ) { this.items.addLast( item ); // Or, before Java 21: `List.add( this.items.size() , item )`. } @Override public boolean equals ( Object obj ) { if ( obj == this ) return true; if ( obj == null || obj.getClass( ) != this.getClass( ) ) return false; var that = ( User ) obj; return Objects.equals( this.name , that.name ) && Objects.equals( this.items , that.items ); } @Override public int hashCode ( ) { return Objects.hash( name , items ); } @Override public String toString ( ) { return "User[" + "name=" + name + ", " + "items=" + items + ']'; } } ``` Some example data. ```java final List < Item > masterListOfItems = new ArrayList <>( List.of( new Item( "Dog" ) , new Item( "Cat" ) , new Item( "Bird" ) ) ); final List < User > users = new ArrayList <>( List.of( new User( "Alice" , new LinkedList <>( masterListOfItems ) ) , new User( "Bob" , new LinkedList <>( masterListOfItems ) ) , new User( "Carol" , new LinkedList <>( masterListOfItems ) ) ) ); ``` Bob prefers cats. So he moves the second item `Cat` into the first position (index zero), above `Dog` item. ```java // Bob prefers cats. // Retrieve Bob. User bob = users.stream( ).filter( user -> user.name( ).equalsIgnoreCase( "Bob" ) ).findAny( ).get( ); System.out.println( "(before move) bob = " + bob ); // Retrieve the Cat item. Item cat = bob.items( ).stream( ).filter( item -> item.description( ).equalsIgnoreCase( "Cat" ) ).findAny( ).get( ); // To move the position of `Cat` in the list, remove, and add back in. bob.items( ).remove( cat ); bob.items( ).addFirst( cat ); System.out.println( "(after move) bob = " + bob ); ``` When run: ```none (before move) bob = User[name=Bob, items=[Item[description=Dog], Item[description=Cat], Item[description=Bird]]] (after move) bob = User[name=Bob, items=[Item[description=Cat], Item[description=Dog], Item[description=Bird]]] ``` You said: > The size of the list is not constant. I assume that means you want to add an item, and possibly remove. Let's look at addition. We need to add the new item to the master list, and then add the item to each `User` object’s own `List`. ```java // New item. Item hamster = new Item( "Hamster" ); // Add new item to the master list. masterListOfItems.addLast( hamster ); // Add new item to the list contained within each `User` object. users.forEach( user -> user.addItem( hamster ) ); System.out.println( "(after add) bob = " + bob ); System.out.println( "masterListOfItems = " + masterListOfItems ); ``` When run, we see that Bob has his own list ordered by his personal preference while the order of our master list remains undisturbed. ```none (after add) bob = User[name=Bob, items=[Item[description=Cat], Item[description=Dog], Item[description=Bird], Item[description=Hamster]]] masterListOfItems = [Item[description=Dog], Item[description=Cat], Item[description=Bird], Item[description=Hamster]] ``` Be aware that this use of multiple lists is efficient with memory. The content objects (`User` & `Item` objects) are *not* being duplicated. There is only **one instance of every `Item`** object in memory. Each single instance is shared, by way of a reference, amongst the many `List` objects each owned by a `User` object. [1]: https://stackoverflow.com/a/5101103/642706
Why not create your own simple Google SignIn button using a TextView and the Google logo came up with Google signing library: <TextView android:text="Sign In with Google" android:gravity="center" android:background="@drawable/<of your choice if required>" android:padding="16dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:drawablePadding="8dp" app:drawableStartCompat="@drawable/googleg_standard_color_18"/> [![enter image description here][1]][1] [1]: https://i.stack.imgur.com/je3d8.png
In your view you have unread_notifications = Notification.objects.filter(user=request.user, is_read=False).count() With count() at the end, if there is 1 unread notification, unread_notifications will be 1. It won't be the unread notification object, so it won't have an is_read property I suspect you want: unread_notifications = Notification.objects.filter(user=request.user, is_read=False) for notification in unread_notifications: #We don't need this line as the filter guarantees is_read=False #if notification.is_read == False: notification.is_read = True notification .save()
My linguistics rating experiment contains 36 stimuli in total for rating. There are 6 themes (e.g. doctor, farm, etc), and each theme has 3 conditions (good, bad, mixed), and each condition has 2 sentences. So there is a total of 3x2x6 = 36 sentences. I had 54 participants, each participant rates one sentence from each theme, with each rating 6 sentences in total. My goal is to test if the 3 conditions significantly produce different ratings (e.g. condition good produces better ratings than condition bad). I am trying to interpret the data results using the brms package in r, taking participants and themes into consideration (in the case where these two factors contribute to ratings as well). Currently, my model looks like this: ``` fit_1 <- brm( rating ~ 1 + condition + (1|theme) + (1|participant), data = stimuli_rating, family = cumulative() ) ``` Is this how the model is supposed to be? ``` fit_2 <- brm( rating ~ 1 + condition*theme + (1|participant), data = stimuli_rating, family = cumulative() ) ``` What about this? Thank you!
Suppose A is a symmetric matrix whose SVD is A= USV^T, and let B = U\sqrt{S}V^T, then B^2 should be equal to A. But when I implemented it using tensorflow, B^2 and A does not match. Highly appreciated if you could give some advice! [code][1] [1]: https://i.stack.imgur.com/2aIvr.png
I have a python program that starts an OpenCV face detection function on startup. This code works fine and the camera is able to run and face detection works fine. On pressing the 'Q' key within the OpenCV frame, a pygame program (Pong) is started. However, once the game starts, the OpenCV capture hangs immediately. How do i fix my code so that both are running in parallel? from time import sleep import cv2 from cvzone.FaceDetectionModule import FaceDetector import numpy as np import logging import threading from time import sleep import time import pygame pygame.init() # Font that is used to render the text font20 = pygame.font.Font('freesansbold.ttf', 20) # RGB values of standard colors BLACK = (0, 0, 0) WHITE = (255, 255, 255) GREEN = (0, 255, 0) # Basic parameters of the screen WIDTH, HEIGHT = 900, 600 screen = pygame.display.set_mode((WIDTH, HEIGHT)) pygame.display.set_caption("Pong") clock = pygame.time.Clock() FPS = 30 # Striker class class Striker: # Take the initial position, dimensions, speed and color of the object def __init__(self, posx, posy, width, height, speed, color): self.posx = posx self.posy = posy self.width = width self.height = height self.speed = speed self.color = color # Rect that is used to control the position and collision of the object self.geekRect = pygame.Rect(posx, posy, width, height) # Object that is blit on the screen self.geek = pygame.draw.rect(screen, self.color, self.geekRect) # Used to display the object on the screen def display(self): self.geek = pygame.draw.rect(screen, self.color, self.geekRect) def update(self, yFac): self.posy = self.posy + self.speed*yFac # Restricting the striker to be below the top surface of the screen if self.posy <= 0: self.posy = 0 # Restricting the striker to be above the bottom surface of the screen elif self.posy + self.height >= HEIGHT: self.posy = HEIGHT-self.height # Updating the rect with the new values self.geekRect = (self.posx, self.posy, self.width, self.height) def displayScore(self, text, score, x, y, color): text = font20.render(text+str(score), True, color) textRect = text.get_rect() textRect.center = (x, y) screen.blit(text, textRect) def getRect(self): return self.geekRect # Ball class class Ball: def __init__(self, posx, posy, radius, speed, color): self.posx = posx self.posy = posy self.radius = radius self.speed = speed self.color = color self.xFac = 1 self.yFac = -1 self.ball = pygame.draw.circle( screen, self.color, (self.posx, self.posy), self.radius) self.firstTime = 1 def display(self): self.ball = pygame.draw.circle( screen, self.color, (self.posx, self.posy), self.radius) def update(self): self.posx += self.speed*self.xFac self.posy += self.speed*self.yFac # If the ball hits the top or bottom surfaces, # then the sign of yFac is changed and # it results in a reflection if self.posy <= 0 or self.posy >= HEIGHT: self.yFac *= -1 if self.posx <= 0 and self.firstTime: self.firstTime = 0 return 1 elif self.posx >= WIDTH and self.firstTime: self.firstTime = 0 return -1 else: return 0 def reset(self): self.posx = WIDTH//2 self.posy = HEIGHT//2 self.xFac *= -1 self.firstTime = 1 # Used to reflect the ball along the X-axis def hit(self): self.xFac *= -1 def getRect(self): return self.ball # Game Manager def pong(): running = True # Defining the objects geek1 = Striker(20, 0, 10, 100, 10, GREEN) geek2 = Striker(WIDTH-30, 0, 10, 100, 10, GREEN) ball = Ball(WIDTH//2, HEIGHT//2, 7, 7, WHITE) listOfGeeks = [geek1, geek2] # Initial parameters of the players geek1Score, geek2Score = 0, 0 geek1YFac, geek2YFac = 0, 0 while running: screen.fill(BLACK) # Event handling for event in pygame.event.get(): if event.type == pygame.QUIT: running = False if event.type == pygame.KEYDOWN: if event.key == pygame.K_UP: geek2YFac = -1 if event.key == pygame.K_DOWN: geek2YFac = 1 if event.key == pygame.K_w: geek1YFac = -1 if event.key == pygame.K_s: geek1YFac = 1 if event.type == pygame.KEYUP: if event.key == pygame.K_UP or event.key == pygame.K_DOWN: geek2YFac = 0 if event.key == pygame.K_w or event.key == pygame.K_s: geek1YFac = 0 # Collision detection for geek in listOfGeeks: if pygame.Rect.colliderect(ball.getRect(), geek.getRect()): ball.hit() # Updating the objects geek1.update(geek1YFac) geek2.update(geek2YFac) point = ball.update() # -1 -> Geek_1 has scored # +1 -> Geek_2 has scored # 0 -> None of them scored if point == -1: geek1Score += 1 elif point == 1: geek2Score += 1 # Someone has scored # a point and the ball is out of bounds. # So, we reset it's position if point: ball.reset() # Displaying the objects on the screen geek1.display() geek2.display() ball.display() # Displaying the scores of the players geek1.displayScore("Geek_1 : ", geek1Score, 100, 20, WHITE) geek2.displayScore("Geek_2 : ", geek2Score, WIDTH-100, 20, WHITE) pygame.display.update() clock.tick(FPS) def getface(): print("Face") cap = cv2.VideoCapture(0) ws, hs = 1280, 720 cap.set(3, ws) cap.set(4, hs) fx=0 if not cap.isOpened(): print("Camera couldn't Access!!!") exit() #port = "COM7" #board = pyfirmata.Arduino(port) #servo_pinX = board.get_pin('d:9:s') #pin 9 Arduino #servo_pinY = board.get_pin('d:10:s') #pin 10 Arduino detector = FaceDetector() #servoPos = [90, 90] # initial servo position while True: success, img = cap.read() img, bboxs = detector.findFaces(img, draw=False) if bboxs: #get the coordinate fx, fy = bboxs[0]["center"][0], bboxs[0]["center"][1] pos = [fx, fy] cv2.circle(img, (fx, fy), 80, (0, 0, 255), 2) cv2.putText(img, str(pos), (fx+15, fy-15), cv2.FONT_HERSHEY_PLAIN, 2, (255, 0, 0), 2 ) cv2.line(img, (0, fy), (ws, fy), (0, 0, 0), 2) # x line cv2.line(img, (fx, hs), (fx, 0), (0, 0, 0), 2) # y line cv2.circle(img, (fx, fy), 15, (0, 0, 255), cv2.FILLED) cv2.putText(img, "TARGET LOCKED", (850, 50), cv2.FONT_HERSHEY_PLAIN, 3, (255, 0, 255), 3 ) else: cv2.putText(img, "NO TARGET", (880, 50), cv2.FONT_HERSHEY_PLAIN, 3, (0, 0, 255), 3) cv2.circle(img, (640, 360), 80, (0, 0, 255), 2) cv2.circle(img, (640, 360), 15, (0, 0, 255), cv2.FILLED) cv2.line(img, (0, 360), (ws, 360), (0, 0, 0), 2) # x line cv2.line(img, (640, hs), (640, 0), (0, 0, 0), 2) # y line cv2.putText(img, f'Servo X: 1 deg', (50, 50), cv2.FONT_HERSHEY_PLAIN, 2, (255, 0, 0), 2) cv2.putText(img, f'Servo Y: 88 deg', (50, 100), cv2.FONT_HERSHEY_PLAIN, 2, (255, 0, 0), 2) #servo_pinX.write(servoPos[0]) #servo_pinY.write(servoPos[1]) cv2.imshow("Image", img) if cv2.waitKey(1) & 0xFF == ord("q"): t1=threading.Thread(target=pong()) t1.start() t1.join() #break cap.release() def main(): t2=threading.Thread(target=getface()) t2.start() #t1.start() #t2.join() #t1.join() if __name__ == "__main__": main() pygame.quit()
Python OpenCV and PyGame threading issue
|python|opencv|pygame|
I have a website for car and tow services for passenger cars and services which includes assistance and assistance for damaged cars in the North Only the pages I create will not be indexed for long. Please do a check. https://emdadrodbar.ir/ I used the yoast plugin and registered my sitemap in Google Search Console, but it didn't change much. Is there a better solution to get my pages indexed sooner?
The problem is that it takes a long time to index web pages in emdadrodbar.ir.؟
Is there any way to tell Notepad please remove the following [DOCUMENT](https://i.stack.imgur.com/Ukr0X.jpg) Remove all the empty characters after the last , sign. I know I can tell please replace , with empty but the problem is I have many , that hast to stay in the file. I just need notepad to remove EVERYTHING including that last , sign after the last , sign in the document. For example 14.56364,46.02230,1,80,1,216,Golovec I need that to be 14.56364,46.02230,1,80 With no empty spaces after that or that last , sign. The problem is sometimes some lines have more than one empty characters after the last , sign. This does not help **.{1}$** The problem is the Python script I have and is very sensitive to any kind of extra signs of characters after the last , sign. Thank you I tried all the .{1}$ replace empty spaces...works but needs to be repeated since some lines have more than one empty charatcter.
Yes, you can use emmeans to compute the odds ratio for females at the ages of 47 and 33. (I've rounded the ages as 47.356 and 32.634 seem oddly specific for a person's age.) For clarity I refit the model without the `rms` bells and whistles. I'll also calculate the same contrast with both [`emmeans`](https://cran.r-project.org/web/packages/emmeans/vignettes/comparisons.html) and [`marginaleffects`](https://marginaleffects.com). ``` r # ... code to generate myData ... fit.lrm <- lrm(y ~ age * sex, data = myData) # Log odds ratio k <- rms::contrast( fit.lrm, list(sex = "female", age = 47), list(sex = "female", age = 33) ) # Odds ratio print(k, fun = exp) #> sex Contrast S.E. Lower Upper Z Pr(>|z|) #> 1 female 12.70547 NA 4.68864 34.42982 5 0 #> #> Confidence intervals are 0.95 individual intervals fit.glm <- glm(y ~ age * sex, family = binomial(), data = myData) ``` With `emmeans` first we specify the reference grid (in this case, sex = female at two different ages) and then we calculate the pairwise contrast. ``` r emm <- emmeans(fit.glm, ~ age + sex, at = list(sex = "female", age = c(47, 33))) # Use `type = "response"` to get the odds ratio (rather than the log odds ratio) emmeans::contrast(emm, method = "pairwise", type = "response") #> contrast odds.ratio SE df null z.ratio p.value #> age47 female / age33 female 12.7 6.46 Inf 1 4.998 <.0001 #> #> Tests are performed on the log odds ratio scale # `pairs` is short-hand for `contrast(emm, method = "pairwise")` confint(pairs(emm, type = "response")) #> contrast odds.ratio SE df asymp.LCL asymp.UCL #> age47 female / age33 female 12.7 6.46 Inf 4.69 34.4 #> #> Confidence level used: 0.95 #> Intervals are back-transformed from the log odds ratio scale ``` With `marginaleffects` we calculate the contrast (ie. the comparison) in one step. ``` r marginaleffects::comparisons( fit.glm, variables = list(age = c(47, 33)), newdata = datagrid(sex = "female"), type = "link", transform = exp ) #> #> Term Contrast sex Estimate Pr(>|z|) S 2.5 % 97.5 % age #> age 47 - 33 female 12.7 <0.001 20.7 4.69 34.4 40.4 #> #> Columns: rowid, term, contrast, estimate, p.value, s.value, conf.low, conf.high, sex, predicted_lo, predicted_hi, predicted, y, age #> Type: link ```
We are using Orkes as a managed solution. What I have found in our organization is that the support and expertise of the Orkes team (paid for solution) is much more valuable to our software practice than hosting it or managing it ourselves. Orkes to Conductor, is to me like RedHat is to Linux. You can use the OpenSource version very well, but if you need enterprise capabilities, then you can go with the supported version, i.e. Orkes.
- **azure-storage-blob**: - **12.19.1**: - **Windows 10**: - **3.10.6**: **Describe the bug** When attempting to retrieve the list of blob names from the Azure Blob Storage container, an "Incorrect padding" error is encountered. This issue seems to be causing a hindrance in fetching the blob names effectively. **Code Snippet:** ```python try: # Get the list of blobs in the container blob_list = self.container_client.list_blobs() print("List of blobs:") for blob in blob_list: print(blob.name) except Exception as e: print(f"An error occurred while retrieving the list of blobs: {str(e)}") ``` **Error Message:** `Incorrect padding`
Getting "Incorrect padding" error when trying to retrieve the list of blob names
|python|azure|azure-blob-storage|
You need to use https://www.npmjs.com/package/@emotion/is-prop-valid then try to use such a wrapper: <StyleSheetManager shouldForwardProp={shouldForwardProp}> <App /> </StyleSheetManager> And then – the shouldForwardProp realisation from previous answer or similar.
I found the solution def test_create_todo(client): with TestClient(app) as client: data = {"title": "Todo 1", "description": "Description Todo 1"} response = client.post("/todos", json=data) assert response.status_code == 201
I have issues replacing text with pre defined text when the user hovers over the original text. I have it working on some but not on others. Can someone explain to me what is that I am doing wrong? Any help will be grateful.
How to set text inside a div using JavaScript and CSS
|text|hover|
null
How users can logout/delete his account from google spread sheet database using javascript when the user click there delete buttton on account.html
I found you can set a negative value for `plugins.title.padding.bottom` to achieve this. The legend and title will overlap if the space is needed though. The settings I am using are: ``` plugins.legend.display = true plugins.legend.align = 'end' plugins.legend.position = 'top' plugins.title.display = true plugins.title.padding.bottom = -27 plugins.title.text = 'My Chart Title' plugins.title.align = 'start' ```
SET TRANSACTION ISOLATION LEVEL { READ UNCOMMITTED | READ COMMITTED | REPEATABLE READ | SNAPSHOT | SERIALIZABLE } will change the isolation level for the duration of the connection or until changed by a subsequent set command. In my case I expect that lowering the isolation level to snapshot will achieve the desired result. This is documented https://learn.microsoft.com/en-us/sql/t-sql/statements/set-transaction-isolation-level-transact-sql?view=sql-server-ver16
diff3 output in git conflict style, including mergeable hunks
|git|diff|git-diff|diff3|
> The thing is if my `updateCategoryDto` is null If the input (`updateCategoryDto`) is `null` then there's something wrong with the request. In that case, return `400 Bad Request`: if (updateCategoryDto is null) return new BadRequestResult(); Alternatively, you may wish to use one of the alternative types, like [BadRequestObjectResult][1], if you want to supply additional information to the caller. Often, however, the ASP.NET framework is going to intercept the request even before that, so that in practice, your action method never gets called with a `null` value. [1]: https://learn.microsoft.com/dotnet/api/microsoft.aspnetcore.mvc.badrequestobjectresult
You need to clone the `Carbon` object or change to immutable object. Carbon is a mutable object by default. Use `copy` method $booking_end = $booking_start->copy()->addMinute(45)->format("Y-m-d H:i:s"); ---------- Look this Stack Overflow post, same issue https://stackoverflow.com/a/49905830/11836673
I think you could change your code here: ``` tree.plot_tree(classifier.fit(Xtest, Ytest)) ``` into: ``` tree.plot_tree(decision_tree.named_steps['cls']) ``` as named_steps is an attribute of your fitted pipeline. See [this link](https://scikit-learn.org/stable/modules/generated/sklearn.pipeline.Pipeline.html) for more details.
I was following a tutorial on Web API and I saw the creator creating his service method as nullable `( Task<Comment?> Update(CommentUpdateDto comment) )` and he later used it like following which made sense: ``` [HttpPut("{id:int}")] public async Task<IActionResult> Update([FromRoute] int id, [FromBody] CommentUpdateDto commentUpdateDto) { if (!ModelState.IsValid) return BadRequest(ModelState); var comment=await _commentRepo.UpdateAsync(id, commentUpdateDto.ToCommentFromUpdate()); if (comment == null) { return NotFound("Comment not found!"); } return Ok(comment); } ``` Now I want to use same approach in my `ASP.Net Core MVC` app, but for some reason it doesn't make sense. It is probably because I am using `Fluent Validation` with auto mapper. My CategoryService: ``` public async Task<Category?> UpdateCategoryAsync(UpdateCategoryDto updateCategoryDto) { var category = await GetCategoryByIdAsync(updateCategoryDto.Id); if (category == null) return null; mapper.Map(updateCategoryDto, category); await unitOfWork.GetRepository<Category>().UpdateAsync(category); await unitOfWork.SaveChangesAsync(); return category; } ``` My Controller Action: ``` [HttpPost] public async Task<IActionResult> Update(UpdateCategoryDto updateCategoryDto) { var category=mapper.Map<Category>(updateCategoryDto); var result = validator.Validate(category); var exists= await categoryService.Exists(category); if(exists) result.Errors.Add(new ValidationFailure("Name", "This category name already exists")); if(result.IsValid) { await categoryService.UpdateCategoryAsync(updateCategoryDto); return RedirectToAction("Index", "Category", new { Area = "Admin" }); } result.AddToModelState(ModelState); return View(updateCategoryDto); } ``` I tried to modify it like this: ``` public async Task<IActionResult> Update(UpdateCategoryDto updateCategoryDto) { var category = mapper.Map<Category>(updateCategoryDto); var result = validator.Validate(category); var exists = await categoryService.Exists(category); if (exists) result.Errors.Add(new ValidationFailure("Name", "This category name already exists")); if (result.IsValid) { var value = await categoryService.UpdateCategoryAsync(updateCategoryDto); if(value == null) return NotFound(); return RedirectToAction("Index", "Category", new { Area = "Admin" }); } result.AddToModelState(ModelState); return View(updateCategoryDto); } ``` The thing is if my `updateCategoryDto` is null, I cannot even pass the validation as my category will be null, so my modification doesn't change anything. I want to know what changes I should make in order to have a logical flow. Should I just use my service method as `Task<Category>` instead of `Task<Category?>` or do I have to make changes in my controller action. Note that I am a self-taught beginner, so any suggestions or advice is valuable for me. If you think I can make changes in my code for better, please share it with me. Thanks in advance!
i need answer in simple c++ like the code im using it prints me the repeated nums ``` #include <iostream> using namespace std; int main() { int arr[5], arr2[5], i = 0, j = 0; cout << "enter elements of array:\n"; for (i = 0; i < 5; i++) { cin >> arr[i]; } for (i = 0; i < 5; i++) { for (j = 0; j < i; j++) { if (arr[i] == arr[j])break; } if (i == j) cout << arr[i]; } } ```
I started to write a discord bot using discord.js. I also followed the guid they provided until I was finished with "Event handling": https://discordjs.guide/creating-your-bot/event-handling.html#reading-event-files I wrote my first event where I want the bot to write a welcome message in a channel when somebody joins the server. This is my code: welcome.js ``` const { Events } = require('discord.js'); module.exports = { name: Events.GuildMemberAdd, once: true, execute(client, member) { const channelID = '1194723491551912079'; const channel = client.channels.cache.get(channelID); const message = `Welcome <@${member}>!`; channel.send(message); }, }; ``` The slash commands from the guide (user, ping and server) are working and also the ClientReady event. I don't know what to do after searching for some solutions and being new to js. Thank you for your help in advance.
Sending welcome message in channel using discord.js
|javascript|discord.js|
I have a npc class which has a method called chase that is referenced inside the update function. when chase is called it says its not a function or it's not defined. I have another method being referenced in the same way that works. [enter image description here](https://i.stack.imgur.com/SvQ91.png) chase method. [enter image description here](https://i.stack.imgur.com/kprh4.png) chase is called at npc_spr.chase(); this creates an error while above the bullet_spr.updateMe() works. updateMe is also a method. what I expected to happen was for the method to be called like the one above. I have tried many different ways of rewriting it but everything results in the not defined or not a function error.
Phaser 3, function doesn't exist/not defined
|phaser-framework|
null
I believe this will work in `2010`: B1: =IF(A1="Name","Group",IF(A2="Name","", INDEX($A$1:A1,LOOKUP(2,1/($A$1:A1="Name"),ROW($A$1:A1))-1))) and fill down. ***Algorithm*** - If the adjacent cell in Column A = "Name" then enter "Group" - If the next cell down in column A = "Name" then leave a blank - The lookup formula will return the row number of the last cell in column A (up to the current row of the formula) that = "Name" - Subtract `1` to get the row number of the group name - The Index function will then return the relevant group name [![enter image description here][1]][1] [1]: https://i.stack.imgur.com/vNNmx.png
I am trying to retrieve a table with the values of Cramer's correlation coefficients on a set of fields using the following SQL query: ```sql WITH var_pairs AS ( WITH vars AS (SELECT n FROM unnest(ARRAY['Performance Score', 'state', 'sex', 'maritaldesc', 'citizendesc', 'Hispanic/Latino', 'racedesc', 'Reason For Term', 'Employment Status', 'department', 'position', 'Manager Name', 'Employee Source']) AS n) SELECT vars1.n AS var1, vars2.n AS var2 FROM vars AS vars1 CROSS JOIN vars AS vars2 ) SELECT (WITH -- Contingency table observed AS ( SELECT var1 AS x, var2 AS y, COUNT(*) AS observed FROM hr_dataset GROUP BY var1, var2 ), -- Sum of the rows of the contingency table row_total AS ( SELECT x, SUM(observed) AS row_total FROM observed GROUP BY x ), -- Sum of columns of the contiguity table col_total AS ( SELECT y, SUM(observed) AS col_total FROM observed GROUP BY y ), -- Total number of observations grand_total AS ( SELECT SUM(observed) AS grand_total FROM observed ), -- Expected frequencies expected AS ( SELECT observed.x, observed.y, (row_total.row_total * col_total.col_total) / grand_total.grand_total AS expected FROM observed INNER JOIN row_total USING(x) INNER JOIN col_total USING(y) CROSS JOIN grand_total ), -- Chi-square statistics chi_sq AS ( SELECT SUM(POWER(observed.observed - expected.expected, 2) / expected.expected) AS chi_sq FROM observed INNER JOIN expected USING(x, y) ), count_x AS ( SELECT count(DISTINCT x) AS count_x FROM observed ), count_y AS ( SELECT count(DISTINCT y) AS count_y FROM observed ) -- Cramer's correlation coefficient SELECT SQRT(chi_sq / (grand_total * (least(count_x, count_y) - 1))) AS "Cramer\'s V" FROM chi_sq CROSS JOIN grand_total CROSS JOIN count_x CROSS JOIN count_y ) FROM var_pairs ``` Response from the server: ERROR: division by zero. As far as I understand, I am passing parameters var1 and var2 to the subquery incorrectly. How to do it correctly? I am using Postgres.
Likert scale study - ordinal regression model
|r|linguistics|ordinal|likert|brms|
null
I added these codes to settings.py for extra security ``` SECURE_BROWSER_XSS_FILTER = True SECURE_CONTENT_TYPE_NOSNIFF = True SECURE_SSL_REDIRECT = True SECURE_HSTS_SECONDS = 86400 SECURE_HSTS_PRELOAD = True SECURE_HSTS_INCLUDE_SUBDOMAINS = True SESSION_COOKIE_SECURE = True CSRF_COOKIE_SECURE = True ``` Then on 127.0.0.1:8000 I could no longer connect to the Django server, even when I deleted that line of code I couldn't connect to the Django development server even in another project. Browsers return this > This site can't provide a secure connection. 127.0.0.1 sent an invalid response. > ERR_SSL_PROTOCOL_ERROR Django Console: > [31/Mar/2024 22:15:09] code 400, message Bad request version ('8³£\x14õì=®\x18\x01\x8f*Ú\x86á\x00') Django version: 4.1.7 I tried clearing the cache / using other browsers and reversing the same code snippet but to no avail .Someone even recommended resetting the database, but it didn't help
Django's previous settings prevent connecting to localhost
|ssl|django-settings|
null
|html|css|css-shapes|
You can specify eager loading via chaining and also with multiple options together. So here we load via outer join from User to UserProjectRoleLink to Project. Then we after that query is loaded we lookup the roles via the role ids we fetched in the first query. So this should result in exactly 2 `SELECT` statements. ```python q = select( User ).options( joinedload( User.user_project_roles ).options( joinedload(UserProjectRoleLink.project), selectinload(UserProjectRoleLink.role) ).where(User.id == user_id) ``` There is an example that uses these suboptions here [specifying-sub-options-with-load-options](https://docs.sqlalchemy.org/en/20/orm/queryguide/relationships.html#specifying-sub-options-with-load-options) As long as you don't reference `project.documents` then the documents should not be eager loaded. Depending on how your serialization works, ie. jsonify, or whatever, you will need to exclude that property.
I have upgraded the gitlab-runner version to the latest one, and could resolve the issue. However, it is not clear why the problem occurred with the lower gitlab-runner version.
I make a simple diagnostic for the car whit ELM327.And i can read a fault codes ,and compare values of received fault end post the result int the text box but how can i compare the received value and not tu use so many (IF) in the code..I try use a text file whit the list of fault codes but only i found the example where the return value is true or false. Example if i received the fault 0400 and i want to compare that value exist on list of codes i make and when found that fault add some text that explain that fault code. I hope you understand me. Sorry for my bad english I was not able to find a single independent example of how to solve it. Thanks for your help
C# Compare multiple string values
[enter image description here](https://i.stack.imgur.com/BltfN.png) I`m developing an googleOAuth2.0 for authorization at ASP.net Core Web Api v7.0. I created a web app in console.cloud.google.com and got the app credentials. I followed to this instructions: https://learn.microsoft.com/en-us/aspnet/core/security/authentication/social/google-logins?view=aspnetcore-7.0 I tried this method and it didn`t create an google icon auth and didnt redirect me when i click at button to sign in. Maybe it need to create a controller. Program.cs ``` var builder = WebApplication.CreateBuilder(args); var services = builder.Services; var configuration = builder.Configuration; var connectionString = configuration.GetConnectionString("DefaultConnection"); services.AddDbContext<DataContext>(options => { options.UseMySql(connectionString, ServerVersion.AutoDetect(connectionString)); }); services.AddAuthentication().AddGoogle(googleOptions => { googleOptions.ClientId = configuration["Authentication:Google:ClientId"]; googleOptions.ClientSecret = configuration["Authentication:Google:ClientSecret"]; }); builder.Services.RegisterCoreConfiguration(builder.Configuration); builder.Services.RegisterCoreDependencies(); ``` Index.cshtml ``` @page @model IndexModel @{ ViewData["Title"] = "Home page"; } <div class="text-center"> <h1 class="display-4">Welcome</h1> <strong style="text-align:center">Home page of future Tinder Clone Web APP :)</strong> <a href="/signin-google">Sign In</a> </div> ```
ASP.NET with Google authentication throws error : The oauth state was missing or invalid
|c#|google-oauth|google-oauth-.net-client|
null
I have a series of athena tables that get compiled from millions of small s3 json files each week. The data is partitioned. However, after upgrading to Athena query engine 3, I am suddenly receiving the following error when I attempt to compile the data files: ``` HIVE_CURSOR_ERROR: com.amazonaws.services.s3.model.AmazonS3Exception: Please reduce your request rate. (Service: Amazon S3; Status Code: 503; Error Code: SlowDown; ``` I have tried looking at AWS recommendations and all say that I should partition the data (which I already do) or wait (which I have also done). Any suggestions are greatly appreciated.
Athena Query Engine 3: HIVE_CURSOR_ERROR
|sql|amazon-web-services|amazon-athena|
> Have you guys ever tried... Yes. I did it, sometime back in the 1980s. It was more of a proof of concept than anything else. I never used it in any real project. Everything I did back then would be called "undefined behavior" today, but back then, experimentation and reading library and OS source code was business-as-usual for figuring out what would work with a given toolchain and, on a given platform. -------- Eric Postpischil said, > ...the values of automatic objects local to the function are indeterminate. That wasn't too hard to deal with. The setjmp and longjmp calls in my home-made threading library were inside functions that were written so as not to depend on the value of any local variable surviving a context switch. The client functions that _called_ the library didn't have to worry about it for the same reason that client functions never have to worry about their local variables being corrupted by any arbitrary function call. -------- Ikegami said, > ...each thread needs a stack. So you need something that swaps stacks in addition to changing the instruction pointer. That's a bit misleading. "swaps stacks" means changing the stack pointer. `longjmp` does that. How could it not? When used as intended, it has to restore the context of some function call further down the same stack. It can't do that without restoring a saved stack pointer. My library used it to restore the context of some function call that was saved from a _different_ stack. But still, each thread must have its own stack, and at the base of each thread's stack, there must be an activation record for some function, as if the function was called from somewhere, but called from where? The "create new thread" function of my library allocated a block of memory to be used as the stack, and then it _synthesized_ a stack frame for the first function to be called, and it synthesized a `jmp_buf` containing a "saved" context such that the first instruction of the function would be executed on the new stack whenever the program `longjmp()`ed to it. -------- Like I said, all of the above was UB. You can't _depend_ on it to work with any given compiler, with any given runtime library, on any given OS or hardware. And also, doing it on a multi-CPU host probably will be tricker than when I did it back in the day. But you can try. Even if you fail, you might learn something.
I need to improve *general heap sort* using C# multithreading. I don't have a clear idea about implementation of improvements. One of the suggestions I got is to separate arrays for *N* parts and heapsort each part in specific thread. And then merge each ordered part of array. In this case I think it will not be so efficient because of merging in general stream after using heapsort. Can you suggest other ideas? Or maybe if it will be not efficient, do you have any ideas how I can use multithreading in in heap sort in a different way?
Simply use indexing with dataframe object match_result. To get the decimals use: `match_result['prices'][i][0]['decimal']`. To get the type use: `match_result['type'][i]` import pandas as pd import requests as r api = 'https://content.toto.nl/content-service/api/v1/q/event-list?startTimeFrom=2024-03-31T22%3A00%3A00Z&startTimeTo=2024-04-01T21%3A59%3A59Z&started=false&maxMarkets=10&orderMarketsBy=displayOrder&marketSortsIncluded=--%2CCS%2CDC%2CDN%2CHH%2CHL%2CMH%2CMR%2CWH&marketGroupTypesIncluded=CUSTOM_GROUP%2CDOUBLE_CHANCE%2CDRAW_NO_BET%2CMATCH_RESULT%2CMATCH_WINNER%2CMONEYLINE%2CROLLING_SPREAD%2CROLLING_TOTAL%2CSTATIC_SPREAD%2CSTATIC_TOTAL&eventSortsIncluded=MTCH&includeChildMarkets=true&prioritisePrimaryMarkets=true&includeCommentary=true&includeMedia=true&drilldownTagIds=691&excludeDrilldownTagIds=7291%2C7294%2C7300%2C7303%2C7306' re = r.get(api) red = re.json() match_result = pd.json_normalize(red, record_path=['data', 'events', 'markets', 'outcomes']) for i, v in match_result.iterrows(): if match_result['type'][i] == 'MR': print(match_result['prices'][i][0]['decimal']) # To print decimal use: match_result['prices'][i][0]['decimal'] # To print type use: match_result['type'][i]
It appears to be the case from a simple test I made: ``` add_custom_target(B COMMAND echo B ) add_custom_command(TARGET B POST_BUILD COMMAND echo post build start COMMAND sleep 5 COMMAND echo post build end ) add_custom_target(A ALL COMMAND echo A DEPENDS B) ``` but I didn't find any offical documentation mentioning this guarantee. Can I rely on it?
If target A depends on B, are B's POST_BUILD commands guaranteed to be executed before A starting to build?
|cmake|
Your expectation is wrong. A call of `next` starts the next middleware/request handler. It doesn't stop the current function. You can stop and leave a function with a `return` statement, e.g.: if (!username || !password || !email || !firstname || !lastname || !phone_number|| !role) { return next({ name: "MissingCustomerDataError", message: "Required Field - username, password, email, firstname, lastname, phone_number" }); or handle the error using a `throw` statement.
Setting `options(seededlda_threads = 1)` gives reproducible results: ``` r library(quanteda) library(seededlda) options(seededlda_threads = 1) corp <- data_corpus_moviereviews toks <- tokens(corp, remove_punct = TRUE, remove_symbols = TRUE, remove_numbers = TRUE, remove_url = TRUE) dfmt <- dfm(toks) |> dfm_remove(stopwords("en")) |> dfm_remove("*@*") |> dfm_trim(max_docfreq = 0.1, docfreq_type = "prop") set.seed(42) lda_seq <- textmodel_lda(dfmt, k = 5, gamma = 0.5, batch_size = 0.01, auto_iter = TRUE, verbose = FALSE) x <- terms(lda_seq) set.seed(42) lda_seq <- textmodel_lda(dfmt, k = 5, gamma = 0.5, batch_size = 0.01, auto_iter = TRUE, verbose = FALSE) y <- terms(lda_seq) waldo::compare(x, y) #> ✔ No differences ``` <sup>Created on 2024-03-30 with [reprex v2.1.0](https://reprex.tidyverse.org)</sup>
|sql|sql-server|
{"Voters":[{"Id":354577,"DisplayName":"Chris"},{"Id":522444,"DisplayName":"Hovercraft Full Of Eels"},{"Id":874188,"DisplayName":"tripleee"}],"SiteSpecificCloseReasonIds":[18]}
Usually using a variable is an additional overhead, but in your case Chrome was able to provide the same performance. But if a variable is reused, that could actually boost performance. So the rule could be - don't create unnecessary variables. Also note that JS engine could optimize code while compiling so in reality your both examples could be exactly the same after being compiled. If you create a variable it could be considered a write operation, but write operations are anything that mutates data or creates new one, in your case you join an array and this is a quite big write operation that stores the result as a temporary string. So when you assign this string to a real variable you add almost nothing to the already tremendous overhead. The less write operations the faster code. But that's about constant factors in an algorithm. I suggest to learn about time complexity and big O notation. ``` ` Chrome/123 --------------------------------------------------------------------------------------- > n=10 | n=100 | n=1000 | n=10000 without vars ■ 1.00x x100k 565 | 1.00x x10k 594 | ■ 1.00x x1k 629 | ■ 1.00x x10 125 with vars 1.02x x100k 577 | ■ 1.00x x10k 592 | 1.01x x1k 635 | 1.03x x10 129 --------------------------------------------------------------------------------------- https://github.com/silentmantra/benchmark ` ``` <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-js --> let $length = 10; const big_strings = []; const palette = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; for (let i = 0; i < $length; i++) { let big_string = ""; for (let i = 0; i < 100; i++) { big_string += palette[Math.floor(Math.random() * palette.length)]; } big_string.charCodeAt(0); big_strings.push(big_string); } let $input = big_strings; var arrayStringsAreEqual = function(word1, word2) { let a = word1.join(''); let b = word2.join(''); if (a == b) { return true; } else { return false; } }; var arrayStringsAreEqual2 = function(word1, word2) { return word1.join('') == word2.join(''); }; var arrayStringsAreEqual3 = function (word1, word2) { function* gen(word){ for(const w of word){ yield* w; } } const a = gen(word1), b = gen(word2); let x, y; do{ x = a.next().value, y = b.next().value; }while(x && x===y) return a.next().done && b.next().done; }; // @benchmark with vars arrayStringsAreEqual($input, $input); // @benchmark without vars arrayStringsAreEqual2($input, $input); // @benchmark generator arrayStringsAreEqual3($input, $input); /*@skip*/ fetch('https://cdn.jsdelivr.net/gh/silentmantra/benchmark/loader.js').then(r => r.text().then(eval)); <!-- end snippet -->
{"OriginalQuestionIds":[30299093],"Voters":[{"Id":8620333,"DisplayName":"Temani Afif","BindingReason":{"GoldTagBadge":"css"}}]}
|c#|
null
I caught this exception when running the program: ``` Exception thrown at 0x0000000000000000 in OpenGL project.exe: 0xC0000005: Access violation executing location 0x0000000000000000. ``` This is my code below: ```c++ #include <iostream> #include <glad/glad.h> #include <GLFW/glfw3.h> int main() { glfwInit(); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); GLFWwindow* window{ glfwCreateWindow(800, 800, "Win", NULL, NULL) }; if (window == NULL) { std::cout << "Doesn't work"; glfwTerminate(); return -1; } gladLoadGL(); glfwMakeContextCurrent(window); glViewport(0, 0, 800, 800); glClearColor(50.0f, 1.3f, 1.7f, 1.0); glClear(GL_COLOR_BUFFER_BIT); glfwSwapBuffers(window); while (!glfwWindowShouldClose(window)) { glfwPollEvents(); } glfwTerminate(); return 0; } ``` The code stopped working when I tried to add color This is the link to the tutorial I was using: https://youtu.be/z03LXhRBLGI?list=PLPaoO-vpZnumdcb4tZc4x5Q-v7CkrQ6M- I have no idea what the exception could be referring to I tried moving a few things around like putting this block into the while statement ```c++ glViewport(0, 0, 800, 800); glClearColor(50.0f, 1.3f, 1.7f, 1.0); glClear(GL_COLOR_BUFFER_BIT); glfwSwapBuffers(window); ```
How to fix "Access violation executing location" when using GLFW and GLAD
|c++|opengl|graphics|glfw|glad|
null
Android has no USSD APIs. There is no requirement for whatever dialer app it has to work with USSD at all (remember the dialer app is an app and may be changed). It is not recommended to use USSD at all in an Android app, as whether it works will depend on the apps the OEM installed, whether the customer has installed a custom dialer, the carrier they use (as USSD codes are almost all carrier specific), and in the end to get it to work with any device you're going to have to do some hacky stuff as no APIs exist, so you'd have to try to screenshot and scrape the UI. In reality- USSD is kind of a dead technology. It existed in pre-data days to provide limited ability to make network calls. In the modern day when every phone has data there's no advantage to using it over a web service.
null
Maintaining a list in a particular order per user, in Java
I'm having problems setting up HTTPS in my Spring Boot application. The application is hosted on an AWS EC2 server with Ubuntu 20. When I try to access the application via Postman using HTTPS, I get a timeout in the server response. Spring Security configuration: ```java @EnableWebSecurity public class SecurityConfiguration extends WebSecurityConfigurerAdapter { private final UserDetailsDataImplements clientService; private final PasswordEncoder passwordEncoder; public SecurityConfiguration(UserDetailsDataImplements usuarioService, PasswordEncoder passwordEncoder) { this.clientService = usuarioService; this.passwordEncoder = passwordEncoder; } @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth.userDetailsService(clientService).passwordEncoder(passwordEncoder); } @Override protected void configure(HttpSecurity http) throws Exception { http.csrf().disable() .requiresChannel() // Requer configurações de canal (HTTP/HTTPS) .anyRequest().requiresSecure() // Requer HTTPS para todas as requisições .and() .authorizeRequests() .antMatchers(HttpMethod.POST, "/login").permitAll() .antMatchers(HttpMethod.GET, "/update").permitAll() .antMatchers(HttpMethod.POST, "/client").permitAll() .antMatchers(HttpMethod.GET, "/data/test").permitAll() .antMatchers(HttpMethod.POST, "/data/register").permitAll() .anyRequest().authenticated() .and() .addFilter(new AuthenticationFilter(authenticationManager())) .addFilter(new AuthValidation(authenticationManager())) .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS) .and() .cors(); } @Bean public CorsConfigurationSource corsConfigurationSource() { CorsConfiguration configuration = new CorsConfiguration(); configuration.setAllowedOrigins(Arrays.asList("http://localhost:3000")); configuration.setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "DELETE", "OPTIONS", "HEAD", "TRACE", "CONNECT")); configuration.setAllowedHeaders(Arrays.asList("*")); UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); source.registerCorsConfiguration("/**", configuration); return source; } } ``` AWS EC2 console: ```shell . ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v2.6.3) 2024-03-31 22:25:01.203 INFO 16246 --- [ main] com.brasens.main.BrasensRest : Starting BrasensRest v0.0.1-SNAPSHOT using Java 11.0.22 on ip-172-31-21-105 with PID 16246 (/home/ubuntu/mspm-backend/target/msmp-http-0.0.1-SNAPSHOT.jar started by ubuntu in /home/ubuntu/mspm-backend/target) 2024-03-31 22:25:01.209 INFO 16246 --- [ main] com.brasens.main.BrasensRest : The following profiles are active: prod 2024-03-31 22:25:04.665 INFO 16246 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode. 2024-03-31 22:25:05.058 INFO 16246 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 371 ms. Found 14 JPA repository interfaces. 2024-03-31 22:25:06.972 INFO 16246 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8443 (https) 2024-03-31 22:25:07.001 INFO 16246 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat] 2024-03-31 22:25:07.002 INFO 16246 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.56] 2024-03-31 22:25:07.209 INFO 16246 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext 2024-03-31 22:25:07.215 INFO 16246 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 5846 ms 2024-03-31 22:25:08.780 INFO 16246 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default] 2024-03-31 22:25:08.965 INFO 16246 --- [ main] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.6.4.Final 2024-03-31 22:25:09.386 INFO 16246 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.2.Final} 2024-03-31 22:25:09.599 INFO 16246 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting... 2024-03-31 22:25:10.598 INFO 16246 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed. 2024-03-31 22:25:10.652 INFO 16246 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.PostgresPlusDialect 2024-03-31 22:25:13.054 INFO 16246 --- [ main] org.hibernate.tuple.PojoInstantiator : HHH000182: No default (no-argument) constructor for class: com.brasens.main.security.PasswordResetToken (class must be instantiated by Interceptor) 2024-03-31 22:25:13.726 INFO 16246 --- [ main] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform] 2024-03-31 22:25:13.740 INFO 16246 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default' 2024-03-31 22:25:15.235 WARN 16246 --- [ main] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning 2024-03-31 22:25:15.973 INFO 16246 --- [ main] f.a.AutowiredAnnotationBeanPostProcessor : Autowired annotation should only be used on methods with parameters: public void com.brasens.main.cronjobs.Scheduler.check() 2024-03-31 22:25:16.363 INFO 16246 --- [ main] o.s.s.w.a.c.ChannelProcessingFilter : Validated configuration attributes 2024-03-31 22:25:16.441 INFO 16246 --- [ main] o.s.s.web.DefaultSecurityFilterChain : Will secure any request with [org.springframework.security.web.access.channel.ChannelProcessingFilter@4a89ef44, org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@6a950a3b, org.springframework.security.web.context.SecurityContextPersistenceFilter@681c0ae6, org.springframework.security.web.header.HeaderWriterFilter@15639d09, org.springframework.web.filter.CorsFilter@4f7be6c8, org.springframework.security.web.authentication.logout.LogoutFilter@1a2e0d57, com.brasens.main.security.AuthenticationFilter@647b9364, com.brasens.main.security.AuthValidation@b6bccb4, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@4d98e41b, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@7459a21e, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@49edcb30, org.springframework.security.web.session.SessionManagementFilter@52bd9a27, org.springframework.security.web.access.ExceptionTranslationFilter@7634f2b, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@1e1237ab] 2024-03-31 22:25:17.839 INFO 16246 --- [ main] o.s.b.a.e.web.EndpointLinksResolver : Exposing 1 endpoint(s) beneath base path '/actuator' 2024-03-31 22:25:18.286 INFO 16246 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8443 (https) with context path '' 2024-03-31 22:25:18.341 INFO 16246 --- [ main] com.brasens.main.BrasensRest : Started BrasensRest in 18.862 seconds (JVM running for 20.927) ^C2024-03-31 22:28:58.761 INFO 16246 --- [ionShutdownHook] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default' 2024-03-31 22:28:58.764 INFO 16246 --- [ionShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated... 2024-03-31 22:28:58.791 INFO 16246 --- [ionShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed. ``` Photo of the Postman: [enter image description here](https://i.stack.imgur.com/AuTwO.png) Photo of the AWS EC2 Security Groups: [enter image description here](https://i.stack.imgur.com/8jFON.png) The outbound rules also look like this application.properties: ``` http.port: 8080 server.port: 8443 ################# SSL CONFIG ################# security.require-ssl=true server.ssl.key-store:/etc/letsencrypt/live/brasens.com/keystore.p12 server.ssl.key-store-password: root server.ssl.keyStoreType: PKCS12 server.ssl.keyAlias: tomcat ``` What could be causing the timeout when trying to access the application via HTTPS? Are there any additional settings I should make in Spring Boot or AWS EC2 to ensure that HTTPS is working correctly? Any suggestions on how to diagnose and resolve this timeout problem?
HTTPS configuration in Spring Boot, server returning timeout
|java|spring|security|https|
null
I have set up a Datastream service, in order to replicate data from Cloud SQL (MySQL) to BigQuery. Everything is set up correctly, connection works. But the weird thing is that only tables < 10mb size are replicated without issues. The larger tables (100+ MB) all fail. When checking the error status, it only says "Timed-out while waiting for the query to complete." I have not found anything useful regarding this error. What approaches can I try? Backfilling a specific table give the same error. Source (MySQL) database connection flags are set to the recommended values: net_read_timeout: 3600 seconds (1 hour) net_write_timeout: 3600 seconds (1 hour) wait_timeout: 86400 seconds (24 hours)
*There is very good post about trimming 1fr to 0: https://stackoverflow.com/questions/52861086/why-does-minmax0-1fr-work-for-long-elements-while-1fr-doesnt* In general I would like to have a cell which expands as the content grows, but within the limits of its parent. Currently I have a grid with cell with such lengthy content that even without expanding it is bigger than the entire screen. So I would to do two things -- clip the size of the cell, and secondly -- provide the scroll. I used `minmax(0, 1fr)` from the post I mentioned, so grid has free hand to squash the cell to zero, but it still does not effectively compute the height, so the scroller does not not the "fixed" height. Without this information the scroll is not activated. <!-- begin snippet: js hide: false console: false babel: false --> <!-- language: lang-html --> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <style> body { width: 100vw; height: 100vh; margin: 0; padding: 0; overflow: hidden; } .page { height: 100%; /*display: flex; flex-direction: column;*/ display:grid; grid-template-rows: min-content minmax(0, 1fr); } .header { } .content { flex-grow: 1; flex-shrink: 1; flex-basis: 0; } .quiz-grid { height: 100%; max-height: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) min-content; grid-template-areas: "left main right" "footer footer footer"; } .quiz-cell-left { grid-area: left; min-height: 0; } .quiz-cell-right { grid-area: right; min-height: 0; } .quiz-cell-main { grid-area: main; border: 1px red solid; min-height: 0; } .quiz-cell-footer { grid-area: footer; justify-self: center; align-self: center; } /* my scroll view component */ .scroll-container { position: relative; width: 100%; min-height: 0; background-color: azure; max-height: 100%; } .scroll-content { height: 100%; width: 100%; overflow-y: auto; } </style> </head> <body> <div class="page"> <div class="header">Header</div> <div class="content"> <div class="quiz-grid"> <div class="quiz-cell-main"> <div class="scroll-container"> <div class="scroll-content"> <h1>something</h1> <h1>else</h1> <h1>alice</h1> <h1>cat</h1> <h1>or dog</h1> <h1>now</h1> <h1>world</h1> <h1>something</h1> <h1>else</h1> <h1>alice</h1> <h1>cat</h1> <h1>or dog</h1> <h1>now</h1> <h1>world</h1> <h1>something</h1> <h1>else</h1> <h1>alice</h1> <h1>cat</h1> <h1>or dog</h1> <h1>now</h1> <h1>world</h1> <h1>something</h1> <h1>else</h1> <h1>alice</h1> <h1>cat</h1> <h1>or dog</h1> <h1>now</h1> <h1>world</h1> </div> </div> </div> <div class="quiz-cell-footer"> footer </div> </div> </div> </div> </body> </html> <!-- end snippet --> *Comment to the code: the content sits in cell "main", the other elements (header, footer) are just to make sure the solution would not be over simplified.* **Update**: originally I used "flex" for outer layout, I switched to grid and I managed to achieve the partial clip at least, I am still stuck with my real clip with scroll.
{"Voters":[{"Id":1255289,"DisplayName":"miken32"},{"Id":354577,"DisplayName":"Chris"},{"Id":874188,"DisplayName":"tripleee"}],"SiteSpecificCloseReasonIds":[11]}
I have the following code in Deneb Vega Lite. It produces a scatter plot that has a connected mean line between each group. I am trying to change the color of the points to all be light grey and the lines to be the same color as the legend. Currently it seems that the legend color replaces whatever I put in the point section [![enter image description here][1]][1] [1]: https://i.stack.imgur.com/h3qas.png <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-html --> { "data": {"name": "dataset"}, "layer": [ { "mark": {"type": "point", "opacity": 0.3}, "encoding": { "x": {"field": "Movie", "type": "nominal"}, "y": {"field": "Rating", "type": "quantitative"} } }, { "mark": {"type": "line", "point": {"filled": true}}, "encoding": { "x": {"field": "Movie", "type": "nominal"}, "y": {"aggregate": "mean", "field": "Rating"}, "detail": {"field": "Country", "type": "nominal"} } } ], "encoding": { "color": { "field": "Country", "type": "nominal", "legend": {"title": "Country"} } } } <!-- end snippet -->
How to change point color in Deneb while having lines be the same color as the legend