qid
int64
1
74.7M
question
stringlengths
15
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
4
30.2k
response_k
stringlengths
11
36.5k
66,738,678
### When I load the following code using php... `<?php <h1>Some text</h1> ?>` ### the tags are printed as text - `<h1>Some text</h1>` ### Any ideas? Found the answer - see my answer. =================================
2021/03/21
[ "https://Stackoverflow.com/questions/66738678", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14920090/" ]
You need to output the actual HTML code if you are placing any HTML code within PHP. You can achieve this using [`echo()`](https://www.php.net/manual/en/function.echo.php). ```php <?php echo("<h1>Some text</h1>"); ?> ```
Found the issue, the content-type was set as json.
66,738,678
### When I load the following code using php... `<?php <h1>Some text</h1> ?>` ### the tags are printed as text - `<h1>Some text</h1>` ### Any ideas? Found the answer - see my answer. =================================
2021/03/21
[ "https://Stackoverflow.com/questions/66738678", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14920090/" ]
You need to output the actual HTML code if you are placing any HTML code within PHP. You can achieve this using [`echo()`](https://www.php.net/manual/en/function.echo.php). ```php <?php echo("<h1>Some text</h1>"); ?> ```
``` <?php echo "<h1>Some text</h1>"; ?> ``` ``` <?php echo "<h1>Some text</h1>"; ?> ``` if you want to show a variable ``` <?php $_varTest=2; echo "<h1>Show variable {$_varTest}</h1>"; ?> ```
66,738,678
### When I load the following code using php... `<?php <h1>Some text</h1> ?>` ### the tags are printed as text - `<h1>Some text</h1>` ### Any ideas? Found the answer - see my answer. =================================
2021/03/21
[ "https://Stackoverflow.com/questions/66738678", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14920090/" ]
``` <h1><?php Some text ?></h1> ``` why dont you try this.
You must print it in order for it to appear the way you want it to ``` <?php echo"<h1>Some text</h1>" ?> ``` like this
66,738,678
### When I load the following code using php... `<?php <h1>Some text</h1> ?>` ### the tags are printed as text - `<h1>Some text</h1>` ### Any ideas? Found the answer - see my answer. =================================
2021/03/21
[ "https://Stackoverflow.com/questions/66738678", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14920090/" ]
``` <h1><?php Some text ?></h1> ``` why dont you try this.
Found the issue, the content-type was set as json.
66,738,678
### When I load the following code using php... `<?php <h1>Some text</h1> ?>` ### the tags are printed as text - `<h1>Some text</h1>` ### Any ideas? Found the answer - see my answer. =================================
2021/03/21
[ "https://Stackoverflow.com/questions/66738678", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14920090/" ]
``` <h1><?php Some text ?></h1> ``` why dont you try this.
``` <?php echo "<h1>Some text</h1>"; ?> ``` ``` <?php echo "<h1>Some text</h1>"; ?> ``` if you want to show a variable ``` <?php $_varTest=2; echo "<h1>Show variable {$_varTest}</h1>"; ?> ```
29,790,865
Say I have the following: ``` wchar_t *str = L"Hello World!"; ``` Is `L"Hello World!"` encoded in UTF-16LE or UTF-16BE? **Note:** I am using Visual C++ 2010.
2015/04/22
[ "https://Stackoverflow.com/questions/29790865", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4582812/" ]
Depends on your editor, VS2010 uses UTF-8 by default :) With a BOM so the compiler can tell. It can be changed, click the arrow on the Save button. The compiler will turn it into UTF-16LE in the object file, there are no remaining big-endian machines supported by msvc++ that I know of, ARM cores all run little-endian ...
You can safely assume that any wide character string on Windows uses little endian UTF-16 - see this answer for a more elaborate dive: [Can I safely assume that Windows installations will always be little-endian?](https://stackoverflow.com/questions/6449468/can-i-safely-assume-that-windows-installations-will-always-be-...
33,259,989
I have a method to get an image from a server, that image I'm getting it as a byte array so I'm converting to [UInt8]. The problem is that I don't find a way to convert the [UInt8] to an Image to show in my application. This is the code that I'm using to get the image from the server: ``` func GetSnapshotFromCamera(...
2015/10/21
[ "https://Stackoverflow.com/questions/33259989", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5428766/" ]
What you want to do is convert the binary array ([UInt8]) into NSData first. You can do that with: ``` let data = NSData(bytes: [UInt8], length: 2) ``` (You need to give the length of the byte array) After converting (and unwrapping every optional) convert it to UIImage with: ``` let image = UIImage(data: data) `...
try this: ``` if let array = try GetSnapshotFromCamera(...) { let data = NSData(bytes: array, length: array.count) let image = UIImage(data: data) } ```
35,867,829
I generate form fields dynamically using ng-repeat. Everything works fine. But now I want to use angular datepicker component and it is based on a directive. The problem is that this seems only to work for static content/id attributes. In case of the dynamic ones I get "field.Key" - the placeholder value -, and not t...
2016/03/08
[ "https://Stackoverflow.com/questions/35867829", "https://Stackoverflow.com", "https://Stackoverflow.com/users/250773/" ]
```js $(document).ready(function(){ $("form").trigger("submit"); }); $('form').on('submit', function() { alert("ya"); }); ``` ```html <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script> <form method="post" action="action.php"> // somany divs <input type="hidden" na...
If you want to submit you can use this code which is not using jquery, it is the plain js function ``` document.forms["formname"].submit(); ``` And you need to have a form, which you identify with an id attribute in the form tag ``` <form id='formname' action='mypage.html'> ```
52,393,047
Do you know why sync fibonacci method is faster than async/await and that is faster than async task? I used async on every project method, so it's main this is so bad approach... Code: ``` static int FibonacciSync(int number) { if (number == 0) { return 0; } else if (number ==...
2018/09/18
[ "https://Stackoverflow.com/questions/52393047", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3859310/" ]
> > Do you know why sync fibonacci method is faster than async/await and that is faster than async task? > > > Asynchrony is not about improving *raw speed*. As you've discovered, it takes longer overall. If you use it poorly, as you have done, it makes things much, much slower for zero benefit. The fundamental p...
a good rule of thumb: only use async calls for functions that use an external resource: file system, database, http calls, ... when you do in memory stuff, like calculating fibonacci, do it sync, the overhead of creating a seperate thread/context for in memory calculation is too much unless you have a ui thread that ...
57,834,492
I have a string like this: `"my bike, is very big"` and i would like to split it in the following way. ``` ["my","bike",",","is","very","big"] ```
2019/09/07
[ "https://Stackoverflow.com/questions/57834492", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7162942/" ]
What you describe is (almost) the [round half up](https://en.wikipedia.org/wiki/Rounding#Round_half_up) strategy. However using `int` it won't work for negative numbers: ``` >>> def round_half_up(x, n=0): ... shift = 10 ** n ... return int(x*shift + 0.5) / shift ... >>> round_half_up(-1.26, 1) -1.2 ``` Inst...
My understanding is that your suggestion of `int(x+0.5)` should work fine because it returns an integer object that will be exact. However, your subsequent suggestion of dividing by 1000 to round to a certain number of decimal places will return a floating point object so will suffer from exactly the issue you are tryi...
37,532
If I have two dependent continuous random variables $X$ and $Y$ with known pdf's $f(x)$ and $f(y)$. How to calculate their join probability distribution $f(x, y)$? For example if $Y = \sin{X}$ and I want to calculate the pdf of $Z$ where $Z = \frac{X}{Y}$ or $Z = X - Y$. So, how to find out $f(x, y)$ first?
2011/05/07
[ "https://math.stackexchange.com/questions/37532", "https://math.stackexchange.com", "https://math.stackexchange.com/users/953/" ]
If $Y$ is a regular function of $X$, $(X,Y)$ cannot have a density since $(X,Y)$ is always on the graph of the function, which has measure zero. But you should not use this to compute the distribution of $Z$ a function of $X$. Rather, you could use the fact that $Z$ has density $f\_Z$ if and only if, for every measur...
You can't. You need to know how they are dependent.
44,316,854
I really think that it would be beneficial to my workflow if I could just include a fully-functional component with a single php function call. Something like ddl(); Which would produce an HTML drop down list, fully styled and functional. With external resources, I need to worry about including the JavaScript and CSS...
2017/06/01
[ "https://Stackoverflow.com/questions/44316854", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5644982/" ]
For small projects - one to three pages - you probably won't ever notice much of an issue. Especially if you never duplicate functionality. However, if you want a scalable application, you really need to separate form from function. Style sheets are actually easier to maintain by looking at the relationship of styles a...
1. Easier to manage cache, which will reduce bandwidth usage 2. No code duplication 3. Better practice for scalability purposes - maybe you have a interaction designer, graphical designer and a software developer. You wouldn't want everyone to work on the same file
2,943,875
Using a google code svn as a basic maven repository is easy. However, using mvn site:deploy efficiently on google code seems hard. So far, I found only these solutions: * Deploy to a local file:/// and use a PERL script to delete the old and copy the new. Source: <http://www.mail-archive.com/users@maven.apache.org/m...
2010/05/31
[ "https://Stackoverflow.com/questions/2943875", "https://Stackoverflow.com", "https://Stackoverflow.com/users/123280/" ]
Would a solution like rsync be easier? You essentially want to mirror a locally-generated tree of HTML etc., to a remote server. Otherwise, you could get Maven to generate and publish the site as part of a continuous integration build using, say, Hudson. Not suitable if you need the site to be globally available - unl...
I'd suggest you to use <https://maven2-repository.dev.java.net/> to deploy your open source artifacts. Quite simple to configure and use. The main "issue" is that you'll need to create an account but you can use it only to deploy the artifacts and still have your source code hosted on Google Code
2,943,875
Using a google code svn as a basic maven repository is easy. However, using mvn site:deploy efficiently on google code seems hard. So far, I found only these solutions: * Deploy to a local file:/// and use a PERL script to delete the old and copy the new. Source: <http://www.mail-archive.com/users@maven.apache.org/m...
2010/05/31
[ "https://Stackoverflow.com/questions/2943875", "https://Stackoverflow.com", "https://Stackoverflow.com/users/123280/" ]
I've found good instruction to do what do you want with good responses: <http://babyloncandle.blogspot.com/2009/04/deploying-maven-artifacts-to-googlecode.html> But I suggest to use normal simple http hosting, because it is much more faster than Google Code SVN. Your project is not the one, which needs site, while lo...
I'd suggest you to use <https://maven2-repository.dev.java.net/> to deploy your open source artifacts. Quite simple to configure and use. The main "issue" is that you'll need to create an account but you can use it only to deploy the artifacts and still have your source code hosted on Google Code
2,943,875
Using a google code svn as a basic maven repository is easy. However, using mvn site:deploy efficiently on google code seems hard. So far, I found only these solutions: * Deploy to a local file:/// and use a PERL script to delete the old and copy the new. Source: <http://www.mail-archive.com/users@maven.apache.org/m...
2010/05/31
[ "https://Stackoverflow.com/questions/2943875", "https://Stackoverflow.com", "https://Stackoverflow.com/users/123280/" ]
How to deploy maven artifact to Google code svn? I. Create m2 folder with releases and snaphots subfolders II. Add dependency to [maven-svn-wagon](http://code.google.com/p/maven-svn-wagon/) ``` <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-deploy-plugin</artifactId> ...
I'd suggest you to use <https://maven2-repository.dev.java.net/> to deploy your open source artifacts. Quite simple to configure and use. The main "issue" is that you'll need to create an account but you can use it only to deploy the artifacts and still have your source code hosted on Google Code
2,943,875
Using a google code svn as a basic maven repository is easy. However, using mvn site:deploy efficiently on google code seems hard. So far, I found only these solutions: * Deploy to a local file:/// and use a PERL script to delete the old and copy the new. Source: <http://www.mail-archive.com/users@maven.apache.org/m...
2010/05/31
[ "https://Stackoverflow.com/questions/2943875", "https://Stackoverflow.com", "https://Stackoverflow.com/users/123280/" ]
Here is the simplest configuration that works for me in my Google code projects that have a maven repository on Google code svn: ``` <build> ... <extensions> <extension> <groupId>org.jvnet.wagon-svn</groupId> <artifactId>wagon-svn</artifactId> <version>1.9</version> </extension> </exten...
I'd suggest you to use <https://maven2-repository.dev.java.net/> to deploy your open source artifacts. Quite simple to configure and use. The main "issue" is that you'll need to create an account but you can use it only to deploy the artifacts and still have your source code hosted on Google Code
2,943,875
Using a google code svn as a basic maven repository is easy. However, using mvn site:deploy efficiently on google code seems hard. So far, I found only these solutions: * Deploy to a local file:/// and use a PERL script to delete the old and copy the new. Source: <http://www.mail-archive.com/users@maven.apache.org/m...
2010/05/31
[ "https://Stackoverflow.com/questions/2943875", "https://Stackoverflow.com", "https://Stackoverflow.com/users/123280/" ]
How to deploy maven artifact to Google code svn? I. Create m2 folder with releases and snaphots subfolders II. Add dependency to [maven-svn-wagon](http://code.google.com/p/maven-svn-wagon/) ``` <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-deploy-plugin</artifactId> ...
Would a solution like rsync be easier? You essentially want to mirror a locally-generated tree of HTML etc., to a remote server. Otherwise, you could get Maven to generate and publish the site as part of a continuous integration build using, say, Hudson. Not suitable if you need the site to be globally available - unl...
2,943,875
Using a google code svn as a basic maven repository is easy. However, using mvn site:deploy efficiently on google code seems hard. So far, I found only these solutions: * Deploy to a local file:/// and use a PERL script to delete the old and copy the new. Source: <http://www.mail-archive.com/users@maven.apache.org/m...
2010/05/31
[ "https://Stackoverflow.com/questions/2943875", "https://Stackoverflow.com", "https://Stackoverflow.com/users/123280/" ]
Here is the simplest configuration that works for me in my Google code projects that have a maven repository on Google code svn: ``` <build> ... <extensions> <extension> <groupId>org.jvnet.wagon-svn</groupId> <artifactId>wagon-svn</artifactId> <version>1.9</version> </extension> </exten...
Would a solution like rsync be easier? You essentially want to mirror a locally-generated tree of HTML etc., to a remote server. Otherwise, you could get Maven to generate and publish the site as part of a continuous integration build using, say, Hudson. Not suitable if you need the site to be globally available - unl...
2,943,875
Using a google code svn as a basic maven repository is easy. However, using mvn site:deploy efficiently on google code seems hard. So far, I found only these solutions: * Deploy to a local file:/// and use a PERL script to delete the old and copy the new. Source: <http://www.mail-archive.com/users@maven.apache.org/m...
2010/05/31
[ "https://Stackoverflow.com/questions/2943875", "https://Stackoverflow.com", "https://Stackoverflow.com/users/123280/" ]
How to deploy maven artifact to Google code svn? I. Create m2 folder with releases and snaphots subfolders II. Add dependency to [maven-svn-wagon](http://code.google.com/p/maven-svn-wagon/) ``` <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-deploy-plugin</artifactId> ...
I've found good instruction to do what do you want with good responses: <http://babyloncandle.blogspot.com/2009/04/deploying-maven-artifacts-to-googlecode.html> But I suggest to use normal simple http hosting, because it is much more faster than Google Code SVN. Your project is not the one, which needs site, while lo...
2,943,875
Using a google code svn as a basic maven repository is easy. However, using mvn site:deploy efficiently on google code seems hard. So far, I found only these solutions: * Deploy to a local file:/// and use a PERL script to delete the old and copy the new. Source: <http://www.mail-archive.com/users@maven.apache.org/m...
2010/05/31
[ "https://Stackoverflow.com/questions/2943875", "https://Stackoverflow.com", "https://Stackoverflow.com/users/123280/" ]
Here is the simplest configuration that works for me in my Google code projects that have a maven repository on Google code svn: ``` <build> ... <extensions> <extension> <groupId>org.jvnet.wagon-svn</groupId> <artifactId>wagon-svn</artifactId> <version>1.9</version> </extension> </exten...
I've found good instruction to do what do you want with good responses: <http://babyloncandle.blogspot.com/2009/04/deploying-maven-artifacts-to-googlecode.html> But I suggest to use normal simple http hosting, because it is much more faster than Google Code SVN. Your project is not the one, which needs site, while lo...
7,712,418
Can you help to achieve the goal I mentioned in the commented block below to complete sample unit test? Idea is how to check on a mock object, if one of its methods is called with a type instance that has a particular property is set to expected value/ ``` private IMyObject stub = MockRepository.GenerateMock<IMyObjec...
2011/10/10
[ "https://Stackoverflow.com/questions/7712418", "https://Stackoverflow.com", "https://Stackoverflow.com/users/136141/" ]
I think you're looking for argument constraints in Rhino Mocks. I had a go at a few of the frameworks sometime ago - [link](http://madcoderspeak.blogspot.com/2010/01/meet-frameworks-rhino-v-moq-v-jmock.html#scen9). I think you're looking for `Arg<IViewModel>.Matches (vm => vm.Person.Name == "Peter" )`
Look at the [reference](http://ayende.com/wiki/Rhino+Mocks+3.5.ashx): ``` stub.AsswertWasCalled(s=>s.Render(Arg<IViewModel>.Property("Person", "John"))) ```
2,555,856
Here is theorem 1.14 from Rudin's RCA: > > If $f\_n : X \to [-\infty, \infty]$ is measurable for $n=1,2,3,...$, and $g = \sup\_{n \ge 1} f\_n$ and $h = \limsup\limits\_{n \to \infty} f\_n$, then $g$ and $h$ are measurable. > > > Immediately following this is the corollary (a): > > The limit of every pointwise c...
2017/12/07
[ "https://math.stackexchange.com/questions/2555856", "https://math.stackexchange.com", "https://math.stackexchange.com/users/193319/" ]
Hint: Apply the theorem for $-f\_n$. You will get the inf version and the liminf version. Now when limsup and liminf are measurable, what can you say about the limit when it exists? Update: Sorry I didn't read your question fully. You wanted to know how this result for reals extends to complex functions. Well, any co...
I think the $h$ should be $h=\lim\_{n}\sup\_{k\geq n}f\_{k}$. If we can show that for each $n$, $\sup\_{k\geq n}f\_{k}$ is measurable, then the corollary applies to $h$ along with $(\sup\_{k\geq n}f\_{k})\_{n}$. Now we see that \begin{align\*} \left(\sup\_{k\geq n}f\_{k}\right)^{-1}(a,\infty]=\bigcup\_{k\geq n}f\_{k}^...
69,863,212
This is my script mytest.py. ``` import argparse parser = argparse.ArgumentParser(description="Params") parser.add_argument( "--value") def test(args): print(args.value) args = parser.parse_args() test(args) ``` I want to pass argument store in variable `val` ``` val =1 !python mytest.py --value val ``...
2021/11/06
[ "https://Stackoverflow.com/questions/69863212", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11170350/" ]
You want to `sapply`/`lapply` the `get` function here. For example: ```r a <- c(2, 5, NA, NA, 6, NA) b <- c(NA, 1, 3, 4, NA, 8) nmes <- c("a", "b") # Apply get() to each name in the nmes vector # Then convert the resulting matrix to a data frame as.data.frame(sapply(nms, get)) ``` ``` a b 1 2 NA 2 5 1 3 NA ...
We can use `mget` to 'get' a list, then `"loop-unlist"` with `sapply` and `function(x) x` or `[` to create a matrix ``` sapply(mget(vectornames), \(x) x) #OR sapply(mget(vectornames), `[`) a b [1,] 2 NA [2,] 5 1 [3,] NA 3 [4,] NA 4 [5,] 6 NA [6,] NA 8 ```
38,936,124
This media query is not working as I expected it to. What I want to do is hide an element if the window is below 544px, and also hide it if it is above 767px. So it will only be visible while the window is between 544px and 767px. ``` @media (max-width: 544px) and (min-width: 767px) { .show-sm-only { dis...
2016/08/13
[ "https://Stackoverflow.com/questions/38936124", "https://Stackoverflow.com", "https://Stackoverflow.com/users/425823/" ]
You can combine two media queries in one, like this: ``` @media (max-width: 544px), (min-width: 767px) { .show-sm-only { display: none !important; } } ``` **EDIT** This will hide `.show-sm-only` on screen smaller than (max-width) 544px and on screen bigger than (min-width) 767px.
You want this, your rules are the wrong way round. Right now you're saying it must be smaller than (max-width) 544px, but bigger than (min-width) 767px, which is impossible. See below how they are the other way round. **EDIT** As per the comments. To do `or` (instead of `and`, which for your situation is impossible),...
38,936,124
This media query is not working as I expected it to. What I want to do is hide an element if the window is below 544px, and also hide it if it is above 767px. So it will only be visible while the window is between 544px and 767px. ``` @media (max-width: 544px) and (min-width: 767px) { .show-sm-only { dis...
2016/08/13
[ "https://Stackoverflow.com/questions/38936124", "https://Stackoverflow.com", "https://Stackoverflow.com/users/425823/" ]
If you want a media query that is applied when BOTH conditions are true (which I think is what you're looking for here), use another `and`. Here it's hidden by default, and only visible when between 544px to 767px. ``` .my-element { display: none; @media (min-width: 544px) and (max-width: 767px) { display: bl...
You want this, your rules are the wrong way round. Right now you're saying it must be smaller than (max-width) 544px, but bigger than (min-width) 767px, which is impossible. See below how they are the other way round. **EDIT** As per the comments. To do `or` (instead of `and`, which for your situation is impossible),...
38,936,124
This media query is not working as I expected it to. What I want to do is hide an element if the window is below 544px, and also hide it if it is above 767px. So it will only be visible while the window is between 544px and 767px. ``` @media (max-width: 544px) and (min-width: 767px) { .show-sm-only { dis...
2016/08/13
[ "https://Stackoverflow.com/questions/38936124", "https://Stackoverflow.com", "https://Stackoverflow.com/users/425823/" ]
You can combine two media queries in one, like this: ``` @media (max-width: 544px), (min-width: 767px) { .show-sm-only { display: none !important; } } ``` **EDIT** This will hide `.show-sm-only` on screen smaller than (max-width) 544px and on screen bigger than (min-width) 767px.
If you want a media query that is applied when BOTH conditions are true (which I think is what you're looking for here), use another `and`. Here it's hidden by default, and only visible when between 544px to 767px. ``` .my-element { display: none; @media (min-width: 544px) and (max-width: 767px) { display: bl...
89,024
I have a window with a moving vertical part, so to open and close this window I need to slide the moving part left or right. And the window has horizontal blinds on it. I'd like to install a portable A/C and put its exhaust into this window, but I think the portable A/C exhaust would get in the way of the blinds. Wh...
2016/04/20
[ "https://diy.stackexchange.com/questions/89024", "https://diy.stackexchange.com", "https://diy.stackexchange.com/users/52902/" ]
The deeper the better; ideally, it should be as deep as the range. Closer to the burners is better too, as is a higher airflow, within reason. Beyond 300 CFM, you might need a makeup air system or to be diligent about opening a window when it's running. More info: <http://www.greenbuildingadvisor.com/blogs/dept/green-...
I couldn't find anything in International Residential Code that specifies range hood size, so it would appear that size is more of a style choice. Table M1507.4 does say that the minimum exhaust rate of the hood must be 100 CFM intermittent, or 25 CFM continuous. Section M1503.4 of the IRC says that if the exhaust ho...
711,856
Question: $$ \text{It is given that } y= \frac{3a+2}{2a-4} \text{and }x= \frac{a+3}{a+8} \\ $$ $$ \text{Express } y \text{ in terms of } x. $$ From using $x$ to solve for $a$, I discovered that $$ a = \frac{8x-3}{1-x} $$ Then I proceeded to substitute $a$ into $y$. I did this twice to ensure no mistakes are made,...
2014/03/14
[ "https://math.stackexchange.com/questions/711856", "https://math.stackexchange.com", "https://math.stackexchange.com/users/90332/" ]
Your answer is $$\frac{22x-7}{20x-10}$$ And the books "correct" answer is $$\frac{7-22x}{10-20x}$$ Yes? Notice what happens when you multiply both the numerator and denominator in your answer by $-1$? You're very welcome.
You got the correct answer. Just multiply both numerator and denominator by -1 $$\frac{22x-7}{20x-10} = \frac{-1}{-1} \times \frac{7-22x}{10-20x}$$
25,423,477
I´m coding my own real time visitors counter in PHP and ajax. Everything is working OK, but there is one small problem, being that every time the ajax call is made it counts as an extra visit. I know how to sort out specific visitors based on User Agents, such as bots etc., so if I could only specify a User Agent in t...
2014/08/21
[ "https://Stackoverflow.com/questions/25423477", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2104024/" ]
Don't know PHP, but in C# this is how I determine if it is AJAX from jQuery: ``` if (Request.Headers["X-Requested-With"] == "XMLHttpRequest"){ // this is AJAX } ``` So you can avoid updating your db if above is `true`. I'm sure you know the equivalent in PHP.
> > Everything is working OK, but there is one small problem, being that every time the ajax call is made it counts as an extra visit. > > > A (somewhat) better solution is make a user identifiable using a certain value. I suggest cookies. * Generate a cookie on page load containing a unique value, like some UUID...
25,423,477
I´m coding my own real time visitors counter in PHP and ajax. Everything is working OK, but there is one small problem, being that every time the ajax call is made it counts as an extra visit. I know how to sort out specific visitors based on User Agents, such as bots etc., so if I could only specify a User Agent in t...
2014/08/21
[ "https://Stackoverflow.com/questions/25423477", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2104024/" ]
Don't know PHP, but in C# this is how I determine if it is AJAX from jQuery: ``` if (Request.Headers["X-Requested-With"] == "XMLHttpRequest"){ // this is AJAX } ``` So you can avoid updating your db if above is `true`. I'm sure you know the equivalent in PHP.
I found out that the ajax call did in fact not cause visit hits. The rogue hit counts came from another compontent in CMS system, and I fixed this by tweaking the core engine to disregard counts when user reloads same page. Pretty simple.
15,854,442
In my broadcast receiver activity I need to run some code when an alert is fired which I can get working no problem, but I need to make sure my Map activity is on the screen when this code is run, so I am trying to start the Map activity with an intent but this crashes the application and I do not know why. Here is the...
2013/04/06
[ "https://Stackoverflow.com/questions/15854442", "https://Stackoverflow.com", "https://Stackoverflow.com/users/567371/" ]
You should pass the variables though intent ``` public void accessMap(Context context) { Intent openNext = new Intent("com.timer.MAP"); openNext.putExtra("destination", null); openNext.putExtra("goingToLat", 0); openNext.putExtra("text for mtv", "Select a new Destination!"); ......... openNext.setFlags(Intent.FLAG_AC...
You can create a Notification and show it. If the user clicks on the Notification then you can launch your Map screen.
15,854,442
In my broadcast receiver activity I need to run some code when an alert is fired which I can get working no problem, but I need to make sure my Map activity is on the screen when this code is run, so I am trying to start the Map activity with an intent but this crashes the application and I do not know why. Here is the...
2013/04/06
[ "https://Stackoverflow.com/questions/15854442", "https://Stackoverflow.com", "https://Stackoverflow.com/users/567371/" ]
You should pass the variables though intent ``` public void accessMap(Context context) { Intent openNext = new Intent("com.timer.MAP"); openNext.putExtra("destination", null); openNext.putExtra("goingToLat", 0); openNext.putExtra("text for mtv", "Select a new Destination!"); ......... openNext.setFlags(Intent.FLAG_AC...
Set the flag `FLAG_ACTIVITY_NEW_TASK` on the `Intent`. But you really shouldn't be launching activity in this way. An activity seemingly popping up out of nowhere is a weird/undesirable user experience. The notification you are setting should be sufficient, then the user can decide whether he/she wants to launch your ...
249,691
If TLS communication uses ciphers that does not support forward secrecy[FS] (like RSA key exchange ciphers), confidentiality of the past communication is compromised if the private key is compromised. But will the integrity also gets compromised in this scenario? I got this doubt after seeing the CVSS scoring in this [...
2021/05/25
[ "https://security.stackexchange.com/questions/249691", "https://security.stackexchange.com", "https://security.stackexchange.com/users/153738/" ]
Generally, the integrity wouldn't be impacted. Usually it can't be, really, since the communication was presumably recorded some time ago. However, the symmetric key used for integrity (HMACs or AEAD modes) is exposed, and that could be a meaningful impact in some specific cases. 1. The attacker has a man-in-the-middl...
The core idea here is that with RSA key transport the client generates a session key, ***encrypts*** it for the server using the server's RSA public key, and sends it. If an attacker gets a copy of the server's RSA private key, then they can passively sniff future traffic, decrypt any TLS handshake and extract the sess...
287,689
When e.g. a bunch of zerglings surround, say, a marauder, the latter seems to die fast. Is that just because it is attacked by so many units at once, or is there some hidden mechanic? Do the zerglings get some sort of special bonus to attack speed or damage? Is the surrounded unit paralysed? Is it immobilised?
2016/10/10
[ "https://gaming.stackexchange.com/questions/287689", "https://gaming.stackexchange.com", "https://gaming.stackexchange.com/users/10967/" ]
No there are no special bonuses. Surrounding is just an effective tactic in some situations. In your example you have Zerglings surrounding a single marauder. I haven't played in a while but to surround a marauder with Zerglings you will probably need about 6-8 zerglings. This means you have 6(+) zerglings attacking a...
"Surrounding" is just a type of micro (micro is optimizing your army unit's attack and defense by controlling them well) that works well for your melee ground units. It spreads them out in such a way that the maximum number possible are attacking the target at the same time. It also prevents the attacked units from usi...
24,118,819
``` package com.example.nrbapp; import java.util.ArrayList; import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBar; import android.support.v4.app.Fragment; import android.content.Context; import android.graphics.Color; import android.graphics.Typeface; import android.os.Bundle; impor...
2014/06/09
[ "https://Stackoverflow.com/questions/24118819", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3702641/" ]
In your `onCreate()`: ``` setContentView(R.layout.activity_search_result); ``` So the linear layout "tr" is referenced in activity\_search\_result, which is why the NPE when referenced for the textview. this happens for the activity, where as your `linearlayout` is probably defined inside the fragment layout, (...
Where is your LinearLayout t1, inside activity\_search\_result.xml or fragment\_search\_result? That could be mistake...
53,672,523
I'm a student, new to LINQ and we've been given an assignment to deal with LINQ queries. My problem is I've been struggling the past days to figure out the correct way to perform this step: print the customers name that has "Milk" inside their orders. ``` Write a LINQ query to select all customers buying milk. Print ...
2018/12/07
[ "https://Stackoverflow.com/questions/53672523", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6327327/" ]
In your example, the call to `TryUpdateModelAsync` ends up setting properties on your `adminUpdate` instance based on values found in `ModelState`. If you want to set another value for `Password`, you can just do so after the call to `TryUpdateModelAsync`, like this: ``` if (await TryUpdateModelAsync( adminUpdate,...
Can you try to add new line (right above TryUpdateModelAsync ) ``` adminUpdate.Password = password; if (await TryUpdateModelAsync( adminUpdate, ```
4,945,956
It's been while for release of MIDP 3.0 spec. But is there any device which supports this specifications ?
2011/02/09
[ "https://Stackoverflow.com/questions/4945956", "https://Stackoverflow.com", "https://Stackoverflow.com/users/255507/" ]
I don't believe there are any commercially-available MIDP 3.0 phones available yet. The [Java ME benchmark list](http://www.club-java.com/TastePhone/J2ME/MIDP_Benchmark.jsp) only shows MIDP 2.1 as the highest supported version. Even Motorola, the spec lead, does not [list any MIDP 3.0 phones](http://developer.motorola....
Samsung galaxy pro b7510 support MIDP 3.0.Refer the link [Midp3.0 supported device](http://www.newcellphoneprices.com/filter_view.php?filter_type=java&filter=3&txt=MIDP%203.0) Some of **android** phones support **MIDP 3.0**
37,601,346
How do I create an Options Menu like in the following Screenshot: [![enter image description here](https://i.stack.imgur.com/wxPNk.png)](https://i.stack.imgur.com/wxPNk.png) The Options Menu should be opened afther clicking on the "More"-Icon of a RecyclerView Item! My try was this: ``` @Override public void onBind...
2016/06/02
[ "https://Stackoverflow.com/questions/37601346", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5994190/" ]
step.1 add Recyclerview view layout. step.2 Recyclerview rows layout recycler\_item.xml ``` <?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:card_view="http://schemas.android.com/apk/res-auto" android:layout_width="matc...
I guess it is better to handle click event in Activity as TaskAdapter ``` public void onBindViewHolder(final TaskViewHolder holder, final int position) { holder.name.setText(obj.get(position).getName()); Date date =obj.get(position).getUpdate_date(); String pattern = "dd-MM-YYYY"; SimpleDateFormat sim...
37,601,346
How do I create an Options Menu like in the following Screenshot: [![enter image description here](https://i.stack.imgur.com/wxPNk.png)](https://i.stack.imgur.com/wxPNk.png) The Options Menu should be opened afther clicking on the "More"-Icon of a RecyclerView Item! My try was this: ``` @Override public void onBind...
2016/06/02
[ "https://Stackoverflow.com/questions/37601346", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5994190/" ]
It is very easy to create an option menu like this. Just add a button in your list item design. You can use the following string to display 3 vertical dots. ``` <TextView android:id="@+id/textViewOptions" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignPare...
All the answers above are great. I just wanna add a small tip. making the 'more' button with *textView* is also a good solution but there is a more convenient way to do that. you can get the vector asset from *vector asset* menu in the android studio and use this asset to any button or view wherever you want. ``` //fo...
37,601,346
How do I create an Options Menu like in the following Screenshot: [![enter image description here](https://i.stack.imgur.com/wxPNk.png)](https://i.stack.imgur.com/wxPNk.png) The Options Menu should be opened afther clicking on the "More"-Icon of a RecyclerView Item! My try was this: ``` @Override public void onBind...
2016/06/02
[ "https://Stackoverflow.com/questions/37601346", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5994190/" ]
I found out that the only Menu, that looks like the Menu above is the `PopupMenu`. So in `onClick`: ``` @Override public void onClick(View view, int position, MotionEvent e) { ImageButton btnMore = (ImageButton) view.findViewById(R.id.item_song_btnMore); if (RecyclerViewOnTouchListener.isViewClicked(btnMore,...
**Simple Code In Kotlin : -** ``` holder!!.t_description!!.setOnClickListener { val popup = PopupMenu(context, holder.t_description) popup.inflate(R.menu.navigation) popup.setOnMenuItemClickListener(object : PopupMenu.OnMenuItemClickListener{ override fun onMenuItemClick(p0: MenuI...
37,601,346
How do I create an Options Menu like in the following Screenshot: [![enter image description here](https://i.stack.imgur.com/wxPNk.png)](https://i.stack.imgur.com/wxPNk.png) The Options Menu should be opened afther clicking on the "More"-Icon of a RecyclerView Item! My try was this: ``` @Override public void onBind...
2016/06/02
[ "https://Stackoverflow.com/questions/37601346", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5994190/" ]
step.1 add Recyclerview view layout. step.2 Recyclerview rows layout recycler\_item.xml ``` <?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:card_view="http://schemas.android.com/apk/res-auto" android:layout_width="matc...
All the answers above are great. I just wanna add a small tip. making the 'more' button with *textView* is also a good solution but there is a more convenient way to do that. you can get the vector asset from *vector asset* menu in the android studio and use this asset to any button or view wherever you want. ``` //fo...
37,601,346
How do I create an Options Menu like in the following Screenshot: [![enter image description here](https://i.stack.imgur.com/wxPNk.png)](https://i.stack.imgur.com/wxPNk.png) The Options Menu should be opened afther clicking on the "More"-Icon of a RecyclerView Item! My try was this: ``` @Override public void onBind...
2016/06/02
[ "https://Stackoverflow.com/questions/37601346", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5994190/" ]
I found out that the only Menu, that looks like the Menu above is the `PopupMenu`. So in `onClick`: ``` @Override public void onClick(View view, int position, MotionEvent e) { ImageButton btnMore = (ImageButton) view.findViewById(R.id.item_song_btnMore); if (RecyclerViewOnTouchListener.isViewClicked(btnMore,...
step.1 add Recyclerview view layout. step.2 Recyclerview rows layout recycler\_item.xml ``` <?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:card_view="http://schemas.android.com/apk/res-auto" android:layout_width="matc...
37,601,346
How do I create an Options Menu like in the following Screenshot: [![enter image description here](https://i.stack.imgur.com/wxPNk.png)](https://i.stack.imgur.com/wxPNk.png) The Options Menu should be opened afther clicking on the "More"-Icon of a RecyclerView Item! My try was this: ``` @Override public void onBind...
2016/06/02
[ "https://Stackoverflow.com/questions/37601346", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5994190/" ]
**Simple Code In Kotlin : -** ``` holder!!.t_description!!.setOnClickListener { val popup = PopupMenu(context, holder.t_description) popup.inflate(R.menu.navigation) popup.setOnMenuItemClickListener(object : PopupMenu.OnMenuItemClickListener{ override fun onMenuItemClick(p0: MenuI...
I guess it is better to handle click event in Activity as TaskAdapter ``` public void onBindViewHolder(final TaskViewHolder holder, final int position) { holder.name.setText(obj.get(position).getName()); Date date =obj.get(position).getUpdate_date(); String pattern = "dd-MM-YYYY"; SimpleDateFormat sim...
37,601,346
How do I create an Options Menu like in the following Screenshot: [![enter image description here](https://i.stack.imgur.com/wxPNk.png)](https://i.stack.imgur.com/wxPNk.png) The Options Menu should be opened afther clicking on the "More"-Icon of a RecyclerView Item! My try was this: ``` @Override public void onBind...
2016/06/02
[ "https://Stackoverflow.com/questions/37601346", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5994190/" ]
It is very easy to create an option menu like this. Just add a button in your list item design. You can use the following string to display 3 vertical dots. ``` <TextView android:id="@+id/textViewOptions" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignPare...
step.1 add Recyclerview view layout. step.2 Recyclerview rows layout recycler\_item.xml ``` <?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:card_view="http://schemas.android.com/apk/res-auto" android:layout_width="matc...
37,601,346
How do I create an Options Menu like in the following Screenshot: [![enter image description here](https://i.stack.imgur.com/wxPNk.png)](https://i.stack.imgur.com/wxPNk.png) The Options Menu should be opened afther clicking on the "More"-Icon of a RecyclerView Item! My try was this: ``` @Override public void onBind...
2016/06/02
[ "https://Stackoverflow.com/questions/37601346", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5994190/" ]
It is very easy to create an option menu like this. Just add a button in your list item design. You can use the following string to display 3 vertical dots. ``` <TextView android:id="@+id/textViewOptions" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignPare...
1. There is a simple way to show menu like this: ViewHolder: define fields ``` private ImageView menuBtn; private PopupMenu popupMenu; ``` Create method `bind` with logic of creating menu on button click and closing it on reusing view: ``` if (popupMenu != null) { popupMenu.dismiss(); } menuBtn...
37,601,346
How do I create an Options Menu like in the following Screenshot: [![enter image description here](https://i.stack.imgur.com/wxPNk.png)](https://i.stack.imgur.com/wxPNk.png) The Options Menu should be opened afther clicking on the "More"-Icon of a RecyclerView Item! My try was this: ``` @Override public void onBind...
2016/06/02
[ "https://Stackoverflow.com/questions/37601346", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5994190/" ]
It is very easy to create an option menu like this. Just add a button in your list item design. You can use the following string to display 3 vertical dots. ``` <TextView android:id="@+id/textViewOptions" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignPare...
**Simple Code In Kotlin : -** ``` holder!!.t_description!!.setOnClickListener { val popup = PopupMenu(context, holder.t_description) popup.inflate(R.menu.navigation) popup.setOnMenuItemClickListener(object : PopupMenu.OnMenuItemClickListener{ override fun onMenuItemClick(p0: MenuI...
37,601,346
How do I create an Options Menu like in the following Screenshot: [![enter image description here](https://i.stack.imgur.com/wxPNk.png)](https://i.stack.imgur.com/wxPNk.png) The Options Menu should be opened afther clicking on the "More"-Icon of a RecyclerView Item! My try was this: ``` @Override public void onBind...
2016/06/02
[ "https://Stackoverflow.com/questions/37601346", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5994190/" ]
It is very easy to create an option menu like this. Just add a button in your list item design. You can use the following string to display 3 vertical dots. ``` <TextView android:id="@+id/textViewOptions" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignPare...
Change the `RecyclerViewOnTouchListener` class to pass the `MotionEvent` to the `OnTouchCallback` implementation. In the class implementing `onItemClick`, add the following: ``` @Override public void onClick(final View view, int position, MotionEvent e) { View menuButton = view.findViewById(R.id.menu)...
14,224,863
I need to sort a NSMutableArray containing NSURLs with localizedStandardCompare: ``` [array sortUsingComparator:^NSComparisonResult(id obj1, id obj2) { NSString *f1 = [(NSURL *)obj1 absoluteString]; NSString *f2 = [(NSURL *)obj2 absoluteString]; return [f1 localizedStandardCompare:f2]; }]; ``` This works...
2013/01/08
[ "https://Stackoverflow.com/questions/14224863", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1096710/" ]
So here is how I typically solve this problem. My notes are purely my opinion (religous?) about naming classes in an MVC project to keep clear their purpose. Couple of interfaces to keep it extensible: ``` // be specific about what type of results, both in the name of the // interface and the property needed, you do...
What I typically do is pass the posted Model back into the view. This way the values are not cleared out. Your code would look something like this: ``` <div style="float:left;"> <div style="float:left;"> <label>Name:</label> @Html.TextBox("name", Model.Name) </div> <div style="float:left; margin-le...
14,224,863
I need to sort a NSMutableArray containing NSURLs with localizedStandardCompare: ``` [array sortUsingComparator:^NSComparisonResult(id obj1, id obj2) { NSString *f1 = [(NSURL *)obj1 absoluteString]; NSString *f2 = [(NSURL *)obj2 absoluteString]; return [f1 localizedStandardCompare:f2]; }]; ``` This works...
2013/01/08
[ "https://Stackoverflow.com/questions/14224863", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1096710/" ]
if you are using html in mvc then check solution 2 from [here](http://www.codeproject.com/Questions/774540/how-to-retain-text-box-values-after-postback-in-as), `value="@Request["txtNumber1"]"` worked fine for me, ``` <input type="text" id="txtNumber1" name="txtNumber1" value="@Request["txtNumber1"]"/> ``` hope helps...
What I typically do is pass the posted Model back into the view. This way the values are not cleared out. Your code would look something like this: ``` <div style="float:left;"> <div style="float:left;"> <label>Name:</label> @Html.TextBox("name", Model.Name) </div> <div style="float:left; margin-le...
60,914,918
```js import React from 'react'; import Slick from 'react-slick'; import style from './Slider.module.css'; import {Link} from 'react-router-dom'; const SliderTemplates = (props) => { let template = null; const settings= { dots:true, infinite: true, arrows: false, spee...
2020/03/29
[ "https://Stackoverflow.com/questions/60914918", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7702048/" ]
Use [`MultiLabelBinarizer`](https://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.MultiLabelBinarizer.html) with `d.keys()` and `d.values()` of dictionary: ``` from sklearn.preprocessing import MultiLabelBinarizer mlb = MultiLabelBinarizer() df = pd.DataFrame(mlb.fit_transform(d.values()), index=d.k...
You can create a series, `explode` it, and then use `get_dummies` with `sum`: ``` pd.get_dummies(pd.Series(d).explode()).sum(level=0) ``` Or you can play with the exploded series and `unstack`: ``` (pd.Series(d).explode() .to_frame(name='cols') .assign(values=1) .set_index('cols', append=True)['values'] ...
53,056,028
I'm using for a GetAppRolesForUser function (and have tried variations of based on answers here): ``` private AuthContext db = new AuthContext(); ... var userRoles = Mapper.Map<List<RoleApi>>( db.Users.SingleOrDefault(u => u.InternetId == username) .Groups.SelectMany(g => g.Roles.Where(r => r.Asset.AssetName...
2018/10/30
[ "https://Stackoverflow.com/questions/53056028", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2762742/" ]
I think the problem is you're lazy loading the groups and roles. One solution is eager load them before you call `SingleOrDefault` ``` var user = db.Users.Include(x => x.Groups.Select(y => y.Roles)) .SingleOrDefault(u => u.InternetId == username); var groups = user.Groups.SelectMany( ...
Here is another way of avoiding lazy loading. You can also look at projection and have only those fields which you need rather than loading the entire columns. ``` var userRoles = Mapper.Map<List<RoleApi>>( db.Users.Where(u => u.InternetId == username).Select(../* projection */ ) .Groups.SelectMany(g => g.Roles.Wher...
53,056,028
I'm using for a GetAppRolesForUser function (and have tried variations of based on answers here): ``` private AuthContext db = new AuthContext(); ... var userRoles = Mapper.Map<List<RoleApi>>( db.Users.SingleOrDefault(u => u.InternetId == username) .Groups.SelectMany(g => g.Roles.Where(r => r.Asset.AssetName...
2018/10/30
[ "https://Stackoverflow.com/questions/53056028", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2762742/" ]
I think the problem is you're lazy loading the groups and roles. One solution is eager load them before you call `SingleOrDefault` ``` var user = db.Users.Include(x => x.Groups.Select(y => y.Roles)) .SingleOrDefault(u => u.InternetId == username); var groups = user.Groups.SelectMany( ...
You have to be aware of two differences: * The difference between IEnumerable and IQueryable * The difference between functions that return `IQueryable<TResult>` (lazy) and functions that return `TResult` (executing) Difference between `Enumerable` and `Queryable` ----------------------------------------------- . A ...
53,056,028
I'm using for a GetAppRolesForUser function (and have tried variations of based on answers here): ``` private AuthContext db = new AuthContext(); ... var userRoles = Mapper.Map<List<RoleApi>>( db.Users.SingleOrDefault(u => u.InternetId == username) .Groups.SelectMany(g => g.Roles.Where(r => r.Asset.AssetName...
2018/10/30
[ "https://Stackoverflow.com/questions/53056028", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2762742/" ]
TheGeneral's answer covers why you are getting caught out with lazy loading. You may also need to include Asset to get AssetName. With AutoMapper you can avoid the need to Eager Load the entities by employing `.ProjectTo<T>()` to the `IQueryable`, provided there is a User accessible in Group. For instance: ``` var r...
Here is another way of avoiding lazy loading. You can also look at projection and have only those fields which you need rather than loading the entire columns. ``` var userRoles = Mapper.Map<List<RoleApi>>( db.Users.Where(u => u.InternetId == username).Select(../* projection */ ) .Groups.SelectMany(g => g.Roles.Wher...
53,056,028
I'm using for a GetAppRolesForUser function (and have tried variations of based on answers here): ``` private AuthContext db = new AuthContext(); ... var userRoles = Mapper.Map<List<RoleApi>>( db.Users.SingleOrDefault(u => u.InternetId == username) .Groups.SelectMany(g => g.Roles.Where(r => r.Asset.AssetName...
2018/10/30
[ "https://Stackoverflow.com/questions/53056028", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2762742/" ]
TheGeneral's answer covers why you are getting caught out with lazy loading. You may also need to include Asset to get AssetName. With AutoMapper you can avoid the need to Eager Load the entities by employing `.ProjectTo<T>()` to the `IQueryable`, provided there is a User accessible in Group. For instance: ``` var r...
You have to be aware of two differences: * The difference between IEnumerable and IQueryable * The difference between functions that return `IQueryable<TResult>` (lazy) and functions that return `TResult` (executing) Difference between `Enumerable` and `Queryable` ----------------------------------------------- . A ...
65,086,069
To demonstrate this, I have few IPs in text file called `blocked.txt` with the following content: ``` 1.1.1.1 1.1.1.2 1.1.1.3 2.1.1.1 2.1.1.2 ``` So given an input of CIDR of `1.1.1.0/24` I want to remove the IP that belongs this CIDR range which are `1.1.1.1`, `1.1.1.2` and `1.1.1.3` The only thing that makes me ...
2020/12/01
[ "https://Stackoverflow.com/questions/65086069", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13288989/" ]
***EDIT:*** Since OP added few more samples to handle lines with `/` present one could try following. ``` awk -F'/' -v val="1.1.1.0/24" ' BEGIN{ match(val,/.*\./) matched=substr(val,RSTART,RLENGTH-1) split(substr(val,RSTART+RLENGTH),arr,"/") for(i=arr[1];i<=arr[2];i++){ skip[matched"."i] } } !($1 in skip)...
Another way of doing this is by using nmap which support CIDR notation: ``` nmap -sn -v 1.1.1.0/24 | awk '/^Nmap scan/ { print $5 }' > ipadds.txt ``` Run nmap on the CIDR range doing a simple ping scan with -v to display hosts that may be down also. Use awk to strip everything but the IP addresses, outputting them t...
306,907
Does anyone know what these RCA-to-USB cables are/do? There doesn’t seem to be any electronics in the cable like an [EasyCap](http://images.google.com/images?safe=off&sout=1&q=easycap), so I can only assume that the RCA connectors are directly connected to the USB pins. I suppose that it *could* be used for A/V capture...
2011/07/06
[ "https://superuser.com/questions/306907", "https://superuser.com", "https://superuser.com/users/3279/" ]
According to the [product description](http://rads.stackoverflow.com/amzn/click/B003QA5LA0) at Amazon, they are RCA-to-USB cables... They plug into a camcorder via RCA, to display images/sound on certain "USB-enabled TVs and PCs."
hook a rca camera to the usb cable and you are now able to use any camera as a video conference room camera. No driver needed. Most conference calls are able to be recorded thru the website you are using for the call. You are correct! It will not work for recording, unless you are using some other program that allow...
306,907
Does anyone know what these RCA-to-USB cables are/do? There doesn’t seem to be any electronics in the cable like an [EasyCap](http://images.google.com/images?safe=off&sout=1&q=easycap), so I can only assume that the RCA connectors are directly connected to the USB pins. I suppose that it *could* be used for A/V capture...
2011/07/06
[ "https://superuser.com/questions/306907", "https://superuser.com", "https://superuser.com/users/3279/" ]
I did some digging and found some useful information in [a review on Amazon](http://www.amazon.com/review/R3EXGOXUSBCQ8T/ref=cm_cr_rdp_perm?ie=UTF8&ASIN=B003QA5LA0 "GSI - 3 RCA To USB Cable"). As you suspected, there is no analog/digital conversion hardware in the cable, the RCA lines are tied directly to the USB pins....
According to the [product description](http://rads.stackoverflow.com/amzn/click/B003QA5LA0) at Amazon, they are RCA-to-USB cables... They plug into a camcorder via RCA, to display images/sound on certain "USB-enabled TVs and PCs."
306,907
Does anyone know what these RCA-to-USB cables are/do? There doesn’t seem to be any electronics in the cable like an [EasyCap](http://images.google.com/images?safe=off&sout=1&q=easycap), so I can only assume that the RCA connectors are directly connected to the USB pins. I suppose that it *could* be used for A/V capture...
2011/07/06
[ "https://superuser.com/questions/306907", "https://superuser.com", "https://superuser.com/users/3279/" ]
I did some digging and found some useful information in [a review on Amazon](http://www.amazon.com/review/R3EXGOXUSBCQ8T/ref=cm_cr_rdp_perm?ie=UTF8&ASIN=B003QA5LA0 "GSI - 3 RCA To USB Cable"). As you suspected, there is no analog/digital conversion hardware in the cable, the RCA lines are tied directly to the USB pins....
hook a rca camera to the usb cable and you are now able to use any camera as a video conference room camera. No driver needed. Most conference calls are able to be recorded thru the website you are using for the call. You are correct! It will not work for recording, unless you are using some other program that allow...
23,482,982
We have this line in my code base: ``` var uncurryThis = Function.bind.bind(Function.call); ``` That I'm trying to work through. Presumably, it uncurries. How do I work this out? I guess it's a version of `Function.bind` whose own `this` is bound to `Function.call`. Doesn't help me enough. And I haven't found any u...
2014/05/05
[ "https://Stackoverflow.com/questions/23482982", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1339987/" ]
It passes the `call` function to the `bind` function, with the `bind` function itself being the value of `this`. Thus you get in return a wrapper around the `bind` function that arranges for `this` to be the `call` function when you call it. *That*, in turn, is a function that lets you create a wrapper around the `call...
OK. You know what [`bind`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind) does? It's a method of Functions to fix their `this` argument, and returns a new function. It could be simplified to: ``` function bind(context) { var fn = this; return function() { ...
23,482,982
We have this line in my code base: ``` var uncurryThis = Function.bind.bind(Function.call); ``` That I'm trying to work through. Presumably, it uncurries. How do I work this out? I guess it's a version of `Function.bind` whose own `this` is bound to `Function.call`. Doesn't help me enough. And I haven't found any u...
2014/05/05
[ "https://Stackoverflow.com/questions/23482982", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1339987/" ]
It passes the `call` function to the `bind` function, with the `bind` function itself being the value of `this`. Thus you get in return a wrapper around the `bind` function that arranges for `this` to be the `call` function when you call it. *That*, in turn, is a function that lets you create a wrapper around the `call...
when we call bind on a function, it returns new function with this is replaced by context: ``` function random() { alert(this.foo); } var newRandom = random.bind({foo:"hello world"}) //return new function same as //`random` with `this` is replaced by object {foo:"hello world"} ``` the same we have: ``` Function.b...
23,482,982
We have this line in my code base: ``` var uncurryThis = Function.bind.bind(Function.call); ``` That I'm trying to work through. Presumably, it uncurries. How do I work this out? I guess it's a version of `Function.bind` whose own `this` is bound to `Function.call`. Doesn't help me enough. And I haven't found any u...
2014/05/05
[ "https://Stackoverflow.com/questions/23482982", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1339987/" ]
It passes the `call` function to the `bind` function, with the `bind` function itself being the value of `this`. Thus you get in return a wrapper around the `bind` function that arranges for `this` to be the `call` function when you call it. *That*, in turn, is a function that lets you create a wrapper around the `call...
I think this can be explained more clearly if you work backward. **Context:** Suppose we want to lowercase an array of strings. This can be done like so: ``` [‘A’, ‘B’].map(s => s.toLowerCase()) ``` Let's say, for whatever reason, I want to make this call more generic. I don't like how `s` is bound to `this` and t...
23,482,982
We have this line in my code base: ``` var uncurryThis = Function.bind.bind(Function.call); ``` That I'm trying to work through. Presumably, it uncurries. How do I work this out? I guess it's a version of `Function.bind` whose own `this` is bound to `Function.call`. Doesn't help me enough. And I haven't found any u...
2014/05/05
[ "https://Stackoverflow.com/questions/23482982", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1339987/" ]
OK. You know what [`bind`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind) does? It's a method of Functions to fix their `this` argument, and returns a new function. It could be simplified to: ``` function bind(context) { var fn = this; return function() { ...
when we call bind on a function, it returns new function with this is replaced by context: ``` function random() { alert(this.foo); } var newRandom = random.bind({foo:"hello world"}) //return new function same as //`random` with `this` is replaced by object {foo:"hello world"} ``` the same we have: ``` Function.b...
23,482,982
We have this line in my code base: ``` var uncurryThis = Function.bind.bind(Function.call); ``` That I'm trying to work through. Presumably, it uncurries. How do I work this out? I guess it's a version of `Function.bind` whose own `this` is bound to `Function.call`. Doesn't help me enough. And I haven't found any u...
2014/05/05
[ "https://Stackoverflow.com/questions/23482982", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1339987/" ]
OK. You know what [`bind`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind) does? It's a method of Functions to fix their `this` argument, and returns a new function. It could be simplified to: ``` function bind(context) { var fn = this; return function() { ...
I think this can be explained more clearly if you work backward. **Context:** Suppose we want to lowercase an array of strings. This can be done like so: ``` [‘A’, ‘B’].map(s => s.toLowerCase()) ``` Let's say, for whatever reason, I want to make this call more generic. I don't like how `s` is bound to `this` and t...
3,393,829
I want to open the dialog box when the user clicks on a browse button in the nib. This would search for a picture he wants from his pc and upload it. How do I do this programmatically in iphone.
2010/08/03
[ "https://Stackoverflow.com/questions/3393829", "https://Stackoverflow.com", "https://Stackoverflow.com/users/397734/" ]
What you need is: ``` //declaration: MyConstuctor(int inDenominator, int inNumerator, int inWholeNumber = 0); //definition: MyConstuctor::MyConstuctor(int inDenominator,int inNumerator,int inWholeNumber) { mNum = inNumerator; mDen = inDenominator; mWhole = inWholeNumber; } ``` This way you...
No, you need to provide the default value in the declaration of the method only. The definition of the method should have all 3 parameters without the default value. If the user of the class chooses to pass the 3rd parameter it will be used, otherwise default value specified in the declaration will be used.
3,393,829
I want to open the dialog box when the user clicks on a browse button in the nib. This would search for a picture he wants from his pc and upload it. How do I do this programmatically in iphone.
2010/08/03
[ "https://Stackoverflow.com/questions/3393829", "https://Stackoverflow.com", "https://Stackoverflow.com/users/397734/" ]
No, you need to provide the default value in the declaration of the method only. The definition of the method should have all 3 parameters without the default value. If the user of the class chooses to pass the 3rd parameter it will be used, otherwise default value specified in the declaration will be used.
You should add the default parameter to the declaration as well and the default value in the implementation is not necessary.
3,393,829
I want to open the dialog box when the user clicks on a browse button in the nib. This would search for a picture he wants from his pc and upload it. How do I do this programmatically in iphone.
2010/08/03
[ "https://Stackoverflow.com/questions/3393829", "https://Stackoverflow.com", "https://Stackoverflow.com/users/397734/" ]
What you need is: ``` //declaration: MyConstuctor(int inDenominator, int inNumerator, int inWholeNumber = 0); //definition: MyConstuctor::MyConstuctor(int inDenominator,int inNumerator,int inWholeNumber) { mNum = inNumerator; mDen = inDenominator; mWhole = inWholeNumber; } ``` This way you...
You should add the default parameter to the declaration as well and the default value in the implementation is not necessary.
26,613,419
I'm gonna build a website with 2 layouts: boxed and full width by Bootstrap 3. As bootstrap document, I can create full width layout by using `.container-fluid`, is it right? In addition, I want to know the way create boxed width layout too.
2014/10/28
[ "https://Stackoverflow.com/questions/26613419", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2494232/" ]
Use .container for a responsive fixed width container. ``` <div class="container"> ... </div> ``` Use .container-fluid for a full width container, spanning the entire width of your viewport. ``` <div class="container-fluid"> ... </div> ``` <http://getbootstrap.com/css/>
It sounds like the solution you are referring to is going to take you specifying the container widths using media queries. Something like this should work for what you are after: ``` /* Customize container */ @media (min-width: 960px) { .container { max-width: 780px; } } ``` The above apply to wheth...
23,679,968
I've got a browser game and I have recently started adding audio to the game. Chrome does not load the whole page and gets stuck at `"91 requests | 8.1 MB transferred"` and does not load any more content; and it even breaks the website in all other tabs, saying `Waiting for available socket`. After 5 mins (exactly)...
2014/05/15
[ "https://Stackoverflow.com/questions/23679968", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1989999/" ]
**Explanation:** This problem occurs because Chrome allows up to 6 open connections by default. So if you're streaming multiple media files simultaneously from 6 `<video>` or `<audio>` tags, the 7th connection (for example, an image) will just hang, until one of the sockets opens up. Usually, an open connection will c...
simple and correct solution is put off preload your audio and video file from setting and recheck your page your problem of waiting for available socket will resolved ... if you use jplayer then replace **preload:"metadata"** to **preload:"none"** from jplayer JS file ... **preload:"metadata"** is the default va...
23,679,968
I've got a browser game and I have recently started adding audio to the game. Chrome does not load the whole page and gets stuck at `"91 requests | 8.1 MB transferred"` and does not load any more content; and it even breaks the website in all other tabs, saying `Waiting for available socket`. After 5 mins (exactly)...
2014/05/15
[ "https://Stackoverflow.com/questions/23679968", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1989999/" ]
**Explanation:** This problem occurs because Chrome allows up to 6 open connections by default. So if you're streaming multiple media files simultaneously from 6 `<video>` or `<audio>` tags, the 7th connection (for example, an image) will just hang, until one of the sockets opens up. Usually, an open connection will c...
Our first thought is that the site is down or the like, but the truth is that this is not the problem or disability. Nor is it a problem because a simple connection when tested under Firefox, Opera or services Explorer open as normal. The error in Chrome displays a sign that says "This site is not available" and clari...
23,679,968
I've got a browser game and I have recently started adding audio to the game. Chrome does not load the whole page and gets stuck at `"91 requests | 8.1 MB transferred"` and does not load any more content; and it even breaks the website in all other tabs, saying `Waiting for available socket`. After 5 mins (exactly)...
2014/05/15
[ "https://Stackoverflow.com/questions/23679968", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1989999/" ]
Looks like you are hitting the limit on connections per server. I see you are loading a lot of static files and my advice is to separate them on subdomains and serve them directly with Nginx for example. * Create a subdomain called *img.yoursite.com* and load all your images from there. * Create a subdomain called *s...
The message: > > Waiting for available socket... > > > is shown, because you've reached a limit on the ssl\_socket\_pool either per Host, Proxy or Group. Here are the maximum number of HTTP connections which you can make with a Chrome browser: * The maximum number of connections per proxy is 32 connections. Thi...
23,679,968
I've got a browser game and I have recently started adding audio to the game. Chrome does not load the whole page and gets stuck at `"91 requests | 8.1 MB transferred"` and does not load any more content; and it even breaks the website in all other tabs, saying `Waiting for available socket`. After 5 mins (exactly)...
2014/05/15
[ "https://Stackoverflow.com/questions/23679968", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1989999/" ]
**Explanation:** This problem occurs because Chrome allows up to 6 open connections by default. So if you're streaming multiple media files simultaneously from 6 `<video>` or `<audio>` tags, the 7th connection (for example, an image) will just hang, until one of the sockets opens up. Usually, an open connection will c...
Chrome is a Chromium-based browser and Chromium-based browsers only allow maximum 6 open socket connections at a time, when the 7th connection starts up it will just sit idle and wait for one of the 6 which are running to stop and then it will start running. Hence the error code **‘waiting for available sockets’**, the...
23,679,968
I've got a browser game and I have recently started adding audio to the game. Chrome does not load the whole page and gets stuck at `"91 requests | 8.1 MB transferred"` and does not load any more content; and it even breaks the website in all other tabs, saying `Waiting for available socket`. After 5 mins (exactly)...
2014/05/15
[ "https://Stackoverflow.com/questions/23679968", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1989999/" ]
Looks like you are hitting the limit on connections per server. I see you are loading a lot of static files and my advice is to separate them on subdomains and serve them directly with Nginx for example. * Create a subdomain called *img.yoursite.com* and load all your images from there. * Create a subdomain called *s...
Chrome is a Chromium-based browser and Chromium-based browsers only allow maximum 6 open socket connections at a time, when the 7th connection starts up it will just sit idle and wait for one of the 6 which are running to stop and then it will start running. Hence the error code **‘waiting for available sockets’**, the...
23,679,968
I've got a browser game and I have recently started adding audio to the game. Chrome does not load the whole page and gets stuck at `"91 requests | 8.1 MB transferred"` and does not load any more content; and it even breaks the website in all other tabs, saying `Waiting for available socket`. After 5 mins (exactly)...
2014/05/15
[ "https://Stackoverflow.com/questions/23679968", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1989999/" ]
The message: > > Waiting for available socket... > > > is shown, because you've reached a limit on the ssl\_socket\_pool either per Host, Proxy or Group. Here are the maximum number of HTTP connections which you can make with a Chrome browser: * The maximum number of connections per proxy is 32 connections. Thi...
Our first thought is that the site is down or the like, but the truth is that this is not the problem or disability. Nor is it a problem because a simple connection when tested under Firefox, Opera or services Explorer open as normal. The error in Chrome displays a sign that says "This site is not available" and clari...
23,679,968
I've got a browser game and I have recently started adding audio to the game. Chrome does not load the whole page and gets stuck at `"91 requests | 8.1 MB transferred"` and does not load any more content; and it even breaks the website in all other tabs, saying `Waiting for available socket`. After 5 mins (exactly)...
2014/05/15
[ "https://Stackoverflow.com/questions/23679968", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1989999/" ]
simple and correct solution is put off preload your audio and video file from setting and recheck your page your problem of waiting for available socket will resolved ... if you use jplayer then replace **preload:"metadata"** to **preload:"none"** from jplayer JS file ... **preload:"metadata"** is the default va...
Chrome is a Chromium-based browser and Chromium-based browsers only allow maximum 6 open socket connections at a time, when the 7th connection starts up it will just sit idle and wait for one of the 6 which are running to stop and then it will start running. Hence the error code **‘waiting for available sockets’**, the...
23,679,968
I've got a browser game and I have recently started adding audio to the game. Chrome does not load the whole page and gets stuck at `"91 requests | 8.1 MB transferred"` and does not load any more content; and it even breaks the website in all other tabs, saying `Waiting for available socket`. After 5 mins (exactly)...
2014/05/15
[ "https://Stackoverflow.com/questions/23679968", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1989999/" ]
The message: > > Waiting for available socket... > > > is shown, because you've reached a limit on the ssl\_socket\_pool either per Host, Proxy or Group. Here are the maximum number of HTTP connections which you can make with a Chrome browser: * The maximum number of connections per proxy is 32 connections. Thi...
simple and correct solution is put off preload your audio and video file from setting and recheck your page your problem of waiting for available socket will resolved ... if you use jplayer then replace **preload:"metadata"** to **preload:"none"** from jplayer JS file ... **preload:"metadata"** is the default va...
23,679,968
I've got a browser game and I have recently started adding audio to the game. Chrome does not load the whole page and gets stuck at `"91 requests | 8.1 MB transferred"` and does not load any more content; and it even breaks the website in all other tabs, saying `Waiting for available socket`. After 5 mins (exactly)...
2014/05/15
[ "https://Stackoverflow.com/questions/23679968", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1989999/" ]
The message: > > Waiting for available socket... > > > is shown, because you've reached a limit on the ssl\_socket\_pool either per Host, Proxy or Group. Here are the maximum number of HTTP connections which you can make with a Chrome browser: * The maximum number of connections per proxy is 32 connections. Thi...
Chrome is a Chromium-based browser and Chromium-based browsers only allow maximum 6 open socket connections at a time, when the 7th connection starts up it will just sit idle and wait for one of the 6 which are running to stop and then it will start running. Hence the error code **‘waiting for available sockets’**, the...
23,679,968
I've got a browser game and I have recently started adding audio to the game. Chrome does not load the whole page and gets stuck at `"91 requests | 8.1 MB transferred"` and does not load any more content; and it even breaks the website in all other tabs, saying `Waiting for available socket`. After 5 mins (exactly)...
2014/05/15
[ "https://Stackoverflow.com/questions/23679968", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1989999/" ]
Looks like you are hitting the limit on connections per server. I see you are loading a lot of static files and my advice is to separate them on subdomains and serve them directly with Nginx for example. * Create a subdomain called *img.yoursite.com* and load all your images from there. * Create a subdomain called *s...
Our first thought is that the site is down or the like, but the truth is that this is not the problem or disability. Nor is it a problem because a simple connection when tested under Firefox, Opera or services Explorer open as normal. The error in Chrome displays a sign that says "This site is not available" and clari...
11,450,481
I am working with CodeIgniter and have created a custom form preferences custom config. In that I have an array that is as follows: ```none Array ( [1] => Category 1 [2] => Category 2 [3] => Category 3 [4] => Category 4 [5] => Category 5 ) ``` I am passing that to the view as the var `$service_categorie...
2012/07/12
[ "https://Stackoverflow.com/questions/11450481", "https://Stackoverflow.com", "https://Stackoverflow.com/users/265431/" ]
`in_array()` checks if a *value* exists in the array. So in\_array('Category 1', $service\_categories) would work. However, to check if a key is present in an array, you can use: ``` if(array_key_exists($service->service_category, $service_categories)) { echo "Exists"; } ``` I think, this is what you're lookin...
> > The variable : $service->service\_category is a number. > > > And that precisely is the problem: your testing to see if "5" is equal to "Category 5", which it is obviously not. Simplest solution would be to prepend the "5" with "Category ": ``` <?php $category = 'Category ' . $service->service_category; if (...
11,450,481
I am working with CodeIgniter and have created a custom form preferences custom config. In that I have an array that is as follows: ```none Array ( [1] => Category 1 [2] => Category 2 [3] => Category 3 [4] => Category 4 [5] => Category 5 ) ``` I am passing that to the view as the var `$service_categorie...
2012/07/12
[ "https://Stackoverflow.com/questions/11450481", "https://Stackoverflow.com", "https://Stackoverflow.com/users/265431/" ]
`in_array()` checks if a *value* exists in the array. So in\_array('Category 1', $service\_categories) would work. However, to check if a key is present in an array, you can use: ``` if(array_key_exists($service->service_category, $service_categories)) { echo "Exists"; } ``` I think, this is what you're lookin...
I think [array\_key\_exists](http://php.net/manual/en/function.array-key-exists.php) is the function you might search.
11,450,481
I am working with CodeIgniter and have created a custom form preferences custom config. In that I have an array that is as follows: ```none Array ( [1] => Category 1 [2] => Category 2 [3] => Category 3 [4] => Category 4 [5] => Category 5 ) ``` I am passing that to the view as the var `$service_categorie...
2012/07/12
[ "https://Stackoverflow.com/questions/11450481", "https://Stackoverflow.com", "https://Stackoverflow.com/users/265431/" ]
`in_array()` checks if a *value* exists in the array. So in\_array('Category 1', $service\_categories) would work. However, to check if a key is present in an array, you can use: ``` if(array_key_exists($service->service_category, $service_categories)) { echo "Exists"; } ``` I think, this is what you're lookin...
``` if (isset($service_categories[$service->service_category])) { echo "Exists"; } ```
36,061
I just started working with ASP.NET MVC a few weeks ago, and I'm finding that it can be very easy to write spaghetti code in the controllers. For my first project, I created a very simple view with a few controls. At first, all of my code was in the `Index()` action result. That worked okay for a while, but as more fea...
2013/11/25
[ "https://codereview.stackexchange.com/questions/36061", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/32574/" ]
It sounds like you need to add a service layer where you can include all your business logic. This way your controller classes do not become bloated with business logic and they are only dealing with the handling of requests and the population of view-models. Using thin controllers like this you can separate your logi...
Although @SilverlightFox is right in that you need to separate your business logic from contoller; this in itself will not improve readability of your code; as the biggest problem, namely **Arrow Code** will still remain. **Arrow Code** results from to many nesting levels in code. Also in an `if/else` statement handl...
45,982,383
This is the code to create a database copy in Azure using service management api's ``` SqlManagementClient sqlClient = new SqlManagementClient sqlClient (); DatabaseCopyCreateParameters newDatabaseParameters = new DatabaseCopyCreateParameters() { IsContinuous = true, ...
2017/08/31
[ "https://Stackoverflow.com/questions/45982383", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4328901/" ]
Location is decided based on the server location. Since my server is in East Asia, Obviously db will be in East Asia
You can avoid this by copying the database using T-SQL as explained below: ``` -- Execute on the master database of the target server (server2) -- Start copying from Server1 to Server2 CREATE DATABASE Database1_copy AS COPY OF server1.Database1; ``` For more information, click [here](https://learn.microsoft.com/en-u...
8,310
Is there a quantum algorithm allowing to determine the state with the highest probability of occurring (i.e. highest square amplitude), more efficiently than repeatedly measuring and estimating a histogram?
2019/09/25
[ "https://quantumcomputing.stackexchange.com/questions/8310", "https://quantumcomputing.stackexchange.com", "https://quantumcomputing.stackexchange.com/users/8598/" ]
Yes. It is, for instance, part of Grover's algorithm and to be precise it is the 'Amplitude Amplification' part. $2| \psi \rangle \langle \psi | - I$, which will increase the amplitudes by their difference from the average
It looks like you want an algorithm that, given a state of the form $|\psi\rangle=\alpha|0\rangle+\beta|1\rangle$ with $|\alpha|\ge|\beta|$, gives back $|0\rangle$ with probability greater than $|\alpha|^2$. I don't think this is possible. Indeed, say such a mapping $\mathcal E$ existed. This $\mathcal E$ must be such...
16,908,635
Just started c++ and I'm working on making blackjack. I've set it up so a player's hand is a string of cards, ex: hand[1] = ❤2 hand[2] = ❤J I've made a function to add up the values of all of the cards in the cards array but i'm running into a problem: ``` int handValue(string hand[]){ int handSum; //return...
2013/06/04
[ "https://Stackoverflow.com/questions/16908635", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2441938/" ]
Your `GetHashCode` implementation does not return the same value for (A, B) and (B, A). The `HashSet` checks if it already contains a given hash at the moment of insertion. If it doesn't, then the object will be considered new. If you correct your `GetHashCode`, then at the moment of inserting the second `Pair` the `H...
Just remove this: \*397 If they are considered duplicates, they must **return the same int from GetHashCode()**. (However, if they are not considered duplicates they are still allowed to return the same int, that will only affect performance).
98,488
So I'm still relatively a newbie when it comes to rulings on using weapons and such, but I was wondering is it feasible for a level 1 bard (human or half elf most likely) starting out to be able to wield a two-handed great sword? That being said the idea is the bard will mostly be a healer of sort, but for role playin...
2017/04/20
[ "https://rpg.stackexchange.com/questions/98488", "https://rpg.stackexchange.com", "https://rpg.stackexchange.com/users/35430/" ]
Well technically you could wield anything as a weapon, you just wouldn't have much success with it (you do not add your proficiency bonus to attacks, which is a +2 at 1st level). To be competent with a weapon, you need proficiency with it. Bards do not get proficiency with two-handed swords, so you have two options: 1...
In 5e D&D, the Bard does not start with proficiency with Greatswords. However, if you choose the College of Valor archetype then you can get proficiency with Greatswords at level 3. If you don't want to wait that long / go with different college, there are other options: * The easiest is to use the variant Human an...
98,488
So I'm still relatively a newbie when it comes to rulings on using weapons and such, but I was wondering is it feasible for a level 1 bard (human or half elf most likely) starting out to be able to wield a two-handed great sword? That being said the idea is the bard will mostly be a healer of sort, but for role playin...
2017/04/20
[ "https://rpg.stackexchange.com/questions/98488", "https://rpg.stackexchange.com", "https://rpg.stackexchange.com/users/35430/" ]
As others have noted, taking the College of Valor as a 3rd level bard is an 0ption. Multiclassing is an option. The Weapons Master feat is an option. All of those are significant constraints or character development expenses to get one weapon proficiency. They each come with other benefits, of course, but they may not ...
In 5e D&D, the Bard does not start with proficiency with Greatswords. However, if you choose the College of Valor archetype then you can get proficiency with Greatswords at level 3. If you don't want to wait that long / go with different college, there are other options: * The easiest is to use the variant Human an...
98,488
So I'm still relatively a newbie when it comes to rulings on using weapons and such, but I was wondering is it feasible for a level 1 bard (human or half elf most likely) starting out to be able to wield a two-handed great sword? That being said the idea is the bard will mostly be a healer of sort, but for role playin...
2017/04/20
[ "https://rpg.stackexchange.com/questions/98488", "https://rpg.stackexchange.com", "https://rpg.stackexchange.com/users/35430/" ]
In 5e D&D, the Bard does not start with proficiency with Greatswords. However, if you choose the College of Valor archetype then you can get proficiency with Greatswords at level 3. If you don't want to wait that long / go with different college, there are other options: * The easiest is to use the variant Human an...
Worthy to note, at 2nd level Jack-of-All-Trades is one of the most pft overlooked and OP early boosts in the game. You are at least half proficient with anything with which you are not fully proficient. This would include greatswords, as well as initiative, per RAW, confirmed and legit bard power plays. Be sure to alwa...
98,488
So I'm still relatively a newbie when it comes to rulings on using weapons and such, but I was wondering is it feasible for a level 1 bard (human or half elf most likely) starting out to be able to wield a two-handed great sword? That being said the idea is the bard will mostly be a healer of sort, but for role playin...
2017/04/20
[ "https://rpg.stackexchange.com/questions/98488", "https://rpg.stackexchange.com", "https://rpg.stackexchange.com/users/35430/" ]
Well technically you could wield anything as a weapon, you just wouldn't have much success with it (you do not add your proficiency bonus to attacks, which is a +2 at 1st level). To be competent with a weapon, you need proficiency with it. Bards do not get proficiency with two-handed swords, so you have two options: 1...
As others have noted, taking the College of Valor as a 3rd level bard is an 0ption. Multiclassing is an option. The Weapons Master feat is an option. All of those are significant constraints or character development expenses to get one weapon proficiency. They each come with other benefits, of course, but they may not ...
98,488
So I'm still relatively a newbie when it comes to rulings on using weapons and such, but I was wondering is it feasible for a level 1 bard (human or half elf most likely) starting out to be able to wield a two-handed great sword? That being said the idea is the bard will mostly be a healer of sort, but for role playin...
2017/04/20
[ "https://rpg.stackexchange.com/questions/98488", "https://rpg.stackexchange.com", "https://rpg.stackexchange.com/users/35430/" ]
Well technically you could wield anything as a weapon, you just wouldn't have much success with it (you do not add your proficiency bonus to attacks, which is a +2 at 1st level). To be competent with a weapon, you need proficiency with it. Bards do not get proficiency with two-handed swords, so you have two options: 1...
As others have said, there are a few easy ways to do this: 1. variant human - weapon master feat (1st level) 2. valor bard archetype (3rd level) 3. multiclass into barbarian, fighter, paladin, or ranger 4. wield a longsword with 2 hands (1d10 damage), and re-flavor it as a slightly undersized greatsword. Maybe your ch...
98,488
So I'm still relatively a newbie when it comes to rulings on using weapons and such, but I was wondering is it feasible for a level 1 bard (human or half elf most likely) starting out to be able to wield a two-handed great sword? That being said the idea is the bard will mostly be a healer of sort, but for role playin...
2017/04/20
[ "https://rpg.stackexchange.com/questions/98488", "https://rpg.stackexchange.com", "https://rpg.stackexchange.com/users/35430/" ]
Well technically you could wield anything as a weapon, you just wouldn't have much success with it (you do not add your proficiency bonus to attacks, which is a +2 at 1st level). To be competent with a weapon, you need proficiency with it. Bards do not get proficiency with two-handed swords, so you have two options: 1...
Worthy to note, at 2nd level Jack-of-All-Trades is one of the most pft overlooked and OP early boosts in the game. You are at least half proficient with anything with which you are not fully proficient. This would include greatswords, as well as initiative, per RAW, confirmed and legit bard power plays. Be sure to alwa...
98,488
So I'm still relatively a newbie when it comes to rulings on using weapons and such, but I was wondering is it feasible for a level 1 bard (human or half elf most likely) starting out to be able to wield a two-handed great sword? That being said the idea is the bard will mostly be a healer of sort, but for role playin...
2017/04/20
[ "https://rpg.stackexchange.com/questions/98488", "https://rpg.stackexchange.com", "https://rpg.stackexchange.com/users/35430/" ]
As others have noted, taking the College of Valor as a 3rd level bard is an 0ption. Multiclassing is an option. The Weapons Master feat is an option. All of those are significant constraints or character development expenses to get one weapon proficiency. They each come with other benefits, of course, but they may not ...
As others have said, there are a few easy ways to do this: 1. variant human - weapon master feat (1st level) 2. valor bard archetype (3rd level) 3. multiclass into barbarian, fighter, paladin, or ranger 4. wield a longsword with 2 hands (1d10 damage), and re-flavor it as a slightly undersized greatsword. Maybe your ch...
98,488
So I'm still relatively a newbie when it comes to rulings on using weapons and such, but I was wondering is it feasible for a level 1 bard (human or half elf most likely) starting out to be able to wield a two-handed great sword? That being said the idea is the bard will mostly be a healer of sort, but for role playin...
2017/04/20
[ "https://rpg.stackexchange.com/questions/98488", "https://rpg.stackexchange.com", "https://rpg.stackexchange.com/users/35430/" ]
As others have noted, taking the College of Valor as a 3rd level bard is an 0ption. Multiclassing is an option. The Weapons Master feat is an option. All of those are significant constraints or character development expenses to get one weapon proficiency. They each come with other benefits, of course, but they may not ...
Worthy to note, at 2nd level Jack-of-All-Trades is one of the most pft overlooked and OP early boosts in the game. You are at least half proficient with anything with which you are not fully proficient. This would include greatswords, as well as initiative, per RAW, confirmed and legit bard power plays. Be sure to alwa...
98,488
So I'm still relatively a newbie when it comes to rulings on using weapons and such, but I was wondering is it feasible for a level 1 bard (human or half elf most likely) starting out to be able to wield a two-handed great sword? That being said the idea is the bard will mostly be a healer of sort, but for role playin...
2017/04/20
[ "https://rpg.stackexchange.com/questions/98488", "https://rpg.stackexchange.com", "https://rpg.stackexchange.com/users/35430/" ]
As others have said, there are a few easy ways to do this: 1. variant human - weapon master feat (1st level) 2. valor bard archetype (3rd level) 3. multiclass into barbarian, fighter, paladin, or ranger 4. wield a longsword with 2 hands (1d10 damage), and re-flavor it as a slightly undersized greatsword. Maybe your ch...
Worthy to note, at 2nd level Jack-of-All-Trades is one of the most pft overlooked and OP early boosts in the game. You are at least half proficient with anything with which you are not fully proficient. This would include greatswords, as well as initiative, per RAW, confirmed and legit bard power plays. Be sure to alwa...
46,919,402
I have been using Oracle cloud PAAS linux server for my DB machine (Oracle 11g) and having linux application server where i can run all my Java applications. Assume i have spring based web application which can connect cloud DB machine. I have tried to access the schema in Toad for oracle, it is working as expected bu...
2017/10/24
[ "https://Stackoverflow.com/questions/46919402", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3003757/" ]
This issue is because of Oracle DB machine encryption **ENCRYPTION\_SERVER** settings. As i understood which is default and set it to enabled, when we set it to ***disabled*** or comment the line then application will work as expected. Below is the file name for reference, ``` Filename : sqlnet.ora (We have to disable...
It did not help me at all. Actually I followed your solution and I ended up having another error more critical and serious than the one trying to solve. Let me explain. First of all the value "disabled" that you mentioned is not even an accepted value for this parameter. According to Oracle ([Oracle Docs](https://docs....
46,919,402
I have been using Oracle cloud PAAS linux server for my DB machine (Oracle 11g) and having linux application server where i can run all my Java applications. Assume i have spring based web application which can connect cloud DB machine. I have tried to access the schema in Toad for oracle, it is working as expected bu...
2017/10/24
[ "https://Stackoverflow.com/questions/46919402", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3003757/" ]
This issue is because of Oracle DB machine encryption **ENCRYPTION\_SERVER** settings. As i understood which is default and set it to enabled, when we set it to ***disabled*** or comment the line then application will work as expected. Below is the file name for reference, ``` Filename : sqlnet.ora (We have to disable...
Downgrading the OJDBC jar to version7 also works - Replace higher version(ojdbc14.jar was the culprit in my case) with ojdbc7.jar in your dependency files
46,919,402
I have been using Oracle cloud PAAS linux server for my DB machine (Oracle 11g) and having linux application server where i can run all my Java applications. Assume i have spring based web application which can connect cloud DB machine. I have tried to access the schema in Toad for oracle, it is working as expected bu...
2017/10/24
[ "https://Stackoverflow.com/questions/46919402", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3003757/" ]
It did not help me at all. Actually I followed your solution and I ended up having another error more critical and serious than the one trying to solve. Let me explain. First of all the value "disabled" that you mentioned is not even an accepted value for this parameter. According to Oracle ([Oracle Docs](https://docs....
Downgrading the OJDBC jar to version7 also works - Replace higher version(ojdbc14.jar was the culprit in my case) with ojdbc7.jar in your dependency files
63,057,420
I get the following errors, when I try to deploy the following Firebase Javascript Function via the command "firebase deploy --only functions" from Firebase-Tools CLI in Version 8.6.0. ``` exports.notifyNewMessage = functions.firestore.document("posts/{postId}").onCreate((docSnapshot, context) => { firestore.colle...
2020/07/23
[ "https://Stackoverflow.com/questions/63057420", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11924602/" ]
Sending a body with a GET request is not supported by HTTP. See [this Q&A](https://stackoverflow.com/questions/978061/http-get-with-request-body) for full details. But if you really want to do this, even though you know it's wrong, you can do it this way: ```golang iKnowThisBodyShouldBeIgnored := strings.NewReader("te...
1. Do not send body in a GET request: [an explanation](https://stackoverflow.com/questions/978061). RFC 7231 [says](https://www.rfc-editor.org/rfc/rfc7231#section-4.3.1) the following: > > A payload within a GET request message has no defined semantics; > sending a payload body on a GET request might cause some exis...
11,061,929
I am working on a web application where users can upload different files MS Word (.doc and .docx), Excel (.xls and .xlsx), Power point, PDF, text files and Rich Text Files (.rtf). As part of the application flow I would like to display a preview of the contents of the files in an IFrame, HTML best but I can go with te...
2012/06/16
[ "https://Stackoverflow.com/questions/11061929", "https://Stackoverflow.com", "https://Stackoverflow.com/users/200120/" ]
There is no single library that solves the problem so I solved it using the following libraries for each file type: a) MS Word documents - Live Docx (http://www.phplivedocx.org/2009/08/13/convert-docx-doc-rtf-to-html-in-php/) b) MS Excel - PHP Excel (http://phpexcel.codeplex.com/) c) Text from PDF - class from this ...
I had a similar task a few years ago and we ended up using OpenOffice in server mode with ImageMagick to retrieve Thumbnails images of PowerPoint documents. For some kind of presentations library. Basically the idea is to run OpenOffice and convert your documents to PDF and then use ImageMagick to create a thumbnail i...
49,316,374
I had this working without jquery, but the problem was that the tooltip was appearing on the whole div rather than just the PNG. The mouseover function worked well with jquery so I decided to switch to that, however I do not know how to trigger the CSS animation when the mouseover function runs. ```js $('#cookie')....
2018/03/16
[ "https://Stackoverflow.com/questions/49316374", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9488393/" ]
You can change the CSS - you may want to hide (display:none) instead of using visibility since moving the mouse to the edge of the screen will add scrollbars now ```js $('#cookie').mouseover(function() { $('#tooltip').css({"opacity":1, "visibility": "visible"}) }); $('#cookie').mouseout(function() { $('#toolti...
When adding and removing class do not use the `.` before the classname...as it will add a class with the name `.class` instead of `class`. You can make your code a little bit cleaner and use ES6 variable declaration ( as a bonus :) ). If your html markup is like in your example ( tooltip exactly after the image ), you...
49,316,374
I had this working without jquery, but the problem was that the tooltip was appearing on the whole div rather than just the PNG. The mouseover function worked well with jquery so I decided to switch to that, however I do not know how to trigger the CSS animation when the mouseover function runs. ```js $('#cookie')....
2018/03/16
[ "https://Stackoverflow.com/questions/49316374", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9488393/" ]
When adding and removing class do not use the `.` before the classname...as it will add a class with the name `.class` instead of `class`. You can make your code a little bit cleaner and use ES6 variable declaration ( as a bonus :) ). If your html markup is like in your example ( tooltip exactly after the image ), you...
when you add a class you don't need the dot before the class name because it's a declaration, not a selector ``` Wrong: $('#cookie').addClass('.cookieToolTipHovered'); Correct: $('#cookie').addClass('cookieToolTipHovered'); ``` Then, you need to remove the class when you're out, if you don't the class will keep app...