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
47,136,417
For the below code, ``` // Print indexes var randArray = [5, 6, 7, 8]; for(var val in randArray){ // val is type inferred to String type document.write(val + "<br>"); } // Print values for(var val of randArray){ // Line 95 document.write(val + "<br>"); } ``` --- Below is the error, ``` tstut.ts(95,9): error TS...
2017/11/06
[ "https://Stackoverflow.com/questions/47136417", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3317808/" ]
An easy fix to your code is to change `var` to [`let`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/let): ``` // Print indexes var randArray = [5, 6, 7, 8]; for(let val in randArray){ console.log(val); } // Print values for(let val of randArray){ console.log(val); } ``` Your probl...
Using "for..in" in JavaScript exposes the **key/index** of an array , simply 'coz it doesn't iterate over array items, instead it iterates over the keys/index in an array. For example, ```js var randArray = [5, 6, 7, 8]; for(let val in randArray){ document.write(val + "<br>"); } ``` In above code, no matter what...
14,903
MS Project seems to take a task and calculate *per day work* by dividing *total work* by *duration*. In the schedule I am working on, each resource is available for 10 hours per day, but MS Project doesn't take advantage of this. I would like to level my schedule based on the 10 available hours per day rather than s...
2015/05/11
[ "https://pm.stackexchange.com/questions/14903", "https://pm.stackexchange.com", "https://pm.stackexchange.com/users/17113/" ]
If each resource is available to work 10 hours per day then set up a resource calendar with the 10 hours working times on it. Then apply that resource calendar to each resource as required. Additionally you can modify the project settings in Change Working Time, to define a working day as 10 hours so that Project calc...
You can update the resource table to show greater than 100% utilization. In this case, you would load 125%. This will allow greater than 8 working hours per day.
11,633,959
I am trying to create a route in route table that routes to a virtual item (using a cms that creates url like example.com/about/company, where there is no physical file called company exists) using system.web.routing (unfortunately i cannot use iis rewriting/routing). I have tried the following but it results in 404. I...
2012/07/24
[ "https://Stackoverflow.com/questions/11633959", "https://Stackoverflow.com", "https://Stackoverflow.com/users/330201/" ]
I got it. I put it in the cache folder and it works now. Plus, I stupidly forgot the new command (since create() didn't seem to need it). My working code: I stored the file in the cache dir, that works! ``` File output = new File(getCacheDir() + "/exampleout.mid"); ``` And then calling the file: ``` String f...
**1.** If you have dropped your file directly on to your sd-card , then you can access it this way... ``` "/sdcard/test3.mp3" ``` **2.** But **above mentioned way is Not the proper way** to do it... **See below for the appropriate way.** ``` String baseDirectory = Environment.getExternalStorageDirectory().getAbsolu...
57,964,811
I have a trouble that I can't resolve. I have two models **User** & **Orgs** They are bounded by a pivot table **user\_org** through a belongsToMany relationship. An user can be member of many Orgs and an Orgs can have many users. Into my controller I craft a query : `$users = User::query();` I wanted to get $users ...
2019/09/16
[ "https://Stackoverflow.com/questions/57964811", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2217654/" ]
It is because `for` loop won't wait for your `setTimeout` method to execute. Every time the `for` loop encounters the `setTimeout` method, JS will call the event loop and place it there (to be executed once it times out) and move forward. That's why it calls your `resolve` before printing the `console.log` statements f...
Well, you call `resolve()` *inside* of your `for` loop. You should place it outside of the `for` loop so that it waits for the loop to finish.
57,964,811
I have a trouble that I can't resolve. I have two models **User** & **Orgs** They are bounded by a pivot table **user\_org** through a belongsToMany relationship. An user can be member of many Orgs and an Orgs can have many users. Into my controller I craft a query : `$users = User::query();` I wanted to get $users ...
2019/09/16
[ "https://Stackoverflow.com/questions/57964811", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2217654/" ]
`setTimeout` doesn't wait for the function to return - it just schedules it to be executed later. The call to `setTimeout` returns immediately and your task finishes after that. To wait for the scheduled function to execute after a certain period of time, call `resolve()` at the end of the delayed function. That way t...
Well, you call `resolve()` *inside* of your `for` loop. You should place it outside of the `for` loop so that it waits for the loop to finish.
57,964,811
I have a trouble that I can't resolve. I have two models **User** & **Orgs** They are bounded by a pivot table **user\_org** through a belongsToMany relationship. An user can be member of many Orgs and an Orgs can have many users. Into my controller I craft a query : `$users = User::query();` I wanted to get $users ...
2019/09/16
[ "https://Stackoverflow.com/questions/57964811", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2217654/" ]
It is possible to create this effect, but you need to put your `resolve()` in its own `setTimeout()`, adjusting the second parameter such that there is sufficient time for the other timeouts to complete. ```js const first = new Promise((resolve, reject) => { setTimeout(() => { resolve('First promise resolved!'...
Well, you call `resolve()` *inside* of your `for` loop. You should place it outside of the `for` loop so that it waits for the loop to finish.
57,964,811
I have a trouble that I can't resolve. I have two models **User** & **Orgs** They are bounded by a pivot table **user\_org** through a belongsToMany relationship. An user can be member of many Orgs and an Orgs can have many users. Into my controller I craft a query : `$users = User::query();` I wanted to get $users ...
2019/09/16
[ "https://Stackoverflow.com/questions/57964811", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2217654/" ]
@johnnybigH, The second function resolve's outside of timeout so technically it will not wait for timeout function to complete as you are resolving it out of setTimeout. Now 2nd one is resolved so it is going for the execution of the third function. What you can do is inside of 2nd function for the loop. look for the ...
It is possible to create this effect, but you need to put your `resolve()` in its own `setTimeout()`, adjusting the second parameter such that there is sufficient time for the other timeouts to complete. ```js const first = new Promise((resolve, reject) => { setTimeout(() => { resolve('First promise resolved!'...
57,964,811
I have a trouble that I can't resolve. I have two models **User** & **Orgs** They are bounded by a pivot table **user\_org** through a belongsToMany relationship. An user can be member of many Orgs and an Orgs can have many users. Into my controller I craft a query : `$users = User::query();` I wanted to get $users ...
2019/09/16
[ "https://Stackoverflow.com/questions/57964811", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2217654/" ]
@johnnybigH, The second function resolve's outside of timeout so technically it will not wait for timeout function to complete as you are resolving it out of setTimeout. Now 2nd one is resolved so it is going for the execution of the third function. What you can do is inside of 2nd function for the loop. look for the ...
Well, you call `resolve()` *inside* of your `for` loop. You should place it outside of the `for` loop so that it waits for the loop to finish.
57,964,811
I have a trouble that I can't resolve. I have two models **User** & **Orgs** They are bounded by a pivot table **user\_org** through a belongsToMany relationship. An user can be member of many Orgs and an Orgs can have many users. Into my controller I craft a query : `$users = User::query();` I wanted to get $users ...
2019/09/16
[ "https://Stackoverflow.com/questions/57964811", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2217654/" ]
@johnnybigH, The second function resolve's outside of timeout so technically it will not wait for timeout function to complete as you are resolving it out of setTimeout. Now 2nd one is resolved so it is going for the execution of the third function. What you can do is inside of 2nd function for the loop. look for the ...
This is the expected behavior. The setTimeouts will not demonstrate expected order since the functions themselves resolved in the order as defined in the promise. Just replace the setTimeouts with console.log()'s and you will see the order executed as defined.
57,964,811
I have a trouble that I can't resolve. I have two models **User** & **Orgs** They are bounded by a pivot table **user\_org** through a belongsToMany relationship. An user can be member of many Orgs and an Orgs can have many users. Into my controller I craft a query : `$users = User::query();` I wanted to get $users ...
2019/09/16
[ "https://Stackoverflow.com/questions/57964811", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2217654/" ]
@johnnybigH, The second function resolve's outside of timeout so technically it will not wait for timeout function to complete as you are resolving it out of setTimeout. Now 2nd one is resolved so it is going for the execution of the third function. What you can do is inside of 2nd function for the loop. look for the ...
`setTimeout` doesn't wait for the function to return - it just schedules it to be executed later. The call to `setTimeout` returns immediately and your task finishes after that. To wait for the scheduled function to execute after a certain period of time, call `resolve()` at the end of the delayed function. That way t...
57,964,811
I have a trouble that I can't resolve. I have two models **User** & **Orgs** They are bounded by a pivot table **user\_org** through a belongsToMany relationship. An user can be member of many Orgs and an Orgs can have many users. Into my controller I craft a query : `$users = User::query();` I wanted to get $users ...
2019/09/16
[ "https://Stackoverflow.com/questions/57964811", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2217654/" ]
This is the expected behavior. The setTimeouts will not demonstrate expected order since the functions themselves resolved in the order as defined in the promise. Just replace the setTimeouts with console.log()'s and you will see the order executed as defined.
Well, you call `resolve()` *inside* of your `for` loop. You should place it outside of the `for` loop so that it waits for the loop to finish.
57,964,811
I have a trouble that I can't resolve. I have two models **User** & **Orgs** They are bounded by a pivot table **user\_org** through a belongsToMany relationship. An user can be member of many Orgs and an Orgs can have many users. Into my controller I craft a query : `$users = User::query();` I wanted to get $users ...
2019/09/16
[ "https://Stackoverflow.com/questions/57964811", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2217654/" ]
`setTimeout` doesn't wait for the function to return - it just schedules it to be executed later. The call to `setTimeout` returns immediately and your task finishes after that. To wait for the scheduled function to execute after a certain period of time, call `resolve()` at the end of the delayed function. That way t...
This is the expected behavior. The setTimeouts will not demonstrate expected order since the functions themselves resolved in the order as defined in the promise. Just replace the setTimeouts with console.log()'s and you will see the order executed as defined.
57,964,811
I have a trouble that I can't resolve. I have two models **User** & **Orgs** They are bounded by a pivot table **user\_org** through a belongsToMany relationship. An user can be member of many Orgs and an Orgs can have many users. Into my controller I craft a query : `$users = User::query();` I wanted to get $users ...
2019/09/16
[ "https://Stackoverflow.com/questions/57964811", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2217654/" ]
It is because `for` loop won't wait for your `setTimeout` method to execute. Every time the `for` loop encounters the `setTimeout` method, JS will call the event loop and place it there (to be executed once it times out) and move forward. That's why it calls your `resolve` before printing the `console.log` statements f...
This is the expected behavior. The setTimeouts will not demonstrate expected order since the functions themselves resolved in the order as defined in the promise. Just replace the setTimeouts with console.log()'s and you will see the order executed as defined.
6,795,585
I have an element with multiple elements inside. All of the elements inside have the same name. Is there any way to remove them using one function? (refer to this question for example [Remove multiple children from parent?](https://stackoverflow.com/questions/6795034/remove-multiple-children-from-parent/6795103)
2011/07/22
[ "https://Stackoverflow.com/questions/6795585", "https://Stackoverflow.com", "https://Stackoverflow.com/users/843787/" ]
ok this should be easy. First get the parent element: ``` var theParent = document.getElementById("notSoHappyFather"); ``` then get an array of the nodes that you want to remove: ``` var theChildren = theParent.getElementsByName("unluckyChild"); ``` Lastly, remove them with a loop: ``` for (var i = 0; i < theChi...
A sample of your HTML would get you a more complete answer, but one can fairly easy call DOM functions to get the list of children and just remove them. In jQuery, remove all children would be something like this: ``` $("#target > *").remove(); ``` or ``` $("#target").html(""); ``` And, you can see a demo here: ...
6,795,585
I have an element with multiple elements inside. All of the elements inside have the same name. Is there any way to remove them using one function? (refer to this question for example [Remove multiple children from parent?](https://stackoverflow.com/questions/6795034/remove-multiple-children-from-parent/6795103)
2011/07/22
[ "https://Stackoverflow.com/questions/6795585", "https://Stackoverflow.com", "https://Stackoverflow.com/users/843787/" ]
Here's a solution that removes the first level children with the specified name for the parent with the specified id. If you want to go deeper, you can recursively call it on the child elements you get inside (you'll have to add a `parent` parameter as well). ``` function removeChildren (params){ var parentId = pa...
A sample of your HTML would get you a more complete answer, but one can fairly easy call DOM functions to get the list of children and just remove them. In jQuery, remove all children would be something like this: ``` $("#target > *").remove(); ``` or ``` $("#target").html(""); ``` And, you can see a demo here: ...
6,795,585
I have an element with multiple elements inside. All of the elements inside have the same name. Is there any way to remove them using one function? (refer to this question for example [Remove multiple children from parent?](https://stackoverflow.com/questions/6795034/remove-multiple-children-from-parent/6795103)
2011/07/22
[ "https://Stackoverflow.com/questions/6795585", "https://Stackoverflow.com", "https://Stackoverflow.com/users/843787/" ]
**2021 Answer:** Perhaps there are lots of way to do it, such as [Element.replaceChildren()](https://developer.mozilla.org/en-US/docs/Web/API/Element/replaceChildren). I would like to show you an effective solution with **only one redraw & reflow** *supporting all ES6+ browsers*. ``` function removeChildren(cssSelect...
A sample of your HTML would get you a more complete answer, but one can fairly easy call DOM functions to get the list of children and just remove them. In jQuery, remove all children would be something like this: ``` $("#target > *").remove(); ``` or ``` $("#target").html(""); ``` And, you can see a demo here: ...
6,795,585
I have an element with multiple elements inside. All of the elements inside have the same name. Is there any way to remove them using one function? (refer to this question for example [Remove multiple children from parent?](https://stackoverflow.com/questions/6795034/remove-multiple-children-from-parent/6795103)
2011/07/22
[ "https://Stackoverflow.com/questions/6795585", "https://Stackoverflow.com", "https://Stackoverflow.com/users/843787/" ]
Here's a solution that removes the first level children with the specified name for the parent with the specified id. If you want to go deeper, you can recursively call it on the child elements you get inside (you'll have to add a `parent` parameter as well). ``` function removeChildren (params){ var parentId = pa...
ok this should be easy. First get the parent element: ``` var theParent = document.getElementById("notSoHappyFather"); ``` then get an array of the nodes that you want to remove: ``` var theChildren = theParent.getElementsByName("unluckyChild"); ``` Lastly, remove them with a loop: ``` for (var i = 0; i < theChi...
6,795,585
I have an element with multiple elements inside. All of the elements inside have the same name. Is there any way to remove them using one function? (refer to this question for example [Remove multiple children from parent?](https://stackoverflow.com/questions/6795034/remove-multiple-children-from-parent/6795103)
2011/07/22
[ "https://Stackoverflow.com/questions/6795585", "https://Stackoverflow.com", "https://Stackoverflow.com/users/843787/" ]
**2021 Answer:** Perhaps there are lots of way to do it, such as [Element.replaceChildren()](https://developer.mozilla.org/en-US/docs/Web/API/Element/replaceChildren). I would like to show you an effective solution with **only one redraw & reflow** *supporting all ES6+ browsers*. ``` function removeChildren(cssSelect...
ok this should be easy. First get the parent element: ``` var theParent = document.getElementById("notSoHappyFather"); ``` then get an array of the nodes that you want to remove: ``` var theChildren = theParent.getElementsByName("unluckyChild"); ``` Lastly, remove them with a loop: ``` for (var i = 0; i < theChi...
6,795,585
I have an element with multiple elements inside. All of the elements inside have the same name. Is there any way to remove them using one function? (refer to this question for example [Remove multiple children from parent?](https://stackoverflow.com/questions/6795034/remove-multiple-children-from-parent/6795103)
2011/07/22
[ "https://Stackoverflow.com/questions/6795585", "https://Stackoverflow.com", "https://Stackoverflow.com/users/843787/" ]
Here's a solution that removes the first level children with the specified name for the parent with the specified id. If you want to go deeper, you can recursively call it on the child elements you get inside (you'll have to add a `parent` parameter as well). ``` function removeChildren (params){ var parentId = pa...
**2021 Answer:** Perhaps there are lots of way to do it, such as [Element.replaceChildren()](https://developer.mozilla.org/en-US/docs/Web/API/Element/replaceChildren). I would like to show you an effective solution with **only one redraw & reflow** *supporting all ES6+ browsers*. ``` function removeChildren(cssSelect...
9,412,881
I am using Eclipse IDE , i need to search a String inside my Project . So inside Eclipse , I clikced Search Item from Menu and Selected File and entered a String "exch" . It is displaying all the results such as "exchange" , but i want to display only the Exact String matched "exch" ![enter image description here](...
2012/02/23
[ "https://Stackoverflow.com/questions/9412881", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Check the "Regular expression" checkbox, and surround your word with `\b` at the beginning and end which matches beginning and end (boundaries) of a word, so your search term will be `\bexch\b`
Check Regular expression and search `\sexch\s`
10,407
I'm ready to move from MyISAM to InnoDB but wanted to know if there was a full list of things to look for? For example, I haven't seen any list mention that running `DISABLE KEYS` on an InnoDB table will throw a warning, except the manual page for `ALTER TABLE`. It's that kind of thing I need to know about before conve...
2012/01/09
[ "https://dba.stackexchange.com/questions/10407", "https://dba.stackexchange.com", "https://dba.stackexchange.com/users/5693/" ]
Here are some gotchas **Memory Usage** ================ MyISAM ------ * only caches index pages. * shared keycache (sized by key\_buffer\_size). * [You can also set up dedicated keycache, one or more tables per cache table](http://dev.mysql.com/doc/refman/5.5/en/cache-index.html). InnoDB ------ * caches data pages...
I think the biggest gotcha would be around innodb being transactional. You'll want to know if the MySQL libraries being used by your applications auto\_commit by default or not. [Python](http://mysql-python.sourceforge.net/FAQ.html#my-data-disappeared-or-won-t-go-away), for example, does not auto commit. This means if...
72,212,425
I have the following function ``` function wordCount(input) { const count = {}; input .forEach(r => { const words = r.split(" ") words.forEach(w => { w = w.replace(/[^a-zöüßä ]/i,"") w = w[0].toUpperCase() + w.slice(1).toLocaleLowerCase(); count[...
2022/05/12
[ "https://Stackoverflow.com/questions/72212425", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6193913/" ]
You need to make your pictures to fill their layouts, AND keep their aspect ratio. The best way is to set their ["object-fit"](https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit) css property to "contain". Try this: ``` <Card raised sx={{ maxWidth: 280, margin: "0 auto", padding: "0.1em", }}...
Try this ``` parent-image-element { width: 100px; } image { width: 100%; max-height: 100px; } ```
6,328,872
Currently I have a servlet `CsmServlet.java` which is getting called by the client side, here is the `web.xml` part ``` <servlet> <display-name>upload</display-name> <servlet-name>upload</servlet-name> <servlet-class>com.abc.csm.web.CsmServlet</servlet-class> </servlet> ``` which is perfect. Now I have t...
2011/06/13
[ "https://Stackoverflow.com/questions/6328872", "https://Stackoverflow.com", "https://Stackoverflow.com/users/707414/" ]
As Struts implements the MVC architecture, ideally you would not want to have your servlet doing the controlling part. You may want to copy the logic from your servlet to the Struts action. In general, you would have two options: 1. Dont have servlets in you code (as controllers) and let the struts handle controlling....
Struts has a front controller servlet that accepts all requests and passes them on to Action classes that do the work. I think your servlet is out of a job. It sounds like it should be an Action class that's called by the front controller when clients ask for it.
39,616,729
While browsing Linux kernel code, I found the following two functions in `kernel/capability.c`. **1)** ``` bool has_capability(struct task_struct *t, int cap) /*Does a task have a capability in init_user_ns.*/ ``` **2)** ``` bool has_ns_capability(struct task_struct *t, struct user_namespace *ns, int cap) /*Does...
2016/09/21
[ "https://Stackoverflow.com/questions/39616729", "https://Stackoverflow.com", "https://Stackoverflow.com/users/981766/" ]
Linux capabilities were introduced in Linux 2.2, while namespaces were introduced in Linux 3.8. I therefore though that since they were developed independently, they should have independent existence. As I now realise, after reading these articles ([Link1](https://lwn.net/Articles/420328/) and [Link2](https://lwn.net/A...
Namespaces are the key to containers, such as `docker` and the like. They provide resource isolation between the containers. The idea is that each container has separate namespaces for a number of attribute types, including process and thread IDs, user and group IDs, TCP/UDP ports, network interfaces, mounted filesys...
13,350,485
Here is [a jsFiddle](http://jsfiddle.net/bmh_ca/SksQ3/1/) demonstrating the following problem: Given a foreach binding over a list of (observable) strings, the observables do not seem to update from changes to input tags bound inside the foreach. One would expect them to. Here's the example from the jsFiddle: ### HTM...
2012/11/12
[ "https://Stackoverflow.com/questions/13350485", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19212/" ]
I worked around this by using `value: $parent.list[$index()]`, as seen in [this jsFiddle](http://jsfiddle.net/bmh_ca/SksQ3/3/). The new bindings looks like this: ``` <ul data-bind='foreach: list'> <li> <input data-bind='value: $parent.list[$index()]' /> </li> </ul> ``` One could perhaps improve on th...
Every data object used in the default knockout bindings will always be unwrapped. So you are essentially binding to the value of the items in the list, not the observable as you are expecting. Observables should be properties of an object, not a replacement of the object itself. Set the observables as a property of so...
16,818,309
I'm trying to copy my uploaded file to another directory called **img** folder with following code. But it doesn't work properly. I don't know why ? can you help me plz ? **php Code:** ``` if($image["name"] != "") { //$path = PATH . DS . "uploads" . DS . "products" . DS . $id; $path = "../../uploads" . DS . "...
2013/05/29
[ "https://Stackoverflow.com/questions/16818309", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2331198/" ]
The `copy()` function needs the full file path for the source file; you're just passing the filename, not the path. As things stand, it's looking in the current folder for the file, not finding it, and throwing the error as a result. From the previous line of code, it looks like your full path should be `$path . DS ....
Your copy function is wrong... ``` copy($uploadImage, $path2); ``` As Spudley answer says, you have to use the full path of the image. Also, `$path2` is a directory. You have to give a name for the new copy of the image. So, your copy function would be as follows: ``` copy($path . DS . $uploadImage, $path2. DS ....
5,982,094
I have managed to fork and exec a different program from within my app. I'm currently working on how to wait until the process called from exec returns a result through a pipe or stdout. However, can I have a group of processes using a single fork, or do I have to fork many times and call the same program again? Can I ...
2011/05/12
[ "https://Stackoverflow.com/questions/5982094", "https://Stackoverflow.com", "https://Stackoverflow.com/users/499699/" ]
One `Fork` syscall make only one new process (one PID). You should organize some data structures (e.g. array of pids, array of parent's ends of pipes, etc), do 8 fork from main program (every child will do `exec`) and then wait for childs. After each fork() it will return you a PID of child. You can store this pid and...
It's mind-bending at first, but you seem to grasp that, when you call fork( ): * the calling process (the "parent") is essentially duplicated by the operating system and the duplicate process becomes the "child" with a unique PID all its own; * the returned value from the fork( ) call is either: integer 0,1 meaning ...
5,982,094
I have managed to fork and exec a different program from within my app. I'm currently working on how to wait until the process called from exec returns a result through a pipe or stdout. However, can I have a group of processes using a single fork, or do I have to fork many times and call the same program again? Can I ...
2011/05/12
[ "https://Stackoverflow.com/questions/5982094", "https://Stackoverflow.com", "https://Stackoverflow.com/users/499699/" ]
One `Fork` syscall make only one new process (one PID). You should organize some data structures (e.g. array of pids, array of parent's ends of pipes, etc), do 8 fork from main program (every child will do `exec`) and then wait for childs. After each fork() it will return you a PID of child. You can store this pid and...
It's been a while since I've worked in C/C++, but a few points: * The Wikipedia [fork-exec page](http://en.wikipedia.org/wiki/Fork-exec) provides a starting point to learn about forking and execing. Google is your friend here too. * As osgx's answer says, fork() can only give you one subprocess, so you'll have to call...
5,982,094
I have managed to fork and exec a different program from within my app. I'm currently working on how to wait until the process called from exec returns a result through a pipe or stdout. However, can I have a group of processes using a single fork, or do I have to fork many times and call the same program again? Can I ...
2011/05/12
[ "https://Stackoverflow.com/questions/5982094", "https://Stackoverflow.com", "https://Stackoverflow.com/users/499699/" ]
It's mind-bending at first, but you seem to grasp that, when you call fork( ): * the calling process (the "parent") is essentially duplicated by the operating system and the duplicate process becomes the "child" with a unique PID all its own; * the returned value from the fork( ) call is either: integer 0,1 meaning ...
It's been a while since I've worked in C/C++, but a few points: * The Wikipedia [fork-exec page](http://en.wikipedia.org/wiki/Fork-exec) provides a starting point to learn about forking and execing. Google is your friend here too. * As osgx's answer says, fork() can only give you one subprocess, so you'll have to call...
4,004,926
I cannot seem to find a solution to the following Diophantine Equation: $x^2-y^3=2$, where $x,y \in \mathbb{Z}.$ I thought that I could maybe reduce it to a simpler equation , maybe check for the extension $\mathbb{Q}\left[\sqrt{2}\right],$ but nothing that I have tried seems to work. Perhaps it is a known equation/cur...
2021/01/29
[ "https://math.stackexchange.com/questions/4004926", "https://math.stackexchange.com", "https://math.stackexchange.com/users/870427/" ]
Let $x$ and $y$ be integers such that $x^2-y^3=2$. Then $x$ and $y$ are both odd, and $$y^3=(x-\sqrt{2})(x+\sqrt{2}),$$ where the gcd of the two factors on the right hand side divides their sum $2\sqrt{2}=\sqrt{2}^3$, and because their product is odd we see that they are coprime. Because $\Bbb{Z}[\sqrt{2}]$ is a unique...
$x^2-y^3=2\quad\implies\quad y=\sqrt[\large3]{x^2-2}\quad\lor\quad x=\sqrt{y^3+2}\quad$ Both equations are true only when $\quad (x,y)=(\pm1,-1)$ For larger values, no squares and cubes differ by only $2$.
4,004,926
I cannot seem to find a solution to the following Diophantine Equation: $x^2-y^3=2$, where $x,y \in \mathbb{Z}.$ I thought that I could maybe reduce it to a simpler equation , maybe check for the extension $\mathbb{Q}\left[\sqrt{2}\right],$ but nothing that I have tried seems to work. Perhaps it is a known equation/cur...
2021/01/29
[ "https://math.stackexchange.com/questions/4004926", "https://math.stackexchange.com", "https://math.stackexchange.com/users/870427/" ]
Let $x$ and $y$ be integers such that $x^2-y^3=2$. Then $x$ and $y$ are both odd, and $$y^3=(x-\sqrt{2})(x+\sqrt{2}),$$ where the gcd of the two factors on the right hand side divides their sum $2\sqrt{2}=\sqrt{2}^3$, and because their product is odd we see that they are coprime. Because $\Bbb{Z}[\sqrt{2}]$ is a unique...
COMMENT.- The discriminant $\Delta = - (4a ^ 3 + 27b ^ 2)$ of the curve $x ^ 2 = y ^ 3 + 2$ considering it as a case of $y ^ 2 = x ^ 3 + ax + b$ (Weirstrass form) in which they have reversed the usual roles of the coordinates, it is different from zero so the curve is not singular or elliptic. There is an obvious solut...
4,004,926
I cannot seem to find a solution to the following Diophantine Equation: $x^2-y^3=2$, where $x,y \in \mathbb{Z}.$ I thought that I could maybe reduce it to a simpler equation , maybe check for the extension $\mathbb{Q}\left[\sqrt{2}\right],$ but nothing that I have tried seems to work. Perhaps it is a known equation/cur...
2021/01/29
[ "https://math.stackexchange.com/questions/4004926", "https://math.stackexchange.com", "https://math.stackexchange.com/users/870427/" ]
Let $x$ and $y$ be integers such that $x^2-y^3=2$. Then $x$ and $y$ are both odd, and $$y^3=(x-\sqrt{2})(x+\sqrt{2}),$$ where the gcd of the two factors on the right hand side divides their sum $2\sqrt{2}=\sqrt{2}^3$, and because their product is odd we see that they are coprime. Because $\Bbb{Z}[\sqrt{2}]$ is a unique...
This is an elliptic curve, and can be solved by a computer algebra system. I use the following code on [sage cell server](https://sagecell.sagemath.org/), and you can also try it yourself. ``` E = EllipticCurve([0, 2]) print(E.integral_points()) ``` The output: ``` [(-1 : 1 : 1)] ``` Therefore this is (up to sig...
4,004,926
I cannot seem to find a solution to the following Diophantine Equation: $x^2-y^3=2$, where $x,y \in \mathbb{Z}.$ I thought that I could maybe reduce it to a simpler equation , maybe check for the extension $\mathbb{Q}\left[\sqrt{2}\right],$ but nothing that I have tried seems to work. Perhaps it is a known equation/cur...
2021/01/29
[ "https://math.stackexchange.com/questions/4004926", "https://math.stackexchange.com", "https://math.stackexchange.com/users/870427/" ]
COMMENT.- The discriminant $\Delta = - (4a ^ 3 + 27b ^ 2)$ of the curve $x ^ 2 = y ^ 3 + 2$ considering it as a case of $y ^ 2 = x ^ 3 + ax + b$ (Weirstrass form) in which they have reversed the usual roles of the coordinates, it is different from zero so the curve is not singular or elliptic. There is an obvious solut...
$x^2-y^3=2\quad\implies\quad y=\sqrt[\large3]{x^2-2}\quad\lor\quad x=\sqrt{y^3+2}\quad$ Both equations are true only when $\quad (x,y)=(\pm1,-1)$ For larger values, no squares and cubes differ by only $2$.
4,004,926
I cannot seem to find a solution to the following Diophantine Equation: $x^2-y^3=2$, where $x,y \in \mathbb{Z}.$ I thought that I could maybe reduce it to a simpler equation , maybe check for the extension $\mathbb{Q}\left[\sqrt{2}\right],$ but nothing that I have tried seems to work. Perhaps it is a known equation/cur...
2021/01/29
[ "https://math.stackexchange.com/questions/4004926", "https://math.stackexchange.com", "https://math.stackexchange.com/users/870427/" ]
This is an elliptic curve, and can be solved by a computer algebra system. I use the following code on [sage cell server](https://sagecell.sagemath.org/), and you can also try it yourself. ``` E = EllipticCurve([0, 2]) print(E.integral_points()) ``` The output: ``` [(-1 : 1 : 1)] ``` Therefore this is (up to sig...
$x^2-y^3=2\quad\implies\quad y=\sqrt[\large3]{x^2-2}\quad\lor\quad x=\sqrt{y^3+2}\quad$ Both equations are true only when $\quad (x,y)=(\pm1,-1)$ For larger values, no squares and cubes differ by only $2$.
18,639,962
My controller calls this model method on update: ``` def update_standard(param_attributes) ... if param_attributes[:is_legacy] == true param_attributes[:foo_type_id] = 2 end update_attributes(param_attributes) end ``` `foo_type_id` should overwrite whatever the user entered in the form, but the user's choice...
2013/09/05
[ "https://Stackoverflow.com/questions/18639962", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1810434/" ]
``` param_attributes[:is_legacy] == "true" ? param_attributes[:foo_type_id] = 2 : param_attributes[:foo_type_id] update_attributes(param_attributes) ```
I think there could be some issues with your logic evaluation. Try changing this to the following and see if it works? ``` if !param_attributes[:is_legacy].nil? && param_attributes[:is_legacy].to_sym == :true param_attributes[:foo_type_id] = 2 end ```
18,639,962
My controller calls this model method on update: ``` def update_standard(param_attributes) ... if param_attributes[:is_legacy] == true param_attributes[:foo_type_id] = 2 end update_attributes(param_attributes) end ``` `foo_type_id` should overwrite whatever the user entered in the form, but the user's choice...
2013/09/05
[ "https://Stackoverflow.com/questions/18639962", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1810434/" ]
You should check to make sure that `params[:is_legacy]` actually returns `true` and not `"true"` -- pretty sure params are always strings.
I think there could be some issues with your logic evaluation. Try changing this to the following and see if it works? ``` if !param_attributes[:is_legacy].nil? && param_attributes[:is_legacy].to_sym == :true param_attributes[:foo_type_id] = 2 end ```
326,253
**UPDATE** I've posted my solution below. --- This thing popped up on the computer of one of my employees on Friday. I've spent most of the weekend scanning the computer with Avira AntiVir, Avira Boot Sector Repair Tool, Kaspersky Virus Removal Tool, Malwarebytes, Spybot, McAfee Stinger, and something else I forgot ...
2011/08/22
[ "https://superuser.com/questions/326253", "https://superuser.com", "https://superuser.com/users/31673/" ]
How much time have you spent already trying to fix the PC? You may just find that booting with something like an Ubuntu live CD to copy all data to a removable USB hard drive, then formatting the disk and re-installing is actually the fastest way to solve this problem. I've seen it happen time and time again where so...
Most, but not all, malware can be **manually** removed with [autoruns](http://technet.microsoft.com/en-us/sysinternals/bb963902). Try the following procedure: * download autoruns from the above link and run it straight from the zip archive * let it scan (if it can) * look for two types of entries - ones with **no sig...
326,253
**UPDATE** I've posted my solution below. --- This thing popped up on the computer of one of my employees on Friday. I've spent most of the weekend scanning the computer with Avira AntiVir, Avira Boot Sector Repair Tool, Kaspersky Virus Removal Tool, Malwarebytes, Spybot, McAfee Stinger, and something else I forgot ...
2011/08/22
[ "https://superuser.com/questions/326253", "https://superuser.com", "https://superuser.com/users/31673/" ]
So, after spending several days fighting this thing, I finally got rid of it. I'm pretty sure I got the right one, but along the way I found some suspicious items that could have contributed. Here's the steps it took to clean it up. First thing I did was to check all of the autostart locations on windows. I followed t...
This seems to be a brand new scareware. As far as I see, it has not been described by the antivirus specialists yet. It threatens to delete the contents of the disk and sue you for using an illegal copy of Windows. I propose you turn off the infected computer, remove the disk and copy the contents of the disk to some...
326,253
**UPDATE** I've posted my solution below. --- This thing popped up on the computer of one of my employees on Friday. I've spent most of the weekend scanning the computer with Avira AntiVir, Avira Boot Sector Repair Tool, Kaspersky Virus Removal Tool, Malwarebytes, Spybot, McAfee Stinger, and something else I forgot ...
2011/08/22
[ "https://superuser.com/questions/326253", "https://superuser.com", "https://superuser.com/users/31673/" ]
As it's been said over and over again, the *only* sure-fire way to ensure that a virus is gone is to format your computer, and re-install things one by one. That said, this isn't technically a virus, but a new kind of malware that makes you pay to remove it, which you should not do under any circumstances, because you...
Most, but not all, malware can be **manually** removed with [autoruns](http://technet.microsoft.com/en-us/sysinternals/bb963902). Try the following procedure: * download autoruns from the above link and run it straight from the zip archive * let it scan (if it can) * look for two types of entries - ones with **no sig...
326,253
**UPDATE** I've posted my solution below. --- This thing popped up on the computer of one of my employees on Friday. I've spent most of the weekend scanning the computer with Avira AntiVir, Avira Boot Sector Repair Tool, Kaspersky Virus Removal Tool, Malwarebytes, Spybot, McAfee Stinger, and something else I forgot ...
2011/08/22
[ "https://superuser.com/questions/326253", "https://superuser.com", "https://superuser.com/users/31673/" ]
As it's been said over and over again, the *only* sure-fire way to ensure that a virus is gone is to format your computer, and re-install things one by one. That said, this isn't technically a virus, but a new kind of malware that makes you pay to remove it, which you should not do under any circumstances, because you...
It seems to be the [BKA Trojan](http://www.google.com/search?q=bka%20trojan) (the first couple of results are links to the scareware’s site, so don’t use those). It seems that the [consensus](http://translate.google.com/translate?hl=en&sl=auto&tl=en&twu=1&u=http://www.computerbase.de/forum/showthread.php?t=940165) is t...
326,253
**UPDATE** I've posted my solution below. --- This thing popped up on the computer of one of my employees on Friday. I've spent most of the weekend scanning the computer with Avira AntiVir, Avira Boot Sector Repair Tool, Kaspersky Virus Removal Tool, Malwarebytes, Spybot, McAfee Stinger, and something else I forgot ...
2011/08/22
[ "https://superuser.com/questions/326253", "https://superuser.com", "https://superuser.com/users/31673/" ]
So, after spending several days fighting this thing, I finally got rid of it. I'm pretty sure I got the right one, but along the way I found some suspicious items that could have contributed. Here's the steps it took to clean it up. First thing I did was to check all of the autostart locations on windows. I followed t...
It seems to be the [BKA Trojan](http://www.google.com/search?q=bka%20trojan) (the first couple of results are links to the scareware’s site, so don’t use those). It seems that the [consensus](http://translate.google.com/translate?hl=en&sl=auto&tl=en&twu=1&u=http://www.computerbase.de/forum/showthread.php?t=940165) is t...
326,253
**UPDATE** I've posted my solution below. --- This thing popped up on the computer of one of my employees on Friday. I've spent most of the weekend scanning the computer with Avira AntiVir, Avira Boot Sector Repair Tool, Kaspersky Virus Removal Tool, Malwarebytes, Spybot, McAfee Stinger, and something else I forgot ...
2011/08/22
[ "https://superuser.com/questions/326253", "https://superuser.com", "https://superuser.com/users/31673/" ]
It seems to be the [BKA Trojan](http://www.google.com/search?q=bka%20trojan) (the first couple of results are links to the scareware’s site, so don’t use those). It seems that the [consensus](http://translate.google.com/translate?hl=en&sl=auto&tl=en&twu=1&u=http://www.computerbase.de/forum/showthread.php?t=940165) is t...
Most, but not all, malware can be **manually** removed with [autoruns](http://technet.microsoft.com/en-us/sysinternals/bb963902). Try the following procedure: * download autoruns from the above link and run it straight from the zip archive * let it scan (if it can) * look for two types of entries - ones with **no sig...
326,253
**UPDATE** I've posted my solution below. --- This thing popped up on the computer of one of my employees on Friday. I've spent most of the weekend scanning the computer with Avira AntiVir, Avira Boot Sector Repair Tool, Kaspersky Virus Removal Tool, Malwarebytes, Spybot, McAfee Stinger, and something else I forgot ...
2011/08/22
[ "https://superuser.com/questions/326253", "https://superuser.com", "https://superuser.com/users/31673/" ]
As it's been said over and over again, the *only* sure-fire way to ensure that a virus is gone is to format your computer, and re-install things one by one. That said, this isn't technically a virus, but a new kind of malware that makes you pay to remove it, which you should not do under any circumstances, because you...
How much time have you spent already trying to fix the PC? You may just find that booting with something like an Ubuntu live CD to copy all data to a removable USB hard drive, then formatting the disk and re-installing is actually the fastest way to solve this problem. I've seen it happen time and time again where so...
326,253
**UPDATE** I've posted my solution below. --- This thing popped up on the computer of one of my employees on Friday. I've spent most of the weekend scanning the computer with Avira AntiVir, Avira Boot Sector Repair Tool, Kaspersky Virus Removal Tool, Malwarebytes, Spybot, McAfee Stinger, and something else I forgot ...
2011/08/22
[ "https://superuser.com/questions/326253", "https://superuser.com", "https://superuser.com/users/31673/" ]
This seems to be a brand new scareware. As far as I see, it has not been described by the antivirus specialists yet. It threatens to delete the contents of the disk and sue you for using an illegal copy of Windows. I propose you turn off the infected computer, remove the disk and copy the contents of the disk to some...
Most, but not all, malware can be **manually** removed with [autoruns](http://technet.microsoft.com/en-us/sysinternals/bb963902). Try the following procedure: * download autoruns from the above link and run it straight from the zip archive * let it scan (if it can) * look for two types of entries - ones with **no sig...
326,253
**UPDATE** I've posted my solution below. --- This thing popped up on the computer of one of my employees on Friday. I've spent most of the weekend scanning the computer with Avira AntiVir, Avira Boot Sector Repair Tool, Kaspersky Virus Removal Tool, Malwarebytes, Spybot, McAfee Stinger, and something else I forgot ...
2011/08/22
[ "https://superuser.com/questions/326253", "https://superuser.com", "https://superuser.com/users/31673/" ]
How much time have you spent already trying to fix the PC? You may just find that booting with something like an Ubuntu live CD to copy all data to a removable USB hard drive, then formatting the disk and re-installing is actually the fastest way to solve this problem. I've seen it happen time and time again where so...
This seems to be a brand new scareware. As far as I see, it has not been described by the antivirus specialists yet. It threatens to delete the contents of the disk and sue you for using an illegal copy of Windows. I propose you turn off the infected computer, remove the disk and copy the contents of the disk to some...
326,253
**UPDATE** I've posted my solution below. --- This thing popped up on the computer of one of my employees on Friday. I've spent most of the weekend scanning the computer with Avira AntiVir, Avira Boot Sector Repair Tool, Kaspersky Virus Removal Tool, Malwarebytes, Spybot, McAfee Stinger, and something else I forgot ...
2011/08/22
[ "https://superuser.com/questions/326253", "https://superuser.com", "https://superuser.com/users/31673/" ]
So, after spending several days fighting this thing, I finally got rid of it. I'm pretty sure I got the right one, but along the way I found some suspicious items that could have contributed. Here's the steps it took to clean it up. First thing I did was to check all of the autostart locations on windows. I followed t...
How much time have you spent already trying to fix the PC? You may just find that booting with something like an Ubuntu live CD to copy all data to a removable USB hard drive, then formatting the disk and re-installing is actually the fastest way to solve this problem. I've seen it happen time and time again where so...
34,367,700
This is my HTML code. ``` <img src="images/maxicon.png" class="iconimg" width="100%" alt=""> <a href="#"><img src="images/link.png" class="linkimg" alt=""></a> ``` This is the CSS: ``` .linkimg { display: none; } .iconimg:hover .linkimg { display: block; } ``` I have tried several solutions available on...
2015/12/19
[ "https://Stackoverflow.com/questions/34367700", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4246306/" ]
I think you can use only Ninja Forms without extensions, and hook directly in 'ninja\_forms\_after\_submission' that fires after submission and allow you to use data submitted and perform actions. This is a starter codebase to achieve your result, but needs to be customized on your needs and your form structure. ``` ...
The Ninja Forms Front-end Posting extension isn't really meant for displaying form submission data on the front end. From: <https://ninjaforms.com/extensions/front-end-posting/> "The Ninja Forms Front-end Posting extension gives you the power of the WordPress post editor on any publicly viewable page you choose." If...
34,367,700
This is my HTML code. ``` <img src="images/maxicon.png" class="iconimg" width="100%" alt=""> <a href="#"><img src="images/link.png" class="linkimg" alt=""></a> ``` This is the CSS: ``` .linkimg { display: none; } .iconimg:hover .linkimg { display: block; } ``` I have tried several solutions available on...
2015/12/19
[ "https://Stackoverflow.com/questions/34367700", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4246306/" ]
I think you can use only Ninja Forms without extensions, and hook directly in 'ninja\_forms\_after\_submission' that fires after submission and allow you to use data submitted and perform actions. This is a starter codebase to achieve your result, but needs to be customized on your needs and your form structure. ``` ...
If you do not mind paying a little money for a plugin I would recommend using gravity forms rather then ninja forms for more advanced stuff like this. I manually create a custom post type "oproep" and used a gravityforms plugin to create a custom post from type oproep when an user submits the form. Because you use c...
34,367,700
This is my HTML code. ``` <img src="images/maxicon.png" class="iconimg" width="100%" alt=""> <a href="#"><img src="images/link.png" class="linkimg" alt=""></a> ``` This is the CSS: ``` .linkimg { display: none; } .iconimg:hover .linkimg { display: block; } ``` I have tried several solutions available on...
2015/12/19
[ "https://Stackoverflow.com/questions/34367700", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4246306/" ]
I think you can use only Ninja Forms without extensions, and hook directly in 'ninja\_forms\_after\_submission' that fires after submission and allow you to use data submitted and perform actions. This is a starter codebase to achieve your result, but needs to be customized on your needs and your form structure. ``` ...
FrancescoCarlucci's answer is correct, but just adding an additional comment: in case you want to specify by form field IDs which fields should go where in your post, NinjaForms passes the ID as a number (in my case for example, I needed field 136 for my post title). It may have been obvious but I racked my brain for a...
298,907
I'm new to Magento(2) and I'm trying to display Stock Status, stock count, and quantity field in category view like in product view. I don't know where to get theses values and where to put it... I'm using magento 2.2.10 and I'm using the default luma theme I found that if i comment some containers in `catalog_product...
2019/12/16
[ "https://magento.stackexchange.com/questions/298907", "https://magento.stackexchange.com", "https://magento.stackexchange.com/users/84912/" ]
I have seen this error when the install does not have enough memory. Check your hosting settings. `memory_limit` should be 768 mb +
**Solutions** You have to delete an order grid entry from the `ui_bookmark` table. In a `ui_bookmark` table, delete the row where you want to reset the filter. or if you don't know which entry of order then you can truncate this table.
54,187,408
I have a list of combinations of companies, cities, and states in excel, each a string. I would like to split the string of words based on a given word (the city name) and the result to be two columns, one with with company name, one with the city and state. Splitting on space or symbol delimiters doesn't work becaus...
2019/01/14
[ "https://Stackoverflow.com/questions/54187408", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6460510/" ]
If you want to avoid VBA, the following formulas could work for you: ``` =LEFT(A2,FIND(B2,A2)-2) =RIGHT(A2,LEN(A2)-FIND(B2,A2)+1) ```
You can use this as two functions (one returns the left part, other returns the right part): ``` Function split1(str As String, dlmtr As String) As String Dim pt1() As String pt1 = Split(str, dlmtr) split1 = pt1(0) End Function Function split2(str As String, dlmtr As String) As String Dim pt2() As String pt2 = Split(...
47,914,409
Is it possible to form a query where table1.first\_name + " " + table1.last\_name matches table2.customer\_name? IE: customers.first\_name = "John" customers.last\_name = "Doe" orders.customer\_name = "John Doe" It seems to me this would be a common query, but just can't come up with the syntax intuitively. Also, I...
2017/12/20
[ "https://Stackoverflow.com/questions/47914409", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8621188/" ]
You are looking for `concat` ``` where concat(customers.first_name,' ',customers.last_name) = orders.customer_name ```
You can concatenate the values and compare the result as so: ``` (customers.first_name || ' ' || customers.last_name) = orders.customer_name ``` Brackets only for readability
48,271,741
This appears to only happen when I'm using the `generic/arch` box. I've tried several ubuntu boxes and everything works fine. Host OS is Manjaro. It's freezing with output: ``` INFO interface: info: ==> default: Waiting for domain to get an IP address... ...
2018/01/15
[ "https://Stackoverflow.com/questions/48271741", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3937773/" ]
Since you are using the libvirt provider, you should be able to check out the state of the virtual machine with `virt-manager`. The rest of the answer is written under the two assumptions that my system is not so different from yours and that I have run into the same problem using vagrant-libvirt and generic/arch (v1....
In my case, I had overly restrictive `iptables` rules preventing the NAT which is set up for the virtual network bridge(s) `virbr*` by Vagrant via libvirt. As an experiment, I disabled all firewall rules before starting the Vagrant machine and it was able to get an IP address.
6,214,722
I have some videos and I want to test their with automation. Could you tell, how does `selenium-webdriver` work with video? How does it recognize it?
2011/06/02
[ "https://Stackoverflow.com/questions/6214722", "https://Stackoverflow.com", "https://Stackoverflow.com/users/449397/" ]
You can reshape or delete the cells themselves using ()-addressing. ``` model(:,2) = []; ```
You have to transpose the two pieces, and change some parentheses: ``` temp= [{ model{:,1:i-1}}' {model{:,i+1:size(model,2)}}'] ```
6,214,722
I have some videos and I want to test their with automation. Could you tell, how does `selenium-webdriver` work with video? How does it recognize it?
2011/06/02
[ "https://Stackoverflow.com/questions/6214722", "https://Stackoverflow.com", "https://Stackoverflow.com/users/449397/" ]
You can reshape or delete the cells themselves using ()-addressing. ``` model(:,2) = []; ```
there is a function called fun\_removecellrowcols, which removes specific row/columns indicated by the user. This affects the dimensions of the cell, due to the row/cols removal. <http://www.mathworks.com/matlabcentral/fileexchange/46196-fun-removecellrowcols> Regards, José
129,542
I've spent a good part of the day searching, writing and finally scrapping a script that I can use with my Inno Setup install script that will download and install the appropriate .NET 2.0 Framework if needed. There are definitely a number of examples out there, but they: 1. Want to install Internet Explorer if neede...
2008/09/24
[ "https://Stackoverflow.com/questions/129542", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7442/" ]
[.NET Framework 1.1/2.0/3.5 Installer for InnoSetup](http://www.codeproject.com/KB/install/dotnetfx_innosetup_instal.aspx)
I have recently been looking into this issue but without the same requirements that you have. I haven't seen a script that does what you want but have you considered instead checking if .NET 2.0 is installed and if not then prompt them to download it. You can open a URL in the default browser and get the user to attemp...
5,237,005
Say I have a table `customers` with the following fields and records: ``` id first_name last_name email phone ------------------------------------------------------------------------ 1 Michael Turley mturley@whatever.com 555-123-4567 2 John Dohe jdoe@whatever.com...
2011/03/08
[ "https://Stackoverflow.com/questions/5237005", "https://Stackoverflow.com", "https://Stackoverflow.com/users/354065/" ]
The short answer is, no there isn't a better way (that I can think of). It's a trade off. If you find there are a lot of these instances, it might be worthwhile to invest some time writing a more robust algorithm for checking existing customers prior to adding a new one (i.e. checking variations on first / last names,...
As an update to my comment: ``` use information_schema; select table_name from columns where column_name = 'customer_id'; ``` Then loop through the resulting tables and update accordingly. Personally, I would use your instinctive solution, as this one may be dangerous if there are tables containing customer\_id co...
5,237,005
Say I have a table `customers` with the following fields and records: ``` id first_name last_name email phone ------------------------------------------------------------------------ 1 Michael Turley mturley@whatever.com 555-123-4567 2 John Dohe jdoe@whatever.com...
2011/03/08
[ "https://Stackoverflow.com/questions/5237005", "https://Stackoverflow.com", "https://Stackoverflow.com/users/354065/" ]
I got here form google this is my 2 cents: ``` SELECT `TABLE_NAME` FROM `information_schema`.`KEY_COLUMN_USAGE` WHERE REFERENCED_TABLE_SCHEMA='DATABASE' AND REFERENCED_TABLE_NAME='customers' AND REFERENCED_COLUMN_NAME='customer_id' ``` add the db for insurance (you'll never know when somebody copies the db). ...
The short answer is, no there isn't a better way (that I can think of). It's a trade off. If you find there are a lot of these instances, it might be worthwhile to invest some time writing a more robust algorithm for checking existing customers prior to adding a new one (i.e. checking variations on first / last names,...
5,237,005
Say I have a table `customers` with the following fields and records: ``` id first_name last_name email phone ------------------------------------------------------------------------ 1 Michael Turley mturley@whatever.com 555-123-4567 2 John Dohe jdoe@whatever.com...
2011/03/08
[ "https://Stackoverflow.com/questions/5237005", "https://Stackoverflow.com", "https://Stackoverflow.com/users/354065/" ]
At a minimum, to prevent any triggers on deletions causing some cascading effect, I would FIRST do update SomeTable set CustomerID = CorrectValue where CustomerID = WrongValue (do that across all tables)... THEN Delete from Customers where CustomerID = WrongValue As for duplicate data... Try to figure out which "...
As an update to my comment: ``` use information_schema; select table_name from columns where column_name = 'customer_id'; ``` Then loop through the resulting tables and update accordingly. Personally, I would use your instinctive solution, as this one may be dangerous if there are tables containing customer\_id co...
5,237,005
Say I have a table `customers` with the following fields and records: ``` id first_name last_name email phone ------------------------------------------------------------------------ 1 Michael Turley mturley@whatever.com 555-123-4567 2 John Dohe jdoe@whatever.com...
2011/03/08
[ "https://Stackoverflow.com/questions/5237005", "https://Stackoverflow.com", "https://Stackoverflow.com/users/354065/" ]
I got here form google this is my 2 cents: ``` SELECT `TABLE_NAME` FROM `information_schema`.`KEY_COLUMN_USAGE` WHERE REFERENCED_TABLE_SCHEMA='DATABASE' AND REFERENCED_TABLE_NAME='customers' AND REFERENCED_COLUMN_NAME='customer_id' ``` add the db for insurance (you'll never know when somebody copies the db). ...
At a minimum, to prevent any triggers on deletions causing some cascading effect, I would FIRST do update SomeTable set CustomerID = CorrectValue where CustomerID = WrongValue (do that across all tables)... THEN Delete from Customers where CustomerID = WrongValue As for duplicate data... Try to figure out which "...
5,237,005
Say I have a table `customers` with the following fields and records: ``` id first_name last_name email phone ------------------------------------------------------------------------ 1 Michael Turley mturley@whatever.com 555-123-4567 2 John Dohe jdoe@whatever.com...
2011/03/08
[ "https://Stackoverflow.com/questions/5237005", "https://Stackoverflow.com", "https://Stackoverflow.com/users/354065/" ]
I got here form google this is my 2 cents: ``` SELECT `TABLE_NAME` FROM `information_schema`.`KEY_COLUMN_USAGE` WHERE REFERENCED_TABLE_SCHEMA='DATABASE' AND REFERENCED_TABLE_NAME='customers' AND REFERENCED_COLUMN_NAME='customer_id' ``` add the db for insurance (you'll never know when somebody copies the db). ...
As an update to my comment: ``` use information_schema; select table_name from columns where column_name = 'customer_id'; ``` Then loop through the resulting tables and update accordingly. Personally, I would use your instinctive solution, as this one may be dangerous if there are tables containing customer\_id co...
30,458,408
I'm trying to post a new record in a table with `<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">`. But every row in my table has an unique id, and that id is put next to every `name`. So I'm trying to get the id with `$_GET` but it's been unsuccesful so far. Is the method I'm trying wrong or am I doin...
2015/05/26
[ "https://Stackoverflow.com/questions/30458408", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3095385/" ]
Your button name is ``` name="saveRecord<?php echo $id; ?> ``` SO this condition need `$id` ``` if (isset($_POST['saveRecord'])) {// your id missing ```
move your opening and closing form tags in while loop,it will submit only 1 form at a time,otherwise all the inputs will be submitted.
30,458,408
I'm trying to post a new record in a table with `<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">`. But every row in my table has an unique id, and that id is put next to every `name`. So I'm trying to get the id with `$_GET` but it's been unsuccesful so far. Is the method I'm trying wrong or am I doin...
2015/05/26
[ "https://Stackoverflow.com/questions/30458408", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3095385/" ]
Don't bother trying to do both at once (the $\_GET variables will only be passed if it is included in the action of the form). The script won't pick up the the records from the $\_POST as the names of the field have the ID included in them. Either create each record as an individual form (move the whole lot inside th...
Your button name is ``` name="saveRecord<?php echo $id; ?> ``` SO this condition need `$id` ``` if (isset($_POST['saveRecord'])) {// your id missing ```
30,458,408
I'm trying to post a new record in a table with `<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">`. But every row in my table has an unique id, and that id is put next to every `name`. So I'm trying to get the id with `$_GET` but it's been unsuccesful so far. Is the method I'm trying wrong or am I doin...
2015/05/26
[ "https://Stackoverflow.com/questions/30458408", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3095385/" ]
Don't bother trying to do both at once (the $\_GET variables will only be passed if it is included in the action of the form). The script won't pick up the the records from the $\_POST as the names of the field have the ID included in them. Either create each record as an individual form (move the whole lot inside th...
move your opening and closing form tags in while loop,it will submit only 1 form at a time,otherwise all the inputs will be submitted.
5,235,868
I have just set up a test that checks that I am able to insert entries into my database using Hibernate. The thing that drives me crazy is that Hibernate does not actually delete the entries, although it reports that they are gone! The test below runs successfully, but when I check my DB afterwards the entries that w...
2011/03/08
[ "https://Stackoverflow.com/questions/5235868", "https://Stackoverflow.com", "https://Stackoverflow.com/users/200987/" ]
I guess it's related to inconsistent use of transactions (note that `beginTransaction()` in `allStatisticItemsInDB()` is called several times without corresponding commits). Try to manage transactions in proper way, for example, like this: ``` Session session = HibernateUtil.getSessionFactory().getCurrentSession(); T...
Can you post your DB schema and HBM or Fluent maps? One thing that got me a while back was I had a ReadOnly() in my Fluent map. It never threw an error and I too saw the "delete from blah where blahblah=..." in the logs.
5,235,868
I have just set up a test that checks that I am able to insert entries into my database using Hibernate. The thing that drives me crazy is that Hibernate does not actually delete the entries, although it reports that they are gone! The test below runs successfully, but when I check my DB afterwards the entries that w...
2011/03/08
[ "https://Stackoverflow.com/questions/5235868", "https://Stackoverflow.com", "https://Stackoverflow.com/users/200987/" ]
I guess it's related to inconsistent use of transactions (note that `beginTransaction()` in `allStatisticItemsInDB()` is called several times without corresponding commits). Try to manage transactions in proper way, for example, like this: ``` Session session = HibernateUtil.getSessionFactory().getCurrentSession(); T...
I have the same problem. Although I was not using transaction at all. I was using namedQuery like this : ``` Query query = session.getNamedQuery(EmployeeNQ.DELETE_EMPLOYEES); int rows = query.executeUpdate(); session.close(); ``` It was returning 2 rows but the database still had all the records. Then I wrap up the...
5,235,868
I have just set up a test that checks that I am able to insert entries into my database using Hibernate. The thing that drives me crazy is that Hibernate does not actually delete the entries, although it reports that they are gone! The test below runs successfully, but when I check my DB afterwards the entries that w...
2011/03/08
[ "https://Stackoverflow.com/questions/5235868", "https://Stackoverflow.com", "https://Stackoverflow.com/users/200987/" ]
I have the same problem. Although I was not using transaction at all. I was using namedQuery like this : ``` Query query = session.getNamedQuery(EmployeeNQ.DELETE_EMPLOYEES); int rows = query.executeUpdate(); session.close(); ``` It was returning 2 rows but the database still had all the records. Then I wrap up the...
Can you post your DB schema and HBM or Fluent maps? One thing that got me a while back was I had a ReadOnly() in my Fluent map. It never threw an error and I too saw the "delete from blah where blahblah=..." in the logs.
9,392,951
I've been successfully able to generate a `.docx` document with <https://github.com/djpate/docxgen> but as soon as i try to include TinyMCE text, i no longer can open the document. (non valid char). Is there a way to convert the HTML text before giving it to docxgen to avoid such error?
2012/02/22
[ "https://Stackoverflow.com/questions/9392951", "https://Stackoverflow.com", "https://Stackoverflow.com/users/318071/" ]
I've decided to go with the pro version of the library <http://www.phpdocx.com/> as it simplifies the whole process. I hope it'll fill my needs.
Another solution is using <http://htmltodocx.codeplex.com/> which just recently came out. I, however, tried it and it messed up my invoice (granted I used tables where I shouldn't have) Jim
9,392,951
I've been successfully able to generate a `.docx` document with <https://github.com/djpate/docxgen> but as soon as i try to include TinyMCE text, i no longer can open the document. (non valid char). Is there a way to convert the HTML text before giving it to docxgen to avoid such error?
2012/02/22
[ "https://Stackoverflow.com/questions/9392951", "https://Stackoverflow.com", "https://Stackoverflow.com/users/318071/" ]
Finally, I settled with this answer to create a doc (simply output html and Word will recognize it): ``` header( 'Content-Type: application/msword' ); header("Content-disposition: attachment; filename=" .date("Y-m-d").".doc"); /* header("Content-type: application/vnd.ms-word"); header("Content-d...
Another solution is using <http://htmltodocx.codeplex.com/> which just recently came out. I, however, tried it and it messed up my invoice (granted I used tables where I shouldn't have) Jim
4,156,378
How can we find the Jordan Canonical form given the minimal polynomial and the dimension of the kernel? I know how we could find it if either the matrix or the characteristic polynomial was given, but how does knowing the dimension of the kernel help us? $$ B: \mathbb{R}^4\rightarrow \mathbb{R}^4 $$ $$ m\_B(x) = (x-2)^...
2021/05/31
[ "https://math.stackexchange.com/questions/4156378", "https://math.stackexchange.com", "https://math.stackexchange.com/users/933806/" ]
There exists a bounded, non-entire function on the complex plane that is analytic/holomorphic in some region. > > One possible example is $g(z) = \max\bigl(0, \frac{|z|-1}{|z|+1}\bigr)$. The verification of properties is left as an exercise. > > >
As meromorphic functions diverge to infinity at the pole, the answer to your question is negative. Next best I can think of is examples of the following kind: Define $g(z) = z^n$ inside the unit disc and outside the unit disc as $z^n/|z|^n$. On the boundary of the unit disc both definitions agree and so we get a cont...
4,156,378
How can we find the Jordan Canonical form given the minimal polynomial and the dimension of the kernel? I know how we could find it if either the matrix or the characteristic polynomial was given, but how does knowing the dimension of the kernel help us? $$ B: \mathbb{R}^4\rightarrow \mathbb{R}^4 $$ $$ m\_B(x) = (x-2)^...
2021/05/31
[ "https://math.stackexchange.com/questions/4156378", "https://math.stackexchange.com", "https://math.stackexchange.com/users/933806/" ]
There exists a bounded, non-entire function on the complex plane that is analytic/holomorphic in some region. > > One possible example is $g(z) = \max\bigl(0, \frac{|z|-1}{|z|+1}\bigr)$. The verification of properties is left as an exercise. > > >
You can even go further and prescribe an arbitrary region and an arbitrary analytic function thereon (as long as the latter is bounded on the former). If you do not require continuity you can just continue your function by 0 (or any other value you wish for). But you can also work with a smooth cutoff function in the s...
24,320,502
This is my first trial in translating `pygtk` `glade`; I have created Rockdome.mo file on the following dir:`./locale/ar/LC_MESSAGES/Rockdome.mo` ``` def apply_locale(self , lang): domain = "Rockdome" local_path = basefolder+"/locale" # basefolder is the current dir lang = gettext.tra...
2014/06/20
[ "https://Stackoverflow.com/questions/24320502", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3231979/" ]
the following method works succefully with me > 1. use `locale` module not `gettext`. 2. execute `locale.setlocale(category , language )` 3. Set the `translation_domain` of `gtk.Builder` by `gtk.Builder.set_translation_domain()` before loading glade file by : EX:`gtk.Builder.add_from_file` Code ## ------- ``` im...
You are only changing the `lang` object within the scope of the function. You have to return it to set it properly. You need to call your function like this: `my_lang = apply_locale(lang)` or you could set `lang` as a property of the class. ``` def apply_locale(self , lang): domain = "Rockdome" local_path ...
32,277,451
``` <p id="demo"></p> <script> //This is the email list var emailList =["adam@yahoo.edu\n", "henry@yahoo.edu\n", "john@yahoo.edu\n", "sally@yahoo.edu\n", "adam@yahoo.edu\n", "david@yahoo.edu\n", "myhome@yahoo.edu\n", "david@yahoo.edu\n", "david@yahoo.edu\n", "hunger@yahoo.edu\n", "madison@yahoo.edu\n", ]; document.g...
2015/08/28
[ "https://Stackoverflow.com/questions/32277451", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5277453/" ]
A one-liner, people love one-liners ``` var names = emailList.map(function(e){ return e.split('@').shift(); }).sort(); ``` If you want to take specifically the `@yahoo*` out, change split param to '@yahoo' ``` var names = emailList.map(function(e){ return e.split('@yahoo').shift(); }).sort(); ``` This will leave...
Try this following code ``` Array.prototype.remove = function(replaceString){ this.join('#').replace(replaceString,'').split('#').sort(); } emailList.remove('@yahoo.com'); ```
32,277,451
``` <p id="demo"></p> <script> //This is the email list var emailList =["adam@yahoo.edu\n", "henry@yahoo.edu\n", "john@yahoo.edu\n", "sally@yahoo.edu\n", "adam@yahoo.edu\n", "david@yahoo.edu\n", "myhome@yahoo.edu\n", "david@yahoo.edu\n", "david@yahoo.edu\n", "hunger@yahoo.edu\n", "madison@yahoo.edu\n", ]; document.g...
2015/08/28
[ "https://Stackoverflow.com/questions/32277451", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5277453/" ]
You can use the **map** function to transform your current list to one without the yahoo part. ``` var myEmailList = emailList.map(function(email){ return email.replace("@yahoo.com", ""); }); ``` and then you can sort it. ``` myEmailList.sort(); ``` you might also consider joining the list so it looks pretty ...
Try this following code ``` Array.prototype.remove = function(replaceString){ this.join('#').replace(replaceString,'').split('#').sort(); } emailList.remove('@yahoo.com'); ```
32,277,451
``` <p id="demo"></p> <script> //This is the email list var emailList =["adam@yahoo.edu\n", "henry@yahoo.edu\n", "john@yahoo.edu\n", "sally@yahoo.edu\n", "adam@yahoo.edu\n", "david@yahoo.edu\n", "myhome@yahoo.edu\n", "david@yahoo.edu\n", "david@yahoo.edu\n", "hunger@yahoo.edu\n", "madison@yahoo.edu\n", ]; document.g...
2015/08/28
[ "https://Stackoverflow.com/questions/32277451", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5277453/" ]
A one-liner, people love one-liners ``` var names = emailList.map(function(e){ return e.split('@').shift(); }).sort(); ``` If you want to take specifically the `@yahoo*` out, change split param to '@yahoo' ``` var names = emailList.map(function(e){ return e.split('@yahoo').shift(); }).sort(); ``` This will leave...
You can use the **map** function to transform your current list to one without the yahoo part. ``` var myEmailList = emailList.map(function(email){ return email.replace("@yahoo.com", ""); }); ``` and then you can sort it. ``` myEmailList.sort(); ``` you might also consider joining the list so it looks pretty ...
32,277,451
``` <p id="demo"></p> <script> //This is the email list var emailList =["adam@yahoo.edu\n", "henry@yahoo.edu\n", "john@yahoo.edu\n", "sally@yahoo.edu\n", "adam@yahoo.edu\n", "david@yahoo.edu\n", "myhome@yahoo.edu\n", "david@yahoo.edu\n", "david@yahoo.edu\n", "hunger@yahoo.edu\n", "madison@yahoo.edu\n", ]; document.g...
2015/08/28
[ "https://Stackoverflow.com/questions/32277451", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5277453/" ]
You need to loop through each item in the array and replace the string: ``` function myFunction() { for (var i = 0; i < emailList.length; i++) { emailList[i] = emailList[i].replace("@yahoo.com", ""); } emailList.sort(); } ``` Don't forget to call the function when you need it: ``` myFunction(); ...
Try this following code ``` Array.prototype.remove = function(replaceString){ this.join('#').replace(replaceString,'').split('#').sort(); } emailList.remove('@yahoo.com'); ```
32,277,451
``` <p id="demo"></p> <script> //This is the email list var emailList =["adam@yahoo.edu\n", "henry@yahoo.edu\n", "john@yahoo.edu\n", "sally@yahoo.edu\n", "adam@yahoo.edu\n", "david@yahoo.edu\n", "myhome@yahoo.edu\n", "david@yahoo.edu\n", "david@yahoo.edu\n", "hunger@yahoo.edu\n", "madison@yahoo.edu\n", ]; document.g...
2015/08/28
[ "https://Stackoverflow.com/questions/32277451", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5277453/" ]
A one-liner, people love one-liners ``` var names = emailList.map(function(e){ return e.split('@').shift(); }).sort(); ``` If you want to take specifically the `@yahoo*` out, change split param to '@yahoo' ``` var names = emailList.map(function(e){ return e.split('@yahoo').shift(); }).sort(); ``` This will leave...
Use array methods: * [`map()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map) to remove the email host * [`sort()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort) to sort alphabetically * [`filter()`](https://developer.mozilla.o...
32,277,451
``` <p id="demo"></p> <script> //This is the email list var emailList =["adam@yahoo.edu\n", "henry@yahoo.edu\n", "john@yahoo.edu\n", "sally@yahoo.edu\n", "adam@yahoo.edu\n", "david@yahoo.edu\n", "myhome@yahoo.edu\n", "david@yahoo.edu\n", "david@yahoo.edu\n", "hunger@yahoo.edu\n", "madison@yahoo.edu\n", ]; document.g...
2015/08/28
[ "https://Stackoverflow.com/questions/32277451", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5277453/" ]
You can use the **map** function to transform your current list to one without the yahoo part. ``` var myEmailList = emailList.map(function(email){ return email.replace("@yahoo.com", ""); }); ``` and then you can sort it. ``` myEmailList.sort(); ``` you might also consider joining the list so it looks pretty ...
You can use either a for loop: ``` for (var i in myEmailList) { myEmailList[i] = myEmailList[i].replace("@yahoo.com"); } ``` or the map function: ``` myEmailList.map(function(email){return email.replace("@yahoo.com", "");}) ``` to get rid of every occurrence of "@yahoo.com" in the strings in the list. Then, ...
32,277,451
``` <p id="demo"></p> <script> //This is the email list var emailList =["adam@yahoo.edu\n", "henry@yahoo.edu\n", "john@yahoo.edu\n", "sally@yahoo.edu\n", "adam@yahoo.edu\n", "david@yahoo.edu\n", "myhome@yahoo.edu\n", "david@yahoo.edu\n", "david@yahoo.edu\n", "hunger@yahoo.edu\n", "madison@yahoo.edu\n", ]; document.g...
2015/08/28
[ "https://Stackoverflow.com/questions/32277451", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5277453/" ]
You need to loop through each item in the array and replace the string: ``` function myFunction() { for (var i = 0; i < emailList.length; i++) { emailList[i] = emailList[i].replace("@yahoo.com", ""); } emailList.sort(); } ``` Don't forget to call the function when you need it: ``` myFunction(); ...
You can use either a for loop: ``` for (var i in myEmailList) { myEmailList[i] = myEmailList[i].replace("@yahoo.com"); } ``` or the map function: ``` myEmailList.map(function(email){return email.replace("@yahoo.com", "");}) ``` to get rid of every occurrence of "@yahoo.com" in the strings in the list. Then, ...
32,277,451
``` <p id="demo"></p> <script> //This is the email list var emailList =["adam@yahoo.edu\n", "henry@yahoo.edu\n", "john@yahoo.edu\n", "sally@yahoo.edu\n", "adam@yahoo.edu\n", "david@yahoo.edu\n", "myhome@yahoo.edu\n", "david@yahoo.edu\n", "david@yahoo.edu\n", "hunger@yahoo.edu\n", "madison@yahoo.edu\n", ]; document.g...
2015/08/28
[ "https://Stackoverflow.com/questions/32277451", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5277453/" ]
You can use the **map** function to transform your current list to one without the yahoo part. ``` var myEmailList = emailList.map(function(email){ return email.replace("@yahoo.com", ""); }); ``` and then you can sort it. ``` myEmailList.sort(); ``` you might also consider joining the list so it looks pretty ...
Use array methods: * [`map()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map) to remove the email host * [`sort()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort) to sort alphabetically * [`filter()`](https://developer.mozilla.o...
32,277,451
``` <p id="demo"></p> <script> //This is the email list var emailList =["adam@yahoo.edu\n", "henry@yahoo.edu\n", "john@yahoo.edu\n", "sally@yahoo.edu\n", "adam@yahoo.edu\n", "david@yahoo.edu\n", "myhome@yahoo.edu\n", "david@yahoo.edu\n", "david@yahoo.edu\n", "hunger@yahoo.edu\n", "madison@yahoo.edu\n", ]; document.g...
2015/08/28
[ "https://Stackoverflow.com/questions/32277451", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5277453/" ]
A one-liner, people love one-liners ``` var names = emailList.map(function(e){ return e.split('@').shift(); }).sort(); ``` If you want to take specifically the `@yahoo*` out, change split param to '@yahoo' ``` var names = emailList.map(function(e){ return e.split('@yahoo').shift(); }).sort(); ``` This will leave...
You can use either a for loop: ``` for (var i in myEmailList) { myEmailList[i] = myEmailList[i].replace("@yahoo.com"); } ``` or the map function: ``` myEmailList.map(function(email){return email.replace("@yahoo.com", "");}) ``` to get rid of every occurrence of "@yahoo.com" in the strings in the list. Then, ...
32,277,451
``` <p id="demo"></p> <script> //This is the email list var emailList =["adam@yahoo.edu\n", "henry@yahoo.edu\n", "john@yahoo.edu\n", "sally@yahoo.edu\n", "adam@yahoo.edu\n", "david@yahoo.edu\n", "myhome@yahoo.edu\n", "david@yahoo.edu\n", "david@yahoo.edu\n", "hunger@yahoo.edu\n", "madison@yahoo.edu\n", ]; document.g...
2015/08/28
[ "https://Stackoverflow.com/questions/32277451", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5277453/" ]
A one-liner, people love one-liners ``` var names = emailList.map(function(e){ return e.split('@').shift(); }).sort(); ``` If you want to take specifically the `@yahoo*` out, change split param to '@yahoo' ``` var names = emailList.map(function(e){ return e.split('@yahoo').shift(); }).sort(); ``` This will leave...
You need to loop through each item in the array and replace the string: ``` function myFunction() { for (var i = 0; i < emailList.length; i++) { emailList[i] = emailList[i].replace("@yahoo.com", ""); } emailList.sort(); } ``` Don't forget to call the function when you need it: ``` myFunction(); ...
1,955,895
I'm trying to calculate the radius of convergence of $\displaystyle\sum (1-1/n)^n\sin (n \alpha) z^{n}$ and my idea was to use the Hadamard formula, but I have no idea what to do about the $\sin$ and then I noticed that $\sin(n\alpha) = -i Im(e^{in\alpha})$ and then I thought that if the ratio would be the same as $\di...
2016/10/06
[ "https://math.stackexchange.com/questions/1955895", "https://math.stackexchange.com", "https://math.stackexchange.com/users/306462/" ]
This is like asking "is $2$ equal to $4/2$ or $6/3$?" You have come across two equivalent ways of phrasing the same number. They're the same because $\cos(3\pi/2) = \cos(-\pi/2)$ and $\sin(3\pi/2) = \sin(-\pi/2)$. Think of this as two sets of directions to the same address ($-5j$). The representation $-5j = 5(\cos(3\p...
Both are equivalent. $$\frac{3}{2}\pi - (- \frac{1}{2}\pi)2 =2\pi$$ and trigonometry function has a period of $2 \pi$.
42,497,896
In short, I need to test some functions by creating 100 random integer lists of each specified length (500, 1000, 10000) and store the results. Eventually, I need to be able to calculate an average execution time for each test but I've yet to get that far with the code. I assumed the following was the best way to appr...
2017/02/27
[ "https://Stackoverflow.com/questions/42497896", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7630431/" ]
I think you meant ``` found = True ``` Instead of ``` found == True ``` On line 47 Also a for loop is much cleaner try this, it should be what your looking for: ``` def ordered_sequential_search(a_list, item): start = time.time() found = False stop = False for i in range(len(a_list)): ...
It is overwriting values in the dictionary because you have specified the key to overwrite values. You are not appending to the dictionary which you should have done. Your while loop might not be breaking, that why your for loop cannot iterate to another value.
279,710
Consider the following data: ``` TableDat = {{0.1, 0.1}, {0.2, 0.3}, {0.3, 0.55}, {0.5, 1}, {0.6, 1.17}, {0.8, 1.5}, {0.9, 1.6}, {1, 1.5}, {1.1, 1.3}, {1.25, 1.}, {1.35, 0.8}, {1.5, 0.5}}; ListPlot[TableDat] ``` I would like to fit it with a smooth function: ``` fit = NonlinearModelFit[TableDat, a*x + b*x...
2023/02/08
[ "https://mathematica.stackexchange.com/questions/279710", "https://mathematica.stackexchange.com", "https://mathematica.stackexchange.com/users/41058/" ]
Just add a constraint ``` fit = NonlinearModelFit[TableDat, {a*x + b*x^2 + c, 1.6 == (a*x + b*x^2 + c /. x -> 0.9)}, {a, b, c}, x] Show[Plot[fit[x], {x, 0.1, 1.5}], ListPlot[TableDat]] ``` [![enter image description here](https://i.stack.imgur.com/or1qE.jpg)](https://i.stack.imgur.com/or1qE.jpg) Hope it helps!
The right way ============= You say your model is ``` model = ( y == a*x + b*x^2 + c ) ``` that is, three free parameters `{a,b,c}`. But in reality, given the constraint `{ 0.9, 1.6 }` your model has only two parameters `{a,b}` ``` model2 = FullSimplify[ model/. First@Solve[ model /. { x -> 0.9, y -> 1.6 }, c...
20,226,802
I managed to successfully silence the CrashReport dialog, but when my application crashes and I restart it, I get the annoying dialog as from Title. Is there a way to prevent it to appear, and just let the application run without interruption?
2013/11/26
[ "https://Stackoverflow.com/questions/20226802", "https://Stackoverflow.com", "https://Stackoverflow.com/users/78374/" ]
Try this to get rid of the reopening windows: ``` defaults write -app "Application Name" NSQuitAlwaysKeepsWindows -bool false ``` You may also disable it for every application by selecting this option in the preferences: "Close windows when quitting an application" And for others reading this thread, to remove the ...
You can disable this for a specific Xcode scheme by going to Edit Scheme, choosing the Options tab, and checking the box labeled "Launch application without state restoration." ![](https://i.stack.imgur.com/RyooI.png) However, this will *only* apply when you actually launch the application from Xcode; it won't disabl...
20,226,802
I managed to successfully silence the CrashReport dialog, but when my application crashes and I restart it, I get the annoying dialog as from Title. Is there a way to prevent it to appear, and just let the application run without interruption?
2013/11/26
[ "https://Stackoverflow.com/questions/20226802", "https://Stackoverflow.com", "https://Stackoverflow.com/users/78374/" ]
Try this to get rid of the reopening windows: ``` defaults write -app "Application Name" NSQuitAlwaysKeepsWindows -bool false ``` You may also disable it for every application by selecting this option in the preferences: "Close windows when quitting an application" And for others reading this thread, to remove the ...
I was having a similar problem with google chrome and I could solve it by reading the following link: <https://support.google.com/chrome/thread/22716083?hl=en> Drew Z recommends the following solution there which worked for me: > > 1. In the Mac menu bar at the top of the screen, click Go. > 2. Select Go to Folder....
20,226,802
I managed to successfully silence the CrashReport dialog, but when my application crashes and I restart it, I get the annoying dialog as from Title. Is there a way to prevent it to appear, and just let the application run without interruption?
2013/11/26
[ "https://Stackoverflow.com/questions/20226802", "https://Stackoverflow.com", "https://Stackoverflow.com/users/78374/" ]
Try this to get rid of the reopening windows: ``` defaults write -app "Application Name" NSQuitAlwaysKeepsWindows -bool false ``` You may also disable it for every application by selecting this option in the preferences: "Close windows when quitting an application" And for others reading this thread, to remove the ...
Voila! I've just solved this problem by deleting all Unity-related files inside ~Library/Caches folder on my Mac!
20,226,802
I managed to successfully silence the CrashReport dialog, but when my application crashes and I restart it, I get the annoying dialog as from Title. Is there a way to prevent it to appear, and just let the application run without interruption?
2013/11/26
[ "https://Stackoverflow.com/questions/20226802", "https://Stackoverflow.com", "https://Stackoverflow.com/users/78374/" ]
Try this to get rid of the reopening windows: ``` defaults write -app "Application Name" NSQuitAlwaysKeepsWindows -bool false ``` You may also disable it for every application by selecting this option in the preferences: "Close windows when quitting an application" And for others reading this thread, to remove the ...
For those trying to accomplish this `defaults write -app "Application Name" NSQuitAlwaysKeepsWindows -bool false` with Python, you may get the error `Couldn't find an application named "Python"; defaults unchanged`. To solve this, repeat the process to get the "reopen windows?" pop-up again, but do not choose an opt...
20,226,802
I managed to successfully silence the CrashReport dialog, but when my application crashes and I restart it, I get the annoying dialog as from Title. Is there a way to prevent it to appear, and just let the application run without interruption?
2013/11/26
[ "https://Stackoverflow.com/questions/20226802", "https://Stackoverflow.com", "https://Stackoverflow.com/users/78374/" ]
I was having a similar problem with google chrome and I could solve it by reading the following link: <https://support.google.com/chrome/thread/22716083?hl=en> Drew Z recommends the following solution there which worked for me: > > 1. In the Mac menu bar at the top of the screen, click Go. > 2. Select Go to Folder....
You can disable this for a specific Xcode scheme by going to Edit Scheme, choosing the Options tab, and checking the box labeled "Launch application without state restoration." ![](https://i.stack.imgur.com/RyooI.png) However, this will *only* apply when you actually launch the application from Xcode; it won't disabl...
20,226,802
I managed to successfully silence the CrashReport dialog, but when my application crashes and I restart it, I get the annoying dialog as from Title. Is there a way to prevent it to appear, and just let the application run without interruption?
2013/11/26
[ "https://Stackoverflow.com/questions/20226802", "https://Stackoverflow.com", "https://Stackoverflow.com/users/78374/" ]
Voila! I've just solved this problem by deleting all Unity-related files inside ~Library/Caches folder on my Mac!
You can disable this for a specific Xcode scheme by going to Edit Scheme, choosing the Options tab, and checking the box labeled "Launch application without state restoration." ![](https://i.stack.imgur.com/RyooI.png) However, this will *only* apply when you actually launch the application from Xcode; it won't disabl...
20,226,802
I managed to successfully silence the CrashReport dialog, but when my application crashes and I restart it, I get the annoying dialog as from Title. Is there a way to prevent it to appear, and just let the application run without interruption?
2013/11/26
[ "https://Stackoverflow.com/questions/20226802", "https://Stackoverflow.com", "https://Stackoverflow.com/users/78374/" ]
For those trying to accomplish this `defaults write -app "Application Name" NSQuitAlwaysKeepsWindows -bool false` with Python, you may get the error `Couldn't find an application named "Python"; defaults unchanged`. To solve this, repeat the process to get the "reopen windows?" pop-up again, but do not choose an opt...
You can disable this for a specific Xcode scheme by going to Edit Scheme, choosing the Options tab, and checking the box labeled "Launch application without state restoration." ![](https://i.stack.imgur.com/RyooI.png) However, this will *only* apply when you actually launch the application from Xcode; it won't disabl...
7,266,915
Consider the following: ``` class A { private: A() {} public: A(int x = 0) {} }; int main() { A a(1); return 0; } ``` I have two constructors, one is a default and the other one is converting constructor with a default argument. When I try to compile the code, I expected an ambiguity error, but the ...
2011/09/01
[ "https://Stackoverflow.com/questions/7266915", "https://Stackoverflow.com", "https://Stackoverflow.com/users/911575/" ]
There is no compilation error because no error exists in your code. Just like defining two functions: they need to have different signatures, other than that, it's possible. The ambiguity compilation error appears only when you try to call one of those functions. Same will happen trying to call the default constructor ...
Here is a slightly modified example that I have tested with GCC on cygwin: ``` #include <iostream> class A { private: A(); public: A(int x = 0); }; A::A() { std::cout << "Constructor 1.\n" << std::endl; } A::A(int x) { std::cout << "Constructor 2 with x = " << x << std::endl; } int main() { A a1...
7,266,915
Consider the following: ``` class A { private: A() {} public: A(int x = 0) {} }; int main() { A a(1); return 0; } ``` I have two constructors, one is a default and the other one is converting constructor with a default argument. When I try to compile the code, I expected an ambiguity error, but the ...
2011/09/01
[ "https://Stackoverflow.com/questions/7266915", "https://Stackoverflow.com", "https://Stackoverflow.com/users/911575/" ]
There is no compilation error because no error exists in your code. Just like defining two functions: they need to have different signatures, other than that, it's possible. The ambiguity compilation error appears only when you try to call one of those functions. Same will happen trying to call the default constructor ...
Ambiguity doesn't arise because the private constructor is not even considered when you write `A a(1)`, as you pass an argument to it, and the private constructor doesn't take any argument. However, if you write `A a`, then there will be ambiguity, because both constructors are candidates, and the compiler cannot deci...
7,266,915
Consider the following: ``` class A { private: A() {} public: A(int x = 0) {} }; int main() { A a(1); return 0; } ``` I have two constructors, one is a default and the other one is converting constructor with a default argument. When I try to compile the code, I expected an ambiguity error, but the ...
2011/09/01
[ "https://Stackoverflow.com/questions/7266915", "https://Stackoverflow.com", "https://Stackoverflow.com/users/911575/" ]
There is no compilation error because no error exists in your code. Just like defining two functions: they need to have different signatures, other than that, it's possible. The ambiguity compilation error appears only when you try to call one of those functions. Same will happen trying to call the default constructor ...
Declaring potentially ambiguous functions in C++ does not produce any ambiguity errors. Ambiguity takes place when you attempt to *refer* to these functions in an ambiguous way. In your example ambiguity will occur if you try to default-construct your object. Strictly speaking, it is perfectly normal to have declarati...
7,266,915
Consider the following: ``` class A { private: A() {} public: A(int x = 0) {} }; int main() { A a(1); return 0; } ``` I have two constructors, one is a default and the other one is converting constructor with a default argument. When I try to compile the code, I expected an ambiguity error, but the ...
2011/09/01
[ "https://Stackoverflow.com/questions/7266915", "https://Stackoverflow.com", "https://Stackoverflow.com/users/911575/" ]
Here is a slightly modified example that I have tested with GCC on cygwin: ``` #include <iostream> class A { private: A(); public: A(int x = 0); }; A::A() { std::cout << "Constructor 1.\n" << std::endl; } A::A(int x) { std::cout << "Constructor 2 with x = " << x << std::endl; } int main() { A a1...
Ambiguity doesn't arise because the private constructor is not even considered when you write `A a(1)`, as you pass an argument to it, and the private constructor doesn't take any argument. However, if you write `A a`, then there will be ambiguity, because both constructors are candidates, and the compiler cannot deci...
7,266,915
Consider the following: ``` class A { private: A() {} public: A(int x = 0) {} }; int main() { A a(1); return 0; } ``` I have two constructors, one is a default and the other one is converting constructor with a default argument. When I try to compile the code, I expected an ambiguity error, but the ...
2011/09/01
[ "https://Stackoverflow.com/questions/7266915", "https://Stackoverflow.com", "https://Stackoverflow.com/users/911575/" ]
Declaring potentially ambiguous functions in C++ does not produce any ambiguity errors. Ambiguity takes place when you attempt to *refer* to these functions in an ambiguous way. In your example ambiguity will occur if you try to default-construct your object. Strictly speaking, it is perfectly normal to have declarati...
Here is a slightly modified example that I have tested with GCC on cygwin: ``` #include <iostream> class A { private: A(); public: A(int x = 0); }; A::A() { std::cout << "Constructor 1.\n" << std::endl; } A::A(int x) { std::cout << "Constructor 2 with x = " << x << std::endl; } int main() { A a1...
7,266,915
Consider the following: ``` class A { private: A() {} public: A(int x = 0) {} }; int main() { A a(1); return 0; } ``` I have two constructors, one is a default and the other one is converting constructor with a default argument. When I try to compile the code, I expected an ambiguity error, but the ...
2011/09/01
[ "https://Stackoverflow.com/questions/7266915", "https://Stackoverflow.com", "https://Stackoverflow.com/users/911575/" ]
Your code compiles because there is no ambiguity. You created a class with two constructors, one which always takes 0 arguments, and one which always takes one argument, an int. You then unambiguously called the constructor taking an int value. That this int has a default value does not matter, it is still a completely...
Here is a slightly modified example that I have tested with GCC on cygwin: ``` #include <iostream> class A { private: A(); public: A(int x = 0); }; A::A() { std::cout << "Constructor 1.\n" << std::endl; } A::A(int x) { std::cout << "Constructor 2 with x = " << x << std::endl; } int main() { A a1...
7,266,915
Consider the following: ``` class A { private: A() {} public: A(int x = 0) {} }; int main() { A a(1); return 0; } ``` I have two constructors, one is a default and the other one is converting constructor with a default argument. When I try to compile the code, I expected an ambiguity error, but the ...
2011/09/01
[ "https://Stackoverflow.com/questions/7266915", "https://Stackoverflow.com", "https://Stackoverflow.com/users/911575/" ]
Declaring potentially ambiguous functions in C++ does not produce any ambiguity errors. Ambiguity takes place when you attempt to *refer* to these functions in an ambiguous way. In your example ambiguity will occur if you try to default-construct your object. Strictly speaking, it is perfectly normal to have declarati...
Ambiguity doesn't arise because the private constructor is not even considered when you write `A a(1)`, as you pass an argument to it, and the private constructor doesn't take any argument. However, if you write `A a`, then there will be ambiguity, because both constructors are candidates, and the compiler cannot deci...
7,266,915
Consider the following: ``` class A { private: A() {} public: A(int x = 0) {} }; int main() { A a(1); return 0; } ``` I have two constructors, one is a default and the other one is converting constructor with a default argument. When I try to compile the code, I expected an ambiguity error, but the ...
2011/09/01
[ "https://Stackoverflow.com/questions/7266915", "https://Stackoverflow.com", "https://Stackoverflow.com/users/911575/" ]
Your code compiles because there is no ambiguity. You created a class with two constructors, one which always takes 0 arguments, and one which always takes one argument, an int. You then unambiguously called the constructor taking an int value. That this int has a default value does not matter, it is still a completely...
Ambiguity doesn't arise because the private constructor is not even considered when you write `A a(1)`, as you pass an argument to it, and the private constructor doesn't take any argument. However, if you write `A a`, then there will be ambiguity, because both constructors are candidates, and the compiler cannot deci...