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,167 | **In Short**
I’m wondering if there is any research to support the idea that paying for a child to attend college leads to a more desirable outcome than allowing them to pay their own way (either via working, via scholarships, or via student loans). This could be shown in terms of mid-career income, unemployment numbe... | 2016/12/14 | [
"https://parenting.stackexchange.com/questions/28167",
"https://parenting.stackexchange.com",
"https://parenting.stackexchange.com/users/7735/"
] | My husband and I helped our son with undergraduate college so that he wouldn't have so much debt from student loans but only because he was committed to his education. I am all for helping your children with this if you have the resources, but only if they are committed to their education too. I paid for my own college... | Split the cost with the child
=============================
My parents and I had a deal with regards to college. They would pay for 50% of the costs of college, including tuition/fees/room/board. I had to pay the other 50%, however there was the stipulation that any scholarships I earned went into my 50%. Since I was ... |
28,167 | **In Short**
I’m wondering if there is any research to support the idea that paying for a child to attend college leads to a more desirable outcome than allowing them to pay their own way (either via working, via scholarships, or via student loans). This could be shown in terms of mid-career income, unemployment numbe... | 2016/12/14 | [
"https://parenting.stackexchange.com/questions/28167",
"https://parenting.stackexchange.com",
"https://parenting.stackexchange.com/users/7735/"
] | 1. People with degrees statistically have a [better income](http://study.com/articles/How_Much_More_Do_College_Graduates_Earn_Than_Non-College_Graduates.html) than those without degrees.
2. If assisting your child financially is the difference as to whether they can acquire a degree or not then it seems logical that yo... | As you note in your question, college tuition has risen significantly faster than inflation over the past decade or two. This makes it more difficult to cover all one's college costs just from work during college. If you can afford it, you might put enough away to take some of the burden off of them, while still depend... |
28,167 | **In Short**
I’m wondering if there is any research to support the idea that paying for a child to attend college leads to a more desirable outcome than allowing them to pay their own way (either via working, via scholarships, or via student loans). This could be shown in terms of mid-career income, unemployment numbe... | 2016/12/14 | [
"https://parenting.stackexchange.com/questions/28167",
"https://parenting.stackexchange.com",
"https://parenting.stackexchange.com/users/7735/"
] | Split the cost with the child
=============================
My parents and I had a deal with regards to college. They would pay for 50% of the costs of college, including tuition/fees/room/board. I had to pay the other 50%, however there was the stipulation that any scholarships I earned went into my 50%. Since I was ... | I think you should, because I wouldn't be able to study aboard for university without my parents' help. But you need to let your children understand you are not giving them free money.
I think the key point is to let your children understand the value of their education, and that university degree doesn't just fall fr... |
8,242,229 | I just downloaded SOAPUI 4.0.1 and tried to run it in Ubuntu 11.10. I run the file soapui.sh. The application started up and the window actually appeared, but then after a few seconds it closed. Looking at the terminal I saw that the JVM crashed. Below are the details of the error:
```
(process:4183): GLib-GObject-CRI... | 2011/11/23 | [
"https://Stackoverflow.com/questions/8242229",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1045107/"
] | Look here: <http://www.eviware.com/forum/viewtopic.php?f=13&t=7736>
Look in ..../soapui-4.0.1/bin/soapui.sh:
```
#uncomment to disable browser component
#JAVA_OPTS="$JAVA_OPTS -Dsoapui.jxbrowser.disable=true" <- uncomment this line
```
if you are usising soapui.sh to start soapUI. If you used installer and using la... | I also have the same issue
```
--
DUMP
...
# JRE version: 6.0_33-b03
# Java VM: Java HotSpot(TM) Server VM (20.8-b03 mixed mode linux-x86 )
# Problematic frame:
# C [libgconf-2.so.4+0x176aa] __float128+0x176aa
...
OS:Fedora release 16 (Verne)
uname:Linux 3.3.2-6.fc16.i686 #1 SMP Sat Apr 21 13:23:12 UTC 2012 i686
lib... |
7,076,901 | In my web application I am validating the url from glabal.asax . I want to validate the url and need to redirect to an action if needed. I am using Application\_BeginRequest to catch the request event.
```
protected void Application_BeginRequest(object sender, EventArgs e)
{
// If the product is not regi... | 2011/08/16 | [
"https://Stackoverflow.com/questions/7076901",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/461561/"
] | All above will not work you will be in the loop of executing the method `Application_BeginRequest`.
You need to use
```
HttpContext.Current.RewritePath("Home/About");
``` | Besides the ways mentioned already. Another way is using URLHelper which I used in a scenario once error happend and User should be redirected to the Login page :
```
public void Application_PostAuthenticateRequest(object sender, EventArgs e){
try{
if(!Request.IsAuthenticated){
throw new Inva... |
7,076,901 | In my web application I am validating the url from glabal.asax . I want to validate the url and need to redirect to an action if needed. I am using Application\_BeginRequest to catch the request event.
```
protected void Application_BeginRequest(object sender, EventArgs e)
{
// If the product is not regi... | 2011/08/16 | [
"https://Stackoverflow.com/questions/7076901",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/461561/"
] | Besides the ways mentioned already. Another way is using URLHelper which I used in a scenario once error happend and User should be redirected to the Login page :
```
public void Application_PostAuthenticateRequest(object sender, EventArgs e){
try{
if(!Request.IsAuthenticated){
throw new Inva... | I had an old web forms application I had to convert to MVC 5 and one of the requirements was supporting possible {old\_form}.aspx links. In Global.asax Application\_BeginRequest I set up a switch statement to handle old pages to redirect to the new ones and to avoid the possible undesired looping to the home/default ro... |
7,076,901 | In my web application I am validating the url from glabal.asax . I want to validate the url and need to redirect to an action if needed. I am using Application\_BeginRequest to catch the request event.
```
protected void Application_BeginRequest(object sender, EventArgs e)
{
// If the product is not regi... | 2011/08/16 | [
"https://Stackoverflow.com/questions/7076901",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/461561/"
] | ```
Response.RedirectToRoute(
new RouteValueDictionary {
{ "Controller", "Home" },
{ "Action", "TimeoutRedirect" }} );
``` | You can try with this:
Context.Response.Redirect();
Nt sure. |
7,076,901 | In my web application I am validating the url from glabal.asax . I want to validate the url and need to redirect to an action if needed. I am using Application\_BeginRequest to catch the request event.
```
protected void Application_BeginRequest(object sender, EventArgs e)
{
// If the product is not regi... | 2011/08/16 | [
"https://Stackoverflow.com/questions/7076901",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/461561/"
] | Try this:
```
HttpContext.Current.Response.Redirect("...");
``` | In my case, i prefer not use Web.config. Then i created code above in Global.asax file:
```
protected void Application_Error(object sender, EventArgs e)
{
Exception ex = Server.GetLastError();
//Not Found (When user digit unexisting url)
if(ex is HttpException && ((HttpException)ex).GetHtt... |
7,076,901 | In my web application I am validating the url from glabal.asax . I want to validate the url and need to redirect to an action if needed. I am using Application\_BeginRequest to catch the request event.
```
protected void Application_BeginRequest(object sender, EventArgs e)
{
// If the product is not regi... | 2011/08/16 | [
"https://Stackoverflow.com/questions/7076901",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/461561/"
] | Besides the ways mentioned already. Another way is using URLHelper which I used in a scenario once error happend and User should be redirected to the Login page :
```
public void Application_PostAuthenticateRequest(object sender, EventArgs e){
try{
if(!Request.IsAuthenticated){
throw new Inva... | ```
Response.RedirectToRoute(
new RouteValueDictionary {
{ "Controller", "Home" },
{ "Action", "TimeoutRedirect" }} );
``` |
7,076,901 | In my web application I am validating the url from glabal.asax . I want to validate the url and need to redirect to an action if needed. I am using Application\_BeginRequest to catch the request event.
```
protected void Application_BeginRequest(object sender, EventArgs e)
{
// If the product is not regi... | 2011/08/16 | [
"https://Stackoverflow.com/questions/7076901",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/461561/"
] | Use the below code for redirection
```
Response.RedirectToRoute("Default");
```
"Default" is route name. If you want to redirect to any action,just create a route and use that route name . | Try this:
```
HttpContext.Current.Response.Redirect("...");
``` |
7,076,901 | In my web application I am validating the url from glabal.asax . I want to validate the url and need to redirect to an action if needed. I am using Application\_BeginRequest to catch the request event.
```
protected void Application_BeginRequest(object sender, EventArgs e)
{
// If the product is not regi... | 2011/08/16 | [
"https://Stackoverflow.com/questions/7076901",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/461561/"
] | Try this:
```
HttpContext.Current.Response.Redirect("...");
``` | I do it like this:
```
HttpContextWrapper contextWrapper = new HttpContextWrapper(this.Context);
RouteData routeData = new RouteData();
routeData.Values.Add("controller", "Home");
routeData.Values.Add("action", "FirstVisit");
IController controller = new HomeController();
... |
7,076,901 | In my web application I am validating the url from glabal.asax . I want to validate the url and need to redirect to an action if needed. I am using Application\_BeginRequest to catch the request event.
```
protected void Application_BeginRequest(object sender, EventArgs e)
{
// If the product is not regi... | 2011/08/16 | [
"https://Stackoverflow.com/questions/7076901",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/461561/"
] | Besides the ways mentioned already. Another way is using URLHelper which I used in a scenario once error happend and User should be redirected to the Login page :
```
public void Application_PostAuthenticateRequest(object sender, EventArgs e){
try{
if(!Request.IsAuthenticated){
throw new Inva... | I do it like this:
```
HttpContextWrapper contextWrapper = new HttpContextWrapper(this.Context);
RouteData routeData = new RouteData();
routeData.Values.Add("controller", "Home");
routeData.Values.Add("action", "FirstVisit");
IController controller = new HomeController();
... |
7,076,901 | In my web application I am validating the url from glabal.asax . I want to validate the url and need to redirect to an action if needed. I am using Application\_BeginRequest to catch the request event.
```
protected void Application_BeginRequest(object sender, EventArgs e)
{
// If the product is not regi... | 2011/08/16 | [
"https://Stackoverflow.com/questions/7076901",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/461561/"
] | Besides the ways mentioned already. Another way is using URLHelper which I used in a scenario once error happend and User should be redirected to the Login page :
```
public void Application_PostAuthenticateRequest(object sender, EventArgs e){
try{
if(!Request.IsAuthenticated){
throw new Inva... | Try this:
```
HttpContext.Current.Response.Redirect("...");
``` |
7,076,901 | In my web application I am validating the url from glabal.asax . I want to validate the url and need to redirect to an action if needed. I am using Application\_BeginRequest to catch the request event.
```
protected void Application_BeginRequest(object sender, EventArgs e)
{
// If the product is not regi... | 2011/08/16 | [
"https://Stackoverflow.com/questions/7076901",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/461561/"
] | Try this:
```
HttpContext.Current.Response.Redirect("...");
``` | ```
Response.RedirectToRoute(
new RouteValueDictionary {
{ "Controller", "Home" },
{ "Action", "TimeoutRedirect" }} );
``` |
64,364,342 | I am trying to explore AD integration and was able to succesfully complete the setup as described in [AWS blog post](https://aws.amazon.com/blogs/security/how-to-enable-ldaps-for-your-aws-microsoft-ad-directory/), and verified that SSL connection is working fine from "Management box".
Based on my understanding, ldp.ex... | 2020/10/15 | [
"https://Stackoverflow.com/questions/64364342",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1094597/"
] | I'm assuming you generated the SSL cert in AWS via Amazon Certificate Services (ACS). Although ACS won't allow you to export the private key from ACS, you shouldn't need it. All you need to do is import the public certificate into the certificate trust store that your Linux box is using when it connects to the AD serve... | ```
You can download the certificate from the ldaps end point and install it as follows.
Install openldap client
sudo yum install -y openldap-clients
• Download and Add Server Certificate to the openldap cert path
openssl s_client -connect <LDAPSURL>:636 -showcerts </dev/null 2>/dev/null | openssl x509 -outf... |
379,128 | How would someone who really knows how to take advantage of dynamic programming languages approach programming differently than someone working in a static language?
I'm familiar with the whole debate over static versus dynamic typing, but that's not what I'm getting at. I'd like to discuss problem solving techniques... | 2008/12/18 | [
"https://Stackoverflow.com/questions/379128",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25188/"
] | It comes down to one of my favorite ratios: How much time I spend thinking about solving a problem, vs. how much time I spend thinking about the tool I'm using to solve the problem. Think of it as equivalent to S/N ratios.
With duck-typing languages (which I consider to be the factor that helps me the most with produc... | More libraries and more important *more useable libraries*.
My guess is that the "Duck Typing" usually associated with dynamic languages helps simplify the code significantly and makes writing generic code much easier. You are not constrained by a strict class hierarchy and thus are able to more easily compose compone... |
379,128 | How would someone who really knows how to take advantage of dynamic programming languages approach programming differently than someone working in a static language?
I'm familiar with the whole debate over static versus dynamic typing, but that's not what I'm getting at. I'd like to discuss problem solving techniques... | 2008/12/18 | [
"https://Stackoverflow.com/questions/379128",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25188/"
] | I like slim's answer. I do spend a crazy amount of time in Java and C++ crafting custom data structures that are just free in Python/Ruby. And crafting specialized functions to process these custom data structures. Yes, in C++, STL is really nice. Yes, Generics in Java are nice. They help create custom data structures ... | Dynamic Languages can change the object at run time, you can add methods, properties...
One good example of Dynamic Languages magic is this Groovy code snippet which call a method on a webservice in just two lines of code:
```
def proxy = new SoapClient("http://localhost:6980/MathServiceInterface?wsdl");
def result =... |
379,128 | How would someone who really knows how to take advantage of dynamic programming languages approach programming differently than someone working in a static language?
I'm familiar with the whole debate over static versus dynamic typing, but that's not what I'm getting at. I'd like to discuss problem solving techniques... | 2008/12/18 | [
"https://Stackoverflow.com/questions/379128",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25188/"
] | Fast iterations make happier programmers, and they don't come any faster than an interactive interpreter. Good interpreter exploitation gives you sandbox, testing, and prototyping at the same time.
Beware programming by permutation, however. My personal rule of thumb is that it's just because it works doesn't mean it'... | Read "Higher Order Perl" by Mark Jason Dominus. It only discusses Perl but it does give techniques that are natural to Perl that would be less natural in most static languages.
```
All languages obviously have their strengths and weaknesses and dymanic vs static
```
is only one of many ways to classify a language.... |
379,128 | How would someone who really knows how to take advantage of dynamic programming languages approach programming differently than someone working in a static language?
I'm familiar with the whole debate over static versus dynamic typing, but that's not what I'm getting at. I'd like to discuss problem solving techniques... | 2008/12/18 | [
"https://Stackoverflow.com/questions/379128",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25188/"
] | It comes down to one of my favorite ratios: How much time I spend thinking about solving a problem, vs. how much time I spend thinking about the tool I'm using to solve the problem. Think of it as equivalent to S/N ratios.
With duck-typing languages (which I consider to be the factor that helps me the most with produc... | Dynamic languages are capable of executing code which was created at run-time. This is very dangerous if malicious code is injected. But very powerful if you can sanitize the environment.
I think Javascript people do this by executing JSON files. |
379,128 | How would someone who really knows how to take advantage of dynamic programming languages approach programming differently than someone working in a static language?
I'm familiar with the whole debate over static versus dynamic typing, but that's not what I'm getting at. I'd like to discuss problem solving techniques... | 2008/12/18 | [
"https://Stackoverflow.com/questions/379128",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25188/"
] | I like slim's answer. I do spend a crazy amount of time in Java and C++ crafting custom data structures that are just free in Python/Ruby. And crafting specialized functions to process these custom data structures. Yes, in C++, STL is really nice. Yes, Generics in Java are nice. They help create custom data structures ... | I can't cite this right now (my memory is failing me), but I've heard something along the lines of:
>
> The closest the programming industry has come to a silver bullet is
> managed languages – freeing the programmer from having to worry about
> the details of memory management and letting them focus more energy
> ... |
379,128 | How would someone who really knows how to take advantage of dynamic programming languages approach programming differently than someone working in a static language?
I'm familiar with the whole debate over static versus dynamic typing, but that's not what I'm getting at. I'd like to discuss problem solving techniques... | 2008/12/18 | [
"https://Stackoverflow.com/questions/379128",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25188/"
] | I can't cite this right now (my memory is failing me), but I've heard something along the lines of:
>
> The closest the programming industry has come to a silver bullet is
> managed languages – freeing the programmer from having to worry about
> the details of memory management and letting them focus more energy
> ... | I do not have a specific answer, just a suggestion: have a look at the book "[Design patterns in Ruby](http://designpatternsinruby.com)" : it goes over most of the classic design patterns (à la Gamma et al., and more) and express them, quite succinctly, in Ruby :) |
379,128 | How would someone who really knows how to take advantage of dynamic programming languages approach programming differently than someone working in a static language?
I'm familiar with the whole debate over static versus dynamic typing, but that's not what I'm getting at. I'd like to discuss problem solving techniques... | 2008/12/18 | [
"https://Stackoverflow.com/questions/379128",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25188/"
] | John, just based on your update edit of 1/5/09, you might find [AMOP](http://en.wikipedia.org/wiki/The_Art_of_the_Metaobject_Protocol) an interesting read, and more on the line you're thinking of. It's pretty lisp-centric, but after all many of the good dynamic ideas started there. So if you can enjoy (or get past) tha... | Dynamic languages are capable of executing code which was created at run-time. This is very dangerous if malicious code is injected. But very powerful if you can sanitize the environment.
I think Javascript people do this by executing JSON files. |
379,128 | How would someone who really knows how to take advantage of dynamic programming languages approach programming differently than someone working in a static language?
I'm familiar with the whole debate over static versus dynamic typing, but that's not what I'm getting at. I'd like to discuss problem solving techniques... | 2008/12/18 | [
"https://Stackoverflow.com/questions/379128",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25188/"
] | Fast iterations make happier programmers, and they don't come any faster than an interactive interpreter. Good interpreter exploitation gives you sandbox, testing, and prototyping at the same time.
Beware programming by permutation, however. My personal rule of thumb is that it's just because it works doesn't mean it'... | For me it's turnaround speed. The dynamic languages I use (Python and a bit of JavaScript at the moment) are interpreted. This means I can try things out on the fly. If I want to see how a certain bit of the API behaves I can just hack away at the interpreter for a couple of minutes.
If I wanted to do the same in a l... |
379,128 | How would someone who really knows how to take advantage of dynamic programming languages approach programming differently than someone working in a static language?
I'm familiar with the whole debate over static versus dynamic typing, but that's not what I'm getting at. I'd like to discuss problem solving techniques... | 2008/12/18 | [
"https://Stackoverflow.com/questions/379128",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25188/"
] | My biggest gains are in mapping between databases and objects (ORM).
If there is no concept of a type, it becomes very easy to say assign every column in a row to a value in an object. Of course the trade off is that there can be a mismatch between the type of value you think is there and what type the computer does. | More libraries and more important *more useable libraries*.
My guess is that the "Duck Typing" usually associated with dynamic languages helps simplify the code significantly and makes writing generic code much easier. You are not constrained by a strict class hierarchy and thus are able to more easily compose compone... |
379,128 | How would someone who really knows how to take advantage of dynamic programming languages approach programming differently than someone working in a static language?
I'm familiar with the whole debate over static versus dynamic typing, but that's not what I'm getting at. I'd like to discuss problem solving techniques... | 2008/12/18 | [
"https://Stackoverflow.com/questions/379128",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25188/"
] | I like slim's answer. I do spend a crazy amount of time in Java and C++ crafting custom data structures that are just free in Python/Ruby. And crafting specialized functions to process these custom data structures. Yes, in C++, STL is really nice. Yes, Generics in Java are nice. They help create custom data structures ... | Read "Higher Order Perl" by Mark Jason Dominus. It only discusses Perl but it does give techniques that are natural to Perl that would be less natural in most static languages.
```
All languages obviously have their strengths and weaknesses and dymanic vs static
```
is only one of many ways to classify a language.... |
62,490,259 | I am trying to use selenium + python to enter credit card values into a Shopify site. The boxes to enter the card values are in an iframe and I am unsure how to switch to this iframe.
I currently have this code:
```
WebDriverWait(driver, 10).until(EC.frame_to_be_available_and_switch_to_it((By.XPATH,
... | 2020/06/20 | [
"https://Stackoverflow.com/questions/62490259",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13554838/"
] | See [Knuth–Morris–Pratt algorithm](https://en.wikipedia.org/wiki/Knuth%E2%80%93Morris%E2%80%93Pratt_algorithm), which has the time complexity of $O(n)$
One possible implementation:
```py
def kmp(pattern, text):
n = len(pattern)
m = len(text)
next_v = [0] * n
for i in range(1, n):
j = next_v[i ... | Convert `l1` and `l2` to strings, and then do the search:
```
l1 = [1,2,3,4]
l2 = [3,5,6,1,2,3,4,6]
l1 = str(l1)
l2 = str(l2)
# This will return a string of the data only without the '[',']'
l1 = l1.split('[')[1].split(']')[0]
l2 = l2.split('[')[1].split(']')[0]
# Using string find function
if l2.find(l1) > 0 :
pr... |
62,490,259 | I am trying to use selenium + python to enter credit card values into a Shopify site. The boxes to enter the card values are in an iframe and I am unsure how to switch to this iframe.
I currently have this code:
```
WebDriverWait(driver, 10).until(EC.frame_to_be_available_and_switch_to_it((By.XPATH,
... | 2020/06/20 | [
"https://Stackoverflow.com/questions/62490259",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13554838/"
] | See [Knuth–Morris–Pratt algorithm](https://en.wikipedia.org/wiki/Knuth%E2%80%93Morris%E2%80%93Pratt_algorithm), which has the time complexity of $O(n)$
One possible implementation:
```py
def kmp(pattern, text):
n = len(pattern)
m = len(text)
next_v = [0] * n
for i in range(1, n):
j = next_v[i ... | Here is what you can do:
```
l1 = [1,2,3,4]
l2 = [3,5,6,1,2,3,4,6]
found = False
for i in range(len(l2)-len(l1)+1):
if l2[i:i+len(l1)] == l1:
found = True
if found:
print('found')
else:
print('not found')
```
Output:
```
found
```
---
**Another way:**
```
l1 = [1,2,3,4]
l2 = [3,5,6,1,2,3,4... |
57,941,441 | I am trying to find a REGEX expression (or multiple ones) that i can use in Notepad++ (Windows) that will change different parts of URLs based on specific symbols that divide them.
Basically i have this type of URLs in a big file, they are scaterred around:
```
domain.com/folder/random-text-1?REPLACE-THIS-1=REPLACE-T... | 2019/09/15 | [
"https://Stackoverflow.com/questions/57941441",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11064864/"
] | The function *parentheses* expects an lvalue in the std::string parameter, i.e. a named variable. However, you have supplied an rvalue (temporary) in this call:
parentheses(n,"",0,0);
An empty string object is created and passed to parentheses. You can avoid this problem by changing the definition of parentheses like... | the function needs a memory to change, you didn't specify which.
declare a string to hold what you want to pass and where to get the output to.
```
string s = "";
```
and pass it to the function |
57,941,441 | I am trying to find a REGEX expression (or multiple ones) that i can use in Notepad++ (Windows) that will change different parts of URLs based on specific symbols that divide them.
Basically i have this type of URLs in a big file, they are scaterred around:
```
domain.com/folder/random-text-1?REPLACE-THIS-1=REPLACE-T... | 2019/09/15 | [
"https://Stackoverflow.com/questions/57941441",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11064864/"
] | the function needs a memory to change, you didn't specify which.
declare a string to hold what you want to pass and where to get the output to.
```
string s = "";
```
and pass it to the function | If you want to change the values of your string for any string that is passed as a paramenter (lvalue, as well rvalue), just initialize a variable with the intended content and pass it to your function.
But if you want to treat lvalue strings diferently from rvalue strings, just overload your original function. i.e.:
... |
57,941,441 | I am trying to find a REGEX expression (or multiple ones) that i can use in Notepad++ (Windows) that will change different parts of URLs based on specific symbols that divide them.
Basically i have this type of URLs in a big file, they are scaterred around:
```
domain.com/folder/random-text-1?REPLACE-THIS-1=REPLACE-T... | 2019/09/15 | [
"https://Stackoverflow.com/questions/57941441",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11064864/"
] | The function *parentheses* expects an lvalue in the std::string parameter, i.e. a named variable. However, you have supplied an rvalue (temporary) in this call:
parentheses(n,"",0,0);
An empty string object is created and passed to parentheses. You can avoid this problem by changing the definition of parentheses like... | I'm not really sure what the purpose is of passing `""` by reference is, as any value put there will get lost.
Anyway, to answer your question, create a variable and pass it instead:
```
void solve(int n){
std::string tmp = "";
parentheses(n,tmp,0,0);
}
```
If you don't care about the value stored in `tmp`,... |
57,941,441 | I am trying to find a REGEX expression (or multiple ones) that i can use in Notepad++ (Windows) that will change different parts of URLs based on specific symbols that divide them.
Basically i have this type of URLs in a big file, they are scaterred around:
```
domain.com/folder/random-text-1?REPLACE-THIS-1=REPLACE-T... | 2019/09/15 | [
"https://Stackoverflow.com/questions/57941441",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11064864/"
] | I'm not really sure what the purpose is of passing `""` by reference is, as any value put there will get lost.
Anyway, to answer your question, create a variable and pass it instead:
```
void solve(int n){
std::string tmp = "";
parentheses(n,tmp,0,0);
}
```
If you don't care about the value stored in `tmp`,... | If you want to change the values of your string for any string that is passed as a paramenter (lvalue, as well rvalue), just initialize a variable with the intended content and pass it to your function.
But if you want to treat lvalue strings diferently from rvalue strings, just overload your original function. i.e.:
... |
57,941,441 | I am trying to find a REGEX expression (or multiple ones) that i can use in Notepad++ (Windows) that will change different parts of URLs based on specific symbols that divide them.
Basically i have this type of URLs in a big file, they are scaterred around:
```
domain.com/folder/random-text-1?REPLACE-THIS-1=REPLACE-T... | 2019/09/15 | [
"https://Stackoverflow.com/questions/57941441",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11064864/"
] | The function *parentheses* expects an lvalue in the std::string parameter, i.e. a named variable. However, you have supplied an rvalue (temporary) in this call:
parentheses(n,"",0,0);
An empty string object is created and passed to parentheses. You can avoid this problem by changing the definition of parentheses like... | If you want to change the values of your string for any string that is passed as a paramenter (lvalue, as well rvalue), just initialize a variable with the intended content and pass it to your function.
But if you want to treat lvalue strings diferently from rvalue strings, just overload your original function. i.e.:
... |
57,941,441 | I am trying to find a REGEX expression (or multiple ones) that i can use in Notepad++ (Windows) that will change different parts of URLs based on specific symbols that divide them.
Basically i have this type of URLs in a big file, they are scaterred around:
```
domain.com/folder/random-text-1?REPLACE-THIS-1=REPLACE-T... | 2019/09/15 | [
"https://Stackoverflow.com/questions/57941441",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11064864/"
] | The function *parentheses* expects an lvalue in the std::string parameter, i.e. a named variable. However, you have supplied an rvalue (temporary) in this call:
parentheses(n,"",0,0);
An empty string object is created and passed to parentheses. You can avoid this problem by changing the definition of parentheses like... | Your `parentheses()` function takes a **non-const reference** to a `std::string` object, so it expects an actual `std::string` object on the other side of the reference - an lvalue (something that can be assigned to).
But your `solve()` function is not passing a `std::string` object, it is passing a string literal ins... |
57,941,441 | I am trying to find a REGEX expression (or multiple ones) that i can use in Notepad++ (Windows) that will change different parts of URLs based on specific symbols that divide them.
Basically i have this type of URLs in a big file, they are scaterred around:
```
domain.com/folder/random-text-1?REPLACE-THIS-1=REPLACE-T... | 2019/09/15 | [
"https://Stackoverflow.com/questions/57941441",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11064864/"
] | Your `parentheses()` function takes a **non-const reference** to a `std::string` object, so it expects an actual `std::string` object on the other side of the reference - an lvalue (something that can be assigned to).
But your `solve()` function is not passing a `std::string` object, it is passing a string literal ins... | If you want to change the values of your string for any string that is passed as a paramenter (lvalue, as well rvalue), just initialize a variable with the intended content and pass it to your function.
But if you want to treat lvalue strings diferently from rvalue strings, just overload your original function. i.e.:
... |
67,992,086 | Here's my code for an express server:
```
const express=require('express');
express();
const app=express();
app.get('/',(req,res)=>{
res.send('Welcome to API xyz!');
});
app.listen(3000,()=>{
console.log('Listening on port 3000...');
});
```
Running the server from a git bash terminal, in the app's direc... | 2021/06/15 | [
"https://Stackoverflow.com/questions/67992086",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/619177/"
] | >
> I expected the values to be 1, what am I doing wrong in my source code? why all values are 2?
>
>
>
You observed twice. If you're using `observeDuration` you don't also need `observe`.
>
> How can I set the buckets to use ranges, instead of <=?
>
>
>
You can't, this is how `histogram_quantile` expects th... | I think one way you can achieve this, is through regex. For example,
```regex
le=~"([1-9]+)\\..*"
```
will give you all values that are greater than 0.9999 |
119,958 | Maybe I misundertand something, but I find Greg Egan's treatment of the simultaneity problem between distant clones in Diaspora problematic, strangely at odds with the overall technically detailed rigorous style of the book. Consider this in Chapter 11:
>
> Elena had chose not to wake if any other versions of her had... | 2016/02/19 | [
"https://scifi.stackexchange.com/questions/119958",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/60790/"
] | There's no indication in the novel how Elena's scheme was implemented but absent superluminal signaling, her various exoselves would likely adopt the following strategy.
Sort the Carter-Zimmerman polis expeditions by estimated time of arrival. Each exoself in each polis waits for news from all the trips with earlier a... | The crafts were going significantly slower than the speed of light, so I think it's plausible that for *nearly* all pairs of crafts going to two destinations A and B, if the first craft sent a signal at the moment it arrived at A, and the signal moved at the speed of light, then the signal would reach B before the othe... |
49,969 | [](https://i.stack.imgur.com/jQr8T.png)
So... I have a set up as below. I ping PC7 from the router. obviously an ARP is sent to determine PC7's MAC address. but it doesnt work. i then decide to set packettracer to simulation mode. i ping pc7 again and... | 2018/04/18 | [
"https://networkengineering.stackexchange.com/questions/49969",
"https://networkengineering.stackexchange.com",
"https://networkengineering.stackexchange.com/users/46304/"
] | Yeeei. I'm so thrilled i found my mistake. I didn't makeg that port on the switch to the router a trunking port... i'm so sorry i didn't tell you guys about all the VLANS i had in there... i see how there was no way you could have seen that. anyways:
```
!
interface GigabitEthernet0/1
switchport trunk allowed vlan 1... | You just need to wait for the port to goes in forwarding mode.
By default on Cisco switches (and it seems in packet tracer), when a port goes UP, the STP process block the port until it determines that the network is loop-free, by listening for BPDU on this port.
To avoid this you can configure ports that are connect... |
1,417,842 | let $x\_1= a+ib,x\_2= c+id,k=$scalar
$f(x\_1,x\_2)=f(x\_1) + f(x\_2)$
$f(a+ib + c + id)=(a+c)-i(b+d)$
$f(a+ib)+f(c+id)=(a+c) - i(b+d)$
$f(kx\_1)=kf(x\_1)$
$f(k(a+ib))= k(a-ib)$
$kf(x\_1)=k(a-ib)$
Looks linear to me, but tutor said it wasn't. please help. | 2015/09/02 | [
"https://math.stackexchange.com/questions/1417842",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/265853/"
] | There is a distinction between $\mathbb{R}$-linear and $\mathbb{C}$-linear.
So, here, for instance, if we take $w$ to be a scalar in $\mathbb{C}$, then
$$f(wz) = \bar{w} f(z).$$
Now, if $\Im w = 0$, then this is the required relation for linearity, but if $\Im w \neq 0$, then we don't have linearity. Therefore, $f$ ... | $T(z) = \overline{z}$
$T(wz) = (w\overline{z}) = (\overline{w}\overline{z}) = \overline{w}f(z) \ne wf(z)$
Therefore not linear (consider the bar on the right of w and z as it is on the upper). |
583,434 | Like when you download node.js there is a long list of shasums for each download, windows, osx, linux.
<http://blog.nodejs.org/>
Why is that?
I know you can check a file sha1sum and thereby check if the file is exactly like the developers wanted it to be, but who does that? Is that the reason?
I have never tried do... | 2013/04/16 | [
"https://superuser.com/questions/583434",
"https://superuser.com",
"https://superuser.com/users/166362/"
] | Reason 1
--------
Allows you to check if the file wasn't corrupted during download.
Reason 2
--------
Allows you to check if the file wasn't tampered with by a third party. | >
> I know you can check a file sha1sum and thereby check if the file is exactly like the developers wanted it to be, but who does that? Is that the reason? I have never tried downloading a file and it was corrupt or something.
>
>
>
Just because it has never happened to you doesn't mean it can't happen, and you *... |
33,840 | Dans un dossier de postulation j'ai rencontré la phrase :
>
> Pour en faciliter la lecture, ce document est structuré en cinq chapitres que j'ai voulu concis.
>
>
>
En googlant, je ne trouve pas quelque part l'expression *que j'ai voulu concis*. Est-elle erronée ou a-t-elle une connotation qui m'échapperait ? | 2019/02/14 | [
"https://french.stackexchange.com/questions/33840",
"https://french.stackexchange.com",
"https://french.stackexchange.com/users/16020/"
] | Il n'y a pas d'erreur ; c'est un usage de « vouloir » assez courant, que l'on trouve au TLFi ;
>
> [Avec un attribut du compl. d'obj. dir.] Souhaiter avoir, proposer une chose qui présente certaines qualités. Vouloir un steack saignant. La merluche se réduit en une espèce de crème. Si vous la voulez verte, vous pilez... | Ce n'est pas une faute, c'est juste que ce style de formulation est assez peu répandu.
On entendrait plus régulièrement ce genre de phrase :
>
> Pour en faciliter la lecture, ce document est structuré en cinq chapitres que j'ai voulu **rendre plus concis**.
>
>
>
Ce qui signifie, ici, *le résumer pour en rendre ... |
33,840 | Dans un dossier de postulation j'ai rencontré la phrase :
>
> Pour en faciliter la lecture, ce document est structuré en cinq chapitres que j'ai voulu concis.
>
>
>
En googlant, je ne trouve pas quelque part l'expression *que j'ai voulu concis*. Est-elle erronée ou a-t-elle une connotation qui m'échapperait ? | 2019/02/14 | [
"https://french.stackexchange.com/questions/33840",
"https://french.stackexchange.com",
"https://french.stackexchange.com/users/16020/"
] | Il n'y a pas d'erreur ; c'est un usage de « vouloir » assez courant, que l'on trouve au TLFi ;
>
> [Avec un attribut du compl. d'obj. dir.] Souhaiter avoir, proposer une chose qui présente certaines qualités. Vouloir un steack saignant. La merluche se réduit en une espèce de crème. Si vous la voulez verte, vous pilez... | La phrase est correcte.
Ce n'est pas une expression proprement dite mais juste l'adjectif "Concis" utilisé ici et signifiant "bref" ou "de forme réduite".
Le [CNRTL](http://www.cnrtl.fr/definition/concis) en donne la définition: "Qui est réduit à l'essentiel et l'exprime en peu de mots". |
338,563 | In my basic understanding of ByteArrays the benefit is that it is smaller in file size.
The down size of a ByteArray is that for any given format you have to know the about the file format to get information out of it. You need a specification and software tools or software to find information.
For example, to get i... | 2016/12/21 | [
"https://softwareengineering.stackexchange.com/questions/338563",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/48061/"
] | It is certainly possible that the JPEG and PNG people might have used XML-based *headers* if file size were not an issue. Using text would make it more obvious what all the fields mean and so forth.
But for storing the actual file data, almost certainly not. The data elements of JPEG/PNG images is a sequence of bytes,... | Two things:
1. The benefits of your scheme are small and questionable: yes I can parse and extract metadata a bit more easily. But you only really need one C library to parse an image format and then it's a solved problem.
2. Even with modern bandwidth image size is a huge concern. Think about browsing Facebook from a... |
338,563 | In my basic understanding of ByteArrays the benefit is that it is smaller in file size.
The down size of a ByteArray is that for any given format you have to know the about the file format to get information out of it. You need a specification and software tools or software to find information.
For example, to get i... | 2016/12/21 | [
"https://softwareengineering.stackexchange.com/questions/338563",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/48061/"
] | It is certainly possible that the JPEG and PNG people might have used XML-based *headers* if file size were not an issue. Using text would make it more obvious what all the fields mean and so forth.
But for storing the actual file data, almost certainly not. The data elements of JPEG/PNG images is a sequence of bytes,... | Byte arrays are human readable. I've been reading them since I was 10 and I've been human for longer than that. This was before I even had a fancy hex editor. Peek and Poke commands are old friends.
What an xml document gives you isn't human readability. It gives you a reasonably predictable encoding (ASCII, UTF-8, et... |
338,563 | In my basic understanding of ByteArrays the benefit is that it is smaller in file size.
The down size of a ByteArray is that for any given format you have to know the about the file format to get information out of it. You need a specification and software tools or software to find information.
For example, to get i... | 2016/12/21 | [
"https://softwareengineering.stackexchange.com/questions/338563",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/48061/"
] | It is certainly possible that the JPEG and PNG people might have used XML-based *headers* if file size were not an issue. Using text would make it more obvious what all the fields mean and so forth.
But for storing the actual file data, almost certainly not. The data elements of JPEG/PNG images is a sequence of bytes,... | You example XML isn't even a good example, as you're still using a byte array. A 'true' XML for an image, to contrast with byte arrays, would be something like:
```
<s:Image xmlns="www.w3c.org" width="1000" height="600" bits="8">
<s:pixels>
<s:row>
<pixel>000000<pixel>
<pixel>000001<pixel>
... |
67,337,853 | Is there a way in javascript in which you can remove the empty lines from a text. And if there is, is the only option iterating over the text to check if there is an empty line or is there a straightforward way. Any help is appreciated. Thanks in advance.
For example:
```
This
is
an
example
```
would change to
... | 2021/04/30 | [
"https://Stackoverflow.com/questions/67337853",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15656320/"
] | You can separate the lines and filter over them.
```js
let str = `This
is
an
example`;
let res = str.split('\n').filter(Boolean).join('\n');
console.log(res);
``` | You can use [`String.prototype.replaceAll`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replaceAll) with a RegExp pattern to get what you need:
```
const str = `This
is
an
example`;
console.log(str.replaceAll(/\n\n+/ig, `\n`, str);
``` |
67,337,853 | Is there a way in javascript in which you can remove the empty lines from a text. And if there is, is the only option iterating over the text to check if there is an empty line or is there a straightforward way. Any help is appreciated. Thanks in advance.
For example:
```
This
is
an
example
```
would change to
... | 2021/04/30 | [
"https://Stackoverflow.com/questions/67337853",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15656320/"
] | You can separate the lines and filter over them.
```js
let str = `This
is
an
example`;
let res = str.split('\n').filter(Boolean).join('\n');
console.log(res);
``` | You can use the following code:
```
text = `This
is
an
example`
cleaned_text = text.split('\n').filter(x=> x !== '').join('\n');
```
The split makes an array with the text separated by the '\n' token, then filters the empty strings and then join again with an '\n' character |
67,337,853 | Is there a way in javascript in which you can remove the empty lines from a text. And if there is, is the only option iterating over the text to check if there is an empty line or is there a straightforward way. Any help is appreciated. Thanks in advance.
For example:
```
This
is
an
example
```
would change to
... | 2021/04/30 | [
"https://Stackoverflow.com/questions/67337853",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15656320/"
] | You can use the following code:
```
text = `This
is
an
example`
cleaned_text = text.split('\n').filter(x=> x !== '').join('\n');
```
The split makes an array with the text separated by the '\n' token, then filters the empty strings and then join again with an '\n' character | You can use [`String.prototype.replaceAll`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replaceAll) with a RegExp pattern to get what you need:
```
const str = `This
is
an
example`;
console.log(str.replaceAll(/\n\n+/ig, `\n`, str);
``` |
51,640,799 | Been bouncing back and forth between Swift and C# and I'm not sure if I'm forgetting certain things, or if C# just doesn't easily support what I'm after.
Consider this code which calculates the initial value for `Foo`:
```
// Note: This is a field on an object, not a local variable.
int Foo = CalculateInitialFoo();
... | 2018/08/01 | [
"https://Stackoverflow.com/questions/51640799",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/168179/"
] | I wouldn't suggest doing this, but you could use an anonymous function to initialize
```
int _foo = new Func<int>(() =>
{
return 5;
})();
```
Is there a reason you would like to do it using lambdas rather than named functions, or as a calculated property?
I assume you want to avoid calculated properties because... | You could initialize your field in the constructor and declare `CalculateInitialFoo` as local function.
```
private int _foo;
public MyType()
{
_foo = CalculateInitialFoo();
int CalculateInitialFoo()
{
int x = 0;
// Perform calculations to get x
return x;
}
}
```
Th... |
51,640,799 | Been bouncing back and forth between Swift and C# and I'm not sure if I'm forgetting certain things, or if C# just doesn't easily support what I'm after.
Consider this code which calculates the initial value for `Foo`:
```
// Note: This is a field on an object, not a local variable.
int Foo = CalculateInitialFoo();
... | 2018/08/01 | [
"https://Stackoverflow.com/questions/51640799",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/168179/"
] | To solve the problem in the general case you'd need to create and then execute an anonymous function, which you can technically do as an expression:
```
int Foo = new Func<int>(() =>
{
int x = 0;
// Perform calculations to get x
return x;
})();
```
You can clean this up a bit by writ... | You could initialize your field in the constructor and declare `CalculateInitialFoo` as local function.
```
private int _foo;
public MyType()
{
_foo = CalculateInitialFoo();
int CalculateInitialFoo()
{
int x = 0;
// Perform calculations to get x
return x;
}
}
```
Th... |
695,755 | Am getting an error mentioned below when I call my WCF service?How do i get rid of it?
There was an error while trying to serialize parameter <http://tempuri.org/:MyWCFSvc.svc>
The InnerException message was 'Type 'System.String[]' with data contract name 'ArrayOfstring:<http://schemas.microsoft.com/2003/10/Serializat... | 2009/03/30 | [
"https://Stackoverflow.com/questions/695755",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/68717/"
] | A year late, but I had the same issue and here is what you need to do
```
List<SomeClass> mylist = new List<SomeClass>();
DataContractSerializer dcs = new DataContractSerializer(mylist.GetType());
XmlWriter writer = XmlWriter.Create(sb, XWS);
dcs.WriteObject(writer, query);
writer.Close();
```
The problem is ... | There's no reason for you to have to KnownType an array of strings. The serializer should already know about that, and arrays are not a problem. I'm moving Lists of things around in WCF without an issue. Could you post a representative sample of what you're doing? |
695,755 | Am getting an error mentioned below when I call my WCF service?How do i get rid of it?
There was an error while trying to serialize parameter <http://tempuri.org/:MyWCFSvc.svc>
The InnerException message was 'Type 'System.String[]' with data contract name 'ArrayOfstring:<http://schemas.microsoft.com/2003/10/Serializat... | 2009/03/30 | [
"https://Stackoverflow.com/questions/695755",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/68717/"
] | I too had the same issues but after qualifiying the OperationContract with `[ServiceKnownType(typeof(string[]))]` and `[ServiceKnownType(typeof(int[]))]` fixed the issue.
Eg:
```
[ServiceContract]
public interface IReportService
{
[OperationContract]
[ServiceKnownType(typeof(string[]))]
... | There's no reason for you to have to KnownType an array of strings. The serializer should already know about that, and arrays are not a problem. I'm moving Lists of things around in WCF without an issue. Could you post a representative sample of what you're doing? |
695,755 | Am getting an error mentioned below when I call my WCF service?How do i get rid of it?
There was an error while trying to serialize parameter <http://tempuri.org/:MyWCFSvc.svc>
The InnerException message was 'Type 'System.String[]' with data contract name 'ArrayOfstring:<http://schemas.microsoft.com/2003/10/Serializat... | 2009/03/30 | [
"https://Stackoverflow.com/questions/695755",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/68717/"
] | A year late, but I had the same issue and here is what you need to do
```
List<SomeClass> mylist = new List<SomeClass>();
DataContractSerializer dcs = new DataContractSerializer(mylist.GetType());
XmlWriter writer = XmlWriter.Create(sb, XWS);
dcs.WriteObject(writer, query);
writer.Close();
```
The problem is ... | Configuring service references on your client provides "Data Type" options that allow you to specify different types for Collection/Dictionary Types. What settings do you have in there? |
695,755 | Am getting an error mentioned below when I call my WCF service?How do i get rid of it?
There was an error while trying to serialize parameter <http://tempuri.org/:MyWCFSvc.svc>
The InnerException message was 'Type 'System.String[]' with data contract name 'ArrayOfstring:<http://schemas.microsoft.com/2003/10/Serializat... | 2009/03/30 | [
"https://Stackoverflow.com/questions/695755",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/68717/"
] | I too had the same issues but after qualifiying the OperationContract with `[ServiceKnownType(typeof(string[]))]` and `[ServiceKnownType(typeof(int[]))]` fixed the issue.
Eg:
```
[ServiceContract]
public interface IReportService
{
[OperationContract]
[ServiceKnownType(typeof(string[]))]
... | Configuring service references on your client provides "Data Type" options that allow you to specify different types for Collection/Dictionary Types. What settings do you have in there? |
695,755 | Am getting an error mentioned below when I call my WCF service?How do i get rid of it?
There was an error while trying to serialize parameter <http://tempuri.org/:MyWCFSvc.svc>
The InnerException message was 'Type 'System.String[]' with data contract name 'ArrayOfstring:<http://schemas.microsoft.com/2003/10/Serializat... | 2009/03/30 | [
"https://Stackoverflow.com/questions/695755",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/68717/"
] | A year late, but I had the same issue and here is what you need to do
```
List<SomeClass> mylist = new List<SomeClass>();
DataContractSerializer dcs = new DataContractSerializer(mylist.GetType());
XmlWriter writer = XmlWriter.Create(sb, XWS);
dcs.WriteObject(writer, query);
writer.Close();
```
The problem is ... | I too had the same issues but after qualifiying the OperationContract with `[ServiceKnownType(typeof(string[]))]` and `[ServiceKnownType(typeof(int[]))]` fixed the issue.
Eg:
```
[ServiceContract]
public interface IReportService
{
[OperationContract]
[ServiceKnownType(typeof(string[]))]
... |
25,937,806 | What is the preferred way of producing a String which holds a sequence of whitespaces of an arbitrary length? Is it this way:
```
final String spaces = " "; //three white spaces
```
or is there a better way? | 2014/09/19 | [
"https://Stackoverflow.com/questions/25937806",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2200045/"
] | I'd say personal preference, as long as the person that will maintain the code after you know what's happening that's what is most important.
Here is another option:
```
final String spaces = String.format("%"+ 3 +"s", " ");
```
Just to add on from @Freiheit, this would be another solution to the problem.
```
fina... | I assume you want to pad or indent other Strings. Using something like [Apache StringUtils.leftPad](http://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html#leftPad(java.lang.String,%20int)) is a much better option than having whitespace String variables. |
3,059,013 | I'm aware that this kind of question should be asked in Computer Science Stack Exchange. But I decided to ask here because there should be more effective answers here with more experienced people with solid math background that might have taught themselves some computer science.
I decided to ask this question after be... | 2019/01/02 | [
"https://math.stackexchange.com/questions/3059013",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/413924/"
] | >
> Based on the belief that computer system and programming can be completely theoretical, I decided to learn from the very basic.
>
>
>
It's a bit arrogant to stick too tightly to such a belief when you're still learning the field don'tcha think?
*Some* areas of computer science can be called "completely theore... | If you are at a university offering computer science degrees, you could find out the names of a few courses that are required for 2nd or 3d year students, get a copy of the text book for one of them, and try to read it.
One thing making your task harder is that computer science is a very wide field, and no one book c... |
3,059,013 | I'm aware that this kind of question should be asked in Computer Science Stack Exchange. But I decided to ask here because there should be more effective answers here with more experienced people with solid math background that might have taught themselves some computer science.
I decided to ask this question after be... | 2019/01/02 | [
"https://math.stackexchange.com/questions/3059013",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/413924/"
] | >
> Based on the belief that computer system and programming can be completely theoretical, I decided to learn from the very basic.
>
>
>
It's a bit arrogant to stick too tightly to such a belief when you're still learning the field don'tcha think?
*Some* areas of computer science can be called "completely theore... | >
> I wish there are some theoretical textbooks that build the whole
> operation system, compiler, or some of this kind, that is readable to
> math students.
>
>
>
I highly recommend reading [The Elements of Computing Systems](https://rads.stackoverflow.com/amzn/click/0262640686) by Nisan and Schocken, and doing... |
73,154,413 | symbolic model function passing
Hi!
I stuck in my fitting due to my symbolic function,
Please kindly let me know how this issue could be solved here is my code, I need to pass tow independent\_var which are xCl and XI and a is parameter:
```
import numpy as np
import lmfit
import sympy as sp
anion = {'I': 1, 'Cl':... | 2022/07/28 | [
"https://Stackoverflow.com/questions/73154413",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19370106/"
] | We can do an outer join on the `id` fields and then use `coalesce()` to prioritize the fields from `dfn`.
```
columns = ['id', 'neighbor_sid', 'neighbor', 'division']
dfo. \
join(dfn, 'id', 'outer'). \
select(*['id'] + [func.coalesce(dfn[k], dfo[k]).alias(k) for k in columns if k != 'id']). \
orderBy('id'... | Id do a full outer join then coalesce to choose the second table where necessary:
```
# imports and creating data example
from pyspark.sql import functions as F, Window as W
cols = ["id", "neighbor_sid", "neighbor", "division"]
data1 = [
["a1", 1100, 'Naalehu', 'Hawaii'],
["a2", 1101, 'key-west-fl', 'Miami'],
... |
27,718,032 | I have very basic issue and have following code. In rare cases, we are not able to call setDriver(set driver object) and call getDriver function for calling driver class function which resultant memory crash( as setdriver has not set). is it possible to check getdriver object. I have tried to set NULL but as we are ret... | 2014/12/31 | [
"https://Stackoverflow.com/questions/27718032",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3996232/"
] | References can't point to nothing so I suggest two options:
a) throw an exception - this for me is clearly the best solution; this is an edge case and very appropriate for exception handling
b) Include a method driver.isLoaded() which the caller can check - in the case when you can't allocate a driver return a stub dri... | A safe way to don't have to check if pointer is null is to force it to never be:
```
class sample {
public:
// No default constructor
explicit sample(Driver &driver) m_d(&driver) {}
void setDriver(Driver &driver) { m_d = &driver; }
Driver& getDriver() { return *m_d; }
private:
Driver *m_d;
};
``... |
60,889,245 | What does this mean, and how do I fix it, I know for a fact my code is correct and nothing is wrong with it, I checked with multiple friends. I have no idea why this is happening and I need my bot to start working soon. | 2020/03/27 | [
"https://Stackoverflow.com/questions/60889245",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12055789/"
] | This is an error happening within the discord.js library if a web request is stuck for a long time, which might happen due to an outage or bad internet connection. Those connections are killed with that error message to free resources.
Those errors should not be fatal and can be ignored. | Expanding flame’s point - put your code in a try catch statement e.g.
```js
try {
//code
} catch (error) {
//error code for example
console.log('an error has occurred')
//if you want no error has occurred log
console.log('')
// ^ will not log anything
}
```
Alternatively, I’ve researched that it could be something t... |
155,933 | I saw some kind of workflow in vim:
Vim had a file open. Then some combination of keys made vim disappear and the user was in the command line working in cli mode, then opened another file and then suddenly returned to the previously opened file exactly at the place/line he was.
It reminded me the switch among wi... | 2014/09/16 | [
"https://unix.stackexchange.com/questions/155933",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/42132/"
] | There are several options to do so:
* You can use a terminal multiplexer like [screen](http://en.wikipedia.org/wiki/GNU_Screen) or [tmux](http://en.wikipedia.org/wiki/Tmux).
In screen, for example, the shortcut `Ctrl`+`a` - `a`, has the same functiononality as `Alt`+`Tab` in graphical environments: switch to the last... | I don't know about the "suddenly returned ..." part, but the first bit is fairly trivial. The `:shell` command opens your shell. For me, it opens at wherever I was when I opened `vim`, so it is inheriting settings from `vim`, [as G-Man notes](https://unix.stackexchange.com/questions/155933/switching-among-cli-and-vim-a... |
155,933 | I saw some kind of workflow in vim:
Vim had a file open. Then some combination of keys made vim disappear and the user was in the command line working in cli mode, then opened another file and then suddenly returned to the previously opened file exactly at the place/line he was.
It reminded me the switch among wi... | 2014/09/16 | [
"https://unix.stackexchange.com/questions/155933",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/42132/"
] | There are several options to do so:
* You can use a terminal multiplexer like [screen](http://en.wikipedia.org/wiki/GNU_Screen) or [tmux](http://en.wikipedia.org/wiki/Tmux).
In screen, for example, the shortcut `Ctrl`+`a` - `a`, has the same functiononality as `Alt`+`Tab` in graphical environments: switch to the last... | You can press `Ctrl-z` to stop vim and go to CLI, do whatever you need to (edit another vim file perhaps), then press `fg` on command line to return back into vim at the same place you left off at. If you didn't see the command `fg` being typed, then it's very likely that [screen](http://www.gnu.org/software/screen/) w... |
72,434,598 | we are trying to get the content of the attachment's of the in the rtf mail but I have tried to search using different terms but have not found any reliable solution . can someone please help me to get the source of the attachment's as we get them in the html format. | 2022/05/30 | [
"https://Stackoverflow.com/questions/72434598",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9808048/"
] | I think the error in the second for loop
change :
```
x < SystemInformation.VirtualScreen.Height
```
To :
```
y < SystemInformation.VirtualScreen.Height
```
Like This
```
for (int x = 0; x < SystemInformation.VirtualScreen.Width; x++)
{
for (int y = 0; y < SystemInformation.Virtu... | It's an excellent way to learn how to debug.
The exception is thrown on this line:
```
Color currentPixelColor = bitmap.GetPixel(x, y);
```
And it clearly states that the error is on `y`. If you put your mouse over the `y`, you'll see `1080` (probably, depending on your screen resolution), which is, indeed, out of ... |
72,434,598 | we are trying to get the content of the attachment's of the in the rtf mail but I have tried to search using different terms but have not found any reliable solution . can someone please help me to get the source of the attachment's as we get them in the html format. | 2022/05/30 | [
"https://Stackoverflow.com/questions/72434598",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9808048/"
] | I think the error in the second for loop
change :
```
x < SystemInformation.VirtualScreen.Height
```
To :
```
y < SystemInformation.VirtualScreen.Height
```
Like This
```
for (int x = 0; x < SystemInformation.VirtualScreen.Width; x++)
{
for (int y = 0; y < SystemInformation.Virtu... | This worked. I don't know if this is the best thing to do, what do you guys think
```
try
{
Bitmap bitmap = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
Graphics graphics = Graphics.FromImage(bitmap as Image);
graphics.Co... |
72,434,598 | we are trying to get the content of the attachment's of the in the rtf mail but I have tried to search using different terms but have not found any reliable solution . can someone please help me to get the source of the attachment's as we get them in the html format. | 2022/05/30 | [
"https://Stackoverflow.com/questions/72434598",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9808048/"
] | It's an excellent way to learn how to debug.
The exception is thrown on this line:
```
Color currentPixelColor = bitmap.GetPixel(x, y);
```
And it clearly states that the error is on `y`. If you put your mouse over the `y`, you'll see `1080` (probably, depending on your screen resolution), which is, indeed, out of ... | This worked. I don't know if this is the best thing to do, what do you guys think
```
try
{
Bitmap bitmap = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
Graphics graphics = Graphics.FromImage(bitmap as Image);
graphics.Co... |
16,202,436 | merge list of lists for example
```
list_of_lists = [['NA','NA','NA','0,678'], ['0.327','NA','NA','NA'], ...]
```
I want
```
merged = ['0.327','NA','NA','0,678']
```
Please comment. | 2013/04/24 | [
"https://Stackoverflow.com/questions/16202436",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2150169/"
] | Use a list comprehension with a nested generator expression to pick the first non-`NA` element, together with `zip()`:
```
merged = [next((el for el in elements if el != 'NA'), 'NA') for elements in zip(*list_of_lists)]
```
Demo:
```
>>> list_of_lists = [['NA','NA','NA','0,678'], ['0.327','NA','NA','NA']]
>>> [next... | Assuming that there both list do not have values in the same position (as suggested by Martijn Pieters) then you could use:
```
for i in range(len(l1)):
l1[i] = l2[i] if l1[i] == 'NA' and l2[i] != 'NA' else l1[i]
```
Hope this helps! |
16,202,436 | merge list of lists for example
```
list_of_lists = [['NA','NA','NA','0,678'], ['0.327','NA','NA','NA'], ...]
```
I want
```
merged = ['0.327','NA','NA','0,678']
```
Please comment. | 2013/04/24 | [
"https://Stackoverflow.com/questions/16202436",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2150169/"
] | Use a list comprehension with a nested generator expression to pick the first non-`NA` element, together with `zip()`:
```
merged = [next((el for el in elements if el != 'NA'), 'NA') for elements in zip(*list_of_lists)]
```
Demo:
```
>>> list_of_lists = [['NA','NA','NA','0,678'], ['0.327','NA','NA','NA']]
>>> [next... | ```
>>> list_of_lists = [['NA','NA','NA','0,678'], ['0.327','NA','NA','NA']]
>>> from itertools import ifilter # Py3k doesn't need import, use filter built-in
>>> [next(ifilter('NA'.__ne__, col), 'NA') for col in zip(*list_of_lists)]
['0.327', 'NA', 'NA', '0,678']
``` |
9,362,324 | ```
protected function button1_clickHandler(event:MouseEvent):void
{
Security.allowDomain("*.googleapis.com" );
Security.allowDomain("*.google.com" );
var q : URLLoader = new URLLoader();
q.addEventListener( Event.COMPLETE, onGeocodingComplete );
... | 2012/02/20 | [
"https://Stackoverflow.com/questions/9362324",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/767942/"
] | ```
Cell = Cell.Select(s => System.Web.HttpUtility.HtmlEncode(s)).ToList();
```
or
shorter:
```
Cell = Cell.Select(System.Web.HttpUtility.HtmlEncode).ToList();
``` | you could create an extension method that does the trick
```
public static class MyCustomListMethod
{
public static void Add(this IList<string> list, string item,bool htmlEndode){
list.Add(System.Web.HttpUtility.HtmlEncode(item));
}
}
```
and then
```
public static void Main(... |
9,362,324 | ```
protected function button1_clickHandler(event:MouseEvent):void
{
Security.allowDomain("*.googleapis.com" );
Security.allowDomain("*.google.com" );
var q : URLLoader = new URLLoader();
q.addEventListener( Event.COMPLETE, onGeocodingComplete );
... | 2012/02/20 | [
"https://Stackoverflow.com/questions/9362324",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/767942/"
] | You could use the [`ConvertAll<T>`](http://msdn.microsoft.com/en-us/library/73fe8cwf.aspx) extension method :
```
Cell = Cell.ConvertAll<string>(s => System.Web.HttpUtility.HtmlEncode(s));
```
or shorter :
```
Cell = Cell.ConvertAll<string>(System.Web.HttpUtility.HtmlEncode);
``` | you could create an extension method that does the trick
```
public static class MyCustomListMethod
{
public static void Add(this IList<string> list, string item,bool htmlEndode){
list.Add(System.Web.HttpUtility.HtmlEncode(item));
}
}
```
and then
```
public static void Main(... |
57,346,913 | I'm creating simple web automation using JavaScript and selenium for homework purposes.
The purpose of the exercise is really simple, click on a link and fill a web form in the new page.
The problem is that I'm not able to fill this form even though I'm able to locate the web element correctly ( I think ).
I tried ... | 2019/08/04 | [
"https://Stackoverflow.com/questions/57346913",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11812367/"
] | Please replace below line of code:
```
const username = driver.findElement(By.xpath("//form/div/div/input[@id = "username"]")).sendKeys("some text");
```
with this line:
```
const username = driver.findElement(By.xpath("//form/div/div/input[@id = 'username']")).sendKeys("some text");
```
Since you are using doubl... | I see a number of problems with this code. I'm not sure what the `url` variable holds at runtime, but I suspect it holds the URL to the login page. You want to go to the URL first, then fill in fields.
```
const driver = new selenium.Builder().forBrowser("chrome").build();
driver.get(url);
```
Next, you need to mak... |
675,294 | ```
\documentclass{article}
\usepackage{hyperref}
\usepackage{expl3}
\hypersetup{
colorlinks=true,
linkcolor=blue,
filecolor=magenta,
urlcolor=cyan,
pdftitle={Overleaf Example},
pdfpagemode=FullScreen,
}
\ExplSyntaxOn
\NewDocumentCommand{\curl}{m}{
\tl_set:Nn \l_tmpa_tl {#1}
\re... | 2023/02/15 | [
"https://tex.stackexchange.com/questions/675294",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/289984/"
] | Here is how to pop left the sequence such as to obtain `1a1c6e99h6`.
```
\documentclass{article}
\usepackage{hyperref}
\usepackage{expl3}
\hypersetup{
colorlinks=true,
linkcolor=blue,
filecolor=magenta,
urlcolor=cyan,
pdftitle={Overleaf Example},
pdfpagemode=FullScreen,
}
\ExplSyntaxOn... | I think you don't want extraction, but just replacement:
```
\documentclass{article}
\usepackage{hyperref}
\usepackage{expl3}
\hypersetup{
colorlinks=true,
linkcolor=blue,
filecolor=magenta,
urlcolor=cyan,
pdftitle={Overleaf Example},
pdfpagemode=FullScreen,
}
\ExplSyntaxOn
\NewDocume... |
13,729,199 | New web developer here so please bear with me...
I'm creating an FAQ page on our site with 10-15 questions that I would like to display the answer to after clicking on the question.
Example:
Q. What is your name?
(after clicking the question, the answer will slide down displaying the text)
Adam
I would also like ... | 2012/12/05 | [
"https://Stackoverflow.com/questions/13729199",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1879937/"
] | It is better if you encase the question and corresponding answer inside a Separate div..
**HTML**
```
<div>
<p class="question">Q. WHO IS REQUIRED TO PARTICIPATE?</p>
<p class="answer">Everyone must participate. </p>
</div>
<div>
<p class="question">Q. MINIMUM AGE OF THE PARTICIPA... | ### Try using this code.
Even though you are a beginner, using semantic tags like, `UL` and `LI` is semantic and good. Giving `H3` and `P` for the questions and answers are useful because, it works even when the CSS is not present.
**HTML:**
```
<ul class="faq">
<li>
<h3><a href="#">Question 1</a></h3>
... |
582,019 | I am creating some cockburn tables using this [wonderful site](https://www.tablesgenerator.com/) suggested to me. The problem I encountered is that the table below looks like this:
[](https://i.stack.imgur.com/ZtvB4.png)
What do I expect
[![enter im... | 2021/02/05 | [
"https://tex.stackexchange.com/questions/582019",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/234567/"
] | * your table is huge
* page layout is unknow
* in following suggestion is assumed:
+ that font size in table can be smaller, i.e. be of `\footnotesize
+ line spread can be reduced
+ page layout is defined by `geometry` package default settings:
```
\documentclass{article}
\usepackage{geometry}
\usepackage[table,xcd... | The table presented looks like part of a project documentation, perhaps a GUI. That means it will be a living document,
with changes and additions throughout the life of the project.
So it will be a futile exercise trying to fit this particular table on a single page. It won't last the first draft.
Looking closely, it... |
4,139,824 | I want to add a slide up affect with jQuery to a DIV when a link inside of the DIV is clicked, but the problem i am running into is the class of the DIV's are defined by a loop. So, i can't define the DIV class in the jQuery line, because each DIV class is different and i cannot determine ahead of time what they are. I... | 2010/11/09 | [
"https://Stackoverflow.com/questions/4139824",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/476412/"
] | Apparently you cannot remove DOM nodes that are not in the DOM at the moment.
You could use:
```
nodes = nodes.not('#b');
```
Keep in mind that even after (and during) manipulation, ids should be unique. | **EDIT** - Updated to support not inserting the div's into the DOM, and simply removing them pre-insertion.
```
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script>
<script>
$(function() {
var data = '<div class="1">aa</div> <div class="2">bb... |
387,411 | [](https://i.stack.imgur.com/ox5p4.jpg) This is on a control board from a crane...not sure of crane mfg or country of origin. Anyway, owner lost 12Vdc to the board and tried to jumper it in...ooops. This is where the smoke came out...can't seem to find... | 2018/07/24 | [
"https://electronics.stackexchange.com/questions/387411",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/194349/"
] | That's some kind of diode, possibly in a SMA package. Note the cathode band on the left end (as oriented in your picture).
The designation "V" hints that it might be used as a voltage reference, which would mean a Zener diode. However, without seeing the rest of the circuit or a repair manual, there is no way to know.... | From the looks of it it is a ST part. Problem is, the actual product marking is right where the case blew up. So there is no way to determine the correct part based on the code.
Here is the typical marking of a ST diode in a SMx case:
[](https://i.s... |
1,767,899 | Let $a,b,c,a',b',c'\in \mathbb{Z}\_{\geq 1}$ be such that
$$
\frac{1}{a}+\frac{1}{b}+\frac{1}{c}<1,\quad \frac{1}{a'}+\frac{1}{b'}+\frac{1}{c'}<1.
$$
Suppose
$$
\frac{1}{a}+\frac{1}{b}+\frac{1}{c}=\frac{1}{a'}+\frac{1}{b'}+\frac{1}{c'}.
$$
Is it true that $\{a,b,c\}=\{a',b',c'\}$? If it is not, it should be easy to g... | 2016/05/02 | [
"https://math.stackexchange.com/questions/1767899",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/336294/"
] | COUNTEREXAMPLE.
Take $\left\{a,b,c \right\}=\left\{4k,6k,12k\right\}$ and $\left\{a',b',c' \right\}=\left\{6k,6k,6k\right\}$. Then both sums add up to $\frac{1}{2k}$.
Since @HRSE asks, here is another counterexample, in the case $\left\{a,b,c \right\}=\left\{40k,20k,120k\right\}$$\left\{a',b',c' \right\}=\left\{21k... | It is not true. Take a=2,b=3,c=-2,a'= 3, b'=3, c'=-3. |
1,767,899 | Let $a,b,c,a',b',c'\in \mathbb{Z}\_{\geq 1}$ be such that
$$
\frac{1}{a}+\frac{1}{b}+\frac{1}{c}<1,\quad \frac{1}{a'}+\frac{1}{b'}+\frac{1}{c'}<1.
$$
Suppose
$$
\frac{1}{a}+\frac{1}{b}+\frac{1}{c}=\frac{1}{a'}+\frac{1}{b'}+\frac{1}{c'}.
$$
Is it true that $\{a,b,c\}=\{a',b',c'\}$? If it is not, it should be easy to g... | 2016/05/02 | [
"https://math.stackexchange.com/questions/1767899",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/336294/"
] | Since you did not specify that $a\neq b\neq c$ and $a'\neq b'\neq c'$ an obvious counterexample is:
$1/4 + 1/4 +1/3= 5/6$
$1/6+1/3+1/3= 5/6$
I think the interesting question is what if you assume that $a\neq b\neq c$. Does there then exist $a',b',c'$ such that $1/a+1/b+1/c=1/a'+1/b'+1/c'$, $a'\neq b'\neq c'$ and $\{... | It is not true. Take a=2,b=3,c=-2,a'= 3, b'=3, c'=-3. |
1,767,899 | Let $a,b,c,a',b',c'\in \mathbb{Z}\_{\geq 1}$ be such that
$$
\frac{1}{a}+\frac{1}{b}+\frac{1}{c}<1,\quad \frac{1}{a'}+\frac{1}{b'}+\frac{1}{c'}<1.
$$
Suppose
$$
\frac{1}{a}+\frac{1}{b}+\frac{1}{c}=\frac{1}{a'}+\frac{1}{b'}+\frac{1}{c'}.
$$
Is it true that $\{a,b,c\}=\{a',b',c'\}$? If it is not, it should be easy to g... | 2016/05/02 | [
"https://math.stackexchange.com/questions/1767899",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/336294/"
] | COUNTEREXAMPLE.
Take $\left\{a,b,c \right\}=\left\{4k,6k,12k\right\}$ and $\left\{a',b',c' \right\}=\left\{6k,6k,6k\right\}$. Then both sums add up to $\frac{1}{2k}$.
Since @HRSE asks, here is another counterexample, in the case $\left\{a,b,c \right\}=\left\{40k,20k,120k\right\}$$\left\{a',b',c' \right\}=\left\{21k... | Since you did not specify that $a\neq b\neq c$ and $a'\neq b'\neq c'$ an obvious counterexample is:
$1/4 + 1/4 +1/3= 5/6$
$1/6+1/3+1/3= 5/6$
I think the interesting question is what if you assume that $a\neq b\neq c$. Does there then exist $a',b',c'$ such that $1/a+1/b+1/c=1/a'+1/b'+1/c'$, $a'\neq b'\neq c'$ and $\{... |
1,767,899 | Let $a,b,c,a',b',c'\in \mathbb{Z}\_{\geq 1}$ be such that
$$
\frac{1}{a}+\frac{1}{b}+\frac{1}{c}<1,\quad \frac{1}{a'}+\frac{1}{b'}+\frac{1}{c'}<1.
$$
Suppose
$$
\frac{1}{a}+\frac{1}{b}+\frac{1}{c}=\frac{1}{a'}+\frac{1}{b'}+\frac{1}{c'}.
$$
Is it true that $\{a,b,c\}=\{a',b',c'\}$? If it is not, it should be easy to g... | 2016/05/02 | [
"https://math.stackexchange.com/questions/1767899",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/336294/"
] | COUNTEREXAMPLE.
Take $\left\{a,b,c \right\}=\left\{4k,6k,12k\right\}$ and $\left\{a',b',c' \right\}=\left\{6k,6k,6k\right\}$. Then both sums add up to $\frac{1}{2k}$.
Since @HRSE asks, here is another counterexample, in the case $\left\{a,b,c \right\}=\left\{40k,20k,120k\right\}$$\left\{a',b',c' \right\}=\left\{21k... | For the more general case when $a\neq b\neq c$ and $a'\neq b'\neq c'$, the answer is also no.
In particular, let $\frac1a +\frac1b = \frac{1}{a'}$, and $\frac{1}{c} = \frac{1}{b'} +\frac{1}{c'}$. Then $a' = \frac{ab}{a + b}$, and $c = \frac{b' c' }{b'+ c'}$. We'd want these to be integers.
A simple way of making $\f... |
1,767,899 | Let $a,b,c,a',b',c'\in \mathbb{Z}\_{\geq 1}$ be such that
$$
\frac{1}{a}+\frac{1}{b}+\frac{1}{c}<1,\quad \frac{1}{a'}+\frac{1}{b'}+\frac{1}{c'}<1.
$$
Suppose
$$
\frac{1}{a}+\frac{1}{b}+\frac{1}{c}=\frac{1}{a'}+\frac{1}{b'}+\frac{1}{c'}.
$$
Is it true that $\{a,b,c\}=\{a',b',c'\}$? If it is not, it should be easy to g... | 2016/05/02 | [
"https://math.stackexchange.com/questions/1767899",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/336294/"
] | Since you did not specify that $a\neq b\neq c$ and $a'\neq b'\neq c'$ an obvious counterexample is:
$1/4 + 1/4 +1/3= 5/6$
$1/6+1/3+1/3= 5/6$
I think the interesting question is what if you assume that $a\neq b\neq c$. Does there then exist $a',b',c'$ such that $1/a+1/b+1/c=1/a'+1/b'+1/c'$, $a'\neq b'\neq c'$ and $\{... | For the more general case when $a\neq b\neq c$ and $a'\neq b'\neq c'$, the answer is also no.
In particular, let $\frac1a +\frac1b = \frac{1}{a'}$, and $\frac{1}{c} = \frac{1}{b'} +\frac{1}{c'}$. Then $a' = \frac{ab}{a + b}$, and $c = \frac{b' c' }{b'+ c'}$. We'd want these to be integers.
A simple way of making $\f... |
36,956,375 | I wrote this code to compare two `CSV files (f1 and f2)` which both have 3 columns and many rows, then each time an `item at cell 1 of f1 matches that of f2` and `item at cell 2 of f1 matches that of f2, it should write the values`cell1 of f1, cell2 of f1, cell 3 of f2, for each respective column to a file named `netwo... | 2016/04/30 | [
"https://Stackoverflow.com/questions/36956375",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3449019/"
] | I am thinking load all files to memory than compare them.
```
import csv
with open(file1Path,'rb') as f:
r = csv.reader(f)
res1 = [line for line in f]
with open(file2Path,'rb') as f:
r = csv.reader(f)
res2 = [line for line in f]
final = [ [file1col[0],file1col[1],file2... | Try to not modify the "t" `dict` each time you get a new row and use generators instead of it
```
def get_row():
with open('file1.csv') as ff:
for f1 in csv.DictReader(ff):
with open('file2.csv') as ff:
for f2 in csv.DictReader(ff):
if int(f1['From'].strip())... |
36,956,375 | I wrote this code to compare two `CSV files (f1 and f2)` which both have 3 columns and many rows, then each time an `item at cell 1 of f1 matches that of f2` and `item at cell 2 of f1 matches that of f2, it should write the values`cell1 of f1, cell2 of f1, cell 3 of f2, for each respective column to a file named `netwo... | 2016/04/30 | [
"https://Stackoverflow.com/questions/36956375",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3449019/"
] | Not 100% sure but lists should be slightly more efficient in your case (iteration, memory and no look up). However, dictionnaries are extremely efficient to look up values. Also, you don't need to convert to integer and use strip when comparing. This code should work fine.
```
import csv
output = []
with open('file1.... | Try to not modify the "t" `dict` each time you get a new row and use generators instead of it
```
def get_row():
with open('file1.csv') as ff:
for f1 in csv.DictReader(ff):
with open('file2.csv') as ff:
for f2 in csv.DictReader(ff):
if int(f1['From'].strip())... |
36,956,375 | I wrote this code to compare two `CSV files (f1 and f2)` which both have 3 columns and many rows, then each time an `item at cell 1 of f1 matches that of f2` and `item at cell 2 of f1 matches that of f2, it should write the values`cell1 of f1, cell2 of f1, cell 3 of f2, for each respective column to a file named `netwo... | 2016/04/30 | [
"https://Stackoverflow.com/questions/36956375",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3449019/"
] | You could create a `dict` where key is `(from, to)` from both csv files and combine them for the result:
```
import csv
from collections import OrderedDict
with open('file1.csv') as f:
reader = csv.reader(f)
reader.next()
rows = OrderedDict((tuple(row[:2]), None) for row in reader)
with open('file2.csv')... | Try to not modify the "t" `dict` each time you get a new row and use generators instead of it
```
def get_row():
with open('file1.csv') as ff:
for f1 in csv.DictReader(ff):
with open('file2.csv') as ff:
for f2 in csv.DictReader(ff):
if int(f1['From'].strip())... |
36,956,375 | I wrote this code to compare two `CSV files (f1 and f2)` which both have 3 columns and many rows, then each time an `item at cell 1 of f1 matches that of f2` and `item at cell 2 of f1 matches that of f2, it should write the values`cell1 of f1, cell2 of f1, cell 3 of f2, for each respective column to a file named `netwo... | 2016/04/30 | [
"https://Stackoverflow.com/questions/36956375",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3449019/"
] | Not 100% sure but lists should be slightly more efficient in your case (iteration, memory and no look up). However, dictionnaries are extremely efficient to look up values. Also, you don't need to convert to integer and use strip when comparing. This code should work fine.
```
import csv
output = []
with open('file1.... | I am thinking load all files to memory than compare them.
```
import csv
with open(file1Path,'rb') as f:
r = csv.reader(f)
res1 = [line for line in f]
with open(file2Path,'rb') as f:
r = csv.reader(f)
res2 = [line for line in f]
final = [ [file1col[0],file1col[1],file2... |
36,956,375 | I wrote this code to compare two `CSV files (f1 and f2)` which both have 3 columns and many rows, then each time an `item at cell 1 of f1 matches that of f2` and `item at cell 2 of f1 matches that of f2, it should write the values`cell1 of f1, cell2 of f1, cell 3 of f2, for each respective column to a file named `netwo... | 2016/04/30 | [
"https://Stackoverflow.com/questions/36956375",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3449019/"
] | You could create a `dict` where key is `(from, to)` from both csv files and combine them for the result:
```
import csv
from collections import OrderedDict
with open('file1.csv') as f:
reader = csv.reader(f)
reader.next()
rows = OrderedDict((tuple(row[:2]), None) for row in reader)
with open('file2.csv')... | I am thinking load all files to memory than compare them.
```
import csv
with open(file1Path,'rb') as f:
r = csv.reader(f)
res1 = [line for line in f]
with open(file2Path,'rb') as f:
r = csv.reader(f)
res2 = [line for line in f]
final = [ [file1col[0],file1col[1],file2... |
36,956,375 | I wrote this code to compare two `CSV files (f1 and f2)` which both have 3 columns and many rows, then each time an `item at cell 1 of f1 matches that of f2` and `item at cell 2 of f1 matches that of f2, it should write the values`cell1 of f1, cell2 of f1, cell 3 of f2, for each respective column to a file named `netwo... | 2016/04/30 | [
"https://Stackoverflow.com/questions/36956375",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3449019/"
] | You could create a `dict` where key is `(from, to)` from both csv files and combine them for the result:
```
import csv
from collections import OrderedDict
with open('file1.csv') as f:
reader = csv.reader(f)
reader.next()
rows = OrderedDict((tuple(row[:2]), None) for row in reader)
with open('file2.csv')... | Not 100% sure but lists should be slightly more efficient in your case (iteration, memory and no look up). However, dictionnaries are extremely efficient to look up values. Also, you don't need to convert to integer and use strip when comparing. This code should work fine.
```
import csv
output = []
with open('file1.... |
28,908,080 | I'm trying to select a random element in a 2D list in python.
I'm creating a blackjack game.
>
> I'm aware of how long and non-optimized this code is, but I'm new to programming and I want to make mistakes to learn.
>
>
> Here's the initial code that I have set up. I create the suits (spades, clubs, hearts, diam... | 2015/03/06 | [
"https://Stackoverflow.com/questions/28908080",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4598380/"
] | ```
import random
list2d = [range(0, 5), range(5, 10), range(10, 15), range(15, 20)]
for i in range(0, 10):
random_suite = random.choice(list2d)
random_card = random.choice(random_suite)
print random_suite, random_card
```
output:
```
[5, 6, 7, 8, 9] 7
[5, 6, 7, 8, 9] 5
[... | ```
#include <stdafx.h>
#include <iostream>
#include <cstdlib> // for rand() and srand()
#include <ctime> // for time()
using namespace std;
int main()
{
srand(time(0)); // set initial seed value to system clock
for (int nCount=0; nCount < 100; ++nCount)
{
cout << rand() << "\t";
if ((nCo... |
28,908,080 | I'm trying to select a random element in a 2D list in python.
I'm creating a blackjack game.
>
> I'm aware of how long and non-optimized this code is, but I'm new to programming and I want to make mistakes to learn.
>
>
> Here's the initial code that I have set up. I create the suits (spades, clubs, hearts, diam... | 2015/03/06 | [
"https://Stackoverflow.com/questions/28908080",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4598380/"
] | The list you enter in random.choice() must be a 1D array.
So you can do this,
```
random_list_of_suits = np.random.choice(list_of_suits) # you can get spades/clubs/hearts/diamonds
index_of_random_card_number = random.choice(len(random_list_of_suits))
random_card = random_list_of_suits[index_of_random_card_number] # Yo... | ```
#include <stdafx.h>
#include <iostream>
#include <cstdlib> // for rand() and srand()
#include <ctime> // for time()
using namespace std;
int main()
{
srand(time(0)); // set initial seed value to system clock
for (int nCount=0; nCount < 100; ++nCount)
{
cout << rand() << "\t";
if ((nCo... |
28,908,080 | I'm trying to select a random element in a 2D list in python.
I'm creating a blackjack game.
>
> I'm aware of how long and non-optimized this code is, but I'm new to programming and I want to make mistakes to learn.
>
>
> Here's the initial code that I have set up. I create the suits (spades, clubs, hearts, diam... | 2015/03/06 | [
"https://Stackoverflow.com/questions/28908080",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4598380/"
] | ```
import random
list2d = [range(0, 5), range(5, 10), range(10, 15), range(15, 20)]
for i in range(0, 10):
random_suite = random.choice(list2d)
random_card = random.choice(random_suite)
print random_suite, random_card
```
output:
```
[5, 6, 7, 8, 9] 7
[5, 6, 7, 8, 9] 5
[... | The list you enter in random.choice() must be a 1D array.
So you can do this,
```
random_list_of_suits = np.random.choice(list_of_suits) # you can get spades/clubs/hearts/diamonds
index_of_random_card_number = random.choice(len(random_list_of_suits))
random_card = random_list_of_suits[index_of_random_card_number] # Yo... |
382,875 | I have two of the exact same 2TB external HDDs. I copied a bunch of information to one of them and then copied everything from the first to the second HDD and now their sitting at different amounts of free space. The copy job completed without error and there are no obvious large hidden files lying around.
First ques... | 2012/01/27 | [
"https://superuser.com/questions/382875",
"https://superuser.com",
"https://superuser.com/users/38871/"
] | Several possible causes
* System restore or volume shadow copy using the extra space
* chkdsk found some file fragments and left them in some folder
* MFT size difference
* Cluster size difference (more obvious if you're had a lot of small files)
* Robocopy did not handle sparse files/compressed files/junctions correc... | You could use SyncToy from Microsoft, or ROBOCOPY with the /MIR command under Windows XP or higher. What OS are you using? |
55,926,830 | I'm filtering some data where say table.x has the following structure
```
column1 | c.2 |column3
0.0.0.0 | 20 | 2019-04-29 14:55:52
0.0.0.0 | 10 | 2019-04-29 14:45:52
0.0.0.0 | 50 | 2019-04-29 14:35:52
0.0.0.0 | 50 | 2019-04-29 14:25:52
0.0.0.0 | 90 | 2019-04-29 14:15:52
0.0.0.1 | 40 | 2019-04-29 14:05:52
0.0.0.1 | 4... | 2019/04/30 | [
"https://Stackoverflow.com/questions/55926830",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5450427/"
] | You need to get the max `column3` for each `column1` by grouping and then join to the table:
```
select t.*
from tablename t inner join (
select column1, max(column3) column3
from tablename
group by column1
) g on g.column1 = t.column1 and g.column3 = t.column3
``` | You could usea inner join on max col3 group by column1
```
select * from my_table m
inner join (
select column1, max(column3) col3
from my_table
group by column1
) t on t. column1 = m.column1 and t.col3 = m.column3
``` |
55,926,830 | I'm filtering some data where say table.x has the following structure
```
column1 | c.2 |column3
0.0.0.0 | 20 | 2019-04-29 14:55:52
0.0.0.0 | 10 | 2019-04-29 14:45:52
0.0.0.0 | 50 | 2019-04-29 14:35:52
0.0.0.0 | 50 | 2019-04-29 14:25:52
0.0.0.0 | 90 | 2019-04-29 14:15:52
0.0.0.1 | 40 | 2019-04-29 14:05:52
0.0.0.1 | 4... | 2019/04/30 | [
"https://Stackoverflow.com/questions/55926830",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5450427/"
] | You need to get the max `column3` for each `column1` by grouping and then join to the table:
```
select t.*
from tablename t inner join (
select column1, max(column3) column3
from tablename
group by column1
) g on g.column1 = t.column1 and g.column3 = t.column3
``` | Try the following SQL code:
```
SELECT max(column1), column2, max(column3) --maximum of IP address and time
FROM yourTable
GROUP BY column1 --grouped by IP address
```
The result is:
```
max(column1) | column2 | max(column3)
------------------------------------------------
0.0.0.0 ... |
55,926,830 | I'm filtering some data where say table.x has the following structure
```
column1 | c.2 |column3
0.0.0.0 | 20 | 2019-04-29 14:55:52
0.0.0.0 | 10 | 2019-04-29 14:45:52
0.0.0.0 | 50 | 2019-04-29 14:35:52
0.0.0.0 | 50 | 2019-04-29 14:25:52
0.0.0.0 | 90 | 2019-04-29 14:15:52
0.0.0.1 | 40 | 2019-04-29 14:05:52
0.0.0.1 | 4... | 2019/04/30 | [
"https://Stackoverflow.com/questions/55926830",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5450427/"
] | You need to get the max `column3` for each `column1` by grouping and then join to the table:
```
select t.*
from tablename t inner join (
select column1, max(column3) column3
from tablename
group by column1
) g on g.column1 = t.column1 and g.column3 = t.column3
``` | Try to use window function
```
select
column1, column2, column3
from (
SELECT
column1, column2, column3,
row_number() over ( partition by column1 ) pbg
FROM tablename
) aaaa
where aaaa.pbg = 1
``` |
55,926,830 | I'm filtering some data where say table.x has the following structure
```
column1 | c.2 |column3
0.0.0.0 | 20 | 2019-04-29 14:55:52
0.0.0.0 | 10 | 2019-04-29 14:45:52
0.0.0.0 | 50 | 2019-04-29 14:35:52
0.0.0.0 | 50 | 2019-04-29 14:25:52
0.0.0.0 | 90 | 2019-04-29 14:15:52
0.0.0.1 | 40 | 2019-04-29 14:05:52
0.0.0.1 | 4... | 2019/04/30 | [
"https://Stackoverflow.com/questions/55926830",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5450427/"
] | What about using `DISTINCT` with one column like so :
```
SELECT DISTINCT ON (column1) column1, column2, column3 FROM table_name
```
---
**Note** `c.2` is not a valid column name.
---
Here is a demo online <https://rextester.com/FBIS74019> | You could usea inner join on max col3 group by column1
```
select * from my_table m
inner join (
select column1, max(column3) col3
from my_table
group by column1
) t on t. column1 = m.column1 and t.col3 = m.column3
``` |
55,926,830 | I'm filtering some data where say table.x has the following structure
```
column1 | c.2 |column3
0.0.0.0 | 20 | 2019-04-29 14:55:52
0.0.0.0 | 10 | 2019-04-29 14:45:52
0.0.0.0 | 50 | 2019-04-29 14:35:52
0.0.0.0 | 50 | 2019-04-29 14:25:52
0.0.0.0 | 90 | 2019-04-29 14:15:52
0.0.0.1 | 40 | 2019-04-29 14:05:52
0.0.0.1 | 4... | 2019/04/30 | [
"https://Stackoverflow.com/questions/55926830",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5450427/"
] | What about using `DISTINCT` with one column like so :
```
SELECT DISTINCT ON (column1) column1, column2, column3 FROM table_name
```
---
**Note** `c.2` is not a valid column name.
---
Here is a demo online <https://rextester.com/FBIS74019> | Try the following SQL code:
```
SELECT max(column1), column2, max(column3) --maximum of IP address and time
FROM yourTable
GROUP BY column1 --grouped by IP address
```
The result is:
```
max(column1) | column2 | max(column3)
------------------------------------------------
0.0.0.0 ... |
55,926,830 | I'm filtering some data where say table.x has the following structure
```
column1 | c.2 |column3
0.0.0.0 | 20 | 2019-04-29 14:55:52
0.0.0.0 | 10 | 2019-04-29 14:45:52
0.0.0.0 | 50 | 2019-04-29 14:35:52
0.0.0.0 | 50 | 2019-04-29 14:25:52
0.0.0.0 | 90 | 2019-04-29 14:15:52
0.0.0.1 | 40 | 2019-04-29 14:05:52
0.0.0.1 | 4... | 2019/04/30 | [
"https://Stackoverflow.com/questions/55926830",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5450427/"
] | What about using `DISTINCT` with one column like so :
```
SELECT DISTINCT ON (column1) column1, column2, column3 FROM table_name
```
---
**Note** `c.2` is not a valid column name.
---
Here is a demo online <https://rextester.com/FBIS74019> | Try to use window function
```
select
column1, column2, column3
from (
SELECT
column1, column2, column3,
row_number() over ( partition by column1 ) pbg
FROM tablename
) aaaa
where aaaa.pbg = 1
``` |
55,926,830 | I'm filtering some data where say table.x has the following structure
```
column1 | c.2 |column3
0.0.0.0 | 20 | 2019-04-29 14:55:52
0.0.0.0 | 10 | 2019-04-29 14:45:52
0.0.0.0 | 50 | 2019-04-29 14:35:52
0.0.0.0 | 50 | 2019-04-29 14:25:52
0.0.0.0 | 90 | 2019-04-29 14:15:52
0.0.0.1 | 40 | 2019-04-29 14:05:52
0.0.0.1 | 4... | 2019/04/30 | [
"https://Stackoverflow.com/questions/55926830",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5450427/"
] | You could usea inner join on max col3 group by column1
```
select * from my_table m
inner join (
select column1, max(column3) col3
from my_table
group by column1
) t on t. column1 = m.column1 and t.col3 = m.column3
``` | Try to use window function
```
select
column1, column2, column3
from (
SELECT
column1, column2, column3,
row_number() over ( partition by column1 ) pbg
FROM tablename
) aaaa
where aaaa.pbg = 1
``` |
55,926,830 | I'm filtering some data where say table.x has the following structure
```
column1 | c.2 |column3
0.0.0.0 | 20 | 2019-04-29 14:55:52
0.0.0.0 | 10 | 2019-04-29 14:45:52
0.0.0.0 | 50 | 2019-04-29 14:35:52
0.0.0.0 | 50 | 2019-04-29 14:25:52
0.0.0.0 | 90 | 2019-04-29 14:15:52
0.0.0.1 | 40 | 2019-04-29 14:05:52
0.0.0.1 | 4... | 2019/04/30 | [
"https://Stackoverflow.com/questions/55926830",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5450427/"
] | Try the following SQL code:
```
SELECT max(column1), column2, max(column3) --maximum of IP address and time
FROM yourTable
GROUP BY column1 --grouped by IP address
```
The result is:
```
max(column1) | column2 | max(column3)
------------------------------------------------
0.0.0.0 ... | Try to use window function
```
select
column1, column2, column3
from (
SELECT
column1, column2, column3,
row_number() over ( partition by column1 ) pbg
FROM tablename
) aaaa
where aaaa.pbg = 1
``` |
282,381 | I want to return the previous row based on the current id number.
All id numbers are UNIQUE, but are NOT (necessarily) SEQUENTIAL.
```
SELECT LAG(id) FROM cb_cat WHERE id=450;
```
I thought this query should work.
If possible, I would like to return \* from the previous row before the current id.
I do not know whic... | 2020/12/31 | [
"https://dba.stackexchange.com/questions/282381",
"https://dba.stackexchange.com",
"https://dba.stackexchange.com/users/221179/"
] | Window functions work on the result after the `WHERE` clause is applied. Since `id` is unique and you ask for exactly one `id`, that result has a maximum of one row. There just isn't any previous row whatsoever.
Further more relational tables represent relations which are a special form of (multi) sets. And (multi) se... | You just need to add an `OVER` and `ORDER BY` clause to your lag function so it knows how to order the records to select the previous one. Also you can specify how many rows back to look (in this case one row back).
For example: `SELECT LAG(id, 1) OVER (ORDER BY id) FROM cb_cat WHERE id=450`
Using this you can either... |
63,599,077 | I am trying to differentiate the linetype and/or color in stacked `geom_area` by group. How can I do that? Simply `geom_area(linetype = type)` or `color = type` does not work. Only think that works changes the values for both groups: `geom_area(color = "white")`. How can I modify the color and linetype by group?
My du... | 2020/08/26 | [
"https://Stackoverflow.com/questions/63599077",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2742140/"
] | C++ treats `const` very strictly. Copying such a struct will be painful if possible at all (without UB). Perhaps what you are really looking for is "readonly" instead? In that case you can make fields private with public getters/setters:
```cpp
struct Foo {
public:
Foo(): id(-1), value(-1) {}
Foo(i... | In C++, an object can be initialized only once. Your constant member is initialized via the default constructor when you declare the array. Then, you attempt to change that value via assignment
```
foos[0] = Foo(1234);
```
This fails, and righly so. One thing you could do is to have a container of not Foos, but some... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.