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
6,596,330
Given this enum ``` public enum UserStatus : byte { Approved = 1, Locked = 2, Expire = 3 } ``` why does this check always return false when `usr.Status = 1` ``` if(usr.Status.Equals(UserStatus.Approved)) return true; return false; ``` The comparison seems to work - there is no compile time error o...
2011/07/06
[ "https://Stackoverflow.com/questions/6596330", "https://Stackoverflow.com", "https://Stackoverflow.com/users/174390/" ]
Because you will have to cast. The equals method will check if `UserStatus` is an `int` (depending on the type you have defined at the property `usr.Status`). It will then return that is not (it is of type `UserStatus`) thus return `false` Better code would be: ``` return usr.Status == (int)UserStatus.Approved; ```
The first thing any Equals implementation usually checks is: "is this the right type". And `UserStatus` is ***not*** the same as `byte`. (actually, this only happens because you have *boxed* the items via your incompatible use of `Equals`; at the IL level they are indistinguishable until boxed) You must compare them ...
6,596,330
Given this enum ``` public enum UserStatus : byte { Approved = 1, Locked = 2, Expire = 3 } ``` why does this check always return false when `usr.Status = 1` ``` if(usr.Status.Equals(UserStatus.Approved)) return true; return false; ``` The comparison seems to work - there is no compile time error o...
2011/07/06
[ "https://Stackoverflow.com/questions/6596330", "https://Stackoverflow.com", "https://Stackoverflow.com/users/174390/" ]
Because you will have to cast. The equals method will check if `UserStatus` is an `int` (depending on the type you have defined at the property `usr.Status`). It will then return that is not (it is of type `UserStatus`) thus return `false` Better code would be: ``` return usr.Status == (int)UserStatus.Approved; ```
That is because the `Usr.Status` contains an Integer and the `UserStatus.Approved` returns an String i.e., `Approved`. So, an integer of value `1` can not be equal to the String `Approved`. So, you must convert the Enum status also to an integer by the following code ``` if (usr.Status == (int)(UserStatus.Approved)) ...
6,596,330
Given this enum ``` public enum UserStatus : byte { Approved = 1, Locked = 2, Expire = 3 } ``` why does this check always return false when `usr.Status = 1` ``` if(usr.Status.Equals(UserStatus.Approved)) return true; return false; ``` The comparison seems to work - there is no compile time error o...
2011/07/06
[ "https://Stackoverflow.com/questions/6596330", "https://Stackoverflow.com", "https://Stackoverflow.com/users/174390/" ]
The first thing any Equals implementation usually checks is: "is this the right type". And `UserStatus` is ***not*** the same as `byte`. (actually, this only happens because you have *boxed* the items via your incompatible use of `Equals`; at the IL level they are indistinguishable until boxed) You must compare them ...
That is because the `Usr.Status` contains an Integer and the `UserStatus.Approved` returns an String i.e., `Approved`. So, an integer of value `1` can not be equal to the String `Approved`. So, you must convert the Enum status also to an integer by the following code ``` if (usr.Status == (int)(UserStatus.Approved)) ...
7,790,058
``` <body> <div id="options"> <p class="input"> <input type="text"/> <a class="remove" >Remove</a> </p> <p class="input"> <input type="text"/> <a class="remove" >Remove</a> </p> </div> <a href = "#" id ="click" >Add Option</a> </body> ``` ...
2011/10/17
[ "https://Stackoverflow.com/questions/7790058", "https://Stackoverflow.com", "https://Stackoverflow.com/users/872417/" ]
try using it with [`.live()`](http://api.jquery.com/live/) ``` $(".remove").live("click",function(){ $(this).parent().remove(); }); ```
At the time you bind the event handler to the `.remove` elements, the new elements don't exist yet (obviously). That's why jQuery cannot find them and bind the event handler. You can solve this using [`.live` *[docs]*](http://api.jquery.com/live/) or [`.delegate` *[docs]*](http://api.jquery.com/delegate/): ``` $(".r...
7,790,058
``` <body> <div id="options"> <p class="input"> <input type="text"/> <a class="remove" >Remove</a> </p> <p class="input"> <input type="text"/> <a class="remove" >Remove</a> </p> </div> <a href = "#" id ="click" >Add Option</a> </body> ``` ...
2011/10/17
[ "https://Stackoverflow.com/questions/7790058", "https://Stackoverflow.com", "https://Stackoverflow.com/users/872417/" ]
At the time you bind the event handler to the `.remove` elements, the new elements don't exist yet (obviously). That's why jQuery cannot find them and bind the event handler. You can solve this using [`.live` *[docs]*](http://api.jquery.com/live/) or [`.delegate` *[docs]*](http://api.jquery.com/delegate/): ``` $(".r...
This works: <http://jsfiddle.net/UJERQ/> ``` $("#click").click(function add_option(){ $("#options").append('<p class="input"><input type="text"/><a class="remove" > Remove</a></p>') addTheClicks(); }) function addTheClicks(){ var btns = $(".remove"); var btnsLength = btns.length; ...
7,790,058
``` <body> <div id="options"> <p class="input"> <input type="text"/> <a class="remove" >Remove</a> </p> <p class="input"> <input type="text"/> <a class="remove" >Remove</a> </p> </div> <a href = "#" id ="click" >Add Option</a> </body> ``` ...
2011/10/17
[ "https://Stackoverflow.com/questions/7790058", "https://Stackoverflow.com", "https://Stackoverflow.com/users/872417/" ]
try using it with [`.live()`](http://api.jquery.com/live/) ``` $(".remove").live("click",function(){ $(this).parent().remove(); }); ```
This works: <http://jsfiddle.net/UJERQ/> ``` $("#click").click(function add_option(){ $("#options").append('<p class="input"><input type="text"/><a class="remove" > Remove</a></p>') addTheClicks(); }) function addTheClicks(){ var btns = $(".remove"); var btnsLength = btns.length; ...
164,656
Imagine a game of Checkers, but you can move left right up down instead of diagonally. I have made an array to store liberties (available moves) and use `if` statements to update if a checker can move there. Checkers can share liberties: [![enter image description here](https://i.stack.imgur.com/k0SGP.png)](https://i...
2017/06/01
[ "https://codereview.stackexchange.com/questions/164656", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/140137/" ]
I tried to do the same thing, basically using binary numbers & counting the bits instead. Let some number `binarySet` have the same number of bits as the input set has elements. Then just count up from zero. For each bit in the binary number, that bit corresponds to an element in the input set. If the bit is set (1, no...
> > > ``` > if(set.isEmpty()){ > return ret; > } > > ``` > > This is unnecessary. If the set is empty, the iterator will return `false` to the first `hasNext()`, and you'll go straight to the final `return ret;`. Other than that, it seems like a simple, obviously correct, approach. H...
164,656
Imagine a game of Checkers, but you can move left right up down instead of diagonally. I have made an array to store liberties (available moves) and use `if` statements to update if a checker can move there. Checkers can share liberties: [![enter image description here](https://i.stack.imgur.com/k0SGP.png)](https://i...
2017/06/01
[ "https://codereview.stackexchange.com/questions/164656", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/140137/" ]
I tried to do the same thing, basically using binary numbers & counting the bits instead. Let some number `binarySet` have the same number of bits as the input set has elements. Then just count up from zero. For each bit in the binary number, that bit corresponds to an element in the input set. If the bit is set (1, no...
Like Peter already answered, you are adding the same subsets a lot (which are automatically removed since a `Set` cannot contain duplicates). markspace solves this problem by using bit manipulations which is awesome, but might not be what you prefer. So I'll propose a different approach that uses the same general idea...
164,656
Imagine a game of Checkers, but you can move left right up down instead of diagonally. I have made an array to store liberties (available moves) and use `if` statements to update if a checker can move there. Checkers can share liberties: [![enter image description here](https://i.stack.imgur.com/k0SGP.png)](https://i...
2017/06/01
[ "https://codereview.stackexchange.com/questions/164656", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/140137/" ]
I tried to do the same thing, basically using binary numbers & counting the bits instead. Let some number `binarySet` have the same number of bits as the input set has elements. Then just count up from zero. For each bit in the binary number, that bit corresponds to an element in the input set. If the bit is set (1, no...
It's good - but it's not object-oriented! All your methods are static and *I guess that's fine* but it's a procedural way of thinking. We can't instantiate a `PowerSet` (in fact, we can but it's useless). In your example, once you recieve your set of sets, the entire semantic that it's a powerset has been lost. What w...
164,656
Imagine a game of Checkers, but you can move left right up down instead of diagonally. I have made an array to store liberties (available moves) and use `if` statements to update if a checker can move there. Checkers can share liberties: [![enter image description here](https://i.stack.imgur.com/k0SGP.png)](https://i...
2017/06/01
[ "https://codereview.stackexchange.com/questions/164656", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/140137/" ]
> > > ``` > if(set.isEmpty()){ > return ret; > } > > ``` > > This is unnecessary. If the set is empty, the iterator will return `false` to the first `hasNext()`, and you'll go straight to the final `return ret;`. Other than that, it seems like a simple, obviously correct, approach. H...
Like Peter already answered, you are adding the same subsets a lot (which are automatically removed since a `Set` cannot contain duplicates). markspace solves this problem by using bit manipulations which is awesome, but might not be what you prefer. So I'll propose a different approach that uses the same general idea...
164,656
Imagine a game of Checkers, but you can move left right up down instead of diagonally. I have made an array to store liberties (available moves) and use `if` statements to update if a checker can move there. Checkers can share liberties: [![enter image description here](https://i.stack.imgur.com/k0SGP.png)](https://i...
2017/06/01
[ "https://codereview.stackexchange.com/questions/164656", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/140137/" ]
> > > ``` > if(set.isEmpty()){ > return ret; > } > > ``` > > This is unnecessary. If the set is empty, the iterator will return `false` to the first `hasNext()`, and you'll go straight to the final `return ret;`. Other than that, it seems like a simple, obviously correct, approach. H...
It's good - but it's not object-oriented! All your methods are static and *I guess that's fine* but it's a procedural way of thinking. We can't instantiate a `PowerSet` (in fact, we can but it's useless). In your example, once you recieve your set of sets, the entire semantic that it's a powerset has been lost. What w...
164,656
Imagine a game of Checkers, but you can move left right up down instead of diagonally. I have made an array to store liberties (available moves) and use `if` statements to update if a checker can move there. Checkers can share liberties: [![enter image description here](https://i.stack.imgur.com/k0SGP.png)](https://i...
2017/06/01
[ "https://codereview.stackexchange.com/questions/164656", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/140137/" ]
Like Peter already answered, you are adding the same subsets a lot (which are automatically removed since a `Set` cannot contain duplicates). markspace solves this problem by using bit manipulations which is awesome, but might not be what you prefer. So I'll propose a different approach that uses the same general idea...
It's good - but it's not object-oriented! All your methods are static and *I guess that's fine* but it's a procedural way of thinking. We can't instantiate a `PowerSet` (in fact, we can but it's useless). In your example, once you recieve your set of sets, the entire semantic that it's a powerset has been lost. What w...
12,111,754
I have the below code: ``` contacts = new Contact[] { new Contact(0, "Mercury") }; } ``` What I want to do is add values from a list of contacts, rather than Strings like Mercury! How would I go about this?
2012/08/24
[ "https://Stackoverflow.com/questions/12111754", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1567801/" ]
Just use [List](http://docs.oracle.com/javase/1.4.2/docs/api/java/util/List.html)'s toArray method, and cast it appropriately: ``` Contact[] contacts = contactsList.toArray(new Contact[0]); ``` Taking another look at that, you will need to hand it a Contact[] (empty of course), for it to know what class type to be u...
If you have a `List<Contact> contactsList` with some data. ``` int size = contactsList.size(); Contact[] contacts = new Contact[size]; for(int i = 0; i < size; i++ ) { // selection logic here-- contacts[i] = contactsList.get(i); } ``` Now you have a Array `Contact[]`.
12,111,754
I have the below code: ``` contacts = new Contact[] { new Contact(0, "Mercury") }; } ``` What I want to do is add values from a list of contacts, rather than Strings like Mercury! How would I go about this?
2012/08/24
[ "https://Stackoverflow.com/questions/12111754", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1567801/" ]
The easiest way to do this is using the `List.toArray` method. Assumming you have a `List<Contact> lstContacts` or similar: ``` Contact[] arrContacts = lstContacts.toArray(new Contact[0]); ```
If you have a `List<Contact> contactsList` with some data. ``` int size = contactsList.size(); Contact[] contacts = new Contact[size]; for(int i = 0; i < size; i++ ) { // selection logic here-- contacts[i] = contactsList.get(i); } ``` Now you have a Array `Contact[]`.
12,111,754
I have the below code: ``` contacts = new Contact[] { new Contact(0, "Mercury") }; } ``` What I want to do is add values from a list of contacts, rather than Strings like Mercury! How would I go about this?
2012/08/24
[ "https://Stackoverflow.com/questions/12111754", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1567801/" ]
Just use [List](http://docs.oracle.com/javase/1.4.2/docs/api/java/util/List.html)'s toArray method, and cast it appropriately: ``` Contact[] contacts = contactsList.toArray(new Contact[0]); ``` Taking another look at that, you will need to hand it a Contact[] (empty of course), for it to know what class type to be u...
The easiest way to do this is using the `List.toArray` method. Assumming you have a `List<Contact> lstContacts` or similar: ``` Contact[] arrContacts = lstContacts.toArray(new Contact[0]); ```
72,311,869
The project was to make our own set class that we went over, but to use smart pointers. I got all my functions to work without smart pointer, but now that I tried to use them I'm getting issues with creating a new node. ``` #include "cs19_compact_string_set.h" #include <memory> #include <queue> #include <string> #incl...
2022/05/19
[ "https://Stackoverflow.com/questions/72311869", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13073496/" ]
The following will check entries for validity and accept valid ones on the first try: ``` while True: try: even_num = int(input("Please enter an even number from 1-20: ")) except ValueError: print("Sorry, please enter an integer value.\n") continue if not 1 <= even_num <= 20: ...
Without given error-message I can only suggest improvement: 1. simplify the test for even number with `in [2,4]` (compare to a list of integers instead combining string-comparison) 2. extract the test as function and make it defensive/safe (test also for int) 3. improve readability of the loop-condition similar to "as...
146,185
I'm trying to simulate this effect in cycles with materials [![The opposition effect seen on earth](https://i.stack.imgur.com/SGw9V.jpg)](https://i.stack.imgur.com/SGw9V.jpg) This phenomena is called "Opposition Surge/effect", and is a result of the phase angle between a light source (sun) and the observer approaches...
2019/07/23
[ "https://blender.stackexchange.com/questions/146185", "https://blender.stackexchange.com", "https://blender.stackexchange.com/users/37812/" ]
You can create dense geometry only where needed with [Adaptive Subdivision](https://docs.blender.org/manual/en/2.80/render/cycles/object_settings/adaptive_subdiv.html) and displacement in Blender. It's still an experimental feature, but seems to work quite well.
Or you can create gravel with a particle system or use linked duplicates.
825,351
> > Let $$\vec{v} = \frac{\vec{r}}{|\vec{r}|^3},$$ $\vec{r}=(x,y,z)$. > Evaluate > > > $$ \iint\limits\_S \vec{v} \cdot \vec{n} \, dS$$ > > > with $\vec{n} $ pointing to the exterior of the surface $S$ and $S$ > being a closed and smooth surface which contais the origin at the > interior. > > > Answer: $ 4 \p...
2014/06/08
[ "https://math.stackexchange.com/questions/825351", "https://math.stackexchange.com", "https://math.stackexchange.com/users/96262/" ]
another way could be for you to use a substitution $x+1=t^3$. Then as $x \to 0$, $t \to 1$. Use this and simplify.
Use L'Hôpital's rule: $\lim\limits\_{x\rightarrow0} \left[ \frac {(x+1)^{1/3}-1}{x} \right]=\lim\limits\_{x\rightarrow0}\left[\frac{\frac{d}{dx}[(x+1)^{1/3}-1]}{\frac{d}{dx}[x]} \right]=\lim\limits\_{x\rightarrow0}\left[\frac{\frac{1}{3}(x+1)^{-2/3}-0}{1}\right]=\lim\limits\_{x\rightarrow0}\left[\frac{1}{3}(x+1)^{-2/3}...
825,351
> > Let $$\vec{v} = \frac{\vec{r}}{|\vec{r}|^3},$$ $\vec{r}=(x,y,z)$. > Evaluate > > > $$ \iint\limits\_S \vec{v} \cdot \vec{n} \, dS$$ > > > with $\vec{n} $ pointing to the exterior of the surface $S$ and $S$ > being a closed and smooth surface which contais the origin at the > interior. > > > Answer: $ 4 \p...
2014/06/08
[ "https://math.stackexchange.com/questions/825351", "https://math.stackexchange.com", "https://math.stackexchange.com/users/96262/" ]
another way could be for you to use a substitution $x+1=t^3$. Then as $x \to 0$, $t \to 1$. Use this and simplify.
Let's put $1 + x = y$ so that $y \to 1$ as $x \to 0$. Then we have $$\begin{aligned}L &= \lim\_{x \to 0}\frac{(1 + x)^{1/3} - 1}{x}\\ &= \lim\_{y \to 1}\frac{y^{1/3} - 1}{y - 1}\\ &= \lim\_{z \to 1}\frac{z - 1}{z^{3} - 1}\text{ by putting }y = z^{3}, z\to 1\\ &= \lim\_{z \to 1}\frac{1}{z^{2} + z + 1} = \frac{1}{3}\end{...
825,351
> > Let $$\vec{v} = \frac{\vec{r}}{|\vec{r}|^3},$$ $\vec{r}=(x,y,z)$. > Evaluate > > > $$ \iint\limits\_S \vec{v} \cdot \vec{n} \, dS$$ > > > with $\vec{n} $ pointing to the exterior of the surface $S$ and $S$ > being a closed and smooth surface which contais the origin at the > interior. > > > Answer: $ 4 \p...
2014/06/08
[ "https://math.stackexchange.com/questions/825351", "https://math.stackexchange.com", "https://math.stackexchange.com/users/96262/" ]
I'm assuming you've studied differentiation. Let $f(x)=(x+1)^{1/3}$. Now consider $f'(0)$. By definition, \begin{align} f'(0)&= \lim\_{h\to0}\frac{f(h)-f(0)}{h} \\ &=\lim\_{h\to0} \frac{(h+1)^{1/3}-1}{h} \end{align} This is precisely the limit you want to evaluate. Now $f'(0)$ can be evaluated using your usual rules ...
Use L'Hôpital's rule: $\lim\limits\_{x\rightarrow0} \left[ \frac {(x+1)^{1/3}-1}{x} \right]=\lim\limits\_{x\rightarrow0}\left[\frac{\frac{d}{dx}[(x+1)^{1/3}-1]}{\frac{d}{dx}[x]} \right]=\lim\limits\_{x\rightarrow0}\left[\frac{\frac{1}{3}(x+1)^{-2/3}-0}{1}\right]=\lim\limits\_{x\rightarrow0}\left[\frac{1}{3}(x+1)^{-2/3}...
825,351
> > Let $$\vec{v} = \frac{\vec{r}}{|\vec{r}|^3},$$ $\vec{r}=(x,y,z)$. > Evaluate > > > $$ \iint\limits\_S \vec{v} \cdot \vec{n} \, dS$$ > > > with $\vec{n} $ pointing to the exterior of the surface $S$ and $S$ > being a closed and smooth surface which contais the origin at the > interior. > > > Answer: $ 4 \p...
2014/06/08
[ "https://math.stackexchange.com/questions/825351", "https://math.stackexchange.com", "https://math.stackexchange.com/users/96262/" ]
Let's put $1 + x = y$ so that $y \to 1$ as $x \to 0$. Then we have $$\begin{aligned}L &= \lim\_{x \to 0}\frac{(1 + x)^{1/3} - 1}{x}\\ &= \lim\_{y \to 1}\frac{y^{1/3} - 1}{y - 1}\\ &= \lim\_{z \to 1}\frac{z - 1}{z^{3} - 1}\text{ by putting }y = z^{3}, z\to 1\\ &= \lim\_{z \to 1}\frac{1}{z^{2} + z + 1} = \frac{1}{3}\end{...
Use L'Hôpital's rule: $\lim\limits\_{x\rightarrow0} \left[ \frac {(x+1)^{1/3}-1}{x} \right]=\lim\limits\_{x\rightarrow0}\left[\frac{\frac{d}{dx}[(x+1)^{1/3}-1]}{\frac{d}{dx}[x]} \right]=\lim\limits\_{x\rightarrow0}\left[\frac{\frac{1}{3}(x+1)^{-2/3}-0}{1}\right]=\lim\limits\_{x\rightarrow0}\left[\frac{1}{3}(x+1)^{-2/3}...
825,351
> > Let $$\vec{v} = \frac{\vec{r}}{|\vec{r}|^3},$$ $\vec{r}=(x,y,z)$. > Evaluate > > > $$ \iint\limits\_S \vec{v} \cdot \vec{n} \, dS$$ > > > with $\vec{n} $ pointing to the exterior of the surface $S$ and $S$ > being a closed and smooth surface which contais the origin at the > interior. > > > Answer: $ 4 \p...
2014/06/08
[ "https://math.stackexchange.com/questions/825351", "https://math.stackexchange.com", "https://math.stackexchange.com/users/96262/" ]
I'm assuming you've studied differentiation. Let $f(x)=(x+1)^{1/3}$. Now consider $f'(0)$. By definition, \begin{align} f'(0)&= \lim\_{h\to0}\frac{f(h)-f(0)}{h} \\ &=\lim\_{h\to0} \frac{(h+1)^{1/3}-1}{h} \end{align} This is precisely the limit you want to evaluate. Now $f'(0)$ can be evaluated using your usual rules ...
Let's put $1 + x = y$ so that $y \to 1$ as $x \to 0$. Then we have $$\begin{aligned}L &= \lim\_{x \to 0}\frac{(1 + x)^{1/3} - 1}{x}\\ &= \lim\_{y \to 1}\frac{y^{1/3} - 1}{y - 1}\\ &= \lim\_{z \to 1}\frac{z - 1}{z^{3} - 1}\text{ by putting }y = z^{3}, z\to 1\\ &= \lim\_{z \to 1}\frac{1}{z^{2} + z + 1} = \frac{1}{3}\end{...
4,682,021
In Java I try try to use the `String.split()` method splitting a string on `";"`, but not on `"\\\\;"`. (2 back-slashes followed by a semi-colon) Ex: `"aa;bb;cc\\;dd;ee\\;;ff"` should be split into; ``` aa bb cc\\;dd ee\\; ff ``` How do I accomplish this using a regular expression? Markus
2011/01/13
[ "https://Stackoverflow.com/questions/4682021", "https://Stackoverflow.com", "https://Stackoverflow.com/users/574499/" ]
Use ``` "aa;bb;cc\\;dd;ee\\;;ff".split("(?<!\\\\);"); ``` (?<!...) is called a "zero-width lookbehind". In English, you're splitting on all `;` characters that are **NOT** preceded by a double slash, without actually matching the double slash. The quadruple slash is to escape backslashes to the regex parser. The act...
This is called negative lookbehind and the syntax is like `(?<!a)b`. This matches on any b that isnt precended by an a. You would want something like: ``` (?<!\\\\); ```
4,682,021
In Java I try try to use the `String.split()` method splitting a string on `";"`, but not on `"\\\\;"`. (2 back-slashes followed by a semi-colon) Ex: `"aa;bb;cc\\;dd;ee\\;;ff"` should be split into; ``` aa bb cc\\;dd ee\\; ff ``` How do I accomplish this using a regular expression? Markus
2011/01/13
[ "https://Stackoverflow.com/questions/4682021", "https://Stackoverflow.com", "https://Stackoverflow.com/users/574499/" ]
Use ``` "aa;bb;cc\\;dd;ee\\;;ff".split("(?<!\\\\);"); ``` (?<!...) is called a "zero-width lookbehind". In English, you're splitting on all `;` characters that are **NOT** preceded by a double slash, without actually matching the double slash. The quadruple slash is to escape backslashes to the regex parser. The act...
Here a code example with . as separator: ``` String p = "hello.regex\\.brain\\.twister"; System.out.println( p ); for (String s : p.split( "(?<!\\\\)\\.", -1 )) { System.out.println( "-> "+ s ); } ``` Will Ouptut: ``` hello.regex\.brain\.twister -> hello -> regex\.brain.\twister ```
4,682,021
In Java I try try to use the `String.split()` method splitting a string on `";"`, but not on `"\\\\;"`. (2 back-slashes followed by a semi-colon) Ex: `"aa;bb;cc\\;dd;ee\\;;ff"` should be split into; ``` aa bb cc\\;dd ee\\; ff ``` How do I accomplish this using a regular expression? Markus
2011/01/13
[ "https://Stackoverflow.com/questions/4682021", "https://Stackoverflow.com", "https://Stackoverflow.com/users/574499/" ]
This is called negative lookbehind and the syntax is like `(?<!a)b`. This matches on any b that isnt precended by an a. You would want something like: ``` (?<!\\\\); ```
Here a code example with . as separator: ``` String p = "hello.regex\\.brain\\.twister"; System.out.println( p ); for (String s : p.split( "(?<!\\\\)\\.", -1 )) { System.out.println( "-> "+ s ); } ``` Will Ouptut: ``` hello.regex\.brain\.twister -> hello -> regex\.brain.\twister ```
67,577,838
Here is the data frame. ``` Number UrinateFrequently UrgeUrinate 1 occasionally rarely 2 rarely rarely 3 occasionally occasionally 4 rarely always 5 frequently always ``` I can only summarise one column at a time like this ``` a %>% group_by(Urin...
2021/05/17
[ "https://Stackoverflow.com/questions/67577838", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14682630/" ]
So, as I said in my comment, you have 2 options to copy the script from a remote host to another remote host. It is possible that the first option may give you a **double-hop** error, if that was the case you should be looking at [**`CredSSP`**](https://devblogs.microsoft.com/scripting/enable-powershell-second-hop-fun...
Try replacing this line \$server\D$\scripts with the following so that it expands correctly (your error code shows three backslashes) ``` "\\$server\D$\scripts" ``` I feel that this script could use a re-write all together - if you're invoking a command on a remote computer, you can reference that computers folder s...
50,321,544
Is there a way of using the Django REST filters inside a **`GET`** function I created? It works when I use this: ``` class ContactListView(generics.ListAPIView): queryset = Profile.objects.all() serializer_class = UserContactListSerializer filter_backends = (filters.SearchFilter,) search_fields = ('n...
2018/05/13
[ "https://Stackoverflow.com/questions/50321544", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6003679/" ]
Inside a Get function... Say you had a URL like `mywebsite.com/mypage/?search=[searchterm]` then in your GET function use this: ``` def get(self, request): filterurl = self.request.query_params.get('search', None) contacts = Profile.objects.all() if filterurl is not None: contacts = Profile.objec...
In get function, the View is an instance. So filter\_backends is a property of this instance. You must reupdate the property of its and call "filter\_queryset" function. "filter\_backends" will be used in this function.: ``` def get(self, request, pk, format=None): self.filter_backends = (filters.SearchFilter,) ...
63,121,482
In my c++ code, I would like to validate my user input to be an int between 1,10 using a do while loop. I am able to validated for integers outside of the range. However if user inputs a float or a letter, it becomes an infinite loop. My idea is to add a condition in my while loop for if the input is not an integer to ...
2020/07/27
[ "https://Stackoverflow.com/questions/63121482", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12279422/" ]
You can check whether the input failed, i.e. the user entered something that could not be read as an `int` like this: ``` if (cin.fail()) { // in place of IF (STEPS IS NOT INTEGER==TRUE) cin.clear(); cin.ignore(); cout << "not an integer, try again\n"; continue; } ``` This avoids the need for the `COU...
You could use the `!` operator. For example: ``` if ( !(std::cin >> steps) ) { std::cin.clear(); std::cin.ignore(); std::cout << "Incorrect entry. Try again: "; } ``` Also consider not using [`using namespace std;`](https://stackoverflow.com/questions/1452721/why-is-usi...
3,653,502
How to evaluate this limit? $$\lim\_{x \to 0} \ln\left(\frac{\cos x}{1+\sin x}\right)^{\frac{1}{x}}$$ I think, somehow it can be transformed to expression, similar to $\frac{\ln (1+x)}{x}$ which limit is equal to $1$, but how? Can you help?$
2020/05/01
[ "https://math.stackexchange.com/questions/3653502", "https://math.stackexchange.com", "https://math.stackexchange.com/users/782013/" ]
Using L'Hopital's Rule, we have \begin{align} \lim\_{x\to0}\ln\left(\frac{\cos x}{1+\sin x}\right)^{1/x}&=\lim\_{x\to0}\frac{\ln(\cos x)-\ln(1+\sin x)}{x}\\ &=\lim\_{x\to0}\left(-\tan x-\frac{\cos x}{1+\sin x}\right)\\ &=-1 \end{align} [WolframAlpha](https://www.wolframalpha.com/input/?i=limit+x+to+0+ln%28%28cosx%2F%2...
**Hint.** Use the fact that $\ln u^v = v \ln u$ and the Taylor expansion for $\cos x$, $\sin x$; then use again the Taylor expansion of $\ln (1+x)$.
3,653,502
How to evaluate this limit? $$\lim\_{x \to 0} \ln\left(\frac{\cos x}{1+\sin x}\right)^{\frac{1}{x}}$$ I think, somehow it can be transformed to expression, similar to $\frac{\ln (1+x)}{x}$ which limit is equal to $1$, but how? Can you help?$
2020/05/01
[ "https://math.stackexchange.com/questions/3653502", "https://math.stackexchange.com", "https://math.stackexchange.com/users/782013/" ]
**Hint.** Use the fact that $\ln u^v = v \ln u$ and the Taylor expansion for $\cos x$, $\sin x$; then use again the Taylor expansion of $\ln (1+x)$.
We have \begin{aligned} \lim\limits\_{x\to 0}\ln\left(\frac{\cos x}{1+\sin x}\right)^{\frac{1}{x}}&=\lim\limits\_{x\to 0}\left(\frac{\ln(1+(\cos x-1))-\ln(1+\sin x)}{x}\right)\\ &=\lim\limits\_{x\to 0}\left(\frac{\ln(1+(\cos x-1))}{x(\cos x-1)}\cdot\frac{\cos x-1}{x}\cdot x-\frac{\ln(1+\sin x)}{x\sin x}\cdot \sin x\rig...
3,653,502
How to evaluate this limit? $$\lim\_{x \to 0} \ln\left(\frac{\cos x}{1+\sin x}\right)^{\frac{1}{x}}$$ I think, somehow it can be transformed to expression, similar to $\frac{\ln (1+x)}{x}$ which limit is equal to $1$, but how? Can you help?$
2020/05/01
[ "https://math.stackexchange.com/questions/3653502", "https://math.stackexchange.com", "https://math.stackexchange.com/users/782013/" ]
Using L'Hopital's Rule, we have \begin{align} \lim\_{x\to0}\ln\left(\frac{\cos x}{1+\sin x}\right)^{1/x}&=\lim\_{x\to0}\frac{\ln(\cos x)-\ln(1+\sin x)}{x}\\ &=\lim\_{x\to0}\left(-\tan x-\frac{\cos x}{1+\sin x}\right)\\ &=-1 \end{align} [WolframAlpha](https://www.wolframalpha.com/input/?i=limit+x+to+0+ln%28%28cosx%2F%2...
Like this: $ L=\lim\_{x \to 0} \frac{\ln \frac{\cos x}{1+\sin x}}{x}=\lim\_{x \to 0}\frac{\frac{\cos x}{1+\sin x}-1}{x}=\lim\_{x \to 0} \frac{\cos x-1-\sin x}{x(1+\sin x)}=\lim\_{x \to 0}(-\sin x-\cos x)=-1 $
3,653,502
How to evaluate this limit? $$\lim\_{x \to 0} \ln\left(\frac{\cos x}{1+\sin x}\right)^{\frac{1}{x}}$$ I think, somehow it can be transformed to expression, similar to $\frac{\ln (1+x)}{x}$ which limit is equal to $1$, but how? Can you help?$
2020/05/01
[ "https://math.stackexchange.com/questions/3653502", "https://math.stackexchange.com", "https://math.stackexchange.com/users/782013/" ]
Like this: $ L=\lim\_{x \to 0} \frac{\ln \frac{\cos x}{1+\sin x}}{x}=\lim\_{x \to 0}\frac{\frac{\cos x}{1+\sin x}-1}{x}=\lim\_{x \to 0} \frac{\cos x-1-\sin x}{x(1+\sin x)}=\lim\_{x \to 0}(-\sin x-\cos x)=-1 $
We have \begin{aligned} \lim\limits\_{x\to 0}\ln\left(\frac{\cos x}{1+\sin x}\right)^{\frac{1}{x}}&=\lim\limits\_{x\to 0}\left(\frac{\ln(1+(\cos x-1))-\ln(1+\sin x)}{x}\right)\\ &=\lim\limits\_{x\to 0}\left(\frac{\ln(1+(\cos x-1))}{x(\cos x-1)}\cdot\frac{\cos x-1}{x}\cdot x-\frac{\ln(1+\sin x)}{x\sin x}\cdot \sin x\rig...
3,653,502
How to evaluate this limit? $$\lim\_{x \to 0} \ln\left(\frac{\cos x}{1+\sin x}\right)^{\frac{1}{x}}$$ I think, somehow it can be transformed to expression, similar to $\frac{\ln (1+x)}{x}$ which limit is equal to $1$, but how? Can you help?$
2020/05/01
[ "https://math.stackexchange.com/questions/3653502", "https://math.stackexchange.com", "https://math.stackexchange.com/users/782013/" ]
Using L'Hopital's Rule, we have \begin{align} \lim\_{x\to0}\ln\left(\frac{\cos x}{1+\sin x}\right)^{1/x}&=\lim\_{x\to0}\frac{\ln(\cos x)-\ln(1+\sin x)}{x}\\ &=\lim\_{x\to0}\left(-\tan x-\frac{\cos x}{1+\sin x}\right)\\ &=-1 \end{align} [WolframAlpha](https://www.wolframalpha.com/input/?i=limit+x+to+0+ln%28%28cosx%2F%2...
We have \begin{aligned} \lim\limits\_{x\to 0}\ln\left(\frac{\cos x}{1+\sin x}\right)^{\frac{1}{x}}&=\lim\limits\_{x\to 0}\left(\frac{\ln(1+(\cos x-1))-\ln(1+\sin x)}{x}\right)\\ &=\lim\limits\_{x\to 0}\left(\frac{\ln(1+(\cos x-1))}{x(\cos x-1)}\cdot\frac{\cos x-1}{x}\cdot x-\frac{\ln(1+\sin x)}{x\sin x}\cdot \sin x\rig...
3,653,502
How to evaluate this limit? $$\lim\_{x \to 0} \ln\left(\frac{\cos x}{1+\sin x}\right)^{\frac{1}{x}}$$ I think, somehow it can be transformed to expression, similar to $\frac{\ln (1+x)}{x}$ which limit is equal to $1$, but how? Can you help?$
2020/05/01
[ "https://math.stackexchange.com/questions/3653502", "https://math.stackexchange.com", "https://math.stackexchange.com/users/782013/" ]
Using L'Hopital's Rule, we have \begin{align} \lim\_{x\to0}\ln\left(\frac{\cos x}{1+\sin x}\right)^{1/x}&=\lim\_{x\to0}\frac{\ln(\cos x)-\ln(1+\sin x)}{x}\\ &=\lim\_{x\to0}\left(-\tan x-\frac{\cos x}{1+\sin x}\right)\\ &=-1 \end{align} [WolframAlpha](https://www.wolframalpha.com/input/?i=limit+x+to+0+ln%28%28cosx%2F%2...
For $1+\sin x\ne0,$ $$\dfrac{\cos x}{1+\sin x}=\dfrac{1-\tan\dfrac x2}{1+\tan\dfrac x2}=1+\dfrac{-2\tan\dfrac x2}{1+\tan\dfrac x2}$$ $$\lim\_{x\to0}\left(\dfrac{\cos x}{1+\sin x}\right)^{1/x}$$ $$=\left(\lim\_{x\to0}\left(1+\dfrac{-2\tan\dfrac x2}{1+\tan\dfrac x2}\right)^{-\dfrac{1+\tan\dfrac x2}{2\tan\dfrac x2}}\rig...
3,653,502
How to evaluate this limit? $$\lim\_{x \to 0} \ln\left(\frac{\cos x}{1+\sin x}\right)^{\frac{1}{x}}$$ I think, somehow it can be transformed to expression, similar to $\frac{\ln (1+x)}{x}$ which limit is equal to $1$, but how? Can you help?$
2020/05/01
[ "https://math.stackexchange.com/questions/3653502", "https://math.stackexchange.com", "https://math.stackexchange.com/users/782013/" ]
For $1+\sin x\ne0,$ $$\dfrac{\cos x}{1+\sin x}=\dfrac{1-\tan\dfrac x2}{1+\tan\dfrac x2}=1+\dfrac{-2\tan\dfrac x2}{1+\tan\dfrac x2}$$ $$\lim\_{x\to0}\left(\dfrac{\cos x}{1+\sin x}\right)^{1/x}$$ $$=\left(\lim\_{x\to0}\left(1+\dfrac{-2\tan\dfrac x2}{1+\tan\dfrac x2}\right)^{-\dfrac{1+\tan\dfrac x2}{2\tan\dfrac x2}}\rig...
We have \begin{aligned} \lim\limits\_{x\to 0}\ln\left(\frac{\cos x}{1+\sin x}\right)^{\frac{1}{x}}&=\lim\limits\_{x\to 0}\left(\frac{\ln(1+(\cos x-1))-\ln(1+\sin x)}{x}\right)\\ &=\lim\limits\_{x\to 0}\left(\frac{\ln(1+(\cos x-1))}{x(\cos x-1)}\cdot\frac{\cos x-1}{x}\cdot x-\frac{\ln(1+\sin x)}{x\sin x}\cdot \sin x\rig...
2,655,677
How might I go about running a JNLP app on a machine that has no Internet access? Is there a way to copy the app's files from a machine where the app has already been downloaded and run?
2010/04/16
[ "https://Stackoverflow.com/questions/2655677", "https://Stackoverflow.com", "https://Stackoverflow.com/users/152730/" ]
A better solution is to request a .jar file download that you can run with `java -jar program.jar` because the files that are stored after the launch of the .jnlp isn't really "readable", you will find that resources and classes names are somewhat obfuscated.
A project named [jnlpdownloader](http://code.google.com/p/jnlpdownloader/) does this task, download from the jnlp all dependencies and creates executables.
10,313,627
I am trying to create a simple pagination routine for values held in an `ArrayList`. Basically what I want to do is render the first five elements in the `ArrayList` at first go. And then when users click on `Next (increment by another 5)` and `Previous (decrease by 5)`. My logic looks like this: ``` class foo { p...
2012/04/25
[ "https://Stackoverflow.com/questions/10313627", "https://Stackoverflow.com", "https://Stackoverflow.com/users/340390/" ]
Based on "pscuderi" [solution here](https://stackoverflow.com/a/22947052/1124409) I've built a wrapping class that can be helpful for someone looking for this: ``` import java.util.ArrayList; import java.util.Collections; import java.util.List; public class PaginatedList<T> { private static final int DEFAULT_PAGE_S...
Change ``` if (moveCounter > -1 && moveCounter <= archive.size()) { renderValues(moveCounter-1, true); } ``` to ``` if (moveCounter > 0 && moveCounter <= archive.size()) { renderValues(moveCounter-1, true); } ```
10,313,627
I am trying to create a simple pagination routine for values held in an `ArrayList`. Basically what I want to do is render the first five elements in the `ArrayList` at first go. And then when users click on `Next (increment by another 5)` and `Previous (decrease by 5)`. My logic looks like this: ``` class foo { p...
2012/04/25
[ "https://Stackoverflow.com/questions/10313627", "https://Stackoverflow.com", "https://Stackoverflow.com/users/340390/" ]
Change ``` if (moveCounter > -1 && moveCounter <= archive.size()) { renderValues(moveCounter-1, true); } ``` to ``` if (moveCounter > 0 && moveCounter <= archive.size()) { renderValues(moveCounter-1, true); } ```
Here is a simple java function for pagination. Note that the `page` starts from 0 (first page) ``` public List<Object> pagedResponse(List<Object> allItems, int page, int limit){ int totalItems = allItems.size(); int fromIndex = page*limit; int toIndex = fromIndex+limit; if(fromIndex <= totalItems) { ...
10,313,627
I am trying to create a simple pagination routine for values held in an `ArrayList`. Basically what I want to do is render the first five elements in the `ArrayList` at first go. And then when users click on `Next (increment by another 5)` and `Previous (decrease by 5)`. My logic looks like this: ``` class foo { p...
2012/04/25
[ "https://Stackoverflow.com/questions/10313627", "https://Stackoverflow.com", "https://Stackoverflow.com/users/340390/" ]
Based on "pscuderi" [solution here](https://stackoverflow.com/a/22947052/1124409) I've built a wrapping class that can be helpful for someone looking for this: ``` import java.util.ArrayList; import java.util.Collections; import java.util.List; public class PaginatedList<T> { private static final int DEFAULT_PAGE_S...
I would do it like this: I'm not sure what renderValues does, and whether we have to substract 1 or maybe defaultStep from the upper bound of the moveCounter. ``` private void pageMove (int step) { moveCounter = moveCounter + step; if (moveCounter < 0) moveCounter = 0; if (moveCounter > values.size ()) m...
10,313,627
I am trying to create a simple pagination routine for values held in an `ArrayList`. Basically what I want to do is render the first five elements in the `ArrayList` at first go. And then when users click on `Next (increment by another 5)` and `Previous (decrease by 5)`. My logic looks like this: ``` class foo { p...
2012/04/25
[ "https://Stackoverflow.com/questions/10313627", "https://Stackoverflow.com", "https://Stackoverflow.com/users/340390/" ]
I would do it like this: I'm not sure what renderValues does, and whether we have to substract 1 or maybe defaultStep from the upper bound of the moveCounter. ``` private void pageMove (int step) { moveCounter = moveCounter + step; if (moveCounter < 0) moveCounter = 0; if (moveCounter > values.size ()) m...
Here is a simple java function for pagination. Note that the `page` starts from 0 (first page) ``` public List<Object> pagedResponse(List<Object> allItems, int page, int limit){ int totalItems = allItems.size(); int fromIndex = page*limit; int toIndex = fromIndex+limit; if(fromIndex <= totalItems) { ...
10,313,627
I am trying to create a simple pagination routine for values held in an `ArrayList`. Basically what I want to do is render the first five elements in the `ArrayList` at first go. And then when users click on `Next (increment by another 5)` and `Previous (decrease by 5)`. My logic looks like this: ``` class foo { p...
2012/04/25
[ "https://Stackoverflow.com/questions/10313627", "https://Stackoverflow.com", "https://Stackoverflow.com/users/340390/" ]
Based on "pscuderi" [solution here](https://stackoverflow.com/a/22947052/1124409) I've built a wrapping class that can be helpful for someone looking for this: ``` import java.util.ArrayList; import java.util.Collections; import java.util.List; public class PaginatedList<T> { private static final int DEFAULT_PAGE_S...
Here is a simple java function for pagination. Note that the `page` starts from 0 (first page) ``` public List<Object> pagedResponse(List<Object> allItems, int page, int limit){ int totalItems = allItems.size(); int fromIndex = page*limit; int toIndex = fromIndex+limit; if(fromIndex <= totalItems) { ...
1,100,819
I'm working on a large project (for me) which will have many classes and will need to be extensible, but I'm not sure how to plan out my program and how the classes need to interact. I took an OOD course a few semesters back and learned a lot from it; like writing UML, and translating requirements documents into objec...
2009/07/08
[ "https://Stackoverflow.com/questions/1100819", "https://Stackoverflow.com", "https://Stackoverflow.com/users/125946/" ]
Adding to what Scott Davies had to say: 1. Make absolutely sure you know what your program is all about before you start. What *is* your program? What will it *not* do? What problem is it trying to solve? 2. Your first set of use cases shouldn't be a laundry list of everything the program will eventually do. Start wit...
Just quoting <http://www.fysh.org/~katie/computing/methodologies.txt> And at the core of RUP is a small area where you have to use OO design talents.... if you don't have them, it's like having a methodology for running the 100m. "Step 1: write about running really fast. Step 2: Go and draw a plan of the racetrack. ...
1,100,819
I'm working on a large project (for me) which will have many classes and will need to be extensible, but I'm not sure how to plan out my program and how the classes need to interact. I took an OOD course a few semesters back and learned a lot from it; like writing UML, and translating requirements documents into objec...
2009/07/08
[ "https://Stackoverflow.com/questions/1100819", "https://Stackoverflow.com", "https://Stackoverflow.com/users/125946/" ]
The technique I've used in real projects with reasonable success is Responsibility Driven Design, inspired by Wirfs-Brock's book. Start with the top level user stories, and with colleagues, at a whiteboard, sketch the high-level interactions they imply. This gets you the first idea of what the big modules are; and an...
Honestly, a good step would be going back and looking at flow charting and sequence diagramming. There are a ton of good sites that show you how to do it. I find it to be invaluable when looking at how I want to break down a program into classes as I know exactly what the program needs inputted, computed, and outputted...
1,100,819
I'm working on a large project (for me) which will have many classes and will need to be extensible, but I'm not sure how to plan out my program and how the classes need to interact. I took an OOD course a few semesters back and learned a lot from it; like writing UML, and translating requirements documents into objec...
2009/07/08
[ "https://Stackoverflow.com/questions/1100819", "https://Stackoverflow.com", "https://Stackoverflow.com/users/125946/" ]
The problem with large projects is that you can not oversee all the interactions between components. It is thus important to reduce the complexity of the project. Class and Sequence diagrams are too detailed for this phase of design. First try to think from a higher abstraction level. Think about major components and...
I am afraid that this is not an answer *people like to hear*. Anyway, let me state my opinion. OOP should be viewed as one of the paradigms, not as the superior paradigm. OOP is good for solving certain kind of problems, like developing a GUI library. It also fits into the style of software development usually follow...
1,100,819
I'm working on a large project (for me) which will have many classes and will need to be extensible, but I'm not sure how to plan out my program and how the classes need to interact. I took an OOD course a few semesters back and learned a lot from it; like writing UML, and translating requirements documents into objec...
2009/07/08
[ "https://Stackoverflow.com/questions/1100819", "https://Stackoverflow.com", "https://Stackoverflow.com/users/125946/" ]
**Learn design patterns**. It has been my personal revolution the past two years regarding OOP. Get a book. I would recommend you this one: [Head First Design Patterns](https://rads.stackoverflow.com/amzn/click/com/0596007124) It is in Java but it can be extensible to any language.
As answered in [What is the workflow you follow to design the software you’re about to write?](https://stackoverflow.com/questions/454382/what-is-the-workflow-you-follow-to-design-the-software-youre-about-to-write/454406#454406)
1,100,819
I'm working on a large project (for me) which will have many classes and will need to be extensible, but I'm not sure how to plan out my program and how the classes need to interact. I took an OOD course a few semesters back and learned a lot from it; like writing UML, and translating requirements documents into objec...
2009/07/08
[ "https://Stackoverflow.com/questions/1100819", "https://Stackoverflow.com", "https://Stackoverflow.com/users/125946/" ]
1. study & master Design Patterns. 2. Next, learn about the Domain Driven Design 3. After that, learn the requirement gathering > > I took an OOD course a few semesters > back and learned a lot from it; like > writing UML, and translating > requirements documents into objects > and classes. We learned sequence > ...
One useful technique is to relate your unique problem description to something you can find in the real world. For example, you are modelling a complex health care system that will take the world by storm. Are there any examples you can readily call upon to model this? Indeed. Observe how the side pharmacy would oper...
1,100,819
I'm working on a large project (for me) which will have many classes and will need to be extensible, but I'm not sure how to plan out my program and how the classes need to interact. I took an OOD course a few semesters back and learned a lot from it; like writing UML, and translating requirements documents into objec...
2009/07/08
[ "https://Stackoverflow.com/questions/1100819", "https://Stackoverflow.com", "https://Stackoverflow.com/users/125946/" ]
**Design Patterns** **Creational Design Patterns** Singleton - Ensure that only one instance of a class is created and Provide a global access point to the object. Factory(Simplified version of Factory Method)- Creates objects without exposing the instantiation logic to the client and Refers to the newly created o...
If you have domain expertise on the project you are going to work on like say banking. It's easy to structure your objects and you know how those enhancements come every other day. If you don't have that expertise work with someone who has that expertise and convert those ideas into technical details. If you are conf...
1,100,819
I'm working on a large project (for me) which will have many classes and will need to be extensible, but I'm not sure how to plan out my program and how the classes need to interact. I took an OOD course a few semesters back and learned a lot from it; like writing UML, and translating requirements documents into objec...
2009/07/08
[ "https://Stackoverflow.com/questions/1100819", "https://Stackoverflow.com", "https://Stackoverflow.com/users/125946/" ]
It's oft repeated but completely true - understand your data. For OOP your classes should describe salient pieces of information and how they interact. If you have a mental model that well-describes the behaviour and lifetime of the data, you'll have an easy ride laying out your classes. This is simply an extension ...
First of all - design should come from your soul. You must feel it by your every fibre. I usually walk it down for two or three months before I start doing anything, Just walking down the streets (really). And thinking. Walking is a good meditation, you know. So it lets you to concentrate well. Secondly - use OOP and ...
1,100,819
I'm working on a large project (for me) which will have many classes and will need to be extensible, but I'm not sure how to plan out my program and how the classes need to interact. I took an OOD course a few semesters back and learned a lot from it; like writing UML, and translating requirements documents into objec...
2009/07/08
[ "https://Stackoverflow.com/questions/1100819", "https://Stackoverflow.com", "https://Stackoverflow.com/users/125946/" ]
Try using behavior driven development. It'll be hard to break your old habits, but I've found that BDD really is your best bet when it comes to developing in the real world. <http://behaviour-driven.org/>
Honestly, a good step would be going back and looking at flow charting and sequence diagramming. There are a ton of good sites that show you how to do it. I find it to be invaluable when looking at how I want to break down a program into classes as I know exactly what the program needs inputted, computed, and outputted...
1,100,819
I'm working on a large project (for me) which will have many classes and will need to be extensible, but I'm not sure how to plan out my program and how the classes need to interact. I took an OOD course a few semesters back and learned a lot from it; like writing UML, and translating requirements documents into objec...
2009/07/08
[ "https://Stackoverflow.com/questions/1100819", "https://Stackoverflow.com", "https://Stackoverflow.com/users/125946/" ]
1. study & master Design Patterns. 2. Next, learn about the Domain Driven Design 3. After that, learn the requirement gathering > > I took an OOD course a few semesters > back and learned a lot from it; like > writing UML, and translating > requirements documents into objects > and classes. We learned sequence > ...
As answered in [What is the workflow you follow to design the software you’re about to write?](https://stackoverflow.com/questions/454382/what-is-the-workflow-you-follow-to-design-the-software-youre-about-to-write/454406#454406)
1,100,819
I'm working on a large project (for me) which will have many classes and will need to be extensible, but I'm not sure how to plan out my program and how the classes need to interact. I took an OOD course a few semesters back and learned a lot from it; like writing UML, and translating requirements documents into objec...
2009/07/08
[ "https://Stackoverflow.com/questions/1100819", "https://Stackoverflow.com", "https://Stackoverflow.com/users/125946/" ]
The steps that I use for initial design (getting to a class diagram), are: 1. Requirements gathering. Talk to the client and factor out the use cases to define what functionality the software should have. 2. Compose a narrative of the individual use cases. 3. Go through the narrative and highlight nouns (person, place...
I am afraid that this is not an answer *people like to hear*. Anyway, let me state my opinion. OOP should be viewed as one of the paradigms, not as the superior paradigm. OOP is good for solving certain kind of problems, like developing a GUI library. It also fits into the style of software development usually follow...
19,401,825
I am trying this query but without success. ``` SELECT name, phone_office, billing_address_city, billing_address_street, billing_address_country FROM accounts WHERE ($P!{EmployeeID} is null or assigned_user_id = $P!{EmployeeID}) ORDER BY billing_address_country, billing_address_city ``` This url will filter by Empl...
2013/10/16
[ "https://Stackoverflow.com/questions/19401825", "https://Stackoverflow.com", "https://Stackoverflow.com/users/564979/" ]
Ok, let see the sample. For example we have a query: ```sql SELECT id, city, street FROM address WHERE city=$P{inputParamCity} ORDER BY city ``` But our ***inputParamCity*** can be undefined. In this case we got an error: ``` Error filling print... Error preparing statement for executing the report query :  SELECT...
I think optional where clause can be done in this way also :- ``` SELECT name, phone_office, billing_address_city, billing_address_street, billing_address_country FROM accounts WHERE (assigned_user_id = $P{EmployeeID} or $P{EmployeeID} is null) ORDER BY billing_address_country, billing_ad...
19,500,216
Is there a chance to get: ``` System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); ``` from XAML code? ``` <Window x:Class="TestWpf.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" ...
2013/10/21
[ "https://Stackoverflow.com/questions/19500216", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1729349/" ]
You can use MarkupExtension for this: ``` public class Version : MarkupExtension { public override object ProvideValue(IServiceProvider serviceProvider) { return System.Reflection.Assembly .GetExecutingAssembly().GetName().Version.ToString(); } } ``` And to use it this way: ...
In the code-behind of your `Window` create a property returning that string: ``` public string Version { get { return System.Reflection.Assembly .GetExecutingAssembly().GetName().Version.ToString(); } } ``` Then reference that from your XAML code: ``` <Window x:Class="TestWpf.MainWin...
11,148,318
I'm writing a simple loan calculator with gui using swing. I used DecimalFormat to make sure I capture the input in my specified format ####.## for my JFormattedTextField . ``` public static void main(String[] args) { JFormattedTextField loanAmountField = new JFormattedTextField(new DecimalFormat("####.##")); ...
2012/06/21
[ "https://Stackoverflow.com/questions/11148318", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1154722/" ]
You can use the [`setValue`](http://www.open.collab.net/nonav/community/cif_cee/pt/javadoc/tracker-ws/com/collabnet/tracker/ws/SetValue.html) method for this; ``` monthlyPaymentField.setValue(new Double(12.22)); ```
Use [setValue](http://docs.oracle.com/javase/6/docs/api/javax/swing/JFormattedTextField.html#setValue%28java.lang.Object%29), ie: ``` monthlyPaymentField.setValue(new Double(12.22)); ``` [How to Use Formatted Text Fields](http://docs.oracle.com/javase/tutorial/uiswing/components/formattedtextfield.html) tutorial ha...
46,307,886
I want to practice with some database that I want to use inside Visual Studio 2017. I had `Northwind.mdf` that I downloaded some time ago. But when I try to connect to it from VS2017 Servers panel, I get error message: > > This database file is not compatible with the current instance of SQL Server. > > > Q1: Wh...
2017/09/19
[ "https://Stackoverflow.com/questions/46307886", "https://Stackoverflow.com", "https://Stackoverflow.com/users/610422/" ]
SQL Server only supports databases up to two versions ago, I don't know what version of SQL Server comes with VS2017 but I suppose that is at least SQL Server 2016 (you can check it using the query `select @@version`), so it supports at most DB's from SQL Server 2012 and [Northwind is for SQL Server 2000](https://www.m...
i have the same problem, i want to use the northwind in VS2017 environment. (btw - [w3scools](https://www.w3schools.com/sql/)use this northwind db to teach sql (october 2018) so i download the sql script from [here](https://learn.microsoft.com/en-us/dotnet/framework/data/adonet/sql/linq/downloading-sample-databases),...
11,099,179
I have the following dataframe: ``` sp <- combn(c("sp1","sp2","sp3","sp4"),2) d <- data.frame(t(sp),"freq"=sample(0:100,6)) ``` and two factors ``` x1 <- as.factor(c("sp1","sp2")) x2 <- as.factor(c("sp3","sp4")) ``` I need a dataframe returned containing all possible combinations of `x1` and `x2` and the `freq` f...
2012/06/19
[ "https://Stackoverflow.com/questions/11099179", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1392044/" ]
Do not make `x1` and `x2` factors. Just use vectors. Use `%in%` for the logical test. ``` sp <- combn(c("sp1","sp2","sp3","sp4"),2) d <- data.frame(t(sp),"freq"=sample(0:100,6)) x1 <- c("sp1","sp2") x2 <- c("sp3","sp4") sub <- d[d$X1 %in% x1 & d$X2 %in% x2,] ```
You are almost there: ``` d[d$X1 %in% x1 & d$X2 %in% x2,] ```
10,369,702
Hello I am writing an app that makes the use of coordinates from a webserver. I know how to retrieve the coordinates from the webservice, but once I get them how can I constantly display them on the map. Sort of like the Location Listener updates the point on the map when the location from the location manager changes....
2012/04/29
[ "https://Stackoverflow.com/questions/10369702", "https://Stackoverflow.com", "https://Stackoverflow.com/users/804928/" ]
Well what you can do is to use a `timer` to populate the map. Basically, you can have one method which contacts the server, fetches the coordinates and adds them into an arraylist. Now this method can be called from inside the timer (which can run every few seconds, depending on your needs). Also, inside this timer cla...
``` GeoPoint p = mapView.getProjection().fromPixels((int) event.getX(),(int) event.getY()); Drawable srcdrawable = getApplicationContext().getResources().getDrawable(R.drawable.pin_blue); CustomItemizedOverlay srcitemizedOverlay = new CustomItemizedOverlay(srcdrawable, getApplicationContext()); OverlayItem srcoverlayit...
67,538,460
I'm trying to research the best hyperparameters for my boosted decision tree training. Here's the code for just two instances: ``` user = '/home/.../BDT/' nestimators = [1, 2] rule all: input: user + 'AUC_score.pdf' rule testing: output: user + 'AUC_score.csv' shell: 'python bdt.py --nestima...
2021/05/14
[ "https://Stackoverflow.com/questions/67538460", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15927987/" ]
The error arises because `{}` is replaced by a generator object, that is, it is *not* replaced first by `1` and then by `2` but, so to speak, by an iterator over `nestimators`. Even if you correct the python expression in the rule `testing`. There may be a more fundamental problem if I understand your aim correctly. [...
The problem in your code is that the expression `nestimators[i] for i in range(2)` is not a list (as you may think). That is a generator, and it doesn't produce any values until you explicitly do that. For example, this code: ```py 'python bdt.py --nestimators {}'.format(list(nestimators[i] for i in range(2))) ``` p...
6,445,177
I am trying to understand memory allocation in C++. A question that comes to my mind is why is it so necessary to allocate memory? And what happens if we use memory without allocating it? Also, I was shocked to see how careless C++ is on memory allocation. If gives free access to memory through arrays with no bounds ch...
2011/06/22
[ "https://Stackoverflow.com/questions/6445177", "https://Stackoverflow.com", "https://Stackoverflow.com/users/200894/" ]
The above code is [Undefined Behaviour](http://en.wikipedia.org/wiki/Undefined_behavior). It can work, work incorrectly, not work at all, crash, or order pizza through Microsoft Skype. Thou shalt not rely on undefined behavior.
> > Is it possible that the memory > location i am accessing has been > allocated to some other program and > assigning a value to it might cause > that program to crash/behave in a very > unexpected fashion? > > > No, modern OSs are designed just to avoid that (for security reasons). And you have to alloc...
6,445,177
I am trying to understand memory allocation in C++. A question that comes to my mind is why is it so necessary to allocate memory? And what happens if we use memory without allocating it? Also, I was shocked to see how careless C++ is on memory allocation. If gives free access to memory through arrays with no bounds ch...
2011/06/22
[ "https://Stackoverflow.com/questions/6445177", "https://Stackoverflow.com", "https://Stackoverflow.com/users/200894/" ]
This seems like two questions: 1. Why doesn't c++ do bounds-checking? 2. Why do we need dynamic memory allocation? My answers: 1. Because then it'd be slower. You can always write an accessor function that checks bounds, like std::vector::at(). 2. Because not being able to resize memory at runtime can be very incon...
In most operating systems, there is a distinct separation between the physical memory available in the host computer, and the logical memory footprint that application code can see. This is mediated, in most cases, by a part of the CPU called the Memory Management Unit (or MMU), and it serves a number of useful goals. ...
6,445,177
I am trying to understand memory allocation in C++. A question that comes to my mind is why is it so necessary to allocate memory? And what happens if we use memory without allocating it? Also, I was shocked to see how careless C++ is on memory allocation. If gives free access to memory through arrays with no bounds ch...
2011/06/22
[ "https://Stackoverflow.com/questions/6445177", "https://Stackoverflow.com", "https://Stackoverflow.com/users/200894/" ]
Many good answers, but I feel that there's something missing regarding "why we need to allocate memory". I think it is important to know how the control flow of a computer program works at the lowest level, since C and C++ are relatively thin layers of abstraction over the hardware. While it is possible to write a pro...
In most operating systems, there is a distinct separation between the physical memory available in the host computer, and the logical memory footprint that application code can see. This is mediated, in most cases, by a part of the CPU called the Memory Management Unit (or MMU), and it serves a number of useful goals. ...
6,445,177
I am trying to understand memory allocation in C++. A question that comes to my mind is why is it so necessary to allocate memory? And what happens if we use memory without allocating it? Also, I was shocked to see how careless C++ is on memory allocation. If gives free access to memory through arrays with no bounds ch...
2011/06/22
[ "https://Stackoverflow.com/questions/6445177", "https://Stackoverflow.com", "https://Stackoverflow.com/users/200894/" ]
Allocating memory on the heap allows dynamic allocation of a dynamic amount of memory with a dynamic lifetime. If you want bounds-checking, you can get it through std::vector::at(). > > In what cases would assigning value to a non allocated memory location would be dangerous? > > > All cases. > > what are the...
In most operating systems, there is a distinct separation between the physical memory available in the host computer, and the logical memory footprint that application code can see. This is mediated, in most cases, by a part of the CPU called the Memory Management Unit (or MMU), and it serves a number of useful goals. ...
6,445,177
I am trying to understand memory allocation in C++. A question that comes to my mind is why is it so necessary to allocate memory? And what happens if we use memory without allocating it? Also, I was shocked to see how careless C++ is on memory allocation. If gives free access to memory through arrays with no bounds ch...
2011/06/22
[ "https://Stackoverflow.com/questions/6445177", "https://Stackoverflow.com", "https://Stackoverflow.com/users/200894/" ]
**Why is it neccessary to allocate memory?** Because that way, you mark the memory as yours. Nobody else can use it. It also verifies that there is in fact memory available. If your system only has 1000 bytes of memory, just picking byte 1500 to store some data at is a bad idea. **What happens if we use memory without...
Allocating memory on the heap allows dynamic allocation of a dynamic amount of memory with a dynamic lifetime. If you want bounds-checking, you can get it through std::vector::at(). > > In what cases would assigning value to a non allocated memory location would be dangerous? > > > All cases. > > what are the...
6,445,177
I am trying to understand memory allocation in C++. A question that comes to my mind is why is it so necessary to allocate memory? And what happens if we use memory without allocating it? Also, I was shocked to see how careless C++ is on memory allocation. If gives free access to memory through arrays with no bounds ch...
2011/06/22
[ "https://Stackoverflow.com/questions/6445177", "https://Stackoverflow.com", "https://Stackoverflow.com/users/200894/" ]
The above code is [Undefined Behaviour](http://en.wikipedia.org/wiki/Undefined_behavior). It can work, work incorrectly, not work at all, crash, or order pizza through Microsoft Skype. Thou shalt not rely on undefined behavior.
Many good answers, but I feel that there's something missing regarding "why we need to allocate memory". I think it is important to know how the control flow of a computer program works at the lowest level, since C and C++ are relatively thin layers of abstraction over the hardware. While it is possible to write a pro...
6,445,177
I am trying to understand memory allocation in C++. A question that comes to my mind is why is it so necessary to allocate memory? And what happens if we use memory without allocating it? Also, I was shocked to see how careless C++ is on memory allocation. If gives free access to memory through arrays with no bounds ch...
2011/06/22
[ "https://Stackoverflow.com/questions/6445177", "https://Stackoverflow.com", "https://Stackoverflow.com/users/200894/" ]
**Why is it neccessary to allocate memory?** Because that way, you mark the memory as yours. Nobody else can use it. It also verifies that there is in fact memory available. If your system only has 1000 bytes of memory, just picking byte 1500 to store some data at is a bad idea. **What happens if we use memory without...
This seems like two questions: 1. Why doesn't c++ do bounds-checking? 2. Why do we need dynamic memory allocation? My answers: 1. Because then it'd be slower. You can always write an accessor function that checks bounds, like std::vector::at(). 2. Because not being able to resize memory at runtime can be very incon...
6,445,177
I am trying to understand memory allocation in C++. A question that comes to my mind is why is it so necessary to allocate memory? And what happens if we use memory without allocating it? Also, I was shocked to see how careless C++ is on memory allocation. If gives free access to memory through arrays with no bounds ch...
2011/06/22
[ "https://Stackoverflow.com/questions/6445177", "https://Stackoverflow.com", "https://Stackoverflow.com/users/200894/" ]
The above code is [Undefined Behaviour](http://en.wikipedia.org/wiki/Undefined_behavior). It can work, work incorrectly, not work at all, crash, or order pizza through Microsoft Skype. Thou shalt not rely on undefined behavior.
Allocating memory on the heap allows dynamic allocation of a dynamic amount of memory with a dynamic lifetime. If you want bounds-checking, you can get it through std::vector::at(). > > In what cases would assigning value to a non allocated memory location would be dangerous? > > > All cases. > > what are the...
6,445,177
I am trying to understand memory allocation in C++. A question that comes to my mind is why is it so necessary to allocate memory? And what happens if we use memory without allocating it? Also, I was shocked to see how careless C++ is on memory allocation. If gives free access to memory through arrays with no bounds ch...
2011/06/22
[ "https://Stackoverflow.com/questions/6445177", "https://Stackoverflow.com", "https://Stackoverflow.com/users/200894/" ]
The above code is [Undefined Behaviour](http://en.wikipedia.org/wiki/Undefined_behavior). It can work, work incorrectly, not work at all, crash, or order pizza through Microsoft Skype. Thou shalt not rely on undefined behavior.
In most operating systems, there is a distinct separation between the physical memory available in the host computer, and the logical memory footprint that application code can see. This is mediated, in most cases, by a part of the CPU called the Memory Management Unit (or MMU), and it serves a number of useful goals. ...
6,445,177
I am trying to understand memory allocation in C++. A question that comes to my mind is why is it so necessary to allocate memory? And what happens if we use memory without allocating it? Also, I was shocked to see how careless C++ is on memory allocation. If gives free access to memory through arrays with no bounds ch...
2011/06/22
[ "https://Stackoverflow.com/questions/6445177", "https://Stackoverflow.com", "https://Stackoverflow.com/users/200894/" ]
The above code is [Undefined Behaviour](http://en.wikipedia.org/wiki/Undefined_behavior). It can work, work incorrectly, not work at all, crash, or order pizza through Microsoft Skype. Thou shalt not rely on undefined behavior.
This seems like two questions: 1. Why doesn't c++ do bounds-checking? 2. Why do we need dynamic memory allocation? My answers: 1. Because then it'd be slower. You can always write an accessor function that checks bounds, like std::vector::at(). 2. Because not being able to resize memory at runtime can be very incon...
36,951,583
I'm not good at English,Sory. I am a Ansible, are making a Docker. But it can not successfully set the DNS. Error Message: ``` TASK [data container] ********************************************************** fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg": "Docker API Error: json: cannot u...
2016/04/30
[ "https://Stackoverflow.com/questions/36951583", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3387068/" ]
Maybe this can help: ``` int start = 10; int stop = 200; int step = 20; do { cout << start << " "; start = start + step; // increment. Shorter version: start += step; } while (start < stop); ``` When getting the input try something like ``` int start = -1; while(start < 0) { cout << "Please enter a pos...
Instead of incrementing start by 1, increment it by `step`. Also, you need to output the `start` variable, not `step`. Outputting step as you did before will just result in: ``` Integer: 20 Integer: 20 Integer: 20 .... ``` Here are the changes I made: ``` cout << "Integers: "; while(start < end) { cout << star...
2,572,551
I don't know how to execute a command stored as a variable or how to use `ifeq` inside of a target, so I have a *very* redundant Makefile at the moment! Ideally I'd like to have just one target (`all`) which would run the stored command on Mac and run it twice on Linux, once with -m32 and once with -m64. ``` all: ...
2010/04/03
[ "https://Stackoverflow.com/questions/2572551", "https://Stackoverflow.com", "https://Stackoverflow.com/users/310170/" ]
You make macros do most of the work, noting that you should use $(CC) rather than gcc. ``` BUILD_COMMAND = $(CC) $(SHARED_OPT) $(GENERAL_CFLAGS) $(PLATFORM_CFLAGS) BUILD_NAME32 = $(BUILD_NAME) TARGET_32 = $(BUILD_DIR)$(BUILD_NAME32) TARGET_64 = $(BUILD_DIR)$(BUILD_NAME64) LIBS_32 = $(LIBRARIES) LIBS_64 ...
This is pretty simple, but you should be able to adapt it to more complicated things by changing the shell command that you run. ``` PLATFORM := $(shell uname) all:$(PLATFORM) Darwin: echo Darwin Linux: echo Linux ```
2,572,551
I don't know how to execute a command stored as a variable or how to use `ifeq` inside of a target, so I have a *very* redundant Makefile at the moment! Ideally I'd like to have just one target (`all`) which would run the stored command on Mac and run it twice on Linux, once with -m32 and once with -m64. ``` all: ...
2010/04/03
[ "https://Stackoverflow.com/questions/2572551", "https://Stackoverflow.com", "https://Stackoverflow.com/users/310170/" ]
This is pretty simple, but you should be able to adapt it to more complicated things by changing the shell command that you run. ``` PLATFORM := $(shell uname) all:$(PLATFORM) Darwin: echo Darwin Linux: echo Linux ```
You have some good advice there (probe the platform, use variables) but you should also be aware that you're running very close to the point where it is better to stop thinking in terms of supporting platforms and instead in terms of describing features that you require for your software and using `autoconf` (and famil...
2,572,551
I don't know how to execute a command stored as a variable or how to use `ifeq` inside of a target, so I have a *very* redundant Makefile at the moment! Ideally I'd like to have just one target (`all`) which would run the stored command on Mac and run it twice on Linux, once with -m32 and once with -m64. ``` all: ...
2010/04/03
[ "https://Stackoverflow.com/questions/2572551", "https://Stackoverflow.com", "https://Stackoverflow.com/users/310170/" ]
You make macros do most of the work, noting that you should use $(CC) rather than gcc. ``` BUILD_COMMAND = $(CC) $(SHARED_OPT) $(GENERAL_CFLAGS) $(PLATFORM_CFLAGS) BUILD_NAME32 = $(BUILD_NAME) TARGET_32 = $(BUILD_DIR)$(BUILD_NAME32) TARGET_64 = $(BUILD_DIR)$(BUILD_NAME64) LIBS_32 = $(LIBRARIES) LIBS_64 ...
You have some good advice there (probe the platform, use variables) but you should also be aware that you're running very close to the point where it is better to stop thinking in terms of supporting platforms and instead in terms of describing features that you require for your software and using `autoconf` (and famil...
10,827,696
I know this is caused when the view has a code path that doesn't return an `HttpResponse`, obviously. I'm new to django, so this may be completely wrong. Here's the FormView code. Do I need to override `render_to_response`? ``` class AddAdvertView(FormView): form_class = NewAdForm def get(self, *args, **kwar...
2012/05/31
[ "https://Stackoverflow.com/questions/10827696", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1038204/" ]
This is probably what you want in your `get` method: ``` def get(self, *args, **kwargs): campaign = get_object_or_404(Campaign, id=self.kwargs['campaign_id']) ctx = self.get_context_data() ctx['campaign'] = campaign return self.render_to_response(ctx) ``` If you aren't doing anything with `post`...
You should return something from `post` and `get` methods, at least `super(AddAdvertView, self).get(*args, **kwargs)`. In your code `get` just created an attribute (though it should return an empty form), and `post` does nothing at all (though it should process the form). It seems you should not redefine `post` and `ge...
18,317,405
I know this is fairly easy for UITableViewCells but I'm not sure how to approach this using a UICollectionView. EDIT. Pictures for clarification. Text content of the cells are not the same here but they should be. In landscape: ![](https://i.stack.imgur.com/E4rB6.png) In portrait: ![enter image description here](ht...
2013/08/19
[ "https://Stackoverflow.com/questions/18317405", "https://Stackoverflow.com", "https://Stackoverflow.com/users/142358/" ]
I don' think there's any good general way to do this without subclassing the flow layout. For a more specific case, you can use integer math combined with the modulus operator to get "rows" from the indexPath. So, if you had 5 items on each row, you could return either 0 or 1 from this expression: ``` NSInteger rowTes...
Use the indexPath.section property to get a row.
18,317,405
I know this is fairly easy for UITableViewCells but I'm not sure how to approach this using a UICollectionView. EDIT. Pictures for clarification. Text content of the cells are not the same here but they should be. In landscape: ![](https://i.stack.imgur.com/E4rB6.png) In portrait: ![enter image description here](ht...
2013/08/19
[ "https://Stackoverflow.com/questions/18317405", "https://Stackoverflow.com", "https://Stackoverflow.com/users/142358/" ]
Neither the collection view nor its layout will tell you a “row number” for items. You have to compute it yourself. If all of your measurements are uniform (which is the case if you didn't implement any `UICollectionViewDelegateFlowLayout` methods), you can compute it pretty easily. There are a few places you could d...
Use the indexPath.section property to get a row.
18,317,405
I know this is fairly easy for UITableViewCells but I'm not sure how to approach this using a UICollectionView. EDIT. Pictures for clarification. Text content of the cells are not the same here but they should be. In landscape: ![](https://i.stack.imgur.com/E4rB6.png) In portrait: ![enter image description here](ht...
2013/08/19
[ "https://Stackoverflow.com/questions/18317405", "https://Stackoverflow.com", "https://Stackoverflow.com/users/142358/" ]
I don' think there's any good general way to do this without subclassing the flow layout. For a more specific case, you can use integer math combined with the modulus operator to get "rows" from the indexPath. So, if you had 5 items on each row, you could return either 0 or 1 from this expression: ``` NSInteger rowTes...
Something like this should do it. May take some tweaking, etc. Assuming that you are not using sections which would have to have some changes.. ----------------------------------------------------------------------------------------------------------------------------------------------- ``` #import <UIKit/UIKit.h> @i...
18,317,405
I know this is fairly easy for UITableViewCells but I'm not sure how to approach this using a UICollectionView. EDIT. Pictures for clarification. Text content of the cells are not the same here but they should be. In landscape: ![](https://i.stack.imgur.com/E4rB6.png) In portrait: ![enter image description here](ht...
2013/08/19
[ "https://Stackoverflow.com/questions/18317405", "https://Stackoverflow.com", "https://Stackoverflow.com/users/142358/" ]
I don' think there's any good general way to do this without subclassing the flow layout. For a more specific case, you can use integer math combined with the modulus operator to get "rows" from the indexPath. So, if you had 5 items on each row, you could return either 0 or 1 from this expression: ``` NSInteger rowTes...
This is yucky, subject to breaking if there's a header, but at least this will get you going. In cellForItemAtIndexPath... ``` // dequeue cell CGFloat originY = cell.frame.origin.y; // if there are headers, then grab the header view and... originY -= header.bounds.size.height * indexPath.section; NSInteger row = or...
18,317,405
I know this is fairly easy for UITableViewCells but I'm not sure how to approach this using a UICollectionView. EDIT. Pictures for clarification. Text content of the cells are not the same here but they should be. In landscape: ![](https://i.stack.imgur.com/E4rB6.png) In portrait: ![enter image description here](ht...
2013/08/19
[ "https://Stackoverflow.com/questions/18317405", "https://Stackoverflow.com", "https://Stackoverflow.com/users/142358/" ]
Neither the collection view nor its layout will tell you a “row number” for items. You have to compute it yourself. If all of your measurements are uniform (which is the case if you didn't implement any `UICollectionViewDelegateFlowLayout` methods), you can compute it pretty easily. There are a few places you could d...
I don' think there's any good general way to do this without subclassing the flow layout. For a more specific case, you can use integer math combined with the modulus operator to get "rows" from the indexPath. So, if you had 5 items on each row, you could return either 0 or 1 from this expression: ``` NSInteger rowTes...
18,317,405
I know this is fairly easy for UITableViewCells but I'm not sure how to approach this using a UICollectionView. EDIT. Pictures for clarification. Text content of the cells are not the same here but they should be. In landscape: ![](https://i.stack.imgur.com/E4rB6.png) In portrait: ![enter image description here](ht...
2013/08/19
[ "https://Stackoverflow.com/questions/18317405", "https://Stackoverflow.com", "https://Stackoverflow.com/users/142358/" ]
Neither the collection view nor its layout will tell you a “row number” for items. You have to compute it yourself. If all of your measurements are uniform (which is the case if you didn't implement any `UICollectionViewDelegateFlowLayout` methods), you can compute it pretty easily. There are a few places you could d...
Something like this should do it. May take some tweaking, etc. Assuming that you are not using sections which would have to have some changes.. ----------------------------------------------------------------------------------------------------------------------------------------------- ``` #import <UIKit/UIKit.h> @i...
18,317,405
I know this is fairly easy for UITableViewCells but I'm not sure how to approach this using a UICollectionView. EDIT. Pictures for clarification. Text content of the cells are not the same here but they should be. In landscape: ![](https://i.stack.imgur.com/E4rB6.png) In portrait: ![enter image description here](ht...
2013/08/19
[ "https://Stackoverflow.com/questions/18317405", "https://Stackoverflow.com", "https://Stackoverflow.com/users/142358/" ]
Neither the collection view nor its layout will tell you a “row number” for items. You have to compute it yourself. If all of your measurements are uniform (which is the case if you didn't implement any `UICollectionViewDelegateFlowLayout` methods), you can compute it pretty easily. There are a few places you could d...
This is yucky, subject to breaking if there's a header, but at least this will get you going. In cellForItemAtIndexPath... ``` // dequeue cell CGFloat originY = cell.frame.origin.y; // if there are headers, then grab the header view and... originY -= header.bounds.size.height * indexPath.section; NSInteger row = or...
4,161,399
We've got an app that needs to run in a Java app server. I've got to develop a webapp to go with it. I've started reading about Ruby on Rails, and I really like the approach: MVC, convention over configuration, tons of stuff taken care of for you. I may be dreaming the impossible dream, but are there any Java webapp d...
2010/11/12
[ "https://Stackoverflow.com/questions/4161399", "https://Stackoverflow.com", "https://Stackoverflow.com/users/237815/" ]
Not impossible at all. It's already been done. Here are a few Java-equivalents: * Grails <http://www.grails.org/> * SpringRoo. <http://www.springsource.org/roo> * Spring MVC. <http://www.springsource.org/> All are products of SpringSource. If you're getting serious about Java web development, I highly recommend you ...
Have a good look at the the [Play Framework](http://www.playframework.org/). I think that it's the best way to develop Java web applications at the moment. Certainly the quickest. There is no deploy cycle. Save the code and refresh the browser. It comes with Hibernate and a host of enhanced functionality that streaml...
40,272,328
In my Excel sheet I have a column with dates and times which looks like this: 27.09.2016 14:02:03 I would like to get the difference between each pair of date in seconds. For Example: 10.10.2016 13:00:10 - 10.10.2016 13:00:00 = 10s If I do ``` = A 1- A2 ``` I get 0,000115741 Can anyone please help me?
2016/10/26
[ "https://Stackoverflow.com/questions/40272328", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1837111/" ]
The value is in days (24 hours) not in seconds. 10 seconds are (almost) exactly that fraction of 24 hours that you get as the answer. Multiply it with 60x60x24 and you get your 10 seconds.
Alex. S response is good enough, you can also multiply what you are getting by 86400 (which is the result of 60\*60\*24, you just save some operations) There are other alternatives you can explore. You can take a look to this link:<https://www.ablebits.com/office-addins-blog/2015/06/24/calculate-time-excel/>
14,891,829
I'm using Selenium 2 and I want to click an 'invite' link for Name3. How can I do that? here is the html code: ``` <ul> <li> <label for="511565484"> <img src="pic1">Name1</label> <a class="button_green sendInvite" href="javascript:;" title="Invite">Invite</a> </li> <li> <l...
2013/02/15
[ "https://Stackoverflow.com/questions/14891829", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Seems likely it can only be done with XPath: ``` //label[text()='Name3']/following-sibling::a ```
element2 = driver.findElement(By.xpath("//img[()text='Name3']/a")); element2.click();
14,891,829
I'm using Selenium 2 and I want to click an 'invite' link for Name3. How can I do that? here is the html code: ``` <ul> <li> <label for="511565484"> <img src="pic1">Name1</label> <a class="button_green sendInvite" href="javascript:;" title="Invite">Invite</a> </li> <li> <l...
2013/02/15
[ "https://Stackoverflow.com/questions/14891829", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Seems likely it can only be done with XPath: ``` //label[text()='Name3']/following-sibling::a ```
If XPATH isn't the most usable thing for you, you can always do something like this (Ruby implementation of Webdriver... but it's all the same): ``` invite_links = driver.find_elements(:class_name, "sendInvite") ``` invite\_links now contains an array of all matches, so your next step is pretty easy: ``` invite_lin...
36,391,273
I am trying to upload an HTML form via AJAX (just JS, no jQuery). The form is assembled by my template by adding three components: The csrf token, a ModelForm and a regular Django form (forms.Form). The model form {{ form.as\_p}} comprises the visible parts of the form whereas the form {{ order\_form }} comprises some ...
2016/04/03
[ "https://Stackoverflow.com/questions/36391273", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5640221/" ]
It might be better to not pass the form element to FormData like this: ``` new FormData(document.getElementById(form_ID)) ``` I'm almost sure, it's only supported by firefox. Other browsers do not auto-populate the object. Also where you do: ``` var sendContent = sendCSRFtoken+"&"+formData; ``` Since 'sendCSRFt...
You have 2 problems * You have to use FormData.append to add data to a request that uses Formdata. * FormData objects use the multipart/form-data content type in request(which is set automatically and correctly) ``` ... var url = "/submit_blog_entry/"; formData.append("csrfmiddlewaretoken",getCookie('csrftoken')); ...
36,391,273
I am trying to upload an HTML form via AJAX (just JS, no jQuery). The form is assembled by my template by adding three components: The csrf token, a ModelForm and a regular Django form (forms.Form). The model form {{ form.as\_p}} comprises the visible parts of the form whereas the form {{ order\_form }} comprises some ...
2016/04/03
[ "https://Stackoverflow.com/questions/36391273", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5640221/" ]
Thanks to all of you. I now found the problem, stupid copy&paste. The JS function submitBlogEntryForm() creating the AJAX request was bad. Setting the httpRequest header ``` httpRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); ``` caused contradicting encoding instructions. I just remov...
You have 2 problems * You have to use FormData.append to add data to a request that uses Formdata. * FormData objects use the multipart/form-data content type in request(which is set automatically and correctly) ``` ... var url = "/submit_blog_entry/"; formData.append("csrfmiddlewaretoken",getCookie('csrftoken')); ...
303,779
I am trying to get the Custom Attribute I have in the **sales\_order\_item** to display on the rest/V1/orders/items API call. I was able to get the Attribute to display on the rest/V1/orders API call. Using a **Magento\Sales\Api\OrderRepositoryInterface** plugin. But the Attribute don't display on the rest/V1/orders/it...
2020/02/11
[ "https://magento.stackexchange.com/questions/303779", "https://magento.stackexchange.com", "https://magento.stackexchange.com/users/66186/" ]
You have to make **`your Custom Attribute`** attribute as extension attribute for `Magento\Sales\Api\Data\OrderItemInterface` create `extension_attributes.xml` at your modules `app/code/{Vendorname}/{ModuleName}/etc`. ``` <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNames...
I know it is a little late, but for anyone else looking for a way to get label values of custom attributes, and configurable item values via the rest api. I am presuming you want the custom attribute's label & value label, and not id & value\_id as those do exist in the orders api. There are 3 steps we need to make ...
56,929,689
I have a react app in which i need to push new key values (values can be arrays) to a key in state. ``` this.state = { keyValue: {} } ``` Visualising it will be something like this: `keyValue:{'key1':[value1],'key2':[value2,value3]}` How do i do this in react ?i tried: `const newKeyvalue = Object.keys(state.k...
2019/07/08
[ "https://Stackoverflow.com/questions/56929689", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1081319/" ]
`keyValue` is a dynamic variable? They try the following ``` this.setState({[keyValue]: newKeyvalue}); ```
You can do this by following statement. ```js const obj = {'keyValue':{'key1':[1],'key2':[2, 3]}} const newKeyValue = Object.assign({}, obj.keyValue, {"key3":[6,7], "key2": [...obj.keyValue.key2, 8]}) console.log(newKeyValue); ```
56,929,689
I have a react app in which i need to push new key values (values can be arrays) to a key in state. ``` this.state = { keyValue: {} } ``` Visualising it will be something like this: `keyValue:{'key1':[value1],'key2':[value2,value3]}` How do i do this in react ?i tried: `const newKeyvalue = Object.keys(state.k...
2019/07/08
[ "https://Stackoverflow.com/questions/56929689", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1081319/" ]
I'm using like this ``` obj = [] obj.push({ value: i, label:data[i].api_keys_id }) ``` result: ``` [ { value: 1, label: 154 }, { value: 2, label: 545 } ] ``` if you want to key name dynamic you can wrap with [] and then set ``` obj = [] myKeyName="value" obj.push({ [myKeyName]: i, label:data[i].api_keys_id }...
You can do this by following statement. ```js const obj = {'keyValue':{'key1':[1],'key2':[2, 3]}} const newKeyValue = Object.assign({}, obj.keyValue, {"key3":[6,7], "key2": [...obj.keyValue.key2, 8]}) console.log(newKeyValue); ```
56,929,689
I have a react app in which i need to push new key values (values can be arrays) to a key in state. ``` this.state = { keyValue: {} } ``` Visualising it will be something like this: `keyValue:{'key1':[value1],'key2':[value2,value3]}` How do i do this in react ?i tried: `const newKeyvalue = Object.keys(state.k...
2019/07/08
[ "https://Stackoverflow.com/questions/56929689", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1081319/" ]
Here is an example on how to dynamically add new **key-value** pairs to the object in your state. See sandbox: <https://codesandbox.io/s/create-arrays-of-n-length-and-editable-d9b3h> Additionally, I've provided a way for you to modify an existing **key-value** pair to update its own array. You can change up the new-v...
You can do this by following statement. ```js const obj = {'keyValue':{'key1':[1],'key2':[2, 3]}} const newKeyValue = Object.assign({}, obj.keyValue, {"key3":[6,7], "key2": [...obj.keyValue.key2, 8]}) console.log(newKeyValue); ```
56,929,689
I have a react app in which i need to push new key values (values can be arrays) to a key in state. ``` this.state = { keyValue: {} } ``` Visualising it will be something like this: `keyValue:{'key1':[value1],'key2':[value2,value3]}` How do i do this in react ?i tried: `const newKeyvalue = Object.keys(state.k...
2019/07/08
[ "https://Stackoverflow.com/questions/56929689", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1081319/" ]
`keyValue` is a dynamic variable? They try the following ``` this.setState({[keyValue]: newKeyvalue}); ```
I'm using like this ``` obj = [] obj.push({ value: i, label:data[i].api_keys_id }) ``` result: ``` [ { value: 1, label: 154 }, { value: 2, label: 545 } ] ``` if you want to key name dynamic you can wrap with [] and then set ``` obj = [] myKeyName="value" obj.push({ [myKeyName]: i, label:data[i].api_keys_id }...
56,929,689
I have a react app in which i need to push new key values (values can be arrays) to a key in state. ``` this.state = { keyValue: {} } ``` Visualising it will be something like this: `keyValue:{'key1':[value1],'key2':[value2,value3]}` How do i do this in react ?i tried: `const newKeyvalue = Object.keys(state.k...
2019/07/08
[ "https://Stackoverflow.com/questions/56929689", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1081319/" ]
Here is an example on how to dynamically add new **key-value** pairs to the object in your state. See sandbox: <https://codesandbox.io/s/create-arrays-of-n-length-and-editable-d9b3h> Additionally, I've provided a way for you to modify an existing **key-value** pair to update its own array. You can change up the new-v...
`keyValue` is a dynamic variable? They try the following ``` this.setState({[keyValue]: newKeyvalue}); ```
56,929,689
I have a react app in which i need to push new key values (values can be arrays) to a key in state. ``` this.state = { keyValue: {} } ``` Visualising it will be something like this: `keyValue:{'key1':[value1],'key2':[value2,value3]}` How do i do this in react ?i tried: `const newKeyvalue = Object.keys(state.k...
2019/07/08
[ "https://Stackoverflow.com/questions/56929689", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1081319/" ]
Here is an example on how to dynamically add new **key-value** pairs to the object in your state. See sandbox: <https://codesandbox.io/s/create-arrays-of-n-length-and-editable-d9b3h> Additionally, I've provided a way for you to modify an existing **key-value** pair to update its own array. You can change up the new-v...
I'm using like this ``` obj = [] obj.push({ value: i, label:data[i].api_keys_id }) ``` result: ``` [ { value: 1, label: 154 }, { value: 2, label: 545 } ] ``` if you want to key name dynamic you can wrap with [] and then set ``` obj = [] myKeyName="value" obj.push({ [myKeyName]: i, label:data[i].api_keys_id }...
281,433
I try to find the [generating function](http://en.wikipedia.org/wiki/Generating_function) of $(1 + x + x^{10})^{20}$. My main problem is that all the forumalas I know, based on sequence (meaning, $1 + x + x^2 + x^3+\dots$ and so on), and I don't success to convert it to any sequence.
2013/01/18
[ "https://math.stackexchange.com/questions/281433", "https://math.stackexchange.com", "https://math.stackexchange.com/users/19657/" ]
$$(1 + x + x^{10})^{20}=((1+(x+x^{10}))^{20}=\sum\_{k=0}^{20}\binom{20}{k}(x+x^{10})^k=$$ $$=\sum\_{k=0}^{20}\binom{20}{k}x^k(1+x^{9})^k=\sum\_{k=0}^{20}\binom{20}{k}x^k\sum\_{j=0}^{k}\binom{k}{j}x^{9j}=\sum\_{k=0}^{20}\sum\_{j=0}^{k}\binom{20}{k}\binom{k}{j}x^{k+9j}$$ let $0\leq k+9j=t\leq200\Rightarrow j=\frac{t-k}{9...
The sequence for which $(1+x+x^{10})^{20}$ is the generating function, is $1, 20, 190, 1140, 4845, 15504, 38760, 77520, 125970, 167960, 184776, 168340, 129390, 96900, 116280, 248064, 547485, 1008900, 1511830, 1847580, 1847751, 1515060, 1036830, 697680, 813960, 1705440, 3546540, 6049980, 8314400, 9237820, 8315160, 60659...
5,810,970
I have a QImage that I built from a pixmap something like the following: ``` QPixmap fullPmap = topItem->pixmap(); fullPmap = fullPmap.copy(isec.toRect()); QImage chip = fullPmap.toImage(); ``` This is basically intersecting with a rectangle on screen to crop the image to a chipped size. I now need to get the chara...
2011/04/27
[ "https://Stackoverflow.com/questions/5810970", "https://Stackoverflow.com", "https://Stackoverflow.com/users/229072/" ]
When dealing with raw image data, you need to be aware of some basic issues: * What is the format or layout of pixel data. The QImage converted from QPixmap is not necessarily always in RGB888 or RGB32. Call QImage::format() and deal with different layout differently. Especially with RGB32 family, you need to make sur...
This worked for me: ``` m_image = new QImage(IMAGE_WIDTH,IMAGE_HEIGHT, QImage::Format_RGB32); m_image->fill(Qt::white); int rawDataCount = 0; for (int y = 0;y<IMAGE_HEIGHT;y++) { uint* line = (uint*)m_image->scanLine(y); for (int x=0;x<IMAGE_WIDTH;x++) { WORD temp = cameraZero[rawDataCount++]; ...
28,061,316
I am trying to select data from a date range using `BETWEEN` in the where clause,But it does not return the correct result.The date field is in the format `'mm/dd/YYYY'` and the type is `varchar` My query, ``` select * from time_track where track_date between '01/01/2015' and '01/21/2015' ``` But the result contain ...
2015/01/21
[ "https://Stackoverflow.com/questions/28061316", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3710370/" ]
You need to convert the date string to a real date ``` select * from time_track where STR_TO_DATE(track_date ,'%d/%m/%Y') between '2015-01-01' and '2015-01-21' ``` ### Or even better use the date data type for that column. Then you don't need to convert the data in your queries and can make use of indexes which ma...
Try on this formate select \* from time\_track where track\_date >= '2015-01-01 00:00:00' AND track\_date <= '2015-01-01 00:00:00'
28,061,316
I am trying to select data from a date range using `BETWEEN` in the where clause,But it does not return the correct result.The date field is in the format `'mm/dd/YYYY'` and the type is `varchar` My query, ``` select * from time_track where track_date between '01/01/2015' and '01/21/2015' ``` But the result contain ...
2015/01/21
[ "https://Stackoverflow.com/questions/28061316", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3710370/" ]
You need to convert the date string to a real date ``` select * from time_track where STR_TO_DATE(track_date ,'%d/%m/%Y') between '2015-01-01' and '2015-01-21' ``` ### Or even better use the date data type for that column. Then you don't need to convert the data in your queries and can make use of indexes which ma...
I got the answer. ``` SELECT * FROM `time_track` where DATE_FORMAT(STR_TO_DATE(track_date, '%c/%d/%Y'), '%Y-%m-%d') between '2015-01-01' and '2015-01-21' ```
28,061,316
I am trying to select data from a date range using `BETWEEN` in the where clause,But it does not return the correct result.The date field is in the format `'mm/dd/YYYY'` and the type is `varchar` My query, ``` select * from time_track where track_date between '01/01/2015' and '01/21/2015' ``` But the result contain ...
2015/01/21
[ "https://Stackoverflow.com/questions/28061316", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3710370/" ]
You need to convert the date string to a real date ``` select * from time_track where STR_TO_DATE(track_date ,'%d/%m/%Y') between '2015-01-01' and '2015-01-21' ``` ### Or even better use the date data type for that column. Then you don't need to convert the data in your queries and can make use of indexes which ma...
First convert two dates you have selected ``` $from=strtotime(date("Y-m-d H:i:s", strtotime($yourfromdate))) $to=strtotime(date("Y-m-d H:i:s", strtotime($yourtodate))) select * from time_track where track_date>='$from' and track_date<='$to' ```
28,061,316
I am trying to select data from a date range using `BETWEEN` in the where clause,But it does not return the correct result.The date field is in the format `'mm/dd/YYYY'` and the type is `varchar` My query, ``` select * from time_track where track_date between '01/01/2015' and '01/21/2015' ``` But the result contain ...
2015/01/21
[ "https://Stackoverflow.com/questions/28061316", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3710370/" ]
You need to convert the date string to a real date ``` select * from time_track where STR_TO_DATE(track_date ,'%d/%m/%Y') between '2015-01-01' and '2015-01-21' ``` ### Or even better use the date data type for that column. Then you don't need to convert the data in your queries and can make use of indexes which ma...
the format of your date is incorrect. You must use this format in your query: yyyy-mm-dd. select \* from time\_track where track\_date between '2015-01-01' and '2015-01-21' Marco
28,061,316
I am trying to select data from a date range using `BETWEEN` in the where clause,But it does not return the correct result.The date field is in the format `'mm/dd/YYYY'` and the type is `varchar` My query, ``` select * from time_track where track_date between '01/01/2015' and '01/21/2015' ``` But the result contain ...
2015/01/21
[ "https://Stackoverflow.com/questions/28061316", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3710370/" ]
You need to convert the date string to a real date ``` select * from time_track where STR_TO_DATE(track_date ,'%d/%m/%Y') between '2015-01-01' and '2015-01-21' ``` ### Or even better use the date data type for that column. Then you don't need to convert the data in your queries and can make use of indexes which ma...
For mysql between clause to work expectedly, ideal values would be integer, date, time or datetime. Try changing the datatype from varchar to datetime. That would do your comparison job.