qid int64 1 74.7M | question stringlengths 0 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 2 48.3k | response_k stringlengths 2 40.5k |
|---|---|---|---|---|---|
1,360,248 | I'm trying to get Windows 10 to emulate the new "Digital Wellbeing" feature that Google released alongside Android 9. Basically it changes the screen to grey-scale at night-time to try and incentivize people to get off their phone and go to sleep.
When I learned of Windows 10's "color filter" feature (which also allow... | 2018/09/21 | [
"https://superuser.com/questions/1360248",
"https://superuser.com",
"https://superuser.com/users/927750/"
] | I had exactly the same need. I used [AutoHotKey](https://www.autohotkey.com/) for this. This script checks every 10 min. If the time between 10:30 - 10:39 pm, it presses `Win`+`Ctrl`+`C`.
```
#Persistent
SetTimer, ToggleGreyscaleFilter, 600000 ; Check every 10 min
ToggleGreyscaleFilter:
TheTime = %A_Hour%%A_Min%
I... | For those who looking for simple solution on Windows:
You may use [WinMagnification](https://pypi.org/project/WinMagnification/) Python 3.8+ lib.
It supports a grayscale color effect, and also you can animate transition with it (by changing effect power over time).
```
import win_magnification as mag
mag_api = mag.Wi... |
22,467,142 | I am relatively new to T4 templates. I am working in visual studio 2012 and using the tangible T4 editor. I have my text templates in one project and I want to read a class in another project and do some processing and write the generated code to a third project. I want to pass in the class file path to my template For... | 2014/03/17 | [
"https://Stackoverflow.com/questions/22467142",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1527762/"
] | In the form action, you are directing to **<https://www.paypal.com/cgi-bin/webscr>**
But In the IPN code your
```
$ch = curl_init('https://www.sandbox.paypal.com/cgi-bin/webscr');
```
So one points to the sandbox, but not the other. That should be the problem. | The problem is in your IPN handler, not in this code. It should be obvious that this code must work, otherwise no IPN would have happened at all. You need to post the *relevant* code. Probably you haven't built the validation callback URL correctly, or you aren't sending it to the right URL (sandbox or live). |
18,553,214 | I can't figure out what the 'bytes' method is complaining about. In the code below, i am trying to generate an authentication key for my client and i keep getting this error [1]
```
import hmac
import hashlib
import base64
message = bytes("Message", 'utf-8') # errors here
secret = bytes("secret", 'utf-8')
signature ... | 2013/08/31 | [
"https://Stackoverflow.com/questions/18553214",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/643954/"
] | `bytes()` in Python 2.x is the same as `str()` and it accepts only one string argument.
Use just `message = "Message"` and `secret = "secret"`. You don't even need `bytes()` here. | try,
```
import hmac
import hashlib
import base64
message = bytes("Message")
secret = bytes("secret")
signature = base64.b64encode(hmac.new(secret, message, digestmod=hashlib.sha256).digest())
print(signature)
``` |
18,553,214 | I can't figure out what the 'bytes' method is complaining about. In the code below, i am trying to generate an authentication key for my client and i keep getting this error [1]
```
import hmac
import hashlib
import base64
message = bytes("Message", 'utf-8') # errors here
secret = bytes("secret", 'utf-8')
signature ... | 2013/08/31 | [
"https://Stackoverflow.com/questions/18553214",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/643954/"
] | The likely reason you encountered this problem is the code you were using was written for Python 3.x and you executed it under Python 2.x.
*I know someone has already partially stated this, but I thought it might be helpful to make it clearer to people new to Python who may not realize why the 'utf-8' argument was bei... | try,
```
import hmac
import hashlib
import base64
message = bytes("Message")
secret = bytes("secret")
signature = base64.b64encode(hmac.new(secret, message, digestmod=hashlib.sha256).digest())
print(signature)
``` |
18,553,214 | I can't figure out what the 'bytes' method is complaining about. In the code below, i am trying to generate an authentication key for my client and i keep getting this error [1]
```
import hmac
import hashlib
import base64
message = bytes("Message", 'utf-8') # errors here
secret = bytes("secret", 'utf-8')
signature ... | 2013/08/31 | [
"https://Stackoverflow.com/questions/18553214",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/643954/"
] | `bytes()` in Python 2.x is the same as `str()` and it accepts only one string argument.
Use just `message = "Message"` and `secret = "secret"`. You don't even need `bytes()` here. | The likely reason you encountered this problem is the code you were using was written for Python 3.x and you executed it under Python 2.x.
*I know someone has already partially stated this, but I thought it might be helpful to make it clearer to people new to Python who may not realize why the 'utf-8' argument was bei... |
16,766,490 | please help me for my coding. I want to make a program like this. sorry bad english.
Given input:
```
N
where N is an integer.
```
return:
```
True if N = 2^x, where x is an integer.
```
I've tried to do this but it doesn't work as i want.
```
using namespace std;
int main()
{
float a,b,c;
cin>>a... | 2013/05/27 | [
"https://Stackoverflow.com/questions/16766490",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2423694/"
] | As [What Every Computer Scientist Should Know About Floating-Point Arithmetic](http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html) explains, floating point numbers in computer programs pretend they can represent any real number, but actually have only 32 or 64 bits, so you will get rounded off to the neares... | Declare the values a,b,c as double if you want to use this
c=log10(a)/log10(2.0);
Declare the values a,b,c as float if u want to use this
c=log10(a)/log10(2.0f);
I executed the program with both these changes ,one by one .Its working for both
check the syntax and example [here](http://www.cplusplus.com/reference/cm... |
16,766,490 | please help me for my coding. I want to make a program like this. sorry bad english.
Given input:
```
N
where N is an integer.
```
return:
```
True if N = 2^x, where x is an integer.
```
I've tried to do this but it doesn't work as i want.
```
using namespace std;
int main()
{
float a,b,c;
cin>>a... | 2013/05/27 | [
"https://Stackoverflow.com/questions/16766490",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2423694/"
] | As [What Every Computer Scientist Should Know About Floating-Point Arithmetic](http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html) explains, floating point numbers in computer programs pretend they can represent any real number, but actually have only 32 or 64 bits, so you will get rounded off to the neares... | I think the code should read (given the problem description.) You want to know if N is a power of 2?
**Edit to code**
```
#include <iostream>
int main()
{
unsigned int N;
std::cout << "Input a number ";
std::cin >> N;
unsigned int two_to_the_power_of_bit = 0;
do {
std::cout << "Working on... |
475,162 | I'm trying without any luck to use [**NTSysLog**](http://troy.jdmz.net/syslogwin/) in order to grab my network computers *Security Logs* and send them into a Log Service ([**Loggly**](http://loggly.com/) in this case).
I can install and run NTSysLog from a Windows 7 Professional machine
![enter image description her... | 2013/02/04 | [
"https://serverfault.com/questions/475162",
"https://serverfault.com",
"https://serverfault.com/users/711/"
] | You can't install a certificate on a machine unless the corresponding private key is already installed. Even if you could, what would the point be? A certificate binds a key to an identity. Without the key, the certificate is useless. (The certificate is public. The key is private.)
Likely the server it worked on has ... | mmc is not very user friendly with the snap in module etc. If you going to do operations like exporting and reimporting certs on IIS like David suggested you may want to look at other more user friendly tools like [SSLTools Manager](http://www.ssltools.com/manager) |
7,746,016 | I've been trying to make an icon that has transparency. I've tried Axialis but the documentation is crummy and the ui is somewhat inscrutable. Everytime I think I've figured out how to set transparency, it's coming in with white space.
MS documenation mentions using magenta as the background, so I also tried that and g... | 2011/10/12 | [
"https://Stackoverflow.com/questions/7746016",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/992205/"
] | Just use GIMP (<http://www.gimp.org/>). Start off with a transparent background and the size you would like. I use it for all my Android applications. | Try Evan Old's plugin for Paint.NET. YMMV.
<http://forums.getpaint.net/index.php?/topic/927-icon-cursor-and-animated-cursor-format-v37-may-2010/page-1> |
11,600,301 | I have code which is roughly as follows (I removed some parts, as they are irrelevant):
```
Library.focus = function(event) {
var element, paragraph;
element = event.srcElement;
paragraph = document.createElement("p");
paragraph.innerText = element.innerText;
element.parentNode.insertBefore(para... | 2012/07/22 | [
"https://Stackoverflow.com/questions/11600301",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/697108/"
] | From [mdn docs](https://developer.mozilla.org/En/DOM/Node.removeChild):
>
> If child is actually not a child of the element node, the method
> throws an exception. This will also happen if child was in fact a
> child of element at the time of the call, but was removed by an event
> handler invoked in the course of... | Dont pass the event as parameter for Library.focus function. it will work.
```
Library.focus = function() {
var element, paragraph;
element = event.srcElement;
paragraph = document.createElement("p");
paragraph.innerText = element.innerText;
element.parentNode.insertBefore(paragraph, element); ... |
11,600,301 | I have code which is roughly as follows (I removed some parts, as they are irrelevant):
```
Library.focus = function(event) {
var element, paragraph;
element = event.srcElement;
paragraph = document.createElement("p");
paragraph.innerText = element.innerText;
element.parentNode.insertBefore(para... | 2012/07/22 | [
"https://Stackoverflow.com/questions/11600301",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/697108/"
] | If you're trying to modify, in an onblur handler, the same node you're trying to remove in another handler (eg onfocus, keydown etc) then the first call to `removeChild` will fire the onblur handler before actually removing the node.
If the onblur handler then modifies the node so that its parent changes, control will... | Dont pass the event as parameter for Library.focus function. it will work.
```
Library.focus = function() {
var element, paragraph;
element = event.srcElement;
paragraph = document.createElement("p");
paragraph.innerText = element.innerText;
element.parentNode.insertBefore(paragraph, element); ... |
11,600,301 | I have code which is roughly as follows (I removed some parts, as they are irrelevant):
```
Library.focus = function(event) {
var element, paragraph;
element = event.srcElement;
paragraph = document.createElement("p");
paragraph.innerText = element.innerText;
element.parentNode.insertBefore(para... | 2012/07/22 | [
"https://Stackoverflow.com/questions/11600301",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/697108/"
] | From [mdn docs](https://developer.mozilla.org/En/DOM/Node.removeChild):
>
> If child is actually not a child of the element node, the method
> throws an exception. This will also happen if child was in fact a
> child of element at the time of the call, but was removed by an event
> handler invoked in the course of... | If you're trying to modify, in an onblur handler, the same node you're trying to remove in another handler (eg onfocus, keydown etc) then the first call to `removeChild` will fire the onblur handler before actually removing the node.
If the onblur handler then modifies the node so that its parent changes, control will... |
38,530,983 | Is it possible to loop a json object one by one ?
let's say I have this object (text). I want to loop on `text` and get **next** item every 1 minute until I get them all. How can I do this in javascript ?
```
var text =
{
"name":"John Johnson",
"street":"Oslo West 16",
"determine"... | 2016/07/22 | [
"https://Stackoverflow.com/questions/38530983",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6608257/"
] | You can use `Object.keys` if the order is not important:
```
var keys = Object.keys(text), i = 0;
var myInterval = setInterval(function(){
if(i >= keys.length) clearInterval(myInterval); // You need to clear the interval ;)
var current = text[keys[i++]];
//.....
}, 1000*60); //1 minute
```
I hope this will... | **Native:**
You can get a list of keys in an array by using `Object.keys` and `setTimeout` built-in functions.
`Object.keys` returns an array of keys an an object
`setTimeout` takes a function and executes it after certain number of milliseconds (1000) in this case
So in your case
```
var keys = Object.keys(arr... |
38,530,983 | Is it possible to loop a json object one by one ?
let's say I have this object (text). I want to loop on `text` and get **next** item every 1 minute until I get them all. How can I do this in javascript ?
```
var text =
{
"name":"John Johnson",
"street":"Oslo West 16",
"determine"... | 2016/07/22 | [
"https://Stackoverflow.com/questions/38530983",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6608257/"
] | You can use `Object.keys` if the order is not important:
```
var keys = Object.keys(text), i = 0;
var myInterval = setInterval(function(){
if(i >= keys.length) clearInterval(myInterval); // You need to clear the interval ;)
var current = text[keys[i++]];
//.....
}, 1000*60); //1 minute
```
I hope this will... | You could use the superb example of MDN for [Iterators](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators#Iterators) and use it for the properties.
For every interval, the iterator is called with `next()` and then the value is checked. if done, clear the interval or display the pro... |
38,530,983 | Is it possible to loop a json object one by one ?
let's say I have this object (text). I want to loop on `text` and get **next** item every 1 minute until I get them all. How can I do this in javascript ?
```
var text =
{
"name":"John Johnson",
"street":"Oslo West 16",
"determine"... | 2016/07/22 | [
"https://Stackoverflow.com/questions/38530983",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6608257/"
] | You can use `Object.keys` if the order is not important:
```
var keys = Object.keys(text), i = 0;
var myInterval = setInterval(function(){
if(i >= keys.length) clearInterval(myInterval); // You need to clear the interval ;)
var current = text[keys[i++]];
//.....
}, 1000*60); //1 minute
```
I hope this will... | You should first solve the generic problem of sending out the element of an array with some delay. Once you've done that, it's easy enough to apply that to the keys of an object.
Here's a simple version using `setTimeout`:
```
function emitWithDelay(array, callback) {
var n = 0;
function emitOne() {
if (n >=... |
38,530,983 | Is it possible to loop a json object one by one ?
let's say I have this object (text). I want to loop on `text` and get **next** item every 1 minute until I get them all. How can I do this in javascript ?
```
var text =
{
"name":"John Johnson",
"street":"Oslo West 16",
"determine"... | 2016/07/22 | [
"https://Stackoverflow.com/questions/38530983",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6608257/"
] | You could use the superb example of MDN for [Iterators](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators#Iterators) and use it for the properties.
For every interval, the iterator is called with `next()` and then the value is checked. if done, clear the interval or display the pro... | **Native:**
You can get a list of keys in an array by using `Object.keys` and `setTimeout` built-in functions.
`Object.keys` returns an array of keys an an object
`setTimeout` takes a function and executes it after certain number of milliseconds (1000) in this case
So in your case
```
var keys = Object.keys(arr... |
38,530,983 | Is it possible to loop a json object one by one ?
let's say I have this object (text). I want to loop on `text` and get **next** item every 1 minute until I get them all. How can I do this in javascript ?
```
var text =
{
"name":"John Johnson",
"street":"Oslo West 16",
"determine"... | 2016/07/22 | [
"https://Stackoverflow.com/questions/38530983",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6608257/"
] | You could use the superb example of MDN for [Iterators](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators#Iterators) and use it for the properties.
For every interval, the iterator is called with `next()` and then the value is checked. if done, clear the interval or display the pro... | You should first solve the generic problem of sending out the element of an array with some delay. Once you've done that, it's easy enough to apply that to the keys of an object.
Here's a simple version using `setTimeout`:
```
function emitWithDelay(array, callback) {
var n = 0;
function emitOne() {
if (n >=... |
59,564,296 | I created new column in table and wrote an inner join function which fills that column with values. But now i figured it out that i need that value added for each repeated `NUMBER` in table `CART`.
```
ALTER TABLE [HEADERS] ADD [SUM] [DECIMAL]
GO
UPDATE [HEADERS]
SET [HEADERS].[SUM] = [CART].[AMOUNT]*[CART].[PRICE]
FR... | 2020/01/02 | [
"https://Stackoverflow.com/questions/59564296",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11598253/"
] | Use aggregation before the `JOIN`:
```
UPDATE h
SET h.[SUM] = c.total
FROM HEADERS h JOIN
(SELECT c.NUMBER, SUM(C.AMOUNT * C.PRICE) as total
FROM CART c
GROUP BY c.NUMBER
) c
ON c.NUMBER = h.NUMBER;
``` | You probably need to add the TableName C to fix the query-error and make it work:
```
UPDATE h
SET h.[SUM] = c.[CART].[AMOUNT]*c.[CART].[PRICE]
FROM HEADERS h JOIN
(SELECT c.NUMBER, SUM(C.AMOUNT * C.PRICE) as total
FROM CART c
GROUP BY c.NUMBER
) c
ON c.NUMBER = h.... |
1,239,311 | I'm a very long time ubuntu user (over a decade) but have not been here as I've had no issues with Ubuntu. With the arrival of 20.04 LTS I decided to encrypt my data (or system if needed). I'm looking for the following:
* Method to reinstall ubuntu with LUKS encryption on a previous LUKS encrypted ubuntu install on a ... | 2020/05/14 | [
"https://askubuntu.com/questions/1239311",
"https://askubuntu.com",
"https://askubuntu.com/users/1082019/"
] | For video playback in the browser you only need to install the package `ubuntu-restricted-extras`. To do so open a terminal and type:
```
sudo apt install ubuntu-restricted-extras
```
Should that still fail with the error message you posted above, reboot and try again. Should the error persist, a previous update mig... | I tried and failed to get videos to work.
I install both clv and mpv and found that both worked.
I chose to set music and video in Settings -> Default Applications to mpv.
Whist I was fighting videos I may have install various codex which might just be essential to mpv. |
1,239,311 | I'm a very long time ubuntu user (over a decade) but have not been here as I've had no issues with Ubuntu. With the arrival of 20.04 LTS I decided to encrypt my data (or system if needed). I'm looking for the following:
* Method to reinstall ubuntu with LUKS encryption on a previous LUKS encrypted ubuntu install on a ... | 2020/05/14 | [
"https://askubuntu.com/questions/1239311",
"https://askubuntu.com",
"https://askubuntu.com/users/1082019/"
] | I can now play videos thanks to the input of Bene and Pilot6. Solution was as follows:
1. $ sudo apt install ubuntu-restricted-extras
On prompt/ message/ question by command terminal I typed in:
2. $ sudo dpkg --configure -a
I accepted MS license by pressing tab, enter
Package installed successfully | I tried and failed to get videos to work.
I install both clv and mpv and found that both worked.
I chose to set music and video in Settings -> Default Applications to mpv.
Whist I was fighting videos I may have install various codex which might just be essential to mpv. |
229,939 | Running Snow Leopard. Completely inexplicably, I seem to have enabled the OSX root user by accident. I honestly have no idea how it happened, but if memory serves I was looking at the login pane (with my two user accounts) when I must have hit something, and suddenly the two accounts were replaced by one that just said... | 2011/01/06 | [
"https://superuser.com/questions/229939",
"https://superuser.com",
"https://superuser.com/users/58051/"
] | The problem turned out to be that the /Users folder, or some related configuration became corrupt. My user home folders were still there but the Accounts pane of System Preferences didn't list them.
Running ls -lah on /Users showed that my two normal accounts had "501" and "502" as the user and "staff" as the group, r... | Revert to an old Time Machine backup, or failing that, an Archive and Install and repair your installation. It sounds like you've broken it irreparably. |
1,345,575 | I know there is this [post](https://stackoverflow.com/questions/495050/list-of-css-features-not-supported-by-ie6), but I still want to know more and learn from other ppl that have a lot more experience than I do.
So I was wondering *what CSS-features or Javascript-functions or anything else I am not thinking of right n... | 2009/08/28 | [
"https://Stackoverflow.com/questions/1345575",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/109948/"
] | If you need a list of IE bugs
refer this
[Explorer Exposed!](http://www.positioniseverything.net/explorer.html)
Another CSS that won't work with IE is
[Border-radius: create rounded corners with CSS!](http://www.css3.info/preview/rounded-border/)
And also read this one from msdn
[CSS Compatibility and Internet Ex... | There's always [quirks mode](http://www.quirksmode.org/bugreports/archives/explorer_windows/) |
1,345,575 | I know there is this [post](https://stackoverflow.com/questions/495050/list-of-css-features-not-supported-by-ie6), but I still want to know more and learn from other ppl that have a lot more experience than I do.
So I was wondering *what CSS-features or Javascript-functions or anything else I am not thinking of right n... | 2009/08/28 | [
"https://Stackoverflow.com/questions/1345575",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/109948/"
] | If you need a list of IE bugs
refer this
[Explorer Exposed!](http://www.positioniseverything.net/explorer.html)
Another CSS that won't work with IE is
[Border-radius: create rounded corners with CSS!](http://www.css3.info/preview/rounded-border/)
And also read this one from msdn
[CSS Compatibility and Internet Ex... | IE (not only 6 though, think I've seen this on 7 as well) has this thing where it will not evaluate values in loops until it's out of the method. That is, this code (example of setting ids on cells in a table row):
```
putids = function (cells)
{
for (var i = 0; i < 5; i++)
{
cells[i].id = "cellid" + i... |
1,345,575 | I know there is this [post](https://stackoverflow.com/questions/495050/list-of-css-features-not-supported-by-ie6), but I still want to know more and learn from other ppl that have a lot more experience than I do.
So I was wondering *what CSS-features or Javascript-functions or anything else I am not thinking of right n... | 2009/08/28 | [
"https://Stackoverflow.com/questions/1345575",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/109948/"
] | If you need a list of IE bugs
refer this
[Explorer Exposed!](http://www.positioniseverything.net/explorer.html)
Another CSS that won't work with IE is
[Border-radius: create rounded corners with CSS!](http://www.css3.info/preview/rounded-border/)
And also read this one from msdn
[CSS Compatibility and Internet Ex... | More advanced CSS selectors, such as *element > immediate-child*, `element[attribute=value]`, etc., do not appear to work in IE (tested on IE8) for elements dynamically added to the page. I've seen stuff like `div#something > p {color: red}` not working in IE once the `p` nodes were added dynamically as a child of `div... |
1,345,575 | I know there is this [post](https://stackoverflow.com/questions/495050/list-of-css-features-not-supported-by-ie6), but I still want to know more and learn from other ppl that have a lot more experience than I do.
So I was wondering *what CSS-features or Javascript-functions or anything else I am not thinking of right n... | 2009/08/28 | [
"https://Stackoverflow.com/questions/1345575",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/109948/"
] | If you need a list of IE bugs
refer this
[Explorer Exposed!](http://www.positioniseverything.net/explorer.html)
Another CSS that won't work with IE is
[Border-radius: create rounded corners with CSS!](http://www.css3.info/preview/rounded-border/)
And also read this one from msdn
[CSS Compatibility and Internet Ex... | Quirksmode is good. You can also get a full run-down of what is supported by whom over at SitePoint: <http://reference.sitepoint.com/css> |
1,345,575 | I know there is this [post](https://stackoverflow.com/questions/495050/list-of-css-features-not-supported-by-ie6), but I still want to know more and learn from other ppl that have a lot more experience than I do.
So I was wondering *what CSS-features or Javascript-functions or anything else I am not thinking of right n... | 2009/08/28 | [
"https://Stackoverflow.com/questions/1345575",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/109948/"
] | There's always [quirks mode](http://www.quirksmode.org/bugreports/archives/explorer_windows/) | IE (not only 6 though, think I've seen this on 7 as well) has this thing where it will not evaluate values in loops until it's out of the method. That is, this code (example of setting ids on cells in a table row):
```
putids = function (cells)
{
for (var i = 0; i < 5; i++)
{
cells[i].id = "cellid" + i... |
1,345,575 | I know there is this [post](https://stackoverflow.com/questions/495050/list-of-css-features-not-supported-by-ie6), but I still want to know more and learn from other ppl that have a lot more experience than I do.
So I was wondering *what CSS-features or Javascript-functions or anything else I am not thinking of right n... | 2009/08/28 | [
"https://Stackoverflow.com/questions/1345575",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/109948/"
] | There's always [quirks mode](http://www.quirksmode.org/bugreports/archives/explorer_windows/) | More advanced CSS selectors, such as *element > immediate-child*, `element[attribute=value]`, etc., do not appear to work in IE (tested on IE8) for elements dynamically added to the page. I've seen stuff like `div#something > p {color: red}` not working in IE once the `p` nodes were added dynamically as a child of `div... |
1,345,575 | I know there is this [post](https://stackoverflow.com/questions/495050/list-of-css-features-not-supported-by-ie6), but I still want to know more and learn from other ppl that have a lot more experience than I do.
So I was wondering *what CSS-features or Javascript-functions or anything else I am not thinking of right n... | 2009/08/28 | [
"https://Stackoverflow.com/questions/1345575",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/109948/"
] | There's always [quirks mode](http://www.quirksmode.org/bugreports/archives/explorer_windows/) | Quirksmode is good. You can also get a full run-down of what is supported by whom over at SitePoint: <http://reference.sitepoint.com/css> |
1,345,575 | I know there is this [post](https://stackoverflow.com/questions/495050/list-of-css-features-not-supported-by-ie6), but I still want to know more and learn from other ppl that have a lot more experience than I do.
So I was wondering *what CSS-features or Javascript-functions or anything else I am not thinking of right n... | 2009/08/28 | [
"https://Stackoverflow.com/questions/1345575",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/109948/"
] | More advanced CSS selectors, such as *element > immediate-child*, `element[attribute=value]`, etc., do not appear to work in IE (tested on IE8) for elements dynamically added to the page. I've seen stuff like `div#something > p {color: red}` not working in IE once the `p` nodes were added dynamically as a child of `div... | IE (not only 6 though, think I've seen this on 7 as well) has this thing where it will not evaluate values in loops until it's out of the method. That is, this code (example of setting ids on cells in a table row):
```
putids = function (cells)
{
for (var i = 0; i < 5; i++)
{
cells[i].id = "cellid" + i... |
1,345,575 | I know there is this [post](https://stackoverflow.com/questions/495050/list-of-css-features-not-supported-by-ie6), but I still want to know more and learn from other ppl that have a lot more experience than I do.
So I was wondering *what CSS-features or Javascript-functions or anything else I am not thinking of right n... | 2009/08/28 | [
"https://Stackoverflow.com/questions/1345575",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/109948/"
] | Quirksmode is good. You can also get a full run-down of what is supported by whom over at SitePoint: <http://reference.sitepoint.com/css> | IE (not only 6 though, think I've seen this on 7 as well) has this thing where it will not evaluate values in loops until it's out of the method. That is, this code (example of setting ids on cells in a table row):
```
putids = function (cells)
{
for (var i = 0; i < 5; i++)
{
cells[i].id = "cellid" + i... |
56,089,509 | I got this error when I try to generate signed apk for my project
>
> Duplicate class com.google.android.gms.measurement.AppMeasurement
> found in modules classes.jar
> (com.google.android.gms:play-services-measurement-impl:16.5.0) and
> classes.jar (com.google.firebase:firebase-analytics-impl:10.0.1)
> Duplicate... | 2019/05/11 | [
"https://Stackoverflow.com/questions/56089509",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11484860/"
] | Try with
```
implementation("com.google.android.gms:play-services-gcm:$project.playServicesVersion") {
exclude group: 'com.google.android.gms'
}
```
You can Try including one by one the one which brings errors you apply
```
implementation("**API**") {
exclude group: 'com.google.android.gms'
}
```
**NB*... | For those who face this type of issue in the future
Ensure that you are using the specific dependency of play services according to your requirements. In my case, I need a map dependency but I am importing the play service dependency which causes duplicate class issues with another firebase dependency.
Use this
```
... |
56,089,509 | I got this error when I try to generate signed apk for my project
>
> Duplicate class com.google.android.gms.measurement.AppMeasurement
> found in modules classes.jar
> (com.google.android.gms:play-services-measurement-impl:16.5.0) and
> classes.jar (com.google.firebase:firebase-analytics-impl:10.0.1)
> Duplicate... | 2019/05/11 | [
"https://Stackoverflow.com/questions/56089509",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11484860/"
] | Try with
```
implementation("com.google.android.gms:play-services-gcm:$project.playServicesVersion") {
exclude group: 'com.google.android.gms'
}
```
You can Try including one by one the one which brings errors you apply
```
implementation("**API**") {
exclude group: 'com.google.android.gms'
}
```
**NB*... | Reason: This error usually occurs due to depedencies using same functionality.
Solution: To revolve such issue is to comment: play-services because play-services-maps has same functions like play-services and also display locations on our android UI system. Please see below for solution.
//implementation 'com.google... |
56,089,509 | I got this error when I try to generate signed apk for my project
>
> Duplicate class com.google.android.gms.measurement.AppMeasurement
> found in modules classes.jar
> (com.google.android.gms:play-services-measurement-impl:16.5.0) and
> classes.jar (com.google.firebase:firebase-analytics-impl:10.0.1)
> Duplicate... | 2019/05/11 | [
"https://Stackoverflow.com/questions/56089509",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11484860/"
] | For those who face this type of issue in the future
Ensure that you are using the specific dependency of play services according to your requirements. In my case, I need a map dependency but I am importing the play service dependency which causes duplicate class issues with another firebase dependency.
Use this
```
... | Reason: This error usually occurs due to depedencies using same functionality.
Solution: To revolve such issue is to comment: play-services because play-services-maps has same functions like play-services and also display locations on our android UI system. Please see below for solution.
//implementation 'com.google... |
28,754,547 | I have the following:
```
import netrc
machine = 'ftp.example.com'
auth = netrc.netrc().authenticators(machine)
```
I have the following line in my `.netrc` file:
```
machine "### comment"
```
I get the following error:
>
> netrc.NetrcParseError: bad follower token 'comment"'
>
>
>
I can remove the comment... | 2015/02/26 | [
"https://Stackoverflow.com/questions/28754547",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10415/"
] | Doesn't your line need to be
```
machine ftp.example.com login user password pw
```
If you start the line with 'machine' you at least need a machine name, before you comment out the rest of the line, otherwise netrc can't parse the line. | I believe it's parsing the line without treating the quotation marks any differently from other non-whitespace characters. So this:
```
machine "### comment"
```
gets turned into the tokens `machine`, `"###`, and `comment"`. After that, it can't find any more tokens, and it barfs.
Unfortunately, since there are lot... |
6,464,607 | I have a demo on the following link:
<http://mywebbapp.com/tableSortingDemo.html>
When you click on the Status column and start sorting and then click on the pagination arrow to go to page 2 the rows don't alternate color until you click on the Status column again. Is there a script I can write to resolve this? | 2011/06/24 | [
"https://Stackoverflow.com/questions/6464607",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/333757/"
] | Yes, though I suggest using a premade table such as [DataTables](http://www.datatables.net/%20DataTables).
Here's a small jQuery plugin that could be used if you can trigger it when you paginate:
```
jQuery.fn.stripe = function() {
$(this).find('tr').removeClass('even odd').filter(':odd').addClass('odd').end().fi... | It sounds like your logic to specify the background colors for the rows is just running in the wrong place. Without seeing your code, it's impossible to really debug it, though. |
71,052,202 | I would like to divide a list of positive integers by the length of digits.
For example, int\_list = `[1,3,13,888,1004]`
-> `[1,3] , [13] , [888] , [1004]`
I have implemented below:
```py
def seperate_by_digit(int_list):
len_set = set() # track how many digits we have
int_dict = {} # key : len of digits... | 2022/02/09 | [
"https://Stackoverflow.com/questions/71052202",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14391435/"
] | I ended up using an approach where I let the Azure pipeline insert the secrets into my appSetting when I am deploying, hence the code will not be interfacing with the keyvault. | On development environment you need to use SecretManager as described [here](https://learn.microsoft.com/en-us/aspnet/core/security/key-vault-configuration?view=aspnetcore-6.0#secret-storage-in-the-development-environment).
[Here](https://learn.microsoft.com/en-us/aspnet/core/security/app-secrets?view=aspnetcore-6.0&t... |
41,718,919 | I have the following function:
```
function void my_randomize_int(int seed, inout int mem, int min, int max);
if(max == null) begin
`uvm_info("my_randomize_int", "No max constraint, using default value", UVM_LOW)
max = 2147483647;
end
if(min == null) begin
`uvm_info("my_randomize_... | 2017/01/18 | [
"https://Stackoverflow.com/questions/41718919",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6465067/"
] | Yes, there's [`std::system_error`](http://en.cppreference.com/w/cpp/error/system_error). It's derived from `std::runtime_error`. It's pretty Unix-land-oriented but it does support error codes in general, and I suggest that you use it that way.
---
The following code demonstrates how to define one's own error category... | Consider using [`std::system_error`](http://en.cppreference.com/w/cpp/error/system_error) out of the box.
Note that using simply `throw;` without an argument is a *far* better way of re-throwing your exception (you seem to be using `throw err;`) since the former will throw the exception *by reference* rather than *by ... |
3,338,819 | My understanding is that taking the minimum of two (or more) functions is like creating a union of the functions which in some cases would result in a non-convex function. I can draw it out with some simple 2d functions but I can't figure out how to show it with equations. Thanks in advance for the help! | 2019/08/30 | [
"https://math.stackexchange.com/questions/3338819",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/699606/"
] | The minimum $h:\Bbb R \to \Bbb R$ of $f(x)=(x-1)^2$ and $g(x)=(x+1)^2$ is not convex at $[-1,1]$.
*Proof*: $h(0)>h(-1)$ and $h(0)>h(1)$. | In $[0,1]$, $$f:=x-x^3,\\g:=(1-x)-(1-x)^3,\\h:=\min(f,g)$$
Now the average of $h\left(\dfrac1{\sqrt 3}\right)$ and $h\left(1-\dfrac1{\sqrt 3}\right)$ is $\dfrac{2}{3\sqrt3}$, but $h\left(\dfrac12\right)=\dfrac38$, which is smaller. |
3,338,819 | My understanding is that taking the minimum of two (or more) functions is like creating a union of the functions which in some cases would result in a non-convex function. I can draw it out with some simple 2d functions but I can't figure out how to show it with equations. Thanks in advance for the help! | 2019/08/30 | [
"https://math.stackexchange.com/questions/3338819",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/699606/"
] | Minimum of $|x|$ and $|1-x|$ is not convex. (In fact it is strictly concave on $(0,1)$).
Write $\frac 1 2$ as $\frac 1 2 (0)+\frac 1 2 (1)$. Convexity would mean $\frac 1 2 \leq \frac 1 2 (0)+\frac 1 2 (0)$! | The minimum $h:\Bbb R \to \Bbb R$ of $f(x)=(x-1)^2$ and $g(x)=(x+1)^2$ is not convex at $[-1,1]$.
*Proof*: $h(0)>h(-1)$ and $h(0)>h(1)$. |
3,338,819 | My understanding is that taking the minimum of two (or more) functions is like creating a union of the functions which in some cases would result in a non-convex function. I can draw it out with some simple 2d functions but I can't figure out how to show it with equations. Thanks in advance for the help! | 2019/08/30 | [
"https://math.stackexchange.com/questions/3338819",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/699606/"
] | Minimum of $|x|$ and $|1-x|$ is not convex. (In fact it is strictly concave on $(0,1)$).
Write $\frac 1 2$ as $\frac 1 2 (0)+\frac 1 2 (1)$. Convexity would mean $\frac 1 2 \leq \frac 1 2 (0)+\frac 1 2 (0)$! | In $[0,1]$, $$f:=x-x^3,\\g:=(1-x)-(1-x)^3,\\h:=\min(f,g)$$
Now the average of $h\left(\dfrac1{\sqrt 3}\right)$ and $h\left(1-\dfrac1{\sqrt 3}\right)$ is $\dfrac{2}{3\sqrt3}$, but $h\left(\dfrac12\right)=\dfrac38$, which is smaller. |
26,093,447 | ```
private StringReader myReader;
private void printToolStripMenuItem_Click(object sender, EventArgs e)
{
printDialog1.Document = printDocument1;
string strText = this.richTextBox1.Text;
myReader = new StringReader(strText);
if (printDialog1.ShowDialog() == DialogResult.OK)
{
printDocument1.Print();
}
}
private voi... | 2014/09/29 | [
"https://Stackoverflow.com/questions/26093447",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4085654/"
] | Please try following link for details of errors
<http://technet.microsoft.com/en-us/library/cc645611(v=sql.105).aspx>
The error codes are returned by the db server to the sql client.
**Update**
Try the latest database events and errors here
<https://learn.microsoft.com/en-us/sql/relational-databases/errors-events/... | The rules I use for general classification:
* Number = -1 OR Class/Level/Severity = 20: "Connection Error"
* Number = -2: "Command Timeout Error"
I believe the negative values are strictly from the client library (ie. network connection issues); this implies the "duplicate" numbers like 2 and 53 come back from the se... |
39,149,218 | I am trying to print a string in all uppercase letters. When I run the print command it prints the type of x and the location.
Why does it print the operation instead of the result?
```
x = 'bacon'
x = x.upper
print x
>>>
<built-in method upper of str object at 0x02A95F60>
``` | 2016/08/25 | [
"https://Stackoverflow.com/questions/39149218",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6625618/"
] | Everything in Python is an object, including functions and methods. `x.upper` is the `upper` attribute of `x`, which happens to be a function object. `x.upper()` is the result of trying to call that attribute as a function, so you are trying to do
```
print x.upper()
```
As an aside, you can try to call any object i... | `upper` (and all other methods) is something like "function ready to use", that way you can do:
```
x = 'bacon'
x = x.upper
print x()
```
But the most common to see, and the way I think you want is:
```
x = 'bacon'
x = x.upper()
print x
```
"Ridiculous" example using [lambda](http://www.secnetix.de/olli/Python/la... |
114,847 | Introduction
------------
You may know and love your normal unit circle. But mathematicans are crazy and thus they have abstracted the concept to any point that satisfies `x*x+y*y=1`. Because Cryptographers1 are also weird, they *love* finite fields and *sometimes* finite rings (it is not like they have much choice th... | 2017/04/01 | [
"https://codegolf.stackexchange.com/questions/114847",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/55329/"
] | Bash + GNU Utilities, 59
========================
```bash
x={0..$[$1-1]}d*
eval echo $x$x+$1%1-0r^56*32+P|dc|fold -$1
```
Input `n` given as a command-line parameter. The y-axis is inverted.
[Try it online](https://tio.run/nexus/bash#@19hW22gp6cSrWKoaxhbm6LFlVqWmKOQmpyRr6BSoVKhrWKoaqhrUBRnaqZlbKQdUJOSXJOWn5OioKti@P... | Haskell, 115 bytes
==================
```
n#(a,b)|mod(a*a+b*b)n==1='X'|1>0=' '
m n=map(n#)<$>zipWith(zipWith(,))(replicate n[0..n-1])(replicate n<$>[0..n-1])
```
The y axis is inverted.
[Try it online!](https://tio.run/nexus/haskell#VctBCsJADEDRvacItDBJraXj2vQaCuIiowUDJg5lVtK7j24UXH148Ks3KH2i1Z43lE62qUvkzJHDKaxxGjl... |
114,847 | Introduction
------------
You may know and love your normal unit circle. But mathematicans are crazy and thus they have abstracted the concept to any point that satisfies `x*x+y*y=1`. Because Cryptographers1 are also weird, they *love* finite fields and *sometimes* finite rings (it is not like they have much choice th... | 2017/04/01 | [
"https://codegolf.stackexchange.com/questions/114847",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/55329/"
] | [Python 3](https://docs.python.org/3/), (102 98 95 bytes)
=========================================================
### y-axis inverted
```python
n=int(input());r=range(n);p=print
for i in r:
for j in r:p(end=' 'if(i*i+j*j)%n-1else'X')
p()
```
[Try it online!](https://tio.run/nexus/python3#JckxCoAwDADAva/IIk0UB8V... | [GolfScript](http://www.golfscript.com/golfscript/), 34 bytes
=============================================================
```
~:c,{.*}%:a{:b;a{b+c%1=' x'=}%}%n*
```
[Try it online!](https://tio.run/nexus/golfscript#@19nlaxTradVq2qVWG2VZJ1YnaSdrGpoq65QoW5bq1qrmqf1/7@JEQA "GolfScript – TIO Nexus")
I really don't li... |
114,847 | Introduction
------------
You may know and love your normal unit circle. But mathematicans are crazy and thus they have abstracted the concept to any point that satisfies `x*x+y*y=1`. Because Cryptographers1 are also weird, they *love* finite fields and *sometimes* finite rings (it is not like they have much choice th... | 2017/04/01 | [
"https://codegolf.stackexchange.com/questions/114847",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/55329/"
] | [Haskell](https://www.haskell.org/), 68 bytes
=============================================
```hs
f n|r<-[0..n-1]=unlines[[last$' ':['X'|mod(x*x+y*y)n==1]|y<-r]|x<-r]
```
[Try it online!](https://tio.run/nexus/haskell#@5@mkFdTZKMbbaCnl6drGGtbmpeTmZdaHB2dk1hcoqKuoG4VrR6hXpObn6JRoVWhXalVqZlna2sYW1Npo1sUW1MBIv/nJmbmKdg... | [Python 3](https://docs.python.org/3/), (102 98 95 bytes)
=========================================================
### y-axis inverted
```python
n=int(input());r=range(n);p=print
for i in r:
for j in r:p(end=' 'if(i*i+j*j)%n-1else'X')
p()
```
[Try it online!](https://tio.run/nexus/python3#JckxCoAwDADAva/IIk0UB8V... |
114,847 | Introduction
------------
You may know and love your normal unit circle. But mathematicans are crazy and thus they have abstracted the concept to any point that satisfies `x*x+y*y=1`. Because Cryptographers1 are also weird, they *love* finite fields and *sometimes* finite rings (it is not like they have much choice th... | 2017/04/01 | [
"https://codegolf.stackexchange.com/questions/114847",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/55329/"
] | [Python 3](https://docs.python.org/3/), ~~87~~ 83 bytes
=======================================================
```python
lambda n:"\n".join("".join(" X"[(y*y+x*x)%n==1]for x in range(n))for y in range(n))
```
[Try it online!](https://tio.run/nexus/python3#S7ON@Z@TmJuUkqiQZ6UUk6ekl5WfmaehBKMVIpSiNSq1KrUrtCo0VfNsbQ1j... | [GNU APL](https://www.gnu.org/software/apl/), 41 chars, 59 bytes
================================================================
Reads an integer and displays the circle.
```
N←⎕◊⌽{(⍵+1)⊃' ' 'X'}¨{1=(N|(+/⍵*2))}¨⍳N N
```
### Ungolfed
```
N←⎕
⌽ ⍝ flip the X axis so 0,0 is bottom left
{
... |
114,847 | Introduction
------------
You may know and love your normal unit circle. But mathematicans are crazy and thus they have abstracted the concept to any point that satisfies `x*x+y*y=1`. Because Cryptographers1 are also weird, they *love* finite fields and *sometimes* finite rings (it is not like they have much choice th... | 2017/04/01 | [
"https://codegolf.stackexchange.com/questions/114847",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/55329/"
] | [Octave](https://www.gnu.org/software/octave/), ~~45~~ 44 bytes
===============================================================
```matlab
@(n)[(mod((x=(0:n-1).^2)+x',n)==1)*56+32,'']
```
[Try it online!](https://tio.run/nexus/octave#@@@gkacZrZGbn6KhUWGrYWCVp2uoqRdnpKldoa6Tp2lra6ipZWqmbWyko64e@z8xr1jD0FDzPwA "Octave ... | [J](http://jsoftware.com/), 20 bytes
====================================
```
' x'{~1=[|+/~@:*:@i.
```
[Try it online!](https://tio.run/nexus/j#@59ma6WuUKFeXWdoG12jrV/nYKVl5ZCp9z81OSNfIU3BxIgrtSKzRMHgPwA "J – TIO Nexus") |
114,847 | Introduction
------------
You may know and love your normal unit circle. But mathematicans are crazy and thus they have abstracted the concept to any point that satisfies `x*x+y*y=1`. Because Cryptographers1 are also weird, they *love* finite fields and *sometimes* finite rings (it is not like they have much choice th... | 2017/04/01 | [
"https://codegolf.stackexchange.com/questions/114847",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/55329/"
] | [Lithp](https://github.com/andrakis/node-lithp), 125 bytes
----------------------------------------------------------
```
#N::((join(map(seq(- N 1)0)(scope #Y::((join(map(seq 0(- N 1))(scope #X::
((?(== 1(@(+(* X X)(* Y Y))N))"X" " "))))""))))"\n")
```
Linebreak for readability.
[Try it online!](https://andrakis.gi... | [GolfScript](http://www.golfscript.com/golfscript/), 34 bytes
=============================================================
```
~:c,{.*}%:a{:b;a{b+c%1=' x'=}%}%n*
```
[Try it online!](https://tio.run/nexus/golfscript#@19nlaxTradVq2qVWG2VZJ1YnaSdrGpoq65QoW5bq1qrmqf1/7@JEQA "GolfScript – TIO Nexus")
I really don't li... |
114,847 | Introduction
------------
You may know and love your normal unit circle. But mathematicans are crazy and thus they have abstracted the concept to any point that satisfies `x*x+y*y=1`. Because Cryptographers1 are also weird, they *love* finite fields and *sometimes* finite rings (it is not like they have much choice th... | 2017/04/01 | [
"https://codegolf.stackexchange.com/questions/114847",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/55329/"
] | [Jelly](https://github.com/DennisMitchell/jelly), ~~14~~ 13 bytes
=================================================================
```
R²+þ`%=1ị⁾X Y
```
The x-axis is inverted.
[Try it online!](https://tio.run/nexus/jelly#@x90aJP24X0JqraGD3d3P2rcF6EQ@f//fxMjAA "Jelly – TIO Nexus")
### How it works
```
R²+þ`%=1ị⁾... | [dc](https://www.gnu.org/software/bc/manual/dc-1.05/html_mono/dc.html), 79 bytes
================================================================================
```
?dsRsQ[88P]sl[32P]sH[0sM[lM2^lR2^+lQ%d1=l1!=HlM1+dsMlQ>c]dscx10PlR1-dsR0<S]dsSx
```
The `y`-axis is inverted whereas the `x`-axis is not.
[Try it onli... |
114,847 | Introduction
------------
You may know and love your normal unit circle. But mathematicans are crazy and thus they have abstracted the concept to any point that satisfies `x*x+y*y=1`. Because Cryptographers1 are also weird, they *love* finite fields and *sometimes* finite rings (it is not like they have much choice th... | 2017/04/01 | [
"https://codegolf.stackexchange.com/questions/114847",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/55329/"
] | [Haskell](https://www.haskell.org/), 68 bytes
=============================================
```hs
f n|r<-[0..n-1]=unlines[[last$' ':['X'|mod(x*x+y*y)n==1]|y<-r]|x<-r]
```
[Try it online!](https://tio.run/nexus/haskell#@5@mkFdTZKMbbaCnl6drGGtbmpeTmZdaHB2dk1hcoqKuoG4VrR6hXpObn6JRoVWhXalVqZlna2sYW1Npo1sUW1MBIv/nJmbmKdg... | [Lithp](https://github.com/andrakis/node-lithp), 125 bytes
----------------------------------------------------------
```
#N::((join(map(seq(- N 1)0)(scope #Y::((join(map(seq 0(- N 1))(scope #X::
((?(== 1(@(+(* X X)(* Y Y))N))"X" " "))))""))))"\n")
```
Linebreak for readability.
[Try it online!](https://andrakis.gi... |
114,847 | Introduction
------------
You may know and love your normal unit circle. But mathematicans are crazy and thus they have abstracted the concept to any point that satisfies `x*x+y*y=1`. Because Cryptographers1 are also weird, they *love* finite fields and *sometimes* finite rings (it is not like they have much choice th... | 2017/04/01 | [
"https://codegolf.stackexchange.com/questions/114847",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/55329/"
] | Mathematica, 56 48 bytes
------------------------
*Edit: Thanks to Greg Martin and Martin Ender for saving 8 bytes.*
```
Grid@Array[If[Mod[#^2+#2^2,x]==1,X]&,{x=#,#},0]&
```
Original solution:
------------------
```
Grid@Table[If[Tr[{i-1,j-1}^2]~Mod~#==1,X,],{i,#},{j,#}]&
``` | [J](http://jsoftware.com/), 20 bytes
====================================
```
' x'{~1=[|+/~@:*:@i.
```
[Try it online!](https://tio.run/nexus/j#@59ma6WuUKFeXWdoG12jrV/nYKVl5ZCp9z81OSNfIU3BxIgrtSKzRMHgPwA "J – TIO Nexus") |
114,847 | Introduction
------------
You may know and love your normal unit circle. But mathematicans are crazy and thus they have abstracted the concept to any point that satisfies `x*x+y*y=1`. Because Cryptographers1 are also weird, they *love* finite fields and *sometimes* finite rings (it is not like they have much choice th... | 2017/04/01 | [
"https://codegolf.stackexchange.com/questions/114847",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/55329/"
] | [Jelly](https://github.com/DennisMitchell/jelly), ~~14~~ 13 bytes
=================================================================
```
R²+þ`%=1ị⁾X Y
```
The x-axis is inverted.
[Try it online!](https://tio.run/nexus/jelly#@x90aJP24X0JqraGD3d3P2rcF6EQ@f//fxMjAA "Jelly – TIO Nexus")
### How it works
```
R²+þ`%=1ị⁾... | [Python 3](https://docs.python.org/3/), 82 bytes
================================================
```python
f=lambda n,k=0:k<n>f(n,k+1)!=print(''.join(' X'[(k*k+j*j)%n==1]for j in range(n)))
```
[Try it online!](https://tio.run/nexus/python3#DcZBDkAwEADAr6yDdFdFECex3iERhwqVtixp/L/MaZLl01zrZkDKwHUfBhkt/tcNZfxEJy8qVfn... |
17,586,113 | I am trying to run a very simple program, and I'm stuck on the basics of declaring the nested lists and maps.
I'm working on a project which requires me to store polynomials into an ArrayList.
Each polynomial is named, so I want a key/value map to pull the name of the polynomial (1, 2, 3 etc.) as the key, and the actu... | 2013/07/11 | [
"https://Stackoverflow.com/questions/17586113",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1585868/"
] | You can't instantiate `new Map<String, Map<Integer, Integer>>()` because [`java.util.Map`](http://docs.oracle.com/javase/7/docs/api/java/util/Map.html) is an *interface* (it doesn't have a constructor). You need to use a concrete type like [`java.util.HashMap`](http://docs.oracle.com/javase/7/docs/api/java/util/HashMap... | This is incorrect:
```
Map<String, Map<Integer>> polynomialIndex = new Map<String, Map<Integer>>();
```
Maps need to have two parameters and your nested map `Map<Integer>` only has one. I think you're looking for something like:
```
Map<String, Map<Integer, Integer>> polynomialIndex = new Map<String, Map<Integer, I... |
7,777 | Related: [When is it allowable to change the rules?](https://codegolf.meta.stackexchange.com/q/1346/3808)
As noted in the linked meta post above, it's typically particularly frowned upon to significantly change the rules of a challenge after posting it. There's no hard and fast rule on this yet, so the purpose of this... | 2015/12/22 | [
"https://codegolf.meta.stackexchange.com/questions/7777",
"https://codegolf.meta.stackexchange.com",
"https://codegolf.meta.stackexchange.com/users/3808/"
] | Rule changes that don't invalidate existing answers should be allowed (they should not be rolled back).
*(Upvote if you agree, downvote if you disagree, and comment for anything else.)* | Rule changes that invalidate existing answers should be allowed (they should not be rolled back).
*(Upvote if you agree, downvote if you disagree, and comment for anything else.)* |
7,777 | Related: [When is it allowable to change the rules?](https://codegolf.meta.stackexchange.com/q/1346/3808)
As noted in the linked meta post above, it's typically particularly frowned upon to significantly change the rules of a challenge after posting it. There's no hard and fast rule on this yet, so the purpose of this... | 2015/12/22 | [
"https://codegolf.meta.stackexchange.com/questions/7777",
"https://codegolf.meta.stackexchange.com",
"https://codegolf.meta.stackexchange.com/users/3808/"
] | Rule changes that don't invalidate existing answers should be allowed (they should not be rolled back).
*(Upvote if you agree, downvote if you disagree, and comment for anything else.)* | Rule changes in comments are equally valid as those that have been edited into the actual post.
*(Upvote if you agree, downvote if you disagree, and comment for anything else.)* |
7,777 | Related: [When is it allowable to change the rules?](https://codegolf.meta.stackexchange.com/q/1346/3808)
As noted in the linked meta post above, it's typically particularly frowned upon to significantly change the rules of a challenge after posting it. There's no hard and fast rule on this yet, so the purpose of this... | 2015/12/22 | [
"https://codegolf.meta.stackexchange.com/questions/7777",
"https://codegolf.meta.stackexchange.com",
"https://codegolf.meta.stackexchange.com/users/3808/"
] | In support of allowing rule changes that invalidate existing answers
====================================================================
**Closing loopholes**
Suppose you've posted a [fastest-code](https://codegolf.stackexchange.com/questions/tagged/fastest-code "show questions tagged 'fastest-code'") challenge abou... | Rule changes that don't invalidate existing answers should be allowed (they should not be rolled back).
*(Upvote if you agree, downvote if you disagree, and comment for anything else.)* |
7,777 | Related: [When is it allowable to change the rules?](https://codegolf.meta.stackexchange.com/q/1346/3808)
As noted in the linked meta post above, it's typically particularly frowned upon to significantly change the rules of a challenge after posting it. There's no hard and fast rule on this yet, so the purpose of this... | 2015/12/22 | [
"https://codegolf.meta.stackexchange.com/questions/7777",
"https://codegolf.meta.stackexchange.com",
"https://codegolf.meta.stackexchange.com/users/3808/"
] | Rule changes are allowed
------------------------
They're often a very bad idea, but I don't think we should forbid them, regardless of whether they invalidate answers or not.
Most of the time, rule changes are meant to improve the challenge. This can include closing loopholes as isaacg mentioned, but it can also mea... | Rule changes that don't invalidate existing answers should be allowed (they should not be rolled back).
*(Upvote if you agree, downvote if you disagree, and comment for anything else.)* |
7,777 | Related: [When is it allowable to change the rules?](https://codegolf.meta.stackexchange.com/q/1346/3808)
As noted in the linked meta post above, it's typically particularly frowned upon to significantly change the rules of a challenge after posting it. There's no hard and fast rule on this yet, so the purpose of this... | 2015/12/22 | [
"https://codegolf.meta.stackexchange.com/questions/7777",
"https://codegolf.meta.stackexchange.com",
"https://codegolf.meta.stackexchange.com/users/3808/"
] | Rule changes that invalidate existing answers should be allowed (they should not be rolled back).
*(Upvote if you agree, downvote if you disagree, and comment for anything else.)* | Rule changes in comments are equally valid as those that have been edited into the actual post.
*(Upvote if you agree, downvote if you disagree, and comment for anything else.)* |
7,777 | Related: [When is it allowable to change the rules?](https://codegolf.meta.stackexchange.com/q/1346/3808)
As noted in the linked meta post above, it's typically particularly frowned upon to significantly change the rules of a challenge after posting it. There's no hard and fast rule on this yet, so the purpose of this... | 2015/12/22 | [
"https://codegolf.meta.stackexchange.com/questions/7777",
"https://codegolf.meta.stackexchange.com",
"https://codegolf.meta.stackexchange.com/users/3808/"
] | In support of allowing rule changes that invalidate existing answers
====================================================================
**Closing loopholes**
Suppose you've posted a [fastest-code](https://codegolf.stackexchange.com/questions/tagged/fastest-code "show questions tagged 'fastest-code'") challenge abou... | Rule changes that invalidate existing answers should be allowed (they should not be rolled back).
*(Upvote if you agree, downvote if you disagree, and comment for anything else.)* |
7,777 | Related: [When is it allowable to change the rules?](https://codegolf.meta.stackexchange.com/q/1346/3808)
As noted in the linked meta post above, it's typically particularly frowned upon to significantly change the rules of a challenge after posting it. There's no hard and fast rule on this yet, so the purpose of this... | 2015/12/22 | [
"https://codegolf.meta.stackexchange.com/questions/7777",
"https://codegolf.meta.stackexchange.com",
"https://codegolf.meta.stackexchange.com/users/3808/"
] | Rule changes are allowed
------------------------
They're often a very bad idea, but I don't think we should forbid them, regardless of whether they invalidate answers or not.
Most of the time, rule changes are meant to improve the challenge. This can include closing loopholes as isaacg mentioned, but it can also mea... | Rule changes that invalidate existing answers should be allowed (they should not be rolled back).
*(Upvote if you agree, downvote if you disagree, and comment for anything else.)* |
7,777 | Related: [When is it allowable to change the rules?](https://codegolf.meta.stackexchange.com/q/1346/3808)
As noted in the linked meta post above, it's typically particularly frowned upon to significantly change the rules of a challenge after posting it. There's no hard and fast rule on this yet, so the purpose of this... | 2015/12/22 | [
"https://codegolf.meta.stackexchange.com/questions/7777",
"https://codegolf.meta.stackexchange.com",
"https://codegolf.meta.stackexchange.com/users/3808/"
] | In support of allowing rule changes that invalidate existing answers
====================================================================
**Closing loopholes**
Suppose you've posted a [fastest-code](https://codegolf.stackexchange.com/questions/tagged/fastest-code "show questions tagged 'fastest-code'") challenge abou... | Rule changes in comments are equally valid as those that have been edited into the actual post.
*(Upvote if you agree, downvote if you disagree, and comment for anything else.)* |
7,777 | Related: [When is it allowable to change the rules?](https://codegolf.meta.stackexchange.com/q/1346/3808)
As noted in the linked meta post above, it's typically particularly frowned upon to significantly change the rules of a challenge after posting it. There's no hard and fast rule on this yet, so the purpose of this... | 2015/12/22 | [
"https://codegolf.meta.stackexchange.com/questions/7777",
"https://codegolf.meta.stackexchange.com",
"https://codegolf.meta.stackexchange.com/users/3808/"
] | Rule changes are allowed
------------------------
They're often a very bad idea, but I don't think we should forbid them, regardless of whether they invalidate answers or not.
Most of the time, rule changes are meant to improve the challenge. This can include closing loopholes as isaacg mentioned, but it can also mea... | Rule changes in comments are equally valid as those that have been edited into the actual post.
*(Upvote if you agree, downvote if you disagree, and comment for anything else.)* |
7,777 | Related: [When is it allowable to change the rules?](https://codegolf.meta.stackexchange.com/q/1346/3808)
As noted in the linked meta post above, it's typically particularly frowned upon to significantly change the rules of a challenge after posting it. There's no hard and fast rule on this yet, so the purpose of this... | 2015/12/22 | [
"https://codegolf.meta.stackexchange.com/questions/7777",
"https://codegolf.meta.stackexchange.com",
"https://codegolf.meta.stackexchange.com/users/3808/"
] | Rule changes are allowed
------------------------
They're often a very bad idea, but I don't think we should forbid them, regardless of whether they invalidate answers or not.
Most of the time, rule changes are meant to improve the challenge. This can include closing loopholes as isaacg mentioned, but it can also mea... | In support of allowing rule changes that invalidate existing answers
====================================================================
**Closing loopholes**
Suppose you've posted a [fastest-code](https://codegolf.stackexchange.com/questions/tagged/fastest-code "show questions tagged 'fastest-code'") challenge abou... |
2,803,363 | I'm interesting for the evaluation of $\int\_{-1}^1 x^{2k} \operatorname{erf}(x)^k \,dx=0$ with $l$ is a real number , I want to get closed form of that integral , i'm coming up to define it as :$\int\_{-1}^1 x^{2k} \operatorname{erf}(x)^k \,dx=0$ if $k$ is odd integer number and else ( equal to $\beta \neq 0$ ) if $k$... | 2018/05/31 | [
"https://math.stackexchange.com/questions/2803363",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/156150/"
] | $$I\_k=\int\_{-1}^1 x^{2k}\, \left[\text{erf}(x)\right]^k \,dx$$ is $0$ if $k$ is odd. So, we need to focus on
$$I\_{2k}=\int\_{-1}^1 x^{4k}\, \left[\text{erf}(x)\right]^{2k} \,dx$$ which could be *approximated*, as I wrote in an answer to your previous question, using
$$\left[\text{erf}(x)\right]^2\approx 1-e^{-a x^2... | For $k=2$, Maple says the integral is
$${\frac { \left( 16\, \left( {\rm erf} \left(l\right) \right) ^{2
}{l}^{5}{\pi}^{3/2}{{\rm e}^{2\,{l}^{2}}}+32\,{\rm erf} \left(l\right)
{{\rm e}^{{l}^{2}}}\pi\,{l}^{4}-43\,\pi\,\sqrt {2}{{\rm e}^{2\,{l}^{2}
}}{\rm erf} \left(\sqrt {2}l\right)+64\,{\rm erf} \left(l\right){
{\rm e}... |
10,677,242 | I have a MySQL table that looks something like this:
```
+--------------------------------------+
| id | product_id | qty |
+--------------------------------------+
| 1 | 0 | 1 |
| 2 | 1 | 3 |
| 3 | 0 | 2 |
| 4 | ... | 2012/05/20 | [
"https://Stackoverflow.com/questions/10677242",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1101095/"
] | MySQL does this for you:
```
SELECT product_id, sum(qty)
FROM tablename
GROUP BY product_id
``` | As to the first question. It will work, but Notice "Undefined offset" will be issued
Also remember that array index must be a string so
```
$qtyArray[$row['product_id']] += $row['qty'];
``` |
10,677,242 | I have a MySQL table that looks something like this:
```
+--------------------------------------+
| id | product_id | qty |
+--------------------------------------+
| 1 | 0 | 1 |
| 2 | 1 | 3 |
| 3 | 0 | 2 |
| 4 | ... | 2012/05/20 | [
"https://Stackoverflow.com/questions/10677242",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1101095/"
] | MySQL does this for you:
```
SELECT product_id, sum(qty)
FROM tablename
GROUP BY product_id
``` | As mentioned - you're better off using a group query as that's a lot more efficient.
However:
```
$qtyArray[$row[product_id]] += $row[qty];
```
That's going to trigger a notice unless the variable is already set. That's beause it's equivalent to:
```
$qtyArray[$row[product_id]] =
$qtyArray[$row[product_id]] +... |
10,440,792 | I'm asking this because I know that the pythonic way to check whether a list is empty or not is the following:
```
my_list = []
if not my_list:
print "computer says no"
else:
# my_list isn't empty
print "computer says yes"
```
will print `computer says no`, etc. So this leads me to identify `[]` with `F... | 2012/05/03 | [
"https://Stackoverflow.com/questions/10440792",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/913071/"
] | The `if` statement evaluates everything in a Boolean context, it is like there is an implicit call to the [`bool()`](http://docs.python.org/library/functions.html#bool) built-in function.
Here is how you would actually check how things will be evaluated by an `if` statement:
```
>>> bool([])
False
>>> bool([]) == Fal... | Empty containers are "falsy," that is, they evaluate to `False` *in a Boolean context*. That doesn't mean they are literally equal to the constant `False`.
In other words, the following is `True`:
```
bool([]) == False
```
The truth value of an object is determined by its `__nonzero__()` or its `__len__()` method. ... |
10,440,792 | I'm asking this because I know that the pythonic way to check whether a list is empty or not is the following:
```
my_list = []
if not my_list:
print "computer says no"
else:
# my_list isn't empty
print "computer says yes"
```
will print `computer says no`, etc. So this leads me to identify `[]` with `F... | 2012/05/03 | [
"https://Stackoverflow.com/questions/10440792",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/913071/"
] | The `if` statement evaluates everything in a Boolean context, it is like there is an implicit call to the [`bool()`](http://docs.python.org/library/functions.html#bool) built-in function.
Here is how you would actually check how things will be evaluated by an `if` statement:
```
>>> bool([])
False
>>> bool([]) == Fal... | Built-in types in Python have a truth value which allows you to test them for truthfulness. See *[Truth Value Testing](http://docs.python.org/library/stdtypes.html#truth-value-testing)*.
This is different than saying `object == False` which is doing an actual value test (equality test). It is using the objects `__eq__... |
10,440,792 | I'm asking this because I know that the pythonic way to check whether a list is empty or not is the following:
```
my_list = []
if not my_list:
print "computer says no"
else:
# my_list isn't empty
print "computer says yes"
```
will print `computer says no`, etc. So this leads me to identify `[]` with `F... | 2012/05/03 | [
"https://Stackoverflow.com/questions/10440792",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/913071/"
] | The `if` statement evaluates everything in a Boolean context, it is like there is an implicit call to the [`bool()`](http://docs.python.org/library/functions.html#bool) built-in function.
Here is how you would actually check how things will be evaluated by an `if` statement:
```
>>> bool([])
False
>>> bool([]) == Fal... | In your example, the not operator is causing your list to be converted to a boolean. Try this:
```
>>> not []
True
>>> not [1]
False
```
"is" and "==" don't do that conversion. |
10,440,792 | I'm asking this because I know that the pythonic way to check whether a list is empty or not is the following:
```
my_list = []
if not my_list:
print "computer says no"
else:
# my_list isn't empty
print "computer says yes"
```
will print `computer says no`, etc. So this leads me to identify `[]` with `F... | 2012/05/03 | [
"https://Stackoverflow.com/questions/10440792",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/913071/"
] | Empty containers are "falsy," that is, they evaluate to `False` *in a Boolean context*. That doesn't mean they are literally equal to the constant `False`.
In other words, the following is `True`:
```
bool([]) == False
```
The truth value of an object is determined by its `__nonzero__()` or its `__len__()` method. ... | Built-in types in Python have a truth value which allows you to test them for truthfulness. See *[Truth Value Testing](http://docs.python.org/library/stdtypes.html#truth-value-testing)*.
This is different than saying `object == False` which is doing an actual value test (equality test). It is using the objects `__eq__... |
10,440,792 | I'm asking this because I know that the pythonic way to check whether a list is empty or not is the following:
```
my_list = []
if not my_list:
print "computer says no"
else:
# my_list isn't empty
print "computer says yes"
```
will print `computer says no`, etc. So this leads me to identify `[]` with `F... | 2012/05/03 | [
"https://Stackoverflow.com/questions/10440792",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/913071/"
] | Empty containers are "falsy," that is, they evaluate to `False` *in a Boolean context*. That doesn't mean they are literally equal to the constant `False`.
In other words, the following is `True`:
```
bool([]) == False
```
The truth value of an object is determined by its `__nonzero__()` or its `__len__()` method. ... | In your example, the not operator is causing your list to be converted to a boolean. Try this:
```
>>> not []
True
>>> not [1]
False
```
"is" and "==" don't do that conversion. |
10,440,792 | I'm asking this because I know that the pythonic way to check whether a list is empty or not is the following:
```
my_list = []
if not my_list:
print "computer says no"
else:
# my_list isn't empty
print "computer says yes"
```
will print `computer says no`, etc. So this leads me to identify `[]` with `F... | 2012/05/03 | [
"https://Stackoverflow.com/questions/10440792",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/913071/"
] | Built-in types in Python have a truth value which allows you to test them for truthfulness. See *[Truth Value Testing](http://docs.python.org/library/stdtypes.html#truth-value-testing)*.
This is different than saying `object == False` which is doing an actual value test (equality test). It is using the objects `__eq__... | In your example, the not operator is causing your list to be converted to a boolean. Try this:
```
>>> not []
True
>>> not [1]
False
```
"is" and "==" don't do that conversion. |
30,866,844 | I´m trying to simulate a multi layer doughnut chart by initializing Chart.js multiple times over same canvas. There is only one chart visible at the time. The other will be visible when you hover over its position…
Does somebody know how to make both visible at the same time?
Here is my code:
```
<!doctype html>
<ht... | 2015/06/16 | [
"https://Stackoverflow.com/questions/30866844",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5014911/"
] | To show the messages you got from validation beneath the corresponding form field, you need to use the following code if the send button is tapped:
```
var formValues = form.getValues(),
fields = form.query("field");
// remove the style class from all fields
for (var i = 0; i < fields.length; i++) {
fields[i]... | you have to take an item below form like that
```
items: [{
xtype: 'textareafield',
itemId: 'errorMessage'
}]
```
and get item set text on button tap
```
if (!errors.isValid()) {
// loop through validation errors and generate a message to the user
errors.each(function (errorObj) ... |
30,866,844 | I´m trying to simulate a multi layer doughnut chart by initializing Chart.js multiple times over same canvas. There is only one chart visible at the time. The other will be visible when you hover over its position…
Does somebody know how to make both visible at the same time?
Here is my code:
```
<!doctype html>
<ht... | 2015/06/16 | [
"https://Stackoverflow.com/questions/30866844",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5014911/"
] | To show the messages you got from validation beneath the corresponding form field, you need to use the following code if the send button is tapped:
```
var formValues = form.getValues(),
fields = form.query("field");
// remove the style class from all fields
for (var i = 0; i < fields.length; i++) {
fields[i]... | ```
var formValues = form.getValues(),
fields = form.query("field");
// remove the style class from all fields
for (var i = 0; i < fields.length; i++) {
fields[i].removeCls('invalidField');
// TODO: Remove old error messages from fields
}
// dump form fields into new model instance
var model = Ext.create('App... |
59,213,370 | **pay.service.ts**
```
@ViewChild('cardElementForm', { static: false }) cardElementForm: ElementRef;
stripe = Stripe(environment.stripe.pubKey);
async createStripeForm() {
const stripeElements = this.stripe.elements();
const cardElement = stripeElements.create('card');
cardElement.mount(this.cardEle... | 2019/12/06 | [
"https://Stackoverflow.com/questions/59213370",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11918246/"
] | I had this error today, for me it was that I had a syntax-level error in my `.ts` files, so they couldn't really compile.
In above situation, I think, the tests should not start (and instead show compile error).
But for whatever reason, somehow the tests start, and `Jasmine` fails with "`No specs found`" log. | Once I moved the .spec file into the the /spec dir it found the tests. |
59,213,370 | **pay.service.ts**
```
@ViewChild('cardElementForm', { static: false }) cardElementForm: ElementRef;
stripe = Stripe(environment.stripe.pubKey);
async createStripeForm() {
const stripeElements = this.stripe.elements();
const cardElement = stripeElements.create('card');
cardElement.mount(this.cardEle... | 2019/12/06 | [
"https://Stackoverflow.com/questions/59213370",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11918246/"
] | I had this error today, for me it was that I had a syntax-level error in my `.ts` files, so they couldn't really compile.
In above situation, I think, the tests should not start (and instead show compile error).
But for whatever reason, somehow the tests start, and `Jasmine` fails with "`No specs found`" log. | In my case I saw some errors in terminal when I run ng test but when browser open it shown no specs found.
ERROR IN PROJECT
[](https://i.stack.imgur.com/Eqti9.png)
this was the error. After fixed the above error it showed all the specs with the resu... |
59,213,370 | **pay.service.ts**
```
@ViewChild('cardElementForm', { static: false }) cardElementForm: ElementRef;
stripe = Stripe(environment.stripe.pubKey);
async createStripeForm() {
const stripeElements = this.stripe.elements();
const cardElement = stripeElements.create('card');
cardElement.mount(this.cardEle... | 2019/12/06 | [
"https://Stackoverflow.com/questions/59213370",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11918246/"
] | In my case I saw some errors in terminal when I run ng test but when browser open it shown no specs found.
ERROR IN PROJECT
[](https://i.stack.imgur.com/Eqti9.png)
this was the error. After fixed the above error it showed all the specs with the resu... | I had the same issue but in my case I upgraded from angular 9 to angular 10 and tests stopped running, I was getting a lot of:
```
src/app/xxxxx/basic-info/basic-info.component.spec.ts:391:9 - error TS2532: Object is possibly 'undefined'.
391 this.whatToDelete = ["mumbo", "jumbo"];
```
So in the 'describe' I change... |
59,213,370 | **pay.service.ts**
```
@ViewChild('cardElementForm', { static: false }) cardElementForm: ElementRef;
stripe = Stripe(environment.stripe.pubKey);
async createStripeForm() {
const stripeElements = this.stripe.elements();
const cardElement = stripeElements.create('card');
cardElement.mount(this.cardEle... | 2019/12/06 | [
"https://Stackoverflow.com/questions/59213370",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11918246/"
] | I had this error today, for me it was that I had a syntax-level error in my `.ts` files, so they couldn't really compile.
In above situation, I think, the tests should not start (and instead show compile error).
But for whatever reason, somehow the tests start, and `Jasmine` fails with "`No specs found`" log. | Solved it. Once i moved the .spec files into the /src folder, Jasmine detected them without any problems. |
59,213,370 | **pay.service.ts**
```
@ViewChild('cardElementForm', { static: false }) cardElementForm: ElementRef;
stripe = Stripe(environment.stripe.pubKey);
async createStripeForm() {
const stripeElements = this.stripe.elements();
const cardElement = stripeElements.create('card');
cardElement.mount(this.cardEle... | 2019/12/06 | [
"https://Stackoverflow.com/questions/59213370",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11918246/"
] | In my case I saw some errors in terminal when I run ng test but when browser open it shown no specs found.
ERROR IN PROJECT
[](https://i.stack.imgur.com/Eqti9.png)
this was the error. After fixed the above error it showed all the specs with the resu... | I had a similar issue and apparently it was due to an invalid import.
This was the specific import:
`import 'rxjs/add/observable/throw'`
I just removed the import and everything worked fine.
ng test seemed to execute just fine, so it was a little confusing. |
59,213,370 | **pay.service.ts**
```
@ViewChild('cardElementForm', { static: false }) cardElementForm: ElementRef;
stripe = Stripe(environment.stripe.pubKey);
async createStripeForm() {
const stripeElements = this.stripe.elements();
const cardElement = stripeElements.create('card');
cardElement.mount(this.cardEle... | 2019/12/06 | [
"https://Stackoverflow.com/questions/59213370",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11918246/"
] | Solved it. Once i moved the .spec files into the /src folder, Jasmine detected them without any problems. | I had a similar issue and apparently it was due to an invalid import.
This was the specific import:
`import 'rxjs/add/observable/throw'`
I just removed the import and everything worked fine.
ng test seemed to execute just fine, so it was a little confusing. |
59,213,370 | **pay.service.ts**
```
@ViewChild('cardElementForm', { static: false }) cardElementForm: ElementRef;
stripe = Stripe(environment.stripe.pubKey);
async createStripeForm() {
const stripeElements = this.stripe.elements();
const cardElement = stripeElements.create('card');
cardElement.mount(this.cardEle... | 2019/12/06 | [
"https://Stackoverflow.com/questions/59213370",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11918246/"
] | Solved it. Once i moved the .spec files into the /src folder, Jasmine detected them without any problems. | I had the same issue but in my case I upgraded from angular 9 to angular 10 and tests stopped running, I was getting a lot of:
```
src/app/xxxxx/basic-info/basic-info.component.spec.ts:391:9 - error TS2532: Object is possibly 'undefined'.
391 this.whatToDelete = ["mumbo", "jumbo"];
```
So in the 'describe' I change... |
59,213,370 | **pay.service.ts**
```
@ViewChild('cardElementForm', { static: false }) cardElementForm: ElementRef;
stripe = Stripe(environment.stripe.pubKey);
async createStripeForm() {
const stripeElements = this.stripe.elements();
const cardElement = stripeElements.create('card');
cardElement.mount(this.cardEle... | 2019/12/06 | [
"https://Stackoverflow.com/questions/59213370",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11918246/"
] | Solved it. Once i moved the .spec files into the /src folder, Jasmine detected them without any problems. | Once I moved the .spec file into the the /spec dir it found the tests. |
59,213,370 | **pay.service.ts**
```
@ViewChild('cardElementForm', { static: false }) cardElementForm: ElementRef;
stripe = Stripe(environment.stripe.pubKey);
async createStripeForm() {
const stripeElements = this.stripe.elements();
const cardElement = stripeElements.create('card');
cardElement.mount(this.cardEle... | 2019/12/06 | [
"https://Stackoverflow.com/questions/59213370",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11918246/"
] | I had this error today, for me it was that I had a syntax-level error in my `.ts` files, so they couldn't really compile.
In above situation, I think, the tests should not start (and instead show compile error).
But for whatever reason, somehow the tests start, and `Jasmine` fails with "`No specs found`" log. | I had the same issue but in my case I upgraded from angular 9 to angular 10 and tests stopped running, I was getting a lot of:
```
src/app/xxxxx/basic-info/basic-info.component.spec.ts:391:9 - error TS2532: Object is possibly 'undefined'.
391 this.whatToDelete = ["mumbo", "jumbo"];
```
So in the 'describe' I change... |
59,213,370 | **pay.service.ts**
```
@ViewChild('cardElementForm', { static: false }) cardElementForm: ElementRef;
stripe = Stripe(environment.stripe.pubKey);
async createStripeForm() {
const stripeElements = this.stripe.elements();
const cardElement = stripeElements.create('card');
cardElement.mount(this.cardEle... | 2019/12/06 | [
"https://Stackoverflow.com/questions/59213370",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11918246/"
] | In my case I saw some errors in terminal when I run ng test but when browser open it shown no specs found.
ERROR IN PROJECT
[](https://i.stack.imgur.com/Eqti9.png)
this was the error. After fixed the above error it showed all the specs with the resu... | Once I moved the .spec file into the the /spec dir it found the tests. |
763,642 | Is there an app that can adjust gamma/brightness/contrast for ubuntu 16.04?
`xgamma` doesn't have any effect.
Thank you
**Edits**
```
*-display:0
description: VGA compatible controller
product: Mobile 4 Series Chipset Integrated Graphics Controller
vendor: Intel Corporation
... | 2016/04/27 | [
"https://askubuntu.com/questions/763642",
"https://askubuntu.com",
"https://askubuntu.com/users/226761/"
] | **Note this is not a app but a script can be made if the process works on your pc**
Open your terminal and enter this command.
`xrandr -q | grep " connected"`
My output is:
**DVI-I-0 connected primary 1280x1024+0+0 (normal left inverted right x axis y axis) 376mm x 301mm**
Copy the value that comes before "connect... | As shown in other answer:
```
xrandr --output your_display_name --gamma 0.5:0.5:0.5
```
To automatically apply *xrandr* options on each login, commands can be done in a simple Python script **added to "Startup Applications"** in Ubuntu.
~/xrandr\_display\_setup.py:
```py
#!/usr/bin/env python3
import subprocess a... |
6,444,632 | I have an Excel table saved as a CSV that looks something like (when it's in Excel) this just longer:
```
Monday Tuesday Wednesday Thursday Friday
marsbar 9 8 0 6 5
reeses 0 0 0 9 0
twix 2 3 0 5 6
snickers 9 8 0 6 5
```
(The format isnt perfect, but you get the gi... | 2011/06/22 | [
"https://Stackoverflow.com/questions/6444632",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/808545/"
] | Your best bet is to use the `csv` package built into python. It will let you loop over the rows, giving you a list each time, like so:
```
import csv
candy_reader = csv.reader(open('candy.csv', 'rb'))
for row in candy_reader:
if row[0] in candy_to_find:
monday_total += row[1]
# etc.
```
I didn't initi... | We can *help you* write such a program, yes.
We will not write the program for you (that's not what StackOverflow is about).
Python comes with a [CSV module](http://www.python.org/doc//current/library/csv.html), which will read in an Excel-saved CSV file.
You can store your data in a [dictionary](http://www.python.... |
6,444,632 | I have an Excel table saved as a CSV that looks something like (when it's in Excel) this just longer:
```
Monday Tuesday Wednesday Thursday Friday
marsbar 9 8 0 6 5
reeses 0 0 0 9 0
twix 2 3 0 5 6
snickers 9 8 0 6 5
```
(The format isnt perfect, but you get the gi... | 2011/06/22 | [
"https://Stackoverflow.com/questions/6444632",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/808545/"
] | We can *help you* write such a program, yes.
We will not write the program for you (that's not what StackOverflow is about).
Python comes with a [CSV module](http://www.python.org/doc//current/library/csv.html), which will read in an Excel-saved CSV file.
You can store your data in a [dictionary](http://www.python.... | In addition to the other answers, you may also want to take a look at the xlrd module, as it can deal with the excel spreadsheets directly if you'd rather not deal with CSV business. The module allows you to read entire (or ranges) of rows/columns at a time as well as grabbing individual cells and you can iterate throu... |
6,444,632 | I have an Excel table saved as a CSV that looks something like (when it's in Excel) this just longer:
```
Monday Tuesday Wednesday Thursday Friday
marsbar 9 8 0 6 5
reeses 0 0 0 9 0
twix 2 3 0 5 6
snickers 9 8 0 6 5
```
(The format isnt perfect, but you get the gi... | 2011/06/22 | [
"https://Stackoverflow.com/questions/6444632",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/808545/"
] | We can *help you* write such a program, yes.
We will not write the program for you (that's not what StackOverflow is about).
Python comes with a [CSV module](http://www.python.org/doc//current/library/csv.html), which will read in an Excel-saved CSV file.
You can store your data in a [dictionary](http://www.python.... | Some useful bits:
If you have a list of lists like
```
[['marsbar', 0, 1, 2, 3, 4], ['twix', 3, 4, 5, 6, 7]]
```
(which you should be able to get by using the `csv` module)
You will probably want to convert it to a dictionary, where the first item of each list is used for the key, and the rest make up the value. Y... |
6,444,632 | I have an Excel table saved as a CSV that looks something like (when it's in Excel) this just longer:
```
Monday Tuesday Wednesday Thursday Friday
marsbar 9 8 0 6 5
reeses 0 0 0 9 0
twix 2 3 0 5 6
snickers 9 8 0 6 5
```
(The format isnt perfect, but you get the gi... | 2011/06/22 | [
"https://Stackoverflow.com/questions/6444632",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/808545/"
] | Your best bet is to use the `csv` package built into python. It will let you loop over the rows, giving you a list each time, like so:
```
import csv
candy_reader = csv.reader(open('candy.csv', 'rb'))
for row in candy_reader:
if row[0] in candy_to_find:
monday_total += row[1]
# etc.
```
I didn't initi... | Maybe with the [csv module](http://docs.python.org/library/csv.html)
I suppose the delimiter is the tab character (`\t`)
```
import csv
reader = csv.reader(open('csv_file.csv', 'rb'), delimiter='\t')
for row in reader:
print row
>>>['Monday','Tuesday', 'Wednesday', 'Thursday', 'Friday']
['marsbar', '9', '8','0',... |
6,444,632 | I have an Excel table saved as a CSV that looks something like (when it's in Excel) this just longer:
```
Monday Tuesday Wednesday Thursday Friday
marsbar 9 8 0 6 5
reeses 0 0 0 9 0
twix 2 3 0 5 6
snickers 9 8 0 6 5
```
(The format isnt perfect, but you get the gi... | 2011/06/22 | [
"https://Stackoverflow.com/questions/6444632",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/808545/"
] | Maybe with the [csv module](http://docs.python.org/library/csv.html)
I suppose the delimiter is the tab character (`\t`)
```
import csv
reader = csv.reader(open('csv_file.csv', 'rb'), delimiter='\t')
for row in reader:
print row
>>>['Monday','Tuesday', 'Wednesday', 'Thursday', 'Friday']
['marsbar', '9', '8','0',... | In addition to the other answers, you may also want to take a look at the xlrd module, as it can deal with the excel spreadsheets directly if you'd rather not deal with CSV business. The module allows you to read entire (or ranges) of rows/columns at a time as well as grabbing individual cells and you can iterate throu... |
6,444,632 | I have an Excel table saved as a CSV that looks something like (when it's in Excel) this just longer:
```
Monday Tuesday Wednesday Thursday Friday
marsbar 9 8 0 6 5
reeses 0 0 0 9 0
twix 2 3 0 5 6
snickers 9 8 0 6 5
```
(The format isnt perfect, but you get the gi... | 2011/06/22 | [
"https://Stackoverflow.com/questions/6444632",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/808545/"
] | Maybe with the [csv module](http://docs.python.org/library/csv.html)
I suppose the delimiter is the tab character (`\t`)
```
import csv
reader = csv.reader(open('csv_file.csv', 'rb'), delimiter='\t')
for row in reader:
print row
>>>['Monday','Tuesday', 'Wednesday', 'Thursday', 'Friday']
['marsbar', '9', '8','0',... | Some useful bits:
If you have a list of lists like
```
[['marsbar', 0, 1, 2, 3, 4], ['twix', 3, 4, 5, 6, 7]]
```
(which you should be able to get by using the `csv` module)
You will probably want to convert it to a dictionary, where the first item of each list is used for the key, and the rest make up the value. Y... |
6,444,632 | I have an Excel table saved as a CSV that looks something like (when it's in Excel) this just longer:
```
Monday Tuesday Wednesday Thursday Friday
marsbar 9 8 0 6 5
reeses 0 0 0 9 0
twix 2 3 0 5 6
snickers 9 8 0 6 5
```
(The format isnt perfect, but you get the gi... | 2011/06/22 | [
"https://Stackoverflow.com/questions/6444632",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/808545/"
] | Your best bet is to use the `csv` package built into python. It will let you loop over the rows, giving you a list each time, like so:
```
import csv
candy_reader = csv.reader(open('candy.csv', 'rb'))
for row in candy_reader:
if row[0] in candy_to_find:
monday_total += row[1]
# etc.
```
I didn't initi... | In addition to the other answers, you may also want to take a look at the xlrd module, as it can deal with the excel spreadsheets directly if you'd rather not deal with CSV business. The module allows you to read entire (or ranges) of rows/columns at a time as well as grabbing individual cells and you can iterate throu... |
6,444,632 | I have an Excel table saved as a CSV that looks something like (when it's in Excel) this just longer:
```
Monday Tuesday Wednesday Thursday Friday
marsbar 9 8 0 6 5
reeses 0 0 0 9 0
twix 2 3 0 5 6
snickers 9 8 0 6 5
```
(The format isnt perfect, but you get the gi... | 2011/06/22 | [
"https://Stackoverflow.com/questions/6444632",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/808545/"
] | Your best bet is to use the `csv` package built into python. It will let you loop over the rows, giving you a list each time, like so:
```
import csv
candy_reader = csv.reader(open('candy.csv', 'rb'))
for row in candy_reader:
if row[0] in candy_to_find:
monday_total += row[1]
# etc.
```
I didn't initi... | Some useful bits:
If you have a list of lists like
```
[['marsbar', 0, 1, 2, 3, 4], ['twix', 3, 4, 5, 6, 7]]
```
(which you should be able to get by using the `csv` module)
You will probably want to convert it to a dictionary, where the first item of each list is used for the key, and the rest make up the value. Y... |
6,444,632 | I have an Excel table saved as a CSV that looks something like (when it's in Excel) this just longer:
```
Monday Tuesday Wednesday Thursday Friday
marsbar 9 8 0 6 5
reeses 0 0 0 9 0
twix 2 3 0 5 6
snickers 9 8 0 6 5
```
(The format isnt perfect, but you get the gi... | 2011/06/22 | [
"https://Stackoverflow.com/questions/6444632",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/808545/"
] | In addition to the other answers, you may also want to take a look at the xlrd module, as it can deal with the excel spreadsheets directly if you'd rather not deal with CSV business. The module allows you to read entire (or ranges) of rows/columns at a time as well as grabbing individual cells and you can iterate throu... | Some useful bits:
If you have a list of lists like
```
[['marsbar', 0, 1, 2, 3, 4], ['twix', 3, 4, 5, 6, 7]]
```
(which you should be able to get by using the `csv` module)
You will probably want to convert it to a dictionary, where the first item of each list is used for the key, and the rest make up the value. Y... |
45,343,570 | This is my current data in database.
```
========================================
id | IC |date |time |
1 | test |2017-07-27 |14:19:26 |
2 | test |2017-07-27 |14:20:26 |
3 | second |2017-07-28 |06:58:55 |
========================================
```
I... | 2017/07/27 | [
"https://Stackoverflow.com/questions/45343570",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7935771/"
] | This will return the max date & time per ic:
```
select ic, max(date), max(time)
from check_in
group by ic
``` | This should work
```
select max(time),date,id
from (select max(date) as date,time,id from check-in group by time,id )
group by date,id;
``` |
45,343,570 | This is my current data in database.
```
========================================
id | IC |date |time |
1 | test |2017-07-27 |14:19:26 |
2 | test |2017-07-27 |14:20:26 |
3 | second |2017-07-28 |06:58:55 |
========================================
```
I... | 2017/07/27 | [
"https://Stackoverflow.com/questions/45343570",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7935771/"
] | This will return the max date & time per ic:
```
select ic, max(date), max(time)
from check_in
group by ic
``` | You can use a tuple and group by ic
```
SELECT id,pass_no,time_in,ic,date_in
FROM `check_in`
WHERE (date_in, time_in, ic) in (
SELECT MAX(date_in), max(time_id), ic
FROM check_in
GROUP BY id)
``` |
45,343,570 | This is my current data in database.
```
========================================
id | IC |date |time |
1 | test |2017-07-27 |14:19:26 |
2 | test |2017-07-27 |14:20:26 |
3 | second |2017-07-28 |06:58:55 |
========================================
```
I... | 2017/07/27 | [
"https://Stackoverflow.com/questions/45343570",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7935771/"
] | This will return the max date & time per ic:
```
select ic, max(date), max(time)
from check_in
group by ic
``` | Did you try with "OR" condition insteads "AND"? |
45,343,570 | This is my current data in database.
```
========================================
id | IC |date |time |
1 | test |2017-07-27 |14:19:26 |
2 | test |2017-07-27 |14:20:26 |
3 | second |2017-07-28 |06:58:55 |
========================================
```
I... | 2017/07/27 | [
"https://Stackoverflow.com/questions/45343570",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7935771/"
] | You can use a tuple and group by ic
```
SELECT id,pass_no,time_in,ic,date_in
FROM `check_in`
WHERE (date_in, time_in, ic) in (
SELECT MAX(date_in), max(time_id), ic
FROM check_in
GROUP BY id)
``` | This should work
```
select max(time),date,id
from (select max(date) as date,time,id from check-in group by time,id )
group by date,id;
``` |
45,343,570 | This is my current data in database.
```
========================================
id | IC |date |time |
1 | test |2017-07-27 |14:19:26 |
2 | test |2017-07-27 |14:20:26 |
3 | second |2017-07-28 |06:58:55 |
========================================
```
I... | 2017/07/27 | [
"https://Stackoverflow.com/questions/45343570",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7935771/"
] | You can use a tuple and group by ic
```
SELECT id,pass_no,time_in,ic,date_in
FROM `check_in`
WHERE (date_in, time_in, ic) in (
SELECT MAX(date_in), max(time_id), ic
FROM check_in
GROUP BY id)
``` | Did you try with "OR" condition insteads "AND"? |
1,986,872 | I'm porting a Delphi 5 app to D2010, and I've got a bit of a problem. On one form is a TImage component with an OnMouseMove event that's supposed to update a label whenever the mouse is moved over the image. This worked just fine in the original app, but now the OnMouseMove event fires constantly whenever the mouse is ... | 2009/12/31 | [
"https://Stackoverflow.com/questions/1986872",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32914/"
] | *My psychic debugging sense tells me that you are on Windows, the label is a tooltip window and you are updating on every mousemove.*
In all seriousness, I've seen this exact thing with tooltip window when we switched to Vista. It seems that more recent versions of the Windows tooltip window somehow generate WM\_MOUSE... | Mason, I can't reproduce this is a new D2010 (Update 4 & 5) VCL Forms application on Windows XP SP2. Here's what I did:
* File|New|VCL Forms Application
* Dropped a TImage and TLabel on the form
* Picked a random image out of the default images folder (GreenBar.bmp) for the TImage.Picture
* Double-clicked the TImage.O... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.