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 |
|---|---|---|---|---|---|
269,105 | I am trying to implement a ***Left shift/ Right Shift on arrays***.
I was able to accomplish this using double loops.
Can the efficiency be improved?
This is the working code for LeftShift/RightShift which is using 2 nested loops.
```
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
struct Array
{
in... | 2021/10/18 | [
"https://codereview.stackexchange.com/questions/269105",
"https://codereview.stackexchange.com",
"https://codereview.stackexchange.com/users/231559/"
] | You know, C and C++ are different languages. You used both tags, and your code is confused as to which it wants to be. It appears to use C syntax, library calls, and ways of doing things; but it includes a C++ header. It doesn't seem to use that header though. Maybe this is the current state of the file after you have ... | The fastest way is to use `memmove()` and `memset()`, because as library routines they should be optimal. But if you can't do that for whatever reason, your best speed-up is from moving to using pointers. Looping over arrays with indexing is *never* optimal speed-wise (although it has obvious advantages for code readab... |
269,105 | I am trying to implement a ***Left shift/ Right Shift on arrays***.
I was able to accomplish this using double loops.
Can the efficiency be improved?
This is the working code for LeftShift/RightShift which is using 2 nested loops.
```
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
struct Array
{
in... | 2021/10/18 | [
"https://codereview.stackexchange.com/questions/269105",
"https://codereview.stackexchange.com",
"https://codereview.stackexchange.com/users/231559/"
] | Why do you have the following line if you are not using `temp`?
```c
int temp = arr->A[0];
```
You do not need the nested loops. You are currently shifting the elements one position at a time when you can move them `n` positions.
```c
void LeftShift1(struct Array* arr, unsigned int n) {
for (unsigned int i = 0;... | You can use `memmove()` function to move overlapping areas of memory and `memset()` to clear the moved items.
LeftShift can be implemented like:
```c
#include <string.h>
void LeftShift(struct Array *arr, int n) //n is the number of shifts
{
memmove(&arr->A[0], &arr->A[n], (arr->size-n)*sizeof(arr->A[0]));
... |
269,105 | I am trying to implement a ***Left shift/ Right Shift on arrays***.
I was able to accomplish this using double loops.
Can the efficiency be improved?
This is the working code for LeftShift/RightShift which is using 2 nested loops.
```
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
struct Array
{
in... | 2021/10/18 | [
"https://codereview.stackexchange.com/questions/269105",
"https://codereview.stackexchange.com",
"https://codereview.stackexchange.com/users/231559/"
] | >
>
> ```
> #include <iostream>
> #include <stdlib.h>
> #include <stdio.h>
>
> ```
>
>
If this is C, don't attempt to include `<iostream>`. If it's C++, use the C++ headers (`<cstdlib>` etc), and prefer `<iostream>` to `<stdio.h>`. There's almost never any need for an *implementation* file to be bilingual C and C... | The fastest way is to use `memmove()` and `memset()`, because as library routines they should be optimal. But if you can't do that for whatever reason, your best speed-up is from moving to using pointers. Looping over arrays with indexing is *never* optimal speed-wise (although it has obvious advantages for code readab... |
269,105 | I am trying to implement a ***Left shift/ Right Shift on arrays***.
I was able to accomplish this using double loops.
Can the efficiency be improved?
This is the working code for LeftShift/RightShift which is using 2 nested loops.
```
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
struct Array
{
in... | 2021/10/18 | [
"https://codereview.stackexchange.com/questions/269105",
"https://codereview.stackexchange.com",
"https://codereview.stackexchange.com/users/231559/"
] | You can use `memmove()` function to move overlapping areas of memory and `memset()` to clear the moved items.
LeftShift can be implemented like:
```c
#include <string.h>
void LeftShift(struct Array *arr, int n) //n is the number of shifts
{
memmove(&arr->A[0], &arr->A[n], (arr->size-n)*sizeof(arr->A[0]));
... | >
>
> ```
> #include <iostream>
> #include <stdlib.h>
> #include <stdio.h>
>
> ```
>
>
If this is C, don't attempt to include `<iostream>`. If it's C++, use the C++ headers (`<cstdlib>` etc), and prefer `<iostream>` to `<stdio.h>`. There's almost never any need for an *implementation* file to be bilingual C and C... |
269,105 | I am trying to implement a ***Left shift/ Right Shift on arrays***.
I was able to accomplish this using double loops.
Can the efficiency be improved?
This is the working code for LeftShift/RightShift which is using 2 nested loops.
```
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
struct Array
{
in... | 2021/10/18 | [
"https://codereview.stackexchange.com/questions/269105",
"https://codereview.stackexchange.com",
"https://codereview.stackexchange.com/users/231559/"
] | Why do you have the following line if you are not using `temp`?
```c
int temp = arr->A[0];
```
You do not need the nested loops. You are currently shifting the elements one position at a time when you can move them `n` positions.
```c
void LeftShift1(struct Array* arr, unsigned int n) {
for (unsigned int i = 0;... | The code doesn't check if `n` is within the expected boundaries of the array. Unintentional overwriting of memory is such an infamous concern in C/C++, even in toy code I would add the range check to build good habits, or at the very least document in a comment that the caller is assumed to be trusted. |
258,547 | I am trying to get an app I've been working hard on ready in the Google Play store, and recently ran into an error similar to the one described here:
[Unable to deactivate APK accidentally uploaded to Prod](https://stackoverflow.com/questions/17006165/unable-to-deactivate-apk-accidentally-uploaded-to-prod)
I just had... | 2014/06/05 | [
"https://meta.stackoverflow.com/questions/258547",
"https://meta.stackoverflow.com",
"https://meta.stackoverflow.com/users/2171147/"
] | I suspect folks interpreted this as a customer support issue - which is fair, given the author admitted he tried to post it in Google's support forums first.
But I'm not sure it is. Unlike the ever-irritating "why was my app rejected?" questions, this appears to be a straight forward tool-usage question, one that *cou... | Off topic means more than just 'the general thing this question was asking about is not acceptable'. There are various reasons, including things like the OP didn't provide enough info to answer the question.
In this case, I bet this was a "Too Localized" (since it doesn't display which reason, I suspect it's one of th... |
37,149 | I'm looking for a way that I can convert several thousand .xml files into .csv. I've had no problems doing so in small quantities, but the data that I am dealing with is within several thousand folders. More specifically, I am looking at MLB game data over the course of a single season. Each game has its own separate f... | 2016/10/26 | [
"https://softwarerecs.stackexchange.com/questions/37149",
"https://softwarerecs.stackexchange.com",
"https://softwarerecs.stackexchange.com/users/27475/"
] | You haven't said anything about your technology constraints, but
(a) converting XML to CSV is easily done with any XSLT processor
(b) XSLT 2.0 processors such as [Saxon](http://saxon.sourceforge.net/) typically have the ability to process multiple files in directory structures using the collection() or uri-collection... | I would suggest using [python](http://www.python.org) with the built in [os.walk](https://docs.python.org/3/library/os.html?highlight=walk#os.walk), [csv](https://docs.python.org/3/library/csv.html?highlight=csv) and xml parse libraries such as [expat](https://docs.python.org/3/library/pyexpat.html?highlight=xml).
* F... |
31,745,986 | I want to check the array has the value other than **0000-00-00 00:00:00** in php
```
Array ( [0] => 0000-00-00 00:00:00
[1] => 2015-07-31 12:43:02
[2] => 0000-00-00 00:00:00
[3] => 0000-00-00 00:00:00 )
```
**2015-07-31 12:43:02** time may be change to any time | 2015/07/31 | [
"https://Stackoverflow.com/questions/31745986",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4120426/"
] | You could loop over the array and test each value against the bad date and if it is not bad then do whatever you want to do with it.
```
$found_good = false;
foreach ( $arr as $i => $v ) {
if ( $v != '0000-00-00 00:00:00' ) {
$found_good = true;
echo "array[$i] has the valid date $v\n";
}
}
``` | Use `array_filter`:
Here is your array:
```
$items = [
0 => '0000-00-00 00:00:00'
1 => '2015-07-31 12:43:02'
2 => '0000-00-00 00:00:00'
3 => '0000-00-00 00:00:00'
];
```
Here is how you might use count with `array_filter` to solve your problem:
```
if (count(array_filter($items, function($v) { retu... |
31,745,986 | I want to check the array has the value other than **0000-00-00 00:00:00** in php
```
Array ( [0] => 0000-00-00 00:00:00
[1] => 2015-07-31 12:43:02
[2] => 0000-00-00 00:00:00
[3] => 0000-00-00 00:00:00 )
```
**2015-07-31 12:43:02** time may be change to any time | 2015/07/31 | [
"https://Stackoverflow.com/questions/31745986",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4120426/"
] | You could loop over the array and test each value against the bad date and if it is not bad then do whatever you want to do with it.
```
$found_good = false;
foreach ( $arr as $i => $v ) {
if ( $v != '0000-00-00 00:00:00' ) {
$found_good = true;
echo "array[$i] has the valid date $v\n";
}
}
``` | You can use `in_array`
E.g:
```
$os = array("0000-00-00 00:00:00 ", "2015-07-31 12:43:02", "0000-00-00 00:00:00 ", "0000-00-00 00:00:00");
if (in_array("0000-00-00 00:00:00", $os)) {
echo "Got Value";
}
else {
echo "Got No value";
}
```
To read more about in\_array [click here](http://php.net/manual/en/func... |
31,745,986 | I want to check the array has the value other than **0000-00-00 00:00:00** in php
```
Array ( [0] => 0000-00-00 00:00:00
[1] => 2015-07-31 12:43:02
[2] => 0000-00-00 00:00:00
[3] => 0000-00-00 00:00:00 )
```
**2015-07-31 12:43:02** time may be change to any time | 2015/07/31 | [
"https://Stackoverflow.com/questions/31745986",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4120426/"
] | You could loop over the array and test each value against the bad date and if it is not bad then do whatever you want to do with it.
```
$found_good = false;
foreach ( $arr as $i => $v ) {
if ( $v != '0000-00-00 00:00:00' ) {
$found_good = true;
echo "array[$i] has the valid date $v\n";
}
}
``` | A simple solution without using `array_filter`
```
$arr = array (0 => "0000-00-00 00:00:00",
1=> "2015-07-31 12:43:02" ,
2 => "0000-00-00 00:00:00",
3 => "0000-00-00 00:00:00");
$ccount = count($arr);
$c=0;
foreach($arr as $a=>$b)
{
if(in_array($b, $arr))
$c++;
}
if($ccount == $c)
echo "something pres... |
31,745,986 | I want to check the array has the value other than **0000-00-00 00:00:00** in php
```
Array ( [0] => 0000-00-00 00:00:00
[1] => 2015-07-31 12:43:02
[2] => 0000-00-00 00:00:00
[3] => 0000-00-00 00:00:00 )
```
**2015-07-31 12:43:02** time may be change to any time | 2015/07/31 | [
"https://Stackoverflow.com/questions/31745986",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4120426/"
] | Use `array_filter`:
Here is your array:
```
$items = [
0 => '0000-00-00 00:00:00'
1 => '2015-07-31 12:43:02'
2 => '0000-00-00 00:00:00'
3 => '0000-00-00 00:00:00'
];
```
Here is how you might use count with `array_filter` to solve your problem:
```
if (count(array_filter($items, function($v) { retu... | You can use `in_array`
E.g:
```
$os = array("0000-00-00 00:00:00 ", "2015-07-31 12:43:02", "0000-00-00 00:00:00 ", "0000-00-00 00:00:00");
if (in_array("0000-00-00 00:00:00", $os)) {
echo "Got Value";
}
else {
echo "Got No value";
}
```
To read more about in\_array [click here](http://php.net/manual/en/func... |
31,745,986 | I want to check the array has the value other than **0000-00-00 00:00:00** in php
```
Array ( [0] => 0000-00-00 00:00:00
[1] => 2015-07-31 12:43:02
[2] => 0000-00-00 00:00:00
[3] => 0000-00-00 00:00:00 )
```
**2015-07-31 12:43:02** time may be change to any time | 2015/07/31 | [
"https://Stackoverflow.com/questions/31745986",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4120426/"
] | Use `array_filter`:
Here is your array:
```
$items = [
0 => '0000-00-00 00:00:00'
1 => '2015-07-31 12:43:02'
2 => '0000-00-00 00:00:00'
3 => '0000-00-00 00:00:00'
];
```
Here is how you might use count with `array_filter` to solve your problem:
```
if (count(array_filter($items, function($v) { retu... | A simple solution without using `array_filter`
```
$arr = array (0 => "0000-00-00 00:00:00",
1=> "2015-07-31 12:43:02" ,
2 => "0000-00-00 00:00:00",
3 => "0000-00-00 00:00:00");
$ccount = count($arr);
$c=0;
foreach($arr as $a=>$b)
{
if(in_array($b, $arr))
$c++;
}
if($ccount == $c)
echo "something pres... |
806 | I have a vivid memory of something similar to [Psychohistory](https://en.wikipedia.org/wiki/Psychohistory_%28fictional%29) being used in either a TV show or movie (most likely TV). Earth is taken over by a totalitarian government (or alien), and two characters are debating whether to fight it or not. They had mathemati... | 2011/01/18 | [
"https://scifi.stackexchange.com/questions/806",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/175/"
] | In the Deep Space Nine episode [Statistical Probabilities](http://en.wikipedia.org/wiki/Statistical_Probabilities), Dr Bashir and some other genetically augmented humans "develop a statistical historical model to predict the future". | Michael Flynn has [In the Country of the Blind](http://rads.stackoverflow.com/amzn/click/076534498X). I read it with this huge sense of deja vu. I was sure I had read an excerpt and not remembered reading it.
I found it a very strange read. But intruiging, and somewhat confusing as there are many levels to the story. ... |
806 | I have a vivid memory of something similar to [Psychohistory](https://en.wikipedia.org/wiki/Psychohistory_%28fictional%29) being used in either a TV show or movie (most likely TV). Earth is taken over by a totalitarian government (or alien), and two characters are debating whether to fight it or not. They had mathemati... | 2011/01/18 | [
"https://scifi.stackexchange.com/questions/806",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/175/"
] | In the Deep Space Nine episode [Statistical Probabilities](http://en.wikipedia.org/wiki/Statistical_Probabilities), Dr Bashir and some other genetically augmented humans "develop a statistical historical model to predict the future". | [Psychohistorical Crisis](http://en.wikipedia.org/wiki/Psychohistorical_Crisis) is a novel that takes place in the Foundation universe, but written by another author. |
806 | I have a vivid memory of something similar to [Psychohistory](https://en.wikipedia.org/wiki/Psychohistory_%28fictional%29) being used in either a TV show or movie (most likely TV). Earth is taken over by a totalitarian government (or alien), and two characters are debating whether to fight it or not. They had mathemati... | 2011/01/18 | [
"https://scifi.stackexchange.com/questions/806",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/175/"
] | In the Deep Space Nine episode [Statistical Probabilities](http://en.wikipedia.org/wiki/Statistical_Probabilities), Dr Bashir and some other genetically augmented humans "develop a statistical historical model to predict the future". | In Heinlein's *If This Goes On* (aka *Revolt in 2100*) from 1940, the rebels had advanced psychological skills and constantly monitored the readiness of the general population to accept revolution against the Church of the First Prophet. At one point, they (the rebels) conclude that victory is a long way off (based on ... |
806 | I have a vivid memory of something similar to [Psychohistory](https://en.wikipedia.org/wiki/Psychohistory_%28fictional%29) being used in either a TV show or movie (most likely TV). Earth is taken over by a totalitarian government (or alien), and two characters are debating whether to fight it or not. They had mathemati... | 2011/01/18 | [
"https://scifi.stackexchange.com/questions/806",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/175/"
] | Michael Flynn has [In the Country of the Blind](http://rads.stackoverflow.com/amzn/click/076534498X). I read it with this huge sense of deja vu. I was sure I had read an excerpt and not remembered reading it.
I found it a very strange read. But intruiging, and somewhat confusing as there are many levels to the story. ... | In Heinlein's *If This Goes On* (aka *Revolt in 2100*) from 1940, the rebels had advanced psychological skills and constantly monitored the readiness of the general population to accept revolution against the Church of the First Prophet. At one point, they (the rebels) conclude that victory is a long way off (based on ... |
806 | I have a vivid memory of something similar to [Psychohistory](https://en.wikipedia.org/wiki/Psychohistory_%28fictional%29) being used in either a TV show or movie (most likely TV). Earth is taken over by a totalitarian government (or alien), and two characters are debating whether to fight it or not. They had mathemati... | 2011/01/18 | [
"https://scifi.stackexchange.com/questions/806",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/175/"
] | [Psychohistorical Crisis](http://en.wikipedia.org/wiki/Psychohistorical_Crisis) is a novel that takes place in the Foundation universe, but written by another author. | In Heinlein's *If This Goes On* (aka *Revolt in 2100*) from 1940, the rebels had advanced psychological skills and constantly monitored the readiness of the general population to accept revolution against the Church of the First Prophet. At one point, they (the rebels) conclude that victory is a long way off (based on ... |
88,307 | I've created a CPT, added capabilities to it and them to the Subscriber role successfully.
However the mapping is clearly not working because I get errors on publish and a Subscriber cannot edit their own posts (which the function below allows if they are the author). Why won't my map\_meta\_cap function work?
I've ... | 2013/02/25 | [
"https://wordpress.stackexchange.com/questions/88307",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/18726/"
] | Turns out it's a real bad idea to map your own meta capabilities. To solve this problem I ended up going through the steps you would with a map\_meta\_cap function with TWO plugins.
Use [[Map Cap]](http://wordpress.org/extend/plugins/map-cap/) to automatically map the meta capabilities of my new custom post type to my... | For anyone also struggling with this issue, there is an awesome tutorial that clearly explains how to do it without relying on plugins: <https://3.7designs.co/blog/2014/08/restricting-access-to-custom-post-types-using-roles-in-wordpress/>
If you need to create a new role, you must do it on your activation hook using t... |
9,664,904 | I'd like to copy some files from a production bucket to a development bucket daily.
For example:
Copy productionbucket/feed/feedname/date
to developmentbucket/feed/feedname/date
Because the files I want are so deep in the folder structure, it's too time consuming to go to each folder and copy/paste.
I've played arou... | 2012/03/12 | [
"https://Stackoverflow.com/questions/9664904",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55900/"
] | To move/copy from one bucket to another or the same bucket I use s3cmd tool and works fine. For instance:
```
s3cmd cp --recursive s3://bucket1/directory1 s3://bucket2/directory1
s3cmd mv --recursive s3://bucket1/directory1 s3://bucket2/directory1
``` | We had this exact problem with our ETL jobs at [Snowplow](http://snowplowanalytics.com), so we extracted our parallel file-copy code (Ruby, built on top of [Fog](http://fog.io/1.7.0/)), into its own Ruby gem, called Sluice:
<https://github.com/snowplow/sluice>
Sluice also handles S3 file delete, move and download; al... |
9,664,904 | I'd like to copy some files from a production bucket to a development bucket daily.
For example:
Copy productionbucket/feed/feedname/date
to developmentbucket/feed/feedname/date
Because the files I want are so deep in the folder structure, it's too time consuming to go to each folder and copy/paste.
I've played arou... | 2012/03/12 | [
"https://Stackoverflow.com/questions/9664904",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55900/"
] | If you're working in Python you can use [`cloudpathlib`](https://cloudpathlib.drivendata.org/stable/), which wraps `boto3` to copy from one bucket to another.
Because it uses the [AWS copy operation](https://docs.aws.amazon.com/AmazonS3/latest/userguide/copy-object.html) when going from an S3 source to an S3 target, i... | For new version aws2.
```
aws2 s3 sync s3://SOURCE_BUCKET_NAME s3://NEW_BUCKET_NAME
``` |
9,664,904 | I'd like to copy some files from a production bucket to a development bucket daily.
For example:
Copy productionbucket/feed/feedname/date
to developmentbucket/feed/feedname/date
Because the files I want are so deep in the folder structure, it's too time consuming to go to each folder and copy/paste.
I've played arou... | 2012/03/12 | [
"https://Stackoverflow.com/questions/9664904",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55900/"
] | The new official [AWS CLI](http://aws.amazon.com/cli/) natively supports most of the functionality of `s3cmd`. I'd previously been using `s3cmd` or the ruby AWS SDK to do things like this, but the official CLI works great for this.
<http://docs.aws.amazon.com/cli/latest/reference/s3/sync.html>
```
aws s3 sync s3://ol... | We had this exact problem with our ETL jobs at [Snowplow](http://snowplowanalytics.com), so we extracted our parallel file-copy code (Ruby, built on top of [Fog](http://fog.io/1.7.0/)), into its own Ruby gem, called Sluice:
<https://github.com/snowplow/sluice>
Sluice also handles S3 file delete, move and download; al... |
9,664,904 | I'd like to copy some files from a production bucket to a development bucket daily.
For example:
Copy productionbucket/feed/feedname/date
to developmentbucket/feed/feedname/date
Because the files I want are so deep in the folder structure, it's too time consuming to go to each folder and copy/paste.
I've played arou... | 2012/03/12 | [
"https://Stackoverflow.com/questions/9664904",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55900/"
] | For me the following command just worked:
```
aws s3 mv s3://bucket/data s3://bucket/old_data --recursive
``` | If you have a unix host within AWS, then use s3cmd from s3tools.org. Set up permissions so that your key as read access to your development bucket. Then run:
```
s3cmd cp -r s3://productionbucket/feed/feedname/date s3://developmentbucket/feed/feedname
``` |
9,664,904 | I'd like to copy some files from a production bucket to a development bucket daily.
For example:
Copy productionbucket/feed/feedname/date
to developmentbucket/feed/feedname/date
Because the files I want are so deep in the folder structure, it's too time consuming to go to each folder and copy/paste.
I've played arou... | 2012/03/12 | [
"https://Stackoverflow.com/questions/9664904",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55900/"
] | The new official [AWS CLI](http://aws.amazon.com/cli/) natively supports most of the functionality of `s3cmd`. I'd previously been using `s3cmd` or the ruby AWS SDK to do things like this, but the official CLI works great for this.
<http://docs.aws.amazon.com/cli/latest/reference/s3/sync.html>
```
aws s3 sync s3://ol... | Actually as of recently I just use the copy+paste action in the AWS s3 interface. Just navigate to the files you want to copy, click on "Actions" -> "Copy" then navigate to the destination bucket and "Actions" -> "Paste"
It transfers the files pretty quick and it seems like a less convoluted solution that doesn't requ... |
9,664,904 | I'd like to copy some files from a production bucket to a development bucket daily.
For example:
Copy productionbucket/feed/feedname/date
to developmentbucket/feed/feedname/date
Because the files I want are so deep in the folder structure, it's too time consuming to go to each folder and copy/paste.
I've played arou... | 2012/03/12 | [
"https://Stackoverflow.com/questions/9664904",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55900/"
] | I spent days writing my own custom tool to parallelize the copies required for this, but then I ran across documentation on [how to get the AWS S3 CLI sync command to synchronize buckets with massive parallelization](http://docs.aws.amazon.com/cli/latest/topic/s3-config.html). The following commands will tell the AWS C... | If you have a unix host within AWS, then use s3cmd from s3tools.org. Set up permissions so that your key as read access to your development bucket. Then run:
```
s3cmd cp -r s3://productionbucket/feed/feedname/date s3://developmentbucket/feed/feedname
``` |
9,664,904 | I'd like to copy some files from a production bucket to a development bucket daily.
For example:
Copy productionbucket/feed/feedname/date
to developmentbucket/feed/feedname/date
Because the files I want are so deep in the folder structure, it's too time consuming to go to each folder and copy/paste.
I've played arou... | 2012/03/12 | [
"https://Stackoverflow.com/questions/9664904",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55900/"
] | .NET Example as requested:
```cs
using (client)
{
var existingObject = client.ListObjects(requestForExisingFile).S3Objects;
if (existingObject.Count == 1)
{
var requestCopyObject = new CopyObjectRequest()
{
SourceBucket = BucketNameProd,
SourceKey = objectToMerge.Ke... | For new version aws2.
```
aws2 s3 sync s3://SOURCE_BUCKET_NAME s3://NEW_BUCKET_NAME
``` |
9,664,904 | I'd like to copy some files from a production bucket to a development bucket daily.
For example:
Copy productionbucket/feed/feedname/date
to developmentbucket/feed/feedname/date
Because the files I want are so deep in the folder structure, it's too time consuming to go to each folder and copy/paste.
I've played arou... | 2012/03/12 | [
"https://Stackoverflow.com/questions/9664904",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55900/"
] | I spent days writing my own custom tool to parallelize the copies required for this, but then I ran across documentation on [how to get the AWS S3 CLI sync command to synchronize buckets with massive parallelization](http://docs.aws.amazon.com/cli/latest/topic/s3-config.html). The following commands will tell the AWS C... | Here is a ruby class for performing this: <https://gist.github.com/4080793>
Example usage:
```
$ gem install aws-sdk
$ irb -r ./bucket_sync_service.rb
> from_creds = {aws_access_key_id:"XXX",
aws_secret_access_key:"YYY",
bucket:"first-bucket"}
> to_creds = {aws_access_key_id:"ZZZ",
... |
9,664,904 | I'd like to copy some files from a production bucket to a development bucket daily.
For example:
Copy productionbucket/feed/feedname/date
to developmentbucket/feed/feedname/date
Because the files I want are so deep in the folder structure, it's too time consuming to go to each folder and copy/paste.
I've played arou... | 2012/03/12 | [
"https://Stackoverflow.com/questions/9664904",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55900/"
] | To move/copy from one bucket to another or the same bucket I use s3cmd tool and works fine. For instance:
```
s3cmd cp --recursive s3://bucket1/directory1 s3://bucket2/directory1
s3cmd mv --recursive s3://bucket1/directory1 s3://bucket2/directory1
``` | I would like to add some stuff to this question.
I got an issue while uploading a .gz file with 75GB.
The error was
>
> An error occurred (InvalidArgument) when calling the UploadPart operation: Part number must be an integer between 1 and 10000, inclusive
>
>
>
I did the below changes
```
aws configure set de... |
9,664,904 | I'd like to copy some files from a production bucket to a development bucket daily.
For example:
Copy productionbucket/feed/feedname/date
to developmentbucket/feed/feedname/date
Because the files I want are so deep in the folder structure, it's too time consuming to go to each folder and copy/paste.
I've played arou... | 2012/03/12 | [
"https://Stackoverflow.com/questions/9664904",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55900/"
] | To move/copy from one bucket to another or the same bucket I use s3cmd tool and works fine. For instance:
```
s3cmd cp --recursive s3://bucket1/directory1 s3://bucket2/directory1
s3cmd mv --recursive s3://bucket1/directory1 s3://bucket2/directory1
``` | Here is a ruby class for performing this: <https://gist.github.com/4080793>
Example usage:
```
$ gem install aws-sdk
$ irb -r ./bucket_sync_service.rb
> from_creds = {aws_access_key_id:"XXX",
aws_secret_access_key:"YYY",
bucket:"first-bucket"}
> to_creds = {aws_access_key_id:"ZZZ",
... |
30,194,440 | Does anyone know how do i generate a new random number so i can store them into different variables? (into temp1 and temp2) I want the program to rerun the "randomnumber" function each time for each new variable so i can store the new random value into them.
```js
<HTML>
<!Foundation Page for building our Javascript... | 2015/05/12 | [
"https://Stackoverflow.com/questions/30194440",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4794283/"
] | You could do *two* slices.
```
>>> l = [1, 2, 3, 4, 5, 6]
>>> l[start:][:length]
[3, 4, 5]
```
It's only 3 additional characters, although it's relatively expensive, computationally, since an extra intermediate object needs to be created for the second slice operation.
(If this were Perl, `:][:` could be considered... | You can do this
```
>>> l[2:5]
[3, 4, 5]
```
Or more generally, if you know the start index and length of the slice
```
def sliceToLength(l, at, size):
return l[at: at+size]
>>> sliceToLength(l, 2, 3)
[3, 4, 5]
``` |
50,309,470 | Attempting to make an array of 2d points.
```
import random
import numpy as np
world_x=500
world_y=500
num_points = 7
points_list = []
def fill_points():
for i in range(num_points):
points_list.append(random.randrange(-1*world_x,world_x+1))
points_list.append(random.randrange(-1*world_y,world_y+... | 2018/05/12 | [
"https://Stackoverflow.com/questions/50309470",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4755622/"
] | The `.reshape` method *returns a new array object*, that is, it doesn't work in-place. You can either reassign the results of `reshape` back to the same variable, or modify the `.shape` attribute directly, which does work in-place:
```
In [1]: import numpy as np
In [2]: arr = np.arange(10)
In [3]: arr
Out[3]: array(... | It looks like you want to keep the x and y cords together, try adding them as a list. E.g.:
```
import random
import numpy as np
world_x=500
world_y=500
num_points = 7
points_list = []
def fill_points():
for i in range(num_points):
points_list.append([random.randrange(-1*world_x,world_x+1),
... |
16,259,506 | Is it possible to mimic the behavior of dynamic allocation using the following code. For example we do not know the exact number of the integer that are stored in a file and we are going to read the file and then store it in an array called Hello.
```
int x;
int n=0;
ifstream input("a.dat");
while (!input.eof())
{
... | 2013/04/28 | [
"https://Stackoverflow.com/questions/16259506",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2328291/"
] | >
> Is it possible to mimic the behavior of dynamic allocation using the
> following code.
>
>
>
No, the major difference is that the array in your program is stored on stack, whereas all dynamic memory allocations takes place on heap.
What you are exactly doing, in your code is using the VLA feature of C99 stan... | ```
int Hello[n];
```
is **NOT** `dynamic` allocation. It is required that `n` is a compile time constant if you want to declare `Hello` in this way.
try:
```
int* Hello = new int[n];
```
and don't forget to release the memory when you are done using it:
```
delete[] Hello;
``` |
16,259,506 | Is it possible to mimic the behavior of dynamic allocation using the following code. For example we do not know the exact number of the integer that are stored in a file and we are going to read the file and then store it in an array called Hello.
```
int x;
int n=0;
ifstream input("a.dat");
while (!input.eof())
{
... | 2013/04/28 | [
"https://Stackoverflow.com/questions/16259506",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2328291/"
] | ```
int Hello[n];
```
is **NOT** `dynamic` allocation. It is required that `n` is a compile time constant if you want to declare `Hello` in this way.
try:
```
int* Hello = new int[n];
```
and don't forget to release the memory when you are done using it:
```
delete[] Hello;
``` | For a start the second
```
while (!input.eof())
```
Will always fail. That terminated the first one and then you set about closing that input stream! |
16,259,506 | Is it possible to mimic the behavior of dynamic allocation using the following code. For example we do not know the exact number of the integer that are stored in a file and we are going to read the file and then store it in an array called Hello.
```
int x;
int n=0;
ifstream input("a.dat");
while (!input.eof())
{
... | 2013/04/28 | [
"https://Stackoverflow.com/questions/16259506",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2328291/"
] | >
> Is it possible to mimic the behavior of dynamic allocation using the
> following code.
>
>
>
No, the major difference is that the array in your program is stored on stack, whereas all dynamic memory allocations takes place on heap.
What you are exactly doing, in your code is using the VLA feature of C99 stan... | This is allowed as an extension by some compilers, but is not strictly part of C++.
```
int Hello[n];
```
As an alternative, you can allocate the memory yourself:
```
int* Hello = new int[n];
```
And free it yourself also:
```
delete[] Hello;
```
But you can avoid manual memory management by usng `std::vector`... |
16,259,506 | Is it possible to mimic the behavior of dynamic allocation using the following code. For example we do not know the exact number of the integer that are stored in a file and we are going to read the file and then store it in an array called Hello.
```
int x;
int n=0;
ifstream input("a.dat");
while (!input.eof())
{
... | 2013/04/28 | [
"https://Stackoverflow.com/questions/16259506",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2328291/"
] | This is allowed as an extension by some compilers, but is not strictly part of C++.
```
int Hello[n];
```
As an alternative, you can allocate the memory yourself:
```
int* Hello = new int[n];
```
And free it yourself also:
```
delete[] Hello;
```
But you can avoid manual memory management by usng `std::vector`... | For a start the second
```
while (!input.eof())
```
Will always fail. That terminated the first one and then you set about closing that input stream! |
16,259,506 | Is it possible to mimic the behavior of dynamic allocation using the following code. For example we do not know the exact number of the integer that are stored in a file and we are going to read the file and then store it in an array called Hello.
```
int x;
int n=0;
ifstream input("a.dat");
while (!input.eof())
{
... | 2013/04/28 | [
"https://Stackoverflow.com/questions/16259506",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2328291/"
] | >
> Is it possible to mimic the behavior of dynamic allocation using the
> following code.
>
>
>
No, the major difference is that the array in your program is stored on stack, whereas all dynamic memory allocations takes place on heap.
What you are exactly doing, in your code is using the VLA feature of C99 stan... | For a start the second
```
while (!input.eof())
```
Will always fail. That terminated the first one and then you set about closing that input stream! |
6,476,746 | I have an app (for Honeycomb) with a main activity that shows a sort of dashboard, with three buttons and a title. When the user clicks a button they are taken to a screen where they can enter data and do a calculation. I would like to have two approaches to the calculation in this second ('calculator') activity, and w... | 2011/06/25 | [
"https://Stackoverflow.com/questions/6476746",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/688573/"
] | You can write action script class and use [as3sip](http://code.google.com/p/as3sip/) library to serve your purpose . | I slept on it and that's my "final answer":
You can't accept incoming connections in flash, thus you'd need a special proxy keeping the signaling connection alive and assisting in symmetric RTP. The required infrastructure is not much different from running the SIP UA on the server, and passing the media streams to the... |
68,064 | I was planning on using ray casting for collision detection in my game. However, when I use an attack similar to this:

(which would project something like a cylinder), how would I go about detecting if it hits the other player? | 2013/12/30 | [
"https://gamedev.stackexchange.com/questions/68064",
"https://gamedev.stackexchange.com",
"https://gamedev.stackexchange.com/users/40151/"
] | I think this is what you want:
[Physics.SphereCast](http://docs.unity3d.com/Documentation/ScriptReference/Physics.SphereCast.html)
From the docs:
>
> Casts a sphere against all colliders in the scene and
> returns detailed information on what was hit.
>
>
> This is useful when a Raycast does not give enough prec... | This is typically done with multiple raycasts. The game design dictates the exact pattern needed but a simple one is to just do 4 or so casts at equal distances along the surface of the cylinder. Do all the tests, collect all their results, then take the hit with the shortest distance. Avoid overly small or narrow obje... |
68,064 | I was planning on using ray casting for collision detection in my game. However, when I use an attack similar to this:

(which would project something like a cylinder), how would I go about detecting if it hits the other player? | 2013/12/30 | [
"https://gamedev.stackexchange.com/questions/68064",
"https://gamedev.stackexchange.com",
"https://gamedev.stackexchange.com/users/40151/"
] | I think this is what you want:
[Physics.SphereCast](http://docs.unity3d.com/Documentation/ScriptReference/Physics.SphereCast.html)
From the docs:
>
> Casts a sphere against all colliders in the scene and
> returns detailed information on what was hit.
>
>
> This is useful when a Raycast does not give enough prec... | Transform key points (see below) of the other player's body into the object space of the cylinder.
Then check whether any of them fall within the axis-aligned bounding box of the cylinder.
If so, then check whether they fall within the cylinder, by checking radial distance from cylinder's axial centre.
Key points t... |
1,474,787 | So I have an application which has a .NET API available. Their API library communicates with their main application through .NET remoting calls. In order to use the API, the application must be up and running already.
So, I have an instance where I need to programmatically start the application and then instantiate on... | 2009/09/25 | [
"https://Stackoverflow.com/questions/1474787",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/160359/"
] | Try this:
```
using System.Net.NetworkInformation;
using System.Net;
private static bool IsPortAvailable(int port)
{
IPGlobalProperties globalProperties = IPGlobalProperties.GetIPGlobalProperties();
IPEndPoint[] activeListeners = globalProperties.GetActiveTcpListeners();
if (activeListeners.A... | Just to get out of the box for a moment, have you thought about using WCF with MSMQ? I am not sure that I fully understand you're architecture, but it sounds like the client of the API has to spin up another process that hosts the API. There may be a timing issue between when you start the API host, and when the client... |
1,474,787 | So I have an application which has a .NET API available. Their API library communicates with their main application through .NET remoting calls. In order to use the API, the application must be up and running already.
So, I have an instance where I need to programmatically start the application and then instantiate on... | 2009/09/25 | [
"https://Stackoverflow.com/questions/1474787",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/160359/"
] | Try this:
```
using System.Net.NetworkInformation;
using System.Net;
private static bool IsPortAvailable(int port)
{
IPGlobalProperties globalProperties = IPGlobalProperties.GetIPGlobalProperties();
IPEndPoint[] activeListeners = globalProperties.GetActiveTcpListeners();
if (activeListeners.A... | Have you considered wrapping the attempt to instantiate API object into a try-catch block? Then you can analyze the exception and see if it was caused by the server not listening. And if it was, you can just wait and retry.
Makes sense? |
1,474,787 | So I have an application which has a .NET API available. Their API library communicates with their main application through .NET remoting calls. In order to use the API, the application must be up and running already.
So, I have an instance where I need to programmatically start the application and then instantiate on... | 2009/09/25 | [
"https://Stackoverflow.com/questions/1474787",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/160359/"
] | Try this:
```
using System.Net.NetworkInformation;
using System.Net;
private static bool IsPortAvailable(int port)
{
IPGlobalProperties globalProperties = IPGlobalProperties.GetIPGlobalProperties();
IPEndPoint[] activeListeners = globalProperties.GetActiveTcpListeners();
if (activeListeners.A... | Just a small typo in the code.
Correction is as follows:
```cs
using System.Net.NetworkInformation;
using System.Net;
private static bool IsPortAvailable(int port)
{
IPGlobalProperties globalProperties = IPGlobalProperties.GetIPGlobalProperties();
IPEndPoint[] activeListeners = globalProperties.GetActiveT... |
1,474,787 | So I have an application which has a .NET API available. Their API library communicates with their main application through .NET remoting calls. In order to use the API, the application must be up and running already.
So, I have an instance where I need to programmatically start the application and then instantiate on... | 2009/09/25 | [
"https://Stackoverflow.com/questions/1474787",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/160359/"
] | Try this:
```
using System.Net.NetworkInformation;
using System.Net;
private static bool IsPortAvailable(int port)
{
IPGlobalProperties globalProperties = IPGlobalProperties.GetIPGlobalProperties();
IPEndPoint[] activeListeners = globalProperties.GetActiveTcpListeners();
if (activeListeners.A... | When you register a IpcServerChannel it makes a Named Pipe to communicate over with the name of the Port Name you chose for your IpcServerChannel. You can look at the list of Named Pipes to see if your Port Name is there.
```
System.IO.Directory.GetFiles(@"\\.\pipe\").Any((path) => path.Contains(@"\\.\pipe\" + pipeNam... |
7,943 | We have a site which is using the ip of the client machine to determine location for display on the home page
Has anyone got any idea how we test this from a fixed office, on a corporate network? | 2014/03/05 | [
"https://sqa.stackexchange.com/questions/7943",
"https://sqa.stackexchange.com",
"https://sqa.stackexchange.com/users/6977/"
] | Ideally I'd want dev to set a different private subnet to each supported location then change the private IP of the test computer for each location to test when creating the product. If necessary this could be enabled or disable in a config file (have a qa/production config option similar to debug).
This would allow y... | I would take a look at [scapy](http://www.secdev.org/projects/scapy/) which is a [python](http://python.org) library that allows you to construct packets that lie about the originating IP address, (and much more). |
47,589,816 | I’m a student who is (trying) to write a python implementation of Dykstra’s Algorithm. I know this question has been asked 100 times before, but there are some specifics of my situation I’m not fully understanding.
I have a weighted, non-directed graph with 10 nodes. My actual graph will have many more nodes. The gra... | 2017/12/01 | [
"https://Stackoverflow.com/questions/47589816",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9025541/"
] | Using [`count`](http://php.net/count) on an array in PHP requires these steps:
1. Execute an SQL query
2. Have the database filter the correct data
3. Send all the data from the database over the wire to PHP
4. Have PHP process the data from the database into an array
5. Have PHP count the array
Whereas a [`COUNT`](h... | I think you already have the answer. First, you have to make a query to MySQL. If you only need the count of the active users, and not the data itself, using
```
SELECT COUNT(1) FROM TABLE WHERE ...
```
is the fastest way to get the count from the database. But, if you are doing a second query to get the suspended ... |
37,431,444 | When writing `redux-thunk` functions, known as *thunks* there is allot of boilerplate that could be easily abstracted away. For example in most of our async API calls we are doing the following, without any side-effects:
```
export const LOGIN_REQUEST = 'my-app/auth/LOGIN_REQUEST';
export const LOGIN_RECIEVE = 'my-app... | 2016/05/25 | [
"https://Stackoverflow.com/questions/37431444",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/913622/"
] | Redux Thunk lets you inject a custom argument since 2.1.0.
```
const api = createApi() // you would write this function
const store = createStore(
reducer,
applyMiddleware(thunk.withExtraArgument(api))
)
// your action creator:
function fetchUser(id) {
return (dispatch, getState, api) => {
// you can use ap... | Unfortunately, there is no common way in redux community to approach this exact problem. I personally feel that people should not be afraid to write their own custom wrappers around redux to deal with exactly such situations.
I created a library called [redux-tiles](https://github.com/Bloomca/redux-tiles), which actua... |
27,774,036 | Below is json response and I have problems getting `shipping_address` data.
```
{
"orders": [{
"created_at": "2015-01-04T02:20:03+01:00",
"financial_status": "paid",
"id": 384536708,
"total_price": "45.00",
"line_items": [{
"fulfillment_service": "manual",
... | 2015/01/05 | [
"https://Stackoverflow.com/questions/27774036",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2113612/"
] | You have to do it manually count on loop like this
```
$count = count($date)-1;
```
then loop through this
```
for ( $i=0;$i <= $count; $i++ ) {
$arrayGenerate[$i] = array(
'row1' => $data[$i].'-'.$requestor[$i].'-'.$die[$i]
);
}
```
like this | Try with -
```
for($i = 0; $i <= count($date); $i ++) {
echo $date[$i]." - ".$requestor[$i]." - ".$die[$i];
}
``` |
27,774,036 | Below is json response and I have problems getting `shipping_address` data.
```
{
"orders": [{
"created_at": "2015-01-04T02:20:03+01:00",
"financial_status": "paid",
"id": 384536708,
"total_price": "45.00",
"line_items": [{
"fulfillment_service": "manual",
... | 2015/01/05 | [
"https://Stackoverflow.com/questions/27774036",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2113612/"
] | You have to do it manually count on loop like this
```
$count = count($date)-1;
```
then loop through this
```
for ( $i=0;$i <= $count; $i++ ) {
$arrayGenerate[$i] = array(
'row1' => $data[$i].'-'.$requestor[$i].'-'.$die[$i]
);
}
```
like this | Assuming the all 3 arrays count/size is same & you want it in this fashion
```
<?php
$a = array('1','2','3');
$b = array('4','5','6');
$c = array('7','8','9');
for($i=0;$i<count($a);$i++)
{
echo $merged_arr_str = $a[$i] . " - " . $b[$i] . " - ". $c[$i] . " <br/>";
}
?>
``` |
27,774,036 | Below is json response and I have problems getting `shipping_address` data.
```
{
"orders": [{
"created_at": "2015-01-04T02:20:03+01:00",
"financial_status": "paid",
"id": 384536708,
"total_price": "45.00",
"line_items": [{
"fulfillment_service": "manual",
... | 2015/01/05 | [
"https://Stackoverflow.com/questions/27774036",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2113612/"
] | You have to do it manually count on loop like this
```
$count = count($date)-1;
```
then loop through this
```
for ( $i=0;$i <= $count; $i++ ) {
$arrayGenerate[$i] = array(
'row1' => $data[$i].'-'.$requestor[$i].'-'.$die[$i]
);
}
```
like this | **You can try this**
**Example One:-**
```
$date = array('date1','date2','date3','date4');
$requestor = array('requestor1','requestor2','requestor3','requestor4');
$die = array('die1','die2','die3','die4');
$count = max(count($date), count($requestor), count($die));
$newarray = array();
for($i=0; $i < $count; $i++) ... |
27,774,036 | Below is json response and I have problems getting `shipping_address` data.
```
{
"orders": [{
"created_at": "2015-01-04T02:20:03+01:00",
"financial_status": "paid",
"id": 384536708,
"total_price": "45.00",
"line_items": [{
"fulfillment_service": "manual",
... | 2015/01/05 | [
"https://Stackoverflow.com/questions/27774036",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2113612/"
] | You have to do it manually count on loop like this
```
$count = count($date)-1;
```
then loop through this
```
for ( $i=0;$i <= $count; $i++ ) {
$arrayGenerate[$i] = array(
'row1' => $data[$i].'-'.$requestor[$i].'-'.$die[$i]
);
}
```
like this | ```
for($i = 0; $i < count($date); $i ++) {
echo $date[$i]." - ".$requestor[$i]." - ".$die[$i];
}
```
this loop will iterat untill last element of date array.if you want to put equal to sign then you have to initialize `$i` with 1.
```
exm. if $i = 0 then $i < count($date)
OR
if $i ... |
28,448,652 | I used nuget to update my project to signalr 2.2 and structure map 2.6.4.
Now when my program attempts to use SignalR, structure map is throwing this error:
```
StructureMap.StructureMapException was unhandled by user code
HResult=-2146232832
Message=StructureMap Exception Code: 202
No Default ... | 2015/02/11 | [
"https://Stackoverflow.com/questions/28448652",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3762481/"
] | This was solved by first looking to resolve in the base class:
```
public override object GetService(Type serviceType)
{
if (serviceType == null)
return null;
var service = base.GetService(serviceType);
if (service != null) return service;
return container.TryGetInstance(serviceType);
}
... | What solved this for me was making a change to the GetService method as well. Here is my full StrucutreMapSignalRDependencyResolver for reference:
```
public class StructureMapSignalRDependencyResolver : DefaultDependencyResolver
{
private readonly IContainer _container;
public StructureMapSignalRDependencyRe... |
66,564,137 | I am currently researching the possibilities of the Google My Business API.
I understand that I need to be an owner/manager of a business/location in order to edit the information. But if I just want to Get the information, such as opening hours, is this possible without being a manager/owner? | 2021/03/10 | [
"https://Stackoverflow.com/questions/66564137",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15367973/"
] | See <https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Image_types>
It's actually not "image/jpg" but "image/jpeg". If you specify non-existent format, the fallback (at least for me) seems to be "image/png". That's why you always got a valid image but with the same filesize. | I *think* this method uses html types:
[html types](https://www.google.com/search?q=html%20image%20types&oq=html%20image%20types&aqs=chrome..69i57j0j0i22i30l4j0i10i22i30j0i22i30l3.4863j0j7&sourceid=chrome&ie=UTF-8)
Try **"image/jpg"**.
Be careful, though, this is a request to the browser, and the browser can send bac... |
11,511,771 | I have a div i want to make it scroll top .
when i set its height to pixel that time i am getting the scroll but when
i am setting it to percent i am not getting scroll
```
<div id="lblAlert" runat="server" class="warning-message" style="overflow:auto" >
// working code
scrollfun()
{
lblAlert.style.height = 65;
... | 2012/07/16 | [
"https://Stackoverflow.com/questions/11511771",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1527247/"
] | try to get height of parent element using
```
var element_Height = $(element).parent().css('height');
```
and calculate scroll height from it using
```
height = (2 / 100) * element_Height;
```
This will give you height to scroll. | Heres my jsFiddle that does what you want <http://jsfiddle.net/F8Qpx/>
```
changeHeight = function (){
var obj = document.getElementById('lblAlert');
var parent = obj.parentNode;
obj.style.height = (parent.offsetHeight/100)*2 + "px";//Make 2%
}
```
This code should work |
30,406 | My text wants me to prove that $e^A$ converges for any $n \times n$ matrix and put a bound on it in terms of $|A|$ and $n$ where $| |$ is the norm induced by identification of $M(n, n)$ with $\mathbb{R}^{n^2}$. I can prove convergence and it's obviously bounded by $e^{|A|}$ but I don't see how to get it in terms of $n$... | 2011/04/01 | [
"https://math.stackexchange.com/questions/30406",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/8830/"
] | Here's a sketch of the way I did this in class (using the norm $||A|| = \max\{|a\_{ij}|\}$ but should still work):
The first step is to show that $||AB|| \leq n||A|||B||$. Then by induction, letting $B = A^{r-1}$, it can be proven that $||A^r|| \leq n^{r-1} ||A||^r$.
Consider the Taylor series $$T\_n(x) = \sum\_{k=0}... | I ripped this from here: <http://www.cis.upenn.edu/~cis610/diffgeom-n.pdf>
If $A = (a\_{ij})$ is an $n\times n$ matrix, and we let $\mu = max \{|a\_{ij}|: 1\leq i,j\leq n\}$, then $|a\_{i,j}^{(p)}| \leq (n\mu)^{p}$ (See link for a proof by induction), where $A^{p} = (a\_{i,j}^{(p)})$. See the link for the rest. Only d... |
31,008,547 | I am writing a code to pull data from a database which removes item columns that contain all NAs. I want R to tell give me the column name of the removed column. I have newdat and newdat1, which is the data before and after removal of the columns that contain NA. Thus, so far I have:
```
> name<-colnames(newdat)
> nam... | 2015/06/23 | [
"https://Stackoverflow.com/questions/31008547",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4941925/"
] | Try :
```
name[!(name %in% name1)]
```
As pointed out, if you want to go both ways (ie some might be in name1 but not name), you need the opposite:
```
name1[!(name1 %in% name)]
```
or to find all differences together:
```
c(name1[!(name1 %in% name)], name[!(name %in% name1)])
``` | As @docendo discimus suggested, use `setdiff`:
```
> name <- c("i5", "i4", "i2", "i3", "i1", "b4", "b3", "b2", "b1")
> name1 <- c("b3", "i5", "i4", "i2", "b2", "b1", "i3", "i1")
> setdiff(name, name1)
[1] "b4"
``` |
60,958 | Overview
--------
I have two Arista 7050SX switches. They don't support stacking. But I essentially will be using them as a stacked pair none the less (just means managing two individual switches).
They're currently connected together via a port channel of two qsfp links. No lacp. Trunk port, native vlan 10
Switch ... | 2019/08/15 | [
"https://networkengineering.stackexchange.com/questions/60958",
"https://networkengineering.stackexchange.com",
"https://networkengineering.stackexchange.com/users/60406/"
] | You have a problem on Switch 1. Your default route is to an address that the switch doesn't know how to reach. The default route should be `ip route 0.0.0.0/0 10.3.104.3`. Switch 2 knows how to reach `172.16.64.1` because it is on a directly connected network, but Switch 1 doesn't know how to reach that network, so the... | The.best way to connect two switches with one uplink by port -channel or ether -channel . Binding two cables into single instance and connect each cable to each switches interfàce and configure it for uplink interfàce .. i
You can reach secondary switch by management ip address . Create management Vlan and configure m... |
49,987 | I have taxonomy vocabulary called “`Groups`”, with 3 terms. I have two content types that both use a `Groups` term reference field. These content types are called “`Media`” and “`Links`”.
When displaying “`Media`” (node), I have an embedded view that shows “`Links`”. How can I only show “`Links`” that have the same te... | 2012/11/08 | [
"https://drupal.stackexchange.com/questions/49987",
"https://drupal.stackexchange.com",
"https://drupal.stackexchange.com/users/5079/"
] | >
> I have ***embed view*** that shows “Links”. How can I only show “Links” that
> have the same terms as the actual “Media”?
>
>
>
I'm not sure you used Entity Views Attach module to attach the View or just placing the View as a block.
Whatever it is, you can do it. But if you have EVA, you will be able to set... | Yes, you can do this using contextual filters. You need to add a *"Content has taxonomy term ID"* contextual filter, and set the default value to *"Taxonomy term ID from URL"* and check *"Load default filter from node page, that's good for related taxonomy blocks"*. now check *"Limit terms by vocabulary"* and select *"... |
1,639 | Some examples of loan words:
* Human names like "Paul" or "Bhavya".
* Proper nouns like "White House" or "United States".
* Using any word at all from the other language ("which" from English, "the", etc., even if the conlang doesn't have these words). Basically this might be like how we use `syntax highlighting` (<- ... | 2022/07/28 | [
"https://conlang.stackexchange.com/questions/1639",
"https://conlang.stackexchange.com",
"https://conlang.stackexchange.com/users/2990/"
] | >
> What I am wondering is what are the different ways you can "safely" import these words into another lang?
>
>
>
In natlangs, the one overarching purpose behind everything in a language is to communicate. If some aspect of the language is getting in the way of this, then evolutionary pressures will remove that ... | Toki Pona, a rather-successful minimalist conlang, has a (IMO) really nice process called [tokiponization](https://www.reddit.com/r/tokipona/wiki/tokiponize).
The steps are these:
1. If possible, it should be avoided. Simply translate things like "White House" or "United States".
2. If that is not possible, find a "he... |
6,464,524 | Imagine I have a list of tuples in this format:
```
(1, 2, 3)
(1, 0, 2)
(3, 9 , 11)
(0, 2, 8)
(2, 3, 4)
(2, 4, 5)
(2, 7, 8)
....
```
How could I sort the list by the first element of the tuples, and then by the second? I'd like to get to this list:
```
(0, 2, 8)
(1, 0, 2)
(1, 2, 3)
(2, 3, 4)
(2, 4, 5)
(2, 7, 8)
(3,... | 2011/06/24 | [
"https://Stackoverflow.com/questions/6464524",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31610/"
] | Why not simply let python sort the list for you ?
```
my_list = [
(1, 2, 3),
(1, 0, 2),
(3, 9 , 11),
(0, 2, 8),
(2, 3, 4),
(2, 4, 5),
(2, 7, 8),
]
print sorted(my_list)
>>>[(0, 2, 8), (1, 0, 2), (1, 2, 3), (2, 3, 4), (2, 4, 5), (2, 7, 8), (3, 9, 11)]
``` | Python automagically does the right thing:
```
>>> a = [(1, 2, 3), (1, 0, 2), (3, 9, 11), (0, 2, 8), (2, 3, 4), (2, 4, 5), (2, 7, 8)]
>>> a.sort()
>>> a
[(0, 2, 8), (1, 0, 2), (1, 2, 3), (2, 3, 4), (2, 4, 5), (2, 7, 8), (3, 9, 11)]
``` |
6,464,524 | Imagine I have a list of tuples in this format:
```
(1, 2, 3)
(1, 0, 2)
(3, 9 , 11)
(0, 2, 8)
(2, 3, 4)
(2, 4, 5)
(2, 7, 8)
....
```
How could I sort the list by the first element of the tuples, and then by the second? I'd like to get to this list:
```
(0, 2, 8)
(1, 0, 2)
(1, 2, 3)
(2, 3, 4)
(2, 4, 5)
(2, 7, 8)
(3,... | 2011/06/24 | [
"https://Stackoverflow.com/questions/6464524",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31610/"
] | Why not simply let python sort the list for you ?
```
my_list = [
(1, 2, 3),
(1, 0, 2),
(3, 9 , 11),
(0, 2, 8),
(2, 3, 4),
(2, 4, 5),
(2, 7, 8),
]
print sorted(my_list)
>>>[(0, 2, 8), (1, 0, 2), (1, 2, 3), (2, 3, 4), (2, 4, 5), (2, 7, 8), (3, 9, 11)]
``` | If you don't mind sorting by *all three* elements, this is really trivial:
```
>>> l = [(1, 2, 3), (1, 0, 2), (3, 9, 11), (0, 2, 8), (2, 3, 4), (2, 4, 5), (2, 7, 8)]
>>> l.sort()
>>> l
[(0, 2, 8), (1, 0, 2), (1, 2, 3), (2, 3, 4), (2, 4, 5), (2, 7, 8), (3, 9, 11)]
``` |
6,464,524 | Imagine I have a list of tuples in this format:
```
(1, 2, 3)
(1, 0, 2)
(3, 9 , 11)
(0, 2, 8)
(2, 3, 4)
(2, 4, 5)
(2, 7, 8)
....
```
How could I sort the list by the first element of the tuples, and then by the second? I'd like to get to this list:
```
(0, 2, 8)
(1, 0, 2)
(1, 2, 3)
(2, 3, 4)
(2, 4, 5)
(2, 7, 8)
(3,... | 2011/06/24 | [
"https://Stackoverflow.com/questions/6464524",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31610/"
] | Why not simply let python sort the list for you ?
```
my_list = [
(1, 2, 3),
(1, 0, 2),
(3, 9 , 11),
(0, 2, 8),
(2, 3, 4),
(2, 4, 5),
(2, 7, 8),
]
print sorted(my_list)
>>>[(0, 2, 8), (1, 0, 2), (1, 2, 3), (2, 3, 4), (2, 4, 5), (2, 7, 8), (3, 9, 11)]
``` | Tuples are already sorted that way.
Try this:
```
#!/usr/bin/python2
l = [
(1, 2, 3),
(1, 0, 2),
(3, 9 , 11),
(0, 2, 8),
(2, 3, 4),
(2, 4, 5),
(2, 7, 8),
]
l.sort()
print l
``` |
6,464,524 | Imagine I have a list of tuples in this format:
```
(1, 2, 3)
(1, 0, 2)
(3, 9 , 11)
(0, 2, 8)
(2, 3, 4)
(2, 4, 5)
(2, 7, 8)
....
```
How could I sort the list by the first element of the tuples, and then by the second? I'd like to get to this list:
```
(0, 2, 8)
(1, 0, 2)
(1, 2, 3)
(2, 3, 4)
(2, 4, 5)
(2, 7, 8)
(3,... | 2011/06/24 | [
"https://Stackoverflow.com/questions/6464524",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31610/"
] | Why not simply let python sort the list for you ?
```
my_list = [
(1, 2, 3),
(1, 0, 2),
(3, 9 , 11),
(0, 2, 8),
(2, 3, 4),
(2, 4, 5),
(2, 7, 8),
]
print sorted(my_list)
>>>[(0, 2, 8), (1, 0, 2), (1, 2, 3), (2, 3, 4), (2, 4, 5), (2, 7, 8), (3, 9, 11)]
``` | ```
>>> x = [
... (1, 2, 3),
... (1, 0, 2),
... (3, 9 , 11),
... (0, 2, 8),
... (2, 3, 4),
... (2, 4, 5),
... (2, 7, 8),
... ]
>>> x.sort()
>>> x
[(0, 2, 8), (1, 0, 2), (1, 2, 3), (2, 3, 4), (2, 4, 5), (2, 7, 8), (3, 9, 11)]
``` |
6,464,524 | Imagine I have a list of tuples in this format:
```
(1, 2, 3)
(1, 0, 2)
(3, 9 , 11)
(0, 2, 8)
(2, 3, 4)
(2, 4, 5)
(2, 7, 8)
....
```
How could I sort the list by the first element of the tuples, and then by the second? I'd like to get to this list:
```
(0, 2, 8)
(1, 0, 2)
(1, 2, 3)
(2, 3, 4)
(2, 4, 5)
(2, 7, 8)
(3,... | 2011/06/24 | [
"https://Stackoverflow.com/questions/6464524",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31610/"
] | Python automagically does the right thing:
```
>>> a = [(1, 2, 3), (1, 0, 2), (3, 9, 11), (0, 2, 8), (2, 3, 4), (2, 4, 5), (2, 7, 8)]
>>> a.sort()
>>> a
[(0, 2, 8), (1, 0, 2), (1, 2, 3), (2, 3, 4), (2, 4, 5), (2, 7, 8), (3, 9, 11)]
``` | If you don't mind sorting by *all three* elements, this is really trivial:
```
>>> l = [(1, 2, 3), (1, 0, 2), (3, 9, 11), (0, 2, 8), (2, 3, 4), (2, 4, 5), (2, 7, 8)]
>>> l.sort()
>>> l
[(0, 2, 8), (1, 0, 2), (1, 2, 3), (2, 3, 4), (2, 4, 5), (2, 7, 8), (3, 9, 11)]
``` |
6,464,524 | Imagine I have a list of tuples in this format:
```
(1, 2, 3)
(1, 0, 2)
(3, 9 , 11)
(0, 2, 8)
(2, 3, 4)
(2, 4, 5)
(2, 7, 8)
....
```
How could I sort the list by the first element of the tuples, and then by the second? I'd like to get to this list:
```
(0, 2, 8)
(1, 0, 2)
(1, 2, 3)
(2, 3, 4)
(2, 4, 5)
(2, 7, 8)
(3,... | 2011/06/24 | [
"https://Stackoverflow.com/questions/6464524",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31610/"
] | Python automagically does the right thing:
```
>>> a = [(1, 2, 3), (1, 0, 2), (3, 9, 11), (0, 2, 8), (2, 3, 4), (2, 4, 5), (2, 7, 8)]
>>> a.sort()
>>> a
[(0, 2, 8), (1, 0, 2), (1, 2, 3), (2, 3, 4), (2, 4, 5), (2, 7, 8), (3, 9, 11)]
``` | Tuples are already sorted that way.
Try this:
```
#!/usr/bin/python2
l = [
(1, 2, 3),
(1, 0, 2),
(3, 9 , 11),
(0, 2, 8),
(2, 3, 4),
(2, 4, 5),
(2, 7, 8),
]
l.sort()
print l
``` |
6,464,524 | Imagine I have a list of tuples in this format:
```
(1, 2, 3)
(1, 0, 2)
(3, 9 , 11)
(0, 2, 8)
(2, 3, 4)
(2, 4, 5)
(2, 7, 8)
....
```
How could I sort the list by the first element of the tuples, and then by the second? I'd like to get to this list:
```
(0, 2, 8)
(1, 0, 2)
(1, 2, 3)
(2, 3, 4)
(2, 4, 5)
(2, 7, 8)
(3,... | 2011/06/24 | [
"https://Stackoverflow.com/questions/6464524",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31610/"
] | Python automagically does the right thing:
```
>>> a = [(1, 2, 3), (1, 0, 2), (3, 9, 11), (0, 2, 8), (2, 3, 4), (2, 4, 5), (2, 7, 8)]
>>> a.sort()
>>> a
[(0, 2, 8), (1, 0, 2), (1, 2, 3), (2, 3, 4), (2, 4, 5), (2, 7, 8), (3, 9, 11)]
``` | ```
>>> x = [
... (1, 2, 3),
... (1, 0, 2),
... (3, 9 , 11),
... (0, 2, 8),
... (2, 3, 4),
... (2, 4, 5),
... (2, 7, 8),
... ]
>>> x.sort()
>>> x
[(0, 2, 8), (1, 0, 2), (1, 2, 3), (2, 3, 4), (2, 4, 5), (2, 7, 8), (3, 9, 11)]
``` |
6,464,524 | Imagine I have a list of tuples in this format:
```
(1, 2, 3)
(1, 0, 2)
(3, 9 , 11)
(0, 2, 8)
(2, 3, 4)
(2, 4, 5)
(2, 7, 8)
....
```
How could I sort the list by the first element of the tuples, and then by the second? I'd like to get to this list:
```
(0, 2, 8)
(1, 0, 2)
(1, 2, 3)
(2, 3, 4)
(2, 4, 5)
(2, 7, 8)
(3,... | 2011/06/24 | [
"https://Stackoverflow.com/questions/6464524",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31610/"
] | Tuples are already sorted that way.
Try this:
```
#!/usr/bin/python2
l = [
(1, 2, 3),
(1, 0, 2),
(3, 9 , 11),
(0, 2, 8),
(2, 3, 4),
(2, 4, 5),
(2, 7, 8),
]
l.sort()
print l
``` | If you don't mind sorting by *all three* elements, this is really trivial:
```
>>> l = [(1, 2, 3), (1, 0, 2), (3, 9, 11), (0, 2, 8), (2, 3, 4), (2, 4, 5), (2, 7, 8)]
>>> l.sort()
>>> l
[(0, 2, 8), (1, 0, 2), (1, 2, 3), (2, 3, 4), (2, 4, 5), (2, 7, 8), (3, 9, 11)]
``` |
6,464,524 | Imagine I have a list of tuples in this format:
```
(1, 2, 3)
(1, 0, 2)
(3, 9 , 11)
(0, 2, 8)
(2, 3, 4)
(2, 4, 5)
(2, 7, 8)
....
```
How could I sort the list by the first element of the tuples, and then by the second? I'd like to get to this list:
```
(0, 2, 8)
(1, 0, 2)
(1, 2, 3)
(2, 3, 4)
(2, 4, 5)
(2, 7, 8)
(3,... | 2011/06/24 | [
"https://Stackoverflow.com/questions/6464524",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31610/"
] | Tuples are already sorted that way.
Try this:
```
#!/usr/bin/python2
l = [
(1, 2, 3),
(1, 0, 2),
(3, 9 , 11),
(0, 2, 8),
(2, 3, 4),
(2, 4, 5),
(2, 7, 8),
]
l.sort()
print l
``` | ```
>>> x = [
... (1, 2, 3),
... (1, 0, 2),
... (3, 9 , 11),
... (0, 2, 8),
... (2, 3, 4),
... (2, 4, 5),
... (2, 7, 8),
... ]
>>> x.sort()
>>> x
[(0, 2, 8), (1, 0, 2), (1, 2, 3), (2, 3, 4), (2, 4, 5), (2, 7, 8), (3, 9, 11)]
``` |
14,674,843 | I have a scroll detail view in which I am displaying some text from a database using Core Text(iPhone and iPad). At the moment my scroll view is a default set length. However as some text entries are longer than others, this means I have a lot of white space underneath the text for some detail views.
Could anyone sugg... | 2013/02/03 | [
"https://Stackoverflow.com/questions/14674843",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/441717/"
] | try this...
```
NSString *text = @"your text from db";
CGSize constraint = CGSizeMake(textview.frame.size.width, 20000.0f);
CGSize size = [text sizeWithFont:[UIFont systemFontOfSize:FONT_SIZE] constrainedToSize:constraint lineBreakMode:UILineBreakModeWordWrap];
textview.frame = CGRectMake(0, 0, size.width, size.hei... | Try something like:
```
float yourDynamicHeight = 0;
for(UILabel *lbl in yourArrayOfLabels) {
yourDynamicHeight += lbl.frame.size.height;
}
// Perhaps add some arbitrary extra height
[yourScrollView setContentSize:CGSizeMake(yourWidth,yourDynamicHeight];
```
Note: Writing this on the go so have not compiled tes... |
25,826,813 | I am developing a software for AVR microcontroller. Saying in fromt, now I only have LEDs and pushbuttons to debug. The problem is that if I pass a string literal into the following function:
```
void test_char(const char *str) {
if (str[0] == -1)
LED_PORT ^= 1 << 7; /* Test */
}
```
Somewhere in `main... | 2014/09/13 | [
"https://Stackoverflow.com/questions/25826813",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2353597/"
] | For speed, hammer now fires paired-down events by default. However, you can reenable event delegation by turning on the domEvents setting like this:
```
$('ul').hammer({domEvents:true}).on("tap", "li", callback);
``` | I asked a similar question with no answer ([Long press (hold) with jquery hammer.js 2 and event delegation](https://stackoverflow.com/questions/25134649/long-press-hold-with-jquery-hammer-js-2-and-event-delegation)).
I ended up checking event target. It's a bit annoying because it means you can't use some of the fanci... |
1,177,545 | >
> For the function $f(x) = \mathrm{e}^x$ on the interval $[0,1]$, by using polynomial interpolation with $x\_0 = 0$, $x\_1 = 1/2$, and $x\_2 = 1$,
> find the upper bound for the magnitude
> $$
> \max\_{0 \leq x \leq 1} |\mathrm{e}^x - p\_2(x)|
> $$
>
>
>
I'm confused on how to solve this. | 2015/03/06 | [
"https://math.stackexchange.com/questions/1177545",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/188423/"
] | The [Tonelli-Shanks](http://en.wikipedia.org/wiki/Tonelli%E2%80%93Shanks_algorithm) and [Cipolla](http://en.wikipedia.org/wiki/Cipolla's_algorithm) algorithms for square-roots can easily be generalized to compute d'th roots in finite fields, e.g. see Adleman; Manders; Miller: [On taking roots in finite fields](http://w... | I haven't yet found an example where $n \not\equiv 1$, $a=3$, and $\gcd(p-1,3) = 1$. So I suspect nontrivial answers only exist when $\gcd(p-1,3) \ne 1$.
When $\gcd(a,p-1) = k \ne 1$, we have $\forall n \not\equiv 0, n^{\frac{a(p-1)}{k}} = \left(n^{\frac{a}{k}}\right)^{p-1} \equiv 1$, so $\forall n \not\equiv 0, \left... |
55,230,659 | I am working on a small web application and I want to make it as clean as possible (without api's or frameworks \* no express).
And as soon I started I've encountered my first problem.
Once I'm rendering a html file using nodejs, the references toward files in general that you call from the inside of the html are "no... | 2019/03/18 | [
"https://Stackoverflow.com/questions/55230659",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9398337/"
] | Your program contains code like this:
```
if(req.url === "/"){
/* send something */
}
else if(req.url === "/feed"){
/* send something else*/
}
else {
/* send an error */
}
```
If you want to send other files (.pngs for example), each of them must appear in that if/else if cascade, or in a switch stateme... | The `<img src=".\Footage\UserTemplateIcon.png">` is not going to work in your HTML because most browsers will not let you load an image over the `file://` protocol.
To fix this, you will need to set up an HTTP endpoint that will serve `\Footage\UserTemplateIcon.png` - this could be the same server as your web applicat... |
55,230,659 | I am working on a small web application and I want to make it as clean as possible (without api's or frameworks \* no express).
And as soon I started I've encountered my first problem.
Once I'm rendering a html file using nodejs, the references toward files in general that you call from the inside of the html are "no... | 2019/03/18 | [
"https://Stackoverflow.com/questions/55230659",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9398337/"
] | The `<img src=".\Footage\UserTemplateIcon.png">` is not going to work in your HTML because most browsers will not let you load an image over the `file://` protocol.
To fix this, you will need to set up an HTTP endpoint that will serve `\Footage\UserTemplateIcon.png` - this could be the same server as your web applicat... | I would **highly reccomend** using express.
The simplest way to allow rendering images is to put them into `public/images` directory.
```js
const express = require('express')
const app = express()
const port = 3000
app.use(express.static(__dirname + '/public'));
app.get('/', (req, res) => {
res.sendFile('index.htm... |
55,230,659 | I am working on a small web application and I want to make it as clean as possible (without api's or frameworks \* no express).
And as soon I started I've encountered my first problem.
Once I'm rendering a html file using nodejs, the references toward files in general that you call from the inside of the html are "no... | 2019/03/18 | [
"https://Stackoverflow.com/questions/55230659",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9398337/"
] | Your program contains code like this:
```
if(req.url === "/"){
/* send something */
}
else if(req.url === "/feed"){
/* send something else*/
}
else {
/* send an error */
}
```
If you want to send other files (.pngs for example), each of them must appear in that if/else if cascade, or in a switch stateme... | I would **highly reccomend** using express.
The simplest way to allow rendering images is to put them into `public/images` directory.
```js
const express = require('express')
const app = express()
const port = 3000
app.use(express.static(__dirname + '/public'));
app.get('/', (req, res) => {
res.sendFile('index.htm... |
40,841 | I am unsure of what I am trying to put my finger on, but it seems like it is an enormous assumption that ontological commitments can be - or should be - necessitated by simply the language that we use. Breaking down sentences or statements into their syntactical and semantical parts and then affirm the existence of var... | 2017/02/10 | [
"https://philosophy.stackexchange.com/questions/40841",
"https://philosophy.stackexchange.com",
"https://philosophy.stackexchange.com/users/-1/"
] | This very issue is analyzed in detail in [Quine's paper On What There Is](http://math.boisestate.edu/~holmes/Phil209/Quine%20-%20On%20What%20There%20Is.pdf), you may want to read it in full, it is short and freely available. Here is the key passage:
>
> "*We can very easily involve ourselves in ontological commitment... | Yes, there are philosophical possibilities to deny that language necessitates ontological commitments. The presumption that language does necessitates ontological commitments is an invention of 20th century analytic philosophy, and it is highly contentious there too.
Arguing from language was ridiculed by philosophers... |
40,841 | I am unsure of what I am trying to put my finger on, but it seems like it is an enormous assumption that ontological commitments can be - or should be - necessitated by simply the language that we use. Breaking down sentences or statements into their syntactical and semantical parts and then affirm the existence of var... | 2017/02/10 | [
"https://philosophy.stackexchange.com/questions/40841",
"https://philosophy.stackexchange.com",
"https://philosophy.stackexchange.com/users/-1/"
] | This very issue is analyzed in detail in [Quine's paper On What There Is](http://math.boisestate.edu/~holmes/Phil209/Quine%20-%20On%20What%20There%20Is.pdf), you may want to read it in full, it is short and freely available. Here is the key passage:
>
> "*We can very easily involve ourselves in ontological commitment... | Yes, it is possible to deny, and I do so now. Perhaps languages that are fluid, and gradually evolved for the purposes of communication. A designed language, however, this does not apply to. Take for instance, programming languages. No ontology is necessary, and it would be possible to design a language that also funct... |
40,841 | I am unsure of what I am trying to put my finger on, but it seems like it is an enormous assumption that ontological commitments can be - or should be - necessitated by simply the language that we use. Breaking down sentences or statements into their syntactical and semantical parts and then affirm the existence of var... | 2017/02/10 | [
"https://philosophy.stackexchange.com/questions/40841",
"https://philosophy.stackexchange.com",
"https://philosophy.stackexchange.com/users/-1/"
] | This very issue is analyzed in detail in [Quine's paper On What There Is](http://math.boisestate.edu/~holmes/Phil209/Quine%20-%20On%20What%20There%20Is.pdf), you may want to read it in full, it is short and freely available. Here is the key passage:
>
> "*We can very easily involve ourselves in ontological commitment... | The **use** of language implies "ontological commitments". By posting this answer to your question, I am committing to the weird and undemonstrable ideas that you exist, that languages exist, and that it is possible to make meaningful statements about existing things.
From this, of course, it does not follow any kind ... |
105,791 | Hilbert reformulated the quadratic reciprocity law of Gauß as a product formula
$$
\prod\_v(a,b)\_v=1
$$
for the various local Hilbert symbols. For each place $v$ of $\bf Q$, the Hilbert symbol $(\ ,\ )\_v$ is a *bimultiplicative* map
$$
{\bf Q}\_v^\times\times{\bf Q}\_v^\times\to{\bf Z}^\times
$$
so that, by definit... | 2012/08/29 | [
"https://mathoverflow.net/questions/105791",
"https://mathoverflow.net",
"https://mathoverflow.net/users/2821/"
] | EDIT: After looking into the history more closely, I think it's fairly certain that the correct answer to the question is Calvin Moore. (See my added text below.)
The question is interesting and looks straightforward, but it may not have a simple answer. A number of independent lines of research, differently motivate... | Matsumoto's computation of $K\_2$ of a field in "Introduction to Algebraic K-Theory" by John Milnor. |
393,632 | I just had a more than 2-week long vacation/business trip and I couldn't remember actually what was I working in my coding and where I stopped. Could someone recommend a best practice to solve this? | 2019/06/21 | [
"https://softwareengineering.stackexchange.com/questions/393632",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/339212/"
] | Simple. Keep a notebook which records all work done that day and lessons learnt. Make a record every time you stop work. I use // to indicate breaks in work but do whatever suits you.
This is also a valuable tool for project management queries when they're asking why you didn't finish X, Y & Z on a given day.
For a ... | I sometimes use a counter-intuitive approach, especially over a weekend. Start on something and leave it slightly unfinished, may not compile, fail a unit test etc.
When I come back, this jogs my memory sufficiently to continue working.
P.S. This approach may not work for everyone. :) |
393,632 | I just had a more than 2-week long vacation/business trip and I couldn't remember actually what was I working in my coding and where I stopped. Could someone recommend a best practice to solve this? | 2019/06/21 | [
"https://softwareengineering.stackexchange.com/questions/393632",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/339212/"
] | The most obvious recommendation is to always stop at a point where all of the work is "done". So when you return, you start on something new instead of trying to remember where you left of.
Instead of looking at it as a vacation time, look at it as if you worked in some different part of the application. So after few ... | Do you follow AGILE ?
If you do then you can have sprints, with Kunban charts...
So it could point you out to the feature \ bug you were working on...
***How it going to help OP ?***
***When user stories are broken down to tasks, ideally tasks should be less then a day,*** so when you come after 2,4,8 weeks holiday... |
393,632 | I just had a more than 2-week long vacation/business trip and I couldn't remember actually what was I working in my coding and where I stopped. Could someone recommend a best practice to solve this? | 2019/06/21 | [
"https://softwareengineering.stackexchange.com/questions/393632",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/339212/"
] | Personally, I leave an intentional compile error.
I write a short comment to myself in the code. Then I uncomment it.
When I get back, by force of habit I start up my IDE, build, and...hey, something's broken!
I go there, and there's my note, telling me what I was working on. | Do you follow AGILE ?
If you do then you can have sprints, with Kunban charts...
So it could point you out to the feature \ bug you were working on...
***How it going to help OP ?***
***When user stories are broken down to tasks, ideally tasks should be less then a day,*** so when you come after 2,4,8 weeks holiday... |
393,632 | I just had a more than 2-week long vacation/business trip and I couldn't remember actually what was I working in my coding and where I stopped. Could someone recommend a best practice to solve this? | 2019/06/21 | [
"https://softwareengineering.stackexchange.com/questions/393632",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/339212/"
] | Simple. Keep a notebook which records all work done that day and lessons learnt. Make a record every time you stop work. I use // to indicate breaks in work but do whatever suits you.
This is also a valuable tool for project management queries when they're asking why you didn't finish X, Y & Z on a given day.
For a ... | Do you follow AGILE ?
If you do then you can have sprints, with Kunban charts...
So it could point you out to the feature \ bug you were working on...
***How it going to help OP ?***
***When user stories are broken down to tasks, ideally tasks should be less then a day,*** so when you come after 2,4,8 weeks holiday... |
393,632 | I just had a more than 2-week long vacation/business trip and I couldn't remember actually what was I working in my coding and where I stopped. Could someone recommend a best practice to solve this? | 2019/06/21 | [
"https://softwareengineering.stackexchange.com/questions/393632",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/339212/"
] | The most obvious recommendation is to always stop at a point where all of the work is "done". So when you return, you start on something new instead of trying to remember where you left of.
Instead of looking at it as a vacation time, look at it as if you worked in some different part of the application. So after few ... | >
> How do you know where you stopped in your codes after a 2-week break?
>
>
>
The same way I know where I stopped after I take a bathroom break.
Notes.
You take notes, you make to do lists, you don't walk away from the 2 hours of work that it took to get an idea spun up in your brain without writing it down.
... |
393,632 | I just had a more than 2-week long vacation/business trip and I couldn't remember actually what was I working in my coding and where I stopped. Could someone recommend a best practice to solve this? | 2019/06/21 | [
"https://softwareengineering.stackexchange.com/questions/393632",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/339212/"
] | The most obvious recommendation is to always stop at a point where all of the work is "done". So when you return, you start on something new instead of trying to remember where you left of.
Instead of looking at it as a vacation time, look at it as if you worked in some different part of the application. So after few ... | Personally, I leave an intentional compile error.
I write a short comment to myself in the code. Then I uncomment it.
When I get back, by force of habit I start up my IDE, build, and...hey, something's broken!
I go there, and there's my note, telling me what I was working on. |
393,632 | I just had a more than 2-week long vacation/business trip and I couldn't remember actually what was I working in my coding and where I stopped. Could someone recommend a best practice to solve this? | 2019/06/21 | [
"https://softwareengineering.stackexchange.com/questions/393632",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/339212/"
] | Copious notes. Write down your thoughts, your progress, in as much detail as needed to clear your mind.
It's no different from when you do a problem analysis tracking down a bug and someone else is going to execute the fix (or yourself at some indeterminate point in the future). Write down EVERYTHING of consequence. W... | Do you follow AGILE ?
If you do then you can have sprints, with Kunban charts...
So it could point you out to the feature \ bug you were working on...
***How it going to help OP ?***
***When user stories are broken down to tasks, ideally tasks should be less then a day,*** so when you come after 2,4,8 weeks holiday... |
393,632 | I just had a more than 2-week long vacation/business trip and I couldn't remember actually what was I working in my coding and where I stopped. Could someone recommend a best practice to solve this? | 2019/06/21 | [
"https://softwareengineering.stackexchange.com/questions/393632",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/339212/"
] | >
> How do you know where you stopped in your codes after a 2-week break?
>
>
>
The same way I know where I stopped after I take a bathroom break.
Notes.
You take notes, you make to do lists, you don't walk away from the 2 hours of work that it took to get an idea spun up in your brain without writing it down.
... | Simple. Keep a notebook which records all work done that day and lessons learnt. Make a record every time you stop work. I use // to indicate breaks in work but do whatever suits you.
This is also a valuable tool for project management queries when they're asking why you didn't finish X, Y & Z on a given day.
For a ... |
393,632 | I just had a more than 2-week long vacation/business trip and I couldn't remember actually what was I working in my coding and where I stopped. Could someone recommend a best practice to solve this? | 2019/06/21 | [
"https://softwareengineering.stackexchange.com/questions/393632",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/339212/"
] | Copious notes. Write down your thoughts, your progress, in as much detail as needed to clear your mind.
It's no different from when you do a problem analysis tracking down a bug and someone else is going to execute the fix (or yourself at some indeterminate point in the future). Write down EVERYTHING of consequence. W... | Simple. Keep a notebook which records all work done that day and lessons learnt. Make a record every time you stop work. I use // to indicate breaks in work but do whatever suits you.
This is also a valuable tool for project management queries when they're asking why you didn't finish X, Y & Z on a given day.
For a ... |
393,632 | I just had a more than 2-week long vacation/business trip and I couldn't remember actually what was I working in my coding and where I stopped. Could someone recommend a best practice to solve this? | 2019/06/21 | [
"https://softwareengineering.stackexchange.com/questions/393632",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/339212/"
] | The most obvious recommendation is to always stop at a point where all of the work is "done". So when you return, you start on something new instead of trying to remember where you left of.
Instead of looking at it as a vacation time, look at it as if you worked in some different part of the application. So after few ... | Simple. Keep a notebook which records all work done that day and lessons learnt. Make a record every time you stop work. I use // to indicate breaks in work but do whatever suits you.
This is also a valuable tool for project management queries when they're asking why you didn't finish X, Y & Z on a given day.
For a ... |
53,935 | Is there anything preventing a character from using an ability such as Second Wind, or casting a spell such as Misty Step, when not engaged in a combat encounter?
The rules indicate you get one Bonus Action on your turn. My assumption is that a character gets a "turn" every round whether they are in combat or just wal... | 2015/01/04 | [
"https://rpg.stackexchange.com/questions/53935",
"https://rpg.stackexchange.com",
"https://rpg.stackexchange.com/users/19523/"
] | Yes, they can be used out of combat. Bonus Actions aren't special in this regard—all spells take an action of some kind to cast, and if you couldn't take "combat" actions outside of combat, you couldn't cast *any* spell out of combat. (Or drink a potion. Or remove something from your backpack. Or walk 30 feet.)
Combat... | All kinds of action can be taken out of combat
----------------------------------------------
Combat is just a construct to help gameplay zoom in when a lot of things are happening at the same time. The PHB expains this on page 189:
>
> Combat in D&D can be chaotic, deadly, and thrilling. This chapter provides the r... |
9,309,552 | In javascript how the hexadecimal and octal integers are converted to the decimal values:
For example:
```
var num=parseInt("0x10");
document.write(num);
```
It displays as output the value 16 how?? | 2012/02/16 | [
"https://Stackoverflow.com/questions/9309552",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/460920/"
] | Here is a sample stylesheet transforming your XML to HTML:
```
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="html" indent="yes"/>
<xsl:template match="/">
<html>
<head>
<title>Example</title>
</head>
<body>
<xsl:apply... | This should work. You only need to correct tabs (formatting)
```
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" indent="yes"/>
<xsl:template match="/products">
<xsl:text disable-output-escaping="yes">SupplierID ... |
277,677 | I am trying to find a replacement part for my macbook air 2016 (model-A1466) I/O board and flex cable.
The cable has a part number printed on it:
821-1722-A
C-{4 digits which I can't remember}
I found a replacement part with the same product number, but the 4 digits on the second line are different.
Does tha... | 2017/03/27 | [
"https://apple.stackexchange.com/questions/277677",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/230674/"
] | According to [this](https://www.ifixit.com/Store/Mac/MacBook-Air-13-Inch-Mid-2013-through-Early-2015-I-O-Board-Cable/IF188-089-2) iFixit product page the part number for this part doesn't seem to include the `C-XXXX` portion as they only have `821-1722-A` listed in the part number. I also find it useful to use their [I... | It is always better to know the EMC number of your Mac.
The A\*\*\* model is only about the kind of MacBook (type of enclosure).
For instance, A1278 (13'') and A1286 (15'') MacBook Pro are spread over several years, but there are different EMC numbers depending on the year those Mac were produced.
Apple is specialist... |
9,496,167 | I need to store a collection of `Point` pairs, but don't want to use plain C# arrays to be bound to use of iterators. Which is the easiest way (except using `KeyValuePair<Point,Point>`) to have such an two dimensional collection at hand with being able to `.Add(Point, Point)` to it? | 2012/02/29 | [
"https://Stackoverflow.com/questions/9496167",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/645460/"
] | `Point,Point` is *not* a key-value pair, it's a `Tuple<Point,Point>`. You can create a `List<Tuple<Point,Point>>` or whatever fits your needs.
However, you should keep something in mind - a `Tuple` is an immutable structure - you can't change it's elements to point to other `Point` objects (however, if the `Point` obj... | will `List<Tuple<int,int>>` you help? |
9,496,167 | I need to store a collection of `Point` pairs, but don't want to use plain C# arrays to be bound to use of iterators. Which is the easiest way (except using `KeyValuePair<Point,Point>`) to have such an two dimensional collection at hand with being able to `.Add(Point, Point)` to it? | 2012/02/29 | [
"https://Stackoverflow.com/questions/9496167",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/645460/"
] | Subclass `List<Tuple<Point,Point>>` and create an overload of .Add with two Point parameters.
```
public class MyCollection : List<Tuple<Point, Point>>
{
public void Add(Point p1, Point p2)
{
this.Add(Tuple.Create(p1, p2));
}
}
``` | will `List<Tuple<int,int>>` you help? |
9,496,167 | I need to store a collection of `Point` pairs, but don't want to use plain C# arrays to be bound to use of iterators. Which is the easiest way (except using `KeyValuePair<Point,Point>`) to have such an two dimensional collection at hand with being able to `.Add(Point, Point)` to it? | 2012/02/29 | [
"https://Stackoverflow.com/questions/9496167",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/645460/"
] | `Point,Point` is *not* a key-value pair, it's a `Tuple<Point,Point>`. You can create a `List<Tuple<Point,Point>>` or whatever fits your needs.
However, you should keep something in mind - a `Tuple` is an immutable structure - you can't change it's elements to point to other `Point` objects (however, if the `Point` obj... | ```
IEnumerable<Tuple<Point, Point>>
```
<http://msdn.microsoft.com/en-us/library/dd268536.aspx> |
9,496,167 | I need to store a collection of `Point` pairs, but don't want to use plain C# arrays to be bound to use of iterators. Which is the easiest way (except using `KeyValuePair<Point,Point>`) to have such an two dimensional collection at hand with being able to `.Add(Point, Point)` to it? | 2012/02/29 | [
"https://Stackoverflow.com/questions/9496167",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/645460/"
] | `Point,Point` is *not* a key-value pair, it's a `Tuple<Point,Point>`. You can create a `List<Tuple<Point,Point>>` or whatever fits your needs.
However, you should keep something in mind - a `Tuple` is an immutable structure - you can't change it's elements to point to other `Point` objects (however, if the `Point` obj... | Subclass `List<Tuple<Point,Point>>` and create an overload of .Add with two Point parameters.
```
public class MyCollection : List<Tuple<Point, Point>>
{
public void Add(Point p1, Point p2)
{
this.Add(Tuple.Create(p1, p2));
}
}
``` |
9,496,167 | I need to store a collection of `Point` pairs, but don't want to use plain C# arrays to be bound to use of iterators. Which is the easiest way (except using `KeyValuePair<Point,Point>`) to have such an two dimensional collection at hand with being able to `.Add(Point, Point)` to it? | 2012/02/29 | [
"https://Stackoverflow.com/questions/9496167",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/645460/"
] | Subclass `List<Tuple<Point,Point>>` and create an overload of .Add with two Point parameters.
```
public class MyCollection : List<Tuple<Point, Point>>
{
public void Add(Point p1, Point p2)
{
this.Add(Tuple.Create(p1, p2));
}
}
``` | ```
IEnumerable<Tuple<Point, Point>>
```
<http://msdn.microsoft.com/en-us/library/dd268536.aspx> |
13,663,261 | I'm writing a game AI in Haskell, and I want to search the game state tree for a specified amount of time (i.e. I always want to AI to take 3 seconds to make its decision on what move to make)
How can I do this in a pure language like Haskell? I expect that I'll need to do some diving into threads and such but I would... | 2012/12/01 | [
"https://Stackoverflow.com/questions/13663261",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/595605/"
] | One idea: Combine `timeout` (suggested by @MathematicalOrchid) with mutable variables from [SafeSemaphore](http://hackage.haskell.org/packages/archive/SafeSemaphore/0.9.0/doc/html/Control-Concurrent-MSampleVar.html) to store intermediate values every time your process computes a partial result:
```
import Control.Mona... | Since the result you're looking for depends on time, this is inevitably going to involve impure code.
It looks like `System.Timeout` from the `base` package provides the ability to run an I/O computation until some timeout (per the comment by leftaroundabout.) So all you need to do is write an `IO` computation that re... |
13,663,261 | I'm writing a game AI in Haskell, and I want to search the game state tree for a specified amount of time (i.e. I always want to AI to take 3 seconds to make its decision on what move to make)
How can I do this in a pure language like Haskell? I expect that I'll need to do some diving into threads and such but I would... | 2012/12/01 | [
"https://Stackoverflow.com/questions/13663261",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/595605/"
] | One idea: Combine `timeout` (suggested by @MathematicalOrchid) with mutable variables from [SafeSemaphore](http://hackage.haskell.org/packages/archive/SafeSemaphore/0.9.0/doc/html/Control-Concurrent-MSampleVar.html) to store intermediate values every time your process computes a partial result:
```
import Control.Mona... | `System.Timeout` is the way to go. It's got a very clean interface, that doesn't feel at all like you're messing with threads.
Searching the game space sounds like a pure computation, and `System.Timeout` runs `IO` actions, so you'll need to wrap the value in `return`, and evaluate the code strictly enough that `time... |
18,885 | I want to generate a key pair such that the private key can be used once to sign a small message (1024 bytes) at some indeterminate point in the future and the public key can be used to verify that signature, what can I do to get better security than a regular asymmetric algorithm (e.g. RSA)?
The use case is allowing ... | 2014/08/29 | [
"https://crypto.stackexchange.com/questions/18885",
"https://crypto.stackexchange.com",
"https://crypto.stackexchange.com/users/17055/"
] | One algorithm that is especially suited to one-use key pars is [lamport signatures](http://en.wikipedia.org/wiki/Lamport_signature). Like many (all?) other signature functions, lamport signatures first hash the message to get it down to a size that is more reasonable to sign.
For this use case, if you are willing to h... | What do you mean by better security? RSA was proved to be as difficult as prime factorisation and is thus one of the best understood public key cryptosystems. Also, since its widely used their implementations have withstood years of attacks. Since you are going for a one-time usage of the keys, speed is not of importan... |
18,885 | I want to generate a key pair such that the private key can be used once to sign a small message (1024 bytes) at some indeterminate point in the future and the public key can be used to verify that signature, what can I do to get better security than a regular asymmetric algorithm (e.g. RSA)?
The use case is allowing ... | 2014/08/29 | [
"https://crypto.stackexchange.com/questions/18885",
"https://crypto.stackexchange.com",
"https://crypto.stackexchange.com/users/17055/"
] | Your use case is specific enough that you may be able to avoid full signatures and use a one-way function directly.
When publishing the data you can use as a public key the hash of a random value $H(r)$, so that the full message is $(H(r), m, H(H(r) || m))$. Revealing $r$ is then seen as the revocation of that data, s... | What do you mean by better security? RSA was proved to be as difficult as prime factorisation and is thus one of the best understood public key cryptosystems. Also, since its widely used their implementations have withstood years of attacks. Since you are going for a one-time usage of the keys, speed is not of importan... |
18,885 | I want to generate a key pair such that the private key can be used once to sign a small message (1024 bytes) at some indeterminate point in the future and the public key can be used to verify that signature, what can I do to get better security than a regular asymmetric algorithm (e.g. RSA)?
The use case is allowing ... | 2014/08/29 | [
"https://crypto.stackexchange.com/questions/18885",
"https://crypto.stackexchange.com",
"https://crypto.stackexchange.com/users/17055/"
] | One algorithm that is especially suited to one-use key pars is [lamport signatures](http://en.wikipedia.org/wiki/Lamport_signature). Like many (all?) other signature functions, lamport signatures first hash the message to get it down to a size that is more reasonable to sign.
For this use case, if you are willing to h... | Your use case is specific enough that you may be able to avoid full signatures and use a one-way function directly.
When publishing the data you can use as a public key the hash of a random value $H(r)$, so that the full message is $(H(r), m, H(H(r) || m))$. Revealing $r$ is then seen as the revocation of that data, s... |
48,018,336 | I am an AP Computer Science student and I was wondering how to finish up my factorial code using for loops. Here is what I have so far:
```
import java.util.Scanner;
public class Factorial
{
public static void main(String[] args)
{
int num;
int factorial = 1;
int i;
Scanner i... | 2017/12/29 | [
"https://Stackoverflow.com/questions/48018336",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9151973/"
] | You are centering the paragraph itself when its container doesn't fill half the width of the slider. What you need to do is expand the right container (.right) to the correct width and center all of its contents:
```
.right {
float: right;
position: relative;
width: 50%; /* MAKE THE CONTAINER THE RIGHT SI... | You just needs to add width and align property into the ".right" class like
```
.right {
width : calc(100% / 2);
text-align : center;
}
``` |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.