qid
int64
4
22.2M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
74,134,470
<p>I have this a_tag element: <code>&lt;a href=&quot;Mywebsite/test/cart/&quot; class=&quot;added_to_cart&quot; title=&quot;View cart&quot;&gt;View cart&lt;/a&gt; </code> which is bound to different click events by outer plugins used on my website, I tried to remove all the other click events using this, <code>$('.added_to_cart').click(function() { return false; });</code> Which is working fine but it is also disabling the href link redirection.</p> <p>Is there a way to remove all the click events and keep the href link redirection ??</p>
[ { "answer_id": 74134650, "author": "some name", "author_id": 11917187, "author_profile": "https://Stackoverflow.com/users/11917187", "pm_score": 3, "selected": true, "text": "return false" }, { "answer_id": 74134674, "author": "Mohammed Maheswer", "author_id": 14890293, ...
2022/10/20
[ "https://Stackoverflow.com/questions/74134470", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20216105/" ]
74,134,479
<p>I am trying to iterate in ascending order through numbers that only consist of digits 2, 3, 5 and 7. However the initial input number may contain other digits. But after the first iteration we will be dealing with strictly the digits 2, 3, 5 and 7 only.</p> <h3>Examples:</h3> <p><strong>Input</strong></p> <pre><code> 3257737 3257777 3257787 </code></pre> <p><strong>Expected output</strong></p> <pre><code> 3257737 =&gt; 3257752 3257777 =&gt; 3272222 3257787 =&gt; 3272222 </code></pre> <p>These are 3 test cases on 3 separate lines. The output numbers could serve as input again to produce a series of increasing numbers.</p> <p>My idea was to replace the last digit like this:</p> <pre><code>string generate_next_number(s){ int len = s.length(); if (s[len-1] &lt; '2') { s[len-1] = '2'; } else if (s[len-1] == '2') { s[len-1] = '3'; } else if (s[len-1] &lt; '5') { s[len-1] = '5'; } else if (s[len-1] &lt; '7'){ s[len-1] = '7'; } else { s[len-1] = '2'; string s2 = generate_next_number(substr(s.length()-1)); s = s2 + s[len-1]; } return s; } </code></pre> <p>I couldn't make this recursive code to work. It doesn't compile. What is wrong and how can I fix it?</p> <hr> <p>I here add also a O(4^no_of_digits) code, although it is clear that this naive approach is not generic enough, as it is limited to a number of digits.</p> <p>Here I have coded for a sample 10 digit number in python. For variable digits we might have to use recursion:</p> <pre class="lang-py prettyprint-override"><code> def get_next_number(num): t1 = 10 t2 = 10*10 t3 = 10*t2 t4 = 10*t3 t5 = 10*t4 t6 = 10*t5 t7 = 10*t6 t8 = 10*t7 t9 = 10*t8 digits = [2,3,5,7] for i9 in digits: d9=i9*t9 for i8 in digits: d8=i8*t8 for i7 in digits: d7=i7*t7 for i6 in digits: d6=i6*t6 for i5 in digits: d5=i5*t5 for i4 in digits: d4=i4*t4 for i3 in digits: d3=i3*t3 for i2 in digits: d2=i2*t2 for i1 in digits: d1=i1*t1 for i0 in digits: d0=i0 n = d17+d16+d15+d14+d13+d12+d11+d10+d9+d8+d7+d6+d5+d4+d3+d2+d1+d0 if n &lt;= num: continue return n # this 11-digit number scenario will be encountered if num is # the largest possible 10 digit number of this kind return 22222222222 </code></pre>
[ { "answer_id": 74134650, "author": "some name", "author_id": 11917187, "author_profile": "https://Stackoverflow.com/users/11917187", "pm_score": 3, "selected": true, "text": "return false" }, { "answer_id": 74134674, "author": "Mohammed Maheswer", "author_id": 14890293, ...
2022/10/20
[ "https://Stackoverflow.com/questions/74134479", "https://Stackoverflow.com", "https://Stackoverflow.com/users/865220/" ]
74,134,480
<p>I recently implemented unique username into my app when registering, all good far here, by the way I also need to set it to when the user is editting it's profile.</p> <p>I tried to do the same thing, but I'm facing an issue here. The app don't let save the profile, because it's checking if the username's taken and, as we're already using one, it won't let us do it.</p> <p><em><strong>Ex.:</strong></em> My username is <strong>&quot;bob&quot;</strong>, I changed my profile pic or my display name, so when I click to save, the app will do a username checking in the background and will not let me save it because the username is already taken, but the problem is that it's already my user.</p> <p>I've tried to set this, but failed:</p> <pre><code>if (document.equals(setup_username.getText().toString()) || document.isEmpty()){ updateProfile(); </code></pre> <p>Here's my code:</p> <pre><code>setup_progressbar.setVisibility(View.VISIBLE); FirebaseFirestore.getInstance().collection(&quot;Users&quot;).whereEqualTo(&quot;username&quot;,setup_username.getText().toString()).get().addOnCompleteListener((task) -&gt; { if (task.isSuccessful()){ List&lt;DocumentSnapshot&gt; document = task.getResult().getDocuments(); if (document.equals(setup_username.getText().toString()) || document.isEmpty()){ updateProfile(); } else { setup_progressbar.setVisibility(View.INVISIBLE); setup_username.setError(getString(R.string.username_taken)); return; } } else { setup_progressbar.setVisibility(View.INVISIBLE); String error = task.getException().getMessage(); FancyToast.makeText(getApplicationContext(), error, FancyToast.LENGTH_SHORT, FancyToast.ERROR, false).show(); } }); </code></pre> <p><em>So how to get around this and only forbid it when I try to change my username to another that is taken? Like: <strong>&quot;bob&quot;</strong> to <strong>&quot;bill&quot;</strong>, but <strong>&quot;bill&quot;</strong> is already taken, so it won't allow.</em></p>
[ { "answer_id": 74138652, "author": "Frank van Puffelen", "author_id": 209103, "author_profile": "https://Stackoverflow.com/users/209103", "pm_score": 1, "selected": false, "text": "Users" } ]
2022/10/20
[ "https://Stackoverflow.com/questions/74134480", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11257675/" ]
74,134,495
<p>sorry if the title is confusing, i don't know much about html. i'm wondering if there's a way you can make these two boxes stay the same size even if the content in one makes it bigger than the other? like, is there a way to make the smaller box mirror the bigger one's size, even if it has less stuff in it? html btw</p> <p>attaching what i have as the coding right now; i think the reason i can't find an answer is because i don't really know how to ask the question, so i hope this makes sense to y'all. <a href="https://i.stack.imgur.com/InMyq.png" rel="nofollow noreferrer">link to the coding i have right now</a> thanks in advance for any help :}</p>
[ { "answer_id": 74138652, "author": "Frank van Puffelen", "author_id": 209103, "author_profile": "https://Stackoverflow.com/users/209103", "pm_score": 1, "selected": false, "text": "Users" } ]
2022/10/20
[ "https://Stackoverflow.com/questions/74134495", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20288169/" ]
74,134,511
<p>I'm trying to set the 'keys' variable inside a set function.</p> <p>The 'keys' variable will not pass as the key</p> <p>How do I go about passing the variable keys as the key inside of this object?</p> <pre><code>const [user, setUser] = useState({ key: 'value', key2: 'value2', key3: 'value3' }) const passwordChange = (keys, elem) =&gt; { setUser({...user, keys: elem}) } passwordChange(key3, 'new value') </code></pre>
[ { "answer_id": 74138652, "author": "Frank van Puffelen", "author_id": 209103, "author_profile": "https://Stackoverflow.com/users/209103", "pm_score": 1, "selected": false, "text": "Users" } ]
2022/10/20
[ "https://Stackoverflow.com/questions/74134511", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2404079/" ]
74,134,517
<p>This snippet was used in an activity(onCreate) :</p> <pre><code> binding = ActivityMainBinding.inflate(layoutInflater) setContentView(binding.root) </code></pre> <p>This snippet was used in an Fragment(onCreateView) :</p> <pre><code> cameraView = inflater.inflate(R.layout.fragment_camera_view, container, false) return cameraView </code></pre>
[ { "answer_id": 74134686, "author": "Hanry", "author_id": 626481, "author_profile": "https://Stackoverflow.com/users/626481", "pm_score": 1, "selected": false, "text": "text1" }, { "answer_id": 74144921, "author": "cactustictacs", "author_id": 13598222, "author_profile...
2022/10/20
[ "https://Stackoverflow.com/questions/74134517", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20117118/" ]
74,134,535
<p>I want to send dynamic query to the mongoose <strong>find()</strong> method. For each iteration I need to send dynamic key and value in find method. Can someone help in this and I have tried below. The query for each iteration needs to be <code>find({ idle_screen : value}), find({verify_address : value})</code></p> <pre><code>const relatedDoc: any = { idle_screen:1, verify_address: 2, update_address :3 }; Object.entries(relatedDoc).forEach(async ([key, value]) =&gt; { // Here i want to add key as property in object const query = { key : value} // actual o/p = {key : 1} , expected o/p = {idle_screen : 1} , {verify_address : 2} var appointmentRefDocs = await appointment.find(query); })``` Thanks in advance. </code></pre>
[ { "answer_id": 74134594, "author": "Saurabh Mistry", "author_id": 6943762, "author_profile": "https://Stackoverflow.com/users/6943762", "pm_score": 2, "selected": false, "text": "const relatedDoc: any = {\n idle_screen:data.idle_screen, \n verify_address: data.verify_address, \...
2022/10/20
[ "https://Stackoverflow.com/questions/74134535", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9391150/" ]
74,134,561
<p>I have a laravel form to create a new product entry in a database on submit, am supposed to be redirected back but I get a completely blank page without any errors. There is no new entry in my database when I check. The form is made up of various text fields, an image URL, and a multi-selected Image URL</p> <p>please this is my blade template</p> <pre><code>&lt;form method=&quot;POST&quot; action=&quot;{{ route('products.store') }}&quot; enctype=&quot;multipart/form-data&quot;&gt; &lt;h4 class=&quot;card-title&quot;&gt;Create Product&lt;/h4&gt;&lt;br&gt;&lt;br&gt; @csrf &lt;div class=&quot;row&quot;&gt; &lt;div class=&quot;col&quot;&gt; &lt;div class=&quot;row mbr-1&quot;&gt; &lt;label for=&quot;example-text-input&quot; class=&quot;col-sm-2 col-form-label&quot;&gt;Name&lt;/label&gt; &lt;div class=&quot;col-sm-6&quot;&gt; &lt;input name=&quot;name&quot; class=&quot;form-control&quot; type=&quot;text&quot; value=&quot;&quot; id=&quot;example-text-input&quot;&gt; &lt;/div&gt; &lt;/div&gt; &lt;!-- end row --&gt; &lt;/div&gt; &lt;div class=&quot;col&quot;&gt; &lt;div class=&quot;row mb-3&quot;&gt; &lt;label for=&quot;example-text-input&quot; class=&quot;col-sm-2 col-form-label&quot;&gt;Category&lt;/label&gt; &lt;div class=&quot;col-sm-6&quot;&gt; &lt;input name=&quot;name&quot; class=&quot;form-control&quot; type=&quot;text&quot; value=&quot;&quot; id=&quot;example-text-input&quot;&gt; &lt;/div&gt; &lt;/div&gt; &lt;!-- end row --&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class=&quot;container&quot;&gt; &lt;div class=&quot;row&quot;&gt; &lt;div class=&quot;col&quot;&gt; &lt;div class=&quot;row mb-3&quot;&gt; &lt;label for=&quot;example-text-input&quot; class=&quot;col-sm-2 col-form-label&quot;&gt;Price&lt;/label&gt; &lt;div class=&quot;col-sm-6&quot;&gt; &lt;input name=&quot;catchy_title&quot; class=&quot;form-control&quot; type=&quot;number&quot; value=&quot;&quot; id=&quot;example-text-input&quot;&gt; &lt;/div&gt; &lt;/div&gt; &lt;!-- end row --&gt; &lt;/div&gt; &lt;div class=&quot;col&quot;&gt; &lt;div class=&quot;row mb-3&quot;&gt; &lt;label for=&quot;example-text-input&quot; class=&quot;col-sm-2 col-form-label&quot;&gt;Status&lt;/label&gt; &lt;div class=&quot;col-sm-6&quot;&gt; &lt;input name=&quot;status&quot; class=&quot;form-control&quot; type=&quot;text&quot; value=&quot;&quot; id=&quot;example-text-input&quot;&gt; &lt;/div&gt; &lt;/div&gt; &lt;!-- end row --&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class=&quot;container&quot;&gt; &lt;div class=&quot;row mb-3&quot;&gt; &lt;label for=&quot;example-text-input&quot; class=&quot;col-sm-2 col-form-label&quot;&gt;Product Description&lt;/label&gt; &lt;div class=&quot;col-sm-8&quot;&gt; &lt;textarea id=&quot;elm1&quot; name=&quot;long_description&quot; placeholder=&quot;Please enter a vivid description of the product&quot;&gt;&lt;/textarea&gt; &lt;/div&gt; &lt;/div&gt; &lt;!-- end row --&gt; &lt;/div&gt; &lt;div class=&quot;container&quot;&gt; &lt;div class=&quot;row&quot;&gt; &lt;div class=&quot;col&quot;&gt; &lt;div class=&quot;row mb-3&quot;&gt; &lt;label for=&quot;example-text-input&quot; class=&quot;col-sm-2 col-form-label&quot;&gt;Tags&lt;/label&gt; &lt;div class=&quot;col-sm-6&quot;&gt; &lt;input name=&quot;tags&quot; class=&quot;form-control&quot; type=&quot;text&quot; value=&quot;&quot; id=&quot;example-text-input&quot;&gt; &lt;/div&gt; &lt;/div&gt; &lt;!-- end row --&gt; &lt;/div&gt; &lt;div class=&quot;col&quot;&gt; &lt;div class=&quot;row mb-3&quot;&gt; &lt;label for=&quot;example-text-input&quot; class=&quot;col-sm-2 col-form-label&quot;&gt;Estimated Delivery Time&lt;/label&gt; &lt;div class=&quot;col-sm-6&quot;&gt; &lt;input name=&quot;estimated_delivery_time&quot; class=&quot;form-control&quot; type=&quot;text&quot; value=&quot;&quot; id=&quot;example-text-input&quot;&gt; &lt;/div&gt; &lt;/div&gt; &lt;!-- end row --&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class=&quot;container&quot;&gt; &lt;div class=&quot;row&quot;&gt; &lt;div class=&quot;col&quot;&gt; &lt;div class=&quot;row mb-3&quot;&gt; &lt;label for=&quot;example-text-input&quot; class=&quot;col-sm-2 col-form-label&quot;&gt;Available Quantity&lt;/label&gt; &lt;div class=&quot;col-sm-6&quot;&gt; &lt;input name=&quot;available_quantity&quot; class=&quot;form-control&quot; type=&quot;text&quot; value=&quot;&quot; id=&quot;example-text-input&quot;&gt; &lt;/div&gt; &lt;/div&gt; &lt;!-- end row --&gt; &lt;/div&gt; &lt;div class=&quot;col&quot;&gt; &lt;div class=&quot;row mb-3&quot;&gt; &lt;label for=&quot;example-text-input&quot; class=&quot;col-sm-2 col-form-label&quot;&gt;Colors&lt;/label&gt; &lt;div class=&quot;col-sm-6&quot;&gt; &lt;input name=&quot;colors&quot; class=&quot;form-control&quot; type=&quot;text&quot; value=&quot;&quot; id=&quot;example-text-input&quot;&gt; &lt;/div&gt; &lt;/div&gt; &lt;!-- end row --&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class=&quot;container&quot;&gt; &lt;div class=&quot;row&quot;&gt; &lt;div class=&quot;col&quot;&gt; &lt;div class=&quot;row mb-3&quot;&gt; &lt;label for=&quot;example-text-input&quot; class=&quot;col-sm-2 col-form-label&quot;&gt;Supplier's Name&lt;/label&gt; &lt;div class=&quot;col-sm-6&quot;&gt; &lt;input name=&quot;supplier_name&quot; class=&quot;form-control&quot; type=&quot;text&quot; value=&quot;&quot; id=&quot;example-text-input&quot;&gt; &lt;/div&gt; &lt;/div&gt; &lt;!-- end row --&gt; &lt;/div&gt; &lt;div class=&quot;col&quot;&gt; &lt;div class=&quot;row mb-3&quot;&gt; &lt;label for=&quot;example-text-input&quot; class=&quot;col-sm-2 col-form-label&quot;&gt;Supplier's Contact&lt;/label&gt; &lt;div class=&quot;col-sm-6&quot;&gt; &lt;input name=&quot;supplier_contact&quot; class=&quot;form-control&quot; type=&quot;text&quot; value=&quot;&quot; id=&quot;example-text-input&quot;&gt; &lt;/div&gt; &lt;/div&gt; &lt;!-- end row --&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class=&quot;container&quot;&gt; &lt;div class=&quot;row&quot;&gt; &lt;div class=&quot;col&quot;&gt; &lt;div class=&quot;row mb-3&quot;&gt; &lt;label for=&quot;example-text-input&quot; class=&quot;col-sm-2 col-form-label&quot;&gt;Video Url / Link&lt;/label&gt; &lt;div class=&quot;col-sm-6&quot;&gt; &lt;input name=&quot;video_description&quot; class=&quot;form-control&quot; type=&quot;text&quot; value=&quot;&quot; id=&quot;example-text-input&quot;&gt; &lt;/div&gt; &lt;/div&gt; &lt;!-- end row --&gt; &lt;/div&gt; &lt;div class=&quot;col&quot;&gt; &lt;div class=&quot;row mb-3&quot;&gt; &lt;label for=&quot;example-text-input&quot; class=&quot;col-sm-2 col-form-label&quot;&gt;Primarry Image&lt;/label&gt; &lt;div class=&quot;col-sm-6&quot;&gt; &lt;input name=&quot;primary_image&quot; accept=&quot;image/*&quot; class=&quot;form-control&quot; type=&quot;file&quot; id=&quot;image&quot;&gt; &lt;/div&gt; &lt;/div&gt; &lt;!-- end row --&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class=&quot;container&quot;&gt; &lt;div class=&quot;row&quot;&gt; &lt;div class=&quot;col&quot;&gt; &lt;div class=&quot;row mb-3&quot;&gt; &lt;label for=&quot;example-text-input&quot; class=&quot;col-sm-2 col-form-label&quot;&gt; Primary Image Preview&lt;/label&gt; &lt;div class=&quot;col-sm-6&quot;&gt; &lt;img id=&quot;showImage&quot; class=&quot;&quot; width=&quot;300px&quot; src=&quot;{{ !empty($Product-&gt;image) ? url('upload/products/' . $product-&gt;image) : url('upload/no_image.jpg') }}&quot; alt=&quot;Hero image&quot;&gt; &lt;/div&gt; &lt;/div&gt; &lt;!-- end row --&gt; &lt;/div&gt; &lt;div class=&quot;col&quot;&gt; &lt;div class=&quot;row mb-3&quot;&gt; &lt;label for=&quot;example-text-input&quot; class=&quot;col-sm-2 col-form-label&quot;&gt;Add Other Images&lt;/label&gt; &lt;div class=&quot;col-sm-6&quot;&gt; &lt;input name=&quot;multi_image[]&quot; accept=&quot;image/*&quot; class=&quot;form-control&quot; type=&quot;file&quot; id=&quot;image&quot; multiple=&quot;&quot;&gt; &lt;/div&gt; &lt;/div&gt; &lt;!-- end row --&gt; &lt;/div&gt; &lt;/div&gt; &lt;input type=&quot;submit&quot; class=&quot;btn btn-info waves-effect waves-light&quot; value=&quot;Create Product&quot;&gt; &lt;/form&gt; </code></pre> <p>and this is my store function</p> <pre><code> public function store(Request $request) { if ($request-&gt;file('image')) { $image = $request-&gt;file('image'); $name_gen = hexdec(uniqid()).'.'.$image-&gt;getClientOriginalExtension(); // 3434343443.jpg Image::make($image)-&gt;resize(523,605)-&gt;save('upload/home_about/'.$name_gen); $save_url = 'upload/products/'.$name_gen; $this-&gt;validate($request, [ 'name' =&gt; $request-&gt;name, 'category' =&gt; $request-&gt;category, 'price' =&gt; $request-&gt;price, 'description' =&gt; $request-&gt;description, 'status' =&gt; $request -&gt; status, 'tags' =&gt; $request -&gt; tags, 'estimated_delivery_time' =&gt; $request-&gt;estimated_delivery_time, 'available_quantity' =&gt; $request-&gt;available_quantity, 'colors' =&gt; $request-&gt;colors, 'supplier_name' =&gt; $request-&gt;supplier_name, 'supplier_phone' =&gt; $request-&gt;supplier_phone, 'video_description' =&gt; $request-&gt;video_description, 'primary_image' =&gt; $save_url, 'other_images' =&gt; $save_url, ]); $notification = array( 'message' =&gt; 'Product created successfully', 'alert-type' =&gt; 'success' ); return redirect()-&gt;back()-&gt;with($notification); } </code></pre> <p>Please what am I doing wrong?</p> <p>thank you for taking some time to review</p>
[ { "answer_id": 74134585, "author": "DCodeMania", "author_id": 8546303, "author_profile": "https://Stackoverflow.com/users/8546303", "pm_score": -1, "selected": false, "text": "return redirect()->route('route-name-here')->with($notification);\n" }, { "answer_id": 74135979, "au...
2022/10/20
[ "https://Stackoverflow.com/questions/74134561", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18016271/" ]
74,134,580
<p>I currently have a cdktf (terraform cdk for typescript) project where I have a variable defined as follows:</p> <pre><code>const resourceName = new TerraformVariable(this, &quot;resourceName&quot;, { type: &quot;string&quot;, default: &quot;defaultResourceName&quot;, description: &quot;resource name&quot;, }); </code></pre> <p>However, when I run <code>cdktf deploy -var=&quot;resourceName=foo&quot;</code> I am seeing that the <code>resourceName</code> variable is still <code>defaultResourceName</code> rather than <code>foo</code> as I have intended to pass in via the cli. According to the terraform documentation at <a href="https://www.terraform.io/language/values/variables#variables-on-the-command-line" rel="nofollow noreferrer">https://www.terraform.io/language/values/variables#variables-on-the-command-line</a> this is the right way to pass in variables on the cli but it's clearly not working here - would anyone know the actual correct way? I know variables can be dynamically changed via environment variables but I'd ideally like to just pass variables through cli directly.</p>
[ { "answer_id": 74134665, "author": "Anand Damdiyal", "author_id": 20248718, "author_profile": "https://Stackoverflow.com/users/20248718", "pm_score": -1, "selected": false, "text": "cdktf deploy -p resourceName=foo" }, { "answer_id": 74184178, "author": "javierlga", "auth...
2022/10/20
[ "https://Stackoverflow.com/questions/74134580", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14917411/" ]
74,134,589
<p>I have a strange hydration error in NextJS! I wonder if anyone can help me get to the bottom of it?</p> <p>I have an object which gets processed synchronously. If i stringify this object and render it, i dont get an error.</p> <p>but if, after stringifying it, i map through it, I get this hydration error.</p> <p>What could be going on here?</p> <pre class="lang-js prettyprint-override"><code>const OpponentList = ({ opponents }: Props) =&gt; { return ( &lt;ul&gt; &lt;p&gt;{JSON.stringify(opponents)}&lt;/p&gt; // NO ERROR {opponents.map((opponent) =&gt; {. // HYDRATION ERROR return &lt;li key={opponent.username}&gt;{opponent.username}&lt;/li&gt;; })} &lt;/ul&gt; ); }; export default OpponentList; </code></pre>
[ { "answer_id": 74134665, "author": "Anand Damdiyal", "author_id": 20248718, "author_profile": "https://Stackoverflow.com/users/20248718", "pm_score": -1, "selected": false, "text": "cdktf deploy -p resourceName=foo" }, { "answer_id": 74184178, "author": "javierlga", "auth...
2022/10/20
[ "https://Stackoverflow.com/questions/74134589", "https://Stackoverflow.com", "https://Stackoverflow.com/users/887804/" ]
74,134,608
<div class="s-table-container"> <table class="s-table"> <thead> <tr> <th style="text-align: left;">serial</th> <th style="text-align: center;">name</th> <th style="text-align: right;">match</th> </tr> </thead> <tbody> <tr> <td style="text-align: left;">1</td> <td style="text-align: center;">John</td> <td style="text-align: right;">5,6,8</td> </tr> <tr> <td style="text-align: left;">2</td> <td style="text-align: center;">Steve</td> <td style="text-align: right;">1,7</td> </tr> <tr> <td style="text-align: left;">3</td> <td style="text-align: center;">Kevin</td> <td style="text-align: right;">4</td> </tr> <tr> <td style="text-align: left;">4</td> <td style="text-align: center;">Kevin</td> <td style="text-align: right;">3</td> </tr> <tr> <td style="text-align: left;">5</td> <td style="text-align: center;">John</td> <td style="text-align: right;">1,6,8</td> </tr> <tr> <td style="text-align: left;">6</td> <td style="text-align: center;">Johnn</td> <td style="text-align: right;">1,5,8</td> </tr> <tr> <td style="text-align: left;">7</td> <td style="text-align: center;">Steves</td> <td style="text-align: right;">2</td> </tr> <tr> <td style="text-align: left;">8</td> <td style="text-align: center;">John</td> <td style="text-align: right;">1,5,6</td> </tr> </tbody> </table> </div> <p>Need to check and match the name of each row with the name of the row serial number mentioned in it's match column. Keep the serials matching else remove it. If nothing is matching then put null.</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th style="text-align: left;">serial</th> <th style="text-align: center;">name</th> <th style="text-align: right;">match</th> <th style="text-align: right;">updated_match</th> </tr> </thead> <tbody> <tr> <td style="text-align: left;">1</td> <td style="text-align: center;">John</td> <td style="text-align: right;">5,6,8</td> <td style="text-align: right;">5,8</td> </tr> <tr> <td style="text-align: left;">2</td> <td style="text-align: center;">Steve</td> <td style="text-align: right;">1,7</td> <td style="text-align: right;"></td> </tr> <tr> <td style="text-align: left;">3</td> <td style="text-align: center;">Kevin</td> <td style="text-align: right;">4</td> <td style="text-align: right;">4</td> </tr> <tr> <td style="text-align: left;">4</td> <td style="text-align: center;">Kevin</td> <td style="text-align: right;">3</td> <td style="text-align: right;">3</td> </tr> <tr> <td style="text-align: left;">5</td> <td style="text-align: center;">John</td> <td style="text-align: right;">1,6,8</td> <td style="text-align: right;">1,8</td> </tr> <tr> <td style="text-align: left;">6</td> <td style="text-align: center;">Johnn</td> <td style="text-align: right;">1,5,8</td> <td style="text-align: right;"></td> </tr> <tr> <td style="text-align: left;">7</td> <td style="text-align: center;">Steves</td> <td style="text-align: right;">2</td> <td style="text-align: right;"></td> </tr> <tr> <td style="text-align: left;">8</td> <td style="text-align: center;">John</td> <td style="text-align: right;">1,5,6</td> <td style="text-align: right;">1,5</td> </tr> </tbody> </table> </div>
[ { "answer_id": 74134665, "author": "Anand Damdiyal", "author_id": 20248718, "author_profile": "https://Stackoverflow.com/users/20248718", "pm_score": -1, "selected": false, "text": "cdktf deploy -p resourceName=foo" }, { "answer_id": 74184178, "author": "javierlga", "auth...
2022/10/20
[ "https://Stackoverflow.com/questions/74134608", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
74,134,614
<p>I have long vector of strings. e.g. <code>c('aecde1234e', 'ewert6e8e0')</code></p> <p>I want to compare each chacter in each string to one specific lookup character, e.g. <code>'e'</code>.</p> <p>The goal is to have a long vector of strings with the result e.g. <code>c('0100100001', '1010001010')</code>.</p> <p>How can I write such a comparison in R ?</p>
[ { "answer_id": 74134663, "author": "Jilber Urbina", "author_id": 1315767, "author_profile": "https://Stackoverflow.com/users/1315767", "pm_score": 3, "selected": true, "text": "> string <- c('aecde1234e', 'ewert6e8e0')\n> sapply(strsplit(string, \"\"), function(x) paste(as.numeric(x == \...
2022/10/20
[ "https://Stackoverflow.com/questions/74134614", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7956263/" ]
74,134,622
<p>just asking can you please tell me how can I achieve it when I clicked the button it should only add the class on its parent div. Currently its adding both the parent div even I click the first button</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>$( ".main-btn" ).each(function(index) { $(this).on("click", function(){ $(".main").addClass("addClass") }); });</code></pre> <pre class="snippet-code-css lang-css prettyprint-override"><code>.main { background: yellow; margin-bottom: 3px; height: 50px; } .main.addClass { background: green; }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"&gt;&lt;/script&gt; &lt;div class="main"&gt; &lt;div class="main-btn"&gt;Button&lt;/div&gt; &lt;/div&gt; &lt;div class="main"&gt; &lt;div class="main-btn"&gt;Button&lt;/div&gt; &lt;/div&gt;</code></pre> </div> </div> </p>
[ { "answer_id": 74134654, "author": "Phil", "author_id": 283366, "author_profile": "https://Stackoverflow.com/users/283366", "pm_score": 2, "selected": false, "text": ".each()" }, { "answer_id": 74135843, "author": "Sigurd Mazanti", "author_id": 14776809, "author_profi...
2022/10/20
[ "https://Stackoverflow.com/questions/74134622", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16170674/" ]
74,134,639
<p>I have an array of company reviews like below, and from that, I am trying to generate three new arrays. I have managed to create two arrays with sums but the last one(rating filter) is where I got stuck, want to create an array for the ratings with 5 items like 1 star, 2 stars, and so on.</p> <pre><code>const reviews = [ { designation_id: 544, designation: 'Software Developer', department_id: 18, department: 'IT &amp; Information Security', overall_rating: 4 }, { designation_id: 592, designation: 'UI Designer', department_id: 37, department: 'UX, Design &amp; Architecture', overall_rating: 5 }, { designation_id: 544, designation: 'Software Developer', department_id: 18, department: 'IT &amp; Information Security', overall_rating: 3 } ] </code></pre> <p>The <strong>desired Output</strong>:</p> <pre><code>const ratingFilter = [ {count: 2, name: '1 Star'}, {count: 1, name: '2 Stars'}, {count: 3, name: '3 Stars'}, {count: 1, name: '4 Stars'}, {count: 2, name: '5 Stars'}, ] </code></pre> <p>This is what I have done so far:</p> <pre><code>const departmentFilters = []; const designationFilters = []; arr.reduce((accu: { [key: string]: any }, curr) =&gt; { const departmentKey = curr.department .split(' ') .join('_') .toLowerCase(); const designationKey = curr.designation .split(' ') .join('_') .toLowerCase(); //departments filters if (!accu[departmentKey]) { accu[departmentKey] = { count: 1, name: curr.department, id: curr.department_id }; departmentFilters.push(accu[departmentKey]); } else { accu[departmentKey].count++; } //desinations filters if (!accu[designationKey]) { accu[designationKey] = { count: 1, name: curr.designation, id: curr.designation_id }; designationFilters.push(accu[designationKey]); } else { accu[designationKey].count++; } return accu; }, Object.create(null)); </code></pre>
[ { "answer_id": 74134654, "author": "Phil", "author_id": 283366, "author_profile": "https://Stackoverflow.com/users/283366", "pm_score": 2, "selected": false, "text": ".each()" }, { "answer_id": 74135843, "author": "Sigurd Mazanti", "author_id": 14776809, "author_profi...
2022/10/20
[ "https://Stackoverflow.com/questions/74134639", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12202749/" ]
74,134,643
<p>Our app update got rejected by Google because we had REQUEST_INSTALL_PACKAGES in the Manifest. We removed it, uploaded a new version and it still got rejected. We then added</p> <pre><code> &lt;uses-permission android:name=&quot;android.permission.REQUEST_INSTALL_PACKAGES&quot; tools:node=&quot;remove&quot;/&gt; </code></pre> <p>as suggested here on SO, but to no avail. We continue to get rejected. There is no REQUEST_INSTALL_PACKAGES in our Manfiest and not in the Merged Manifest either. What are we missing?</p>
[ { "answer_id": 74134654, "author": "Phil", "author_id": 283366, "author_profile": "https://Stackoverflow.com/users/283366", "pm_score": 2, "selected": false, "text": ".each()" }, { "answer_id": 74135843, "author": "Sigurd Mazanti", "author_id": 14776809, "author_profi...
2022/10/20
[ "https://Stackoverflow.com/questions/74134643", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1112269/" ]
74,134,666
<p>I'm new to AWS CDK and I'm trying to set up lambda with few AWS managed policies.</p> <p>Lambda configuration,</p> <pre><code>this.lambdaFunction = new Function(this, 'LambdaName', { functionName: 'LambdaName', description: `Timestamp: ${new Date().toISOString()} `, code: ..., handler: '...', memorySize: 512, timeout: Duration.seconds(30), vpc: ..., runtime: Runtime.PYTHON_3_8, }); </code></pre> <p>I want to add <code>AmazonRedshiftDataFullAccess</code> ManagedPolicy to lambda role but couldn't find out a way to do it as <code>addToRolePolicy</code> supports only the <code>PolicyStatement</code> and not <code>ManagedPolicy</code>.</p> <p>Tried something as following, it errored out saying role may be undefined.</p> <pre><code>this.lambdaFunction.role .addManagedPolicy(ManagedPolicy.fromAwsManagedPolicyName(&quot;service-role/AmazonRedshiftDataFullAccess&quot;)); </code></pre> <p>Could anyone help me understand what is the right way to add a ManagedPolicy to the default role that gets created with the lambda function?</p>
[ { "answer_id": 74134654, "author": "Phil", "author_id": 283366, "author_profile": "https://Stackoverflow.com/users/283366", "pm_score": 2, "selected": false, "text": ".each()" }, { "answer_id": 74135843, "author": "Sigurd Mazanti", "author_id": 14776809, "author_profi...
2022/10/20
[ "https://Stackoverflow.com/questions/74134666", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5848966/" ]
74,134,679
<p>Why we should use <code>suspend</code>? Are they used only to restrict a function not to be used outside coroutine scope or other <code>suspend</code> functions?</p>
[ { "answer_id": 74134654, "author": "Phil", "author_id": 283366, "author_profile": "https://Stackoverflow.com/users/283366", "pm_score": 2, "selected": false, "text": ".each()" }, { "answer_id": 74135843, "author": "Sigurd Mazanti", "author_id": 14776809, "author_profi...
2022/10/20
[ "https://Stackoverflow.com/questions/74134679", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14110478/" ]
74,134,680
<p>I have a RichTextBox that logs information about my app. Here is an example of what it may log:</p> <pre><code>&lt;22:52:21:179&gt; Starting Argo Studio &lt;22:52:22:731&gt; Argo Studio has finished starting &lt;22:52:30:41&gt; Time to load commands: 00:00:00.00 &lt;22:52:30:48&gt; Created 'App 1' </code></pre> <p>The text between the <code>&lt;</code> and the <code>&gt;</code> is the time.</p> <p><strong>I need to change the color of the time to gray.</strong></p> <p>Previously, I did this:</p> <pre><code>for (int i = 0; i &lt; RichTextBox.Lines.Length; i++) { int indexStart = RichTextBox.GetFirstCharIndexFromLine(i); int indexEnd = RichTextBox.Lines[i].Split(' ')[0].Length; RichTextBox.Select(indexStart, indexEnd); RichTextBox.SelectionColor = Color.Gray; } </code></pre> <p>However, this no longer works for me because now I have logs with multiple lines:</p> <pre><code>&lt;23:0:4:320&gt; Error-h88tzd: The source and destination are the same. Source: 'C:\Users\user\Dropbox\PC\Desktop\...'. Destination: 'C:\Users\user\Dropbox\PC\Desktop\.... More information: https:// </code></pre>
[ { "answer_id": 74135457, "author": "hossein sabziani", "author_id": 4301195, "author_profile": "https://Stackoverflow.com/users/4301195", "pm_score": 1, "selected": false, "text": "> or <" }, { "answer_id": 74135526, "author": "Jimi", "author_id": 7444103, "author_pro...
2022/10/20
[ "https://Stackoverflow.com/questions/74134680", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19789337/" ]
74,134,683
<p>I have a huge file with many column. I want to count the number of occurences of each values in 1 column. Therefore, I use <code>cut -f 2 &quot;file&quot; | sort | uniq -c </code> . I got the result as I want. However, when I read this file to R, It shows that I have only 1 column but the data is like the example below Example:</p> <pre><code>123 Chelsea 65 Liverpool 77 Manchester city 2 Brentford </code></pre> <p>The thing I want is two columns, one for the counts the other for the names. However, I got one only. Can anyone help me to split the column into 2 or a better method to extract from the big file?</p> <p>Thanks in advance !!!!</p>
[ { "answer_id": 74135457, "author": "hossein sabziani", "author_id": 4301195, "author_profile": "https://Stackoverflow.com/users/4301195", "pm_score": 1, "selected": false, "text": "> or <" }, { "answer_id": 74135526, "author": "Jimi", "author_id": 7444103, "author_pro...
2022/10/20
[ "https://Stackoverflow.com/questions/74134683", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18482513/" ]
74,134,706
<p>Lets say i got a pretrained model <strong>model.pt</strong></p> <p>how do i know what <strong>classes</strong> can this model predict?</p> <p>i think it is saved inside the model but how do I extract it?</p> <p>Im trying to understand what <a href="https://github.com/AndreyGuzhov/AudioCLIP" rel="nofollow noreferrer">https://github.com/AndreyGuzhov/AudioCLIP</a> does</p> <p>it has a pretrained <strong>AudioCLIP-Full-Training.pt</strong></p> <p>how do I know the labels or classes inside this <strong>AudioCLIP-Full-Training.pt</strong></p>
[ { "answer_id": 74135457, "author": "hossein sabziani", "author_id": 4301195, "author_profile": "https://Stackoverflow.com/users/4301195", "pm_score": 1, "selected": false, "text": "> or <" }, { "answer_id": 74135526, "author": "Jimi", "author_id": 7444103, "author_pro...
2022/10/20
[ "https://Stackoverflow.com/questions/74134706", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19140415/" ]
74,134,713
<p>When joining between python daframes, is it possible to match the included key value instead of the same key value?</p> <p>For example</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>A</th> <th>B</th> <th>C</th> <th>D</th> <th>E</th> </tr> </thead> <tbody> <tr> <td>ABC</td> <td>1</td> <td>2</td> <td>3</td> <td>4</td> </tr> <tr> <td>DEF</td> <td>5</td> <td>6</td> <td>7</td> <td>8</td> </tr> <tr> <td>GHI</td> <td>9</td> <td>10</td> <td>11</td> <td>12</td> </tr> </tbody> </table> </div> <p>df_1 like this. And</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>F</th> <th>G</th> <th>H</th> <th>I</th> <th>J</th> </tr> </thead> <tbody> <tr> <td>AB</td> <td>13</td> <td>14</td> <td>15</td> <td>16</td> </tr> <tr> <td>DE</td> <td>17</td> <td>18</td> <td>19</td> <td>20</td> </tr> <tr> <td>GH</td> <td>21</td> <td>22</td> <td>23</td> <td>24</td> </tr> </tbody> </table> </div> <p>df_2 like this.</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>A</th> <th>B</th> <th>C</th> <th>D</th> <th>E</th> <th>G</th> <th>H</th> <th>I</th> <th>J</th> </tr> </thead> <tbody> <tr> <td>ABC</td> <td>1</td> <td>2</td> <td>3</td> <td>4</td> <td>13</td> <td>14</td> <td>15</td> <td>16</td> </tr> <tr> <td>DEF</td> <td>5</td> <td>6</td> <td>7</td> <td>8</td> <td>17</td> <td>18</td> <td>19</td> <td>20</td> </tr> <tr> <td>GHI</td> <td>9</td> <td>10</td> <td>11</td> <td>12</td> <td>21</td> <td>22</td> <td>23</td> <td>24</td> </tr> </tbody> </table> </div> <p>Like this data frame, I want to combine columns A and F based on them. Although it is not the same KEY, the column value of F contains the column value of A, and I want to match it based on it.</p> <p>Can I put conditions for key matching when I try Join? I converted each data frame in dictionary form, and I combined the data frames by matching the included KEY.</p> <p>However, this data frame lost all the column names as shown in the table above, so I couldn't provide the results I wanted.</p> <p>If it's not JOIN's method, is there a different way to combine the two data frames?</p>
[ { "answer_id": 74135457, "author": "hossein sabziani", "author_id": 4301195, "author_profile": "https://Stackoverflow.com/users/4301195", "pm_score": 1, "selected": false, "text": "> or <" }, { "answer_id": 74135526, "author": "Jimi", "author_id": 7444103, "author_pro...
2022/10/20
[ "https://Stackoverflow.com/questions/74134713", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20117886/" ]
74,134,717
<p>I have he below code like this which splits the address column and pops if length of add dict equal to 4 or 5(see code).</p> <pre><code>import pandas as pd data = {'address': [&quot;William J. Clare\\n290 Valley Dr.\\nCasper, WY 82604\\nUSA&quot;, &quot;1180 Shelard Tower\\nMinneapolis, MN 55426\\nUSA&quot;, &quot;William N. Barnard\\n145 S. Durbin\\nCasper, WY 82601\\nUSA&quot;, &quot;215 S 11th ST&quot;] } df = pd.DataFrame(data) df_dict = df.to_dict('records') for row in df_dict: add = row[&quot;address&quot;] print(add.split(&quot;\\n&quot;), len(add.split(&quot;\\n&quot;))) if len(add.split(&quot;\\n&quot;))==4: target = add.split(&quot;\\n&quot;) target.pop(0) target = '\\n'.join(target) if len(add.split(&quot;\\n&quot;))==5: target = add.split(&quot;\\n&quot;) target.pop(0) target.pop(1) target = '\\n'.join(target) print(target) </code></pre> <p>However, instead of giving condition to pop, I would like to retain last three elements of the dict with if <code>len(add.split(&quot;\\n&quot;) &gt; 3</code> I need a command which retains only last three elements instead of popping the elements.</p> <p>like this:</p> <pre><code>address 290 Valley Dr.\\nCasper, WY 82604\\nUSA 1180 Shelard Tower\\nMinneapolis, MN 55426\\nUSA 145 S. Durbin\\nCasper, WY 82601\\nUSA 215 S 11th ST `` Your help will be greatly appreciated. Thanks in advance </code></pre>
[ { "answer_id": 74135457, "author": "hossein sabziani", "author_id": 4301195, "author_profile": "https://Stackoverflow.com/users/4301195", "pm_score": 1, "selected": false, "text": "> or <" }, { "answer_id": 74135526, "author": "Jimi", "author_id": 7444103, "author_pro...
2022/10/20
[ "https://Stackoverflow.com/questions/74134717", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20271577/" ]
74,134,727
<pre><code>how to format string data like this '[1,fish#, 15,bird#, 4,horse#]' </code></pre> <blockquote> <p>to '1,fish#15,bird#4,horse#'</p> </blockquote>
[ { "answer_id": 74135457, "author": "hossein sabziani", "author_id": 4301195, "author_profile": "https://Stackoverflow.com/users/4301195", "pm_score": 1, "selected": false, "text": "> or <" }, { "answer_id": 74135526, "author": "Jimi", "author_id": 7444103, "author_pro...
2022/10/20
[ "https://Stackoverflow.com/questions/74134727", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19646043/" ]
74,134,728
<p>How to find selector from this? I want to click the button but unable to find selector.it will be a css selector or class selector.</p> <p>HTML</p> <pre><code>&lt;button data-bb-handler=&quot;confirm&quot; type=&quot;button&quot; class=&quot;btn btn-success&quot;&gt;Continue and Logout Other User&lt;/button&gt; </code></pre>
[ { "answer_id": 74135457, "author": "hossein sabziani", "author_id": 4301195, "author_profile": "https://Stackoverflow.com/users/4301195", "pm_score": 1, "selected": false, "text": "> or <" }, { "answer_id": 74135526, "author": "Jimi", "author_id": 7444103, "author_pro...
2022/10/20
[ "https://Stackoverflow.com/questions/74134728", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20288356/" ]
74,134,729
<p>I wanted to add event when initializing bloc inside the 'main.dart'. But It didn't call init event . Are there any way to do this without calling inside 'initState' of the next class</p> <pre><code>void main() { runApp( MultiBlocProvider(providers: [ BlocProvider(create: (context) =&gt; CountlyBloc()..add(CountlyInitEvent())) ], child: MyApp()), ); } </code></pre>
[ { "answer_id": 74134781, "author": "BHARATH T", "author_id": 13518285, "author_profile": "https://Stackoverflow.com/users/13518285", "pm_score": 0, "selected": false, "text": "lazy" }, { "answer_id": 74554039, "author": "sopesa", "author_id": 20586103, "author_profile...
2022/10/20
[ "https://Stackoverflow.com/questions/74134729", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12176279/" ]
74,134,735
<p>I saw this answer <a href="https://stackoverflow.com/questions/4268760/how-do-i-select-avg-of-multiple-columns-on-a-single-row">how do I select AVG of multiple columns on a single row</a> but I have some rows which is the value is 0 and it's throwing an <code>error division by zero</code> when I try to use his</p> <pre><code>select (COALESCE(q1,0)+COALESCE(q2,0)+COALESCE(q3,0)+COALESCE(q4,0) / (COALESCE(q1/q1,0)+COALESCE(q2/q2,0)+COALESCE(q3/q3,0)+COALESCE(q4/q4,0) from table1 </code></pre> <p>ex.</p> <pre><code>q1 q2 q3 q4 10 5 NULL 0 8 5 5 NULL 5 5 5 5 -------------- 7.5 6 5 </code></pre>
[ { "answer_id": 74134940, "author": "M-Raw", "author_id": 9373597, "author_profile": "https://Stackoverflow.com/users/9373597", "pm_score": 0, "selected": false, "text": "select (\n COALESCE(q1::real, 0::real)+\n COALESCE(q2::real, 0::real)+\n COALESCE(q3::real, 0::real)+\n CO...
2022/10/20
[ "https://Stackoverflow.com/questions/74134735", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20087550/" ]
74,134,756
<p>I have a file which contain two columns, eg <code>abc.txt</code></p> <pre><code>000000008b8c5200 af dg sd jh g1 43 66 23 67 000000008b8c5220 bc bi ub cb ue qi hd 16 72 0000000056fb2620 ad ag sj ha bn bc bh 53 69 0000000056fb2640 ak bh jg bf re 34 16 8g ff 0000000045ab4630 sg fj g3 6g dh w7 28 g7 dg 0000000045ab4650 jb sh jd b7 us vy ys du 89 </code></pre> <p>Here I need to concatenate 2nd row 2nd column with first row first column like this:</p> <pre><code>bcbiubcbueqihd1672afdgsdjhg143662367 </code></pre> <p>Condition for concatenating:<br /> only when (hexadecimal)difference between 2nd row, 1st column and 1st row, 1st column is 20. For this example it would be:</p> <pre><code>000000008b8c5220 - 000000008b8c5200 = 20. 0000000056fb2640 - 0000000056fb2620 = 20. 0000000045ab4650 - 0000000045ab4630 = 20. </code></pre> <p>Similarly for upcoming rows and columns. Write the results to a file with first row and concatenated data like this:</p> <pre><code>000000008b8c5200 bcbiubcbueqihd1672afdgsdjhg143662367 0000000056fb2620 akbhjgbfre34168gffadagsjhabnbcbh5369 0000000045ab4630 jbshjdb7usvyysdu89sgfjg36gdhw728g7dg </code></pre> <p>How can I do this?</p>
[ { "answer_id": 74134876, "author": "hodV", "author_id": 8217065, "author_profile": "https://Stackoverflow.com/users/8217065", "pm_score": 0, "selected": false, "text": "int" }, { "answer_id": 74135147, "author": "Rabinzel", "author_id": 15521392, "author_profile": "ht...
2022/10/20
[ "https://Stackoverflow.com/questions/74134756", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20273554/" ]
74,134,770
<p>I know how to autostart a python script (or so I thought). But I want a programm or something, if my python script is not running anymore, it should start the script again. Has anyone a idea how to do this? Edit: I tried running it as a service but that didnt work.</p> <pre><code>import bluetooth import pygame pygame.mixer.init() server_sock=bluetooth.BluetoothSocket( bluetooth.RFCOMM ) port = 22 server_sock.bind((&quot;&quot;,port)) server_sock.listen(1) client_sock,address = server_sock.accept() print (&quot;Verbindung Hergestellt mit: &quot;, address) while True: recvdata = client_sock.recv(1024) print (&quot;Nachricht bekommen: %s&quot; % recvdata) pygame.mixer.pause() if (recvdata == b&quot;h&quot;): sound = pygame.mixer.Sound('/home/maxi/Desktop/test.wav') playing = sound.play() if (recvdata == b&quot;p&quot;): sound = pygame.mixer.Sound('/home/maxi/Desktop/test2.wav') playing = sound.play() if (recvdata == b&quot;k&quot;): break client_sock.close() server_sock.close() </code></pre> <p>My startscript is:</p> <pre><code>[Unit] Description=MaxiTest After=multi-user.target [Service] Type=simple Restart=always ExecStart=/usr/bin/python3 /home/maxi/Desktop/btsound1.py [Install] WantedBy=multi-user.target </code></pre>
[ { "answer_id": 74134915, "author": "Omid Estaji", "author_id": 7556148, "author_profile": "https://Stackoverflow.com/users/7556148", "pm_score": 1, "selected": false, "text": "#!/bin/bash\n# This is start.sh\ncd /home/maxi/Desktop/\n/usr/bin/python3 btsound1.py\n" } ]
2022/10/20
[ "https://Stackoverflow.com/questions/74134770", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20288352/" ]
74,134,788
<p>How to get the last value from the url in OIC?</p> <pre><code>https://test.com:111/fscm/resources/11.13.18.05/invoices/11111/child/invoiceInstallments/ 00030000000SDSDD00057708000000000000CB2F0000000SDSC000577080 </code></pre> <p>I want to get 00030000000SDSDD00057708000000000000CB2F0000000SDSC000577080 value from the url. Which is invoiceInstallmentUniqId. Can anyone help me with this?</p> <p>Thank you!</p>
[ { "answer_id": 74134952, "author": "Littlefoot", "author_id": 9097906, "author_profile": "https://Stackoverflow.com/users/9097906", "pm_score": 1, "selected": false, "text": "SQL> with test(col) as\n 2 (select 'https://test.com:111/fscm/resources/11.13.18.05/invoices/11111/child/invo...
2022/10/20
[ "https://Stackoverflow.com/questions/74134788", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16514999/" ]
74,134,797
<p>I've created a custom icon and imported it as SVG on my next.js app. I want to implement a feature where users can customize the color of this icon, like red to yellow or black, etc. But this is static image, is there a way I can achieve this?</p> <p><a href="https://i.stack.imgur.com/0BnXN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0BnXN.png" alt="enter image description here" /></a></p>
[ { "answer_id": 74136395, "author": "l1qu1d", "author_id": 4858687, "author_profile": "https://Stackoverflow.com/users/4858687", "pm_score": 3, "selected": true, "text": "@svgr/webpack" } ]
2022/10/20
[ "https://Stackoverflow.com/questions/74134797", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10207161/" ]
74,134,869
<p>I have a column ID with both string and int values. I wanted to insert a dash between the string and int for those ID values. However, I am not sure where to start. Any advice or tip would be greatly appreciated.</p> <p>I have this in PROC SQL code:</p> <pre><code>PROC SQL; select case when ID CONTAINTS &quot;ABC&quot; THEN CATX(&quot;-&quot;, SUBSTR(ID,1,3), SUBSTR(ID,3,6) when ID CONTAINTS &quot;AB&quot; THEN CATX(&quot;-&quot;, SUBSTR(ID,1,2), SUBSTR(ID,2,7) when ID CONTAINTS &quot;ABCS&quot; THEN CATX(&quot;-&quot;, SUBSTR(ID,1,4), SUBSTR(ID,4,6) else ID end as ID, Name, Age, Gender from A; quit; </code></pre> <p>Example from this:</p> <pre><code>|ID |Name |Age|Gender| |123456789|Sam |30 |M | |232456676|Jessica|20 |F | |ABC134475|Suzen |29 |F | |AB1235674|Alex |26 |M | |ABCS24563|NON |15 |F | </code></pre> <p>To this:</p> <pre><code>|ID |Name |Age|Gender| |123456789 |Sam |30 |M | |232456676 |Jessica|20 |F | |ABC-134475|Suzen |29 |F | |AB-1235674|Alex |26 |M | |ABCS-24563|NON |15 |F | </code></pre>
[ { "answer_id": 74136395, "author": "l1qu1d", "author_id": 4858687, "author_profile": "https://Stackoverflow.com/users/4858687", "pm_score": 3, "selected": true, "text": "@svgr/webpack" } ]
2022/10/20
[ "https://Stackoverflow.com/questions/74134869", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16204817/" ]
74,134,875
<p>I have the following function, which basically check for percentage of the matching positions of two strings:</p> <pre><code>library(tidyverse) calculate_sequ_identity &lt;- function(sequ_1 = NULL, sequ_2 = NULL) { # # Two sequs must be of the same length # sequ_1 &lt;- &quot;FKDHKHIDVKDRHRTRHLAKTRCYHIDPHH&quot; # sequ_2 &lt;- &quot;FKDKKHLDKFSSYHVKTAFFHVCTQNPQDS&quot; try(if (nchar(sequ_1) != nchar(sequ_2)) stop(&quot;sequ of different length&quot;)) seq1_dat &lt;- as_tibble(unlist(str_split(string = sequ_1, pattern = &quot;&quot;))) %&gt;% dplyr::rename(res = 1) %&gt;% dplyr::rename(res.seq1 = 1) seq2_dat &lt;- as_tibble(unlist(str_split(string = sequ_2, pattern = &quot;&quot;))) %&gt;% dplyr::rename(res = 1) %&gt;% dplyr::rename(res.seq2 = 1) final_dat &lt;- bind_cols(seq1_dat, seq2_dat) %&gt;% rowwise() %&gt;% mutate(identity_status = if_else(res.seq1 == res.seq2, 1, 0)) %&gt;% unnest(cols = c()) %&gt;% mutate(res_no = row_number()) identity &lt;- sum(final_dat$identity_status) / nchar(sequ_1) identity } </code></pre> <p>With this as example:</p> <pre><code> sequ_1: FKDHKHIDVKDRHRTRHLAKTRCYHIDPHH ||| || | | # 7 matches of 30 char seqs sequ_2: FKDKKHLDKFSSYHVKTAFFHVCTQNPQDS </code></pre> <p>The matching identity is 7/30 = 0.23.</p> <p>But I'm not sure if it's the fastest routine. Please advice what's the fast way to calculate. Typically I have millions of pair to check.</p> <p>Current benchmark:</p> <pre><code>rbenchmark::benchmark( &quot;m1&quot; = {calculate_sequ_identity(sequ_1 = sequ_1, sequ_2 = sequ_2)}, replications = 100, columns = c(&quot;test&quot;, &quot;replications&quot;, &quot;elapsed&quot;, &quot;relative&quot;, &quot;user.self&quot;, &quot;sys.self&quot;) ) </code></pre> <p>gives me</p> <pre><code> test replications elapsed relative user.self sys.self 1 m1 100 2.267 1.000 2.228 0.032 </code></pre>
[ { "answer_id": 74135031, "author": "jay.sf", "author_id": 6574038, "author_profile": "https://Stackoverflow.com/users/6574038", "pm_score": 2, "selected": false, "text": "f <- \\(x, y) {\n stopifnot(nchar(x) == nchar(y))\n matrixStats::colMeans2(mapply(`==`, strsplit(x, ''), strsplit(y...
2022/10/20
[ "https://Stackoverflow.com/questions/74134875", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8391698/" ]
74,134,928
<p>My thread group consists 30 user. I want to run every user for every date in a month. Suppose, user1 request date of January 1, user2 request january2 and continue. In this way, I will be covered all the date in a month. For this, how I design my Test Plan, and how to write date function so that after every request date will increase automatically?</p>
[ { "answer_id": 74135031, "author": "jay.sf", "author_id": 6574038, "author_profile": "https://Stackoverflow.com/users/6574038", "pm_score": 2, "selected": false, "text": "f <- \\(x, y) {\n stopifnot(nchar(x) == nchar(y))\n matrixStats::colMeans2(mapply(`==`, strsplit(x, ''), strsplit(y...
2022/10/20
[ "https://Stackoverflow.com/questions/74134928", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13193762/" ]
74,134,933
<p>In the structure of the Marks model, I have courseCode (String), courseTitle (String), studentMarks (Array of studentId and marks of that course ).</p> <p><em>The data stored in the marks collection:</em></p> <pre><code>[ { &quot;_id&quot;: &quot;634 ...&quot;, &quot;courseCode&quot;: &quot;cse1201&quot;, &quot;courseTitle&quot;: &quot;Structured Programming &quot;, &quot;studentsMarks&quot;: [ { &quot;id&quot;: &quot;ce17001&quot;, &quot;marks&quot;: 52, &quot;_id&quot;: &quot;634a9be567a1f07b ... &quot; }, { &quot;id&quot;: &quot;ce17002&quot;, &quot;marks&quot;: 50, &quot;_id&quot;: &quot;634a9be567a1f07be ... &quot; } ], &quot;type&quot;: &quot;theory&quot; }, { &quot;_id&quot;: &quot;634a9be567a1f07be0 ...&quot;, &quot;courseCode&quot;: &quot;cse1202&quot;, &quot;courseTitle&quot;: &quot;Data Structer&quot;, &quot;studentsMarks&quot;: [ { &quot;id&quot;: &quot;ce17001&quot;, &quot;marks&quot;: 45, &quot;_id&quot;: &quot;634 ...&quot; }, { &quot;id&quot;: &quot;ce17002&quot;, &quot;marks&quot;: 61, &quot;_id&quot;: &quot;634 ... &quot; } ], &quot;type&quot;: &quot;theory&quot; } ] </code></pre> <p>I want to group student's marks by their unique student id. (ce17001, ce17002). For each students, there will be an array of marks, which will hold all the marks of taken courses of a particular student.</p> <p><em><strong>Expected output :</strong></em></p> <pre><code>[ { &quot;id&quot;: &quot;ce17001&quot;, &quot;marksArray&quot;: [ { &quot;courseCode&quot;: &quot;cse1201&quot;, &quot;courseTitle&quot;: &quot;Structured Programming&quot;, &quot;marks&quot;: 52 }, { &quot;courseCode&quot;: &quot;cse1202&quot;, &quot;courseTitle&quot;: &quot;Data structer&quot;, &quot;marks&quot;: 45 } ] }, { &quot;id&quot;: &quot;ce17002&quot;, &quot;marksArray&quot;: [ { &quot;courseCode&quot;: &quot;cse1201&quot;, &quot;courseTitle&quot;: &quot;Structured Programming&quot;, &quot;marks&quot;: 50 }, { &quot;courseCode&quot;: &quot;cse1202&quot;, &quot;courseTitle&quot;: &quot;Data structer&quot;, &quot;marks&quot;: 61 } ] } ] </code></pre>
[ { "answer_id": 74135202, "author": "nimrod serok", "author_id": 18482310, "author_profile": "https://Stackoverflow.com/users/18482310", "pm_score": 3, "selected": true, "text": "$unwind" }, { "answer_id": 74139386, "author": "azam45", "author_id": 19968600, "author_pr...
2022/10/20
[ "https://Stackoverflow.com/questions/74134933", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11052029/" ]
74,134,942
<p>I have a xml file like this</p> <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt; &lt;Configuration name=&quot;abc&quot;&gt; &lt;Properties&gt; &lt;Property name=&quot;1&quot;&gt;A&lt;/Property&gt; &lt;Property name=&quot;2&quot;&gt;B&lt;/Property&gt; &lt;Property name=&quot;3&quot;&gt;C&lt;/Property&gt; &lt;Property name=&quot;4&quot;&gt;D&lt;/Property&gt; &lt;Property name=&quot;5&quot;&gt;E&lt;/Property&gt; &lt;Property name=&quot;6&quot;&gt;F&lt;/Property&gt; &lt;/Properties&gt; &lt;/Configuration&gt; </code></pre> <p>I want to change the value of property names 1 and 2 only and for others to stay as it is.</p> <p>Here is the code which I am using, but it is removing all other element and giving me value of only 1 element in my output file,</p> <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt; &lt;xsl:stylesheet version=&quot;2.0&quot; &lt;xsl:template match=&quot;@* | node()&quot;&gt; &lt;xsl:copy&gt; &lt;xsl:apply-templates select=&quot;@* | node()&quot; /&gt; &lt;/xsl:copy&gt; &lt;/xsl:template&gt; &lt;xsl:template match=&quot;Configuration/Properties/Property[@name='1']&quot; /&gt; &lt;xsl:template match=&quot;Configuration/Properties&quot;&gt; &lt;xsl:element name=&quot;Properties&quot;&gt; &lt;xsl:choose&gt; &lt;xsl:when test=&quot;(Property/@name='1')&quot;&gt; &lt;xsl:element name=&quot;Property&quot; &gt; &lt;xsl:attribute name=&quot;name&quot;&gt; &lt;xsl:value-of select=&quot;'1'&quot;/&gt; &lt;/xsl:attribute&gt; &lt;xsl:value-of select=&quot;'INFO'&quot;/&gt; &lt;/xsl:element&gt; &lt;/xsl:when&gt; &lt;/xsl:choose&gt; &lt;/xsl:element&gt; &lt;/xsl:template&gt; &lt;/xsl:stylesheet&gt; </code></pre> <p>Thank you.</p>
[ { "answer_id": 74135280, "author": "Conal Tuohy", "author_id": 7372462, "author_profile": "https://Stackoverflow.com/users/7372462", "pm_score": 1, "selected": false, "text": ">" }, { "answer_id": 74135386, "author": "Pranjal Chamola", "author_id": 11195302, "author_p...
2022/10/20
[ "https://Stackoverflow.com/questions/74134942", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20288515/" ]
74,134,986
<p>I have three models, as shown below:</p> <pre><code>class TagsModel(models.Model): title = models.CharField(max_length=200) def __str__(self): return self.title class ImagesModel(models.Model): title = models.CharField(max_length=500, default='image') image_cdn = models.TextField(null=True, blank=True) image = models.ImageField(upload_to='articles/images/', null=True, blank=True) timestamp = models.DateTimeField(auto_now=True) update = models.DateTimeField(auto_now_add=True) def __str__(self): return self.title class ArticlesModel(models.Model): title = models.CharField(max_length=1000) category = models.CharField(max_length=40, choices=category_choices, default=('General', 'General')) summary = models.TextField(blank=False, null=True, max_length=5000) tags = models.ManyToManyField(TagsModel, blank=True) image = models.ImageField(blank=True, null=True, upload_to='articles/article-image/') image_cdn = models.TextField(blank=True, null=True) image_src = models.ForeignKey(ImagesModel, related_name='Image_cdn', on_delete=models.PROTECT, null=True) images = models.ManyToManyField(ImagesModel, blank=True) json = models.JSONField(null=True, blank=True) html = models.TextField(blank=True, null=True) is_published = models.BooleanField(default=False) update = models.DateTimeField(auto_now_add=True) timestamp = models.DateTimeField(auto_now=True) def __str__(self): return self.title def get_absolute_url(self): return reverse('articles:article_detail', kwargs={'article_id': self.id}) </code></pre> <p>And in the view.py</p> <pre><code>class ArticlesView(APIView): def get(self, request): articles_list = ArticlesModel.objects.all() images_list = ImagesModel.objects.all() images_serializer = ImagesSerializer(images_list, many=True) articles_serializer = ArticlesListSerializer(articles_list, many=True) return Response({ 'images':images_serializer.data, 'articles':articles_serializer.data }) </code></pre> <p>So when I send request I get results like this: <a href="https://i.stack.imgur.com/Kl4RE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Kl4RE.png" alt="enter image description here" /></a></p> <p>The problem here is that I get the ids of Images and tags and not the objects themselves! I am asking if there's a way in django/DRF to get the objects (images, tags) included with the queries of Articles and not only their ids?</p>
[ { "answer_id": 74135739, "author": "Mahammadhusain kadiwala", "author_id": 19205926, "author_profile": "https://Stackoverflow.com/users/19205926", "pm_score": 3, "selected": true, "text": "class ProductSerializer(serializers.ModelSerializer):\n cate = serializers.SerializerMethodField...
2022/10/20
[ "https://Stackoverflow.com/questions/74134986", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10059227/" ]
74,134,988
<p>I have:</p> <pre class="lang-none prettyprint-override"><code>Customerkeycode B01:B14:110083 </code></pre> <p>I want:</p> <pre class="lang-none prettyprint-override"><code>PlanningCustomerSuperGroupCode, DPGCode, APGCode BO1, B14, 110083 </code></pre>
[ { "answer_id": 74135739, "author": "Mahammadhusain kadiwala", "author_id": 19205926, "author_profile": "https://Stackoverflow.com/users/19205926", "pm_score": 3, "selected": true, "text": "class ProductSerializer(serializers.ModelSerializer):\n cate = serializers.SerializerMethodField...
2022/10/20
[ "https://Stackoverflow.com/questions/74134988", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18890924/" ]
74,135,001
<p>I'm having problem with the conditional always returning true. I'm not sure if it's the value it's seeing as truthy in general but it's messing with me.</p> <pre><code>Problem: Check to see if a string has the same amount of 'x's and 'o's. The method must return a boolean and be case insensitive. The string can contain any char. Examples input/output: XO(&quot;ooxx&quot;) =&gt; true XO(&quot;xooxx&quot;) =&gt; false XO(&quot;ooxXm&quot;) =&gt; true XO(&quot;zpzpzpp&quot;) =&gt; true // when no 'x' and 'o' is present should return true XO(&quot;zzoo&quot;) =&gt; false </code></pre> <pre><code>function XO(str) { let on = 0 let xn = 0 let result = &quot;&quot; for (let i = 0; i &lt;=str.length; i++) { if (str[i] = &quot;x&quot; || &quot;X&quot;){ xn++ } if (str[i] = &quot;o&quot; || &quot;O&quot;) { on++ }; if (xn == on || xn &amp;&amp; on == 0){ result = true }else if (xn !== on) { result = false } return result } } </code></pre> <p>Seems the conditional is always returning true. Not sure if it's because the types are true (which is why I kept it strict).</p>
[ { "answer_id": 74135124, "author": "Aman Mehta", "author_id": 13378772, "author_profile": "https://Stackoverflow.com/users/13378772", "pm_score": 2, "selected": false, "text": "XO" }, { "answer_id": 74135330, "author": "brk", "author_id": 2181397, "author_profile": "h...
2022/10/20
[ "https://Stackoverflow.com/questions/74135001", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20123957/" ]
74,135,006
<p>I am currently writing a class as a derivative to the Button class, creating &quot;Text Buttons&quot; in their stead. However, while I was testing the Button class itself, I seem to be missing something about the Button's surface scaling, rather than scaling both the Text and the Button.</p> <p>How do I actually make the Button fit to its text?</p> <p>Relevant codeblock:</p> <pre class="lang-py prettyprint-override"><code> self.button = Button(text = self.textinput, color = color.rgba(0,255,0,255), text_color = color.rgb(self.unhovered[0], self.unhovered[1], self.unhovered[2]), x = self.position[0], y = self.position[1], on_click = self.click) self.button.fit_to_text() </code></pre> <p>Result: <a href="https://i.stack.imgur.com/vOxin.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vOxin.png" alt="As you can see, the physical button is much larger than the text." /></a></p> <p>All related code:</p> <pre class="lang-py prettyprint-override"><code>window.fullscreen = True window.color = rgb(0,0,0) Text.size = 0.06 Text.default_font = 'font/silver.ttf' Text.default_resolution = WINDOW_HEIGHT * 2 * Text.size class TextButton(): def __init__(self, textinput = str, position = tuple, hovered = tuple, unhovered = tuple, *click): self.position = position self.textinput = textinput self.hovered = hovered self.unhovered = unhovered self.click = click self.button = Button(text = self.textinput, color = color.rgba(0,255,0,255), text_color = color.rgb(self.unhovered[0], self.unhovered[1], self.unhovered[2]), x = self.position[0], y = self.position[1], on_click = self.click) self.button.fit_to_text() self.button.on_mouse_enter = Func(setattr, self.button, 'text_color', color.rgb(self.hovered[0], self.hovered[1], self.hovered[2])) self.button.on_mouse_exit = Func(setattr, self.button, 'text_color', color.rgb(self.unhovered[0], self.unhovered[1], self.unhovered[2])) self.button.on_click = self.click button = TextButton('testbutton', position = (0, 0), hovered = (255, 0, 0), unhovered = (255, 255, 255)) </code></pre> <p>Expected result:</p> <p><a href="https://i.stack.imgur.com/8GBSB.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8GBSB.png" alt="enter image description here" /></a></p>
[ { "answer_id": 74143863, "author": "pokepetter", "author_id": 12811086, "author_profile": "https://Stackoverflow.com/users/12811086", "pm_score": 1, "selected": false, "text": "Text.size = 0.06" } ]
2022/10/20
[ "https://Stackoverflow.com/questions/74135006", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12026193/" ]
74,135,022
<p>I've encountered a problem regarding typescript and need some help</p> <p>I'm new to typescript and a code block below illustrates shortened version of my problem.</p> <p><a href="https://www.typescriptlang.org/play?#code/JYOwLgpgTgZghgYwgAgILOQbwFAYwNzgBsBXCARgC5kBnMKUAcwG5c9DSIAmauhkFmwwwSIBAAo4vekwA0yAEbT%20jAJTV8Ae2AATVgF9s2UJFiIUAISxDkHMlWQgSAWwXRWeW8TI9HLt1AeeCJiktROrtDySn6RUOq22nrI2IZGIQhgwJogyADyJKbIADwAKsgQAB6QIDo0aMgAPsgWAHzizgCeAGKiCNSlANoA5BnDALryUshDw3YUE9EDI-NcE6oYOJ5dvaFw0aoG2EA" rel="nofollow noreferrer">Link to Typescript Playground</a></p> <pre><code>interface A { value1: string; value2: string; func(a: string, b: string): void; } interface B { value1: number; value2: number; func(a: number, b: number): void; } function Outer &lt;T extends A | B&gt;(myFunc: T['func'], a: T['value1'], b: T['value2']) { myFunc(a, b); // get an error: Argument of type 'string | number' is not assignable to parameter of type 'never'. } </code></pre> <p>What I want is to pass parameters to 'Outer' function which will then infer 'T'.</p> <p>I thought it would be okay to call 'myFunc', but error comes up and says I can't assign 'a' and 'b' to 'never'.</p> <p>** This set of codes might look a bit weird. It's actually intended to be a react hook.</p> <p>What's going on here? and What would be a proper way to solve this?</p> <p>Thanks a lot in advance.</p>
[ { "answer_id": 74135379, "author": "Svetoslav Petkov", "author_id": 11612861, "author_profile": "https://Stackoverflow.com/users/11612861", "pm_score": 0, "selected": false, "text": "function Outer<T>(myFunc: (a: T, b: T) => void, a: T, b: T) {\n myFunc(a, b);\n}\n\n// example calls\...
2022/10/20
[ "https://Stackoverflow.com/questions/74135022", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19928137/" ]
74,135,024
<p>I m getting below error after successful build of every flutter app . Plz share the way to resolve it &quot;Installing build\app\outputs\flutter-apk\app.apk... 7.0s Error: ADB exited with exit code 1 Performing Streamed Install</p> <p>adb: failed to install C:\projectss\downloader\build\app\outputs\flutter-apk\app.apk: Failure [INSTALL_FAILED_USER_RESTRICTED: Install canceled by user] Error launching application on M2006C3MII.&quot;</p>
[ { "answer_id": 74135379, "author": "Svetoslav Petkov", "author_id": 11612861, "author_profile": "https://Stackoverflow.com/users/11612861", "pm_score": 0, "selected": false, "text": "function Outer<T>(myFunc: (a: T, b: T) => void, a: T, b: T) {\n myFunc(a, b);\n}\n\n// example calls\...
2022/10/20
[ "https://Stackoverflow.com/questions/74135024", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19772032/" ]
74,135,079
<p>I've been working on an extended version of Material UI's Autocomplete where I am implementing a feature that allows the user to move the option to the input via keyboard events (Arrow key up + down). The user should then be allowed to select one of the options via the <code>ENTER</code> key.</p> <p>For some reason, the <code>onChange</code> event is not triggered and I am kind of puzzled to understand why this happens.</p> <pre><code>export default function Autocompleter() { const [input, setInput] = React.useState(null); const handleInputChange = (event, option, reason) =&gt; { console.log('On input change triggered'); }; const handleOnChange = (event, value, reason) =&gt; { console.log('On change triggered! '); }; const handleHighlightChange = (event, option, reason) =&gt; { if (option &amp;&amp; reason === 'keyboard') { setInput(option); } }; const handleFilterOptions = (currentOptions) =&gt; currentOptions; const handleGetOptionsLabel = (option) =&gt; { return option.label; }; return ( &lt;Autocomplete id=&quot;combo-box-demo&quot; freeSolo={true} value={input} onChange={handleOnChange} onInputChange={handleInputChange} options={top100Films} isOptionEqualToValue={(option, value) =&gt; option.label === value.label} includeInputInList={true} onHighlightChange={handleHighlightChange} getOptionLabel={handleGetOptionsLabel} filterOptions={handleFilterOptions} style={{ width: 300 }} renderInput={(params) =&gt; ( &lt;TextField {...params} label=&quot;Combo box&quot; variant=&quot;outlined&quot; /&gt; )} /&gt; ); } </code></pre> <p>Here is also a working example:</p> <p><a href="https://stackblitz.com/edit/react-ts-rsodyc?file=index.tsx,App.tsx,Autocompleter.tsx" rel="nofollow noreferrer">https://stackblitz.com/edit/react-ts-rsodyc?file=index.tsx,App.tsx,Autocompleter.tsx</a></p> <p><strong>NOTE:</strong> This is a light example of my original code, but it should be enough to address the issue.</p> <p>There are a few things I tried such as using <code>inputValue</code> in combination with the <code>onHighlightChange</code> but this does not seem to work either.</p> <p><code>includeInputInList</code> seemed to be the solution according to the doc, but it does nothing? Does anyone understand what it is supposed to do and is it helpful in my case?</p> <p><strong>UPDATE:</strong></p> <p>Updating the <code>input</code> state in <code>onHighlightChange</code> breaks the <code>onChange</code>. Unfortunately, I do want to update the <code>input</code> every time the user highlights an option via keyboard events.</p> <p>Thank you for any kind of help and idea</p>
[ { "answer_id": 74135311, "author": "Bojan Tomić", "author_id": 5761648, "author_profile": "https://Stackoverflow.com/users/5761648", "pm_score": 1, "selected": false, "text": "onChange" }, { "answer_id": 74209912, "author": "RubenSmn", "author_id": 20088324, "author_p...
2022/10/20
[ "https://Stackoverflow.com/questions/74135079", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3069584/" ]
74,135,109
<p>Let's say I have:</p> <pre><code>a = 'abcde' b = 'ab34e' </code></pre> <p>How can I get printed out that the difference in a is c,d and in b is 3,4? Also would it be possible to also the get the index of those?</p> <p>I know I should use difflib, but the furthest I've got is with this overly complex code from this website: <a href="https://towardsdatascience.com/side-by-side-comparison-of-strings-in-python-b9491ac858" rel="nofollow noreferrer">https://towardsdatascience.com/side-by-side-comparison-of-strings-in-python-b9491ac858</a></p> <p>and it doesn't even do what I want to do. Thank you in advance.</p>
[ { "answer_id": 74135169, "author": "JarroVGIT", "author_id": 1557060, "author_profile": "https://Stackoverflow.com/users/1557060", "pm_score": 3, "selected": true, "text": "a = \"abcde\"\nb = \"ab2de\"\n\nfor index, char in enumerate(a):\n if not b[index] == char:\n print(f\"Fi...
2022/10/20
[ "https://Stackoverflow.com/questions/74135109", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19213913/" ]
74,135,162
<p>I have a simple loop that should copy ranges form three sheets and stack them on top of each other in another sheet. I define the ranges of each of the three sheets via a cell that counts rows in the Control Sheet.</p> <p>I do not get an error message, however only the range of the first sheets gets pasted. I troubleshooted already to see if the loop is running until end and indeed it does. I cannot wrap my head around why only the range from the first sheets gets pasted in the final sheet.</p> <pre><code>Sub Loop() Dim ws_Sheet As Worksheet, ws As Worksheet Dim lng_LastRow As Long, lng_LastColumn As Long, lng_LastRowSheet As Long Dim rng_WorkRange As Range Dim arrSht, i Dim counter As Integer arrSht = Array(&quot;a&quot;, &quot;b&quot;, &quot;c&quot;) Set ws_Sheet = Worksheets(&quot;d&quot;) ws_Sheet.Cells.ClearContents counter = 1 For i = 0 To 2 Set ws = Worksheets(arrSht(i)) lng_LastRow = Worksheets(&quot;Control&quot;).Range(&quot;E&quot; &amp; counter).Value + 1 lng_LastColumn = ws.Cells(1, Columns.Count).End(xlToLeft).Column lng_LastRowSheet = ws_Sheet.Cells(Rows.Count, 1).End(xlUp).Row Set rng_WorkRange = ws.Range(ws.Cells(1, 1), ws.Cells(lng_LastRow, lng_LastColumn)) rng_WorkRange.Copy ws_Sheet.Range(&quot;A&quot; &amp; lng_LastRowSheet) counter = counter + 1 Next i End Sub </code></pre>
[ { "answer_id": 74135169, "author": "JarroVGIT", "author_id": 1557060, "author_profile": "https://Stackoverflow.com/users/1557060", "pm_score": 3, "selected": true, "text": "a = \"abcde\"\nb = \"ab2de\"\n\nfor index, char in enumerate(a):\n if not b[index] == char:\n print(f\"Fi...
2022/10/20
[ "https://Stackoverflow.com/questions/74135162", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10562005/" ]
74,135,197
<p>XML i am parsing:</p> <pre><code>&lt;List&gt; &lt;Item&gt; &lt;Price&gt; &lt;Amount&gt;100&lt;/Amount&gt; &lt;Next_Item&gt; &lt;Name&gt;Apple&lt;/Name&gt; &lt;/Next_Item&gt; &lt;Next_Item&gt; &lt;Name&gt;Orange&lt;/Name&gt; &lt;/Next_Item&gt; &lt;/Price&gt; &lt;Price&gt; &lt;Amount&gt;200&lt;/Amount&gt; &lt;Next_Item&gt; &lt;Name&gt;Apple&lt;/Name&gt; &lt;/Next_Item&gt; &lt;Next_Item&gt; &lt;Name&gt;Orange&lt;/Name&gt; &lt;/Next_Item&gt; &lt;/Price&gt; &lt;/Item&gt; &lt;/List&gt; </code></pre> <p>In Output XML i want to add a comment above Next_Item:</p> <pre><code>&lt;List&gt; &lt;Item&gt; &lt;Price&gt; &lt;Amount&gt;100&lt;/Amount&gt; &lt;!--Not-Needed--&gt; &lt;Next_Item&gt; &lt;Name&gt;Apple&lt;/Name&gt; &lt;/Next_Item&gt; &lt;Next_Item&gt; &lt;Name&gt;Orange&lt;/Name&gt; &lt;/Next_Item&gt; &lt;/Price&gt; &lt;Price&gt; &lt;Amount&gt;200&lt;/Amount&gt; &lt;Next_Item&gt; &lt;Name&gt;Apple&lt;/Name&gt; &lt;/Next_Item&gt; &lt;Next_Item&gt; &lt;Name&gt;Orange&lt;/Name&gt; &lt;/Next_Item&gt; &lt;/Price&gt; &lt;/Item&gt; &lt;/List&gt; </code></pre> <p>I tried following:</p> <pre><code>doc = etree.parse('XML1') for id in doc.xpath('//Item/Price/Next_Item/text()'): id = etree.Comment('Not-Needed') root = doc.getroot() root.insert(1, comment) </code></pre> <p>Its adding comment at the top of file instead of above 'next_item' element.</p> <p>As here</p> <p>root.insert(1, comment) [1 is index]</p> <p>so is there a way where instead of index number i can pass a variable so i can add comment to number of places . for example whenever it finds 'next_item' it has to add a comment</p> <p>output i am getting is:</p> <pre><code>&lt;List&gt; &lt;!--Not-Needed--&gt;&lt;!--Not-Needed--&gt;&lt;!--Not-Needed--&gt;&lt;!--Not-Needed--&gt;&lt;!--Not-Needed--&gt;&lt;!--Not-Needed--&gt;&lt;!--Not-Needed--&gt;&lt;!--Not-Needed--&gt; &lt;Item&gt; &lt;Price&gt; &lt;Amount&gt;100&lt;/Amount&gt; &lt;Next_Item&gt; &lt;Name&gt;Apple&lt;/Name&gt; &lt;/Next_Item&gt; &lt;Next_Item&gt; &lt;Name&gt;Orange&lt;/Name&gt; &lt;/Next_Item&gt; &lt;/Price&gt; &lt;Price&gt; &lt;Amount&gt;200&lt;/Amount&gt; &lt;Next_Item&gt; &lt;Name&gt;Apple&lt;/Name&gt; &lt;/Next_Item&gt; &lt;Next_Item&gt; &lt;Name&gt;Orange&lt;/Name&gt; &lt;/Next_Item&gt; &lt;/Price&gt; &lt;/Item&gt; &lt;/List&gt; </code></pre> <p>Grateful for your help.</p>
[ { "answer_id": 74135169, "author": "JarroVGIT", "author_id": 1557060, "author_profile": "https://Stackoverflow.com/users/1557060", "pm_score": 3, "selected": true, "text": "a = \"abcde\"\nb = \"ab2de\"\n\nfor index, char in enumerate(a):\n if not b[index] == char:\n print(f\"Fi...
2022/10/20
[ "https://Stackoverflow.com/questions/74135197", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20131092/" ]
74,135,204
<p>I have a batch that reads a .csv file and maps its data into a POJO. I need to write two XML files as output. Currently, to write these two files, I generated classes via XJC from their XSD.</p> <p>I am writing from a FlatFileItemWriter (written in a text file which is useless) via a delegator. It is in this delegator that I write my two XML files. The batch works fine, I produce both XML files as output, no problem. However, I'm not satisfied because I'm producing a useless empty .txt file and I'm using a FlatFileItemWriter, that's not the way to do it.</p> <pre class="lang-java prettyprint-override"><code>@Bean @StepScope public FlatFileItemWriter&lt;MetaCsv&gt; csvWriter(MetaAgregator aggregator) { FlatFileItemWriter&lt;MetaCsv&gt; flatFileItemWriter = new FlatFileItemWriter&lt;&gt;(); String outFilePath = &quot;resources/data/esopetosae/output/out.txt&quot;; flatFileItemWriter.setResource(new FileSystemResource(outFilePath)); flatFileItemWriter.setLineAggregator(aggregator); flatFileItemWriter.setShouldDeleteIfExists(true); flatFileItemWriter.setShouldDeleteIfEmpty(true); return flatFileItemWriter; } </code></pre> <p>Aggregator:</p> <pre class="lang-java prettyprint-override"><code>@Bean public MetaAgregator aggregator() { return new MetaAgregator (); } </code></pre> <p>How can I make my Writer manage the writing of the two different XML files (different rootXML, different structure and data) while keeping the aggregator? Is it possible?</p>
[ { "answer_id": 74135169, "author": "JarroVGIT", "author_id": 1557060, "author_profile": "https://Stackoverflow.com/users/1557060", "pm_score": 3, "selected": true, "text": "a = \"abcde\"\nb = \"ab2de\"\n\nfor index, char in enumerate(a):\n if not b[index] == char:\n print(f\"Fi...
2022/10/20
[ "https://Stackoverflow.com/questions/74135204", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14535321/" ]
74,135,206
<p>*project- New.app-app want to add an app inside app</p> <p>1.how to register this to the setting.py file?</p> <ol start="2"> <li>what are the things I should be worried once I have an app with in an app?</li> </ol>
[ { "answer_id": 74135169, "author": "JarroVGIT", "author_id": 1557060, "author_profile": "https://Stackoverflow.com/users/1557060", "pm_score": 3, "selected": true, "text": "a = \"abcde\"\nb = \"ab2de\"\n\nfor index, char in enumerate(a):\n if not b[index] == char:\n print(f\"Fi...
2022/10/20
[ "https://Stackoverflow.com/questions/74135206", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17929911/" ]
74,135,208
<p>I have dataset of student's scores for each subject.</p> <pre> StuID Subject Scores 1 Math 90 1 Geo 80 2 Math 70 2 Geo 60 3 Math 50 3 Geo 90 </pre> <p>Now I want to count the range of scores for each subject like <code>0&lt; x &lt;=20</code>, <code>20&lt; x &lt;=30</code> and get a dataframe like this:</p> <pre> Subject 0-20 20-40 40-60 60-80 80-100 Math 0 0 1 1 1 Geo 0 0 0 1 2 </pre> <p>The given dataset is just a sample of the data I am working on. My dataset has more than 1000 line. How can I do it? Thank you!</p>
[ { "answer_id": 74135322, "author": "mozway", "author_id": 16343464, "author_profile": "https://Stackoverflow.com/users/16343464", "pm_score": 3, "selected": true, "text": "df" }, { "answer_id": 74135459, "author": "Azhar Khan", "author_id": 2847330, "author_profile": ...
2022/10/20
[ "https://Stackoverflow.com/questions/74135208", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15554142/" ]
74,135,209
<p>getting this error showing in red screen I update my packages _TypeError Another exception was thrown: type 'Null' is not a subtype of type 'String' I tried to update the sdk and I'm not understanding where the problem is in this code. I added CircularProgressIndicator with condition statements The relevant error-causing widget was: quizpage quizpage:file:///C:/Users/flutt/Downloads/quiz/flutter-quizstar-master/lib/quizpage.dart:57:18</p> <pre><code> class getjson extends StatefulWidget { String langname; getjson(this.langname); @override State&lt;getjson&gt; createState() =&gt; _getjsonState(); } class _getjsonState extends State&lt;getjson&gt; { late String assettoload; // a function setasset() { if (widget.langname == &quot;Science&quot;) { assettoload = &quot;assets/Science.json&quot;; } else if (widget.langname == &quot;Maths&quot;) { assettoload = &quot;assets/Maths.json&quot;; } else if (widget.langname == &quot;History&quot;) { assettoload = &quot;assets/History.json&quot;; } } @override Widget build(BuildContext context) { setasset(); // and now we return the FutureBuilder to load and decode JSON return FutureBuilder( future: DefaultAssetBundle.of(context).loadString(assettoload, cache: false), builder: (context, snapshot) { if (snapshot.hasData) { List mydata = json.decode(snapshot.data.toString()); if (mydata == null) { return Scaffold( body: Center( child: Text( &quot;Loading&quot;, ), ), ); } else { return quizpage(mydata: mydata); }} return CircularProgressIndicator(); }, ); } } class quizpage extends StatefulWidget { final List mydata; quizpage({required this.mydata}); @override _quizpageState createState() =&gt; _quizpageState(mydata); } class _quizpageState extends State&lt;quizpage&gt; { final List mydata; _quizpageState(this.mydata); Color colortoshow = Colors.indigoAccent; Color right = Colors.green; Color wrong = Colors.red; int marks = 0; int i = 1; bool disableAnswer = false; int j = 1; int timer = 30; String showtimer = &quot;30&quot;; var random_array; Map&lt;String, Color&gt; btncolor = { &quot;a&quot;: Colors.indigoAccent, &quot;b&quot;: Colors.indigoAccent, &quot;c&quot;: Colors.indigoAccent, &quot;d&quot;: Colors.indigoAccent, }; bool canceltimer = false; genrandomarray(){ var distinctIds = []; var rand = new Random(); for (int i = 0;; ) { distinctIds.add(rand.nextInt(10)); random_array = distinctIds.toSet().toList(); if(random_array.length &lt; 10){ continue; }else{ break; } } print(random_array); } @override void initState() { starttimer(); genrandomarray(); super.initState(); } @override void setState(fn) { if (mounted) { super.setState(fn); } } void starttimer() async { const onesec = Duration(seconds: 1); Timer.periodic(onesec, (Timer t) { setState(() { if (timer &lt; 1) { t.cancel(); nextquestion(); } else if (canceltimer == true) { t.cancel(); } else { timer = timer - 1; } showtimer = timer.toString(); }); }); } void nextquestion() { canceltimer = false; timer = 30; setState(() { if (j &lt; 10) { i = random_array[j]; j++; } else { Navigator.of(context).pushReplacement(MaterialPageRoute( builder: (context) =&gt; resultpage(marks: marks), )); } btncolor[&quot;a&quot;] = Colors.indigoAccent; btncolor[&quot;b&quot;] = Colors.indigoAccent; btncolor[&quot;c&quot;] = Colors.indigoAccent; btncolor[&quot;d&quot;] = Colors.indigoAccent; disableAnswer = false; }); starttimer(); } void checkanswer(String k) { // in the previous version this was // mydata[2][&quot;1&quot;] == mydata[1][&quot;1&quot;][k] // which i forgot to change // so nake sure that this is now corrected if (mydata[2][i.toString()] == mydata[1][i.toString()][k]) { // just a print sattement to check the correct working // debugPrint(mydata[2][i.toString()] + &quot; is equal to &quot; + mydata[1][i.toString()][k]); marks = marks + 5; // changing the color variable to be green colortoshow = right; } else { // just a print sattement to check the correct working // debugPrint(mydata[2][&quot;1&quot;] + &quot; is equal to &quot; + mydata[1][&quot;1&quot;][k]); colortoshow = wrong; } setState(() { btncolor[k] = colortoshow; canceltimer = true; disableAnswer = true; }); // nextquestion(); // changed timer duration to 1 second Timer(Duration(seconds: 2), nextquestion); } Widget choicebutton(String k) { return Padding( padding: EdgeInsets.symmetric( vertical: 10.0, horizontal: 20.0, ), child: MaterialButton( onPressed: () =&gt; checkanswer(k), child: Text( mydata[1][i.toString()][k], style: TextStyle( color: Colors.white, fontFamily: &quot;Alike&quot;, fontSize: 16.0, ), maxLines: 1, ), color: btncolor[k], splashColor: Colors.indigo[700], highlightColor: Colors.indigo[700], minWidth: 200.0, height: 45.0, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20.0)), ), ); } @override Widget build(BuildContext context) { SystemChrome.setPreferredOrientations( [DeviceOrientation.portraitDown, DeviceOrientation.portraitUp]); return WillPopScope( onWillPop: () async{ return await showDialog( context: context, builder: (context) =&gt; AlertDialog( title: Text( &quot;Welcome&quot;, ), content: Text(&quot;You Can't Go Back At This Stage.&quot;), actions: &lt;Widget&gt;[ ElevatedButton( onPressed: () { Navigator.of(context).pop(); }, child: Text( 'Ok', ), ) ], )); }, child: Scaffold( body: Column( children: &lt;Widget&gt;[ Expanded( flex: 3, child: Container( padding: EdgeInsets.all(15.0), alignment: Alignment.bottomLeft, child: Text( mydata[0][i.toString()] , style: TextStyle( fontSize: 16.0, fontFamily: &quot;Quando&quot;, ), ), ), ), Expanded( flex: 6, child: AbsorbPointer( absorbing: disableAnswer, child: Container( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: &lt;Widget&gt;[ choicebutton('a'), choicebutton('b'), choicebutton('c'), choicebutton('d'), ], ), ), ), ), Expanded( flex: 1, child: Container( alignment: Alignment.topCenter, child: Center( child: Text( showtimer, style: TextStyle( fontSize: 35.0, fontWeight: FontWeight.w700, fontFamily: 'Times New Roman', ), ), ), ), ), ], ), ), ); } } </code></pre>
[ { "answer_id": 74135304, "author": "eamirho3ein", "author_id": 10306997, "author_profile": "https://Stackoverflow.com/users/10306997", "pm_score": 2, "selected": true, "text": "Text" } ]
2022/10/20
[ "https://Stackoverflow.com/questions/74135209", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20061332/" ]
74,135,215
<p>I am writing code to insert values from CSV files to MySQL DB. one of the SQL columns is DateTime. I get the value created from CSV and its this: 07/07/10 08:08</p> <pre><code>Timestamp sqlTimestampCreated = Timestamp.valueOf(String.valueOf(created)); statement.setTimestamp(6, sqlTimestampCreated); </code></pre> <p>how to convert 'created' to Datetime and set it to prepared Statement?</p>
[ { "answer_id": 74135309, "author": "Aman Mehta", "author_id": 13378772, "author_profile": "https://Stackoverflow.com/users/13378772", "pm_score": -1, "selected": false, "text": "yyyy-mm-dd hh:mm:ss" }, { "answer_id": 74136262, "author": "Basil Bourque", "author_id": 64270...
2022/10/20
[ "https://Stackoverflow.com/questions/74135215", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18434972/" ]
74,135,307
<p>I need to print <strong>startTime</strong> form this Map of decodedData. I am new to flutter . I need startTime so that I can show the time slots for availability.</p> <pre><code>Map decodedData = { &quot;sts&quot; : &quot;SUCCESS&quot;, &quot;data&quot; : [{ &quot;startTime&quot;: 1665392445000, &quot;between&quot;: 1665414045000 }, { &quot;startTime&quot;: 1665414045000, &quot;between&quot;: 1665414045000 }, ]}; </code></pre>
[ { "answer_id": 74135452, "author": "Vicky Rathod", "author_id": 10934506, "author_profile": "https://Stackoverflow.com/users/10934506", "pm_score": 0, "selected": false, "text": " decodedData[\"data\"]).values.forEach((v) => print(\"startTime = \n ${v[\"startTime\"]}\"));\n" }, { ...
2022/10/20
[ "https://Stackoverflow.com/questions/74135307", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19661715/" ]
74,135,326
<p>So I have two files. One yaml file that contains <code>tibetan words : its meaning</code>. Another csv file that contains only word and it's POStag. As below:</p> <p>yaml file :</p> <pre><code>ད་གདོད: ད་གཟོད་དང་དོན་འདྲ། ད་ཆུ: དངུལ་ཆུ་ཡི་མིང་གཞན། ད་ཕྲུག: དྭ་ཕྲུག་གི་འབྲི་ཚུལ་གཞན། ད་བེར: སྒྲིབ་བྱེད་དང་རླུང་འགོག་བྱེད་ཀྱི་གླེགས་བུ་ལེབ་མོའི་མིང་། ད་མེ་དུམ་མེ: དམ་དུམ་ལ་ལྟོས། </code></pre> <p>csv file :</p> <pre><code>ད་ཆུ PART ད་གདོད DET </code></pre> <p>Desired output:</p> <pre><code>ད་ཆུ PART དངུལ་ཆུ་ཡི་མིང་གཞན། ད་གདོད DET ད་གཟོད་དང་དོན་འདྲ། </code></pre> <p>Any idea on how to make text match from csv file to yaml file and extract its meaning in csv?</p>
[ { "answer_id": 74135435, "author": "noah", "author_id": 19745277, "author_profile": "https://Stackoverflow.com/users/19745277", "pm_score": 1, "selected": false, "text": "YAML_LINES = \"ད་གདོད: ད་གཟོད་དང་དོན་འདྲ།\\nད་ཆུ: དངུལ་ཆུ་ཡི་མིང་གཞན\\nད་ཕྲུག: དྭ་ཕྲུག་གི་འབྲི་ཚུལ་གཞན\\nད་བེར: སྒྲིབ...
2022/10/20
[ "https://Stackoverflow.com/questions/74135326", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17946386/" ]
74,135,366
<p>basically the issue is i am getting cities array and in the cities array i have multiple cities and each city also contain array i need model for this json response i am using &quot;https://app.quicktype.io/&quot;</p> <pre><code>{ &quot;code&quot;: &quot;0&quot;, &quot;message&quot;: &quot;Success!&quot;, &quot;data&quot;: { &quot;firstName&quot;: &quot;hello&quot;, &quot;lastName&quot;: &quot;world&quot;, &quot;mobile1&quot;: &quot;123456789&quot;, &quot;mobile2&quot;: &quot;123456789&quot;, &quot;cities&quot;: [ { &quot;Dubai&quot;: [ { &quot;id&quot;: 17, &quot;value&quot;: &quot;Dubai&quot;, &quot;selected&quot;: false } ] }, { &quot;Ajman&quot;: [ { &quot;id&quot;: 29, &quot;value&quot;: &quot;Ajman&quot;, &quot;selected&quot;: false } ] }, { &quot;Fujairah&quot;: [ { &quot;id&quot;: 30, &quot;value&quot;: &quot;Fujairah&quot;, &quot;selected&quot;: false } ] }, { &quot;Ras Al Khaimah&quot;: [ { &quot;id&quot;: 31, &quot;value&quot;: &quot;Ras Al Khaimah&quot;, &quot;selected&quot;: false } ] }, { &quot;Um Ul Quwein&quot;: [ { &quot;id&quot;: 32, &quot;value&quot;: &quot;Umm Al Quwein&quot;, &quot;selected&quot;: false } ] }, { &quot;AbuDhabi&quot;: [ { &quot;id&quot;: 33, &quot;value&quot;: &quot;Al Ain&quot;, &quot;selected&quot;: false }, { &quot;id&quot;: 34, &quot;value&quot;: &quot;Abu Dhabi&quot;, &quot;selected&quot;: false } ] }, { &quot;Sharjah&quot;: [ { &quot;id&quot;: 35, &quot;value&quot;: &quot;Sharjah&quot;, &quot;selected&quot;: true } ] } ], &quot;picture&quot;: &quot;https://upload.wikimedia.org/wikipedia/commons/thumb/b/b6/Image_created_with_a_mobile_phone.png/640px-Image_created_with_a_mobile_phone.png&quot; } } </code></pre>
[ { "answer_id": 74135472, "author": "Dheeraj Singh Bhadoria", "author_id": 10562311, "author_profile": "https://Stackoverflow.com/users/10562311", "pm_score": -1, "selected": false, "text": "class Response{\n String? code;\n String? message;\n Data? data;\n\n Response({this.code, this...
2022/10/20
[ "https://Stackoverflow.com/questions/74135366", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20288806/" ]
74,135,368
<p>There is a custom user model which inherits <code>AbstractUser</code> in Django.</p> <p>The model has <code>username = None</code>, below is the model:</p> <pre><code>class User(AbstractUser): username = None email = models.EmailField(_(&quot;Email address&quot;), unique=True) USERNAME_FIELD = &quot;email&quot; </code></pre> <p>I want to remove <code>username = None</code> so that we can save usernames as well.</p> <p>But the issues is we have various users in the database.</p> <p>and when I remove the <code>username = None</code> and try to migrate, I get the prompt:</p> <p><strong>It is impossible to add a non-nullable field 'username' to user without specifying a default. This is because the database needs something to populate existing rows. Please select a fix:</strong></p> <ol> <li><strong>Provide a one-off default now (will be set on all existing rows with a null value for this column)</strong></li> <li><strong>Quit and manually define a default value in models.py.</strong></li> </ol> <p>I don't want to override the <code>username</code> field of <code>AbstractUser</code> class.</p> <p><code>AbstractUser &gt; username</code>:</p> <pre><code>username_validator = UnicodeUsernameValidator() username = models.CharField( _(&quot;username&quot;), max_length=150, unique=True, help_text=_( &quot;Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.&quot; ), validators=[username_validator], error_messages={ &quot;unique&quot;: _(&quot;A user with that username already exists.&quot;), }, ) </code></pre> <p>I want <code>username</code> to take value of <code>email</code> if a different value is not provided.</p> <p>How can I provide the default value?</p>
[ { "answer_id": 74135835, "author": "NixonSparrow", "author_id": 12775662, "author_profile": "https://Stackoverflow.com/users/12775662", "pm_score": 1, "selected": false, "text": "pre_save" }, { "answer_id": 74136178, "author": "kaveh", "author_id": 2074794, "author_pr...
2022/10/20
[ "https://Stackoverflow.com/questions/74135368", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6049429/" ]
74,135,385
<p>Lets say I have an app like:</p> <pre><code> return ( &lt;div className=&quot;App&quot;&gt; &lt;button onMouseDown={(e) =&gt; console.log(&quot;down&quot;)} onMouseUp={(e) =&gt; console.log(&quot;up&quot;)} onMouseMove={(e) =&gt; console.log(&quot;move&quot;)} &gt; test &lt;/button&gt; &lt;/div&gt; ); } export default App; </code></pre> <p>With this minimal example I would expect that <em>down</em> is fired only once when pressing the mousebutton, <em>up</em> also once etc. But my console output shows that things seem to get messy when also moving the mouse? What is going on here? like real input is mousedown-&gt;mousemove-&gt;mouseup but console is sth like mousedown-&gt;mousemove-&gt;mouseup-&gt;mousedown-&gt;mousemove-&gt;mouseup which makes no sense to me....</p> <p>Thanks a lot!</p> <p>it does not matter if it's an button or not (I just choose a button for simplicity).</p>
[ { "answer_id": 74135835, "author": "NixonSparrow", "author_id": 12775662, "author_profile": "https://Stackoverflow.com/users/12775662", "pm_score": 1, "selected": false, "text": "pre_save" }, { "answer_id": 74136178, "author": "kaveh", "author_id": 2074794, "author_pr...
2022/10/20
[ "https://Stackoverflow.com/questions/74135385", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19247344/" ]
74,135,397
<p>As the title, How do I get the column name of the second/third largest/smallest value across rows by <code>dplyr</code>? (Note!: compare value from gp1 to gp3, I modify the orginal data)</p> <p>One way is use <code>apply</code> in base R:</p> <pre><code>a &lt;- data.frame(name=letters[1:9], gp1=c(3:11), gp2=c(1:9), gp3=c(8,8,2,6,6,6,12,12,6)) ## ## name gp1 gp2 gp3 ## 1 a 3 1 8 ## 2 b 4 2 8 ## 3 c 5 3 2 ## 4 d 6 4 6 ## 5 e 7 5 6 ## 6 f 8 6 6 ## 7 g 9 7 12 ## 8 h 10 8 12 ## 9 i 11 9 6 a$max1_colname &lt;- apply(a, 1, function(t) colnames(a)[which.max(t)]) ## There will be some warnings. the problem of name column? ## ## name gp1 gp2 gp3 max1_colname ## 1 a 3 1 8 gp3 ## 2 b 4 2 8 gp3 ## 3 c 5 3 2 gp1 ## 4 d 6 4 6 gp1 ## 5 e 7 5 6 gp1 ## 6 f 8 6 6 gp1 ## 7 g 9 7 12 gp3 ## 8 h 10 8 12 gp3 ## 9 i 11 9 6 gp1 </code></pre> <p>How could I accomplish it by using <code>dplyr</code> (ignore the 4th row has two max values) and how about the second largest column name?</p> <p>Extra: More complex, if there are two max largest value (such as 4th row), how could I get the result as follow:</p> <pre><code>## ## name gp1 gp2 gp3 max1_colname ## 1 a 3 1 8 gp3 ## 2 b 4 2 8 gp3 ## 3 c 5 3 2 gp1 ## 4 d 6 4 6 gp1+gp3 ## 5 e 7 5 6 gp1 ## 6 f 8 6 6 gp1 ## 7 g 9 7 12 gp3 ## 8 h 10 8 12 gp3 ## 9 i 11 9 6 gp1 </code></pre> <p>Thanks.</p>
[ { "answer_id": 74135697, "author": "mgrund", "author_id": 14407123, "author_profile": "https://Stackoverflow.com/users/14407123", "pm_score": 2, "selected": false, "text": "library(tidyverse)\n\na %>% \n rowwise() %>% \n mutate(max1_colname = names(.)[which.max(c_across(everything()))]...
2022/10/20
[ "https://Stackoverflow.com/questions/74135397", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7334572/" ]
74,135,406
<p>I want to import a function present in a julia file somewhere during runtime just like in python we have <code>importlib.import_module</code> to import module is there something present in julia</p> <p>I'm new to julia and I'm not sure how to do that. I have to import a function <code>main</code> from another julia file and want to run it but I have to also check a condition before that if the condition is true then I want to import the function.</p> <p><strong>EDIT</strong></p> <p>I have a file</p> <p>main.jl</p> <pre><code>function myMain() s1 = &quot;Hello&quot; s2 = &quot;World!&quot; include(&quot;functions/hello.jl&quot;) say(s1, s2) end myMain() </code></pre> <p>hello.jl</p> <pre><code>function say(s1, s2) print(s1, s2) end </code></pre> <p><strong>Error</strong></p> <pre><code>ERROR: LoadError: MethodError: no method matching say(::String, ::String) The applicable method may be too new: running in world age 32378, while current world is 32379. Closest candidates are: say(::Any, ::Any) at ~/Desktop/julia_including/functions/hello.jl:1 (method too new to be called from this world context.) Stacktrace: [1] myMain() @ Main ~/Desktop/julia_including/main.jl:5 [2] top-level scope @ ~/Desktop/julia_including/main.jl:8 in expression starting at /home/shivansh/Desktop/julia_including/main.jl:8 </code></pre> <p>It works fine when I don't use include inside the myMain() function in main.jl</p>
[ { "answer_id": 74139962, "author": "aldente", "author_id": 6565383, "author_profile": "https://Stackoverflow.com/users/6565383", "pm_score": 0, "selected": false, "text": "if some_condition\n include(\"/path/to/some/file/that/you/need.jl\")\nelse\n include(\"/path/to/some/OTHER/fil...
2022/10/20
[ "https://Stackoverflow.com/questions/74135406", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18186810/" ]
74,135,417
<p>I want to develop an app which needs to run a scheduled job which writes something to database for every 15 minutes from 9 am to 9 pm How can i implement this? Thanks</p>
[ { "answer_id": 74139962, "author": "aldente", "author_id": 6565383, "author_profile": "https://Stackoverflow.com/users/6565383", "pm_score": 0, "selected": false, "text": "if some_condition\n include(\"/path/to/some/file/that/you/need.jl\")\nelse\n include(\"/path/to/some/OTHER/fil...
2022/10/20
[ "https://Stackoverflow.com/questions/74135417", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13523051/" ]
74,135,490
<p>I want to split a dataframe into quartiles of a specific column.</p> <p>I have data from 800 companies. One row displays a specific score which ranges from 0 to 100.</p> <p>I want to split the dataframe in 4 groups (quartiles) with same size (Q1 to Q4, Q4 should contain the companies with the highest scores). So each group should contain 200 companies. How can I divide the companies into 4 equal sized groups according to their score of a specific column (here the last column &quot;ESG Combined Score 2011&quot;)? I want to extract the groups to separate sheets in excel (Q1 in a sheet named Q1, Q2 in a sheet named Q2 and so on).</p> <p>Here is an extract of the data:</p> <pre><code> df1 Company Common Name Company Market Capitalization ESG Combined Score 2011 0 SSR Mining Inc 3.129135e+09 32.817325 1 Fluor Corp 3.958424e+09 69.467729 2 CBRE Group Inc 2.229251e+10 59.632423 3 Assurant Inc 8.078239e+09 46.492803 4 CME Group Inc 6.269954e+10 42.469682 5 Peabody Energy Corp 3.842130e+09 73.374671 </code></pre> <p>And as an additional question: How can I turn off the scientific notation of the column in the middle? I want it to display with separators.</p> <p>Thanks for your help</p>
[ { "answer_id": 74139962, "author": "aldente", "author_id": 6565383, "author_profile": "https://Stackoverflow.com/users/6565383", "pm_score": 0, "selected": false, "text": "if some_condition\n include(\"/path/to/some/file/that/you/need.jl\")\nelse\n include(\"/path/to/some/OTHER/fil...
2022/10/20
[ "https://Stackoverflow.com/questions/74135490", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20262273/" ]
74,135,511
<p>How do I get words to break correctly to new lines in Android with Jetpack Compose? I know the functionality from the web, where I use <code>&amp;shy;</code> for such cases.</p> <p>I defined string values with possible line breaks like this: <code>Korrespondenz\u00ADsprache</code>. Unfortunately this does not work for Android.</p> <p>I use the following code</p> <pre><code>Text( text = &quot;Korrespondenz\u00ADsprache&quot;, style = MaterialTheme.typography.h4 ) </code></pre> <p>Currently the result looks like this:</p> <p><a href="https://i.stack.imgur.com/krRGV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/krRGV.png" alt="enter image description here" /></a></p> <p>The expected result should look like this:</p> <p><a href="https://i.stack.imgur.com/CaEle.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CaEle.png" alt="enter image description here" /></a></p>
[ { "answer_id": 74139962, "author": "aldente", "author_id": 6565383, "author_profile": "https://Stackoverflow.com/users/6565383", "pm_score": 0, "selected": false, "text": "if some_condition\n include(\"/path/to/some/file/that/you/need.jl\")\nelse\n include(\"/path/to/some/OTHER/fil...
2022/10/20
[ "https://Stackoverflow.com/questions/74135511", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5999224/" ]
74,135,517
<p>My query</p> <pre class="lang-js prettyprint-override"><code> const users = usersWorkspaceModel .find({ workspaceId, userRole: 'supervisor', }) .select({ _id: 0, createdAt: 0, assignedBy: 0, updatedAt: 0, workspaceId: 0, }) .populate({ path: 'userId', select: ['_id', 'name', 'email'], mode: 'User', }); </code></pre> <p>This returns me the following result :-</p> <pre class="lang-json prettyprint-override"><code> &quot;users&quot;: [ { &quot;userId&quot;: { &quot;_id&quot;: &quot;634e890c9de1ec46aad0015a&quot;, &quot;name&quot;: &quot;supervisor-abdullah-new&quot;, &quot;email&quot;: &quot;abdullah_new@gmail.com&quot; }, &quot;userRole&quot;: &quot;supervisor&quot;, &quot;busy&quot;: false, &quot;socketId&quot;: null }, { &quot;userId&quot;: { &quot;_id&quot;: &quot;633d498fc3935aa2ab1f9af6&quot;, &quot;name&quot;: &quot;supervisor-abdullah&quot;, &quot;email&quot;: &quot;abdullah-supervisor@gmail.com&quot; }, &quot;userRole&quot;: &quot;supervisor&quot;, &quot;busy&quot;: false, &quot;socketId&quot;: null }, ] </code></pre> <p>The result that I want :-</p> <pre class="lang-json prettyprint-override"><code>&quot;users&quot;: [ { &quot;_id&quot;: &quot;634e890c9de1ec46aad0015a&quot;, &quot;name&quot;: &quot;supervisor-abdullah-new&quot;, &quot;email&quot;: &quot;abdullah_new@gmail.com&quot;, &quot;userRole&quot;: &quot;supervisor&quot;, &quot;busy&quot;: false, &quot;socketId&quot;: null }, { &quot;_id&quot;: &quot;633d498fc3935aa2ab1f9af6&quot;, &quot;name&quot;: &quot;supervisor-abdullah&quot;, &quot;email&quot;: &quot;abdullah-supervisor@gmail.com&quot;, &quot;userRole&quot;: &quot;supervisor&quot;, &quot;busy&quot;: false, &quot;socketId&quot;: null }, ] </code></pre> <p>usersWorkspaceModel Collection :-</p> <pre class="lang-json prettyprint-override"><code>{ &quot;_id&quot;: { &quot;$oid&quot;: &quot;634feda89b9ebdf9a12aa7c1&quot; }, &quot;userId&quot;: { &quot;$oid&quot;: &quot;6347bf9befe34bf785fb9a07&quot; }, &quot;userRole&quot;: &quot;supervisor&quot;, &quot;workspaceId&quot;: { &quot;$oid&quot;: &quot;6347de1e81a714995bb497b1&quot; }, &quot;assignedBy&quot;: { &quot;$oid&quot;: &quot;633c3409f2c19af92e788ac6&quot; }, &quot;busy&quot;: false, &quot;socketId&quot;: null, &quot;createdAt&quot;: { &quot;$date&quot;: { &quot;$numberLong&quot;: &quot;1666182568991&quot; } }, &quot;updatedAt&quot;: { &quot;$date&quot;: { &quot;$numberLong&quot;: &quot;1666187418223&quot; } } },{ &quot;_id&quot;: { &quot;$oid&quot;: &quot;634ea79850cbfd7e532d27a7&quot; }, &quot;userId&quot;: { &quot;$oid&quot;: &quot;633d498fc3935aa2ab1f9af6&quot; }, &quot;userRole&quot;: &quot;supervisor&quot;, &quot;workspaceId&quot;: { &quot;$oid&quot;: &quot;633fd3235788f7cd7222c19e&quot; }, &quot;assignedBy&quot;: { &quot;$oid&quot;: &quot;633c3409f2c19af92e788ac6&quot; }, &quot;busy&quot;: false, &quot;socketId&quot;: null, &quot;createdAt&quot;: { &quot;$date&quot;: { &quot;$numberLong&quot;: &quot;1666099096965&quot; } }, &quot;updatedAt&quot;: { &quot;$date&quot;: { &quot;$numberLong&quot;: &quot;1666247564289&quot; } } } </code></pre> <p>Users Collection:-</p> <pre class="lang-json prettyprint-override"><code>{ &quot;_id&quot;: { &quot;$oid&quot;: &quot;63354ddcdddc0907714a8622&quot; }, &quot;name&quot;: &quot;warda2&quot;, &quot;email&quot;: &quot;client@gmail.com&quot;, &quot;password&quot;: &quot;$2b$10$BSEMsaytAXm.vaZKLDCuzu7LG4SPzvsXrLEOYK/3F5Fq4FGDdGuTO&quot;, &quot;companyPosition&quot;: null, &quot;companyName&quot;: null, &quot;industry&quot;: null, &quot;country&quot;: null, &quot;currency&quot;: [], &quot;profileImageUrl&quot;: null, &quot;profileImageName&quot;: null, &quot;role&quot;: &quot;client&quot;, &quot;isEmployee&quot;: false, &quot;status&quot;: &quot;Active&quot;, &quot;firebaseToken&quot;: &quot;fXxT5ZRQJSKMDOaXKOkWxF:APA91bGkZDWuceOGTd_hTwHhjCRKo4c6rbsyBSdFBL8l45oBxqKvpxHnjYLfUzAU6whHwGmpM07wasEw9nne4U8qRdhz_vf5hSJs3NLVZ94DsxtryxxIDM_WVM1A2E76mVJ39_46FMmU&quot;, &quot;resetPasswordToken&quot;: null, &quot;resetPasswordExpires&quot;: null, &quot;emailVerificationToken&quot;: null, &quot;emailTokenExpiry&quot;: null, &quot;createdAt&quot;: { &quot;$date&quot;: { &quot;$numberLong&quot;: &quot;1664437724388&quot; } }, &quot;updatedAt&quot;: { &quot;$date&quot;: { &quot;$numberLong&quot;: &quot;1666247312218&quot; } }, &quot;deleted&quot;: true },{ &quot;_id&quot;: { &quot;$oid&quot;: &quot;6346c87dca22a36cf627bd8b&quot; }, &quot;name&quot;: &quot;supervisor-hassan&quot;, &quot;email&quot;: &quot;hassan@gmail.com&quot;, &quot;password&quot;: &quot;$2b$10$VQ0MiXKlGKc0A0EmOr.4i.kImCQtjRqYQVNlURfoPfpfvszcHoI9.&quot;, &quot;companyPosition&quot;: null, &quot;companyName&quot;: null, &quot;industry&quot;: null, &quot;country&quot;: null, &quot;currency&quot;: [], &quot;profileImageUrl&quot;: null, &quot;profileImageName&quot;: null, &quot;role&quot;: &quot;supervisor&quot;, &quot;isEmployee&quot;: false, &quot;status&quot;: &quot;Active&quot;, &quot;firebaseToken&quot;: null, &quot;resetPasswordToken&quot;: null, &quot;resetPasswordExpires&quot;: null, &quot;emailVerificationToken&quot;: null, &quot;emailTokenExpiry&quot;: null, &quot;deleted&quot;: true, &quot;createdAt&quot;: { &quot;$date&quot;: { &quot;$numberLong&quot;: &quot;1665583229322&quot; } }, &quot;updatedAt&quot;: { &quot;$date&quot;: { &quot;$numberLong&quot;: &quot;1665583352347&quot; } } } </code></pre> <p>I want the nested object <code>userId</code> to be flattened using mongoose. How can I achieve this ? I want the data present in the <code>userId</code> object to be placed on the same top level object (not in any nested object). I just want to restructure the data which is being returned by my query.</p>
[ { "answer_id": 74136388, "author": "NeNaD", "author_id": 14389830, "author_profile": "https://Stackoverflow.com/users/14389830", "pm_score": 0, "selected": false, "text": "const ObjectId = require('mongoose').Types.ObjectId;\n\n\nconst users = usersWorkspaceModel.aggregate([\n {\n $m...
2022/10/20
[ "https://Stackoverflow.com/questions/74135517", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19741132/" ]
74,135,531
<p>This is the code I'm trying to run</p> <pre><code>select min(sod.ModifiedDate) as [ModifiedDate] ,Bikes = (select sum(LineTotal) from SalesOrderDetail where max(ProductCategoryName) = 'Bikes' and ModifiedDate = sod.ModifiedDatee) ,Components = (select sum(LineTotal) from SalesOrderDetail where max(ProductCategoryName) = 'Components' and ModifiedDate = sod.ModifiedDate) ,Clothing = (select sum(LineTotal) from SalesOrderDetail where max(ProductCategoryName) = 'Clothing' and ModifiedDate = sod.ModifiedDate ) ,Accessories = (select sum(LineTotal) from SalesOrderDetail where max(ProductCategoryName) = 'Accessories' and ModifiedDate = sod.ModifiedDate ) from SalesOrderDetail sod inner join product p on p.ProductID = sod.ProductID inner join ProductSubcategory ps on ps.ProductSubcategoryID = p.ProductSubcategoryID inner join ProductCategory pc on pc.ProductCategoryID = ps.ProductCategoryID group by ProductCategoryName ,sod.ModifiedDate ,datepart(year, sod.ModifiedDate) ,datepart(month, sod.ModifiedDate) ,datepart(day, sod.ModifiedDate) order by datepart(year, sod.ModifiedDate) ,datepart(month, sod.ModifiedDate) ,datepart(day, sod.ModifiedDate) </code></pre> <p>I can't figure out how to make it so it splits the LineTotal into the four ProductNameCategory like this: (expected result)</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>ModifiedDate</th> <th>Bikes</th> <th>Components</th> <th>Clothing</th> <th>Accessories</th> </tr> </thead> <tbody> <tr> <td>2005-07-01 00:00:00.000</td> <td>467709.136900</td> <td>31525.960400</td> <td>2875.153600</td> <td>1695.666000</td> </tr> <tr> <td>2005-07-02 00:00:00.000</td> <td>13931.520000</td> <td>NULL</td> <td>NULL</td> <td>NULL</td> </tr> <tr> <td>2005-07-03 00:00:00.000</td> <td>15012.178200</td> <td>NULL</td> <td>NULL</td> <td>NULL</td> </tr> <tr> <td>2005-07-04 00:00:00.000</td> <td>7156.540000</td> <td>NULL</td> <td>NULL</td> <td>NULL</td> </tr> <tr> <td>2005-07-05 00:00:00.000</td> <td>15012.178200</td> <td>NULL</td> <td>NULL</td> <td>NULL</td> </tr> </tbody> </table> </div> <p>All I get is this, it adds all the lineTotal for a given date regardless of ProductCategoryName and then puts the sum in Components, except when the only thing there is that day is Bikes, then he puts it in Bikes.</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>ModifiedDate</th> <th>Bikes</th> <th>Components</th> <th>Clothing</th> <th>Accessories</th> </tr> </thead> <tbody> <tr> <td>2005-07-01 00:00:00.000</td> <td>NULL</td> <td>503805.916900</td> <td>NULL</td> <td>NULL</td> </tr> <tr> <td>2005-07-02 00:00:00.000</td> <td>13931.520000</td> <td>NULL</td> <td>NULL</td> <td>NULL</td> </tr> <tr> <td>2005-07-03 00:00:00.000</td> <td>15012.178200</td> <td>NULL</td> <td>NULL</td> <td>NULL</td> </tr> <tr> <td>2005-07-04 00:00:00.000</td> <td>7156.540000</td> <td>NULL</td> <td>NULL</td> <td>NULL</td> </tr> <tr> <td>2005-07-05 00:00:00.000</td> <td>15012.178200</td> <td>NULL</td> <td>NULL</td> <td>NULL</td> </tr> </tbody> </table> </div> <p>How can I make it look like the expected result without Pivot and case when? I need to get the results showed here using four different methods to then test performance and I already used pivot and case when. I'm trying to use this method I found <a href="https://learn.microsoft.com/en-us/troubleshoot/sql/database-design/rotate-table" rel="nofollow noreferrer">https://learn.microsoft.com/en-us/troubleshoot/sql/database-design/rotate-table</a> for this specific query</p>
[ { "answer_id": 74144046, "author": "Tim Jarosz", "author_id": 2452207, "author_profile": "https://Stackoverflow.com/users/2452207", "pm_score": 0, "selected": false, "text": "select DISTINCT CAST(sod.ModifiedDate as date) as [ModifiedDate]\n , Bikes = (\n select sum(LineTotal) ...
2022/10/20
[ "https://Stackoverflow.com/questions/74135531", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20287774/" ]
74,135,539
<p>I have a few things to get clear, specifically regarding modeling architecture for a serverless application using AWS CDK.</p> <p>I’m currently working on a serverless application developed using AWS CDK in TypeScript. Also as a convention, we follow the below rules too.</p> <ol> <li>A stack should only have one table (dynamo)</li> <li>A stack should only have one REST API (api-gateway)</li> <li>A stack should not depend on any other stack (no cross-references), unless its the Event-Stack (a stack dedicated to managing EventBridge operations)</li> </ol> <p>The reason for that is so that each stack can be deployed independently without any interferences of other stacks. In a way, our stacks are equivalent to micro-services in a micro-service architecture.</p> <p>At the moment all the REST APIs are public and now we have decided to make them private by attaching custom Lambda authorizers to each API Gateway resource. Now, in this custom Lambda authorizer, we have to do certain operations (apart from token validation) in order to allow the user's request to proceed further. Those operations are,</p> <ol> <li>Get the user’s role from DB using the user ID in the token</li> <li>Get the user’s subscription plan (paid, free, etc.) from DB using the user ID in the token.</li> <li>Get the user’s current payment status (due, no due, fully paid, etc.) from DB using the user ID in the token.</li> <li>Get scopes allowed for this user based on 1. 2. And 3.</li> <li>Check whether the user can access this scope (the resource user currently requesting) based on 4.</li> </ol> <p>This authorizer Lambda function needs to be used by all the other Stacks to make their APIs private. But the problem is roles, scopes, subscriptions, payments &amp; user data are in different stacks in their dedicated DynamoDB tables. Because of the rules, I have explained before (especially rule number 3.) we cannot depend on the resources defined in other stacks. Hence we are unable to create the Authoriser we want.</p> <p>Solutions we could think of and their problems:</p> <ul> <li>Since EventBridge isn't bi-directional we cannot use it to fetch data from a different stack resource.</li> <li>We can <a href="https://docs.aws.amazon.com/lambda/latest/dg/API_Invoke.html" rel="nofollow noreferrer">invoke</a> a Lambda in a different stack using its ARN and get the required data from its' response but, AWS has discouraged this as a CDK Anti Pattern</li> <li>We cannot use technology like gRPC because it requires a continuously running server, which is out of the scope of the server-less architecture.</li> </ul> <p>There was also a proposal to re-design the CDK layout of our application. The main feature of this layout is going from non-crossed-references to adopting a fully-crossed-references pattern. (Inspired by layered architecture as described in this <a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/best-practices.html#organizingstacks" rel="nofollow noreferrer">AWS best practice</a>)</p> <p>Based on that article, we came up with a layout like this.</p> <ul> <li>Presentation Layer <ul> <li>Stack for deploying the consumer web app</li> <li>Stack for deploying admin portal web app</li> </ul> </li> <li>Application Layer <ul> <li>Stack for REST API definitions using API Gateway</li> <li>Stack for Lambda functions running business-specific operations (Ex: CRUDs)</li> <li>Stack for Lambda functions runs on event triggers</li> <li>Stack for Authorisation (Custom Lambda authorizer(s))</li> <li>Stack for Authentication implementation (Cognito user pool and client)</li> <li>Stack for Events (EvenBuses)</li> <li>Stack for storage (S3)</li> </ul> </li> <li>Data Layer <ul> <li>Stack containing all the database definitions</li> <li>There could be another stack for reporting, data engineering, etc.</li> </ul> </li> </ul> <p><a href="https://i.stack.imgur.com/K4Po0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/K4Po0.png" alt="proposed CDK application architecture" /></a></p> <p>As you can see, now stacks are going to have multiple dependencies with other stacks' resources (But no circular dependencies, as shown in the attached image). While this pattern unblocks us from writing an effective custom Lambda authorizer we are not sure whether this pattern won't be a problem in the long run, when the application's scope increases.</p> <p>I highly appreciate the help any one of you could give us to resolve this problem. Thanks!</p>
[ { "answer_id": 74147454, "author": "Wesley Cheek", "author_id": 11922567, "author_profile": "https://Stackoverflow.com/users/11922567", "pm_score": 0, "selected": false, "text": "AWS Systems Manager" } ]
2022/10/20
[ "https://Stackoverflow.com/questions/74135539", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2006658/" ]
74,135,546
<p>I have three sheets in a workbook where people enter data (text values) in different columns, with different row lengths.</p> <p>For example:</p> <p><strong>Sheet 1</strong></p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>Group 1</th> <th>Group 2</th> <th>Group 3</th> </tr> </thead> <tbody> <tr> <td>Apple</td> <td>Apple</td> <td>Apple</td> </tr> <tr> <td>Orange</td> <td>Orange</td> <td>Banana</td> </tr> <tr> <td></td> <td>Banana</td> <td>Peach</td> </tr> <tr> <td></td> <td>Pear</td> <td></td> </tr> </tbody> </table> </div> <p><strong>Sheet 2</strong></p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>Group 1</th> <th>Group 2</th> <th>Group 3</th> </tr> </thead> <tbody> <tr> <td>Onion</td> <td>Onion</td> <td>Onion</td> </tr> <tr> <td>Tomato</td> <td>Tomato</td> <td>Leek</td> </tr> <tr> <td>Leek</td> <td></td> <td>Garlic</td> </tr> <tr> <td></td> <td></td> <td>Potato</td> </tr> </tbody> </table> </div> <p>I'm looking to combine this data into a single sheet, displayed as such:</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>Group 1</th> <th>Group 2</th> <th>Group 3</th> </tr> </thead> <tbody> <tr> <td>Apple</td> <td>Apple</td> <td>Apple</td> </tr> <tr> <td>Orange</td> <td>Orange</td> <td>Banana</td> </tr> <tr> <td>Onion</td> <td>Banana</td> <td>Peach</td> </tr> <tr> <td>Tomato</td> <td>Pear</td> <td>Onion</td> </tr> <tr> <td>Leek</td> <td>Onion</td> <td>Leek</td> </tr> <tr> <td></td> <td>Tomato</td> <td>Garlic</td> </tr> <tr> <td></td> <td></td> <td>Potato</td> </tr> </tbody> </table> </div> <p>I've tried this formula:</p> <p><code>=QUERY({Sheet1!A3:G;Sheet2!A3:G;Sheet3!A3:G},&quot;select * where Col1&lt;&gt;'' or Col2&lt;&gt;'' or Col3&lt;&gt;''&quot;,0)</code></p> <p>But it adds in blanks for as many as the longest column is on each sheet, like so:</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>Group 1</th> </tr> </thead> <tbody> <tr> <td>Apple</td> </tr> <tr> <td>Orange</td> </tr> <tr> <td></td> </tr> <tr> <td></td> </tr> <tr> <td>Onion</td> </tr> <tr> <td>Tomato</td> </tr> <tr> <td>Leek</td> </tr> </tbody> </table> </div> <p>Is there anything I can change to have it just list the items per column in the order queried, skipping blank cells as opposed to rows? I found lots of guidance in other questions about consolidating into a single column, but I want to keep the columns separated and consolidate rows instead.</p>
[ { "answer_id": 74147454, "author": "Wesley Cheek", "author_id": 11922567, "author_profile": "https://Stackoverflow.com/users/11922567", "pm_score": 0, "selected": false, "text": "AWS Systems Manager" } ]
2022/10/20
[ "https://Stackoverflow.com/questions/74135546", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19422231/" ]
74,135,549
<p>I have an image when manually resized to width 1000pts the resolution comes to 261.5pixels/inch</p> <p><strong>Original Image Dimensions</strong></p> <p><a href="https://i.stack.imgur.com/8ahVc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8ahVc.png" alt="enter image description here" /></a></p> <p><em><strong>Manual Update width to 1000pts</strong></em></p> <p><a href="https://i.stack.imgur.com/dUg11.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dUg11.png" alt="enter image description here" /></a></p> <p>The resolution downgraded to 261.5 px/in</p> <p>When i try the same programmatically with js script the width changes but resolution is same as of the original image</p> <p><strong>JS Code</strong></p> <pre><code> document.resizeImage(UnitValue(parseInt(row.width),&quot;pt&quot;), null, null); //working </code></pre> <p>where row.width = 1000</p> <p><strong>Image dimensions after executing the js script</strong></p> <p><a href="https://i.stack.imgur.com/W250F.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/W250F.png" alt="enter image description here" /></a></p> <p>How to calculate the resolution of the image automatically and set to 261.5px/inch</p>
[ { "answer_id": 74150437, "author": "Alaksandar Jesus Gene", "author_id": 2491541, "author_profile": "https://Stackoverflow.com/users/2491541", "pm_score": 2, "selected": true, "text": "newResolution = document.resolution * (originalWidth / parseInt(row.width));\ndocument.resizeImage(null...
2022/10/20
[ "https://Stackoverflow.com/questions/74135549", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2491541/" ]
74,135,561
<p>I have a dataframe that looks like this:</p> <pre><code>Col_1 Col_X_1 Col_2 Col_X_2 ... ABC 890 AJF 341 JFH 183 DFJ 132 ... </code></pre> <p>After each block of columns (e.g. Col_1 &amp; Col_X_1) that belong together according to the number at the end, I want to insert two more (empty) columns with the names <em>Col_Y_n</em> and <em>Col_Z_n</em>, with n being the same number as the block of columns before. The final dataframe should look like this:</p> <pre><code>Col_1 Col_X_1 Col_Y_1 Col_Z_1 Col_2 Col_X_2 Col_Y_2 Col_Z_2 ... ABC 890 AJF 341 JFH 183 DFJ 132 ... </code></pre> <p>How can I accomplish this?</p> <p>Here my <code>dput</code> output of my real data:</p> <pre><code>structure(list(Company = c(&quot;CompanyA&quot;, &quot;CompanyB&quot;), Team_1 = c(&quot;NameA&quot;, &quot;NameB&quot;), Team_Desc_1 = c(&quot;Founder &amp; Co-CEO&quot;, &quot;Senior Blockchain Engineer&quot;), Team_URL_1 = c(&quot;https://www.linkedin.com/in/NameA/&quot;, NA), Team_Ver_1 = c(&quot;unverified&quot;, NA), Team_2 = c(&quot;NameC&quot;, &quot;NameD&quot;), Team_Desc_2 = c(&quot;Chairman&quot;, &quot;Senior Software Engineer&quot; ), Team_URL_2 = c(&quot;https://www.linkedin.com/in/NameC/&quot;, NA), Team_Ver_2 = c(&quot;unverified&quot;, NA), Team_3 = c(&quot;NameE&quot;, &quot;NameF&quot;)), class = c(&quot;grouped_df&quot;, &quot;tbl_df&quot;, &quot;tbl&quot;, &quot;data.frame&quot;), row.names = c(NA, -2L), groups = structure(list( Company = c(&quot;CompanyB&quot;, &quot;CompanyA&quot;), .rows = structure(list( 2L, 1L), ptype = integer(0), class = c(&quot;vctrs_list_of&quot;, &quot;vctrs_vctr&quot;, &quot;list&quot;))), class = c(&quot;tbl_df&quot;, &quot;tbl&quot;, &quot;data.frame&quot; ), row.names = c(NA, -2L), .drop = TRUE)) </code></pre>
[ { "answer_id": 74137326, "author": "s__", "author_id": 6498650, "author_profile": "https://Stackoverflow.com/users/6498650", "pm_score": 2, "selected": false, "text": "split()" }, { "answer_id": 74137900, "author": "Panagiotis Togias", "author_id": 6181820, "author_pr...
2022/10/20
[ "https://Stackoverflow.com/questions/74135561", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11361967/" ]
74,135,650
<p>I am a novice in using python and pandas so please pardon my ignorance.</p> <p>I am tracking my sleep habits using a watch to see what time I usually go to bed. In this hypothetical example, I have this data (just an excerpt of the overall data I have):</p> <pre><code>import pandas as pd df = pd.DataFrame( { &quot;Date&quot;: [&quot;16/10/2022&quot;, &quot;17/10/2022&quot;, &quot;18/10/2022&quot;, &quot;19/10/2022&quot;], &quot;Time&quot;: [&quot;2:15:00 AM&quot;, &quot;11:30:00 PM&quot;, &quot;12:20:00 AM&quot;, &quot;1:15:00 AM&quot;], } ) </code></pre> <p>I tried to find the minimum time (i.e.earliest time I go to bed) and the maximum time (the latest I went to bed) using the describe function after converting them to datetime objects.</p> <pre><code>df[&quot;Date and Time&quot;] = df[&quot;Date&quot;] + &quot; &quot; + df[&quot;Time&quot;] df[&quot;Date and Time&quot;] = pd.to_datetime(df[&quot;Date and Time&quot;]) </code></pre> <p>However, the statistics given for the min and the max are given by pandas are as follows</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th></th> <th>Date and Time</th> </tr> </thead> <tbody> <tr> <td>count</td> <td>4</td> </tr> <tr> <td>mean</td> <td>2022-10-17 18:50:00</td> </tr> <tr> <td>min</td> <td>2022-10-16 02:15:00</td> </tr> <tr> <td>25%</td> <td>2022-10-17 12:11:15</td> </tr> <tr> <td>50%</td> <td>2022-10-17 23:55:00</td> </tr> <tr> <td>75%</td> <td>2022-10-18 06:33:45</td> </tr> <tr> <td>max</td> <td>2022-10-19 01:15:00</td> </tr> </tbody> </table> </div> <p>I would expect the output for the min to be 11:30 PM, rather than at 2:15:00 AM, and the max to be 2:15:00am, rather than 1:15:00 AM.</p> <p>If I do not join the &quot;Time&quot; and &quot;Date&quot; column as shown:</p> <pre><code>df[&quot;Date&quot;] = pd.to_datetime(df[&quot;Date&quot;]) df[&quot;Time&quot;] = pd.to_datetime(df[&quot;Time&quot;]) df.describe(datetime_is_numeric=True) </code></pre> <p>Then the output is thus:</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th></th> <th>Date</th> <th>Time</th> </tr> </thead> <tbody> <tr> <td>count</td> <td>4</td> <td>4</td> </tr> <tr> <td>mean</td> <td>2022-10-17 12:00:00</td> <td>2022-10-20 06:50:00</td> </tr> <tr> <td>min</td> <td>2022-10-16 00:00:00</td> <td>2022-10-20 00:20:00</td> </tr> <tr> <td>25%</td> <td>2022-10-16 18:00:00</td> <td>2022-10-20 01:01:15</td> </tr> <tr> <td>50%</td> <td>2022-10-17 12:00:00</td> <td>2022-10-20 01:45:00</td> </tr> <tr> <td>75%</td> <td>2022-10-18 06:00:00</td> <td>2022-10-20 07:33:45</td> </tr> <tr> <td>max</td> <td>2022-10-19 00:00:00</td> <td>2022-10-20 23:30:00</td> </tr> </tbody> </table> </div> <p>Any help is greatly appreciated.</p>
[ { "answer_id": 74135766, "author": "T C Molenaar", "author_id": 8814131, "author_profile": "https://Stackoverflow.com/users/8814131", "pm_score": 1, "selected": false, "text": "df = pd.DataFrame({\"Date\": [\"16/10/2022\", \"17/10/2022\", \"18/10/2022\", \"19/10/2022\"],\n ...
2022/10/20
[ "https://Stackoverflow.com/questions/74135650", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20288547/" ]
74,135,753
<p>As you all aware that MS Office 365 changed from Basic Auth to Modern Authentication recently, so it blocks all access from protocols such as IMAP/POP/SMTP. In that case we have to use Access token (OAUTH 2.0) generated from MS API by passing the client/secret, username , password &amp; scope.</p> <p>Currently, I'm able to get the access token for users who do not use MFA(able to access user mailboxes with IMAP protocol), but for the users who uses MFA, we have the app password for them. For mfa users, I'm passing their app password(in the password field) to get the access token, but I'm getting the following error</p> <pre><code>&quot;error&quot;: &quot;invalid_grant&quot;, &quot;error_description&quot;: &quot;AADSTS50126: Error validating credentials due to invalid username or password.&quot;, &quot;error_codes&quot;: [ 50126 ], </code></pre> <p>grant type I'm using for this request is &quot;password&quot;. Any suggestion how to resolve this issue? Do I delegate any API permissions in azure ad application side? I have currently enabled IMAP accessforALL for my usage.</p> <p>Please help.. Thanks in advance</p>
[ { "answer_id": 74135766, "author": "T C Molenaar", "author_id": 8814131, "author_profile": "https://Stackoverflow.com/users/8814131", "pm_score": 1, "selected": false, "text": "df = pd.DataFrame({\"Date\": [\"16/10/2022\", \"17/10/2022\", \"18/10/2022\", \"19/10/2022\"],\n ...
2022/10/20
[ "https://Stackoverflow.com/questions/74135753", "https://Stackoverflow.com", "https://Stackoverflow.com/users/851680/" ]
74,135,782
<p><strong>OS</strong>: Ubuntu 20.04 LTS, x86 64</p> <p>After I rebooted my system with a kubernetes cluster, all the deployments, pods and everything else stoped wokring. How do I diagnose what the problem here is?</p> <p>The response to the command <code>sudo kubectl get status</code> is: <code>The connection to the server localhost:8080 was refused - did you specify the right host or port?</code>.</p> <p><strong>EDIT</strong>:</p> <p>The output of <code>cat ~.kube/config</code>:</p> <pre><code>clusters: - cluster: certificate-authority-data: xxx server: https://xxx:6443 name: kubernetes contexts: - context: cluster: kubernetes user: kubernetes-admin name: kubernetes-admin@kubernetes current-context: kubernetes-admin@kubernetes kind: Config preferences: {} users: - name: kubernetes-admin user: client-certificate-data: xxx client-key-data: xxx </code></pre> <p>Output of <code>sudo systemctl status kubelet</code>:</p> <pre><code>2042 kuberuntime_manager.go:815] &quot;CreatePodSandbox for pod failed&quot; err=&quot;rpc error: code = Unknown desc = failed to setup network for sandbox&gt; Oct 20 15:30:16 xxx kubelet[2042]: E1020 15:30:16.872177 2042 pod_workers.go:951] &quot;Error syncing pod, skipping&quot; err=&quot;failed to \&quot;CreatePodSandbox\&quot; for \&quot;coredns-6d4b75cb6d-hk8sz_kube-system(3a7dc6&gt; Oct 20 15:30:26 xxx kubelet[2042]: E1020 15:30:26.870800 2042 remote_runtime.go:201] &quot;RunPodSandbox from runtime service failed&quot; err=&quot;rpc error: code = Unknown desc = failed to setup network for sa&gt; Oct 20 15:30:26 xxx kubelet[2042]: E1020 15:30:26.870917 2042 kuberuntime_sandbox.go:70] &quot;Failed to create sandbox for pod&quot; err=&quot;rpc error: code = Unknown desc = failed to setup network for sandbox&gt; Oct 20 15:30:26 xxx kubelet[2042]: E1020 15:30:26.870977 2042 kuberuntime_manager.go:815] &quot;CreatePodSandbox for pod failed&quot; err=&quot;rpc error: code = Unknown desc = failed to setup network for sandbox&gt; Oct 20 15:30:26 xxx kubelet[2042]: E1020 15:30:26.871089 2042 pod_workers.go:951] &quot;Error syncing pod, skipping&quot; err=&quot;failed to \&quot;CreatePodSandbox\&quot; for \&quot;coredns-6d4b75cb6d-hxqws_kube-system(3579f3&gt; Oct 20 15:30:29 xxx kubelet[2042]: E1020 15:30:29.873159 2042 remote_runtime.go:201] &quot;RunPodSandbox from runtime service failed&quot; err=&quot;rpc error: code = Unknown desc = failed to setup network for sa&gt; Oct 20 15:30:29 xxx kubelet[2042]: E1020 15:30:29.873268 2042 kuberuntime_sandbox.go:70] &quot;Failed to create sandbox for pod&quot; err=&quot;rpc error: code = Unknown desc = failed to setup network for sandbox&gt; Oct 20 15:30:29 xxx kubelet[2042]: E1020 15:30:29.873319 2042 kuberuntime_manager.go:815] &quot;CreatePodSandbox for pod failed&quot; err=&quot;rpc error: code = Unknown desc = failed to setup network for sandbox&gt; Oct 20 15:30:29 xxx kubelet[2042]: E1020 15:30:29.873415 2042 pod_workers.go:951] &quot;Error syncing pod, skipping&quot; err=&quot;failed to \&quot;CreatePodSandbox\&quot; for \&quot;coredns-6d4b75cb6d-hk8sz_kube-system(3a7dc6&gt; </code></pre> <p>output of <code>kubectl get nodes</code>:</p> <pre><code>NAME STATUS ROLES AGE VERSION xxx Ready control-plane 6d v1.24.3 </code></pre> <p>output of <code>sudo ~/.kube/config</code>:</p> <pre><code>/home/xxx/.kube/config: 1: apiVersion:: not found /home/xxx/.kube/config: 2: clusters:: not found /home/xxx/.kube/config: 3: -: not found /home/xxx/.kube/config: 4: certificate-authority-data:: not found /home/xxx/.kube/config: 5: server:: not found /home/xxx/.kube/config: 6: name:: not found /home/xxx/.kube/config: 7: contexts:: not found /home/xxx/.kube/config: 8: -: not found /home/xxx/.kube/config: 9: cluster:: not found /home/xxx/.kube/config: 10: user:: not found /home/xxx/.kube/config: 11: name:: not found /home/xxx/.kube/config: 12: current-context:: not found /home/xxx/.kube/config: 13: kind:: not found /home/xxx/.kube/config: 14: preferences:: not found /home/xxx/.kube/config: 15: users:: not found /home/xxx/.kube/config: 16: -: not found /home/xxx/.kube/config: 17: user:: not found /home/xxx/.kube/config: 18: client-certificate-data:: not found /home/xxx/.kube/config: 19: client-key-data:: not found </code></pre>
[ { "answer_id": 74136450, "author": "Gaurav Khairnar", "author_id": 10730731, "author_profile": "https://Stackoverflow.com/users/10730731", "pm_score": -1, "selected": false, "text": "sudo chmod -R 777 ~/.kube\n" }, { "answer_id": 74137677, "author": "Ali", "author_id": 15...
2022/10/20
[ "https://Stackoverflow.com/questions/74135782", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20289089/" ]
74,135,819
<p>I have three tables which look like this (simplified)</p> <p>&quot;plants&quot; Table</p> <pre><code>ID (PK, AI) | botanicalName | quickCode 1 | Monstera adansonii | 1234567 2 | Aloe Vera | 1233456 </code></pre> <p>&quot;commonNames&quot; Table</p> <pre><code>ID (PK, AI) | plantsID | commonName 1 | 1 | Swiss Cheese Vine 2 | 2 | Cape Fern 3 | 1 | Hurricane Plant </code></pre> <p>&quot;images&quot; Table</p> <pre><code>ID (PK, AI) | plantsID | fileName 1 | 1 | monstera_adansonii.jpg 2 | 2 | capefern.jpg 3 | 2 | capefern2.jpg </code></pre> <p>In &quot;commonNames&quot; and &quot;images&quot; tables the &quot;plantsID&quot; columns are references to the ID in &quot;plants&quot; table.</p> <p>How could I write my MySQL Select and php to format a result like this:</p> <pre><code> array ( id =&gt; 1, //plants.id botanicalName =&gt; Monstera adansonii, //plants.botanicalName commonNames =&gt; array ( 0 =&gt; Swiss Cheese Vine, 1 =&gt; Hurricane Plant ), //commonNames.commonName (array) fileName =&gt; array ( 0 =&gt; monstera_adansonii.jpg ) //images.fileName (array), ) </code></pre>
[ { "answer_id": 74138777, "author": "f.nics", "author_id": 20290448, "author_profile": "https://Stackoverflow.com/users/20290448", "pm_score": 1, "selected": false, "text": "commonNames" }, { "answer_id": 74139096, "author": "Soriyyx", "author_id": 1339133, "author_pro...
2022/10/20
[ "https://Stackoverflow.com/questions/74135819", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1196198/" ]
74,135,827
<p>I am learning ReactJs and I am trying to implement below react classs based component into functional component but I am having difficulties in it. When I implement this into functional component it does not updates the webpage.</p> <p>I have imported DISHES an object from where I gets the data. I am trying to set state using functional component</p> <p>Below I have attached some code which I tried to use to set state</p> <pre><code> class Main extends Component { constructor(props) { super(props); this.state = { dishes: DISHES, selectedDish: null, }; } onDishSelect(dishId) { this.setState({ selectedDish: dishId }); } render() { return ( &lt;div&gt; &lt;Navbar dark color=&quot;primary&quot;&gt; &lt;NavbarBrand href=&quot;./&quot; className=&quot;mx-5&quot;&gt; Ristorante De Confusion &lt;/NavbarBrand&gt; &lt;/Navbar&gt; &lt;Menu dishes={this.state.dishes} onClick={(dishId) =&gt; this.onDishSelect(dishId)} /&gt; &lt;Dishdetail dish={this.state.dishes.filter((dish) =&gt; dish.id === this.state.selectedDish)[0]} /&gt; &lt;/div&gt; ); } } export default Main; </code></pre> <p>This is I am trying to convert</p> <pre><code>import React, { useState } from &quot;react&quot;; import { Navbar, NavbarBrand } from &quot;reactstrap&quot;; import Menu from &quot;./Menu&quot;; import Dishdetail from &quot;./Dishdetail&quot;; import { DISHES } from &quot;../shared/dishes&quot;; function Main() { const [dishes] = useState({ DISHES }); const [selectedDish, updatedDish] = useState(null); function onDishSelect(dishId) { return updatedDish((selectedDish) =&gt; ({ ...selectedDish, selectedDish: dishId, })); } return ( &lt;div&gt; &lt;Navbar dark color=&quot;primary&quot;&gt; &lt;NavbarBrand href=&quot;./&quot; className=&quot;mx-5&quot;&gt; Ristorante De Confusion &lt;/NavbarBrand&gt; &lt;/Navbar&gt; &lt;Menu dishes={dishes} onClick={(dishId) =&gt; onDishSelect(dishId)} /&gt; &lt;Dishdetail dish={dishes.filter((dish) =&gt; dish.id === selectedDish)[0]} /&gt; &lt;/div&gt; ); } export default Main; </code></pre>
[ { "answer_id": 74135955, "author": "no_modules", "author_id": 19835828, "author_profile": "https://Stackoverflow.com/users/19835828", "pm_score": 0, "selected": false, "text": "useState" }, { "answer_id": 74135963, "author": "KcH", "author_id": 11737596, "author_profi...
2022/10/20
[ "https://Stackoverflow.com/questions/74135827", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20150032/" ]
74,135,889
<p>I am trying to setup a master-slave environment to perform distributed testing in JMeter, But even after setting up all the things, i am unable to do so.</p> <p>Below configurations i already setup:</p> <ol> <li><p>Firewall is disable.</p> </li> <li><p>RMI keystore is generated from master machine and the created &quot;jks&quot; file has been pasted to all slave machine. Also for alternative solution, i marked &quot;server.rmi.ssl.disable&quot; as &quot;true&quot; in &quot;user.properties&quot; fike.</p> </li> <li><p>I also setup a server port in &quot;jmeter.properties&quot; file with slave ip addresses as well.</p> </li> </ol> <p><a href="https://i.stack.imgur.com/2X0TI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2X0TI.png" alt="enter image description here" /></a></p> <p>but after doing all the above listed things, i am getting error as &quot;Connection timed out&quot; and &quot;Connection Refused to host&quot;.</p> <p>can anyone please help me to overcome the problem ? thanks in advance.</p>
[ { "answer_id": 74135955, "author": "no_modules", "author_id": 19835828, "author_profile": "https://Stackoverflow.com/users/19835828", "pm_score": 0, "selected": false, "text": "useState" }, { "answer_id": 74135963, "author": "KcH", "author_id": 11737596, "author_profi...
2022/10/20
[ "https://Stackoverflow.com/questions/74135889", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12261541/" ]
74,135,891
<p>I'm trying to clear the pointLoads variable first and then add a new array to it inside the useEffect. only the counter works inside useEffect. What am I doing wrong? Here is my code.</p> <pre><code>import React, { useState, useEffect } from 'react'; const TEST = () =&gt; { const pointLoads = []; pointLoads.push([5, 0, -10], [22, 10, -200]) const [formData, setFormData] = useState({ &quot;A&quot;: &quot;9 &quot;, &quot;B&quot;: &quot;19 &quot;, &quot;C&quot;: &quot;9876 &quot; }); useEffect(() =&gt; { pointLoads.length = 0; pointLoads.push([formData.A, formData.B, formData.C]) }, []); return ( &lt;div className=&quot;App&quot;&gt; {pointLoads.length} &lt;br /&gt; {pointLoads} &lt;/div&gt; ) } export default TEST; </code></pre>
[ { "answer_id": 74136049, "author": "S.Marx", "author_id": 11095009, "author_profile": "https://Stackoverflow.com/users/11095009", "pm_score": 1, "selected": false, "text": "useState" } ]
2022/10/20
[ "https://Stackoverflow.com/questions/74135891", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20238848/" ]
74,135,901
<p>This line of code is no working, and I cannot for the life of me figure out what is wrong with it.</p> <p>INSERT INTO teacher (email,password,admin) VALUES (deborah68@example.org,d%6AsQPq7y,1);</p> <p>this wont run and says the error is near the end of the line any help is appreciated, the schema is called at3</p>
[ { "answer_id": 74136049, "author": "S.Marx", "author_id": 11095009, "author_profile": "https://Stackoverflow.com/users/11095009", "pm_score": 1, "selected": false, "text": "useState" } ]
2022/10/20
[ "https://Stackoverflow.com/questions/74135901", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15319398/" ]
74,135,937
<p>I have some data like this,</p> <pre><code>menu_list = [ {'name':'ABC','parent_id':None,'id':5}, {'name':'XYZ','parent_id':5,'id':7}, {'name':'APPLE','parent_id':7,'id':8}, {'name':'Mango','parent_id':5,'id':9}, {'name':'Mango-small','parent_id':9,'id':10}, ] </code></pre> <p>i was expecting the final group by result like,</p> <pre><code>ABC ----XYZ -------- APPLE ----Mango ----Mango SMALL </code></pre> <p>The final output as a dictionary.</p> <p>I have used collection module of Python, and defaultdict() method. but this do the task only for first level group. But i need the nested and outer both as well. If any suggestion that would be great help. Thanks.</p>
[ { "answer_id": 74136074, "author": "Dmitriy Neledva", "author_id": 16786350, "author_profile": "https://Stackoverflow.com/users/16786350", "pm_score": 2, "selected": false, "text": "menu_list = [\n\n {'name':'ABC','parent_id':None,'id':5},\n {'name':'XYZ','parent_id':5,'id':7},\n {...
2022/10/20
[ "https://Stackoverflow.com/questions/74135937", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13181402/" ]
74,135,941
<p>I have the following data frame:</p> <pre><code>library(tidyverse) dat &lt;- structure(list(res = c(&quot;A&quot;, &quot;R&quot;, &quot;D&quot;, &quot;H&quot;, &quot;I&quot;, &quot;L&quot;, &quot;K&quot;, &quot;F&quot;, &quot;T&quot;, &quot;V&quot;), nof_res = structure(c(1L, 3L, 3L, 4L, 1L, 1L, 4L, 1L, 1L, 1L), .Dim = 10L, .Dimnames = structure(list(NULL), .Names = &quot;&quot;), class = &quot;table&quot;)), class = c(&quot;tbl_df&quot;, &quot;tbl&quot;, &quot;data.frame&quot;), row.names = c(NA, -10L)) </code></pre> <p>It looks like this:</p> <pre><code> res nof_res &lt;chr&gt; &lt;table&gt; 1 A 1 2 R 3 3 D 3 4 H 4 5 I 1 6 L 1 7 K 4 8 F 1 9 T 1 10 V 1 </code></pre> <p>I'd like to fill the res column of that data frame with this vector, and fill the missing value with 0.</p> <pre><code> full_aa &lt;- c(&quot;A&quot;, &quot;R&quot;, &quot;N&quot;, &quot;D&quot;, &quot;C&quot;, &quot;E&quot;, &quot;Q&quot;, &quot;G&quot;, &quot;H&quot;, &quot;I&quot;, &quot;L&quot;, &quot;K&quot;, &quot;M&quot;, &quot;F&quot;, &quot;P&quot;, &quot;S&quot;, &quot;T&quot;, &quot;W&quot;, &quot;Y&quot;, &quot;V&quot;) </code></pre> <p>The final desired result is this:</p> <pre><code>=== ======= res nof_res === ======= A 1 R 3 N 0 D 3 C 0 E 0 Q 0 G 0 H 4 I 1 L 1 K 4 M 0 F 1 P 0 S 0 T 1 W 0 Y 0 V 1 === ======= </code></pre> <p>So the final column length must be the same as <code>length(full_aa)</code> which is 20. How can I achieve that?</p>
[ { "answer_id": 74136022, "author": "r.user.05apr", "author_id": 6162011, "author_profile": "https://Stackoverflow.com/users/6162011", "pm_score": 1, "selected": false, "text": "enframe" }, { "answer_id": 74136032, "author": "Maël", "author_id": 13460602, "author_profi...
2022/10/20
[ "https://Stackoverflow.com/questions/74135941", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8391698/" ]
74,136,005
<p>Virtual Host not working</p> <p>i created a virtual host in nginx ubuntu for example.com but when i go to example.com it shows the original example.com</p> <p>This a virtual host file <code>/etc/nginx/sites-enabled/example.com</code></p> <pre><code>server { listen 80; listen [::]:80; server_name example.com; root /var/www/example.com; index index.html; location / { try_files $uri $uri/ =404; } } </code></pre> <p>This is nginx.conf</p> <pre><code>user www-data; worker_processes auto; pid /run/nginx.pid; include /etc/nginx/modules-enabled/*.conf; events { worker_connections 768; # multi_accept on; } http { ## # Basic Settings ## sendfile on; tcp_nopush on; types_hash_max_size 2048; # server_tokens off; # server_names_hash_bucket_size 64; # server_name_in_redirect off; include /etc/nginx/mime.types; default_type application/octet-stream; ## # SSL Settings ## ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE ssl_prefer_server_ciphers on; ## # Logging Settings ## access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; ## # Gzip Settings ## gzip on; # gzip_vary on; # gzip_proxied any; # gzip_comp_level 6; # gzip_buffers 16 8k; # gzip_http_version 1.1; # gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript; ## # Virtual Host Configs ## include /etc/nginx/conf.d/*.conf; include /etc/nginx/sites-enabled/*; } #mail { # # See sample authentication script at: # # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript # # # auth_http localhost/auth.php; # # pop3_capabilities &quot;TOP&quot; &quot;USER&quot;; # # imap_capabilities &quot;IMAP4rev1&quot; &quot;UIDPLUS&quot;; # # server { # listen localhost:110; # protocol pop3; # proxy on; # } # # server { # listen localhost:143; # protocol imap; # proxy on; # } #} </code></pre> <p><strong>nginx version: nginx/1.18.0 (Ubuntu)</strong></p> <p><strong>Ubuntu version</strong></p> <pre><code>No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 22.04.1 LTS Release: 22.04 Codename: jammy </code></pre>
[ { "answer_id": 74136022, "author": "r.user.05apr", "author_id": 6162011, "author_profile": "https://Stackoverflow.com/users/6162011", "pm_score": 1, "selected": false, "text": "enframe" }, { "answer_id": 74136032, "author": "Maël", "author_id": 13460602, "author_profi...
2022/10/20
[ "https://Stackoverflow.com/questions/74136005", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7043908/" ]
74,136,033
<p>I am using plesk for my server management. Yesterday server restarted automatically due to some updated . When my server turned on , it stops to process laravel queues . I run this command on my Laravel-project-root-directory to restart queues manually. command : <code>nohup php artisan queue:work --daemon &amp;</code> Can i found a way to automatically run this command on my server on server restart. I am new to plesk &amp; laravel queues.</p>
[ { "answer_id": 74136022, "author": "r.user.05apr", "author_id": 6162011, "author_profile": "https://Stackoverflow.com/users/6162011", "pm_score": 1, "selected": false, "text": "enframe" }, { "answer_id": 74136032, "author": "Maël", "author_id": 13460602, "author_profi...
2022/10/20
[ "https://Stackoverflow.com/questions/74136033", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20127199/" ]
74,136,065
<p>Here is my code:</p> <pre><code> response.data.data.map((item, index) =&gt; { console.log('response',item); const itemIndex = dataList.findIndex(v =&gt; v.dt3 === item.dt3); if (itemIndex &gt; -1) { //update quantity in list if same item is selected more than one time const value = { ds: item.ds, bl: item.bl, mty: item.od_auto.Mty, name: item.customer_name_auto, }; dataList.push(value); } else { const value = { ds: item.ds, bl: item.bl, mty: item.od_auto.Mty, name: item.customer_name_auto, }; dataList.push(item.dt3); for(let i = 0; i&lt;dataList.length; i++){ dataList[i] = value; } } }); </code></pre> <p>Expected output:</p> <pre><code> const DATA = [ { title: '4th April, 2020', data: [ { ds: item.ds, bl: item.bl, mty: item.od_auto.Mty, name: item.customer_name_auto, },{ ds: item.ds, bl: item.bl, mty: item.od_auto.Mty, name: item.customer_name_auto, } ], }, { title: '3rd April, 2020', data: [ { ds: item.ds, bl: item.bl, mty: item.od_auto.Mty, name: item.customer_name_auto, },{ ds: item.ds, bl: item.bl, mty: item.od_auto.Mty, name: item.customer_name_auto, } ], }, { title: '2nd April, 2020', data: [ { ds: item.ds, bl: item.bl, mty: item.od_auto.Mty, name: item.customer_name_auto, },{ ds: item.ds, bl: item.bl, mty: item.od_auto.Mty, name: item.customer_name_auto, } ], }, { title: '1st April, 2020', data: [ { ds: item.ds, bl: item.bl, mty: item.od_auto.Mty, name: item.customer_name_auto, },{ ds: item.ds, bl: item.bl, mty: item.od_auto.Mty, name: item.customer_name_auto, } ], }, ]; </code></pre> <p>This is how my API response looks:</p> <pre><code>{ &quot;status&quot;: 1, &quot;data&quot;: [ { &quot;aid&quot;: 188427, &quot;s&quot;: 1, &quot;dt&quot;: &quot;19th Oct 2022&quot;, &quot;dt3&quot;: &quot;19-10-2022&quot;, &quot;ds&quot;: &quot;Proceeds&quot;, &quot;cr&quot;: 172, &quot;bk&quot;: &quot;sdlsjkfhjdfhgf&quot;, &quot;bkid&quot;: 1, &quot;up&quot;: &quot;&quot;, &quot;od&quot;: { &quot;Mty&quot;: &quot;&quot;, &quot;Mre&quot;: &quot;&quot;, &quot;Mct&quot;: &quot;&quot;, &quot;Mci&quot;: &quot;&quot;, &quot;Mdt&quot;: &quot;&quot;, &quot;Mdi&quot;: &quot;&quot; }, &quot;typ&quot;: &quot;&quot;, &quot;cnm&quot;: &quot;&quot;, &quot;tm&quot;: &quot;19th Oct 2022 19:31&quot;, &quot;bl&quot;: &quot;224&quot;, &quot;od_auto&quot;: { &quot;Mty&quot;: &quot;Services&quot;, &quot;Mci&quot;: 77, &quot;Mct&quot;: 2, &quot;Mre&quot;: &quot;&quot;, &quot;Mdt&quot;: &quot;&quot;, &quot;Mdi&quot;: &quot;&quot; }, &quot;customer_name_auto&quot;: null }, { &quot;aid&quot;: 188426, &quot;s&quot;: 2, &quot;dt&quot;: &quot;19th Oct 2022&quot;, &quot;dt3&quot;: &quot;19-10-2022&quot;, &quot;ds&quot;: &quot;cslkdjfhsjkdfhjshfjs&quot;, &quot;cr&quot;: 1.01, &quot;bk&quot;: &quot;slkdjfhsjkdfhljdfh&quot;, &quot;bkid&quot;: 397, &quot;up&quot;: &quot;&quot;, &quot;od&quot;: { &quot;Mty&quot;: &quot;&quot;, &quot;Mre&quot;: &quot;&quot;, &quot;Mct&quot;: &quot;&quot;, &quot;Mci&quot;: &quot;&quot;, &quot;Mdt&quot;: &quot;&quot;, &quot;Mdi&quot;: &quot;&quot; }, &quot;typ&quot;: &quot;&quot;, &quot;cnm&quot;: &quot;&quot;, &quot;tm&quot;: &quot;19th Oct 2022 18:07&quot;, &quot;bl&quot;: &quot;2487.22&quot;, &quot;od_auto&quot;: { &quot;Mty&quot;: &quot;djfdfhghgh&quot;, &quot;Mci&quot;: 181, &quot;Mct&quot;: 1, &quot;Mre&quot;: &quot;&quot;, &quot;Mdt&quot;: &quot;&quot;, &quot;Mdi&quot;: &quot;&quot; }, &quot;customer_name_auto&quot;: &quot;skdhfshdghsd&quot; }, ]} </code></pre> <p>I am fetching the response from API to create Inverted flatlist. In my response array I have date object for each item in the array. Now I want to group the items which has same date in an array. How can I arrange the array items?</p>
[ { "answer_id": 74136158, "author": "Engr.Aftab Ufaq", "author_id": 9570734, "author_profile": "https://Stackoverflow.com/users/9570734", "pm_score": 2, "selected": true, "text": "const data_array = {\n \"status\": 1,\n \"data\": [\n {\n \"aid\": 188427,\n ...
2022/10/20
[ "https://Stackoverflow.com/questions/74136065", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8281996/" ]
74,136,079
<p>I want to implement face authentication and TouchID (finger) in react native for both platform android and ios. I've implemented IOS side face authentication and TouchId authentication. I am using react-native-touch-id library</p> <p>In android when i detect face id and try to authenticate with face but it takes finger instead of face.</p> <p>How can i Implemented Both face and Touch id in android side for React-native app?</p>
[ { "answer_id": 74136158, "author": "Engr.Aftab Ufaq", "author_id": 9570734, "author_profile": "https://Stackoverflow.com/users/9570734", "pm_score": 2, "selected": true, "text": "const data_array = {\n \"status\": 1,\n \"data\": [\n {\n \"aid\": 188427,\n ...
2022/10/20
[ "https://Stackoverflow.com/questions/74136079", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20289252/" ]
74,136,084
<p>i have in table one column in integer. This integer looks like:</p> <p><code>2204010044</code> - it is <code>YYMMDDHH24MI</code>.</p> <p>I want this column in sql query convert to date. But when i try, i get error: <code>ORA-01840</code>. I testing this: <code>TO_DATE(&quot;mycolumn&quot;,'yymmddhh24mi')</code> I've tried multiple options, but always to no avail.</p> <p><code>NLS_DATE_FORMAT</code> is for database: <code>DD.MM.YY</code> (i dont know,if its relevant)</p>
[ { "answer_id": 74136158, "author": "Engr.Aftab Ufaq", "author_id": 9570734, "author_profile": "https://Stackoverflow.com/users/9570734", "pm_score": 2, "selected": true, "text": "const data_array = {\n \"status\": 1,\n \"data\": [\n {\n \"aid\": 188427,\n ...
2022/10/20
[ "https://Stackoverflow.com/questions/74136084", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14020570/" ]
74,136,103
<p>I have an array that I am iterating over with forEach and I need to add what is output to the console in html using template strings. How can i do this?</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>const postCategories = arr[index].category; const postCategory = postCategories.forEach(category =&gt; { console.log(category.name); }); const article = `&lt;article class="news"&gt; &lt;div class="news-taxonomy"&gt; &lt;span&gt;//Here I need to enter the name of the category&lt;/span&gt; &lt;/div&gt; &lt;/article&gt;`;</code></pre> </div> </div> </p>
[ { "answer_id": 74136158, "author": "Engr.Aftab Ufaq", "author_id": 9570734, "author_profile": "https://Stackoverflow.com/users/9570734", "pm_score": 2, "selected": true, "text": "const data_array = {\n \"status\": 1,\n \"data\": [\n {\n \"aid\": 188427,\n ...
2022/10/20
[ "https://Stackoverflow.com/questions/74136103", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20135524/" ]
74,136,111
<p>I'm having a problem where variables are in curly brace.I am trying to perform a variable substitution within curly braces which I understand is not feasible directly in TCL.But if there are other methods to resolve this? because I see the samiliar question in website that the answer is use list [] and others. But I want to countinue use curly brace, could someone can help me to resolve the question?</p> <pre><code>set top_design a puts $top_design puts {aaa %top_design} </code></pre> <p>output :</p> <pre><code> a aaa %top_design </code></pre> <p>so how to display the subtitute of top_design in second puts.</p>
[ { "answer_id": 74136767, "author": "Krzysztof Jurga", "author_id": 16261637, "author_profile": "https://Stackoverflow.com/users/16261637", "pm_score": 0, "selected": false, "text": "set v1 aaa\nset v2 bbb\nset vres1 {$v1 $v2}\nset vres2 \"\\{$v1 $v2\\}\"\nset vres3 \"\\{\\$v1 \\$v2\\}\...
2022/10/20
[ "https://Stackoverflow.com/questions/74136111", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19867533/" ]
74,136,140
<p>I have 100,000 XML files that look like this</p> <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; standalone=&quot;no&quot;?&gt; &lt;reiXml&gt; &lt;program&gt;BB&lt;/program&gt; &lt;nazivStavbe&gt;Test build&lt;/nazivStavbe&gt; &lt;X&gt;101000&lt;/X&gt; &lt;Y&gt;462000&lt;/Y&gt; &lt;QNH&gt;24788&lt;/QNH&gt; &lt;QNC&gt;9698&lt;/QNC&gt; &lt;Qf&gt;255340&lt;/Qf&gt; &lt;Qp&gt;597451&lt;/Qp&gt; &lt;CO2&gt;126660&lt;/CO2&gt; &lt;An&gt;1010.7&lt;/An&gt; &lt;Vc&gt;3980&lt;/Vc&gt; &lt;A&gt;2362.8&lt;/A&gt; &lt;Ht&gt;0.336&lt;/Ht&gt; &lt;f0&gt;0.59&lt;/f0&gt; ... &lt;/reiXml&gt; </code></pre> <p>I want to extract around 10 numbers from each, e.g. An, Vc... but i have a problem since the XML files doesn't have a root name. I looked up to other cases on this forum, but I can't seem to replicate their solutions (e.g. <a href="https://stackoverflow.com/questions/23891295/python-xml-parsing-without-root">link</a>).</p> <p>So I have basically 2 problems: 1) how to read multiple XML files and 2) extract certain values from it... and put that in 1 txt file with 100,000 rows :(</p> <p>The final result would be something like:</p> <pre><code> An Vc XMLfile1 1010.7 3980 XMLfile2 ... ... XMLfile3 ... ... </code></pre>
[ { "answer_id": 74136951, "author": "Andrej Kesely", "author_id": 10035985, "author_profile": "https://Stackoverflow.com/users/10035985", "pm_score": 2, "selected": true, "text": "beautifulsoup" }, { "answer_id": 74139850, "author": "energyMax", "author_id": 3579151, "...
2022/10/20
[ "https://Stackoverflow.com/questions/74136140", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3579151/" ]
74,136,154
<p>I have app for working with database that uses psycopg2. When I try to insert a column with repeating name I got this error:</p> <pre><code>&gt; self.cursor.execute(str(query)) E psycopg2.errors.UniqueViolation: duplicate key value violates unique constraint &quot;deposits_area_name_key&quot; E DETAIL: Key (area_name)=(test-name) already exists. dbase-api-server/dbase_api_server/dbase.py:110: UniqueViolation </code></pre> <p>I use try-except block to catch it and it work. But exception doesn't raise when I run pytests.</p> <pre><code>import logging from psycopg2 import connect as connect_to_db from psycopg2._psycopg import connection as postgres_connection from psycopg2._psycopg import cursor as db_cursor from psycopg2.errors import UniqueViolation from pypika import Query, Table from dbase_api_server.containers import PostgresConnectionParams class StorageDBase: def __init__(self, params: PostgresConnectionParams): try: self.__connection = connect_to_db( host=params.host, port=params.port, user=params.user, password=params.password, database=params.database ) except OperationalError as err: logging.error(err, 'problems with database operation') raise @property def connection(self) -&gt; postgres_connection: return self.__connection @property def cursor(self) -&gt; db_cursor: return self.__connection.cursor() def is_success_commit(self) -&gt; bool: self.connection.commit() def add_deposit_info(self, area_name: str) -&gt; bool: table = Table('deposits') query = str(Query.into(table).columns('area_name').insert(area_name)) try: self.cursor.execute(query) return self.is_success_commit() except UniqueViolation as error: logging.error( error, f'deposit with name {area_name} already exists' ) return False </code></pre> <p>Test:</p> <pre><code>from hamcrest import assert_that, equal_to, is_ from dbase_api_server.dbase import StorageDBase class TestStorageDBase: def test_add_deposit_repeating_name(self, up_test_dbase): area_name = 'test-name' is_first_added = up_test_dbase.add_deposit_info(area_name) assert_that(actual_or_assertion=is_first_added, matcher=is_(True)) is_second_added = up_test_dbase.add_deposit_info(area_name) assert_that(actual_or_assertion=is_second_added, matcher=is_(False)) query_count = f'SELECT COUNT(1) FROM deposits WHERE area_name=\'{area_name}\'' cursor = up_test_dbase.cursor cursor.execute(query_count) records_count = cursor.fetchone()[0] assert_that(actual_or_assertion=records_count, matcher=equal_to(1)) self.remove_records_from_deposits(dbase_adapter=up_test_dbase) </code></pre> <p>There was a similar question <a href="https://stackoverflow.com/questions/58740043/how-do-i-catch-a-psycopg2-errors-uniqueviolation-error-in-a-python-flask-app">here</a>, but this solutions doesn't help to solve problem.</p> <p>How I can catch this error?</p>
[ { "answer_id": 74136951, "author": "Andrej Kesely", "author_id": 10035985, "author_profile": "https://Stackoverflow.com/users/10035985", "pm_score": 2, "selected": true, "text": "beautifulsoup" }, { "answer_id": 74139850, "author": "energyMax", "author_id": 3579151, "...
2022/10/20
[ "https://Stackoverflow.com/questions/74136154", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20289070/" ]
74,136,172
<p>I have no previous experience with C# and .NET so I'm following <a href="https://learn.microsoft.com/en-us/aspnet/web-pages/overview/ui-layouts-and-themes/4-working-with-forms" rel="nofollow noreferrer">this</a> tutorial to create an HTML form for some practice. It says on the page, <em>At the top of the Form.cshtml file, enter the following code:</em></p> <pre><code>@{ if (IsPost) { string companyname = Request.Form[&quot;companyname&quot;]; string contactname = Request.Form[&quot;contactname&quot;]; int employeecount = Request.Form[&quot;employees&quot;].AsInt(); &lt;text&gt; You entered: &lt;br /&gt; Company Name: @companyname &lt;br /&gt; Contact Name: @contactname &lt;br /&gt; Employee Count: @employeecount &lt;br /&gt; &lt;/text&gt; } } </code></pre> <p>However, no matter where I place this piece of code on the page it gives me errors on <strong>(IsPost)</strong> (CS0103), that <em>The name 'isPost' does not exist in the current context</em> and <strong>AsInt()</strong> (CS1061), <em>'StringValue' does not contain a definition for 'AsInt' and no accessible extension method 'AsInt' accepting a first argument of type 'StringValue' could be found (are you missing a using directive or an assembly reference?)..</em></p> <p>I'm not familiar with C# syntax but I thought this would be simple since it's literally like two steps in the tutorial, but somehow, I manage to fail with it anyways. I've Googled the errors and like mentioned I've tried to place the code snippet above in different places, but I have a hard time seeing still why it does not work.</p> <p>Below is the code in full. Someone with more knowledge that can see why this isn't working?</p> <pre><code>@page @model IndexModel @{ ViewData[&quot;Title&quot;] = &quot;Home page&quot;; } @{ if (IsPost) { string companyname = Request.Form[&quot;companyname&quot;]; int employeecount = Request.Form[&quot;employees&quot;].AsInt(); &lt;text&gt; You entered: &lt;br /&gt; Company Name: @companyname &lt;br /&gt; Employee Count: @employeecount &lt;br /&gt; &lt;/text&gt; } } &lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;Customer Form&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;form method=&quot;post&quot;&gt; &lt;fieldset&gt; &lt;legend&gt;Add Customer&lt;/legend&gt; &lt;div&gt; &lt;label for=&quot;CompanyName&quot;&gt;Company Name:&lt;/label&gt; &lt;input type=&quot;text&quot; name=&quot;CompanyName&quot; value=&quot;&quot; /&gt; &lt;/div&gt; &lt;div&gt; &lt;label for=&quot;Employees&quot;&gt;Employee Count:&lt;/label&gt; &lt;input type=&quot;text&quot; name=&quot;Employees&quot; value=&quot;&quot; /&gt; &lt;/div&gt; &lt;div&gt; &lt;label&gt;&amp;nbsp;&lt;/label&gt; &lt;input type=&quot;submit&quot; value=&quot;Submit&quot; class=&quot;submit&quot; /&gt; &lt;/div&gt; &lt;/fieldset&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
[ { "answer_id": 74136951, "author": "Andrej Kesely", "author_id": 10035985, "author_profile": "https://Stackoverflow.com/users/10035985", "pm_score": 2, "selected": true, "text": "beautifulsoup" }, { "answer_id": 74139850, "author": "energyMax", "author_id": 3579151, "...
2022/10/20
[ "https://Stackoverflow.com/questions/74136172", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18396907/" ]
74,136,190
<p>I have similar question as <a href="https://stackoverflow.com/questions/39800718/how-to-use-jq-to-find-all-paths-to-a-certain-key/">how-to-use-jq-to-find-all-paths-to-a-certain-key</a> and also checked the accepted answer.</p> <p>The solution described in answer works for the exactly same input as <a href="https://stackoverflow.com/questions/39800718/how-to-use-jq-to-find-all-paths-to-a-certain-key/">the ticket</a>, but after I updated the json a little bit as following (remove last foo part), I can't get any output by filter:</p> <pre><code>fromstream(tostream | select(.[0]|index(&quot;foo&quot;))) </code></pre> <p>The updated input json:</p> <pre><code>{ &quot;A&quot;: { &quot;A1&quot;: { &quot;foo&quot;: { &quot;_&quot;: &quot;_&quot; } }, &quot;A2&quot;: { &quot;_&quot;: &quot;_&quot; } }, &quot;B&quot;: { &quot;B1&quot;: {} } } </code></pre> <p>The expected output should be:</p> <pre><code>{ &quot;A&quot;: { &quot;A1&quot;: { &quot;foo&quot;: { &quot;_&quot;: &quot;_&quot; } } } } </code></pre> <p>But I got nothing. You can check here <a href="https://jqplay.org/s/s21FFUeoQz0" rel="nofollow noreferrer">https://jqplay.org/s/s21FFUeoQz0</a>.</p> <p>I've also tried the filter without <strong>fromstream</strong>:</p> <pre><code>tostream | select(.[0]|index(&quot;foo&quot;)) </code></pre> <p>The output will be as following, it seems <a href="https://jqplay.org/s/1ZVF5p6WFu_G" rel="nofollow noreferrer">work here</a>.</p> <pre><code>[[&quot;A&quot;,&quot;A1&quot;,&quot;foo&quot;,&quot;_&quot;],&quot;_&quot;] [[&quot;A&quot;,&quot;A1&quot;,&quot;foo&quot;,&quot;_&quot;]] [[&quot;A&quot;,&quot;A1&quot;,&quot;foo&quot;]] </code></pre> <p>So I suspect the <strong>fromstream</strong> has some problem. Can anyone help me figure out? Thanks!</p>
[ { "answer_id": 74136304, "author": "peak", "author_id": 997358, "author_profile": "https://Stackoverflow.com/users/997358", "pm_score": 2, "selected": true, "text": "fromstream(tostream | select(length==1 or (.[0]|index(\"foo\"))))\n" }, { "answer_id": 74136541, "author": "og...
2022/10/20
[ "https://Stackoverflow.com/questions/74136190", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6719835/" ]
74,136,208
<p>Example data:</p> <pre><code>mtcars &lt;- mtcars cols &lt;- c(&quot;cyl&quot;, &quot;vs&quot;) # I would like to create a table for each column in `columns`: for (i in seq(cols)) { print(table(mtcars$cols[i])) } # I also tried: for (i in seq(cols)) { print(table(get(paste0(&quot;mtcars$&quot;, cols[i])))) } </code></pre> <p>But this does not produce any table. How can I feed a vector of column names to the table function?</p>
[ { "answer_id": 74136304, "author": "peak", "author_id": 997358, "author_profile": "https://Stackoverflow.com/users/997358", "pm_score": 2, "selected": true, "text": "fromstream(tostream | select(length==1 or (.[0]|index(\"foo\"))))\n" }, { "answer_id": 74136541, "author": "og...
2022/10/20
[ "https://Stackoverflow.com/questions/74136208", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8071608/" ]
74,136,227
<p>I'm trying to prevent the deletion of certain entries in the inline model views with <code>flask-admin</code>:</p> <p><a href="https://i.stack.imgur.com/aB2tT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/aB2tT.png" alt="enter image description here" /></a></p> <p>The respective inline model code looks like this:</p> <pre><code>class ModelCategoryValueInline(InlineFormAdmin): form_columns = ('id', 'display_name', 'name') form_edit_columns = ('id', 'display_name') can_delete = False form_args= dict( display_name=dict(label='Display Name', validators=[DataRequired()]), name=dict(label='Technical Name', validators=[DataRequired()]), ) def on_model_delete(self, model): # Not called at all.. print('on_model_delete', model) if model.builtin == True: raise ValidationError(f'[{model}] is a build-in CategoryValue and cannot be deleted.') def on_model_change(self, form, model, is_created): # Is called, but has model already changed... - deleted models do not get this event if not is_created: if form.form.name.data != model.name: raise ValidationError(f'You cannot change the internal name of a category value!') def on_form_prefill(self, form, id): # not called att all form.name.render_kw = {'disabled': 'disabled', 'readonly': True} </code></pre> <p>I haven't figured out a way to prevent deletion of inline entries. <code>on_model_delete()</code> is not called when deleting the inline entries. <code>can_delete</code> has no effect either.</p> <p>How can I disable the deletion of inline entries?</p> <p>Ideally I want to be able to control deletion via the <code>on_model_delete()</code> method and prevent only deletion of values that match certain criteria.</p>
[ { "answer_id": 74136304, "author": "peak", "author_id": 997358, "author_profile": "https://Stackoverflow.com/users/997358", "pm_score": 2, "selected": true, "text": "fromstream(tostream | select(length==1 or (.[0]|index(\"foo\"))))\n" }, { "answer_id": 74136541, "author": "og...
2022/10/20
[ "https://Stackoverflow.com/questions/74136227", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7483494/" ]
74,136,247
<p>I have the following <code>dataframe</code>:</p> <pre><code>gp_columns = { 'name': ['companyA', 'companyB'], 'firm_ID' : [1, 2], 'timestamp_one' : ['2016-04-01', '2017-09-01'] } fund_columns = { 'firm_ID': [1, 1, 2, 2, 2], 'department_ID' : [10, 11, 20, 21, 22], 'timestamp_mult' : ['2015-01-01', '2016-03-01', '2016-10-01', '2017-02-01', '2018-11-01'], 'number' : [400, 500, 1000, 3000, 4000] } gp_df = pd.DataFrame(gp_columns) fund_df = pd.DataFrame(fund_columns) gp_df['timestamp_one'] = pd.to_datetime(gp_df['timestamp_one']) fund_df['timestamp_mult'] = pd.to_datetime(fund_df['timestamp_mult']) merged_df = gp_df.merge(fund_df) merged_df merged_df_v1 = merged_df.copy() merged_df_v1['incidence_num'] = merged_df.groupby('firm_ID')['department_ID']\ .transform('cumcount') merged_df_v1['incidence_num'] = merged_df_v1['incidence_num'] + 1 merged_df_v1['time_delta'] = merged_df_v1['timestamp_mult'] - merged_df_v1['timestamp_one'] merged_wide = pd.pivot(merged_df_v1, index = ['name','firm_ID', 'timestamp_one'], \ columns = 'incidence_num', \ values = ['department_ID', 'time_delta', 'timestamp_mult', 'number']) merged_wide.reset_index() </code></pre> <p>that looks as follows: <a href="https://i.stack.imgur.com/7Qd8S.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7Qd8S.png" alt="enter image description here" /></a></p> <p>My question is how i get a column that calculates the minimum time delta (so closest to 0). Note that the time delta can be negative or positive, so <code>.abs()</code> does not work for me here.</p> <p>I want a <code>dataframe</code> with this particular output: <a href="https://i.stack.imgur.com/djR8r.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/djR8r.png" alt="enter image description here" /></a></p>
[ { "answer_id": 74136304, "author": "peak", "author_id": 997358, "author_profile": "https://Stackoverflow.com/users/997358", "pm_score": 2, "selected": true, "text": "fromstream(tostream | select(length==1 or (.[0]|index(\"foo\"))))\n" }, { "answer_id": 74136541, "author": "og...
2022/10/20
[ "https://Stackoverflow.com/questions/74136247", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13936100/" ]
74,136,274
<p>Currently I have my parent components handling all my Axios calls, and I'll pass that data down with props. Should my child components be handling those requests individually in each child component, what is the best practice?</p>
[ { "answer_id": 74136304, "author": "peak", "author_id": 997358, "author_profile": "https://Stackoverflow.com/users/997358", "pm_score": 2, "selected": true, "text": "fromstream(tostream | select(length==1 or (.[0]|index(\"foo\"))))\n" }, { "answer_id": 74136541, "author": "og...
2022/10/20
[ "https://Stackoverflow.com/questions/74136274", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13731361/" ]
74,136,281
<p>In the dataframe absolute values and percentages are combined, and I want to split them into 2 separated columns:</p> <pre><code>df &lt;- data.frame (Sales = c(&quot;74(2.08%)&quot;, &quot;71(2.00%)&quot;, &quot;58(1.63%)&quot;, &quot;42(1.18%)&quot;)) Sales 1 74(2.08%) 2 71(2.00%) 3 58(1.63%) 4 42(1.18%) </code></pre> <p>Expected output</p> <pre><code> Sales Share 1 74 2.08 2 71 2.00 3 58 1.63 4 42 1.18 </code></pre>
[ { "answer_id": 74136304, "author": "peak", "author_id": 997358, "author_profile": "https://Stackoverflow.com/users/997358", "pm_score": 2, "selected": true, "text": "fromstream(tostream | select(length==1 or (.[0]|index(\"foo\"))))\n" }, { "answer_id": 74136541, "author": "og...
2022/10/20
[ "https://Stackoverflow.com/questions/74136281", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20181941/" ]
74,136,284
<p>Raw query insertion is working fine with hard codded values but I need to populate submitted form values in ExecuteSqlRaw() method.</p> <pre><code> _context .Database .ExecuteSqlRaw(&quot;INSERT INTO Staff([StaffFirstName],[StaffLastName],[StaffPhoto], [StaffDesignation],[StaffDepartment],[StaffBio]) VALUES('1','2','3' ...)&quot;); </code></pre> <p>I tried interpolation syntax, but not working <a href="https://i.stack.imgur.com/3G2Gn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3G2Gn.png" alt="enter image description here" /></a></p>
[ { "answer_id": 74148015, "author": "averybusinesssolutions", "author_id": 16900384, "author_profile": "https://Stackoverflow.com/users/16900384", "pm_score": 2, "selected": false, "text": "_context.Staff.Add(staff)\n" }, { "answer_id": 74180356, "author": "chrisdot", "aut...
2022/10/20
[ "https://Stackoverflow.com/questions/74136284", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7186739/" ]
74,136,299
<p>my question is why the key&amp;value(512) in tables tt is not same:</p> <p>i have same lua code:</p> <pre class="lang-lua prettyprint-override"><code>t={501,502,503,504,505,506,507,508,509,510,511,512} tt={} for _, id in pairs(t) do print(id) tt[id] = id end print(&quot;----------------------&quot;) for k,v in pairs(tt) do print(k,v) end </code></pre> <p>in lua5.1: <a href="https://i.stack.imgur.com/xFITH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xFITH.png" alt="enter image description here" /></a></p> <p>in lua5.3: <a href="https://i.stack.imgur.com/MVfzx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MVfzx.png" alt="enter image description here" /></a></p>
[ { "answer_id": 74148015, "author": "averybusinesssolutions", "author_id": 16900384, "author_profile": "https://Stackoverflow.com/users/16900384", "pm_score": 2, "selected": false, "text": "_context.Staff.Add(staff)\n" }, { "answer_id": 74180356, "author": "chrisdot", "aut...
2022/10/20
[ "https://Stackoverflow.com/questions/74136299", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13639029/" ]
74,136,309
<p>I'm using here useState to store data, update current value, by using this it's not store previous data, it's only store update current value which do useState. But I want to store previous data and update data all of them, somethings like, i have 10 api's data and i want to call them end of my api using ids.</p> <p>i want to store 10 api's data in one array.</p> <p>how to store 10 apis data in together using useState();</p> <p>my code is somethings like:</p> <pre><code>const [dataLoc, setDataLoc] = useState([]); const ids = [1,2,3,4,5,6,7,8,9,10] useEffect(() =&gt; { ids?.map((id) =&gt; { fetch(`https://jsonplaceholder.typicode.com/posts/${id}`) .then((response) =&gt; response.json()) .then((dataLoc) =&gt; setDataLoc(dataLoc.title)) .catch((error) =&gt; console.error(error)) }) }, []); console.log(dataLoc); </code></pre> <p>output is:</p> <p><a href="https://i.stack.imgur.com/f55zy.png" rel="nofollow noreferrer">enter image description here</a></p> <p>but it's in 10 array the out put but i want all the title in one array.</p> <p>anyone can help me how can i do this here? ThankYou for Your Trying in advance!</p>
[ { "answer_id": 74148015, "author": "averybusinesssolutions", "author_id": 16900384, "author_profile": "https://Stackoverflow.com/users/16900384", "pm_score": 2, "selected": false, "text": "_context.Staff.Add(staff)\n" }, { "answer_id": 74180356, "author": "chrisdot", "aut...
2022/10/20
[ "https://Stackoverflow.com/questions/74136309", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19900677/" ]
74,136,312
<p>the way to determine a request parameter is null in spring</p>
[ { "answer_id": 74136794, "author": "Rob Spoor", "author_id": 1180351, "author_profile": "https://Stackoverflow.com/users/1180351", "pm_score": 1, "selected": false, "text": "null" }, { "answer_id": 74138105, "author": "Priyesh Jakhmola", "author_id": 14392679, "author...
2022/10/20
[ "https://Stackoverflow.com/questions/74136312", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
74,136,351
<p>our team right now is using helm chart to deploy services to k8s cluster, and ArgoCD to sync the helm chart modification to k8s cluster.</p> <p>My question is that, when ArgoCD performs a helm chart sync, what action does it do under the hood? <strong>does it use the command &quot;helm upgrade&quot; to do it?</strong> or else?</p> <p>Thanks</p>
[ { "answer_id": 74136794, "author": "Rob Spoor", "author_id": 1180351, "author_profile": "https://Stackoverflow.com/users/1180351", "pm_score": 1, "selected": false, "text": "null" }, { "answer_id": 74138105, "author": "Priyesh Jakhmola", "author_id": 14392679, "author...
2022/10/20
[ "https://Stackoverflow.com/questions/74136351", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1683098/" ]
74,136,365
<p>I want to list all customer with the latest phone number and most recent customer type the phone number and type of customers are changing periodically so I want the latest record only without getting old values based on the lastestupdate column</p> <p>Customer:</p> <pre><code>+------------+--------------------+------------+ |latestUpdate| CustID | AddID | TypeID | +------------+--------+-----------+------------- | 2020-03-01 | 1 | 1 | 1 | | 2020-04-07 | 2 | 2 | 2 | | 2020-06-13 | 3 | 3 | 3 | | 2020-03-29 | 4 | 4 | 4 | | 2020-02-06 | 5 | 5 | 5 | +------------+--------+------------+----------+ </code></pre> <p>CustomerAddress:</p> <pre><code>+------------+--------+-----------+ |latestUpdate| AddID | Mobile | +------------+--------+-----------+ | 2020-03-01 | 1 | 66666 | | 2020-04-07 | 1 | 55555 | | 2020-06-13 | 2 | 99999 | | 2020-03-29 | 3 | 11111 | | 2020-02-06 | 3 | 22222 | +------------+--------+-----------+ </code></pre> <p>CustomerType:</p> <pre><code>+------------+--------+-----------+ |latestUpdate| TypeId | TypeName | +------------+--------+-----------+ | 2020-03-01 | 1 | First | | 2020-04-07 | 1 | Second | | 2020-06-13 | 3 | Third | | 2020-03-29 | 4 | Fourth | | 2020-02-06 | 5 | Fifth | +------------+--------+-----------+ </code></pre> <p>When I tried to join I am always getting duplicated customerID not only the latest record</p> <p>I want to Display Customer.CustID and CustomerType.TypeName and CustomerAddress.Mobile</p>
[ { "answer_id": 74136466, "author": "Richard Barraclough", "author_id": 457140, "author_profile": "https://Stackoverflow.com/users/457140", "pm_score": 0, "selected": false, "text": "SELECT *\nFROM (\n SELECT latestUpdate, CustID, AddID, TypeID,\n ROW_NUMBER() OVER (PARTITION BY...
2022/10/20
[ "https://Stackoverflow.com/questions/74136365", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12768176/" ]
74,136,371
<p>In iOS 16 <a href="https://developer.apple.com/documentation/swiftui/view/accentcolor(_:)" rel="nofollow noreferrer"><code>accentColor(_:)</code></a> modifier has been deprecated, and Apple suggests using <a href="https://developer.apple.com/documentation/swiftui/datepicker/tint(_:)" rel="nofollow noreferrer"><code>tint(_:)</code></a> instead.</p> <p>However, I found it does not work on the <code>DatePicker</code>. It works as expected on the <code>Button</code>, for instance. I was experimenting with applying <code>.tint</code> modifier on different levels but without success. <code>.accentColor</code> works as expected, though.</p> <ul> <li>In the example, I apply <code>.purple</code> tint to the entire <code>List</code> view, so I expect it will be applied to all subviews.</li> <li>I apply <code>.red</code> tint to the <code>DatePicker</code>, which should override parent's tint. In the result, it has neither its own tint nor its parent's tint – it's the default (<code>.blue</code>) – <strong>not as expected</strong>.</li> <li>I apply <code>.green</code> tint to the first <code>Button</code> and it overrides parent's tint – as expected.</li> <li>I do not apply any tint to the second <code>Button</code>, so it inherits parent's tint (<code>.purple</code>) – as expected.</li> </ul> <pre><code>struct ContentView: View { @State private var date = Date() var body: some View { List { DatePicker(&quot;Date&quot;, selection: $date, displayedComponents: [.date]) .datePickerStyle(.graphical) .tint(.red) // &lt;- doesn't work Button(&quot;Button with own tint&quot;) { } .buttonStyle(.borderedProminent) .tint(.green) // &lt;- works Button(&quot;Button with parent tint&quot;) { } .buttonStyle(.borderedProminent) } .tint(.purple) // &lt;- works on Button, but not on DatePicker } } </code></pre> <p><a href="https://i.stack.imgur.com/eKuXX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eKuXX.png" alt="DatePikcer test view" /></a></p> <p>Am I doing something wrong, or is it some kind of SwiftUI's bug?</p>
[ { "answer_id": 74136972, "author": "dortus47", "author_id": 14532657, "author_profile": "https://Stackoverflow.com/users/14532657", "pm_score": 2, "selected": false, "text": "colorInvert" } ]
2022/10/20
[ "https://Stackoverflow.com/questions/74136371", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2577206/" ]
74,136,375
<p>Docusign Provides a way to get tabs data for a single document in a template by specifying documentId. I could not find a way to get tabs data for all documents included in a template.</p>
[ { "answer_id": 74136972, "author": "dortus47", "author_id": 14532657, "author_profile": "https://Stackoverflow.com/users/14532657", "pm_score": 2, "selected": false, "text": "colorInvert" } ]
2022/10/20
[ "https://Stackoverflow.com/questions/74136375", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8434226/" ]