qid int64 1 74.7M | question stringlengths 0 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 2 48.3k | response_k stringlengths 2 40.5k |
|---|---|---|---|---|---|
1,891,884 | My Django templates use a lot of related stuff: images, style sheets, etc.
Where should I put these file, or how should I refer to them in the template itself?
For now I'm using the development server.
I know it's a really common thing, but I can't really figure it out. | 2009/12/12 | [
"https://Stackoverflow.com/questions/1891884",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/190806/"
] | I put them inside a folder named `static`, which is in the web project's top level folder.
Example:
>
> /static/img/
>
> /static/js/
>
> /static/css/
>
> /templates/
>
> urls.py
>
> settings.py
>
>
>
I then have the following rule in my `urls.py` file:
```
(r'^static/(?P<path>.*)$', 'djan... | Maybe you can read the doc <http://docs.djangoproject.com/en/dev/howto/static-files/#howto-static-files> |
1,891,884 | My Django templates use a lot of related stuff: images, style sheets, etc.
Where should I put these file, or how should I refer to them in the template itself?
For now I'm using the development server.
I know it's a really common thing, but I can't really figure it out. | 2009/12/12 | [
"https://Stackoverflow.com/questions/1891884",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/190806/"
] | I put them inside a folder named `static`, which is in the web project's top level folder.
Example:
>
> /static/img/
>
> /static/js/
>
> /static/css/
>
> /templates/
>
> urls.py
>
> settings.py
>
>
>
I then have the following rule in my `urls.py` file:
```
(r'^static/(?P<path>.*)$', 'djan... | We put ours under /media. Everything that is specifically tied to the layout of the sites is further separated. Of course none of this static content is served by Django on the production site. They often aren't even on the same physical server.
```
/media
/images - this is for content-specific images
/video -... |
1,891,884 | My Django templates use a lot of related stuff: images, style sheets, etc.
Where should I put these file, or how should I refer to them in the template itself?
For now I'm using the development server.
I know it's a really common thing, but I can't really figure it out. | 2009/12/12 | [
"https://Stackoverflow.com/questions/1891884",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/190806/"
] | Maybe you can read the doc <http://docs.djangoproject.com/en/dev/howto/static-files/#howto-static-files> | We put ours under /media. Everything that is specifically tied to the layout of the sites is further separated. Of course none of this static content is served by Django on the production site. They often aren't even on the same physical server.
```
/media
/images - this is for content-specific images
/video -... |
44,949,408 | I want to make a list of dicts that have the following structure,
```
[{'Business' : 'Attorney' , 'Website text' : '(one line from the loaded file)'}, {'Business' : 'Attorney' , 'Website text' : '(one line from the loaded file)'}, ...]
```
However at the moment i only have a csv file consisting of the website text. ... | 2017/07/06 | [
"https://Stackoverflow.com/questions/44949408",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8139139/"
] | Since the only difference is the text, you can do the following:
```
with open('attorneys text.csv') as data_file:
data = [{'Business':'Attorney', 'Website text':line} for line in data_file]
```
The `'Business':'Attorney'` pair will be the same for each dictionary, while the value corresponding to `'Website text... | You can use [defaultdict](https://docs.python.org/3/library/collections.html#collections.defaultdict:)
```
from collections import defaultdict
s = ["Business", "Attorney", "Website text"]
data = defaultdict(list)
data[s[0]].append(business)
data[s[1]].append(classes)
data[s[2]].append(website)
``` |
44,949,408 | I want to make a list of dicts that have the following structure,
```
[{'Business' : 'Attorney' , 'Website text' : '(one line from the loaded file)'}, {'Business' : 'Attorney' , 'Website text' : '(one line from the loaded file)'}, ...]
```
However at the moment i only have a csv file consisting of the website text. ... | 2017/07/06 | [
"https://Stackoverflow.com/questions/44949408",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8139139/"
] | Since the only difference is the text, you can do the following:
```
with open('attorneys text.csv') as data_file:
data = [{'Business':'Attorney', 'Website text':line} for line in data_file]
```
The `'Business':'Attorney'` pair will be the same for each dictionary, while the value corresponding to `'Website text... | This is what i would do:
```
data = []
with open('attorneys text.csv') as data_file:
for line in data_file
row = { "Business": "Attorney", "Website text": line}
data.append(row)
```
I don t know if i understood well what you want to do |
30,458,681 | I've noticed that variable scope within a bash for loop seems to change if I pipe the output of the loop.
For example, here `g` remains changed after the loop:
```
$ g=bing; for f in foo; do g=fing; echo g in loop: $g; done; echo g after $g;
g in loop: fing
g after fing
```
whereas here, the change during the loop... | 2015/05/26 | [
"https://Stackoverflow.com/questions/30458681",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/420867/"
] | From the bash man page
>
> Each command in a pipeline is executed as a separate process (i.e., in a subshell).
>
>
>
This means that both sides of the pipeline are run in a subshell.
From <http://www.tldp.org/LDP/abs/html/subshells.html>
>
> Variables in a subshell are not visible outside the block of code in ... | As soon as you use a pipe (`|`) subshells are involved, mostly on both sides of the pipe.
Therefore the for loop runs in a subshell and sets the variable inside that subshell. That's why after the loop the variable value stayed.
In your first example there is no subshell, just multiple commands executed after each ot... |
113,272 | I'm currently hacking the [Advanced Testimonial Manager](https://www.magentocommerce.com/magento-connect/advanced-testimonial-manager.html) plugin to achieve what I need on the website I'm working on. It's a pretty good module but I required pagination rather than all testimonials being dumped onto one page:
```
publi... | 2016/04/29 | [
"https://magento.stackexchange.com/questions/113272",
"https://magento.stackexchange.com",
"https://magento.stackexchange.com/users/31296/"
] | if you are adding only you must add this function as `public`
```
public function _getCollection()
{
$limit = 10
$curr_page = 1;
if(Mage::app()->getRequest()->getParam('p'))
{
$curr_page = Mage::app()->getRequest()->getParam('p');
}
if(Ma... | Not absolutelly sure, but maybe you have to change line
```
$pager->setCollection($this->getCollection());
```
to
```
$pager->setCollection($this->_getCollection());
```
? |
3,272,501 | I'm programming a big game in Java and I'm trying to optimize the code but also to keep the code neat and well organized. Now I am unsure if I should use the public static field of single classes that have a couple of variables that are used by a lot of instances.
For example the class camera has an x and y position ... | 2010/07/17 | [
"https://Stackoverflow.com/questions/3272501",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/394410/"
] | I'd suggest you create a Painter class and do the following:
```
public void paint(Painter painter)
{
painter.draw(x, y, unit_sprite);
}
```
That way the units don't have to worry about the existence of a camera. It is none of the unit's business how that works. The unit just needs to know how to draw itself... | Just time it and see.
```
long startTime = System.currentTimeMillis();
for(int i=0; i<1000000; i++){
// Call your code
}
System.out.println("Total time " + (System.currentTimeMillis() - startTime) + " ms");
```
My guess is the JIT will take care of the differences and they will all be roughly equivalent. There'... |
3,272,501 | I'm programming a big game in Java and I'm trying to optimize the code but also to keep the code neat and well organized. Now I am unsure if I should use the public static field of single classes that have a couple of variables that are used by a lot of instances.
For example the class camera has an x and y position ... | 2010/07/17 | [
"https://Stackoverflow.com/questions/3272501",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/394410/"
] | Enumerate and calculate to millisecond to m.server by using integer vaule.
that is guest without looking at any books. | In all programming languages, it is always recommended to use get/set methods for both static and instance members. This allows to change internal implementations transparently for a client code, if this is necessary. However, sometimes these rules are broken, if performance is very important. |
3,272,501 | I'm programming a big game in Java and I'm trying to optimize the code but also to keep the code neat and well organized. Now I am unsure if I should use the public static field of single classes that have a couple of variables that are used by a lot of instances.
For example the class camera has an x and y position ... | 2010/07/17 | [
"https://Stackoverflow.com/questions/3272501",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/394410/"
] | If you have only one camera at all times, i would choose the third way. Otherwise i would choose the second way.
I think that from performance point of view, using a public static field is a good idea. As far as code readability goes, if it is easily understood that there is only one camera at all times, this should b... | Enumerate and calculate to millisecond to m.server by using integer vaule.
that is guest without looking at any books. |
3,272,501 | I'm programming a big game in Java and I'm trying to optimize the code but also to keep the code neat and well organized. Now I am unsure if I should use the public static field of single classes that have a couple of variables that are used by a lot of instances.
For example the class camera has an x and y position ... | 2010/07/17 | [
"https://Stackoverflow.com/questions/3272501",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/394410/"
] | If you have only one camera at all times, i would choose the third way. Otherwise i would choose the second way.
I think that from performance point of view, using a public static field is a good idea. As far as code readability goes, if it is easily understood that there is only one camera at all times, this should b... | In all programming languages, it is always recommended to use get/set methods for both static and instance members. This allows to change internal implementations transparently for a client code, if this is necessary. However, sometimes these rules are broken, if performance is very important. |
3,272,501 | I'm programming a big game in Java and I'm trying to optimize the code but also to keep the code neat and well organized. Now I am unsure if I should use the public static field of single classes that have a couple of variables that are used by a lot of instances.
For example the class camera has an x and y position ... | 2010/07/17 | [
"https://Stackoverflow.com/questions/3272501",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/394410/"
] | If you have only one camera at all times, i would choose the third way. Otherwise i would choose the second way.
I think that from performance point of view, using a public static field is a good idea. As far as code readability goes, if it is easily understood that there is only one camera at all times, this should b... | Overall the second should provide a good balance; it also will ensure that you don't accidently hold references to the camera beyond when you anticipate, or that you don't run into conflicts with stateful static fields.
Keep in mind that you should still profile the performance regardless of whatever solution you choo... |
3,272,501 | I'm programming a big game in Java and I'm trying to optimize the code but also to keep the code neat and well organized. Now I am unsure if I should use the public static field of single classes that have a couple of variables that are used by a lot of instances.
For example the class camera has an x and y position ... | 2010/07/17 | [
"https://Stackoverflow.com/questions/3272501",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/394410/"
] | I'd suggest you create a Painter class and do the following:
```
public void paint(Painter painter)
{
painter.draw(x, y, unit_sprite);
}
```
That way the units don't have to worry about the existence of a camera. It is none of the unit's business how that works. The unit just needs to know how to draw itself... | If you have only one camera at all times, i would choose the third way. Otherwise i would choose the second way.
I think that from performance point of view, using a public static field is a good idea. As far as code readability goes, if it is easily understood that there is only one camera at all times, this should b... |
3,272,501 | I'm programming a big game in Java and I'm trying to optimize the code but also to keep the code neat and well organized. Now I am unsure if I should use the public static field of single classes that have a couple of variables that are used by a lot of instances.
For example the class camera has an x and y position ... | 2010/07/17 | [
"https://Stackoverflow.com/questions/3272501",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/394410/"
] | Enumerate and calculate to millisecond to m.server by using integer vaule.
that is guest without looking at any books. | Just time it and see.
```
long startTime = System.currentTimeMillis();
for(int i=0; i<1000000; i++){
// Call your code
}
System.out.println("Total time " + (System.currentTimeMillis() - startTime) + " ms");
```
My guess is the JIT will take care of the differences and they will all be roughly equivalent. There'... |
3,272,501 | I'm programming a big game in Java and I'm trying to optimize the code but also to keep the code neat and well organized. Now I am unsure if I should use the public static field of single classes that have a couple of variables that are used by a lot of instances.
For example the class camera has an x and y position ... | 2010/07/17 | [
"https://Stackoverflow.com/questions/3272501",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/394410/"
] | I'd suggest you create a Painter class and do the following:
```
public void paint(Painter painter)
{
painter.draw(x, y, unit_sprite);
}
```
That way the units don't have to worry about the existence of a camera. It is none of the unit's business how that works. The unit just needs to know how to draw itself... | Enumerate and calculate to millisecond to m.server by using integer vaule.
that is guest without looking at any books. |
3,272,501 | I'm programming a big game in Java and I'm trying to optimize the code but also to keep the code neat and well organized. Now I am unsure if I should use the public static field of single classes that have a couple of variables that are used by a lot of instances.
For example the class camera has an x and y position ... | 2010/07/17 | [
"https://Stackoverflow.com/questions/3272501",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/394410/"
] | You'll have to benchmark in your context to be sure but here is my experience:
* Passing parameters to functions is generally the fastest if you have a small number of parameters that will be used a lot in an inner loop. This is because the JIT will assign these to registers
* Access to public static member variables ... | In all programming languages, it is always recommended to use get/set methods for both static and instance members. This allows to change internal implementations transparently for a client code, if this is necessary. However, sometimes these rules are broken, if performance is very important. |
3,272,501 | I'm programming a big game in Java and I'm trying to optimize the code but also to keep the code neat and well organized. Now I am unsure if I should use the public static field of single classes that have a couple of variables that are used by a lot of instances.
For example the class camera has an x and y position ... | 2010/07/17 | [
"https://Stackoverflow.com/questions/3272501",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/394410/"
] | If you have only one camera at all times, i would choose the third way. Otherwise i would choose the second way.
I think that from performance point of view, using a public static field is a good idea. As far as code readability goes, if it is easily understood that there is only one camera at all times, this should b... | Just time it and see.
```
long startTime = System.currentTimeMillis();
for(int i=0; i<1000000; i++){
// Call your code
}
System.out.println("Total time " + (System.currentTimeMillis() - startTime) + " ms");
```
My guess is the JIT will take care of the differences and they will all be roughly equivalent. There'... |
43,552 | The Situation
-------------
I am currently creating a Telegram bot for me and some friends that stores all chat messages we send in our group chat in a database so that we can retrieve advanced chat statistics. I live in Germany.
---
Arising Questions
-----------------
Now my first question is **if it would be lega... | 2019/08/09 | [
"https://law.stackexchange.com/questions/43552",
"https://law.stackexchange.com",
"https://law.stackexchange.com/users/27039/"
] | A promise that a court would not enforce by injunction can still be valid consideration and be part of a valid contract. Failure to carry out such obligations would lead to some measure of money damages, most likely.
On the other hand, provisions specifically barred by law, or against public policy, such as a promise... | >
> If I agreed to these terms what would happen?
>
>
>
They have no effect on the rest of the contract. The "anti-undermine" and "anti-complain" clauses are unenforceable as too vague and oppressive (somewhat related to the notion of duress), respectively.
More important is to bear in mind that the *actual* cons... |
56,061,960 | I am trying to add the text written in a textfield everytime and add it into an ArrayList. For eg- if the text "abcdef" is written in the textfield, then it should get added into the list. Again if the text "ghijkl" is written in the textfield, than that should get added.
My code for adding the text into the listview:... | 2019/05/09 | [
"https://Stackoverflow.com/questions/56061960",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Oracle solution:
```
with CTE as
(
select t1.*,
row_number() over(order by DBMS_RANDOM.VALUE) as rn -- random order assigned
from MyTable t1
where CPID <40
)
select *
from CTE
where rn <=5 -- pick 5 at random
union all
select t2.*, null
from my_table t2
where CPID >= 40
```
SQL Server:
```
with CTE as
(
se... | How about something like this...
```sql
SELECT *
FROM (SELECT CID,
CVAL,
CPID,
CPER,
Row_number() OVER (partition BY CPID ORDER BY CPID ASC ) AS RN
FROM Table) tmp
WHERE CPER>=40 OR pids <= 5
```
However, this is not random. |
56,061,960 | I am trying to add the text written in a textfield everytime and add it into an ArrayList. For eg- if the text "abcdef" is written in the textfield, then it should get added into the list. Again if the text "ghijkl" is written in the textfield, than that should get added.
My code for adding the text into the listview:... | 2019/05/09 | [
"https://Stackoverflow.com/questions/56061960",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Oracle solution:
```
with CTE as
(
select t1.*,
row_number() over(order by DBMS_RANDOM.VALUE) as rn -- random order assigned
from MyTable t1
where CPID <40
)
select *
from CTE
where rn <=5 -- pick 5 at random
union all
select t2.*, null
from my_table t2
where CPID >= 40
```
SQL Server:
```
with CTE as
(
se... | Assuming that you want five *additional* random records, you can do:
```
select t.*
from (select t.*,
row_number() over (partition by cpid,
(case when cper >= 40 then 1 else 2 end)
order by dbms_random.value
... |
40,598,191 | I'm trying to server an HTML page with some Javascript from a Flask Server
Python Code:
```
from flask import Flask
from flask import render_template
app = Flask(__name__)
@app.route("/")
def hello():
return render_template('simple.html')
if __name__ == "__main__":
app.run()
```
My directory looks somethi... | 2016/11/14 | [
"https://Stackoverflow.com/questions/40598191",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/986012/"
] | At the start of your main method:
```
Pattern p = Pattern.compile("(.*)([+-].*)i");
double real, imaginary;
```
Then in `case 1:`
```
System.out.println("Enter first complex number: ");
real = 0.0;
imaginary = 0.0;
Matcher m = p.match(get.nextLine()); // read the user input as a string
... | Add following method in Driver class
```
public static Complex getComplexNumber(final Scanner get){
String firstComplex=get.nextLine();
String[] arr = firstComplex.split("[-+]i");
return new Complex(Double.parseDouble(arr[0]),Double.parseDouble(arr[1]));
}
```
and then Instead of
firstComple... |
40,598,191 | I'm trying to server an HTML page with some Javascript from a Flask Server
Python Code:
```
from flask import Flask
from flask import render_template
app = Flask(__name__)
@app.route("/")
def hello():
return render_template('simple.html')
if __name__ == "__main__":
app.run()
```
My directory looks somethi... | 2016/11/14 | [
"https://Stackoverflow.com/questions/40598191",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/986012/"
] | At the start of your main method:
```
Pattern p = Pattern.compile("(.*)([+-].*)i");
double real, imaginary;
```
Then in `case 1:`
```
System.out.println("Enter first complex number: ");
real = 0.0;
imaginary = 0.0;
Matcher m = p.match(get.nextLine()); // read the user input as a string
... | You need get real and imaginary path of complex number.
By making *a few changes in your code* I have this result:
Main logic is:
```
private final static Pattern PATTERN = Pattern.compile("(.*)([+-])(.*)i");
// ...
String complexInput = get.next();
final Matcher matcher = PATTERN.matcher(complexInput);
if (matcher.... |
40,598,191 | I'm trying to server an HTML page with some Javascript from a Flask Server
Python Code:
```
from flask import Flask
from flask import render_template
app = Flask(__name__)
@app.route("/")
def hello():
return render_template('simple.html')
if __name__ == "__main__":
app.run()
```
My directory looks somethi... | 2016/11/14 | [
"https://Stackoverflow.com/questions/40598191",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/986012/"
] | At the start of your main method:
```
Pattern p = Pattern.compile("(.*)([+-].*)i");
double real, imaginary;
```
Then in `case 1:`
```
System.out.println("Enter first complex number: ");
real = 0.0;
imaginary = 0.0;
Matcher m = p.match(get.nextLine()); // read the user input as a string
... | Here is something if you have integer parts. Please amend for doubles.
```
Complex c1;
Scanner sline = new Scanner(System.in);
Pattern p = Pattern.compile("(\+|-){0,1}\\d+[ ]*(\+|-)[ ]*(i\\d+|\\d+i)");
if(sline.hasNext(p)) {
String str = sline.next(p).replace("+"," +").replace("-"," -");
Scanner sc = new Scann... |
5,800,975 | I'm building a site for mobile devices and therefore has a fluid layout.
My navigation list looks like this:
```
<ul>
<li>home</li>
<li>about</li>
<li>work</li>
<li>contact</li>
</ul>
```
Problem is, the first list item needs to be 100px only (left aligned always), and the other 3 split evenly, t... | 2011/04/27 | [
"https://Stackoverflow.com/questions/5800975",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/111445/"
] | This is the simplest way I could think of:
```
ul { overflow: hidden; padding-left: 100px; position: relative; }
li { width: 33.33%; float: left; }
li:first-child { position: absolute; top: 0; left: 0; width: 100px; }
```
The main idea is taking the first `li` out of the flow (`position: absolute`) and adding a padd... | hmm a bit cludgy - but this seems to work, it does require nesting the list (second 3 links in separate list) and a span for the "home" link, theory is that you need the first link to float, width: 100px, then you need the second group not to float and have their overflow hidden so the group take up the remaining space... |
5,800,975 | I'm building a site for mobile devices and therefore has a fluid layout.
My navigation list looks like this:
```
<ul>
<li>home</li>
<li>about</li>
<li>work</li>
<li>contact</li>
</ul>
```
Problem is, the first list item needs to be 100px only (left aligned always), and the other 3 split evenly, t... | 2011/04/27 | [
"https://Stackoverflow.com/questions/5800975",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/111445/"
] | This is the simplest way I could think of:
```
ul { overflow: hidden; padding-left: 100px; position: relative; }
li { width: 33.33%; float: left; }
li:first-child { position: absolute; top: 0; left: 0; width: 100px; }
```
The main idea is taking the first `li` out of the flow (`position: absolute`) and adding a padd... | For what it's worth, this was what I was thinking of when I made my comment on your question:
<http://jsfiddle.net/4t9fV/>
```
ul {
display: table;
width: 100%;
background: #ccc;
table-layout: fixed
}
li {
display: table-cell;
text-align: center;
outline: 1px dashed red
}
li:first-child {
... |
11,925,379 | I had the following code, however I don't understand what and why it outputs what it does.
```
int main(){
int *i;
int *fun();
i=fun();
printf("%d\n",*i);
printf("%d\n",*i);
}
int *fun(){
int k=12;
return(&k);
}
```
The output is 12 and a garbage value. Can somebody explain the output?
Should... | 2012/08/12 | [
"https://Stackoverflow.com/questions/11925379",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1591319/"
] | >
> Wouldn't it return garbage values both of the time?
>
>
>
After the return of `fun`, `k` does not exist anymore, so printing the value, stored in the address of `k` is **undefined behaviour**.
That's why you have different/garbage value.
>
> k is local to fun(), so it would be stored on a stack and that ac... | The stack isn't immediately cleared when a function returns, so the `12` will still be on the stack after `fun()` returns - until something else overwrites it.
You'll see different results in different compilers and different build options (debug vs. release). |
236,127 | I can't seem to figure this one out
Two guerilla forces, with troop strength $x(t)$ and $y(t)$, are in combat with each other without reinforcement. Suppose the territory is rather large and full of places to hide. The $y$-force needs to find the $x$-force first before it can inflict combat losses, and the higher the ... | 2012/11/13 | [
"https://math.stackexchange.com/questions/236127",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/49190/"
] | Let $p$ and $q$ be **odd primes**. Let $d$ be the order of $a$ modulo $q$. (Since $q$ divides $a^p-1$, the number $a$ cannot be divisible by $q$.)
By Fermat's Theorem, $a^{q-1}\equiv 1\pmod{p}$. So $d$ divides $q-1$.
We are told that $q$ divides $a^p-1$. So $a^p\equiv 1\pmod{q}$, and therefore $d$ divides $p$.
That ... | You can use the fact that $a^n-b^n = (a - b) \times \sum\_{i=0}^{n-1}a^ib^{n-1-i}$, and that every natural number has finitely many divisors.
Edit: And I think you mean $\exists t \in \mathbb{Z}, q = 2pt + 1$, right ? |
236,127 | I can't seem to figure this one out
Two guerilla forces, with troop strength $x(t)$ and $y(t)$, are in combat with each other without reinforcement. Suppose the territory is rather large and full of places to hide. The $y$-force needs to find the $x$-force first before it can inflict combat losses, and the higher the ... | 2012/11/13 | [
"https://math.stackexchange.com/questions/236127",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/49190/"
] | Let $p$ and $q$ be **odd primes**. Let $d$ be the order of $a$ modulo $q$. (Since $q$ divides $a^p-1$, the number $a$ cannot be divisible by $q$.)
By Fermat's Theorem, $a^{q-1}\equiv 1\pmod{p}$. So $d$ divides $q-1$.
We are told that $q$ divides $a^p-1$. So $a^p\equiv 1\pmod{q}$, and therefore $d$ divides $p$.
That ... | I tried proving last part, but I cant complete it also. Anyway, here are the steps that Ive done.
Assume that $p$ is a prime divisor of $2^{2^n}+1$ and let $d$ be the order of $2 \pmod{p}$. Then $2^{2^n}\equiv -1\pmod{p}$. Hence (by squaring both sides), we get $2^{2^{n+1}}\equiv 1\pmod{p}$.
**Claim:** $d=2^{n+1}$. (... |
32,921,299 | I am using Swift 2.0 Xcode 7.0 and using Core Data in my app.
I am facing trouble in fetching the results back from coredata.
My entity name is **User** which is a subclass of **NSManagedObject**. When I created the NSManagedObject Subclass from editor, XCode 7 created two classes for me
1. **User.swift**
2. Extension... | 2015/10/03 | [
"https://Stackoverflow.com/questions/32921299",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2545465/"
] | The fetch request returns an *array* of objects (which can have
zero, one, or more elements), even if you expect only a single
result. In your case, you would simply access the first element
of the result array:
```
let fetchResults = try
self.managedObjectContext.executeFetchRequest(fetchRequest) as! [User]
if fetc... | The problem is that you mix `User` and `[User]`. The first one is a user-object, and it has a `userAge` property. The second one is a list of users and it doesn't have a `userAge` property. E.g. if a list `users` has two elements, then `users[0]` and `users[1]` were users, but `users` itself is just a list of users |
38,666,812 | I'm trying to make a `GroupBox` in XAML that houses three `RadioButton`s. Everything looks fine except that the `'g'` in my `GroupBox` header is cut off at the bottom, like this:

I've read other posts with formatting issues, and have steered clear of positioning ... | 2016/07/29 | [
"https://Stackoverflow.com/questions/38666812",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6576841/"
] | I've tested it with everything that came to my mind and im not able to reproduce it. Please try the following:
```
<GroupBox FontSize="12" FontWeight="Bold">
<GroupBox.Header>
<TextBlock Height="22" Text="Current Units (English)"/> </GroupBox.Header>
```
Since the Header in the `GroupBox` is a ... | Try this:
```
<GroupBox HorizontalAlignment="Stretch" Name="currentUnitsGroupBox" VerticalAlignment="Stretch" FontSize="12" FontWeight="Bold">
<GroupBox.Header>
<TextBlock Text="Current Units (English)" Padding="5" />
</GroupBox.Header>
</GroupBox>
``` |
43,198,196 | I am building an app that presents UITableView to the user, from which the user needs to make a selection. Once the selects a row, they are presented another ViewController which displays details of the selection they made on the previous ViewController.
Here's the catch: After the user makes the selection, the app ne... | 2017/04/04 | [
"https://Stackoverflow.com/questions/43198196",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/458811/"
] | May this helps you. You should have to use the service and broadcast receiver for that.
**MainActivty.java**
```
public class MainActivity extends AppCompatActivity {
private Button btn_startservice;
private Button btn_stopservice;
private TextView tv_servicecounter;
ServiceDemo myService;
boolea... | Try the following code, it works:
```
HomeWatcher mHomeWatcher = new HomeWatcher(this);
mHomeWatcher.setOnHomePressedListener(new OnHomePressedListener() {
@Override
public void onHomePressed() {
// do something here...
}
@Override
public void onHomeLongPressed() {
}
});
mHomeWatcher.st... |
43,198,196 | I am building an app that presents UITableView to the user, from which the user needs to make a selection. Once the selects a row, they are presented another ViewController which displays details of the selection they made on the previous ViewController.
Here's the catch: After the user makes the selection, the app ne... | 2017/04/04 | [
"https://Stackoverflow.com/questions/43198196",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/458811/"
] | May this helps you. You should have to use the service and broadcast receiver for that.
**MainActivty.java**
```
public class MainActivity extends AppCompatActivity {
private Button btn_startservice;
private Button btn_stopservice;
private TextView tv_servicecounter;
ServiceDemo myService;
boolea... | You can create a new Home screen Activity (`ACTION_MAIN` with category `CATEGORY_HOME`), count the number of Intents (Home) received and then perhaps start the real Home. |
43,198,196 | I am building an app that presents UITableView to the user, from which the user needs to make a selection. Once the selects a row, they are presented another ViewController which displays details of the selection they made on the previous ViewController.
Here's the catch: After the user makes the selection, the app ne... | 2017/04/04 | [
"https://Stackoverflow.com/questions/43198196",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/458811/"
] | Try the following code, it works:
```
HomeWatcher mHomeWatcher = new HomeWatcher(this);
mHomeWatcher.setOnHomePressedListener(new OnHomePressedListener() {
@Override
public void onHomePressed() {
// do something here...
}
@Override
public void onHomeLongPressed() {
}
});
mHomeWatcher.st... | You can create a new Home screen Activity (`ACTION_MAIN` with category `CATEGORY_HOME`), count the number of Intents (Home) received and then perhaps start the real Home. |
5,959 | What are some grilling tools that a beginner should have when purchasing a new grill? Additionally, are there tools that are useful for the more advanced outdoor cook? | 2010/08/25 | [
"https://cooking.stackexchange.com/questions/5959",
"https://cooking.stackexchange.com",
"https://cooking.stackexchange.com/users/177/"
] | If you're using charcoal, a spray bottle with H2O can be handy for flare-ups. Otherwise, I think others have the bases covered. | I have a wide, flat knife that can be used as a spatula; I find it really useful. Everything else has pretty much been mentioned, but I would suggest a pair of tongs with decent teeth on them. It's very disheartening when that burger or steak slips out of your grip and into the coals or onto the ground. |
5,959 | What are some grilling tools that a beginner should have when purchasing a new grill? Additionally, are there tools that are useful for the more advanced outdoor cook? | 2010/08/25 | [
"https://cooking.stackexchange.com/questions/5959",
"https://cooking.stackexchange.com",
"https://cooking.stackexchange.com/users/177/"
] | The tools I use the most are:
* Tongs,
* Spatula for stuck things,
* A small towel to apply oil,
* thermometer,
* a long handled basting brush
* a brush to clean the grill with
* spray bottle with water (for flare-ups) | An additional tool that will make grilling much easier is a veggie basket; basically it looks like a saute pan with holes poked throughout it. Aluminum foil can be your friend, but these little guys are much more flexible. |
5,959 | What are some grilling tools that a beginner should have when purchasing a new grill? Additionally, are there tools that are useful for the more advanced outdoor cook? | 2010/08/25 | [
"https://cooking.stackexchange.com/questions/5959",
"https://cooking.stackexchange.com",
"https://cooking.stackexchange.com/users/177/"
] | The tools I use the most are:
* Tongs,
* Spatula for stuck things,
* A small towel to apply oil,
* thermometer,
* a long handled basting brush
* a brush to clean the grill with
* spray bottle with water (for flare-ups) | I have a wide, flat knife that can be used as a spatula; I find it really useful. Everything else has pretty much been mentioned, but I would suggest a pair of tongs with decent teeth on them. It's very disheartening when that burger or steak slips out of your grip and into the coals or onto the ground. |
5,959 | What are some grilling tools that a beginner should have when purchasing a new grill? Additionally, are there tools that are useful for the more advanced outdoor cook? | 2010/08/25 | [
"https://cooking.stackexchange.com/questions/5959",
"https://cooking.stackexchange.com",
"https://cooking.stackexchange.com/users/177/"
] | In addition to what others have said, you should have TWO of each meat-handling tool (tongs, mainly). That way you can use one to handle raw meat, and one to remove cooked meat. | If you're using charcoal, a spray bottle with H2O can be handy for flare-ups. Otherwise, I think others have the bases covered. |
5,959 | What are some grilling tools that a beginner should have when purchasing a new grill? Additionally, are there tools that are useful for the more advanced outdoor cook? | 2010/08/25 | [
"https://cooking.stackexchange.com/questions/5959",
"https://cooking.stackexchange.com",
"https://cooking.stackexchange.com/users/177/"
] | Tool-wise: spatula, tongs, grill brush (for cleaning) and a basting brush. If you're using extremely hot fire or high flames there are grill-safe mitts you can buy.
This isn't a tool, but I find buying cedar (or other wood) planks for grilling fish and other meats and veggies on are invaluable. Similarly, applewood or... | An additional tool that will make grilling much easier is a veggie basket; basically it looks like a saute pan with holes poked throughout it. Aluminum foil can be your friend, but these little guys are much more flexible. |
5,959 | What are some grilling tools that a beginner should have when purchasing a new grill? Additionally, are there tools that are useful for the more advanced outdoor cook? | 2010/08/25 | [
"https://cooking.stackexchange.com/questions/5959",
"https://cooking.stackexchange.com",
"https://cooking.stackexchange.com/users/177/"
] | The basic things that you need are:
* Grill brush to clean the grate
* Large tongs to get food on and off of the grill
With that, oil to oil the grate, fuel, and quite possibly aluminum foil you will be grilling.
A grill basket of sorts can be very useful. Metal skewers for making kebabs are great if you like that s... | I have a wide, flat knife that can be used as a spatula; I find it really useful. Everything else has pretty much been mentioned, but I would suggest a pair of tongs with decent teeth on them. It's very disheartening when that burger or steak slips out of your grip and into the coals or onto the ground. |
5,959 | What are some grilling tools that a beginner should have when purchasing a new grill? Additionally, are there tools that are useful for the more advanced outdoor cook? | 2010/08/25 | [
"https://cooking.stackexchange.com/questions/5959",
"https://cooking.stackexchange.com",
"https://cooking.stackexchange.com/users/177/"
] | The tools I use the most are:
* Tongs,
* Spatula for stuck things,
* A small towel to apply oil,
* thermometer,
* a long handled basting brush
* a brush to clean the grill with
* spray bottle with water (for flare-ups) | If you're using charcoal, a spray bottle with H2O can be handy for flare-ups. Otherwise, I think others have the bases covered. |
5,959 | What are some grilling tools that a beginner should have when purchasing a new grill? Additionally, are there tools that are useful for the more advanced outdoor cook? | 2010/08/25 | [
"https://cooking.stackexchange.com/questions/5959",
"https://cooking.stackexchange.com",
"https://cooking.stackexchange.com/users/177/"
] | Tool-wise: spatula, tongs, grill brush (for cleaning) and a basting brush. If you're using extremely hot fire or high flames there are grill-safe mitts you can buy.
This isn't a tool, but I find buying cedar (or other wood) planks for grilling fish and other meats and veggies on are invaluable. Similarly, applewood or... | I have a wide, flat knife that can be used as a spatula; I find it really useful. Everything else has pretty much been mentioned, but I would suggest a pair of tongs with decent teeth on them. It's very disheartening when that burger or steak slips out of your grip and into the coals or onto the ground. |
5,959 | What are some grilling tools that a beginner should have when purchasing a new grill? Additionally, are there tools that are useful for the more advanced outdoor cook? | 2010/08/25 | [
"https://cooking.stackexchange.com/questions/5959",
"https://cooking.stackexchange.com",
"https://cooking.stackexchange.com/users/177/"
] | The tools I use the most are:
* Tongs,
* Spatula for stuck things,
* A small towel to apply oil,
* thermometer,
* a long handled basting brush
* a brush to clean the grill with
* spray bottle with water (for flare-ups) | Tool-wise: spatula, tongs, grill brush (for cleaning) and a basting brush. If you're using extremely hot fire or high flames there are grill-safe mitts you can buy.
This isn't a tool, but I find buying cedar (or other wood) planks for grilling fish and other meats and veggies on are invaluable. Similarly, applewood or... |
5,959 | What are some grilling tools that a beginner should have when purchasing a new grill? Additionally, are there tools that are useful for the more advanced outdoor cook? | 2010/08/25 | [
"https://cooking.stackexchange.com/questions/5959",
"https://cooking.stackexchange.com",
"https://cooking.stackexchange.com/users/177/"
] | In addition to what others have said, you should have TWO of each meat-handling tool (tongs, mainly). That way you can use one to handle raw meat, and one to remove cooked meat. | The basic things that you need are:
* Grill brush to clean the grate
* Large tongs to get food on and off of the grill
With that, oil to oil the grate, fuel, and quite possibly aluminum foil you will be grilling.
A grill basket of sorts can be very useful. Metal skewers for making kebabs are great if you like that s... |
40,249,167 | On Sql Server 2012 (T-SQL), I would like to analyse a list of absence dates and rearrange the data to summarise information, catalogued by month.
Example:
Here is a list of raw data
```
TimeSheetID UserID LeaveID StartDate EndDate Duration
1 779 1 01/01/2016 01/01/2016 ... | 2016/10/25 | [
"https://Stackoverflow.com/questions/40249167",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2327663/"
] | Try this:
```
df[df['Office'].str.contains("^(?:N|M|V|R)")]
```
or:
```
df[df['Office'].str.contains("^[NMVR]+")]
```
Demo:
```
In [91]: df
Out[91]:
Office
0 No-No
1 AAAA
2 MicroHard
3 Valley
4 vvvvv
5 zzzzzzzzzz
6 Risk is fun
In [92]: df[df['Office'].str.contains("^(?:... | The method `startswith` allows a *string* or *tuple* as its first argument:
```
# Option 1
new_df = df[df['Office'].str.startswith(('N','M','V','R'), na=False)
```
Example:
```
df = pd.DataFrame(data=[np.nan, 'Austria', 'Norway', 'Madagascar', 'Romania', 'Spain', 'Uruguay', 'Yemen'], columns=['Office'])
print(df)
d... |
33,374,523 | I saw in the zookeper C binding that one of the events is ZOO\_CREATED\_EVENT.
So i assumed that when i set watch on path without real node - and then the node created - i will get "created event". but when i try to do it (Set the watch and then create the node) nothing happened.
So is it possible? and if no when th... | 2015/10/27 | [
"https://Stackoverflow.com/questions/33374523",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3382861/"
] | Per the [manual](http://php.net/manual/en/function.array-sum.php), the `array_sum` expects an array, not a string.
Your code also currently is only working with one record. You need to loop the fetch to get all records.
This should give you the sum.
```
$query = "SELECT * FROM table";
$stmt = sqlsrv_query($conn, $qu... | ```
$sum = array();
$users = array();
$query = "SELECT * FROM table";
$stmt = sqlsrv_query($conn, $query);
$data = sqlsrv_fetch_array($stmt);
while ($row = sqlsrv_fetch_array($result)) {
$users[] = $row;
}
foreach ($users as $user) {
$sum[] = $user['value'];
}
echo $total = array_sum($sum);
``` |
63,651,659 | I have the following Query that returns an array
```
$wines = Wine::all();
//Remove type_id and producer_id
foreach ($wines as $wine) {
$location = $wine->producer->location;
}
```
This is what I get if i echo $wine->producer->location;
```
{"city": "Kavadartsi", "address": "29-ти Ноември, ... | 2020/08/29 | [
"https://Stackoverflow.com/questions/63651659",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11650127/"
] | First of this is wrong: `$wine->producer->location->['address'];`, you might want to do this instead `$wine->producer->location['address'];`.
If that doesn't work, then it would help a lot to see what your producer migration file looks like, but if am to guess it is probably in json like `$table->json('location');`.
I... | Remove the arrow after location: $wine->producer->location['address'];
If you are getting the same error and if location is in JSON format in your database, json\_decode it:
```
$location = json_decode($wine->producer->location, true);
$address = $location['address'];
``` |
39,844,270 | hey so I have a problem with typecasting int. I have a program here designed to print the two digits of an entered number then I am supposed to increment the first digit using the ++ operator and multiply by ten then add the second digit and print the new number (which should be the original plus 10). I can't get the f... | 2016/10/04 | [
"https://Stackoverflow.com/questions/39844270",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6918232/"
] | Hi Please try following code I have debuged your website on mobile.
```
header {
background-color: #87CEEB;
min-height: 60px;
border: 1px solid #87ceeb!important;
}
.main{
background: url('https://s4.postimg.org/shvgf6cj1/cutheader.png');
}
```
I guess it is pixel density problem | You can use below code to solved ur css issue, this will hide the white line
```
header{
z-index: 1;
}
main{
margin-top: -1px;
}
```
see screenshot [](https://i.stack.imgur.com/ai7ln.png) |
39,844,270 | hey so I have a problem with typecasting int. I have a program here designed to print the two digits of an entered number then I am supposed to increment the first digit using the ++ operator and multiply by ten then add the second digit and print the new number (which should be the original plus 10). I can't get the f... | 2016/10/04 | [
"https://Stackoverflow.com/questions/39844270",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6918232/"
] | Hi Please try following code I have debuged your website on mobile.
```
header {
background-color: #87CEEB;
min-height: 60px;
border: 1px solid #87ceeb!important;
}
.main{
background: url('https://s4.postimg.org/shvgf6cj1/cutheader.png');
}
```
I guess it is pixel density problem | I had 2 problems
1)margin-bottom: -1px (css in links)
2)bad retina browser resize. SVG image help. |
37,309,828 | I'm trying to compile a C code that contains the following lines:
```
//...
#ifdef CPU_GPREG_NAMES
static const char *reg_names[] = CPU_GPREG_NAMES;
#endif
//...
```
where the macro `CPU_GPREG_NAMES` is defined as:
```
#define CPU_GPREG_NAMES \
"zero", "at", "v0", "v1", "a... | 2016/05/18 | [
"https://Stackoverflow.com/questions/37309828",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2407119/"
] | You forget to put curly braces:
```
#define CPU_GPREG_NAMES { \
"zero", "at", "v0", "v1", "a0", "a1", "a2", "a3", \
"t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7", \
"s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", \
"t8", "t9", "k0", "k1", "gp", "sp", "fp", "ra" ... | You need curly braces around your initializer. Because what you're initializing is an array, the braces signify that you're setting multiple elements of the array:
```
#define CPU_GPREG_NAMES { \
"zero", "at", "v0", "v1", "a0", "a1", "a2", "a3", \
"t0", "t1", "... |
37,309,828 | I'm trying to compile a C code that contains the following lines:
```
//...
#ifdef CPU_GPREG_NAMES
static const char *reg_names[] = CPU_GPREG_NAMES;
#endif
//...
```
where the macro `CPU_GPREG_NAMES` is defined as:
```
#define CPU_GPREG_NAMES \
"zero", "at", "v0", "v1", "a... | 2016/05/18 | [
"https://Stackoverflow.com/questions/37309828",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2407119/"
] | You need curly braces to define your array for the initializer. You can either do:
```
#define CPU_GPREG_NAMES { \
"zero", ... \
... \
}
```
or
```
static const char *reg_names[] = {CPU_GPREG_NAMES};
``` | You need curly braces around your initializer. Because what you're initializing is an array, the braces signify that you're setting multiple elements of the array:
```
#define CPU_GPREG_NAMES { \
"zero", "at", "v0", "v1", "a0", "a1", "a2", "a3", \
"t0", "t1", "... |
37,309,828 | I'm trying to compile a C code that contains the following lines:
```
//...
#ifdef CPU_GPREG_NAMES
static const char *reg_names[] = CPU_GPREG_NAMES;
#endif
//...
```
where the macro `CPU_GPREG_NAMES` is defined as:
```
#define CPU_GPREG_NAMES \
"zero", "at", "v0", "v1", "a... | 2016/05/18 | [
"https://Stackoverflow.com/questions/37309828",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2407119/"
] | You need curly braces to define your array for the initializer. You can either do:
```
#define CPU_GPREG_NAMES { \
"zero", ... \
... \
}
```
or
```
static const char *reg_names[] = {CPU_GPREG_NAMES};
``` | You forget to put curly braces:
```
#define CPU_GPREG_NAMES { \
"zero", "at", "v0", "v1", "a0", "a1", "a2", "a3", \
"t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7", \
"s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", \
"t8", "t9", "k0", "k1", "gp", "sp", "fp", "ra" ... |
13,508,033 | I have created a storyboard with 12 buttons, 12 smaller buttons and 12 labels.
It is like that:
```
btnBig1.tag = 1
btnSmall1.tag = 1
lbl1.tag = 1
btnBig2.tag = 2
btnSmall2.tag = 2
lbl2.tag = 2
```
etc...
Now when a procedure is called
```
- (IBAction)processButtonUpInside:(id)sender
{
UIButton *nButton = ... | 2012/11/22 | [
"https://Stackoverflow.com/questions/13508033",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1390192/"
] | You can use 3 a different starting point for each button family:
```
enum {
kTagFirstBigButton = 1000,
kTagFirstSmallButton = 2000,
kTagFirstLabel = 3000,
}
```
Assign the tags using them:
```
btnBig1.tag = kTagFirstBigButton + 1;
btnSmall1.tag = kTagFirstSmallButton + 1;
lbl1.tag = kTagFirstLabel + 1;
... | You shouldn't assign the same tag id to different views.
Indeed, do something like this:
```
btnBig1.tag = 11 btnSmall1.tag = 12 lbl1.tag = 13;
btnBig2.tag = 21 btnSmall2.tag = 22 lbl2.tag = 23;
```
Then consider the last digit of the tag id:
```
UIView *nView = (UIView *)sender;
if (lastDigit(sender.tag) == 3)
//... |
13,508,033 | I have created a storyboard with 12 buttons, 12 smaller buttons and 12 labels.
It is like that:
```
btnBig1.tag = 1
btnSmall1.tag = 1
lbl1.tag = 1
btnBig2.tag = 2
btnSmall2.tag = 2
lbl2.tag = 2
```
etc...
Now when a procedure is called
```
- (IBAction)processButtonUpInside:(id)sender
{
UIButton *nButton = ... | 2012/11/22 | [
"https://Stackoverflow.com/questions/13508033",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1390192/"
] | You shouldn't assign the same tag id to different views.
Indeed, do something like this:
```
btnBig1.tag = 11 btnSmall1.tag = 12 lbl1.tag = 13;
btnBig2.tag = 21 btnSmall2.tag = 22 lbl2.tag = 23;
```
Then consider the last digit of the tag id:
```
UIView *nView = (UIView *)sender;
if (lastDigit(sender.tag) == 3)
//... | In my case where I don't have a reference to the subviews that I want to edit under the same tag I just grab all of the subviews for a given view then loop through all of them and check the tag, if the tag match I execute some code. For example..
```
#define kSameViewTag 9500001
for (int i = 0; i < 10; i++) // add a ... |
13,508,033 | I have created a storyboard with 12 buttons, 12 smaller buttons and 12 labels.
It is like that:
```
btnBig1.tag = 1
btnSmall1.tag = 1
lbl1.tag = 1
btnBig2.tag = 2
btnSmall2.tag = 2
lbl2.tag = 2
```
etc...
Now when a procedure is called
```
- (IBAction)processButtonUpInside:(id)sender
{
UIButton *nButton = ... | 2012/11/22 | [
"https://Stackoverflow.com/questions/13508033",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1390192/"
] | You can use 3 a different starting point for each button family:
```
enum {
kTagFirstBigButton = 1000,
kTagFirstSmallButton = 2000,
kTagFirstLabel = 3000,
}
```
Assign the tags using them:
```
btnBig1.tag = kTagFirstBigButton + 1;
btnSmall1.tag = kTagFirstSmallButton + 1;
lbl1.tag = kTagFirstLabel + 1;
... | In my case where I don't have a reference to the subviews that I want to edit under the same tag I just grab all of the subviews for a given view then loop through all of them and check the tag, if the tag match I execute some code. For example..
```
#define kSameViewTag 9500001
for (int i = 0; i < 10; i++) // add a ... |
2,260,931 | i wrote a cuda program and i am testing it on ubuntu as a virtual machine. the reason for this is i have windows 7, i don't want to install ubuntu as a secondary operating system, and i need to use a linux operating system for testing.
my question is: will the virtual machine limit the gpu resources? So will my cuda co... | 2010/02/14 | [
"https://Stackoverflow.com/questions/2260931",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/272506/"
] | Unfortunately the virtual machine simulates a graphics device and as such you won't have access to the real GPU. This is because of the way the virtualisation handles multiple VMs accessing the same device - it provides a layer in between to share the real device.
It is possible to get true access to the hardware, but... | As of CUDA 3.1 it's virtualization capabilities are not vivid, so the only usable approach is to run CUDA programs directly on the target HW+SW |
2,260,931 | i wrote a cuda program and i am testing it on ubuntu as a virtual machine. the reason for this is i have windows 7, i don't want to install ubuntu as a secondary operating system, and i need to use a linux operating system for testing.
my question is: will the virtual machine limit the gpu resources? So will my cuda co... | 2010/02/14 | [
"https://Stackoverflow.com/questions/2260931",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/272506/"
] | Unfortunately the virtual machine simulates a graphics device and as such you won't have access to the real GPU. This is because of the way the virtualisation handles multiple VMs accessing the same device - it provides a layer in between to share the real device.
It is possible to get true access to the hardware, but... | I just heard a talk at NVIDIA's GPU technology conference by a researcher named Xiaohui Cui (Oak Ridge National Laboratory). Among other things, he described accessing GPUs from Virtual machines using something called gVirtuS. He did not create gVirtuS, but described it as an opensource "virtual cuda" driver. See follo... |
2,260,931 | i wrote a cuda program and i am testing it on ubuntu as a virtual machine. the reason for this is i have windows 7, i don't want to install ubuntu as a secondary operating system, and i need to use a linux operating system for testing.
my question is: will the virtual machine limit the gpu resources? So will my cuda co... | 2010/02/14 | [
"https://Stackoverflow.com/questions/2260931",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/272506/"
] | I faced a similar task once. What I ended up doing was installing Ubuntu on a 8GB thumb drive with persistent mode enabled.
That gave me 4GB to install CUDA and everything else I needed.
Having a bootable USB stick around can be very useful. I recommend reading [this](https://wiki.ubuntu.com/LiveUsbPendrivePersisten... | Unfortunately the virtual machine simulates a graphics device and as such you won't have access to the real GPU. This is because of the way the virtualisation handles multiple VMs accessing the same device - it provides a layer in between to share the real device.
It is possible to get true access to the hardware, but... |
2,260,931 | i wrote a cuda program and i am testing it on ubuntu as a virtual machine. the reason for this is i have windows 7, i don't want to install ubuntu as a secondary operating system, and i need to use a linux operating system for testing.
my question is: will the virtual machine limit the gpu resources? So will my cuda co... | 2010/02/14 | [
"https://Stackoverflow.com/questions/2260931",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/272506/"
] | Unfortunately the virtual machine simulates a graphics device and as such you won't have access to the real GPU. This is because of the way the virtualisation handles multiple VMs accessing the same device - it provides a layer in between to share the real device.
It is possible to get true access to the hardware, but... | Use [rCUDA](http://rcuda.net/) to add a virtual GPU to your VM. |
2,260,931 | i wrote a cuda program and i am testing it on ubuntu as a virtual machine. the reason for this is i have windows 7, i don't want to install ubuntu as a secondary operating system, and i need to use a linux operating system for testing.
my question is: will the virtual machine limit the gpu resources? So will my cuda co... | 2010/02/14 | [
"https://Stackoverflow.com/questions/2260931",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/272506/"
] | I just heard a talk at NVIDIA's GPU technology conference by a researcher named Xiaohui Cui (Oak Ridge National Laboratory). Among other things, he described accessing GPUs from Virtual machines using something called gVirtuS. He did not create gVirtuS, but described it as an opensource "virtual cuda" driver. See follo... | As of CUDA 3.1 it's virtualization capabilities are not vivid, so the only usable approach is to run CUDA programs directly on the target HW+SW |
2,260,931 | i wrote a cuda program and i am testing it on ubuntu as a virtual machine. the reason for this is i have windows 7, i don't want to install ubuntu as a secondary operating system, and i need to use a linux operating system for testing.
my question is: will the virtual machine limit the gpu resources? So will my cuda co... | 2010/02/14 | [
"https://Stackoverflow.com/questions/2260931",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/272506/"
] | I faced a similar task once. What I ended up doing was installing Ubuntu on a 8GB thumb drive with persistent mode enabled.
That gave me 4GB to install CUDA and everything else I needed.
Having a bootable USB stick around can be very useful. I recommend reading [this](https://wiki.ubuntu.com/LiveUsbPendrivePersisten... | As of CUDA 3.1 it's virtualization capabilities are not vivid, so the only usable approach is to run CUDA programs directly on the target HW+SW |
2,260,931 | i wrote a cuda program and i am testing it on ubuntu as a virtual machine. the reason for this is i have windows 7, i don't want to install ubuntu as a secondary operating system, and i need to use a linux operating system for testing.
my question is: will the virtual machine limit the gpu resources? So will my cuda co... | 2010/02/14 | [
"https://Stackoverflow.com/questions/2260931",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/272506/"
] | I faced a similar task once. What I ended up doing was installing Ubuntu on a 8GB thumb drive with persistent mode enabled.
That gave me 4GB to install CUDA and everything else I needed.
Having a bootable USB stick around can be very useful. I recommend reading [this](https://wiki.ubuntu.com/LiveUsbPendrivePersisten... | I just heard a talk at NVIDIA's GPU technology conference by a researcher named Xiaohui Cui (Oak Ridge National Laboratory). Among other things, he described accessing GPUs from Virtual machines using something called gVirtuS. He did not create gVirtuS, but described it as an opensource "virtual cuda" driver. See follo... |
2,260,931 | i wrote a cuda program and i am testing it on ubuntu as a virtual machine. the reason for this is i have windows 7, i don't want to install ubuntu as a secondary operating system, and i need to use a linux operating system for testing.
my question is: will the virtual machine limit the gpu resources? So will my cuda co... | 2010/02/14 | [
"https://Stackoverflow.com/questions/2260931",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/272506/"
] | I just heard a talk at NVIDIA's GPU technology conference by a researcher named Xiaohui Cui (Oak Ridge National Laboratory). Among other things, he described accessing GPUs from Virtual machines using something called gVirtuS. He did not create gVirtuS, but described it as an opensource "virtual cuda" driver. See follo... | Use [rCUDA](http://rcuda.net/) to add a virtual GPU to your VM. |
2,260,931 | i wrote a cuda program and i am testing it on ubuntu as a virtual machine. the reason for this is i have windows 7, i don't want to install ubuntu as a secondary operating system, and i need to use a linux operating system for testing.
my question is: will the virtual machine limit the gpu resources? So will my cuda co... | 2010/02/14 | [
"https://Stackoverflow.com/questions/2260931",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/272506/"
] | I faced a similar task once. What I ended up doing was installing Ubuntu on a 8GB thumb drive with persistent mode enabled.
That gave me 4GB to install CUDA and everything else I needed.
Having a bootable USB stick around can be very useful. I recommend reading [this](https://wiki.ubuntu.com/LiveUsbPendrivePersisten... | Use [rCUDA](http://rcuda.net/) to add a virtual GPU to your VM. |
204,020 | What's the longest time a team of five players can hard-CC (stunned etc.) a single enemy champion continuously by chaining their CC? | 2015/02/02 | [
"https://gaming.stackexchange.com/questions/204020",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/90551/"
] | According to the wiki, there's 4 types of hard [crowd control](http://leagueoflegends.wikia.com/wiki/Crowd_control): airborne, forced action, stun, and suppression.
Assuming max CDR and level 18:
```
cost per cost/
Champ cc secs cd stun mp5 mp10
--------------------------... | Indefinite.
For simplicity's sake we'll just use a team of 5 Lux. Lux Q (binding light, roots enemy for 2 seconds) has an 11 second CD maxed out. With 40% CDR that's a 6.6 CD. Rooting lasts for 2 seconds. Only 4 Luxes are needed for perma CC.
Obviously, with other champions that have multiple CCs, low CD CCs, etc, in... |
204,020 | What's the longest time a team of five players can hard-CC (stunned etc.) a single enemy champion continuously by chaining their CC? | 2015/02/02 | [
"https://gaming.stackexchange.com/questions/204020",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/90551/"
] | Indefinite.
For simplicity's sake we'll just use a team of 5 Lux. Lux Q (binding light, roots enemy for 2 seconds) has an 11 second CD maxed out. With 40% CDR that's a 6.6 CD. Rooting lasts for 2 seconds. Only 4 Luxes are needed for perma CC.
Obviously, with other champions that have multiple CCs, low CD CCs, etc, in... | zilean ABOUT 30 sec with E Q W E Q W E Q W E Q W E Q W E Q W E Q W E COMBO Do those CC chains come even close to this?
Zilean CD 22 CC 29.5 |
204,020 | What's the longest time a team of five players can hard-CC (stunned etc.) a single enemy champion continuously by chaining their CC? | 2015/02/02 | [
"https://gaming.stackexchange.com/questions/204020",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/90551/"
] | According to the wiki, there's 4 types of hard [crowd control](http://leagueoflegends.wikia.com/wiki/Crowd_control): airborne, forced action, stun, and suppression.
Assuming max CDR and level 18:
```
cost per cost/
Champ cc secs cd stun mp5 mp10
--------------------------... | zilean ABOUT 30 sec with E Q W E Q W E Q W E Q W E Q W E Q W E Q W E COMBO Do those CC chains come even close to this?
Zilean CD 22 CC 29.5 |
474,166 | I want to change INT to INTERNATIONAL and NA to NATIONAL ASSEMBLY in whole excel workbook through an excel Macro or Find and Replace dialogue box. But when I run the macro or change it through Find and Replace dialogue box it also replace NA from CHINA last 2 characters and it became CHINATIONAL ASSEMBLY and INTERIOR t... | 2012/09/14 | [
"https://superuser.com/questions/474166",
"https://superuser.com",
"https://superuser.com/users/158333/"
] | In the `Find and Replace` window, you need to check the box `Match entire cell contents` then run it.
 | 1. Save your file as a CSV file. If you want to manipulate a subset of your worksheet (e.g., selected columns and/or rows), copy that region into a scratch file (or sheet) and save that as CSV. If you need to modify multiple sheets, repeat this process for each sheet.
2. Edit the CSV file with some sort of smart text... |
474,166 | I want to change INT to INTERNATIONAL and NA to NATIONAL ASSEMBLY in whole excel workbook through an excel Macro or Find and Replace dialogue box. But when I run the macro or change it through Find and Replace dialogue box it also replace NA from CHINA last 2 characters and it became CHINATIONAL ASSEMBLY and INTERIOR t... | 2012/09/14 | [
"https://superuser.com/questions/474166",
"https://superuser.com",
"https://superuser.com/users/158333/"
] | If you go the VBA route, try using `Regular Expressions`
Here's a start
```
Sub ReplaceWithRE()
Dim re As Object 'RegExp
Dim rng As Range, cl As Range
Dim sh As Worksheet
Dim wb As Workbook
Dim sReplace As String
Dim aReplace(0 To 1, 0 To 1) As String
Dim i As Long
Set wb = ActiveWork... | 1. Save your file as a CSV file. If you want to manipulate a subset of your worksheet (e.g., selected columns and/or rows), copy that region into a scratch file (or sheet) and save that as CSV. If you need to modify multiple sheets, repeat this process for each sheet.
2. Edit the CSV file with some sort of smart text... |
474,166 | I want to change INT to INTERNATIONAL and NA to NATIONAL ASSEMBLY in whole excel workbook through an excel Macro or Find and Replace dialogue box. But when I run the macro or change it through Find and Replace dialogue box it also replace NA from CHINA last 2 characters and it became CHINATIONAL ASSEMBLY and INTERIOR t... | 2012/09/14 | [
"https://superuser.com/questions/474166",
"https://superuser.com",
"https://superuser.com/users/158333/"
] | If the values you are looking to replace are by themselves in the cells (no other text), definitely follow [CharlieRB's solution](https://superuser.com/a/474182/143655). If the values are located in the cells, along with additional text, a slightly modified version would work.
Open the Find and Replace window. Click t... | 1. Save your file as a CSV file. If you want to manipulate a subset of your worksheet (e.g., selected columns and/or rows), copy that region into a scratch file (or sheet) and save that as CSV. If you need to modify multiple sheets, repeat this process for each sheet.
2. Edit the CSV file with some sort of smart text... |
16,967 | It is known from the gemara ([Shabbos 31a](http://hebrewbooks.org/shas.aspx?mesechta=2&daf=31&format=pdf) and cited in [maamar Toras HaBayis ch. 1](http://hebrewbooks.org/pdfpager.aspx?req=33083&st=&pgnum=5), among other places) that when a person dies, he is asked if he had set times for learning. I know that these ti... | 2012/06/08 | [
"https://judaism.stackexchange.com/questions/16967",
"https://judaism.stackexchange.com",
"https://judaism.stackexchange.com/users/1569/"
] | Shulchan Aruch OC 238:
א. צריך ליזהר בלמוד הלילה יותר מבשל יום, והמבטלו עונשו מרובה
ב. אם יש לו חק קבוע ללמוד כך וכך ליום והיה טרוד ביום ולא השלימו, ישלימנו בלילה מיד
Regarding upper limits, I believe this is a Nedarim question. The Gemara says (Nedarim 7a):
אמר רב גידל אמר רב: האומר לחבירו: "נשכים ונשנה פרק זה", ע... | The Shulchan Aruch rules ([OC 155:1](http://hebrewbooks.org/pdfpager.aspx?req=49624&st=&pgnum=84))
>
> אחר שיצא מבהכ"נ, ילך לבה"מ; ויקבע עת ללמוד, וצריך שאותו עת יהיה קבוע שלא יעבירנו אף אם הוא סבור להרויח הרבה.
>
> After one leaves the synagogue he should go to the study hall and establish a time of study which... |
19,764 | I'm looking for an exhaustive writing tracker, either software or a spreadsheet. ideally, the basic things it would need to track are word count per session, projects worked on, submission status, etc. The more things related to writing to track the better.
If there's a way to create or it includes graphs that would b... | 2015/11/18 | [
"https://writers.stackexchange.com/questions/19764",
"https://writers.stackexchange.com",
"https://writers.stackexchange.com/users/15928/"
] | **Excel, absolutely.**
You might not want to consider this, but give it a shot. Here are the things it could do for you:
1. **Word Count.** It has this one in the bag. Simply write for a session and count the words. If you're using MS Word, just highlight the words. It will tell you the word count down on the botto... | You can try my old buddy [Scrivener.](http://www.literatureandlatte.com/scrivener.php) I don't use even a quarter of the bells and whistles I know are there, so hunt around the documentation and see if it's useful. I know it at least has a Goal function so you can set a word count goal to meet, and keeps track in the f... |
19,764 | I'm looking for an exhaustive writing tracker, either software or a spreadsheet. ideally, the basic things it would need to track are word count per session, projects worked on, submission status, etc. The more things related to writing to track the better.
If there's a way to create or it includes graphs that would b... | 2015/11/18 | [
"https://writers.stackexchange.com/questions/19764",
"https://writers.stackexchange.com",
"https://writers.stackexchange.com/users/15928/"
] | **Excel, absolutely.**
You might not want to consider this, but give it a shot. Here are the things it could do for you:
1. **Word Count.** It has this one in the bag. Simply write for a session and count the words. If you're using MS Word, just highlight the words. It will tell you the word count down on the botto... | I use a variation of Fritz Freiheit's Master Writing Log. It is a LibreOffice spreadsheet (works under excel too) and doesn't have graphs but they're easy to put in.
See <http://fritzfreiheit.com/wiki/Master_writing_log> |
19,764 | I'm looking for an exhaustive writing tracker, either software or a spreadsheet. ideally, the basic things it would need to track are word count per session, projects worked on, submission status, etc. The more things related to writing to track the better.
If there's a way to create or it includes graphs that would b... | 2015/11/18 | [
"https://writers.stackexchange.com/questions/19764",
"https://writers.stackexchange.com",
"https://writers.stackexchange.com/users/15928/"
] | While Excel is good at tracking data, and I use Scrivener for all of my writing, you may want to look at [Pacemaker](http://pacemaker.press/). It's a free web service, and a great way to set goals and enter progress.
It will automatically adjust based on your progress, and creates charts that you can vary several dif... | You can try my old buddy [Scrivener.](http://www.literatureandlatte.com/scrivener.php) I don't use even a quarter of the bells and whistles I know are there, so hunt around the documentation and see if it's useful. I know it at least has a Goal function so you can set a word count goal to meet, and keeps track in the f... |
19,764 | I'm looking for an exhaustive writing tracker, either software or a spreadsheet. ideally, the basic things it would need to track are word count per session, projects worked on, submission status, etc. The more things related to writing to track the better.
If there's a way to create or it includes graphs that would b... | 2015/11/18 | [
"https://writers.stackexchange.com/questions/19764",
"https://writers.stackexchange.com",
"https://writers.stackexchange.com/users/15928/"
] | While Excel is good at tracking data, and I use Scrivener for all of my writing, you may want to look at [Pacemaker](http://pacemaker.press/). It's a free web service, and a great way to set goals and enter progress.
It will automatically adjust based on your progress, and creates charts that you can vary several dif... | I use a variation of Fritz Freiheit's Master Writing Log. It is a LibreOffice spreadsheet (works under excel too) and doesn't have graphs but they're easy to put in.
See <http://fritzfreiheit.com/wiki/Master_writing_log> |
3,215,028 | Greetings folks!
I'm running into a problem with WPF databinding that I hope you can help out with. I'm new to WPF but an expereienced developer (VB 3.0-6.0, C#).
Here's the scenario:
I have a C# project called MasterPartsData which contains a number of classes which reprsent different types of parts (capacitor, diode... | 2010/07/09 | [
"https://Stackoverflow.com/questions/3215028",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/145857/"
] | With respect to your suspicions:
1) I think the default binding behavior of a `TextBox` is `TwoWay`, with a `LostFocus` update trigger, meaning that your UI focus will have to change to another control before the binding will update, if changes are made in the UI.
If changes are made in the code you need to raise th... | In a basic binding scenario, if your class looks like this
```
public class MasterPartsData
{
private string _c0uf;
public string C0uf
{
get { return _c0uf;}
set { _c0uf = value;}
}
public MasterPartsData()
{
C0uf = "Hello World!";
}
}
```
your XAML would look li... |
60,068,001 | I have DF as follows:
```
Name starttime endtime
user1 2019-08-02 03:34:45 2019-08-02 03:52:03
user2 2019-08-13 13:34:10 2019-08-13 14:02:10
```
I would like to check if the `endtime` bleeds into the next hour and if it does then update it to the last minute and second of the current hour as... | 2020/02/05 | [
"https://Stackoverflow.com/questions/60068001",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5203233/"
] | Another solution would be to truncate the `starttime` to hour then add 59 seconds and 59 minutes using SQL syntax `INTERVAL` like this:
```
adjust_expr = "date_trunc('hour', starttime) + INTERVAL 59 seconds + INTERVAL 59 minutes"
df.withColumn("endtime",
when(col("endtime") > expr(adjust_expr),
... | Assuming your DataFrame has the following schema:
```
df.printSchema()
#root
# |-- Name: string (nullable = true)
# |-- starttime: timestamp (nullable = true)
# |-- endtime: timestamp (nullable = true)
```
i.e. where `starttime` and `endtime` are both [`TimestampType()`](http://spark.apache.org/docs/latest/api/pytho... |
35,059 | I would like to upgrade from XP Professional to Windows 7 Professional. Could someone give me a few basic steps of the process? I keep reading about "clean installs", "migration", and saving everything before upgrading. What specificly, must be saved...or should I not have skipped Vista all these years? | 2009/09/03 | [
"https://superuser.com/questions/35059",
"https://superuser.com",
"https://superuser.com/users/7920/"
] | Your friend [How-To-Geek](https://superuser.com/users/4102/the-how-to-geek) has a step-by-step guide entitled [Migrate XP to Windows 7 with Easy Transfer and a USB Drive](http://www.howtogeek.com/howto/3179/migrate-xp-to-windows-7-with-easy-transfer-and-a-usb-drive/) available on [HowToGeek.com](http://www.howtogeek.co... | Use the Migration Wizard (aka Windows Easy Transfer) that comes with the Windows 7 media. In the `support\migwiz` directory run `migsetup.exe`. This will help you transfer your files to an "External Hard Disk or USB drive".
Perform a clean installation of Windows 7 on your machine and then restore your data again runn... |
35,059 | I would like to upgrade from XP Professional to Windows 7 Professional. Could someone give me a few basic steps of the process? I keep reading about "clean installs", "migration", and saving everything before upgrading. What specificly, must be saved...or should I not have skipped Vista all these years? | 2009/09/03 | [
"https://superuser.com/questions/35059",
"https://superuser.com",
"https://superuser.com/users/7920/"
] | Your friend [How-To-Geek](https://superuser.com/users/4102/the-how-to-geek) has a step-by-step guide entitled [Migrate XP to Windows 7 with Easy Transfer and a USB Drive](http://www.howtogeek.com/howto/3179/migrate-xp-to-windows-7-with-easy-transfer-and-a-usb-drive/) available on [HowToGeek.com](http://www.howtogeek.co... | You won't be able to do a direct xp to 7 upgrade. for some inane reason, microsoft decided against it. you can only do a clean install which means you'll have to backup all of your settings, documents, media and do a clean install of 7 then import your stuff.
i think this is microsoft's way of giving us the finger ba... |
35,059 | I would like to upgrade from XP Professional to Windows 7 Professional. Could someone give me a few basic steps of the process? I keep reading about "clean installs", "migration", and saving everything before upgrading. What specificly, must be saved...or should I not have skipped Vista all these years? | 2009/09/03 | [
"https://superuser.com/questions/35059",
"https://superuser.com",
"https://superuser.com/users/7920/"
] | Use the Migration Wizard (aka Windows Easy Transfer) that comes with the Windows 7 media. In the `support\migwiz` directory run `migsetup.exe`. This will help you transfer your files to an "External Hard Disk or USB drive".
Perform a clean installation of Windows 7 on your machine and then restore your data again runn... | You won't be able to do a direct xp to 7 upgrade. for some inane reason, microsoft decided against it. you can only do a clean install which means you'll have to backup all of your settings, documents, media and do a clean install of 7 then import your stuff.
i think this is microsoft's way of giving us the finger ba... |
28,504,144 | I have checked every question in stackoverflow. :(
But anything seems not working..
i have placed a breakpoint in the event and not firing.
I hope you get the solution
Thanks
```
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:DropDownList AutoPostBack="true"
... | 2015/02/13 | [
"https://Stackoverflow.com/questions/28504144",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1766970/"
] | The function `strtok` is the standard method of tokenizing a string. With that you can build the full path-name of the file.
```
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
main(int argc, char **argv)
{
char* fullPath = getenv( "PATH" );
struct stat... | Here's something to try:
```
// Variables needed during iteration.
char* start = fullPath;
char sep = ':';
char* iter;
char trialPath[BUFSIZ];
// Get the path
char* originalPath = getenv( "PATH" );
// Make a copy of the path since we are going to modify it
// while we are iterating on it.
char* fullPath = malloc(str... |
28,504,144 | I have checked every question in stackoverflow. :(
But anything seems not working..
i have placed a breakpoint in the event and not firing.
I hope you get the solution
Thanks
```
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:DropDownList AutoPostBack="true"
... | 2015/02/13 | [
"https://Stackoverflow.com/questions/28504144",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1766970/"
] | Because string standard library functions are not allowed you need to write a string tokenizer yourself you can do something on the lines of the following code below, You might would have to refine it a little more.
Basically what we are doing here
Get the PATH
find token ':'
memcpy substring upto token -1
updat... | Here's something to try:
```
// Variables needed during iteration.
char* start = fullPath;
char sep = ':';
char* iter;
char trialPath[BUFSIZ];
// Get the path
char* originalPath = getenv( "PATH" );
// Make a copy of the path since we are going to modify it
// while we are iterating on it.
char* fullPath = malloc(str... |
36,783,547 | here is my code
```
function leftArrowPressed() {
document.getElementById("image1").src = "http://orig04.deviantart.net/137f/f/2014/147/3/1/random_character__jet_bear_by_mnrart-d7jwteg.gif";
var element = document.getElementById("image1");
element.style.left = parseInt(element.sty... | 2016/04/22 | [
"https://Stackoverflow.com/questions/36783547",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5577201/"
] | This is a [bug](https://bugs.chromium.org/p/chromium/issues/detail?id=1018533) in Chrome, which apparently only happens with 'some' videos. Similar bug reports have been filed and closed numerous times in the past, so I suggest we keep a watch on it, so it doesn't get closed again until the issue is actually fixed. | The solution for me was to first send the following headers from my server:
```
Accept-Ranges: none,
Content-Length: 123456,
Content-Type: audio/mpeg
```
And then use a `MediaSource` object:
```
const mediaSource = new MediaSource();
audio.src = URL.createObjectURL(mediaSource);
mediaSource.addEventListener('source... |
36,783,547 | here is my code
```
function leftArrowPressed() {
document.getElementById("image1").src = "http://orig04.deviantart.net/137f/f/2014/147/3/1/random_character__jet_bear_by_mnrart-d7jwteg.gif";
var element = document.getElementById("image1");
element.style.left = parseInt(element.sty... | 2016/04/22 | [
"https://Stackoverflow.com/questions/36783547",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5577201/"
] | I finally figured out an answer! Chrome requires you to set the currentTime as a String, and not as a number.
```js
function settime() {
var video = document.getElementById("video1");
console.log(video.currentTime); // output 0
video.currentTime = 10.0;
console.log(video.currentTime); // output 0 f... | It should be
```
var video = document.getElementById("video1");
```
as you have
```
<video id="video1" class="video-js vjs-default-skin" muted>
``` |
36,783,547 | here is my code
```
function leftArrowPressed() {
document.getElementById("image1").src = "http://orig04.deviantart.net/137f/f/2014/147/3/1/random_character__jet_bear_by_mnrart-d7jwteg.gif";
var element = document.getElementById("image1");
element.style.left = parseInt(element.sty... | 2016/04/22 | [
"https://Stackoverflow.com/questions/36783547",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5577201/"
] | This is caused in many cases by the server not replying with an `Accept-Ranges` header. For an obscure, only-Google-developer-relevant reason (the FF folks don't seem to be so offended by a server replying without an `Accept-Ranges` header), they refuse to implement seeking when such a header is not provided. You can a... | It should be
```
var video = document.getElementById("video1");
```
as you have
```
<video id="video1" class="video-js vjs-default-skin" muted>
``` |
36,783,547 | here is my code
```
function leftArrowPressed() {
document.getElementById("image1").src = "http://orig04.deviantart.net/137f/f/2014/147/3/1/random_character__jet_bear_by_mnrart-d7jwteg.gif";
var element = document.getElementById("image1");
element.style.left = parseInt(element.sty... | 2016/04/22 | [
"https://Stackoverflow.com/questions/36783547",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5577201/"
] | It has probably already been addressed, but it's a Chrome "bug" that they could fix like FF but #wontfix I guess. It's a server-side fix so you would want to look at making sure you pass the headers right.
It's wasteful as heck but by setting the Accept-Ranges to `bytes` (be sure to include the content length and mime... | You can add `preload="auto"` and the browser will try to download the file as soon as possible.
<https://developer.mozilla.org/en-US/docs/Web/Guide/Audio_and_video_delivery/Cross-browser_audio_basics>
Worked for me. |
36,783,547 | here is my code
```
function leftArrowPressed() {
document.getElementById("image1").src = "http://orig04.deviantart.net/137f/f/2014/147/3/1/random_character__jet_bear_by_mnrart-d7jwteg.gif";
var element = document.getElementById("image1");
element.style.left = parseInt(element.sty... | 2016/04/22 | [
"https://Stackoverflow.com/questions/36783547",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5577201/"
] | It has probably already been addressed, but it's a Chrome "bug" that they could fix like FF but #wontfix I guess. It's a server-side fix so you would want to look at making sure you pass the headers right.
It's wasteful as heck but by setting the Accept-Ranges to `bytes` (be sure to include the content length and mime... | In my case I had to update video serving server to return response with `Status Code 206` and `Content-Range` and `Content-Length` headers |
36,783,547 | here is my code
```
function leftArrowPressed() {
document.getElementById("image1").src = "http://orig04.deviantart.net/137f/f/2014/147/3/1/random_character__jet_bear_by_mnrart-d7jwteg.gif";
var element = document.getElementById("image1");
element.style.left = parseInt(element.sty... | 2016/04/22 | [
"https://Stackoverflow.com/questions/36783547",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5577201/"
] | In my case I had to update video serving server to return response with `Status Code 206` and `Content-Range` and `Content-Length` headers | It should be
```
var video = document.getElementById("video1");
```
as you have
```
<video id="video1" class="video-js vjs-default-skin" muted>
``` |
36,783,547 | here is my code
```
function leftArrowPressed() {
document.getElementById("image1").src = "http://orig04.deviantart.net/137f/f/2014/147/3/1/random_character__jet_bear_by_mnrart-d7jwteg.gif";
var element = document.getElementById("image1");
element.style.left = parseInt(element.sty... | 2016/04/22 | [
"https://Stackoverflow.com/questions/36783547",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5577201/"
] | I came across the same problem. Here's what happened in the bottom line.
1. If you are writing code in an integrated development environment, then open your HTML file directly from a hard disk besides the IDE server - This happened to me, the server did not let you set an arbitrary time during video playback.
2. You c... | It should be
```
var video = document.getElementById("video1");
```
as you have
```
<video id="video1" class="video-js vjs-default-skin" muted>
``` |
36,783,547 | here is my code
```
function leftArrowPressed() {
document.getElementById("image1").src = "http://orig04.deviantart.net/137f/f/2014/147/3/1/random_character__jet_bear_by_mnrart-d7jwteg.gif";
var element = document.getElementById("image1");
element.style.left = parseInt(element.sty... | 2016/04/22 | [
"https://Stackoverflow.com/questions/36783547",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5577201/"
] | This is caused in many cases by the server not replying with an `Accept-Ranges` header. For an obscure, only-Google-developer-relevant reason (the FF folks don't seem to be so offended by a server replying without an `Accept-Ranges` header), they refuse to implement seeking when such a header is not provided. You can a... | In my case I had to update video serving server to return response with `Status Code 206` and `Content-Range` and `Content-Length` headers |
36,783,547 | here is my code
```
function leftArrowPressed() {
document.getElementById("image1").src = "http://orig04.deviantart.net/137f/f/2014/147/3/1/random_character__jet_bear_by_mnrart-d7jwteg.gif";
var element = document.getElementById("image1");
element.style.left = parseInt(element.sty... | 2016/04/22 | [
"https://Stackoverflow.com/questions/36783547",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5577201/"
] | This is caused in many cases by the server not replying with an `Accept-Ranges` header. For an obscure, only-Google-developer-relevant reason (the FF folks don't seem to be so offended by a server replying without an `Accept-Ranges` header), they refuse to implement seeking when such a header is not provided. You can a... | Seems you're using `video.js`. If so, get and set currentTime via `VideoJsPlayer.currentTime()` method.
For example:
```js
const player = videojs(document.getElementById("video1"));
// read currentTime
console.log(player.currentTime());
//set currentTime
player.currentTime(10.0);
// read currentTime
console.log(pl... |
36,783,547 | here is my code
```
function leftArrowPressed() {
document.getElementById("image1").src = "http://orig04.deviantart.net/137f/f/2014/147/3/1/random_character__jet_bear_by_mnrart-d7jwteg.gif";
var element = document.getElementById("image1");
element.style.left = parseInt(element.sty... | 2016/04/22 | [
"https://Stackoverflow.com/questions/36783547",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5577201/"
] | It has probably already been addressed, but it's a Chrome "bug" that they could fix like FF but #wontfix I guess. It's a server-side fix so you would want to look at making sure you pass the headers right.
It's wasteful as heck but by setting the Accept-Ranges to `bytes` (be sure to include the content length and mime... | Seems you're using `video.js`. If so, get and set currentTime via `VideoJsPlayer.currentTime()` method.
For example:
```js
const player = videojs(document.getElementById("video1"));
// read currentTime
console.log(player.currentTime());
//set currentTime
player.currentTime(10.0);
// read currentTime
console.log(pl... |
26,502,865 | I have this code.c in ubuntu in terminal
but when I compile it with gcc this error appeared
```
cod2.c: In function ‘main’:
cod2.c:9:11: error: subscripted value is neither array nor pointer nor vector
```
why is that?
```
int main(int argc , char ** argv){
mkdir(argc[1] , 00755);
return 0;
}
``` | 2014/10/22 | [
"https://Stackoverflow.com/questions/26502865",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4168893/"
] | Date stored in varchar is not a real date and hence the order by also does not give you what you want. The best approach would be store date always in mysql native data types. However in your case you can use `str_to_date()` function to convert the varchar dates to real date and then use it for sort something as
```
o... | ```
$sql = "SELECT * FROM `axnmrs_cases` WHERE `vin` = ':vin' ORDER BY `date_created` ASC LIMIT 30";
```
Already tried something like this? |
26,502,865 | I have this code.c in ubuntu in terminal
but when I compile it with gcc this error appeared
```
cod2.c: In function ‘main’:
cod2.c:9:11: error: subscripted value is neither array nor pointer nor vector
```
why is that?
```
int main(int argc , char ** argv){
mkdir(argc[1] , 00755);
return 0;
}
``` | 2014/10/22 | [
"https://Stackoverflow.com/questions/26502865",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4168893/"
] | Date stored in varchar is not a real date and hence the order by also does not give you what you want. The best approach would be store date always in mysql native data types. However in your case you can use `str_to_date()` function to convert the varchar dates to real date and then use it for sort something as
```
o... | You are using the wrong format in your `STR_TO_DATE` function, if the date is in the format:
```
2014-09-22 10:28:28
```
Then you need to use
```
STR_TO_DATE(date_created, '%Y-%m-%d %H:%i:%s')
```
i.e. the format you give should match the format your varchar is in.
**[Example on SQL Fiddle](http://sqlfiddle.com/... |
62,148,994 | I've recently update vim on ubuntu, and since then, a strange character keep appearing at random time at my cursor place. It seems to appear when I do nothing for some seconds. The character is `>4;2m` and I can't understand the logic of its appearance. Has anyone the same problem ? Switching buffer and coming back to ... | 2020/06/02 | [
"https://Stackoverflow.com/questions/62148994",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4075169/"
] | It was a problem of `modifyOtherKeys`. After looking at the doc, putting
```
let &t_TI = ""
let &t_TE = ""
```
in my vimrc solved the problem. | This works for me:
```
touch ~/.vimrc
``` |
614,185 | I'm trying to find documented (or, undocumented, if that's my only option) APIs on OS X to query a list of windows from the window server and then cause the windows to move and resize. Can anyone point me in the right direction? I guess I'd be starting with something like FindWindowEx and MoveWindow under Win32.
Note ... | 2009/03/05 | [
"https://Stackoverflow.com/questions/614185",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/74164/"
] | Use the Accessibility API. Using this API you can connect to a process, obtain a list of windows (actually an array), get the positions and sizes of each window and also change window properties if you like.
However, an application can only be using this API if the user has enabled access for assistive devices in his ... | I agree that Accessibility is the best way forward. But if you want quick-and-dirty, AppleScript will work as well. |
58,518,894 | I wanted to perform an operation where i would like to delete all the rows(but not to drop the table) in postgres and update with new rows in it. And I wanted to use `pd.read_sql_query()` method from pandas:
```
qry = 'delete from "table_name"'
pd.read_sql_query(qry, conection, **kwargs)
```
But it was throwing erro... | 2019/10/23 | [
"https://Stackoverflow.com/questions/58518894",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4732694/"
] | I use MySql, but the logic is the same:
Query 1: Choose all ids from you table
Quear 2: Delete all this ids
As a result you have:
`Delete FROM table_name WHERE id IN (Select id FROM table_name)`
The line do not return anuthing, it just delete all rows with a special id. I recomend to do the command using psycopg o... | **You can follow the next steps!**
1. Check 'row existence' first in the table.
2. And then delete rows
**Example code**
```
check_row_query = "select exists(select * from tbl_name limit 1)"
check_exist = pd.read_sql_query(check_row_query, con)
if check_exist.exists[0]:
delete_query = 'DELETE FROM tbl_name WHERE... |
29,264,079 | I have a table `dbo.participation`:
```
ID INT NOT NULL IDENTITY(1,1) PRIMARY KEY CLUSTERED,
User VARCHAR(MAX) NOT NULL,
ParticipationLevel TINYINT NOT NULL,
Selector VARCHAR(MAX) NOT NULL,
DateCreated DATETIME NOT NULL
```
I created the code below but unfortunately it shows bad performance for `@DateStart` ... | 2015/03/25 | [
"https://Stackoverflow.com/questions/29264079",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4713425/"
] | You need an index along the following lines
```
CREATE INDEX ix
ON dbo.Participation(DateCreated)
INCLUDE (ParticipationLevel);
```
And you should rewrite the query to get rid of the `OR` and to avoid the unnecessary reference to a column defined as `NOT NULL`.
(Note a simple `COUNT(Selector)` would not look up... | Below two checks not needed in your **WHERE** clause
@DateStart IS NOT NULL AND
@DateEnd IS NOT NULL AND
```
SELECT dateadd(month, datediff(month, 0, DateCreated), 0) AS MDate
,COUNT(CASE WHEN ParticipationLevel >= 10 THEN Tracking ELSE NULL END) AS ParticipationLevel1
,COUNT(CAS... |
123,233 | It’s a fairly well known accessibility issue that italic fonts should be avoided as they reduce readability for those with sight issues and dyslexia.
(discussed here: [Are italics on the web bad for accessibility?](https://ux.stackexchange.com/questions/62742/are-italics-on-the-web-bad-for-accessibility))
However, mo... | 2019/01/18 | [
"https://ux.stackexchange.com/questions/123233",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/54194/"
] | *I think it is perfectly fine to use italics.*
The keys, in my mind, are to (a) use the proper markup and (b) use emphasis appropriately.
As far as proper markup, most (but not all...) tools for generating web pages will produce italic and bold text appropriately using tags `<i>italicized text</i>` rather than messin... | The problem with nearly all 'font readability studies' is that they use a completely arbitrary set of samples and an arbitrary sample size. [An example](http://dyslexiahelp.umich.edu/sites/default/files/good_fonts_for_dyslexia_study.pdf).
As such, what they are typically measuring is "within the confines of these 8 t... |
3,481,658 | Let $\alpha$ be an ordinal number. How can I show that every subset $x$ of $\alpha$ has either the same cardinality as $\alpha$ or there exists an cardinal number $\beta$ such that $|x|=\beta < |\alpha|$? | 2019/12/19 | [
"https://math.stackexchange.com/questions/3481658",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/678722/"
] | First prove that if $x\subseteq\alpha$, then there is an ordinal $\beta\leq\alpha$ such that $x$ is order isomorphic to $\beta$ (that is to say, $\beta$ is the order type of $x$).
Then you only need to prove that if $\beta\leq\alpha$, then the cardinality of $\beta$ is at most that of $\alpha$. This should be a fairly... | Let $\alpha^+$ denote the [Hartogs number](https://en.wikipedia.org/wiki/Hartogs_number) of $\alpha$, i.e. the least ordinal of greater cardinality than $\alpha$. This concept is well-defined for any set. The Hartogs number of any $x\subseteq\alpha$ is at most $\alpha^+$. If it's exactly $\alpha^+$, $x$ bijects with $\... |
28,385,804 | I have problems with unreliable debugging with my S5 device on one USB port. I had no similar problem with my Nexus. I can work around the problem by switching USB port, but I really want to know what is going on. One day both USB ports starts to behave this way; and then I will have no clue if I don't fix it now.
Her... | 2015/02/07 | [
"https://Stackoverflow.com/questions/28385804",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/428400/"
] | In your save path you need to set up a location folder. Use `'files'` as session driver preferred. As like below I have set up a cache to store sessions in BASE PATH which is setting folder. Make sure you have auto loaded sessions and `$config['encryption_key'] = ''` add key.
You can set up a database sessions but thi... | I use this code it work.
```
if (version_compare(PHP_VERSION, '5.4.0', '<')) {
if(session_id() == '') session_start();
} else {
if (session_status() == PHP_SESSION_NONE) session_start();
}
``` |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.