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
17,027,275
I'm having a bit of trouble sending my data to my controller through the ajax request I'm using. Currently in my view, I have ``` <p>Please enter your email and phone number registered with the account</p> <table id="Table"> <tr> <td>Email</td> <td> <input id = "email" type ="text" name= "em...
2013/06/10
[ "https://Stackoverflow.com/questions/17027275", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2094139/" ]
The solution is: ``` $m = new Mongo(); $collection = $m->selectDB('production')->selectCollection("centers"); $array = array('_id' => new MongoId('516d3ae30074d35600000001')); $project = array( 'locations' => array( '$elemMatch' => array('id' => new MongoId('51b595eabe55b59630000000')) ) ); ...
Based on the documentation in his repo, does this not work for you: ``` $this->mongo_db ->where(array( '_id' => ObjectId('516d3ae30074d35600000001'), 'locations' => array( '$elemMatch' => array( "id" : ObjectId("51b595eabe55b59630000000") ) ) )) ->get('centers'); ``` **edit**: I had originally copied this ba...
8,226,782
I was wondering if it is possible to extract the facebook account assigned to the windows phone, I would like to have access to the user name, picture and friends name, pictures (which are stored in the People of WP7). This would be done in C#. Thanks
2011/11/22
[ "https://Stackoverflow.com/questions/8226782", "https://Stackoverflow.com", "https://Stackoverflow.com/users/912212/" ]
You can get the name and photo of friends if the user has logged into their facebook account. You just can't get the account name and picture of the facebook login. See <http://msdn.microsoft.com/en-us/library/hh202972(v=vs.92).aspx>
There is no way to access this information unfortunately.
2,724,705
``` +-------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------+-------------+------+-----+---------+-------+ | pid | varchar(99) | YES | | NULL | | +-------+-------------+------+-----+---------+-------+ 1 row in set (0.00 sec) +-------+-------...
2010/04/27
[ "https://Stackoverflow.com/questions/2724705", "https://Stackoverflow.com", "https://Stackoverflow.com/users/179736/" ]
Yes, with every exception check-box is un-checked it breaks on only these Invoke exceptions. All the other exceptions work fine. The great news is that an anonymous genius gave me a work-around: ``` delegate void VoidTest(); VoidTest test = (VoidTest)Delegate.CreateDelegate(typeof(VoidTest), o, method.Name); ...
Are you sure that "Break on first-chance exceptions" is disabled? Go to Debug -> Exceptions and make sure everything is turned off.
23,669,615
I have a button that is meant to swap from one activity to another which use to work but ever since i added the coding for another button to call for zxing's scanning feature the button no longer does anything at all. This is my MainActivity.java for those who are willing to help ``` package com.example.mdpmk1; ...
2014/05/15
[ "https://Stackoverflow.com/questions/23669615", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3491977/" ]
I also suffered from the same situation. And after that, I use the older version of "list-item" and "gallery". This has **worked well.** `Ex: v2.4.6`
Is the theme options page being included? You'll need to reference it in your functions.php, something to the effect of: ``` require_once locate_template('/path-to-your/theme-options.php' ); ```
42,446,638
Here is a first attempt at iterator of a doubly linked list: `dlist.h` ``` #ifndef dlist_h #define dlist_h /* Node */ template <class Elem> struct Link { Link(); Link (Link<Elem>* s, Link<Elem>* p, const Elem& v); Link (const Link<Elem>& src); Link<Elem>& operator= (const Link<Elem>& src); bool...
2017/02/24
[ "https://Stackoverflow.com/questions/42446638", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3313438/" ]
The problem is your `push_front` method, you forgot to link `first->succ->prev` back to new node, hence your doubly linked list is basically a singly linked list The first `i--` succeed because `last` points to a default node, but `curr->prev` is a nullptr since you forgot to link back, so the next `i--` will deref th...
Your constructor for `Link` does not properly update the elements given as arguments. Inserting an element between two elements breaks the previous link. This is a more appropriate constructor : ``` template <class Elem> Link<Elem>::Link(Link<Elem>* s, const Elem& v) : succ(s), prev(s->prev), val(v) { // Upda...
3,763,008
[This question](https://i.stack.imgur.com/YY664.jpg) recently popped up on one of my tests and I still have no idea on how to even begin. I tried assuming $\sin(x+2A)+\sin(A)=t^2$ which did not help at all. Then I went on to multiply and divide by $\tan x$ to create a derivative on the numerator, still does not help....
2020/07/20
[ "https://math.stackexchange.com/questions/3763008", "https://math.stackexchange.com", "https://math.stackexchange.com/users/756034/" ]
*Not elementary at all* $$I=\int \frac{\sec (x)}{\sqrt{\sin(x+2a)+\sin(a)}}\,dx$$ $$\sin(x+2a)+\sin(a)=\sin (a)+\sin (2 a) \cos (x)+\cos (2 a) \sin (x)$$ Using the tangent half-angle substitution $x=2 \tan^{-1}(t)$ $$\sin(x+2a)+\sin(a)=\frac{(\sin (a)+\sin (2 a))+2 t \cos (2 a)+t^2 (\sin (a)-\sin (2 a))}{1+t^2}$$ $$(\...
Let $$A=\dfrac\pi2-2b,\quad x=4b-\dfrac\pi2-y,\tag1$$ then $$I=\int\dfrac{\text dy}{\cos(y-4b)\sqrt{\cos y+\cos2b}} =\int\dfrac{\text dy}{(\cos4b\cos y+\sin4b\sin y)\sqrt{\cos y+\cos2b}}$$ $$=\int\dfrac{(\cos4b\cos y-\sin4b\sin y)\,\text dy}{(\cos^2 4b\cos^2 y-\sin^2 4b\sin^2y)\sqrt{\cos y+\cos2b}}=I\_1\cos4b-I\_2\sin4...
78,516
So in the last couple of weeks I've had some issues with the Linux Libertine font and package, both don't seem to work anymore on a completely up-to-date version of MacTeX (which is equivalent to TeX Live 2012). The issues don't appear on a Ubuntu 12.04 box which is running TeX Live 2009; I work on both computers regul...
2012/10/21
[ "https://tex.stackexchange.com/questions/78516", "https://tex.stackexchange.com", "https://tex.stackexchange.com/users/17484/" ]
The Linux Libertine fonts recently switched from `libertine-legacy` to `libertine-type1` in TeX Live. This resulted in many documents not working any more, especially with old-style-figures. Libertine Package ================= Old-style-figures are default in the latest version, so just use: `\usepackage{libertine...
I preffered to install the package `libertine-legacy` into a local TDS-directory. As I use texlive, I installed the package from CTAN into TEXMFHOME, following the advice here: <http://www.tug.org/pipermail/tex-live/2012-October/032462.html>. This is not as trivial as it seems. I had to enable the Map libertine.map v...
78,516
So in the last couple of weeks I've had some issues with the Linux Libertine font and package, both don't seem to work anymore on a completely up-to-date version of MacTeX (which is equivalent to TeX Live 2012). The issues don't appear on a Ubuntu 12.04 box which is running TeX Live 2009; I work on both computers regul...
2012/10/21
[ "https://tex.stackexchange.com/questions/78516", "https://tex.stackexchange.com", "https://tex.stackexchange.com/users/17484/" ]
The Linux Libertine fonts recently switched from `libertine-legacy` to `libertine-type1` in TeX Live. This resulted in many documents not working any more, especially with old-style-figures. Libertine Package ================= Old-style-figures are default in the latest version, so just use: `\usepackage{libertine...
As long as you download and unzip the package <http://www.ctan.org/tex-archive/fonts/libertine> to your local tree, followed by `tlmgr update --all` , run `mktexlsr` or `texhash` and `updmap-sys enable Map libertine.map` , the package must work. As of May 2013 Texlive is frozen, so the above works like a charm.
78,516
So in the last couple of weeks I've had some issues with the Linux Libertine font and package, both don't seem to work anymore on a completely up-to-date version of MacTeX (which is equivalent to TeX Live 2012). The issues don't appear on a Ubuntu 12.04 box which is running TeX Live 2009; I work on both computers regul...
2012/10/21
[ "https://tex.stackexchange.com/questions/78516", "https://tex.stackexchange.com", "https://tex.stackexchange.com/users/17484/" ]
I preffered to install the package `libertine-legacy` into a local TDS-directory. As I use texlive, I installed the package from CTAN into TEXMFHOME, following the advice here: <http://www.tug.org/pipermail/tex-live/2012-October/032462.html>. This is not as trivial as it seems. I had to enable the Map libertine.map v...
As long as you download and unzip the package <http://www.ctan.org/tex-archive/fonts/libertine> to your local tree, followed by `tlmgr update --all` , run `mktexlsr` or `texhash` and `updmap-sys enable Map libertine.map` , the package must work. As of May 2013 Texlive is frozen, so the above works like a charm.
21,630,406
I have a function in my real-world problem that returns a list. Is there any way to use this with the dplyr mutate()? This toy example doesn't work -: ``` it = data.table(c("a","a","b","b","c"),c(1,2,3,4,5), c(2,3,4,2,2)) myfun = function(arg1,arg2) { temp1 = arg1 + arg2 temp2 = arg1 - arg2 list(temp1,temp2) } myf...
2014/02/07
[ "https://Stackoverflow.com/questions/21630406", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2006864/" ]
The idiomatic way to do this using `data.table` would be to use the `:=` (assignment by reference) operator. Here's an illustration: ``` it[, c(paste0("V", 4:5)) := myfun(V2, V3)] ``` --- If you really want a list, why not: ``` as.list(it[, myfun(V2, V3)]) ``` Alternatively, maybe this is what you want, but why ...
The mutate() function is designed to add new columns to the existing data frame. A data frame is a list of vectors of the same length. Thus, you cant add a list as a new column, because a list is not a vector. You can rewrite your function as two functions, each of which return a vector. Then apply each of these separ...
21,630,406
I have a function in my real-world problem that returns a list. Is there any way to use this with the dplyr mutate()? This toy example doesn't work -: ``` it = data.table(c("a","a","b","b","c"),c(1,2,3,4,5), c(2,3,4,2,2)) myfun = function(arg1,arg2) { temp1 = arg1 + arg2 temp2 = arg1 - arg2 list(temp1,temp2) } myf...
2014/02/07
[ "https://Stackoverflow.com/questions/21630406", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2006864/" ]
Given the title to this question, I thought I'd post a `tidyverse` solution that uses `dplyr::mutate`. Note that `myfun` needs to output a `data.frame` to work. ```r library(tidyverse) it = data.frame( v1 = c("a","a","b","b","c"), v2 = c(1,2,3,4,5), v3 = c(2,3,4,2,2)) myfun = function(arg1,arg2) { temp1 ...
The mutate() function is designed to add new columns to the existing data frame. A data frame is a list of vectors of the same length. Thus, you cant add a list as a new column, because a list is not a vector. You can rewrite your function as two functions, each of which return a vector. Then apply each of these separ...
21,630,406
I have a function in my real-world problem that returns a list. Is there any way to use this with the dplyr mutate()? This toy example doesn't work -: ``` it = data.table(c("a","a","b","b","c"),c(1,2,3,4,5), c(2,3,4,2,2)) myfun = function(arg1,arg2) { temp1 = arg1 + arg2 temp2 = arg1 - arg2 list(temp1,temp2) } myf...
2014/02/07
[ "https://Stackoverflow.com/questions/21630406", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2006864/" ]
The idiomatic way to do this using `data.table` would be to use the `:=` (assignment by reference) operator. Here's an illustration: ``` it[, c(paste0("V", 4:5)) := myfun(V2, V3)] ``` --- If you really want a list, why not: ``` as.list(it[, myfun(V2, V3)]) ``` Alternatively, maybe this is what you want, but why ...
Given the title to this question, I thought I'd post a `tidyverse` solution that uses `dplyr::mutate`. Note that `myfun` needs to output a `data.frame` to work. ```r library(tidyverse) it = data.frame( v1 = c("a","a","b","b","c"), v2 = c(1,2,3,4,5), v3 = c(2,3,4,2,2)) myfun = function(arg1,arg2) { temp1 ...
40,814,827
As far as I can tell I've followed the advice given by other users, but I still get a segfault when I try to return a pointer to an array. The printf in main returns nothing, so I'm guessing that the pointer isn't to anything on the heap? ``` #include <stdio.h> #include <stdlib.h> int * stringy(int length){ int *p...
2016/11/26
[ "https://Stackoverflow.com/questions/40814827", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4339674/" ]
It seems like there is a typo in your code. Instead of ``` for(i = 0; 1 < length; i++){ ``` , it looks like you meant ``` for(i = 0; i < length; i++){ ```
You need to check for null pointers; `malloc` returns `NULL` when it can't allocate the memory you requested, and that would cause the problem you're referring to. Also, you should cast your pointer to `int *`. The actual problem, however, is that you have a typo; rather than `1 < length`, your for loop condition shou...
17,969,604
I'm new to Python and I am currently doing some work with IF statements. This is what I have so far... ``` print("Hello") myName = input("What is your name?") print("Hello " +myName) myAge = int(input("How old are you?")) if myAge <=18: myResponse = input("You must still be at school?") if myResponse == "Yes" ...
2013/07/31
[ "https://Stackoverflow.com/questions/17969604", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2633836/" ]
This condition checks that myRespone is either `yes` or `"y"` and is case insensitive (meaning that `yes`, `YeS`, and others are all valid) ``` myResponse.lower() in ["yes","y"] ```
With string functions: ``` if myResponse.upper() == 'NO': # do something ``` Or: ``` if myResponse.lower() == 'no': #do something ```
17,969,604
I'm new to Python and I am currently doing some work with IF statements. This is what I have so far... ``` print("Hello") myName = input("What is your name?") print("Hello " +myName) myAge = int(input("How old are you?")) if myAge <=18: myResponse = input("You must still be at school?") if myResponse == "Yes" ...
2013/07/31
[ "https://Stackoverflow.com/questions/17969604", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2633836/" ]
This condition checks that myRespone is either `yes` or `"y"` and is case insensitive (meaning that `yes`, `YeS`, and others are all valid) ``` myResponse.lower() in ["yes","y"] ```
Try this: ``` if myResonse.lower() == "yes": etc ```
17,969,604
I'm new to Python and I am currently doing some work with IF statements. This is what I have so far... ``` print("Hello") myName = input("What is your name?") print("Hello " +myName) myAge = int(input("How old are you?")) if myAge <=18: myResponse = input("You must still be at school?") if myResponse == "Yes" ...
2013/07/31
[ "https://Stackoverflow.com/questions/17969604", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2633836/" ]
This condition checks that myRespone is either `yes` or `"y"` and is case insensitive (meaning that `yes`, `YeS`, and others are all valid) ``` myResponse.lower() in ["yes","y"] ```
The question asks specifically for answers in the form "yes" or "no" with different capitalizations ("y" or "n" are not mentioned). With that in mind, we can do as follows, being careful to remove any extra spaces: ``` if myresponse.strip().lower() == "yes": # if yes, do something ``` And similarly: ``` if myre...
17,969,604
I'm new to Python and I am currently doing some work with IF statements. This is what I have so far... ``` print("Hello") myName = input("What is your name?") print("Hello " +myName) myAge = int(input("How old are you?")) if myAge <=18: myResponse = input("You must still be at school?") if myResponse == "Yes" ...
2013/07/31
[ "https://Stackoverflow.com/questions/17969604", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2633836/" ]
Try this: ``` if myResonse.lower() == "yes": etc ```
With string functions: ``` if myResponse.upper() == 'NO': # do something ``` Or: ``` if myResponse.lower() == 'no': #do something ```
17,969,604
I'm new to Python and I am currently doing some work with IF statements. This is what I have so far... ``` print("Hello") myName = input("What is your name?") print("Hello " +myName) myAge = int(input("How old are you?")) if myAge <=18: myResponse = input("You must still be at school?") if myResponse == "Yes" ...
2013/07/31
[ "https://Stackoverflow.com/questions/17969604", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2633836/" ]
The question asks specifically for answers in the form "yes" or "no" with different capitalizations ("y" or "n" are not mentioned). With that in mind, we can do as follows, being careful to remove any extra spaces: ``` if myresponse.strip().lower() == "yes": # if yes, do something ``` And similarly: ``` if myre...
With string functions: ``` if myResponse.upper() == 'NO': # do something ``` Or: ``` if myResponse.lower() == 'no': #do something ```
32,842,481
I have generate a 16 digit number and i want to extract one number from every 4 digits of that 16 digit number. For e.g: 1234567892345678. I want to extract 2 from 1234, 7 from 5678, 3 from 9034 & 7 from 5678. Then store it in another variable $a. the extraction will be in a random manner.
2015/09/29
[ "https://Stackoverflow.com/questions/32842481", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5281549/" ]
You can try this - ``` $d = '1234567892345678'; $s = str_split($d, 4); // split in 4 digits $n = array_map(function($x) { return substr($x, rand(0, 3), rand(1, 1)); // extract single digit random number }, $s); ``` `$n` will hold the random numbers.
Here you have a one-liner: ``` $s = $string[rand(0,3)].$string[rand(4,7)].$string[rand(8,11)].$string[rand(12,15)]; echo $s; ``` Another one-liner: ``` for($s='',$i=0;$i<10; $s.=$string[rand($i,$i+=3)]); echo $s; ```
32,842,481
I have generate a 16 digit number and i want to extract one number from every 4 digits of that 16 digit number. For e.g: 1234567892345678. I want to extract 2 from 1234, 7 from 5678, 3 from 9034 & 7 from 5678. Then store it in another variable $a. the extraction will be in a random manner.
2015/09/29
[ "https://Stackoverflow.com/questions/32842481", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5281549/" ]
I might be late at answering this question but you can simply use `strlen` function along with `for` loop like as ``` $str = "1234567892345678"; for($i = 0; $i < strlen($str);$i += 4){ echo $str[$i+rand(0,3)]; } ```
Here you have a one-liner: ``` $s = $string[rand(0,3)].$string[rand(4,7)].$string[rand(8,11)].$string[rand(12,15)]; echo $s; ``` Another one-liner: ``` for($s='',$i=0;$i<10; $s.=$string[rand($i,$i+=3)]); echo $s; ```
32,842,481
I have generate a 16 digit number and i want to extract one number from every 4 digits of that 16 digit number. For e.g: 1234567892345678. I want to extract 2 from 1234, 7 from 5678, 3 from 9034 & 7 from 5678. Then store it in another variable $a. the extraction will be in a random manner.
2015/09/29
[ "https://Stackoverflow.com/questions/32842481", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5281549/" ]
You can try this - ``` $d = '1234567892345678'; $s = str_split($d, 4); // split in 4 digits $n = array_map(function($x) { return substr($x, rand(0, 3), rand(1, 1)); // extract single digit random number }, $s); ``` `$n` will hold the random numbers.
I might be late at answering this question but you can simply use `strlen` function along with `for` loop like as ``` $str = "1234567892345678"; for($i = 0; $i < strlen($str);$i += 4){ echo $str[$i+rand(0,3)]; } ```
727,444
Why a simple theory of lift like the one described below, is not accepted? If you don’t agree with the following, please just skip this question and do not delete or downvote it, because it is a legitimate, scientifically sound explanation of lift. Common sense theory of wing lift fundamentals: Assume an airpl...
2022/09/13
[ "https://physics.stackexchange.com/questions/727444", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/344842/" ]
Pressure is the result of momentum exchange between gas particles and a surface. Even in a gas which has no bulk velocity vector, each particle travels in a straight line until it collides with either a surface or another particles. When a particle collides with anything it can’t continue on its original trajectory the...
The main problem with that explanation is that it makes conflates lift with profile drag. Lift is a different phenomena and the "lift" in your explanation is less like actual lift and more like the upwards component of profile drag. The explanation contains just enough specifics to be wrong, or at least miss the primar...
727,444
Why a simple theory of lift like the one described below, is not accepted? If you don’t agree with the following, please just skip this question and do not delete or downvote it, because it is a legitimate, scientifically sound explanation of lift. Common sense theory of wing lift fundamentals: Assume an airpl...
2022/09/13
[ "https://physics.stackexchange.com/questions/727444", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/344842/" ]
Pressure is the result of momentum exchange between gas particles and a surface. Even in a gas which has no bulk velocity vector, each particle travels in a straight line until it collides with either a surface or another particles. When a particle collides with anything it can’t continue on its original trajectory the...
The theory of wings pushing air is highly unsatisfactory if you know that the main contribution to the lift comes from suction at the leading edge and on the upper side of the aerodynamic surface. Even 2D-airfoil generates lift without any need for "air replacement". Try to have a look to the relation between **press...
302,367
If you look at the Terminal->Preferences->Settings->Keyboard pane it displays how some keyboard keys and combinations map to shell strings. The list seems really strange to me as it's missing a lot of combinations like Shift+F1 and it maps option+F1 and F6 to the same code. Also the codes shown look like ANSI escape ...
2011/06/26
[ "https://superuser.com/questions/302367", "https://superuser.com", "https://superuser.com/users/45919/" ]
The mappings are different because Mac OS X is not a DOS, for which the web site you linked to was apparently written. The specific mappings were inherited from previous Unix/Linux terminal emulators, as is reflected in your options for what kind of terminal emulator Terminal.app you wish to appear: ![enter image desc...
This is tricky, it's 2015 and there is still no simple answer for `Shift-F2`, which I need for Byobu on the remote Linux box. I wrote this config for a Max OS X *Terminal.app*, which you can import, which enables `F1`-`F10` combinations with `Shift`, `Ctrl` and `Alt`. <https://github.com/timothybasanov/terminal-app-f...
16,793
Does anyone how banks determine the spread over LIBOR on a Equity Swap? Example: Party A pays the return on SPTR to Party B Party B pays 1M LIBOR + 40 bps to Party A Does anyone know how the 40 bps spread would be determined? Thank you!
2015/02/27
[ "https://quant.stackexchange.com/questions/16793", "https://quant.stackexchange.com", "https://quant.stackexchange.com/users/15500/" ]
I realize the previous answer doesn't answer anything, yes the spread over LIBOR on the swap is such that the swap has 0 value at inception, but how do you compute the value of the equity leg ? The spread on an equity swap depends on the level at which you can repo the underlying equity if you replicate the swap throu...
Unless the counterparty specifically bought the swap, then at inception the swap had a 0 value, i.e. the spread is that value which equates the two legs. Of course, it's usually bumped up (bank receiving) or down (bank paying) as the trader's profit.
16,793
Does anyone how banks determine the spread over LIBOR on a Equity Swap? Example: Party A pays the return on SPTR to Party B Party B pays 1M LIBOR + 40 bps to Party A Does anyone know how the 40 bps spread would be determined? Thank you!
2015/02/27
[ "https://quant.stackexchange.com/questions/16793", "https://quant.stackexchange.com", "https://quant.stackexchange.com/users/15500/" ]
I realize the previous answer doesn't answer anything, yes the spread over LIBOR on the swap is such that the swap has 0 value at inception, but how do you compute the value of the equity leg ? The spread on an equity swap depends on the level at which you can repo the underlying equity if you replicate the swap throu...
The spread is determined by how much the notional value of the swap is collateralized. If the swap is 0% collateralized, your rate can be as high as L+600. If it's fully collateralized, as low as L+50. If you keep 10% of the notional amount as pledged collateral, then any single day loss over 10% in SPTR would requir...
8,286,834
How do you tackle this problem when you are dealing with legacy code * Classes you deal with is not well designed, requires some serious design changes * Classes you deal with mostly tightly coupled * You don't have enough unit tests to do refactoring much * You don't add new unit tests because design is bad and you ...
2011/11/27
[ "https://Stackoverflow.com/questions/8286834", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40322/" ]
A Chicken and Egg problem. If it's not possible to write some decent unit tests because of thight coupling, a better approach might be to **work from the top down**. If you don't already have Integration, System and or GUI tests, this would be a good reason to create them **before** you start creating unit tests. O...
You first want to make sure you don't change the behaviour of the code. If you write unit tests which assert the way that the code currently behaves then you can make changes to the code and check that the tests still pass, if they do then the code behaviour hasn't changed. You can then refactor the code however you li...
106,841
**Screenshot** [![enter image description here](https://i.stack.imgur.com/NT0Ny.jpg)](https://i.stack.imgur.com/NT0Ny.jpg) **Trigger:** ``` trigger Triggertovalidate on GEN_Parameter__c (BEFORE INSERT,BEFORE UPDATE) { LIST<GEN_Parameter__c> li = [select id,Country__c from GEN_Parameter__c where id != null]; ...
2016/01/27
[ "https://salesforce.stackexchange.com/questions/106841", "https://salesforce.stackexchange.com", "https://salesforce.stackexchange.com/users/27143/" ]
@Salesforcesmarty 's answer is almost correct. You simply need to change the condition line into: ``` if(trigger.isInsert || (trigger.isUpdate && existrecord.Id != c.Id)) ``` And this will work for you.
Your code will throw error, even though you are not updating any country field on update. Update your code with this: ``` trigger Triggertovalidate on GEN_Parameter__c (BEFORE INSERT,BEFORE UPDATE) { Set<String> countries = new Set<String>(); for(GEN_Parameter__c country : [select id,Country__c from GEN_Param...
34,663,461
Relavent page here: <http://marcmurray.net/test_sites/cans/#> Basically I have added an svg image into my navbar into the navbar-brand class, but it has pushed all of my navigation down and outside of itself, can anyone see what it is I am doing wrong? ``` <nav class="navbar navbar-inverse navbar-static-top" role="na...
2016/01/07
[ "https://Stackoverflow.com/questions/34663461", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2877138/" ]
``` <img src="img/logo.svg"></a></div> ``` You have a missing div closure there
You missing `navbar-header` closing `</div>` after logo: ``` <div class="navbar-header"> ... <a href="#" class="navbar-brand pull-left"><img src="img/logo.svg"></a> </div> - add this ```
34,663,461
Relavent page here: <http://marcmurray.net/test_sites/cans/#> Basically I have added an svg image into my navbar into the navbar-brand class, but it has pushed all of my navigation down and outside of itself, can anyone see what it is I am doing wrong? ``` <nav class="navbar navbar-inverse navbar-static-top" role="na...
2016/01/07
[ "https://Stackoverflow.com/questions/34663461", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2877138/" ]
``` <img src="img/logo.svg"></a></div> ``` You have a missing div closure there
Three opened divs but two closed divs. Check it!
3,196,504
Suppose I have a class named foo, and it has 3 public members foo1, foo2, and foo3. Now suppose I'm writing a function that takes an instance of class foo as a parameter, but when I'm writing this function I have no idea what public members it has. Is there a way for me to determine at run-time that it has public mem...
2010/07/07
[ "https://Stackoverflow.com/questions/3196504", "https://Stackoverflow.com", "https://Stackoverflow.com/users/199808/" ]
You could use reflection: ``` // List all public properties for the given type PropertyInfo[] properties = foo.GetType().GetProperties(); foreach (var property in properties) { string propertyName = property.Name; } ``` You should be aware that there could be an additional overhead when using reflection because ...
Following article on [MSDN](http://msdn.microsoft.com/en-us/library/t0cs7xez%28v=VS.80%29.aspx) should help you determine the methods of a type
3,196,504
Suppose I have a class named foo, and it has 3 public members foo1, foo2, and foo3. Now suppose I'm writing a function that takes an instance of class foo as a parameter, but when I'm writing this function I have no idea what public members it has. Is there a way for me to determine at run-time that it has public mem...
2010/07/07
[ "https://Stackoverflow.com/questions/3196504", "https://Stackoverflow.com", "https://Stackoverflow.com/users/199808/" ]
Have a look at the .net reflection namespace: <http://msdn.microsoft.com/en-us/library/ms173183(VS.80).aspx>
Following article on [MSDN](http://msdn.microsoft.com/en-us/library/t0cs7xez%28v=VS.80%29.aspx) should help you determine the methods of a type
3,196,504
Suppose I have a class named foo, and it has 3 public members foo1, foo2, and foo3. Now suppose I'm writing a function that takes an instance of class foo as a parameter, but when I'm writing this function I have no idea what public members it has. Is there a way for me to determine at run-time that it has public mem...
2010/07/07
[ "https://Stackoverflow.com/questions/3196504", "https://Stackoverflow.com", "https://Stackoverflow.com/users/199808/" ]
Have a look at the .net reflection namespace: <http://msdn.microsoft.com/en-us/library/ms173183(VS.80).aspx>
``` foreach(PropertyInfo pi in yourObject.GetType().GetProperties()) { Type theType = pi.PropertyType; } ```
3,196,504
Suppose I have a class named foo, and it has 3 public members foo1, foo2, and foo3. Now suppose I'm writing a function that takes an instance of class foo as a parameter, but when I'm writing this function I have no idea what public members it has. Is there a way for me to determine at run-time that it has public mem...
2010/07/07
[ "https://Stackoverflow.com/questions/3196504", "https://Stackoverflow.com", "https://Stackoverflow.com/users/199808/" ]
This is a job for reflection. Look into methods like: `myFoo.GetType().GetMethods(BindingFlags.Instance | BindingFlags.Public);` This will return all public, instance methods that the type has. You can then look through the returned results and determine if this class meets your criteria. There are equivalent methods...
Following article on [MSDN](http://msdn.microsoft.com/en-us/library/t0cs7xez%28v=VS.80%29.aspx) should help you determine the methods of a type
3,196,504
Suppose I have a class named foo, and it has 3 public members foo1, foo2, and foo3. Now suppose I'm writing a function that takes an instance of class foo as a parameter, but when I'm writing this function I have no idea what public members it has. Is there a way for me to determine at run-time that it has public mem...
2010/07/07
[ "https://Stackoverflow.com/questions/3196504", "https://Stackoverflow.com", "https://Stackoverflow.com/users/199808/" ]
You could use reflection: ``` // List all public properties for the given type PropertyInfo[] properties = foo.GetType().GetProperties(); foreach (var property in properties) { string propertyName = property.Name; } ``` You should be aware that there could be an additional overhead when using reflection because ...
``` foreach(PropertyInfo pi in yourObject.GetType().GetProperties()) { Type theType = pi.PropertyType; } ```
3,196,504
Suppose I have a class named foo, and it has 3 public members foo1, foo2, and foo3. Now suppose I'm writing a function that takes an instance of class foo as a parameter, but when I'm writing this function I have no idea what public members it has. Is there a way for me to determine at run-time that it has public mem...
2010/07/07
[ "https://Stackoverflow.com/questions/3196504", "https://Stackoverflow.com", "https://Stackoverflow.com/users/199808/" ]
Well, that's what Reflection is there for : ``` Type myObjectType = typeof(foo); System.Reflection.FieldInfo[] fieldInfo = myObjectType.GetFields(); foreach (System.Reflection.FieldInfo info in fieldInfo) Console.WriteLine(info.Name); // or whatever you desire to do with it ```
You could use reflection: ``` // List all public properties for the given type PropertyInfo[] properties = foo.GetType().GetProperties(); foreach (var property in properties) { string propertyName = property.Name; } ``` You should be aware that there could be an additional overhead when using reflection because ...
3,196,504
Suppose I have a class named foo, and it has 3 public members foo1, foo2, and foo3. Now suppose I'm writing a function that takes an instance of class foo as a parameter, but when I'm writing this function I have no idea what public members it has. Is there a way for me to determine at run-time that it has public mem...
2010/07/07
[ "https://Stackoverflow.com/questions/3196504", "https://Stackoverflow.com", "https://Stackoverflow.com/users/199808/" ]
Well, that's what Reflection is there for : ``` Type myObjectType = typeof(foo); System.Reflection.FieldInfo[] fieldInfo = myObjectType.GetFields(); foreach (System.Reflection.FieldInfo info in fieldInfo) Console.WriteLine(info.Name); // or whatever you desire to do with it ```
Following article on [MSDN](http://msdn.microsoft.com/en-us/library/t0cs7xez%28v=VS.80%29.aspx) should help you determine the methods of a type
3,196,504
Suppose I have a class named foo, and it has 3 public members foo1, foo2, and foo3. Now suppose I'm writing a function that takes an instance of class foo as a parameter, but when I'm writing this function I have no idea what public members it has. Is there a way for me to determine at run-time that it has public mem...
2010/07/07
[ "https://Stackoverflow.com/questions/3196504", "https://Stackoverflow.com", "https://Stackoverflow.com/users/199808/" ]
Well, that's what Reflection is there for : ``` Type myObjectType = typeof(foo); System.Reflection.FieldInfo[] fieldInfo = myObjectType.GetFields(); foreach (System.Reflection.FieldInfo info in fieldInfo) Console.WriteLine(info.Name); // or whatever you desire to do with it ```
This is a job for reflection. Look into methods like: `myFoo.GetType().GetMethods(BindingFlags.Instance | BindingFlags.Public);` This will return all public, instance methods that the type has. You can then look through the returned results and determine if this class meets your criteria. There are equivalent methods...
3,196,504
Suppose I have a class named foo, and it has 3 public members foo1, foo2, and foo3. Now suppose I'm writing a function that takes an instance of class foo as a parameter, but when I'm writing this function I have no idea what public members it has. Is there a way for me to determine at run-time that it has public mem...
2010/07/07
[ "https://Stackoverflow.com/questions/3196504", "https://Stackoverflow.com", "https://Stackoverflow.com/users/199808/" ]
Well, that's what Reflection is there for : ``` Type myObjectType = typeof(foo); System.Reflection.FieldInfo[] fieldInfo = myObjectType.GetFields(); foreach (System.Reflection.FieldInfo info in fieldInfo) Console.WriteLine(info.Name); // or whatever you desire to do with it ```
``` foreach(PropertyInfo pi in yourObject.GetType().GetProperties()) { Type theType = pi.PropertyType; } ```
3,196,504
Suppose I have a class named foo, and it has 3 public members foo1, foo2, and foo3. Now suppose I'm writing a function that takes an instance of class foo as a parameter, but when I'm writing this function I have no idea what public members it has. Is there a way for me to determine at run-time that it has public mem...
2010/07/07
[ "https://Stackoverflow.com/questions/3196504", "https://Stackoverflow.com", "https://Stackoverflow.com/users/199808/" ]
This is a job for reflection. Look into methods like: `myFoo.GetType().GetMethods(BindingFlags.Instance | BindingFlags.Public);` This will return all public, instance methods that the type has. You can then look through the returned results and determine if this class meets your criteria. There are equivalent methods...
``` foreach(PropertyInfo pi in yourObject.GetType().GetProperties()) { Type theType = pi.PropertyType; } ```
7,742,720
I'm setting a margin for a div element, however the body element also gets that margin. Consider this code: ``` <!-- HTML --> <body> <div> </div> </body> <!-- CSS --> <style> html,body { height:100%; margin:0; padding:0; outline:1px solid blue; } div { margin:20px; outline:1px solid red; ...
2011/10/12
[ "https://Stackoverflow.com/questions/7742720", "https://Stackoverflow.com", "https://Stackoverflow.com/users/613576/" ]
This sounds similar to a problem I had: [Margins and negative margins](https://stackoverflow.com/questions/5750088/margins-and-negative-margins). I solved mine by putting a padding-top rather than a border, maybe this works with your design slightly better? Otherwise try this link: <http://www.seifi.org/css/understandi...
This is caused by an effect known as collapsing margins. > > Certain adjoining margins combine to form a single margin. Those margins are said to “collapse.” Margins are adjoining if there are no nonempty content, padding or border areas or clearance to separate them. > > > <http://www.w3.org/TR/css3-box/#collap...
7,742,720
I'm setting a margin for a div element, however the body element also gets that margin. Consider this code: ``` <!-- HTML --> <body> <div> </div> </body> <!-- CSS --> <style> html,body { height:100%; margin:0; padding:0; outline:1px solid blue; } div { margin:20px; outline:1px solid red; ...
2011/10/12
[ "https://Stackoverflow.com/questions/7742720", "https://Stackoverflow.com", "https://Stackoverflow.com/users/613576/" ]
This sounds similar to a problem I had: [Margins and negative margins](https://stackoverflow.com/questions/5750088/margins-and-negative-margins). I solved mine by putting a padding-top rather than a border, maybe this works with your design slightly better? Otherwise try this link: <http://www.seifi.org/css/understandi...
I know this is an old question, but I just wanna point out that, in the example given in the question, one could use padding instead of margins: ```html <!-- HTML --> <body> <div> content </div> </body> <!-- CSS --> <style> html, body { box-sizing: border-box; /* padding makes part of the */ ...
7,742,720
I'm setting a margin for a div element, however the body element also gets that margin. Consider this code: ``` <!-- HTML --> <body> <div> </div> </body> <!-- CSS --> <style> html,body { height:100%; margin:0; padding:0; outline:1px solid blue; } div { margin:20px; outline:1px solid red; ...
2011/10/12
[ "https://Stackoverflow.com/questions/7742720", "https://Stackoverflow.com", "https://Stackoverflow.com/users/613576/" ]
This is caused by an effect known as collapsing margins. > > Certain adjoining margins combine to form a single margin. Those margins are said to “collapse.” Margins are adjoining if there are no nonempty content, padding or border areas or clearance to separate them. > > > <http://www.w3.org/TR/css3-box/#collap...
I know this is an old question, but I just wanna point out that, in the example given in the question, one could use padding instead of margins: ```html <!-- HTML --> <body> <div> content </div> </body> <!-- CSS --> <style> html, body { box-sizing: border-box; /* padding makes part of the */ ...
4,062,136
I need to show that $x \sim y$ if $x=2y$. I started off by assuming that $x,y \in R$. Since $x=2y$, $y=x/2$. Since $y \neq 2x$, $\sim$ is not symmetric. Could I approach the problem is this way?
2021/03/15
[ "https://math.stackexchange.com/questions/4062136", "https://math.stackexchange.com", "https://math.stackexchange.com/users/899876/" ]
Yes, you can. Note that all you have to do is to find a pair of real numbers $x,y$ such that $x \sim y$ but $y \nsim x$. Take $x = 2, y = 1$.
Yes, you are correct. The relation is not symmetric. Hope this helps. Ask anything if not clear :)
15,334,909
I would like to write a function convert type `string -> nat` in `coq`. Where the string contents only number will return `nat` otherwise it will return `0` for the alphabet or alphabet with number or any cases that is not contain number (for example: ', -, ...). For example: `"0", "1", "2", "3", ... "99",..` will re...
2013/03/11
[ "https://Stackoverflow.com/questions/15334909", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1061263/" ]
You can define the default function as private method : ```dart _defaultTransform(Something v) => v; void _doSomething(List<Something> numbers, [transform(Something element) = _defaultTransform]) {...} ``` Or check argument like this : ```dart void _doSomething(List<Something> numbers, [transform...
if you want to initialize a Function parameter that is also a field of your class I suggest: ``` class MyClass{ Function myFunc; MyClass({this.myFunc = _myDefaultFunc}){...} static _myDefaultFunc(){...} } ``` Or more suitable: ``` typedef SpecialFunction = ReturnType Function( Fi...
1,316,481
I have two WLAN SSIDs. One is operating at 2.4GHz frequency, and the SSID is "stratus24". Other is operating at 5GHz frequency, and the SSID is "stratus50". Both of these WLANs are bridged to the same Ethernet LAN. So, there are three ways to access the same network: via "stratus24" SSID at 2.4GHz, via "stratus50" SSID...
2018/04/23
[ "https://superuser.com/questions/1316481", "https://superuser.com", "https://superuser.com/users/537374/" ]
I think I found the reason. I searched for "stratus24" in Windows registry using regedit and found that `Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Profiles\{41FBD081-E721-466D-89F9-2FE1FB37FEB6}` has in `ProfileName` the "stratus24" string. So, the next thing was to search fo...
There seems to be some confusion here between network adapter names and network names in Windows. If you connect a wired ethernet connection to a Windows PC, the 'ethernet' network adapter will be given a name. The adapter name can be changed in Network Connections (ie "Change adapter settings") as shown [here](https:...
70,203,488
I am new to MERN and I am learning it. I don't know how to fetch all the data from a specific collection and display the data of each record on separate cards. I have developed the backend code and is working perfectly when I send requests via postman but fetching and displaying data from React app is a problem for me....
2021/12/02
[ "https://Stackoverflow.com/questions/70203488", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14599009/" ]
Just use the AXIOS library to do your REST calls in the front-end. What you created in your nodejs project is just an endpoint, now you will have to make an API call to the endpoint from the front end. Answer by Heartbit is also apt, but typically in React, devs use the AXIOS library for the rest API calls. Read the ...
There are many ways that you can query to get data from your API server. so here I am trying to describe two of them. **1. By native browser `Fetch` API:** ```js const AdsContainer = ({children}) => { const [data, setData] = useState(); useEffect(() => { fetch('/ads').then(response => { setData(respon...
70,203,488
I am new to MERN and I am learning it. I don't know how to fetch all the data from a specific collection and display the data of each record on separate cards. I have developed the backend code and is working perfectly when I send requests via postman but fetching and displaying data from React app is a problem for me....
2021/12/02
[ "https://Stackoverflow.com/questions/70203488", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14599009/" ]
Just use the AXIOS library to do your REST calls in the front-end. What you created in your nodejs project is just an endpoint, now you will have to make an API call to the endpoint from the front end. Answer by Heartbit is also apt, but typically in React, devs use the AXIOS library for the rest API calls. Read the ...
I recommend you install axios. * Learn more <https://www.npmjs.com/package/axios> * Using: ```js useEffect(() => { const getAds = async () => { const res = await axios.get('/ads') console.log(res.data) } getAds() }, []) ```
25,058
I need a noun that includes all of: (desktop computer, laptop, tablet, smartphone). Back in the day, in English, a "computer" normally only meant a desktop computer. These days, I think most people understand that desktops, laptops, tablets, and smartphones are all "computers", they just have different form factors. ...
2015/06/16
[ "https://japanese.stackexchange.com/questions/25058", "https://japanese.stackexchange.com", "https://japanese.stackexchange.com/users/10193/" ]
What コンピュータ refers to greatly depends on the context. When explicitly asked, most people of course understand that a smartphone is also a kind of コンピュータ. But in daily life, people tend to use コンピュータ to refer to bigger ones, such as desktop PCs or supercomputers. If someone just says "昨日コンピュータを買ったよ", it probably means t...
I'd say: **tablets, yes; smartphones, no**. The word コンピュータ is not actually used all that much, it sounds a bit formal/heavy iron. The everyday word for personal computing devices is パソコン or PC, which by default means a desktop. [Subcategories of パソコン](http://www.yodobashi.com/%E3%83%91%E3%82%BD%E3%82%B3%E3%83%B3/ct/1...
67,558,190
I've been trying the new modules feature, but I'm unable to export a global constant. The exporting seems to compile fine, but when importing the compiler complains that the constant is not declared. My code: test.cpp ``` export module test; export struct my_type { int x, y; }; export constexpr int my_constant = 42;...
2021/05/16
[ "https://Stackoverflow.com/questions/67558190", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1753601/" ]
const-qualified variables have internal linkage by default, so it might be necessary to write it as ``` export extern const int my_constant = 42; ``` According to <https://en.cppreference.com/w/cpp/language/storage_duration> the `export` definition should make the variable have external linkage, so you might have hi...
Simply use `inline` ``` export inline constexpr int my_constant = 42; ```
35,271,526
I Have installed Laravel on my Windows. So While accessing <http://localhost:8000/phpmyadmin> it doesn't seem to be working since it has some kind of conflict with laravel routes. ``` Sorry, the page you are looking for could not be found. 1/1NotFoundHttpException in RouteCollection.php line 161: ``` How can I fix ...
2016/02/08
[ "https://Stackoverflow.com/questions/35271526", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5801126/" ]
javad71 It would appear that your issue is this. When you run your server for you laravel installation, your system is looking at the /path/to/code/public folder. This folder in the Laravel installation does have an .htaccess file that does some 'magic' for laravel translating the url you visit into the correct route....
javed71. Not sure what you are trying to accomplish but PHPMyadmin is supposed to be installed together with your Apache, PhP and MySQL if you're using XAMPP or WAMP. Visting <http://localhost/phpmyadmin> and resulting to 404 or PageNotFound error means that there is no running instance of Apache on your machine. How...
38,547
I would like to create a look for my model that is similar to the material of models in Blender "object"/"sculpt" mode. I have tried using Glossy and Diffuse nodes to make "plastic" and "rubber" (according to online tutorials) but it ends up looking wrong; I want it to have a sort of rubber-putty 'sheen' rather than a ...
2015/09/14
[ "https://blender.stackexchange.com/questions/38547", "https://blender.stackexchange.com", "https://blender.stackexchange.com/users/17936/" ]
Here's the similar effect I achieved mixing the ***Toon Shaders*** (see the nodes setup below). Although I don't know how to achieve the 100% accurate effect. [![enter image description here](https://i.stack.imgur.com/1fkYC.jpg)](https://i.stack.imgur.com/1fkYC.jpg) [![enter image description here](https://i.stack.imgu...
Try using a Diffuse BDSF node (in cycles, of course), and play with the 'roughness' setting'. If your rig is like mine (not very powerful), it may be helpful to put your 3DView in render mode, hide everything except for maybe a cube or small icosphere (set to shade smooth), and then apply this diffuse material. Start f...
19,792,368
I have dropzone working no a site but once in a while when I drop an image in it turns to landscape. This seems to happen more on larger images. I cannot find anyone with this problem so I was hoping someone here has dealt with this issue. Upon further testing I have narrowed this down to only images with the extensio...
2013/11/05
[ "https://Stackoverflow.com/questions/19792368", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1012256/" ]
Use SimpleImage. > > change vertical or horizontal mobile image into properly oriented.. So > that any vertical mobile store in vertical only.. Use simple image > auto\_orient funtion. Get Simple image from : > <https://github.com/claviska/SimpleImage> > > > ``` $img = new SimpleImage(); $imagenm="Bomb...
Just in case anyone comes across this I figured I would answer it now that I have worked though it. I found in the EXIF data that the orientation needed to be locked in before converting the image. Even though the browser or email client rendered it upright it saved rated 90 degrees. By running the following php exec b...
4,741,880
This is a bit of a challenge. Here's what I'm looking for: 1. 3 divs on screen 2. Div 1 resides in the middle of the page (centered) 3. Div 2 resides just off the screen on the far left 4. Div 3 resides just off the screen on the far right 5. `OnClick`, Div 1 slides to the position Div 2 was (to the left), Div 2 slide...
2011/01/19
[ "https://Stackoverflow.com/questions/4741880", "https://Stackoverflow.com", "https://Stackoverflow.com/users/579394/" ]
Something like this? <http://jsfiddle.net/jtbowden/ykbgT/embedded/result/> <http://jsfiddle.net/jtbowden/ykbgT/> This is the basic functionality. It doesn't scale to more divs, etc, but that should get you started. The key is to wrap your elements in a container and make the overflow hidden. **Update**: Here's a ...
Maybe I misinterpreted. I though you wanted three divs in a row, and only the ones on the end sliding and whatnot. <http://jsfiddle.net/acsfy/> (I know you're using jQuery for this, but it pissed me off as I was trying to force it to work. You'd have to adapt this for your purposes.)
4,741,880
This is a bit of a challenge. Here's what I'm looking for: 1. 3 divs on screen 2. Div 1 resides in the middle of the page (centered) 3. Div 2 resides just off the screen on the far left 4. Div 3 resides just off the screen on the far right 5. `OnClick`, Div 1 slides to the position Div 2 was (to the left), Div 2 slide...
2011/01/19
[ "https://Stackoverflow.com/questions/4741880", "https://Stackoverflow.com", "https://Stackoverflow.com/users/579394/" ]
Something like this? <http://jsfiddle.net/jtbowden/ykbgT/embedded/result/> <http://jsfiddle.net/jtbowden/ykbgT/> This is the basic functionality. It doesn't scale to more divs, etc, but that should get you started. The key is to wrap your elements in a container and make the overflow hidden. **Update**: Here's a ...
And... not a year too late. If you want it to start on the first div, your css needs to look like this. ``` #box1 { background-color:#333; } #box2 { background-color:#333; left: -50%; } #box3 { background-color:#333; left: 150%; } #box4 { background-color:#333; left: 150%; } #box5 { background-co...
4,741,880
This is a bit of a challenge. Here's what I'm looking for: 1. 3 divs on screen 2. Div 1 resides in the middle of the page (centered) 3. Div 2 resides just off the screen on the far left 4. Div 3 resides just off the screen on the far right 5. `OnClick`, Div 1 slides to the position Div 2 was (to the left), Div 2 slide...
2011/01/19
[ "https://Stackoverflow.com/questions/4741880", "https://Stackoverflow.com", "https://Stackoverflow.com/users/579394/" ]
Something like this? <http://jsfiddle.net/jtbowden/ykbgT/embedded/result/> <http://jsfiddle.net/jtbowden/ykbgT/> This is the basic functionality. It doesn't scale to more divs, etc, but that should get you started. The key is to wrap your elements in a container and make the overflow hidden. **Update**: Here's a ...
Extending **Jeff B** answer, i've included [Hammer.js](http://hammerjs.github.io/) and made a circular list. ``` $(function() { $("#esq").click(function() { console.log("Esquerda !"); var obj = $(".ativo"); $(obj).animate({ left: '-50%' }, 500, function() { $(this).css('left', '+150%');...
4,741,880
This is a bit of a challenge. Here's what I'm looking for: 1. 3 divs on screen 2. Div 1 resides in the middle of the page (centered) 3. Div 2 resides just off the screen on the far left 4. Div 3 resides just off the screen on the far right 5. `OnClick`, Div 1 slides to the position Div 2 was (to the left), Div 2 slide...
2011/01/19
[ "https://Stackoverflow.com/questions/4741880", "https://Stackoverflow.com", "https://Stackoverflow.com/users/579394/" ]
Maybe I misinterpreted. I though you wanted three divs in a row, and only the ones on the end sliding and whatnot. <http://jsfiddle.net/acsfy/> (I know you're using jQuery for this, but it pissed me off as I was trying to force it to work. You'd have to adapt this for your purposes.)
And... not a year too late. If you want it to start on the first div, your css needs to look like this. ``` #box1 { background-color:#333; } #box2 { background-color:#333; left: -50%; } #box3 { background-color:#333; left: 150%; } #box4 { background-color:#333; left: 150%; } #box5 { background-co...
4,741,880
This is a bit of a challenge. Here's what I'm looking for: 1. 3 divs on screen 2. Div 1 resides in the middle of the page (centered) 3. Div 2 resides just off the screen on the far left 4. Div 3 resides just off the screen on the far right 5. `OnClick`, Div 1 slides to the position Div 2 was (to the left), Div 2 slide...
2011/01/19
[ "https://Stackoverflow.com/questions/4741880", "https://Stackoverflow.com", "https://Stackoverflow.com/users/579394/" ]
Maybe I misinterpreted. I though you wanted three divs in a row, and only the ones on the end sliding and whatnot. <http://jsfiddle.net/acsfy/> (I know you're using jQuery for this, but it pissed me off as I was trying to force it to work. You'd have to adapt this for your purposes.)
Extending **Jeff B** answer, i've included [Hammer.js](http://hammerjs.github.io/) and made a circular list. ``` $(function() { $("#esq").click(function() { console.log("Esquerda !"); var obj = $(".ativo"); $(obj).animate({ left: '-50%' }, 500, function() { $(this).css('left', '+150%');...
4,741,880
This is a bit of a challenge. Here's what I'm looking for: 1. 3 divs on screen 2. Div 1 resides in the middle of the page (centered) 3. Div 2 resides just off the screen on the far left 4. Div 3 resides just off the screen on the far right 5. `OnClick`, Div 1 slides to the position Div 2 was (to the left), Div 2 slide...
2011/01/19
[ "https://Stackoverflow.com/questions/4741880", "https://Stackoverflow.com", "https://Stackoverflow.com/users/579394/" ]
Extending **Jeff B** answer, i've included [Hammer.js](http://hammerjs.github.io/) and made a circular list. ``` $(function() { $("#esq").click(function() { console.log("Esquerda !"); var obj = $(".ativo"); $(obj).animate({ left: '-50%' }, 500, function() { $(this).css('left', '+150%');...
And... not a year too late. If you want it to start on the first div, your css needs to look like this. ``` #box1 { background-color:#333; } #box2 { background-color:#333; left: -50%; } #box3 { background-color:#333; left: 150%; } #box4 { background-color:#333; left: 150%; } #box5 { background-co...
13,297,328
I'm using JSF 2 and I'm getting some exception while I'm using some web service and I want to catch that exception and display the message on my `.xhtml` page. How can I do that?
2012/11/08
[ "https://Stackoverflow.com/questions/13297328", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1771540/" ]
You can use [the `try-catch` block](http://docs.oracle.com/javase/tutorial/essential/exceptions/) to catch and handle the exception. You can use [`FacesContext#addMessage()`](http://docs.oracle.com/javaee/6/api/javax/faces/context/FacesContext.html#addMessage%28java.lang.String,%20javax.faces.application.FacesMessage%2...
To give you an example to what BalusC has explained, you could write a simple method that gets called in a catch statement. ``` private void addErrorMessage(String msg, String clientId) { String codingErrorMsgKey = "coding_error_msg"; FacesMessage fm; FacesContext facesContext = FacesContext.ge...
54,003,900
I want to insert a new row into a table with a auto number column. My code is below, I can't find out how to insert auto number column simultaneously with other columns: ``` pth = My.Application.Info.DirectoryPath Dim SQL = "INSERT INTO approved (id, word, approveds) VALUES (@idd, @word, @approval)" Using Con As New...
2019/01/02
[ "https://Stackoverflow.com/questions/54003900", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6012755/" ]
You say > > What I've done so far is to get all text objects and image objects and locations. > > > but you don't go into detail how you do so. I assume you use a matching `IRenderListener` implementation. But `IRenderListener`, as you found out yourself, > > only extracts images and texts. > > > The main...
try to implement IRenderListener ``` internal class ImageExtractor : IRenderListener { private int _currentPage = 1; private int _imageCount = 0; private readonly string _outputFilePrefix; private readonly string _outputFolder; private readonly bool _overwriteExistingFiles; private ImageExtr...
125,639
Is it possible to replace a large-dimensional system of differential equations with one partial differential equation?
2013/03/26
[ "https://mathoverflow.net/questions/125639", "https://mathoverflow.net", "https://mathoverflow.net/users/32541/" ]
Call a unitary matrix *flat* if all its entries have the same absolute value. In operator theory these arise as a class of type-II matrices, which were used by Vaughan Jones in his work on link invariants. Currently they are also of interest in physics, because of their connection with "mutually unbiased bases". In thi...
No. For example, there are [Hadamard matrices](http://en.wikipedia.org/wiki/Hadamard_matrix) (after rescaling).
2,230
Has anyone implemented `IAlertUpdateHandler` interface successfully? Actually I've to suppress alert subscription notification email. I've following code in `PreUpdate` method: ``` public bool PreUpdate(SPAlert a, SPWeb web, bool newAlert, string properties) { if (CHECK_IF_SUPPRESSING_EMAIL) { a.Updat...
2010/04/07
[ "https://sharepoint.stackexchange.com/questions/2230", "https://sharepoint.stackexchange.com", "https://sharepoint.stackexchange.com/users/528/" ]
I know that it might be a bit late for this but I thought put it anyway to help the next one. I found a solution/hack for this problem. I beleive that when the alert is created from the UI the system fires an SPAlert.update(), so what I came up with is to do similar but ignore the update called from the UI to do that...
I think you need to be using OnNotification in the IAlertNotifyHandler interface. ``` public bool OnNotification(SPAlertHandlerParams ahp) { if (CHECK_IF_SUPPRESSING_EMAIL) { return false; } else { return true; } } ```
24,150
I'm currently in a country where internet access is expensive (New Zealand), and I'm curious if I'll be able to download Portal 2. How big is the download in Steam?
2011/06/07
[ "https://gaming.stackexchange.com/questions/24150", "https://gaming.stackexchange.com", "https://gaming.stackexchange.com/users/2958/" ]
The [system requirements](http://store.steampowered.com/app/620/) list 7.6 GB for Portal 2. If you already have a Source game the size could be much smaller since the Source engine compromises a large part of the download.
Yeah like all the other have said, Need to have Source SDK Base 2007 installed already, and that file is a whooping 4.8Gigs (if i remember correctly - around 4gig range) So I would say Portal 2 is roughly 2.5 gigs
24,150
I'm currently in a country where internet access is expensive (New Zealand), and I'm curious if I'll be able to download Portal 2. How big is the download in Steam?
2011/06/07
[ "https://gaming.stackexchange.com/questions/24150", "https://gaming.stackexchange.com", "https://gaming.stackexchange.com/users/2958/" ]
The [system requirements](http://store.steampowered.com/app/620/) list 7.6 GB for Portal 2. If you already have a Source game the size could be much smaller since the Source engine compromises a large part of the download.
The amount of data that needs to be downloaded is different than the amount of disk space the game uses once installed. As reported by the installer screen before installing Portal 2 the disk space required during the installation is 11.6GB: ![enter image description here](https://i.stack.imgur.com/dYv8v.jpg) However...
192,258
I have to execute custom PHP code after new post is saved with all it's meta data. My question is how to achieve that? Tried with **save\_post** action, but it executes before meta records are saved, so I cannot use it in this case. So, how can I run my custom function after post with all related data is saved in dat...
2015/06/22
[ "https://wordpress.stackexchange.com/questions/192258", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/44050/" ]
For **NEW** post type 'post' use `draft_to_publish` action hook: ``` function fpw_post_info( $post ) { if ( 'post' == $post->post_type ) { // echo '<pre>'; print_r( $post ); echo '<br />'; // $meta = get_post_meta( $post->ID ); print_r( $meta ); echo '</pre>'; die(); // your custom code goe...
You might use this: ```php function myFunction($post_id, $post, $update ) { // your code here } add_action('save_post', 'myFunction'); ``` `$update` is a boolean and return false if this is a new post. If it's an update it returns true. Here is the documentation: <https://developer.wordpress.org/reference/hook...
192,258
I have to execute custom PHP code after new post is saved with all it's meta data. My question is how to achieve that? Tried with **save\_post** action, but it executes before meta records are saved, so I cannot use it in this case. So, how can I run my custom function after post with all related data is saved in dat...
2015/06/22
[ "https://wordpress.stackexchange.com/questions/192258", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/44050/" ]
For **NEW** post type 'post' use `draft_to_publish` action hook: ``` function fpw_post_info( $post ) { if ( 'post' == $post->post_type ) { // echo '<pre>'; print_r( $post ); echo '<br />'; // $meta = get_post_meta( $post->ID ); print_r( $meta ); echo '</pre>'; die(); // your custom code goe...
The correct and simpler answer is to use the `wp_insert_post` action. <https://developer.wordpress.org/reference/hooks/wp_insert_post/> > > An important distinction of wp\_insert\_post action is that it is fired > after update\_post\_meta has been called. > > > There are 3 parameters available - the $update flag...
192,258
I have to execute custom PHP code after new post is saved with all it's meta data. My question is how to achieve that? Tried with **save\_post** action, but it executes before meta records are saved, so I cannot use it in this case. So, how can I run my custom function after post with all related data is saved in dat...
2015/06/22
[ "https://wordpress.stackexchange.com/questions/192258", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/44050/" ]
Quite stupid solution, but works: ``` function afterPostUpdated($meta_id, $post_id, $meta_key='', $meta_value=''){ if($meta_key=='_edit_lock') { if($_GET['message']==1) { // Your code here // } } } add_action('updated_post_meta', 'afterPostUpdated', 10, 4); ...
You might use this: ```php function myFunction($post_id, $post, $update ) { // your code here } add_action('save_post', 'myFunction'); ``` `$update` is a boolean and return false if this is a new post. If it's an update it returns true. Here is the documentation: <https://developer.wordpress.org/reference/hook...
192,258
I have to execute custom PHP code after new post is saved with all it's meta data. My question is how to achieve that? Tried with **save\_post** action, but it executes before meta records are saved, so I cannot use it in this case. So, how can I run my custom function after post with all related data is saved in dat...
2015/06/22
[ "https://wordpress.stackexchange.com/questions/192258", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/44050/" ]
Quite stupid solution, but works: ``` function afterPostUpdated($meta_id, $post_id, $meta_key='', $meta_value=''){ if($meta_key=='_edit_lock') { if($_GET['message']==1) { // Your code here // } } } add_action('updated_post_meta', 'afterPostUpdated', 10, 4); ...
The correct and simpler answer is to use the `wp_insert_post` action. <https://developer.wordpress.org/reference/hooks/wp_insert_post/> > > An important distinction of wp\_insert\_post action is that it is fired > after update\_post\_meta has been called. > > > There are 3 parameters available - the $update flag...
192,258
I have to execute custom PHP code after new post is saved with all it's meta data. My question is how to achieve that? Tried with **save\_post** action, but it executes before meta records are saved, so I cannot use it in this case. So, how can I run my custom function after post with all related data is saved in dat...
2015/06/22
[ "https://wordpress.stackexchange.com/questions/192258", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/44050/" ]
You might use this: ```php function myFunction($post_id, $post, $update ) { // your code here } add_action('save_post', 'myFunction'); ``` `$update` is a boolean and return false if this is a new post. If it's an update it returns true. Here is the documentation: <https://developer.wordpress.org/reference/hook...
The correct and simpler answer is to use the `wp_insert_post` action. <https://developer.wordpress.org/reference/hooks/wp_insert_post/> > > An important distinction of wp\_insert\_post action is that it is fired > after update\_post\_meta has been called. > > > There are 3 parameters available - the $update flag...
1,239,847
How do I compute $-6(-4)^{n-1}$ + $8(-4)^{n-2}$ ? I recall that as long as the number from both operands (in this case: -4) are the same, I can actually "add" them together. But the problem is the -6 from the first operand and the +8 from the second operand makes the math difficult right? So should I just factor it b...
2015/04/18
[ "https://math.stackexchange.com/questions/1239847", "https://math.stackexchange.com", "https://math.stackexchange.com/users/132545/" ]
$$(-4)^{n-1}(-6+8(-4)^{-1})$$ $$(-4)^{n-1}(-6-2)$$ $$(-4)^{n}\frac{-8}{-4}=2(-4)^n$$
Hints: $-6(-4)^{n-1}=-6\times (-4)\times (-4)^{n-2}=24(-4)^{n-2}$
1,239,847
How do I compute $-6(-4)^{n-1}$ + $8(-4)^{n-2}$ ? I recall that as long as the number from both operands (in this case: -4) are the same, I can actually "add" them together. But the problem is the -6 from the first operand and the +8 from the second operand makes the math difficult right? So should I just factor it b...
2015/04/18
[ "https://math.stackexchange.com/questions/1239847", "https://math.stackexchange.com", "https://math.stackexchange.com/users/132545/" ]
Hints: $-6(-4)^{n-1}=-6\times (-4)\times (-4)^{n-2}=24(-4)^{n-2}$
This problem is looking to assess your comfort with the properties of exponents. Recall these general properties... * $x^a x^b = x^{a+b}$ * $\dfrac{x^a}{x^b} = x^{a-b}$ * $(x^a)^b = (x^b)^a = x^{ab}$ * $x^{-a} = \dfrac{1}{x^a}$ for $x \ne 0$ So, solving the problem using a slightly alternative method than the others ...
1,239,847
How do I compute $-6(-4)^{n-1}$ + $8(-4)^{n-2}$ ? I recall that as long as the number from both operands (in this case: -4) are the same, I can actually "add" them together. But the problem is the -6 from the first operand and the +8 from the second operand makes the math difficult right? So should I just factor it b...
2015/04/18
[ "https://math.stackexchange.com/questions/1239847", "https://math.stackexchange.com", "https://math.stackexchange.com/users/132545/" ]
$$(-4)^{n-1}(-6+8(-4)^{-1})$$ $$(-4)^{n-1}(-6-2)$$ $$(-4)^{n}\frac{-8}{-4}=2(-4)^n$$
This problem is looking to assess your comfort with the properties of exponents. Recall these general properties... * $x^a x^b = x^{a+b}$ * $\dfrac{x^a}{x^b} = x^{a-b}$ * $(x^a)^b = (x^b)^a = x^{ab}$ * $x^{-a} = \dfrac{1}{x^a}$ for $x \ne 0$ So, solving the problem using a slightly alternative method than the others ...
13,483,289
I'm currently writing a divide and conquer version of the Convex Hull algorithm and it's very close to working but am having trouble merging two convex hulls (to form the overall convex hull). I'm merging by: * Computing Upper & Lower Hulls for each Input Hull, A and B * Finding the combined upper hull by ensuring ri...
2012/11/20
[ "https://Stackoverflow.com/questions/13483289", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1236799/" ]
check this out; it'll give you very clever approaches to convex hull manipulation <https://web.archive.org/web/20120617005317/http://moais.imag.fr/membres/denis.trystram/SupportsDeCours/convexHull.pdf>
While this is using the XNA library, you can definitely port this to Java: ``` public static class PolygonUnion { public static bool PolyUnion(Vector2[] polya, Vector2[] polyb, out Vector2[] union, out Vector2[] intersection) { if (!Intersects(polya, polyb)) { un...
13,483,289
I'm currently writing a divide and conquer version of the Convex Hull algorithm and it's very close to working but am having trouble merging two convex hulls (to form the overall convex hull). I'm merging by: * Computing Upper & Lower Hulls for each Input Hull, A and B * Finding the combined upper hull by ensuring ri...
2012/11/20
[ "https://Stackoverflow.com/questions/13483289", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1236799/" ]
check this out; it'll give you very clever approaches to convex hull manipulation <https://web.archive.org/web/20120617005317/http://moais.imag.fr/membres/denis.trystram/SupportsDeCours/convexHull.pdf>
I'm not sure to understand what you mean by lower and upper and it would be good to specify if it is 2D or 3D. For a 2D convex hull. I have made an algorithm, which, according to my tests is the fastest (at least twice as fast as Chan) and both are in O(n log h). But what also differenciate mine, is that is support ...
7,946,913
Consider the following C++ code: ``` double someZero = 0; std::cout << 0 - someZero << '\n'; // prints 0 std::cout << -someZero << std::endl; // prints -0 ``` The question arises: what is negative zero good for, and should it be defensively avoided (i.e. use subtraction instead of smacking a minus onto a variable)...
2011/10/30
[ "https://Stackoverflow.com/questions/7946913", "https://Stackoverflow.com", "https://Stackoverflow.com/users/836523/" ]
From Wikipedia: > > It is claimed that the inclusion of signed zero in IEEE 754 makes it much easier to achieve numerical accuracy in some critical problems[1], in particular when computing with complex elementary functions[2]. > > > The first reference is "Branch Cuts for Complex Elementary Functions or Much Ado...
Negative zero has for example some use when handling complex numbers... In everyday use one should mostly avoid the negative zero. Some links with information regarding background/uses/pitfalls of "negative zero": * <http://en.wikipedia.org/wiki/Signed_zero> * <http://en.wikipedia.org/wiki/Floating_point#Signed_ze...
7,946,913
Consider the following C++ code: ``` double someZero = 0; std::cout << 0 - someZero << '\n'; // prints 0 std::cout << -someZero << std::endl; // prints -0 ``` The question arises: what is negative zero good for, and should it be defensively avoided (i.e. use subtraction instead of smacking a minus onto a variable)...
2011/10/30
[ "https://Stackoverflow.com/questions/7946913", "https://Stackoverflow.com", "https://Stackoverflow.com/users/836523/" ]
There are only two real use-cases that I can see: 1. You want to show that a value is negative but very very small (perhaps infinitessimal), i.e. too small to represent as a float or double. 2. You are working with math that only allows negatives, but still want to display zero. There are a few cases in physics, compl...
Negative zero has for example some use when handling complex numbers... In everyday use one should mostly avoid the negative zero. Some links with information regarding background/uses/pitfalls of "negative zero": * <http://en.wikipedia.org/wiki/Signed_zero> * <http://en.wikipedia.org/wiki/Floating_point#Signed_ze...
7,946,913
Consider the following C++ code: ``` double someZero = 0; std::cout << 0 - someZero << '\n'; // prints 0 std::cout << -someZero << std::endl; // prints -0 ``` The question arises: what is negative zero good for, and should it be defensively avoided (i.e. use subtraction instead of smacking a minus onto a variable)...
2011/10/30
[ "https://Stackoverflow.com/questions/7946913", "https://Stackoverflow.com", "https://Stackoverflow.com/users/836523/" ]
In addition Signed Zero Good For : The zeroes can be considered as a variant of the extended real number line such that 1/−0 = −∞ and 1/+0 = +∞, division by zero is only undefined for ±0/±0. Negatively signed zero echoes the mathematical analysis concept of approaching 0 from below as a one-sided limit, which may be...
Negative zero has for example some use when handling complex numbers... In everyday use one should mostly avoid the negative zero. Some links with information regarding background/uses/pitfalls of "negative zero": * <http://en.wikipedia.org/wiki/Signed_zero> * <http://en.wikipedia.org/wiki/Floating_point#Signed_ze...
7,946,913
Consider the following C++ code: ``` double someZero = 0; std::cout << 0 - someZero << '\n'; // prints 0 std::cout << -someZero << std::endl; // prints -0 ``` The question arises: what is negative zero good for, and should it be defensively avoided (i.e. use subtraction instead of smacking a minus onto a variable)...
2011/10/30
[ "https://Stackoverflow.com/questions/7946913", "https://Stackoverflow.com", "https://Stackoverflow.com/users/836523/" ]
I'm making a measuring app, and the -0 is very useful for mixed numbers (such as separating into feet and inches). Imagine that we have a variable "length" that we're trying to separate into "feet" and "inches". (This is java code, but the same idea is true for C++). ``` feet = Math.signum(length) * Math.floor(Math....
Negative zero has for example some use when handling complex numbers... In everyday use one should mostly avoid the negative zero. Some links with information regarding background/uses/pitfalls of "negative zero": * <http://en.wikipedia.org/wiki/Signed_zero> * <http://en.wikipedia.org/wiki/Floating_point#Signed_ze...
7,946,913
Consider the following C++ code: ``` double someZero = 0; std::cout << 0 - someZero << '\n'; // prints 0 std::cout << -someZero << std::endl; // prints -0 ``` The question arises: what is negative zero good for, and should it be defensively avoided (i.e. use subtraction instead of smacking a minus onto a variable)...
2011/10/30
[ "https://Stackoverflow.com/questions/7946913", "https://Stackoverflow.com", "https://Stackoverflow.com/users/836523/" ]
From Wikipedia: > > It is claimed that the inclusion of signed zero in IEEE 754 makes it much easier to achieve numerical accuracy in some critical problems[1], in particular when computing with complex elementary functions[2]. > > > The first reference is "Branch Cuts for Complex Elementary Functions or Much Ado...
There are only two real use-cases that I can see: 1. You want to show that a value is negative but very very small (perhaps infinitessimal), i.e. too small to represent as a float or double. 2. You are working with math that only allows negatives, but still want to display zero. There are a few cases in physics, compl...
7,946,913
Consider the following C++ code: ``` double someZero = 0; std::cout << 0 - someZero << '\n'; // prints 0 std::cout << -someZero << std::endl; // prints -0 ``` The question arises: what is negative zero good for, and should it be defensively avoided (i.e. use subtraction instead of smacking a minus onto a variable)...
2011/10/30
[ "https://Stackoverflow.com/questions/7946913", "https://Stackoverflow.com", "https://Stackoverflow.com/users/836523/" ]
From Wikipedia: > > It is claimed that the inclusion of signed zero in IEEE 754 makes it much easier to achieve numerical accuracy in some critical problems[1], in particular when computing with complex elementary functions[2]. > > > The first reference is "Branch Cuts for Complex Elementary Functions or Much Ado...
In addition Signed Zero Good For : The zeroes can be considered as a variant of the extended real number line such that 1/−0 = −∞ and 1/+0 = +∞, division by zero is only undefined for ±0/±0. Negatively signed zero echoes the mathematical analysis concept of approaching 0 from below as a one-sided limit, which may be...
7,946,913
Consider the following C++ code: ``` double someZero = 0; std::cout << 0 - someZero << '\n'; // prints 0 std::cout << -someZero << std::endl; // prints -0 ``` The question arises: what is negative zero good for, and should it be defensively avoided (i.e. use subtraction instead of smacking a minus onto a variable)...
2011/10/30
[ "https://Stackoverflow.com/questions/7946913", "https://Stackoverflow.com", "https://Stackoverflow.com/users/836523/" ]
From Wikipedia: > > It is claimed that the inclusion of signed zero in IEEE 754 makes it much easier to achieve numerical accuracy in some critical problems[1], in particular when computing with complex elementary functions[2]. > > > The first reference is "Branch Cuts for Complex Elementary Functions or Much Ado...
I'm making a measuring app, and the -0 is very useful for mixed numbers (such as separating into feet and inches). Imagine that we have a variable "length" that we're trying to separate into "feet" and "inches". (This is java code, but the same idea is true for C++). ``` feet = Math.signum(length) * Math.floor(Math....
7,946,913
Consider the following C++ code: ``` double someZero = 0; std::cout << 0 - someZero << '\n'; // prints 0 std::cout << -someZero << std::endl; // prints -0 ``` The question arises: what is negative zero good for, and should it be defensively avoided (i.e. use subtraction instead of smacking a minus onto a variable)...
2011/10/30
[ "https://Stackoverflow.com/questions/7946913", "https://Stackoverflow.com", "https://Stackoverflow.com/users/836523/" ]
In addition Signed Zero Good For : The zeroes can be considered as a variant of the extended real number line such that 1/−0 = −∞ and 1/+0 = +∞, division by zero is only undefined for ±0/±0. Negatively signed zero echoes the mathematical analysis concept of approaching 0 from below as a one-sided limit, which may be...
There are only two real use-cases that I can see: 1. You want to show that a value is negative but very very small (perhaps infinitessimal), i.e. too small to represent as a float or double. 2. You are working with math that only allows negatives, but still want to display zero. There are a few cases in physics, compl...
7,946,913
Consider the following C++ code: ``` double someZero = 0; std::cout << 0 - someZero << '\n'; // prints 0 std::cout << -someZero << std::endl; // prints -0 ``` The question arises: what is negative zero good for, and should it be defensively avoided (i.e. use subtraction instead of smacking a minus onto a variable)...
2011/10/30
[ "https://Stackoverflow.com/questions/7946913", "https://Stackoverflow.com", "https://Stackoverflow.com/users/836523/" ]
In addition Signed Zero Good For : The zeroes can be considered as a variant of the extended real number line such that 1/−0 = −∞ and 1/+0 = +∞, division by zero is only undefined for ±0/±0. Negatively signed zero echoes the mathematical analysis concept of approaching 0 from below as a one-sided limit, which may be...
I'm making a measuring app, and the -0 is very useful for mixed numbers (such as separating into feet and inches). Imagine that we have a variable "length" that we're trying to separate into "feet" and "inches". (This is java code, but the same idea is true for C++). ``` feet = Math.signum(length) * Math.floor(Math....
73,674,823
I have a `sorted list` which looks as below: ``` mylist = [-2, -2, 1, 1, 4, 4, 3, 3, 3] ``` The list is sorted in ascending order based upon the number of times it appears. In case of a tie, the list is sorted based upon the values. I need to convert this list into a `square matrix of equal chunks(3*3 in this case)...
2022/09/10
[ "https://Stackoverflow.com/questions/73674823", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5632400/" ]
I assume you want to iterate the output matrix this way (NxN = 5x5 example, 0->24 order): ``` [[ 0, 1, 3, 6, 10], [ 2, 4, 7, 11, 15], [ 5, 8, 12, 16, 19], [ 9, 13, 17, 20, 22], [14, 18, 21, 23, 24]] ``` For each cell, the coordinates (i,j) have their sum equal to the number of the diagonal (`k`) from top-l...
Here's some code to wrap a list backwards up a matrix, which seems to solve this case. Also, your question doesn't make any sense. Diagonally? And how is that list sorted? ``` def create_matrix(lst, n): ret = [[0 for i in range(n)] for i in range(n)] for i in range(n*n-1,-1,-1): ret[i//n][i%n] = lst[n*...
113,762
We currently have a problem with new users being created that are destined for a secondary site collection. When activated they're being sent the wrong links (`www.contoso.co.uk/client` rather than `www.contoso.co.uk/second/brand/client`) and when you browse to the right link they do not have permissions. `www.contoso...
2014/09/02
[ "https://sharepoint.stackexchange.com/questions/113762", "https://sharepoint.stackexchange.com", "https://sharepoint.stackexchange.com/users/33014/" ]
If you are asking about permissions on cross site collections. If you have to two site collections and you want a user access both site collections. Then you need to add the User into Both Site collections. If both Site collections are in same web app, you can add the user in the policy of web app then user will acc...
The sites and subsites are defined by the admins and that decides if they are combined or seperate (breaking the inheritance). How the sites and subsites permissions work togeather , PS : <http://office.microsoft.com/en-us/windows-sharepoint-services-help/about-controlling-access-to-sites-and-site-content-HA010100144....
74,587,741
I have to create a program that tracks a person's motion. F represents forward B represents backward. The values are to be randomly generated between 2-20 as well as the total # of steps being randomly generated from 10-85 (total will decide when the steps will stop). The # of forward steps has to be greater than the #...
2022/11/27
[ "https://Stackoverflow.com/questions/74587741", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20611666/" ]
I would tackle it like this: ```py import random total_steps = random.randint(10, 85) fwd = random.randint(3,(20, total_steps-1)[total_steps<21]) bkwd= random.randint(2,fwd-1) if (fwd+bkwd) > total_steps: bkwd = total_steps-fwd print("Total_steps=", total_steps, ", fwd=", fwd, ", bkwd=", bkwd) # Initialise st...
If I would not have to complicate things, I would just set the `total` steps taken random generation from the sum of `fwd` and `bkwd`. And as per the requirements mentioned, the sum will not be greater or equal to 85. ```py total=random.randint(fwd+bkwd,85) ```
5,697
I will restate the 3-D version of the problem. In how many ways can you color a regular cube with 2 colors up to a rotational isometry. The answer is of course a special case of Burnsides Lemma which can be used to show that the number of distinct face permutations is $\frac{1}{24}(N^6 + 3N^4 + 12N^3 + 8N^2)$ where $N$...
2010/09/29
[ "https://math.stackexchange.com/questions/5697", "https://math.stackexchange.com", "https://math.stackexchange.com/users/1906/" ]
First let's state the special case of Burnside's lemma that is relevant here. **Lemma:** Let $G$ be a finite group acting on a finite set $X$. The number of ways to color the elements of $X$ with $z$ different colors, up to the action of $G$, is $$\frac{1}{|G|} \sum\_{g \in G} z^{c(g)}$$ where $c(g)$ is the number o...
I presume you want to colour the *faces* of the cube? If so there are $2^6$ colourings as there are six faces. But do you want two colourings which are equivalent under rotations (or rotations and reflections) to count as as the same? If so then this is a classic application of [Burnside's lemma](http://en.wikipedia.or...
5,697
I will restate the 3-D version of the problem. In how many ways can you color a regular cube with 2 colors up to a rotational isometry. The answer is of course a special case of Burnsides Lemma which can be used to show that the number of distinct face permutations is $\frac{1}{24}(N^6 + 3N^4 + 12N^3 + 8N^2)$ where $N$...
2010/09/29
[ "https://math.stackexchange.com/questions/5697", "https://math.stackexchange.com", "https://math.stackexchange.com/users/1906/" ]
Once someone else has done the hard work and come up with the answer, as Qiaochu has done, then it's easy to prove it on an *ad hoc* basis as this interloper (me) will do. Consider an $n$-cube with faces coloured red and blue. Consider a set of $n$ balls. Colour the $j$-th ball red, blue or green according to the colo...
I presume you want to colour the *faces* of the cube? If so there are $2^6$ colourings as there are six faces. But do you want two colourings which are equivalent under rotations (or rotations and reflections) to count as as the same? If so then this is a classic application of [Burnside's lemma](http://en.wikipedia.or...
5,697
I will restate the 3-D version of the problem. In how many ways can you color a regular cube with 2 colors up to a rotational isometry. The answer is of course a special case of Burnsides Lemma which can be used to show that the number of distinct face permutations is $\frac{1}{24}(N^6 + 3N^4 + 12N^3 + 8N^2)$ where $N$...
2010/09/29
[ "https://math.stackexchange.com/questions/5697", "https://math.stackexchange.com", "https://math.stackexchange.com/users/1906/" ]
I presume you want to colour the *faces* of the cube? If so there are $2^6$ colourings as there are six faces. But do you want two colourings which are equivalent under rotations (or rotations and reflections) to count as as the same? If so then this is a classic application of [Burnside's lemma](http://en.wikipedia.or...
Here is a contribution that treats the full symmetry group of the hypercube, not just rigid motions. This group can be obtained by labelling the vertices of the cube with the $2^n$ bit strings of length $n$ where adjacency is equivalent to having one bit different between two vertices. Then we obtain the full vertex pe...
5,697
I will restate the 3-D version of the problem. In how many ways can you color a regular cube with 2 colors up to a rotational isometry. The answer is of course a special case of Burnsides Lemma which can be used to show that the number of distinct face permutations is $\frac{1}{24}(N^6 + 3N^4 + 12N^3 + 8N^2)$ where $N$...
2010/09/29
[ "https://math.stackexchange.com/questions/5697", "https://math.stackexchange.com", "https://math.stackexchange.com/users/1906/" ]
First let's state the special case of Burnside's lemma that is relevant here. **Lemma:** Let $G$ be a finite group acting on a finite set $X$. The number of ways to color the elements of $X$ with $z$ different colors, up to the action of $G$, is $$\frac{1}{|G|} \sum\_{g \in G} z^{c(g)}$$ where $c(g)$ is the number o...
Here is a contribution that treats the full symmetry group of the hypercube, not just rigid motions. This group can be obtained by labelling the vertices of the cube with the $2^n$ bit strings of length $n$ where adjacency is equivalent to having one bit different between two vertices. Then we obtain the full vertex pe...
5,697
I will restate the 3-D version of the problem. In how many ways can you color a regular cube with 2 colors up to a rotational isometry. The answer is of course a special case of Burnsides Lemma which can be used to show that the number of distinct face permutations is $\frac{1}{24}(N^6 + 3N^4 + 12N^3 + 8N^2)$ where $N$...
2010/09/29
[ "https://math.stackexchange.com/questions/5697", "https://math.stackexchange.com", "https://math.stackexchange.com/users/1906/" ]
Once someone else has done the hard work and come up with the answer, as Qiaochu has done, then it's easy to prove it on an *ad hoc* basis as this interloper (me) will do. Consider an $n$-cube with faces coloured red and blue. Consider a set of $n$ balls. Colour the $j$-th ball red, blue or green according to the colo...
Here is a contribution that treats the full symmetry group of the hypercube, not just rigid motions. This group can be obtained by labelling the vertices of the cube with the $2^n$ bit strings of length $n$ where adjacency is equivalent to having one bit different between two vertices. Then we obtain the full vertex pe...
46,450,057
I have the following input text: ``` Teterboro US [TEB] - 20KM ``` I would like to get the following output : ``` Teterboro US ``` I am using the following expression : ``` .*\[ ``` But it I am getting the following result ``` Teterboro US [ ``` I would like to get rid of the last space and bracket " [" I ...
2017/09/27
[ "https://Stackoverflow.com/questions/46450057", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7681051/" ]
You can use `/.*?(?=\s*\[)/` with `match`; i.e. change `\[` to look ahead `(?=\s*\[)` which asserts the following pattern but won't consume it: ```js var s = "Teterboro US [TEB] - 20KM"; console.log( s.match(/.*?(?=\s*\[)/) ) ```
You can try this pattern: ``` .*(?= \[) ``` It is `positive lookahead assertion` and it works just like you expect.
46,450,057
I have the following input text: ``` Teterboro US [TEB] - 20KM ``` I would like to get the following output : ``` Teterboro US ``` I am using the following expression : ``` .*\[ ``` But it I am getting the following result ``` Teterboro US [ ``` I would like to get rid of the last space and bracket " [" I ...
2017/09/27
[ "https://Stackoverflow.com/questions/46450057", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7681051/" ]
You can use `/.*?(?=\s*\[)/` with `match`; i.e. change `\[` to look ahead `(?=\s*\[)` which asserts the following pattern but won't consume it: ```js var s = "Teterboro US [TEB] - 20KM"; console.log( s.match(/.*?(?=\s*\[)/) ) ```
Another option (worth mentioning in case you're not familiar with groups) is to catch only the relevant part: ```js var s = "Teterboro US [TEB] - 20KM"; console.log( s.match(/(.*)\[/)[1] ) ``` The regex is: ``` (.*)\[ ``` matches anything followed by "[", but it "remembers" the part surrounded by parenthesis....
46,450,057
I have the following input text: ``` Teterboro US [TEB] - 20KM ``` I would like to get the following output : ``` Teterboro US ``` I am using the following expression : ``` .*\[ ``` But it I am getting the following result ``` Teterboro US [ ``` I would like to get rid of the last space and bracket " [" I ...
2017/09/27
[ "https://Stackoverflow.com/questions/46450057", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7681051/" ]
You can use `/.*?(?=\s*\[)/` with `match`; i.e. change `\[` to look ahead `(?=\s*\[)` which asserts the following pattern but won't consume it: ```js var s = "Teterboro US [TEB] - 20KM"; console.log( s.match(/.*?(?=\s*\[)/) ) ```
You could use: \w+\s+\w+? Depending upon your input
46,450,057
I have the following input text: ``` Teterboro US [TEB] - 20KM ``` I would like to get the following output : ``` Teterboro US ``` I am using the following expression : ``` .*\[ ``` But it I am getting the following result ``` Teterboro US [ ``` I would like to get rid of the last space and bracket " [" I ...
2017/09/27
[ "https://Stackoverflow.com/questions/46450057", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7681051/" ]
You can try this pattern: ``` .*(?= \[) ``` It is `positive lookahead assertion` and it works just like you expect.
Another option (worth mentioning in case you're not familiar with groups) is to catch only the relevant part: ```js var s = "Teterboro US [TEB] - 20KM"; console.log( s.match(/(.*)\[/)[1] ) ``` The regex is: ``` (.*)\[ ``` matches anything followed by "[", but it "remembers" the part surrounded by parenthesis....
46,450,057
I have the following input text: ``` Teterboro US [TEB] - 20KM ``` I would like to get the following output : ``` Teterboro US ``` I am using the following expression : ``` .*\[ ``` But it I am getting the following result ``` Teterboro US [ ``` I would like to get rid of the last space and bracket " [" I ...
2017/09/27
[ "https://Stackoverflow.com/questions/46450057", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7681051/" ]
You can try this pattern: ``` .*(?= \[) ``` It is `positive lookahead assertion` and it works just like you expect.
You could use: \w+\s+\w+? Depending upon your input
403,857
Modern English has some diphthongs ending in /-ɪ/, as in \*oy/oi of "boy/voice", \*ay/ā of "bay/ace", \*ey/ī of "eye/ice", etc. But I haven't found the diphthongs /uɪ, ʌɪ/ (or even /ʊɪ/). Does Modern English have them? If yes, where (in which words)? Did English have them at some time in the past (in Old English, Mid...
2017/08/02
[ "https://english.stackexchange.com/questions/403857", "https://english.stackexchange.com", "https://english.stackexchange.com/users/250563/" ]
[ʌɪ] ---- Assuming we take the symbol "ʌ" to represent more or less the STRUT vowel, some contemporary North American speakers have a diphthong more or less pronounced [ʌɪ] (it could also be transcribed as [əɪ], [ɜɪ], or [ɐɪ]) as an allophone of /aɪ/. For certain other North American speakers, there may be a marginal ...
Phonetically, the diphthong [ʊɪ] still exists in some English accents spoken today, particularly in the words *ruin*, *fluid*, etc. This appears to be characteristic of the accents which exhibit what is called "smoothing," in which a diphthong + /ə/ may be reduced to a simple falling diphthong or even a long monophtho...
464,997
I am attempting to setup Apache + PHP-FPM, however, we have a long running script that was executed and eventually timed out, which severed the link between Apache and FPM ultimately bringing down the whole site... Is there anyway to prevent the whole site from coming down if the --idle-timeout is reached? ``` FastCg...
2018/08/27
[ "https://unix.stackexchange.com/questions/464997", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/31654/" ]
The Apache request to php-fpm [will be aborted when the timeout is reached](https://wiki.apache.org/httpd/HelpOnInstalling/FastCgi). Thus for the user as well. If you want the end client to get a response, there are three possibilities that come to mind: 1. increase your timeout value (since you PHP application is slo...
Long running scripts should not be run from the browser/Apache. You should run it in the background with PHP CLI instead of FPM. CLI scripts do not timeout and do not interfere with Apache operation. You can either schedule the script to run regularly by using cronjobs or you can make it trigger from the browser by do...
3,455,711
I am storing a string (url) in a variable it can look like one/two/three/test.aspx?ID=12312 I want to extract the querystring value, not from window.location but from the html I thought I could use substring and write ``` var link = ($(this).find('a').attr('href')); var qs = link.substring( link.indexOf("="), text....
2010/08/11
[ "https://Stackoverflow.com/questions/3455711", "https://Stackoverflow.com", "https://Stackoverflow.com/users/416735/" ]
A while ago, I'd written a short function for this: ``` /** * Gets the query parameters of the given URI as a associative array or map * e.g. Given a URI http://www.level3labs.com/jaf?foo=bar&baz=bazzm, will * give {"foo":"bar", "baz":"bazzm"} * @param {URI} strUri The uri with a query * @return Objec...
Just omit the second parameter. In this case, should return the end of the string starting at the provided index.