qid int64 1 74.7M | question stringlengths 0 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 2 48.3k | response_k stringlengths 2 40.5k |
|---|---|---|---|---|---|
126,218 | I have a plan on how to get a lot of damage out with the assassin from Dnd 5e but I wanted to run the order of actions by you guys to see if it is correct or not.
Assassin 17/warlock 3
* Apply serpent venom poison to rapier
* Casts *[Invisibility](https://www.dndbeyond.com/spells/invisibility)* via warlock invocation... | 2018/07/13 | [
"https://rpg.stackexchange.com/questions/126218",
"https://rpg.stackexchange.com",
"https://rpg.stackexchange.com/users/45765/"
] | ### Hex won't cause disadvantage on the saving throw
Ability checks and saving throws are different things.
>
> Also, choose one ability. The target has disadvantage on ability checks with the chosen ability. (PHB, p. 251)
>
>
>
Not casting *hex*, since it isn't helping you, removes the worry about being invisi... | ### Apply serpent venom poison to rapier
From [serpent venom poison](https://www.dndbeyond.com/equipment/serpent-venom-injury) description:
>
> This poison must be harvested from a dead or incapacitated giant poisonous snake. A creature subjected to this poison must succeed on a DC 11 Constitution **saving throw**,... |
46,633,168 | Aloha guy's,
1. can you explain the file for what this can be good??
in project explorer -> Gradle: org.controlsfx:controlsfx:8.40.12 -> Resource Bundel 'controlsfx' -> here the different file in different language. Can i with this translate my Programm content englisch,Germany,Polish and can i make it editable
2.if ... | 2017/10/08 | [
"https://Stackoverflow.com/questions/46633168",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8730104/"
] | I'd clone the repo (which you'd need to do anyway if you want to create a PR for it) and `git grep` it:
```
$ git grep string_to_look_for
``` | From [GitHub Developer Guide](https://developer.github.com/v3/search/#search-code):
```
GET /search/code
```
Example:
<https://api.github.com/search/code?q=addClass+in:file+language:js+repo:jquery/jquery> |
46,633,168 | Aloha guy's,
1. can you explain the file for what this can be good??
in project explorer -> Gradle: org.controlsfx:controlsfx:8.40.12 -> Resource Bundel 'controlsfx' -> here the different file in different language. Can i with this translate my Programm content englisch,Germany,Polish and can i make it editable
2.if ... | 2017/10/08 | [
"https://Stackoverflow.com/questions/46633168",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8730104/"
] | You can search an entire repo in github by using the search bar found at the top left corner of the screen.
[](https://i.stack.imgur.com/kSrCP.png) | From [GitHub Developer Guide](https://developer.github.com/v3/search/#search-code):
```
GET /search/code
```
Example:
<https://api.github.com/search/code?q=addClass+in:file+language:js+repo:jquery/jquery> |
51,424,453 | I am willing to add or insert the list values in the dataframe. The dataframe len is `49`, whereas the length of list id `47`. I am getting the following error while implementing the code.
```
print("Lenght of dataframe: ",datasetTest.open.count())
print("Lenght of array: ",len(test_pred_list))
datasetTest['predict_c... | 2018/07/19 | [
"https://Stackoverflow.com/questions/51424453",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4948889/"
] | If you convert the list to a Series then it will just work:
```
datasetTest.loc[:,'predict_close'] = pd.Series(test_pred_list)
```
example:
```
In[121]:
df = pd.DataFrame({'a':np.arange(3)})
df
Out[121]:
a
0 0
1 1
2 2
In[122]:
df.loc[:,'b'] = pd.Series(['a','b'])
df
Out[122]:
a b
0 0 a
1 1 ... | You can add items to your list with an arbitrary `filler` scalar.
Data from @EdChum.
```
filler = 0
lst = ['a', 'b']
df.loc[:, 'b'] = lst + [filler]*(len(df.index) - len(lst))
print(df)
a b
0 0 a
1 1 b
2 2 0
``` |
51,424,453 | I am willing to add or insert the list values in the dataframe. The dataframe len is `49`, whereas the length of list id `47`. I am getting the following error while implementing the code.
```
print("Lenght of dataframe: ",datasetTest.open.count())
print("Lenght of array: ",len(test_pred_list))
datasetTest['predict_c... | 2018/07/19 | [
"https://Stackoverflow.com/questions/51424453",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4948889/"
] | If you convert the list to a Series then it will just work:
```
datasetTest.loc[:,'predict_close'] = pd.Series(test_pred_list)
```
example:
```
In[121]:
df = pd.DataFrame({'a':np.arange(3)})
df
Out[121]:
a
0 0
1 1
2 2
In[122]:
df.loc[:,'b'] = pd.Series(['a','b'])
df
Out[122]:
a b
0 0 a
1 1 ... | You still can assign it by using `loc` data from Ed
```
l = ['a','b']
df.loc[range(len(l)),'b'] = l
df
Out[546]:
a b
0 0 a
1 1 b
2 2 NaN
``` |
51,424,453 | I am willing to add or insert the list values in the dataframe. The dataframe len is `49`, whereas the length of list id `47`. I am getting the following error while implementing the code.
```
print("Lenght of dataframe: ",datasetTest.open.count())
print("Lenght of array: ",len(test_pred_list))
datasetTest['predict_c... | 2018/07/19 | [
"https://Stackoverflow.com/questions/51424453",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4948889/"
] | You still can assign it by using `loc` data from Ed
```
l = ['a','b']
df.loc[range(len(l)),'b'] = l
df
Out[546]:
a b
0 0 a
1 1 b
2 2 NaN
``` | You can add items to your list with an arbitrary `filler` scalar.
Data from @EdChum.
```
filler = 0
lst = ['a', 'b']
df.loc[:, 'b'] = lst + [filler]*(len(df.index) - len(lst))
print(df)
a b
0 0 a
1 1 b
2 2 0
``` |
73,489,746 | Whenever I execute a C program, there are 3 standard files, `stdin`, `stdout`, `stderr`. Theses map to `/proc/self/fd/0`, `/proc/self/fd/1`, `/proc/self/fd/2` in Linux, which link to `/dev/pts/0` in my computer. This is pseudo-terminal, to which this process outputs to and takes inputs from.
What is the equivalent of ... | 2022/08/25 | [
"https://Stackoverflow.com/questions/73489746",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12357035/"
] | They don't exist as files on Windows. Even though Windows NT has a object manager in the kernel where named kernel objects exist, the console is not part of it.
At the Win32 layer, those 3 handles are returned by [`GetStdHandle`](https://learn.microsoft.com/en-us/windows/console/getstdhandle). They are special handles... | There is no direct equivalent of /dev/stdin and other Unix pseudo files.
You could create a named pipe (CreateNamedPipe) but it isn't exactly identical.
The windows files conIN$ and conOUT$ are similar, but they only read or write to the current window. |
73,489,746 | Whenever I execute a C program, there are 3 standard files, `stdin`, `stdout`, `stderr`. Theses map to `/proc/self/fd/0`, `/proc/self/fd/1`, `/proc/self/fd/2` in Linux, which link to `/dev/pts/0` in my computer. This is pseudo-terminal, to which this process outputs to and takes inputs from.
What is the equivalent of ... | 2022/08/25 | [
"https://Stackoverflow.com/questions/73489746",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12357035/"
] | On a Linux kernel, the `stdin`, `stdout` and `stderr` streams have corresponding entries in `/proc`. That `/proc` filesystem is an informational structure which provides visibility into the system; it is not the implementation of these streams.
Firstly, `stdout` is a C concept: an instance of a `FILE *` I/O stream. Th... | They don't exist as files on Windows. Even though Windows NT has a object manager in the kernel where named kernel objects exist, the console is not part of it.
At the Win32 layer, those 3 handles are returned by [`GetStdHandle`](https://learn.microsoft.com/en-us/windows/console/getstdhandle). They are special handles... |
73,489,746 | Whenever I execute a C program, there are 3 standard files, `stdin`, `stdout`, `stderr`. Theses map to `/proc/self/fd/0`, `/proc/self/fd/1`, `/proc/self/fd/2` in Linux, which link to `/dev/pts/0` in my computer. This is pseudo-terminal, to which this process outputs to and takes inputs from.
What is the equivalent of ... | 2022/08/25 | [
"https://Stackoverflow.com/questions/73489746",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12357035/"
] | On a Linux kernel, the `stdin`, `stdout` and `stderr` streams have corresponding entries in `/proc`. That `/proc` filesystem is an informational structure which provides visibility into the system; it is not the implementation of these streams.
Firstly, `stdout` is a C concept: an instance of a `FILE *` I/O stream. Th... | There is no direct equivalent of /dev/stdin and other Unix pseudo files.
You could create a named pipe (CreateNamedPipe) but it isn't exactly identical.
The windows files conIN$ and conOUT$ are similar, but they only read or write to the current window. |
53,341,213 | I'm trying to mix two audio files in swift AVFoundations. I have a solution that mixes two audio and plays them simultaneously. What I really want is to start the second audio after some time. For example audio 1 plays then second audio starts playing after 10(given time) seconds. Any help is appreciated. Thanks in adv... | 2018/11/16 | [
"https://Stackoverflow.com/questions/53341213",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4250562/"
] | You should use [scheduleSegment](https://developer.apple.com/documentation/avfoundation/avaudioplayernode/1385884-schedulesegment).
```
func scheduleWithOffset(_ offset: TimeInterval) {
let samplerate1 = file1.processingFormat.sampleRate
player1.scheduleSegment(file1,
startingFrame... | I don't personally have experience with `AVAudioEngine` or `AVAudioMixerNode`, however, you can do this with `Timer`.
You currently have `audioPlayer.play(at: nil)`, however, this will always play immediately after establishing this player. What I would do, or try to do, is apply some kind of timer to this.
```
var... |
53,341,213 | I'm trying to mix two audio files in swift AVFoundations. I have a solution that mixes two audio and plays them simultaneously. What I really want is to start the second audio after some time. For example audio 1 plays then second audio starts playing after 10(given time) seconds. Any help is appreciated. Thanks in adv... | 2018/11/16 | [
"https://Stackoverflow.com/questions/53341213",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4250562/"
] | You should use [scheduleSegment](https://developer.apple.com/documentation/avfoundation/avaudioplayernode/1385884-schedulesegment).
```
func scheduleWithOffset(_ offset: TimeInterval) {
let samplerate1 = file1.processingFormat.sampleRate
player1.scheduleSegment(file1,
startingFrame... | You may add another playerNode to the mixer and then play it after delay like this :
```
let audioPlayer2 = AVAudioPlayerNode()
self.audioEngine.attach(audioPlayer2)
self.audioEngine.connect(audioPlayer2, to: self.mixer, format: nil)
var file2 : AVAudioFile = try! AVAudioFile.init(forReading: fileUrl2!... |
9,896,674 | In a Relational Database, what is the best way to handle removing an object from the object graph while still retaining referential integrity? At some point, this has to happen. Either through a soft or hard delete.
For example - when a product is removed, what is the best approach to make sure that the orders contain... | 2012/03/27 | [
"https://Stackoverflow.com/questions/9896674",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1026459/"
] | There are basically 3 "standard solutions":
*Solution 1*
You need the product (like in your case because of the invoices referencing it). This means the data is VALID and the only change is that it goes "out of stock" or "out of portfolio". In any case your business process often will need you to handle RMA situatio... | Here is an answer I received from an un-named source. I will say this, he is pretty well respected, and to be respectful I am not going to post his name.
I am not going to accept my own answer here, or bypass the bounty, but am just showing his answer.
"With a full-featured RDBMS you can partition the table on the "d... |
32,612,381 | In Identity Server features I see "Multi-factor authentication" but I don't see how to configure it in the product ! All I see is configuring a local authentication with either login/password or IWA... | 2015/09/16 | [
"https://Stackoverflow.com/questions/32612381",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5342924/"
] | WSO2IS does not support for multi-factor authentication by default. It has capabilities to support it. Because you can implement and plug custom authenticators for WSO2IS. However there is no any multi-factor authenticator which is shipped with it. But there is some plan to ship a `FIDO` authenticator with WSO2IS next ... | To have multi-factor authentication, add multiple identity providers to a single service provider. An example of this is detailed [here](http://xacmlinfo.org/2015/09/01/configure-multiple-federated-identity-providers-with-wso2-identity-server-wso2is/). In that example, Asela shows how to set multiple federated provider... |
14,306,236 | I'm trying to share a file using the something like `intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));` the file is located in the path `data/data/my.package.name/folder/fileName` and whenever I try to send the file using the Gmail app I get an error.
I think this is due to the read permissions of the file, an... | 2013/01/13 | [
"https://Stackoverflow.com/questions/14306236",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/557240/"
] | Try this it might help you.
You are trying to send the file as an email attachment using `intents`.
The reason why the file is empty is that the email app does not have access to the file in `data/data/my.package.name/folder/fileName`, due to Androids security model (the `data/data/my.package.name/folder/fileName` di... | The standard mechanism to share content is via the ContentProvider.
<http://developer.android.com/training/enterprise/app-compatibility.html#sharing_files> |
63,147,506 | I want to extract the part before the 1st `/`, how can I do that?
```
SELECT REGEXP_SUBSTR('prAct1-03/cPMI-01/iPEPC9-01/t35s-08','(pr.*)/',1,1) as promoter
FROM dual;
```
did not work, and seems oracle did not support Lookahead and Lookbehind.
Thanks! | 2020/07/29 | [
"https://Stackoverflow.com/questions/63147506",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11778300/"
] | I would just use the base string functions here:
```
SELECT SUBSTR(col, 1, INSTR(col, '/') - 1) AS first_part
FROM yourTable;
```
[Demo
----](https://dbfiddle.uk/?rdbms=oracle_11.2&fiddle=9f93f9b1b0629326b6be1ff700bcc170)
If you really wanted to use regex, then try:
```
SELECT REGXP_SUBSTR(col, '^[^/]+')
FROM your... | One option uses `REGEXP_REPLACE()` function :
```
SELECT REGEXP_REPLACE('prAct1-03/cPMI-01/iPEPC9-01/t35s-08','(\S)(/.*)','\1') AS promoter
FROM dual;
```
`[Demo](https://dbfiddle.uk/?rdbms=oracle_11.2&fiddle=95d17d21eca9223566e078a0e00bb0b3)` |
63,147,506 | I want to extract the part before the 1st `/`, how can I do that?
```
SELECT REGEXP_SUBSTR('prAct1-03/cPMI-01/iPEPC9-01/t35s-08','(pr.*)/',1,1) as promoter
FROM dual;
```
did not work, and seems oracle did not support Lookahead and Lookbehind.
Thanks! | 2020/07/29 | [
"https://Stackoverflow.com/questions/63147506",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11778300/"
] | I would just use the base string functions here:
```
SELECT SUBSTR(col, 1, INSTR(col, '/') - 1) AS first_part
FROM yourTable;
```
[Demo
----](https://dbfiddle.uk/?rdbms=oracle_11.2&fiddle=9f93f9b1b0629326b6be1ff700bcc170)
If you really wanted to use regex, then try:
```
SELECT REGXP_SUBSTR(col, '^[^/]+')
FROM your... | Please use below query,
```
select substr('prAct1-03/cPMI-01/iPEPC9-01/t35s-08', 0, instr('prAct1-03/cPMI-01/iPEPC9-01/t35s-08', '/')-1) as promoter from dual;
```
[](https://i.stack.imgur.com/JJHyv.png) |
63,147,506 | I want to extract the part before the 1st `/`, how can I do that?
```
SELECT REGEXP_SUBSTR('prAct1-03/cPMI-01/iPEPC9-01/t35s-08','(pr.*)/',1,1) as promoter
FROM dual;
```
did not work, and seems oracle did not support Lookahead and Lookbehind.
Thanks! | 2020/07/29 | [
"https://Stackoverflow.com/questions/63147506",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11778300/"
] | One option uses `REGEXP_REPLACE()` function :
```
SELECT REGEXP_REPLACE('prAct1-03/cPMI-01/iPEPC9-01/t35s-08','(\S)(/.*)','\1') AS promoter
FROM dual;
```
`[Demo](https://dbfiddle.uk/?rdbms=oracle_11.2&fiddle=95d17d21eca9223566e078a0e00bb0b3)` | Please use below query,
```
select substr('prAct1-03/cPMI-01/iPEPC9-01/t35s-08', 0, instr('prAct1-03/cPMI-01/iPEPC9-01/t35s-08', '/')-1) as promoter from dual;
```
[](https://i.stack.imgur.com/JJHyv.png) |
43,982,388 | consider the following code, which causes a weird behavior:
foo.h
-----
```
#ifndef FOO_H
#define FOO_H
void foo();
#endif
```
foo.c
-----
```
#include <stdio.h>
// NOTICE - foo.h is not included!
void foo()
{
printf("foo!\n");
}
```
main.c
------
```
#include "foo.h"
int main()
{
foo();
return ... | 2017/05/15 | [
"https://Stackoverflow.com/questions/43982388",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5462551/"
] | The header file is declaring the function, so when compiling main.c the compiler knows the function signature to validate against. When compiling foo.c, it doesn't need to be declared, as it is the declaration of the function. It is up to the linker to see if there are any unresolved symbols, which there aren't in this... | What will happen if there was another function(test.c) included in the above question.
**foo.h**
```
#ifndef FOO_H
#define FOO_H
void foo();
#endif
```
**foo.c**
```
#include <stdio.h>
// NOTICE - foo.h is not included!
void foo()
{
printf("foo!\n");
}
```
**test.c**
```
#include <stdio.h>
void foo()
... |
30,397,298 | I have an array of my own class:
```
var listofmyclasses = [MyClass]()
```
in MyClass I have implemented:
```
- func encodeWithCoder(aCoder: NSCoder!)
- init (coder aDecoder: NSCoder!)
```
I am writing an XML File with the content of my array and this works fine:
```
let plistpath = directories[0].str... | 2015/05/22 | [
"https://Stackoverflow.com/questions/30397298",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1344545/"
] | Try this to read back the file:
```
let dat : NSData = NSData.dataWithContentsOfMappedFile(plistpath) as NSData
let unarchiver = NSKeyedUnarchiver(forReadingWithData: dat)
let read_bookmarks = unarchiver.decodeObject() as [MyClass]
unarchiver.finishDecoding()
```
(Of course you certainly want to use ... | The class `NSPropertyListSerialization` can decode all sorts of plist encodings like `NSPropertyListXMLFormat_v1_0`
```
NSError* error;
NSData* data = [NSData dataWithContentsOfURL:yourURL options:NSDataReadingMappedIfSafe error:&error];
NSDictionary* dict = [NSPropertyListSerialization propertyListWithData:data optio... |
12,235,643 | I have been coping with an annoying "bug" in eclipse (android) for some time, and today it has just annoyed me to much! So I was wondering has anyone else come accross it, and have you found a fix for it?
It's hard to explain, so hopefully these three screen caps will help:
The first screenshot, everything is ok.
![... | 2012/09/02 | [
"https://Stackoverflow.com/questions/12235643",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/508401/"
] | This is a known bug and happens if you edit the layout in the visual editor and then switch back to the xml editor. You can sometimes fix it by scrolling up and down the file or selecting all the text. Otherwise, just close and reopen the xml file when switching from visual editor to xml editor. It's annoying and still... | As some commentators have mentioned it seems that this is a duplicate (have flagged as such), although as it is a hard issue to describe that is no surprise! I have tried an [answer](https://stackoverflow.com/a/11418891/508401) from one of the questions and it seems to solve the problem. Although it does not prevent th... |
40,913,952 | Could someone please take a look at my code and tell me what I’m doing wrong? I'm trying to consolidate a group of excel files that are in a folder into a master Excel file. My logic seems right but for some reason, the data is not pasting into the master file from the source files. Thank you all in advance!
```
Sub C... | 2016/12/01 | [
"https://Stackoverflow.com/questions/40913952",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5171347/"
] | Simply run it through the parsefunc\_RTE, try this snippet:
```
$message = ...
$parseFuncConf = $GLOBALS['TSFE']->tmpl->setup['lib.']['parseFunc_RTE.'];
$messageHtml = $GLOBALS['TSFE']->cObj->parseFunc($message, $parseFuncConf);
``` | If you output this message to fluid template, you maybe can use around it. Guess it should parse the link.
In PHP you probably can use a function of the ContentObjectRenderer like this one: <https://typo3.org/api/typo3cms/class_t_y_p_o3_1_1_c_m_s_1_1_frontend_1_1_content_object_1_1_content_object_renderer.html#a1f5083b... |
16,823,629 | I have a set of valid characters [0-9a-z\_] and a variable that is assigned one of these characters. What I want to do is to be able to increment that variable to the next in the set.
If need be I can handle the "special" cases where it would increment from '9' to 'a' and 'z' to '\_', but I can't figure out how to inc... | 2013/05/29 | [
"https://Stackoverflow.com/questions/16823629",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2434131/"
] | Maybe this can be a solution:
```
a=({0..9} {a..z} _)
echo ${a[*]}
yc=11
echo ${a[yc]}
((++yc))
echo ${a[yc]}
echo ${a[++yc]}
#Alternative
declare -A h
# Fill the has point to the next character
for((i=0;((i+1))<${#a[*]};++i)) { h[${a[i]}]=${a[i+1]};}
y=b
echo $y, ${h[$y]}
```
Output:
```
0 1 2 3 4 5 6 7 8 9 a b ... | You can start with this:
```
echo 0x$(( $(printf "%x" "'b'") + 1)) | xxd -r
``` |
16,823,629 | I have a set of valid characters [0-9a-z\_] and a variable that is assigned one of these characters. What I want to do is to be able to increment that variable to the next in the set.
If need be I can handle the "special" cases where it would increment from '9' to 'a' and 'z' to '\_', but I can't figure out how to inc... | 2013/05/29 | [
"https://Stackoverflow.com/questions/16823629",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2434131/"
] | ```
y=b
echo "$y" # this shows 'b'
y=$(echo "$y" | tr "0-9a-z" "1-9a-z_")
echo "$y" # this shows 'c'
```
Note that this does not handle the case where $y = "\_" (not sure what you want then, and in any case it'll probably require separate handling), and if $y is more than one character long it'll "increment" all of... | Maybe this can be a solution:
```
a=({0..9} {a..z} _)
echo ${a[*]}
yc=11
echo ${a[yc]}
((++yc))
echo ${a[yc]}
echo ${a[++yc]}
#Alternative
declare -A h
# Fill the has point to the next character
for((i=0;((i+1))<${#a[*]};++i)) { h[${a[i]}]=${a[i+1]};}
y=b
echo $y, ${h[$y]}
```
Output:
```
0 1 2 3 4 5 6 7 8 9 a b ... |
16,823,629 | I have a set of valid characters [0-9a-z\_] and a variable that is assigned one of these characters. What I want to do is to be able to increment that variable to the next in the set.
If need be I can handle the "special" cases where it would increment from '9' to 'a' and 'z' to '\_', but I can't figure out how to inc... | 2013/05/29 | [
"https://Stackoverflow.com/questions/16823629",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2434131/"
] | Maybe this can be a solution:
```
a=({0..9} {a..z} _)
echo ${a[*]}
yc=11
echo ${a[yc]}
((++yc))
echo ${a[yc]}
echo ${a[++yc]}
#Alternative
declare -A h
# Fill the has point to the next character
for((i=0;((i+1))<${#a[*]};++i)) { h[${a[i]}]=${a[i+1]};}
y=b
echo $y, ${h[$y]}
```
Output:
```
0 1 2 3 4 5 6 7 8 9 a b ... | I wrote this for a project, it uses the chr and ord fucntions(also found here somewhere) and some pure bash(only external called in the function is tr), if you are doing more than 100 characters I would use something else, but for short strings in my testing its actually slightly faster than python.
Also this script l... |
16,823,629 | I have a set of valid characters [0-9a-z\_] and a variable that is assigned one of these characters. What I want to do is to be able to increment that variable to the next in the set.
If need be I can handle the "special" cases where it would increment from '9' to 'a' and 'z' to '\_', but I can't figure out how to inc... | 2013/05/29 | [
"https://Stackoverflow.com/questions/16823629",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2434131/"
] | ```
y=b
echo "$y" # this shows 'b'
y=$(echo "$y" | tr "0-9a-z" "1-9a-z_")
echo "$y" # this shows 'c'
```
Note that this does not handle the case where $y = "\_" (not sure what you want then, and in any case it'll probably require separate handling), and if $y is more than one character long it'll "increment" all of... | You can start with this:
```
echo 0x$(( $(printf "%x" "'b'") + 1)) | xxd -r
``` |
16,823,629 | I have a set of valid characters [0-9a-z\_] and a variable that is assigned one of these characters. What I want to do is to be able to increment that variable to the next in the set.
If need be I can handle the "special" cases where it would increment from '9' to 'a' and 'z' to '\_', but I can't figure out how to inc... | 2013/05/29 | [
"https://Stackoverflow.com/questions/16823629",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2434131/"
] | You can start with this:
```
echo 0x$(( $(printf "%x" "'b'") + 1)) | xxd -r
``` | I wrote this for a project, it uses the chr and ord fucntions(also found here somewhere) and some pure bash(only external called in the function is tr), if you are doing more than 100 characters I would use something else, but for short strings in my testing its actually slightly faster than python.
Also this script l... |
16,823,629 | I have a set of valid characters [0-9a-z\_] and a variable that is assigned one of these characters. What I want to do is to be able to increment that variable to the next in the set.
If need be I can handle the "special" cases where it would increment from '9' to 'a' and 'z' to '\_', but I can't figure out how to inc... | 2013/05/29 | [
"https://Stackoverflow.com/questions/16823629",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2434131/"
] | **for those who would like to print incremented letter by execution of a function**:
```
ALPHA=( {A..Z} )
alpha_increment () { echo ${ALPHA[${i:-0}]}; ((i++)) ;}
```
---
```
alpha_increment
A
alpha_increment
B
alpha_increment
C
``` | You can start with this:
```
echo 0x$(( $(printf "%x" "'b'") + 1)) | xxd -r
``` |
16,823,629 | I have a set of valid characters [0-9a-z\_] and a variable that is assigned one of these characters. What I want to do is to be able to increment that variable to the next in the set.
If need be I can handle the "special" cases where it would increment from '9' to 'a' and 'z' to '\_', but I can't figure out how to inc... | 2013/05/29 | [
"https://Stackoverflow.com/questions/16823629",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2434131/"
] | ```
y=b
echo "$y" # this shows 'b'
y=$(echo "$y" | tr "0-9a-z" "1-9a-z_")
echo "$y" # this shows 'c'
```
Note that this does not handle the case where $y = "\_" (not sure what you want then, and in any case it'll probably require separate handling), and if $y is more than one character long it'll "increment" all of... | I wrote this for a project, it uses the chr and ord fucntions(also found here somewhere) and some pure bash(only external called in the function is tr), if you are doing more than 100 characters I would use something else, but for short strings in my testing its actually slightly faster than python.
Also this script l... |
16,823,629 | I have a set of valid characters [0-9a-z\_] and a variable that is assigned one of these characters. What I want to do is to be able to increment that variable to the next in the set.
If need be I can handle the "special" cases where it would increment from '9' to 'a' and 'z' to '\_', but I can't figure out how to inc... | 2013/05/29 | [
"https://Stackoverflow.com/questions/16823629",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2434131/"
] | ```
y=b
echo "$y" # this shows 'b'
y=$(echo "$y" | tr "0-9a-z" "1-9a-z_")
echo "$y" # this shows 'c'
```
Note that this does not handle the case where $y = "\_" (not sure what you want then, and in any case it'll probably require separate handling), and if $y is more than one character long it'll "increment" all of... | **for those who would like to print incremented letter by execution of a function**:
```
ALPHA=( {A..Z} )
alpha_increment () { echo ${ALPHA[${i:-0}]}; ((i++)) ;}
```
---
```
alpha_increment
A
alpha_increment
B
alpha_increment
C
``` |
16,823,629 | I have a set of valid characters [0-9a-z\_] and a variable that is assigned one of these characters. What I want to do is to be able to increment that variable to the next in the set.
If need be I can handle the "special" cases where it would increment from '9' to 'a' and 'z' to '\_', but I can't figure out how to inc... | 2013/05/29 | [
"https://Stackoverflow.com/questions/16823629",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2434131/"
] | **for those who would like to print incremented letter by execution of a function**:
```
ALPHA=( {A..Z} )
alpha_increment () { echo ${ALPHA[${i:-0}]}; ((i++)) ;}
```
---
```
alpha_increment
A
alpha_increment
B
alpha_increment
C
``` | I wrote this for a project, it uses the chr and ord fucntions(also found here somewhere) and some pure bash(only external called in the function is tr), if you are doing more than 100 characters I would use something else, but for short strings in my testing its actually slightly faster than python.
Also this script l... |
301,776 | I would like to know if there is any easy way to print multiple emails(about 200) so that they continue on as opposed to printing one per page. I have tried with thunderbird and evolution and this does not seem possible. Would concatenating the individual mail files work or are there other unix utilities that could do ... | 2008/11/19 | [
"https://Stackoverflow.com/questions/301776",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1246613/"
] | Why don't you put all the data from the mails in one text file and print that one.
This could be done by something like:
```
cat *.eml > file.txt
```
Or print it directly with
```
cat *.eml | lpr
``` | I can say for sure about \*n\*x, but if it is possible to define a printer which only outputs text, and that will output to a text file, then you could print your batch to that printer and remove the form-feeds from the resulting text file.
I've used a similar technique in Windows: create a new printer using the Gener... |
301,776 | I would like to know if there is any easy way to print multiple emails(about 200) so that they continue on as opposed to printing one per page. I have tried with thunderbird and evolution and this does not seem possible. Would concatenating the individual mail files work or are there other unix utilities that could do ... | 2008/11/19 | [
"https://Stackoverflow.com/questions/301776",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1246613/"
] | Why don't you put all the data from the mails in one text file and print that one.
This could be done by something like:
```
cat *.eml > file.txt
```
Or print it directly with
```
cat *.eml | lpr
``` | If you're wanting to filter emails then I suggest finding where the data is stored and scripting a solution at that level.
On my Windows box, Thunderbird stores my Inbox in a rather large-ish file at
>
> C:\Documents and Settings\Bruce Axtens\Application Data\Thunderbird\Profiles\x5j9chtd.default\Mail\Local Folder... |
301,776 | I would like to know if there is any easy way to print multiple emails(about 200) so that they continue on as opposed to printing one per page. I have tried with thunderbird and evolution and this does not seem possible. Would concatenating the individual mail files work or are there other unix utilities that could do ... | 2008/11/19 | [
"https://Stackoverflow.com/questions/301776",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1246613/"
] | Why don't you put all the data from the mails in one text file and print that one.
This could be done by something like:
```
cat *.eml > file.txt
```
Or print it directly with
```
cat *.eml | lpr
``` | Perl makes it pretty easy with the [Email::Abstract](http://search.cpan.org/~rjbs/Email-Abstract-2.134/lib/Email/Abstract.pm) module. Give the following script (maildump) a list of emails to dump out and then pipe it all into lpr...
maildump m1 m2 m3 m4 | lpr
```
#!/usr/bin/perl
use Email::Abstract;
while ($mfile... |
301,776 | I would like to know if there is any easy way to print multiple emails(about 200) so that they continue on as opposed to printing one per page. I have tried with thunderbird and evolution and this does not seem possible. Would concatenating the individual mail files work or are there other unix utilities that could do ... | 2008/11/19 | [
"https://Stackoverflow.com/questions/301776",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1246613/"
] | Perl makes it pretty easy with the [Email::Abstract](http://search.cpan.org/~rjbs/Email-Abstract-2.134/lib/Email/Abstract.pm) module. Give the following script (maildump) a list of emails to dump out and then pipe it all into lpr...
maildump m1 m2 m3 m4 | lpr
```
#!/usr/bin/perl
use Email::Abstract;
while ($mfile... | I can say for sure about \*n\*x, but if it is possible to define a printer which only outputs text, and that will output to a text file, then you could print your batch to that printer and remove the form-feeds from the resulting text file.
I've used a similar technique in Windows: create a new printer using the Gener... |
301,776 | I would like to know if there is any easy way to print multiple emails(about 200) so that they continue on as opposed to printing one per page. I have tried with thunderbird and evolution and this does not seem possible. Would concatenating the individual mail files work or are there other unix utilities that could do ... | 2008/11/19 | [
"https://Stackoverflow.com/questions/301776",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1246613/"
] | Perl makes it pretty easy with the [Email::Abstract](http://search.cpan.org/~rjbs/Email-Abstract-2.134/lib/Email/Abstract.pm) module. Give the following script (maildump) a list of emails to dump out and then pipe it all into lpr...
maildump m1 m2 m3 m4 | lpr
```
#!/usr/bin/perl
use Email::Abstract;
while ($mfile... | If you're wanting to filter emails then I suggest finding where the data is stored and scripting a solution at that level.
On my Windows box, Thunderbird stores my Inbox in a rather large-ish file at
>
> C:\Documents and Settings\Bruce Axtens\Application Data\Thunderbird\Profiles\x5j9chtd.default\Mail\Local Folder... |
4,749,858 | I have a collection of data like so
```
Programme title | Episode | Subtitle | Performers | Description
```
Initially I normalised this into two table like so
```
PROGRAMME
progid | progtitle | description
EPISODE
epid | progid | episode | subtitle | description
```
I'm thinking I'd like to ... | 2011/01/20 | [
"https://Stackoverflow.com/questions/4749858",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/564045/"
] | It's many-to-many. One performer can be in multiple programs, and one program can have multiple performers.
There's plenty of information on the net (and in textbooks) about setting up many-to-may relationships. One such resource is here:
<http://www.tekstenuitleg.net/en/articles/software/database-design-tutorial/ma... | beside performer table you have to create a relation table
performer table
```
performerid | name | ...
```
relation table
```
performerid | progid
``` |
4,749,858 | I have a collection of data like so
```
Programme title | Episode | Subtitle | Performers | Description
```
Initially I normalised this into two table like so
```
PROGRAMME
progid | progtitle | description
EPISODE
epid | progid | episode | subtitle | description
```
I'm thinking I'd like to ... | 2011/01/20 | [
"https://Stackoverflow.com/questions/4749858",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/564045/"
] | Also, performers can change between episodes | beside performer table you have to create a relation table
performer table
```
performerid | name | ...
```
relation table
```
performerid | progid
``` |
20,019,801 | I'm working on a prototype mobile app and having difficulty returning back to the splash screen once the user button presses the Yes button on a modal (on the login page).
This is my code so far:
```
$("#login_cancel").click(function () {
$(function () {
$("#login_canceldialog").dialog({
... | 2013/11/16 | [
"https://Stackoverflow.com/questions/20019801",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/436493/"
] | try this to avoid reloading as your own answer has nothing to do with giving the `#splash` a top to down slide
```
$(document).ready(function () {
$("#splash_logo").hide().fadeIn(1500);
animateSignup()
function animateSignup() { //new function to animate signUp_btn
$("#signup_btn").animate({
"paddin... | Used - `location.reload();`
so code became:
```
function close_login() {
$("#login").animate({
"margin-top": "-=568px"
}, "slow").hide(1);
location.reload();
}
``` |
13,530 | The problem occurs within one particular unit of an apartment complex. All other units are fine. The problem has gradually gotten worse. All electricity within the house will flicker on and off. It is most obvious with the lights but TVs, stove, and other appliances are affected as well.
At first, this would only be t... | 2012/04/10 | [
"https://diy.stackexchange.com/questions/13530",
"https://diy.stackexchange.com",
"https://diy.stackexchange.com/users/5858/"
] | If you are the landlord I would have another electrician come out to check it. It be something like a factory defect in the subpanel or main panel. Every lug could be tightened and torqued to factory specs but the lug might be stripped out.
If you are the renter then I would make it clear to your landlord that this is... | There might be a break in the wire from the meter to the main panel. The break is small enough to work most of the time but under a large load it will increase in resistance. Or a big truck passing by may shake the ground enough to widen the crack. Try having that piece replaced.
Second to that, I would replace the m... |
13,530 | The problem occurs within one particular unit of an apartment complex. All other units are fine. The problem has gradually gotten worse. All electricity within the house will flicker on and off. It is most obvious with the lights but TVs, stove, and other appliances are affected as well.
At first, this would only be t... | 2012/04/10 | [
"https://diy.stackexchange.com/questions/13530",
"https://diy.stackexchange.com",
"https://diy.stackexchange.com/users/5858/"
] | If you are the landlord I would have another electrician come out to check it. It be something like a factory defect in the subpanel or main panel. Every lug could be tightened and torqued to factory specs but the lug might be stripped out.
If you are the renter then I would make it clear to your landlord that this is... | I would consider hiring a thermal imaging camera. Given what you have probably spent already, and the danger posed, you may want to invest in one that attaches to your Android or Apple smart phone. You can always sell it afterwards. In the UK, a 3 day hire is around $100.
I'd be inclined to look at the main breaker. V... |
31,902,195 | I have an object ( array of hashes ) and I need to convert it into ordered key value pairs.
This is object:
```
var places_info = [
{"place_id":180,"name":"Abc","city":"Gotham"},
{"place_id":161,"name":"Def","city":"Sin City"},
{"place_id":178,"name":"Ghi","city":"Timbuktu"},
{"place_id":179,"name":"Jkl","cit... | 2015/08/09 | [
"https://Stackoverflow.com/questions/31902195",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/196241/"
] | Until ES6, there is NO guaranteed order for properties on a Javascript object. They are unordered. If you need order and need to support environments before ES6, then you can't just use properties on an object and get a guaranteed order of those properties.
So your choice is to pick some other data structure that can... | The properties order in objects are not guaranted in JavaScript, you need to use an Array.
Take a look at this:
```
var obj = {
'180': 'Abc',
'161': 'Def',
'178': 'Ghi',
'179': 'Jkl',
'174': 'Mno'
};
for (var i in obj) { console.log(i); };
```
will give you:
161, 174, 178, 179, 180 |
31,902,195 | I have an object ( array of hashes ) and I need to convert it into ordered key value pairs.
This is object:
```
var places_info = [
{"place_id":180,"name":"Abc","city":"Gotham"},
{"place_id":161,"name":"Def","city":"Sin City"},
{"place_id":178,"name":"Ghi","city":"Timbuktu"},
{"place_id":179,"name":"Jkl","cit... | 2015/08/09 | [
"https://Stackoverflow.com/questions/31902195",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/196241/"
] | Until ES6, there is NO guaranteed order for properties on a Javascript object. They are unordered. If you need order and need to support environments before ES6, then you can't just use properties on an object and get a guaranteed order of those properties.
So your choice is to pick some other data structure that can... | Just use JavaScript's native `Map` data structure. It preserves order. We are now way past 2015 so it should be standard in almost any runtime.
e.g.
```js
const m = new Map([["greeting", "hello"], ["salutation", "welcome"]])
```
See Also <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Obje... |
6,661,151 | I have many of these "controllers":
```
app.get('/',function(req,res){
var stuff = { 'title': 'blah' };
res.render('mytemplate',stuff);
});
```
Notice res.render? I want to add this header to every response header I make:
`X-XSS-Protection: 0`
How can I add that response header automatically? | 2011/07/12 | [
"https://Stackoverflow.com/questions/6661151",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/179736/"
] | Use a [middleware](https://expressjs.com/en/guide/using-middleware.html)...
```
app.use(function (req, res, next) {
res.header("Access-Control-Allow-Origin", "*")
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept")
next()
})
```
But make sure you use it **before** your ... | I'd like to point out that none of these answer actually answer the question; the question is specifically relating to render responses; e.g. for an app like:
```
const router = require('express').Router();
router.use('/test.json', (req, res) => res.json({ test: 'hi' });
router.use('/test.html', (req, res) => res.rend... |
6,661,151 | I have many of these "controllers":
```
app.get('/',function(req,res){
var stuff = { 'title': 'blah' };
res.render('mytemplate',stuff);
});
```
Notice res.render? I want to add this header to every response header I make:
`X-XSS-Protection: 0`
How can I add that response header automatically? | 2011/07/12 | [
"https://Stackoverflow.com/questions/6661151",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/179736/"
] | ```
// global controller
app.get('/*',function(req,res,next){
res.header('X-XSS-Protection' , 0 );
next(); // http://expressjs.com/guide.html#passing-route control
});
```
Just make sure this is the first controller you add, order is significant. | I find that another good place to inject default headers is during the Routing Middleware. This way, all routes controlled by the router instance will receive the headers.
For example:
```js
//...
var router = express.Router();
// middleware for all routes
router.use(function(req, res, next) {
// inject default h... |
6,661,151 | I have many of these "controllers":
```
app.get('/',function(req,res){
var stuff = { 'title': 'blah' };
res.render('mytemplate',stuff);
});
```
Notice res.render? I want to add this header to every response header I make:
`X-XSS-Protection: 0`
How can I add that response header automatically? | 2011/07/12 | [
"https://Stackoverflow.com/questions/6661151",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/179736/"
] | ```
// global controller
app.get('/*',function(req,res,next){
res.header('X-XSS-Protection' , 0 );
next(); // http://expressjs.com/guide.html#passing-route control
});
```
Just make sure this is the first controller you add, order is significant. | For express 4.x, the idiomatic way is as follows:
### Implementation
```
// no mount path; executed for every request.
app.use(function (req, res, next) {
res.set('X-XSS-Protection', 0);
next();
});
```
### Test
```
describe('Response Headers', function () {
it('responds with header X-XSS-Protection: 0', fun... |
6,661,151 | I have many of these "controllers":
```
app.get('/',function(req,res){
var stuff = { 'title': 'blah' };
res.render('mytemplate',stuff);
});
```
Notice res.render? I want to add this header to every response header I make:
`X-XSS-Protection: 0`
How can I add that response header automatically? | 2011/07/12 | [
"https://Stackoverflow.com/questions/6661151",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/179736/"
] | For express 4.x, the idiomatic way is as follows:
### Implementation
```
// no mount path; executed for every request.
app.use(function (req, res, next) {
res.set('X-XSS-Protection', 0);
next();
});
```
### Test
```
describe('Response Headers', function () {
it('responds with header X-XSS-Protection: 0', fun... | I find that another good place to inject default headers is during the Routing Middleware. This way, all routes controlled by the router instance will receive the headers.
For example:
```js
//...
var router = express.Router();
// middleware for all routes
router.use(function(req, res, next) {
// inject default h... |
6,661,151 | I have many of these "controllers":
```
app.get('/',function(req,res){
var stuff = { 'title': 'blah' };
res.render('mytemplate',stuff);
});
```
Notice res.render? I want to add this header to every response header I make:
`X-XSS-Protection: 0`
How can I add that response header automatically? | 2011/07/12 | [
"https://Stackoverflow.com/questions/6661151",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/179736/"
] | For express 4.x, the idiomatic way is as follows:
### Implementation
```
// no mount path; executed for every request.
app.use(function (req, res, next) {
res.set('X-XSS-Protection', 0);
next();
});
```
### Test
```
describe('Response Headers', function () {
it('responds with header X-XSS-Protection: 0', fun... | I'd like to point out that none of these answer actually answer the question; the question is specifically relating to render responses; e.g. for an app like:
```
const router = require('express').Router();
router.use('/test.json', (req, res) => res.json({ test: 'hi' });
router.use('/test.html', (req, res) => res.rend... |
6,661,151 | I have many of these "controllers":
```
app.get('/',function(req,res){
var stuff = { 'title': 'blah' };
res.render('mytemplate',stuff);
});
```
Notice res.render? I want to add this header to every response header I make:
`X-XSS-Protection: 0`
How can I add that response header automatically? | 2011/07/12 | [
"https://Stackoverflow.com/questions/6661151",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/179736/"
] | you could create your own middleware method like so:
```
addToHeader = function (req, res, next) {
console.log("add to header called ... " + req.url);
res.header('X-XSS-Protection', '0');
next();
}
```
and then change your routes to sth like this:
```
app.get('/', addToHeader, function(req,res){
var stuff =... | I'd like to point out that none of these answer actually answer the question; the question is specifically relating to render responses; e.g. for an app like:
```
const router = require('express').Router();
router.use('/test.json', (req, res) => res.json({ test: 'hi' });
router.use('/test.html', (req, res) => res.rend... |
6,661,151 | I have many of these "controllers":
```
app.get('/',function(req,res){
var stuff = { 'title': 'blah' };
res.render('mytemplate',stuff);
});
```
Notice res.render? I want to add this header to every response header I make:
`X-XSS-Protection: 0`
How can I add that response header automatically? | 2011/07/12 | [
"https://Stackoverflow.com/questions/6661151",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/179736/"
] | For express 4.x, the idiomatic way is as follows:
### Implementation
```
// no mount path; executed for every request.
app.use(function (req, res, next) {
res.set('X-XSS-Protection', 0);
next();
});
```
### Test
```
describe('Response Headers', function () {
it('responds with header X-XSS-Protection: 0', fun... | you could create your own middleware method like so:
```
addToHeader = function (req, res, next) {
console.log("add to header called ... " + req.url);
res.header('X-XSS-Protection', '0');
next();
}
```
and then change your routes to sth like this:
```
app.get('/', addToHeader, function(req,res){
var stuff =... |
6,661,151 | I have many of these "controllers":
```
app.get('/',function(req,res){
var stuff = { 'title': 'blah' };
res.render('mytemplate',stuff);
});
```
Notice res.render? I want to add this header to every response header I make:
`X-XSS-Protection: 0`
How can I add that response header automatically? | 2011/07/12 | [
"https://Stackoverflow.com/questions/6661151",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/179736/"
] | ```
// global controller
app.get('/*',function(req,res,next){
res.header('X-XSS-Protection' , 0 );
next(); // http://expressjs.com/guide.html#passing-route control
});
```
Just make sure this is the first controller you add, order is significant. | you could create your own middleware method like so:
```
addToHeader = function (req, res, next) {
console.log("add to header called ... " + req.url);
res.header('X-XSS-Protection', '0');
next();
}
```
and then change your routes to sth like this:
```
app.get('/', addToHeader, function(req,res){
var stuff =... |
6,661,151 | I have many of these "controllers":
```
app.get('/',function(req,res){
var stuff = { 'title': 'blah' };
res.render('mytemplate',stuff);
});
```
Notice res.render? I want to add this header to every response header I make:
`X-XSS-Protection: 0`
How can I add that response header automatically? | 2011/07/12 | [
"https://Stackoverflow.com/questions/6661151",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/179736/"
] | You probably want to use [app.use](http://expressjs.com/api.html#app.use) with your own middleware:
```
app.use(function(req, res, next) {
res.header('X-XSS-Protection', 0);
next();
});
``` | I find that another good place to inject default headers is during the Routing Middleware. This way, all routes controlled by the router instance will receive the headers.
For example:
```js
//...
var router = express.Router();
// middleware for all routes
router.use(function(req, res, next) {
// inject default h... |
6,661,151 | I have many of these "controllers":
```
app.get('/',function(req,res){
var stuff = { 'title': 'blah' };
res.render('mytemplate',stuff);
});
```
Notice res.render? I want to add this header to every response header I make:
`X-XSS-Protection: 0`
How can I add that response header automatically? | 2011/07/12 | [
"https://Stackoverflow.com/questions/6661151",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/179736/"
] | ```
// global controller
app.get('/*',function(req,res,next){
res.header('X-XSS-Protection' , 0 );
next(); // http://expressjs.com/guide.html#passing-route control
});
```
Just make sure this is the first controller you add, order is significant. | You probably want to use [app.use](http://expressjs.com/api.html#app.use) with your own middleware:
```
app.use(function(req, res, next) {
res.header('X-XSS-Protection', 0);
next();
});
``` |
36,421,010 | I have a text file like below
```
A : abc
B : crs
C : rds
D : fgh
A: wer
B : tyu
C : uio
D : dfg
```
There can be any number of above blocks in the input text file.I want to create a json file from this.Here is my code:
```
import json
with open("<input file path>") as fd: # open fi... | 2016/04/05 | [
"https://Stackoverflow.com/questions/36421010",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5845411/"
] | ```
Use this
protected void showBackButton() {
mDrawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
mDrawerToggle.setDrawerIndicatorEnabled(false);
final Drawable upArrow = ContextCompat.getDrawable(this, R.drawable.ic_back); (R.drawable.ic_back==> your own drawable .png)
... | Try this:
```
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"/>
```
I.e. using `@style/ThemeOverlay.AppCompat.Da... |
1,388,799 | Instead of calling **regsvr32.exe**, one can register a .DLL using the following steps:
```
HINSTANCE hLib = ::LoadLibraryEx(dllPath, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
HRESULT (STDAPICALLTYPE* lpDllEntryPoint)(void);
(FARPROC&)lpDllEntryPoint = ::GetProcAddress(hLib, "DllRegisterServer");
const HRESULT hRes = (*lp... | 2009/09/07 | [
"https://Stackoverflow.com/questions/1388799",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/74612/"
] | COM registration requires write access to the `HKEY_LOCAL_MACHINE` part of the registry.
Under UAC, write access to the `HKEY_LOCAL_MACHINE` requires an *elevated* administrator.
The easiest way to get an elevated process is to create it with a manifest that specifies 'requireAdministrator' access. - Look under the P... | Regrettably, I couldn't get this to work for all DLLs, even with [Chris Becke's](https://stackoverflow.com/questions/1388799/programatically-registering-dlls-on-windows-vista-using-dllregisterserver/1389430#1389430) excellent tips. I didn't want to spend too much time solving the problem, so now I simply call **regsvr3... |
24,008,599 | I want to set the cursor position to last character in textbox.
I'm using this code.
```
$("#txt_search").focus();
```
In **chrome** it is set cursor to last but in **mozilla** it is in first. | 2014/06/03 | [
"https://Stackoverflow.com/questions/24008599",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2533907/"
] | Based on agstudy's answer, the correct code is:
```
ldtSUM<-lapply(ldt,function(x)x[, sum(V4), by = "V1,V3"]
``` | You had two parts to your problem:
The first part you have already solved by:
```
ldtSUM<-lapply(ldt,function(x)x[, sum(V4), by = "V1,V3"]
```
The second part is on initialization, and that can be solved by following:
```
ldtSUM <- list()
```
After this initialization if you run your original code:
```
for (i in... |
7,490,219 | I am very surprised by the strange exception, that I got.
```
class Threads {
public:
Threads() {}
~Threads() {}
void StartThread(int (*p)()); //pointer to a function
private:
HANDLE hThread;
DWORD dwThreadID;
};
```
Method StartThread should receive pointer... | 2011/09/20 | [
"https://Stackoverflow.com/questions/7490219",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/955445/"
] | The call convention is wrong:
LPTHREAD\_START\_ROUTINE is a \_\_stdcall method not a \_\_cdecl method, see the documentation here: <http://msdn.microsoft.com/en-us/library/aa964928.aspx>. | It looks like you are actually calling the function on this line...
```
(LPTHREAD_START_ROUTINE)(*p)()
```
...and it returns an int that you're casting. That just can't work. How about:
```
(LPTHREAD_START_ROUTINE)p
```
...instead? |
498,627 | After reading many pages of documentation and articles on [how to telnet](https://unix.stackexchange.com/questions/72116/freebsd-telnet-does-not-take-root-login) or SSH into FreeBSD as root, none have given me a solution that actually works. I am looking for a how-to-remote-into this FreeBSD in less than 10 easy steps.... | 2013/04/12 | [
"https://serverfault.com/questions/498627",
"https://serverfault.com",
"https://serverfault.com/users/78219/"
] | 1. Undo whatever you did to `inetd.conf`.
2. Edit `/etc/ssh/sshd_config`, add `PermitRootLogin yes`
3. run `/etc/rc.d/sshd start`
Telnet doesn't work on ssh. You have to connect via ssh in PuTTY.
If you have a firewall up, you'll need to punch a hole.
Security Note: #2 is a **really** terrible idea. You should eithe... | Enable SSH
```
vi /etc/rc.conf
sshd_enable="YES"
```
Start the SSH service
```
/etc/rc.d/sshd start
```
Chech the status
```
/etc/rc.d/sshd onestatus
``` |
25,562,757 | Is there an optimized equation for calculating if a sphere and line will intersect, i'm aware of the closest point solution but i was wondering if there was another. There's also the quadratic equation but it requires a lot of calculations, and i'm not sure of all the early outs that are possible with it. I know of two... | 2014/08/29 | [
"https://Stackoverflow.com/questions/25562757",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3901459/"
] | I don't think you can really get much better. You might be able to eliminate some simple cases . If say the start and end point of the line have x coordinates less that the sphere center minus the radius and ones above above the sphere center and ones below then it will not be possible. You could consider the cube surr... | look here [ray and ellipsoid intersection accuracy improvement](https://stackoverflow.com/q/25470493/2521214)
* just set `r[3]` as `(1/R*R,1/R*R,1/R*R)`
* or update equations to singular radius (can multiply whole equation by 1/(R\*R) later)
* in current state it need 3 x triple dot's, 1 x sqrt, 2 x div and some minor... |
52,337,034 | I have the arrow function below and I want to be able to return everything here to a component.
How do I return everything? Is it possible to use an export with this? The code below resides in
a js file.
```
const myTester = props => {
[
{
title: props.intl.formatMessage({
id: "ren_past_due"
... | 2018/09/14 | [
"https://Stackoverflow.com/questions/52337034",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2320476/"
] | Try doing `conda clean --all` before running this command. I got this from [this Github discussion](https://github.com/conda/conda/issues/7038#issuecomment-415893714). | Removing 'defaults' from the channels list in my .condarc file resolved this issue for me.
My .condarc file contained the following originally and I simply removed '-defaults' so that I only had conda-forge in my cnannels :
```
ssl_verify: true
channels:
- conda-forge
- defaults
``` |
1,533,507 | I'm sure this is an easy problem, but i can't think of a way (other than using javascript to force a postback) to get a list of checkboxes in the asp.net code behind.
each checkbox is in a seperate custom control so i can't use a checkboxlist.
any help would be much appreciated.
Thanks in advance | 2009/10/07 | [
"https://Stackoverflow.com/questions/1533507",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/142122/"
] | If you have a usercontrol with N number of checkboxes, you need to expose a public property holding the collection of ids, controls...whatever it is that you need access to from the parent container. | You can recursively traverse the hierarchy of the controls on a Page and just get the controls that are CheckBoxes
In your page you can declare a member that will be used to store the checkboxes:
```
private List<CheckBox> checkBoxes = new List<CheckBox>();
```
Using a recursive method you can traverse the controls... |
2,150,108 | What is the most efficient way to rotate a list in python?
Right now I have something like this:
```
>>> def rotate(l, n):
... return l[n:] + l[:n]
...
>>> l = [1,2,3,4]
>>> rotate(l,1)
[2, 3, 4, 1]
>>> rotate(l,2)
[3, 4, 1, 2]
>>> rotate(l,0)
[1, 2, 3, 4]
>>> rotate(l,-1)
[4, 1, 2, 3]
```
Is there a better wa... | 2010/01/27 | [
"https://Stackoverflow.com/questions/2150108",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/134397/"
] | A [`collections.deque`](http://docs.python.org/library/collections.html#deque-objects) is optimized for pulling and pushing on both ends. They even have a dedicated `rotate()` method.
```
from collections import deque
items = deque([1, 2])
items.append(3) # deque == [1, 2, 3]
items.rotate(1) # The deque... | I take this cost model as a reference:
<http://scripts.mit.edu/~6.006/fall07/wiki/index.php?title=Python_Cost_Model>
Your method of slicing the list and concatenating two sub-lists are linear-time operations. I would suggest using pop, which is a constant-time operation, e.g.:
```
def shift(list, n):
for i in ra... |
2,150,108 | What is the most efficient way to rotate a list in python?
Right now I have something like this:
```
>>> def rotate(l, n):
... return l[n:] + l[:n]
...
>>> l = [1,2,3,4]
>>> rotate(l,1)
[2, 3, 4, 1]
>>> rotate(l,2)
[3, 4, 1, 2]
>>> rotate(l,0)
[1, 2, 3, 4]
>>> rotate(l,-1)
[4, 1, 2, 3]
```
Is there a better wa... | 2010/01/27 | [
"https://Stackoverflow.com/questions/2150108",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/134397/"
] | I also got interested in this and compared some of the suggested solutions with [perfplot](https://github.com/nschloe/perfplot) (a small project of mine).
It turns out that Kelly Bundy's suggestion
```py
tmp = data[shift:]
tmp += data[:shift]
```
performs very well for all shifts.
Essentially, perfplot performs th... | If efficiency is your goal, (cycles? memory?) you may be better off looking at the array module: <http://docs.python.org/library/array.html>
Arrays do not have the overhead of lists.
As far as pure lists go though, what you have is about as good as you can hope to do. |
2,150,108 | What is the most efficient way to rotate a list in python?
Right now I have something like this:
```
>>> def rotate(l, n):
... return l[n:] + l[:n]
...
>>> l = [1,2,3,4]
>>> rotate(l,1)
[2, 3, 4, 1]
>>> rotate(l,2)
[3, 4, 1, 2]
>>> rotate(l,0)
[1, 2, 3, 4]
>>> rotate(l,-1)
[4, 1, 2, 3]
```
Is there a better wa... | 2010/01/27 | [
"https://Stackoverflow.com/questions/2150108",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/134397/"
] | I take this cost model as a reference:
<http://scripts.mit.edu/~6.006/fall07/wiki/index.php?title=Python_Cost_Model>
Your method of slicing the list and concatenating two sub-lists are linear-time operations. I would suggest using pop, which is a constant-time operation, e.g.:
```
def shift(list, n):
for i in ra... | For a list `X = ['a', 'b', 'c', 'd', 'e', 'f']` and a desired shift value of `shift` **less than list length**, we can define the function `list_shift()` as below
```
def list_shift(my_list, shift):
assert shift < len(my_list)
return my_list[shift:] + my_list[:shift]
```
Examples,
`list_shift(X,1)` returns... |
2,150,108 | What is the most efficient way to rotate a list in python?
Right now I have something like this:
```
>>> def rotate(l, n):
... return l[n:] + l[:n]
...
>>> l = [1,2,3,4]
>>> rotate(l,1)
[2, 3, 4, 1]
>>> rotate(l,2)
[3, 4, 1, 2]
>>> rotate(l,0)
[1, 2, 3, 4]
>>> rotate(l,-1)
[4, 1, 2, 3]
```
Is there a better wa... | 2010/01/27 | [
"https://Stackoverflow.com/questions/2150108",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/134397/"
] | What about just using [`pop(0)`](https://docs.python.org/3/tutorial/datastructures.html#more-on-lists)?
>
> `list.pop([i])`
>
>
> Remove the item at the given position in the list, and return it. If
> no index is specified, `a.pop()` removes and returns the last item in
> the list. (The square brackets around the... | What is the use case? Often, we don't actually need a fully shifted array --we just need to access a handful of elements in the shifted array.
Getting Python slices is runtime O(k) where k is the slice, so a sliced rotation is runtime N. The deque rotation command is also O(k). Can we do better?
Consider an array t... |
2,150,108 | What is the most efficient way to rotate a list in python?
Right now I have something like this:
```
>>> def rotate(l, n):
... return l[n:] + l[:n]
...
>>> l = [1,2,3,4]
>>> rotate(l,1)
[2, 3, 4, 1]
>>> rotate(l,2)
[3, 4, 1, 2]
>>> rotate(l,0)
[1, 2, 3, 4]
>>> rotate(l,-1)
[4, 1, 2, 3]
```
Is there a better wa... | 2010/01/27 | [
"https://Stackoverflow.com/questions/2150108",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/134397/"
] | It depends on what you want to have happen when you do this:
```
>>> shift([1,2,3], 14)
```
You might want to change your:
```
def shift(seq, n):
return seq[n:]+seq[:n]
```
to:
```
def shift(seq, n):
n = n % len(seq)
return seq[n:] + seq[:n]
``` | Just some notes on timing:
If you're starting with a list, `l.append(l.pop(0))` is the fastest method you can use. This can be shown with time complexity alone:
* deque.rotate is **O(k)** (k=number of elements)
* list to deque conversion is **O(n)**
* list.append and list.pop are both **O(1)**
So if you are starting... |
2,150,108 | What is the most efficient way to rotate a list in python?
Right now I have something like this:
```
>>> def rotate(l, n):
... return l[n:] + l[:n]
...
>>> l = [1,2,3,4]
>>> rotate(l,1)
[2, 3, 4, 1]
>>> rotate(l,2)
[3, 4, 1, 2]
>>> rotate(l,0)
[1, 2, 3, 4]
>>> rotate(l,-1)
[4, 1, 2, 3]
```
Is there a better wa... | 2010/01/27 | [
"https://Stackoverflow.com/questions/2150108",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/134397/"
] | Just some notes on timing:
If you're starting with a list, `l.append(l.pop(0))` is the fastest method you can use. This can be shown with time complexity alone:
* deque.rotate is **O(k)** (k=number of elements)
* list to deque conversion is **O(n)**
* list.append and list.pop are both **O(1)**
So if you are starting... | Another alternative:
```
def move(arr, n):
return [arr[(idx-n) % len(arr)] for idx,_ in enumerate(arr)]
``` |
2,150,108 | What is the most efficient way to rotate a list in python?
Right now I have something like this:
```
>>> def rotate(l, n):
... return l[n:] + l[:n]
...
>>> l = [1,2,3,4]
>>> rotate(l,1)
[2, 3, 4, 1]
>>> rotate(l,2)
[3, 4, 1, 2]
>>> rotate(l,0)
[1, 2, 3, 4]
>>> rotate(l,-1)
[4, 1, 2, 3]
```
Is there a better wa... | 2010/01/27 | [
"https://Stackoverflow.com/questions/2150108",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/134397/"
] | I think you've got the most efficient way
```
def shift(l,n):
n = n % len(l)
return l[-U:] + l[:-U]
``` | What is the use case? Often, we don't actually need a fully shifted array --we just need to access a handful of elements in the shifted array.
Getting Python slices is runtime O(k) where k is the slice, so a sliced rotation is runtime N. The deque rotation command is also O(k). Can we do better?
Consider an array t... |
2,150,108 | What is the most efficient way to rotate a list in python?
Right now I have something like this:
```
>>> def rotate(l, n):
... return l[n:] + l[:n]
...
>>> l = [1,2,3,4]
>>> rotate(l,1)
[2, 3, 4, 1]
>>> rotate(l,2)
[3, 4, 1, 2]
>>> rotate(l,0)
[1, 2, 3, 4]
>>> rotate(l,-1)
[4, 1, 2, 3]
```
Is there a better wa... | 2010/01/27 | [
"https://Stackoverflow.com/questions/2150108",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/134397/"
] | Just some notes on timing:
If you're starting with a list, `l.append(l.pop(0))` is the fastest method you can use. This can be shown with time complexity alone:
* deque.rotate is **O(k)** (k=number of elements)
* list to deque conversion is **O(n)**
* list.append and list.pop are both **O(1)**
So if you are starting... | What is the use case? Often, we don't actually need a fully shifted array --we just need to access a handful of elements in the shifted array.
Getting Python slices is runtime O(k) where k is the slice, so a sliced rotation is runtime N. The deque rotation command is also O(k). Can we do better?
Consider an array t... |
2,150,108 | What is the most efficient way to rotate a list in python?
Right now I have something like this:
```
>>> def rotate(l, n):
... return l[n:] + l[:n]
...
>>> l = [1,2,3,4]
>>> rotate(l,1)
[2, 3, 4, 1]
>>> rotate(l,2)
[3, 4, 1, 2]
>>> rotate(l,0)
[1, 2, 3, 4]
>>> rotate(l,-1)
[4, 1, 2, 3]
```
Is there a better wa... | 2010/01/27 | [
"https://Stackoverflow.com/questions/2150108",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/134397/"
] | I have similar thing. For example, to shift by two...
```
def Shift(*args):
return args[len(args)-2:]+args[:len(args)-2]
``` | I'm "old school" I define efficiency in lowest latency, processor time and memory usage, our nemesis are the bloated libraries. So there is exactly one right way:
```
def rotatel(nums):
back = nums.pop(0)
nums.append(back)
return nums
``` |
2,150,108 | What is the most efficient way to rotate a list in python?
Right now I have something like this:
```
>>> def rotate(l, n):
... return l[n:] + l[:n]
...
>>> l = [1,2,3,4]
>>> rotate(l,1)
[2, 3, 4, 1]
>>> rotate(l,2)
[3, 4, 1, 2]
>>> rotate(l,0)
[1, 2, 3, 4]
>>> rotate(l,-1)
[4, 1, 2, 3]
```
Is there a better wa... | 2010/01/27 | [
"https://Stackoverflow.com/questions/2150108",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/134397/"
] | I also got interested in this and compared some of the suggested solutions with [perfplot](https://github.com/nschloe/perfplot) (a small project of mine).
It turns out that Kelly Bundy's suggestion
```py
tmp = data[shift:]
tmp += data[:shift]
```
performs very well for all shifts.
Essentially, perfplot performs th... | The following method is O(n) in place with constant auxiliary memory:
```
def rotate(arr, shift):
pivot = shift % len(arr)
dst = 0
src = pivot
while (dst != src):
arr[dst], arr[src] = arr[src], arr[dst]
dst += 1
src += 1
if src == len(arr):
src = pivot
elif dst == pivot:
pivot =... |
23,205,057 | I am using the following to get count from netstat but the count appears on the next line. Here is what I am doing
```
$LIST = (netstat -an|select-string 443|select-string "LISTENING").count
write "LISTENING:" $LIST >> D:\entNew.txt
```
output is:
```
LISTENING: 40
```
How do I get the output to write like this :... | 2014/04/21 | [
"https://Stackoverflow.com/questions/23205057",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3557869/"
] | In your case just test :
"LISTENING:$LIST" >> D:\entNew.txt
However, I would not use `>>` but `set-content` CmdLet, and I'd prefer use a regular expression to filter the output of netstat. | Here's a one liner that I did to test solutions that results in what you want.
```
"Listening:$((netstat -an | select-string "Listening").count)"
``` |
10,962,069 | As a simple exercise to get me acquainted with Haskell, after idling around on Youtube and stumbling into the American Countdown game show, I wanted to make a solver for the Numbers game.
You get 6 numbers and need to combine them with `(+) (-) (*) (/)` in order to get a given result.
 ... | You cannot print the name of a function in Haskell (there may be some crazy tricks with meta programming but essentially you cannot). For your program it is probably easiest to define the list of operations as a list of pairs with a string of the name of each operator e.g.
```
let operations = [((+)," + "), ((-), " - ... |
10,962,069 | As a simple exercise to get me acquainted with Haskell, after idling around on Youtube and stumbling into the American Countdown game show, I wanted to make a solver for the Numbers game.
You get 6 numbers and need to combine them with `(+) (-) (*) (/)` in order to get a given result.

apply :: Operation -> Double -> Double -> Double
apply Add = (+)
apply Subtract = (-)
apply Multiply = (*)
apply Divide = (/)
``` | You cannot print the name of a function in Haskell (there may be some crazy tricks with meta programming but essentially you cannot). For your program it is probably easiest to define the list of operations as a list of pairs with a string of the name of each operator e.g.
```
let operations = [((+)," + "), ((-), " - ... |
60,595 | In the normal workflow of image processing, there are multiple operations, increase image contrast, image denoising, image deblur and image super-resolution. What are the sequence/order of performing these different operations. Are there any overlap among these operations? | 2019/09/09 | [
"https://dsp.stackexchange.com/questions/60595",
"https://dsp.stackexchange.com",
"https://dsp.stackexchange.com/users/670/"
] | If your image is modeled as an image which is noisy, blurry and heavily decimated the optimal thing to do is estimate the image given that model.
The model is well defined in [@Laurent Duval](https://dsp.stackexchange.com/users/15892/laurent-duval)'s [answer](https://dsp.stackexchange.com/a/60605/128).
I'd remark ... | Contrast, additive noise, (invariant) blurring and subsampling could be formulated together in a single optimization framework. This can theoretically be dealt with, provided that loss and penalty functions are tractable, in many fashions, globally or in an iterative fashion. So they overlap. A possible global model is... |
60,595 | In the normal workflow of image processing, there are multiple operations, increase image contrast, image denoising, image deblur and image super-resolution. What are the sequence/order of performing these different operations. Are there any overlap among these operations? | 2019/09/09 | [
"https://dsp.stackexchange.com/questions/60595",
"https://dsp.stackexchange.com",
"https://dsp.stackexchange.com/users/670/"
] | Contrast, additive noise, (invariant) blurring and subsampling could be formulated together in a single optimization framework. This can theoretically be dealt with, provided that loss and penalty functions are tractable, in many fashions, globally or in an iterative fashion. So they overlap. A possible global model is... | I suggest you take a look at this paper:
*End-to-End Learning for Joint Image Demosaicing, Denoising and Super-Resolution*.
in **Section 3. Proposed method**, they have discussed the execution order of image demosaicing, denoising, and super-resolution. From the paper,
>
> For the mixture problem of image demos... |
60,595 | In the normal workflow of image processing, there are multiple operations, increase image contrast, image denoising, image deblur and image super-resolution. What are the sequence/order of performing these different operations. Are there any overlap among these operations? | 2019/09/09 | [
"https://dsp.stackexchange.com/questions/60595",
"https://dsp.stackexchange.com",
"https://dsp.stackexchange.com/users/670/"
] | If your image is modeled as an image which is noisy, blurry and heavily decimated the optimal thing to do is estimate the image given that model.
The model is well defined in [@Laurent Duval](https://dsp.stackexchange.com/users/15892/laurent-duval)'s [answer](https://dsp.stackexchange.com/a/60605/128).
I'd remark ... | I suggest you take a look at this paper:
*End-to-End Learning for Joint Image Demosaicing, Denoising and Super-Resolution*.
in **Section 3. Proposed method**, they have discussed the execution order of image demosaicing, denoising, and super-resolution. From the paper,
>
> For the mixture problem of image demos... |
3,074,130 | I'm building a website with ASP.NET MVC where one feature displays some points on a Google map, using the Google Maps Javascript API. As I have a lot of points, I don't want to fetch them all; rather, I want to get only the ones that are in the current view area that the user is looking at on the map (the bounding box)... | 2010/06/19 | [
"https://Stackoverflow.com/questions/3074130",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/130164/"
] | It looks like you're looking for the `idle` event:
>
> This event is fired when the map becomes idle after panning or zooming.
>
>
>
Example:
```
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>Google Maps Events</title>
<script src="http://map... | i think you need use an listener...
in this case an event listener..
[gmaps events reference](http://code.google.com/apis/maps/documentation/javascript/v2/events.html)
if you use v3 search on v3 reference for listeners |
3,074,130 | I'm building a website with ASP.NET MVC where one feature displays some points on a Google map, using the Google Maps Javascript API. As I have a lot of points, I don't want to fetch them all; rather, I want to get only the ones that are in the current view area that the user is looking at on the map (the bounding box)... | 2010/06/19 | [
"https://Stackoverflow.com/questions/3074130",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/130164/"
] | It looks like you're looking for the `idle` event:
>
> This event is fired when the map becomes idle after panning or zooming.
>
>
>
Example:
```
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>Google Maps Events</title>
<script src="http://map... | this is a list of Gevents-> [here](http://econym.org.uk/gmap/gevent.htm)
probably are not listed all |
1,382,976 | I'm trying to store today's date in a sqlite table as a string in a 24-hour time format regardless of the user's locale. Because NSDate honours the user's locale, this code returns different results depending on the user's location:
```
NSLog(@"The date is %@", [NSDate date]);
```
If their locale is set to the Unite... | 2009/09/05 | [
"https://Stackoverflow.com/questions/1382976",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/88487/"
] | In my previous answer I thought you were having issues with SQLite Persistent Objects, but that's not the case. I think you've simply misunderstood what the following code is actually doing:
```
NSLog(@"The date is %@", [NSDate date]);
```
The reason why you're getting different log output under different locales is... | You could use the sqlite `DATETIME` type, and actually store the date instead of a string. You can use `NSDateFormatter` to define how the date is displayed to the user. |
1,382,976 | I'm trying to store today's date in a sqlite table as a string in a 24-hour time format regardless of the user's locale. Because NSDate honours the user's locale, this code returns different results depending on the user's location:
```
NSLog(@"The date is %@", [NSDate date]);
```
If their locale is set to the Unite... | 2009/09/05 | [
"https://Stackoverflow.com/questions/1382976",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/88487/"
] | Update: in the end I chose to override the user's locale before manipulating the date and storing it, by using NSLocale. So, instead of this:
```
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss.SSSS"];
NSString *formattedDateString = [dateFormatter... | You could use the sqlite `DATETIME` type, and actually store the date instead of a string. You can use `NSDateFormatter` to define how the date is displayed to the user. |
1,382,976 | I'm trying to store today's date in a sqlite table as a string in a 24-hour time format regardless of the user's locale. Because NSDate honours the user's locale, this code returns different results depending on the user's location:
```
NSLog(@"The date is %@", [NSDate date]);
```
If their locale is set to the Unite... | 2009/09/05 | [
"https://Stackoverflow.com/questions/1382976",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/88487/"
] | In my previous answer I thought you were having issues with SQLite Persistent Objects, but that's not the case. I think you've simply misunderstood what the following code is actually doing:
```
NSLog(@"The date is %@", [NSDate date]);
```
The reason why you're getting different log output under different locales is... | You might consider [swizzling](http://www.cocoadev.com/index.pl?MethodSwizzling) the `[NSDate date]` call to always apply the US locale date formatter. |
1,382,976 | I'm trying to store today's date in a sqlite table as a string in a 24-hour time format regardless of the user's locale. Because NSDate honours the user's locale, this code returns different results depending on the user's location:
```
NSLog(@"The date is %@", [NSDate date]);
```
If their locale is set to the Unite... | 2009/09/05 | [
"https://Stackoverflow.com/questions/1382976",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/88487/"
] | Update: in the end I chose to override the user's locale before manipulating the date and storing it, by using NSLocale. So, instead of this:
```
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss.SSSS"];
NSString *formattedDateString = [dateFormatter... | You might consider [swizzling](http://www.cocoadev.com/index.pl?MethodSwizzling) the `[NSDate date]` call to always apply the US locale date formatter. |
1,382,976 | I'm trying to store today's date in a sqlite table as a string in a 24-hour time format regardless of the user's locale. Because NSDate honours the user's locale, this code returns different results depending on the user's location:
```
NSLog(@"The date is %@", [NSDate date]);
```
If their locale is set to the Unite... | 2009/09/05 | [
"https://Stackoverflow.com/questions/1382976",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/88487/"
] | In my previous answer I thought you were having issues with SQLite Persistent Objects, but that's not the case. I think you've simply misunderstood what the following code is actually doing:
```
NSLog(@"The date is %@", [NSDate date]);
```
The reason why you're getting different log output under different locales is... | This looks like a bug in SQLite Persistent Objects. The library takes your NSDate instance and serialises it as a string in the format `@"yyyy-MM-dd HH:mm:ss.SSSS"`, which means that the timezone information is actually being thrown out. When the date string is converted back into an NSDate, the timezone is assumed to ... |
1,382,976 | I'm trying to store today's date in a sqlite table as a string in a 24-hour time format regardless of the user's locale. Because NSDate honours the user's locale, this code returns different results depending on the user's location:
```
NSLog(@"The date is %@", [NSDate date]);
```
If their locale is set to the Unite... | 2009/09/05 | [
"https://Stackoverflow.com/questions/1382976",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/88487/"
] | Update: in the end I chose to override the user's locale before manipulating the date and storing it, by using NSLocale. So, instead of this:
```
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss.SSSS"];
NSString *formattedDateString = [dateFormatter... | This looks like a bug in SQLite Persistent Objects. The library takes your NSDate instance and serialises it as a string in the format `@"yyyy-MM-dd HH:mm:ss.SSSS"`, which means that the timezone information is actually being thrown out. When the date string is converted back into an NSDate, the timezone is assumed to ... |
11,627,797 | Can't seem to find the definitive answer to this. What restrictions should I look out for between the two? I currently use foursquare exclusively, but sometimes there are places not in foursquare that maybe I want to use Google for.
**Update**
I use the 4sq API only for the name of the place and lat/lng. I don't want... | 2012/07/24 | [
"https://Stackoverflow.com/questions/11627797",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/61320/"
] | <https://developer.foursquare.com/overview/community> explicitly says
"Venues Database Usage
...
DON'T perform a search across both foursquare and Google Places, then return a combination of their results/data." | In the "Venue database usage" Foursquare policy seems to accept a combined use of their API with others as long as the rule of attribution is addressed:
"You can show information from these kinds of sources side by side, so long as the data from Foursquare is in its original form and clearly attributed to us. As a rul... |
25,235,234 | I can dynamically create textboxes and labels using numericUpDown1, but i cannot decrement when the user wants to decrease the number of textboxes and labels to be used.
Here is my code :
```
TextBox textbox = new TextBox();
Point p = new Point(35, 40 * i);
textbox.Location = p;
textbox.Size = new System.Drawing.Siz... | 2014/08/11 | [
"https://Stackoverflow.com/questions/25235234",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2800283/"
] | I don't really like dynamically adding and removing only by the name of the control.
What I like to do is manage the list of controls myself and call `Add` or `Remove` with the actual control:
```
private readonly List<TextBox> _txts = new List<TextBox>();
// Then you can add a textbox with:
TextBox txt = // init a n... | gb\_addPos.Controls.remove("txtbox\_" + I); |
58,914,478 | I have tried to do this in java however the **&&** symbols keep on giving error.
Below is the code that I used:
```java
int d = 18;
{
if ((d % 2) && (d% 3));
{
System.out.println("True!");
}
{
System.out.println("False!");
}
}
```
This is my code. I am not sure why its no... | 2019/11/18 | [
"https://Stackoverflow.com/questions/58914478",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Please learn about the modulus operator, and how to [check divisibility in java](https://stackoverflow.com/questions/8260690/how-to-check-if-number-is-divisible-by-a-certain-number).
```
if ((d % 2 == 0) && (d % 3 == 0))
{
System.out.println("True!");
}
```
Also, you had a rogue semi-colon at the end of your if ... | 1. `if ((d % 2) && (d% 3));` you have a semicolon `;` at the end,
remove it.
2. If `d == 18`, then `((d%2) && (d%3)) = (0 && 0) = 0` So in this
case, What java sees is: `if(0){ // ... }`
If I remember correctly, this is valid in C/C++, but not in Java. That is why you get error.
Anyways, to fix the problem, you ca... |
58,914,478 | I have tried to do this in java however the **&&** symbols keep on giving error.
Below is the code that I used:
```java
int d = 18;
{
if ((d % 2) && (d% 3));
{
System.out.println("True!");
}
{
System.out.println("False!");
}
}
```
This is my code. I am not sure why its no... | 2019/11/18 | [
"https://Stackoverflow.com/questions/58914478",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Please learn about the modulus operator, and how to [check divisibility in java](https://stackoverflow.com/questions/8260690/how-to-check-if-number-is-divisible-by-a-certain-number).
```
if ((d % 2 == 0) && (d % 3 == 0))
{
System.out.println("True!");
}
```
Also, you had a rogue semi-colon at the end of your if ... | `if` condition expects boolean. `Mod` operation would not return boolean, this is why compiler is intelligent and gives you this error.
if you try to run
```
if (1 && 2) // this will give you an error as well.
```
The expressions need to evaluate to a boolean (either true or false) in order to understand operato... |
69,295,288 | **BLADE FILE FOR EDIT**
```
<div class="form-group mb-3">
<label>Country:</label>
<div class="col-sm-4">
<select id="country-dd" name="country[]" class="js-example-basic-multiple form-control" multiple="multiple">
@foreach... | 2021/09/23 | [
"https://Stackoverflow.com/questions/69295288",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16956728/"
] | I think you missed to assign key to form widget
```
body: Form(
key: _formKey,
child: Padding(
...
``` | You have to pass the key to the Form for the form to know it has a key:
```
Scaffold(
body: Form(
key: _formKey, // <== here
child: Padding(
``` |
56,911,942 | i trying to create fields.One2Many for my invoice module, i create two different module, one called ms\_produk and another called invoice, then for the ms\_produk i use as master product, which serve CRUD for item and have a table named "ms\_produk\_ms\_produk"
here is my ms\_produk model looked like :
```
# -*- codi... | 2019/07/06 | [
"https://Stackoverflow.com/questions/56911942",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2666368/"
] | Change the newly added section as,
```
<record id="salesorder_tree" model="ir.ui.view">
<field name="name">salesorder.form.tree</field>
<field name="model">salesorder.salesorder</field>
<field name="type">tree</field>
<field name='arch' type="xml">
<field name='detail... | In your view define the fields you want in inside One2many field and make sure you've added editable in tree view. If you want to add records from another model to field in your model you can use Many2many field and can choose product from list view.
Many2many field can be used as tree view or other view using widget
C... |
56,911,942 | i trying to create fields.One2Many for my invoice module, i create two different module, one called ms\_produk and another called invoice, then for the ms\_produk i use as master product, which serve CRUD for item and have a table named "ms\_produk\_ms\_produk"
here is my ms\_produk model looked like :
```
# -*- codi... | 2019/07/06 | [
"https://Stackoverflow.com/questions/56911942",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2666368/"
] | Change the newly added section as,
```
<record id="salesorder_tree" model="ir.ui.view">
<field name="name">salesorder.form.tree</field>
<field name="model">salesorder.salesorder</field>
<field name="type">tree</field>
<field name='arch' type="xml">
<field name='detail... | `@Terrence Poe my bad, i already update my code to form view, but still error, can u help me with full code?`
define your x2m field as a list.
```xml
<!-- form view -->
<record model="ir.ui.view" id="browse_msproduk_form_view">
<field name="name">salesorder.form</field>
<field name="model">salesorder.salesord... |
3,501,652 | I've written this simple Carousel. At the moment I'm using setInterval to run my nextSlide function at certain intervals. I want to defer the timer from running when a user clicks on the navigation links for a certain length of time.
Check it out here
<http://jsbin.com/uzixi3/3/edit>
Any feedback on how the rest is w... | 2010/08/17 | [
"https://Stackoverflow.com/questions/3501652",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/338104/"
] | You could do something like this: <http://jsbin.com/uzixi3/5/edit>
The interval part is here:
```
var int = setInterval($.fn.nextSlide, 3000);
$("#slideNavigation a").click(function() {
clearInterval(int);
setTimeout(function() {
setInterval($.fn.nextSlide, 3000);
}, 10000);
});
```
I made some other twea... | You can save the return value of `setInterval` in a variable to refer to it later - that way you can cancel it if you need to, or restart it.
See [this MDC article](https://developer.mozilla.org/en/window.setInterval) for more details.
The basics are:
```
intervalID = setInterval(flashText, 1000);
//do something...... |
3,501,652 | I've written this simple Carousel. At the moment I'm using setInterval to run my nextSlide function at certain intervals. I want to defer the timer from running when a user clicks on the navigation links for a certain length of time.
Check it out here
<http://jsbin.com/uzixi3/3/edit>
Any feedback on how the rest is w... | 2010/08/17 | [
"https://Stackoverflow.com/questions/3501652",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/338104/"
] | You can save the return value of `setInterval` in a variable to refer to it later - that way you can cancel it if you need to, or restart it.
See [this MDC article](https://developer.mozilla.org/en/window.setInterval) for more details.
The basics are:
```
intervalID = setInterval(flashText, 1000);
//do something...... | The above code really helped. Thanks Nick. I made a few minor adjustments so that once you clicked the function: the timer would stop, the function would execute, and then the timer initiates and resumes regular intervals.
make sure you re-assign the `var int` to the new `interval` you create within the `click functio... |
3,501,652 | I've written this simple Carousel. At the moment I'm using setInterval to run my nextSlide function at certain intervals. I want to defer the timer from running when a user clicks on the navigation links for a certain length of time.
Check it out here
<http://jsbin.com/uzixi3/3/edit>
Any feedback on how the rest is w... | 2010/08/17 | [
"https://Stackoverflow.com/questions/3501652",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/338104/"
] | You can save the return value of `setInterval` in a variable to refer to it later - that way you can cancel it if you need to, or restart it.
See [this MDC article](https://developer.mozilla.org/en/window.setInterval) for more details.
The basics are:
```
intervalID = setInterval(flashText, 1000);
//do something...... | See:
```
var IntID = setTimer();
function setTimer(){
i = setInterval(startSlider, 4000);
return i;
}
function stopSlider() {
clearInterval(IntID);
}
//Restart Timer
// Option 1 make a restartSlider function and call it
$("#button").click(restartSlider);
function restartSlider(){
IntID = setTimer()... |
3,501,652 | I've written this simple Carousel. At the moment I'm using setInterval to run my nextSlide function at certain intervals. I want to defer the timer from running when a user clicks on the navigation links for a certain length of time.
Check it out here
<http://jsbin.com/uzixi3/3/edit>
Any feedback on how the rest is w... | 2010/08/17 | [
"https://Stackoverflow.com/questions/3501652",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/338104/"
] | You could do something like this: <http://jsbin.com/uzixi3/5/edit>
The interval part is here:
```
var int = setInterval($.fn.nextSlide, 3000);
$("#slideNavigation a").click(function() {
clearInterval(int);
setTimeout(function() {
setInterval($.fn.nextSlide, 3000);
}, 10000);
});
```
I made some other twea... | The above code really helped. Thanks Nick. I made a few minor adjustments so that once you clicked the function: the timer would stop, the function would execute, and then the timer initiates and resumes regular intervals.
make sure you re-assign the `var int` to the new `interval` you create within the `click functio... |
3,501,652 | I've written this simple Carousel. At the moment I'm using setInterval to run my nextSlide function at certain intervals. I want to defer the timer from running when a user clicks on the navigation links for a certain length of time.
Check it out here
<http://jsbin.com/uzixi3/3/edit>
Any feedback on how the rest is w... | 2010/08/17 | [
"https://Stackoverflow.com/questions/3501652",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/338104/"
] | You could do something like this: <http://jsbin.com/uzixi3/5/edit>
The interval part is here:
```
var int = setInterval($.fn.nextSlide, 3000);
$("#slideNavigation a").click(function() {
clearInterval(int);
setTimeout(function() {
setInterval($.fn.nextSlide, 3000);
}, 10000);
});
```
I made some other twea... | See:
```
var IntID = setTimer();
function setTimer(){
i = setInterval(startSlider, 4000);
return i;
}
function stopSlider() {
clearInterval(IntID);
}
//Restart Timer
// Option 1 make a restartSlider function and call it
$("#button").click(restartSlider);
function restartSlider(){
IntID = setTimer()... |
55,676 | I'm looking to find some resources to read about the following:
When we talk about a general concept (the word pencil in "a pencil is made of wood"), we actually have a mental image of a **particular** object in our mind (a particular pencil with a particular color in the example).
I'm looking to read about this an... | 2018/09/22 | [
"https://philosophy.stackexchange.com/questions/55676",
"https://philosophy.stackexchange.com",
"https://philosophy.stackexchange.com/users/35091/"
] | Ernst Mach and Julian Barbour suggest that *time is our perception of change*, and perhaps that's one of the best definitions of time I've found. The only physical fact lying under such definition is *change*, which we can perceive subjectively.
Before answering your question, a mental experiment. Imagine you are a pr... | Time, as we know it is a method of tracking events, the "time" we know is something that is defined by man, but something defined by man is not always created by them, "time" will always flow, without time, we would not be able to see, hear, think, thus be.
>
> That is, if everything in the universe suddenly stopped,... |
55,676 | I'm looking to find some resources to read about the following:
When we talk about a general concept (the word pencil in "a pencil is made of wood"), we actually have a mental image of a **particular** object in our mind (a particular pencil with a particular color in the example).
I'm looking to read about this an... | 2018/09/22 | [
"https://philosophy.stackexchange.com/questions/55676",
"https://philosophy.stackexchange.com",
"https://philosophy.stackexchange.com/users/35091/"
] | Ernst Mach and Julian Barbour suggest that *time is our perception of change*, and perhaps that's one of the best definitions of time I've found. The only physical fact lying under such definition is *change*, which we can perceive subjectively.
Before answering your question, a mental experiment. Imagine you are a pr... | The interval of a second is currently defined as exactly 9 192 631 770 cycles of a Caesium atomic clock. Furthermore the definition has changed several times.
>
> <https://en.wikipedia.org/wiki/Second>
>
>
>
From this we see that: 1. The interval of a second is completely arbitrarily chosen. 2. Scientists take gr... |
55,676 | I'm looking to find some resources to read about the following:
When we talk about a general concept (the word pencil in "a pencil is made of wood"), we actually have a mental image of a **particular** object in our mind (a particular pencil with a particular color in the example).
I'm looking to read about this an... | 2018/09/22 | [
"https://philosophy.stackexchange.com/questions/55676",
"https://philosophy.stackexchange.com",
"https://philosophy.stackexchange.com/users/35091/"
] | Ernst Mach and Julian Barbour suggest that *time is our perception of change*, and perhaps that's one of the best definitions of time I've found. The only physical fact lying under such definition is *change*, which we can perceive subjectively.
Before answering your question, a mental experiment. Imagine you are a pr... | It depends.
If nothing is changing because in fact there is nothing there then it's right to say that no time is passing because there is nothing there including time.
If nothing is changing because everything is actually in stasis but could potentially change then time is passing.
If nothing is changing because ev... |
55,676 | I'm looking to find some resources to read about the following:
When we talk about a general concept (the word pencil in "a pencil is made of wood"), we actually have a mental image of a **particular** object in our mind (a particular pencil with a particular color in the example).
I'm looking to read about this an... | 2018/09/22 | [
"https://philosophy.stackexchange.com/questions/55676",
"https://philosophy.stackexchange.com",
"https://philosophy.stackexchange.com/users/35091/"
] | There's no contradiction between "time is something fundamental," a physics/metaphysics thesis, and "time is a concept invented to describe how we experience events," an epistemic/conceptual thesis. I would combine a "don't know" answer to time (or rather, spacetime) being fundamental, with a "yes" to your second optio... | The interval of a second is currently defined as exactly 9 192 631 770 cycles of a Caesium atomic clock. Furthermore the definition has changed several times.
>
> <https://en.wikipedia.org/wiki/Second>
>
>
>
From this we see that: 1. The interval of a second is completely arbitrarily chosen. 2. Scientists take gr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.