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
52,578,648
I have a project made of several Maven projects, where the tests are in separated modules. E.g: ``` com.xyz.abc.feature.model com.xyz.abc.feature.model.test ``` The tests are JUnit tests, and I have been running them from the command line with `mvn install`. I want to step through the code in a specific test, so I h...
2018/09/30
[ "https://Stackoverflow.com/questions/52578648", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1942584/" ]
There are two main approaches here. First, you could just execute the test from Eclipse and debug it like you would debug any other Java program. This is probably the easiest approach, but may not be accurate enough if there are differences between the Maven execution and the execution in Eclipse (e.g., environment va...
Just open the test in eclipse, double-click on the test name to select it (actually just clicking in the test-name to put the cursor in it should be enough, or you can e.g. select it in the outline view), then right-click and choose `Debug As` > `JUnit Test`
52,578,648
I have a project made of several Maven projects, where the tests are in separated modules. E.g: ``` com.xyz.abc.feature.model com.xyz.abc.feature.model.test ``` The tests are JUnit tests, and I have been running them from the command line with `mvn install`. I want to step through the code in a specific test, so I h...
2018/09/30
[ "https://Stackoverflow.com/questions/52578648", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1942584/" ]
Maven SureFire plugin runs the test in a different process by default. That's likely why it wasn't working for you. You would first disable forking by adding this to your pom.xml: ``` <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifac...
There are two main approaches here. First, you could just execute the test from Eclipse and debug it like you would debug any other Java program. This is probably the easiest approach, but may not be accurate enough if there are differences between the Maven execution and the execution in Eclipse (e.g., environment va...
52,578,648
I have a project made of several Maven projects, where the tests are in separated modules. E.g: ``` com.xyz.abc.feature.model com.xyz.abc.feature.model.test ``` The tests are JUnit tests, and I have been running them from the command line with `mvn install`. I want to step through the code in a specific test, so I h...
2018/09/30
[ "https://Stackoverflow.com/questions/52578648", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1942584/" ]
Maven SureFire plugin runs the test in a different process by default. That's likely why it wasn't working for you. You would first disable forking by adding this to your pom.xml: ``` <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifac...
Just open the test in eclipse, double-click on the test name to select it (actually just clicking in the test-name to put the cursor in it should be enough, or you can e.g. select it in the outline view), then right-click and choose `Debug As` > `JUnit Test`
3,148,039
On a 64-bit machine: Can a 64-bit application call a COM server (out proc) which is running in 32-bit process? What about vice versa? (32 bit app calling 64-bit COM out proc server) Thanks!
2010/06/30
[ "https://Stackoverflow.com/questions/3148039", "https://Stackoverflow.com", "https://Stackoverflow.com/users/169269/" ]
The whole point of out-proc COM is that the two processes interact via RPC (usually LRPC), so it doesn't matter at all which bitness each of them has. We used COM+ surrogate for forcing 32-bit in-proc components into a separate process for the only purpose of consuming them from 64-bit clients many times - with all ne...
This may be relevant [MIDL: 64-Bit Porting Guide](http://msdn.microsoft.com/en-us/library/ms810720.aspx). Basically what it says is that if you pass pointer types (`IUnknown` etc) it's OK but if you *cheat* by passing a pointer disguised as a `DWORD` you may face some problems.
52,191,509
I have a very large SQL query. I am trying to scrape tables names using javascript out of SQL query. (I provide SQL query in a text file as input) ``` select t1.name, t1.id, t1.address, t2.units,t2.sale from SCHMEA1.candy_customers_azim_056 as t1 inner join SCHEMA1.candy_sales_history_set t2 on (t1.custid = ...
2018/09/05
[ "https://Stackoverflow.com/questions/52191509", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7352014/" ]
``` (from|join)\s+\w+\.((\w*)[as ]+(\w+)) ``` should return what you're looking for in the second capture group.
You may try this one as well: ``` /(from|join)\s+(\w+\.)?(\w+)(\s+as)?(\s+\w+)?/gmi ``` You can see examples [here](https://regex101.com/r/av7fpW/3).
127,056
I feel stupid asking, but I can't seem to find the answer to this anywhere. I'm trying to follow [these instructions](http://ubuntuforums.org/showthread.php?t=614743) to edit my bash prompt, but there is no `.bashrc` in either my user directory (`~/.bashrc`), or in my home directory, or in the main file system director...
2012/04/28
[ "https://askubuntu.com/questions/127056", "https://askubuntu.com", "https://askubuntu.com/users/57473/" ]
Don't forget it is a hidden file inside your home directory (you would not be the first to do a `ls -l` and thinking it is not there). Do a: ``` ls -la ~/ | more ``` There should be a `.bashrc` on the first page. If not just create it with: ``` vi ~/.bashrc ``` and add in the lines you need to add into it. Per...
Bashrc file is a hidden file inside the home directory. It is actually, give the path directions. And those are wanted to edit `.bashrc` file, try this command `gedit ~/.bashrc` instead of this `~/.bashrc` . This command `gedit ~/.bashrc` directly take you to the text editor, where you can edit it easily, as you know...
127,056
I feel stupid asking, but I can't seem to find the answer to this anywhere. I'm trying to follow [these instructions](http://ubuntuforums.org/showthread.php?t=614743) to edit my bash prompt, but there is no `.bashrc` in either my user directory (`~/.bashrc`), or in my home directory, or in the main file system director...
2012/04/28
[ "https://askubuntu.com/questions/127056", "https://askubuntu.com", "https://askubuntu.com/users/57473/" ]
There is a .bashrc in every user's home folder (99.99% of the time) as well as one system-wide (which I don't know the location of in Ubuntu). The quickest way to access it is `nano ~/.bashrc` from a terminal (replace `nano` with whatever you like to use). If this is not present in a user's home folder the system-wid...
Use `nano ~/.bashrc` to open and edit the .bashrc file. (This will create the file if it does not yet exist)
127,056
I feel stupid asking, but I can't seem to find the answer to this anywhere. I'm trying to follow [these instructions](http://ubuntuforums.org/showthread.php?t=614743) to edit my bash prompt, but there is no `.bashrc` in either my user directory (`~/.bashrc`), or in my home directory, or in the main file system director...
2012/04/28
[ "https://askubuntu.com/questions/127056", "https://askubuntu.com", "https://askubuntu.com/users/57473/" ]
if not in home directory, you can just copy from `/etc/bash.bashrc`, and make it source for your terminal, by typing in your terminal `source .bashrc` from your home directory after copying.
If you use encryption and work from the command line you might not see it as one need to mount the real home-dir first (in contrast to in the graphical UI where this is done automaticallu) by the command: ``` ecryptfs-mount-private ``` (I had the same question and stumbled upon this question; but found *my* answer i...
127,056
I feel stupid asking, but I can't seem to find the answer to this anywhere. I'm trying to follow [these instructions](http://ubuntuforums.org/showthread.php?t=614743) to edit my bash prompt, but there is no `.bashrc` in either my user directory (`~/.bashrc`), or in my home directory, or in the main file system director...
2012/04/28
[ "https://askubuntu.com/questions/127056", "https://askubuntu.com", "https://askubuntu.com/users/57473/" ]
Use `gedit ~/.bashrc`, it will allow you to modify `~/.bashrc` using gedit.
Use `nano ~/.bashrc` to open and edit the .bashrc file. (This will create the file if it does not yet exist)
127,056
I feel stupid asking, but I can't seem to find the answer to this anywhere. I'm trying to follow [these instructions](http://ubuntuforums.org/showthread.php?t=614743) to edit my bash prompt, but there is no `.bashrc` in either my user directory (`~/.bashrc`), or in my home directory, or in the main file system director...
2012/04/28
[ "https://askubuntu.com/questions/127056", "https://askubuntu.com", "https://askubuntu.com/users/57473/" ]
If `.bashrc` is not in your home folder, even after you list the hidden files, you can copy it from: ``` /etc/skel/.bashrc ```
Bashrc file is a hidden file inside the home directory. It is actually, give the path directions. And those are wanted to edit `.bashrc` file, try this command `gedit ~/.bashrc` instead of this `~/.bashrc` . This command `gedit ~/.bashrc` directly take you to the text editor, where you can edit it easily, as you know...
127,056
I feel stupid asking, but I can't seem to find the answer to this anywhere. I'm trying to follow [these instructions](http://ubuntuforums.org/showthread.php?t=614743) to edit my bash prompt, but there is no `.bashrc` in either my user directory (`~/.bashrc`), or in my home directory, or in the main file system director...
2012/04/28
[ "https://askubuntu.com/questions/127056", "https://askubuntu.com", "https://askubuntu.com/users/57473/" ]
It is hidden because of the '.' it starts with. list it with `ls -al` or enable "show hidden files" under the view menu in nautilus (Ctrl-H will also do the trick). You can edit it with your favorite text editor from your home directory e.g. `cd` to go to your home directory then: `emacs .bashrc`
If `.bashrc` is not in your home folder, even after you list the hidden files, you can copy it from: ``` /etc/skel/.bashrc ```
127,056
I feel stupid asking, but I can't seem to find the answer to this anywhere. I'm trying to follow [these instructions](http://ubuntuforums.org/showthread.php?t=614743) to edit my bash prompt, but there is no `.bashrc` in either my user directory (`~/.bashrc`), or in my home directory, or in the main file system director...
2012/04/28
[ "https://askubuntu.com/questions/127056", "https://askubuntu.com", "https://askubuntu.com/users/57473/" ]
Use `gedit ~/.bashrc`, it will allow you to modify `~/.bashrc` using gedit.
Bashrc file is a hidden file inside the home directory. It is actually, give the path directions. And those are wanted to edit `.bashrc` file, try this command `gedit ~/.bashrc` instead of this `~/.bashrc` . This command `gedit ~/.bashrc` directly take you to the text editor, where you can edit it easily, as you know...
127,056
I feel stupid asking, but I can't seem to find the answer to this anywhere. I'm trying to follow [these instructions](http://ubuntuforums.org/showthread.php?t=614743) to edit my bash prompt, but there is no `.bashrc` in either my user directory (`~/.bashrc`), or in my home directory, or in the main file system director...
2012/04/28
[ "https://askubuntu.com/questions/127056", "https://askubuntu.com", "https://askubuntu.com/users/57473/" ]
There is a .bashrc in every user's home folder (99.99% of the time) as well as one system-wide (which I don't know the location of in Ubuntu). The quickest way to access it is `nano ~/.bashrc` from a terminal (replace `nano` with whatever you like to use). If this is not present in a user's home folder the system-wid...
Bashrc file is a hidden file inside the home directory. It is actually, give the path directions. And those are wanted to edit `.bashrc` file, try this command `gedit ~/.bashrc` instead of this `~/.bashrc` . This command `gedit ~/.bashrc` directly take you to the text editor, where you can edit it easily, as you know...
127,056
I feel stupid asking, but I can't seem to find the answer to this anywhere. I'm trying to follow [these instructions](http://ubuntuforums.org/showthread.php?t=614743) to edit my bash prompt, but there is no `.bashrc` in either my user directory (`~/.bashrc`), or in my home directory, or in the main file system director...
2012/04/28
[ "https://askubuntu.com/questions/127056", "https://askubuntu.com", "https://askubuntu.com/users/57473/" ]
Use `gedit ~/.bashrc`, it will allow you to modify `~/.bashrc` using gedit.
Just one note: after you made your alias in bashrc, you need in your terminal to write following command in order that your aliases work: ``` source .bashrc ``` Personally, whenever I install Linux anew, I add some aliases finding an appropriate place in .bashrc E.g. ``` #My aliases alias shut='shutdown now' alias ...
127,056
I feel stupid asking, but I can't seem to find the answer to this anywhere. I'm trying to follow [these instructions](http://ubuntuforums.org/showthread.php?t=614743) to edit my bash prompt, but there is no `.bashrc` in either my user directory (`~/.bashrc`), or in my home directory, or in the main file system director...
2012/04/28
[ "https://askubuntu.com/questions/127056", "https://askubuntu.com", "https://askubuntu.com/users/57473/" ]
**User specific**, hidden by default. ``` ~/.bashrc ``` If not there simply create one. **System wide**: ``` /etc/bash.bashrc ```
Use `nano ~/.bashrc` to open and edit the .bashrc file. (This will create the file if it does not yet exist)
2,236,536
I want to make a search engine in an intranet. Now i use this clause in PHP. ``` $k = explode(" ",$_GET[key]); $sql = "select entreprise.*, employee.* where entreprise.* or employee.* like '%$k[0]%' or '%$k[1]%'"; ``` But it seems doesn't work. Do you know where is wrong? Thanks in advance. Edit: ``` $sql = "s...
2010/02/10
[ "https://Stackoverflow.com/questions/2236536", "https://Stackoverflow.com", "https://Stackoverflow.com/users/198728/" ]
``` $("a.merchantLink").click(function(){ // (if div is the previous element to ul) $(this).closest("ul.merchantsInProductList").prev("div.skuFinder"); // (if div is the not previous element to ul and is anywhere inside li with //class productListItem) $(this).closest("li.productListItem").find("div.sk...
Try: ``` $('a.merchantLink').click(function(){ var el = $(this).parent().siblings('.skuFinder'); }); ```
2,236,536
I want to make a search engine in an intranet. Now i use this clause in PHP. ``` $k = explode(" ",$_GET[key]); $sql = "select entreprise.*, employee.* where entreprise.* or employee.* like '%$k[0]%' or '%$k[1]%'"; ``` But it seems doesn't work. Do you know where is wrong? Thanks in advance. Edit: ``` $sql = "s...
2010/02/10
[ "https://Stackoverflow.com/questions/2236536", "https://Stackoverflow.com", "https://Stackoverflow.com/users/198728/" ]
``` $("a.merchantLink").click(function(){ // (if div is the previous element to ul) $(this).closest("ul.merchantsInProductList").prev("div.skuFinder"); // (if div is the not previous element to ul and is anywhere inside li with //class productListItem) $(this).closest("li.productListItem").find("div.sk...
``` $(".merchantLink").click( function(){ $(".skuFinder").load(); }); ``` May be this can help you.
19,869,236
Wikipedia says A\* runs in O(|E|) where |E| is the number of edges in the graph. But my friend says A\* is just a general case of Dijkstra's algorithm, and Dijkstra's algorithm runs in O(|E| + |V| log |V|). So I am confused about why A\* runs faster than Dijkstra's algorithm.
2013/11/08
[ "https://Stackoverflow.com/questions/19869236", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2644137/" ]
I think the time complexity of A\* listed on Wikipedia is incorrect (or at least, it's misleading). That time complexity only seems to count the number of states expanded in the search, rather than the time required to determine which states to explore. To be efficient, A\* search needs to store a priority queue conta...
Essentially A\* is faster because it can use heuristics to make more educated guesses about which route is the best to case, something which Dijkstra's algorithm does not do.
646,076
I don't know how to install much-needed nvidia drivers on my powermac g5 quad. I am using ubuntu 14.04.2. Any help would be greatly appreciated as I cannot get into desktop
2015/07/08
[ "https://askubuntu.com/questions/646076", "https://askubuntu.com", "https://askubuntu.com/users/237040/" ]
There are no proprietary Nvidia drivers supporting this adapter for powerpc platform. And it looks like nouveau does not support 3D acceleration well for it. The only solution I see is to install Xubuntu. It does not require 3D acceleration and it may work with open source drivers.
Try this: ``` sudo apt-get install nvidia-311-updates ``` and it might work.
65,586,859
Suppose I have this code. Which method is better? ``` // Method 1 std::size_t size() { // m_myVector is of type std::vector<MyClass*> in all examples return m_myVector.size(); } // Method 2 std::vector<MyClass*>::size_type size() { // m_myVector is of type std::vector<MyClass*> in all examples return m_myVect...
2021/01/05
[ "https://Stackoverflow.com/questions/65586859", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5849965/" ]
> > but of course there's the off-chance that the size of the vector isn't of type std::size\_t > > > Such off-chance doesn't practically exist in this case because `std::vector<MyClass*>::size_type` is (indirectly guaranteed and required to be) of type `std::size_t`. Using `std::size_t` is fine in this case, and ...
`std::size_t` is a type capable of holding the size of any array, including arrays allocated through allocators. This means that `std::size_t` will always be able to store the result of `std::vector<T>::size()`, so method 1 will never lead to an overflow and is perfectly readable. There is no guarantee that `std::vec...
46,027,001
I read [the Google style guide for R](https://google.github.io/styleguide/Rguide). For "Assignment", they say: > > Use <-, not =, for assignment. > > > GOOD: > > x <- 5 > > > BAD: > > x = 5 > > > Can you tell me what the difference is between these two methods of assignment, and why one is to be prefe...
2017/09/03
[ "https://Stackoverflow.com/questions/46027001", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1958823/" ]
I believe there are two reasons. One is that `<-` and `=` have slightly different meanings depending on context. For example, compare the behavior of the statements: ``` printx <- function(x) print(x) printx(x="hello") printx(x<-"hello") ``` In the second case, `printx(x<-"hello")` will also assign to the parent sco...
Both are used, just in different contexts. If we don't use them in the right contexts, we'll see errors. See here: Using **<-** is for defining a local variable. ``` #Example: creating a vector x <- c(1,2,3) #Here we could use = and that would happen to work in this case. ``` Using **<<-** , as Joshua Ulrich says,...
44,446,900
How can I remove value **"288"** from **"pecan"** and return the updated array. Array like so: ``` a: 10: { s: 13: "Fraser Island"; a: 7: { i: 0; i: 303; i: 1; i: 34; i: 2; i: 27; i: 3; i: 291; i: 4; i: 293; i: 5; i: 37; i: 6; i: 288; } s: 5: "pecan"; a: 5: { ...
2017/06/08
[ "https://Stackoverflow.com/questions/44446900", "https://Stackoverflow.com", "https://Stackoverflow.com/users/568504/" ]
So you know you are looking under the `pecan` key and you know you are looking for `288`, so just search to return the key and `unset()`: ``` $key = 'pecan'; $val = '288'; unset($array[0][$key][array_search($val, $array[0][$key])]); ``` To re-index: ``` $array[0][$key] = array_values($array[0][$key]); ``` Or to ...
Try `remove_element_by_value($arr, '288', 'pecan')` ``` // DELETE VALUE FROM ARRAY function remove_element_by_value($arr, $val, $keyToSearch) { $keyOfValue = array_search($val, $arr[0][$keyToSearch]); unset($arr[0][$keyToSearch][$keyOfValue]); $arr[0][$keyToSearch] = array_v...
44,446,900
How can I remove value **"288"** from **"pecan"** and return the updated array. Array like so: ``` a: 10: { s: 13: "Fraser Island"; a: 7: { i: 0; i: 303; i: 1; i: 34; i: 2; i: 27; i: 3; i: 291; i: 4; i: 293; i: 5; i: 37; i: 6; i: 288; } s: 5: "pecan"; a: 5: { ...
2017/06/08
[ "https://Stackoverflow.com/questions/44446900", "https://Stackoverflow.com", "https://Stackoverflow.com/users/568504/" ]
So you know you are looking under the `pecan` key and you know you are looking for `288`, so just search to return the key and `unset()`: ``` $key = 'pecan'; $val = '288'; unset($array[0][$key][array_search($val, $array[0][$key])]); ``` To re-index: ``` $array[0][$key] = array_values($array[0][$key]); ``` Or to ...
``` // DELETE VALUE FROM ARRAY function remove_element_by_value($arr, $key ,$val ) { $return = array(); foreach($arr as $k => $v) { if(is_array($v)) { $return[$k] = remove_element_by_value($v, $val); //recursion continue; } if($v == $val && $k == $key) continue; ...
44,446,900
How can I remove value **"288"** from **"pecan"** and return the updated array. Array like so: ``` a: 10: { s: 13: "Fraser Island"; a: 7: { i: 0; i: 303; i: 1; i: 34; i: 2; i: 27; i: 3; i: 291; i: 4; i: 293; i: 5; i: 37; i: 6; i: 288; } s: 5: "pecan"; a: 5: { ...
2017/06/08
[ "https://Stackoverflow.com/questions/44446900", "https://Stackoverflow.com", "https://Stackoverflow.com/users/568504/" ]
So you know you are looking under the `pecan` key and you know you are looking for `288`, so just search to return the key and `unset()`: ``` $key = 'pecan'; $val = '288'; unset($array[0][$key][array_search($val, $array[0][$key])]); ``` To re-index: ``` $array[0][$key] = array_values($array[0][$key]); ``` Or to ...
This function will remove Element From specific **Indexed/Associative** array: ``` function removeElement($array, $value) { if(is_array($array)) { $key = array_search($value,$array); if(!isset($key)) { unset($array[$key]); return $array; } } } ``` This function will remov...
44,446,900
How can I remove value **"288"** from **"pecan"** and return the updated array. Array like so: ``` a: 10: { s: 13: "Fraser Island"; a: 7: { i: 0; i: 303; i: 1; i: 34; i: 2; i: 27; i: 3; i: 291; i: 4; i: 293; i: 5; i: 37; i: 6; i: 288; } s: 5: "pecan"; a: 5: { ...
2017/06/08
[ "https://Stackoverflow.com/questions/44446900", "https://Stackoverflow.com", "https://Stackoverflow.com/users/568504/" ]
Try `remove_element_by_value($arr, '288', 'pecan')` ``` // DELETE VALUE FROM ARRAY function remove_element_by_value($arr, $val, $keyToSearch) { $keyOfValue = array_search($val, $arr[0][$keyToSearch]); unset($arr[0][$keyToSearch][$keyOfValue]); $arr[0][$keyToSearch] = array_v...
``` // DELETE VALUE FROM ARRAY function remove_element_by_value($arr, $key ,$val ) { $return = array(); foreach($arr as $k => $v) { if(is_array($v)) { $return[$k] = remove_element_by_value($v, $val); //recursion continue; } if($v == $val && $k == $key) continue; ...
44,446,900
How can I remove value **"288"** from **"pecan"** and return the updated array. Array like so: ``` a: 10: { s: 13: "Fraser Island"; a: 7: { i: 0; i: 303; i: 1; i: 34; i: 2; i: 27; i: 3; i: 291; i: 4; i: 293; i: 5; i: 37; i: 6; i: 288; } s: 5: "pecan"; a: 5: { ...
2017/06/08
[ "https://Stackoverflow.com/questions/44446900", "https://Stackoverflow.com", "https://Stackoverflow.com/users/568504/" ]
Try `remove_element_by_value($arr, '288', 'pecan')` ``` // DELETE VALUE FROM ARRAY function remove_element_by_value($arr, $val, $keyToSearch) { $keyOfValue = array_search($val, $arr[0][$keyToSearch]); unset($arr[0][$keyToSearch][$keyOfValue]); $arr[0][$keyToSearch] = array_v...
This function will remove Element From specific **Indexed/Associative** array: ``` function removeElement($array, $value) { if(is_array($array)) { $key = array_search($value,$array); if(!isset($key)) { unset($array[$key]); return $array; } } } ``` This function will remov...
48,689,743
I want to have one of those "i" icons appear next to a name on my site so people can click on it and look up more information. I have this HTML ``` <div id="personName"><h2>PersonA</h2> <div id="moreInfo">i</div></div> ``` and the below style ``` #personName { display: block; } #moreInfo { border-radiu...
2018/02/08
[ "https://Stackoverflow.com/questions/48689743", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
That's because `box-sizing: border-box` includes both the `border` *and the `padding`* in the height computations. Which means that if you create an element with `height: 30px` and `padding-top: 5px`, it will be 35px tall (height + padding) but with setting `box-sizing: border-box`, it will be 30px tall. In your spec...
As per Jesse de Bruijne's answer, you can set the padding property within the #moreInfo selector to 0. If you can, try and reduce the font size of the i, to better position it (I'm using Chrome). Setting it to 30px seems to show it better. ``` #moreInfo { ... padding: 0; font: 30px Arial, sans-serif; ....
13,670,217
I'm using passport.js to authenticate users. I would like to be able to pass a username, collected from the user, which will reach the end of the authentication process so that I can store the username when I create the user (if it doesn't yet exist). I've tried this: ``` app.get("/auth/google", function(request, resp...
2012/12/02
[ "https://Stackoverflow.com/questions/13670217", "https://Stackoverflow.com", "https://Stackoverflow.com/users/164506/" ]
You can pass a *state* object to passport.authenticate, like so: ``` passport.authenticate("google", { scope: [ "https://www.googleapis.com/auth/userinfo.profile", "https://www.googleapis.com/auth/userinfo.email" ], state: request.query.username })(request, response); ``` You can acce...
For anyone using OpenID, req.query seems to be overwritten by the OpenId query params and thus can't be passed through directly. You can attach variables to req.session however. ``` router.get('/auth/social', (req, res, next) => { req.session.foo = req.query.foo; next(); }, passport.authenticate('social')); ``` ...
48,677,557
For some reason I'm getting this error: > > Uncaught ReferenceError: $stateProvider is not defined > > > even though `angular-ui-router.js` is being loaded fine. Here is my code ``` (function () { var mod = angular.module('MyApp', ['ui.router']); debugger; mod.config(['$stateProvider', '$locationPr...
2018/02/08
[ "https://Stackoverflow.com/questions/48677557", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8701373/" ]
I had a similar problem, when doing apt-get upgrade... The problem is that apt-get was trying to use python2.7, but the symlink was pointing to python3.4: ``` debian:/usr/bin# cat /etc/debian_version 8.10 debian:/usr/bin# ll /usr/bin/python lrwxrwxrwx 1 root root 18 Feb 26 17:02 /usr/bin/python -> /usr/bin/python3.4 ...
Install python-dev module for specific version of python: ``` sudo apt install python3.6-dev ```
48,677,557
For some reason I'm getting this error: > > Uncaught ReferenceError: $stateProvider is not defined > > > even though `angular-ui-router.js` is being loaded fine. Here is my code ``` (function () { var mod = angular.module('MyApp', ['ui.router']); debugger; mod.config(['$stateProvider', '$locationPr...
2018/02/08
[ "https://Stackoverflow.com/questions/48677557", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8701373/" ]
If you look at `/usr/bin/add-apt-repository` it says ``` #!/usr/bin/python3 ``` at the top. If you updated with a newer python (e.g. dist had 3.5 but you installed 3.7) your `/usr/bin/python3` points to a python that does not have `apt_pkg`. You can temporarily edit `/usr/bin/add-apt-repository` to point to ``` #!...
Install python-dev module for specific version of python: ``` sudo apt install python3.6-dev ```
48,677,557
For some reason I'm getting this error: > > Uncaught ReferenceError: $stateProvider is not defined > > > even though `angular-ui-router.js` is being loaded fine. Here is my code ``` (function () { var mod = angular.module('MyApp', ['ui.router']); debugger; mod.config(['$stateProvider', '$locationPr...
2018/02/08
[ "https://Stackoverflow.com/questions/48677557", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8701373/" ]
This is likely because you switched python versions in a weird way. Do you have `/usr/lib/python3/dist-packages/apt_pkg.so` ? This can be missing if you removed a version of python. The answer that worked for me was this from [askubuntu forums](https://askubuntu.com/questions/1069087/modulenotfounderror-no-module-name...
Install python-dev module for specific version of python: ``` sudo apt install python3.6-dev ```
42,477,624
This days I try to create an abstract base repository using some basic CRUD functions proposed by [DapperExtensions](https://github.com/tmsmith/Dapper-Extensions). But the code given as an exemple use a SqlConnection which is made to connect to a SQL Server database. I want to be able to connect to all kind of Database...
2017/02/27
[ "https://Stackoverflow.com/questions/42477624", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7208185/" ]
Try this: ``` var results = lines .Aggregate(new[] { new List<string>() }.ToList(), (a, x) => { if (x.StartsWith("Student")) { a.Add(new List<string>()); } a.Last().Add(x); return a; }) .Skip(1) .Sel...
It is really vague what you are trying to do but here is a very basic example of what I think you are doing. Now the only thing you need to do is change the `fileName` param. ``` static void Main(string[] args) { string line = null; Student student = null; IList<Student> students = new List<Student>(); ...
42,477,624
This days I try to create an abstract base repository using some basic CRUD functions proposed by [DapperExtensions](https://github.com/tmsmith/Dapper-Extensions). But the code given as an exemple use a SqlConnection which is made to connect to a SQL Server database. I want to be able to connect to all kind of Database...
2017/02/27
[ "https://Stackoverflow.com/questions/42477624", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7208185/" ]
Something like this ``` if (args.Length < 1) return; // optional check if any args string text = File.ReadAllText(args[0]); string[] parts = text.Split(new[] { "Student" }, 0); string[][] lines = Array.ConvertAll(parts, part => part.Split(new[] { '\r', '\n' }, 1)); Debug.Print(lines[1][1]); ...
It is really vague what you are trying to do but here is a very basic example of what I think you are doing. Now the only thing you need to do is change the `fileName` param. ``` static void Main(string[] args) { string line = null; Student student = null; IList<Student> students = new List<Student>(); ...
42,477,624
This days I try to create an abstract base repository using some basic CRUD functions proposed by [DapperExtensions](https://github.com/tmsmith/Dapper-Extensions). But the code given as an exemple use a SqlConnection which is made to connect to a SQL Server database. I want to be able to connect to all kind of Database...
2017/02/27
[ "https://Stackoverflow.com/questions/42477624", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7208185/" ]
Try this: ``` var results = lines .Aggregate(new[] { new List<string>() }.ToList(), (a, x) => { if (x.StartsWith("Student")) { a.Add(new List<string>()); } a.Last().Add(x); return a; }) .Skip(1) .Sel...
Something like this ``` if (args.Length < 1) return; // optional check if any args string text = File.ReadAllText(args[0]); string[] parts = text.Split(new[] { "Student" }, 0); string[][] lines = Array.ConvertAll(parts, part => part.Split(new[] { '\r', '\n' }, 1)); Debug.Print(lines[1][1]); ...
21,168,556
So I am calling the save method of my repository. ``` //Store Controller private StoreService; Store s = new Store(); s.setName("some store"); storeService.createStore(s); ``` -- ``` //StoreServiceImpl private StoreRepository storeRepository; public void createStore(Store s) { storeRepository.save(s); } ``` ...
2014/01/16
[ "https://Stackoverflow.com/questions/21168556", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1099123/" ]
I've figured it out. I needed to create a jpaTransactionManager and set my entityManager within it. Then, I needed to wrap the jpaTransactionManager in a TransactionProxyFactoryBean. Then I needed to create my StoreService bean in the xml as a proxy to TransactionProxyFactoryBean. After that, all calls to save went thr...
Because your `Store` ids are assigned,thus Hibernate has no idea if a given `id` value exists yet in the database. So by default it checks (*execute* `SELECT` *statement*) against the database to see If this `Store` already exists into database or not and then fire `INSERT` statement.
43,921,865
I have a CSV text file that is causing me a headache. The file itself is quiet big. Below is a sample of the file and the problem within it. The carriage returns in the comment section are breaking the CSV structure and cause an issue during an import of data in Excel. How do I fix this? ``` "DataId" "mpi_id" "p...
2017/05/11
[ "https://Stackoverflow.com/questions/43921865", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7782271/" ]
This css code will make the div stick to top of screen ------------------------------------------------------ position:fixed;top:0px;Right:0px;Left:0px;
This might be worth looking into. [jquery how to get the page's current screen top position?](https://stackoverflow.com/questions/7019353/jquery-how-to-get-the-pages-current-screen-top-position) Then in your CSS I would set the position to absolute like this: ``` position: absolute; ``` I assume you already have a ...
43,921,865
I have a CSV text file that is causing me a headache. The file itself is quiet big. Below is a sample of the file and the problem within it. The carriage returns in the comment section are breaking the CSV structure and cause an issue during an import of data in Excel. How do I fix this? ``` "DataId" "mpi_id" "p...
2017/05/11
[ "https://Stackoverflow.com/questions/43921865", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7782271/" ]
This css code will make the div stick to top of screen ------------------------------------------------------ position:fixed;top:0px;Right:0px;Left:0px;
``` enter code here ``` ```html <table> <tr> <td style="width:100px; height:500px; background:#00aa00"> foo </td> <td style="float:right"> bar </td> </tr> </table> ``` Should make it so that it stays on our screen no matter how far down you scroll or if you want the on the right to appe...
43,921,865
I have a CSV text file that is causing me a headache. The file itself is quiet big. Below is a sample of the file and the problem within it. The carriage returns in the comment section are breaking the CSV structure and cause an issue during an import of data in Excel. How do I fix this? ``` "DataId" "mpi_id" "p...
2017/05/11
[ "https://Stackoverflow.com/questions/43921865", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7782271/" ]
This might be worth looking into. [jquery how to get the page's current screen top position?](https://stackoverflow.com/questions/7019353/jquery-how-to-get-the-pages-current-screen-top-position) Then in your CSS I would set the position to absolute like this: ``` position: absolute; ``` I assume you already have a ...
``` enter code here ``` ```html <table> <tr> <td style="width:100px; height:500px; background:#00aa00"> foo </td> <td style="float:right"> bar </td> </tr> </table> ``` Should make it so that it stays on our screen no matter how far down you scroll or if you want the on the right to appe...
59,235
I've configured a Fedora 11 installation to join our domain. It seems to join successfully (though it reports a DNS update failure) but when I try to access \\fedoraserver.test.mycompany.com I'm prompted for a password. So I enter adminuser and the password and that fails, so I try `test.mycompany.com\adminuser` and th...
2009/08/26
[ "https://serverfault.com/questions/59235", "https://serverfault.com", "https://serverfault.com/users/9107/" ]
From the linux box try: ``` $ kinit your_username ``` And enter your password. Then enter: ``` $ klist ``` And see if you have a valid kerberos ticket. In my krb5.conf file I do not have any port numbers in my realms section. Additionally, in the domain\_realm section I have something like this: ``` MY-DC1.COMP...
I would expect that the DNS update failure is your clue here - Windows/Linux (or Unix) interoperability is by no means as seamless as it's sometimes advertised to be. Make sure that your other machines can resolve name-to-IP and IP-to-name for the new box, and if not, add the appropriate DNS records. Then try it and se...
59,235
I've configured a Fedora 11 installation to join our domain. It seems to join successfully (though it reports a DNS update failure) but when I try to access \\fedoraserver.test.mycompany.com I'm prompted for a password. So I enter adminuser and the password and that fails, so I try `test.mycompany.com\adminuser` and th...
2009/08/26
[ "https://serverfault.com/questions/59235", "https://serverfault.com", "https://serverfault.com/users/9107/" ]
Sorry for the late reply but maybe I can help someone with the DNS problem once he/she has it. I resolved the DNS problem by adding a mapping to the Fully Qualified DomainName to the address of the Domain Controller such as so: Domain: herazio.com DC: HER-PDC /etc/hosts file: HER-PDC.herazio.com 192.50.2.2 This reso...
I would expect that the DNS update failure is your clue here - Windows/Linux (or Unix) interoperability is by no means as seamless as it's sometimes advertised to be. Make sure that your other machines can resolve name-to-IP and IP-to-name for the new box, and if not, add the appropriate DNS records. Then try it and se...
10,656,060
I'm having a hard time getting a javascript confirm box from asp:buttonfield: This is the original code of the Gridview, however buttonfield does not seem to accept "onClientClick" ``` <asp:GridView ID="gvNavios" runat="server" onrowcommand="gvNavios_RowCommand"> <Columns> <asp:ButtonField runat="server" ButtonT...
2012/05/18
[ "https://Stackoverflow.com/questions/10656060", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1403744/" ]
This problem was solved in another question I subsequently asked which can be found here... [iOS - Math help - base image zooms with pinch gesture need overlaid images adjust X/Y coords relative](https://stackoverflow.com/questions/10709280/ios-math-help-base-image-zooms-with-pinch-gesture-need-overlaid-images-adjus) ...
You have to be working out the coordinates for the pins in a mathematical way rather then using pixels for example if your image was 100 x 100 and you wanted to put the pin in the centre point of the map rather then setting the x and y coordinates to (50, 50) you set them to (image.size.width/2,image.size.height/2) bec...
144,551
I've recently finished a MS in computer engineering and long term it's likely that I'll look into doing a PhD. One of the reasons I didnt do it straight away is that I dont really have a clue what I'd like to do it in. I enjoyed parts of EE, CE, applied mathematics, and CS. Both to maybe look for what areas I'd most ...
2020/02/22
[ "https://academia.stackexchange.com/questions/144551", "https://academia.stackexchange.com", "https://academia.stackexchange.com/users/81211/" ]
You can search university reading lists, e.g., [https://www.google.com/search?q="reading list"%20"applied mathematics"%20site:edu](https://www.google.com/search?q=%22reading%20list%22%20%22applied%20mathematics%22%20site:edu), replacing *applied mathematics* with phrases to hone in your search.
See the schools you are interested in, check out the descriptions of their MS/PhD programs. There you should see what graduate classes are offered. Their reading lists should give a starting point.
20,483,619
I've been working on some build scripts, and this is bugging me. I want to be sure that we're independent of environment settings, but in order to be sure of that I feel a need to understand how/where the settings are used by the tools. The Visual Studio command prompt and/or vcvarsall.bat file set up two distinct env...
2013/12/10
[ "https://Stackoverflow.com/questions/20483619", "https://Stackoverflow.com", "https://Stackoverflow.com/users/622571/" ]
`LIB` is for the linker, helps it find import and static libraries. `LIBPATH` is for the compiler, helps it find metadata files. Like type libraries, .NET assemblies, WinRT .winmd files.
The `LIB` environment-variable is passed to the **linker**, and helps it to find and import **`.lib`** files. > > And that, no matter if `.lib` file belongs to dynamic or static library. > > > The `LIBPATH`environment-variable is passed to the **compiler**, and helps it to find **meta-data** files. > > Like .NE...
25,838,316
I am trying to write a bash script to list the size of each file/subdir of the current directory, as follows: ``` for f in $(ls -A) do du -sh $f done ``` I used `ls -A` because I need to include hidden files/dirs starting with a dot, like `.ssh`. However, the script above cannot handle spaces if the file names i...
2014/09/14
[ "https://Stackoverflow.com/questions/25838316", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4196578/" ]
Dont parse the output from `ls`. When the file contains a space, the `$f` contains the parts of teh filename splitted on the space, and therefore the double quotes doesn't got the whole filename The next will work and will do the same as your script ``` GLOBIGNORE=".:.." #ignore . and .. shopt -s dotglob #the * wi...
I generally prefer using the program `find` if a `for` loop would cause headaches. In your case, it is really simple: ``` $ find . -maxdepth 1 -exec du -sh '{}' \; ``` There are a number of security issues with using `-exec` which is why GNU `find` supports the safer `-execdir` that should be preferred if available....
25,838,316
I am trying to write a bash script to list the size of each file/subdir of the current directory, as follows: ``` for f in $(ls -A) do du -sh $f done ``` I used `ls -A` because I need to include hidden files/dirs starting with a dot, like `.ssh`. However, the script above cannot handle spaces if the file names i...
2014/09/14
[ "https://Stackoverflow.com/questions/25838316", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4196578/" ]
Unless the directory is so big that the list of file names is too big: ``` du -sh * .* ``` Be aware that this will include `.` and `..`, though. If you want to eliminate `..` (probably a good idea), you can use: ``` for file in * .* do [ "$file" = ".." ] && continue du -sh "$file" # Double quotes important...
I generally prefer using the program `find` if a `for` loop would cause headaches. In your case, it is really simple: ``` $ find . -maxdepth 1 -exec du -sh '{}' \; ``` There are a number of security issues with using `-exec` which is why GNU `find` supports the safer `-execdir` that should be preferred if available....
25,838,316
I am trying to write a bash script to list the size of each file/subdir of the current directory, as follows: ``` for f in $(ls -A) do du -sh $f done ``` I used `ls -A` because I need to include hidden files/dirs starting with a dot, like `.ssh`. However, the script above cannot handle spaces if the file names i...
2014/09/14
[ "https://Stackoverflow.com/questions/25838316", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4196578/" ]
I generally prefer using the program `find` if a `for` loop would cause headaches. In your case, it is really simple: ``` $ find . -maxdepth 1 -exec du -sh '{}' \; ``` There are a number of security issues with using `-exec` which is why GNU `find` supports the safer `-execdir` that should be preferred if available....
Try this: ``` ls -A | while read -r line do du -sh "$line" done ``` Instead of checking for the `ls -A` output word by word, the while loop checks line by line. This way, you don't need to change the IFS variable.
25,838,316
I am trying to write a bash script to list the size of each file/subdir of the current directory, as follows: ``` for f in $(ls -A) do du -sh $f done ``` I used `ls -A` because I need to include hidden files/dirs starting with a dot, like `.ssh`. However, the script above cannot handle spaces if the file names i...
2014/09/14
[ "https://Stackoverflow.com/questions/25838316", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4196578/" ]
I generally prefer using the program `find` if a `for` loop would cause headaches. In your case, it is really simple: ``` $ find . -maxdepth 1 -exec du -sh '{}' \; ``` There are a number of security issues with using `-exec` which is why GNU `find` supports the safer `-execdir` that should be preferred if available....
Time to summarize. Assuming you are using Linux, this should work in most (if not all) cases. ``` find -maxdepth 1 -mindepth 1 -print0 | xargs -r -0 du -sh ```
25,838,316
I am trying to write a bash script to list the size of each file/subdir of the current directory, as follows: ``` for f in $(ls -A) do du -sh $f done ``` I used `ls -A` because I need to include hidden files/dirs starting with a dot, like `.ssh`. However, the script above cannot handle spaces if the file names i...
2014/09/14
[ "https://Stackoverflow.com/questions/25838316", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4196578/" ]
Dont parse the output from `ls`. When the file contains a space, the `$f` contains the parts of teh filename splitted on the space, and therefore the double quotes doesn't got the whole filename The next will work and will do the same as your script ``` GLOBIGNORE=".:.." #ignore . and .. shopt -s dotglob #the * wi...
Try this: ``` ls -A | while read -r line do du -sh "$line" done ``` Instead of checking for the `ls -A` output word by word, the while loop checks line by line. This way, you don't need to change the IFS variable.
25,838,316
I am trying to write a bash script to list the size of each file/subdir of the current directory, as follows: ``` for f in $(ls -A) do du -sh $f done ``` I used `ls -A` because I need to include hidden files/dirs starting with a dot, like `.ssh`. However, the script above cannot handle spaces if the file names i...
2014/09/14
[ "https://Stackoverflow.com/questions/25838316", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4196578/" ]
Dont parse the output from `ls`. When the file contains a space, the `$f` contains the parts of teh filename splitted on the space, and therefore the double quotes doesn't got the whole filename The next will work and will do the same as your script ``` GLOBIGNORE=".:.." #ignore . and .. shopt -s dotglob #the * wi...
Time to summarize. Assuming you are using Linux, this should work in most (if not all) cases. ``` find -maxdepth 1 -mindepth 1 -print0 | xargs -r -0 du -sh ```
25,838,316
I am trying to write a bash script to list the size of each file/subdir of the current directory, as follows: ``` for f in $(ls -A) do du -sh $f done ``` I used `ls -A` because I need to include hidden files/dirs starting with a dot, like `.ssh`. However, the script above cannot handle spaces if the file names i...
2014/09/14
[ "https://Stackoverflow.com/questions/25838316", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4196578/" ]
Unless the directory is so big that the list of file names is too big: ``` du -sh * .* ``` Be aware that this will include `.` and `..`, though. If you want to eliminate `..` (probably a good idea), you can use: ``` for file in * .* do [ "$file" = ".." ] && continue du -sh "$file" # Double quotes important...
Try this: ``` ls -A | while read -r line do du -sh "$line" done ``` Instead of checking for the `ls -A` output word by word, the while loop checks line by line. This way, you don't need to change the IFS variable.
25,838,316
I am trying to write a bash script to list the size of each file/subdir of the current directory, as follows: ``` for f in $(ls -A) do du -sh $f done ``` I used `ls -A` because I need to include hidden files/dirs starting with a dot, like `.ssh`. However, the script above cannot handle spaces if the file names i...
2014/09/14
[ "https://Stackoverflow.com/questions/25838316", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4196578/" ]
Unless the directory is so big that the list of file names is too big: ``` du -sh * .* ``` Be aware that this will include `.` and `..`, though. If you want to eliminate `..` (probably a good idea), you can use: ``` for file in * .* do [ "$file" = ".." ] && continue du -sh "$file" # Double quotes important...
Time to summarize. Assuming you are using Linux, this should work in most (if not all) cases. ``` find -maxdepth 1 -mindepth 1 -print0 | xargs -r -0 du -sh ```
18,416,178
I know this question was asked so many times but I never found an answer that relates to my question. I am trying to install Apache Tomcat server on my MacBook Pro. All answers were answered for Windows and Eclipse. I want to install and configure the server using Terminal. So the problem is happening at the last step ...
2013/08/24
[ "https://Stackoverflow.com/questions/18416178", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1319943/" ]
You say you've got the latest version, but then you also say you're using Java 1.6\_051. That is *not* the latest version of Java. You need Java 7 - see [this page](http://www.java.com/en/download/faq/java_mac.xml) for how to install Java 7 on Mac OSX. If you can't install Java 7 on your machine for some reason, you'...
For Tomcat 8 Any installed Java 7 or later JRE (32-bit or 64-bit) may be used. Please read the requirements <http://tomcat.apache.org/tomcat-8.0-doc/setup.html>
17,787,761
I've a problem with my sendto function in my code, when I try to send a raw ethernet packet. I use a Ubuntu 12.04.01 LTS, with two tap devices connected over two vde\_switches and a dpipe Example: my send programm create the packet like below, the programm is binded by the socket from tap0 and send the packet to tap...
2013/07/22
[ "https://Stackoverflow.com/questions/17787761", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2590572/" ]
Just use a standard javascript object: ``` var dictionary = {};//create new object dictionary["key1"] = value1;//set key1 var key1 = dictionary["key1"];//get key1 ``` NOTE: You can also get/set any "keys" you create using dot notation (i.e. `dictionary.key1`) --- You could take that further if you wanted specific ...
``` var widget={}; var key='k'; widget[key]='v'; alert(widget.k);//gives you v ```
17,787,761
I've a problem with my sendto function in my code, when I try to send a raw ethernet packet. I use a Ubuntu 12.04.01 LTS, with two tap devices connected over two vde\_switches and a dpipe Example: my send programm create the packet like below, the programm is binded by the socket from tap0 and send the packet to tap...
2013/07/22
[ "https://Stackoverflow.com/questions/17787761", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2590572/" ]
Just use a standard javascript object: ``` var dictionary = {};//create new object dictionary["key1"] = value1;//set key1 var key1 = dictionary["key1"];//get key1 ``` NOTE: You can also get/set any "keys" you create using dot notation (i.e. `dictionary.key1`) --- You could take that further if you wanted specific ...
How about this class taken from [Marijn Havereke's book Eloquent JavaScript](http://eloquentjavascript.net/1st_edition/chapter8.html) [The fiddle](http://jsfiddle.net/ktabarez/X3AJ7/) ``` function Dictionary(values) { this.values = values || {}; var forEachIn = function (object, action) { for (var pro...
17,787,761
I've a problem with my sendto function in my code, when I try to send a raw ethernet packet. I use a Ubuntu 12.04.01 LTS, with two tap devices connected over two vde\_switches and a dpipe Example: my send programm create the packet like below, the programm is binded by the socket from tap0 and send the packet to tap...
2013/07/22
[ "https://Stackoverflow.com/questions/17787761", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2590572/" ]
How about this class taken from [Marijn Havereke's book Eloquent JavaScript](http://eloquentjavascript.net/1st_edition/chapter8.html) [The fiddle](http://jsfiddle.net/ktabarez/X3AJ7/) ``` function Dictionary(values) { this.values = values || {}; var forEachIn = function (object, action) { for (var pro...
``` var widget={}; var key='k'; widget[key]='v'; alert(widget.k);//gives you v ```
17,077,777
I have this text field: ``` <input id="address" type="text" value=""> ``` and this button: ``` <input id="ricerca" type="button" class="enter" value="GO!"> ``` and jQuery: ``` $("#ricerca").click(function(){ var e = jQuery.Event('keypress'); e.which = 13; // #13 = Enter key $("#address").focus(); ...
2013/06/13
[ "https://Stackoverflow.com/questions/17077777", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1869672/" ]
define what should happen on keypress event for `#address`. Look at this code. Press enter key from insde the text box and then click on the button, both trigger the keypress event. demo - <http://jsbin.com/ocohev/1/edit> ``` $(function () { $('#address').keypress(function (event) { if (eve...
Use this Jquery code: ``` $("#id_of_textbox").keyup(function(event){ if(event.keyCode == 13){ $("#id_of_button").click(); } }); ```
482,217
In the aftermath of the recent storms in the UK, one of my neighbours reported a flash and loud bang from his local transformer station, and the power briefly cut out. After that, several households reported their appliances malfunctioning, including a hair-dryer getting dangerously hot, the smell of burning from soc...
2020/02/20
[ "https://electronics.stackexchange.com/questions/482217", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/131417/" ]
A broken neutral can cause serious over-voltages on an electricity supply. UK supplies are usually three-phase and neutral, with approximately 415V between phases, and 240V between any one phase and neutral. The secondary of the substation is "star" wound, with the neutral being the common point. Most UK houses are su...
Sounds like either a step down transformer failed and you all got a seriously high voltage and current spike, or it was a lightning strike on the power station. In either case the surge would likely have shorted out insulation on things like motors. The voltage might well have jumped into the tens of kV briefly. Howev...
482,217
In the aftermath of the recent storms in the UK, one of my neighbours reported a flash and loud bang from his local transformer station, and the power briefly cut out. After that, several households reported their appliances malfunctioning, including a hair-dryer getting dangerously hot, the smell of burning from soc...
2020/02/20
[ "https://electronics.stackexchange.com/questions/482217", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/131417/" ]
We have a [HNQ question on that](https://diy.stackexchange.com/questions/185036/why-is-my-voltage-dropping-with-load-and-why-is-current-flowing-on-my-ground-wir/185045#185045) right now over on diy.stackexchange. That problem is a *little* different since that person gets 2 phases (hot-neutral-hot), and most UK homes...
Sounds like either a step down transformer failed and you all got a seriously high voltage and current spike, or it was a lightning strike on the power station. In either case the surge would likely have shorted out insulation on things like motors. The voltage might well have jumped into the tens of kV briefly. Howev...
482,217
In the aftermath of the recent storms in the UK, one of my neighbours reported a flash and loud bang from his local transformer station, and the power briefly cut out. After that, several households reported their appliances malfunctioning, including a hair-dryer getting dangerously hot, the smell of burning from soc...
2020/02/20
[ "https://electronics.stackexchange.com/questions/482217", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/131417/" ]
A broken neutral can cause serious over-voltages on an electricity supply. UK supplies are usually three-phase and neutral, with approximately 415V between phases, and 240V between any one phase and neutral. The secondary of the substation is "star" wound, with the neutral being the common point. Most UK houses are su...
We have a [HNQ question on that](https://diy.stackexchange.com/questions/185036/why-is-my-voltage-dropping-with-load-and-why-is-current-flowing-on-my-ground-wir/185045#185045) right now over on diy.stackexchange. That problem is a *little* different since that person gets 2 phases (hot-neutral-hot), and most UK homes...
6,689
I use a chest freezer with a Brewpad heating element stuck to the inside wall (for warmer fermentations/bottle conditioning), and a single-stage Johnson controller. Since getting this, I haven't used the freezer's compressor to cool the chamber, only the heating element, as ambient temps in my basement have been in the...
2012/03/22
[ "https://homebrew.stackexchange.com/questions/6689", "https://homebrew.stackexchange.com", "https://homebrew.stackexchange.com/users/1870/" ]
You are doing the right thing. Ambient temperature (aka the air temperature inside the chest) can go low like this, but since the probe is taped to the fermentation vessel, and the controller is calling for chilling, then chilling is what is needed. The thermal mass of the chest walls, cooling tubes, freon, and the air...
Adding a computer fan inside my chest freezer really helped with the humidity issues. I use one of these [USB fans](http://rads.stackoverflow.com/amzn/click/B00080G0BK). It has a flat cable so it fits fine in the closed door with no need to drill a hole anywhere. Also they're much worse in the warmer months when there'...
53,799,113
Okay there are a few ways to print your variables. For instance: ``` > x<-27 > x ``` Or you can do ``` > (x<-27) ``` But is there a way to do this after youve hit enter? For example ``` > reallyreallylongvariablenamehere<-52 > #now I have to type out the reallylongvariablename all over > reallyreallylongvariab...
2018/12/16
[ "https://Stackoverflow.com/questions/53799113", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5874160/" ]
You can use `.Last.value`. ``` x <- 27 .Last.value # [1] 27 ```
The `.Last.value` option suggested by *@RichScriven* is perfect. But you can do something that is more elegant, like using the `.` (or any other character) to show the value of the lastly assigned value. Just execute the following to make the `.` capture the work of `.Last.value` : ``` makeActiveBinding(".", functio...
11,137,084
I'm just starting out in Java, and only ever used PHP before - finding it hard to get my head round the object-orientated thing. I am using the Eclipse IDE. I am trying to make a program that will tell you your weight on another planet - seems simple enough All I have done so far is make half the interface in Swing (...
2012/06/21
[ "https://Stackoverflow.com/questions/11137084", "https://Stackoverflow.com", "https://Stackoverflow.com/users/979052/" ]
You should * only manipulate Swing components inside the [event dispatch thread](http://docs.oracle.com/javase/tutorial/uiswing/concurrency/); * call `setVisible(true)` only after all the components have been added to the frame; * spell *Planet* with only one *n*, although that's less important. The `<Object>` that "...
You need to do everything dealing with Swing components inside the EventDispatchThread (EDT). wrap the call to `new View()` in a call to `SwingUtilities.invokeAndWait()`
11,137,084
I'm just starting out in Java, and only ever used PHP before - finding it hard to get my head round the object-orientated thing. I am using the Eclipse IDE. I am trying to make a program that will tell you your weight on another planet - seems simple enough All I have done so far is make half the interface in Swing (...
2012/06/21
[ "https://Stackoverflow.com/questions/11137084", "https://Stackoverflow.com", "https://Stackoverflow.com/users/979052/" ]
You should * only manipulate Swing components inside the [event dispatch thread](http://docs.oracle.com/javase/tutorial/uiswing/concurrency/); * call `setVisible(true)` only after all the components have been added to the frame; * spell *Planet* with only one *n*, although that's less important. The `<Object>` that "...
Try this out: ``` public static void main(String[] args) { View sal = new View(); sal.setSize(500, 400); sal.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); sal.setVisible(true); ``` } Comment these lines after the constructor: ``` super(titleText); setSize(500,400)...
11,137,084
I'm just starting out in Java, and only ever used PHP before - finding it hard to get my head round the object-orientated thing. I am using the Eclipse IDE. I am trying to make a program that will tell you your weight on another planet - seems simple enough All I have done so far is make half the interface in Swing (...
2012/06/21
[ "https://Stackoverflow.com/questions/11137084", "https://Stackoverflow.com", "https://Stackoverflow.com/users/979052/" ]
You should * only manipulate Swing components inside the [event dispatch thread](http://docs.oracle.com/javase/tutorial/uiswing/concurrency/); * call `setVisible(true)` only after all the components have been added to the frame; * spell *Planet* with only one *n*, although that's less important. The `<Object>` that "...
Always call `pack()`. This version works reliably (at least to appear). ``` import javax.swing.*; import java.awt.*; public class View extends JFrame { static String titleText = "Calculate your Weight on another Planet"; public View(){ super(titleText); // not now! //setSize(500,400)...
11,137,084
I'm just starting out in Java, and only ever used PHP before - finding it hard to get my head round the object-orientated thing. I am using the Eclipse IDE. I am trying to make a program that will tell you your weight on another planet - seems simple enough All I have done so far is make half the interface in Swing (...
2012/06/21
[ "https://Stackoverflow.com/questions/11137084", "https://Stackoverflow.com", "https://Stackoverflow.com/users/979052/" ]
You need to do everything dealing with Swing components inside the EventDispatchThread (EDT). wrap the call to `new View()` in a call to `SwingUtilities.invokeAndWait()`
Try this out: ``` public static void main(String[] args) { View sal = new View(); sal.setSize(500, 400); sal.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); sal.setVisible(true); ``` } Comment these lines after the constructor: ``` super(titleText); setSize(500,400)...
11,137,084
I'm just starting out in Java, and only ever used PHP before - finding it hard to get my head round the object-orientated thing. I am using the Eclipse IDE. I am trying to make a program that will tell you your weight on another planet - seems simple enough All I have done so far is make half the interface in Swing (...
2012/06/21
[ "https://Stackoverflow.com/questions/11137084", "https://Stackoverflow.com", "https://Stackoverflow.com/users/979052/" ]
Always call `pack()`. This version works reliably (at least to appear). ``` import javax.swing.*; import java.awt.*; public class View extends JFrame { static String titleText = "Calculate your Weight on another Planet"; public View(){ super(titleText); // not now! //setSize(500,400)...
Try this out: ``` public static void main(String[] args) { View sal = new View(); sal.setSize(500, 400); sal.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); sal.setVisible(true); ``` } Comment these lines after the constructor: ``` super(titleText); setSize(500,400)...
73,757
I was reading how a very small amount of people have perfect pitch and how it's very hard for adults to develop it. So I was wondering if maybe there's a hack where I can only limit the notes to a scale and then instead of having to choose between 12 notes I could just limit the choices to the 7 notes of a scale. Is ...
2018/08/15
[ "https://music.stackexchange.com/questions/73757", "https://music.stackexchange.com", "https://music.stackexchange.com/users/-1/" ]
First, I should pass along that people who have more experience with perfect pitch than I do emphatically state that true perfect pitch (hearing a note and instantly knowing what pitch it is) cannot be learned as an adult. There may be agreement or disagreement, but that is what I'm told, and being in the field of musi...
Yes, it's conceivable that this could be a good training strategy. Start by trying to learn a limited range of pitches. Makes sense. Of course, once you've got ONE pitch right, you're going to find it hard to seperate Perfect Pitch from Relative Pitch. I suggest you don't worry too much about developing Perfect Pitch...
64,400
I want to set "Formula" to all cells in certain column **whatever the number of rows was**. **But i don't want to set this function to first cell "Header" of this column**. How do i make it ?.
2009/11/02
[ "https://superuser.com/questions/64400", "https://superuser.com", "https://superuser.com/users/15307/" ]
If your header is in cell A1 and your formulas need to start in A2 and go to the end, **start by selecting A2, press (and release) "End" then press "Shift+Down Arrow"**. Now everything from A2 to the end is selected and you can paste your formula. If you have no data in A2-A65535, you will select the entire range. If y...
I think you may have to reword this a little for people to understand exactly what you are after. Are you trying to reference the range of all cells in a column except for the header? Most likely you can do this using an OFFSET with a COUNTA function inside, for example to get all of column A without the header you cou...
64,400
I want to set "Formula" to all cells in certain column **whatever the number of rows was**. **But i don't want to set this function to first cell "Header" of this column**. How do i make it ?.
2009/11/02
[ "https://superuser.com/questions/64400", "https://superuser.com", "https://superuser.com/users/15307/" ]
I think you may have to reword this a little for people to understand exactly what you are after. Are you trying to reference the range of all cells in a column except for the header? Most likely you can do this using an OFFSET with a COUNTA function inside, for example to get all of column A without the header you cou...
for example if you want to apply SIN(x) on a set of data in a row, in a vacant cell type: =SIN("click on the first cell of the row") then press "enter" then grab the handle of this cell and draw it up to the last cell. now you have a set of data in a row each cell of which is has the value of the SIN(the original cell)
64,400
I want to set "Formula" to all cells in certain column **whatever the number of rows was**. **But i don't want to set this function to first cell "Header" of this column**. How do i make it ?.
2009/11/02
[ "https://superuser.com/questions/64400", "https://superuser.com", "https://superuser.com/users/15307/" ]
If your header is in cell A1 and your formulas need to start in A2 and go to the end, **start by selecting A2, press (and release) "End" then press "Shift+Down Arrow"**. Now everything from A2 to the end is selected and you can paste your formula. If you have no data in A2-A65535, you will select the entire range. If y...
for example if you want to apply SIN(x) on a set of data in a row, in a vacant cell type: =SIN("click on the first cell of the row") then press "enter" then grab the handle of this cell and draw it up to the last cell. now you have a set of data in a row each cell of which is has the value of the SIN(the original cell)
64,039,435
I have a id=box inside html, having trouble using javascript to move the box with my arrow keys on the keyboard but as the code only goes down. Not up left or right. Not sure how my code is not working. ``` let boxTop = 200; let boxLeft = 200; document.getElementById("box").style.top = boxTop + "px"; document.addEve...
2020/09/24
[ "https://Stackoverflow.com/questions/64039435", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14134331/" ]
you can use the following code: ``` let boxTop = 200; let boxLeft = 200; document.getElementById("box").style.top = boxTop + "px"; document.getElementById("box").style.left = boxLeft + "px"; document.addEventListener('keydown', logKey); function logKey(e) { switch(e.keyCode){ case 37: box....
The question asks why the box only moves down when the user presses an arrow key. A good start is to go through each line of your code and clarify exactly what it is doing versus what you'd like it to do. I'll put some things to consider in comments below so you can edit your code and then see if there is more to be d...
1,415,753
Problem: Given that $34!=295232799cd96041408476186096435ab000000$. Find $a, b, c, d$. $a, b, c, d$ are single digits. I am able to find $a$ and $b$ but cant find $c, d$. I did the prime factorisation of $34!$ using De-Polignac's formula. I got $\frac{34!}{10^7}=2^{25}\times3^{15}\times7^4\times11^3\times13^2\times17^2...
2015/08/31
[ "https://math.stackexchange.com/questions/1415753", "https://math.stackexchange.com", "https://math.stackexchange.com/users/238932/" ]
HINT: The number is a multiple of $9$ and a multiple of $11$.
You know that $34!$ is divisible by $9$, so, because the sum of all other digits is $141$, you know that $c+d=3$ or $c+d=12$. Now do the same for divisibility by $11$ (remember the alternating sums criterion?).
1,415,753
Problem: Given that $34!=295232799cd96041408476186096435ab000000$. Find $a, b, c, d$. $a, b, c, d$ are single digits. I am able to find $a$ and $b$ but cant find $c, d$. I did the prime factorisation of $34!$ using De-Polignac's formula. I got $\frac{34!}{10^7}=2^{25}\times3^{15}\times7^4\times11^3\times13^2\times17^2...
2015/08/31
[ "https://math.stackexchange.com/questions/1415753", "https://math.stackexchange.com", "https://math.stackexchange.com/users/238932/" ]
HINT: The number is a multiple of $9$ and a multiple of $11$.
Here $34!$ contain $2^{32}$ and $5^7$. So $2^{25}$ remaining and $2^{7}\cdot 5^7 = (10)^7$ form $7$ zeros at the end. So $34! = 295232799cd9604140809643ab \times 10^7$ now after deleting $7$ zero,s , So we get $34! = 295232799cd9604140809643ab$ Now we use divisibility test for last $7$ digits using $2^7$. Here $(...
1,415,753
Problem: Given that $34!=295232799cd96041408476186096435ab000000$. Find $a, b, c, d$. $a, b, c, d$ are single digits. I am able to find $a$ and $b$ but cant find $c, d$. I did the prime factorisation of $34!$ using De-Polignac's formula. I got $\frac{34!}{10^7}=2^{25}\times3^{15}\times7^4\times11^3\times13^2\times17^2...
2015/08/31
[ "https://math.stackexchange.com/questions/1415753", "https://math.stackexchange.com", "https://math.stackexchange.com/users/238932/" ]
You know that $34!$ is divisible by $9$, so, because the sum of all other digits is $141$, you know that $c+d=3$ or $c+d=12$. Now do the same for divisibility by $11$ (remember the alternating sums criterion?).
Here $34!$ contain $2^{32}$ and $5^7$. So $2^{25}$ remaining and $2^{7}\cdot 5^7 = (10)^7$ form $7$ zeros at the end. So $34! = 295232799cd9604140809643ab \times 10^7$ now after deleting $7$ zero,s , So we get $34! = 295232799cd9604140809643ab$ Now we use divisibility test for last $7$ digits using $2^7$. Here $(...
5,914,103
What is wrong with this code. I seem to have the same problems everytime I try to use an AND or an `OR` in a mysql statement. I am obviously not understanding how this is being interpreted as I can never get it to work. ``` SELECT * FROM customer WHERE (record_number = '{$_POST['record_number']}') OR (po = '{...
2011/05/06
[ "https://Stackoverflow.com/questions/5914103", "https://Stackoverflow.com", "https://Stackoverflow.com/users/742113/" ]
You didn't close the quote on `OR (po='{$_POST['record_number']})`. On a side note - this is hugely opened to sql injection attack - might want to look into sanitizing your inputs.
Assuming this is being done from php ``` $sql = "SELECT * FROM customer WHERE (record_number='". mysql_real_escape_string($_POST['record_number'])."') OR (po='". mysql_real_escape_string($_POST['record_number'])."') LIMIT 1"; ``` Should work and is escaped from mysql injection.
5,914,103
What is wrong with this code. I seem to have the same problems everytime I try to use an AND or an `OR` in a mysql statement. I am obviously not understanding how this is being interpreted as I can never get it to work. ``` SELECT * FROM customer WHERE (record_number = '{$_POST['record_number']}') OR (po = '{...
2011/05/06
[ "https://Stackoverflow.com/questions/5914103", "https://Stackoverflow.com", "https://Stackoverflow.com/users/742113/" ]
You didn't close the quote on `OR (po='{$_POST['record_number']})`. On a side note - this is hugely opened to sql injection attack - might want to look into sanitizing your inputs.
The problem is not because of the structure of your query, but because you are breaking it with your single colons. ``` (record_number='{$_POST['record_number']}') OR (po='{$_POST['record_number']}) ``` In PHP, you are allowed to not use single colons in array indexes, so try this: ``` (record_number='{$_POST[recor...
5,914,103
What is wrong with this code. I seem to have the same problems everytime I try to use an AND or an `OR` in a mysql statement. I am obviously not understanding how this is being interpreted as I can never get it to work. ``` SELECT * FROM customer WHERE (record_number = '{$_POST['record_number']}') OR (po = '{...
2011/05/06
[ "https://Stackoverflow.com/questions/5914103", "https://Stackoverflow.com", "https://Stackoverflow.com/users/742113/" ]
You didn't close the quote on `OR (po='{$_POST['record_number']})`. On a side note - this is hugely opened to sql injection attack - might want to look into sanitizing your inputs.
Use: ``` $query = sprintf("SELECT c.* FROM CUSTOMER c WHERE c.record_number = '%s' OR c.po = '%s' LIMIT 1", mysql_real_escape_string($_POST["record_number"]), mysql_real_escape_string($_POST["record_number...
5,914,103
What is wrong with this code. I seem to have the same problems everytime I try to use an AND or an `OR` in a mysql statement. I am obviously not understanding how this is being interpreted as I can never get it to work. ``` SELECT * FROM customer WHERE (record_number = '{$_POST['record_number']}') OR (po = '{...
2011/05/06
[ "https://Stackoverflow.com/questions/5914103", "https://Stackoverflow.com", "https://Stackoverflow.com/users/742113/" ]
You didn't close the quote on `OR (po='{$_POST['record_number']})`. On a side note - this is hugely opened to sql injection attack - might want to look into sanitizing your inputs.
A couple of problems. One is that you are using the same style of quotes (single quotes) for both the SQL literals and the PHP string being used to index into the `$_POST` array. Use double quotes for the PHP string: `"record_number"` instead of `'record_number'`. But beware! Blindly including input from `$_POST` insi...
13,487,697
I have data like this format... ``` ID id date time total ----------------------------------------------------------- 51 192 2012-08-14 00:00:00.000 02:10 PM 4900.00 51 191 2012-08-11 00:00:00.000 03:20 PM 5500.00 51 35 2012-08-17 00:00:00.000 10:30 AM 2900.00 51 35 2...
2012/11/21
[ "https://Stackoverflow.com/questions/13487697", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1740091/" ]
try this: ``` select Years,number as Month,isnull(Total,0) as Total from( select number from master..spt_values where type='P' and number between 1 and 12) seq cross join (select distinct Year([date]) as Years from Table1) y left join (select Year([date])as Year,month([date])as Month,sum(total)...
this one works in oracle ``` select <place your rest of required columns> ,to_char(date,'month') Month,sum(total) total from talbe1 group by to_char(date,'month') ,<place your rest of required columns> ; ```
13,487,697
I have data like this format... ``` ID id date time total ----------------------------------------------------------- 51 192 2012-08-14 00:00:00.000 02:10 PM 4900.00 51 191 2012-08-11 00:00:00.000 03:20 PM 5500.00 51 35 2012-08-17 00:00:00.000 10:30 AM 2900.00 51 35 2...
2012/11/21
[ "https://Stackoverflow.com/questions/13487697", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1740091/" ]
try this: ``` select Years,number as Month,isnull(Total,0) as Total from( select number from master..spt_values where type='P' and number between 1 and 12) seq cross join (select distinct Year([date]) as Years from Table1) y left join (select Year([date])as Year,month([date])as Month,sum(total)...
Query : **[SQLFIDDLEExample](http://sqlfiddle.com/#!3/d27b1/15)** ``` SELECT t.month ,isnull(SUM(total),0) AS total FROM (VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12) ) AS t(month) LEFT JOIN Table1 t1 ON MONTH(t1.date) = t.month GROUP BY t.month ``` Result: ``` | MONTH | TOTAL | ------------...
310,157
I have inherited a WP multisite without the access to the main site (network admin). I need to install a plugin and have unpacked it via FTP but need to enable it and can't. Any way of doing this via MySQL?
2018/08/01
[ "https://wordpress.stackexchange.com/questions/310157", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/63631/" ]
You have in your query `WHERE p.post_type IN ('post', 'page')`, that is why it shows only the posts and pages. Add post type **product** to query: `WHERE p.post_type IN ('post', 'page', 'product')`
Replace this with your search form and products will show in results: ``` <form method="get" id="searchform" action="<?php echo esc_url( home_url( '/' ) ); ?>"> <label for="s">Search</label> <input type="text" class="field" name="s" id="s" placeholder="Search Something" /> <input type="submit" class="subm...
57,703,854
I have an **API project** and an **Angular Project** under the same solution in .NetCore. My angular project is calling the APIs from the API project. In order to access the APIs,i have put the baseurl of the API in the Environment.ts and Environment.prod.ts file. But after publishing the project i realized the Environ...
2019/08/29
[ "https://Stackoverflow.com/questions/57703854", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11835450/" ]
> > But after publishing the project i realized the Environment files are > not created. > > > You wont see the env file because it's already bundle every everything into js file > > There is not other way to do that without publishing your solution > again. > > > You have to build everything again and aga...
Indeed, as you've noticed, the environments files are not available because they have been integrated into the built artifact. If you want to dynamically change the environments URL, you will have to code the logic: a service that fetch the API urls on some kind of server. Usually, if it's just an environment URL to c...
27,172,084
So I have code : ``` $wzor = '/^<span class=\"person\">(.*?)</span>/'; $text = str_replace($wzor, '', $text); ``` I want to remove all spans with class person from my text but my code doesn't work my input is like: ``` <ul> <li><span class="label">Spółdzielnia Socjalna Giełda Pracy</span><span class="person...
2014/11/27
[ "https://Stackoverflow.com/questions/27172084", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4137238/" ]
The **`^`** at the start forces the match to be at the beginning of the string. Also, there is an unescaped **`/`** in `</span>` This should work : ``` $wzor = '/<span class=\"person\">(.*?)<\/span>/'; ``` Also use [`preg_replace`](http://php.net/preg_replace) instead of [`str_replace`](http://php.net/str_replace)....
If you want to use Regular Expressions, you need to use the `preg_replace()` function. Also there was an error in your regex, that did not escape the slash character. This one works: ``` <span class=\"person(.*?)<\/span> ```
4,014,190
Perhaps this just sounds ridiculous but I'm wondering is this possible with Ruby? Basically I have a function... ``` def add a,b c = a + b return c end ``` I'd like to be able to pass the "+" or another operator e.g "-" to the function so that it'd be something like... ``` def sum a,b,operator c = a operator b ...
2010/10/25
[ "https://Stackoverflow.com/questions/4014190", "https://Stackoverflow.com", "https://Stackoverflow.com/users/358438/" ]
Two possibilities: Take method/operator name as a symbol: ``` def sum a,b,operator a.send(operator, b) end sum 42, 23, :+ ``` Or the more general solution: Take a block: ``` def sum a,b yield a,b end sum 42, 23, &:+ ```
``` 4.send("+", 5) ``` Returns `9` <http://corelib.rubyonrails.org/classes/Object.html#M001077>
38,293,605
this is my dataframe ``` df = pd.DataFrame({'Col1':['Joe','Bob','Joe','Joe'], 'Col2':[55,25,88,80]}) ``` I only want the names of if it appears more than once in 'Col1' I can do it like this ``` grouped = df.groupby("Col1") grouped.filter(lambda x: x["Col1"].count()>2)['Col1'].unique() ``` Howe...
2016/07/10
[ "https://Stackoverflow.com/questions/38293605", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2333196/" ]
Use `value_counts` and `isin` ``` vc = df.Col1.value_counts() > 2 vc = vc[vc] df.loc[df.Col1.isin(vc.index)] ``` [![enter image description here](https://i.stack.imgur.com/fTVzR.png)](https://i.stack.imgur.com/fTVzR.png)
Here's a NumPy based solution using [`np.unique`](http://docs.scipy.org/doc/numpy/reference/generated/numpy.unique.html) - ``` unq,count = np.unique(df.Col1,return_counts=True) out = unq[count>n] ``` Sample run - ``` In [34]: df Out[34]: Col1 Col2 0 Joe 55 1 Bob 25 2 Joe 88 3 Joe 80 4 Joe 44...
38,902,290
Ok so I have a intranet webpage that I am making using HTML and I want to put a link (absolute or relative) on my page that opens a PDF. The code I use is ``` <a href="http://harold.local/documents/sandP.pdf" target="_blank">Privacy and Security</a> ``` Now what ends up happening is that I get this error: > > 4...
2016/08/11
[ "https://Stackoverflow.com/questions/38902290", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6500255/" ]
You want to use the `continue` statement, this skips the current iteration of the loop: ``` for i=1:10 if (condition) continue; elseif (condition) (do something) else (do something) end end ``` See: <http://www.tutorialspoint.com/matlab/matlab_continue_statement.htm>
If you want to skip `condition2` if `condition1` is true, simply ask for the opposite: ``` for i = 1:10 if ~(condition1) if (condition2) (do something) else (do something) end end end ``` The `~` ("not") will turn `true` to `false`, and the other way around. S...
38,902,290
Ok so I have a intranet webpage that I am making using HTML and I want to put a link (absolute or relative) on my page that opens a PDF. The code I use is ``` <a href="http://harold.local/documents/sandP.pdf" target="_blank">Privacy and Security</a> ``` Now what ends up happening is that I get this error: > > 4...
2016/08/11
[ "https://Stackoverflow.com/questions/38902290", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6500255/" ]
The answer from ialquaz is the correct one (in my opinion), so no need to elaborate that. Instead, I'll answer you second question: > > If I remove the first if statement, what would happen during the loop > if none of the other conditions are met? > > > This depends on what your conditions are but in general, Y...
If you want to skip `condition2` if `condition1` is true, simply ask for the opposite: ``` for i = 1:10 if ~(condition1) if (condition2) (do something) else (do something) end end end ``` The `~` ("not") will turn `true` to `false`, and the other way around. S...
38,902,290
Ok so I have a intranet webpage that I am making using HTML and I want to put a link (absolute or relative) on my page that opens a PDF. The code I use is ``` <a href="http://harold.local/documents/sandP.pdf" target="_blank">Privacy and Security</a> ``` Now what ends up happening is that I get this error: > > 4...
2016/08/11
[ "https://Stackoverflow.com/questions/38902290", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6500255/" ]
You want to use the `continue` statement, this skips the current iteration of the loop: ``` for i=1:10 if (condition) continue; elseif (condition) (do something) else (do something) end end ``` See: <http://www.tutorialspoint.com/matlab/matlab_continue_statement.htm>
``` for i=1:10 if (condition) && ~(condition1) (do something) elseif ~(condition1) (do something) end end ``` You can do it in above way as well
38,902,290
Ok so I have a intranet webpage that I am making using HTML and I want to put a link (absolute or relative) on my page that opens a PDF. The code I use is ``` <a href="http://harold.local/documents/sandP.pdf" target="_blank">Privacy and Security</a> ``` Now what ends up happening is that I get this error: > > 4...
2016/08/11
[ "https://Stackoverflow.com/questions/38902290", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6500255/" ]
You want to use the `continue` statement, this skips the current iteration of the loop: ``` for i=1:10 if (condition) continue; elseif (condition) (do something) else (do something) end end ``` See: <http://www.tutorialspoint.com/matlab/matlab_continue_statement.htm>
The answer from ialquaz is the correct one (in my opinion), so no need to elaborate that. Instead, I'll answer you second question: > > If I remove the first if statement, what would happen during the loop > if none of the other conditions are met? > > > This depends on what your conditions are but in general, Y...
38,902,290
Ok so I have a intranet webpage that I am making using HTML and I want to put a link (absolute or relative) on my page that opens a PDF. The code I use is ``` <a href="http://harold.local/documents/sandP.pdf" target="_blank">Privacy and Security</a> ``` Now what ends up happening is that I get this error: > > 4...
2016/08/11
[ "https://Stackoverflow.com/questions/38902290", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6500255/" ]
You want to use the `continue` statement, this skips the current iteration of the loop: ``` for i=1:10 if (condition) continue; elseif (condition) (do something) else (do something) end end ``` See: <http://www.tutorialspoint.com/matlab/matlab_continue_statement.htm>
If condition1 happens to be true and if 'true' you don't want to do anything, you don't need that in the code. So I'll go with something like this: ``` for i=1:10 //commenting 'if' for condition1 since you wouldn't need it //if (condition1) if (condition2) (do something) else (do somet...
38,902,290
Ok so I have a intranet webpage that I am making using HTML and I want to put a link (absolute or relative) on my page that opens a PDF. The code I use is ``` <a href="http://harold.local/documents/sandP.pdf" target="_blank">Privacy and Security</a> ``` Now what ends up happening is that I get this error: > > 4...
2016/08/11
[ "https://Stackoverflow.com/questions/38902290", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6500255/" ]
The answer from ialquaz is the correct one (in my opinion), so no need to elaborate that. Instead, I'll answer you second question: > > If I remove the first if statement, what would happen during the loop > if none of the other conditions are met? > > > This depends on what your conditions are but in general, Y...
``` for i=1:10 if (condition) && ~(condition1) (do something) elseif ~(condition1) (do something) end end ``` You can do it in above way as well
38,902,290
Ok so I have a intranet webpage that I am making using HTML and I want to put a link (absolute or relative) on my page that opens a PDF. The code I use is ``` <a href="http://harold.local/documents/sandP.pdf" target="_blank">Privacy and Security</a> ``` Now what ends up happening is that I get this error: > > 4...
2016/08/11
[ "https://Stackoverflow.com/questions/38902290", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6500255/" ]
The answer from ialquaz is the correct one (in my opinion), so no need to elaborate that. Instead, I'll answer you second question: > > If I remove the first if statement, what would happen during the loop > if none of the other conditions are met? > > > This depends on what your conditions are but in general, Y...
If condition1 happens to be true and if 'true' you don't want to do anything, you don't need that in the code. So I'll go with something like this: ``` for i=1:10 //commenting 'if' for condition1 since you wouldn't need it //if (condition1) if (condition2) (do something) else (do somet...
47,700,694
So, I followed an online course from [www.code.org](https://code.org/) to accomodate myself with JavaScript. I used elements such as `setProperty();` and `onEvent();`. I used an online editor to add a button and the following code to change the button's text when the user clicks it: ``` onEvent("button1","click", func...
2017/12/07
[ "https://Stackoverflow.com/questions/47700694", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9016701/" ]
This would most likely be the equivalent: a combination of adding a *click* event listener to the button and changing its text in the callback's function body via `texContent`. ```js document.getElementById('button1').addEventListener('click', function() { this.textContent = 'Hello there!'; }); ``` ```html <butto...
HTML `<button id="but" onclick="clickme()">click me </button>` JS ``` <script> function clickme(){ document.getElementById("but").innerHTML = "changed"; } </script> ```
47,700,694
So, I followed an online course from [www.code.org](https://code.org/) to accomodate myself with JavaScript. I used elements such as `setProperty();` and `onEvent();`. I used an online editor to add a button and the following code to change the button's text when the user clicks it: ``` onEvent("button1","click", func...
2017/12/07
[ "https://Stackoverflow.com/questions/47700694", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9016701/" ]
This would most likely be the equivalent: a combination of adding a *click* event listener to the button and changing its text in the callback's function body via `texContent`. ```js document.getElementById('button1').addEventListener('click', function() { this.textContent = 'Hello there!'; }); ``` ```html <butto...
You can add id to your button, for example: ``` <button id="myButton">Click!</button> ``` And then in javascript: 1. select the element. ```js document.getElementById("myButton"); ``` 2. add the event handler to it, so the code would become like this: ```js document.getElementById("myButton").onclick = function...
47,700,694
So, I followed an online course from [www.code.org](https://code.org/) to accomodate myself with JavaScript. I used elements such as `setProperty();` and `onEvent();`. I used an online editor to add a button and the following code to change the button's text when the user clicks it: ``` onEvent("button1","click", func...
2017/12/07
[ "https://Stackoverflow.com/questions/47700694", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9016701/" ]
This would most likely be the equivalent: a combination of adding a *click* event listener to the button and changing its text in the callback's function body via `texContent`. ```js document.getElementById('button1').addEventListener('click', function() { this.textContent = 'Hello there!'; }); ``` ```html <butto...
Simply write the whole onclick event handler function inside the button tag only. ``` <button type="buttton" onclick="this.innerHTML='Text changed'"></button> ```
47,700,694
So, I followed an online course from [www.code.org](https://code.org/) to accomodate myself with JavaScript. I used elements such as `setProperty();` and `onEvent();`. I used an online editor to add a button and the following code to change the button's text when the user clicks it: ``` onEvent("button1","click", func...
2017/12/07
[ "https://Stackoverflow.com/questions/47700694", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9016701/" ]
HTML `<button id="but" onclick="clickme()">click me </button>` JS ``` <script> function clickme(){ document.getElementById("but").innerHTML = "changed"; } </script> ```
You can add id to your button, for example: ``` <button id="myButton">Click!</button> ``` And then in javascript: 1. select the element. ```js document.getElementById("myButton"); ``` 2. add the event handler to it, so the code would become like this: ```js document.getElementById("myButton").onclick = function...
47,700,694
So, I followed an online course from [www.code.org](https://code.org/) to accomodate myself with JavaScript. I used elements such as `setProperty();` and `onEvent();`. I used an online editor to add a button and the following code to change the button's text when the user clicks it: ``` onEvent("button1","click", func...
2017/12/07
[ "https://Stackoverflow.com/questions/47700694", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9016701/" ]
HTML `<button id="but" onclick="clickme()">click me </button>` JS ``` <script> function clickme(){ document.getElementById("but").innerHTML = "changed"; } </script> ```
Simply write the whole onclick event handler function inside the button tag only. ``` <button type="buttton" onclick="this.innerHTML='Text changed'"></button> ```
20,321,795
I want to load contacts from android device, I have used different methods but contacts load so slow, * I am using CommanDataKinds, * I am getting index of column out of the loop(only one, then use that variable in loop). also I want to use fast scrolling technique like viber. **What exactly I need is viber contact ...
2013/12/02
[ "https://Stackoverflow.com/questions/20321795", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3051593/" ]
try with this dude :) best of luck ``` public class ReadContacts extends AsyncTask<Void, Void, Void>{ private ListView contactsList; private Context cntx; private Constant constants; static final String[] CONTACTS_SUMMARY_PROJECTION = new String[] { Contacts._ID, // 0 Contacts.DISPLA...
checkout this [sample](http://developer.android.com/training/contacts-provider/retrieve-names.html) to retriev contacts and display in listview like fastscroll.
38,022,832
When a new user registers, I would like to give him an gravatar profile image by default, afterwards he should be able to set it manually, so the changeset method should only apply if profile\_img\_url is nil ``` def changeset(model, params \\ :empty) do model |> cast(...) ... |> get_gravatar end defp get_gra...
2016/06/24
[ "https://Stackoverflow.com/questions/38022832", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5004923/" ]
You will not be able to get clang-format to respect all custom inhouse formatting, and their [documentation on adding new style options](https://clang.llvm.org/docs/ClangFormatStyleOptions.html#adding-additional-style-options) is pretty tight. The adoption of clang-format into an existing codebase requires *some* compr...
As of **clang-format** 13 there is a new `AlignArrayOfStructures` option available that can help with exactly this.
20,981,998
I have used Worklight 5 for Eclipse Juno multiple times and had great success when building hybrid apps for Android and iOS. However, I just recently installed a new version of Eclipse Juno on a new computer and later installed Android ADT and Worklight. Eclipse works as normal for non-Worklight apps. When I create a...
2014/01/07
[ "https://Stackoverflow.com/questions/20981998", "https://Stackoverflow.com", "https://Stackoverflow.com/users/883396/" ]
In Worklight 6.1 they have re-swizzled the options a bit, but if you want the equivalent of "Build all and Deploy," select: "Run on Worklight Development Server." You need to select the **App**, not the common folder to get that option.
Since you say you've been using Worklight 5 and have now switched to Worklight 6.1.0, I suggest that you will review the following: * [What's New in Worklight 6.0.0.0](http://pic.dhe.ibm.com/infocenter/wrklight/v6r0m0/topic/com.ibm.worklight.getstart.doc/start/c_what_s_new.html) * [What's New in Worklight 6.1.0.0](htt...