qid
int64
1
74.7M
question
stringlengths
0
58.3k
date
stringlengths
10
10
metadata
sequence
response_j
stringlengths
2
48.3k
response_k
stringlengths
2
40.5k
50,753,645
I am facing the following situation: I own a domain name, let's say example.com at name.com We have a website hosted at bluehost on a shared hosting with an IP1 We have an ERP (odoo) hosted at digitalocean on a droplet where Nginx is running and where IP2 is allocated. The erp is accesible via IP2:port\_number I am trying to redirect erp.example.com in direction of odoo while keeping the main domaine <http://example.com> to point to IP1 I have tried to setup two A record. One for erp.example.com to point to IP2 but here I can not specify the port at name.com, problem is it doesn't seems even to point on the 80 port as I don't see the Nginx welcome page when I type <http://erp.example.com> I have setup another A record which point to the bluehost IP1 on a wordpress website and this works fine. DNS are recorded with two ns of bluehost only. Based on my understanding I should point the erp.example.com to IP2, then set nginx to filter erp.example.com to go to IP2:port with a redirection ? I don't understand why my A record pointing to IP2 doesn't direct me to the digital ocean server. In Chrome it gives me a ERR\_NAME\_NOT\_RESOLVED . What am I doing wrong ?
2018/06/08
[ "https://Stackoverflow.com/questions/50753645", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5594353/" ]
How a form need be setup **0. Static design** Html markup should hold how the design is structured and laid out. Any permanent classes are to be applied directly in markup. **1. Constructor** Setup dependencies, like services, providers, configuration etc. These enable the component to manage itself along with interact with other elements. **2. Initializer (ngOnInit)** Populates form elements like dropdowns etc when their values are to be retrieved from external source, rather than being known at design time. This is to be done once only to setup the initial rendering of the form **3. Input changes (ngOnChanges)** Runs on every change on any input, and perform any action which gets triggered by that particular control. For example, if there are multiple inputs and on any validation failure on a single one, you need to focus on the failed control and disable *all* others, you can do it here. Useful for validation logic. Not to be used to handle other control's layout and structure. This often runs recursively if one control impacts others so logic has to be carefully designed. If you want to prevent this from running, you can disable the Angular change detection and manually handle the state yourself. **4. Control's event handlers** Here you take in the final value of the control and use it to perform manipulation of other controls in the form. As soon as you change the value of other controls, the ngOnChanges event fires again.
ngOnChanges() is called whenever input bound properties of its component changes, it receives an object called SimpleChanges which contains changed and previous property. ngOnInit() is used to initialize things in a component,unlike ngOnChanges() it is called only once and after first ngOnChanges().
50,753,645
I am facing the following situation: I own a domain name, let's say example.com at name.com We have a website hosted at bluehost on a shared hosting with an IP1 We have an ERP (odoo) hosted at digitalocean on a droplet where Nginx is running and where IP2 is allocated. The erp is accesible via IP2:port\_number I am trying to redirect erp.example.com in direction of odoo while keeping the main domaine <http://example.com> to point to IP1 I have tried to setup two A record. One for erp.example.com to point to IP2 but here I can not specify the port at name.com, problem is it doesn't seems even to point on the 80 port as I don't see the Nginx welcome page when I type <http://erp.example.com> I have setup another A record which point to the bluehost IP1 on a wordpress website and this works fine. DNS are recorded with two ns of bluehost only. Based on my understanding I should point the erp.example.com to IP2, then set nginx to filter erp.example.com to go to IP2:port with a redirection ? I don't understand why my A record pointing to IP2 doesn't direct me to the digital ocean server. In Chrome it gives me a ERR\_NAME\_NOT\_RESOLVED . What am I doing wrong ?
2018/06/08
[ "https://Stackoverflow.com/questions/50753645", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5594353/" ]
ngOnInit and ngOnChanges are functions belonging to a component life-cycle method groups and they are executed in a different moment of our component (that's why name life-cycle). Here is a list of all of them: [![enter image description here](https://i.stack.imgur.com/JwzQ4.png)](https://i.stack.imgur.com/JwzQ4.png)
ngOnChanges() is called whenever input bound properties of its component changes, it receives an object called SimpleChanges which contains changed and previous property. ngOnInit() is used to initialize things in a component,unlike ngOnChanges() it is called only once and after first ngOnChanges().
50,753,645
I am facing the following situation: I own a domain name, let's say example.com at name.com We have a website hosted at bluehost on a shared hosting with an IP1 We have an ERP (odoo) hosted at digitalocean on a droplet where Nginx is running and where IP2 is allocated. The erp is accesible via IP2:port\_number I am trying to redirect erp.example.com in direction of odoo while keeping the main domaine <http://example.com> to point to IP1 I have tried to setup two A record. One for erp.example.com to point to IP2 but here I can not specify the port at name.com, problem is it doesn't seems even to point on the 80 port as I don't see the Nginx welcome page when I type <http://erp.example.com> I have setup another A record which point to the bluehost IP1 on a wordpress website and this works fine. DNS are recorded with two ns of bluehost only. Based on my understanding I should point the erp.example.com to IP2, then set nginx to filter erp.example.com to go to IP2:port with a redirection ? I don't understand why my A record pointing to IP2 doesn't direct me to the digital ocean server. In Chrome it gives me a ERR\_NAME\_NOT\_RESOLVED . What am I doing wrong ?
2018/06/08
[ "https://Stackoverflow.com/questions/50753645", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5594353/" ]
How a form need be setup **0. Static design** Html markup should hold how the design is structured and laid out. Any permanent classes are to be applied directly in markup. **1. Constructor** Setup dependencies, like services, providers, configuration etc. These enable the component to manage itself along with interact with other elements. **2. Initializer (ngOnInit)** Populates form elements like dropdowns etc when their values are to be retrieved from external source, rather than being known at design time. This is to be done once only to setup the initial rendering of the form **3. Input changes (ngOnChanges)** Runs on every change on any input, and perform any action which gets triggered by that particular control. For example, if there are multiple inputs and on any validation failure on a single one, you need to focus on the failed control and disable *all* others, you can do it here. Useful for validation logic. Not to be used to handle other control's layout and structure. This often runs recursively if one control impacts others so logic has to be carefully designed. If you want to prevent this from running, you can disable the Angular change detection and manually handle the state yourself. **4. Control's event handlers** Here you take in the final value of the control and use it to perform manipulation of other controls in the form. As soon as you change the value of other controls, the ngOnChanges event fires again.
ngOnChanges will be called first on the life cycle hook when there is a change to the component inputs through the parent. ngOnInit will be called only once on initializing the component after the first ngOnChanges called.
50,753,645
I am facing the following situation: I own a domain name, let's say example.com at name.com We have a website hosted at bluehost on a shared hosting with an IP1 We have an ERP (odoo) hosted at digitalocean on a droplet where Nginx is running and where IP2 is allocated. The erp is accesible via IP2:port\_number I am trying to redirect erp.example.com in direction of odoo while keeping the main domaine <http://example.com> to point to IP1 I have tried to setup two A record. One for erp.example.com to point to IP2 but here I can not specify the port at name.com, problem is it doesn't seems even to point on the 80 port as I don't see the Nginx welcome page when I type <http://erp.example.com> I have setup another A record which point to the bluehost IP1 on a wordpress website and this works fine. DNS are recorded with two ns of bluehost only. Based on my understanding I should point the erp.example.com to IP2, then set nginx to filter erp.example.com to go to IP2:port with a redirection ? I don't understand why my A record pointing to IP2 doesn't direct me to the digital ocean server. In Chrome it gives me a ERR\_NAME\_NOT\_RESOLVED . What am I doing wrong ?
2018/06/08
[ "https://Stackoverflow.com/questions/50753645", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5594353/" ]
ngOnInit and ngOnChanges are functions belonging to a component life-cycle method groups and they are executed in a different moment of our component (that's why name life-cycle). Here is a list of all of them: [![enter image description here](https://i.stack.imgur.com/JwzQ4.png)](https://i.stack.imgur.com/JwzQ4.png)
ngOnChanges will be called first on the life cycle hook when there is a change to the component inputs through the parent. ngOnInit will be called only once on initializing the component after the first ngOnChanges called.
50,753,645
I am facing the following situation: I own a domain name, let's say example.com at name.com We have a website hosted at bluehost on a shared hosting with an IP1 We have an ERP (odoo) hosted at digitalocean on a droplet where Nginx is running and where IP2 is allocated. The erp is accesible via IP2:port\_number I am trying to redirect erp.example.com in direction of odoo while keeping the main domaine <http://example.com> to point to IP1 I have tried to setup two A record. One for erp.example.com to point to IP2 but here I can not specify the port at name.com, problem is it doesn't seems even to point on the 80 port as I don't see the Nginx welcome page when I type <http://erp.example.com> I have setup another A record which point to the bluehost IP1 on a wordpress website and this works fine. DNS are recorded with two ns of bluehost only. Based on my understanding I should point the erp.example.com to IP2, then set nginx to filter erp.example.com to go to IP2:port with a redirection ? I don't understand why my A record pointing to IP2 doesn't direct me to the digital ocean server. In Chrome it gives me a ERR\_NAME\_NOT\_RESOLVED . What am I doing wrong ?
2018/06/08
[ "https://Stackoverflow.com/questions/50753645", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5594353/" ]
How a form need be setup **0. Static design** Html markup should hold how the design is structured and laid out. Any permanent classes are to be applied directly in markup. **1. Constructor** Setup dependencies, like services, providers, configuration etc. These enable the component to manage itself along with interact with other elements. **2. Initializer (ngOnInit)** Populates form elements like dropdowns etc when their values are to be retrieved from external source, rather than being known at design time. This is to be done once only to setup the initial rendering of the form **3. Input changes (ngOnChanges)** Runs on every change on any input, and perform any action which gets triggered by that particular control. For example, if there are multiple inputs and on any validation failure on a single one, you need to focus on the failed control and disable *all* others, you can do it here. Useful for validation logic. Not to be used to handle other control's layout and structure. This often runs recursively if one control impacts others so logic has to be carefully designed. If you want to prevent this from running, you can disable the Angular change detection and manually handle the state yourself. **4. Control's event handlers** Here you take in the final value of the control and use it to perform manipulation of other controls in the form. As soon as you change the value of other controls, the ngOnChanges event fires again.
ngOnInit and ngOnChanges are functions belonging to a component life-cycle method groups and they are executed in a different moment of our component (that's why name life-cycle). Here is a list of all of them: [![enter image description here](https://i.stack.imgur.com/JwzQ4.png)](https://i.stack.imgur.com/JwzQ4.png)
4,966,169
example: in abc[2] we find 3rd bit as set then , the actual bit number would be 8\*2+3 that is 19th bit is set!!! like that.
2011/02/11
[ "https://Stackoverflow.com/questions/4966169", "https://Stackoverflow.com", "https://Stackoverflow.com/users/591925/" ]
you can do a simple bit op check: ``` abc[i] & (1 << n) ``` that will be `0` if bit is not set and `(1 << n)` if it is set
This helps? ``` int l = sizeof(abc); int k = sizeof(*abc); int i, j; for (i = 0; i < l; ++i) { char n = abc[i]; for (j = 0; j < k; ++j) { if (n & 0x01) printf("Bit number %d is set.\n", (l*k)-i); n = n >> 1; } } ```
4,966,169
example: in abc[2] we find 3rd bit as set then , the actual bit number would be 8\*2+3 that is 19th bit is set!!! like that.
2011/02/11
[ "https://Stackoverflow.com/questions/4966169", "https://Stackoverflow.com", "https://Stackoverflow.com/users/591925/" ]
you can do a simple bit op check: ``` abc[i] & (1 << n) ``` that will be `0` if bit is not set and `(1 << n)` if it is set
When using GCC you can fasten your bitmap lookup using * [\_\_builtin\_ctzl(word)](http://gcc.gnu.org/onlinedocs/gcc-4.5.2/gcc/Other-Builtins.html#index-g_t_005f_005fbuiltin_005fctzl-3060 "__builtin_ctzl") to locate the first bit (low order) set in a uint32\_t * (((sizeof(word) \* 8) - 1) - [\_\_builtin\_clzl(word))](http://gcc.gnu.org/onlinedocs/gcc-4.5.2/gcc/Other-Builtins.html#index-g_t_005f_005fbuiltin_005fclzl-3059 "__builtin_clzl") to locate the last bit (high order) set in a uint32\_t If you're not willing to use some GCC centric extension and don't wan't to parse your array as uint32\_t, you can still use the [ffs()](http://pubs.opengroup.org/onlinepubs/009695399/functions/ffs.html "ffs at OpenGroup") function to find the first bit (low order) set at each of the array index, see [ffs()](http://www.kernel.org/doc/man-pages/online/pages/man3/ffs.3.html "ffs manpage from Linux")'s manpage.
4,966,169
example: in abc[2] we find 3rd bit as set then , the actual bit number would be 8\*2+3 that is 19th bit is set!!! like that.
2011/02/11
[ "https://Stackoverflow.com/questions/4966169", "https://Stackoverflow.com", "https://Stackoverflow.com/users/591925/" ]
When using GCC you can fasten your bitmap lookup using * [\_\_builtin\_ctzl(word)](http://gcc.gnu.org/onlinedocs/gcc-4.5.2/gcc/Other-Builtins.html#index-g_t_005f_005fbuiltin_005fctzl-3060 "__builtin_ctzl") to locate the first bit (low order) set in a uint32\_t * (((sizeof(word) \* 8) - 1) - [\_\_builtin\_clzl(word))](http://gcc.gnu.org/onlinedocs/gcc-4.5.2/gcc/Other-Builtins.html#index-g_t_005f_005fbuiltin_005fclzl-3059 "__builtin_clzl") to locate the last bit (high order) set in a uint32\_t If you're not willing to use some GCC centric extension and don't wan't to parse your array as uint32\_t, you can still use the [ffs()](http://pubs.opengroup.org/onlinepubs/009695399/functions/ffs.html "ffs at OpenGroup") function to find the first bit (low order) set at each of the array index, see [ffs()](http://www.kernel.org/doc/man-pages/online/pages/man3/ffs.3.html "ffs manpage from Linux")'s manpage.
This helps? ``` int l = sizeof(abc); int k = sizeof(*abc); int i, j; for (i = 0; i < l; ++i) { char n = abc[i]; for (j = 0; j < k; ++j) { if (n & 0x01) printf("Bit number %d is set.\n", (l*k)-i); n = n >> 1; } } ```
17,925,648
So I'm doing some refactoring and it's really annoying that I don't get all the errors up front. How can I either increase the limit or remove the limit, so that the compiler will output all the errors it can find?
2013/07/29
[ "https://Stackoverflow.com/questions/17925648", "https://Stackoverflow.com", "https://Stackoverflow.com/users/310121/" ]
So I found how to do it. You add this compiler flag: ``` -ferror-limit=0 ``` 0 means that it will not stop because of too many errors. This seems to be a question and answer that explains how to add a compiler flag in Xcode 4: [Xcode Project-Wide compiler flag](https://stackoverflow.com/questions/7932834/xcode-project-wide-compiler-flag)
Preferences > General > [x] Continue Building After Errors [![image of preferences dialog](https://i.stack.imgur.com/JDaeN.png)](https://i.stack.imgur.com/JDaeN.png)
17,925,648
So I'm doing some refactoring and it's really annoying that I don't get all the errors up front. How can I either increase the limit or remove the limit, so that the compiler will output all the errors it can find?
2013/07/29
[ "https://Stackoverflow.com/questions/17925648", "https://Stackoverflow.com", "https://Stackoverflow.com/users/310121/" ]
So I found how to do it. You add this compiler flag: ``` -ferror-limit=0 ``` 0 means that it will not stop because of too many errors. This seems to be a question and answer that explains how to add a compiler flag in Xcode 4: [Xcode Project-Wide compiler flag](https://stackoverflow.com/questions/7932834/xcode-project-wide-compiler-flag)
Here is the complete syntax to compile and pass the flags to the make command: ``` make install CFLAGS="-ferror-limit=0" ``` Also as outlined in the link below: <https://developer.apple.com/library/content/documentation/Porting/Conceptual/PortingUnix/compiling/compiling.html>
17,925,648
So I'm doing some refactoring and it's really annoying that I don't get all the errors up front. How can I either increase the limit or remove the limit, so that the compiler will output all the errors it can find?
2013/07/29
[ "https://Stackoverflow.com/questions/17925648", "https://Stackoverflow.com", "https://Stackoverflow.com/users/310121/" ]
Preferences > General > [x] Continue Building After Errors [![image of preferences dialog](https://i.stack.imgur.com/JDaeN.png)](https://i.stack.imgur.com/JDaeN.png)
Here is the complete syntax to compile and pass the flags to the make command: ``` make install CFLAGS="-ferror-limit=0" ``` Also as outlined in the link below: <https://developer.apple.com/library/content/documentation/Porting/Conceptual/PortingUnix/compiling/compiling.html>
6,160
**September update:** Community Ads are now live network-wide. All ads with a score of 6 or higher, or with a score of 4 or higher *and* no downvotes will be displayed (except for any that have a note from the CM Team explaining why it wasn't selected). Go to [the main post on MSE](https://meta.stackexchange.com/q/364556/208518) for a list of the ads that are being displayed. And stay tuned for 2022's edition for the next opportunity to submit more ad proposals! --- **AUGUST NOTE:** This post has now been locked and new submissions are not being accepted. Ad submissions are now undergoing review by the Community Team, and this question will be updated once the ads are live. --- We're almost halfway through 2021, and [in case you missed it](https://meta.stackexchange.com/q/364556/208518), Community Promotion Ads are gonna be a bit different this time! **TL;DR: submit and vote for ad proposals before August 2nd!** ### What are Community Ads? Community Ads are community-vetted advertisements that will show up on the main site, or on other sites in the network. They can show up in the right sidebar, or in banners in question pages. The purpose of this question is the vetting process. Images of the advertisements are provided, and community voting will enable the advertisements to be considered by [the Community Management Team](https://meta.stackexchange.com/a/99341/208518) to be displayed. ### Why do we have Community Ads? This is a method for the community to control what gets promoted to visitors on the site. The goal of this initiative is for future visitors to find out about *the stuff your community deems important*. This also serves as a way to promote information and resources that are *relevant to your own community's interests*, both for those already in the community and those yet to join. You may want to promote external resources, or Meta guidance for newcomers, for instance. This initiative has an added goal of providing your community with *an opportunity to showcase exemplary questions from your main site, as well as frequently-linked-to guides from your Meta site*. While the latter makes sense to be shown solely on this site, the former can be shown all across the network. These should avoid hot button topics, and instead focus more on evergreen questions that show what your community’s all about. ### Why do we reset the ads? Some services will maintain usefulness over the years, while other things will wane to allow for new faces to show up. Resetting the ads every year helps accommodate this, and allows old ads that have served their purpose to be cycled out for fresher ads for newer things. This helps keep the material in the ads relevant to not just the subject matter of the community, but to the current status of the community. Historically, we've reset the ads every year — since this is the first run of a new format, we'll run the ads collected in this post through the end of 2021 and reassess the rotation cycle then. The community ads have no restrictions against reposting an ad from a previous cycle. If a particular service or ad is very valuable to the community and will continue to be so, it is a good idea to repost it. It may be helpful to give it a new face in the process, so as to prevent the imagery of the ad from getting stale after a previous exposure. ### Are there restrictions to the ads I can post? All proposed ads need to abide by [our Code of Conduct](/conduct). [Our ad creative guidelines](https://stackoverflow.com/advertising/guidelines) also generally apply (note that the first 2 bullet points on the “Tracking” section do not apply, and a lot of the guidelines surrounding claims, comparisons, proof, etc., while still applicable, may not be particularly relevant). Finally, ads can not be promoting products nor soliciting programmer time or resources for: knowledge sharing or collaboration tools for technologists, or for sites where ad buyers are primarily targeting technologists. ### How does it work? The answers you post to this question *must* conform to the following rules, or they will be ignored: 1. **Each answer must relate to a single ad submission.** Please do not post multiple ad submissions in the same answer. 2. All answers must be in one of the below formats: 1. If you have an image for the ad you want to display on this site (must be the case for ads to external sources): ``` [![Image name. Example: "community_ad_name_300x250"][1]][2] [1]: https://image-url [2]: https://clickthrough-url ``` 2. If you want to create an ad for a question from your main or meta site, to be advertised on this or other sites in the network (staff will generate a frame for the ad with this site's theme, for brand consistency): ``` Question title Question URL Ad size (right sidebar or banner ads) Site(s) to be displayed in. Can be: - "self" for ads to be displayed on this site - "all" for ads to be displayed all over the network - a specific subset of sites ``` 3. Please **do not add anything else to the body of the post**. If you want to discuss something, do it in the comments. ### Image requirements * The image that you create must be 300 x 250 pixels for right sidebar ads or 728 x 90 pixels for banner ads. Images can be double that if high DPI. * Must be hosted through our standard image uploader (imgur) * Must be GIF, PNG, or JPG * No animated GIFs * Absolute limit on file size of 150 KB * If the background of the image is white or partially white, there must be a 1px border (2px if high DPI) surrounding it. ### Selection process **This post will remain open for ad submissions and voting until August 2nd**. At that point, the question will be closed/locked, and no more ad submissions will be accepted. For ad submissions to be considered for selection by the Community Management Team, they must have **a minimum score of 6 at the time the post was closed/locked for submissions.** Given this is the first run with this new format, we may adjust the score threshold to be a bit lower if we see ads struggling to get to it (especially if the ads are not getting downvotes) by the time submissions and voting are closed. ### Reporting statistics Once this cycle is over, at the end of 2021, the Community Management Team will provide you with reporting statistics, as described in the "reporting" section of [this post](https://meta.stackexchange.com/q/364556/208518). --- Feel free to use the question's comment section to ask for any clarifications.
2021/06/17
[ "https://stats.meta.stackexchange.com/questions/6160", "https://stats.meta.stackexchange.com", "https://stats.meta.stackexchange.com/users/72321/" ]
Algorithms for automatic model selection [Algorithms for automatic model selection](https://stats.stackexchange.com/questions/20836) Ad size: right sidebar Site(s) to be displayed in: all
What are the shortcomings of the Mean Absolute Percentage Error (MAPE)? [What are the shortcomings of the Mean Absolute Percentage Error (MAPE)?](https://stats.stackexchange.com/questions/299712) Ad size: right sidebar Site(s) to be displayed in: all
6,160
**September update:** Community Ads are now live network-wide. All ads with a score of 6 or higher, or with a score of 4 or higher *and* no downvotes will be displayed (except for any that have a note from the CM Team explaining why it wasn't selected). Go to [the main post on MSE](https://meta.stackexchange.com/q/364556/208518) for a list of the ads that are being displayed. And stay tuned for 2022's edition for the next opportunity to submit more ad proposals! --- **AUGUST NOTE:** This post has now been locked and new submissions are not being accepted. Ad submissions are now undergoing review by the Community Team, and this question will be updated once the ads are live. --- We're almost halfway through 2021, and [in case you missed it](https://meta.stackexchange.com/q/364556/208518), Community Promotion Ads are gonna be a bit different this time! **TL;DR: submit and vote for ad proposals before August 2nd!** ### What are Community Ads? Community Ads are community-vetted advertisements that will show up on the main site, or on other sites in the network. They can show up in the right sidebar, or in banners in question pages. The purpose of this question is the vetting process. Images of the advertisements are provided, and community voting will enable the advertisements to be considered by [the Community Management Team](https://meta.stackexchange.com/a/99341/208518) to be displayed. ### Why do we have Community Ads? This is a method for the community to control what gets promoted to visitors on the site. The goal of this initiative is for future visitors to find out about *the stuff your community deems important*. This also serves as a way to promote information and resources that are *relevant to your own community's interests*, both for those already in the community and those yet to join. You may want to promote external resources, or Meta guidance for newcomers, for instance. This initiative has an added goal of providing your community with *an opportunity to showcase exemplary questions from your main site, as well as frequently-linked-to guides from your Meta site*. While the latter makes sense to be shown solely on this site, the former can be shown all across the network. These should avoid hot button topics, and instead focus more on evergreen questions that show what your community’s all about. ### Why do we reset the ads? Some services will maintain usefulness over the years, while other things will wane to allow for new faces to show up. Resetting the ads every year helps accommodate this, and allows old ads that have served their purpose to be cycled out for fresher ads for newer things. This helps keep the material in the ads relevant to not just the subject matter of the community, but to the current status of the community. Historically, we've reset the ads every year — since this is the first run of a new format, we'll run the ads collected in this post through the end of 2021 and reassess the rotation cycle then. The community ads have no restrictions against reposting an ad from a previous cycle. If a particular service or ad is very valuable to the community and will continue to be so, it is a good idea to repost it. It may be helpful to give it a new face in the process, so as to prevent the imagery of the ad from getting stale after a previous exposure. ### Are there restrictions to the ads I can post? All proposed ads need to abide by [our Code of Conduct](/conduct). [Our ad creative guidelines](https://stackoverflow.com/advertising/guidelines) also generally apply (note that the first 2 bullet points on the “Tracking” section do not apply, and a lot of the guidelines surrounding claims, comparisons, proof, etc., while still applicable, may not be particularly relevant). Finally, ads can not be promoting products nor soliciting programmer time or resources for: knowledge sharing or collaboration tools for technologists, or for sites where ad buyers are primarily targeting technologists. ### How does it work? The answers you post to this question *must* conform to the following rules, or they will be ignored: 1. **Each answer must relate to a single ad submission.** Please do not post multiple ad submissions in the same answer. 2. All answers must be in one of the below formats: 1. If you have an image for the ad you want to display on this site (must be the case for ads to external sources): ``` [![Image name. Example: "community_ad_name_300x250"][1]][2] [1]: https://image-url [2]: https://clickthrough-url ``` 2. If you want to create an ad for a question from your main or meta site, to be advertised on this or other sites in the network (staff will generate a frame for the ad with this site's theme, for brand consistency): ``` Question title Question URL Ad size (right sidebar or banner ads) Site(s) to be displayed in. Can be: - "self" for ads to be displayed on this site - "all" for ads to be displayed all over the network - a specific subset of sites ``` 3. Please **do not add anything else to the body of the post**. If you want to discuss something, do it in the comments. ### Image requirements * The image that you create must be 300 x 250 pixels for right sidebar ads or 728 x 90 pixels for banner ads. Images can be double that if high DPI. * Must be hosted through our standard image uploader (imgur) * Must be GIF, PNG, or JPG * No animated GIFs * Absolute limit on file size of 150 KB * If the background of the image is white or partially white, there must be a 1px border (2px if high DPI) surrounding it. ### Selection process **This post will remain open for ad submissions and voting until August 2nd**. At that point, the question will be closed/locked, and no more ad submissions will be accepted. For ad submissions to be considered for selection by the Community Management Team, they must have **a minimum score of 6 at the time the post was closed/locked for submissions.** Given this is the first run with this new format, we may adjust the score threshold to be a bit lower if we see ads struggling to get to it (especially if the ads are not getting downvotes) by the time submissions and voting are closed. ### Reporting statistics Once this cycle is over, at the end of 2021, the Community Management Team will provide you with reporting statistics, as described in the "reporting" section of [this post](https://meta.stackexchange.com/q/364556/208518). --- Feel free to use the question's comment section to ask for any clarifications.
2021/06/17
[ "https://stats.meta.stackexchange.com/questions/6160", "https://stats.meta.stackexchange.com", "https://stats.meta.stackexchange.com/users/72321/" ]
[![Common topics on Matter Modeling SE](https://i.stack.imgur.com/GVzhj.png)](https://mattermodeling.stackexchange.com/)
How to find a good fit for semi-sinusoidal model in R? [How to find a good fit for semi-sinusoidal model in R?](https://stats.stackexchange.com/questions/60500) Ad size: right sidebar Site(s) to be displayed in: all
6,160
**September update:** Community Ads are now live network-wide. All ads with a score of 6 or higher, or with a score of 4 or higher *and* no downvotes will be displayed (except for any that have a note from the CM Team explaining why it wasn't selected). Go to [the main post on MSE](https://meta.stackexchange.com/q/364556/208518) for a list of the ads that are being displayed. And stay tuned for 2022's edition for the next opportunity to submit more ad proposals! --- **AUGUST NOTE:** This post has now been locked and new submissions are not being accepted. Ad submissions are now undergoing review by the Community Team, and this question will be updated once the ads are live. --- We're almost halfway through 2021, and [in case you missed it](https://meta.stackexchange.com/q/364556/208518), Community Promotion Ads are gonna be a bit different this time! **TL;DR: submit and vote for ad proposals before August 2nd!** ### What are Community Ads? Community Ads are community-vetted advertisements that will show up on the main site, or on other sites in the network. They can show up in the right sidebar, or in banners in question pages. The purpose of this question is the vetting process. Images of the advertisements are provided, and community voting will enable the advertisements to be considered by [the Community Management Team](https://meta.stackexchange.com/a/99341/208518) to be displayed. ### Why do we have Community Ads? This is a method for the community to control what gets promoted to visitors on the site. The goal of this initiative is for future visitors to find out about *the stuff your community deems important*. This also serves as a way to promote information and resources that are *relevant to your own community's interests*, both for those already in the community and those yet to join. You may want to promote external resources, or Meta guidance for newcomers, for instance. This initiative has an added goal of providing your community with *an opportunity to showcase exemplary questions from your main site, as well as frequently-linked-to guides from your Meta site*. While the latter makes sense to be shown solely on this site, the former can be shown all across the network. These should avoid hot button topics, and instead focus more on evergreen questions that show what your community’s all about. ### Why do we reset the ads? Some services will maintain usefulness over the years, while other things will wane to allow for new faces to show up. Resetting the ads every year helps accommodate this, and allows old ads that have served their purpose to be cycled out for fresher ads for newer things. This helps keep the material in the ads relevant to not just the subject matter of the community, but to the current status of the community. Historically, we've reset the ads every year — since this is the first run of a new format, we'll run the ads collected in this post through the end of 2021 and reassess the rotation cycle then. The community ads have no restrictions against reposting an ad from a previous cycle. If a particular service or ad is very valuable to the community and will continue to be so, it is a good idea to repost it. It may be helpful to give it a new face in the process, so as to prevent the imagery of the ad from getting stale after a previous exposure. ### Are there restrictions to the ads I can post? All proposed ads need to abide by [our Code of Conduct](/conduct). [Our ad creative guidelines](https://stackoverflow.com/advertising/guidelines) also generally apply (note that the first 2 bullet points on the “Tracking” section do not apply, and a lot of the guidelines surrounding claims, comparisons, proof, etc., while still applicable, may not be particularly relevant). Finally, ads can not be promoting products nor soliciting programmer time or resources for: knowledge sharing or collaboration tools for technologists, or for sites where ad buyers are primarily targeting technologists. ### How does it work? The answers you post to this question *must* conform to the following rules, or they will be ignored: 1. **Each answer must relate to a single ad submission.** Please do not post multiple ad submissions in the same answer. 2. All answers must be in one of the below formats: 1. If you have an image for the ad you want to display on this site (must be the case for ads to external sources): ``` [![Image name. Example: "community_ad_name_300x250"][1]][2] [1]: https://image-url [2]: https://clickthrough-url ``` 2. If you want to create an ad for a question from your main or meta site, to be advertised on this or other sites in the network (staff will generate a frame for the ad with this site's theme, for brand consistency): ``` Question title Question URL Ad size (right sidebar or banner ads) Site(s) to be displayed in. Can be: - "self" for ads to be displayed on this site - "all" for ads to be displayed all over the network - a specific subset of sites ``` 3. Please **do not add anything else to the body of the post**. If you want to discuss something, do it in the comments. ### Image requirements * The image that you create must be 300 x 250 pixels for right sidebar ads or 728 x 90 pixels for banner ads. Images can be double that if high DPI. * Must be hosted through our standard image uploader (imgur) * Must be GIF, PNG, or JPG * No animated GIFs * Absolute limit on file size of 150 KB * If the background of the image is white or partially white, there must be a 1px border (2px if high DPI) surrounding it. ### Selection process **This post will remain open for ad submissions and voting until August 2nd**. At that point, the question will be closed/locked, and no more ad submissions will be accepted. For ad submissions to be considered for selection by the Community Management Team, they must have **a minimum score of 6 at the time the post was closed/locked for submissions.** Given this is the first run with this new format, we may adjust the score threshold to be a bit lower if we see ads struggling to get to it (especially if the ads are not getting downvotes) by the time submissions and voting are closed. ### Reporting statistics Once this cycle is over, at the end of 2021, the Community Management Team will provide you with reporting statistics, as described in the "reporting" section of [this post](https://meta.stackexchange.com/q/364556/208518). --- Feel free to use the question's comment section to ask for any clarifications.
2021/06/17
[ "https://stats.meta.stackexchange.com/questions/6160", "https://stats.meta.stackexchange.com", "https://stats.meta.stackexchange.com/users/72321/" ]
Why is accuracy not the best measure for assessing classification models? [Why is accuracy not the best measure for assessing classification models?](https://stats.stackexchange.com/questions/312780/) Ad size: right sidebar Site(s) to be displayed in: all
Can simple linear regression be done without using plots and linear algebra? [Can simple linear regression be done without using plots and linear algebra?](https://stats.stackexchange.com/questions/204930) Ad size: right sidebar Site(s) to be displayed in: all
6,160
**September update:** Community Ads are now live network-wide. All ads with a score of 6 or higher, or with a score of 4 or higher *and* no downvotes will be displayed (except for any that have a note from the CM Team explaining why it wasn't selected). Go to [the main post on MSE](https://meta.stackexchange.com/q/364556/208518) for a list of the ads that are being displayed. And stay tuned for 2022's edition for the next opportunity to submit more ad proposals! --- **AUGUST NOTE:** This post has now been locked and new submissions are not being accepted. Ad submissions are now undergoing review by the Community Team, and this question will be updated once the ads are live. --- We're almost halfway through 2021, and [in case you missed it](https://meta.stackexchange.com/q/364556/208518), Community Promotion Ads are gonna be a bit different this time! **TL;DR: submit and vote for ad proposals before August 2nd!** ### What are Community Ads? Community Ads are community-vetted advertisements that will show up on the main site, or on other sites in the network. They can show up in the right sidebar, or in banners in question pages. The purpose of this question is the vetting process. Images of the advertisements are provided, and community voting will enable the advertisements to be considered by [the Community Management Team](https://meta.stackexchange.com/a/99341/208518) to be displayed. ### Why do we have Community Ads? This is a method for the community to control what gets promoted to visitors on the site. The goal of this initiative is for future visitors to find out about *the stuff your community deems important*. This also serves as a way to promote information and resources that are *relevant to your own community's interests*, both for those already in the community and those yet to join. You may want to promote external resources, or Meta guidance for newcomers, for instance. This initiative has an added goal of providing your community with *an opportunity to showcase exemplary questions from your main site, as well as frequently-linked-to guides from your Meta site*. While the latter makes sense to be shown solely on this site, the former can be shown all across the network. These should avoid hot button topics, and instead focus more on evergreen questions that show what your community’s all about. ### Why do we reset the ads? Some services will maintain usefulness over the years, while other things will wane to allow for new faces to show up. Resetting the ads every year helps accommodate this, and allows old ads that have served their purpose to be cycled out for fresher ads for newer things. This helps keep the material in the ads relevant to not just the subject matter of the community, but to the current status of the community. Historically, we've reset the ads every year — since this is the first run of a new format, we'll run the ads collected in this post through the end of 2021 and reassess the rotation cycle then. The community ads have no restrictions against reposting an ad from a previous cycle. If a particular service or ad is very valuable to the community and will continue to be so, it is a good idea to repost it. It may be helpful to give it a new face in the process, so as to prevent the imagery of the ad from getting stale after a previous exposure. ### Are there restrictions to the ads I can post? All proposed ads need to abide by [our Code of Conduct](/conduct). [Our ad creative guidelines](https://stackoverflow.com/advertising/guidelines) also generally apply (note that the first 2 bullet points on the “Tracking” section do not apply, and a lot of the guidelines surrounding claims, comparisons, proof, etc., while still applicable, may not be particularly relevant). Finally, ads can not be promoting products nor soliciting programmer time or resources for: knowledge sharing or collaboration tools for technologists, or for sites where ad buyers are primarily targeting technologists. ### How does it work? The answers you post to this question *must* conform to the following rules, or they will be ignored: 1. **Each answer must relate to a single ad submission.** Please do not post multiple ad submissions in the same answer. 2. All answers must be in one of the below formats: 1. If you have an image for the ad you want to display on this site (must be the case for ads to external sources): ``` [![Image name. Example: "community_ad_name_300x250"][1]][2] [1]: https://image-url [2]: https://clickthrough-url ``` 2. If you want to create an ad for a question from your main or meta site, to be advertised on this or other sites in the network (staff will generate a frame for the ad with this site's theme, for brand consistency): ``` Question title Question URL Ad size (right sidebar or banner ads) Site(s) to be displayed in. Can be: - "self" for ads to be displayed on this site - "all" for ads to be displayed all over the network - a specific subset of sites ``` 3. Please **do not add anything else to the body of the post**. If you want to discuss something, do it in the comments. ### Image requirements * The image that you create must be 300 x 250 pixels for right sidebar ads or 728 x 90 pixels for banner ads. Images can be double that if high DPI. * Must be hosted through our standard image uploader (imgur) * Must be GIF, PNG, or JPG * No animated GIFs * Absolute limit on file size of 150 KB * If the background of the image is white or partially white, there must be a 1px border (2px if high DPI) surrounding it. ### Selection process **This post will remain open for ad submissions and voting until August 2nd**. At that point, the question will be closed/locked, and no more ad submissions will be accepted. For ad submissions to be considered for selection by the Community Management Team, they must have **a minimum score of 6 at the time the post was closed/locked for submissions.** Given this is the first run with this new format, we may adjust the score threshold to be a bit lower if we see ads struggling to get to it (especially if the ads are not getting downvotes) by the time submissions and voting are closed. ### Reporting statistics Once this cycle is over, at the end of 2021, the Community Management Team will provide you with reporting statistics, as described in the "reporting" section of [this post](https://meta.stackexchange.com/q/364556/208518). --- Feel free to use the question's comment section to ask for any clarifications.
2021/06/17
[ "https://stats.meta.stackexchange.com/questions/6160", "https://stats.meta.stackexchange.com", "https://stats.meta.stackexchange.com/users/72321/" ]
When if ever is a median statistic a sufficient statistic? [When if ever is a median statistic a sufficient statistic?](https://stats.stackexchange.com/questions/122917) Ad size: right sidebar Site(s) to be displayed in: all
How to find a good fit for semi-sinusoidal model in R? [How to find a good fit for semi-sinusoidal model in R?](https://stats.stackexchange.com/questions/60500) Ad size: right sidebar Site(s) to be displayed in: all
6,160
**September update:** Community Ads are now live network-wide. All ads with a score of 6 or higher, or with a score of 4 or higher *and* no downvotes will be displayed (except for any that have a note from the CM Team explaining why it wasn't selected). Go to [the main post on MSE](https://meta.stackexchange.com/q/364556/208518) for a list of the ads that are being displayed. And stay tuned for 2022's edition for the next opportunity to submit more ad proposals! --- **AUGUST NOTE:** This post has now been locked and new submissions are not being accepted. Ad submissions are now undergoing review by the Community Team, and this question will be updated once the ads are live. --- We're almost halfway through 2021, and [in case you missed it](https://meta.stackexchange.com/q/364556/208518), Community Promotion Ads are gonna be a bit different this time! **TL;DR: submit and vote for ad proposals before August 2nd!** ### What are Community Ads? Community Ads are community-vetted advertisements that will show up on the main site, or on other sites in the network. They can show up in the right sidebar, or in banners in question pages. The purpose of this question is the vetting process. Images of the advertisements are provided, and community voting will enable the advertisements to be considered by [the Community Management Team](https://meta.stackexchange.com/a/99341/208518) to be displayed. ### Why do we have Community Ads? This is a method for the community to control what gets promoted to visitors on the site. The goal of this initiative is for future visitors to find out about *the stuff your community deems important*. This also serves as a way to promote information and resources that are *relevant to your own community's interests*, both for those already in the community and those yet to join. You may want to promote external resources, or Meta guidance for newcomers, for instance. This initiative has an added goal of providing your community with *an opportunity to showcase exemplary questions from your main site, as well as frequently-linked-to guides from your Meta site*. While the latter makes sense to be shown solely on this site, the former can be shown all across the network. These should avoid hot button topics, and instead focus more on evergreen questions that show what your community’s all about. ### Why do we reset the ads? Some services will maintain usefulness over the years, while other things will wane to allow for new faces to show up. Resetting the ads every year helps accommodate this, and allows old ads that have served their purpose to be cycled out for fresher ads for newer things. This helps keep the material in the ads relevant to not just the subject matter of the community, but to the current status of the community. Historically, we've reset the ads every year — since this is the first run of a new format, we'll run the ads collected in this post through the end of 2021 and reassess the rotation cycle then. The community ads have no restrictions against reposting an ad from a previous cycle. If a particular service or ad is very valuable to the community and will continue to be so, it is a good idea to repost it. It may be helpful to give it a new face in the process, so as to prevent the imagery of the ad from getting stale after a previous exposure. ### Are there restrictions to the ads I can post? All proposed ads need to abide by [our Code of Conduct](/conduct). [Our ad creative guidelines](https://stackoverflow.com/advertising/guidelines) also generally apply (note that the first 2 bullet points on the “Tracking” section do not apply, and a lot of the guidelines surrounding claims, comparisons, proof, etc., while still applicable, may not be particularly relevant). Finally, ads can not be promoting products nor soliciting programmer time or resources for: knowledge sharing or collaboration tools for technologists, or for sites where ad buyers are primarily targeting technologists. ### How does it work? The answers you post to this question *must* conform to the following rules, or they will be ignored: 1. **Each answer must relate to a single ad submission.** Please do not post multiple ad submissions in the same answer. 2. All answers must be in one of the below formats: 1. If you have an image for the ad you want to display on this site (must be the case for ads to external sources): ``` [![Image name. Example: "community_ad_name_300x250"][1]][2] [1]: https://image-url [2]: https://clickthrough-url ``` 2. If you want to create an ad for a question from your main or meta site, to be advertised on this or other sites in the network (staff will generate a frame for the ad with this site's theme, for brand consistency): ``` Question title Question URL Ad size (right sidebar or banner ads) Site(s) to be displayed in. Can be: - "self" for ads to be displayed on this site - "all" for ads to be displayed all over the network - a specific subset of sites ``` 3. Please **do not add anything else to the body of the post**. If you want to discuss something, do it in the comments. ### Image requirements * The image that you create must be 300 x 250 pixels for right sidebar ads or 728 x 90 pixels for banner ads. Images can be double that if high DPI. * Must be hosted through our standard image uploader (imgur) * Must be GIF, PNG, or JPG * No animated GIFs * Absolute limit on file size of 150 KB * If the background of the image is white or partially white, there must be a 1px border (2px if high DPI) surrounding it. ### Selection process **This post will remain open for ad submissions and voting until August 2nd**. At that point, the question will be closed/locked, and no more ad submissions will be accepted. For ad submissions to be considered for selection by the Community Management Team, they must have **a minimum score of 6 at the time the post was closed/locked for submissions.** Given this is the first run with this new format, we may adjust the score threshold to be a bit lower if we see ads struggling to get to it (especially if the ads are not getting downvotes) by the time submissions and voting are closed. ### Reporting statistics Once this cycle is over, at the end of 2021, the Community Management Team will provide you with reporting statistics, as described in the "reporting" section of [this post](https://meta.stackexchange.com/q/364556/208518). --- Feel free to use the question's comment section to ask for any clarifications.
2021/06/17
[ "https://stats.meta.stackexchange.com/questions/6160", "https://stats.meta.stackexchange.com", "https://stats.meta.stackexchange.com/users/72321/" ]
What should I do when my neural network doesn't learn? [What should I do when my neural network doesn't learn?](https://stats.stackexchange.com/questions/352036) Ad size: right sidebar Site(s) to be displayed in: all
When to choose SARSA vs. Q Learning [When to choose SARSA vs. Q Learning](https://stats.stackexchange.com/questions/326788) Ad size: right sidebar Site(s) to be displayed in: all
6,160
**September update:** Community Ads are now live network-wide. All ads with a score of 6 or higher, or with a score of 4 or higher *and* no downvotes will be displayed (except for any that have a note from the CM Team explaining why it wasn't selected). Go to [the main post on MSE](https://meta.stackexchange.com/q/364556/208518) for a list of the ads that are being displayed. And stay tuned for 2022's edition for the next opportunity to submit more ad proposals! --- **AUGUST NOTE:** This post has now been locked and new submissions are not being accepted. Ad submissions are now undergoing review by the Community Team, and this question will be updated once the ads are live. --- We're almost halfway through 2021, and [in case you missed it](https://meta.stackexchange.com/q/364556/208518), Community Promotion Ads are gonna be a bit different this time! **TL;DR: submit and vote for ad proposals before August 2nd!** ### What are Community Ads? Community Ads are community-vetted advertisements that will show up on the main site, or on other sites in the network. They can show up in the right sidebar, or in banners in question pages. The purpose of this question is the vetting process. Images of the advertisements are provided, and community voting will enable the advertisements to be considered by [the Community Management Team](https://meta.stackexchange.com/a/99341/208518) to be displayed. ### Why do we have Community Ads? This is a method for the community to control what gets promoted to visitors on the site. The goal of this initiative is for future visitors to find out about *the stuff your community deems important*. This also serves as a way to promote information and resources that are *relevant to your own community's interests*, both for those already in the community and those yet to join. You may want to promote external resources, or Meta guidance for newcomers, for instance. This initiative has an added goal of providing your community with *an opportunity to showcase exemplary questions from your main site, as well as frequently-linked-to guides from your Meta site*. While the latter makes sense to be shown solely on this site, the former can be shown all across the network. These should avoid hot button topics, and instead focus more on evergreen questions that show what your community’s all about. ### Why do we reset the ads? Some services will maintain usefulness over the years, while other things will wane to allow for new faces to show up. Resetting the ads every year helps accommodate this, and allows old ads that have served their purpose to be cycled out for fresher ads for newer things. This helps keep the material in the ads relevant to not just the subject matter of the community, but to the current status of the community. Historically, we've reset the ads every year — since this is the first run of a new format, we'll run the ads collected in this post through the end of 2021 and reassess the rotation cycle then. The community ads have no restrictions against reposting an ad from a previous cycle. If a particular service or ad is very valuable to the community and will continue to be so, it is a good idea to repost it. It may be helpful to give it a new face in the process, so as to prevent the imagery of the ad from getting stale after a previous exposure. ### Are there restrictions to the ads I can post? All proposed ads need to abide by [our Code of Conduct](/conduct). [Our ad creative guidelines](https://stackoverflow.com/advertising/guidelines) also generally apply (note that the first 2 bullet points on the “Tracking” section do not apply, and a lot of the guidelines surrounding claims, comparisons, proof, etc., while still applicable, may not be particularly relevant). Finally, ads can not be promoting products nor soliciting programmer time or resources for: knowledge sharing or collaboration tools for technologists, or for sites where ad buyers are primarily targeting technologists. ### How does it work? The answers you post to this question *must* conform to the following rules, or they will be ignored: 1. **Each answer must relate to a single ad submission.** Please do not post multiple ad submissions in the same answer. 2. All answers must be in one of the below formats: 1. If you have an image for the ad you want to display on this site (must be the case for ads to external sources): ``` [![Image name. Example: "community_ad_name_300x250"][1]][2] [1]: https://image-url [2]: https://clickthrough-url ``` 2. If you want to create an ad for a question from your main or meta site, to be advertised on this or other sites in the network (staff will generate a frame for the ad with this site's theme, for brand consistency): ``` Question title Question URL Ad size (right sidebar or banner ads) Site(s) to be displayed in. Can be: - "self" for ads to be displayed on this site - "all" for ads to be displayed all over the network - a specific subset of sites ``` 3. Please **do not add anything else to the body of the post**. If you want to discuss something, do it in the comments. ### Image requirements * The image that you create must be 300 x 250 pixels for right sidebar ads or 728 x 90 pixels for banner ads. Images can be double that if high DPI. * Must be hosted through our standard image uploader (imgur) * Must be GIF, PNG, or JPG * No animated GIFs * Absolute limit on file size of 150 KB * If the background of the image is white or partially white, there must be a 1px border (2px if high DPI) surrounding it. ### Selection process **This post will remain open for ad submissions and voting until August 2nd**. At that point, the question will be closed/locked, and no more ad submissions will be accepted. For ad submissions to be considered for selection by the Community Management Team, they must have **a minimum score of 6 at the time the post was closed/locked for submissions.** Given this is the first run with this new format, we may adjust the score threshold to be a bit lower if we see ads struggling to get to it (especially if the ads are not getting downvotes) by the time submissions and voting are closed. ### Reporting statistics Once this cycle is over, at the end of 2021, the Community Management Team will provide you with reporting statistics, as described in the "reporting" section of [this post](https://meta.stackexchange.com/q/364556/208518). --- Feel free to use the question's comment section to ask for any clarifications.
2021/06/17
[ "https://stats.meta.stackexchange.com/questions/6160", "https://stats.meta.stackexchange.com", "https://stats.meta.stackexchange.com/users/72321/" ]
Problems with pie charts [Problems with pie charts](https://stats.stackexchange.com/questions/8974) Ad size: right sidebar Site(s) to be displayed in: all
[![Common topics on Matter Modeling SE](https://i.stack.imgur.com/GVzhj.png)](https://mattermodeling.stackexchange.com/)
6,160
**September update:** Community Ads are now live network-wide. All ads with a score of 6 or higher, or with a score of 4 or higher *and* no downvotes will be displayed (except for any that have a note from the CM Team explaining why it wasn't selected). Go to [the main post on MSE](https://meta.stackexchange.com/q/364556/208518) for a list of the ads that are being displayed. And stay tuned for 2022's edition for the next opportunity to submit more ad proposals! --- **AUGUST NOTE:** This post has now been locked and new submissions are not being accepted. Ad submissions are now undergoing review by the Community Team, and this question will be updated once the ads are live. --- We're almost halfway through 2021, and [in case you missed it](https://meta.stackexchange.com/q/364556/208518), Community Promotion Ads are gonna be a bit different this time! **TL;DR: submit and vote for ad proposals before August 2nd!** ### What are Community Ads? Community Ads are community-vetted advertisements that will show up on the main site, or on other sites in the network. They can show up in the right sidebar, or in banners in question pages. The purpose of this question is the vetting process. Images of the advertisements are provided, and community voting will enable the advertisements to be considered by [the Community Management Team](https://meta.stackexchange.com/a/99341/208518) to be displayed. ### Why do we have Community Ads? This is a method for the community to control what gets promoted to visitors on the site. The goal of this initiative is for future visitors to find out about *the stuff your community deems important*. This also serves as a way to promote information and resources that are *relevant to your own community's interests*, both for those already in the community and those yet to join. You may want to promote external resources, or Meta guidance for newcomers, for instance. This initiative has an added goal of providing your community with *an opportunity to showcase exemplary questions from your main site, as well as frequently-linked-to guides from your Meta site*. While the latter makes sense to be shown solely on this site, the former can be shown all across the network. These should avoid hot button topics, and instead focus more on evergreen questions that show what your community’s all about. ### Why do we reset the ads? Some services will maintain usefulness over the years, while other things will wane to allow for new faces to show up. Resetting the ads every year helps accommodate this, and allows old ads that have served their purpose to be cycled out for fresher ads for newer things. This helps keep the material in the ads relevant to not just the subject matter of the community, but to the current status of the community. Historically, we've reset the ads every year — since this is the first run of a new format, we'll run the ads collected in this post through the end of 2021 and reassess the rotation cycle then. The community ads have no restrictions against reposting an ad from a previous cycle. If a particular service or ad is very valuable to the community and will continue to be so, it is a good idea to repost it. It may be helpful to give it a new face in the process, so as to prevent the imagery of the ad from getting stale after a previous exposure. ### Are there restrictions to the ads I can post? All proposed ads need to abide by [our Code of Conduct](/conduct). [Our ad creative guidelines](https://stackoverflow.com/advertising/guidelines) also generally apply (note that the first 2 bullet points on the “Tracking” section do not apply, and a lot of the guidelines surrounding claims, comparisons, proof, etc., while still applicable, may not be particularly relevant). Finally, ads can not be promoting products nor soliciting programmer time or resources for: knowledge sharing or collaboration tools for technologists, or for sites where ad buyers are primarily targeting technologists. ### How does it work? The answers you post to this question *must* conform to the following rules, or they will be ignored: 1. **Each answer must relate to a single ad submission.** Please do not post multiple ad submissions in the same answer. 2. All answers must be in one of the below formats: 1. If you have an image for the ad you want to display on this site (must be the case for ads to external sources): ``` [![Image name. Example: "community_ad_name_300x250"][1]][2] [1]: https://image-url [2]: https://clickthrough-url ``` 2. If you want to create an ad for a question from your main or meta site, to be advertised on this or other sites in the network (staff will generate a frame for the ad with this site's theme, for brand consistency): ``` Question title Question URL Ad size (right sidebar or banner ads) Site(s) to be displayed in. Can be: - "self" for ads to be displayed on this site - "all" for ads to be displayed all over the network - a specific subset of sites ``` 3. Please **do not add anything else to the body of the post**. If you want to discuss something, do it in the comments. ### Image requirements * The image that you create must be 300 x 250 pixels for right sidebar ads or 728 x 90 pixels for banner ads. Images can be double that if high DPI. * Must be hosted through our standard image uploader (imgur) * Must be GIF, PNG, or JPG * No animated GIFs * Absolute limit on file size of 150 KB * If the background of the image is white or partially white, there must be a 1px border (2px if high DPI) surrounding it. ### Selection process **This post will remain open for ad submissions and voting until August 2nd**. At that point, the question will be closed/locked, and no more ad submissions will be accepted. For ad submissions to be considered for selection by the Community Management Team, they must have **a minimum score of 6 at the time the post was closed/locked for submissions.** Given this is the first run with this new format, we may adjust the score threshold to be a bit lower if we see ads struggling to get to it (especially if the ads are not getting downvotes) by the time submissions and voting are closed. ### Reporting statistics Once this cycle is over, at the end of 2021, the Community Management Team will provide you with reporting statistics, as described in the "reporting" section of [this post](https://meta.stackexchange.com/q/364556/208518). --- Feel free to use the question's comment section to ask for any clarifications.
2021/06/17
[ "https://stats.meta.stackexchange.com/questions/6160", "https://stats.meta.stackexchange.com", "https://stats.meta.stackexchange.com/users/72321/" ]
What should I do when my neural network doesn't learn? [What should I do when my neural network doesn't learn?](https://stats.stackexchange.com/questions/352036) Ad size: right sidebar Site(s) to be displayed in: all
Can simple linear regression be done without using plots and linear algebra? [Can simple linear regression be done without using plots and linear algebra?](https://stats.stackexchange.com/questions/204930) Ad size: right sidebar Site(s) to be displayed in: all
6,160
**September update:** Community Ads are now live network-wide. All ads with a score of 6 or higher, or with a score of 4 or higher *and* no downvotes will be displayed (except for any that have a note from the CM Team explaining why it wasn't selected). Go to [the main post on MSE](https://meta.stackexchange.com/q/364556/208518) for a list of the ads that are being displayed. And stay tuned for 2022's edition for the next opportunity to submit more ad proposals! --- **AUGUST NOTE:** This post has now been locked and new submissions are not being accepted. Ad submissions are now undergoing review by the Community Team, and this question will be updated once the ads are live. --- We're almost halfway through 2021, and [in case you missed it](https://meta.stackexchange.com/q/364556/208518), Community Promotion Ads are gonna be a bit different this time! **TL;DR: submit and vote for ad proposals before August 2nd!** ### What are Community Ads? Community Ads are community-vetted advertisements that will show up on the main site, or on other sites in the network. They can show up in the right sidebar, or in banners in question pages. The purpose of this question is the vetting process. Images of the advertisements are provided, and community voting will enable the advertisements to be considered by [the Community Management Team](https://meta.stackexchange.com/a/99341/208518) to be displayed. ### Why do we have Community Ads? This is a method for the community to control what gets promoted to visitors on the site. The goal of this initiative is for future visitors to find out about *the stuff your community deems important*. This also serves as a way to promote information and resources that are *relevant to your own community's interests*, both for those already in the community and those yet to join. You may want to promote external resources, or Meta guidance for newcomers, for instance. This initiative has an added goal of providing your community with *an opportunity to showcase exemplary questions from your main site, as well as frequently-linked-to guides from your Meta site*. While the latter makes sense to be shown solely on this site, the former can be shown all across the network. These should avoid hot button topics, and instead focus more on evergreen questions that show what your community’s all about. ### Why do we reset the ads? Some services will maintain usefulness over the years, while other things will wane to allow for new faces to show up. Resetting the ads every year helps accommodate this, and allows old ads that have served their purpose to be cycled out for fresher ads for newer things. This helps keep the material in the ads relevant to not just the subject matter of the community, but to the current status of the community. Historically, we've reset the ads every year — since this is the first run of a new format, we'll run the ads collected in this post through the end of 2021 and reassess the rotation cycle then. The community ads have no restrictions against reposting an ad from a previous cycle. If a particular service or ad is very valuable to the community and will continue to be so, it is a good idea to repost it. It may be helpful to give it a new face in the process, so as to prevent the imagery of the ad from getting stale after a previous exposure. ### Are there restrictions to the ads I can post? All proposed ads need to abide by [our Code of Conduct](/conduct). [Our ad creative guidelines](https://stackoverflow.com/advertising/guidelines) also generally apply (note that the first 2 bullet points on the “Tracking” section do not apply, and a lot of the guidelines surrounding claims, comparisons, proof, etc., while still applicable, may not be particularly relevant). Finally, ads can not be promoting products nor soliciting programmer time or resources for: knowledge sharing or collaboration tools for technologists, or for sites where ad buyers are primarily targeting technologists. ### How does it work? The answers you post to this question *must* conform to the following rules, or they will be ignored: 1. **Each answer must relate to a single ad submission.** Please do not post multiple ad submissions in the same answer. 2. All answers must be in one of the below formats: 1. If you have an image for the ad you want to display on this site (must be the case for ads to external sources): ``` [![Image name. Example: "community_ad_name_300x250"][1]][2] [1]: https://image-url [2]: https://clickthrough-url ``` 2. If you want to create an ad for a question from your main or meta site, to be advertised on this or other sites in the network (staff will generate a frame for the ad with this site's theme, for brand consistency): ``` Question title Question URL Ad size (right sidebar or banner ads) Site(s) to be displayed in. Can be: - "self" for ads to be displayed on this site - "all" for ads to be displayed all over the network - a specific subset of sites ``` 3. Please **do not add anything else to the body of the post**. If you want to discuss something, do it in the comments. ### Image requirements * The image that you create must be 300 x 250 pixels for right sidebar ads or 728 x 90 pixels for banner ads. Images can be double that if high DPI. * Must be hosted through our standard image uploader (imgur) * Must be GIF, PNG, or JPG * No animated GIFs * Absolute limit on file size of 150 KB * If the background of the image is white or partially white, there must be a 1px border (2px if high DPI) surrounding it. ### Selection process **This post will remain open for ad submissions and voting until August 2nd**. At that point, the question will be closed/locked, and no more ad submissions will be accepted. For ad submissions to be considered for selection by the Community Management Team, they must have **a minimum score of 6 at the time the post was closed/locked for submissions.** Given this is the first run with this new format, we may adjust the score threshold to be a bit lower if we see ads struggling to get to it (especially if the ads are not getting downvotes) by the time submissions and voting are closed. ### Reporting statistics Once this cycle is over, at the end of 2021, the Community Management Team will provide you with reporting statistics, as described in the "reporting" section of [this post](https://meta.stackexchange.com/q/364556/208518). --- Feel free to use the question's comment section to ask for any clarifications.
2021/06/17
[ "https://stats.meta.stackexchange.com/questions/6160", "https://stats.meta.stackexchange.com", "https://stats.meta.stackexchange.com/users/72321/" ]
[![Need Data? Open Data Stack Exchange](https://i.stack.imgur.com/wqiQI.png)](http://opendata.stackexchange.com/)
Can simple linear regression be done without using plots and linear algebra? [Can simple linear regression be done without using plots and linear algebra?](https://stats.stackexchange.com/questions/204930) Ad size: right sidebar Site(s) to be displayed in: all
6,160
**September update:** Community Ads are now live network-wide. All ads with a score of 6 or higher, or with a score of 4 or higher *and* no downvotes will be displayed (except for any that have a note from the CM Team explaining why it wasn't selected). Go to [the main post on MSE](https://meta.stackexchange.com/q/364556/208518) for a list of the ads that are being displayed. And stay tuned for 2022's edition for the next opportunity to submit more ad proposals! --- **AUGUST NOTE:** This post has now been locked and new submissions are not being accepted. Ad submissions are now undergoing review by the Community Team, and this question will be updated once the ads are live. --- We're almost halfway through 2021, and [in case you missed it](https://meta.stackexchange.com/q/364556/208518), Community Promotion Ads are gonna be a bit different this time! **TL;DR: submit and vote for ad proposals before August 2nd!** ### What are Community Ads? Community Ads are community-vetted advertisements that will show up on the main site, or on other sites in the network. They can show up in the right sidebar, or in banners in question pages. The purpose of this question is the vetting process. Images of the advertisements are provided, and community voting will enable the advertisements to be considered by [the Community Management Team](https://meta.stackexchange.com/a/99341/208518) to be displayed. ### Why do we have Community Ads? This is a method for the community to control what gets promoted to visitors on the site. The goal of this initiative is for future visitors to find out about *the stuff your community deems important*. This also serves as a way to promote information and resources that are *relevant to your own community's interests*, both for those already in the community and those yet to join. You may want to promote external resources, or Meta guidance for newcomers, for instance. This initiative has an added goal of providing your community with *an opportunity to showcase exemplary questions from your main site, as well as frequently-linked-to guides from your Meta site*. While the latter makes sense to be shown solely on this site, the former can be shown all across the network. These should avoid hot button topics, and instead focus more on evergreen questions that show what your community’s all about. ### Why do we reset the ads? Some services will maintain usefulness over the years, while other things will wane to allow for new faces to show up. Resetting the ads every year helps accommodate this, and allows old ads that have served their purpose to be cycled out for fresher ads for newer things. This helps keep the material in the ads relevant to not just the subject matter of the community, but to the current status of the community. Historically, we've reset the ads every year — since this is the first run of a new format, we'll run the ads collected in this post through the end of 2021 and reassess the rotation cycle then. The community ads have no restrictions against reposting an ad from a previous cycle. If a particular service or ad is very valuable to the community and will continue to be so, it is a good idea to repost it. It may be helpful to give it a new face in the process, so as to prevent the imagery of the ad from getting stale after a previous exposure. ### Are there restrictions to the ads I can post? All proposed ads need to abide by [our Code of Conduct](/conduct). [Our ad creative guidelines](https://stackoverflow.com/advertising/guidelines) also generally apply (note that the first 2 bullet points on the “Tracking” section do not apply, and a lot of the guidelines surrounding claims, comparisons, proof, etc., while still applicable, may not be particularly relevant). Finally, ads can not be promoting products nor soliciting programmer time or resources for: knowledge sharing or collaboration tools for technologists, or for sites where ad buyers are primarily targeting technologists. ### How does it work? The answers you post to this question *must* conform to the following rules, or they will be ignored: 1. **Each answer must relate to a single ad submission.** Please do not post multiple ad submissions in the same answer. 2. All answers must be in one of the below formats: 1. If you have an image for the ad you want to display on this site (must be the case for ads to external sources): ``` [![Image name. Example: "community_ad_name_300x250"][1]][2] [1]: https://image-url [2]: https://clickthrough-url ``` 2. If you want to create an ad for a question from your main or meta site, to be advertised on this or other sites in the network (staff will generate a frame for the ad with this site's theme, for brand consistency): ``` Question title Question URL Ad size (right sidebar or banner ads) Site(s) to be displayed in. Can be: - "self" for ads to be displayed on this site - "all" for ads to be displayed all over the network - a specific subset of sites ``` 3. Please **do not add anything else to the body of the post**. If you want to discuss something, do it in the comments. ### Image requirements * The image that you create must be 300 x 250 pixels for right sidebar ads or 728 x 90 pixels for banner ads. Images can be double that if high DPI. * Must be hosted through our standard image uploader (imgur) * Must be GIF, PNG, or JPG * No animated GIFs * Absolute limit on file size of 150 KB * If the background of the image is white or partially white, there must be a 1px border (2px if high DPI) surrounding it. ### Selection process **This post will remain open for ad submissions and voting until August 2nd**. At that point, the question will be closed/locked, and no more ad submissions will be accepted. For ad submissions to be considered for selection by the Community Management Team, they must have **a minimum score of 6 at the time the post was closed/locked for submissions.** Given this is the first run with this new format, we may adjust the score threshold to be a bit lower if we see ads struggling to get to it (especially if the ads are not getting downvotes) by the time submissions and voting are closed. ### Reporting statistics Once this cycle is over, at the end of 2021, the Community Management Team will provide you with reporting statistics, as described in the "reporting" section of [this post](https://meta.stackexchange.com/q/364556/208518). --- Feel free to use the question's comment section to ask for any clarifications.
2021/06/17
[ "https://stats.meta.stackexchange.com/questions/6160", "https://stats.meta.stackexchange.com", "https://stats.meta.stackexchange.com/users/72321/" ]
Why is accuracy not the best measure for assessing classification models? [Why is accuracy not the best measure for assessing classification models?](https://stats.stackexchange.com/questions/312780/) Ad size: right sidebar Site(s) to be displayed in: all
Principled way of collapsing categorical variables with many levels? [Principled way of collapsing categorical variables with many levels?](https://stats.stackexchange.com/questions/146907) Ad size: right sidebar Site(s) to be displayed in: all
6,160
**September update:** Community Ads are now live network-wide. All ads with a score of 6 or higher, or with a score of 4 or higher *and* no downvotes will be displayed (except for any that have a note from the CM Team explaining why it wasn't selected). Go to [the main post on MSE](https://meta.stackexchange.com/q/364556/208518) for a list of the ads that are being displayed. And stay tuned for 2022's edition for the next opportunity to submit more ad proposals! --- **AUGUST NOTE:** This post has now been locked and new submissions are not being accepted. Ad submissions are now undergoing review by the Community Team, and this question will be updated once the ads are live. --- We're almost halfway through 2021, and [in case you missed it](https://meta.stackexchange.com/q/364556/208518), Community Promotion Ads are gonna be a bit different this time! **TL;DR: submit and vote for ad proposals before August 2nd!** ### What are Community Ads? Community Ads are community-vetted advertisements that will show up on the main site, or on other sites in the network. They can show up in the right sidebar, or in banners in question pages. The purpose of this question is the vetting process. Images of the advertisements are provided, and community voting will enable the advertisements to be considered by [the Community Management Team](https://meta.stackexchange.com/a/99341/208518) to be displayed. ### Why do we have Community Ads? This is a method for the community to control what gets promoted to visitors on the site. The goal of this initiative is for future visitors to find out about *the stuff your community deems important*. This also serves as a way to promote information and resources that are *relevant to your own community's interests*, both for those already in the community and those yet to join. You may want to promote external resources, or Meta guidance for newcomers, for instance. This initiative has an added goal of providing your community with *an opportunity to showcase exemplary questions from your main site, as well as frequently-linked-to guides from your Meta site*. While the latter makes sense to be shown solely on this site, the former can be shown all across the network. These should avoid hot button topics, and instead focus more on evergreen questions that show what your community’s all about. ### Why do we reset the ads? Some services will maintain usefulness over the years, while other things will wane to allow for new faces to show up. Resetting the ads every year helps accommodate this, and allows old ads that have served their purpose to be cycled out for fresher ads for newer things. This helps keep the material in the ads relevant to not just the subject matter of the community, but to the current status of the community. Historically, we've reset the ads every year — since this is the first run of a new format, we'll run the ads collected in this post through the end of 2021 and reassess the rotation cycle then. The community ads have no restrictions against reposting an ad from a previous cycle. If a particular service or ad is very valuable to the community and will continue to be so, it is a good idea to repost it. It may be helpful to give it a new face in the process, so as to prevent the imagery of the ad from getting stale after a previous exposure. ### Are there restrictions to the ads I can post? All proposed ads need to abide by [our Code of Conduct](/conduct). [Our ad creative guidelines](https://stackoverflow.com/advertising/guidelines) also generally apply (note that the first 2 bullet points on the “Tracking” section do not apply, and a lot of the guidelines surrounding claims, comparisons, proof, etc., while still applicable, may not be particularly relevant). Finally, ads can not be promoting products nor soliciting programmer time or resources for: knowledge sharing or collaboration tools for technologists, or for sites where ad buyers are primarily targeting technologists. ### How does it work? The answers you post to this question *must* conform to the following rules, or they will be ignored: 1. **Each answer must relate to a single ad submission.** Please do not post multiple ad submissions in the same answer. 2. All answers must be in one of the below formats: 1. If you have an image for the ad you want to display on this site (must be the case for ads to external sources): ``` [![Image name. Example: "community_ad_name_300x250"][1]][2] [1]: https://image-url [2]: https://clickthrough-url ``` 2. If you want to create an ad for a question from your main or meta site, to be advertised on this or other sites in the network (staff will generate a frame for the ad with this site's theme, for brand consistency): ``` Question title Question URL Ad size (right sidebar or banner ads) Site(s) to be displayed in. Can be: - "self" for ads to be displayed on this site - "all" for ads to be displayed all over the network - a specific subset of sites ``` 3. Please **do not add anything else to the body of the post**. If you want to discuss something, do it in the comments. ### Image requirements * The image that you create must be 300 x 250 pixels for right sidebar ads or 728 x 90 pixels for banner ads. Images can be double that if high DPI. * Must be hosted through our standard image uploader (imgur) * Must be GIF, PNG, or JPG * No animated GIFs * Absolute limit on file size of 150 KB * If the background of the image is white or partially white, there must be a 1px border (2px if high DPI) surrounding it. ### Selection process **This post will remain open for ad submissions and voting until August 2nd**. At that point, the question will be closed/locked, and no more ad submissions will be accepted. For ad submissions to be considered for selection by the Community Management Team, they must have **a minimum score of 6 at the time the post was closed/locked for submissions.** Given this is the first run with this new format, we may adjust the score threshold to be a bit lower if we see ads struggling to get to it (especially if the ads are not getting downvotes) by the time submissions and voting are closed. ### Reporting statistics Once this cycle is over, at the end of 2021, the Community Management Team will provide you with reporting statistics, as described in the "reporting" section of [this post](https://meta.stackexchange.com/q/364556/208518). --- Feel free to use the question's comment section to ask for any clarifications.
2021/06/17
[ "https://stats.meta.stackexchange.com/questions/6160", "https://stats.meta.stackexchange.com", "https://stats.meta.stackexchange.com/users/72321/" ]
Why do we only see L1 and L2 regularization but not other norms? [Why do we only see $L\_1$ and $L\_2$ regularization but not other norms?](https://stats.stackexchange.com/questions/269298) Ad size: right sidebar Site(s) to be displayed in: all
Algorithms for automatic model selection [Algorithms for automatic model selection](https://stats.stackexchange.com/questions/20836) Ad size: right sidebar Site(s) to be displayed in: all
11,772,080
I am using Java 7, `NIO` package rather than `IO`, but JFileChooser uses `File` class to `getSelectedFile()`, but in NIO there is only `Path` class. How can I use `NIO` classes with `JFileChooser` ?
2012/08/02
[ "https://Stackoverflow.com/questions/11772080", "https://Stackoverflow.com", "https://Stackoverflow.com/users/276660/" ]
``` Path path = selectedFile.toPath(); ```
try this : ``` File file = Paths.get(URI).toFile(); ```
11,772,080
I am using Java 7, `NIO` package rather than `IO`, but JFileChooser uses `File` class to `getSelectedFile()`, but in NIO there is only `Path` class. How can I use `NIO` classes with `JFileChooser` ?
2012/08/02
[ "https://Stackoverflow.com/questions/11772080", "https://Stackoverflow.com", "https://Stackoverflow.com/users/276660/" ]
``` yourPath = yourJFileChooser.getSelectedFile().toPath(); ```
try this : ``` File file = Paths.get(URI).toFile(); ```
11,772,080
I am using Java 7, `NIO` package rather than `IO`, but JFileChooser uses `File` class to `getSelectedFile()`, but in NIO there is only `Path` class. How can I use `NIO` classes with `JFileChooser` ?
2012/08/02
[ "https://Stackoverflow.com/questions/11772080", "https://Stackoverflow.com", "https://Stackoverflow.com/users/276660/" ]
``` Path path = selectedFile.toPath(); ```
``` yourPath = yourJFileChooser.getSelectedFile().toPath(); ```
74,577,761
I have a df with a column that some values are having `...` and some `..` and some are without dots. ``` Type range Mike 10..13 Ni 3..4 NANA 2...3 Gi 2 ``` desired output should look like this ``` Type range Mike 10 Mike 11 Mike 12 MIke 13 Ni 3 Ni 4 NANA 2 NANA 3 Gi 2 ``` So dots represnt the range of between to number ( inclusive the end number). How am I suppsoed to do it in pandas?
2022/11/25
[ "https://Stackoverflow.com/questions/74577761", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17561414/" ]
Parse str as list first and then [explode](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.explode.html): ``` import re def str_to_list(s): if not s: return [] nums = re.split('\.{2,3}', s) if len(nums) == 1: return nums return list(range(int(nums[0]), int(nums[1]) + 1)) df['range'] = df['range'].astype(str).map(str_to_list) df.explode('range') Type range 0 Mike 10 0 Mike 11 0 Mike 12 0 Mike 13 1 Ni 3 1 Ni 4 2 NANA 2 2 NANA 3 3 Gi 2 ```
An approach using [`numpy.arange`](https://numpy.org/doc/stable/reference/generated/numpy.arange.html) with [`pandas.DataFrame.explode`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.explode.html) : ``` out = ( df .assign(range= df["range"] .str.replace("\.+", "-", regex=True) .str.split("-") .apply(lambda x: np.arange(list(map(int, x))[0], list(map(int, x))[-1]+1, 1) if len(x)>1 else x)) .explode("range", ignore_index=True) ) ``` #### # Output : ``` print(out) Type range 0 Mike 10 1 Mike 11 2 Mike 12 3 Mike 13 4 Ni 3 5 Ni 4 6 NANA 2 7 NANA 3 8 Gi 2 ```
60,124,368
In get Number method. when I use Random() method android studio give me error message Cannot create an instance of an abstract class please tell me how to solve this error. ``` class MainActivityDataGenerator : ViewModel() { private lateinit var myRandomNumber : String fun getNumber(): String{ Log.i(Tag, "Get Number") if (!::myRandomNumber.isInitialized){ this.createNumber() } return myRandomNumber } fun createNumber(){ Log.i(Tag, "create new Number") val random = Random() myRandomNumber = " Number "+ (random.nextInt(10-1)+1) } companion object{ private val Tag : String = MainActivityDataGenerator::class.java.simpleName } } ```
2020/02/08
[ "https://Stackoverflow.com/questions/60124368", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10852037/" ]
I guess it's the difference in import statement. If you want to use the Kotlin Random class then use like this. with below import. ``` import kotlin.random.Random //..... val random = Random(12) ``` if you want to use the Java one which you seems to then use it like this. ``` import java.util.* //..... val random = Random() ``` just remove the kotlin one or add the seed value in constructor it will work.
You need to provide a seed number to Random class to create an object. Here I modified your code and explained everything inside code with comments. ``` import android.util.Log import androidx.lifecycle.ViewModel import kotlin.random.Random class MainActivityDataGenerator : ViewModel() { private lateinit var myRandomNumber : String fun getNumber(): String{ Log.i(Tag, "Get Number") if (!::myRandomNumber.isInitialized){ this.createNumber() } return myRandomNumber } fun createNumber(){ Log.i(Tag, "create new Number") /* Initialize it with a seed number. Seed is used to generate a random number sequence. Two different Object of Random class with same seed number will generate same sequences of random number. If you want different sequences use different seed numbers to different objects*/ val random = Random(10) myRandomNumber = " Number "+ (random.nextInt(10-1)+1) } companion object{ private val Tag : String = MainActivityDataGenerator::class.java.simpleName } } ```
44,155,922
I have a map drawn in CorelDRAW that shows the location of some company assets. Each one in shown as a square on the map. My aim is to create an interactive version of the map, where the user can click on a square and be shown more information about the asset. CorelDRAW allows me to specify a name for each shape. Then, if the diagram is exported as an SVG, the shape names are used for the id attributes. This gives me a map in SVG format; let's say it looks like this: ```html <svg width="100" height="100"> <rect id="firstAsset" x="25" y="50" width="20" height="20" /> <rect id="secondAsset" x="50" y="15" width="20" height="20" /> </svg> ``` I want to be able to click on each rectangle and have information displayed about it. A popup would do, such as [this example at w3cschools](https://www.w3schools.com/howto/howto_js_popup.asp), or a modal box if there's more information to display. So, I've started by embedding a test svg in an html document. This doesn't mean it will end up on a web server; the file may just end up saved on a SharePoint. Ideally it would end up a single file that can be distributed by email if need be. Here is what I have so far, using modal boxes: [link to js fiddle](https://jsfiddle.net/William_Foulkes/10cux7vy/). The problem is, the full SVG is going to have dozens more clickable shapes, and if the map is updated in CorelDRAW, I will have to add the onclick() and class attributes to each shape all over again. I need to be able to take information about each asset in some standard format, and then have it automatically added to each asset in the SVG. I originally envisioned writing a script that would take the SVG file and a file with the information to display. It would search the SVG for id attributes, check for corresponding information to display, and if so make the element clickable to display that information. This is where I'm stuck. Do I need to write a separate program just to maintain this map? Or could this be done using javascript in the document itself? To recap, I have: * An automatically generated SVG with id attributes against each asset * I will have some information about each asset, which I can put in html format and I want to be able to click on an asset on the map and show the information about it. P.S. I'm new to html and javascript.
2017/05/24
[ "https://Stackoverflow.com/questions/44155922", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7962446/" ]
Be sure that your css rule for background is directly inside html file and not inside your css file which have to load too. ``` <app-root> <div style="background-image: url('')"></div> </app-root> ``` And if your image isn't too big, you can convert it to base64 on website like [this](https://www.base64-image.de/) and add it directly like this: ``` background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhE...); ``` or ``` <img width="50" height="50" src="data:image/png;base64,iVBORw0KGgoAAAANSUhE..."/> ```
I would recommend using ngSwitch [here](https://angular.io/docs/ts/latest/api/common/index/NgSwitch-directive.html) ``` <div [ngSwitch]='status'> <div *ngSwitchCase="'loading'"> <!-- all of the inline styles and massive SVG markup for my spinner --> </div> <div *ngSwitchCase="'active'"> </div> </div> ```
44,155,922
I have a map drawn in CorelDRAW that shows the location of some company assets. Each one in shown as a square on the map. My aim is to create an interactive version of the map, where the user can click on a square and be shown more information about the asset. CorelDRAW allows me to specify a name for each shape. Then, if the diagram is exported as an SVG, the shape names are used for the id attributes. This gives me a map in SVG format; let's say it looks like this: ```html <svg width="100" height="100"> <rect id="firstAsset" x="25" y="50" width="20" height="20" /> <rect id="secondAsset" x="50" y="15" width="20" height="20" /> </svg> ``` I want to be able to click on each rectangle and have information displayed about it. A popup would do, such as [this example at w3cschools](https://www.w3schools.com/howto/howto_js_popup.asp), or a modal box if there's more information to display. So, I've started by embedding a test svg in an html document. This doesn't mean it will end up on a web server; the file may just end up saved on a SharePoint. Ideally it would end up a single file that can be distributed by email if need be. Here is what I have so far, using modal boxes: [link to js fiddle](https://jsfiddle.net/William_Foulkes/10cux7vy/). The problem is, the full SVG is going to have dozens more clickable shapes, and if the map is updated in CorelDRAW, I will have to add the onclick() and class attributes to each shape all over again. I need to be able to take information about each asset in some standard format, and then have it automatically added to each asset in the SVG. I originally envisioned writing a script that would take the SVG file and a file with the information to display. It would search the SVG for id attributes, check for corresponding information to display, and if so make the element clickable to display that information. This is where I'm stuck. Do I need to write a separate program just to maintain this map? Or could this be done using javascript in the document itself? To recap, I have: * An automatically generated SVG with id attributes against each asset * I will have some information about each asset, which I can put in html format and I want to be able to click on an asset on the map and show the information about it. P.S. I'm new to html and javascript.
2017/05/24
[ "https://Stackoverflow.com/questions/44155922", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7962446/" ]
Be sure that your css rule for background is directly inside html file and not inside your css file which have to load too. ``` <app-root> <div style="background-image: url('')"></div> </app-root> ``` And if your image isn't too big, you can convert it to base64 on website like [this](https://www.base64-image.de/) and add it directly like this: ``` background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhE...); ``` or ``` <img width="50" height="50" src="data:image/png;base64,iVBORw0KGgoAAAANSUhE..."/> ```
The part where the loading screen is taken care in my repo ``` constructor(private router: Router,private _loadingSvc: LoadingAnimateService) { router.events.subscribe((event: RouterEvent) => { this.navigationInterceptor(event); }); } // Shows and hides the loading spinner during RouterEvent changes navigationInterceptor(event: RouterEvent): void { if (event instanceof NavigationStart) { this.loading = true; this._loadingSvc.setValue(true);// temporary solution to loading } if (event instanceof NavigationEnd) { this.loading = false; this._loadingSvc.setValue(false);//temporary solution to loading } // Set loading state to false in both of the below events to hide the spinner in case a request fails if (event instanceof NavigationCancel) { this.loading = false; } if (event instanceof NavigationError) { this.loading = false; } } ``` Html Template ``` <div *ngIf="loading"> <!-- show something fancy here, here with Angular 2 Material's loading bar or circle --> <div class = "parent"> <div class="spinner"> <div class="rect1"></div> <div class="rect2"></div> <div class="rect3"></div> <div class="rect4"></div> <div class="rect5"></div> </div> </div> </div> ```
32,680,732
I tried send it by fileTransfer method: ``` let modelURL = NSBundle.mainBundle().URLForResource("my_app", withExtension: "momd")! WCSession.defaultSession().transferFile(modelURL, metadata:nil) ``` but I get error: > > Optional(Error Domain=WCErrorDomain Code=7008 "Invalid parameter passed to WatchConnectivity API." UserInfo={NSLocalizedDescription=Invalid parameter passed to WatchConnectivity API., NSLocalizedRecoverySuggestion=Only pass parameters of correct type.}) > > > Do you have any idea how to sync CoreData between iPhone and WatchOS2?
2015/09/20
[ "https://Stackoverflow.com/questions/32680732", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1753184/" ]
You are trying to send the entire “momd” directory. The transfer file API of WatchConnectivity does not seem to support transferring directories, and is therefore returning an error in -session:didFinishFileTransfer:error: To resolve this problem you have a couple of options: 1. Serialize the momd directory into a single file and then deserialize on the receiving side (using something like zip, etc) 2. Create a transfer format for transferring specific pieces of information from the database. * The project would pull a specific piece out of the database, and send it across. The receiving side would then add that piece of content to its own database. You would probably use the transferUserInfo API with this solution. Solution number 2 is probably the best one as it allows you to send only the changes that have been made instead of the entire database each time a change is made, but will be more work.
This is probably what you are looking for: `Watch Connectivity Framework` More Here: <https://developer.apple.com/library/prerelease/ios/documentation/WatchConnectivity/Reference/WatchConnectivity_framework/index.html> And here: <https://forums.developer.apple.com/thread/3927> Quoting from the **forums.developer.apple.com** > > Watch apps that shared data with their iOS apps using a shared group container must be redesigned to handle data differently. In watchOS 2, each process must manage its own copy of any shared data in the local container directory. For data that is actually shared and updated by both apps, this requires using the Watch Connectivity framework to move that data between them. > > >
6,590,117
``` Array ( [n] => Unover [i] => 250 ) Array ( [n] => Un [i] => 195 ) Array ( [n] => Iliad [i] => 110 ) ``` They are in the form of $arr['Unover']['i']. I'd like to sort them based on the i smallest to largest, can't figure how to do it without completely wrecking the array and no idea where to start. Need to be able to get it into another array that I can just foreach through in orde
2011/07/05
[ "https://Stackoverflow.com/questions/6590117", "https://Stackoverflow.com", "https://Stackoverflow.com/users/586712/" ]
[`Write-Debug`](http://technet.microsoft.com/en-us/library/dd347714.aspx) is designed for outputting simple messages when debug preferences are set in a particular [way](http://ss64.com/ps/write-debug.html). It takes only a string, not just anything like `Write-Host` does (and magically formats). You will have to format your output yourself into a single string. You could combine `Write-Host` and `Write-Debug` if you have extra info to output before prompting the user: ``` if ($DebugPreference -ne 'SilentlyContinue') { Write-Host 'such-and-such array:' $array } Write-Debug 'such-and-such array dumped' ``` `Write-Host` is used because it will always write to the console host, rather than to the script's output, as `Write-Output` does. If you where redirecting standard output of the script to a file, `Write-Output` would end up in the file, while `Write-Host` would still be seen in the console. You could also try doing something like this if your array is of simply enough types that an automatic call to `ToString()` on them (if they're not strings already) gets you what you want: ``` $array = 'Alice','Bob','Charlie' Write-Debug ([String]::Join("`n", $array)) ```
Write-Debug: ``` Write-Debug [-Message] <string> [<CommonParameters>] ``` It expects a string. It is unable to convert a string array to a string as the error says. The reason why it expects a string is because it `writes debug messages to the console from a script or command.` Note that Write-Output and Write-Host take an object: ``` Write-Output [-InputObject] <PSObject[]> [<CommonParameters>] ``` and ``` Write-Host [[-Object] <Object>] ... ```
6,590,117
``` Array ( [n] => Unover [i] => 250 ) Array ( [n] => Un [i] => 195 ) Array ( [n] => Iliad [i] => 110 ) ``` They are in the form of $arr['Unover']['i']. I'd like to sort them based on the i smallest to largest, can't figure how to do it without completely wrecking the array and no idea where to start. Need to be able to get it into another array that I can just foreach through in orde
2011/07/05
[ "https://Stackoverflow.com/questions/6590117", "https://Stackoverflow.com", "https://Stackoverflow.com/users/586712/" ]
If you want write-debug to handle each one separately: ``` [string[]]$test = @("test1", "test2", "test3") Write-Output $test test1 test2 test3 $DebugPreference = "Inquire" $test | Write-Debug DEBUG: test1 DEBUG: test2 DEBUG: test3 ```
[`Write-Debug`](http://technet.microsoft.com/en-us/library/dd347714.aspx) is designed for outputting simple messages when debug preferences are set in a particular [way](http://ss64.com/ps/write-debug.html). It takes only a string, not just anything like `Write-Host` does (and magically formats). You will have to format your output yourself into a single string. You could combine `Write-Host` and `Write-Debug` if you have extra info to output before prompting the user: ``` if ($DebugPreference -ne 'SilentlyContinue') { Write-Host 'such-and-such array:' $array } Write-Debug 'such-and-such array dumped' ``` `Write-Host` is used because it will always write to the console host, rather than to the script's output, as `Write-Output` does. If you where redirecting standard output of the script to a file, `Write-Output` would end up in the file, while `Write-Host` would still be seen in the console. You could also try doing something like this if your array is of simply enough types that an automatic call to `ToString()` on them (if they're not strings already) gets you what you want: ``` $array = 'Alice','Bob','Charlie' Write-Debug ([String]::Join("`n", $array)) ```
6,590,117
``` Array ( [n] => Unover [i] => 250 ) Array ( [n] => Un [i] => 195 ) Array ( [n] => Iliad [i] => 110 ) ``` They are in the form of $arr['Unover']['i']. I'd like to sort them based on the i smallest to largest, can't figure how to do it without completely wrecking the array and no idea where to start. Need to be able to get it into another array that I can just foreach through in orde
2011/07/05
[ "https://Stackoverflow.com/questions/6590117", "https://Stackoverflow.com", "https://Stackoverflow.com/users/586712/" ]
I kept having the same problem, and none of the solutions I found above or anywhere else would work in the general case. For example, the first answer above works only because the array is an array of strings. If it's an array of anything else, that solution breaks, and Write-Debug will output the object type, and not its value as one would expect. Finally I found a general solution: The key point is to first convert the input object to a string using the Out-String command. Once everything is a string, the above solution works. Using "Out-String -stream" improves the output alignment. Example: ``` PS C:\> gwmi win32_bios SMBIOSBIOSVersion : 786F3 v01.34 Manufacturer : Hewlett-Packard Name : Default System BIOS SerialNumber : CZC8196Q8S Version : HPQOEM - 20120709 PS C:\> gwmi win32_bios | ft -auto SMBIOSBIOSVersion Manufacturer Name SerialNumber Version ----------------- ------------ ---- ------------ ------- 786F3 v01.34 Hewlett-Packard Default System BIOS CZC8196Q8S HPQOEM - ... PS C:\> $DebugPreference = "Continue" PS C:\> gwmi win32_bios | ft -auto | Write-Debug DEBUG: Microsoft.PowerShell.Commands.Internal.Format.FormatStartData DEBUG: Microsoft.PowerShell.Commands.Internal.Format.GroupStartData DEBUG: Microsoft.PowerShell.Commands.Internal.Format.FormatEntryData DEBUG: Microsoft.PowerShell.Commands.Internal.Format.GroupEndData PS C:\> gwmi win32_bios | ft -auto | Out-String | Write-Debug DEBUG: SMBIOSBIOSVersion Manufacturer Name SerialNumber Version ----------------- ------------ ---- ------------ ------- 786F3 v01.34 Hewlett-Packard Default System BIOS CZC8196Q8S HPQOEM - ... PS C:\> gwmi win32_bios | ft | Out-String -stream | Write-Debug DEBUG: DEBUG: SMBIOSBIOSVersi Manufacturer Name SerialNumber Version DEBUG: on DEBUG: --------------- ------------ ---- ------------ ------- DEBUG: 786F3 v01.34 Hewlett-Packard Default Syst... CZC8196Q8S HPQOEM - 201... DEBUG: DEBUG:PS C:\> ```
[`Write-Debug`](http://technet.microsoft.com/en-us/library/dd347714.aspx) is designed for outputting simple messages when debug preferences are set in a particular [way](http://ss64.com/ps/write-debug.html). It takes only a string, not just anything like `Write-Host` does (and magically formats). You will have to format your output yourself into a single string. You could combine `Write-Host` and `Write-Debug` if you have extra info to output before prompting the user: ``` if ($DebugPreference -ne 'SilentlyContinue') { Write-Host 'such-and-such array:' $array } Write-Debug 'such-and-such array dumped' ``` `Write-Host` is used because it will always write to the console host, rather than to the script's output, as `Write-Output` does. If you where redirecting standard output of the script to a file, `Write-Output` would end up in the file, while `Write-Host` would still be seen in the console. You could also try doing something like this if your array is of simply enough types that an automatic call to `ToString()` on them (if they're not strings already) gets you what you want: ``` $array = 'Alice','Bob','Charlie' Write-Debug ([String]::Join("`n", $array)) ```
6,590,117
``` Array ( [n] => Unover [i] => 250 ) Array ( [n] => Un [i] => 195 ) Array ( [n] => Iliad [i] => 110 ) ``` They are in the form of $arr['Unover']['i']. I'd like to sort them based on the i smallest to largest, can't figure how to do it without completely wrecking the array and no idea where to start. Need to be able to get it into another array that I can just foreach through in orde
2011/07/05
[ "https://Stackoverflow.com/questions/6590117", "https://Stackoverflow.com", "https://Stackoverflow.com/users/586712/" ]
If you want write-debug to handle each one separately: ``` [string[]]$test = @("test1", "test2", "test3") Write-Output $test test1 test2 test3 $DebugPreference = "Inquire" $test | Write-Debug DEBUG: test1 DEBUG: test2 DEBUG: test3 ```
Write-Debug: ``` Write-Debug [-Message] <string> [<CommonParameters>] ``` It expects a string. It is unable to convert a string array to a string as the error says. The reason why it expects a string is because it `writes debug messages to the console from a script or command.` Note that Write-Output and Write-Host take an object: ``` Write-Output [-InputObject] <PSObject[]> [<CommonParameters>] ``` and ``` Write-Host [[-Object] <Object>] ... ```
6,590,117
``` Array ( [n] => Unover [i] => 250 ) Array ( [n] => Un [i] => 195 ) Array ( [n] => Iliad [i] => 110 ) ``` They are in the form of $arr['Unover']['i']. I'd like to sort them based on the i smallest to largest, can't figure how to do it without completely wrecking the array and no idea where to start. Need to be able to get it into another array that I can just foreach through in orde
2011/07/05
[ "https://Stackoverflow.com/questions/6590117", "https://Stackoverflow.com", "https://Stackoverflow.com/users/586712/" ]
I kept having the same problem, and none of the solutions I found above or anywhere else would work in the general case. For example, the first answer above works only because the array is an array of strings. If it's an array of anything else, that solution breaks, and Write-Debug will output the object type, and not its value as one would expect. Finally I found a general solution: The key point is to first convert the input object to a string using the Out-String command. Once everything is a string, the above solution works. Using "Out-String -stream" improves the output alignment. Example: ``` PS C:\> gwmi win32_bios SMBIOSBIOSVersion : 786F3 v01.34 Manufacturer : Hewlett-Packard Name : Default System BIOS SerialNumber : CZC8196Q8S Version : HPQOEM - 20120709 PS C:\> gwmi win32_bios | ft -auto SMBIOSBIOSVersion Manufacturer Name SerialNumber Version ----------------- ------------ ---- ------------ ------- 786F3 v01.34 Hewlett-Packard Default System BIOS CZC8196Q8S HPQOEM - ... PS C:\> $DebugPreference = "Continue" PS C:\> gwmi win32_bios | ft -auto | Write-Debug DEBUG: Microsoft.PowerShell.Commands.Internal.Format.FormatStartData DEBUG: Microsoft.PowerShell.Commands.Internal.Format.GroupStartData DEBUG: Microsoft.PowerShell.Commands.Internal.Format.FormatEntryData DEBUG: Microsoft.PowerShell.Commands.Internal.Format.GroupEndData PS C:\> gwmi win32_bios | ft -auto | Out-String | Write-Debug DEBUG: SMBIOSBIOSVersion Manufacturer Name SerialNumber Version ----------------- ------------ ---- ------------ ------- 786F3 v01.34 Hewlett-Packard Default System BIOS CZC8196Q8S HPQOEM - ... PS C:\> gwmi win32_bios | ft | Out-String -stream | Write-Debug DEBUG: DEBUG: SMBIOSBIOSVersi Manufacturer Name SerialNumber Version DEBUG: on DEBUG: --------------- ------------ ---- ------------ ------- DEBUG: 786F3 v01.34 Hewlett-Packard Default Syst... CZC8196Q8S HPQOEM - 201... DEBUG: DEBUG:PS C:\> ```
Write-Debug: ``` Write-Debug [-Message] <string> [<CommonParameters>] ``` It expects a string. It is unable to convert a string array to a string as the error says. The reason why it expects a string is because it `writes debug messages to the console from a script or command.` Note that Write-Output and Write-Host take an object: ``` Write-Output [-InputObject] <PSObject[]> [<CommonParameters>] ``` and ``` Write-Host [[-Object] <Object>] ... ```
6,590,117
``` Array ( [n] => Unover [i] => 250 ) Array ( [n] => Un [i] => 195 ) Array ( [n] => Iliad [i] => 110 ) ``` They are in the form of $arr['Unover']['i']. I'd like to sort them based on the i smallest to largest, can't figure how to do it without completely wrecking the array and no idea where to start. Need to be able to get it into another array that I can just foreach through in orde
2011/07/05
[ "https://Stackoverflow.com/questions/6590117", "https://Stackoverflow.com", "https://Stackoverflow.com/users/586712/" ]
I kept having the same problem, and none of the solutions I found above or anywhere else would work in the general case. For example, the first answer above works only because the array is an array of strings. If it's an array of anything else, that solution breaks, and Write-Debug will output the object type, and not its value as one would expect. Finally I found a general solution: The key point is to first convert the input object to a string using the Out-String command. Once everything is a string, the above solution works. Using "Out-String -stream" improves the output alignment. Example: ``` PS C:\> gwmi win32_bios SMBIOSBIOSVersion : 786F3 v01.34 Manufacturer : Hewlett-Packard Name : Default System BIOS SerialNumber : CZC8196Q8S Version : HPQOEM - 20120709 PS C:\> gwmi win32_bios | ft -auto SMBIOSBIOSVersion Manufacturer Name SerialNumber Version ----------------- ------------ ---- ------------ ------- 786F3 v01.34 Hewlett-Packard Default System BIOS CZC8196Q8S HPQOEM - ... PS C:\> $DebugPreference = "Continue" PS C:\> gwmi win32_bios | ft -auto | Write-Debug DEBUG: Microsoft.PowerShell.Commands.Internal.Format.FormatStartData DEBUG: Microsoft.PowerShell.Commands.Internal.Format.GroupStartData DEBUG: Microsoft.PowerShell.Commands.Internal.Format.FormatEntryData DEBUG: Microsoft.PowerShell.Commands.Internal.Format.GroupEndData PS C:\> gwmi win32_bios | ft -auto | Out-String | Write-Debug DEBUG: SMBIOSBIOSVersion Manufacturer Name SerialNumber Version ----------------- ------------ ---- ------------ ------- 786F3 v01.34 Hewlett-Packard Default System BIOS CZC8196Q8S HPQOEM - ... PS C:\> gwmi win32_bios | ft | Out-String -stream | Write-Debug DEBUG: DEBUG: SMBIOSBIOSVersi Manufacturer Name SerialNumber Version DEBUG: on DEBUG: --------------- ------------ ---- ------------ ------- DEBUG: 786F3 v01.34 Hewlett-Packard Default Syst... CZC8196Q8S HPQOEM - 201... DEBUG: DEBUG:PS C:\> ```
If you want write-debug to handle each one separately: ``` [string[]]$test = @("test1", "test2", "test3") Write-Output $test test1 test2 test3 $DebugPreference = "Inquire" $test | Write-Debug DEBUG: test1 DEBUG: test2 DEBUG: test3 ```
65,105,209
![Else is executed](https://i.stack.imgur.com/Px5Xg.png) the if else statement is not working for me
2020/12/02
[ "https://Stackoverflow.com/questions/65105209", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14747792/" ]
``` print('Hello There') number=int(input('please provide a number')) if number%2==0: print ('even') else: print('odd') ``` Just read about the `modulus %`
`/` is the division operator. If you want to check for evenness vs oddness, you should be looking at the remainder, and using the module (`%`) operator: ```py if number % 2 == 0: print("even") else: print("odd") ```
44,868,612
I'm doing a project in MapReduce using Amazon Web Services and I'm having this error: > > FATAL [main] org.apache.hadoop.mapred.YarnChild: Error running child : > java.lang.StackOverflowError at > java.util.regex.Pattern$GroupHead.match(Pattern.java:4658) > > > I read a few other questions to understand why this happened and it seems my regex has repetitive alternative paths. This is the regex: ``` \\s+(?=(?:(?<=[a-zA-Z])\"(?=[A-Za-z])|\"[^\"]*\"|[^\"])*$) ``` What it does is that it splits by space except when they are inside these symbols `< >` or these `" "`. So basically takes strings that are inside those 2 types of symbol. I have tried many other versions but none works, so I am far away from an optimal one. I am kind of lost and it's the first time Im using these complicated regexs. Can someone please give a better option for my regex? I would truly appreciate every feedback regarding this! EDIT: This string with URLs inside <> and text inside "" and spaces: <\janhaeussler.com/?sioc\_type=user&sioc\_id=1/> "HEY" <.org/1999/02/22-rdf-syntax-ns#type/> should produce these 3 Strings: 1. <\janhaeussler.com/?sioc\_type=user&sioc\_id=1/> (with or without <>) 2. "HEY" 3. <.org/1999/02/22-rdf-syntax-ns#type/> EDIT 2: I think the symbols <> are confusing. I am trying to find a regex that splits by one or more spaces without taking into consideration the spaces inside " ", since the urls do not have spaces.
2017/07/02
[ "https://Stackoverflow.com/questions/44868612", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5182830/" ]
Try this: ``` \s+(?=(?:(?:[^"]*"){2})*[^"]*$) ``` [Demo](https://regex101.com/r/fn1IoR/2/) ``` String string = "abc d<\\janhaeussler.com/?sioc_type=user &sioc_id=1/> \"HEY 1\" 2 3 <.org/1999/02/22-rdf-syntax-ns#type/> \"tra la\" <asdfadsf sadfasdf/> 4 \"sdf sdf\" 5 6"; String[] res=string.split("\\s+(?=(?:(?:[^\"]*\"){2})*[^\"]*$)"); System.out.println(Arrays.toString(res)); ``` Will output: ``` [abc, d<\janhaeussler.com/?sioc_type=user, &sioc_id=1/>, "HEY 1", 2, 3, <.org/1999/02/22-rdf-syntax-ns#type/>, "tra la", <asdfadsf, sadfasdf/>, 4, "sdf sdf", 5, 6] ```
Don't use `split()`. Use a `find()` loop instead, with this regex: ```none (?:<[^<]*> | "[^"]*" | \S )+ ``` Example: ``` String input = "<\\janhaeussler.com/?sioc_type=user&sioc_id=1/> \"HEY\" <.org/1999/02/22-rdf-syntax-ns#type/>"; Pattern p = Pattern.compile("(?:<[^<]*>|\"[^\"]*\"|\\S)+"); for (Matcher m = p.matcher(input); m.find(); ) { System.out.println(m.group()); } ``` *Output* ```none <\janhaeussler.com/?sioc_type=user&sioc_id=1/> "HEY" <.org/1999/02/22-rdf-syntax-ns#type/> ```
44,868,612
I'm doing a project in MapReduce using Amazon Web Services and I'm having this error: > > FATAL [main] org.apache.hadoop.mapred.YarnChild: Error running child : > java.lang.StackOverflowError at > java.util.regex.Pattern$GroupHead.match(Pattern.java:4658) > > > I read a few other questions to understand why this happened and it seems my regex has repetitive alternative paths. This is the regex: ``` \\s+(?=(?:(?<=[a-zA-Z])\"(?=[A-Za-z])|\"[^\"]*\"|[^\"])*$) ``` What it does is that it splits by space except when they are inside these symbols `< >` or these `" "`. So basically takes strings that are inside those 2 types of symbol. I have tried many other versions but none works, so I am far away from an optimal one. I am kind of lost and it's the first time Im using these complicated regexs. Can someone please give a better option for my regex? I would truly appreciate every feedback regarding this! EDIT: This string with URLs inside <> and text inside "" and spaces: <\janhaeussler.com/?sioc\_type=user&sioc\_id=1/> "HEY" <.org/1999/02/22-rdf-syntax-ns#type/> should produce these 3 Strings: 1. <\janhaeussler.com/?sioc\_type=user&sioc\_id=1/> (with or without <>) 2. "HEY" 3. <.org/1999/02/22-rdf-syntax-ns#type/> EDIT 2: I think the symbols <> are confusing. I am trying to find a regex that splits by one or more spaces without taking into consideration the spaces inside " ", since the urls do not have spaces.
2017/07/02
[ "https://Stackoverflow.com/questions/44868612", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5182830/" ]
Try this: ``` \s+(?=(?:(?:[^"]*"){2})*[^"]*$) ``` [Demo](https://regex101.com/r/fn1IoR/2/) ``` String string = "abc d<\\janhaeussler.com/?sioc_type=user &sioc_id=1/> \"HEY 1\" 2 3 <.org/1999/02/22-rdf-syntax-ns#type/> \"tra la\" <asdfadsf sadfasdf/> 4 \"sdf sdf\" 5 6"; String[] res=string.split("\\s+(?=(?:(?:[^\"]*\"){2})*[^\"]*$)"); System.out.println(Arrays.toString(res)); ``` Will output: ``` [abc, d<\janhaeussler.com/?sioc_type=user, &sioc_id=1/>, "HEY 1", 2, 3, <.org/1999/02/22-rdf-syntax-ns#type/>, "tra la", <asdfadsf, sadfasdf/>, 4, "sdf sdf", 5, 6] ```
You could try to match: tags OR what's between the double quotes OR the remaining non-whitespaces. ``` <[^>]+>|"[^"]+"|\S+ ``` For example: ``` String str = "<\\janhaeussler.com/?sioc_type=user&sioc_id=1/> \"HEY\" YOU! \"How Are You?\" <.org/1999/02/22-rdf-syntax-ns#type/>"; final java.util.regex.Pattern pattern = java.util.regex.Pattern.compile("<[^>]+>|\"[^\"]+\"|\\S+"); java.util.regex.Matcher matcher = pattern.matcher(str); while (matcher.find()) { System.out.println("match: " + matcher.group(0)); } ``` Prints: ``` match: <\janhaeussler.com/?sioc_type=user&sioc_id=1/> match: "HEY" match: YOU! match: "How Are You?" match: <.org/1999/02/22-rdf-syntax-ns#type/> ```
25,866,078
I am trying to read txt file using `RandomAccessFile` and `FileChannel` which contains large number of float / integer values, but at after the all conversations using `ByteBuffer` the values which I get as a result are not the same with the ones in txt file. Here is how I am doing it : ``` RandomAccessFile mRandomFile = new RandomAccessFile(Environment.getExternalStorageDirectory() + "/Models/vertices.txt", "rw"); FileChannel mInChannel = mRandomFile.getChannel(); ByteBuffer mBuffer = ByteBuffer.allocate(181017 * 4); mBuffer.clear(); mInChannel.read(mBuffer); mBuffer.rewind(); FloatBuffer mFloatBUffer = mBuffer.asFloatBuffer(); mFloatBUffer.get(VERTS); mInChannel.close(); for (int i = 0; i < 20; i++) { Log.d("", "VALUE: " + VERTS[i]); } ``` The values in txt file are presented in this way (they are separated with a new line): ``` -36.122300 -6.356030 -46.876744 -36.122303 -7.448818 -46.876756 -36.122303 -7.448818 81.123221 -36.122300 -6.356030 81.123209 36.817676 -6.356030 -46.876779 36.817676 -7.448818 -46.876779 -36.122303 -7.448818 ``` and the values which I am getting in `for` are: ``` VALUE: 1.0187002E-11 VALUE: 2.5930944E-9 VALUE: 6.404289E-10 VALUE: 2.5957827E-6 VALUE: 2.6255839E-6 VALUE: 8.339467E-33 VALUE: 4.1885793E-11 VALUE: 1.0740952E-5 VALUE: 1.0187002E-11 VALUE: 2.5930944E-9 VALUE: 6.513428E-10 VALUE: 1.0383363E-5 VALUE: 4.3914857E-5 VALUE: 8.339467E-33 VALUE: 4.1885793E-11 VALUE: 1.0801023E-5 VALUE: 1.0187002E-11 VALUE: 2.5930944E-9 VALUE: 6.513428E-10 VALUE: 1.0383363E-5 ``` Any ideas, suggestions what I am missing here?
2014/09/16
[ "https://Stackoverflow.com/questions/25866078", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1511776/" ]
It is a text file, not a random access file. You should be reading with a `BufferedReader`. It´s got a `readLine()` that returns a String, and then you can just go with `Double.valueOf(String)`. There´s more code here [How to use Buffered Reader in Java](https://stackoverflow.com/questions/16265693/how-to-use-buffered-reader-in-java)
Android-Developer again, i see you try the binary-file-approach... to do this you must convert your data Create a **new** Java-Project and use your original methods there to load the the values from a xml/text-file and convert it into floats... (yes, it will take some time then, but it provided valid data...) once you have the data inside your application store your floats into a file named floats.bin (using a FileWriter). Go then and copy the file floats.bin into your Android Project and try to load it there with your code from above (looks good in my opinion)... (referring to [Android fastest way of reading big arrays of variables](https://stackoverflow.com/questions/25845929/android-fastest-way-of-reading-big-arrays-of-variables/25846974#25846974)) after sleeping one night over your problem i think you can * either distract the user and load the data before you show your models... * or you can show the model while you are loading - and let the user see your progress and see the model growing with each second.... * or you can split your data into seperate chunks from coarse to fine and load first the coarse data and show it - then you load into background the finer and finer data and add it piece by piece into your model...
51,886,330
In my project I have included a third-party bundle via composer containing multiple forms like: ``` namespace acme\ContactBundle\Form\Type; class PersonType extends AbstractType { /** * @param FormBuilderInterface $builder * @param array $options */ public function buildForm(FormBuilderInterface $builder, array $options) { $builder ->add('firstname', TextType::class, array( 'label' => 'person.firstname' )) ->add('lastname', TextType::class, array( 'label' => 'person.lastname' )); } } ``` Now I would like to add an additional field *before* `firstname` called `title`. Is there a way to do this without touching the original code? Probably, I also need to alter the entity to add the additional database field. Alternatively: Since I have write access to the third-party bundle, maybe there's a way to allow fields to be injected?
2018/08/16
[ "https://Stackoverflow.com/questions/51886330", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
That's is because you are using : `Dart version 2.1.0-dev.0.0.flutter-be6309690f` and the plugin named `flutter_circular_chart` has a `constraint` <https://github.com/xqwzts/flutter_circular_chart/blob/master/pubspec.yaml> ``` environment: sdk: '>=1.19.0 <2.0.0' ``` You can fork the project and update the sdk constraint and ref to your repository: Like this: ``` flutter_circular_chart: git: https://github.com/your_repo/flutter_circular_chart.git ``` **Note** Also would be fine if you open an issue in their repo to notify the devs about the issue that you have.
Use devendency\_override with same version witch need for same for other dependency. Like google\_maps\_flutter: ^0.5.28+1 needs intl to be 0.16.0 then craete dependency\_overrides: intl: ^0.16.0 below of dev\_dependencies: flutter\_test: sdk: flutter run project until it not run on device. Enjoy. Thanks..
12,015,139
I'm having some cookie/oauth issues. What I'm trying to achieve is have a new tab open up, have the user go through google's oauth flow, and upon returning to the app they should be able to make requests to our api with the cookie they receive, but.. I have no idea how to save that cookie. If I go into chrome's inspect tool I can see the cookie in the resources tab, but anything done with forge or angularjs (the js framework I'm using) doesn't include the cookie, and due to browser security I can't set it manually. Any help?
2012/08/18
[ "https://Stackoverflow.com/questions/12015139", "https://Stackoverflow.com", "https://Stackoverflow.com/users/434445/" ]
Why do you have to save it as a cookie? You have localStorage (or [forge.prefs](http://docs.trigger.io/en/v1.4/modules/prefs.html?highlight=prefs#prefs.set), but not sure how those work exactly). You're in a mobile app, so the security of localStorage isn't a worry.
I use angular-storage. It is perfect for storing the token. <https://github.com/auth0/angular-storage> To save your token after login: ``` store.set('jwt', data.token); store.set('user', jwtHelper.decodeToken(store.get('jwt'))); ``` Then to check if your token is valid: ``` .run(function($rootScope, $state, store, jwtHelper) { $rootScope.$on('$stateChangeStart', function(event, toState, toParams) { if (toState.data && toState.data.requiresLogin) { store.set('redirect', {state: toState.name, stateParams: toParams}); //TODO This is never passing but still redirecting? if (!store.get('jwt') || jwtHelper.isTokenExpired(store.get('jwt'))) { event.preventDefault(); $state.go('login'); } } }); }) ```
448,554
I use my AirPods Pro 2 for both my MacBook but also on another device. What I notice is that when my MacBook is asleep, but I take out my AirPods, it will cause my MacBook to wake up. I looked through the settings in my MacBook but I only see the basic bluetooth options for the AirPods. I can't seem to find a setting to ensure my MacBook doesn't auto-wake up from AirPods or any Bluetooth item.
2022/10/03
[ "https://apple.stackexchange.com/questions/448554", "https://apple.stackexchange.com", "https://apple.stackexchange.com/users/473526/" ]
As much as I love the shell, it’s unforgiving with wildcards and spaces in general and worse if your script gets to folders you didn’t expect. Your case of all within one folder and no recursion limits your risk to [script this cleanly](https://apple.stackexchange.com/a/448509/5472). To prepare, empty trash (so you can easily see / reverse this if needed) and consider making a backup - great advice any time you are about to automate destruction of thousands of files right next to ones you hope to retain. In finder, search for space 2.ext with quotes. Select search in your folder to ensure you’re not searching everywhere and count the results. **“ 2.ext”** * `Command` + `A` * `Command` + `Delete`
In Terminal, `rm *\ 2.ext` should work. PS: To be sure that the correct files get deleted, run `ls *\ 2.ext` first, or use `rm -i *\ 2.ext` to be prompted for each file.
448,554
I use my AirPods Pro 2 for both my MacBook but also on another device. What I notice is that when my MacBook is asleep, but I take out my AirPods, it will cause my MacBook to wake up. I looked through the settings in my MacBook but I only see the basic bluetooth options for the AirPods. I can't seem to find a setting to ensure my MacBook doesn't auto-wake up from AirPods or any Bluetooth item.
2022/10/03
[ "https://apple.stackexchange.com/questions/448554", "https://apple.stackexchange.com", "https://apple.stackexchange.com/users/473526/" ]
[nohillside's answer](https://apple.stackexchange.com/a/448509) to use `rm *\ 2.ext` will work just fine, but if you want extra confidence it's doing the right thing, you can instead use ``` mkdir to_be_deleted mv -- *\ 2.ext to_be_deleted ``` That'll put all the files you want deleted in a separate folder - you can then use finder (or whatever) to check which files are still in the original folder, and which ones have been moved. When you're happy it looks good, delete the `to_be_deleted` folder. *Thanks to fd0 for suggesting the initial `--` argument.*
In Terminal, `rm *\ 2.ext` should work. PS: To be sure that the correct files get deleted, run `ls *\ 2.ext` first, or use `rm -i *\ 2.ext` to be prompted for each file.
448,554
I use my AirPods Pro 2 for both my MacBook but also on another device. What I notice is that when my MacBook is asleep, but I take out my AirPods, it will cause my MacBook to wake up. I looked through the settings in my MacBook but I only see the basic bluetooth options for the AirPods. I can't seem to find a setting to ensure my MacBook doesn't auto-wake up from AirPods or any Bluetooth item.
2022/10/03
[ "https://apple.stackexchange.com/questions/448554", "https://apple.stackexchange.com", "https://apple.stackexchange.com/users/473526/" ]
In Terminal, `rm *\ 2.ext` should work. PS: To be sure that the correct files get deleted, run `ls *\ 2.ext` first, or use `rm -i *\ 2.ext` to be prompted for each file.
As noted by others, there might be issues here with shell scripting depending on how the duplicates were made. You could theoretically avoid those by copying the folder and trying it first, but the only way to totally verify is if you went through them by hand which somewhat defeats the purpose. This is a Python file I use for similar deduplication that I might have. It scans the folder for files by using their sha256, retains the highest file name alphabetically (which should generally keep the cleaner file names) and deletes the others. You can change the dry\_run variable on the 3rd to last line to true like this: ``` if __name__ == '__main__': d = Deduplicator(path, dry_run=True) d.deduplicate() ``` To verify that the files you want to delete are actually what are going to be deleted. And, of course, change line 4 from /path/to/your/files to the actual directory where the files are. To run, on a mac you should simply be able to run: ``` python /path/to/your/deduplicate.py ``` Where /path/to/your/script is wherever you save this .py file. Basically, put the following in a text file and name it deduplicate.py: ``` import os import hashlib path = '/path/to/your/files' class Deduplicator: def __init__(self, path, dry_run=True): self.path = path self.file_dict = dict() self.dry_run = dry_run def deduplicate(self): self.get_files() self.clean_files() def get_file_hash(self, file_path): with open(file_path, 'rb') as f: file = f.read() hash = hashlib.sha256(file).hexdigest() return hash def get_files(self): # Loop through the directory for file in os.listdir(path): # Get the file hash hash = self.get_file_hash(os.path.join(self.path, file)) # If we haven't seen the hash yet, go ahead and initiate the list if not self.file_dict.get(hash): self.file_dict[hash] = list() # Then add this filename to that hashed value self.file_dict[hash].append(file) def clean_files(self): for hash, file_names in self.file_dict.items(): file_names.sort(reverse=True) files_to_delete = file_names[:-1] print(f"File to keep: {file_names[0]}") print(f'Files to delete: {files_to_delete}') print('-'*50) if not self.dry_run: for file in files_to_delete: full_path = os.path.join(path,file) print(f"...deleting: {full_path}") os.remove(full_path) if __name__ == '__main__': d = Deduplicator(path, dry_run=False) d.deduplicate() ```
448,554
I use my AirPods Pro 2 for both my MacBook but also on another device. What I notice is that when my MacBook is asleep, but I take out my AirPods, it will cause my MacBook to wake up. I looked through the settings in my MacBook but I only see the basic bluetooth options for the AirPods. I can't seem to find a setting to ensure my MacBook doesn't auto-wake up from AirPods or any Bluetooth item.
2022/10/03
[ "https://apple.stackexchange.com/questions/448554", "https://apple.stackexchange.com", "https://apple.stackexchange.com/users/473526/" ]
In Terminal, `rm *\ 2.ext` should work. PS: To be sure that the correct files get deleted, run `ls *\ 2.ext` first, or use `rm -i *\ 2.ext` to be prompted for each file.
A very unpopular opinion is to use a dedicated duplicate removal software rather than trying to mess up with terminal. Even if you are pro-terminal user you might end up deleting important files. There are few reasons. 1. Softwares are developed after succeeding a lot of cases. 2. They compare file content rather than relying on file name only. 3. They provide an interface that draw attention to important details.
448,554
I use my AirPods Pro 2 for both my MacBook but also on another device. What I notice is that when my MacBook is asleep, but I take out my AirPods, it will cause my MacBook to wake up. I looked through the settings in my MacBook but I only see the basic bluetooth options for the AirPods. I can't seem to find a setting to ensure my MacBook doesn't auto-wake up from AirPods or any Bluetooth item.
2022/10/03
[ "https://apple.stackexchange.com/questions/448554", "https://apple.stackexchange.com", "https://apple.stackexchange.com/users/473526/" ]
As much as I love the shell, it’s unforgiving with wildcards and spaces in general and worse if your script gets to folders you didn’t expect. Your case of all within one folder and no recursion limits your risk to [script this cleanly](https://apple.stackexchange.com/a/448509/5472). To prepare, empty trash (so you can easily see / reverse this if needed) and consider making a backup - great advice any time you are about to automate destruction of thousands of files right next to ones you hope to retain. In finder, search for space 2.ext with quotes. Select search in your folder to ensure you’re not searching everywhere and count the results. **“ 2.ext”** * `Command` + `A` * `Command` + `Delete`
[nohillside's answer](https://apple.stackexchange.com/a/448509) to use `rm *\ 2.ext` will work just fine, but if you want extra confidence it's doing the right thing, you can instead use ``` mkdir to_be_deleted mv -- *\ 2.ext to_be_deleted ``` That'll put all the files you want deleted in a separate folder - you can then use finder (or whatever) to check which files are still in the original folder, and which ones have been moved. When you're happy it looks good, delete the `to_be_deleted` folder. *Thanks to fd0 for suggesting the initial `--` argument.*
448,554
I use my AirPods Pro 2 for both my MacBook but also on another device. What I notice is that when my MacBook is asleep, but I take out my AirPods, it will cause my MacBook to wake up. I looked through the settings in my MacBook but I only see the basic bluetooth options for the AirPods. I can't seem to find a setting to ensure my MacBook doesn't auto-wake up from AirPods or any Bluetooth item.
2022/10/03
[ "https://apple.stackexchange.com/questions/448554", "https://apple.stackexchange.com", "https://apple.stackexchange.com/users/473526/" ]
As much as I love the shell, it’s unforgiving with wildcards and spaces in general and worse if your script gets to folders you didn’t expect. Your case of all within one folder and no recursion limits your risk to [script this cleanly](https://apple.stackexchange.com/a/448509/5472). To prepare, empty trash (so you can easily see / reverse this if needed) and consider making a backup - great advice any time you are about to automate destruction of thousands of files right next to ones you hope to retain. In finder, search for space 2.ext with quotes. Select search in your folder to ensure you’re not searching everywhere and count the results. **“ 2.ext”** * `Command` + `A` * `Command` + `Delete`
As noted by others, there might be issues here with shell scripting depending on how the duplicates were made. You could theoretically avoid those by copying the folder and trying it first, but the only way to totally verify is if you went through them by hand which somewhat defeats the purpose. This is a Python file I use for similar deduplication that I might have. It scans the folder for files by using their sha256, retains the highest file name alphabetically (which should generally keep the cleaner file names) and deletes the others. You can change the dry\_run variable on the 3rd to last line to true like this: ``` if __name__ == '__main__': d = Deduplicator(path, dry_run=True) d.deduplicate() ``` To verify that the files you want to delete are actually what are going to be deleted. And, of course, change line 4 from /path/to/your/files to the actual directory where the files are. To run, on a mac you should simply be able to run: ``` python /path/to/your/deduplicate.py ``` Where /path/to/your/script is wherever you save this .py file. Basically, put the following in a text file and name it deduplicate.py: ``` import os import hashlib path = '/path/to/your/files' class Deduplicator: def __init__(self, path, dry_run=True): self.path = path self.file_dict = dict() self.dry_run = dry_run def deduplicate(self): self.get_files() self.clean_files() def get_file_hash(self, file_path): with open(file_path, 'rb') as f: file = f.read() hash = hashlib.sha256(file).hexdigest() return hash def get_files(self): # Loop through the directory for file in os.listdir(path): # Get the file hash hash = self.get_file_hash(os.path.join(self.path, file)) # If we haven't seen the hash yet, go ahead and initiate the list if not self.file_dict.get(hash): self.file_dict[hash] = list() # Then add this filename to that hashed value self.file_dict[hash].append(file) def clean_files(self): for hash, file_names in self.file_dict.items(): file_names.sort(reverse=True) files_to_delete = file_names[:-1] print(f"File to keep: {file_names[0]}") print(f'Files to delete: {files_to_delete}') print('-'*50) if not self.dry_run: for file in files_to_delete: full_path = os.path.join(path,file) print(f"...deleting: {full_path}") os.remove(full_path) if __name__ == '__main__': d = Deduplicator(path, dry_run=False) d.deduplicate() ```
448,554
I use my AirPods Pro 2 for both my MacBook but also on another device. What I notice is that when my MacBook is asleep, but I take out my AirPods, it will cause my MacBook to wake up. I looked through the settings in my MacBook but I only see the basic bluetooth options for the AirPods. I can't seem to find a setting to ensure my MacBook doesn't auto-wake up from AirPods or any Bluetooth item.
2022/10/03
[ "https://apple.stackexchange.com/questions/448554", "https://apple.stackexchange.com", "https://apple.stackexchange.com/users/473526/" ]
As much as I love the shell, it’s unforgiving with wildcards and spaces in general and worse if your script gets to folders you didn’t expect. Your case of all within one folder and no recursion limits your risk to [script this cleanly](https://apple.stackexchange.com/a/448509/5472). To prepare, empty trash (so you can easily see / reverse this if needed) and consider making a backup - great advice any time you are about to automate destruction of thousands of files right next to ones you hope to retain. In finder, search for space 2.ext with quotes. Select search in your folder to ensure you’re not searching everywhere and count the results. **“ 2.ext”** * `Command` + `A` * `Command` + `Delete`
A very unpopular opinion is to use a dedicated duplicate removal software rather than trying to mess up with terminal. Even if you are pro-terminal user you might end up deleting important files. There are few reasons. 1. Softwares are developed after succeeding a lot of cases. 2. They compare file content rather than relying on file name only. 3. They provide an interface that draw attention to important details.
448,554
I use my AirPods Pro 2 for both my MacBook but also on another device. What I notice is that when my MacBook is asleep, but I take out my AirPods, it will cause my MacBook to wake up. I looked through the settings in my MacBook but I only see the basic bluetooth options for the AirPods. I can't seem to find a setting to ensure my MacBook doesn't auto-wake up from AirPods or any Bluetooth item.
2022/10/03
[ "https://apple.stackexchange.com/questions/448554", "https://apple.stackexchange.com", "https://apple.stackexchange.com/users/473526/" ]
[nohillside's answer](https://apple.stackexchange.com/a/448509) to use `rm *\ 2.ext` will work just fine, but if you want extra confidence it's doing the right thing, you can instead use ``` mkdir to_be_deleted mv -- *\ 2.ext to_be_deleted ``` That'll put all the files you want deleted in a separate folder - you can then use finder (or whatever) to check which files are still in the original folder, and which ones have been moved. When you're happy it looks good, delete the `to_be_deleted` folder. *Thanks to fd0 for suggesting the initial `--` argument.*
As noted by others, there might be issues here with shell scripting depending on how the duplicates were made. You could theoretically avoid those by copying the folder and trying it first, but the only way to totally verify is if you went through them by hand which somewhat defeats the purpose. This is a Python file I use for similar deduplication that I might have. It scans the folder for files by using their sha256, retains the highest file name alphabetically (which should generally keep the cleaner file names) and deletes the others. You can change the dry\_run variable on the 3rd to last line to true like this: ``` if __name__ == '__main__': d = Deduplicator(path, dry_run=True) d.deduplicate() ``` To verify that the files you want to delete are actually what are going to be deleted. And, of course, change line 4 from /path/to/your/files to the actual directory where the files are. To run, on a mac you should simply be able to run: ``` python /path/to/your/deduplicate.py ``` Where /path/to/your/script is wherever you save this .py file. Basically, put the following in a text file and name it deduplicate.py: ``` import os import hashlib path = '/path/to/your/files' class Deduplicator: def __init__(self, path, dry_run=True): self.path = path self.file_dict = dict() self.dry_run = dry_run def deduplicate(self): self.get_files() self.clean_files() def get_file_hash(self, file_path): with open(file_path, 'rb') as f: file = f.read() hash = hashlib.sha256(file).hexdigest() return hash def get_files(self): # Loop through the directory for file in os.listdir(path): # Get the file hash hash = self.get_file_hash(os.path.join(self.path, file)) # If we haven't seen the hash yet, go ahead and initiate the list if not self.file_dict.get(hash): self.file_dict[hash] = list() # Then add this filename to that hashed value self.file_dict[hash].append(file) def clean_files(self): for hash, file_names in self.file_dict.items(): file_names.sort(reverse=True) files_to_delete = file_names[:-1] print(f"File to keep: {file_names[0]}") print(f'Files to delete: {files_to_delete}') print('-'*50) if not self.dry_run: for file in files_to_delete: full_path = os.path.join(path,file) print(f"...deleting: {full_path}") os.remove(full_path) if __name__ == '__main__': d = Deduplicator(path, dry_run=False) d.deduplicate() ```
448,554
I use my AirPods Pro 2 for both my MacBook but also on another device. What I notice is that when my MacBook is asleep, but I take out my AirPods, it will cause my MacBook to wake up. I looked through the settings in my MacBook but I only see the basic bluetooth options for the AirPods. I can't seem to find a setting to ensure my MacBook doesn't auto-wake up from AirPods or any Bluetooth item.
2022/10/03
[ "https://apple.stackexchange.com/questions/448554", "https://apple.stackexchange.com", "https://apple.stackexchange.com/users/473526/" ]
[nohillside's answer](https://apple.stackexchange.com/a/448509) to use `rm *\ 2.ext` will work just fine, but if you want extra confidence it's doing the right thing, you can instead use ``` mkdir to_be_deleted mv -- *\ 2.ext to_be_deleted ``` That'll put all the files you want deleted in a separate folder - you can then use finder (or whatever) to check which files are still in the original folder, and which ones have been moved. When you're happy it looks good, delete the `to_be_deleted` folder. *Thanks to fd0 for suggesting the initial `--` argument.*
A very unpopular opinion is to use a dedicated duplicate removal software rather than trying to mess up with terminal. Even if you are pro-terminal user you might end up deleting important files. There are few reasons. 1. Softwares are developed after succeeding a lot of cases. 2. They compare file content rather than relying on file name only. 3. They provide an interface that draw attention to important details.
30,742,889
Can't figure out how to get this work: ``` //Have a tiny CustomServiceLoader implementation public class MyServiceLoader { static private Map<Class<?>, Class<?>> CONTENTS = new HashMap<>(); static public <S, T extends S> void registerClassForInterface(Class<T> c, Class<S> i) { if (c == null) { CONTENTS.remove(i); } else { CONTENTS.put(c, i); } } static public <S, T extends S> Class<T> getClassForInterface(Class<S> i) { return (Class<T>)CONTENTS.get(i); } } ``` Usage: ``` // classes registration works perfect event check for interface conformance (e.g. T extends S really works here!): MyServiceLoader.registerClassForInterface(Model.class, APIAsyncLoaderTask.class); // but I can't figure out how to instantiate a class returned from my service loader: Class c = GiftdServiceLoader.getClassForInterface(APIAsyncLoaderTask.class); mLoaderTask = c.newInstance(); // 'new c();' also couldn't work ``` And compiler error: ![incompatible types compiler error](https://i.stack.imgur.com/7234z.png) also I have a strange tip for that method which is ``` public final Class<T> extends Object implements Serializable, AnnotatedElement, GenericDeclaration, Type ``` But I cannot see my interface there. I'm getting same when using both: **abstract class + class** and **interface + class** **How do I make it work properly? I'm wondering is it at least possible?**
2015/06/09
[ "https://Stackoverflow.com/questions/30742889", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1823351/" ]
You're using the raw type `Class`. ``` Class c = GiftdServiceLoader.getClassForInterface(APIAsyncLoaderTask.class); ``` All generatic types and generic type parameters in any method invoked on such a reference are erased. Parameterize it correctly ``` Class<APIAsyncLoaderTask> c = MyServiceLoader.getClassForInterface(APIAsyncLoaderTask.class); ``` Note that you should use only the interface type if you aren't sure of what you'll be receiving from the call to `getClassForInterface`. For example, I can do ``` MyServiceLoader.registerClassForInterface(NotModel.class, APIAsyncLoaderTask.class); // but I can't figure out how to instantiate a class returned from my service loader: Class<Model> c = MyServiceLoader.getClassForInterface(APIAsyncLoaderTask.class); Model mLoaderTask = c.newInstance(); // 'new c();' also couldn't work ``` and it will fail with a `ClassCastException`. Generics are not powerful enough to prevent this. --- I believe you meant to have ``` CONTENTS.put(i, c); ``` in your `registerClassForInterface` method.
You have the raw form of the `Class` class in the preceding line: ``` Class c = GiftdServiceLoader.getClassForInterface(APIAsyncLoaderTask.class); ``` Therefore, the `newInstance()` method returns an `Object`, which can't be assigned to an `APIAsyncLoaderTask`. But coming out of a `Map<Class<?>, Class<?>>`, the best you can do with generics is `Class<?> c = ...`, and `newInstance` still returns an `Object`. You don't have the information at compile time to determine if the `Class` `c` represents an `APIAsyncLoaderTask`. However, you can enforce an upper bound on the value of the `HashMap`. ``` static private Map<Class<?>, Class<? extends APIAsyncLoaderTask>> CONTENTS = new HashMap<>(); ``` Your `registerClassForInterface` method will need that upper bound also. ``` static public <S extends APIAsyncLoaderTask, T extends S> void registerClassForInterface( Class<T> c, Class<S> i) { ``` Then you can `get` a `Class<? extends APIAsyncLoaderTask>` out of the `HashMap`, and `newInstance()` will return the erasure of the upper bound -- an `APIAsyncLoaderTask`.
8,069,236
This gives me seg fault 11 when I input the string. Why am i getting the seg fault? It's so simple... where is the seg fault coming from? ``` int main(){ char * str; printf ("please enter string : "); cin >> str; // reverse_str(str); } ```
2011/11/09
[ "https://Stackoverflow.com/questions/8069236", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1038203/" ]
You have not allocated any memory to `str`. So you are trying to essentially write to a pointer which cannot hold the string. Essentially this leads to an Undefined Behavior and a seg fault. The solution is: You should use **[std::string](http://www.google.co.in/url?sa=t&rct=j&q=std::string&source=web&cd=1&ved=0CCUQFjAA&url=http://www.cplusplus.com/reference/string/string/&ei=Nr26Tt-9AYXMhAeKuf27Bw&usg=AFQjCNHYSO65lBUum_PPFu0nJcwzb0EW9w)** instead of pointer. ``` std::string str; std::cout<<"please enter string : "; std::cin >>str; ``` Also, try not to mix C and C++. Use `streams` in C++ not `printf` --- Alternatively, there are 2 other approaches: **Not so good other Approach 1:** You can allocate memory to `str` by making it an fixed size array: ``` #define MAX_INPUT 256 char str[MAX_INPUT]={0}; ``` **Drawback:** This would require that you need to know the length of the maximum input that user can enter at compile time, Since **[Variable Length Arrays](https://stackoverflow.com/questions/1887097/variable-length-arrays-in-c)** are not allowed in C++. **Not so good other Approach 2:** You could allocate memory dynamically to `str` using `new []`.`str` will be a pointer in this case. ``` #define MAX_INPUT 256 char *str = new char[MAX_INPUT]; ``` **Drawback:** Again this approach has the drawback of knowing how much memory to allocate at compile time in this case,since user inputs the string. Also, You need to remember to deallocate by calling `delete[]` or you leak memory. Also, try to avoid using `new` as much as possible in C++. **Conclusion:** Best solution here is to use `std::string` because it saves you from all above problems.
Segmentation faults occur when a program accesses memory that doesn't belong to it. The pointer `str` is not initialized. It doesn't point at any memory. The stream-extraction operator `>>` doesn't allocate new memory for the string it reads; it expects the pointer to already point to a buffer that it can fill. It doesn't know that `str` is garbage, though. It assumes it's a valid pointer and attempts to write into that memory. Since the memory at that garbage address doesn't belong to your program, the OS halts it with a segmentation fault. Read into a `std::string` instead. Better yet, use `std::getline` so the user can enter a string with spaces; the `>>` operator will only read up to the first whitespace character. ``` std::string str; std::getline(cin, str); ```
8,069,236
This gives me seg fault 11 when I input the string. Why am i getting the seg fault? It's so simple... where is the seg fault coming from? ``` int main(){ char * str; printf ("please enter string : "); cin >> str; // reverse_str(str); } ```
2011/11/09
[ "https://Stackoverflow.com/questions/8069236", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1038203/" ]
You should use `std::string` instead. Your declaration: ``` char * str; ``` declares only a pointer, but does not allocate a memory region for the string to be stored. The solutions could have been ``` char str[256]; ``` or ``` char * str = new char[256]; ``` However, they are *very* bad style because you would then have to check and control the size of input each time you want to write to it. C++ provides `std::string` to store strings. Use it.
Use `std::string`. Or, if you just want to use char \* (discouraged): ``` char * str = new char[256]; cin >> str; ```
8,069,236
This gives me seg fault 11 when I input the string. Why am i getting the seg fault? It's so simple... where is the seg fault coming from? ``` int main(){ char * str; printf ("please enter string : "); cin >> str; // reverse_str(str); } ```
2011/11/09
[ "https://Stackoverflow.com/questions/8069236", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1038203/" ]
You should use `std::string` instead. Your declaration: ``` char * str; ``` declares only a pointer, but does not allocate a memory region for the string to be stored. The solutions could have been ``` char str[256]; ``` or ``` char * str = new char[256]; ``` However, they are *very* bad style because you would then have to check and control the size of input each time you want to write to it. C++ provides `std::string` to store strings. Use it.
You need to allocate memory first for `str`. You declared only a pointer ``` char* str = (char*)malloc(MAX_SIZE_OF_BUFFER); ```
8,069,236
This gives me seg fault 11 when I input the string. Why am i getting the seg fault? It's so simple... where is the seg fault coming from? ``` int main(){ char * str; printf ("please enter string : "); cin >> str; // reverse_str(str); } ```
2011/11/09
[ "https://Stackoverflow.com/questions/8069236", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1038203/" ]
You have not allocated any memory to `str`. So you are trying to essentially write to a pointer which cannot hold the string. Essentially this leads to an Undefined Behavior and a seg fault. The solution is: You should use **[std::string](http://www.google.co.in/url?sa=t&rct=j&q=std::string&source=web&cd=1&ved=0CCUQFjAA&url=http://www.cplusplus.com/reference/string/string/&ei=Nr26Tt-9AYXMhAeKuf27Bw&usg=AFQjCNHYSO65lBUum_PPFu0nJcwzb0EW9w)** instead of pointer. ``` std::string str; std::cout<<"please enter string : "; std::cin >>str; ``` Also, try not to mix C and C++. Use `streams` in C++ not `printf` --- Alternatively, there are 2 other approaches: **Not so good other Approach 1:** You can allocate memory to `str` by making it an fixed size array: ``` #define MAX_INPUT 256 char str[MAX_INPUT]={0}; ``` **Drawback:** This would require that you need to know the length of the maximum input that user can enter at compile time, Since **[Variable Length Arrays](https://stackoverflow.com/questions/1887097/variable-length-arrays-in-c)** are not allowed in C++. **Not so good other Approach 2:** You could allocate memory dynamically to `str` using `new []`.`str` will be a pointer in this case. ``` #define MAX_INPUT 256 char *str = new char[MAX_INPUT]; ``` **Drawback:** Again this approach has the drawback of knowing how much memory to allocate at compile time in this case,since user inputs the string. Also, You need to remember to deallocate by calling `delete[]` or you leak memory. Also, try to avoid using `new` as much as possible in C++. **Conclusion:** Best solution here is to use `std::string` because it saves you from all above problems.
You should use `std::string` instead. Your declaration: ``` char * str; ``` declares only a pointer, but does not allocate a memory region for the string to be stored. The solutions could have been ``` char str[256]; ``` or ``` char * str = new char[256]; ``` However, they are *very* bad style because you would then have to check and control the size of input each time you want to write to it. C++ provides `std::string` to store strings. Use it.
8,069,236
This gives me seg fault 11 when I input the string. Why am i getting the seg fault? It's so simple... where is the seg fault coming from? ``` int main(){ char * str; printf ("please enter string : "); cin >> str; // reverse_str(str); } ```
2011/11/09
[ "https://Stackoverflow.com/questions/8069236", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1038203/" ]
You have not allocated any memory to `str`. So you are trying to essentially write to a pointer which cannot hold the string. Essentially this leads to an Undefined Behavior and a seg fault. The solution is: You should use **[std::string](http://www.google.co.in/url?sa=t&rct=j&q=std::string&source=web&cd=1&ved=0CCUQFjAA&url=http://www.cplusplus.com/reference/string/string/&ei=Nr26Tt-9AYXMhAeKuf27Bw&usg=AFQjCNHYSO65lBUum_PPFu0nJcwzb0EW9w)** instead of pointer. ``` std::string str; std::cout<<"please enter string : "; std::cin >>str; ``` Also, try not to mix C and C++. Use `streams` in C++ not `printf` --- Alternatively, there are 2 other approaches: **Not so good other Approach 1:** You can allocate memory to `str` by making it an fixed size array: ``` #define MAX_INPUT 256 char str[MAX_INPUT]={0}; ``` **Drawback:** This would require that you need to know the length of the maximum input that user can enter at compile time, Since **[Variable Length Arrays](https://stackoverflow.com/questions/1887097/variable-length-arrays-in-c)** are not allowed in C++. **Not so good other Approach 2:** You could allocate memory dynamically to `str` using `new []`.`str` will be a pointer in this case. ``` #define MAX_INPUT 256 char *str = new char[MAX_INPUT]; ``` **Drawback:** Again this approach has the drawback of knowing how much memory to allocate at compile time in this case,since user inputs the string. Also, You need to remember to deallocate by calling `delete[]` or you leak memory. Also, try to avoid using `new` as much as possible in C++. **Conclusion:** Best solution here is to use `std::string` because it saves you from all above problems.
You need to allocate memory first for `str`. You declared only a pointer ``` char* str = (char*)malloc(MAX_SIZE_OF_BUFFER); ```
8,069,236
This gives me seg fault 11 when I input the string. Why am i getting the seg fault? It's so simple... where is the seg fault coming from? ``` int main(){ char * str; printf ("please enter string : "); cin >> str; // reverse_str(str); } ```
2011/11/09
[ "https://Stackoverflow.com/questions/8069236", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1038203/" ]
You have not allocated any memory to `str`. So you are trying to essentially write to a pointer which cannot hold the string. Essentially this leads to an Undefined Behavior and a seg fault. The solution is: You should use **[std::string](http://www.google.co.in/url?sa=t&rct=j&q=std::string&source=web&cd=1&ved=0CCUQFjAA&url=http://www.cplusplus.com/reference/string/string/&ei=Nr26Tt-9AYXMhAeKuf27Bw&usg=AFQjCNHYSO65lBUum_PPFu0nJcwzb0EW9w)** instead of pointer. ``` std::string str; std::cout<<"please enter string : "; std::cin >>str; ``` Also, try not to mix C and C++. Use `streams` in C++ not `printf` --- Alternatively, there are 2 other approaches: **Not so good other Approach 1:** You can allocate memory to `str` by making it an fixed size array: ``` #define MAX_INPUT 256 char str[MAX_INPUT]={0}; ``` **Drawback:** This would require that you need to know the length of the maximum input that user can enter at compile time, Since **[Variable Length Arrays](https://stackoverflow.com/questions/1887097/variable-length-arrays-in-c)** are not allowed in C++. **Not so good other Approach 2:** You could allocate memory dynamically to `str` using `new []`.`str` will be a pointer in this case. ``` #define MAX_INPUT 256 char *str = new char[MAX_INPUT]; ``` **Drawback:** Again this approach has the drawback of knowing how much memory to allocate at compile time in this case,since user inputs the string. Also, You need to remember to deallocate by calling `delete[]` or you leak memory. Also, try to avoid using `new` as much as possible in C++. **Conclusion:** Best solution here is to use `std::string` because it saves you from all above problems.
Use `std::string`. Or, if you just want to use char \* (discouraged): ``` char * str = new char[256]; cin >> str; ```
8,069,236
This gives me seg fault 11 when I input the string. Why am i getting the seg fault? It's so simple... where is the seg fault coming from? ``` int main(){ char * str; printf ("please enter string : "); cin >> str; // reverse_str(str); } ```
2011/11/09
[ "https://Stackoverflow.com/questions/8069236", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1038203/" ]
`str` doesn't point to anything sensible. You need to have a memory to write to. ``` std::string str; std::cout << "please enter string: "; std::cin >> str; ```
Your first line, `char * str` declares a raw pointer and doesn't initialize it or allocate any memory. That means it could point anywhere, and most likely not somewhere valid or useful. You most likely segfault when you try to use it on the 3rd line. Can you use `std::string` instead? It'll be much easier and safer than raw C-strings.
8,069,236
This gives me seg fault 11 when I input the string. Why am i getting the seg fault? It's so simple... where is the seg fault coming from? ``` int main(){ char * str; printf ("please enter string : "); cin >> str; // reverse_str(str); } ```
2011/11/09
[ "https://Stackoverflow.com/questions/8069236", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1038203/" ]
You should use `std::string` instead. Your declaration: ``` char * str; ``` declares only a pointer, but does not allocate a memory region for the string to be stored. The solutions could have been ``` char str[256]; ``` or ``` char * str = new char[256]; ``` However, they are *very* bad style because you would then have to check and control the size of input each time you want to write to it. C++ provides `std::string` to store strings. Use it.
Your first line, `char * str` declares a raw pointer and doesn't initialize it or allocate any memory. That means it could point anywhere, and most likely not somewhere valid or useful. You most likely segfault when you try to use it on the 3rd line. Can you use `std::string` instead? It'll be much easier and safer than raw C-strings.
8,069,236
This gives me seg fault 11 when I input the string. Why am i getting the seg fault? It's so simple... where is the seg fault coming from? ``` int main(){ char * str; printf ("please enter string : "); cin >> str; // reverse_str(str); } ```
2011/11/09
[ "https://Stackoverflow.com/questions/8069236", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1038203/" ]
You should use `std::string` instead. Your declaration: ``` char * str; ``` declares only a pointer, but does not allocate a memory region for the string to be stored. The solutions could have been ``` char str[256]; ``` or ``` char * str = new char[256]; ``` However, they are *very* bad style because you would then have to check and control the size of input each time you want to write to it. C++ provides `std::string` to store strings. Use it.
Segmentation faults occur when a program accesses memory that doesn't belong to it. The pointer `str` is not initialized. It doesn't point at any memory. The stream-extraction operator `>>` doesn't allocate new memory for the string it reads; it expects the pointer to already point to a buffer that it can fill. It doesn't know that `str` is garbage, though. It assumes it's a valid pointer and attempts to write into that memory. Since the memory at that garbage address doesn't belong to your program, the OS halts it with a segmentation fault. Read into a `std::string` instead. Better yet, use `std::getline` so the user can enter a string with spaces; the `>>` operator will only read up to the first whitespace character. ``` std::string str; std::getline(cin, str); ```
8,069,236
This gives me seg fault 11 when I input the string. Why am i getting the seg fault? It's so simple... where is the seg fault coming from? ``` int main(){ char * str; printf ("please enter string : "); cin >> str; // reverse_str(str); } ```
2011/11/09
[ "https://Stackoverflow.com/questions/8069236", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1038203/" ]
Your first line, `char * str` declares a raw pointer and doesn't initialize it or allocate any memory. That means it could point anywhere, and most likely not somewhere valid or useful. You most likely segfault when you try to use it on the 3rd line. Can you use `std::string` instead? It'll be much easier and safer than raw C-strings.
You need to allocate memory first for `str`. You declared only a pointer ``` char* str = (char*)malloc(MAX_SIZE_OF_BUFFER); ```
67,104,574
I'm creating an `aws_subnet` and referencing it in another resource. Example: ``` resource "aws_subnet" "mango" { vpc_id = aws_vpc.mango.id cidr_block = "${var.subnet_cidr}" } ``` The reference ``` network_configuration { subnets = "${aws_subnet.mango.id}" } ``` When planning it I get `aws_subnet.mango.id is a string, known only after apply` error. I'm new to Terraform. Is there something similar to Cloudformation's `DependsOn` or `Export/Import`?
2021/04/15
[ "https://Stackoverflow.com/questions/67104574", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17450994/" ]
This is a case of [explicit dependency](https://learn.hashicorp.com/tutorials/terraform/dependencies#manage-explicit-dependencies). The argument `depends_on` similar to CloudFormation's `DependsOn` solves such dependencies. Note: *"Since Terraform will wait to create the dependent resource until after the specified resource is created, adding explicit dependencies can increase the length of time it takes for Terraform to create your infrastructure."* Example: ``` depends_on = [aws_subnet.mango] ```
The information like `ID` or other such information which will be generated by AWS, cannot be predicted by `terraform plan` as this step only does a dry run and doesn't apply any changes. The fields which have `known only after apply` is not an error, but just informs the user that these fields only get populated in terraform state after its applied. The dependency order is handled by Terraform and hence referring values (even those which have `known only after apply`) will be resolved at run time.
67,104,574
I'm creating an `aws_subnet` and referencing it in another resource. Example: ``` resource "aws_subnet" "mango" { vpc_id = aws_vpc.mango.id cidr_block = "${var.subnet_cidr}" } ``` The reference ``` network_configuration { subnets = "${aws_subnet.mango.id}" } ``` When planning it I get `aws_subnet.mango.id is a string, known only after apply` error. I'm new to Terraform. Is there something similar to Cloudformation's `DependsOn` or `Export/Import`?
2021/04/15
[ "https://Stackoverflow.com/questions/67104574", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17450994/" ]
This is a case of [explicit dependency](https://learn.hashicorp.com/tutorials/terraform/dependencies#manage-explicit-dependencies). The argument `depends_on` similar to CloudFormation's `DependsOn` solves such dependencies. Note: *"Since Terraform will wait to create the dependent resource until after the specified resource is created, adding explicit dependencies can increase the length of time it takes for Terraform to create your infrastructure."* Example: ``` depends_on = [aws_subnet.mango] ```
This line: ``` cidr_block = "${var.subnet_cidr}" ``` should look like ``` cidr_block = var.subnet_cidr ``` And this line: ``` subnets = "${aws_subnet.mango.id}" ``` should look like ``` subnets = aws_subnet.mango.id ``` Terraform gives a warning when a string value only has a template in it. The reason is that for cases like yours, it's able to make a graph with the bare value and resolve it on apply, but it's unable to make the string without creating the resource first.
67,104,574
I'm creating an `aws_subnet` and referencing it in another resource. Example: ``` resource "aws_subnet" "mango" { vpc_id = aws_vpc.mango.id cidr_block = "${var.subnet_cidr}" } ``` The reference ``` network_configuration { subnets = "${aws_subnet.mango.id}" } ``` When planning it I get `aws_subnet.mango.id is a string, known only after apply` error. I'm new to Terraform. Is there something similar to Cloudformation's `DependsOn` or `Export/Import`?
2021/04/15
[ "https://Stackoverflow.com/questions/67104574", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17450994/" ]
This is a case of [explicit dependency](https://learn.hashicorp.com/tutorials/terraform/dependencies#manage-explicit-dependencies). The argument `depends_on` similar to CloudFormation's `DependsOn` solves such dependencies. Note: *"Since Terraform will wait to create the dependent resource until after the specified resource is created, adding explicit dependencies can increase the length of time it takes for Terraform to create your infrastructure."* Example: ``` depends_on = [aws_subnet.mango] ```
The error in this case is not the string "known only after apply" but the message "Incorrect attribute value type". `subnets` (plural) requires a *list* of strings but you gave only one string. ``` network_configuration { subnets = ["${aws_subnet.mango.id}"] } ``` The `depends_on` is not necessary in this case, tf resolves this dependency by itself. `depends_on` is only important if tf can't get this by itself. writing `"${foo.bar}"` instead of `foo.bar` is also no problem but doesn't follow tf's code-style-rules.
26,002,958
This HTML / JS code : ``` <script> window.onload = function(e) { window.onkeydown = function(event) { if (event.ctrlKey && (event.keyCode == 61 || event.keyCode == 187)) { event.preventDefault(); alert("hello"); return false; } } } </script> <p>Blah</p> ``` **overrides** the browser CTRL+PLUS 's ZOOM keyboard shortcut. It works on Firefox, Chrome, but not with Safari : with Safari, if you do CTRL+PLUS on this page, the `alert("hello")` is launched, but the browser's zooming is also changed ! This means that `event.preventDefault();` hasn't worked like it should have worked. **How to use `event.preventDefault()` with Safari ?** *Note: I already tried as well with StopPropagation, but it doesn't solve the problem.*
2014/09/23
[ "https://Stackoverflow.com/questions/26002958", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1422096/" ]
Seems like this is problem with `ctrlKey`. Assuming you use Mac OS X system you need to check for `metaKey` too, so your code should be: ``` if ((event.ctrlKey || event.metaKey) && (event.keyCode == 61 || event.keyCode == 187)) ```
We probably have different keyboard layouts or something, but my `+` and `-` signs on my numpad have the key code values 107 and 109. (<http://www.asquare.net/javascript/tests/KeyCode.html>) The code snippet below works in safari for me. ```js window.onkeydown = function (event) { if (event.ctrlKey && (event.keyCode == 107 || event.keyCode == 109)) { event.preventDefault(); alert("hello"); } } ```
26,002,958
This HTML / JS code : ``` <script> window.onload = function(e) { window.onkeydown = function(event) { if (event.ctrlKey && (event.keyCode == 61 || event.keyCode == 187)) { event.preventDefault(); alert("hello"); return false; } } } </script> <p>Blah</p> ``` **overrides** the browser CTRL+PLUS 's ZOOM keyboard shortcut. It works on Firefox, Chrome, but not with Safari : with Safari, if you do CTRL+PLUS on this page, the `alert("hello")` is launched, but the browser's zooming is also changed ! This means that `event.preventDefault();` hasn't worked like it should have worked. **How to use `event.preventDefault()` with Safari ?** *Note: I already tried as well with StopPropagation, but it doesn't solve the problem.*
2014/09/23
[ "https://Stackoverflow.com/questions/26002958", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1422096/" ]
Seems like this is problem with `ctrlKey`. Assuming you use Mac OS X system you need to check for `metaKey` too, so your code should be: ``` if ((event.ctrlKey || event.metaKey) && (event.keyCode == 61 || event.keyCode == 187)) ```
You can try this: ``` window.onkeydown = function(event) { if (event.ctrlKey && (event.keyCode == 61 || event.keyCode == 187)) { if (event.preventDefault){ event.preventDefault(); } else { event.returnValue = false; } alert("hello"); return false; } } } ```
26,002,958
This HTML / JS code : ``` <script> window.onload = function(e) { window.onkeydown = function(event) { if (event.ctrlKey && (event.keyCode == 61 || event.keyCode == 187)) { event.preventDefault(); alert("hello"); return false; } } } </script> <p>Blah</p> ``` **overrides** the browser CTRL+PLUS 's ZOOM keyboard shortcut. It works on Firefox, Chrome, but not with Safari : with Safari, if you do CTRL+PLUS on this page, the `alert("hello")` is launched, but the browser's zooming is also changed ! This means that `event.preventDefault();` hasn't worked like it should have worked. **How to use `event.preventDefault()` with Safari ?** *Note: I already tried as well with StopPropagation, but it doesn't solve the problem.*
2014/09/23
[ "https://Stackoverflow.com/questions/26002958", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1422096/" ]
Seems like this is problem with `ctrlKey`. Assuming you use Mac OS X system you need to check for `metaKey` too, so your code should be: ``` if ((event.ctrlKey || event.metaKey) && (event.keyCode == 61 || event.keyCode == 187)) ```
The key codes for zoom are different across browsers: ``` Opera MSIE Firefox Safari Chrome 61 187 107 187 187 = + 109 189 109 189 189 - _ ``` Also try : ``` event.stopImmediatePropagation(); ``` To prevent other handlers from executing.
26,002,958
This HTML / JS code : ``` <script> window.onload = function(e) { window.onkeydown = function(event) { if (event.ctrlKey && (event.keyCode == 61 || event.keyCode == 187)) { event.preventDefault(); alert("hello"); return false; } } } </script> <p>Blah</p> ``` **overrides** the browser CTRL+PLUS 's ZOOM keyboard shortcut. It works on Firefox, Chrome, but not with Safari : with Safari, if you do CTRL+PLUS on this page, the `alert("hello")` is launched, but the browser's zooming is also changed ! This means that `event.preventDefault();` hasn't worked like it should have worked. **How to use `event.preventDefault()` with Safari ?** *Note: I already tried as well with StopPropagation, but it doesn't solve the problem.*
2014/09/23
[ "https://Stackoverflow.com/questions/26002958", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1422096/" ]
We probably have different keyboard layouts or something, but my `+` and `-` signs on my numpad have the key code values 107 and 109. (<http://www.asquare.net/javascript/tests/KeyCode.html>) The code snippet below works in safari for me. ```js window.onkeydown = function (event) { if (event.ctrlKey && (event.keyCode == 107 || event.keyCode == 109)) { event.preventDefault(); alert("hello"); } } ```
You can try this: ``` window.onkeydown = function(event) { if (event.ctrlKey && (event.keyCode == 61 || event.keyCode == 187)) { if (event.preventDefault){ event.preventDefault(); } else { event.returnValue = false; } alert("hello"); return false; } } } ```
26,002,958
This HTML / JS code : ``` <script> window.onload = function(e) { window.onkeydown = function(event) { if (event.ctrlKey && (event.keyCode == 61 || event.keyCode == 187)) { event.preventDefault(); alert("hello"); return false; } } } </script> <p>Blah</p> ``` **overrides** the browser CTRL+PLUS 's ZOOM keyboard shortcut. It works on Firefox, Chrome, but not with Safari : with Safari, if you do CTRL+PLUS on this page, the `alert("hello")` is launched, but the browser's zooming is also changed ! This means that `event.preventDefault();` hasn't worked like it should have worked. **How to use `event.preventDefault()` with Safari ?** *Note: I already tried as well with StopPropagation, but it doesn't solve the problem.*
2014/09/23
[ "https://Stackoverflow.com/questions/26002958", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1422096/" ]
We probably have different keyboard layouts or something, but my `+` and `-` signs on my numpad have the key code values 107 and 109. (<http://www.asquare.net/javascript/tests/KeyCode.html>) The code snippet below works in safari for me. ```js window.onkeydown = function (event) { if (event.ctrlKey && (event.keyCode == 107 || event.keyCode == 109)) { event.preventDefault(); alert("hello"); } } ```
The key codes for zoom are different across browsers: ``` Opera MSIE Firefox Safari Chrome 61 187 107 187 187 = + 109 189 109 189 189 - _ ``` Also try : ``` event.stopImmediatePropagation(); ``` To prevent other handlers from executing.
845,426
`/etc/hosts` lets you set system-wide hostname lookups. Is there a place in OS X to set per-user hostnames? I use two user accounts on my laptop and I'd like to override IP addresses for just one of those accounts. Is that possible?
2014/11/26
[ "https://superuser.com/questions/845426", "https://superuser.com", "https://superuser.com/users/39309/" ]
No, DNS is global. You don't mention any details. You could redefine: thissite.com 0.0.0.0 mythissite.com 122.122.122.122 <-- with the IP address of the real site. Then only people who know that thissite.com is broken and to use mythissinte.com instead would be able to access thissite.com
There is no such thing in any operating system, but you can swap `/etc/hosts` file by some script when user is logging in. I don't know much about OS X, you may have to restart one or more network services after that file swap. You also might want to change permissions or owner on `/etc/hosts` file, if your script will be running from non-administrator account.
45,794,275
In my application I am using authentication with Google account. When the user logs in for the first time list of google accounts used on the device is displayed and user can log in by picking one of available accounts. But when the user logs out and then try to log in again the list is no longer displayed and he is automatically logged with previously picked account. How can I prevent my app from remembering that account and force it to display account list on every log in try?
2017/08/21
[ "https://Stackoverflow.com/questions/45794275", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8404031/" ]
Try this : ``` htmlCanvas.onclick= function(evt) { img.src = images[count]; img.width = 80/100* htmlCanvas.width; img.height = 80/100* htmlCanvas.height; var x = evt.offsetX - img.width/2, y = evt.offsetY - img.height/2; // context.drawImage(img, x, y); context.drawImage(img, x, y, img.width, img.height); count++; if (count == images.length) { count = 0; } } ```
``` context.drawImage(img, 0, 0,img.width,img.height,0,0,htmlCanvas.width,htmlCanvas.height); ``` you also can use `background-size:cover;`
45,794,275
In my application I am using authentication with Google account. When the user logs in for the first time list of google accounts used on the device is displayed and user can log in by picking one of available accounts. But when the user logs out and then try to log in again the list is no longer displayed and he is automatically logged with previously picked account. How can I prevent my app from remembering that account and force it to display account list on every log in try?
2017/08/21
[ "https://Stackoverflow.com/questions/45794275", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8404031/" ]
Try this : ``` htmlCanvas.onclick= function(evt) { img.src = images[count]; img.width = 80/100* htmlCanvas.width; img.height = 80/100* htmlCanvas.height; var x = evt.offsetX - img.width/2, y = evt.offsetY - img.height/2; // context.drawImage(img, x, y); context.drawImage(img, x, y, img.width, img.height); count++; if (count == images.length) { count = 0; } } ```
The max-height/width doesn't work because everything within the canvas is independent from your css. If you want to set the image to 80% use `htmlCanvas.width` and `htmlCanvas.height` to calculate the new size and use `context.drawImage(img, x, y, w, h)` to set the image size when drawing. Maybe [this post](https://stackoverflow.com/questions/21961839/simulation-background-size-cover-in-canvas/21961894#21961894) could be helpful.
3,591,833
> > Let $F(x)=x^{3}+2 x-2,$ let $\alpha \in \mathbb{C}$ be a root of $F,$ and let $K=\mathbb{Q}(\alpha)$ > > > Find $a, b, c \in \mathbb{Q}$ such that $\alpha^{4}=a \alpha^{2}+b \alpha+c$ > > > We have that [$K:\mathbb{Q}]=3$. I know that such a thing is possible, but do not know in what manner to proceed. Please leave a hint only as this is a homework assignment.
2020/03/23
[ "https://math.stackexchange.com/questions/3591833", "https://math.stackexchange.com", "https://math.stackexchange.com/users/716605/" ]
$\alpha$ is a root of $F$, so $\alpha^3 + 2\alpha - 2 = ?$ And you should be able to solve that for $\alpha^4$ (by multiplying by one thing, then moving all non-$\alpha^4$ terms to the right-hand side).
Since $\alpha$ is a root of $f(x) = x^3 + 2x - 2, \tag 1$ we have $\alpha^3 + 2\alpha - 2 = 0, \tag 2$ or $\alpha^3 = -2\alpha + 2; \tag 3$ thus, $\alpha^4 = -2\alpha^2 + 2\alpha; \tag 4$ therefore, $a = -2, \tag 5$ $b = 2, \tag 6$ and $c = 0. \tag 7$ In order to show uniqueness, suppose there are $q, r, s \in \Bbb Q \tag 8$ with $\alpha^4 = q\alpha^2 + r\alpha + s; \tag 9$ we subract (4) from (9): $0 = (q + 2)\alpha^2 + (r - 2)\alpha + s; \tag{10}$ thus $\alpha$ must satisfy the polynomial $g(x) = (q + 2)x^2 + (r - 2)x + s \in \Bbb Q[x]; \tag{11}$ we observe that $f(x)$ is irreducible over $\Bbb Q$ *via* [the Eisenstein criterion](https://en.wikipedia.org/wiki/Eisenstein%27s_criterion) with prime $p = 2$; therefore it is minimal for $\alpha$ over $\Bbb Q$; but this contradicts $g(\alpha) = 0 \tag{12}$ unless $g(x) = 0; \tag{13}$ therefore (13) binds and thus $q = -2 = a, \tag{14}$ $r = 2 = b, \tag{15}$ and $s = c = 0, \tag{16}$ and we conclude the expression (4) for $\alpha^4$ is unique.
42,950,167
For me it is not clear what the difference is between a WebSphere Message Broker and the WebSphere MQ . According to wikipedia the message broker translates and routes the message. Which would lead me to believe the WebSphere MQ is the queue, but it is not clear from all of the marketing information what the core task of the WebSphere MQ is. Wikipedia says MQ is composed of messages, queues, and queue managers. Does that mean WebSphere Message Broker is a component of MQ?
2017/03/22
[ "https://Stackoverflow.com/questions/42950167", "https://Stackoverflow.com", "https://Stackoverflow.com/users/273096/" ]
WebSphere Message Broker is not a component of WebSphere MQ Series (moreover, starting from v10 of Message Broker you don't need to have WebSphere MQ installed at all on your system in order to run message broker). Think about WebSphere MQ as of a transport layer - you can send a message and receive it on another end (and all other particularities like persistence, fail-over, JMS, etc.) Think about WebSphere Message Broker as of a set of transformations you can apply on your message (which **may** be transported via WebSphere MQ layer)
If an analogy helps, MQ is like an HTTP client and HTTP server, whereas MB/IIB is more of a gateway (proxy). Usually they emphasize **disparate systems** and **transformations** in the MB/IIB context.
42,950,167
For me it is not clear what the difference is between a WebSphere Message Broker and the WebSphere MQ . According to wikipedia the message broker translates and routes the message. Which would lead me to believe the WebSphere MQ is the queue, but it is not clear from all of the marketing information what the core task of the WebSphere MQ is. Wikipedia says MQ is composed of messages, queues, and queue managers. Does that mean WebSphere Message Broker is a component of MQ?
2017/03/22
[ "https://Stackoverflow.com/questions/42950167", "https://Stackoverflow.com", "https://Stackoverflow.com/users/273096/" ]
If an analogy helps, MQ is like an HTTP client and HTTP server, whereas MB/IIB is more of a gateway (proxy). Usually they emphasize **disparate systems** and **transformations** in the MB/IIB context.
WebSpher MQ is an implementation of JSM plus a bit more, Message Broker or IIB as its called now is an ESB, It enables communication between separate system by transforming message from one definition to another. MQ is one of the many transport channels that WMB can use to send and receive messages.
42,950,167
For me it is not clear what the difference is between a WebSphere Message Broker and the WebSphere MQ . According to wikipedia the message broker translates and routes the message. Which would lead me to believe the WebSphere MQ is the queue, but it is not clear from all of the marketing information what the core task of the WebSphere MQ is. Wikipedia says MQ is composed of messages, queues, and queue managers. Does that mean WebSphere Message Broker is a component of MQ?
2017/03/22
[ "https://Stackoverflow.com/questions/42950167", "https://Stackoverflow.com", "https://Stackoverflow.com/users/273096/" ]
WebSphere Message Broker is not a component of WebSphere MQ Series (moreover, starting from v10 of Message Broker you don't need to have WebSphere MQ installed at all on your system in order to run message broker). Think about WebSphere MQ as of a transport layer - you can send a message and receive it on another end (and all other particularities like persistence, fail-over, JMS, etc.) Think about WebSphere Message Broker as of a set of transformations you can apply on your message (which **may** be transported via WebSphere MQ layer)
WebSpher MQ is an implementation of JSM plus a bit more, Message Broker or IIB as its called now is an ESB, It enables communication between separate system by transforming message from one definition to another. MQ is one of the many transport channels that WMB can use to send and receive messages.
2,341,335
**Preamble** I know from linear algebra that any vector in a vector space can be written as a linear combination of basis vectors. However, in physics, unit vectors are used as basis vectors, which brings me to my question. **Note**: I do not have the math tools to formally prove any of this... I just need an explanation **The question** Which is correct (and why): * Are all unit vectors basis vectors? * Are all basis vector unit vectors? * Are unit vectors a subset of basis vectors? * Are basis vectors a subset of unit vectors? In a nutshell if the set of all basis vectors was **b** and the set of all unit vectors was **u**, what is the relation between the two sets? (i.e. b \_\_\_ u)
2017/06/29
[ "https://math.stackexchange.com/questions/2341335", "https://math.stackexchange.com", "https://math.stackexchange.com/users/458997/" ]
The term *unit vector* is well-defined: a vector of length one. The term *basis vector* is taken out of context, and doesn't make sense on its own. A *basis* of a vector space $V$ is a set of vectors $\left\{v\_1,\dots, v\_n\right\}$ such each vector $v\in V$ can be written uniquely as a linear combination of $v\_1,\dots, v\_n$. So if you read “basis vector”, it means “member of the aforementioned basis,” and which basis is being referenced comes from the context. * **Are all unit vectors basis vectors?** No. The vector $e\_1 = (1,0,0)$ in $\mathbb{R}^3$ is a unit vector. But on its own it's not a “basis vector.” There is a basis of $\mathbb{R}^3$ which contains $e\_1$—for instance $\left\{e\_1, e\_2, e\_3\right\}$. In general, for any unit vector $v$ we can find a basis of $V$ that has $v$ as a member. * **Are all basis vectors unit vectors?** The best way to interpret this question is: *Does every basis consist of unit vectors?* The answer is no. For instance $\left\{e\_1, e\_2, e\_1+e\_3\right\}$ is a basis of $\mathbb{R}^3$ too, and not all of its elements are unit vectors. * **Are unit vectors a subset of basis vectors?** No. However, there is an additional property of vectors that's related. Vectors $v$ and $w$ are *orthogonal* if their inner (dot) product $v\cdot w= 0$. A set of vectors is *orthonormal* if every single vector in the set is a unit vector, and any pair of vectors in the set are orthogonal. An orthonormal set of $n$ vectors in an $n$-dimensional vector space is automatically a basis. * **Are basis vectors a subset of unit vectors**? No. However, if you start with a basis $v\_1, \dots, v\_n$, there exists an orthonormal basis $u\_1, \dots, u\_n$ such that for each $k$ between $1$ and $n$, the span of $u\_1, \dots, u\_k$ is the same as the span of $v\_1, \dots, v\_k$. The algorithm which constructs $u\_1, \dots, u\_n$ is called the *Gram-Schmidt process.* Because of this property, the physicists might assume that any given basis is orthonormal. I hope that clarifies some of these terms. **Edit** You asked for some more explanation on the third point. The standard basis $\hat{\mathbf x}, \hat{\mathbf y}, \hat{\mathbf z}$ (using your notation) of $\mathbb{R}^n$ is orthonormal. Put your hand in the right-hand-rule position with these three vectors, and rotate your hand. The vectors change, but not the property that each of them is unit length, and that each pair are perpendicular/orthogonal. Now let $\mathbf{v}$ be any vector. If $\mathbf{v}$ can be written as a linear combination $a \hat{\mathbf x} + b \hat{\mathbf y} + c \hat{\mathbf z}$, then what are $a$, $b$, and $c$? Use the orthonormality property: \begin{align\*} \mathbf{v}\cdot\hat{\mathbf x} &= (a \hat{\mathbf x} + b \hat{\mathbf y} + c \hat{\mathbf z})\hat{\mathbf x}\\ &= a \hat{\mathbf x}\cdot \hat{\mathbf x} + b \hat{\mathbf y}\cdot \hat{\mathbf x} + c \hat{\mathbf z}\cdot \hat{\mathbf x} \\ &= a (1) + b(0) + c(0) = a \end{align\*} [Since $\hat{\mathbf x}$ is a unit vector, $\hat{\mathbf x}\cdot\hat{\mathbf x} = \left\Vert\hat{\mathbf x}\right\Vert^2 = 1$.] You can do the same for $\hat{\mathbf y}$ and $\hat{\mathbf z$}$. Therefore the coefficients of $\mathbf{v}$ can be recovered by the dot products: $$ \mathbf{v} = (\mathbf{v}\cdot\hat{\mathbf x})\hat{\mathbf x} + (\mathbf{v}\cdot\hat{\mathbf y})\hat{\mathbf x} + (\mathbf{v}\cdot\hat{\mathbf z})\hat{\mathbf x} $$
Being a "basis vector" is not a property of vectors on their own, so your questions have no clear answer. Take, for instance, the real plane. One basis here would be $\{(1,0),(1,1)\}$. So in this case, those two would be basis vectors. On the other hand, if you take $\{(2,2),(1,1)\}$, then this set of vectors forms no basis, and thus there's no reason to call either a "basis vector". In general, a basis is something that you can chose for any given vector space - any set of vectors that is both linearly independant (no linear combination of them except with all zero coefficients adds to 0) and spans the vector space (any vector can be expressed as linear combination).
32,046,116
I have sql Upgrade script which has many sql statements(DDL,DML). When i ran this upgrade script in SQL developer, it runs successufully.I also provide in my script at the bottom commit. I can see all the changes in the database after running this upgrade script except the unique index constraints. When i insert few duplicate records it says unique constraint violated. It means the table has unique constraints. But i dont know why i cant view this constraints in oracle sql developer. The other DDL changes made i can view.I dont know is there any settings to view it in oracle sql developer. ``` CREATE UNIQUE INDEX "RATOR_MONITORING"."CAPTURING_UK1" ON "RATOR_MONITORING"."CAPTURING" ("DB_TABLE"); CREATE UNIQUE INDEX "RATOR_MONITORING_CONFIGURATION"."BRAND_UK1" ON "RATOR_MONITORING_CONFIGURATION"."BRAND" ("NAME"); CREATE UNIQUE INDEX "RATOR_MONITORING_CONFIGURATION"."BRAND_BUSINESS_PROCESS_UK1" ON "RATOR_MONITORING_CONFIGURATION"."BRAND_BUSINESS_PROCESS" ("BRAND_ID", "BP_ID"); CREATE UNIQUE INDEX "RATOR_MONITORING_CONFIGURATION"."BRAND_ENGINE_UK1" ON "RATOR_MONITORING_CONFIGURATION"."BRAND_ENGINE" ("BRAND_ID", "ENGINE_ID"); ```
2015/08/17
[ "https://Stackoverflow.com/questions/32046116", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4508605/" ]
As A Hocevar noted, if you create an index ``` create unique index test_ux on test(id); ``` you see it in the Indexes tab of the table properties (not in the Constraints tab). Please note that COMMIT is not required here, it is done implicitely in each DDL statement. More usual source of problems are stale metadata in SQL Developer, i.e. missing REFRESH (ctrl R on user or table node). If you want to define the constraint, **add** following statement, that will reuse the index defined previously ``` alter table test add constraint test_unique unique(id) using index test_ux; ``` See further discussion about the option in [Documentation](http://docs.oracle.com/cd/B28359_01/server.111/b28286/clauses002.htm#SQLRF52179)
I am assuming you are trying to look for index on a table in the correct tab in sql developer. If you are not able to see the index there, one reason could be that your user (the one with which you are logged in) doesn't have proper rights to see the Index.
32,046,116
I have sql Upgrade script which has many sql statements(DDL,DML). When i ran this upgrade script in SQL developer, it runs successufully.I also provide in my script at the bottom commit. I can see all the changes in the database after running this upgrade script except the unique index constraints. When i insert few duplicate records it says unique constraint violated. It means the table has unique constraints. But i dont know why i cant view this constraints in oracle sql developer. The other DDL changes made i can view.I dont know is there any settings to view it in oracle sql developer. ``` CREATE UNIQUE INDEX "RATOR_MONITORING"."CAPTURING_UK1" ON "RATOR_MONITORING"."CAPTURING" ("DB_TABLE"); CREATE UNIQUE INDEX "RATOR_MONITORING_CONFIGURATION"."BRAND_UK1" ON "RATOR_MONITORING_CONFIGURATION"."BRAND" ("NAME"); CREATE UNIQUE INDEX "RATOR_MONITORING_CONFIGURATION"."BRAND_BUSINESS_PROCESS_UK1" ON "RATOR_MONITORING_CONFIGURATION"."BRAND_BUSINESS_PROCESS" ("BRAND_ID", "BP_ID"); CREATE UNIQUE INDEX "RATOR_MONITORING_CONFIGURATION"."BRAND_ENGINE_UK1" ON "RATOR_MONITORING_CONFIGURATION"."BRAND_ENGINE" ("BRAND_ID", "ENGINE_ID"); ```
2015/08/17
[ "https://Stackoverflow.com/questions/32046116", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4508605/" ]
As A Hocevar noted, if you create an index ``` create unique index test_ux on test(id); ``` you see it in the Indexes tab of the table properties (not in the Constraints tab). Please note that COMMIT is not required here, it is done implicitely in each DDL statement. More usual source of problems are stale metadata in SQL Developer, i.e. missing REFRESH (ctrl R on user or table node). If you want to define the constraint, **add** following statement, that will reuse the index defined previously ``` alter table test add constraint test_unique unique(id) using index test_ux; ``` See further discussion about the option in [Documentation](http://docs.oracle.com/cd/B28359_01/server.111/b28286/clauses002.htm#SQLRF52179)
If you not obtain any error, the solution is very simple and tedious. SQL Developer doesn't refresh his fetched structures. Kindly push Refresh blue icon (or use Ctrl-R) in Connections view or disconnect and connect again (or restart SQL Developer) to see your changes in structures.
14,156,007
I was evaluating the outlook redemption for conversion of .eml to .msg file and subsequently purchase of the software. what I found was it uses current user login to connect to outlook and convert a .eml file to .msg. but I would like to know is that if we deploy this on the server we would use a service account for the conversion. now the question is whether this service account that is used to perform the .eml to .msg conversion is required to have valid email id on the exchange server.
2013/01/04
[ "https://Stackoverflow.com/questions/14156007", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1948304/" ]
You can use LogonExchangeMailbox(User, ServerName) or LogonPstStore(Path, Format, DisplayName, Password, Encryption) <http://www.dimastr.com/redemption/rdo/rdosession.htm>
Keep in mind you do not need to log in to convert an EML file to MSG: call RDOSession.CreateMessageFroMMsgFIle (returns RDOMail object), call RDOMail.IMport(..., olRfc822) to import the EML file, then RDOMail.Save.
18,138,150
I'm trying to make an `HTTPGET` request to a REST server, the URL i need to send contains many parameters: This is the URI : `http://darate.free.fr/rest/api.php?rquest=addUser&&login=samuel&&password=0757bed3d74ccc8fc8e67a13983fc95dca209407&&firstname=samuel&&lastname=barbier` I need to get the Login,password,first, name and last name that the user types, then produce an URI like the once above. Is there any easy way to create the URI, without concatenate the first part of the URI `http://darate.free.fr/rest/api.php?rquest=addUser` with every `&&parameter:value`
2013/08/08
[ "https://Stackoverflow.com/questions/18138150", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2302854/" ]
I prefer to use [`Uri.Builder`](http://developer.android.com/reference/android/net/Uri.Builder.html) for building `Uri`s. It makes sure everything is escaped properly. My typical code: ``` Uri.Builder builder = Uri.parse(BASE_URI).buildUpon(); builder.appendPath(REQUEST_PATH); builder.builder.appendQueryParameter("param1", value); Uri builtUri = builder.build(); ```
I hope you can use webview.posturl shown below ``` webview.postUrl("http://5.39.186.164/SEBC.php?user="+username)); ``` It also worked fine for me to get the username from the database. I hope it will help you.
11,248,235
I am reading Code Complete. In that book, Steve McConnell warns that "Developer tests tend to be 'clean tests.' Developers tend to test for whether the code works (clean test) rather than test for all the ways the code breaks (dirty tests)." How do I write a test for the way the code breaks? I mean, I can write tests for bad input and make sure that it is blocked correctly. But aside from that, what sorts of things should I be thinking about? What does McConnell mean here? I am comfortable with basic unit testing but trying to master it.
2012/06/28
[ "https://Stackoverflow.com/questions/11248235", "https://Stackoverflow.com", "https://Stackoverflow.com/users/821742/" ]
I think you are on the right path here. Tests to prove that the code works would call a method with sensible, meaningful and expected inputs, with the program in normal state. While tests to break the code try to think "out of the box" regarding that piece of code, thus use any sort of senseless or unexpected input. What is IMHO important though is to understand that the two thought processes are very different. When a developer writes code in TDD fashion, (s)he tends to focus on the various bits of functionality to implement in the code, and the tests to prove that this and that bit of functionality or use case works as specified. Tests created this way are what McConnell calls "clean tests". Thinking about how a piece of code could be broken requires a very different thought process and different experience too. It requires looking at your methods and APIs from a different angle, e.g. temporarily putting aside what you know about the *aim* of these methods and parameters, and focusing only what is *technically possible* to do with them. Also to think about all the - often implied - preconditions or dependencies required for this method to work correctly. Does it depend on a configuration parameter read from DB? Does it write to the file system? Does it call another component, expecting it to having been initialized properly beforehand? Does it use large amounts of memory? Does it display a message on a GUI?... And what if one or more of these doesn't hold? All this leads to important questions: **how should your method handle such dirty cases?** Should it crash? Throw an exception? Continue as best as it can? Return an error code? Log an error report?... All these little or bigger decisions are actually quite important for defining the contract of a method or an API correctly and consistently. Kent Beck talks about switching between wearing "developer hat" and "tester hat" in the same sense. Fluently switching viewpoints and thought processes this way requires practice and experience.
What author most likely meant by *clean test* is test that verifies only [*happy path*](http://en.wikipedia.org/wiki/Happy_path) of method execution. Testing happy path is usually easiest and people might tend to think that since *it works*, their job with writing tests is done. This rarely is the case. Consider: ``` public void SaveLog(string entry) { var outputFile = this.outputFileProvider.GetLogFile(); var isValid = this.logValidator.IsValid(outputFile); if (isValid) { this.logWriter.Write(outputFile, entry); } } ``` Happy path testing would be simply assuming all the dependencies (`outputFileProvider`, `logValidator`, `logWriter`) worked and write is indeed taking place. However, there's high chance something *might break* along the way, and those *paths* should be tested too. Like: * `outputFileProvider` fails to acquire output file * `outputFile` turns out to be invalid * `logValidator` fails with its own exception * `logWriter` fails to write Just to name a few! There's lot more to unit testing than simply checking happy path, but unfortunately this is often the case.
11,248,235
I am reading Code Complete. In that book, Steve McConnell warns that "Developer tests tend to be 'clean tests.' Developers tend to test for whether the code works (clean test) rather than test for all the ways the code breaks (dirty tests)." How do I write a test for the way the code breaks? I mean, I can write tests for bad input and make sure that it is blocked correctly. But aside from that, what sorts of things should I be thinking about? What does McConnell mean here? I am comfortable with basic unit testing but trying to master it.
2012/06/28
[ "https://Stackoverflow.com/questions/11248235", "https://Stackoverflow.com", "https://Stackoverflow.com/users/821742/" ]
I think you are on the right path here. Tests to prove that the code works would call a method with sensible, meaningful and expected inputs, with the program in normal state. While tests to break the code try to think "out of the box" regarding that piece of code, thus use any sort of senseless or unexpected input. What is IMHO important though is to understand that the two thought processes are very different. When a developer writes code in TDD fashion, (s)he tends to focus on the various bits of functionality to implement in the code, and the tests to prove that this and that bit of functionality or use case works as specified. Tests created this way are what McConnell calls "clean tests". Thinking about how a piece of code could be broken requires a very different thought process and different experience too. It requires looking at your methods and APIs from a different angle, e.g. temporarily putting aside what you know about the *aim* of these methods and parameters, and focusing only what is *technically possible* to do with them. Also to think about all the - often implied - preconditions or dependencies required for this method to work correctly. Does it depend on a configuration parameter read from DB? Does it write to the file system? Does it call another component, expecting it to having been initialized properly beforehand? Does it use large amounts of memory? Does it display a message on a GUI?... And what if one or more of these doesn't hold? All this leads to important questions: **how should your method handle such dirty cases?** Should it crash? Throw an exception? Continue as best as it can? Return an error code? Log an error report?... All these little or bigger decisions are actually quite important for defining the contract of a method or an API correctly and consistently. Kent Beck talks about switching between wearing "developer hat" and "tester hat" in the same sense. Fluently switching viewpoints and thought processes this way requires practice and experience.
Elisabeth Hendrickson, of [Test Obsessed](http://testobsessed.com/blog/2007/02/19/test-heuristics-cheat-sheet/), has a [Test Heuristics Cheat Sheet](http://testobsessed.com/wp-content/uploads/2011/04/testheuristicscheatsheetv1.pdf) in which she lists *all sorts* of testing approaches. The document is broadly about testing, but the section called "Data Type Attacks" has lots of specific examples that "unhappy path" unit tests could look at. For example, here are her ideas about ways to test paths and files: > > Long Name (>255 chars) > > Special Characters in Name (space \* ? / \ | < > , . ( ) [ ] { } ; : ‘ “ ! > @ # $ % ^ &) > Non-Existent > Already Exists > No Space > Minimal Space > Write-Protected > Unavailable > Locked > On Remote Machine > Corrupted > > >
15,206,166
I am using storyboards. I have used auto layout but its not working with ios5 and give crashes so I want to remove it. However, How can I uncheck the auto layout. But if I uncheck auto layout, How can i set my screens for both iPhone 4 and 5 Regards
2013/03/04
[ "https://Stackoverflow.com/questions/15206166", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1921872/" ]
You can disable autolayout in IB but set the constraints programatically in the view controller, based on whether the iOS version on the device supports it or not by, for example, checking if the NSLayoutConstraint class can be found: ``` if (NSClassFromString(@"NSLayoutConstraint")) { //create constraints } ``` More info on creating the actual constraints can be found here: <http://www.techotopia.com/index.php/Implementing_iOS_6_Auto_Layout_Constraints_in_Code>
You can uncheck auto layout from the Storyboard Utilities tab. If you aren't using auto layout you can use strings and structs or make adjustments programatically. ![enter image description here](https://i.stack.imgur.com/wFxGJ.jpg)
15,206,166
I am using storyboards. I have used auto layout but its not working with ios5 and give crashes so I want to remove it. However, How can I uncheck the auto layout. But if I uncheck auto layout, How can i set my screens for both iPhone 4 and 5 Regards
2013/03/04
[ "https://Stackoverflow.com/questions/15206166", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1921872/" ]
You can uncheck auto layout from the Storyboard Utilities tab. If you aren't using auto layout you can use strings and structs or make adjustments programatically. ![enter image description here](https://i.stack.imgur.com/wFxGJ.jpg)
For the use the Auto Layout use the springs in the story board for each view depending on how you want to resize them! Naturally you will need ``` view.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleWidth ``` In the StoryBoard when you set a string or strut that means you are fixing that distance eg: if you select the bottom spring the distance of the view from the bottom is fixed which is same as the above UIViewAutoresizingFlexibleTopMargin.
15,206,166
I am using storyboards. I have used auto layout but its not working with ios5 and give crashes so I want to remove it. However, How can I uncheck the auto layout. But if I uncheck auto layout, How can i set my screens for both iPhone 4 and 5 Regards
2013/03/04
[ "https://Stackoverflow.com/questions/15206166", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1921872/" ]
You can disable autolayout in IB but set the constraints programatically in the view controller, based on whether the iOS version on the device supports it or not by, for example, checking if the NSLayoutConstraint class can be found: ``` if (NSClassFromString(@"NSLayoutConstraint")) { //create constraints } ``` More info on creating the actual constraints can be found here: <http://www.techotopia.com/index.php/Implementing_iOS_6_Auto_Layout_Constraints_in_Code>
For the use the Auto Layout use the springs in the story board for each view depending on how you want to resize them! Naturally you will need ``` view.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleWidth ``` In the StoryBoard when you set a string or strut that means you are fixing that distance eg: if you select the bottom spring the distance of the view from the bottom is fixed which is same as the above UIViewAutoresizingFlexibleTopMargin.
7,035,049
How can I join these 2 queries together. ``` SELECT * FROM tbl_person WHERE tbl_person.status_id = '+ status_dg.selectedItem.status_id +'; SELECT * FROM tbl_settings WHERE tbl_settings.status_id = '+ status_dg.selectedItem.status_id +'; ``` I tried this but doesn't seem to work. ``` SELECT * FROM tbl_person, tbl_settings WHERE tbl_person.status_id = '+ status_dg.selectedItem.status_id +' OR tbl_settings.status_id = '+ status_dg.selectedItem.status_id +'; ``` Here's a bit more information about what I'm trying to do. In both tables (tbl\_person, tbl\_settings) status\_id is a foreign key. In my application a user has the ability to create and delete statuses. So this query I'm trying to write is for when a status is being deleted. Before the status is deleted I need to check both tbl\_person and tbl\_settings to see if the status being deleted exists in either table. If either of the tables have a match to the status being deleted I need to promote the user. Hope this helps.
2011/08/12
[ "https://Stackoverflow.com/questions/7035049", "https://Stackoverflow.com", "https://Stackoverflow.com/users/258594/" ]
Do not know what you need probably union? ``` SELECT * FROM tbl_person WHERE tbl_person.status_id = '+ status_dg.selectedItem.status_id +' union SELECT * FROM tbl_status WHERE tbl_status.status_id = '+ status_dg.selectedItem.status_id +' ``` 1.You should AVOID using "\*" to select all records. You should specify set of columns you want to retrieve. 2. This line: `WHERE tbl_person.status_id = '+ status_dg.selectedItem.status_id +'` looks like you're doing something totally wrong. You should avoid putting business logic in SQL and yes, provide more info
Without more information on your table schema, try: ``` SELECT * FROM tbl_person, tbl_settings WHERE tbl_person.status_id = tbl_settings.status_id AND tbl_person.status_id = '+status_dg.selectedItem.status_id+' ``` This will join the 2 tables, `tbl_person` and `tbl_status`, on `status_id`, and only retrieve rows where `status_id = '+status_dg.selectedItem.status_id+'`.
7,035,049
How can I join these 2 queries together. ``` SELECT * FROM tbl_person WHERE tbl_person.status_id = '+ status_dg.selectedItem.status_id +'; SELECT * FROM tbl_settings WHERE tbl_settings.status_id = '+ status_dg.selectedItem.status_id +'; ``` I tried this but doesn't seem to work. ``` SELECT * FROM tbl_person, tbl_settings WHERE tbl_person.status_id = '+ status_dg.selectedItem.status_id +' OR tbl_settings.status_id = '+ status_dg.selectedItem.status_id +'; ``` Here's a bit more information about what I'm trying to do. In both tables (tbl\_person, tbl\_settings) status\_id is a foreign key. In my application a user has the ability to create and delete statuses. So this query I'm trying to write is for when a status is being deleted. Before the status is deleted I need to check both tbl\_person and tbl\_settings to see if the status being deleted exists in either table. If either of the tables have a match to the status being deleted I need to promote the user. Hope this helps.
2011/08/12
[ "https://Stackoverflow.com/questions/7035049", "https://Stackoverflow.com", "https://Stackoverflow.com/users/258594/" ]
I am a little confused with your question because you used tbl\_person and tbl\_status firstly, then you tried to test by joining tbl\_person and tbl\_settings. Which two tables do you want to join? If you want to join tbl\_person and tbl\_settings, how about this. ``` SELECT * FROM tbl_person JOIN tbl_setting ON tbl_person.status_id = tbl_settings.status_id WHERE tbl_person.status_id = '+status_dg.selectedItem.status_id+' ```
Without more information on your table schema, try: ``` SELECT * FROM tbl_person, tbl_settings WHERE tbl_person.status_id = tbl_settings.status_id AND tbl_person.status_id = '+status_dg.selectedItem.status_id+' ``` This will join the 2 tables, `tbl_person` and `tbl_status`, on `status_id`, and only retrieve rows where `status_id = '+status_dg.selectedItem.status_id+'`.
7,035,049
How can I join these 2 queries together. ``` SELECT * FROM tbl_person WHERE tbl_person.status_id = '+ status_dg.selectedItem.status_id +'; SELECT * FROM tbl_settings WHERE tbl_settings.status_id = '+ status_dg.selectedItem.status_id +'; ``` I tried this but doesn't seem to work. ``` SELECT * FROM tbl_person, tbl_settings WHERE tbl_person.status_id = '+ status_dg.selectedItem.status_id +' OR tbl_settings.status_id = '+ status_dg.selectedItem.status_id +'; ``` Here's a bit more information about what I'm trying to do. In both tables (tbl\_person, tbl\_settings) status\_id is a foreign key. In my application a user has the ability to create and delete statuses. So this query I'm trying to write is for when a status is being deleted. Before the status is deleted I need to check both tbl\_person and tbl\_settings to see if the status being deleted exists in either table. If either of the tables have a match to the status being deleted I need to promote the user. Hope this helps.
2011/08/12
[ "https://Stackoverflow.com/questions/7035049", "https://Stackoverflow.com", "https://Stackoverflow.com/users/258594/" ]
Do not know what you need probably union? ``` SELECT * FROM tbl_person WHERE tbl_person.status_id = '+ status_dg.selectedItem.status_id +' union SELECT * FROM tbl_status WHERE tbl_status.status_id = '+ status_dg.selectedItem.status_id +' ``` 1.You should AVOID using "\*" to select all records. You should specify set of columns you want to retrieve. 2. This line: `WHERE tbl_person.status_id = '+ status_dg.selectedItem.status_id +'` looks like you're doing something totally wrong. You should avoid putting business logic in SQL and yes, provide more info
To join the tables, you need to define the joining fields, which in your case seems to be the status\_id fields. This might not work correctly, but if you look at the last line you'll need that in your query: ``` SELECT * FROM tbl_person, tbl_settings WHERE ( tbl_person.status_id='+status_dg.selectedItem.status_id+' OR tbl_settings.status_id='+status_dg.selectedItem.status_id+' ) AND tbl_person.status_id = tbl_settings.status_id; ```
7,035,049
How can I join these 2 queries together. ``` SELECT * FROM tbl_person WHERE tbl_person.status_id = '+ status_dg.selectedItem.status_id +'; SELECT * FROM tbl_settings WHERE tbl_settings.status_id = '+ status_dg.selectedItem.status_id +'; ``` I tried this but doesn't seem to work. ``` SELECT * FROM tbl_person, tbl_settings WHERE tbl_person.status_id = '+ status_dg.selectedItem.status_id +' OR tbl_settings.status_id = '+ status_dg.selectedItem.status_id +'; ``` Here's a bit more information about what I'm trying to do. In both tables (tbl\_person, tbl\_settings) status\_id is a foreign key. In my application a user has the ability to create and delete statuses. So this query I'm trying to write is for when a status is being deleted. Before the status is deleted I need to check both tbl\_person and tbl\_settings to see if the status being deleted exists in either table. If either of the tables have a match to the status being deleted I need to promote the user. Hope this helps.
2011/08/12
[ "https://Stackoverflow.com/questions/7035049", "https://Stackoverflow.com", "https://Stackoverflow.com/users/258594/" ]
I am a little confused with your question because you used tbl\_person and tbl\_status firstly, then you tried to test by joining tbl\_person and tbl\_settings. Which two tables do you want to join? If you want to join tbl\_person and tbl\_settings, how about this. ``` SELECT * FROM tbl_person JOIN tbl_setting ON tbl_person.status_id = tbl_settings.status_id WHERE tbl_person.status_id = '+status_dg.selectedItem.status_id+' ```
To join the tables, you need to define the joining fields, which in your case seems to be the status\_id fields. This might not work correctly, but if you look at the last line you'll need that in your query: ``` SELECT * FROM tbl_person, tbl_settings WHERE ( tbl_person.status_id='+status_dg.selectedItem.status_id+' OR tbl_settings.status_id='+status_dg.selectedItem.status_id+' ) AND tbl_person.status_id = tbl_settings.status_id; ```
47,912,642
Let say I have a `Map<Date, List<Integer>>`, where list of integers is just a list of numbers thrown in lottery draw. It may look like this: ``` Wed Nov 15 13:31:45 EST 2017=[1, 2, 3, 4, 5, 6], Wed Nov 22 13:31:45 EST 2017=[7, 8, 9, 10, 11, 12], Wed Nov 29 13:31:45 EST 2017=[13, 14, 15, 16, 17, 18], Wed Dec 13 13:31:45 EST 2017=[1, 19, 20, 21, 22, 23], Wed Dec 20 13:31:45 EST 2017=[24, 25, 26, 27, 28, 29] ``` I need to convert that map into the map, where key is the lottery number, and the value is the last date when the number was thrown. Something like: 1=Wed Dec 13 13:31:45 EST 2017 2=Wed Nov 15 13:31:45 EST 2017 etc till 49. So, the question is: is it possible to make it with the Java 8 streams and if yes, then how. Thanks in advance.
2017/12/20
[ "https://Stackoverflow.com/questions/47912642", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1712442/" ]
If I am not mistaken you are looking for something like this (assuming `Date` is `Comparable`): ``` map.entrySet() .stream() .flatMap(x -> x.getValue().stream().map(y -> new AbstractMap.SimpleEntry<>(x.getKey(), y))) .collect(Collectors.groupingBy( Entry::getValue, Collectors.collectingAndThen( Collectors.maxBy(Comparator.comparing(Entry::getKey)), x -> x.get().getKey()))); ```
Here's a succint way to do it (without streams, though): ``` Map<Integer, Date> result = new HashMap<>(); map.forEach((date, list) -> list.forEach(n -> result.merge(n, date, (oldDate, newDate) -> newDate.after(oldDate) ? newDate : oldDate))); ``` This iterates the `map` map and for each one of its `(date, list)` pairs, it iterates the `list` list of numbers. Then it uses the [`Map.merge`](https://docs.oracle.com/javase/9/docs/api/java/util/Map.html#merge-K-V-java.util.function.BiFunction-) and [`Date.after`](https://docs.oracle.com/javase/9/docs/api/java/util/Date.html#after-java.util.Date-) methods to put entries into the `result` map in such a way that only the last date is mapped to a given number.
27,842,921
``` #include<stdio.h> int main() { int i; goto l; for(i = 0; i < 5; i++) { l:printf("Hi\n"); } return 0; } ``` The above code gives output three times Hi . I don't have any idea how it happens, please expalin it. If i reducde value of 5 to 3 then only once the Hi printed.
2015/01/08
[ "https://Stackoverflow.com/questions/27842921", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3671587/" ]
iCloud doesn't support a pretty wide range of calendar-query requests. You may be stuck downloading the entire collection first.
The url you are using to post request must contain ics file link along with the UID in request.
4,214,815
I have a simple webservice running in Visual Studio. If I attempt to view the metadata it is missing information about the operation and so svcutil generates client code without any methods. Is there anything wrong with my setup? ``` <system.serviceModel> <bindings> <basicHttpBinding> <binding name="FCRPublishSOAP" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true"> <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"/> <security mode="None"> <transport clientCredentialType="None" proxyCredentialType="None" realm=""/> <message clientCredentialType="UserName" algorithmSuite="Default"/> </security> </binding> </basicHttpBinding> </bindings> <services> <service name="Test.Publish.FCRPublish" behaviorConfiguration="SimpleServiceBehavior"> <endpoint address="FCRPublish" behaviorConfiguration="" binding="basicHttpBinding" bindingConfiguration="FCRPublishSOAP" contract="IFCRPublish"/> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> </service> </services> <behaviors> <serviceBehaviors> <behavior name="SimpleServiceBehavior"> <serviceMetadata httpGetEnabled="True" policyVersion="Policy15" /> </behavior> </serviceBehaviors> </behaviors> ``` Interface: ``` [System.ServiceModel.ServiceContractAttribute(Namespace="http://Test/Publish", ConfigurationName="IFCRPublish")] public interface IFCRPublish { // CODEGEN: Generating message contract since the operation PublishNotification is neither RPC nor document wrapped. [System.ServiceModel.OperationContractAttribute(Action="http://Test/PublishNotification", ReplyAction="*")] PublishNotificationResponse1 PublishNotification(PublishNotificationRequest1 request); } ``` Response: ``` [System.Diagnostics.DebuggerStepThroughAttribute()] [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")] [System.ServiceModel.MessageContractAttribute(IsWrapped=false)] public partial class PublishNotificationResponse1 { [System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://Test/PublishTypes", Order=0)] public PublishNotificationResponse PublishNotificationResponse; public PublishNotificationResponse1() { } public PublishNotificationResponse1(PublishNotificationResponse PublishNotificationResponse) { this.PublishNotificationResponse = PublishNotificationResponse; } } ``` Request: ``` [System.Diagnostics.DebuggerStepThroughAttribute()] [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")] [System.ServiceModel.MessageContractAttribute(IsWrapped=false)] public partial class PublishNotificationRequest1 { [System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://Test/PublishTypes", Order=0)] public PublishNotification PublishNotification; public PublishNotificationRequest1() { } public PublishNotificationRequest1(PublishNotification PublishNotification) { this.PublishNotification = PublishNotification; } } ``` This is the metadata I receive: ``` <wsdl:import namespace="http://Test/Publish" location="http://localhost:3992/FCRPublish.svc?wsdl=wsdl0"/> <wsdl:types/> <wsdl:binding name="BasicHttpBinding_IFCRPublish" type="i0:IFCRPublish"> <soap:binding transport="http://schemas.xmlsoap.org/soap/http"/> </wsdl:binding> <wsdl:service name="FCRPublish"> <wsdl:port name="BasicHttpBinding_IFCRPublish" binding="tns:BasicHttpBinding_IFCRPublish"> <soap:address location="http://localhost:3992/FCRPublish.svc"/> </wsdl:port> </wsdl:service> ``` Where has my operation gone?
2010/11/18
[ "https://Stackoverflow.com/questions/4214815", "https://Stackoverflow.com", "https://Stackoverflow.com/users/236733/" ]
Worked it out. Setting ReplyAction="\*" for an OperationContract means the WsdlExporter (which publishes the metadata) will ignore that Operation. Setting any other value fixes it. What bothers me about this is that svcutil will by default set replyaction to \* which means svcutil by default creates services for which the metadata is effectively broken.
try removing `FCRPublish` from the address of your enpoint... your mex endpoint is there and seems ok, so I believe it should work
12,598,223
I need to get both table and here is the table structure Table A ------- * UserID * Username * Status * IntroCode Table B ------- * IntroCode * UserID I want to get the table a data and join with table b on tblA.IntroCode = tblB.IntroCode, then get the username of tblB.userID. How can i do such join ? I tried half way and stuck in the middle, please help. Thanks for reply
2012/09/26
[ "https://Stackoverflow.com/questions/12598223", "https://Stackoverflow.com", "https://Stackoverflow.com/users/235119/" ]
``` SELECT B.userID from TableA A LEFT JOIN TableB B on A.IntroCode=B.IntroCode ```
use this query ``` SELECT * FROM tblA INNER JOIN tblB ON tblA.IntroCode = tblB.IntroCode where tblB.userid = value ```
12,598,223
I need to get both table and here is the table structure Table A ------- * UserID * Username * Status * IntroCode Table B ------- * IntroCode * UserID I want to get the table a data and join with table b on tblA.IntroCode = tblB.IntroCode, then get the username of tblB.userID. How can i do such join ? I tried half way and stuck in the middle, please help. Thanks for reply
2012/09/26
[ "https://Stackoverflow.com/questions/12598223", "https://Stackoverflow.com", "https://Stackoverflow.com/users/235119/" ]
Use this query. ``` SELECT TableA.Username FROM TableA JOIN TableB ON (TableA.IntroCode = TableB.IntroCode); ```
use this query ``` SELECT * FROM tblA INNER JOIN tblB ON tblA.IntroCode = tblB.IntroCode where tblB.userid = value ```
12,598,223
I need to get both table and here is the table structure Table A ------- * UserID * Username * Status * IntroCode Table B ------- * IntroCode * UserID I want to get the table a data and join with table b on tblA.IntroCode = tblB.IntroCode, then get the username of tblB.userID. How can i do such join ? I tried half way and stuck in the middle, please help. Thanks for reply
2012/09/26
[ "https://Stackoverflow.com/questions/12598223", "https://Stackoverflow.com", "https://Stackoverflow.com/users/235119/" ]
``` SELECT column_name(s) FROM TableA LEFT JOIN TableB ON TableA.UserID=TableB.UserID ```
use this query ``` SELECT * FROM tblA INNER JOIN tblB ON tblA.IntroCode = tblB.IntroCode where tblB.userid = value ```
12,598,223
I need to get both table and here is the table structure Table A ------- * UserID * Username * Status * IntroCode Table B ------- * IntroCode * UserID I want to get the table a data and join with table b on tblA.IntroCode = tblB.IntroCode, then get the username of tblB.userID. How can i do such join ? I tried half way and stuck in the middle, please help. Thanks for reply
2012/09/26
[ "https://Stackoverflow.com/questions/12598223", "https://Stackoverflow.com", "https://Stackoverflow.com/users/235119/" ]
This is just a simple join. ``` SELECT a.*, b.* -- select your desired columns here FROM tableA a INNER JOIN tableB b ON a.IntroCode = b.IntroCode WHERE b.userid = valueHere ``` **UPDATE 1** ``` SELECT a.UserID, a.`Username` OrigUserName, a.`Status`, c.`Username` IntroUserName FROM tableA a INNER JOIN tableB b ON a.IntroCode = b.IntroCode INNER JOIN tableA c ON b.userID = c.userID -- WHERE b.UserID = valueHere -- extra condition here ```
``` SELECT B.userID from TableA A LEFT JOIN TableB B on A.IntroCode=B.IntroCode ```
12,598,223
I need to get both table and here is the table structure Table A ------- * UserID * Username * Status * IntroCode Table B ------- * IntroCode * UserID I want to get the table a data and join with table b on tblA.IntroCode = tblB.IntroCode, then get the username of tblB.userID. How can i do such join ? I tried half way and stuck in the middle, please help. Thanks for reply
2012/09/26
[ "https://Stackoverflow.com/questions/12598223", "https://Stackoverflow.com", "https://Stackoverflow.com/users/235119/" ]
``` select a.*,b.IntroCode from TableA a left join TableB b on a.IntroCode = b.IntroCode ```
use this query ``` SELECT * FROM tblA INNER JOIN tblB ON tblA.IntroCode = tblB.IntroCode where tblB.userid = value ```
12,598,223
I need to get both table and here is the table structure Table A ------- * UserID * Username * Status * IntroCode Table B ------- * IntroCode * UserID I want to get the table a data and join with table b on tblA.IntroCode = tblB.IntroCode, then get the username of tblB.userID. How can i do such join ? I tried half way and stuck in the middle, please help. Thanks for reply
2012/09/26
[ "https://Stackoverflow.com/questions/12598223", "https://Stackoverflow.com", "https://Stackoverflow.com/users/235119/" ]
This is just a simple join. ``` SELECT a.*, b.* -- select your desired columns here FROM tableA a INNER JOIN tableB b ON a.IntroCode = b.IntroCode WHERE b.userid = valueHere ``` **UPDATE 1** ``` SELECT a.UserID, a.`Username` OrigUserName, a.`Status`, c.`Username` IntroUserName FROM tableA a INNER JOIN tableB b ON a.IntroCode = b.IntroCode INNER JOIN tableA c ON b.userID = c.userID -- WHERE b.UserID = valueHere -- extra condition here ```
you have to give the columns with same name an unique value: ``` SELECT a.UserID as uid_a, b.UserID as uid_b FROM tableA a INNER JOIN tableB b ON a.IntroCode = b.IntroCode WHERE b.UserID = 1 ```
12,598,223
I need to get both table and here is the table structure Table A ------- * UserID * Username * Status * IntroCode Table B ------- * IntroCode * UserID I want to get the table a data and join with table b on tblA.IntroCode = tblB.IntroCode, then get the username of tblB.userID. How can i do such join ? I tried half way and stuck in the middle, please help. Thanks for reply
2012/09/26
[ "https://Stackoverflow.com/questions/12598223", "https://Stackoverflow.com", "https://Stackoverflow.com/users/235119/" ]
This is just a simple join. ``` SELECT a.*, b.* -- select your desired columns here FROM tableA a INNER JOIN tableB b ON a.IntroCode = b.IntroCode WHERE b.userid = valueHere ``` **UPDATE 1** ``` SELECT a.UserID, a.`Username` OrigUserName, a.`Status`, c.`Username` IntroUserName FROM tableA a INNER JOIN tableB b ON a.IntroCode = b.IntroCode INNER JOIN tableA c ON b.userID = c.userID -- WHERE b.UserID = valueHere -- extra condition here ```
``` SELECT column_name(s) FROM TableA LEFT JOIN TableB ON TableA.UserID=TableB.UserID ```