qid
int64
1
74.7M
question
stringlengths
0
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
2
48.3k
response_k
stringlengths
2
40.5k
53,452,226
In C++, if I try to do this: ``` std::function<void(bool,void)> ``` then the compiler will throw errors. Why is this? It's useful in many cases. One example: ``` //g++ -std=c++17 prblm.cpp #include <cstdio> #include <functional> template<class type_t> class some_callback { public: using callback_t = st...
2018/11/23
[ "https://Stackoverflow.com/questions/53452226", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10438811/" ]
*"Why is this?"* Because the only permitted usage of `void` in a parameter list is to show that the function doesn't accept any parameters. From [[function]](https://en.cppreference.com/w/cpp/language/function): > > `void` > > > Indicates that the function takes no parameters, it is the exact synonym for an empty...
Other answers have explained the why. This answers "is there a clean way around it?" What I usually do for callbacks is use lambdas. ``` std::function<void(void)> myfunc; bool b = false; int i = 42; myfunc = [&]() { if (b) ++i; }; ```
53,452,226
In C++, if I try to do this: ``` std::function<void(bool,void)> ``` then the compiler will throw errors. Why is this? It's useful in many cases. One example: ``` //g++ -std=c++17 prblm.cpp #include <cstdio> #include <functional> template<class type_t> class some_callback { public: using callback_t = st...
2018/11/23
[ "https://Stackoverflow.com/questions/53452226", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10438811/" ]
Variadic templates are one way to do this: ``` template <class... T> struct some_callback { std::function<void(bool, T...)> myfunc; }; using callback_with_just_bool = some_callback<>; using callback_with_an_int_too = some_callback<int>; ``` This is even cleaner with an alias template: ``` template <class... T> u...
Other answers have explained the why. This answers "is there a clean way around it?" What I usually do for callbacks is use lambdas. ``` std::function<void(void)> myfunc; bool b = false; int i = 42; myfunc = [&]() { if (b) ++i; }; ```
1,782,545
How / where do I store settings in a windows mobile 6 application (targeting compact framework 3.5)? Is there some mechanism like the properties.settings for desktop?
2009/11/23
[ "https://Stackoverflow.com/questions/1782545", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7021/" ]
Unfortunately, the System.Configuration is missing from .NET Compact Framework. You can use the [Smart Device Framework](http://www.opennetcf.com/Products/SmartDeviceFramework/tabid/65/Default.aspx) or you can just create a class that stores your settings and the save it and load it using a [XmlSerializer](http://msdn...
It would be best to use the config settings class to do the job for you. Alternatively, for more flexibility, use an INI class handler (there are a good few out there, look for Windows mobile platform portability). [Nini](http://nini.sourceforge.net/) would be your best bet! Hope this helps, Best regards, Tom.
1,782,545
How / where do I store settings in a windows mobile 6 application (targeting compact framework 3.5)? Is there some mechanism like the properties.settings for desktop?
2009/11/23
[ "https://Stackoverflow.com/questions/1782545", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7021/" ]
Or just store the stuff in the registry, which is what I ended up doing.
It would be best to use the config settings class to do the job for you. Alternatively, for more flexibility, use an INI class handler (there are a good few out there, look for Windows mobile platform portability). [Nini](http://nini.sourceforge.net/) would be your best bet! Hope this helps, Best regards, Tom.
115,147
Every time I go to break a block in Minecraft it opens the in-game menu. I don't know how to stop this from happening, any ideas?
2013/04/25
[ "https://gaming.stackexchange.com/questions/115147", "https://gaming.stackexchange.com", "https://gaming.stackexchange.com/users/47528/" ]
Try looking at your controls, I think that you have it so that if you left-click it opens the menu instead of Esc.
It's a Java bug. Try downloading and installing a different (newer, older, whatever) Java VM. As a workaround, hit more slowly, one click at a time. The bug seems to trigger when you hold the mouse button down for repeated clicks.
6,013,339
How do I turn this, which uses two calls two `children`: ``` $('#id tr').children('td').children('input') ``` into something that calls children only once? I am trying to select every input text box inside a particular table row (`tr`) that's a child of `#id`. I've tried ``` $('#id tr').children('td input') ``` a...
2011/05/16
[ "https://Stackoverflow.com/questions/6013339", "https://Stackoverflow.com", "https://Stackoverflow.com/users/726361/" ]
Although I like the `$("#id tr td input")` suggestions, in some cases (e.g. if you had the `$("#id tr")` object from some other source) you might instead be looking for [`.find()`](http://api.jquery.com/find/), which goes multiple levels deep (instead of `.children()` which only goes one): ``` $("#id tr").find("td inp...
Why not just `$('#id tr input')`? Or maybe `$('#id input')`
6,013,339
How do I turn this, which uses two calls two `children`: ``` $('#id tr').children('td').children('input') ``` into something that calls children only once? I am trying to select every input text box inside a particular table row (`tr`) that's a child of `#id`. I've tried ``` $('#id tr').children('td input') ``` a...
2011/05/16
[ "https://Stackoverflow.com/questions/6013339", "https://Stackoverflow.com", "https://Stackoverflow.com/users/726361/" ]
Why not just `$('#id tr input')`? Or maybe `$('#id input')`
U can set a class for your inputs and select it `$('#id tr').children('td:input').hasclass('class name')`
6,013,339
How do I turn this, which uses two calls two `children`: ``` $('#id tr').children('td').children('input') ``` into something that calls children only once? I am trying to select every input text box inside a particular table row (`tr`) that's a child of `#id`. I've tried ``` $('#id tr').children('td input') ``` a...
2011/05/16
[ "https://Stackoverflow.com/questions/6013339", "https://Stackoverflow.com", "https://Stackoverflow.com/users/726361/" ]
Why not just `$('#id tr input')`? Or maybe `$('#id input')`
I'm amazed no one suggested this one: ``` $('td input', '#idc tr') ``` Which will allow you to have the `#idc tr` part from a variable. Basically what you're doing is doing a concatenation; so you read the right selector first, and then the left one, for instance: ``` $('> input', 'div') ``` Is the equivalent of:...
6,013,339
How do I turn this, which uses two calls two `children`: ``` $('#id tr').children('td').children('input') ``` into something that calls children only once? I am trying to select every input text box inside a particular table row (`tr`) that's a child of `#id`. I've tried ``` $('#id tr').children('td input') ``` a...
2011/05/16
[ "https://Stackoverflow.com/questions/6013339", "https://Stackoverflow.com", "https://Stackoverflow.com/users/726361/" ]
Although I like the `$("#id tr td input")` suggestions, in some cases (e.g. if you had the `$("#id tr")` object from some other source) you might instead be looking for [`.find()`](http://api.jquery.com/find/), which goes multiple levels deep (instead of `.children()` which only goes one): ``` $("#id tr").find("td inp...
U can set a class for your inputs and select it `$('#id tr').children('td:input').hasclass('class name')`
6,013,339
How do I turn this, which uses two calls two `children`: ``` $('#id tr').children('td').children('input') ``` into something that calls children only once? I am trying to select every input text box inside a particular table row (`tr`) that's a child of `#id`. I've tried ``` $('#id tr').children('td input') ``` a...
2011/05/16
[ "https://Stackoverflow.com/questions/6013339", "https://Stackoverflow.com", "https://Stackoverflow.com/users/726361/" ]
Although I like the `$("#id tr td input")` suggestions, in some cases (e.g. if you had the `$("#id tr")` object from some other source) you might instead be looking for [`.find()`](http://api.jquery.com/find/), which goes multiple levels deep (instead of `.children()` which only goes one): ``` $("#id tr").find("td inp...
I'm amazed no one suggested this one: ``` $('td input', '#idc tr') ``` Which will allow you to have the `#idc tr` part from a variable. Basically what you're doing is doing a concatenation; so you read the right selector first, and then the left one, for instance: ``` $('> input', 'div') ``` Is the equivalent of:...
6,013,339
How do I turn this, which uses two calls two `children`: ``` $('#id tr').children('td').children('input') ``` into something that calls children only once? I am trying to select every input text box inside a particular table row (`tr`) that's a child of `#id`. I've tried ``` $('#id tr').children('td input') ``` a...
2011/05/16
[ "https://Stackoverflow.com/questions/6013339", "https://Stackoverflow.com", "https://Stackoverflow.com/users/726361/" ]
I'm amazed no one suggested this one: ``` $('td input', '#idc tr') ``` Which will allow you to have the `#idc tr` part from a variable. Basically what you're doing is doing a concatenation; so you read the right selector first, and then the left one, for instance: ``` $('> input', 'div') ``` Is the equivalent of:...
U can set a class for your inputs and select it `$('#id tr').children('td:input').hasclass('class name')`
61,278
What method do you use when you want to get performance data about specific code paths?
2008/09/14
[ "https://Stackoverflow.com/questions/61278", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3848/" ]
I do my profiles by creating two classes: `cProfile` and `cProfileManager`. `cProfileManager` will hold all the data that resulted from `cProfile`. `cProfile` with have the following requirements: * `cProfile` has a constructor which initializes the current time. * `cProfile` has a deconstructor which sends the tota...
I have a quick-and-dirty profiling class that can be used in profiling in even the most tight inner loops. The emphasis is on extreme light weight and simple code. The class allocates a two-dimensional array of fixed size. I then add "checkpoint" calls all over the place. When checkpoint N is reached immediately after ...
61,278
What method do you use when you want to get performance data about specific code paths?
2008/09/14
[ "https://Stackoverflow.com/questions/61278", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3848/" ]
This method has several limitations, but I still find it very useful. I'll list the limitations (I know of) up front and let whoever wants to use it do so at their own risk. 1. The original version I posted over-reported time spent in recursive calls (as pointed out in the comments to the answer). 2. It's not thread s...
I do my profiles by creating two classes: `cProfile` and `cProfileManager`. `cProfileManager` will hold all the data that resulted from `cProfile`. `cProfile` with have the following requirements: * `cProfile` has a constructor which initializes the current time. * `cProfile` has a deconstructor which sends the tota...
61,278
What method do you use when you want to get performance data about specific code paths?
2008/09/14
[ "https://Stackoverflow.com/questions/61278", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3848/" ]
Note, the following is all written specifically for Windows. I also have a timer class that I wrote to do quick-and-dirty profiling that uses QueryPerformanceCounter() to get high-precision timings, but with a slight difference. My timer class doesn't dump the elapsed time when the Timer object falls out of scope. Ins...
The article *Code profiler and optimizations* has lots of information about C++ code profiling and also has a free download link to a program/class that will show you a graphic presentation for different code paths/methods.
61,278
What method do you use when you want to get performance data about specific code paths?
2008/09/14
[ "https://Stackoverflow.com/questions/61278", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3848/" ]
I do my profiles by creating two classes: `cProfile` and `cProfileManager`. `cProfileManager` will hold all the data that resulted from `cProfile`. `cProfile` with have the following requirements: * `cProfile` has a constructor which initializes the current time. * `cProfile` has a deconstructor which sends the tota...
The article *Code profiler and optimizations* has lots of information about C++ code profiling and also has a free download link to a program/class that will show you a graphic presentation for different code paths/methods.
61,278
What method do you use when you want to get performance data about specific code paths?
2008/09/14
[ "https://Stackoverflow.com/questions/61278", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3848/" ]
Note, the following is all written specifically for Windows. I also have a timer class that I wrote to do quick-and-dirty profiling that uses QueryPerformanceCounter() to get high-precision timings, but with a slight difference. My timer class doesn't dump the elapsed time when the Timer object falls out of scope. Ins...
I wrote a simple cross-platform class called [nanotimer](http://www.plflib.org/nanotimer.htm) for this reason. The goal was to be as lightweight as possible so as to not interfere with actual code performance by adding too many instructions and thereby influencing the instruction cache. It is capable of getting microse...
61,278
What method do you use when you want to get performance data about specific code paths?
2008/09/14
[ "https://Stackoverflow.com/questions/61278", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3848/" ]
This method has several limitations, but I still find it very useful. I'll list the limitations (I know of) up front and let whoever wants to use it do so at their own risk. 1. The original version I posted over-reported time spent in recursive calls (as pointed out in the comments to the answer). 2. It's not thread s...
Note, the following is all written specifically for Windows. I also have a timer class that I wrote to do quick-and-dirty profiling that uses QueryPerformanceCounter() to get high-precision timings, but with a slight difference. My timer class doesn't dump the elapsed time when the Timer object falls out of scope. Ins...
61,278
What method do you use when you want to get performance data about specific code paths?
2008/09/14
[ "https://Stackoverflow.com/questions/61278", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3848/" ]
Well, I have two code snippets. In [pseudocode](http://en.wikipedia.org/wiki/Pseudocode) they are looking like (it's a simplified version, I'm using [QueryPerformanceFrequency](http://msdn.microsoft.com/en-us/library/windows/desktop/ms644905%28v=vs.85%29.aspx) actually): ### First snippet: ``` Timer timer = new Timer...
The article *Code profiler and optimizations* has lots of information about C++ code profiling and also has a free download link to a program/class that will show you a graphic presentation for different code paths/methods.
61,278
What method do you use when you want to get performance data about specific code paths?
2008/09/14
[ "https://Stackoverflow.com/questions/61278", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3848/" ]
I do my profiles by creating two classes: `cProfile` and `cProfileManager`. `cProfileManager` will hold all the data that resulted from `cProfile`. `cProfile` with have the following requirements: * `cProfile` has a constructor which initializes the current time. * `cProfile` has a deconstructor which sends the tota...
I wrote a simple cross-platform class called [nanotimer](http://www.plflib.org/nanotimer.htm) for this reason. The goal was to be as lightweight as possible so as to not interfere with actual code performance by adding too many instructions and thereby influencing the instruction cache. It is capable of getting microse...
61,278
What method do you use when you want to get performance data about specific code paths?
2008/09/14
[ "https://Stackoverflow.com/questions/61278", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3848/" ]
Well, I have two code snippets. In [pseudocode](http://en.wikipedia.org/wiki/Pseudocode) they are looking like (it's a simplified version, I'm using [QueryPerformanceFrequency](http://msdn.microsoft.com/en-us/library/windows/desktop/ms644905%28v=vs.85%29.aspx) actually): ### First snippet: ``` Timer timer = new Timer...
I wrote a simple cross-platform class called [nanotimer](http://www.plflib.org/nanotimer.htm) for this reason. The goal was to be as lightweight as possible so as to not interfere with actual code performance by adding too many instructions and thereby influencing the instruction cache. It is capable of getting microse...
61,278
What method do you use when you want to get performance data about specific code paths?
2008/09/14
[ "https://Stackoverflow.com/questions/61278", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3848/" ]
This method has several limitations, but I still find it very useful. I'll list the limitations (I know of) up front and let whoever wants to use it do so at their own risk. 1. The original version I posted over-reported time spent in recursive calls (as pointed out in the comments to the answer). 2. It's not thread s...
I wrote a simple cross-platform class called [nanotimer](http://www.plflib.org/nanotimer.htm) for this reason. The goal was to be as lightweight as possible so as to not interfere with actual code performance by adding too many instructions and thereby influencing the instruction cache. It is capable of getting microse...
74,558,080
This is a true story of evolving code. We began with many classes based on this structure: ``` class Base { public: virtual void doSomething() {} }; class Derived : public Base { public: void doSomething() override { Base::doSomething(); // Do the basics // Do other derived things } ...
2022/11/24
[ "https://Stackoverflow.com/questions/74558080", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2181250/" ]
What I can suggest is `parent` typedef in `Derived`: ``` class Base { public: virtual void doSomething() {} }; class Derived : public Base { private: typedef Base parent; public: void doSomething() override { parent::doSomething(); // Do the basics // Do other derived things } };...
I think this question is related to: [Using "super" in C++](https://stackoverflow.com/questions/180601/using-super-in-c) I've seen projects, where the direct parent of the current class is mentioned as a "SUPER" typedef in the class header. This makes code-changes with new intermediate classes easier. Not bulletproof,...
16,832,999
I have an array an elements. They have similar id: ``` Step2_Visits_0__CountryCode Step2_Visits_1__CountryCode Step2_Visits_2__CountryCode Step2_Visits_3__CountryCode Step2_Visits_4__CountryCode ``` This array names as "visitCountries". I use "loop for" and append after each element tag . For example: ``` for(var...
2013/05/30
[ "https://Stackoverflow.com/questions/16832999", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1129783/" ]
PopupWindow already has its own dismiss listener, just use it as follows ``` Popup popup = new Popup(getBaseContext()); popup.show(arg1); ``` Change that to ``` Popup popup = new Popup(getBaseContext()); popup.setOnDismissListener(new PopupWindow.OnDismissListener() { @Override public void ...
**EDIT** I hadn't noticed you were extending a PopupWindow, which already has this implemented as shown in @Jayabal's answer. Anyway this is how you would do it if the PopupWindow didn't already have it's own onDismissListener. Simply create your own OnDismissListener Interface. ``` public interface onDismissListener...
38,018,112
I don't have much experience with jquery so excuse my ignorance. I'm trying to make a FAQ where the answer appears when the question is clicked. Here's some test code. Obviously I'm not doing the jquery right because it's not working. ``` <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.or...
2016/06/24
[ "https://Stackoverflow.com/questions/38018112", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4458077/" ]
Using jQuery's next() method (<http://api.jquery.com/next/>) will let you work with the li following the one you clicked on. Note that I used show() instead of addClass('open') because I don't know what's in your open class - slideUp() is going to add display:none to all of the answers, so you have to make sure your ...
``` $(document).ready(function(){ $('.answer').hide(); $('.question').on('click', function() { $('.answer').toggle('show'); }); }); ``` You wanna something like this if I got you right. <https://jsfiddle.net/mprzmb7b/1/>
5,509,803
How can I convert a string like `'\\x41'` to an escaped string like `'\x41'`, using Python?
2011/04/01
[ "https://Stackoverflow.com/questions/5509803", "https://Stackoverflow.com", "https://Stackoverflow.com/users/363249/" ]
``` >>> '\\x41'.decode('string_escape') 'A' ``` Gory details [here](http://docs.python.org/library/codecs.html#standard-encodings).
I don't really understand your question, but I'll try to give you some solutions. 1. If you gonna print pure '\x41', you could just > > `print r'\x41'` > > > 1. And if what you want is to print the 'A' out, pls do: > > `print u'\x41'` > > >
28,031,165
I'm trying to get information out of this Dictionary that was created from a JSON string. The JSON string is returned from the server and is put in a dictionary. That dictionary is passed to myMethod that is suppose to break it down so I can get the information that each record contains. The "Recordset" is an Array. ...
2015/01/19
[ "https://Stackoverflow.com/questions/28031165", "https://Stackoverflow.com", "https://Stackoverflow.com/users/995931/" ]
Try this ``` NSArray * arrRecord = [arrRecordSet objectForKey:@"Record"]; ```
Try to check first if the return of [dictionary objectForKey:@"Recordset"] is really a dictionary or an array. To do this: ``` if([[dictionary objectForKey:@"Recordset"] isKindOfClass:[NSArray class]]) { //object is array } else if ([[dictionary objectForKey:@"Recordset"] isKindOfClass:[NSDiction...
12,521,930
I have a image inputted in the css with the following code: ``` .imgtemp { float:right; top:0px; left:0px; overflow:visible; width:100%; } ``` I have also added the div tag to the page so its displaying, but the image is wider than the div due to the des...
2012/09/20
[ "https://Stackoverflow.com/questions/12521930", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1682435/" ]
You should place `overflow:visible` on your div, not on an image.
``` .contact__section{ // your container width: 100%; display: block; overflow: hidden; // hide in case your XL image is too high to keep other sections of page neat } .contact__flexbox{ position: relative; // you may not need it display: block; // for mobile size, or none; if not want to display o...
12,521,930
I have a image inputted in the css with the following code: ``` .imgtemp { float:right; top:0px; left:0px; overflow:visible; width:100%; } ``` I have also added the div tag to the page so its displaying, but the image is wider than the div due to the des...
2012/09/20
[ "https://Stackoverflow.com/questions/12521930", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1682435/" ]
As Nelson said, overflow: hidden on your image won't help you. If you absolutely must have the container be smaller than the image inside it, you can use positioning (relative on the parent div, absolute on the image with a top and left of 0, for example) to ignore its parent's size. You'll want to use something other ...
``` .contact__section{ // your container width: 100%; display: block; overflow: hidden; // hide in case your XL image is too high to keep other sections of page neat } .contact__flexbox{ position: relative; // you may not need it display: block; // for mobile size, or none; if not want to display o...
49,802
I am in a home loan with my ex-partner in joint tenancy. She is the primary on the loan paperwork. I would like to remove myself from the loan. Is that possible? She does not want to refinance in her name only but rather just remove me from the original which I am fine with.
2015/07/12
[ "https://money.stackexchange.com/questions/49802", "https://money.stackexchange.com", "https://money.stackexchange.com/users/30310/" ]
This will be up to the bank. Ask them, but if they are unwilling then refinancing or selling the house are the only other options. Even changing the title does not release you from the loan obligation.
Both people are responsible for the loan, it doesn't matter who is prime. The lender can ding both parties credit reports for failure to pay. It can force payment from either party. They are unlikely to want to let one party out of the deal unless they have done an updated review of the solo persons finances and credi...
151,126
I need to put a quote in my research paper. My friends give me different answers so I'm confused now... Would it be > > According to "Title", "blah blah blah." > > > or > > According to "Title," "blah blah blah." > > >
2014/02/11
[ "https://english.stackexchange.com/questions/151126", "https://english.stackexchange.com", "https://english.stackexchange.com/users/65365/" ]
Depends on the context. Imagine the sentence doesn't have quotes: > > According to Fred, astrophysics is a rapidly growing field. > > > You can substitute "Fred" for anything, including some title. Note that the comma would be where it is, regardless of what you substitute for the word Fred. The comma is not part...
In American English, according to most style manuals, punctuation marks are placed inside of the quotes. For more information see [here](https://www.grammarbook.com/punctuation/quotes.asp) and [here](http://blog.apastyle.org/apastyle/2011/08/punctuating-around-quotation-marks.html).
63,946
Hi I just wanted some feedback on a DDOS preventing php script that I'm designing. It quite simple and I wanted some feedback on whether you guys think it would be effective. I'm currently using the [ulogin framework](http://ulogin.sourceforge.net/) as a base and have implemented API Key's. At the moment the user will...
2014/07/25
[ "https://security.stackexchange.com/questions/63946", "https://security.stackexchange.com", "https://security.stackexchange.com/users/-1/" ]
Your code is good for monitoring users activity on the server but to be honest, It can't help preventing DDOS attacks since the aim of DDOS attacks is to send tons of requests to the server to make it too busy to respond to its intended users. your code seems to be doing lots of checking to determine if the number o...
the hosting company won't do a lot for you in terms of DDoS. As soon as it gets to large (which with most hosting is small) and/or floods the ISP they will blackhole you. Try something like Prolexic or Akamai (the later doing API with their new release). good luck.
17,239,204
Note that I am working in C++03, and the `delete`d functions of C++11 are not available to me. I am attempting to design a non-copyable object, and prevent the compiler from considering the implicitly-declared copy constructor on that class. This is for a unit test fixture I am developing. Consider that I have two ma...
2013/06/21
[ "https://Stackoverflow.com/questions/17239204", "https://Stackoverflow.com", "https://Stackoverflow.com/users/241536/" ]
Your ambiguity is that `*this` can bind to both a `Root &` and a `Fixture &`, and both conversions are equally good (namely derived-to-base conversions). The trick is to create an overload that's a *better* match. For example, ``` template <typename T> Fixture(T &) ``` is will match any lvalue *exactly*, and thus ...
There is no way to prevent the existence of the copy constructor signature, not in C++98, and not in C++11 either. `= delete` does not remove something from the overload set either, it only fails if it is selected. I have no better idea than to insert the explicit cast if you don't want to mess with the public interfa...
17,239,204
Note that I am working in C++03, and the `delete`d functions of C++11 are not available to me. I am attempting to design a non-copyable object, and prevent the compiler from considering the implicitly-declared copy constructor on that class. This is for a unit test fixture I am developing. Consider that I have two ma...
2013/06/21
[ "https://Stackoverflow.com/questions/17239204", "https://Stackoverflow.com", "https://Stackoverflow.com/users/241536/" ]
Your ambiguity is that `*this` can bind to both a `Root &` and a `Fixture &`, and both conversions are equally good (namely derived-to-base conversions). The trick is to create an overload that's a *better* match. For example, ``` template <typename T> Fixture(T &) ``` is will match any lvalue *exactly*, and thus ...
If you're not going to pass around `Branch` as an instance of `Fixture`, there is no need for inheriting it at all. What you basically would like to do is be able to set something up in `Fixture` for all instances of `Root`, if I'm not mistaken. So lets attack that cause, instead of bending C++. **DISCLAIMER**: If it's...
11,036,482
I'm using the following to insert company data into a mysql table. Is is possible to check if the company is already in the database first before it tries to enter it in again? The php variable `$company` is what I want to check against. ``` <?php require("database.php"); // Opens a connection to a MySQL se...
2012/06/14
[ "https://Stackoverflow.com/questions/11036482", "https://Stackoverflow.com", "https://Stackoverflow.com/users/609630/" ]
1. Do a select statement to see if they are in there before doing the insert 2. (Not recommended) make the name field (or any other field that idnentifies a company, a unique key so when you try to enter it again it is rejected
The natural solution would be to run another query prior (e.g. select count()) to check if the marker exists, and branch your conditional logic from there. A more interesting solution would be to use the concept of an **UPSERT** (Update + Insert). An upsert inserts the row if it doesn't exist, and updates it if it doe...
11,036,482
I'm using the following to insert company data into a mysql table. Is is possible to check if the company is already in the database first before it tries to enter it in again? The php variable `$company` is what I want to check against. ``` <?php require("database.php"); // Opens a connection to a MySQL se...
2012/06/14
[ "https://Stackoverflow.com/questions/11036482", "https://Stackoverflow.com", "https://Stackoverflow.com/users/609630/" ]
Try the following. Basically, sending another query to check for a duplicate row with the same company name and if the query returns 0 rows then only run the insert command. ``` <?php require("database.php"); // Opens a connection to a MySQL server $con = mysql_connect("localhost", $username, $password); if (!$con) {...
1. Do a select statement to see if they are in there before doing the insert 2. (Not recommended) make the name field (or any other field that idnentifies a company, a unique key so when you try to enter it again it is rejected
11,036,482
I'm using the following to insert company data into a mysql table. Is is possible to check if the company is already in the database first before it tries to enter it in again? The php variable `$company` is what I want to check against. ``` <?php require("database.php"); // Opens a connection to a MySQL se...
2012/06/14
[ "https://Stackoverflow.com/questions/11036482", "https://Stackoverflow.com", "https://Stackoverflow.com/users/609630/" ]
Try the following. Basically, sending another query to check for a duplicate row with the same company name and if the query returns 0 rows then only run the insert command. ``` <?php require("database.php"); // Opens a connection to a MySQL server $con = mysql_connect("localhost", $username, $password); if (!$con) {...
The natural solution would be to run another query prior (e.g. select count()) to check if the marker exists, and branch your conditional logic from there. A more interesting solution would be to use the concept of an **UPSERT** (Update + Insert). An upsert inserts the row if it doesn't exist, and updates it if it doe...
24,166,616
What is the correct way to return a string when no results are returned. The following isn't working ``` SELECT TOP 1 CASE WHEN CustomerName IS NULL THEN 'Unknown' WHEN CustomerName = '' THEN 'Unknown' ELSE CustomerName END AS CustomerName FROM CUSTOMER WHERE Cust...
2014/06/11
[ "https://Stackoverflow.com/questions/24166616", "https://Stackoverflow.com", "https://Stackoverflow.com/users/974840/" ]
It seems you want to return `Unknown` when there are no rows in your table that have `CustomerName` that's not `NULL` or not `''`. ``` SELECT COALESCE((SELECT TOP 1 CustomerName FROM CUSTOMER WHERE CustomerCode = 222 AND CustomerName IS NOT NULL AND CustomerName <> ''),'Unknown') C...
Try this may be it's work.. ``` SELECT DISTINCT TOP 1 CASE WHEN ISNULL(CustomerName,'') <>'' THEN CustomerName ELSE 'Unknown' END as CustomerName FROM CUSTOMER WHERE CustomerCode = 222 ``` or ``` SELECT TOP 1 CustomerName FROM (SELECT DISTINCT TOP 1 CASE WHEN ISNULL(CustomerName,'') <>'' THEN CustomerName EL...
24,166,616
What is the correct way to return a string when no results are returned. The following isn't working ``` SELECT TOP 1 CASE WHEN CustomerName IS NULL THEN 'Unknown' WHEN CustomerName = '' THEN 'Unknown' ELSE CustomerName END AS CustomerName FROM CUSTOMER WHERE Cust...
2014/06/11
[ "https://Stackoverflow.com/questions/24166616", "https://Stackoverflow.com", "https://Stackoverflow.com/users/974840/" ]
If I understand the question, you want to return a value even when the WHERE clause doesn't match, and you want 'Unknown' to replace the empty string or a NULL value: ``` SELECT TOP 1 COALESCE(NULLIF(CustomerName,''),'Unknown') FROM ( SELECT CustomerName FROM CUSTOMER WHERE CustomerCode = 222 UNION ALL SELECT NU...
Try this may be it's work.. ``` SELECT DISTINCT TOP 1 CASE WHEN ISNULL(CustomerName,'') <>'' THEN CustomerName ELSE 'Unknown' END as CustomerName FROM CUSTOMER WHERE CustomerCode = 222 ``` or ``` SELECT TOP 1 CustomerName FROM (SELECT DISTINCT TOP 1 CASE WHEN ISNULL(CustomerName,'') <>'' THEN CustomerName EL...
24,166,616
What is the correct way to return a string when no results are returned. The following isn't working ``` SELECT TOP 1 CASE WHEN CustomerName IS NULL THEN 'Unknown' WHEN CustomerName = '' THEN 'Unknown' ELSE CustomerName END AS CustomerName FROM CUSTOMER WHERE Cust...
2014/06/11
[ "https://Stackoverflow.com/questions/24166616", "https://Stackoverflow.com", "https://Stackoverflow.com/users/974840/" ]
It seems you want to return `Unknown` when there are no rows in your table that have `CustomerName` that's not `NULL` or not `''`. ``` SELECT COALESCE((SELECT TOP 1 CustomerName FROM CUSTOMER WHERE CustomerCode = 222 AND CustomerName IS NOT NULL AND CustomerName <> ''),'Unknown') C...
If I understand the question, you want to return a value even when the WHERE clause doesn't match, and you want 'Unknown' to replace the empty string or a NULL value: ``` SELECT TOP 1 COALESCE(NULLIF(CustomerName,''),'Unknown') FROM ( SELECT CustomerName FROM CUSTOMER WHERE CustomerCode = 222 UNION ALL SELECT NU...
128,855
I try to help some people with basic English, and I'm not able to explain why "Everyone" takes a "s" with the simple present verb, and why "People" takes no "s". I explained "Everyone" as a group, and group means a plural, but have a singular form. Example: a football team. But with "people", my explanation get confu...
2017/05/09
[ "https://ell.stackexchange.com/questions/128855", "https://ell.stackexchange.com", "https://ell.stackexchange.com/users/46339/" ]
"Everyone" is equivalent to "Every person". Although we are talking about multiple people, we are grammatically using a singular. * Everyone (singular) **works** overtime today. * Every person (singular) **works** overtime today. "People", on the other hand, is the plural for "person". "Persons" *can be* correct in c...
Almost all English plural nouns end in *s* or *es* but there are about 20 or so nouns with irregular plurals (that aren't stolen from Latin) - and *people* is one of them. So it's treated the same way as a noun with *s* or *es* on the end. *Everyone* is really the two words "every one" run together. So it's really *on...
37,289,099
I was thinking about trying to get MySQL working with my ASP.NET Core application and so I added `"MySql.Data": "6.9.8"` to my project.json dependencies. Doing so and running `dotnet restore` I get `Package MySql.Data 6.9.8 is not compatible with netcoreapp1.0` I think this means that the MySQL ADO provider doesn't ...
2016/05/18
[ "https://Stackoverflow.com/questions/37289099", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1348592/" ]
Try adding "net46" within project.json ``` "frameworks": { "netcoreapp1.0": { "imports": [ "dotnet5.6", "dnxcore50", "net46", "portable-net45+win8" ] } }, ```
There is a new package v 6.10 available on Nuget as a fix for this problem. <https://www.nuget.org/packages/MySql.Data/6.10.0-alpha> This is in alpha phase i hope soon the release version come.
29,033,172
I have a Label named "`Lable_Match`" (in self.view) and a `UIView`(in self.view). In that View there are 1000+ labels. and view is move using touch move method. and When user move View and he touch end that time check view subview lable is on the "`Lable_Match`" if any one lable is on this so the check text are...
2015/03/13
[ "https://Stackoverflow.com/questions/29033172", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4194486/" ]
For user input, you usually want `CultureInfo.CurrentCulture`. The fact that *you're* using a locale that's not natural to you is not the usual user case - if the user has `,` as the decimal point in their whole system, they're probably used to using that, instead of your preferred `.`. In other words, while you're tes...
If you do a correctly internationalized program... A) If you are using Winforms or WPF or in general the user will "work" on the machine of the program, then input parsing should be done with the `CurrentCulture` B) If you are web-programming, then the user should be able to select its culture, and `CurrentCulture` ...
18,805,601
I'm having a problem using Ember. When I change a model, its "isDirty" flag becomes true, which is what I expect. However, after that its "isDirty" flag is true, even after I save that model. Here's a minimal Rails + Ember project (so I can actually save the model) that shows the situation: <https://github.com/cster...
2013/09/14
[ "https://Stackoverflow.com/questions/18805601", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2151750/" ]
Here's probably the funniest answer: assume your file is `file.txt`, then just do this: ``` printf 'curl http://example.com/?vehicle=%s&number=%s&period=%s\n' $(<file.txt) ``` It: * is 100% pure bash, * has no explicit loops * is the shortest answer * is very funny Hope this helps `:)`
Try this: ``` while read vehicle number period ; do echo curl http://example.com/\?vehicle="$vehicle"\&number="$number"\&period="$period" done < input.txt ```
18,805,601
I'm having a problem using Ember. When I change a model, its "isDirty" flag becomes true, which is what I expect. However, after that its "isDirty" flag is true, even after I save that model. Here's a minimal Rails + Ember project (so I can actually save the model) that shows the situation: <https://github.com/cster...
2013/09/14
[ "https://Stackoverflow.com/questions/18805601", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2151750/" ]
Here's probably the funniest answer: assume your file is `file.txt`, then just do this: ``` printf 'curl http://example.com/?vehicle=%s&number=%s&period=%s\n' $(<file.txt) ``` It: * is 100% pure bash, * has no explicit loops * is the shortest answer * is very funny Hope this helps `:)`
Maybe use `sed` to interleave the URL arguments with other parts. Guessing from the sample you posted: ``` sed 's/\([a-z]*\) \([0-9]*\) \([A-Z]\)/curl http:\/\/example.com\/?vehicle=\1\&number=\2\&period=\3/' ```
285,329
$A=\begin{bmatrix} a & b\\ b & c \end{bmatrix}$ Find any $(a,b,c) \in \mathbb{C}^3$ , $a \neq 0$ , $b \neq 0$ , $c \neq 0$ , so that eigenvalues of A are $\lambda\_1=\lambda\_2=1$ --- $det(A-\lambda I)=\begin{bmatrix} a-\lambda & b\\ b & c- \lambda \end{bmatrix}=(a-\lambda)(c-\lambda)-b^2=0$ $\Longrightarrow$ $\l...
2013/01/23
[ "https://math.stackexchange.com/questions/285329", "https://math.stackexchange.com", "https://math.stackexchange.com/users/57112/" ]
You are very close, everything is okay up to the step: $4a^2-8a+4b^2+4=0$. This reduces to $a^2-2a+b^2+1=0$ Now, solve for $$b = \pm \sqrt{-(a-1)^{2}} = \pm i(a-1)$$ So, you are free to choose $a's$. Regards
Your work looks OK up to $4a^2-8a+4b^2+4=0$. This reduces to $a^2-2a+b^2+1=0$, and you can try a few values for $a$ and $b$. I tried $a=3$, which yielded $c=-1$ and $b=2i$. The resulting matrix has the eigenvalues you want.
74,485,961
``` const human = { name: "asdasd", mouth: { sayName(){ console.log(this.name) } } } human.mouth.sayName() // undefined ``` HELLO! I need the name field to be taken from the parent object THANK YOU!
2022/11/18
[ "https://Stackoverflow.com/questions/74485961", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12106806/" ]
You're using a function called `check`, and it doesn't exist - like your error is telling you. There's one in your class, but that isn't in the same scope so you can't just call it using its name. To access a method in a class, use `self.<name>`. Also, you should only *pass the check function*, not *call* it. ```py ...
Put this code in your `@commands.Cog.listener()` decorator, and the code will work if your cogs loader is working. If you would like me to show you my cogs loader, I can. ```py accept = '✅' decline = '' def check(reaction, user): return user == author messsage = await ctx.send("test") await message.add_reaction(ac...
620,827
I'm a bit hung up on the idea of forces at either end of a spring being equal, surely by extending the spring you are moving its centre of mass and hence applying a resultant force on it. I get it when the spring is not extending or has already extended, but while it is extending surely the force pulling the molecules ...
2021/03/13
[ "https://physics.stackexchange.com/questions/620827", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/291944/" ]
> > I'm a bit hung up on the idea of forces at either end of a spring > being equal, surely by extending the spring you are moving its centre > of mass and hence applying a resultant force on it. > > > Yes. If the spring is *being extended* then almost by definition its Centre of Mass (in the case of a **massive ...
The forces are equal at the ends because if they were not one end or the other would move. If you replace the spring with an elastic string , it is easier to see that the tension in the string is the same all over. And also in the spring (which is a hard kind of curly string) the tension (force) is equal along the leng...
18,161,636
I want to read json from php server using javascript (not jquery) like ``` xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { json = xmlhttp.responseText; JSON.parse(json, function (key, val) { alert(key + '-'+ val); ...
2013/08/10
[ "https://Stackoverflow.com/questions/18161636", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1600166/" ]
If you are using normal javascript, You want to loop through the properties of an object, which u can do it in javascript with `for in` statement. ``` <script> var xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 ...
From the [MDN documentation about `JSON.parse`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse): > > The reviver is ultimately called with the empty string and the topmost value to permit transformation of the topmost value. > > > Parsing `{"id":"1","name":"2"}` will g...
38,727,544
I normally don't ask questions here because most of the times I can find answers. But at this moment I haven´t find one, and I am really stuck. I have a problem trying to get access token for the Cherwell api: <http://13.88.176.216/CherwellAPI/Swagger/ui/index#!/Service/Service_Token> I used postman to generate this co...
2016/08/02
[ "https://Stackoverflow.com/questions/38727544", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3357141/" ]
You should probably edit (parts of) your last two ... er, now, *three*—comments into your question, but for now, I'll just quote them here: > > I found where I might have off road. When I checked-out the branch I was going to work on, I got this message (let's called the branch `b1`: > > > > ``` > Branch b1 set up...
**Current State:** Your head isn't attached to a branch, so you pushed with the branch whose history was the same as the remotes. You were working with a detached head, so when you pushed the head instead of the branch, it worked. If you do a `git status` it with show: > > HEAD detached at XXXXXXX > > > **Fixing...
62,067
**Question**: when did someone first call the astronomical objects that orbit planets "moons"? More precisely, I'm probably looking for the first use of *lunae* in this context. I assume that "moons" would have been a translation of the Latin word which astronomers tended to prefer. **Presumed, but Incorrect Answer**:...
2020/12/02
[ "https://history.stackexchange.com/questions/62067", "https://history.stackexchange.com", "https://history.stackexchange.com/users/44571/" ]
[Chistiaan Huygens](https://en.wikipedia.org/wiki/Christiaan_Huygens#Saturn%27s_rings_and_Titan) in 1656 is the first documented evidence. --- The invention of the telescope limits this to after 1610. Since Galileo was the first to observe such objects, it was Kepler who in 1611 called them satellites in his *Narrati...
A publication from 1665, [Philosophical Transactions](https://books.google.com/books?id=4u2DURXGT-IC&pg=PA72&dq=moons%20satellites%20%20jupiter&hl=en&newbks=1&newbks_redir=0&sa=X&ved=2ahUKEwik7-WEsK7tAhXNop4KHd16DnIQuwUwAXoECAIQBg#v=onepage&q=moons%20satellites%20%20jupiter&f=true), in an article which tosses about nam...
69,761,783
Given two integer arrays `a` and `b`, where the elements in `b` represent indices of `a`... ``` a = array([10,10,10,8,8,8]) b = array([0,2,3,5]) ``` I want to generate a new array whose elements are the sums of the elements in `a` along the index ranges given in `b`, not including the element at the tail of the ran...
2021/10/28
[ "https://Stackoverflow.com/questions/69761783", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11499001/" ]
You can try this: ``` import numpy as np a = np.array([10,10,10,8,8,8]) b = np.array([0,2,3,5]) list(map(sum, np.split(a, b))) ``` It gives: ``` [0, 20, 10, 16, 8] ``` The last number is the sum of the slice `a[5:]`.
Is that what you are looking for? ``` import numpy as np a = np.array([10,10,10,8,8,8]) b = np.array([0,2,3,5]) result = [] for i, v in enumerate(b): result.append(sum(a[b[i-1]:v])) result = np.array(result) ``` The result: ``` [ 0 20 10 16] ```
69,761,783
Given two integer arrays `a` and `b`, where the elements in `b` represent indices of `a`... ``` a = array([10,10,10,8,8,8]) b = array([0,2,3,5]) ``` I want to generate a new array whose elements are the sums of the elements in `a` along the index ranges given in `b`, not including the element at the tail of the ran...
2021/10/28
[ "https://Stackoverflow.com/questions/69761783", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11499001/" ]
I think you are looking at [`np.ufunc.reduceat`](https://numpy.org/devdocs/reference/generated/numpy.ufunc.reduceat.html): ``` np.add.reduceat(a,b) ``` Out: ``` # gotta handle the case `b[0] == 0` separately array([20, 10, 16, 8]) ```
Is that what you are looking for? ``` import numpy as np a = np.array([10,10,10,8,8,8]) b = np.array([0,2,3,5]) result = [] for i, v in enumerate(b): result.append(sum(a[b[i-1]:v])) result = np.array(result) ``` The result: ``` [ 0 20 10 16] ```
69,761,783
Given two integer arrays `a` and `b`, where the elements in `b` represent indices of `a`... ``` a = array([10,10,10,8,8,8]) b = array([0,2,3,5]) ``` I want to generate a new array whose elements are the sums of the elements in `a` along the index ranges given in `b`, not including the element at the tail of the ran...
2021/10/28
[ "https://Stackoverflow.com/questions/69761783", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11499001/" ]
I think you are looking at [`np.ufunc.reduceat`](https://numpy.org/devdocs/reference/generated/numpy.ufunc.reduceat.html): ``` np.add.reduceat(a,b) ``` Out: ``` # gotta handle the case `b[0] == 0` separately array([20, 10, 16, 8]) ```
You can try this: ``` import numpy as np a = np.array([10,10,10,8,8,8]) b = np.array([0,2,3,5]) list(map(sum, np.split(a, b))) ``` It gives: ``` [0, 20, 10, 16, 8] ``` The last number is the sum of the slice `a[5:]`.
2,156,832
I want to get some data between some 2 indexes. For example, I have string: "just testing..." and I need string from 2 till 6. I should get: 'st tes'. What function can do this for me?
2010/01/28
[ "https://Stackoverflow.com/questions/2156832", "https://Stackoverflow.com", "https://Stackoverflow.com/users/87152/" ]
Use `substr`: ``` std::string myString = "just testing..."; std::string theSubstring = myString.substr(2, 6); ``` Note that the second parameter is the *length* of the substring, not an index (your question is a bit unclear, since the substring from 2 to 6 is actually 'st t', not 'st tes').
use the [substr](http://www.cplusplus.com/reference/string/string/substr/) method: ``` std::string theString = "just testing"; std::string theSubstring = theString.substr(2, 4); ```
30,034,822
I am trying to fill a ComboBox with the days in the selected month with this ``` private void cboSelectMonth_SelectedIndexChanged(object sender, EventArgs e) { if (cboSelectMonth.SelectedIndex >= 0) { int year = Convert.ToInt32(cboSelectYear.SelectedValue); int month = Con...
2015/05/04
[ "https://Stackoverflow.com/questions/30034822", "https://Stackoverflow.com", "https://Stackoverflow.com/users/481813/" ]
It's simple, but you have to specify a year, too. Mind February and leap years! ``` int year = 2015; int month = 5; int[] days = Enumerable.Range(1, DateTime.DaysInMonth(year, month)).ToArray(); ``` You can specify it as a `DataSource` afterwards: ``` cboSelectDay.DataSource = days; cboSelectDay.DataBind(); ```
Using your general approach, this does work: ``` int thisMonthsDays = DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month); for (int i = 1; i <= thisMonthsDays; i++) { comboBox1.Items.Add(i); } ``` It fills a comboBox1 with (for May) with 31 days as expected. Trying to work through and grasp it better, I t...
30,034,822
I am trying to fill a ComboBox with the days in the selected month with this ``` private void cboSelectMonth_SelectedIndexChanged(object sender, EventArgs e) { if (cboSelectMonth.SelectedIndex >= 0) { int year = Convert.ToInt32(cboSelectYear.SelectedValue); int month = Con...
2015/05/04
[ "https://Stackoverflow.com/questions/30034822", "https://Stackoverflow.com", "https://Stackoverflow.com/users/481813/" ]
It's simple, but you have to specify a year, too. Mind February and leap years! ``` int year = 2015; int month = 5; int[] days = Enumerable.Range(1, DateTime.DaysInMonth(year, month)).ToArray(); ``` You can specify it as a `DataSource` afterwards: ``` cboSelectDay.DataSource = days; cboSelectDay.DataBind(); ```
you can do this - I am passing hard coded values for year and month ``` for (int i = 0; i < DateTime.DaysInMonth(2015, 05); i++) { cmbMonth.Items.Add(i.ToString()); } ``` let me know if you have any other requirement
30,034,822
I am trying to fill a ComboBox with the days in the selected month with this ``` private void cboSelectMonth_SelectedIndexChanged(object sender, EventArgs e) { if (cboSelectMonth.SelectedIndex >= 0) { int year = Convert.ToInt32(cboSelectYear.SelectedValue); int month = Con...
2015/05/04
[ "https://Stackoverflow.com/questions/30034822", "https://Stackoverflow.com", "https://Stackoverflow.com/users/481813/" ]
Using your general approach, this does work: ``` int thisMonthsDays = DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month); for (int i = 1; i <= thisMonthsDays; i++) { comboBox1.Items.Add(i); } ``` It fills a comboBox1 with (for May) with 31 days as expected. Trying to work through and grasp it better, I t...
you can do this - I am passing hard coded values for year and month ``` for (int i = 0; i < DateTime.DaysInMonth(2015, 05); i++) { cmbMonth.Items.Add(i.ToString()); } ``` let me know if you have any other requirement
16,529,276
I'm relatively new to python but I'm trying to understand something which seems basic. Create a vector: ``` x = np.linspace(0,2,3) Out[38]: array([ 0., 1., 2.]) ``` now why isn't x[:,0] a value argument? ``` IndexError: invalid index ``` It must be x[0]. I have a function I am calling which calculates: ``` np...
2013/05/13
[ "https://Stackoverflow.com/questions/16529276", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1495869/" ]
Perhaps you are looking for this: ``` np.sqrt(x[...,0]**2 + x[...,1]**2 + x[...,2]**2) ``` There can be any number of dimensions in place of the ellipsis `...` See also [What does the Python Ellipsis object do?](https://stackoverflow.com/q/772124/222914), and [the docs of NumPy basic slicing](http://docs.scipy.org/...
I tend to solve this is by writing ``` x = np.atleast_2d(x) norm = np.sqrt(x[:,0]**2 + x[:,1]**2 + x[:,2]**2) ``` Matlab doesn't have 1D arrays, so `b=[1 2 3]` is still a 2D array and indexing with two dimensions makes sense. It can be a novel concept for you, but they're quite useful in fact (you can stop worrying ...
16,529,276
I'm relatively new to python but I'm trying to understand something which seems basic. Create a vector: ``` x = np.linspace(0,2,3) Out[38]: array([ 0., 1., 2.]) ``` now why isn't x[:,0] a value argument? ``` IndexError: invalid index ``` It must be x[0]. I have a function I am calling which calculates: ``` np...
2013/05/13
[ "https://Stackoverflow.com/questions/16529276", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1495869/" ]
Perhaps you are looking for this: ``` np.sqrt(x[...,0]**2 + x[...,1]**2 + x[...,2]**2) ``` There can be any number of dimensions in place of the ellipsis `...` See also [What does the Python Ellipsis object do?](https://stackoverflow.com/q/772124/222914), and [the docs of NumPy basic slicing](http://docs.scipy.org/...
The problem is that x[:,0] in Python isn't the same as in Matlab. If you want to extract the first element in the single row vector you should go with ``` x[:1] ``` This is called a "slice". In this example it means that you take everything in the array from the first element to the element with index 1 (not includ...
16,529,276
I'm relatively new to python but I'm trying to understand something which seems basic. Create a vector: ``` x = np.linspace(0,2,3) Out[38]: array([ 0., 1., 2.]) ``` now why isn't x[:,0] a value argument? ``` IndexError: invalid index ``` It must be x[0]. I have a function I am calling which calculates: ``` np...
2013/05/13
[ "https://Stackoverflow.com/questions/16529276", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1495869/" ]
Perhaps you are looking for this: ``` np.sqrt(x[...,0]**2 + x[...,1]**2 + x[...,2]**2) ``` There can be any number of dimensions in place of the ellipsis `...` See also [What does the Python Ellipsis object do?](https://stackoverflow.com/q/772124/222914), and [the docs of NumPy basic slicing](http://docs.scipy.org/...
It looks like the ellipsis as described by @JanneKarila has answered your question, but I'd like to point out how you might make your code a bit more "numpythonic". It appears you want to handle an n-dimensional array with the shape (d\_1, d\_2, ..., d\_{n-1}, 3), and compute the magnitudes of this collection of three-...
16,529,276
I'm relatively new to python but I'm trying to understand something which seems basic. Create a vector: ``` x = np.linspace(0,2,3) Out[38]: array([ 0., 1., 2.]) ``` now why isn't x[:,0] a value argument? ``` IndexError: invalid index ``` It must be x[0]. I have a function I am calling which calculates: ``` np...
2013/05/13
[ "https://Stackoverflow.com/questions/16529276", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1495869/" ]
I tend to solve this is by writing ``` x = np.atleast_2d(x) norm = np.sqrt(x[:,0]**2 + x[:,1]**2 + x[:,2]**2) ``` Matlab doesn't have 1D arrays, so `b=[1 2 3]` is still a 2D array and indexing with two dimensions makes sense. It can be a novel concept for you, but they're quite useful in fact (you can stop worrying ...
The problem is that x[:,0] in Python isn't the same as in Matlab. If you want to extract the first element in the single row vector you should go with ``` x[:1] ``` This is called a "slice". In this example it means that you take everything in the array from the first element to the element with index 1 (not includ...
16,529,276
I'm relatively new to python but I'm trying to understand something which seems basic. Create a vector: ``` x = np.linspace(0,2,3) Out[38]: array([ 0., 1., 2.]) ``` now why isn't x[:,0] a value argument? ``` IndexError: invalid index ``` It must be x[0]. I have a function I am calling which calculates: ``` np...
2013/05/13
[ "https://Stackoverflow.com/questions/16529276", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1495869/" ]
It looks like the ellipsis as described by @JanneKarila has answered your question, but I'd like to point out how you might make your code a bit more "numpythonic". It appears you want to handle an n-dimensional array with the shape (d\_1, d\_2, ..., d\_{n-1}, 3), and compute the magnitudes of this collection of three-...
I tend to solve this is by writing ``` x = np.atleast_2d(x) norm = np.sqrt(x[:,0]**2 + x[:,1]**2 + x[:,2]**2) ``` Matlab doesn't have 1D arrays, so `b=[1 2 3]` is still a 2D array and indexing with two dimensions makes sense. It can be a novel concept for you, but they're quite useful in fact (you can stop worrying ...
16,529,276
I'm relatively new to python but I'm trying to understand something which seems basic. Create a vector: ``` x = np.linspace(0,2,3) Out[38]: array([ 0., 1., 2.]) ``` now why isn't x[:,0] a value argument? ``` IndexError: invalid index ``` It must be x[0]. I have a function I am calling which calculates: ``` np...
2013/05/13
[ "https://Stackoverflow.com/questions/16529276", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1495869/" ]
It looks like the ellipsis as described by @JanneKarila has answered your question, but I'd like to point out how you might make your code a bit more "numpythonic". It appears you want to handle an n-dimensional array with the shape (d\_1, d\_2, ..., d\_{n-1}, 3), and compute the magnitudes of this collection of three-...
The problem is that x[:,0] in Python isn't the same as in Matlab. If you want to extract the first element in the single row vector you should go with ``` x[:1] ``` This is called a "slice". In this example it means that you take everything in the array from the first element to the element with index 1 (not includ...
20,641,922
I have question regarding the performance factor for the following question. Consider a table : Users, ``` -----userId------- userName----- 1 ABC 2 XYZ ``` Another table : Transaction, ``` ------createdBy----ReceivedBy----TransactionId 1 2 ...
2013/12/17
[ "https://Stackoverflow.com/questions/20641922", "https://Stackoverflow.com", "https://Stackoverflow.com/users/922998/" ]
Your query is a good start, but it is unnecessarily complex. Try the following: ``` SELECT createdBy, ReceivedBy, TransactionId, userName FROM Transaction INNER JOIN Users ON createdBy = userId ``` Update: Doing it in the query is the better way (in my opinion), since it makes sense to get your data from the databas...
why not simply doing something like: ``` select t.createdBy, t.ReceivedBy, t.TransactionId, u.userName from Transactions u, Users u where t.createdBy = u.userId ```
20,641,922
I have question regarding the performance factor for the following question. Consider a table : Users, ``` -----userId------- userName----- 1 ABC 2 XYZ ``` Another table : Transaction, ``` ------createdBy----ReceivedBy----TransactionId 1 2 ...
2013/12/17
[ "https://Stackoverflow.com/questions/20641922", "https://Stackoverflow.com", "https://Stackoverflow.com/users/922998/" ]
Your query is a good start, but it is unnecessarily complex. Try the following: ``` SELECT createdBy, ReceivedBy, TransactionId, userName FROM Transaction INNER JOIN Users ON createdBy = userId ``` Update: Doing it in the query is the better way (in my opinion), since it makes sense to get your data from the databas...
use this format: ``` SELECT a.batsman_id,a.matchs,a.hundreds,b.country_type, c.player_name FROM batsman a INNER JOIN countrycode b ON a.country_code=b.country_code INNER JOIN players c ON a.player_id=c.player_id ORDER BY a.batsman_id; ```
41,041,983
I'm running an rsync daemon (providing a mirror for the SaneSecurity signatures). rsync is started like this (from runit): ``` /usr/bin/rsync -v --daemon --no-detach ``` And the config contains: ``` use chroot = no munge symlinks = no max connections = 200 timeout = 30 syslog facility = loc...
2016/12/08
[ "https://Stackoverflow.com/questions/41041983", "https://Stackoverflow.com", "https://Stackoverflow.com/users/618343/" ]
You need to make 2 small changes to a single line ``` Ext.get('txtUsuEmail').setStyle('background-color','#DC143C'); //change this as per below ``` 1) Target specifically the `<input>` textbox using `Ext.get('txtUsuEmail-inputEl').` 2) Change the `background` property not the `background-color`. So the final would...
You could give an id to the textfield and simply use the below setStyle: ``` Ext.get('YourTextFieldId').setStyle('background', '#ABCDEF'); ```
58,536,220
``` <input ngModel name='quantity' placeholder='Quantity' type="number" class="form-control" pattern="^\d*(\.\d{0,2})?$" required /> <input ngModel name='price' class="form-control" placeholder='Price' type="number" required /> <input name='total' class...
2019/10/24
[ "https://Stackoverflow.com/questions/58536220", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3709523/" ]
Add `[(ngModel)]` in the fields. Try like this: **[Working Demo](https://stackblitz.com/edit/angular-qqjhbx?embed=1&file=src/app/app.component.html)** ``` <input [(ngModel)]="quantity" name='quantity' placeholder='Quantity' type="number" class="form-control" pattern="^\d*(\.\d{0,2})?$" required /> <input [(ngModel)...
Try this, use *double quotes* to evaluate the value of your variable. ``` <input name="total" class="form-control" type="number" [value]="addRowForm.value.quantity * addRowForm.value.price" /> ```
512,947
There are unknown number of lines in a file. How to delete nth line (when counted from the bottom) with one-liner command (you may use more than one if it is necessary) on Unix platform.
2019/04/17
[ "https://unix.stackexchange.com/questions/512947", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/347577/" ]
if `$n` hold number of line to delete to delete a single line use ``` printf "\$-%d+1,\$-%d+1d\nwq\n" $n $n| ed -s file ``` to delete n last lines ``` printf "\$-%d,\$d\nwq\n" $n | ed -s file ``` where * `\$%d,\$d` tell ed to delete n last lines (printf will insert n) * `wq` write and quit * `-s` in `ed -s` wil...
An one-line, in-place solution: With `gawk`, this will delete the 42nd line from the bottom: ``` gawk -i inplace 'i==0 {if(FNR>t){t=FNR}else{i=1}} i==1 && FNR!=t-42 {print}' input input ``` The 42 can be replaced with any number. If 0 is used then the last line is deleted. Notice that the `input` file is specified...
512,947
There are unknown number of lines in a file. How to delete nth line (when counted from the bottom) with one-liner command (you may use more than one if it is necessary) on Unix platform.
2019/04/17
[ "https://unix.stackexchange.com/questions/512947", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/347577/" ]
Pure `sed`: * If *n* is 1: ``` sed '$ d' ``` This is simple: if it's the last line, delete the pattern space, so it's not printed. * If *n* is greater than 1 (and available as `$n`): ``` sed " : start 1,$((n-1)) { N; b start } $ { t end; s/^//; D } N P D : end " ``` Note `$((n-1))` is expan...
An one-line, in-place solution: With `gawk`, this will delete the 42nd line from the bottom: ``` gawk -i inplace 'i==0 {if(FNR>t){t=FNR}else{i=1}} i==1 && FNR!=t-42 {print}' input input ``` The 42 can be replaced with any number. If 0 is used then the last line is deleted. Notice that the `input` file is specified...
512,947
There are unknown number of lines in a file. How to delete nth line (when counted from the bottom) with one-liner command (you may use more than one if it is necessary) on Unix platform.
2019/04/17
[ "https://unix.stackexchange.com/questions/512947", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/347577/" ]
Pure `sed`: * If *n* is 1: ``` sed '$ d' ``` This is simple: if it's the last line, delete the pattern space, so it's not printed. * If *n* is greater than 1 (and available as `$n`): ``` sed " : start 1,$((n-1)) { N; b start } $ { t end; s/^//; D } N P D : end " ``` Note `$((n-1))` is expan...
if `$n` hold number of line to delete to delete a single line use ``` printf "\$-%d+1,\$-%d+1d\nwq\n" $n $n| ed -s file ``` to delete n last lines ``` printf "\$-%d,\$d\nwq\n" $n | ed -s file ``` where * `\$%d,\$d` tell ed to delete n last lines (printf will insert n) * `wq` write and quit * `-s` in `ed -s` wil...
512,947
There are unknown number of lines in a file. How to delete nth line (when counted from the bottom) with one-liner command (you may use more than one if it is necessary) on Unix platform.
2019/04/17
[ "https://unix.stackexchange.com/questions/512947", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/347577/" ]
To remove for example the 4th line from the bottom using `sed`: ``` tac input | sed '4d' | tac ``` To overwrite the input file: ``` tmpfile=$(mktemp) tac input | sed '4d' | tac > "$tmpfile" && mv "$tmpfile" input ```
if `$n` hold number of line to delete to delete a single line use ``` printf "\$-%d+1,\$-%d+1d\nwq\n" $n $n| ed -s file ``` to delete n last lines ``` printf "\$-%d,\$d\nwq\n" $n | ed -s file ``` where * `\$%d,\$d` tell ed to delete n last lines (printf will insert n) * `wq` write and quit * `-s` in `ed -s` wil...
512,947
There are unknown number of lines in a file. How to delete nth line (when counted from the bottom) with one-liner command (you may use more than one if it is necessary) on Unix platform.
2019/04/17
[ "https://unix.stackexchange.com/questions/512947", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/347577/" ]
To remove for example the 4th line from the bottom using `sed`: ``` tac input | sed '4d' | tac ``` To overwrite the input file: ``` tmpfile=$(mktemp) tac input | sed '4d' | tac > "$tmpfile" && mv "$tmpfile" input ```
Neither standard `sed` nor `awk` support editing in place. For that, you better use `ed(1)` or `ex(1)`: ``` printf '$-%dd\nw\n' 1 | ed -s your_file ``` Or with here-doc ``` ed -s <<'EOT' your_file $-1d w EOT ``` With advanced shells like `bash`, `zsh` or`ksh93` you can use the `$'...'` syntax and here-strings: ...
512,947
There are unknown number of lines in a file. How to delete nth line (when counted from the bottom) with one-liner command (you may use more than one if it is necessary) on Unix platform.
2019/04/17
[ "https://unix.stackexchange.com/questions/512947", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/347577/" ]
You can combine `head` and `tail` to achieve this. If the *nth* line from the bottom needs to be deleted 1. `head` reads from standard input and reports to standard output *total -n* lines from the top 2. `tail` reads and reports to standard output the bottom *n-1* lines from standard input. 3. Taken as a whole, the ...
`sed` cannot calculate nth row from bottom by itself, so we need to that before, e.g. using `awk`: Delete 4th row from bottom: ``` delrow=$(awk -v n=4 'END { print NR-n+1 }' file) sed -i "${delrow}d" file ```
512,947
There are unknown number of lines in a file. How to delete nth line (when counted from the bottom) with one-liner command (you may use more than one if it is necessary) on Unix platform.
2019/04/17
[ "https://unix.stackexchange.com/questions/512947", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/347577/" ]
Pure `sed`: * If *n* is 1: ``` sed '$ d' ``` This is simple: if it's the last line, delete the pattern space, so it's not printed. * If *n* is greater than 1 (and available as `$n`): ``` sed " : start 1,$((n-1)) { N; b start } $ { t end; s/^//; D } N P D : end " ``` Note `$((n-1))` is expan...
You can combine `head` and `tail` to achieve this. If the *nth* line from the bottom needs to be deleted 1. `head` reads from standard input and reports to standard output *total -n* lines from the top 2. `tail` reads and reports to standard output the bottom *n-1* lines from standard input. 3. Taken as a whole, the ...
512,947
There are unknown number of lines in a file. How to delete nth line (when counted from the bottom) with one-liner command (you may use more than one if it is necessary) on Unix platform.
2019/04/17
[ "https://unix.stackexchange.com/questions/512947", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/347577/" ]
To remove for example the 4th line from the bottom using `sed`: ``` tac input | sed '4d' | tac ``` To overwrite the input file: ``` tmpfile=$(mktemp) tac input | sed '4d' | tac > "$tmpfile" && mv "$tmpfile" input ```
This is tagged with `sed` and `awk` but the question doesn't mention these as being required for the solution. Here's a Perl filter which removes the 4th-from-last line and prints the result. The output can written to a tmp file and then used to replace the original. ``` perl -e '@L = <STDIN>; splice(@L,-4,1); print ...
512,947
There are unknown number of lines in a file. How to delete nth line (when counted from the bottom) with one-liner command (you may use more than one if it is necessary) on Unix platform.
2019/04/17
[ "https://unix.stackexchange.com/questions/512947", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/347577/" ]
if `$n` hold number of line to delete to delete a single line use ``` printf "\$-%d+1,\$-%d+1d\nwq\n" $n $n| ed -s file ``` to delete n last lines ``` printf "\$-%d,\$d\nwq\n" $n | ed -s file ``` where * `\$%d,\$d` tell ed to delete n last lines (printf will insert n) * `wq` write and quit * `-s` in `ed -s` wil...
`sed` cannot calculate nth row from bottom by itself, so we need to that before, e.g. using `awk`: Delete 4th row from bottom: ``` delrow=$(awk -v n=4 'END { print NR-n+1 }' file) sed -i "${delrow}d" file ```
512,947
There are unknown number of lines in a file. How to delete nth line (when counted from the bottom) with one-liner command (you may use more than one if it is necessary) on Unix platform.
2019/04/17
[ "https://unix.stackexchange.com/questions/512947", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/347577/" ]
Neither standard `sed` nor `awk` support editing in place. For that, you better use `ed(1)` or `ex(1)`: ``` printf '$-%dd\nw\n' 1 | ed -s your_file ``` Or with here-doc ``` ed -s <<'EOT' your_file $-1d w EOT ``` With advanced shells like `bash`, `zsh` or`ksh93` you can use the `$'...'` syntax and here-strings: ...
An one-line, in-place solution: With `gawk`, this will delete the 42nd line from the bottom: ``` gawk -i inplace 'i==0 {if(FNR>t){t=FNR}else{i=1}} i==1 && FNR!=t-42 {print}' input input ``` The 42 can be replaced with any number. If 0 is used then the last line is deleted. Notice that the `input` file is specified...
6,853,088
I have a **need to find ALL files on my hard drive** (in the C: partition), regardless of permissions. (Windows XP Pro, using C#) In an earlier question, I was told: > > The "C:\System Volume Inforamtion" folder cannot be viewed because it is assigned only to the SYSTEM user. In order to see inside of it you need to...
2011/07/28
[ "https://Stackoverflow.com/questions/6853088", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10722/" ]
I've had this problem. It's because your browser now assumes /page/ is the root where it should start looking for css files etc, Simply put: ``` <base href="/"> ``` In your ``` <head>. ``` Your browser will now strt looking for css files etc from the root of your website. **edit: nvm, messed up formatting beca...
To solve this issue, I had to put in the head of my page. The javascript files I had to make absolute paths since different browsers handle the base tag differently.
35,679,352
I have a data table with the structure as given below: ``` structure(list(GVKEY1 = c(2721, 113609, 62634, NA, 62599, 15855, 15855, NA, NA, NA), GVKEY2 = c(NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_ ), GVKEY3 = c(NA_real_, NA_real_, NA_real_, NA_real_, NA_real_...
2016/02/28
[ "https://Stackoverflow.com/questions/35679352", "https://Stackoverflow.com", "https://Stackoverflow.com/users/243796/" ]
You can use the vectorized `pmax` function combined with `do.call` in order to avoid by row operation. This is uses the fact that `data.table` and `data.frame` are both lists (check out `is.list(patent)`), compared to `apply` which converts the `data.table` to a matrix. Also, as mentioned in the comments, the `:=` upda...
A slight change for you, `apply` instead of `lapply`, and when using `:=`, you don't use the `<-` assignment operator\*. ``` patent[, GVKEY := apply(.SD, 1, max, na.rm = TRUE), .SDcols = c('GVKEY1', 'GVKEY2', 'GVKEY3', 'GVKEY4', 'GVKEY5')] ``` \*References: * <https://stackoverflow.com/a/10226454/5977215> * [data....
110,492
I have a table `SUBSCRIBER` and in it the data is stored in a way that `bars` is a multi-valued column . Different values of bars are stored in different rows with the `ID` as following : ```none ID BARS 1 , BAR1 1 , BAR2 1 , BAR3 2 , BAR4 2 , BAR3 3 , BAR3 4 , BAR1 4 , BAR4 ``` OUTPUT for the data set should be the...
2015/08/09
[ "https://dba.stackexchange.com/questions/110492", "https://dba.stackexchange.com", "https://dba.stackexchange.com/users/72427/" ]
If you don't need the extra commas, then: ``` SELECT CONCAT(id, ',', GROUP_CONCAT(bars ORDER BY bars)) FROM subscriber WHERE bars IN ('bar1', 'bar4') GROUP BY id; ``` If you do need the commas, then search for "pivoting".
You can use `GROUP_CONCAT` and `CASE`: **Query:** ``` SELECT SUBSCRIBER.ID, CASE WHEN GROUP_CONCAT(CASE WHEN BARS='BAR1' OR BARS='BAR4' THEN BARS END) LIKE '%BAR1%' OR GROUP_CONCAT(CASE WHEN BARS='BAR1' OR BARS='BAR4' THEN BARS END) LIKE '%BAR4%' THEN GROUP_CONCAT(CASE WHEN BARS='BAR1' OR BARS='BAR4'...
37,366,964
I'm trying to translate a simple button hover example to emca6 (I'm using babel) and keep failing. I guess that my bind is wrong somehow but I'm new to jscript and don't completely understand the: ` ``` constructor(props) { super(props);` ``` I mean I get that it's like super in python, but why the weird s...
2016/05/21
[ "https://Stackoverflow.com/questions/37366964", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5797730/" ]
Josh, Sorry your experience had been frustrating. I'm not at a computer at the moment but wanted to see if I could provide some help and will try to repro your scenario as soon as I can. * All types that compose your function (either in a single or multiple .csx files) are compiled into a single assembly. So the error...
Use latest version of Entity Framework, I have tested using `version 6.1.3`. Then no need to specify any `DbConfiguartion`. You can safely remove the `DbConfiguration` code, just keep the `DbContext` this will not throw the exception and hopefully everything will work. ``` using System.Net; using System.Data.Entity; u...
19,502,359
I'd like to see the number of visitors on a specific page (for which I have URL). I don't find in Analytics where to enter a URL in order to look for statistics for this specific page.
2013/10/21
[ "https://Stackoverflow.com/questions/19502359", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1422096/" ]
Go to Behavior > Site Content > All Pages and put your URI into the search box.![enter image description here](https://i.stack.imgur.com/36k4C.png)
As Blexy already [answered](https://stackoverflow.com/a/19502866/1476885), go to "Behavior > Site Content > All Pages". Just pay attention that "Behavior" appears two times in the left sidebar and we need to click on the second option:            [![sidebar](https://i.stack.imgur.com/1pSaO.png)](https://i.stack.imgur...
19,502,359
I'd like to see the number of visitors on a specific page (for which I have URL). I don't find in Analytics where to enter a URL in order to look for statistics for this specific page.
2013/10/21
[ "https://Stackoverflow.com/questions/19502359", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1422096/" ]
Go to Behavior > Site Content > All Pages and put your URI into the search box.![enter image description here](https://i.stack.imgur.com/36k4C.png)
If you want to know the number of ***visitors*** (as is titled in the question) and not the number of ***pageviews***, then you'll need to create a custom report. Terminology ----------- --- Google Analytics has changed the terminology they use within the reports. Now, visits is named "[sessions](https://support.goo...
1,029,463
There is a set a set $S$ of numbers. i.e. $(s\_1, s\_2, s\_3, s\_4, s\_5, ..., s\_n)$. The average of the numbers in the set is $N$. How do I prove that at least one of the numbers in the set is greater than or equal to $N$? I am thinking that a proof by contradiction is probably the easiest way. I could do a proof b...
2014/11/19
[ "https://math.stackexchange.com/questions/1029463", "https://math.stackexchange.com", "https://math.stackexchange.com/users/180481/" ]
Suppose there are $n$ elements $s\_i \in S$ and the largest is $M$. Then looking at the mean we have $\dfrac{\sum\_i s\_i} {n}=N$, and each $s\_i \le M$, so $ nN=\sum\_i s\_i \le \sum\_i M=nM$ meaning $nN \le nM$ and so $$N \le M$$ i.e. the mean is less than or equal to the maximum. No need to look for a contradic...
Enumerate the elements of $S$ as $S=\{s\_1,\ldots,s\_K\}$. Suppose that it was true that $s\_i<N$ for all $i$. Then, $$ \sum\_{i=1}^K s\_i<\sum\_{i=1}^K N=K\times N=K\frac{\sum\_{i=1}^K s\_i}{K}=\sum\_{i=1}^K s\_i. $$ The leftmost term and rightmost term are the same so you have a contradiction.
4,118,128
Generally speaking, I’m wondering what the usual identities for Gaussian multiple integrals with a positive definite matrix become when the matrix is only positive semidefinite. I could not find anything about this in the literature, any reference is welcome. For instance, if ${\mathbf{A}}$ is positive definite, then ...
2021/04/27
[ "https://math.stackexchange.com/questions/4118128", "https://math.stackexchange.com", "https://math.stackexchange.com/users/318721/" ]
If $\mathbf{A}$ is only positive semidefinite, then the corresponding Gaussian integrals are not necessarily defined. In one dimension the only positive semidefinite matrix which is not positive definite is the zero matrix, and $x^t\mathbf{A}x = 0$ for all $x\in\mathbb{R}$, so $$ \int\_{-\infty}^\infty e^{-x^t\mathbf{A...
Here is a very partial answer. **Theorem** : if ${\mathbf{A}}$ is positive semidefinite and ${\mathbf{J}} = {\mathbf{A}}{{\mathbf{A}}^ + }{\mathbf{J}}$, then $\mathbb{E}{\mathbf{x}} = {{\mathbf{A}}^ + }{\mathbf{J}}$ , provided we allow ourself to cancel out terms like $\frac{a}{a}$ even if $a$ is infinite. **Proof** ...
25,062,844
I have a stream that watch output of multi file in a directory, process data and put it to HDFS. Here is my stream creat command: ``` stream create --name fileHdfs --definition "file --dir=/var/log/supervisor/ --pattern=tracker.out-*.log --outputType=text/plain | logHdfsTransformer | hdfs --fsUri=hdfs://192.168.1.115...
2014/07/31
[ "https://Stackoverflow.com/questions/25062844", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3172277/" ]
It's not currently supported, but it would be easy to write a custom `source` using a Spring Integration `inbound-channel-adapter` to invoke a POJO that reads a line at a time. Please open a [new feature JIRA issue](https://jira.spring.io/browse/XD). You could also do it with a `job` instead of a `stream` in XD.
Spring Integration has a FileSplitter that splits a text file into lines. You can use this to create a custom processor module, let's call it file-split: 1. Create file-split.xml file with the following content: ``` <?xml version="1.0" encoding="UTF-8"?> beans xmlns="http://www.springframework.org/schema/beans" xm...
25,062,844
I have a stream that watch output of multi file in a directory, process data and put it to HDFS. Here is my stream creat command: ``` stream create --name fileHdfs --definition "file --dir=/var/log/supervisor/ --pattern=tracker.out-*.log --outputType=text/plain | logHdfsTransformer | hdfs --fsUri=hdfs://192.168.1.115...
2014/07/31
[ "https://Stackoverflow.com/questions/25062844", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3172277/" ]
It's not currently supported, but it would be easy to write a custom `source` using a Spring Integration `inbound-channel-adapter` to invoke a POJO that reads a line at a time. Please open a [new feature JIRA issue](https://jira.spring.io/browse/XD). You could also do it with a `job` instead of a `stream` in XD.
you can try using the **--mode=lines** option while deploying the stream. Please check below documentation reference : <http://docs.spring.io/spring-xd/docs/current/reference/html/#file> Hope this helps! Cheers, Pratik
25,062,844
I have a stream that watch output of multi file in a directory, process data and put it to HDFS. Here is my stream creat command: ``` stream create --name fileHdfs --definition "file --dir=/var/log/supervisor/ --pattern=tracker.out-*.log --outputType=text/plain | logHdfsTransformer | hdfs --fsUri=hdfs://192.168.1.115...
2014/07/31
[ "https://Stackoverflow.com/questions/25062844", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3172277/" ]
I know that this may be late, but for any googlers out there looking for the solution: Even though there is no module or option that does it automatically, it's as simple as adding a splitter that separates the incoming message into multiple outgoing messages. Please note that you have to decide between using \n and ...
Spring Integration has a FileSplitter that splits a text file into lines. You can use this to create a custom processor module, let's call it file-split: 1. Create file-split.xml file with the following content: ``` <?xml version="1.0" encoding="UTF-8"?> beans xmlns="http://www.springframework.org/schema/beans" xm...
25,062,844
I have a stream that watch output of multi file in a directory, process data and put it to HDFS. Here is my stream creat command: ``` stream create --name fileHdfs --definition "file --dir=/var/log/supervisor/ --pattern=tracker.out-*.log --outputType=text/plain | logHdfsTransformer | hdfs --fsUri=hdfs://192.168.1.115...
2014/07/31
[ "https://Stackoverflow.com/questions/25062844", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3172277/" ]
I know that this may be late, but for any googlers out there looking for the solution: Even though there is no module or option that does it automatically, it's as simple as adding a splitter that separates the incoming message into multiple outgoing messages. Please note that you have to decide between using \n and ...
you can try using the **--mode=lines** option while deploying the stream. Please check below documentation reference : <http://docs.spring.io/spring-xd/docs/current/reference/html/#file> Hope this helps! Cheers, Pratik
25,062,844
I have a stream that watch output of multi file in a directory, process data and put it to HDFS. Here is my stream creat command: ``` stream create --name fileHdfs --definition "file --dir=/var/log/supervisor/ --pattern=tracker.out-*.log --outputType=text/plain | logHdfsTransformer | hdfs --fsUri=hdfs://192.168.1.115...
2014/07/31
[ "https://Stackoverflow.com/questions/25062844", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3172277/" ]
Spring Integration has a FileSplitter that splits a text file into lines. You can use this to create a custom processor module, let's call it file-split: 1. Create file-split.xml file with the following content: ``` <?xml version="1.0" encoding="UTF-8"?> beans xmlns="http://www.springframework.org/schema/beans" xm...
you can try using the **--mode=lines** option while deploying the stream. Please check below documentation reference : <http://docs.spring.io/spring-xd/docs/current/reference/html/#file> Hope this helps! Cheers, Pratik
26,195,949
A CSS animation is continuously playing behind an image. When the image is not loaded it will display, but when loaded the image will overlap the animation. I'm using z-index to achieve this, but it's not working. The image should hide loading animation with the z-index property. **Note:** I can't use any javascript...
2014/10/04
[ "https://Stackoverflow.com/questions/26195949", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3710243/" ]
You have to add **position** to the element that you want to apply **z-index**. From CSS-tricks: > > The z-index property in CSS controls the vertical stacking order of > elements that overlap. As in, which one appears as if it is physically > closer to you. z-index only effects elements that have a position > va...
To position the loading animation correctly: * Place the loading div inside the container * Set the container as `position: relative` so that the loading div is positioned in relation to it To hide the loading animation when the image is loaded: * The loading div is given `z-index: 1` * The image is given `position:...
58,984,073
i need a help when i execute the following MYSQL command in Navicat i get ``` mysql> SELECT Password FROM workers; +----------+ | Password | +----------+ | A | | B | | B | | B | | B | ``` when i fire it in java i get ``` java.sql.SQLException: Co...
2019/11/21
[ "https://Stackoverflow.com/questions/58984073", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11752429/" ]
You need to add the version to. Like this: ``` composer require symfony/web-server-bundle --dev ^4.4.2 ``` You can check for the latest version here: <https://packagist.org/packages/symfony/web-server-bundle>
Install Symfony <https://symfony.com/download> and use : * `symfony server:start` * or `symfony server:start -d`
58,984,073
i need a help when i execute the following MYSQL command in Navicat i get ``` mysql> SELECT Password FROM workers; +----------+ | Password | +----------+ | A | | B | | B | | B | | B | ``` when i fire it in java i get ``` java.sql.SQLException: Co...
2019/11/21
[ "https://Stackoverflow.com/questions/58984073", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11752429/" ]
Install Symfony <https://symfony.com/download> and use : * `symfony server:start` * or `symfony server:start -d`
The development web-server is included in the symfony client. Install the symfony cli : <https://symfony.com/download> Then, you can start the dev web server ```sh symfony server:start ```
58,984,073
i need a help when i execute the following MYSQL command in Navicat i get ``` mysql> SELECT Password FROM workers; +----------+ | Password | +----------+ | A | | B | | B | | B | | B | ``` when i fire it in java i get ``` java.sql.SQLException: Co...
2019/11/21
[ "https://Stackoverflow.com/questions/58984073", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11752429/" ]
Install Symfony <https://symfony.com/download> and use : * `symfony server:start` * or `symfony server:start -d`
If you are in development, you can simply use the inbuilt PHP server. Change directory to your Symfony project directory and run the following `php -S localhost:8001 -t public`
58,984,073
i need a help when i execute the following MYSQL command in Navicat i get ``` mysql> SELECT Password FROM workers; +----------+ | Password | +----------+ | A | | B | | B | | B | | B | ``` when i fire it in java i get ``` java.sql.SQLException: Co...
2019/11/21
[ "https://Stackoverflow.com/questions/58984073", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11752429/" ]
You need to add the version to. Like this: ``` composer require symfony/web-server-bundle --dev ^4.4.2 ``` You can check for the latest version here: <https://packagist.org/packages/symfony/web-server-bundle>
The development web-server is included in the symfony client. Install the symfony cli : <https://symfony.com/download> Then, you can start the dev web server ```sh symfony server:start ```
58,984,073
i need a help when i execute the following MYSQL command in Navicat i get ``` mysql> SELECT Password FROM workers; +----------+ | Password | +----------+ | A | | B | | B | | B | | B | ``` when i fire it in java i get ``` java.sql.SQLException: Co...
2019/11/21
[ "https://Stackoverflow.com/questions/58984073", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11752429/" ]
You need to add the version to. Like this: ``` composer require symfony/web-server-bundle --dev ^4.4.2 ``` You can check for the latest version here: <https://packagist.org/packages/symfony/web-server-bundle>
If you are in development, you can simply use the inbuilt PHP server. Change directory to your Symfony project directory and run the following `php -S localhost:8001 -t public`
40,616,704
Can we use pair as an argument for another pair in C++. Here is a test program to do that. ``` #include <iostream> #include <utility> int main() { std::pair<int,int> m; m=std::make_pair(1,3); int r = 3; int *q = &r; int **p =&q; int **t = p; std::pair<int**,<std::pair<int,int> > > i(p,m)...
2016/11/15
[ "https://Stackoverflow.com/questions/40616704", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4669984/" ]
You can use [`.map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map) ``` var output = input.map(function(item) { return item.messageid; }); ``` This will create an array that will look like `[582b4350af7cb8f21e4b7b43,582b4350af7cb8f21e4b7xb43]`
You could map the property `messageid`. ```js var objectArray = [{ messageid: '582b4350af7cb8f21e4b7b43', _id: '582b4c79105387dd21e08004' }, { messageid: '582b4350af7cb8f21e4b7xb43', _id: '582b4c79105387dd21e08s004' }], newArray = objectArray.map(function (o) { return o.messageid; }); console.log(...
40,616,704
Can we use pair as an argument for another pair in C++. Here is a test program to do that. ``` #include <iostream> #include <utility> int main() { std::pair<int,int> m; m=std::make_pair(1,3); int r = 3; int *q = &r; int **p =&q; int **t = p; std::pair<int**,<std::pair<int,int> > > i(p,m)...
2016/11/15
[ "https://Stackoverflow.com/questions/40616704", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4669984/" ]
You can use [`.map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map) ``` var output = input.map(function(item) { return item.messageid; }); ``` This will create an array that will look like `[582b4350af7cb8f21e4b7b43,582b4350af7cb8f21e4b7xb43]`
Use `forEach` to loop through the array ``` var orArray = [{ messageid: '582b4350af7cb8f21e4b7b43', _id: '582b4c79105387dd21e08004' }, { messageid: '582b4350af7cb8f21e4b7xb43', _id: '582b4c79105387dd21e08s004' } ]; var newArr = []; orArray.forEach(function(item...
40,616,704
Can we use pair as an argument for another pair in C++. Here is a test program to do that. ``` #include <iostream> #include <utility> int main() { std::pair<int,int> m; m=std::make_pair(1,3); int r = 3; int *q = &r; int **p =&q; int **t = p; std::pair<int**,<std::pair<int,int> > > i(p,m)...
2016/11/15
[ "https://Stackoverflow.com/questions/40616704", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4669984/" ]
You could map the property `messageid`. ```js var objectArray = [{ messageid: '582b4350af7cb8f21e4b7b43', _id: '582b4c79105387dd21e08004' }, { messageid: '582b4350af7cb8f21e4b7xb43', _id: '582b4c79105387dd21e08s004' }], newArray = objectArray.map(function (o) { return o.messageid; }); console.log(...
Use `forEach` to loop through the array ``` var orArray = [{ messageid: '582b4350af7cb8f21e4b7b43', _id: '582b4c79105387dd21e08004' }, { messageid: '582b4350af7cb8f21e4b7xb43', _id: '582b4c79105387dd21e08s004' } ]; var newArr = []; orArray.forEach(function(item...
336,920
I built this computer back in June and this has been an issue ever since I first built it. What happens is that my computer will POST just fine and then go to the black screen where it states "Loading Windows". Usually it sits there for a second and then it the pulsing Windows logo will appear, and after a few seconds,...
2011/09/18
[ "https://superuser.com/questions/336920", "https://superuser.com", "https://superuser.com/users/33595/" ]
You may have already tried this but, as no one else has suggested it... Disable **ALL** overclocking features and next update **ALL** the drivers you can - never use the versions that come on disk and take a look at the AMD website and your motherboard company. As it is happening at such an early stage, I believe th...
First; if you're overclocking, you need to step back down a notch once you start having problems. If you are having problems at the default BIOS settings then you have a hardware problem. Memtest although great, does not always report errors. Try testing by taking out one stick at a time. I've had to do this recently ...