qid int64 1 74.7M | question stringlengths 15 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 4 30.2k | response_k stringlengths 11 36.5k |
|---|---|---|---|---|---|
16,168,458 | I have this:
* 110121 NATURAL 95 1570,40
* 110121 NATURAL 95 1570,40\*
* 41,110 1 x 38,20 CZK)[A] \*
* ' 31,831 261,791 1308,61)
* >01572 PRAVO SO 17,00
* 1,000 ks x 17,00
* 1570,40
Every line of this output is saved in List and I want to get number 1570,40
My regular expressions looks like this for this type of for... | 2013/04/23 | [
"https://Stackoverflow.com/questions/16168458",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1281305/"
] | Not sure I well understand your needs, but I think you could use word boundaries like:
```
\b([1-9]\d*[.,]\d{2})\b
```
In order to not match dates, you can use:
```
(?:^|[^.,\d])(\d+[,.]\d\d)(?:[^.,\d]|$)
```
**explanation:**
```
The regular expression:
(?-imsx:(?:^|[^.,\d])(\d+[,.]\d\d)(?:[^.,\d]|$))
matches ... | Try this:
```
String s = "41,110 1 x 38,20 CZK)[A] * ";
Matcher m = Pattern.compile("\\d+,\\d+").matcher(s);
while(m.find()) {
System.out.println(m.group());
}
``` |
16,168,458 | I have this:
* 110121 NATURAL 95 1570,40
* 110121 NATURAL 95 1570,40\*
* 41,110 1 x 38,20 CZK)[A] \*
* ' 31,831 261,791 1308,61)
* >01572 PRAVO SO 17,00
* 1,000 ks x 17,00
* 1570,40
Every line of this output is saved in List and I want to get number 1570,40
My regular expressions looks like this for this type of for... | 2013/04/23 | [
"https://Stackoverflow.com/questions/16168458",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1281305/"
] | Not sure I well understand your needs, but I think you could use word boundaries like:
```
\b([1-9]\d*[.,]\d{2})\b
```
In order to not match dates, you can use:
```
(?:^|[^.,\d])(\d+[,.]\d\d)(?:[^.,\d]|$)
```
**explanation:**
```
The regular expression:
(?-imsx:(?:^|[^.,\d])(\d+[,.]\d\d)(?:[^.,\d]|$))
matches ... | The `"([1-9][0-9]*[\\.|,][0-9]{2})[^\\.\\d](.*)"` has `[^\\.\\d]`, it means it expects one non-digit, non-dot symbol right after the number. The second line has `*` which matches it. First line has the number at the end of line, so nothing matches. I think you need just one regexp which will catch all numbers: `[^.\\d]... |
4,477,777 | I downloaded XAMPP xampp-linux-1.7.3a.tar.gz and followed the same steps as given in the link <http://www.apachefriends.org/en/faq-xampp-linux.html#start>.
After following all the steps, mysql is not starting. The error that i am getting is
```
> [root@localhost bin]# pwd
> /opt/lampp/bin
> [root@localhost bin]# ./... | 2010/12/18 | [
"https://Stackoverflow.com/questions/4477777",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/66593/"
] | It's true that git doesn't permanently store this information, but you can likely find out anyway. Git has reflogs!
```
git reflog show <branch>
```
If the branch was created in the last 90 days (by default; use `gc.reflogExpire` to change this), the last line in that reflog will be the creation of the branch.
I'm ... | Git doesn't really have a concept of this, if you want to add this, you'd need to add a heuristic, because all git really cares about is attaching a label to a given commit in the tree. |
4,477,777 | I downloaded XAMPP xampp-linux-1.7.3a.tar.gz and followed the same steps as given in the link <http://www.apachefriends.org/en/faq-xampp-linux.html#start>.
After following all the steps, mysql is not starting. The error that i am getting is
```
> [root@localhost bin]# pwd
> /opt/lampp/bin
> [root@localhost bin]# ./... | 2010/12/18 | [
"https://Stackoverflow.com/questions/4477777",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/66593/"
] | It's true that git doesn't permanently store this information, but you can likely find out anyway. Git has reflogs!
```
git reflog show <branch>
```
If the branch was created in the last 90 days (by default; use `gc.reflogExpire` to change this), the last line in that reflog will be the creation of the branch.
I'm ... | I guess you looking for
```
git log --graph --oneline --all
```
Check this thread out for a more detailed explaination.
[Stackoverflow answer](https://stackoverflow.com/a/4991675/3050426) |
3,063,714 | Consider the following subsets of the plane $\mathbb{R}^2$:
$$X=\{(x,y)|y=0\}\cup \{(x,y)|x>0\text{ and}\; y=1/x\}$$
How to show that $A$ and $B$ are open in $X$ under subspace topology.
Efforts:
Let's define $A=\{(x,y)|y=0\}$ and $B=\{(x,y)|x>0\text{ and}\; y=1/x\}$.
To show that $A$ is open I need to find an op... | 2019/01/06 | [
"https://math.stackexchange.com/questions/3063714",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/581242/"
] | Note that both $A$ and $B$ are closed in $\mathbb R^2$ (why?), and so $M:=\mathbb R^2\backslash B$ and $N:=\mathbb R^2\backslash A$ are open in $\mathbb R^2$. Consequently, since $X=A\cup B$ and $A\cap B=\emptyset$, we have $A=X\cap M$ and $B=X\cap N$, showing that both $A$ and $B$ are also open in $X$.
Note that thi... | Hint: It might be easier to show that both $A,B$ are closed in $X$, and then since $X = A \cup B$, we immediately have that $A,B$ are both open in $X$. |
20,597 | Imagine a simple tree:
```
\begin{tikzpicture}
\node {Selbstregulation}
[edge from parent fork down]
child {node {Kognition}}
child {node {Metakognition}
child {node {Planung}}
child {node {Monotoring}}
child {node {Regulation}}
}
\end{tikzpicture}
```
Is it possible to unveil t... | 2011/06/13 | [
"https://tex.stackexchange.com/questions/20597",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/6095/"
] | A TikZ option to set the color to white depending on the current slide:
```
\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{trees}
\tikzset{hide on/.code={\only<#1>{\color{white}}}}
\begin{document}
\begin{frame}
\begin{tikzpicture}
\only<4>{} % Force beamer to show the correct amount of slides
\no... | [I have been told this is not possible](http://osdir.com/ml/tex.latex.beamer.general/2007-02/msg00029.html). [The package author wrote in 2005 that it wasn't](http://comments.gmane.org/gmane.comp.tex.latex.beamer.general/432). If the ability has been added I do not know of it.
My correspondent's advice is the best wor... |
20,597 | Imagine a simple tree:
```
\begin{tikzpicture}
\node {Selbstregulation}
[edge from parent fork down]
child {node {Kognition}}
child {node {Metakognition}
child {node {Planung}}
child {node {Monotoring}}
child {node {Regulation}}
}
\end{tikzpicture}
```
Is it possible to unveil t... | 2011/06/13 | [
"https://tex.stackexchange.com/questions/20597",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/6095/"
] | [I have been told this is not possible](http://osdir.com/ml/tex.latex.beamer.general/2007-02/msg00029.html). [The package author wrote in 2005 that it wasn't](http://comments.gmane.org/gmane.comp.tex.latex.beamer.general/432). If the ability has been added I do not know of it.
My correspondent's advice is the best wor... | I improved the answer of Caramdir using opacity instead of color white, changing:
```
\tikzset{hide on/.code={\only<#1>{\color{white}}}}
```
with:
```
\tikzset{hide on/.code={\only<#1>{\color{fg!20}}}}
```
in my case I wanted a semitransparent effect, you can also set "fg!0" for full hiding, or any other level of... |
20,597 | Imagine a simple tree:
```
\begin{tikzpicture}
\node {Selbstregulation}
[edge from parent fork down]
child {node {Kognition}}
child {node {Metakognition}
child {node {Planung}}
child {node {Monotoring}}
child {node {Regulation}}
}
\end{tikzpicture}
```
Is it possible to unveil t... | 2011/06/13 | [
"https://tex.stackexchange.com/questions/20597",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/6095/"
] | A TikZ option to set the color to white depending on the current slide:
```
\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{trees}
\tikzset{hide on/.code={\only<#1>{\color{white}}}}
\begin{document}
\begin{frame}
\begin{tikzpicture}
\only<4>{} % Force beamer to show the correct amount of slides
\no... | I improved the answer of Caramdir using opacity instead of color white, changing:
```
\tikzset{hide on/.code={\only<#1>{\color{white}}}}
```
with:
```
\tikzset{hide on/.code={\only<#1>{\color{fg!20}}}}
```
in my case I wanted a semitransparent effect, you can also set "fg!0" for full hiding, or any other level of... |
33,708,854 | The problem is I have to use curl and sometimes the curl requests take a long time because of the timeouts. I have set the timeouts to 1 second so no request should take more than 1 second but still the server is unable to process other php requests.
My question is how many concurrent scripts(running at the same time)... | 2015/11/14 | [
"https://Stackoverflow.com/questions/33708854",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5492657/"
] | If I take your question literally (i.e. invoke `doGet()` from `doPost()`), you can just invoke the `doGet()` method... it's a standard method like any other.
Here's a tip: When the `doPost()` and `doGet()` methods share a common set of logic, it's a good practice to isolate that logic into a separate (private) method ... | You can do that, it's a simple
```
this.doGet(req, resp);
return;
```
However, it's not a best practice. Generally better to implement view logic as a JSP, and dispatch to it from the post logic...
```
this. getServletConfig().getRequestDispatcher("my_view.jsp")
.forward(req,resp);;
return;
```
Or use... |
26,219 | I have a 2002 Hyundai XG350, and all of the wires from the battery run out of sight before connecting to the chassis. There is only one wire coming off of the negative, and a number of different cables coming off of the positive. I know that it's most likely that my car is a negative ground, but I wanted to check with ... | 2016/02/18 | [
"https://mechanics.stackexchange.com/questions/26219",
"https://mechanics.stackexchange.com",
"https://mechanics.stackexchange.com/users/5175/"
] | I think that they stopped making positive earth cars in the 1960s.I have never seen a positive earth car with an alternater .All the pos earth stuff I had seen had generators and was generally british .Neg earth corrodes the wiring and pos earth corrodes the body .The choice is obvious .If you are still worried that yo... | You can ground to the engine if the battery terminal isn't accessible. If the battery terminals aren't marked, on (some) Hyundais there will be fusible links on the positive battery terminal. And usually the cable is red and larger gauge than the negative battery cable. |
58,620,358 | I want to check if a given email exists in auth\_user of django
First I import
```
from django.contrib.auth.models import User
```
In the controller, I test like this:
```
user_by_email = User.objects.get(email=email) # internal server error at this point.
if user_by_email is not None:
return HttpResponseBadRe... | 2019/10/30 | [
"https://Stackoverflow.com/questions/58620358",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/577647/"
] | Maybe you should use `filter`
```py
user_by_email = User.objects.filter(email=email).first()
if not user_by_email:
return HttpResponseBadRequest()
``` | OK I found an answer:
When you use filter, it doesn't cause internal server error:
```
user_by_username = User.objects.filter(username=username).first()
if user_by_username is not None:
return HttpResponseBadRequest()
``` |
4,770,649 | <http://www.w3.org/TR/css3-roadmap/>
Hasn't CSS3 been out since a while now? Why is most of the specification not complete?
Is there a complete reference anywhere on the web (or in a book)? | 2011/01/22 | [
"https://Stackoverflow.com/questions/4770649",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/478205/"
] | Wikipedia has a nicely compiled [list of CSS3 specs](https://en.wikipedia.org/wiki/Cascading_Style_Sheets#CSS_3). | Does this link help: <http://www.w3.org/TR/#tr_CSS>
Standards are a slow process -- you can see newer stuff in that list. A book is probably your best bet to see a "distilled" version. |
4,770,649 | <http://www.w3.org/TR/css3-roadmap/>
Hasn't CSS3 been out since a while now? Why is most of the specification not complete?
Is there a complete reference anywhere on the web (or in a book)? | 2011/01/22 | [
"https://Stackoverflow.com/questions/4770649",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/478205/"
] | Wikipedia has a nicely compiled [list of CSS3 specs](https://en.wikipedia.org/wiki/Cascading_Style_Sheets#CSS_3). | The problem is it's hard to find an *authoritative* single source of documentation for CSS3. [CSS2.1 spec](https://www.w3.org/TR/CSS2/) was easy to find. It was one monolithic easy to read spec even when it was a draft. [However](https://www.w3.org/TR/css-2010/#intro):
>
> for CSS beyond Level 2, the CSS Working Grou... |
4,770,649 | <http://www.w3.org/TR/css3-roadmap/>
Hasn't CSS3 been out since a while now? Why is most of the specification not complete?
Is there a complete reference anywhere on the web (or in a book)? | 2011/01/22 | [
"https://Stackoverflow.com/questions/4770649",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/478205/"
] | CSS 2.1 was finalized only a couple of years ago. As Hogan said, this could take 10 years. CSS3 was introduced just a few years ago itself. Standards are based on implementation, not invention. | This is a presentation I wrote showing [the state of the union in HTML5](http://www.slideshare.net/senchainc/html5-state-of-the-union) (and satellite specs) and CSS3. The CSS3 section is in the middle.
CSS3 basics are there, but there are many advanced features that have not been implemented yet, and IE is particularl... |
4,770,649 | <http://www.w3.org/TR/css3-roadmap/>
Hasn't CSS3 been out since a while now? Why is most of the specification not complete?
Is there a complete reference anywhere on the web (or in a book)? | 2011/01/22 | [
"https://Stackoverflow.com/questions/4770649",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/478205/"
] | CSS 2.1 was finalized only a couple of years ago. As Hogan said, this could take 10 years. CSS3 was introduced just a few years ago itself. Standards are based on implementation, not invention. | Does this link help: <http://www.w3.org/TR/#tr_CSS>
Standards are a slow process -- you can see newer stuff in that list. A book is probably your best bet to see a "distilled" version. |
4,770,649 | <http://www.w3.org/TR/css3-roadmap/>
Hasn't CSS3 been out since a while now? Why is most of the specification not complete?
Is there a complete reference anywhere on the web (or in a book)? | 2011/01/22 | [
"https://Stackoverflow.com/questions/4770649",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/478205/"
] | This work takes time, a lot to be done.
Check "CSS3 for Web Designers"
<http://books.alistapart.com/products/css3-for-web-designers> | This is a presentation I wrote showing [the state of the union in HTML5](http://www.slideshare.net/senchainc/html5-state-of-the-union) (and satellite specs) and CSS3. The CSS3 section is in the middle.
CSS3 basics are there, but there are many advanced features that have not been implemented yet, and IE is particularl... |
4,770,649 | <http://www.w3.org/TR/css3-roadmap/>
Hasn't CSS3 been out since a while now? Why is most of the specification not complete?
Is there a complete reference anywhere on the web (or in a book)? | 2011/01/22 | [
"https://Stackoverflow.com/questions/4770649",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/478205/"
] | CSS 2.1 was finalized only a couple of years ago. As Hogan said, this could take 10 years. CSS3 was introduced just a few years ago itself. Standards are based on implementation, not invention. | Wikipedia has a nicely compiled [list of CSS3 specs](https://en.wikipedia.org/wiki/Cascading_Style_Sheets#CSS_3). |
4,770,649 | <http://www.w3.org/TR/css3-roadmap/>
Hasn't CSS3 been out since a while now? Why is most of the specification not complete?
Is there a complete reference anywhere on the web (or in a book)? | 2011/01/22 | [
"https://Stackoverflow.com/questions/4770649",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/478205/"
] | This work takes time, a lot to be done.
Check "CSS3 for Web Designers"
<http://books.alistapart.com/products/css3-for-web-designers> | Does this link help: <http://www.w3.org/TR/#tr_CSS>
Standards are a slow process -- you can see newer stuff in that list. A book is probably your best bet to see a "distilled" version. |
4,770,649 | <http://www.w3.org/TR/css3-roadmap/>
Hasn't CSS3 been out since a while now? Why is most of the specification not complete?
Is there a complete reference anywhere on the web (or in a book)? | 2011/01/22 | [
"https://Stackoverflow.com/questions/4770649",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/478205/"
] | This work takes time, a lot to be done.
Check "CSS3 for Web Designers"
<http://books.alistapart.com/products/css3-for-web-designers> | The problem is it's hard to find an *authoritative* single source of documentation for CSS3. [CSS2.1 spec](https://www.w3.org/TR/CSS2/) was easy to find. It was one monolithic easy to read spec even when it was a draft. [However](https://www.w3.org/TR/css-2010/#intro):
>
> for CSS beyond Level 2, the CSS Working Grou... |
4,770,649 | <http://www.w3.org/TR/css3-roadmap/>
Hasn't CSS3 been out since a while now? Why is most of the specification not complete?
Is there a complete reference anywhere on the web (or in a book)? | 2011/01/22 | [
"https://Stackoverflow.com/questions/4770649",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/478205/"
] | Wikipedia has a nicely compiled [list of CSS3 specs](https://en.wikipedia.org/wiki/Cascading_Style_Sheets#CSS_3). | This is a presentation I wrote showing [the state of the union in HTML5](http://www.slideshare.net/senchainc/html5-state-of-the-union) (and satellite specs) and CSS3. The CSS3 section is in the middle.
CSS3 basics are there, but there are many advanced features that have not been implemented yet, and IE is particularl... |
4,770,649 | <http://www.w3.org/TR/css3-roadmap/>
Hasn't CSS3 been out since a while now? Why is most of the specification not complete?
Is there a complete reference anywhere on the web (or in a book)? | 2011/01/22 | [
"https://Stackoverflow.com/questions/4770649",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/478205/"
] | CSS 2.1 was finalized only a couple of years ago. As Hogan said, this could take 10 years. CSS3 was introduced just a few years ago itself. Standards are based on implementation, not invention. | The problem is it's hard to find an *authoritative* single source of documentation for CSS3. [CSS2.1 spec](https://www.w3.org/TR/CSS2/) was easy to find. It was one monolithic easy to read spec even when it was a draft. [However](https://www.w3.org/TR/css-2010/#intro):
>
> for CSS beyond Level 2, the CSS Working Grou... |
32,422,074 | I'm trying to style some links such that they appear bold if not visited before, and appear as normal if they have been visited before.
HTML:
```
<a href="http://www.facebook.com/" target="_blank">Facebook</a><br>
<a href="http://stackoverflow.com/questions/6962541/how-do-i-define-font-weight-in-css?lq=1" target="_b... | 2015/09/06 | [
"https://Stackoverflow.com/questions/32422074",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3040176/"
] | The reason is that not all attributes are allowed for the `:visited` pseudo selector. See [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/Privacy_and_the_:visited_selector).
You could use other attirubtes, such as `color: green`. | It seems like a browsers limitation.
It seems like a browsers limitation.
"For many years the CSS :visited selector has been a vector for querying a user’s history. It’s not particularly dangerous by itself, but when it’s combined with getComputedStyle() in JavaScript it means that someone can walk through your history... |
32,422,074 | I'm trying to style some links such that they appear bold if not visited before, and appear as normal if they have been visited before.
HTML:
```
<a href="http://www.facebook.com/" target="_blank">Facebook</a><br>
<a href="http://stackoverflow.com/questions/6962541/how-do-i-define-font-weight-in-css?lq=1" target="_b... | 2015/09/06 | [
"https://Stackoverflow.com/questions/32422074",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3040176/"
] | The reason is that not all attributes are allowed for the `:visited` pseudo selector. See [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/Privacy_and_the_:visited_selector).
You could use other attirubtes, such as `color: green`. | It's not `font-weight: normal` that don't work it's your browser.
Because if you add `font-weight: normal` on the hover property it will work.
Look at [this answer](https://stackoverflow.com/questions/8331688/why-doesnt-this-avisited-css-style-work) |
437 | Rant incoming...
I think this fracturing of SO into a 'subjective' and 'non-subjective' version is the worst idea since New Coke. Its idealogical nonsense in the face of what made SO great, i.e. a sense of community and the improving thereof. What was unworkable about stucking 'subjective' tags on subjective questions... | 2010/10/14 | [
"https://softwareengineering.meta.stackexchange.com/questions/437",
"https://softwareengineering.meta.stackexchange.com",
"https://softwareengineering.meta.stackexchange.com/users/5341/"
] | We tried to agree on a set of guidelines for asking and marking overly-subjective questions on SO... And failed.
We tried to agree on a set of guidelines for creating "list" and "gtky" questions... And failed.
We tried to agree on a set of guidelines for using Community Wiki on SO... And failed.
So now subjective, l... | I didn't think there was anything wrong with the subjective tag, but there is a problem with subjective questions. **Stack Overflow was made great because you could come here and get a good quick answer.** I love being able to get my questions answered quick.
I also like to answer questions, but with all the subjectiv... |
50,604,579 | I am still new to java 8 , I want to convert a loop like this :
```
//result is List<String>
for(String elem:result) {
if(elem.contains(".")) {
elem = elem.split("\\.")[0];
}
}
```
to java 8 stream style .. how can I accomplish this ?
what I tried so far :
```
result.stream().map(String::split("\\... | 2018/05/30 | [
"https://Stackoverflow.com/questions/50604579",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2866298/"
] | You can use the following code fragment
```
do {
System.out.println("Please enter the age: ");
p1.setAge(scan.nextInt());
} while(p1.getAge() < 0);
``` | You should use loop for this.
You can change the definition of `setAge()` as following:
```
public boolean setAge(int _age) {
if (_age < 0) {
System.out.println("Wrong age. Please input correct age.");
return false;
}
age = _age;
return true;
}
```
and calling as following:
```
wh... |
23,213,186 | I am trying to make a slider that changes images with mouse click on a right arrow button, but I suffer some blank frames. I want it to be seamless. here are my codes:
html:
```
<div id="img_slider">
<img src="../images/proj/1(2).jpg" id="img_1" class="slide_img"/>
<img src="../images/proj/1.jpg"id="img_2" cl... | 2014/04/22 | [
"https://Stackoverflow.com/questions/23213186",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2870404/"
] | You could introduce paging into the grid, and only extract from the database the records which you are going to display. Another approach would be to extract data, cache it, and then access the cache - but in this case first time round would still be slow.
If extracting a large data set is the problem, I would conside... | Which part is slowing down? Have you tried to time the SQL query?
Never used MySQL this way, but usual optimization techniques are [stored procedures](http://dev.mysql.com/doc/connector-net/en/connector-net-tutorials-stored-procedures.html) and [indexes](https://dev.mysql.com/doc/refman/5.5/en/optimization-indexes.htm... |
69,085,238 | [enter image description here](https://i.stack.imgur.com/mLw9E.jpg)
I can't describe the problem thoroughly because I don't know rhythm game terms.
*In the picture*
* The white cube Note represents the object which the player needs to hit on time.
* The green rectangle Line is the representation of the timing. When ... | 2021/09/07 | [
"https://Stackoverflow.com/questions/69085238",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16849609/"
] | Like you said; The semaphore is used to limit the concurrent threads. But the body is still executed concurrently. So locks/interlocked is required.
The bigger problem is: Using `Interlocked.Exchange(ref current, mCurrentScanner);` to read the value safely and using the `Interlocked.Increment(ref mCurrentScanner);`.
... | It seems that the purpose of the semaphore is to protect the long running task and not to protect access to the private variables.
This is is useful from a resource management perspective. For example to prevent too many concurrent long running tasks from trashing a shared resource like a database.
The interlocked sta... |
18,307,631 | I am trying to find out how to show/hide an element depending on the fact whether the element ".question a" has the class "checked" or not. But it isn't working. Anybody knows why ;( ?
```
$().ready(function() {
var myLink = ".question a";
if (myLink.hasClass('checked')) {
$('.answer').show(300);
... | 2013/08/19 | [
"https://Stackoverflow.com/questions/18307631",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2695264/"
] | Try like
```
$(document).ready(function() {
var myLink = $(".question a");
if (myLink.hasClass('checked')) { //You can also use $(this).hasClass
$('.answer').show(300);
}
else {
$('.answer').hide(300);
}
});
```
If you want to change the status of link then call the same while ... | Try
```
$(function() {
var myLink = $(".question a"); // need to use jQuery selector here
if (myLink.hasClass('checked')) {
$('.answer').show(300);
}
else {
$('.answer').hide(300);
}
});
``` |
18,307,631 | I am trying to find out how to show/hide an element depending on the fact whether the element ".question a" has the class "checked" or not. But it isn't working. Anybody knows why ;( ?
```
$().ready(function() {
var myLink = ".question a";
if (myLink.hasClass('checked')) {
$('.answer').show(300);
... | 2013/08/19 | [
"https://Stackoverflow.com/questions/18307631",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2695264/"
] | Try like
```
$(document).ready(function() {
var myLink = $(".question a");
if (myLink.hasClass('checked')) { //You can also use $(this).hasClass
$('.answer').show(300);
}
else {
$('.answer').hide(300);
}
});
```
If you want to change the status of link then call the same while ... | **Repalce**
```
var myLink = ".question a";
```
**With**
```
var myLink = $(".question a");
``` |
18,307,631 | I am trying to find out how to show/hide an element depending on the fact whether the element ".question a" has the class "checked" or not. But it isn't working. Anybody knows why ;( ?
```
$().ready(function() {
var myLink = ".question a";
if (myLink.hasClass('checked')) {
$('.answer').show(300);
... | 2013/08/19 | [
"https://Stackoverflow.com/questions/18307631",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2695264/"
] | Try like
```
$(document).ready(function() {
var myLink = $(".question a");
if (myLink.hasClass('checked')) { //You can also use $(this).hasClass
$('.answer').show(300);
}
else {
$('.answer').hide(300);
}
});
```
If you want to change the status of link then call the same while ... | add `$` before myLink
```
$(document).ready(function() {
var myLink = ".question a";
if ($(myLink).hasClass('checked')) {
$('.answer').show(300);
}
else {
$('.answer').hide(300);
}
});
``` |
39,727,744 | If I am not wrong, one can connect to a Cassandra cluster knowing at least one of the nodes that is in the cluster, and then the others can be discovered.
Lets say I have three nodes (1, 2 and 3) and I connect to those nodes like this:
`Cluster.builder().addContactPoints("1,2,3".split(",")).build();`
Then, if node ... | 2016/09/27 | [
"https://Stackoverflow.com/questions/39727744",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3645944/"
] | As Nick mentioned, it's based on DNS resolution, not Cassandra server health.
If you remove hosts from your environment more often than you recompile your application, then you should consider not baking your contact points into the code, and instead, feed them in through some other means (environment variable, REST s... | The documentation there is just in regards to "resolving" the contact points that are passed in. So converting hostnames to ip addresses. If you are specifying ip addresses to begin with, they will not be resolved, simply checked for validity. If you are using hostnames then each contact point will need to be resolvabl... |
39,727,744 | If I am not wrong, one can connect to a Cassandra cluster knowing at least one of the nodes that is in the cluster, and then the others can be discovered.
Lets say I have three nodes (1, 2 and 3) and I connect to those nodes like this:
`Cluster.builder().addContactPoints("1,2,3".split(",")).build();`
Then, if node ... | 2016/09/27 | [
"https://Stackoverflow.com/questions/39727744",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3645944/"
] | This validation is only to make sure that all the provided hosts can be resolved, it doesn't even check if a Cassandra server is running on each host. So it is basically to ensure that you did not do any typos while providing the hosts as indeed it doesn't assume that it could be a normal use case to have a provided ho... | The documentation there is just in regards to "resolving" the contact points that are passed in. So converting hostnames to ip addresses. If you are specifying ip addresses to begin with, they will not be resolved, simply checked for validity. If you are using hostnames then each contact point will need to be resolvabl... |
39,727,744 | If I am not wrong, one can connect to a Cassandra cluster knowing at least one of the nodes that is in the cluster, and then the others can be discovered.
Lets say I have three nodes (1, 2 and 3) and I connect to those nodes like this:
`Cluster.builder().addContactPoints("1,2,3".split(",")).build();`
Then, if node ... | 2016/09/27 | [
"https://Stackoverflow.com/questions/39727744",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3645944/"
] | This validation is only to make sure that all the provided hosts can be resolved, it doesn't even check if a Cassandra server is running on each host. So it is basically to ensure that you did not do any typos while providing the hosts as indeed it doesn't assume that it could be a normal use case to have a provided ho... | As Nick mentioned, it's based on DNS resolution, not Cassandra server health.
If you remove hosts from your environment more often than you recompile your application, then you should consider not baking your contact points into the code, and instead, feed them in through some other means (environment variable, REST s... |
609,933 | I have four 12 V large tubular deep-cycle lead-acid batteries and I want to know which one of these is a better set-up and why:
1. combine two batteries to make one 24 V battery; this way I will have two 24 V batteries
2. combine all four batteries to make one 48 V battery
The load for this set-up is a normal househo... | 2022/02/25 | [
"https://electronics.stackexchange.com/questions/609933",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/308212/"
] | >
> I think it's a question of power vs capacity and
>
>
>
No difference.
The power delivered by each battery is 1/4 of the power taken by the load, no matter how the batteries are connected.
>
> I want more capacity and long life for the batteries if possible.
>
>
>
No difference.
The energy contained in ... | It is always preferable to connect lead-acid batteries in series, rather than in parallel.
Lead-acid batteries balance better when they are all charged with equal current, rather than all charged with equal voltage.
When the charging is balanced, the battery lasts longer. When the charging is unbalanced, one battery ... |
3,865,173 | I am in charge of a website, and I have set up a "Quote of the Day" which currently is quite simplistic. [See Here](http://www.bris.ac.uk/Depts/Union/UBSCR/quotes.html) (on the right of the page)
What it currently does is it gets the Day of the month and the month, and normalises to one, then multiplies by the number ... | 2010/10/05 | [
"https://Stackoverflow.com/questions/3865173",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/174464/"
] | You could try rounding up on an even day and rounding down on an odd day. But I'm am sure there is better ways, this is just quick suggestion.
Also you could try using the current day of the year in the calculation as this is unique for each new day in the year as opposed to repeating each month. | ```html
<body onLoad="thoughts_authors()">
<script>
function thoughts_authors()
{
var authors=new Array()
authors[0] = "Charles Schulz";
authors[1] = "Jack Wagner";
authors[2] = "Mark Twain";
authors[3] = "Oscar Wilde";
authors[4] = "David Letterman";
authors[5] = "Lily Tomlin";
var thoughts=new Array()
t... |
3,865,173 | I am in charge of a website, and I have set up a "Quote of the Day" which currently is quite simplistic. [See Here](http://www.bris.ac.uk/Depts/Union/UBSCR/quotes.html) (on the right of the page)
What it currently does is it gets the Day of the month and the month, and normalises to one, then multiplies by the number ... | 2010/10/05 | [
"https://Stackoverflow.com/questions/3865173",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/174464/"
] | Fun question. Instead of relying on days of the month, why not count days since a given date? JS provides a pretty good property for that: `getTime()`, which gives you the number of milliseconds since 12am UTC on Jan. 1 1970, which you can convert to days with some simple division.
The only thing that complicates it ... | You could try rounding up on an even day and rounding down on an odd day. But I'm am sure there is better ways, this is just quick suggestion.
Also you could try using the current day of the year in the calculation as this is unique for each new day in the year as opposed to repeating each month. |
3,865,173 | I am in charge of a website, and I have set up a "Quote of the Day" which currently is quite simplistic. [See Here](http://www.bris.ac.uk/Depts/Union/UBSCR/quotes.html) (on the right of the page)
What it currently does is it gets the Day of the month and the month, and normalises to one, then multiplies by the number ... | 2010/10/05 | [
"https://Stackoverflow.com/questions/3865173",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/174464/"
] | If you want to show the quotes in order, you could get the current Julian Day number, which will increase by one each day, and take the reminder after dividing it by the number of quotes as the number of today's quote. If you want to show all quotes but the order of them to change each cycle, you can xor the quote numb... | You could try rounding up on an even day and rounding down on an odd day. But I'm am sure there is better ways, this is just quick suggestion.
Also you could try using the current day of the year in the calculation as this is unique for each new day in the year as opposed to repeating each month. |
3,865,173 | I am in charge of a website, and I have set up a "Quote of the Day" which currently is quite simplistic. [See Here](http://www.bris.ac.uk/Depts/Union/UBSCR/quotes.html) (on the right of the page)
What it currently does is it gets the Day of the month and the month, and normalises to one, then multiplies by the number ... | 2010/10/05 | [
"https://Stackoverflow.com/questions/3865173",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/174464/"
] | True, determinism is something "a random number generator could never do". Fortunately (for this case, at least), programming languages provide *pseudo*-random number generators, not the real thing. The pseudo-random numbers are generated by doing a bunch of calculations on a "seed" value.
To get a repeatable "random"... | ```html
<body onLoad="thoughts_authors()">
<script>
function thoughts_authors()
{
var authors=new Array()
authors[0] = "Charles Schulz";
authors[1] = "Jack Wagner";
authors[2] = "Mark Twain";
authors[3] = "Oscar Wilde";
authors[4] = "David Letterman";
authors[5] = "Lily Tomlin";
var thoughts=new Array()
t... |
3,865,173 | I am in charge of a website, and I have set up a "Quote of the Day" which currently is quite simplistic. [See Here](http://www.bris.ac.uk/Depts/Union/UBSCR/quotes.html) (on the right of the page)
What it currently does is it gets the Day of the month and the month, and normalises to one, then multiplies by the number ... | 2010/10/05 | [
"https://Stackoverflow.com/questions/3865173",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/174464/"
] | If you want to show the quotes in order, you could get the current Julian Day number, which will increase by one each day, and take the reminder after dividing it by the number of quotes as the number of today's quote. If you want to show all quotes but the order of them to change each cycle, you can xor the quote numb... | Do you have to limit yourself to having a cycle of 360 days? If you have for example 500 quotes. some might never be used.
How about- Every day pick a random number between 1 and #OfQoutes, use it as the quote of day index, and mark it as "used in current cycle".
Next time when you pick a number, if you pick a qu... |
3,865,173 | I am in charge of a website, and I have set up a "Quote of the Day" which currently is quite simplistic. [See Here](http://www.bris.ac.uk/Depts/Union/UBSCR/quotes.html) (on the right of the page)
What it currently does is it gets the Day of the month and the month, and normalises to one, then multiplies by the number ... | 2010/10/05 | [
"https://Stackoverflow.com/questions/3865173",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/174464/"
] | Fun question. Instead of relying on days of the month, why not count days since a given date? JS provides a pretty good property for that: `getTime()`, which gives you the number of milliseconds since 12am UTC on Jan. 1 1970, which you can convert to days with some simple division.
The only thing that complicates it ... | Do you have to limit yourself to having a cycle of 360 days? If you have for example 500 quotes. some might never be used.
How about- Every day pick a random number between 1 and #OfQoutes, use it as the quote of day index, and mark it as "used in current cycle".
Next time when you pick a number, if you pick a qu... |
3,865,173 | I am in charge of a website, and I have set up a "Quote of the Day" which currently is quite simplistic. [See Here](http://www.bris.ac.uk/Depts/Union/UBSCR/quotes.html) (on the right of the page)
What it currently does is it gets the Day of the month and the month, and normalises to one, then multiplies by the number ... | 2010/10/05 | [
"https://Stackoverflow.com/questions/3865173",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/174464/"
] | True, determinism is something "a random number generator could never do". Fortunately (for this case, at least), programming languages provide *pseudo*-random number generators, not the real thing. The pseudo-random numbers are generated by doing a bunch of calculations on a "seed" value.
To get a repeatable "random"... | Do you have to limit yourself to having a cycle of 360 days? If you have for example 500 quotes. some might never be used.
How about- Every day pick a random number between 1 and #OfQoutes, use it as the quote of day index, and mark it as "used in current cycle".
Next time when you pick a number, if you pick a qu... |
3,865,173 | I am in charge of a website, and I have set up a "Quote of the Day" which currently is quite simplistic. [See Here](http://www.bris.ac.uk/Depts/Union/UBSCR/quotes.html) (on the right of the page)
What it currently does is it gets the Day of the month and the month, and normalises to one, then multiplies by the number ... | 2010/10/05 | [
"https://Stackoverflow.com/questions/3865173",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/174464/"
] | If you want to show the quotes in order, you could get the current Julian Day number, which will increase by one each day, and take the reminder after dividing it by the number of quotes as the number of today's quote. If you want to show all quotes but the order of them to change each cycle, you can xor the quote numb... | ```html
<body onLoad="thoughts_authors()">
<script>
function thoughts_authors()
{
var authors=new Array()
authors[0] = "Charles Schulz";
authors[1] = "Jack Wagner";
authors[2] = "Mark Twain";
authors[3] = "Oscar Wilde";
authors[4] = "David Letterman";
authors[5] = "Lily Tomlin";
var thoughts=new Array()
t... |
3,865,173 | I am in charge of a website, and I have set up a "Quote of the Day" which currently is quite simplistic. [See Here](http://www.bris.ac.uk/Depts/Union/UBSCR/quotes.html) (on the right of the page)
What it currently does is it gets the Day of the month and the month, and normalises to one, then multiplies by the number ... | 2010/10/05 | [
"https://Stackoverflow.com/questions/3865173",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/174464/"
] | True, determinism is something "a random number generator could never do". Fortunately (for this case, at least), programming languages provide *pseudo*-random number generators, not the real thing. The pseudo-random numbers are generated by doing a bunch of calculations on a "seed" value.
To get a repeatable "random"... | You could try rounding up on an even day and rounding down on an odd day. But I'm am sure there is better ways, this is just quick suggestion.
Also you could try using the current day of the year in the calculation as this is unique for each new day in the year as opposed to repeating each month. |
3,865,173 | I am in charge of a website, and I have set up a "Quote of the Day" which currently is quite simplistic. [See Here](http://www.bris.ac.uk/Depts/Union/UBSCR/quotes.html) (on the right of the page)
What it currently does is it gets the Day of the month and the month, and normalises to one, then multiplies by the number ... | 2010/10/05 | [
"https://Stackoverflow.com/questions/3865173",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/174464/"
] | Fun question. Instead of relying on days of the month, why not count days since a given date? JS provides a pretty good property for that: `getTime()`, which gives you the number of milliseconds since 12am UTC on Jan. 1 1970, which you can convert to days with some simple division.
The only thing that complicates it ... | True, determinism is something "a random number generator could never do". Fortunately (for this case, at least), programming languages provide *pseudo*-random number generators, not the real thing. The pseudo-random numbers are generated by doing a bunch of calculations on a "seed" value.
To get a repeatable "random"... |
58,570,254 | Can't crop **cell.imageView?** to circle.
I was on many forums and nothing not found.
I use **tableView** with standard cell (non custom).
My code:
```
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifi... | 2019/10/26 | [
"https://Stackoverflow.com/questions/58570254",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8280087/"
] | you should set a frame for the Image view before :
```
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "channelCell", for: indexPath)
cell.accessoryType = .disclosureIndicator
cell.imageView?... | At the time when you fill your cell, your cell didn't layout it frames.
1) The one approach is to call layoutIfNeeded() and then set corner radius, equal to cell.imageView?.layer.cornerRadius = cell.imageView?.bounds.frame.height / 2
But it's not best from performance point of view, because you create redundant layo... |
58,570,254 | Can't crop **cell.imageView?** to circle.
I was on many forums and nothing not found.
I use **tableView** with standard cell (non custom).
My code:
```
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifi... | 2019/10/26 | [
"https://Stackoverflow.com/questions/58570254",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8280087/"
] | you should set a frame for the Image view before :
```
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "channelCell", for: indexPath)
cell.accessoryType = .disclosureIndicator
cell.imageView?... | Both the cell height are different, so you can set height by below code and get proper round image.
```
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 50 // set your cell height
}
``` |
45,497,953 | I have some trouble finding the cause of a View Controller not being released. It only appears at the top of the hierarchy as it is a sub page with the only purpose being to chat(a minor feature) with other users of the app.
I have already tried using instruments and the only information I can find is that the cause o... | 2017/08/04 | [
"https://Stackoverflow.com/questions/45497953",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7193589/"
] | When using a lot of external stuff like Socket Client or Realm Client there's a huge opportunity for having some strong references by these guys. I suppose if the question is what causes retain cycle you can try few approaches.
First. Try to remove one by one anything that shouldn't actually belong to the VC in the o... | you can use MLeaksFinder to help figure out what causes the recycle. |
39,955,782 | I am trying to set up environment to run my TC in different browsers. But currently TC are run normally just in Chrome browser, Firefox browser is opened but nothing happens (test scenarios are not run) when I am trying to run TC in FF, Opera, Safari browsers.
How to adjust my settings to be able to run TC successfully... | 2016/10/10 | [
"https://Stackoverflow.com/questions/39955782",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6387686/"
] | If you happen to pass here looking for a way to run every test through many browsers, I wrote this (working!) (overly talkative) snippet based on Thomas Walpole's accepted answer:
```
Rspec.configure do |conf|
Capybara.register_driver :chrome do |mode|
Capybara::Selenium::Driver.new mode, :browser => :remote,... | The options you're passing to the drivers you're registering are only valid for poltergeist. Rather than the big if/else you can just register all the drivers and then use the one you need.
```
RSpec.configure do |config|
config.include LoginHelper # You probably want to only include this for feature tests
config... |
73,631,325 | Hi I am trying to get the src data from the image on the website, I locate the image using the class since it is unique. With the code below it is able to locate the image but is unable to save the image to mongodb and shows up as null, so want to find the src and save the link instead.
ps. the code works for other cl... | 2022/09/07 | [
"https://Stackoverflow.com/questions/73631325",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15716259/"
] | To extract the value of `src` attribute simply call `.get('src')` on your element.
Try to change your strategy selecting elements and avoid using classes that are often dynamically - I recommend to use more static identifier as well as HTML structure.
```
for url in cate_list:
result = requests.get(url, cookies=... | ```py
import requests
from bs4 import BeautifulSoup, SoupStrainer
from urllib.parse import urljoin
from concurrent.futures import ThreadPoolExecutor, as_completed
cookies = {
"hideLocationOverlay": "true",
"selectedShippingState": "Kuala Lumpur",
"selectedPostalCode": "56000",
}
links = [
"8630656/rea... |
67,407,369 | How do I count the number of occurrences of repeated $ character in the given strings.
For ex:
1. String = '$$$$ABC$$$DE$$$' --> Answer is 4,3,3
2. String = '###$$%%ANE$$$$$' --> Answer is 2,5
I have no idea how to do it so did not do any attempts.
Thanks for your help.
For Reproducing:
1. DDL and Inserts:
```
C... | 2021/05/05 | [
"https://Stackoverflow.com/questions/67407369",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15760800/"
] | Please try the following solution. It will work starting from SQL Server 2017 onwards.
It is based on use of the `TRANSLATE()` function, and XML and XQuery.
**SQL**
```
-- DDL and sample data population, start
DECLARE @tbl TABLE (ID INT IDENTITY PRIMARY KEY, tokens VARCHAR(30));
INSERT INTO @tbl (tokens) VALUES
('$$... | **We can do this with a number of steps:**
* **We use a tally/numbers table to shred the string** into individual characters. The tally is calculated on the fly with a couple of cross-joins and `ROW_NUMBER`
* **We then calculate a grouping ID** for each group of characters, using a standard gaps-and-islands technique:... |
2,019,056 | I have been trying to get a simple double XOR neural network to work and I am having problems getting backpropagation to train a really simple feed forward neural network.
I have been mostly been trying to follow [this](http://galaxy.agh.edu.pl/~vlsi/AI/backp_t_en/backprop.html) guide in getting a neural network but... | 2010/01/07 | [
"https://Stackoverflow.com/questions/2019056",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/144600/"
] | Have a look at [15 Steps to implement a Neural Network](http://code-spot.co.za/2009/10/08/15-steps-to-implemented-a-neural-net/), it should get you started. | Sounds to me like you are struggling with backprop and what you describe above doesn't quite match how I understand it to work, and your description is a bit ambiguous.
You calculate the output error term to backpropagate as the diffrence between the prediction and the actual value multiplied by the derivative of the ... |
2,019,056 | I have been trying to get a simple double XOR neural network to work and I am having problems getting backpropagation to train a really simple feed forward neural network.
I have been mostly been trying to follow [this](http://galaxy.agh.edu.pl/~vlsi/AI/backp_t_en/backprop.html) guide in getting a neural network but... | 2010/01/07 | [
"https://Stackoverflow.com/questions/2019056",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/144600/"
] | Have a look at [15 Steps to implement a Neural Network](http://code-spot.co.za/2009/10/08/15-steps-to-implemented-a-neural-net/), it should get you started. | How about this open-source code. It defines a simple 1 hidden layer net (2 input, 2 hidden, 1 output) and solves XOR problem:
<https://web.archive.org/web/20131105002125/http://www.sylbarth.com/mlp.php> |
2,019,056 | I have been trying to get a simple double XOR neural network to work and I am having problems getting backpropagation to train a really simple feed forward neural network.
I have been mostly been trying to follow [this](http://galaxy.agh.edu.pl/~vlsi/AI/backp_t_en/backprop.html) guide in getting a neural network but... | 2010/01/07 | [
"https://Stackoverflow.com/questions/2019056",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/144600/"
] | Have a look at [15 Steps to implement a Neural Network](http://code-spot.co.za/2009/10/08/15-steps-to-implemented-a-neural-net/), it should get you started. | I wrote a simple a "Tutorial" that you can check out below.
It is a simple implementation of the perceptron model. You can imagine a perceptron as a neural network with only one neuron. There is of curse code that you can test out that I wrote in C++. I go through the code step by step so you shouldn't have any issues... |
2,019,056 | I have been trying to get a simple double XOR neural network to work and I am having problems getting backpropagation to train a really simple feed forward neural network.
I have been mostly been trying to follow [this](http://galaxy.agh.edu.pl/~vlsi/AI/backp_t_en/backprop.html) guide in getting a neural network but... | 2010/01/07 | [
"https://Stackoverflow.com/questions/2019056",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/144600/"
] | Have a look at [15 Steps to implement a Neural Network](http://code-spot.co.za/2009/10/08/15-steps-to-implemented-a-neural-net/), it should get you started. | What about a simple function approximation network like the one that predicts and fits a Sine Function. Also, I think, avoiding class during implementation is a must for getting the basics easily. Let's consider a single hidden layer network.
```
//Had a lot of trouble with shuffle
#include <iostream>
#include<vecto... |
2,019,056 | I have been trying to get a simple double XOR neural network to work and I am having problems getting backpropagation to train a really simple feed forward neural network.
I have been mostly been trying to follow [this](http://galaxy.agh.edu.pl/~vlsi/AI/backp_t_en/backprop.html) guide in getting a neural network but... | 2010/01/07 | [
"https://Stackoverflow.com/questions/2019056",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/144600/"
] | I wrote a simple a "Tutorial" that you can check out below.
It is a simple implementation of the perceptron model. You can imagine a perceptron as a neural network with only one neuron. There is of curse code that you can test out that I wrote in C++. I go through the code step by step so you shouldn't have any issues... | Sounds to me like you are struggling with backprop and what you describe above doesn't quite match how I understand it to work, and your description is a bit ambiguous.
You calculate the output error term to backpropagate as the diffrence between the prediction and the actual value multiplied by the derivative of the ... |
2,019,056 | I have been trying to get a simple double XOR neural network to work and I am having problems getting backpropagation to train a really simple feed forward neural network.
I have been mostly been trying to follow [this](http://galaxy.agh.edu.pl/~vlsi/AI/backp_t_en/backprop.html) guide in getting a neural network but... | 2010/01/07 | [
"https://Stackoverflow.com/questions/2019056",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/144600/"
] | Sounds to me like you are struggling with backprop and what you describe above doesn't quite match how I understand it to work, and your description is a bit ambiguous.
You calculate the output error term to backpropagate as the diffrence between the prediction and the actual value multiplied by the derivative of the ... | What about a simple function approximation network like the one that predicts and fits a Sine Function. Also, I think, avoiding class during implementation is a must for getting the basics easily. Let's consider a single hidden layer network.
```
//Had a lot of trouble with shuffle
#include <iostream>
#include<vecto... |
2,019,056 | I have been trying to get a simple double XOR neural network to work and I am having problems getting backpropagation to train a really simple feed forward neural network.
I have been mostly been trying to follow [this](http://galaxy.agh.edu.pl/~vlsi/AI/backp_t_en/backprop.html) guide in getting a neural network but... | 2010/01/07 | [
"https://Stackoverflow.com/questions/2019056",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/144600/"
] | I wrote a simple a "Tutorial" that you can check out below.
It is a simple implementation of the perceptron model. You can imagine a perceptron as a neural network with only one neuron. There is of curse code that you can test out that I wrote in C++. I go through the code step by step so you shouldn't have any issues... | How about this open-source code. It defines a simple 1 hidden layer net (2 input, 2 hidden, 1 output) and solves XOR problem:
<https://web.archive.org/web/20131105002125/http://www.sylbarth.com/mlp.php> |
2,019,056 | I have been trying to get a simple double XOR neural network to work and I am having problems getting backpropagation to train a really simple feed forward neural network.
I have been mostly been trying to follow [this](http://galaxy.agh.edu.pl/~vlsi/AI/backp_t_en/backprop.html) guide in getting a neural network but... | 2010/01/07 | [
"https://Stackoverflow.com/questions/2019056",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/144600/"
] | How about this open-source code. It defines a simple 1 hidden layer net (2 input, 2 hidden, 1 output) and solves XOR problem:
<https://web.archive.org/web/20131105002125/http://www.sylbarth.com/mlp.php> | What about a simple function approximation network like the one that predicts and fits a Sine Function. Also, I think, avoiding class during implementation is a must for getting the basics easily. Let's consider a single hidden layer network.
```
//Had a lot of trouble with shuffle
#include <iostream>
#include<vecto... |
2,019,056 | I have been trying to get a simple double XOR neural network to work and I am having problems getting backpropagation to train a really simple feed forward neural network.
I have been mostly been trying to follow [this](http://galaxy.agh.edu.pl/~vlsi/AI/backp_t_en/backprop.html) guide in getting a neural network but... | 2010/01/07 | [
"https://Stackoverflow.com/questions/2019056",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/144600/"
] | I wrote a simple a "Tutorial" that you can check out below.
It is a simple implementation of the perceptron model. You can imagine a perceptron as a neural network with only one neuron. There is of curse code that you can test out that I wrote in C++. I go through the code step by step so you shouldn't have any issues... | What about a simple function approximation network like the one that predicts and fits a Sine Function. Also, I think, avoiding class during implementation is a must for getting the basics easily. Let's consider a single hidden layer network.
```
//Had a lot of trouble with shuffle
#include <iostream>
#include<vecto... |
50,472,826 | I am testing a flutter application. I am to run an integration testing, just like Espresso and Selenium allow UI testing, based on my reading, I got to understand that testing Flutter UI will require setting up the integration model. In Selenium `findById` and Espresso, we can use , `R.id.unique_element_id`.
I have tr... | 2018/05/22 | [
"https://Stackoverflow.com/questions/50472826",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1252174/"
] | I have created a method to enter text.
Maybe this will be useful for someone.
```
Future<void> enterText(SerializableFinder itemFinder, String text) async {
final isTextFieldPresent = await isPresent(itemFinder);
if (isTextFieldPresent) {
await _driver.tap(itemFinder);
await _driver.enterText(te... | Not sure if you found an answer to your question, but I am posting a solution here. Hope it helps.
Basically, you need to define `key` property on the `TextFormField` widget, which will help you to identify that widget uniquely and then you can perform actions on it.
Example:
```
new TextFormField(
ke... |
50,472,826 | I am testing a flutter application. I am to run an integration testing, just like Espresso and Selenium allow UI testing, based on my reading, I got to understand that testing Flutter UI will require setting up the integration model. In Selenium `findById` and Espresso, we can use , `R.id.unique_element_id`.
I have tr... | 2018/05/22 | [
"https://Stackoverflow.com/questions/50472826",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1252174/"
] | flutter\_driver is dead now(Discontinued) you can use this [integration\_test](https://pub.dev/packages/integration_test)
I create login flow example
1. First add a dependency in pubspec.yaml under dev
```
dev_dependencies:
flutter_test:
sdk: flutter
test: ^1.9.4
integrati... | Not sure if you found an answer to your question, but I am posting a solution here. Hope it helps.
Basically, you need to define `key` property on the `TextFormField` widget, which will help you to identify that widget uniquely and then you can perform actions on it.
Example:
```
new TextFormField(
ke... |
50,472,826 | I am testing a flutter application. I am to run an integration testing, just like Espresso and Selenium allow UI testing, based on my reading, I got to understand that testing Flutter UI will require setting up the integration model. In Selenium `findById` and Espresso, we can use , `R.id.unique_element_id`.
I have tr... | 2018/05/22 | [
"https://Stackoverflow.com/questions/50472826",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1252174/"
] | flutter\_driver is dead now(Discontinued) you can use this [integration\_test](https://pub.dev/packages/integration_test)
I create login flow example
1. First add a dependency in pubspec.yaml under dev
```
dev_dependencies:
flutter_test:
sdk: flutter
test: ^1.9.4
integrati... | I have created a method to enter text.
Maybe this will be useful for someone.
```
Future<void> enterText(SerializableFinder itemFinder, String text) async {
final isTextFieldPresent = await isPresent(itemFinder);
if (isTextFieldPresent) {
await _driver.tap(itemFinder);
await _driver.enterText(te... |
56,118,274 | New to angular, so might sound a trivial question, however all solution provided on SO have failed to work so far.
I have a simple login component wherein on submit, I redirect the user to profile page. I am able to send the user to the said component but the nav bar on top does not auto refresh, i.e. I have kept a ses... | 2019/05/13 | [
"https://Stackoverflow.com/questions/56118274",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1300955/"
] | This is how I solved it:
**nav.component.html**
```
...
<li *ngIf="!auth.isLoggedIn()">
...
</li>
<li *ngIf="auth.isLoggedIn()">
...
</li>
...
```
**nav.component.ts**
```
export class NavComponent implements OnInit {
constructor(public auth: AuthService) {
}
...
```
**auth.service.ts**
```
export c... | The solution for this is basic, you should use the most common features of Angular. I will get you through the thought process and then show you some sample code.
**Thought process:**
**Problem:** We need to know whether the user is logged in or not at all times.
**Solution:** We will have a service that tells ... |
7,490,400 | So I have a gem in /vendor/bundle that needed to be fixed, and when I edit one of the files and then run bundle install it links up properly and all is good. But the problem is that when I deploy my project, the edits to my gem are lost because it runs bundle and saves the gems in a separate shared directory.
It seem... | 2011/09/20 | [
"https://Stackoverflow.com/questions/7490400",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/636892/"
] | I think the [experience](http://groups.google.com/group/project-lombok/browse_thread/thread/726c60980dd9dd5e) of [Project Lombok](http://projectlombok.org/) with annotation processing in the Play framework will be helpful to you. It is easy to setup APT processing, but very specific. Look at the [play-lombok module](ht... | I have no experience with Play, but I know that the following managed to use Querydsl SQL with the Play framework : <http://twitter.com/#!/rrmckinley>
He might be able to help you. I am not aware of any other integration of Querydsl with Play. |
7,490,400 | So I have a gem in /vendor/bundle that needed to be fixed, and when I edit one of the files and then run bundle install it links up properly and all is good. But the problem is that when I deploy my project, the edits to my gem are lost because it runs bundle and saves the gems in a separate shared directory.
It seem... | 2011/09/20 | [
"https://Stackoverflow.com/questions/7490400",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/636892/"
] | I have no experience with Play, but I know that the following managed to use Querydsl SQL with the Play framework : <http://twitter.com/#!/rrmckinley>
He might be able to help you. I am not aware of any other integration of Querydsl with Play. | You could check the existing modules that change the Database adaptor (like [this one](http://www.playframework.org/modules/morphia) for Mongo) and do something similar to link QueryDSL. Play hot-reloading should be available to it if it's a module. |
7,490,400 | So I have a gem in /vendor/bundle that needed to be fixed, and when I edit one of the files and then run bundle install it links up properly and all is good. But the problem is that when I deploy my project, the edits to my gem are lost because it runs bundle and saves the gems in a separate shared directory.
It seem... | 2011/09/20 | [
"https://Stackoverflow.com/questions/7490400",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/636892/"
] | I'm running play with querydsl using eclipse. (see <http://blog.mysema.com/2010/10/using-querydsl-in-eclipse.html>)
As generated source dir i used app/ which means that the Q classes will be generated in the same dir as the model classes which is not optimal but works.
Added these lines to the dependencies.yml
```
... | I have no experience with Play, but I know that the following managed to use Querydsl SQL with the Play framework : <http://twitter.com/#!/rrmckinley>
He might be able to help you. I am not aware of any other integration of Querydsl with Play. |
7,490,400 | So I have a gem in /vendor/bundle that needed to be fixed, and when I edit one of the files and then run bundle install it links up properly and all is good. But the problem is that when I deploy my project, the edits to my gem are lost because it runs bundle and saves the gems in a separate shared directory.
It seem... | 2011/09/20 | [
"https://Stackoverflow.com/questions/7490400",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/636892/"
] | I think the [experience](http://groups.google.com/group/project-lombok/browse_thread/thread/726c60980dd9dd5e) of [Project Lombok](http://projectlombok.org/) with annotation processing in the Play framework will be helpful to you. It is easy to setup APT processing, but very specific. Look at the [play-lombok module](ht... | You could check the existing modules that change the Database adaptor (like [this one](http://www.playframework.org/modules/morphia) for Mongo) and do something similar to link QueryDSL. Play hot-reloading should be available to it if it's a module. |
7,490,400 | So I have a gem in /vendor/bundle that needed to be fixed, and when I edit one of the files and then run bundle install it links up properly and all is good. But the problem is that when I deploy my project, the edits to my gem are lost because it runs bundle and saves the gems in a separate shared directory.
It seem... | 2011/09/20 | [
"https://Stackoverflow.com/questions/7490400",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/636892/"
] | I'm running play with querydsl using eclipse. (see <http://blog.mysema.com/2010/10/using-querydsl-in-eclipse.html>)
As generated source dir i used app/ which means that the Q classes will be generated in the same dir as the model classes which is not optimal but works.
Added these lines to the dependencies.yml
```
... | You could check the existing modules that change the Database adaptor (like [this one](http://www.playframework.org/modules/morphia) for Mongo) and do something similar to link QueryDSL. Play hot-reloading should be available to it if it's a module. |
11,866,643 | I have a class with constructor like this:
```
public class Bar
{
public Bar(IFoo foo, IFoo2 foo2, IFoo3 foo3, IFooN fooN, String text)
{
}
}
```
I want to register Bar in Unity and provide a value for text:
```
unity.RegisterType<Bar, Bar>(new InjectionConstructor("123"));
```
However I can't do thi... | 2012/08/08 | [
"https://Stackoverflow.com/questions/11866643",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/235715/"
] | Unity can't do this out of the box. The best you can do is:
```cs
container.RegisterType<Bar>(
new InjectionConstructor(
typeof(IFoo), typeof(IFoo2), typeof(IFoo3), typeof(IFooN), "123"));
```
Or you can use the `SmartConstructor` provided by the [TecX](http://tecx.codeplex.com) project. [This blog post]... | ```
public void Register<TFrom>(params object[] constructorParams) where TFrom : class
{
_container.RegisterType<TFrom>(new InjectionConstructor(constructorParams));
}
``` |
11,866,643 | I have a class with constructor like this:
```
public class Bar
{
public Bar(IFoo foo, IFoo2 foo2, IFoo3 foo3, IFooN fooN, String text)
{
}
}
```
I want to register Bar in Unity and provide a value for text:
```
unity.RegisterType<Bar, Bar>(new InjectionConstructor("123"));
```
However I can't do thi... | 2012/08/08 | [
"https://Stackoverflow.com/questions/11866643",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/235715/"
] | Unity can't do this out of the box. The best you can do is:
```cs
container.RegisterType<Bar>(
new InjectionConstructor(
typeof(IFoo), typeof(IFoo2), typeof(IFoo3), typeof(IFooN), "123"));
```
Or you can use the `SmartConstructor` provided by the [TecX](http://tecx.codeplex.com) project. [This blog post]... | I used to do that as described in the answer above (that's using `InjectionConstructor`). The problem with that is that if the signature of the constructor is changed but `InjectionConstructor` is not updated, then we will know that only at run time. I think that there is a cleaner way to do that and without getting de... |
288,458 | >
> That you hit him is bad action.
>
>
>
Can this sentence make sense? | 2021/06/08 | [
"https://ell.stackexchange.com/questions/288458",
"https://ell.stackexchange.com",
"https://ell.stackexchange.com/users/-1/"
] | You can easily count an action. One action, two actions, three actions.
So if there is only one action, you need to write *an* action, or for your example, *a* bad action.
Otherwise your grammar is alright. A clause such as [that you hit him] can be a subject or an object, without any problem.
Subject:
That you hit ... | "It is bad that you hit him" can be rearranged as "That you hit him is bad," but this is a little unusual. "Hitting him is bad" is more colloquial.
Your word-order appears in, for example, "That you hit him was bad enough: stealing his ice cream was unforgivable," though "Hitting him was bad enough..." would be more c... |
22,399,916 | I am trying to query some informations with laravel 4 blade syntax but I am always getting this error:
>
> Trying to get property of non-object
>
>
>
**Controller**
```
<?php
class ProfileController extends BaseController {
public function user($username) {
$users = User::where("username", "=", $use... | 2014/03/14 | [
"https://Stackoverflow.com/questions/22399916",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2987994/"
] | Seems like its not an object. Try
```
$user['id']; //In this case its an array
```
Other, try to output your $user so you can see whats in it. Is there even data in it? | Here, you get just the very first row that is (possibly) found
```
$users = $users->first();
```
Then, you pass it to view as `users` variable (wrong naming, why users, if taking just one?)
```
return View::make("profile.user")->with("users", $users);
```
Forget naming right now, here is the problem.
You take... |
22,399,916 | I am trying to query some informations with laravel 4 blade syntax but I am always getting this error:
>
> Trying to get property of non-object
>
>
>
**Controller**
```
<?php
class ProfileController extends BaseController {
public function user($username) {
$users = User::where("username", "=", $use... | 2014/03/14 | [
"https://Stackoverflow.com/questions/22399916",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2987994/"
] | I think you should do:
```
$users = User::where("username", "=", $username)->get();
```
Also you are using `first` so
```
$users = $users->first();
```
will store only the first user in users variable, so you can't foreach loop it - just remove the line with `first`. | Seems like its not an object. Try
```
$user['id']; //In this case its an array
```
Other, try to output your $user so you can see whats in it. Is there even data in it? |
22,399,916 | I am trying to query some informations with laravel 4 blade syntax but I am always getting this error:
>
> Trying to get property of non-object
>
>
>
**Controller**
```
<?php
class ProfileController extends BaseController {
public function user($username) {
$users = User::where("username", "=", $use... | 2014/03/14 | [
"https://Stackoverflow.com/questions/22399916",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2987994/"
] | I think you should do:
```
$users = User::where("username", "=", $username)->get();
```
Also you are using `first` so
```
$users = $users->first();
```
will store only the first user in users variable, so you can't foreach loop it - just remove the line with `first`. | Here, you get just the very first row that is (possibly) found
```
$users = $users->first();
```
Then, you pass it to view as `users` variable (wrong naming, why users, if taking just one?)
```
return View::make("profile.user")->with("users", $users);
```
Forget naming right now, here is the problem.
You take... |
33,652,430 | I am trying to connect my Spring Boot app with Facebook.
I am following the spring social integration with facebook <https://spring.io/guides/gs/accessing-facebook/>.
build.gradle includes this line:
`compile 'org.springframework.social:spring-social-facebook'`
application.properties:
spring.social.facebook.appId... | 2015/11/11 | [
"https://Stackoverflow.com/questions/33652430",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4347638/"
] | Same happened to me. I had to downgrade from 1.2.7 to 1.2.3 for spring boot maven plugin
```
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<!--<version>1.2.7.RELEASE</version>-->
<!-- downgraded because of bug in HelloControler
facebook.i... | The
{code}compile 'org.springframework.social:spring-social-facebook'{code}
Tells gradle this is a compile time dependency. You probably need this artefact on the classpath even at runtime.
<https://docs.gradle.org/current/userguide/build_lifecycle.html>
So it should probably be changed so you get it on cp runtime... |
74,492,224 | I'm writing a program that displays a fast food menu and it allows the user to select an item. Then, the user enters the quantity of that item, and can continue selecting items with specific quantities until done. What I'm having trouble with is finding out how to calculate a running total. I am new to c# so I only kno... | 2022/11/18 | [
"https://Stackoverflow.com/questions/74492224",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20540538/"
] | You do NOT want to use `sleep()` on the main thread, as it will appear to "lock up" your app.
Instead, use a repeating `Timer` -- try this, tap anywhere to start the `printWithDelay()`:
```
class ViewController: UIViewController {
struct CartProductResult {
var id: Int
var title: String
v... | ```
func printWithDelay(products: [CartProductResult], completion: (@escaping ()-> Void)) {
for product in products {
let seconds = 1.0
sleep(1)
print(" Wait 1 second")
print(product.id)
}
completion()
}
printWithDelay(products: cartProducts) {
print("Done printing prod... |
18,601,000 | I have a web application that exclusively uses AJAX so there are no full refreshes and everything is set up as
```
<a href="javascript:...()">
```
It works really well on Chrome and Firefox but IE asks to confirm the page reload every time I click on anything. Would it be better to change the links to
```
href="#"... | 2013/09/03 | [
"https://Stackoverflow.com/questions/18601000",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/988129/"
] | With "href='#'" you will probably need to preventDefaults on your JS function so the page doesn't go to top because of the '#' anchor.
I would do:
HTML
```
<a href="javascript:void(0)" class="someclass" rel='2'>
```
JS
```
$('.someclass').on('click', function(){
var value = $(this).attr('rel');
// use 'valu... | Use `<a href="#" onclick="myFunction()"></a>`.
Also, make sure that in your javascript function you stop the event from propagating like this:
```
function myFunction() {
//Your code here
event.preventDefault ? event.preventDefault() : event.returnValue = false;
return false;
}
```
This will stop the br... |
18,601,000 | I have a web application that exclusively uses AJAX so there are no full refreshes and everything is set up as
```
<a href="javascript:...()">
```
It works really well on Chrome and Firefox but IE asks to confirm the page reload every time I click on anything. Would it be better to change the links to
```
href="#"... | 2013/09/03 | [
"https://Stackoverflow.com/questions/18601000",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/988129/"
] | Just stop using inline javascript all together. You don't need it.
Output the id associated to the element in a data attribute:
```
<a href="#" data-id="34" class="list-item">listitem1</a>
```
Now you can bind to those click events from an external js file:
```
$(document).ready(function(){
$(".list-item").cli... | With "href='#'" you will probably need to preventDefaults on your JS function so the page doesn't go to top because of the '#' anchor.
I would do:
HTML
```
<a href="javascript:void(0)" class="someclass" rel='2'>
```
JS
```
$('.someclass').on('click', function(){
var value = $(this).attr('rel');
// use 'valu... |
18,601,000 | I have a web application that exclusively uses AJAX so there are no full refreshes and everything is set up as
```
<a href="javascript:...()">
```
It works really well on Chrome and Firefox but IE asks to confirm the page reload every time I click on anything. Would it be better to change the links to
```
href="#"... | 2013/09/03 | [
"https://Stackoverflow.com/questions/18601000",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/988129/"
] | Just stop using inline javascript all together. You don't need it.
Output the id associated to the element in a data attribute:
```
<a href="#" data-id="34" class="list-item">listitem1</a>
```
Now you can bind to those click events from an external js file:
```
$(document).ready(function(){
$(".list-item").cli... | Use `<a href="#" onclick="myFunction()"></a>`.
Also, make sure that in your javascript function you stop the event from propagating like this:
```
function myFunction() {
//Your code here
event.preventDefault ? event.preventDefault() : event.returnValue = false;
return false;
}
```
This will stop the br... |
243,241 | I've always been taught that an interface with no DC offset (the same amount of 1s and 0s when averaged over time) is desirable. To this end, often encodings like 8b10b will include a running disparity which compensates accordingly.
Looking at the wikipedia entry for 8b10b, it mentions that the discrepancy between 1s... | 2016/06/28 | [
"https://electronics.stackexchange.com/questions/243241",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/16047/"
] | First - synchronization, it is easy to spot the difference between zeros and ones if they both occur often.
Imagine you are in a tunnel, someone far away has a flashlight. You agree how long should a "one" and a "zero" last. If he keeps sending 0101010101 it will be very easy to count all zeros and ones. It should als... | Classically this sort of encoding was accomplished using manchester encoding, which has an over head of 100%, i.e. you need 2X symbols to ensure that you get 1X the data through. The 10b8b or variants are far more bandwidth efficient with only a 1.25 factor. There are even higher order schemes that are more efficient. ... |
52,881,825 | I would like to call an EXE-Tool (based on Perl) with a PowerShell script.
Basically the following command calls the tool in CMD. The tool processes some files and creates an outfile:
```
tool.exe [OPTIONS] > out.txt
```
Also the tool prints some "results" after creating this outfile.
Now, how can I put this comman... | 2018/10/18 | [
"https://Stackoverflow.com/questions/52881825",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10526007/"
] | Another possibility is to use a set of Cloud Functions for Firebase that are triggered with `onCreate()` and `onUpdate()`. In other words the creation and update dates are written in the backend.
See the following answer: [How to add timestamp to every collection insert,update in firebase functions for firestore datab... | You could perform a [transaction](https://firebase.google.com/docs/firestore/manage-data/transactions#transactions) on that document, and query and check it in the transaction handler. If the document already exists, you can also see what fields it contains, and only update that document as you see fit from your checks... |
49,781,041 | This is the only thing I could think of.
```css
#div {
height: 20px;
width: 20px;
background-color: black;
transition: 1s;
}
#div:hover {
background-color: red;
}
#div:hover {
transition-delay: 2s;
background-color: blue;
}
```
```html
<div id="div">
</div>
```
It'll instead ignore the ... | 2018/04/11 | [
"https://Stackoverflow.com/questions/49781041",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Are you looking for docker-compose's `external_links` keyword?
`external_links` allows you reuse already running containers.
According to [docker-compose specification](https://docs.docker.com/compose/compose-file/#external_links):
>
> This keyword links to containers started outside this docker-compose.yml or even... | You probably don't want to keep using a container that you don't know how to create. However, the good news is that you should be able to figure out how you can create your container again by inspecting it with the command
```
$ docker container inspect ID
```
This will display all settings, the docker-compose speci... |
49,781,041 | This is the only thing I could think of.
```css
#div {
height: 20px;
width: 20px;
background-color: black;
transition: 1s;
}
#div:hover {
background-color: red;
}
#div:hover {
transition-delay: 2s;
background-color: blue;
}
```
```html
<div id="div">
</div>
```
It'll instead ignore the ... | 2018/04/11 | [
"https://Stackoverflow.com/questions/49781041",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | You can give name for your container. If there is no container with the given name, then it is the first time to run the image. If the named container is found, restart the container.
In this way, you can reuse the container. Here is my sample script.
```
containerName="IamContainer"
if docker ps -a --format '{{.Name... | You probably don't want to keep using a container that you don't know how to create. However, the good news is that you should be able to figure out how you can create your container again by inspecting it with the command
```
$ docker container inspect ID
```
This will display all settings, the docker-compose speci... |
45,638,830 | I have been working on `Project Euler #23`.
This is the task:
>
> Problem 23
>
>
> A perfect number is a number for which the sum of its proper divisors is exactly equal to the number. For example, the sum of the proper divisors of 28 would be 1 + 2 + 4 + 7 + 14 = 28, which means that 28 is a perfect number.
>
> ... | 2017/08/11 | [
"https://Stackoverflow.com/questions/45638830",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8176981/"
] | Your `getDivisors` function is incorrect. It doesn't count the root divisors of square numbers (for example, if `num=25`, it will return 1). Here is a corrected version:
```
def getDivisors(num):
if num==1:
return 1
n = math.ceil(math.sqrt(num))
total = 1
divisor = 2
while (divisor < n):
... | I have done a couple of changes to the code mentioned above and i had the correct answer within 13 seconds. My CPU is intel core i5. Here is my code:
```
from array import array
import math
def find_abundant(number):
sum_factor = 1
value = math.ceil(math.sqrt(number))
if number == 1:
return False
... |
45,638,830 | I have been working on `Project Euler #23`.
This is the task:
>
> Problem 23
>
>
> A perfect number is a number for which the sum of its proper divisors is exactly equal to the number. For example, the sum of the proper divisors of 28 would be 1 + 2 + 4 + 7 + 14 = 28, which means that 28 is a perfect number.
>
> ... | 2017/08/11 | [
"https://Stackoverflow.com/questions/45638830",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8176981/"
] | Your `getDivisors` function is incorrect. It doesn't count the root divisors of square numbers (for example, if `num=25`, it will return 1). Here is a corrected version:
```
def getDivisors(num):
if num==1:
return 1
n = math.ceil(math.sqrt(num))
total = 1
divisor = 2
while (divisor < n):
... | This code works 6 seconds on my computer:
```
from math import sqrt
import itertools
import functools
import operator
#simplicity test
def fuc(a):
d = 1
z = 0
while d<= sqrt(a):
d = d + 1
if a == 2:
z = a
elif (a%d) == 0:
z = False
break
... |
45,638,830 | I have been working on `Project Euler #23`.
This is the task:
>
> Problem 23
>
>
> A perfect number is a number for which the sum of its proper divisors is exactly equal to the number. For example, the sum of the proper divisors of 28 would be 1 + 2 + 4 + 7 + 14 = 28, which means that 28 is a perfect number.
>
> ... | 2017/08/11 | [
"https://Stackoverflow.com/questions/45638830",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8176981/"
] | Your `getDivisors` function is incorrect. It doesn't count the root divisors of square numbers (for example, if `num=25`, it will return 1). Here is a corrected version:
```
def getDivisors(num):
if num==1:
return 1
n = math.ceil(math.sqrt(num))
total = 1
divisor = 2
while (divisor < n):
... | I found these small tweaks might help reducing the overall time taken. I got the in about 4 seconds on my computer.
```
from math import sqrt
from itertools import compress
start = time.process_time()
abundant_nos = []
for i in range(12,28123):
factor = 0
for j in range(2,int(sqrt(i))+1):
if i%j == 0:... |
45,638,830 | I have been working on `Project Euler #23`.
This is the task:
>
> Problem 23
>
>
> A perfect number is a number for which the sum of its proper divisors is exactly equal to the number. For example, the sum of the proper divisors of 28 would be 1 + 2 + 4 + 7 + 14 = 28, which means that 28 is a perfect number.
>
> ... | 2017/08/11 | [
"https://Stackoverflow.com/questions/45638830",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8176981/"
] | Your `getDivisors` function is incorrect. It doesn't count the root divisors of square numbers (for example, if `num=25`, it will return 1). Here is a corrected version:
```
def getDivisors(num):
if num==1:
return 1
n = math.ceil(math.sqrt(num))
total = 1
divisor = 2
while (divisor < n):
... | A possible solution with numpy that avoids the nested loop, and generally times less than 3 seconds on my laptop, is the following.
**Description**
Take your list of abundant Numbers and transform to numpy array *A*. Make an additional array containing the numbers from 1 to the limit posed in the problem *B*. Use an ... |
45,638,830 | I have been working on `Project Euler #23`.
This is the task:
>
> Problem 23
>
>
> A perfect number is a number for which the sum of its proper divisors is exactly equal to the number. For example, the sum of the proper divisors of 28 would be 1 + 2 + 4 + 7 + 14 = 28, which means that 28 is a perfect number.
>
> ... | 2017/08/11 | [
"https://Stackoverflow.com/questions/45638830",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8176981/"
] | I have done a couple of changes to the code mentioned above and i had the correct answer within 13 seconds. My CPU is intel core i5. Here is my code:
```
from array import array
import math
def find_abundant(number):
sum_factor = 1
value = math.ceil(math.sqrt(number))
if number == 1:
return False
... | I found these small tweaks might help reducing the overall time taken. I got the in about 4 seconds on my computer.
```
from math import sqrt
from itertools import compress
start = time.process_time()
abundant_nos = []
for i in range(12,28123):
factor = 0
for j in range(2,int(sqrt(i))+1):
if i%j == 0:... |
45,638,830 | I have been working on `Project Euler #23`.
This is the task:
>
> Problem 23
>
>
> A perfect number is a number for which the sum of its proper divisors is exactly equal to the number. For example, the sum of the proper divisors of 28 would be 1 + 2 + 4 + 7 + 14 = 28, which means that 28 is a perfect number.
>
> ... | 2017/08/11 | [
"https://Stackoverflow.com/questions/45638830",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8176981/"
] | I have done a couple of changes to the code mentioned above and i had the correct answer within 13 seconds. My CPU is intel core i5. Here is my code:
```
from array import array
import math
def find_abundant(number):
sum_factor = 1
value = math.ceil(math.sqrt(number))
if number == 1:
return False
... | A possible solution with numpy that avoids the nested loop, and generally times less than 3 seconds on my laptop, is the following.
**Description**
Take your list of abundant Numbers and transform to numpy array *A*. Make an additional array containing the numbers from 1 to the limit posed in the problem *B*. Use an ... |
45,638,830 | I have been working on `Project Euler #23`.
This is the task:
>
> Problem 23
>
>
> A perfect number is a number for which the sum of its proper divisors is exactly equal to the number. For example, the sum of the proper divisors of 28 would be 1 + 2 + 4 + 7 + 14 = 28, which means that 28 is a perfect number.
>
> ... | 2017/08/11 | [
"https://Stackoverflow.com/questions/45638830",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8176981/"
] | This code works 6 seconds on my computer:
```
from math import sqrt
import itertools
import functools
import operator
#simplicity test
def fuc(a):
d = 1
z = 0
while d<= sqrt(a):
d = d + 1
if a == 2:
z = a
elif (a%d) == 0:
z = False
break
... | I found these small tweaks might help reducing the overall time taken. I got the in about 4 seconds on my computer.
```
from math import sqrt
from itertools import compress
start = time.process_time()
abundant_nos = []
for i in range(12,28123):
factor = 0
for j in range(2,int(sqrt(i))+1):
if i%j == 0:... |
45,638,830 | I have been working on `Project Euler #23`.
This is the task:
>
> Problem 23
>
>
> A perfect number is a number for which the sum of its proper divisors is exactly equal to the number. For example, the sum of the proper divisors of 28 would be 1 + 2 + 4 + 7 + 14 = 28, which means that 28 is a perfect number.
>
> ... | 2017/08/11 | [
"https://Stackoverflow.com/questions/45638830",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8176981/"
] | This code works 6 seconds on my computer:
```
from math import sqrt
import itertools
import functools
import operator
#simplicity test
def fuc(a):
d = 1
z = 0
while d<= sqrt(a):
d = d + 1
if a == 2:
z = a
elif (a%d) == 0:
z = False
break
... | A possible solution with numpy that avoids the nested loop, and generally times less than 3 seconds on my laptop, is the following.
**Description**
Take your list of abundant Numbers and transform to numpy array *A*. Make an additional array containing the numbers from 1 to the limit posed in the problem *B*. Use an ... |
70,146,712 | I have created a `Match` table and want to run this query:
```
select player_id, max(goals)
from soccer.player_match_stat
group by player_id
```
The aim is to find the `player_id` who has the max number of goals in this table. So, I am grouping the tables data by `player_id` and then getting the `max()` of goals, bu... | 2021/11/28 | [
"https://Stackoverflow.com/questions/70146712",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14166274/"
] | May be you need aggregate not by `max` but by `sum`:
```
select player_id, sum(goals)
from soccer.player_match_stat
group by player_id
order by 2 desc
limit 1
```
If you aggregate by `max` you just get maximal value of goals for player per game.
If you aggregate by `sum` you get total number of goals for player acro... | Try following:
```
CREATE TABLE Match_tbl(
player_id int,
goals int );
INSERT INTO Match_tbl values
(1,2),
(2,5),
(1,4);
```
In MySQL or PostgreSQL :
```
SELECT player_id
, total_goals
FROM (
SELECT player_id
... |
637 | The inspiration for my question comes from The Great C by Philip K Dick. To summarize, the Great C is a computer that has taken over a large portion of the planet. It uses proxy agents to keep control by relentlessly patrolling the area and killing anything that gets in its way.
My question is an extension of this ide... | 2014/09/30 | [
"https://worldbuilding.stackexchange.com/questions/637",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/119/"
] | There is a lot we don't know about this computer, but let us consider that it was created by a civilisation of some kind and placed on the planet with both the intelligence for agency and some facility for acting on its environment, which if it is to survive for any length of time, would probably be necessary—I will as... | From the perspective of a computer scientist:
Computers have the advanced ability to calculate through every possibility and alternative in a very precise manner, but they lack abilities like faith or conviction. In many aspects a computer acts like a chess player: moves are calculated far in advance, however random b... |
637 | The inspiration for my question comes from The Great C by Philip K Dick. To summarize, the Great C is a computer that has taken over a large portion of the planet. It uses proxy agents to keep control by relentlessly patrolling the area and killing anything that gets in its way.
My question is an extension of this ide... | 2014/09/30 | [
"https://worldbuilding.stackexchange.com/questions/637",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/119/"
] | Yes, it would be possible, though I would say it would require to have been set up to do so by people.
>
> Would it even be possible to gain enough energy to power itself and
> continue expanding?
>
>
>
Certainly. All it needs is some sort of sustainable and or reproducible power plant and input to the plant. Co... | Yes, I believe it could be possible.
I like this idea for several reasons, it appeals to my inner geek. Here are a few thoughts of different ways this could occur.
**Stealth**
We already have a worldwide IT infrastructure, you're using it right now. If a program was created/evolved which mirrored a lot of properties... |
637 | The inspiration for my question comes from The Great C by Philip K Dick. To summarize, the Great C is a computer that has taken over a large portion of the planet. It uses proxy agents to keep control by relentlessly patrolling the area and killing anything that gets in its way.
My question is an extension of this ide... | 2014/09/30 | [
"https://worldbuilding.stackexchange.com/questions/637",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/119/"
] | Yes, it would be possible, though I would say it would require to have been set up to do so by people.
>
> Would it even be possible to gain enough energy to power itself and
> continue expanding?
>
>
>
Certainly. All it needs is some sort of sustainable and or reproducible power plant and input to the plant. Co... | From the perspective of a computer scientist:
Computers have the advanced ability to calculate through every possibility and alternative in a very precise manner, but they lack abilities like faith or conviction. In many aspects a computer acts like a chess player: moves are calculated far in advance, however random b... |
637 | The inspiration for my question comes from The Great C by Philip K Dick. To summarize, the Great C is a computer that has taken over a large portion of the planet. It uses proxy agents to keep control by relentlessly patrolling the area and killing anything that gets in its way.
My question is an extension of this ide... | 2014/09/30 | [
"https://worldbuilding.stackexchange.com/questions/637",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/119/"
] | Yes, it would be possible, though I would say it would require to have been set up to do so by people.
>
> Would it even be possible to gain enough energy to power itself and
> continue expanding?
>
>
>
Certainly. All it needs is some sort of sustainable and or reproducible power plant and input to the plant. Co... | (
assuming
1. a moderate technology level of the civilization which left behind the AI. Apart from being able to make AIs, it wouldn't be much more advanced than us, so not more than 20 or so years in the future. Less technology is impossible because AI and too much more opens so many possibility it becomes boring.
... |
637 | The inspiration for my question comes from The Great C by Philip K Dick. To summarize, the Great C is a computer that has taken over a large portion of the planet. It uses proxy agents to keep control by relentlessly patrolling the area and killing anything that gets in its way.
My question is an extension of this ide... | 2014/09/30 | [
"https://worldbuilding.stackexchange.com/questions/637",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/119/"
] | There is a lot we don't know about this computer, but let us consider that it was created by a civilisation of some kind and placed on the planet with both the intelligence for agency and some facility for acting on its environment, which if it is to survive for any length of time, would probably be necessary—I will as... | Yes, I believe it could be possible.
I like this idea for several reasons, it appeals to my inner geek. Here are a few thoughts of different ways this could occur.
**Stealth**
We already have a worldwide IT infrastructure, you're using it right now. If a program was created/evolved which mirrored a lot of properties... |
637 | The inspiration for my question comes from The Great C by Philip K Dick. To summarize, the Great C is a computer that has taken over a large portion of the planet. It uses proxy agents to keep control by relentlessly patrolling the area and killing anything that gets in its way.
My question is an extension of this ide... | 2014/09/30 | [
"https://worldbuilding.stackexchange.com/questions/637",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/119/"
] | **tl;dr**: Yes, **in vacuo**, probably, but what that would look like and if it even is possible considering all the other factors in play, requires a lot more information about details of its history and circumstances.
A few basic decisions have to be made before this kind of question can be well-defined enough to pr... | Yes, I believe it could be possible.
I like this idea for several reasons, it appeals to my inner geek. Here are a few thoughts of different ways this could occur.
**Stealth**
We already have a worldwide IT infrastructure, you're using it right now. If a program was created/evolved which mirrored a lot of properties... |
637 | The inspiration for my question comes from The Great C by Philip K Dick. To summarize, the Great C is a computer that has taken over a large portion of the planet. It uses proxy agents to keep control by relentlessly patrolling the area and killing anything that gets in its way.
My question is an extension of this ide... | 2014/09/30 | [
"https://worldbuilding.stackexchange.com/questions/637",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/119/"
] | **tl;dr**: Yes, **in vacuo**, probably, but what that would look like and if it even is possible considering all the other factors in play, requires a lot more information about details of its history and circumstances.
A few basic decisions have to be made before this kind of question can be well-defined enough to pr... | From the perspective of a computer scientist:
Computers have the advanced ability to calculate through every possibility and alternative in a very precise manner, but they lack abilities like faith or conviction. In many aspects a computer acts like a chess player: moves are calculated far in advance, however random b... |
637 | The inspiration for my question comes from The Great C by Philip K Dick. To summarize, the Great C is a computer that has taken over a large portion of the planet. It uses proxy agents to keep control by relentlessly patrolling the area and killing anything that gets in its way.
My question is an extension of this ide... | 2014/09/30 | [
"https://worldbuilding.stackexchange.com/questions/637",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/119/"
] | There is a lot we don't know about this computer, but let us consider that it was created by a civilisation of some kind and placed on the planet with both the intelligence for agency and some facility for acting on its environment, which if it is to survive for any length of time, would probably be necessary—I will as... | (
assuming
1. a moderate technology level of the civilization which left behind the AI. Apart from being able to make AIs, it wouldn't be much more advanced than us, so not more than 20 or so years in the future. Less technology is impossible because AI and too much more opens so many possibility it becomes boring.
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.