qid
int64
1
74.7M
question
stringlengths
0
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
2
48.3k
response_k
stringlengths
2
40.5k
3,455,711
I am storing a string (url) in a variable it can look like one/two/three/test.aspx?ID=12312 I want to extract the querystring value, not from window.location but from the html I thought I could use substring and write ``` var link = ($(this).find('a').attr('href')); var qs = link.substring( link.indexOf("="), text....
2010/08/11
[ "https://Stackoverflow.com/questions/3455711", "https://Stackoverflow.com", "https://Stackoverflow.com/users/416735/" ]
Just omit the second parameter. In this case, should return the end of the string starting at the provided index.
Try this instead ``` var link = ($(this).find('a').attr('href')); var qs = link.substring( link.indexOf("=")); ```
3,455,711
I am storing a string (url) in a variable it can look like one/two/three/test.aspx?ID=12312 I want to extract the querystring value, not from window.location but from the html I thought I could use substring and write ``` var link = ($(this).find('a').attr('href')); var qs = link.substring( link.indexOf("="), text....
2010/08/11
[ "https://Stackoverflow.com/questions/3455711", "https://Stackoverflow.com", "https://Stackoverflow.com/users/416735/" ]
Just omit the second parameter. In this case, should return the end of the string starting at the provided index.
Another way could be: > > var qs = link.split("=").pop(); > > >
3,455,711
I am storing a string (url) in a variable it can look like one/two/three/test.aspx?ID=12312 I want to extract the querystring value, not from window.location but from the html I thought I could use substring and write ``` var link = ($(this).find('a').attr('href')); var qs = link.substring( link.indexOf("="), text....
2010/08/11
[ "https://Stackoverflow.com/questions/3455711", "https://Stackoverflow.com", "https://Stackoverflow.com/users/416735/" ]
A while ago, I'd written a short function for this: ``` /** * Gets the query parameters of the given URI as a associative array or map * e.g. Given a URI http://www.level3labs.com/jaf?foo=bar&baz=bazzm, will * give {"foo":"bar", "baz":"bazzm"} * @param {URI} strUri The uri with a query * @return Objec...
Try this instead ``` var link = ($(this).find('a').attr('href')); var qs = link.substring( link.indexOf("=")); ```
3,455,711
I am storing a string (url) in a variable it can look like one/two/three/test.aspx?ID=12312 I want to extract the querystring value, not from window.location but from the html I thought I could use substring and write ``` var link = ($(this).find('a').attr('href')); var qs = link.substring( link.indexOf("="), text....
2010/08/11
[ "https://Stackoverflow.com/questions/3455711", "https://Stackoverflow.com", "https://Stackoverflow.com/users/416735/" ]
A while ago, I'd written a short function for this: ``` /** * Gets the query parameters of the given URI as a associative array or map * e.g. Given a URI http://www.level3labs.com/jaf?foo=bar&baz=bazzm, will * give {"foo":"bar", "baz":"bazzm"} * @param {URI} strUri The uri with a query * @return Objec...
Another way could be: > > var qs = link.split("=").pop(); > > >
8,038,414
I am trying to bind a mousemove event to the body. My attempts so far: ``` $('html, body').mousemove(function(event){...}); $('html, body')[0].onmousemove= function(event){...}; $('body').bind('mousemove', function(event){...}); document.onmousemove = function(event){...}; document.getElementsByTagName('body')[0]....
2011/11/07
[ "https://Stackoverflow.com/questions/8038414", "https://Stackoverflow.com", "https://Stackoverflow.com/users/299711/" ]
You don't want it in the body because body is not necessarily the full page. ``` $( document ).mousemove( function () { }); ``` jsfiddle: <http://jsfiddle.net/uDfPj/> Alternatively without jQuery: ``` document.documentElement.onmousemove = function(){}; ```
I doubt whether the onMouseMove event is associated with the body tag. Can you try it on the window tag? I haven't tried that though.
8,038,414
I am trying to bind a mousemove event to the body. My attempts so far: ``` $('html, body').mousemove(function(event){...}); $('html, body')[0].onmousemove= function(event){...}; $('body').bind('mousemove', function(event){...}); document.onmousemove = function(event){...}; document.getElementsByTagName('body')[0]....
2011/11/07
[ "https://Stackoverflow.com/questions/8038414", "https://Stackoverflow.com", "https://Stackoverflow.com/users/299711/" ]
You don't want it in the body because body is not necessarily the full page. ``` $( document ).mousemove( function () { }); ``` jsfiddle: <http://jsfiddle.net/uDfPj/> Alternatively without jQuery: ``` document.documentElement.onmousemove = function(){}; ```
try it with the document instead. here's a great sample page that shows it working <http://www.quirksmode.org/dom/events/tests/mousemove.html> and a compatibility table: <http://www.quirksmode.org/dom/events/mousemove.html>
67,868,556
is there a way to import css style sheet on the fly in Vaadin14 ? I use `@CssImport("./views/main/main-view.css")` at the top of my class, and ``` Button lumoBtn = new Button("Lumo", click -> { UI ui = this.getUI().get(); ThemeList themeList = ui.getCurrent().getElement().getThemeList(); // ...
2021/06/07
[ "https://Stackoverflow.com/questions/67868556", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12256299/" ]
You can't switch between themes at runtime, it's a missing feature: <https://github.com/vaadin/flow/issues/5163>
The solution I found to go around it: Create variants of theme, and change from one to another on the fly. * *java file* ``` UI ui = this.getUI().get(); ThemeList themeList = ui.getCurrent().getElement().getThemeList(); // remove curent theme for (String theme : themeList){ themeList.remove(theme); } switch (event...
42,411,723
I have following statement using `using`: ``` using (var reader = data.CreateCommand(sql).ExecuteDataReader()) ``` in this case `data` is some object which internally holds `SqlConnection`. `CreateCommand(sql)` function returns `SqlCommand` and `ExecuteDataReader` returns `SqlDataReader`. Since `SqlCommand` and `Sql...
2017/02/23
[ "https://Stackoverflow.com/questions/42411723", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3419044/" ]
*"if it's possible to combine them"* - two `using` are totally fine, because both needs to be disposed. You can combine them by extracting into method: ``` void RunWithReader(string sql, Action<SQLDataReader> action) { using (var cmd = data.CreateCommand(sql)) using (var reader = cmd.ExecuteDataReader()) ...
Agree with Matthew Watson's comment. You need to have both of `usings` statemets. Here is the related question with additional reasoning. [SqlConnection SqlCommand SqlDataReader IDisposable](https://stackoverflow.com/questions/16985876/sqlconnection-sqlcommand-sqldatareader-idisposable)
42,411,723
I have following statement using `using`: ``` using (var reader = data.CreateCommand(sql).ExecuteDataReader()) ``` in this case `data` is some object which internally holds `SqlConnection`. `CreateCommand(sql)` function returns `SqlCommand` and `ExecuteDataReader` returns `SqlDataReader`. Since `SqlCommand` and `Sql...
2017/02/23
[ "https://Stackoverflow.com/questions/42411723", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3419044/" ]
Agree with Matthew Watson's comment. You need to have both of `usings` statemets. Here is the related question with additional reasoning. [SqlConnection SqlCommand SqlDataReader IDisposable](https://stackoverflow.com/questions/16985876/sqlconnection-sqlcommand-sqldatareader-idisposable)
In General ---------- > > **You should** `Dispose` **every class that implements** `IDisposable`. > > > However, your question is specifically dealing with a scenario **where all the resources are all related**, which if my understanding is correct, the Garbage Collector will dispose these resources for you autom...
42,411,723
I have following statement using `using`: ``` using (var reader = data.CreateCommand(sql).ExecuteDataReader()) ``` in this case `data` is some object which internally holds `SqlConnection`. `CreateCommand(sql)` function returns `SqlCommand` and `ExecuteDataReader` returns `SqlDataReader`. Since `SqlCommand` and `Sql...
2017/02/23
[ "https://Stackoverflow.com/questions/42411723", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3419044/" ]
*"if it's possible to combine them"* - two `using` are totally fine, because both needs to be disposed. You can combine them by extracting into method: ``` void RunWithReader(string sql, Action<SQLDataReader> action) { using (var cmd = data.CreateCommand(sql)) using (var reader = cmd.ExecuteDataReader()) ...
The way you have presented your code the inner `IDisposable` (`IDbCommand`) is not disposed. You have two choices: You can put it all in one `using` like this: ``` using (IDisposable cmd = data.CreateCommand(), reader = ((IDbCommand)cmd).ExecuteReader()) { // code here } ``` But that is rather cumbersome. The ...
42,411,723
I have following statement using `using`: ``` using (var reader = data.CreateCommand(sql).ExecuteDataReader()) ``` in this case `data` is some object which internally holds `SqlConnection`. `CreateCommand(sql)` function returns `SqlCommand` and `ExecuteDataReader` returns `SqlDataReader`. Since `SqlCommand` and `Sql...
2017/02/23
[ "https://Stackoverflow.com/questions/42411723", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3419044/" ]
*"if it's possible to combine them"* - two `using` are totally fine, because both needs to be disposed. You can combine them by extracting into method: ``` void RunWithReader(string sql, Action<SQLDataReader> action) { using (var cmd = data.CreateCommand(sql)) using (var reader = cmd.ExecuteDataReader()) ...
In General ---------- > > **You should** `Dispose` **every class that implements** `IDisposable`. > > > However, your question is specifically dealing with a scenario **where all the resources are all related**, which if my understanding is correct, the Garbage Collector will dispose these resources for you autom...
42,411,723
I have following statement using `using`: ``` using (var reader = data.CreateCommand(sql).ExecuteDataReader()) ``` in this case `data` is some object which internally holds `SqlConnection`. `CreateCommand(sql)` function returns `SqlCommand` and `ExecuteDataReader` returns `SqlDataReader`. Since `SqlCommand` and `Sql...
2017/02/23
[ "https://Stackoverflow.com/questions/42411723", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3419044/" ]
The way you have presented your code the inner `IDisposable` (`IDbCommand`) is not disposed. You have two choices: You can put it all in one `using` like this: ``` using (IDisposable cmd = data.CreateCommand(), reader = ((IDbCommand)cmd).ExecuteReader()) { // code here } ``` But that is rather cumbersome. The ...
In General ---------- > > **You should** `Dispose` **every class that implements** `IDisposable`. > > > However, your question is specifically dealing with a scenario **where all the resources are all related**, which if my understanding is correct, the Garbage Collector will dispose these resources for you autom...
72,790,118
```js var num = prompt("Enter a number"); for (var sum = 0; sum <= num; sum++) { sum = sum + 1; } document.write(sum); ``` example when I enter 6 in the prompt it will sum 1+2+3+4+5+6 =21. but as of right now i can only print 123456 instead of 21.
2022/06/28
[ "https://Stackoverflow.com/questions/72790118", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13193144/" ]
The problem with your code is that you're using `sum` for the loop and for the answer. That's messing everything up. You can use a variable for the loop and another variable for the sum. Maybe that works for you. ```js var num = prompt("Enter a number"); var sum = 0; for(var i = 1; i <= num; i++) { sum += i; } do...
here is some change in your code. **note**: (+) is used to convert string-number type to number type ```js var num = prompt("Enter a number"); const sum = Array.from(Array(+num + 1).keys()).reduce((prev, curr) => prev += curr, 0); document.write(sum); ```
72,790,118
```js var num = prompt("Enter a number"); for (var sum = 0; sum <= num; sum++) { sum = sum + 1; } document.write(sum); ``` example when I enter 6 in the prompt it will sum 1+2+3+4+5+6 =21. but as of right now i can only print 123456 instead of 21.
2022/06/28
[ "https://Stackoverflow.com/questions/72790118", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13193144/" ]
* Input received by you is a string and that's why it's contacting rather than adding to sum. * This is the best optimum solution as its time complexity is O(3) times only. * so, it's fast. rather than with brute force which is o(n); ```js var num = prompt("Enter a number"); function total(n) { return n * (n + 1) /...
here is some change in your code. **note**: (+) is used to convert string-number type to number type ```js var num = prompt("Enter a number"); const sum = Array.from(Array(+num + 1).keys()).reduce((prev, curr) => prev += curr, 0); document.write(sum); ```
31,827,215
I am new to assembly language. To be clear, this is homework. The problem is given a char \*list, how can I find which character is the end of the string? So I have ``` xor ecx, ecx; //counter loop1: mov esi, list; mov eax, [esi + ecx]; cmp eax, 0x00; //check if the character is null je end; inc ecx; jmp loop1; end: ...
2015/08/05
[ "https://Stackoverflow.com/questions/31827215", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5091361/" ]
* You should not reset the counter as part of the loop. * You should not initialize the address as part of the loop. * The zero-termination is just a single byte but you test a complete dword. * The fewer jumps the better code you've written Putting all of this together we get ``` mov esi, list mov ecx, -1 loop1:...
You are reading several bytes at a time, and testing if they are all zero. Try to read just one byte instead: ``` mov al, [esi + ecx]; cmp al, 0x00; //check if the character is null ```
43,434,902
I am trying to implement a simple spring boot application and deploy it directly on its internal server.Here's my application class ``` import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.web.support.SpringBootServletInitializer; import org.springframework.context.annotati...
2017/04/16
[ "https://Stackoverflow.com/questions/43434902", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7816606/" ]
You are seeing this warning: `** WARNING ** : Your ApplicationContext is unlikely to start due to a @ComponentScan of the default package.` This is probably because your Application class is located in the default package, and generally the application fails to start in this case. So you should create some package...
Andy has found the root cause and give solution [here](https://stackoverflow.com/a/35080798/2293534) Root Cause Analysis: -------------------- Your code is in the default package, i.e. you have `.java` files in `src/main/java` with no package statement at the top. There's a warning message in the log indicating that ...
54,232,857
I'm trying to center two div elements in the form of buttons. But nothing I try seems to work. The furthest I got is getting it in the middle with `position: absolute;` but when I do that the two elements get on top of each other. The code I'm currently using: ```css /* For the button: */ .btn1 { color: #000 !im...
2019/01/17
[ "https://Stackoverflow.com/questions/54232857", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10926954/" ]
Will this help you? **Added/Edited:** display: block; margin-bottom: 15px; **Removed:** position: absolute; top:10%; bottom: 10%; left: 0; right: 0; margin: auto; ```css .btn1 { color: #000 !important; text-transform: uppercase; background: #ed1b36; padding: 20px; border-radius: 5px; display: block...
If you need to horizontally center `a` inside of a `div` your `div` should have a `text-align: center`. Check this fiddle <https://jsfiddle.net/03t46hmn> Please note: Using a same class for `div` and `a` may cause confusion. Try to avoid such approach.
54,232,857
I'm trying to center two div elements in the form of buttons. But nothing I try seems to work. The furthest I got is getting it in the middle with `position: absolute;` but when I do that the two elements get on top of each other. The code I'm currently using: ```css /* For the button: */ .btn1 { color: #000 !im...
2019/01/17
[ "https://Stackoverflow.com/questions/54232857", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10926954/" ]
Hope this helps. i have use `margin-right:auto` and `margin-left:auto` for btn1 to align it horizontally center and `.btns{ margin-top:50%; transform:translateY(-50%) }` to align it center vertically ```css .btn1 { color: #000 !important; text-transform: uppercase; background: #ed1b36; padding: 20px;...
If you need to horizontally center `a` inside of a `div` your `div` should have a `text-align: center`. Check this fiddle <https://jsfiddle.net/03t46hmn> Please note: Using a same class for `div` and `a` may cause confusion. Try to avoid such approach.
54,232,857
I'm trying to center two div elements in the form of buttons. But nothing I try seems to work. The furthest I got is getting it in the middle with `position: absolute;` but when I do that the two elements get on top of each other. The code I'm currently using: ```css /* For the button: */ .btn1 { color: #000 !im...
2019/01/17
[ "https://Stackoverflow.com/questions/54232857", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10926954/" ]
Will this help you? **Added/Edited:** display: block; margin-bottom: 15px; **Removed:** position: absolute; top:10%; bottom: 10%; left: 0; right: 0; margin: auto; ```css .btn1 { color: #000 !important; text-transform: uppercase; background: #ed1b36; padding: 20px; border-radius: 5px; display: block...
Maybe you should style each tag div. Set different left for each tag div. Such as ``` <div class="btn1"> <a class="btn1" href="showTable.php"><b>Reserveringen</b></a> </div> <br> <div class="btn1 btn-logout"> <a class="btn1" href="logout.php"><b>Logout</b></a> </div> ``` Style: ``` .btn-logout{ left: 40%; }...
54,232,857
I'm trying to center two div elements in the form of buttons. But nothing I try seems to work. The furthest I got is getting it in the middle with `position: absolute;` but when I do that the two elements get on top of each other. The code I'm currently using: ```css /* For the button: */ .btn1 { color: #000 !im...
2019/01/17
[ "https://Stackoverflow.com/questions/54232857", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10926954/" ]
Will this help you? **Added/Edited:** display: block; margin-bottom: 15px; **Removed:** position: absolute; top:10%; bottom: 10%; left: 0; right: 0; margin: auto; ```css .btn1 { color: #000 !important; text-transform: uppercase; background: #ed1b36; padding: 20px; border-radius: 5px; display: block...
Try this HTML ``` <div class="con"> <div class="btn1"> <a class="btn1" href="showTable.php"><b>Reserveringen</b></a> </div> <div class="btn1"> <a class="btn1" href="logout.php"><b>Logout</b></a> </div> </div> ``` CSS ``` .con{ min-height: 300px; display: flex; justify-content: space-between; ...
54,232,857
I'm trying to center two div elements in the form of buttons. But nothing I try seems to work. The furthest I got is getting it in the middle with `position: absolute;` but when I do that the two elements get on top of each other. The code I'm currently using: ```css /* For the button: */ .btn1 { color: #000 !im...
2019/01/17
[ "https://Stackoverflow.com/questions/54232857", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10926954/" ]
Hope this helps. i have use `margin-right:auto` and `margin-left:auto` for btn1 to align it horizontally center and `.btns{ margin-top:50%; transform:translateY(-50%) }` to align it center vertically ```css .btn1 { color: #000 !important; text-transform: uppercase; background: #ed1b36; padding: 20px;...
Maybe you should style each tag div. Set different left for each tag div. Such as ``` <div class="btn1"> <a class="btn1" href="showTable.php"><b>Reserveringen</b></a> </div> <br> <div class="btn1 btn-logout"> <a class="btn1" href="logout.php"><b>Logout</b></a> </div> ``` Style: ``` .btn-logout{ left: 40%; }...
54,232,857
I'm trying to center two div elements in the form of buttons. But nothing I try seems to work. The furthest I got is getting it in the middle with `position: absolute;` but when I do that the two elements get on top of each other. The code I'm currently using: ```css /* For the button: */ .btn1 { color: #000 !im...
2019/01/17
[ "https://Stackoverflow.com/questions/54232857", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10926954/" ]
Hope this helps. i have use `margin-right:auto` and `margin-left:auto` for btn1 to align it horizontally center and `.btns{ margin-top:50%; transform:translateY(-50%) }` to align it center vertically ```css .btn1 { color: #000 !important; text-transform: uppercase; background: #ed1b36; padding: 20px;...
Try this HTML ``` <div class="con"> <div class="btn1"> <a class="btn1" href="showTable.php"><b>Reserveringen</b></a> </div> <div class="btn1"> <a class="btn1" href="logout.php"><b>Logout</b></a> </div> </div> ``` CSS ``` .con{ min-height: 300px; display: flex; justify-content: space-between; ...
453,846
When I monitor my computer's memory usage in Resource Manager, I see that I constantly get between 60 and 100 hard faults. Is this normal? Or is that hard fault graph ideally supposed to be flat at 0? I run Windows 7 and I have 4GB RAM.
2012/07/26
[ "https://superuser.com/questions/453846", "https://superuser.com", "https://superuser.com/users/17016/" ]
I suppose that it can be normal considering the amount of RAM you have. The more RAM you have, the fewer hard faults you should see.
On my 2009 laptop with 3GB of RAM there are usually 0-20 hard faults per/sec while playing a game, processing a video, etc. It could be that certain kinds of RAM like ECC or certain brand qualities.
453,846
When I monitor my computer's memory usage in Resource Manager, I see that I constantly get between 60 and 100 hard faults. Is this normal? Or is that hard fault graph ideally supposed to be flat at 0? I run Windows 7 and I have 4GB RAM.
2012/07/26
[ "https://superuser.com/questions/453846", "https://superuser.com", "https://superuser.com/users/17016/" ]
I suppose that it can be normal considering the amount of RAM you have. The more RAM you have, the fewer hard faults you should see.
Memory Hard Faults have nothing to do with the 'brand' or 'quality' of the memory. It means that the software has requested an address and the page where it resides isn't still in main memory. Usually it has been swapped to virtual memory, (hard drive or SSD) and the OS will swap it back from virtual memory to physical...
453,846
When I monitor my computer's memory usage in Resource Manager, I see that I constantly get between 60 and 100 hard faults. Is this normal? Or is that hard fault graph ideally supposed to be flat at 0? I run Windows 7 and I have 4GB RAM.
2012/07/26
[ "https://superuser.com/questions/453846", "https://superuser.com", "https://superuser.com/users/17016/" ]
I suppose that it can be normal considering the amount of RAM you have. The more RAM you have, the fewer hard faults you should see.
I am running a Dell with 6GB memory and was running at 100 hard faults/sec at idle. I ran Andvanced SystemCare free version, ran a scan and my faults went down to zero. I think I had spyware running in the background. Hope this helps!
453,846
When I monitor my computer's memory usage in Resource Manager, I see that I constantly get between 60 and 100 hard faults. Is this normal? Or is that hard fault graph ideally supposed to be flat at 0? I run Windows 7 and I have 4GB RAM.
2012/07/26
[ "https://superuser.com/questions/453846", "https://superuser.com", "https://superuser.com/users/17016/" ]
Memory Hard Faults have nothing to do with the 'brand' or 'quality' of the memory. It means that the software has requested an address and the page where it resides isn't still in main memory. Usually it has been swapped to virtual memory, (hard drive or SSD) and the OS will swap it back from virtual memory to physical...
On my 2009 laptop with 3GB of RAM there are usually 0-20 hard faults per/sec while playing a game, processing a video, etc. It could be that certain kinds of RAM like ECC or certain brand qualities.
453,846
When I monitor my computer's memory usage in Resource Manager, I see that I constantly get between 60 and 100 hard faults. Is this normal? Or is that hard fault graph ideally supposed to be flat at 0? I run Windows 7 and I have 4GB RAM.
2012/07/26
[ "https://superuser.com/questions/453846", "https://superuser.com", "https://superuser.com/users/17016/" ]
On my 2009 laptop with 3GB of RAM there are usually 0-20 hard faults per/sec while playing a game, processing a video, etc. It could be that certain kinds of RAM like ECC or certain brand qualities.
I am running a Dell with 6GB memory and was running at 100 hard faults/sec at idle. I ran Andvanced SystemCare free version, ran a scan and my faults went down to zero. I think I had spyware running in the background. Hope this helps!
453,846
When I monitor my computer's memory usage in Resource Manager, I see that I constantly get between 60 and 100 hard faults. Is this normal? Or is that hard fault graph ideally supposed to be flat at 0? I run Windows 7 and I have 4GB RAM.
2012/07/26
[ "https://superuser.com/questions/453846", "https://superuser.com", "https://superuser.com/users/17016/" ]
Memory Hard Faults have nothing to do with the 'brand' or 'quality' of the memory. It means that the software has requested an address and the page where it resides isn't still in main memory. Usually it has been swapped to virtual memory, (hard drive or SSD) and the OS will swap it back from virtual memory to physical...
I am running a Dell with 6GB memory and was running at 100 hard faults/sec at idle. I ran Andvanced SystemCare free version, ran a scan and my faults went down to zero. I think I had spyware running in the background. Hope this helps!
1,067,346
I have an application a part of which uses shared libraries. These libraries are linked at compile time. At Runtime the loader expects the shared object to be in the `LD_LIBRARY_PATH` , if not found the entire application crashes with error "unable to load shared libraries".Note that there is no guarantee that client ...
2009/07/01
[ "https://Stackoverflow.com/questions/1067346", "https://Stackoverflow.com", "https://Stackoverflow.com/users/91593/" ]
You can wrap your application with another one which first checks for all the required libraries, and if something is missing it errors out nicely, but if everything is allright it execs the real application.
Your problem is that the resolution of unresolved symbols is done very early on - on Linux I believe the data symbols are resolved at process startup, and the function symbols are done lazily. Therefore depending on what symbols you have unresolved, and on what sort of static initialization you have going on - you may ...
1,067,346
I have an application a part of which uses shared libraries. These libraries are linked at compile time. At Runtime the loader expects the shared object to be in the `LD_LIBRARY_PATH` , if not found the entire application crashes with error "unable to load shared libraries".Note that there is no guarantee that client ...
2009/07/01
[ "https://Stackoverflow.com/questions/1067346", "https://Stackoverflow.com", "https://Stackoverflow.com/users/91593/" ]
The common solution to your problem is to declare a table of function pointers, to do a single dlsym() to find it, and then call all the other functions through a pointer to that table. Example (untested): ``` // libfoo.h struct APIs { void (*api1)(void); void *(*api2)(int); long (*api3)(int, void *); }; /...
You can wrap your application with another one which first checks for all the required libraries, and if something is missing it errors out nicely, but if everything is allright it execs the real application.
1,067,346
I have an application a part of which uses shared libraries. These libraries are linked at compile time. At Runtime the loader expects the shared object to be in the `LD_LIBRARY_PATH` , if not found the entire application crashes with error "unable to load shared libraries".Note that there is no guarantee that client ...
2009/07/01
[ "https://Stackoverflow.com/questions/1067346", "https://Stackoverflow.com", "https://Stackoverflow.com/users/91593/" ]
You can wrap your application with another one which first checks for all the required libraries, and if something is missing it errors out nicely, but if everything is allright it execs the real application.
You are probably looking for some form of delay library load on Linux. It's not available out-of-the-box but you can easily mimic it by creating a small static stub library that would try to `dlopen` needed library on first call to any of it's functions (emitting diagnostic message and terminating if `dlopen` failed) a...
1,067,346
I have an application a part of which uses shared libraries. These libraries are linked at compile time. At Runtime the loader expects the shared object to be in the `LD_LIBRARY_PATH` , if not found the entire application crashes with error "unable to load shared libraries".Note that there is no guarantee that client ...
2009/07/01
[ "https://Stackoverflow.com/questions/1067346", "https://Stackoverflow.com", "https://Stackoverflow.com/users/91593/" ]
The common solution to your problem is to declare a table of function pointers, to do a single dlsym() to find it, and then call all the other functions through a pointer to that table. Example (untested): ``` // libfoo.h struct APIs { void (*api1)(void); void *(*api2)(int); long (*api3)(int, void *); }; /...
Your problem is that the resolution of unresolved symbols is done very early on - on Linux I believe the data symbols are resolved at process startup, and the function symbols are done lazily. Therefore depending on what symbols you have unresolved, and on what sort of static initialization you have going on - you may ...
1,067,346
I have an application a part of which uses shared libraries. These libraries are linked at compile time. At Runtime the loader expects the shared object to be in the `LD_LIBRARY_PATH` , if not found the entire application crashes with error "unable to load shared libraries".Note that there is no guarantee that client ...
2009/07/01
[ "https://Stackoverflow.com/questions/1067346", "https://Stackoverflow.com", "https://Stackoverflow.com/users/91593/" ]
Use below type of code ``` Class DynLib { /* All your functions */ void fun1() {}; void fun2() {}; . . . } DynLib* getDynLibPointer() { DynLib* x = new Dynlib; return x; } ``` use `dlopen()` for loading this library at runtime. and use `dlsym()` and call `getDynLibPointer()` which r...
Your problem is that the resolution of unresolved symbols is done very early on - on Linux I believe the data symbols are resolved at process startup, and the function symbols are done lazily. Therefore depending on what symbols you have unresolved, and on what sort of static initialization you have going on - you may ...
1,067,346
I have an application a part of which uses shared libraries. These libraries are linked at compile time. At Runtime the loader expects the shared object to be in the `LD_LIBRARY_PATH` , if not found the entire application crashes with error "unable to load shared libraries".Note that there is no guarantee that client ...
2009/07/01
[ "https://Stackoverflow.com/questions/1067346", "https://Stackoverflow.com", "https://Stackoverflow.com/users/91593/" ]
You are probably looking for some form of delay library load on Linux. It's not available out-of-the-box but you can easily mimic it by creating a small static stub library that would try to `dlopen` needed library on first call to any of it's functions (emitting diagnostic message and terminating if `dlopen` failed) a...
Your problem is that the resolution of unresolved symbols is done very early on - on Linux I believe the data symbols are resolved at process startup, and the function symbols are done lazily. Therefore depending on what symbols you have unresolved, and on what sort of static initialization you have going on - you may ...
1,067,346
I have an application a part of which uses shared libraries. These libraries are linked at compile time. At Runtime the loader expects the shared object to be in the `LD_LIBRARY_PATH` , if not found the entire application crashes with error "unable to load shared libraries".Note that there is no guarantee that client ...
2009/07/01
[ "https://Stackoverflow.com/questions/1067346", "https://Stackoverflow.com", "https://Stackoverflow.com/users/91593/" ]
The common solution to your problem is to declare a table of function pointers, to do a single dlsym() to find it, and then call all the other functions through a pointer to that table. Example (untested): ``` // libfoo.h struct APIs { void (*api1)(void); void *(*api2)(int); long (*api3)(int, void *); }; /...
Use below type of code ``` Class DynLib { /* All your functions */ void fun1() {}; void fun2() {}; . . . } DynLib* getDynLibPointer() { DynLib* x = new Dynlib; return x; } ``` use `dlopen()` for loading this library at runtime. and use `dlsym()` and call `getDynLibPointer()` which r...
1,067,346
I have an application a part of which uses shared libraries. These libraries are linked at compile time. At Runtime the loader expects the shared object to be in the `LD_LIBRARY_PATH` , if not found the entire application crashes with error "unable to load shared libraries".Note that there is no guarantee that client ...
2009/07/01
[ "https://Stackoverflow.com/questions/1067346", "https://Stackoverflow.com", "https://Stackoverflow.com/users/91593/" ]
The common solution to your problem is to declare a table of function pointers, to do a single dlsym() to find it, and then call all the other functions through a pointer to that table. Example (untested): ``` // libfoo.h struct APIs { void (*api1)(void); void *(*api2)(int); long (*api3)(int, void *); }; /...
You are probably looking for some form of delay library load on Linux. It's not available out-of-the-box but you can easily mimic it by creating a small static stub library that would try to `dlopen` needed library on first call to any of it's functions (emitting diagnostic message and terminating if `dlopen` failed) a...
1,067,346
I have an application a part of which uses shared libraries. These libraries are linked at compile time. At Runtime the loader expects the shared object to be in the `LD_LIBRARY_PATH` , if not found the entire application crashes with error "unable to load shared libraries".Note that there is no guarantee that client ...
2009/07/01
[ "https://Stackoverflow.com/questions/1067346", "https://Stackoverflow.com", "https://Stackoverflow.com/users/91593/" ]
Use below type of code ``` Class DynLib { /* All your functions */ void fun1() {}; void fun2() {}; . . . } DynLib* getDynLibPointer() { DynLib* x = new Dynlib; return x; } ``` use `dlopen()` for loading this library at runtime. and use `dlsym()` and call `getDynLibPointer()` which r...
You are probably looking for some form of delay library load on Linux. It's not available out-of-the-box but you can easily mimic it by creating a small static stub library that would try to `dlopen` needed library on first call to any of it's functions (emitting diagnostic message and terminating if `dlopen` failed) a...
62,574,365
I am trying to get the request header in a mojolicious template. I need to get a custom header. In Flask I would use ``` {{request.headers['customheader] }} ``` How do I achieve the same in Mojolicious? There is a `Mojo::Message::Request` package. So are what I have isn't working. ``` % use Mojo::Message::Request;...
2020/06/25
[ "https://Stackoverflow.com/questions/62574365", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11951910/" ]
If you just want to show a second x-axis (without plotting anything on it) it may be easier with a [scondary axis](https://matplotlib.org/3.1.1/gallery/subplots_axes_and_figures/secondary_axis.html#sphx-glr-gallery-subplots-axes-and-figures-secondary-axis-py). You'll have to change the [`functions`](https://matplotlib....
Ok my workaround now was simply plotting the data with the second axis without color. ``` import matplotlib.pyplot as plt import numpy as np fig,axs = plt.subplots() xticklabels = [str(x) for x in range(0, 40+1, 5)] y = np.random.rand(41*8) axs.set_xticks(np.arange(0,41*8,5*8)) axs.set_xticklabels(xticklabels) ax0...
40,728,670
Is there a way to show some visual indication that the inline button has been pressed in telegram bot. I have a bit which send inline keyboard, and when I press each buttons it works perfectly fine, but there is a slight delay in getting response from the server. As there is no visual indication to show if a button ha...
2016/11/21
[ "https://Stackoverflow.com/questions/40728670", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3702922/" ]
there are **different types of [inline buttons](https://core.telegram.org/bots/api#inlinekeyboardbutton)** in Telegram: * Opens **URL** (with `url`). * **Forward** a message (with `switch_inline_query`). * Insert query at the chat (with `switch_inline_query_current_chat`). * **Button with action** (with `callback_data...
As an alternative way, after you got the callback response at your server, you can use Emoji for showing feedback to your users. Just edit the inline message and edit some relative emoji to the button text.
1,993
It seems that *I slept during the holiday* can be translated into two ways: > > Mi dormis *en* la festotago. > > > Mi dormis *dum* la festotago. > > > Do they both mean the same?
2016/11/05
[ "https://esperanto.stackexchange.com/questions/1993", "https://esperanto.stackexchange.com", "https://esperanto.stackexchange.com/users/6/" ]
Your two sentences mean different things. *Dum* implies duration. *En* suggests that something happened within the period. * Mi dormis en la festotago. At some point you slept. * Mi dormis dum la festotago. You spent your festival day sleeping.
PMEG has a paragraph about this. <http://bertilow.com/pmeg/gramatiko/rolmontriloj/rolvortetoj/lokaj_rolvortetoj/en.html#i-sb8> *Dum* shows a duration (over which the action took place). *En* can show one of two things * a **point** in time * the time needed to complete an action, basically the **point** in time when ...
51,265,281
I have profiled my unit test and the majority of the time the application is running is spent on this section of code. It is a function that converts a float to a string. How can I rewrite the code below to have a better speed performance? Am I misreading the report and the bottleneck is somewhere else? The profile ...
2018/07/10
[ "https://Stackoverflow.com/questions/51265281", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2509099/" ]
If using an external library to achieve this goal is possible, you can go with [fmtlib](http://fmtlib.net/latest/index.html) (this library will probably make it into the standard), which claims to be faster than other approaches (see their [benchmarks](https://github.com/fmtlib/fmt#benchmarks)). ``` #include <fmt/form...
Instead of converting the incomming data from float to a char representation, you should try to generate your comparison data to the incoming binary format, maybe only once with a tool which creates a compilable binary table. This enables you to compare binary/float against binary/float data without any need to do fur...
156,286
What is the problem with [my question](https://stackoverflow.com/questions/13481241/)? I got 2 downvotes already but no explanation as to why. If my question belongs elsewhere, or if the answer is "no", why won't people just tell me?
2012/11/20
[ "https://meta.stackexchange.com/questions/156286", "https://meta.stackexchange.com", "https://meta.stackexchange.com/users/190276/" ]
It is a bad question for Stack Overflow - it is asking for resources. Resource questions are considered not constructive. In general, questions that ask people for opinions (and people will recommend different resources depending on their opinion of them) are not good questions for Stack Overflow. Answers are expect...
A question asking for which library/framework to use has exactly the same problems as shopping questions. Shopping questions are considered "Not constructive" as is [described in this blog post](https://blog.stackoverflow.com/2010/11/qa-is-hard-lets-go-shopping/).
22,442,213
i have a simple app, but it seems it's not very simple. What i want to do is: when i press on Button 1 plays Song1, if i press on Button 2 -- then Song1 stops and Song 2 plays i can make this if i have only 2 buttons and 2 songs, but how can i make it when i have more? here is my code ``` private MediaPlayer mp1; ...
2014/03/16
[ "https://Stackoverflow.com/questions/22442213", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2705075/" ]
When you press `Button1` ``` mp2.stop();mp3.stop();mp4.stop(); ``` is called but these MediaPlayers have not been created yet. That's why you net a `null pointer exception`. Instantiate all MediaPlayers outside of the `OnClickListener`s. Also I would suggest not to use 4 MediaPlayers, cause you waste resources. Cr...
To avoid the NullPointerException you could test in your conditions if the mp instance is not null like this `if ((mp1 != null) && mp1.isPlaying())`, and if you want to manage several buttons with several media players, you could use a Map.
22,442,213
i have a simple app, but it seems it's not very simple. What i want to do is: when i press on Button 1 plays Song1, if i press on Button 2 -- then Song1 stops and Song 2 plays i can make this if i have only 2 buttons and 2 songs, but how can i make it when i have more? here is my code ``` private MediaPlayer mp1; ...
2014/03/16
[ "https://Stackoverflow.com/questions/22442213", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2705075/" ]
ok, i solved the nullpointexception and after this i got a illegalstateexception, now i made player to work. i knew which is the problem, and i know that the code is based on logic, but at that time my logic wasn't efficient, i got to sleep, and in the morning i allready had the answer in my head :) 1. created private...
To avoid the NullPointerException you could test in your conditions if the mp instance is not null like this `if ((mp1 != null) && mp1.isPlaying())`, and if you want to manage several buttons with several media players, you could use a Map.
15,116,627
I'm trying to make a list of images, 2 per row. The uneven rows (1, 3, 5, etc.) should have a small image first, and a wide one second. The even rows (2, 4, 6, 8, etc.) should have the wide image first and the smaller one second. I'm now at row 3, and I cannot get the small image to the left for whatever reason. As ...
2013/02/27
[ "https://Stackoverflow.com/questions/15116627", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2116085/" ]
mysql's PHP driver does NOT allow multiple queries in a single ->query() call, exactly for this reason. It's an anti-injection defense, to prevent the classic [Bobby Tables](http://bobby-tables.com) attack. This true for all PHP db interfaces (mysql, mysqli, pdo), as they all use the same underlying mysql C api library...
In order for your stacked query injection technique to work, you will need to use the "mysqli\_multi\_query()" function: <http://php.net/manual/en/mysqli.multi-query.php> <http://www.websec.ca/kb/sql_injection#MySQL_Stacked_Queries> MsSQL is the only database that supports stacked queries by default. Also possibly a...
28,143,292
I have a data frame with some ambiguous observation names in it and want to add some classification to them. One of the problems I had was that some of the observation names match multiple classes that I would want to assign, so I decided to go for adding a column for each class and fill it with True/False depending on...
2015/01/26
[ "https://Stackoverflow.com/questions/28143292", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4493197/" ]
Be careful with how you use the brackets `[` and `[[` to index lists. Use `[` to return a new *list* with the selected index, `[[` to return *the object actually contained* at the selected index. For example, using your code: ``` > Classes[1] # returns a list [[1]] [1] "ab" "ba" > Classes[[1]] # returns a vector [1]...
the problem is that the values in `Classes` is a list, and using the single bracket operator (`[`) returns a list object, and not the object contained in a list. It just so happens that the `%in%` operator does what you expect when the item contained in the list has one element (`Class1` for example), but not when the ...
273,779
I'm trying to create a workflow that's seems like it should be simple, but I can't seem to tick all my boxes. Essentially it's because a step can be skipped sometimes. Item is entered - workflow starts Step 1: Status changes to "choice A" Workflow sends an email to "person A" Step 2: Status Change to "choice B" Work...
2019/12/19
[ "https://sharepoint.stackexchange.com/questions/273779", "https://sharepoint.stackexchange.com", "https://sharepoint.stackexchange.com/users/88149/" ]
You could create a workflow on on each library that contains information being updated on "subject" such that whenever a new document on "subject" is created or updated, that file is then updated in your centralized information site.
I, not sure if there has been any upgrade in 365 that solves this issue in a better way, but I´ve found something that helps somehow: We work on plans and different levels of groups with different access to files. The problem we had was that some teams work on files placed in a general folder/file structure but we don´...
273,779
I'm trying to create a workflow that's seems like it should be simple, but I can't seem to tick all my boxes. Essentially it's because a step can be skipped sometimes. Item is entered - workflow starts Step 1: Status changes to "choice A" Workflow sends an email to "person A" Step 2: Status Change to "choice B" Work...
2019/12/19
[ "https://sharepoint.stackexchange.com/questions/273779", "https://sharepoint.stackexchange.com", "https://sharepoint.stackexchange.com/users/88149/" ]
I think the most effective way to actually sync between two sites would be using custom solutions. Since you have passed that option, you can use **OneDrive for Business** and **Microsoft Flow** instead. Keep both document libraries synced to OneDrive for Business. Then create flows for OneDrive for Business and tri...
I, not sure if there has been any upgrade in 365 that solves this issue in a better way, but I´ve found something that helps somehow: We work on plans and different levels of groups with different access to files. The problem we had was that some teams work on files placed in a general folder/file structure but we don´...
273,779
I'm trying to create a workflow that's seems like it should be simple, but I can't seem to tick all my boxes. Essentially it's because a step can be skipped sometimes. Item is entered - workflow starts Step 1: Status changes to "choice A" Workflow sends an email to "person A" Step 2: Status Change to "choice B" Work...
2019/12/19
[ "https://sharepoint.stackexchange.com/questions/273779", "https://sharepoint.stackexchange.com", "https://sharepoint.stackexchange.com/users/88149/" ]
I think I figured out a relatively robust and easy to use method (for Windows at least). You can use a [`.url` file](https://fileinfo.com/extension/url) to point to the URL of a file on a Sharepoint team. The file is a simple text file with the following content: ``` [InternetShortcut] URL=https://your_tenant.sharepo...
I, not sure if there has been any upgrade in 365 that solves this issue in a better way, but I´ve found something that helps somehow: We work on plans and different levels of groups with different access to files. The problem we had was that some teams work on files placed in a general folder/file structure but we don´...
10,308,067
I am using twitter Bootstrap with jQuery and i was wondering how can i toggle between "Subscribe / UnSubscribe" Each click its an ajax request so the user can Subscribe / UnSubscribe Once a user subscribed i display a messege "Subscribed!" What about if a user regret and want to unubscribed? I would like to have...
2012/04/25
[ "https://Stackoverflow.com/questions/10308067", "https://Stackoverflow.com", "https://Stackoverflow.com/users/941093/" ]
``` $(document).on('click', '#subscribe, #unsubscribe', function(){ var url; var button_id; var button_text; var self = $(this); self.button('loading'); if( this.id === 'subscribe' ) { url = "<%= "#{root_url}subscribe_to/#{@collection.id}"%>"; button_id = 'unsubscribe';...
What is happening at present is your click handler is getting attached at the start only. So later changing the id will not attach the handler. For this you use dynamic handler. So you should do following ``` $(document).on("click", "#subscribe", function(){ // ... }); $(document).on("click", "#unsubscribe", fu...
58,017,536
I have a GraphQL query that looks like this: ``` { actor { entitySearch(query: "name LIKE 'SOME_NAME'") { results { entities { guid } } } } } ``` I can't figure out how to create the Go struct to hold the returned data. The only thing I care about...
2019/09/19
[ "https://Stackoverflow.com/questions/58017536", "https://Stackoverflow.com", "https://Stackoverflow.com/users/736170/" ]
In GraphQL, the shape of the returned JSON will match the shape of the GraphQL query: you will have a `"data"` field, which will have an `"actor"` child, which will contain `"entitySearch"`, and so on. The library you're calling is in fact pretty minimal. Given [the conventional HTTP transport format](https://graphql.o...
I suggest using a map and the `json` package. I am unfamiliar with graphQL so I'll make a regular HTTP request and hope you can use it to make sense of your own issue: ```golang response, err := http.Get("https://example.com") // error checking code omitted defer response.Body.Close() // now we want to read the bod...
71,834,608
I was taking a look at this Github project: <https://github.com/LloydLabs/delete-self-poc> This project uses the SetFileInformationByHandle API (<https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-setfileinformationbyhandle>) in a somewhat creative way to allow the deletion from disk of a locked fi...
2022/04/11
[ "https://Stackoverflow.com/questions/71834608", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18776214/" ]
`RtlCopyMemory(fRename.FileName, lpwStream, sizeof(lpwStream));` writes 4 or 8 bytes into a 2 byte buffer! Who knows where the remaining bytes are going, the program behavior is probably undefined. The concept of deleting a running exe like this might work but the code indicates that the author does not have a full un...
the `ds_rename_handle` function is wrong implemented. the FILE\_RENAME\_INFO is **variable** size structure. as result declaration ``` FILE_RENAME_INFO fRename; ``` almost always wrong (it will ok only if **FileName** containing 1 or 2 symbols) really we need first calculate `FileNameLength` and then allocate `PF...
20,150,955
I have created a folder within WordPress public\_html folder and created a test.php file in it as below. www.mysite.com/myfolder/test.php When I navigate to this url, I get page not found 404 error. All other files in myfolder, e.g. test.txt load without any issues. It's just php files that are not running. Could an...
2013/11/22
[ "https://Stackoverflow.com/questions/20150955", "https://Stackoverflow.com", "https://Stackoverflow.com/users/812120/" ]
WordPress has its own .htaccess that is probably treating your URI as some sort of "Search Engine Friendly" thing, and translating it into some other format that WP is expecting. For example, <http://www.mysite.com/myfolder/test.php> might get rewritten to something like <http://www.mysite.com/myfolder/index.php?target...
Please check file-folder permission of myfolder. It should not be 777 instead it should be 755 on your server. Please refer [Wordpress php file execution](https://stackoverflow.com/questions/8811938/wordpress-php-file-execution)
20,150,955
I have created a folder within WordPress public\_html folder and created a test.php file in it as below. www.mysite.com/myfolder/test.php When I navigate to this url, I get page not found 404 error. All other files in myfolder, e.g. test.txt load without any issues. It's just php files that are not running. Could an...
2013/11/22
[ "https://Stackoverflow.com/questions/20150955", "https://Stackoverflow.com", "https://Stackoverflow.com/users/812120/" ]
This is weird since WP leaves your files alone due to `RewriteCond %{REQUEST_FILENAME} !-f` condition. Try creating a `myfolder/.htaccess` file with this line: ``` # just one line here RewriteEngine On ``` This will basically nullify all rewrite rules of parent folder.
Please check file-folder permission of myfolder. It should not be 777 instead it should be 755 on your server. Please refer [Wordpress php file execution](https://stackoverflow.com/questions/8811938/wordpress-php-file-execution)
63,308,758
What does evaluation of variable mean? ``` int main(){ int variable; variable; } ``` What does "variable" do? Why evaluation of "variable" should produce its own value?
2020/08/07
[ "https://Stackoverflow.com/questions/63308758", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11996484/" ]
Evaluating basically means "executing the code". In an expression, `variable` "loads" an `int` containing the value of that variable into the CPU. Evaluating the statement `variable;` "loads" that value to the CPU, which then does nothing with it. (The compiler is smart enough to detect that nothing happens, and will...
In C++, as with other languages, *expressions* are *evaluated*, typically to return a singular value. This happens by following the [operator precedence rules](https://en.cppreference.com/w/cpp/language/operator_precedence) to apply operators in the correct order.1 In the simplest case: ``` int x = 2; int y = x + x *...
63,308,758
What does evaluation of variable mean? ``` int main(){ int variable; variable; } ``` What does "variable" do? Why evaluation of "variable" should produce its own value?
2020/08/07
[ "https://Stackoverflow.com/questions/63308758", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11996484/" ]
To "evaluate an expression" means to compute its result and execute its side effects. Expression `variable` has no side effects. (Unlike something like `x = 1` or `printf("abc")`). It's result has type `int` (determining the type is not a part of the evaluation, because it never requires runtime computations), and th...
In C++, as with other languages, *expressions* are *evaluated*, typically to return a singular value. This happens by following the [operator precedence rules](https://en.cppreference.com/w/cpp/language/operator_precedence) to apply operators in the correct order.1 In the simplest case: ``` int x = 2; int y = x + x *...
165,378
I am developing an API in Unix environment for virtual machines. Most of the modules are developed in python. I have few questions on this. I have the file extension as `abc.py`. I would like to make this as a command. For example , `virtman dominfo [vmid]` should be the command syntax. Now I have to give `./virtman.p...
2014/11/01
[ "https://unix.stackexchange.com/questions/165378", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/89936/" ]
You seem to be mistaken in that `abc.py` would not be a command. If you can execute it, then is, just one with a dot in the name. Execute in the sense that you can do `./abc.py`, so the execute bits must be set. If you **have** to do `python abc.py` than you it is not a command (yet). In general, to make a normal pyth...
Anthon's answer is correct, however for non-trivial Python projects you should have a look at the [distutils](https://docs.python.org/2/distutils/) module in the standard library. It's *designed* to deploy python modules and executables on a system the "right way", and : * Python devs are familiar with this module (or...
59,064,525
I created a site by laravel and I want to show categories and relevant products names. I have an array and like this ``` $category = [ '1' => 'cat1', '2' => 'cat2' ]; $product = [ '0' => array( 'name' => 'product1', 'category_id' => '2' ), '1' => array( 'name' => 'product2', 'cat...
2019/11/27
[ "https://Stackoverflow.com/questions/59064525", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12009593/" ]
You can make use of Laravel collections' [groupBy](https://laravel.com/docs/5.8/collections#method-groupby) for your use case. In your controller file, group by `category_id` key and render them in your blade by looping. **Controller Snippet:** ``` public function someMethod(){ $category = [ '1' => 'cat...
You can use simple `foreach` loop like next: ``` foreach($category as $ind=>$cat){ echo "<h3>".$cat."</h3>".PHP_EOL; foreach($product as $row){ if($row['category_id'] == $ind) { echo "<p>".$row['name']."</p>".PHP_EOL; } } echo "<hr><hr>".PHP_EOL; } ``` [Demo](https://3v4l....
59,064,525
I created a site by laravel and I want to show categories and relevant products names. I have an array and like this ``` $category = [ '1' => 'cat1', '2' => 'cat2' ]; $product = [ '0' => array( 'name' => 'product1', 'category_id' => '2' ), '1' => array( 'name' => 'product2', 'cat...
2019/11/27
[ "https://Stackoverflow.com/questions/59064525", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12009593/" ]
You can make use of Laravel collections' [groupBy](https://laravel.com/docs/5.8/collections#method-groupby) for your use case. In your controller file, group by `category_id` key and render them in your blade by looping. **Controller Snippet:** ``` public function someMethod(){ $category = [ '1' => 'cat...
try ``` @foreach($category as $key => $cat) <h3>{{$cat}}</h3> @foreach($product as $pr) @if($pr['category_id'] == $key) <p>{{$pr['name']}}</p><br> @endif @endforeach <br> @endforeach ```
23,980
Any idea what PROM is intended in this diagram is ?[![PROM](https://i.stack.imgur.com/PAQPB.png)](https://i.stack.imgur.com/PAQPB.png) It is from the rational R1000 computer. Edit: Its not my project, I was trying to help the Danish data museum. They are making an emulator for this computer. And I realized I might ha...
2022/02/26
[ "https://retrocomputing.stackexchange.com/questions/23980", "https://retrocomputing.stackexchange.com", "https://retrocomputing.stackexchange.com/users/11626/" ]
Most likely a standard 4 KiBit 512 by 8 Bipolar PROM. Going from pinout and assumed DIP 20 it's either an * AMD 27S28 (OC output), or * AMD 27S29 (Tristate output) From the circuit shown I'd assume it being a [27S29](https://www.tekkna.it/open2b/var/catalog/product/files/7738.pdf). Timing wise both are the same. Co...
it is almost certainly a 512x8 bipolar prom. It is probably being used as a decoder. They were common in the late 70's and 80's before fast CMOS ones were available. They are all obsolete now although some are still available in the surplus market. Apple used them on the Apple II disk controller and printer cards.
246,648
I may soon have temporary access to a large and interesting data set, where the data is sensitive and raises privacy and confidentiality concerns. Number of records in the low hundred thousands, number of variables in the mid-hundreds. I need to describe what I will do with the data, and provide assurances that I will ...
2016/11/18
[ "https://stats.stackexchange.com/questions/246648", "https://stats.stackexchange.com", "https://stats.stackexchange.com/users/12923/" ]
Since you haven't described the exact fields which are privacy sensitive (which will be removed before you're allowed to "take home" the data), I'm assuming these would be fields such as names, addresses, phone nos, income or expenditure details, employers, etc. If you'd prefer to fit a regression on interesting field...
If you have all categorical data then you can make a table like this ``` var1 var2 var3 N 0 0 0 2 1 0 0 10 1 1 0 15 1 1 1 2 0 1 0 0 0 1 1 10 0 0 1 7 ``` This will allow you to exactly reconstruct the data for those three variables. You probably won'...
611,642
I just started to learn general theory of relativity by Hartle's gravity textbook. In a section on gravitational wave I encountered following statement 'Gravitational waves are hard to detect due to weak coupling of matter' and refers to this equation $$\frac{F\_{grav}}{F\_{elec}}\approx10^{-36}$$ There is another stat...
2021/02/01
[ "https://physics.stackexchange.com/questions/611642", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/285636/" ]
First, gravitational waves that we do have available for observations are, thankfully, not that much intense. Their sources are rather powerful (like, radiating few solar masses for half a second for a stellar black hole binary), but they are also far away and the inverse squares law kicks in pretty well. A billion lig...
I can try to tell you why gravitational waves are (experimentally) hard to detect. If you want to detect them, you do so nowadays in Laser Physics experiments (e. g. at LIGO in the US or at Virgo in Europe). For this, huge mirrors are used. If know gravitational waves are in the interferometers, the amount by which the...
1,946
If I have a site with numerous subcategories would it be better to have one domain with each subcategory linking off it, or a domain for each subcategory? For example, if it's a sports news site, it might be something like: ``` sportsnews.com sportsnews.com/football-news sportsnews.com/cricket-news sportsnews.com/ten...
2010/08/05
[ "https://webmasters.stackexchange.com/questions/1946", "https://webmasters.stackexchange.com", "https://webmasters.stackexchange.com/users/1306/" ]
What's going to be: 1) better for your users? If spreading it out over several domains will make the content easier for your users to navigate and use then take that route. If putting it all in one place will do that, then take that route. You want to make sure you don't lose sight of the bigger picture which is the ...
Would it not be best to have something like ``` sportsnews.com sportsnews.com/football sportsnews.com/cricket sportsnews.com/tennis ```
1,946
If I have a site with numerous subcategories would it be better to have one domain with each subcategory linking off it, or a domain for each subcategory? For example, if it's a sports news site, it might be something like: ``` sportsnews.com sportsnews.com/football-news sportsnews.com/cricket-news sportsnews.com/ten...
2010/08/05
[ "https://webmasters.stackexchange.com/questions/1946", "https://webmasters.stackexchange.com", "https://webmasters.stackexchange.com/users/1306/" ]
What's going to be: 1) better for your users? If spreading it out over several domains will make the content easier for your users to navigate and use then take that route. If putting it all in one place will do that, then take that route. You want to make sure you don't lose sight of the bigger picture which is the ...
One factor in SEO is speed. Using different domains can affect browser caching and cookies and therefore speed. I think it comes down to if you think your average user is interested in more than one sport, if he would visit only one site then have different domains and just link between them. If he is more likely to wa...
1,946
If I have a site with numerous subcategories would it be better to have one domain with each subcategory linking off it, or a domain for each subcategory? For example, if it's a sports news site, it might be something like: ``` sportsnews.com sportsnews.com/football-news sportsnews.com/cricket-news sportsnews.com/ten...
2010/08/05
[ "https://webmasters.stackexchange.com/questions/1946", "https://webmasters.stackexchange.com", "https://webmasters.stackexchange.com/users/1306/" ]
What's going to be: 1) better for your users? If spreading it out over several domains will make the content easier for your users to navigate and use then take that route. If putting it all in one place will do that, then take that route. You want to make sure you don't lose sight of the bigger picture which is the ...
Keep all in one domain, the other way is somehow bizzarre.
1,946
If I have a site with numerous subcategories would it be better to have one domain with each subcategory linking off it, or a domain for each subcategory? For example, if it's a sports news site, it might be something like: ``` sportsnews.com sportsnews.com/football-news sportsnews.com/cricket-news sportsnews.com/ten...
2010/08/05
[ "https://webmasters.stackexchange.com/questions/1946", "https://webmasters.stackexchange.com", "https://webmasters.stackexchange.com/users/1306/" ]
One factor in SEO is speed. Using different domains can affect browser caching and cookies and therefore speed. I think it comes down to if you think your average user is interested in more than one sport, if he would visit only one site then have different domains and just link between them. If he is more likely to wa...
Would it not be best to have something like ``` sportsnews.com sportsnews.com/football sportsnews.com/cricket sportsnews.com/tennis ```
1,946
If I have a site with numerous subcategories would it be better to have one domain with each subcategory linking off it, or a domain for each subcategory? For example, if it's a sports news site, it might be something like: ``` sportsnews.com sportsnews.com/football-news sportsnews.com/cricket-news sportsnews.com/ten...
2010/08/05
[ "https://webmasters.stackexchange.com/questions/1946", "https://webmasters.stackexchange.com", "https://webmasters.stackexchange.com/users/1306/" ]
Keep all in one domain, the other way is somehow bizzarre.
Would it not be best to have something like ``` sportsnews.com sportsnews.com/football sportsnews.com/cricket sportsnews.com/tennis ```
1,946
If I have a site with numerous subcategories would it be better to have one domain with each subcategory linking off it, or a domain for each subcategory? For example, if it's a sports news site, it might be something like: ``` sportsnews.com sportsnews.com/football-news sportsnews.com/cricket-news sportsnews.com/ten...
2010/08/05
[ "https://webmasters.stackexchange.com/questions/1946", "https://webmasters.stackexchange.com", "https://webmasters.stackexchange.com/users/1306/" ]
One factor in SEO is speed. Using different domains can affect browser caching and cookies and therefore speed. I think it comes down to if you think your average user is interested in more than one sport, if he would visit only one site then have different domains and just link between them. If he is more likely to wa...
Keep all in one domain, the other way is somehow bizzarre.
66,325,874
I have 2 tables (example) which have something like this... In the Invoice table, I have 5 records and in the Quotation table, I have 3. | Invoice | | --- | | id | | price | | inv\_desc | | invoice\_date | | balance | | Quotation | | --- | | id | | qty | | quo\_desc | | quo\_date | I want to get all records (\*) fro...
2021/02/23
[ "https://Stackoverflow.com/questions/66325874", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15102985/" ]
You may try a union query: ``` $first = DB::table('Invoice') ->select('description', NULL, 'price', 'balance', 'invoice_date') ->where('invoice_date', '>=', '2021-01-01') ->where('invoice_date', '<', '2021-03-01'); $result = DB::table('Quotation') ->select('description', 'qty', NULL, NULL, 'quo_date')...
Since eloquent, what's the relationship between Quote and Invoice? Would it be something like 1 quote will have many invoice? And I guess a Quote comes before an invoice. if it is. 1. You will need to have to add another column in Invoice. so Quotation\_id 2. Create your Quotation Model > > > ``` > class Quotation ...
66,325,874
I have 2 tables (example) which have something like this... In the Invoice table, I have 5 records and in the Quotation table, I have 3. | Invoice | | --- | | id | | price | | inv\_desc | | invoice\_date | | balance | | Quotation | | --- | | id | | qty | | quo\_desc | | quo\_date | I want to get all records (\*) fro...
2021/02/23
[ "https://Stackoverflow.com/questions/66325874", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15102985/" ]
You may try a union query: ``` $first = DB::table('Invoice') ->select('description', NULL, 'price', 'balance', 'invoice_date') ->where('invoice_date', '>=', '2021-01-01') ->where('invoice_date', '<', '2021-03-01'); $result = DB::table('Quotation') ->select('description', 'qty', NULL, NULL, 'quo_date')...
This is an answer in another post that I asked, similar to this question: <https://stackoverflow.com/a/66454203/15102985>
50,335,824
A MVC 5 project was created and you want to change the menu of this one, for it resorted to [Bootwatch](https://bootswatch.com/), the menu that you want to implement is the following [![Menu](https://i.stack.imgur.com/2vqxn.png)](https://i.stack.imgur.com/2vqxn.png) The first thing I did was change the general style ...
2018/05/14
[ "https://Stackoverflow.com/questions/50335824", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8120432/" ]
You are missing jQuery.min.js i believe, or it might be placed in the wrong order in your code structure. Hope this snippet helps!! ```html <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script> <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"></script> <link hre...
Can you check your css for the following: ``` .navbar-collapse.collapse { display: none!important; } ``` I am able to get a working menu in a new MVC 5 project using what you posted, but I do not have the same css as you. Please see a similar problem: [Bootstrap mobile menu wont stay open](https://stack...
14,714,022
Is it possible to configure the Windows Azure CLI tools without using a .publishsettings file? The 'azure account -h' command lists only options for downloading and importing a .publishsettings file.
2013/02/05
[ "https://Stackoverflow.com/questions/14714022", "https://Stackoverflow.com", "https://Stackoverflow.com/users/183343/" ]
I would recommend learning how to use [mysqldump](http://www.thegeekstuff.com/2008/09/backup-and-restore-mysql-database-using-mysqldump/) on the command line, which is almost certainly what phpMyAdmin is using under the hood to do your database export. If you're using `mysqldump`, you can transfer the dump file via SSH...
This might help: <http://support.tigertech.net/mysql-duplicate> It says you need to click on the database name on the left side before exporting, for no apparent reason, or else you won't be able to import the exported file into a new database. Also, you have to cut your input files into small pieces. The UI says les...
52,897,427
My view looks something like this (but I've slimmed it down for simplicity) **view.jsx** ``` import * as R from 'ramda'; import { Validate } from 'src/utils/validate'; class example extends Component { constructor(props) { super(props); this.state = { model: EMPTY_MODEL, ...
2018/10/19
[ "https://Stackoverflow.com/questions/52897427", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2418295/" ]
As `skyboyer` eluded to, the issues is binding a arrow function In validate.js changed ``` export const Validate = ({ currentTarget }) => { ``` to ``` export const Validate = function ({ currentTarget }) { ```
Can you try `this.validate = Validate.bind(this);` instead?
17,598,359
So I'm new to MVC4 and C#, I have been designing this website for about 2 weeks now and there have not been any issues with the intelisense. For 2 days now Visual studio is telling me that @Viewbag and other @ commands are not part of my project and i may be missing something or it tells me that Viewbag doesn't exist ...
2013/07/11
[ "https://Stackoverflow.com/questions/17598359", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2236967/" ]
Make sure you have specified the Razor version you are using in the `appSettings` of your web.config: ``` <appSettings> <add key="webpages:Version" value="2.0.0.0" /> <add key="ClientValidationEnabled" value="true" /> <add key="UnobtrusiveJavaScriptEnabled" value="true" /> </appSettings> ``` Also make su...
Had the same problem, after i mistakenly added `<appSettings>` into Views Web.config instead of the "main" Web.config file. Took me a few hours to figure that out... Hope it helps someone.
17,598,359
So I'm new to MVC4 and C#, I have been designing this website for about 2 weeks now and there have not been any issues with the intelisense. For 2 days now Visual studio is telling me that @Viewbag and other @ commands are not part of my project and i may be missing something or it tells me that Viewbag doesn't exist ...
2013/07/11
[ "https://Stackoverflow.com/questions/17598359", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2236967/" ]
Create a new Internet web app take out your changes ( from the old code ) Insert the newly created Internet Web App config file, Add old changes back ( skip all the reading line by line see if any of that really was messing up ) Hope that helps
Had the same problem, after i mistakenly added `<appSettings>` into Views Web.config instead of the "main" Web.config file. Took me a few hours to figure that out... Hope it helps someone.
3,912,301
I'm wondering if the minimal polynomials of $A, A^T\in\mathbb{M}\_{n\times n}(\mathbb{F})$ are somehow related? Are they the same? If $m\_A(t)$ is the minimal polynomial of $A$, then $m\_A(A) = 0$. So, $(m\_A(A))^T = 0$. If two matrices $P,Q$ commute then $(PQ)^T = P^TQ^T$. Using this, we can see that $m\_A(A^T) =0$. ...
2020/11/18
[ "https://math.stackexchange.com/questions/3912301", "https://math.stackexchange.com", "https://math.stackexchange.com/users/425395/" ]
You don't need to consider any factorisation. Let $p(x)=\sum\_{i=1}^ka\_ix^i$ be any monic polynomial. If $p(A)=0$, then $$ p(A^T)=\sum\_{i=1}^ka\_i(A^T)^i=\left(\sum\_{i=1}^ka\_iA^i\right)^T=p(A)^T=0. $$ Since $A=(A^T)^T$, it is also true that $p(A^T)=0\Rightarrow p(A)=0$. Therefore $A$ and $A^T$ share the same set of...
$m\_A$ and $m\_{A^T}$ are the minimal polynomials for $A$ and $A^T$ respectively. So we have $m\_A(A) = 0$ and $m\_{A^T}(A^T) = 0$ by definition. Let $m\_A(t) = p\_1(t)p\_2(t)...p\_k(t)$ where $p\_i(t)\forall 1\leq i\leq k$ are the irreducible factors of $m\_A(t)$. $m\_A(A) = 0 \implies (m\_A(A))^T = 0$, which is jus...
25,069,559
I have a form, and I'm checking to see if it's submitting properly to post. This is my first foray into POST, so other than rudimentary research and tutorial stuff, I'm having a lot of problems. I wrote a simple script to see if my form is working properly at all. The HTML is clipped to only show you the form; I do hav...
2014/07/31
[ "https://Stackoverflow.com/questions/25069559", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3892726/" ]
Part of your problem is that you are using a variable you're calling `$_POSTEST` when really what you want is the $\_POST array. $\_POST is a special reserved variable in PHP (and needs to be referenced using that exact syntax) which is: > > An associative array of variables passed to the current script via the > HT...
There is not any $\_POSTTEST array in php. Use [$\_POST](http://php.net/manual/en/reserved.variables.post.php).
90,990
Post-structuralist thought seems, to me, to be quite hard to argue with as a concept. Clearly, we understand the world through language, which both stems from culture, loading concepts with cultural meanings, and is imprecise. As such, the idea that we cannot arrive at an objective truth about the world, and could not ...
2022/05/03
[ "https://philosophy.stackexchange.com/questions/90990", "https://philosophy.stackexchange.com", "https://philosophy.stackexchange.com/users/6520/" ]
> > Clearly, we understand the world through language > > > If by this you mean we understand the world *only* through language, this is not clear at all. In fact, it is false, because it entirely discounts the value of nonverbal thoughts. Language is highly *useful* for understanding the world, but as they say, "...
> > "we are left in a position where topics of critical importance in > medicine and environmental science can be thrown into doubt by > opponents with political axes to grind" > > > We were going to be in that position anyway. Look at US politics on covid & climate change - nothing to do with Structuralism. I wo...
90,990
Post-structuralist thought seems, to me, to be quite hard to argue with as a concept. Clearly, we understand the world through language, which both stems from culture, loading concepts with cultural meanings, and is imprecise. As such, the idea that we cannot arrive at an objective truth about the world, and could not ...
2022/05/03
[ "https://philosophy.stackexchange.com/questions/90990", "https://philosophy.stackexchange.com", "https://philosophy.stackexchange.com/users/6520/" ]
> > Clearly, we understand the world through language > > > If by this you mean we understand the world *only* through language, this is not clear at all. In fact, it is false, because it entirely discounts the value of nonverbal thoughts. Language is highly *useful* for understanding the world, but as they say, "...
You remark, "The dispute is, rather, about the way in which science is given a privileged position as an arbiter of truth." I'll make my response short: Science is indeed given a privileged position as an arbiter of truth *in scientific matters*- where the truth content of an assertion can be determined in ways that a...
58,886,932
I want to get my data from server in the component where the data is needed. (call api at `mounted` or `beforemounted` or `created` (component lifecycle loop)) If I followed the rule above, it is inevitable to call same multiple REST api at same page. I tried to cache them but it is quite difficult to handle the REST...
2019/11/16
[ "https://Stackoverflow.com/questions/58886932", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3846998/" ]
If you want an SSR page than you can make API requests in the asyncData method inside pages or if you want to make API requests on client-side than you can go for mounted method. And for state management/managing data in component/across component can be achieved via VueX
You can use `nuxtServerInit` to store in `vuex` Check out the [documentation](https://nuxtjs.org/guide/vuex-store/#the-nuxtserverinit-action)
55,251,577
I need it in "modern DOM" if possible. Here is the code. ``` <select name="skuAndSize" id="skuAndSize" class="ncss-btn fs16-sm ncss-base pb3-sm prl5-sm pt3-sm css-1rsed2n"> <option value="" disabled="">Select Size</option> <option value="22348626:7" disabled="">US 7</option> <option value="22348625:7.5" disable...
2019/03/19
[ "https://Stackoverflow.com/questions/55251577", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You can set selectedIndex with javascript ```js const val = 'US 10.5'; const skuAndSize = document.getElementById ('skuAndSize'); skuAndSize.selectedIndex = [...skuAndSize.options].findIndex (option => option.text === val); ``` ```html <select name="skuAndSize" id="skuAndSize" class="ncss-btn fs16-sm ncss-base pb3-...
Quick answer ============ You can set the value of a select by setting the property `value`: ``` document.querySelector('#skuAndSize').value = '22348622:10.5'; ``` See <https://developer.mozilla.org/en-US/docs/Web/API/HTMLSelectElement> Complete Example ================ ```js const tests = [4, 'Three', 2, '1']; ...
55,251,577
I need it in "modern DOM" if possible. Here is the code. ``` <select name="skuAndSize" id="skuAndSize" class="ncss-btn fs16-sm ncss-base pb3-sm prl5-sm pt3-sm css-1rsed2n"> <option value="" disabled="">Select Size</option> <option value="22348626:7" disabled="">US 7</option> <option value="22348625:7.5" disable...
2019/03/19
[ "https://Stackoverflow.com/questions/55251577", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You can set selectedIndex with javascript ```js const val = 'US 10.5'; const skuAndSize = document.getElementById ('skuAndSize'); skuAndSize.selectedIndex = [...skuAndSize.options].findIndex (option => option.text === val); ``` ```html <select name="skuAndSize" id="skuAndSize" class="ncss-btn fs16-sm ncss-base pb3-...
You can use [`Array#find()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find) and compare the `text` property of `<option>` to wanted value ```js var val = 'US 10.5', options = document.querySelector('#skuAndSize').options, wantedOption = Array.from(options).find(o => ...
55,251,577
I need it in "modern DOM" if possible. Here is the code. ``` <select name="skuAndSize" id="skuAndSize" class="ncss-btn fs16-sm ncss-base pb3-sm prl5-sm pt3-sm css-1rsed2n"> <option value="" disabled="">Select Size</option> <option value="22348626:7" disabled="">US 7</option> <option value="22348625:7.5" disable...
2019/03/19
[ "https://Stackoverflow.com/questions/55251577", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You can set selectedIndex with javascript ```js const val = 'US 10.5'; const skuAndSize = document.getElementById ('skuAndSize'); skuAndSize.selectedIndex = [...skuAndSize.options].findIndex (option => option.text === val); ``` ```html <select name="skuAndSize" id="skuAndSize" class="ncss-btn fs16-sm ncss-base pb3-...
This is jquery version for your requirement. ```js $('#skuAndSize').change(function(){ var text1 = 'US 10.5'; $("#skuAndSize option").filter(function() { return $(this).text() == text1; }).prop('selected', true); }) ``` ```html <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.j...
345,133
Currently my Ubuntu server runs RubyOnRails applications with Apache2 + Passenger. Now I need to deploy a Sinatra (Plain Ruby app) which needs to run on Thin instead of Passenger. I'm familiar with configuring Apache and would like to continue in that manner, with the VirtualHosts (in sites-available) etc.. How can ...
2011/12/29
[ "https://serverfault.com/questions/345133", "https://serverfault.com", "https://serverfault.com/users/102189/" ]
You'll be configuring Apache as a "reverse proxy" - that search term will point you to a wealth of information regarding the configuration, but here's an example that should get you most of the way to the deployment you're looking for. If you'll be using a different hostname and different `<VirtualHost>`, then you can...
You could use Varnish to route app requests. I did this at my last job on our RoR/Varnish/NGINX stack. Besides, Varnish caching is awesome!
23,632,326
Let's say I want to create `SomeClass`, which inherits from two classes: `class SomeClass(InheritedClass1, InheritedClass2):` Both the `InheritedClass1` and `InheritedClass2` have the **method with the same name**, named `performLogic`. If I declare `super().peformLogic()`, I will get result only from the first argu...
2014/05/13
[ "https://Stackoverflow.com/questions/23632326", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2102559/" ]
`super` is not a universal replacement for calling a method in a parent base class; it requires that classes be designed cooperatively. This means that *every* class needs to call `super().performLogic`, just in case it is not the last element of some class's MRO. Ultimately, there has to be some class at the end of th...
This is actually a very interesting question. I think there would not be any features in the language to allow this. What you basically want to do is to use method resolution in the language to call two methods where method resolution would always resolve one method. Hence, this cannot be done. If you want to call two ...
30,037,680
Sorry again for knocking here again but I want to ask a final question. I found this code and it was not commented on. Can someone please comment it for me so that I can understand what the code is trying to do. Learning connection on my own. :( ``` public static void main(String[] args){ JFrame frame = new J...
2015/05/04
[ "https://Stackoverflow.com/questions/30037680", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4862643/" ]
Your problem is in your comparison. ``` if (union.toString().contains(apiSwRepo.toString())) { } else union.add(apiSwRepo); ``` In the above code, you are converting the Set to a String and then calling contains(). You instead should be .contains() on the union itself like so: ``` if (union.contains(apiSwRepo))...
I don't know the reason yet. But I solved it making this changes to intersection method: ``` public <T> int intersection (Set<T> s1,Set<T> s2){ Set<T> intersection = new HashSet<T>(); for (T apiSwRepo:s2){ if (s1.toString().contains(apiSwRepo.toString())){ intersection.add(apiSwRepo); ...
44,075,134
How do I clearly mark and label "To-Do"s directly in my code (using Atom on Mac) for later?
2017/05/19
[ "https://Stackoverflow.com/questions/44075134", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4722345/" ]
I'd just mark your comments with `# TODO`. Most IDEs have a way of aggregating these comments to a list. Atom is no different, although you'd need to install [a plugin for it](https://atom.io/packages/todo-show).
This doesn't strictly satisfy your requirement of not using comments, but most IDEs support "Todos". Just start a comment with "todo": ``` # TODO: Fix this code! ``` In many IDEs, this will cause the comment to be marked in some bright color (light blue in IntelliJ), and put it into a TODO section so it can be viewe...
44,075,134
How do I clearly mark and label "To-Do"s directly in my code (using Atom on Mac) for later?
2017/05/19
[ "https://Stackoverflow.com/questions/44075134", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4722345/" ]
I'd just mark your comments with `# TODO`. Most IDEs have a way of aggregating these comments to a list. Atom is no different, although you'd need to install [a plugin for it](https://atom.io/packages/todo-show).
I use `input`s with a description of the surrounding code/what needs done, they stop execution to make it obvious something needs done while allowing you to continue.
13,662,597
I'm writing an Android app that involves connecting to a TCP server (that I also wrote) and sending/receiving text from it. Right now I have a bug in my final read (client-side). When I use the debugger in Eclipse, it shows that I am receiving all the bytes that are sent, but for certain pieces of text, if I'm expect...
2012/12/01
[ "https://Stackoverflow.com/questions/13662597", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1200782/" ]
You're reading a string into an `int`, you should use `char` array instead: ``` char action[200]; fscanf(fin, "%199s", action); ``` And here you need the address of `boughtTickets` ``` fscanf(fin, "%d", &boughtTickets); ``` Here you're printing the addresses of variables instead of their values: ``` printf("Sold...
`strmp` compare string to another string but for your program you are comparing `int` (`action`) to string. also for `fscanf(fin, "%s", action);` `fscanf` is reading string from the file input descriptor `fin` so the type of `action` should be char buffer ``` char action[256]; fscanf(fin, "%s", action); if (strcmp(...
7,523,354
I have a method like this: ``` -(void)A:(int)a B:(int)b{ } ``` and want to put the method into a new thread: ``` NSInvocationOperation *theOp = [[NSInvocationOperation alloc]initWithTarget:self selector:@selector(A:B:) object:nil]; ``` but "EXC\_BAD\_ACCESS".
2011/09/23
[ "https://Stackoverflow.com/questions/7523354", "https://Stackoverflow.com", "https://Stackoverflow.com/users/918859/" ]
From Apple's docs: "The selector to invoke when running the operation. The selector may take 0 or 1 parameters;". So if you want to call a method with more parameters, create an extra method with a single parameter and call the method with more parameters from there.
You don't need the second B: usuage would be: ``` [[NSInvocationOperation alloc]initWithTarget:self selector:@selector(A:) object:nil]; ```
7,523,354
I have a method like this: ``` -(void)A:(int)a B:(int)b{ } ``` and want to put the method into a new thread: ``` NSInvocationOperation *theOp = [[NSInvocationOperation alloc]initWithTarget:self selector:@selector(A:B:) object:nil]; ``` but "EXC\_BAD\_ACCESS".
2011/09/23
[ "https://Stackoverflow.com/questions/7523354", "https://Stackoverflow.com", "https://Stackoverflow.com/users/918859/" ]
The method you invoke with `NSInvocationOperation` can only take a single parameter, and that parameter must be an Objective-C object (like `NSNumber`) and not a plain C type (like `int`). Typically, to handle multiple parameters you use an NSDictionary or NSArray to hold the parameters: ``` - (void)myMethod:(NSDicti...
From Apple's docs: "The selector to invoke when running the operation. The selector may take 0 or 1 parameters;". So if you want to call a method with more parameters, create an extra method with a single parameter and call the method with more parameters from there.
7,523,354
I have a method like this: ``` -(void)A:(int)a B:(int)b{ } ``` and want to put the method into a new thread: ``` NSInvocationOperation *theOp = [[NSInvocationOperation alloc]initWithTarget:self selector:@selector(A:B:) object:nil]; ``` but "EXC\_BAD\_ACCESS".
2011/09/23
[ "https://Stackoverflow.com/questions/7523354", "https://Stackoverflow.com", "https://Stackoverflow.com/users/918859/" ]
If possible, try to have one array or dictionary as the parameter to the selector. Then when you are invoking convert your two params into one object (either array or dictionary) and send that object. In the selector, i think you can get them back from array or dictionary.
You don't need the second B: usuage would be: ``` [[NSInvocationOperation alloc]initWithTarget:self selector:@selector(A:) object:nil]; ```
7,523,354
I have a method like this: ``` -(void)A:(int)a B:(int)b{ } ``` and want to put the method into a new thread: ``` NSInvocationOperation *theOp = [[NSInvocationOperation alloc]initWithTarget:self selector:@selector(A:B:) object:nil]; ``` but "EXC\_BAD\_ACCESS".
2011/09/23
[ "https://Stackoverflow.com/questions/7523354", "https://Stackoverflow.com", "https://Stackoverflow.com/users/918859/" ]
The method you invoke with `NSInvocationOperation` can only take a single parameter, and that parameter must be an Objective-C object (like `NSNumber`) and not a plain C type (like `int`). Typically, to handle multiple parameters you use an NSDictionary or NSArray to hold the parameters: ``` - (void)myMethod:(NSDicti...
You don't need the second B: usuage would be: ``` [[NSInvocationOperation alloc]initWithTarget:self selector:@selector(A:) object:nil]; ```
7,523,354
I have a method like this: ``` -(void)A:(int)a B:(int)b{ } ``` and want to put the method into a new thread: ``` NSInvocationOperation *theOp = [[NSInvocationOperation alloc]initWithTarget:self selector:@selector(A:B:) object:nil]; ``` but "EXC\_BAD\_ACCESS".
2011/09/23
[ "https://Stackoverflow.com/questions/7523354", "https://Stackoverflow.com", "https://Stackoverflow.com/users/918859/" ]
The method you invoke with `NSInvocationOperation` can only take a single parameter, and that parameter must be an Objective-C object (like `NSNumber`) and not a plain C type (like `int`). Typically, to handle multiple parameters you use an NSDictionary or NSArray to hold the parameters: ``` - (void)myMethod:(NSDicti...
If possible, try to have one array or dictionary as the parameter to the selector. Then when you are invoking convert your two params into one object (either array or dictionary) and send that object. In the selector, i think you can get them back from array or dictionary.
11,254,806
I'm trying to create a half circle in d3. Using [cardinal interpolation](https://github.com/mbostock/d3/wiki/SVG-Shapes#wiki-line_interpolate) produces a path that is close to what I want, but isn't quite "circular" enough. How can I write my own interpolator to better round this path, or is there a better method? Her...
2012/06/29
[ "https://Stackoverflow.com/questions/11254806", "https://Stackoverflow.com", "https://Stackoverflow.com/users/522877/" ]
See: [How to calculate the SVG Path for an arc (of a circle)](https://stackoverflow.com/questions/5736398/how-to-calculate-the-svg-path-for-an-arc-of-a-circle) --- The problem with using d3.arc() to create curved lines is that it layers two lines on top of each other. See: <https://stackoverflow.com/a/11595157/522877...
Have you looked at the [arc section](https://github.com/mbostock/d3/wiki/SVG-Shapes#wiki-arc)?
27,528,025
I am trying do a dynamic bind a < tabset> based on the selected value of dropdownlist. Here is my app.js ``` var app = angular.module('app',['ui.bootstrap']); app.controller('tabCtrl',function($scope,$http){ $scope.countryList=[{name:'Canada',id:'ca'},{name:'United States',id:'us'}]; $scope.selectedCountry =$s...
2014/12/17
[ "https://Stackoverflow.com/questions/27528025", "https://Stackoverflow.com", "https://Stackoverflow.com/users/454232/" ]
The spec doesn't specifically mentions this but it is possible to combine both the :host-context and :host selector to get the correct result. ``` <polymer-element name="my-element"> <template> <style> :host(:hover) { background-color: blue; // For all other situations ...
Reading through [the spec](http://dev.w3.org/csswg/css-scoping/), that doesn't appear to be possible. However, it is possible to do the following. ``` <polymer-element name="my-element"> <template> <style> :host(:hover) { background-color: blue; // For all other situations ...
16,781,229
In GotW #6b part 2, we find the code ``` class polygon { public: polygon() : area{-1} {} //.... double area; }; ``` Why should we use list initialization for base types instead of the commonly used `area(-1)`? Are there any advantages / situations where they behave differently?
2013/05/27
[ "https://Stackoverflow.com/questions/16781229", "https://Stackoverflow.com", "https://Stackoverflow.com/users/673730/" ]
> > Why should we use list initialization for base types instead of the commonly used area(-1)? > > > First of all, I think the message there is just that C++11's uniform initialization should be used whenever it can be used. In this case, it is mostly a matter of style and taste. Whether the style and taste pro...
This wouldn't make a difference for scalars, but the author was probably conforming to the new syntax. For example, before C++11 you couldn't initialize arrays through the initializer list, but this can be accommodated easily through aggregate-initialization: ``` struct A { A() : data{1, 2, 3} // this wouldn't wor...
52,655,415
I want to remove the non digits in data and put it in a python list, but when I try to execute the loop it raises "IndexError: list assignment index out of range" why ? its iterating along the b variable that have the same length that the data has. ``` data = ['1A', '1B', '2', '3A', '3B'] b=range(len(data)) pt=[] ...
2018/10/04
[ "https://Stackoverflow.com/questions/52655415", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10095708/" ]
Instead of ``` pt[i]=(''.join(c for c in x if c in digits)) ``` use ``` pt.append((''.join(c for c in x if c in digits))) ``` The reason the first does not work because `pt[i]` requires that there exists `i`-th element of the list `pt`. Actually, you can rewrite your code to be much simpler: ``` pt=[] for...
that happens because you're trying to assign values to non-existing items in pt, because you can't just put e.g pt[1] = 3 without pt[1] existing already. * so just change it by either : `pt=data` instead of `pt = []` or use `pt.append((''.join(c for c in x if c in digits)))` > > this one doesn't require a list ...
52,655,415
I want to remove the non digits in data and put it in a python list, but when I try to execute the loop it raises "IndexError: list assignment index out of range" why ? its iterating along the b variable that have the same length that the data has. ``` data = ['1A', '1B', '2', '3A', '3B'] b=range(len(data)) pt=[] ...
2018/10/04
[ "https://Stackoverflow.com/questions/52655415", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10095708/" ]
Instead of ``` pt[i]=(''.join(c for c in x if c in digits)) ``` use ``` pt.append((''.join(c for c in x if c in digits))) ``` The reason the first does not work because `pt[i]` requires that there exists `i`-th element of the list `pt`. Actually, you can rewrite your code to be much simpler: ``` pt=[] for...
``` digits ="0123456789" data = ['1A', '1B', '2', '3A', '3B'] pt=[] for i, x in enumerate(data): pt.append((''.join(c for c in x if c in digits))) print(pt) ``` Is this what you're after?
52,655,415
I want to remove the non digits in data and put it in a python list, but when I try to execute the loop it raises "IndexError: list assignment index out of range" why ? its iterating along the b variable that have the same length that the data has. ``` data = ['1A', '1B', '2', '3A', '3B'] b=range(len(data)) pt=[] ...
2018/10/04
[ "https://Stackoverflow.com/questions/52655415", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10095708/" ]
Instead of ``` pt[i]=(''.join(c for c in x if c in digits)) ``` use ``` pt.append((''.join(c for c in x if c in digits))) ``` The reason the first does not work because `pt[i]` requires that there exists `i`-th element of the list `pt`. Actually, you can rewrite your code to be much simpler: ``` pt=[] for...
You could simply use list comprehension ``` data = ['1A', '1B', '2', '3A', '3B'] pt = [x for x in data if x in digits] ```