qid int64 1 74.7M | question stringlengths 15 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 4 30.2k | response_k stringlengths 11 36.5k |
|---|---|---|---|---|---|
28,838 | The 9 Billion Names of God is a short story by Arthur C. Clarke. It's about a group of Tibetan monks whose order is devoted to writing down all the possible names of God, written in their own alphabet. Essentially, they are devoted to writing every possible permutation of their alphabet, restricted by a few rules. In t... | 2014/05/30 | [
"https://codegolf.stackexchange.com/questions/28838",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/19462/"
] | C 140 ~~177 235~~
=================
Good old procedural style, no fancyness.
It counts (no write) 11,459,252,883 names in 8 minutes.
Next edit with the runtime and size of names file. Watch the sky...
**Runtime** 57 minutes, file size 126,051,781,713 (9 chars+crlf per row). Please tell me the monks' email a... | [Pyg](https://gist.github.com/Synthetica9/9796173) (Waaay too long, for a language made for golfing)
====================================================================================================
*whispers*: 101...
```
Pe(*ItCh(((J(x)for x in ItPr("ABCDEFGHIJKLM",repeat=j)if not An((i*3 in x)for i in x))for j i... |
28,838 | The 9 Billion Names of God is a short story by Arthur C. Clarke. It's about a group of Tibetan monks whose order is devoted to writing down all the possible names of God, written in their own alphabet. Essentially, they are devoted to writing every possible permutation of their alphabet, restricted by a few rules. In t... | 2014/05/30 | [
"https://codegolf.stackexchange.com/questions/28838",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/19462/"
] | Perl, 70 68 66 50 characters
============================
```
$"=",";map/(.)\1{3}/||say,glob$i.="{@a}"for@a=A..M
```
Usage:
```
$ perl -E 'code' > output_file
```
The nice thing is that the prints are buffered, so you get all 1-character solutions printed first, followed by 2-character words and so on. | Python 2 - 212 bytes
====================
```
from itertools import chain,product as p
a='ABCDEFGHIJKLM'
q={c*4 for c in a}
c=0
for n in chain(*(p(*([a]*l)) for l in range(1,10))):
n=''.join(n)
if not any(u in n for u in q):print n
c+=1
if c==10**9:break
``` |
639,837 | I am troubleshooting errors establishing a secure connection to an EPP server. I issue the command below and see that all of the server certificates are verified, but still I get an error (highlighted in bold). Is there still a problem validating the server's certificates? If so, what could it be?
Edit: I snipped the ... | 2014/10/27 | [
"https://serverfault.com/questions/639837",
"https://serverfault.com",
"https://serverfault.com/users/250944/"
] | You get the error about `certificate unknown` from the server, so it refers to the validation of your client certificate on the server side and not to the (successful) validation of the servers certificate at the client side. That means the server does not like your client certificate.
Please check your client certifi... | In my case, the clients did not appreciate being forced to do TLS, but were warm and fuzzy when we added "SSLProtocol +SSLv3" in the https server :| |
639,837 | I am troubleshooting errors establishing a secure connection to an EPP server. I issue the command below and see that all of the server certificates are verified, but still I get an error (highlighted in bold). Is there still a problem validating the server's certificates? If so, what could it be?
Edit: I snipped the ... | 2014/10/27 | [
"https://serverfault.com/questions/639837",
"https://serverfault.com",
"https://serverfault.com/users/250944/"
] | You get the error about `certificate unknown` from the server, so it refers to the validation of your client certificate on the server side and not to the (successful) validation of the servers certificate at the client side. That means the server does not like your client certificate.
Please check your client certifi... | I just experienced something similar.
You may have forgotten to install the CA Certificates.
If you're on ubuntu or debian: **apt-get install ca-certificates** |
639,837 | I am troubleshooting errors establishing a secure connection to an EPP server. I issue the command below and see that all of the server certificates are verified, but still I get an error (highlighted in bold). Is there still a problem validating the server's certificates? If so, what could it be?
Edit: I snipped the ... | 2014/10/27 | [
"https://serverfault.com/questions/639837",
"https://serverfault.com",
"https://serverfault.com/users/250944/"
] | You get the error about `certificate unknown` from the server, so it refers to the validation of your client certificate on the server side and not to the (successful) validation of the servers certificate at the client side. That means the server does not like your client certificate.
Please check your client certifi... | In my case
>
> error:14094416:SSL routines:SSL3\_READ\_BYTES:sslv3 alert certificate unknown:s3\_pkt.c:1260:SSL alert number 46
>
>
>
was solved by adding
```
ssl_verify_client_cert = yes
```
in */etc/dovecot/dovecot.conf*. |
639,837 | I am troubleshooting errors establishing a secure connection to an EPP server. I issue the command below and see that all of the server certificates are verified, but still I get an error (highlighted in bold). Is there still a problem validating the server's certificates? If so, what could it be?
Edit: I snipped the ... | 2014/10/27 | [
"https://serverfault.com/questions/639837",
"https://serverfault.com",
"https://serverfault.com/users/250944/"
] | I just experienced something similar.
You may have forgotten to install the CA Certificates.
If you're on ubuntu or debian: **apt-get install ca-certificates** | In my case, the clients did not appreciate being forced to do TLS, but were warm and fuzzy when we added "SSLProtocol +SSLv3" in the https server :| |
639,837 | I am troubleshooting errors establishing a secure connection to an EPP server. I issue the command below and see that all of the server certificates are verified, but still I get an error (highlighted in bold). Is there still a problem validating the server's certificates? If so, what could it be?
Edit: I snipped the ... | 2014/10/27 | [
"https://serverfault.com/questions/639837",
"https://serverfault.com",
"https://serverfault.com/users/250944/"
] | In my case
>
> error:14094416:SSL routines:SSL3\_READ\_BYTES:sslv3 alert certificate unknown:s3\_pkt.c:1260:SSL alert number 46
>
>
>
was solved by adding
```
ssl_verify_client_cert = yes
```
in */etc/dovecot/dovecot.conf*. | In my case, the clients did not appreciate being forced to do TLS, but were warm and fuzzy when we added "SSLProtocol +SSLv3" in the https server :| |
639,837 | I am troubleshooting errors establishing a secure connection to an EPP server. I issue the command below and see that all of the server certificates are verified, but still I get an error (highlighted in bold). Is there still a problem validating the server's certificates? If so, what could it be?
Edit: I snipped the ... | 2014/10/27 | [
"https://serverfault.com/questions/639837",
"https://serverfault.com",
"https://serverfault.com/users/250944/"
] | In my case
>
> error:14094416:SSL routines:SSL3\_READ\_BYTES:sslv3 alert certificate unknown:s3\_pkt.c:1260:SSL alert number 46
>
>
>
was solved by adding
```
ssl_verify_client_cert = yes
```
in */etc/dovecot/dovecot.conf*. | I just experienced something similar.
You may have forgotten to install the CA Certificates.
If you're on ubuntu or debian: **apt-get install ca-certificates** |
61,512,609 | I am web scraping a website that contains open [Christmas tree farms](http://www.pickyourownchristmastree.org/) in the United States. My end goal is to obtain phone names, numbers, address, and emails for each farm. Though this is my end goal, I have not coded that far, so please only help me where I am stuck. I'd also... | 2020/04/29 | [
"https://Stackoverflow.com/questions/61512609",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10859585/"
] | Based on your reply to my comment, I have modified your solution with a few minor changes. You should be able to follow this logic for getting and navigating to each link in your map.
1. I created an empty list `state_links` at the beginning.
* For each state link we find, I append it to that list.
2. For each state ... | ```
import requests
from bs4 import BeautifulSoup
source = requests.get('http://www.pickyourownchristmastree.org/').text
soup = BeautifulSoup(source, 'html.parser')
concatenate = 'http://www.pickyourownchristmastree.org/'
state_links = []
ab = ['AL', 'AK', 'AZ', 'AR', 'CA', 'CO', 'CT', 'DE', 'FL', 'GA', 'HI', 'ID','IL... |
54,557,934 | Is it possible to add/extend user authentication logic to AAD?
I want to be able to retrieve the user's password in an alternative way, then hand the password over to AAD to have it validated by AAD in the normal way.
From a high level, this is the authentication flow that I have in mind:
1. A user enters a system w... | 2019/02/06 | [
"https://Stackoverflow.com/questions/54557934",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/919153/"
] | You can use Username/Password authentication (`grant_type=password`) with AAD apps, although that flow is officially discouraged.
How that flow works in conjunction with the ADAL.NET library is explained in great detail here: <https://github.com/AzureAD/azure-activedirectory-library-for-dotnet/wiki/Acquiring-tokens-wi... | Yes, you can do this. You can issue authentication tokens and create a custom authentication endpoint by adding an AuthController. Before a user can call the endpoint, he needs to call the AuthController with valid credentials in order to get a token which will be used in subsequent API calls.
This is by far the best... |
20,047,684 | I have a 2D `char` vector:
```
vector< vector<char> > matrix;
```
I will read in a matrix as an input and store it in that vector. The size of my vector is fixed and is ROW x COL. I guess I need to resize it for each row and column.
How can I accomplish it without taking extra memory (resizing it correctly)? | 2013/11/18 | [
"https://Stackoverflow.com/questions/20047684",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2878007/"
] | **Given the vector is empty**, you can simply resize the outer vector with preallocated inner vectors without the need of a loop:
```
matrix.resize(COL, vector<char>(ROW));
```
Alternatively, when **initializing** or if you want to reset a **non-empty vector**, you can use the constructor overload taking a size and ... | ```
const size_t ROW = 10;
const size_t COL = 20;
std::vector<std::vector<char>> v;
v.resize( ROW );
std::for_each( v.begin(), v.end(),
std::bind2nd( std::mem_fun_ref( &std::vector<char>::resize ), COL ) );
std::cout << "size = " << v.size() << std::endl;
for ( const s... |
20,047,684 | I have a 2D `char` vector:
```
vector< vector<char> > matrix;
```
I will read in a matrix as an input and store it in that vector. The size of my vector is fixed and is ROW x COL. I guess I need to resize it for each row and column.
How can I accomplish it without taking extra memory (resizing it correctly)? | 2013/11/18 | [
"https://Stackoverflow.com/questions/20047684",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2878007/"
] | **Given the vector is empty**, you can simply resize the outer vector with preallocated inner vectors without the need of a loop:
```
matrix.resize(COL, vector<char>(ROW));
```
Alternatively, when **initializing** or if you want to reset a **non-empty vector**, you can use the constructor overload taking a size and ... | While construction with sized vector as default value, given by @leemes, is quite an answer, there is an alternative without using an additional vector and copy ctor:
```
assert(COL >= 0);
assert(ROW >= 0);
vector<vector<char>> matrix;
for (size_t i{0}; i != COL; ++i)
{
matrix.emplace_back(ROW);
}
``` |
20,047,684 | I have a 2D `char` vector:
```
vector< vector<char> > matrix;
```
I will read in a matrix as an input and store it in that vector. The size of my vector is fixed and is ROW x COL. I guess I need to resize it for each row and column.
How can I accomplish it without taking extra memory (resizing it correctly)? | 2013/11/18 | [
"https://Stackoverflow.com/questions/20047684",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2878007/"
] | ```
const size_t ROW = 10;
const size_t COL = 20;
std::vector<std::vector<char>> v;
v.resize( ROW );
std::for_each( v.begin(), v.end(),
std::bind2nd( std::mem_fun_ref( &std::vector<char>::resize ), COL ) );
std::cout << "size = " << v.size() << std::endl;
for ( const s... | While construction with sized vector as default value, given by @leemes, is quite an answer, there is an alternative without using an additional vector and copy ctor:
```
assert(COL >= 0);
assert(ROW >= 0);
vector<vector<char>> matrix;
for (size_t i{0}; i != COL; ++i)
{
matrix.emplace_back(ROW);
}
``` |
31,772,532 | I'm migrating my MVC5 app to MVC6. Currently I'm using two conventions
```
public class RentABikeDbContext : DbContext
{
...
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.Conventions.Remove<PluralizingTableNameCo... | 2015/08/02 | [
"https://Stackoverflow.com/questions/31772532",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4306948/"
] | Entity Framework 7 does not have any built-in pluralization, so nothing to remove there, and Cascade delete is not yet implemented <https://github.com/aspnet/EntityFramework/issues/333> | Iterate thru all entities, get the foreign keys, and set them to Delete Restricted:
```
foreach (var relationship in builder.Model.GetEntityTypes().SelectMany(e => e.GetForeignKeys()))
{
relationship.DeleteBehavior = DeleteBehavior.Restrict;
}
``` |
2,503,448 | Consider the curve **C** given by the following equation
$$
\sqrt{x}+\sqrt{y}=\sqrt{a}
$$
where $a$ is a constant with the condition $a > 0$.
Let $(x\_0, y\_0)$ with be a point on **C** such that $x>0$ and $y>0$.
Now, assume that $(x\_1, 0)$ and $(0, y\_1)$ be considered $x$ and $y$ such that intercepts of the tan... | 2017/11/03 | [
"https://math.stackexchange.com/questions/2503448",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/499001/"
] | [](https://i.stack.imgur.com/CShyP.jpg)
I call the distance from R to D after 2 minutes of fly as a function $x(t)$
The horizontal distance can be described with this formula:
$$\begin{align}L(t)=Vt \cos\alpha &&(1)\end{align}$$
The vertical distance can be described w... | You can write x and y as functions of time.
x = 5t cos 20◦
y = 5tsin20◦
Now the distance$ D =\sqrt(x^{2} + (1 + y)^{2})$.
But it will be easier to work with D2
.
$D^{2} = x^{2} + (1 + y)^{2}$
Then differentiating the above we get 2D ($dD/dt)$ = ... |
2,503,448 | Consider the curve **C** given by the following equation
$$
\sqrt{x}+\sqrt{y}=\sqrt{a}
$$
where $a$ is a constant with the condition $a > 0$.
Let $(x\_0, y\_0)$ with be a point on **C** such that $x>0$ and $y>0$.
Now, assume that $(x\_1, 0)$ and $(0, y\_1)$ be considered $x$ and $y$ such that intercepts of the tan... | 2017/11/03 | [
"https://math.stackexchange.com/questions/2503448",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/499001/"
] | The altitude in the question should not be the altitude of a triangle (at least if you want to use the cosine law).
Let $x$ represent the distance of the plane to the radar station.
Let $y$ represent the distance of the plane from its initial position at $t=0$ (when it was 10 km above the radar station). Essentially... | You can write x and y as functions of time.
x = 5t cos 20◦
y = 5tsin20◦
Now the distance$ D =\sqrt(x^{2} + (1 + y)^{2})$.
But it will be easier to work with D2
.
$D^{2} = x^{2} + (1 + y)^{2}$
Then differentiating the above we get 2D ($dD/dt)$ = ... |
2,503,448 | Consider the curve **C** given by the following equation
$$
\sqrt{x}+\sqrt{y}=\sqrt{a}
$$
where $a$ is a constant with the condition $a > 0$.
Let $(x\_0, y\_0)$ with be a point on **C** such that $x>0$ and $y>0$.
Now, assume that $(x\_1, 0)$ and $(0, y\_1)$ be considered $x$ and $y$ such that intercepts of the tan... | 2017/11/03 | [
"https://math.stackexchange.com/questions/2503448",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/499001/"
] | The altitude in the question should not be the altitude of a triangle (at least if you want to use the cosine law).
Let $x$ represent the distance of the plane to the radar station.
Let $y$ represent the distance of the plane from its initial position at $t=0$ (when it was 10 km above the radar station). Essentially... | [](https://i.stack.imgur.com/CShyP.jpg)
I call the distance from R to D after 2 minutes of fly as a function $x(t)$
The horizontal distance can be described with this formula:
$$\begin{align}L(t)=Vt \cos\alpha &&(1)\end{align}$$
The vertical distance can be described w... |
69,042,339 | I believe all the object properties are optional, so I do not fully understand the errors.
Because I've made the properties optional, but not the object itself?
Error
-----
```
Expected 1 arguments, but got 0. TS2554
71 | // Get the claims on the initial page load
72 | useEffect(() => {
> 73 | fet... | 2021/09/03 | [
"https://Stackoverflow.com/questions/69042339",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/240363/"
] | I have answered my own question.
It says that the json file isn't found but in fact, it's not a code problem.
It's a file problem, I have deleted the `__pycache__` file and it suddenly worked correctly.
So, my conclusion is that you have to have no directories in your bot folder.
so, have a nice day ! I hope my respon... | In most cases your json.load - JSONDecodeError: Expecting value: line 1 column 1 (char 0) error is due to :
1. non-JSON conforming quoting
2. XML/HTML output (that is, a string starting with <), or
3. incompatible character encoding
Ultimately the error tells you that at the very first position the string already doe... |
198,797 | Whenever I click on the `<lightning:button>` inside `<aura:iteration>`, I need to delete that particular record using `<force:recordData>` but When I click on `<lightning:button>`, the envId is coming to the component but not going into `<force:recordData recordId="{!v.envId}>`,
so I am getting error as "Uncaught Acti... | 2017/11/14 | [
"https://salesforce.stackexchange.com/questions/198797",
"https://salesforce.stackexchange.com",
"https://salesforce.stackexchange.com/users/50922/"
] | There are couple of changes you need to make in order to work it:
1. use reloadRecord() Method so that `force:recordData` can understand your assignment.
2. Use `recordUpdated` attribute in `force:recordData` to get notify of change
So your code will look like this
component
```
<aura:component controller="SampleCl... | I think I've read that you should avoid using LDS with lists as it is very inefficient (link below). Also I see you calling the servers' getAllEnvironments, so it would seem you've combined two different ways getting data from SF, you're really not using LDS it the way it was originally designed.
[How efficient is Li... |
13,941,417 | AFAIK mutation observers are not available yet in IE. Chrome, Safari, Firefox have their implementations and its working its way through the standardization process. I'm wondering if anyone (preferably MS employee) knows the story with IE, or might give me a pointer to an article I missed. | 2012/12/18 | [
"https://Stackoverflow.com/questions/13941417",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/127079/"
] | IE 11 supports `MutationObservers` natively. For IE 9-10 you can use this polyfill:
<https://github.com/Polymer/MutationObservers> | There's a recent article on [Windows 8](http://blogs.msdn.com/b/windowsappdev/archive/2012/09/19/make-your-html-javascript-app-accessible.aspx) app development which uses `onpropertychange` to handle DOM mutation.
>
> Example 4: Handle onpropertychange for ARIA-selected property to detect programmatic change of tab ... |
13,941,417 | AFAIK mutation observers are not available yet in IE. Chrome, Safari, Firefox have their implementations and its working its way through the standardization process. I'm wondering if anyone (preferably MS employee) knows the story with IE, or might give me a pointer to an article I missed. | 2012/12/18 | [
"https://Stackoverflow.com/questions/13941417",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/127079/"
] | There's a recent article on [Windows 8](http://blogs.msdn.com/b/windowsappdev/archive/2012/09/19/make-your-html-javascript-app-accessible.aspx) app development which uses `onpropertychange` to handle DOM mutation.
>
> Example 4: Handle onpropertychange for ARIA-selected property to detect programmatic change of tab ... | For compatibility with IE9-10, <https://github.com/webmodules/mutation-observer> exposes the native MutationObserver API provided by the browser, or a polyfill based on mutation events. |
13,941,417 | AFAIK mutation observers are not available yet in IE. Chrome, Safari, Firefox have their implementations and its working its way through the standardization process. I'm wondering if anyone (preferably MS employee) knows the story with IE, or might give me a pointer to an article I missed. | 2012/12/18 | [
"https://Stackoverflow.com/questions/13941417",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/127079/"
] | IE 11 supports `MutationObservers` natively. For IE 9-10 you can use this polyfill:
<https://github.com/Polymer/MutationObservers> | For compatibility with IE9-10, <https://github.com/webmodules/mutation-observer> exposes the native MutationObserver API provided by the browser, or a polyfill based on mutation events. |
18,131,170 | Although I've been using Sql Server on an occasional basis for yonks, I didn't realise until I stumbled across it the other day that you could do something like this:
```
declare @result varchar(8000)
select @result = ''
select @result = @result + acolumn+ ' '
from atable
```
Nothing I'd read in the Transact-Sql ... | 2013/08/08 | [
"https://Stackoverflow.com/questions/18131170",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2663863/"
] | The answer is that I needed to choose File > Manage Version and save a new version. That allowed me to re-publish using the new version number, which contains the updates. Simply re-publishing under the old version number does not do what you might expect.
That now explains the problem I had with another script... | There are two versions of the web app, practically speaking. There is the published version as it existed when you published it and the development version, which reflects your code as it currently exists in the editor. You can access your updated code in its current state without re-publishing by clicking on the "*Tes... |
14,979,327 | I'm creating Action Bar navigation tabs, but when the Action Bar is stacked the tabs are not getting the whole width space. I have a foto to illustrate it.

Is possible, in this case, giving to each tab 50% of the screen width?
Thank you
I'm editin... | 2013/02/20 | [
"https://Stackoverflow.com/questions/14979327",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1554475/"
] | I don't think that's feasible at the moment. I've been trying to do the same thing for the past few days, and here's what I have found so far.
The Android framework uses a class called ActionBarPolicy to set some rules regarding the ActionBar's behavior.
In this file (which can be found here : <https://github.com/and... | Android stacked action bar tabs do not have adjustable widths.
>
> "Stacked action bar tabs now have a width limit. This prevents super-wide tabs that can span the whole screen. The cluster of tabs is centered if it does not span the full width. " <https://android.googlesource.com/platform/frameworks/base/+/b8139af3... |
57,403,252 | I understand the general concept of data alignment, but what I do not understand is the restriction on memory address value, forced to be a multiple of the size of underlying data type.
[This answer](https://stackoverflow.com/a/672482/11205473) explains the data alignment well.
**Quote:**
>
> Let's look at a memory... | 2019/08/07 | [
"https://Stackoverflow.com/questions/57403252",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11205473/"
] | The assumption about that statement is not necessarily true. I don't want to re-iterate the answer you linked to describing the reasons for using and highly preferring aligned access, but there are architectures that do support unaligned memory access -- ARM for example (check out this [SO answer](https://stackoverflow... | >
> Assuming it's true, why " But words can only be fetched at even addresses. " be true?
>
>
>
The memory actually stores words. The processor actually addresses the memory in words, and fetches a word at a time.
When you fetch a byte, it actually fetches a word, then ignores either the first half or the second... |
57,403,252 | I understand the general concept of data alignment, but what I do not understand is the restriction on memory address value, forced to be a multiple of the size of underlying data type.
[This answer](https://stackoverflow.com/a/672482/11205473) explains the data alignment well.
**Quote:**
>
> Let's look at a memory... | 2019/08/07 | [
"https://Stackoverflow.com/questions/57403252",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11205473/"
] | Usually a processors internal addresses points to a whole word. This is because you don't want your (simple) processor be able to address a word at a random byte (or even worse: bit) because
1. You waste addressable memory: presuming the biggest possible address your processor is able to process is the max value of it... | >
> Assuming it's true, why " But words can only be fetched at even addresses. " be true?
>
>
>
The memory actually stores words. The processor actually addresses the memory in words, and fetches a word at a time.
When you fetch a byte, it actually fetches a word, then ignores either the first half or the second... |
37,257,009 | I have two matrix:
```
A=[1 2 3; 4 5 6; 7 8 9]
C=[0 0 2; 0 0 1; 0 0 8]
```
I want to keep nonzero values of C and create D. Then, replace the zero elements with A matrix.
So D should be:
```
D=[1 2 2; 4 5 1; 7 8 8]
```
I try this code:
```
A=[1 2 3; 4 5 6; 7 8 9]
C=[0 0 2; 0 0 1; 0 0 8]
T=A(C==0)
R=sparse(T)
K=... | 2016/05/16 | [
"https://Stackoverflow.com/questions/37257009",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3470711/"
] | Use:
```
D = A;
D(C~=0) = C(C~=0);
``` | ```
A=[1 2 3; 4 5 6; 7 8 9];
C=[0 0 2; 0 0 1; 0 0 8];
D=A;
inds=find(C~=0);
D(inds)=C(inds)
D =
1 2 2
4 5 1
7 8 8
``` |
37,257,009 | I have two matrix:
```
A=[1 2 3; 4 5 6; 7 8 9]
C=[0 0 2; 0 0 1; 0 0 8]
```
I want to keep nonzero values of C and create D. Then, replace the zero elements with A matrix.
So D should be:
```
D=[1 2 2; 4 5 1; 7 8 8]
```
I try this code:
```
A=[1 2 3; 4 5 6; 7 8 9]
C=[0 0 2; 0 0 1; 0 0 8]
T=A(C==0)
R=sparse(T)
K=... | 2016/05/16 | [
"https://Stackoverflow.com/questions/37257009",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3470711/"
] | Use:
```
D = A;
D(C~=0) = C(C~=0);
``` | drorco's answer is the right way to do it, but there is a one-liner that I couldn't resist:
```
D = ~C.*A + ~~C.*C;
``` |
3,987,457 | Let $a\_1,a\_2,a\_3,b\_1,b\_2,b\_3\in \mathbb{R}$, $a\_1,a\_2,a\_3>0$, $b\_1<b\_2<b\_3$.
Prove that $\frac{a\_1}{x-b\_1}+\frac{a\_2}{x-b\_2}+\frac{a\_3}{x-b\_3} = 0$ has exactly two solutions in $\mathbb{R}$.
First, I showed that the solutions must be bounded in $[b\_1,b\_3]$.
Since there are 3 points that the f... | 2021/01/16 | [
"https://math.stackexchange.com/questions/3987457",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/725982/"
] | You need to use IVT in the two intervals $(b\_1,b\_2)$ and $(b\_2, b\_3)$ near the endpoints.
At $b\_1^+$, $\frac{{a\_1}}{x-b\_1}+\frac{{a\_2}}{x-b\_2}+\frac{{a\_3}}{x-b\_3} \to \infty$.
That is because $\frac{{a\_1}}{x-b\_1}+\frac{{a\_2}}{x-b\_2}+\frac{{a\_3}}{x-b\_3}> \frac{{a\_1}}{x-b\_1}+\frac{{a\_2}}{b-b\_2}+\fr... | Obviously $x\ne b\_1,b\_2mb\_3$ a simplification gives:
$$f(x)=a\_1(x-b\_2)(x-b\_3)+a\_2(x-b\_1)(x-b\_3)+a\_3(x-b\_1)(x-b\_2)$$
So we get $$f(b\_1)=a\_3(b\_1-b\_2)(b\_1-b\_3)>0$$
$$f(b\_2)=a\_2(b\_2-b\_1)(b\_1-b\_3)<0$$
$$f(b\_3)=a\_3(b\_3-b\_1)(b\_2-b\_2)>0$$
By IVT $f(x)=0$ has two real roots one in $(b\_1,b\_2)$ and... |
46,825,756 | I'm working on a Kivy app which needs to upload a file to S3 using `boto3` but fails in the JSON `decoder.py` when trying to load the `endpoint` model and establish a `client` connection. This works fine locally running on `16.04` but fails after compiling with `buildozer` and running on `Lollipop 5.1.1`.
**Buildozer ... | 2017/10/19 | [
"https://Stackoverflow.com/questions/46825756",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2087277/"
] | Several days of working and found no resolution to the unusual JSON parsing issue. In the end, rolled back to boto (v2) which hasn't implemented the JSON model of determining endpoints etc. Works fine when deployed.
[What is the difference between the AWS boto and boto3](https://stackoverflow.com/questions/32322503/wh... | Boto3 now works with python-for-android (P4A) with python 3.7.
When this question was first posted neither Boto3 nor Boto worked on P4A/Python3.
The requirements are: android,python3==3.7,kivy,boto3,botocore,urllib3,python-dateutil,jmespath,s3transfer
I believe you may also need openssl. I am using numpy which has o... |
6,650,176 | When reading [Jon Skeet](https://stackoverflow.com/users/22656/jon-skeet)'s answer to this particular question [How can I make it so my class variables can only be set to one of three choices?](https://stackoverflow.com/questions/6640774/how-can-i-make-it-so-my-class-variables-can-only-be-set-to-one-of-three-choices/66... | 2011/07/11 | [
"https://Stackoverflow.com/questions/6650176",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/767890/"
] | >
> If the limitation imposed by the enum definition is so easily broken, what is the point
>
>
>
I think the enum abstraction was not designed with *limitation* or *guarantees* in mind. I think it was designed with *convenience* and *maintainability* in mind
Good reasons:
*Skip the first bullet if you don't wa... | I don't know about the reasons for this design decision, but we can look at a few of its consequences.
Let's look at the IL representation of an enum:
```
.class private auto ansi sealed MyEnum
extends [mscorlib]System.Enum
{
// Fields
.field public specialname rtspecialname int32 value__
.field publi... |
6,650,176 | When reading [Jon Skeet](https://stackoverflow.com/users/22656/jon-skeet)'s answer to this particular question [How can I make it so my class variables can only be set to one of three choices?](https://stackoverflow.com/questions/6640774/how-can-i-make-it-so-my-class-variables-can-only-be-set-to-one-of-three-choices/66... | 2011/07/11 | [
"https://Stackoverflow.com/questions/6650176",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/767890/"
] | [Enumerations](http://www.devarticles.com/c/a/C-Sharp/Introduction-to-Objects-and-Classes-in-C-sharp/1/) are essentially unique types that allow you to assign symbolic names to integral values. They are not used for restricting the allowable values of a variable... | >
> If the limitation imposed by the enum definition is so easily broken, what is the point
>
>
>
I think the enum abstraction was not designed with *limitation* or *guarantees* in mind. I think it was designed with *convenience* and *maintainability* in mind
Good reasons:
*Skip the first bullet if you don't wa... |
6,650,176 | When reading [Jon Skeet](https://stackoverflow.com/users/22656/jon-skeet)'s answer to this particular question [How can I make it so my class variables can only be set to one of three choices?](https://stackoverflow.com/questions/6640774/how-can-i-make-it-so-my-class-variables-can-only-be-set-to-one-of-three-choices/66... | 2011/07/11 | [
"https://Stackoverflow.com/questions/6650176",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/767890/"
] | It is allowed any value because you may mark the enum with the "Flags" attribute. That means you may compose any value by OR-ing various members of the enum itself.
Basically the compiler is not smart enough to take care of any possible way where the enum is used.
EDIT: found a previous post by Eric Lippert:
[Why doe... | I don't know about the reasons for this design decision, but we can look at a few of its consequences.
Let's look at the IL representation of an enum:
```
.class private auto ansi sealed MyEnum
extends [mscorlib]System.Enum
{
// Fields
.field public specialname rtspecialname int32 value__
.field publi... |
6,650,176 | When reading [Jon Skeet](https://stackoverflow.com/users/22656/jon-skeet)'s answer to this particular question [How can I make it so my class variables can only be set to one of three choices?](https://stackoverflow.com/questions/6640774/how-can-i-make-it-so-my-class-variables-can-only-be-set-to-one-of-three-choices/66... | 2011/07/11 | [
"https://Stackoverflow.com/questions/6650176",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/767890/"
] | [Enumerations](http://www.devarticles.com/c/a/C-Sharp/Introduction-to-Objects-and-Classes-in-C-sharp/1/) are essentially unique types that allow you to assign symbolic names to integral values. They are not used for restricting the allowable values of a variable... | It is allowed any value because you may mark the enum with the "Flags" attribute. That means you may compose any value by OR-ing various members of the enum itself.
Basically the compiler is not smart enough to take care of any possible way where the enum is used.
EDIT: found a previous post by Eric Lippert:
[Why doe... |
6,650,176 | When reading [Jon Skeet](https://stackoverflow.com/users/22656/jon-skeet)'s answer to this particular question [How can I make it so my class variables can only be set to one of three choices?](https://stackoverflow.com/questions/6640774/how-can-i-make-it-so-my-class-variables-can-only-be-set-to-one-of-three-choices/66... | 2011/07/11 | [
"https://Stackoverflow.com/questions/6650176",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/767890/"
] | [Enumerations](http://www.devarticles.com/c/a/C-Sharp/Introduction-to-Objects-and-Classes-in-C-sharp/1/) are essentially unique types that allow you to assign symbolic names to integral values. They are not used for restricting the allowable values of a variable... | I don't know about the reasons for this design decision, but we can look at a few of its consequences.
Let's look at the IL representation of an enum:
```
.class private auto ansi sealed MyEnum
extends [mscorlib]System.Enum
{
// Fields
.field public specialname rtspecialname int32 value__
.field publi... |
6,650,176 | When reading [Jon Skeet](https://stackoverflow.com/users/22656/jon-skeet)'s answer to this particular question [How can I make it so my class variables can only be set to one of three choices?](https://stackoverflow.com/questions/6640774/how-can-i-make-it-so-my-class-variables-can-only-be-set-to-one-of-three-choices/66... | 2011/07/11 | [
"https://Stackoverflow.com/questions/6650176",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/767890/"
] | It is more questioning in what you can do when enums are not limited to there values:
Flags is one of these examples:
```
[Flags]
enum MyFlag
{
a,
b,
c
}
```
Now you can do bit operations:
```
MyFlag flags = MyFlag.a|MyFlag.b;
``` | I don't know about the reasons for this design decision, but we can look at a few of its consequences.
Let's look at the IL representation of an enum:
```
.class private auto ansi sealed MyEnum
extends [mscorlib]System.Enum
{
// Fields
.field public specialname rtspecialname int32 value__
.field publi... |
6,650,176 | When reading [Jon Skeet](https://stackoverflow.com/users/22656/jon-skeet)'s answer to this particular question [How can I make it so my class variables can only be set to one of three choices?](https://stackoverflow.com/questions/6640774/how-can-i-make-it-so-my-class-variables-can-only-be-set-to-one-of-three-choices/66... | 2011/07/11 | [
"https://Stackoverflow.com/questions/6650176",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/767890/"
] | [Enumerations](http://www.devarticles.com/c/a/C-Sharp/Introduction-to-Objects-and-Classes-in-C-sharp/1/) are essentially unique types that allow you to assign symbolic names to integral values. They are not used for restricting the allowable values of a variable... | It is more questioning in what you can do when enums are not limited to there values:
Flags is one of these examples:
```
[Flags]
enum MyFlag
{
a,
b,
c
}
```
Now you can do bit operations:
```
MyFlag flags = MyFlag.a|MyFlag.b;
``` |
41,666,698 | I have created a javascript regular expression in order to validate comments entered by users in my app. The regex allows letters, numbers some special symbols and a range of emojis
I received help [here](https://stackoverflow.com/questions/41433382/can-you-help-me-alter-my-regular-expression-to-include-a-particular-r... | 2017/01/15 | [
"https://Stackoverflow.com/questions/41666698",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2686581/"
] | You seem to misunderstand the meaning of `new` in (dynamic) array; you are using
`array = new int[input];` as if this would append a new slot to an array and set the value then to `input`.
Do two steps:
First, as soon as you know how many items the array shall hold, reserve memory for it (e.g. like `array = new int[a... | I see at least three approaches. The first one is the following
```
int n;
cout << "Enter the number of integers: ";
cin >> n;
int input;
int* array = new int[n];
for(int i = 0; i < n; i++){
cout << "Enter your integer:" << endl;
cin >> input;
array[i] = input;
}
for(int i = 0; i < n; i++){
cout <<... |
41,666,698 | I have created a javascript regular expression in order to validate comments entered by users in my app. The regex allows letters, numbers some special symbols and a range of emojis
I received help [here](https://stackoverflow.com/questions/41433382/can-you-help-me-alter-my-regular-expression-to-include-a-particular-r... | 2017/01/15 | [
"https://Stackoverflow.com/questions/41666698",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2686581/"
] | You seem to misunderstand the meaning of `new` in (dynamic) array; you are using
`array = new int[input];` as if this would append a new slot to an array and set the value then to `input`.
Do two steps:
First, as soon as you know how many items the array shall hold, reserve memory for it (e.g. like `array = new int[a... | your problem simply you are trying to put your numbers values into size of your array and you are not storing them inside it.
also in each iteration you initialize array with the inputs values `array = new int[input];`
so it will reserve size from memory in each iteration according to your inputs values and when you ... |
9,139,483 | I'm sorry if this thread will be considered as subjective, but my question is more on the technical side.
I'm working with C# in the Framework .Net 4.0. I spent a few years playing with C++ and I've received an education where variables that were not initialized got me a kick in the butt.
Today, each time I see a uni... | 2012/02/04 | [
"https://Stackoverflow.com/questions/9139483",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/174129/"
] | >
> I want to know, if, in C#, ALL variables are automatically
> initialized, or if there are some cases where there are not
>
>
>
When you declare a reference type variable like instance of `SomeClass`, it's default value will be `null`. Your variable will get initialized once you allocate some memory for it usi... | In C# you won't have a problem with uninitialized variables having random values like you do in C/C++.
Some variables (fields/statics for example) are guaranteed to be initialized to their default value (generally null/0), and the compiler give you [an error](http://msdn.microsoft.com/en-us/library/4y7h161d(v=vs.100)... |
9,139,483 | I'm sorry if this thread will be considered as subjective, but my question is more on the technical side.
I'm working with C# in the Framework .Net 4.0. I spent a few years playing with C++ and I've received an education where variables that were not initialized got me a kick in the butt.
Today, each time I see a uni... | 2012/02/04 | [
"https://Stackoverflow.com/questions/9139483",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/174129/"
] | >
> I want to know, if, in C#, ALL variables are automatically
> initialized, or if there are some cases where there are not
>
>
>
When you declare a reference type variable like instance of `SomeClass`, it's default value will be `null`. Your variable will get initialized once you allocate some memory for it usi... | Initializing or not initializing a variable in C# depends on what you want to achieve, and both options are valid in different situations.
Take, for example, a class that exposes some properties and you wish the properties to have a default value:
```
public class X
{
private object _propertyName;
public ob... |
9,139,483 | I'm sorry if this thread will be considered as subjective, but my question is more on the technical side.
I'm working with C# in the Framework .Net 4.0. I spent a few years playing with C++ and I've received an education where variables that were not initialized got me a kick in the butt.
Today, each time I see a uni... | 2012/02/04 | [
"https://Stackoverflow.com/questions/9139483",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/174129/"
] | In C# you won't have a problem with uninitialized variables having random values like you do in C/C++.
Some variables (fields/statics for example) are guaranteed to be initialized to their default value (generally null/0), and the compiler give you [an error](http://msdn.microsoft.com/en-us/library/4y7h161d(v=vs.100)... | Initializing or not initializing a variable in C# depends on what you want to achieve, and both options are valid in different situations.
Take, for example, a class that exposes some properties and you wish the properties to have a default value:
```
public class X
{
private object _propertyName;
public ob... |
4,871,187 | I want to connect the ms access database in c# through ado.net at windows server 2008 R2 standard.
```
using System.Data.OleDb;
OleDbConnection connectionAccess = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\\testTable.mdb");
OleDbDataAdapter adapterAccess = new OleDbDataAdapter("Select * fro... | 2011/02/02 | [
"https://Stackoverflow.com/questions/4871187",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/599509/"
] | The problem might be of the Platform. The Jet OLEDB only supports x86 (32 bit OS) and not x64 64 (bit). There is not a 64 bit version of jet that is why you get that error.
To force your app to use the 32 bit change the target cpu to x86 in the advanced compiler options in visual studio.
This [similar question on MS... | This could be because of a windows user seucrity setting issue,check the rights over the path etc. |
71,002 | I understand that they're soldiers for life. But I don't recall them taking an oath that bans this type of relationship. We were shown that they do have free time when Fives visits the clone bar. | 2014/10/20 | [
"https://scifi.stackexchange.com/questions/71002",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/35105/"
] | In the show, there is no evidence of clones having a romantic relationship besides Cut Lawquane, but he did desert, so that negates him as an example. While there are no instances where a clone is reprimanded for having one, that does not mean that clones don't have romantic relationships.
But, due to the lack of exam... | Actually, in the episode with Cut, he said they were programmed not to have any relationship. I think. |
71,002 | I understand that they're soldiers for life. But I don't recall them taking an oath that bans this type of relationship. We were shown that they do have free time when Fives visits the clone bar. | 2014/10/20 | [
"https://scifi.stackexchange.com/questions/71002",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/35105/"
] | In the show, there is no evidence of clones having a romantic relationship besides Cut Lawquane, but he did desert, so that negates him as an example. While there are no instances where a clone is reprimanded for having one, that does not mean that clones don't have romantic relationships.
But, due to the lack of exam... | Clone troopers were not programmed against relationships or were altered against physical relationships because the Kaminoans found that those that were made poorer troopers. However, most clones had a very limited chance to actually pursue any kind of relationship due to the demands of the war and the fact that clones... |
71,002 | I understand that they're soldiers for life. But I don't recall them taking an oath that bans this type of relationship. We were shown that they do have free time when Fives visits the clone bar. | 2014/10/20 | [
"https://scifi.stackexchange.com/questions/71002",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/35105/"
] | In the show, there is no evidence of clones having a romantic relationship besides Cut Lawquane, but he did desert, so that negates him as an example. While there are no instances where a clone is reprimanded for having one, that does not mean that clones don't have romantic relationships.
But, due to the lack of exam... | Possibly.
---------
79's, the clone bar that you mentioned, was frequented by quite a few female non-clones.
At least one female patron seemed to be on the prowl, commenting this upon seeing Rako Hardeen.
>
> Wow, I want to check his midi-chlorian count.
>
>
> |
71,002 | I understand that they're soldiers for life. But I don't recall them taking an oath that bans this type of relationship. We were shown that they do have free time when Fives visits the clone bar. | 2014/10/20 | [
"https://scifi.stackexchange.com/questions/71002",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/35105/"
] | Clone troopers were not programmed against relationships or were altered against physical relationships because the Kaminoans found that those that were made poorer troopers. However, most clones had a very limited chance to actually pursue any kind of relationship due to the demands of the war and the fact that clones... | Actually, in the episode with Cut, he said they were programmed not to have any relationship. I think. |
71,002 | I understand that they're soldiers for life. But I don't recall them taking an oath that bans this type of relationship. We were shown that they do have free time when Fives visits the clone bar. | 2014/10/20 | [
"https://scifi.stackexchange.com/questions/71002",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/35105/"
] | Possibly.
---------
79's, the clone bar that you mentioned, was frequented by quite a few female non-clones.
At least one female patron seemed to be on the prowl, commenting this upon seeing Rako Hardeen.
>
> Wow, I want to check his midi-chlorian count.
>
>
> | Actually, in the episode with Cut, he said they were programmed not to have any relationship. I think. |
12,362,502 | I've just upgraded to Mountain Lion so I can use some of the C++11 features on the new version of Clang that comes with xcode. I'm using cmake 2.8.9 from Homebrew.
I've made a very simple CMake project which adds the compiler flags for C++11:
```
# CMakeLists.txt
cmake_minimum_required(VERSION 2.8)
add_executable(tes... | 2012/09/11 | [
"https://Stackoverflow.com/questions/12362502",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/779577/"
] | I'm not sure that [`ADD_DEFINITIONS`](http://www.cmake.org/cmake/help/cmake2.6docs.html#command%3aadd_definitions) is the right tool for this particular job.
Perhaps a better option is to set the value of [`CMAKE_CXX_FLAGS`](http://www.cmake.org/Wiki/CMake_Useful_Variables#Compilers_and_Tools) directly:
```
cmake_mi... | Go to your project targets->Apple LLVM compiler 4.1 - Language->select c++library to
```
libc__(LLVM C++ stadard library with c++ 11 support);
``` |
12,362,502 | I've just upgraded to Mountain Lion so I can use some of the C++11 features on the new version of Clang that comes with xcode. I'm using cmake 2.8.9 from Homebrew.
I've made a very simple CMake project which adds the compiler flags for C++11:
```
# CMakeLists.txt
cmake_minimum_required(VERSION 2.8)
add_executable(tes... | 2012/09/11 | [
"https://Stackoverflow.com/questions/12362502",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/779577/"
] | I'm not sure that [`ADD_DEFINITIONS`](http://www.cmake.org/cmake/help/cmake2.6docs.html#command%3aadd_definitions) is the right tool for this particular job.
Perhaps a better option is to set the value of [`CMAKE_CXX_FLAGS`](http://www.cmake.org/Wiki/CMake_Useful_Variables#Compilers_and_Tools) directly:
```
cmake_mi... | I saw this error when running `gcc` rather than `g++`. If I use `g++`, things compile correctly. Perhaps your Makefile is using the wrong compiler front end. |
12,362,502 | I've just upgraded to Mountain Lion so I can use some of the C++11 features on the new version of Clang that comes with xcode. I'm using cmake 2.8.9 from Homebrew.
I've made a very simple CMake project which adds the compiler flags for C++11:
```
# CMakeLists.txt
cmake_minimum_required(VERSION 2.8)
add_executable(tes... | 2012/09/11 | [
"https://Stackoverflow.com/questions/12362502",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/779577/"
] | I'm not sure that [`ADD_DEFINITIONS`](http://www.cmake.org/cmake/help/cmake2.6docs.html#command%3aadd_definitions) is the right tool for this particular job.
Perhaps a better option is to set the value of [`CMAKE_CXX_FLAGS`](http://www.cmake.org/Wiki/CMake_Useful_Variables#Compilers_and_Tools) directly:
```
cmake_mi... | After getting this error recently (using Clang) the problem was in not passing `-std=c++11 -stdlib=libc++` as linker flags too.
So they have to be passed both as compiler flags **and** as linker flags.
For GCC the first flag is `-std=c++0x`, instead of `-std=c++11`. |
12,362,502 | I've just upgraded to Mountain Lion so I can use some of the C++11 features on the new version of Clang that comes with xcode. I'm using cmake 2.8.9 from Homebrew.
I've made a very simple CMake project which adds the compiler flags for C++11:
```
# CMakeLists.txt
cmake_minimum_required(VERSION 2.8)
add_executable(tes... | 2012/09/11 | [
"https://Stackoverflow.com/questions/12362502",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/779577/"
] | I'm not sure that [`ADD_DEFINITIONS`](http://www.cmake.org/cmake/help/cmake2.6docs.html#command%3aadd_definitions) is the right tool for this particular job.
Perhaps a better option is to set the value of [`CMAKE_CXX_FLAGS`](http://www.cmake.org/Wiki/CMake_Useful_Variables#Compilers_and_Tools) directly:
```
cmake_mi... | For me the answer was simply using `clang++` instead of `clang`. |
12,362,502 | I've just upgraded to Mountain Lion so I can use some of the C++11 features on the new version of Clang that comes with xcode. I'm using cmake 2.8.9 from Homebrew.
I've made a very simple CMake project which adds the compiler flags for C++11:
```
# CMakeLists.txt
cmake_minimum_required(VERSION 2.8)
add_executable(tes... | 2012/09/11 | [
"https://Stackoverflow.com/questions/12362502",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/779577/"
] | Go to your project targets->Apple LLVM compiler 4.1 - Language->select c++library to
```
libc__(LLVM C++ stadard library with c++ 11 support);
``` | After getting this error recently (using Clang) the problem was in not passing `-std=c++11 -stdlib=libc++` as linker flags too.
So they have to be passed both as compiler flags **and** as linker flags.
For GCC the first flag is `-std=c++0x`, instead of `-std=c++11`. |
12,362,502 | I've just upgraded to Mountain Lion so I can use some of the C++11 features on the new version of Clang that comes with xcode. I'm using cmake 2.8.9 from Homebrew.
I've made a very simple CMake project which adds the compiler flags for C++11:
```
# CMakeLists.txt
cmake_minimum_required(VERSION 2.8)
add_executable(tes... | 2012/09/11 | [
"https://Stackoverflow.com/questions/12362502",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/779577/"
] | Go to your project targets->Apple LLVM compiler 4.1 - Language->select c++library to
```
libc__(LLVM C++ stadard library with c++ 11 support);
``` | For me the answer was simply using `clang++` instead of `clang`. |
12,362,502 | I've just upgraded to Mountain Lion so I can use some of the C++11 features on the new version of Clang that comes with xcode. I'm using cmake 2.8.9 from Homebrew.
I've made a very simple CMake project which adds the compiler flags for C++11:
```
# CMakeLists.txt
cmake_minimum_required(VERSION 2.8)
add_executable(tes... | 2012/09/11 | [
"https://Stackoverflow.com/questions/12362502",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/779577/"
] | I saw this error when running `gcc` rather than `g++`. If I use `g++`, things compile correctly. Perhaps your Makefile is using the wrong compiler front end. | After getting this error recently (using Clang) the problem was in not passing `-std=c++11 -stdlib=libc++` as linker flags too.
So they have to be passed both as compiler flags **and** as linker flags.
For GCC the first flag is `-std=c++0x`, instead of `-std=c++11`. |
12,362,502 | I've just upgraded to Mountain Lion so I can use some of the C++11 features on the new version of Clang that comes with xcode. I'm using cmake 2.8.9 from Homebrew.
I've made a very simple CMake project which adds the compiler flags for C++11:
```
# CMakeLists.txt
cmake_minimum_required(VERSION 2.8)
add_executable(tes... | 2012/09/11 | [
"https://Stackoverflow.com/questions/12362502",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/779577/"
] | I saw this error when running `gcc` rather than `g++`. If I use `g++`, things compile correctly. Perhaps your Makefile is using the wrong compiler front end. | For me the answer was simply using `clang++` instead of `clang`. |
41,817,403 | I have an app with models we'll call Box, Stock, Experiment, & Sample. Here are what the ActiveRecord relationships look like:
```
class Box
has_many :stocks
accepts_nested_attributes_for :stocks
end
class Stock
belongs_to :box
has_many :samples
end
class Experiment
has_many :samples
accepts_nested_attri... | 2017/01/23 | [
"https://Stackoverflow.com/questions/41817403",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3791138/"
] | seems a bit late but I came through a google link so maybe it will help others.
To archive passing further arguments like a key as Narayanan wants, the first way is by using the `.withArgs` function as it is describe in the [docs](https://buildbot.readthedocs.io/en/latest/manual/configuration/properties.html#renderer)... | Property() function takes property name as parameter.
You need [Renderer](http://docs.buildbot.net/latest/manual/cfg-properties.html#renderer) which allows to use arbitrary Python code.
For example, write renderer:
```
@util.renderer
def dictionary_value(props):
mydictionary = props.getProperty('mydictionary')
... |
11,021,871 | I have a web page that prompts for user input via DropDownLists in some table cells. When a selection is made the selection replaces the DropDownList so that the action can only be performed once. In the case that a change needs to be made I want to be able to click a button that reloads the page from scratch. I have G... | 2012/06/13 | [
"https://Stackoverflow.com/questions/11021871",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1429069/"
] | Put a link on the page with the text "Reload" and the url the url of the page. It's perfectly valid to have a page with a link to itself.
If you don't like the link idea, use a standard Button and in the click event, use Response.Redirect to redirect to the current page. | You can set an OnClick for your button that resets each DropDownList's SelectedIndex to 0 instead of reloading the page from scratch. Alternatively, you can set a Response.Redirect([the page's url]) into the OnClick as is suggested [here](http://www.velocityreviews.com/forums/t232190-how-to-clear-viewstate-in-aspx-or-a... |
51,296,227 | I am trying to combine consecutive values in pandas to create a new output dataframe and could use some help.
Input:
```
depth type
0 50 0
1 100 1
2 150 1
3 200 1
4 250 0
5 300 0
6 350 0
7 400 1
8 450 1
9 500 0
```
Output:
```
start_depth stop_... | 2018/07/12 | [
"https://Stackoverflow.com/questions/51296227",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7577404/"
] | Following Wen's suggestion of `agg min/max`:
```
c=(df.type != df.type.shift()).cumsum().values
ndf = df.groupby([c, 'type']).depth.agg(['min','max']).reset_index(level=1)
type start end
1 0 50 50
2 1 100 200
3 0 250 350
4 1 400 450
5 0 500 500
```
to get ju... | Here is my solution , usig `agg`
```
df.loc[df.type==1,:].groupby(df.type.eq(0).cumsum()).agg({'depth':['min','max'],'type':'first'})
Out[42]:
type depth
first min max
type
1 1 100 200
4 1 400 450
``` |
14,946,018 | I'm creating a Page Dynamically in ASP.NET and i want to load a Control inside the form but everytime I try to Add it to Page.Form.Controls the Form is null and gives out a NullReference
```
Page myPage = new Page();
FormAtt ctrl = (FormAtt)myPage.LoadControl("path/to/my/file.ascx");
myPage.Form.Controls.Add(ctrl);
`... | 2013/02/18 | [
"https://Stackoverflow.com/questions/14946018",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/408729/"
] | Look like UserControl file path is not correct.
Could you try this
```
string path = HttpContext.Current.Request.ApplicationPath == "/" ?
string.Empty : HttpContext.Current.Request.ApplicationPath;
... (FormAtt)myPage.LoadControl(path + "/path/to/my/file.ascx");
```
If it still doesn't work, where is your fi... | `Page myPage = new Page();` is almost definitely not what you want here. It sounds like you want to load your control into the current page, which would just be `Page.Controls.Add(ctrl)`.
Your title and question are both pretty clear about creating a Page though, so maybe you should explain the big picture more. |
42,909,805 | I'm experiencing issues with duplicated Typescript type declarations in the following case:
I've got the following dependency tree for my application A:
```
A->@angular/http:2.3.1
A->B->@angular/http:2.3.1
```
Both A and B are managed by npm. After running
```
npm install
```
the filesystem looks like this:
`... | 2017/03/20 | [
"https://Stackoverflow.com/questions/42909805",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1165421/"
] | Meanwhile I found out that you can fix this error by explicitly importing the according types inside the using class of A. In my case (cp. error message above), I needed to:
```
import {Response, Headers} from '@angular/http';
``` | I had the same problem. There are basically two ways to solve this.
1. Make a UMD module of project B. This might take a lot of time
2. use `as any as TheRequiredObject` see below.
Let assume you got this class in project b:
```
export class B{
getSome(): Observable {
return this.http.get('some_url');
... |
20,007,124 | I've a String like following:
```
var str = '35,35,105,105,130,208,50,250';
```
I would like to split this string and get like this:
```
var arr = [[35,35],[105,105],[130,208],[50,250]];
```
I tried some ways, but none of them give me anything. I tried with looping to find the even comma position and split, but t... | 2013/11/15 | [
"https://Stackoverflow.com/questions/20007124",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1389604/"
] | One possible approach:
```
'35,35,105,105,130,208,50,250'.match(/\d+,\d+/g).map(function(s) {
return s.split(',');
});
```
Another crazy idea in one line:
```
JSON.parse('['+ '35,35,105,105,130,208,50,250'.replace(/\d+,\d+/g, '[$&]') +']');
``` | Here's one way to do it.
```
var values = str.split(','),
output = [];
while(values.length)
output.push(values.splice(0,2));
```
If `str` contains an odd number of values, the last array in output will contain only one value using this method. |
5,019,247 | I'm trying to decide whether to implement an application in Ruby or Clojure. Two of the requirements involve parallel processing:
1. The app must make parallel calls to fetch XML feeds and other types of data over the internet. Many such calls are made, and serializing the calls is inefficient.
2. The responses to tho... | 2011/02/16 | [
"https://Stackoverflow.com/questions/5019247",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/232417/"
] | Here's a simple little example of one way to do this. Note that there's nothing limiting the number of threads it creates at once, so you might want to create some sort of thread pool if you're running lots of threads.
```
[1,2,3].map{|x| Thread.start{x+1}}.map{|t| t.join.value}
``` | I think the choice of implementation language depends on your application.
If you are network bound, Ruby should work fine. You might find it easier to implement concurrent requests using a [reactor pattern](http://en.wikipedia.org/wiki/Reactor_pattern) with [EventMachine](https://github.com/eventmachine/eventmachine... |
5,019,247 | I'm trying to decide whether to implement an application in Ruby or Clojure. Two of the requirements involve parallel processing:
1. The app must make parallel calls to fetch XML feeds and other types of data over the internet. Many such calls are made, and serializing the calls is inefficient.
2. The responses to tho... | 2011/02/16 | [
"https://Stackoverflow.com/questions/5019247",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/232417/"
] | Making the `pmap` function reusable is similarly simple:
```
module Enumerable
def pmap
map {|x| Thread.start {yield x}}.map {|t| t.join.value}
end
end
```
But, of course, using a proper thread pool / executor would probably be a good idea. Here’s [an example](http://eigenclass.org/hiki/simple+concurrency+ru... | I think the choice of implementation language depends on your application.
If you are network bound, Ruby should work fine. You might find it easier to implement concurrent requests using a [reactor pattern](http://en.wikipedia.org/wiki/Reactor_pattern) with [EventMachine](https://github.com/eventmachine/eventmachine... |
16,480,827 | Consider the code below:
```
string ConnectionString = "dsn=mysql;uid=sa;DATABASE=userdb;";
string qryStr = "insert into info(code) values(@code);";
OdbcConnection con = new OdbcConnection(ConnectionString);
OdbcCommand cmd = new OdbcCommand(qryStr,con );
cmd.Parameters.Add("@code", System.Data.Odbc.OdbcType.Int).Valu... | 2013/05/10 | [
"https://Stackoverflow.com/questions/16480827",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1122702/"
] | I've finally found the solution as given in [this](http://forums.asp.net/t/1090296.aspx/2/10) link.
**The Odbc interface does not recognise the use of @named variables, only ? which are taken by position. You can use ?Param1, ?Param 2 for readability, but the position is all that is used.** | Try
```
string ConnectionString = "dsn=mysql;uid=sa;DATABASE=userdb;";
string qryStr = "insert into info(code) values(?code);";
OdbcConnection con = new OdbcConnection(ConnectionString);
OdbcCommand cmd = new OdbcCommand(qryStr,con );
cmd.Parameters.Add("@code", System.Data.Odbc.OdbcType.Int).Value = 999;
cmd.Connecti... |
16,480,827 | Consider the code below:
```
string ConnectionString = "dsn=mysql;uid=sa;DATABASE=userdb;";
string qryStr = "insert into info(code) values(@code);";
OdbcConnection con = new OdbcConnection(ConnectionString);
OdbcCommand cmd = new OdbcCommand(qryStr,con );
cmd.Parameters.Add("@code", System.Data.Odbc.OdbcType.Int).Valu... | 2013/05/10 | [
"https://Stackoverflow.com/questions/16480827",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1122702/"
] | Try
```
string ConnectionString = "dsn=mysql;uid=sa;DATABASE=userdb;";
string qryStr = "insert into info(code) values(?code);";
OdbcConnection con = new OdbcConnection(ConnectionString);
OdbcCommand cmd = new OdbcCommand(qryStr,con );
cmd.Parameters.Add("@code", System.Data.Odbc.OdbcType.Int).Value = 999;
cmd.Connecti... | **Worked 100% please try this**
```
byte[] imageDatas = ReadFile(strFn);
try
{
if (con.State == ConnectionState.Open)
{
con.Close();
}
con.Open();
OdbcCommand cmd = new OdbcCommand("insert into students(id,name,img) values(" + txtId.Text + ",'" + txtName.Text + "',?)", con);
cmd.Parame... |
16,480,827 | Consider the code below:
```
string ConnectionString = "dsn=mysql;uid=sa;DATABASE=userdb;";
string qryStr = "insert into info(code) values(@code);";
OdbcConnection con = new OdbcConnection(ConnectionString);
OdbcCommand cmd = new OdbcCommand(qryStr,con );
cmd.Parameters.Add("@code", System.Data.Odbc.OdbcType.Int).Valu... | 2013/05/10 | [
"https://Stackoverflow.com/questions/16480827",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1122702/"
] | I've finally found the solution as given in [this](http://forums.asp.net/t/1090296.aspx/2/10) link.
**The Odbc interface does not recognise the use of @named variables, only ? which are taken by position. You can use ?Param1, ?Param 2 for readability, but the position is all that is used.** | **Worked 100% please try this**
```
byte[] imageDatas = ReadFile(strFn);
try
{
if (con.State == ConnectionState.Open)
{
con.Close();
}
con.Open();
OdbcCommand cmd = new OdbcCommand("insert into students(id,name,img) values(" + txtId.Text + ",'" + txtName.Text + "',?)", con);
cmd.Parame... |
90,077 | A lot of people recommend using `Ed25519` instead of `RSA` keys for SSH.
The introduction page of `Ed25519` (<http://ed25519.cr.yp.to/>) says:
`[..] breaking it has similar difficulty to breaking [..] RSA with ~3000-bit keys [..]`
So speaking **only** of security (not speed!), why should one *not* prefer `RSA 4096... | 2015/05/25 | [
"https://security.stackexchange.com/questions/90077",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/60931/"
] | Key strengths, and their equivalences, become meaningless when they reach the zone of "cannot be broken with existing and foreseeable technology", because there is no such thing as more secure than that. It is a common reflex to try to think of key sizes as providing some sort of security margin, but this kind of reaso... | According to [gitlab](https://gitlab.com/help/ssh/README#ed25519-ssh-keys)
>
> The book Practical Cryptography With Go suggests that ED25519 keys are more secure and performant than RSA keys.
>
>
>
and [recommends](https://gitlab.com/help/ssh/README#rsa-ssh-keys)
>
> If you use RSA keys for SSH ... that you use... |
28,329,465 | Am just wondering if there is a way to save data into a text file without being overwritten.
Currently i am using sharedpreferences and it overwrites the data which is okay but coinciding with this, i want somewhere where i can keep record of the value before being overwritten in a list or column form.
So it goes so... | 2015/02/04 | [
"https://Stackoverflow.com/questions/28329465",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4375010/"
] | Generally Gettext uses @ to distinguish language variants. So in this case it could be `de_DE@informal`. This way the locale will be correctly handled by Gettext with fallback to `de_DE` (in contrast with suggested `de_DE-x-informal` which will not fall back this way as Gettext will see `DE-x-informal` as country code)... | Language tags as defined in [BCP 47](https://www.rfc-editor.org/rfc/rfc5646) (currently RFC 5646) do not specify any codes for informal vs. formal variants of German. It would probably be unrealistic to try to have such codes registered, so you would be limited to Private Use subtags, e.g. de-x-formal vs. de-x-informal... |
28,329,465 | Am just wondering if there is a way to save data into a text file without being overwritten.
Currently i am using sharedpreferences and it overwrites the data which is okay but coinciding with this, i want somewhere where i can keep record of the value before being overwritten in a list or column form.
So it goes so... | 2015/02/04 | [
"https://Stackoverflow.com/questions/28329465",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4375010/"
] | Generally Gettext uses @ to distinguish language variants. So in this case it could be `de_DE@informal`. This way the locale will be correctly handled by Gettext with fallback to `de_DE` (in contrast with suggested `de_DE-x-informal` which will not fall back this way as Gettext will see `DE-x-informal` as country code)... | Since you asked about WooCommerce, explaining the current state of how WordPress handles it is probably most relevant:
The best approach is to use [locale variants](https://www.gnu.org/software/gettext/manual/html_node/Locale-Names.html) as Michal wrote, but WordPress has its own unique twist on it and don’t use the v... |
20,519,260 | I have a graph which has data points for each day, but I'm dissatisfied with the default setup of the x axis.
The default x-axis picks out a selection of points to label, e.g. with `xAxis.ticks(d3.time.month);` it will label the 1st of each month with the name of that month:
```
|-------|-------|-------|-------|---... | 2013/12/11 | [
"https://Stackoverflow.com/questions/20519260",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6691/"
] | To make them appear in the middle of the range, you would need to add an offset (dx) to the `text` elements. This offset would be equal to half the size of an interval, which you can compute dynamically.
Here's an [example](http://bl.ocks.org/mbostock/6186172) that does something very similar. | I had the same problem and solved it by using another scale for the X-axis that is shifted 15 days.
```
// scale is your usual x scale. change dates on the domain by 15 days
var d0 = scale.domain()[0];
d0.setDate(d0.getDate() - 15);
var d1 = scale.domain()[1];
d1.setDate(d1.getDate() - 15);
// use this new x scale fo... |
20,519,260 | I have a graph which has data points for each day, but I'm dissatisfied with the default setup of the x axis.
The default x-axis picks out a selection of points to label, e.g. with `xAxis.ticks(d3.time.month);` it will label the 1st of each month with the name of that month:
```
|-------|-------|-------|-------|---... | 2013/12/11 | [
"https://Stackoverflow.com/questions/20519260",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6691/"
] | (2019) Using latest d3v5, other stackoverflow responses, [1](https://stackoverflow.com/questions/17221755/is-it-possible-to-find-the-distance-between-ticks-in-d3-js#), and [mbostock trick to select and edit the labels text property](https://bl.ocks.org/mbostock/6186172), [axis styling](https://bl.ocks.org/mbostock/3371... | I had the same problem and solved it by using another scale for the X-axis that is shifted 15 days.
```
// scale is your usual x scale. change dates on the domain by 15 days
var d0 = scale.domain()[0];
d0.setDate(d0.getDate() - 15);
var d1 = scale.domain()[1];
d1.setDate(d1.getDate() - 15);
// use this new x scale fo... |
57,773,156 | I try to add a radio button to my vendor view, after installing my module there are no changes in my view.
I wish you can help me
1/ my file.py
```
# -*- coding: utf-8 -*-
from odoo import fields, models, api
class Vendor(models.Model):
_inherit = 'res.partner'
type = fields.selection([('internal', 'Interna... | 2019/09/03 | [
"https://Stackoverflow.com/questions/57773156",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5997502/"
] | It's because there is no row where `Denumire` *equals* `'NGT2-65/201-32/1.3-72(DO) BMT 65 ,radial tool holder, DOOSAN'`. However, there is a row where `Denumire` *starts* with that value. The `%` on the end with [`LIKE`](https://learn.microsoft.com/en-us/sql/t-sql/language-elements/like-transact-sql?view=sql-server-201... | `LIKE` is the ANSI/ISO standard operator for comparing a column value to another column value, or to a quoted string.
It returns either 1 (TRUE) or 0 (FALSE).
The equals to(`=`) operator is a comparison operator and used for equality test within two numbers or expressions.
`LIKE` is generally used only with strings h... |
69,441,558 | i am trying to display data from a nested JSON object. The data is retrieved correctly from axios but I dont get it to be displayed.
The json object looks like this:
```json
{
"id": "1",
"name": "Germany",
"continent": "Europe",
"president": {
"id": "12",
"name"... | 2021/10/04 | [
"https://Stackoverflow.com/questions/69441558",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5057987/"
] | Patterns in `MATCH_RECOGNIZE` work in a similar fashion to regular expressions; you want something like:
*(Note: your `PIERCING_LINE` formula does not give the expected output so I have assumed you want `C > (C1 + O1)/2` rather than `C > C1 + (O1/2)`.)*
```sql
SELECT *
FROM raw_source
MATCH_RECOGNIZE (
PARTITION ... | I've upvoted @MT0's answer and I would use `match_recognize` for this sort of thing myself since this is squarely the sort of problem it is designed to deal with. However, `match_recognize` is a pretty sophisticated construct and the patterns you're looking for are pretty simple. So as expressed, you could solve your p... |
10,726,016 | I've been assigned to document some new code, and I can't figure out how the code below works. This is the new `Sub` for a public class.
I am guessing that "r" stands for row, but how are the three properties getting the data? I can't find anything in the code that would help shed light on this.
```
Protected Sub Ne... | 2012/05/23 | [
"https://Stackoverflow.com/questions/10726016",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/880874/"
] | This is a constructor - it's getting a DataRow passed to it ("r"), and using the values of the fields within that row to initialize its properties.
Basically, when this type is created, you have to pass it a `DataRow` that's already initialized (and has all of the values). The three properties (`UserID`, `WorkID`, and... | `r` is a [DataRow](http://msdn.microsoft.com/en-us/library/system.data.datarow.aspx). It has an extension method of `.Field`:
```
WorkID = r.Field(Of Int32)("workID")
```
It means: set `WorkID` to the value of the column in the data row with the name "workID" and the type of that value is `Int32`. |
33,252,995 | I am using Apache Solr for implementing searching functionality in my application. I have one column which defines the price of services offered by application in respect of different vendors. For Example: there is a service XYZ. And there are many providers that provide XYZ service with different prices.
```
----... | 2015/10/21 | [
"https://Stackoverflow.com/questions/33252995",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/997482/"
] | If your index is not distributed, the Solr Stats component can do this. Just request percentile 50: <https://cwiki.apache.org/confluence/display/solr/The+Stats+Component> | Solr does not provide a ready function. But you can try writting a custom function query for the same.
Below is the link which may help you to achieve the same.
<http://www.solrtutorial.com/custom-solr-functionquery.html> |
1,413 | Or is it okay for the secondary fermentation to be colder than primary? | 2010/02/02 | [
"https://homebrew.stackexchange.com/questions/1413",
"https://homebrew.stackexchange.com",
"https://homebrew.stackexchange.com/users/160/"
] | If all you're doing with the secondary is conditioning the beer, i.e. letting the flavors develop and whatnot, it can be cooler. If you're trying to let the yeast continue to ferment out the last few gravity points, it's best to leave it around the same temperature. If the yeast are fermenting and you drop the temperat... | The suggested fermenting temperatures really are to create optimal conditions for the yeast to thrive in your fermenter. I usually let the gravity ferment out first before racking to secondary where it basically conditions. When racking, I leave much of the yeast sediment in the primary because it has done its job. |
7,091,781 | Could anyone please explain what and how this code below is doing/working?
```
RoleEnvironment.Chaning += RoleEnvironmentChaning;
private void RoleEnvironmentChanaing(object sender, RoleEnvironmentchaningnEventArgs e)
{
......
}
```
basically, if you could walk me through how event handling works in c#.net will b... | 2011/08/17 | [
"https://Stackoverflow.com/questions/7091781",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/656348/"
] | Basically that's saying: whenever the RoleEnviroment decided to trigger the "changing" event, call that method. (I assume it should be Changing rather than Chaning or Chanaing as per your code.)
In other words, events in C# are an implementation of the [publisher/subscriber](http://en.wikipedia.org/wiki/Publish/subscr... | Some first page search results:
<http://www.codeproject.com/KB/cs/csevents01.aspx>
<http://www.c-sharpcorner.com/UploadFile/ddutta/EventHandlingInNetUsingCS11092005052726AM/EventHandlingInNetUsingCS.aspx>
<http://msdn.microsoft.com/en-us/library/aa645739%28VS.71%29.aspx> |
7,091,781 | Could anyone please explain what and how this code below is doing/working?
```
RoleEnvironment.Chaning += RoleEnvironmentChaning;
private void RoleEnvironmentChanaing(object sender, RoleEnvironmentchaningnEventArgs e)
{
......
}
```
basically, if you could walk me through how event handling works in c#.net will b... | 2011/08/17 | [
"https://Stackoverflow.com/questions/7091781",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/656348/"
] | Let's forget about C# for a second and think about the following scenario.
You have a button on the screen that you want the user to click, you don't know when the user will click the button and neither do you want to check constantly if the user has clicked the button. What you want to do is run a bit of custom code w... | Some first page search results:
<http://www.codeproject.com/KB/cs/csevents01.aspx>
<http://www.c-sharpcorner.com/UploadFile/ddutta/EventHandlingInNetUsingCS11092005052726AM/EventHandlingInNetUsingCS.aspx>
<http://msdn.microsoft.com/en-us/library/aa645739%28VS.71%29.aspx> |
7,091,781 | Could anyone please explain what and how this code below is doing/working?
```
RoleEnvironment.Chaning += RoleEnvironmentChaning;
private void RoleEnvironmentChanaing(object sender, RoleEnvironmentchaningnEventArgs e)
{
......
}
```
basically, if you could walk me through how event handling works in c#.net will b... | 2011/08/17 | [
"https://Stackoverflow.com/questions/7091781",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/656348/"
] | Let's forget about C# for a second and think about the following scenario.
You have a button on the screen that you want the user to click, you don't know when the user will click the button and neither do you want to check constantly if the user has clicked the button. What you want to do is run a bit of custom code w... | Basically that's saying: whenever the RoleEnviroment decided to trigger the "changing" event, call that method. (I assume it should be Changing rather than Chaning or Chanaing as per your code.)
In other words, events in C# are an implementation of the [publisher/subscriber](http://en.wikipedia.org/wiki/Publish/subscr... |
63,996,152 | I'm trying to get an array of employees and wait for it to finish.
Tried using `DispatchGroup` but nothing seems to happened.
There is two dimensional array the first one is over the employees, the second is on the documents that he successfully received. Then, it should append the `ShiftConst` object to the requeste... | 2020/09/21 | [
"https://Stackoverflow.com/questions/63996152",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9645137/"
] | Your current test is not accurate because it doesn't check if the `num2` contains *other* numbers as well - for example, `9993332` would match as well.
One possibility is to sort the digits, then check that every digit at an index is equal to every digit in the other array:
```js
const toArr = num => [...String(num)]... | You could sort digits get a string and compare with the other string.
```js
function check(a, b) {
return Array.from(a.toString()).sort().join('') === Array.from(b.toString()).sort().join('');
}
console.log(check(3332, 3323));
console.log(check(117, 771));
console.log(check(113, 771));
``` |
70,522,438 | It appears that React does not like when you are setting the app state in a loop, so I was curious as to what the best approach for something like this was?
I have some logic that I am attempting to count the number of times the `input` variable is greater than the `stat` variable in my loop:
```
const [ statTotal, s... | 2021/12/29 | [
"https://Stackoverflow.com/questions/70522438",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1278584/"
] | You can use `querySelectorAll` to select all tds and add your content
```js
const data = [1, 2, 3, 4]
const changeThis = document.querySelectorAll("#changeThis td");
changeThis.forEach((cellItem,idx) => {
cellItem.innerHTML = data[idx];
})
```
```html
<table>
<thead>something</thead>
<tbody>
<tr id="ch... | you can also do that...
```js
const
data = [1, 2, 3, 4]
, changeThis = document.querySelector('#changeThis')
;
let index = 0;
for (let cell of [...changeThis.cells])
{
if ( cell.matches('td'))
cell.textContent = data[index++]
}
```
```html
<table>
<thead>something</thead>
<tbody>
<tr id... |
54,019,677 | I want to use `contains` with search a word that has single space on left and right side. But it is not working..
```
SELECT *
FROM mytable
WHERE Contains(name, ' Hertz ');
```
Any help is appreciated.. | 2019/01/03 | [
"https://Stackoverflow.com/questions/54019677",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10861913/"
] | You Can LTRIM RTRIM the column and can get the values.
```
create table #temp
(
name varchar(50)
)
insert into #temp values(' hertz')
insert into #temp values('hertz ')
insert into #temp values('hertzx')
insert into #temp values('hertz')
select * from #temp where LTRIM(RTRIM(name)) like '%hertz%'
```
If you wan... | Try with this:
```
SELECT *
FROM mytable
WHERE name=' Hertz '
```
If Hertz is just an example, you can use:
```
SELECT *
FROM mytable
WHERE name like ' % '
```
which will return all the names with an space in the first and last position |
54,019,677 | I want to use `contains` with search a word that has single space on left and right side. But it is not working..
```
SELECT *
FROM mytable
WHERE Contains(name, ' Hertz ');
```
Any help is appreciated.. | 2019/01/03 | [
"https://Stackoverflow.com/questions/54019677",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10861913/"
] | You Can LTRIM RTRIM the column and can get the values.
```
create table #temp
(
name varchar(50)
)
insert into #temp values(' hertz')
insert into #temp values('hertz ')
insert into #temp values('hertzx')
insert into #temp values('hertz')
select * from #temp where LTRIM(RTRIM(name)) like '%hertz%'
```
If you wan... | Try as below.
```
SELECT *
FROM mytable
WHERE name LIKE '% Hertz %'
```
[Learn more about like operator](https://www.w3schools.com/sql/sql_like.asp) |
54,019,677 | I want to use `contains` with search a word that has single space on left and right side. But it is not working..
```
SELECT *
FROM mytable
WHERE Contains(name, ' Hertz ');
```
Any help is appreciated.. | 2019/01/03 | [
"https://Stackoverflow.com/questions/54019677",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10861913/"
] | You Can LTRIM RTRIM the column and can get the values.
```
create table #temp
(
name varchar(50)
)
insert into #temp values(' hertz')
insert into #temp values('hertz ')
insert into #temp values('hertzx')
insert into #temp values('hertz')
select * from #temp where LTRIM(RTRIM(name)) like '%hertz%'
```
If you wan... | You could try this
```
SELECT *
FROM mytable
WHERE name Like '% Hertz %'
``` |
54,019,677 | I want to use `contains` with search a word that has single space on left and right side. But it is not working..
```
SELECT *
FROM mytable
WHERE Contains(name, ' Hertz ');
```
Any help is appreciated.. | 2019/01/03 | [
"https://Stackoverflow.com/questions/54019677",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10861913/"
] | You Can LTRIM RTRIM the column and can get the values.
```
create table #temp
(
name varchar(50)
)
insert into #temp values(' hertz')
insert into #temp values('hertz ')
insert into #temp values('hertzx')
insert into #temp values('hertz')
select * from #temp where LTRIM(RTRIM(name)) like '%hertz%'
```
If you wan... | To search with spaces included, you need to enclose your expression within double quotes, like :
```
SELECT *
FROM mytable
WHERE CONTAINS(name, '" Hertz "');
```
Of course this also can be written with LIKE (although it will be less efficient when dealing with large data sets) :
```
SELECT *
FROM mytable
WHERE name... |
54,019,677 | I want to use `contains` with search a word that has single space on left and right side. But it is not working..
```
SELECT *
FROM mytable
WHERE Contains(name, ' Hertz ');
```
Any help is appreciated.. | 2019/01/03 | [
"https://Stackoverflow.com/questions/54019677",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10861913/"
] | You Can LTRIM RTRIM the column and can get the values.
```
create table #temp
(
name varchar(50)
)
insert into #temp values(' hertz')
insert into #temp values('hertz ')
insert into #temp values('hertzx')
insert into #temp values('hertz')
select * from #temp where LTRIM(RTRIM(name)) like '%hertz%'
```
If you wan... | If you use **like** operator, you no need to give spaces between that like below
```
select * from mytable where name like '%her%'
```
And also if you want the data of which having spaces, you can use like below
```
select * from mytable where name like '_%hertz%_'
```
If we use **underscore**, it will skip the p... |
54,019,677 | I want to use `contains` with search a word that has single space on left and right side. But it is not working..
```
SELECT *
FROM mytable
WHERE Contains(name, ' Hertz ');
```
Any help is appreciated.. | 2019/01/03 | [
"https://Stackoverflow.com/questions/54019677",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10861913/"
] | You Can LTRIM RTRIM the column and can get the values.
```
create table #temp
(
name varchar(50)
)
insert into #temp values(' hertz')
insert into #temp values('hertz ')
insert into #temp values('hertzx')
insert into #temp values('hertz')
select * from #temp where LTRIM(RTRIM(name)) like '%hertz%'
```
If you wan... | Try this
```
Select * from mytable where replace(name,' ','')='Hertz'
```
You can also use `ltrim` & `rtrim` to remove spaces at run time to match the name values. |
54,019,677 | I want to use `contains` with search a word that has single space on left and right side. But it is not working..
```
SELECT *
FROM mytable
WHERE Contains(name, ' Hertz ');
```
Any help is appreciated.. | 2019/01/03 | [
"https://Stackoverflow.com/questions/54019677",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10861913/"
] | You Can LTRIM RTRIM the column and can get the values.
```
create table #temp
(
name varchar(50)
)
insert into #temp values(' hertz')
insert into #temp values('hertz ')
insert into #temp values('hertzx')
insert into #temp values('hertz')
select * from #temp where LTRIM(RTRIM(name)) like '%hertz%'
```
If you wan... | You can try this
```
SELECT a.name
FROM mytable a
WHERE a.name like ' %% '
```
OR
```
SELECT a.name
FROM mytable a
WHERE a.name like' % '
```
You can find the live demo [**Demo here**](https://rextester.com/BECE9953) |
62,342,176 | I have a table with five column description, opening balance, sale, sale return, recipt.
I want to merge opening balance, sale as "Debit" and salereturn, recipt as "Credit".
How to calculate running total as column name as "balance" debit amount plus and credit amount MINUS in balance column?
![SEE TABLE STRACTURE A... | 2020/06/12 | [
"https://Stackoverflow.com/questions/62342176",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13723139/"
] | ```
packageMap.filter(({ id }) => matchingIDs.includes(id)).map(({ name }) => name)
``` | This would work:
```js
const packageMap = [
{
id: `g3IbvxHPGt4xUVfYK`,
name: `Package 1 - Cost £10`
},
{
id: `HPGKCapDCJS76sgd7`,
name: `Package 2 - Cost £20`
},
{
id: `jbd73hndxJH6U6j6s`,
name: `Package 3 - Cost £1`
},
{
id: `5F53DSndxJH6nns22`,
name: `Pack... |
62,342,176 | I have a table with five column description, opening balance, sale, sale return, recipt.
I want to merge opening balance, sale as "Debit" and salereturn, recipt as "Credit".
How to calculate running total as column name as "balance" debit amount plus and credit amount MINUS in balance column?
![SEE TABLE STRACTURE A... | 2020/06/12 | [
"https://Stackoverflow.com/questions/62342176",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13723139/"
] | This would work:
```js
const packageMap = [
{
id: `g3IbvxHPGt4xUVfYK`,
name: `Package 1 - Cost £10`
},
{
id: `HPGKCapDCJS76sgd7`,
name: `Package 2 - Cost £20`
},
{
id: `jbd73hndxJH6U6j6s`,
name: `Package 3 - Cost £1`
},
{
id: `5F53DSndxJH6nns22`,
name: `Pack... | Use `reduce` and `includes`
```js
const packageMap = [
{
id: `g3IbvxHPGt4xUVfYK`,
name: `Package 1 - Cost £10`,
},
{
id: `HPGKCapDCJS76sgd7`,
name: `Package 2 - Cost £20`,
},
{
id: `jbd73hndxJH6U6j6s`,
name: `Package 3 - Cost £1`,
},
{
id: `5F53DSndxJH6nns22`,
... |
62,342,176 | I have a table with five column description, opening balance, sale, sale return, recipt.
I want to merge opening balance, sale as "Debit" and salereturn, recipt as "Credit".
How to calculate running total as column name as "balance" debit amount plus and credit amount MINUS in balance column?
![SEE TABLE STRACTURE A... | 2020/06/12 | [
"https://Stackoverflow.com/questions/62342176",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13723139/"
] | ```
packageMap.filter(({ id }) => matchingIDs.includes(id)).map(({ name }) => name)
``` | Use `reduce` and `includes`
```js
const packageMap = [
{
id: `g3IbvxHPGt4xUVfYK`,
name: `Package 1 - Cost £10`,
},
{
id: `HPGKCapDCJS76sgd7`,
name: `Package 2 - Cost £20`,
},
{
id: `jbd73hndxJH6U6j6s`,
name: `Package 3 - Cost £1`,
},
{
id: `5F53DSndxJH6nns22`,
... |
61,641,925 | How is it possible to exclude the top row or cell of sheet from getActiveRange() if it exists? How can shift() be integrated? A selection is only made within a column to define the area to be used in column 3.
```
function x() {
var s = SpreadsheetApp.getActive().getActiveSheet();
var lastColumn = s.getActiveRange... | 2020/05/06 | [
"https://Stackoverflow.com/questions/61641925",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Just use shift when you getValues(), that removes the first row and leaves all others rows.
```
const activeRange = s.getActiveRange().getValues();
activeRange.shift(); // this removes the first row
activeRange.forEach( function(row, index){
// do something here with each row
console.log(row)
})
``` | Yes, you can.
```
function x() {
var s = SpreadsheetApp.getActive().getActiveSheet();
var activeRange = s.getActiveRange()
if(activeRange.getRow() == 1){
// If first row is 1, then resize the range.
var height = activeRange.getHeight();
activeRange = activeRange.offset(1, 0, height-1);
}
Logger.... |
61,641,925 | How is it possible to exclude the top row or cell of sheet from getActiveRange() if it exists? How can shift() be integrated? A selection is only made within a column to define the area to be used in column 3.
```
function x() {
var s = SpreadsheetApp.getActive().getActiveSheet();
var lastColumn = s.getActiveRange... | 2020/05/06 | [
"https://Stackoverflow.com/questions/61641925",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | To get the Range object corresponding to a given Range, minus a single header row:
```
function getRangeMinusHeaders(range) {
var height = range.getHeight();
if (height == 1) {
return null;
}
var width = range.getWidth();
var sheet = range.getSheet();
return sheet.getRange(1, 1, height-1, width);
}
``... | Yes, you can.
```
function x() {
var s = SpreadsheetApp.getActive().getActiveSheet();
var activeRange = s.getActiveRange()
if(activeRange.getRow() == 1){
// If first row is 1, then resize the range.
var height = activeRange.getHeight();
activeRange = activeRange.offset(1, 0, height-1);
}
Logger.... |
283,056 | We are developing a big system with SQL Server database, ASP.NET Web API 2.2 services and another external services.
We need to load more data on a table while we process the current data on it. To allow load data in background we call our ASP.NET Web API from a CLR SQL Server Stored Procedure.
Then, our ASP.NET Web ... | 2015/05/06 | [
"https://softwareengineering.stackexchange.com/questions/283056",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/49940/"
] | A simple greedy approach should fulfill your requirements. I assume you have an ordered input queue with all actions to process, and a list of actions associated with corresponding users currently under (parallel) processing (lets call these "users under processing"). Whenever the processing of one action is done, it i... | I would suggest you look into scheduling algorithms:
[a list of scheduling algorithms by category here](http://en.wikipedia.org/wiki/Category:Processor_scheduling_algorithms)
and partial order relations to make sure the order of the actions of a given user is respected. You can generate a tree of dependencies using th... |
57,181,101 | I want to include ngx-monaco-editor in my project to create a calculator-like screen on the front-end which shows the text entered as the user clicks on the corresponding buttons.
I have installed ngx-monaco-editor (version 6.0.0) for the same.
The dependencies have been included in app.module.ts and I have added the... | 2019/07/24 | [
"https://Stackoverflow.com/questions/57181101",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8092462/"
] | There is no asset folder in 10.0.0 but there is in version 9.0.0
I use it and it worked. | Changing the input configuration in angular.json enabled the files to be copied over to the dist folder.
Changing the output configuration allowed the loader.json file to be found. |
57,181,101 | I want to include ngx-monaco-editor in my project to create a calculator-like screen on the front-end which shows the text entered as the user clicks on the corresponding buttons.
I have installed ngx-monaco-editor (version 6.0.0) for the same.
The dependencies have been included in app.module.ts and I have added the... | 2019/07/24 | [
"https://Stackoverflow.com/questions/57181101",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8092462/"
] | `ngx-monaco-editor` requires `monaco-editor`
1. Install monaco-editor: `npm install monaco-editor`
2. Add a entry under `projects>architect>options>assets` in angular.json:
`{ "glob": "**/*", "input": "node_modules/monaco-editor", "output": "assets/monaco-editor" }` | Changing the input configuration in angular.json enabled the files to be copied over to the dist folder.
Changing the output configuration allowed the loader.json file to be found. |
57,181,101 | I want to include ngx-monaco-editor in my project to create a calculator-like screen on the front-end which shows the text entered as the user clicks on the corresponding buttons.
I have installed ngx-monaco-editor (version 6.0.0) for the same.
The dependencies have been included in app.module.ts and I have added the... | 2019/07/24 | [
"https://Stackoverflow.com/questions/57181101",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8092462/"
] | There is no asset folder in 10.0.0 but there is in version 9.0.0
I use it and it worked. | `ngx-monaco-editor` requires `monaco-editor`
1. Install monaco-editor: `npm install monaco-editor`
2. Add a entry under `projects>architect>options>assets` in angular.json:
`{ "glob": "**/*", "input": "node_modules/monaco-editor", "output": "assets/monaco-editor" }` |
13,060,055 | Is there a way to use RestKit as an object mapper, say I give it a JSON string and an object mapping, then it gives me the object entity, without setting up the server and all those network related stuff?
Thanks!
updated:
what I need is:
1. give Restkit an RKObjectMapping, the object class and JSON string
2. get th... | 2012/10/25 | [
"https://Stackoverflow.com/questions/13060055",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/879826/"
] | To minimally impact users, I would update only a certain # of records at a time. The number to update is more dependent on your hardware than anything else in my opinion. | Go through the table one row at a time using a loop or even a cursor. Make sure each update is using row locks.
If you don't have a way of identifying rows that still have to be updated, create another table first to hold the primary key and an update indicator, copy all primary key values in there and then keep trac... |
13,060,055 | Is there a way to use RestKit as an object mapper, say I give it a JSON string and an object mapping, then it gives me the object entity, without setting up the server and all those network related stuff?
Thanks!
updated:
what I need is:
1. give Restkit an RKObjectMapping, the object class and JSON string
2. get th... | 2012/10/25 | [
"https://Stackoverflow.com/questions/13060055",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/879826/"
] | Normally you'd write a single update statement to update rows. But in your case you actually want to break it up.
<http://www.sqlfiddle.com/#!3/c9c75/6>
Is a working example of a common pattern. You don't want a batch size of 2, maybe you want 100,000 or 25,000 - you'll have to test on your system to determine the bes... | To minimally impact users, I would update only a certain # of records at a time. The number to update is more dependent on your hardware than anything else in my opinion. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.