qid int64 10 74.7M | question stringlengths 15 26.2k | date stringlengths 10 10 | metadata list | response_j stringlengths 27 28.1k | response_k stringlengths 23 26.8k |
|---|---|---|---|---|---|
53,650,746 | If my character collided in an Object, I want my camera position y to move down a bit. I have tried to program it like this :
```
void OnTriggerEnter2D(Collider other)
{
float x = Camera.main.transform.position.x;
float y = Camera.main.transform.position.y;
Vector3 origP... | 2018/12/06 | [
"https://Stackoverflow.com/questions/53650746",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9896379/"
] | I think you simple need :
```
UPDATE t1
SET t1.code = t2.code
FROM t1 INNER JOIN
t2
ON t1.FULL_NAME = t2.FIRST_NAME + ' ' + t2.LAST_NAME
WHERE t1.code IS NULL;
``` | Here's the answer:
```
UPDATE IMPORT_DATA.RDBS_DATA_STORAGE
SET child_iin = pd.iin
FROM IMPORT_DATA.RDBS_DATA_STORAGE
INNER JOIN nedb.PERSONAL_DATA pd
ON child_iin LIKE '%' + pd.LAST_NAME + '%' + ' ' + '%' + pd.FIRST_NAME + '%'
WHERE LEN(child_iin) < 1;
```
`N`'s were unnecessary |
10,721,443 | I have a static list:
```
public static List<IMachines>mList =new List<IMachines>();
```
The list intakes two different types of objects(machines) in it:
```
IMachines machine = new AC();
IMachines machine = new Generator();
```
If after adding items to the list, I want to search for a particular machine by its n... | 2012/05/23 | [
"https://Stackoverflow.com/questions/10721443",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1407560/"
] | You can use the [`is` operator](http://msdn.microsoft.com/en-us/library/scekt9xw.aspx):
>
> Checks if an object is compatible with a given type
>
>
>
For example:
```
if(item is AC)
{
// it is AC
}
``` | ```
interface IVehicle {
}
class Car : IVehicle
{
}
class Bicycle : IVehicle
{
}
static void Main(string[] args)
{
var v1 = new Car();
var v2 = new Bicycle();
var list = new List<IVehicle>();
list.Add(v1);
list.Add(v2);
fore... |
28,970,289 | I have a situation when a msg fails and I would like to replay that msg with the highest priority using python boto package so he will be taken first. If I'm not wrong SQS queue does not support priority queue, so I would like to implement something simple.
**Important note**: when a msg fails I no longer have the mes... | 2015/03/10 | [
"https://Stackoverflow.com/questions/28970289",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2965630/"
] | I don't think there is any way to do this with a single SQS queue. You have no control over delivery of messages and, therefore, no way to impose a priority on messages. If you find a way, I would love to hear about it.
I think you could possibly use two queues (or more generally N queues where N is the number of leve... | As far as I know AWS SQS does not provide a native way or doing a priority queue (single queue priority). If you are open to considering other options, RabbitMQ can do this. Client can specify a priority of 0-255 in the message, and the queue will prioritize a higher priority message gets to the customer first.
For m... |
45,069,328 | I am very new to Maven builds. I have created a maven project and running it using maven build. It is running fine using tomcat7:run as goal but then I am finding it hard to stop the server. I am getting following error when I try to run again.
```
java.net.BindException: Address already in use: JVM_Bind <null>:8080
... | 2017/07/12 | [
"https://Stackoverflow.com/questions/45069328",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2684818/"
] | If the process is still running, you should be able to see it in your console. If you see a stop button (like *1*), just press it and that should stop the tomcat server.
If you happen to have had more than one service running, then the button in *2* should be activated. That will show all the running and stopped servi... | You can use `mvn tomcat7:shutdown` command to stop.
>
> Shuts down all possibly started embedded tomcat servers. This will be automatically down through a shutdown hook or you may call this Mojo to shut them down explictly.
>
>
>
Here is the [documentation](http://tomcat.apache.org/maven-plugin-2.0/tomcat7-maven-... |
143,700 | Is there a term that can be used to refer to both the prefix and suffix of a word?
For example, *unenjoyable*. I'm looking for a collective word that described BOTH *un* and *able*. | 2013/12/30 | [
"https://english.stackexchange.com/questions/143700",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/60849/"
] | I think the word you are looking for is [affix](http://en.wikipedia.org/wiki/Affix), though that also includes "-fixes" other than just "suffix" and "prefix".
>
> [Noun: affix (plural affixes)](http://en.wiktionary.org/wiki/affix)
>
>
> (linguistics) A bound morpheme added to a word’s stem; formerly applied only to... | Like the other answers mentioned, the general word referring to prefixes, suffixes and similar, is *affix*. However, [Wikipedia](http://en.wikipedia.org/wiki/Infix) also mentions *adfix* as joint name for prefixes and suffixes but **not** any other kind of affix:
>
> It [infix] contrasts with adfix, a rare term for a... |
12,097,243 | Consider I am given a specific range (0 to 5,000,000) and I should generate 2,500,000 unique random numbers from this range. What is an efficient way to do this? I understand that is tough to get true random numbers.
I tried by checking if a number exists so that I can generate a new random number. But it takes hours... | 2012/08/23 | [
"https://Stackoverflow.com/questions/12097243",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/73137/"
] | Easiest way to code it:
```
std::random_shuffle(vectoshrink.begin(), vectoshrink.end());
vectoshrink.resize(vectoshrink.size() / 2);
```
If you want to maintain the order of the elements in `vectoshrink` use AndreyT's answer.
If you really do want to select the indexes in advance:
```
std::vector<size_t> vec(vecto... | Generate 1st number <5M, 2nd number <(5M-1), etc. Each time after you remove element, you'll have one element less and you don't care if it's the same number. ;-) This doesn't answer your question about unique numbers, but about halving your vector.
And you will not have to generate more numbers than you need. |
656,079 | I created a basic test PostgreSQL RDS instance in a VPC that has a single public subnet and that should be available to connect over the public internet. It uses the default security group, which is open for port 5432. When I try to connect, it fails. I must be missing something very straightforward -- but I'm pretty l... | 2015/01/03 | [
"https://serverfault.com/questions/656079",
"https://serverfault.com",
"https://serverfault.com/users/86294/"
] | The issue was that the inbound rule in the Security Group specified a security group as the source. Changing it to a CIDR that included my IP address fixed the issue.
Open the database security group in AWS; and choose "Edit inbound rules"; "Add rule". There is a "My IP" option in the dropdown menu; select that option... | Was facing similar issue, and this is how I resolved it:
Click on the security group for the RDS instance and check the inbound rules. You might see something like this:
[](https://i.stack.imgur.com/lgoNh.png)
Have to set the IP range to contain you... |
50,100,211 | In angular i want to check the component containing any input value is changed or Not.
Example.
i have a page with 5 controls (3 text box and 2 drop downs )
if the value got changed on textbox or drop down,i want to identify that is any value is changed or it is as previous.
please help me,if any one can.. | 2018/04/30 | [
"https://Stackoverflow.com/questions/50100211",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5291499/"
] | If you're using [`ReactiveForms`](https://angular.io/api/forms/ReactiveFormsModule) you can use [`valueChanges`](https://angular.io/api/forms/AbstractControl#valueChanges) like:
```
this.myFormGroup.valueChanges
.debounceTime(500) // optional
.subscribe(data => {
// do some stuff with `data`
});
``` | In input field write `(ngModelChange)="findchanges(inputValue)"`. Then in ts file get changes of that input field. |
49,962,583 | I want to write a function that extracts n number of elements from the start of a list in Haskell. I know it can be done using the built-in 'take' function and I have done it, which works. However, I can't seem to write a function without take.
This is my code.
```
takeElem' :: Int -> [t] -> [t]
takeElem' _ [] = []
ta... | 2018/04/22 | [
"https://Stackoverflow.com/questions/49962583",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9483263/"
] | I didn't add what should happen in the case when n is zero. I just added
```
takeElem' 0 list = []
```
it works now. | It should be 0 \_ instead of \_ [].
Because you are saying it is [] when you took everything of the list instead of [] when your n reaches 0. |
22,125,096 | I am preparing for an entry-level job interview. I am trying to reverse the order of words in a string, but my output is a bunch of junk that makes no sense. I think the problem may be because I'm using "char\*" for my functions? Anyways, heres my code
```
#include <iostream>
#include <string>
using namespace std;
ch... | 2014/03/02 | [
"https://Stackoverflow.com/questions/22125096",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3370198/"
] | let me recommend a different approach. If youre using char pointers:
1. split the string using `strtok` into an array of `char*`s.
2. iterate over this array of words from the end backwards and reassemble the string.
If you opt to use strings and STL containers, refer to this question as for splitting the string to t... | ```
#include "stdafx.h"
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
void split(string &str, vector<string> &v, char ch);
int main() {
string str;
std::getline(std::cin, str);
vector <string> stringVec;
split(str, stringVec, ' ');
vector <string>::reverse_iter... |
58,358,936 | Despite a ton of searching, I can't find any method equivalent in the Firebase Realtime Database to the increment method available in Firestore.
The problem I am trying to solve is that I have a ticketing app which increments a counter on Firebase for attendees at the event; however if a user went offline and was reg... | 2019/10/12 | [
"https://Stackoverflow.com/questions/58358936",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1072220/"
] | There's a new method `ServerValue.increment()`in firebase Swift SDK
It's better for performance and cheaper since no round trip is required.
API Docs [here](https://firebase.google.com/docs/reference/swift/firebasedatabase/api/reference/Classes/ServerValue)
Usage example:
```
firebase.database()
.ref('somePath'... | Realtime Database does seem to have this feature now. The API reference is here: <https://firebase.google.com/docs/reference/js/firebase.database.ServerValue#increment>
Basically in a `ref.update()` you will provide `database.ServerValue.increment(n)` on the field you wish to increment.
For example:
```
ref.update({... |
5,345,253 | I have written my own module, mainly handling a filefield for a django site. After messing around with some things related to mod\_wsgi (solved by updating to 3.3), i got my code to run. Right after all the necessary imports, before defining any classes or functions, i test for the availability of sox, an audiocommandl... | 2011/03/17 | [
"https://Stackoverflow.com/questions/5345253",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/581421/"
] | `||` says: if any condition is true, It'll return true, without looking at the ones after it.
So `true || false` is true, `false || true` is true.
In your case, you say "if strExt is not equal to **wav** and is not equal to **mp3**, then execute the code". In case that one of them is true, it executes.
I'm thinking ... | If you want to get into second `if`, when `strExt` is not equal to both `'wav'` and `'mp3'` you need to use an `&&` operator.
```
if (strExt!='wav' || strExt!='mp3')
```
when `strExt='wav'` => `strExt!='wav'` = false; `strExt!='mp3'` = true => false or true = true and gets into `if` statement and is the case is simi... |
5,605,092 | I would like to get the physical address of Linux "jiffies" variable so that I can read it by just reading the contents of this memory address. | 2011/04/09 | [
"https://Stackoverflow.com/questions/5605092",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/703810/"
] | For kernel code, use the functions defined in `include/linux/jiffies.h`. (`get_jiffies_64` for example).
[Kernel command using Linux system calls](http://www.ibm.com/developerworks/linux/library/l-system-calls/) illustrates syscall handling in Linux with a userspace syscall that reads jiffies. Could be what you're aft... | If you have the sources installed,
```
locate jiffies
```
schould reveal the .c and .h files, as in:
```
/usr/src/linux-headers-$(uname -r)/include/linux/jiffies.h
``` |
59,857,971 | I keep running into an issue where I am awaiting data from a prop to do something within it inside my created hook. It keeps throwing errors such as "this.value is not defined" (As it has not yet loaded from prop)
I have fixed some of these issues using `v-if` and only using as needed. However in some cases I wanted t... | 2020/01/22 | [
"https://Stackoverflow.com/questions/59857971",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9469439/"
] | The accepted answer provides a great solution, which set `v-if` on entire Child component in Parent component. However there's still some edge cases where your prop literally becomes empty or null if the API returns so, which eventually ends up never rendering your Child component at all though you might need to show s... | There are at least two approaches I can think of:
1. Dependency injection
-----------------------
The parent/root to `provide` the data/object down the component tree and the receiving end (children) to `inject` them.
**Parent**
```js
{
data: () => ({
userInfo: null
}),
created() {
// Populates data ... |
811,711 | 
I am having issues identifying if the following are reflexive/symmetric/antisymmetric/transitive. Could anybody help me out? I have the book definitions but I'm confused on really the application of the definition. | 2014/05/27 | [
"https://math.stackexchange.com/questions/811711",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/152086/"
] | The answer is no. Indeed,for $ k \in N$ let $\mu\_k$ be a Dirac measure concentrated at $x=0$(we consider measures on the real axis $R$). Then $\sum\_{k \in N}\mu\_k$ is not atomic measure in the above-mentioned sense | It seems that the answer is positive: If $(\mu\_n)\_{n \in \mathbb{N}}$ is a sequence of atomic measures, then the sum $\sum\_{n \in \mathbb{N}} \mu\_n$ is atomic. This has been shown by P. Capek in his paper *The atoms of a countable sum of set functions* (Mathematica Slovaca 1989, No. 1, p.81-89; [link](http://dml.cz... |
120,121 | Given two lists that contain no duplicate elements `a` and `b`, find the crossover between the two lists and output an ASCII-Art Venn Diagram. The Venn Diagram will use a squarified version of the traditional circles for simplicity.
Example
=======
**Given:**
```
a = [1, 11, 'Fox', 'Bear', 333, 'Bee']
b = ['1', 333,... | 2017/05/11 | [
"https://codegolf.stackexchange.com/questions/120121",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/59376/"
] | [Husk](https://github.com/barbuz/Husk), ~~72~~ 58 bytes
=======================================================
```
mṙ1₁Fz+m(₁TT' Ṡ:→S:öR'-→▲mL)TTømėF`-FnF-
Ṡz:(`:'+:'+R'|-2L
```
[Try it online!](https://tio.run/##yygtzv7/P/fhzpmGj5oa3aq0czWAdEiIusLDnQusHrVNCrY6vC1IXRfIejRtU66PZkjI4R25R6a7Jei65bnpcgFVVVlpJFipawNRkHq... | [Python 2](https://docs.python.org/2/), ~~221~~ ~~210~~ 212 bytes
=================================================================
```python
m=map
A,B=m(set,input())
d=A-B,B&A,B-A
e=[max(m(len,s))+1for s in d]
p,i,n='+|\n'
o=b=p+p.join(m('-'.__mul__,e))+p+n
while sum(m(len,d)):o+=i+i.join(m(str.ljust,[len(s)and s.pop... |
73,065,922 | I am trying to use Unix's comm command to compare two files in Tcl.
I tried the below to no avail:
```
exec bash -c {comm -2 -3 <(sort file1) <(sort file2) > only_in_file1}
exec {comm -2 -3 <(sort file1) <(sort file2) > only_in_file1}
```
It is one of the quick way that I know to do so but if there is a method in T... | 2022/07/21 | [
"https://Stackoverflow.com/questions/73065922",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18627911/"
] | Using boolean arithmetics:
```
N = 3
m1 = df['values'].le(0)
m2 = df.groupby(m1.cumsum())['values'].transform('count').gt(N)
df['period'] = (m1&m2).cumsum().where((~m1)&m2)
```
output:
```
values period
1 0 NaN
2 8 NaN
3 1 NaN
4 0 NaN
5 5 1.0
6 6 ... | You can try
```py
sign = np.sign(df['values'])
m = sign.ne(sign.shift()).cumsum() # continuous same value group
df['period'] = (df[sign.eq(1)] # Exclude non-positive numbers
.groupby(m)
['values'].filter(lambda col: len(col) >= 3)
.groupby(m)
.ngro... |
6,888,297 | ```
public class Car
{
public char color;
public char getColor()
{
return color;
}
public void setColor(char color)
{
this.color = color;
}
}
public class MyCar
{
private Car car = null;
public MyCar()
{
this.car = new Car();
car.c... | 2011/07/31 | [
"https://Stackoverflow.com/questions/6888297",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/778896/"
] | Well, I would view it in these terms:
* Encapsulation: by allowing direct access to the `color` *field*, the `Car` class is exposing an implementation detail. Ignacio has shown that he doesn't view this type of violation as one of encapsulation, but of data hiding - my own view of the word "encapsulation" is that it i... | Information hiding is violated in Car.
I think other principles are formally respected, ie. nothing stops me from having a MyCar class wrapping the Car class if the two classes are not intended to be used polymorphically.
One could argue that it is just bad design, and I would agree.
The same applies to using char... |
33,177 | Is there an Android app that enables hand-writing / drawing on a word document? I want to draw and write on the text. I don't want to edit the document, but write on the top of it. Instead of typing the letters using the keyboard, I want to draw on the text. Just like writing / drawing on a picture, I would like to dra... | 2012/11/10 | [
"https://android.stackexchange.com/questions/33177",
"https://android.stackexchange.com",
"https://android.stackexchange.com/users/23432/"
] | In the Play store there is a 'installed' tab which as the name implies is of currently installed applications. The 'all' tab shows apps which have ever been installed on the device.
If you don't want a application to show up in this list, then from the phone open Play store, go into your My Apps and on the All tab yo... | Deleting cache and data of the Play store app solved the problem for me. |
4,896,446 | I've written a application and using 6 timers that must start after each other but these timers don't work properly. I don't know much about timers.
For example, timer1 start and something happen in application. then timer1 must stop forever and timer2 must start immediately and something happen in application. Then t... | 2011/02/04 | [
"https://Stackoverflow.com/questions/4896446",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/602869/"
] | It sounds like you don't need six timers - you need *one* timer, which does one of six actions when it fires, depending on the current state. I think that would lead to much simpler code than starting up multiple timers. | The first thing to consider here, is that if all 6 timers have the *exact* same code, I'm certain that your better of using only one timer, and instead keep a state that let's you know if you are in mode 1,2,3,4,5 or 6. This will also remove the need to stop the first timer, and start the new one.
So have a class vari... |
61,987,967 | So I have this assignment where I have to create a Winforms table data and display it.
I have created first form (DataGridView) to display the detail of the product view with function add, modify buttons to it, and the second form which allows me to enter the product id and product name and save the data as well.
But... | 2020/05/24 | [
"https://Stackoverflow.com/questions/61987967",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12815504/"
] | The method is exposed as part of the `DocumentPrototype` object, accessible under `window.Document.prototype`:
The `window.document` instance only inherits it from the `Document` class.
```js
console.log( Document.prototype.getElementById );
Document.prototype.getElementById = (val) => 'gotcha ' + val;
console.log... | It will depend on native code (probably in C++) that is part of the browser. You could search for getElementById in the source code of a web browser to look at it.
JavaScript is an interpreted language; every web browser has a JavaScript interpreter. When you write JavaScript yourself, you can define methods on object... |
26,433,561 | I can search exact matches from Google by using quotes like `"system <<-"`.
How can I do the same thing for GitHub? | 2014/10/17 | [
"https://Stackoverflow.com/questions/26433561",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/170931/"
] | If your search term is a filename or other substring which contains punctuation characters, a partial workaround to get GitHub's code search to return instances of that substring is to (1) replace the punctuation characters in your search term with spaces, and (2) enclose the search term in quotes.
For example, instea... | If you **quickly want to search inside a specific repo**, try that:
* Press `.` while viewing the repo to open it inside a browser-based VS Code window
* Enter your search term into the menu on the left
* Enable indexing
[](https://i.stack.imgur.c... |
2,255,008 | Using my not-outstanding Google skills, I have not been able to find a decent tutorial on Groovy for Ruby programmers. There are a lot of political pieces (Ruby is great! Groovy is great!) and tiny little contrasts, but I really don't care which is better. I know Ruby (and Java) relatively well, and I'd like to learn G... | 2010/02/12 | [
"https://Stackoverflow.com/questions/2255008",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8047/"
] | Did you see [this](http://blog.headius.com/2008/04/converting-groovy-to-ruby.html) and [this](http://www.glenstampoultzis.net/blog/?p=61)?
Relatively short posts, I know. You're right; there doesn't appear to be much...
update: [two](http://www.javabeat.net/articles/16-introduction-to-groovy-scripting-language-1.html)... | We need more questions like this one. Three years after the question, there's still a comparitive lack of information on this moving betwen these two similar languages.
I did find this Slide Share presentation, which covers a lot of basic ground.
* **[Comparing groovy and (j)ruby](http://fr.slideshare.net/dnosenko/c... |
3,098,737 | >
> Prove that $\lim\_{(x,y)\to(0,0)}(xy+y^{3})=0$.
>
>
>
I am trying to determine how to set the $\delta$. Here is my rough work, which isn't much:
$|f(x,y)-0|=|xy+y^{3}|\leq |y||x+y^{2}|$
I am not sure whether I should separate $y$ or separate $xy$ and $y^{3}$ to make it $|xy| + |y^{3}|$. Any ideas how to fini... | 2019/02/03 | [
"https://math.stackexchange.com/questions/3098737",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/-1/"
] | **Hint**
For $\vert x \vert, \vert y \vert \le 1$, you have
$$\vert xy+y^3 \vert \le \vert x \vert \vert y \vert + \vert y \vert^3 \le \vert x \vert \vert y \vert + \vert y \vert\le 2 \vert y \vert$$ | Using polar coordinates (not really necessary here, but useful in harder cases):
$$|xy + y^3| = |r^2\cos\theta\sin\theta + r^3\sin^3\theta|\le r^2 + r^3,$$
and $r = \|(x,y)\|$ (euclidean norm), so... |
43,407 | I am trying to make a transportable charger for iPhones, but before I can start this I need to know how much power my iPhone uses when I make an emergency call.
If nobody knows this, I will be glad to have any information related to this. | 2012/03/12 | [
"https://apple.stackexchange.com/questions/43407",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/20006/"
] | [Anandtech](http://www.anandtech.com/show/4971/apple-iphone-4s-review-att-verizon/15) has some nice charts detailing the wattage of the iPhone 4S running various apps, which could be a good starting point for you.
You may also want to check out existing kits/projects, such as [MintyBoost](http://www.ladyada.net/make/... | The power use is going to vary somewhat depending on external factors on the RF side. Network mode in use (GSM/3G) and the power required to establish a stable connection to the cell site in use together with any other usage on the device (speaker/bluetooth/GPS)
Best guess is that your baseline should be the specified... |
3,430,447 | I'm new to MVC and I'm implementing the Nerd Dinner MVC sample app in MS MVC2. I'm on step 10, "Ajax enabling RSVPs accepts". I've added the new RSVP controller and added the Register action method like so:
```
public class RSVPController : Controller
{
DinnerRepository dinnerRepository = new DinnerRepository();
... | 2010/08/07 | [
"https://Stackoverflow.com/questions/3430447",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/177347/"
] | This portion of your action explains why you just get the "see you there" message:
```
return Content("Thanks - we'll see you there!");
```
That's all that's being returned.
The reason you were getting a 404 to begin with is the use of an actionlink:
```
Ajax.ActionLink(...
```
That will create a URL link, a G... | As an additional comment to debugging issues with this problem, being a Java/JSF developer, I ran into a hard lesson that
```
<script src="/Scripts/MicrosoftAjax.js" type="text/javascript" />
```
and
```
<script src="/Scripts/MicrosoftAjax.js" type="text/javascript"></script>
```
are processed differently. The fi... |
59,037,856 | im trying to create a component in react native.
The example of the component is:
```js
import React from 'react'
import PropTypes from 'prop-types'
import { View, Text, Image } from 'react-native'
const MyComponent = ({Text, Image}) => {
return (
<Text>{Text}</Text>
<Image source={require('../../assets/i... | 2019/11/25 | [
"https://Stackoverflow.com/questions/59037856",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12368797/"
] | You are passing **Text** and **Image** as arguments (props) to your function.
1. Not sure where you are using the image prop; if you aren't you should remove it.
2. **As for the Text argument, you need to change this to *text* with lowercase *t***. Anything you pass as prop is essentially an argument to a function. U... | Try importing and using Image like this
```
import myIMage from '../../sourcefile.png'
const Component = (props) => {
return (
<View>
<View />
<Image source={myImage} style={{height: 100, width: 100}} /> //style is important here
</View>
export default Component;
``` |
16,092,951 | Is it possible to exclude a column from my WebAPI's IQueryable function? e.g. How would I exclude the property "FirstName" from my people entity:
```
[HttpGet]
public IQueryable<Contact> GetPeople()
{
return _contextProvider.Context.People;
}
```
pseudocoded:
```
[HttpGet]
public IQueryable<Contact> GetPeople()... | 2013/04/18 | [
"https://Stackoverflow.com/questions/16092951",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1612628/"
] | Project results manually to `Contact` entity, and do not provide data for `FirstName` column:
```
[HttpGet]
public IEnumerable<Contact> GetPeople()
{
return from p in _contextProvider.Context.People
select new Contact {
Id = p.Id,
LastName = p.LastName
};
}
```
... | Another method is to decorate the column with `Runtime.Serialization.IgnoreDataMember` like this.
```
[Runtime.Serialization.IgnoreDataMember]
public string FirstName { get; set; }
``` |
66,868,663 | I am having `jsconfig.json` in my root directory using `Nuxt.js` project.
And I am having an error:
```
File '/home/mike/Documents/nuxt/node_modules/dotenv/types' not found.
The file is in the program because:
Root file specified for compilation
```
Actually 5 errors in a first line of `jsconfig.json`:
[![Erro... | 2021/03/30 | [
"https://Stackoverflow.com/questions/66868663",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14923276/"
] | Just reload VSCode by typing `ctrl + shift + p` then type `reload window` and it should work. | I ran into this and just exiting and relaunching VSCode (from the icon) seemed to fix it.
I'd originally started via `code .` so I'm thinking perhaps the instance with the error had picked up a weird env var from my terminal. |
2,689,947 | In particular I mean:
$$\sin(x)^2 + \cos(x)^2$$
$$=\left(\sum\_{n=0}^{\infty} (-1)^n \frac{x^{2n+1}}{(2n+1)!}\right)^2 + \left(\sum\_{n=0}^{\infty} (-1)^n \frac{x^{2n}}{(2n)!}\right)^2$$
However I am not sure how you're supposed to correctly expand and recombine terms when dealing with the sum of two squared series,... | 2018/03/13 | [
"https://math.stackexchange.com/questions/2689947",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/539262/"
] | Absolutely. Power series actually multiply just like polynomials do: $$(a\_0+a\_1x+a\_2x^2+a\_3x^3+\ldots)(b\_0+b\_1x+b\_2x^2+\ldots)=\sum\_{n=0}^{\infty}\left(\sum\_{c=0}^na\_cb\_{n-c}\right)x^n.$$
Let $$\alpha(x)=\left(\sum\_{n=0}^{\infty} (-1)^n\frac{x^{2n+1}}{(2n+1)!}\right)^2$$
$$\beta(x)=\left(\sum\_{n=0}^{\inft... | Note that just using their series
$$\sin^2 x + \cos^2 x=(\cos x+i\sin x)(\cos x-i\sin x)\stackrel{\text{by series}}=e^{ix}e^{-ix}=1$$ |
62,296,032 | What is the time complexity of this code to find if the number is power of 2 or not.
Is it **O(1)**?
```
bool isPowerOfTwo(int x) {
// x will check if x == 0 and !(x & (x - 1)) will check if x is a power of 2 or not
return (x && !(x & (x - 1)));
}
```
### [LeetCode 231](https://leetcode.com/problems/power-... | 2020/06/10 | [
"https://Stackoverflow.com/questions/62296032",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8548556/"
] | Yes, It is O(1), but Time complexity for bitwiseAnd(10^9,1) bitwiseAnd(10,1) are not same even though they both are O(1). In reality, there are 4 basic operations involved in your equation itself, which we consider as basic and unit operations in terms of the power of computing that it does. But in reality, These basic... | Yes the code is time complexity O(1) because the running time is constant and does not depend on the size of the input. |
31,289,296 | I have been talking to less/css developers and they would like to do static code analysis on there less code. I was wondering if there is a plugin for sonar that can do this analysis on the less code instead of the generated css code? | 2015/07/08 | [
"https://Stackoverflow.com/questions/31289296",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3420578/"
] | The styling of the anchor's title is handled by the user agent.
If you want to style a tool tip yourself, you would have to implement it.
For more information see [here](http://www.w3.org/TR/html401/struct/global.html#adef-title) | It is impossible.
But you could use something else, instead of "native" title.
Add your own custom attribute and do some javascript/css to display a tooltip.
ex:
```
<a href="linkstowhatyouwant" data-mytitlecustom="click here" class="tooltipped">
```
and with jQuery/Javascript/CSS, you detect when mouse is over a... |
45,229,032 | ```
#include<bits/stdc++.h>
using namespace std;
main()
{
vector<vector<int> > v;
for(int i = 0;i < 3;i++)
{
vector<int> temp;
for(int j = 0;j < 3;j++)
{
temp.push_back(j);
}
//cout<<typeid(temp).name()<<endl;
v[i].push_back(temp);
}
}
```
I... | 2017/07/21 | [
"https://Stackoverflow.com/questions/45229032",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6672853/"
] | **Problem:** Your vector `v` is empty yet and you can't access `v[i]` without pushing any vector in v.
**Solution:** Replace the statement `v[i].push_back(temp);` with `v.push_back(temp);` | Just do it...
=============
```
#include<bits/stdc++.h>
using namespace std;
int main()
{
vector<vector<int> > v;
for(int i = 0; i < 3; i++)
{
vector<int> temp;
for(int j = 0; j < 3; j++)
{
temp.push_back(j);
}
v.push_back(temp);//use v instead of v[i];
... |
36,617,682 | I'm having trouble importing an .sql dump file with docker-compose. I've followed the docs, which apparently will load the .sql file from docker-entrypoint-initdb.d. However, when I run `docker-compose up`, the sql file is not copied over to the container.
I've tried stopping the containers with `-vf` flag, but that d... | 2016/04/14 | [
"https://Stackoverflow.com/questions/36617682",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1279007/"
] | After many attempts with the volumes setting i found a workaround
I created another image based on mysql with the following in the Dockerfile
```
FROM mysql:5.6
ADD dump.sql /docker-entrypoint-initdb.d
```
Then removed the volumes from compose and ran the new image
```
frontend:
image: myimage
ports:
- "80... | Mysql database dump **schema.sql** is residing in the **/mysql-dump/schema.sql** directory and it creates tables during the initialization process.
docker-compose.yml:
```
mysql:
image: mysql:5.7
command: mysqld --user=root
volumes:
- ./mysql-dump:/docker-entrypoint-initdb.d
environment:
M... |
16,543,528 | I installed BB tools for Eclipse, just added and removed BB Nature to one of my projects.
And now, I can't compile it (for Android).

Eclipse told me about some troubles in AndroidManifest.xml:
**native-code: armeabi AndroidManifest.xml /VitocarsAnd... | 2013/05/14 | [
"https://Stackoverflow.com/questions/16543528",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1331598/"
] | Following example shows a simplest way to serialize `struct` into `char` array and de-serialize it.
```
#include <iostream>
#include <cstring>
#define BUFSIZE 512
#define PACKETSIZE sizeof(MSG)
using namespace std;
typedef struct MSG
{
int type;
int priority;
int sender;
char message[BUFSIZE];
}MSG;... | Ok I will take the [example](http://www.boost.org/doc/libs/1_53_0/libs/serialization/doc/tutorial.html) from the boost web site as I don't understand what you can not understand from it.
I added some comments and changes to it how you can transfer via network. The network code itself is not in here. For this you can... |
6,656,651 | The documentation says that 160 dp (density-independent) equals 1 inch. And 72 pt is also 1 inch. So I don't see why android define a dp measurement while it seems to work the same as points. Can anybody explain that? Why should I use dp if I can use pt? | 2011/07/11 | [
"https://Stackoverflow.com/questions/6656651",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/839680/"
] | The Android documentation used to incorrectly state that 160 dp always equals 1 inch regardless of screen density. This was reported as a [bug](http://code.google.com/p/android/issues/detail?id=21159) which was accepted and the documentation updated.
From the updated documentation:
160 dp will NOT always equal 1 inch... | Out of curiosity, I tried the layout from John's answer on my two devices: Asus Transformer (10.1 in) and HTC Legend (3.2 in). The results were pretty interesting:
Transformer (cropped):

And Legend:
 |
43,020,393 | [](https://i.stack.imgur.com/yHFD9.jpg)
This method should only be accessed from tests or within private scope less... (Ctrl+F1)
This inspection looks at Android API calls that have been annotated with various support annotations (such as RequiresPermission or UiThre... | 2017/03/25 | [
"https://Stackoverflow.com/questions/43020393",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7559349/"
] | ```
Uri downloadUrl = taskSnapshot.getStorage().getDownloadUrl();
```
Change the variable name:
```
Task<Uri> downloadUrl = taskSnapshot.getStorage().getDownloadUrl();
```
It will work. | Since you are on version 10.0.1
do this instead so it will work
```
@SuppressWarnings("VisibleForTesting") Uri downloadUrl = taskSnapshot.getDownloadUrl();
``` |
45,262,038 | I am using a `KSH` script to execute a binary (program) that has the following syntax to execute correctly:
* `myprog [-v | --verbose (optional)] [input1] [input2]`
The program prints nothing & returns exit code 0 (zero) on success. On failure it prints ERROR messages to `STDERR` & returns `exit status > 0`. If `-v` ... | 2017/07/23 | [
"https://Stackoverflow.com/questions/45262038",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3050164/"
] | Rather than trying to monkey patch redirections into the command line, just redirect the streams when you parse the flags. That is:
```
while getopts "va:b:" arg
do
case $arg in
v) # verbose output
verbopt="-v"
exec 1>${dateTime}_out.log 2>${dateTime}_err.log
;;
...
``... | The problem is that `>` is not expanded in the value of `$log`.
I'm afraid you will need to use a conditional for this, for example:
```
cmd="myprog $verbopt $arg1 $arg2"
if [ "$log" ]; then
$cmd 1>${dateTime}_out.log 2>${dateTime}_err.log
else
$cmd
fi
``` |
495,993 | To be a 'silverlight' developer, is it basically asking for both programming and graphic skills?
Or is it just a matter of implementing the graphics into the silverlight project?
i.e. can you be a silverlight guru and yet not know heads from tails when it comes to graphic design? | 2009/01/30 | [
"https://Stackoverflow.com/questions/495993",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39677/"
] | To be a silverlight developer, you really only need to know a .NET language, event driven programming, and how to use markup for XAML. It's pretty simple really; the XAML describes UI elements (which can all be handled by the designer) which can then be used in code as a .NET object is created for each UI element.
Kno... | It is not strictly necessary to be a good graphic designer, knowing how to develop .NET applications and XAML is sufficient. However, it's like drawing, all you have to do is to hold a pencil and move your hand, but if you have a good sense for art, the result will be better. Since in Silverlight your potential targets... |
67,554,315 | New to react and hooks, I am trying to do a login module using hooks. However when I am not able to update the state of my Auth state. Read elsewhere that useState do not update immediately and needs to be coupled with useEffect() to have it updated. However I am using useState in a custom hook and not sure how to have... | 2021/05/16 | [
"https://Stackoverflow.com/questions/67554315",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14195732/"
] | At last i achieved this with the below solution
```
String vpnsBtn;
if (check.equals("night")){
switch (status) {
case "connect":
vpnBtn.setVisibility(View.VISIBLE);
vpnsBtn = ("disconnected.json");
logTv.setTextColor(getResources().getColor(R.colo... | For using Lottie I did these:
In `build.gradle(:app)` add this and sync:
```
implementation ‘com.airbnb.android:lottie:$lottieVersion’
```
then, add `assets` file. Then, add the JSON files there. Then, go to `activity_main.xml` file, add:
```
<com.airbnb.lottie.LottieAnimationView
android:id="@+id/lav_... |
13,731,107 | I have some simple classes that looks like this:
```
Class Favorites
Guid UserId
Guid ObjectId
Class Objects
Guid Id
String Name
```
With Entity Framework I want to select all the Objects which has been marked as a favorite by a user.
So I tried something like this
```
context.Objects.Where(
x => x.Id ==
c... | 2012/12/05 | [
"https://Stackoverflow.com/questions/13731107",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/909902/"
] | you could use join clause:
```
context.Favorite
.Where(f => f.UserId == UserId)
.Join(context.Objects, t => t.ObjectId, u => u.Id, (t, u) => t);
``` | Use FirstOrDefault() instead of Any() |
27,803,870 | In Yii 1 it was possible to publish an asset with:
```
Yii::app()->getAssetManager()->publish(Yii::getPathOfAlias('ext.MyWidget.assets'));
```
How can I publish an asset within a widget in Yii2? | 2015/01/06 | [
"https://Stackoverflow.com/questions/27803870",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1714171/"
] | In your view of your widget:
```
app\assets\AppAsset::register($this); // $this == the View object
```
Check [the docs](http://www.yiiframework.com/doc-2.0/guide-structure-assets.html). | The problem for this case in the question.
==========================================
In Yii2 AssetBandle should be unique because it avoids duplication on load same files on a web page. In Yii1 it was a problem.
Almost all of the suggested answers here do not solve this problem.
That why the answer should be like th... |
2,720,770 | There is em dash and en dash. Is there an "en" equivalent to * * ? Is there an *en* equivalent to pure *Ascii 32*?
I want a better way to write this:
```
123<span class="spanen"> </span>456<span class="spanen"> </span>789
```
or this:
```
123<span class="spanen"> </span>456<span class="spanen"> </sp... | 2010/04/27 | [
"https://Stackoverflow.com/questions/2720770",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/89021/"
] | The Unicode character U+2002 *EN SPACE* (` `, ` ` or as entity reference ` `) is a space with en width. | You could alter your CSS in such:
```
.spanen{word-spacing:.6em;}
``` |
36,203,469 | I've created child themes before without issue however when I create one using Woocommerce Mystile theme it does not display properly with menu items missing and images resizing to be too large.
I made the child theme by creating a new folder in the wp-content>themes folder called mystile-child and creating style.css w... | 2016/03/24 | [
"https://Stackoverflow.com/questions/36203469",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1026127/"
] | ```
$('head').append('<link rel="stylesheet" href="style.css" type="text/css" />');
$('head').append('<script type=text/javascript" src="script.js" />');
```
or if you want to add the code and not the file the:
```
$('body').append($("<script>alert('avascript!');<\/script>")[0]);
$('body').append($("<style>.someclas... | * If you only need to append different forms at a given time, you can put all the forms on the page and then hide/show them with jquery.
* If the javascript is for validations purposes, you can write different functions that will be called depending on the form you are submitting.
* Finally the css can be applied to ea... |
25,325,413 | Suppose, we have the following HTML file:
### test.htm
```
<!DOCTYPE html>
<html>
<head>
<title>test</title>
</head>
<body>
<b>weight:</b> 120kg<br>
<b>length:</b> 10cm<br>
</body>
</html>
```
How can I get the following data from it?
```
{
'weight' => '120kg',
'length' => '10cm',
}
```
### p... | 2014/08/15 | [
"https://Stackoverflow.com/questions/25325413",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/789186/"
] | This gets you very close to what you want (you'll need to tweak the text strings you're getting for the keys and values slightly).
But I think you'll find it far simpler using a tool like [Web:Scraper](https://metacpan.org/pod/Web::Scraper).
```
#!/usr/bin/env perl
use strict;
use warnings;
use 5.010;
use Data::Dum... | Two solutions using [`Mojo::DOM`](https://metacpan.org/pod/Mojo::DOM):
```
use strict;
use warnings;
use Mojo::DOM;
use Data::Dump;
my $dom = Mojo::DOM->new(do {local $/; <DATA>});
my %hash = do {
my $text = $dom->find('body')->all_text();
split ' ', $text;
};
dd \%hash;
my %hash2 = map {
$_->all_text... |
310,589 | In our MOSS '07 site we have a page that contains just a Page Viewer web part in it that points to a site on another server. However, I've noticed that on that page (and any others that have a Page Viewer web part on it) our drop down menus and hover effects are **super slow** and completely max out the CPU on the visi... | 2008/11/22 | [
"https://Stackoverflow.com/questions/310589",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30866/"
] | ```
function loadJSInclude(scriptPath, callback)
{
var scriptNode = document.createElement('SCRIPT');
scriptNode.type = 'text/javascript';
scriptNode.src = scriptPath;
var headNode = document.getElementsByTagName('HEAD');
if (headNode[0] != null)
headNode[0].appendChild(scriptNode);
if... | You might want to take a look at a real [DEMO](http://bachhoa24.com/ban-nha-di-an-bd-dt11x20m-gia-1-ty-200-cl-1002687.html#show_map) on real estate site.
On the demo page, just click on the link [Xem bản đồ] to see the map loaded on demand.
The map loaded only when the link be clicked not at the time of page load, so ... |
267,609 | Outlook 2010.
Want to create a rule that moves all mail from my inbox to another folder:
* Has been read
* Is older than X days
I was looking at Auto-archiving, but it does not seem to let me be this specific with my criteria. | 2011/04/07 | [
"https://superuser.com/questions/267609",
"https://superuser.com",
"https://superuser.com/users/49303/"
] | The search folders are the answer, however the OP asked about mail *older than* a particular date. If you use "modified last week" then it shows everything within the last week and filters out things older than 1 week. For the inverse that, use language like:
* 8 days ago
* 1 week ago
* etc...
![enter image descripti... | For the upcoming researchers, i have done the following using Developer tools
```
Public WithEvents olItems As Outlook.Items
Sub Application_Startup()
Set olItems = Session.GetDefaultFolder(olFolderInbox).Items
End Sub
Private Sub olItems_ItemChange(ByVal Item As Object)
Dim deFolder ... |
40,684,698 | Since November 8, 2016, we've seen a sudden increase in crashes from WebThread. We don't know what is causing the crash.
We do have web articles and ads in the app. We did not have any App Release. There were no significant changes on the web or ads.
Since crashes are happening on screens without articles, we are thi... | 2016/11/18 | [
"https://Stackoverflow.com/questions/40684698",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/413594/"
] | **Answering my own question to add more details than comment area.
Not marking as answered as I don't have solution.**
Unfortunately, we were not able to solve issue. Fortunately, crash rate came down after 2-3 days.
After spending 3 days, we were certain it was related to Google Ads. However, Why crash rate wen... | Simply put, the crash you are experiencing is because of a memory leak.
A variable or object is trying to access restricted memory, which will result in this crash. **My guess is that one of the advertising frameworks/APIs you are using did not handle the iOS 10.1.1 (Build 14B100) update which came out October 31st, ... |
8,224,422 | I currently have a JFrame where on it's content pane I draw images on from a game loop at 60 frames per second. This works fine, but at the right side, I now have more Swing elements on which I want to display some info on when selecting certain parts of the content pane. That part is a static GUI and does not make use... | 2011/11/22 | [
"https://Stackoverflow.com/questions/8224422",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/618622/"
] | Call the `update()` in `SwingUtilities.invokeAndWait()` which stops the thread and updates UI in EDT. | Problem is that you are use `Thread.sleep(int)`, that stop and freeze GUI during `EventDispatchTread` more in the [Concurency in Swing](http://download.oracle.com/javase/tutorial/uiswing/concurrency/index.html), [example](https://stackoverflow.com/questions/7943584/update-jlabel-every-x-seconds-from-arraylistlist-java)... |
22,080,382 | I was doing some MySQL test queries, and realized that comparing a string column with `0` (as a number) gives `TRUE`!
```
select 'string' = 0 as res; -- res = 1 (true), UNexpected! why!??!?!
```
however, comparing it to any other number, positive or negative, integer or decimal, gives `false` as expected
(of course ... | 2014/02/27 | [
"https://Stackoverflow.com/questions/22080382",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1385198/"
] | ["Strings are automatically converted to numbers and numbers to strings as necessary."](https://dev.mysql.com/doc/refman/5.0/en/comparison-operators.html#operator_equal) This means that in order to compare a string to a number, it tries to parse a number from the start of the string. In this case there is no number the... | if you want to fix it you can compare two strings:
```
select 'string' = convert(0,char) as res --- res = 0
``` |
25,797,320 | I wanted to get every thing between first occurence of (\*) and (\n)
**Here is the string:**
**\*Set of classes with distinct scalable between plugs, cores, and logs and are with and test data.\*Maps of class distributions across the basin.\*Description of the origin of the various classes and their link to types.**\... | 2014/09/11 | [
"https://Stackoverflow.com/questions/25797320",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1389485/"
] | The following should work:
```
result = subject.match(/\*[\s\S]*?\n(?!\*)/g);
```
Test it [live on regex101.com](http://regex101.com/r/tW3tW1/1). | Alternate, possibly quicker regex.
```
/\*[^\r\n]*\r?\n(?!\*)/g
``` |
22,203,661 | So I have the following html:
```
<div class="btn-group pull-right">
<button type="button" class="btn btn-success dropdown-toggle" data-toggle="dropdown">Export Features <span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
<li><a href="#" data-toggle="modal" data-target="#m... | 2014/03/05 | [
"https://Stackoverflow.com/questions/22203661",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3379926/"
] | Your code should works fine:
**[Bootply Demo](http://www.bootply.com/119106)**
Some things to note:
* You need to include `jQuery` since Bootstrap js require `jQuery` to works.
* You need to include Bootstrap CSS and JS files.
* Include Bootstrap JS after you've included `jQuery` properly. | Your call to the modal should match IDs. Use something like this:
```
<a data-toggle="modal" href="#myModal">CSV</a>
```
Your first div for you modal should be something like this
```
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
```
That shoul... |
146,695 | I'm embarrassed how many times I've used ordinary BJT transistors in circuits that clearly would have been better suited to a FET, and even better a MOSFET. This is because as a lifelong hobbyist, I have a huge stash of common BJTs, and sadly the days of well stocked "neighborhood" electronic store are long gone. Exper... | 2015/01/05 | [
"https://electronics.stackexchange.com/questions/146695",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/54964/"
] | First, you have to get over looking for parts that have thru hole variants. Hardly anything does anymore, and there's no point to them anyway. Soldering a SMD part is actually *easier* than soldering a thru hole part.
My common N channel FET goto part for low voltages is the IRFML8244. This is a great little part. It'... | MOSFETs are a little unlike BJTs in that while just about any BJT can be substituted for any other device (so long as the parameters are in the ballpark), MOSFET circuits typically depend on a particular Vt. This is because for the most part BJTs are characterized by the beta parameter, but it is considered poor design... |
18,350,662 | I notice python won't let you add an instance of a class to itself as a static member at class definition.
```
>>> class Foo:
... A = Foo()
...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 2, in Foo
NameError: name 'Foo' is not defined
```
However either of the... | 2013/08/21 | [
"https://Stackoverflow.com/questions/18350662",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1704140/"
] | Your first example doesn't work because you haven't created the class `Foo` yet. You're in the process of doing so (hence the `NameError`)
Your second example works because you have a class called `Foo()`. You override it, but you still keep a copy of it. Take a look at this:
```
>>> class Foo:
... def __init__(s... | At class definition time, the class itself doesn't exist yet, the contents of the indented block are executed and any names are resolved and functions are called. At that point, the name of the class, the base classes and a dictionary containing the names and values to store in the class are passed off to the metaclass... |
37,576,078 | I'm developing a C++ static library with Visual Studio 2015.
I have the following struct:
```
struct ConstellationArea
{
// Constellation's abbrevation.
std::string abbrevation;
// Area's vertices.
std::vector<std::string> coordinate;
ConstellationArea(std::string cons) : abbrevation(cons)
{}... | 2016/06/01 | [
"https://Stackoverflow.com/questions/37576078",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/68571/"
] | `ConstellationArea(std::string cons)` is a constructor and must be called during initialization of an object.
So it's legal to have `ConstellationArea area("foo")` because you are initializing the object.
But `area("foo")` is not an [initialization](http://en.cppreference.com/w/cpp/language/initialization), actually ... | Reassign the value?
```
area = ConstellationArea(tokens[0]);
``` |
17,862,804 | If i have a SQL statement like below
```
SELECT * FROM myTable WHERE CID = :vCID AND DataType = :vDataType
```
And usually i use TQuery to get some data like below
```
aQuery.ParamByName('vCID').Value := '0025';
aQuery.ParamByName('vDataType').AsInteger := 1;
```
But how can i ignore the "CID" key to get a SQL li... | 2013/07/25 | [
"https://Stackoverflow.com/questions/17862804",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/617179/"
] | The best option is to simply use separate queries:
```
aQueryBoth.SQL.Text := 'SELECT * FROM myTable WHERE CID = :vCID AND DataType = :vDataType';
...
aQueryBoth.ParamByName('vCID').Value := '0025';
aQueryBoth.ParamByName('vDataType').AsInteger := 1;
```
```
aQueryDataType.SQL.Text := 'SELECT * FROM myTable WHERE Da... | Change your Query to
```
SELECT * FROM myTable
WHERE CID = ISNULL(:vCID,CID) AND DataType = ISNULL(:vDataType,DataType)
```
or
```
SELECT * FROM myTable
WHERE COALESCE(CID,'') = COALESCE(:vCID,CID,'')
AND COALESCE(DataType,0) = COALESCE(:vDataType,DataType,0)
```
The second one would handle the case of NULL ... |
19,375,748 | "I have 3 buttons on click of the button using java script the div will appear each div have different button to save some data in asp.net
page but it refresh whole page i would like to refresh particular div only and save data to my db"
Button Code
```
<asp:Button ID="btnConse" runat="server" CssClass="Button" Al... | 2013/10/15 | [
"https://Stackoverflow.com/questions/19375748",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2881511/"
] | You aren't allocating memory for `global_variable`, so `fgets` tries to write at a random position in memory, leading to the OS detect memory violation and stopping the process by sending SIGSEGV that causes segmentation fault.
Change the your main to something like this:
```
int main () {
pthread_t t_m, t1, t2, ... | Note declaration:
```
char* global_variable;
```
is not an array but a pointer, and you are trying to read as:
```
fgets(global_variable, 999, stdin);
```
without allocating memory ==> Undefined behaviour, causes of segmentation fault at runtime.
To rectify it, either allocate memory for it as @dutt suggesting ... |
64,726,380 | I am trying to figure out what is wrong with my nested loop without receiving the answer to the exercise I'm working on. The initial error is that there is a comparison of signedness.
Prompt: Given a vector of integers named vec, find the sum of the product of all pairs of vector elements. Ex: {1,2,3}: (1x2)+(1x3)+(2x... | 2020/11/07 | [
"https://Stackoverflow.com/questions/64726380",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14594819/"
] | Need to bind it on constructor, when ever function binding is passed as props a new function will be created by which the props will signify a change triggering the render again
```
import TimeGrid from './TimeGrid';
class ScheduleView extends Component {
constructor(props) {
super(props);
this.state = {
... | Use this instead of your *`handleGridChange`* function
```
<TimeGrid
schedule={this.state.schedule}
handleGridChange={(newSchedule) => this.setState({schedule: newSchedule})}
/>
```
it'll work for sure. |
4,475,704 | I am wondering if the following code can be written in a somewhat nicer way. Basically, I want to calculate `z = f(x, y)` for a `(x, y)` meshgrid.
```
a = linspace(0, xr, 100)
b = linspace(0, yr, 100) ... | 2010/12/17 | [
"https://Stackoverflow.com/questions/4475704",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/534298/"
] | you could do something like
```
z = [[f(item_a, item_b) for item_b in b] for item_a in a]
``` | If you set it all at once, you can use a list comprehension;
```
[[f(a[i], b[j]) for j in range(100)] for i in range(100)]
```
If you need to use a `z` that's already there, however, you can't do that and your code is about the neatest you'll get.
*Addition:* I don't know with what this `lingrid` does, but if it pr... |
22,613,293 | The ANTLR4 book references a multi-mode example
<https://github.com/stfairy/learn-antlr4/blob/master/tpantlr2-code/lexmagic/ModeTagsLexer.g4>
```
lexer grammar ModeTagsLexer;
// Default mode rules (the SEA)
OPEN : '<' -> mode(ISLAND) ; // switch to ISLAND mode
TEXT : ~'<'+ ; // cl... | 2014/03/24 | [
"https://Stackoverflow.com/questions/22613293",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/134894/"
] | One of the following is happening:
1. You forgot to update the `OPEN` rule in **ModeTagsLexer.g4** to use the following form:
```
OPEN : '«' -> mode(ISLAND) ;
```
2. You found a bug in ANTLR 4, which should be reported to the [issue tracker](https://github.com/antlr/antlr4/issues). | Have you specified the file encoding that ANTLR should use when reading the grammar? It should be okay with European characters less than 255 but... |
23 | When I am grating a block of parmesan cheese and the block becomes particularly small, I often fear that I will slip/the item will be completely grated and I will cut/grate my fingers. I've used rubber gloves as well but I'm concerned they are not thick enough. What is the best way to protect against this? Are there gr... | 2014/12/09 | [
"https://lifehacks.stackexchange.com/questions/23",
"https://lifehacks.stackexchange.com",
"https://lifehacks.stackexchange.com/users/23/"
] | There are a variety of devices to solve this problem, my first thought would be thimbles if you don't want to buy one, but I would encourage just getting such a device, there's both rotary and flat-board ones I've seen. The rotary ones are thus:
 | How about using bottle caps to cover the ends of the fingers?
Or reverse the cap so it sinks into the potato (in my case) and use the protruding part as a handle? |
51,768,027 | Given an input array of `1`s and `0`s of arbitrary length, such as:
```
[0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0]
```
How can I (most efficiently) calculate a new array detailing if chunks of size `n` `0`s which can fit into the input?
Examples
--------
Where output now means
* 1 == 'Yes a zero ch... | 2018/08/09 | [
"https://Stackoverflow.com/questions/51768027",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1180964/"
] | You could count the connected free places by reversing the array and take an flag for the last return value for mapping.
>
> Array before final mapping and after, depending on `n`
>
>
>
> ```
> 1 0 4 3 2 1 0 0 2 1 0 0 0 3 2 1 0 2 1 array with counter
> 1 0 4 4 4 4 0 0 2 2 0 0 0 3 ... | You could use `some` method and then if the current element is `0` you can slice part of the array from current index and check if its all zeros.
```js
const data = [0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0]
function check(arr, n) {
let chunk = Array(n).fill(0).join('');
return arr.some((e, i) =... |
35,032,889 | I am working on a wordpress plugin. I want to get the url of my website and get the page name out of that like `www.example.com/pagename` in this case I want `pagename`. so for that I used native PHP function `$_SERVER['REQUEST_URI']` to get URL of my website. I stored it in `$url` variable as shown below.
```
$url= ... | 2016/01/27 | [
"https://Stackoverflow.com/questions/35032889",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4688722/"
] | Actually you should use a router, like <https://github.com/auraphp/Aura.Router> or any other. But simple and quick answer for you will be
```
$parts = explode('/', trim($url, '/'));
$name = $parts[1];
```
if you want to get the 2nd uri segment. | ```
$url= $_SERVER['REQUEST_URI'];
$name = explode("/",$url);
echo $name[1];
```
In $name you got the separate strings in array. You can get the name by doing echo like above if your name is going to come first in your url after your domain name. |
16,622 | What is the relationship of the option value and the pay off to an option?
What happens if the option value > pay off? or if it is equal to the pay off?
I read that in a put option , the option value is a solution to $$\sup\_\tau E[\max\left\{K-S,0\right \}]$$, where $K$ is the exercise price. Does this imply that the... | 2017/05/03 | [
"https://economics.stackexchange.com/questions/16622",
"https://economics.stackexchange.com",
"https://economics.stackexchange.com/users/13132/"
] | The put option allows you to decide to sell at the exercise price $K$ rather than the market price $S$.
So if you exercise the put option, in effect it is worth $K-S$ at that point as you could have sold at the market price.
You will only do that if it is positive. Hence the $\max\left\{K-S,0\right \}$ expression. ... | By option value, I suppose you mean the price of the options (i.e. The option premium)
The premium you pay for an option, say $10, consists of two parts - Intrinsic value and Time value.
Intrinsic value is simply as you described, the pay off of the option. For a call option, it is the market price - strike price an... |
42,780,975 | Visual Studio Code's default status bar color is blue, and I find it quite distracting. I used [this extension](https://marketplace.visualstudio.com/items?itemName=bentx.vscode-custom-theme) to change the color, but it has stopped working after the *1.10.2* update. | 2017/03/14 | [
"https://Stackoverflow.com/questions/42780975",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7683987/"
] | You can change the colour of the statusbar by editing the user settings by adding these lines of code in it:
```json
"workbench.colorCustomizations": {
"statusBar.background" : "#1A1A1A",
"statusBar.noFolderBackground" : "#212121",
"statusBar.debuggingBackground": "#263238"
}
``` | 1. I am going to save 30 minutes of time to noobs like me - it has to be edited in the *settings.json* file.
The easiest way to access it is menu command *File* → *Preferences* → *Settings*, search for "Color", choose an option "Workbench: Color Customizations" → "Edit in settings.json".
2. This uses the [solution prop... |
13,894,878 | i have a list of user reviews that a user can choose to approve or delete.
I have the reviews.php file which lists the pending reviews, a approve\_review.php file and a delete\_review.php file.
Once the user approves the review i need the mysql column 'approve' to be changed from '0' to '1'. Same applies for the delet... | 2012/12/15 | [
"https://Stackoverflow.com/questions/13894878",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1904892/"
] | I had the same issue and what I did was replace all the ints with longs in the parameters.
Old Calls:
```
[DllImport("odbc32.dll")]
internal static extern int SQLDataSources(int EnvHandle, int Direction, StringBuilder ServerName, int ServerNameBufferLenIn, ref int ServerNameBufferLenOut, StringBuilder Driver, int Dri... | The first thing I'd do it get the parameter types right. Those name length ptr arguments are SQLSMALLINTs not ints. Also ODBC APIs return SQLRETURN types not int. See [SQLDatSources](http://msdn.microsoft.com/en-us/library/windows/desktop/ms711004%28v=vs.85%29.aspx). |
3,769,088 | I have two classes, `TProvider` and `TEncrypt`. The calling application will talk to the `TProvider` class. The calling application will call `Initialise` first to obtain the handle `mhProvider`. I require access to this handle later when i try to perform encryption, as the `TEncrypt` class donot have access to this ha... | 2010/09/22 | [
"https://Stackoverflow.com/questions/3769088",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/119535/"
] | Either you pass the handle to TEncrypt via a *(constructor/method) parameter*, or you make it available via a *global variable*. I would prefer the former, as global variables make the code harder to understand, maintain and test.
Availability may also be indirect, e.g. you pass an object to `TEncrypt::Encryption()` w... | If `mhProvider` is needed by `TEncrypt`, then why is it in the class `TProvider`? Somehow your classes don't look to be properly designed. |
27,259,096 | I am trying to get a count on the number of times a number (`start_value`) doubles until it reaches a particular value (`end_value`) in the cleanest way possible. Consider the following example:
```
id start_value end_value
1 40 130
2 100 777
3 0.20 2.1
example 1... | 2014/12/02 | [
"https://Stackoverflow.com/questions/27259096",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1285948/"
] | Divide the end value by the start value to get the factor between them. For example 130/40 = 3.25. Doubling the value once gives a factor 2, and doubling it twice gives a factor 4, and so on.
You can use the logarithm for base 2 to calculate how many times you need to double the value to get a specific factor. log2(3.... | Try below SQL :
```
select id, start_value, end_value, floor(log(end_value / start_value,2)/2)
from TempTable
```
Hope this Helps :) |
23,798,380 | I have a number of links on the page, dynamically generated like so:
```
<a href="#" class="more-info-item" ng-click="showStats(item, $event)">
More information
</a>
```
I also have a simple custom template that should show an item's name:
```
<script type="text/ng-template" id="iteminfo.html">
<div class="ite... | 2014/05/22 | [
"https://Stackoverflow.com/questions/23798380",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/306296/"
] | Here is a solution using a custom directive which injects the item dynamically using ng-if:
[View Solution with Plunker](http://plnkr.co/edit/itt4yIdLeg74BL3YlLwr?p=preview)
**html:**
```
<script type="text/ng-template" id="iteminfo.html">
<div class="item-name" ng-if="item.visible">
{{item.name}}
... | You can use the built-in **[ngInclude](https://docs.angularjs.org/api/ng/directive/ngInclude)** directive in `AngularJS`
Try this out
**[Working Demo](http://jsfiddle.net/UGj7t/1/)**
**html**
```
<div ng-controller="Ctrl">
<a href="#" class="more-info-item" ng-click="showStats(item, $event)">
More i... |
9,419,875 | I like to have a typical "usage:" line in my `cmd.exe` scripts — if a parameter is missing, user is given simple reminder of how the script is to be used.
The problem is that I can't safely predict whether potential user would use GUI or CLI. If somebody using GUI double-clicks this script in Explorer window, they won... | 2012/02/23 | [
"https://Stackoverflow.com/questions/9419875",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/835945/"
] | Start your batch checking for %WINDIR% in %cmdcmdline% like this:
```
echo "%cmdcmdline%" | findstr /ic:"%windir%" >nul && (
echo Interactive run of: %0 is not allowed
pause
exit /B 1
)
``` | Similar approach...
```
setlocal
set startedFromExplorer=
echo %cmdcmdline% | find /i "cmd.exe /c """"%~0""" >nul
if not errorlevel 1 set startedFromExplorer=1
...
if defined startedFromExplorer pause
goto :EOF
``` |
11,559,592 | I embed three Google Fonts from <http://www.google.com/webfonts> (Dosis, Open Sans, Lato)
And they all work fine except IE9 where it returns:
```
CSS3111: @font-face encountered unknown error.
2HG_tEPiQ4Z6795cGfdivPY6323mHUZFJMgTvxaG2iE.eot
CSS3111: @font-face encountered unknown error.
KlmP_Vc2zOZBldw8AfXD5g.eot
... | 2012/07/19 | [
"https://Stackoverflow.com/questions/11559592",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1074346/"
] | Commenting out the 2nd source declaration for the EOT font worked for me. Make sure you the 1st declaration right above "src: url("../fonts/webfonts/Helvetica Neue.eot");"
Tested on Chrome, Firefox,Sarafi, IE9-10-11.
```
@font-face {
font-family: 'Helvetica Neue';
font-style: normal;
font-weight: 400;
src: ur... | I had the same issue in IE11, I fixed the issue by converting my font file from `.woff2` to `.woff`.
In general, make sure the browser supports the font file format. |
12,948,072 | I have a issue with radio button array. I have 1 timer when timer is 0 and select 1 radio button then that value get in jquery.
```
<li>
<span class="option">Option1 : Value1 </span>
<input type="radio" name="cmbans[][1]" id="cmbans[][1]" value="Value1" />
</li>
<li>
<span class="option">Option2 : Value2 </span>... | 2012/10/18 | [
"https://Stackoverflow.com/questions/12948072",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1699283/"
] | I didn't get ypur problem correctly. I'm not sure if this one helps you..
Change your html like this..
```
<li>
<span class="option">Option1 : Value1 </span>
<input type="radio" name="cmbans[]" id="cmbans1" value="Value1" />
</li>
<li>
<span class="option">Option2 : Value2 </span>
<input type="radio" name="cm... | To select element whose ids' have special characters you have to escape these special characters. In your case `[` and `]`, also your choice in id naming is quite stramge
```
$("#cmbans\\[\\]\\[1\\]").val()
``` |
5,697,453 | The following method attempts to calculate the number of days in a year of an NSHebrew calendar object, given a hebrew year. For some reason, I'm getting inconsistent results across devices. The test case was the date of May 25, 1996. One device was returning one day longer (the correct value) than another device, whic... | 2011/04/18 | [
"https://Stackoverflow.com/questions/5697453",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/224988/"
] | An object initilizer statement like `var x = new Foo { Property1 = 5};` will be implemented as something like this:
```
Foo temp = new Foo();
temp.Property1 = 5;
x = temp;
```
As you can see, the properties in the initiallizer are set after the object is constructed, however the variable isn't set to the fully-initi... | It is fully constructed first, then initialized. You will however never get a reference to such an object if an exception is thrown, the compiler makes sure that your reference can only ever refer to a properly initialized object. It uses a temporary to guarantee this.
So for example, this code:
```
var obj = new Mod... |
336,901 | I need a verb meaning "walking slowly into water" that fits this example:
>
> She shivered a bit - as the lake water was cold - but then continued to \_\_\_\_ into the deep.
>
>
> | 2016/07/13 | [
"https://english.stackexchange.com/questions/336901",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/166244/"
] | You can use the word "sink":
>
> We watched the Titanic "sink" into the cold water.
>
>
> The more you struggle, the more you will "sink" in quicksand.
>
>
> As our feet "sank" into the mud, the alligators got much closer.
>
>
>
It describes slow or sluggish speed. | I like the word "falter". There is not a lot of context, but what's provided paints a picture of a woman who doesn't want to be there (is she being forced? self-harm? is the context more benign and innocent?). Whatever the context, she is shivering, either in fear reaction or reaction to the cold water, and in a simila... |
11,845,287 | I'm looking for an efficient way to store a huge number of booleans (up to 2.5\*10e11) in PHP's memory. My first idea was to create an array of integers and store one boolean per bit in each integer:
```
// number of booleans to store
$n = 2.5 * pow(10, 11);
// bits per integer
$bitsPerInt = PHP_INT_SIZE * 8;
// ini... | 2012/08/07 | [
"https://Stackoverflow.com/questions/11845287",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/846987/"
] | Perhaps the SplStack or the SplFixedArray classes from the [SPL](http://php.net/manual/es/book.spl.php) fit your needs better. | If using one bit per value uses too much memory then you will need to rethink your design - everything in memory is just bits at the end of the day, and you can't squeeze more than one boolean value into a single bit (by definition). |
14,352,487 | I was reading this question
[Awk code to select multiple patterns](https://stackoverflow.com/questions/14336710/awk-code-to-select-multiple-patterns)
The user has this as input
```
------------------------------------------------------------------------
r4544 | n479826 | 2012-08-28 07:12:33 -0400 (Tue, 28 Aug 2012) |... | 2013/01/16 | [
"https://Stackoverflow.com/questions/14352487",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1982150/"
] | I was lazy enough to explain the answer :)
But lemme put my lazyness aside for some time now:
```
/^r/{a=$1;b=$2;c=substr($3,0,20)}
```
The above block of code will execute only when the line starts with a letter r.
inside the block says store the first field in a ,second field in b and third field from input is :
... | The reason is that values of a, b and c are not replaced before the M is encountered. so it is still appended to the print statement. |
762,147 | my attempt $$\lim\_{x\to \infty}\frac{\frac{f(x)}{g(x)}}{\frac{f'(x)}{g'(x)}}\text{ yields }\frac{0}{0}$$ then use l'hopital on this
$$\lim\_{x\to \infty}\frac{\frac{f(x)}{g(x)}}{\frac{f'(x)}{g'(x)}} =\lim\_{x\to \infty} \frac{\frac{f'}{g}-\frac{fg'}{g^2}}{\frac{f''}{g'}-\frac{f'g''}{g'^2}} $$
$$\lim\_{x\to \infty}\... | 2014/04/20 | [
"https://math.stackexchange.com/questions/762147",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/61346/"
] | Let $f(x)=e^{-x^2}$ and $g(x)=e^{-x}$. | This seems like it would require some type of lemma which described the behavior of the products and quotients of $\ f:f'::f':f''$. You can factor $\ f'/g'$ out of the expression you stopped at, but are then stuck with a difference quotient with unlike terms. Without a rigorous lemma which would allow you replace limit... |
622,514 | This is not my area of expertise, so forgive me if I am getting this completely wrong. Some datacentres are now offering IPv6 addresses and potentially 100s per VM. What would the benefit of this be? Surely you only ever need one address and many ports? What benefit would be gained from having 100s of IPv6 addresses po... | 2014/08/19 | [
"https://serverfault.com/questions/622514",
"https://serverfault.com",
"https://serverfault.com/users/238379/"
] | >
> What would the benefit of this be?
>
>
>
One IP per Website or other such web service immediately springs to mind. Then you don't need to worry about SNI, Virtual Hosts, or any of that. Also, darknet honeypots.
>
> Surely you only ever need one address and many ports?
>
>
>
Most protocols can't specify ... | You can bind services to particular addresses. For instance, suppose you have machine with global routable address `2001:db8:cafe:babe:20c:29ff:fe01:2345` and you run a DNS- and a web server on that machine. Then, you could add the addresses, say, `2001:db8:cafe:babe::53` for DNS and `2001:db8:cafe:babe::80` for HTTP (... |
65,940 | Aside from obviously the the 60D and 6D being APS-C and Full Frame respectively, What are the main features or new controls that must be learnt about when using the canon 6D to truly master the cameras capabilities, that are not available on a canon 60D? | 2015/07/31 | [
"https://photo.stackexchange.com/questions/65940",
"https://photo.stackexchange.com",
"https://photo.stackexchange.com/users/41707/"
] | I believe that the "obvious" change here should not be underestimated.
After my recent switch from APS-C (Canon) to full frame (Nikon) even with the brand change and the different user interface my biggest challenge are implications of DOF and the fact that because of that the focusing needs to be much more exact. | In Canon 6D you can set up AF micro adjustments for lenses you have. That may improve sharpness a bit.
There is also ISO 50 mode that is turned of by default. |
7,246 | We are told, 'The just (upright) shall live by faith.' So I have a question for the Christians here. How do you understand faith? This does not have to be strictly biblical (since the scripture does not interpret itself, except where it really explicitly does so) but can also use anecdotal, philosophical or logical pro... | 2012/04/20 | [
"https://christianity.stackexchange.com/questions/7246",
"https://christianity.stackexchange.com",
"https://christianity.stackexchange.com/users/-1/"
] | Faith is the conviction and acceptance of what God has revealed to you. Faith persists even when challenged or confronted with reasons to not accept what God has revealed to you.
The object of Christian faith is always God. Christian faith is not blind or baseless, rather it derives it's strength and endurance from it... | "Faith is the key to open the door inside of us, that opens to God."
It is the bridge between the physical and spiritual worlds.
>
> Do you not know that your body is a temple of the Holy Spirit, who is
> in you, whom you have received from God? You are not your own;
> -Corinthians 6:19
>
>
> |
44,778,090 | I'm a novice with GNU parallel and I'm only semi-knowledgeable about bash in general so I would really appreciate some advice.
I want to read line by line through an input file containing a file path in the first column and the path to a second file in the second column, and for each line use the columns as input in ... | 2017/06/27 | [
"https://Stackoverflow.com/questions/44778090",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8219909/"
] | I ended up figuring this out for myself. I used --colsep to split the files into fields and then a regex to replace the string. The 1 before the equals signs say to print the first field while the regex within the equal signs do the string replacement.
`parallel -j10 --colsep '\t'-a $2 removeM -1 bamToFastq_{=1s/_R1_... | This does not answer the full question, so treat it as a comment.
Version 20170322 introduced dynamic replacement strings, which might be useful here.
A dynamic replacement string is a `--rpl` definition that takes an argument. The argument is grabbed with () in the replacement string and used in the code to run as $... |
73,369,181 | ```
func writeToChan(wg *sync.WaitGroup, ch chan int, stop int) {
defer wg.Done()
for i := 0; i < stop; i++ {
ch <- i
}
}
func readToChan(wg *sync.WaitGroup, ch chan int) {
defer wg.Done()
for n := range ch {
fmt.Println(n)
}
}
func main() {
ch := make(chan int, 3)
wg ... | 2022/08/16 | [
"https://Stackoverflow.com/questions/73369181",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19733327/"
] | You need to close channel at the sender side.
By using
```golang
for n := range ch {
fmt.Println(n)
}
```
The loop will only stop when `ch` is closed
correct example:
```golang
package main
import (
"fmt"
"sync"
)
func writeToChan(wg *sync.WaitGroup, ch chan int, stop int) {
defer wg.Done()
f... | If close is not called on buffered channel, reader doesn't know when to stop reading.
Check this example with for and select calls(to handle multi channels).
<https://go.dev/play/p/Lx5g9o4RsqW>
```
package main
import (
"fmt"
"sync"
"time")
func writeToChan(wg *sync.WaitGroup, ch chan int, stop ... |
27,793,848 | In our one of production database, we have 4 column table and there are no PK,UK constraints on it. only one notnull constraint on one column. The inserts are slow on this table and when I checked the indexes , there is one index which is built on all columns.
It is a normal table and not IOT. I really don't see a ne... | 2015/01/06 | [
"https://Stackoverflow.com/questions/27793848",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3825288/"
] | One case where it could be useful is,
Say for example, you are trying to check the existence of records in this table and for that you have to have joins on all four columns. So in such a case if you have written a correlated query like below,
```
SELECT <something>
FROM table_1 t1
WHERE EXISTS
(SELECT 1 FROM table_... | Indexes are good to better query optimization but causes slow updates/inserts because the indexes needs to be updated at each modification.
If these tables first use is querying and inserts happens only in a specific periods like a batch at the beginning or the end of the day only, then you can remove the indexes befo... |
8,131,692 | I've been looking for a solution with Bitbucket and XCode.
As everybody knows, XCode 4.2 comes with git support.
I've created a bitbucket account and I wanted to push my changes to my repository,
I've followed this tutorial
<https://confluence.atlassian.com/display/BITBUCKET/Use+the+SSH+protocol+with+Bitbucket>
How... | 2011/11/15 | [
"https://Stackoverflow.com/questions/8131692",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1031846/"
] | **iOS 9.2, Xcode 7.2, ARC enabled**
It seems that every time I start a new Xcode project, I have to crawl back to this post and others like it to put together a solution to get my \*.git repository set up for the new project. My goal with this answer is to update and compile a full solution. Thanks to all original con... | You have to add your generated SSH key to your account.
I use GitHub, but BitBucket is basically a clone of it so the same procedures apply:
```
cat ~/.ssh/id_rsa.pub | pbcopy
```
Now try re-connecting. |
38,235,645 | This works, I know.
```
int8_t intArray7[][2] = {-2, -1,
0, 1,
2, 3,
4, 5,
6, 7};
int8_t intArray8[][2] = {10, 9,
8, 7,
6, 5,
4, 3,
... | 2016/07/06 | [
"https://Stackoverflow.com/questions/38235645",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4561887/"
] | I believe the most compatible method is to use a `struct` (or `class`) to describe the array:
```
struct Array_Attributes
{
int8_t * array_memory;
unsigned int maximum_rows;
unsigned int maximum_columns;
};
```
You can treat the `array_memory` as a multidimensional array by converting from 2d to 1d indices:
... | Alright, I'd like to answer my own question too. There are many good ideas here, but let me post this simple and low-memory-cost solution. For devices of minimal memory (ex: an ATTiny AVR microcontroller with 512 bytes of RAM and a few kB program flash memory), I think this may be the best solution. I've tested it; it ... |
21,690,763 | I'm currently learning about coupling and dependencies in Java. I've been reading [this tutorial](http://tutorials.jenkov.com/ood/understanding-dependencies.html) and understand that if class1 contains an instance of class2 and if you call a method like `exampleMethod(c2)`, this counts as dependency between class1 and ... | 2014/02/11 | [
"https://Stackoverflow.com/questions/21690763",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3120842/"
] | The fact that class1 contains a reference to an instance of class2 suffices to say that class1 *depends* on class2. In all of your 3 examples you need a reference to class2 in order to call its methods. This only increases the need for dependency in your class1 but not the dependency itself.
Please read <http://depfin... | 1. Yes.
2. Yes.
3. Yes.
One way to reduce coupling is to use interfaces. This way, class 1 only knows about the interface, and is not coupled with class 2 specifically. And in fact, any class that implements the interface could be used instead of class 2 and class 1 would still be satisfied. |
50,408 | This is my original image in a layer... on top of a pattern bg

as you can see, it has a white background. I would love for it to be transparent.
When I change its blending mode to "Multiply" it becomes transparent as you can see in the image below
... | 2015/03/31 | [
"https://graphicdesign.stackexchange.com/questions/50408",
"https://graphicdesign.stackexchange.com",
"https://graphicdesign.stackexchange.com/users/9841/"
] | There's no solid way to get the same appearance as the multiply blend mode. But **you can get exceptionally close** with very little effort.
Just `Command/Ctrl`-click the thumbnail for the Blue Channel in the **Channel Panel**. (should then see marching ants)
Highlight the layer in the **Layer Panel** and add a new m... | In addition to Scott's answer, you could use the Blending Options for the layer. Just lowering blend if option:

Gave me a pretty good result:
 |
169,011 | If Yavin Prime was fired upon, the scattered debris would have destroyed Yavin 4 as well.
**Why did they wait to make a direct shot?** | 2017/09/06 | [
"https://scifi.stackexchange.com/questions/169011",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/89189/"
] | This was addressed in an "[Ask the Jedi Council](https://web.archive.org/web/20030212050533/http://www.starwars.com/community/askjc/steve/askjc20010405.html)" feature on the StarWars.com website.
According to LucasFilm's (former) Head of Fan Relations/Director of Content Management [Steve Sansweet](http://www.starwars... | The Empire was particularly proud of the Death Star and they were power-blinded. They want to see rebels die quickly in one shot. Destroying Yavin would have taken time to destroy Yavin 4.
Plus, the Death Star was near to Yavin and destroying this planet would have caused debris fly to Death Star and damage it. The D... |
8,898,298 | Is there a way in wordpress that I can create custom page templates for a mobile version, I mean something like when it detects that is a mobile to load `mobile_header.php` or is there a better way, I can't do this only from css I also need to use some custom page templates.
Thanks! | 2012/01/17 | [
"https://Stackoverflow.com/questions/8898298",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/58839/"
] | What you could do is create a new theme which is a mobile template specifically. You can then put this code into your functions.php file and it will use the mobile template instead.
```
add_filter('option_template', 'mobileTheme');
add_filter('template', 'mobileTheme');
add_filter('option_template', 'mobileTheme');
ad... | How about WPTouch? It is a WP plugin. |
25,475,230 | So far I have this:
```
ls /usr/bin | grep "^[\.]"
```
The cmd still gets files with a "." in there.
I have looked at [[:punct:]] but still returns the same thing. | 2014/08/24 | [
"https://Stackoverflow.com/questions/25475230",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3973363/"
] | You can change your regex to exclude files starting with ".":
```
ls -a /usr/bin | grep "^[^.]"
```
This regex selects only files which do not have "." at the start. By the way only `ls -a` shows files that starts with ".". How did you manage to get them without "-a" ? | I think you are referring to the current working directory and parent dirctory and not a command with "a dot" in it.
Try this as you probably have ls aliased:
/bin/ls /usr/bin |
28,051,743 | I am using **browserify** so I can use npm modules in my front end code, and **gulp** to do my build tasks. This works fine:
```
var browserify = require('gulp-browserify');
gulp.task('js', ['clean'], function() {
gulp
.src('./public/js/src/index.js')
.pipe(browserify({
insertGlobals ... | 2015/01/20 | [
"https://Stackoverflow.com/questions/28051743",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/123671/"
] | Use **gulp-notify**. Note also you should use the [browserify](https://github.com/substack/node-browserify) module instead of the deprecated [gulp-browerify](https://github.com/deepak1556/gulp-browserify) module.
```
var browserify = require('browserify'),
brfs = require('brfs'),
watchify = require('watchify'... | In my gulpfile, I just listen for uncaught exceptions and notify using [node-notifier](https://npmjs.org/package/node-notifier):
```
var Notifier = require('node-notifier');
notifier = new Notifier();
process.on('uncaughtException', function(err) {
notifier.notify({title: 'error', message: 'gulp process has crashed... |
10,015,708 | I'm new to exceptions and am trying to figure out when is appropriate to use them. In the following php code I would like to change `echo` (no need to tell the user) to simply log the message. Should I just replace `echo` with `log->notice(...)` (for example) or should I be using an exception (which I plan to log anywa... | 2012/04/04 | [
"https://Stackoverflow.com/questions/10015708",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1024808/"
] | You could try calling `accordion()` again after setting the html in your ajax success handler. This should re-apply the styles:
```
$("#accordion").accordion();
``` | There might be several causes for this. Here is one possible cause:
If you use JavaScript for styling(adding CSS class etc.) your accordion menu, and that usually run on page load.
Then call the styling function again after setting the loaded content in your success callback. |
11,635,059 | I have been working on an app for a number of months now and a strange bug has appeared in the last week or two. After extended use of the application (20-30 minutes), many of our custom labels (based on UILabel) cease to render correctly (some will just appear blank). Interestingly, bringing up the keyboard in this si... | 2012/07/24 | [
"https://Stackoverflow.com/questions/11635059",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/445153/"
] | After first time the inner loop is finished, the inner iterator over file2 reached the end so the solution is to point inner iterator of file2 to file's beginning each time, for example:
```
while f < 50:
for line in file1:
file2.seek(0, 0)
for name in file2:
if name == line:
... | Depending on the size of the files, you can use the `readlines()` function to read the lines of each file into a list.
Then, iterate over these lists. This will ensure that you do not have problems with the current position of the file position. |
27,298,426 | i'm stuck at this very basic form, that i could not accomplish, which i want to build a search form with an text input, and two select controls, with a route that accept 3 parameters, the problem that when the i submit the form, it map the parameters with the question mark, not the Laravel way,
Markup
------
```
{{ ... | 2014/12/04 | [
"https://Stackoverflow.com/questions/27298426",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2100974/"
] | The simplest way is just to accept the incoming request, and pull out the variables you want in the Controller:
```
Route::get('search', ['as' => 'search', 'uses' => 'SearchController@search']);
```
and then in `SearchController@search`:
```
class SearchController extends BaseController {
public function searc... | I was struggling with this too and finally got it to work.
routes.php
```
Route::get('people', 'PeopleController@index');
Route::get('people/{lastName}', 'PeopleController@show');
Route::get('people/{lastName}/{firstName}', 'PeopleController@show');
Route::post('people', 'PeopleController@processForm');
```
PeopleC... |
14,076,179 | In C I use `"1st line 1\n2nd line"` for a newline, but what about VB? I know `"1st line" & VbCrLf & "2nd line"` but its too verbose, what is the escape char for a newline in VB?
I want to print
```
1st line
2nd line
```
I tried using `\n` but it always outputs this no matter how many times I run the compiler
```
1... | 2012/12/28 | [
"https://Stackoverflow.com/questions/14076179",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | You should use `Environment.NewLine`. That evaluates to CR+LF on Windows, and LF on Unix systems.
There are no escape sequences for CR or LF characters in VB. And that's why `"\n"` is treated literally. So, `Environment.NewLine` is your guy. | If you're looking for an inline escape to accomplish something like including line breaks in a String.Format you can include a pipe or something similar and then replace it at the end of your string.
>
> String.Format("Batch: {0} | ProductNumber: {1} | Formula: {2}", dr.Item("BatchNumber"), dr.Item("PartNum"), dr.Ite... |
9,010,693 | I'm going nuts trying to figure out why I'm having such a difficult time getting WordPress to only show posts newer than 30-days and I could really use a second set of eyes. I'm using the following code but nothing is showing up on my site.
```
<?php
// Create a new filtering function that will add our where clause to... | 2012/01/25 | [
"https://Stackoverflow.com/questions/9010693",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/965879/"
] | The way you're doing looks fine. Try putting `posts_per_page => -1` as the argument.
The following works for me:
```
function filter_where( $where = '' ) {
$where .= " AND post_date > '" . date('Y-m-d', strtotime('-30 days')) . "'";
return $where;
}
add_filter( 'posts_where', 'filter_where' );
$args = array(... | I know this is super old but, you can do this with WP\_Query now.
```
$args = array(
'post_type' => 'post', // or whatever post type you want
'posts_per_page' => -1, // get all posts that apply, i.e. no limit
'date_query' => array(
array(
'after' => '-30 days',
'column' => 'post_date',
),... |
94,755 | >
> 笑顔が無邪気でかわいい子
>
>
>
Hi.
Does this clause here mean a child with an innocent and cute smile or a cute child with an innocent smile?
Thank you | 2022/05/29 | [
"https://japanese.stackexchange.com/questions/94755",
"https://japanese.stackexchange.com",
"https://japanese.stackexchange.com/users/48269/"
] | This is ambiguous and can be taken both ways. I personally feel "a child with an innocent and cute smile" is slightly more likely because you can say 笑顔が無邪気**な**かわいい子 to unambiguously mean "a cute child with an innocent smile". | 無邪気 can be an adjective or noun. Particle で in position after a noun indicates an uncontrollable reason. In this case, this sentence means "a child is cute because of an innocent smile" and you can replace "で" with "から". |
31,270 | Do day trips (e.g. gone from home from 9am to 4 pm) qualify for the traveling exemption from the sukkah? | 2013/09/23 | [
"https://judaism.stackexchange.com/questions/31270",
"https://judaism.stackexchange.com",
"https://judaism.stackexchange.com/users/955/"
] | [YU Torah online](http://www.yutorah.org/lectures/lecture.cfm/723700/Flug,_Rabbi_Josh#) has a good summary.
The subject is disputed by the Vilna Gaon and Rabbeinu Tam. The first allows only up till sunset; the second up to when the stars appear.
>
> Mishna Berurah 233:14, limits the leniency to recite Mincha until... | In the mishna in Berachos 26a, the tana'im dispute until when one can daven mincha. R' Yehuda says until plag hamincha (the second half of the time of mincha ketana, which goes from 9 1/2 hours of the day till twelve), the Chachamim say until the evening. The gemara (26b-27a) proves that 'until plag hamincha' cannot me... |
921,276 | This question looks pretty easy and hard at the same time. Here's how it goes:
**Let A and B be symmmetric nxn matrices. Show that A + B is also symmetric.**
To me this sounds like a pretty obvious fact, well, if its not obvious I still have a good idea of why this is true, but I'm new to university level maths and I... | 2014/09/06 | [
"https://math.stackexchange.com/questions/921276",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/173101/"
] | This is how I would write a proof of this statement:
Let $A=(a\_{ij})\_{i,j=1}^n$,$B=(b\_{ij})\_{i,j=1}^n$ be symmetric matrices, then it holds that $a\_{ij}=a\_{ji}$ and correspondingly for $B$. Then consider the sum $C=A+B$, then $c\_{ij}=a\_{ij}+b\_{ij}$, and $c\_{ji}=a\_{ji}+b\_{ji}$. Then since $A$, $B$ are both ... | I found this here: <http://mymathforum.com/linear-algebra/8319-if-b-symmetric-show-b-also-symmetric.html>
a) Since (A+B)^T = A^T + B^T, A = A^T and B = B^T, and you have that (A+B)^T = (A+B) That is, A + B is symmetric.
I thought of doing it by writing down the matrices out in full but I thought that would be messy. ... |
6,696,063 | If I `SELECT` IDs then `UPDATE` using those IDs, then the `UPDATE` query is faster than if I would `UPDATE` using the conditions in the `SELECT`.
To illustrate:
```
SELECT id FROM table WHERE a IS NULL LIMIT 10; -- 0.00 sec
UPDATE table SET field = value WHERE id IN (...); -- 0.01 sec
```
The above is about 100 tim... | 2011/07/14 | [
"https://Stackoverflow.com/questions/6696063",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/732284/"
] | The two queries are not identical. You only know that the IDs are unique in the table.
UPDATE ... LIMIT 10 will update at most 10 records.
UPDATE ... WHERE id IN (SELECT ... LIMIT 10) may update more than 10 records if there are duplicate ids. | The comment by Michael J.V is the best description. This answer assumes `a` is a column that is not indexed and 'id' is.
The WHERE clause in the first UPDATE command is working off the primary key of the table, `id`
The WHERE clause in the second UPDATE command is working off a non-indexed column. This makes the find... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.