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
17,064
``` echo -e 'one two three\nfour five six\nseven eight nine' one two three four five six seven eight nine ``` how can I do some "MAGIC" do get this output?: ``` three six nine ``` UPDATE: I don't need it in this specific way, I need a general solution so that no matter how many columns are in a row, e.g.: awk alwa...
2011/07/20
[ "https://unix.stackexchange.com/questions/17064", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/6960/" ]
Try: ``` echo -e 'one two three\nfour five six\nseven eight nine' | awk '{print $NF}' ```
It can also be done using `'sed'`: ``` echo -e 'one two three\nfour five six\nseven eight nine' | sed -e 's/^.* \([^ ]*\)$/\1/' ``` **Update:** or more simply: ``` echo -e 'one two three\nfour five six\nseven eight nine' | sed -e 's/^.* //' ```
17,064
``` echo -e 'one two three\nfour five six\nseven eight nine' one two three four five six seven eight nine ``` how can I do some "MAGIC" do get this output?: ``` three six nine ``` UPDATE: I don't need it in this specific way, I need a general solution so that no matter how many columns are in a row, e.g.: awk alwa...
2011/07/20
[ "https://unix.stackexchange.com/questions/17064", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/6960/" ]
Or using [`cut`](http://linux.about.com/od/commands/l/blcmdl1_cut.htm): ``` echo -e 'one two three\nfour five six\nseven eight nine' | cut -f 3 -d' ' ``` although this does not satisfy the 'general solution' requirement. Using [`rev`](http://linux.about.com/library/cmd/blcmdl1_rev.htm) twice we can solve this as wel...
In perl this can be done as follows: ``` #!/usr/bin/perl #create a line of arbitrary data $line = "1 2 3 4 5"; # splt the line into an array (we call the array 'array', for lolz) @array = split(' ', $line); # print the last element in the array, followed by a newline character; print "$array[-1]\n"; ``` output: ...
17,064
``` echo -e 'one two three\nfour five six\nseven eight nine' one two three four five six seven eight nine ``` how can I do some "MAGIC" do get this output?: ``` three six nine ``` UPDATE: I don't need it in this specific way, I need a general solution so that no matter how many columns are in a row, e.g.: awk alwa...
2011/07/20
[ "https://unix.stackexchange.com/questions/17064", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/6960/" ]
Try `grep` (shorter/simpler, but 3x slower than `awk` because of regex usage): ``` grep -o '\S\+$' <(echo -e '... seven eight nine') ``` Or `ex` (even more slower, but it prints the whole buffer after finish, more useful when it needs to be sorted or edited in-place): ``` ex -s +'%s/^.*\s//g' -c'%p|q!' <(echo -e '....
``` ... | perl -lane 'print $F[-1]' ```
17,064
``` echo -e 'one two three\nfour five six\nseven eight nine' one two three four five six seven eight nine ``` how can I do some "MAGIC" do get this output?: ``` three six nine ``` UPDATE: I don't need it in this specific way, I need a general solution so that no matter how many columns are in a row, e.g.: awk alwa...
2011/07/20
[ "https://unix.stackexchange.com/questions/17064", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/6960/" ]
``` ... | perl -lane 'print $F[-1]' ```
In perl this can be done as follows: ``` #!/usr/bin/perl #create a line of arbitrary data $line = "1 2 3 4 5"; # splt the line into an array (we call the array 'array', for lolz) @array = split(' ', $line); # print the last element in the array, followed by a newline character; print "$array[-1]\n"; ``` output: ...
17,064
``` echo -e 'one two three\nfour five six\nseven eight nine' one two three four five six seven eight nine ``` how can I do some "MAGIC" do get this output?: ``` three six nine ``` UPDATE: I don't need it in this specific way, I need a general solution so that no matter how many columns are in a row, e.g.: awk alwa...
2011/07/20
[ "https://unix.stackexchange.com/questions/17064", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/6960/" ]
It's easier than you think. ``` $ echo one two three | awk '{print $NF}' three ```
Using `awk` you can first check if there is at least one column. ``` echo | awk '{if (NF >= 1) print $NF}' echo 1 2 3 | awk '{if (NF >= 1) print $NF}' ```
17,064
``` echo -e 'one two three\nfour five six\nseven eight nine' one two three four five six seven eight nine ``` how can I do some "MAGIC" do get this output?: ``` three six nine ``` UPDATE: I don't need it in this specific way, I need a general solution so that no matter how many columns are in a row, e.g.: awk alwa...
2011/07/20
[ "https://unix.stackexchange.com/questions/17064", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/6960/" ]
``` ... | perl -lane 'print $F[-1]' ```
Using `awk` you can first check if there is at least one column. ``` echo | awk '{if (NF >= 1) print $NF}' echo 1 2 3 | awk '{if (NF >= 1) print $NF}' ```
17,064
``` echo -e 'one two three\nfour five six\nseven eight nine' one two three four five six seven eight nine ``` how can I do some "MAGIC" do get this output?: ``` three six nine ``` UPDATE: I don't need it in this specific way, I need a general solution so that no matter how many columns are in a row, e.g.: awk alwa...
2011/07/20
[ "https://unix.stackexchange.com/questions/17064", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/6960/" ]
Try `grep` (shorter/simpler, but 3x slower than `awk` because of regex usage): ``` grep -o '\S\+$' <(echo -e '... seven eight nine') ``` Or `ex` (even more slower, but it prints the whole buffer after finish, more useful when it needs to be sorted or edited in-place): ``` ex -s +'%s/^.*\s//g' -c'%p|q!' <(echo -e '....
It can also be done using `'sed'`: ``` echo -e 'one two three\nfour five six\nseven eight nine' | sed -e 's/^.* \([^ ]*\)$/\1/' ``` **Update:** or more simply: ``` echo -e 'one two three\nfour five six\nseven eight nine' | sed -e 's/^.* //' ```
17,064
``` echo -e 'one two three\nfour five six\nseven eight nine' one two three four five six seven eight nine ``` how can I do some "MAGIC" do get this output?: ``` three six nine ``` UPDATE: I don't need it in this specific way, I need a general solution so that no matter how many columns are in a row, e.g.: awk alwa...
2011/07/20
[ "https://unix.stackexchange.com/questions/17064", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/6960/" ]
Or using [`cut`](http://linux.about.com/od/commands/l/blcmdl1_cut.htm): ``` echo -e 'one two three\nfour five six\nseven eight nine' | cut -f 3 -d' ' ``` although this does not satisfy the 'general solution' requirement. Using [`rev`](http://linux.about.com/library/cmd/blcmdl1_rev.htm) twice we can solve this as wel...
Using `awk` you can first check if there is at least one column. ``` echo | awk '{if (NF >= 1) print $NF}' echo 1 2 3 | awk '{if (NF >= 1) print $NF}' ```
98,552
Im trying to create some realistic mockups of canvas prints laying next to cars, or even hanging on walls. Need to know that extra step i need to know to make these look real. [![enter image description here](https://i.stack.imgur.com/EuHYj.jpg)](https://i.stack.imgur.com/EuHYj.jpg)
2017/09/18
[ "https://graphicdesign.stackexchange.com/questions/98552", "https://graphicdesign.stackexchange.com", "https://graphicdesign.stackexchange.com/users/103032/" ]
1) When combining images from multiple sources, ideally you want to use images of the same quality. The color looks fine but the quality of the canvas/text looks much nicer than the background. I would suggest finding a higher-resolution background image. You can also tell by the sharp border of the canvas. 2) Adding ...
This answer is rewritten. I also edited a little your image to make it more consistent. All this is only based on my speculations because there's no facts available about the wanted forms, positions and colors. [![enter image description here](https://i.stack.imgur.com/3ephO.jpg)](https://i.stack.imgur.com/3ephO.jpg)...
23,321,028
are these functions equivalent? ``` template <class T> void foo(T && t) { bar(std::forward<T>(t)); } template <class T> void foo2(T && t) { bar(std::forward<decltype(t)>(t)); } template <class T> void foo3(T && t) { bar(std::forward(t)); } ``` if they are, can I always use this macro for perfect forwar...
2014/04/27
[ "https://Stackoverflow.com/questions/23321028", "https://Stackoverflow.com", "https://Stackoverflow.com/users/642626/" ]
> > Are these functions **two** equivalent? > > > **Yes**, they are equivalent. `decltype(t)` is the same as `T&&`, and when used with `std::forward`, there is no difference between `T` and `T&&`, regardless what `T` is. > > Can I always use this macro for perfect forwarding? > > > Yes, you can. If you want ...
The accepted answer does not solve the problem in title completely. A macro argument preserves the type of the expression. A forwarding parameter in a template does not. This means `t` in `foo2` (as a forwarding function parameter) has the type `T&&` (because this is the forwarding template parameter), but it can be s...
82,656
Currently Safari shows the url of the open page without mentioning the protocol: > > apple.stackexchange.com/questions/ask > > > Is there a way to have Safari show the protocol in the address bar: > > <https://apple.stackexchange.com/questions/ask> > > >
2013/02/19
[ "https://apple.stackexchange.com/questions/82656", "https://apple.stackexchange.com", "https://apple.stackexchange.com/users/14758/" ]
You can temporarily display the protocol by activating the address bar with `⌘ Cmd`-`L` and copy-pasting the current URL back to the address bar with `⌘ Cmd`-`C`, `⌘ Cmd`-`V`. The protocol will, however, disappear again as soon as you load a new page by following a link on the page or pressing `Enter` in the address b...
Normally settings like these that aren't in the UI are sometimes available to change with the defaults command in the Terminal app. (this won't work on iOS AFAIK). Unfortunately though, it doesn't appear there is any setting for this: ``` teak:~ mhp$ defaults read com.apple.Safari | grep -i protocol teak:~ mhp$ defa...
44,842,723
URLs and URNs are subsets of URIs. There are many answers on Stack Overflow that explain the concepts quite nicely. You often find a Venn diagram where URNs and URLs are overlapping sets, implying that each of the three areas are not empty. I can imagine a URN that's not a URL: the ISBN of a book. I can also imagine a...
2017/06/30
[ "https://Stackoverflow.com/questions/44842723", "https://Stackoverflow.com", "https://Stackoverflow.com/users/942671/" ]
According to the [classical view](https://www.w3.org/TR/2001/NOTE-uri-clarification-20010921/#classical), a URI can either be a URL or a URN (or possibly something else), not both: > > During the early years of discussion of web identifiers (early to mid 90s), people assumed that an identifer type would be **cast int...
* URI : Uniform Resource Identifier * URL : Uniform Resource Locator * URN : Uniform Resource Name A URI identifies a resource, it is done either by location (URL) or by name (URN). See: [URI on Wikipedia](https://en.wikipedia.org/wiki/Uniform_Resource_Identifier#Relationship_between_URIs.2C_URLs.2C_and_URNs) EDIT -...
21,359,298
I saw there is an `ADD` instruction on ARM, does it work for both `signed` and `unsigned int`? Some status flags should be different when the instruction is specified with `S` suffix, right? Such as setting overflow (`V`) flag. I am wondering is there another version of ADD/SUB to handle one of the integer.
2014/01/26
[ "https://Stackoverflow.com/questions/21359298", "https://Stackoverflow.com", "https://Stackoverflow.com/users/396383/" ]
Twos complement means there is no difference between signed and unsigned addition. The s bit determines whether any flags are modified or not IF modified, then carry is the unsigned overflow/borrow and v is the signed overflow/borrow. This is all described in ARMs documentation.
Because ARM uses two's complement representation, signed and unsigned addition (similarly subtraction) are the same thing. The only difference is [how you *interpret* the flags afterwards](http://infocenter.arm.com/help/topic/com.arm.doc.dui0473h/CEGBHJCJ.html), if you set them with the `s` suffix.
20,756,777
In my application, I work on several thousand of document a day. I'd like, in some cases some logs, one log by document. Then I'd like for a specific target change the output filename (and only the filename) at runtime. Around the web I found how to create a target by programming me I'd like just update a the filename...
2013/12/24
[ "https://Stackoverflow.com/questions/20756777", "https://Stackoverflow.com", "https://Stackoverflow.com/users/118584/" ]
For anyone stuck on this, I finally found a solution. I was trying to update some syslog target settings at runtime and nothing was working. Simply updating the configuration does not work, you need to reset the Configuration object, which is as simple as doing this: ``` LogManager.Configuration = LogManager.Configura...
[I happen to have written an answer that fits your question as well](https://stackoverflow.com/questions/37327129/nlog-dynamically-change-filename-using-nlog-config/52734579#52734579). In essence, instead of trying to *rewrite* the configuration, you'd be better off simply creating a configuration that allows you to d...
20,756,777
In my application, I work on several thousand of document a day. I'd like, in some cases some logs, one log by document. Then I'd like for a specific target change the output filename (and only the filename) at runtime. Around the web I found how to create a target by programming me I'd like just update a the filename...
2013/12/24
[ "https://Stackoverflow.com/questions/20756777", "https://Stackoverflow.com", "https://Stackoverflow.com/users/118584/" ]
Try `ReconfigExistingLoggers` method: ``` var target = (FileTarget)LogManager.Configuration.FindTargetByName("logfile"); target.FileName = "${logDirectory}/file2.txt"; LogManager.ReconfigExistingLoggers(); ``` As written in docs: > > Loops through all loggers previously returned by GetLogger. and > recalculates t...
[I happen to have written an answer that fits your question as well](https://stackoverflow.com/questions/37327129/nlog-dynamically-change-filename-using-nlog-config/52734579#52734579). In essence, instead of trying to *rewrite* the configuration, you'd be better off simply creating a configuration that allows you to d...
20,756,777
In my application, I work on several thousand of document a day. I'd like, in some cases some logs, one log by document. Then I'd like for a specific target change the output filename (and only the filename) at runtime. Around the web I found how to create a target by programming me I'd like just update a the filename...
2013/12/24
[ "https://Stackoverflow.com/questions/20756777", "https://Stackoverflow.com", "https://Stackoverflow.com/users/118584/" ]
[Tony's](https://stackoverflow.com/a/20757494/2009197) solution doesn't seem to work if you use NLog Async (`<targets async="true">`). I had to use the wrapper target to get my FileTarget, otherwise I get a lot of errors. I'm using NLog 2.1. ``` if (LogManager.Configuration != null && LogManager.Configuration.Configur...
This worked for me. ``` using NLog; using NLog.Targets; using NLog.Targets.Wrappers; var target = LogManager.Configuration.FindTargetByName("logfile"); var asyncTarget = target as AsyncTargetWrapper; var fileTarget = asyncTarget.WrappedTarget as FileTarget; var file = fileTarget.FileName; var archiveFile = fileTarget...
20,756,777
In my application, I work on several thousand of document a day. I'd like, in some cases some logs, one log by document. Then I'd like for a specific target change the output filename (and only the filename) at runtime. Around the web I found how to create a target by programming me I'd like just update a the filename...
2013/12/24
[ "https://Stackoverflow.com/questions/20756777", "https://Stackoverflow.com", "https://Stackoverflow.com/users/118584/" ]
Try `ReconfigExistingLoggers` method: ``` var target = (FileTarget)LogManager.Configuration.FindTargetByName("logfile"); target.FileName = "${logDirectory}/file2.txt"; LogManager.ReconfigExistingLoggers(); ``` As written in docs: > > Loops through all loggers previously returned by GetLogger. and > recalculates t...
If not needing to change the LogDirectory at runtime, then you can do this: ``` target.FileName = "${var:logDirectory}\\file2.txt"); ``` If needing to modify the logDirectory at runtime, then use the GDC: <https://github.com/NLog/NLog/wiki/Gdc-layout-renderer> ``` NLog.GlobalDiagnosticsContext.Set("logDirectory","...
20,756,777
In my application, I work on several thousand of document a day. I'd like, in some cases some logs, one log by document. Then I'd like for a specific target change the output filename (and only the filename) at runtime. Around the web I found how to create a target by programming me I'd like just update a the filename...
2013/12/24
[ "https://Stackoverflow.com/questions/20756777", "https://Stackoverflow.com", "https://Stackoverflow.com/users/118584/" ]
[Tony's](https://stackoverflow.com/a/20757494/2009197) solution doesn't seem to work if you use NLog Async (`<targets async="true">`). I had to use the wrapper target to get my FileTarget, otherwise I get a lot of errors. I'm using NLog 2.1. ``` if (LogManager.Configuration != null && LogManager.Configuration.Configur...
[I happen to have written an answer that fits your question as well](https://stackoverflow.com/questions/37327129/nlog-dynamically-change-filename-using-nlog-config/52734579#52734579). In essence, instead of trying to *rewrite* the configuration, you'd be better off simply creating a configuration that allows you to d...
20,756,777
In my application, I work on several thousand of document a day. I'd like, in some cases some logs, one log by document. Then I'd like for a specific target change the output filename (and only the filename) at runtime. Around the web I found how to create a target by programming me I'd like just update a the filename...
2013/12/24
[ "https://Stackoverflow.com/questions/20756777", "https://Stackoverflow.com", "https://Stackoverflow.com/users/118584/" ]
If not needing to change the LogDirectory at runtime, then you can do this: ``` target.FileName = "${var:logDirectory}\\file2.txt"); ``` If needing to modify the logDirectory at runtime, then use the GDC: <https://github.com/NLog/NLog/wiki/Gdc-layout-renderer> ``` NLog.GlobalDiagnosticsContext.Set("logDirectory","...
For anyone stuck on this, I finally found a solution. I was trying to update some syslog target settings at runtime and nothing was working. Simply updating the configuration does not work, you need to reset the Configuration object, which is as simple as doing this: ``` LogManager.Configuration = LogManager.Configura...
20,756,777
In my application, I work on several thousand of document a day. I'd like, in some cases some logs, one log by document. Then I'd like for a specific target change the output filename (and only the filename) at runtime. Around the web I found how to create a target by programming me I'd like just update a the filename...
2013/12/24
[ "https://Stackoverflow.com/questions/20756777", "https://Stackoverflow.com", "https://Stackoverflow.com/users/118584/" ]
Try `ReconfigExistingLoggers` method: ``` var target = (FileTarget)LogManager.Configuration.FindTargetByName("logfile"); target.FileName = "${logDirectory}/file2.txt"; LogManager.ReconfigExistingLoggers(); ``` As written in docs: > > Loops through all loggers previously returned by GetLogger. and > recalculates t...
The reason why you get the error is that **NLog knows nothing about "logDirectory"** keyname. You may implement it by yourself (read instructions [here](https://stackoverflow.com/questions/4091606/most-useful-nlog-configurations/4098047#4098047)) or use predefined ones from [here](https://github.com/nlog/nlog/wiki/Layo...
20,756,777
In my application, I work on several thousand of document a day. I'd like, in some cases some logs, one log by document. Then I'd like for a specific target change the output filename (and only the filename) at runtime. Around the web I found how to create a target by programming me I'd like just update a the filename...
2013/12/24
[ "https://Stackoverflow.com/questions/20756777", "https://Stackoverflow.com", "https://Stackoverflow.com/users/118584/" ]
[Tony's](https://stackoverflow.com/a/20757494/2009197) solution doesn't seem to work if you use NLog Async (`<targets async="true">`). I had to use the wrapper target to get my FileTarget, otherwise I get a lot of errors. I'm using NLog 2.1. ``` if (LogManager.Configuration != null && LogManager.Configuration.Configur...
For anyone stuck on this, I finally found a solution. I was trying to update some syslog target settings at runtime and nothing was working. Simply updating the configuration does not work, you need to reset the Configuration object, which is as simple as doing this: ``` LogManager.Configuration = LogManager.Configura...
20,756,777
In my application, I work on several thousand of document a day. I'd like, in some cases some logs, one log by document. Then I'd like for a specific target change the output filename (and only the filename) at runtime. Around the web I found how to create a target by programming me I'd like just update a the filename...
2013/12/24
[ "https://Stackoverflow.com/questions/20756777", "https://Stackoverflow.com", "https://Stackoverflow.com/users/118584/" ]
If not needing to change the LogDirectory at runtime, then you can do this: ``` target.FileName = "${var:logDirectory}\\file2.txt"); ``` If needing to modify the logDirectory at runtime, then use the GDC: <https://github.com/NLog/NLog/wiki/Gdc-layout-renderer> ``` NLog.GlobalDiagnosticsContext.Set("logDirectory","...
This worked for me. ``` using NLog; using NLog.Targets; using NLog.Targets.Wrappers; var target = LogManager.Configuration.FindTargetByName("logfile"); var asyncTarget = target as AsyncTargetWrapper; var fileTarget = asyncTarget.WrappedTarget as FileTarget; var file = fileTarget.FileName; var archiveFile = fileTarget...
20,756,777
In my application, I work on several thousand of document a day. I'd like, in some cases some logs, one log by document. Then I'd like for a specific target change the output filename (and only the filename) at runtime. Around the web I found how to create a target by programming me I'd like just update a the filename...
2013/12/24
[ "https://Stackoverflow.com/questions/20756777", "https://Stackoverflow.com", "https://Stackoverflow.com/users/118584/" ]
If not needing to change the LogDirectory at runtime, then you can do this: ``` target.FileName = "${var:logDirectory}\\file2.txt"); ``` If needing to modify the logDirectory at runtime, then use the GDC: <https://github.com/NLog/NLog/wiki/Gdc-layout-renderer> ``` NLog.GlobalDiagnosticsContext.Set("logDirectory","...
[I happen to have written an answer that fits your question as well](https://stackoverflow.com/questions/37327129/nlog-dynamically-change-filename-using-nlog-config/52734579#52734579). In essence, instead of trying to *rewrite* the configuration, you'd be better off simply creating a configuration that allows you to d...
35,783,626
I have the following function, and I want to test if the two strings are anagrams. One way I thought about doing it would be to sum the values of each of the characters in the strings and then compare their values. However, I am getting a segmentation fault in both the for loops when I try to run my program. I am not ...
2016/03/03
[ "https://Stackoverflow.com/questions/35783626", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5406694/" ]
In your `for` loops you must check `*p != '\0'` `*q != '\0'` This is the cause of the seg-fault. --- Furthermore, even fixed, that code will give you false positives: "bc" anagram of "ad" I suggest you a different approach: make two arrays of `int`s sized 256, zero initialized. Let every item of each array kee...
"p !=0" should be "\*p != 0", as it is now you are waiting for the pointer to become null.
35,783,626
I have the following function, and I want to test if the two strings are anagrams. One way I thought about doing it would be to sum the values of each of the characters in the strings and then compare their values. However, I am getting a segmentation fault in both the for loops when I try to run my program. I am not ...
2016/03/03
[ "https://Stackoverflow.com/questions/35783626", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5406694/" ]
In your `for` loops you must check `*p != '\0'` `*q != '\0'` This is the cause of the seg-fault. --- Furthermore, even fixed, that code will give you false positives: "bc" anagram of "ad" I suggest you a different approach: make two arrays of `int`s sized 256, zero initialized. Let every item of each array kee...
Here is a complete solution for your problem: ``` #include <stdio.h> #include <string.h> #include <stdlib.h> int cmp(const void *str1, const void *str2) { return (*((char*)str1) - *((char*)str2)); } bool areAnagram(char *str1, char *str2) { int n1 = strlen(str1); int n2 = strlen(str2); if (n1 !=...
35,783,626
I have the following function, and I want to test if the two strings are anagrams. One way I thought about doing it would be to sum the values of each of the characters in the strings and then compare their values. However, I am getting a segmentation fault in both the for loops when I try to run my program. I am not ...
2016/03/03
[ "https://Stackoverflow.com/questions/35783626", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5406694/" ]
In your `for` loops you must check `*p != '\0'` `*q != '\0'` This is the cause of the seg-fault. --- Furthermore, even fixed, that code will give you false positives: "bc" anagram of "ad" I suggest you a different approach: make two arrays of `int`s sized 256, zero initialized. Let every item of each array kee...
Since we're already giving answers about better approaches, here's mine: Get a list of (preferably small) prime numbers. You need one for every possible character of your input strings, thus when you want to check strings containing only digits 0 to 9 you need 10 prime numbers. Let's take these: ``` static unsigned c...
1,393,522
Let $X$ and $Y$ be topological spaces and $f$ be homeomorphism from $X-\{x\}$ to $Y-\{y\}$ where $x\in X$ and $y\in Y$. Is it true that the extension $g:X\to Y$ sending $x$ to $y$ is a homeomorphism? ? --- Attempt: Let $U$ be an open set of $Y$ containing $y$. I want to show that $g^{-1}(U)$ is open. Claim 1. $x$ i...
2015/08/11
[ "https://math.stackexchange.com/questions/1393522", "https://math.stackexchange.com", "https://math.stackexchange.com/users/51855/" ]
This is in general not true. Consider the two-dimensional unit circle and the interval $(0, 1]$. These two spaces are not homeomorphic, as one is compact and the other one not. But if you remove an arbitrary point on the circle and the point $1$ on the interval, the remaining sets are homeomorphic.
Another example. If $X$, $Y$ are two-point spaces, then the assumption says nothing. Yet, there are non-homeomorphic two-point spaces.
39,757,321
I need to run a function (show a modal) **if** a page **DOES** have a particular field value **AND is not** a certain page. It also needs to work if the page **DOES NOT HAVE THE FIELD VALUE** and it is not the certain page. They work individually like this: //if page has field value: ``` <?php $values = get_field...
2016/09/28
[ "https://Stackoverflow.com/questions/39757321", "https://Stackoverflow.com", "https://Stackoverflow.com/users/362437/" ]
found solution, uri.encode has default argument of `def char_unescaped?(char) when char in 0..0x10FFFF do char_reserved?(char) or char_unreserved?(char) end` for the second argument, by passing char\_unreserved, the function will now encode reserved characters `URI.encode(" & ", &URI.char_unreserved?(&1)) "%20%26%20...
`URI.encode/2` accepts second optional argument - a function to determine whether or not skip encode a char. So we can use the function that returns false (not skip) for any char: ``` URI.encode("&", fn(_) -> false end) "%26" ```
267,642
I have a VM running Fedora 17 on VMWare over windows 7. I want to SSH to my university server from fedora but when I try something like: ``` ssh myuser@server.com ``` I don't get request for my password. If I try to SSH using PuTTY in windows, everything is OK. Then I pinged the server and got the following message...
2011/04/07
[ "https://superuser.com/questions/267642", "https://superuser.com", "https://superuser.com/users/75340/" ]
On Fedora Core 18 (Gnome) Using the GUI tools: ``` Applications > System Tools > System Settings > Brightness & Lock ``` From the terminal (to set sleep timeout to 10 minutes / 600 seconds, then require login after 15 minutes / 900 seconds): ``` gsettings set org.gnome.settings-daemon.plugins.power sleep-display-a...
On Debian (release 7.4 = wheezy): The problem with lock/timeout/idle/gnome-screensaver is resolved on a standard install, thru the menu "Applications" in the lowest-leftest corner, Applications > System Tools > Preferences > System Settings > Brightness and Lock or thru the menu (with your name) in the lowest-righte...
267,642
I have a VM running Fedora 17 on VMWare over windows 7. I want to SSH to my university server from fedora but when I try something like: ``` ssh myuser@server.com ``` I don't get request for my password. If I try to SSH using PuTTY in windows, everything is OK. Then I pinged the server and got the following message...
2011/04/07
[ "https://superuser.com/questions/267642", "https://superuser.com", "https://superuser.com/users/75340/" ]
On Fedora Core 18 (Gnome) Using the GUI tools: ``` Applications > System Tools > System Settings > Brightness & Lock ``` From the terminal (to set sleep timeout to 10 minutes / 600 seconds, then require login after 15 minutes / 900 seconds): ``` gsettings set org.gnome.settings-daemon.plugins.power sleep-display-a...
For Fedora 14, it is in the screensaver settings under something like "require password to return from screensaver." I don't remember the exact phrasing as I am not booted in fedora at the moment. EDIT: I am running GNOME with Fedora 14.
267,642
I have a VM running Fedora 17 on VMWare over windows 7. I want to SSH to my university server from fedora but when I try something like: ``` ssh myuser@server.com ``` I don't get request for my password. If I try to SSH using PuTTY in windows, everything is OK. Then I pinged the server and got the following message...
2011/04/07
[ "https://superuser.com/questions/267642", "https://superuser.com", "https://superuser.com/users/75340/" ]
For Fedora 14, it is in the screensaver settings under something like "require password to return from screensaver." I don't remember the exact phrasing as I am not booted in fedora at the moment. EDIT: I am running GNOME with Fedora 14.
For Leap 42.x. If you are using Gnome, go to Activities | Show Applications | Settings | Power | Power Saving. Change it to the number of minutes you desire or simply make it Never.
267,642
I have a VM running Fedora 17 on VMWare over windows 7. I want to SSH to my university server from fedora but when I try something like: ``` ssh myuser@server.com ``` I don't get request for my password. If I try to SSH using PuTTY in windows, everything is OK. Then I pinged the server and got the following message...
2011/04/07
[ "https://superuser.com/questions/267642", "https://superuser.com", "https://superuser.com/users/75340/" ]
On Ubuntu 10 running Gnome: System -> Preferences -> Screensaver. There's a checkbox to lock after the screensaver activates, and there's checkbox and a slider to activate the screensaver after a certain amount of time.
On Debian (release 7.4 = wheezy): The problem with lock/timeout/idle/gnome-screensaver is resolved on a standard install, thru the menu "Applications" in the lowest-leftest corner, Applications > System Tools > Preferences > System Settings > Brightness and Lock or thru the menu (with your name) in the lowest-righte...
267,642
I have a VM running Fedora 17 on VMWare over windows 7. I want to SSH to my university server from fedora but when I try something like: ``` ssh myuser@server.com ``` I don't get request for my password. If I try to SSH using PuTTY in windows, everything is OK. Then I pinged the server and got the following message...
2011/04/07
[ "https://superuser.com/questions/267642", "https://superuser.com", "https://superuser.com/users/75340/" ]
On Centos 7 gui To prevent screen from locking: Applications (upper left hand corner of desktop) → System Tools → Settings → Privacy → Left click on Screen Lock → Lock screen after blank for, drop down menu To prevent screen from going black: Applications → System Tools → Settings → Power → Blank Screen
For Red Hat Enterprise Linux (RHEL) I found it to be Settings > Privacy > Screen lock
267,642
I have a VM running Fedora 17 on VMWare over windows 7. I want to SSH to my university server from fedora but when I try something like: ``` ssh myuser@server.com ``` I don't get request for my password. If I try to SSH using PuTTY in windows, everything is OK. Then I pinged the server and got the following message...
2011/04/07
[ "https://superuser.com/questions/267642", "https://superuser.com", "https://superuser.com/users/75340/" ]
On Debian (release 7.4 = wheezy): The problem with lock/timeout/idle/gnome-screensaver is resolved on a standard install, thru the menu "Applications" in the lowest-leftest corner, Applications > System Tools > Preferences > System Settings > Brightness and Lock or thru the menu (with your name) in the lowest-righte...
For Fedora 14, it is in the screensaver settings under something like "require password to return from screensaver." I don't remember the exact phrasing as I am not booted in fedora at the moment. EDIT: I am running GNOME with Fedora 14.
267,642
I have a VM running Fedora 17 on VMWare over windows 7. I want to SSH to my university server from fedora but when I try something like: ``` ssh myuser@server.com ``` I don't get request for my password. If I try to SSH using PuTTY in windows, everything is OK. Then I pinged the server and got the following message...
2011/04/07
[ "https://superuser.com/questions/267642", "https://superuser.com", "https://superuser.com/users/75340/" ]
On Ubuntu 10 running Gnome: System -> Preferences -> Screensaver. There's a checkbox to lock after the screensaver activates, and there's checkbox and a slider to activate the screensaver after a certain amount of time.
On Centos 7 gui To prevent screen from locking: Applications (upper left hand corner of desktop) → System Tools → Settings → Privacy → Left click on Screen Lock → Lock screen after blank for, drop down menu To prevent screen from going black: Applications → System Tools → Settings → Power → Blank Screen
267,642
I have a VM running Fedora 17 on VMWare over windows 7. I want to SSH to my university server from fedora but when I try something like: ``` ssh myuser@server.com ``` I don't get request for my password. If I try to SSH using PuTTY in windows, everything is OK. Then I pinged the server and got the following message...
2011/04/07
[ "https://superuser.com/questions/267642", "https://superuser.com", "https://superuser.com/users/75340/" ]
On Debian 8 (jessie) it's in "Settings/Privacy". (press Alt-F1 and type "settings"). To run it from somewhere else, name of the application is "gnome-control-center".
On Debian (release 7.4 = wheezy): The problem with lock/timeout/idle/gnome-screensaver is resolved on a standard install, thru the menu "Applications" in the lowest-leftest corner, Applications > System Tools > Preferences > System Settings > Brightness and Lock or thru the menu (with your name) in the lowest-righte...
267,642
I have a VM running Fedora 17 on VMWare over windows 7. I want to SSH to my university server from fedora but when I try something like: ``` ssh myuser@server.com ``` I don't get request for my password. If I try to SSH using PuTTY in windows, everything is OK. Then I pinged the server and got the following message...
2011/04/07
[ "https://superuser.com/questions/267642", "https://superuser.com", "https://superuser.com/users/75340/" ]
On Debian 8 (jessie) it's in "Settings/Privacy". (press Alt-F1 and type "settings"). To run it from somewhere else, name of the application is "gnome-control-center".
For Leap 42.x. If you are using Gnome, go to Activities | Show Applications | Settings | Power | Power Saving. Change it to the number of minutes you desire or simply make it Never.
267,642
I have a VM running Fedora 17 on VMWare over windows 7. I want to SSH to my university server from fedora but when I try something like: ``` ssh myuser@server.com ``` I don't get request for my password. If I try to SSH using PuTTY in windows, everything is OK. Then I pinged the server and got the following message...
2011/04/07
[ "https://superuser.com/questions/267642", "https://superuser.com", "https://superuser.com/users/75340/" ]
On Fedora Core 18 (Gnome) Using the GUI tools: ``` Applications > System Tools > System Settings > Brightness & Lock ``` From the terminal (to set sleep timeout to 10 minutes / 600 seconds, then require login after 15 minutes / 900 seconds): ``` gsettings set org.gnome.settings-daemon.plugins.power sleep-display-a...
For Centos 7 running MATE GUI, it's in the menu under `System -> Preferences -> Look and Feel -> Screensaver`. You can turn it off from here, as well as locking the screen when computer is idle. Also, there is `Power Management` button in the bottom toolbar of Screensaver preferences windows where you can change additi...
913,173
I'm changing my background-image css property using Mootools: **$(document.body).setStyle('background-image','url(' + pBackground + ')');** *And it's its working, but how can a make one fade effect between picture change?* Thanks, Pedro
2009/05/26
[ "https://Stackoverflow.com/questions/913173", "https://Stackoverflow.com", "https://Stackoverflow.com/users/36026/" ]
You can't fade a background specifically... you have to fade the element that has the background. For your situation, I would suggest using a `<div>` that encompasses everything in the `<body>` of your HTML, ie: ``` <html> <body> <div id="main"> </div> </body> ``` You could then set the background-image property o...
Not sure of what i am saying, BUT since it's not a part of the html document, it's not an 'element' so javascript should not be able to work on it. But, just an idea, and depending on how your site looks, you could try to set an opacity, to simulate an opacity on the body, which can lead to the effect you want..
913,173
I'm changing my background-image css property using Mootools: **$(document.body).setStyle('background-image','url(' + pBackground + ')');** *And it's its working, but how can a make one fade effect between picture change?* Thanks, Pedro
2009/05/26
[ "https://Stackoverflow.com/questions/913173", "https://Stackoverflow.com", "https://Stackoverflow.com/users/36026/" ]
Just as a caution, any child elements of that div will also fade, so if you want the background to fade while elements over it remain opaque, you will need to absolutely position any child elements. Absolutely positioning all elements brings other problems with it when you have variable length content, but there are w...
Not sure of what i am saying, BUT since it's not a part of the html document, it's not an 'element' so javascript should not be able to work on it. But, just an idea, and depending on how your site looks, you could try to set an opacity, to simulate an opacity on the body, which can lead to the effect you want..
913,173
I'm changing my background-image css property using Mootools: **$(document.body).setStyle('background-image','url(' + pBackground + ')');** *And it's its working, but how can a make one fade effect between picture change?* Thanks, Pedro
2009/05/26
[ "https://Stackoverflow.com/questions/913173", "https://Stackoverflow.com", "https://Stackoverflow.com/users/36026/" ]
You can't fade a background specifically... you have to fade the element that has the background. For your situation, I would suggest using a `<div>` that encompasses everything in the `<body>` of your HTML, ie: ``` <html> <body> <div id="main"> </div> </body> ``` You could then set the background-image property o...
Just as a caution, any child elements of that div will also fade, so if you want the background to fade while elements over it remain opaque, you will need to absolutely position any child elements. Absolutely positioning all elements brings other problems with it when you have variable length content, but there are w...
5,021,041
Here's the pattern I'm thinking of using: ``` class Dicty(dict): def __init__(self): self.__dict__ = self d = Dicty() d.foo = 'bar' print d['foo'] >>> bar d['foo'] = 'baz' print d.foo >>> 'baz' ``` Generally, I prefer the semantics of object attribute access over dict get/set access, but there ar...
2011/02/16
[ "https://Stackoverflow.com/questions/5021041", "https://Stackoverflow.com", "https://Stackoverflow.com/users/66289/" ]
Here's a less "hacky" way to achieve the same effect: ``` class Dicty(dict): def __getattr__(self, key): return self[key] def __setattr__(self, key, value): self[key] = value ``` I *think* that your way may work fine as well, but setting the `__dict__` attribute like that seems a bit iffy sty...
Don't set `self.__dict__`. Call `__init__(self, *args, **kwargs)` on the superclass. Also, `dict` inherits from `object` so you don't need to specify it.
5,021,041
Here's the pattern I'm thinking of using: ``` class Dicty(dict): def __init__(self): self.__dict__ = self d = Dicty() d.foo = 'bar' print d['foo'] >>> bar d['foo'] = 'baz' print d.foo >>> 'baz' ``` Generally, I prefer the semantics of object attribute access over dict get/set access, but there ar...
2011/02/16
[ "https://Stackoverflow.com/questions/5021041", "https://Stackoverflow.com", "https://Stackoverflow.com/users/66289/" ]
Here's a less "hacky" way to achieve the same effect: ``` class Dicty(dict): def __getattr__(self, key): return self[key] def __setattr__(self, key, value): self[key] = value ``` I *think* that your way may work fine as well, but setting the `__dict__` attribute like that seems a bit iffy sty...
A couple of things. One is if you try and use a dictionary method, such as `keys`, you won't be able to get it now. There were some other issues I ran into, such as being pickle-able and copy-able. But I have implemented something that does this without those problems. You can see it here, it's the AttrDict class in ...
26,767,016
I have attached my full source code of my program that can open a `.txt` file. It doesn't execute after the `cout << length`. I am trying to store the `.txt` file information in memory by using an array. ``` #include <iostream> #include <string.h> #include <fstream> using namespace std; char filename[128]; char file[...
2014/11/05
[ "https://Stackoverflow.com/questions/26767016", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4167396/" ]
This is horribly wasteful way to count number of lines in a file. ``` for (int i=0; getline(inputfiles,line); i++) // i is also completely useless here { length++; } ``` You're reading the whole file only to throw everything away and start again! And after this loop is done, `inputfiles.eof()` will be `true` an...
You asked: > > > ``` > // char file[length][250]; <- How can I create the array based on the length variable? > > ``` > > Declare `file` as: ``` char (*file)[250] = NULL; ``` and then, ``` file = new char[length][250]; ``` Make sure you call `delete [] file` before the end of the function. You said: ...
43,080,002
i am trying to generate being able to have a number of dice and then selecting the number of sides on the dice this is my code how would i make this work ``` print("\n") #Creates new program print("Welcome...") print("You are are playing a game of dice, this is a two player game, who ever rolls the highest number win...
2017/03/28
[ "https://Stackoverflow.com/questions/43080002", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7211909/" ]
Try this: ``` print("Welcome...") print("You are are playing a game of dice, this is a two player game, who ever rolls the highest number wins") name1 = input("What is Player 1's Name?") #Inputs "player 1's" name print("Hello", name1) name2 = input("What is Player 2's Name?") print("Greetings"...
Problem, I can see, is this line: ``` Roll11 = int(randint(Dice,Sides)) ``` You are trying to pass string values as integer parameters. try to use it like this: ``` Roll11 = randint(int(Dice), int(Sides)) ```
35,459,053
I read [this](http://developer.android.com/intl/ru/training/backup/autosyncapi.html#testing) article. As you can see it says that I need to execute the following command: ``` adb shell bmgr wipe <TRANSPORT> <PACKAGE> ``` NOTE that I'm using Windows OS. To get the `Transport` value I executed the following command: ...
2016/02/17
[ "https://Stackoverflow.com/questions/35459053", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1897423/" ]
You may use a separate file and include the file using `@include` while you may pass the data with a dynamic variable name so you'll be able to use that variable name in your included view, for example: ``` @include('view.name', ['variableName' => $array]) ``` So, in the `view.name` view you can use/access the `$arr...
`@yield` produce a section, like an include but with the included template defined from the children `@yield` does not accept parameters, and it makes sense since the parent does not have to knows what children will implement. If you want to pass parameters to the template, an `@include` probably suits better the cas...
9,102,761
if a long variable is declared as :- **private volatile long counter = 0;** now if i increment it using pre-increment operator, then would the operation be atomic ? if yes, then will it be more efficient than `java.util.concurrent.atomic.AtomicLong` object's increment ??
2012/02/01
[ "https://Stackoverflow.com/questions/9102761", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1150236/" ]
`volatile` keyword only solves [visibility](http://www.ibm.com/developerworks/library/j-jtp03304/) problem. You have to use `AtomicLong` or `synchronized` method/block for atomicity ([Atomicity in concurrent programming](http://en.wikipedia.org/wiki/Atomicity_%28programming%29)). One more article that came out today: ...
The pre-increment operator is *not* atomic. Also, incrementing a `volatile long` is likely to be less efficient than using `AtomicLong` on almost all platforms, because the latter is supported by hardware.
9,102,761
if a long variable is declared as :- **private volatile long counter = 0;** now if i increment it using pre-increment operator, then would the operation be atomic ? if yes, then will it be more efficient than `java.util.concurrent.atomic.AtomicLong` object's increment ??
2012/02/01
[ "https://Stackoverflow.com/questions/9102761", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1150236/" ]
`volatile` keyword only solves [visibility](http://www.ibm.com/developerworks/library/j-jtp03304/) problem. You have to use `AtomicLong` or `synchronized` method/block for atomicity ([Atomicity in concurrent programming](http://en.wikipedia.org/wiki/Atomicity_%28programming%29)). One more article that came out today: ...
The short answer is No. You will need to synchronize the method that increments counter, or, preferably, use an AtomicLong. For the record, ++ operators are not atomic *even on integers*.
9,102,761
if a long variable is declared as :- **private volatile long counter = 0;** now if i increment it using pre-increment operator, then would the operation be atomic ? if yes, then will it be more efficient than `java.util.concurrent.atomic.AtomicLong` object's increment ??
2012/02/01
[ "https://Stackoverflow.com/questions/9102761", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1150236/" ]
`volatile` keyword only solves [visibility](http://www.ibm.com/developerworks/library/j-jtp03304/) problem. You have to use `AtomicLong` or `synchronized` method/block for atomicity ([Atomicity in concurrent programming](http://en.wikipedia.org/wiki/Atomicity_%28programming%29)). One more article that came out today: ...
A volatile variable is not the same as an atomic variable. For volatile variables, the java compiler will attempt to minimize shuffling commands around for the sake of efficiency (don't ask me the details of that.. ), to avoid concurrency problems. Atomic variables are explicitly made for atomic operations, like in y...
25,611,704
I was doing the first recursion exercise on this here: <http://cscircles.cemc.uwaterloo.ca/16-recursion/> I followed the obvious hint and made this: ``` def countup(n): if n == 0: print('Blastoff!') else: countup(n - 1) print(n) ``` So the code basically counts up from 0(blastoff) to n. I just don't...
2014/09/01
[ "https://Stackoverflow.com/questions/25611704", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3979854/" ]
Each time `countup()` calls itself, it'll eventually return to that same point where it called. The next line will then print `n`, as it was *during that function call*. And each time you call a function, all its names are created anew, they are *local*. As such, each time you call `countup()` you have a local, indepe...
It uses recursion to print the numbers. The best way to understand this is by an example: ``` countup(3) countup(2) countup(1) countup(0) n == 0 print('Blastoff!') print (1) print(2) print(3) ``` Each time the function is called, it calles the same function with `n-1`, until `n==...
25,611,704
I was doing the first recursion exercise on this here: <http://cscircles.cemc.uwaterloo.ca/16-recursion/> I followed the obvious hint and made this: ``` def countup(n): if n == 0: print('Blastoff!') else: countup(n - 1) print(n) ``` So the code basically counts up from 0(blastoff) to n. I just don't...
2014/09/01
[ "https://Stackoverflow.com/questions/25611704", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3979854/" ]
Each time `countup()` calls itself, it'll eventually return to that same point where it called. The next line will then print `n`, as it was *during that function call*. And each time you call a function, all its names are created anew, they are *local*. As such, each time you call `countup()` you have a local, indepe...
Consider the variant: ``` def countup(n): if n == 0: print('Blastoff!') else: print(n, end=', ') countup(n - 1) # print(n, end=', ') reverse ``` Prints: ``` 5, 4, 3, 2, 1, Blastoff! ``` Vs reverse the order of the print with the recursive call: ``` def countup(n): if n == 0: pri...
25,611,704
I was doing the first recursion exercise on this here: <http://cscircles.cemc.uwaterloo.ca/16-recursion/> I followed the obvious hint and made this: ``` def countup(n): if n == 0: print('Blastoff!') else: countup(n - 1) print(n) ``` So the code basically counts up from 0(blastoff) to n. I just don't...
2014/09/01
[ "https://Stackoverflow.com/questions/25611704", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3979854/" ]
It uses recursion to print the numbers. The best way to understand this is by an example: ``` countup(3) countup(2) countup(1) countup(0) n == 0 print('Blastoff!') print (1) print(2) print(3) ``` Each time the function is called, it calles the same function with `n-1`, until `n==...
Consider the variant: ``` def countup(n): if n == 0: print('Blastoff!') else: print(n, end=', ') countup(n - 1) # print(n, end=', ') reverse ``` Prints: ``` 5, 4, 3, 2, 1, Blastoff! ``` Vs reverse the order of the print with the recursive call: ``` def countup(n): if n == 0: pri...
10,801,977
I've just started a brand new rails project and the first task I'm trying to complete is creating an object and having it save within my database. I went through the automated way of generating an object, in this case a URL object as follows: ``` rails generate scaffold Url domain:string ``` I've also tested out two...
2012/05/29
[ "https://Stackoverflow.com/questions/10801977", "https://Stackoverflow.com", "https://Stackoverflow.com/users/812939/" ]
This is how my production mongoid.yml looks like ``` <% if ENV['MONGOLAB_URI'] %> <% uri = URI.parse(ENV['MONGOLAB_URI']) %> production: <<: *defaults sessions: default: <<: *default_session database: <%= uri.path.sub('/','') %> username: <%= uri.user %> password: <%= uri.password %> ...
Database connections currently cannot be made via URI at this point in mongoid. The format of the mongoid.yml is as follows: ``` environment: host: <%= ENV['MONGOID_HOST'] %> port: <%= ENV['MONGOID_PORT'] %> username: <%= ENV['MONGOID_USERNAME'] %> password: <%= ENV['MONGOID_PASSWORD'] %> database: <%= ENV['...
10,801,977
I've just started a brand new rails project and the first task I'm trying to complete is creating an object and having it save within my database. I went through the automated way of generating an object, in this case a URL object as follows: ``` rails generate scaffold Url domain:string ``` I've also tested out two...
2012/05/29
[ "https://Stackoverflow.com/questions/10801977", "https://Stackoverflow.com", "https://Stackoverflow.com/users/812939/" ]
Database connections currently cannot be made via URI at this point in mongoid. The format of the mongoid.yml is as follows: ``` environment: host: <%= ENV['MONGOID_HOST'] %> port: <%= ENV['MONGOID_PORT'] %> username: <%= ENV['MONGOID_USERNAME'] %> password: <%= ENV['MONGOID_PASSWORD'] %> database: <%= ENV['...
For a replica set / non-replica-set on MongoHQ: ``` production: sessions: default: <% if ENV['MONGOHQ_HOST_LIST'] %> database: <%= ENV['MONGOHQ_DATABASE'] %> username: <%= ENV['MONGOHQ_USER'] %> password: <%= ENV['MONGOHQ_PASSWD'] %> hosts: <% YAML.parse(ENV['MONGOHQ_HOST_LIST...
10,801,977
I've just started a brand new rails project and the first task I'm trying to complete is creating an object and having it save within my database. I went through the automated way of generating an object, in this case a URL object as follows: ``` rails generate scaffold Url domain:string ``` I've also tested out two...
2012/05/29
[ "https://Stackoverflow.com/questions/10801977", "https://Stackoverflow.com", "https://Stackoverflow.com/users/812939/" ]
This is how my production mongoid.yml looks like ``` <% if ENV['MONGOLAB_URI'] %> <% uri = URI.parse(ENV['MONGOLAB_URI']) %> production: <<: *defaults sessions: default: <<: *default_session database: <%= uri.path.sub('/','') %> username: <%= uri.user %> password: <%= uri.password %> ...
For a replica set / non-replica-set on MongoHQ: ``` production: sessions: default: <% if ENV['MONGOHQ_HOST_LIST'] %> database: <%= ENV['MONGOHQ_DATABASE'] %> username: <%= ENV['MONGOHQ_USER'] %> password: <%= ENV['MONGOHQ_PASSWD'] %> hosts: <% YAML.parse(ENV['MONGOHQ_HOST_LIST...
86,507
**Note**: the next iteration at [Natural merge sort - follow-up](https://codereview.stackexchange.com/questions/86572/natural-merge-sort-follow-up) I have compiled **natural merge sort** algorithm from Java to C++. Natural merge sort sacrifices at most \$2N\$ amount of work in order to recognize the **runs** in the i...
2015/04/10
[ "https://codereview.stackexchange.com/questions/86507", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/58360/" ]
One thing that I find odd is that you duplicate a great deal of standard library code to implement your sorting algorithm: * `is_sorted` can be replaced by [`std::is_sorted`](http://en.cppreference.com/w/cpp/algorithm/is_sorted). * `are_equal` can be replaced by [`std::equal`](http://en.cppreference.com/w/cpp/algorith...
In `UnsafeIntQueue`, you've declared ``` size_t *m_buffer; ``` It may be better to instead declare this as ``` unique_ptr<size_t[]> m_buffer; ``` and let `unique_ptr` manage the allocated memory, rather than managing it manually. Similarly, in `build_run_size_queue`, you have declared ``` UnsafeIntQueue* p_q; ...
86,507
**Note**: the next iteration at [Natural merge sort - follow-up](https://codereview.stackexchange.com/questions/86572/natural-merge-sort-follow-up) I have compiled **natural merge sort** algorithm from Java to C++. Natural merge sort sacrifices at most \$2N\$ amount of work in order to recognize the **runs** in the i...
2015/04/10
[ "https://codereview.stackexchange.com/questions/86507", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/58360/" ]
One thing that I find odd is that you duplicate a great deal of standard library code to implement your sorting algorithm: * `is_sorted` can be replaced by [`std::is_sorted`](http://en.cppreference.com/w/cpp/algorithm/is_sorted). * `are_equal` can be replaced by [`std::equal`](http://en.cppreference.com/w/cpp/algorith...
> > > ``` > p_q->enqueue(right - head); > std::reverse(head, right); > > ``` > > Seems it would be more efficient to iterate in reverse when enqueueing, rather than enqueuing normally and then reversing?
86,507
**Note**: the next iteration at [Natural merge sort - follow-up](https://codereview.stackexchange.com/questions/86572/natural-merge-sort-follow-up) I have compiled **natural merge sort** algorithm from Java to C++. Natural merge sort sacrifices at most \$2N\$ amount of work in order to recognize the **runs** in the i...
2015/04/10
[ "https://codereview.stackexchange.com/questions/86507", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/58360/" ]
In `UnsafeIntQueue`, you've declared ``` size_t *m_buffer; ``` It may be better to instead declare this as ``` unique_ptr<size_t[]> m_buffer; ``` and let `unique_ptr` manage the allocated memory, rather than managing it manually. Similarly, in `build_run_size_queue`, you have declared ``` UnsafeIntQueue* p_q; ...
> > > ``` > p_q->enqueue(right - head); > std::reverse(head, right); > > ``` > > Seems it would be more efficient to iterate in reverse when enqueueing, rather than enqueuing normally and then reversing?
35,777,549
I have been hammering at this for the past 2 days and i've already tried every single solution on the internet, so here goes. I have a problem with undefined references. I am doing a project to compare 3 algorithms and i have compartmentalized them into 3 different sets of cpp files. I am using Dev C++ with gcc 4.9.2....
2016/03/03
[ "https://Stackoverflow.com/questions/35777549", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2036770/" ]
You actually have two declarations of Bresenham class, one in Bresenham.hpp and one in Bresenham.cpp. Change your cpp file in following way: ``` Bresenham::Bresenham(std::string BMPName,std::string TestDataFile) { std::ifstream testFile(TestDataFile); SDL_Surface *image; image=OpenBMP(BMPName); if ( SD...
> > What should I do? > > > First of all, you need to set up correct code units: * remove `#undef main` (makes no sense) * remove the [include guards](https://en.wikipedia.org/wiki/Include_guard) from your cpp files, they belong only in header files. With these, the code just doesn't get compiled, hence the linki...
50,892,536
I recently got access to a legacy database where all dates are stored in an unfamiliar format I'm unable to translate, my initial research makes me think this is a Julian date type, but it seems to be a bit off? Thankfully there's one date column that has a normal counterpart to it, but there are a lot of other dates...
2018/06/16
[ "https://Stackoverflow.com/questions/50892536", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4044142/" ]
It could be the number of Days since **1600-12-31** i.e. **1-Jan-1601** = 1 etc. Would like to see dates from a different year to confirm --- ### Cobol Date functions As SaggingRuffus pointed out. Many dialects of Cobol have functions that convert dates To/From *Days since 31-Dec-1600* These functions include: ``...
Adding to Bruce Martin's answer: Even ancient SQL Server support DATEADD/DATEDIFF, you just have to modify the start date to 1900 instead of 1600 using the constant `109208` (the number of dates inbetween). ``` dateadd(day, (legacydatecol- 109208), 0) as legacy2date datediff(day, '19000101', datecol ) + 109208 as...
5,897,845
here is some food for thought. When I write monadic code, the monad imposes ordering on the operations done. For example, If I write in the IO monad: ``` do a <- doSomething b <- doSomethingElse return (a + b) ``` I know `doSomething` will be executed before `doSomethingElse`. Now, consider the equivalent co...
2011/05/05
[ "https://Stackoverflow.com/questions/5897845", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23845/" ]
This problem of over-sequentializing monad code is known as the ["commutative monads problem"](http://www.haskell.org/haskellwiki/Monad#Commutative_monads). > > Commutative monads are monads for which the order of actions makes no difference (they commute), that is when following code: > > > ``` do a <- f x b ...
> > The semantics of C don't actually specify what order these two function calls will be evaluated, so the compiler is free to move things around as it pleases. > > > But what if `doSomething()` causes a side-effect that will change the behavior of `doSomethingElse()`? Do you really want the compiler to mess with...
5,897,845
here is some food for thought. When I write monadic code, the monad imposes ordering on the operations done. For example, If I write in the IO monad: ``` do a <- doSomething b <- doSomethingElse return (a + b) ``` I know `doSomething` will be executed before `doSomethingElse`. Now, consider the equivalent co...
2011/05/05
[ "https://Stackoverflow.com/questions/5897845", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23845/" ]
This is a deep dirty hack, but it seems like it should do the trick to me. ``` {-# OPTIONS_GHC -fglasgow-exts #-} {-# LANGUAGE MagicHash #-} module Unorder where import GHC.Types unorder :: IO a -> IO b -> IO (a, b) unorder (IO f) (IO g) = IO $ \rw# -> let (# _, x #) = f rw# (# _, y #) = g r...
> > The semantics of C don't actually specify what order these two function calls will be evaluated, so the compiler is free to move things around as it pleases. > > > But what if `doSomething()` causes a side-effect that will change the behavior of `doSomethingElse()`? Do you really want the compiler to mess with...
5,897,845
here is some food for thought. When I write monadic code, the monad imposes ordering on the operations done. For example, If I write in the IO monad: ``` do a <- doSomething b <- doSomethingElse return (a + b) ``` I know `doSomething` will be executed before `doSomethingElse`. Now, consider the equivalent co...
2011/05/05
[ "https://Stackoverflow.com/questions/5897845", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23845/" ]
This problem of over-sequentializing monad code is known as the ["commutative monads problem"](http://www.haskell.org/haskellwiki/Monad#Commutative_monads). > > Commutative monads are monads for which the order of actions makes no difference (they commute), that is when following code: > > > ``` do a <- f x b ...
This is a deep dirty hack, but it seems like it should do the trick to me. ``` {-# OPTIONS_GHC -fglasgow-exts #-} {-# LANGUAGE MagicHash #-} module Unorder where import GHC.Types unorder :: IO a -> IO b -> IO (a, b) unorder (IO f) (IO g) = IO $ \rw# -> let (# _, x #) = f rw# (# _, y #) = g r...
12,183,688
I wrote a Java program. For a small input, after warm-up (the first 50 runs), its running time turns to be around 2 milliseconds. In this case, could we get any benefit if I use multiple threads version? If not, what are the overhead hidden the benefits of parallel execution?
2012/08/29
[ "https://Stackoverflow.com/questions/12183688", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1258409/" ]
Most likely the overhead of starting the threads would far outweigh any speedup. On windows you'll even have trouble measuring the execution time reliably for such fast programs. But of course, you must ask yourself if you truly need any speedup for a program that runs in 2 ms.
Id depends on if 2ms is too slow. It also depends if you want to run the tasks concurrently. Why not use an Executor to run your tasks then you can add threads as you need them.
12,183,688
I wrote a Java program. For a small input, after warm-up (the first 50 runs), its running time turns to be around 2 milliseconds. In this case, could we get any benefit if I use multiple threads version? If not, what are the overhead hidden the benefits of parallel execution?
2012/08/29
[ "https://Stackoverflow.com/questions/12183688", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1258409/" ]
Most likely the overhead of starting the threads would far outweigh any speedup. On windows you'll even have trouble measuring the execution time reliably for such fast programs. But of course, you must ask yourself if you truly need any speedup for a program that runs in 2 ms.
Well, 2ms is at least a candidate for splitting up over multiple threads. Continually creating/running/terminating/joining threads is a non-starter - hopeless design. If signaling work to a set of dedicated threads or issuing work to a pool, it all depends on the work done and the data organization. If there is any bl...
31,118,356
I am developing a MySQL db for a user list, and I am trying to determine the most efficient way to design it. My issue comes in that there are 3 types of users: "general", "normal", and "super". General and normal users differ only in the values of certain columns, so the schema to store them is identical. However, su...
2015/06/29
[ "https://Stackoverflow.com/questions/31118356", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1950274/" ]
why not build an extra table; but only for the extra coloumns you need for super users? so 2 tables one with all the users and one with super users's extra info
If you want to have this type of schema. try to create a relation like: tb\_user > user\_id , user\_type\_id(int) tb\_user\_type > user\_type\_id(int) , type\_name this way you will have just 2 tables and if the type is not set you can set a default value to a user.
31,118,356
I am developing a MySQL db for a user list, and I am trying to determine the most efficient way to design it. My issue comes in that there are 3 types of users: "general", "normal", and "super". General and normal users differ only in the values of certain columns, so the schema to store them is identical. However, su...
2015/06/29
[ "https://Stackoverflow.com/questions/31118356", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1950274/" ]
If each user needs a unique id, then you have the answer to your question: You want one `users` table with a `UserId` column. Often, that column would be an auto-incremented integer primary key column -- a good approach to the implementation. What to do about the other columns? This depends on a number different facto...
If you want to have this type of schema. try to create a relation like: tb\_user > user\_id , user\_type\_id(int) tb\_user\_type > user\_type\_id(int) , type\_name this way you will have just 2 tables and if the type is not set you can set a default value to a user.
30,115,585
We've been working on a project with Yii2 Advanced App, with a custom bootstrap template. I've generated the crud using gii. All other CRUDs work fine. But the User crud displays Yii2 User Module not the CRUD. I've gone through amnah's complete documentations and couldn't find any solutions in any other places either....
2015/05/08
[ "https://Stackoverflow.com/questions/30115585", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4809308/" ]
There are many problems with your code, so i **strongly** suggest to use the functions [password\_hash()](http://www.php.net/manual/en/function.password-hash.php) and [password\_verify()](http://www.php.net/manual/en/function.password-verify.php) to do the hashing. Because you said that you want to understand how it w...
One problem in your example is that you use a new salt every time you want to verify a password, instead of using the old salt. In practice, you need to store the salt you used to hash a password in order to verify it. Try the following code: ``` $salt = Salt::random(12); $password = Hashing::create_hash('123456', $s...
30,115,585
We've been working on a project with Yii2 Advanced App, with a custom bootstrap template. I've generated the crud using gii. All other CRUDs work fine. But the User crud displays Yii2 User Module not the CRUD. I've gone through amnah's complete documentations and couldn't find any solutions in any other places either....
2015/05/08
[ "https://Stackoverflow.com/questions/30115585", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4809308/" ]
If you really want to make your life easier. You can go for `PHPASS` library which provides you functions to use. You just need to create an object of the class and use the functions. Check out these links: You can download the library from here: [Download PHPASS](http://www.openwall.com/phpass/) You can get some mor...
One problem in your example is that you use a new salt every time you want to verify a password, instead of using the old salt. In practice, you need to store the salt you used to hash a password in order to verify it. Try the following code: ``` $salt = Salt::random(12); $password = Hashing::create_hash('123456', $s...
30,115,585
We've been working on a project with Yii2 Advanced App, with a custom bootstrap template. I've generated the crud using gii. All other CRUDs work fine. But the User crud displays Yii2 User Module not the CRUD. I've gone through amnah's complete documentations and couldn't find any solutions in any other places either....
2015/05/08
[ "https://Stackoverflow.com/questions/30115585", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4809308/" ]
There are many problems with your code, so i **strongly** suggest to use the functions [password\_hash()](http://www.php.net/manual/en/function.password-hash.php) and [password\_verify()](http://www.php.net/manual/en/function.password-verify.php) to do the hashing. Because you said that you want to understand how it w...
If you really want to make your life easier. You can go for `PHPASS` library which provides you functions to use. You just need to create an object of the class and use the functions. Check out these links: You can download the library from here: [Download PHPASS](http://www.openwall.com/phpass/) You can get some mor...
2,866,930
How can I check to see if ``` ob_start("ob_gzhandler"); ``` is working and test the difference with or without it? Thanks,
2010/05/19
[ "https://Stackoverflow.com/questions/2866930", "https://Stackoverflow.com", "https://Stackoverflow.com/users/214405/" ]
Using the "Net" tab of [Firebug](http://getfirebug.com/), check to see if the `Content-Encoding` header has a value of `gzip` or `deflate`. Or, try the [online gzip test](http://www.gidnetwork.com/tools/gzip-test.php). [See this question](https://stackoverflow.com/questions/2428542/how-can-i-verify-that-web-pages-are...
You can use [`ob_list_handlers`](http://php.net/ob_list_handlers) to get an array of handlers that are in use.
25,207,771
I have a SQL query ``` SELECT TABLE_SCHEMA + TABLE_NAME AS ColumnZ FROM information_schema.tables ``` I want the result should be `table_Schema.table_name`. help me please!!
2014/08/08
[ "https://Stackoverflow.com/questions/25207771", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3807363/" ]
Try this: ``` SELECT TABLE_SCHEMA + '.' + TABLE_NAME AS ColumnZ FROM information_schema.tables ```
``` SELECT CONCAT(TABLE_SCHEMA, '.', TABLE_NAME) AS ColumnZ FROM information_schema.tables ```
25,207,771
I have a SQL query ``` SELECT TABLE_SCHEMA + TABLE_NAME AS ColumnZ FROM information_schema.tables ``` I want the result should be `table_Schema.table_name`. help me please!!
2014/08/08
[ "https://Stackoverflow.com/questions/25207771", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3807363/" ]
Try this: ``` SELECT TABLE_SCHEMA + '.' + TABLE_NAME AS ColumnZ FROM information_schema.tables ```
This code work for you try this.... ``` SELECT Title, FirstName, lastName, ISNULL(Title,'') + ' ' + ISNULL(FirstName,'') + ' ' + ISNULL(LastName,'') as FullName FROM Customer ```
25,207,771
I have a SQL query ``` SELECT TABLE_SCHEMA + TABLE_NAME AS ColumnZ FROM information_schema.tables ``` I want the result should be `table_Schema.table_name`. help me please!!
2014/08/08
[ "https://Stackoverflow.com/questions/25207771", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3807363/" ]
Try this: ``` SELECT TABLE_SCHEMA + '.' + TABLE_NAME AS ColumnZ FROM information_schema.tables ```
From SQL Server 2017 onwards, there is `CONCAT_WS` operator, to concatenate with separators. ```sql SELECT CONCAT_WS('.', TABLE_SCHEMA ,TABLE_NAME) AS ColumnZ FROM information_schema.tables ```
25,207,771
I have a SQL query ``` SELECT TABLE_SCHEMA + TABLE_NAME AS ColumnZ FROM information_schema.tables ``` I want the result should be `table_Schema.table_name`. help me please!!
2014/08/08
[ "https://Stackoverflow.com/questions/25207771", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3807363/" ]
``` SELECT CONCAT(TABLE_SCHEMA, '.', TABLE_NAME) AS ColumnZ FROM information_schema.tables ```
From SQL Server 2017 onwards, there is `CONCAT_WS` operator, to concatenate with separators. ```sql SELECT CONCAT_WS('.', TABLE_SCHEMA ,TABLE_NAME) AS ColumnZ FROM information_schema.tables ```
25,207,771
I have a SQL query ``` SELECT TABLE_SCHEMA + TABLE_NAME AS ColumnZ FROM information_schema.tables ``` I want the result should be `table_Schema.table_name`. help me please!!
2014/08/08
[ "https://Stackoverflow.com/questions/25207771", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3807363/" ]
This code work for you try this.... ``` SELECT Title, FirstName, lastName, ISNULL(Title,'') + ' ' + ISNULL(FirstName,'') + ' ' + ISNULL(LastName,'') as FullName FROM Customer ```
From SQL Server 2017 onwards, there is `CONCAT_WS` operator, to concatenate with separators. ```sql SELECT CONCAT_WS('.', TABLE_SCHEMA ,TABLE_NAME) AS ColumnZ FROM information_schema.tables ```
54,348,032
I'm going to make a validation of a string, using javascript `isNaN` build in function. But depending of other variable, I want to negate de value of the `isNaN`, so I can check if its a Number or Not a Number *e.g.:* I'm trying to do something like this, but in javascript, it's not valid ``` function validation(ob...
2019/01/24
[ "https://Stackoverflow.com/questions/54348032", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9119186/" ]
The expression `isNaN` is valid javascript function but `!isNaN` is not. You need to pass a valid javascript function that returns the opposite of `isNaN`: ``` function validation(objectWithStrings, type){ const stringCheck = type == 1 ? isNaN : (str) => !isNaN(str) ... } ```
Taking into account the observation, you can create a `negate` function that accepts a callback and negates the result of callback execution: ```js const isNumber = value => !isNaN(+value); const negate = fn => (...args) => !fn(...args); const isNotNumber = negate(isNumber); console.log(isNumber('10')); console....
18,381,899
I'm trying to properly close a MongoDB connection when the app is shut down. Here is the code: ```js var express = require('express') , http = require('http') , mongoose = require('mongoose') , path = require('path'); var app = express(); app.set('port', process.env.PORT || 3000); mongoose.connect('mongodb://...
2013/08/22
[ "https://Stackoverflow.com/questions/18381899", "https://Stackoverflow.com", "https://Stackoverflow.com/users/864413/" ]
When server.close is called, there are two properties that are checked. ``` handle<tcp handle> connections ``` Responsible code fragment of server.close responsible for this error; ``` if (!this._handle) { // Throw error. Follows net_legacy behaviour. throw new Error('Not running'); } ``` Only i...
I don't think setting server.\_connections = 0 actually closes the connection. It just satisfies the conditions to get your callback executed. You might want to try something like this: ```js // Everything else how you had it before ... var sockets = []; server.on('connection', function(socket) { sockets.push(soc...
18,381,899
I'm trying to properly close a MongoDB connection when the app is shut down. Here is the code: ```js var express = require('express') , http = require('http') , mongoose = require('mongoose') , path = require('path'); var app = express(); app.set('port', process.env.PORT || 3000); mongoose.connect('mongodb://...
2013/08/22
[ "https://Stackoverflow.com/questions/18381899", "https://Stackoverflow.com", "https://Stackoverflow.com/users/864413/" ]
When server.close is called, there are two properties that are checked. ``` handle<tcp handle> connections ``` Responsible code fragment of server.close responsible for this error; ``` if (!this._handle) { // Throw error. Follows net_legacy behaviour. throw new Error('Not running'); } ``` Only i...
The reason your server has open connections is because you are sending `Connection: keep-alive` header. Morgan's answer closes all the connections on the server cleanly, disconnecting all of the clients. If you are just testing your application and want to shut it down cleanly before/after tests I recommend sending `...
18,381,899
I'm trying to properly close a MongoDB connection when the app is shut down. Here is the code: ```js var express = require('express') , http = require('http') , mongoose = require('mongoose') , path = require('path'); var app = express(); app.set('port', process.env.PORT || 3000); mongoose.connect('mongodb://...
2013/08/22
[ "https://Stackoverflow.com/questions/18381899", "https://Stackoverflow.com", "https://Stackoverflow.com/users/864413/" ]
The reason your server has open connections is because you are sending `Connection: keep-alive` header. Morgan's answer closes all the connections on the server cleanly, disconnecting all of the clients. If you are just testing your application and want to shut it down cleanly before/after tests I recommend sending `...
I don't think setting server.\_connections = 0 actually closes the connection. It just satisfies the conditions to get your callback executed. You might want to try something like this: ```js // Everything else how you had it before ... var sockets = []; server.on('connection', function(socket) { sockets.push(soc...
456,671
I just finished my first PCB with KiCad. Now, I need to produce it and I need the Pick and Place file. When I try to generate footprint position files the software produce the message "No footprint for automated placement". I'm using the version 5.1.4-e60b266 for ubuntu 18.04.1. How can I generate this file? How can I ...
2019/09/08
[ "https://electronics.stackexchange.com/questions/456671", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/88419/" ]
Pick and place, and thus the \*.pos file, is relevant to surface mount technology. The automatic placement of through-hole technology is not something that is worth the money to invest in due to the volumes produced. The problem with leaded is the need to position each leg for each hole. If you place an test surface-m...
The same problem occurred to me today using KiCad Version 5.1.4. - And I think I've found a solution to the problem: --- **1) Temporary solution:** KiCad: Pcbnew: 'File' -> 'Fabrication Outputs' -> 'Footprint Position (.pos) file...' -> 'Generate Footprint Position Files': Check this checkbox in the 'Generate Foot...
456,671
I just finished my first PCB with KiCad. Now, I need to produce it and I need the Pick and Place file. When I try to generate footprint position files the software produce the message "No footprint for automated placement". I'm using the version 5.1.4-e60b266 for ubuntu 18.04.1. How can I generate this file? How can I ...
2019/09/08
[ "https://electronics.stackexchange.com/questions/456671", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/88419/" ]
Pick and place, and thus the \*.pos file, is relevant to surface mount technology. The automatic placement of through-hole technology is not something that is worth the money to invest in due to the volumes produced. The problem with leaded is the need to position each leg for each hole. If you place an test surface-m...
A Centroid file (\*.pos) is not required for Throughhole (THT) only projects. It is only required for placing SMT components.
456,671
I just finished my first PCB with KiCad. Now, I need to produce it and I need the Pick and Place file. When I try to generate footprint position files the software produce the message "No footprint for automated placement". I'm using the version 5.1.4-e60b266 for ubuntu 18.04.1. How can I generate this file? How can I ...
2019/09/08
[ "https://electronics.stackexchange.com/questions/456671", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/88419/" ]
The same problem occurred to me today using KiCad Version 5.1.4. - And I think I've found a solution to the problem: --- **1) Temporary solution:** KiCad: Pcbnew: 'File' -> 'Fabrication Outputs' -> 'Footprint Position (.pos) file...' -> 'Generate Footprint Position Files': Check this checkbox in the 'Generate Foot...
A Centroid file (\*.pos) is not required for Throughhole (THT) only projects. It is only required for placing SMT components.
35,303,632
I am new to learning PHP and recently I was notified on my website about " Call to a member function count() on a non-object " . I don't have the slightest clue on how to fix but I want to learn. I think I know what's wrong but I need to learn how to fix it so, my website can show up again. Any suggestions? ``` <?php...
2016/02/09
[ "https://Stackoverflow.com/questions/35303632", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5905624/" ]
*(This looks like Magento code - is it?)* The issue is that this line: ``` if(!$_productCollection->count()): ``` Is attempting to call the function `count()` on the class / object `$_productCollection`. However, for whatever reason, in this case `$_productCollection` is not set, and therefore the function does not...
Breaking down the error: **Call to a member function count()** Look for `->count()` (you're using `count` as a function that should be on an object). **...on a non-object** The thing you thought was an object (`$_productCollection`) actually isn't an object. So look up higher in the file and figure out *where* `$_p...
32,823,543
How can I open the location settings from android via Qt? I have already tried this and I can open the settings successfully, but not the location settings: ``` QAndroidJniObject intent("android/content/Intent","()V"); if ( intent.isValid() ) { QAndroidJniObject param1 = QAndroidJniObject::fromStrin...
2015/09/28
[ "https://Stackoverflow.com/questions/32823543", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5337742/" ]
Instead of the standard `Button`, use the following when you need that behavior ``` public class NonSelectableButton : Button { public NonSelectableButton() { SetStyle(ControlStyles.Selectable, false); } } ``` **EDIT:** Here is a little test proving that it's working ``` using System; using Sy...
The best I could work out for stopping all buttons responding to the space-bar is this: **NB: It is a bit of a hack**: Set your form's `KeyPreview` property to `true`. Then add this code to the form's `KeyPress` event: ``` private void Form1_KeyPress(object sender, KeyPressEventArgs e) { if (this.ActiveControl ...
32,823,543
How can I open the location settings from android via Qt? I have already tried this and I can open the settings successfully, but not the location settings: ``` QAndroidJniObject intent("android/content/Intent","()V"); if ( intent.isValid() ) { QAndroidJniObject param1 = QAndroidJniObject::fromStrin...
2015/09/28
[ "https://Stackoverflow.com/questions/32823543", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5337742/" ]
The best I could work out for stopping all buttons responding to the space-bar is this: **NB: It is a bit of a hack**: Set your form's `KeyPreview` property to `true`. Then add this code to the form's `KeyPress` event: ``` private void Form1_KeyPress(object sender, KeyPressEventArgs e) { if (this.ActiveControl ...
Looks like you have troubles applying my previous answer. Here is another way using the same idea: Add a new code file to your project and put the following code inside (make sure to replace `YourNamespace` with yours!) ``` using System; using System.Reflection; using System.Windows.Forms; namespace YourNamespace { ...
32,823,543
How can I open the location settings from android via Qt? I have already tried this and I can open the settings successfully, but not the location settings: ``` QAndroidJniObject intent("android/content/Intent","()V"); if ( intent.isValid() ) { QAndroidJniObject param1 = QAndroidJniObject::fromStrin...
2015/09/28
[ "https://Stackoverflow.com/questions/32823543", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5337742/" ]
Instead of the standard `Button`, use the following when you need that behavior ``` public class NonSelectableButton : Button { public NonSelectableButton() { SetStyle(ControlStyles.Selectable, false); } } ``` **EDIT:** Here is a little test proving that it's working ``` using System; using Sy...
Looks like you have troubles applying my previous answer. Here is another way using the same idea: Add a new code file to your project and put the following code inside (make sure to replace `YourNamespace` with yours!) ``` using System; using System.Reflection; using System.Windows.Forms; namespace YourNamespace { ...
8,381,345
What are the query browsers for DB2 e.g Database Administrator(Data Studio), Toad for DB2 etc? I worked with them but are there more ?
2011/12/05
[ "https://Stackoverflow.com/questions/8381345", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2214674/" ]
You can find a list of browsers in Wikipedia: <http://en.wikipedia.org/wiki/Comparison_of_database_tools#General> and look at "Other" column. You will see which tools work with DB2. The popular ones are: * Toad for DB2 <http://www.toadworld.com/products#ibm-db2> * SQuirreL <http://www.squirrelsql.org> * SQL Maest...
I find [DbVisualizer](http://www.dbvis.com/) to be outstanding even when compared to many native tools. ![DbVisualizer Features](https://i.stack.imgur.com/nK5Be.png)
8,381,345
What are the query browsers for DB2 e.g Database Administrator(Data Studio), Toad for DB2 etc? I worked with them but are there more ?
2011/12/05
[ "https://Stackoverflow.com/questions/8381345", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2214674/" ]
I find [DbVisualizer](http://www.dbvis.com/) to be outstanding even when compared to many native tools. ![DbVisualizer Features](https://i.stack.imgur.com/nK5Be.png)
I recommend the IBM data studio among the free tools. It lets you * Manipulate(Create , modify, execute) stored procedures * See explain plans - run performance analysis * Let you open unlimited connections which some of the free tools doesn't let you. Also, it's based on eclipse framework, so if you are already usin...
8,381,345
What are the query browsers for DB2 e.g Database Administrator(Data Studio), Toad for DB2 etc? I worked with them but are there more ?
2011/12/05
[ "https://Stackoverflow.com/questions/8381345", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2214674/" ]
I've recently discovered DBeaver (<http://dbeaver.jkiss.org>) and I love it. Runs on Win and Linux (on Centos7 I just unpacked an archive and ran executable), it's open source and without need of external driver it has connected to DB2 server right away. Same for PostgreSQL and MS SQL Server. Not sure how it compares ...
I find [DbVisualizer](http://www.dbvis.com/) to be outstanding even when compared to many native tools. ![DbVisualizer Features](https://i.stack.imgur.com/nK5Be.png)
8,381,345
What are the query browsers for DB2 e.g Database Administrator(Data Studio), Toad for DB2 etc? I worked with them but are there more ?
2011/12/05
[ "https://Stackoverflow.com/questions/8381345", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2214674/" ]
You can find a list of browsers in Wikipedia: <http://en.wikipedia.org/wiki/Comparison_of_database_tools#General> and look at "Other" column. You will see which tools work with DB2. The popular ones are: * Toad for DB2 <http://www.toadworld.com/products#ibm-db2> * SQuirreL <http://www.squirrelsql.org> * SQL Maest...
I recommend the IBM data studio among the free tools. It lets you * Manipulate(Create , modify, execute) stored procedures * See explain plans - run performance analysis * Let you open unlimited connections which some of the free tools doesn't let you. Also, it's based on eclipse framework, so if you are already usin...
8,381,345
What are the query browsers for DB2 e.g Database Administrator(Data Studio), Toad for DB2 etc? I worked with them but are there more ?
2011/12/05
[ "https://Stackoverflow.com/questions/8381345", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2214674/" ]
You can find a list of browsers in Wikipedia: <http://en.wikipedia.org/wiki/Comparison_of_database_tools#General> and look at "Other" column. You will see which tools work with DB2. The popular ones are: * Toad for DB2 <http://www.toadworld.com/products#ibm-db2> * SQuirreL <http://www.squirrelsql.org> * SQL Maest...
I've recently discovered DBeaver (<http://dbeaver.jkiss.org>) and I love it. Runs on Win and Linux (on Centos7 I just unpacked an archive and ran executable), it's open source and without need of external driver it has connected to DB2 server right away. Same for PostgreSQL and MS SQL Server. Not sure how it compares ...
8,381,345
What are the query browsers for DB2 e.g Database Administrator(Data Studio), Toad for DB2 etc? I worked with them but are there more ?
2011/12/05
[ "https://Stackoverflow.com/questions/8381345", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2214674/" ]
I've recently discovered DBeaver (<http://dbeaver.jkiss.org>) and I love it. Runs on Win and Linux (on Centos7 I just unpacked an archive and ran executable), it's open source and without need of external driver it has connected to DB2 server right away. Same for PostgreSQL and MS SQL Server. Not sure how it compares ...
I recommend the IBM data studio among the free tools. It lets you * Manipulate(Create , modify, execute) stored procedures * See explain plans - run performance analysis * Let you open unlimited connections which some of the free tools doesn't let you. Also, it's based on eclipse framework, so if you are already usin...
1,203,646
in the following indexer code block, why do we need: ``` public string this[int pos] { get { return myData[pos]; } set { myData[pos] = value; } } ``` what exactly does "this" in this[int pos] do? Thanks ``` /// Indexer Code Block starts here using System; /// <summary> /// ...
2009/07/29
[ "https://Stackoverflow.com/questions/1203646", "https://Stackoverflow.com", "https://Stackoverflow.com/users/133466/" ]
**From a c# syntax perspective:** You need `this` because - how else would you declare it? Functionality on a class must have a name, or address, by which to reference it. A method signature is: ``` [modifiers] [type] [name] (parameters) public string GetString (Type myparam); ``` A property signature...
The 'this' keyword indicates that you are defining behavior that will be invoked when your class is accessed as if it was an array. Since your defining behavior for the class instance, use of the 'this' keyword in that context makes sense. You don't call myInd.indexer[], you call myInd[].
1,203,646
in the following indexer code block, why do we need: ``` public string this[int pos] { get { return myData[pos]; } set { myData[pos] = value; } } ``` what exactly does "this" in this[int pos] do? Thanks ``` /// Indexer Code Block starts here using System; /// <summary> /// ...
2009/07/29
[ "https://Stackoverflow.com/questions/1203646", "https://Stackoverflow.com", "https://Stackoverflow.com/users/133466/" ]
It means that you can use the indexer on the object itself (like an array). ``` class Foo { public string this[int i] { get { return someData[i]; } set { someData i = value; } } } // ... later in code Foo f = new Foo( ); string s = f[0]; ```
The "this" in your case specifies that this property is the [indexer](http://msdn.microsoft.com/en-us/library/aa288464%28VS.71%29.aspx) for this class. This is the syntax in C# to define an indexer on a class, so you can use it like: ``` myInd[9] = ... ```
1,203,646
in the following indexer code block, why do we need: ``` public string this[int pos] { get { return myData[pos]; } set { myData[pos] = value; } } ``` what exactly does "this" in this[int pos] do? Thanks ``` /// Indexer Code Block starts here using System; /// <summary> /// ...
2009/07/29
[ "https://Stackoverflow.com/questions/1203646", "https://Stackoverflow.com", "https://Stackoverflow.com/users/133466/" ]
This is just marker for compiler to know that that property has indexer syntax. In this case it enables myInd to use "array syntax" (e.g. myInd[9]).
It allows your class to behave in a similar manner to an array. In this case, your indexer is allowing you to reference myData transparently from outside the IntIndexer class. If you didn't have the indexer declared, the following code would fail: ``` myInd[1] = "Something"; ```
1,203,646
in the following indexer code block, why do we need: ``` public string this[int pos] { get { return myData[pos]; } set { myData[pos] = value; } } ``` what exactly does "this" in this[int pos] do? Thanks ``` /// Indexer Code Block starts here using System; /// <summary> /// ...
2009/07/29
[ "https://Stackoverflow.com/questions/1203646", "https://Stackoverflow.com", "https://Stackoverflow.com/users/133466/" ]
It means that you can use the indexer on the object itself (like an array). ``` class Foo { public string this[int i] { get { return someData[i]; } set { someData i = value; } } } // ... later in code Foo f = new Foo( ); string s = f[0]; ```
The 'this' keyword indicates that you are defining behavior that will be invoked when your class is accessed as if it was an array. Since your defining behavior for the class instance, use of the 'this' keyword in that context makes sense. You don't call myInd.indexer[], you call myInd[].
1,203,646
in the following indexer code block, why do we need: ``` public string this[int pos] { get { return myData[pos]; } set { myData[pos] = value; } } ``` what exactly does "this" in this[int pos] do? Thanks ``` /// Indexer Code Block starts here using System; /// <summary> /// ...
2009/07/29
[ "https://Stackoverflow.com/questions/1203646", "https://Stackoverflow.com", "https://Stackoverflow.com/users/133466/" ]
**From a c# syntax perspective:** You need `this` because - how else would you declare it? Functionality on a class must have a name, or address, by which to reference it. A method signature is: ``` [modifiers] [type] [name] (parameters) public string GetString (Type myparam); ``` A property signature...
The "this" in your case specifies that this property is the [indexer](http://msdn.microsoft.com/en-us/library/aa288464%28VS.71%29.aspx) for this class. This is the syntax in C# to define an indexer on a class, so you can use it like: ``` myInd[9] = ... ```
1,203,646
in the following indexer code block, why do we need: ``` public string this[int pos] { get { return myData[pos]; } set { myData[pos] = value; } } ``` what exactly does "this" in this[int pos] do? Thanks ``` /// Indexer Code Block starts here using System; /// <summary> /// ...
2009/07/29
[ "https://Stackoverflow.com/questions/1203646", "https://Stackoverflow.com", "https://Stackoverflow.com/users/133466/" ]
This is just marker for compiler to know that that property has indexer syntax. In this case it enables myInd to use "array syntax" (e.g. myInd[9]).
The 'this' keyword indicates that you are defining behavior that will be invoked when your class is accessed as if it was an array. Since your defining behavior for the class instance, use of the 'this' keyword in that context makes sense. You don't call myInd.indexer[], you call myInd[].
1,203,646
in the following indexer code block, why do we need: ``` public string this[int pos] { get { return myData[pos]; } set { myData[pos] = value; } } ``` what exactly does "this" in this[int pos] do? Thanks ``` /// Indexer Code Block starts here using System; /// <summary> /// ...
2009/07/29
[ "https://Stackoverflow.com/questions/1203646", "https://Stackoverflow.com", "https://Stackoverflow.com/users/133466/" ]
**From a c# syntax perspective:** You need `this` because - how else would you declare it? Functionality on a class must have a name, or address, by which to reference it. A method signature is: ``` [modifiers] [type] [name] (parameters) public string GetString (Type myparam); ``` A property signature...
This is just marker for compiler to know that that property has indexer syntax. In this case it enables myInd to use "array syntax" (e.g. myInd[9]).