qid int64 1 74.7M | question stringlengths 15 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 4 30.2k | response_k stringlengths 11 36.5k |
|---|---|---|---|---|---|
256,964 | Inspired by a challenge from the [OUCC 2022 Seniors competition](https://challenge.bebras.uk/index.php?action=anon_join&grp_id=12427).
### Background
Two teams are playing "capture the flag". They take turns invading each other's base and capturing their opposing team's flag in the shortest amount of time. The attack... | 2023/01/21 | [
"https://codegolf.stackexchange.com/questions/256964",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/114446/"
] | [Charcoal](https://github.com/somebody1234/Charcoal), ~~28~~ 21 bytes
=====================================================================
```
≔↨¹Eθ×⊟ι↨±³ιθI∧θ÷θ±↔θ
```
[Try it online!](https://tio.run/##PY65DsIwEER7vmLLtbSRckJBFaChAKWgs1KYxAqWgnPY5PeNYwWmem9HI23zEnMziN650hjVaTwJIzEhuIkRJ4KHekuD1TCiYgShvMtOWImZd8V8... | [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), 10 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
============================================================================================================================
```
ε`3*-*}O.±
```
Port of almost any other answer, with input-trip... |
256,964 | Inspired by a challenge from the [OUCC 2022 Seniors competition](https://challenge.bebras.uk/index.php?action=anon_join&grp_id=12427).
### Background
Two teams are playing "capture the flag". They take turns invading each other's base and capturing their opposing team's flag in the shortest amount of time. The attack... | 2023/01/21 | [
"https://codegolf.stackexchange.com/questions/256964",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/114446/"
] | [Jelly](https://github.com/DennisMitchell/jelly), 8 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
===================================================================================================================
Employs the team identification trick from [Arnauld's JavaScript ES6 answer](https://co... | Julia,44 bytes
==============
```
a->sign(mapfoldl(i->i[1]*(i[2]-3*i[3]),+,a))
```
I'm taking the strategy everyone else is using by using -1 for A and 1 for B, then multiplying that by the number of seconds after deductions. Outputting the sign of the output is the team who wins, and zero is a draw. |
256,964 | Inspired by a challenge from the [OUCC 2022 Seniors competition](https://challenge.bebras.uk/index.php?action=anon_join&grp_id=12427).
### Background
Two teams are playing "capture the flag". They take turns invading each other's base and capturing their opposing team's flag in the shortest amount of time. The attack... | 2023/01/21 | [
"https://codegolf.stackexchange.com/questions/256964",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/114446/"
] | [Nibbles](http://golfscript.com/nibbles/index.html), ~~6~~ 5.5 bytes
====================================================================
```
`$+.$*-@*3
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m708LzMpKSe1eMGCpaUlaboWqxJUtPVUtHQdtIwhAlDxm9rRStEaBjpGBjqGmjoahjrGEIaZjomBji6IZQSSA7JilWKhegA)
Takes a li... | [Nim](https://nim-lang.org/), 77 bytes
======================================
```
import math,sequtils
proc c[S](s:S):int=sgn sum s.mapIt it[0]*(it[1]-3*it[2])
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m704LzN3wYKlpSVpuhY3fTNzC_KLShRyE0sydIpTC0tLMnOKuQqK8pMVkqODYzWKrYI1rTLzSmyL0_MUiktzFYr1chMLPEsUMkuiD... |
256,964 | Inspired by a challenge from the [OUCC 2022 Seniors competition](https://challenge.bebras.uk/index.php?action=anon_join&grp_id=12427).
### Background
Two teams are playing "capture the flag". They take turns invading each other's base and capturing their opposing team's flag in the shortest amount of time. The attack... | 2023/01/21 | [
"https://codegolf.stackexchange.com/questions/256964",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/114446/"
] | [Japt](https://github.com/ETHproductions/japt) [`-g`](https://codegolf.meta.stackexchange.com/a/14339/), 10 [bytes](https://en.wikipedia.org/wiki/ISO/IEC_8859-1)
==============================================================================================================================================================... | [Thunno](https://github.com/Thunno/Thunno), \$ 11 \log\_{256}(96) \approx \$ 9.05 bytes
=======================================================================================
```
eAu3*-*ESza
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m72sJKM0Ly9_wYKlpSVpuharUx1LjbV0tVyDqxIhIlCJBTe9o6N1DXUUTA10FIxjdRTAH... |
23,097,418 | however I am not sure where I am supposed to enter the whoWins() method. Do I enter this method in the actionperformed Method of the buttons or do i need to something different. Please help.
```
public class TTT extends JFrame implements ActionListener {
private JButton buttons[] = new JButton[9];
pri... | 2014/04/16 | [
"https://Stackoverflow.com/questions/23097418",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3285009/"
] | If you really want to do this right, then I suggest making some big changes, some M-V-C type changes:
* First and foremost, separate out the logic of the game from the game GUI. This would mean that the code that determines who wins should not be in any code that contains GUI type code. This will be your "model"
* Nex... | I am also interested in writing a Tic Tac Toe game, so I copied your code, and did a little modification, and it passed test, check following:
```
package eric.j2se.swing;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
imp... |
11,560 | In DBZ, we see that the Elder Kai fully awakens the dormant power of Gohan. In this state Gohan can match Buu in his unfused form. But after Buu absorbs Piccolo and Gotenks, why doesn't Gohan go Super?
Is there any reason that Gohan couldn't transform to Super Saiyan form after the awakening?
Edit 1: Removed the tra... | 2014/06/30 | [
"https://anime.stackexchange.com/questions/11560",
"https://anime.stackexchange.com",
"https://anime.stackexchange.com/users/6368/"
] | I think I found a possible answer, because I had a similar question.
In [Gohan](http://dragonball.wikia.com/wiki/Gohan) article on Dragon Ball Wiki.
>
> However, amazed at realizing that
> some of his power really was unlocked, Gohan apologizes to Old Kai,
> and resumes the ritual. **After some time, the ritual is... | In Dragon Ball Super when training with Piccolo Gohan powered up to super saiyan 2, and then he made a final effort and transformed into mystic form , passing from super saiyan 2 to mystic form in a gradual change, as a next stage, so no, now with Dragon Ball Super the answer is clear, he can't transform into super sai... |
11,560 | In DBZ, we see that the Elder Kai fully awakens the dormant power of Gohan. In this state Gohan can match Buu in his unfused form. But after Buu absorbs Piccolo and Gotenks, why doesn't Gohan go Super?
Is there any reason that Gohan couldn't transform to Super Saiyan form after the awakening?
Edit 1: Removed the tra... | 2014/06/30 | [
"https://anime.stackexchange.com/questions/11560",
"https://anime.stackexchange.com",
"https://anime.stackexchange.com/users/6368/"
] | I think I found a possible answer, because I had a similar question.
In [Gohan](http://dragonball.wikia.com/wiki/Gohan) article on Dragon Ball Wiki.
>
> However, amazed at realizing that
> some of his power really was unlocked, Gohan apologizes to Old Kai,
> and resumes the ritual. **After some time, the ritual is... | According to Dragon Ball Wiki, Daizenshuu 2 commented on the possibility of [Gohan](http://dragonball.wikia.com/wiki/Gohan#Power) becoming a Super Saiyan:
>
> Daizenshuu 2 states that Ultimate Gohan is still capable of becoming a Super Saiyan, but even without utilising the form he surpasses Super Saiyan 3 Gotenks in... |
11,560 | In DBZ, we see that the Elder Kai fully awakens the dormant power of Gohan. In this state Gohan can match Buu in his unfused form. But after Buu absorbs Piccolo and Gotenks, why doesn't Gohan go Super?
Is there any reason that Gohan couldn't transform to Super Saiyan form after the awakening?
Edit 1: Removed the tra... | 2014/06/30 | [
"https://anime.stackexchange.com/questions/11560",
"https://anime.stackexchange.com",
"https://anime.stackexchange.com/users/6368/"
] | I think I found a possible answer, because I had a similar question.
In [Gohan](http://dragonball.wikia.com/wiki/Gohan) article on Dragon Ball Wiki.
>
> However, amazed at realizing that
> some of his power really was unlocked, Gohan apologizes to Old Kai,
> and resumes the ritual. **After some time, the ritual is... | The answer is yes. His power was fully awaken and so he had no need to transform into super Saiyan. He could go super but he didn't know that Buu could absorb people and their power level.
When he is in mystic form his full power was awaken and he had the same power as he did as super Saiyan. so his base power was ris... |
11,560 | In DBZ, we see that the Elder Kai fully awakens the dormant power of Gohan. In this state Gohan can match Buu in his unfused form. But after Buu absorbs Piccolo and Gotenks, why doesn't Gohan go Super?
Is there any reason that Gohan couldn't transform to Super Saiyan form after the awakening?
Edit 1: Removed the tra... | 2014/06/30 | [
"https://anime.stackexchange.com/questions/11560",
"https://anime.stackexchange.com",
"https://anime.stackexchange.com/users/6368/"
] | I think I found a possible answer, because I had a similar question.
In [Gohan](http://dragonball.wikia.com/wiki/Gohan) article on Dragon Ball Wiki.
>
> However, amazed at realizing that
> some of his power really was unlocked, Gohan apologizes to Old Kai,
> and resumes the ritual. **After some time, the ritual is... | The answer is actually no. Gohan's Mystic Powerup IS his Super Saiyan transformation which is why elder Kai tells him to powerup as if he were transforming. |
11,560 | In DBZ, we see that the Elder Kai fully awakens the dormant power of Gohan. In this state Gohan can match Buu in his unfused form. But after Buu absorbs Piccolo and Gotenks, why doesn't Gohan go Super?
Is there any reason that Gohan couldn't transform to Super Saiyan form after the awakening?
Edit 1: Removed the tra... | 2014/06/30 | [
"https://anime.stackexchange.com/questions/11560",
"https://anime.stackexchange.com",
"https://anime.stackexchange.com/users/6368/"
] | In Dragon Ball Super when training with Piccolo Gohan powered up to super saiyan 2, and then he made a final effort and transformed into mystic form , passing from super saiyan 2 to mystic form in a gradual change, as a next stage, so no, now with Dragon Ball Super the answer is clear, he can't transform into super sai... | Actually, Gohan's Mystic Power-Up actually made it so his ki transformed to that of a Kai, but doing so made it so that his appearance doesn't change when he goes Super Saiyan.
When he fought Super Buu, he was actually a Super Saiyan 2 charged by Kai energy, but the Kai powers he got from his Mystic training made his ... |
11,560 | In DBZ, we see that the Elder Kai fully awakens the dormant power of Gohan. In this state Gohan can match Buu in his unfused form. But after Buu absorbs Piccolo and Gotenks, why doesn't Gohan go Super?
Is there any reason that Gohan couldn't transform to Super Saiyan form after the awakening?
Edit 1: Removed the tra... | 2014/06/30 | [
"https://anime.stackexchange.com/questions/11560",
"https://anime.stackexchange.com",
"https://anime.stackexchange.com/users/6368/"
] | The answer is yes. His power was fully awaken and so he had no need to transform into super Saiyan. He could go super but he didn't know that Buu could absorb people and their power level.
When he is in mystic form his full power was awaken and he had the same power as he did as super Saiyan. so his base power was ris... | It makes perfect sense that Ultimate Gohan (the official name for the "form") can go Super Saiyan. Whenever Gohan had sudden outburst of rage and power he utilized and unleashed very small portions of his full power, the greatest example of this was him transforming into and SSJ2 against Perfect Cell.
The Super Saiyan... |
11,560 | In DBZ, we see that the Elder Kai fully awakens the dormant power of Gohan. In this state Gohan can match Buu in his unfused form. But after Buu absorbs Piccolo and Gotenks, why doesn't Gohan go Super?
Is there any reason that Gohan couldn't transform to Super Saiyan form after the awakening?
Edit 1: Removed the tra... | 2014/06/30 | [
"https://anime.stackexchange.com/questions/11560",
"https://anime.stackexchange.com",
"https://anime.stackexchange.com/users/6368/"
] | In Dragon Ball Super when training with Piccolo Gohan powered up to super saiyan 2, and then he made a final effort and transformed into mystic form , passing from super saiyan 2 to mystic form in a gradual change, as a next stage, so no, now with Dragon Ball Super the answer is clear, he can't transform into super sai... | It makes perfect sense that Ultimate Gohan (the official name for the "form") can go Super Saiyan. Whenever Gohan had sudden outburst of rage and power he utilized and unleashed very small portions of his full power, the greatest example of this was him transforming into and SSJ2 against Perfect Cell.
The Super Saiyan... |
11,560 | In DBZ, we see that the Elder Kai fully awakens the dormant power of Gohan. In this state Gohan can match Buu in his unfused form. But after Buu absorbs Piccolo and Gotenks, why doesn't Gohan go Super?
Is there any reason that Gohan couldn't transform to Super Saiyan form after the awakening?
Edit 1: Removed the tra... | 2014/06/30 | [
"https://anime.stackexchange.com/questions/11560",
"https://anime.stackexchange.com",
"https://anime.stackexchange.com/users/6368/"
] | The answer is yes. His power was fully awaken and so he had no need to transform into super Saiyan. He could go super but he didn't know that Buu could absorb people and their power level.
When he is in mystic form his full power was awaken and he had the same power as he did as super Saiyan. so his base power was ris... | According to Dragon Ball Wiki, Daizenshuu 2 commented on the possibility of [Gohan](http://dragonball.wikia.com/wiki/Gohan#Power) becoming a Super Saiyan:
>
> Daizenshuu 2 states that Ultimate Gohan is still capable of becoming a Super Saiyan, but even without utilising the form he surpasses Super Saiyan 3 Gotenks in... |
11,560 | In DBZ, we see that the Elder Kai fully awakens the dormant power of Gohan. In this state Gohan can match Buu in his unfused form. But after Buu absorbs Piccolo and Gotenks, why doesn't Gohan go Super?
Is there any reason that Gohan couldn't transform to Super Saiyan form after the awakening?
Edit 1: Removed the tra... | 2014/06/30 | [
"https://anime.stackexchange.com/questions/11560",
"https://anime.stackexchange.com",
"https://anime.stackexchange.com/users/6368/"
] | In Dragon Ball Super when training with Piccolo Gohan powered up to super saiyan 2, and then he made a final effort and transformed into mystic form , passing from super saiyan 2 to mystic form in a gradual change, as a next stage, so no, now with Dragon Ball Super the answer is clear, he can't transform into super sai... | According to Dragon Ball Wiki, Daizenshuu 2 commented on the possibility of [Gohan](http://dragonball.wikia.com/wiki/Gohan#Power) becoming a Super Saiyan:
>
> Daizenshuu 2 states that Ultimate Gohan is still capable of becoming a Super Saiyan, but even without utilising the form he surpasses Super Saiyan 3 Gotenks in... |
11,560 | In DBZ, we see that the Elder Kai fully awakens the dormant power of Gohan. In this state Gohan can match Buu in his unfused form. But after Buu absorbs Piccolo and Gotenks, why doesn't Gohan go Super?
Is there any reason that Gohan couldn't transform to Super Saiyan form after the awakening?
Edit 1: Removed the tra... | 2014/06/30 | [
"https://anime.stackexchange.com/questions/11560",
"https://anime.stackexchange.com",
"https://anime.stackexchange.com/users/6368/"
] | I think I found a possible answer, because I had a similar question.
In [Gohan](http://dragonball.wikia.com/wiki/Gohan) article on Dragon Ball Wiki.
>
> However, amazed at realizing that
> some of his power really was unlocked, Gohan apologizes to Old Kai,
> and resumes the ritual. **After some time, the ritual is... | It makes perfect sense that Ultimate Gohan (the official name for the "form") can go Super Saiyan. Whenever Gohan had sudden outburst of rage and power he utilized and unleashed very small portions of his full power, the greatest example of this was him transforming into and SSJ2 against Perfect Cell.
The Super Saiyan... |
777,896 | I'm planning to record some tutorial videos. How do I make a mouse pointer/cursor with yellow circle around it on Ubuntu 16.04, so my students could see where I am? | 2016/05/26 | [
"https://askubuntu.com/questions/777896",
"https://askubuntu.com",
"https://askubuntu.com/users/548944/"
] | Yellow circle can be done by installing any one of the following software:
1. [Cam studio](https://sourceforge.net/projects/camstudio/): Is an open source windows software. Install it using wine then go to cursor settings. There is a cursor highlight.
2. RealWorld Cursor Editor: Also for Windows. Using this, you can d... | I have not tested this, but I think it's the right answer.
* Open compiz config: `sudo apt install compizconfig-settings-manager && ccsm`
* Look for plugin Show mouse, under Accessibility - ENABLE it..
* Play with it, to see if that's okay :)
You'll need `compiz-plugins` package to have this option.
[](https://i.stack.imgur.com/vB... | I have not tested this, but I think it's the right answer.
* Open compiz config: `sudo apt install compizconfig-settings-manager && ccsm`
* Look for plugin Show mouse, under Accessibility - ENABLE it..
* Play with it, to see if that's okay :)
You'll need `compiz-plugins` package to have this option.
[ which had some broken links and left me still in search of themes that someone else had surely created. I found one I liked. Here's an a... | I have not tested this, but I think it's the right answer.
* Open compiz config: `sudo apt install compizconfig-settings-manager && ccsm`
* Look for plugin Show mouse, under Accessibility - ENABLE it..
* Play with it, to see if that's okay :)
You'll need `compiz-plugins` package to have this option.
[ is to create a php file called docr... | I found [this website](https://wp-mix.com/php-absolute-path-document-root-base-url/) which provided me with the only **good** solution I have found after scouring the web...
```
$root = preg_replace("!${_SERVER['SCRIPT_NAME']}$!", "", $_SERVER['SCRIPT_FILENAME']);
```
The way this works is by getting the full path o... |
3,591 | I have gotten two videos of Chinese movies at Amazon and in fact both had Mandarin soundtracks with a choice of Chinese (simplified or traditional) or English subtitles. That is what I wanted. But in both cases I was buying blind. It seems impossible to get reliable information on the languages of a video either at Ama... | 2013/08/19 | [
"https://chinese.stackexchange.com/questions/3591",
"https://chinese.stackexchange.com",
"https://chinese.stackexchange.com/users/2223/"
] | You can use some video software or website.
Like PPS, PPTV, CNTVBOX, Youku, TuDou, Xunlei Kankan, Xunbo, etc etc, but you won't get English subtitle in most of them, although you can find lots of videos with English voiceover. It maybe troublesome if you want to watch movies since they ban IP address outside China acc... | For a beginner of Chinese-learning, you can watch CCTV:
学说中国话,朋友遍天下 (Learning Chinese, full with friends):<http://english.cntv.cn/learnchinese/>
Besides this, you can also see this **[Thread](https://chinese.stackexchange.com/questions/1120/resources-for-learning-mandarin-chinese)**. |
3,591 | I have gotten two videos of Chinese movies at Amazon and in fact both had Mandarin soundtracks with a choice of Chinese (simplified or traditional) or English subtitles. That is what I wanted. But in both cases I was buying blind. It seems impossible to get reliable information on the languages of a video either at Ama... | 2013/08/19 | [
"https://chinese.stackexchange.com/questions/3591",
"https://chinese.stackexchange.com",
"https://chinese.stackexchange.com/users/2223/"
] | >
> You see, I want to hear actual Chinese spoken at normal speed for the length of a movie or tv show. So 学说中国话 is run to hear but not really what I want.
>
>
>
Oh, it seems that you can find more and more Chinese news played in CCTV4 (Chinese International Channel), this is now standard Chinese news for you to l... | You can use some video software or website.
Like PPS, PPTV, CNTVBOX, Youku, TuDou, Xunlei Kankan, Xunbo, etc etc, but you won't get English subtitle in most of them, although you can find lots of videos with English voiceover. It maybe troublesome if you want to watch movies since they ban IP address outside China acc... |
3,591 | I have gotten two videos of Chinese movies at Amazon and in fact both had Mandarin soundtracks with a choice of Chinese (simplified or traditional) or English subtitles. That is what I wanted. But in both cases I was buying blind. It seems impossible to get reliable information on the languages of a video either at Ama... | 2013/08/19 | [
"https://chinese.stackexchange.com/questions/3591",
"https://chinese.stackexchange.com",
"https://chinese.stackexchange.com/users/2223/"
] | Maybe you can find something useful at www.shooter.cn. Good luck! | You can use some video software or website.
Like PPS, PPTV, CNTVBOX, Youku, TuDou, Xunlei Kankan, Xunbo, etc etc, but you won't get English subtitle in most of them, although you can find lots of videos with English voiceover. It maybe troublesome if you want to watch movies since they ban IP address outside China acc... |
3,591 | I have gotten two videos of Chinese movies at Amazon and in fact both had Mandarin soundtracks with a choice of Chinese (simplified or traditional) or English subtitles. That is what I wanted. But in both cases I was buying blind. It seems impossible to get reliable information on the languages of a video either at Ama... | 2013/08/19 | [
"https://chinese.stackexchange.com/questions/3591",
"https://chinese.stackexchange.com",
"https://chinese.stackexchange.com/users/2223/"
] | >
> You see, I want to hear actual Chinese spoken at normal speed for the length of a movie or tv show. So 学说中国话 is run to hear but not really what I want.
>
>
>
Oh, it seems that you can find more and more Chinese news played in CCTV4 (Chinese International Channel), this is now standard Chinese news for you to l... | For a beginner of Chinese-learning, you can watch CCTV:
学说中国话,朋友遍天下 (Learning Chinese, full with friends):<http://english.cntv.cn/learnchinese/>
Besides this, you can also see this **[Thread](https://chinese.stackexchange.com/questions/1120/resources-for-learning-mandarin-chinese)**. |
3,591 | I have gotten two videos of Chinese movies at Amazon and in fact both had Mandarin soundtracks with a choice of Chinese (simplified or traditional) or English subtitles. That is what I wanted. But in both cases I was buying blind. It seems impossible to get reliable information on the languages of a video either at Ama... | 2013/08/19 | [
"https://chinese.stackexchange.com/questions/3591",
"https://chinese.stackexchange.com",
"https://chinese.stackexchange.com/users/2223/"
] | If you are / were a player of World of Warcraft, you may wanna check a Chinese cartoon name I'm MT 我叫MT. This cartoon series are recorded in Chinese but have English subtitles. As a cartoon, the charters are talking mostly in oral Chinese, without so many attention about grammar, but very closed to real Chinese convers... | For a beginner of Chinese-learning, you can watch CCTV:
学说中国话,朋友遍天下 (Learning Chinese, full with friends):<http://english.cntv.cn/learnchinese/>
Besides this, you can also see this **[Thread](https://chinese.stackexchange.com/questions/1120/resources-for-learning-mandarin-chinese)**. |
3,591 | I have gotten two videos of Chinese movies at Amazon and in fact both had Mandarin soundtracks with a choice of Chinese (simplified or traditional) or English subtitles. That is what I wanted. But in both cases I was buying blind. It seems impossible to get reliable information on the languages of a video either at Ama... | 2013/08/19 | [
"https://chinese.stackexchange.com/questions/3591",
"https://chinese.stackexchange.com",
"https://chinese.stackexchange.com/users/2223/"
] | Maybe you can find something useful at www.shooter.cn. Good luck! | For a beginner of Chinese-learning, you can watch CCTV:
学说中国话,朋友遍天下 (Learning Chinese, full with friends):<http://english.cntv.cn/learnchinese/>
Besides this, you can also see this **[Thread](https://chinese.stackexchange.com/questions/1120/resources-for-learning-mandarin-chinese)**. |
3,591 | I have gotten two videos of Chinese movies at Amazon and in fact both had Mandarin soundtracks with a choice of Chinese (simplified or traditional) or English subtitles. That is what I wanted. But in both cases I was buying blind. It seems impossible to get reliable information on the languages of a video either at Ama... | 2013/08/19 | [
"https://chinese.stackexchange.com/questions/3591",
"https://chinese.stackexchange.com",
"https://chinese.stackexchange.com/users/2223/"
] | >
> You see, I want to hear actual Chinese spoken at normal speed for the length of a movie or tv show. So 学说中国话 is run to hear but not really what I want.
>
>
>
Oh, it seems that you can find more and more Chinese news played in CCTV4 (Chinese International Channel), this is now standard Chinese news for you to l... | If you are / were a player of World of Warcraft, you may wanna check a Chinese cartoon name I'm MT 我叫MT. This cartoon series are recorded in Chinese but have English subtitles. As a cartoon, the charters are talking mostly in oral Chinese, without so many attention about grammar, but very closed to real Chinese convers... |
3,591 | I have gotten two videos of Chinese movies at Amazon and in fact both had Mandarin soundtracks with a choice of Chinese (simplified or traditional) or English subtitles. That is what I wanted. But in both cases I was buying blind. It seems impossible to get reliable information on the languages of a video either at Ama... | 2013/08/19 | [
"https://chinese.stackexchange.com/questions/3591",
"https://chinese.stackexchange.com",
"https://chinese.stackexchange.com/users/2223/"
] | Maybe you can find something useful at www.shooter.cn. Good luck! | >
> You see, I want to hear actual Chinese spoken at normal speed for the length of a movie or tv show. So 学说中国话 is run to hear but not really what I want.
>
>
>
Oh, it seems that you can find more and more Chinese news played in CCTV4 (Chinese International Channel), this is now standard Chinese news for you to l... |
3,591 | I have gotten two videos of Chinese movies at Amazon and in fact both had Mandarin soundtracks with a choice of Chinese (simplified or traditional) or English subtitles. That is what I wanted. But in both cases I was buying blind. It seems impossible to get reliable information on the languages of a video either at Ama... | 2013/08/19 | [
"https://chinese.stackexchange.com/questions/3591",
"https://chinese.stackexchange.com",
"https://chinese.stackexchange.com/users/2223/"
] | Maybe you can find something useful at www.shooter.cn. Good luck! | If you are / were a player of World of Warcraft, you may wanna check a Chinese cartoon name I'm MT 我叫MT. This cartoon series are recorded in Chinese but have English subtitles. As a cartoon, the charters are talking mostly in oral Chinese, without so many attention about grammar, but very closed to real Chinese convers... |
46,477,240 | I am trying to find where "code" from df2 appears in any of the "code1,code2,code3" columns in df1 and return the rows from df2 where that match was successful.
Here is my sample code:
```
df1 = pd.DataFrame(
{
'terms' : ['term1','term2'],
'code1': ['1234x', '4321y'],
'code2': ['2345x'... | 2017/09/28 | [
"https://Stackoverflow.com/questions/46477240",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3311213/"
] | **Option 1**
`np.in1d`
Indiscriminate check if a `df2.code` for a particular row is anywhere in `df1`
```
df2[np.in1d(df2.code, df1[['code1', 'code2', 'code3']])]
name rate location code
1 Sara 3.5 OH 6543y
```
Speed it up
```
df2[np.in1d(df2.code.values, df1[['code1', 'code2', 'code3']].value... | Use, `filter` and `stack`
```
In [4647]: df2[df2['code'].isin(df1.filter(like='code').stack())]
Out[4647]:
name rate location code
1 Sara 3.5 OH 6543y
```
Or, if you're use about `code*` columns to be after `1:`
```
In [4648]: df2[df2['code'].isin(df1[df1.columns[1:]].stack())]
Out[4648]:
name rate... |
44,498,073 | I have a type and a JSON string that can be serialized into this type out of the box:
```
public class MyVar
{
public string Content { get; set; }
public string Type { get; set; }
}
public class TypeA
{
public string Name { get; set; }
public Dictionary<string, MyVar> Vars { get; set; }
}
```
Is it ... | 2017/06/12 | [
"https://Stackoverflow.com/questions/44498073",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/204688/"
] | Found it. I have to use a JsonConverter attribute.
```
[JsonConverter(typeof(MyVarsConverter))]
public MyVars Vars { get; set; }
```
And the implementation of the converter has to do the transformation from dictionary to an MyVars instance:
```
public class MyVarsConverter : JsonConverter
{
public override obje... | You can do it using Jobject, extract the values using Jobject and set it to the property which you want to to.
For eg I have a Jobject jo
```
var name jo.GetValue("Name ").ToString();
```
You can loop through Jobject and extract and set value to your custom model. |
42,897,701 | I have an application installed in 20 linux servers. The application contains multiple configuration files such as.
```
/etc/config_1/config_1_1.cfg
/etc/config_1/config_1_2.cfg
/etc/config_2/config_2_1.cfg
/etc/config_2/config_2_2.cfg
/etc/config_3/config_3.cfg
```
I will have all these configuration files in all t... | 2017/03/20 | [
"https://Stackoverflow.com/questions/42897701",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2982989/"
] | From command line:
`vim -d /etc/config_1/config_1_1.cfg /etc/config_1/config_1_2.cfg /etc/config_2/config_2_1.cfg /etc/config_2/config_2_2.cfg /etc/config_3/config_3.cfg` | Using the file comparison tool. |
42,897,701 | I have an application installed in 20 linux servers. The application contains multiple configuration files such as.
```
/etc/config_1/config_1_1.cfg
/etc/config_1/config_1_2.cfg
/etc/config_2/config_2_1.cfg
/etc/config_2/config_2_2.cfg
/etc/config_3/config_3.cfg
```
I will have all these configuration files in all t... | 2017/03/20 | [
"https://Stackoverflow.com/questions/42897701",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2982989/"
] | When you are only interested in the values, you can do something like
```
grep "." allfiles | sed 's/^\([^:]*\):\(.*\)/\2 : \1/' | sort
``` | Using the file comparison tool. |
42,897,701 | I have an application installed in 20 linux servers. The application contains multiple configuration files such as.
```
/etc/config_1/config_1_1.cfg
/etc/config_1/config_1_2.cfg
/etc/config_2/config_2_1.cfg
/etc/config_2/config_2_2.cfg
/etc/config_3/config_3.cfg
```
I will have all these configuration files in all t... | 2017/03/20 | [
"https://Stackoverflow.com/questions/42897701",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2982989/"
] | First, you need to collect the files in the same location to be easier and execute the following command:
```
diffuse x.cfg y.cfg
```
this will give you the ability to highlight the diffrence | Using the file comparison tool. |
19,741,717 | I have to create UI using the Gridview. The image are dynamic since it is coming from the webservice .
I can define column number using the xml but the item at the zeroth index has to have one full image and then the rest should be divided into columns .
Any Help is appreciated. | 2013/11/02 | [
"https://Stackoverflow.com/questions/19741717",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1562755/"
] | You shoud use a [`TableLayout`](http://developer.android.com/reference/android/widget/TableLayout.html). `GridView` does not support spanning operations.
>
> A layout that arranges its children into rows and columns. A
> TableLayout consists of a number of TableRow objects, each defining a
> row (actually, you can ... | you can use `GrideView` weight=1 and above of it add `ImageView`
for example if you want to use `GrideView` this is full example Layout
```
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="v... |
19,741,717 | I have to create UI using the Gridview. The image are dynamic since it is coming from the webservice .
I can define column number using the xml but the item at the zeroth index has to have one full image and then the rest should be divided into columns .
Any Help is appreciated. | 2013/11/02 | [
"https://Stackoverflow.com/questions/19741717",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1562755/"
] | You shoud use a [`TableLayout`](http://developer.android.com/reference/android/widget/TableLayout.html). `GridView` does not support spanning operations.
>
> A layout that arranges its children into rows and columns. A
> TableLayout consists of a number of TableRow objects, each defining a
> row (actually, you can ... | Based on Jack K Fouani. Some changes that will save entire image from cropping:
```
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<!-- Large Image -->
<ImageView
... |
19,741,717 | I have to create UI using the Gridview. The image are dynamic since it is coming from the webservice .
I can define column number using the xml but the item at the zeroth index has to have one full image and then the rest should be divided into columns .
Any Help is appreciated. | 2013/11/02 | [
"https://Stackoverflow.com/questions/19741717",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1562755/"
] | You shoud use a [`TableLayout`](http://developer.android.com/reference/android/widget/TableLayout.html). `GridView` does not support spanning operations.
>
> A layout that arranges its children into rows and columns. A
> TableLayout consists of a number of TableRow objects, each defining a
> row (actually, you can ... | I solved it by using ListView .Added a view to listView Header. Then inside the child for the list view I added two view .In the getView method of the custom adapter I incremented the position by one everytime.
P.S: If you want to implement the above view using endless adapter you will have to find a better solution. |
19,741,717 | I have to create UI using the Gridview. The image are dynamic since it is coming from the webservice .
I can define column number using the xml but the item at the zeroth index has to have one full image and then the rest should be divided into columns .
Any Help is appreciated. | 2013/11/02 | [
"https://Stackoverflow.com/questions/19741717",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1562755/"
] | Based on Jack K Fouani. Some changes that will save entire image from cropping:
```
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<!-- Large Image -->
<ImageView
... | you can use `GrideView` weight=1 and above of it add `ImageView`
for example if you want to use `GrideView` this is full example Layout
```
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="v... |
19,741,717 | I have to create UI using the Gridview. The image are dynamic since it is coming from the webservice .
I can define column number using the xml but the item at the zeroth index has to have one full image and then the rest should be divided into columns .
Any Help is appreciated. | 2013/11/02 | [
"https://Stackoverflow.com/questions/19741717",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1562755/"
] | I solved it by using ListView .Added a view to listView Header. Then inside the child for the list view I added two view .In the getView method of the custom adapter I incremented the position by one everytime.
P.S: If you want to implement the above view using endless adapter you will have to find a better solution. | you can use `GrideView` weight=1 and above of it add `ImageView`
for example if you want to use `GrideView` this is full example Layout
```
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="v... |
78,115 | Can I use 0000 steel wool to make a better uniform finish? | 2015/11/16 | [
"https://diy.stackexchange.com/questions/78115",
"https://diy.stackexchange.com",
"https://diy.stackexchange.com/users/45664/"
] | I would use a dual action orbital sander and wet/dry paper @1200 grit a very wet sponge to dampen the area dont press down let the sander float and as the streaks are cut out the residue will turn milky, keep wiping and moving this high grit with water will leave a mirror finish, I have used 800 & 1000 to remove larger... | Once the urethane has dried, sanding will only fog up the surface. You could sand it to remove any large imperfections and then put on another coat. If you were getting streaks you may want to work in a slightly cooler area so it takes longer to dry and you have more time to work with it. |
68,271,923 | I have a docker container that internally starts a server. (I don't own this. I am just reusing it)
Once the server starts, I am running some curl commands that hit this server.
I am running the above steps in a script. Here's the issue:
the docker container starts but internally I think it is taking some time to actu... | 2021/07/06 | [
"https://Stackoverflow.com/questions/68271923",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1593170/"
] | One way would be like this...
```
#calculate the sd for each row...
sds <- apply(m, 1, sd)
#generate all noise factors at once and just add to m...
m <- m + rnorm(nrow(m) * ncol(m), mean = 0, sd = sds * 0.05)
```
This works because `sds` will be recycled for each column. In general these matrix operations are very ... | This sould do the trick:
```
require(tidyverse)
set.seed(1)
m = matrix(rnorm(9), nrow = 3, ncol = 3)
> m
[,1] [,2] [,3]
[1,] -0.6264538 1.5952808 0.4874291
[2,] 0.1836433 0.3295078 0.7383247
[3,] -0.8356286 -0.8204684 0.5757814
```
Calculate `sd` by row
```
m_sd <- apply(m, 1, sd)
```
C... |
11,819,547 | I think that both the question and the answer here shouldn't be very complicated.
I have installed and configured the FOSUserBundle to use in a project with Symfony2.
What I need to know is where I tell the Security which page it has to redirect the user when they try to access to a forbidden url.
By default it is /... | 2012/08/05 | [
"https://Stackoverflow.com/questions/11819547",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/882150/"
] | It's not done by FOSUserBundle, but the Security system in Symfony2. You need to set the following in security.yml:
```
firewalls:
main:
form_login:
default_target_path: /path/to/redirect/to
```
EDIT:
Sorry, misread the question. Change login\_path to /admin like so:
```
firewalls:
main... | Ok
I got it!
It was more like:
```
main:
form_login:
login_path: /path/to/redirect/to
```
Thanks again |
2,337,767 | Let $V$ be a Euclidean vector space with an even dimension and
$f: V \to V$ an orthogonal mapping with $\det f= -1$.
Is it right, that $f$ has eigenvalues $1$ and $-1$?
because of $| \lambda |= 1$.
The determinant is the product of the eigenvalues, therefore there must be at least one $-1$.
Can you show me the proof... | 2017/06/27 | [
"https://math.stackexchange.com/questions/2337767",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/446663/"
] | Yes, but your argument is broken(\*). That the eigenvalues can be nothing else than $1$ and $-1$ follows from the orthogonality of $f$ and **not** the determinant being $-1$. That it actually has these eigenvalues follows from the determinant and even dimension.
Suppose that we have an eigenvector $u\ne0$ with eigenva... | It is not true that all the eigenvalues of $f$ are either $1$ or $-1$. The **real** eigenvalues are. For instance, the eigenvalues of the orthogonal matrix $$f=\begin{pmatrix}\cos\theta&-\sin\theta&0&0\\\sin\theta&\cos\theta&0&0\\0&0&1&0\\0&0&0&-1\\\end{pmatrix}$$
are: $\cos\theta+i\sin\theta,\ \cos\theta-i\sin\theta,\... |
2,337,767 | Let $V$ be a Euclidean vector space with an even dimension and
$f: V \to V$ an orthogonal mapping with $\det f= -1$.
Is it right, that $f$ has eigenvalues $1$ and $-1$?
because of $| \lambda |= 1$.
The determinant is the product of the eigenvalues, therefore there must be at least one $-1$.
Can you show me the proof... | 2017/06/27 | [
"https://math.stackexchange.com/questions/2337767",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/446663/"
] | Yes, but your argument is broken(\*). That the eigenvalues can be nothing else than $1$ and $-1$ follows from the orthogonality of $f$ and **not** the determinant being $-1$. That it actually has these eigenvalues follows from the determinant and even dimension.
Suppose that we have an eigenvector $u\ne0$ with eigenva... | No, real linear operators can have complex eigenvalues, and if you want to not consider those (which is reasonable because they don't have corresponding eigenvectors in your real vector space) then the determinant is not in general the product of all eigenvalues. (In case of a real orthogonal operator there is an addit... |
2,337,767 | Let $V$ be a Euclidean vector space with an even dimension and
$f: V \to V$ an orthogonal mapping with $\det f= -1$.
Is it right, that $f$ has eigenvalues $1$ and $-1$?
because of $| \lambda |= 1$.
The determinant is the product of the eigenvalues, therefore there must be at least one $-1$.
Can you show me the proof... | 2017/06/27 | [
"https://math.stackexchange.com/questions/2337767",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/446663/"
] | Yes, but your argument is broken(\*). That the eigenvalues can be nothing else than $1$ and $-1$ follows from the orthogonality of $f$ and **not** the determinant being $-1$. That it actually has these eigenvalues follows from the determinant and even dimension.
Suppose that we have an eigenvector $u\ne0$ with eigenva... | The eigenvalues of a real matrix, when considered as complex matrix all of whose entries happen to be real, either are real themselves, or come in complex conjugated pairs.
Since the determinant is the product of all eigenvalues, due to the conjugated pair property any complex eigenvalue $\lambda$ gives rise to the fa... |
6,000,812 | What is the algorithm for drawing line on the plane (pointwise), if it is not horizontal or vertical? | 2011/05/14 | [
"https://Stackoverflow.com/questions/6000812",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/603019/"
] | See [Bresenham's algorithm](http://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm). | There is no 'pointwise' algorithm - points are infinitesimally small, so any algorithm based on points would take an infinite time to complete.
Instead, lines are drawn based on a notional pen width and calculating how many and what intensity of pixels that stroking the line with a pen would cover.
If you merely wa... |
53,798,288 | I've been experimenting with Node JS recently and for some reason, my code does not continue onto the next step even though it is supposed to.
Here is my code:
```
const request = require('request');
var jssoup = require('jssoup').default;
const {Harvester} = require('captcha-manager');
const harvester = new Harvest... | 2018/12/15 | [
"https://Stackoverflow.com/questions/53798288",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10355744/"
] | According to me the method you are following is correct. The core purpose of *202 Accepted* status is that 'Request is accepted and the server will process it'.
Now the only problem I can see here is Until when? To answer that I recommend that you can add some calculation which will check the average time it takes to ... | An alternative way of looking at this, is maybe it's not a temporary resource. Maybe it's a regular resource that has a state that's incomplete.
If you consider it a real resource that will change states later, you don't have to think as much about using `202 Accepted`. The transaction you're creating 'exists', it jus... |
36,622,422 | Which is the better way to set a `Bitmap`, setting it in xml as background or setting it programmatically?
I'm encountering `Out of Memory` issue and sometime giving binary xml error.I have used background image of max size 500kb(xxhdpi). So I'm wondering which is the better way to set bitmap as background.
Setting b... | 2016/04/14 | [
"https://Stackoverflow.com/questions/36622422",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4082923/"
] | I agree with jrturton. It'll only work in highly controlled conditions **and with three beacons** and the result will be far from perfect. Here's what happens when you calculate with two beacons:
Just look at it as a triangle.
[](https://i.stack.imgu... | I've got a good result finally, in order if some one needs the solution:
I have considered the p1 and p2 as center of two circles.
Then I have calculated the distance between two centers (two points distance formula) like this: `double dx = (b.x-a.x);
double dy = (b.y-a.y);
double dist = sqrt(dx*dx + dy*dy);`
Then ... |
36,622,422 | Which is the better way to set a `Bitmap`, setting it in xml as background or setting it programmatically?
I'm encountering `Out of Memory` issue and sometime giving binary xml error.I have used background image of max size 500kb(xxhdpi). So I'm wondering which is the better way to set bitmap as background.
Setting b... | 2016/04/14 | [
"https://Stackoverflow.com/questions/36622422",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4082923/"
] | You can't. All the maths in the world won't change the fact that the RSSI reading you get from beacons fluctuates wildly and in response to dozens of factors outside of your control.
The best you can do is to roughly say which beacons you are near, and very roughly how near they are. Any attempt to be more precise th... | I've got a good result finally, in order if some one needs the solution:
I have considered the p1 and p2 as center of two circles.
Then I have calculated the distance between two centers (two points distance formula) like this: `double dx = (b.x-a.x);
double dy = (b.y-a.y);
double dist = sqrt(dx*dx + dy*dy);`
Then ... |
16,237,082 | I want to take grouped values (column: 'Criticality') from one table dbo.VTM\_duedate and next count values (column: 'DEVICE\_NAME') in another table dbo.TPM\_scan based on grouped values.
Table 1
```
USE tempdb;
GO
IF OBJECT_ID('dbo.VTM_duedate') IS NOT NULL
DROP TABLE dbo.VTM_duedate;
GO
CREATE TABLE dbo.VTM_dued... | 2013/04/26 | [
"https://Stackoverflow.com/questions/16237082",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2124434/"
] | ```
$yesterday = date("Y-m-d", strtotime('-1 day'));
$result = mysql_query("SELECT * FROM microcompany WHERE date='$yesterday' AND code='2.0.0'") or die(mysql_error());
``` | ```
$date = new DateTime('Yesterday');
echo $date->format('Y-m-d');
```
Or
```
$date = new DateTime('2013-01-28');
$date->modify('-1 day');
echo $date->format('Y-m-d');
```
FYI, [you shouldn't use `mysql_*` functions in new code](https://stackoverflow.com/q/12859942/). They are no longer maintained [and are offici... |
16,237,082 | I want to take grouped values (column: 'Criticality') from one table dbo.VTM\_duedate and next count values (column: 'DEVICE\_NAME') in another table dbo.TPM\_scan based on grouped values.
Table 1
```
USE tempdb;
GO
IF OBJECT_ID('dbo.VTM_duedate') IS NOT NULL
DROP TABLE dbo.VTM_duedate;
GO
CREATE TABLE dbo.VTM_dued... | 2013/04/26 | [
"https://Stackoverflow.com/questions/16237082",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2124434/"
] | ```
$yesterday = date("Y-m-d", strtotime('-1 day'));
$result = mysql_query("SELECT * FROM microcompany WHERE date='$yesterday' AND code='2.0.0'") or die(mysql_error());
``` | use native mysql functions for that purpose.
```
$result = mysql_query("SELECT * FROM microcompany WHERE
date=date_sub(date(now()), interval 1 day) AND code='2.0.0'")
or die(mysql_error());
``` |
16,237,082 | I want to take grouped values (column: 'Criticality') from one table dbo.VTM\_duedate and next count values (column: 'DEVICE\_NAME') in another table dbo.TPM\_scan based on grouped values.
Table 1
```
USE tempdb;
GO
IF OBJECT_ID('dbo.VTM_duedate') IS NOT NULL
DROP TABLE dbo.VTM_duedate;
GO
CREATE TABLE dbo.VTM_dued... | 2013/04/26 | [
"https://Stackoverflow.com/questions/16237082",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2124434/"
] | Why not use the MySQL function? They are meant to be used in MySQL.
```
SELECT * FROM microcompany WHERE date=DATE(DATE_SUB(NOW(), INTERVAL 1 DAY)) AND code='2.0.0'
```
btw. mysql-\* functions are deprecated: <http://www.php.net/manual/en/function.mysql-query.php> | ```
$date = new DateTime('Yesterday');
$fdate = $date->format('Y-m-d');
echo $fdate;
``` |
16,237,082 | I want to take grouped values (column: 'Criticality') from one table dbo.VTM\_duedate and next count values (column: 'DEVICE\_NAME') in another table dbo.TPM\_scan based on grouped values.
Table 1
```
USE tempdb;
GO
IF OBJECT_ID('dbo.VTM_duedate') IS NOT NULL
DROP TABLE dbo.VTM_duedate;
GO
CREATE TABLE dbo.VTM_dued... | 2013/04/26 | [
"https://Stackoverflow.com/questions/16237082",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2124434/"
] | Why not use the MySQL function? They are meant to be used in MySQL.
```
SELECT * FROM microcompany WHERE date=DATE(DATE_SUB(NOW(), INTERVAL 1 DAY)) AND code='2.0.0'
```
btw. mysql-\* functions are deprecated: <http://www.php.net/manual/en/function.mysql-query.php> | use native mysql functions for that purpose.
```
$result = mysql_query("SELECT * FROM microcompany WHERE
date=date_sub(date(now()), interval 1 day) AND code='2.0.0'")
or die(mysql_error());
``` |
16,237,082 | I want to take grouped values (column: 'Criticality') from one table dbo.VTM\_duedate and next count values (column: 'DEVICE\_NAME') in another table dbo.TPM\_scan based on grouped values.
Table 1
```
USE tempdb;
GO
IF OBJECT_ID('dbo.VTM_duedate') IS NOT NULL
DROP TABLE dbo.VTM_duedate;
GO
CREATE TABLE dbo.VTM_dued... | 2013/04/26 | [
"https://Stackoverflow.com/questions/16237082",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2124434/"
] | use native mysql functions for that purpose.
```
$result = mysql_query("SELECT * FROM microcompany WHERE
date=date_sub(date(now()), interval 1 day) AND code='2.0.0'")
or die(mysql_error());
``` | ```
<?php
$yesterday = date('Y-m-d', strtotime('-1 day',strtotime(date("y-m-d")) ));
$query = "SELECT * FROM microcompany WHERE date='".$yesterday."' AND code='2.0.0'";
$newQuery = 'update microcompany set date = "'.$yesterday.' where date = "'.$oldDate.'" and code ="2.0.0"';
?>
``` |
16,237,082 | I want to take grouped values (column: 'Criticality') from one table dbo.VTM\_duedate and next count values (column: 'DEVICE\_NAME') in another table dbo.TPM\_scan based on grouped values.
Table 1
```
USE tempdb;
GO
IF OBJECT_ID('dbo.VTM_duedate') IS NOT NULL
DROP TABLE dbo.VTM_duedate;
GO
CREATE TABLE dbo.VTM_dued... | 2013/04/26 | [
"https://Stackoverflow.com/questions/16237082",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2124434/"
] | Why not use the MySQL function? They are meant to be used in MySQL.
```
SELECT * FROM microcompany WHERE date=DATE(DATE_SUB(NOW(), INTERVAL 1 DAY)) AND code='2.0.0'
```
btw. mysql-\* functions are deprecated: <http://www.php.net/manual/en/function.mysql-query.php> | ```
$date = new DateTime('Yesterday');
echo $date->format('Y-m-d');
```
Or
```
$date = new DateTime('2013-01-28');
$date->modify('-1 day');
echo $date->format('Y-m-d');
```
FYI, [you shouldn't use `mysql_*` functions in new code](https://stackoverflow.com/q/12859942/). They are no longer maintained [and are offici... |
16,237,082 | I want to take grouped values (column: 'Criticality') from one table dbo.VTM\_duedate and next count values (column: 'DEVICE\_NAME') in another table dbo.TPM\_scan based on grouped values.
Table 1
```
USE tempdb;
GO
IF OBJECT_ID('dbo.VTM_duedate') IS NOT NULL
DROP TABLE dbo.VTM_duedate;
GO
CREATE TABLE dbo.VTM_dued... | 2013/04/26 | [
"https://Stackoverflow.com/questions/16237082",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2124434/"
] | ```
$yesterday = date("Y-m-d", strtotime('-1 day'));
$result = mysql_query("SELECT * FROM microcompany WHERE date='$yesterday' AND code='2.0.0'") or die(mysql_error());
``` | ```
$date = new DateTime('Yesterday');
$fdate = $date->format('Y-m-d');
echo $fdate;
``` |
16,237,082 | I want to take grouped values (column: 'Criticality') from one table dbo.VTM\_duedate and next count values (column: 'DEVICE\_NAME') in another table dbo.TPM\_scan based on grouped values.
Table 1
```
USE tempdb;
GO
IF OBJECT_ID('dbo.VTM_duedate') IS NOT NULL
DROP TABLE dbo.VTM_duedate;
GO
CREATE TABLE dbo.VTM_dued... | 2013/04/26 | [
"https://Stackoverflow.com/questions/16237082",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2124434/"
] | ```
$date = new DateTime('Yesterday');
$fdate = $date->format('Y-m-d');
echo $fdate;
``` | ```
<?php
$yesterday = date('Y-m-d', strtotime('-1 day',strtotime(date("y-m-d")) ));
$query = "SELECT * FROM microcompany WHERE date='".$yesterday."' AND code='2.0.0'";
$newQuery = 'update microcompany set date = "'.$yesterday.' where date = "'.$oldDate.'" and code ="2.0.0"';
?>
``` |
16,237,082 | I want to take grouped values (column: 'Criticality') from one table dbo.VTM\_duedate and next count values (column: 'DEVICE\_NAME') in another table dbo.TPM\_scan based on grouped values.
Table 1
```
USE tempdb;
GO
IF OBJECT_ID('dbo.VTM_duedate') IS NOT NULL
DROP TABLE dbo.VTM_duedate;
GO
CREATE TABLE dbo.VTM_dued... | 2013/04/26 | [
"https://Stackoverflow.com/questions/16237082",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2124434/"
] | Why not use the MySQL function? They are meant to be used in MySQL.
```
SELECT * FROM microcompany WHERE date=DATE(DATE_SUB(NOW(), INTERVAL 1 DAY)) AND code='2.0.0'
```
btw. mysql-\* functions are deprecated: <http://www.php.net/manual/en/function.mysql-query.php> | ```
<?php
$yesterday = date('Y-m-d', strtotime('-1 day',strtotime(date("y-m-d")) ));
$query = "SELECT * FROM microcompany WHERE date='".$yesterday."' AND code='2.0.0'";
$newQuery = 'update microcompany set date = "'.$yesterday.' where date = "'.$oldDate.'" and code ="2.0.0"';
?>
``` |
16,237,082 | I want to take grouped values (column: 'Criticality') from one table dbo.VTM\_duedate and next count values (column: 'DEVICE\_NAME') in another table dbo.TPM\_scan based on grouped values.
Table 1
```
USE tempdb;
GO
IF OBJECT_ID('dbo.VTM_duedate') IS NOT NULL
DROP TABLE dbo.VTM_duedate;
GO
CREATE TABLE dbo.VTM_dued... | 2013/04/26 | [
"https://Stackoverflow.com/questions/16237082",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2124434/"
] | ```
$date = new DateTime('Yesterday');
echo $date->format('Y-m-d');
```
Or
```
$date = new DateTime('2013-01-28');
$date->modify('-1 day');
echo $date->format('Y-m-d');
```
FYI, [you shouldn't use `mysql_*` functions in new code](https://stackoverflow.com/q/12859942/). They are no longer maintained [and are offici... | use native mysql functions for that purpose.
```
$result = mysql_query("SELECT * FROM microcompany WHERE
date=date_sub(date(now()), interval 1 day) AND code='2.0.0'")
or die(mysql_error());
``` |
5,401,262 | What is the most effective way to obtain a vector having a unique specified object property (not unique objects just objects with unique specified property).
If y needed to be a unique property
```
point.x = 2 point.y = 3
point.x = 3 point.y = 3
point.x = 4 point.y = 4
point.x = 4 point.y = 5
```
Could become:
```... | 2011/03/23 | [
"https://Stackoverflow.com/questions/5401262",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/506565/"
] | `Person` is an object with two functions - `Create` and `showMe`. In JavaScript, there are no classes, only objects, and this is how you write up an object - using 'Object Literal Notation' (the curly braces and functions/properties separated by commas).
`New` is a clever re-implementation of the `new` keyword. Instea... | ```
`Person` -- a variable w/ 'parts' (used loosely) `Person.Create` and `Person.showMe'
`Person.Create` -- function of `Person` that sets `Person.name` and `Person.age` to its arguments
`Person.showMe` -- returns a string explaining values of `Person.name` and `Person.age`
`New` -- a function intended to in... |
57,358,535 | I want to send push notification to the client app from the merchant app. Both are two different android apps. How can I achieve this using `FCM` or any other service?
Do I need to have both these apps in the same `Firebase` project or different firebase projects? | 2019/08/05 | [
"https://Stackoverflow.com/questions/57358535",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9290001/"
] | In order to send messages, use FCM Rest API
POST\_API\_URL: <https://fcm.googleapis.com/>
Header :
1) Authorization : key=legacy\_server\_key
2) Content-Type : application/json
Body:
{
"to":"receiver push token",
"notification":{
"title":"",
"body":""
},
"data":{
},
"android":{
"priority":"high"
},
"apns":{
"h... | You can do that either with one firebase project or two .. it dosen't really matter.. You should use a webservice (API) as a proxy to send notification.
In order to send messages you can use a set of languages or use a the rest API (hitting *<https://fcm.googleapis.com/fcm/send>*) provided by the [firebase documentati... |
6,957,683 | Why does Microsoft use extension methods for classes that it creates; instead of just adding the methods to the classes, or creating child classes? | 2011/08/05 | [
"https://Stackoverflow.com/questions/6957683",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/401173/"
] | There are a number of reason Microsoft did this. The two biggest being:
1. Extension methods apply to interfaces, not just classes. Had Microsoft simply added the Linq methods directly to IEnumerable, it would have required every concrete implementation of that interface to implement those methods as well. By making t... | My two cents:
because extension methods were added only in later versions of the .NET framework, they already had .NET Framework 1, 1.1, 2.0 and newer then at some point they added extension methods so they have used them to enrich the feature set on top of existing classes. |
6,957,683 | Why does Microsoft use extension methods for classes that it creates; instead of just adding the methods to the classes, or creating child classes? | 2011/08/05 | [
"https://Stackoverflow.com/questions/6957683",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/401173/"
] | `IgnoreRoute()` on `RouteCollection` is an extension method because it is intended for use with the MVC framework, rather than a core ASP.NET application. My guess would be that they didn't want to pollute the `RouteCollection` class with methods that non-MVC applications wouldn't need, while still allowing MVC applica... | My two cents:
because extension methods were added only in later versions of the .NET framework, they already had .NET Framework 1, 1.1, 2.0 and newer then at some point they added extension methods so they have used them to enrich the feature set on top of existing classes. |
6,957,683 | Why does Microsoft use extension methods for classes that it creates; instead of just adding the methods to the classes, or creating child classes? | 2011/08/05 | [
"https://Stackoverflow.com/questions/6957683",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/401173/"
] | This is an example of the [Non-Virtual Interface](https://stackoverflow.com/questions/6481260/non-virtual-interface-design-pattern-question-in-c-c) pattern (similar to [Template Method](http://en.wikipedia.org/wiki/Template_method_pattern)). This is a pattern used in languages with multiple (implementation) inheritance... | My two cents:
because extension methods were added only in later versions of the .NET framework, they already had .NET Framework 1, 1.1, 2.0 and newer then at some point they added extension methods so they have used them to enrich the feature set on top of existing classes. |
6,957,683 | Why does Microsoft use extension methods for classes that it creates; instead of just adding the methods to the classes, or creating child classes? | 2011/08/05 | [
"https://Stackoverflow.com/questions/6957683",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/401173/"
] | I think the main reason is that it's very easy to extend such methods. For example, if you Linq extension methods you can easily write yout own set of extension methods (maybe foreach or some specific filter) which will work greate with microsoft methods: mylist.Where(...).MyFilter(...).Select(...) | My two cents:
because extension methods were added only in later versions of the .NET framework, they already had .NET Framework 1, 1.1, 2.0 and newer then at some point they added extension methods so they have used them to enrich the feature set on top of existing classes. |
6,957,683 | Why does Microsoft use extension methods for classes that it creates; instead of just adding the methods to the classes, or creating child classes? | 2011/08/05 | [
"https://Stackoverflow.com/questions/6957683",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/401173/"
] | There are a number of reason Microsoft did this. The two biggest being:
1. Extension methods apply to interfaces, not just classes. Had Microsoft simply added the Linq methods directly to IEnumerable, it would have required every concrete implementation of that interface to implement those methods as well. By making t... | `IgnoreRoute()` on `RouteCollection` is an extension method because it is intended for use with the MVC framework, rather than a core ASP.NET application. My guess would be that they didn't want to pollute the `RouteCollection` class with methods that non-MVC applications wouldn't need, while still allowing MVC applica... |
6,957,683 | Why does Microsoft use extension methods for classes that it creates; instead of just adding the methods to the classes, or creating child classes? | 2011/08/05 | [
"https://Stackoverflow.com/questions/6957683",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/401173/"
] | There are a number of reason Microsoft did this. The two biggest being:
1. Extension methods apply to interfaces, not just classes. Had Microsoft simply added the Linq methods directly to IEnumerable, it would have required every concrete implementation of that interface to implement those methods as well. By making t... | This is an example of the [Non-Virtual Interface](https://stackoverflow.com/questions/6481260/non-virtual-interface-design-pattern-question-in-c-c) pattern (similar to [Template Method](http://en.wikipedia.org/wiki/Template_method_pattern)). This is a pattern used in languages with multiple (implementation) inheritance... |
6,957,683 | Why does Microsoft use extension methods for classes that it creates; instead of just adding the methods to the classes, or creating child classes? | 2011/08/05 | [
"https://Stackoverflow.com/questions/6957683",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/401173/"
] | There are a number of reason Microsoft did this. The two biggest being:
1. Extension methods apply to interfaces, not just classes. Had Microsoft simply added the Linq methods directly to IEnumerable, it would have required every concrete implementation of that interface to implement those methods as well. By making t... | I think the main reason is that it's very easy to extend such methods. For example, if you Linq extension methods you can easily write yout own set of extension methods (maybe foreach or some specific filter) which will work greate with microsoft methods: mylist.Where(...).MyFilter(...).Select(...) |
6,957,683 | Why does Microsoft use extension methods for classes that it creates; instead of just adding the methods to the classes, or creating child classes? | 2011/08/05 | [
"https://Stackoverflow.com/questions/6957683",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/401173/"
] | `IgnoreRoute()` on `RouteCollection` is an extension method because it is intended for use with the MVC framework, rather than a core ASP.NET application. My guess would be that they didn't want to pollute the `RouteCollection` class with methods that non-MVC applications wouldn't need, while still allowing MVC applica... | This is an example of the [Non-Virtual Interface](https://stackoverflow.com/questions/6481260/non-virtual-interface-design-pattern-question-in-c-c) pattern (similar to [Template Method](http://en.wikipedia.org/wiki/Template_method_pattern)). This is a pattern used in languages with multiple (implementation) inheritance... |
6,957,683 | Why does Microsoft use extension methods for classes that it creates; instead of just adding the methods to the classes, or creating child classes? | 2011/08/05 | [
"https://Stackoverflow.com/questions/6957683",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/401173/"
] | `IgnoreRoute()` on `RouteCollection` is an extension method because it is intended for use with the MVC framework, rather than a core ASP.NET application. My guess would be that they didn't want to pollute the `RouteCollection` class with methods that non-MVC applications wouldn't need, while still allowing MVC applica... | I think the main reason is that it's very easy to extend such methods. For example, if you Linq extension methods you can easily write yout own set of extension methods (maybe foreach or some specific filter) which will work greate with microsoft methods: mylist.Where(...).MyFilter(...).Select(...) |
28,955 | In Christianity, God's grace is what allows us to have a relationship with him. He gives us what we don't deserve like righteousness, life, and in the ultimate example his own son, in spite of our sin so that we might finally have eternal peace with him. And in light of God's grace Christians are expected give grace to... | 2015/12/03 | [
"https://islam.stackexchange.com/questions/28955",
"https://islam.stackexchange.com",
"https://islam.stackexchange.com/users/6581/"
] | I did not find a clear definition of grace (of Christianity). But, I can try relating different aspects of the definition I found in [wiki](https://en.wikipedia.org/wiki/Divine_grace#Christianity:_the_graces_of_the_Holy_Rosary) to that of Islam from mostly from Qur'an.
>
> Grace in Christianity is the free and unmeri... | In Islam the great and only lord "Allah" have mentioned that he is closer to us than our eyelashes and we can ask for anything we need directly from him rather than someone else. This shows that god is merciful and gives us whatever is right and good for us. He doesn't look at it whether we deserve it or not. And we be... |
28,955 | In Christianity, God's grace is what allows us to have a relationship with him. He gives us what we don't deserve like righteousness, life, and in the ultimate example his own son, in spite of our sin so that we might finally have eternal peace with him. And in light of God's grace Christians are expected give grace to... | 2015/12/03 | [
"https://islam.stackexchange.com/questions/28955",
"https://islam.stackexchange.com",
"https://islam.stackexchange.com/users/6581/"
] | There are several words related to mercy in Quran that don't have exact translations in English and all are translated to mercy but are not really the same.
Two of major names of God related to mercy in Quran are Ar-Rahman and Ar-Rahim. Typically Ar-Rahman is interpreted to mean the merciful towards all beings while A... | In Islam the great and only lord "Allah" have mentioned that he is closer to us than our eyelashes and we can ask for anything we need directly from him rather than someone else. This shows that god is merciful and gives us whatever is right and good for us. He doesn't look at it whether we deserve it or not. And we be... |
28,955 | In Christianity, God's grace is what allows us to have a relationship with him. He gives us what we don't deserve like righteousness, life, and in the ultimate example his own son, in spite of our sin so that we might finally have eternal peace with him. And in light of God's grace Christians are expected give grace to... | 2015/12/03 | [
"https://islam.stackexchange.com/questions/28955",
"https://islam.stackexchange.com",
"https://islam.stackexchange.com/users/6581/"
] | In Islam the great and only lord "Allah" have mentioned that he is closer to us than our eyelashes and we can ask for anything we need directly from him rather than someone else. This shows that god is merciful and gives us whatever is right and good for us. He doesn't look at it whether we deserve it or not. And we be... | In Islam, no one deserves anything, Allah first gifts His creatures with a talentive state, so that they will have requests, then will respond back their needs by mercy. The evolution from existing in posse toward completion is wholely based on Him being the Most Gracious (Ar-Rahman: الرحمن) and the Most Merciful (Ar-R... |
28,955 | In Christianity, God's grace is what allows us to have a relationship with him. He gives us what we don't deserve like righteousness, life, and in the ultimate example his own son, in spite of our sin so that we might finally have eternal peace with him. And in light of God's grace Christians are expected give grace to... | 2015/12/03 | [
"https://islam.stackexchange.com/questions/28955",
"https://islam.stackexchange.com",
"https://islam.stackexchange.com/users/6581/"
] | In Islam the great and only lord "Allah" have mentioned that he is closer to us than our eyelashes and we can ask for anything we need directly from him rather than someone else. This shows that god is merciful and gives us whatever is right and good for us. He doesn't look at it whether we deserve it or not. And we be... | Short answer: yes: "fa azallahum al shaytan"...the satan made them fall...from what? from the state of bliss that they were in by being allowed to be in the garden to eat of whatever was therein except "this tree." |
28,955 | In Christianity, God's grace is what allows us to have a relationship with him. He gives us what we don't deserve like righteousness, life, and in the ultimate example his own son, in spite of our sin so that we might finally have eternal peace with him. And in light of God's grace Christians are expected give grace to... | 2015/12/03 | [
"https://islam.stackexchange.com/questions/28955",
"https://islam.stackexchange.com",
"https://islam.stackexchange.com/users/6581/"
] | I did not find a clear definition of grace (of Christianity). But, I can try relating different aspects of the definition I found in [wiki](https://en.wikipedia.org/wiki/Divine_grace#Christianity:_the_graces_of_the_Holy_Rosary) to that of Islam from mostly from Qur'an.
>
> Grace in Christianity is the free and unmeri... | In Islam, no one deserves anything, Allah first gifts His creatures with a talentive state, so that they will have requests, then will respond back their needs by mercy. The evolution from existing in posse toward completion is wholely based on Him being the Most Gracious (Ar-Rahman: الرحمن) and the Most Merciful (Ar-R... |
28,955 | In Christianity, God's grace is what allows us to have a relationship with him. He gives us what we don't deserve like righteousness, life, and in the ultimate example his own son, in spite of our sin so that we might finally have eternal peace with him. And in light of God's grace Christians are expected give grace to... | 2015/12/03 | [
"https://islam.stackexchange.com/questions/28955",
"https://islam.stackexchange.com",
"https://islam.stackexchange.com/users/6581/"
] | I did not find a clear definition of grace (of Christianity). But, I can try relating different aspects of the definition I found in [wiki](https://en.wikipedia.org/wiki/Divine_grace#Christianity:_the_graces_of_the_Holy_Rosary) to that of Islam from mostly from Qur'an.
>
> Grace in Christianity is the free and unmeri... | Short answer: yes: "fa azallahum al shaytan"...the satan made them fall...from what? from the state of bliss that they were in by being allowed to be in the garden to eat of whatever was therein except "this tree." |
28,955 | In Christianity, God's grace is what allows us to have a relationship with him. He gives us what we don't deserve like righteousness, life, and in the ultimate example his own son, in spite of our sin so that we might finally have eternal peace with him. And in light of God's grace Christians are expected give grace to... | 2015/12/03 | [
"https://islam.stackexchange.com/questions/28955",
"https://islam.stackexchange.com",
"https://islam.stackexchange.com/users/6581/"
] | There are several words related to mercy in Quran that don't have exact translations in English and all are translated to mercy but are not really the same.
Two of major names of God related to mercy in Quran are Ar-Rahman and Ar-Rahim. Typically Ar-Rahman is interpreted to mean the merciful towards all beings while A... | In Islam, no one deserves anything, Allah first gifts His creatures with a talentive state, so that they will have requests, then will respond back their needs by mercy. The evolution from existing in posse toward completion is wholely based on Him being the Most Gracious (Ar-Rahman: الرحمن) and the Most Merciful (Ar-R... |
28,955 | In Christianity, God's grace is what allows us to have a relationship with him. He gives us what we don't deserve like righteousness, life, and in the ultimate example his own son, in spite of our sin so that we might finally have eternal peace with him. And in light of God's grace Christians are expected give grace to... | 2015/12/03 | [
"https://islam.stackexchange.com/questions/28955",
"https://islam.stackexchange.com",
"https://islam.stackexchange.com/users/6581/"
] | There are several words related to mercy in Quran that don't have exact translations in English and all are translated to mercy but are not really the same.
Two of major names of God related to mercy in Quran are Ar-Rahman and Ar-Rahim. Typically Ar-Rahman is interpreted to mean the merciful towards all beings while A... | Short answer: yes: "fa azallahum al shaytan"...the satan made them fall...from what? from the state of bliss that they were in by being allowed to be in the garden to eat of whatever was therein except "this tree." |
1,488,186 | Is it possible in C++ to stringify template arguments?
I tried this:
```
#include <iostream>
#define STRINGIFY(x) #x
template <typename T>
struct Stringify
{
Stringify()
{
std::cout << STRINGIFY(T) << endl;
}
};
int main()
{
Stringify<int> s;
}
```
But what I get is a `T`, and not an... | 2009/09/28 | [
"https://Stackoverflow.com/questions/1488186",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/177482/"
] | This breaks one of my primary tenets of C++ code writing: Avoid using tricks in both the template features and the preprocessor at the same time.
Part of the reason for templates and the nastiness they introduce into the language was an attempt to wean developers away from using the preprocessor. If you use both, then... | Here’s what I do: I have a `demangle()` function (implemented on top of `abi::__cxa_demangle()` which I call with a couple of convenience template function overloads, `nameof()`, with either the type I want stringified or an instance of same.
It’s fairly compact, so I’ll reproduce it here in all its glory. In `demang... |
1,488,186 | Is it possible in C++ to stringify template arguments?
I tried this:
```
#include <iostream>
#define STRINGIFY(x) #x
template <typename T>
struct Stringify
{
Stringify()
{
std::cout << STRINGIFY(T) << endl;
}
};
int main()
{
Stringify<int> s;
}
```
But what I get is a `T`, and not an... | 2009/09/28 | [
"https://Stackoverflow.com/questions/1488186",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/177482/"
] | Your code doesn't work because the preprocessor, responsible for searching and expanding the macros you use in your code, is not aware of the language itself. It is just a text parser. It finds that STRINGIFY(T) in the very function template and expand it, much before you give a type to that template. As it turns out, ... | If you use boost/core/demangle.hpp, you can get a reliable human-readable string.
```
char const * name = typeid(T).name();
boost::core::scoped_demangled_name demangled( name );
std::cout << (demangled.get() ? demangled.get() : "Failed to demangle") << std::endl;
``` |
1,488,186 | Is it possible in C++ to stringify template arguments?
I tried this:
```
#include <iostream>
#define STRINGIFY(x) #x
template <typename T>
struct Stringify
{
Stringify()
{
std::cout << STRINGIFY(T) << endl;
}
};
int main()
{
Stringify<int> s;
}
```
But what I get is a `T`, and not an... | 2009/09/28 | [
"https://Stackoverflow.com/questions/1488186",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/177482/"
] | You could use some template magic.
```
#include <iostream>
template <typename T>
struct TypeName { static const char *name; };
template <typename T>
const char *TypeName<T>::name = "unknown";
template <>
const char *TypeName<int>::name = "int";
template <typename T>
struct Stringify
{
Stringify()
{
... | No, you cannot work on types as if they were variables. You could write code that extracted the typeid() of an element and printed the name, but the resulting value will probably not be what you expect (type names are not standarized).
You can also work with template specializations (and some macro magic) to achieve a... |
1,488,186 | Is it possible in C++ to stringify template arguments?
I tried this:
```
#include <iostream>
#define STRINGIFY(x) #x
template <typename T>
struct Stringify
{
Stringify()
{
std::cout << STRINGIFY(T) << endl;
}
};
int main()
{
Stringify<int> s;
}
```
But what I get is a `T`, and not an... | 2009/09/28 | [
"https://Stackoverflow.com/questions/1488186",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/177482/"
] | No, you cannot work on types as if they were variables. You could write code that extracted the typeid() of an element and printed the name, but the resulting value will probably not be what you expect (type names are not standarized).
You can also work with template specializations (and some macro magic) to achieve a... | in my code I use the "awful" double-declaration of the "Class-Name"
```
MqFactoryC<MyServer>::Add("MyServer").Default();
```
because c++ is NOT able to extract the string "MyServer" from the template…
the only "way" to get "rid" of this… using a cpp "wrapper"
```
#define MQ_CPPSTR(s) #s
#define MqFactoryCAdd(T) MqF... |
1,488,186 | Is it possible in C++ to stringify template arguments?
I tried this:
```
#include <iostream>
#define STRINGIFY(x) #x
template <typename T>
struct Stringify
{
Stringify()
{
std::cout << STRINGIFY(T) << endl;
}
};
int main()
{
Stringify<int> s;
}
```
But what I get is a `T`, and not an... | 2009/09/28 | [
"https://Stackoverflow.com/questions/1488186",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/177482/"
] | You could try
```
typeid(T).name()
```
**Edit**: Fixed based on comments. | Here’s what I do: I have a `demangle()` function (implemented on top of `abi::__cxa_demangle()` which I call with a couple of convenience template function overloads, `nameof()`, with either the type I want stringified or an instance of same.
It’s fairly compact, so I’ll reproduce it here in all its glory. In `demang... |
1,488,186 | Is it possible in C++ to stringify template arguments?
I tried this:
```
#include <iostream>
#define STRINGIFY(x) #x
template <typename T>
struct Stringify
{
Stringify()
{
std::cout << STRINGIFY(T) << endl;
}
};
int main()
{
Stringify<int> s;
}
```
But what I get is a `T`, and not an... | 2009/09/28 | [
"https://Stackoverflow.com/questions/1488186",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/177482/"
] | You could use some template magic.
```
#include <iostream>
template <typename T>
struct TypeName { static const char *name; };
template <typename T>
const char *TypeName<T>::name = "unknown";
template <>
const char *TypeName<int>::name = "int";
template <typename T>
struct Stringify
{
Stringify()
{
... | Your code doesn't work because the preprocessor, responsible for searching and expanding the macros you use in your code, is not aware of the language itself. It is just a text parser. It finds that STRINGIFY(T) in the very function template and expand it, much before you give a type to that template. As it turns out, ... |
1,488,186 | Is it possible in C++ to stringify template arguments?
I tried this:
```
#include <iostream>
#define STRINGIFY(x) #x
template <typename T>
struct Stringify
{
Stringify()
{
std::cout << STRINGIFY(T) << endl;
}
};
int main()
{
Stringify<int> s;
}
```
But what I get is a `T`, and not an... | 2009/09/28 | [
"https://Stackoverflow.com/questions/1488186",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/177482/"
] | You could try
```
typeid(T).name()
```
**Edit**: Fixed based on comments. | No, you cannot work on types as if they were variables. You could write code that extracted the typeid() of an element and printed the name, but the resulting value will probably not be what you expect (type names are not standarized).
You can also work with template specializations (and some macro magic) to achieve a... |
1,488,186 | Is it possible in C++ to stringify template arguments?
I tried this:
```
#include <iostream>
#define STRINGIFY(x) #x
template <typename T>
struct Stringify
{
Stringify()
{
std::cout << STRINGIFY(T) << endl;
}
};
int main()
{
Stringify<int> s;
}
```
But what I get is a `T`, and not an... | 2009/09/28 | [
"https://Stackoverflow.com/questions/1488186",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/177482/"
] | You could try
```
typeid(T).name()
```
**Edit**: Fixed based on comments. | This breaks one of my primary tenets of C++ code writing: Avoid using tricks in both the template features and the preprocessor at the same time.
Part of the reason for templates and the nastiness they introduce into the language was an attempt to wean developers away from using the preprocessor. If you use both, then... |
1,488,186 | Is it possible in C++ to stringify template arguments?
I tried this:
```
#include <iostream>
#define STRINGIFY(x) #x
template <typename T>
struct Stringify
{
Stringify()
{
std::cout << STRINGIFY(T) << endl;
}
};
int main()
{
Stringify<int> s;
}
```
But what I get is a `T`, and not an... | 2009/09/28 | [
"https://Stackoverflow.com/questions/1488186",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/177482/"
] | You could try
```
typeid(T).name()
```
**Edit**: Fixed based on comments. | in my code I use the "awful" double-declaration of the "Class-Name"
```
MqFactoryC<MyServer>::Add("MyServer").Default();
```
because c++ is NOT able to extract the string "MyServer" from the template…
the only "way" to get "rid" of this… using a cpp "wrapper"
```
#define MQ_CPPSTR(s) #s
#define MqFactoryCAdd(T) MqF... |
1,488,186 | Is it possible in C++ to stringify template arguments?
I tried this:
```
#include <iostream>
#define STRINGIFY(x) #x
template <typename T>
struct Stringify
{
Stringify()
{
std::cout << STRINGIFY(T) << endl;
}
};
int main()
{
Stringify<int> s;
}
```
But what I get is a `T`, and not an... | 2009/09/28 | [
"https://Stackoverflow.com/questions/1488186",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/177482/"
] | You could use some template magic.
```
#include <iostream>
template <typename T>
struct TypeName { static const char *name; };
template <typename T>
const char *TypeName<T>::name = "unknown";
template <>
const char *TypeName<int>::name = "int";
template <typename T>
struct Stringify
{
Stringify()
{
... | This breaks one of my primary tenets of C++ code writing: Avoid using tricks in both the template features and the preprocessor at the same time.
Part of the reason for templates and the nastiness they introduce into the language was an attempt to wean developers away from using the preprocessor. If you use both, then... |
44,205,591 | I am using @angular v4.0.3 and webpack 2.2.0.
It was working fine using [Auler](http://ium.com/@evertonrobertoauler/angular-4-universal-app-with-angular-cli-db8b53bba07d) post but as I included localStorage it stopped working.
Is there any way to make it work or any module for localStorage in angular universal | 2017/05/26 | [
"https://Stackoverflow.com/questions/44205591",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6214945/"
] | A good way is to make `localStorage` an injectable and provide different implementations for it.
An abstract class that reflects [`Storage` API](https://github.com/Microsoft/TypeScript/blob/v2.3.3/lib/lib.d.ts#L15751-L15760) can be used as a token:
```
export abstract class LocalStorage {
readonly length: number;... | This happens because using Angular Universal for Server Side Rendering, the Angular app runs in both the Nodejs server and the client browser. At this point, the server app does not have a reference to the localStorage object, because it is only available on the client-side.
There's an article I wrote about this with ... |
974,186 | I feel like this should be easy, but I can't remember the technique that I should use to solve this.
How does one solve an integral like this:
$$\int\_0^\infty \frac x {(x+1)^3}$$ | 2014/10/15 | [
"https://math.stackexchange.com/questions/974186",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/184443/"
] | Try this
$${x\over (x +1)^3} = {x + 1\over(x + 1)^3} - {1\over(x+1)^3}. $$ | \begin{align\*}
& \int\_0^\infty \frac{x}{(x+1)^3} \mathrm{d} x \\
& = \int\_0^\infty \frac{x + 1 -1}{(x+1)^3} \mathrm{d} x \\
& = \int\_0^\infty \left( \frac{1}{(x+1)^2} - \frac{1}{(x+1)^3} \right) \mathrm{d} x \\
\end{align\*}
Now use the substitution $u = x+1$. |
974,186 | I feel like this should be easy, but I can't remember the technique that I should use to solve this.
How does one solve an integral like this:
$$\int\_0^\infty \frac x {(x+1)^3}$$ | 2014/10/15 | [
"https://math.stackexchange.com/questions/974186",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/184443/"
] | $$
\int\_0^\infty \frac{x}{(x+1)^3} \mathrm{d} x =\int\_1^\infty \frac{x-1}{x^3} \mathrm{d} x \\
=\left[-\frac1{x} + \frac12 \frac1{x^2}\right]\_1^{\infty}=\frac12
$$ | \begin{align\*}
& \int\_0^\infty \frac{x}{(x+1)^3} \mathrm{d} x \\
& = \int\_0^\infty \frac{x + 1 -1}{(x+1)^3} \mathrm{d} x \\
& = \int\_0^\infty \left( \frac{1}{(x+1)^2} - \frac{1}{(x+1)^3} \right) \mathrm{d} x \\
\end{align\*}
Now use the substitution $u = x+1$. |
59,989,280 | We have a situation in oracle SQL.
```
select x from A where x=10;
```
so if `10` exists in the column, value will be displayed `10`. but if it doesn't exists I want to display `null`. I tried `NVL` but it is not returning anything as data is not displaying.
Could you please help me to resolve this. | 2020/01/30 | [
"https://Stackoverflow.com/questions/59989280",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | If you want to return multiple rows from the original `SELECT` then you can use `UNION ALL` to add a row when the value does not exist:
```sql
SELECT x
FROM A
WHERE x = 10
UNION ALL
SELECT NULL
FROM DUAL
WHERE NOT EXISTS (
SELECT x
FROM A
WHERE x = 10
)
```
If your table is:
```sql
CREATE TABLE a ( x... | Try this:
```
select max(x)
from A
where x = 10; --this will return null if no data
```
And then you can do a NVL:
```
select nvl(max(x), 0)
from A
where x = 10; --this will return 0 if no data
``` |
59,989,280 | We have a situation in oracle SQL.
```
select x from A where x=10;
```
so if `10` exists in the column, value will be displayed `10`. but if it doesn't exists I want to display `null`. I tried `NVL` but it is not returning anything as data is not displaying.
Could you please help me to resolve this. | 2020/01/30 | [
"https://Stackoverflow.com/questions/59989280",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | If you want to return multiple rows from the original `SELECT` then you can use `UNION ALL` to add a row when the value does not exist:
```sql
SELECT x
FROM A
WHERE x = 10
UNION ALL
SELECT NULL
FROM DUAL
WHERE NOT EXISTS (
SELECT x
FROM A
WHERE x = 10
)
```
If your table is:
```sql
CREATE TABLE a ( x... | `Where` clause filter out the data what you are looking for, if it doesn't exists then query will return no record.
So, you can remove `where` clause & do aggregation :
```
select max(case when a.x = 10 then 10 end)
from a;
``` |
73,682,009 | I would like to make 3 radio buttons and I would like to get the value of checked one when I press a button.
```
<py-script>
<input id="rad1" name="choice" type="radio">
<label for="rad1">1</label>
<input id="rad2" name="choice" type="radio">
<label for="rad2">2</label>
<input id="rad3" name="choice" type="radio">
<la... | 2022/09/11 | [
"https://Stackoverflow.com/questions/73682009",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/389717/"
] | You may check every radio button separatelly and use `if/else` to set correct value
```
document.querySelector("#rad1").checked
document.querySelector("#rad2").checked
document.querySelector("#rad3").checked
```
But if you have the same name in all radio buttons then you can use `name` and pseudo-selector `:checke... | As someone in the comments said,
```
document.querySelector("#rad1").checked
```
should do the trick. You can do it this way in javascript and this is pretty much the same (ofc not identical but still). |
39,345,634 | I have tried `var res = str.replace(/ |,|.|/g, "");` and `var res = str.replace(/ |,|.|/gi, "");`. What am I missing here?
```js
var str = "Text with comma, space, and period.";
var res = str.replace(/ |,|.|/g, "");
document.write(res);
``` | 2016/09/06 | [
"https://Stackoverflow.com/questions/39345634",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6764260/"
] | If you just want to delete all spaces, commas and periods you can do it like that:
```
var res = str.replace(/[ ,.]/g, "");
```
You can also use the `|` operator, but in that case you have to escape the period, because a plain period will match with any character. As a general remark, if in a regular expression you ... | You need to escape dot `\.`:
```
"Text with comma, space and period.".replace(/ |,|\.|/g, "")
``` |
39,345,634 | I have tried `var res = str.replace(/ |,|.|/g, "");` and `var res = str.replace(/ |,|.|/gi, "");`. What am I missing here?
```js
var str = "Text with comma, space, and period.";
var res = str.replace(/ |,|.|/g, "");
document.write(res);
``` | 2016/09/06 | [
"https://Stackoverflow.com/questions/39345634",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6764260/"
] | You need to escape dot `\.`:
```
"Text with comma, space and period.".replace(/ |,|\.|/g, "")
``` | You can use these lines:
```
str = str.replace(/[ ,.]/g,'');
```
Plus i have added a fiddle for this at [Fiddle](https://jsfiddle.net/ac8Lh7tn/) |
39,345,634 | I have tried `var res = str.replace(/ |,|.|/g, "");` and `var res = str.replace(/ |,|.|/gi, "");`. What am I missing here?
```js
var str = "Text with comma, space, and period.";
var res = str.replace(/ |,|.|/g, "");
document.write(res);
``` | 2016/09/06 | [
"https://Stackoverflow.com/questions/39345634",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6764260/"
] | If you just want to delete all spaces, commas and periods you can do it like that:
```
var res = str.replace(/[ ,.]/g, "");
```
You can also use the `|` operator, but in that case you have to escape the period, because a plain period will match with any character. As a general remark, if in a regular expression you ... | You can use these lines:
```
str = str.replace(/[ ,.]/g,'');
```
Plus i have added a fiddle for this at [Fiddle](https://jsfiddle.net/ac8Lh7tn/) |
7,402,617 | I'm trying to copy a column with data from a table to another in MySQL. But I can't wrap my head around it. Both tables have an id column called 'nid' which fits perfectly.
I want to move the column called 'field\_pref\_position\_value' from the table 'content\_field\_pref\_position' to the column 'pref\_position' in ... | 2011/09/13 | [
"https://Stackoverflow.com/questions/7402617",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/935038/"
] | I think you have just named the same table twice:
```
UPDATE
content_type_player
SET
content_type_player.pref_position = content_field_pref_position.field_pref_position_value
FROM
content_field_**player**
JOIN
content_field_pref_position ON content_type_player.nid = content_field_pref_position.nid
``` | As suggested by @heximal
```
UPDATE
content_type_player
SET
b.pref_position = a.field_pref_position_value
FROM
content_field_pref_position a
content_type_player b
WHERE
a.nid = b.nid
``` |
7,402,617 | I'm trying to copy a column with data from a table to another in MySQL. But I can't wrap my head around it. Both tables have an id column called 'nid' which fits perfectly.
I want to move the column called 'field\_pref\_position\_value' from the table 'content\_field\_pref\_position' to the column 'pref\_position' in ... | 2011/09/13 | [
"https://Stackoverflow.com/questions/7402617",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/935038/"
] | I think you have just named the same table twice:
```
UPDATE
content_type_player
SET
content_type_player.pref_position = content_field_pref_position.field_pref_position_value
FROM
content_field_**player**
JOIN
content_field_pref_position ON content_type_player.nid = content_field_pref_position.nid
``` | As suggested by Nielsiano
```
UPDATE content_type_player JOIN content_field_pref_position ON content_field_pref_position.nid = content_type_player.nid SET content_type_player.pref_position = content_field_pref_position.field_pref_position_value
``` |
2,975,824 | In googling I can't seem to find an example of intercepting event on a proxied type and it doesn't seem to be working for me. Is there a way I can do this (ie. use an IInterceptor when an event is invoked)? | 2010/06/04 | [
"https://Stackoverflow.com/questions/2975824",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/326518/"
] | I've used this in a Universal app to determine if the code is running on an iPad
```
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
// Do iPad only stuff here
}
``` | Check out the documentation for [UIDevice](http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UIDevice_Class/Reference/UIDevice.html) |
2,975,824 | In googling I can't seem to find an example of intercepting event on a proxied type and it doesn't seem to be working for me. Is there a way I can do this (ie. use an IInterceptor when an event is invoked)? | 2010/06/04 | [
"https://Stackoverflow.com/questions/2975824",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/326518/"
] | Check out the documentation for [UIDevice](http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UIDevice_Class/Reference/UIDevice.html) | Look at `UIDevice` and it's properties. There is a `systemVersion` string that will work for what you want. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.