Id
int64
34.6M
60.5M
Title
stringlengths
15
150
Body
stringlengths
33
36.7k
Tags
stringlengths
3
112
CreationDate
stringdate
2016-01-01 00:21:59
2020-02-29 17:55:56
Y
stringclasses
3 values
58,225,014
Access Form checkbox updates date in another table
I'm trying to make a form checkbox update a the date in another table. Private Sub Delivered_AfterUpdate() If Delivered = -1 Then [tool implentation].[date] = Now() End Sub This is code I have but it does not work. Does anyone have a suggestion? Thanks
<vba><ms-access><ms-access-forms>
2019-10-03 18:32:45
LQ_EDIT
58,225,210
How to run multiple calculations at once using python?
<p>I have recently started using python and to try learn I have set a task of being able to run two chunks of code at once. I have 1 chunk of code to generate and append prime numbers into a list</p> <pre><code>primes=[] for num in range(1,999999999999 + 1): if num &gt; 1: for i in range(2,num): if (num % i) == 0: break else: primes.append(num) </code></pre> <p>And another chunk of code to use the prime numbers generates to find perfect numbers</p> <pre><code>limit = 25000000000000000000 for p in primes(): pp = 2**p perfect = (pp - 1) * (pp // 2) if perfect &gt; limit: break elif is_prime(pp - 1): print(perfect) </code></pre> <p>I have heard of something to do with importing thread or something along those lines but I am very confused by it, if anyone can help by giving me clear instructions on what to do that would be very appreciated. I have only been learning python for about a week now. </p> <p><em>Final note, I didn't code these calculations myself but I have modified them to what I need them for</em> </p>
<python><python-3.x>
2019-10-03 18:48:22
LQ_CLOSE
58,225,819
round robin in a array in langage c
Bonjour, comment implémenter un round robin en langage c pour un tableau de 4 éléments [1,2,3,4]. le résultat du programme doit afficher, pour chaque élément, la liste des joueurs auxquels il fera face en ordre chronologique: 1: 4,2,3 2: 3,1,4 3: 2,4,1 4: 1,3,2
<algorithm>
2019-10-03 19:36:42
LQ_EDIT
58,226,484
Undefined property: PDOStatement::$num_rows
<p>This doesn't work:</p> <p>// Extract data items from dataset</p> <p>I've been all over the web for two days, including previous answers here</p> <pre><code> if ($result-&gt; num_rows &gt; 0) { while($row = $result-&gt; fetch_assoc()) </code></pre> <p>Connected successfully Notice: Undefined property: PDOStatement::$num_rows in E:\web\peoplespoll\htdocs\TableTest.php on line 64 0 result Fatal error: Uncaught Error: Call to undefined method PDO::close() in E:\web\peoplespoll\htdocs\TableTest.php:83 Stack trace: #0 {main} thrown in E:\web\peoplespoll\htdocs\TableTest.php on line 83</p>
<php><mysql><pdo>
2019-10-03 20:32:17
LQ_CLOSE
58,227,051
XCODE 11 Broke DateFormatter?
One day, the app worked. The next day I updated to Xcode 11 and now the app crashes with "unexpectedly found nil" on line 27 (when executing line 15) in the picture. I asked my co-worker who doesn't yet have Xcode 11, and his doesn't crash. we are on the same branch/commit...everything. Any advice? any way around this? my code should appear in that image link... need 10 rep to post images. https://i.stack.imgur.com/103AU.png [1]: https://i.stack.imgur.com/103AU.png
<ios><swift><xcode11>
2019-10-03 21:21:31
LQ_EDIT
58,227,991
can you explain me to how functions operate
<p>how do you use functions because i am big confusion at the moment and really want learn how to code </p>
<python>
2019-10-03 23:08:57
LQ_CLOSE
58,228,224
C: When a user does not provide an input I'm getting "Segmentation fault: 11". It works fine when a user does provide an input. How can I fix this?
Its a while (1) loop continuously asks user for input until terminated. I want it to ask the user for an input and if no input is given upon pressing enter it should ask for the input again. I've initialized input as char input[100]; I also tried doing "char *input = (char *)malloc(10*sizeof(char));" but it does not help.
<c><fgets>
2019-10-03 23:52:48
LQ_EDIT
58,228,603
Is there a java script code to animate vertical black bars with certain width to move over white background?
<p>Is there a java script code to animate vertical black bars with certain width to move over white background ? I want the finish result to be like in this video : <a href="https://www.youtube.com/watch?v=bdMWbfTMOMM" rel="nofollow noreferrer">https://www.youtube.com/watch?v=bdMWbfTMOMM</a> Thank you </p>
<javascript><jquery><html><css>
2019-10-04 00:56:40
LQ_CLOSE
58,229,236
Python Restful API
<p>I have written a python script that will connect to the oracle database using cx_oracle and gets data and performs some action on it. </p> <p>I want to expose this python script as a Restful API. In google, I read that using flask we can deploy a Python script as a Web service.</p> <p>What I am not clear </p> <ol> <li>The flask itself behaves like a server? </li> <li>Can I deploy the python Webservice in the Web logic server?</li> <li>I want to deploy this Webservice in production. How can I provide security to this?</li> <li>In another site, I read using Connection, Swagger we can implement it. </li> <li>I am actually written using flask, flask-jsonpify, flask-sqlalchemy, flask-restful. </li> <li>Please suggest which packages i need to use to deploy it as WebService.</li> </ol> <p>Let me know in case of any other details needed. Thanks in advance for your suggestions and guidance. </p> <p>Vijay</p>
<python><flask>
2019-10-04 02:42:14
LQ_CLOSE
58,231,233
How can i parse this video url in this api and play on my android studio?
Here is the structure of the **API**.(JSON format).I have already parse title & subtitle from this API. But how can i parse this youtube video link and play it in android studio. { "success": true, "message": "All Contents of Nirdeshona Videos", "data": [ { "id": 1, "title": "New NVideo", "sub_title": "New song", **"link": "https://www.youtube.com/watch?v=lecITZkWqzg",** "status": 1, "created_at": "2019-10-01 08:41:29", "updated_at": "2019-10-01 08:41:29" } ] }
<java><android><json><api><android-videoview>
2019-10-04 06:47:56
LQ_EDIT
58,234,063
I need to add a tick mark on selected option of dropdown. I am using angular material. Not getting the solution
<p>Example: options, A B C D</p> <p>If i select B from the dropdown, I need to add a tick symbol next to the selected option.</p>
<angular><angular-material>
2019-10-04 09:57:03
LQ_CLOSE
58,235,170
Regex extract number from a string with a specific pattern in Alteryx
<p>I have string like this which looks like a url</p> <pre><code>mainpath/path2/abc/PI 6/j </code></pre> <p>From the string I need to get the number along with <strong>PI</strong></p> <p>Main problem is the position of <strong>PI</strong> part wont be always the same. Sometimes it could be at the end. Sometimes at the middle.</p> <p>So how can I get that number extracted using regex? I'm really stucked with this</p>
<regex><alteryx>
2019-10-04 11:04:47
LQ_CLOSE
58,235,751
codeigniter Data Not inserting
my Controller <?php /** * */ class Product extends CI_Controller { function __construct() { parent::__construct(); $this->load->helper('url'); $this->load->helper('form'); $this->load->library('form_validation'); //$this->load->library('session'); $config['upload_path'] = './upload/'; $config['allowed_types'] = 'gif|jpg|png|jpeg'; $this->load->library('upload',$config); $this->load->model('Pro_model'); } public function NewProduct(){ $data['categories'] = $this->Pro_model->fetchCat(); $data['upload_error'] = $this->upload->display_errors(); //var_dump($cat_res); exit; $this->load->view('common/header'); $this->load->view('common/sidebar'); $this->load->view('addnewpro',$data); $this->load->view('common/footer'); } public function Pro_insert(){ $this->form_validation->set_rules('proname','Product Name','required'); $this->form_validation->set_rules('prodesc','Product Description','required'); $this->form_validation->set_rules('proprice','Product Price','required'); $this->form_validation->set_rules('procat','Product Category','required'); if ($this->form_validation->run() && $this->upload->do_upload('proimg')) { $post = $this->input->post(); unset($post['submit']); //var_dump($post); exit; $data = $this->upload->data(); $img_path = base_url("upload/".$data['raw_name'].$data['file_ext']); //var_dump($img_path); exit; $post['img_path'] = $img_path; $post_data = $this->Pro_model->insert_product($post); // var_dump($pro_data); exit; if ($post_data) { $this->session->set_flashdata('prosuccess','Product Insert Success'); //redirect('Product/Pro_insert'); $this->NewProduct(); } else{ $this->NewProduct(); } } else{ $this->NewProduct(); } } } my model <?php /** * */ class Pro_model extends CI_Model { public function insert_product($post){ return $this->db->insert('product',$post); //echo $this->db->last_query(); exit; } public function fetchCat() { $res = $this->db->get('category'); //echo $this->db->last_query(); exit; return $res->result(); } } my view <!-- MAIN CONTENT--> <div class="main-content"> <div class="section__content section__content--p30"> <div class="container-fluid"> <?php if ($this->session->flashdata('prosuccess')) { ?> <div class="alert alert-success"> <?php echo $this->session->flashdata('prosuccess'); } ?></div> <div class="row"> <div class="col-lg-6"> <form action="<?php echo base_url('product/Pro_insert'); ?>" method="post" enctype="multipart/form-data"> <div class="card"> <div class="card-header"> <strong>Add New</strong> Product </div> <div class="card-body card-block"> <div class="has-success form-group"> <label for="inputIsValid" class=" form-control-label">Product Name</label> <input type="text" name="proname" class="is-valid form-control-success form-control"> <div style="color: red"><?php echo form_error('proname'); ?></div> </div> <div class="has-warning form-group"> <label for="inputIsInvalid" class=" form-control-label">Product Description</label> <input type="text" name="prodesc" class="is-invalid form-control"> <div style="color: red"> <?php echo form_error('prodesc'); ?></div> </div> <div class="has-warning form-group"> <label for="inputIsInvalid" class=" form-control-label">Product Price</label> <input type="text" name="proprice" class="is-invalid form-control"> <div style="color: red"> <?php echo form_error('proprice'); ?></div> </div> <div class="has-warning form-group"> <label for="inputIsInvalid" class=" form-control-label">Product Category</label> <select name="procat" class="is-invalid form-control"> <?php foreach ($categories as $cat) { ?> <option value="<?php echo $cat->cat_id; ?>"><?php echo $cat->cat_name; ?></option> <?php } ?> <div style="color: red"> <?php echo form_error('procat'); ?></div> </select> </div> <div class="has-warning form-group"> <label for="inputIsInvalid" class=" form-control-label">Product Image</label> <input type="file" name="proimg" class="is-invalid"> <?php if ($upload_error) { echo $upload_error; } ?> </div> </div> <div class="card-footer"> <input type="submit" name="submit" class="btn btn-primary btn-sm"> </div> </div> </form> </div> </div> my Error is A Database Error Occurred Error Number: 1054 Unknown column 'proname' in 'field list' INSERT INTO `product` (`proname`, `prodesc`, `proprice`, `procat`, `img_path`) VALUES ('sultan', 'ali', '2323', '11', 'http://localhost/shop/Admin/upload/Penguins7.jpg') Filename: G:/xampp/htdocs/shop/Admin/system/database/DB_driver.php Line Number: 691
<codeigniter>
2019-10-04 11:41:57
LQ_EDIT
58,237,341
Flutter app freezes when a TextField or TextFormField is selected
<p>I have a Flutter app that is functioning properly in all respects except when I select a TextField (or TextFormField). When I select the TextField, the cursor blinks in the TextField, but I can't type anything AND all other buttons like the floatingActionButton and the back button in the AppBar quit working. Essentially, the app appears to be frozen, but I don't get any error messages.</p> <p>After numerous attempts to fix the problem in two different pages that contain FocusNodes and TextEditingControllers, I went back to square one by incorporating a new page with code straight from Flutter's website, but the TextField in this barebones code still locks up the app.</p> <pre><code>import 'package:flutter/material.dart'; class EventDetailForm extends StatefulWidget { static const String routeName = "/events/event-detail-form"; @override _EventDetailFormState createState() =&gt; _EventDetailFormState(); } class _EventDetailFormState extends State&lt;EventDetailForm&gt; { final myController = TextEditingController(); @override void dispose() { myController.dispose(); super.dispose(); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar(title: Text('Event Detail')), body: Padding( padding: const EdgeInsets.all(16), child: TextField( controller: myController, )), floatingActionButton: FloatingActionButton( onPressed: () { return showDialog( context: context, builder: (context) { return AlertDialog( content: Text(myController.text), ); }); }, child: Icon(Icons.text_fields), ), ); } } </code></pre> <p>Unfortunately, I am not getting any error messages. The cursor just blinks in the TextField and everything else loses function and I have to quit and restart. I am not sure what else I should be considering. Does anyone have any ideas on what might be causing this?</p>
<flutter><textfield>
2019-10-04 13:24:17
HQ
58,239,310
I want to make a spoiler function which can be used multiple times in a WordPress post
<div id="my-spoiler"> <div id= "my-spoiler-title" role= "button" onclick= "(document.getElementById('1') .style.display=document.getElementById('1').style.display=='none' ? '' : 'none')"> Spoiler Title </div> <div class="my-spoiler-content" id="1" style= "display:none"> Hidden Content </div> </div> I use this code But to use this multiple times in a post, I have to create unique "id" every time like "id=1", "id=2'.... Is there any way to call child div without any "id" and achieve the results. I want to use this function for my Quiz type post. when initially answer is hidden and when user touch the spoiler title than answers is visible. I done CSS part of this function and all things work properly if I use unique "id" for every question. I don't want to use any plugin or short code type plugin. Thanks in advance.
<javascript><html><css><wordpress>
2019-10-04 15:25:14
LQ_EDIT
58,239,954
need help first first year university homework problem invloving loops
Problem: In the space provided, write a program that uses nested loops to draw the pattern below. You are not allowed to use any of the formatting functions; your solution must use nested loops and must use calls to print("*", end="") and print("-", end="") to print characters to the screen (without moving to the next line) and calls to print() to move down to the next line. 1. ** 2. *_** 3. *__*** 4. *___**** 5. *____***** I have no idea where to start with this problem I'm new to programming. I must use nested loops and use print("*", end="") and print("-", end=""). I can't use formatting functions and I can only go to a new line using print()
<python-3.x>
2019-10-04 16:12:52
LQ_EDIT
58,240,574
Convert numbers (1-1000) to words in console log using Javascript
<p>So I was able to convert #1 - 9 into words using Javascript in console log. How can I get my code to show the remaining numbers, which would be 10-1000?</p> <pre><code>function numbersToWords(value) { let input = String(value).split(''); let mapData = { "0": "Zero", "1": "One", "2": "Two", "3": "Three", "4": "Four", "5": "Five", "6": "Six", "7": "Seven", "8": "Eight", "9": "Nine", }; let output = ''; var tempArray = [] for (let i = 0; i &lt; input.length; i++) { tempArray.push(mapData[input[i]]) } output = tempArray.join(' '); return output; } console.log(numbersToWords(123456789)); </code></pre>
<javascript><numbers><converters>
2019-10-04 17:05:43
LQ_CLOSE
58,240,575
Convert a number to a specific format
Using PHP's `[number_format()][1]` function, returns a formatted number. I want to convert the number to that format, not replace it. So i am trying to use a void function but the number is not converted. The number `10500100` should be converted to : `10,500,100.00` <?php function format_number_($number) { $number = number_format($number,2,'.',','); } $a = 10500100; format_number_($a); echo $a; ?> [1]: https://www.php.net/manual/en/function.number-format.php
<php><function>
2019-10-04 17:05:45
LQ_EDIT
58,241,403
Copy and paste value X amount of times
I'm currently working on a project on VBA that requires multiple manipulation on data. I need to create a macro that copies the information from cell "Q2" and pastes it on cell "A2", "B2","C2" and "D2". From there it needs to do the same with the information of cell "Q3" and paste it on "E2" and so on until there is no further data on "Q". At the moment it needs to paste the data a total of 4 times, but it needs to be modified later on for it to be 2 or 3 times. Any idea on how to make this? Thanks!
<excel><vba>
2019-10-04 18:14:49
LQ_EDIT
58,241,471
I can't understand why this input isn't working
<p><a href="https://i.stack.imgur.com/ausxI.png" rel="nofollow noreferrer">Input function error</a></p> <p>Very new I'm using colab and I can't figure out for the life of me why this doesn't work</p>
<python-3.x>
2019-10-04 18:21:34
LQ_CLOSE
58,242,342
SwiftUI Row Height of List - how to control?
<p>I have a simple List in SwiftUI. Code and Screenshot included below. I would like to reduce the height of each row in the list (so less space between lines and text lines closer together).</p> <p>I already tried to add a ".frame(height: 20)" to the HStack but it only allows the line spacing to be increased!</p> <p>Is there a way to do that?</p> <p>Thanks!</p> <p>Gerard</p> <pre><code>import SwiftUI struct PressureData: Identifiable { let id: Int let timeStamp: String let pressureVal: Int } struct ContentView : View { @State var pressureList = [ PressureData(id: 0, timeStamp: "11:49:57", pressureVal: 10), PressureData(id: 1, timeStamp: "11:49:56", pressureVal: 8), PressureData(id: 2, timeStamp: "11:49:55", pressureVal: 9), PressureData(id: 3, timeStamp: "11:49:54", pressureVal: 1), ] var body: some View { VStack { Text("Pressure Readings") .font(.system(size: 30)) List(pressureList) { row in HStack { Spacer() Text(row.timeStamp) Text("---&gt;") Text(String(row.pressureVal)) Spacer() } .frame(height: 30) } } } } </code></pre> <p><a href="https://i.stack.imgur.com/bY7AL.png" rel="noreferrer"><img src="https://i.stack.imgur.com/bY7AL.png" alt="enter image description here"></a></p>
<listview><formatting><swiftui>
2019-10-04 19:42:04
HQ
58,242,578
Double expression calculated as integer
<p>If I compile this code:</p> <p><code>int celsius = 41; double result = celsius *9/5 + 32;</code></p> <p>I get a result of 105.0, but casting celsius as double gets me the correct result of 105.8</p> <p><code>int celsius = 41; double result = (double)celsius *9/5 + 32;</code></p> <p>Why I need to cast?</p>
<java>
2019-10-04 20:02:48
LQ_CLOSE
58,243,680
React-Native another VirtualizedList-backed container
<p>After upgrading to react-native 0.61 i get a lot of warnings like that:</p> <pre><code>VirtualizedLists should never be nested inside plain ScrollViews with the same orientation - use another VirtualizedList-backed container instead. </code></pre> <p>What is the other <code>VirtualizedList-backed container</code> that i should use, and why is it now advised not to use like that?</p>
<javascript><reactjs><react-native>
2019-10-04 22:12:57
HQ
58,244,691
How to remove view controller stack and only show one view controller
<p>When I present another view controller, it shows this view:</p> <p><a href="https://i.stack.imgur.com/85FPy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/85FPy.png" alt="enter image description here"></a></p> <p>How do I change it so that my program only shows the destination view controller without this effect?</p>
<ios><swift>
2019-10-05 01:33:38
LQ_CLOSE
58,245,503
Javsacript. How to manipulate array of objects so it groups elements that have the same element?
<p>I have an array like the following, that I will fetch from MongoDB:</p> <pre><code>[ {date: '2019-10-05', score: 3}, {date: '2019-10-05', score: 5}, {date: '2019-10-06', score: 4}, {date: '2019-10-06', score: 1}, ] </code></pre> <p>I need to make a new array to look like the following:</p> <pre><code>[ {date: '2019-10-05', score: [3,5]}, {date: '2019-10-06', score: [4,1]} ] </code></pre> <p>Basically grouping the scores into the same arrays based on the date attribute. Any kinds of advice to achieve this is appreciated.</p>
<javascript><arrays>
2019-10-05 05:07:48
LQ_CLOSE
58,245,771
Timed out waiting for process to appear on device
<p>I am having the following problem when running or debugging apps on a device or emulator with Android Studio. The application is installed but it is not started on the device (or emulator). In the Run window I can see the following:</p> <p>Launching app on device. Waiting for process to come online...</p> <p>and after some time I see the following: Timed out waiting for process to appear on 'device'...</p> <p>I have attached a screenshot that shows the problem.</p> <p><a href="https://i.stack.imgur.com/dXzhJ.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/dXzhJ.jpg" alt="enter image description here"></a></p> <p>The problem started recently. I am using the latest version of Android studio (3.5.1) and a Google Pixel device running Android 10 but the problem happens on emulators and other devices running previous versions of Android. The problem also happens on two different computers, with different Android applications and devices - the common factor is Android studio. Finally, the problem seems to have started after I updated Android Studio to 3.5. </p> <p>Does anyone know how to fix this problem? I have tried many things (clear cache, rebuild, invalidate and restart, etc) without success.</p> <p>Any ideas?</p>
<android><android-studio>
2019-10-05 05:57:10
HQ
58,248,114
If statement issue prints all the phrases
<p>Here is the code. I want to write a different phrase that needs to be printed according to the Q1 response but the program doesn't work properly and prints all the phrases. </p> <pre><code>print ('Pet animals') #choose an animal print ('A. Dog') print ('B. Cat') print ('C. Hamster') print ('D. Bird') print ('E. None') Q1response= input('I have a ') if(Q1response == "A" or "a"): print ('They are so cute') elif (Q1response == "B" or "b"): print ('They are so haughty') </code></pre>
<python><windows><if-statement>
2019-10-05 12:04:30
LQ_CLOSE
58,248,138
my C program doesnt work the way its supposed to
I made this program but it doesnt work. You enter two numbers. Then you press + or -. If you press + it should add the numbers. If you press - it should subtract. But that part doesnt work. ``` #include <stdio.h> #include <stdlib.h> /* run this program using the console pauser or add your own getch, system("pause") or input loop */ int main(int argc, char *argv[]) { char opt; int a,b,s; scanf("%d",&a); scanf("%c\n",&opt); scanf("%d",&b); if(opt=='+') { //this part doesnt work s=a+b; } else if(opt=='-') { s=a-b; } printf("%d",s); return 0; } ``` What should i do?
<c><if-statement><scanf>
2019-10-05 12:07:48
LQ_EDIT
58,248,239
How to console imput and store a line of numbers in c++?
There is a line full of a specific number (N) of numbers. For example: if N = 5 then the line can be: 0 1 5 3 4 How can I read in a line like that? If I store it in a string (string temp; cin >> temp;), it becomes '00' for some reason... Also, I need to put them into a number array. Can you help me please?
<c++><arrays><input><split><numbers>
2019-10-05 12:23:16
LQ_EDIT
58,248,489
I have a problem with password-verify. Even though I know the password has been entered correctly I still get a false result
I use this code to enter the hash value in mySql database: I have replaced the server login details. The input comes from a form that is created when a user scans an NFC microchip. ``` $servername = "localhost"; $username = "xxxxxxxxx"; $password = "xxxxxxxxx"; $database = "xxxxxxxxx"; // substitute your mysql database name $hash = password_hash($Pass, PASSWORD_DEFAULT); if ($UID === "0") { echo "You have not scanned a chip to enter the registration process"; } else { $Type = $_POST["Type"]; $Units = $_POST["UNITS"]; $LstStln = $_POST["LstStln"]; $Country = $_POST["Country"]; if (empty($_POST["eMail"])) { $emailErr = "Email is required"; echo "Email is required"; } else { $eMail = test_input($_POST["eMail"]); // check if e-mail address is well-formed if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/",$eMail)) { die ("Invalid email format. Try again."); } // Create connection $conn = new mysqli($servername, $username, $password, $database); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } $sql = "INSERT INTO ItsMine (UID, Password, email, Type, UNITS, LstStln, Country) VALUES ('$UID', '$hash', '$eMail', '$Type', '$Units', '$LstStln', '$Country')"; $result = $conn->query($sql); ``` This is corresponding code that processes the input from this form and is returning false from password verify. ``` $servername = "localhost"; $username = "xxxxxxxxx"; $password = "xxxxxxxxx"; $database = "xxxxxxxxxx"; // substitute your mysql database name $email = $_POST['email']; $Pass = $_POST['Password']; // Create connection $conn = new mysqli($servername, $username, $password, $database); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } //get the hashed password from the database $sql = "SELECT * From ItsMine where eMail = '$email'"; $result = $conn->query($sql); $row=mysqli_fetch_assoc($result); $hash = $row["Password"]; //Check password entered against the stored hash if (password_verify($Pass, $hash)) { $tql = "SELECT * From ItsMine where eMail = '$email'"; ```
<php><sql><mysqli><passwords>
2019-10-05 12:54:41
LQ_EDIT
58,248,608
finding max value of finishes per date
<p>Pardon for the title, but I absolutely have no idea as to how to describe this.</p> <p>I've got a table like this:</p> <pre><code>trackID playerID score date 1 2 4510 1494075555 1 2 4507 1494076300 1 2 4513 1494076561 2 3 39455 1494083772 3 3 5665 1494089018 2 2 38444 1494074519 4 3 34443 1494089138 5 3 56443 1494260918 </code></pre> <p>I want only the first finish per track, a track can have multiple players finish on the same date. I want to have the max amount of first finishes on a single day.</p> <p>In the table above, player 3 finished 3 maps for the first time on the 6.5.2017. On the 8.5.2017 he only finished a single track. I only want to include the date he finished the most tracks.</p> <p>Result I want:</p> <pre><code>playerID trackID count(trackID) date 3 2,3,4 3 6.5.2017 2 1,2 2 6.5.2017 </code></pre>
<mysql><subquery>
2019-10-05 13:09:54
LQ_CLOSE
58,248,822
how did make code decompress java spring boot?
Hi everyone i'm Starting Beginner learning java springboot .my profressor give an assignment for me . that's decompress java springboot. the proposition has define input and out . following example Input1 : 2[abc]3[ab]c Output1 : abcabcabababc Input2 : 10[a]c2[ab] Output2 : aaaaaaaaaacabab Input3 : 2[3[a]b] Output3 : aaabaaab somebody help me please . that's very seriousry for me . can help and explain to me T_T
<java>
2019-10-05 13:34:45
LQ_EDIT
58,249,425
Oracle-Making Optional Constraint in Select
How to make a constraint optional? That is, if a codition of the consraint is FALSE, how to ignore the constraint in a simplest way? The expected result of my code is, RR -- 100 200 My Code is, WITH DATASET AS ( SELECT 1 A, 10 B, 100 RR FROM DUAL UNION SELECT NULL A, 10 B, 200 RR FROM DUAL ) SELECT RR FROM DATASET WHERE A=2 -- How to make this constraint optional(that is, if this is FALSE,ignoring this constraint?) AND B=10 ;
<sql><oracle><select><where-clause>
2019-10-05 14:51:14
LQ_EDIT
58,250,055
Cannot use optional chaining on non-optional value of type 'Bool'
<p>Why I can't use c? 1 : 2 syntax in swiftui? Is there any solution? </p> <pre><code>import SwiftUI struct ContentView: View { var c: Bool = false var body: some View { Text("Hello World") .foregroundColor(c? .red : .blue) } } struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView() } } </code></pre>
<swift>
2019-10-05 16:08:38
LQ_CLOSE
58,250,106
Uses of for row loop in template
<p>I searched in the docs but could not find tag mentioned below . I want to know where can we use it and Please provide link so i can read more about this tag. </p> <pre><code>{% for row in qs %} {{ row.total_income }} {% endfor %} </code></pre>
<django>
2019-10-05 16:14:22
LQ_CLOSE
58,250,210
The best framework for building a beautiful and high-end GUI by python
<p>I want to make a nice, high-end GUI with Python</p> <p>Which framework do you recommend?</p>
<python-3.x>
2019-10-05 16:25:14
LQ_CLOSE
58,252,201
Getting Podfile by Cocoa installation... Is a directory...why?
[enter image description here][1] [1]: https://i.stack.imgur.com/jiQnk.jpg Trying to get Pod file, I am always having the same mistake with this part. bash...." is a directory" by terminal. Whan can I do? Thanks
<swift><xcode><cocoapods><pod><podfile>
2019-10-05 20:44:36
LQ_EDIT
58,252,493
iOS: Is it possible to Programatically disconnect a call?
Is it possible to disconnect a call programmatically? I know call kit can be used to make VOIP calls/ block users but is it possible to install an app and lets say user is busy and just by enabling a flag in the app just send them all to voicemail or disconnect without user interaction?
<ios><swift><callkit>
2019-10-05 21:31:33
LQ_EDIT
58,253,289
Argument 1 passed to App\Http\Controllers\Auth\RegisterController::validator() must be an instance of Illuminate\Http\Request
Can anyone help me with this error? I am making an application, I am using the Laravel Framework version 5.8.35. ERROR : Argument 1 passed to App\Http\Controllers\Auth\RegisterController::validator() must be an instance of Illuminate\Http\Request Register Controller : The idea of ​​control is to control the sending of data between the view and the database. This controller controls the application's remit. <?php namespace App\Http\Controllers\Auth; use App\User; use App\Http\Controllers\Controller; use Illuminate\Foundation\Auth\RegistersUsers; use Illuminate\Http\Request; class RegisterController extends Controller { use RegistersUsers; protected $redirectTo = '/home'; public function __construct() { $this->middleware('guest'); } protected function validator(Request $request) { $this ->validate($request, [ 'nome' => 'required|max:255', 'sobrenome' => 'required|max:255', 'email' => 'required|email|unique:users,email|max:255', 'cpf' => 'required|min:11|unique:users,cpf', 'rg' => 'required|min:7|unique:users,rg', 'telefone' => 'required', 'celular' => 'required', 'rua' => 'required|max:255', 'bairro' => 'required|max:255', 'complemento' => 'max:255', 'numero' => 'required', 'cep' => 'required|min:8', 'datanascimento' => 'required|date|before:today', 'password' => 'required|min:8|confirmed|max:60', ]); $user = User::create(request(['nome','sobrenome', 'email','cpf','rg','telefone','celular','rua','bairro','complento','numero','cep','datanascimento','password'])); auth()->login($user); return redirect()->to('/home'); } } View Register: The idea of ​​the view is to show the user in a friendlier way how to register to use the system. @section('content') <link href="{{ asset('css/sb-admin-2.min.css')}}" rel="stylesheet"> <div class="form-horizontal"> {{Form::model(['route' => 'register', 'method' => 'post'])}} <div class="form-group"> {{Form::label('nome', 'Nome:',['class' => 'col-lg-2 control-label'])}} {{Form::text('nome',null,['class' => 'col-lg-8 form'])}} @if ($errors->has('nome')) {{$errors->first('nome')}} @endif </div> <div class="form-group"> {{Form::label('sobrenome', 'Sobrenome:',['class' => 'col-lg-2 control-label'])}} {{Form::text('sobrenome',null,['class' => 'col-lg-8 form'])}} @if ($errors->has('nome')) {{$errors->first('nome')}} @endif </div> <div class="form-group"> {{Form::label('datanascimento', 'Data de Nascimento:',['class' => 'col-lg-2 control-label'])}} {{Form::date('datanascimento',null,['class' => 'col-lg-8 form'])}} @if ($errors->has('datanascimento')) {{$errors->first('datanascimento')}} @endif </div> <div class="form-group"> {{Form::label('cpf', 'CPF:',['class' => 'col-lg-2 control-label'])}} {{Form::text('cpf',null,['class' => 'col-lg-8 form'])}} @if ($errors->has('cpf')) {{$errors->first('cpf')}} @endif </div> <div class="form-group"> {{Form::label('rg', 'RG:',['class' => 'col-lg-2 control-label'])}} {{Form::text('rg',null,['class' => 'col-lg-8 form'])}} @if ($errors->has('rg')) {{$errors->first('rg')}} @endif </div> <div class="form-group"> {{Form::label('telefone', 'Telefone:',['class' => 'col-lg-2 control-label'])}} {{Form::text('telefone',null,['class' => 'col-lg-8 form'])}} @if ($errors->has('telefone')) {{$errors->first('telefone')}} @endif </div> <div class="form-group"> {{Form::label('celular', 'Celular:',['class' => 'col-lg-2 control-label'])}} {{Form::text('celular',null,['class' => 'col-lg-8 form'])}} @if ($errors->has('celular')) {{$errors->first('celular')}} @endif </div> <div class="form-group"> {{Form::label('rua', 'Rua:',['class' => 'col-lg-2 control-label'])}} {{Form::text('rua',null,['class' => 'col-lg-8 form'])}} @if ($errors->has('rua')) {{$errors->first('rua')}} @endif </div> <div class="form-group"> {{Form::label('bairro', 'Bairro:',['class' => 'col-lg-2 control-label'])}} {{Form::text('bairro',null,['class' => 'col-lg-8 form'])}} @if ($errors->has('bairro')) {{$errors->first('bairro')}} @endif </div> <div class="form-group"> {{Form::label('complemento', 'Complemento:',['class' => 'col-lg-2 control-label'])}} {{Form::text('complemento',null,['class' => 'col-lg-8 form'])}} @if ($errors->has('complemento')) {{$errors->first('complemento')}} @endif </div> <div class="form-group"> {{Form::label('numero', 'Número:',['class' => 'col-lg-2 control-label'])}} {{Form::text('numero',null,['class' => 'col-lg-8 form'])}} @if ($errors->has('numero')) {{$errors->first('numero')}} @endif </div> <div class="form-group"> {{Form::label('cep', 'CEP:',['class' => 'col-lg-2 control-label'])}} {{Form::text('cep',null,['class' => 'col-lg-8 form'])}} @if ($errors->has('cep')) {{$errors->first('cep')}} @endif </div> <div class="form-group"> {{Form::label('email', 'Email:',['class' => 'col-lg-2 control-label'])}} {{Form::text('email',null,['class' => 'col-lg-8 form'])}} @if ($errors->has('email')) {{$errors->first('email')}} @endif </div> <div class="form-group"> {{Form::label('password', 'Senha:',['class' => 'col-lg-2 control-label'])}} {{Form::password('password',['class' => 'col-lg-8 form', 'type' => 'password'])}} @if ($errors->has('password')) {{$errors->first('password')}} @endif </div> <div class="form-group"> {{Form::label('password_confirmation', 'Confirmação Senha:',['class' => 'col-lg-2 control-label'])}} {{Form::password('password_confirmation',['class' => 'col-lg-8 form'])}} @if ($errors->has('password_confirmation')) {{$errors->first('password_confirmation')}} @endif </div> <div class="form-group"> {{Form::reset('Limpar', array('class' => 'btn btn-danger limpar'))}} {{Form::submit('Salvar',array('class'=> 'btn btn-success salvar', 'id' => 'validar'))}} {{Form::close()}} </div> </div> </div> </div> </div> @endsection
<php><laravel><validation><laravel-5>
2019-10-06 00:12:51
LQ_EDIT
58,253,533
how to convert a string to an integer in java
<p>i get an error when try to convert a string to an integer</p> <pre><code> public static void main(String[] args){ String rate= "3.7"; int age=20; boolean istrue=true; double salary=60.4; //convert to String String Newsalary=String.valueOf(salary); String Newage=String.valueOf(age); String Newistrue=String.valueOf(istrue); //convert to Integer int Newrate= Integer.parseInt(rate);//here is the probleme int NewsalaryInt=(int) salary; //convert to double double NewrateDouble=Double.parseDouble(rate); double NewageDouble=(double) age; } } </code></pre> <p>the problem is when i convert rate varaible which is String to an integer</p>
<java><android>
2019-10-06 01:17:11
LQ_CLOSE
58,255,821
How to use K.get_session in Tensorflow 2.0 or how to migrate it?
<pre><code>def __init__(self, **kwargs): self.__dict__.update(self._defaults) # set up default values self.__dict__.update(kwargs) # and update with user overrides self.class_names = self._get_class() self.anchors = self._get_anchors() self.sess = K.get_session() </code></pre> <p>RuntimeError: <code>get_session</code> is not available when using TensorFlow 2.0.</p>
<machine-learning><keras><deep-learning><real-time><tensorflow2.0>
2019-10-06 09:13:25
HQ
58,255,971
Docker scale with deterministic port binding
<p>I would like to scale a <code>wildfly</code> container having exposed multiple ports with deterministic results.</p> <p><strong>docker-compose.yml</strong></p> <pre><code>version: '3' services: wildfly-server: build: context: . dockerfile: Dockerfile args: admin_user: admin admin_password: admin deploy: resources: limits: memory: 1.5G cpus: "1.5" restart: always ports: - "8000-8099:8080" - "8100-8199:9990" - "8200-8299:8787" expose: - "8080" - "9990" - "8787" </code></pre> <p><strong>Dockerfile</strong></p> <pre><code>FROM jboss/wildfly:16.0.0.Final # DOCKER ENV VARIABLES ENV WILDFLY_HOME /opt/jboss/wildfly ENV STANDALONE_DIR ${WILDFLY_HOME}/standalone ENV DEPLOYMENT_DIR ${STANDALONE_DIR}/deployments ENV CONFIGURATION_DIR ${STANDALONE_DIR}/configuration RUN ${WILDFLY_HOME}/bin/add-user.sh ${admin_user} ${admin_password} --silent # OPENING DEBUG PORT RUN rm ${WILDFLY_HOME}/bin/standalone.conf ADD standalone.conf ${WILDFLY_HOME}/bin/ # SET JAVA ENV VARS RUN rm ${CONFIGURATION_DIR}/standalone.xml ADD standalone.xml ${CONFIGURATION_DIR}/ </code></pre> <p><strong>Command to start</strong></p> <pre><code>docker-compose up --build --force-recreate --scale wildfly-server=10 </code></pre> <p>It almost works as I want to, but there is some port discrepancy. When I create the containers, I want them to have incremental ports for each container to be exposed as follows:</p> <pre><code>machine_1 8001, 8101, 82001 machine_2 8002, 8102, 82002 machine_3 8003, 8103, 82003 </code></pre> <p>But what I get as a result is not deterministic and looks like this:</p> <pre><code>machine_1 8001, 8102, 82003 machine_2 8002, 8101, 82001 machine_3 8003, 8103, 82002 </code></pre> <p>The problem is that every time I run the compose up command, the ports are different for each container.</p> <p>Example output:</p> <pre><code>CONTAINER ID COMMAND CREATED STATUS PORTS NAMES 0232f24fbca4 "/opt/jboss/wildfly/…" 5 minutes ago Up 5 minutes 0.0.0.0:8028-&gt;8080/tcp, 0.0.0.0:8231-&gt;8787/tcp, 0.0.0.0:8126-&gt;9990/tcp wildfly-server_7 13a6a365a552 "/opt/jboss/wildfly/…" 5 minutes ago Up 5 minutes 0.0.0.0:8031-&gt;8080/tcp, 0.0.0.0:8230-&gt;8787/tcp, 0.0.0.0:8131-&gt;9990/tcp wildfly-server_10 bf8260d9874d "/opt/jboss/wildfly/…" 5 minutes ago Up 5 minutes 0.0.0.0:8029-&gt;8080/tcp, 0.0.0.0:8228-&gt;8787/tcp, 0.0.0.0:8129-&gt;9990/tcp wildfly-server_6 3d58f2e9bdfe "/opt/jboss/wildfly/…" 5 minutes ago Up 5 minutes 0.0.0.0:8030-&gt;8080/tcp, 0.0.0.0:8229-&gt;8787/tcp, 0.0.0.0:8130-&gt;9990/tcp wildfly-server_9 7824a73a09f5 "/opt/jboss/wildfly/…" 5 minutes ago Up 5 minutes 0.0.0.0:8027-&gt;8080/tcp, 0.0.0.0:8227-&gt;8787/tcp, 0.0.0.0:8128-&gt;9990/tcp wildfly-server_3 85425462259d "/opt/jboss/wildfly/…" 5 minutes ago Up 5 minutes 0.0.0.0:8024-&gt;8080/tcp, 0.0.0.0:8224-&gt;8787/tcp, 0.0.0.0:8124-&gt;9990/tcp wildfly-server_2 5be5bbe8e577 "/opt/jboss/wildfly/…" 5 minutes ago Up 5 minutes 0.0.0.0:8026-&gt;8080/tcp, 0.0.0.0:8226-&gt;8787/tcp, 0.0.0.0:8127-&gt;9990/tcp wildfly-server_8 2512fc0643a3 "/opt/jboss/wildfly/…" 5 minutes ago Up 5 minutes 0.0.0.0:8023-&gt;8080/tcp, 0.0.0.0:8223-&gt;8787/tcp, 0.0.0.0:8123-&gt;9990/tcp wildfly-server_5 b156de688dcb "/opt/jboss/wildfly/…" 5 minutes ago Up 5 minutes 0.0.0.0:8025-&gt;8080/tcp, 0.0.0.0:8225-&gt;8787/tcp, 0.0.0.0:8125-&gt;9990/tcp wildfly-server_4 3e9401552b0a "/opt/jboss/wildfly/…" 5 minutes ago Up 5 minutes 0.0.0.0:8022-&gt;8080/tcp, 0.0.0.0:8222-&gt;8787/tcp, 0.0.0.0:8122-&gt;9990/tcp wildfly-server_1 </code></pre> <p><strong><em>Question</em></strong></p> <p>Is there any way to make the port distribution deterministic? Like disable parallel running to have serial checks on the available ports or any other method? The only alternative I found is to have a <code>yml</code> template and generate all the necessary files (like 10 if I need 10 containers etc). Are there any alternative solutions?</p>
<docker><docker-compose>
2019-10-06 09:35:41
HQ
58,256,044
How to change SF Symbols' icon color in UIKit?
<p>In <code>SwiftUI</code>, you can change the icon's color using <code>foregroundColor</code> modifier. So I think there should be a way to change the color in <code>UIKit</code>. I looked up the documentation and didn't find anything related to it.</p> <p>Is it possible right now?</p> <pre class="lang-swift prettyprint-override"><code>let iconImage = UIImage(systemName: "chevron.right", withConfiguration: UIImage.SymbolConfiguration(pointSize: 16, weight: .regular, scale: .medium)) </code></pre>
<ios><sf-symbols>
2019-10-06 09:46:02
HQ
58,258,851
Why do we need to return state from reducer in React
I am new to Redux and was trying to get how to work with Redux properly but I encountered a confusion on why we need to return state in reducer. Here is the code: const initialState = { counter: 0 }; const reducer = (state = initialState, action) => { if (action.type === "INCREMENT") { return { counter: state.counter + 1 }; } return state; why do we need to use this code? }; export default reducer;
<javascript><reactjs><redux>
2019-10-06 15:44:47
LQ_EDIT
58,260,480
How to merge two same column datatable cells in one cell with comma sepreated in c#?
I have tow datatable with the same column like:- input datatable1- Column1 Column2 Column3 Aa Bb Cc Dd Ee Ff input datatable2- Column1 Column2 Column3 Gg Hh Ii Jj Kk Ll I need output table like:- Column1 Column2 Column3 Aa,Gg Bb,Hh Cc,Ii Dd,Jj Ee,Kk Ff,Li Thanks in advance for help!
<c#><.net>
2019-10-06 19:15:15
LQ_EDIT
58,261,649
For loop is executed asynchronously in javascript?
<p>In my example below, why does it log 512, rather than 1? I understand javascript is synchronous, so shouldn't the logging occur long before the for loop completes? For this reason, I was expecting result = 1 when logged.</p> <pre><code>let result = 1; for (counter = 1; counter &lt; 10; counter ++) { result = result * 2; } console.log(result); </code></pre>
<javascript><execution><synchronous>
2019-10-06 22:16:52
LQ_CLOSE
58,262,148
Guidance on basic python assignment
<p>Need to create a python code to provide a list of tuples (searched words, list of occurrences). the searched words are listed in a Thesaurus which need to be searched in a series of documents in a Corpus.</p> <p>Any suggestion/guidance?</p>
<python>
2019-10-06 23:56:05
LQ_CLOSE
58,262,380
How to pass parameters to on:click in Svelte?
<p>Binding a function to a button is easy and straightforward:</p> <pre><code>&lt;button on:click={handleClick}&gt; Clicks are handled by the handleClick function! &lt;/button&gt; </code></pre> <p>But I don't see a way to pass parameters (arguments) to the function, when I do this:</p> <pre><code>&lt;button on:click={handleClick("parameter1")}&gt; Oh no! &lt;/button&gt; </code></pre> <p>The function is called on page load, and never again.</p> <p>Is it possible at all to pass parameters to function called from <code>on:click{}</code>?</p> <p><hr> <strong>EDIT:</strong></p> <p>I just found a hacky way to do it. Calling the function from an inline handler works.</p> <pre><code>&lt;button on:click={() =&gt; handleClick("parameter1")}&gt; It works... &lt;/button&gt; </code></pre>
<svelte><svelte-3>
2019-10-07 00:46:07
HQ
58,264,304
How to start mongo v4.2.0
<p>I have successfully installed Mongo v4.2.0.</p> <pre><code>mongo --version MongoDB shell version v4.2.0 git version: a4b751dcf51dd249c5865812b390cfd1c0129c30 OpenSSL version: OpenSSL 1.1.1c 28 May 2019 allocator: tcmalloc modules: none build environment: distmod: ubuntu1804 distarch: x86_64 target_arch: x86_64 </code></pre> <p>But when i start mongo, it is showing error. Kindly help me out. I am using ubuntu 18.04. mongo</p> <pre><code>MongoDB shell version v4.2.0 connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&amp;gssapiServiceName=mongodb 2019-10-07T11:35:13.915+0530 E QUERY [js] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused : connect@src/mongo/shell/mongo.js:341:17 @(connect):2:6 2019-10-07T11:35:13.916+0530 F - [main] exception: connect failed 2019-10-07T11:35:13.916+0530 E - [main] exiting with code 1 </code></pre>
<mongodb>
2019-10-07 06:14:03
LQ_CLOSE
58,264,904
I need help for open and close action menu using css
I am creating a floating action buttons and here is my code My Code: jsfiddle.net/7zkjas08 Currently in my code when user click the action button the popup appears and user need to click or tap in somewhere in the screen to close the popup. I want functionality like this : jsfiddle.net/r2hxbL5j When user click the button it shows the cross X closing sign. So user can tap/click the cross sign and popup disappears. Please help me how can i do this.
<javascript><php><html><css><wordpress>
2019-10-07 07:09:14
LQ_EDIT
58,266,328
Weird problem when i try to format string to date in Angalar
I try to format string to Date. this.deadLine = new Date(this.deadLine); When i console this i got "Invalid Date". The output of this.deadLine without a format is: "2019-10-21T21:00:00.000Z" If i do it without a variable like this its work: const a = new Date("2019-10-21T21:00:00.000Z") console.log (a) The output good Tue Oct 22 2019 00:00:00 GMT+0300 (Israel Daylight Time) Why its not work on this.deadLine in the first line???
<javascript><angular>
2019-10-07 08:58:21
LQ_EDIT
58,266,418
Correct way of error handling in React-Redux
<p>I want to understand what is more general or correct way of error handling with React-Redux. </p> <p>Suppose, I have phone number sign up component.</p> <p>That Component throws an error say if the input phone number is invalid </p> <p>What would be a best way to handle that error? </p> <p><strong>Idea 1:</strong> Create a component, which takes an error and dispatches an action whenever an error is passed to it</p> <p><strong>idea 2:</strong> Since the error is related to that component, pass that error to a component (which isn't connected to redux i.e the error handler component won't dispatch the action)</p> <p><strong>Question:</strong> Can someone guide me on proper-way of error handling in React-Redux for large-scale app? </p>
<reactjs><redux>
2019-10-07 09:04:31
HQ
58,267,023
Casting an Int to a boolean Issue in C++
If we assume that an int takes 4 bytes and a bool takes 1 byte, what happens to the other 3 bytes when an int is casted to a bool. do those bytes become free and can be overwritten by any other assignment. I saw something like this in a code: ``` void foo(bool e){ int a; bool s; e = e >> 24; ... } void mainFunc(){ int *arg = (int*)malloc(sizeof(int)); *arg = xxxx; foo((bool)arg); } ``` Is this a right thing to do?
<c++><integer-arithmetic>
2019-10-07 09:42:35
LQ_EDIT
58,269,400
What is favicon.ico ? Why is it required?
<p>I am new to Web Programming and browsing thru chrome dev tools, I always wondered what is favicon and why is it needed??</p>
<html><web><react-fullstack>
2019-10-07 12:17:57
LQ_CLOSE
58,269,413
Why in principle an in-place-modifying method should return None
<p>A language design question.</p> <p>Taking Python as example.</p> <p>Quoting a <a href="https://stackoverflow.com/questions/22442378/what-is-the-difference-between-sortedlist-vs-list-sort#comment81703173_22442440">comment</a> in an answer to a question concerning the difference between <code>list.sort()</code> and <code>sorted()</code>:</p> <blockquote> <p>In general, when a python function returns None, it is a sign, that the operations are done in place, that's why, when you want to print list.sort() it returns None.</p> </blockquote> <p>I am wondering the reason for the language-design principle that an in-place-modifying method should return <code>None</code>. Just for curiosity, say, why cannot <code>list.sort()</code> (and other in-place-modifying functions/methods) return itself?</p> <p>A possbile argument is that doing so avoids creating a copy and could be faster. However, copying a list in Python only creates a reference and shouldn't be much expensive.</p> <p>Another argument could be <code>list.sort()</code>, from its literal meaning, shouldn't be an object. Then what about having another method that both modifies list in place and returns a copy -- call it <code>list.sorted()</code>? I guess having such a method will facilitate certain usage.</p>
<python>
2019-10-07 12:18:22
LQ_CLOSE
58,270,424
Julia in Google Colab
<p>I am trying to setup Julia with Google Colab. Installation instructions as in <a href="https://discourse.julialang.org/t/julia-on-google-colab-free-gpu-accelerated-shareable-notebooks/15319" rel="noreferrer">https://discourse.julialang.org/t/julia-on-google-colab-free-gpu-accelerated-shareable-notebooks/15319</a> have been followed. Despite that, I am unable to launch Julia.</p> <p>I am trying to use Julia with Google Colab. I followed the following steps:</p> <ol> <li>Install CUDA</li> </ol> <pre><code>!wget https://developer.nvidia.com/compute/cuda/9.0/Prod/local_installers/cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64-deb !dpkg -i cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64-deb !apt-key add /var/cuda-repo-9-0-local/7fa2af80.pub !apt update -q !apt install cuda gcc-6 g++-6 -y -q !ln -s /usr/bin/gcc-6 /usr/local/cuda/bin/gcc !ln -s /usr/bin/g++-6 /usr/local/cuda/bin/g++ </code></pre> <ol start="2"> <li>Install Julia 1.2.0</li> </ol> <pre><code>!curl -sSL "https://julialang-s3.julialang.org/bin/linux/x64/1.2/julia-1.2.0-linux-x86_64.tar.gz" -o julia.tar.gz !tar -xzf julia.tar.gz -C /usr --strip-components 1 !rm -rf julia.tar.gz* !julia -e 'using Pkg; pkg"add IJulia; add CuArrays; add Flux; precompile"' </code></pre> <p>The above two steps run perfectly fine. I am unable to initiate a Julia session. I tried: </p> <pre><code> !julia </code></pre> <p>With this, the Julia start-up screen keeps showing with no command-line.</p>
<julia><gpu><google-colaboratory>
2019-10-07 13:19:36
HQ
58,271,174
can i use custom font for the image in java?
BufferedImage source = ImageIO.read(input_file); File backImg = new File("C:\\Users\\saradhi\\Desktop\\water-lily-3784022__340.jpg"); BufferedImage backImgB = ImageIO.read(backImg); final BufferedImage textImage = new BufferedImage( backImgB.getWidth(), backImgB.getHeight(), BufferedImage.TYPE_INT_ARGB); Graphics2D g = textImage.createGraphics(); FontRenderContext frc = g.getFontRenderContext(); /* * Font font1 = Font.createFont(Font.TRUETYPE_FONT, new * File("C:\\Users\\saradhi\\Desktop\\Pacifico.ttf")); font1.deriveFont(9f); */ Font font = new Font(Font.SANS_SERIF, Font.BOLD, 120); GlyphVector gv = font.createGlyphVector(frc, name); Rectangle2D box = gv.getVisualBounds(); int xOff = 25+(int)-box.getX(); int yOff = 80+(int)-box.getY(); Shape shape = gv.getOutline(xOff,yOff); g.setClip(shape); g.drawImage(backImgB,0,0,null); g.setClip(null); g.setStroke(new BasicStroke(2f)); g.setColor(Color.BLACK); g.setRenderingHint( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g.draw(shape); g.dispose(); File file = new File("cat-text.png"); ImageIO.write(textImage,"png",new File("C:\\Users\\saradhi\\Desktop\\resultEX.jpeg"));
<java>
2019-10-07 14:01:03
LQ_EDIT
58,272,830
Python crashing on MacOS 10.15 Beta (19A582a) with "/usr/lib/libcrypto.dylib"
<p>I ran my Django project with new macOS Catalina and was running fine.<br> I installed oh_my_zsh then I tried to run the same project it is crashing with the following errors. I uninstalled oh_my_zsh and tried again but it did not worked.</p> <pre><code>Path: /usr/local/Cellar/python/3.7.4_1/Frameworks/Python.framework/Versions/3.7/Resources/Python.app/Contents/MacOS/Python Identifier: Python Version: 3.7.4 (3.7.4) Code Type: X86-64 (Native) Parent Process: Python [7526] Responsible: Terminal [7510] User ID: 501 Date/Time: 2019-10-07 20:59:20.675 +0530 OS Version: Mac OS X 10.15 (19A582a) Report Version: 12 Anonymous UUID: CB7F20F6-96C0-4F63-9EC5-AFF3E0989687 Time Awake Since Boot: 3000 seconds System Integrity Protection: enabled Crashed Thread: 0 Dispatch queue: com.apple.main-thread Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 Exception Note: EXC_CORPSE_NOTIFY Application Specific Information: /usr/lib/libcrypto.dylib abort() called Invalid dylib load. Clients should not load the unversioned libcrypto dylib as it does not have a stable ABI. </code></pre>
<python><oh-my-zsh><libcrypto><macos-catalina>
2019-10-07 15:37:12
HQ
58,273,101
why am I getting null results?Please give me a solution
User Table (users): id,email,password Post table (posts) : id,user_id,title,body //here i am using Post Model My User Model contains: public function posts(){ return $this->hasOne('App\Post'); }
<laravel>
2019-10-07 15:53:47
LQ_EDIT
58,273,596
Right Outer Join Significance
<p>Though we can achieve the same result when we put right table in left and use left outer join. Then what is the significance of Right Outer Join?</p>
<sql-server><tsql>
2019-10-07 16:27:30
LQ_CLOSE
58,275,616
Footer is not fixed at the bottom (tried most of the answers in stack overflow)
The footer is not fixed at the bottom when the contents of the page are less than the window height. Tried many methods. Nothing seems to work. Below is the screenshot.Please help. contents more than window size:[![][1]][1] contents less than window height: [![enter image description here][2]][2] [1]: https://i.stack.imgur.com/Num3i.png [2]: https://i.stack.imgur.com/s5eoh.png
<html><css><twitter-bootstrap>
2019-10-07 19:00:25
LQ_EDIT
58,276,590
Should I prevent from using position relative and absolute?
<p>I have a friend that deals with web a pretty much time, and he is saying that the standard is almost not using absolute/relative position, especially when you doing responsive design.</p> <p>I am totally beginner, and until now I use for positioning position:absolute or relative. is he right? How do you build a website usually?</p> <p>Thank for response.</p>
<html><css><responsive-design><position>
2019-10-07 20:18:30
LQ_CLOSE
58,278,320
how does Collections.binarySearch() with comparator work when the input is not in sorted?
<p>I am confused that this method doesn't work as expected:</p> <p>public static int binarySearch(List list, T key, Comparator c)</p> <p>here is my code</p> <pre><code>// Create a list List&lt;Domain&gt; l = new ArrayList&lt;Domain&gt;(); l.add(new Domain(10, "quiz.geeksforgeeks.org")); l.add(new Domain(70, "practice.geeksforgeeks.org")); l.add(new Domain(30, "code.geeksforgeeks.org")); l.add(new Domain(40, "www.geeksforgeeks.org")); l.add(new Domain(20, "practice.geeksforgeeks.org")); l.add(new Domain(21, "practice.geeksforgeeks.org")); // Searching a domain with key value 10. To search // we create an object of domain with key 10. int index = Collections.binarySearch(l, new Domain(31, null),new Comparator&lt;Domain&gt;() { public int compare(Domain u1, Domain u2) { return u1.getId().compareTo(u2.getId()); } }); System.out.println("Found at index " + index); </code></pre> <p>it returns -7 to me which is not correct. From the documentation, it says "The list must be sorted into ascending order according to the specified comparator". Here the sorted list should be :Domain(10...,20,21,30,40,70 I didnt see why the -7?</p>
<java><binary-search>
2019-10-07 23:27:25
LQ_CLOSE
58,278,826
How to deal with values between methods and constructors
<p>Its rough right now, but I'm stuck because I can't find a way to access either digits (an array of integers (it has to be a private array, per the assignment rules)) or size. Is there a way to access constructor variables in methods within the same class?</p> <p>I'm not sure what to try, as I'm still in the very basic stages (only a lesson or two in Java) and I don't know how to continue.</p> <pre><code>public class Zillion { private int[] digits; String strdigits; public Zillion(int size) { int[] digits = new int[size]; } public String toString() { for(int x=0; x&lt;digits.length; x++) { strdigits += digits[x]; System.out.println(strdigits); } return(strdigits); } public static void main(String[] args) { Zillion z = new Zillion(2); System.out.println(z); // 00 2 points } </code></pre> <p>}</p> <p>Below are my errors; System.out.println(z) is supposed to output 00, but it seems the code gets trapped by a NullPointerException when I try to access digits.length in line 10.</p> <pre><code>Exception in thread "main" java.lang.NullPointerException at lab4_carl6188.Zillion.toString(Zillion.java:10) at java.base/java.lang.String.valueOf(String.java:3042) at java.base/java.io.PrintStream.println(PrintStream.java:897) at lab4_carl6188.Zillion.main(Zillion.java:19) </code></pre>
<java>
2019-10-08 00:48:01
LQ_CLOSE
58,282,057
ASP.Net query: adding a value from one table to another table where the ID´s match
So my problem is: I have a club table with a ClubId. This table has a field with the badge reference string. (I´ll acces the Picture itself through wwwroot). I now have a table with results. This results table has a hometeamId a hometeambadge field thats still empty and a awayteamId and a awayteambadge field thats also empty. I now want to write a methode where I add the badge string from the club table into the results table where the ClubId is equal to the hometeamId and the awayteamId. How do I do this in a query in ASP.Net Core ?
<c#><asp.net><asp.net-core><razor-pages>
2019-10-08 07:41:40
LQ_EDIT
58,282,730
How does append() work in this code snippet? Confused with a particular variable
<p>Can someone explain this code to me? More specifically, the part about lead.append([sum1 - sum2 , 1]) and print(ans[1],ans[0]). </p> <p>I do not understand the "1" in "lead.append([sum1 - sum2 , 1])"</p> <p>I, also, do not understand the "1" and "0" in print(ans[1],ans[0]). </p> <pre class="lang-py prettyprint-override"><code>lead = [] sum1 , sum2 = 0 , 0 for i in range(int(input())): a1 , a2 = map(int, input().split()) sum1 += a1 sum2 += a2 if sum1&gt;sum2: lead.append([sum1 - sum2 , 1]) else: lead.append([sum2 - sum1 , 2]) ans = max(lead) print(ans[1],ans[0]) </code></pre> <p>Thanks.</p>
<python><function><append>
2019-10-08 08:30:35
LQ_CLOSE
58,282,941
LocalDate and LocalDateTime depend on ZonedDateTime
<p>Why are the methods:<br><br> <code>public ZonedDateTime atStartOfDay(ZoneId zone)</code> from class <strong>LocalDate</strong><br> <br>and<br><br> <code>public ZonedDateTime atZone(ZoneId zone)</code> from class <strong>LocalDateTime</strong><br> <br>adding dependencies to <strong>ZonedDateTime</strong>?<br><br> They look like "util" methods from <strong>ZonedDateTime</strong> and are in fact creating dependencies from classes (<strong>LocalDate</strong> and <strong>LocalDateTime</strong>) that shouldn't know anything about time zones.<br><br> Also, there are a lot more "util" methods that could be added to those classes to "help" with time zones.<br><br> Is this the best approach in terms of architecture?</p>
<java><architecture><localdate><zoneddatetime>
2019-10-08 08:45:09
LQ_CLOSE
58,283,022
PYTHON: Find duplicate elements in the first index of each item and removing items based on the second index
<p>I have a 2D array storing a name and score for different people. The program should sort through the array, and if there are multiple scores per person, it should remove them all except the highest one.</p> <pre><code>scores = [["Alexander", 7], ["Lucy", 4], ["Kieran", 5], ["Alexander", 4]] </code></pre> <p>Should remove ["Alexander", 4] as there are two items in the array with name "Alexander" and 4 is the lowest score out of them both.</p>
<python><multidimensional-array>
2019-10-08 08:50:51
LQ_CLOSE
58,284,447
How do I enable DataTable JS?
I am trying to make a function table to be a data table but as a noob am failing. I want search and pagination Datatable. Can anyone help? $(document).ready(function(){ function fetch_data() { $.ajax({ url:"fetch.php", method:"POST", dataType:"json", success:function(data) { var html = ''; for(var count = 0; count < data.length; count++) { html += '<tr>'; html += '<td><input type="checkbox" id="'+data[count].id+'" data-name="'+data[count].name+'" data-address="'+data[count].address+'" data-gender="'+data[count].gender+'" data-designation="'+data[count].designation+'" data-age="'+data[count].age+'" class="check_box" /></td>'; html += '<td>'+data[count].name+'</td>'; html += '<td>'+data[count].address+'</td>'; html += '<td>'+data[count].gender+'</td>'; html += '<td>'+data[count].designation+'</td>'; html += '<td>'+data[count].age+'</td></tr>'; } $('tbody').html(html); } }); } fetch_data();
<javascript><jquery><datatables>
2019-10-08 10:20:20
LQ_EDIT
58,284,787
If condiction with two different diferent values for same variable
I have to allow upload of two different types of image dimension image can either be of width 370 or 602 how can i check it using if image width `370 or 602` with if statement. If image width are correct then it is okay otherwise i delete the file. below code always fails even as either if dimension doesnt match. how can i make below to allow either dimension using System; public class Program { public static void Main() { Console.WriteLine("Hello World"); int imgW = 370; // assuming image width is 370 if (imgW != 370 || imgW != 602) { Console.WriteLine("One"); } else { Console.WriteLine("Two"); } } }
<c#>
2019-10-08 10:42:52
LQ_EDIT
58,285,266
Simulate external webservice for integration test
<p>I have to simulate external webservice, specially SOAP webservice, to run integration test in java.</p> <p>Any suggestion?</p>
<java><testing><integration-testing>
2019-10-08 11:14:27
LQ_CLOSE
58,285,922
Shorten code to check conditions in switch
<p>How to short my code? To do not describe all the numbers.</p> <pre><code>func counter(_ count: Int) -&gt; String { switch count { case 1, 21, 31, 41, 51, 61, 71, 81, 91, 101, 121, 131, 141, 151, 161, 171, 181, 191, 201, 221, 231, 241, 251, 261, 271, 281, 291, 301, 321, 331, 341, 351, 361, 371, 381, 391, 491, 501: return "\(searchAmong) \(count) \(photographer)" case 2...4, 22...24, 32...34, 42...44, 52...54, 62...64, 72...74, 82...84, 92...94, 102...104: return "\(searchAmong) \(count) \(photographerss)" case 5...20, 25...30, 35...40, 45...50, 55...60, 65...70, 75...80, 85...90, 95...100, 105...110: return "\(searchAmong) \(count) \(photographers)" default: let nothingToSearch = NSLocalizedString("Nothing to search :(", comment: "Нечего искать :(") return nothingToSearch } } </code></pre>
<ios><swift><xcode><switch-statement>
2019-10-08 11:58:18
LQ_CLOSE
58,287,164
SQL SEPARETE FOR SP
ABOUT : SQL MANAGEMENT STUDIO STORAGE PROSEDURE The following variables '|' I want to separate it from . How can I do it. '628391|28100|8304|3|1201129|12|Kg|M01|SERIOUSLY CHUNKY WOOL' '627452|70462|618|60|100059|72|Ad|M01|THICK & QUICK STRIPES' '617213|99233|89|10|18754|12|Kg|M01|FASHION KC ARAN 400'
<sql><sql-server>
2019-10-08 13:17:25
LQ_EDIT
58,287,522
Strange output in a while loop(C language)
<p>i just started learning C and don't understand why does the code segment below output 30. And why it doesn't output a number each iteration.</p> <pre><code>int k=3, f=3; while (k&lt;10) K++; f*=k; printf("%d", f); </code></pre> <p>And when added curly braces it outputs 1814400, which in my opinion is the correct output</p> <pre><code>int k=3, f=3; while (k&lt;10){ K++; f*=k; } printf("%d", f); </code></pre> <p>Could you explain why outputs are different? </p>
<c><loops><while-loop><output>
2019-10-08 13:37:42
LQ_CLOSE
58,288,242
Cross-site resource at <URL> was set without the `SameSite` attribute .NET
<p>How to solve <code>SameSite</code> attribute?</p> <p>:1 A cookie associated with a cross-site resource at <a href="http://doubleclick.net/" rel="noreferrer">http://doubleclick.net/</a> was set without the <code>SameSite</code> attribute. A future release of Chrome will only deliver cookies with cross-site requests if they are set with <code>SameSite=None</code> and <code>Secure</code>. You can review cookies in developer tools under Application>Storage>Cookies and see more details at <a href="https://www.chromestatus.com/feature/5088147346030592" rel="noreferrer">https://www.chromestatus.com/feature/5088147346030592</a> and <a href="https://www.chromestatus.com/feature/5633521622188032" rel="noreferrer">https://www.chromestatus.com/feature/5633521622188032</a>.</p> <p>same for google.com, linkedin, facebook.com, twitter.com. etc</p> <p>Unable to add 'Samesite' attributes. What will be the best way to get this solve?</p>
<google-chrome><cookies><samesite>
2019-10-08 14:19:10
HQ
58,289,315
Polymorphic Relationship With Laravel
<p>I have the photo that can be belongs to a post and comment, So i have created <code>photos table</code> which have these columns</p> <pre><code>- photable_id - photable_type - user_id - file_name </code></pre> <p>The question is: what if i have a photo that belongs to a post and the same photo belongs to another post or comment ?</p>
<laravel>
2019-10-08 15:15:48
LQ_CLOSE
58,291,437
I Copied the code recommended by google, howeverI receive a syntax error
So I copied the python code that google cloud recommends to you, iv tried it in Jyputer notebooks and as a python file but I still get syntax error def predict(content, project_id, model_id): print predict("1.jpg", ispace-254720, ICN886814670746214838) File "<ipython-input-16-a9c7141e2bf3>", line 1 print predict("1.jpg", ispace-254720, ICN886814670746214838) ^ SyntaxError: invalid syntax
<python><google-cloud-platform><automl>
2019-10-08 17:38:55
LQ_EDIT
58,292,474
Using DateTime.TryParseExact C#
<p>I dont know how TryParseExact method works in a sample date format: This is the format: (<strong>Beginning: 2019.06.30. 14:56:43</strong>) And how to tell to TryParseExact this format?</p>
<c#><.net><datetime><tryparse>
2019-10-08 18:57:14
LQ_CLOSE
58,293,209
Mi subconsulta solo me muestra un registro y agrego mas y ya no los muestra me manda error,la estoy haciendo en SQL Server 2014
SELECT ListaMaestra.id_ListaMaestra,ListaMaestra.Clave,ListaMaestra.Nombre_P,ListaMaestra.Modulo_P,ListaMaestra.Caracteristicas,ListaMaestra.Tipo_Formato, ListaMaestra.Fecha_Emision,ListaMaestra.Fecha_Revision,ListaMaestra.Revision,ListaMaestra.Norma,empleado.nombre,cargo.nombre_cargo, (select empleado.nombre from ListaMaestra,empleado WHERE ListaMaestra.Nombre_Reviso = empleado.id_empleado) AS Nombre_Elaboro, (select cargo.nombre_cargo from ListaMaestra,cargo WHERE ListaMaestra.Cargo_Reviso = cargo.id_cargo) AS Cargo_Elaboro,ListaMaestra.Estatus,ListaMaestra.Ruta_PDF FROM ListaMaestra,empleado,cargo WHERE ListaMaestra.Nombre_Elaboro = empleado.id_empleado AND ListaMaestra.Cargo_Elaboro = cargo.id_cargo
<sql><sql-server><sql-server-2014>
2019-10-08 19:54:23
LQ_EDIT
58,293,578
Conventional For Loop vs Enhanced For Loop
<p>This code: </p> <pre><code>import java.util.*; import java.io.*; class TestClass { public static void main(String args[] ) throws Exception { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int arr[] = new int[n]; for(int i = 0; i &lt; n; i++) arr[i] = sc.nextInt(); for(int i : arr) System.out.println(arr[i]); } } </code></pre> <p>Outputs: </p> <pre><code>2 3 4 1 2 </code></pre> <p>With this Input: </p> <pre><code>5 1 1 2 3 4 1 </code></pre> <p>On the other hand This Code:</p> <pre><code>import java.util.*; import java.io.*; class TestClass { public static void main(String args[] ) throws Exception { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int arr[] = new int[n]; for(int i = 0; i &lt; n; i++) arr[i] = sc.nextInt(); for(int i = 0; i &lt; n; i++) System.out.println(arr[i]); } } </code></pre> <p>Outputs:</p> <pre><code>1 2 3 4 1 </code></pre> <p>In the first code snippet the foreach loop should print the elements of the array but I don't understand what are those numbers and how those numbers are the elements of that array.</p>
<java><for-loop><foreach>
2019-10-08 20:22:07
LQ_CLOSE
58,294,051
Using classes vs constructor functions in TypeScript
I am starting to write my first little app in TypeScript. Before, I did a lot of reading on the JavaScript classes and how *bad* and *fake* they are in JavaScript. That's why I decided to use good old constructor functions in my TS application, but after I wrote my first interface, a problem arose - how do I implement it in my constructor function? Let's say I have an interface: ``` interface WebScraper { url: string, getRawContent(): string, } ``` when I used classes I would simply code ``` class Scraper implements WebScraper { //... } ``` but how do I do it for a constructor function? I will be using it with the `new` keyword so it will return an object with specific properties. Would that be correct then, if I specify the interface as the return type? ``` function Scraper(): WebScraper { //... } ``` I actually tried that and got an error ``` error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value. ``` How do I solve this then?
<typescript>
2019-10-08 21:02:56
LQ_EDIT
58,297,004
hello i followed simcoder uber app and got the app in his github but whene i try to log in as a customer the app crash
10-09 12:04:27.809 17199-17199/com.simcoder.uber E/AndroidRuntime: FATAL EXCEPTION: main Process: com.simcoder.uber, PID: 17199 java.lang.IllegalArgumentException: Not a valid geo location: 120.8281794, 14.8458765 at com.firebase.geofire.GeoLocation.<init>(GeoLocation.java:51) at com.simcoder.uber.CustomerMapActivity.getDriversAround(CustomerMapActivity.java:540) at com.simcoder.uber.CustomerMapActivity.access$2300(CustomerMapActivity.java:74) at com.simcoder.uber.CustomerMapActivity$10.onLocationResult(CustomerMapActivity.java:483) at com.google.android.gms.internal.zzcec.zzt(Unknown Source) at com.google.android.gms.common.api.internal.zzcl.zzb(Unknown Source) at com.google.android.gms.common.api.internal.zzcm.handleMessage(Unknown Source) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5541) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:853) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:737)
<android>
2019-10-09 04:18:10
LQ_EDIT
58,297,211
powershell: split strings
Can you please suggest me on how to get the output using split or any other commands using powershell *string = "version(2.3.4)_stack_over_flow.zip" required output : "stack_over_flow"*
<regex><powershell><split>
2019-10-09 04:45:51
LQ_EDIT
58,298,742
Display all the columns in employees table along with average salary of each dept
<p>i want a query to display all the columns in employees table along with average salary of each department.</p>
<sql><oracle>
2019-10-09 07:06:16
LQ_CLOSE
58,298,838
Read a file name and create a column with it
<p>i have a filename called shoes_2016, how do I create a dataframe column called year and extract out the year according to the filename.</p>
<python><pandas><dataframe>
2019-10-09 07:11:52
LQ_CLOSE
58,300,894
How can I get Radio to work on flutter when using dynamic object?
I'm new to flutter and I have issues with Radio. I got it to work perfectly when using the "regular" method: int _groupValue=-1; ... ... child: Align( alignment: Alignment.center, child: Column( children: <Widget>[ RadioListTile(activeColor: Colors.black, groupValue: _groupValue, value: 1, onChanged: (value) { setState(() { _groupValue=value; }); }, title: Text("a"), ), RadioListTile(activeColor: Colors.black, groupValue: _groupValue, value: 2, onChanged: (value) { setState(() { _groupValue=value; }); }, title: Text("b"), ), ], ), ), Since i'm using data from API to create the radio buttons i've changed this code to this: child: Align( alignment: Alignment.center, child: children: radioListView ), ), and on click of a button i call async method to download the data from the API and like this : void getApiData() async { ... ... ... setState() { var radioListView = List<RadioListTile>(); for (Map<String, dynamic> c in apidata)) { radioListView.add(new RadioListTile( groupValue: _groupValue, value: c['option_value'], title: c['title'], onChanged: (value) { setState(() { _groupValue=value; }); ), )); } } } using the first code it works but using the second code i just get to see the items but nothing happens when i click on the radio buttons (although the onchanged does triggers because i tried to print the value and it's fine) what am I doing wrong ?
<flutter><flutter-radiobutton>
2019-10-09 09:19:31
LQ_EDIT
58,301,326
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'user_shops' in 'where clause' (SQL: select * from `shops` where `user_shops` = 233 limit 1)
[Error Image ][1]**Working on a Multi vendor website . Suddenly got this error when shop/vendor user want to login no problem normal user** Here two type user one is vendor or ShopOwner/ another one normal Customer when vendor want to logging got this error. But normal user no Problem facing for login. Added new column but problem is continue SQL integrity Error. **Here is Login Controller.** > Details for Login Controller public function userlogin(Request $request){ $data = Cart::getContent(); $this->validate($request, [ 'email' => 'required', 'password' => 'required', ],[ 'email.required' => 'Email not matched with Database!', 'password.required' => 'Password not matched with Database!', ]); $checkUserInput = filter_var($request->input('email'), FILTER_VALIDATE_EMAIL)?'email': 'username'; $user = Auth::guard('web')->attempt([$checkUserInput => $request->email,'password'=>$request->password]); if($user == 'true'){ if(Auth::user()->is_activated == 1){ if(count($data)>0){ if(count(Cart::session(Auth::user()->id)->getContent())>0){ foreach ($data as $key => $value) { if(!Cart::session(Auth::user()->id)->get($value->id) ){ Cart::session(Auth::user()->id)->add($value->id, $value->name,$value->price,$value->quantity, $value->image,array('color' => $value->attributes->color)); }else{ Cart::session(Auth::user()->id)->update($value->id, array( 'quantity' => array( 'relative' => false, 'value' => $request->quantity ), 'attributes' => array( 'color' => $value->attributes->color ), )); } } }else{ foreach ($data as $key => $value) { Cart::session(Auth::user()->id)->add($value->id, $value->name,$value->price,$value->quantity, $value->image,array('color' => $value->attributes->color)); } } } if(Auth::user()->user_type == 2){ $model = Shop::where('user_id',Auth::user()->$user_id)->first(); if($model){ if($request->previous){ return redirect()->route('neneMart.dashboard'); }else{ return Redirect::to($request->previous); } }else{ if(empty($request->previous)){ return redirect()->route('create-shop'); }else{ return Redirect::to($request->previous); } } }else{ if(empty($request->previous)){ return redirect()->route('home'); }else{ return Redirect::to($request->previous); } } } else{ return redirect()->route('user-login')->with(Auth::logout())->with('error', 'User email has not been activated yet!'); } }else{ return redirect()->route('user-login')->with('error', 'Whoops! Wrong Email or Username or Password !'); } }` > ROUTE Route:: get('user-login', 'Auth\LoginController@usershowLoginForm')->name('user-login'); Route:: post('userLogin', 'Auth\LoginController@userlogin')->name('userLogin'); > Shop Management Controller public function index() { $shop = Shop::where('user_id',Auth::user()->id)->first(); $model = ShopManagement::where('shop_id','Nenemart-'.$shop->id)->first(); $shopid = 'Nenemart-'.$shop->id; $agent = new Agent(); if($agent->isMobile() || $agent->isTablet()){ return view('mobile.mart.shopmanagemnt',compact('model','shopid')); }else{ return view('frontend.mart.shopmanagemnt',compact('model','shopid')); } } public function vendorShop(){ $shop = Shop::where('user_id',Auth::user()->id)->first(); $model = ShopManagement::where('shop_id','Nenemart-'.$shop->id)->first(); $vendorProducts = Product::orderBy('id', 'dese')->where('created_by', $shop->id)->where('type', 1)->get(); $agent = new Agent(); if($agent->isMobile() || $agent->isTablet()){ return view('mobile.mart.vendorShop',compact('model', 'vendorProducts')); }else{ return view('frontend.mart.vendorShop',compact('model', 'vendorProducts')); } } **Error** [1]: https://i.stack.imgur.com/CtD6W.jpg
<mysql><sql><laravel>
2019-10-09 09:43:01
LQ_EDIT
58,301,481
Is it possible to write a multi-database query with PHPMyAdmin?
<p>I need to create a query which connects to different databases with different users. Every database has its own user.</p> <p>Can I achieve this with PHPMyAdmin?</p>
<php><mysql><phpmyadmin>
2019-10-09 09:51:10
LQ_CLOSE
58,302,546
Can anyone assist me with this question from Project Euler. Which Algorithm would i use?
Given a list containing Province, CustomerName and SalesValue (sorted by Province and CustomerName), describe an algorithm you could use that would output each CustomerName and SalesValue with the total SalesValue per Province.
<sql><database>
2019-10-09 10:53:18
LQ_EDIT
58,302,885
Map roles to REST API
How to do role validation for REST API's. I have 2 roles called "admin" and "manager" REST API's : /users -> POST /users -> GET "admin" role can access both the API's but "manager" can access only GET API.
<spring-boot><api-gateway>
2019-10-09 11:14:02
LQ_EDIT
58,302,929
what is the correct way to write this mysql query?? "SELECT SUM(buyingPrice-(buyingPrice*10/100))"
<p>what is the correct way to write this mysql query?? "SELECT SUM(buyingPrice-(buyingPrice*10/100))" I wanna get the calculation done by the query?? Is this even possible?? </p>
<mysql><sql>
2019-10-09 11:16:52
LQ_CLOSE
58,303,094
Hii guys ,i have been trying to solve a problem where from a given list you have to remove a given element. list1=[0,1,2,2,3,0,4,2], remove_element=2
def fun(list1,remove_element): if len(list1)==0: return 0 for i in range(len(list1)): if remove_element==list1[i]: list1.remove(remove_element) return list1 here is the error i get: <pre> Traceback (most recent call last): File "<pyshell#205>", line 1, in <module> print(fun(list1,remove_element)) File "<pyshell#204>", line 5, in fun if remove_element==list1[i]: IndexError: list index out of range </pre>
<python><list><indexing><range>
2019-10-09 11:27:21
LQ_EDIT
58,303,132
How to Access Variable's Memory Address In Java?
<p>I wrote this code and want to see memory location of 2 objects that i create from one class and make instance of one specific variable.</p> <pre><code>public class StaticFields { int a = 12; int b = 235; public static void main(String[] args) { StaticFields obj = new StaticFields(); int a = obj.a; StaticFields obj2 = new StaticFields(); int c = obj2.a; System.out.println(System.identityHashCode(a)); System.out.println(System.identityHashCode(c)); } } </code></pre> <p>why the "identityHashCode" of "a" and "c" is the same ?</p> <p>Thanks.</p>
<java><oop><variables>
2019-10-09 11:29:51
LQ_CLOSE
58,304,016
how to add 2 column with respect of group
<p>I want to add column a and b separately sum.a and sum.b with respect of group SAMPN</p> <p>Output:</p> <pre><code>SAMPN a b 1 1 2 1 3 5 2 1 1 2 7 4 </code></pre> <p>output</p> <pre><code>SAMPN a b sum.a sum.b 1 1 2 4 7 1 3 5 4 7 2 1 1 8 5 2 7 4 8 5 </code></pre>
<r><dataframe>
2019-10-09 12:20:31
LQ_CLOSE
58,304,278
How to fix 'character map file `UTF-8' not found'
<p>I'm setting up a UBI rhel8 container. I need to execute this command:</p> <pre class="lang-sh prettyprint-override"><code>localedef -f UTF-8 -i en_US en_US.UTF-8 </code></pre> <p>which failed with:</p> <pre><code>character map file `UTF-8' not found: No such file or directory cannot read character map directory `/usr/share/i18n/charmaps': No such file or directory </code></pre>
<utf-8><locale><redhat-containers>
2019-10-09 12:36:43
HQ
58,306,405
why main function isn't returning any value?
/*I am trying to return the 1st bit of boolean value of 10 using right shift in the cb function.*/ ```#include <stdio.h> #include<stdbool.h> bool cb(int N,int i){ //`called function` return ((N>>i)&1)==1; } int main(void) { //`main function` cb(10,1); //`function calling` return 0; } ``` //Status:successfully Executed,but no output.
<c>
2019-10-09 14:25:35
LQ_EDIT
58,308,169
docker for mac memory usage in com.docker.hyperkit
<p>I'm running docker desktop community 2.1.0.3 on MacOS Mojave. I've got 8GB of memory allocated to Docker, which already seems like a lot (that's half my RAM). Somehow even after exiting and then starting Docker for Mac again, which means no containers are running, docker is already exceeding the memory allocation by 1GB.</p> <p>What is expected memory usage for docker with no containers running? Is there a memory leak in docker for mac or docker's hyperkit?</p> <p><a href="https://i.stack.imgur.com/bHNKq.png" rel="noreferrer"><img src="https://i.stack.imgur.com/bHNKq.png" alt="enter image description here"></a></p> <p><a href="https://i.stack.imgur.com/ZEWFw.png" rel="noreferrer"><img src="https://i.stack.imgur.com/ZEWFw.png" alt="docker for mac memory leak"></a></p>
<docker><memory-leaks><docker-for-mac>
2019-10-09 16:06:57
HQ
58,308,266
why I have an empty Row in the end of my greedview?
I have always an emty row in the end of my grid View gv_remboursement.DataSource = listResult; gv_remboursement.VirtualItemCount = iTotal; gv_remboursement.DataBind(); listResultContent.Visible = isVisible; listResult contains the list that I fill from the data base
<c#><html><asp.net><.net>
2019-10-09 16:12:48
LQ_EDIT
58,308,725
How to implement a magnifying glass in the index list of an UITableView?
<p>I want to implement a magnifying glass in the index list of an UITableView in Swift. Here is how it should look like:</p> <p><a href="https://i.stack.imgur.com/42qlW.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/42qlW.jpg" alt=""></a> Is there a simple way to achieve it? The magnifying glass should be a button. By pressing this button something like</p> <pre class="lang-swift prettyprint-override"><code>tableView.scroll(to: .top, animated: true) </code></pre> <p>should be executed...</p> <p>Thanks for your help!</p>
<ios><swift><uitableview>
2019-10-09 16:42:41
LQ_CLOSE
58,309,618
Regex to accept all type of files except one (NIFI)
<p>What will be the regular expression to accept all type of file formats except zip format?</p> <pre><code>.* </code></pre> <p>accepts all types of files. But I don't want zip files. So what will be regex in this case?</p> <p>Thanks.</p>
<regex>
2019-10-09 17:48:35
LQ_CLOSE