qid
int64
question
string
date
string
metadata
list
response_j
string
response_k
string
12,899,282
I've started building Linux installers on the 64 bit windows version of Install4j recently and am getting the error below when it the generated installers start to do their extraction. Is this something I'm doing wrong or is unsupported? Or a bug in 5.1 of install4j. I've recently upgraded to it as well. ``` Extracti...
2012/10/15
[ "https://Stackoverflow.com/questions/12899282", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1192789/" ]
You need to append div to your page. Currently, you have just created a reference to the clone without displaying it. $("body").append(div);
You have to attach the cloned div somewhere inside your html. For example: ``` var off = $(this).offset(); var div = $('#testtt').clone(); div.css({ position: "absolute", top: off.top, left: off.left }); // append to parent of "this" var parent = $(this).parent(); div.appendTo(parent); // should be unnecessary, exce...
12,899,282
I've started building Linux installers on the 64 bit windows version of Install4j recently and am getting the error below when it the generated installers start to do their extraction. Is this something I'm doing wrong or is unsupported? Or a bug in 5.1 of install4j. I've recently upgraded to it as well. ``` Extracti...
2012/10/15
[ "https://Stackoverflow.com/questions/12899282", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1192789/" ]
You are cloning the div **but not inserting** it anywhere in your DOM.. So it is non existent until you do that ``` var off = $(this).offset(); var div = $('#testtt').clone(); div.css({ position: "absolute", top: off.top, left: off.left }); $('body').append(div); <-- Appending to body here.. You can append anywher...
As per the comment from @andrewWhitaker, you need to add the new element to the DOM. e.g. ``` div.attr('id').val( div.attr('id')+"_cloned" ); $("#my_container_element_id").append(div); ``` You can also remove the ``` div.show(); ```
12,899,282
I've started building Linux installers on the 64 bit windows version of Install4j recently and am getting the error below when it the generated installers start to do their extraction. Is this something I'm doing wrong or is unsupported? Or a bug in 5.1 of install4j. I've recently upgraded to it as well. ``` Extracti...
2012/10/15
[ "https://Stackoverflow.com/questions/12899282", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1192789/" ]
You have to attach the cloned div somewhere inside your html. For example: ``` var off = $(this).offset(); var div = $('#testtt').clone(); div.css({ position: "absolute", top: off.top, left: off.left }); // append to parent of "this" var parent = $(this).parent(); div.appendTo(parent); // should be unnecessary, exce...
in Jquery ``` $('.addRow').click(function(){ var off = $(this).offset(); var div = $('#testtt').clone(); div.css({ position: "absolute", top: off.top, left: off.left }); div.show(); div.appendTo($("#testtt"); ``` })
445,800
So recently on a project I'm working on, we've been struggling to keep a solution's code base and the associated database schema in synch (Database = SQL Server 2008). Database changes occur fairly regularly (adding columns, constraints, relationships, etc) and as a result it's not uncommon for people to do a 'Get La...
2009/01/15
[ "https://Stackoverflow.com/questions/445800", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18471/" ]
We try to work forward from the creation scripts. i.e a change to the database is not authorised unless the script has been tested and checked into source control. But this assumes that the database team is integrated with your app team which is usually not the case in a large project... (I was tempted to answer thi...
have a look at DB Ghost - you can create a dbp using the scripter in seconds and then manage all your database code with the change manager. www.dbghost.com This is exactly what DB Ghost was designed to handle.
445,800
So recently on a project I'm working on, we've been struggling to keep a solution's code base and the associated database schema in synch (Database = SQL Server 2008). Database changes occur fairly regularly (adding columns, constraints, relationships, etc) and as a result it's not uncommon for people to do a 'Get La...
2009/01/15
[ "https://Stackoverflow.com/questions/445800", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18471/" ]
Ok although its not the entire solution, you should include an assertion in the Application code that links up to the database to assert the correct schema is being used, that way at least it becomes obvious, and you avoid silent bugs and people complaining that stuff went crazy all of the sudden. As for the schema ve...
Have a look at this question: [dynamic patching of databases](https://stackoverflow.com/questions/252972/dynamic-patching-of-databases). I think it's similar enough to your problem to be helpful.
445,800
So recently on a project I'm working on, we've been struggling to keep a solution's code base and the associated database schema in synch (Database = SQL Server 2008). Database changes occur fairly regularly (adding columns, constraints, relationships, etc) and as a result it's not uncommon for people to do a 'Get La...
2009/01/15
[ "https://Stackoverflow.com/questions/445800", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18471/" ]
Ok although its not the entire solution, you should include an assertion in the Application code that links up to the database to assert the correct schema is being used, that way at least it becomes obvious, and you avoid silent bugs and people complaining that stuff went crazy all of the sudden. As for the schema ve...
We basically do things the way you are, with the generation script checked into source control as well. I'm the designated database master so all changes to the script itself are done through me. People send me scripts of the changes they have made, I update my master copy of the schema, run a generate scripts (SSMS) t...
445,800
So recently on a project I'm working on, we've been struggling to keep a solution's code base and the associated database schema in synch (Database = SQL Server 2008). Database changes occur fairly regularly (adding columns, constraints, relationships, etc) and as a result it's not uncommon for people to do a 'Get La...
2009/01/15
[ "https://Stackoverflow.com/questions/445800", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18471/" ]
We try to work forward from the creation scripts. i.e a change to the database is not authorised unless the script has been tested and checked into source control. But this assumes that the database team is integrated with your app team which is usually not the case in a large project... (I was tempted to answer thi...
Use a tool like [RedGate SQL Compare](http://www.red-gate.com/products/SQL_Compare/index.htm) to generate the change schema between any given version of the database. You can then check that file into source code control
445,800
So recently on a project I'm working on, we've been struggling to keep a solution's code base and the associated database schema in synch (Database = SQL Server 2008). Database changes occur fairly regularly (adding columns, constraints, relationships, etc) and as a result it's not uncommon for people to do a 'Get La...
2009/01/15
[ "https://Stackoverflow.com/questions/445800", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18471/" ]
have a look at DB Ghost - you can create a dbp using the scripter in seconds and then manage all your database code with the change manager. www.dbghost.com This is exactly what DB Ghost was designed to handle.
Have a look at this question: [dynamic patching of databases](https://stackoverflow.com/questions/252972/dynamic-patching-of-databases). I think it's similar enough to your problem to be helpful.
445,800
So recently on a project I'm working on, we've been struggling to keep a solution's code base and the associated database schema in synch (Database = SQL Server 2008). Database changes occur fairly regularly (adding columns, constraints, relationships, etc) and as a result it's not uncommon for people to do a 'Get La...
2009/01/15
[ "https://Stackoverflow.com/questions/445800", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18471/" ]
have a look at DB Ghost - you can create a dbp using the scripter in seconds and then manage all your database code with the change manager. www.dbghost.com This is exactly what DB Ghost was designed to handle.
If you are not using Visual Studio Database Professional Edition, then you will need another tool that can break the database down into its elemental pieces so that they are managable and changeable in an easier manner. I'd recommend seriously considering [Redgate's SQL tools](http://www.red-gate.com/products/sql_tool...
445,800
So recently on a project I'm working on, we've been struggling to keep a solution's code base and the associated database schema in synch (Database = SQL Server 2008). Database changes occur fairly regularly (adding columns, constraints, relationships, etc) and as a result it's not uncommon for people to do a 'Get La...
2009/01/15
[ "https://Stackoverflow.com/questions/445800", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18471/" ]
Ok although its not the entire solution, you should include an assertion in the Application code that links up to the database to assert the correct schema is being used, that way at least it becomes obvious, and you avoid silent bugs and people complaining that stuff went crazy all of the sudden. As for the schema ve...
Use a tool like [RedGate SQL Compare](http://www.red-gate.com/products/SQL_Compare/index.htm) to generate the change schema between any given version of the database. You can then check that file into source code control
445,800
So recently on a project I'm working on, we've been struggling to keep a solution's code base and the associated database schema in synch (Database = SQL Server 2008). Database changes occur fairly regularly (adding columns, constraints, relationships, etc) and as a result it's not uncommon for people to do a 'Get La...
2009/01/15
[ "https://Stackoverflow.com/questions/445800", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18471/" ]
We try to work forward from the creation scripts. i.e a change to the database is not authorised unless the script has been tested and checked into source control. But this assumes that the database team is integrated with your app team which is usually not the case in a large project... (I was tempted to answer thi...
My solution to this problem is simple. Define everything as XML, and make sure that both the database, the ORM and the UI are generated from this XML, no exceptions. That way, you can use code generation tools to quickly regenerate the database creation script, which will alter your schema while (hopefully) preserving ...
445,800
So recently on a project I'm working on, we've been struggling to keep a solution's code base and the associated database schema in synch (Database = SQL Server 2008). Database changes occur fairly regularly (adding columns, constraints, relationships, etc) and as a result it's not uncommon for people to do a 'Get La...
2009/01/15
[ "https://Stackoverflow.com/questions/445800", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18471/" ]
We try to work forward from the creation scripts. i.e a change to the database is not authorised unless the script has been tested and checked into source control. But this assumes that the database team is integrated with your app team which is usually not the case in a large project... (I was tempted to answer thi...
Have a look at this question: [dynamic patching of databases](https://stackoverflow.com/questions/252972/dynamic-patching-of-databases). I think it's similar enough to your problem to be helpful.
445,800
So recently on a project I'm working on, we've been struggling to keep a solution's code base and the associated database schema in synch (Database = SQL Server 2008). Database changes occur fairly regularly (adding columns, constraints, relationships, etc) and as a result it's not uncommon for people to do a 'Get La...
2009/01/15
[ "https://Stackoverflow.com/questions/445800", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18471/" ]
Ok although its not the entire solution, you should include an assertion in the Application code that links up to the database to assert the correct schema is being used, that way at least it becomes obvious, and you avoid silent bugs and people complaining that stuff went crazy all of the sudden. As for the schema ve...
We try to work forward from the creation scripts. i.e a change to the database is not authorised unless the script has been tested and checked into source control. But this assumes that the database team is integrated with your app team which is usually not the case in a large project... (I was tempted to answer thi...
1,879,028
I was wondering about the following: Lets assume that you have a function like $f(x)=x$ and you measure your function by taking an integral from $0$ to $1$, which gives you: $$ \int\_{0}^{1} x \; {\rm d}x = \frac{1}{2} $$ Ok, now let's imagine that we randomly reorder in a **unique way** the function. I mean, once yo...
2016/08/02
[ "https://math.stackexchange.com/questions/1879028", "https://math.stackexchange.com", "https://math.stackexchange.com/users/246452/" ]
To be clear, my impression is that in the main part of your question you are asking about the family $F$ of bijections $[0,1] \to [0,1]$ with the particular property that the `graph' of each function is dense in $[0,1]^2$; ie, your '$1$st intuition' point is assumed to hold. Demonstrating the existence of such function...
You want to randomly choose an output (that has not yet been used) for each new input and remember it for subsequent identical queries. This is called [memoization](https://en.wikipedia.org/wiki/Memoization) in computer science. But you also want to integrate the function. This is not compatible with the above randomi...
1,879,028
I was wondering about the following: Lets assume that you have a function like $f(x)=x$ and you measure your function by taking an integral from $0$ to $1$, which gives you: $$ \int\_{0}^{1} x \; {\rm d}x = \frac{1}{2} $$ Ok, now let's imagine that we randomly reorder in a **unique way** the function. I mean, once yo...
2016/08/02
[ "https://math.stackexchange.com/questions/1879028", "https://math.stackexchange.com", "https://math.stackexchange.com/users/246452/" ]
To be clear, my impression is that in the main part of your question you are asking about the family $F$ of bijections $[0,1] \to [0,1]$ with the particular property that the `graph' of each function is dense in $[0,1]^2$; ie, your '$1$st intuition' point is assumed to hold. Demonstrating the existence of such function...
Define $C:=(0,1/2)\cap\mathbb{Q}$ and $\widetilde C:=\{c+1/2\,|\,c\in C\}\subset (1/2,1)$. Then define the function $f^R$ as follows: $$ f^R(x):= \begin{cases} x+1/2 & x\in C \\ x-1/2 & x\in \widetilde C \\ x & \textrm{else} \\ \end{cases} $$ Hence $f^R$ is a (bijective) reordering of $f(x)=x$ on $[0,1]$ but it is disc...
1,879,028
I was wondering about the following: Lets assume that you have a function like $f(x)=x$ and you measure your function by taking an integral from $0$ to $1$, which gives you: $$ \int\_{0}^{1} x \; {\rm d}x = \frac{1}{2} $$ Ok, now let's imagine that we randomly reorder in a **unique way** the function. I mean, once yo...
2016/08/02
[ "https://math.stackexchange.com/questions/1879028", "https://math.stackexchange.com", "https://math.stackexchange.com/users/246452/" ]
To be clear, my impression is that in the main part of your question you are asking about the family $F$ of bijections $[0,1] \to [0,1]$ with the particular property that the `graph' of each function is dense in $[0,1]^2$; ie, your '$1$st intuition' point is assumed to hold. Demonstrating the existence of such function...
Though it doesn't capture *exactly* what you are talking about in your example, stochastic integrals do "measure" randomly defined functions (i.e. stochastic processes). Just to make this more precise, (I'm making no assumptions about your background so apologies for the length), let $(\Omega, \mathcal{F}, \{\mathcal...
1,879,028
I was wondering about the following: Lets assume that you have a function like $f(x)=x$ and you measure your function by taking an integral from $0$ to $1$, which gives you: $$ \int\_{0}^{1} x \; {\rm d}x = \frac{1}{2} $$ Ok, now let's imagine that we randomly reorder in a **unique way** the function. I mean, once yo...
2016/08/02
[ "https://math.stackexchange.com/questions/1879028", "https://math.stackexchange.com", "https://math.stackexchange.com/users/246452/" ]
To be clear, my impression is that in the main part of your question you are asking about the family $F$ of bijections $[0,1] \to [0,1]$ with the particular property that the `graph' of each function is dense in $[0,1]^2$; ie, your '$1$st intuition' point is assumed to hold. Demonstrating the existence of such function...
My way to read the question is about the stochastic behavior of a randomly chosen measure preserving measurable bijection with measurable inverse. It is essentially impossible to make this rigorous by a [result](https://amzn.com/0691618461) of Aumann. There is also a related "Random order impossibility principle" in...
1,879,028
I was wondering about the following: Lets assume that you have a function like $f(x)=x$ and you measure your function by taking an integral from $0$ to $1$, which gives you: $$ \int\_{0}^{1} x \; {\rm d}x = \frac{1}{2} $$ Ok, now let's imagine that we randomly reorder in a **unique way** the function. I mean, once yo...
2016/08/02
[ "https://math.stackexchange.com/questions/1879028", "https://math.stackexchange.com", "https://math.stackexchange.com/users/246452/" ]
You want to randomly choose an output (that has not yet been used) for each new input and remember it for subsequent identical queries. This is called [memoization](https://en.wikipedia.org/wiki/Memoization) in computer science. But you also want to integrate the function. This is not compatible with the above randomi...
Define $C:=(0,1/2)\cap\mathbb{Q}$ and $\widetilde C:=\{c+1/2\,|\,c\in C\}\subset (1/2,1)$. Then define the function $f^R$ as follows: $$ f^R(x):= \begin{cases} x+1/2 & x\in C \\ x-1/2 & x\in \widetilde C \\ x & \textrm{else} \\ \end{cases} $$ Hence $f^R$ is a (bijective) reordering of $f(x)=x$ on $[0,1]$ but it is disc...
1,879,028
I was wondering about the following: Lets assume that you have a function like $f(x)=x$ and you measure your function by taking an integral from $0$ to $1$, which gives you: $$ \int\_{0}^{1} x \; {\rm d}x = \frac{1}{2} $$ Ok, now let's imagine that we randomly reorder in a **unique way** the function. I mean, once yo...
2016/08/02
[ "https://math.stackexchange.com/questions/1879028", "https://math.stackexchange.com", "https://math.stackexchange.com/users/246452/" ]
You want to randomly choose an output (that has not yet been used) for each new input and remember it for subsequent identical queries. This is called [memoization](https://en.wikipedia.org/wiki/Memoization) in computer science. But you also want to integrate the function. This is not compatible with the above randomi...
Though it doesn't capture *exactly* what you are talking about in your example, stochastic integrals do "measure" randomly defined functions (i.e. stochastic processes). Just to make this more precise, (I'm making no assumptions about your background so apologies for the length), let $(\Omega, \mathcal{F}, \{\mathcal...
1,879,028
I was wondering about the following: Lets assume that you have a function like $f(x)=x$ and you measure your function by taking an integral from $0$ to $1$, which gives you: $$ \int\_{0}^{1} x \; {\rm d}x = \frac{1}{2} $$ Ok, now let's imagine that we randomly reorder in a **unique way** the function. I mean, once yo...
2016/08/02
[ "https://math.stackexchange.com/questions/1879028", "https://math.stackexchange.com", "https://math.stackexchange.com/users/246452/" ]
My way to read the question is about the stochastic behavior of a randomly chosen measure preserving measurable bijection with measurable inverse. It is essentially impossible to make this rigorous by a [result](https://amzn.com/0691618461) of Aumann. There is also a related "Random order impossibility principle" in...
Define $C:=(0,1/2)\cap\mathbb{Q}$ and $\widetilde C:=\{c+1/2\,|\,c\in C\}\subset (1/2,1)$. Then define the function $f^R$ as follows: $$ f^R(x):= \begin{cases} x+1/2 & x\in C \\ x-1/2 & x\in \widetilde C \\ x & \textrm{else} \\ \end{cases} $$ Hence $f^R$ is a (bijective) reordering of $f(x)=x$ on $[0,1]$ but it is disc...
1,879,028
I was wondering about the following: Lets assume that you have a function like $f(x)=x$ and you measure your function by taking an integral from $0$ to $1$, which gives you: $$ \int\_{0}^{1} x \; {\rm d}x = \frac{1}{2} $$ Ok, now let's imagine that we randomly reorder in a **unique way** the function. I mean, once yo...
2016/08/02
[ "https://math.stackexchange.com/questions/1879028", "https://math.stackexchange.com", "https://math.stackexchange.com/users/246452/" ]
My way to read the question is about the stochastic behavior of a randomly chosen measure preserving measurable bijection with measurable inverse. It is essentially impossible to make this rigorous by a [result](https://amzn.com/0691618461) of Aumann. There is also a related "Random order impossibility principle" in...
Though it doesn't capture *exactly* what you are talking about in your example, stochastic integrals do "measure" randomly defined functions (i.e. stochastic processes). Just to make this more precise, (I'm making no assumptions about your background so apologies for the length), let $(\Omega, \mathcal{F}, \{\mathcal...
57,314,045
I'm trying to do prediction on capacity column, however each data point consist of more data. I tried exploding the dataset and copying the capacity values to each row, but that shouldn't be the case because each row will get different capacity predicted. Is there a way to train such kind of dataset? [![enter image d...
2019/08/01
[ "https://Stackoverflow.com/questions/57314045", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8427065/" ]
You can try to look at the logs from each of the Kubernetes components. You can start with the [kube-apiserver](https://kubernetes.io/docs/reference/command-line-tools-reference/kube-apiserver/) to see what happened after the request was received. Then the [kube-scheduler](https://kubernetes.io/docs/reference/command-l...
``` kubectl get event -n name_space ``` is a good start to see what went wrong which showed me Volume mount issue An even better command to call is: ``` journalctl -u kubelet ```
56,200,950
I have followed the instructions shown on [tensorflow's website](https://www.tensorflow.org/install/gpu) to the absolute letter, yet I still get the following error when trying to import tensorflow in python: ``` Traceback (most recent call last): File "C:\Users\redacted\source\Repos\TFTest1\TFTest1\tf2-gpu\lib\site-p...
2019/05/18
[ "https://Stackoverflow.com/questions/56200950", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1073157/" ]
I was **able to solve my problem** by having the exact same setup as I described in my original post, but instead **used Python 3.6** instead of 3.7. All other variables remained the same. (Thank to Peter for helping find the answer!) I started with a fresh environment in Visual Studio 2019 and ran the following impor...
New GPU? Had the same problem couple of weeks ago. Took me hours to find the problem. Here are some ideas: As of April 2019, I solved the "DLL load failed" problem under Windows 10 / Python 3.6.x / GPU RTX 20xx by installing CUDA 10.0 (**not 10.1 or 9.x!!!**) with cuDNN 7.5.0. I also have Visual Studio 2015 installed....
443,236
I'm trying to scp a file from my local linux machine to a remote Windows machine, and I'm coming up with some inconsistencies in how scp handles Windows file paths with spaces... This works, note that spaces are properly escaped in the path to the local file: ``` scp /home/will/file\ with\ spaces.txt remote@host:D:/U...
2018/05/11
[ "https://unix.stackexchange.com/questions/443236", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/133209/" ]
I was going crazy on Windows 10 -- this worked for me ``` scp -r user@hostname:"/Library/Application' 'Support/Adobe/Common/Plug-ins/7.0/" ./Adobe ```
Your shell is seeing `Google\\ Drive`, and parsing it as `Google`, followed by a literal backslash, a space (which separates the arguments to `scp`, followed by `Drive`, and then passing that on to SCP which doesn't know what to do now that you're sending it too many arguments. To make this more clear, compare how the...
443,236
I'm trying to scp a file from my local linux machine to a remote Windows machine, and I'm coming up with some inconsistencies in how scp handles Windows file paths with spaces... This works, note that spaces are properly escaped in the path to the local file: ``` scp /home/will/file\ with\ spaces.txt remote@host:D:/U...
2018/05/11
[ "https://unix.stackexchange.com/questions/443236", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/133209/" ]
As mentioned in the question and answered [here](https://unix.stackexchange.com/a/93259/250848), **method 2** was the solution that worked in my case. Adding as an answer for convenience of later readers. * Windows 10 * Git bash `scp` **Single / Double Quotes:** `scp ./myfile.txt user@host:'"/c:/AppName/a poorly n...
Your shell is seeing `Google\\ Drive`, and parsing it as `Google`, followed by a literal backslash, a space (which separates the arguments to `scp`, followed by `Drive`, and then passing that on to SCP which doesn't know what to do now that you're sending it too many arguments. To make this more clear, compare how the...
443,236
I'm trying to scp a file from my local linux machine to a remote Windows machine, and I'm coming up with some inconsistencies in how scp handles Windows file paths with spaces... This works, note that spaces are properly escaped in the path to the local file: ``` scp /home/will/file\ with\ spaces.txt remote@host:D:/U...
2018/05/11
[ "https://unix.stackexchange.com/questions/443236", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/133209/" ]
Use the `-T` option: ``` scp -T user@remote.host:'"c:\path with\spaces in\it\foo.txt"' . ```
Your shell is seeing `Google\\ Drive`, and parsing it as `Google`, followed by a literal backslash, a space (which separates the arguments to `scp`, followed by `Drive`, and then passing that on to SCP which doesn't know what to do now that you're sending it too many arguments. To make this more clear, compare how the...
443,236
I'm trying to scp a file from my local linux machine to a remote Windows machine, and I'm coming up with some inconsistencies in how scp handles Windows file paths with spaces... This works, note that spaces are properly escaped in the path to the local file: ``` scp /home/will/file\ with\ spaces.txt remote@host:D:/U...
2018/05/11
[ "https://unix.stackexchange.com/questions/443236", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/133209/" ]
I was going crazy on Windows 10 -- this worked for me ``` scp -r user@hostname:"/Library/Application' 'Support/Adobe/Common/Plug-ins/7.0/" ./Adobe ```
Use the `-T` option: ``` scp -T user@remote.host:'"c:\path with\spaces in\it\foo.txt"' . ```
443,236
I'm trying to scp a file from my local linux machine to a remote Windows machine, and I'm coming up with some inconsistencies in how scp handles Windows file paths with spaces... This works, note that spaces are properly escaped in the path to the local file: ``` scp /home/will/file\ with\ spaces.txt remote@host:D:/U...
2018/05/11
[ "https://unix.stackexchange.com/questions/443236", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/133209/" ]
As mentioned in the question and answered [here](https://unix.stackexchange.com/a/93259/250848), **method 2** was the solution that worked in my case. Adding as an answer for convenience of later readers. * Windows 10 * Git bash `scp` **Single / Double Quotes:** `scp ./myfile.txt user@host:'"/c:/AppName/a poorly n...
Use the `-T` option: ``` scp -T user@remote.host:'"c:\path with\spaces in\it\foo.txt"' . ```
12,162,756
I have an **ASP.NET Web Forms** application. I would like to create a download link to make available to the user the possibility to download an **XML file**. However the file does not have to be stored on the server. In my **aspx** file I have the download link (placed inside a GridView): ``` <asp:HyperLinField Tex...
2012/08/28
[ "https://Stackoverflow.com/questions/12162756", "https://Stackoverflow.com", "https://Stackoverflow.com/users/675082/" ]
You don't need to create the file - you already have the XML content in your `XmlDocument`, which you can directly output to the browser. Untested example: ``` Response.ContentType = "application/xml" Response.Clear() xdoc.Save(Response.OutputStream) Response.Flush() ``` Update: To get the browser to show the *do...
It can be as simple as: ``` Private Sub SendResults() 'Write the XML for the DataSet. Page.Response.ContentType = "text/xml" Page.Response.Output.Write(xmlContentAsString) Page.Response.End() End Sub ``` Essentially, you change the response output type, and pass to the output ...
2,170,064
> > If $x=(11+11) \times (12+12) \times (13+13) \times\cdots \times > (18+18) \times (19+19)$, what will be the remainder if $x$ is divided by $100$? > > > I tried simplifying the expression like this: $$\frac{2(11)\times2(12)\times2(13)\cdots\times2(19)}{100}$$ $$\frac{2^8(19!\div10!)}{2^2\times5^2}$$ $$\frac{...
2017/03/03
[ "https://math.stackexchange.com/questions/2170064", "https://math.stackexchange.com", "https://math.stackexchange.com/users/331967/" ]
$$ x=(20+2) \times (20+4) \times (20+6) \times\cdots \times (20+16) \times (20+18) $$ After the multiplication is expanded, we get many terms. But the remainder is driven by the last two terms, namely $$ S = S\_1 + S\_2 = \left(2\cdot4\cdot\dots\cdot18\right) + \left(20\cdot2\cdot4\cdot\dots\cdot18\left(\frac12+\dots...
We need $$\prod\_{r=11}^{19}2r\pmod{100}$$ As $20|(15+15)\cdot(12+12)$ let us find $22\cdot26\cdot28\cdot32\cdot34\cdot36\cdot38\pmod5$ $22\cdot26\cdot28\cdot32\cdot34\cdot36\cdot38\equiv2\cdot1\cdot3\cdot2\cdot4\cdot1\cdot3\equiv4\pmod5$ $$\implies\prod\_{r=11}^{19}2r\equiv4\cdot(15+15)\cdot(12+12)\pmod{5\cdot20}$...
11,362,442
I want to style/mark a MenuItem in GWT MenuBar. So i have some logic that adds a style name to a menu item (the logic is working properly). ``` mItem.setStyleName("menuItemMarked", true); ``` with this set getStyleName yields "gwt-MenuItem menuItemMarked" as expected. But how to use/apply this style in css (at the ...
2012/07/06
[ "https://Stackoverflow.com/questions/11362442", "https://Stackoverflow.com", "https://Stackoverflow.com/users/447426/" ]
Where are you specifying your CSS? If your code is located within your code packages, it is likely being obfuscated by the GWT compiler. This applies to `<ui:style>` blocks in `.ui.xml` files, and `.css` files included in ClientBundles. In this case, you will want to check out [Programmatic Access to Inline Styles](h...
Make sure you specify correct selector name in your css. In this case you need to have following: ``` .gwt-MenuItem.menuItemMarked { background-color: yellow; } ``` Since `gwt-MenuItem` remains the first class name in the list it takes precedence over any styles (incl. `background-color`) defined in the subseque...
27,866,564
I want to know the difference between these two codes even though they produce the same output: CODE 1: ``` class ret { public static int add(int x) { if(x!=0) return x+add(x-1); return x; } public static void main(String args[]) { System.out.println(add(5)); } } ...
2015/01/09
[ "https://Stackoverflow.com/questions/27866564", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1613360/" ]
This is a recursive method, so when `x != 0`, you will return the result of "`x` added to calling the method again with `(x-1)`". The final call will always return `x == 0` or `constant = 0`, so you will return `15` from both versions. Single return vs. multiple return is a matter of debate. The former should be prefe...
The use of multiple `return` statement versus using a single exit point cannot be answered with an easy one-line answer. I guess the best answer you can get is "it depends on your company's standards". Single exit point is a very good standard, even though I don't personally endorse it. You end up having methods that ...
626,823
[![enter image description here](https://i.stack.imgur.com/XpsDR.png)](https://i.stack.imgur.com/XpsDR.png) [![enter image description here](https://i.stack.imgur.com/d95j6.png)](https://i.stack.imgur.com/d95j6.png) Above is quoted from [here](https://www.allaboutcircuits.com/technical-articles/low-pass-filter-a-pwm-...
2022/07/10
[ "https://electronics.stackexchange.com/questions/626823", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/311888/" ]
Because the first *is* a buck converter. Notice the **Pulse** source. The way you get that in the article they describe is through a micro-controller pin. How does that pin work? Well....it's a transistor. The top image is a buck converter with the transistor hidden in a micro-controller. The downside of it is that mi...
The reason the simpler buck converter schematic at the top (all your schematics are buck converters) is not favored over more complex synchronous designs is because, put simply, it is vastly inferior in terms of cost, size, efficiency, and capability. The lion's share of any switching converter's losses are lost entir...
19,808,956
I need to find the emails of the last person that performed an action over a post. The database structure is a little bit complicated because of several reasons not important for the case. ``` SELECT u.address FROM text t JOIN post p ON (p.pid=t.pid) JOIN node n ON (n.nid=p.nid) JOIN user u ON (t.login=u.login) W...
2013/11/06
[ "https://Stackoverflow.com/questions/19808956", "https://Stackoverflow.com", "https://Stackoverflow.com/users/658957/" ]
You can use a window function (aka "analytical" function) to calculate the max date. Then you can select all rows where the created date equals the max. date. ``` select address from ( SELECT u.address, p.created, max(p.created) over () as max_date FROM text t JOIN post p ON (p.pid=t.pid) ...
``` SELECT address FROM ( SELECT u.address, row_number() OVER (PARTITION BY n.nid ORDER BY p.created DESC) AS rn FROM text t JOIN post p ON (p.pid=t.pid) JOIN node n ON (n.nid=p.nid) JOIN user u ON (t.login=u.login) WHERE n.nid='123456' ) WHERE rn = 1; ``` The `ROW_NUMBER` function number...
200,378
Similarly to this question: > > [Convert a PDF to greyscale on the command line in FLOSS?](https://superuser.com/questions/104656/convert-a-PDF-to-greyscale-on-the-command-line-in-floss) > > > I have a PDF-document and want to convert it to pure black and white. So I want to discard halftones. To convert to grays...
2010/10/17
[ "https://superuser.com/questions/200378", "https://superuser.com", "https://superuser.com/users/5854/" ]
for gray scale PDF: By using GhostScript IN PHP code, use this script ``` exec("'gs' '-sOutputFile=outputfilename.pdf' '-sDEVICE=pdfwrite' '-sColorConversionStrategy=Gray' '-dProcessColorModel=/DeviceGray' '-dCompatibilityLevel=1.4' 'inputfilename.pdf'",$output); ``` usefull url <http://www.linuxjournal.com/co...
For pure black and white PDF, you need to convert it into ps format then into PDF for postscript: ``` exec(" gs -sDEVICE=psmono -dNOPAUSE -dBATCH -dSAFER -sOutputFile=combined.ps $pdf"); ``` postscript to PDF -> black and white ``` exec(" gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dSAFER -sOutputFile=file_pdf.pd...
200,378
Similarly to this question: > > [Convert a PDF to greyscale on the command line in FLOSS?](https://superuser.com/questions/104656/convert-a-PDF-to-greyscale-on-the-command-line-in-floss) > > > I have a PDF-document and want to convert it to pure black and white. So I want to discard halftones. To convert to grays...
2010/10/17
[ "https://superuser.com/questions/200378", "https://superuser.com", "https://superuser.com/users/5854/" ]
I am not sure if the following suggestion will work... but it may be worth to try out: 1. convert the PDF to PostScript using the simple `pdf2ps` utility 2. convert that PostScript back to PDF while using a re-defined `/setrgbcolor` PostScript operator These are the commands: First ``` pdf2ps color.pdf color.ps ...
ImageMagick can do it. ```bash convert -posterize 2 input.pdf output.pdf ``` Comes out nice & crisp, and about a 3rd the file size of the color original.
200,378
Similarly to this question: > > [Convert a PDF to greyscale on the command line in FLOSS?](https://superuser.com/questions/104656/convert-a-PDF-to-greyscale-on-the-command-line-in-floss) > > > I have a PDF-document and want to convert it to pure black and white. So I want to discard halftones. To convert to grays...
2010/10/17
[ "https://superuser.com/questions/200378", "https://superuser.com", "https://superuser.com/users/5854/" ]
It's not ghostscript, but with imagemagick this is quite simple: ``` convert -monochrome input.pdf output.pdf ```
For pure black and white PDF, you need to convert it into ps format then into PDF for postscript: ``` exec(" gs -sDEVICE=psmono -dNOPAUSE -dBATCH -dSAFER -sOutputFile=combined.ps $pdf"); ``` postscript to PDF -> black and white ``` exec(" gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dSAFER -sOutputFile=file_pdf.pd...
200,378
Similarly to this question: > > [Convert a PDF to greyscale on the command line in FLOSS?](https://superuser.com/questions/104656/convert-a-PDF-to-greyscale-on-the-command-line-in-floss) > > > I have a PDF-document and want to convert it to pure black and white. So I want to discard halftones. To convert to grays...
2010/10/17
[ "https://superuser.com/questions/200378", "https://superuser.com", "https://superuser.com/users/5854/" ]
Just wanted to chime in that this was a handy post. Been using k2pdfopt to format pdfs for kindle usage. For years used gImageReader edited the pdf with brightness and contrast and exported to a image file. The big problem was I had to manually right click for each image of the pdf which is tedious to say the least and...
ImageMagick can do it. ```bash convert -posterize 2 input.pdf output.pdf ``` Comes out nice & crisp, and about a 3rd the file size of the color original.
200,378
Similarly to this question: > > [Convert a PDF to greyscale on the command line in FLOSS?](https://superuser.com/questions/104656/convert-a-PDF-to-greyscale-on-the-command-line-in-floss) > > > I have a PDF-document and want to convert it to pure black and white. So I want to discard halftones. To convert to grays...
2010/10/17
[ "https://superuser.com/questions/200378", "https://superuser.com", "https://superuser.com/users/5854/" ]
I could not find out which procedure for color selection is used in the PDFs I am dealing with. This is why I convert to grayscale PostScript first: ``` gs -o gray.ps -sDEVICE=ps2write -sColorConversionStrategy=Gray -dProcessColorModel=/DeviceGray -dCompatibilityLevel=1.4 -f colored.pdf ``` As the PDFs I struggle to...
Just wanted to chime in that this was a handy post. Been using k2pdfopt to format pdfs for kindle usage. For years used gImageReader edited the pdf with brightness and contrast and exported to a image file. The big problem was I had to manually right click for each image of the pdf which is tedious to say the least and...
200,378
Similarly to this question: > > [Convert a PDF to greyscale on the command line in FLOSS?](https://superuser.com/questions/104656/convert-a-PDF-to-greyscale-on-the-command-line-in-floss) > > > I have a PDF-document and want to convert it to pure black and white. So I want to discard halftones. To convert to grays...
2010/10/17
[ "https://superuser.com/questions/200378", "https://superuser.com", "https://superuser.com/users/5854/" ]
The last suggestion indeed only converts to grayscale and then only works if the underlying doc uses *setrgbcolor*. This did not work for me, since I had a doc, that used *setcolor*. I had success with redefining *setcolor* to always set the color to 0,0,0: ``` gs -o <output-file.pdf> -sDEVICE=pdfwrite \ -c "/osetcol...
I could not find out which procedure for color selection is used in the PDFs I am dealing with. This is why I convert to grayscale PostScript first: ``` gs -o gray.ps -sDEVICE=ps2write -sColorConversionStrategy=Gray -dProcessColorModel=/DeviceGray -dCompatibilityLevel=1.4 -f colored.pdf ``` As the PDFs I struggle to...
200,378
Similarly to this question: > > [Convert a PDF to greyscale on the command line in FLOSS?](https://superuser.com/questions/104656/convert-a-PDF-to-greyscale-on-the-command-line-in-floss) > > > I have a PDF-document and want to convert it to pure black and white. So I want to discard halftones. To convert to grays...
2010/10/17
[ "https://superuser.com/questions/200378", "https://superuser.com", "https://superuser.com/users/5854/" ]
I could not find out which procedure for color selection is used in the PDFs I am dealing with. This is why I convert to grayscale PostScript first: ``` gs -o gray.ps -sDEVICE=ps2write -sColorConversionStrategy=Gray -dProcessColorModel=/DeviceGray -dCompatibilityLevel=1.4 -f colored.pdf ``` As the PDFs I struggle to...
for gray scale PDF: By using GhostScript IN PHP code, use this script ``` exec("'gs' '-sOutputFile=outputfilename.pdf' '-sDEVICE=pdfwrite' '-sColorConversionStrategy=Gray' '-dProcessColorModel=/DeviceGray' '-dCompatibilityLevel=1.4' 'inputfilename.pdf'",$output); ``` usefull url <http://www.linuxjournal.com/co...
200,378
Similarly to this question: > > [Convert a PDF to greyscale on the command line in FLOSS?](https://superuser.com/questions/104656/convert-a-PDF-to-greyscale-on-the-command-line-in-floss) > > > I have a PDF-document and want to convert it to pure black and white. So I want to discard halftones. To convert to grays...
2010/10/17
[ "https://superuser.com/questions/200378", "https://superuser.com", "https://superuser.com/users/5854/" ]
The last suggestion indeed only converts to grayscale and then only works if the underlying doc uses *setrgbcolor*. This did not work for me, since I had a doc, that used *setcolor*. I had success with redefining *setcolor* to always set the color to 0,0,0: ``` gs -o <output-file.pdf> -sDEVICE=pdfwrite \ -c "/osetcol...
ImageMagick can do it. ```bash convert -posterize 2 input.pdf output.pdf ``` Comes out nice & crisp, and about a 3rd the file size of the color original.
200,378
Similarly to this question: > > [Convert a PDF to greyscale on the command line in FLOSS?](https://superuser.com/questions/104656/convert-a-PDF-to-greyscale-on-the-command-line-in-floss) > > > I have a PDF-document and want to convert it to pure black and white. So I want to discard halftones. To convert to grays...
2010/10/17
[ "https://superuser.com/questions/200378", "https://superuser.com", "https://superuser.com/users/5854/" ]
It's not ghostscript, but with imagemagick this is quite simple: ``` convert -monochrome input.pdf output.pdf ```
I had to modify the solution suggested by Surge ([above](https://superuser.com/a/249038/1226308)) a little bit for my file: Step 1: Convert the coloured.pdf to coloured.ps ``` gswin64c -dNOPAUSE -dBATCH -sDEVICE=ps2write -sOutputFile=coloured.ps coloured.pdf ``` Step 2: Convert the coloured.ps to blackandwhite.pdf ...
200,378
Similarly to this question: > > [Convert a PDF to greyscale on the command line in FLOSS?](https://superuser.com/questions/104656/convert-a-PDF-to-greyscale-on-the-command-line-in-floss) > > > I have a PDF-document and want to convert it to pure black and white. So I want to discard halftones. To convert to grays...
2010/10/17
[ "https://superuser.com/questions/200378", "https://superuser.com", "https://superuser.com/users/5854/" ]
The last suggestion indeed only converts to grayscale and then only works if the underlying doc uses *setrgbcolor*. This did not work for me, since I had a doc, that used *setcolor*. I had success with redefining *setcolor* to always set the color to 0,0,0: ``` gs -o <output-file.pdf> -sDEVICE=pdfwrite \ -c "/osetcol...
I am not sure if the following suggestion will work... but it may be worth to try out: 1. convert the PDF to PostScript using the simple `pdf2ps` utility 2. convert that PostScript back to PDF while using a re-defined `/setrgbcolor` PostScript operator These are the commands: First ``` pdf2ps color.pdf color.ps ...
57,030,433
I'd like to simulate the hover of the mouse over an element using JS or any other library. I created this for the example and added some CSS to see when the `<p>` is hovered : ``` <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Hover test</title> <script src="https://ajax.googleapis....
2019/07/14
[ "https://Stackoverflow.com/questions/57030433", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11716975/" ]
Try this code: ``` function simulateMouseover() { var event = new MouseEvent('mouseover', { 'view': window, 'bubbles': true, 'cancelable': true }); var myTarget = document.querySelector('.red'); var canceled = !myTarget.dispatchEvent(event); if (canceled) { // A handler called preventDefault...
``` $("p").hover(function(){ $(this).css("background-color", "yellow"); }, function(){ $(this).css("background-color", "pink"); }); ``` jQuery can accomplish this as well. Have fun. let me know if you have questions <https://www.w3schools.com/jquery/event_hover.asp>
16,307,661
I am coming from a nhibernate background and I am wondering how can I generate the Guid automatically on the serer side and not make a round trip to make it on the database side? In fluent nhibernate it is simple just ``` Id(x => x.Id).GeneratedBy.GuidComb(); ```
2013/04/30
[ "https://Stackoverflow.com/questions/16307661", "https://Stackoverflow.com", "https://Stackoverflow.com/users/130015/" ]
If you want to generate the key on the server, simply do this in code: ``` public class TestObject { public TestObject() { Id = Guid.NewGuid(); } public Guid Id { get; set; } } ``` If you want the database to generate the key, then use the [DatabaseGenerated](http://msdn.microsoft.com/en-GB...
This code does what you need: ``` using System; using System.Runtime.InteropServices; public static class SequentialGuidProvider { [DllImport("rpcrt4.dll", SetLastError = true)] private static extern int UuidCreateSequential(out Guid guid); private static Guid CreateGuid() { Guid guid; ...
16,307,661
I am coming from a nhibernate background and I am wondering how can I generate the Guid automatically on the serer side and not make a round trip to make it on the database side? In fluent nhibernate it is simple just ``` Id(x => x.Id).GeneratedBy.GuidComb(); ```
2013/04/30
[ "https://Stackoverflow.com/questions/16307661", "https://Stackoverflow.com", "https://Stackoverflow.com/users/130015/" ]
If you want to generate the key on the server, simply do this in code: ``` public class TestObject { public TestObject() { Id = Guid.NewGuid(); } public Guid Id { get; set; } } ``` If you want the database to generate the key, then use the [DatabaseGenerated](http://msdn.microsoft.com/en-GB...
As of EF 6.1.3, database defaults [`newsequentialid()` or `newid()`] may be important when using GUID's as PK's See [entity framework use a guid as the primary key](http://www.developerhandbook.com/2014/07/13/entity-framework-use-a-guid-as-the-primary-key/).
16,307,661
I am coming from a nhibernate background and I am wondering how can I generate the Guid automatically on the serer side and not make a round trip to make it on the database side? In fluent nhibernate it is simple just ``` Id(x => x.Id).GeneratedBy.GuidComb(); ```
2013/04/30
[ "https://Stackoverflow.com/questions/16307661", "https://Stackoverflow.com", "https://Stackoverflow.com/users/130015/" ]
This code does what you need: ``` using System; using System.Runtime.InteropServices; public static class SequentialGuidProvider { [DllImport("rpcrt4.dll", SetLastError = true)] private static extern int UuidCreateSequential(out Guid guid); private static Guid CreateGuid() { Guid guid; ...
As of EF 6.1.3, database defaults [`newsequentialid()` or `newid()`] may be important when using GUID's as PK's See [entity framework use a guid as the primary key](http://www.developerhandbook.com/2014/07/13/entity-framework-use-a-guid-as-the-primary-key/).
19,064,858
How to perform validation on edittext ie I have an edittext where a name is typed and this name should be of varchar(type) of max 10 letters..
2013/09/28
[ "https://Stackoverflow.com/questions/19064858", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2814462/" ]
Why would you be using shared preferences if you want to clear them on your app launch? Shared Preferences are a way to store small preferences and read them later, for things such as settings. **You could just define static variables in your activities and read them in your other ones.** If you do want to clear the ...
clear those on app launch. same thing to me.
19,064,858
How to perform validation on edittext ie I have an edittext where a name is typed and this name should be of varchar(type) of max 10 letters..
2013/09/28
[ "https://Stackoverflow.com/questions/19064858", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2814462/" ]
Why would you be using shared preferences if you want to clear them on your app launch? Shared Preferences are a way to store small preferences and read them later, for things such as settings. **You could just define static variables in your activities and read them in your other ones.** If you do want to clear the ...
Just clear your values in onDestroy and onStop method ``` override fun onStop() { //clear data here before super super.onStop() } override fun onDestroy() { //clear data here before super super.onDestroy() } ```
19,064,858
How to perform validation on edittext ie I have an edittext where a name is typed and this name should be of varchar(type) of max 10 letters..
2013/09/28
[ "https://Stackoverflow.com/questions/19064858", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2814462/" ]
I don't know how are you setting your values into `SharedPreferences` or why are you declaring it static, as it's already called `Shared` and meant to, but what i usually do to set values is something like that : ``` Integer myValue=0;//some int value SharedPreferences sp = getApplicationContext().getSharedPreferences...
Just clear your values in onDestroy and onStop method ``` override fun onStop() { //clear data here before super super.onStop() } override fun onDestroy() { //clear data here before super super.onDestroy() } ```
19,064,858
How to perform validation on edittext ie I have an edittext where a name is typed and this name should be of varchar(type) of max 10 letters..
2013/09/28
[ "https://Stackoverflow.com/questions/19064858", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2814462/" ]
Why would you be using shared preferences if you want to clear them on your app launch? Shared Preferences are a way to store small preferences and read them later, for things such as settings. **You could just define static variables in your activities and read them in your other ones.** If you do want to clear the ...
You cannot clear `SharedPreferences` when my app is killed through `task manager`.
19,064,858
How to perform validation on edittext ie I have an edittext where a name is typed and this name should be of varchar(type) of max 10 letters..
2013/09/28
[ "https://Stackoverflow.com/questions/19064858", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2814462/" ]
clear those on app launch. same thing to me.
Just clear your values in onDestroy and onStop method ``` override fun onStop() { //clear data here before super super.onStop() } override fun onDestroy() { //clear data here before super super.onDestroy() } ```
19,064,858
How to perform validation on edittext ie I have an edittext where a name is typed and this name should be of varchar(type) of max 10 letters..
2013/09/28
[ "https://Stackoverflow.com/questions/19064858", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2814462/" ]
I don't know how are you setting your values into `SharedPreferences` or why are you declaring it static, as it's already called `Shared` and meant to, but what i usually do to set values is something like that : ``` Integer myValue=0;//some int value SharedPreferences sp = getApplicationContext().getSharedPreferences...
If the SharedPreferences Data is in a different app... i dont see how you could reach it. first of all you can solve your issue by using SQL,then you can access your DB in any activity without any issues. second if you dont want to kill variable while the program is running but kill them when its exited then just dont...
19,064,858
How to perform validation on edittext ie I have an edittext where a name is typed and this name should be of varchar(type) of max 10 letters..
2013/09/28
[ "https://Stackoverflow.com/questions/19064858", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2814462/" ]
Why would you be using shared preferences if you want to clear them on your app launch? Shared Preferences are a way to store small preferences and read them later, for things such as settings. **You could just define static variables in your activities and read them in your other ones.** If you do want to clear the ...
You cannot programatically clear the shared preferences content- You can clear your app data from the application manager which is the recommended way.
19,064,858
How to perform validation on edittext ie I have an edittext where a name is typed and this name should be of varchar(type) of max 10 letters..
2013/09/28
[ "https://Stackoverflow.com/questions/19064858", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2814462/" ]
clear those on app launch. same thing to me.
If the SharedPreferences Data is in a different app... i dont see how you could reach it. first of all you can solve your issue by using SQL,then you can access your DB in any activity without any issues. second if you dont want to kill variable while the program is running but kill them when its exited then just dont...
19,064,858
How to perform validation on edittext ie I have an edittext where a name is typed and this name should be of varchar(type) of max 10 letters..
2013/09/28
[ "https://Stackoverflow.com/questions/19064858", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2814462/" ]
Why would you be using shared preferences if you want to clear them on your app launch? Shared Preferences are a way to store small preferences and read them later, for things such as settings. **You could just define static variables in your activities and read them in your other ones.** If you do want to clear the ...
I don't know how are you setting your values into `SharedPreferences` or why are you declaring it static, as it's already called `Shared` and meant to, but what i usually do to set values is something like that : ``` Integer myValue=0;//some int value SharedPreferences sp = getApplicationContext().getSharedPreferences...
19,064,858
How to perform validation on edittext ie I have an edittext where a name is typed and this name should be of varchar(type) of max 10 letters..
2013/09/28
[ "https://Stackoverflow.com/questions/19064858", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2814462/" ]
I don't know how are you setting your values into `SharedPreferences` or why are you declaring it static, as it's already called `Shared` and meant to, but what i usually do to set values is something like that : ``` Integer myValue=0;//some int value SharedPreferences sp = getApplicationContext().getSharedPreferences...
You cannot clear `SharedPreferences` when my app is killed through `task manager`.
4,671,610
Why would anyone use `String.Format` in C# and VB .NET as opposed to the concatenation operators (`&` in VB, and `+` in C#)? What is the main difference? Why are everyone so interested in using `String.Format`? I am very curious.
2011/01/12
[ "https://Stackoverflow.com/questions/4671610", "https://Stackoverflow.com", "https://Stackoverflow.com/users/553609/" ]
Besides being a bit easier to read and adding a few more operators, it's also beneficial if your application is internationalized. A lot of times the variables are numbers or key words which will be in a different order for different languages. By using String.Format, your code can remain unchanged while different stri...
One reason it is not preferable to write the string like `'string +"Value"+ string'` is because of Localization. In cases where localization is occurring we want the localized string to be correctly formatted, which could be very different from the language being coded in. For example we need to show the following er...
4,671,610
Why would anyone use `String.Format` in C# and VB .NET as opposed to the concatenation operators (`&` in VB, and `+` in C#)? What is the main difference? Why are everyone so interested in using `String.Format`? I am very curious.
2011/01/12
[ "https://Stackoverflow.com/questions/4671610", "https://Stackoverflow.com", "https://Stackoverflow.com/users/553609/" ]
First, I find ``` string s = String.Format( "Your order {0} will be delivered on {1:yyyy-MM-dd}. Your total cost is {2:C}.", orderNumber, orderDeliveryDate, orderCost ); ``` far easier to read, write and maintain than ``` string s = "Your order " + orderNumber.ToString() + " wi...
Several reasons: 1. `String.Format()` is very powerful. You can use simple format indicators (like fixed width, currency, character lengths, etc) right in the format string. You can even create your own format providers for things like expanding enums, mapping specific inputs to much more complicated outputs, or local...
4,671,610
Why would anyone use `String.Format` in C# and VB .NET as opposed to the concatenation operators (`&` in VB, and `+` in C#)? What is the main difference? Why are everyone so interested in using `String.Format`? I am very curious.
2011/01/12
[ "https://Stackoverflow.com/questions/4671610", "https://Stackoverflow.com", "https://Stackoverflow.com/users/553609/" ]
Besides being a bit easier to read and adding a few more operators, it's also beneficial if your application is internationalized. A lot of times the variables are numbers or key words which will be in a different order for different languages. By using String.Format, your code can remain unchanged while different stri...
There's interesting stuff on the performance aspects in [this question](https://stackoverflow.com/questions/21078/whats-the-best-string-concatenation-method-using-c) However I personally would still recommend `string.Format` unless performance is critical for readability reasons. ``` string.Format("{0}: {1}", key, va...
4,671,610
Why would anyone use `String.Format` in C# and VB .NET as opposed to the concatenation operators (`&` in VB, and `+` in C#)? What is the main difference? Why are everyone so interested in using `String.Format`? I am very curious.
2011/01/12
[ "https://Stackoverflow.com/questions/4671610", "https://Stackoverflow.com", "https://Stackoverflow.com/users/553609/" ]
First, I find ``` string s = String.Format( "Your order {0} will be delivered on {1:yyyy-MM-dd}. Your total cost is {2:C}.", orderNumber, orderDeliveryDate, orderCost ); ``` far easier to read, write and maintain than ``` string s = "Your order " + orderNumber.ToString() + " wi...
[`String.Format`](http://msdn.microsoft.com/en-us/library/fht0f5be.aspx) adds many options in addition to the concatenation operators, including the ability to specify the specific format of each item added into the string. For details on what is possible, I'd recommend reading the section on MSDN titled [Composite Fo...
4,671,610
Why would anyone use `String.Format` in C# and VB .NET as opposed to the concatenation operators (`&` in VB, and `+` in C#)? What is the main difference? Why are everyone so interested in using `String.Format`? I am very curious.
2011/01/12
[ "https://Stackoverflow.com/questions/4671610", "https://Stackoverflow.com", "https://Stackoverflow.com/users/553609/" ]
Several reasons: 1. `String.Format()` is very powerful. You can use simple format indicators (like fixed width, currency, character lengths, etc) right in the format string. You can even create your own format providers for things like expanding enums, mapping specific inputs to much more complicated outputs, or local...
One reason it is not preferable to write the string like `'string +"Value"+ string'` is because of Localization. In cases where localization is occurring we want the localized string to be correctly formatted, which could be very different from the language being coded in. For example we need to show the following er...
4,671,610
Why would anyone use `String.Format` in C# and VB .NET as opposed to the concatenation operators (`&` in VB, and `+` in C#)? What is the main difference? Why are everyone so interested in using `String.Format`? I am very curious.
2011/01/12
[ "https://Stackoverflow.com/questions/4671610", "https://Stackoverflow.com", "https://Stackoverflow.com/users/553609/" ]
First, I find ``` string s = String.Format( "Your order {0} will be delivered on {1:yyyy-MM-dd}. Your total cost is {2:C}.", orderNumber, orderDeliveryDate, orderCost ); ``` far easier to read, write and maintain than ``` string s = "Your order " + orderNumber.ToString() + " wi...
One reason it is not preferable to write the string like `'string +"Value"+ string'` is because of Localization. In cases where localization is occurring we want the localized string to be correctly formatted, which could be very different from the language being coded in. For example we need to show the following er...
4,671,610
Why would anyone use `String.Format` in C# and VB .NET as opposed to the concatenation operators (`&` in VB, and `+` in C#)? What is the main difference? Why are everyone so interested in using `String.Format`? I am very curious.
2011/01/12
[ "https://Stackoverflow.com/questions/4671610", "https://Stackoverflow.com", "https://Stackoverflow.com/users/553609/" ]
I can see a number of reasons: **Readability** ``` string s = string.Format("Hey, {0} it is the {1}st day of {2}. I feel {3}!", _name, _day, _month, _feeling); ``` vs: ``` string s = "Hey," + _name + " it is the " + _day + "st day of " + _month + ". I feel " + feeling + "!"; ``` **Format Specifiers** (and this...
[`String.Format`](http://msdn.microsoft.com/en-us/library/fht0f5be.aspx) adds many options in addition to the concatenation operators, including the ability to specify the specific format of each item added into the string. For details on what is possible, I'd recommend reading the section on MSDN titled [Composite Fo...
4,671,610
Why would anyone use `String.Format` in C# and VB .NET as opposed to the concatenation operators (`&` in VB, and `+` in C#)? What is the main difference? Why are everyone so interested in using `String.Format`? I am very curious.
2011/01/12
[ "https://Stackoverflow.com/questions/4671610", "https://Stackoverflow.com", "https://Stackoverflow.com/users/553609/" ]
[`String.Format`](http://msdn.microsoft.com/en-us/library/fht0f5be.aspx) adds many options in addition to the concatenation operators, including the ability to specify the specific format of each item added into the string. For details on what is possible, I'd recommend reading the section on MSDN titled [Composite Fo...
There's interesting stuff on the performance aspects in [this question](https://stackoverflow.com/questions/21078/whats-the-best-string-concatenation-method-using-c) However I personally would still recommend `string.Format` unless performance is critical for readability reasons. ``` string.Format("{0}: {1}", key, va...
4,671,610
Why would anyone use `String.Format` in C# and VB .NET as opposed to the concatenation operators (`&` in VB, and `+` in C#)? What is the main difference? Why are everyone so interested in using `String.Format`? I am very curious.
2011/01/12
[ "https://Stackoverflow.com/questions/4671610", "https://Stackoverflow.com", "https://Stackoverflow.com/users/553609/" ]
Besides being a bit easier to read and adding a few more operators, it's also beneficial if your application is internationalized. A lot of times the variables are numbers or key words which will be in a different order for different languages. By using String.Format, your code can remain unchanged while different stri...
First, I find ``` string s = String.Format( "Your order {0} will be delivered on {1:yyyy-MM-dd}. Your total cost is {2:C}.", orderNumber, orderDeliveryDate, orderCost ); ``` far easier to read, write and maintain than ``` string s = "Your order " + orderNumber.ToString() + " wi...
4,671,610
Why would anyone use `String.Format` in C# and VB .NET as opposed to the concatenation operators (`&` in VB, and `+` in C#)? What is the main difference? Why are everyone so interested in using `String.Format`? I am very curious.
2011/01/12
[ "https://Stackoverflow.com/questions/4671610", "https://Stackoverflow.com", "https://Stackoverflow.com/users/553609/" ]
[`String.Format`](http://msdn.microsoft.com/en-us/library/fht0f5be.aspx) adds many options in addition to the concatenation operators, including the ability to specify the specific format of each item added into the string. For details on what is possible, I'd recommend reading the section on MSDN titled [Composite Fo...
One reason it is not preferable to write the string like `'string +"Value"+ string'` is because of Localization. In cases where localization is occurring we want the localized string to be correctly formatted, which could be very different from the language being coded in. For example we need to show the following er...
29,734,833
For example, if `ZZAZAAZ` is input, the sum of `A` would be `14` (since its placement is `3,5,6`), while the sum of `Z` would be `14` `(1 + 2 + 4 + 7)`. How would I do that?
2015/04/19
[ "https://Stackoverflow.com/questions/29734833", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4807840/" ]
You can use a generator expression within `sum` : ``` >>> s='ZZAZAAZ' >>> sum(i for i,j in enumerate(s,1) if j=='A') 14 ```
For all the elements in `s` you could do this. Also, it would find the counts for each element in a single pass of the string `s`, hence it's linear in the number of elements in `s`. ``` >>> s = 'ZZAZAAZ' >>> d = {} >>> for i, item in enumerate(s): ... d[item] = d.get(item, 0) + i + 1 >>> print d {'A': 14, 'Z': 14...
29,734,833
For example, if `ZZAZAAZ` is input, the sum of `A` would be `14` (since its placement is `3,5,6`), while the sum of `Z` would be `14` `(1 + 2 + 4 + 7)`. How would I do that?
2015/04/19
[ "https://Stackoverflow.com/questions/29734833", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4807840/" ]
You can use a generator expression within `sum` : ``` >>> s='ZZAZAAZ' >>> sum(i for i,j in enumerate(s,1) if j=='A') 14 ```
Furthering [Kasra's idea](https://stackoverflow.com/a/29734859/4686625) of using `enumerate`, if you wanted a dictionary containing these sums you could use a dictionary comprehension, and iterate over the set of unique characters, like so: ``` >>> s = 'ZZAZAAZ' >>> {let:sum(a for a,b in enumerate(s,1) if b==let) for...
29,734,833
For example, if `ZZAZAAZ` is input, the sum of `A` would be `14` (since its placement is `3,5,6`), while the sum of `Z` would be `14` `(1 + 2 + 4 + 7)`. How would I do that?
2015/04/19
[ "https://Stackoverflow.com/questions/29734833", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4807840/" ]
For all the elements in `s` you could do this. Also, it would find the counts for each element in a single pass of the string `s`, hence it's linear in the number of elements in `s`. ``` >>> s = 'ZZAZAAZ' >>> d = {} >>> for i, item in enumerate(s): ... d[item] = d.get(item, 0) + i + 1 >>> print d {'A': 14, 'Z': 14...
Furthering [Kasra's idea](https://stackoverflow.com/a/29734859/4686625) of using `enumerate`, if you wanted a dictionary containing these sums you could use a dictionary comprehension, and iterate over the set of unique characters, like so: ``` >>> s = 'ZZAZAAZ' >>> {let:sum(a for a,b in enumerate(s,1) if b==let) for...
59,995,248
I'm creating a python script to do I2C read and write. The script also handles test scripts (also in python) to send hardware. The test scripts previously are sent through GUI, but my script by-passes GUI usage and talks to I2C driver directly. If the test scripts are flat, no problem. However, if there's nested functi...
2020/01/30
[ "https://Stackoverflow.com/questions/59995248", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12816042/" ]
Pretty simple with Linq: ``` var newList = aList.Select(s => s.Trim()); ``` If you *need* a list just add `.ToList()` to the end. You could also overwrite the same list variable, or use a `for` loop to replace the strings in the list in-place: ``` for(int i=0; i < aList.Count; i++) { aList[i] = aList[i].Trim();...
``` aList = aList.Select(x => x.Trim()).ToList(); ```
59,995,248
I'm creating a python script to do I2C read and write. The script also handles test scripts (also in python) to send hardware. The test scripts previously are sent through GUI, but my script by-passes GUI usage and talks to I2C driver directly. If the test scripts are flat, no problem. However, if there's nested functi...
2020/01/30
[ "https://Stackoverflow.com/questions/59995248", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12816042/" ]
You can trim leading and trailing whitespace on each item by using a Linq selector: ``` var withoutWhitespace = aList.Select(item => item.Trim()).ToList(); ```
Pretty simple with Linq: ``` var newList = aList.Select(s => s.Trim()); ``` If you *need* a list just add `.ToList()` to the end. You could also overwrite the same list variable, or use a `for` loop to replace the strings in the list in-place: ``` for(int i=0; i < aList.Count; i++) { aList[i] = aList[i].Trim();...
59,995,248
I'm creating a python script to do I2C read and write. The script also handles test scripts (also in python) to send hardware. The test scripts previously are sent through GUI, but my script by-passes GUI usage and talks to I2C driver directly. If the test scripts are flat, no problem. However, if there's nested functi...
2020/01/30
[ "https://Stackoverflow.com/questions/59995248", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12816042/" ]
Pretty simple with Linq: ``` var newList = aList.Select(s => s.Trim()); ``` If you *need* a list just add `.ToList()` to the end. You could also overwrite the same list variable, or use a `for` loop to replace the strings in the list in-place: ``` for(int i=0; i < aList.Count; i++) { aList[i] = aList[i].Trim();...
Well, bellow is the simple answer: ``` var xList = aList.Select(x => x?.Trim('"').Trim()).ToList(); ``` It will remove leading and trailing whitespace inside quotes.
59,995,248
I'm creating a python script to do I2C read and write. The script also handles test scripts (also in python) to send hardware. The test scripts previously are sent through GUI, but my script by-passes GUI usage and talks to I2C driver directly. If the test scripts are flat, no problem. However, if there's nested functi...
2020/01/30
[ "https://Stackoverflow.com/questions/59995248", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12816042/" ]
``` aList.Select(x=>x.TrimStart().TrimEnd()).ToList() ```
``` aList = aList.Select(x => x.Trim()).ToList(); ```
59,995,248
I'm creating a python script to do I2C read and write. The script also handles test scripts (also in python) to send hardware. The test scripts previously are sent through GUI, but my script by-passes GUI usage and talks to I2C driver directly. If the test scripts are flat, no problem. However, if there's nested functi...
2020/01/30
[ "https://Stackoverflow.com/questions/59995248", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12816042/" ]
You can trim leading and trailing whitespace on each item by using a Linq selector: ``` var withoutWhitespace = aList.Select(item => item.Trim()).ToList(); ```
``` aList.Select(x=>x.TrimStart().TrimEnd()).ToList() ```
59,995,248
I'm creating a python script to do I2C read and write. The script also handles test scripts (also in python) to send hardware. The test scripts previously are sent through GUI, but my script by-passes GUI usage and talks to I2C driver directly. If the test scripts are flat, no problem. However, if there's nested functi...
2020/01/30
[ "https://Stackoverflow.com/questions/59995248", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12816042/" ]
``` aList.Select(x=>x.TrimStart().TrimEnd()).ToList() ```
Well, bellow is the simple answer: ``` var xList = aList.Select(x => x?.Trim('"').Trim()).ToList(); ``` It will remove leading and trailing whitespace inside quotes.
59,995,248
I'm creating a python script to do I2C read and write. The script also handles test scripts (also in python) to send hardware. The test scripts previously are sent through GUI, but my script by-passes GUI usage and talks to I2C driver directly. If the test scripts are flat, no problem. However, if there's nested functi...
2020/01/30
[ "https://Stackoverflow.com/questions/59995248", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12816042/" ]
You can trim leading and trailing whitespace on each item by using a Linq selector: ``` var withoutWhitespace = aList.Select(item => item.Trim()).ToList(); ```
``` aList = aList.Select(x => x.Trim()).ToList(); ```
59,995,248
I'm creating a python script to do I2C read and write. The script also handles test scripts (also in python) to send hardware. The test scripts previously are sent through GUI, but my script by-passes GUI usage and talks to I2C driver directly. If the test scripts are flat, no problem. However, if there's nested functi...
2020/01/30
[ "https://Stackoverflow.com/questions/59995248", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12816042/" ]
``` aList = aList.Select(x => x.Trim()).ToList(); ```
Well, bellow is the simple answer: ``` var xList = aList.Select(x => x?.Trim('"').Trim()).ToList(); ``` It will remove leading and trailing whitespace inside quotes.
59,995,248
I'm creating a python script to do I2C read and write. The script also handles test scripts (also in python) to send hardware. The test scripts previously are sent through GUI, but my script by-passes GUI usage and talks to I2C driver directly. If the test scripts are flat, no problem. However, if there's nested functi...
2020/01/30
[ "https://Stackoverflow.com/questions/59995248", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12816042/" ]
You can trim leading and trailing whitespace on each item by using a Linq selector: ``` var withoutWhitespace = aList.Select(item => item.Trim()).ToList(); ```
Well, bellow is the simple answer: ``` var xList = aList.Select(x => x?.Trim('"').Trim()).ToList(); ``` It will remove leading and trailing whitespace inside quotes.
41,871,756
I try to make a script that reduces the size of images in a folder. But I have always a error message. I must reduce the size in the same folder and subfolders Can you help to build my script please? Thank you in advance. Here is the script : ``` $source = "U:\TEST\Compression\images" $exclude_list = "(Imprimerie|...
2017/01/26
[ "https://Stackoverflow.com/questions/41871756", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7473265/" ]
You are using (I assume) the [Resize-Image](https://gallery.technet.microsoft.com/scriptcenter/Resize-Image-A-PowerShell-3d26ef68) module. The reported problem is that the path's file format is not supported. Without further data, I assume that you're passing a full object to the OutputFile. To fix this, try specify...
Use $source\_photos.fullname i.e. ``` ... Resize-Image -InputFile $($source_photos.fullname) -Scale .... ```
51,732,775
I have a couple of checkboxes. When I check one, the other unchecks. Every time this action happens there is a function that checks if the length of the checkboxes is equal to one. The expected behavior is: if it's equal to one, the function must continue, if not, it must wait until it is. The thing is that the che...
2018/08/07
[ "https://Stackoverflow.com/questions/51732775", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9699805/" ]
As I commented - you don't need to "wait" until the condition is true (that exactly one checkbox is checked). You can test that condition each time the state of any checkbox is changed. This snippet demonstrates doing that - verbosely telling you in the console what's going on. You will see it say *"Run the rest of th...
So your problem is basically that your function is returning before all the data has arrived that you want to evaluate. You can wait for a result by employing a timer structure. ``` function unchecking(){ $('.checkbox').on('change', function() { $('.checkbox').not(this).prop('checked', false); }); ...
920,605
I want to prove that $x^2+y^2+xy\ge 0$ for all $x,y\in \mathbb{R}$. My "proof": Suppose wlog that $x\ge y$, so $x^2\cdot x\ge x^2\cdot y\ge y^2\cdot y=y^3$ (because $x^2\ge 0$ so we can multiply both sides by it without changing the inequality sign) giving $x^3\ge y^3$. Substracting we have $x^3-y^3\ge 0$ or $(x-y)(x^...
2014/09/05
[ "https://math.stackexchange.com/questions/920605", "https://math.stackexchange.com", "https://math.stackexchange.com/users/47912/" ]
$(x+y)^2 \geq xy$ If one of $x, y$ is negative, this is obvious due to sign. Otherwise, WLOG, assume both $x$ and $y$ are positive. Since $x+y \geq x$ and $x+y \geq y$, then $(x+y)^2 \geq xy$.
$\newcommand{\angles}[1]{\left\langle\, #1 \,\right\rangle} \newcommand{\braces}[1]{\left\lbrace\, #1 \,\right\rbrace} \newcommand{\bracks}[1]{\left\lbrack\, #1 \,\right\rbrack} \newcommand{\ceil}[1]{\,\left\lceil\, #1 \,\right\rceil\,} \newcommand{\dd}{{\rm d}} \newcommand{\ds}[1]{\displaystyle{#1}} \newcommand{...
920,605
I want to prove that $x^2+y^2+xy\ge 0$ for all $x,y\in \mathbb{R}$. My "proof": Suppose wlog that $x\ge y$, so $x^2\cdot x\ge x^2\cdot y\ge y^2\cdot y=y^3$ (because $x^2\ge 0$ so we can multiply both sides by it without changing the inequality sign) giving $x^3\ge y^3$. Substracting we have $x^3-y^3\ge 0$ or $(x-y)(x^...
2014/09/05
[ "https://math.stackexchange.com/questions/920605", "https://math.stackexchange.com", "https://math.stackexchange.com/users/47912/" ]
Another approach: note that $-2|xy| \leq xy \leq 2|xy|$, so we have $$x^2 - 2|xy| + y^2 \leq x^2 + xy + y^2 \leq x^2 + 2|xy| + y^2$$ or equivalently, $$(|x|-|y|)^2 \leq x^2 + xy + y^2 \leq (|x| + |y|)^2$$ Since the left hand side is nonnegative, the result follows.
A homogeneous bivariate second-degree polynomial with a negative discriminant can be only everywhere non-negative or everywhere non-positive over $\mathbb{R}^2$. Since in $(x,y)=(1,1)$ the inequality holds as $\geq$, for every $(x,y)\in\mathbb{R}^2$ we have $x^2+xy+y^2\geq 0$.
920,605
I want to prove that $x^2+y^2+xy\ge 0$ for all $x,y\in \mathbb{R}$. My "proof": Suppose wlog that $x\ge y$, so $x^2\cdot x\ge x^2\cdot y\ge y^2\cdot y=y^3$ (because $x^2\ge 0$ so we can multiply both sides by it without changing the inequality sign) giving $x^3\ge y^3$. Substracting we have $x^3-y^3\ge 0$ or $(x-y)(x^...
2014/09/05
[ "https://math.stackexchange.com/questions/920605", "https://math.stackexchange.com", "https://math.stackexchange.com/users/47912/" ]
Note that we can prove it by $$x^2+y^2+xy=\left(x+\frac y2\right)^2+\frac{3}{4}y^2\ge 0.$$
$\newcommand{\angles}[1]{\left\langle\, #1 \,\right\rangle} \newcommand{\braces}[1]{\left\lbrace\, #1 \,\right\rbrace} \newcommand{\bracks}[1]{\left\lbrack\, #1 \,\right\rbrack} \newcommand{\ceil}[1]{\,\left\lceil\, #1 \,\right\rceil\,} \newcommand{\dd}{{\rm d}} \newcommand{\ds}[1]{\displaystyle{#1}} \newcommand{...
920,605
I want to prove that $x^2+y^2+xy\ge 0$ for all $x,y\in \mathbb{R}$. My "proof": Suppose wlog that $x\ge y$, so $x^2\cdot x\ge x^2\cdot y\ge y^2\cdot y=y^3$ (because $x^2\ge 0$ so we can multiply both sides by it without changing the inequality sign) giving $x^3\ge y^3$. Substracting we have $x^3-y^3\ge 0$ or $(x-y)(x^...
2014/09/05
[ "https://math.stackexchange.com/questions/920605", "https://math.stackexchange.com", "https://math.stackexchange.com/users/47912/" ]
A homogeneous bivariate second-degree polynomial with a negative discriminant can be only everywhere non-negative or everywhere non-positive over $\mathbb{R}^2$. Since in $(x,y)=(1,1)$ the inequality holds as $\geq$, for every $(x,y)\in\mathbb{R}^2$ we have $x^2+xy+y^2\geq 0$.
$\newcommand{\angles}[1]{\left\langle\, #1 \,\right\rangle} \newcommand{\braces}[1]{\left\lbrace\, #1 \,\right\rbrace} \newcommand{\bracks}[1]{\left\lbrack\, #1 \,\right\rbrack} \newcommand{\ceil}[1]{\,\left\lceil\, #1 \,\right\rceil\,} \newcommand{\dd}{{\rm d}} \newcommand{\ds}[1]{\displaystyle{#1}} \newcommand{...
920,605
I want to prove that $x^2+y^2+xy\ge 0$ for all $x,y\in \mathbb{R}$. My "proof": Suppose wlog that $x\ge y$, so $x^2\cdot x\ge x^2\cdot y\ge y^2\cdot y=y^3$ (because $x^2\ge 0$ so we can multiply both sides by it without changing the inequality sign) giving $x^3\ge y^3$. Substracting we have $x^3-y^3\ge 0$ or $(x-y)(x^...
2014/09/05
[ "https://math.stackexchange.com/questions/920605", "https://math.stackexchange.com", "https://math.stackexchange.com/users/47912/" ]
My more logical, less formulaic proof: (its a bit long, but it covers all cases) If x and y are both positive, all parts are positive If one is positive and one is zero, all parts are positive, or zero (nothing negative) If both are zero, all parts are zero, and it is not negative. If both are negative, all of the ...
$\newcommand{\angles}[1]{\left\langle\, #1 \,\right\rangle} \newcommand{\braces}[1]{\left\lbrace\, #1 \,\right\rbrace} \newcommand{\bracks}[1]{\left\lbrack\, #1 \,\right\rbrack} \newcommand{\ceil}[1]{\,\left\lceil\, #1 \,\right\rceil\,} \newcommand{\dd}{{\rm d}} \newcommand{\ds}[1]{\displaystyle{#1}} \newcommand{...
920,605
I want to prove that $x^2+y^2+xy\ge 0$ for all $x,y\in \mathbb{R}$. My "proof": Suppose wlog that $x\ge y$, so $x^2\cdot x\ge x^2\cdot y\ge y^2\cdot y=y^3$ (because $x^2\ge 0$ so we can multiply both sides by it without changing the inequality sign) giving $x^3\ge y^3$. Substracting we have $x^3-y^3\ge 0$ or $(x-y)(x^...
2014/09/05
[ "https://math.stackexchange.com/questions/920605", "https://math.stackexchange.com", "https://math.stackexchange.com/users/47912/" ]
Another approach: note that $-2|xy| \leq xy \leq 2|xy|$, so we have $$x^2 - 2|xy| + y^2 \leq x^2 + xy + y^2 \leq x^2 + 2|xy| + y^2$$ or equivalently, $$(|x|-|y|)^2 \leq x^2 + xy + y^2 \leq (|x| + |y|)^2$$ Since the left hand side is nonnegative, the result follows.
$\newcommand{\angles}[1]{\left\langle\, #1 \,\right\rangle} \newcommand{\braces}[1]{\left\lbrace\, #1 \,\right\rbrace} \newcommand{\bracks}[1]{\left\lbrack\, #1 \,\right\rbrack} \newcommand{\ceil}[1]{\,\left\lceil\, #1 \,\right\rceil\,} \newcommand{\dd}{{\rm d}} \newcommand{\ds}[1]{\displaystyle{#1}} \newcommand{...
920,605
I want to prove that $x^2+y^2+xy\ge 0$ for all $x,y\in \mathbb{R}$. My "proof": Suppose wlog that $x\ge y$, so $x^2\cdot x\ge x^2\cdot y\ge y^2\cdot y=y^3$ (because $x^2\ge 0$ so we can multiply both sides by it without changing the inequality sign) giving $x^3\ge y^3$. Substracting we have $x^3-y^3\ge 0$ or $(x-y)(x^...
2014/09/05
[ "https://math.stackexchange.com/questions/920605", "https://math.stackexchange.com", "https://math.stackexchange.com/users/47912/" ]
Note that we can prove it by $$x^2+y^2+xy=\left(x+\frac y2\right)^2+\frac{3}{4}y^2\ge 0.$$
The question posed was whether the OP's proof is correct. Mark Bennet pointed out one flaw in comments, namely that you can't divide by $x-y$ if $x=y$. It's worth noting another problem with the proof: You can indeed suppose wlog that $x\ge y$, from which $x^2\cdot x\ge x^2\cdot y$ follows (because $x^2\ge0$), but the ...
920,605
I want to prove that $x^2+y^2+xy\ge 0$ for all $x,y\in \mathbb{R}$. My "proof": Suppose wlog that $x\ge y$, so $x^2\cdot x\ge x^2\cdot y\ge y^2\cdot y=y^3$ (because $x^2\ge 0$ so we can multiply both sides by it without changing the inequality sign) giving $x^3\ge y^3$. Substracting we have $x^3-y^3\ge 0$ or $(x-y)(x^...
2014/09/05
[ "https://math.stackexchange.com/questions/920605", "https://math.stackexchange.com", "https://math.stackexchange.com/users/47912/" ]
$(x+y)^2 \geq xy$ If one of $x, y$ is negative, this is obvious due to sign. Otherwise, WLOG, assume both $x$ and $y$ are positive. Since $x+y \geq x$ and $x+y \geq y$, then $(x+y)^2 \geq xy$.
A homogeneous bivariate second-degree polynomial with a negative discriminant can be only everywhere non-negative or everywhere non-positive over $\mathbb{R}^2$. Since in $(x,y)=(1,1)$ the inequality holds as $\geq$, for every $(x,y)\in\mathbb{R}^2$ we have $x^2+xy+y^2\geq 0$.
920,605
I want to prove that $x^2+y^2+xy\ge 0$ for all $x,y\in \mathbb{R}$. My "proof": Suppose wlog that $x\ge y$, so $x^2\cdot x\ge x^2\cdot y\ge y^2\cdot y=y^3$ (because $x^2\ge 0$ so we can multiply both sides by it without changing the inequality sign) giving $x^3\ge y^3$. Substracting we have $x^3-y^3\ge 0$ or $(x-y)(x^...
2014/09/05
[ "https://math.stackexchange.com/questions/920605", "https://math.stackexchange.com", "https://math.stackexchange.com/users/47912/" ]
One (simple) way: let t = x2 + y2 + xy then t - xy ≥ 0 since it is the sum of two real squares x2 + y2 and t + xy ≥ 0 since it is the square of the real (x + y) [since (x + y)2 = x2 + y2 + 2xy] adding these, we get 2t ≥ 0, therefore t ≥ 0
$\newcommand{\angles}[1]{\left\langle\, #1 \,\right\rangle} \newcommand{\braces}[1]{\left\lbrace\, #1 \,\right\rbrace} \newcommand{\bracks}[1]{\left\lbrack\, #1 \,\right\rbrack} \newcommand{\ceil}[1]{\,\left\lceil\, #1 \,\right\rceil\,} \newcommand{\dd}{{\rm d}} \newcommand{\ds}[1]{\displaystyle{#1}} \newcommand{...
920,605
I want to prove that $x^2+y^2+xy\ge 0$ for all $x,y\in \mathbb{R}$. My "proof": Suppose wlog that $x\ge y$, so $x^2\cdot x\ge x^2\cdot y\ge y^2\cdot y=y^3$ (because $x^2\ge 0$ so we can multiply both sides by it without changing the inequality sign) giving $x^3\ge y^3$. Substracting we have $x^3-y^3\ge 0$ or $(x-y)(x^...
2014/09/05
[ "https://math.stackexchange.com/questions/920605", "https://math.stackexchange.com", "https://math.stackexchange.com/users/47912/" ]
The question posed was whether the OP's proof is correct. Mark Bennet pointed out one flaw in comments, namely that you can't divide by $x-y$ if $x=y$. It's worth noting another problem with the proof: You can indeed suppose wlog that $x\ge y$, from which $x^2\cdot x\ge x^2\cdot y$ follows (because $x^2\ge0$), but the ...
$\newcommand{\angles}[1]{\left\langle\, #1 \,\right\rangle} \newcommand{\braces}[1]{\left\lbrace\, #1 \,\right\rbrace} \newcommand{\bracks}[1]{\left\lbrack\, #1 \,\right\rbrack} \newcommand{\ceil}[1]{\,\left\lceil\, #1 \,\right\rceil\,} \newcommand{\dd}{{\rm d}} \newcommand{\ds}[1]{\displaystyle{#1}} \newcommand{...
37,718,652
I am running this script: ``` function insertformat(formats){ //Deletes the content of the dropdown if there was any document.getElementById('format').options.length = 50; //fills the dropdown with an associative array for (var key in formats) var newOption = "<option value='"+key+"'>"+form...
2016/06/09
[ "https://Stackoverflow.com/questions/37718652", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4485955/" ]
Currently the `appned` code is not `inside loop` so only `last value` is added to the dropdown. Change your loop like this. ``` for (var key in formats) { var newOption = "<option value='"+key+"'>"+formats[key]+"</option>"; $("#format").append(newOption); } ```
Use this code ``` function insertformat(formats){ //Deletes the content of the dropdown if there was any document.getElementById('format').options.length = 50; //fills the dropdown with an associative array for (var key in formats){ var newOption = "<option value='"+key+"'>"+for...
365,463
I have read that when you press `Ctrl`+`C` a `SIGINT` signal will be sent to the *foreground process group*. Can you give me an example of how I can have two or more processes in the *foreground process group*, because I want to see if all processes will terminate if I press `Ctrl`+`C`.
2017/05/16
[ "https://unix.stackexchange.com/questions/365463", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/228808/" ]
Since [new processes all belong to the same process group](https://unix.stackexchange.com/questions/363126/why-is-process-not-part-of-expected-process-group), that of the parent process, have a process start a bunch of processes (`fork`), and then with appropriate logging and a delay, type `Ctrl`+`C`. They all eat a `S...
A [pipeline is one job](http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_202), with multiple processes: ``` (cat ; echo foo >&2) | (cat ; echo bar >&2 ) ``` If you end the input with `Ctrl`+`D`, you get the `foo` and `bar` output, if you kill the pipeline with `Ctrl`+`C`, neither is pri...
365,463
I have read that when you press `Ctrl`+`C` a `SIGINT` signal will be sent to the *foreground process group*. Can you give me an example of how I can have two or more processes in the *foreground process group*, because I want to see if all processes will terminate if I press `Ctrl`+`C`.
2017/05/16
[ "https://unix.stackexchange.com/questions/365463", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/228808/" ]
A [pipeline is one job](http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_202), with multiple processes: ``` (cat ; echo foo >&2) | (cat ; echo bar >&2 ) ``` If you end the input with `Ctrl`+`D`, you get the `foo` and `bar` output, if you kill the pipeline with `Ctrl`+`C`, neither is pri...
One example: ``` bash-4.3$ ( ( sleep 2 & (ps -Hfj | sh -c cat; perl -MPOSIX -E 'say tcgetpgrp 0'; sleep 5;:);:);:) UID PID PPID PGID SID C STIME TTY TIME CMD chazelas 18631 3848 18631 18631 0 12:51 pts/7 00:00:00 /bin/zsh chazelas 2184 18631 2184 18631 0 21:00 pts/7 00:00:00 bash --no...
365,463
I have read that when you press `Ctrl`+`C` a `SIGINT` signal will be sent to the *foreground process group*. Can you give me an example of how I can have two or more processes in the *foreground process group*, because I want to see if all processes will terminate if I press `Ctrl`+`C`.
2017/05/16
[ "https://unix.stackexchange.com/questions/365463", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/228808/" ]
Since [new processes all belong to the same process group](https://unix.stackexchange.com/questions/363126/why-is-process-not-part-of-expected-process-group), that of the parent process, have a process start a bunch of processes (`fork`), and then with appropriate logging and a delay, type `Ctrl`+`C`. They all eat a `S...
One example: ``` bash-4.3$ ( ( sleep 2 & (ps -Hfj | sh -c cat; perl -MPOSIX -E 'say tcgetpgrp 0'; sleep 5;:);:);:) UID PID PPID PGID SID C STIME TTY TIME CMD chazelas 18631 3848 18631 18631 0 12:51 pts/7 00:00:00 /bin/zsh chazelas 2184 18631 2184 18631 0 21:00 pts/7 00:00:00 bash --no...
35,716,590
I am trying to make a custom right click command for nautilus. I managed to find a useful content [here](https://askubuntu.com/questions/186509/how-do-i-make-a-custom-right-click-command-for-nautilus/186513). What I don't understand is what does these two lines essentially mean ? ``` IFS_BAK=$IFS IFS=" " ``` And t...
2016/03/01
[ "https://Stackoverflow.com/questions/35716590", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5255935/" ]
`IFS_BAK` is essentially creating a backup of existing value of `IFS` variable. The next line then assigns a new value to `IFS` i.e specific/required the script. More info on Internal Field Separator (IFS) can be found here: <https://unix.stackexchange.com/questions/16192/what-is-ifs-in-context-of-for-looping> ...
Okay, I got it. It is called an 'Internal Field Separator', a special variable in shell. If you set IFS to | (i.e. IFS=| ), | will be treated as delimiters between words/fields when splitting a line of input. In the first line: ``` IFS_BAK=$IFS ``` the initial 'IFS' value is stored in the variable 'IFS\_BAK' and ...
64,561,882
How would I parse newlines using the Rply module in python? I'm making a programming language, and am parsing the following statement: ``` print("hi"); print("hi"); ``` But I get the following error: ```py PS E:\ParserAndLexer> & C:/Python38/python.exe e:/ParserAndLexer/lite/main.py e:\ParserAndLexer\lite\main_pars...
2020/10/27
[ "https://Stackoverflow.com/questions/64561882", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13744661/" ]
There are *two* loops, and the inner one never terminates (since you never update `game_won`, so you never move on to the second iteration of the outer loop.
You have two indefinite loops. The inner loop that terminates on predicate; `not game_won` the logic in the inner loop continues indefinitely without returning to the outer context because at no point within the loop do you set `game_won=True`. ``` def a(): try: if 3> 0: print("This space ...
64,561,882
How would I parse newlines using the Rply module in python? I'm making a programming language, and am parsing the following statement: ``` print("hi"); print("hi"); ``` But I get the following error: ```py PS E:\ParserAndLexer> & C:/Python38/python.exe e:/ParserAndLexer/lite/main.py e:\ParserAndLexer\lite\main_pars...
2020/10/27
[ "https://Stackoverflow.com/questions/64561882", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13744661/" ]
There are *two* loops, and the inner one never terminates (since you never update `game_won`, so you never move on to the second iteration of the outer loop.
first the while play loop will start and it will go on until while not game\_won loop and since not game\_won is True it will start that loop and wont go out until not game\_won is False
64,561,882
How would I parse newlines using the Rply module in python? I'm making a programming language, and am parsing the following statement: ``` print("hi"); print("hi"); ``` But I get the following error: ```py PS E:\ParserAndLexer> & C:/Python38/python.exe e:/ParserAndLexer/lite/main.py e:\ParserAndLexer\lite\main_pars...
2020/10/27
[ "https://Stackoverflow.com/questions/64561882", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13744661/" ]
There are *two* loops, and the inner one never terminates (since you never update `game_won`, so you never move on to the second iteration of the outer loop.
``` def a(): try: if 3> 0: print("This space is occupied, try another!") return false print(" 0 1 2") except IndexError: # You never reach this point because 3 > 0: is the same as just putting if 1==1 it always reads as a true statement p...