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 |
|---|---|---|---|---|---|
19,813,376 | I shall write a script using Python to change an user password on a SAMBA server.
I never learned Python and now I tried different things on my VirtualBox with Ubuntu.
With this code I can change (or better delete and set a new) password of an user in my VirtualBox.
But will it also work on the Server?
I have no clue.... | 2013/11/06 | [
"https://Stackoverflow.com/questions/19813376",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2960552/"
] | user2960552's solution doesn't work without user interaction. The following fixes that:
```
def create_or_update_samba_user(username, password):
proc = subprocess.Popen(['sudo', 'smbpasswd', '-a', username], stdin=subprocess.PIPE)
proc.communicate(input=password + '\n' + password + '\n')
``` | So if I read right this should work?
```
from subprocess import Popen
uname = raw_input("Username: ")
proc = Popen(['/usr/bin/sudo', '/usr/bin/smbpasswd', '-a', uname])
proc.communicate()
```
Thank you for your help!
Sadly I don't have access to the Server yet so I can't test it. And I don't want to give a not-wor... |
19,813,376 | I shall write a script using Python to change an user password on a SAMBA server.
I never learned Python and now I tried different things on my VirtualBox with Ubuntu.
With this code I can change (or better delete and set a new) password of an user in my VirtualBox.
But will it also work on the Server?
I have no clue.... | 2013/11/06 | [
"https://Stackoverflow.com/questions/19813376",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2960552/"
] | Cannot comment that's why here is a slightly different version from Nyman:
```
def create_or_update_samba_user(username, password):
proc = subprocess.Popen(['sudo', 'smbpasswd', '-a', '-s', username], stdin=subprocess.PIPE)
proc.communicate(input=password + '\n' + password + '\n')
```
This is the version tha... | So if I read right this should work?
```
from subprocess import Popen
uname = raw_input("Username: ")
proc = Popen(['/usr/bin/sudo', '/usr/bin/smbpasswd', '-a', uname])
proc.communicate()
```
Thank you for your help!
Sadly I don't have access to the Server yet so I can't test it. And I don't want to give a not-wor... |
19,813,376 | I shall write a script using Python to change an user password on a SAMBA server.
I never learned Python and now I tried different things on my VirtualBox with Ubuntu.
With this code I can change (or better delete and set a new) password of an user in my VirtualBox.
But will it also work on the Server?
I have no clue.... | 2013/11/06 | [
"https://Stackoverflow.com/questions/19813376",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2960552/"
] | user2960552's solution doesn't work without user interaction. The following fixes that:
```
def create_or_update_samba_user(username, password):
proc = subprocess.Popen(['sudo', 'smbpasswd', '-a', username], stdin=subprocess.PIPE)
proc.communicate(input=password + '\n' + password + '\n')
``` | Cannot comment that's why here is a slightly different version from Nyman:
```
def create_or_update_samba_user(username, password):
proc = subprocess.Popen(['sudo', 'smbpasswd', '-a', '-s', username], stdin=subprocess.PIPE)
proc.communicate(input=password + '\n' + password + '\n')
```
This is the version tha... |
49,757,690 | I donwloaded windev mobile.I downloaded the express version.This is my first time ever working with this tool.I have a question though
Will the tag "express version" be there until i get the full version.Isn't there a way to remove it?
[](https://i.stack.imgur.com/kH... | 2018/04/10 | [
"https://Stackoverflow.com/questions/49757690",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9625814/"
] | Yes. WinDev Mobile Express is not meant to be used to create applications that are going to be delivered. So they add the tag to encourage users to buy the full version. | True,
You can check power of Windev Mobile and create unlimited application without any restrictions. The only restriction is nag screen that reminds you for trial version.
I highly recommend you to go for WX |
166,832 | I am studying present perfect, and I found the following phrase:
>
> Susan hasn't mastered Japanese, but she can communicate.
>
>
>
What's the difference between this phrase and the next:
>
> Susan don't master Japanese, but she can communicate.
>
>
>
If Susan can communicate right now, and present perfect ... | 2014/04/28 | [
"https://english.stackexchange.com/questions/166832",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/31766/"
] | Your question involves many different topics. It seems that the main gist of your question is about subject-verb agreement. But your two sets of examples are quite different from each other.
For instance, your first set of examples are **declarative clauses** that involve the **existential construction:**
>
> Which ... | It depends on the way that you parse the sentence:
>
> ?how much (flour and butter) are needed to make a pizza
>
> how much flour [is needed] and how much butter is needed to make a pizza
>
>
>
I can see both as valid parses, but the first seems a bit stilted to me. There's no contradiction, it's simply a mat... |
166,832 | I am studying present perfect, and I found the following phrase:
>
> Susan hasn't mastered Japanese, but she can communicate.
>
>
>
What's the difference between this phrase and the next:
>
> Susan don't master Japanese, but she can communicate.
>
>
>
If Susan can communicate right now, and present perfect ... | 2014/04/28 | [
"https://english.stackexchange.com/questions/166832",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/31766/"
] | You can also say "There are both water and butter in the fridge". | It depends on the way that you parse the sentence:
>
> ?how much (flour and butter) are needed to make a pizza
>
> how much flour [is needed] and how much butter is needed to make a pizza
>
>
>
I can see both as valid parses, but the first seems a bit stilted to me. There's no contradiction, it's simply a mat... |
166,832 | I am studying present perfect, and I found the following phrase:
>
> Susan hasn't mastered Japanese, but she can communicate.
>
>
>
What's the difference between this phrase and the next:
>
> Susan don't master Japanese, but she can communicate.
>
>
>
If Susan can communicate right now, and present perfect ... | 2014/04/28 | [
"https://english.stackexchange.com/questions/166832",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/31766/"
] | Your question involves many different topics. It seems that the main gist of your question is about subject-verb agreement. But your two sets of examples are quite different from each other.
For instance, your first set of examples are **declarative clauses** that involve the **existential construction:**
>
> Which ... | Saying "there **is** butter and water in the fridge" and "how much flour and butter **is** needed" sounds more natural and logical to my ear.
Consider that what is implied in those phrases is the amount.
And so:
>
> "There is water and butter in the fridge" means just about the same as
>
>
> "There is an indefin... |
166,832 | I am studying present perfect, and I found the following phrase:
>
> Susan hasn't mastered Japanese, but she can communicate.
>
>
>
What's the difference between this phrase and the next:
>
> Susan don't master Japanese, but she can communicate.
>
>
>
If Susan can communicate right now, and present perfect ... | 2014/04/28 | [
"https://english.stackexchange.com/questions/166832",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/31766/"
] | You can also say "There are both water and butter in the fridge". | Saying "there **is** butter and water in the fridge" and "how much flour and butter **is** needed" sounds more natural and logical to my ear.
Consider that what is implied in those phrases is the amount.
And so:
>
> "There is water and butter in the fridge" means just about the same as
>
>
> "There is an indefin... |
166,832 | I am studying present perfect, and I found the following phrase:
>
> Susan hasn't mastered Japanese, but she can communicate.
>
>
>
What's the difference between this phrase and the next:
>
> Susan don't master Japanese, but she can communicate.
>
>
>
If Susan can communicate right now, and present perfect ... | 2014/04/28 | [
"https://english.stackexchange.com/questions/166832",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/31766/"
] | Your question involves many different topics. It seems that the main gist of your question is about subject-verb agreement. But your two sets of examples are quite different from each other.
For instance, your first set of examples are **declarative clauses** that involve the **existential construction:**
>
> Which ... | You can also say "There are both water and butter in the fridge". |
5,822,740 | To properly map every pixel of a heightmap image to a terrain, we will end up with a terrain both in width and length 1 unit less that the actual width and length of the heightmap. For instance, if we have an image with just 2 pixels wide, each pixel will map to each vertex of a quad. We have 2 pixels but only 1 unit o... | 2011/04/28 | [
"https://Stackoverflow.com/questions/5822740",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40480/"
] | One problem is that you have to apply the `SubSonicPrimaryKey` attribute to the property for the primary key in your model object, which is generated code.
So you can't just try and put it there manually like Drackir is showing. Next time your templates get generated that change will get blown away, and you can't app... | From what I gather SubSonic helps link up your classes (perhaps generates them?) and your database. According to the [Convention docs](http://www.subsonicproject.com/docs/Conventions):
>
> **Primary Keys**
>
>
> If you want to use SubSonic to access
> your table, you need to have a Primary
> Key defined for your ... |
58,344,364 | Chrome is reporting the following warning:
>
> A cookie associated with a cross-site resource at <https://www.googletagmanager.com/> was set without the `SameSite` attribute. A future release of Chrome will only deliver cookies with cross-site requests if they are set with `SameSite=None` and `Secure`. You can review... | 2019/10/11 | [
"https://Stackoverflow.com/questions/58344364",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3621633/"
] | For any of these warnings, if you are not responsible for the domain then you are not responsible for updating the cookies. The Google Tag Manager team will be responsible for updating the relevant code that sets the `SameSite` attributes for cookies from `googletagmanager.com`.
At this point, the warnings are purely ... | Chrome is already rolling out this change. You can set cookie flag in analytics.js or gtag.js for this to work, for example:
```
gtag('config', 'G-N2A3FMNDT5', {
cookie_flags: 'max-age=7200;secure;samesite=none'
});
```
For more information and background, see this blog post: [The New cookieFlags Setting In Google... |
213,293 | In the world I've been writing, the population has the ability to access other planets, by going through the dimension/plane known as 'the Warp'.
However, these people are, for the most part, fairly advanced technologically. This has led to them coming up with ways to launch satellites and long range missiles.
My ques... | 2021/09/13 | [
"https://worldbuilding.stackexchange.com/questions/213293",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/86034/"
] | There wouldn't be any reason to actual travel through space, though exploration for the sake of curiosity / science would happen.
I've actually developed a roleplaying game which is SciFi but also has technology to go straight from planet to planet (think "Stargate"). When you think it through, there's no reason to ev... | **Magic does not provide a map.**
You can find some places by magic because magic can feel them. But it does not give an idea of the precise location and it does not show a lot of places. Physical travel is the only way to get an overall view with a precise mapping and a complete knowledge. |
213,293 | In the world I've been writing, the population has the ability to access other planets, by going through the dimension/plane known as 'the Warp'.
However, these people are, for the most part, fairly advanced technologically. This has led to them coming up with ways to launch satellites and long range missiles.
My ques... | 2021/09/13 | [
"https://worldbuilding.stackexchange.com/questions/213293",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/86034/"
] | There is no point in venturing into the empty of space for reaching a planet where you can conveniently "jump".
There is still a point in going into space for investigating thing which you can't physically access, like any star, gas giants and other bodies which would end your life pretty quickly.
In our solar system... | **Magic does not provide a map.**
You can find some places by magic because magic can feel them. But it does not give an idea of the precise location and it does not show a lot of places. Physical travel is the only way to get an overall view with a precise mapping and a complete knowledge. |
213,293 | In the world I've been writing, the population has the ability to access other planets, by going through the dimension/plane known as 'the Warp'.
However, these people are, for the most part, fairly advanced technologically. This has led to them coming up with ways to launch satellites and long range missiles.
My ques... | 2021/09/13 | [
"https://worldbuilding.stackexchange.com/questions/213293",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/86034/"
] | To me this appears to be more of a magic design problem, not a problem of the physics and engineering involved in space exploration. If this magic system is advanced to the point that I can go through this warp in a sufficiently advanced spacesuit, or send any amount of cargo I want, then space exploration via traditio... | **The Warp Sucks.**
It hurts. And it smells. Then you smell, and not for a little while. It is full of dangerous things that want to do stuff to you or beg from you or hang off of your clothes or eat little bits of you. The warp makes your teeth ache and later when your teeth ache you can smell that smell again and fe... |
213,293 | In the world I've been writing, the population has the ability to access other planets, by going through the dimension/plane known as 'the Warp'.
However, these people are, for the most part, fairly advanced technologically. This has led to them coming up with ways to launch satellites and long range missiles.
My ques... | 2021/09/13 | [
"https://worldbuilding.stackexchange.com/questions/213293",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/86034/"
] | There is no point in venturing into the empty of space for reaching a planet where you can conveniently "jump".
There is still a point in going into space for investigating thing which you can't physically access, like any star, gas giants and other bodies which would end your life pretty quickly.
In our solar system... | Magic requires rare materials
-----------------------------
Solid portals require huge amounts of gold and silver and other rare metals and materials. These are extremely expensive to mine on planets. As such, it makes logical sense to build space empires on each planet to get accessible rarer elements from meteors an... |
213,293 | In the world I've been writing, the population has the ability to access other planets, by going through the dimension/plane known as 'the Warp'.
However, these people are, for the most part, fairly advanced technologically. This has led to them coming up with ways to launch satellites and long range missiles.
My ques... | 2021/09/13 | [
"https://worldbuilding.stackexchange.com/questions/213293",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/86034/"
] | There wouldn't be any reason to actual travel through space, though exploration for the sake of curiosity / science would happen.
I've actually developed a roleplaying game which is SciFi but also has technology to go straight from planet to planet (think "Stargate"). When you think it through, there's no reason to ev... | I imagine it'd be about the same way sailing ships came to be in this universe; what's the point of a boat when you can just teleport your whole army across the sea to your enemy? Well, it's a giant wooden sea-beast armed to the teeth with guns that shoot giant solid iron rocks, some of which *explode*. Combined with m... |
213,293 | In the world I've been writing, the population has the ability to access other planets, by going through the dimension/plane known as 'the Warp'.
However, these people are, for the most part, fairly advanced technologically. This has led to them coming up with ways to launch satellites and long range missiles.
My ques... | 2021/09/13 | [
"https://worldbuilding.stackexchange.com/questions/213293",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/86034/"
] | To me this appears to be more of a magic design problem, not a problem of the physics and engineering involved in space exploration. If this magic system is advanced to the point that I can go through this warp in a sufficiently advanced spacesuit, or send any amount of cargo I want, then space exploration via traditio... | I imagine it'd be about the same way sailing ships came to be in this universe; what's the point of a boat when you can just teleport your whole army across the sea to your enemy? Well, it's a giant wooden sea-beast armed to the teeth with guns that shoot giant solid iron rocks, some of which *explode*. Combined with m... |
213,293 | In the world I've been writing, the population has the ability to access other planets, by going through the dimension/plane known as 'the Warp'.
However, these people are, for the most part, fairly advanced technologically. This has led to them coming up with ways to launch satellites and long range missiles.
My ques... | 2021/09/13 | [
"https://worldbuilding.stackexchange.com/questions/213293",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/86034/"
] | There is no point in venturing into the empty of space for reaching a planet where you can conveniently "jump".
There is still a point in going into space for investigating thing which you can't physically access, like any star, gas giants and other bodies which would end your life pretty quickly.
In our solar system... | There wouldn't be any reason to actual travel through space, though exploration for the sake of curiosity / science would happen.
I've actually developed a roleplaying game which is SciFi but also has technology to go straight from planet to planet (think "Stargate"). When you think it through, there's no reason to ev... |
213,293 | In the world I've been writing, the population has the ability to access other planets, by going through the dimension/plane known as 'the Warp'.
However, these people are, for the most part, fairly advanced technologically. This has led to them coming up with ways to launch satellites and long range missiles.
My ques... | 2021/09/13 | [
"https://worldbuilding.stackexchange.com/questions/213293",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/86034/"
] | >
> My question is, how would these cultures be motivated to explore space in depth, such as with rovers or astronauts, instead of just sticking to existing magical ways of reaching other planets.
>
>
>
Magical travel between worlds doesn't preclude space exploration and science... on the contrary, it makes them h... | **Magic does not provide a map.**
You can find some places by magic because magic can feel them. But it does not give an idea of the precise location and it does not show a lot of places. Physical travel is the only way to get an overall view with a precise mapping and a complete knowledge. |
213,293 | In the world I've been writing, the population has the ability to access other planets, by going through the dimension/plane known as 'the Warp'.
However, these people are, for the most part, fairly advanced technologically. This has led to them coming up with ways to launch satellites and long range missiles.
My ques... | 2021/09/13 | [
"https://worldbuilding.stackexchange.com/questions/213293",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/86034/"
] | There is no point in venturing into the empty of space for reaching a planet where you can conveniently "jump".
There is still a point in going into space for investigating thing which you can't physically access, like any star, gas giants and other bodies which would end your life pretty quickly.
In our solar system... | To me this appears to be more of a magic design problem, not a problem of the physics and engineering involved in space exploration. If this magic system is advanced to the point that I can go through this warp in a sufficiently advanced spacesuit, or send any amount of cargo I want, then space exploration via traditio... |
213,293 | In the world I've been writing, the population has the ability to access other planets, by going through the dimension/plane known as 'the Warp'.
However, these people are, for the most part, fairly advanced technologically. This has led to them coming up with ways to launch satellites and long range missiles.
My ques... | 2021/09/13 | [
"https://worldbuilding.stackexchange.com/questions/213293",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/86034/"
] | >
> My question is, how would these cultures be motivated to explore space in depth, such as with rovers or astronauts, instead of just sticking to existing magical ways of reaching other planets.
>
>
>
Magical travel between worlds doesn't preclude space exploration and science... on the contrary, it makes them h... | Magic requires rare materials
-----------------------------
Solid portals require huge amounts of gold and silver and other rare metals and materials. These are extremely expensive to mine on planets. As such, it makes logical sense to build space empires on each planet to get accessible rarer elements from meteors an... |
14,068,694 | I need to create a simple rest based webservice in node.js I already know only how to consume the already exposed ones.I used http module for that.Any suggestion on how to create a webservice will be much helpful | 2012/12/28 | [
"https://Stackoverflow.com/questions/14068694",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1790453/"
] | You can use [Expressjs](http://expressjs.com/guide.html), it's the most common web framework to make REST Api. Check this stackoverflow question which provides a lot of [good resources](https://stackoverflow.com/questions/8144214/learning-express-for-node-js). Have a look at this [tutorial](http://www.hacksparrow.com/e... | Hey heres something that i tried its really simple.Below is the code
```
var express = require("express");
var app = express();
var data="<Bank><rows>10</rows></Bank>"
console.log(data);
app.get('/Dynamic', function(req, response) {
response.contentType('application/xml');
console.log('listening');
response.send(data)... |
14,068,694 | I need to create a simple rest based webservice in node.js I already know only how to consume the already exposed ones.I used http module for that.Any suggestion on how to create a webservice will be much helpful | 2012/12/28 | [
"https://Stackoverflow.com/questions/14068694",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1790453/"
] | You can use [Expressjs](http://expressjs.com/guide.html), it's the most common web framework to make REST Api. Check this stackoverflow question which provides a lot of [good resources](https://stackoverflow.com/questions/8144214/learning-express-for-node-js). Have a look at this [tutorial](http://www.hacksparrow.com/e... | we can use this code
```
var express = require('express');
var app = express();
app.post('/login', function(req, res) {
res.send('Got the data');
});
app.listen(3002);
console.log('Listening on port 3002...');
``` |
14,068,694 | I need to create a simple rest based webservice in node.js I already know only how to consume the already exposed ones.I used http module for that.Any suggestion on how to create a webservice will be much helpful | 2012/12/28 | [
"https://Stackoverflow.com/questions/14068694",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1790453/"
] | Hey heres something that i tried its really simple.Below is the code
```
var express = require("express");
var app = express();
var data="<Bank><rows>10</rows></Bank>"
console.log(data);
app.get('/Dynamic', function(req, response) {
response.contentType('application/xml');
console.log('listening');
response.send(data)... | we can use this code
```
var express = require('express');
var app = express();
app.post('/login', function(req, res) {
res.send('Got the data');
});
app.listen(3002);
console.log('Listening on port 3002...');
``` |
42,033,675 | I'm working with adjacency matrices that look like this:
```
N <- 5
A <- matrix(round(runif(N^2),1),N)
diag(A) <- 0
1> A
[,1] [,2] [,3] [,4] [,5]
[1,] 0.0 0.1 0.2 0.6 0.9
[2,] 0.8 0.0 0.4 0.7 0.5
[3,] 0.6 0.8 0.0 0.8 0.6
[4,] 0.8 0.1 0.1 0.0 0.3
[5,] 0.2 0.9 0.7 0.9 0.0
```
Probabilist... | 2017/02/03 | [
"https://Stackoverflow.com/questions/42033675",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1883795/"
] | Your union.pr function is slower by 500 times than a simple and efficient way. So replace your union.pr by 1-prod(1-pr) and you'll get 500X speed.
```
x <- runif(1000)*0.01
t1 <- proc.time()
for (i in 1:10000){
y <- union.pr(x)
}
t1 <- proc.time()-t1
print(t1)
# user system elapsed
# 21.09 0.02 21.18
t2 <-... | So @Julius's answer was useful for reminding me of some elementary probability rules, but it didn't speed up the rate of computation much. The following function, however, helps a ton:
```
second_order_adjacency2 <- function(A, i, j){#function to calculate probability that i is linked to j through some other node
a1... |
53,028,980 | How do I modify this data source from this line
```
`String constr = (@"Data source=(localdb)\MSSQLLocalDB; initial catalog=DataHRD; integrated security=true;");`
```
`(localdb)\MSSQLLocalDB ==> C:\Users\SONY\Desktop\asda\asd\MainMenu\DataHRD.mdf`
or different directory out of localdb | 2018/10/28 | [
"https://Stackoverflow.com/questions/53028980",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10569547/"
] | Here is what I have come up with (as far as I understood the question):
```
awk 'NR==1{fields=NF
for (i = 1; i <= fields; i++)
cols[i]=length($i)
}
NR>1 { if(NF != fields)
print "line "NR" has a different number of columns"
else
for (i = 1;... | Try this:
```
awk 'NR == FNR {
for (i=1; i<=NF; ++i) {
a[i]=length($i)
}
next
}
{
for (i=1; i<=NF; ++i) {
if (length($i)!=a[i]) {
printf("error at line %d, column %d.\n%s\n", FNR, i, $0)
exit
}
}
}' ref_file file
```
Output:
```
error at line 4, column 3.
1112 2220 22 1
``` |
53,028,980 | How do I modify this data source from this line
```
`String constr = (@"Data source=(localdb)\MSSQLLocalDB; initial catalog=DataHRD; integrated security=true;");`
```
`(localdb)\MSSQLLocalDB ==> C:\Users\SONY\Desktop\asda\asd\MainMenu\DataHRD.mdf`
or different directory out of localdb | 2018/10/28 | [
"https://Stackoverflow.com/questions/53028980",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10569547/"
] | Similar to F. Knorr's answer, but uses the ref\_file
```
awk '
NR == FNR { nf = NF; for (i=1; i<=NF; i++) len[i] = length($i); next }
NF != nf { err = FNR; exit }
{ for (i=1; i<=NF; i++) if (len[i] != length($i)) { err = FNR; exit } }
END { if (err) { print "invalid file format on line", err; exit 1 } ... | Try this:
```
awk 'NR == FNR {
for (i=1; i<=NF; ++i) {
a[i]=length($i)
}
next
}
{
for (i=1; i<=NF; ++i) {
if (length($i)!=a[i]) {
printf("error at line %d, column %d.\n%s\n", FNR, i, $0)
exit
}
}
}' ref_file file
```
Output:
```
error at line 4, column 3.
1112 2220 22 1
``` |
53,028,980 | How do I modify this data source from this line
```
`String constr = (@"Data source=(localdb)\MSSQLLocalDB; initial catalog=DataHRD; integrated security=true;");`
```
`(localdb)\MSSQLLocalDB ==> C:\Users\SONY\Desktop\asda\asd\MainMenu\DataHRD.mdf`
or different directory out of localdb | 2018/10/28 | [
"https://Stackoverflow.com/questions/53028980",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10569547/"
] | Similar to F. Knorr's answer, but uses the ref\_file
```
awk '
NR == FNR { nf = NF; for (i=1; i<=NF; i++) len[i] = length($i); next }
NF != nf { err = FNR; exit }
{ for (i=1; i<=NF; i++) if (len[i] != length($i)) { err = FNR; exit } }
END { if (err) { print "invalid file format on line", err; exit 1 } ... | Here is what I have come up with (as far as I understood the question):
```
awk 'NR==1{fields=NF
for (i = 1; i <= fields; i++)
cols[i]=length($i)
}
NR>1 { if(NF != fields)
print "line "NR" has a different number of columns"
else
for (i = 1;... |
57,650,203 | I'm trying to batch put a number of items to DynamoDB using AppSync. When I call the resolver it throws no errors but nothing is saved to the database.
**Schema**
```
type BoxScore @model {
id: ID!
userId: String!
gameVariant: String!
complete: Boolean!
failFact: BoxScoreFact @connection
totalCorrect: Int... | 2019/08/25 | [
"https://Stackoverflow.com/questions/57650203",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4397018/"
] | Because the api you are using makes blocking calls doesn't necessarily mean that you need to adhere to that. If you are already using Kotlin coroutines you can easily use `withContext(Dispatchers.IO` to require a function to run on an IO thread. You absolutely should do this to avoid hanging the UI thread.
```
sus... | Use `withContext(Dispatchers.IO)` in your `makeServiceCall` function |
27,645 | I make a lot of text files using a basic text editor (in the F15 with Xfce DE I use Leaf). Recently the save dialogue is defaulting the "Places" sidebar to "Recently Used" where before it was always my home directory. This adds an extra step to my routines, because you can't save to "Places". And for the same reason th... | 2011/12/25 | [
"https://unix.stackexchange.com/questions/27645",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/9494/"
] | <http://tstarling.com/blog/2011/11/file_chooser_recent/>
Apparently, this is a change made to GTK recently. I have the same on my laptop and I can confirm that it's annoying. There doesn't seem to be a fix (except reverting the update in question or recompiling it all yourself) but let's hope that the developers take ... | you may be interested in using Scribes an another text editor which has the option. [scribes](http://scribes.sourceforge.net) see for more information
[this](https://superuser.com/questions/74883/changing-gedits-default-file-open-save-path) |
157,945 | Friends of mine were travelling in the UK by bus once, when suddenly the bus stopped and all passengers had to get out. The driver told them that there were "snow windows" and so they couldn't proceed to Glasgow. When they said "but there's no SNOW" - all they got back was "but there are snow windows". However, no one ... | 2014/03/16 | [
"https://english.stackexchange.com/questions/157945",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/16955/"
] | You can use 'whose' but not 'who' with things.
'Which' does not have a possessive. You cannot say 'the house which's chimneys are red'; for 'which's' doesn't exist. Somebody like John Lawler or Edwin Ashworth may be able to explain why.
It is perfectly alright to use 'whose' in the context in which you have shown it... | The use of *whose* is not limited to people.
>
> Mr. Waits said he had heard Mr. Kaczynski cursing the dogs, [whose barking](http://www.nytimes.com/1999/03/14/us/new-portrait-unabomber-environmental-saboteur-around-montana-village-for-20.html) may have betrayed his location in the woods. - the New York Times
> Whose... |
200,352 | [**Stack Exchange is not the place for conversation, opinions, or socializing**.](https://stackexchange.com/about) This is stated as a rule valid for **every** SE site.
Since most of Christianity is based on interpretation of the bible, how is that different from opinion based answers? How is [this question](https://c... | 2013/10/11 | [
"https://meta.stackexchange.com/questions/200352",
"https://meta.stackexchange.com",
"https://meta.stackexchange.com/users/146858/"
] | To add to the other answers here: there's no rule on Stack Overflow (or most other sites) that *prohibits opinions*. Rather, we discourage questions that ask *only* for opinions. [The guidelines for this are in the help center](https://meta.stackoverflow.com/help/dont-ask), but I'll quote part of them here for your ben... | No.
===
The standard for C.SE is generally within the same spectrum of standards for other SE sites.
--------------------------------------------------------------------------------------------
>
> How is [this question](https://christianity.stackexchange.com/questions/130/can-i-believe-in-evolution-and-still-be-a-c... |
200,352 | [**Stack Exchange is not the place for conversation, opinions, or socializing**.](https://stackexchange.com/about) This is stated as a rule valid for **every** SE site.
Since most of Christianity is based on interpretation of the bible, how is that different from opinion based answers? How is [this question](https://c... | 2013/10/11 | [
"https://meta.stackexchange.com/questions/200352",
"https://meta.stackexchange.com",
"https://meta.stackexchange.com/users/146858/"
] | Well, there are some sites where the answers are a little fuzzier than others. As it happens, Christianity is not one of those sites. It *could* have been and some of the new users expect it to be, but the site has worked hard to not encourage "the meaning of life" questions or answers. To quote from the top answer to ... | I the question on C.SE should be closed, it doesn't meet the criteria of the site questions coming from an identifiable tradition.
There's a clear cut Catholic answer to this question that would fill many volumes with nuances and it's annoying to have questions like this out there because they pretty much preclude th... |
200,352 | [**Stack Exchange is not the place for conversation, opinions, or socializing**.](https://stackexchange.com/about) This is stated as a rule valid for **every** SE site.
Since most of Christianity is based on interpretation of the bible, how is that different from opinion based answers? How is [this question](https://c... | 2013/10/11 | [
"https://meta.stackexchange.com/questions/200352",
"https://meta.stackexchange.com",
"https://meta.stackexchange.com/users/146858/"
] | I the question on C.SE should be closed, it doesn't meet the criteria of the site questions coming from an identifiable tradition.
There's a clear cut Catholic answer to this question that would fill many volumes with nuances and it's annoying to have questions like this out there because they pretty much preclude th... | No.
===
The standard for C.SE is generally within the same spectrum of standards for other SE sites.
--------------------------------------------------------------------------------------------
>
> How is [this question](https://christianity.stackexchange.com/questions/130/can-i-believe-in-evolution-and-still-be-a-c... |
200,352 | [**Stack Exchange is not the place for conversation, opinions, or socializing**.](https://stackexchange.com/about) This is stated as a rule valid for **every** SE site.
Since most of Christianity is based on interpretation of the bible, how is that different from opinion based answers? How is [this question](https://c... | 2013/10/11 | [
"https://meta.stackexchange.com/questions/200352",
"https://meta.stackexchange.com",
"https://meta.stackexchange.com/users/146858/"
] | First off, your premise is mistaken:
>
> Since all of Christianity is based on interpretation of the bible,
>
>
>
No it's not. One very large group of Christians - Catholics - does *not* base their entire religion on the Bible. IF you look at Christianity.SE, there are lots of things being asked that aren't just ... | I the question on C.SE should be closed, it doesn't meet the criteria of the site questions coming from an identifiable tradition.
There's a clear cut Catholic answer to this question that would fill many volumes with nuances and it's annoying to have questions like this out there because they pretty much preclude th... |
200,352 | [**Stack Exchange is not the place for conversation, opinions, or socializing**.](https://stackexchange.com/about) This is stated as a rule valid for **every** SE site.
Since most of Christianity is based on interpretation of the bible, how is that different from opinion based answers? How is [this question](https://c... | 2013/10/11 | [
"https://meta.stackexchange.com/questions/200352",
"https://meta.stackexchange.com",
"https://meta.stackexchange.com/users/146858/"
] | Someone hasn't read [Good Subjective, Bad Subjective](https://blog.stackoverflow.com/2010/09/good-subjective-bad-subjective/). You should read the whole thing, but here are the highlights:
>
> Insisting on objectivity is fine for computing and mathematics. But once you get past the hard(ish) sciences, you veer toward... | No.
===
The standard for C.SE is generally within the same spectrum of standards for other SE sites.
--------------------------------------------------------------------------------------------
>
> How is [this question](https://christianity.stackexchange.com/questions/130/can-i-believe-in-evolution-and-still-be-a-c... |
200,352 | [**Stack Exchange is not the place for conversation, opinions, or socializing**.](https://stackexchange.com/about) This is stated as a rule valid for **every** SE site.
Since most of Christianity is based on interpretation of the bible, how is that different from opinion based answers? How is [this question](https://c... | 2013/10/11 | [
"https://meta.stackexchange.com/questions/200352",
"https://meta.stackexchange.com",
"https://meta.stackexchange.com/users/146858/"
] | Someone hasn't read [Good Subjective, Bad Subjective](https://blog.stackoverflow.com/2010/09/good-subjective-bad-subjective/). You should read the whole thing, but here are the highlights:
>
> Insisting on objectivity is fine for computing and mathematics. But once you get past the hard(ish) sciences, you veer toward... | I the question on C.SE should be closed, it doesn't meet the criteria of the site questions coming from an identifiable tradition.
There's a clear cut Catholic answer to this question that would fill many volumes with nuances and it's annoying to have questions like this out there because they pretty much preclude th... |
200,352 | [**Stack Exchange is not the place for conversation, opinions, or socializing**.](https://stackexchange.com/about) This is stated as a rule valid for **every** SE site.
Since most of Christianity is based on interpretation of the bible, how is that different from opinion based answers? How is [this question](https://c... | 2013/10/11 | [
"https://meta.stackexchange.com/questions/200352",
"https://meta.stackexchange.com",
"https://meta.stackexchange.com/users/146858/"
] | Well, there are some sites where the answers are a little fuzzier than others. As it happens, Christianity is not one of those sites. It *could* have been and some of the new users expect it to be, but the site has worked hard to not encourage "the meaning of life" questions or answers. To quote from the top answer to ... | No.
===
The standard for C.SE is generally within the same spectrum of standards for other SE sites.
--------------------------------------------------------------------------------------------
>
> How is [this question](https://christianity.stackexchange.com/questions/130/can-i-believe-in-evolution-and-still-be-a-c... |
200,352 | [**Stack Exchange is not the place for conversation, opinions, or socializing**.](https://stackexchange.com/about) This is stated as a rule valid for **every** SE site.
Since most of Christianity is based on interpretation of the bible, how is that different from opinion based answers? How is [this question](https://c... | 2013/10/11 | [
"https://meta.stackexchange.com/questions/200352",
"https://meta.stackexchange.com",
"https://meta.stackexchange.com/users/146858/"
] | To add to the other answers here: there's no rule on Stack Overflow (or most other sites) that *prohibits opinions*. Rather, we discourage questions that ask *only* for opinions. [The guidelines for this are in the help center](https://meta.stackoverflow.com/help/dont-ask), but I'll quote part of them here for your ben... | Well, there are some sites where the answers are a little fuzzier than others. As it happens, Christianity is not one of those sites. It *could* have been and some of the new users expect it to be, but the site has worked hard to not encourage "the meaning of life" questions or answers. To quote from the top answer to ... |
200,352 | [**Stack Exchange is not the place for conversation, opinions, or socializing**.](https://stackexchange.com/about) This is stated as a rule valid for **every** SE site.
Since most of Christianity is based on interpretation of the bible, how is that different from opinion based answers? How is [this question](https://c... | 2013/10/11 | [
"https://meta.stackexchange.com/questions/200352",
"https://meta.stackexchange.com",
"https://meta.stackexchange.com/users/146858/"
] | Well, there are some sites where the answers are a little fuzzier than others. As it happens, Christianity is not one of those sites. It *could* have been and some of the new users expect it to be, but the site has worked hard to not encourage "the meaning of life" questions or answers. To quote from the top answer to ... | Someone hasn't read [Good Subjective, Bad Subjective](https://blog.stackoverflow.com/2010/09/good-subjective-bad-subjective/). You should read the whole thing, but here are the highlights:
>
> Insisting on objectivity is fine for computing and mathematics. But once you get past the hard(ish) sciences, you veer toward... |
200,352 | [**Stack Exchange is not the place for conversation, opinions, or socializing**.](https://stackexchange.com/about) This is stated as a rule valid for **every** SE site.
Since most of Christianity is based on interpretation of the bible, how is that different from opinion based answers? How is [this question](https://c... | 2013/10/11 | [
"https://meta.stackexchange.com/questions/200352",
"https://meta.stackexchange.com",
"https://meta.stackexchange.com/users/146858/"
] | To add to the other answers here: there's no rule on Stack Overflow (or most other sites) that *prohibits opinions*. Rather, we discourage questions that ask *only* for opinions. [The guidelines for this are in the help center](https://meta.stackoverflow.com/help/dont-ask), but I'll quote part of them here for your ben... | Someone hasn't read [Good Subjective, Bad Subjective](https://blog.stackoverflow.com/2010/09/good-subjective-bad-subjective/). You should read the whole thing, but here are the highlights:
>
> Insisting on objectivity is fine for computing and mathematics. But once you get past the hard(ish) sciences, you veer toward... |
71,740,505 | What is the best approach for this animation?
`Row + Flexible + AnimatedSize + Image` ?
or `Rive`. Thank you in advance.
[](https://i.stack.imgur.com/8AKIc.gif) | 2022/04/04 | [
"https://Stackoverflow.com/questions/71740505",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12279445/"
] | You can do this using an animated container when one card is selected then another card's height/width will be decreased and the selected container height/width will be increased.
[Flutter Cookbook - Animate the properties of a container](https://docs.flutter.dev/cookbook/animation/animated-container) | **I just worked hard to make like this, this will surely help you**
[](https://i.stack.imgur.com/y0H8a.gif)
import 'dart:math';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
```
void main() {
runApp(MaterialApp(
... |
55,148,884 | I have FOSUser working and now attempting to add Google/Facebook sign-up, meaning that I will still sign up users with regular FOSUser setup.
I know about HWIOAuthBundle but I am reluctant to add another bundle. Already having second thoughts about FOS bundle itself after all the overriding I already did.
When creat... | 2019/03/13 | [
"https://Stackoverflow.com/questions/55148884",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2127381/"
] | You can use method `ljust` of `str`, following way:
```
words = ['some','example','words','for','testing']
longest = max(map(len,words))
for w in [words[i:i+3] for i in range(0,len(words),3)]:
print(' '.join([j.ljust(longest) for j in w]))
```
output is:
```
some example words
for testing
```
Note th... | You can iterate through the list of `words`, using slicing, printing every three elements together, like this:
```
print("Unique words in my file are: ")
for i in range(len(words)-2):
print(words[i:i+3])
```
You can even further format the output, maybe using something like this:
```
print("Unique words in my f... |
55,148,884 | I have FOSUser working and now attempting to add Google/Facebook sign-up, meaning that I will still sign up users with regular FOSUser setup.
I know about HWIOAuthBundle but I am reluctant to add another bundle. Already having second thoughts about FOS bundle itself after all the overriding I already did.
When creat... | 2019/03/13 | [
"https://Stackoverflow.com/questions/55148884",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2127381/"
] | You can use method `ljust` of `str`, following way:
```
words = ['some','example','words','for','testing']
longest = max(map(len,words))
for w in [words[i:i+3] for i in range(0,len(words),3)]:
print(' '.join([j.ljust(longest) for j in w]))
```
output is:
```
some example words
for testing
```
Note th... | You can use default overloaded operators for strings. Here is an example (`"\t"` means tab):
```
words = ["Xander", "Spec", "Meng", "Sparc", "Jones", "Nick", "Link", "Xander", "Spec", "Meng"]
print("Unique words in my file are: ")
word_temp=""
i=1
for word in words:
if (i%3!=0):
word_temp+=word+"\t"
el... |
55,148,884 | I have FOSUser working and now attempting to add Google/Facebook sign-up, meaning that I will still sign up users with regular FOSUser setup.
I know about HWIOAuthBundle but I am reluctant to add another bundle. Already having second thoughts about FOS bundle itself after all the overriding I already did.
When creat... | 2019/03/13 | [
"https://Stackoverflow.com/questions/55148884",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2127381/"
] | You can use method `ljust` of `str`, following way:
```
words = ['some','example','words','for','testing']
longest = max(map(len,words))
for w in [words[i:i+3] for i in range(0,len(words),3)]:
print(' '.join([j.ljust(longest) for j in w]))
```
output is:
```
some example words
for testing
```
Note th... | I hope this is what you are looking for:
```py
words = [1, 2, 3, 4, 5, 6]
for index, word in enumerate(words):
# For every 3rd occurrence
if not (index + 1) % 3:
print(word, end='\n')
else:
print(word, end='\t')
```
Output
1 2 3
4 5 6
based on @karls inputs change... |
31,988 | This must be a very simple issue to solve, but I am stuck (not a UNIX pro). I need to move a gz to a target directory, but I get a `No such file or directory`.
```
NOW=$(date +"%Y-%m-%d-%T")
DEST="~/scripts/backup"
SQL_DUMP="db_dump_$NOW.sql.gz"
echo "$SQL_DUMP"
drush sql-dump | gzip -9 > $SQL_DUMP
mv -t $DEST $SQL_... | 2012/02/17 | [
"https://unix.stackexchange.com/questions/31988",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/15657/"
] | The problem is *not* with your `mv` command.
*Tilde expansion* is the name for what the shell does when it replaces the `~` character with the user's home directory, e.g. `/home/username`. It is possible to tell the shell to not do this by quoting the tilde character. This is exactly what you have done in
```
DEST="~... | Read **mv** manual
```
SYNOPSIS
mv [SOURCE] [DEST]
```
And you may want to check if $DEST already exist:
```
if [ -d ${DEST} ]; then
do something
fi
```
If not, use **mkdir** with **-p** as parameter to make parent directories.
```
...
else
mkdir -p ${DEST}
fi
``` |
23,731,343 | Using WampServer 2.5 on Windows 7 Ultimate 64 bit I am not able to redirect from Wamp index page to Projects URL. For example, I have a Project called "Proj 1" which listed under "**Your Projects**" but when I click on that the address bar only change to
>
> Proj 1
>
>
>
and I get this error message on page **Oo... | 2014/05/19 | [
"https://Stackoverflow.com/questions/23731343",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3649067/"
] | The **QUICK AND DIRTY** way to revert back to the old way and undo this new **INTENDED** functionality is:-
Edit \wamp\index.php
Find this line at aprox line 34
```
$suppress_localhost = true;
```
And change it to
```
$suppress_localhost = false;
```
**CORRECT Solution**
Is to create a VirtualHost for each o... | One option could be updating the www index.php (Line 338) from
```
$projectContents .= '<li><a href="'.($suppress_localhost ? 'http://' : '').$file.'">'.$file.'</a></li>';
```
to
```
$projectContents .= '<li><a href="'.($suppress_localhost ? 'http://localhost/' : '').$file.'">'.$file.'</a></li>';
``` |
3,152,664 | Here's an interesting question about the various quirks of the C++ language. I have a pair of functions, which are supposed to fill an array of points with the corners of a rectangle. There are two overloads for it: one takes a `Point[5]`, the other takes a `Point[4]`. The 5-point version refers to a closed polygon, wh... | 2010/06/30 | [
"https://Stackoverflow.com/questions/3152664",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53315/"
] | Why don't you just pass a standard pointer, instead of a sized one, like this
```
void RectToPointArray(const degRect& rect, degPoint * points ) ;
``` | >
> So my question is: is there a
> type-safe way of casting an array of
> one size to an array of a smaller size
> where the array type is the same?
>
>
>
No. I don't think the language allows you to do this at all: consider casting int[10] to int[5]. You can always get a pointer to it, however, but we can't '... |
3,152,664 | Here's an interesting question about the various quirks of the C++ language. I have a pair of functions, which are supposed to fill an array of points with the corners of a rectangle. There are two overloads for it: one takes a `Point[5]`, the other takes a `Point[4]`. The 5-point version refers to a closed polygon, wh... | 2010/06/30 | [
"https://Stackoverflow.com/questions/3152664",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53315/"
] | I don't think your framing/thinking of the problem is correct. You don't generally need to concretely type an object that has 4 vertices vs an object that has 5.
But if you MUST type it, then you can use `struct`s to concretely define the types instead.
```
struct Coord
{
float lat, long ;
} ;
```
Then
```
str... | >
> So my question is: is there a
> type-safe way of casting an array of
> one size to an array of a smaller size
> where the array type is the same?
>
>
>
No. I don't think the language allows you to do this at all: consider casting int[10] to int[5]. You can always get a pointer to it, however, but we can't '... |
3,152,664 | Here's an interesting question about the various quirks of the C++ language. I have a pair of functions, which are supposed to fill an array of points with the corners of a rectangle. There are two overloads for it: one takes a `Point[5]`, the other takes a `Point[4]`. The 5-point version refers to a closed polygon, wh... | 2010/06/30 | [
"https://Stackoverflow.com/questions/3152664",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53315/"
] | I would use `std::vector` or *(this is really bad and should not be used)* in some extreme cases you can even use plain arrays via pointer like `Point*` and then you shouldn't have such *"casting"* troubles. | Why don't you just pass a standard pointer, instead of a sized one, like this
```
void RectToPointArray(const degRect& rect, degPoint * points ) ;
``` |
3,152,664 | Here's an interesting question about the various quirks of the C++ language. I have a pair of functions, which are supposed to fill an array of points with the corners of a rectangle. There are two overloads for it: one takes a `Point[5]`, the other takes a `Point[4]`. The 5-point version refers to a closed polygon, wh... | 2010/06/30 | [
"https://Stackoverflow.com/questions/3152664",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53315/"
] | Why don't you just pass a standard pointer, instead of a sized one, like this
```
void RectToPointArray(const degRect& rect, degPoint * points ) ;
``` | I guess you could use function template specialization, like this (simplified example where first argument was ignored and function name was replaced by f(), etc.):
```
#include <iostream>
using namespace std;
class X
{
};
template<int sz, int n>
int f(X (&x)[sz])
{
cout<<"process "<<n<<" entries in a "<<sz<<"-d... |
3,152,664 | Here's an interesting question about the various quirks of the C++ language. I have a pair of functions, which are supposed to fill an array of points with the corners of a rectangle. There are two overloads for it: one takes a `Point[5]`, the other takes a `Point[4]`. The 5-point version refers to a closed polygon, wh... | 2010/06/30 | [
"https://Stackoverflow.com/questions/3152664",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53315/"
] | I would use `std::vector` or *(this is really bad and should not be used)* in some extreme cases you can even use plain arrays via pointer like `Point*` and then you shouldn't have such *"casting"* troubles. | >
> So my question is: is there a
> type-safe way of casting an array of
> one size to an array of a smaller size
> where the array type is the same?
>
>
>
No. I don't think the language allows you to do this at all: consider casting int[10] to int[5]. You can always get a pointer to it, however, but we can't '... |
3,152,664 | Here's an interesting question about the various quirks of the C++ language. I have a pair of functions, which are supposed to fill an array of points with the corners of a rectangle. There are two overloads for it: one takes a `Point[5]`, the other takes a `Point[4]`. The 5-point version refers to a closed polygon, wh... | 2010/06/30 | [
"https://Stackoverflow.com/questions/3152664",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53315/"
] | I don't think it's a good idea to do this by overloading. The name of the function doesn't tell the caller whether it's going to fill an open array or not. And what if the caller has only a pointer and wants to fill coordinates (let's say he wants to fill multiple rectangles to be part of a bigger array at different of... | I would use `std::vector` or *(this is really bad and should not be used)* in some extreme cases you can even use plain arrays via pointer like `Point*` and then you shouldn't have such *"casting"* troubles. |
3,152,664 | Here's an interesting question about the various quirks of the C++ language. I have a pair of functions, which are supposed to fill an array of points with the corners of a rectangle. There are two overloads for it: one takes a `Point[5]`, the other takes a `Point[4]`. The 5-point version refers to a closed polygon, wh... | 2010/06/30 | [
"https://Stackoverflow.com/questions/3152664",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53315/"
] | I would use `std::vector` or *(this is really bad and should not be used)* in some extreme cases you can even use plain arrays via pointer like `Point*` and then you shouldn't have such *"casting"* troubles. | I guess you could use function template specialization, like this (simplified example where first argument was ignored and function name was replaced by f(), etc.):
```
#include <iostream>
using namespace std;
class X
{
};
template<int sz, int n>
int f(X (&x)[sz])
{
cout<<"process "<<n<<" entries in a "<<sz<<"-d... |
3,152,664 | Here's an interesting question about the various quirks of the C++ language. I have a pair of functions, which are supposed to fill an array of points with the corners of a rectangle. There are two overloads for it: one takes a `Point[5]`, the other takes a `Point[4]`. The 5-point version refers to a closed polygon, wh... | 2010/06/30 | [
"https://Stackoverflow.com/questions/3152664",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53315/"
] | I don't think it's a good idea to do this by overloading. The name of the function doesn't tell the caller whether it's going to fill an open array or not. And what if the caller has only a pointer and wants to fill coordinates (let's say he wants to fill multiple rectangles to be part of a bigger array at different of... | I guess you could use function template specialization, like this (simplified example where first argument was ignored and function name was replaced by f(), etc.):
```
#include <iostream>
using namespace std;
class X
{
};
template<int sz, int n>
int f(X (&x)[sz])
{
cout<<"process "<<n<<" entries in a "<<sz<<"-d... |
3,152,664 | Here's an interesting question about the various quirks of the C++ language. I have a pair of functions, which are supposed to fill an array of points with the corners of a rectangle. There are two overloads for it: one takes a `Point[5]`, the other takes a `Point[4]`. The 5-point version refers to a closed polygon, wh... | 2010/06/30 | [
"https://Stackoverflow.com/questions/3152664",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53315/"
] | I don't think it's a good idea to do this by overloading. The name of the function doesn't tell the caller whether it's going to fill an open array or not. And what if the caller has only a pointer and wants to fill coordinates (let's say he wants to fill multiple rectangles to be part of a bigger array at different of... | I don't think your framing/thinking of the problem is correct. You don't generally need to concretely type an object that has 4 vertices vs an object that has 5.
But if you MUST type it, then you can use `struct`s to concretely define the types instead.
```
struct Coord
{
float lat, long ;
} ;
```
Then
```
str... |
3,152,664 | Here's an interesting question about the various quirks of the C++ language. I have a pair of functions, which are supposed to fill an array of points with the corners of a rectangle. There are two overloads for it: one takes a `Point[5]`, the other takes a `Point[4]`. The 5-point version refers to a closed polygon, wh... | 2010/06/30 | [
"https://Stackoverflow.com/questions/3152664",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53315/"
] | I don't think it's a good idea to do this by overloading. The name of the function doesn't tell the caller whether it's going to fill an open array or not. And what if the caller has only a pointer and wants to fill coordinates (let's say he wants to fill multiple rectangles to be part of a bigger array at different of... | >
> So my question is: is there a
> type-safe way of casting an array of
> one size to an array of a smaller size
> where the array type is the same?
>
>
>
No. I don't think the language allows you to do this at all: consider casting int[10] to int[5]. You can always get a pointer to it, however, but we can't '... |
206,293 | Is there a reason, historical or otherwise, why the modulus operator is part of a small set of standard operators in what seems like many languages? (`+, -, *, /` and `%`, for Java and C, with `**` in Ruby and Python).
It seems strange to include mod as a "fundamental" (not to knock it, I use it plenty, but I also use... | 2013/07/23 | [
"https://softwareengineering.stackexchange.com/questions/206293",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/197372/"
] | I am sure it is common because many CPU architectures implement `modulus` as a second output of the integer divide instruction.
I don't recall it being present in 1970s CPUs (6800, 8080, Z80, 1604, etc.), but by the 1980s, the Intel 8086 and 8088, as well as the Motorola 6809 had it.
The PDP-11 instruction architectu... | Many programming languages have a "remainder" operator which may be used as a modulus operator when both operands are positive; said operator is often called the "modulus" operator, because that is its primary use. Languages generally have such an operator because many hardware platforms' division hardware automaticall... |
206,293 | Is there a reason, historical or otherwise, why the modulus operator is part of a small set of standard operators in what seems like many languages? (`+, -, *, /` and `%`, for Java and C, with `**` in Ruby and Python).
It seems strange to include mod as a "fundamental" (not to knock it, I use it plenty, but I also use... | 2013/07/23 | [
"https://softwareengineering.stackexchange.com/questions/206293",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/197372/"
] | I am sure it is common because many CPU architectures implement `modulus` as a second output of the integer divide instruction.
I don't recall it being present in 1970s CPUs (6800, 8080, Z80, 1604, etc.), but by the 1980s, the Intel 8086 and 8088, as well as the Motorola 6809 had it.
The PDP-11 instruction architectu... | Modulus is closely related to group and ring theory, which are very fundamental mathematical theories.
Exponentiation is just the third operation in the sequence addition, multiplication, exponentiation, tetration (and that's an infinite sequence). It does become important mainly with complex numbers, which are rarer... |
206,293 | Is there a reason, historical or otherwise, why the modulus operator is part of a small set of standard operators in what seems like many languages? (`+, -, *, /` and `%`, for Java and C, with `**` in Ruby and Python).
It seems strange to include mod as a "fundamental" (not to knock it, I use it plenty, but I also use... | 2013/07/23 | [
"https://softwareengineering.stackexchange.com/questions/206293",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/197372/"
] | I am sure it is common because many CPU architectures implement `modulus` as a second output of the integer divide instruction.
I don't recall it being present in 1970s CPUs (6800, 8080, Z80, 1604, etc.), but by the 1980s, the Intel 8086 and 8088, as well as the Motorola 6809 had it.
The PDP-11 instruction architectu... | Sorry, but at the risk of turning this into a game of "Call My Bluff" I think the real answer to this question is quite simple:
Mod allows precise computations in "non-decimal" quantities and units such as dates, time, yards, inches, ounces etc.
In decimal calculations, it also provides a method for the programmer to... |
206,293 | Is there a reason, historical or otherwise, why the modulus operator is part of a small set of standard operators in what seems like many languages? (`+, -, *, /` and `%`, for Java and C, with `**` in Ruby and Python).
It seems strange to include mod as a "fundamental" (not to knock it, I use it plenty, but I also use... | 2013/07/23 | [
"https://softwareengineering.stackexchange.com/questions/206293",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/197372/"
] | Many programming languages have a "remainder" operator which may be used as a modulus operator when both operands are positive; said operator is often called the "modulus" operator, because that is its primary use. Languages generally have such an operator because many hardware platforms' division hardware automaticall... | Modulus is closely related to group and ring theory, which are very fundamental mathematical theories.
Exponentiation is just the third operation in the sequence addition, multiplication, exponentiation, tetration (and that's an infinite sequence). It does become important mainly with complex numbers, which are rarer... |
206,293 | Is there a reason, historical or otherwise, why the modulus operator is part of a small set of standard operators in what seems like many languages? (`+, -, *, /` and `%`, for Java and C, with `**` in Ruby and Python).
It seems strange to include mod as a "fundamental" (not to knock it, I use it plenty, but I also use... | 2013/07/23 | [
"https://softwareengineering.stackexchange.com/questions/206293",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/197372/"
] | Many programming languages have a "remainder" operator which may be used as a modulus operator when both operands are positive; said operator is often called the "modulus" operator, because that is its primary use. Languages generally have such an operator because many hardware platforms' division hardware automaticall... | Sorry, but at the risk of turning this into a game of "Call My Bluff" I think the real answer to this question is quite simple:
Mod allows precise computations in "non-decimal" quantities and units such as dates, time, yards, inches, ounces etc.
In decimal calculations, it also provides a method for the programmer to... |
206,293 | Is there a reason, historical or otherwise, why the modulus operator is part of a small set of standard operators in what seems like many languages? (`+, -, *, /` and `%`, for Java and C, with `**` in Ruby and Python).
It seems strange to include mod as a "fundamental" (not to knock it, I use it plenty, but I also use... | 2013/07/23 | [
"https://softwareengineering.stackexchange.com/questions/206293",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/197372/"
] | Modulus is closely related to group and ring theory, which are very fundamental mathematical theories.
Exponentiation is just the third operation in the sequence addition, multiplication, exponentiation, tetration (and that's an infinite sequence). It does become important mainly with complex numbers, which are rarer... | Sorry, but at the risk of turning this into a game of "Call My Bluff" I think the real answer to this question is quite simple:
Mod allows precise computations in "non-decimal" quantities and units such as dates, time, yards, inches, ounces etc.
In decimal calculations, it also provides a method for the programmer to... |
106,854 | I'm getting this error on the `ST_ConcaveHull` function call and after reading the docs, I'm unclear as to whether this Error is correct behavior or not.
Here is the business end of the query (vx are points):
`select id , ST_ConcaveHull(ST_Collect(vx), 0.80)`
And here's the error:
```
********** Error ********** ... | 2014/07/10 | [
"https://gis.stackexchange.com/questions/106854",
"https://gis.stackexchange.com",
"https://gis.stackexchange.com/users/31/"
] | Regina's comment actually answered the question--it isn't expected behaviour.
As a workaround, I wrapped the call with function w/ exception block so that I get null back (which is OK for my purposes).
Feel free to edit/improve because `pl/pgsql` isn't my strength:
```
--DROP FUNCTION public.st_nullableconcavehull... | I confirm this behavior is still problematic as of this postgis\_full\_version() on PostgreSQL 9.5
```
POSTGIS="2.3.2 r15302" GEOS="3.4.2-CAPI-1.8.2 r3921" PROJ="Rel. 4.8.0, 6 March 2012" GDAL="GDAL 1.10.1, released 2013/08/26" LIBXML="2.9.1" LIBJSON="0.11.99" RASTER.
```
---
Jay Cummins Patch was effective however... |
62,577 | Why has the bell distribution not become widely used? Is the bell distribution only ideal in inviscid flow scenarios or is there another reason for the lack of use? | 2019/04/21 | [
"https://aviation.stackexchange.com/questions/62577",
"https://aviation.stackexchange.com",
"https://aviation.stackexchange.com/users/38891/"
] | Something like it is widely used, only not by this name.
Although less elegant and general than Prandtl's paper, the same solution was found 17 years later by R.T. Jones when he optimized the ratio of lift to mass of wings in [NACA TN 2249](https://ntrs.nasa.gov/archive/nasa/casi.ntrs.nasa.gov/19760012005.pdf). The fi... | i think the short answer to your first question is that there aren't very many aircraft without vertical surface. Only a few body-style such as flying wing come to mind, i have a friend who designed one recently.
For your second question no unless you're approaching the speed of sound, "inviscid flow" simplifies equat... |
58,540 | When trying to enter a SQL query with parameters using the Oracle OLE DB provider I get the following error:
>
> Parameters cannot be extracted from the SQL command. The provider might not help to parse parameter information from the command. In that case, use the "SQL command from variable" access mode, in which the... | 2008/09/12 | [
"https://Stackoverflow.com/questions/58540",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1281/"
] | To expand on the link given in the question:
1. Create a package variable
2. Double click on the package variable name. (This allows you to access the properties of the variable)
3. Set the property 'EvaluateAsExpression' to true
4. Enter the query in the expression builder.
5. Set the OLE DB source query to SQL Comma... | If You use Data Flow Task and use OLE DB Source, and you need parameterize your Query :
1. Create Variable to save "Full" of Query statement : Right Click on blank area outside the package - and Click Variables :
[](https://i.stack.imgur.com/yLvNJ.jpg)
Click Add Vari... |
58,540 | When trying to enter a SQL query with parameters using the Oracle OLE DB provider I get the following error:
>
> Parameters cannot be extracted from the SQL command. The provider might not help to parse parameter information from the command. In that case, use the "SQL command from variable" access mode, in which the... | 2008/09/12 | [
"https://Stackoverflow.com/questions/58540",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1281/"
] | To expand on the link given in the question:
1. Create a package variable
2. Double click on the package variable name. (This allows you to access the properties of the variable)
3. Set the property 'EvaluateAsExpression' to true
4. Enter the query in the expression builder.
5. Set the OLE DB source query to SQL Comma... | In my case the issue was that i had comments within the sql in the normal form of /\* \*/ and i also had column aliases as "Column name" instead of [Column Name].
Once i removed them it works.
Also try to have your parameter ? statement within the WHERE clause and not within the JOINS, that was part of the issue to... |
49,777,108 | I am trying to check if a playlist is simple or master by an index value. My problem is when I put the (True) URL it still returns a false statement "This is a simple Playlist".
Any tips on how I can fix this ?
```
String output = getPlaylistUrl(input);
String mediaRecord = output.substring(399);
String lastRecord ... | 2018/04/11 | [
"https://Stackoverflow.com/questions/49777108",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9259365/"
] | In Java, strings can not be compared for equality using `==`, because `==` compares two instances, not the content. So unless s1 and s2 are actually the same instance, `s1 == s2` will never return `true`.
You need to use `equals(...)` to compare two strings for equality.
```
if (mediaRecord.equals(lastRecord) { ... }... | In order to compare Strings you need to use .equals and not ==. Using == compares references and not values |
36,701,708 | I'm using the following statement in a mySQL workbench query:
```
LOAD XML INFILE 'ProductFile.xml' INTO TABLE myDB.products
ROWS IDENTIFIED BY '<product>';
```
which produces the following log:
>
> 19:15:52 LOAD XML INFILE 'ProductFile.xml' INTO TABLE myDB.products ROWS IDENTIFIED BY '' 0 row(s) affected Records... | 2016/04/18 | [
"https://Stackoverflow.com/questions/36701708",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5935169/"
] | If you want to see detalis you can use window aggregate functions.
One of the benefits of using window functions is that unlike grouped queries, windowed queries do not hide the detali. They return a row for every underlying query's row.
Using OVER clause you define a window of rows for the function.
You can try t... | Just use window functions:
```
SELECT *, SUM(price_amount) OVER () as total_price_amount
FROM tBoard b INNER JOIN
tPrice p
ON b.PriceBand_ID = p.PriceBand_ID
WHERE Board_start_date BETWEEN '20150101' AND '20150131';
``` |
212,132 | I'm trying to add the ppa repository (as a root) with the following command:
```
export HTTP_PROXY="http://firstname.surname@xxx.com:my_pass@165.x.x.232:8080"
add-apt-repository ppa:nilarimogard/webupd8
Traceback (most recent call last):
File "/usr/bin/add-apt-repository", line 125, in <module>
ppa_info = get_p... | 2012/11/05 | [
"https://askubuntu.com/questions/212132",
"https://askubuntu.com",
"https://askubuntu.com/users/78223/"
] | Workaround if `apt-get` still works behind the proxy
----------------------------------------------------
* add sources manually to `/etc/apt/sources.list`
* add gpg key
Adding sources manually
-----------------------
I think on launchpad.net every ppa still contains a small description how to add sources manually. ... | Actually it seems to be much easier than the answer posted previously. You just need "sudo" to know that you are behind a proxy and it will work effortlessly. To do this, you need to export your proxy for `http` and `https` the way you usually do:
```
export http_proxy=http://username:password@host:port/
export https_... |
212,132 | I'm trying to add the ppa repository (as a root) with the following command:
```
export HTTP_PROXY="http://firstname.surname@xxx.com:my_pass@165.x.x.232:8080"
add-apt-repository ppa:nilarimogard/webupd8
Traceback (most recent call last):
File "/usr/bin/add-apt-repository", line 125, in <module>
ppa_info = get_p... | 2012/11/05 | [
"https://askubuntu.com/questions/212132",
"https://askubuntu.com",
"https://askubuntu.com/users/78223/"
] | Workaround if `apt-get` still works behind the proxy
----------------------------------------------------
* add sources manually to `/etc/apt/sources.list`
* add gpg key
Adding sources manually
-----------------------
I think on launchpad.net every ppa still contains a small description how to add sources manually. ... | Make sure **apt proxy** is set like below
```
sudo vi /etc/apt/apt.conf
```
add following proxy settings and save the file
```
Acquire::http::proxy "http ://proxy.company.com:port/";
Acquire::https::proxy "https ://proxy.company.com:port/";
Acquire::ftp::proxy "ftp://proxy.company.com:port/";
```
in addition expo... |
212,132 | I'm trying to add the ppa repository (as a root) with the following command:
```
export HTTP_PROXY="http://firstname.surname@xxx.com:my_pass@165.x.x.232:8080"
add-apt-repository ppa:nilarimogard/webupd8
Traceback (most recent call last):
File "/usr/bin/add-apt-repository", line 125, in <module>
ppa_info = get_p... | 2012/11/05 | [
"https://askubuntu.com/questions/212132",
"https://askubuntu.com",
"https://askubuntu.com/users/78223/"
] | Actually it seems to be much easier than the answer posted previously. You just need "sudo" to know that you are behind a proxy and it will work effortlessly. To do this, you need to export your proxy for `http` and `https` the way you usually do:
```
export http_proxy=http://username:password@host:port/
export https_... | Make sure **apt proxy** is set like below
```
sudo vi /etc/apt/apt.conf
```
add following proxy settings and save the file
```
Acquire::http::proxy "http ://proxy.company.com:port/";
Acquire::https::proxy "https ://proxy.company.com:port/";
Acquire::ftp::proxy "ftp://proxy.company.com:port/";
```
in addition expo... |
6,859,225 | I would like to be able to control the appearance of the `JFileChooser`. In particular I would like to save how the `JFileChooser` was displayed when it was last shown. I would like to save whether it was used in details/list view and which column (eg, size or date modified) the lists were sorted.
I know there is a lo... | 2011/07/28 | [
"https://Stackoverflow.com/questions/6859225",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/541765/"
] | Keep a reference to it and only construct it once. It should open on subsequent occasions looking pretty much like it did when the user disposed it. You would need to take extra steps to restore the **location** of the file chooser.
---
### Persisting between runs.
There are a number of ways of storing the data betw... | Unfortunately, what you want to do is not trivial. It should be, but it's not implemented that way. The display of the directory and the sorting is part of the LAF. The only way to get the behavior you want is by implementing your own [BasicFileChooserUI](http://download.oracle.com/javase/6/docs/api/javax/swing/plaf/ba... |
6,859,225 | I would like to be able to control the appearance of the `JFileChooser`. In particular I would like to save how the `JFileChooser` was displayed when it was last shown. I would like to save whether it was used in details/list view and which column (eg, size or date modified) the lists were sorted.
I know there is a lo... | 2011/07/28 | [
"https://Stackoverflow.com/questions/6859225",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/541765/"
] | How about Object Serialization ? You can Persist the JFileChooser Object to a file and later retrieve it. | Unfortunately, what you want to do is not trivial. It should be, but it's not implemented that way. The display of the directory and the sorting is part of the LAF. The only way to get the behavior you want is by implementing your own [BasicFileChooserUI](http://download.oracle.com/javase/6/docs/api/javax/swing/plaf/ba... |
58,916,306 | I'm trying to parse a string with regex. A valid string is of the following format:
```
https://github.com/xyz/abc/a_123/project_14.git
```
The valid string should contain `github.com` and `xyz` or `zyx`. If the string is valid I want to capture `abc/a_123` into `$A` and `project_14` into `$B`.
What I did:
```
if ... | 2019/11/18 | [
"https://Stackoverflow.com/questions/58916306",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9808098/"
] | Here is a way using regex:
```
url='https://github.com/xyz/abc/a_123/project_14.git'
if [[ $url =~ http[s]?:[/]{2}(github.com)[/]([[:alpha:]]+)(/.*)$ ]]
then
$A=${BASH_REMATCH[2]}
$B=${BASH_REMATCH[3]%.git}
fi
```
And here is a small proof of concept:
```
url='https://github.com/xyz/abc/a_123/project_... | I think this does what you want :
```
#!/bin/bash
repo="https://github.com/xyz/abc/a_123/project_14.git"
[[ ! "$repo" =~ https:\/\/github.com\/[a-z]+\/[a-z]+\/[a-z]_[0-9]+\/.*.git ]] && exit
A=$( echo "$repo" | sed -E "s/(https:\/\/github.com\/[a-z]+)(\/[a-z]+\/[a-z]_[0-9]+\/)(.*.git)/\2/g" )
B=$( echo "$repo" | se... |
58,916,306 | I'm trying to parse a string with regex. A valid string is of the following format:
```
https://github.com/xyz/abc/a_123/project_14.git
```
The valid string should contain `github.com` and `xyz` or `zyx`. If the string is valid I want to capture `abc/a_123` into `$A` and `project_14` into `$B`.
What I did:
```
if ... | 2019/11/18 | [
"https://Stackoverflow.com/questions/58916306",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9808098/"
] | Here is a way using regex:
```
url='https://github.com/xyz/abc/a_123/project_14.git'
if [[ $url =~ http[s]?:[/]{2}(github.com)[/]([[:alpha:]]+)(/.*)$ ]]
then
$A=${BASH_REMATCH[2]}
$B=${BASH_REMATCH[3]%.git}
fi
```
And here is a small proof of concept:
```
url='https://github.com/xyz/abc/a_123/project_... | Would you please try the following:
```
strchk() {
local x=$1
if [[ $x =~ github.com/(xyz|zyx)/(.+)/(.+) ]]; then
A="${BASH_REMATCH[2]}"
B="${BASH_REMATCH[3]%.*}"
return 0
else
return 1
fi
}
```
Results:
```
strchk "https://github.com/xyz/abc/a_123/project_14.git" && ... |
13,340,955 | I got an float pointer (array), which represents an image.
It's elements count and index has width\*height.
The image is not like a matrix, which has it's origin at the upper left.
Instead it has the origin in the lower left, like in the carthesian coordinate system.
After reaching the max-width, it starts it's next ro... | 2012/11/12 | [
"https://Stackoverflow.com/questions/13340955",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1654284/"
] | I'll throw a rock in the lake and watch the ripples. Note: I have *no* idea what the caller expects to do with the xformed data, mostly due to my fledgling knowledge of OpenCV. However the core question of transformation seemed pretty straight forward. If I'm way off-base kindly leave a comment and I'll drop the answer... | Planning your image processing API as
```
void my_func (int *src, int *dst, int x_stride, int y_stride, int N);
```
makes it easy to iterate in continuous memory while flipping the scanning direction between left<->right, but also between up<->down.
If the API is designed for different input & output *strides*, o... |
13,340,955 | I got an float pointer (array), which represents an image.
It's elements count and index has width\*height.
The image is not like a matrix, which has it's origin at the upper left.
Instead it has the origin in the lower left, like in the carthesian coordinate system.
After reaching the max-width, it starts it's next ro... | 2012/11/12 | [
"https://Stackoverflow.com/questions/13340955",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1654284/"
] | I'll throw a rock in the lake and watch the ripples. Note: I have *no* idea what the caller expects to do with the xformed data, mostly due to my fledgling knowledge of OpenCV. However the core question of transformation seemed pretty straight forward. If I'm way off-base kindly leave a comment and I'll drop the answer... | As I understand your problem, you want to pass your array to an OpenCV API so that it interprets it as a `(top,left)` indexed 2-d matrix. One simple way to do that without rearranging any of your array is illustrated by the following example :
```
float a[8] = {1,2,3,4,5,6,7,8}; //your array containing the image
int ... |
39,230,191 | The question is quite simple. I have following SQL:
```
SELECT *
FROM T1
SELECT *
FROM T2
SELECT *
FROM T3
SELECT *
FROM T4
```
In one case I need all four data sets, in other I need only `T1` and `T2`.
Should I write another stored procedure which returns only `T1` and `T2`, or can I just skip last two data sets... | 2016/08/30 | [
"https://Stackoverflow.com/questions/39230191",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2559709/"
] | Reader will only read so far ahead
It may start the NextResult(); but it won't execute it all unless it fits in the buffer
Try this
After you read T1 change a value in T4
You will see the new value (unless the row count is low)
You would not see the new value if SQL ran all 4 at the start
You can also re... | Since SQL Server does not know what you are doing with the result sets within your application, it will prepare all resultsets whether you need them or not. At least I think so.
You might open the Profiler to monitor at which moment the `SELECT` takes place, all at once or one after the other... But I'm quite sure, th... |
39,230,191 | The question is quite simple. I have following SQL:
```
SELECT *
FROM T1
SELECT *
FROM T2
SELECT *
FROM T3
SELECT *
FROM T4
```
In one case I need all four data sets, in other I need only `T1` and `T2`.
Should I write another stored procedure which returns only `T1` and `T2`, or can I just skip last two data sets... | 2016/08/30 | [
"https://Stackoverflow.com/questions/39230191",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2559709/"
] | Reader will only read so far ahead
It may start the NextResult(); but it won't execute it all unless it fits in the buffer
Try this
After you read T1 change a value in T4
You will see the new value (unless the row count is low)
You would not see the new value if SQL ran all 4 at the start
You can also re... | The ExecuteReader will execute the proc in its entirety. If you watch profiler and put delays in your code in between steps you will see that. The other steps you have aren't against the proc, they against the executed result of the proc in the form of your reader.
What you should do is a matter of opinion and tradeof... |
47,808,779 | I am implementing `Text-to-Speech(TTS)` in android on English, Hindi and Punjabi language.
`TTS` working fine in English and Hindi but it is not working on the Punjabi language.
For the Punjabi language, I used this below code
```
tts.setLanguage(new Locale("pan"));
tts.speak(output, TextToSpeech.QUEUE_FLUSH, null... | 2017/12/14 | [
"https://Stackoverflow.com/questions/47808779",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7029181/"
] | The TextToSpeech object you create (tts) can use any speech engine. You are probably using the Google engine.
Different engines have different capabilities.
Usually the engine on a device is either:
1) Samsung speech engine - "com.samsung.SMT"
2) Google speech engine - "com.google.android.tts"
or 3) PICO - "com.sv... | Andorid does not have Text to speech for Punjabi enabled yet. In my opinion, you have to use Hear2Read app for Punjabi TTS. |
47,808,779 | I am implementing `Text-to-Speech(TTS)` in android on English, Hindi and Punjabi language.
`TTS` working fine in English and Hindi but it is not working on the Punjabi language.
For the Punjabi language, I used this below code
```
tts.setLanguage(new Locale("pan"));
tts.speak(output, TextToSpeech.QUEUE_FLUSH, null... | 2017/12/14 | [
"https://Stackoverflow.com/questions/47808779",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7029181/"
] | There's a Work Around to support Punjabi Text to speech in android as Google is not supporting it officially now. We have translated punjabi text in hindi and then used the Hindi Text to speech feature to achieve the required behaviour.
To speak ਹਰੀ ਬੱਤੀ ਲਈ ਤਿਆਰ ਹੋ ਜਾਓ ਜੀ text in punjabi, we have to use हरी बत्ती लई त... | Andorid does not have Text to speech for Punjabi enabled yet. In my opinion, you have to use Hear2Read app for Punjabi TTS. |
47,808,779 | I am implementing `Text-to-Speech(TTS)` in android on English, Hindi and Punjabi language.
`TTS` working fine in English and Hindi but it is not working on the Punjabi language.
For the Punjabi language, I used this below code
```
tts.setLanguage(new Locale("pan"));
tts.speak(output, TextToSpeech.QUEUE_FLUSH, null... | 2017/12/14 | [
"https://Stackoverflow.com/questions/47808779",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7029181/"
] | The TextToSpeech object you create (tts) can use any speech engine. You are probably using the Google engine.
Different engines have different capabilities.
Usually the engine on a device is either:
1) Samsung speech engine - "com.samsung.SMT"
2) Google speech engine - "com.google.android.tts"
or 3) PICO - "com.sv... | There's a Work Around to support Punjabi Text to speech in android as Google is not supporting it officially now. We have translated punjabi text in hindi and then used the Hindi Text to speech feature to achieve the required behaviour.
To speak ਹਰੀ ਬੱਤੀ ਲਈ ਤਿਆਰ ਹੋ ਜਾਓ ਜੀ text in punjabi, we have to use हरी बत्ती लई त... |
22,101,775 | How can i call method of a window form from another form closing event ?
Suppose second for is getting closed and i want to call method of first form when second get closed to update some changes on first window form. | 2014/02/28 | [
"https://Stackoverflow.com/questions/22101775",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1772998/"
] | You can add an event handler to the `form_closing` event in the first form and handle it accordingly.
Somewhere in `form1`
```
form2.Form_Closing += yourhandler;
``` | Pass a reference from your first form to your second. Say you create your second form this way (From your first form):
```
Form2 frm2 = new Form2();
frm2.referenceToFirstForm = this
```
In your second form you should have this:
```
public Form1 referenceToFirstForm
```
Then in your `OnClosing` event you can refer... |
22,101,775 | How can i call method of a window form from another form closing event ?
Suppose second for is getting closed and i want to call method of first form when second get closed to update some changes on first window form. | 2014/02/28 | [
"https://Stackoverflow.com/questions/22101775",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1772998/"
] | You can add an event handler to the `form_closing` event in the first form and handle it accordingly.
Somewhere in `form1`
```
form2.Form_Closing += yourhandler;
``` | This assumes that form 2 has a a control called TextBox1, when form 2 closes the lambda expression will be called and transfer data to form 1.
```
public partial class Form1 : Form
{
private Form2 openedForm2 = null;
public Form1()
{
InitializeComponent();
}
private void button1_Click(ob... |
22,101,775 | How can i call method of a window form from another form closing event ?
Suppose second for is getting closed and i want to call method of first form when second get closed to update some changes on first window form. | 2014/02/28 | [
"https://Stackoverflow.com/questions/22101775",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1772998/"
] | This assumes that form 2 has a a control called TextBox1, when form 2 closes the lambda expression will be called and transfer data to form 1.
```
public partial class Form1 : Form
{
private Form2 openedForm2 = null;
public Form1()
{
InitializeComponent();
}
private void button1_Click(ob... | Pass a reference from your first form to your second. Say you create your second form this way (From your first form):
```
Form2 frm2 = new Form2();
frm2.referenceToFirstForm = this
```
In your second form you should have this:
```
public Form1 referenceToFirstForm
```
Then in your `OnClosing` event you can refer... |
14,389 | According to [someone on the internet](http://av8.home.comcast.net/~av8/onlinestorage/fltplanchange.pdf), the FAA intends to discontinue accepting domestic flight plans and switch to ICAO-only in October. I've also heard this around the airport, but been unable to verify it.
The provided link says that the FAA is *pro... | 2015/04/26 | [
"https://aviation.stackexchange.com/questions/14389",
"https://aviation.stackexchange.com",
"https://aviation.stackexchange.com/users/167/"
] | The link from your question paraphrases and links to [“Flight Service Program Changes,”](http://www.faa.gov/about/office_org/headquarters_offices/ato/service_units/systemops/fs/changes/) of which the April 13, 2015 7:49:56 AM EDT revision is reproduced below with **added emphasis in boldface.**
>
> Flight Service Pro... | That is a yes. They are proposing to move away from the NAS FP (FAA Form 7233-1) and require use of the FAA Form 7233-4 (The FAA version of an international flight plan). The move is hoped for the fall of 2016. The delay was to get all vendors up to speed, and iron out procedures for specialty flight plans like those f... |
2,926,134 | I am new to etale cohomology theory and recently learnt some base change theorems like proper base change and smooth base change. However, I am somehow confused about the etale cohomology group of $\Bbb Z/p\Bbb Z$ after base change.
For example, asssume we have a scheme $X$ proper smooth over $\Bbb Z\_p$, where $\Bbb ... | 2018/09/22 | [
"https://math.stackexchange.com/questions/2926134",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/-1/"
] | The answer to the question, as written, is no. Let me give you a silly reason it can never be true, and then give you a more interesting way of constructing a concrete example.
Note that if $X/\mathbb{F}\_p$ is a smooth (not needed, but makes me feel better) geometrically connected variety of dimension $n$, then $H^i(... | >
> Do you know examples where the dimension of i-th cohomology group of the special fiber is larger than generic fiber?
>
>
> It's late, so I'll have to think more, but the answer is definitely no for $i=1$, and in fact the proof follows from the above. The key point is to recall that if $X$ is a smooth geometrical... |
10,132,465 | I finally have my multilingual CakePHP 2.1 app *almost* working.
First, I define the default language at the end of `core.php`:
```
/* Define default language */
Configure::write('Config.language', 'eng');
```
Here is my code in `AppControler.php`:
```
public function beforeFilter() {
parent::beforeFilter();
... | 2012/04/12 | [
"https://Stackoverflow.com/questions/10132465",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/967773/"
] | I ended up adding a function to my AppController and calling it in my `beforeFilter()`:
My `beforeFilter()` looks like this:
```
public function beforeFilter() {
parent::beforeFilter();
$this->_checkRoute();
$this->Auth->allow('index','view','home','display','logout');
}
```
Here is the `_checkRoute()... | Can you give us the HTML output of the flags ?
I think it's an issue with your url method in your AppHelper. If you try to echo something in it, does it show ?
**Edit** : I've another explanation, in your route, you have :
```
'language' => '[a-z]{2}'
```
As your language code use 3 characters, you should use :
`... |
10,132,465 | I finally have my multilingual CakePHP 2.1 app *almost* working.
First, I define the default language at the end of `core.php`:
```
/* Define default language */
Configure::write('Config.language', 'eng');
```
Here is my code in `AppControler.php`:
```
public function beforeFilter() {
parent::beforeFilter();
... | 2012/04/12 | [
"https://Stackoverflow.com/questions/10132465",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/967773/"
] | Can you give us the HTML output of the flags ?
I think it's an issue with your url method in your AppHelper. If you try to echo something in it, does it show ?
**Edit** : I've another explanation, in your route, you have :
```
'language' => '[a-z]{2}'
```
As your language code use 3 characters, you should use :
`... | Just in case others fall over this question. What I did was using deewilcox's answer above and changed the code a bit.
```
function _checkRoute() {
$lang = $this->params["language"];
if ($lang != $this->Session->read("Config.language")) {
$this->Session->write('Config.language', "".$lang);
Con... |
10,132,465 | I finally have my multilingual CakePHP 2.1 app *almost* working.
First, I define the default language at the end of `core.php`:
```
/* Define default language */
Configure::write('Config.language', 'eng');
```
Here is my code in `AppControler.php`:
```
public function beforeFilter() {
parent::beforeFilter();
... | 2012/04/12 | [
"https://Stackoverflow.com/questions/10132465",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/967773/"
] | I ended up adding a function to my AppController and calling it in my `beforeFilter()`:
My `beforeFilter()` looks like this:
```
public function beforeFilter() {
parent::beforeFilter();
$this->_checkRoute();
$this->Auth->allow('index','view','home','display','logout');
}
```
Here is the `_checkRoute()... | Just in case others fall over this question. What I did was using deewilcox's answer above and changed the code a bit.
```
function _checkRoute() {
$lang = $this->params["language"];
if ($lang != $this->Session->read("Config.language")) {
$this->Session->write('Config.language', "".$lang);
Con... |
355,527 | Here the professor said that, Tournament sort needs **(n-1) + 2(n-1)logn** comparisons.
{Where **(n-1)** for calculating **Maximum** or say creating Tournament structure
and
**2(n-1)logn** for other elements to sort}
**Why did the professor leave out the number of comparisons needed to find the Minimum?** Because to ... | 2017/08/11 | [
"https://softwareengineering.stackexchange.com/questions/355527",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/245424/"
] | I don't think cyclomatic complexity is affected by exit points. It is related to the number of code paths, which will correlate to the number of decision points. One way to look at it is "how many unit tests would I need to write to obtain 100% code coverage?" In your example, you would need two tests, in both cases.
... | From the viewpoint of cyclomatic complexity, the two should (I believe) come out the same. You've changed the syntax, but it doesn't really affect the flow of control.
If you really wanted to change the cyclomatic complexity, you could probably do something like this:
```
replies = ["No, Dog is not barking", "Yes, Do... |
355,527 | Here the professor said that, Tournament sort needs **(n-1) + 2(n-1)logn** comparisons.
{Where **(n-1)** for calculating **Maximum** or say creating Tournament structure
and
**2(n-1)logn** for other elements to sort}
**Why did the professor leave out the number of comparisons needed to find the Minimum?** Because to ... | 2017/08/11 | [
"https://softwareengineering.stackexchange.com/questions/355527",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/245424/"
] | I don't think cyclomatic complexity is affected by exit points. It is related to the number of code paths, which will correlate to the number of decision points. One way to look at it is "how many unit tests would I need to write to obtain 100% code coverage?" In your example, you would need two tests, in both cases.
... | Short answer: both examples have the same cyclomatic complexity but many tools will calculate the first one to have higher complexity.
Longer answer: ["The cyclomatic complexity of a section of source code is the number of linearly independent paths within it."](https://en.wikipedia.org/wiki/Cyclomatic_complexity) Bot... |
56,590,647 | I have 2 large json files with each 200k objects and when i try to loop between 2 jsons for a common id, it takes more time for execution.
**Implementation 1**
```
for (var i in matterData.data) {
const fobj = matterData.data[i];
const ma_array = [];
for (var j in activityData.data) {
const aobj = activit... | 2019/06/14 | [
"https://Stackoverflow.com/questions/56590647",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5568136/"
] | First create a map containing id as the key and matter.data as value and create a empty array for acitvity then iterate over the activity and push activity in empty array
```
const map = {}
for( var i in matterData.data){
map[matterData.data[i].id] = matterData.data[i];
matterData.data[i].activities = [];
}
for(v... | You are running an O(n^2) loop which is nearly 200000\*200000 loop. Thats huge calculation to handle. You can reduce this complexity by using map. Store all values of `activityData.data` in map with id. And then iterate over one `matterData.data` to check if the id exists in map. |
56,590,647 | I have 2 large json files with each 200k objects and when i try to loop between 2 jsons for a common id, it takes more time for execution.
**Implementation 1**
```
for (var i in matterData.data) {
const fobj = matterData.data[i];
const ma_array = [];
for (var j in activityData.data) {
const aobj = activit... | 2019/06/14 | [
"https://Stackoverflow.com/questions/56590647",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5568136/"
] | First create a map containing id as the key and matter.data as value and create a empty array for acitvity then iterate over the activity and push activity in empty array
```
const map = {}
for( var i in matterData.data){
map[matterData.data[i].id] = matterData.data[i];
matterData.data[i].activities = [];
}
for(v... | Implementation of [the answer with ruhul](https://stackoverflow.com/a/56590726/9986821)
```
const map = Object.create(null);
const res = [];
// Store all values of matterData.data in map with id.
matterData.data.forEach(item => (map[item.id] = item));
// iterate over one activityData.data to check if the id exists... |
56,590,647 | I have 2 large json files with each 200k objects and when i try to loop between 2 jsons for a common id, it takes more time for execution.
**Implementation 1**
```
for (var i in matterData.data) {
const fobj = matterData.data[i];
const ma_array = [];
for (var j in activityData.data) {
const aobj = activit... | 2019/06/14 | [
"https://Stackoverflow.com/questions/56590647",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5568136/"
] | First create a map containing id as the key and matter.data as value and create a empty array for acitvity then iterate over the activity and push activity in empty array
```
const map = {}
for( var i in matterData.data){
map[matterData.data[i].id] = matterData.data[i];
matterData.data[i].activities = [];
}
for(v... | The Set.has is O(1) which, I think can be used efficiently for this purpose.
```
var subSet = new Set(activityData.data.map(obj => {obj.matter.id}));
for (var i in matterData.data) {
const ma_array = [];
if (subSet.has(matterData.data[i].id){
...
}
}
``` |
1,169,987 | I had always assumed that AJAX-driven content was invisible to search engines.
(i.e. content inserted into the DOM via XMLHTTPRequest)
For example, in this site, the main content is loaded via AJAX request by the browser:
<http://www.trustedsource.org/query/terra.cl>
...if you view this page with **Javascript disab... | 2009/07/23 | [
"https://Stackoverflow.com/questions/1169987",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/52529/"
] | Following this guide from Google, AJAX sites may be made crawlable:
<http://code.google.com/intl/sv-SE/web/ajaxcrawling/docs/getting-started.html> | Search engines could run the JavaScript needed to index Ajax content, but it would be difficult and computationally expensive — I'm not aware of any that actually do.
A well written site will, if it uses Ajax, use it according to the principles of [progressive enhancement](http://icant.co.uk/articles/pragmatic-progres... |
1,169,987 | I had always assumed that AJAX-driven content was invisible to search engines.
(i.e. content inserted into the DOM via XMLHTTPRequest)
For example, in this site, the main content is loaded via AJAX request by the browser:
<http://www.trustedsource.org/query/terra.cl>
...if you view this page with **Javascript disab... | 2009/07/23 | [
"https://Stackoverflow.com/questions/1169987",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/52529/"
] | Following this guide from Google, AJAX sites may be made crawlable:
<http://code.google.com/intl/sv-SE/web/ajaxcrawling/docs/getting-started.html> | Content that gets loaded immediately (say with a secondary HTTP request as in your example after the initial pageload) is usually visible to the search engine crawler.
However, if you have content that beyond this gets loaded via ajax following a user action, e.g. clicking a tab or button and such, won't be seen or in... |
1,169,987 | I had always assumed that AJAX-driven content was invisible to search engines.
(i.e. content inserted into the DOM via XMLHTTPRequest)
For example, in this site, the main content is loaded via AJAX request by the browser:
<http://www.trustedsource.org/query/terra.cl>
...if you view this page with **Javascript disab... | 2009/07/23 | [
"https://Stackoverflow.com/questions/1169987",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/52529/"
] | If you're using something like jQuery tabs, even if you're linking to HTML files within the same directory, it degrades nicely back to normal without the javascript, and the tabs just become likes to the actual pages. It's ugly, but it works. You can also style these versions, too. | Google just made their crawlers run Javascript without any developer changes!
<http://googlewebmastercentral.blogspot.com/2015/10/deprecating-our-ajax-crawling-scheme.html>
They state:
>
> Today, as long as you're not blocking Googlebot from crawling your JavaScript or CSS files, we are generally able to render and... |
1,169,987 | I had always assumed that AJAX-driven content was invisible to search engines.
(i.e. content inserted into the DOM via XMLHTTPRequest)
For example, in this site, the main content is loaded via AJAX request by the browser:
<http://www.trustedsource.org/query/terra.cl>
...if you view this page with **Javascript disab... | 2009/07/23 | [
"https://Stackoverflow.com/questions/1169987",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/52529/"
] | I have NoScript installed and active. Both links show the same content (+/- the google header bar). Therefore, the Google cache shows only what is statically there. | Content that gets loaded immediately (say with a secondary HTTP request as in your example after the initial pageload) is usually visible to the search engine crawler.
However, if you have content that beyond this gets loaded via ajax following a user action, e.g. clicking a tab or button and such, won't be seen or in... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.