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
45,401,378
so im making the board game GO for javascript and im having trouble counting the territories. If you didnt know, GO is like a complex checkers where you place stones horizontally and vertically instead of diagonally. A territory comes when the game has ended and you have made a border of your stones (the board edges co...
2017/07/30
[ "https://Stackoverflow.com/questions/45401378", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6799727/" ]
I managed to do this very effectively in the end using my own algorithm. It will first identify the territory in question and get the lowX, lowY, highX, highY. So in this case it would be 0, 0, 5, 5 respectivly. I then do a for loop like this: ``` for (var j = lowX; j < highX + 1; j++) { var l...
Im going to post an idea myself and try this method. So i will first get the most left column in the territory, in this case its index 0. i will use a for loop to scroll through every column finding out the most up and the most down stone in the column. So first is column 0. the most up stone is 0 and the most down is ...
17,149,200
I have graph class that looks like: ``` class Graph { public: typedef unsigned int size_type; typedef std::list<size_type> Neighbours; protected: size_type m_nodes_count, m_edges_count; public: Graph(size_type nodes_count = 0) : m_nodes_count(nodes_count), m_edges_count(0) {} virtual...
2013/06/17
[ "https://Stackoverflow.com/questions/17149200", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1017941/" ]
`gdb` is probably getting confused by an **implementation detail** the `std::list`. E.g. the old [SGI STL `list`](http://www.sgi.com/tech/stl/stl_list.h) was implemented as a **circular list**. Inside the `list` object, there is only a singly `_List_node<_Tp>` pointer called `_M_node`. The constructor puts the internal...
I think that the problem is on the copy constructor, just do this: ``` AdjList(const AdjList& g) : AdjList(g.m_nodes_count) { m_list = g.m_list ; } ``` The `operator=()` method should create a new `Vector<Row>` with the same nodes that `g.m_list` has.
3,071,254
> > If $A\_1,A\_2,\dots,A\_m$ are independent and $\mathbb{P}(A\_i)=p$ for > $i=1,\dots,m$, find the probability that: > > > * none of the $A\_i$ occur, > * an even number of the $A\_i$ occur. > > > For the first question, I would say the required probability is: $$ 1 - \mathbb{P}(\cup\_i A\_i) = 1- \mathbb{P}(...
2019/01/12
[ "https://math.stackexchange.com/questions/3071254", "https://math.stackexchange.com", "https://math.stackexchange.com/users/517825/" ]
$\DeclareMathOperator{\im}{Im}\DeclareMathOperator{sp}{Span}\require{AMScd}$First, let us understand where all the maps are going in the Smith normal form: \begin{CD} \mathbb{Z}^4 @>A>> \mathbb{Z}^3\\ @APAA @AAQA \\ \mathbb{Z}^4 @>>D> \mathbb{Z}^3 \end{CD} $P$ and $Q$ are isomorphisms (invertible), $D$ is diagonal a...
I don't know if you are follow the same course as mine but I had this exact exercice this semester with D. Testerman. Here is the solution : [![First Part](https://i.stack.imgur.com/zgTMp.png)](https://i.stack.imgur.com/zgTMp.png) [![Second Part](https://i.stack.imgur.com/ZwFIN.png)](https://i.stack.imgur.com/ZwFIN.p...
3,071,254
> > If $A\_1,A\_2,\dots,A\_m$ are independent and $\mathbb{P}(A\_i)=p$ for > $i=1,\dots,m$, find the probability that: > > > * none of the $A\_i$ occur, > * an even number of the $A\_i$ occur. > > > For the first question, I would say the required probability is: $$ 1 - \mathbb{P}(\cup\_i A\_i) = 1- \mathbb{P}(...
2019/01/12
[ "https://math.stackexchange.com/questions/3071254", "https://math.stackexchange.com", "https://math.stackexchange.com/users/517825/" ]
$\DeclareMathOperator{\im}{Im}\DeclareMathOperator{sp}{Span}\require{AMScd}$First, let us understand where all the maps are going in the Smith normal form: \begin{CD} \mathbb{Z}^4 @>A>> \mathbb{Z}^3\\ @APAA @AAQA \\ \mathbb{Z}^4 @>>D> \mathbb{Z}^3 \end{CD} $P$ and $Q$ are isomorphisms (invertible), $D$ is diagonal a...
This took me six elementary column matrices, the 4 by 4 square matrix has determinant $1.$ Actually, I combined some steps, so it might be more reasonable to indicate the square matrix as $R = R\_1 R\_2R\_3R\_4R\_5R\_6R\_7 R\_8,$ this is the order when using column operations rather than the more familiar row operation...
69,062,041
Example: =MIN({"510";"515";"503";"";"";""}) How to get the min value of this array from **non-empty** items. Item *503* to be the minimum here and is the answer.
2021/09/05
[ "https://Stackoverflow.com/questions/69062041", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1979578/" ]
This problem is about creating [disjoint sets](https://en.wikipedia.org/wiki/Disjoint-set_data_structure) and so I would use union-find methods. Now Python is not particularly known for being fast, but for the sake of showing the algorithm, here is an implementation of a `DisjointSet` class without libraries: ``` cla...
Do you mean by?: ``` from itertools import combinations l1 = [0, 5, 7, 63, 64, 101] l2 = [8, 9, 19] l3 = [78, 79] l4 = [5, 4, 34] print([v for x, y in combinations([l1, l2, l3, l4], 2) for v in {*x} & {*y}]) ``` Output: ``` [5] ```
17,447
I'm new to Arduino and microcontroller . I want to connect my Arduino Mega to three slaves which Arduino Unos. I know that these slaves will share MISO, MOSI, and SCK lines. However, SS is unique to each slave. For single slave, the SS is pin 53. So, for three slaves, which other two pins can I use as SS? Thank you ...
2015/11/03
[ "https://arduino.stackexchange.com/questions/17447", "https://arduino.stackexchange.com", "https://arduino.stackexchange.com/users/14543/" ]
To better understand how you can do this it is good to understand first just what goes on when a button bounces. It is, literally, bouncing - just like a ball when you drop it. Due to the fact that it's either connected to ground or pulled up to +5V by the pullup resistor it's either going to be LOW or HIGH with very ...
Actually, Majenko's diagram assumes the interplay of the pullup resistor forces the line back to a HIGH position (as quickly as the internal transistors can overpower the drop from the switch). If the switch itself is mechanical with a pullup resistor (external or internal), then the only thing "bouncing" is the switch...
195,030
I'm just throwing this out there for discussion/answering: If person A sat in a chair all his life, in a house on earth (let's say 100 years), and person B flew around in earth's atmosphere at let's say 1000km/h or 1000mph (which ever is easiest to comprehend) for 100 years. Would there be a time difference for thos...
2015/07/20
[ "https://physics.stackexchange.com/questions/195030", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/86302/" ]
As I understand it regular fusion in a star takes light elements as input and the output is heavier elements and energy. There are several potential steps in the regular process, e.g: * Hydrogen fusing to helium **and producing energy** which keeps the star from collapsing. * After a lot of hydrygen is spent and heliu...
As I understand it, iron will not be able to fuse with iron no matter how much of it you have gravitationally bound. Instead to fuse iron atoms together requires a supernova.
195,030
I'm just throwing this out there for discussion/answering: If person A sat in a chair all his life, in a house on earth (let's say 100 years), and person B flew around in earth's atmosphere at let's say 1000km/h or 1000mph (which ever is easiest to comprehend) for 100 years. Would there be a time difference for thos...
2015/07/20
[ "https://physics.stackexchange.com/questions/195030", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/86302/" ]
> > Let's say a field of stars all die within a short amount of time. Just > for argument's sake they produce a debris field of iron ( or any other > heavy element). Provided that there is enough time the debris will > agglomerate, we know this. > > > My question: Given enough mass, will this agglomeration of hea...
As I understand it, iron will not be able to fuse with iron no matter how much of it you have gravitationally bound. Instead to fuse iron atoms together requires a supernova.
195,030
I'm just throwing this out there for discussion/answering: If person A sat in a chair all his life, in a house on earth (let's say 100 years), and person B flew around in earth's atmosphere at let's say 1000km/h or 1000mph (which ever is easiest to comprehend) for 100 years. Would there be a time difference for thos...
2015/07/20
[ "https://physics.stackexchange.com/questions/195030", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/86302/" ]
The answer is a qualified yes, depending on your definition of fusion. If you collect together a mass of iron less than about $1.2M\_{\odot}$ it is possible for that to form a stable configuration, a little smaller than the size of the Earth, supported by electron degeneracy pressure. Such a star would just sit there ...
As I understand it, iron will not be able to fuse with iron no matter how much of it you have gravitationally bound. Instead to fuse iron atoms together requires a supernova.
195,030
I'm just throwing this out there for discussion/answering: If person A sat in a chair all his life, in a house on earth (let's say 100 years), and person B flew around in earth's atmosphere at let's say 1000km/h or 1000mph (which ever is easiest to comprehend) for 100 years. Would there be a time difference for thos...
2015/07/20
[ "https://physics.stackexchange.com/questions/195030", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/86302/" ]
> > Let's say a field of stars all die within a short amount of time. Just > for argument's sake they produce a debris field of iron ( or any other > heavy element). Provided that there is enough time the debris will > agglomerate, we know this. > > > My question: Given enough mass, will this agglomeration of hea...
As I understand it regular fusion in a star takes light elements as input and the output is heavier elements and energy. There are several potential steps in the regular process, e.g: * Hydrogen fusing to helium **and producing energy** which keeps the star from collapsing. * After a lot of hydrygen is spent and heliu...
195,030
I'm just throwing this out there for discussion/answering: If person A sat in a chair all his life, in a house on earth (let's say 100 years), and person B flew around in earth's atmosphere at let's say 1000km/h or 1000mph (which ever is easiest to comprehend) for 100 years. Would there be a time difference for thos...
2015/07/20
[ "https://physics.stackexchange.com/questions/195030", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/86302/" ]
As I understand it regular fusion in a star takes light elements as input and the output is heavier elements and energy. There are several potential steps in the regular process, e.g: * Hydrogen fusing to helium **and producing energy** which keeps the star from collapsing. * After a lot of hydrygen is spent and heliu...
Iron won't fuse into heavier elements. It's a question of nuclear physics. Iron is the most stable form of nuclear matter. In other words, iron has the lowest energy configuration of all nuclear matter. Fusion can appear in the cores of stars because it's an exothermic process, that is, fusing nuclei lighter than iro...
195,030
I'm just throwing this out there for discussion/answering: If person A sat in a chair all his life, in a house on earth (let's say 100 years), and person B flew around in earth's atmosphere at let's say 1000km/h or 1000mph (which ever is easiest to comprehend) for 100 years. Would there be a time difference for thos...
2015/07/20
[ "https://physics.stackexchange.com/questions/195030", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/86302/" ]
> > Let's say a field of stars all die within a short amount of time. Just > for argument's sake they produce a debris field of iron ( or any other > heavy element). Provided that there is enough time the debris will > agglomerate, we know this. > > > My question: Given enough mass, will this agglomeration of hea...
Iron won't fuse into heavier elements. It's a question of nuclear physics. Iron is the most stable form of nuclear matter. In other words, iron has the lowest energy configuration of all nuclear matter. Fusion can appear in the cores of stars because it's an exothermic process, that is, fusing nuclei lighter than iro...
195,030
I'm just throwing this out there for discussion/answering: If person A sat in a chair all his life, in a house on earth (let's say 100 years), and person B flew around in earth's atmosphere at let's say 1000km/h or 1000mph (which ever is easiest to comprehend) for 100 years. Would there be a time difference for thos...
2015/07/20
[ "https://physics.stackexchange.com/questions/195030", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/86302/" ]
> > Let's say a field of stars all die within a short amount of time. Just > for argument's sake they produce a debris field of iron ( or any other > heavy element). Provided that there is enough time the debris will > agglomerate, we know this. > > > My question: Given enough mass, will this agglomeration of hea...
The answer is a qualified yes, depending on your definition of fusion. If you collect together a mass of iron less than about $1.2M\_{\odot}$ it is possible for that to form a stable configuration, a little smaller than the size of the Earth, supported by electron degeneracy pressure. Such a star would just sit there ...
195,030
I'm just throwing this out there for discussion/answering: If person A sat in a chair all his life, in a house on earth (let's say 100 years), and person B flew around in earth's atmosphere at let's say 1000km/h or 1000mph (which ever is easiest to comprehend) for 100 years. Would there be a time difference for thos...
2015/07/20
[ "https://physics.stackexchange.com/questions/195030", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/86302/" ]
The answer is a qualified yes, depending on your definition of fusion. If you collect together a mass of iron less than about $1.2M\_{\odot}$ it is possible for that to form a stable configuration, a little smaller than the size of the Earth, supported by electron degeneracy pressure. Such a star would just sit there ...
Iron won't fuse into heavier elements. It's a question of nuclear physics. Iron is the most stable form of nuclear matter. In other words, iron has the lowest energy configuration of all nuclear matter. Fusion can appear in the cores of stars because it's an exothermic process, that is, fusing nuclei lighter than iro...
34,066,607
When I have to write a reference to a callable function I use the standard syntax of PHP [defined as](http://php.net/manual/it/language.types.callable.php): > > A PHP function is **passed by its name as a string**. Any built-in or user-defined function can be used *[... omitted...]*. > > > A method of an instantiat...
2015/12/03
[ "https://Stackoverflow.com/questions/34066607", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7002281/" ]
You already are next to the shortest thing you can do You can perfectly call your anonymous function directly in your function call without using a variable For instance, you can replace: ``` $callable=function($param) use ($object){ return $object->myMethod($param); } call_user_func($callable, $param); ``` b...
I became to a solution, always based on the [anonymous-functions](http://php.net/manual/it/functions.anonymous.php) that solve the problem but leave me not full satisfied: **Static method of a class** ``` $callable = function($param){ return \my\namespace\myClass::myMethod($param); } ``` **method of a object*...
34,440,838
WebBrowser control has a ContextMenuStrip property that can be set to a context menu. But this menu appears by right-click, how can I show it by left-click? There is no `Click` event for WebBrowser control and the `MousePosition` of `WebBrowser.Document` click event is not precise. It seems it depends on the element th...
2015/12/23
[ "https://Stackoverflow.com/questions/34440838", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2651073/" ]
You can assign a handler to [`Click`](https://msdn.microsoft.com/en-us/library/system.windows.forms.htmldocument.click(v=vs.110).aspx) event or other mouse events of [`Document`](https://msdn.microsoft.com/en-us/library/system.windows.forms.webbrowser.document(v=vs.110).aspx) and show the context menu at [`Cursor.Posit...
Here is some code for you. What you are looking for is doable with an event handler. If you need help please ask in comments. ``` this._browser.DocumentCompleted+=new WebBrowserDocumentCompletedEventHandler(browser_DocumentCompleted); ... private void browser_DocumentCompleted(Object sender, WebBrowserDocumentComplete...
70,423,477
I have a C++ class which I intend to call from python's mpi4py interface such that each node spawns the class. On the C++ side, I'm using the [Open MPI](https://www.open-mpi.org/) library (installed via [homebrew](https://formulae.brew.sh/formula/open-mpi)) and [pybind11](https://github.com/pybind/pybind11). The C++ c...
2021/12/20
[ "https://Stackoverflow.com/questions/70423477", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4593199/" ]
I understand that you would like to have an explanation and not just a code dump or some comments. So, let me try to explain you. As you know: Numbers like 12345 in a base 10 numbering system or decimal system are build of a digit and a power of 10. Mathematically you could write 12345 also a `5*10^0 + 4*10^1 + 3*10^...
I can offer the solution of your problem: ``` #include <iostream> #include <vector> #include <map> #include <set> #include <tuple> using namespace std; void showContentVector(vector<int>& input) { for(int i=0; i<input.size(); ++i) { cout<<input[i]<<", "; } return; } void showContentMap(map<int,...
70,423,477
I have a C++ class which I intend to call from python's mpi4py interface such that each node spawns the class. On the C++ side, I'm using the [Open MPI](https://www.open-mpi.org/) library (installed via [homebrew](https://formulae.brew.sh/formula/open-mpi)) and [pybind11](https://github.com/pybind/pybind11). The C++ c...
2021/12/20
[ "https://Stackoverflow.com/questions/70423477", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4593199/" ]
I can offer the solution of your problem: ``` #include <iostream> #include <vector> #include <map> #include <set> #include <tuple> using namespace std; void showContentVector(vector<int>& input) { for(int i=0; i<input.size(); ++i) { cout<<input[i]<<", "; } return; } void showContentMap(map<int,...
A possible solution: * reading your input as a string, * checking if the input is a valid number (contains only digits), * then counting the digits using an array of 10 elements (one for each digit from 0 to 9). A couple of notes on the code below: 1. Why `counts[c - '0']`? Subscript operator, `[]`, will use a `size...
70,423,477
I have a C++ class which I intend to call from python's mpi4py interface such that each node spawns the class. On the C++ side, I'm using the [Open MPI](https://www.open-mpi.org/) library (installed via [homebrew](https://formulae.brew.sh/formula/open-mpi)) and [pybind11](https://github.com/pybind/pybind11). The C++ c...
2021/12/20
[ "https://Stackoverflow.com/questions/70423477", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4593199/" ]
I can offer the solution of your problem: ``` #include <iostream> #include <vector> #include <map> #include <set> #include <tuple> using namespace std; void showContentVector(vector<int>& input) { for(int i=0; i<input.size(); ++i) { cout<<input[i]<<", "; } return; } void showContentMap(map<int,...
A simple approach: Assuming you want to get the number of digits of the decimal equivalent of the number, you can convert the int to a string, then count the digit characters: ``` #include <string> [...] char digit = '3'; // or any digit int num = 321523; // or any number // convert to decimal string std::string str_...
70,423,477
I have a C++ class which I intend to call from python's mpi4py interface such that each node spawns the class. On the C++ side, I'm using the [Open MPI](https://www.open-mpi.org/) library (installed via [homebrew](https://formulae.brew.sh/formula/open-mpi)) and [pybind11](https://github.com/pybind/pybind11). The C++ c...
2021/12/20
[ "https://Stackoverflow.com/questions/70423477", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4593199/" ]
I understand that you would like to have an explanation and not just a code dump or some comments. So, let me try to explain you. As you know: Numbers like 12345 in a base 10 numbering system or decimal system are build of a digit and a power of 10. Mathematically you could write 12345 also a `5*10^0 + 4*10^1 + 3*10^...
A possible solution: * reading your input as a string, * checking if the input is a valid number (contains only digits), * then counting the digits using an array of 10 elements (one for each digit from 0 to 9). A couple of notes on the code below: 1. Why `counts[c - '0']`? Subscript operator, `[]`, will use a `size...
70,423,477
I have a C++ class which I intend to call from python's mpi4py interface such that each node spawns the class. On the C++ side, I'm using the [Open MPI](https://www.open-mpi.org/) library (installed via [homebrew](https://formulae.brew.sh/formula/open-mpi)) and [pybind11](https://github.com/pybind/pybind11). The C++ c...
2021/12/20
[ "https://Stackoverflow.com/questions/70423477", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4593199/" ]
I understand that you would like to have an explanation and not just a code dump or some comments. So, let me try to explain you. As you know: Numbers like 12345 in a base 10 numbering system or decimal system are build of a digit and a power of 10. Mathematically you could write 12345 also a `5*10^0 + 4*10^1 + 3*10^...
A simple approach: Assuming you want to get the number of digits of the decimal equivalent of the number, you can convert the int to a string, then count the digit characters: ``` #include <string> [...] char digit = '3'; // or any digit int num = 321523; // or any number // convert to decimal string std::string str_...
191,621
I want to retrieve a record from SharePoint list by passing field value to CAML query using javascript,I tried below code ``` function retrieveDetails(name) { var ctx = new SP.ClientContext(appWebUrl);//Get the SharePoint Context object based upon the URL var myList = ctx.get_web().get_lists().getByTit...
2016/08/24
[ "https://sharepoint.stackexchange.com/questions/191621", "https://sharepoint.stackexchange.com", "https://sharepoint.stackexchange.com/users/52922/" ]
resolved this issue by removing `<Query></Query>` from my caml query ``` function retrieveDetails(name) { var ctx = new SP.ClientContext(appWebUrl);//Get the SharePoint Context object based upon the URL var myList = ctx.get_web().get_lists().getByTitle("PersonalDetails"); var query = new SP.CamlQue...
Your caml query is wrong. If you want to be sure it's not the code, please try this caml query: ``` query.set_viewXml('<View><Query><Where><IsNotNull><FieldRef Name=\'ID\' /></IsNotNull></Where></Query><RowLimit>100</RowLimit></View>'); ```
191,621
I want to retrieve a record from SharePoint list by passing field value to CAML query using javascript,I tried below code ``` function retrieveDetails(name) { var ctx = new SP.ClientContext(appWebUrl);//Get the SharePoint Context object based upon the URL var myList = ctx.get_web().get_lists().getByTit...
2016/08/24
[ "https://sharepoint.stackexchange.com/questions/191621", "https://sharepoint.stackexchange.com", "https://sharepoint.stackexchange.com/users/52922/" ]
resolved this issue by removing `<Query></Query>` from my caml query ``` function retrieveDetails(name) { var ctx = new SP.ClientContext(appWebUrl);//Get the SharePoint Context object based upon the URL var myList = ctx.get_web().get_lists().getByTitle("PersonalDetails"); var query = new SP.CamlQue...
Try below code to get the data from SharePoint list using CAML query. ``` function retrieveDetails(name) { var ctx = new SP.ClientContext(appWebUrl);//Get the SharePoint Context object based upon the URL var myList = ctx.get_web().get_lists().getByTitle("PersonalDetails"); var query = new SP.CamlQuer...
21,394,573
I would like to get the value for of a hiddenfield if a checkbox is checked on my gridview my gridview: ``` <asp:GridView ID="gv_enfant" runat="server" AutoGenerateColumns="False" BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="3" DataSourceID="SqlDataSource1" ...
2014/01/28
[ "https://Stackoverflow.com/questions/21394573", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Late answer, but if it still helps (or for anyone else) you should be able to do the following with SQL 2008. ``` DECLARE @point GEOMETRY = GEOMETRY::STPointFromText('POINT(0 0)', 0); DECLARE @line GEOMETRY = GEOMETRY::STLineFromText('POINT(10 10, 20 20)', 0); SELECT STIntersection(@point.STBuffer(@point.STDistance(@...
**Note @Road is the same as geography MULTILINESTRING** **SET INITIAL ROAD SEGMENT** *SET @Road* = geography::STMLineFromText('MULTILINESTRING ((-79.907603999999992 32.851905999999985, -79.907708999999983 32.851751, -79.907879999999992 32.851555999999995, -79.907889999999981 32.851542999999992, -79.907995999999983...
48,395,984
I have the following vuejs component. I know that it is a pretty simple example, but still it does not load correctly. Find below my code: ```js Vue.component('my-component', { template: '<div>{{ msg }}</div>', data: { msg: 'hello' } }); new Vue({ el: '#app-6' }); ``` ```html <!DOCTYPE html> <ht...
2018/01/23
[ "https://Stackoverflow.com/questions/48395984", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2847689/" ]
Data Must be a function always ```js var data={msg: 'hello'} Vue.component('my-component', { template: '<div>{{ msg }}</div>', data:function() { return data; } }); new Vue({ el: '#app-6' }); ``` ```html <!DOCTYPE html> <html lang="en"> <meta> <meta charset="UTF-8"> <title>Components i...
Your data should be a function like this: ``` data () { return { msg: 'Hello' } } ``` More information here: <https://v2.vuejs.org/v2/guide/components.html#data-Must-Be-a-Function>
48,395,984
I have the following vuejs component. I know that it is a pretty simple example, but still it does not load correctly. Find below my code: ```js Vue.component('my-component', { template: '<div>{{ msg }}</div>', data: { msg: 'hello' } }); new Vue({ el: '#app-6' }); ``` ```html <!DOCTYPE html> <ht...
2018/01/23
[ "https://Stackoverflow.com/questions/48395984", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2847689/" ]
Your data should be a function like this: ``` data () { return { msg: 'Hello' } } ``` More information here: <https://v2.vuejs.org/v2/guide/components.html#data-Must-Be-a-Function>
you should do it like this. ``` Vue.component('my-component', { template: '<div>{{ msg }}</div>', data: function () { return { msg: 'Hello' } } }); ```
48,395,984
I have the following vuejs component. I know that it is a pretty simple example, but still it does not load correctly. Find below my code: ```js Vue.component('my-component', { template: '<div>{{ msg }}</div>', data: { msg: 'hello' } }); new Vue({ el: '#app-6' }); ``` ```html <!DOCTYPE html> <ht...
2018/01/23
[ "https://Stackoverflow.com/questions/48395984", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2847689/" ]
Data Must be a function always ```js var data={msg: 'hello'} Vue.component('my-component', { template: '<div>{{ msg }}</div>', data:function() { return data; } }); new Vue({ el: '#app-6' }); ``` ```html <!DOCTYPE html> <html lang="en"> <meta> <meta charset="UTF-8"> <title>Components i...
you should do it like this. ``` Vue.component('my-component', { template: '<div>{{ msg }}</div>', data: function () { return { msg: 'Hello' } } }); ```
51,195,379
Strange issue... This is using VisualStudio Community 2017 and is a C++CLI WinForms project. **BGStatsInterface.cpp** ``` #include "BGStatsInterface.h" using namespace System; using namespace System::Windows::Forms; [STAThreadAttribute] void Main(array<String^>^ args) { Application::EnableVisualStyles(); A...
2018/07/05
[ "https://Stackoverflow.com/questions/51195379", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7194063/" ]
This happens when using #include Windows.h as it defines ::IServiceProvider while the framework has System::IServiceProvider, then when there's a using namespace System in scope somewhere it becomes ambiguous. Solution is to simply put the delcarations in your own namespace.
Just providing another solution in here if your project is small - remove: ``` using namespace System; ``` and use full type name in the code for System's class, e.g. `System::String^`.
51,195,379
Strange issue... This is using VisualStudio Community 2017 and is a C++CLI WinForms project. **BGStatsInterface.cpp** ``` #include "BGStatsInterface.h" using namespace System; using namespace System::Windows::Forms; [STAThreadAttribute] void Main(array<String^>^ args) { Application::EnableVisualStyles(); A...
2018/07/05
[ "https://Stackoverflow.com/questions/51195379", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7194063/" ]
This happens when using #include Windows.h as it defines ::IServiceProvider while the framework has System::IServiceProvider, then when there's a using namespace System in scope somewhere it becomes ambiguous. Solution is to simply put the delcarations in your own namespace.
To fix this, put your include file (that has windows.h in it) before declaring your namespaces and/or using statements: So: ``` #include "stdafx.h" using namespace System; ``` instead of ``` using namespace System; #include "stdafx.h" ``` Hat tip to <http://www.windows-tech.info/17/fbe07cd4dfcac878.php>
32,356,907
I have basic order form (4 inputs only for testing purposes), i want to count number of inputs (total items) where value is filled in and higher then 0 (basicaly how many products has been ordered, no to confuse with their quantities). When i add products is fine, problems start when I remove items( set them to 0). Cou...
2015/09/02
[ "https://Stackoverflow.com/questions/32356907", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1826668/" ]
Just use a jquery selector and loop through it. ``` $("input").change(function(){ var counter = 0; $("input").each(function(){ if($(this).val() != "" && $(this).val() != 0) counter++; }); $("#order_total").html('Total Items:' + counter + '<br>' + 'Order Subtotal: ' + total); }); ```
``` if(total > 0){ var counter = 0; $("input[type=text]").each(function(){ if($(this).val() != "" && $(this).val() != 0) counter++; }); $("#order_total").html('Total Items:' + counter + '<br>' + 'Order Subtotal: ' + total); $("#order_total").show(); $('.submitorder').show(); } if(total == ...
9,553,939
I'm trying to crawl FTP and pull down all the files recursively. Up until now I was trying to pull down a directory with ``` ftp.list.each do |entry| if entry.split(/\s+/)[0][0, 1] == "d" out[:dirs] << entry.split.last unless black_dirs.include? entry.split.last else out[:files] << entry.spli...
2012/03/04
[ "https://Stackoverflow.com/questions/9553939", "https://Stackoverflow.com", "https://Stackoverflow.com/users/853685/" ]
You can also use a regular expression. I put one together. Please verify if it works for you as well as I don't know it your dir listing look different. You have to use Ruby 1.9 btw. ``` reg = /^(?<type>.{1})(?<mode>\S+)\s+(?<number>\d+)\s+(?<owner>\S+)\s+(?<group>\S+)\s+(?<size>\d+)\s+(?<mod_time>.{12})\s+(?<path>.+)...
You can avoid recursion if you list all files at once `files = ftp.nlst('**/*.*')` Directories are not included in the list but the full ftp path is still available in the name. EDIT I'm assuming that each file name contains a dot and directory names don't. Thanks for mentioning @Niklas B.
9,553,939
I'm trying to crawl FTP and pull down all the files recursively. Up until now I was trying to pull down a directory with ``` ftp.list.each do |entry| if entry.split(/\s+/)[0][0, 1] == "d" out[:dirs] << entry.split.last unless black_dirs.include? entry.split.last else out[:files] << entry.spli...
2012/03/04
[ "https://Stackoverflow.com/questions/9553939", "https://Stackoverflow.com", "https://Stackoverflow.com/users/853685/" ]
Assuming that the FTP server returns *Unix-like* file listings, the following code works. At least for me. ``` regex = /^d[r|w|x|-]+\s+[0-9]\s+\S+\s+\S+\s+\d+\s+\w+\s+\d+\s+[\d|:]+\s(.+)/ ftp.ls.each do |line| if dir = line.match(regex) puts dir[1] end end ``` `dir[1]` contains the name of the direct...
As @Alex pointed out, using patterns in filenames for this is hardly reliable. Directories CAN have dots in their names (.ssh for example), and listings can be very different on different servers. His method works, but as he himself points out, takes too long. I prefer using the .size method from Net::FTP. It retur...
9,553,939
I'm trying to crawl FTP and pull down all the files recursively. Up until now I was trying to pull down a directory with ``` ftp.list.each do |entry| if entry.split(/\s+/)[0][0, 1] == "d" out[:dirs] << entry.split.last unless black_dirs.include? entry.split.last else out[:files] << entry.spli...
2012/03/04
[ "https://Stackoverflow.com/questions/9553939", "https://Stackoverflow.com", "https://Stackoverflow.com/users/853685/" ]
Assuming that the FTP server returns *Unix-like* file listings, the following code works. At least for me. ``` regex = /^d[r|w|x|-]+\s+[0-9]\s+\S+\s+\S+\s+\d+\s+\w+\s+\d+\s+[\d|:]+\s(.+)/ ftp.ls.each do |line| if dir = line.match(regex) puts dir[1] end end ``` `dir[1]` contains the name of the direct...
I'll add my solution to the mix... Using `ftp.nlst('**/*.*')` did not work for me... server doesn't seem to support that \*\* syntax. The chdir trick with a `rescue` seems expensive and hackish. Assuming that all files have at least one char, a single period, and then an extension, I did a simple recursion. ``` d...
9,553,939
I'm trying to crawl FTP and pull down all the files recursively. Up until now I was trying to pull down a directory with ``` ftp.list.each do |entry| if entry.split(/\s+/)[0][0, 1] == "d" out[:dirs] << entry.split.last unless black_dirs.include? entry.split.last else out[:files] << entry.spli...
2012/03/04
[ "https://Stackoverflow.com/questions/9553939", "https://Stackoverflow.com", "https://Stackoverflow.com/users/853685/" ]
There are a huge variety of FTP servers around. We have clients who use some obscure proprietary, Windows-based servers and the file listing returned by them look completely different from Linux versions. So what I ended up doing is for each file/directory entry I try changing directory into it and if this doesn't wo...
I'll add my solution to the mix... Using `ftp.nlst('**/*.*')` did not work for me... server doesn't seem to support that \*\* syntax. The chdir trick with a `rescue` seems expensive and hackish. Assuming that all files have at least one char, a single period, and then an extension, I did a simple recursion. ``` d...
9,553,939
I'm trying to crawl FTP and pull down all the files recursively. Up until now I was trying to pull down a directory with ``` ftp.list.each do |entry| if entry.split(/\s+/)[0][0, 1] == "d" out[:dirs] << entry.split.last unless black_dirs.include? entry.split.last else out[:files] << entry.spli...
2012/03/04
[ "https://Stackoverflow.com/questions/9553939", "https://Stackoverflow.com", "https://Stackoverflow.com/users/853685/" ]
You can also use a regular expression. I put one together. Please verify if it works for you as well as I don't know it your dir listing look different. You have to use Ruby 1.9 btw. ``` reg = /^(?<type>.{1})(?<mode>\S+)\s+(?<number>\d+)\s+(?<owner>\S+)\s+(?<group>\S+)\s+(?<size>\d+)\s+(?<mod_time>.{12})\s+(?<path>.+)...
There are a huge variety of FTP servers around. We have clients who use some obscure proprietary, Windows-based servers and the file listing returned by them look completely different from Linux versions. So what I ended up doing is for each file/directory entry I try changing directory into it and if this doesn't wo...
9,553,939
I'm trying to crawl FTP and pull down all the files recursively. Up until now I was trying to pull down a directory with ``` ftp.list.each do |entry| if entry.split(/\s+/)[0][0, 1] == "d" out[:dirs] << entry.split.last unless black_dirs.include? entry.split.last else out[:files] << entry.spli...
2012/03/04
[ "https://Stackoverflow.com/questions/9553939", "https://Stackoverflow.com", "https://Stackoverflow.com/users/853685/" ]
You can avoid recursion if you list all files at once `files = ftp.nlst('**/*.*')` Directories are not included in the list but the full ftp path is still available in the name. EDIT I'm assuming that each file name contains a dot and directory names don't. Thanks for mentioning @Niklas B.
As @Alex pointed out, using patterns in filenames for this is hardly reliable. Directories CAN have dots in their names (.ssh for example), and listings can be very different on different servers. His method works, but as he himself points out, takes too long. I prefer using the .size method from Net::FTP. It retur...
9,553,939
I'm trying to crawl FTP and pull down all the files recursively. Up until now I was trying to pull down a directory with ``` ftp.list.each do |entry| if entry.split(/\s+/)[0][0, 1] == "d" out[:dirs] << entry.split.last unless black_dirs.include? entry.split.last else out[:files] << entry.spli...
2012/03/04
[ "https://Stackoverflow.com/questions/9553939", "https://Stackoverflow.com", "https://Stackoverflow.com/users/853685/" ]
You can also use a regular expression. I put one together. Please verify if it works for you as well as I don't know it your dir listing look different. You have to use Ruby 1.9 btw. ``` reg = /^(?<type>.{1})(?<mode>\S+)\s+(?<number>\d+)\s+(?<owner>\S+)\s+(?<group>\S+)\s+(?<size>\d+)\s+(?<mod_time>.{12})\s+(?<path>.+)...
As @Alex pointed out, using patterns in filenames for this is hardly reliable. Directories CAN have dots in their names (.ssh for example), and listings can be very different on different servers. His method works, but as he himself points out, takes too long. I prefer using the .size method from Net::FTP. It retur...
9,553,939
I'm trying to crawl FTP and pull down all the files recursively. Up until now I was trying to pull down a directory with ``` ftp.list.each do |entry| if entry.split(/\s+/)[0][0, 1] == "d" out[:dirs] << entry.split.last unless black_dirs.include? entry.split.last else out[:files] << entry.spli...
2012/03/04
[ "https://Stackoverflow.com/questions/9553939", "https://Stackoverflow.com", "https://Stackoverflow.com/users/853685/" ]
You can also use a regular expression. I put one together. Please verify if it works for you as well as I don't know it your dir listing look different. You have to use Ruby 1.9 btw. ``` reg = /^(?<type>.{1})(?<mode>\S+)\s+(?<number>\d+)\s+(?<owner>\S+)\s+(?<group>\S+)\s+(?<size>\d+)\s+(?<mod_time>.{12})\s+(?<path>.+)...
Assuming that the FTP server returns *Unix-like* file listings, the following code works. At least for me. ``` regex = /^d[r|w|x|-]+\s+[0-9]\s+\S+\s+\S+\s+\d+\s+\w+\s+\d+\s+[\d|:]+\s(.+)/ ftp.ls.each do |line| if dir = line.match(regex) puts dir[1] end end ``` `dir[1]` contains the name of the direct...
9,553,939
I'm trying to crawl FTP and pull down all the files recursively. Up until now I was trying to pull down a directory with ``` ftp.list.each do |entry| if entry.split(/\s+/)[0][0, 1] == "d" out[:dirs] << entry.split.last unless black_dirs.include? entry.split.last else out[:files] << entry.spli...
2012/03/04
[ "https://Stackoverflow.com/questions/9553939", "https://Stackoverflow.com", "https://Stackoverflow.com/users/853685/" ]
You can also use a regular expression. I put one together. Please verify if it works for you as well as I don't know it your dir listing look different. You have to use Ruby 1.9 btw. ``` reg = /^(?<type>.{1})(?<mode>\S+)\s+(?<number>\d+)\s+(?<owner>\S+)\s+(?<group>\S+)\s+(?<size>\d+)\s+(?<mod_time>.{12})\s+(?<path>.+)...
I'll add my solution to the mix... Using `ftp.nlst('**/*.*')` did not work for me... server doesn't seem to support that \*\* syntax. The chdir trick with a `rescue` seems expensive and hackish. Assuming that all files have at least one char, a single period, and then an extension, I did a simple recursion. ``` d...
9,553,939
I'm trying to crawl FTP and pull down all the files recursively. Up until now I was trying to pull down a directory with ``` ftp.list.each do |entry| if entry.split(/\s+/)[0][0, 1] == "d" out[:dirs] << entry.split.last unless black_dirs.include? entry.split.last else out[:files] << entry.spli...
2012/03/04
[ "https://Stackoverflow.com/questions/9553939", "https://Stackoverflow.com", "https://Stackoverflow.com/users/853685/" ]
There are a huge variety of FTP servers around. We have clients who use some obscure proprietary, Windows-based servers and the file listing returned by them look completely different from Linux versions. So what I ended up doing is for each file/directory entry I try changing directory into it and if this doesn't wo...
As @Alex pointed out, using patterns in filenames for this is hardly reliable. Directories CAN have dots in their names (.ssh for example), and listings can be very different on different servers. His method works, but as he himself points out, takes too long. I prefer using the .size method from Net::FTP. It retur...
13,539,692
Say we have the following classes: ``` class DoubleOhSeven { public static void doSomethingClassy(); public static void neverDoThisClassy(); } class Dude { public void doSomething(); public void neverDoThis(); } public class Party { public static void main(String[] args){ DoubleOhSeven.doSomething(); ...
2012/11/24
[ "https://Stackoverflow.com/questions/13539692", "https://Stackoverflow.com", "https://Stackoverflow.com/users/390897/" ]
The unused methods are still there occupying memory as part of the class / object, even if they're not directly called. If they were optimised away, then that would make reflective calls on these methods impossible. One could argue that an optimisation could be generated that only stored the method stub in memory, an...
The unused methods inrease the class size, but classes are stored in a so called PermGen memory. The heap memory, where regular java objects are stored, is not affected by class size
13,539,692
Say we have the following classes: ``` class DoubleOhSeven { public static void doSomethingClassy(); public static void neverDoThisClassy(); } class Dude { public void doSomething(); public void neverDoThis(); } public class Party { public static void main(String[] args){ DoubleOhSeven.doSomething(); ...
2012/11/24
[ "https://Stackoverflow.com/questions/13539692", "https://Stackoverflow.com", "https://Stackoverflow.com/users/390897/" ]
The unused methods are still there occupying memory as part of the class / object, even if they're not directly called. If they were optimised away, then that would make reflective calls on these methods impossible. One could argue that an optimisation could be generated that only stored the method stub in memory, an...
The memory used by an instance of a class `Abc` does not depend on how many methods there are in `Abc`. The generated bytecode obviously does increase in size when you add methods, whether they do something or not, but that would only affect the size of the class object `Abc.class`, which is loaded only once, regardle...
13,539,692
Say we have the following classes: ``` class DoubleOhSeven { public static void doSomethingClassy(); public static void neverDoThisClassy(); } class Dude { public void doSomething(); public void neverDoThis(); } public class Party { public static void main(String[] args){ DoubleOhSeven.doSomething(); ...
2012/11/24
[ "https://Stackoverflow.com/questions/13539692", "https://Stackoverflow.com", "https://Stackoverflow.com/users/390897/" ]
The unused methods are still there occupying memory as part of the class / object, even if they're not directly called. If they were optimised away, then that would make reflective calls on these methods impossible. One could argue that an optimisation could be generated that only stored the method stub in memory, an...
Since classes are safed in ther PermGen for Sun Hotspot JVMs (that will change for Java 8), you can do something like this, first run: ``` MemoryMXBean memoryMXBean = ManagementFactory.getMemoryMXBean(); long before = memoryMXBean.getNonHeapMemoryUsage().getUsed(); new Dude(); // class must not be loaded before Syste...
13,539,692
Say we have the following classes: ``` class DoubleOhSeven { public static void doSomethingClassy(); public static void neverDoThisClassy(); } class Dude { public void doSomething(); public void neverDoThis(); } public class Party { public static void main(String[] args){ DoubleOhSeven.doSomething(); ...
2012/11/24
[ "https://Stackoverflow.com/questions/13539692", "https://Stackoverflow.com", "https://Stackoverflow.com/users/390897/" ]
The unused methods are still there occupying memory as part of the class / object, even if they're not directly called. If they were optimised away, then that would make reflective calls on these methods impossible. One could argue that an optimisation could be generated that only stored the method stub in memory, an...
The method can be compiled and loaded to PerGen. But JVM maybe `optimize` method using `method inlining`. Eg: ``` public class Test { public void foo(){ System.out.println("foo"); bar(); } public void bar(){ System.out.println("bar"); } } ``` The method will be compiled li...
13,539,692
Say we have the following classes: ``` class DoubleOhSeven { public static void doSomethingClassy(); public static void neverDoThisClassy(); } class Dude { public void doSomething(); public void neverDoThis(); } public class Party { public static void main(String[] args){ DoubleOhSeven.doSomething(); ...
2012/11/24
[ "https://Stackoverflow.com/questions/13539692", "https://Stackoverflow.com", "https://Stackoverflow.com/users/390897/" ]
The memory used by an instance of a class `Abc` does not depend on how many methods there are in `Abc`. The generated bytecode obviously does increase in size when you add methods, whether they do something or not, but that would only affect the size of the class object `Abc.class`, which is loaded only once, regardle...
The unused methods inrease the class size, but classes are stored in a so called PermGen memory. The heap memory, where regular java objects are stored, is not affected by class size
13,539,692
Say we have the following classes: ``` class DoubleOhSeven { public static void doSomethingClassy(); public static void neverDoThisClassy(); } class Dude { public void doSomething(); public void neverDoThis(); } public class Party { public static void main(String[] args){ DoubleOhSeven.doSomething(); ...
2012/11/24
[ "https://Stackoverflow.com/questions/13539692", "https://Stackoverflow.com", "https://Stackoverflow.com/users/390897/" ]
Since classes are safed in ther PermGen for Sun Hotspot JVMs (that will change for Java 8), you can do something like this, first run: ``` MemoryMXBean memoryMXBean = ManagementFactory.getMemoryMXBean(); long before = memoryMXBean.getNonHeapMemoryUsage().getUsed(); new Dude(); // class must not be loaded before Syste...
The unused methods inrease the class size, but classes are stored in a so called PermGen memory. The heap memory, where regular java objects are stored, is not affected by class size
13,539,692
Say we have the following classes: ``` class DoubleOhSeven { public static void doSomethingClassy(); public static void neverDoThisClassy(); } class Dude { public void doSomething(); public void neverDoThis(); } public class Party { public static void main(String[] args){ DoubleOhSeven.doSomething(); ...
2012/11/24
[ "https://Stackoverflow.com/questions/13539692", "https://Stackoverflow.com", "https://Stackoverflow.com/users/390897/" ]
The unused methods inrease the class size, but classes are stored in a so called PermGen memory. The heap memory, where regular java objects are stored, is not affected by class size
The method can be compiled and loaded to PerGen. But JVM maybe `optimize` method using `method inlining`. Eg: ``` public class Test { public void foo(){ System.out.println("foo"); bar(); } public void bar(){ System.out.println("bar"); } } ``` The method will be compiled li...
13,539,692
Say we have the following classes: ``` class DoubleOhSeven { public static void doSomethingClassy(); public static void neverDoThisClassy(); } class Dude { public void doSomething(); public void neverDoThis(); } public class Party { public static void main(String[] args){ DoubleOhSeven.doSomething(); ...
2012/11/24
[ "https://Stackoverflow.com/questions/13539692", "https://Stackoverflow.com", "https://Stackoverflow.com/users/390897/" ]
The memory used by an instance of a class `Abc` does not depend on how many methods there are in `Abc`. The generated bytecode obviously does increase in size when you add methods, whether they do something or not, but that would only affect the size of the class object `Abc.class`, which is loaded only once, regardle...
The method can be compiled and loaded to PerGen. But JVM maybe `optimize` method using `method inlining`. Eg: ``` public class Test { public void foo(){ System.out.println("foo"); bar(); } public void bar(){ System.out.println("bar"); } } ``` The method will be compiled li...
13,539,692
Say we have the following classes: ``` class DoubleOhSeven { public static void doSomethingClassy(); public static void neverDoThisClassy(); } class Dude { public void doSomething(); public void neverDoThis(); } public class Party { public static void main(String[] args){ DoubleOhSeven.doSomething(); ...
2012/11/24
[ "https://Stackoverflow.com/questions/13539692", "https://Stackoverflow.com", "https://Stackoverflow.com/users/390897/" ]
Since classes are safed in ther PermGen for Sun Hotspot JVMs (that will change for Java 8), you can do something like this, first run: ``` MemoryMXBean memoryMXBean = ManagementFactory.getMemoryMXBean(); long before = memoryMXBean.getNonHeapMemoryUsage().getUsed(); new Dude(); // class must not be loaded before Syste...
The method can be compiled and loaded to PerGen. But JVM maybe `optimize` method using `method inlining`. Eg: ``` public class Test { public void foo(){ System.out.println("foo"); bar(); } public void bar(){ System.out.println("bar"); } } ``` The method will be compiled li...
26,404
In our web-application(built on Bootstrap and Angular), certain tabs in the navbar are displayed only to particular users. Certain input boxes/ buttons are enabled only to certain users. I want to write test scripts using Selenium/ Sikuli to test this functionality and I want your suggestions in this approach. One of ...
2017/03/26
[ "https://sqa.stackexchange.com/questions/26404", "https://sqa.stackexchange.com", "https://sqa.stackexchange.com/users/24825/" ]
I think the name comes from the resulting graph over-time, which is called a stairstep graph. I don't think it is official, but more some terms added together which seemed logical. The step load pattern increases the user load periodically during the load test. Creating a stairstep graph where you show number of users...
"Stair-Step" is also know as "Ramp up". In this type of Performance Testing, load is increased in a schedule intervals to check the server performance.
26,404
In our web-application(built on Bootstrap and Angular), certain tabs in the navbar are displayed only to particular users. Certain input boxes/ buttons are enabled only to certain users. I want to write test scripts using Selenium/ Sikuli to test this functionality and I want your suggestions in this approach. One of ...
2017/03/26
[ "https://sqa.stackexchange.com/questions/26404", "https://sqa.stackexchange.com", "https://sqa.stackexchange.com/users/24825/" ]
I think the name comes from the resulting graph over-time, which is called a stairstep graph. I don't think it is official, but more some terms added together which seemed logical. The step load pattern increases the user load periodically during the load test. Creating a stairstep graph where you show number of users...
Load is increased over time and by set increments. Users observe whether the server load on memory, cpu, etc. and response time remain constant, increase proportionally or start to increase disproportionately. It is done in steps or increments for efficiency. Instead of 5000 different tests with 1,2,3,4,5,6,7,8... 50...
26,404
In our web-application(built on Bootstrap and Angular), certain tabs in the navbar are displayed only to particular users. Certain input boxes/ buttons are enabled only to certain users. I want to write test scripts using Selenium/ Sikuli to test this functionality and I want your suggestions in this approach. One of ...
2017/03/26
[ "https://sqa.stackexchange.com/questions/26404", "https://sqa.stackexchange.com", "https://sqa.stackexchange.com/users/24825/" ]
I think the name comes from the resulting graph over-time, which is called a stairstep graph. I don't think it is official, but more some terms added together which seemed logical. The step load pattern increases the user load periodically during the load test. Creating a stairstep graph where you show number of users...
Here is an explanation for the term you are looking for. Though I believe that the adliteram term you are after does not exist, but it refers to the different approaches to **load patterns**. The **step** load pattern is used to specify a user load that increases with time up to a defined maximum user load. For steppi...
64,872,442
I deployed a Rails application in Digital Ocean Ubuntu Server using Capistrano. For some reason the puma server suddenly stops. I'm not sure what's the reason. That's why I created a script **/home/deploy/startup-script.sh** the script contains the commands to startup the Rails application in daemon ``` #!/bin/bash ...
2020/11/17
[ "https://Stackoverflow.com/questions/64872442", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1077711/" ]
I agree with OP that, the simple predicate of the O(N) algo might not work on the stack-based solution when looking for the first element > 2x in the remaining array. I found a O(NlogN) solution for this btw. It uses a **Min-heap** to maintain the frontier elements we are interested in. ### Pseudo-code: ``` def get...
Sure, easily. We just need a sorted version of the array (sorted elements plus their original index) and then we can do an efficient search (a modified binary search) that points us to the start of the elements that are larger than the current number (or a multiple of it, it doesn't matter). Those elements we can then...
64,872,442
I deployed a Rails application in Digital Ocean Ubuntu Server using Capistrano. For some reason the puma server suddenly stops. I'm not sure what's the reason. That's why I created a script **/home/deploy/startup-script.sh** the script contains the commands to startup the Rails application in daemon ``` #!/bin/bash ...
2020/11/17
[ "https://Stackoverflow.com/questions/64872442", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1077711/" ]
I agree with OP that, the simple predicate of the O(N) algo might not work on the stack-based solution when looking for the first element > 2x in the remaining array. I found a O(NlogN) solution for this btw. It uses a **Min-heap** to maintain the frontier elements we are interested in. ### Pseudo-code: ``` def get...
The stack-based solution [offered at geeksforgeeks](https://www.geeksforgeeks.org/next-greater-element/) does not seem to maintain the order of the elements in the result even in its output: ``` input: int arr[] = { 11, 13, 21, 3 }; output: 11 -- 13 13 -- 21 3 -- -1 21 -- -1 ``` After minor modification to find...
29,578,436
I am new to Swift I am using MPMovieviewcontroller when i click next or previous button then no event occurs here is code ``` import UIKit import MediaPlayer class ViewController: UIViewController { var i : Int = 0 var movieplayer : MPMoviePlayerController! var arr = ["Akbar","Serial","ak"] override func viewDidLoad...
2015/04/11
[ "https://Stackoverflow.com/questions/29578436", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4741194/" ]
Try this ``` func startplaying() { if i <= 2 { let path = NSBundle.mainBundle().pathForResource(arr[i], ofType: "mov") let url = NSURL.fileURLWithPath(path!) movieplayer.contentURL = NSURL.fileURLWithPath(url) } ``` Read more: [Play MP4 using MPMoviePlayerController() in Swift](https://stacko...
Here I do next/Previous Manully using button I hope it is proper way to next/previous operation ``` import UIKit import MediaPlayer class ViewController: UIViewController { var movieplayer : MPMoviePlayerController! var arr = ["ak","Serial","Akbar"] var i = 0 override func viewDidLoad() { super.viewDidLoad() s...
15,700,850
I am having some trouble finding a solution in mySQL, I have 2 tables where in the one I have my images and in the other I have my votes and image\_id that I bind together using this line: ``` $sql = "SELECT `image` FROM `sh_images`, `sh_votes` WHERE `sh_images`.`id`=`sh_votes`.`image_id` ORDER BY `vote` DESC"; ``` ...
2013/03/29
[ "https://Stackoverflow.com/questions/15700850", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2223874/" ]
You should be using `LEFT JOIN` on this. `LEFT JOIN` is different from `INNER JOIN` (*which is what you are doing right now*). `LEFT JOIN` displays all the records define on the *LeftHand side* whether it has a matching record or none on the *RightHand side* table on the result. ``` SELECT image, vote FROM sh_i...
Sure, just use a LEFT JOIN: ``` SELECT image FROM sh_images LEFT JOIN sh_votes ON sh_images.id=sh_votes.image_id ORDER BY vote DESC; ``` Btw, consider using `INNER JOIN` syntax for your straight joins, it's easier to prevent a missing join condition that way.
31,470,858
I have two variables `@date` of type `datetime` and `@time` of type `time`. I want to add both to get another `datetime` variable. And I want to perform further calculations on it. Ex: ``` Declare @date datetime Declare @time time ``` I want something like this ``` @date = @date + @time (but not concatenation) S...
2015/07/17
[ "https://Stackoverflow.com/questions/31470858", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2045931/" ]
You can tranform your time to seconds and add them to your datetime value: ``` DECLARE @datetime DATETIME = GETDATE(), @time TIME = '01:16:24', @timeinseconds INT PRINT 'we add ' + CAST(@time AS VARCHAR(8)) + ' to ' + CONVERT(VARCHAR,@datetime,120)+ ':' SELECT @timeinseconds = DATEPART(SECOND, @time)...
Your code is correct. ``` DECLARE @date DATETIME = '1/1/2020' DECLARE @time TIME = '1:00 pm' DECLARE @Startdate DATETIME SET @date = @date + @time SELECT @Startdate = DATEADD(DAY, -1, @date) @date = 2020-01-01 13:00:00.000 @Startdate = 2019-12-31 13:00:00.000 ``` It isn't concatenating, it is adding them together...
31,470,858
I have two variables `@date` of type `datetime` and `@time` of type `time`. I want to add both to get another `datetime` variable. And I want to perform further calculations on it. Ex: ``` Declare @date datetime Declare @time time ``` I want something like this ``` @date = @date + @time (but not concatenation) S...
2015/07/17
[ "https://Stackoverflow.com/questions/31470858", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2045931/" ]
The only thing you are missing is that @time needs to be cast back to a datetime before adding to @date. ``` declare @date datetime = '2022-05-26' declare @time time = '09:52:14' declare @Startdate datetime set @date = @date + convert(datetime,@time) SELECT @Startdate = DATEADD(DAY, -1, @date) ``` Produces: [![ent...
I'm not sure what's going on here, but if your variables are datetime and time types, this should work just fine: ``` declare @date datetime declare @time time set @date = '20150717' set @time = '12:34:56' set @date = @date + @time select @date, DATEADD(DAY,-1,@date) ``` See [SQL Fiddle](http://sqlfiddle.com/#!3/...
31,470,858
I have two variables `@date` of type `datetime` and `@time` of type `time`. I want to add both to get another `datetime` variable. And I want to perform further calculations on it. Ex: ``` Declare @date datetime Declare @time time ``` I want something like this ``` @date = @date + @time (but not concatenation) S...
2015/07/17
[ "https://Stackoverflow.com/questions/31470858", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2045931/" ]
If you need to take only date part from `@date` and time part from `@time` - can convert your `@date` and `@time` to strings, concatenate the values and convert back to datetime: ``` select cast(convert(nvarchar(20), @date, 104) + ' ' + convert(nvarchar(20), @time, 108) as datetime2) ``` Or, alternativel...
I'm not sure what's going on here, but if your variables are datetime and time types, this should work just fine: ``` declare @date datetime declare @time time set @date = '20150717' set @time = '12:34:56' set @date = @date + @time select @date, DATEADD(DAY,-1,@date) ``` See [SQL Fiddle](http://sqlfiddle.com/#!3/...
31,470,858
I have two variables `@date` of type `datetime` and `@time` of type `time`. I want to add both to get another `datetime` variable. And I want to perform further calculations on it. Ex: ``` Declare @date datetime Declare @time time ``` I want something like this ``` @date = @date + @time (but not concatenation) S...
2015/07/17
[ "https://Stackoverflow.com/questions/31470858", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2045931/" ]
First of all convert `@date` and `@time` variables to `NVARCHAR()`, then concat them and after It convert It to `DATETIME` datatype. After It you can use `DATEADD` function on It. Try in following: ``` DECLARE @date DATETIME DECLARE @time TIME SET @date = GETDATE() SET @time = '10:12:13' SELECT DATEADD(DAY, -1, CAS...
Your code is correct. ``` DECLARE @date DATETIME = '1/1/2020' DECLARE @time TIME = '1:00 pm' DECLARE @Startdate DATETIME SET @date = @date + @time SELECT @Startdate = DATEADD(DAY, -1, @date) @date = 2020-01-01 13:00:00.000 @Startdate = 2019-12-31 13:00:00.000 ``` It isn't concatenating, it is adding them together...
31,470,858
I have two variables `@date` of type `datetime` and `@time` of type `time`. I want to add both to get another `datetime` variable. And I want to perform further calculations on it. Ex: ``` Declare @date datetime Declare @time time ``` I want something like this ``` @date = @date + @time (but not concatenation) S...
2015/07/17
[ "https://Stackoverflow.com/questions/31470858", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2045931/" ]
You can tranform your time to seconds and add them to your datetime value: ``` DECLARE @datetime DATETIME = GETDATE(), @time TIME = '01:16:24', @timeinseconds INT PRINT 'we add ' + CAST(@time AS VARCHAR(8)) + ' to ' + CONVERT(VARCHAR,@datetime,120)+ ':' SELECT @timeinseconds = DATEPART(SECOND, @time)...
First of all convert `@date` and `@time` variables to `NVARCHAR()`, then concat them and after It convert It to `DATETIME` datatype. After It you can use `DATEADD` function on It. Try in following: ``` DECLARE @date DATETIME DECLARE @time TIME SET @date = GETDATE() SET @time = '10:12:13' SELECT DATEADD(DAY, -1, CAS...
31,470,858
I have two variables `@date` of type `datetime` and `@time` of type `time`. I want to add both to get another `datetime` variable. And I want to perform further calculations on it. Ex: ``` Declare @date datetime Declare @time time ``` I want something like this ``` @date = @date + @time (but not concatenation) S...
2015/07/17
[ "https://Stackoverflow.com/questions/31470858", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2045931/" ]
You can tranform your time to seconds and add them to your datetime value: ``` DECLARE @datetime DATETIME = GETDATE(), @time TIME = '01:16:24', @timeinseconds INT PRINT 'we add ' + CAST(@time AS VARCHAR(8)) + ' to ' + CONVERT(VARCHAR,@datetime,120)+ ':' SELECT @timeinseconds = DATEPART(SECOND, @time)...
If you need to take only date part from `@date` and time part from `@time` - can convert your `@date` and `@time` to strings, concatenate the values and convert back to datetime: ``` select cast(convert(nvarchar(20), @date, 104) + ' ' + convert(nvarchar(20), @time, 108) as datetime2) ``` Or, alternativel...
31,470,858
I have two variables `@date` of type `datetime` and `@time` of type `time`. I want to add both to get another `datetime` variable. And I want to perform further calculations on it. Ex: ``` Declare @date datetime Declare @time time ``` I want something like this ``` @date = @date + @time (but not concatenation) S...
2015/07/17
[ "https://Stackoverflow.com/questions/31470858", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2045931/" ]
If you need to take only date part from `@date` and time part from `@time` - can convert your `@date` and `@time` to strings, concatenate the values and convert back to datetime: ``` select cast(convert(nvarchar(20), @date, 104) + ' ' + convert(nvarchar(20), @time, 108) as datetime2) ``` Or, alternativel...
Your code is correct. ``` DECLARE @date DATETIME = '1/1/2020' DECLARE @time TIME = '1:00 pm' DECLARE @Startdate DATETIME SET @date = @date + @time SELECT @Startdate = DATEADD(DAY, -1, @date) @date = 2020-01-01 13:00:00.000 @Startdate = 2019-12-31 13:00:00.000 ``` It isn't concatenating, it is adding them together...
31,470,858
I have two variables `@date` of type `datetime` and `@time` of type `time`. I want to add both to get another `datetime` variable. And I want to perform further calculations on it. Ex: ``` Declare @date datetime Declare @time time ``` I want something like this ``` @date = @date + @time (but not concatenation) S...
2015/07/17
[ "https://Stackoverflow.com/questions/31470858", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2045931/" ]
The only thing you are missing is that @time needs to be cast back to a datetime before adding to @date. ``` declare @date datetime = '2022-05-26' declare @time time = '09:52:14' declare @Startdate datetime set @date = @date + convert(datetime,@time) SELECT @Startdate = DATEADD(DAY, -1, @date) ``` Produces: [![ent...
Your code is correct. ``` DECLARE @date DATETIME = '1/1/2020' DECLARE @time TIME = '1:00 pm' DECLARE @Startdate DATETIME SET @date = @date + @time SELECT @Startdate = DATEADD(DAY, -1, @date) @date = 2020-01-01 13:00:00.000 @Startdate = 2019-12-31 13:00:00.000 ``` It isn't concatenating, it is adding them together...
31,470,858
I have two variables `@date` of type `datetime` and `@time` of type `time`. I want to add both to get another `datetime` variable. And I want to perform further calculations on it. Ex: ``` Declare @date datetime Declare @time time ``` I want something like this ``` @date = @date + @time (but not concatenation) S...
2015/07/17
[ "https://Stackoverflow.com/questions/31470858", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2045931/" ]
First of all convert `@date` and `@time` variables to `NVARCHAR()`, then concat them and after It convert It to `DATETIME` datatype. After It you can use `DATEADD` function on It. Try in following: ``` DECLARE @date DATETIME DECLARE @time TIME SET @date = GETDATE() SET @time = '10:12:13' SELECT DATEADD(DAY, -1, CAS...
I'm not sure what's going on here, but if your variables are datetime and time types, this should work just fine: ``` declare @date datetime declare @time time set @date = '20150717' set @time = '12:34:56' set @date = @date + @time select @date, DATEADD(DAY,-1,@date) ``` See [SQL Fiddle](http://sqlfiddle.com/#!3/...
31,470,858
I have two variables `@date` of type `datetime` and `@time` of type `time`. I want to add both to get another `datetime` variable. And I want to perform further calculations on it. Ex: ``` Declare @date datetime Declare @time time ``` I want something like this ``` @date = @date + @time (but not concatenation) S...
2015/07/17
[ "https://Stackoverflow.com/questions/31470858", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2045931/" ]
The only thing you are missing is that @time needs to be cast back to a datetime before adding to @date. ``` declare @date datetime = '2022-05-26' declare @time time = '09:52:14' declare @Startdate datetime set @date = @date + convert(datetime,@time) SELECT @Startdate = DATEADD(DAY, -1, @date) ``` Produces: [![ent...
First of all convert `@date` and `@time` variables to `NVARCHAR()`, then concat them and after It convert It to `DATETIME` datatype. After It you can use `DATEADD` function on It. Try in following: ``` DECLARE @date DATETIME DECLARE @time TIME SET @date = GETDATE() SET @time = '10:12:13' SELECT DATEADD(DAY, -1, CAS...
210,792
I don't know if it's heartless,but when I'm in a situation that is really sad(like a funeral) I always have this urge to laugh.Of course I try not to burst out in laughter but I guess it's how I cope with these things. Is there a word that can describe this?I don't mind if it would be used for the urge,the behaviour,t...
2014/11/28
[ "https://english.stackexchange.com/questions/210792", "https://english.stackexchange.com", "https://english.stackexchange.com/users/99370/" ]
**Nervous-laughter** should be a appropriate word. And in a novel I read a word **painful-dimples**, It sounds compatible too. But `painful-dimples` kind of word is not heard or seen usually.
I'd describe that as a fit of [hysterical](http://dictionary.reference.com/browse/hysterical) laughter : Hysterical: > > * uncontrollably emotional. > * irrational from fear, emotion, or an emotional shock. > > > ( from dictionary.reference.com)
210,792
I don't know if it's heartless,but when I'm in a situation that is really sad(like a funeral) I always have this urge to laugh.Of course I try not to burst out in laughter but I guess it's how I cope with these things. Is there a word that can describe this?I don't mind if it would be used for the urge,the behaviour,t...
2014/11/28
[ "https://english.stackexchange.com/questions/210792", "https://english.stackexchange.com", "https://english.stackexchange.com/users/99370/" ]
**Nervous-laughter** should be a appropriate word. And in a novel I read a word **painful-dimples**, It sounds compatible too. But `painful-dimples` kind of word is not heard or seen usually.
The psychological term is "inappropriate affect". Not to make you nervous... but, it can be an indicator of pathology.
210,792
I don't know if it's heartless,but when I'm in a situation that is really sad(like a funeral) I always have this urge to laugh.Of course I try not to burst out in laughter but I guess it's how I cope with these things. Is there a word that can describe this?I don't mind if it would be used for the urge,the behaviour,t...
2014/11/28
[ "https://english.stackexchange.com/questions/210792", "https://english.stackexchange.com", "https://english.stackexchange.com/users/99370/" ]
**Nervous-laughter** should be a appropriate word. And in a novel I read a word **painful-dimples**, It sounds compatible too. But `painful-dimples` kind of word is not heard or seen usually.
Titter to laugh nervously, often at something that you feel you should not be laughing at.
210,792
I don't know if it's heartless,but when I'm in a situation that is really sad(like a funeral) I always have this urge to laugh.Of course I try not to burst out in laughter but I guess it's how I cope with these things. Is there a word that can describe this?I don't mind if it would be used for the urge,the behaviour,t...
2014/11/28
[ "https://english.stackexchange.com/questions/210792", "https://english.stackexchange.com", "https://english.stackexchange.com/users/99370/" ]
**Nervous-laughter** should be a appropriate word. And in a novel I read a word **painful-dimples**, It sounds compatible too. But `painful-dimples` kind of word is not heard or seen usually.
Laughter is a highly complex behavior. One term for what you describe might be *nervous laughter* (if you actually laughed instead of just felt the urge to laugh). But that term is used in various ways, so as far as I know, the best way to describe it is similar to what you did in the question.
210,792
I don't know if it's heartless,but when I'm in a situation that is really sad(like a funeral) I always have this urge to laugh.Of course I try not to burst out in laughter but I guess it's how I cope with these things. Is there a word that can describe this?I don't mind if it would be used for the urge,the behaviour,t...
2014/11/28
[ "https://english.stackexchange.com/questions/210792", "https://english.stackexchange.com", "https://english.stackexchange.com/users/99370/" ]
The psychological term is "inappropriate affect". Not to make you nervous... but, it can be an indicator of pathology.
I'd describe that as a fit of [hysterical](http://dictionary.reference.com/browse/hysterical) laughter : Hysterical: > > * uncontrollably emotional. > * irrational from fear, emotion, or an emotional shock. > > > ( from dictionary.reference.com)
210,792
I don't know if it's heartless,but when I'm in a situation that is really sad(like a funeral) I always have this urge to laugh.Of course I try not to burst out in laughter but I guess it's how I cope with these things. Is there a word that can describe this?I don't mind if it would be used for the urge,the behaviour,t...
2014/11/28
[ "https://english.stackexchange.com/questions/210792", "https://english.stackexchange.com", "https://english.stackexchange.com/users/99370/" ]
I'd describe that as a fit of [hysterical](http://dictionary.reference.com/browse/hysterical) laughter : Hysterical: > > * uncontrollably emotional. > * irrational from fear, emotion, or an emotional shock. > > > ( from dictionary.reference.com)
Titter to laugh nervously, often at something that you feel you should not be laughing at.
210,792
I don't know if it's heartless,but when I'm in a situation that is really sad(like a funeral) I always have this urge to laugh.Of course I try not to burst out in laughter but I guess it's how I cope with these things. Is there a word that can describe this?I don't mind if it would be used for the urge,the behaviour,t...
2014/11/28
[ "https://english.stackexchange.com/questions/210792", "https://english.stackexchange.com", "https://english.stackexchange.com/users/99370/" ]
I'd describe that as a fit of [hysterical](http://dictionary.reference.com/browse/hysterical) laughter : Hysterical: > > * uncontrollably emotional. > * irrational from fear, emotion, or an emotional shock. > > > ( from dictionary.reference.com)
Laughter is a highly complex behavior. One term for what you describe might be *nervous laughter* (if you actually laughed instead of just felt the urge to laugh). But that term is used in various ways, so as far as I know, the best way to describe it is similar to what you did in the question.
210,792
I don't know if it's heartless,but when I'm in a situation that is really sad(like a funeral) I always have this urge to laugh.Of course I try not to burst out in laughter but I guess it's how I cope with these things. Is there a word that can describe this?I don't mind if it would be used for the urge,the behaviour,t...
2014/11/28
[ "https://english.stackexchange.com/questions/210792", "https://english.stackexchange.com", "https://english.stackexchange.com/users/99370/" ]
The psychological term is "inappropriate affect". Not to make you nervous... but, it can be an indicator of pathology.
Titter to laugh nervously, often at something that you feel you should not be laughing at.
210,792
I don't know if it's heartless,but when I'm in a situation that is really sad(like a funeral) I always have this urge to laugh.Of course I try not to burst out in laughter but I guess it's how I cope with these things. Is there a word that can describe this?I don't mind if it would be used for the urge,the behaviour,t...
2014/11/28
[ "https://english.stackexchange.com/questions/210792", "https://english.stackexchange.com", "https://english.stackexchange.com/users/99370/" ]
The psychological term is "inappropriate affect". Not to make you nervous... but, it can be an indicator of pathology.
Laughter is a highly complex behavior. One term for what you describe might be *nervous laughter* (if you actually laughed instead of just felt the urge to laugh). But that term is used in various ways, so as far as I know, the best way to describe it is similar to what you did in the question.
4,587,392
Is it possible to create an instance of an interface in Java? Somewhere I have read that using inner anonymous class we can do it as shown below: ```java interface Test { public void wish(); } class Main { public static void main(String[] args) { Test t = new Test() { public void wish() {...
2011/01/03
[ "https://Stackoverflow.com/questions/4587392", "https://Stackoverflow.com", "https://Stackoverflow.com/users/547709/" ]
No in my opinion , you can create a reference variable of an interface but you can not create an instance of an interface just like an abstract class.
Yes it is correct. you can do it with an inner class.
4,587,392
Is it possible to create an instance of an interface in Java? Somewhere I have read that using inner anonymous class we can do it as shown below: ```java interface Test { public void wish(); } class Main { public static void main(String[] args) { Test t = new Test() { public void wish() {...
2011/01/03
[ "https://Stackoverflow.com/questions/4587392", "https://Stackoverflow.com", "https://Stackoverflow.com/users/547709/" ]
Normaly, you can create a reference for an interface. But you cant create an instance for interface.
Yes it is correct. you can do it with an inner class.
4,587,392
Is it possible to create an instance of an interface in Java? Somewhere I have read that using inner anonymous class we can do it as shown below: ```java interface Test { public void wish(); } class Main { public static void main(String[] args) { Test t = new Test() { public void wish() {...
2011/01/03
[ "https://Stackoverflow.com/questions/4587392", "https://Stackoverflow.com", "https://Stackoverflow.com/users/547709/" ]
Normaly, you can create a reference for an interface. But you cant create an instance for interface.
Short answer...yes. You can use an anonymous class when you initialize a variable. Take a look at this question: [Anonymous vs named inner classes? - best practices?](https://stackoverflow.com/q/714602)
4,587,392
Is it possible to create an instance of an interface in Java? Somewhere I have read that using inner anonymous class we can do it as shown below: ```java interface Test { public void wish(); } class Main { public static void main(String[] args) { Test t = new Test() { public void wish() {...
2011/01/03
[ "https://Stackoverflow.com/questions/4587392", "https://Stackoverflow.com", "https://Stackoverflow.com/users/547709/" ]
Yes, your example is correct. Anonymous classes can implement interfaces, and that's the only time I can think of that you'll see a class implementing an interface without the "implements" keyword. Check out another code sample right here: ```java interface ProgrammerInterview { public void read(); } class Websit...
No in my opinion , you can create a reference variable of an interface but you can not create an instance of an interface just like an abstract class.
4,587,392
Is it possible to create an instance of an interface in Java? Somewhere I have read that using inner anonymous class we can do it as shown below: ```java interface Test { public void wish(); } class Main { public static void main(String[] args) { Test t = new Test() { public void wish() {...
2011/01/03
[ "https://Stackoverflow.com/questions/4587392", "https://Stackoverflow.com", "https://Stackoverflow.com/users/547709/" ]
You can never instantiate an interface in java. You can, however, refer to an object that implements an interface by the type of the interface. For example, ``` public interface A { } public class B implements A { } public static void main(String[] args) { A test = new B(); //A test = new A(); // wont compile...
Yes it is correct. you can do it with an inner class.
4,587,392
Is it possible to create an instance of an interface in Java? Somewhere I have read that using inner anonymous class we can do it as shown below: ```java interface Test { public void wish(); } class Main { public static void main(String[] args) { Test t = new Test() { public void wish() {...
2011/01/03
[ "https://Stackoverflow.com/questions/4587392", "https://Stackoverflow.com", "https://Stackoverflow.com/users/547709/" ]
Short answer...yes. You can use an anonymous class when you initialize a variable. Take a look at this question: [Anonymous vs named inner classes? - best practices?](https://stackoverflow.com/q/714602)
Yes we can, "Anonymous classes enable you to make your code more concise. They enable you to declare and instantiate a class at the same time. They are like local classes except that they do not have a name"-[>>Java Doc](http://docs.oracle.com/javase/tutorial/java/javaOO/anonymousclasses.html)
4,587,392
Is it possible to create an instance of an interface in Java? Somewhere I have read that using inner anonymous class we can do it as shown below: ```java interface Test { public void wish(); } class Main { public static void main(String[] args) { Test t = new Test() { public void wish() {...
2011/01/03
[ "https://Stackoverflow.com/questions/4587392", "https://Stackoverflow.com", "https://Stackoverflow.com/users/547709/" ]
You can never instantiate an interface in java. You can, however, refer to an object that implements an interface by the type of the interface. For example, ``` public interface A { } public class B implements A { } public static void main(String[] args) { A test = new B(); //A test = new A(); // wont compile...
Yes we can, "Anonymous classes enable you to make your code more concise. They enable you to declare and instantiate a class at the same time. They are like local classes except that they do not have a name"-[>>Java Doc](http://docs.oracle.com/javase/tutorial/java/javaOO/anonymousclasses.html)
4,587,392
Is it possible to create an instance of an interface in Java? Somewhere I have read that using inner anonymous class we can do it as shown below: ```java interface Test { public void wish(); } class Main { public static void main(String[] args) { Test t = new Test() { public void wish() {...
2011/01/03
[ "https://Stackoverflow.com/questions/4587392", "https://Stackoverflow.com", "https://Stackoverflow.com/users/547709/" ]
No in my opinion , you can create a reference variable of an interface but you can not create an instance of an interface just like an abstract class.
Yes we can, "Anonymous classes enable you to make your code more concise. They enable you to declare and instantiate a class at the same time. They are like local classes except that they do not have a name"-[>>Java Doc](http://docs.oracle.com/javase/tutorial/java/javaOO/anonymousclasses.html)
4,587,392
Is it possible to create an instance of an interface in Java? Somewhere I have read that using inner anonymous class we can do it as shown below: ```java interface Test { public void wish(); } class Main { public static void main(String[] args) { Test t = new Test() { public void wish() {...
2011/01/03
[ "https://Stackoverflow.com/questions/4587392", "https://Stackoverflow.com", "https://Stackoverflow.com/users/547709/" ]
You can never instantiate an interface in java. You can, however, refer to an object that implements an interface by the type of the interface. For example, ``` public interface A { } public class B implements A { } public static void main(String[] args) { A test = new B(); //A test = new A(); // wont compile...
Normaly, you can create a reference for an interface. But you cant create an instance for interface.
4,587,392
Is it possible to create an instance of an interface in Java? Somewhere I have read that using inner anonymous class we can do it as shown below: ```java interface Test { public void wish(); } class Main { public static void main(String[] args) { Test t = new Test() { public void wish() {...
2011/01/03
[ "https://Stackoverflow.com/questions/4587392", "https://Stackoverflow.com", "https://Stackoverflow.com/users/547709/" ]
Normaly, you can create a reference for an interface. But you cant create an instance for interface.
Yes we can, "Anonymous classes enable you to make your code more concise. They enable you to declare and instantiate a class at the same time. They are like local classes except that they do not have a name"-[>>Java Doc](http://docs.oracle.com/javase/tutorial/java/javaOO/anonymousclasses.html)
1,053,217
Hey I would like to know the correct approach to this problem. I think I'm close but I'm confusing myself. How many sets of size five are there from the natural numbers 1-100 that contain exactly two odd numbers? First we would select 2 odd numbers (50 choose 2) Then sum it with (50 choose 3)? For the even #s?
2014/12/05
[ "https://math.stackexchange.com/questions/1053217", "https://math.stackexchange.com", "https://math.stackexchange.com/users/197861/" ]
Not sum it, multiply it. This is because for **every way** of choosing the odds, there are $\binom{50}{3}$ ways to choose the evens.
Rule of product, not rule of sum. We choose our even numbers independently of the odd numbers. So $\binom{50}{2} \binom{50}{3}$. Note the rule of sum is for disjoint cases (ie., partitioning the elements you are counting). Consider a smaller example- one even number and one odd number from $\{1, ..., 6\}$. So we can h...
1,053,217
Hey I would like to know the correct approach to this problem. I think I'm close but I'm confusing myself. How many sets of size five are there from the natural numbers 1-100 that contain exactly two odd numbers? First we would select 2 odd numbers (50 choose 2) Then sum it with (50 choose 3)? For the even #s?
2014/12/05
[ "https://math.stackexchange.com/questions/1053217", "https://math.stackexchange.com", "https://math.stackexchange.com/users/197861/" ]
Not sum it, multiply it. This is because for **every way** of choosing the odds, there are $\binom{50}{3}$ ways to choose the evens.
We want a set of size $5$, with $2$ odd numbers *and* $3$ even numbers. Converting this into math lingo, we get $\binom{50}{2} \cdot \binom{50}{3}$, and not their sum because we want both and not one or the other.
1,053,217
Hey I would like to know the correct approach to this problem. I think I'm close but I'm confusing myself. How many sets of size five are there from the natural numbers 1-100 that contain exactly two odd numbers? First we would select 2 odd numbers (50 choose 2) Then sum it with (50 choose 3)? For the even #s?
2014/12/05
[ "https://math.stackexchange.com/questions/1053217", "https://math.stackexchange.com", "https://math.stackexchange.com/users/197861/" ]
Not sum it, multiply it. This is because for **every way** of choosing the odds, there are $\binom{50}{3}$ ways to choose the evens.
Choose 2 odd numbers from 50 : $\binom{50}{2}$ For each of these choices, you can choose 3 even numbers from the 50 even numbers : $\binom{50}{3}$ Thus it should be $\binom{50}{2}.\binom{50}{3}$
1,053,217
Hey I would like to know the correct approach to this problem. I think I'm close but I'm confusing myself. How many sets of size five are there from the natural numbers 1-100 that contain exactly two odd numbers? First we would select 2 odd numbers (50 choose 2) Then sum it with (50 choose 3)? For the even #s?
2014/12/05
[ "https://math.stackexchange.com/questions/1053217", "https://math.stackexchange.com", "https://math.stackexchange.com/users/197861/" ]
Rule of product, not rule of sum. We choose our even numbers independently of the odd numbers. So $\binom{50}{2} \binom{50}{3}$. Note the rule of sum is for disjoint cases (ie., partitioning the elements you are counting). Consider a smaller example- one even number and one odd number from $\{1, ..., 6\}$. So we can h...
We want a set of size $5$, with $2$ odd numbers *and* $3$ even numbers. Converting this into math lingo, we get $\binom{50}{2} \cdot \binom{50}{3}$, and not their sum because we want both and not one or the other.
1,053,217
Hey I would like to know the correct approach to this problem. I think I'm close but I'm confusing myself. How many sets of size five are there from the natural numbers 1-100 that contain exactly two odd numbers? First we would select 2 odd numbers (50 choose 2) Then sum it with (50 choose 3)? For the even #s?
2014/12/05
[ "https://math.stackexchange.com/questions/1053217", "https://math.stackexchange.com", "https://math.stackexchange.com/users/197861/" ]
Choose 2 odd numbers from 50 : $\binom{50}{2}$ For each of these choices, you can choose 3 even numbers from the 50 even numbers : $\binom{50}{3}$ Thus it should be $\binom{50}{2}.\binom{50}{3}$
We want a set of size $5$, with $2$ odd numbers *and* $3$ even numbers. Converting this into math lingo, we get $\binom{50}{2} \cdot \binom{50}{3}$, and not their sum because we want both and not one or the other.
54,913,904
I'm trying to select the number of free beds per floor and the number of rooms in which those beds exist. I think I'm having trouble because I first have to calculate how many beds are free in each room, which I'm doing by subtracting the number of beds in the room minus the people that are assigned to that room. Can ...
2019/02/27
[ "https://Stackoverflow.com/questions/54913904", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11127217/" ]
*Never* use commas in the `FROM` clause. *Always* use proper, explicit, **standard** `JOIN` syntax. You just need the correct `GROUP BY` logic. I think it is like this ``` SELECT pl.codigo AS Floor_id, count(count distinct h.id) as num_rooms, MAX(numero_camas) - count(distinct h.id) AS Free_beds FROM habitaci...
Based on the answer of Gordon Linoff and yor statement I guess with this minor changes you should get the correct result (I guess the distinct rooms need to be counted and the amount of beds minus the people that are assigned needs to be summed up): ``` SELECT pl.codigo AS Floor_id, count(distinct habitac...
54,913,904
I'm trying to select the number of free beds per floor and the number of rooms in which those beds exist. I think I'm having trouble because I first have to calculate how many beds are free in each room, which I'm doing by subtracting the number of beds in the room minus the people that are assigned to that room. Can ...
2019/02/27
[ "https://Stackoverflow.com/questions/54913904", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11127217/" ]
*Never* use commas in the `FROM` clause. *Always* use proper, explicit, **standard** `JOIN` syntax. You just need the correct `GROUP BY` logic. I think it is like this ``` SELECT pl.codigo AS Floor_id, count(count distinct h.id) as num_rooms, MAX(numero_camas) - count(distinct h.id) AS Free_beds FROM habitaci...
You need two aggregations: The number of beds per habitation, then the sum of available beds per floor. One way to do this is: ``` select planta_id, count(*) as rooms, sum(available - occupied) as free_beds from ( select planta_id, h.id as habitacion_id, numero_camas as available, (select count(*) fr...
46,502,470
I have made an image gallery, made up by two rows each with tree images. I've made my site responsive, but for some reason, the images does not resize/adjust according to the screen. I've attached the picture, and as is visible the images does not adjust to the screen. [Screen shot of site](https://i.stack.imgur.com/Gj...
2017/09/30
[ "https://Stackoverflow.com/questions/46502470", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6669176/" ]
The image does not resize because you gave them a absolute width. If you give the element a `max-width` and `max-height` of 100% it should be responsive. So like this: ```css .image3 { max-height: 100%; max-width: 100%; border-style: solid; border-width: 5px; color: grey; } ``` ```html <div class="ro...
Why would they? You can use ``` max-width: 100%; /* or 33% or whatever you need */ ``` to let it shrink when the screen has less width, but right now it will always be the size you specified. --- Also "responsiveness" mainly refers to having different layouts for different screen widths, which results in optimize...
46,502,470
I have made an image gallery, made up by two rows each with tree images. I've made my site responsive, but for some reason, the images does not resize/adjust according to the screen. I've attached the picture, and as is visible the images does not adjust to the screen. [Screen shot of site](https://i.stack.imgur.com/Gj...
2017/09/30
[ "https://Stackoverflow.com/questions/46502470", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6669176/" ]
The image does not resize because you gave them a absolute width. If you give the element a `max-width` and `max-height` of 100% it should be responsive. So like this: ```css .image3 { max-height: 100%; max-width: 100%; border-style: solid; border-width: 5px; color: grey; } ``` ```html <div class="ro...
It seems you're giving a fixed size to your images using `px` units. If you want your images to be responsive, to adapt their size, you need to use relative units. Being the most common: * Relative to the container: percentaje **%** * Relative to the container font-size: **em** * Relative to the root element font-size...
46,502,470
I have made an image gallery, made up by two rows each with tree images. I've made my site responsive, but for some reason, the images does not resize/adjust according to the screen. I've attached the picture, and as is visible the images does not adjust to the screen. [Screen shot of site](https://i.stack.imgur.com/Gj...
2017/09/30
[ "https://Stackoverflow.com/questions/46502470", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6669176/" ]
The image does not resize because you gave them a absolute width. If you give the element a `max-width` and `max-height` of 100% it should be responsive. So like this: ```css .image3 { max-height: 100%; max-width: 100%; border-style: solid; border-width: 5px; color: grey; } ``` ```html <div class="ro...
use this code. here i used bootstrap... copy whole code.. and save as page.html then check. ``` <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootst...
46,502,470
I have made an image gallery, made up by two rows each with tree images. I've made my site responsive, but for some reason, the images does not resize/adjust according to the screen. I've attached the picture, and as is visible the images does not adjust to the screen. [Screen shot of site](https://i.stack.imgur.com/Gj...
2017/09/30
[ "https://Stackoverflow.com/questions/46502470", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6669176/" ]
The image does not resize because you gave them a absolute width. If you give the element a `max-width` and `max-height` of 100% it should be responsive. So like this: ```css .image3 { max-height: 100%; max-width: 100%; border-style: solid; border-width: 5px; color: grey; } ``` ```html <div class="ro...
If you want an image to be responsive there are 2 main things you need to do: 1. never set both width and height, just set width. 2. don't use pixels to set the width use percentages In your case you have 3 images so divide 100% in 3 which is about 33%, so give the images the size of 33% (or a little less if the cont...
185,586
The basic search capabilities of MediaWiki (at least, the version we're running - 1.7.1) are pretty poor. I'd like to improve them with an extension, but there are a lot of options and I'd like to have a good starting point. For what it's worth, the wiki is an internal one; we don't have the option, for example, of us...
2010/09/28
[ "https://serverfault.com/questions/185586", "https://serverfault.com", "https://serverfault.com/users/2741/" ]
1. Dont do email marketing. Don't. Streamsend, Mailchimp or Constant Contact are spammers by any other name. A pig with lipstick is still a pig. 2. If you must, just customize an existing solution. Very customizable: [sendmail](http://www.sendmail.org)
Lyris, LSoft, Constant Contact and if you like programmable interfaces Mailgun
1,115,775
I have installed VirtualBox 5.0.14 on an Lubuntu 15.10 host, and created a virtual machine with Lubuntu 14.04.5 LTS as the guest OS. I would like to set up a host-only network adapter in VirtualBox so that I can access an Apache webserver running inside the guest OS from a webbrowser running on the host system. So fa...
2016/08/20
[ "https://superuser.com/questions/1115775", "https://superuser.com", "https://superuser.com/users/526082/" ]
### Shorter answer. Based on what I know about default VirtualBox network settings, your host only connection that uses `192.168.10.10` is on the incorrect subnet and that adjustment is being done in the wrong area to get this thing working. When setting up a host only adapter on the host OS, the IPv4 address should ...
**The purpose of Host-only networking using VirtualBox** In your example, you're attempting to set up a host-only network in VirtualBox that consists of one guest machine only, and of course the host machine. Keep in mind, however, that *Host-only networking* is designed so that it can accommodate multiple guest mach...
8,638,109
I saw a class "AttributeSelectedClassifier" was once created in the following ways: ``` AttributeSelectedClassifier classifier = new AttributeSelectedClassifier(); classifier.setClassifier(base); classifier.setEvaluator(eval); ``` This above one looks natural to me. But how about the following one. ``` classifier ...
2011/12/26
[ "https://Stackoverflow.com/questions/8638109", "https://Stackoverflow.com", "https://Stackoverflow.com/users/288609/" ]
This means that the classifier variable is declared as a superclass or superinterface of `AttributeSelectedClassifier`, and that you need to call a method which is not defined in the class or interface, but only on `AttributeSelectedClassifier`. This notation *casts* the variable to `AttributeSelectedClassifier`: ``` ...
This: ``` ((AttributeSelectedClassifier)classifier) ``` isn't "defining" or "declaring" classifier - it's *casting* it. Presumably in this case `classifier` is declared as some superclass of `AttributeSelectedClassifier`. The code isn't particularly clear though. I'd rewrite the second bit of code (assuming you can'...
8,638,109
I saw a class "AttributeSelectedClassifier" was once created in the following ways: ``` AttributeSelectedClassifier classifier = new AttributeSelectedClassifier(); classifier.setClassifier(base); classifier.setEvaluator(eval); ``` This above one looks natural to me. But how about the following one. ``` classifier ...
2011/12/26
[ "https://Stackoverflow.com/questions/8638109", "https://Stackoverflow.com", "https://Stackoverflow.com/users/288609/" ]
Look at the below code. Person implements the `CanWalk` interface. If you assign a `Person` to `CanWalk` interface as shown in the main method, which is a common practice, you can only invoke the methods that are specified in the `CanWalk` interface i.e. `walk()`. If you want to invoke `f()`, that **isn't** declared in...
This: ``` ((AttributeSelectedClassifier)classifier) ``` isn't "defining" or "declaring" classifier - it's *casting* it. Presumably in this case `classifier` is declared as some superclass of `AttributeSelectedClassifier`. The code isn't particularly clear though. I'd rewrite the second bit of code (assuming you can'...