qid
int64
4
22.2M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
74,263,796
<p>I'm trying to deploy a single file to an Azure App Service website using the Azure cli command as below:</p> <pre><code> az webapp deploy --resource-group &lt;group-name&gt; --name &lt;app-name&gt; --src-path config.json --type=static </code></pre> <p>But when I run it I get an error stating:</p> <pre><code> ERROR: An error occured during deployment. Status Code: 400, Details: &quot;Path must be defined for type='Static'&quot; </code></pre> <p>So then I define a path and get:</p> <pre><code> ERROR: unrecognized arguments: --path=/home/site/wwwroot/xxx.json </code></pre> <p>I'm assuming this is because my website is not static. I just want to deploy a single file from a known location in DevOps to the root directory on the website.</p> <p>Any ideas how to solve this? thank you.</p>
[ { "answer_id": 74272860, "author": "Venkatesan", "author_id": 19144428, "author_profile": "https://Stackoverflow.com/users/19144428", "pm_score": 1, "selected": false, "text": " az webapp deploy --resource-group <group-name> --name <app-name> --src-path config.json --type=static\n" }...
2022/10/31
[ "https://Stackoverflow.com/questions/74263796", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17369622/" ]
74,263,797
<p>I need to generate <strong>stats</strong> from <strong>users</strong> collection in <strong>Mongodb</strong>.</p> <p><em><strong>USER schema</strong></em>:</p> <pre class="lang-json prettyprint-override"><code>{ _id: ObjectId, name: string, city: string, gender: enunm[&quot;Male&quot;, &quot;Female&quot;], } </code></pre> <p><em><strong>STATS schema</strong></em>:</p> <pre class="lang-json prettyprint-override"><code>[ { city: string, Male: number, (number of males in that $city) Female: number, (number of females in that $city) } ] </code></pre> <p><strong>What aggregation pipeline I should use?</strong></p> <p>I tried something like this:</p> <pre><code>db.testCollection.aggregate([ { $group: { _id: &quot;$status&quot;, totalQuantity: { $count: &quot;$stats&quot; } } }, ]); </code></pre>
[ { "answer_id": 74263878, "author": "Tom Slabbaert", "author_id": 10770370, "author_profile": "https://Stackoverflow.com/users/10770370", "pm_score": 2, "selected": true, "text": "$cond" }, { "answer_id": 74265484, "author": "Sergey Lobanov", "author_id": 18374576, "au...
2022/10/31
[ "https://Stackoverflow.com/questions/74263797", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18374576/" ]
74,263,806
<p>Please note i have read other answers on here but they havent worked for me (or I have applied them incorrectly, sorry if I have).</p> <p>I have a list which I have then converted to Dataframe. I have then converted to string using:</p> <pre><code>df['URL'] = pd.Series(df['URL'], dtype=&quot;string&quot;) </code></pre> <p>However, when i go to use .find, .partition I get the error:</p> <pre><code>df['URL'].find('entry/') AttributeError: 'Series' object has no attribute 'find' </code></pre> <p>string is as follows and i need to get the unique number between 'entry/' and '/event'. How can i do this?</p> <pre><code>https://fantasy.premierleague.com/entry/349289/event/14 </code></pre>
[ { "answer_id": 74263878, "author": "Tom Slabbaert", "author_id": 10770370, "author_profile": "https://Stackoverflow.com/users/10770370", "pm_score": 2, "selected": true, "text": "$cond" }, { "answer_id": 74265484, "author": "Sergey Lobanov", "author_id": 18374576, "au...
2022/10/31
[ "https://Stackoverflow.com/questions/74263806", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14748830/" ]
74,263,808
<p>I'm trying to have a button on my webiste that if you press it the background color will change to blue which i have, but i'm trying to code that if you press it again it'll change to white again.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>function myFunction() { document.body.style.backgroundColor= "lightblue"; } function my1Function() { document.body.style.backgroundColor= "lightgrey"; } function my2Function() { document.body.style.backgroundColor= "pink"; } function my3Function() { document.body.style.backgroundColor= "lightgreen"; }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;header&gt; &lt;h1&gt;&lt;/h1&gt; &lt;/header&gt; &lt;br&gt; &lt;form action="#"&gt; &lt;label for="fname"&gt;Uw naam:&lt;/label&gt; &lt;input type="text" id="fname" name="fname"&gt; &lt;input type="submit" value="Submit"&gt; &lt;/form&gt; &lt;button type="button" onclick="myFunction()"&gt;Lightblue&lt;/button&gt; &lt;button type="button" onclick="my1Function()"&gt;Lightgrey&lt;/button&gt; &lt;button type="button" onclick="my2Function()"&gt;Pink&lt;/button&gt; &lt;button type="button" onclick="my3Function()"&gt;Lightgreen&lt;/button&gt;</code></pre> </div> </div> </p> <p>I tried using alternatives such as case1, case2, case3 etc.</p>
[ { "answer_id": 74263863, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 0, "selected": false, "text": "const body = document.querySelector('body')\n\nfunction myFunction() { \n body.style.backgroundColor= \"lightblue\";\n i...
2022/10/31
[ "https://Stackoverflow.com/questions/74263808", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20379486/" ]
74,263,906
<p>I have been trying to build a react native app since the early hour of today but was getting the follwing errors:</p> <pre><code>&gt; Could not HEAD 'https://jcenter.bintray.com/com/facebook/react/react-native/maven-metadata.xml'. &gt; Read timed out </code></pre> <p>After checking out <a href="https://jcenter.bintray.com" rel="nofollow noreferrer">https://jcenter.bintray.com</a>, I found out it was down. Can anyone point me to the right option to resolve this issue? Is there any alternative since they said the site may not come back up?</p>
[ { "answer_id": 74265649, "author": "PhilippeAuriach", "author_id": 772091, "author_profile": "https://Stackoverflow.com/users/772091", "pm_score": 0, "selected": false, "text": "jcenter()" }, { "answer_id": 74267590, "author": "AmerllicA", "author_id": 6877799, "autho...
2022/10/31
[ "https://Stackoverflow.com/questions/74263906", "https://Stackoverflow.com", "https://Stackoverflow.com/users/944258/" ]
74,263,919
<p>I am looking for guidance here as I recently encountered an issue when it came to comparisons using <code>ifeq</code> on variables that originated from a top-level Makefile I have no control over, and it made me wonder if there is a way to sanitize or standardize variables so that I can consistently use the same type of comparison going forward.</p> <p>This is the problem I ran into, notice the use of <code>&quot;</code> around values.</p> <pre><code>my_target: ifeq ($(strip $(TOP_VAR_1)), &quot;VALUE&quot;) #this comparison yields true endif ifeq ($(strip $(TOP_VAR_2)), VALUE) #this comparison yields true endif </code></pre> <p>I was able to get these comparisons to work by trial and error based on <a href="https://www.gnu.org/software/make/manual/html_node/Conditional-Syntax.html" rel="nofollow noreferrer">GNU's conditional syntax guide</a>, but this took me a great amount of time to do so.</p> <p>Previous attempts include playing around with <code>strip</code> and quotation marks on variables and values, yet those still yielded a false equality.</p> <p>e.g.</p> <pre><code>my_target: ifeq ($(strip $(TOP_VAR_1)), VALUE) #this comparison yields false endif ifeq ($(strip $(TOP_VAR_2)), &quot;VALUE&quot;) #this comparison yields false endif </code></pre>
[ { "answer_id": 74265791, "author": "MadScientist", "author_id": 939557, "author_profile": "https://Stackoverflow.com/users/939557", "pm_score": 1, "selected": true, "text": "TOP_VAR_1" }, { "answer_id": 74266413, "author": "Vroomfondel", "author_id": 1819452, "author_...
2022/10/31
[ "https://Stackoverflow.com/questions/74263919", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9572648/" ]
74,263,921
<p>I need to get the rows by key (e.g. where status is &quot;Active&quot;) but with sorting on multiple columns.</p> <p>I'm using the pagination that's why I cannot sort the result after fetching it from the DynamoDB. (Just for the information, I'm using the serverless framework)</p> <p>Expected Output is array of rows sorted (ordered) by multiple columns.</p>
[ { "answer_id": 74265791, "author": "MadScientist", "author_id": 939557, "author_profile": "https://Stackoverflow.com/users/939557", "pm_score": 1, "selected": true, "text": "TOP_VAR_1" }, { "answer_id": 74266413, "author": "Vroomfondel", "author_id": 1819452, "author_...
2022/10/31
[ "https://Stackoverflow.com/questions/74263921", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15089488/" ]
74,263,972
<p>I've been trying to create an api endpoint to update my &quot;lead&quot; objects and add a list of facilities to them when sending a put request (each time a different amount of facilities). The lead objects already exist inside the database so do the facility objects. Since i need a date and time associated to each facility when they are being added to a lead i created the &quot;LeadFacilityAssign&quot; class. Since i wasn't able to get it to work i tried to do it just with a post request for now, during the lead creation process. I was told that i need to use bulk_create if i need to add more than one facility this way. I couldn't find anything on bulk_create inside the drf documentation so i decided to do this for now just with one facility and improve my code from there one issue at a time since i'm new to drf.</p> <p>Does anyone know what is causing this error? I tried a few different things but nothing worked so far.</p> <pre><code>ValueError: Cannot assign &quot;1&quot;: &quot;LeadFacilityAssign.assigned_facilities&quot; must be a &quot;Facility&quot; instance. </code></pre> <p>serializers.py</p> <pre><code>class LeadUpdateSerializer(serializers.ModelSerializer): is_owner = serializers.SerializerMethodField() assigned_facilities = serializers.IntegerField(required=True) datetime = serializers.DateTimeField(required=True) class Meta: model = Lead fields = ( &quot;id&quot;, &quot;first_name&quot;, &quot;last_name&quot;, &quot;assigned_facilities&quot;, &quot;datetime&quot;, ) read_only_fields = (&quot;id&quot;, &quot;created_at&quot;, &quot;agent&quot;, &quot;is_owner&quot;) def get_is_owner(self, obj): user = self.context[&quot;request&quot;].user return obj.agent == user def create(self, validated_data): assigned_facilities = validated_data.pop(&quot;assigned_facilities&quot;) datetime = validated_data.pop(&quot;datetime&quot;) instance = Lead.objects.create(**validated_data) instance.leadfacility.create(assigned_facilities=assigned_facilities,datetime=datetime) print(instance) return instance </code></pre> <p>models.py</p> <pre><code>class Facility(models.Model): name = models.CharField(max_length=150, null=True, blank=False) def __str__(self): return self.name class Lead(models.Model): first_name = models.CharField(max_length=40, null=True, blank=True) last_name = models.CharField(max_length=40, null=True, blank=True) def __str__(self): return f&quot;{self.first_name} {self.last_name}&quot; class LeadFacilityAssign(models.Model): assigned_facilities = models.ForeignKey(Facility, on_delete=models.CASCADE, related_name='leadfacility') lead = models.ForeignKey(Lead, on_delete=models.CASCADE, related_name='leadfacility') datetime = models.DateTimeField() </code></pre> <p>views.py</p> <pre><code>class LeadCreateView(CreateAPIView): permission_classes = [IsAuthenticated, IsLeadOwner] serializer_class = LeadUpdateSerializer def perform_create(self, serializer): serializer.save(agent=self.request.user) class LeadUpdateView(UpdateAPIView): permission_classes = [IsAuthenticated, IsLeadOwner] serializer_class = LeadUpdateSerializer def get_queryset(self): return Lead.objects.all() </code></pre>
[ { "answer_id": 74265319, "author": "Utkucan Bıyıklı", "author_id": 7437136, "author_profile": "https://Stackoverflow.com/users/7437136", "pm_score": 3, "selected": true, "text": "Integer" }, { "answer_id": 74312887, "author": "allexiusw", "author_id": 1048404, "author...
2022/10/31
[ "https://Stackoverflow.com/questions/74263972", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3530084/" ]
74,263,994
<p>I am trying to incorporate the following logic, If all rows in Col A is filled and Col B is blank(and vice versa) then copy those rows to a new sheet.</p> <p>Here is what I have so far:</p> <pre><code>Sub DataValidation() Dim rng As Range Dim cell As Range Set rng = Range(&quot;A:B&quot;) For Each cell In rng If Cel.Value = &quot;&quot; Then Sheets(&quot;List&quot;).Cel.Value.EntireRow.Copy Destination:=Sheets(&quot;test&quot;).Range(&quot;A&quot; &amp; Rows.Count).End(xlUp).Offset(1) Next cell End Sub </code></pre> <p>Can anyone help with this? I need help with 1) <code>If.Cel.Value=&quot;&quot;</code> , I dont think this identifies the logic for Col A filled and Col B is blank. 2) And I need help identifying these rows and copying to a new tab.</p> <p>Latest code:</p> <pre><code>Sub DataValidationTwo() Dim ws As Worksheet, lastR As Long, arr, rngCopy As Range, i As Long Set ws = ActiveSheet lastR = ws.Range(&quot;A&quot; &amp; ws.Rows.Count).End(xlUp).Row arr = ws.Range(&quot;AU4:AV&quot; &amp; lastR).Value2 'place the range in an array for faster iteration/processing For i = 4 To UBound(arr) '4 supposing that headers exist on the third row If (arr(i, 1) &lt;&gt; &quot;&quot; And arr(i, 2) = &quot;&quot;) Or (arr(i, 2) &lt;&gt; &quot;&quot; And arr(i, 1) = &quot;&quot;) Then addToRange rngCopy, ws.Range(&quot;A&quot; &amp; i) End If Next i If Not rngCopy Is Nothing Then rngCopy.EntireRow.Copy _ Sheets(&quot;test&quot;).Range(&quot;A&quot; &amp; Rows.Count).End(xlUp).Offset(1) MsgBox &quot;Complete&quot; End Sub </code></pre> <p>new code. It is only pasting row 4 to test. It should paste more of my test rows over.</p> <pre><code>Sub DataValidationTwo() Dim ws As Worksheet, lastR As Long, arr, rngCopy As Range, i As Long With Sheets(&quot;test&quot;) .Rows(2 &amp; &quot;:&quot; &amp; .Rows.Count).Delete End With Set ws = ActiveSheet 'Set ws = Sheets(&quot;ATP List&quot;) lastR = ws.Range(&quot;A&quot; &amp; ws.Rows.Count).End(xlUp).Row arr = ws.Range(&quot;AU4:AV&quot; &amp; lastR).Value2 'place the range in an array for faster iteration/processing For i = 4 To UBound(arr) '4 supposing that headers exist on the third row If (arr(i, 1) &lt;&gt; &quot;&quot; And arr(i, 2) = &quot;&quot;) Or (arr(i, 2) &lt;&gt; &quot;&quot; And arr(i, 1) = &quot;&quot;) Then addToRange rngCopy, ws.Range(&quot;A&quot; &amp; i) End If Next i If Not rngCopy Is Nothing Then rngCopy.EntireRow.Copy _ Sheets(&quot;test&quot;).Range(&quot;A&quot; &amp; Rows.Count).End(xlUp).Offset(1) MsgBox &quot;Complete&quot; End Sub </code></pre>
[ { "answer_id": 74264237, "author": "Lee Stevens", "author_id": 18739922, "author_profile": "https://Stackoverflow.com/users/18739922", "pm_score": 3, "selected": true, "text": "cell.value" }, { "answer_id": 74264578, "author": "FaneDuru", "author_id": 2233308, "author...
2022/10/31
[ "https://Stackoverflow.com/questions/74263994", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6346514/" ]
74,264,006
<p>I need to delete/kill an instance of a class, but it may have references in variables in some other classes. Who knows how I can make it easy?</p> <pre class="lang-py prettyprint-override"><code>is_instance_exist = True def check_vars(): try: print('var1:' + str(var1)) except: print('No var1') try: print('var2:' + str(var2)) except: print('No var2') def instance_deleted(): global is_instance_exist is_instance_exist = False def check_instance(): global is_instance_exist print(&quot;Is instance exist: &quot; + str(is_instance_exist)) class TestClass: def __init__(self, inn): self.tt = inn def __str__(self): return self.tt def change(self, inn): self.tt = inn def __del__(self): instance_deleted() # --------------------------------------- print(&quot;---1--- Create instance of class&quot;) var1 = TestClass('5') var2 = var1 check_vars() check_instance() # --------------------------------------- print(&quot;---2--- Instance connectivity check&quot;) var1.change('6') check_vars() check_instance() # --------------------------------------------------- print(&quot;---2--- Deleting var1&quot;) del var1 check_vars() check_instance() # --------------------------------------------------- print(&quot;---3--- Deleting var2&quot;) del var2 check_vars() check_instance() # --------------------------------------------------- print(&quot;---The end---&quot;) </code></pre> <h2><strong>Removing every variable is very difficult.</strong> <strong>Does anyone know how I can do this easily?</strong></h2> <p>.....................................</p>
[ { "answer_id": 74268114, "author": "Jonathon Mederios", "author_id": 20351074, "author_profile": "https://Stackoverflow.com/users/20351074", "pm_score": 1, "selected": false, "text": "memory = {}\nmemory[\"var1\"] = 1\nmemory[\"var2\"] = 2\nmemory2 = memory\nprint(memory[\"var1\"])\nprin...
2022/10/31
[ "https://Stackoverflow.com/questions/74264006", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17342447/" ]
74,264,009
<p>I have been trying multiple approaches using JOLT to convert a Json as show below:</p> <p><strong>Input</strong> :</p> <pre class="lang-json prettyprint-override"><code>[ { &quot;CarOwners&quot;: [ { &quot;Name&quot;: &quot;john&quot;, &quot;car&quot;: &quot;volvo&quot; }, { &quot;Name&quot;: &quot;john&quot;, &quot;car&quot;: &quot;Audi&quot; }, { &quot;Name&quot;: &quot;Mike&quot;, &quot;car&quot;: &quot;Audi&quot; } ] } ] </code></pre> <p><strong>Desired Output</strong> :</p> <pre class="lang-json prettyprint-override"><code>[ { &quot;CarOwners&quot;: [ { &quot;Name&quot;: &quot;john&quot;, &quot;car&quot;: [ &quot;volvo&quot;, &quot;Audi&quot; ] }, { &quot;Name&quot;: &quot;Mike&quot;, &quot;car&quot;: [&quot;Audi&quot;] } ] } ] </code></pre> <p>To put it simply, based on owner name, I need to combine the json objects &amp; make an array of car names &amp; populate multiple values inside the list when a person owns more than 1 car. Is it even possible using JOLT? Can you please give a hint if you know? Thank you.</p> <p>I tried to use shift operation but unfortunately unable to reach anywhere near the solution.</p>
[ { "answer_id": 74268114, "author": "Jonathon Mederios", "author_id": 20351074, "author_profile": "https://Stackoverflow.com/users/20351074", "pm_score": 1, "selected": false, "text": "memory = {}\nmemory[\"var1\"] = 1\nmemory[\"var2\"] = 2\nmemory2 = memory\nprint(memory[\"var1\"])\nprin...
2022/10/31
[ "https://Stackoverflow.com/questions/74264009", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20379573/" ]
74,264,012
<p>I am trying to make an application to test certain functionality that I intend to add later to my main program, but without the risk of breaking my main program.</p> <p>I'm new to Pascal, and I still don't understand how many things work.</p> <p>The objective of this program is, through a PowerShell command executed in the same application, to obtain several JSON, each one from a specific directory to go through them and check certain things.</p> <p>These things can be the presence of specific file extensions in certain directories, or the presence of a large volume of information in them.</p> <p>Create 3 objects in Delphi for this application. A button to start the program, a Timer and a JvCreateProcess.</p> <p>The interval property of the timer is 10 (ms). The <code>onTimer</code> property is the <code>Timer1Timer</code> method.</p> <p><code>Timer1Timer</code> code:</p> <pre><code>procedure TUProbando.Timer1Timer(Sender: TObject); var Comando: TStrings; ValorJSON: TStrings; begin if ContadorDirectorios = Length(rutas) then begin Timer1.Enabled := false; exit; end; Timer1.Enabled := false; Lista.Clear; // spacer to improve visibilitys memo_Salida_Command_gci.Lines.Add('******* ' + rutas[ContadorDirectorios] + ' *******'); Comando := TStringList.Create; try // Open Powershell Comando.Add('C:\Windows\System32\WindowsPowerShell\v1.0\PowerShell.exe &quot;'); // I add the command line to create a JSON with the contents of the specified directory Comando.Add('&quot;gci ' + rutas[ContadorDirectorios] + ' -Recurse | ConvertTo-Json&quot;'); // I add the command line to the process JvCreateProcess1.CommandLine := Comando.Text; // I run the process JvCreateProcess1.run; ValorJSON := JvCreateProcess1.ConsoleOutput; finally begin Comando.Free; end; end; end; </code></pre> <p>The <code>rutas[]</code> array is a String array containing the directories to check.</p> <pre><code>rutas: array [0 .. 2] of String = ('C:\Users\operario43\Desktop', 'C:\Users\operario43\Documents', 'C:\Users\operario43\Pictures'); </code></pre> <p>Now, <code>JvCreateProcess1</code> code:</p> <pre><code>procedure TUProbando.JvCreateProcess1Terminate(Sender: TObject; ExitCode: Cardinal); begin // Calculate the size of the current directory // I WANT GET JSON OF PREVIOUS POWER SHELL COMMAND HERE SizeDirectory := GetSizeFromJson('JSON HERE', Extensiones); if checkSizeDirectory(SizeDirectory, SizeControlDirectory) then begin ShowMessage('This Directory' + rutas[ContadorDirectorios] + ' has important files not protected by a backup'); end; // +1 counter of directories traversed inc(ContadorDirectorios); end; </code></pre> <p>Other methods that I use:</p> <pre><code>function GetSizeFromJson(JSON: String; vExtensiones: array of string): integer; var Contenedor: TJSONArray; Jfichero: TJSONObject; JNombre: TJSONValue; // value of the 'length' element of each element of the JSON JSizeFile: TJSONNumber; // I: integer; SizeDirectory: Int64; begin SizeDirectory := 0; result := -1; try Contenedor := TJSONObject.ParseJSONValue(JSON) as TJSONArray; if Contenedor = nil then begin ShowMessage('Error al parsear el json' + JSON); exit; end; for I := 0 to Contenedor.Count - 1 do begin Jfichero := Contenedor.Items[I] as TJSONObject; if Jfichero &lt;&gt; nil then begin // I extract the name of the element JNombre := Jfichero.GetValue('Name'); // If the extensions of the files in the directory are in the 'Extensions' array if MatchStr(ExtractFileExt(JNombre.Value), vExtensiones) then begin // get the value of the lenght element in bytes JSizeFile := Jfichero.GetValue('Length') as TJSONNumber; if JSizeFile &lt;&gt; nil then begin // I add the value of 'leght' of the element to the variable SizeDirectory inc(SizeDirectory, JSizeFile.AsInt); end; // if JSizeFile &lt;&gt; nil end; // if MatchStr(ExtractFileExt(JNombre.Value), vExtensiones) end; // if Jfichero &lt;&gt; nil end; // for I := 0 to Contenedor.Count - 1 // I return the value of the size of the directory result := SizeDirectory; except on E: Exception do ShowMessage(E.Message); end; end; // method to find out if the size of the current directory exceeds the recommended size for directories in the variable called SizeControlDirectory function checkSizeDirectory(vSizeDirectory, vSizeControlDirectory : Int64): Boolean; var Contenedor: TJSONArray; begin result := false; vSizeDirectory := GetSizeFromJson(Contenedor.ToString, Extensiones); if vSizeDirectory &gt; vSizeControlDirectory then begin ShowMessage('Directory ' + rutas[ContadorDirectorios] + ' have files don't protected by Backup'); end; end; </code></pre> <p>My question is, how do I get JSON for JvCreateProcess1Terminate method?.</p> <p>I've made a lot of changes trying to get it to work, and made small pieces of code to make it more manageable.</p>
[ { "answer_id": 74264178, "author": "Jens", "author_id": 10388596, "author_profile": "https://Stackoverflow.com/users/10388596", "pm_score": -1, "selected": false, "text": "procedure TForm2.JvImgBtn6Click(Sender: TObject);\nvar\n path : String;\nbegin\n try\n path := ExtractFilePath(...
2022/10/31
[ "https://Stackoverflow.com/questions/74264012", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20053848/" ]
74,264,023
<p>I have been trying to reshape a numpy array by using not more than one loop or even better no loop at all. But after several trials with np.reshape() and np.transpose(), I still do not have a clue how to transform an array like this:</p> <pre><code>array([[1,2,6,3,2,5], [9,4,7,3,2,6], [8,4,6,3,2,6], [9,5,0,4,5,2], [0,5,2,6,4,2], [8,6,2,5,7,4]]) </code></pre> <p>into an array like this:</p> <pre><code>[[1,2,9,4,8,4,0,5,8,6], [6,3,7,3,6,3,0,4,2,6,2,5], [2,5,2,6,2,6,5,2,4,2,7,4]] </code></pre> <p>I see the pattern is,</p> <pre><code># original [[x11, x12, x13, x14, x15, x16], [x21, x22, x23, x24, x25, x26], [x31, x32, x33, x34, x35, x36], [x41, x42, x43, x44, x45, x46], [x51, x52, x53, x54, x55, x56], [x61, x62, x63, x64, x65, x66]] # result [[x11, x12, x21, x22, x31, x32, x41, x42, x51, x52, x61, x62], [x13, x14, x23, x23, x33, x34, x43, x44, x53, x54, x63, x64], [x15, x16, x25, x26, x35, x36, x45, x46, x55, x56, x65, x66]] </code></pre> <p>but my biggest problem is to connect to rows like shown above, especially by using vectorization instead of loops. But I was not even able to do it with one Loop. I needed two.</p> <p>As I said, I tried many things. For example, I reshaped the original array to</p> <pre><code>[[1,2] [6,3], [2,5], [9,4], [7,3], [2,6] [8,4], [6,3], [2,6] [9,5], [0,4], [5,2], [0,5], [2,6], [4,2], [8,6], [2,5], [7,4]] </code></pre> <p>From there I had no clue how to work with the rows to get the desired array.</p> <p>I also tried to instantly reshape the array to match the desired shape, but then I also struggled to make the values match my desired result.</p>
[ { "answer_id": 74264178, "author": "Jens", "author_id": 10388596, "author_profile": "https://Stackoverflow.com/users/10388596", "pm_score": -1, "selected": false, "text": "procedure TForm2.JvImgBtn6Click(Sender: TObject);\nvar\n path : String;\nbegin\n try\n path := ExtractFilePath(...
2022/10/31
[ "https://Stackoverflow.com/questions/74264023", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20379331/" ]
74,264,040
<p>Good Day! I have a simple table with filter functionality in react. The table contains only car <code>name</code> and <code>price</code> with dropdown select for filtering cars with their name. I need to display the total price of filtered cars. here is the <a href="https://codesandbox.io/s/quiet-hooks-vetmx4?file=/src/App.js" rel="nofollow noreferrer">sandbox</a> .</p> <p>What I tried was defining a function like this</p> <pre><code>const updateSubTotal = () =&gt; { var table = document.getElementById(&quot;myTable&quot;); let subTotal = Array.from(table.rows) .slice(1) .reduce((total, row) =&gt; { return total + parseFloat(row.cells[1].innerHTML); }, 0); setTot(subTotal); }; </code></pre> <p>Unfortunately, this function returns invalid value. Here is the whole code</p> <pre><code>import { useState } from &quot;react&quot;; import &quot;./styles.css&quot;; const data = [ { name: &quot;Saab&quot;, price: 100 }, { name: &quot;Mercedes&quot;, price: 50 }, { name: &quot;Audi&quot;, price: 10 } ]; export default function App() { const [tot, setTot] = useState(); const updateSubTotal = () =&gt; { var table = document.getElementById(&quot;myTable&quot;); let subTotal = Array.from(table.rows) .slice(1) .reduce((total, row) =&gt; { return total + parseFloat(row.cells[1].innerHTML); }, 0); setTot(subTotal); }; //CALCULATE sum of prices const totalPrice = data.map((item) =&gt; item.price).reduce((a, b) =&gt; a + b, 0); const [searchValue, setSearchValue] = useState(&quot;&quot;); const DisplayData = data ?.filter((row) =&gt; row?.name?.match(new RegExp(searchValue, &quot;i&quot;))) .map((cars) =&gt; { return ( &lt;tr key={cars.name}&gt; &lt;td&gt;{cars?.name}&lt;/td&gt; &lt;td&gt;{cars?.price}&lt;/td&gt; &lt;/tr&gt; ); }); return ( &lt;div className=&quot;App&quot;&gt; &lt;label for=&quot;cars&quot;&gt;Choose a car:&lt;/label&gt; &lt;select name=&quot;cars&quot; id=&quot;cars&quot; value={searchValue} onChange={(e) =&gt; { setSearchValue(e.target.value); updateSubTotal(); }} &gt; &lt;option value=&quot;saab&quot;&gt;Saab&lt;/option&gt; &lt;option value=&quot;mercedes&quot;&gt;Mercedes&lt;/option&gt; &lt;option value=&quot;audi&quot;&gt;Audi&lt;/option&gt; &lt;/select&gt; &lt;table className=&quot;tables&quot; id=&quot;myTable&quot;&gt; &lt;thead className=&quot;sticky-header overflow-hidden z-50&quot;&gt; &lt;tr&gt; &lt;th className=&quot;&quot;&gt;Car Name&lt;/th&gt; &lt;th className=&quot;&quot;&gt;Price&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody&gt;{DisplayData}&lt;/tbody&gt; &lt;/table&gt; &lt;div&gt;Total Price without filter: {totalPrice}&lt;/div&gt; &lt;div&gt;Total Price after filter: {tot}&lt;/div&gt; &lt;/div&gt; ); } </code></pre>
[ { "answer_id": 74264512, "author": "msabic22", "author_id": 8925990, "author_profile": "https://Stackoverflow.com/users/8925990", "pm_score": 3, "selected": true, "text": " const [searchValue, setSearchValue] = useState(dropdownItems[0]);\n const [filteredData, setFilteredData] = useSt...
2022/10/31
[ "https://Stackoverflow.com/questions/74264040", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12499550/" ]
74,264,068
<p>In the documentation on Hilt, it shows this example of injecting a viewmodel into an activity:</p> <pre class="lang-kotlin prettyprint-override"><code>@HiltViewModel class ExampleViewModel @Inject constructor( private val savedStateHandle: SavedStateHandle, private val repository: ExampleRepository ) : ViewModel() { ... } </code></pre> <pre class="lang-kotlin prettyprint-override"><code>@AndroidEntryPoint class ExampleActivity : AppCompatActivity() { private val exampleViewModel: ExampleViewModel by viewModels() ... } </code></pre> <p>But what if ExampleRepository itself has a constructor that requires parameters? How would the code in the activity be different? How do you tell Hilt what parameters to pass to Repository?</p>
[ { "answer_id": 74264177, "author": "Islam Assem", "author_id": 7872110, "author_profile": "https://Stackoverflow.com/users/7872110", "pm_score": 2, "selected": true, "text": "@Module\n@InstallIn(SingletonComponent::class)\nobject NetworkModule {\n @Provides\n fun provideOkHttpClien...
2022/10/31
[ "https://Stackoverflow.com/questions/74264068", "https://Stackoverflow.com", "https://Stackoverflow.com/users/753632/" ]
74,264,140
<p>I have a dataset in which some columns have lookup values. There are several such columns in the dataset. I need to expand these columns so that the column name consists of the name of the column itself and the keys in the dict.</p> <p>Example df:</p> <pre><code>df col1 col2 col3 a '{key_1: 1a, key_2: 2a}' '{key_3: 1a, key_4: 2a}' b '{key_1: 1b, key_2: 2b}' '{key_3: 1a, key_4: 2a}' c '{key_1: 1c, key_2: 2c}' '{key_3: 1a, key_4: 2a}' </code></pre> <p>Desired result:</p> <pre><code>df_res col1 col2_key_1 col2_key_2 col3_key_3 col3_key_4 a 1a 2a 1a 2a b 1b 2b 1a 2a c 1c 2c 1a 2a </code></pre> <p>How can I do that?</p>
[ { "answer_id": 74264326, "author": "Gonçalo Peres", "author_id": 7109869, "author_profile": "https://Stackoverflow.com/users/7109869", "pm_score": 0, "selected": false, "text": "df_new = pd.DataFrame(data = [\n [row['col1'],\n row['col2'].split(':')[1].split(',')[0].strip(),\n r...
2022/10/31
[ "https://Stackoverflow.com/questions/74264140", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14744714/" ]
74,264,146
<p>I wanted to read my CSV file first. <a href="https://github.com/hamzaal014/file/blob/main/file.csv" rel="nofollow noreferrer">https://github.com/hamzaal014/file/blob/main/file.csv</a></p> <p>the .csv file contains two columns X and Y here is my script:</p> <pre><code>import numpy as np from pandas import DataFrame as df import csv origin_data = open(&quot;file.csv&quot;, &quot;r&quot;) dato = list(csv.reader(origin_data, delimiter=&quot;,&quot;)) print(dato) rowcount = 0 #iterating through the whole file for row in dato: rowcount+= 1 #printing the result #_ print(&quot;Number of lines present:-&quot;, rowcount) print(rowcount) dati = df(dato, columns=['x', 'y']) window = 6 roll_avg = dati.rolling(window).mean() roll_avg_cumulative = dati['y'].cumsum()/np.arange(1, 25) print(roll_avg_cumulative) </code></pre> <p>but my script is not working ???</p> <p>Error --------------------------------------------------------------------</p> <pre><code>Traceback (most recent call last): File &quot;/home/haz/miniconda39/lib/python3.9/site-packages/pandas/core/ops/array_ops.py&quot;, line 163, in _na_arithmetic_op result = func(left, right) File &quot;/home/haz/miniconda39/lib/python3.9/site-packages/pandas/core/computation/expressions.py&quot;, line 239, in evaluate return _evaluate(op, op_str, a, b) # type: ignore[misc] File &quot;/home/haz/miniconda39/lib/python3.9/site-packages/pandas/core/computation/expressions.py&quot;, line 128, in _evaluate_numexpr result = _evaluate_standard(op, op_str, a, b) File &quot;/home/haz/miniconda39/lib/python3.9/site-packages/pandas/core/computation/expressions.py&quot;, line 69, in _evaluate_standard return op(a, b) TypeError: unsupported operand type(s) for /: 'str' and 'int' </code></pre>
[ { "answer_id": 74264326, "author": "Gonçalo Peres", "author_id": 7109869, "author_profile": "https://Stackoverflow.com/users/7109869", "pm_score": 0, "selected": false, "text": "df_new = pd.DataFrame(data = [\n [row['col1'],\n row['col2'].split(':')[1].split(',')[0].strip(),\n r...
2022/10/31
[ "https://Stackoverflow.com/questions/74264146", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12146102/" ]
74,264,151
<pre><code>CREATE TABLE TABLE_ONE ( person varchar(5), COL_1 varchar(20), COL_2 varchar(20), value int, row_num int ); INSERT INTO table_one VALUES ('101','A','ABC',10,1) ('101','A','ABC',20,2) ('101','A','ABC',12,6) ('101','A','ABC',10,8) ('101','A','ABC',20,9) ('101','A','ABC',15,10) ('101','A','ABC',10,12) ('101','B','ABC',1,1) ('101','B','ABC',4,2) ('101','B','ABC',2,3) ('101','B','ABC',1,10) ('101','B','ABC',3,11) ('101','B','ABC',4,15) ('101','B','ABC',4,16) </code></pre> <p>Need to add column 'value' based on consective row_num. If the values are consective in row_num then we add the values and assign the highest row_num value. For example, row_num = 1 and row_num = 2 are consecutive, so we add the values and we get 30 as the value.</p> <p>Output Screenshot</p> <p><a href="https://i.stack.imgur.com/UYn78.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UYn78.png" alt="enter image description here" /></a></p>
[ { "answer_id": 74264450, "author": "Zhorov", "author_id": 6578080, "author_profile": "https://Stackoverflow.com/users/6578080", "pm_score": 2, "selected": false, "text": "value" }, { "answer_id": 74267170, "author": "Lukasz Szozda", "author_id": 5070879, "author_profi...
2022/10/31
[ "https://Stackoverflow.com/questions/74264151", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11455017/" ]
74,264,158
<p>I'm currently using fontawesome in my project and I have a checklist for the user.</p> <p>When the user marks one step as checked it's just for them and doesn't get saved anywhere.</p> <p><strong>What I'd like to have</strong> (edited in the browser for demonstration):</p> <p><a href="https://i.stack.imgur.com/6RpAw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6RpAw.png" alt="enter image description here" /></a></p> <p>getting the checked element to be styled differently is already solved. I'm having issue with swapping the icon from my Fontawesome Component.</p> <p><strong>Code:</strong></p> <pre><code>&lt;ul className=&quot;ingredient-list&quot;&gt; {doc.ingredients &amp;&amp; doc.ingredients.map((ing, index) =&gt; ( &lt;li key={index} onClick={strike}&gt; &lt;FontAwesomeIcon icon={faSquare} className=&quot;icon&quot; /&gt; &lt;span className=&quot;blocked&quot;&gt;{ing}&lt;/span&gt; &lt;/li&gt; ))} &lt;/ul&gt; </code></pre> <p>the function strike looks something like this and only styles the li element including the childs.</p> <pre><code>const strike = (e) =&gt; { e.target.closest('li').classList.toggle('strike') } </code></pre> <p>when printing the child to the console I'm unable to get the FontAwesomeIcon Component since it already rendered in the frontend to SVG.</p> <p>I'm not sure, is there a way to actually manipulating the <code>&lt;FontAwesomeIcon icon={} /&gt;</code> within the strike function?</p> <p><a href="https://i.stack.imgur.com/aG9Mc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/aG9Mc.png" alt="enter image description here" /></a></p> <p>Complete Rendered Code in the Frontend:</p> <pre><code>&lt;div class=&quot;col&quot;&gt; &lt;h3&gt;Zutaten&lt;/h3&gt; &lt;ul class=&quot;ingredient-list&quot;&gt; &lt;li&gt; &lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; data-prefix=&quot;far&quot; data-icon=&quot;square&quot; class=&quot;svg-inline--fa fa-square icon&quot; role=&quot;img&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot; viewBox=&quot;0 0 448 512&quot;&gt; &lt;path fill=&quot;currentColor&quot; d=&quot;M384 32C419.3 32 448 60.65 448 96V416C448 451.3 419.3 480 384 480H64C28.65 480 0 451.3 0 416V96C0 60.65 28.65 32 64 32H384zM384 80H64C55.16 80 48 87.16 48 96V416C48 424.8 55.16 432 64 432H384C392.8 432 400 424.8 400 416V96C400 87.16 392.8 80 384 80z&quot; &gt;&lt;/path&gt; &lt;/svg&gt; &lt;span class=&quot;blocked&quot;&gt;element 1&lt;/span&gt; &lt;/li&gt; &lt;li&gt; &lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; data-prefix=&quot;far&quot; data-icon=&quot;square&quot; class=&quot;svg-inline--fa fa-square icon&quot; role=&quot;img&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot; viewBox=&quot;0 0 448 512&quot;&gt; &lt;path fill=&quot;currentColor&quot; d=&quot;M384 32C419.3 32 448 60.65 448 96V416C448 451.3 419.3 480 384 480H64C28.65 480 0 451.3 0 416V96C0 60.65 28.65 32 64 32H384zM384 80H64C55.16 80 48 87.16 48 96V416C48 424.8 55.16 432 64 432H384C392.8 432 400 424.8 400 416V96C400 87.16 392.8 80 384 80z&quot; &gt;&lt;/path&gt; &lt;/svg&gt; &lt;span class=&quot;blocked&quot;&gt;element 2&lt;/span&gt; &lt;/li&gt; &lt;li&gt; &lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; data-prefix=&quot;far&quot; data-icon=&quot;square&quot; class=&quot;svg-inline--fa fa-square icon&quot; role=&quot;img&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot; viewBox=&quot;0 0 448 512&quot;&gt; &lt;path fill=&quot;currentColor&quot; d=&quot;M384 32C419.3 32 448 60.65 448 96V416C448 451.3 419.3 480 384 480H64C28.65 480 0 451.3 0 416V96C0 60.65 28.65 32 64 32H384zM384 80H64C55.16 80 48 87.16 48 96V416C48 424.8 55.16 432 64 432H384C392.8 432 400 424.8 400 416V96C400 87.16 392.8 80 384 80z&quot; &gt;&lt;/path&gt; &lt;/svg&gt; &lt;span class=&quot;blocked&quot;&gt;element 3&lt;/span&gt; &lt;/li&gt; &lt;li&gt; &lt;svg aria-hidden=&quot;true&quot; focusable=&quot;false&quot; data-prefix=&quot;far&quot; data-icon=&quot;square&quot; class=&quot;svg-inline--fa fa-square icon&quot; role=&quot;img&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot; viewBox=&quot;0 0 448 512&quot;&gt; &lt;path fill=&quot;currentColor&quot; d=&quot;M384 32C419.3 32 448 60.65 448 96V416C448 451.3 419.3 480 384 480H64C28.65 480 0 451.3 0 416V96C0 60.65 28.65 32 64 32H384zM384 80H64C55.16 80 48 87.16 48 96V416C48 424.8 55.16 432 64 432H384C392.8 432 400 424.8 400 416V96C400 87.16 392.8 80 384 80z&quot; &gt;&lt;/path&gt; &lt;/svg&gt; &lt;span class=&quot;blocked&quot;&gt;element 4&lt;/span&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; </code></pre>
[ { "answer_id": 74301365, "author": "Matthias", "author_id": 5272567, "author_profile": "https://Stackoverflow.com/users/5272567", "pm_score": 2, "selected": true, "text": "<ul className=\"ingredient-list\">\n {doc.ingredients && doc.ingredients.map((ing, index) => (\n <li key={index}...
2022/10/31
[ "https://Stackoverflow.com/questions/74264158", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1716585/" ]
74,264,191
<p>I figured I'd post here to get some ideas/feedback on something I've come up against recently. The API I've developed has validation on an identifier that's passed through as a path parameter: e.g. /resource/resource_identifier</p> <p>There are some specific business rules as to what makes an idenfier valid and my API has validation which enforces these rules and returns a 400 when that's violated.</p> <p>Now the reason I'm writing this is that I've been doing this sort of thing in every REST (ish) API I've ever written. It's kind of ingrained in me now but ecently I've been told that this is 'bad' and that it breaks encapsulation. Furthermore, it does this by forcing a consumer to have knowledge about the format of an identifier. I'm told that I should be returning a 404 instead and simply accept anything as an idenfier.</p> <p>We've had some pretty heated debates about this and what encapsulation actually means in the context of REST. I've found numerous definitions but they aren't specific. As with any REST contention it's hard to substantiate an argument for either.</p> <p>If StackOverflow would allow me, I'd like to try and gain a concensus on this and why APIs like Spotify for example, use 400 in this scenario.</p>
[ { "answer_id": 74264918, "author": "Roman Vottner", "author_id": 1377895, "author_profile": "https://Stackoverflow.com/users/1377895", "pm_score": 1, "selected": false, "text": "domain application protocol" }, { "answer_id": 74296571, "author": "inf3rno", "author_id": 607...
2022/10/31
[ "https://Stackoverflow.com/questions/74264191", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5776362/" ]
74,264,195
<p>For example - add animate-ping upon new message from a web-socket.</p>
[ { "answer_id": 74264918, "author": "Roman Vottner", "author_id": 1377895, "author_profile": "https://Stackoverflow.com/users/1377895", "pm_score": 1, "selected": false, "text": "domain application protocol" }, { "answer_id": 74296571, "author": "inf3rno", "author_id": 607...
2022/10/31
[ "https://Stackoverflow.com/questions/74264195", "https://Stackoverflow.com", "https://Stackoverflow.com/users/61628/" ]
74,264,216
<p>how would this be done? I did it with def, but is there a simpler way to do it without def, lambda, enumerate and whatnot?</p> <pre><code>def is_one_away(first: str, other: str) -&gt; bool: skip_difference = { -1: lambda i: (i, i+1), 1: lambda i: (i+1, i), 0: lambda i: (i+1, i+1), } try: skip = skip_difference[len(first) - len(other)] except KeyError: return False for i, (l1, l2) in enumerate(zip(first, other)): if l1 != l2: i -= 1 break remain_first, remain_other = skip(i + 1) return first[remain_first:] == other[remain_other:] </code></pre>
[ { "answer_id": 74264375, "author": "John Coleman", "author_id": 4996248, "author_profile": "https://Stackoverflow.com/users/4996248", "pm_score": 2, "selected": false, "text": "def is_one_away(first,other):\n return len(first) == len(other) and sum(x != y for x,y in zip(first,other)) ...
2022/10/31
[ "https://Stackoverflow.com/questions/74264216", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20379708/" ]
74,264,225
<p>I am started using automapper in my simple project. I want to exactly following 'one-to-many-to-many' mapping :-</p> <pre><code>public class AppUser { public int Id { get; set; } public string UniversityName { get; set; } public ICollection&lt;Post&gt; Posts { get; set; } } public class Post { public int Id { get; set; } public string Description { get; set; } public int AppUserId { get; set; } public AppUser AppUser { get; set; } public ICollection&lt;Postedpic&gt; Postedpics { get; set; } } public class Postedpic { public int Id { get; set; } public string Url { get; set; } public string PublicId { get; set; } public Post Post { get; set; } public int PostId { get; set; } } </code></pre> <p>Destination:</p> <pre><code> public class MemberDto { public int Id { get; set; } public string UniversityName { get; set; } public ICollection&lt;PostDto&gt; Posts { get; set; } } public class PostDto { public int Id { get; set; } public string Description { get; set; } public ICollection&lt;PostedpicDto&gt; Postedpics { get; set; } } public class PostedpicDto { public int Id { get; set; } public string Url { get; set; } public bool IsMain { get; set; } } </code></pre> <p>For proceed with automapper I tried this:-</p> <pre><code> CreateMap&lt;AppUser, MemberDto&gt;() .ForMember(dest=&gt;dest.Posts,opt=&gt;opt.MapFrom(src=&gt;src.Posts.Select(x=&gt;x.Description))) .ForMember(dest=&gt;dest.Posts,opt=&gt;opt.MapFrom(src=&gt;src.Posts.Include(x=&gt;x.Postedpic).Select(x=&gt;x.Postedpic.Url))) .ForMember(dest=&gt;dest.Posts,opt=&gt;opt.MapFrom(src=&gt;src.Posts.Include(x =&gt; x.Postedpic).Select(x=&gt;x.Postedpic.PublicId))); </code></pre> <p>But I found this error:- <a href="https://i.stack.imgur.com/oqY6J.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oqY6J.png" alt="enter image description here" /></a></p> <p>Also I don't understand my approach is right or wrong for proceeding automapper.</p>
[ { "answer_id": 74264549, "author": "Morten Bork", "author_id": 7936642, "author_profile": "https://Stackoverflow.com/users/7936642", "pm_score": 0, "selected": false, "text": "public interface IMemberDtoCreator {\n int GetId();\n string GetUniversityName();\n ICollection<PostDto...
2022/10/31
[ "https://Stackoverflow.com/questions/74264225", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19902391/" ]
74,264,226
<p>I have a rows of vectors in a single in the tibble dataframe and I have a set of filtered words. I want to filter the rows if the characters inside the vectors did not appear inside the filtered set. Eg. Based on the given table, only <strong>row 1, 3 and 4</strong> should be retained. I tried using the filter function but because vectors return True True, it seems to be filtered away and does not remain inside the data table. Is there any function I could use to check for words inside a list based on another list?</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>tags</th> </tr> </thead> <tbody> <tr> <td>c(&quot;hello&quot;, &quot;hi&quot;)</td> </tr> <tr> <td>c(&quot;blanks&quot;, &quot;nothing&quot;)</td> </tr> <tr> <td>c(&quot;thanks&quot;, &quot;welcome&quot;)</td> </tr> <tr> <td>hi</td> </tr> </tbody> </table> </div> <pre class="lang-r prettyprint-override"><code>filtered_words &lt;- c(&quot;hi&quot;,&quot;bye&quot;,&quot;thanks&quot;) </code></pre>
[ { "answer_id": 74264549, "author": "Morten Bork", "author_id": 7936642, "author_profile": "https://Stackoverflow.com/users/7936642", "pm_score": 0, "selected": false, "text": "public interface IMemberDtoCreator {\n int GetId();\n string GetUniversityName();\n ICollection<PostDto...
2022/10/31
[ "https://Stackoverflow.com/questions/74264226", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6077415/" ]
74,264,234
<p>Finally found an anchor code that puts a clickable URL where I want it, however the onclick of the radio buttons writes the URL for each click.</p> <p>I need the URL to replace / reset the previous selection on each radio click so only 1 URL is ever showing - i will eventually have about 30 radio buttons - each will produce a different URL.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>var roomNo = "" var phoneNo = "" var guestPin = "" var roomLink = "" var createLinkNode1 = "" var createLinkNode2 = "" var link369 = 'https://join.meet.video.justice.gov.uk/'; var link453 = 'https://join.meet.video.justice.gov.uk/'; function H369() { document.getElementById("roomNo").innerHTML = "CVP Room: " + "HMCTS369"; document.getElementById("phoneNo").innerHTML = "Telephone Number: " + "02920 "; document.getElementById("guestPin").innerHTML = "Guest Pin Number: " + "4444"; document.getElementById("roomLink").innerHTML = "&lt;b&gt;" + "Full Clickable URL Link: " + "&lt;/b&gt;"; createLinkNode1(link369, document.body); function createLinkNode1(url, parent) { const linkTextNode = document.createTextNode(url); const linkNode = document.createElement('a'); linkNode.href = url; linkNode.appendChild(linkTextNode); parent.appendChild(linkNode); } } function H453() { document.getElementById("roomNo").innerHTML = "CVP Room: " + "HMCTS453"; document.getElementById("phoneNo").innerHTML = "Telephone Number: " + "02920"; document.getElementById("guestPin").innerHTML = "Guest Pin Number: " + "5555"; document.getElementById("roomLink").innerHTML = "&lt;b&gt;" + "Full Clickable URL Link: " + "&lt;/b&gt;"; createLinkNode2(link453, document.body); function createLinkNode2(url, parent) { const linkTextNode = document.createTextNode(url); const linkNode = document.createElement('a'); linkNode.href = url; linkNode.appendChild(linkTextNode); parent.appendChild(linkNode); } }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;html&gt; &lt;body&gt; &lt;input type="radio" name="CVPRoom" onclick = "H369()"&gt;HMCTS369&lt;/br&gt; &lt;input type="radio" name="CVPRoom" onclick = "H453()"&gt;HMCTS453&lt;/br&gt; &lt;p id="demo"&gt;&lt;/p&gt; &lt;p id="demo2"&gt;&lt;/p&gt; &lt;p id="demo3"&gt;&lt;/p&gt; &lt;div id="roomNo"&gt;&lt;/div&gt; &lt;div id="phoneNo"&gt;&lt;/div&gt; &lt;div id="guestPin"&gt;&lt;/div&gt; &lt;div id="roomLink"&gt;&lt;/div&gt; &lt;script src="CVPScripts.js"&gt; &lt;/script&gt; &lt;/body&gt; &lt;/html&gt;</code></pre> </div> </div> </p> <p>I had it working on my previous code version, but the anchor would put the URL at the bottom of the HTML so was useless - stupidly overwrote the code so no example to demo</p>
[ { "answer_id": 74264409, "author": "mplungjan", "author_id": 295783, "author_profile": "https://Stackoverflow.com/users/295783", "pm_score": 0, "selected": false, "text": "const radioContainer = document.getElementById(\"radioContainer\");\nconst linkBase = 'https://join.meet.video.justi...
2022/10/31
[ "https://Stackoverflow.com/questions/74264234", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20379736/" ]
74,264,278
<p>Because I received help from an earlier post, I was able to get a code that does correctly:</p> <pre><code>select * from ( select e.employeename, s.skilldescription, count(*) over(partition by e.employeeid) as count from employeeskills_t k inner join employee_t e on k.employeeid = e.employeeid inner join skill_t s on k.skillid=s.skillid ) t where count&gt; 1 order by employeename, skilldescription </code></pre> <p>But it generates an extra column, <code>count</code>, which I don't need.</p> <p>I don't understand SQL that well, so I dont know if a command exists.</p>
[ { "answer_id": 74264412, "author": "trillion", "author_id": 12513693, "author_profile": "https://Stackoverflow.com/users/12513693", "pm_score": 0, "selected": false, "text": "group by" }, { "answer_id": 74264505, "author": "sankar", "author_id": 4017098, "author_profi...
2022/10/31
[ "https://Stackoverflow.com/questions/74264278", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20371110/" ]
74,264,286
<p>I have a tibble called <code>ehp30</code> with 13 columns which correspond to the answers of a questionnaire (11 columns) by patients at a certain followup timepoint. First row is (with fake data):</p> <pre><code> Pat_TNO AssNo eSocialEvents eJobsAtHome eStandingUp eSittingDown eWalking eExercise eAppetite eSleep eHadToLieDown eUnableToDo eUnableToCope &lt;dbl&gt; &lt;fct&gt; &lt;fct&gt; &lt;fct&gt; &lt;fct&gt; &lt;fct&gt; &lt;fct&gt; &lt;fct&gt; &lt;fct&gt; &lt;fct&gt; &lt;fct&gt; &lt;fct&gt; &lt;fct&gt; 1 1234 baseline Often Often Sometimes Sometimes Sometimes Often Sometimes Often Often Often Sometimes </code></pre> <p>I want to mutate a new column on the end called 'pain' which is the sum of the values from the 11 columns between <code>eSocialEvents</code> and <code>eUnableToCope</code>. The levels are:</p> <pre><code> &quot;Never&quot; &quot;Rarely&quot; &quot;Sometimes&quot; &quot;Often&quot; &quot;Always&quot; </code></pre> <p>which are effectively numbered 1-5, so the sum of the first row should be 39.</p>
[ { "answer_id": 74264374, "author": "Maël", "author_id": 13460602, "author_profile": "https://Stackoverflow.com/users/13460602", "pm_score": 1, "selected": false, "text": "numeric" }, { "answer_id": 74264442, "author": "MrFlick", "author_id": 2372064, "author_profile":...
2022/10/31
[ "https://Stackoverflow.com/questions/74264286", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19414769/" ]
74,264,287
<p>i have a array like this</p> <pre><code>$names = [a,b,c,d,e,f,g,h,i,j,k,l,m]; </code></pre> <p>what i wan to remove</p> <pre><code>$remove = &quot;b,c,e,f,h,i,k,l&quot;; </code></pre> <p>then i need a new array from the remaining elements like below</p> <pre><code>$new_arr = [a,d,g,j,m]; </code></pre>
[ { "answer_id": 74264374, "author": "Maël", "author_id": 13460602, "author_profile": "https://Stackoverflow.com/users/13460602", "pm_score": 1, "selected": false, "text": "numeric" }, { "answer_id": 74264442, "author": "MrFlick", "author_id": 2372064, "author_profile":...
2022/10/31
[ "https://Stackoverflow.com/questions/74264287", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15394858/" ]
74,264,295
<p>I want to design a data warehouse (Data MART) with one fact table and 2 dimensional tables, where the data mart takes some Slowly Changing Dimensions into consideration, with surrogate key. I'm wondering how I can model this so that data insertion to the dimensional tables can be made independent (inserted before fact table row exist) of the fact table. The data will be streamed from PubSub to BigQuery via Dataflow, thus some of the dimensional data might arrive earlier, needing to be inserted into the dimensional table before the fact data.</p>
[ { "answer_id": 74264374, "author": "Maël", "author_id": 13460602, "author_profile": "https://Stackoverflow.com/users/13460602", "pm_score": 1, "selected": false, "text": "numeric" }, { "answer_id": 74264442, "author": "MrFlick", "author_id": 2372064, "author_profile":...
2022/10/31
[ "https://Stackoverflow.com/questions/74264295", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9751975/" ]
74,264,322
<p>I have a pie chart in excel file which I created with Openpyxl.</p> <p><a href="https://i.stack.imgur.com/joi29.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/joi29.png" alt="Pie Chart Created" /></a></p> <p>Is there a way to add percentages to every element in the pie chart like the below image for example?</p> <p><a href="https://i.stack.imgur.com/cXmk8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cXmk8.png" alt="Example of desired pie chart" /></a></p> <p>For some further context, the excel file is created in Python. I have isolated the code segment that creates the pie chart from my code:</p> <pre><code>from openpyxl import Workbook from openpyxl.chart import PieChart, Reference imd=30 lid=18.5 cad=10 wad=12 rud=16.5 sad=0 ht=12 othd=40 wb = Workbook() sheet = wb.active sheet.title=&quot;Data&quot; fi,ft=[],[] sheet['C11'] = imd sheet['C12'] = lid sheet['C13'] = cad sheet['C14'] = wad sheet['C15'] = rud sheet['C16'] = sad sheet['C17'] = ht sheet['C18'] = othd sheet2 = wb.create_sheet() sheet2.title='Charts' pie=PieChart() labels = Reference(sheet, min_col=1, min_row=11, max_row=18) data = Reference(sheet, min_col=3, min_row=10, max_row=18) pie.add_data(data, titles_from_data=True) pie.set_categories(labels) pie.title = &quot;Pie Chart&quot; sheet2.add_chart(pie, 'A1') wb.save(&quot;temp.xlsx&quot;) </code></pre>
[ { "answer_id": 74265258, "author": "stan61285", "author_id": 11409843, "author_profile": "https://Stackoverflow.com/users/11409843", "pm_score": 0, "selected": false, "text": "sheet['C11'] = imd/100 # convert to decimal\nsheet['C11'].number_format = '0.0%' # change to percentage\n" }...
2022/10/31
[ "https://Stackoverflow.com/questions/74264322", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17551376/" ]
74,264,376
<p>I have this code in my flutter app :</p> <pre><code>class WebViewWidget1 extends StatefulWidget { WebViewWidget1({Key? key}) : super(key: key); @override State&lt;WebViewWidget1&gt; createState() =&gt; _WebViewWidget1State(); } class _WebViewWidget1State extends State&lt;WebViewWidget1&gt; { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( centerTitle: true, title: const Text('title'), ), body: const WebView( initialUrl: &quot;https://github.com/ArjunMalhotra07&quot;, javascriptMode: JavascriptMode.unrestricted, ), ); } } </code></pre> <p>I want to implement web view and this was the code I took from the internet. This just doesn't work. It shows a blank white screen with app bar only. Where am I wrong? can't deduce.</p>
[ { "answer_id": 74265258, "author": "stan61285", "author_id": 11409843, "author_profile": "https://Stackoverflow.com/users/11409843", "pm_score": 0, "selected": false, "text": "sheet['C11'] = imd/100 # convert to decimal\nsheet['C11'].number_format = '0.0%' # change to percentage\n" }...
2022/10/31
[ "https://Stackoverflow.com/questions/74264376", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17879169/" ]
74,264,380
<p>I'm interacting directly with the AWS API not through a language specific library.</p> <p>I'm trying to call <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListObjectsV2.html#AmazonS3-ListObjectsV2-response-CommonPrefixes" rel="nofollow noreferrer">ListObjectsV2</a> on a bucket and getting back an error message:</p> <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt; &lt;Error&gt; &lt;Code&gt;AuthorizationHeaderMalformed&lt;/Code&gt; &lt;Message&gt;The authorization header is malformed; the region \'us-east-1\' is wrong; expecting \'eu-west-2\'&lt;/Message&gt; &lt;Region&gt;eu-west-2&lt;/Region&gt; &lt;RequestId&gt;3W75CR8BNRQJ13Y6&lt;/RequestId&gt; &lt;HostId&gt;kYvjGFpckmTBxcq89h3Y+dWmt7UrHJWXlOQyr0k9V2/07NJVDK4dwg2rqAayjOwV1P4Z5bFnvys=&lt;/HostId&gt; &lt;/Error&gt; </code></pre> <p>This seems logical enough, I know the bucket I'm trying to interact with at the moment is <code>eu-west-2</code>.</p> <p>My question is, if I didn't know a bucket's region, how could I find out through the API? Sigv4 requires you to specify the region, but if you don't know it, how can you construct a request to find out?</p> <p>This is for private buckets. I've found answers for public bucets but they don't work for private buckets without authentication. And authentication requires you to know the region (AFAIK).</p>
[ { "answer_id": 74265201, "author": "Anon Coward", "author_id": 2378643, "author_profile": "https://Stackoverflow.com/users/2378643", "pm_score": 2, "selected": true, "text": "x-amz-bucket-region: us-west-2\nx-amz-request-id: [...]\nx-amz-id-2: [...]\nContent-Type: application/xml\nTransf...
2022/10/31
[ "https://Stackoverflow.com/questions/74264380", "https://Stackoverflow.com", "https://Stackoverflow.com/users/453851/" ]
74,264,392
<p>I have tried looking this up, but i am not sure if my terminology is correctly. My initial query works fine, however i want to do a calculation based on the results from the first query. Its not possible to do this from the initial query due to the Inner Joins and Group By</p> <p>I can accomplish this by saving this Query as a View and running my second query against the view. But this is not ideal for the usage.</p> <p>What is the correct wording for using two queries in such a way, the second using the results from the first.</p> <p>Example:</p> <pre><code>Select, column1, column2, column3, column4, SUM(column5) as column5, SUM(column6) as column6, TableB.column7 From TableA Left Out Join TableB on TableB.column7 = TableA.column1 Group By column1, column2, column3, column4 Select column1, column2, column3, column4, column5, column6, (ISNULL (NULLIF(column5 - column6,0) / NULLIF(column5,0),0) * 100) else 0 end as columnGP from (Previous Query just ran) </code></pre> <p>How can i store the results as a Variable, how long is the Data held as a variable? I storing as a variable will have a knock on effect from a performance side</p>
[ { "answer_id": 74264445, "author": "Olivier Jacot-Descombes", "author_id": 880990, "author_profile": "https://Stackoverflow.com/users/880990", "pm_score": 3, "selected": true, "text": "Select\n column1, column2, column3, column4, column5, column6,\n (ISNULL (NULLIF(column5 - column...
2022/10/31
[ "https://Stackoverflow.com/questions/74264392", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4605812/" ]
74,264,400
<p>Actually, I have many sublists and I have to display it one by one after recieving a signal (list contains[170,204]). that's why I have to use Future.wait. But this didn't work for me. what happens actually is that I send the first sublist then I resend the same sublist and after this there was no sublist sended. But when I tried to change the future.wait by Future.delayed it worked as expected. so the problem is on how I used the Future .wait this is my code :</p> <pre><code> getValue() { _characteristic42?.value.listen( (notification) async =&gt; {print(&quot;Notification Value : $notification&quot;)}); } if (notification[0] == 170 &amp;&amp; notification[1] == 204) { await Future.forEach(chun, (ch) async { await Future.delayed(const Duration(seconds: 4)); await c.write(ch, withoutResponse: true); await c.read(); await Future.wait(getValue()); }) </code></pre> <p>I would be very thankful if you can help me resolving this issue</p>
[ { "answer_id": 74264445, "author": "Olivier Jacot-Descombes", "author_id": 880990, "author_profile": "https://Stackoverflow.com/users/880990", "pm_score": 3, "selected": true, "text": "Select\n column1, column2, column3, column4, column5, column6,\n (ISNULL (NULLIF(column5 - column...
2022/10/31
[ "https://Stackoverflow.com/questions/74264400", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20285309/" ]
74,264,441
<p>There are a way to use 1 function and change regardless the UI element i send like textblock, label, header (from menuItiem)</p> <pre><code> private async Task ChangeText(UIelement e,string msg) { //for the menuItem the &quot;.header&quot; for label: &quot;.content&quot; for textblock: &quot;.text&quot; e = msg; } </code></pre> <p>just something like this function or its imposible ?</p>
[ { "answer_id": 74264540, "author": "mm8", "author_id": 7252182, "author_profile": "https://Stackoverflow.com/users/7252182", "pm_score": 3, "selected": true, "text": "private void ChangeText(UIElement e, string msg)\n{\n switch (e)\n {\n case TextBlock tb:\n tb.Te...
2022/10/31
[ "https://Stackoverflow.com/questions/74264441", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17573097/" ]
74,264,449
<p>I'm developing an app for my school that helps students better understand their grades by getting an analysis on their portfolio of assignments for each class. Right now I am at the point of letting the user create the classes they are in and customize the information within it that is displayed in a tableview with custom cells. The user gives the majority of the information in a child view where they input information such as class name, teacher, grade weighting, etc. I wanted to give the user the ability to change the color of the cell once they are viewing the TableView with all the cells - classes - they made. I decided to go about this by having the cells have a UIButton that they can click on for their determined cell to then pull up a UIColorPickerViewController.</p> <p>What I wanted to happen was...</p> <ol> <li>User taps button in cell</li> <li>UIPickerViewController is pulled up</li> <li>User selects their desired color</li> <li>User exits UIPickerViewController</li> <li>Cell is changed to the color</li> </ol> <p>What is actually happening is this</p> <ol> <li>User taps button in cell</li> <li><strong>Cell background becomes black right as UIPickerViewController is presented</strong></li> <li>User selects their desired color</li> <li>User exits UIPickerViewController</li> <li><strong>Cell remains black</strong></li> </ol> <p>I used a delegate to send the information from the cells and then I used the &quot;colorPickerViewControllerDidFinish()&quot; function and it's still not working out. When I did some debugging I found that the value of the UIColorPickerViewController is actually being stored in the variable I am using, but only after I have already assigned it's value to the cell background so I'm unsure what to do. As you can probably tell, I'm new to swift so apologies for any stupid mistakes in my code.</p> <h1>Custom Cell File</h1> <pre class="lang-swift prettyprint-override"><code>// Protocol for VC's to conform to so they can distinguish which cell has a button being tapped protocol newlyCreatedCellDelegate: AnyObject { func didTapButton(title: String, cellView: UIView) } class newlyCreatedClass: UITableViewCell { // Telling the delegate what to do once they are assigned weak var delegate: newlyCreatedCellDelegate? @IBOutlet weak var classContentView: UIView! @IBOutlet weak var classUIView: UIView! @IBOutlet weak var classNameLabel: UILabel! @IBOutlet weak var classTeacherNameLabel: UILabel! @IBOutlet weak var pointType1NameLabel: UILabel! @IBOutlet weak var pointType2NameLabel: UILabel! @IBOutlet weak var pointType3NameLabel: UILabel! @IBOutlet weak var percent1Label: UILabel! @IBOutlet weak var percent2Label: UILabel! @IBOutlet weak var percent3Label: UILabel! @IBOutlet weak var colorButton: UIButton! override func awakeFromNib() { super.awakeFromNib() // Initialization code colorButton.layer.cornerRadius = 21 } override func setSelected(_ selected: Bool, animated: Bool) { super.setSelected(selected, animated: animated) // Configure the view for the selected state } // Essentially creating the prep list for the delegate. If they are called - whoever it is - they will go through this 'checklist' @IBAction func colorButtonTapped(_ sender: Any) { delegate?.didTapButton(title: classNameLabel.text!, cellView: classUIView) } } </code></pre> <h1>ViewController Extensions</h1> <pre class="lang-swift prettyprint-override"><code>extension ClassSelection: newlyCreatedCellDelegate { func didTapButton(title: String, cellView: UIView) { let colorPickerVC = UIColorPickerViewController() colorPickerVC.delegate = self present(colorPickerVC, animated: true, completion: nil) colorPickerViewControllerDidFinish(colorPickerVC) // 'cellBackgroundColor' is a variable declared in the VC to transfer the UIColor value cellView.backgroundColor = cellBackgroundColor } } extension ClassSelection: UIColorPickerViewControllerDelegate { func colorPickerViewControllerDidFinish(_ viewController: UIColorPickerViewController) { cellBackgroundColor = viewController.selectedColor } } </code></pre>
[ { "answer_id": 74264540, "author": "mm8", "author_id": 7252182, "author_profile": "https://Stackoverflow.com/users/7252182", "pm_score": 3, "selected": true, "text": "private void ChangeText(UIElement e, string msg)\n{\n switch (e)\n {\n case TextBlock tb:\n tb.Te...
2022/10/31
[ "https://Stackoverflow.com/questions/74264449", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20379663/" ]
74,264,453
<p>Everything is working properly except the printing of the list, I have tried multiple ways <code>rstrip()</code>, <code>splitline()</code>, <code>replace()</code>, etc. But perhaps I am not using them correctly. I am fairly new to using dictionaries so I would appreciate some guidance for the current problem.</p> <p>txt file (should already be in a list form):</p> <pre class="lang-none prettyprint-override"><code>Shopping List ITEM 1000: Frozen Burgers ITEM 1001: Bread ITEM 1002: Frozen Burgers ITEM 1003: Mayonnaise ITEM 1004: Bread ITEM 1005: Frozen Burgers ITEM 1006: Mustard ITEM 1007: Tomato ITEM 1008: Tomato </code></pre> <p>Code:</p> <pre><code>from collections import Counter def get_items(): print(&quot;&quot;&quot;Items that repeat twice or more in the lists: Item Name Repeat Times ------------------------------&quot;&quot;&quot;) item_count = Counter() with open('Shopping_List.txt') as f: for line in f.readlines()[1:]: item_count.update([line[11:]]) print('\r',*item_count.most_common(3),sep='\n') def get_dictionaries(textfile): items = {} numbers = {} FIRST_NUM = 1000 with open(textfile) as f: for lines in f.readlines()[1:]: numbers[FIRST_NUM]=lines.lstrip()[11:] items[lines.lstrip()[11:]]=items.setdefault(lines.lstrip()[11:],0)+1 FIRST_NUM += 1 return items,numbers get_items() </code></pre>
[ { "answer_id": 74264585, "author": "Deneb", "author_id": 2547890, "author_profile": "https://Stackoverflow.com/users/2547890", "pm_score": 2, "selected": true, "text": "def get_items():\n print(\n \"\"\"Items that repeat twice or more in the lists:\n Item Name Repeat ...
2022/10/31
[ "https://Stackoverflow.com/questions/74264453", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20023907/" ]
74,264,473
<p>When I am viewing my page with these settings on my desktop, the website seems to have no problem. But when I open my page on my mobile device, the navigation bar overflows and makes the page horizontally scrollable.</p> <p>How I want my page to work? I want the page to be horizontally non-scrollable, and make the navigation bar elements centered and adapt with the resolution of my device. However, I don't want the navigation bar to expand beyond 650px. I have set the header background to red for showing the overflow I get on my mobile device. <a href="https://i.stack.imgur.com/fDUd6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fDUd6.png" alt="Image of my problem (nav bar isnt centered + overflowing)" /></a></p> <pre><code>header *{ margin-bottom: 0px; padding-left: 3.5vw; padding-right: 3.5vw; padding-top: 10px; margin-top: 0px; margin-left: auto; margin-right: auto; margin-bottom: 0px;; max-width: 650px; background-color: red; color: #cacaca; text-decoration: none; display: flex; justify-content: space-between; align-items: center; flex-wrap: nowrap; } .nav_links { list-style: none; } .nav_links li { display: inline-block; padding: 0px 0px; } .nav_links li a { transition: all 0.3s ease 0s; } .nav_links li a:hover { color: #ffffff; transition: all 0.3s ease 0s; } </code></pre>
[ { "answer_id": 74264585, "author": "Deneb", "author_id": 2547890, "author_profile": "https://Stackoverflow.com/users/2547890", "pm_score": 2, "selected": true, "text": "def get_items():\n print(\n \"\"\"Items that repeat twice or more in the lists:\n Item Name Repeat ...
2022/10/31
[ "https://Stackoverflow.com/questions/74264473", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14760350/" ]
74,264,548
<p>I am working on creating a macro in Outlook VBA that aims to copy contacts from my default contact-folder to another contact-folder, conditioned by the values of a user-defined field. When refrencing the value of a built in field, the code works as desired. However, the problem arrises when trying to reference the values of a user-defined field. My code seems to be unable to reach the field.</p> <p>Here, when referencing to the title of the contact (&quot;title&quot; being a built-in field), VBA finds it immediately and there is no problem.</p> <pre><code>Sub copyitem() ' Copy and move all contacts from default folder &quot;Contacts&quot; to &quot;Contacts.1.01 Dim olookitem As Object Dim olookname As NameSpace Dim olookfldr As folder Dim destfolder As folder Dim olookcontactitem As ContactItem Dim mycopieditem As ContactItem Set olookname = Application.GetNamespace(&quot;MAPI&quot;) Set olookfldr = olookname.GetDefaultFolder(olFolderContacts) Set destfolder = olookfldr.Folders(&quot;Contacts.1.01&quot;) For Each olookitem In olookfldr.items If olookitem.Class = olContact And olookitem.Title = &quot;Mr.&quot; Then Set olookcontactitem = olookitem Set mycopieditem = olookitem.Copy mycopieditem.Move destfolder End If Next End Sub </code></pre> <p>However, when trying to reference which team in my office the contact belongs to (Column named &quot;Team&quot;), which is defined in a user-defined field, my macro fails to recognize it. Code following below.</p> <pre><code>Sub copyitem() ' Copy and move all contacts from default folder &quot;Contacts&quot; to &quot;Contacts.1.01 Dim olookitem As Object Dim olookname As NameSpace Dim olookfldr As folder Dim destfolder As folder Dim olookcontactitem As ContactItem Dim mycopieditem As ContactItem Dim Myproperty As Object Set olookname = Application.GetNamespace(&quot;MAPI&quot;) Set olookfldr = olookname.GetDefaultFolder(olFolderContacts) Set destfolder = olookfldr.Folders(&quot;Contacts.1.01&quot;) Set Myproperty = olookfldr.UserDefinedProperties.Find(&quot;Team&quot;) Set MyP = olookfldr.UserDefinedProperties ' MsgBox (MyP.item(1).Name) For Each olookitem In olookfldr.items If olookitem.Class = olContact And MyP.item(9).Name = &quot;Accounting&quot; Then Set olookcontactitem = olookitem Set mycopieditem = olookitem.Copy mycopieditem.Move destfolder End If Next End Sub </code></pre>
[ { "answer_id": 74264585, "author": "Deneb", "author_id": 2547890, "author_profile": "https://Stackoverflow.com/users/2547890", "pm_score": 2, "selected": true, "text": "def get_items():\n print(\n \"\"\"Items that repeat twice or more in the lists:\n Item Name Repeat ...
2022/10/31
[ "https://Stackoverflow.com/questions/74264548", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20379834/" ]
74,264,567
<p>Basically, I want to remove the whitespace that exists after numbers</p> <p>Input:</p> <pre><code>medication_title CLORIDRATO DE VENLAFAXINA 75 MG VIIBRYD 40 MG KTRIZ UNO 0.6 U/G </code></pre> <p>Ouput:</p> <pre><code>medication_title medication_title2 CLORIDRATO DE VENLAFAXINA 75 MG CLORIDRATO DE VENLAFAXINA 75MG VIIBRYD 40 MG VIIBRYD 40MG KTRIZ UNO 0.6 U/G KTRIZ UNO 0.6U/G </code></pre> <p>Ideas?</p>
[ { "answer_id": 74264705, "author": "Tim Biegeleisen", "author_id": 1863229, "author_profile": "https://Stackoverflow.com/users/1863229", "pm_score": 2, "selected": true, "text": "SELECT\n medication_title,\n REGEXP_REPLACE(medication_title,\n '\\y(\\d+(?:\\.\\d+)?...
2022/10/31
[ "https://Stackoverflow.com/questions/74264567", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18609422/" ]
74,264,598
<p>I want to set a CPU limit on a container in a docker-compose file.</p> <p>When I execute the following:</p> <pre><code>docker run -d --rm --cpus 0.3 --name aaa progrium/stress -c 8 -t 20s </code></pre> <p>The container is taking 30% of a core according to docker stats:</p> <pre><code>CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS d6be318a85e6 aaa 29.01% 1.328MiB / 3.805GiB 0.03% 806B / 0B 0B / 0B 9 </code></pre> <p>And the limit is set according to docker inspect:</p> <pre><code>$ docker inspect aaa | grep -i cpu &quot;CpuShares&quot;: 0, &quot;NanoCpus&quot;: 300000000, &quot;CpuPeriod&quot;: 0, &quot;CpuQuota&quot;: 0, &quot;CpuRealtimePeriod&quot;: 0, &quot;CpuRealtimeRuntime&quot;: 0, &quot;CpusetCpus&quot;: &quot;&quot;, &quot;CpusetMems&quot;: &quot;&quot;, &quot;CpuCount&quot;: 0, &quot;CpuPercent&quot;: 0, </code></pre> <p>This is expected behavior. But when I write the following docker-compose.yml file:</p> <pre><code>version: '3' services: aaa: image: progrium/stress command: -c 8 -t 20s deploy: resources: limits: memory: 100M cpus: '0.3' </code></pre> <p>And start the project with <code>docker-compose up -d</code> ; I got the following stats output:</p> <pre><code>CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS a94118f4a5f7 docker-aaa-1 87.74% 1.359MiB / 100MiB 1.36% 806B / 0B 1.91MB / 0B 9 </code></pre> <p>And the limit is not set in the inspect output. I expected to see a CPU limit:</p> <pre><code>$ docker inspect docker-aaa-1 | grep -i cpu &quot;CpuShares&quot;: 0, &quot;NanoCpus&quot;: 0, &quot;CpuPeriod&quot;: 0, &quot;CpuQuota&quot;: 0, &quot;CpuRealtimePeriod&quot;: 0, &quot;CpuRealtimeRuntime&quot;: 0, &quot;CpusetCpus&quot;: &quot;&quot;, &quot;CpusetMems&quot;: &quot;&quot;, &quot;CpuCount&quot;: 0, &quot;CpuPercent&quot;: 0, </code></pre> <p>My conclusions are:</p> <ul> <li>My docker engine is able to set cpu limits</li> <li>The limits in the <code>docker-compose.yml</code> file are read (docker stats explicitly show memory limit</li> <li>docker-compose fails to set limit</li> </ul> <p>I tried to set cpu limit the old way (as mentioned in the <a href="https://docs.docker.com/compose/compose-file/compose-file-v3/#resources" rel="nofollow noreferrer">compose file documentation</a>).</p> <pre><code>version: '2' services: aaa: image: progrium/stress command: -c 8 -t 20s cpus: 0.3 </code></pre> <p>The result is the same (no limit on CPU). And no error message from docker-compose.</p> <pre><code>CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS 8658bc78c795 docker-aaa-1 180.75% 1.367MiB / 3.805GiB 0.04% 1.18kB / 0B 0B / 0B 9 </code></pre> <p>How can I ask docker-compose to set the CPU limit? What documentation or configuration lines did I miss?</p> <p>Thanks for your help!</p> <p>Versions:</p> <pre><code>$ docker-compose -v Docker Compose version v2.4.1 $ docker -v Docker version 20.10.21, build baeda1f $ uname -a Linux hostname 5.10.0-18-amd64 #1 SMP Debian 5.10.140-1 (2022-09-02) x86_64 GNU/Linux $ lsb_release -a No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 11 (bullseye) Release: 11 Codename: bullseye </code></pre>
[ { "answer_id": 74264705, "author": "Tim Biegeleisen", "author_id": 1863229, "author_profile": "https://Stackoverflow.com/users/1863229", "pm_score": 2, "selected": true, "text": "SELECT\n medication_title,\n REGEXP_REPLACE(medication_title,\n '\\y(\\d+(?:\\.\\d+)?...
2022/10/31
[ "https://Stackoverflow.com/questions/74264598", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20379464/" ]
74,264,600
<p>I'm a fairly new web developer and I have an ecommerce website that integrates <a href="https://www.easypost.com/" rel="nofollow noreferrer">EasyPost</a> to create and print shipping labels.</p> <p>EasyPost has an API. Also, in each shipping label, I see a JavaScript object (I think) that displays <code>buyer_address... &quot;email&quot;: &quot;example@gmail.com&quot;,</code>, which tells me that the email information is there.</p> <p>My question is somewhat general in scope: What steps would I need to take to go about creating this automation? The website is built in Webflow, so I don't really have a &quot;codebase&quot; or &quot;repository&quot; to store whatever code is needed to build the automation.</p> <p>Since the buyer email is making it into EasyPost with integrations already in place, I feel that I could create a simple program that emails the tracking number to the buyer email every time a label is generated, or perhaps when package is shipped, without the program needing to interact with Webflow or other integrations.</p> <p>I attempted using Zapier, as well as Make.com. Neither worked, and OrderDesk doesn't have a way to send tracking number emails.</p>
[ { "answer_id": 74633121, "author": "Justin Hammond", "author_id": 6064135, "author_profile": "https://Stackoverflow.com/users/6064135", "pm_score": 0, "selected": false, "text": "Webflow" } ]
2022/10/31
[ "https://Stackoverflow.com/questions/74264600", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18130315/" ]
74,264,612
<p>I have a problem developing my app on Android. For a long time, the app was intended to run only on tablets of fixed resolution, so we designed the layout using LinearLayouts. Now we need to deploy the app on various Android devices, including smartphones, so following the Android developer guidelines I decided to convert all my layouts to the newer ConstraintLayout; for my splash screen activity everything works well on various devices.</p> <p>Problems comes with login activity: a simple layout with logo, username and password fields and buttons; using old LinearLayout, when I click on one of the fields the soft input keyboard shows up and let me to scroll to move between fields and buttons, and this is the desidered behaviour. With ConstraintLayout instead when keyboard shows up the layout doesn't scroll anymore and typing the password I can't see the progress until I move the focus away from that field.</p> <p>This is my actual layout:</p> <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;androidx.constraintlayout.widget.ConstraintLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot; xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot; android:id=&quot;@+id/top_constraint_layout&quot; android:layout_width=&quot;match_parent&quot; android:layout_height=&quot;match_parent&quot; &gt; &lt;ImageView android:id=&quot;@+id/imageView&quot; android:layout_width=&quot;0dp&quot; android:layout_height=&quot;0dp&quot; android:contentDescription=&quot;@string/empty_row&quot; android:scaleType=&quot;fitXY&quot; android:src=&quot;@drawable/logo&quot; app:layout_constraintTop_toBottomOf=&quot;@+id/guidelineHorizontal15&quot; app:layout_constraintBottom_toTopOf=&quot;@+id/guidelineHorizontal45&quot; app:layout_constraintStart_toEndOf=&quot;@+id/guidelineVertical20&quot; app:layout_constraintEnd_toStartOf=&quot;@id/guidelineVertical80&quot; /&gt; &lt;EditText android:id=&quot;@+id/username&quot; style=&quot;@style/LayoutLoginEditTextStyle&quot; android:layout_width=&quot;0dp&quot; android:layout_height=&quot;0dp&quot; android:autofillHints=&quot;&quot; android:background=&quot;@android:color/transparent&quot; android:gravity=&quot;center&quot; android:hint=&quot;@string/prompt_email&quot; android:inputType=&quot;text&quot; android:nextFocusForward=&quot;@+id/password&quot; android:textColorHint=&quot;#78909C&quot; android:textSize=&quot;@dimen/_12ssp&quot; app:layout_constraintTop_toBottomOf=&quot;@id/guidelineHorizontal525&quot; app:layout_constraintBottom_toBottomOf=&quot;@id/guidelineHorizontal60&quot; app:layout_constraintStart_toEndOf=&quot;@id/guidelineVertical20&quot; app:layout_constraintEnd_toStartOf=&quot;@id/guidelineVertical80&quot; /&gt; &lt;View android:id=&quot;@+id/view&quot; android:layout_width=&quot;0dp&quot; android:layout_height=&quot;2dp&quot; android:background=&quot;#B4B4B4&quot; app:layout_constraintTop_toBottomOf=&quot;@id/guidelineHorizontal60&quot; app:layout_constraintStart_toEndOf=&quot;@id/guidelineVertical20&quot; app:layout_constraintEnd_toStartOf=&quot;@id/guidelineVertical80&quot; /&gt; &lt;EditText android:id=&quot;@+id/password&quot; style=&quot;@style/LayoutLoginEditTextStyle&quot; android:layout_width=&quot;0dp&quot; android:layout_height=&quot;0dp&quot; android:autofillHints=&quot;&quot; android:background=&quot;@android:color/transparent&quot; android:gravity=&quot;center&quot; android:hint=&quot;@string/prompt_password&quot; android:imeActionLabel=&quot;@string/action_sign_in_short&quot; android:imeOptions=&quot;actionGo&quot; android:inputType=&quot;textPassword&quot; android:textColorHint=&quot;#A1887F&quot; android:textSize=&quot;@dimen/_12ssp&quot; app:layout_constraintBottom_toTopOf=&quot;@id/guidelineHorizontal675&quot; app:layout_constraintEnd_toStartOf=&quot;@id/guidelineVertical80&quot; app:layout_constraintStart_toEndOf=&quot;@id/guidelineVertical20&quot; app:layout_constraintTop_toBottomOf=&quot;@+id/guidelineHorizontal60&quot; /&gt; &lt;it.company.etmlib.ui.graphics.EasyButton style=&quot;@style/EasyButton&quot; android:id=&quot;@+id/registration_button&quot; android:layout_width=&quot;0dp&quot; android:layout_height=&quot;0dp&quot; android:layout_gravity=&quot;center&quot; android:padding=&quot;0dp&quot; android:text=&quot;@string/action_sign_in_register&quot; android:textColor=&quot;@color/black_text&quot; android:textSize=&quot;@dimen/_11ssp&quot; app:layout_constraintTop_toBottomOf=&quot;@+id/guidelineHorizontal75&quot; app:layout_constraintBottom_toTopOf=&quot;@+id/guidelineHorizontal85&quot; app:layout_constraintStart_toEndOf=&quot;@+id/guidelineVertical30&quot; app:layout_constraintEnd_toStartOf=&quot;@+id/guidelineVertical45&quot; /&gt; &lt;it.company.etmlib.ui.graphics.EasyButton style=&quot;@style/EasyButton&quot; android:id=&quot;@+id/sign_in_button&quot; android:layout_width=&quot;0dp&quot; android:layout_height=&quot;0dp&quot; android:layout_gravity=&quot;center&quot; android:padding=&quot;0dp&quot; android:text=&quot;@string/action_sign_in_short&quot; android:textColor=&quot;@color/black_text&quot; android:textSize=&quot;@dimen/_11ssp&quot; app:layout_constraintTop_toBottomOf=&quot;@id/guidelineHorizontal75&quot; app:layout_constraintBottom_toTopOf=&quot;@+id/guidelineHorizontal85&quot; app:layout_constraintStart_toEndOf=&quot;@+id/guidelineVertical55&quot; app:layout_constraintEnd_toStartOf=&quot;@+id/guidelineVertical70&quot; /&gt; &lt;ImageView android:id=&quot;@+id/info_button&quot; android:layout_width=&quot;wrap_content&quot; android:layout_height=&quot;wrap_content&quot; android:layout_marginTop=&quot;20dp&quot; android:layout_marginEnd=&quot;20dp&quot; android:background=&quot;@drawable/logo_info&quot; android:contentDescription=&quot;@string/empty_row&quot; android:visibility=&quot;visible&quot; app:layout_constraintTop_toTopOf=&quot;parent&quot; app:layout_constraintEnd_toEndOf=&quot;parent&quot; /&gt; &lt;ProgressBar style=&quot;@android:style/Widget.DeviceDefault.ProgressBar.Large&quot; android:id=&quot;@+id/login_progress_bar&quot; android:layout_width=&quot;wrap_content&quot; android:layout_height=&quot;wrap_content&quot; android:visibility=&quot;gone&quot; app:layout_constraintTop_toTopOf=&quot;parent&quot; app:layout_constraintBottom_toBottomOf=&quot;parent&quot; app:layout_constraintStart_toStartOf=&quot;parent&quot; app:layout_constraintEnd_toEndOf=&quot;parent&quot; /&gt; &lt;TextView android:id=&quot;@+id/login_status_message&quot; android:layout_width=&quot;wrap_content&quot; android:layout_height=&quot;wrap_content&quot; android:fontFamily=&quot;sans-serif-light&quot; android:text=&quot;@string/login_progress_signing_in&quot; android:textSize=&quot;@dimen/_10ssp&quot; android:textAppearance=&quot;?android:attr/textAppearanceMedium&quot; android:visibility=&quot;gone&quot; app:layout_constraintTop_toBottomOf=&quot;@id/login_progress_bar&quot; app:layout_constraintStart_toStartOf=&quot;parent&quot; app:layout_constraintEnd_toEndOf=&quot;parent&quot; /&gt; &lt;androidx.constraintlayout.widget.Guideline android:id=&quot;@+id/guidelineHorizontal15&quot; android:layout_width=&quot;wrap_content&quot; android:layout_height=&quot;wrap_content&quot; android:orientation=&quot;horizontal&quot; app:layout_constraintGuide_percent=&quot;0.15&quot; /&gt; &lt;androidx.constraintlayout.widget.Guideline android:id=&quot;@+id/guidelineHorizontal45&quot; android:layout_width=&quot;wrap_content&quot; android:layout_height=&quot;wrap_content&quot; android:orientation=&quot;horizontal&quot; app:layout_constraintGuide_percent=&quot;0.45&quot; /&gt; &lt;androidx.constraintlayout.widget.Guideline android:id=&quot;@+id/guidelineHorizontal525&quot; android:layout_width=&quot;wrap_content&quot; android:layout_height=&quot;wrap_content&quot; android:orientation=&quot;horizontal&quot; app:layout_constraintGuide_percent=&quot;0.525&quot; /&gt; &lt;androidx.constraintlayout.widget.Guideline android:id=&quot;@+id/guidelineHorizontal60&quot; android:layout_width=&quot;wrap_content&quot; android:layout_height=&quot;wrap_content&quot; android:orientation=&quot;horizontal&quot; app:layout_constraintGuide_percent=&quot;0.6&quot; /&gt; &lt;androidx.constraintlayout.widget.Guideline android:id=&quot;@+id/guidelineHorizontal675&quot; android:layout_width=&quot;wrap_content&quot; android:layout_height=&quot;wrap_content&quot; android:orientation=&quot;horizontal&quot; app:layout_constraintGuide_percent=&quot;0.675&quot; /&gt; &lt;androidx.constraintlayout.widget.Guideline android:id=&quot;@+id/guidelineHorizontal75&quot; android:layout_width=&quot;wrap_content&quot; android:layout_height=&quot;wrap_content&quot; android:orientation=&quot;horizontal&quot; app:layout_constraintGuide_percent=&quot;0.75&quot; /&gt; &lt;androidx.constraintlayout.widget.Guideline android:id=&quot;@+id/guidelineHorizontal85&quot; android:layout_width=&quot;wrap_content&quot; android:layout_height=&quot;wrap_content&quot; android:orientation=&quot;horizontal&quot; app:layout_constraintGuide_percent=&quot;0.85&quot; /&gt; &lt;androidx.constraintlayout.widget.Guideline android:id=&quot;@+id/guidelineVertical20&quot; android:layout_width=&quot;wrap_content&quot; android:layout_height=&quot;wrap_content&quot; android:orientation=&quot;vertical&quot; app:layout_constraintGuide_percent=&quot;0.2&quot; /&gt; &lt;androidx.constraintlayout.widget.Guideline android:id=&quot;@+id/guidelineVertical25&quot; android:layout_width=&quot;wrap_content&quot; android:layout_height=&quot;wrap_content&quot; android:orientation=&quot;vertical&quot; app:layout_constraintGuide_percent=&quot;0.25&quot; /&gt; &lt;androidx.constraintlayout.widget.Guideline android:id=&quot;@+id/guidelineVertical30&quot; android:layout_width=&quot;wrap_content&quot; android:layout_height=&quot;wrap_content&quot; android:orientation=&quot;vertical&quot; app:layout_constraintGuide_percent=&quot;0.30&quot; /&gt; &lt;androidx.constraintlayout.widget.Guideline android:id=&quot;@+id/guidelineVertical45&quot; android:layout_width=&quot;wrap_content&quot; android:layout_height=&quot;wrap_content&quot; android:orientation=&quot;vertical&quot; app:layout_constraintGuide_percent=&quot;0.45&quot; /&gt; &lt;androidx.constraintlayout.widget.Guideline android:id=&quot;@+id/guidelineVertical50&quot; android:layout_width=&quot;wrap_content&quot; android:layout_height=&quot;wrap_content&quot; android:orientation=&quot;vertical&quot; app:layout_constraintGuide_percent=&quot;0.5&quot; /&gt; &lt;androidx.constraintlayout.widget.Guideline android:id=&quot;@+id/guidelineVertical55&quot; android:layout_width=&quot;wrap_content&quot; android:layout_height=&quot;wrap_content&quot; android:orientation=&quot;vertical&quot; app:layout_constraintGuide_percent=&quot;0.55&quot; /&gt; &lt;androidx.constraintlayout.widget.Guideline android:id=&quot;@+id/guidelineVertical70&quot; android:layout_width=&quot;wrap_content&quot; android:layout_height=&quot;wrap_content&quot; android:orientation=&quot;vertical&quot; app:layout_constraintGuide_percent=&quot;0.70&quot; /&gt; &lt;androidx.constraintlayout.widget.Guideline android:id=&quot;@+id/guidelineVertical75&quot; android:layout_width=&quot;wrap_content&quot; android:layout_height=&quot;wrap_content&quot; android:orientation=&quot;vertical&quot; app:layout_constraintGuide_percent=&quot;0.75&quot; /&gt; &lt;androidx.constraintlayout.widget.Guideline android:id=&quot;@+id/guidelineVertical80&quot; android:layout_width=&quot;wrap_content&quot; android:layout_height=&quot;wrap_content&quot; android:orientation=&quot;vertical&quot; app:layout_constraintGuide_percent=&quot;0.8&quot; /&gt; &lt;View android:id=&quot;@+id/bottomView&quot; android:layout_width=&quot;0dp&quot; android:layout_height=&quot;1dp&quot; android:background=&quot;#FFFFFF&quot; app:layout_constraintTop_toBottomOf=&quot;@+id/top_constraint_layout&quot; app:layout_constraintStart_toStartOf=&quot;parent&quot; app:layout_constraintEnd_toEndOf=&quot;parent&quot; /&gt; &lt;/androidx.constraintlayout.widget.ConstraintLayout&gt; </code></pre> <p>I already read these two threads and try the proposed solutions, without resolving my problem:</p> <ul> <li><a href="https://stackoverflow.com/questions/66012402/scrollable-screen-on-soft-keyboard-open-using-constraint-layout">Scrollable screen on soft keyboard open, using Constraint layout</a></li> <li><a href="https://stackoverflow.com/questions/38323537/window-soft-input-mode-constraintlayout">Window Soft Input Mode ConstraintLayout</a></li> </ul> <p>What I wish to achieve is the same behaviour when keyboard shows up that I had with LinearLayout but using ConstraintLayout, otherwise if it not possible, a viable alternative.</p> <p>Thanks in advance!</p>
[ { "answer_id": 74633121, "author": "Justin Hammond", "author_id": 6064135, "author_profile": "https://Stackoverflow.com/users/6064135", "pm_score": 0, "selected": false, "text": "Webflow" } ]
2022/10/31
[ "https://Stackoverflow.com/questions/74264612", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3679027/" ]
74,264,616
<p>I expected to get the url with category=business,but the web automatically reset my state to the url that dosent have the category.I dont know the reason behind</p> <pre><code> let {id}=useParams() const [newsurl,setNewsurl]=useState(()=&gt;{ const initialstate=&quot;https://newsapi.org/v2/top-headlines?country=us&amp;apiKey=c75d8c8ba2f1470bb24817af1ed669ee&quot; return initialstate;}) //console.log(id); const [articles, setActicles] = useState([]); useEffect( ()=&gt;{ if(id === 2) console.log(&quot;condition&quot;) setNewsurl(&quot;https://newsapi.org/v2/top-headlines?country=de&amp;category=business&amp;apiKey=c75d8c8ba2f1470bb24817af1ed669ee&quot;)},[]) useEffect(() =&gt; { const getArticles = async () =&gt; { const res = await Axios.get(newsurl); setActicles(res.data.articles); console.log(res); }; getArticles(); }, []); useEffect(() =&gt; { console.log(newsurl) // Whatever else we want to do after the state ha s been updated. }, [newsurl]) //return &quot;https://newsapi.org/v2/top-headlines?country=us&amp;apiKey=c75d8c8ba2f1470bb24817af1ed669ee&quot;;} return (&lt;&gt;&lt;Newsnavbar /&gt;{articles?.map(({title,description,url,urlToImage,publishedAt,source})=&gt;( &lt;NewsItem title={title} desciption={description} url={url} urlToImage={urlToImage} publishedAt={publishedAt} source={source.name} /&gt; )) } &lt;/&gt; ) </code></pre> <p>one more things is that when i save the code the page will change to have category but when i refresh it ,it change back to the inital state.Same case when typing the url with no id.May i know how to fix this and the reason behind?</p>
[ { "answer_id": 74264848, "author": "abolfazl shamsollahi", "author_id": 11168409, "author_profile": "https://Stackoverflow.com/users/11168409", "pm_score": 0, "selected": false, "text": "setState" }, { "answer_id": 74264921, "author": "tomleb", "author_id": 15169145, ...
2022/10/31
[ "https://Stackoverflow.com/questions/74264616", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20112858/" ]
74,264,638
<p><em>Beginner question</em> Hi, I'm struggling to figure out a way to encrypt this message. Ideally my program should work like this: <br/> 1. Ask for input of a word/message to encrypt. This could include letters and spaces. <br/> 2. Generate a number between 2 and 20 (i'll call it x for now) <br/> 3. Then randomly select characters of length x to put between each letter of the inputted message. <br/> 4. Print said encrypted message.</p> <p>Issue is when I run the code it prints the same random letter and also does not remove any spaces. It also only uses the same length each time I run the code. Any suggestions on why this happens? Thank you.</p> <pre><code>import random chars = 'abcdeifghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' def ranchar(): y = random.randrange(2, 20) for x in range(2, y): ok = random.choice(chars) return ok phrase = input('Please enter the message you would like to encrypt: ') print(ranchar().join(phrase)) </code></pre> <p>Output:</p> <pre><code>tQhQeQ QqQuQiQcQkQ QbQrQoQwQnQ QfQoQxQ QjQuQmQpQsQ QoQvQeQrQ QtQhQeQ QlQaQzQyQ QdQoQg Process finished with exit code 0 </code></pre>
[ { "answer_id": 74265424, "author": "Ziv Wu", "author_id": 20341339, "author_profile": "https://Stackoverflow.com/users/20341339", "pm_score": 1, "selected": false, "text": "import random\nchars = 'abcdeifghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'\n\n\ndef ranchar(phrase):\n outpu...
2022/10/31
[ "https://Stackoverflow.com/questions/74264638", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20207910/" ]
74,264,654
<p>This is the request am making using the UA method of calling the V3 API, wrapped in a oath library for react. But it's getting deprecated starting June 2023 and I can't figure out how to recreate it in the GA4 v1 Beta API aka Google Analytics Data API. I have tried following Google's documentation but i just can't for my life understand how to make the request...</p> <pre><code>const login = useGoogleLogin({ onSuccess: async response =&gt; { try { console.log(response.access_token); const res = await axios.get(`https://www.googleapis.com/analytics/v3/data/realtime?ids=ga:${gaID}&amp;metrics=rt:activeUsers&amp;access_token=${response.access_token}`, { headers: { &quot;authorization&quot;: `Bearer ${response.access_token}` } }) if (res.data.rows == null) { res.data.rows = 0 } reponseGlobal = response setactiveUsers(res.data.rows); setloggedin(true); const interval = setInterval(function() { fetch (); }, 5000); } catch (err) { console.log(err) } }, scope: 'https://www.googleapis.com/auth/analytics.readonly' }); </code></pre>
[ { "answer_id": 74265424, "author": "Ziv Wu", "author_id": 20341339, "author_profile": "https://Stackoverflow.com/users/20341339", "pm_score": 1, "selected": false, "text": "import random\nchars = 'abcdeifghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'\n\n\ndef ranchar(phrase):\n outpu...
2022/10/31
[ "https://Stackoverflow.com/questions/74264654", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16867893/" ]
74,264,680
<p>I want to scrape parts of this site:</p> <p><a href="https://www.booklooker.de/B%C3%BCcher/Bastian-Sick+Der-Dativ-ist-dem-Genitiv-sein-Tod-Ein-Wegweiser-durch-den-Irrgarten-der-deutschen/id/A02ArCkS01ZZy" rel="nofollow noreferrer">https://www.booklooker.de/B%C3%BCcher/Bastian-Sick+Der-Dativ-ist-dem-Genitiv-sein-Tod-Ein-Wegweiser-durch-den-Irrgarten-der-deutschen/id/A02ArCkS01ZZy</a></p> <p>More accurate this part: <a href="https://i.stack.imgur.com/jU4ul.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jU4ul.png" alt="enter image description here" /></a></p> <p>The html looks like this: <a href="https://i.stack.imgur.com/kU6Mq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kU6Mq.png" alt="enter image description here" /></a></p> <p>I tried this, but it doesn`t work:</p> <pre><code> from bs4 import BeautifulSoup import requests page = requests.get(&quot;https://www.booklooker.de/Bücher/Bastian-Sick+Der-Dativ-ist-dem-Genitiv-sein-Tod-Ein-Wegweiser-durch-den-Irrgarten-der-deutschen/id/A02ArCkS01ZZy&quot;) souped = BeautifulSoup(page.content, &quot;html.parser&quot;) description = souped.find(class_=&quot;propertyItem_13&quot;).find_all(&quot;br&quot;).text </code></pre> <p>But that doesn`t work. Do you have any idea, how it is possible to scrape all the text?</p> <p>Thanks in advance!!</p>
[ { "answer_id": 74264745, "author": "Simon", "author_id": 17174109, "author_profile": "https://Stackoverflow.com/users/17174109", "pm_score": 0, "selected": false, "text": "<br>" }, { "answer_id": 74264793, "author": "Joel Ambu", "author_id": 12907353, "author_profile"...
2022/10/31
[ "https://Stackoverflow.com/questions/74264680", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19809547/" ]
74,264,754
<p>[&quot;9.358,26 €&quot;, &quot;Hello World&quot;, &quot;3.562,77 €&quot;, &quot;3,77 €&quot;] -&gt; [&quot;Hello World&quot;]</p> <p>I was thinking of using regex, but is there a more easy way?</p>
[ { "answer_id": 74264745, "author": "Simon", "author_id": 17174109, "author_profile": "https://Stackoverflow.com/users/17174109", "pm_score": 0, "selected": false, "text": "<br>" }, { "answer_id": 74264793, "author": "Joel Ambu", "author_id": 12907353, "author_profile"...
2022/10/31
[ "https://Stackoverflow.com/questions/74264754", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20099097/" ]
74,264,812
<p>I have fetched data from a website using <code>BeautifulSoup</code> module. I know from meta header that the source encoding for this document is 'iso-8859-1'. I also know that <code>BeutifulSoup</code> automatically transcode to 'UTF-8' upon creation of <code>BeautifulSoup</code> object.</p> <pre><code>import requests from bs4 import BeautifulSoup url = &quot;https://www.assemblee-nationale.fr/12/cri/2003-2004/20040001.asp&quot; r=requests.get(url) soup_data=BeautifulSoup(r.content, 'lxml') print(soup_data.prettify()) </code></pre> <p>Unfortunately, the website has a duplicate element.</p> <pre><code>&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;&gt; &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;&gt; </code></pre> <p>Upon inspection of the <code>BeautifulSoup</code> object using prettify, I realized that <code>BeautifulSoup</code> converted only one of these meta tags.</p> <pre><code>&lt;meta content=&quot;text/html; charset=utf-8&quot; http-equiv=&quot;Content-Type&quot;/&gt; &lt;meta content=&quot;text/html; charset=iso-8859-1&quot; http-eqiv=&quot;Content-Type&quot;/&gt; </code></pre> <p>I'm therefore confused what is the actual encoding of my <code>BeautifulSoup</code> object.</p> <p>Also, during data processing I realized that some of text elements of this object are not properly parsed by my PyCharm console. These strings are 'iso-8859-1' code characters. Therefore, I suspect that the object is either still in ISO encoding or even worse, somehow mixed up.</p> <p><code>['\xa0\xa0\xa0\xa0M. le président.' '\xa0\xa0\xa0\xa0M. le président.'</code></p> <p>I have seen these ISO characters for the first time after I run a numpy function.</p> <pre><code>series = np.apply_along_axis(lambda x: x[0].get_text(), 0, [df]) </code></pre> <p>Any suggestions on how to proceed from this situation? I would like to convert the object to UTF-8 (and be 100% sure it's fully in UTF-8).</p>
[ { "answer_id": 74264965, "author": "Deneb", "author_id": 2547890, "author_profile": "https://Stackoverflow.com/users/2547890", "pm_score": 0, "selected": false, "text": "EncodingDetector" }, { "answer_id": 74267432, "author": "Mark Tolonen", "author_id": 235698, "auth...
2022/10/31
[ "https://Stackoverflow.com/questions/74264812", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2758414/" ]
74,264,817
<p>so I have a string as shown below</p> <pre><code>seqs = &quot;&quot;&quot;&gt;UDW38231.1 |surface glycoprotein|MS|GenBank|ssRNA(+) MFVFLVLLPLVSSQCVNLRTRTQLPPAYTNSFTRGVYYPDKVFRSSVLHSTQDLFLPFFS NVTWFHAIHVSGTNGTKRFDNPVLPFNDGVYFASIEKSNIIRGWIFGTTLDSKTQSLIIV NNATNVVIKVCEFQFCNDPFLDVYYHKNNKSWMESGVYSSANNCTFEYVSQPFLMDLEGK QGNFKNLREFVFKNIDGYFKIYSKHTPINLVRDLPQGFSALEPLVDLPIGINITRFQTLL ALHRSYLTPGDSSSGWTAGAAAYYVGYLQPRTFLLKYNENGTITDAVDCALDPLSETKCT LKSFTVEKGIYQTSNFRVQPTESIVRFPNITNLCPFGEVFNATRFASVYAWNRKRISNCV ADYSVLYNSASFSTFKCYGVSPTKLNDLCFTNVYADSFVIRGDEVRQIAPGQTGKIADYN YKLPDDFTGCVIAWNSNNLDSKVGGNYNYRYRLFRKSNLKPFERDISTEIYQAGSKPCNG VEGFNCYFPLQSYGFQPTNGVGYQPYRVVVLSFELLHAPATVCGPKKSTNLVKNKCVNFN FNGLTGTGVLTESNKKFLPFQQFGRDIADTTDAVRDPQTLEILDITPCSFGGVSVITPGT NTSNQVAVLYQGVNCTEVPVAIHADQLTPTWRVYSTGSNVFQTRAGCLIGAEHVNNSYEC DIPIGAGICASYQTQTNSRRRARSVASQSIIAYTMSLGAENSVAYSNNSIAIPTNFTISV TTEILPVSMTKTSVDCTMYICGDSTECSNLLLQYGSFCTQLNRALTGIAVEQDKNTQEVF AQVKQIYKTPPIKDFGGFNFSQILPDPSKPSKRSFIEDLLFNKVTLADAGFIKQYGDCLG DIAARDLICAQKFNGLTVLPPLLTDEMIAQYTSALLAGTITSGWTFGAGAALQ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DLCFTNVYADSFVIRGDEVRQIAPGQTGKIADYN YKLPDDFTGCVIAWNSNNLDSKVGGNYNYRYRLFRKSNLKPFERDISTEIYQAGSKPCNG VEGFNCYFPLQSYGFQPTNGVGYQPYRVVVLSFELLHAPATVCGPKKSTNLVKNKCVNFN FNGLTGTGVLTESNKKFLPFQQFGRDIADTTDAVRDPQTLEILDITPCSFGGVSVITPGT NTSNQVAVLYQGVNCTEVPVAIHADQLTPTWRVYSTGSNVFQTRAGCLIGAEHVNNSYEC DIPIGAGICASYQTQTNSRRRARSVASQSIIAYTMSLGAENSVAYSNNSIAIPTNFTISV TTEILPVSMTKTSVDCTMYICGDSTECSNLLLQYGSFCTQLNRALTGIAVEQDKNTQEVF AQVKQIYKTPPIKDFGGFNFSQILPDPSKPSKRSFIEDLLFNKVTLADAGFIKQYGDCLG DIAARDLICAQKFNGLTVLPPLLTDEMIAQYTSALLAGTITSGWTFGAGAALQIPFAMQM AYRFNGIGVTQNVLYENQKLIANQFNSAIGKIQDSLSSTASALGKLQNVVNQNAQALNTL VKQLSSNFGAISSVLNDILSRLDKVEAEVQIDRLITGRLQSLQTYVTQQLIRAAEIRASA NLAATKMSECVLGQSKRVDFCGKGYHLMSFPQSAPHGVVFLHVTYVPAQEKNFTTAPAIC HDGKAHFPREGVFVSNGTHWFVTQRNFYEPQIITTDNTFVSGNCDVVIGIVNNTVYDPLQ PELDSFKEELDKYFKNHTSPDVDLGDISGINASVVNIQKEIDRLNEVAKNLNESLIDLQE LGKYEQYIKWPWYIWLGFIAGLIAIVMVTIMLCCMTSCCSCLKGCCSCGSCCKFDEDDSE PVLKGVKLHYT &quot;&quot;&quot; </code></pre> <p>I am using the code below to split the string into elements on a list</p> <pre><code>seq2 = seqs.replace(&quot;\n&quot;,&quot;&quot;) list = seq2.split(&quot;&gt;&quot;) print(list) </code></pre> <p>from there I just remove the first item of the list since it is blank. But what I am trying to do differently is that I want to still split the list and remove all newlines(\n) but I want to use the append function instead and end up with a list where I don't have to remove any elements but I still have each sequence neatly separated. How would I do this?</p>
[ { "answer_id": 74264922, "author": "Samwise", "author_id": 3799759, "author_profile": "https://Stackoverflow.com/users/3799759", "pm_score": 2, "selected": true, "text": "append" }, { "answer_id": 74265119, "author": "H4kim", "author_id": 7685195, "author_profile": "h...
2022/10/31
[ "https://Stackoverflow.com/questions/74264817", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16483846/" ]
74,264,823
<p>I am working on <code>old Angular js version (1.7.9)</code>. I have a following JSON string from server and need to show the data in <code>PIVOT table</code> and I am able to display the data in <code>PIVOT</code> format. I have given the html below. My issue is I need to split each comma inside <code>ng-repeat</code>. As of now the comma is showing as it is.</p> <p><em>I don't need to split last comma in json string. for eg: (&quot;G&quot;: &quot;1,37.5&quot;,) only split 1,37. What I mean, split only inside double qoutes.</em></p> <p>In <code>JSON</code> string we can see that 3,0 and 1,20 etc. I need to split each item and store in separate span tags in a cell.</p> <p>Json format</p> <pre><code>[ { &quot;NAME&quot;: &quot;d1&quot;, &quot;Pro_id&quot;: &quot;421&quot;, &quot;N&quot;: &quot;3,0&quot;, &quot;S&quot;: &quot;3,0&quot;, &quot;G&quot;: &quot;1,37.5&quot;, &quot;I&quot;: &quot;3,0&quot;, &quot;E&quot;: &quot;0&quot;, &quot;Sor&quot;: &quot;3,0&quot;, &quot;custom&quot;: &quot;3,0&quot; }, { &quot;NAME&quot;: &quot;d2&quot;, &quot;pro_id&quot;: &quot;601&quot;, &quot;N&quot;: &quot;3,0&quot;, &quot;S&quot;: &quot;1,20&quot;, &quot;G&quot;: &quot;3,0&quot;, &quot;I&quot;: &quot;3,0&quot;, &quot;E&quot;: &quot;0&quot;, &quot;S&quot;: &quot;3,0&quot;, &quot;c&quot;: &quot;3,0&quot; } ] </code></pre> <p>HTML version</p> <pre><code>&lt;table&gt; &lt;thead&gt; &lt;tr&gt; &lt;tr class=&quot;table table-success border&quot;&gt; &lt;th ng-click=&quot;Cluster(key)&quot; ng-repeat=&quot;(key, val) in DashboardSummary[0]&quot;&gt;{{ key }}&lt;/th&gt; &lt;/tr&gt; &lt;tr style=&quot;color:mediumslateblue&quot; ng-show=&quot;DashboardSummary!='undefined' &amp;&amp; DashboardSummary!='null' &amp;&amp; DashboardSummary.length!=0&quot; ng-repeat=&quot;row in DashboardSummary&quot;&gt; &lt;td style=&quot;border:0.01em outset;border-color:black&quot; ng-repeat=&quot;column in row track by $index&quot;&gt; {{ column }} &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style=&quot;border:none;&quot; ng-show=&quot;DashboardSummary=='undefined' ||DashboardSummary=='null' || DashboardSummary.length==0 &quot;&gt; No data Available. &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre> <p>In JS file I have. DashboardData.data contains above JSON data.</p> <pre><code>$scope.DashboardSummary = JSON.parse(DashboardData.data); </code></pre>
[ { "answer_id": 74264922, "author": "Samwise", "author_id": 3799759, "author_profile": "https://Stackoverflow.com/users/3799759", "pm_score": 2, "selected": true, "text": "append" }, { "answer_id": 74265119, "author": "H4kim", "author_id": 7685195, "author_profile": "h...
2022/10/31
[ "https://Stackoverflow.com/questions/74264823", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7952845/" ]
74,264,850
<p>I have a service that needs to notify the main activity. I use <code>LocalBroadcastManager</code>, and it works fine, but <code>LocalBroadcastManager</code> has been deprecated.</p> <p>This is my actual code in the service:</p> <pre><code>public void onTokenRefresh() { /* build the intent */ Intent intent = new Intent(ACTION_TOKENREFRESHED); intent.putExtra(&quot;token&quot;, &quot;xxx&quot;); /* send the data to registered receivers */ try{ LocalBroadcastManager.getInstance(this).sendBroadcast(intent); } catch (Throwable e){ //no exception handling } } </code></pre> <p>In the main activity, I get informed of the notification like this :</p> <pre><code>context.registerReceiver(broadcastReceiver, intentFilter); </code></pre> <p>What can I use now to remove the deprecated warning? All examples I found regarding sending data from service to activity use LocalBroadcastManager. Can someone give me a workable model for migrating my existing code?</p> <p><strong>NOTE</strong></p> <p>In my example, The <code>onTokenRefresh</code> is called from inside a <code>background thread</code>. That is very important because it means I can simultaneously receive several onTokenRefresh, and I must forward all these tokens to the activity. Most of the offered solutions use live data but make a declaration like :</p> <pre><code>public static final MutableLiveData&lt;String&gt; tokenLiveData = new MutableLiveData&lt;&gt;(); Background Thread1: tokenLiveData.postValue(Token1); Background Thread2 (at same time): tokenLiveData.postValue(Token2); </code></pre> <p>Will forward ALL tokens received simultaneously to the main activity that observes the tokenLiveData? Will the main activity always receive for sure token1 and token2?</p>
[ { "answer_id": 74540645, "author": "Aorlinn", "author_id": 5369727, "author_profile": "https://Stackoverflow.com/users/5369727", "pm_score": 2, "selected": false, "text": "LiveData" }, { "answer_id": 74544184, "author": "MariosP", "author_id": 14434976, "author_profil...
2022/10/31
[ "https://Stackoverflow.com/questions/74264850", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1114043/" ]
74,264,853
<p>So on a large screen I have this (using Bootstrap 5) which is fine:</p> <p><a href="https://i.stack.imgur.com/Vm6bH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Vm6bH.png" alt="enter image description here" /></a></p> <p>But as soon as I shrink the screen the text in the first column spills out over the sections below as opposed to resizing correctly.</p> <p><a href="https://i.stack.imgur.com/4wrMq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4wrMq.png" alt="enter image description here" /></a></p> <p>this was my initial code</p> <pre><code>&lt;section class=&quot;bg-overlay ratio ratio-21x9 bg-soft-blue&quot;&gt; &lt;video poster=&quot;./assets/img/photos/movie2.jpg&quot; src=&quot;./assets/media/home.mp4&quot; autoplay loop muted&gt;&lt;/video&gt; &lt;div class=&quot;video-content&quot;&gt; &lt;div class=&quot;container&quot;&gt; &lt;div class=&quot;row pt-10&quot;&gt; &lt;div class=&quot;col-lg-6 bg-soft-blue&quot;&gt; &lt;h2 class=&quot;text-uppercase heading mb-5&quot;&gt;Title&lt;/h2&gt; &lt;p class=&quot;lead fs-lg lh-sm&quot;&gt;Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. &lt;/p&gt; &lt;span&gt;&lt;a href=&quot;#&quot; class=&quot;text-uppercase btn btn-outline-primary rounded-pill&quot; data-bs-toggle=&quot;modal&quot; data-bs-target=&quot;#modal-signup&quot;&gt;Read More&lt;/a&gt;&lt;/span&gt; &lt;/div&gt; &lt;div class=&quot;col-lg-6&quot;&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;!-- /.container --&gt; &lt;/div&gt; &lt;!-- /.video-content --&gt; &lt;/section&gt; </code></pre> <p>I have tried playing with it like this:</p> <pre><code>&lt;section&gt; &lt;div class=&quot;row pt-10&quot; class=&quot;bg-soft-blue&quot;&gt; &lt;div class=&quot;col-lg-6 bg-soft-blue&quot;&gt; &lt;h2 class=&quot;text-uppercase heading mb-5&quot;&gt;Title&lt;/h2&gt; &lt;p class=&quot;lead fs-lg lh-sm&quot;&gt;Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. &lt;/p&gt; &lt;span&gt;&lt;a href=&quot;#&quot; class=&quot;text-uppercase btn btn-outline-primary rounded-pill&quot; data-bs-toggle=&quot;modal&quot; data-bs-target=&quot;#modal-signup&quot;&gt;Button&lt;/a&gt;&lt;/span&gt; &lt;/div&gt; &lt;div class=&quot;col-lg-6 bg-overlay ratio ratio-4x3 &quot;&gt; &lt;video poster=&quot;./assets/img/photos/movie2.jpg&quot; src=&quot;./assets/media/home.mp4&quot; autoplay loop muted&gt;&lt;/video&gt; &lt;div class=&quot;video-content&quot;&gt; &lt;div class=&quot;container&quot;&gt; video here &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;!-- /.container --&gt; &lt;/div&gt; &lt;!-- /.video-content --&gt; &lt;/section&gt; &lt;!-- /section --&gt; </code></pre> <p>But that actually makes it worse as it splits it into two sections. I tried an embed but then it doesn't auto play. I am ok if the video doesn't work on small screens and is just an image, but i need it to be responsive. I assume its a position issue in the first column, or maybe its just not doable. Any help appreciated.</p>
[ { "answer_id": 74540645, "author": "Aorlinn", "author_id": 5369727, "author_profile": "https://Stackoverflow.com/users/5369727", "pm_score": 2, "selected": false, "text": "LiveData" }, { "answer_id": 74544184, "author": "MariosP", "author_id": 14434976, "author_profil...
2022/10/31
[ "https://Stackoverflow.com/questions/74264853", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2820910/" ]
74,264,855
<p>I need to break date span into quarter of the year. I'm using the below query in main query but as the maximum value reached in the cross apply statement I'm not getting the latest quarter's from the select statement. How to increase the number dynamically in the Values of the select statement. I suppose to get 2022Q2, 2022Q3 and currently its 2022Q4 but the query stopped at 2022Q1 because the Values in the select statement is 12 maximum.</p> <pre class="lang-sql prettyprint-override"><code>Select CAST(YEAR(DATEADD(QQ,n,'2019-01-01')) AS VARCHAR(4)) + 'Q' + DATENAME(qq,DATEADD(QQ,n,'3000-12-31')) as Year_Quarter from( SELECT TOP(1+DATEDIFF(QQ,'2019-01-01','2999-12-31')) n FROM (VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12)) rc(n)) as x order by 1 </code></pre> <pre class="lang-none prettyprint-override"><code>2019Q1 2019Q2 2019Q3 2019Q4 2020Q1 2020Q2 2020Q3 2020Q4 2021Q1 2021Q2 2021Q3 2021Q4 2022Q1 </code></pre> <p>I tried adding the numbers to the Values then getting</p> <pre class="lang-sql prettyprint-override"><code>Select CAST(YEAR(DATEADD(QQ,n,'2019-01-01')) AS VARCHAR(4)) + 'Q' + DATENAME(qq,DATEADD(QQ,n,'3000-12-31')) as Year_Quarter from( SELECT TOP(1+DATEDIFF(QQ,'2019-01-01','2999-12-31')) n FROM (VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14),(15)) rc(n)) as x order by 1 </code></pre> <p>I want the Values in the inner select to add dynamically to get the current quarter.</p> <pre class="lang-none prettyprint-override"><code>2019Q1 2019Q2 2019Q3 2019Q4 2020Q1 2020Q2 2020Q3 2020Q4 2021Q1 2021Q2 2021Q3 2021Q4 2022Q1 2022Q2 2022Q3 2022Q4 </code></pre>
[ { "answer_id": 74540645, "author": "Aorlinn", "author_id": 5369727, "author_profile": "https://Stackoverflow.com/users/5369727", "pm_score": 2, "selected": false, "text": "LiveData" }, { "answer_id": 74544184, "author": "MariosP", "author_id": 14434976, "author_profil...
2022/10/31
[ "https://Stackoverflow.com/questions/74264855", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17386545/" ]
74,264,880
<p>How to exclude a JSON property from comparison in <code>FluentAssertions.Json</code>?</p> <pre class="lang-cs prettyprint-override"><code>JToken token, expectedJson; token.Should().BeEquivalentTo(expectedJson); </code></pre> <pre class="lang-json prettyprint-override"><code>{ &quot;property1&quot;:&quot;value1&quot;, &quot;property2&quot;:&quot;value2&quot;, &quot;property3&quot;:&quot;value3&quot; } </code></pre> <p>I want to exclude property with name &quot;property2&quot; from the comparison. How is it possible?</p>
[ { "answer_id": 74289361, "author": "Andrej B.", "author_id": 136236, "author_profile": "https://Stackoverflow.com/users/136236", "pm_score": 1, "selected": true, "text": "JToken token, expectedJson;\n((JValue)expectedJson.SelectToken(\"property2\")).Value = null;\n((JValue)token.SelectTo...
2022/10/31
[ "https://Stackoverflow.com/questions/74264880", "https://Stackoverflow.com", "https://Stackoverflow.com/users/136236/" ]
74,264,951
<p>I have a dataframe in which I want to filter to rows where at least one of 3 different columns has value &quot;D&quot;</p> <p>Sample df:</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>identifier</th> <th>def</th> <th>abc</th> <th>ghi</th> </tr> </thead> <tbody> <tr> <td>1</td> <td>D</td> <td>C</td> <td>A</td> </tr> <tr> <td>2</td> <td>A</td> <td>D</td> <td>D</td> </tr> <tr> <td>3</td> <td>B</td> <td>C</td> <td>A</td> </tr> <tr> <td>4</td> <td>A</td> <td>D</td> <td>A</td> </tr> </tbody> </table> </div> <p>I want my output to be:</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>identifier</th> <th>def</th> <th>abc</th> <th>ghi</th> </tr> </thead> <tbody> <tr> <td>1</td> <td>D</td> <td>C</td> <td>A</td> </tr> <tr> <td>2</td> <td>A</td> <td>D</td> <td>D</td> </tr> <tr> <td>4</td> <td>A</td> <td>D</td> <td>A</td> </tr> </tbody> </table> </div> <p>I would like to use dplyr filter() but couldn't find how to filter to exactly what I need</p>
[ { "answer_id": 74289361, "author": "Andrej B.", "author_id": 136236, "author_profile": "https://Stackoverflow.com/users/136236", "pm_score": 1, "selected": true, "text": "JToken token, expectedJson;\n((JValue)expectedJson.SelectToken(\"property2\")).Value = null;\n((JValue)token.SelectTo...
2022/10/31
[ "https://Stackoverflow.com/questions/74264951", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18865803/" ]
74,264,956
<p>Let's start with a straightforward definition of <code>foldRight</code>:</p> <pre class="lang-scala prettyprint-override"><code>def foldRight[T, U](base: U)(f: (T, =&gt; U) =&gt; U)(as: Seq[T]): U = { as match { case Nil =&gt; base case head +: next =&gt; f(head, foldRight(base)(f)(next)) } } </code></pre> <p>One of the advantages of such combinator is that it allows us to write something like (I use an <code>if</code> to make the short-circuiting behaviour of <code>||</code> more explicit):</p> <pre class="lang-scala prettyprint-override"><code>def containsElement[T](e: T)(as: Seq[T]): Boolean = { foldRight(false)((el: T, acc) =&gt; if (el == e) true else acc)(as) } </code></pre> <p>Which then works with infinite structures:</p> <pre class="lang-scala prettyprint-override"><code>val bs = 0 #:: 1 #:: 2 #:: 3 #:: LazyList.continually(1) containsElement(3)(bs) </code></pre> <hr /> <p>However, it doesn't work with very <em>looooong</em> sequences, because we are blowing up the stack:</p> <pre class="lang-scala prettyprint-override"><code>val veryLongList = List.fill(1_000_000)(0) :+ 3 containsElement(3)(veryLongList) </code></pre> <p>... would result in a <code>java.lang.StackOverflowError</code>.</p> <hr /> <p>Enter the <code>scala.util.control.TailCalls</code>. We can write a very specialised implementation of <code>containsElement</code> that takes advantage of TCO, such as:</p> <pre class="lang-scala prettyprint-override"><code>def containsElement[T](e: T)(as: Seq[T]) = { import scala.util.control.TailCalls._ def _rec(as: Seq[T]): TailRec[Boolean] = { as match { case Nil =&gt; done(false) case head +: next =&gt; if (head == e) done(true) else _rec(next) } } _rec(as).result } </code></pre> <hr /> <p>But now I want to generalize this to <code>foldRight</code>. The following code was as far as I got via incremental refactoring, but if I keep following this path, I will bump into the fact that I would need to change the <code>f</code> signature to <code>f: (T, =&gt; TailRec[U]) =&gt; U</code> which is <em>not</em> what I wanted at all:</p> <pre class="lang-scala prettyprint-override"><code>def containsElement[T](e: T)(as: Seq[T]) = { import scala.util.control.TailCalls._ val base = false def f(head: T, next: =&gt; TailRec[Boolean]): TailRec[Boolean] = if (head == e) done(true) else next def _rec(as: Seq[T]): TailRec[Boolean] = { as match { case Nil =&gt; done(base) case head +: next =&gt; f(head, _rec(next)) } } _rec(as).result } </code></pre> <hr /> <p><strong>Question:</strong> how can we create an implementation of <code>foldRight</code> that (a) preserves the <code>[T, U](base: U)(f: (T, =&gt; U) =&gt; U)(as: Seq[T]): U</code> signature, (b) works on infinite structures, and (c) doesn't blow up with a <code>StackOverflowError</code> in very long structures?</p>
[ { "answer_id": 74311435, "author": "Andrey Tyukin", "author_id": 2707792, "author_profile": "https://Stackoverflow.com/users/2707792", "pm_score": 3, "selected": true, "text": "def foldRight[T, U](base: U)(f: (T, => U) => U)(as: Seq[T]): U\n" }, { "answer_id": 74336190, "auth...
2022/10/31
[ "https://Stackoverflow.com/questions/74264956", "https://Stackoverflow.com", "https://Stackoverflow.com/users/41652/" ]
74,264,961
<p>The dialog widget is stateless widget, so I Thought I could make the Dialog to Stateful widget by using <code>statefulbuilder</code>. So I made the code like this</p> <pre><code>import 'package:flutter/material.dart'; class TestDialog extends StatefulWidget { const TestDialog({Key? key}) : super(key: key); @override State&lt;TestDialog&gt; createState() =&gt; _TestDialogState(); } class _TestDialogState extends State&lt;TestDialog&gt; { int i=0; Future&lt;void&gt; showpopup (context) async { showDialog( context: context, builder: (context){ return Dialog( child: StatefulBuilder(builder: (BuildContext context, StateSetter setstate){ return Column( children: [ Row( children: [ GestureDetector( child: Container( child : Text(i.toString()) ), onTap: (){ setState(() { i++; }); }, ) ], ) ], ); }), ); } ); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text('stateful dialog'), ), body: Column( children: [ GestureDetector( child: Text('yeah'), onTap: (){ showpopup(context); }, ) ], ), ); } } </code></pre> <p>but in the dialog, the number doesn't change. After I close the dialog and open again, now it shows the change. How can I use <code>statefulbuilder</code> properly? Or is <code>statefulbuilder</code> not valid on this code?</p> <p>I tried the Future&lt;void&gt; to void but it is as same as first.</p>
[ { "answer_id": 74265128, "author": "Ivo", "author_id": 1514861, "author_profile": "https://Stackoverflow.com/users/1514861", "pm_score": 1, "selected": false, "text": " setState(() {\n i++;\n });\n" }, { "answer_id": 74265160, "author": "Rohan Jariwala", "author_id":...
2022/10/31
[ "https://Stackoverflow.com/questions/74264961", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19994708/" ]
74,264,985
<p>I want to add a link, in a component, that points to a PDF document that resides in the application codebase:</p> <pre><code>const SomeComponent = () =&gt; { ... return &lt;a href=&quot;../../shared-assets/some-pdf.pdf&quot;&gt;Download&lt;/a&gt; } </code></pre> <p>I have added it to both the <code>public</code> folder and also tried in a custom folder (<code>shared-assets</code>) in the root of the project. Both time it just wasn't finding the file - probably because the route for this file doesn't exist (not sure how I would set this up).</p> <p>I also tried importing it like an image but this threw an error in the terminal &quot;No loader is configured for '.pdf' files&quot;.</p> <pre><code>import somePdf from '../../shared-assets/some-pdf.pdf'; ... &lt;a href={somePdf}&gt;Download&lt;/a&gt; </code></pre> <p>So how do I get this working?</p>
[ { "answer_id": 74269388, "author": "Kiliman", "author_id": 293609, "author_profile": "https://Stackoverflow.com/users/293609", "pm_score": 1, "selected": false, "text": "<a href=\"/shared-assets/some-pdf.pdf\">Download</a>" }, { "answer_id": 74332702, "author": "JoeTidee", ...
2022/10/31
[ "https://Stackoverflow.com/questions/74264985", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3111255/" ]
74,264,989
<p>Given this DataFrame:</p> <pre><code>data = [['Tom', 'run', '2022-01-26', 'run', '2027-01-26'], ['Max', 'stop', '2020-11-16', 'run', '2022-04-26'], ['Bob', 'run', '2021-10-03', 'stop', '2022-01-26'], ['Ben', 'run', '2020-03-11', 'stop', '2013-01-26'], ['Eva', 'stop', '2017-11-16', 'run', '2015-01-26']] df = pd.DataFrame(data, columns=['Patient', '1_Action', '1_Time', '2_Action', '2_Time']) Patient 1_Action 1_Time 2_Action 2_Time 0 Tom run 2022-01-26 run 2027-01-26 1 Max stop 2020-11-16 run 2022-04-26 2 Bob run 2021-10-03 stop 2022-01-26 3 Ben run 2020-03-11 stop 2013-01-26 4 Eva stop 2017-11-16 run 2015-01-26 </code></pre> <p>I want it to look like:</p> <pre><code> Patient action time 0 Tom run 2022-01-26 1 Max stop 2020-11-16 2 Bob run 2021-10-03 3 Ben run 2020-03-11 4 Eva stop 2017-11-16 5 Tom run 2027-01-26 6 Max run 2022-04-26 7 Bob stop 2022-01-26 8 Ben stop 2013-01-26 9 Eva run 2015-01-26 </code></pre> <p>There is a really good answer from @BeRT2me, including the wide_to_long format:</p> <pre><code>df = pd.wide_to_long(df, stubnames=['action', 'time'], i='patient', j='num', sep='_').reset_index() </code></pre> <p>But my column names don't match the solution, they should be: action_1, but they are 1_Action.</p> <p>The Error message I get is: Value error: the id variables need to be uniquely identify each row.</p> <p>Is there a way to rename my column names, that they are matching the solution, (Dataframe has about 45 columns so the manual renaming is not an option), or can I change the solution code to work with my given column names?</p>
[ { "answer_id": 74269388, "author": "Kiliman", "author_id": 293609, "author_profile": "https://Stackoverflow.com/users/293609", "pm_score": 1, "selected": false, "text": "<a href=\"/shared-assets/some-pdf.pdf\">Download</a>" }, { "answer_id": 74332702, "author": "JoeTidee", ...
2022/10/31
[ "https://Stackoverflow.com/questions/74264989", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19526103/" ]
74,264,990
<p>The rule is I need to display the odd number between two number that the user inputted.</p> <p>But my code have problem.</p> <p>For example when i input: 3 and 11 The output is 5 7 9 11</p> <p>11 should not be included because that's what the user input even it is odd number. The rule is between. 5 7 9 is my target.</p> <p>i'm thinking if it's because of my formula or the way i increment it.</p> <p>First try: i increment numOne before &quot;if&quot;</p> <pre><code>#include &lt;iostream&gt; using namespace std; int main() { int numOne,numTwo; cout &lt;&lt; &quot;Please Enter First Number : &quot;; cin &gt;&gt; numOne; cout &lt;&lt; &quot;Please Enter Second Number ( Should be greater than first number) : &quot; ; cin &gt;&gt; numTwo; cout &lt;&lt; &quot;Odd Numbers Between are: &quot;; while (numOne&lt;numTwo) { numOne++; if ( numOne % 2 == 1) { cout&lt;&lt;numOne&lt;&lt;&quot; &quot;; } } return 0; } </code></pre> <p>The output is: 5 7 9 11</p> <p>-still wrong because 11 should not be include- :(</p> <p>**Second try: i increment numOne below &quot;if&quot;</p> <pre><code>#include &lt;iostream&gt; using namespace std; int main() { int numOne, numTwo; cout &lt;&lt; &quot;Please Enter First Number : &quot;; cin &gt;&gt; numOne; cout &lt;&lt; &quot;Please Enter Second Number ( Should be greater than first number) : &quot; ; cin &gt;&gt; numTwo; cout &lt;&lt; &quot;Odd Numbers Between are: &quot;; while (numOne&lt;numTwo) { if ( numOne % 2 == 1) { cout&lt;&lt;numOne&lt;&lt;&quot; &quot;; } numOne++; } return 0; } </code></pre> <p>The output is: 3 5 7 9</p> <p>-before 11 is the problem but now it's gone when i incremented below.. But it is still wrong because 3 should not be included also- :(</p> <p>3 and 11 is the users input.. Even it is odd it should not be included.. Only the odd number &quot;between them&quot;. &quot;5 7 9&quot;</p>
[ { "answer_id": 74265056, "author": "Chris", "author_id": 15261315, "author_profile": "https://Stackoverflow.com/users/15261315", "pm_score": 3, "selected": true, "text": "numOne" }, { "answer_id": 74265198, "author": "molbdnilo", "author_id": 404970, "author_profile":...
2022/10/31
[ "https://Stackoverflow.com/questions/74264990", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20380067/" ]
74,265,000
<p>I can't make i18next use yaml files for translation. Everything works fine with .json, but not with .yml I have no errors just no translation.</p> <p>My i18n.ts is:</p> <pre><code>import i18n from 'i18next' import {initReactI18next} from 'react-i18next' const translation = require('./enyaml.yml') export const resources = { en: { translation, }, } i18n.use(initReactI18next).init({ resources, lng: 'en', fallbackLng: 'en', interpolation: { escapeValue: false, }, }) </code></pre> <p>As I can see this is some trouble with import or support of yaml files. Really appreciate any advices.</p>
[ { "answer_id": 74265056, "author": "Chris", "author_id": 15261315, "author_profile": "https://Stackoverflow.com/users/15261315", "pm_score": 3, "selected": true, "text": "numOne" }, { "answer_id": 74265198, "author": "molbdnilo", "author_id": 404970, "author_profile":...
2022/10/31
[ "https://Stackoverflow.com/questions/74265000", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11245102/" ]
74,265,025
<p>My website creates a new non-existent website, after I visit my website/näytä_luokka/# (also, class_id). If I try to go to a page that is in the same urls.py file, I get an error because it tries to find a page website/näytä_luokka/luokat instead of going to website/luokat. This happens through navbar. If I try to go to a link that is in another urls.py, everything works fine. Switching from /luokat to other pages works also fine.</p> <p>I am using django to create website.</p> <p>So, here's a couple examples from my</p> <p><strong>urls.py</strong></p> <pre><code>from django.urls import path from . import views urlpatterns = [ path('näytä_luokka/&lt;luokka_id&gt;', views.näytä_luokka, name=&quot;näytä-luokka&quot;), path('luokat', views.kaikki_luokat, name=&quot;luokat&quot;), ] </code></pre> <p><strong>and .views</strong></p> <pre><code>def näytä_luokka(request, luokka_id): luokkalistaus = luokka.objects.get(pk=luokka_id) return render(request, 'tietokanta/näytä_luokat.html', {'luokkalistaus': luokkalistaus}) </code></pre> <pre><code>def kaikki_luokat(request): luokkalista = luokka.objects.all().order_by('nimi') return render(request, 'tietokanta/luokat.html', {'luokkalista': luokkalista}) </code></pre> <p><strong>the navbar</strong></p> <pre><code> &lt;/li&gt; &lt;li class=&quot;nav-item&quot;&gt; &lt;a class=&quot;nav-link&quot; href=&quot;luokat&quot;&gt;Luokat&lt;/a&gt; &lt;/li&gt; </code></pre> <p>I tried adding / after id number, but id didn't do anything.</p>
[ { "answer_id": 74266058, "author": "raphael", "author_id": 10951070, "author_profile": "https://Stackoverflow.com/users/10951070", "pm_score": 3, "selected": true, "text": "path('näytä_luokka/<luokka_id>', views.näytä_luokka, name=\"näytä-luokka\")," }, { "answer_id": 74266477, ...
2022/10/31
[ "https://Stackoverflow.com/questions/74265025", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20367848/" ]
74,265,057
<p>How can I change .a? to &quot;any key&quot;? Like I wish I could put * instead of a.</p> <pre><code>'[[{&quot;a&quot;:&quot;hi there&quot;}]]' | jq '..|select(.a?|contains(&quot;hi&quot;))' { &quot;a&quot;: &quot;hi there&quot; } </code></pre> <p>Or this nested object input?</p> <pre><code>'[[{&quot;a&quot;:&quot;hi there&quot;,&quot;b&quot;:{&quot;c&quot;:&quot;hi again&quot;}}]]' | jq '..|select(.a?|contains(&quot;hi&quot;))' { &quot;a&quot;: &quot;hi there&quot;, &quot;b&quot;: { &quot;c&quot;: &quot;hi again&quot; } } jq: error (at &lt;stdin&gt;:1): null (null) and string (&quot;hi&quot;) cannot have their containment checked </code></pre>
[ { "answer_id": 74266058, "author": "raphael", "author_id": 10951070, "author_profile": "https://Stackoverflow.com/users/10951070", "pm_score": 3, "selected": true, "text": "path('näytä_luokka/<luokka_id>', views.näytä_luokka, name=\"näytä-luokka\")," }, { "answer_id": 74266477, ...
2022/10/31
[ "https://Stackoverflow.com/questions/74265057", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6654942/" ]
74,265,064
<p><strong>Why yet another question on string to hash conversion</strong></p> <p>My question is basically the same as the popular <a href="https://stackoverflow.com/questions/347949/how-to-convert-a-stdstring-to-const-char-or-char?rq=1">How to convert a std::string to const char* or char*</a> question, but with a twist. I need the hash at compile time. Before rejecting my question, let me briefly explain my motivation.</p> <p><strong>Motivation</strong></p> <p>In my framework I am building, I have many threads. I have carefully designed the file structure so these threads re-use files whose functionality are the same so as not to violate ODR and lose maintainability. At the top of the list is error logging. My elaborate code begs to be re-used as-is in these different apps. So the initialized <strong>errorLogger</strong> object needs to be a different instance for each thread.</p> <p><strong>Proposed solution</strong></p> <p>Templatize my <strong>ErrorLogger</strong> class with a constant non-type parameter. In my framework, each app has a unique string that identifies itself. Now if I could hash that string at compile time, I would have the non-type template parameter I need for the compiler to generate separate instances.</p> <p>Here is the example code that doesn't work:</p> <pre><code>#include &lt;string&gt; std::string threadUniqueStr { &quot;threadUniqueName&quot; }; /*constexpr*/ auto threadUniqueHash = std::hash&lt; std::string &gt; {} ( threadUniqueStr ); // uncommented constexpr results in 'expression did not evaluate to a constant' template&lt; size_t &gt; void Func() {} int main() { //Func&lt; threadUniqueHash &gt;(); // ERROR: expression did not evaluate to a constant Func&lt; 33 &gt;(); // works fine } </code></pre> <p>But maybe there is an easier C++ way to do this that I am overlooking?</p> <p><strong>Edit 1: My Solution</strong></p> <p><em>Answer 1</em> shows how to create a hash from a string using string_view which follows @NathanOliver's advice that you have to write your own hash function for it to be constexpr. But I understand that writing your own hash function can have problems. @Pepijn Kramer points out 1) two strings may still produce the same hash and 2) from his experience, that a class hierarchy featuring app reporting at the top and individual error reporting behavior derived classes served his purposes in multi-dev situations (like mine). Since I don't want to use templates non-type parameter feature in an un-tried manner even though I can make a case for it, I am going to create my own <strong>ErrorLogger</strong> class hierarchy. Thanks to all for your helpful input.</p> <p><strong>Edit 2: My Solution 2</strong></p> <p>I ended up using my original design for my error logger. <em>Answer 1</em>'s string_view hash lets me constexpr a unique enough hash number which I use to create explicit template specializations, one for each named project. The ErrorLogger code itself is put into a static inside the specialization. Here is what the coding structure looks like:</p> <pre><code>// .h template&lt; size_t ProjectNameNumT &gt; // primary non-type template global func void INFOMSG(); template&lt; size_t ProjectNameNumT &gt; void INFOMSG( bool yesNo ); // 2nd primary template; 1st overload </code></pre> <pre><code>// global define in Proj A ErrorLogger&lt; PROJ_A_HASH &gt; errorLoggerProjA; </code></pre> <pre><code>// global define in Proj B ErrorLogger&lt; PROJ_B_HASH &gt; errorLoggerProjB; </code></pre> <pre><code>// .cpp template&lt;&gt; void INFOMSG&lt; PROJ_A_HASH &gt;() { errorLoggerProjA.initLoggerHasRun = true; // set bool in specialization A specialization } </code></pre> <pre><code>// .cpp template&lt;&gt; void INFOMSG&lt; PROJ_B_HASH &gt;() { errorLoggerProjB.initLoggerHasRun = true; // set bool in specialization B specialization } </code></pre> <pre><code>// .cpp template&lt;&gt; void INFOMSG&lt; PROJ_B_HASH &gt;( bool yesNo ) { errorLogger.initLoggerHasRun = yesNo; // uses } </code></pre> <pre><code>// dev user's interface INFOMSG&lt; PROJ_A_HASH &gt;(); // sets bool to true in A INFOMSG&lt; PROJ_B_HASH &gt;(); // sets bool to true in B INFOMSG&lt; PROJ_A_HASH &gt;( false ); // sets bool in A to whatever yesNo value which is false here </code></pre> <p>The ODR goal was achieved without sacrificing dev interface ease-of-use.</p>
[ { "answer_id": 74265332, "author": "jwezorek", "author_id": 1413244, "author_profile": "https://Stackoverflow.com/users/1413244", "pm_score": 2, "selected": true, "text": "string_view" }, { "answer_id": 74265694, "author": "SHR", "author_id": 2852165, "author_profile"...
2022/10/31
[ "https://Stackoverflow.com/questions/74265064", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2608530/" ]
74,265,118
<p>I have a dataframe with wide format named <code>df</code>.</p> <p>And I want to tranform it into long format named <code>df2</code>.</p> <p><strong>I do not know how to change <code>df</code> to <code>df2</code> with <code>pivot_longer()</code> function in one step.</strong></p> <p>Any help will be highly appreciated!</p> <pre class="lang-r prettyprint-override"><code>df = data.frame( x.a = 1:3, x.b = 4:6, y.a = 1:3, y.b = 4:6 ) df #&gt; x.a x.b y.a y.b #&gt; 1 1 4 1 4 #&gt; 2 2 5 2 5 #&gt; 3 3 6 3 6 df2 = data.frame( x = 1:6, y = 1:6, type = c('a', 'a', 'a', 'b', 'b', 'b') ) df2 #&gt; x y type #&gt; 1 1 1 a #&gt; 2 2 2 a #&gt; 3 3 3 a #&gt; 4 4 4 b #&gt; 5 5 5 b #&gt; 6 6 6 b </code></pre> <p><sup>Created on 2022-10-31 by the <a href="https://reprex.tidyverse.org" rel="nofollow noreferrer">reprex package</a> (v2.0.1)</sup></p>
[ { "answer_id": 74265154, "author": "Maël", "author_id": 13460602, "author_profile": "https://Stackoverflow.com/users/13460602", "pm_score": 3, "selected": true, "text": "names_to" }, { "answer_id": 74266660, "author": "akrun", "author_id": 3732271, "author_profile": "...
2022/10/31
[ "https://Stackoverflow.com/questions/74265118", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11636376/" ]
74,265,123
<p><a href="https://i.stack.imgur.com/0hozk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0hozk.png" alt="error screenshot" /></a></p> <p>Hi there, I have installed Python 3.10.8 from Microsoft store and installed Pandas (via pip), but still got this message. Thanks</p>
[ { "answer_id": 74265154, "author": "Maël", "author_id": 13460602, "author_profile": "https://Stackoverflow.com/users/13460602", "pm_score": 3, "selected": true, "text": "names_to" }, { "answer_id": 74266660, "author": "akrun", "author_id": 3732271, "author_profile": "...
2022/10/31
[ "https://Stackoverflow.com/questions/74265123", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12527812/" ]
74,265,143
<p>I am working in wpf mvvm app, and I also use Community toolkit.mvvm also. Here I implement Observable validator for textboxes but it does not effect on user interface,</p> <p>ViewModel:</p> <pre><code> public partial class UserViewModel : ObservableValidator { [ObservableProperty] [Required(ErrorMessage =&quot;Name is Required&quot;)] [MinLength(3)] private string name= &quot;&quot;; } </code></pre> <p>Xaml:</p> <pre><code> &lt;TextBox Text=&quot;{Binding Name,UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}&quot;/&gt; </code></pre> <p>When I type on textbox less than 3 character and leave it It does not effect, The TextBox accept characters in every range and also accept empty.</p>
[ { "answer_id": 74265154, "author": "Maël", "author_id": 13460602, "author_profile": "https://Stackoverflow.com/users/13460602", "pm_score": 3, "selected": true, "text": "names_to" }, { "answer_id": 74266660, "author": "akrun", "author_id": 3732271, "author_profile": "...
2022/10/31
[ "https://Stackoverflow.com/questions/74265143", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18528942/" ]
74,265,145
<p><a href="https://i.stack.imgur.com/08hGQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/08hGQ.png" alt="onclick does not open the folder" /></a></p> <p>When I use onclick on a button to send me to a new site inside of a folder it does not work and returns</p> <pre><code>Cannot GET /teamedit_teams.html </code></pre> <p>I know its to-do with the folder as I tested it without and I am quite stumped if anyone knows what's going on and could help that would be much appreciated also I am aware that it is possible that I am just being dumb and don't know what's going on lol</p>
[ { "answer_id": 74265154, "author": "Maël", "author_id": 13460602, "author_profile": "https://Stackoverflow.com/users/13460602", "pm_score": 3, "selected": true, "text": "names_to" }, { "answer_id": 74266660, "author": "akrun", "author_id": 3732271, "author_profile": "...
2022/10/31
[ "https://Stackoverflow.com/questions/74265145", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20380291/" ]
74,265,157
<p>I have an array of Notes that I get from my database, the notes objects each have a category assigned to it. There are also buttons that allow the user to filter the notes by category and only render the ones with the corresponding one.</p> <p>Now, it's all working pretty well but there's one annoying thing that I can't get rid of: whenever I click on any of the buttons: <code>&lt;button onClick={() =&gt; {handleClick(categoryItem.category)}}&gt;{categoryItem.category}&lt;/button&gt;</code>, the filterNotes() function is only called on the second click. I suspect it has to do something with me calling setState() twice, or maybe with the boolean that I set in the functions, but I tried various combinations to call the function on the first click, but to no avail so far.</p> <p>Here's my MainArea code:</p> <pre><code>import React, { useState, useEffect } from &quot;react&quot;; import Header from &quot;./Header&quot;; import Footer from &quot;./Footer&quot;; import ListCategories from &quot;./ListCategories&quot;; import Note from &quot;./Note&quot;; import axios from &quot;axios&quot; function CreateArea(props) { const [isExpanded, setExpanded] = useState(false); const [categories, setCategories] = useState([]) const [notes, setNotes] = useState([]) const [fetchB, setFetch] = useState(true) const [filterOn, setFilter] = useState(false) const [note, setNote] = useState({ title: &quot;&quot;, content: &quot;&quot;, category: '' }); useEffect(() =&gt; { fetch('http://localhost:5000/categories') .then(res =&gt; res.json()) .then(json =&gt; setCategories(json)) }, []) useEffect(() =&gt; { if(fetchB) { fetch('http://localhost:5000/notes') .then(res =&gt; res.json()) .then(json =&gt; { console.log(json) setNotes(json) setFetch(false) }) } }, [fetchB]) function handleChange(event) { const { name, value } = event.target; console.log(&quot;handleChange called&quot;) setNote(prevNote =&gt; { return { ...prevNote, [name]: value }; }); } function submitNote(e){ e.preventDefault(); axios.post(&quot;http://localhost:5000/notes/add-note&quot;, note) .then((res) =&gt; { setNote({ category: '', title: &quot;&quot;, content: &quot;&quot; }) setFetch(true) console.log(&quot;Note added successfully&quot;); console.log(note) }) .catch((err) =&gt; { console.log(&quot;Error couldn't create Note&quot;); console.log(err.message); }); } function expand() { setExpanded(true); } function filterNotes(category){ if(filterOn){ fetch('http://localhost:5000/notes') .then(res =&gt; res.json()) .then(json =&gt; { console.log(&quot;filter notes&quot;) setNotes(json) setNotes(prevNotes =&gt; { console.log(&quot;setNotes called with category &quot; + category) return prevNotes.filter((noteItem) =&gt; { return noteItem.category === category; }); }); setFilter(false) }) } } return ( &lt;div&gt; &lt;Header/&gt; &lt;ListCategories categories={categories} notes={notes} filterNotes={filterNotes} setFilter={setFilter} filterOn={filterOn} setFetch={setFetch}/&gt; &lt;form className=&quot;create-note&quot;&gt; {isExpanded &amp;&amp; ( &lt;input name=&quot;title&quot; onChange={handleChange} value={note.title} placeholder=&quot;Title&quot; /&gt; )} &lt;textarea name=&quot;content&quot; onClick={expand} onChange={handleChange} value={note.content} placeholder=&quot;Take a note...&quot; rows={isExpanded ? 3 : 1} /&gt; &lt;select name=&quot;category&quot; onChange={handleChange} value={note.category}&gt; { categories.map(function(cat) { return &lt;option key={cat.category} value={cat.value} &gt; {cat.category} &lt;/option&gt;; }) } &lt;/select&gt; &lt;button onClick={submitNote}&gt;Add&lt;/button&gt; &lt;/form&gt; &lt;Note notes={notes} setFetch={setFetch}/&gt; &lt;Footer/&gt; &lt;button onClick={()=&gt;{setFetch(true)}}&gt;All&lt;/button&gt; &lt;/div&gt; ); } export default CreateArea; </code></pre> <p>And ListCategories where I get call the function and get the chosen category from the buttons:</p> <pre><code>import React, { useState } from &quot;react&quot;; import CreateCategory from &quot;./CreateCategory&quot;; export default function ListCategories(props) { function handleClick(category){ props.setFilter(true) props.filterNotes(category) } return ( &lt;div className=&quot;category-group&quot;&gt; &lt;CreateCategory/&gt; &lt;div className=&quot;btn-group&quot;&gt; {props.categories.map((categoryItem, index) =&gt;{ return( &lt;button onClick={() =&gt; {handleClick(categoryItem.category)}}&gt;{categoryItem.category}&lt;/button&gt; ) })} &lt;/div&gt; &lt;/div&gt; ) } </code></pre> <p>I'm not sure what the best practice is with such behaviour - do I get the notes from the database each time as I'm doing now or should I do something completely different to avoid the double-click function call?</p> <p>Thanks in advance for any suggestions!</p>
[ { "answer_id": 74265538, "author": "damonholden", "author_id": 17670742, "author_profile": "https://Stackoverflow.com/users/17670742", "pm_score": 3, "selected": true, "text": "function handleClick(category){\n props.setFilter(true)\n props.filterNotes(category)\n }\n" }, { ...
2022/10/31
[ "https://Stackoverflow.com/questions/74265157", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17965573/" ]
74,265,164
<p>I've got some code provided by a vendor that I'm using and its typedef'ing an enum with <code>__attribute__((aligned(1), packed))</code> and GCC is complaining about the multiple attributes:</p> <pre><code>error: ignoring attribute 'packed' because it conflicts with attribute 'aligned' [-Werror=attributes] </code></pre> <p>Not sure what the best approach is here. I feel like both of these attributes are not necessary. Would aligned(1) not also make it packed? And is this even necessary for an enum? Wouldn't it be best to have the struct that this enum goes into be packed?</p> <p>Thanks!</p> <p>I've removed the packed attribute and that works to make GCC happy but I want to make sure that it will still behave the same. This is going into an embedded system that relies on memory mapped registers so I need the mappings to be correct or else things won't work.</p> <p>Here's an example from the code supplied by the vendor:</p> <pre><code>#define DMESCC_PACKED __attribute__ ((__packed__)) #define DMESCC_ENUM8 __attribute__ ((aligned (1), packed)) typedef enum DMESCC_ENUM8 {DMESCC_OFF, DMESCC_ON} dmescc_bittype_t; typedef volatile struct { dmescc_bittype_t rx_char_avail : 1; dmescc_bittype_t zero_count : 1; dmescc_bittype_t tx_buf_empty : 1; dmescc_bittype_t dcd : 1; dmescc_bittype_t sync_hunt : 1; dmescc_bittype_t cts : 1; dmescc_bittype_t txunderrun_eom : 1; dmescc_bittype_t break_abort : 1; } DMESCC_PACKED dmescc_rr0_t; </code></pre> <p>When I build the above code I get the GCC error I mentioned above.</p>
[ { "answer_id": 74265538, "author": "damonholden", "author_id": 17670742, "author_profile": "https://Stackoverflow.com/users/17670742", "pm_score": 3, "selected": true, "text": "function handleClick(category){\n props.setFilter(true)\n props.filterNotes(category)\n }\n" }, { ...
2022/10/31
[ "https://Stackoverflow.com/questions/74265164", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9608947/" ]
74,265,171
<p>Im trying to process a CSV file im reading from AWS S3, for every line of text i would like to activate the <code>worker</code> function to do some work and return a results</p> <p>ideally i would want the results to be ordered as the original CSV, but its not a requirement, for some reason when I run this code I get weird data races and this line:</p> <pre><code>for result := range output { results = append(results, result) } </code></pre> <p>blocks forever</p> <p>I tried using a WaitGroup which also didn't work, closing the <code>output</code> channel also leads me to an error of &quot;trying to put something in a closed channel&quot;</p> <pre><code>func main() { resp, err := ReadCSV(bucket, key) if err != nil { log.Fatal(err) } defer resp.Body.Close() reader := csv.NewReader(resp.Body) detector := NewDetector(languages) var results []DetectionResult numWorkers := 4 input := make(chan string, numWorkers) output := make(chan DetectionResult, numWorkers) start := time.Now() for w := 1; w &lt; numWorkers+1; w++ { go worker(w, detector, input, output) } go func() { for { record, err := reader.Read() if err == io.EOF { close(input) break } if err != nil { log.Fatal(err) } text := record[0] input &lt;- text } }() for result := range output { results = append(results, result) } elapsed := time.Since(start) log.Printf(&quot;Decoded %d lines of text in %s&quot;, len(results), elapsed) } func worker(id int, detector lingua.LanguageDetector, input chan string, output chan DetectionResult) { log.Printf(&quot;worker %d started\n&quot;, id) for t := range input { result := DetectText(detector, t) output &lt;- result } log.Printf(&quot;worker %d finished\n&quot;, id) } </code></pre> <p>Trying to process a CSV (ideally in order), and enrich it with results of a function call to <code>worker</code></p> <p>Tried setting WaitGroup, tried closing the output channel when finished reading (EOF) - results in an error</p>
[ { "answer_id": 74265538, "author": "damonholden", "author_id": 17670742, "author_profile": "https://Stackoverflow.com/users/17670742", "pm_score": 3, "selected": true, "text": "function handleClick(category){\n props.setFilter(true)\n props.filterNotes(category)\n }\n" }, { ...
2022/10/31
[ "https://Stackoverflow.com/questions/74265171", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20380321/" ]
74,265,179
<p>Can someone please explain how to convert this 2022-10-27T00:00:00.000+00:00 date string value into the YYYY-MM-DD format in python</p> <p>output should look like this : 2022-10-27</p> <p>can anyone please help me here</p>
[ { "answer_id": 74265538, "author": "damonholden", "author_id": 17670742, "author_profile": "https://Stackoverflow.com/users/17670742", "pm_score": 3, "selected": true, "text": "function handleClick(category){\n props.setFilter(true)\n props.filterNotes(category)\n }\n" }, { ...
2022/10/31
[ "https://Stackoverflow.com/questions/74265179", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20265738/" ]
74,265,185
<p>I am trying to install Operator Lifecycle Manager (OLM) — a tool to help manage the Operators running on your cluster — from the <a href="https://operatorhub.io/operator/gitlab-runner-operator" rel="nofollow noreferrer">official documentation</a>, but I keep getting the error below. What could possibly be wrong?</p> <p>This is the result from the command:</p> <pre class="lang-bash prettyprint-override"><code>curl -sL https://github.com/operator-framework/operator-lifecycle-manager/releases/download/v0.22.0/install.sh | bash -s v0.22.0 </code></pre> <pre class="lang-bash prettyprint-override"><code>/bin/bash: line 2: $'\r': command not found /bin/bash: line 3: $'\r': command not found /bin/bash: line 5: $'\r': command not found : invalid option6: set: - set: usage: set [-abefhkmnptuvxBCEHPT] [-o option-name] [--] [-] [arg ...] /bin/bash: line 7: $'\r': command not found /bin/bash: line 9: $'\r': command not found /bin/bash: line 60: syntax error: unexpected end of file </code></pre> <p>I've tried removing the existing curl and downloaded and installed another version but the issue has still persisted. Most solutions online are for Linux users and they all lead to Windows path settings and files issues.</p> <p>I haven't found one tackling installing a file using <code>curl</code>.</p> <p>I'll gladly accept any help.</p>
[ { "answer_id": 74265538, "author": "damonholden", "author_id": 17670742, "author_profile": "https://Stackoverflow.com/users/17670742", "pm_score": 3, "selected": true, "text": "function handleClick(category){\n props.setFilter(true)\n props.filterNotes(category)\n }\n" }, { ...
2022/10/31
[ "https://Stackoverflow.com/questions/74265185", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12221987/" ]
74,265,193
<p>Example dataset.</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>CLINIC</th> <th>APPTDATETIME</th> <th>PATIENT_ID</th> <th>NEW_FOLLOWUP_FLAG</th> </tr> </thead> <tbody> <tr> <td>TGYN</td> <td>20/07/2022 09:00:00</td> <td>1</td> <td>N</td> </tr> <tr> <td>TGYN</td> <td>20/07/2022 09:45:00</td> <td>2</td> <td>F</td> </tr> <tr> <td>TGYN</td> <td>20/07/2022 10:05:00</td> <td>NULL</td> <td>NULL</td> </tr> <tr> <td>TGYN</td> <td>20/07/2022 10:05:00</td> <td>4</td> <td>F</td> </tr> <tr> <td>TGYN</td> <td>20/07/2022 10:25:00</td> <td>5</td> <td>F</td> </tr> <tr> <td>TGYN</td> <td>20/07/2022 10:30:00</td> <td>NULL</td> <td>NULL</td> </tr> <tr> <td>TGYN</td> <td>20/07/2022 10:35:00</td> <td>NULL</td> <td>NULL</td> </tr> <tr> <td>TGYN</td> <td>20/07/2022 10:40:00</td> <td>NULL</td> <td>NULL</td> </tr> <tr> <td>TGYN</td> <td>20/07/2022 10:45:00</td> <td>NULL</td> <td>NULL</td> </tr> <tr> <td>TGYN</td> <td>20/07/2022 11:10:00</td> <td>6</td> <td>F</td> </tr> <tr> <td>TGYN</td> <td>20/07/2022 11:10:00</td> <td>7</td> <td>F</td> </tr> </tbody> </table> </div> <p>As you can see there are times with multiple patients, times with empty slots and times with both (generally DQ errors).</p> <p>I'm trying to calculate how many slots where filled and how many of those were new (N) or follow up(F). If there is a slot with a patient and also a NULL row then I only want to count the row with the patient. If there are only NULL rows for a timeslot then I want to count that as 'unfilled'.</p> <p>From this dataset I would like to calculate the following for each group of clinic and apptdatetime.</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>CLINIC</th> <th>APPTDATE</th> <th>N Capacity</th> <th>F Capacity</th> <th>Unfilled Capacity</th> </tr> </thead> <tbody> <tr> <td>TGYN</td> <td>20/07/2022</td> <td>1</td> <td>5</td> <td>4</td> </tr> </tbody> </table> </div> <p>What's the best way to go about this?</p> <p>I've considered taking a list of distinct values for each clinic and date and then joining to that but wanted to know if there are a more elegant way.</p>
[ { "answer_id": 74265325, "author": "Patrick Hurst", "author_id": 18522514, "author_profile": "https://Stackoverflow.com/users/18522514", "pm_score": 1, "selected": false, "text": "DECLARE @table TABLE (CLINIC NVARCHAR(4), APPTDATETIME DATETIME, PATIENT_ID INT, NEW_FOLLOWUP_FLAG NVARCHAR(...
2022/10/31
[ "https://Stackoverflow.com/questions/74265193", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20380172/" ]
74,265,197
<p>I'm new to C and I'm writting some simple stuff to get familiar. I just tried pre-increment on an array index and what I got was really not what I was expecting.</p> <p>The code in question:</p> <pre><code>#include &lt;stdio.h&gt; int main() { int array[5] = {1,2,3,4,5}; int i = 0; printf(&quot;%d %d&quot;,array[i], array[++i]); return 0; } </code></pre> <p>which should display elements of array[0] and array[1], right? But it doesn't, as the output is <code>2 2</code> What am I missing?</p>
[ { "answer_id": 74265505, "author": "Steve Summit", "author_id": 3923896, "author_profile": "https://Stackoverflow.com/users/3923896", "pm_score": 2, "selected": false, "text": "array[i]" } ]
2022/10/31
[ "https://Stackoverflow.com/questions/74265197", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12077627/" ]
74,265,204
<p>i have a navbar component with an app sidebar with navItems attribute on my angular project.</p> <p>here is how my navBar content is :</p> <pre><code>&lt;app-header style=&quot;background-color : #e65100;&quot; [fixed]=&quot;true&quot; [navbarBrandFull]=&quot;{ src: 'assets/img/brand/Bouygues_Construction_logo.svg', width: 350, height: 50, alt: 'AAD' }&quot; [navbarBrandMinimized]=&quot;{ src: 'assets/img/brand/sygnet.svg', width: 30, height: 30, alt: 'AAD' }&quot; [sidebarToggler]=&quot;'lg'&quot; [asideMenuToggler]=&quot;'lgX'&quot; &gt; &lt;ul class=&quot;nav navbar-nav ml-auto&quot; &gt; &lt;li class=&quot;nav-item dropdown&quot; dropdown placement=&quot;bottom right&quot; &gt; &lt;a class=&quot;nav-link&quot; data-toggle=&quot;dropdown&quot; href=&quot;#&quot; role=&quot;button&quot; aria-haspopup=&quot;true&quot; aria-expanded=&quot;false&quot; dropdownToggle (click)=&quot;(false)&quot; &gt; &lt;span class=&quot;d-md-down-none&quot; style=&quot;color: white; font-style: bold;&quot;&gt;{{ currentUser.firstName }} {{ currentUser.lastName }}&lt;/span&gt; &lt;img src=&quot;http://argosstockage.bouygues-construction.com/ArgosStockage/images/photos/PERSONNE____________{{ currentUser.idArgos }}.jpg&quot; (error)=&quot;getDefaultImage($event)&quot; class=&quot;img-avatar&quot; alt=&quot;{{ currentUser.lastName }}&quot; /&gt; &lt;/a&gt; &lt;div class=&quot;dropdown-menu dropdown-menu-right&quot; *dropdownMenu aria-labelledby=&quot;simple-dropdown&quot;&gt; &lt;a class=&quot;dropdown-item&quot; href=&quot;#&quot;&gt;&lt;i class=&quot;fa fa-wrench&quot;&gt;&lt;/i&gt; Paramètres&lt;/a&gt; &lt;a class=&quot;dropdown-item&quot; href=&quot;#&quot; (click)=&quot;logOut()&quot;&gt;&lt;i class=&quot;fa fa-lock&quot;&gt;&lt;/i&gt; Se déconnecter&lt;/a&gt; &lt;/div&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/app-header&gt; &lt;div class=&quot;app-body&quot;&gt; &lt;app-sidebar [fixed]=&quot;true&quot; [display]=&quot;'lg'&quot; style=&quot;background-color : #e65100;&quot;&gt; &lt;ng-scrollbar&gt; &lt;app-sidebar-nav [navItems]=&quot;navItems&quot;&gt;&lt;/app-sidebar-nav&gt; &lt;/ng-scrollbar&gt; &lt;app-sidebar-minimizer&gt;&lt;/app-sidebar-minimizer&gt; &lt;/app-sidebar&gt; &lt;!-- Main content --&gt; &lt;main class=&quot;main&quot;&gt; &lt;!-- Breadcrumb --&gt; &lt;ol class=&quot;breadcrumb&quot;&gt; &lt;app-breadcrumb&gt;&lt;/app-breadcrumb&gt; &lt;/ol&gt; &lt;div class=&quot;container-fluid&quot;&gt; &lt;router-outlet&gt;&lt;/router-outlet&gt; &lt;/div&gt; &lt;!-- /.container-fluid --&gt; &lt;/main&gt; &lt;/div&gt; &lt;app-footer&gt; &lt;span&gt;&lt;b&gt;AAD&lt;/b&gt; &amp;copy; 2022 Bouygues Construction IT.&lt;/span&gt; &lt;span class=&quot;ml-auto&quot;&gt; &lt;a href=&quot;#&quot;&gt;Bouygues Construction IT&lt;/a&gt;&lt;/span&gt; &lt;/app-footer&gt; </code></pre> <p>and here is how my navItems value is composed</p> <pre><code>export const navItems = [ { name: 'Tableau de bord', url: '/dashboard', icon: 'icon-speedometer', }, { title: true, name: 'Projets BBI', }, { name: 'Projects', url: '/projects', icon: 'icon-speedometer', }, { name: 'Selections', url: '/selections', icon: 'icon-envelope', }, { name: 'Commercial Launching', url: '/commercial-launching', icon: 'icon-exclamation', }, { title: true, name: 'Gestion Admin', }, { name: 'Users', url: '/users', icon: 'icon-user', }, { name: 'Applications', url: '/applications', icon: 'icon-screen-smartphone', }, { name: 'Currencies', url: '/currencies', icon: 'icon-bills', }, { name: 'Countries', url: '/countries', icon: 'icon-globe', }, { name: 'Internal Clients', url: '/internalClients', icon: 'icon-wallet', }, { name: 'Business Lines', url: '/businesslines', icon: 'icon-screen-desktop', }, { name: 'Products', url: '/products', icon: 'icon-tag', }, { name: 'Languages', url: '/languages', icon: 'icon-pencil', }, { name: 'Roles', url: '/roles', icon: 'icon-eye', }, { name: 'Tenders', url: '/tenders', icon: 'icon-briefcase', }, { name: 'Unity Significative', url: '/unitySignificatives', icon: 'icon-star', }, { title: true, name: 'Administration', }, { name: 'Configuration', url: '/base', icon: 'icon-settings', }, { name: 'Droits', url: '/buttons', icon: 'icon-shield', }, ]; </code></pre> <p>So i would like to iterate over each item of my navItems and to add for each item an attribute hidden with the value 'false',</p> <p>i've tried to make it like that for now:</p> <pre><code>import { Component, Input } from '@angular/core'; import { Router } from '@angular/router'; import { navItems } from '@app/_nav'; import { AuthenticationService } from '@app/services/auth.service'; @Component({ selector: 'app-dashboard', templateUrl: './default-layout.component.html', }) export class DefaultLayoutComponent { public navItems = navItems; private changes: MutationObserver; counter = 0; //public showDatas = false; public element: HTMLElement = document.body; public currentUser: any; constructor(private router: Router, private _authService: AuthenticationService) { } public ngOnInit() { this.currentUser = this._authService.getCurrentUser(); } public getDefaultImage($event) { if (this.currentUser) { /* for(const anItem in navItems) { console.log(&quot;****************************&quot;+navItems[anItem].name); if(navItems[anItem].name==&quot;Administration&quot;) { anItem['hidden'] = false } } */ /* navItems.forEach(element =&gt; { element.hidden = true; console.log(&quot;*****************&quot;+element); }); navItems.map(function(entry) { entry.hidden = true; return entry; }) } console.log(navItems); for(const anItem of navItems) { anItem['hidden'] = true; console.log(anItem); } console.log(navItems); */ $event.target.src = `https://ui-avatars.com/api/?name=${this.currentUser.firstName}+${this.currentUser.lastName}`; } /* for(const anItem of navItems) { anItem['hidden'] = true; console.log(anItem); navItems[this.counter] = anItem; this.counter = this.counter + 1; } */ /* for(const anItem of navItems) { anItem['hidden'] = false } this.navItems = [...navItems]; */ } public hideNav($event) { for(const anItem of navItems) { anItem['hidden'] = true; console.log(anItem) } this.navItems = [...navItems]; } /* public hideNav($event) { for(const anItem of navItems) { anItem['hidden'] = true; console.log(anItem); } } */ /* public hideNav($event) { for(const anItem of navItems) { anItem['hidden'] = true; } } */ public showGestionAdmin($event) { if(this.currentUser) { for(const anItem in navItems) { console.log(&quot;****************************&quot;+anItem); } } } public logOut() { this._authService.logout(); this.router.navigate(['/login']); } } </code></pre> <p>when i try to change the current Item, i don't know how to add an attribute to the current item</p> <p>My idea is then to pass in parameters the role of the current user and if it is equal to &quot;admin&quot;, the management part of the navBar would be hidden from the user.</p> <p>here is how the appsidebarComponent is imported : <a href="https://i.stack.imgur.com/B72Qi.png" rel="nofollow noreferrer">enter image description here</a></p> <pre><code>import * as i0 from &quot;@angular/core&quot;; import * as i1 from &quot;./app-sidebar-footer.component&quot;; import * as i2 from &quot;./app-sidebar-form.component&quot;; import * as i3 from &quot;./app-sidebar-header.component&quot;; import * as i4 from &quot;./app-sidebar-minimizer.component&quot;; import * as i5 from &quot;./app-sidebar.component&quot;; import * as i6 from &quot;./app-sidebar-nav/app-sidebar-nav-items.component&quot;; import * as i7 from &quot;./app-sidebar-nav.component&quot;; import * as i8 from &quot;./app-sidebar-nav/app-sidebar-nav-divider.component&quot;; import * as i9 from &quot;./app-sidebar-nav/app-sidebar-nav-link.component&quot;; import * as i10 from &quot;./app-sidebar-nav/app-sidebar-nav-title.component&quot;; import * as i11 from &quot;./app-sidebar-nav.directive&quot;; import * as i12 from &quot;./app-sidebar-nav/app-sidebar-nav-label.component&quot;; import * as i13 from &quot;./app-sidebar-nav/app-sidebar-nav-icon.pipe&quot;; import * as i14 from &quot;./app-sidebar-nav/app-sidebar-nav-badge.pipe&quot;; import * as i15 from &quot;./app-sidebar-nav/app-sidebar-nav-link.pipe&quot;; import * as i16 from &quot;./app-sidebar-nav/app-sidebar-nav-item-class.pipe&quot;; import * as i17 from &quot;@angular/common&quot;; import * as i18 from &quot;@angular/router&quot;; import * as i19 from &quot;../shared/layout/layout.module&quot;; export declare class AppSidebarModule { static ɵfac: i0.ɵɵFactoryDeclaration&lt;AppSidebarModule, never&gt;; static ɵmod: i0.ɵɵNgModuleDeclaration&lt;AppSidebarModule, [typeof i1.AppSidebarFooterComponent, typeof i2.AppSidebarFormComponent, typeof i3.AppSidebarHeaderComponent, typeof i4.AppSidebarMinimizerComponent, typeof i4.AppSidebarMinimizerComponent, typeof i5.AppSidebarComponent, typeof i6.AppSidebarNavItemsComponent, typeof i7.AppSidebarNavComponent, typeof i8.AppSidebarNavDividerComponent, typeof i6.AppSidebarNavDropdownComponent, typeof i9.AppSidebarNavLinkComponent, typeof i9.AppSidebarNavLinkContentComponent, typeof i10.AppSidebarNavTitleComponent, typeof i11.NavDropdownDirective, typeof i11.NavDropdownToggleDirective, typeof i12.AppSidebarNavLabelComponent, typeof i13.AppSidebarNavIconPipe, typeof i14.AppSidebarNavBadgePipe, typeof i15.AppSidebarNavLinkPipe, typeof i16.AppSidebarNavItemClassPipe], [typeof i17.CommonModule, typeof i18.RouterModule, typeof i19.LayoutModule], [typeof i1.AppSidebarFooterComponent, typeof i2.AppSidebarFormComponent, typeof i3.AppSidebarHeaderComponent, typeof i4.AppSidebarMinimizerComponent, typeof i5.AppSidebarComponent, typeof i7.AppSidebarNavComponent]&gt;; static ɵinj: i0.ɵɵInjectorDeclaration&lt;AppSidebarModule&gt;; } </code></pre>
[ { "answer_id": 74265846, "author": "Mr. Stash", "author_id": 13625800, "author_profile": "https://Stackoverflow.com/users/13625800", "pm_score": 0, "selected": false, "text": "public hideNav($event) {\n for(const anItem of this.navItems) {\n anItem['attributes']= { hidden: true }...
2022/10/31
[ "https://Stackoverflow.com/questions/74265204", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20330587/" ]
74,265,205
<blockquote> <p>The problem is finding an exact solution to this linear equation</p> <p>max = 1411 + 3932 + 2733 + 8044 + 1755</p> <p>31 + 52 + 23 + 54 + 45 ≤ 36</p> <p>71 + 122 + 113 + 104 ≤ 21</p> <p>− 32 + 123 + 74 + 25 ≤ 17</p> <p>0 ≤ 1, 2, 3, 4, 5 ≤ 20</p> </blockquote> <blockquote> <p>Is anyone able to rewrite this script or suggest a different one?</p> <p>This program shows results but is inaccurate. The program shows x2 = 8635342404774617/9007199254740992</p> <p>Apparently, the correct and best result should be x2 = 209/218.</p> <p>Is anyone able to suggest a better solution?</p> </blockquote> <pre><code> using System; using Google.OrTools.LinearSolver; using Fractions; public class GoogleLinearSolver { static void Main() { Solver solver = Solver.CreateSolver(&quot;GLOP&quot;); Variable x1 = solver.MakeNumVar(0.0, double.PositiveInfinity, &quot;x1&quot;); Variable x2 = solver.MakeNumVar(0.0, double.PositiveInfinity, &quot;x2&quot;); Variable x3 = solver.MakeNumVar(0.0, double.PositiveInfinity, &quot;x3&quot;); Variable x4 = solver.MakeNumVar(0.0, double.PositiveInfinity, &quot;x4&quot;); Variable x5 = solver.MakeNumVar(0.0, double.PositiveInfinity, &quot;x5&quot;); solver.Add(3 * x1 + 5 * x2 + 2 * x3 + 5 * x4 + 4 * x5 &lt;= 36); solver.Add(7 * x1 + 12 * x2 + 11 * x3 + 10 * x4 &lt;= 21); solver.Add(-3 * x2 + 12 * x3 + 7 * x4 + 2 * x5 &lt;= 17); solver.Add(0 &lt;= x1); solver.Add(0 &lt;= x2); solver.Add(0 &lt;= x3); solver.Add(0 &lt;= x4); solver.Add(0 &lt;= x5); solver.Add(x1 &lt;= 20); solver.Add(x2 &lt;= 20); solver.Add(x3 &lt;= 20); solver.Add(x4 &lt;= 20); solver.Add(x5 &lt;= 20); solver.Maximize(141 * x1 + 393 * x2 + 273 * x3 + 804 * x4 + 175 * x5); Solver.ResultStatus resultStatus = solver.Solve(); Fraction x1Fraction = Fraction.FromDouble(x1.SolutionValue()).Reduce(); Fraction x2Fraction = Fraction.FromDouble(x2.SolutionValue()).Reduce(); Fraction x3Fraction = Fraction.FromDouble(x3.SolutionValue()).Reduce(); Fraction x4Fraction = Fraction.FromDouble(x4.SolutionValue()).Reduce(); Fraction x5Fraction = Fraction.FromDouble(x5.SolutionValue()).Reduce(); Fraction resultFract = Fraction.FromDouble(solver.Objective().Value()).Reduce(); Console.WriteLine(&quot;========================================================================&quot;); Console.WriteLine(); Console.WriteLine(&quot; Solution: &quot; + resultFract); Console.WriteLine(&quot; x1 = &quot; + x1Fraction); Console.WriteLine(&quot; x2 = &quot; + x2Fraction); Console.WriteLine(&quot; x3 = &quot; + x3Fraction); Console.WriteLine(&quot; x4 = &quot; + x4Fraction); Console.WriteLine(&quot; x5 = &quot; + x5Fraction); Console.WriteLine(); Console.WriteLine(&quot;========================================================================&quot;); } } </code></pre> <p>This code works but doesn't return the best solution, who can write better?</p>
[ { "answer_id": 74265846, "author": "Mr. Stash", "author_id": 13625800, "author_profile": "https://Stackoverflow.com/users/13625800", "pm_score": 0, "selected": false, "text": "public hideNav($event) {\n for(const anItem of this.navItems) {\n anItem['attributes']= { hidden: true }...
2022/10/31
[ "https://Stackoverflow.com/questions/74265205", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20380308/" ]
74,265,229
<p><em><strong>The Goal</strong></em>:</p> <p>My React Native App shows a list of <code>&lt;Button /&gt;</code> based on the value from a list of Object <code>someData</code>. Once a user press a <code>&lt;Button /&gt;</code>, the App should shows the the <code>text</code> that is associated with this <code>&lt;Button /&gt;</code>. I am trying to achieve this using conditional rendering.</p> <p><em><strong>The Action</strong></em>:</p> <p>So first, I use <code>useEffect</code> to load a list of <code>Boolean</code> to <code>showItems</code>. <code>showItems</code> and <code>someData</code> will have the same index so I can easily indicate whether a particular <code>text</code> associated with <code>&lt;Button /&gt;</code> should be displayed on the App using the <code>index</code>.</p> <p><em><strong>The Error</strong></em>:</p> <p>The conditional rendering does not reflect the latest <code>state</code> of <code>showItems</code>.</p> <p><em><strong>The Code</strong></em>:</p> <p>Here is my code example</p> <pre><code>import {someData} from '../data/data.js'; const App = () =&gt; { const [showItems, setShowItems] = useState([]); useEffect(() =&gt; { const arr = []; someData.map(obj =&gt; { arr.push(false); }); setShowItems(arr); }, []); const handlePressed = index =&gt; { showItems[index] = true; setShowItems(showItems); //The list is changed. //but the conditional rendering does not show the latest state console.log(showItems); }; return ( &lt;View&gt; {someData.map((obj, index) =&gt; { return ( &lt;&gt; &lt;Button title={obj.title} onPress={() =&gt; { handlePressed(index); }} /&gt; {showItems[index] &amp;&amp; &lt;Text&gt;{obj.item}&lt;/Text&gt;} &lt;/&gt; ); })} &lt;/View&gt; ); }; </code></pre>
[ { "answer_id": 74265362, "author": "Nicholas Tower", "author_id": 3794812, "author_profile": "https://Stackoverflow.com/users/3794812", "pm_score": 2, "selected": true, "text": "showItems[index] = true;\nsetShowItems(showItems);\n" }, { "answer_id": 74265418, "author": "Dulaj...
2022/10/31
[ "https://Stackoverflow.com/questions/74265229", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13616193/" ]
74,265,240
<p><a href="https://i.stack.imgur.com/FdyLa.png" rel="nofollow noreferrer">enter image description here</a>i want make padding betwenn this</p> <p>Container(</p> <pre><code> child: Column( children: \&lt;Widget\&gt;\[ // Radio(value: 1, groupValue: 'Null', onChanged: (index) {}), // Expanded( // child: Text('A domicile'), // ), // Radio(value: 1, groupValue: 'Null', onChanged: (index) {}), // Expanded( // child: Text('En consigne'), // ), TextField( decoration: InputDecoration( labelText: ' Ref Expedéteur', labelStyle: TextStyle( color: Color.fromARGB(255, 0, 0, 0), fontFamily: 'Segoe UI', ), enabledBorder: OutlineInputBorder( borderSide: BorderSide( width: 3, color: Color.fromARGB(255, 136, 136, 136)), borderRadius: BorderRadius.all( Radius.circular(40), ), ), focusedBorder: OutlineInputBorder( borderSide: BorderSide( width: 3, color: const Color(0xffff4848)), borderRadius: BorderRadius.all( Radius.circular(40), ), ), errorBorder: OutlineInputBorder( borderSide: BorderSide( width: 3, color: Color.fromARGB(255, 66, 125, 145)), ), ), ), TextField( decoration: InputDecoration( labelText: ' Nombre de colis', labelStyle: TextStyle( color: Color.fromARGB(255, 0, 0, 0), fontFamily: 'Segoe UI', ), enabledBorder: OutlineInputBorder( borderSide: BorderSide( width: 3, color: Color.fromARGB(255, 136, 136, 136)), borderRadius: BorderRadius.all( Radius.circular(40), ), ), focusedBorder: OutlineInputBorder( borderSide: BorderSide( width: 3, color: const Color(0xffff4848)), borderRadius: BorderRadius.all( Radius.circular(40), ), ), errorBorder: OutlineInputBorder( borderSide: BorderSide( width: 3, color: Color.fromARGB(255, 66, 125, 145)), ), ), ), TextField( decoration: InputDecoration( labelText: ' Poids', labelStyle: TextStyle( color: Color.fromARGB(255, 0, 0, 0), fontFamily: 'Segoe UI', ), enabledBorder: OutlineInputBorder( borderSide: BorderSide( width: 3, color: Color.fromARGB(255, 136, 136, 136)), borderRadius: BorderRadius.all( Radius.circular(40), ), ), focusedBorder: OutlineInputBorder( borderSide: BorderSide( width: 3, color: const Color(0xffff4848), ), borderRadius: BorderRadius.all( Radius.circular(40), ), ), errorBorder: OutlineInputBorder( borderSide: BorderSide( width: 3, color: Color.fromARGB(255, 66, 125, 145)), ), ), ), TextField( decoration: InputDecoration( labelText: ' Taille de colis', labelStyle: TextStyle( color: Color.fromARGB(255, 0, 0, 0), fontFamily: 'Segoe UI', ), enabledBorder: OutlineInputBorder( borderSide: BorderSide( width: 2, color: Color.fromARGB(255, 136, 136, 136)), borderRadius: BorderRadius.all( Radius.circular(40), ), ), focusedBorder: OutlineInputBorder( borderSide: BorderSide( width: 2, color: const Color(0xffff4848)), borderRadius: BorderRadius.all( Radius.circular(40), ), ), errorBorder: OutlineInputBorder( borderSide: BorderSide( width: 2, color: Color.fromARGB(255, 66, 125, 145)), ), ), ), // Padding(padding: const EdgeInsets.all(2.0), // child:Column( // children: \[ // Radio(value: 1, groupValue: 'Null', onChanged: (index) {}), // Expanded( // child: Text('Paye'), // ), // \], // ), // ), TextField( decoration: InputDecoration( labelText: ' Ref Expedéteur', labelStyle: TextStyle( color: Color.fromARGB(255, 5, 5, 5), fontFamily: 'Segoe UI', ), enabledBorder: OutlineInputBorder( borderSide: BorderSide( width: 3, color: Color.fromARGB(255, 136, 136, 136)), borderRadius: BorderRadius.all( Radius.circular(40), ), ), focusedBorder: OutlineInputBorder( borderSide: BorderSide( width: 3, color: const Color(0xffff4848)), borderRadius: BorderRadius.all( Radius.circular(40), ), ), errorBorder: OutlineInputBorder( borderSide: BorderSide( width: 3, color: Color.fromARGB(255, 66, 125, 145)), ), ), ), TextField( decoration: InputDecoration( labelText: ' Nombre de colis', labelStyle: TextStyle( color: Color.fromARGB(255, 0, 0, 0), fontFamily: 'Segoe UI', ), enabledBorder: OutlineInputBorder( borderSide: BorderSide( width: 3, color: Color.fromARGB(255, 136, 136, 136)), borderRadius: BorderRadius.all( Radius.circular(40), ), ), focusedBorder: OutlineInputBorder( borderSide: BorderSide( width: 3, color: const Color(0xffff4848)), borderRadius: BorderRadius.all( Radius.circular(40), ), ), errorBorder: OutlineInputBorder( borderSide: BorderSide( width: 3, color: Color.fromARGB(255, 66, 125, 145)), ), ), ), TextField( decoration: InputDecoration( labelText: ' Poids', labelStyle: TextStyle( color: Color.fromARGB(255, 0, 0, 0), fontFamily: 'Segoe UI', ), enabledBorder: OutlineInputBorder( borderSide: BorderSide( width: 3, color: Color.fromARGB(255, 136, 136, 136)), borderRadius: BorderRadius.all( Radius.circular(40), ), ), focusedBorder: OutlineInputBorder( borderSide: BorderSide( width: 3, color: const Color(0xffff4848)), borderRadius: BorderRadius.all( Radius.circular(40), ), ), errorBorder: OutlineInputBorder( borderSide: BorderSide( width: 3, color: Color.fromARGB(255, 66, 125, 145)), ), ), ), TextField( decoration: InputDecoration( labelText: ' Taille de colis', labelStyle: TextStyle( color: Color.fromARGB(255, 0, 0, 0), fontFamily: 'Segoe UI', ), enabledBorder: OutlineInputBorder( borderSide: BorderSide( width: 3, color: Color.fromARGB(255, 136, 136, 136)), borderRadius: BorderRadius.all( Radius.circular(40), ), ), focusedBorder: OutlineInputBorder( borderSide: BorderSide( width: 3, color: const Color(0xffff4848)), borderRadius: BorderRadius.all( Radius.circular(40), ), ), errorBorder: OutlineInputBorder( borderSide: BorderSide( width: 3, color: Color.fromARGB(255, 66, 125, 145)), ), ), ), </code></pre> <p>this is my code its work in side padding but i want padding inside text field im begginner in flutter</p> <p>this is my code its work in side padding but i want padding inside text field im begginner in flutter</p> <p>this is my code its work in side padding but i want padding inside text field im begginner in flutter</p> <pre><code> \], ), ), </code></pre>
[ { "answer_id": 74265362, "author": "Nicholas Tower", "author_id": 3794812, "author_profile": "https://Stackoverflow.com/users/3794812", "pm_score": 2, "selected": true, "text": "showItems[index] = true;\nsetShowItems(showItems);\n" }, { "answer_id": 74265418, "author": "Dulaj...
2022/10/31
[ "https://Stackoverflow.com/questions/74265240", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20293645/" ]
74,265,244
<p>I want to show up the result of the equation in sql :</p> <pre><code>A : 0.5 0.25 1 1 1 </code></pre> <p>I need to take a current row and divide it by the sum of rows, For ex: 0.5/3.75</p> <p>I tried this but shows me an error :</p> <pre><code>select A / sum(A) from table X </code></pre>
[ { "answer_id": 74265281, "author": "GMB", "author_id": 10676716, "author_profile": "https://Stackoverflow.com/users/10676716", "pm_score": 1, "selected": false, "text": "SUM()" }, { "answer_id": 74265298, "author": "BayouKid", "author_id": 20380343, "author_profile": ...
2022/10/31
[ "https://Stackoverflow.com/questions/74265244", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20380371/" ]
74,265,259
<p>I have a map, <code>Map&lt;String, Map&lt;String, String&gt;&gt; myMap = new HashMap&lt;&gt;();</code> that I would like to remap to get it's values, so that I get as a result <code>Map&lt;String, String&gt;</code>.</p> <p>Is it possible to do the mapping using stream API?</p> <p>I have solved the problem using a <code>for</code> loop but I'm interested if that could be done using streams.</p> <p>My solution:</p> <pre><code> Map&lt;String, String&gt; result = new HashMap&lt;&gt;(); myMap.forEach((k, v) -&gt; { result.putAll(v); }); </code></pre> <p>What I want is to get all the values from <code>myMap</code> and put them in a new Map.</p>
[ { "answer_id": 74265281, "author": "GMB", "author_id": 10676716, "author_profile": "https://Stackoverflow.com/users/10676716", "pm_score": 1, "selected": false, "text": "SUM()" }, { "answer_id": 74265298, "author": "BayouKid", "author_id": 20380343, "author_profile": ...
2022/10/31
[ "https://Stackoverflow.com/questions/74265259", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12537240/" ]
74,265,268
<p>I have this image here which is SVG format, when the user clicks this image some action happens.</p> <p>One problem there, this image has some white empty space around it that can't be removed because it's not a quadrilateral.</p> <p>What I need is when the user clicks this empty space around the image don't do the action, I want the action to happen only if the user clicks this pink colored part in the image.</p> <p>I can use either JavaScript or jQuery.</p> <p><a href="https://i.stack.imgur.com/vpNeV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vpNeV.png" alt="enter image description here" /></a></p>
[ { "answer_id": 74265318, "author": "brieuc", "author_id": 12501753, "author_profile": "https://Stackoverflow.com/users/12501753", "pm_score": 3, "selected": true, "text": "document.querySelector('svg path').addEventListener('click', () => console.log('clicked');\n" } ]
2022/10/31
[ "https://Stackoverflow.com/questions/74265268", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10457312/" ]
74,265,273
<p>I am developing an add-in for Word, Excel and PowerPoint. I need to fetch the version of the add-in installed in client machine. I can see the version under 'Security Info' but I need to get it in my script at runtime.</p> <p>Is there any OfficeJS API to fetch add-in version or get 'Security Info' programmatically ?</p>
[ { "answer_id": 74265318, "author": "brieuc", "author_id": 12501753, "author_profile": "https://Stackoverflow.com/users/12501753", "pm_score": 3, "selected": true, "text": "document.querySelector('svg path').addEventListener('click', () => console.log('clicked');\n" } ]
2022/10/31
[ "https://Stackoverflow.com/questions/74265273", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19588388/" ]
74,265,283
<p>I have an array of strings that are end part of document IDs</p> <pre class="lang-js prettyprint-override"><code>const arr = ['ace', 'acb', 'acc', 'aca']; const documents = [ { id: 'xxxxxxxace' }, { id: 'xxxxxxxacb' }, { id: 'xxxxxxxacc' }, { id: 'xxxxxxxaca' } ]; </code></pre> <p>I need a query that would return all documents whose IDs ends with either of <code>arr</code> elements.</p> <p>The only way I could do this is by iterating over <code>arr</code> and calling <code>findFirst</code> with <code>endsWith</code> for each array element.</p> <p>Are there better ways?</p>
[ { "answer_id": 74265398, "author": "ray", "author_id": 14732669, "author_profile": "https://Stackoverflow.com/users/14732669", "pm_score": 1, "selected": false, "text": "$indexOfCP" }, { "answer_id": 74266858, "author": "Hoàng Huy Khánh", "author_id": 9711476, "author...
2022/10/31
[ "https://Stackoverflow.com/questions/74265283", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12009306/" ]
74,265,288
<p>The code seems a bit long for something that trivial.</p> <p>Is there a pythonic way to shorten it?</p> <pre><code>fruit = None for _fruit in basket: if _fruit['name'] != 'banana': continue fruit = _fruit </code></pre>
[ { "answer_id": 74265348, "author": "Dartie", "author_id": 4768254, "author_profile": "https://Stackoverflow.com/users/4768254", "pm_score": 0, "selected": false, "text": "fruit = [x for x in basket if x != \"banana\"]\n" }, { "answer_id": 74265389, "author": "ILS", "autho...
2022/10/31
[ "https://Stackoverflow.com/questions/74265288", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1792858/" ]
74,265,295
<pre><code>fruits = [&quot;mango&quot;, &quot;banana&quot;, &quot;apple&quot;, &quot;yolk&quot;, &quot;mulberry&quot;] letter = input(&quot;Enter the letter you want to search: &quot;) letter2 = input(&quot;Enter the second letter you want to search: &quot;) for word in fruits: if word[0].startswith(letter) and word[1].startswith(letter2): result = word if result == word: print(result) else: print(&quot;no result&quot;) </code></pre> <p>i get the result part working but the &quot;no result&quot; output is not showing whenever i enter in the wrong input</p>
[ { "answer_id": 74265348, "author": "Dartie", "author_id": 4768254, "author_profile": "https://Stackoverflow.com/users/4768254", "pm_score": 0, "selected": false, "text": "fruit = [x for x in basket if x != \"banana\"]\n" }, { "answer_id": 74265389, "author": "ILS", "autho...
2022/10/31
[ "https://Stackoverflow.com/questions/74265295", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20380384/" ]
74,265,321
<p>Now I'm building the application using React.js. All pages are working excepting of auth page. After logging successfully, it should bring the user to the home page but it was broken, and showed the blank page. After refreshing the manually, it started to show the home page.</p> <p>When I checked the application thru development tools in the chrome browser, it says <code>&quot;Uncaught TypeError: destroy is not a function&quot;</code>. I attached the code where caused the error.</p> <pre><code>... const UnauthedWrapper = () =&gt; { const navigate = useNavigate(); const location = useLocation(); const { state: { auth, user }, } = useContext(AppContext); useEffect(() =&gt; { if (auth &amp;&amp; user &amp;&amp; user.emailVerified &amp;&amp; user.dstoreName) { navigate(`/app/overview`); return null; } // eslint-disable-next-line react-hooks/exhaustive-deps }, [auth, user]); return ( &lt;&gt; {!location.pathname.includes(&quot;/auth&quot;) ? ( &lt;Header logo=&quot;/images/logo.png&quot; page=&quot;landing&quot; hideLogin={process.env.REACT_APP_ENV === &quot;PROD&quot;} /&gt; ) : ( &lt;Link to=&quot;/&quot;&gt; &lt;img src=&quot;/images/logo.png&quot; alt=&quot;logo&quot; className=&quot;logo ms-4 mt-4&quot; width={180} /&gt; &lt;/Link&gt; )} ... </code></pre>
[ { "answer_id": 74265348, "author": "Dartie", "author_id": 4768254, "author_profile": "https://Stackoverflow.com/users/4768254", "pm_score": 0, "selected": false, "text": "fruit = [x for x in basket if x != \"banana\"]\n" }, { "answer_id": 74265389, "author": "ILS", "autho...
2022/10/31
[ "https://Stackoverflow.com/questions/74265321", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9140531/" ]
74,265,369
<p>I am using beautiful soup library to extract out data from webpages. Sometimes we have the case where element could not be found in the webpage itself, and if we try to access the sub element than we get error like 'NoneType' object has no attribute 'find'.</p> <p>Like let say for the below code</p> <pre class="lang-py prettyprint-override"><code>res = requests.get(url) soup = BeautifulSoup(res.text, &quot;html.parser&quot;) primary_name = soup.find('div', {&quot;class&quot;: &quot;company-header&quot;}).find('p', {&quot;class&quot;: &quot;heading-xlarge&quot;}).text company_number = soup.find('p', id=&quot;company-number&quot;).find('strong').text </code></pre> <p>If I want to handle the error, I have to write something like below.</p> <pre class="lang-py prettyprint-override"><code>try: primary_name = error_handler(soup.find('div', {&quot;class&quot;: &quot;company-header&quot;}).find('p', {&quot;class&quot;: &quot;heading-xlarge&quot;}).text) except: primary_name = None try: company_number = soup.find('p', id=&quot;company-number&quot;).find('strong').text.strip() except: company_number = None </code></pre> <p>And if there are too many elements, then we end up with lots of <code>try</code> and <code>catch</code> statements. I actually want to write code in the below manner.</p> <pre class="lang-py prettyprint-override"><code>def error_handler(_): try: return _ except: return None primary_name = error_handler(soup.find('div', {&quot;class&quot;: &quot;company-header&quot;}).find('p', {&quot;class&quot;: &quot;heading-xlarge&quot;}).text) # this will still raise the error </code></pre> <p>I know that above code wouldn't work because it will still try to execute first inner function in <code>error_handler</code> function, and it would still raise the error.</p> <p>If you have any idea how to make this code looks cleaner, then please show me.</p>
[ { "answer_id": 74265930, "author": "Igor Moraru", "author_id": 4645291, "author_profile": "https://Stackoverflow.com/users/4645291", "pm_score": 2, "selected": true, "text": "error_handler" }, { "answer_id": 74266012, "author": "hassan abbas", "author_id": 20341562, "...
2022/10/31
[ "https://Stackoverflow.com/questions/74265369", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15063341/" ]
74,265,411
<h4>This is the problem:</h4> <p>Lili is organizing a competition at her school. There are N × N people in a room-sized N × N and each one of them belongs to a team. The team is numbered between 1 to N. In the room, people wear a shirt with numbers between 0 to N indicating team number they come from. People that wears number 0 is spectator.</p> <p>Lili wants to know whether each team consists of at least N members and are in the room. Help Lili to count how many incomplete teams in the room.</p> <p>Input: Input consists of one integer N , number of team participating in this competition followed by N lines consisting of N integers Aij with value between 0 and N inclusive, each representing the numbers in the people’s shirts.</p> <h4>Constraints:</h4> <p>1 ≤ N ≤ 100</p> <h4>Output:</h4> <p>Output the number of incomplete teams in the room.</p> <h4>Sample input 1:</h4> <pre><code>2 1 0 2 2 </code></pre> <h4>Output 1:</h4> <pre><code>1 </code></pre> <h4>Sample input 2:</h4> <pre><code>3 3 0 2 2 0 2 1 3 3 </code></pre> <h4>Output 2:</h4> <pre><code>1 </code></pre> <h4>This is my current code but it keeps saying wrong answer</h4> <pre><code>#include &lt;stdio.h&gt; int main() { int n, array[101][101], i, j, count = 0, k, x = 0; scanf(&quot;%d&quot;, &amp;n); for (i = 0; i &lt; n; i++) { for (j = 0; j &lt; n; j++) { scanf(&quot;%d&quot;, &amp;array[i][j]); } } for (k = 0; k &lt; n; k++) { for (i = 0; i &lt; n; i++) { for (j = 0; j &lt; n; j++) { if (array[i][j] == k + 1) { count += 1; } } } if (count != n) { x += 1; } count = 0; } printf(&quot;%d\n&quot;, x); return 0; } </code></pre>
[ { "answer_id": 74265688, "author": "Serge Ballesta", "author_id": 3545273, "author_profile": "https://Stackoverflow.com/users/3545273", "pm_score": 2, "selected": true, "text": "read N\nalloc an array teams of size N-1 and initialize it with 0\nloop N * N times\n| read a shirt number i\n...
2022/10/31
[ "https://Stackoverflow.com/questions/74265411", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20242899/" ]
74,265,419
<p>I have this db table: <a href="http://sqlfiddle.com/#!9/e1dd38e/7" rel="nofollow noreferrer">http://sqlfiddle.com/#!9/e1dd38e/7</a></p> <p>I am trying to query it so it goes thru each category, returning each subcategory's top 3 vendor's, ordered by their total of spend (sum(amount)), the vendors outside of the top 3 will be summed up as a total and be included as &quot;Others&quot;</p> <p>Also including total amount for category and subcategories</p> <p>I appreciate any help, struggling on this one</p> <p>Expected outcome would be:</p> <pre><code>Paper 515.54 Napkins 314.99 Paper LLC 110.49 Dunder Mifflin 70.99 Brawny 60.02 Others 73.49 Towels 200.55 Acme LLC 52.01 Michigan Paper 41.23 Cascades LLC 40.55 Others 66.76 Food 205.54 Apples 178.76 Orchards LLC 97.10 Northstar Orchard 41.23 Apples LLC 40.43 Pizza 26.78 Dominos 16.53 Pizza Hut 10.25 </code></pre>
[ { "answer_id": 74265688, "author": "Serge Ballesta", "author_id": 3545273, "author_profile": "https://Stackoverflow.com/users/3545273", "pm_score": 2, "selected": true, "text": "read N\nalloc an array teams of size N-1 and initialize it with 0\nloop N * N times\n| read a shirt number i\n...
2022/10/31
[ "https://Stackoverflow.com/questions/74265419", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26130/" ]
74,265,436
<p>In <a href="https://gorm.io/docs/query.html#String-Conditions" rel="nofollow noreferrer">GORM documentation</a> there is an example how to use LIKE conditions:</p> <pre><code>// LIKE db.Where(&quot;name LIKE ?&quot;, &quot;%jin%&quot;).Find(&amp;users) // SELECT * FROM users WHERE name LIKE '%jin%'; </code></pre> <p>The problem that I have with this approach is that if <code>jin</code> is user input variable it can contain wildcard symbols like <code>%</code>. How can I escape such wildcard symbols?</p> <p>For me these symbols must be used in the left part like:</p> <pre><code>db.Where(&quot;name LIKE %?%&quot;, &quot;jin&quot;).Find(&amp;users) </code></pre> <p>OR</p> <pre><code>db.Where(&quot;name LIKE '%' || ? || '%'&quot;, &quot;jin&quot;).Find(&amp;users) </code></pre> <p>and the ORM should escape automatically the parameter, but this is not how it behaves.</p> <p>What is the right solution?</p>
[ { "answer_id": 74265760, "author": "Stefanov.sm", "author_id": 2302032, "author_profile": "https://Stackoverflow.com/users/2302032", "pm_score": 0, "selected": false, "text": "db.Where(\"name like '%'||?||'%' escape '\\'\", userinput)\n" }, { "answer_id": 74266802, "author": ...
2022/10/31
[ "https://Stackoverflow.com/questions/74265436", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44537/" ]
74,265,447
<p>I'm experiencing a weird response by my onClick event handling.</p> <p>I have a list of user boxes, which on click, I'm attempting to navigate the client to that specific user's page ( as if - <code>navigate(&quot;/farmershop/&quot; + e.target.id)</code> )</p> <p>I am debugging by console.logg my e.target.id, I only get the id (which I attempt to retrieve) printed when I click on certain areas in the user box. In case I don't press that specific part in the box (on the image), I get an empty string.</p> <p>These are my functions responsible for stated task:</p> <pre><code>const handle_clicked_farmer = (e) =&gt; { console.log(e.target.id); navigate(&quot;/farmershop/&quot; + e.target.id); } const createTopFarmers = () =&gt; { return top_n_farmers.map((farmer) =&gt; ( // on click take to farmer's page. &lt;Stack sx={{marginTop: &quot;3%&quot;, background: &quot;green&quot;, marginLeft:&quot;5%&quot;, width: &quot;400px&quot;, borderRadius:&quot;5px&quot;, boxShadow: &quot;2px 3px 8px black&quot;}}&gt; &lt;Box sx={{marginLeft:&quot;2%&quot;, cursor: &quot;pointer&quot; }} onClick={handle_clicked_farmer} id={farmer.id}&gt; &lt;Typography sx={{fontFamily: &quot;Amatic SC&quot;, letterSpacing: &quot;2px&quot;, fontSize: &quot;50px&quot;, fontWeight: 700}}&gt;{farmer.firstname}&lt;/Typography&gt; &lt;Typography sx={{fontFamily: &quot;Amatic SC&quot;, letterSpacing: &quot;2px&quot;, fontSize: &quot;50px&quot;, fontWeight: 700, marginTop: &quot;-5%&quot;}}&gt;{farmer.lastname}&lt;/Typography&gt; &lt;img src={farmer.img} style={{width: &quot;100px&quot;, borderRadius: &quot;300px&quot;, border: &quot;2px solid black&quot;}}/&gt; &lt;Typography sx={{fontFamily: &quot;Amatic SC&quot;, letterSpacing: &quot;2px&quot;, fontSize: &quot;20px&quot;, fontWeight: 700, marginTop: &quot;-5%&quot;}}&gt;location: {farmer.location}&lt;/Typography&gt; &lt;/Box&gt; &lt;Box&gt; {farmer.likes} likes &lt;/Box&gt; &lt;Box sx={{backgroundColor: &quot;green&quot;}}&gt; &lt;Typography sx={{fontFamily: &quot;Amatic SC&quot;, fontSize: &quot;25px&quot;}}&gt;{farmer.about}&lt;/Typography&gt; &lt;/Box&gt; &lt;/Stack&gt; )); }; </code></pre> <p>any ideas what might be the issue?</p> <p>regards!</p>
[ { "answer_id": 74265551, "author": "Harrison", "author_id": 15291770, "author_profile": "https://Stackoverflow.com/users/15291770", "pm_score": 1, "selected": false, "text": "Events" }, { "answer_id": 74265553, "author": "dbuchet", "author_id": 14967662, "author_profi...
2022/10/31
[ "https://Stackoverflow.com/questions/74265447", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9517800/" ]
74,265,461
<p>I have a database with multiple tables, and I want to add a column to one table that will be populated with different strings based on the contents of another table.</p> <p>Below are the tables of interest.</p> <pre><code>CREATE TABLE Locations( id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, Location VARCHAR(17) NOT NULL, Is_Property BOOLEAN NOT NULL ); CREATE TABLE Players( id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, Player_Name VARCHAR(17) NOT NULL, Token VARCHAR(17) NOT NULL, FOREIGN KEY (Token) REFERENCES Tokens(Token), P_Location VARCHAR(17) NOT NULL, FOREIGN KEY (P_Location) REFERENCES Locations(Location), Bank_Balance INT NOT NULL DEFAULT 200); ALTER TABLE Locations ADD INDEX `Location` (`Location`); CREATE TABLE Properties AS SELECT id,Location FROM Locations WHERE Is_Property = 1; ALTER TABLE Properties ADD CONSTRAINT PK_Properties PRIMARY KEY (id), ADD COLUMN Colour VARCHAR(6), ADD COLUMN Cost_And_Rent INT, ADD COLUMN Owned VARCHAR(3); CREATE TABLE Properties_Owned( Player_id INT NOT NULL, Prop_id INT NOT NULL, PRIMARY KEY(Player_id, Prop_id), FOREIGN KEY (Player_id) REFERENCES Players(id), FOREIGN KEY (Prop_id) REFERENCES Properties(id)); </code></pre> <p>The <code>Properties</code> and <code>Properties_Owned</code> tables are of interest in this case. I want to create a column called <code>Owned</code> in <code>Properties</code> and populate it with &quot;Yes&quot; or &quot;No&quot; based on if the primary key appears under <code>Prop_id</code> in <code>Properties_Owned</code>. Ergo if it does, <code>Properties.Owned</code> will show &quot;Yes&quot;, and if not, &quot;No&quot;.</p> <p>I've tried using the <code>CASE</code> function, but I'm unsure of if it can be used without calling a <code>SELECT</code> query. Below is my last attempt to do so, but the syntax is wrong somewhere or just misguided altogether.</p> <pre><code>CASE WHEN id IS IN properties_owned.Prop_id THEN Properties.Owned = &quot;Yes&quot; ELSE &quot;No&quot; ; </code></pre> <p>It generates the error code:</p> <pre><code>Error Code: 1064. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CASE WHEN id IS IN properties_owned.Prop_id THEN Properties.Owned = &quot;Yes&quot; ELSE ' at line 1 </code></pre> <p>Edit: As there was a request for sample data, here it is:</p> <pre><code>INSERT INTO Locations(Location,Is_Property) VALUES (&quot;GO&quot;, 0), (&quot;London&quot;, 1), (&quot;Paris&quot;, 0), (&quot;China&quot;, 1), (&quot;New Zealand&quot;, 0), (&quot;Sydney&quot;, 1),; INSERT INTO Players(Player_Name,Token,P_Location,Bank_Balance) VALUES (&quot;Mary&quot;,&quot;Battleship&quot;,&quot;London&quot;,190), (&quot;Bill&quot;,&quot;Dog&quot;,&quot;Paris&quot;,500), (&quot;Jane&quot;,&quot;Car&quot;,&quot;China&quot;,150), (&quot;Norman&quot;,&quot;Thimble&quot;,&quot;London&quot;,250); INSERT INTO Properties_Owned(Player_id,Prop_id) VALUES (1,1), (2,2), (3,3), (4,4), (4,5); </code></pre> <p>Thus the Properties_Owned table will look like this:</p> <pre><code>Player_id | Prop_id ----------|--------- 1 |1 2 |2 3 |3 4 |4 4 |5 </code></pre> <p>And so in the <code>Properties</code> table under <code>Owned</code>, if <code>Properties.id</code> appears in <code>Prop_id</code> above, the <code>Owned</code> column should yield &quot;Yes&quot;.</p> <p><a href="https://i.stack.imgur.com/071vd.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/071vd.png" alt="enter image description here" /></a></p>
[ { "answer_id": 74265551, "author": "Harrison", "author_id": 15291770, "author_profile": "https://Stackoverflow.com/users/15291770", "pm_score": 1, "selected": false, "text": "Events" }, { "answer_id": 74265553, "author": "dbuchet", "author_id": 14967662, "author_profi...
2022/10/31
[ "https://Stackoverflow.com/questions/74265461", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20309604/" ]
74,265,465
<p>I want to limit the quantity of &quot;Order lines&quot; to 2 products only (When 2 products are loaded, I want the &quot;Add a Product&quot;, &quot;Add a section&quot; and &quot;Add a note&quot; buttons to disappear automatically).</p> <p>I tried to use an <code>@api.constrains</code> but it only validates when I click Save button.</p> <p><a href="https://i.stack.imgur.com/BgzAT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BgzAT.png" alt="enter image description here" /></a></p>
[ { "answer_id": 74278915, "author": "odoo newbie", "author_id": 19883757, "author_profile": "https://Stackoverflow.com/users/19883757", "pm_score": 2, "selected": true, "text": "@api.onchange('reservation_line')\ndef _onchange_check_cabanias(self):\n if len(self.reservation_line) > 1:\...
2022/10/31
[ "https://Stackoverflow.com/questions/74265465", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19883757/" ]
74,265,499
<p>I've a table LESSON like this</p> <pre><code>| Student_id | Lesson_id | | ---------- |- -------- | | 352-03-3624| 10359427 | | 352-03-3624| 10359449 | | 805-17-4144| 58149917 | | 805-17-4144| 58149968 | </code></pre> <p>I have to look for students who have taken the same lessons, ie who have the same lesson_id.</p> <p>I used this query:</p> <pre><code>select * from lesson e where exists (select null from lesson i where e.lesson_id = i.lesson_if and e.student_id &lt;&gt; i.student_id) order by lesson_id </code></pre> <p>but it doesn't work very well.</p> <p>Is there someone who can help me?</p> <p>thanks</p> <p>I'm finding for every studend if there is another student who follows the same lessons.</p>
[ { "answer_id": 74265636, "author": "Gnqz", "author_id": 4891815, "author_profile": "https://Stackoverflow.com/users/4891815", "pm_score": 1, "selected": false, "text": "HAVING" }, { "answer_id": 74268036, "author": "Littlefoot", "author_id": 9097906, "author_profile":...
2022/10/31
[ "https://Stackoverflow.com/questions/74265499", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20360789/" ]
74,265,500
<p>Google Sheets offers passing in parameters to lambdas as such: <code>=LAMBDA(x, y, x + y)(100, 200)</code></p> <p>I was thinking of taking 2 columns from another Sheet, filter it with QUERY and then pass those 2 columns into the LAMBDA. Basically the 2 columns were a key and a CSV text that I wanted to split in one go.</p> <ol> <li><code>=lambda(a, b, split(b, &quot;,&quot;))(query('Alias Key Raw'!A1:B, &quot;select * where A starts with 'X'&quot;))</code></li> </ol> <p>This gives the following <code>ERROR Wrong number of arguments to call following LAMBDA function. Expected 2 arguments, but got 1 arguments.</code>. Given that QUERY provides 2 columns of actual values, I thought this would be possible.</p> <ol start="2"> <li><code>=byrow(query('Alias Key Raw'!A1:B, &quot;select * where A starts with 'X'&quot;), lambda(row, split(row, &quot;,&quot;)))</code></li> </ol> <p>This gives me only column A. No error otherwise. All of column B is ignored it appears</p> <ol start="3"> <li>I've tried using <code>BYCOL</code>, <code>BYROW</code>, etc, and a lot of errors are <code>ERROR Wrong number of arguments to call following LAMBDA function. Expected 2 arguments, but got 1 arguments.</code></li> </ol> <h1>Data</h1> <p>Input into the lambda</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>Key</th> <th>Lineages</th> </tr> </thead> <tbody> <tr> <td>CU</td> <td>B.1.1.529.5.1.26</td> </tr> <tr> <td>CV</td> <td>B.1.1.529.2.75.3.1.1.3</td> </tr> <tr> <td>XA</td> <td>B.1.1.7,B.1.177</td> </tr> <tr> <td>XB</td> <td>B.1.634,B.1.631</td> </tr> <tr> <td>XC</td> <td>AY.29,B.1.1.7</td> </tr> <tr> <td>XAZ</td> <td>BA.2.5,BA.5,BA.2.5</td> </tr> <tr> <td>XBC</td> <td>BA.2*,B.1.617.2*,BA.2*,B.1.617.2*</td> </tr> </tbody> </table> </div><h2>Expected</h2> <p>Output from the lambda</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>Key</th> <th>Lineages</th> <th></th> <th></th> <th></th> </tr> </thead> <tbody> <tr> <td>XA</td> <td>B.1.1.7</td> <td>B.1.177</td> <td></td> <td></td> </tr> <tr> <td>XB</td> <td>B.1.634</td> <td>B.1.631</td> <td></td> <td></td> </tr> <tr> <td>XC</td> <td>AY.29</td> <td>B.1.1.7</td> <td></td> <td></td> </tr> <tr> <td>XAZ</td> <td>BA.2.5</td> <td>BA.5</td> <td>BA.2.5</td> <td></td> </tr> <tr> <td>XBC</td> <td>BA.2*</td> <td>B.1.617.2*</td> <td>BA.2*</td> <td>B.1.617.2*</td> </tr> </tbody> </table> </div> <p>Note: There can be any number of lineages in the CSV cell</p>
[ { "answer_id": 74265632, "author": "Osm", "author_id": 19529694, "author_profile": "https://Stackoverflow.com/users/19529694", "pm_score": 3, "selected": true, "text": "=ArrayFormula(\n LAMBDA(a, {QUERY({a},\"Select Col1\"),SPLIT(QUERY({a},\"Select Col2\"),\",\")})\n (QUERY('Alias Key Ra...
2022/10/31
[ "https://Stackoverflow.com/questions/74265500", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2333021/" ]
74,265,524
<p>I have a HashMap in which sentence records are stored with an associated key. Now, an output should be created in this displayed how much the word (in my example the word &quot;car&quot;) in this index (key) occurs. For example, if the word &quot;car&quot; occurs in the index (key) 5, 4 times, the 5 should also be output 4 times.</p> <p>The current output is: Car : [1, 2, 3, 5]</p> <p>My desired output is: Car : [1, 1, 2, 3, 3, 5, 5, 5, 5]</p> <pre><code>Map&lt;Integer, String&gt; carHashMap = new HashMap&lt;&gt;(); ArrayList&lt;Integer&gt; showCarsInMap = new ArrayList&lt;&gt;(); carHashMap.put(1, &quot;this car is very fast car&quot;); carHashMap.put(2, &quot;i have a old car&quot;); carHashMap.put(3, &quot;my first car was an mercedes and my second car was an audi&quot;); carHashMap.put(4, &quot;today is a good day&quot;); carHashMap.put(5, &quot;car car car car&quot;); for (Map.Entry&lt;Integer, String&gt; entrySection : carHashMap.entrySet()) { if (entrySection.getValue().contains(&quot;car&quot;)) { showCarsInMap.add(entrySection.getKey()); } } System.out.println(&quot;Car : &quot; + showCarsInMap); </code></pre> <p>I guess I have to add an additional if-loop, but I don't know how my program can recognize which &quot;car&quot; has already been counted and which not.</p>
[ { "answer_id": 74265632, "author": "Osm", "author_id": 19529694, "author_profile": "https://Stackoverflow.com/users/19529694", "pm_score": 3, "selected": true, "text": "=ArrayFormula(\n LAMBDA(a, {QUERY({a},\"Select Col1\"),SPLIT(QUERY({a},\"Select Col2\"),\",\")})\n (QUERY('Alias Key Ra...
2022/10/31
[ "https://Stackoverflow.com/questions/74265524", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15960888/" ]
74,265,545
<p>I am a newbie to ruby language and I'm trying to run an existing ruby on rails project. While am trying to run <code>bundle install</code> it fails with the following error.</p> <pre><code>Fetching mysql2 0.4.6 Installing mysql2 0.4.6 with native extensions Gem::Ext::BuildError: ERROR: Failed to build gem native extension. current directory: /home/vince/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/mysql2-0.4.6/ext/mysql2 /home/vince/.rbenv/versions/2.7.6/bin/ruby -I /home/vince/.rbenv/versions/2.7.6/lib/ruby/2.7.0 -r ./siteconf20221031-7332-kotkbi.rb extconf.rb checking for rb_absint_size()... yes checking for rb_absint_singlebit_p()... yes checking for ruby/thread.h... yes checking for rb_thread_call_without_gvl() in ruby/thread.h... yes checking for rb_thread_blocking_region()... no checking for rb_wait_for_single_fd()... yes checking for rb_hash_dup()... yes checking for rb_intern3()... yes checking for rb_big_cmp()... yes *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. Provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=/home/vince/.rbenv/versions/2.7.6/bin/$(RUBY_BASE_NAME) --with-ruby-dir --without-ruby-dir --with-ruby-include --without-ruby-include=${ruby-dir}/include --with-ruby-lib --without-ruby-lib=${ruby-dir}/lib --with-mysql-dir --without-mysql-dir --with-mysql-include --without-mysql-include=${mysql-dir}/include --with-mysql-lib --without-mysql-lib=${mysql-dir}/lib --with-mysql-config --without-mysql-config --with-mysqlclient-dir --without-mysqlclient-dir --with-mysqlclient-include --without-mysqlclient-include=${mysqlclient-dir}/include --with-mysqlclient-lib --without-mysqlclient-lib=${mysqlclient-dir}/lib --with-mysqlclientlib --without-mysqlclientlib /home/vince/.rbenv/versions/2.7.6/lib/ruby/2.7.0/mkmf.rb:1050:in `block in find_library': undefined method `split' for nil:NilClass (NoMethodError) from /home/vince/.rbenv/versions/2.7.6/lib/ruby/2.7.0/mkmf.rb:1050:in `collect' from /home/vince/.rbenv/versions/2.7.6/lib/ruby/2.7.0/mkmf.rb:1050:in `find_library' from extconf.rb:95:in `&lt;main&gt;' To see why this extension failed to compile, please check the mkmf.log which can be found here: /home/vince/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/extensions/x86_64-linux/2.7.0/mysql2-0.4.6/mkmf.log extconf failed, exit code 1 Gem files will remain installed in /home/vince/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/mysql2-0.4.6 for inspection. Results logged to /home/vince/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/extensions/x86_64-linux/2.7.0/mysql2-0.4.6/gem_make.out An error occurred while installing mysql2 (0.4.6), and Bundler cannot continue. Make sure that `gem install mysql2 -v '0.4.6' --source 'https://rubygems.org/'` succeeds before bundling. In Gemfile: mysql2 </code></pre> <p>The ruby version is <strong>2.7.6</strong> , Rails <strong>5.0.7.2</strong>, Environment <strong>Ubuntu 20.04</strong></p> <p>Does anyone know the cause of the issue and how it can be solved? I have tried with diffrent stack overflow answers and none of them helped.</p> <p>Please let me know if you need any further details.</p> <p>thank you.</p>
[ { "answer_id": 74265632, "author": "Osm", "author_id": 19529694, "author_profile": "https://Stackoverflow.com/users/19529694", "pm_score": 3, "selected": true, "text": "=ArrayFormula(\n LAMBDA(a, {QUERY({a},\"Select Col1\"),SPLIT(QUERY({a},\"Select Col2\"),\",\")})\n (QUERY('Alias Key Ra...
2022/10/31
[ "https://Stackoverflow.com/questions/74265545", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14988711/" ]
74,265,651
<p>Json output:</p> <pre><code>{ &quot;result&quot;: [ { &quot;id&quot;: &quot;fcf9728ed6e94078bae9ffe200bf1054&quot;, &quot;redirect&quot;: { &quot;source_url&quot;: &quot;www.1234.com/acssurgerynews/article/248345/transgender-health/detransitioners-received-poor-evaluation-when&quot;, &quot;include_subdomains&quot;: false, &quot;target_url&quot;: &quot;https://www.1234.com/viewarticle/962270&quot;, &quot;status_code&quot;: 301, &quot;preserve_query_string&quot;: false, &quot;subpath_matching&quot;: false, &quot;preserve_path_suffix&quot;: false }, &quot;created_on&quot;: &quot;2022-09-07T17:12:21Z&quot;, &quot;modified_on&quot;: &quot;2022-09-07T17:12:21Z&quot; }, { &quot;id&quot;: &quot;fac3ab84691b44219c270a5dd073e374&quot;, &quot;redirect&quot;: { &quot;source_url&quot;: &quot;www.1234.com/advanced-and-metastatic-breast-cancer/article/248363/breast-cancer/liquid-biopsy-metastatic-breast&quot;, &quot;include_subdomains&quot;: false, &quot;target_url&quot;: &quot;https://www.1234.com/viewarticle/942277&quot;, &quot;status_code&quot;: 301, &quot;preserve_query_string&quot;: false, &quot;subpath_matching&quot;: false, &quot;preserve_path_suffix&quot;: false }, &quot;created_on&quot;: &quot;2022-09-07T17:12:21Z&quot;, &quot;modified_on&quot;: &quot;2022-09-07T17:12:21Z&quot; }, { &quot;id&quot;: &quot;0ae189027c574eedac22f854b4676568&quot;, &quot;redirect&quot;: { &quot;source_url&quot;: &quot;www.1234.com/advanced-and-metastatic-breast-cancer/article/249807/breast-cancer/evolving-her2-metastatic-breast&quot;, &quot;include_subdomains&quot;: false, &quot;target_url&quot;: &quot;https://www.1234.com/viewarticle/963856&quot;, &quot;status_code&quot;: 301, &quot;preserve_query_string&quot;: false, &quot;subpath_matching&quot;: false, &quot;preserve_path_suffix&quot;: false }, &quot;created_on&quot;: &quot;2022-09-07T17:12:21Z&quot;, &quot;modified_on&quot;: &quot;2022-09-07T17:12:21Z&quot; } ], &quot;success&quot;: true, &quot;errors&quot;: [], &quot;messages&quot;: [], &quot;result_info&quot;: { &quot;cursors&quot;: { &quot;after&quot;: &quot;equIy9ku2FDvBVLy0avqNewCdepOQiaIaSilEIhBNwhHDIkcF5EjJkYqPwqeewvR5Rb6UO4LB5moBKoO9puoiyJ9QY_bidbcFtbpp60QzYEl_9Hls0jD_2oINTM_CWJPCBTvzmVu7LlUCNTB_UxXE-Ox6h8vuhE&quot; } } } </code></pre> <p>What I'm looking to output on the same line such as:</p> <p><strong>.id,.redirect.source_url,.redirect.target_url,.cursors_after</strong></p> <p>fcf9728ed6e94078bae9ffe200bf1054,www.123.com/123,https://www.123.com/xxx fcf9728ed6e94078bae9ffe200bf1054,www.123.com/123,https://www.123.com/xxx fcf9728ed6e94078bae9ffe200bf1054,www.123.com/123,https://www.123.com/xxx</p>
[ { "answer_id": 74265632, "author": "Osm", "author_id": 19529694, "author_profile": "https://Stackoverflow.com/users/19529694", "pm_score": 3, "selected": true, "text": "=ArrayFormula(\n LAMBDA(a, {QUERY({a},\"Select Col1\"),SPLIT(QUERY({a},\"Select Col2\"),\",\")})\n (QUERY('Alias Key Ra...
2022/10/31
[ "https://Stackoverflow.com/questions/74265651", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2193480/" ]