Id
int64
1.68k
75.6M
PostTypeId
int64
1
2
AcceptedAnswerId
int64
1.7k
75.6M
ParentId
int64
1.68k
75.6M
Score
int64
-60
3.16k
ViewCount
int64
8
2.68M
Body
stringlengths
1
41.1k
Title
stringlengths
14
150
ContentLicense
stringclasses
3 values
FavoriteCount
int64
0
1
CreationDate
stringlengths
23
23
LastActivityDate
stringlengths
23
23
LastEditDate
stringlengths
23
23
LastEditorUserId
int64
-1
21.3M
OwnerUserId
int64
1
21.3M
Tags
sequence
74,897,967
2
null
74,897,739
0
null
There are a few ways of getting there, as you can see from the other other answers, but I would use a ListView: ``` SizedBox( // here you put the sizes you want // you can also use MediaQuery.of(context).size.width to cover the entire screen child: ListView( // by default it's vertical scrollDirection: Axis.horizontal, children: [ Widget1(), Widget2(), ], ), ); ```
null
CC BY-SA 4.0
null
2022-12-23T09:15:23.897
2022-12-23T09:15:23.897
null
null
14,236,110
null
74,897,972
2
null
72,364,343
0
null
I got the same issue. I passed through my index.js. I realized I let a function with no body... ``` async function myfunctionName() ``` I erased it, and it worked much better !
null
CC BY-SA 4.0
null
2022-12-23T09:15:57.537
2022-12-23T09:15:57.537
null
null
14,756,716
null
74,898,115
2
null
74,897,323
0
null
My guess is youre trying to run the project as `dart` file, not `Flutter`. You can check out this answer for [solution](https://stackoverflow.com/questions/52483773/dartui1-error-not-found-dartui-flutter-dart)
null
CC BY-SA 4.0
null
2022-12-23T09:32:33.443
2022-12-23T09:32:33.443
null
null
12,040,178
null
74,898,192
2
null
74,830,757
0
null
Referring to the shared screen shot you shared It seems you are using set multiple rules in a profile. > When Average CPU percentage> 70 Increase count by 1 When Average CPU percentage <30 Decrease count by 1 And Average Memory percentage …… Decrease count by 2 The following autoscale rules are used by the autoscale engine when multiple rules are set. On , autoscale runs if any rule is met. On , autoscale require all rules to be met. To illustrate, For example if you have the following four autoscale rules: - - - - Then the follow occurs: - - On the other hand, if CPU is 25% and memory is 51% autoscale does not scale-in. In order to scale-in, CPU must be 29% and Memory 49%. Suggest you refer this document : [Best practices for Autoscale](https://learn.microsoft.com/en-us/azure/azure-monitor/autoscale/autoscale-best-practices)
null
CC BY-SA 4.0
null
2022-12-23T09:42:12.997
2022-12-23T09:42:12.997
null
null
10,893,879
null
74,898,293
2
null
74,898,177
1
null
If the input files has NUL characters you could replace them by spaces after reading the input file using: ``` for (var i = 0; i < bytes.Length; i++) { if (bytes[i] == '\0') bytes[i] = ' '; } ```
null
CC BY-SA 4.0
null
2022-12-23T09:52:16.313
2022-12-23T09:52:16.313
null
null
2,142,950
null
74,898,474
2
null
24,830,610
0
null
Very old post, but in case someone crawls it and searches for an alternative answer after trying all of the great resources above, here is what worked for me: In my case, mvn was being packaged from another directory than what was setup in the IDE (jetbrains-idea-ce). ![BuildTools Screenshot](https://i.stack.imgur.com/R1BKa.png) The `settings.xml` is being called from the `/.m2/settings.xml`, while the version that is triggering `mvn package` and `mvn deploy` is using another path dpkg-ed from apt, so `/usr/share/maven`. ``` Apache Maven 3.6.3 Maven home: /usr/share/maven Java version: 11.0.17, vendor: Ubuntu, runtime: /usr/lib/jvm/java-11-openjdk-amd64 Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "5.15.0-56-generic", arch: "amd64", family: "unix" ``` What solved it for me is actually modifying `/usr/share/maven/conf/settings.xml` ``` <settings> <server> <id></id> <!-- <id> has to be the same as the <id> in pom.xml --> <username>USERNAME</username> <password>PASSWORD</password> </server> </settings> ```
null
CC BY-SA 4.0
null
2022-12-23T10:13:08.217
2022-12-25T18:05:43.057
2022-12-25T18:05:43.057
4,862,968
20,846,337
null
74,898,863
2
null
74,898,709
0
null
Can you clarify the table structure? Along with stage_event, do you also have some kind of an ID associated to this stage? That would help if you wanted to use lead/lag to get the timestamp for the "next stage" Something like this - ``` SELECT message, stage_name, timestamp, lag(timestamp, 1) over (partition by message_id order by event_stage_id) as next_stage_timestamp FROM events ``` You could then use "next_stage_timestamp - timestamp" to get your difference and average it grouping by event_stage. Like this - ``` select stageName, avg(next_stage_timestamp - timestamp) as avg_time from above_results group by stageName ``` This is better than doing multiple self joins. However it would work only if you had some kind of an ID associated to the stage_event. So your table would be like this - ``` Message StageID StageName Timestamp ---------------------------------------------- A 1 Start 00 A 2 Calculate 20 A 3 Intermediate 30 A 4 Validate 40 A 5 End 60 ```
null
CC BY-SA 4.0
null
2022-12-23T10:57:55.457
2022-12-23T11:38:49.163
2022-12-23T11:38:49.163
8,112,883
8,112,883
null
74,898,997
2
null
69,306,536
1
null
Try this: ``` init { val mediaController = MediaControllerCompat(context, sessionToken) notificationManager = PlayerNotificationManager.Builder( context, NOTIFICATION_ID, NOTIFICATION_CHANNEL_ID ) .setChannelNameResourceId(R.string.notification_channel_name) .setChannelDescriptionResourceId(R.string.notification_channel_description) .setMediaDescriptionAdapter(DescriptionAdapter(mediaController)) .setNotificationListener(notificationListener) .build() .apply { setSmallIcon(R.drawable.ic_music) setMediaSessionToken(sessionToken) } } ```
null
CC BY-SA 4.0
null
2022-12-23T11:11:51.757
2022-12-23T11:11:51.757
null
null
20,846,782
null
74,899,051
2
null
74,887,180
0
null
At this time, you can use ReaderWriterLockSlim to protect the file, and treat "xmlDocument.Save" as a "FileStream file = new FileStream("1.txt", FileMode.Open, FileAccess.ReadWrite);". ``` static void SaveXml() { Console.WriteLine(DateTime.Now.ToString() + " " + "SaveXml"); lockSlim.EnterWriteLock(); try { Console.WriteLine(DateTime.Now.ToString() + " " + "xmlDocument begin save"); XmlDocument xmlDocument = new XmlDocument(); xmlDocument.LoadXml(@"<note> <to> George </to> <from> John </from> <heading> Reminder </heading> <body> Don't forget the meeting!</body> </note>"); xmlDocument.Save("1.txt"); Console.WriteLine(DateTime.Now.ToString() + " " + "xmlDocument Save ok"); } finally { lockSlim.ExitWriteLock(); } } ```
null
CC BY-SA 4.0
null
2022-12-23T11:19:08.567
2022-12-23T11:19:08.567
null
null
20,528,460
null
74,899,184
2
null
74,898,853
2
null
Is the below what you are looking for? 1. Create sample data sets ``` data labelsex; infile datalines delimiter='|' dsd; input chara :$10.; datalines; Sex n(%)|||| ; data have; infile datalines delimiter='|' dsd; input chara :$10. _7ug_kg_day :$10. _9_ug_kg_day :$10. _12_ug_kg_day :$10. Total :$10.; datalines; Male|2 (66.7%)|3 ( 100%)|7 (70.0%)|12 (75.0%) Female|1 (33.3%)||3 (30.0%)|4 (25.0%) ; ``` 1. Compress to remove unexpected blanks 2. Replace missing character value by 0(0%) 3. Indent using the repeat() function. Here it is 3 times a blank space. ``` data t_sex; length chara :$20.; set have; array char $ _character_; do over char; char = compress(char); if missing(char) then char='0(0%)'; end; chara = cat(repeat(' ', 3), chara); run; ``` 1. Rename the chara column to Characteristics 2. Set the two data sets together ``` data want; set labelsex t_sex; rename chara=Characteristics; run; ``` [](https://i.stack.imgur.com/zABlM.png) However I don't see why you would want to indent inside a SAS table. To me it looks like you want to produce some kind of report as an output. If that is the case, I would suggest to use SAS procedures that were design to do so like [PROC REPORT](https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/proc/n1dz7jdasx5t56n1rmlx346dyk6n.htm) or [PROC TABULATE](https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/proc/n00yutbvvckjwrn1ldg5xkvjy1pu.htm). --- An example using PROC REPORT ``` proc report data=t_sex nowd style(report)={rules=none frame=void cellspacing=0}; title1 'Example using PROC REPORT'; column chara _7ug_kg_day _9_ug_kg_day _12_ug_kg_day total; define chara / group order descending 'Characteristics' style(column)={cellwidth=0.5 indent=10}; define _7ug_kg_day / center display '7ugkgday'; define _9_ug_kg_day / center display '9ugkgday '; define _12_ug_kg_day / center display '12ugkgday '; define total / center display 'Total'; compute before / style={just=l font_weight=bold}; line 'Sex n(%)'; endcomp; run; ```                    [](https://i.stack.imgur.com/vK9Nk.png)
null
CC BY-SA 4.0
null
2022-12-23T11:35:18.597
2022-12-23T12:56:29.337
2022-12-23T12:56:29.337
10,468,613
10,468,613
null
74,899,296
2
null
74,899,223
3
null
You can change the width by manipulating pixels. ``` body { height: 100vh; background: repeating-linear-gradient( 45deg, #FFFFFF 0px, #FFFFFF 20px, #000000 20px, #000000 30px ); } ```
null
CC BY-SA 4.0
null
2022-12-23T11:47:55.783
2022-12-23T11:53:20.387
2022-12-23T11:53:20.387
10,347,145
10,347,145
null
74,899,305
2
null
74,899,223
2
null
Try this: ``` body { background-color: #000; background-position: 0 0,131px 10px; background-image: repeating-linear-gradient(45deg,white 0px, white 10px, black 10px, black 15px); background-size: 101% 22247%; } ``` It simply means each `15px` we should have white color (10px) and black color (5px) in a row. But you can change the numbers depending on the width you want.
null
CC BY-SA 4.0
null
2022-12-23T11:49:14.590
2022-12-23T12:09:28.210
2022-12-23T12:09:28.210
18,112,609
18,112,609
null
74,899,531
2
null
74,883,083
1
null
As some have already mentioned, it would be appreciated if you provided a reproducible example. I will still try to answer your question, based on the link you included. You need to do some data transformation, as your data is not yet in "tidy" format. This means: You want a column for every variable, a row for every observation and a cell should contain one value. For that, you need the `pivot_longer()` function. ``` library(tidyverse) data %>% pivot_longer( cols= austria:germania, names_to= "countries", values_to= "values") %>% ggplot(aes(x= central_government_dept_percent_of_gdp, y=values, color= countries)+ geom_line() ```
null
CC BY-SA 4.0
null
2022-12-23T12:16:15.050
2022-12-23T23:08:47.293
2022-12-23T23:08:47.293
12,505,251
17,602,505
null
74,899,598
2
null
74,874,429
1
null
You forgot to include the csv file while posting the question , However i managed to find that on kaggle [csv](https://www.kaggle.com/code/ashvanths/statistical-analysis-of-top-hits-in-spotify/data) . Here is your solution - [click here](https://editor.p5js.org/vignesh2002/sketches/mbwG3njrq) There are several problems with your code 1. for Hover effects to work on canvas , we need to check the distance between the points on every frame , so the hover code must be inside draw function (your draw function is empty) 2. to check the distance between your mouse and each circle their co-ordinates and size must be stored somewhere , In the solution i stored them in an array of objects named songs
null
CC BY-SA 4.0
null
2022-12-23T12:22:22.430
2022-12-23T12:22:22.430
null
null
13,218,335
null
74,899,698
2
null
74,896,120
0
null
I believe everyone using recent Xcode/iOS versions is getting those error messages, and they can seemingly be ignored. They definitely aren't causing Preview crashes for me. Your code is actually very close. If I just uncomment those lines, the only real problem is the absence of a "." in front of the "onTapGesture" view modifier. It feels like a bug that the compiler isn't throwing an error to help you out here. So the following works for me: ``` struct CardView : View { @State var isFaceUp: Bool = true var body: some View{ ZStack { let shape = RoundedRectangle(cornerRadius: 20) if isFaceUp{ shape.fill().foregroundColor(.white) shape.stroke(lineWidth: 3) Text("✈️").font(.largeTitle) } else { shape.fill() } } .onTapGesture { isFaceUp = !isFaceUp } } } ```
null
CC BY-SA 4.0
null
2022-12-23T12:33:31.597
2022-12-23T12:33:31.597
null
null
2,640,516
null
74,899,768
2
null
74,899,121
0
null
I write simple class for that: ``` import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; class SplitInput extends StatefulWidget { final String format; // example '2d 2d 3s' => 2 digits + 2 digits + 3 String(with 3 length) const SplitInput({required this.format}); @override State<SplitInput> createState() => _SplitInputState(); } class _SplitInputState extends State<SplitInput> { @override Widget build(BuildContext context) { return Row( children: [ ...cells(), ], ); } cells() { List<Widget> cellList = []; final listOfCells = widget.format.split(' '); for (String element in listOfCells) { final type = element[0]; final flex = int.parse(element.substring(1, element.length)); final controller = TextEditingController(); cellList.add( Expanded( child: Padding( padding: const EdgeInsets.all(8.0), child: Container( decoration: BoxDecoration( color: Colors.black12, borderRadius: BorderRadius.circular(15), ), child: TextField( controller: controller, decoration: InputDecoration( counter: Container(), focusedBorder: InputBorder.none, border: InputBorder.none, ), textInputAction: TextInputAction.next, textAlign: TextAlign.center, keyboardType: type == 's' ? TextInputType.text : TextInputType.number, maxLength: flex, ), ), ), flex: flex, ), ); } return cellList; } } ``` you can customize that. easily you can use that like below: ``` SplitInput(format: 'd2 d2 s4 d2') ``` `d` is `digit` and `s` is `String` and after them you should write their `length` and split by space. The output is like below: [](https://i.stack.imgur.com/Mch9r.jpg)
null
CC BY-SA 4.0
null
2022-12-23T12:42:53.003
2022-12-23T12:42:53.003
null
null
14,151,725
null
74,899,840
2
null
74,897,739
0
null
thx for all your answers, but what I wanted seems to be achieved by using Transform.translate widget: ``` Widget buildWidget(BuildContext context) => Transform.translate( offset: Offset(100, 0), child: Row(mainAxisAlignment: MainAxisAlignment.center, children: [ Widget1(), Widget2(), ])); ``` Width parameter must be defined for widget1 and widget2.
null
CC BY-SA 4.0
null
2022-12-23T12:51:17.147
2022-12-23T13:16:17.567
2022-12-23T13:16:17.567
14,400,778
14,400,778
null
74,900,129
2
null
74,899,931
0
null
try this : ``` SELECT DISTINCT (array_agg(j->>'stock') OVER (PARTITION BY tracked_products ORDER BY j->>'created_at' DESC)[1] AS stock FROM ean.data CROSS JOIN LATERAL jsonb_path_query(tracked_products :: jsonb, '$[*]') AS j WHERE price < 40 ``` This query relies on a text sorting on `created_at` which should be compliant with the actual date format of this text field. `jsonb_path_query` is used instead of `json_array_elements` so that to avoid an error when tracked_products is not a json of type array. see [dbfiddle](https://dbfiddle.uk/WPPsFAAl) Refer to the [manual](https://www.postgresql.org/docs/current/functions-json.html) for more info about json manipulation
null
CC BY-SA 4.0
null
2022-12-23T13:23:15.967
2022-12-23T15:11:01.420
2022-12-23T15:11:01.420
8,060,017
8,060,017
null
74,900,144
2
null
74,899,273
0
null
you will need to use [selenium for python](https://selenium-python.readthedocs.io/) as you need to load the javascript. beautifulsoup can only really handle static websites.
null
CC BY-SA 4.0
null
2022-12-23T13:25:57.483
2022-12-23T13:25:57.483
null
null
6,651,840
null
74,900,253
2
null
71,856,677
0
null
As Phil Dukhov answered `Modifier.height(IntrinsicSize.Max)` works for me. Just set the modifier to the Root element in your Row. In your case it's Card (change `.fillMaxWidth()` to `.height(IntrinsicSize.Max)`): ``` Card( modifier = Modifier .height(IntrinsicSize.Max) .padding(7.dp) .clickable { onItemClick() }, shape = MaterialTheme.shapes.large, elevation = 4.dp ) ```
null
CC BY-SA 4.0
null
2022-12-23T13:37:01.097
2022-12-23T13:37:01.097
null
null
1,483,448
null
74,900,796
2
null
74,899,807
0
null
The actively available Anaconda builds for Python 3.6 all use 3.6.10, so you would have a possibly easier solve with: ``` conda create -n ssd_env python=3.6 anaconda ``` However, there is the `custom` build, `anaconda=custom=py36_1` that should be generally compatible with `python>=3.6,<3.7`. That is what I get when simulating the solve from OP: ``` CONDA_SUBDIR=win-64 mamba create -n ssd_env --override-channels -c anaconda python=3.6.8 anaconda ``` which solves almost instantly with Mamba. Using `conda` also takes unreasonably long for me, even when explicitly identifying the `anaconda=custom=py36_1`. The reason this takes so long is that this `anaconda` package has no version constraints on the 100+ packages it specifies, which means a search space. This is aggravated by the fact that the solvers work from latest to oldest package versions, and the versions that are expected to be identified are ~3 years down the stack. I recommend: 1. Use Mamba as the solver. 2. Don't use the anaconda package unless absolutely needed. Most users do not ever need all those packages - instead just specify the packages actually required.
null
CC BY-SA 4.0
null
2022-12-23T14:32:44.980
2022-12-23T14:32:44.980
null
null
570,918
null
74,900,806
2
null
74,891,364
0
null
I used codes from [https://github.com/kavyamusty/Shading-removal-of-images/blob/master/Article%20submission.ipynb](https://github.com/kavyamusty/Shading-removal-of-images/blob/master/Article%20submission.ipynb), which works for removing shadows first, then the `cv2.HoughCircles` to find the circles. The codes as below : ``` import cv2 import numpy as np import matplotlib.pyplot as plt def max_filtering(N, I_temp): wall = np.full((I_temp.shape[0]+(N//2)*2, I_temp.shape[1]+(N//2)*2), -1) wall[(N//2):wall.shape[0]-(N//2), (N//2):wall.shape[1]-(N//2)] = I_temp.copy() temp = np.full((I_temp.shape[0]+(N//2)*2, I_temp.shape[1]+(N//2)*2), -1) for y in range(0,wall.shape[0]): for x in range(0,wall.shape[1]): if wall[y,x]!=-1: window = wall[y-(N//2):y+(N//2)+1,x-(N//2):x+(N//2)+1] num = np.amax(window) temp[y,x] = num A = temp[(N//2):wall.shape[0]-(N//2), (N//2):wall.shape[1]-(N//2)].copy() return A def min_filtering(N, A): wall_min = np.full((A.shape[0]+(N//2)*2, A.shape[1]+(N//2)*2), 300) wall_min[(N//2):wall_min.shape[0]-(N//2), (N//2):wall_min.shape[1]-(N//2)] = A.copy() temp_min = np.full((A.shape[0]+(N//2)*2, A.shape[1]+(N//2)*2), 300) for y in range(0,wall_min.shape[0]): for x in range(0,wall_min.shape[1]): if wall_min[y,x]!=300: window_min = wall_min[y-(N//2):y+(N//2)+1,x-(N//2):x+(N//2)+1] num_min = np.amin(window_min) temp_min[y,x] = num_min B = temp_min[(N//2):wall_min.shape[0]-(N//2), (N//2):wall_min.shape[1]-(N//2)].copy() return B def background_subtraction(I, B): O = I - B norm_img = cv2.normalize(O, None, 0,255, norm_type=cv2.NORM_MINMAX) return norm_img def min_max_filtering(M, N, I): if M == 0: #max_filtering A = max_filtering(N, I) #min_filtering B = min_filtering(N, A) #subtraction normalised_img = background_subtraction(I, B) elif M == 1: #min_filtering A = min_filtering(N, I) #max_filtering B = max_filtering(N, A) #subtraction normalised_img = background_subtraction(I, B) return normalised_img # Read Image img = cv2.imread(r"D:/Image.jpg") # Copy origin image cimg = img.copy() # Initialization array of uint8 img_remove_shadow = np.zeros(np.shape(img), dtype="uint8") for i in range(np.shape(img)[2]): img_remove_shadow[:, :, i] = np.array(min_max_filtering(M = 0, N = 20, I = img[:, :, i])) # Using median blur img = cv2.medianBlur(img_remove_shadow,5) # Change to gray image img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) cv2.imshow("Removing Shadow", img) # Find circles circles = cv2.HoughCircles(img, cv2.HOUGH_GRADIENT, 1, 5, np.array([]), 40, 23, 5,20) circles = np.uint16(np.around(circles)) for i in circles[0,:]: # draw the outer circle cv2.circle(cimg,(i[0],i[1]),i[2],(0,255,0),2) # draw the center of the circle cv2.circle(cimg,(i[0],i[1]),2,(0,0,255),3) cv2.imshow('detected circles',cimg) cv2.waitKey(0) cv2.destroyAllWindows() ``` The result is as below: [](https://i.stack.imgur.com/K0iSl.png) [](https://i.stack.imgur.com/VDOo5.png) PS: The codes take 11.74s running time, I would appreciate it if someone could optimize the code.
null
CC BY-SA 4.0
null
2022-12-23T14:33:40.697
2022-12-23T14:39:07.777
2022-12-23T14:39:07.777
17,457,846
17,457,846
null
74,901,169
2
null
74,900,921
1
null
Since you have no fine control on the curve made by border radius, the next best option could be drawing splines with svg. I made a very simple path with a basic bezier curve for the sake of this example. There are further details here: [https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths](https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths) Frankly speaking the path I chose may not perfectly match with your expected result, anyway feel free to walk through this path (no pun intended) if you can't find the solution aimed for using the magics of borders and you want to consider a different option. I also added a range slider to show how to alter the curve in real time keeping in mind that here I have only one control point for the bezier curve that I'm simply shifting on the y axis. ``` const slider = document.querySelector('input[type=range]'); slider.addEventListener('input',(event)=>{ changeCurve(event.target.value); }); function changeCurve(y){ const d = `M 0 0 Q 50 ${y} 100 0`; document.querySelector('.curved svg path') .setAttribute('d', d); } ``` ``` .curved{ background: #D3041E; height: 200px; position: relative; border: solid 8px black; border-top: none; margin: 1em; } .slider { display: flex; justify-content: center; align-items: center; border: solid; } input[type=range]{ cursor: pointer; margin: 1em; } ``` ``` <div class="slider"> <label>Change the curve:</label> <input id="slider" type="range" value="50" min="0" max="100" step="1"> </div> <div class="curved"> <svg width="100%" viewBox="0 0 100 100"> <path d="M 0 0 Q 50 5 100 0" fill="white" /> </svg> </div> ```
null
CC BY-SA 4.0
null
2022-12-23T15:10:49.847
2022-12-25T22:46:21.890
2022-12-25T22:46:21.890
1,221,208
1,221,208
null
74,901,726
2
null
46,990,569
0
null
In Javascript, you could use the reduce method from an array to avoid iterating in a for loop, just like this. ``` function solution(inputArray) { let maxProd = [] inputArray.reduce((accumulator, currentValue) => { maxProd.push(accumulator*currentValue) return currentValue }, ); return Math.max(...maxProd) } ``` Once you have in the array the products, you use the spread operator to get the numbers and using you get the largest
null
CC BY-SA 4.0
null
2022-12-23T16:12:20.530
2023-01-09T08:11:49.867
2023-01-09T08:11:49.867
3,789,665
15,961,129
null
74,901,740
2
null
74,901,614
1
null
You can simply calculate percentile values based on the highest value of each column like this: ``` import pandas as pd df = pd.DataFrame({ 'ID': [1, 2, 3, 4, 5, 6, 7], 'xg': [0.25, 0.77, 1.03, 0.12, 0.66, 0.79, 0.92], 'passes': [15, 19, 22, 26, 23, 12, 31], 'pass_completion': [80, 73, 66, 74, 92, 50, 70], 'progression': [7, 5, 12, 5, 8, 4, 14], }) """ ID xg passes pass_completion progression 0 1 0.25 15 80 7 1 2 0.77 19 73 5 2 3 1.03 22 66 12 3 4 0.12 26 74 5 4 5 0.66 23 92 8 5 6 0.79 12 50 4 6 7 0.92 31 70 14 """ # Following code is what you want to do df['xg_percentile'] = df['xg']/max(df['xg']) df['passes_percentile'] = df['passes']/max(df['passes']) df['pass_completion_percentile'] = df['pass_completion']/max(df['pass_completion']) df['progression_percentile'] = df['progression']/max(df['progression']) print(df) ``` ``` ID xg passes pass_completion progression xg_percentile passes_percentile pass_completion_percentile progression_percentile 0 1 0.25 15 80 7 0.242718 0.483871 0.869565 0.500000 1 2 0.77 19 73 5 0.747573 0.612903 0.793478 0.357143 2 3 1.03 22 66 12 1.000000 0.709677 0.717391 0.857143 3 4 0.12 26 74 5 0.116505 0.838710 0.804348 0.357143 4 5 0.66 23 92 8 0.640777 0.741935 1.000000 0.571429 5 6 0.79 12 50 4 0.766990 0.387097 0.543478 0.285714 6 7 0.92 31 70 14 0.893204 1.000000 0.760870 1.000000 ```
null
CC BY-SA 4.0
null
2022-12-23T16:13:33.687
2022-12-23T16:13:33.687
null
null
1,779,532
null
74,901,812
2
null
74,901,614
0
null
you can use function [pandas.DataFrame.rank](https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.rank.html) ``` import pandas as pd data_dict = { "xg":[0.25,0.77,1.03,0.12,0.66,0.79,0.92], "passes":[15,19,22,26,23,12,31], "passCompletion":[80,72,66,74,92,50,70], "progression":[7,5,12,5,8,4,14]} df = pd.DataFrame(data_dict) df['xg_pctile'] = df.xg.rank(pct = True) ```
null
CC BY-SA 4.0
null
2022-12-23T16:21:17.990
2022-12-23T16:21:17.990
null
null
9,068,636
null
74,901,887
2
null
74,899,273
1
null
If you inspect your browsers Network calls (Click on F12), you'll see that the data is loaded from: ``` https://channelstore.roku.com/api/v6/channels/detailsunion/38e7b84fe064cf927ad471ed632cc3d8 ``` [](https://i.stack.imgur.com/fWxzY.jpg) So, to mimic the response, you can send a `GET` request to the URL. Note, there's no need for `BeautifulSoup`: ``` import requests headers = { 'authority': 'channelstore.roku.com', 'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9', 'accept-language': 'en-US,en;q=0.9', 'cache-control': 'max-age=0', 'cookie': '_csrf=ZaFYG2W7HQA4xqKW3SUfuta0; ks.locale=j%3A%7B%22language%22%3A%22en%22%2C%22country%22%3A%22GB%22%7D; _usn=c2062c71-f89e-456f-9374-7c7767afc665; _uc=54c11aa8-597e-4155-bfa1-379add00fc85%3Aa044adeb2f02798a3c8335d874d49562; _ga=GA1.3.760826055.1671811832; _gid=GA1.3.2471563.1671811832; _ga=GA1.1.760826055.1671811832; _cs_c=0; roku_test; AWSELB=0DC9CDB91658555B919B869A2ED9157DFA13B446022D0100EBAAD7261A39D5A536AC0223E5570FAECF0099832FA9F5DB8028018FCCD9D0A49D8F2BDA087916BC1E51F73D1E; AWSELBCORS=0DC9CDB91658555B919B869A2ED9157DFA13B446022D0100EBAAD7261A39D5A536AC0223E5570FAECF0099832FA9F5DB8028018FCCD9D0A49D8F2BDA087916BC1E51F73D1E; _gat_UA-678051-1=1; _ga_ZZXW5ZLMQ5=GS1.1.1671811832.1.1.1671812598.0.0.0; _cs_id=8a1f1aec-e083-a585-e054-158b6714ab4a.1671811832.1.1671812598.1671811832.1.1705975832137; _cs_s=10.5.0.1671814398585', 'sec-ch-ua': '"Not?A_Brand";v="8", "Chromium";v="108", "Google Chrome";v="108"', 'sec-ch-ua-mobile': '?0', 'sec-ch-ua-platform': '"macOS"', 'sec-fetch-dest': 'document', 'sec-fetch-mode': 'navigate', 'sec-fetch-site': 'none', 'sec-fetch-user': '?1', 'upgrade-insecure-requests': '1', 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36', } params = { 'country': 'GB', 'language': 'en', } response = requests.get( 'https://channelstore.roku.com/api/v6/channels/detailsunion/38e7b84fe064cf927ad471ed632cc3d8', params=params, headers=headers, ).json() # Uncomment to print all the data # from pprint import pprint # pprint(response) print(response.get("feedChannel").get("name")) print("rating: ", response.get("feedChannel").get("starRatingCount")) ``` Prints: ``` The Silver Collection Comedies rating: 3 ```
null
CC BY-SA 4.0
null
2022-12-23T16:30:22.420
2022-12-23T16:30:22.420
null
null
12,349,734
null
74,902,465
2
null
74,900,991
5
null
What you want can be achieved using a Line Chart. No VBA is required. Here is a basic example. : This is a very basic example. You will have to modify this to suit your needs. Let's say you have the dates as shown below in a worksheet. [](https://i.stack.imgur.com/D4OY6.png) Enter `1` in the cells `G2:L2` [](https://i.stack.imgur.com/4ASff.png) Select cells `G2:L2`. Click on `Insert` tab and insert a Line Chart [](https://i.stack.imgur.com/P7pIR.png) Delete the gridlines, chart title and the axes of the chart by selecting it. [](https://i.stack.imgur.com/CQQU0.png) Set the fill as `No Fill` and border as `No Line` [](https://i.stack.imgur.com/pZTfk.png) Select the line and set the marker properties as shown below [](https://i.stack.imgur.com/JtzMc.png) Right click on the chart and click on `Select Data` [](https://i.stack.imgur.com/0yDpV.png) Click on `Hidden and Empty cells` [](https://i.stack.imgur.com/DZVh1.png) Select the options as shown in the below dialog box. Click on `OK`. Click on `OK` again to close the 2nd dialog box [](https://i.stack.imgur.com/Kcsbk.png) Enter the formula `=IFERROR(MATCH(G1,$B$2,0),NA())` in cell `G2` Enter the formula `=IFERROR(MATCH(H1,$B$3,0),NA())` in cell `H2` and copy it to the last cell. In our case it is `L2`. Your worksheet will look like this [](https://i.stack.imgur.com/GwT6P.png) Change the font color of the cells `G2:L2` to white [](https://i.stack.imgur.com/ghqIt.png) Next enter a start date and the end date. You will notice the line [](https://i.stack.imgur.com/uzQvu.png) Do the basic formatting and adjust the chart so that the markers are in the center of the cell. [](https://i.stack.imgur.com/RCrmo.png) And you are done. [](https://i.stack.imgur.com/qZ8Zj.gif)
null
CC BY-SA 4.0
null
2022-12-23T17:35:00.183
2022-12-23T17:35:00.183
null
null
1,140,579
null
74,902,539
2
null
74,902,270
0
null
this is called Banker's rounding, it's the correct way of rounding numbers, it's more like mathematical thing. Here are a few examples to help you grasp the concept of Banker's rounding: 0.5 is equal to 0. Why? Because the nearest even integer is 0. 1.5 equals 2 when rounded up. Why? Because the nearest even integer is 2. 73.5 equals 74 when rounded up. Why? Because the nearest even integer is 74. 74.5 is equivalent to 74. Why? Because the nearest even integer is 74. 75.5 equals 76 when rounded up. Why? Because the nearest even integer is 76. 76.5 equals 76 when rounded down. Why? Because the nearest even integer is 76. but you can write your own round function as follows: ``` a = 5 / 2 def round_it(number): if number % 1 < 0.5: return int(number - number % 1) else: return int(number + (1 - number % 1)) print(round_it(5 / 2)) ```
null
CC BY-SA 4.0
null
2022-12-23T17:42:53.947
2022-12-23T17:57:15.300
2022-12-23T17:57:15.300
18,977,234
18,977,234
null
74,902,552
2
null
74,902,518
0
null
I was trying to do this while running git-bash from Visual Studio Code so when I loaded up git-bash as Administrator I was able to get the `nvm use` call to work correctly. Sorry for the stupid question, but I didn't see it answered on here anywhere else, so hopefully it will be useful to someone else.
null
CC BY-SA 4.0
null
2022-12-23T17:44:31.253
2022-12-23T17:44:31.253
null
null
3,034,043
null
74,902,640
2
null
74,849,182
1
null
I had the same problem and solved it by reverting back to an older version of RStudio.
null
CC BY-SA 4.0
null
2022-12-23T17:55:21.173
2022-12-23T17:55:21.173
null
null
20,840,748
null
74,902,673
2
null
39,626,302
0
null
Resolved!!!!! Just please add those codes to your script [https://gist.github.com/kiding/72721a0553fa93198ae2bb6eefaa3299](https://gist.github.com/kiding/72721a0553fa93198ae2bb6eefaa3299) ``` //reach out to that input field (When ever u r gonna click tofocus) let inputField = document.getElementById("input_focused") /* * Method 1: Briefly change the opacity. * Element might "blink" on focus in some scenarios. */ inputField.addEventListener("focus", () => { methodOne.style.opacity = 0; setTimeout(() => methodOne.style.opacity = 1); }); ``` ``` <section id="modal"> <input id="input_focused"> </section> ```
null
CC BY-SA 4.0
null
2022-12-23T17:59:23.273
2022-12-24T06:03:43.760
2022-12-24T06:03:43.760
19,331,660
19,331,660
null
74,902,722
2
null
74,900,991
1
null
Okay Admittedly this turned out to be a bit of a mess of a script... but it works. - - Here is is, make SURE this goes in your worksheet module: [](https://i.stack.imgur.com/OqExt.png) (Or whatever sheet you're using) ``` Private Sub Worksheet_Change(ByVal Target As Range) Dim oTri As Object 'Triangle Object Dim oLine As Object 'Line Object Dim tLeft As Long 'Left as an integer Dim tCell As Range 'Found Value Cell as range 'Used to decide which triangle needs to be updated. Select Case Target.Address Case "$B$3" 'Design Mode Start Day Set oTri = Shapes("LTopTri") Set oLine = Shapes("TopLine") Case "$C$3" 'Design Mode Finish Day Set oTri = Shapes("RTopTri") Set oLine = Shapes("TopLine") Case "$B$4" 'Manufacture Start Day Set oTri = Shapes("LBottomTri") Set oLine = Shapes("BottomLine") Case "$C$4" 'Manufacture Finish Day Set oTri = Shapes("RBottomTri") Set oLine = Shapes("BottomLine") Case Else Exit Sub End Select 'Move triangle & Line Set tCell = Cells(2, WorksheetFunction.Match(Day(Target.Value), Range("F2:S2")) + 5) tLeft = tCell.Left + (0.5 * tCell.Width) oTri.Top = Target.Top + (0.5 * Target.Height) - (0.5 * oTri.Height) oTri.Left = tLeft - (0.5 * oTri.Width) oLine.Top = oTri.Top + oTri.Height Select Case Target.Row Case "3" oLine.Left = Shapes("LTopTri").Left + (0.5 * Shapes("LTopTri").Width) oLine.Width = Shapes("RTopTri").Left - Shapes("LTopTri").Left Case "4" oLine.Left = Shapes("LBottomTri").Left + (0.5 * Shapes("LBottomTri").Width) oLine.Width = Shapes("RBottomTri").Left - Shapes("LBottomTri").Left End Select End Sub ``` Shape Names: [](https://i.stack.imgur.com/5np5E.png) Result Examples: [](https://i.stack.imgur.com/w4JFd.png) [](https://i.stack.imgur.com/xamsU.png) [](https://i.stack.imgur.com/lhdbX.png) [](https://i.stack.imgur.com/eVBkN.png)
null
CC BY-SA 4.0
null
2022-12-23T18:05:15.800
2022-12-23T18:05:15.800
null
null
16,826,729
null
74,902,905
2
null
74,902,499
2
null
Sample data, ``` set.seed(2022) dat <- data.frame(x=1:100, y=cumsum(runif(100, -10, 10))) head(dat) # x y # 1 1 8.296121 # 2 2 17.037629 # 3 3 12.760420 # 4 4 19.369372 # 5 5 22.204283 # 6 6 22.586202 ``` First cut: we'll split the sequence into blocks of neg/pos, then plot each polygon. (`data.table::rleid` works well, if you must use something else we can contrive a naive version that does the same thing. ``` my_rleid <- function(z) { r <- rle(z) rep.int(seq_along(r$lengths), times = r$lengths) } # or you can use data.table::rleid spl <- split(dat, my_rleid(dat$y < 0)) lapply(spl[1:2], head) # $`1` # x y # 1 1 6.319553 # 2 2 9.264740 # 3 3 1.671311 # 4 4 2.547314 # $`2` # x y # 5 5 -3.758086 # 6 6 -1.042269 # 7 7 -9.556289 # 8 8 -18.716770 # 9 9 -21.310428 # 10 10 -16.165370 miny <- min(dat$y) plot(y ~ x, data = dat, type = "l") abline(h = 0, lty = 2) for (Z in spl) { polygon(Z$x[c(1, 1:nrow(Z), nrow(Z))], c(miny, Z$y, miny), col = if (Z$y[1] < 0) "red" else "blue") } ``` [](https://i.stack.imgur.com/hMqd4.png) As you can see, we need to extend each element of `spl` to extend to the next block (since the `x` values will show a gap). There are many options for this depending on your preferences: carry-forward (add a row to the bottom of each), push-backward (add a row to the top of each from the preceding block), or interpolate between the first row in one with the bottom row in the preceding. I think the first two are fairly simple, I'll opt for the more-difficult (but visually more consistent) one of interpolation. ``` for (ind in 2:length(spl)) { x1 <- spl[[ind-1]] x2 <- spl[[ind]] newdat <- do.call(approx, c(setNames(rbind(x1[nrow(x1),], x2[1,]), c("y", "x")), list(xout = 0))) names(newdat) <- c("y", "x") newdat <- data.frame(newdat)[,2:1] spl[[ind-1]] <- rbind(spl[[ind-1]], newdat) spl[[ind]] <- rbind(newdat, spl[[ind]]) } plot(y ~ x, data = dat, type = "l") abline(h = 0, lty = 2) for (Z in spl) { polygon(Z$x[c(1, 1:nrow(Z), nrow(Z))], c(miny, Z$y, miny), col = if (mean(Z$y) < 0) "red" else "blue") } ``` [](https://i.stack.imgur.com/g9Pu6.png) (Note that the `col=` conditional changed, since we know that the first value should "always" be 0.) : I assumed making the polygon start at the bottom of the plot, as defined by `miny <- min(dat$y)`. As a cue from [AllanCameron's excellent answer](https://stackoverflow.com/a/74903305/3358272), if you set `miny <- 0` instead, you get this: [](https://i.stack.imgur.com/93Png.png)
null
CC BY-SA 4.0
null
2022-12-23T18:29:01.390
2022-12-23T19:31:32.260
2022-12-23T19:31:32.260
3,358,272
3,358,272
null
74,902,935
2
null
74,902,499
0
null
``` plot(ts.NAO$Year, ts.NAO$NAO_index, type="l", xaxt="n", yaxt="n", xlim=c(1900,2020)) par(new=TRUE) plot(ts.NAO$Year, running_mean, type="l", lty=2, lwd=2, col="red", xaxt="n", yaxt="n") title(xlab="Years", ylab="NAO SLP Index") abline(h=0, col="blue") axis(side=1, at=seq(1900,2020,10), labels=seq(1900,2020,10), las=1) axis(side=2, at=seq(-6,6,0.5), labels=seq(-6,6,0.5)) for (i in 1:length(ts.NAO$NAO_index)) { if (ts.NAO$NAO_index[i] > 0) { polygon(c(ts.NAO$Year[i], ts.NAO$Year[i+1], ts.NAO$Year[i+1], ts.NAO$Year[i]), c(0, 0, ts.NAO$NAO_index[i], ts.NAO$NAO_index[i]), col="red", border=NA) } else { polygon(c(ts.NAO$Year[i], ts.NAO$Year[i+1], ts.NAO$Year[i+1], ts.NAO$Year[i]), c(0, 0, ts.NAO$NAO_index[i], ts.NAO$NAO_index[i]), col="blue", border=NA) }#you can choose to remove the polygon borders which is standard #practice for presentation purposes where I work, certainly not #the best way by any means } ```
null
CC BY-SA 4.0
null
2022-12-23T18:33:21.267
2022-12-24T18:11:42.400
2022-12-24T18:11:42.400
20,848,454
20,848,454
null
74,902,985
2
null
74,875,601
1
null
There are some issues with your implementation, starting with the creation of the index widget (both the `scrollArea` and `frmScroll` parents are useless), and painting issues (calling the base `paint()` implementation will potentially paint the previous `fillRect()`). Also, since you probably need to correlate the combo with the actual model data, using an index widget is not the more appropriate choice, and you should instead use a delegate on the table that will create the combo as for the cell. A QComboBox uses a Qt model for its contents, and these models allow setting background and foreground [roles](https://doc.qt.io/qt-5/model-view-programming.html#item-roles) that automatically draw items with the specified colors, if set. While you can just use the combo [setItemData()](https://doc.qt.io/qt-5/qcombobox.html#setItemData) function to set the colors, since you're going to use multiple instances of the same combo class, a better solution is to use a custom model. Then, in order to also draw the combo with the selected color, you have two possibilities: either you override its `paintEvent()` and "mimic" the default behavior by altering the palette, or you just use a specific stylesheet. For this case, I'd suggest the latter, as properly implementing the painting might be unnecessary difficult. Finally, once the delegate for the table is implemented (by overriding its [createEditor()](https://doc.qt.io/qt-5/qstyleditemdelegate.html#createEditor), [setEditorData()](https://doc.qt.io/qt-5/qstyleditemdelegate.html#setEditorData) and [setModelData()](https://doc.qt.io/qt-5/qstyleditemdelegate.html#setModelData) functions) and set, you must call [openPersistentEditor()](https://doc.qt.io/qt-5/qtablewidget.html#openPersistentEditor) for each row of the model. For obvious reasons, whenever you need to add new rows, you must remember to call `openPersistentEditor()` again (which could be done automatically if you connect to the table's model `rowsInserted` signal). ``` from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5.QtWidgets import * StatusData = [ ("Initializing ...", QColor(228, 221, 131)), ("Not Started", QColor(185, 183, 159)), ("Track", QColor(65, 203, 53)), ("Track Approval", QColor(38, 121, 31)), ("For Solving", QColor(31, 121, 104)), ("Solve", QColor(48, 216, 226)), ("For GeoBuild", QColor(226, 167, 48)), ("GeoBuild", QColor(226, 142, 48)), ("For Rotomation", QColor(243, 222, 108)), ("Rotomation", QColor(243, 141, 108)), ("Waiting Assets", QColor(154, 76, 79)), ("For Packing", QColor(76, 112, 154)), ("Packing", QColor(53, 89, 201)), ("Preview", QColor(114, 228, 118)), ("Ready", QColor(178, 114, 228)), ("For Delivery", QColor(147, 169, 236)), ("Delivered", QColor(81, 50, 199)), ("Approved", QColor(84, 95, 239)), ("Cancelled", QColor(239, 84, 84)), ("On Hold", QColor(98, 81, 81)), ("Got Issue!", QColor(98, 1, 1)), ] StatusRole = Qt.UserRole + 1 def textColorForBackground(bgd): ''' A simple helper function that returns a foreground color that will always contrast to the background. ''' if isinstance(bgd, QBrush): bgd = bgd.color() r, g, b, a = bgd.getRgb() if (r * .3 + g * .5 + b * .1) < 100: return QColor(Qt.white) return QColor(Qt.black) class MyQComboBox(QComboBox): _model = None # a single model shared between instances def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) if not self._model: self.__class__._model = QStandardItemModel(0, 1) for row, (text, color) in enumerate(StatusData): item = QStandardItem(text) item.setData(color, Qt.BackgroundRole) item.setData(textColorForBackground(color), Qt.ForegroundRole) self._model.appendRow(item) self.setModel(self._model) self.setFocusPolicy(Qt.StrongFocus) self.currentIndexChanged.connect(self.updateBackground) self.updateBackground(self.currentIndex()) def updateBackground(self, index): if index < 0: self.setStyleSheet('') return self.setStyleSheet(''' MyQComboBox {{ color: {foreground}; background: {background}; }} '''.format( foreground=self.itemData(index, Qt.ForegroundRole).name(), background=self.itemData(index, Qt.BackgroundRole).name() )) def wheelEvent(self, event): return def showPopup(self): maxHeight = min( s.availableGeometry().height() for s in QApplication.screens()) view = self.view() model = view.model() margins = view.parent().contentsMargins() spacing = view.spacing() heightHint = margins.top() + margins.bottom() - spacing for row in range(self.count()): itemHeight = view.visualRect(model.index(row, 0)).height() + spacing if heightHint + itemHeight > maxHeight: break heightHint += itemHeight view.parent().setFixedHeight(heightHint) super().showPopup() class StatusDelegate(QStyledItemDelegate): def createEditor(self, parent, option, index): def updateModel(comboIndex): current = pIndex.data(StatusRole) or 0 if comboIndex != current: self.commitData.emit(editor) pIndex = QPersistentModelIndex(index) editor = MyQComboBox(parent) editor.clearFocus() editor.currentIndexChanged.connect(updateModel) return editor def setEditorData(self, editor, index): statusIndex = index.data(StatusRole) if ( statusIndex is not None and editor.currentIndex() != statusIndex ): editor.setCurrentIndex(statusIndex) def setModelData(self, editor, model, index): current = index.data(StatusRole) or 0 editorIndex = editor.currentIndex() if editorIndex != current: model.setData(index, editorIndex, StatusRole) if editorIndex > 0: background = editor.itemData(editorIndex, Qt.BackgroundRole) else: background = None model.setData(index, background, Qt.BackgroundRole) class MainWindow(QMainWindow): def __init__(self): super(MainWindow, self).__init__() self.UI=uic.loadUi('VertigoCentral.ui', self) self.ShotTable.setFocusPolicy(Qt.NoFocus) self.ShotTable.verticalHeader().setDefaultSectionSize(36) self.ShotTable.horizontalHeader().setSectionResizeMode( 5, QHeaderView.ResizeToContents) self.ShotTable.setItemDelegateForColumn( 5, StatusDelegate(self.ShotTable)) for row in range(self.ShotTable.rowCount()): item = self.ShotTable.item(row, 5) if not item: item = QTableWidgetItem() self.ShotTable.setItem(row, 5, item) self.ShotTable.openPersistentEditor(item) if __name__ == '__main__': import sys app = QApplication(sys.argv) window = MainWindow() window.show() sys.exit(app.exec()) ```
null
CC BY-SA 4.0
null
2022-12-23T18:39:47.793
2022-12-23T18:39:47.793
null
null
2,001,654
null
74,903,171
2
null
20,597,584
2
null
## Simple Solution: Just set `android:insetBottom="50dp"` for popup background xml file in `drawable`: ``` <--spinner_popup_bg.xml--> <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android" android:exitFadeDuration="@android:integer/config_mediumAnimTime"> <item android:state_pressed="true" android:drawable="@android:color/white" /> <item android:state_selected="true" android:drawable="@android:color/white" /> <item> <inset android:insetLeft="5dp" android:insetRight="5dp" android:insetBottom="50dp"> <shape android:shape="rectangle"> <stroke android:width="1dp" android:color="#001726" /> <solid android:color="#FFFF" /> </shape> </inset> </item> </selector> ``` and for `spinner` in activity set `android:popupBackground="@drawable/spinner_popup_bg"` i.e. ``` <Spinner android:id="@+id/myid" ... android:layout_width="300dp" android:layout_height="?attr/dropdownListPreferredItemHeight" android:popupBackground="@drawable/spinner_popup_bg" ... /> ``` [](https://i.stack.imgur.com/xBINh.gif)
null
CC BY-SA 4.0
null
2022-12-23T19:03:58.833
2022-12-23T19:03:58.833
null
null
6,576,302
null
74,903,224
2
null
74,903,039
0
null
try this : ``` from django.conf.urls.static import static urlpatterns = [ ... ... ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) + \ static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) ``` ``` MEDIA_URL = '/media/' MEDIA_ROOT = os.path.join(BASE_DIR, 'media') STATIC_URL = '/static/' STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles') ``` Or just try this command: >
null
CC BY-SA 4.0
null
2022-12-23T19:10:16.627
2022-12-23T19:10:16.627
null
null
12,885,839
null
74,903,305
2
null
74,902,499
1
null
My guess is you are looking for something like this. Create two new series in your data frame - one that is 0 if the y value is negative, and another that is 0 if your y value is positive. Bookend both these series with 0 values. You can then use these two series as the outlines of your polygons: Thanks ro r2evans for the dataset, which I have modified somewhat to make it more in keeping with the ranges of the OP's data. ``` set.seed(2022) dat <- data.frame(x = 1:123, y = cumsum(runif(123, -1.5, 1.5))) dat$y_up <- ifelse(dat$y > 0, dat$y, 0) dat$y_dn <- ifelse(dat$y < 0, dat$y, 0) plot(dat$x, dat$y, type = "l", ann = FALSE, xaxt = "n", yaxt = "n") title(xlab = "Years", ylab = "NAO SLP Index") abline(h = 0) axis(side = 1, at = seq(1, 123, 10), labels = seq(1900, 2020, 10), las = 1) axis(side = 2, at = seq(-6, 6, 0.5), labels = seq(-6, 6, 0.5)) polygon(c(dat$x[1], dat$x, tail(dat$x, 1)), c(0, dat$y_up, 0), col = "red") polygon(c(dat$x[1], dat$x, tail(dat$x, 1)), c(0, dat$y_dn, 0), col = "blue") ``` ![](https://i.imgur.com/uw5rUBU.png) [reprex v2.0.2](https://reprex.tidyverse.org)
null
CC BY-SA 4.0
null
2022-12-23T19:20:40.470
2022-12-23T19:20:40.470
null
null
12,500,315
null
74,903,311
2
null
74,876,421
0
null
I would use the `SparkSQL` API in that case because windows are going to be very helpful. For each year, let's compute the percentage of products needed to achieve at least 65% of the sales: ``` # let's create some sample data. I assume we have one line per sale df = spark.createDataFrame([('2020', 'prod1'), ('2020', 'prod1'), ('2020', 'prod1'), ('2020', 'prod1'), ('2020', 'prod1'), ('2020', 'prod3'), ('2020', 'prod1'), ('2020', 'prod2'), ('2020', 'prod2'), ('2020', 'prod3'), ('2020', 'prod4'), ('2020', 'prod5')], ['year', 'asin']) # let's start by counting the number of sales per product, per year df.groupBy("year", "asin").count().show() ``` ``` +----+-----+-----+ |year| asin|count| +----+-----+-----+ |2020|prod1| 6| |2020|prod3| 2| |2020|prod2| 2| |2020|prod4| 1| |2020|prod5| 1| +----+-----+-----+ ``` Now, let's use windows to compute things we will need to answer your question: - `product_count`- `total_sales`- `cum_sales`- `product_index From there,``is the percentage of product,``the percentage of sales so that we can see if at least 65% of the sales were made by less than 20% of the products. We can finally compute` ``` from pyspark.sql import Window from pyspark.sql import functions as f ordered_window = Window.partitionBy("year").orderBy(f.col("count").desc(), "asin") window = Window.partitionBy("year") rich_df = df.groupBy("year", "asin").count()\ .withColumn("product_count", f.count(f.col("*")).over(window))\ .withColumn("total_sales", f.sum("count").over(window))\ .withColumn("cum_sales", f.sum("count").over(ordered_window))\ .withColumn("product_index", f.rank().over(ordered_window))\ .withColumn("product_per", f.col("product_index") / f.col("product_count"))\ .withColumn("sales_per", f.col("cum_sales") / f.col("total_sales"))\ .withColumn("dist", f.col("sales_per") - 0.65) rich_df.show() ``` ``` +----+-----+-----+-------------+-----------+---------+-------------+-----------+------------------+--------------------+ |year| asin|count|product_count|total_sales|cum_sales|product_index|product_per| sales_per| dist| +----+-----+-----+-------------+-----------+---------+-------------+-----------+------------------+--------------------+ |2020|prod1| 6| 5| 12| 6| 1| 0.2| 0.5|-0.15000000000000002| |2020|prod2| 2| 5| 12| 8| 2| 0.4|0.6666666666666666|0.016666666666666607| |2020|prod3| 2| 5| 12| 10| 3| 0.6|0.8333333333333334| 0.18333333333333335| |2020|prod4| 1| 5| 12| 11| 4| 0.8|0.9166666666666666| 0.2666666666666666| |2020|prod5| 1| 5| 12| 12| 5| 1.0| 1.0| 0.35| +----+-----+-----+-------------+-----------+---------+-------------+-----------+------------------+--------------------+ ``` So in this case, we need 40% of the products (2 out of 5) to reach at least 65% of the sales. Let's only keep that line: ``` dist_win = Window.partitionBy("year").orderBy("dist") rich_df.where(f.col("dist") >= 0)\ .withColumn("dist_rank", f.rank().over(dist_win))\ .where(f.col("dist_rank") == 1)\ .select("year", "product_per", "sales_per", (f.col("product_per") < 0.2).alias("hasLongTail"))\ .show() ``` ``` +----+-----------+------------------+-----------+ |year|product_per| sales_per|hasLongTail| +----+-----------+------------------+-----------+ |2020| 0.4|0.6666666666666666| false| +----+-----------+------------------+-----------+ ``` And that's going to work for more than one year ;-)
null
CC BY-SA 4.0
null
2022-12-23T19:21:36.970
2022-12-23T19:21:36.970
null
null
8,893,686
null
74,903,325
2
null
74,903,039
0
null
try this on top every HTML file if you didn't: ``` {% load static %} ``` this is because when you add some static files then you must tell manually the template to load those static file. for more you can see [here](https://docs.djangoproject.com/en/4.1/howto/static-files/)
null
CC BY-SA 4.0
null
2022-12-23T19:23:01.957
2022-12-23T19:23:01.957
null
null
11,031,987
null
74,903,766
2
null
74,902,499
0
null
An alternative approach using bars. ``` set.seed(2022) dat <- data.frame(x = seq(1900, 2022, 1), y = cumsum(runif(123, -1.5, 1.5))) dat$col <- ifelse(dat$y < 0, "blue3", "red3") bp <- barplot(dat$y, border=F, col=dat$col, space=0, xlab="Year", ylab="Index") lines(bp, dat$y, col="gray45") lines(bp, rnorm(nrow(dat), 1.5, 0.3), lt=2, col="red2") abline(h=0, col="blue") axis(1, bp[c(T, rep(F, 9))], labels=dat$x[c(T,rep(F, 9))]) box() ``` [](https://i.stack.imgur.com/1b7vi.png)
null
CC BY-SA 4.0
null
2022-12-23T20:31:13.677
2022-12-23T20:31:13.677
null
null
9,462,095
null
74,903,784
2
null
74,902,499
1
null
Here's an alternative approach. Instead of dividing the time series into many polygons I decided to draw everything at once (well, twice actually) and limit the plotting region instead. Generating data and initial plotting: ``` # random data set.seed(1) ts.NAO <- list(NAO_index=rnorm(123, sd=2)) running_mean <- stats::filter(ts.NAO$NAO_index, rep(1, 7)/7) plot(ts.NAO$NAO_index, type='n', ann=F, xaxt='n', yaxt='n', xlim=c(0, 123)) title(xlab="Years", ylab="NAO SLP Index") axis(side=1, at=seq(1,123,10), labels=seq(1900,2020,10), las=1) # customizing the x axis axis(side=2, at=seq(-6,6,0.5), labels=seq(-6,6,0.5)) # customizing the y axis # save for later use par0 <- par(c('usr', 'mar')) # vertical value of dividing point between red and blue split.at <- 0 # normalized device coordinates of plotting region x and y limits and # the split point coords <- list(x=grconvertX(par0$usr[1:2], to='ndc'), y=grconvertY(c(par0$usr[3:4], split.at), to='ndc')) ``` Here's a function that creates the lower or upper subfigure and draws the polygon. I didn't want to repeat some parts of code twice, hence the function (although it would be shorter without it). ``` sub_fig <- function(upper=T, color='red') { if (upper) { y.fig <- coords$y[3:2] # subfigure bottom and top y.usr <- c(split.at, par0$usr[4]) # plot y limits } else { y.fig <- coords$y[c(1, 3)] y.usr <- c(par0$usr[3], split.at) } par(fig=c(coords$x, y.fig), mar=rep(0, 4), new=T) frame() plot.window(par0$usr[1:2], y.usr, xaxs='i', yaxs='i') polygon(c(1, seq_along(ts.NAO$NAO_index), length(ts.NAO$NAO_index)), c(split.at, ts.NAO$NAO_index, split.at), col=color) } # upper sub_fig() # lower sub_fig(F, 'blue') # restore initial plot coordinates par(fig=c(0, 1, 0, 1), mar=par0$mar, new=T) frame() plot.window(par0$usr[1:2], par0$usr[3:4], xaxs='i', yaxs='i') abline(h=0, col="blue") lines(running_mean, col=gray(.7), lty=2, lwd=2) ``` [](https://i.stack.imgur.com/oCtWZ.png)
null
CC BY-SA 4.0
null
2022-12-23T20:33:14.670
2022-12-23T20:33:14.670
null
null
2,094,893
null
74,904,025
2
null
29,500,227
0
null
For those who have multiple targets, check if framework was added on the right target. (in Frameworks, Libraries, and Embedded Content).
null
CC BY-SA 4.0
null
2022-12-23T21:12:21.493
2022-12-23T21:12:21.493
null
null
1,804,311
null
74,904,189
2
null
74,903,814
0
null
I got it! so I removed the image from inside the post but kept the image command in the post `.qmd` header. ``` image: "An intro to chi-squared test.png ``` Then in my main `index.qmd` file I added the following below listing: ``` fields: [image, date, title, description, categories,author] ``` So my header became: ``` --- title: "Blog" about: template: jolla image-width: 70% listing: contents: posts fields: [image, date, title, description, categories,author] sort: "date desc" type: default categories: true sort-ui: false filter-ui: false page-layout: full title-block-banner: true --- ``` Now my blog looks like this: [](https://i.stack.imgur.com/svBVR.png)
null
CC BY-SA 4.0
null
2022-12-23T21:40:47.403
2022-12-24T02:08:54.177
2022-12-24T02:08:54.177
9,696,037
9,696,037
null
74,904,193
2
null
74,904,096
0
null
There are two problems with your code: 1. The dialog accepts a BuildContext. So you'll have to provide it. 2. The dialog has a return value of Future<T?>. so you'll have to specify the return type as Future<void> Your function should look like this: ``` Future<void> _showSimpleDialog(BuildContext context) async { return await showDialog( context: context, builder: (context) { return SimpleDialog( title: Text('Do you want delete point?'), children: <Widget>[ SimpleDialogOption( onPressed: () { Future<void> deleteUser(BuildContext context) async { // var res = await _apiClient.deleteAccount(); // if (res == 200) { await Navigator.of(context) .pushNamedAndRemoveUntil('auth', (route) => false); // await deactivateUser(); // } } }, child: const Text('Yes'), ), SimpleDialogOption( onPressed: () { // _dismissDialog(); }, child: const Text('No'), ), ], ); }); } ``` And when you call it, you should provide a `BuildContext`: ``` _showSimpleDialog(context); ``` --- Complete runnable example: ``` import 'package:flutter/material.dart'; const Color darkBlue = Color.fromARGB(255, 18, 32, 47); void main() { runApp(MaterialApp( home: MyApp(), )); } class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( theme: ThemeData.dark().copyWith( scaffoldBackgroundColor: darkBlue, ), debugShowCheckedModeBanner: false, home: Scaffold( body: Center( child: TextButton( child: Text( 'Click Me', style: TextStyle( fontSize: 20.0, color: Colors.white, ), ), onPressed: () { _showSimpleDialog(context); }, ), ), ), ); } } Future<void> _showSimpleDialog(BuildContext context) async { return await showDialog( context: context, builder: (context) { return SimpleDialog( title: Text('Do you want delete point?'), children: <Widget>[ SimpleDialogOption( onPressed: () { Future<void> deleteUser(BuildContext context) async { // var res = await _apiClient.deleteAccount(); // if (res == 200) { await Navigator.of(context) .pushNamedAndRemoveUntil('auth', (route) => false); // await deactivateUser(); // } } }, child: const Text('Yes'), ), SimpleDialogOption( onPressed: () { // _dismissDialog(); }, child: const Text('No'), ), ], ); }); } ```
null
CC BY-SA 4.0
null
2022-12-23T21:41:19.830
2022-12-23T21:41:19.830
null
null
12,349,734
null
74,904,254
2
null
74,903,292
0
null
Try the following commands: 1. flutter clean 2. flutter pub get 3. flutter build apk --release (for release build apk) flutter build apk --debug (for debug apk) Still, if the problem is not resolved try with a lower version of `Gradle`.
null
CC BY-SA 4.0
null
2022-12-23T21:54:07.220
2023-01-03T20:40:46.167
2023-01-03T20:40:46.167
11,979,146
19,746,414
null
74,904,279
2
null
74,876,492
0
null
You need to post the code so we can figure out the answer, but I can see your `pickWinner` function has a `restricted` modifier. If the modifier is preventing the transaction from executing, then the client (remix, metamask, etc) won't be able to estimate the gas.
null
CC BY-SA 4.0
null
2022-12-23T21:58:09.857
2022-12-23T21:58:09.857
null
null
2,079,806
null
74,904,266
2
null
74,904,023
0
null
Perhaps something like this would work for you (please ignore possibly incorrect data in the JSON, when it comes to the values associated with the `icon` key - I've extracted it from your image via an online OCR service): ``` var data = { 0: {day: 'Sat Dec 24 2022 02:00:00', temp: 16.49, icon: '10'}, 1: {day: 'Sat Dec 24 2022 05:00:00', temp: 15.67, icon: '04n'}, 2: {day: 'Sat Dec 24 2022 08:00:00', temp: 14.57, icon: '04d'}, 3: {day: 'Sat Dec 24 2022 11:00:00', temp: 17.12, icon: '04d'}, 4: {day: 'Sat Dec 24 2022 14:00:00', temp: 19.3, icon: '04d'}, 5: {day: 'Sat Dec 24 2022 17:00:00', temp: 18.04, icon: '02d'}, 6: {day: 'Sat Dec 24 2022 20:00:00', temp: 16.08, icon: '02'}, 7: {day: 'Sat Dec 24 2022 23:00:00', temp: 15.17, icon: '010'}, 8: {day: 'Sun Dec 25 2022 02:00:00', temp: 14.06, icon: '010'}, 9: {day: 'Sun Dec 25 2022 05:00:00', temp: 14.63, icon: '10'}, 10: {day: 'Sun Dec 25 2022 08:00:00', temp: 14.37, icon: '10'}, 11: {day: 'Sun Dec 25 2022 11:00:00', temp: 15.43, icon: '04d'}, 12: {day: 'Sun Dec 25 2022 14:00:00', temp: 19.58, icon: '10'}, 13: {day: 'Sun Dec 25 2022 17:00:00', temp: 18.48, icon: '10'}, 14: {day: 'Sun Dec 25 2022 20:00:00', temp: 15.84, icon: '10'}, 15: {day: 'Sun Dec 25 2022 23:00:00', temp: 15.2, icon: '10'}, 16: {day: 'Mon Dec 26 2022 02:00:00', temp: 14.12, icon: '10'}, 17: {day: 'Mon Dec 26 2022 05:00:00', temp: 14.67, icon: '03n'}, 18: {day: 'Mon Dec 26 2022 08:00:00', temp: 15.12, icon: '04d'}, 19: {day: 'Mon Dec 26 2022 11:00:00', temp: 17.76, icon: '04d'}, 20: {day: 'Mon Dec 26 2022 14:00:00', temp: 20.65, icon: '04d'}, 21: {day: 'Mon Dec 26 2022 17:00:00', temp: 18.64, icon: '02d'}, 22: {day: 'Mon Dec 26 2022 20:00:00', temp: 16.01, icon: '03n'}, 23: {day: 'Mon Dec 26 2022 23:00:00', temp: 14.36, icon: '010'}, 24: {day: 'Tue Dec 27 2022 02:00:00', temp: 13.72, icon: '010'}, 25: {day: 'Tue Dec 27 2022 05:00:00', temp: 13.87, icon: '04n'}, 26: {day: 'Tue Dec 27 2022 08:00:00', temp: 14.02, icon: '04d'}, 27: {day: 'Tue Dec 27 2022 11:00:00', temp: 18.3, icon: '02d'}, 28: {day: 'Tue Dec 27 2022 14:00:00', temp: 20.33, icon: '01d'} } var endData = {}; for (const [key, value] of Object.entries(data)) { // key being the numerical key - 0, 1, etc, and value being the associated json // going with the value, we can extract the day and the date (we'll use slice and the first 15 characters for that) from the timestamp-like format, and the associated temperature const day = value.day.slice(0, 15); const temp = value.temp; // next, we check if the day already exists in the endData object if (!endData[day]) { // if it doesn't, we'll add it, and set the min and max temp values to the current temp value, just so we have something to work with later on endData[day] = { min: temp, max: temp }; } else { // if our day is already in the endData object, we'll update the min and max temp values if necessary // the new min value for the current day will be whatever is the lower value between what was already in the endData object, and what we're currently getting with const temp. The same goes for max value endData[day].min = Math.min(endData[day].min, temp); endData[day].max = Math.max(endData[day].max, temp); } } console.log(endData); ```
null
CC BY-SA 4.0
null
2022-12-23T21:55:40.217
2022-12-23T21:55:40.217
null
null
6,133,426
null
74,904,299
2
null
6,375,822
0
null
I tried this and it works perfectly!! just play with percentage until you find the needed result. Apply this on your @font-face: ``` ascent-override: 90%; ``` Hope it helps! More info: [https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/ascent-override](https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/ascent-override)
null
CC BY-SA 4.0
null
2022-12-23T22:01:09.193
2022-12-23T22:01:09.193
null
null
4,980,054
null
74,904,361
2
null
74,902,354
1
null
Content-type of `Form` is `multipart/form-data` and content-type of `Form-encode` is `application/x-www-form-urlencoded`. Does your data you want to post contain more than one type (like `image` along with `text/plain`)? If your data you want to post contains more than one type, look [here](https://www.tutorialspoint.com/data-chunks-in-node-js). If it doesn't, add `Content-type:application/x-www-form-urlencoded` to the header and send post via `Form-encoded` option. Good Luck :) ``` const app = express(); app.use(express.urlencoded({ extended: true })); app.post("/", (req,res) => { res.status(200).json(req.body["random-data"]); // Result = lorem ipsum dolor sit amet }); ```
null
CC BY-SA 4.0
null
2022-12-23T22:12:08.767
2022-12-23T22:12:08.767
null
null
11,818,903
null
74,904,441
2
null
74,903,690
1
null
Probably not the answer that you expect, but you can rework the problem by eliminating `v`, as follows: ``` (x cos u)² - (y sin u)² = cos²u sin²u ``` Then with `t = sin²u`, the equation is quadratic in `t`: ``` x² (1 - t) - y² t = (1 - t) t ```
null
CC BY-SA 4.0
null
2022-12-23T22:25:58.793
2022-12-26T15:51:45.553
2022-12-26T15:51:45.553
null
null
null
74,904,475
2
null
74,900,991
1
null
Okay, if you intend on building this to accommodate ANY size of data. I would 100% recommend you use conditional formatting. - First Step is the day row needs to be filled with full dates (you can do it without, this is just a bit easier). you can format them to just look like the DAY(date) but keep the full date in the cell: [](https://i.stack.imgur.com/iXbxI.png)- Next, you're going to fill ALL THE CELLS in your scheduling chart area with this symbol: ▼: [](https://i.stack.imgur.com/iSUO2.png)- Next you're going to Select ALL the little triangles, and format them white: [](https://i.stack.imgur.com/IYTbf.png) And they're all White: [](https://i.stack.imgur.com/ryacL.png)- Next, Add conditional Formatting. It will check if it is the start date or the end date: > =OR($B2=E$1,$C2=E$1) [](https://i.stack.imgur.com/mitae.png) If you want to make this a bit easier to follow, we can add an additional layer of highlighting: [](https://i.stack.imgur.com/CPr7b.png) [](https://i.stack.imgur.com/uPVQI.png) You WILL need to edit the previous formatting to include the blue, and also put it on top, but we're getting somewhere. You can also add some lines with dashes: [](https://i.stack.imgur.com/BObJM.png) [](https://i.stack.imgur.com/JKyYP.png) [](https://i.stack.imgur.com/ieuDn.png)
null
CC BY-SA 4.0
null
2022-12-23T22:32:37.943
2022-12-23T22:32:37.943
null
null
16,826,729
null
74,904,576
2
null
35,499,498
0
null
``` function replaceNth( string: string, from: string, to: string, n: number ): string { const pattern = RegExp(escapeRe(from)); let nth = 0; // eslint-disable-next-line @typescript-eslint/no-unused-vars const result = string.replace(pattern, function (match, i, original) { nth++; return nth === n ? to : match; }); console.log(`${string} => ${result}`); return result; } ```
null
CC BY-SA 4.0
null
2022-12-23T22:52:45.380
2022-12-23T22:52:45.380
null
null
11,760,510
null
74,904,672
2
null
30,999,076
0
null
Nowadays, the `gap` property for flexbox has pretty decent support: [https://caniuse.com/flexbox-gap](https://caniuse.com/flexbox-gap) So you can use this: ``` .slick-track { display: flex; gap: 1rem; } ``` It'll add space only between elements.
null
CC BY-SA 4.0
null
2022-12-23T23:12:40.097
2022-12-23T23:12:40.097
null
null
7,948,938
null
74,904,984
2
null
14,622,421
2
null
Alas, none of these solutions worked for me. I am working with output from brms::conditional_effects() My solution required: ``` + labs( fill = "New Title", colour = "New Title", labels = "New Title" ) ```
null
CC BY-SA 4.0
null
2022-12-24T00:43:11.513
2022-12-24T00:43:11.513
null
null
19,617,180
null
74,905,117
2
null
74,899,963
0
null
## Custom-Sort Rows - `ActiveSheet``Cells(bottom, right)`- [Right](https://learn.microsoft.com/en-us/office/vba/language/reference/user-interface-help/right-function)`rCol``cRight`- `Application.CustomListCount + 1`- `ByRow`[documentation](https://learn.microsoft.com/en-us/office/vba/api/excel.application.addcustomlist) ``` Sub SortColumns() Dim iclCount As Long: iclCount = Application.CustomListCount ' initial On Error GoTo ClearError ' start error-handling routine Dim wb As Workbook: Set wb = ThisWorkbook ' workbook containing this code Dim ws As Worksheet: Set ws = wb.Sheets("Data") Dim rg As Range: Set rg = ws.Range("A1").CurrentRegion Application.AddCustomList rg.Rows(1) With rg.Resize(rg.Rows.Count - 1).Offset(1) ' exclude first row .Sort .Rows(1), xlAscending, , , , , , xlNo, iclCount + 1, , xlSortRows End With ProcExit: ' Exit Routine On Error Resume Next ' prevent endless loop if error in the following lines With Application ' Delete all newly added custom lists (it's only one in this case). Do While .CustomListCount > iclCount .DeleteCustomList .CustomListCount Loop End With On Error Resume Next Exit Sub ClearError: ' continue error-handling routine Debug.Print "Run-time error '" & Err.Number & "':" & vbLf & Err.Description Resume ProcExit ' redirect to exit routine End Sub ```
null
CC BY-SA 4.0
null
2022-12-24T01:26:52.173
2022-12-24T02:07:21.737
2022-12-24T02:07:21.737
9,814,069
9,814,069
null
74,905,148
2
null
74,903,690
0
null
Divide each side of x equation by cosh(v) and each side of y equation by sinh(v). Square all sides. Replace `sinh(v)**2` with z and `cosh(v)**2` with 1 + z. The sum of the lhs of the equations is 1. The difference is cos(2u). You can solve for cos(2u) and z and work out something close to what you are looking for. ``` >>> from sympy import x, y, z, v, u >>> from sympy import cosh,sinh,cos,Tuple,solve >>> e1 = x**2/cosh(v)**2 + y**2/sinh(v)**2-1 >>> e2 = y**2/sinh(v)**2-x**2/cosh(v)**2-cos(2*u) >>> solve(Tuple(e1,e2).subs(cosh(v)**2,1+z).subs(sinh(v)**2,z), z, cos(2*u), dict=True) [ {z: x**2/2 + y**2/2 - sqrt((x**2 - 2*x + y**2 + 1)*(x**2 + 2*x + y**2 + 1))/2 - 1/2, cos(2*u): -x**2 - y**2 - sqrt((x**2 - 2*x + y**2 + 1)*(x**2 + 2*x + y**2 + 1))}, {z: x**2/2 + y**2/2 + sqrt((x**2 - 2*x + y**2 + 1)*(x**2 + 2*x + y**2 + 1))/2 - 1/2, cos(2*u): -x**2 - y**2 + sqrt((x**2 - 2*x + y**2 + 1)*(x**2 + 2*x + y**2 + 1))}] ```
null
CC BY-SA 4.0
null
2022-12-24T01:41:57.673
2022-12-25T10:15:49.573
2022-12-25T10:15:49.573
1,089,161
1,089,161
null
74,905,302
2
null
74,849,605
0
null
The problem causing widget is `TapButton()` as you didn't produce the `TapButton()` class. I will try to mimic the class using `OutlinedButton` Replace the `TapButton()` with following code: ``` OutlinedButton(onPressed: () {}, child: Text("Sign In")); ``` or ``` FilledButton(onPressed: () {}, child: Text("Sign In")); ``` Output: [](https://i.stack.imgur.com/UbZ89m.png)
null
CC BY-SA 4.0
null
2022-12-24T02:38:20.793
2022-12-24T02:38:20.793
null
null
13,431,819
null
74,905,504
2
null
74,873,084
-1
null
Selecting "View/Force Reload" fixed it for me.
null
CC BY-SA 4.0
null
2022-12-24T03:56:41.553
2022-12-24T03:56:41.553
null
null
2,418,914
null
74,905,741
2
null
74,893,812
0
null
You might use this: `<div id="abc">WORN OUT: <br> DRESSED TO ASCEND FINALLY</div>`
null
CC BY-SA 4.0
null
2022-12-24T05:26:20.010
2022-12-24T05:26:20.010
null
null
20,846,371
null
74,905,969
2
null
74,905,728
0
null
It's because `list` has no `batch` function.maybe you convert `train_ds` from some type that has `batch` function...
null
CC BY-SA 4.0
null
2022-12-24T06:35:27.947
2022-12-24T06:35:27.947
null
null
11,008,967
null
74,905,993
2
null
74,905,813
1
null
Those are NA's. You could filter them out if you don't want them shown. ``` df1 <- data.frame(x = 1:4, z = c(1:2, NA_real_, 4)) ggplot(df1, aes(x, 1, fill = z)) + geom_tile() + scale_fill_viridis_c() ``` [](https://i.stack.imgur.com/jSngo.png) ``` ggplot(subset(df1, !is.na(z)), aes(x, 1, fill = z)) + geom_tile() + scale_fill_viridis_c() ``` [](https://i.stack.imgur.com/Mdg7E.png)
null
CC BY-SA 4.0
null
2022-12-24T06:41:32.267
2022-12-24T06:41:32.267
null
null
6,851,825
null
74,906,043
2
null
74,903,292
0
null
I had Java 19 and gradle 6.7. Those are not compatible. You can learn Compatibility Matrix [here](https://docs.gradle.org/current/userguide/compatibility.html) I used java 19 and gradle 7.6. Those are compatible. That is worked. But now i have new problem [Flutter Error (while build apk) : FAILURE: Build failed with an exception. > Could not resolve all files for configuration ':classpath'](https://stackoverflow.com/questions/74906105/flutter-error-while-build-apk-failure-build-failed-with-an-exception-cou)
null
CC BY-SA 4.0
null
2022-12-24T06:53:02.313
2022-12-24T07:36:55.703
2022-12-24T07:36:55.703
18,065,992
18,065,992
null
74,906,104
2
null
74,905,415
1
null
Since version 15 polyfills.ts is not generated and it is moved directly into angular.json. So you don’t have to add it.
null
CC BY-SA 4.0
null
2022-12-24T07:03:05.010
2022-12-24T07:10:09.943
2022-12-24T07:10:09.943
19,526,872
19,526,872
null
74,906,226
2
null
74,904,919
1
null
## Create an Hourly Sequence ``` Sub CreateHourlySequence() Dim ws As Worksheet: Set ws = ActiveSheet ' improve! Dim dt1: dt1 = ws.Range("A2").Value Dim dt2: dt2 = ws.Range("A3").Value Dim dfCell As Range: Set dfCell = ws.Range("C2") dfCell.Resize(ws.Rows.Count - dfCell.Row + 1).ClearContents Select Case False Case IsDate(dt1), IsDate(dt2): Exit Sub End Select Dim dtDiff As Long: dtDiff = DateDiff("h", dt1, dt2) Dim dtStart As Date, dStep As Long Select Case dtDiff Case Is > 0: dtStart = dt1: dStep = 1 Case Is < 0: dtStart = dt2: dStep = -1 End Select Dim rCount As Long: rCount = Abs(dtDiff) + 1 Dim Data() As Date: ReDim Data(1 To rCount, 1 To 1) Dim d As Long, r As Long If dStep = 0 Then Data(1, 1) = dtStart Else For d = 0 To dtDiff Step dStep r = r + 1 Data(r, 1) = DateAdd("h", d, dtStart) Next d End If dfCell.Resize(rCount).Value = Data End Sub ```
null
CC BY-SA 4.0
null
2022-12-24T07:38:35.227
2022-12-24T07:38:35.227
null
null
9,814,069
null
74,906,350
2
null
2,663,115
0
null
I read through some answers and people have missed one obvious solution to the above problem. If given we can change the structure of the class Node then we can add a boolean flag to know if it has been visited or not. This way we only traverse list once. ``` Class Node{ Data data; Node next; boolean isVisited; } public boolean hasLoop(Node head){ if(head == null) return false; Node current = head; while(current != null){ if(current.isVisited) return true; current.isVisited = true; current = current.next; } return false; } ```
null
CC BY-SA 4.0
null
2022-12-24T08:05:38.833
2022-12-24T08:05:38.833
null
null
6,602,141
null
74,906,418
2
null
74,904,919
1
null
If you are ok with a non-VBA solution, then you have some options. ## Option 1: SEQUENCE For the Excel version listed [here](https://support.microsoft.com/en-us/office/sequence-function-57467a98-57e0-4817-9f14-2eb78519ca90), you could use the `SEQUENCE` function as suggested by chris neilsen. Example: Let's assume that your data starts at A1 like this: [](https://i.stack.imgur.com/hDiG1.png) Then, in C2, you could have : `=SEQUENCE((A3-A2)/VALUE("01:00:00")+1,1,A2,VALUE("01:00:00"))` Note that `VALUE("01:00:00")` represents 1 hour (but you could also use `TIME(1,,)` as suggested by [Mayukh Bhattacharya](https://stackoverflow.com/users/8162520/mayukh-bhattacharya)). --- ## Option 2: Dynamic Array Formula You have an Excel version listed [here](https://support.microsoft.com/en-us/office/dynamic-array-formulas-and-spilled-array-behavior-205c6b06-03ba-4151-89a1-87a7eb36e531), you can use a dynamic array formula . ### Example: Making the same assumptions as option 1, for where the data is, you could use a formula like this one: `=(ROW(INDIRECT("1:"&(A3-A2)/VALUE("01:00:00")+1))-1)*VALUE("01:00:00")+A2` #### Explanations: Using the `INDIRECT` function inside the `ROW` function is a neat trick to get an array with consecutive values. For instance, `INDIRECT("1:9")` return the array containing rows 1 to 9 and passing it to `ROW` will return the array as a column like this `{1;2;3;4;5;6;7;8;9}` (we get only one element per row). Since we don't know in advance how many steps we will take we calculate the number of elements using `(A3-A2)/VALUE("01:00:00")+1` and concatenate it to `"1:"` to get the range of size that we need. When we have the sequential array, we just need to make sure it starts by zero, which is why we remove 1 to all elements of the array like this: `ROW(INDIRECT("1:"&(A3-A2)/VALUE("01:00:00")+1))-1` Finally, we multiply each element of the array by the value corresponding to 1 hour and add the starting point in `A2`. --- ## Option 3: Old array formula Same idea as option 3 but using the old array formula explained [here](https://support.microsoft.com/en-us/office/guidelines-and-examples-of-array-formulas-7d94a64e-3ff3-4686-9372-ecfd5caa57c7#:%7E:text=Important%3A%20Press%20Ctrl%2BShift%2B,before%20you%20enter%20the%20formula.). Basically, you'll have to use `Ctrl+Shift+Enter`.
null
CC BY-SA 4.0
null
2022-12-24T08:21:19.453
2022-12-25T02:37:44.160
2022-12-25T02:37:44.160
5,958,842
5,958,842
null
74,906,593
2
null
49,074,666
17
null
[GitLab 15.7](https://about.gitlab.com/releases/2022/12/22/gitlab-15-7-released/#change-the-dimensions-of-images-in-markdown) (December 2022) adds an official support for this: > ## Change the dimensions of images in Markdown Before this release, there were no controls for changing the size of images rendered within Markdown text areas. This often led to unwieldy images with no control over how much space they took up in descriptions and comments.You can now set the width and height of how images are rendered directly in Markdown by appending the `{width=x height=y}` attributes to the image reference. Sizes can be specified with pixels or percentages.See [Documentation](https://docs.gitlab.com/ee/user/markdown.html#change-the-image-dimensions) and [Issue](https://gitlab.com/gitlab-org/gitlab/-/issues/28118).
null
CC BY-SA 4.0
null
2022-12-24T08:58:31.043
2022-12-24T08:58:31.043
null
null
6,309
null
74,906,617
2
null
15,895,121
0
null
I suspect this solution might work just fine in the original poster's case. ``` String fileName = imageFilePath; File inFile = new File(fileName); BufferedImage img = ImageIO.read(inFile); ... ``` Best,
null
CC BY-SA 4.0
null
2022-12-24T09:03:52.840
2022-12-24T09:03:52.840
null
null
8,551,985
null
74,906,781
2
null
74,906,140
0
null
Copied from Provider document: [https://pub.dev/packages/provider](https://pub.dev/packages/provider) DON'T create your object from variables that can change over time. In such a situation, your object would never update when the value changes. ``` int count; Provider( create: (_) => MyModel(count), child: ... ) ``` If you want to pass variables that can change over time to your object, consider using ProxyProvider: ``` int count; ProxyProvider0( update: (_, __) => MyModel(count), child: ... ) ``` It's ok to use Global key and switch between `ListView` and `ReorderableListView`, see example below: [https://dartpad.dev/?id=fd39a89b67448d86e682dd2c5ec77453](https://dartpad.dev/?id=fd39a89b67448d86e682dd2c5ec77453) ``` void main() { runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( title: 'Flutter Demo', home: MyHomePage(), ); } } class MyHomePage extends StatefulWidget { const MyHomePage({super.key}); @override State<MyHomePage> createState() => _MyHomePageState(); } class _MyHomePageState extends State<MyHomePage> { bool reOrder = false; @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text(reOrder ? "ReoderableListView" : "ListView"), ), floatingActionButton: FloatingActionButton(onPressed: () { setState(() { reOrder = !reOrder; }); }), body: MyListView(reOrder)); } } final data = List.generate(10, (index) => {"title": 'item $index', "value": false}); class MyListView extends StatefulWidget { final bool reOrder; const MyListView(this.reOrder, {super.key}); @override State<MyListView> createState() => _MyListViewState(); } class _MyListViewState extends State<MyListView> { @override Widget build(BuildContext context) { if (widget.reOrder) { return ReorderableListView( key: const ObjectKey('reordeableListView'), onReorder: (int oldIndex, int newIndex) { setState(() { if (oldIndex < newIndex) { newIndex -= 1; } final item = data.removeAt(oldIndex); data.insert(newIndex, item); }); }, children: [ for (var item in data) ListTile( key: ObjectKey('${item["title"]}_compactExerciseTemplateRow_provider'), title: Text(item["title"] as String), trailing: Text((item["value"] as bool).toString()), ), ], ); } else { return ListView.builder( key: const ObjectKey('listView'), itemCount: data.length, padding: const EdgeInsets.only(bottom: 120), itemBuilder: (BuildContext context, int index) { return CheckboxListTile( key: ObjectKey('${data[index]["title"]}_exerciseTemplateRow_provider'), title: Text(data[index]["title"] as String), value: (data[index]["value"] as bool), onChanged: (bool? value) { setState(() => data[index]["value"] = value!); }, ); }, ); } } } ```
null
CC BY-SA 4.0
null
2022-12-24T09:43:59.163
2022-12-24T09:49:41.480
2022-12-24T09:49:41.480
20,746,904
20,746,904
null
74,906,809
2
null
17,602,400
0
null
I'm using [Maizzle](https://maizzle.com) for rendering emails. I have forgot to add the `inlineCSS: true` to my `config.production.js`: ``` module.exports = { inlineCSS: true, } ``` After that, it worked completely fine!
null
CC BY-SA 4.0
null
2022-12-24T09:49:35.253
2022-12-24T09:49:35.253
null
null
8,586,803
null
74,906,834
2
null
74,906,495
0
null
you have to it different for the first cursor - - - - Alternative - - - - - - -
null
CC BY-SA 4.0
null
2022-12-24T09:55:24.013
2022-12-24T10:23:36.263
2022-12-24T10:23:36.263
9,938,317
9,938,317
null
74,907,385
2
null
74,886,706
0
null
``` export function show_tooltip($copy_button) { // Display a tooltip to notify the user the version was copied. const instance = tippy($copy_button[0], { placement: 'top', appendTo: () => document.body, //Just added this line. onUntrigger() { remove_instance(); }, }); instance.setContent("Copied!"); instance.show(); function remove_instance() { if (!instance.state.isDestroyed) { instance.destroy(); } } setTimeout(remove_instance, 3000); } ``` Appending the element to document.body seems to help solve this problem.
null
CC BY-SA 4.0
null
2022-12-24T11:37:33.247
2023-02-04T21:34:03.843
2023-02-04T21:34:03.843
12,237,990
19,652,333
null
74,907,466
2
null
74,906,473
0
null
It seems that when the flutter app starts in release mode on Android, the values of `MediaQuery.of(context).size.width` and `MediaQuery.of(context).size.height` are equal to zero for some reason. This causes my function to execute forever. Now I just return an empty list if the width or height is zero and it works great. The full correct example code is below: ``` import 'dart:math'; import 'package:flutter/material.dart'; void main() { runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({super.key}); // This widget is the root of your application. @override Widget build(BuildContext context) { return const MaterialApp( title: 'Flutter Demo', home: SplashScreen(), ); } } class SplashScreen extends StatefulWidget { const SplashScreen({Key? key}) : super(key: key); @override State<SplashScreen> createState() => _SplashScreenState(); } class _SplashScreenState extends State<SplashScreen> { List<SplashRandomCircle> _circles = []; @override void didChangeDependencies() { super.didChangeDependencies(); final width = MediaQuery.of(context).size.width; final height = MediaQuery.of(context).size.height; final circlesCount = 8 + Random().nextInt(4); setState(() { _circles = SplashRandomCircle.randomListNoIntersection( count: circlesCount, width: width, height: height, ); }); } @override Widget build(BuildContext context) { return Scaffold( body: Stack( children: [ ..._circles .map( (e) => Positioned( left: e.xCoord - e.radius, top: e.yCoord - e.radius, child: Container( decoration: BoxDecoration( shape: BoxShape.rectangle, borderRadius: BorderRadius.circular(e.radius * 0.9), color: e.color, ), width: e.radius * 2, height: e.radius * 2, ), ), ) .toList(), ], ), ); } } class SplashRandomCircle { static int opacityPrecision = 10000; static Random randomizer = Random(); static Color mainColor = const Color.fromARGB(255, 156, 74, 67); static Color randomBlue(double minOpacity, double maxOpacity) { final deltaOpacity = ((maxOpacity - minOpacity) * opacityPrecision).round(); return mainColor.withOpacity( randomizer.nextInt(deltaOpacity) / opacityPrecision + minOpacity, ); } static double randomX(double width, double multiplier) { final right = randomizer.nextBool(); var xCoord = randomizer.nextDouble() * width * multiplier; if (right) { xCoord = width - xCoord; } return xCoord; } static double randomY(double height, double multiplier) { final bottom = randomizer.nextBool(); var yCoord = randomizer.nextDouble() * height * multiplier; if (bottom) { yCoord = height - yCoord; } return yCoord; } static double randomRadius(double minRadius, double width, double multiplier) { return randomizer.nextDouble() * width * multiplier + minRadius; } final double xCoord; final double yCoord; final double radius; final Color color; SplashRandomCircle({ required this.xCoord, required this.yCoord, required this.radius, required this.color, }); static SplashRandomCircle random({ required double width, required double height, double widthMultiplier = 0.5, double heightMultiplier = 0.5, double minRadius = 10, double radiusMultiplier = 0.5, double minOpacity = 0.3, double maxOpacity = 0.8, }) { return SplashRandomCircle( xCoord: randomX(width, widthMultiplier), yCoord: randomY(height, heightMultiplier), radius: randomRadius(minRadius, width, radiusMultiplier), color: randomBlue(minOpacity, maxOpacity), ); } static List<SplashRandomCircle> randomListNoIntersection({ required int count, required double width, required double height, double widthMultiplier = 0.6, double heightMultiplier = 0.6, double minRadius = 6, double radiusMultiplier = 0.6, double minOpacity = 0.4, double maxOpacity = 0.9, double logoWidthMultiplier = 0.4, double circlesSpacingMultiplier = 0.04, }) { final circles = <SplashRandomCircle>[]; if (width <= 0 || height <= 0) { return circles; } while (circles.length < count) { final newCircle = SplashRandomCircle.random( width: width, height: height, widthMultiplier: widthMultiplier, heightMultiplier: heightMultiplier, minRadius: minRadius, radiusMultiplier: radiusMultiplier, minOpacity: minOpacity, maxOpacity: maxOpacity, ); var checkPosition = true; // check if the new circle intersects with any of the existing circles for (final circle in circles) { final xDiff = circle.xCoord - newCircle.xCoord; final yDiff = circle.yCoord - newCircle.yCoord; final distance = sqrt(xDiff * xDiff + yDiff * yDiff); // REMOVE TO AVOID THE BUG if (distance < circle.radius + newCircle.radius + width * circlesSpacingMultiplier) { checkPosition = false; break; } // REMOVE TO AVOID THE BUG } // check if the new circle doesn't intersect with the logo final centerXDiff = width / 2 - newCircle.xCoord; final centerYDiff = height / 2 - newCircle.yCoord; final distance = sqrt(centerXDiff * centerXDiff + centerYDiff * centerYDiff); // REMOVE TO AVOID THE BUG if (distance < newCircle.radius + width * logoWidthMultiplier) { checkPosition = false; } // REMOVE TO AVOID THE BUG if (checkPosition) { circles.add(newCircle); } } return circles; } } ```
null
CC BY-SA 4.0
null
2022-12-24T11:53:45.200
2022-12-24T11:53:45.200
null
null
13,541,839
null
74,907,645
2
null
74,907,399
1
null
What you are looking for is edge detection on a pixel array and has been solved many times before. You can solve it yourself and it's fun to figure out yourself. When a problem exists in 2D space, it often helps to think in 2D. But your data is structured in 1D (which is fine, and the convention) Each pixel/bead has a position in the 1D array -let's call that `i`- and a position in 2D space, defined by `x` and `y`. The relationship between those is like this: `i = x + y * w` ( Where w is the width of the image) With this information you can traverse the 1D array through x and y quite easily and decide for each pixel what its neighbours are doing. example: ``` for(var x = 0; x < width; x++){ for(var y = 0; y < height; y++){ var i = x + y * width; // id of the current pixel being checked. // Calculate neighbour ids: var iNorth = x + (y - 1) * width; var iSouth = x + (y + 1) * width; var iEast = x + 1 + y * width; var iWest = x - 1 + y * width; var iNorthWest = (x - 1) + (y - 1) * width; // haha Kanye // etc.. you get the point // Now encode all those vars in one single byte // Use that byte to choose the right image for the bead at position I // Don't forget to deal with your edge cases } } ``` You can optimize later. (eg. You don't have to update the whole image each time you change one pixel, only its neighbors are affected.) Your "OXOOXOOO" string is a perfectly acceptable way of storing the different states of a bead. A more nerdy approach would be to just store bits in a 8 bit byte.(because each pixel has only 8 neighbours..) Those bytes can be stored in a buffer with the same exact structure as your actual pixel data. I think this should get you started without spoiling too much of the fun?
null
CC BY-SA 4.0
null
2022-12-24T12:29:29.790
2022-12-24T12:29:29.790
null
null
722,626
null
74,907,757
2
null
74,907,121
0
null
infos.data.Voted is array of objects, so you can use like this ``` {info.map((infos) => ( <tr> <td key={infos.id}>{infos.data.Name}</td> <td key={infos.id}>{infos.data.ID}</td> <td key={infos.id}>{infos.data.Email}</td> <td key={infos.id}>{infos.data.Telephone}</td> <td key={infos.id}>{infos.data.Branch.label}</td> <td key={infos.id}>{infos.data.Voted.map((v)=> v.label).join(",")}</td> </tr> ))} ```
null
CC BY-SA 4.0
null
2022-12-24T12:52:59.607
2022-12-24T12:52:59.607
null
null
20,760,580
null
74,907,779
2
null
74,906,453
1
null
your window should look like: [](https://i.stack.imgur.com/icQzp.png)
null
CC BY-SA 4.0
null
2022-12-24T12:58:10.730
2022-12-24T12:58:10.730
null
null
5,632,629
null
74,908,052
2
null
74,907,838
1
null
You were missing a `ctx.beginPath();` call at the beginning: > The CanvasRenderingContext2D.beginPath() method of the Canvas 2D API starts a new path by emptying the list of sub-paths. Call this method when you want to create a new path. ``` drawObject() { ctx.beginPath(); ctx.rect(this.x, this.y, this.w, this.h); ctx.fillStyle = this.color; ctx.fill(); } ``` [https://jsfiddle.net/wm1pxkfd/](https://jsfiddle.net/wm1pxkfd/)
null
CC BY-SA 4.0
null
2022-12-24T13:44:11.290
2022-12-24T13:44:11.290
null
null
3,625,444
null
74,908,231
2
null
74,908,178
0
null
Ok I found the solution its just to specify the color scheme this same like [this](https://stackoverflow.com/questions/69591128/chrome-is-forcing-a-white-background-on-frames-only-on-some-websites) post
null
CC BY-SA 4.0
null
2022-12-24T14:21:09.280
2022-12-24T14:21:09.280
null
null
19,427,448
null
74,908,303
2
null
5,818,850
0
null
``` public List<String> GetTexts() { ArrayList<String> texts = new ArrayList<String>(); for (int i = 0; i < mSpinnerList.size(); i ++) { int position = mSpinnerList.get(i).getSelectedItemPosition(); Log.d("DATA_TO_BE_SEND:", tennisModelArrayList.get(position).getStatus()); texts.add(mSpinnerList.get(i).getItemAtPosition(i).toString()); } return texts; } ```
null
CC BY-SA 4.0
null
2022-12-24T14:33:57.900
2022-12-24T14:33:57.900
null
null
5,015,427
null
74,908,496
2
null
74,904,919
0
null
A Simple Solution given your example (to clear cells it is your job :-) It would be better to write to an array but as example it should be ok. ``` Option Explicit Sub TimeToHour() Dim startTime As Double, endTime As Double, i As Double, z As Double startTime = Range("a2") endTime = Range("a3") Columns(3).NumberFormat = Range("a2").NumberFormat ' Column C z = 2 For i = startTime To endTime Step 1 / 24 Cells(z, 3) = i ' write to column c starting in row 2 z = z + 1 Next End Sub ```
null
CC BY-SA 4.0
null
2022-12-24T15:14:20.963
2022-12-24T15:14:20.963
null
null
19,618,751
null
74,908,569
2
null
74,905,813
1
null
To answer your question in the comment: The white boxes are simply the background of your plot. You can even see the grid lines. There are no values to plot there. NA values correspond to missing values in your data (having actually NA in a cell). Non existing values are not plotted.
null
CC BY-SA 4.0
null
2022-12-24T15:25:42.467
2022-12-24T15:25:42.467
null
null
17,602,505
null
74,908,651
2
null
74,908,542
0
null
You can open settings menu or hit CTRL+, together, then you can search 'suggestion'. There will be plenty of settings suggestion, you can choose what u want to be disabled as u want
null
CC BY-SA 4.0
null
2022-12-24T15:38:48.350
2022-12-24T15:38:48.350
null
null
14,032,873
null
74,908,893
2
null
19,684,040
0
null
for current height in px: ``` height = window.getComputedStyle(document.querySelector('textarea')).getPropertyValue('height') ``` for current width in px: ``` width = window.getComputedStyle(document.querySelector('textarea')).getPropertyValue('width') ``` change `'textarea'` to `'#history'` or like a css selector. or `textarea`, since a variable is declared to select element.
null
CC BY-SA 4.0
null
2022-12-24T16:22:16.813
2022-12-24T16:22:16.813
null
null
14,466,436
null
74,908,988
2
null
74,908,071
0
null
quite simble but complex. a big container that has all elements inside him with a flex column CSS ``` .main{ display: felx; flex-direction: column; position : absolute; top : 0; left : calc((100% / 2) - ((100% / 3)/2)); /* replace 3 with number of sections required */ } section{ height : 90%; /* leaving 10% for the nav bar */ width : 100vw; /* all must be the same size and if there is a gap, the gap must be subtracted using this method calc((100% / 2) - ((((100% - <gap size * number of gapes) / number of sections))/2)) */ } ``` HTML ``` <main> <section id="sec--1" onclick="moveSection(this)"></section> <section id="sec--2" onclick="moveSection(this)"></section> <section id="sec--3" onclick="moveSection(this)"></section> </main> ``` now every thing is ready for javascript any element that is in active mode shall be in the middle so we are going to change the parmeter in the calc() function in css and that is it, using the id and using str.slice(); method in javascript you can slice and concatenate it to int so you can use the method below: ``` function moveSection(e){ let active panel = e.id.slice(-1); let main = document.getElementsByTagName('main')[0]); // change main styling to the right equation } ``` the soloution logic is right but DO NOT copy my code, not going to work, it is missing alot of optimizations. if you still need further more help, I am available.
null
CC BY-SA 4.0
null
2022-12-24T16:38:35.530
2022-12-24T16:38:35.530
null
null
20,339,589
null
74,909,021
2
null
74,906,379
1
null
Use the `m.if3()` function for the conditional statement. Here is the local solution that they discussed on pg 332 of the [Cristiani and Martinon publication](https://www.proquest.com/openview/cb898b48417e869e2d4d62377fa38a4a/1.pdf). [](https://i.stack.imgur.com/CH6g9.png) ``` from gekko import GEKKO import numpy as np import matplotlib.pyplot as plt import math m = GEKKO() nt = 101; pi = math.pi tm = np.linspace(0,1,nt); m.time = tm x1=m.Var(value=-2.5,lb=-100,ub=100) x2=m.Var(value=0,lb=-100,ub=100) u=m.MV(value=0,lb=-pi,ub=pi); u.STATUS=1; u.DCOST=0.1 p = np.zeros(nt); p[-1] = 1.0 final = m.Param(value=p) tf = m.FV(value=10,lb=0.1,ub=100.0); tf.STATUS = 1 c = m.if3(x2-1,1,(x2-1)**2+1) m.Equation(x1.dt()==c*m.cos(u)*tf) m.Equation(x2.dt()==c*m.sin(u)*tf) # hard constraints (fix endpoint) #m.fix_final(x1,3) #m.fix_final(x2,0) # soft constraints (objective) m.Minimize(100*final*(x1-3)**2) m.Minimize(100*final*(x2-0)**2) # minimize final time # initialize with IPOPT Solver m.Minimize(tf) m.options.IMODE = 6 m.options.SOLVER=3 m.solve() # find MINLP solution with APOPT Solver m.options.SOLVER=1 m.options.TIME_SHIFT=0 m.solve() tm = tm * tf.value[0] plt.figure(figsize=(8,5)) plt.plot(tm,x1.value,'k-',lw=2,label=r'$x_1$') plt.plot(tm,x2.value,'b-',lw=2,label=r'$x_2$') plt.plot(tm,u.value,'r--',lw=2,label=r'$u$') plt.legend(loc='best'); plt.grid() plt.xlabel('Time'); plt.ylabel('Value') plt.savefig('results.png',dpi=300); plt.show() ``` The global solution is shown in the paper. [](https://i.stack.imgur.com/ZSL4E.png) The solvers in Gekko (APOPT, BPOPT, IPOPT) are local solvers. You need to add constraints or use different initial guess values to find the global optimum.
null
CC BY-SA 4.0
null
2022-12-24T16:43:56.287
2022-12-24T16:43:56.287
null
null
2,366,941
null
74,909,033
2
null
74,908,542
0
null
Could you please check and disable this extension. I think that is the root cause as your description [](https://i.stack.imgur.com/E0XED.png)
null
CC BY-SA 4.0
null
2022-12-24T16:46:09.850
2022-12-24T16:46:09.850
null
null
14,194,981
null
74,909,082
2
null
74,908,542
0
null
- - `ctrl + ,`- `workspace`- `Text Editor`- `Suggestions` [](https://i.stack.imgur.com/FC8AN.png) `!To turn off the suggestion set the delay to a max value of 9999 and aslo you cloud also turn off by going to quick suggestion section.`
null
CC BY-SA 4.0
null
2022-12-24T16:56:01.980
2022-12-24T16:56:01.980
null
null
15,538,881
null
74,909,203
2
null
74,895,068
0
null
`std::size` is defined in a number of headers, but iostream is not one of them. ``` Defined in header <array> Defined in header <deque> Defined in header <forward_list> Defined in header <iterator> Defined in header <list> Defined in header <map> Defined in header <regex> Defined in header <set> Defined in header <span> (since C++20) Defined in header <string> Defined in header <string_view> Defined in header <unordered_map> Defined in header <unordered_set> Defined in header <vector> ```
null
CC BY-SA 4.0
null
2022-12-24T17:16:14.797
2022-12-24T17:45:10.143
2022-12-24T17:45:10.143
168,986
168,986
null
74,909,279
2
null
74,889,670
0
null
For those who is interested, I found a solution to this issue. 1. Execute this command in terminal for the project dotnet nuget locals --clear all 2. While the project(solution) is opened in the Visual Studio, double-click on the top file (Solution) > Build > General > check the Build with MSBuild on Mono option.
null
CC BY-SA 4.0
null
2022-12-24T17:30:50.337
2022-12-24T17:30:50.337
null
null
8,625,659
null
74,909,320
2
null
22,218,140
2
null
I know this is not technically a javascript question but I was struggling with the same concept so I thought I'd make a demo to visualize the accepted answer Run the below code & move the slider ``` var sample=document.querySelector("#sample") var range=document.querySelector("#range") // rgb(255,0,0) var color1_red=255 var color1_green=0 var color1_blue=0 // rgb(0,0,255) var color2_red=0 var color2_green=0 var color2_blue=255 document.querySelector("#range").addEventListener("input",(event)=>{ let percent= range.value/100.0 let resultRed = color1_red + percent * (color2_red - color1_red); let resultGreen = color1_green + percent * (color2_green - color1_green); let resultBlue = color1_blue + percent * (color2_blue - color1_blue); sample.style.backgroundColor=`rgb(${resultRed},${resultGreen},${resultBlue})` }) ``` ``` #sample{ height:10rem; width:10rem; } #range{ width:10rem } #grad{ width:10rem; height:2rem; background-image: linear-gradient(to right, red , blue); } ``` ``` <div id="grad"></div> <input type="range" min="1" max="100" value="0" id="range"> <div id="sample" style="background-color:rgb(255,0,0);"></div> ``` Hope this helps in some way :)
null
CC BY-SA 4.0
null
2022-12-24T17:37:56.250
2022-12-24T17:37:56.250
null
null
15,182,215
null
74,909,420
2
null
74,900,991
1
null
if: - you place your triangle properly i.e. taking care to have their TopLeftCell in the proper row- add a "days" named range to encompass your "F2:S2" range then you can use the following code to be place in the relevant worksheet code pane: ``` Option Explicit Private Sub Worksheet_Change(ByVal Target As Range) On Error GoTo SafeExit Application.EnableEvents = False With Target Select Case True Case .Column = 2 MoveTriangle .Value, Target, True Case .Column = 3 MoveTriangle .Value, Target, False End Select End With SafeExit: Application.EnableEvents = True End Sub Sub MoveTriangle(myDate As Date, Target As Range, OkStartTriangle As Long) Dim dateRng As Range Dim triangleShp As Shape Select Case True Case Not GetDate(myDate, Range("days"), _ dateRng) MsgBox "Couldn't find date '" & myDate & "' in '" & Range("days").Address(False, False) & "'" Case Not GetShape(Target.Row, OkStartTriangle, _ triangleShp) MsgBox "Couldn't find the " & IIf(OkStartTriangle, "starting", "ending") & " triangle for row: " & Target.Row Case Else With triangleShp .Left = dateRng.Left + 0.5 * (dateRng.Width - .Width) End With End Select End Sub Function GetDate(myDate As Date, daysRng As Range, _ rng As Range) As Boolean Set rng = Range("days").Find(What:=myDate, LookIn:=xlFormulas, LookAt:=xlWhole) GetDate = Not rng Is Nothing End Function Function GetShape(rowIndex As Long, OkStartTriangle As Long, _ triangleShp As Shape) As Boolean Dim triangleColumnIndex As Long If OkStartTriangle Then triangleColumnIndex = Columns.Count Else triangleColumnIndex = 0 End If Set triangleShp = Nothing Dim shp As Shape For Each shp In Shapes With shp With .TopLeftCell Select Case True Case .Row <> rowIndex Case OkStartTriangle If .Column < triangleColumnIndex Then triangleColumnIndex = .Column Set triangleShp = shp End If Case Else If .Column > triangleColumnIndex Then triangleColumnIndex = .Column Set triangleShp = shp End If End Select End With End With Next GetShape = Not triangleShp Is Nothing End Function ```
null
CC BY-SA 4.0
null
2022-12-24T17:55:16.920
2022-12-24T18:08:57.390
2022-12-24T18:08:57.390
3,598,756
3,598,756
null
74,909,719
2
null
74,909,603
1
null
``` df = pd.read_fwf(r'c:\test\complex.txt', header=None) df[['real','im']] = df[0].str.extract(r'\(([-.\de]+)([+-]\d\.[\de\-j]+)') print(df) ``` ``` 0 real im 0 (9.486832980505137680e-01-3.162277660168379412... 9.486832980505137680e-01 -3.162277660168379412e-01j 1 (9.486832980505137680e-01+9.486832980505137680... 9.486832980505137680e-01 +9.486832980505137680e-01j 2 (-9.486832980505137680e-01+9.48683298050513768... -9.486832980505137680e-01 +9.486832980505137680e-01j 3 (-3.162277660168379412e-01+3.16227766016837941... -3.162277660168379412e-01 +3.162277660168379412e-01j 4 (-3.162277660168379412e-01+9.48683298050513768... -3.162277660168379412e-01 +9.486832980505137680e-01j 5 (9.486832980505137680e-01-3.162277660168379412... 9.486832980505137680e-01 -3.162277660168379412e-01j 6 (-3.162277660168379412e-01+3.16227766016837941... -3.162277660168379412e-01 +3.162277660168379412e-01j 7 (9.486832980505137680e-01-9.486832980505137680... 9.486832980505137680e-01 -9.486832980505137680e-01j 8 (9.486832980505137680e-01-9.486832980505137680... 9.486832980505137680e-01 -9.486832980505137680e-01j 9 (-3.162277660168379412e-01+3.16227766016837941... -3.162277660168379412e-01 +3.162277660168379412e-01j 10 (3.162277660168379412e-01-9.486832980505137680... 3.162277660168379412e-01 -9.486832980505137680e-01j ```
null
CC BY-SA 4.0
null
2022-12-24T18:53:38.900
2022-12-24T18:53:38.900
null
null
15,035,314
null
74,909,877
2
null
74,902,817
0
null
A older issue not documented in FilamentAdmin for deploy sites with Nginx server. Solution is add line `try_files $uri /index.php?$query_string;` to vitual host file in section `location ~* \.(jpg|jpeg|gif|png|webp|svg|woff|woff2|ttf|css|js|ico|xml)$`. Example below ``` location ~* \.(jpg|jpeg|gif|png|webp|svg|woff|woff2|ttf|css|js|ico|xml)$ { try_files $uri /index.php?$query_string; access_log off; log_not_found off; expires 14d; } ``` > Attention, is in this section, not in the principal section. [Problem loading Livewire.js #242](https://github.com/livewire/livewire/issues/242#issuecomment-948054946)
null
CC BY-SA 4.0
null
2022-12-24T19:27:06.420
2022-12-24T19:27:06.420
null
null
736,872
null
74,909,907
2
null
74,909,603
0
null
Never knew how annoyingly involved it is to read complex numbers with Pandas, This is a slightly different solution than @Алексей's. I prefer to avoid regular expressions when not absolutely necessary. ``` # Read the file, pandas defaults to string type for contents df = pd.read_csv('complex.txt', header=None, names=['string']) # Convert string representation to complex. # Use of `eval` is ugly but works. df['complex'] = df['string'].map(eval) # Alternatively... #df['complex'] = df['string'].map(lambda c: complex(c.strip('()'))) # Separate real and imaginary parts df['real'] = df['complex'].map(lambda c: c.real) df['imag'] = df['complex'].map(lambda c: c.imag) df ``` is... ``` string complex \ 0 (9.486832980505137680e-01-3.162277660168379412... 0.948683-0.316228j 1 (9.486832980505137680e-01+9.486832980505137680... 0.948683+0.948683j 2 (-9.486832980505137680e-01+9.48683298050513768... -0.948683+0.000000j 3 (-3.162277660168379412e-01+3.16227766016837941... -0.316228+0.316228j 4 (-3.162277660168379412e-01+9.48683298050513768... -0.316228+0.948683j 5 (9.486832980505137680e-01-3.162277660168379412... 0.948683-0.316228j 6 (3.162277660168379412e-01+3.162277660168379412... 0.316228+0.316228j 7 (9.486832980505137680e-01-9.486832980505137680... 0.948683-0.948683j real imag 0 0.948683 -3.162278e-01 1 0.948683 9.486833e-01 2 -0.948683 9.486833e-01 3 -0.316228 3.162278e-01 4 -0.316228 9.486833e-01 5 0.948683 -3.162278e-01 6 0.316228 3.162278e-01 7 0.948683 -9.486833e-01 ``` ``` df.dtypes ``` prints out.. ``` string object complex complex128 real float64 imag float64 dtype: object ```
null
CC BY-SA 4.0
null
2022-12-24T19:32:41.660
2022-12-24T19:41:16.300
2022-12-24T19:41:16.300
9,608,497
9,608,497
null
74,910,296
2
null
74,910,057
0
null
You were almost there [https://jsfiddle.net/mplungjan/e74fcon8/](https://jsfiddle.net/mplungjan/e74fcon8/) Note I changed the inline click to an eventListener ``` window.addEventListener("DOMContentLoaded", () => { const titleField = document.querySelector(".input-title"); const urlField = document.querySelector(".input-url") const createWork = () => { let inputTitle = titleField.value; let inputUrl = urlField.value; let div = document.createElement('div'); let newTitle = document.createElement("h2"); let newUrl = document.createElement("h3"); div.className = "div-work"; document.body.appendChild(div); div.appendChild(newTitle); div.appendChild(newUrl); // save data to local storage localStorage.setItem('title', inputTitle); localStorage.setItem('url', inputUrl); newTitle.innerText = "Title: " + inputTitle; newUrl.innerText = "URL: " + inputUrl; } document.querySelector(".btn-submit").addEventListener("click",createWork) if (localStorage.title && localStorage.url) { let storedTitle = localStorage.getItem('title'); let storedUrl = localStorage.getItem('url'); titleField.value = storedTitle; urlField.value = storedUrl; createWork(); } }); ```
null
CC BY-SA 4.0
null
2022-12-24T21:00:08.343
2022-12-24T21:05:09.350
2022-12-24T21:05:09.350
295,783
295,783
null
74,910,371
2
null
74,910,057
0
null
You should run `localStorage.getItem` code snippet out of the `createWork` function. ``` if (localStorage["title"] && localStorage["url"]) { let storedTitle = localStorage.getItem('title'); let storedUrl = localStorage.getItem('url'); console.log(storedTitle); console.log(storedUrl); let div = document.createElement('div'); let newTitle = document.createElement("h2"); let newUrl = document.createElement("h3"); div.className = "div-work"; document.body.appendChild(div); div.appendChild(newTitle); div.appendChild(newUrl); newTitle.innerText = "Title: " + storedTitle; newUrl.innerText = "URL: " + storedUrl; } function createWork() { let inputTitle = document.querySelector(".input-title").value; let inputUrl = document.querySelector(".input-url").value; let div = document.createElement('div'); let newTitle = document.createElement("h2"); let newUrl = document.createElement("h3"); div.className = "div-work"; document.body.appendChild(div); div.appendChild(newTitle); div.appendChild(newUrl); newTitle.innerText = "Title: " + inputTitle; newUrl.innerText = "URL: " + inputUrl; // save data to local storage localStorage.setItem('title', newTitle.innerText); localStorage.setItem('url', newUrl.innerText); }; ```
null
CC BY-SA 4.0
null
2022-12-24T21:16:45.357
2022-12-24T21:16:45.357
null
null
12,453,755
null
74,910,382
2
null
26,725,306
0
null
I was getting the same error and that was because I didn't use the right convention to add the comment in the xml file. I used the JAVA way to add the comment. We have to use the XML way to add the comment to avoid this error. This error could also be because of formatting , space issue or you have typed anything by mistake in between , etc.
null
CC BY-SA 4.0
null
2022-12-24T21:19:25.723
2022-12-24T21:21:42.190
2022-12-24T21:21:42.190
14,604,540
14,604,540
null
74,910,423
2
null
74,910,376
1
null
Opening in another browser (Safari in my case) it seems to work fine. I closed and reopened Chrome, and now it works fine. The bug seems to possibly be related to Chrome itself. Seen on Version 108.0.5359.124 (Official Build) (arm64) Hopefully anyone seeing a similar error can benefit: Try restarting your browser.
null
CC BY-SA 4.0
null
2022-12-24T21:29:23.367
2022-12-24T21:29:23.367
null
null
20,855,763
null