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
12,326,833
I am sorry for posting a pretty redundant question. I was wondering if it was really necessary to use `else {}` if the code just stops or returns a value. In theory, is it really necessary to put `else{}` in these scenarios? ``` function check() { if($something == "something") { exit; } echo "hello...
2012/09/08
[ "https://Stackoverflow.com/questions/12326833", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Syntactically, it's perfectly fine. It's also a very common pattern to use, and IMHO, makes code more readable. For the sake of code clarity/clean coding, if you're returning a boolean you should return a boolean even if the if() doesn't match. ``` function check() { if($something == "something") { ret...
There's no hard rule. The question of whether the else clause is used is probably dictated by indentation. If you want the code in the two blocks to line up then you put it in. If you don't then leave it out.
12,326,833
I am sorry for posting a pretty redundant question. I was wondering if it was really necessary to use `else {}` if the code just stops or returns a value. In theory, is it really necessary to put `else{}` in these scenarios? ``` function check() { if($something == "something") { exit; } echo "hello...
2012/09/08
[ "https://Stackoverflow.com/questions/12326833", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
The code you have posted is valid, for more clarity i would include else also. ``` function check() { if($something == "something") { return true; } else{ return false; } } ```
For the second scenario, if the function is supposed to return something, you don't 'need' the else, but you should at minimum return false. Personally, I don't like putting the else, because it requires the developer to read through more conditions to determine what is returned. Instead, at the bottom, put return true...
12,326,833
I am sorry for posting a pretty redundant question. I was wondering if it was really necessary to use `else {}` if the code just stops or returns a value. In theory, is it really necessary to put `else{}` in these scenarios? ``` function check() { if($something == "something") { exit; } echo "hello...
2012/09/08
[ "https://Stackoverflow.com/questions/12326833", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
The code you have posted is valid, for more clarity i would include else also. ``` function check() { if($something == "something") { return true; } else{ return false; } } ```
It's not necessary. HOWEVER, the real question is if doing so improves readability. This is debatable, and can vary from developer to developer depending on preference and coding standards.
12,326,833
I am sorry for posting a pretty redundant question. I was wondering if it was really necessary to use `else {}` if the code just stops or returns a value. In theory, is it really necessary to put `else{}` in these scenarios? ``` function check() { if($something == "something") { exit; } echo "hello...
2012/09/08
[ "https://Stackoverflow.com/questions/12326833", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
The code you have posted is valid, for more clarity i would include else also. ``` function check() { if($something == "something") { return true; } else{ return false; } } ```
There's no hard rule. The question of whether the else clause is used is probably dictated by indentation. If you want the code in the two blocks to line up then you put it in. If you don't then leave it out.
32,334,488
I’m using Git on Mac 10.9.5 and would like to pull down the latest version of what is in a branch. I don’t care about any local changes I’ve made — I’m happy to abandon all of those. Right now when I run ``` git pull origin branch-name ``` I get errors like ``` Please, commit your changes or stash them before you c...
2015/09/01
[ "https://Stackoverflow.com/questions/32334488", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1423967/" ]
You have local changes that you need to "stash" before pulling changes. One way is: ``` git stash git pull origin branch-name git stash pop ``` And now you'll be asked to merge your local changes with the changes you got from server. Note that you *don't* have to `stash pop` once you `pull`, you can simply leave t...
If you don't mind losing any changes, you can also `git checkout` the files with changes, but that could take more time depending on the amount of changes you've made, and it won't save the changes for future reference like `git stash` does.
32,334,488
I’m using Git on Mac 10.9.5 and would like to pull down the latest version of what is in a branch. I don’t care about any local changes I’ve made — I’m happy to abandon all of those. Right now when I run ``` git pull origin branch-name ``` I get errors like ``` Please, commit your changes or stash them before you c...
2015/09/01
[ "https://Stackoverflow.com/questions/32334488", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1423967/" ]
You have local changes that you need to "stash" before pulling changes. One way is: ``` git stash git pull origin branch-name git stash pop ``` And now you'll be asked to merge your local changes with the changes you got from server. Note that you *don't* have to `stash pop` once you `pull`, you can simply leave t...
[`git stash`](http://git-scm.com/docs/git-stash) is what you want to use. > > Use git stash when you want to record the current state of the working directory and the index, but want to go back to a clean working directory. The command saves your local modifications away and reverts the working directory to match the...
32,334,488
I’m using Git on Mac 10.9.5 and would like to pull down the latest version of what is in a branch. I don’t care about any local changes I’ve made — I’m happy to abandon all of those. Right now when I run ``` git pull origin branch-name ``` I get errors like ``` Please, commit your changes or stash them before you c...
2015/09/01
[ "https://Stackoverflow.com/questions/32334488", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1423967/" ]
In case you did something wrong, you can replace local changes using the command `git checkout --` this replaces the changes in your working tree with the last content in HEAD. Changes already added to the index, as well as new files, will be kept. If you instead want to drop all your local changes and commits, fe...
You have local changes that you need to "stash" before pulling changes. One way is: ``` git stash git pull origin branch-name git stash pop ``` And now you'll be asked to merge your local changes with the changes you got from server. Note that you *don't* have to `stash pop` once you `pull`, you can simply leave t...
32,334,488
I’m using Git on Mac 10.9.5 and would like to pull down the latest version of what is in a branch. I don’t care about any local changes I’ve made — I’m happy to abandon all of those. Right now when I run ``` git pull origin branch-name ``` I get errors like ``` Please, commit your changes or stash them before you c...
2015/09/01
[ "https://Stackoverflow.com/questions/32334488", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1423967/" ]
``` Git force pull to overwrite local files **git fetch --all git reset --hard origin/master git pull origin master** ```
If you don't mind losing any changes, you can also `git checkout` the files with changes, but that could take more time depending on the amount of changes you've made, and it won't save the changes for future reference like `git stash` does.
32,334,488
I’m using Git on Mac 10.9.5 and would like to pull down the latest version of what is in a branch. I don’t care about any local changes I’ve made — I’m happy to abandon all of those. Right now when I run ``` git pull origin branch-name ``` I get errors like ``` Please, commit your changes or stash them before you c...
2015/09/01
[ "https://Stackoverflow.com/questions/32334488", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1423967/" ]
In case you did something wrong, you can replace local changes using the command `git checkout --` this replaces the changes in your working tree with the last content in HEAD. Changes already added to the index, as well as new files, will be kept. If you instead want to drop all your local changes and commits, fe...
If you don't mind losing any changes, you can also `git checkout` the files with changes, but that could take more time depending on the amount of changes you've made, and it won't save the changes for future reference like `git stash` does.
32,334,488
I’m using Git on Mac 10.9.5 and would like to pull down the latest version of what is in a branch. I don’t care about any local changes I’ve made — I’m happy to abandon all of those. Right now when I run ``` git pull origin branch-name ``` I get errors like ``` Please, commit your changes or stash them before you c...
2015/09/01
[ "https://Stackoverflow.com/questions/32334488", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1423967/" ]
``` Git force pull to overwrite local files **git fetch --all git reset --hard origin/master git pull origin master** ```
[`git stash`](http://git-scm.com/docs/git-stash) is what you want to use. > > Use git stash when you want to record the current state of the working directory and the index, but want to go back to a clean working directory. The command saves your local modifications away and reverts the working directory to match the...
32,334,488
I’m using Git on Mac 10.9.5 and would like to pull down the latest version of what is in a branch. I don’t care about any local changes I’ve made — I’m happy to abandon all of those. Right now when I run ``` git pull origin branch-name ``` I get errors like ``` Please, commit your changes or stash them before you c...
2015/09/01
[ "https://Stackoverflow.com/questions/32334488", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1423967/" ]
In case you did something wrong, you can replace local changes using the command `git checkout --` this replaces the changes in your working tree with the last content in HEAD. Changes already added to the index, as well as new files, will be kept. If you instead want to drop all your local changes and commits, fe...
``` Git force pull to overwrite local files **git fetch --all git reset --hard origin/master git pull origin master** ```
32,334,488
I’m using Git on Mac 10.9.5 and would like to pull down the latest version of what is in a branch. I don’t care about any local changes I’ve made — I’m happy to abandon all of those. Right now when I run ``` git pull origin branch-name ``` I get errors like ``` Please, commit your changes or stash them before you c...
2015/09/01
[ "https://Stackoverflow.com/questions/32334488", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1423967/" ]
In case you did something wrong, you can replace local changes using the command `git checkout --` this replaces the changes in your working tree with the last content in HEAD. Changes already added to the index, as well as new files, will be kept. If you instead want to drop all your local changes and commits, fe...
[`git stash`](http://git-scm.com/docs/git-stash) is what you want to use. > > Use git stash when you want to record the current state of the working directory and the index, but want to go back to a clean working directory. The command saves your local modifications away and reverts the working directory to match the...
11,470,987
So let's say I have a website which doesn't require login but I want to be able to track the user's activity based on what they click on my website, and display data accordingly. For example, if they keep looking at children's books to buy, I would recommend similar children's books. Is this possible in javascript? The...
2012/07/13
[ "https://Stackoverflow.com/questions/11470987", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1231689/" ]
You could use HTML [local or session storage](https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API). These are both easier to use than cookies. You can also use [Mod­ern­izr](http://theburningmonk.com/2010/12/having-fun-with-html5-local-storage-and-session-storage/) for browsers that do not support HTML5.
[html5 websockets](http://net.tutsplus.com/tutorials/javascript-ajax/start-using-html5-websockets-today/) might be of help.
65,418
On the Moduli space $\overline{M}\_{g}$ of genus $g$ stable curves the *Hodge class* $\lambda$ induces a birational morphism $f$ on a projective variety contracting the boundary, that is the exceptional locus of $f$ coincides with the boundary of the moduli space. **Is there a line bundle $L$ on the moduli space of po...
2011/05/19
[ "https://mathoverflow.net/questions/65418", "https://mathoverflow.net", "https://mathoverflow.net/users/14514/" ]
A detailed description of the nef cones of the examples you mention is given in the thesis of William Rulla (The birational geometry of $\overline{M}\_3$ and $\overline{M}\_{2,1}$, The University of Texas at Austin, 2001.) From this, it follows that there are no such line bundles for the two examples that you mention. ...
The Hodge class $\lambda\_{2,1}$ on $\overline{M}\_{2,1}$ is the pull-back of the Hodge class $\lambda$ on $\overline{M}\_{2}$ via the forgetful morphism $$\pi:\overline{M}\_{2,1}\rightarrow\overline{M}\_2,$$ that is $\lambda\_{2,1} = \pi^{\*}\lambda$. **So $\lambda\_{1,2}$ is nef but not big on $\overline{M}\_{2...
38,543,618
I am using InnoDB and have the following table **officeRechNr** ``` year | month | id | ------------------------ 2016 | 7 | 2 | 2016 | 6 | 5 | 2016 | 5 | 6 | ``` My script works as follows: 1. Get *id* from **officeRechNr** from current *year* and *month* 2. Increase *id* by one an...
2016/07/23
[ "https://Stackoverflow.com/questions/38543618", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2311074/" ]
It seems like your webserver is unable to execute more than one request at a time. What this means, in practice, is that even if you open your script in two different times, the server will not execute the second request before the first one is finished. The timeline looks like this: * You open tab 1. * You open tab...
Adam, it seems that your queries are not executing in parallel. Record times at crucial events and print them to confirm this. After the first statement execute: ``` $stmt = $db->prepare('SELECT zahl ...'); ... $stmt->execute(); $times['select'] = date('H:i:s'); //human-readable format. eg: 11:15:32 ``` Then again...
38,543,618
I am using InnoDB and have the following table **officeRechNr** ``` year | month | id | ------------------------ 2016 | 7 | 2 | 2016 | 6 | 5 | 2016 | 5 | 6 | ``` My script works as follows: 1. Get *id* from **officeRechNr** from current *year* and *month* 2. Increase *id* by one an...
2016/07/23
[ "https://Stackoverflow.com/questions/38543618", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2311074/" ]
If you want locking but not full-table locking, try using `SELECT...FOR UPDATE` in a transaction to lock just the rows you select (assuming you have an index on jahr, monat). See <http://dev.mysql.com/doc/refman/5.7/en/innodb-locking-reads.html> Alternatively, you don't need locking at all. You could use ``` UPDATE ...
Adam, it seems that your queries are not executing in parallel. Record times at crucial events and print them to confirm this. After the first statement execute: ``` $stmt = $db->prepare('SELECT zahl ...'); ... $stmt->execute(); $times['select'] = date('H:i:s'); //human-readable format. eg: 11:15:32 ``` Then again...
9,359,234
I have a dictionary D of {string:list} entries, and I compute a function f( D[s1],D[s2] ) --> float for a pair of strings (s1,s2) in D. Additionally, I have created a custom matrix class LabeledNumericMatrix that allows me to perform assignments such as m[ ID1, ID2 ] = 1.0 . I need to calculate f(x,y) and store the...
2012/02/20
[ "https://Stackoverflow.com/questions/9359234", "https://Stackoverflow.com", "https://Stackoverflow.com/users/599444/" ]
First option - a *Server Process* --------------------------------- Create a *Server process*. It's part of the Multiprocessing package which allows parallel access to data structures. This way every process will access the data structure directly, locking other processes. From [the documentation](http://docs.python....
You definitely won't get any performance increase with `threading` - it is an inappropriate tool for cpu-bound tasks. So the only possible choice is `multiprocessing`, but since you have a big data structure, I'd suggest something like [`mmap`](http://docs.python.org/library/mmap.html) (pretty low level, but builtin) ...
9,359,234
I have a dictionary D of {string:list} entries, and I compute a function f( D[s1],D[s2] ) --> float for a pair of strings (s1,s2) in D. Additionally, I have created a custom matrix class LabeledNumericMatrix that allows me to perform assignments such as m[ ID1, ID2 ] = 1.0 . I need to calculate f(x,y) and store the...
2012/02/20
[ "https://Stackoverflow.com/questions/9359234", "https://Stackoverflow.com", "https://Stackoverflow.com/users/599444/" ]
First option - a *Server Process* --------------------------------- Create a *Server process*. It's part of the Multiprocessing package which allows parallel access to data structures. This way every process will access the data structure directly, locking other processes. From [the documentation](http://docs.python....
Have you profiled your code? Is it just calculating f that is too expensive, or storing the results in the data structure (or maybe both)? If f is dominant, then you should make sure you can't make algorithmic improvements before you start worrying about parallelization. You might be able to get a big speed up by turn...
9,359,234
I have a dictionary D of {string:list} entries, and I compute a function f( D[s1],D[s2] ) --> float for a pair of strings (s1,s2) in D. Additionally, I have created a custom matrix class LabeledNumericMatrix that allows me to perform assignments such as m[ ID1, ID2 ] = 1.0 . I need to calculate f(x,y) and store the...
2012/02/20
[ "https://Stackoverflow.com/questions/9359234", "https://Stackoverflow.com", "https://Stackoverflow.com/users/599444/" ]
First option - a *Server Process* --------------------------------- Create a *Server process*. It's part of the Multiprocessing package which allows parallel access to data structures. This way every process will access the data structure directly, locking other processes. From [the documentation](http://docs.python....
Thank you everyone for your responses. I have created a solution (not "the" solution) to the proposed problem, and since others may find it useful, I am posting the code here. My solution is a hybrid of options 1 and 3 suggested by Adam Matan. The code contains line numbers from my vi session, which will help in the d...
9,359,234
I have a dictionary D of {string:list} entries, and I compute a function f( D[s1],D[s2] ) --> float for a pair of strings (s1,s2) in D. Additionally, I have created a custom matrix class LabeledNumericMatrix that allows me to perform assignments such as m[ ID1, ID2 ] = 1.0 . I need to calculate f(x,y) and store the...
2012/02/20
[ "https://Stackoverflow.com/questions/9359234", "https://Stackoverflow.com", "https://Stackoverflow.com/users/599444/" ]
First option - a *Server Process* --------------------------------- Create a *Server process*. It's part of the Multiprocessing package which allows parallel access to data structures. This way every process will access the data structure directly, locking other processes. From [the documentation](http://docs.python....
In reference to my last comment attached to the code posted on March 21, I found multiprocessing.Pool + SQLite (pysqlite2) unusable for my particular task, as two problems occurred: (1) Using the default connection, except for the first worker, every other worker process that performed an insert query only executed on...
9,359,234
I have a dictionary D of {string:list} entries, and I compute a function f( D[s1],D[s2] ) --> float for a pair of strings (s1,s2) in D. Additionally, I have created a custom matrix class LabeledNumericMatrix that allows me to perform assignments such as m[ ID1, ID2 ] = 1.0 . I need to calculate f(x,y) and store the...
2012/02/20
[ "https://Stackoverflow.com/questions/9359234", "https://Stackoverflow.com", "https://Stackoverflow.com/users/599444/" ]
You definitely won't get any performance increase with `threading` - it is an inappropriate tool for cpu-bound tasks. So the only possible choice is `multiprocessing`, but since you have a big data structure, I'd suggest something like [`mmap`](http://docs.python.org/library/mmap.html) (pretty low level, but builtin) ...
Have you profiled your code? Is it just calculating f that is too expensive, or storing the results in the data structure (or maybe both)? If f is dominant, then you should make sure you can't make algorithmic improvements before you start worrying about parallelization. You might be able to get a big speed up by turn...
9,359,234
I have a dictionary D of {string:list} entries, and I compute a function f( D[s1],D[s2] ) --> float for a pair of strings (s1,s2) in D. Additionally, I have created a custom matrix class LabeledNumericMatrix that allows me to perform assignments such as m[ ID1, ID2 ] = 1.0 . I need to calculate f(x,y) and store the...
2012/02/20
[ "https://Stackoverflow.com/questions/9359234", "https://Stackoverflow.com", "https://Stackoverflow.com/users/599444/" ]
You definitely won't get any performance increase with `threading` - it is an inappropriate tool for cpu-bound tasks. So the only possible choice is `multiprocessing`, but since you have a big data structure, I'd suggest something like [`mmap`](http://docs.python.org/library/mmap.html) (pretty low level, but builtin) ...
Thank you everyone for your responses. I have created a solution (not "the" solution) to the proposed problem, and since others may find it useful, I am posting the code here. My solution is a hybrid of options 1 and 3 suggested by Adam Matan. The code contains line numbers from my vi session, which will help in the d...
9,359,234
I have a dictionary D of {string:list} entries, and I compute a function f( D[s1],D[s2] ) --> float for a pair of strings (s1,s2) in D. Additionally, I have created a custom matrix class LabeledNumericMatrix that allows me to perform assignments such as m[ ID1, ID2 ] = 1.0 . I need to calculate f(x,y) and store the...
2012/02/20
[ "https://Stackoverflow.com/questions/9359234", "https://Stackoverflow.com", "https://Stackoverflow.com/users/599444/" ]
You definitely won't get any performance increase with `threading` - it is an inappropriate tool for cpu-bound tasks. So the only possible choice is `multiprocessing`, but since you have a big data structure, I'd suggest something like [`mmap`](http://docs.python.org/library/mmap.html) (pretty low level, but builtin) ...
In reference to my last comment attached to the code posted on March 21, I found multiprocessing.Pool + SQLite (pysqlite2) unusable for my particular task, as two problems occurred: (1) Using the default connection, except for the first worker, every other worker process that performed an insert query only executed on...
9,359,234
I have a dictionary D of {string:list} entries, and I compute a function f( D[s1],D[s2] ) --> float for a pair of strings (s1,s2) in D. Additionally, I have created a custom matrix class LabeledNumericMatrix that allows me to perform assignments such as m[ ID1, ID2 ] = 1.0 . I need to calculate f(x,y) and store the...
2012/02/20
[ "https://Stackoverflow.com/questions/9359234", "https://Stackoverflow.com", "https://Stackoverflow.com/users/599444/" ]
Have you profiled your code? Is it just calculating f that is too expensive, or storing the results in the data structure (or maybe both)? If f is dominant, then you should make sure you can't make algorithmic improvements before you start worrying about parallelization. You might be able to get a big speed up by turn...
Thank you everyone for your responses. I have created a solution (not "the" solution) to the proposed problem, and since others may find it useful, I am posting the code here. My solution is a hybrid of options 1 and 3 suggested by Adam Matan. The code contains line numbers from my vi session, which will help in the d...
9,359,234
I have a dictionary D of {string:list} entries, and I compute a function f( D[s1],D[s2] ) --> float for a pair of strings (s1,s2) in D. Additionally, I have created a custom matrix class LabeledNumericMatrix that allows me to perform assignments such as m[ ID1, ID2 ] = 1.0 . I need to calculate f(x,y) and store the...
2012/02/20
[ "https://Stackoverflow.com/questions/9359234", "https://Stackoverflow.com", "https://Stackoverflow.com/users/599444/" ]
Have you profiled your code? Is it just calculating f that is too expensive, or storing the results in the data structure (or maybe both)? If f is dominant, then you should make sure you can't make algorithmic improvements before you start worrying about parallelization. You might be able to get a big speed up by turn...
In reference to my last comment attached to the code posted on March 21, I found multiprocessing.Pool + SQLite (pysqlite2) unusable for my particular task, as two problems occurred: (1) Using the default connection, except for the first worker, every other worker process that performed an insert query only executed on...
49,849,452
[![enter image description here](https://i.stack.imgur.com/aISuj.png)](https://i.stack.imgur.com/aISuj.png) I want to create add a label to the input field as shown in the attached image. How do I do this using pure HTML and CSS?
2018/04/16
[ "https://Stackoverflow.com/questions/49849452", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6878871/" ]
Try this, change according to your requirement ```css .input-group{ position:relative;width:100%;overflow:hidden; } .input-group input{position:relative;height:45px;border-radius:30px;min-width:500px;box-shadow:none;border:1px solid #eaeaea;padding-left:160px;} .input-group label{position:absolute;left:0;height:48...
Maybe this will help! ```css * { margin: 0; padding: 0; } input { padding: 10px 10px 10px 30px; width: 200px; border: solid 1px lightgray; border-radius: 20px; } label { background-color: lightblue; padding: 9px; border-radius: 20px; color: white; margin-right: -30px; z-index:...
8,741,282
I have a given list that represent a two dimensional list x. This table contains two "spots" of 1 as you can see in the example below: ``` xxxxxxxxxxxxxxxx xx1111xxxx111xxx xxx1111xxxx11xxx x1111xxxxxx111xx ``` I need to change ONLY the second spot from 1 to 2 like the example below: ``` xxxxxxxxxxxxxxxx xx1111xxxx...
2012/01/05
[ "https://Stackoverflow.com/questions/8741282", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1118501/" ]
You could use Definite Clause Grammars (DCG) to implement a finite state transducer. Although DCGs don't deliver much compositional operations on the production side, they are quite good in implementing the recognition side. So what you want to recognize is two different types of runs of 1's. So basically I guess an ...
We can apply ad hoc transliteration (just for 'horizontal' lists): ``` transliteration(Matrix, Translit) :- maplist(transliteration(not_seen), Matrix, Translit). transliteration(_State, [], []). transliteration(State, [X|Xs], [Y|Ys]) :- transliteration(State, X, NewState, Y), transliteration(NewState, Xs, Ys). ...
8,741,282
I have a given list that represent a two dimensional list x. This table contains two "spots" of 1 as you can see in the example below: ``` xxxxxxxxxxxxxxxx xx1111xxxx111xxx xxx1111xxxx11xxx x1111xxxxxx111xx ``` I need to change ONLY the second spot from 1 to 2 like the example below: ``` xxxxxxxxxxxxxxxx xx1111xxxx...
2012/01/05
[ "https://Stackoverflow.com/questions/8741282", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1118501/" ]
You could use Definite Clause Grammars (DCG) to implement a finite state transducer. Although DCGs don't deliver much compositional operations on the production side, they are quite good in implementing the recognition side. So what you want to recognize is two different types of runs of 1's. So basically I guess an ...
Similar to solution suggested by @chac, but more direct. ``` walk(L, R) :- walk(s0, L, R). walk(_, [], []). % finish walk(s0, [0'1|T], [0'1|R]) :- walk(s1, T, R). walk(s1, [0'x|T], [0'x|R]) :- walk(s2, T, R). walk(s2, [0'1|T], [0'2|R]) :- walk(s2, T, R). walk(S, [H|T], [H|R]) :- walk(S, T, R). % keep state and do noth...
8,741,282
I have a given list that represent a two dimensional list x. This table contains two "spots" of 1 as you can see in the example below: ``` xxxxxxxxxxxxxxxx xx1111xxxx111xxx xxx1111xxxx11xxx x1111xxxxxx111xx ``` I need to change ONLY the second spot from 1 to 2 like the example below: ``` xxxxxxxxxxxxxxxx xx1111xxxx...
2012/01/05
[ "https://Stackoverflow.com/questions/8741282", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1118501/" ]
We can apply ad hoc transliteration (just for 'horizontal' lists): ``` transliteration(Matrix, Translit) :- maplist(transliteration(not_seen), Matrix, Translit). transliteration(_State, [], []). transliteration(State, [X|Xs], [Y|Ys]) :- transliteration(State, X, NewState, Y), transliteration(NewState, Xs, Ys). ...
Similar to solution suggested by @chac, but more direct. ``` walk(L, R) :- walk(s0, L, R). walk(_, [], []). % finish walk(s0, [0'1|T], [0'1|R]) :- walk(s1, T, R). walk(s1, [0'x|T], [0'x|R]) :- walk(s2, T, R). walk(s2, [0'1|T], [0'2|R]) :- walk(s2, T, R). walk(S, [H|T], [H|R]) :- walk(S, T, R). % keep state and do noth...
45,791,286
I have a server with Linux Mint OS which has a server-side Maven project that reads some environmental variables. The environmental variables are declared in /etc/profile.d/my\_env\_vars.sh with: ``` export MY_VAR=/opt/my_app export PATH=$MY_VAR:$PATH ``` My server side has a function that when I run it from ecli...
2017/08/21
[ "https://Stackoverflow.com/questions/45791286", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2698832/" ]
> > [Package time](https://golang.org/pkg/time/) > > > Monotonic Clocks > > > Operating systems provide both a “wall clock,” which is subject to > changes for clock synchronization, and a “monotonic clock,” which is > not. The general rule is that the wall clock is for telling time and > the monotonic clock is ...
This is available in Go 1.9 (August 2017) with monotonic clocks, you won't have to do anything special to benefit from it: <https://tip.golang.org/pkg/time/#hdr-Monotonic_Clocks> > > Operating systems provide both a “wall clock,” which is subject to > changes for clock synchronization, and a “monotonic clock,” whic...
45,791,286
I have a server with Linux Mint OS which has a server-side Maven project that reads some environmental variables. The environmental variables are declared in /etc/profile.d/my\_env\_vars.sh with: ``` export MY_VAR=/opt/my_app export PATH=$MY_VAR:$PATH ``` My server side has a function that when I run it from ecli...
2017/08/21
[ "https://Stackoverflow.com/questions/45791286", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2698832/" ]
> > [Package time](https://golang.org/pkg/time/) > > > Monotonic Clocks > > > Operating systems provide both a “wall clock,” which is subject to > changes for clock synchronization, and a “monotonic clock,” which is > not. The general rule is that the wall clock is for telling time and > the monotonic clock is ...
For Go 1.8 and before, the correct timing function is not inside the time package, but instead in the [runtime package](https://golang.org/pkg/runtime/?m=all#nanotime): ``` func nanotime() int64 ``` In order to correctly measure execution time, the following procedure should be used: ``` var startTime = runtime.na...
37,023,524
I can't use the `ldap_connect` function but I checked in php.ini and it's in. I didn't find this error on Internet. Everyone is having "Call to undefined function" but I got "Attempted" and can't figure why. I checked with `function_exists('ldap_connect')` and it was false. I use Symfony2, apache and PHP 5.5.9. I c...
2016/05/04
[ "https://Stackoverflow.com/questions/37023524", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6223960/" ]
I think I find the answer. It was an apache2 issue. I went in `/etc/apache2/mods-available` to check if `ldap.conf` and `ldap.load` were in, and they were. Then I checked in `/etc/apache2/mods-enabled` in which they were not. And that's the problem. So I ran the following command : `sudo a2enmod ldap` in order to act...
You need to enable `ldap` extension to php. To do that (paths are from Ubuntu) add symbolic link `/etc/php5/apache2/conf.d` ``` lrwxrwxrwx 1 root root 31 Sep 23 2014 20-ldap.ini -> ../../mods-available/ldap.ini ``` (similar to `/etc/php5/cli/conf.d` if you want to have this available in `cli`) Check [doc](http:...
15,771,815
Working in Java, I'm looking at a way to loop over a range of indices, based on a set number of entries that are needed per page. The use for this is to return specific elements that are on a specific page. For instance, there are five elements per page, and I want all of the elements on page 5. If the starting index ...
2013/04/02
[ "https://Stackoverflow.com/questions/15771815", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1340219/" ]
Just do a little math in your code. The product of the elements per page and the page number is the last index you want. Then the start index is one past the ending index of the page before it. ``` int start = (page - 1) * (elementsPerPage) + 1; int end = page * elementsPerPage; for (int i = start; i <= end; i++) { ...
Do you mean something like: ``` for(int i = pageNumber*5-4; i <= pageNumber*5; i++) { //access indices with i here } ```
32,715,238
I have a magento shop with over 3000 products and 1000 categories. ``` Category I Category 1 Category 2 Category II Category 3 Category 4 ``` My problem is that all the products are only in the deepest categories. For example: A product in Category 3 also has to be in Category II, but it's no...
2015/09/22
[ "https://Stackoverflow.com/questions/32715238", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5014042/" ]
``` private Fragment getVisibleFragment() { FragmentManager fragmentManager = MainActivity.this.getSupportFragmentManager(); List<Fragment> fragments = fragmentManager.getFragments(); for (Fragment fragment : fragments) { if (fragment != null && fragment.isVisible()) ...
``` public boolean checkFragmentAvailableOrNot1(String fragmentName) { Fragment fragment=getSupportFragmentManager().findFragmentByTag(fragmentName); if (fragment instanceof FragMercado && fragment.isVisible()) { return true; } return false; } ```
32,715,238
I have a magento shop with over 3000 products and 1000 categories. ``` Category I Category 1 Category 2 Category II Category 3 Category 4 ``` My problem is that all the products are only in the deepest categories. For example: A product in Category 3 also has to be in Category II, but it's no...
2015/09/22
[ "https://Stackoverflow.com/questions/32715238", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5014042/" ]
``` private Fragment getVisibleFragment() { FragmentManager fragmentManager = MainActivity.this.getSupportFragmentManager(); List<Fragment> fragments = fragmentManager.getFragments(); for (Fragment fragment : fragments) { if (fragment != null && fragment.isVisible()) ...
``` android.support.v4.app.Fragment getCurrentFragment() { Fragment currentFragment = getActivity().getSupportFragmentManager() .findFragmentById(R.id.frameLayout); return currentFragment; } ```
32,715,238
I have a magento shop with over 3000 products and 1000 categories. ``` Category I Category 1 Category 2 Category II Category 3 Category 4 ``` My problem is that all the products are only in the deepest categories. For example: A product in Category 3 also has to be in Category II, but it's no...
2015/09/22
[ "https://Stackoverflow.com/questions/32715238", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5014042/" ]
``` Fragment getCurrentFragment() { Fragment currentFragment = getSupportFragmentManager() .findFragmentById(R.id.content_frame); return currentFragment; } ``` calling function like this ``` Fragment visibleFragment=getCurrentFragment(); ``` calling this function you can get current visible fra...
``` public boolean checkFragmentAvailableOrNot1(String fragmentName) { Fragment fragment=getSupportFragmentManager().findFragmentByTag(fragmentName); if (fragment instanceof FragMercado && fragment.isVisible()) { return true; } return false; } ```
32,715,238
I have a magento shop with over 3000 products and 1000 categories. ``` Category I Category 1 Category 2 Category II Category 3 Category 4 ``` My problem is that all the products are only in the deepest categories. For example: A product in Category 3 also has to be in Category II, but it's no...
2015/09/22
[ "https://Stackoverflow.com/questions/32715238", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5014042/" ]
``` android.support.v4.app.Fragment getCurrentFragment() { Fragment currentFragment = getActivity().getSupportFragmentManager() .findFragmentById(R.id.frameLayout); return currentFragment; } ```
``` public boolean checkFragmentAvailableOrNot1(String fragmentName) { Fragment fragment=getSupportFragmentManager().findFragmentByTag(fragmentName); if (fragment instanceof FragMercado && fragment.isVisible()) { return true; } return false; } ```
32,715,238
I have a magento shop with over 3000 products and 1000 categories. ``` Category I Category 1 Category 2 Category II Category 3 Category 4 ``` My problem is that all the products are only in the deepest categories. For example: A product in Category 3 also has to be in Category II, but it's no...
2015/09/22
[ "https://Stackoverflow.com/questions/32715238", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5014042/" ]
``` Fragment getCurrentFragment() { Fragment currentFragment = getSupportFragmentManager() .findFragmentById(R.id.content_frame); return currentFragment; } ``` calling function like this ``` Fragment visibleFragment=getCurrentFragment(); ``` calling this function you can get current visible fra...
``` android.support.v4.app.Fragment getCurrentFragment() { Fragment currentFragment = getActivity().getSupportFragmentManager() .findFragmentById(R.id.frameLayout); return currentFragment; } ```
269,081
I have a client whose ISP recently switched their circuit and static IP to an IP that was already blacklisted for SPAM (nice). The client is running Windows SBS 2003 with Exchange 2003 and DNS for the mail system is managed by GoDaddy.com. When I ran the smtp test at <http://mxtoolbox.com> (MXTB) I was receiving a wa...
2011/05/12
[ "https://serverfault.com/questions/269081", "https://serverfault.com", "https://serverfault.com/users/81262/" ]
A couple of things I would recommend. In my opinion this may be the easiest way to set things up without getting in to a lot of unneccessary details. For more info than I'm providing, follow the link that SmallClanger posted in his answer. 1. You don't need to set the masquerade domain but you should set the FQDN on t...
Often it just takes time for blocklists to drop IPs from their lists. Depending on their implementation it could be 24 hours, or it could be a month. Each list's own FAQ should tell you how long. They often have a removal request system you can go through if the delay is going to be too long. (Some will even charge for...
269,081
I have a client whose ISP recently switched their circuit and static IP to an IP that was already blacklisted for SPAM (nice). The client is running Windows SBS 2003 with Exchange 2003 and DNS for the mail system is managed by GoDaddy.com. When I ran the smtp test at <http://mxtoolbox.com> (MXTB) I was receiving a wa...
2011/05/12
[ "https://serverfault.com/questions/269081", "https://serverfault.com", "https://serverfault.com/users/81262/" ]
Sorry if i haven't read your post carefully enough, but you realize the reverse record is 'owned' by your ISP? You say you changed some record at GoDaddy... just wondering if you're getting your forward and reverse records confused. If so, contact your ISP and have them set *their* DNS for the IP to *your* FQDN What i...
Often it just takes time for blocklists to drop IPs from their lists. Depending on their implementation it could be 24 hours, or it could be a month. Each list's own FAQ should tell you how long. They often have a removal request system you can go through if the delay is going to be too long. (Some will even charge for...
73,122,537
Consider that, I have the following values in a table. | Name | Contact Number | Location | | --- | --- | --- | | ABC | 123 | L1 | | XYZ | 456 | L2 | Now, the following set of insert should work ```none ABC, 123, L2 ABC, 456, L3 ABC, 789, L1 MNO, 567, L5 ``` But, following set should not insert. ```none ABC, 123,...
2022/07/26
[ "https://Stackoverflow.com/questions/73122537", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2902476/" ]
Since you confirmed that you want the concatenation to be unique, a trivial unique constraint like this will not work: ```sql alter table MyTable add constraint MyUniqueConstraintName unique ([Name], [Contact Number], [Location]); ``` Because that would allow the following insert, contrary to your requirement: ```...
You can use the `EXCEPT` operator: ``` INSERT INTO dbo.MyTable (Name,[Contact Number],[Location]) SELECT Name,[Contact Number],[Location] FROM ( VALUES ('ABC','123','L1') ) as xyz(Name,[Contact Number],[Location]) EXCEPT SELECT Name,[Contact Number],[Location] FROM dbo.MyTable; ```
21,594,912
I need a regex statement that will check for three capital letters in a row. For example, it should match: ABC, aABC, abcABC But it should not match: AaBbBc, ABCDE At the moment this is my statement: ``` '[^A-Z]*[A-Z]{3}[^A-Z]*' ``` But this matches ABCDE. What am I doing wrong?
2014/02/06
[ "https://Stackoverflow.com/questions/21594912", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2724144/" ]
Regex ----- ``` (?<![A-Z])[A-Z]{3}(?![A-Z]) ``` Explanation ----------- I specified a *negative lookbehind* and a *negative lookahead* before and after the middle regex for three capitals in a row, respectively. This is a better option compared to using a negated character class because it will successfully match ...
You can use this: ``` '^(?:.*[^A-Z])?[A-Z]{3}(?:[^A-Z].*)?$' ``` Explanation: * `^`,`$` to match start and end of line. * `(?:.*[^A-Z])?` to check that the previous character is not capital (if any).
21,594,912
I need a regex statement that will check for three capital letters in a row. For example, it should match: ABC, aABC, abcABC But it should not match: AaBbBc, ABCDE At the moment this is my statement: ``` '[^A-Z]*[A-Z]{3}[^A-Z]*' ``` But this matches ABCDE. What am I doing wrong?
2014/02/06
[ "https://Stackoverflow.com/questions/21594912", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2724144/" ]
Regex ----- ``` (?<![A-Z])[A-Z]{3}(?![A-Z]) ``` Explanation ----------- I specified a *negative lookbehind* and a *negative lookahead* before and after the middle regex for three capitals in a row, respectively. This is a better option compared to using a negated character class because it will successfully match ...
In your regular expression, the `[^A-Z]*` at the beginning and end is saying *"Look for any number of non-capital letters, including 0."* And so, `ABCDE` will satisfy your regular expression. For example, `A` can be seen as "0 non-capital letters" followed by `BCD` followed by `E`, which is also "0 non-capital letters....
21,594,912
I need a regex statement that will check for three capital letters in a row. For example, it should match: ABC, aABC, abcABC But it should not match: AaBbBc, ABCDE At the moment this is my statement: ``` '[^A-Z]*[A-Z]{3}[^A-Z]*' ``` But this matches ABCDE. What am I doing wrong?
2014/02/06
[ "https://Stackoverflow.com/questions/21594912", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2724144/" ]
Regex ----- ``` (?<![A-Z])[A-Z]{3}(?![A-Z]) ``` Explanation ----------- I specified a *negative lookbehind* and a *negative lookahead* before and after the middle regex for three capitals in a row, respectively. This is a better option compared to using a negated character class because it will successfully match ...
Your regex has all explanation that what you are doing wrong ``` '[^A-Z]*[A-Z]{3}[^A-Z]*' ``` If ^ is used inside character set i.e [] which means ignore, so your regex would ignore if it starts A-Z (capital letters) either one or more at the starting. But as per your example, I think you don't want that [A-Z]{3} m...
21,594,912
I need a regex statement that will check for three capital letters in a row. For example, it should match: ABC, aABC, abcABC But it should not match: AaBbBc, ABCDE At the moment this is my statement: ``` '[^A-Z]*[A-Z]{3}[^A-Z]*' ``` But this matches ABCDE. What am I doing wrong?
2014/02/06
[ "https://Stackoverflow.com/questions/21594912", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2724144/" ]
Regex ----- ``` (?<![A-Z])[A-Z]{3}(?![A-Z]) ``` Explanation ----------- I specified a *negative lookbehind* and a *negative lookahead* before and after the middle regex for three capitals in a row, respectively. This is a better option compared to using a negated character class because it will successfully match ...
You have to keep in mind that when you're using regexes, *they will try as much as they can to get a match* (that is also one of the biggest weakness of regex and this is what often causes [catastrophic backtracking](http://www.regular-expressions.info/catastrophic.html)). What this implies is that in your current rege...
21,594,912
I need a regex statement that will check for three capital letters in a row. For example, it should match: ABC, aABC, abcABC But it should not match: AaBbBc, ABCDE At the moment this is my statement: ``` '[^A-Z]*[A-Z]{3}[^A-Z]*' ``` But this matches ABCDE. What am I doing wrong?
2014/02/06
[ "https://Stackoverflow.com/questions/21594912", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2724144/" ]
In your regular expression, the `[^A-Z]*` at the beginning and end is saying *"Look for any number of non-capital letters, including 0."* And so, `ABCDE` will satisfy your regular expression. For example, `A` can be seen as "0 non-capital letters" followed by `BCD` followed by `E`, which is also "0 non-capital letters....
You can use this: ``` '^(?:.*[^A-Z])?[A-Z]{3}(?:[^A-Z].*)?$' ``` Explanation: * `^`,`$` to match start and end of line. * `(?:.*[^A-Z])?` to check that the previous character is not capital (if any).
21,594,912
I need a regex statement that will check for three capital letters in a row. For example, it should match: ABC, aABC, abcABC But it should not match: AaBbBc, ABCDE At the moment this is my statement: ``` '[^A-Z]*[A-Z]{3}[^A-Z]*' ``` But this matches ABCDE. What am I doing wrong?
2014/02/06
[ "https://Stackoverflow.com/questions/21594912", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2724144/" ]
You have to keep in mind that when you're using regexes, *they will try as much as they can to get a match* (that is also one of the biggest weakness of regex and this is what often causes [catastrophic backtracking](http://www.regular-expressions.info/catastrophic.html)). What this implies is that in your current rege...
You can use this: ``` '^(?:.*[^A-Z])?[A-Z]{3}(?:[^A-Z].*)?$' ``` Explanation: * `^`,`$` to match start and end of line. * `(?:.*[^A-Z])?` to check that the previous character is not capital (if any).
21,594,912
I need a regex statement that will check for three capital letters in a row. For example, it should match: ABC, aABC, abcABC But it should not match: AaBbBc, ABCDE At the moment this is my statement: ``` '[^A-Z]*[A-Z]{3}[^A-Z]*' ``` But this matches ABCDE. What am I doing wrong?
2014/02/06
[ "https://Stackoverflow.com/questions/21594912", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2724144/" ]
In your regular expression, the `[^A-Z]*` at the beginning and end is saying *"Look for any number of non-capital letters, including 0."* And so, `ABCDE` will satisfy your regular expression. For example, `A` can be seen as "0 non-capital letters" followed by `BCD` followed by `E`, which is also "0 non-capital letters....
Your regex has all explanation that what you are doing wrong ``` '[^A-Z]*[A-Z]{3}[^A-Z]*' ``` If ^ is used inside character set i.e [] which means ignore, so your regex would ignore if it starts A-Z (capital letters) either one or more at the starting. But as per your example, I think you don't want that [A-Z]{3} m...
21,594,912
I need a regex statement that will check for three capital letters in a row. For example, it should match: ABC, aABC, abcABC But it should not match: AaBbBc, ABCDE At the moment this is my statement: ``` '[^A-Z]*[A-Z]{3}[^A-Z]*' ``` But this matches ABCDE. What am I doing wrong?
2014/02/06
[ "https://Stackoverflow.com/questions/21594912", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2724144/" ]
You have to keep in mind that when you're using regexes, *they will try as much as they can to get a match* (that is also one of the biggest weakness of regex and this is what often causes [catastrophic backtracking](http://www.regular-expressions.info/catastrophic.html)). What this implies is that in your current rege...
Your regex has all explanation that what you are doing wrong ``` '[^A-Z]*[A-Z]{3}[^A-Z]*' ``` If ^ is used inside character set i.e [] which means ignore, so your regex would ignore if it starts A-Z (capital letters) either one or more at the starting. But as per your example, I think you don't want that [A-Z]{3} m...
2,186,486
I am using a framework called qcodo (which forked as qcubed) and is a PHP framework. I want to do a very simple popup using the Facebox jquery plugin. When someone clicks on the link and shown below in line 47. Here is the file: <http://github.com/allyforce/AF-upload/blob/master/Templates/profile_activity.tpl.php> ...
2010/02/02
[ "https://Stackoverflow.com/questions/2186486", "https://Stackoverflow.com", "https://Stackoverflow.com/users/92679/" ]
This is built into Delphi's memory manager ([FastMM](http://edn.embarcadero.com/article/33416)). Set `ReportMemoryLeaksOnShutdown` true. You can also use the "full debug" version of the memory manager for [more detailed checks and information](http://wiert.wordpress.com/2009/07/29/delphi-fastmm-using-fastmm4-for-debugg...
AQTime from [Automated QA](http://www.automatedqa.com/products/aqtime/) is pretty much the defacto standard tool in the Delphi World for profiling for memory leaks (and perf of course) Another option is a static analysys tool, the only one I know of that supports Delphi is Understand from [SciTools](http://www.scitool...
2,186,486
I am using a framework called qcodo (which forked as qcubed) and is a PHP framework. I want to do a very simple popup using the Facebox jquery plugin. When someone clicks on the link and shown below in line 47. Here is the file: <http://github.com/allyforce/AF-upload/blob/master/Templates/profile_activity.tpl.php> ...
2010/02/02
[ "https://Stackoverflow.com/questions/2186486", "https://Stackoverflow.com", "https://Stackoverflow.com/users/92679/" ]
This is built into Delphi's memory manager ([FastMM](http://edn.embarcadero.com/article/33416)). Set `ReportMemoryLeaksOnShutdown` true. You can also use the "full debug" version of the memory manager for [more detailed checks and information](http://wiert.wordpress.com/2009/07/29/delphi-fastmm-using-fastmm4-for-debugg...
The Pascal Analyzer from [Peganza](http://www.peganza.com) does a static analysis of your code.
2,186,486
I am using a framework called qcodo (which forked as qcubed) and is a PHP framework. I want to do a very simple popup using the Facebox jquery plugin. When someone clicks on the link and shown below in line 47. Here is the file: <http://github.com/allyforce/AF-upload/blob/master/Templates/profile_activity.tpl.php> ...
2010/02/02
[ "https://Stackoverflow.com/questions/2186486", "https://Stackoverflow.com", "https://Stackoverflow.com/users/92679/" ]
This is built into Delphi's memory manager ([FastMM](http://edn.embarcadero.com/article/33416)). Set `ReportMemoryLeaksOnShutdown` true. You can also use the "full debug" version of the memory manager for [more detailed checks and information](http://wiert.wordpress.com/2009/07/29/delphi-fastmm-using-fastmm4-for-debugg...
Simplest tool I've ever used for memory leak checking is MemCheck. <http://v.mahon.free.fr/pro/freeware/memcheck/>
2,186,486
I am using a framework called qcodo (which forked as qcubed) and is a PHP framework. I want to do a very simple popup using the Facebox jquery plugin. When someone clicks on the link and shown below in line 47. Here is the file: <http://github.com/allyforce/AF-upload/blob/master/Templates/profile_activity.tpl.php> ...
2010/02/02
[ "https://Stackoverflow.com/questions/2186486", "https://Stackoverflow.com", "https://Stackoverflow.com/users/92679/" ]
The Pascal Analyzer from [Peganza](http://www.peganza.com) does a static analysis of your code.
AQTime from [Automated QA](http://www.automatedqa.com/products/aqtime/) is pretty much the defacto standard tool in the Delphi World for profiling for memory leaks (and perf of course) Another option is a static analysys tool, the only one I know of that supports Delphi is Understand from [SciTools](http://www.scitool...
2,186,486
I am using a framework called qcodo (which forked as qcubed) and is a PHP framework. I want to do a very simple popup using the Facebox jquery plugin. When someone clicks on the link and shown below in line 47. Here is the file: <http://github.com/allyforce/AF-upload/blob/master/Templates/profile_activity.tpl.php> ...
2010/02/02
[ "https://Stackoverflow.com/questions/2186486", "https://Stackoverflow.com", "https://Stackoverflow.com/users/92679/" ]
The Pascal Analyzer from [Peganza](http://www.peganza.com) does a static analysis of your code.
Simplest tool I've ever used for memory leak checking is MemCheck. <http://v.mahon.free.fr/pro/freeware/memcheck/>
3,018,549
So maybe someone can point me in the right direction of what is causing this error? I've been fighting with this for a couple of hours and searching the web, and I can't figure out what I'm doing wrong here. It's included as part of a stored procedure, I don't know if that matters, if it does I can include that as well...
2010/06/10
[ "https://Stackoverflow.com/questions/3018549", "https://Stackoverflow.com", "https://Stackoverflow.com/users/323371/" ]
I'm pretty sure the other answers leave out a case: ``` WHERE (Table.Field = stuff) AND (Table.Field2 = otherstuff) AND (Table2.Field3 = someotherstuff) AND ( (@param1 = 0 and Table.Field IS NULL) OR (@param1 = 1 and NOT Table.Field2 IS NULL) OR (@param1 <> 0 AND @param1 <> 1) -- isn't this needed...
You are returning a string from your case expression, but only a boolean can be used. The string is not evaluated. You could do what you want using dynamic SQL, or you could write it like this instead: ``` AND ( (@param1 = 0 AND Table.Field IS NULL) OR (@param1 = 1 AND Table.Field IS NOT NULL) ) ```
3,018,549
So maybe someone can point me in the right direction of what is causing this error? I've been fighting with this for a couple of hours and searching the web, and I can't figure out what I'm doing wrong here. It's included as part of a stored procedure, I don't know if that matters, if it does I can include that as well...
2010/06/10
[ "https://Stackoverflow.com/questions/3018549", "https://Stackoverflow.com", "https://Stackoverflow.com/users/323371/" ]
I'm pretty sure the other answers leave out a case: ``` WHERE (Table.Field = stuff) AND (Table.Field2 = otherstuff) AND (Table2.Field3 = someotherstuff) AND ( (@param1 = 0 and Table.Field IS NULL) OR (@param1 = 1 and NOT Table.Field2 IS NULL) OR (@param1 <> 0 AND @param1 <> 1) -- isn't this needed...
1. You can't use CASE in the WHERE clause like you are attempting 2. The text you provided in the CASE would only run if you were using dynamic SQL Use: ``` WHERE Table.Field = stuff AND Table.Field2 = otherstuff AND Table2.Field3 = someotherstuff AND ( (@param1 = 0 AND table.field IS NULL) OR (@param1...
5,296,081
Say I need to populate 4 or 5 dropdowns w/ items from a database. Each drop down will have < 15 items in it. These items almost never change. Now I could query the DB each time the page is accessed or I could grab the values from a custom class that would check to see if they already exist in ASP.Net's cache and only ...
2011/03/14
[ "https://Stackoverflow.com/questions/5296081", "https://Stackoverflow.com", "https://Stackoverflow.com/users/169867/" ]
When dealing with performance issues you should always: 1. Do things the **simplest** way first (avoid premature optimisation) 2. Performance test your code with **set performance goals** (e.g. 200ms response time under load of N concurent users) 3. Then, **IF** your code doesn't perform then profile your code to dete...
That's what [System.Web.Helpers.WebCache](http://msdn.microsoft.com/en-us/library/system.web.helpers.webcache.aspx) class exists for.
5,296,081
Say I need to populate 4 or 5 dropdowns w/ items from a database. Each drop down will have < 15 items in it. These items almost never change. Now I could query the DB each time the page is accessed or I could grab the values from a custom class that would check to see if they already exist in ASP.Net's cache and only ...
2011/03/14
[ "https://Stackoverflow.com/questions/5296081", "https://Stackoverflow.com", "https://Stackoverflow.com/users/169867/" ]
When dealing with performance issues you should always: 1. Do things the **simplest** way first (avoid premature optimisation) 2. Performance test your code with **set performance goals** (e.g. 200ms response time under load of N concurent users) 3. Then, **IF** your code doesn't perform then profile your code to dete...
IO is usually more expensive than memory operations (by orders of magnitude). Especially if your database is in another machine, then you would even be using network resources, and it will definitely be faster to just use the cache. But indeed, optimize in the end when you have really identified it as a performance b...
5,296,081
Say I need to populate 4 or 5 dropdowns w/ items from a database. Each drop down will have < 15 items in it. These items almost never change. Now I could query the DB each time the page is accessed or I could grab the values from a custom class that would check to see if they already exist in ASP.Net's cache and only ...
2011/03/14
[ "https://Stackoverflow.com/questions/5296081", "https://Stackoverflow.com", "https://Stackoverflow.com/users/169867/" ]
When dealing with performance issues you should always: 1. Do things the **simplest** way first (avoid premature optimisation) 2. Performance test your code with **set performance goals** (e.g. 200ms response time under load of N concurent users) 3. Then, **IF** your code doesn't perform then profile your code to dete...
Quick answer to your question: 1. **Use the built in .Net cache.** Additional points to ponder over.. 1. Preferably, retrieve all master data in a single database retrieval (think stored procedure and dataset): though, I do not advocate the used of stored procs in **all** scenarios. 2. As you rightly said, ensure th...
31,274,384
I want to split a string when space is followed by comma. My input String : ``` go back, to work ! ,2012-10-01 07:01:45,, 1 ``` Output Expected: ``` "go back, to work !" "2012-10-01 07:01:45,,1" ``` Code I tried: ``` String[] b1=a1.split("[\\s,]"); ``` But this splits the string only based on whitespac...
2015/07/07
[ "https://Stackoverflow.com/questions/31274384", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5018910/" ]
Split on **space followed by comma**: ``` String[] b1 = a1.split("\\s,"); ``` `[\\s,]` is a character class and it will split on space or comma.
Split on space followed by comma using `("\\s,")` will not give you the desired output of ``` "go back, to work !" "2012-10-01 07:01:45" 1 ``` The output will be ``` go back, to work ! 2012-10-01 07:01:45,, 1 ``` Either you can use comma followed by space or space followed by comma using `"\\s,|,\\s"` then y...
31,274,384
I want to split a string when space is followed by comma. My input String : ``` go back, to work ! ,2012-10-01 07:01:45,, 1 ``` Output Expected: ``` "go back, to work !" "2012-10-01 07:01:45,,1" ``` Code I tried: ``` String[] b1=a1.split("[\\s,]"); ``` But this splits the string only based on whitespac...
2015/07/07
[ "https://Stackoverflow.com/questions/31274384", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5018910/" ]
Split on **space followed by comma**: ``` String[] b1 = a1.split("\\s,"); ``` `[\\s,]` is a character class and it will split on space or comma.
Use this to split a string when a white space, then comma occurs. ``` String[] b1 = a1.split(" ,"); ```
31,274,384
I want to split a string when space is followed by comma. My input String : ``` go back, to work ! ,2012-10-01 07:01:45,, 1 ``` Output Expected: ``` "go back, to work !" "2012-10-01 07:01:45,,1" ``` Code I tried: ``` String[] b1=a1.split("[\\s,]"); ``` But this splits the string only based on whitespac...
2015/07/07
[ "https://Stackoverflow.com/questions/31274384", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5018910/" ]
Use this to split a string when a white space, then comma occurs. ``` String[] b1 = a1.split(" ,"); ```
Split on space followed by comma using `("\\s,")` will not give you the desired output of ``` "go back, to work !" "2012-10-01 07:01:45" 1 ``` The output will be ``` go back, to work ! 2012-10-01 07:01:45,, 1 ``` Either you can use comma followed by space or space followed by comma using `"\\s,|,\\s"` then y...
69,060,895
I apologise for asking the very basic question as I am beginner in Scripting. i was wondering why i am getting different result from two different source with the same formatting. Below are my sample file1.txt ``` Id Name Members 122 RCP_VMWARE-DMZ-NONPROD DMZ_NPROD01_11...
2021/09/05
[ "https://Stackoverflow.com/questions/69060895", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6544709/" ]
This happens because the latter file has different format. When examined carefully, one notices there are two spaces between `4` and `HPUX_PROD` strings: ``` Id Name Members 4 HPUX_PROD HPUX_PROD.3 ^^^^ ``` On the first file, there is a single space between number and string: ``` Id Name ...
Since this sort-of looks like csv output with spaces as delimiter (but not quite), I think you could use `ConvertFrom-Csv` on this: ``` # read the file as string array, trim each line and filter only the lines that # when split on 1 or more whitespace characters has more than one field # then replace the spaces by a c...
69,060,895
I apologise for asking the very basic question as I am beginner in Scripting. i was wondering why i am getting different result from two different source with the same formatting. Below are my sample file1.txt ``` Id Name Members 122 RCP_VMWARE-DMZ-NONPROD DMZ_NPROD01_11...
2021/09/05
[ "https://Stackoverflow.com/questions/69060895", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6544709/" ]
The existing answers are helpful, but let me try to break it down conceptually: * **`.Split(" ")` splits the input string by *each individual* space character**, whereas what you're looking for is to split by *runs* of (one or more) spaces, given that your column values can be separated by more than one space. + For...
Since this sort-of looks like csv output with spaces as delimiter (but not quite), I think you could use `ConvertFrom-Csv` on this: ``` # read the file as string array, trim each line and filter only the lines that # when split on 1 or more whitespace characters has more than one field # then replace the spaces by a c...
928,203
I'm trying to iterate over an unknown number of query values in C#... and can't find anything unrelated to LINQ, which I can't use. Anyone have any ideas?
2009/05/29
[ "https://Stackoverflow.com/questions/928203", "https://Stackoverflow.com", "https://Stackoverflow.com/users/112785/" ]
If this question is about getting a querystring in ASP.NET, I think the link you are searching for is: <http://msdn.microsoft.com/en-us/library/system.web.httprequest.querystring.aspx> Essentially, `Request.QueryString` gives you a collection that you can then iterate over.
If the collection implements IEnumerable you can use a foreach, otherwise use a for loop with the .Length of the collection.
928,203
I'm trying to iterate over an unknown number of query values in C#... and can't find anything unrelated to LINQ, which I can't use. Anyone have any ideas?
2009/05/29
[ "https://Stackoverflow.com/questions/928203", "https://Stackoverflow.com", "https://Stackoverflow.com/users/112785/" ]
Using the Request.QueryString gives you a collection that you can iterate over. Using Request.QueryString.Allkeys allows you to iterate over a collection of strings that represent all of the keys i nthe query string. Using this we can come up with something like the below code in order to iterate over all keys and get ...
If the collection implements IEnumerable you can use a foreach, otherwise use a for loop with the .Length of the collection.
25,974
I find it easier to use SSHFS to mount a remote file system on my local computer instead of plainly SSH'ing into the remote computer. This saves me from using all the complicated `scp` commmands for copy/paste. But on the internet, I find very few people talking about SSHFS. If SSHFS is more easier, then why isn't it m...
2011/12/03
[ "https://unix.stackexchange.com/questions/25974", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/8942/" ]
SSH is not primarily used to copy files. It's used to log in to and operate remote machines/server via a secure link, and create secure tunnels between hosts. It's available (or can be installed) on pretty much all the main operating systems out there. SSHFS is limited to remote mounting, available only on systems tha...
Compression overhead, poorer low latency toleration and memory hungry and if connection cuts every now and then sshfs can get cranky.Typical tradeoff when using a secure (sshfs) versus an insecure (nfs) protocol.
25,974
I find it easier to use SSHFS to mount a remote file system on my local computer instead of plainly SSH'ing into the remote computer. This saves me from using all the complicated `scp` commmands for copy/paste. But on the internet, I find very few people talking about SSHFS. If SSHFS is more easier, then why isn't it m...
2011/12/03
[ "https://unix.stackexchange.com/questions/25974", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/8942/" ]
SSH is not primarily used to copy files. It's used to log in to and operate remote machines/server via a secure link, and create secure tunnels between hosts. It's available (or can be installed) on pretty much all the main operating systems out there. SSHFS is limited to remote mounting, available only on systems tha...
I wondered the same. I've spent a lot of time trying and tuning different access methods to remote webspace. I've tried NFS (frequent lockups, poor performance), Samba (very good, especially with SMB 2.0), OpenAFS (despite local caching, it wasn't really quick). Then a colleage mentioned SSHFS. I've mapped the webspac...
25,974
I find it easier to use SSHFS to mount a remote file system on my local computer instead of plainly SSH'ing into the remote computer. This saves me from using all the complicated `scp` commmands for copy/paste. But on the internet, I find very few people talking about SSHFS. If SSHFS is more easier, then why isn't it m...
2011/12/03
[ "https://unix.stackexchange.com/questions/25974", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/8942/" ]
I wondered the same. I've spent a lot of time trying and tuning different access methods to remote webspace. I've tried NFS (frequent lockups, poor performance), Samba (very good, especially with SMB 2.0), OpenAFS (despite local caching, it wasn't really quick). Then a colleage mentioned SSHFS. I've mapped the webspac...
Compression overhead, poorer low latency toleration and memory hungry and if connection cuts every now and then sshfs can get cranky.Typical tradeoff when using a secure (sshfs) versus an insecure (nfs) protocol.
9,845,462
Is there a way to determine change frequency of a file? The situation is i have a log file which will be rolling all the time, in that way i can say my application is running . if it's not writing any then i can say there's some problem. So instead of using tail and see manually if the logs are rolling , how can i ch...
2012/03/23
[ "https://Stackoverflow.com/questions/9845462", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1065448/" ]
Just missed a few things on this one. Here ya go. <http://jsfiddle.net/EN7y4/3/> Namely. You had "self.theWeight" in function Reading instead of "this."... Happy Coding!
``` alert(self.users()[0].theReadings()[0].theWeight(); ``` I would recommend removing the 'thes'. That's an uncommon style.
13,973,958
I created a java login frame using netbeans and I connected it to MySQL using MySQL Connector/J which the jar file was added to the projects library. I also created a table called login which includes all the login details. The following codes are supposed to permit login but I keep getting errors as if the connection ...
2012/12/20
[ "https://Stackoverflow.com/questions/13973958", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1592334/" ]
You need to create a jdbc connection at startup: ``` //load the driver Class.forName("com.mysql.jdbc.Driver").newInstance(); // create a connection conn = DriverManager.getConnection("jdbc:mysql://"+hostName+":" + dbPort+"/"+databaseName+"?"+"user="+dbUser+"&password=" + dbPassword); ```
A good way to do it is to create a separated file called dbConnection for eample. This file will contain method to connect to the DB. Typically it will look like this : ``` public class DBConnection{ Connection con = null; Statement stmt = null; ResultSet rs = null; public DBConnection() {} public void conne...
213,254
I am trying to customize a views output on a view page to wrap the fields in custom markup. I need to group a set of fields to achieve the desired layout like so: Example: ``` <div class="wrapper"> {{ field.[field_name_1].content }} </div> <div class="wrapper2"> {{ field.[field_name_2].content ...
2016/08/31
[ "https://drupal.stackexchange.com/questions/213254", "https://drupal.stackexchange.com", "https://drupal.stackexchange.com/users/66465/" ]
I see many problems in the code you posted in your question. First of all, you are missing a parameter in `preg_replace`. Take a look at the [PHP documentation](http://php.net/manual/en/function.preg-replace.php). Second, you have no delimiters in your pattern. The correct pattern should be: `$patt = '/.+\//';` (You...
you can handle this with [global redirect module](https://www.drupal.org/project/globalredirect), it is useful module that could handle what you want and give your some ability to improve your site SEO. > > GlobalRedirect is a simple module which… > > > > ``` > Checks the current URL for an alias and does a 301 re...
47,129,043
Problem ======= I am looking to extract sample-accurate ranges of LPCM audio from audio tracks within video files. Currently, I'm looking to achieve this using `AVAssetReaderTrackOutput` against an `AVAssetTrack` delivered from reading a `AVURLAsset`. Despite preparing and ensuring the asset is initialized using `AVU...
2017/11/06
[ "https://Stackoverflow.com/questions/47129043", "https://Stackoverflow.com", "https://Stackoverflow.com/users/253072/" ]
One procedure that works is to use AVAssetReader, to read your compressed AV file, in conjunction with AVAssetWriter, to write a new raw LPCM file of the audio samples. Then one can quickly index through this new PCM file (or memory mapped array, if necessary) to extract exact sample-accurate ranges, without incurring ...
I wrote another answer in which I incorrectly claimed `AVAssetReader`/`AVAssetReaderTrackOutput` did not do sample accurate seeking, they do, but it looks broken when your audio track is embedded inside a movie file, so you've found a bug. Congratulations! The audio track dumped with a pass through `AVAssetExportSes...
20,816,698
I'm reading up on datastructures, especially immutable ones like the [append-only B+ tree](http://guide.couchdb.org/draft/btree.html) used in CouchDB and the [Hash array mapped trie](http://en.wikipedia.org/wiki/Hash_array_mapped_trie) used in Clojure and some other functional programming languages. The main reason da...
2013/12/28
[ "https://Stackoverflow.com/questions/20816698", "https://Stackoverflow.com", "https://Stackoverflow.com/users/183662/" ]
B-trees are used because they are a well-understood algorithm that achieves "ideal" sorted-order read-cost. Because keys are sorted, moving to the next or previous key is very cheap. HAMTs or other hash storage, stores keys in random order. Keys are retrieved by their exact value, and there is no efficient way to find...
Btrees are ordered by their key while in a hash map similar keys have very different hash values so are stored far each other. Now think of a query that do a range scan "give me yesterday's sales": with a hash map you have to scan all the map to find them, with a btree on the sales\_dtm columns you'll find them nicely ...
62,847,336
All of my tables have a Trigger for CRUD operations. here is a sample: ``` ALTER TRIGGER [dbo].[Cities_tr] ON [dbo].[Cities] AFTER INSERT, UPDATE AS BEGIN DECLARE @operation CHAR(6) SET @operation = CASE WHEN EXISTS (SELECT * FROM inserted) AND EXISTS (SELECT * FROM deleted) THEN 'Update' WHE...
2020/07/11
[ "https://Stackoverflow.com/questions/62847336", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9067232/" ]
You are cross joining `inserted` and `deleted`. Normally, they would be joined using the table's primary key, which is presumably `CityId`: ``` INSERT INTO history ([dt], [tname], [cuser] , [id], op) SELECT GETDATE(), 'Cities', i.ldu, i.CityId, @operation FROM deleted d JOIN i...
The problem with your code is that you are cross joining `inserted` and `deleted`. On a multi-rows update, both contain many rows, which the cartesian product multiplies. It looks like you actually want to log the "new" rows (either inserted or updated). If so, you don’t want to select from `deleted`. Also, the condit...
366,808
I see that `mkudffs` has options for four different identifiers: the logical volume (`--lvid`), the volume (`--vid`), the volume set (`--vsid`), and the file set identifier (`--fsid`). It, however, gives no guidance to what those mean. So, I went to the UDF specs. Starting with ISO/IEC 13346 aka [ECMA-167](http://www....
2011/12/11
[ "https://superuser.com/questions/366808", "https://superuser.com", "https://superuser.com/users/1735/" ]
These are bunch of not useful strings, except **LVID**. Form mkudffs: * **--lvid** Specify the logical volume identifier. It sets given string to the following fields: + Logical Volume Identifier in the Logical Volume Descriptor (See Figure 15 in [ECMA-167](http://www.ecma-international.org/publications/files/ECMA-S...
I think these are completely up to you; I'd say the fields are there to support enterprise processes. One use that comes readily to mind is to use the volume set identifier for stuff like "monthly full backup of FOO, 2015-12", and the volume identifier could then be something like "disk 1 of 42". Or maybe you'll actual...
366,808
I see that `mkudffs` has options for four different identifiers: the logical volume (`--lvid`), the volume (`--vid`), the volume set (`--vsid`), and the file set identifier (`--fsid`). It, however, gives no guidance to what those mean. So, I went to the UDF specs. Starting with ISO/IEC 13346 aka [ECMA-167](http://www....
2011/12/11
[ "https://superuser.com/questions/366808", "https://superuser.com", "https://superuser.com/users/1735/" ]
These are bunch of not useful strings, except **LVID**. Form mkudffs: * **--lvid** Specify the logical volume identifier. It sets given string to the following fields: + Logical Volume Identifier in the Logical Volume Descriptor (See Figure 15 in [ECMA-167](http://www.ecma-international.org/publications/files/ECMA-S...
Logically speaking those fields all exist to contain data which some member (or members) of the committee who developed and/or modified the standard saw a need for. Just because someone thinks it's a waste of space on the disk doesn't mean there weren't one or more opinions on the matter when the standard was agreed up...
366,808
I see that `mkudffs` has options for four different identifiers: the logical volume (`--lvid`), the volume (`--vid`), the volume set (`--vsid`), and the file set identifier (`--fsid`). It, however, gives no guidance to what those mean. So, I went to the UDF specs. Starting with ISO/IEC 13346 aka [ECMA-167](http://www....
2011/12/11
[ "https://superuser.com/questions/366808", "https://superuser.com", "https://superuser.com/users/1735/" ]
These are bunch of not useful strings, except **LVID**. Form mkudffs: * **--lvid** Specify the logical volume identifier. It sets given string to the following fields: + Logical Volume Identifier in the Logical Volume Descriptor (See Figure 15 in [ECMA-167](http://www.ecma-international.org/publications/files/ECMA-S...
I think these values orientate on other specs, which themselfes try to generalize media mngt. In my example i will refer to Linux but this doesn't mean, it wouldn't apply to Windows. Those specs. are just hidden there. Run the following cmd on Linux and look at the output: blkid > > /dev/x: LABEL="Windows" UUID="?" ...
366,808
I see that `mkudffs` has options for four different identifiers: the logical volume (`--lvid`), the volume (`--vid`), the volume set (`--vsid`), and the file set identifier (`--fsid`). It, however, gives no guidance to what those mean. So, I went to the UDF specs. Starting with ISO/IEC 13346 aka [ECMA-167](http://www....
2011/12/11
[ "https://superuser.com/questions/366808", "https://superuser.com", "https://superuser.com/users/1735/" ]
I think these are completely up to you; I'd say the fields are there to support enterprise processes. One use that comes readily to mind is to use the volume set identifier for stuff like "monthly full backup of FOO, 2015-12", and the volume identifier could then be something like "disk 1 of 42". Or maybe you'll actual...
Logically speaking those fields all exist to contain data which some member (or members) of the committee who developed and/or modified the standard saw a need for. Just because someone thinks it's a waste of space on the disk doesn't mean there weren't one or more opinions on the matter when the standard was agreed up...
366,808
I see that `mkudffs` has options for four different identifiers: the logical volume (`--lvid`), the volume (`--vid`), the volume set (`--vsid`), and the file set identifier (`--fsid`). It, however, gives no guidance to what those mean. So, I went to the UDF specs. Starting with ISO/IEC 13346 aka [ECMA-167](http://www....
2011/12/11
[ "https://superuser.com/questions/366808", "https://superuser.com", "https://superuser.com/users/1735/" ]
I think these are completely up to you; I'd say the fields are there to support enterprise processes. One use that comes readily to mind is to use the volume set identifier for stuff like "monthly full backup of FOO, 2015-12", and the volume identifier could then be something like "disk 1 of 42". Or maybe you'll actual...
I think these values orientate on other specs, which themselfes try to generalize media mngt. In my example i will refer to Linux but this doesn't mean, it wouldn't apply to Windows. Those specs. are just hidden there. Run the following cmd on Linux and look at the output: blkid > > /dev/x: LABEL="Windows" UUID="?" ...
17,721,133
I have something like this: <http://s9.postimg.org/wwizuwnq7/Untitled_1.png> And if you see, the divs (Where I marked in green) have a space of some pixel. And i want if there is a 0-20 pixel space between divs, to order them like this: <http://s23.postimg.org/ky2htcpt7/image.png> So, i started to do this on javascri...
2013/07/18
[ "https://Stackoverflow.com/questions/17721133", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2578996/" ]
You can do this by adding a container div around the bottom 2 blocks. That way they will always be in line, regardless of the height of either of the top two blocks. You should try not to use javascript for styling. CSS is very powerful. Here's a fiddle: <http://jsfiddle.net/kVn7x/> **HTML:** ``` <div> <div styl...
Can't you simply add a **bottom margin** to the selected element in **CSS**? ``` #element { margin-bottom: 20px; } ```
17,721,133
I have something like this: <http://s9.postimg.org/wwizuwnq7/Untitled_1.png> And if you see, the divs (Where I marked in green) have a space of some pixel. And i want if there is a 0-20 pixel space between divs, to order them like this: <http://s23.postimg.org/ky2htcpt7/image.png> So, i started to do this on javascri...
2013/07/18
[ "https://Stackoverflow.com/questions/17721133", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2578996/" ]
I managed to find a method! ``` var position = new Array(); $(".hblocks").each(function(){ position[$(this).attr("id")] = $(this).offset().top; }); $.each(position, function(key, value) { $.each(position, function(key2, value2) { var space = value2 - value; if (space <= 20 && space >= -20 && s...
Can't you simply add a **bottom margin** to the selected element in **CSS**? ``` #element { margin-bottom: 20px; } ```
17,721,133
I have something like this: <http://s9.postimg.org/wwizuwnq7/Untitled_1.png> And if you see, the divs (Where I marked in green) have a space of some pixel. And i want if there is a 0-20 pixel space between divs, to order them like this: <http://s23.postimg.org/ky2htcpt7/image.png> So, i started to do this on javascri...
2013/07/18
[ "https://Stackoverflow.com/questions/17721133", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2578996/" ]
You can do this by adding a container div around the bottom 2 blocks. That way they will always be in line, regardless of the height of either of the top two blocks. You should try not to use javascript for styling. CSS is very powerful. Here's a fiddle: <http://jsfiddle.net/kVn7x/> **HTML:** ``` <div> <div styl...
Your answer would be some king of javascript+css coding to verify height of elements .. work on em then re-arrange them. Stop trying to figure out by yourself, try using [Masonry](http://masonry.desandro.com/) or [jQueryEqualHeight](http://css-tricks.com/equal-height-blocks-in-rows/) explained on CSSTrick. **What is ...
17,721,133
I have something like this: <http://s9.postimg.org/wwizuwnq7/Untitled_1.png> And if you see, the divs (Where I marked in green) have a space of some pixel. And i want if there is a 0-20 pixel space between divs, to order them like this: <http://s23.postimg.org/ky2htcpt7/image.png> So, i started to do this on javascri...
2013/07/18
[ "https://Stackoverflow.com/questions/17721133", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2578996/" ]
You can do this by adding a container div around the bottom 2 blocks. That way they will always be in line, regardless of the height of either of the top two blocks. You should try not to use javascript for styling. CSS is very powerful. Here's a fiddle: <http://jsfiddle.net/kVn7x/> **HTML:** ``` <div> <div styl...
This is untested but something like this should work after your code... The idea is to continuously add 1pixel to the top margin of the problematic div until the difference between the two divs is 20px ``` while(position['div1'] - position['div2'] <20){ $('#div2').animate({marginTop: '+=1px'}, 0);​​​​​​​​​​​​​​...
17,721,133
I have something like this: <http://s9.postimg.org/wwizuwnq7/Untitled_1.png> And if you see, the divs (Where I marked in green) have a space of some pixel. And i want if there is a 0-20 pixel space between divs, to order them like this: <http://s23.postimg.org/ky2htcpt7/image.png> So, i started to do this on javascri...
2013/07/18
[ "https://Stackoverflow.com/questions/17721133", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2578996/" ]
I managed to find a method! ``` var position = new Array(); $(".hblocks").each(function(){ position[$(this).attr("id")] = $(this).offset().top; }); $.each(position, function(key, value) { $.each(position, function(key2, value2) { var space = value2 - value; if (space <= 20 && space >= -20 && s...
Your answer would be some king of javascript+css coding to verify height of elements .. work on em then re-arrange them. Stop trying to figure out by yourself, try using [Masonry](http://masonry.desandro.com/) or [jQueryEqualHeight](http://css-tricks.com/equal-height-blocks-in-rows/) explained on CSSTrick. **What is ...
17,721,133
I have something like this: <http://s9.postimg.org/wwizuwnq7/Untitled_1.png> And if you see, the divs (Where I marked in green) have a space of some pixel. And i want if there is a 0-20 pixel space between divs, to order them like this: <http://s23.postimg.org/ky2htcpt7/image.png> So, i started to do this on javascri...
2013/07/18
[ "https://Stackoverflow.com/questions/17721133", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2578996/" ]
I managed to find a method! ``` var position = new Array(); $(".hblocks").each(function(){ position[$(this).attr("id")] = $(this).offset().top; }); $.each(position, function(key, value) { $.each(position, function(key2, value2) { var space = value2 - value; if (space <= 20 && space >= -20 && s...
This is untested but something like this should work after your code... The idea is to continuously add 1pixel to the top margin of the problematic div until the difference between the two divs is 20px ``` while(position['div1'] - position['div2'] <20){ $('#div2').animate({marginTop: '+=1px'}, 0);​​​​​​​​​​​​​​...
15,796,994
I am trying to strip all divs. Input: ``` <p>111</p> <div class="1334">bla</div> <p>333</p> <p>333</p> <div some unkown stuff>bla2</div> ``` Desired Output: ``` <p>111</p> <p>333</p> <p>333</p> ``` I tried this but it isn't working: ``` release_content = re.sub("/<div>.*<\/div>/s", "", release_...
2013/04/03
[ "https://Stackoverflow.com/questions/15796994", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1200929/" ]
[Do not use regex for this problem](https://stackoverflow.com/a/1732454/1253312). Use an html parser. Here is a solution in python with BeautifulSoup: ``` from BeautifulSoup import BeautifulSoup with open('Path/to/file', 'r') as content_file: content = content_file.read() soup = BeautifulSoup(content) [div.extra...
You don't need any delimeters for regexp patterns in python: ``` release_content = re.sub("<div>.*<\/div>", "", release_content) ``` Are you sure the `div`s won't have any attributes? What happens to nested `div`s?
15,796,994
I am trying to strip all divs. Input: ``` <p>111</p> <div class="1334">bla</div> <p>333</p> <p>333</p> <div some unkown stuff>bla2</div> ``` Desired Output: ``` <p>111</p> <p>333</p> <p>333</p> ``` I tried this but it isn't working: ``` release_content = re.sub("/<div>.*<\/div>/s", "", release_...
2013/04/03
[ "https://Stackoverflow.com/questions/15796994", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1200929/" ]
[Do not use regex for this problem](https://stackoverflow.com/a/1732454/1253312). Use an html parser. Here is a solution in python with BeautifulSoup: ``` from BeautifulSoup import BeautifulSoup with open('Path/to/file', 'r') as content_file: content = content_file.read() soup = BeautifulSoup(content) [div.extra...
You are using a *greedy* operator: `*`. It will try to match as much as possible before it stops. You can try using the non-greedy version, `*?`. So long as you don't have nested `<div>` tags you will be OK. ``` release_content = re.sub("(?s)<div>.*?<\/div>", "", release_content) ``` If you can have nested `<div>` t...
299,895
When I call this function, everything works, as long as I don't try to recursively call the function again. In other words if I uncomment the line: ``` GetChilds rsData("AcctID"), intLevel + 1 ``` Then the function breaks. ``` <% Function GetChilds(ParentID, intLevel) Set rsData= Server.CreateObject("...
2008/11/18
[ "https://Stackoverflow.com/questions/299895", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38678/" ]
hard to tell without more description of how it breaks, but you are not using intLevel for anything.
How does it break? My guess is that after a certain number of recursions you're probably getting a Stack Overflow (ironic) because you're not allocating too many RecordSets.
299,895
When I call this function, everything works, as long as I don't try to recursively call the function again. In other words if I uncomment the line: ``` GetChilds rsData("AcctID"), intLevel + 1 ``` Then the function breaks. ``` <% Function GetChilds(ParentID, intLevel) Set rsData= Server.CreateObject("...
2008/11/18
[ "https://Stackoverflow.com/questions/299895", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38678/" ]
Look like it fails because your connection is still busy serving the RecordSet from the previous call. One option is to use a fresh connection for each call. The danger there is that you'll quickly run out of connections if you recurse too many times. Another option is to read the contents of each RecordSet into a d...
try declaring the variables as local using a DIM statement within the function definition: ``` Function GetChilds(ParentID, intLevel) Dim rsData, sSQL Set ... ``` Edit: Ok, I try to be more explicit. My understanding is that since rsData is not declared by DIM, it is not a local variable, but a global var. Therefor...
299,895
When I call this function, everything works, as long as I don't try to recursively call the function again. In other words if I uncomment the line: ``` GetChilds rsData("AcctID"), intLevel + 1 ``` Then the function breaks. ``` <% Function GetChilds(ParentID, intLevel) Set rsData= Server.CreateObject("...
2008/11/18
[ "https://Stackoverflow.com/questions/299895", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38678/" ]
Running out of SQL Connections? You are dealing with so many layers there (Response.Write for the client, the ASP for the server, and the database) that its not surprising that there are problems. Perhaps you can post some details about the error?
In each call you open a new connection to the database and you don't close it before opening a new one.
299,895
When I call this function, everything works, as long as I don't try to recursively call the function again. In other words if I uncomment the line: ``` GetChilds rsData("AcctID"), intLevel + 1 ``` Then the function breaks. ``` <% Function GetChilds(ParentID, intLevel) Set rsData= Server.CreateObject("...
2008/11/18
[ "https://Stackoverflow.com/questions/299895", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38678/" ]
Look like it fails because your connection is still busy serving the RecordSet from the previous call. One option is to use a fresh connection for each call. The danger there is that you'll quickly run out of connections if you recurse too many times. Another option is to read the contents of each RecordSet into a d...
If you need recursion such as this I would personally put the recursion into a stored procedure and handle that processing on the database side in order to avoid opening multiple connections. If you are using mssql2005 look into something called Common Table Expressions (CTE), they make recursion easy. There are other ...
299,895
When I call this function, everything works, as long as I don't try to recursively call the function again. In other words if I uncomment the line: ``` GetChilds rsData("AcctID"), intLevel + 1 ``` Then the function breaks. ``` <% Function GetChilds(ParentID, intLevel) Set rsData= Server.CreateObject("...
2008/11/18
[ "https://Stackoverflow.com/questions/299895", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38678/" ]
Running out of SQL Connections? You are dealing with so many layers there (Response.Write for the client, the ASP for the server, and the database) that its not surprising that there are problems. Perhaps you can post some details about the error?
If you need recursion such as this I would personally put the recursion into a stored procedure and handle that processing on the database side in order to avoid opening multiple connections. If you are using mssql2005 look into something called Common Table Expressions (CTE), they make recursion easy. There are other ...
299,895
When I call this function, everything works, as long as I don't try to recursively call the function again. In other words if I uncomment the line: ``` GetChilds rsData("AcctID"), intLevel + 1 ``` Then the function breaks. ``` <% Function GetChilds(ParentID, intLevel) Set rsData= Server.CreateObject("...
2008/11/18
[ "https://Stackoverflow.com/questions/299895", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38678/" ]
Running out of SQL Connections? You are dealing with so many layers there (Response.Write for the client, the ASP for the server, and the database) that its not surprising that there are problems. Perhaps you can post some details about the error?
Not that this is actually a solution to the recursion issue, but it might be better for you to work out an SQL statement that returns all the information in a hierarchical format, rather than making recursive calls to your database. Come to think of it though, it may be because you have too many concurrent db connecti...
299,895
When I call this function, everything works, as long as I don't try to recursively call the function again. In other words if I uncomment the line: ``` GetChilds rsData("AcctID"), intLevel + 1 ``` Then the function breaks. ``` <% Function GetChilds(ParentID, intLevel) Set rsData= Server.CreateObject("...
2008/11/18
[ "https://Stackoverflow.com/questions/299895", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38678/" ]
Look like it fails because your connection is still busy serving the RecordSet from the previous call. One option is to use a fresh connection for each call. The danger there is that you'll quickly run out of connections if you recurse too many times. Another option is to read the contents of each RecordSet into a d...
hard to tell without more description of how it breaks, but you are not using intLevel for anything.
299,895
When I call this function, everything works, as long as I don't try to recursively call the function again. In other words if I uncomment the line: ``` GetChilds rsData("AcctID"), intLevel + 1 ``` Then the function breaks. ``` <% Function GetChilds(ParentID, intLevel) Set rsData= Server.CreateObject("...
2008/11/18
[ "https://Stackoverflow.com/questions/299895", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38678/" ]
Look like it fails because your connection is still busy serving the RecordSet from the previous call. One option is to use a fresh connection for each call. The danger there is that you'll quickly run out of connections if you recurse too many times. Another option is to read the contents of each RecordSet into a d...
I have working code with the same scenario. I use a clientside cursor ``` ... rsData.CursorLocation = adUseClient rsData.Open sSQL, conDB, adOpenKeyset, adLockOptimistic rsData.ActiveConnectcion = Nothing ... ``` as pointed out in other responses, this is not very efficient, I use it only in an admin interface wher...
299,895
When I call this function, everything works, as long as I don't try to recursively call the function again. In other words if I uncomment the line: ``` GetChilds rsData("AcctID"), intLevel + 1 ``` Then the function breaks. ``` <% Function GetChilds(ParentID, intLevel) Set rsData= Server.CreateObject("...
2008/11/18
[ "https://Stackoverflow.com/questions/299895", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38678/" ]
hard to tell without more description of how it breaks, but you are not using intLevel for anything.
If you need recursion such as this I would personally put the recursion into a stored procedure and handle that processing on the database side in order to avoid opening multiple connections. If you are using mssql2005 look into something called Common Table Expressions (CTE), they make recursion easy. There are other ...
299,895
When I call this function, everything works, as long as I don't try to recursively call the function again. In other words if I uncomment the line: ``` GetChilds rsData("AcctID"), intLevel + 1 ``` Then the function breaks. ``` <% Function GetChilds(ParentID, intLevel) Set rsData= Server.CreateObject("...
2008/11/18
[ "https://Stackoverflow.com/questions/299895", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38678/" ]
Running out of SQL Connections? You are dealing with so many layers there (Response.Write for the client, the ASP for the server, and the database) that its not surprising that there are problems. Perhaps you can post some details about the error?
Based on the sugestions I will atempt to move the query into a CTE (common table expression) when I find a good tutorial on how to do that. For now and as a quick and dirty fix, I have changed the code as follows: ``` Function GetChilds(ParentID, intLevel) 'Open my Database Connection and Query the current Par...
4,093,989
Does this Python code actually find the dot product of two vectors? ``` import operator vector1 = (2,3,5) vector2 = (3,4,6) dotProduct = reduce( operator.add, map( operator.mul, vector1, vector2)) ```
2010/11/04
[ "https://Stackoverflow.com/questions/4093989", "https://Stackoverflow.com", "https://Stackoverflow.com/users/458858/" ]
Yes it does. Here is another way ``` >>> sum(map( operator.mul, vector1, vector2)) 48 ``` and another that doesn't use `operator` at all ``` >>> vector1 = (2,3,5) >>> vector2 = (3,4,6) >>> sum(p*q for p,q in zip(vector1, vector2)) 48 ```
You can also use the numpy implementation of [dot product](http://docs.scipy.org/doc/numpy/reference/generated/numpy.dot.html) which has large array optimizations in native code to make computations slightly faster. Even better unless you are specifically trying to write a dot product routine or avoid dependencies, usi...
9,306,297
I have an array for example `("1:2","5:90","7:12",1:70,"29:60")` Wherein ID and Qty are separated by a ':' (colon), what I want to do is when there's a duplicate of IDs the program will add the qty and return the new set of arrays so in the example it will become `("1:72","5:90","7:12","29:60")`. Ex.2 ``` ("1:2","5:...
2012/02/16
[ "https://Stackoverflow.com/questions/9306297", "https://Stackoverflow.com", "https://Stackoverflow.com/users/668122/" ]
There's not really enough information here to give you a definitive answer. First it's not clear if this happens only when you run with -j2. What if you run without parallelism (no -j)? When you say "2 core's CPU usage [goes to] 100%", what is happening on those CPUs? If you run "top" in another terminal and then start...
Are you sure the project is prepared for parallel compilation? Maybe the prerequisites aren't correctly ordered. If you build the project with just "make" the compilation finish? If it gets to the end is a target dependency problem.