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 |
|---|---|---|---|---|---|
54,806,748 | i want filter value in subject and show in option tag in html using javascript | var user = [
{
"id": 1,
"firstname": "kalpit",
"lastname": "dwivedi",
"age" : 20,
"hometown" : "jhansi",
"job" : "web design",
"subject" : ["Hindi", "English"]
},
{
"id": 2,
"firstname": "golu",
"lastname": "gupta",
"age": 30,
"hometown": "Vadodara",
"job": "qa tester",
"subject" : ["Hindi", "Socilogy"]
},
{
"id": 3,
"firstname": "john",
"lastname": "doe",
"age": 35,
"hometown": "newport",
"job": "oprater",
"subject" : ["English", "Socilogy"]
},
{
"id": 4,
"firstname": "mohit",
"lastname": "khare",
"age": 40,
"hometown": "kochi",
"job": "civil",
"subject" : ["infa", "angularjs"]
} | <javascript><jquery><html> | 2019-02-21 12:09:50 | LQ_EDIT |
54,806,984 | how to make a drop down list which responds to the letter you enter in html | <!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>choose a country</title>
</head>
<body>
<h1>Where would you like to go?</h1>
<form action="some.jsp">
<select name="item">
<option value="america">America</option>
<option value="turkey">Turkey</option>
<option value="brazil">France</option>
<option value ="spain">Spain</option>
<option value ="Egypt">Egypt</option>
<option value ="Dubai">Dubai</option>
<option value = Argentina">Argentina </option>
<option value = "canada"> Canada </option>
<option value = "france">France</option>
</select>
<input type="submit" value="lets go!!">
</form>
</body>
</html>
I want to make a drop list in which when you press the letter A then all the countries with the letter A pop up. Im confused on how to do this
also I want to align this to the centre of the page. How would I go about this. | <html><xml><jsp> | 2019-02-21 12:22:07 | LQ_EDIT |
54,807,677 | How do you change the value of a variable in the parent class from the child class? | <p>How would i change the value of a value in the parent class using the child class? For example the parent class holds a int value of 4 and I want the child class to change that value to 8.</p>
| <java> | 2019-02-21 12:58:52 | LQ_CLOSE |
54,809,887 | How to draw Line Between two ImagViews in android | [This is acitvity_main.xml code[THis is MainActivity.java code[This is LineView.java code][1]
[1]: https://i.stack.imgur.com/3uXzx.png | <android><android-layout> | 2019-02-21 14:51:30 | LQ_EDIT |
54,810,050 | Docker on a linux VM, performances? | <p>I would like to know what Docker on VM implies regarding the performances, will I have issue ? </p>
<p>To me, adding a "layer" would decrease the performances. Is it right or wrong and most importantly, why ?</p>
<p>I want to be able to know what is the best way to deal with new projects when containers are on the line. </p>
<p>Thanks in advance :)</p>
| <linux><performance><docker> | 2019-02-21 14:59:36 | LQ_CLOSE |
54,812,369 | Get index of an Element in two List located at same position | I want to get position of two elements 1 and A if they are located at same position.
E.g List one has elements {1,1,3,1,5}
List two has elements {Q,B,Z,A,c}
output should be 3.
Below is my code,if anybody has any **optimized solution then please do reply.**
or solution using **Java8**
public class GetIndex {
public static void main(String[] args) {
// TODO Auto-generated method stub
List<String> one = Arrays.asList("1", "1", "3", "1", "5");
List<String> two = Arrays.asList("Q", "B", "Z", "A", "C");
for (int i = 0; i < one.size(); i++) {
if (one.get(i).equals("1") && two.get(i).equals("A")) {
System.out.println("Index where 1 & A: " + i);
}
}
}
} | <java><collections> | 2019-02-21 16:55:23 | LQ_EDIT |
54,813,028 | Continue loop on array after it's over | <p>I have an array with length of 26, each element a letter of the alphabet. I also have an N which can be from -10 to 10.
The N takes the letter and changes it this way.
if my letter is 'a' and N = 2 my 'a' will become 'c', if my letter is 'c' and N = -1 my 'c' will become 'b'.</p>
<p>When i have a letter like 'z' which is the last element of the array and i give N a value it returns undefined.</p>
<p>How can I make it continue to loop on the array. For example if my letter is 'y' and N = 5 then it will give me a 'd'. Hope you understood me xD.</p>
| <javascript> | 2019-02-21 17:33:22 | LQ_CLOSE |
54,813,113 | Navigating through links using Selenium in Python | <p>I'm trying to scrape data from a site with multiple pages linked via a <strong>NEXT</strong> button </p>
<p>The successive page URL has no correspondence with the previous page URL as one might assume</p>
<p>(In that case modifying the path would've solved the problem)</p>
<p>This is what I plan to do -</p>
<p>1.Start with an initial URL </p>
<p>2.Extract information</p>
<p>3.Click <strong>NEXT</strong></p>
<p>Repeat 2 and 3 <em>n</em> times</p>
<p>Specifically, I wanted to know how to get the new page URL on clicking </p>
<p>This is what I've come up with so far</p>
<pre><code>def startWebDriver():
global driver
options = Options()
options.add_argument("--disable-extensions")
driver = webdriver.Chrome(executable_path = '/path/to/driver/chromedriver_linux64/chromedriver',options=options)
#URL of the initial page
driver.get('https://openi.nlm.nih.gov/detailedresult.php?img=CXR1_1_IM-0001-3001&query=&coll=cxr&req=4&npos=1')
time.sleep(4)
#XPATH of the "NEXT" button
element = driver.find_element_by_xpath('//*[@id="imageClassM"]/div/a[2]/img').click()
</code></pre>
<p>Any help would be appreciated</p>
| <python><selenium><selenium-webdriver><web-scraping> | 2019-02-21 17:38:08 | LQ_CLOSE |
54,813,805 | I have the exact same file directory but jupyter notebook is saying there is no such file or directory found | Here is the error:
FileNotFoundError: [Errno 2] No such file or directory: 'Macintosh HD/Users/kishanpatel/Documents/Machine Learning Data/train.zip'
| <python><jupyter-notebook> | 2019-02-21 18:22:45 | LQ_EDIT |
54,814,753 | Typescript | Warning about Missing Return Type of function, ESLint | <p>I have a <code>REACT-STATELESS-COMPONENT</code>, in a project with TypeScript. It has an error, saying, that </p>
<pre><code>Missing return type on function.eslint(@typescript-eslint/explicit-function-return-type)
</code></pre>
<p>I am not sure what it wants me to do. Here is my code:</p>
<pre><code>import React, { Fragment} from 'react';
import IProp from 'dto/IProp';
export interface Props {
prop?: IProp;
}
const Component = <T extends object>({ prop }: Props & T) => (
<Fragment>
{prop? (
<Fragment>
Some Component content..
</Fragment>
) : null}
</Fragment>
);
LicenseInfo.defaultProps: {};
export default Component;
</code></pre>
<p>Can you tell me what I need to do. I need to read about TS, but currently I don't get it at all. And I can't commit right now cause of this.</p>
| <javascript><reactjs><typescript><types><eslint> | 2019-02-21 19:28:09 | HQ |
54,817,253 | GitHub Pages https/www Redirect | <p>How can I get <a href="https://www.test.com" rel="noreferrer">https://www.test.com</a> to redirect to <a href="https://test.com" rel="noreferrer">https://test.com</a> when using GitHub pages to host a static website?</p>
<p>I recently enabled TLS (provided by GitHub/Lets Encrypt) for my static site by setting A records at my DNS provider (namecheap). I've also chosen to "Enforce HTTPS" option in my GitHub repository's settings, which handles redirecting requests from <a href="http://test.com" rel="noreferrer">http://test.com</a> to <a href="https://test.com" rel="noreferrer">https://test.com</a>. I have a redirect configured through my DNS provider which forwards <a href="http://www.test.com" rel="noreferrer">http://www.test.com</a> to <a href="https://test.com" rel="noreferrer">https://test.com</a>, but the one missing piece of the puzzle is forwarding <a href="https://www.test.com" rel="noreferrer">https://www.test.com</a> to <a href="https://test.com" rel="noreferrer">https://test.com</a>. </p>
<p>Regarding this issue, GitHub says, "If your domain has HTTPS enforcement enabled, GitHub Pages' servers will not automatically route redirects. You must configure www subdomain and root domain redirects with your domain registrar."</p>
<p>... and my DNS provider says, "It is not possible to set up a URL redirect in the account for the TCP port forwarding from <a href="http://www.domain.tld" rel="noreferrer">http://www.domain.tld</a> (uses port 80) to <a href="https://www.domain.tld" rel="noreferrer">https://www.domain.tld</a> (working via port 443)."</p>
<p>I seem to be caught in an infinite loop of the two services saying the other should provide this functionality.</p>
| <dns><github-pages><namecheap> | 2019-02-21 22:30:29 | HQ |
54,817,345 | creating unique ID to assign to duplicate addresses in file | <p>I am working to create a household ID when people in my file have the same address but assigned to different people. I need it to be the same ID for each person with the same address not a sequential ID and I am using a program called Alpine so I need to use Sql or version of pig syntax. </p>
| <sql><duplicates><uniqueidentifier><id> | 2019-02-21 22:37:51 | LQ_CLOSE |
54,817,517 | Angular7 production build wrongfully compiles a SASS mixin | I'm using [this mixin][1] to make sloped blocks in my app's layout. It works well until I compile the app (`ng b --prod`) and upload it to AWS. Somehow it doesn't work in the same way as it did in development, instead of this:
`clip-path: polygon(0 0, 100% calc(0% + 7vw), 100% 100%, 0 100%);`
I get this:
`clip-path: polygon(0 calc(0 + 7vw),100% 0,100% 100%,0 100%);`
which is an invalid value, hence the resulting blocks look very much rectangular again. While I can (and most likely will) just define my own styles for this,
I'd like to find the reason for this weird behavior.
Does anybody know how compiling SASS for dev and for prod differs in Angular and how to fix it?
Here's my [`angular.json`][2] in case it's relevant.
[1]: https://github.com/NigelOToole/angled-edges
[2]: https://gist.github.com/BerekHalfhand/08cd1569c46ee0b65e8633036b92a66c | <angular><sass><compilation><mixins><production-environment> | 2019-02-21 22:53:16 | LQ_EDIT |
54,818,230 | Why does b get the value 100? | <p><strong>This is on C:</strong></p>
<pre><code>#include <stdio.h>
int main()
{
int a=100,b;
b= (a>100)?a++:a--;
printf("%d %d\n",a,b);
}
</code></pre>
<p>b assigned the value 100 but when trying </p>
<pre><code>int main()
{
int a=100,b;
b= (a>100)
printf("%d %d\n",a,b);
}
</code></pre>
<p>b prints the value 1 as it returns true.
why is it different when using '?:' operator?</p>
| <c> | 2019-02-22 00:22:36 | LQ_CLOSE |
54,819,582 | How to add array to JSON Object? | I want to stringify JSON Object like "data",
{"data": [0,1,2,3,4,5,6,7], "name":"number"}
How can I add array element into JSON Object? | <javascript><arrays><json><object><ecmascript-6> | 2019-02-22 03:19:47 | LQ_EDIT |
54,819,705 | FirstOrDefaultAsync() & SingleOrDefaultAsync() vs FindAsync() EFCore | <p>We have 3 different approaches to get single items from EFCore they are <code>FirstOrDefaultAsync()</code>, <code>SingleOrDefaultAsync()</code> (including its versions with not default value returned, also we have <code>FindAsync()</code> and maybe more with the same purpose like <code>LastOrDefaultAsync()</code>. </p>
<pre><code> var findItem = await dbContext.TodoItems
.FindAsync(request.Id)
.ConfigureAwait(false);
var firstItem = await dbContext.TodoItems
.FirstOrDefaultAsync(i => i.Id == request.Id)
.ConfigureAwait(false);
var singleItem = await dbContext.TodoItems
.SingleOrDefaultAsync(i => i.Id == request.Id)
.ConfigureAwait(false);
</code></pre>
<p>I would like to know the differences between each one of them. So far what I know is that we <code>FirstOrDefaultAsync()</code> to get the first given a condition, (usually using this because we know that more than one item can satisfy the condition), on the other hand we use <code>SingleOrDefaultAsync()</code> because we know that there is only one possible match to find, and <code>FindAsync()</code> to get an item given its primary key.</p>
<p>I think <code>FirstOrDefaultAsync()</code> & <code>SingleOrDefaultAsync()</code> always hit the database (not sure about this), and <code>FindAsync()</code> this is what Microsoft docs says:</p>
<blockquote>
<p>Asynchronously finds an entity with the given primary key values. If
an entity with the given primary key values exists in the context,
then it is returned immediately without making a request to the store.
Otherwise, a request is made to the store for an entity with the given
primary key values and this entity, if found, is attached to the
context and returned. If no entity is found in the context or the
store, then null is returned.</p>
</blockquote>
<p>So my question is, if our given condition used for <code>FirstOrDefault()</code>, <code>SingleOrDefault()</code> and <code>FindAsync()</code> is the primary key, <strong>do we have any actual difference?</strong></p>
<p>What I think is that the first time they are used always hit the db, <strong>but what about the next calls?</strong>. And probably EFCore could use the same context to get the values for <code>FirstOrDefault()</code> and <code>SingleOrDefault()</code> as it does for <code>FindAsync()</code>, <strong>maybe?</strong>.</p>
| <c#><linq><ef-core-2.0> | 2019-02-22 03:37:42 | HQ |
54,821,639 | Need a Regex to match an int of upto 8 digits including, leading or trailing 0's but not single digit "0" | <p>Need help with Regx, I want to match int of 8 digits including leading or trailing 0' but not single 0
EX:
Should not match "0"
Should match
"00001234"
"12345678"
"00012000"
"01234560
"00000001" (edited) </p>
| <regex> | 2019-02-22 06:54:56 | LQ_CLOSE |
54,821,868 | What's the advantage of using case classes? | <p>Sometimes I see people using standalone case classes for general purposes, instead of pattern matching, for example,</p>
<pre><code>case class Employee(id: Int, name: String, age: Int, city: String)
</code></pre>
<p>What's the advantage using case classes like this over normal classes? </p>
<pre><code>class Employee(id: Int, name: String, age: Int, city: String)
</code></pre>
| <scala> | 2019-02-22 07:13:35 | LQ_CLOSE |
54,822,008 | CSS not working / loading on Codepen react pen | <p>My pen: <a href="https://codepen.io/thelastvampire/pen/GzbqNQ" rel="nofollow noreferrer">https://codepen.io/thelastvampire/pen/GzbqNQ</a>.
<code>please visit the pen above</code>
I'm following a tutorial called "30 days of react"(<a href="https://github.com/fullstackreact/30-days-of-react" rel="nofollow noreferrer">https://github.com/fullstackreact/30-days-of-react</a>). I want to do this on codepen, starting with the day-04 as my skeleton. But the css just doesn't work. I inspect the elements and I don't see the css. But when I run the project (day-04 only from the repository) on my computer, I can see that the same css works and loads well. Any help is appreciated. Thanks in advance.</p>
| <css><reactjs><codepen> | 2019-02-22 07:22:53 | LQ_CLOSE |
54,822,289 | Scala substring match to match noun | <p>Is there any regex to match substring if they have space in between in scala ?</p>
<p>For eg:</p>
<pre><code> "hero 6 go pro" contains "gopro" should return true
"go pro hero 6 " contains "gopro" should return true
</code></pre>
<p>I tried :</p>
<pre><code> def matchWords(input: Seq[Char], words: Seq[Char]): Boolean = (input, words) match {
case (Seq(), Seq() | Seq(' ', _*)) => true
case (Seq(), _) => false
case (Seq(a, tail@_*), Seq(b, rest@_*)) if a == b => matchWords(tail, rest)
case (_, Seq(' ', rest@_*)) => matchWords(input, rest)
case _ => false
}
</code></pre>
<p>but </p>
<p>matchWords("gopro", "hero 6 go pro") returns false</p>
<p>though this matchWords("fitbit", "fit bit versa") return true. </p>
<p>The string should match nouns. </p>
<p>Any idea what I am doing wrong here ?</p>
<p>Thanks,
Shalini </p>
| <regex><scala> | 2019-02-22 07:42:45 | LQ_CLOSE |
54,822,831 | i cant pass intent , neither using array nor by bundles | how to pass intent with parameters.
'Intent intent = new Intent(Apply_leave_Activity.this,
ApplyingReason_Activity.class);
intent.putExtra("ID_EXTRA", new String[] { "21",countOfCL,countOfSL ,countOfEL,startDatey,endDatey,currentDatey});
startActivity(intent);'
receiving code
' String x[]=new String[10];
x =getIntent().getStringArrayExtra("ID_EXTRA");
'
| <android><android-intent> | 2019-02-22 08:23:21 | LQ_EDIT |
54,823,989 | How do you use confirm dialogues in a custom Laravel Nova tool? | <p>Is it possible to use the built in Laravel Nova confirm dialogue in your own tool? All I would like to use is interact with it how Nova does itself.</p>
<p>The docs are quite light on the JS topic, as the only built in UI you seem to be able to work with is the toasted plugin: <a href="https://nova.laravel.com/docs/1.0/customization/frontend.html#javascript" rel="noreferrer">https://nova.laravel.com/docs/1.0/customization/frontend.html#javascript</a></p>
<p><a href="https://i.stack.imgur.com/SXvDF.png" rel="noreferrer"><img src="https://i.stack.imgur.com/SXvDF.png" alt="Built in Laravel Nova confirm dialogue"></a></p>
| <laravel><vuejs2><laravel-nova> | 2019-02-22 09:32:38 | HQ |
54,824,430 | Jupyter autoreload fails when changing a class | <p>When using jupyter lab/notebook, most of the time, I put those 2 lines in the first cell of my notebook :</p>
<pre><code>%reload_ext autoreload
%autoreload 2
</code></pre>
<p>Those usually allow me to modify the scripts I import and to use them without having to reimport them or to relaunch the kernel. Yesterday, I encountered an issue : I modified the script, and executing one cell on the notebook gave me an error. Restarting the kernel and redoing the imports fixed it. I investigated this issue, and tried to create a minimal example.</p>
<p>Let's say you have the following working directory : </p>
<pre><code>+-- nb.ipynb
+-- scripts
| +-- __init__.py
| +-- script1.py
</code></pre>
<p>The notebook is composed of three cells :</p>
<pre><code>%reload_ext autoreload
%autoreload 2
</code></pre>
<p>\</p>
<pre><code>from scripts.script1 import Foo
</code></pre>
<p>\</p>
<pre><code>a = Foo(42)
</code></pre>
<p>At the beginning of this experiment, script1 contains the following :</p>
<pre><code>class Foo():
def __init__(self, x):
self.x = x
</code></pre>
<p>Now, we execute the 3 cells of the notebook, and everything works fine. We then go to script1.py and replace its code by : </p>
<pre><code>class Bar():
def __init__(self, x):
self.x = x
class Foo(Bar):
def __init__(self, x):
super().__init__(x)
</code></pre>
<p>We save the file, go back to the notebook, and execute the cell containg <code>a = Foo(42)</code>
This gives the following error : </p>
<pre><code>[autoreload of script.script failed: Traceback (most recent call last):
File "/home/user/miniconda3/lib/python3.6/site-packages/IPython/extensions/autoreload.py", line 245, in check
superreload(m, reload, self.old_objects)
File "/home/user/miniconda3/lib/python3.6/site-packages/IPython/extensions/autoreload.py", line 384, in superreload
update_generic(old_obj, new_obj)
File "/home/user/miniconda3/lib/python3.6/site-packages/IPython/extensions/autoreload.py", line 323, in update_generic
update(a, b)
File "/home/user/miniconda3/lib/python3.6/site-packages/IPython/extensions/autoreload.py", line 288, in update_class
if update_generic(old_obj, new_obj): continue
File "/home/user/miniconda3/lib/python3.6/site-packages/IPython/extensions/autoreload.py", line 323, in update_generic
update(a, b)
File "/home/user/miniconda3/lib/python3.6/site-packages/IPython/extensions/autoreload.py", line 266, in update_function
setattr(old, name, getattr(new, name))
ValueError: __init__() requires a code object with 0 free vars, not 1
]
</code></pre>
<p>Restarting the kernel or executing the import line again fixes this. Why is <code>autoreload</code> not working in this case?</p>
<p>PS : This was done in python 3.6, and my original issue with this was in python 3.7</p>
| <python><jupyter-notebook> | 2019-02-22 09:54:56 | HQ |
54,824,656 | Since Java 9 HashMap.computeIfAbsent() throws ConcurrentModificationException on attempt to memoize recursive function results | <p>Today I learned from some JS course what memoization is and tried to implement it in Java. I had a simple recursive function to evaluate n-th Fibonacci number:</p>
<pre><code>long fib(long n) {
if (n < 2) {
return n;
}
return fib(n - 1) + fib(n - 2);
}
</code></pre>
<p>Then I decided to use HashMap in order to cache results of recursive method:</p>
<pre><code>private static <I, O> Function<I, O> memoize(Function<I, O> fn) {
final Map<I, O> cache = new HashMap<>();
return in -> {
if (cache.get(in) != null) {
return cache.get(in);
} else {
O result = fn.apply(in);
cache.put(in, result);
return result;
}
};
}
</code></pre>
<p>This worked as I expected and it allowed me to memoize <code>fib()</code> like this <code>memoize(this::fib)</code></p>
<p>Then I googled the subject of memoization in Java and found the question: <a href="https://stackoverflow.com/questions/27549864/java-memoization-method">Java memoization method</a> where <code>computeIfAbsent</code> was proposed which is much shorter than my conditional expression.</p>
<p>So my final code which I expected to work was:</p>
<pre><code>public class FibMemo {
private final Function<Long, Long> memoizedFib = memoize(this::slowFib);
public long fib(long n) {
return memoizedFib.apply(n);
}
long slowFib(long n) {
if (n < 2) {
return n;
}
return fib(n - 1) + fib(n - 2);
}
private static <I, O> Function<I, O> memoize(Function<I, O> fn) {
final Map<I, O> cache = new HashMap<>();
return in -> cache.computeIfAbsent(in, fn);
}
public static void main(String[] args) {
new FibMemo().fib(50);
}
}
</code></pre>
<p>Since I used Java 11, I got:</p>
<pre><code>Exception in thread "main" java.util.ConcurrentModificationException
at java.base/java.util.HashMap.computeIfAbsent(HashMap.java:1134)
at algocasts.matrix.fibonacci.FibMemo.lambda$memoize$0(FibMemo.java:24)
at algocasts.matrix.fibonacci.FibMemo.fib(FibMemo.java:11)
at algocasts.matrix.fibonacci.FibMemo.slowFib(FibMemo.java:19)
at java.base/java.util.HashMap.computeIfAbsent(HashMap.java:1133)
at algocasts.matrix.fibonacci.FibMemo.lambda$memoize$0(FibMemo.java:24)
</code></pre>
<p>The problem quickly brought me to the following question which is very similar: <a href="https://stackoverflow.com/questions/28840047/recursive-concurrenthashmap-computeifabsent-call-never-terminates-bug-or-fea">Recursive ConcurrentHashMap.computeIfAbsent() call never terminates. Bug or "feature"?</a></p>
<p>except Lukas used ConcurrentHashMap and got never ending loop. In the article related to the question Lukas advised:</p>
<blockquote>
<p>The simplest use-site solution for this concrete problem would be to not use a ConcurrentHashMap, but just a HashMap instead:</p>
</blockquote>
<p><code>static Map<Integer, Integer> cache = new HashMap<>();</code></p>
<p>That's exactly what I was trying to do, but did not succeed with Java 11. I found out empirically that HashMap throws ConcurrentModificationException since Java 9 (thanks SDKMAN):</p>
<pre><code>sdk use java 9.0.7-zulu && javac Test.java && java Test # throws ConcurrentModificationException
sdk use java 8.0.202-zulufx && javac Test.java && java Test # works as expected
</code></pre>
<p>Here are the summary of my attempts:</p>
<ul>
<li>Java 8 && ConcurrentHashMap -> works if input < 13, otherwise endless
loop </li>
<li>Java 9 && ConcurrentHashMap -> works if input < 13, hangs if
input = 14, throws <code>IllegalStateException: Recursive update</code> if input
is 50 </li>
<li>Java 8 && HashMap -> Works! </li>
<li>Java 9 && HashMap -> Throws
<code>ConcurrentModificationException</code> after input >= 3</li>
</ul>
<p>I would like to know why ConcurrentModificationException gets thrown on attempt to use HashMap as a cache for recursive function? Was it a bug in Java 8 allowing me to do so or is it another in Java > 9 which throws ConcurrentModificationException?</p>
| <java><recursion><java-9><concurrenthashmap> | 2019-02-22 10:07:15 | HQ |
54,825,593 | How to reach value in dictionary in list in dictionary in dictionary? | Hello I'm trying to gain the number values from this kind of format:
{'Hello' : {'Values': [{'Number': 2},{'Number': 5}, {'Number':7}]}}
How will this be possible in python? I'm trying to get the output of
[2,5,7].
Thank you very much. | <python><python-3.x><list><dictionary> | 2019-02-22 10:57:46 | LQ_EDIT |
54,825,881 | How to return variable itself in PHP functions intead of values? | I have a lot of variables in a certain process and i want to store them all in a function. I want to know if there's a way to return the variables itself from a function instead of returning only the values. | <php><function><return> | 2019-02-22 11:15:19 | LQ_EDIT |
54,826,106 | How can i have good quality when i get pics with glide? | hello i wan't to create profil user, i use firebase to make authentification and get profil picture but when i get profil picture to create the profil user the picture is very bad quality
I use Glide for get profil picture
Glide.with(this)
.load(this.getCurrentUser().getPhotoUrl())
.apply(RequestOptions.circleCropTransform())
.into(imageViewProfile);
My Image view :
<ImageView
android:id="@+id/imageView"
android:layout_width="113dp"
android:layout_height="102dp"
android:layout_marginStart="8dp"
android:layout_marginTop="32dp"
android:layout_marginEnd="8dp"
android:adjustViewBounds="true"
android:scaleType="fitCenter"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
How can i fix it ? i already try to use Picasso but that Don't work
Thanks | <android><imageview><android-glide> | 2019-02-22 11:28:47 | LQ_EDIT |
54,826,169 | what does this mean < die("Connection failed: " . $conn->connect_error); > | <p>I got to know this while learning PHP and I don't exactly know what is this used for, and this is while connecting to database</p>
| <php><mysqli> | 2019-02-22 11:32:31 | LQ_CLOSE |
54,827,201 | Parameters in class name | <p>How can I pass parameters to a class name from a function?</p>
<pre><code> funcName = (param) => {
return (<div className='param'>
..............
</div>) }
</code></pre>
| <javascript><reactjs> | 2019-02-22 12:28:30 | LQ_CLOSE |
54,827,891 | Cannot convert type | I want to call a simple api and return the struct of JSON returned from server. I am using alamofire to achieve this, however I cant get past this cannot convert type error.
this is my function
func loginUser(user_name: String, password: String, callBack:(Login) -> Void){
let parameters: Parameters = ["user_name": user_name,"password": password];
let urlString=serverURL+"login.php";
Alamofire.request(urlString, method: .post, parameters: parameters, encoding: URLEncoding.httpBody)
.responseJSON { response in
if let status = response.response?.statusCode {
switch(status) {
case 200:
guard response.result.isSuccess else {
//error handling
return
}
if let login: Login = response.result.value {
callBack(login)
} else {
callBack(Login(user_id: 0, status:0))
}
default:
print("HTTP Error : \(status)")
callBack(Login(user_id: 0, status:0))
}
}
}
}
i am getting this error in the line
if let login: Login = response.result.value { | <swift><alamofire> | 2019-02-22 13:09:19 | LQ_EDIT |
54,828,301 | Git error when pushing (remote failed to report status) | <p>I cloned a repository from a github enterprise remote with the option "--mirror".</p>
<p>I'd like to push that repo in another remote repository but i've the following error:</p>
<pre><code>> ! [remote failure] XXXX-7342f50b84fbfff3a2bbdcf81481dbcb2d88e5cd -> XXXX-7342f50b84fbfff3a2bbdcf81481dbcb2d88e5cd (remote failed to report status)
> error: failed to push some refs to 'git@github.ZZZZ.com:XXXX/YYYY.git'
> Branch master set up to track remote branch master from origin.
</code></pre>
| <git><github> | 2019-02-22 13:35:24 | HQ |
54,830,615 | Create a copy of object, then deleted an element only from the copy, not the original | <p>How do I make <code>obj2</code> the same as <code>obj1</code> but not affected by the deletion?</p>
<p>Currently the <code>name: 42</code> entry will be deleted from both objects.</p>
<p>Is it because of hoisting - that is, the deletion occurs before <code>obj2</code> is created?</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>var obj1 = {
'name': 'John',
'age': 42,
}
var obj2 = obj1
delete obj1['name']
console.log(obj1)
console.log(obj2)</code></pre>
</div>
</div>
</p>
| <javascript> | 2019-02-22 15:46:41 | LQ_CLOSE |
54,831,474 | How to capitalize part of an element in html/css? | <p>there I have the following element:</p>
<pre><code><h1> Welcome in our flat. </h1>
</code></pre>
<p>And I would like to modify it with CSS so that what it gonna be displayed will be:</p>
<p>Welcome to OUR flat.</p>
<p>So, I wanna capitalize the word OUR. Does anyone know how I can do that?</p>
| <html><css><capitalize> | 2019-02-22 16:37:46 | LQ_CLOSE |
54,831,956 | I am writing a C program and getting message 'Segmentation fault (core dumped) ' | <p>The program is to find out the smallest positive number which is not in the array. When I try to test my code, it shows the message 'Segmentation fault (core dumped)'. I am new to program c, are there anyone can help?</p>
<pre><code>#include <stdio.h>
int n = 5;
int i, j, k, x = 1, temp;
int array[] = {5, 1, 4, 5, 7};
void swap(){
temp = array[i];
array[i] = array[j];
array[j] = temp;
}
void sorting(){
for (i = 0; i < n; i++){
for (j = i + 1; j < n; j++){
if (array[i] > array[j]){
swap();
}
}
}
}
void checking(){
sorting();
for (k = 0; k < n; k++){
if (x != array[k]){
printf('%d',array[k]);
break;
}
else x++;
}
}
int main()
{
checking();
}
</code></pre>
| <c> | 2019-02-22 17:05:20 | LQ_CLOSE |
54,832,393 | FizzBuzz Test Assignment C# TDD | <p>Recently I did a FizzBuzz Test Assignment using C# and TDD but I was told that I didn't meet their exceptions on this exercise to get a second stage interview. Can someone please let me know why I didn't meet their exceptions? What could I have done better and what did I do wrong?
Source code and exercise details can be found here:
<a href="https://github.com/PMVDias/FizzBuzz" rel="nofollow noreferrer">https://github.com/PMVDias/FizzBuzz</a></p>
| <c#><.net-core><tdd><fizzbuzz> | 2019-02-22 17:37:31 | LQ_CLOSE |
54,832,985 | Having mounted() only run once on a component Vue.js | <p>I have two components that conditionally render with <code>v-if</code>:</p>
<pre><code><Element v-if="this.mode === 'mode'"/>
<OtherElement v-if="this.mode !== 'mode'"/>
</code></pre>
<p>I have load-in animations for both components that I have under <code>mounted()</code>, that I only want to run the <em>first</em> time they are loaded. But with mounted, each time the component is recreated when <code>this.mode</code> changes, the animations trigger again. How can I avoid this?</p>
| <javascript><vue.js><vue-component> | 2019-02-22 18:20:37 | HQ |
54,833,543 | Pass swift variables to JavaScript | My problem is that I want to pass TWO variables from xcode to javascript to the same method but it won't work I didn't get the reason
the statement is
webView.evaluateJavaScript("saveData(\(userID, username))", completionHandler: nil)
Where the variables is userID and user name
THANKS
| <javascript><swift><webview> | 2019-02-22 19:03:04 | LQ_EDIT |
54,834,160 | How to download tcpdf php class library? | <p>How do I download tcpdf php class library for generating pdf in my web application ?</p>
| <php><tcpdf> | 2019-02-22 19:48:54 | LQ_CLOSE |
54,838,819 | Taking a list of integers and displaying them in reverse using arrays | <p>If my input is 1 2 3 the output is also coming out as 1 2 3, how do I make these numbers to display 3 2 1?</p>
<pre><code> public static void main(String[] args) {
// TODO code application logic here
Scanner s = new Scanner(System.in);
String text = s.nextLine();
String[] entries = text.split(" ");
int[] nums = new int[entries.length];
for(int i = 0; i < entries.length; i++){
nums[i] = Integer.parseInt(entries[i]);
}
for(int i = 0; i < entries.length; i++){
System.out.println(nums[i]);
}
}
</code></pre>
<p>}</p>
| <java><arrays> | 2019-02-23 06:18:14 | LQ_CLOSE |
54,839,672 | Difference between Swagger & HATEOAS | <p>Can anyone explain difference between Swagger & HATEOAS. I can Search many time but no buddy can explain the proper detailed answer this two aspects. </p>
| <rest><spring-mvc><swagger><spring-hateoas> | 2019-02-23 08:28:45 | HQ |
54,840,929 | React (CRA) SW Cache "public" folder | <p>After executing the create-react-app and enabling the service workers in the <code>index.js</code>, all relevant files from the <code>src</code> folder are cached. However some of my resources reside in the <code>public</code> directory. When I run <code>npm run build</code>, the <code>asset-manifest.json</code> and <code>precache-manifest.HASH.js</code> only contain the HTML, mangled JS and CSS (all stuff from the <code>src</code> folder).</p>
<p><strong>How can I tell the service worker to additionally cache specific files from the <code>public</code> folder?</strong></p>
<p>Here is the actually generated <code>precache-manifest.e431838417905ad548a58141f8dc754b.js</code></p>
<pre><code>self.__precacheManifest = [
{
"revision": "cb0ea38f65ed9eddcc91",
"url": "/grafiti/static/js/runtime~main.cb0ea38f.js"
},
{
"revision": "2c226d1577937984bf58",
"url": "/grafiti/static/js/main.2c226d15.chunk.js"
},
{
"revision": "c88c70e5f4ff8bea6fac",
"url": "/grafiti/static/js/2.c88c70e5.chunk.js"
},
{
"revision": "2c226d1577937984bf58",
"url": "/grafiti/static/css/main.7a6fc926.chunk.css"
},
{
"revision": "980026e33c706b23b041891757cd51be",
"url": "/grafiti/index.html"
}
];
</code></pre>
<p>But I want it to also contain entries for these urls:</p>
<ul>
<li><code>/grafiti/icon-192.png</code></li>
<li><code>/grafiti/icon-512.png</code></li>
</ul>
<p>They come from the <code>public</code> folder.</p>
<p>Alternatively: How can I add my icons for the <code>manifest.webmanifest</code> file in the <code>src</code> folder in a way such that I can reference them from the web manifest?</p>
| <android><service-worker><create-react-app><static-files> | 2019-02-23 11:08:02 | HQ |
54,841,168 | Why does code in c# differ from code in c when i write the same algorithm? | Function in C
unsigned long int ROTL(unsigned long int x, unsigned long int y)
{
return ((x) << (y&(32 - 1))) | ((x) >> (32 - (y&(32 - 1))));
}
Function in C#
uint ROTL(uint x, uint y)
{
return ((x) << (int)(y & (32 - 1))) | ((x) >> (int)(32- (y & (32 - 1))));
}
above functions do the same work and the same result for small numbers,
but when I pass large numbers the result in C# differ from C.
is there any problem in casting or in the function itself. also I'm try to convert using
Convert.ToInt32()
| <c#><c> | 2019-02-23 11:37:03 | LQ_EDIT |
54,842,107 | why is does the sound does not play? | func gameOver() {
UserDefaults.standard.set(score, forKey: "recentScore")
if score > UserDefaults.standard.integer(forKey: "highscore") {
UserDefaults.standard.set(score, forKey: "highscore")
}
let menuScene = MenuScene(size: view!.bounds.size)
view!.presentScene(menuScene)
}
brain.exe has stopped working why is the sound not playing? I have implemented the sound into the project but the program does not play any sound only shows the game over why is that so??????
soundWIRDSPIELEN += 1
if soundWIRDSPIELEN == 1 {
run(SKAction.playSoundFileNamed("lose", waitForCompletion: true))
}
soundWIRDSPIELEN -= 1
if soundWIRDSPIELEN == 0 {
gameOver()
}
} | <swift><audio><sprite-kit><playing> | 2019-02-23 13:26:18 | LQ_EDIT |
54,842,543 | Selection sort in c | Is following c code is written according to selection sort algorithm? I'm little bit confused about it. However, it gives correct results.
#include<stdio.h>
int main()
{
int n;
printf("Enter size of array: ");
scanf("%d",&n);
int a[n],i=0,j,min;
while(i<n)
{
printf("Enter no. %d:",i+1);
scanf("%d",&a[i]);
i++;
}
for(i=0;i<n;i++)
{
for(j=i,min=a[i];j<n;j++)
{
if(a[j]<min)
min=a[j];
else
continue;
a[j]=a[i];
a[i]=min;
}
}
for(i=0;i<n;i++)
printf("%d ",a[i]);
return 0;
}
>
| <c><arrays><algorithm><sorting><selection-sort> | 2019-02-23 14:18:43 | LQ_EDIT |
54,842,575 | How do you use a private variable in child classes? | <p>i have a private variable in my main class, is it possible to use it in other classes without making it a protected variable?</p>
| <java> | 2019-02-23 14:22:30 | LQ_CLOSE |
54,842,845 | Getting error message "expected an indented block" | <p>I keep on getting the error message "expected an indented block"</p>
<pre><code>month = int(input('Please enter a month in numeric form: '))
day = int(input('Please enter a day in numeric form: '))
year = int(input('Please enter a two-digit year in numeric form: '))
if month * day == year:
print ('The date is magic!')
else:
print ('The date is not magic.')
</code></pre>
| <python><python-3.x> | 2019-02-23 14:55:01 | LQ_CLOSE |
54,842,989 | c# remove java script fun from response API | how to remove this fun (adsbygoogle = window.adsbygoogle || []).push; from response from api as string
i used>>
contnt.Replace("\\(adsbygoogle = window.adsbygoogle || []).push\\", ""); not work>>
contnt = Regex.Replace(contnt,"\\\\(adsbygoogle = window.adsbygoogle || []).push;\\\\",""); not work ^_^ how to remove this | <c#><xamarin.forms> | 2019-02-23 15:12:33 | LQ_EDIT |
54,843,302 | ReactJS Bootstrap Navbar and Routing not working together | <p>I am trying to create a simple Webapp using ReactJS, and I wanted to use the <code>Navbar</code> provided by React-Bootstrap. </p>
<p>I created a <code>Navigation.js</code> file containing a class <code>Navigation</code> to separate the <code>Navbar</code> and the Routing from the <code>App.js</code> file. However, both parts do not seem to work. When I load the page, it is just empty, there is no Navbar. Can anyone spot a mistake?</p>
<p>Navigation.js:</p>
<pre><code>import React, { Component } from 'react';
import { Navbar, Nav, Form, FormControl, Button, NavItem } from 'react-bootstrap';
import { Switch, Route } from 'react-router-dom';
import { Home } from './Page';
class Navigation extends Component {
render() {
return (
<div>
<div>
<Navbar>
<Navbar.Brand href="/">React-Bootstrap</Navbar.Brand>
<Navbar.Collapse>
<Nav className="mr-auto">
<NavItem eventkey={1} href="/">
<Nav.Link href="/">Home</Nav.Link>
</NavItem>
</Nav>
<Form inline>
<FormControl type="text" placeholder="Search" className="mr-sm-2" />
<Button variant="outline-success">Search</Button>
</Form>
</Navbar.Collapse>
</Navbar>
</div>
<div>
<Switch>
<Route exact path='/' component={Home} />
<Route render={function () {
return <p>Not found</p>
}} />
</Switch>
</div>
</div>
);
}
}
export default Navigation;
</code></pre>
<p>App.js:</p>
<pre><code>import React, { Component } from 'react';
import Navigation from './components/routing/Navigation';
class App extends Component {
render() {
return (
<div id="App">
<Navigation />
</div>
);
}
}
export default App;
</code></pre>
<p>I tried using a <code>NavItem</code> containing a <code>LinkContainer</code> from <code>react-router-bootstrap</code> already, which led to the same result. </p>
<p>Just for completeness, Page.js:</p>
<pre><code>import React, { Component } from 'react';
import { Link } from 'react-router-dom';
export const Page = ({ title }) => (
<div className="App">
<div className="App-header">
<h2>{title}</h2>
</div>
<p className="App-intro">
This is the {title} page.
</p>
<p>
<Link to="/">Home</Link>
</p>
<p>
<Link to="/about">About</Link>
</p>
<p>
<Link to="/settings">Settings</Link>
</p>
</div>
);
export const About = (props) => (
<Page title="About"/>
);
export const Settings = (props) => (
<Page title="Settings"/>
);
export const Home = (props) => (
<Page title="Home"/>
);
</code></pre>
| <javascript><reactjs><react-router><react-bootstrap> | 2019-02-23 15:52:47 | HQ |
54,844,007 | How to generate full APK file including dynamic feature module | <p>My project has dynamic feature module and I would like to generate debug or release APK including the dynamic feature. Currently I can get only base APK file.</p>
<p>Basically I would generate an APK file like normal application. But I couldn't do with dynamic feature. Yes, I know dynamic feature will work based on AAB. </p>
<p>Is there any ways to make a normal(base + all modules) APK file?. Please help on this.</p>
<p>Thanks</p>
| <android><dynamic-feature> | 2019-02-23 17:11:53 | HQ |
54,844,033 | Regex: Match upto at the end of a string only one optional word character if found | I want to match an optional "s" if present at the end of the string. Other than "s", it cannot have any "word" character. Digits, Symbols are fine.
**Note:** It could be a two or three word search as well, for example "he_mans" or "he mans" while "he manity" or "he manned" etc are wrong. What I care about is how it **ends**
**True examples**
// This two examples below must return true
"fsl_mdl" matches ".*" + "mdl" + "[^a-rt-z][s]?.*" // returns false
"eco_mdl_pipe" matches ".*" + "mdl" + "[^a-rt-z][s]?.*" // returns false"
**False examples**
// The example must return false
"fonneded" matches ".*" + "fonned" + "[^a-rt-z][s]?.*"
| <regex><scala><regex-lookarounds> | 2019-02-23 17:14:59 | LQ_EDIT |
54,844,751 | How does C treat trailing spaces in scanf? | <p>If a <em>scanf</em> statement has any white space in the format string, like as follows, </p>
<pre><code>scanf(" %c",&abc);
</code></pre>
<p>then it just skips over an unlimited number of white spaces until it hits a character.<br>
So <strong>\n p</strong> as input would store <em>p</em> in <strong>abc</strong>. </p>
<p>Using this concept I am not able to predict the output of the following program that I typed.</p>
<pre><code>char echo ;
do {
scanf ("%c ", &echo);
printf ("%c\n",echo);
} while (echo != '\n') ;
</code></pre>
<p>Note that there is a <em>trailing space</em> in the scanf statement. </p>
<p>Upon execution of the code I get the following behaviour.<br>
It asks for a character. <em>I enter C</em><br>
It asks for a character. <em>I enter I</em><br>
It prints C.<br>
It asks for a character. <em>I enter R</em><br>
It prints I.<br>
It asks for a character. <em>I enter C</em><br>
It prints R. </p>
<p>This goes on forever. If I press newline, then it just skips it.<br>
Why does it ask for two characters in the beginning? Shouldn't it execute the <em>printf</em> statement?<br>
Why is the character of the previous input get printed in the next one?</p>
| <c><character><scanf> | 2019-02-23 18:28:44 | LQ_CLOSE |
54,845,144 | how to get specific string from multiple memo | i want to check specific string from multiple memo and if all of them check out then run a procedure but in my code sometimes the procedure runs and sometimes it doesn't and sometimes it runs only when a few have checked out here is my code
`procedure TForm1.Timer14Timer(Sender: TObject);
begin
if (pos('ActiveTunnel',memo10.Text)<>0) or (pos('https://ipfounder.net/?
sponsor',memo10.text)<>0)
and (pos('ActiveTunnel',memo9.Text)<>0) or (pos('https://ipfounder.net/?
sponsor',memo9.text)<>0)
and (pos('ActiveTunnel',memo8.Text)<>0) or (pos('https://ipfounder.net/?
sponsor',memo8.text)<>0)
and (pos('ActiveTunnel',memo7.Text)<>0) or (pos('https://ipfounder.net/?
sponsor',memo7.text)<>0)
and (pos('ActiveTunnel',memo6.Text)<>0) or (pos('https://ipfounder.net/?
sponsor',memo6.text)<>0)
and (pos('ActiveTunnel',memo5.Text)<>0) or (pos('https://ipfounder.net/?
sponsor',memo5.text)<>0)
and (pos('ActiveTunnel',memo4.Text)<>0) or (pos('https://ipfounder.net/?
sponsor',memo4.text)<>0)
and (pos('ActiveTunnel',memo3.Text)<>0) or (pos('https://ipfounder.net/?
sponsor',memo3.text)<>0)
and (pos('ActiveTunnel',memo2.Text)<>0) or (pos('https://ipfounder.net/?
sponsor',memo2.text)<>0)
and (pos('ActiveTunnel',memo1.Text)<>0) or (pos('https://ipfounder.net/?
sponsor',memo1.text)<>0)
then begin
if Checkbox1.Checked = true then
begin
starttun;
sleep(3000);
routesaddlast;
end;
end;
end;` | <delphi><delphi-7> | 2019-02-23 19:08:30 | LQ_EDIT |
54,845,280 | How to interpret mysqldump output? | <p>My intent is to extract the triggers, functions, and stored procedures from a database, edit them, and add them to another database.</p>
<p>Below is a partial output from <code>mysqldump</code>. I understand how the database is updated with the <code>DROP</code>, <code>CREATE</code>, and<code>INSERT INTO</code> statements, but don't understand the triggers. I expected the following:</p>
<pre><code>CREATE TRIGGER users_BINS BEFORE INSERT ON users
FOR EACH ROW
if(IFNULL(NEW.idPublic, 0) = 0) THEN
INSERT INTO _inc_accounts (type, accountsId, idPublic) values ("users",NEW.accountsId,1)
ON DUPLICATE KEY UPDATE idPublic = idPublic + 1;
SET NEW.idPublic=(SELECT idPublic FROM _inc_accounts WHERE accountsId=NEW.accountsId AND type="users");
END IF;
</code></pre>
<p>What does <code>/*!50003</code> mean? I thought it was some comment which would mean the <code>CREATE</code> for the trigger isn't present, but I must be misinterpreting the output.
How should one interpret a mysqldump output?</p>
<p><code>mysqldump -u username-ppassword --routines mydb</code></p>
<pre><code>--
-- Table structure for table `users`
--
DROP TABLE IF EXISTS `users`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`idPublic` int(11) NOT NULL,
`accountsId` int(11) NOT NULL,
`firstname` varchar(45) NOT NULL,
`lastname` varchar(45) NOT NULL,
`email` varchar(45) NOT NULL,
`username` varchar(45) NOT NULL,
`password` char(255) NOT NULL COMMENT 'Password currently uses bcrypt and only requires 60 characters, but may change over time.',
`tsCreated` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`osTicketId` int(11) NOT NULL,
`phone` varchar(45) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `uniqueEmail` (`accountsId`,`email`),
UNIQUE KEY `uniqueUsername` (`accountsId`,`username`),
KEY `fk_users_accounts1_idx` (`accountsId`),
CONSTRAINT `fk_users_accounts1` FOREIGN KEY (`accountsId`) REFERENCES `accounts` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=35 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `users`
--
LOCK TABLES `users` WRITE;
/*!40000 ALTER TABLE `users` DISABLE KEYS */;
INSERT INTO `users` VALUES (xxx
/*!40000 ALTER TABLE `users` ENABLE KEYS */;
UNLOCK TABLES;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8 */ ;
/*!50003 SET character_set_results = utf8 */ ;
/*!50003 SET collation_connection = utf8_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ALLOW_INVALID_DATES,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`michael`@`12.34.56.78`*/ /*!50003 TRIGGER `users_BINS` BEFORE INSERT ON `users` FOR EACH ROW
BEGIN
if(IFNULL(NEW.idPublic, 0) = 0) THEN
INSERT INTO _inc_accounts (type, accountsId, idPublic) values ("users",NEW.accountsId,1)
ON DUPLICATE KEY UPDATE idPublic = idPublic + 1;
SET NEW.idPublic=(SELECT idPublic FROM _inc_accounts WHERE accountsId=NEW.accountsId AND type="users");
END IF;
END */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
</code></pre>
| <mysql><triggers> | 2019-02-23 19:21:55 | HQ |
54,845,329 | How to assign a nested property of an object given an array of keys | <p>I have an object that resembles this:</p>
<pre><code>const obj = {
prop1: {
prop2: {
value: 'something',
...otherProps
}
},
...otherProps
}
</code></pre>
<p>And an array that looks like this:</p>
<pre><code>const history = ['prop1', 'prop2', 'value']
</code></pre>
<p>How do I assign the property <code>value</code> of <code>prop2</code> a new value in a way that would also work for any other depth. </p>
| <javascript> | 2019-02-23 19:26:41 | LQ_CLOSE |
54,845,807 | What is the purpose of the c flag in the "conda install" command | <p>I'm learning to setup python environments using conda, and I noticed that on the anaconda cloud website they recommend installing packages using the sintax </p>
<pre><code>conda install -c package
</code></pre>
<p>However on the conda documentation they use the same command without the c flag.</p>
<p>Could anyone explain to me what is the purpose of the c flag and when should it be used?</p>
| <python><anaconda><conda><miniconda> | 2019-02-23 20:18:16 | HQ |
54,845,817 | read an string array as property name? | <pre><code>newDesign = {
color: 'blue',
shape: 'round'
}
oldDesign = {
color: 'yellow',
shape: 'triangle'
}
</code></pre>
<p>I want to compare this two design to see if their field is changed, so I write these:</p>
<pre><code>fields = [ 'color', 'shape' ]
for (let field in fields) {
if (oldDesign.field !== newDesign.field)
console.log('changed')
}
</code></pre>
<p>However, looks like I can't read the value of fields by using oldDesign.field.</p>
<p>Is there a way to to this? Thank you.</p>
| <javascript> | 2019-02-23 20:19:00 | LQ_CLOSE |
54,846,225 | Why Deprecated issues come up | <p>Deprecated: Function create_function() is deprecated in /home/u2ot620l4yik/public_html/wp-content/themes/Vienna-theme-child/functions.php on line 20</p>
<p>Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; lateset_tweets has a deprecated constructor in /home/u2ot620l4yik/public_html/wp-content/themes/Vienna-theme/includes/widget-twitter.php on line 10</p>
<p>Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; fb_likebox_widget has a deprecated constructor in /home/u2ot620l4yik/public_html/wp-content/themes/Vienna-theme/includes/widget-facebook.php on line 10</p>
<p>Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; pulsar_video_widgets has a deprecated constructor in /home/u2ot620l4yik/public_html/wp-content/themes/Vienna-theme/includes/widget-video.php on line 10</p>
<p>Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; pulsar_flickr has a deprecated constructor in /home/u2ot620l4yik/public_html/wp-content/themes/Vienna-theme/includes/widget-flickr.php on line 10</p>
<p>Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; pm_mailchimp_widget has a deprecated constructor in /home/u2ot620l4yik/public_html/wp-content/themes/Vienna-theme/includes/widget-mailchimp.php on line 24</p>
<p>Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; pm_ln_quickcontact_widget has a deprecated constructor in /home/u2ot620l4yik/public_html/wp-content/themes/Vienna-theme/includes/widget-quickcontact.php on line 24</p>
<p>Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; pm_recentposts_widget has a deprecated constructor in /home/u2ot620l4yik/public_html/wp-content/themes/Vienna-theme/includes/widget-recentposts.php on line 22</p>
<p>Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; pm_testimonials_widget has a deprecated constructor in /home/u2ot620l4yik/public_html/wp-content/themes/Vienna-theme/includes/widget-testimonials.php on line 22</p>
<p>Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; pm_eventposts_widget has a deprecated constructor in /home/u2ot620l4yik/public_html/wp-content/themes/Vienna-theme/includes/widget-events.php on line 24</p>
<p>Deprecated: Function create_function() is deprecated in /home/u2ot620l4yik/public_html/wp-content/themes/Vienna-theme/functions.php on line 223</p>
<p>Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/u2ot620l4yik/public_html/wp-content/plugins/js_composer/include/classes/core/class-vc-mapper.php on line 111</p>
<p>Notice: Undefined index: opt-invalid-security-code-error in /home/u2ot620l4yik/public_html/wp-content/themes/Vienna-theme/functions.php on line 1017</p>
| <wordpress> | 2019-02-23 21:08:10 | LQ_CLOSE |
54,846,532 | Where does pipenv install packages? | <p>I'm using vscode, and my editor shows:</p>
<p><a href="https://i.stack.imgur.com/bjJrV.png" rel="noreferrer"><img src="https://i.stack.imgur.com/bjJrV.png" alt="enter image description here"></a></p>
<p>The red is showing that it can't import those packages. I'm using a <code>pipenv</code> virtual environment and for the life of me, I can't figure out where it installs the packages.</p>
<p>If I could, I could just add that to <code>$PYTHONPATH</code> and life would be better.</p>
<p>Any help?</p>
| <python><pipenv> | 2019-02-23 21:45:47 | HQ |
54,848,062 | card-deck, "Deck not defined" node.js | <p>So, I am progressing in making a card game in Discord with Javascript/node.js. I have been messing with this (<a href="https://www.npmjs.com/package/card-deck" rel="nofollow noreferrer">https://www.npmjs.com/package/card-deck</a>) in the RunKit just to try and get a basic understanding before using it with my code. Perhaps call me totally inexperienced, but I get the result below when running the code displayed in the image.</p>
<p><a href="https://i.gyazo.com/72da331f99b77afe425c132bacec8078.png" rel="nofollow noreferrer">https://i.gyazo.com/72da331f99b77afe425c132bacec8078.png</a></p>
<p>I also tried it in VSC, after installing as they recommend, to get the same result. I noticed that card-deck is on the older side (3 years old on last update) so I don't know if something is outdated and that is why it isn't working, or I am completely missing something. </p>
<p>Any advice? I need the card/deck handling to be able to require various piles/objects. Discard pile, active cards, hand, side decks, ect... and be able to move cards to and from them after originating in a "main deck". Any advice on what went wrong or advice on where to start would be great. Thanks.</p>
| <node.js><discord.js> | 2019-02-24 02:00:02 | LQ_CLOSE |
54,849,318 | cant count multiple columns | My code is <br>
`SELECT COUNT(*) AS none FROM college_votes WHERE `bd` IN ('none', '-Select for Board of Director-') AND `bd1` IN ('none', '-Select for Board of Director-') AND `bd2` IN ('none', '-Select for Board of Director-') AND `bd3` IN ('none', '-Select for Board of Director-')`
<br>
I want to count the same value in different columns | <sql><where><countif> | 2019-02-24 06:20:21 | LQ_EDIT |
54,849,588 | I need Advice in building Neural Network in tweets emotion classification? | I got dataset of four emotion labelled tweets (anger,joy,fear,sad). I transformed tweets to vector looks like that (avg. of frequency distribution to anger tokens, word2vec similarity to anger, avg. of anger in emotion lexicon, avg. of anger in hashtag lexicon) and so for the other emotion set (joy,fear, and sad), is that vector a valid to train my network ?
| <neural-network><sentiment-analysis><feature-extraction> | 2019-02-24 07:09:10 | LQ_EDIT |
54,850,064 | Is it safe to store secret files in public AWS S3 bucket with random key? | Even if S3 bucket is public, it cannot be accessed without not knowing the key. This is what I know.
So I have stored images that contain personal information of users with random keys like `/secret/F0EBAA71F7131E.jpg` in public S3 bucket.
Is there a possibility of data leakage if stored in this way? How can it be leaked, if possible?
| <amazon-web-services><amazon-s3> | 2019-02-24 08:23:24 | LQ_EDIT |
54,851,489 | Flutter Projects & Android X Migration Issues | <p>I just created a new flutter project, added a few plugins and I'm getting the plugin switched to android x therefore i need to switch to android x. I've tried all the different ways of moving to android x and none has worked for me so far. Right now i don't even know what to do anymore, its so frustrating, why wouldn't flutter handle that when creating new projects automatically. Might be using ionic for the project.</p>
| <android><flutter><androidx> | 2019-02-24 11:37:52 | HQ |
54,851,616 | I have a scenario when i need to insert into table from same table after changing some column. Issue is Identity Column | let say,
insert into A select * from A where col1 = "ABC", leads to an error as there would be a same identity column, I want to increment automatically from the max id the table have | <sql><sql-server> | 2019-02-24 11:53:35 | LQ_EDIT |
54,851,861 | How do I activate type annotations hints in Kotlin like depicted? | <p>I was able to activate this option once in my MacOS intellij version, but could never find this option anymore, I forgot its name.</p>
<p>I know there is the CTRL+SHIFT+P alternative to this, but it is not as user-friendly.</p>
<p>How can I activate the option to make intellij show me all the inferred types like depicted? This screenshot came out of the intellij where I was able to put it showing "type hints" like this, so it is possible. I just don't remember where to find this option anymore so I can activate in all my other intellij's.</p>
<p><a href="https://i.stack.imgur.com/tiqjc.png" rel="noreferrer"><img src="https://i.stack.imgur.com/tiqjc.png" alt="enter image description here"></a></p>
| <intellij-idea><kotlin> | 2019-02-24 12:26:44 | HQ |
54,852,116 | How do center of anchor in div, responsive menu? | This is link : https://www.w3schools.com/howto/tryit.asp?filename=tryhow_js_topnav
in this menu in left side, it should be in center of page (horizontal).
How do this and what changes needed? | <javascript><html><css> | 2019-02-24 12:59:02 | LQ_EDIT |
54,853,337 | Click the button and it sends that info into another box on the page | <p>I want to be able to click on a button then that puts that information into another part on the page (in a box). However, I want the ability to remove this from that box too. </p>
<p>What is the best way to do this using html and javascript?</p>
<p>thanks</p>
| <javascript><html><css><button> | 2019-02-24 15:16:43 | LQ_CLOSE |
54,853,344 | find the number of non-empty subsets S such that min(S) + max(S) <= K | // For a given vector of integers and integer K, find the number of non-empty subsets S such that min(S) + max(S) <= K
// For example, for K = 8 and vector [2, 4, 5, 7], the solution is 5 ([2], [4], [2, 4], [2, 4, 5], [2, 5])
The time complexity should be O(n2). Approach and code was asked | <java><algorithm> | 2019-02-24 15:17:14 | LQ_EDIT |
54,853,771 | How can I convert a string so that the first character of each word is uppercase and the rest of the characters lowercase? | <p>So far I have this code that converts every character to uppercase:</p>
<pre><code> public string Header
{
get
{
var value = (string)GetValue(HeaderProperty);
return !string.IsNullOrEmpty(value) ? value.ToUpper() : value;
}
set
{
SetValue(HeaderProperty, value);
}
}
</code></pre>
<p>But I would like to just convert the first character of each word. Is there any function that would allow me to do this?</p>
| <c#> | 2019-02-24 16:05:12 | LQ_CLOSE |
54,853,953 | How to detect noise in images | <p>How to detect noise in images?</p>
<p>I need to do some preprocessing before OCR and I need to detect if there are areas with noise? How to detect these areas? They are typically in rectangular areas</p>
<p>Below is an example. There are some noise in the last column to the right. I need the bounding boxes for all the areas with noise</p>
<p><a href="https://i.stack.imgur.com/wKPCp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wKPCp.png" alt="enter image description here"></a></p>
| <c++><opencv> | 2019-02-24 16:23:46 | LQ_CLOSE |
54,854,655 | iter without map with iterator | I am starting in the hard way of learning Rust, and I have a probably newbie's question : How to improve this function :
fn get_grid() -> [[u8; 9]; 9]
{
let mut grid: [[u8; 9]; 9] = Default::default();
let mut args: Vec<String> = env::args().collect();
if args.len() != 10 {
eprintln!("This program need 9 strings of 9 numbers between 0 and 9");
exit(1);
}
args.remove(0);
let _: Vec<_> = args.iter().enumerate().map(|(i, arg)| {
let _line: Vec<_> = arg.split(' ').enumerate().map(|(j, value)| {
match value.parse() {
Ok(x) => {
grid[i][j] = x;
x
},
Err(e) => {
eprintln!("Value {} is not a valid integer [{}]", value, e);
exit(1);
},
}
}).collect();
}).collect();
return grid;
}
( Sorry for the indentation, SO's indentation is not my friend ).
As far as I understand ".map()", it will, when collecting, build a new iterable ( Vector atm ), and return it. Actually I don't need to have this iterable, I just want to modify an external array, and not have anything built from this iteration.
In javascript, there is .map, but also a .forEach that iter on map and returns nothing. Is there any equivalent in Rust ??
I could probably just use a `for (index, value) in args.iter().enumerate()` but I am searching a way to avoid explicit loop, if there is one.
Any criticism is welcome.
Thanks | <loops><rust><iterator> | 2019-02-24 17:39:09 | LQ_EDIT |
54,855,472 | How the gitlab-ci cache is working on docker runner? what is /cache directory? what is cache_dir? | <ol>
<li><p>How the gitlab-ci cache is working on docker runner? </p></li>
<li><p>What is /cache directory? </p></li>
<li><p>What is cache_dir?</p></li>
<li><p>Where and how files matching the <a href="https://docs.gitlab.com/ee/ci/yaml/#cachepaths" rel="noreferrer">"paths" in "cache" gitlab-ci.yml</a> are stored?</p></li>
</ol>
| <gitlab-ci><gitlab-ci-runner> | 2019-02-24 19:06:51 | HQ |
54,855,507 | Want to make a multi page navigation menu "HTML, JS, jQuery, Bootstrap" | <p>Hello i have been looking for a answer with no luck.</p>
<p>Im looking for a way to clean up my code by having a navigation bar that i can add to other pages with ease. </p>
<p>I have been trying hard to get this right but whitout luck. Hope i can get an answer here.</p>
<p>Im using the Bootstrap library and would be wonderful if someone out there would help me out.</p>
<p>HTML code you will find below.</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><!DOCTYPE html>
<html class="no-js" lang="en">
<head>
<title>Bootstrap 4 Layout</title>
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Raleway:400,800">
<link rel='stylesheet' href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="/css/bootstrap.css">
<link rel="stylesheet" href="/css/styles.css">
</head>
<body>
<!--Main Menu-->
<div class="container">
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
<a class="navbar-brand" href="#">CompanyName</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a class="nav-link" href="index.html">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">About</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" data-toggle="dropdown">
Products
</a>
<div class="dropdown-menu">
<a class="dropdown-item" href="#">Product 1</a>
<a class="dropdown-item" href="#">Product 2</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#">Another Product</a>
</div>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Contact</a>
</li>
</ul>
</div>
</nav>
<!--Futured posts-->
<div class="jumbotron">
<h1 class="display-4">Simple. Elegant. Awesome.</h1>
<p class="lead">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. </p>
<p class="lead">
<a class="btn btn-primary btn-lg" href="#" role="button">Learn more</a>
</p>
</div>
<!--Roster Cards-->
<div class="row">
<div class="col-sm-12 col-md-4">
<div class="card mb-4">
<div class="card-body text-center">
<h5 class="card-title">Card title</h5>
<p class="card-text">Some quick example text to build on the card title</p>
<a href="#" class="card-link">Another link</a>
</div>
</div>
</div>
<div class="col-sm-12 col-md-4">
<div class="card mb-4">
<div class="card-body text-center">
<h5 class="card-title">Card title</h5>
<p class="card-text">Some quick example text to build on the card title</p>
<a href="#" class="card-link">Another link</a>
</div>
</div>
</div>
<div class="col-sm-12 col-md-4">
<div class="card mb-4">
<div class="card-body text-center">
<h5 class="card-title">Card title</h5>
<p class="card-text">Some quick example text to build on the card title</p>
<a href="#" class="card-link">Another link</a>
</div>
</div>
</div>
</div>
<div class="row mt-sm-4 mt-md-0">
<div class="col-sm-12 col-md-8 text-sm-center text-md-left">
<h3>An important heading</h3>
<p class="lead">A sort of important subheading can go here, which is larger and gray.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.</p>
<p>Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.</p>
</div>
<div class="col-sm-12 col-md-4">
<h3 class="mb-4">Secondary Menu</h3>
<ul class="nav flex-column nav-pills">
<li class="nav-item">
<a class="nav-link active" href="#">Active</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link</a>
</li>
<li class="nav-item">
<a class="nav-link disabled" href="#">Disabled</a>
</li>
</ul>
</div>
</div>
</div>
<script src="/js/jquery.min.js"></script>
<script src="/js/popper.min.js"></script>
<script src="/js/bootstrap.min.js"></script>
</body>
</html></code></pre>
</div>
</div>
</p>
| <javascript><jquery><html><css><bootstrap-4> | 2019-02-24 19:11:04 | LQ_CLOSE |
54,856,163 | Does the LOAD DATA INFILE disabled on most shared hostings? | <p>I want to use LOAD DATA INFILE to significantly faster MySQL import process in my plugin software. I hear that some shared hostings disabled this (cool) feature. Is it correct? If yes, why they did it and is it a possibility to emulate this somehow? My software is intended to run successfully on shared hostings.</p>
| <mysql><database><load><hosting> | 2019-02-24 20:22:47 | LQ_CLOSE |
54,856,511 | How to overlap SliverList on a SliverAppBar | <p>I'm trying to overlap a <code>SliverList</code> a few pixels over the <code>SliverAppBar</code>. Similar to <a href="https://stackoverflow.com/questions/53709575/allow-gridview-to-overlap-sliverappbar">this post</a>. I'd like the image in the <code>FlexibleSpaceBar</code> to go under the radius of my <code>SliverList</code>.
I'm attempting to achieve the below.</p>
<p><a href="https://i.stack.imgur.com/q045W.png" rel="noreferrer"><img src="https://i.stack.imgur.com/q045W.png" alt="enter image description here"></a> </p>
<p>I can only get the radius like so. Without the ability to overlap the <code>SliverList</code> onto he <code>SliverAppBar</code>.
<a href="https://i.stack.imgur.com/fNPT7.png" rel="noreferrer"><img src="https://i.stack.imgur.com/fNPT7.png" alt="enter image description here"></a></p>
<pre><code> @override
Widget build(BuildContext context) {
return Scaffold(
body: CustomScrollView(
slivers: <Widget>[
SliverAppBar(
floating: false,
expandedHeight: MediaQuery.of(context).size.height * 0.50,
flexibleSpace: FlexibleSpaceBar(
background: Image.network(pet.photos.first)
),
),
SliverList(
delegate: SliverChildListDelegate([
Container(
height: 40,
decoration: BoxDecoration(
color: Colors.red,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(30),
topRight: Radius.circular(30),
),
),
),
]),
)
],
),
);
}
</code></pre>
<p>Any direction would be appreciated, thanks!</p>
| <flutter><flutter-layout> | 2019-02-24 21:01:50 | HQ |
54,856,679 | Debugging multiple GDB files | <p>I am debugging a C++ code which is divided into multiple files. The code which I am debugging has 6 errors in total, both syntax and logical. I have found one error but I could not figure out a way to solve the rest. I have referred to multiple online sources including but not limited to YouTube (Bucky C++), Tutorial's Point, Geeks for Geeks and more.</p>
<p>My code is in this <a href="https://onlinegdb.com/SkpueFgUN" rel="nofollow noreferrer">link</a>.</p>
<p>Any help here would be greatly appreciated!</p>
| <c++><debugging> | 2019-02-24 21:20:05 | LQ_CLOSE |
54,857,513 | Is there a way to query for a certain amount of documents from a database with graphql? | <p>Essentially what I want to do is to be able to query, lets say, fruits(0:30). This would give me the 29 documents in the collection regarding fruits. I understand how to query documents and such in graphql, but I do not understand how I would resolve this issue. I see many examples using TypeScript or the files are .graphql and I have no idea what is going on. Is there any possible solution in only node/javascript?</p>
| <javascript><node.js><graphql> | 2019-02-24 23:14:34 | LQ_CLOSE |
54,859,153 | Why does we say azure functions as serverless compute service | Please help me understand why we say azure functions as serverless compute service. It does require cloud to host it and run. Cloud is also a server still why we are saying is serverless? | <azure><cloud> | 2019-02-25 03:34:11 | LQ_EDIT |
54,861,831 | Declare classes using 'class' or 'function' | <p>Right now, I know 2 different ways to declare a class. </p>
<p>Using <code>function</code>: </p>
<pre><code>function test (constructor) {
this.value = value;
}
test.prototype.method () {
}
</code></pre>
<p>Using <code>class</code>:</p>
<pre><code>class test {
constructor(parameters) {
this.value = value;
}
method () {
}
}
</code></pre>
<p>What is the difference (if any) between the two, and which should I use when?</p>
| <javascript> | 2019-02-25 08:04:16 | LQ_CLOSE |
54,862,023 | Displaying customUIView in a ViewController | I am creating a uiView which I want to display in my viewcontroller . I have created the UIView and it shows but the problem I have now are
1. When I call the uiview in my viewcontroller, I can no longer interact with the elements of the viewcontroller. The CostomView I created has completely prevented the interaction with my viewcontroller and I want to be able to interact with the UIViewcontroller
2. I want to hide the status bar which includes the battery percentage and networkbar and other things so the view completely covers them. I implemeted a code to cover them but it returns an error.
below is my code
class SliderView: CustomView {
@IBOutlet weak var containerView: UIView!
@IBOutlet weak var sliderImage: UIImageView!
@IBOutlet weak var sliderText: UILabel!
override func initialize() {
super.initialize()
let name = String(describing: type(of: self))
let nib = UINib(nibName: name, bundle: .main)
nib.instantiate(withOwner: self, options: nil)
self.addSubview(self.containerView)
self.containerView.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
self.containerView.topAnchor.constraint(equalTo: self.topAnchor),
self.containerView.leadingAnchor.constraint(equalTo: self.leadingAnchor),
self.containerView.trailingAnchor.constraint(equalTo: self.trailingAnchor),
])
}
override func point(inside point: CGPoint, with event: UIEvent?) -> Bool {
return sliderImage.frame.contains(point)
}
override var prefersStatusBarHidden: Bool {
return true
}
// THIS THROWS an error 'Property does not override any property from its superclass'
}
my UIView is called in my Viewcontroller like
weak var sliderView: SliderView!
override func loadView() {
super.loadView()
let sliderView = SliderView()
self.view.addSubview(sliderView)
NSLayoutConstraint.activate([
sliderView.topAnchor.constraint(equalTo: self.view.topAnchor),
sliderView.bottomAnchor.constraint(equalTo: self.view.bottomAnchor),
sliderView.leadingAnchor.constraint(equalTo: self.view.leadingAnchor),
sliderView.trailingAnchor.constraint(equalTo: self.view.trailingAnchor),
])
self.sliderView = sliderView
}
override func viewDidLoad() {
super.viewDidLoad()
sliderView.sliderText.text = "HOOOOO WORKS"
} | <ios><swift><uiview> | 2019-02-25 08:17:42 | LQ_EDIT |
54,862,388 | What is the difference between Expo CLI and React Native CLI? | <blockquote>
<p>React Native provides two way to create Project.</p>
</blockquote>
<p><strong>First:</strong> </p>
<pre><code>npm install -g expo-cli
</code></pre>
<p><strong>Second:</strong></p>
<pre><code>npm install -g react-native-cli
</code></pre>
<p>so what is different between them and what should be used if we create react native app?</p>
| <react-native><expo><react-native-cli> | 2019-02-25 08:46:17 | HQ |
54,863,458 | Force type conversion in python dataclass __init__ method | <p>I have the following very simple dataclass:</p>
<pre><code>import dataclasses
@dataclasses.dataclass
class Test:
value: int
</code></pre>
<p>I create an instance of the class but instead of an integer I use a string:</p>
<pre><code>>>> test = Test('1')
>>> type(test.value)
<class 'str'>
</code></pre>
<p>What I actually want is a forced conversion to the datatype i defined in the class defintion:</p>
<pre><code>>>> test = Test('1')
>>> type(test.value)
<class 'int'>
</code></pre>
<p>Do I have to write the <code>__init__</code> method manually or is there a simple way to achieve this?</p>
| <python><python-dataclasses> | 2019-02-25 09:52:32 | HQ |
54,864,113 | Activity indicator dynamically changing color ios swift | <p>Help me to resolve the issue or any third party available for activity indicator.</p>
<blockquote>
<p><strong>Activity indicator changing the color after we got the result</strong></p>
</blockquote>
<p>Anyone did this before?</p>
| <ios><swift><uiactivityindicatorview> | 2019-02-25 10:28:34 | LQ_CLOSE |
54,864,521 | how do i updated multiple records column value of based selected id | In products table i have fields like
id product_name product_value quantity status
1 abc 10000 50 received
2 efg 5000 15 shipment
3 hij 850 100 received
4 klm 7000 20 shipment
5 nop 350 50 received
I can select multiple rows at a time.And here i selected id=2,4 and need to change the status='received'. How to do multiple update at single time in rails | <ruby-on-rails> | 2019-02-25 10:49:49 | LQ_EDIT |
54,865,554 | How to : Skip the Header record from one .csv and Copy the Records to another csv file using command prompt or batch | <p>I got a task that says skip the header part of a csv file and copy the rest to another file. I am unable to figure out any way that can do this. I require to do this using command prompt or by writing a batch file code. I tried using for loop but dint worked </p>
| <csv><batch-file><header><command-prompt><skip> | 2019-02-25 11:50:08 | LQ_CLOSE |
54,865,663 | Randomize stylesheet.css per page visit | <p>I have a quick question what the best practice approach is with JS or Jquery concerning the randomization of stylesheets.</p>
<p>I plan to 5 to 6 different stylesheet.css documents handling only color elements (background, href, color). What I try to achieve is to randomize which stylesheet file (For example red, green, black, white) is loaded per user visit.</p>
<p>Is there a JS library for this purpose or a common practice in use already? </p>
| <javascript><jquery><css><random> | 2019-02-25 11:55:42 | LQ_CLOSE |
54,866,221 | How to create a list in C# | [![System.Collections.List Error On Creating List In C#][1]][1]
[1]: https://i.stack.imgur.com/u2VGg.png
Can anyone assist in debugging this code, please ?
Thank you. | <c#> | 2019-02-25 12:28:38 | LQ_EDIT |
54,866,860 | ASP.NET Core Identity 2.2: How to expose the users in my classes (model), or list all in my views? | I would like to expose the users in my classes (model) in order to assign an action to a user that I can select from the list of users.
> public abstract class Issue
{
public Guid IssueId { get; set; }
public IssueType IssueType { get; set; }
public string Code { get; set; }
public string Comments { get; set; }
public DateTime StartDate { get; set; }
public DateTime EndDatePrevision { get; set; }
public bool IsExtrajudicial { get; set; }
public IEnumerable<Action> Actions { get; set; }
}
I want to have a reference of users or list of users inside this class. | <c#><asp.net-core><asp.net-core-identity> | 2019-02-25 13:03:20 | LQ_EDIT |
54,867,352 | How can I deal with getActivity() on android studio? |
When I put in this code in my project, it said "Cannot resolve method getActivity"
then, how can I deal with this problem? | <java><android> | 2019-02-25 13:30:12 | LQ_EDIT |
54,867,411 | i dont use maven, spring or hibernate, just simple web dynamic app...please help me | Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'.
i am update mysql server and workbench and now i lost connection in all applications in my workspace,
sql server is 8.0.15;
I put it connector8.0.15.jar in all applications but it does not work | <java><sql><eclipse> | 2019-02-25 13:33:17 | LQ_EDIT |
54,869,876 | precision of java floating-point numbers | If we run the following code:
float f = 1.2345678990922222f;
double d = 1.22222222222222222222d;
System.out.println("f = " + f + "\t" + "d = " + d);
it prints:
f = 1.2345679 d = 1.2222222222222223
The long tail in the literal 1.2345678990922222 is ignored but the long tail in 1.22222222222222222222 is not (the last decimal digit in the variable d becomes 3 instead of 2). Anybody knows why?
| <java><floating-point><precision> | 2019-02-25 15:45:44 | LQ_EDIT |
54,870,338 | How can i sync my code live between a macbook and a windows computer? | They are connected to the same network, and i use Synergy to use them together. I use Jetbrains IDE's and Visual Studio. What i am looking for is that code synchronizes live between the two devices while i'm editing. So when i take my macbook with me and do a bit of coding on it, when it reconnects to my home network, it should synchronize these changes with my computer. I want it do synchronize live at home. So without re-opening the file. Is there a way to accomplish this with Git(hub)? (i dont know much about git) Anything that is fast enough for live sync on the home network is good enough. Thanks. | <git><visual-studio-code><jetbrains-ide> | 2019-02-25 16:09:25 | LQ_EDIT |
54,871,492 | Need to edit google script to copy a row and move to another sheet | Right now this script is erasing the data in the row and deleting the row after moving the row to the other sheet. The idea is to keep the data on the row and just copy over the row when the commissions have been verified. The companies and products our business is paid on, stays consistent. So I want this script to copy the row and keep it in the original sheet so that I can edit the cells we enter in how much we were paid each month. Thank you in advance!
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-js -->
function Reporting() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var s = ss.getSheetByName('SunLife');
var range = s.getRange(2,1,s.getLastRow()-1,1).getValues()
for(i=s.getMaxRows()-2;i>0;i--){
var cell = range[i][0]
if(cell == 'Yes') {
var row = s.getRange(2+i,1).getRow();
var numColumns = s.getLastColumn();
var targetSheet = ss.getSheetByName("Reporting");
var target = targetSheet.getRange(targetSheet.getLastRow() + 1, 1);
s.getRange(row, 1, 1, numColumns).moveTo(target);
}else{continue}
}
}
<!-- end snippet -->
| <google-apps-script> | 2019-02-25 17:19:41 | LQ_EDIT |
54,871,714 | Having a Null pointer exception while coding my first GUI and I can't figure out where it's going wrong | <pre><code>import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
public class JFrameTest {
private MyListener listener = new MyListener();
private JButton clear = null;
private JButton addOne = null;
private static JFrame frame = null;
private JTextField text1 = null;
private JTextField text2 = null;
private JTextField text3 = null;
private JTextField text4 = null;
private JTextField text5 = null;
private JTextField text6 = null;
public static void main(String[] args) {
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();
}
});
}
private static void createAndShowGUI() {
//Create and set up the window.
frame = new JFrame("Button & Listener Demo");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.add(new JFrameTest().createGUI());
//Display the window.
frame.setSize(800, 500);
frame.setVisible(true);
}
public JTabbedPane createGUI(){
JTabbedPane tabbedPane = new JTabbedPane();
JPanel one = new JPanel();
one.setLayout(new BorderLayout());
JPanel test = new JPanel();
JPanel test2 = new JPanel();
JLabel label1 = new JLabel ("Pound");
JLabel label2 = new JLabel("Ounce :" );
JLabel label3 = new JLabel("Ton :");
JLabel label4 = new JLabel("Tonne :");
JLabel label5 = new JLabel("Kilogram :");
JLabel label6 = new JLabel("Gram :");
text1 = new JTextField(5);
text2 = new JTextField(5);
text3 = new JTextField(5);
text4 = new JTextField(5);
text5 = new JTextField(5);
text6 = new JTextField(5);
JButton button = new JButton();
clear = new JButton("Clear");
clear.addActionListener(listener);
text1.setText("0");
text2.setText("0");
text3.setText("0");
text4.setText("0");
text5.setText("0");
text6.setText("0");
test.add(label1);
test.add(text1);
test.add(label2);
test.add(text2);
test.add(label3);
test.add(text3);
test2.add(label4);
test2.add(text4);
test2.add(label5);
test2.add(text5);
test2.add(label6);
test2.add(text6);
one.add(test, BorderLayout.NORTH);
one.add(test2, BorderLayout.CENTER);
one.add(clear, BorderLayout.SOUTH);
tabbedPane.addTab("Tab 1", one);
JPanel two = new JPanel();
tabbedPane.addTab("Tab 2", two);
return tabbedPane;
}
public class MyListener implements ActionListener{
@Override
public void actionPerformed(ActionEvent e) {
JButton source = (JButton)e.getSource();
String sourceName = source.getName();
if(sourceName.equals("Clear"))
{
System.out.println("yeet");
text1.setText("00");
text2.setText("00");
text3.setText("00");
text4.setText("00");
text5.setText("00");
text6.setText("00");
}
else
{
System.out.println("nah");
}
}
}
}
</code></pre>
<blockquote>
<p>And my error code is:Exception in thread "AWT-EventQueue-0"
java.lang.NullPointerException
at jframetest.JFrameTest$MyListener.actionPerformed(JFrameTest.java:123)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
at java.awt.Component.processMouseEvent(Component.java:6533)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
at java.awt.Component.processEvent(Component.java:6298)
at java.awt.Container.processEvent(Container.java:2236)
at java.awt.Component.dispatchEventImpl(Component.java:4889)
at java.awt.Container.dispatchEventImpl(Container.java:2294)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
at java.awt.Container.dispatchEventImpl(Container.java:2280)
at java.awt.Window.dispatchEventImpl(Window.java:2746)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:90)
at java.awt.EventQueue$4.run(EventQueue.java:731)
at java.awt.EventQueue$4.run(EventQueue.java:729)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)</p>
</blockquote>
| <java><swing> | 2019-02-25 17:34:28 | LQ_CLOSE |
54,873,807 | I'm confused how to proceed with creating a user defined function (PHP) | I'm taking a highschool CS class but the one homework question is really confusing me. So essentially, I'm supposed to create a function that uses 2 arguments. Both of the arguments are strings. One of the arguments is this text (Placeholder text here.) and the other argument is a letter, either A or B. If it's A, I need to change the case using the built in php function of the text to upper case. If it's B, I need to change the case using the built in php function of the text to lower case.
Okay, so I know I have to use an elseif statement, but I'm just not sure how I should proceed. If anyone could give me some starters that would be much appreciated.
Thank you for reading! | <php> | 2019-02-25 20:03:00 | LQ_EDIT |
54,874,747 | Formulario Angular 7 en producción | estoy tratando de poner en funcionamiento un formulario que me envia datos al correo con nodemailer
en localhost:3000 me funciona bien pero al momento de cargar mi proyecto en el servidor con godaddy no logro ponerlo a funcionar este es mi código
una app en la raiz del proyecto llamada nodeMensajeria/src/node modules, app.js y configMensaje.js
[mira la raiz de mi proyecto][1]
app.js
const express = require('express');
const cors = require('cors');
const bodyParser = require('body-parser');
const configMensaje = require('./configMensaje');
const app = express();
app.use(bodyParser.json());
app.use(cors())
app.post('/formulario', (req, res) => {
configMensaje(req.body);
res.status(200).send();
})
app.listen(3000, () => {
console.log('Servidor corriendo')
});
configMensaje.js
const nodemailer = require('nodemailer');
module.exports = (formulario) => {
var transporter = nodemailer.createTransport({
service: 'gmail',
auth: {
user: 'correoorigen',
pass: 'contraseña'
}
});
const mailOptions = {
from: `"${formulario.nombre} 👻" <${formulario.email}>`,
to: 'correodestino', //
subject: formulario.asunto,
html: `
<strong>Nombre:</strong> ${formulario.nombre} <br/>
<strong>Asunto:</strong> ${formulario.asunto} <br/>
<strong>E-mail:</strong> ${formulario.email} <br/>
<strong>Número de contacto:</strong> ${formulario.contacto} <br/>
<strong>Mensaje:</strong> ${formulario.mensaje}
`
};
transporter.sendMail(mailOptions, function (err, info) {
if (err)
console.log(err)
else
console.log(info);
});
}
el servicio message.service.ts
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http'
@Injectable({
providedIn: 'root'
})
export class MessageService {
constructor(private _http: HttpClient) { }
sendMessage(body) {
return this._http.post('http://107.180.59.131:3000/formulario', body);
}
}
Estoy usando la ip de mi dominio
app.component.ts
import { Component, OnInit } from '@angular/core';
import { MessageService } from '../services/message.service';
import swal from 'sweetalert';
import { VirtualTimeScheduler } from 'rxjs';
@Component({
selector: 'app-form',
templateUrl: './form.component.html',
styleUrls: ['./form.component.scss']
})
export class FormComponent implements OnInit {
constructor(public _MessageService: MessageService) { }
contactForm(form) {
this._MessageService.sendMessage(form).subscribe(() => {
swal("Formulario de contacto", "Mensaje enviado correctamente", 'success');
});
}
ngOnInit() {
}
}
En el servidor he instalado nodejs y pm2 para usar pm2 start app.js por medio de ssh y obtengo
[Me muestra que que la app esta ejecutada][2]
pero al momento de enviar el formulario en producción me muestra el siguiente error
Failed to load resource: net::ERR_CONNECTION_TIMED_OUT
main.5cb5f6b8477568c35bd7.js:1 ERROR e {headers: t, status: 0, statusText: "Unknown Error", url: "http://107.180.59.131:3000/formulario", ok: false, …}
[mira el error][3]
[1]: https://i.stack.imgur.com/6jyBH.jpg
[2]: https://i.stack.imgur.com/KczRe.jpg
[3]: https://i.stack.imgur.com/IJjvW.jpg
espero me puedan ayudar con este problema amigos
saludos, | <node.js><angular><pm2><nodemailer> | 2019-02-25 21:12:25 | LQ_EDIT |
54,875,226 | Pepper's tablet default | <p>I'm new about Pepper robot. At the first beginning of Pepper using it's tablet shows three circles include Retail,Office and tourism. Now, the Pepper's tablet just show something such as screensavers. How I can change it's tablet's mode to first configuration?
I also did reset factory but It doesn't return to my desire mode instead of showing screensavers.
<a href="https://i.stack.imgur.com/uC6G4.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uC6G4.jpg" alt="enter image description here"></a></p>
<p><a href="https://i.stack.imgur.com/YkXSg.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YkXSg.jpg" alt="enter image description here"></a></p>
| <tablet><robotics><nao-robot><pepper><choregraphe> | 2019-02-25 21:52:41 | LQ_CLOSE |
54,876,935 | cannot be resolved to a variable eclipse main class | <p>I am fairly new at this and have been looking for a solution on Internet for two days, yet, I could not find any.</p>
<p>This is the class that I identified and initialized variables.</p>
<pre><code> package HelloWorld;
import java.awt.*;
public class Car {
double averageMilesPerGallon;
String licensePlate;
Color paintColor;
boolean areTaillightsWorking;
public Car(double inputAverageMPG,
String inputLicensePlate,
Color inputPaintColor,
boolean inputAreTaillightsWorking) {
this.averageMilesPerGallon = inputAverageMPG;
this.licensePlate = inputLicensePlate;
this.paintColor = inputPaintColor;
this.areTaillightsWorking = inputAreTaillightsWorking;
}
}
</code></pre>
<p>Then, I wanted use these variables in my main class; however, it did not work. I received an error that was saying; "inputAverageMPG cannot be resolved to a variable" and "inputLicensePlate cannot be resolved to a variable." Please refer below to see the main class wherein I received the error.</p>
<pre><code>package HelloWorld;
public class Main {
public static void main(String[] args) {
System.out.println("yes");
Car myCar = new Car(inputAverageMPG = 25.5, inputLicensePlate "12HTHF");
}
}
</code></pre>
| <java> | 2019-02-26 00:48:29 | LQ_CLOSE |
54,877,104 | How to prevent web crawlers in your PHP file | <p>How to prevent web crawlers in your PHP file? I need to add a code that would stop web crawlers from crawling in to my website. </p>
| <php> | 2019-02-26 01:17:51 | LQ_CLOSE |
54,877,463 | PHP How To Create new Url for New Post | <p>I would like to know how to create a new url for each file upload. When people upload videos on the site, I would like the video to have its own url like this: "localhost/example.com/string". For example, Youtube has a new url for each upload like this "<a href="https://www.youtube.com/watch?v=209fsloiwifo" rel="nofollow noreferrer">https://www.youtube.com/watch?v=209fsloiwifo</a>" Is there a way for me to create a new url for each new post in php?</p>
| <php><mysql><post><dns> | 2019-02-26 02:12:46 | LQ_CLOSE |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.