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
55,441,978
For Loops in Python to iterate over id for each item in column
I want to iterate over a dataframe so for each id and for each fruit, so that for each fruit there is a the other fruits associated with that id and the prices of both. [example and expected results][1] [1]: https://i.stack.imgur.com/6Fvhh.png
<python>
2019-03-31 14:33:56
LQ_EDIT
55,442,571
How to export an Angular Material Table into a pdf as well as csv, which should be downloaded on click of a button
<p>I am using Angular Material Table, to show data, which i am getting from an API call. The question now is, how can I export the Mat-Table data into a PDF and a CSV on click of a button, any Angular Modules which can help me serve my purpose.</p> <p>Thanks</p>
<javascript><angular><frontend><mat-table>
2019-03-31 15:40:51
LQ_CLOSE
55,442,723
React-native-camera error when compiling android
<p>I tried to upgrade my react native project to the newest version (0.59.2). Unfortunately, now when trying to run react-native run-android im getting this error:</p> <pre><code>Could not determine the dependencies of task ':app:preDebugBuild'. &gt; Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'. &gt; Could not resolve project :react-native-camera. Required by: project :app &gt; Cannot choose between the following variants of project :react-native-camera: - generalDebugRuntimeElements - mlkitDebugRuntimeElements All of them match the consumer attributes: - Variant 'generalDebugRuntimeElements': - Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found compatible value 'debug'. - Found com.android.build.api.attributes.VariantAttr 'generalDebug' but wasn't required. - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'. - Required org.gradle.usage 'java-runtime' and found compatible value 'java-runtime'. - Found react-native-camera 'general' but wasn't required. - Variant 'mlkitDebugRuntimeElements': - Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found compatible value 'debug'. - Found com.android.build.api.attributes.VariantAttr 'mlkitDebug' but wasn't required. - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'. - Required org.gradle.usage 'java-runtime' and found compatible value 'java-runtime'. - Found react-native-camera 'mlkit' but wasn't required. </code></pre> <p>I have already tried to create a new project however this results in the same error. Reinstalling the node modules didn't help either. On iOS it works fine.</p>
<reactjs><react-native><react-native-camera>
2019-03-31 15:56:37
HQ
55,442,878
Organize local code in packages using Go modules
<p>I can not find a way to factor out some code from <code>main.go</code> into a local package when using Go modules (go version >= 1.11) outside of <code>$GOPATH</code>.</p> <p>I am not importing any external dependencies that need to be included into <code>go.mod</code>, I am just trying to organize locally the source code of this Go module.</p> <p>The file <code>main.go</code>:</p> <pre class="lang-golang prettyprint-override"><code>package main // this import does not work import "./stuff" func main() { stuff.PrintBaz() } </code></pre> <p>The file <code>./stuff/bar.go</code> (pretending to be a local package):</p> <pre class="lang-golang prettyprint-override"><code>package stuff import "log" type Bar struct { Baz int } func PrintBaz() { baz := Bar{42} log.Printf("Bar struct: %v", baz) } </code></pre> <p>The file <code>go.mod</code> (command <code>go mod init foo</code>):</p> <pre><code>module foo go 1.12 </code></pre> <p>When executing <code>go run main.go</code>:</p> <ul> <li>If I <code>import "./stuff"</code>, then I see <code>build command-line-arguments: cannot find module for path _/home/&lt;PATH_TO&gt;/fooprj/stuff</code>.</li> <li>If I <code>import "stuff"</code>, then I see <code>build command-line-arguments: cannot load stuff: cannot find module providing package stuff</code>.</li> <li>If I <code>import stuff "./stuff"</code> with a package alias, then I see again: <code>build command-line-arguments: cannot find module for path _/home/&lt;PATH_TO&gt;/fooprj/stuff</code>.</li> </ul> <p>I can not find a way to make local packages work with go modules.</p> <ul> <li>What's wrong with the code above?</li> <li>How can I import local packages into other Go code inside a project defined with Go modules (file <code>go.mod</code>)?</li> </ul>
<go><go-modules><go-packages>
2019-03-31 16:15:06
HQ
55,443,215
How do you implement the inverse of bit shift operations in C?
<p>When reverse engineering C code that uses bit shift operations, I'm confused on the methodology behind getting the inverse the code below.</p> <pre><code>unsigned char red = 37; unsigned char blue = 100; unsigned char green = 77 unsigned short us = (red &lt;&lt; 8) + (blue); us = (us &lt;&lt; 5 ) | (us &gt;&gt; 11); unsigned int threebytes = (us &lt;&lt; 8) + green; </code></pre> <p>Since NOT is the operation for inverting bits, I assumed I could implement a NOT to invert the bits at each line or at the end of the code, however, my result doesn't match up with the expected output which leads me to believe that I've come to a misunderstanding. What am I not understanding about reverse engineering?</p>
<c><bit-manipulation><reverse-engineering>
2019-03-31 16:54:16
LQ_CLOSE
55,443,785
How to create dynamic link when share button is clicked in android with Firebase?
<p>I want to share user posts with dynamic link so that when anyone clicks the link it opens the app with that post's detail. But I am unable to find any good tutorial. Can anyone help me to create this? </p>
<android><firebase><firebase-dynamic-links>
2019-03-31 17:54:59
LQ_CLOSE
55,443,797
Why do the following comparisons give different results?
<p>I'm trying to compare the following two quantities: an integer 'i' and the size of a vector v.</p> <pre><code>#include &lt;vector&gt; #include &lt;iostream&gt; using namespace std; int main() { vector &lt;int&gt; v(26,0); int i = -1; cout &lt;&lt; i &lt;&lt; " " &lt;&lt; v.size() &lt;&lt; endl; if (i &lt; v.size()) cout &lt;&lt; "a1" &lt;&lt; endl; else cout &lt;&lt; "b1" &lt;&lt; endl; if (-1 &lt; 26) cout &lt;&lt; "a2" &lt;&lt; endl; else cout &lt;&lt; "b2" &lt;&lt; endl; return 0; } </code></pre> <p>When I run the following code, the output that I get is: -1 26 b1 a2</p> <p>whereas I expect it to give: -1 26 a1 a2</p> <p>Why is this happening?</p>
<c++><stl>
2019-03-31 17:56:15
LQ_CLOSE
55,447,023
How do I defer shell completion to another command in bash and zsh?
<p>I am attempting to write a shell script utility that wraps other shell utilities into a single CLI and am trying to get shell completion to work in zsh and bash.</p> <p>For example, let's say the CLI is named <code>util</code>:</p> <pre><code>util aws [...args] #=&gt; runs aws util docker [...args] #=&gt; runs docker util terraform [...args] #=&gt; runs terraform </code></pre> <p>What I would like, ideally, is a way in zsh and bash completion to be able to say "complete this subcommand X like other command Y" independently from the implementation of the completion for the wrapped scripts.</p> <p>Something like:</p> <pre><code>compdef 'util aws'='aws' compdef 'util docker'='docker' compdef 'util terraform'='terraform' </code></pre> <p>A stretch goal would be to allow for completion of an arbitrary sub-command to a subcommand in another binary:</p> <pre><code>util aws [...args] #=&gt; completes against `aws` util ecr [...args] #=&gt; completes against `aws ecr` </code></pre> <p>Is any of this possible? I've been attempting to emulate the completion scripts of the individual binaries, however there is significant variation in how other completion scripts are written.</p>
<bash><zsh><bash-completion><completion><zsh-completion>
2019-04-01 01:25:20
HQ
55,447,073
Calculate the estimated travel time Google Maps
<p>How can I calculate the estimated travel time on a route with react and google-maps?</p>
<javascript><reactjs><react-google-maps>
2019-04-01 01:34:51
LQ_CLOSE
55,447,200
Kentico 9 Email Marketing
<p>Whenever we send out a marketing email campaign, the emails seem to be sent out roughly every 3 minutes:</p> <p><a href="https://i.stack.imgur.com/yYCr5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yYCr5.png" alt="enter image description here"></a></p> <p>Where would I find the admin setting to increase this frequency to say every 5 seconds?</p>
<email><kentico>
2019-04-01 01:54:13
LQ_CLOSE
55,449,162
https://api.instagram.com/oauth/authorize api login error
<p>Instagram login API is in use. After approving the app, the following error occurs.</p> <p>The user denied your request.</p> <p>It worked well until yesterday. What's the problem?</p>
<instagram><instagram-api>
2019-04-01 06:26:40
HQ
55,450,069
not a pbm, pgm or ppm file. by ocrad
<p>I'm sending a book page photo from browser to PHP. I'm writing the photo to disk using this:</p> <pre><code>$decoded = base64_decode($img); file_put_contents($output_file, $decoded); </code></pre> <p>However when I run <a href="https://www.gnu.org/software/ocrad/" rel="nofollow noreferrer">ocrad</a>/<a href="http://jocr.sourceforge.net/" rel="nofollow noreferrer">gocr</a> for the image then <code>gocr</code> shows error </p> <blockquote> <p>"bad magic bytes, expect 0x50 0x3[1-6] but got 0xff 0xd8"</p> </blockquote> <p>while <code>ocrad</code> says </p> <blockquote> <p>"ocrad: bad magic number - not a pbm, pgm or ppm file."</p> </blockquote> <p>What could be the problem?</p>
<php>
2019-04-01 07:32:20
LQ_CLOSE
55,451,174
Trying to get the index of a value in an array in JavaScript
<p>I have three arrays, one of which is in an autocomplete dropdown list. As an item is selected, I would like find its index in the array so that I can use said index in the other two arrays.</p> <p>Is there a simple solution where I can feed an array function a value (i.e. Texas) and get its index number?</p> <p>Thanks </p>
<javascript><arrays>
2019-04-01 08:47:19
LQ_CLOSE
55,451,493
What is window.origin?
<p>What is <code>window.origin</code>? It doesn't seem to be documented in <a href="https://developer.mozilla.org/en-US/docs/Web/API/Window/origin" rel="noreferrer">the usual place</a>.</p> <p>It looks like it might be very similar to <code>window.location.origin</code> - for example, here on Stack Overflow, both return</p> <blockquote> <pre><code>https://stackoverflow.com </code></pre> </blockquote> <p>But inside an <code>iframe</code>, they're different:</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>console.log(window.location.origin); console.log(window.origin);</code></pre> </div> </div> </p> <blockquote> <pre><code>https://stacksnippets.net null </code></pre> </blockquote> <p>The embedded snippet is inside an <code>iframe</code> <em>without</em> <code>allow-same-origin</code>. If you change the iframe, for example, if you edit Stack Overflow's HTML and manually add the attribute:</p> <pre><code>&lt;iframe name="313b857b-943a-7ffd-4663-3d9060cf4cb6" sandbox="allow-same-origin allow-forms allow-modals allow-scripts" class="snippet-box-edit" frameborder="0" style=""&gt; ^^^^^^^^^^^^^^^^^^ </code></pre> <p>and then run the snippet, you get:</p> <blockquote> <pre><code>https://stacksnippets.net https://stacksnippets.net </code></pre> </blockquote> <p>The same sort of behavior is exhibited on other sites with <code>&lt;iframe&gt;</code>s.</p> <p><a href="https://www.google.com/search?q=window.origin" rel="noreferrer">Google</a> does not appear to have any authoritative links on the subject. Searching for the <a href="https://www.google.com/search?q=%22window.origin%22+javascript" rel="noreferrer">exact phrase</a> + Javascript gives many results related to <code>iframe</code>s and <code>postMessage</code>, but no precise description of what <code>window.origin</code> <em>actually is</em>.</p> <p>Calling <code>postMessage</code> from a child <code>iframe</code> appears to result in the parent window receiving a message with the <code>origin</code> property matching the <code>window.origin</code> of the child frame - without <code>allow-same-origin</code>, it's <code>null</code>, otherwise it looks like it's the same as the <code>window.location.origin</code> of the child.</p> <p>The above is what I <em>think</em> I've figured out from guessing-and-checking, but I'm nowhere near certain. I'd appreciate a confirmation/explanation, preferably with a link to an authoritative source.</p>
<javascript><html><iframe><cross-domain>
2019-04-01 09:05:01
HQ
55,451,742
How to connect mysql workbench with putty using python language
I have database in mysql workbench and Im using 'Putty' SSH shell to connect to my database using python language. But I am unable to import mysql.connector or mysqlDb ( got this suggestion form w3school) So I am unable to connect to my database. Can Any one please help me with that.
<python><mysql-workbench>
2019-04-01 09:19:18
LQ_EDIT
55,451,949
how to get the full date list based on start and end date using moment js
get the date list based on start and end date using moment js for example, I have two dates, One is a start date and end date. My start date is `2019-04-02` and my end date is `2019-05-16` i need all the date in between these two dates. my output will be `["2019-04-02", "2019-04-03", "2019-04-04", ..., "2019-05-16"]` is it possible in moment js
<javascript><momentjs>
2019-04-01 09:31:41
LQ_EDIT
55,454,156
How to get random number generator to work properly
<p>My code deals with two dice (a 10 sided "fair" dice and a 20 sided "fair" dice) and using classes, arrays and a random number generator to generate random rolls of the two dice and their summation, but all my code spits out is "You rolled: 18". That is not very random. </p> <pre><code> #include &lt;iostream&gt; #include &lt;stdlib.h&gt; using namespace std; class Dice { private: int rollDice[2] = {}; public: void setval1(int x) { rollDice[0] = x; } void setval2(int y) { rollDice[1] = y; } double getVal1() { return rollDice[0]; } double getVal2() { return rollDice[1]; } }; int main() { Dice a; a.setval1(rand()%9+1); a.setval2(rand()%19+1); cout &lt;&lt; "You rolled: " &lt;&lt; a.getVal1() + a.getVal2(); } </code></pre>
<c++><arrays><class><random>
2019-04-01 11:34:26
LQ_CLOSE
55,455,825
How to exchange or return varibale values in different methods within same class in python?
<blockquote> <p>I want to pass a method value to to other method of the same class</p> </blockquote> <pre><code>class abc: def me(self): self.x = 5 def you(self): print('I want to print here -&gt; x = 5') if __name__ == '__main__': SR =abc() SR.you() </code></pre> <blockquote> <p>while calling the method 'you' how can I print the value of x, which is variable of other method</p> </blockquote>
<python>
2019-04-01 13:04:02
LQ_CLOSE
55,456,984
How to create a programm with linked list that destroys the nth element?
I am creating a programm with linked list which has a function that destroys the n-th element of the list and instead places the element whose number is stored in the nth element. I have created a programm that creates a linked list, but I cant find a way that searches for the nth element. ``` struct elem { int value; elem *next; }; int main() { elem *start=NULL, *last; int a[4]={1,2,3,4}; /// creating for(int i=0;i<4;i++) { elem *p = new elem; /// s1 p->value=a[i]; /// s2 p->next=NULL; /// s3 if(start==NULL) start=p; /// s4a else last->next=p; /// s4b last=p; /// s5 } /// printing elem *p=start; while (p!=NULL) { cout<<p->value<<" "; p=p->next; } /// deleting p = start; /// 1 while (p!=NULL) { start = p->next; /// 2 delete p; /// 3 p=start; /// 4 } } ``` Could I get some help here please? really struggling with linked list, thanks in advance!
<c++><algorithm><linked-list>
2019-04-01 14:00:43
LQ_EDIT
55,457,636
How to send a date values to a another class constructor through object and how to get that date values back?
How to send a date values to another class constructor through an object and how to get that date values back?
<java>
2019-04-01 14:34:48
LQ_EDIT
55,458,091
React Hooks and POST method
<p>I need to understand how can I setup a custom hook in React, for a POST method.</p> <p>If I need to POST some data after a click, but I can't use the custom hook in an event handler, how can I do It?</p> <p>I made a custom Hook with all the fetch logic and the relative reducers... but I dunno how to use It in a click, without breaking the rules.</p> <p>Thanks.</p>
<javascript><reactjs><post><fetch>
2019-04-01 14:58:18
HQ
55,458,359
Android studio - how can I add a textview to a linear layout with an onlick listener
how can I add a textview to a linear layout with a onlick button listener? At the moment, the button onclick listener will produce a textview but i don't like it because it looks messy and unorganised I tried doing this: varlinear.addView(varkebabTotal); but it caused an error. I have looked at other examples but they didn't explain how it will work with an onlick listener. Below I added the code for what happens when the button is clicked varKebab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String name = "Kebab Wrap"; if (menu.containsKey(name)) { kebabquantity = list.get(name); if (kebabquantity == null) { kebabquantity = 0; } kebabquantity++; list.put(name, kebabquantity); //kebab qty calc double kebabTotal = kebabquantity * menu.get(name); overallTotal = overallTotal + menu.get(name); varkebabTotal.setText(String.format("%s %s @ £%s = £%.2f", kebabquantity.toString(), name, menu.get(name), kebabTotal)); varTotalPrice.setText(String.format("Total = £%.2f", overallTotal)); varlinear.addView(varkebabTotal); // this line caused an error } } }); What I need is for the textview to be added onto a linear layout where it will look organised and nice. Whenever the button is clicked again, it should replace the old textview and update it again
<java><android>
2019-04-01 15:13:27
LQ_EDIT
55,458,421
ng-template - typed variable
<p>How can parent component recognise type of <code>let-content</code> which comes from <code>ngTemplateOutletContext</code>? Now <code>{{content.type}}</code> works correctly, but IDE says:</p> <blockquote> <p>unresolved variable type</p> </blockquote> <p>How can I type it as <code>Video</code>?</p> <p><strong>parent.component.ts:</strong></p> <pre><code>export interface Video { id: number; duration: number; type: string; } public videos: Video = [{id: 1, duration: 30, type: 'documentary'}]; </code></pre> <p><strong>parent.component.html:</strong></p> <pre><code>&lt;ul&gt; &lt;li *ngFor="let video of videos"&gt; &lt;tile [bodyTemplate]="tileTemplate" [content]="video"&gt;&lt;/app-card&gt; &lt;/li&gt; &lt;/ul&gt; &lt;ng-template #tileTemplate let-content&gt; &lt;h5 class="tile__type"&gt;{{content.type}}&lt;/h5&gt; &lt;/ng-template&gt; </code></pre> <p><strong>tile.component.ts:</strong></p> <pre><code>@Component({ selector: 'tile', templateUrl: './tile.component.html', styleUrls: ['./tile.component.scss'], changeDetection: ChangeDetectionStrategy.OnPush, }) export class CardComponent { @Input() tileTemplate: TemplateRef&lt;any&gt;; @Input() content: Video; } </code></pre> <p><strong>tile.component.html:</strong></p> <pre><code>&lt;div ... &lt;ng-container [ngTemplateOutlet]="tileTemplate" [ngTemplateOutletContext]="{ $implicit: content }"&gt; &lt;/ng-container&gt; ... &lt;/div&gt; </code></pre>
<angular><typescript>
2019-04-01 15:15:50
HQ
55,460,638
Regex, match when there is dash with spaces before and after
Hy guys. I would need a help with writting a regex. I need it to match only when there is a dash detected with spaces before and after. For example: "first - place" I would also need an separate example when there is dash detected with just one space and no space after, for example: "first -place"
<javascript><regex>
2019-04-01 17:32:08
LQ_EDIT
55,463,708
How to differentiate pointer addresses in program
<p>I have a quick question, I am working on a garbage collection program, and in the program, we must check both the addresses that the pointer points to, and the actual address that the pointer is sitting on as well. We are using C in order to implement a mark and sweep algorithm. My question is: If I want to know the memory location that the pointer is sitting on, how would I do that. Similarly, if I want to know the address that the pointer points to, how would I do that?</p>
<c><pointers>
2019-04-01 21:17:51
LQ_CLOSE
55,464,116
Graphical Explainnation
''' #include <stdio.h> int main() { int c; /* Present Charecter */ int old_c; /* Previous Charecter */ while((c = getchar()) != EOF) { if(old_c == ' ' && c != ' '){ putchar(' '); putchar(c); }else if(c != ' '){ putchar(c); } old_c = c; } return 0; } ''' I don't really understand how this code works. This is a solution for the C The programming language exercise 1.9; So here is my Problem For example i type in as Input : Hello World\n is the '\n' not the last character ? save into old_c : old_c = c; could someone please explain to me how to code works as i really want to learn the c programming language and programming. i am a very beginner;
<c><logic>
2019-04-01 21:53:39
LQ_EDIT
55,464,274
React - input type file Semantic UI React
<p>I'm trying to implement a file upload, but using <a href="https://react.semantic-ui.com/" rel="noreferrer">SUIR</a> <a href="https://react.semantic-ui.com/elements/input/" rel="noreferrer"><code>&lt;Input&gt;</code></a>, button, label, etc.</p> <p>This is strictly about the use of the elements in render.</p> <p>Using regular html <code>&lt;label&gt;</code> and <code>&lt;input&gt;</code> elements this process works as expected. </p> <pre><code> &lt;Form.Field&gt; &lt;label&gt;File input &amp; upload for dataschemas &amp; datasources&lt;/label&gt; &lt;input type="file" onChange={this.fileChange} /&gt; &lt;Button type="submit"&gt;Upload&lt;/Button&gt; &lt;/Form.Field&gt; </code></pre> <p>Now I'm trying to use SUIR <code>&lt;Input&gt;</code> element, as well as some props with the <code>&lt;Button&gt;</code> element for styling.</p> <pre><code> &lt;Form.Field&gt; &lt;label&gt;File input &amp; upload &lt;/label&gt; &lt;Input type="file" onChange={this.fileChange}&gt; &lt;Button content="Choose File" labelPosition="left" icon="file" /&gt; &lt;/Input&gt; &lt;Button type="submit"&gt;Upload&lt;/Button&gt; &lt;/Form.Field&gt; </code></pre> <p>You can visit the codesandbox <a href="https://codesandbox.io/s/5wxr0mwq5p" rel="noreferrer">here</a> to get a better visual idea of what I'm talking about.</p> <p>When I click <code>Choose File</code> in the SUIR implementation example it does not prompt the user to chose a file from their system, whereas the regular html <code>&lt;input&gt;</code> does. I'm not sure how to get <code>&lt;Input type="file ...&gt;</code> in semantic to behave the same way.</p>
<javascript><reactjs><semantic-ui>
2019-04-01 22:08:34
HQ
55,464,609
Monitor bluetooth peripheral state changes even when the app is killed
<p>At the moment I am using <code>CBCentralManager</code>'s constructor that accepts its delegate and other params. From that point on if the app is in foreground or background state the delegate method is called as expected as soon as the bluetooth state changes (such as turnOn/turnOff). When the app is not running even in background i.e when the app is killed, the app is not launched and the delegate method is never called by the system.</p> <p>I've made sure that i have <code>bluetooth-central</code> and <code>bluetooth-peripheral</code> under <code>UIBackgroundModes</code> in the <code>Info.plist</code>.</p> <p>So is there any way to receive the state change notifications even when the app is not running at all?</p> <p><strong>Sidenote</strong>: Our app relies on bluetooth to function properly so it is important to keep the bluetooth turned on. Idea is if a user turns off the bluetooth we need to alert them via local notification that it needs to be turned on for our app function properly.</p>
<c#><ios><swift><xamarin><xamarin.ios>
2019-04-01 22:46:25
LQ_CLOSE
55,465,998
Is there a reason to my second instanciated object takes my first object's value?
When I insert a second Object(a Child), I need to assign to his parent the name of his child (having already the Child object, that has the parents name in a property), but when I call the Parent object always returns the child object. I'm using a Hashtable to store "Cargo" objects. ``` // Hashtable(key,value) TablaCargos(CargoObject.Name, CargoObject) ``` And every Cargo should have a Parent and a Child list Part of my class Cargo ``` class Cargo { private string nombre; private string codigo; private string padre; private List<string> hijos = new List<string>(); public Cargo() { nombre = ""; codigo = ""; padre = ""; hijos = null; } //getter and setters } ``` My form ``` Cargo cargo = new Cargo(); Cargo cargoHijo = new Cargo(); Cargo cargoPadre = new Cargo(); Hashtable TablaCargos = new Hashtable(); string Root = ""; ... // A button_Click listener that add the object to the hashtable, and calls Ordenamiento() ... private void Ordenamiento(string cargoActual) { cargoHijo = (Cargo)TablaCargos[cargoActual]; if (cargoHijo.Padre == "") { // THIS IS A PARENT Root = cargoActual; } else { // THIS IS A CHILD AsignarPadre(cargoHijo.Padre, cargoHijo.Nombre); } private void AsignarPadre(String Padre, String Hijo) { // THE PROBLEM IS HERE, CLEARLY I SEND THE Parent's KEY cargoPadre = (Cargo)TablaCargos[Padre]; // BUT IN THE NEXT LINE cargoPadre TAKES THE VALUE OF THE CHILD // THE SAME VALUE OF cargoAux cargoPadre.Hijos.Add(Hijo); } ``` I expect to assign the child's name to the parent's child property, but the child takes it. Maybe I miss an instantiation or, I don't know
<c#><hashtable>
2019-04-02 02:13:47
LQ_EDIT
55,466,104
Using useMemo instead of React.memo syntax issue
<p>I need to make a demonstration of using React Hooks useMemo. I have working code that is as follows that does what I want:</p> <pre><code>const SpeakerCardDetail = React.memo( ({id,... </code></pre> <p>I found a <a href="https://github.com/facebook/react/issues/14616" rel="noreferrer">link</a> that shows that I could use syntax more like this but I can't figure it out exactly.</p> <p>This is as far as I got:</p> <pre><code>const SpeakerDetail = React.useMemo(() =&gt; { ({ id, </code></pre> <p>Clearly not it though. I do get that React.memo solves the problem but I do need to show useMemo in action and am hoping there is an alternative syntax that I can use.</p>
<reactjs><react-hooks>
2019-04-02 02:28:42
HQ
55,466,213
What is Kubernetes' Users for?
I'm studying Kubernetes now, and have a question about Kubernetes' Users. I learned how to create Users and how to limit access by Role, but when should I use it? I mean, if malicious user(not k8s user, but operating user) penetrate k8s server, they can switch administrator easily (if they can see .kube/config). In addition to, if user switch his user account and he forgot switch back, the another person who enters next can also use first user's account. I doubt if I misunderstand usage of k8s Users, but it seems to be no documents about why k8s prepared it. I slightly assume that Users only use for doing something from inner pods, but if so, what the difference between Users and Service Accounts?
<kubernetes><rbac>
2019-04-02 02:44:27
LQ_EDIT
55,466,298
Pytorch: Can't call numpy() on Variable that requires grad. Use var.detach().numpy() instead
<p>I have an error in my code which is not getting fixed any which way I try.</p> <p>The Error is simple, I return a value:</p> <pre><code>torch.exp(-LL_total/T_total) </code></pre> <p>and get the error later in the pipeline:</p> <pre><code>RuntimeError: Can't call numpy() on Variable that requires grad. Use var.detach().numpy() instead. </code></pre> <p>Solutions such as <code>cpu().detach().numpy()</code> give the same error.</p> <p>How could I fix it? Thanks.</p>
<python><numpy><pytorch>
2019-04-02 02:54:59
HQ
55,466,554
Updation in Google Cloud Storage library
I am working on a project and it requires latest version of google app engine cloud storage client. Where can I find the latest version?
<google-cloud-storage>
2019-04-02 03:27:41
LQ_EDIT
55,467,142
Java Getting values of 0 in Array When is not supposed to be 0 Help D:
So i have to make a beer pong game for my class but when i try to print out the values i inserted in the array cups1[#], cups2[#] they all come out as if i inserted a number 0 which i do not get because i do not have anything inserting a 0 into the array and every time i print i see lots of 0 s in the console. Each ball i insert in the cup has to have a number and that's why i want to print which ball went to which cup my cups are my cups array, i will add an for loop to print the numbers in array but as in right know i want to know why the array is only getting 0 s inserted. D: this are my codes. http://prntscr.com/n67ivn <---an image of my output, public static void main(String[] args) { int cups1[] = new int[9]; int cups2[] = new int[9]; int cup1=1; int cup2=1; int balls=1; for(int i=0; i<1000; i++) { int random = (int)(Math.random()*2); if (random==0) { cups1[cup1]=balls; cup1++; balls++; System.out.println(cups1[cup1]); } if (random==1) { cups2[cup2]=balls; cup2++; balls++; System.out.println(cups2[cup2]); } if (cups1[0]>=1 && cups2[0]>=1) { break; } } } }
<java>
2019-04-02 04:48:32
LQ_EDIT
55,467,178
Is there a way of not hard coding sql queries in my express app?
<p>So I am making an express app for a project and I am using mysql as the db, I had previously hard coded my sql queries in my code, but it is bad practice to do so according to my teacher, so I was looking for a way in which I don't have to hard code. </p> <p>I have tried queries like find and findAll using mongoose, I am looking for something similar.</p> <pre><code>app.get("/shops/:id",function(req,res){ var id = req.params.id; connection.query('SELECT * FROM `menuItems` WHERE shop_id =?',[id],function(error,results,fields) { console.log(results); res.json(JSON.stringify(results)); }) }); </code></pre> <p>I don't want to hard code my queries as I have in the above code snippet.</p> <p>Kindly help me get a way for not hard coding sql queries in my app. Thanks in advance.</p>
<mysql><node.js><express>
2019-04-02 04:53:33
LQ_CLOSE
55,468,173
Can anyone tell me , what is " return false " or "return true" in programing , especially in JavaScript or PHP
<p>who can help me with this problem I don't understand " return true " or "false" in programing. especially this keyword " return "</p>
<javascript><php>
2019-04-02 06:24:21
LQ_CLOSE
55,468,447
How to apply styles for nth childs inner div
<!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-css --> .outer:nth-child(3) > div{ color:red; } <!-- language: lang-html --> <div class="outer"> <div>1st deep element</div> <div>1st deep element</div> <div> <div>2nd deep element</div> </div> </div> <!-- end snippet --> how to control 2nd deep elements style only using outer class selector
<html><css>
2019-04-02 06:43:42
LQ_EDIT
55,471,768
Converting Json output from API to CSV
I am using weather Api to extract data and it give me in json file like this {'data': {'request': [{'type': 'City', 'query': 'Karachi, Pakistan'}], 'weather': [{'date': '2019-03-10', 'astronomy': [{'sunrise': '06:46 AM', 'sunset': '06:38 PM', 'moonrise': '09:04 AM', 'moonset': '09:53 PM', 'moon_phase': 'Waxing Crescent', 'moon_illumination': '24'}], 'maxtempC': '27', 'maxtempF': '80', 'mintempC': '22', 'mintempF': '72', 'totalSnow_cm': '0.0', 'sunHour': '11.6', 'uvIndex': '7', 'hourly': [{'time': '24', 'tempC': '27', 'tempF': '80', 'windspeedMiles': '10', 'windspeedKmph': '16', 'winddirDegree': '234', 'winddir16Point': 'SW', 'weatherCode': '116', 'weatherIconUrl': [{'value': 'http://cdn.worldweatheronline.net/images/wsymbols01_png_64/wsymbol_0002_sunny_intervals.png'}], 'weatherDesc': [{'value': 'Partly cloudy'}], 'precipMM': '0.0', 'humidity': '57', 'visibility': '10', 'pressure': '1012', 'cloudcover': '13', 'HeatIndexC': '25', 'HeatIndexF': '78', 'DewPointC': '15', 'DewPointF': '59', 'WindChillC': '24', 'WindChillF': '75', 'WindGustMiles': '12', 'WindGustKmph': '19', 'FeelsLikeC': '25', 'FeelsLikeF': '78', 'uvIndex': '0'}]}]}} i want to convert it into csv file
<python><json><csv>
2019-04-02 09:51:10
LQ_EDIT
55,471,933
I want to delete duplicate rows using this query only
**delete from employee where ( select * from (select row_number() over (partition by id) rn from employee) alias) > 1;** The above query is not working and giving this error message: **Error Code: 1242. Subquery returns more than 1 row**
<mysql-workbench>
2019-04-02 09:59:05
LQ_EDIT
55,472,201
Generate set of unique 16 digits number/codes like recharge card/voucher using algorithm
<p>I have a task, where i need to Generate set of unique 16 digits number/codes like recharge card/voucher using algorithm.(like recharge scratch cards)</p> <p>I have no idea on how to do this or which algorithm to use.</p> <p>Please help/guide me in achieving this task.</p> <p>Thanks in advance.</p>
<java>
2019-04-02 10:12:08
LQ_CLOSE
55,472,468
Jump to a specific carousel slide based on something other than position?
<p>I'm trying to achieve a way, where I can jump to a specific carousel slide after clicking a button. Now, I know you can do that using indices of specific slides, however, because the content of the slides won't always be in the same order, indices don't solve my issue.</p> <p>I've looked at Owl carousel, and it seems to be possible to achieve this with it, but I'm limited with the libraries I can use and would much prefer to avoid it.</p> <p>Is there a way to jump to a specific slide using something else, like an id or an attribute I could set, preferably by using JQuery, JS or HTML, without any additional libraries?</p>
<javascript><jquery><bootstrap-4>
2019-04-02 10:25:04
LQ_CLOSE
55,472,974
iOS: CollectionView like date picker scrolling effect
<p>I want a list in which 2nd item of list is a bit zoomed and highlighted and when i scroll that cell/item will get little smaller and next item becomes highlighted and zoomed. More like the date picker scrolling effect but with custom cells.</p>
<ios><swift><uicollectionview><uicollectionviewcell>
2019-04-02 10:51:15
LQ_CLOSE
55,473,214
remove Key:value pair from json file using shell script
<p>Below is the content of file1.json amongst many json file in the directory,</p> <pre><code>{ "options": { "create": "cycletime" }, "indexes": [... some data] } </code></pre> <p>I need a regex to delete the object that contains <code>"options"</code> as key and the expected json looks like below, (json must be affect with changes)</p> <pre><code>{ "indexes": [... some data] } </code></pre>
<regex><linux><sed>
2019-04-02 11:04:53
LQ_CLOSE
55,473,268
How to sort an array that has 3 values per row?
<p>This is my array that I have to sort from highest average grade to lowest.</p> <pre><code>let students= [ {name:"Petar", year:1, average:4.35}, {name:"Ivana", year:1, average:3.88}, {name:"Marko", year:2, average:2.27}, {name:"Davor", year:2, average:4.15}, {name:"Petra", year:3, average:3.99}, {name:"Ivan", year:3, average:4.33}, {name:"Goran", year:3, average:3.74} ]; students.sort(function(a,b){ return a[1] - b[1]; }); </code></pre>
<javascript>
2019-04-02 11:07:17
LQ_CLOSE
55,473,608
What's the use of the "with" statement in Python?
<p>While programming in Python, sometimes I need to launch functions and object methods, something like this:</p> <pre><code>obj1.launch_method1(); // object method do_something(); // general function obj1.launch_method2(); // object method </code></pre> <p>Using the <code>with</code> statement, this becomes:</p> <pre><code>with obj1: launch_method1(); do_something(); launch_method2(); </code></pre> <p>In my opinion, this causes confusion, because the next programmer might erroneously think that <code>do_something()</code> is an object method rather than a general function.</p> <p>In top of this, most IDEs has intellisense, so when you type <code>obj1.</code> (mind the dot), a list of methods and properties appears, which makes it pretty easy to type things like <code>obj1.launch_method1()</code>, <code>obj1.launch_method2()</code>, ...</p> <p>So, from a programmer's perspective, there seems not to be an advantage in the usage of the <code>with</code> statement.</p> <p>However, it seems that the <code>with</code> statement launches <code>__enter__</code> and <code>__exit__</code> calls, which seems to create new contexts. What are those calls? What does this mean? Does the usage of the <code>with</code> statement make any difference? If yes, which one(s)?</p>
<python><with-statement>
2019-04-02 11:24:33
LQ_CLOSE
55,474,203
Organization db for blog posts with Mysql and Php
<p>I intend to write a blog for life stories. I will post my photos and text and share it with other people. At the very beginning there was a question, how to organize a database? I'm going to do so in the article would be a photo and text. While there is an option in my head - for each article - to make a new table, but I don’t know, are they doing this? But here I also have a question. Photos for one day can be 30 pieces, and maybe 0. There is an option to attach photos to the text, or vice versa, but I do not know how to be more literate. By this, I can not start work. I have to say that this is my first site, I will use mySQL + PHP.</p> <p>My try is this</p> <pre><code>id int(11) user_id int(11) datecreated timestamp dateupdated timestamp content text title varchar(255) h1 varchar(255) </code></pre> <p>But what about the images?</p> <p>Thank you very much</p>
<php><mysql>
2019-04-02 11:56:37
LQ_CLOSE
55,474,838
Possible to use Php's mail() function to send 1 million plus mails?
<p>I was wondering if it would be feasible to send over 1 million emails (stored in an array or some sql database) using php's mail function. Is this farfetched. I'm new to php and curious of the function's limitations. Thank you so much! I'm not looking to necessarily use a SMTP service like MailChimp at this point.</p>
<php><mysql><email><phpmailer><spam>
2019-04-02 12:30:06
LQ_CLOSE
55,476,187
¿ How to multiply thousands in JavaScript?
I am learning a bit of javascript, i want to make a a small mathematical operation using thousands. Example: 300,000,000 * 3% = 900,000 This is what you should be displayed to the user, and the user may be able to raise or lower the percentage or value as is as a calculator, and I cannot find how to do to multiply a number with thousands by the percentage in javascript.
<javascript>
2019-04-02 13:36:29
LQ_EDIT
55,476,203
pyton insert to database only one data from tuple
I have a problem. I need parse muliple xml file and insert data to databaase. `import os from lxml import etree import sqlite3 conn = sqlite3.connect("xml.db") cursor = conn.cursor() path = 'C:/tools/XML' for filename in os.listdir(path): fullname = os.path.join(path, filename) tree = etree.parse(fullname) test = tree.xpath('//*[@name="Name"]/text()') tpl = tuple(test) cursor.executemany("INSERT INTO parsee VALUES (?);", (tpl,)) conn.commit() sql = "SELECT * FROM parsee" cursor.execute(sql) print(cursor.fetchall())` result: [('testname1',)] if run program again that the program adds another same name. restult: [('testname1',),('testname1',)] In folder 100 files: <curent name="Name">testname1<curent> <curent name="Name">testname2<curent> <curent name="Name">testname3<curent> <curent name="Name">testname4<curent>
<python><sqlite><parsing>
2019-04-02 13:37:05
LQ_EDIT
55,478,588
Calling a method from a constructor in python
<p>The initial question I had was whether or not a method could be called from a Python constructor. The answer <a href="https://stackoverflow.com/questions/12646326/calling-a-class-function-inside-of-init">here</a> suggests that it can, but this surprised me some as, based on my reading, python cannot use something that hasn't been previously defined in the code. Looking at the answers in the linked thread, it seems like they are using a method in the constructor that is defined later in the text. How is this possible in python?</p> <p>Thanks.</p>
<python><constructor>
2019-04-02 15:37:01
LQ_CLOSE
55,478,636
WebContentNotFound on refreshing page of SPA deployed as Azure Blob Static Website with CDN
<p>I have a SPA (built with angular) and deployed to Azure Blob Storage. Everything works fine and well as you go from the default domain but the moment I refresh any of the pages/routes, index.html no longer gets loaded and instead getting the error "the requested content does not exist"</p> <p>Googling that term results in 3 results total so I'm at a loss trying to diagnose &amp; fix this.</p>
<azure><azure-storage><azure-storage-blobs><azure-blob-storage>
2019-04-02 15:39:50
HQ
55,478,701
how to use if(math.random == 50)?
<p>So i am trying to make a site that picks a random number and if that number is between for example 50-60 it is going to do something</p> <p>Here is some code:</p> <pre><code>var opengg; window.onload = function() { opengg = function() { console.log(Math.floor(Math.random() * 100)); if (Math.floor(Math.random() * 100) == 50) { console.log("test") } } } </code></pre>
<javascript><math><random>
2019-04-02 15:42:50
LQ_CLOSE
55,479,130
Show alert when checkbox check
<p>I am working on getting the data from php and populate the check box but i want the jquery so that i can show each selected value when checkbox checked</p> <p>code</p> <pre><code>&lt;input type='checkbox' class='messageCheckbox' name='emergency2[]' value='$rowspecial[category_id]' $checked $disableattr&gt; $rowspecial[category_name] </code></pre>
<jquery><html>
2019-04-02 16:04:08
LQ_CLOSE
55,480,142
Convert structs in C++ to class in Java
<p>I have a code written in C++ which use struct and i want that code to be converted in java.</p> <pre><code>void main(){ struct phone{ char name[100]; char num[10]; }; phone book[100]; for(int i = 0; i&lt;100; i++){ cin&gt;&gt;book[i].name; cin&gt;&gt;book[i].num; } } </code></pre> <p>Please help me to convert this code to java</p>
<java><c++><class><struct><structure>
2019-04-02 17:07:08
LQ_CLOSE
55,480,662
Show 'Total' after the end of each type of records
<p>I have a table which contains two columns, ie. 1. ClassName 2. Student Name</p> <p><a href="https://i.stack.imgur.com/Ewdt2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Ewdt2.png" alt="enter image description here"></a></p>
<sql-server>
2019-04-02 17:40:54
LQ_CLOSE
55,481,141
What does it mean ClassNotFoundException?
<p>At the time of executing my Java Applet program direct from IntelliJ Idea and run through the Internet Explorer it says error:</p>
<java><applet>
2019-04-02 18:12:39
LQ_CLOSE
55,482,386
Generate static Javascript client from Swagger for use in React Native
<p>I'm building a React Native app that will consume an API with Swagger 2.0 definition. I went to Swagger's repo at <a href="https://github.com/swagger-api/swagger-codegen#where-is-javascript" rel="noreferrer">https://github.com/swagger-api/swagger-codegen#where-is-javascript</a> and it points to their Javascript generator at <a href="https://github.com/swagger-api/swagger-js" rel="noreferrer">https://github.com/swagger-api/swagger-js</a>.</p> <p>The problem is that the generator is dynamic, and since I'll be embedding the client in a mobile app, dynamic generator is not an option. They also say that there's a third party project available at <a href="https://github.com/wcandillon/swagger-js-codegen" rel="noreferrer">https://github.com/wcandillon/swagger-js-codegen</a>, which says that the project is no longer maintained and points back to <a href="https://github.com/swagger-api/swagger-codegen" rel="noreferrer">https://github.com/swagger-api/swagger-codegen</a>. (while that 3rd party generator works, I don't want to use a deprecated tool that might break any time since I'll be updating the API client when new endpoints arrive. And that tool also doesn't generate really good code anyway as it says in its own repo.)</p> <p>At this point I'm stuck. What is the supported way of generating a static Javascript client from Swagger definition for use in React Native?</p>
<javascript><react-native><swagger><swagger-2.0><swagger-codegen>
2019-04-02 19:41:14
HQ
55,483,529
Will breaking a Windows 10 app into multiple exe's improve concurrency?
<p>I have a real time video processing application running on Windows 7/10 that has 4 distinct processing steps. Each of these steps is currently running in a WPF Task and I have eliminated copying of the video data as much as is possible, I am down to two copy operations. The capture of the video and the subsequent storing of the video is handled by a COM-based SDK. Would I see an increase in performance if I turned each of the steps into a separate exe and use a shared memory scheme to move the data between the exe's? Or rather than use WPF Tasks, use threads? Anyone have hard data on something like this?</p> <p>Thanks, Doug</p>
<c#><windows><real-time>
2019-04-02 21:02:20
LQ_CLOSE
55,484,800
Do you need to allocate memory to operate on an array in CUDA?
<p>I've seen CUDA programs where you allocate memory on the device, operate on it, and then copy it back to the host, like this:</p> <pre><code>float* h_a = (float*) malloc(numBytes); float* d_a = 0; cudaMalloc((void**) &amp;a, numBytes); cuda_function&lt;&lt;&lt; N/blockSize, blockSize&gt;&gt;&gt;(d_a); cudaMemcpy(d_a, h_a, numBytes, cudaMemcpyDeviceToHost); </code></pre> <p>But then I've also seen code where the CUDA program just operates on memory whose reference was passed to it, like this:</p> <pre><code>__global__ void cuda_function(int* a) { ...&lt;operate on a&gt;... } int main() { cuda_function&lt;&lt;&lt;N/256, 256&gt;&gt;&gt;(a) } </code></pre> <p>What's the different between these two approaches?</p> <p>Thanks!</p>
<c><parallel-processing><cuda>
2019-04-02 23:15:48
LQ_CLOSE
55,486,219
How to get terminal window inside Visual Studio 2017 / 2019?
<p>I was just reading this article - <a href="https://devblogs.microsoft.com/dotnet/visual-studio-2019-net-productivity-2/" rel="noreferrer">https://devblogs.microsoft.com/dotnet/visual-studio-2019-net-productivity-2/</a> and noticed in one of the GIF image, she is showing a terminal window inside VS editor itself. It looks like a fully fledged powershell window. How can we get that? Here is a screenshot.</p> <p><a href="https://i.stack.imgur.com/vKfjO.png" rel="noreferrer"><img src="https://i.stack.imgur.com/vKfjO.png" alt="enter image description here"></a></p>
<terminal><visual-studio-2017><visual-studio-extensions><visual-studio-2019>
2019-04-03 02:41:18
HQ
55,486,246
Javascript Form Validation issue how to reveal condition input field
<p>I'm using Bootstrap and Vanilla Javascript. It is a very simple form, really. </p> <p>My problem, as I have not done any Javascript in a few years, is how to get around the first thing I need help about.</p> <p>Now to the problem:</p> <pre><code>IF the user select "Near_death" in the drop down. a new form must be shown. This has been hidden as long as no one chooses "Near_Death". Such as. &lt;div class="form-group"&gt; &lt;select id="types" name="types" class="form-control"&gt; &lt;option value="Near_death"&gt;Near_death&lt;/option&gt; &lt;option value="1" type="number"&gt;1&lt;/option&gt; &lt;option value="2" type="number"&gt;2&lt;/option&gt; &lt;option value="3" type="number"&gt;3&lt;/option&gt; &lt;/select&gt; &lt;/div&gt; </code></pre> <p>I expect the lower form to revel itself if the user check the "Near_death" form option. It's just a case of conditional hide/show but I cannot for the life if me remember how I used to do it.</p> <p>Please, Only Vanilla JavaScript. Thank you all for any help. Much appreciated! :=)</p>
<javascript><validation>
2019-04-03 02:44:40
LQ_CLOSE
55,486,306
How do I use interface{} as a Struct with json?
``` var a interface{} a = xxStruct json.Unmarshal(jsonData,&a) ``` The "a" become to be a map, not a struct. For java, I could do it like this: ``` Object obj = new XXObject(); String json = JSON.toJSONString(obj); obj = JSON.parse(json,obj.getClass()) ``` What should I do?
<json><go>
2019-04-03 02:51:50
LQ_EDIT
55,487,397
How to upgrade from VS 2017 to 2019?
<p>VS 2019 is RTM, and I was wondering what's the proper way to upgrade from VS 2017, is there a dedicated 'upgrade' method, or is it uninstall and install? Maybe install and uninstall?<br> What's the right way to do it without having to uninstall and reinstall same stuff for nothing?</p>
<installation><visual-studio-2017><upgrade><visual-studio-2019><vsinstaller>
2019-04-03 05:00:36
HQ
55,488,217
In phone number validation 9,10,14 digit numbers should be valid,if number start with + then any digit number should be valid
<p>In my phone number validation i need to validate only 9,10,14 digit numbers and 11,12,13 numbers are not valid,if phone number start with + then any digit number should be valid.Any preg_match code available? please help. :(</p>
<php><wordpress><preg-match>
2019-04-03 06:12:24
LQ_CLOSE
55,488,577
special Chinese characters comparison
<p>. There are something misunderstanding when comparing two characters "李","李".</p> <pre><code>&gt;&gt;&gt; "李" == "李" False &gt;&gt;&gt; id("李") # fisrt one 140041303457584 &gt;&gt;&gt; id("李") # second one 140041303457584 </code></pre> <p>. The first character "李“ id is equal to the second "李" id, but when i try to compare their id to see what happen:</p> <pre><code>&gt;&gt;&gt; id("李") == id("李") False </code></pre> <p>. However, I tried to use chrome "Ctrl + F" that searching the first "李" and matched the second "李".</p> <p>. Does anyone know what happens? what should I do to fix this let the first "李" equal to the second "李"?</p>
<python><encode><cjk>
2019-04-03 06:38:07
LQ_CLOSE
55,489,715
Deserisation fails with when using null numeric primitives as map keys
Gson deserialization failed when using null number primitives as map keys Gson gson = new GsonBuilder() .serializeNulls() .serializeSpecialFloatingPointValues() .create(); Map<Integer, String> mapData = new HashMap<Integer, String>(); mapData.put(null, "abc"); String data = gson.toJson(mapData); System.out.println(data); Type type = TypeToken.getParameterized(HashMap.class, Integer.class, String.class).getType(); Object obj = gson.fromJson(data, type); System.out.println(obj);
<java>
2019-04-03 07:46:56
LQ_EDIT
55,491,082
gnu make - Ignore clean command in Makefile
I have a project to compile with a lot of makefiles including a clean command. That's why i always have to start over again if there is an error. Question: Is there any possibility to tell make to ignore the clean command? I would have to touch > 100 Makefiles otherwise. I would like make to start on the last error, not compiling all done stuff again
<makefile><gnu-make>
2019-04-03 08:58:42
LQ_EDIT
55,492,003
How can I find current month name and current month number in swift
<p>I want to know current month number as int and name as string in swift.Can anybody help me with simple codes?</p>
<ios><swift><date><swift4>
2019-04-03 09:43:10
LQ_CLOSE
55,492,982
React JS: What means: "this.setState(defaultDogs);" in this code?
I'm evaluating a React application (see the code below). I know what is the meaning of setState props etc. and the overall working of it but I miss the meaning of the following: "this.setState(defaultDogs);" I wondered if that is a shorthand of the standard state update. I'm unsure if that update the Dogs state or add a new one instead. React 16 Here's the code where is that statement that is followed by // <<<<<<<<<<: import React, { Component } from 'react'; import Dogs from './components/Dogs'; import DogItem from './components/DogItem'; import AddDog from './components/AddDog'; import './App.css'; class App extends Component { constructor() { super(); this.state = { dogs: [] }; } getDogs() { var defaultDogs = {dogs: [ { name: 'Princess', breed: 'Corgi', image: 'https://s-media-cache-ak0.pinimg.com/originals/51/ae/30/51ae30b78696b33a64661fa3ac205b3b.jpg' }, { name: 'Riley', breed: 'Husky', image: 'http://portland.ohsohandy.com/images/uploads/93796/m/nice-and-sweet-siberian-husky-puppies-for-free-adoption.jpg' }, ]}; this.setState(defaultDogs); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< } componentWillMount() { this.getDogs(); } handleAddDog(dog) { let dogs = this.state.dogs; dogs.push(dog); this.setState({dogs:dogs}); } handleDeleteDog(name) { let dogs = this.state.dogs; let index = dogs.findIndex(x => x.name === name); dogs.splice(index, 1); this.setState({dogs:dogs}); } render() { return ( <div className="App"> <Dogs dogs={this.state.dogs} onDelete={this.handleDeleteDog.bind(this)} /> <AddDog addDog={this.handleAddDog.bind(this)} /> <hr /> </div> ); } } export default App;
<javascript><reactjs>
2019-04-03 10:31:18
LQ_EDIT
55,494,839
get distinct ids for each group value mysql
I have a result-set as following: client_id status ------------------ 67 1 67 0 67 0 67 0 77 0 I need to get only those `client_id` whose `latest (top)` entry is `0`. I tried following but get both `67 and 77`. `67` should be excluded. SELECT DISTINCT client_id FROM ( SELECT client_id, status FROM client_history WHERE (DATE(updated_on) BETWEEN '$from' AND '$to') ORDER BY DATE(updated_on) DESC ) as ch WHERE status = 0 GROUP BY client_id How to set condition so that I can get only those records whose `status` is 0.
<mysql><sql><group-by><distinct>
2019-04-03 12:09:47
LQ_EDIT
55,494,843
strcpy() And strcat() Are Not Working Properly In Turbo C++
> The strcpy() And The strcat() Functions Are Not Working Properly For > Me In The Turbo C++. I have Given my Code Below. I Want The Output To > Be: C:\TURBOC3\BIN\BANK\SHOP\SELLER\334pd.txt > C:\TURBOC3\BIN\BANK\SHOP\SELLER\334pr.txt > C:\TURBOC3\BIN\BANK\SHOP\CART\311itm.txt > >C:\TURBOC3\BIN\BANK\SHOP\CART\311pzr.txt But The Output I Am Getting Is : > C:\TURBOC3\BIN\BANK\SHOP\SELLER\334pd.txt > C:\TURBOC3\BIN\BANK\SHOP\SELLER\334pr.txt > C:\TURBOC3\BIN\BANK\SHOP\CART\311itm.txt 4pd.txt Can Anyone Please > Tell The Error In My Code And How Do I Solve It. void add_to_cart(int se_id,int c_id,char p_name[]) { char id_seller[100],id_customer[100],id_seller1[100],id_customer1[100]; itoa(se_id,id_seller,10); itoa(se_id,id_seller1,10); itoa(c_id,id_customer,10); itoa(c_id,id_customer1,10); strcat(id_seller,"pd.txt"); strcat(id_seller1,"pr.txt"); strcat(id_customer,"itm.txt"); strcat(id_customer1,"pzr.txt"); char location_of_cart_product[]="C:\\TURBOC3\\BIN\\BANK\\SHOP\\CART\\",location_of_cart_price[100]; char location_of_product[]="C:\\TURBOC3\\BIN\\BANK\\SHOP\\SELLER\\",lop[100]; strcpy(location_of_cart_price,location_of_cart_product); strcpy(lop,location_of_product); strcat(location_of_cart_product,id_customer); strcat(location_of_cart_price,id_customer1); strcat(lop,id_seller1); strcat(location_of_product,id_seller); puts(location_of_product); puts(lop); puts(location_of_cart_product); puts(location_of_cart_price); }
<c++><turbo-c++>
2019-04-03 12:10:08
LQ_EDIT
55,495,685
Time Series Data - How to
<p>I'm thinking about doing a study over one month where the subject records how much he drinks and how often he urinates.</p> <p>I want to get the subject to record these activities on a daily basis so that I have a month of data (times of urination each day, volume and times of drink taken each day). Once I have a month of this data for one subject, I want to be able to compare it to similar data from other subjects. The differences between the subjects would be weight, age, sex, underlying illness etc ...</p> <p>I assume this will be done using time series software? If this is appropriate could someone point me in the right direction so that I can crib the appropriate code?</p> <p>So far I've found <a href="https://stackoverflow.com/questions/4908057/time-series-data-manipulation">Time-Series Data manipulation</a> am I heading in the right direction? I am only at the planning stage.</p>
<r>
2019-04-03 12:52:33
LQ_CLOSE
55,496,047
Delegate runner 'androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner' for AndroidJUnit4 could not be loaded
<p>I try to run Kotlin instrumentation tests for android.</p> <p>In my app/build.gradle:</p> <pre><code> android { dataBinding { enabled = true } compileSdkVersion 28 defaultConfig { applicationId "com.myproject" minSdkVersion 18 targetSdkVersion 28 versionCode 6 versionName "0.0.7" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } sourceSets { main.java.srcDirs += 'src/main/kotlin' androidTest.java.srcDirs += 'src/androidTest/kotlin' } androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0-alpha02' androidTestImplementation 'androidx.test.ext:junit:1.1.0' androidTestImplementation 'androidx.test:rules:1.1.2-alpha02' androidTestImplementation 'androidx.test:runner:1.1.2-alpha02' </code></pre> <p>In folder <code>/app/src/androidTest/kotlin/com/myproject/</code> I has Kotlin test:</p> <pre><code>import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import org.junit.Rule import org.junit.runner.RunWith import androidx.test.rule.ActivityTestRule import com.myproject.ui.activity.TradersActivity import org.junit.Before @RunWith(AndroidJUnit4::class) @SmallTest class TradersActivityTest { private lateinit var stringToBetyped: String @get:Rule var activityRule: ActivityTestRule&lt;TradersActivity&gt; = ActivityTestRule(TradersActivity::class.java) @Before fun initValidString() { // Specify a valid string. stringToBetyped = "Espresso" } } </code></pre> <p>but when I run test I get error:</p> <pre><code>$ adb shell am instrument -w -r -e debug false -e class 'com.myproject.TradersActivityTest' com.myproject.debug.test/androidx.test.runner.AndroidJUnitRunner Client not ready yet.. Started running tests java.lang.RuntimeException: Delegate runner 'androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner' for AndroidJUnit4 could not be loaded. at androidx.test.ext.junit.runners.AndroidJUnit4.throwInitializationError(AndroidJUnit4.java:92) at androidx.test.ext.junit.runners.AndroidJUnit4.loadRunner(AndroidJUnit4.java:82) at androidx.test.ext.junit.runners.AndroidJUnit4.loadRunner(AndroidJUnit4.java:51) at androidx.test.ext.junit.runners.AndroidJUnit4.&lt;init&gt;(AndroidJUnit4.java:46) at java.lang.reflect.Constructor.newInstance(Native Method) at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:104) at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:86) at androidx.test.internal.runner.junit4.AndroidAnnotatedBuilder.runnerForClass(AndroidAnnotatedBuilder.java:63) at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59) at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26) at androidx.test.internal.runner.AndroidRunnerBuilder.runnerForClass(AndroidRunnerBuilder.java:153) at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59) at androidx.test.internal.runner.TestLoader.doCreateRunner(TestLoader.java:73) at androidx.test.internal.runner.TestLoader.getRunnersFor(TestLoader.java:104) at androidx.test.internal.runner.TestRequestBuilder.build(TestRequestBuilder.java:789) at androidx.test.runner.AndroidJUnitRunner.buildRequest(AndroidJUnitRunner.java:544) at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:387) at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1879) Caused by: java.lang.reflect.InvocationTargetException at java.lang.reflect.Constructor.newInstance(Native Method) at androidx.test.ext.junit.runners.AndroidJUnit4.loadRunner(AndroidJUnit4.java:72) ... 16 more Caused by: org.junit.runners.model.InitializationError at org.junit.runners.ParentRunner.validate(ParentRunner.java:418) at org.junit.runners.ParentRunner.&lt;init&gt;(ParentRunner.java:84) at org.junit.runners.BlockJUnit4ClassRunner.&lt;init&gt;(BlockJUnit4ClassRunner.java:65) at androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner.&lt;init&gt;(AndroidJUnit4ClassRunner.java:43) at androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner.&lt;init&gt;(AndroidJUnit4ClassRunner.java:48) ... 18 more Tests ran to completion. </code></pre>
<kotlin><android-espresso>
2019-04-03 13:10:38
HQ
55,496,516
How can I call a function out of another functione inside a Class
I have the following problem: I want to call the Function "printHello" from the Function "testHello". The printHello function works on its own, however, when I try to call "printHello" from the "testHello" function, I get an reference error. Thank you for your help. ´´´´´´´´´´´´ <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-js --> class Test{ constructor(name){ this.name; } printHello(parameter){ console.log(parameter); } testHello(){ printHello(printHello(this.name)); } } var test = new Test("Sandro"); test.printHello("hello"); //works, prints "Hello" to the Console test.testHello(); // does not work: Reference Error: printHello is not defined <!-- end snippet -->
<javascript><function><referenceerror>
2019-04-03 13:34:45
LQ_EDIT
55,497,241
Is there a function to convert a int list to a list that shows the smallest-to-largest order of the list?
<p>I need a function that turns a list like [10,5,2,3,7] to a list like [4,2,0,1,3]</p> <p>Basically a list [0,1,2,3,4...] but arranged in the order that the original list has, smallest to biggest.</p> <p>I have no idea where to even start on a function like this. I have Python 3.5.2.</p>
<python><python-3.x>
2019-04-03 14:12:13
LQ_CLOSE
55,497,571
inserts dates into ms-acces databse
how can i write the right syntex to insert date to my database this the sql command that i already tried: "insert into table1 (date) values (#"+DateTime.Parse(DateTime.Now.ToShortDateString())+"#)" also that: "insert into table1 (date) values ('"+DateTime.Parse(DateTime.Now.ToShortDateString())+"')"
<c#><sql><ms-access>
2019-04-03 14:27:40
LQ_EDIT
55,498,372
How to get a list from txt file and explode it in PHP?
<p>Hi I have a txt file like this:</p> <pre><code>lenovo,pc,mouse mac,pc,mouse dell,pc,mouse </code></pre> <p>and I want to make a drop down list of first part of txt file string (pc name). Here is my code but it doesnt work how I want. It doesnt explode it. Any help? </p> <pre><code>echo "Which pc are you using?? &lt;br&gt;"; $pc = file('pc.txt'); $name = ' '; $name.="&lt;option&gt;Choose please&lt;/option&gt;"; foreach ($pc as $type) { $name .= '&lt;option value="'.$type.'"&gt;'.$type.'&lt;/option&gt;'; explode(',',$name);} $select = '&lt;select name="pc"&gt;'.$name.'&lt;/select&gt;'; echo $select; </code></pre>
<php><explode>
2019-04-03 15:04:10
LQ_CLOSE
55,499,474
How to load treeview nodes from sqlite database
I am trying to load nodes into a c# winform treeview using System.Data.SQLite. Currently my database table looks like this: ` ID, Parent_ID, Name 1, 0, Apple 2, 0, Pear 3, 2, Grapes 4, 3, Banana` I need my treeview to look like this: `Apple Pear -> Grapes -> -> Banana` 'Grapes' has a Parent_ID of '2', making it a child node of 'Pear', and 'Banana' has a Parent_ID of '3', making it a child node of 'Grapes'. I'm not very experienced with SQL and am not sure how to go about getting the data out of my SQLite file 'Database.db', containing a table 'MyTable'. Any help is much appreciated.
<c#><.net><sqlite><treeview>
2019-04-03 15:59:16
LQ_EDIT
55,499,555
Property 'matchAll' does not exist on type 'string'
<p>I want to apply Reg Expression on string. In order to get all groups result i am using matchAll method. Here is my code</p> <pre><code>const regexp = RegExp('foo*','g'); const str = "table football, foosball"; let matches = str.matchAll(regexp); for (const match of matches) { console.log(match); } </code></pre> <p>during compiling on above code i got error</p> <blockquote> <p>Property 'matchAll' does not exist on type '"table football, foosball"'</p> </blockquote> <p>during searching about this error i found similar issue on stackoverflow </p> <p><a href="https://stackoverflow.com/questions/51811239/ts2339-property-includes-does-not-exist-on-type-string">TS2339: Property &#39;includes&#39; does not exist on type &#39;string&#39;</a></p> <p>I changed tsconfig configuration as mention in above link but my issue did not solved</p> <p>Here is my tsconfig code;</p> <pre><code>{ "compileOnSave": false, "compilerOptions": { "baseUrl": "./", "importHelpers": true, "outDir": "./dist/out-tsc", "sourceMap": true, "declaration": false, "module": "es2015", "moduleResolution": "node", "emitDecoratorMetadata": true, "experimentalDecorators": true, "target": "es2016", "typeRoots": [ "node_modules/@types" ], "lib": [ "es2018", "dom" ] } } </code></pre>
<typescript><angular7>
2019-04-03 16:03:19
HQ
55,500,966
How add text in the hover effect of this triangle in svg?
<p>I made a triangle with hover effect, but I can´t add text. How can I add text inside the hover effect of this polygon? </p> <p>html :</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-html lang-html prettyprint-override"><code>&lt;svg version="1.0" id="formas" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 792 612" enable-background="new 0 0 792 612" xml:space="preserve"&gt; &lt;linearGradient id="triangulo_apartado_1_1_" gradientUnits="userSpaceOnUse" x1="0" y1="252.5721" x2="117.5039" y2="252.5721"&gt; &lt;stop offset="0" style="stop-color:#5D676A"/&gt; &lt;stop offset="0.4845" style="stop-color:#808B91"/&gt; &lt;stop offset="1" style="stop-color:#5D676A"/&gt; &lt;/linearGradient&gt; &lt;polygon class="triangle" id="triangulo_apartado_1" fill="url(#triangulo_apartado_1_1_)"stroke="#FFFFFF" stroke-miterlimit="10" points="117.504,281.948 0,281.948 58.752,223.196"/&gt; &lt;/svg&gt;</code></pre> </div> </div> </p> <p>style in css:</p> <pre><code>.triangle{} .triangle:hover{fill:#ffcd00;} </code></pre>
<html><css><svg>
2019-04-03 17:28:37
LQ_CLOSE
55,501,323
Best practise: Drawing shape over Background
I'm making a design in flutter and would like to have a wave shape over my background at the bottom (like in the image attached). What is best practise to do it (even for example in html - css). Is it better to overlay a image shape to the bottom of the background e.g. a white wave-shape or to achieve the effect by drawing the wave-shape programmaticaly - ( In flutter for example by using the path widget. Or in css by drawing it)? Img: https://imgur.com/a/0hwF7Sy
<css><performance><flutter>
2019-04-03 17:50:44
LQ_EDIT
55,501,524
How does recaptcha 3 know I'm using selenium/chromedriver?
<p>I'm curious how Recaptcha v3 works. Specifically the browser fingerprinting.</p> <p>When I launch a instance of chrome through selenium/chromedriver and test against ReCaptcha 3 (<a href="https://recaptcha-demo.appspot.com/recaptcha-v3-request-scores.php" rel="noreferrer">https://recaptcha-demo.appspot.com/recaptcha-v3-request-scores.php</a>) I always get a score of 0.1 when using selenium/chromedriver. </p> <p>When using incognito with a normal instance I get 0.3.</p> <p>I've beaten other detection systems by injecting JS and modifying the web driver object and recompiling webdriver from source and modifying the $cdc_ variables. </p> <p>I can see what looks like some obfuscated POST back to the server so I'm going to start digging there.</p> <p>I just wanted to check if anyone was willing to share any advice or experience with this first about what it may be looking for to determine if I'm running selenium/chromedriver?</p>
<selenium><web-scraping><selenium-chromedriver><recaptcha><recaptcha-v3>
2019-04-03 18:03:06
HQ
55,502,787
Why does not the authorization occur?
I implement search in my application. I try to implement the proposed in the seventh answer https://stackoverflow.com/questions/3727662/how-can-you-search-google-programmatically-java-api option. I insert my keys, but for some reason I do not pass authorization. Someone can tell me what I'm doing wrong. Below is my code. I use the com_google_apis_google_api_services_customsearch_v1_rev74_1_25_0.xml library I get the result: run: cs= com.google.api.services.customsearch.Customsearch@16b3fc9e list= {cx=MyCx, key=MyKey, q=test} IOException result result= null tried NB 8.2 и IntelliJ IDEA import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport; import com.google.api.client.json.jackson2.JacksonFactory; import com.google.api.services.customsearch.Customsearch; import com.google.api.services.customsearch.CustomsearchRequestInitializer; import com.google.api.services.customsearch.model.Result; import com.google.api.services.customsearch.model.Search; import java.io.IOException; import java.security.GeneralSecurityException; public class Main { public static void main(String[] args) throws GeneralSecurityException, IOException { // String searchQuery = "test"; //The query to search // String cx = "MyCx"; //Your search engine String searchQuery = "test"; //The query to search String cx = "MyCx"; //Your search engine //Instance Customsearch Customsearch cs= null; try { cs = new Customsearch.Builder(GoogleNetHttpTransport.newTrustedTransport(), JacksonFactory.getDefaultInstance(), null) .setApplicationName("MYApp") .setGoogleClientRequestInitializer(new CustomsearchRequestInitializer("MyKey")) .build(); System.out.println("cs= "+cs); } catch (GeneralSecurityException e) { System.out.println("GeneralSecurityException cs"); } catch (IOException e) { System.out.println("IOException cs"); } catch (Exception e) { System.out.println("Exception cs"); } //Set search parameter Customsearch.Cse.List list = null; try { list = cs.cse().list(searchQuery).setCx(cx); System.out.println("list= "+list); } catch (IOException e) { System.out.println("IOException list"); } //Execute search Search result= null; try { result = list.execute(); } catch (IOException e) { System.out.println("IOException result"); } if (result!=null) { if (result.getItems()!=null){ for (Result ri : result.getItems()) { //Get title, link, body etc. from search System.out.println(ri.getTitle() + ", " + ri.getLink()); } } else { System.out.println(" resultgetItems()= null"); } } else { System.out.println(" result= null"); } } } The code seems to be correct, I would like to understand what you need to do to log in.
<java><android><search>
2019-04-03 19:20:39
LQ_EDIT
55,503,025
How to write generic function with two inputs?
<p>I am a newbee in programming, and I run into an issue with R about generic function: how to write it when there are multiple inputs?</p> <p>For an easy example, for dataset and function</p> <pre class="lang-r prettyprint-override"><code>z &lt;- c(2,3,4,5,8) calc.simp &lt;- function(a,x){a*x+8} # Test the function: calc.simp(x=z,a=3) [1] 14 17 20 23 32 </code></pre> <p>Now I change the class of z: class(z) &lt;- 'simp' How should I write the generic function 'calc' as there are two inputs? My attempts and errors are below:</p> <pre class="lang-r prettyprint-override"><code>calc &lt;- function(x) UseMethod('calc',x) calc(x=z) Error in calc.simp(x = z) : argument "a" is missing, with no default </code></pre> <p>And</p> <pre class="lang-r prettyprint-override"><code>calc &lt;- function(x,y) UseMethod('calc',x,y) Error in UseMethod("calc", x, y) : unused argument (y) </code></pre> <p>My confusion might be a fundamental one as I am just a beginner. Please help! Thank you very much!</p>
<r><generic-programming>
2019-04-03 19:36:01
HQ
55,503,224
The problem with the markers in Google maps
There was a problem, how to remove these buttons from the bottom? https://imgur.com/3JXa8xe
<java><android><google-maps>
2019-04-03 19:50:08
LQ_EDIT
55,503,287
Best way to use reactions as buttons in discord.js?
<p>Currently working a bot that bans maps players can/cannot play in CSGO. On click of a reaction, I would want to push a certain map to an array titled bannedMaps. What is the best way to go about this? I have the reactions reacted to the prompt, and the array of objects for the map also done.</p>
<javascript><node.js><discord><discord.js>
2019-04-03 19:54:04
LQ_CLOSE
55,503,573
Database connections
My program wont launch, I'm getting an error I don't know how to fix. Please advise I've googled the error Error 1: Severity Code Description Project File Line Suppression State Error Unable to copy file "obj\Debug\KarateStock.exe" to "bin\Debug\KarateStock.exe". The process cannot access the file 'bin\Debug\KarateStock.exe' because it is being used by another process. KarateStock Error 2: Severity Code Description Project File Line Suppression State Error Could not copy "obj\Debug\KarateStock.exe" to "bin\Debug\KarateStock.exe". Exceeded retry count of 10. Failed. The file is locked by: "KarateStock (6744), KarateStock (5932), KarateStock (1196)" KarateStock
<c#><database>
2019-04-03 20:14:06
LQ_EDIT
55,506,060
How to reconstruct array in a certain way
Let's say I have an array ``` [-2, -1, 0, 1, 2, 3, 4]; ``` And I want to reconstruct it into below ``` [0, 1, 2, 3, 4, -2, -1]; ``` Is there anyway in JavaScript can achieve this?
<javascript><arrays><sorting><ecmascript-6>
2019-04-04 00:16:44
LQ_EDIT
55,508,326
What is the best way to create a class structure from a bill of materials?
<p>For a semester project (in Java) I have to do some material flow optimization. The starting point for the whole task will be a bill of materials. The user should be able to provide it via a file (xml or yaml). My question is now, how can I build class objects (with dependencies) from this bill of materials automatically?</p> <p>So far I found a serialization/deserialization framework called simple (<a href="http://simple.sourceforge.net/" rel="nofollow noreferrer">http://simple.sourceforge.net/</a>) but I'm not sure if this is the right way to go.</p> <p>I'm glad for any advice.</p>
<java><deserialization>
2019-04-04 05:14:56
LQ_CLOSE
55,509,112
Dereferencing an uninitialized pointer in c++
<p>I was going through c++ pointer concepts. I was not able to understand the concept of dereferencing an uninitialized pointer. In the book which I was going through, it was saying that if we try to dereference an uninitialized pointer, then we will cause runtime error by referring to any other location in the memory. Can anyone explain this? if possible with some examples....</p>
<c++><pointers>
2019-04-04 06:21:08
LQ_CLOSE
55,510,175
Iron Python script for cross Table taggle Rows Grand Total
<p>can any one help me script for cross table rows Grand Total in a cross table.</p> <p>Thanks Raju</p>
<ironpython><spotfire>
2019-04-04 07:30:32
LQ_CLOSE
55,510,223
FirebaseRemoteConfig Error "No value of type 'String' exists for parameter key"
<p>I am using Firebase Core and some other Features, but not Remote Config. Multiple times a second the following Output is on Logcat. </p> <p>Where can I disable the Remote Config functionality or even set those non-existing values?</p> <p>Dependencies:</p> <pre><code>// Project classpath 'com.android.tools.build:gradle:3.2.1' classpath 'com.google.gms:google-services:4.2.0' classpath 'com.google.firebase:firebase-plugins:1.2.0' classpath 'io.fabric.tools:gradle:1.26.1' // Module implementation 'com.android.support:appcompat-v7:28.0.0' implementation 'com.android.support:design:28.0.0' implementation 'com.android.support:support-v4:28.0.0' implementation 'com.android.support.constraint:constraint-layout:1.1.3' implementation 'com.android.support:support-vector-drawable:28.0.0' implementation 'com.android.support:preference-v7:28.0.0' implementation 'com.android.support:appcompat-v7:28.0.0' implementation 'com.android.support:recyclerview-v7:28.0.0' implementation 'com.android.support:design:28.0.0' implementation 'org.jsoup:jsoup:1.11.3' implementation 'com.squareup.okhttp3:okhttp:3.11.0' implementation 'com.android.support:cardview-v7:28.0.0' implementation 'com.google.firebase:firebase-core:16.0.8' implementation 'com.google.firebase:firebase-messaging:17.5.0' implementation 'com.google.firebase:firebase-perf:16.2.4' implementation 'com.google.android.gms:play-services-location:16.0.0' implementation 'com.jsibbold:zoomage:1.2.0' implementation 'com.android.support:exifinterface:28.0.0' implementation 'com.squareup.picasso:picasso:2.71828' implementation 'com.crashlytics.sdk.android:crashlytics:2.9.9' </code></pre> <pre><code>W/FirebaseRemoteConfig: No value of type 'String' exists for parameter key 'sessions_max_length_minutes'. W/FirebaseRemoteConfig: No value of type 'String' exists for parameter key 'sessions_max_length_minutes'. W/FirebaseRemoteConfig: No value of type 'String' exists for parameter key 'sessions_feature_enabled'. W/FirebaseRemoteConfig: No value of type 'String' exists for parameter key 'sessions_max_length_minutes'. W/FirebaseRemoteConfig: No value of type 'String' exists for parameter key 'fpr_vc_trace_sampling_rate'. W/FirebaseRemoteConfig: No value of type 'String' exists for parameter key 'sessions_feature_enabled'. W/FirebaseRemoteConfig: No value of type 'String' exists for parameter key 'fpr_vc_trace_sampling_rate'. </code></pre> <p><em>It is not causing any problems I think, just annoying that it spams the Console.</em></p>
<android><firebase><firebase-remote-config>
2019-04-04 07:33:35
HQ
55,510,526
How to Remove the numbers after the dot.?
i have a drop function to get the value and show in an input field but i just need it as decimal number . events: { drop: function() { document.getElementById('point-temp').value = this.y; } } html: <input placeholder="new Temperature" id="point-temp" type="text" class="field" value="">
<javascript><highcharts>
2019-04-04 07:48:08
LQ_EDIT
55,511,658
add hr whenever there's another value on array element
I have a array of object called elements, and the objects have two values (`name` and `category`). I want to display all names but add an `<hr>` whenever reaches a new **category** Please help and thank you of helping.
<javascript><html><arrays>
2019-04-04 08:50:13
LQ_EDIT
55,513,776
Create spring repository without entity
<p>I want to use spring data repository interface to execute native queries - I think this way is the simplest because of low complexity.</p> <p>But when extending interface ex. <code>CrudRepository&lt;T, ID&gt;</code> I need to write T - my entity, which is not available.</p> <p>My native queries does not return any concrete entity, so what is the best way to create spring repository without entity?</p>
<java><spring>
2019-04-04 10:35:08
HQ
55,513,854
automatic login from email link
<p>I'm trying to create a link in (PHP), when clicked user automatically login in the website passing the authentication. Example: like Facebook is sending the link to verified your account after clicking browser open the Facebook and the user is login</p>
<php><login>
2019-04-04 10:39:32
LQ_CLOSE
55,514,570
How do I remove the "Unresolved issue" banner from App Store Connect?
<p>One of my previous builds had a problem that made it through to the Apple Review, which resulted in a banner at the top of the app saying </p> <blockquote> <p>There are one or more issues with the following platform(s):</p> <p>1 unresolved iOS issue</p> </blockquote> <p><a href="https://i.stack.imgur.com/op6fF.png" rel="noreferrer"><img src="https://i.stack.imgur.com/op6fF.png" alt="enter image description here"></a></p> <p>The issue was fixed, a new build was submitted, reviewed, approved and released - yet the banner persists.</p> <p>How can I make this erroneous and confusing banner go away?</p>
<ios><app-store><appstore-approval><app-store-connect>
2019-04-04 11:15:33
HQ
55,514,651
How do i get the value of the neural network predicted for a single image?
<p>I am trying to create a simple python script that will allow you to put in picture of a handwritten digit and the NN model will try to make a guess as to what digit it is so far I have successfully made the model as well as tested it but when it comes to testing a single image i get an output like this.</p> <p><a href="https://i.imgur.com/0GNMUPR.png" rel="nofollow noreferrer">https://i.imgur.com/0GNMUPR.png</a></p> <pre class="lang-py prettyprint-override"><code>def make_pred(): Tk().withdraw() filename = askopenfilename() #the array that will hold the values of image image = np.zeros(784) #read image gray = cv2.imread(filename, cv2.IMREAD_GRAYSCALE ) #resize image and set background to black gray = cv2.resize(255-gray, (28,28)) #making the image a one dimensional array of 784 flatten = gray.flatten() / 255.0 cv2.imshow("heh",gray) cv2.waitKey(0) cv2.destroyAllWindows() #saving the image and the correct value image = flatten prediction = neural_network_model(x) n_save = tf.train.Saver() with tf.Session() as sess2: n_save.restore(sess2, './nn_test/nnmodel') print(sess2.run(prediction,feed_dict={x: [image], y:[7]})) </code></pre> <p>The <code>y</code> value is 7 because that's the digit i am trying this with.</p> <p>So how do I get the value that the NN thinks the character is?</p>
<python><tensorflow><neural-network><mnist>
2019-04-04 11:19:27
LQ_CLOSE
55,514,942
add sequential number at the beginning of files in Bash
I have 5 files I wan to add sequential numbers and tabulation at the beginning of each file but the second file should start with the last number from the first file and so on here's an example: file1 line1 line2 .... line13 file2 line1 line2 file5 line1 line2 output file1 1 line1 ........ 13 line13 output file2 14 line1 15 line2 and so on
<bash>
2019-04-04 11:32:41
LQ_EDIT
55,515,594
Is there a way to share a configMap in kubernetes between namespaces?
<p>We are using one namespace for the develop environment and one for the staging environment. Inside each one of this namespaces we have several configMaps and secrets but there are a lot of share variables between the two environments so we will like to have a common file for those.</p> <p>Is there a way to have a base configMap into the default namespace and refer to it using something like:</p> <pre><code>- envFrom: - configMapRef: name: default.base-config-map </code></pre> <p>If this is not possible, is there no other way other than duplicate the variables through namespaces?</p>
<kubernetes><namespaces><configmap>
2019-04-04 12:04:33
HQ