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 |
|---|---|---|---|---|---|
53,203,011 | It's abundantly clear to me that when we want to delete a node in a Linked List (be it doubly or singly linked), and we have to search for this node, the time complexity for this task is O(n), as we must traverse the whole list in the worst case to identify the node. Similarly, it is O(k) if we want to delete the k-th ... | 2018/11/08 | [
"https://Stackoverflow.com/questions/53203011",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10622251/"
] | For a node in the middle of the list you need to modify the *previous* node (so its "next" pointer is pointing to the removed nodes "next").
With a double-linked list it's simple since the node to delete contains a pointer to the previous node. That's not possible with s single-linked list, where you need to iterate o... | **Deletion for Single Link List**
Assume that there is total 6 node. and the first node is indicating Head.
If you want to delete the first node then complexity will O(1) because you just need 1 iteration.
If you want to delete the 4th node then complexity will O(n)
If you want to delete the last node then comple... |
53,203,011 | It's abundantly clear to me that when we want to delete a node in a Linked List (be it doubly or singly linked), and we have to search for this node, the time complexity for this task is O(n), as we must traverse the whole list in the worst case to identify the node. Similarly, it is O(k) if we want to delete the k-th ... | 2018/11/08 | [
"https://Stackoverflow.com/questions/53203011",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10622251/"
] | It is true that copying data from `i.next` to `i` and then deleting `i` would be `O(1)` assuming that copying the data is also `O(1)`.
But even with this algorithm, since deleting the last element is `O(n)`, and a description of a function in terms of big O notation only provides an upper bound on the growth rate of t... | The problem with this approach is that it invalidates the wrong reference. Deleting the node shall only invalidate a reference to *that* node, while the references to *any other* node shall remain valid.
As long as you do not hold any reference to the list, this approach would work. Otherwise it is prone to failure. |
53,203,011 | It's abundantly clear to me that when we want to delete a node in a Linked List (be it doubly or singly linked), and we have to search for this node, the time complexity for this task is O(n), as we must traverse the whole list in the worst case to identify the node. Similarly, it is O(k) if we want to delete the k-th ... | 2018/11/08 | [
"https://Stackoverflow.com/questions/53203011",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10622251/"
] | It is true that copying data from `i.next` to `i` and then deleting `i` would be `O(1)` assuming that copying the data is also `O(1)`.
But even with this algorithm, since deleting the last element is `O(n)`, and a description of a function in terms of big O notation only provides an upper bound on the growth rate of t... | For a node in the middle of the list you need to modify the *previous* node (so its "next" pointer is pointing to the removed nodes "next").
With a double-linked list it's simple since the node to delete contains a pointer to the previous node. That's not possible with s single-linked list, where you need to iterate o... |
53,203,011 | It's abundantly clear to me that when we want to delete a node in a Linked List (be it doubly or singly linked), and we have to search for this node, the time complexity for this task is O(n), as we must traverse the whole list in the worst case to identify the node. Similarly, it is O(k) if we want to delete the k-th ... | 2018/11/08 | [
"https://Stackoverflow.com/questions/53203011",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10622251/"
] | For a node in the middle of the list you need to modify the *previous* node (so its "next" pointer is pointing to the removed nodes "next").
With a double-linked list it's simple since the node to delete contains a pointer to the previous node. That's not possible with s single-linked list, where you need to iterate o... | I was looking this up as a way to explain it and get references for a blog post.
Assuming you have to look up the node, like we do often with arrays and lists to find a value, you can only travel in one direction, and it will take O^n times in double and single link lists to get to the node and retrieve it's address i... |
53,203,011 | It's abundantly clear to me that when we want to delete a node in a Linked List (be it doubly or singly linked), and we have to search for this node, the time complexity for this task is O(n), as we must traverse the whole list in the worst case to identify the node. Similarly, it is O(k) if we want to delete the k-th ... | 2018/11/08 | [
"https://Stackoverflow.com/questions/53203011",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10622251/"
] | For a node in the middle of the list you need to modify the *previous* node (so its "next" pointer is pointing to the removed nodes "next").
With a double-linked list it's simple since the node to delete contains a pointer to the previous node. That's not possible with s single-linked list, where you need to iterate o... | >
> It is said that deletion is O(1) in a singly linked list ONLY if you
> have a reference to the node prior to the one you want to delete.
> However, I don't think this is necessarily the case. If you want to
> delete Node i (and you have a reference to Node i), why can't you just
> copy over the data from i.nex... |
27,529,956 | I need to enlarge an input field when it's on focus without the containing td enlarging, too.
Further on both fields should stay on their actual position (have a look on the fiddle, it mooves) and not move up or down (what is caused by the absolute position).
This is my actual state
```
$('.Bemerkung').focus(fu... | 2014/12/17 | [
"https://Stackoverflow.com/questions/27529956",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4371042/"
] | It's not too far from what you originally had:
```
$('.Bemerkung').focus(function() {
oldWidth = $(this).width();
$(this).attr('size','30');
$(this).css({'position':'relative'});
$(this).css({'margin-right':('-'+($(this).width()-oldWidth)+'px')});
})
$('.Bemerkung').blur(function() {
$(this).attr('... | You could use `transform: scale(1.2)` to enlarge it, add `transition` and remove `absolute` position declarations.
```js
$('.Bemerkung').focus(function() {
$(this).css({
'transition': 'transform 0.5s',
'transform': 'scale(1.2)'
});
});
$('.Bemerkung').blur(function() {
$(this).css({
'transfor... |
27,529,956 | I need to enlarge an input field when it's on focus without the containing td enlarging, too.
Further on both fields should stay on their actual position (have a look on the fiddle, it mooves) and not move up or down (what is caused by the absolute position).
This is my actual state
```
$('.Bemerkung').focus(fu... | 2014/12/17 | [
"https://Stackoverflow.com/questions/27529956",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4371042/"
] | It's not too far from what you originally had:
```
$('.Bemerkung').focus(function() {
oldWidth = $(this).width();
$(this).attr('size','30');
$(this).css({'position':'relative'});
$(this).css({'margin-right':('-'+($(this).width()-oldWidth)+'px')});
})
$('.Bemerkung').blur(function() {
$(this).attr('... | Try replacing the javascript with strict CSS.
One thing i did was make the td cell text-align: left. that's the only real difference right now. The reason there is movement when you switch to an absolute position is due to the fact that it's trying to align the elements to the center, but then absolute elements don't ... |
27,541,934 | I'm trying to accomplish a dynamic button which is always square, and based on the height of the text it is with. Something like this:

Basically the icon stays the same, but the size of the box varies, based on what size of text it is next to. The icon should be centere... | 2014/12/18 | [
"https://Stackoverflow.com/questions/27541934",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1940394/"
] | Something like this should do it. You may have to change the size a little depending on the font. Also, you may have to `vertical-align` it.
```
.edit {
display: inline-block;
width: 1em;
height: 1em;
}
.edit img {
display: block;
}
``` | [DEMO](http://jsfiddle.net/gkqsckdb/1/)
HTML:
```
<button>
<h2 id="name">
<span>Amy<a href="#" class="edit">
<img src="/images/edit.png" alt="Edit Name" /></a></span>
</h2>
</button>
```
CSS:
```
button img {
vertical-align: middle;
}
h2 {
font-size:20pt;
}
```
Is this what you want? |
35,435,755 | I am creating a json string using dictionary and I have to remove only that part from string my string is
```
[{Id: "code": "AAA" , Title: "display": "ANAA,FRENCH POLYNESIA"},{Id: "code": "AAB" , Title: "display": "ARRABURY, QL AUSTRALIA"}]
```
I want to remove only
```
"code":
```
And that part from string u... | 2016/02/16 | [
"https://Stackoverflow.com/questions/35435755",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5879311/"
] | You can run this code:
```
string json = "[{Id: \"code\": \"AAA\" , Title: \"display\": \"ANAA,FRENCH POLYNESIA\"},{Id: \"code\": \"AAB\" , Title: \"display\": \"ARRABURY, QL AUSTRALIA\"}]";
json = json.Replace("\"code\":", String.Empty);
json = json.Replace("\"display\":", String.Empty);
```
You can remove wit... | As suggested, use string.Replace:
```
const string codeToRemove = "\"code\":";
const string displayToRemove = "\"display\":";
var entries = dict.Select(d => string.Format("{{Id: {0} , Title: {1}}}", d.Key.Replace(codeToRemove, ""), string.Join(",", d.Value.Replace(displayToRemove, ""))));
var result = "" + string.Jo... |
29,175 | I'm trying to write a SQL Server script to iterate through .bak files in a directory and then restore them to our server. In doing so, I've created three temp tables: #Files to keep track of the file-list returned by running xp\_dirtree, #HeaderInfo to hold data returned when querying restore headeronly to get the data... | 2012/11/23 | [
"https://dba.stackexchange.com/questions/29175",
"https://dba.stackexchange.com",
"https://dba.stackexchange.com/users/15382/"
] | **First your first questions**
1. I would use tinyint for the `BYTE(1)` in this case they told us the possible values are 1 or 0. `BIT` may also work. You could also try `BIT`. But `uint64` is an unsigned 64 Byte integer. BIGINT is signed, so the max value is lower. So technically speaking a DECIMAL(20,0) or greater p... | You can find the [data types mapping](http://msdn.microsoft.com/en-us/library/cc716729.aspx) between SQL Server and C# on MSDN.
I believe that the two return types there are just a mistype in the documentation, and not the actual requirement.
Actually Uint64 should be BIGINT, as you already found, nothing else matches... |
654,953 | I have often see ball grid array (BGA) chips, mostly those from CPUs or GPUs, being glued around in the corners with some red glue or to the perimeter with a translucent one.
Having to manually solder BGA chips using hot air, should I glue the chips to the board before heating?
In their answers to a quite similar que... | 2023/02/21 | [
"https://electronics.stackexchange.com/questions/654953",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/199752/"
] | What you see around the corners is most probably not glue, and certainly not put there to hold the chip in place during automated assembly.
Some SMD components need to be glued down after the soldering, as in case of a PCB with components on both sides, when you flip it upside down to assemble the other side some comp... | The main reason for using staking or underfill is to 1) reduce the stress on the BGA solder joints caused by CTE differences between the package and the board, 2) reduce the possibility of the part detaching from the board during a high shock (depth charge near a submarine) or vibration (rocket launch) event and 3) in ... |
654,953 | I have often see ball grid array (BGA) chips, mostly those from CPUs or GPUs, being glued around in the corners with some red glue or to the perimeter with a translucent one.
Having to manually solder BGA chips using hot air, should I glue the chips to the board before heating?
In their answers to a quite similar que... | 2023/02/21 | [
"https://electronics.stackexchange.com/questions/654953",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/199752/"
] | To add on to the other excellent answers, and to answer your third question: the red glue you see is likely to be some kind of **corner staking** or **underfilling**. After soldering, an adhesive compound is added to mitigate in-the-field failure, particularly when packages are subjected to thermal or physical stresses... | What you see around the corners is most probably not glue, and certainly not put there to hold the chip in place during automated assembly.
Some SMD components need to be glued down after the soldering, as in case of a PCB with components on both sides, when you flip it upside down to assemble the other side some comp... |
654,953 | I have often see ball grid array (BGA) chips, mostly those from CPUs or GPUs, being glued around in the corners with some red glue or to the perimeter with a translucent one.
Having to manually solder BGA chips using hot air, should I glue the chips to the board before heating?
In their answers to a quite similar que... | 2023/02/21 | [
"https://electronics.stackexchange.com/questions/654953",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/199752/"
] | What you see around the corners is most probably not glue, and certainly not put there to hold the chip in place during automated assembly.
Some SMD components need to be glued down after the soldering, as in case of a PCB with components on both sides, when you flip it upside down to assemble the other side some comp... | The "red" glue you are seeing is an SMT red glue and it's a certain type of temperature-set adhesive. Normally most assembly houses will not be using these adhesives, as surface tension will position the components correctly. However that is the "theory" ... In practice and depending on the circumstance, it may be requ... |
654,953 | I have often see ball grid array (BGA) chips, mostly those from CPUs or GPUs, being glued around in the corners with some red glue or to the perimeter with a translucent one.
Having to manually solder BGA chips using hot air, should I glue the chips to the board before heating?
In their answers to a quite similar que... | 2023/02/21 | [
"https://electronics.stackexchange.com/questions/654953",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/199752/"
] | What you see around the corners is most probably not glue, and certainly not put there to hold the chip in place during automated assembly.
Some SMD components need to be glued down after the soldering, as in case of a PCB with components on both sides, when you flip it upside down to assemble the other side some comp... | * 1. No, absolutely no glue should be used on BGAs prior to reflow. BGA solder balls collapse slightly during reflow, increasing contact with the pad, and any adhesive would interfere with that.
* 2. The solder paste holds the chip in place prior to the melt, then surface tension during. No need for anything else.
* 3.... |
654,953 | I have often see ball grid array (BGA) chips, mostly those from CPUs or GPUs, being glued around in the corners with some red glue or to the perimeter with a translucent one.
Having to manually solder BGA chips using hot air, should I glue the chips to the board before heating?
In their answers to a quite similar que... | 2023/02/21 | [
"https://electronics.stackexchange.com/questions/654953",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/199752/"
] | What you see around the corners is most probably not glue, and certainly not put there to hold the chip in place during automated assembly.
Some SMD components need to be glued down after the soldering, as in case of a PCB with components on both sides, when you flip it upside down to assemble the other side some comp... | Personally, I'm intimidated by the whole idea of BGA rework with hobby grade equipment, and really wouldn't do it.
But, no, if I were doing it, I would be very hesitant to glue the chip in place. Surface mount soldering relies on letting the surface tension of melted solder being able to pull the chip into alignment. ... |
654,953 | I have often see ball grid array (BGA) chips, mostly those from CPUs or GPUs, being glued around in the corners with some red glue or to the perimeter with a translucent one.
Having to manually solder BGA chips using hot air, should I glue the chips to the board before heating?
In their answers to a quite similar que... | 2023/02/21 | [
"https://electronics.stackexchange.com/questions/654953",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/199752/"
] | To add on to the other excellent answers, and to answer your third question: the red glue you see is likely to be some kind of **corner staking** or **underfilling**. After soldering, an adhesive compound is added to mitigate in-the-field failure, particularly when packages are subjected to thermal or physical stresses... | * 1. No, absolutely no glue should be used on BGAs prior to reflow. BGA solder balls collapse slightly during reflow, increasing contact with the pad, and any adhesive would interfere with that.
* 2. The solder paste holds the chip in place prior to the melt, then surface tension during. No need for anything else.
* 3.... |
654,953 | I have often see ball grid array (BGA) chips, mostly those from CPUs or GPUs, being glued around in the corners with some red glue or to the perimeter with a translucent one.
Having to manually solder BGA chips using hot air, should I glue the chips to the board before heating?
In their answers to a quite similar que... | 2023/02/21 | [
"https://electronics.stackexchange.com/questions/654953",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/199752/"
] | To add on to the other excellent answers, and to answer your third question: the red glue you see is likely to be some kind of **corner staking** or **underfilling**. After soldering, an adhesive compound is added to mitigate in-the-field failure, particularly when packages are subjected to thermal or physical stresses... | The "red" glue you are seeing is an SMT red glue and it's a certain type of temperature-set adhesive. Normally most assembly houses will not be using these adhesives, as surface tension will position the components correctly. However that is the "theory" ... In practice and depending on the circumstance, it may be requ... |
654,953 | I have often see ball grid array (BGA) chips, mostly those from CPUs or GPUs, being glued around in the corners with some red glue or to the perimeter with a translucent one.
Having to manually solder BGA chips using hot air, should I glue the chips to the board before heating?
In their answers to a quite similar que... | 2023/02/21 | [
"https://electronics.stackexchange.com/questions/654953",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/199752/"
] | To add on to the other excellent answers, and to answer your third question: the red glue you see is likely to be some kind of **corner staking** or **underfilling**. After soldering, an adhesive compound is added to mitigate in-the-field failure, particularly when packages are subjected to thermal or physical stresses... | Personally, I'm intimidated by the whole idea of BGA rework with hobby grade equipment, and really wouldn't do it.
But, no, if I were doing it, I would be very hesitant to glue the chip in place. Surface mount soldering relies on letting the surface tension of melted solder being able to pull the chip into alignment. ... |
654,953 | I have often see ball grid array (BGA) chips, mostly those from CPUs or GPUs, being glued around in the corners with some red glue or to the perimeter with a translucent one.
Having to manually solder BGA chips using hot air, should I glue the chips to the board before heating?
In their answers to a quite similar que... | 2023/02/21 | [
"https://electronics.stackexchange.com/questions/654953",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/199752/"
] | To add on to the other excellent answers, and to answer your third question: the red glue you see is likely to be some kind of **corner staking** or **underfilling**. After soldering, an adhesive compound is added to mitigate in-the-field failure, particularly when packages are subjected to thermal or physical stresses... | What others have said. We use a small under-board preheater (my technician says that is essential) so minimal airflow is needed on top using a hot air pencil. We just bought one of those inexpensive reflow ovens (under USD$500), which with some controller modifications can be quite good for doing small board runs. I sa... |
654,953 | I have often see ball grid array (BGA) chips, mostly those from CPUs or GPUs, being glued around in the corners with some red glue or to the perimeter with a translucent one.
Having to manually solder BGA chips using hot air, should I glue the chips to the board before heating?
In their answers to a quite similar que... | 2023/02/21 | [
"https://electronics.stackexchange.com/questions/654953",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/199752/"
] | To add on to the other excellent answers, and to answer your third question: the red glue you see is likely to be some kind of **corner staking** or **underfilling**. After soldering, an adhesive compound is added to mitigate in-the-field failure, particularly when packages are subjected to thermal or physical stresses... | The main reason for using staking or underfill is to 1) reduce the stress on the BGA solder joints caused by CTE differences between the package and the board, 2) reduce the possibility of the part detaching from the board during a high shock (depth charge near a submarine) or vibration (rocket launch) event and 3) in ... |
56,444,790 | Why do I need to bind () a function inside a constructor?
```
constructor (props){
super(props);
this.funcao = this.funcao.bind(this);
}
```
could not bind () without using a constructor? | 2019/06/04 | [
"https://Stackoverflow.com/questions/56444790",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11599057/"
] | You don't have to bind the methods in the constructor, have a look at the the explanation below.
```js
// Setup (mock)
class MyValue {
constructor(value) {
this.value = value;
}
log() {
console.log(this.value);
}
bindMethods() {
this.log = this.log.bind(this);
}
}
const value = ne... | Keep in mind that if you write your functions in your class as arrow functions, you don't need to bind(this).. its automatic. You don't need to bind properties in your constructor because it already has a this keyword attached to it. |
56,444,790 | Why do I need to bind () a function inside a constructor?
```
constructor (props){
super(props);
this.funcao = this.funcao.bind(this);
}
```
could not bind () without using a constructor? | 2019/06/04 | [
"https://Stackoverflow.com/questions/56444790",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11599057/"
] | Keep in mind that if you write your functions in your class as arrow functions, you don't need to bind(this).. its automatic. You don't need to bind properties in your constructor because it already has a this keyword attached to it. | The reason why you `bind()` functions is because class methods are not bound to the class instance object, which in React's case, it means you don't have access to the component's `state` or `props`.
Use arrow functions to automatically bind to the instance object: `funcao = () => {...}`
And call it from anywhere ins... |
56,444,790 | Why do I need to bind () a function inside a constructor?
```
constructor (props){
super(props);
this.funcao = this.funcao.bind(this);
}
```
could not bind () without using a constructor? | 2019/06/04 | [
"https://Stackoverflow.com/questions/56444790",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11599057/"
] | You don't have to bind the methods in the constructor, have a look at the the explanation below.
```js
// Setup (mock)
class MyValue {
constructor(value) {
this.value = value;
}
log() {
console.log(this.value);
}
bindMethods() {
this.log = this.log.bind(this);
}
}
const value = ne... | The reason why you `bind()` functions is because class methods are not bound to the class instance object, which in React's case, it means you don't have access to the component's `state` or `props`.
Use arrow functions to automatically bind to the instance object: `funcao = () => {...}`
And call it from anywhere ins... |
34,624 | I am about to upgrade the hard disk of my MacBook. (From 60GB to 320GB, which I know is below the limit of 500GB).
I was both able to install an OS X on the new drive and also to transfer the old hard disks partition to the new one with a [sysresccd](http://www.sysresccd.org/Main_Page) (linux live disk) and `dd` (`dd ... | 2009/07/01 | [
"https://serverfault.com/questions/34624",
"https://serverfault.com",
"https://serverfault.com/users/1509/"
] | I think there is a GUI way of doing this with Disk Utility but I can't remember off the top of my head. Anyway you should be able to resize a hfs+ volume nondestructively from the command line. The article is kind of old but the syntax haven't changed so it should still be the same. Standard warning like you should hav... | Interestingly enough, information online suggests that you can use the Boot Camp installer to return your Mac to a non-Boot Camp machine which will grow your HFS+ partitions.
<http://wiki.onmac.net/index.php/Triple_Boot_via_BootCamp#Restoring_your_Mac_to_its_original_state> |
34,624 | I am about to upgrade the hard disk of my MacBook. (From 60GB to 320GB, which I know is below the limit of 500GB).
I was both able to install an OS X on the new drive and also to transfer the old hard disks partition to the new one with a [sysresccd](http://www.sysresccd.org/Main_Page) (linux live disk) and `dd` (`dd ... | 2009/07/01 | [
"https://serverfault.com/questions/34624",
"https://serverfault.com",
"https://serverfault.com/users/1509/"
] | Just cleanly partition the new disk to any size you like and copy the data over with [Carbon Copy Cloner.](http://www.bombich.com/) It will be bootable and have the size you want.
You can do that on a running system, and don't need any live cd's or anything, just an usb or firewire interface for the new/second harddi... | Interestingly enough, information online suggests that you can use the Boot Camp installer to return your Mac to a non-Boot Camp machine which will grow your HFS+ partitions.
<http://wiki.onmac.net/index.php/Triple_Boot_via_BootCamp#Restoring_your_Mac_to_its_original_state> |
34,624 | I am about to upgrade the hard disk of my MacBook. (From 60GB to 320GB, which I know is below the limit of 500GB).
I was both able to install an OS X on the new drive and also to transfer the old hard disks partition to the new one with a [sysresccd](http://www.sysresccd.org/Main_Page) (linux live disk) and `dd` (`dd ... | 2009/07/01 | [
"https://serverfault.com/questions/34624",
"https://serverfault.com",
"https://serverfault.com/users/1509/"
] | Just cleanly partition the new disk to any size you like and copy the data over with [Carbon Copy Cloner.](http://www.bombich.com/) It will be bootable and have the size you want.
You can do that on a running system, and don't need any live cd's or anything, just an usb or firewire interface for the new/second harddi... | I think there is a GUI way of doing this with Disk Utility but I can't remember off the top of my head. Anyway you should be able to resize a hfs+ volume nondestructively from the command line. The article is kind of old but the syntax haven't changed so it should still be the same. Standard warning like you should hav... |
34,624 | I am about to upgrade the hard disk of my MacBook. (From 60GB to 320GB, which I know is below the limit of 500GB).
I was both able to install an OS X on the new drive and also to transfer the old hard disks partition to the new one with a [sysresccd](http://www.sysresccd.org/Main_Page) (linux live disk) and `dd` (`dd ... | 2009/07/01 | [
"https://serverfault.com/questions/34624",
"https://serverfault.com",
"https://serverfault.com/users/1509/"
] | I think there is a GUI way of doing this with Disk Utility but I can't remember off the top of my head. Anyway you should be able to resize a hfs+ volume nondestructively from the command line. The article is kind of old but the syntax haven't changed so it should still be the same. Standard warning like you should hav... | I'll second the idea of just partitioning the drive as you want and copying the data. See [How to Create a Bootable Backup of Mac OS X](http://www.bombich.com/mactips/image.html) for various methods to do so. |
34,624 | I am about to upgrade the hard disk of my MacBook. (From 60GB to 320GB, which I know is below the limit of 500GB).
I was both able to install an OS X on the new drive and also to transfer the old hard disks partition to the new one with a [sysresccd](http://www.sysresccd.org/Main_Page) (linux live disk) and `dd` (`dd ... | 2009/07/01 | [
"https://serverfault.com/questions/34624",
"https://serverfault.com",
"https://serverfault.com/users/1509/"
] | Just cleanly partition the new disk to any size you like and copy the data over with [Carbon Copy Cloner.](http://www.bombich.com/) It will be bootable and have the size you want.
You can do that on a running system, and don't need any live cd's or anything, just an usb or firewire interface for the new/second harddi... | I'll second the idea of just partitioning the drive as you want and copying the data. See [How to Create a Bootable Backup of Mac OS X](http://www.bombich.com/mactips/image.html) for various methods to do so. |
14,741,859 | I have 2 tables:
* **Table1** = names of gas stations (in pairs)
* **Table2** = has co-ordinate information (longitude and latitude amongst other things)
Example of **Table1**:
```
StationID1 StationID2 Name1 Name2 Lattitude1 Longitude1 Lattitude2 Longitude2 Distance
---------------------------------------... | 2013/02/07 | [
"https://Stackoverflow.com/questions/14741859",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/668624/"
] | I think you can modify your UPDATE statement to reference the table alias in the UPDATE line.
```
update t1
set t1.[Lattitude1] = t2.[Lattitude]
from table1 t1
left join table2 t2
on (t1.StationID1 = t2.IDInfo)
``` | You need to change the inner table and give a different allias to the columns that are similar. This should work.
```
update table1
set [Lattitude1] = x.[lat]
from
(
SELECT IDInfo [id], Lattitude [lat] FROM
table2
) x
WHERE
StationID1 = x.[id]
```
In your particular case its not necessary to rename Lattitu... |
56,637,126 | I'm testing a tableview the cell content in XCUItest. In my case, I don't know the order of the cell text, nor am I allowed to set an accessibility id for the text. How can I get the index of a cell given the text inside?
[](https://i.stack.imgur.com... | 2019/06/17 | [
"https://Stackoverflow.com/questions/56637126",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8234508/"
] | The most reliable way really is to add the index into the accessibility identifier. But, you can't. Can you change the accessibility identifier of the cell instead of the text ?
Anyway, if you don't scroll your table view, you can handle it like that :
```
let idx = 0
for cell in table.cells.allElementsBoundByIndex {... | ```
for index in 0..<table.cells.count {
if table.cells.element(boundBy: index).staticTexts["Your Text"].exists {
return index
}
}
``` |
132,698 | I used linear interpolation between points:
```
T = 1;
w = 0.05;
num = 1000;
A = 1;
pulse[x_] := A*(UnitStep[x + w*T/2] - UnitStep[x - w*T/2])
fun =
Table[pulse[x] + 0.2*(RandomReal[] - 0.5), {x, -T/2, T/2,
T/(num - 1)}];
funX = Table[i, {i, -T/2, T/2, T/(num - 1)}];
funINT =
Interpolation[Transpose[{fun... | 2016/12/03 | [
"https://mathematica.stackexchange.com/questions/132698",
"https://mathematica.stackexchange.com",
"https://mathematica.stackexchange.com/users/19601/"
] | You could find a general symbolic Fourier coefficient for a linear polynomial and use the formula to integrate the interpolating function piecewise. If you're content with machine precision (double precision), then you can `Compile` it for really great speed.
```
(* Basic integral formulas *)
ClearAll[cn0];
cn0[0][{t0... | There are several ways to approach answering this question.
Not using NIntegrate
--------------------
One approach is to use direct Trpezoidal formula integration as shown in [this answer](https://mathematica.stackexchange.com/a/5629/34008) of ["Is it possible to compute with the trapezoidal rule by numerical integra... |
132,698 | I used linear interpolation between points:
```
T = 1;
w = 0.05;
num = 1000;
A = 1;
pulse[x_] := A*(UnitStep[x + w*T/2] - UnitStep[x - w*T/2])
fun =
Table[pulse[x] + 0.2*(RandomReal[] - 0.5), {x, -T/2, T/2,
T/(num - 1)}];
funX = Table[i, {i, -T/2, T/2, T/(num - 1)}];
funINT =
Interpolation[Transpose[{fun... | 2016/12/03 | [
"https://mathematica.stackexchange.com/questions/132698",
"https://mathematica.stackexchange.com",
"https://mathematica.stackexchange.com/users/19601/"
] | There are several ways to approach answering this question.
Not using NIntegrate
--------------------
One approach is to use direct Trpezoidal formula integration as shown in [this answer](https://mathematica.stackexchange.com/a/5629/34008) of ["Is it possible to compute with the trapezoidal rule by numerical integra... | Michael's and Anton's answers involve the manual splitting of the piecewise linear functions involved in the computation of the Fourier coefficients at the interpolation points. Yet another way to tell *Mathematica* to automatically split the integrand before integrating is to use the option setting `Method -> "Interpo... |
132,698 | I used linear interpolation between points:
```
T = 1;
w = 0.05;
num = 1000;
A = 1;
pulse[x_] := A*(UnitStep[x + w*T/2] - UnitStep[x - w*T/2])
fun =
Table[pulse[x] + 0.2*(RandomReal[] - 0.5), {x, -T/2, T/2,
T/(num - 1)}];
funX = Table[i, {i, -T/2, T/2, T/(num - 1)}];
funINT =
Interpolation[Transpose[{fun... | 2016/12/03 | [
"https://mathematica.stackexchange.com/questions/132698",
"https://mathematica.stackexchange.com",
"https://mathematica.stackexchange.com/users/19601/"
] | You could find a general symbolic Fourier coefficient for a linear polynomial and use the formula to integrate the interpolating function piecewise. If you're content with machine precision (double precision), then you can `Compile` it for really great speed.
```
(* Basic integral formulas *)
ClearAll[cn0];
cn0[0][{t0... | Michael's and Anton's answers involve the manual splitting of the piecewise linear functions involved in the computation of the Fourier coefficients at the interpolation points. Yet another way to tell *Mathematica* to automatically split the integrand before integrating is to use the option setting `Method -> "Interpo... |
13,003,257 | If I have some kind of tree, and I need to find a specific node in that tree which is essentially null (the struct is not initialised / malloc'ed yet).
If I want to return that very specific uninitialised struct place to be able to initialise it, would something like:
```
if (parentNode->childNode == NULL)
return... | 2012/10/21 | [
"https://Stackoverflow.com/questions/13003257",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/680441/"
] | You can not return NULL. It will not be an identifiable location.
What you can do however is:
* `malloc` the node at the point where you find it and return the pointer returned by malloc,
* you can `return &(parentNode->childNode)` (a pointer to the childNode pointer) which the caller of
the function can use to set... | You can return that `parentNode` and have its `child` initialized elsewhere. |
13,003,257 | If I have some kind of tree, and I need to find a specific node in that tree which is essentially null (the struct is not initialised / malloc'ed yet).
If I want to return that very specific uninitialised struct place to be able to initialise it, would something like:
```
if (parentNode->childNode == NULL)
return... | 2012/10/21 | [
"https://Stackoverflow.com/questions/13003257",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/680441/"
] | You can not return NULL. It will not be an identifiable location.
What you can do however is:
* `malloc` the node at the point where you find it and return the pointer returned by malloc,
* you can `return &(parentNode->childNode)` (a pointer to the childNode pointer) which the caller of
the function can use to set... | You can return NULL, but it would make no sense. You can return a *pointer* to the pointer whose value is NULL:
```
typedef struct link {
struct link *next;
} LL;
LL **getTailPP(LL **ppHead)
{
for( ; *ppHead; ppHead = &(*ppHead)->next ) {;}
return ppHead;
}
``` |
13,003,257 | If I have some kind of tree, and I need to find a specific node in that tree which is essentially null (the struct is not initialised / malloc'ed yet).
If I want to return that very specific uninitialised struct place to be able to initialise it, would something like:
```
if (parentNode->childNode == NULL)
return... | 2012/10/21 | [
"https://Stackoverflow.com/questions/13003257",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/680441/"
] | You can not return NULL. It will not be an identifiable location.
What you can do however is:
* `malloc` the node at the point where you find it and return the pointer returned by malloc,
* you can `return &(parentNode->childNode)` (a pointer to the childNode pointer) which the caller of
the function can use to set... | If the child node is not initialised yet, then you cannot return a pointer to it... how can you return a pointer to something that doesn't exist yet??
What you need to do is return a pointer to the parent node's pointer, which can then be changed to point to the newly-allocated memory for the child node. |
17,268,287 | I am developing a website and currently I am stick in the registration process. When I ask users to register to my website, they need to choose the number of people that a team will have. When I select the number of people in the selection box, my website displays input fields according to the number of people that I s... | 2013/06/24 | [
"https://Stackoverflow.com/questions/17268287",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2514936/"
] | Here is a [**Live demo**](http://jsfiddle.net/mplungjan/EyG6g/)
You need to change your option click to the change event of the select. You can also drop the name and ID of the options:
```
$(function(){
$("#integrantes").on("change",function(){
$("#loscuatro").toggle(this.selectedIndex==1); // second option is... | I don't think `option` is a element that can be clicked (at least in a cross-browser compatible way). It's better to rely on `change` event of the `select` element:
```
$(document).ready(function(){
$("#integrantes").change(function(){
var val = $(this).val();
if(val=='1') {
$('#loscuat... |
17,268,287 | I am developing a website and currently I am stick in the registration process. When I ask users to register to my website, they need to choose the number of people that a team will have. When I select the number of people in the selection box, my website displays input fields according to the number of people that I s... | 2013/06/24 | [
"https://Stackoverflow.com/questions/17268287",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2514936/"
] | Here is a [**Live demo**](http://jsfiddle.net/mplungjan/EyG6g/)
You need to change your option click to the change event of the select. You can also drop the name and ID of the options:
```
$(function(){
$("#integrantes").on("change",function(){
$("#loscuatro").toggle(this.selectedIndex==1); // second option is... | There are several things wrong with the HTML:
```
<body>
<div id="container" class="ltr">
<h2>Please give us your name</h2>
<ul>
<li>
<span>Number of team members
<select name="integrantes" id="integrantes" >
... |
3,935,641 | How can I add a close button to a draggable/resizable div?
I understand that I am essentially describing a dialog, but I have to be able to take advantage of a few of the properties of resizable/draggable (such as containment) that are not a part of dialog.
Any ideas? | 2010/10/14 | [
"https://Stackoverflow.com/questions/3935641",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/476055/"
] | You can use multiple class names (a perfectly normal thing to do), but are only allowed one class attribute on your HTML element.
Do this instead:
```
<a href="#" class="paren defaul">text</a>
``` | Following on from RedFilters' answer you could of course extend your class selectors by using the [angular](https://angularjs.org/) ng-class attribute as follows:
```html
<a href="#" class="paren defaul" ng-class="['tea', 'mat', 'thirs']">text</a>
```
The resulting html would then be:
```html
<a href="#" class="pa... |
3,935,641 | How can I add a close button to a draggable/resizable div?
I understand that I am essentially describing a dialog, but I have to be able to take advantage of a few of the properties of resizable/draggable (such as containment) that are not a part of dialog.
Any ideas? | 2010/10/14 | [
"https://Stackoverflow.com/questions/3935641",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/476055/"
] | You can use multiple class names (a perfectly normal thing to do), but are only allowed one class attribute on your HTML element.
Do this instead:
```
<a href="#" class="paren defaul">text</a>
``` | There's no need for two class statements, simply:
```
<a href="#" class="paren defaul">text</a>
```
Now, in order to handle this in CSS you need to do this:
```
.paren.default{
}
```
...Whithout spaces between the two class selectors.
Cheers! |
511,515 | We have a scenario
One Main e-commerce website - currently attracting a lot of visitors.
Three sub "brand specific" sites which will hang off this site - each of these sites will potentiall have the same level of traffic over time.
The client requires order processing for each brand site to happen in one place (i.e.... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511515",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42446/"
] | Without having a more detailed understanding of how your application is to function it is difficult to provide you with clear direction.
Your proposed implementation of having a central server (Publisher) supporting reads and writes, with a number of additional site specific servers (subscribers) for reads only, is ce... | Not a specific answer to your question but [Youtube scaling](http://video.google.com/videoplay?docid=-6304964351441328559) is an interesting video about youtube scaling. Prehaps it will give you some ideas. |
67,359,673 | I'm using *Entity Framework* and *Dynamic Linq Core* to perform some dynamic queries at run time. I have a question on how to write dynamic linq statements to output columns of counts where each column is a field item of another field.
Say I have a table with 3 columns: ID, Gender, and Age (assuming they are only in t... | 2021/05/02 | [
"https://Stackoverflow.com/questions/67359673",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11735492/"
] | let's say your query returns a list of object of the following class
```
public class Data {
public string Gender { get; set;}
public int Age { get; set;}
public int Value { get; set;}
}
```
```cs
Data results = //query result
var resultsV2 = results.GroupBy(r => r.Gender);
var list = new List<IDictionary... | You could leverage the JSON.Net types in your LINQ Query. [JObject](https://www.newtonsoft.com/json/help/html/M_Newtonsoft_Json_Linq_JObject__ctor_3.htm) accepts an collection of [JProperty](https://www.newtonsoft.com/json/help/html/M_Newtonsoft_Json_Linq_JProperty__ctor_1.htm) and [JArray](https://www.newtonsoft.com/j... |
2,436,542 | I know that on MacOSX / PosiX systems, there is atomic-compare-and-swap for C/C++ code via g++.
However, I don't need the compare -- I just want to atomically swap two values. Is there an atomic swap operation available? [Everythign I can find is atomic\_compare\_and\_swap ... and I just want to do the swap, without c... | 2010/03/12 | [
"https://Stackoverflow.com/questions/2436542",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/247265/"
] | the "lock xchg" intel assembly instruction probably achieves what you want but i dont think there is a GCC wrapper function to make it portable. Therefor your stuck using inline assembly(not portable) or using compare and swap and forcing the compare to be true(inneficient). Hope this helps :-) | Don't think there is. Here's the reference, btw:
<http://developer.apple.com/Mac/library/documentation/DriversKernelHardware/Reference/libkern_ref/OSAtomic_h/index.html#//apple_ref/doc/header/user_space_OSAtomic.h> |
2,436,542 | I know that on MacOSX / PosiX systems, there is atomic-compare-and-swap for C/C++ code via g++.
However, I don't need the compare -- I just want to atomically swap two values. Is there an atomic swap operation available? [Everythign I can find is atomic\_compare\_and\_swap ... and I just want to do the swap, without c... | 2010/03/12 | [
"https://Stackoverflow.com/questions/2436542",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/247265/"
] | GCC does provide this operation on some processors, under the (confusingly named) `__sync_lock_test_and_set`. From the GCC documentation:
>
>
> ```
> This builtin, as described by Intel, is not a traditional
> test-and-set operation, but rather an atomic exchange operation.
> It writes VALUE into `*PTR', and retu... | Don't think there is. Here's the reference, btw:
<http://developer.apple.com/Mac/library/documentation/DriversKernelHardware/Reference/libkern_ref/OSAtomic_h/index.html#//apple_ref/doc/header/user_space_OSAtomic.h> |
2,436,542 | I know that on MacOSX / PosiX systems, there is atomic-compare-and-swap for C/C++ code via g++.
However, I don't need the compare -- I just want to atomically swap two values. Is there an atomic swap operation available? [Everythign I can find is atomic\_compare\_and\_swap ... and I just want to do the swap, without c... | 2010/03/12 | [
"https://Stackoverflow.com/questions/2436542",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/247265/"
] | the "lock xchg" intel assembly instruction probably achieves what you want but i dont think there is a GCC wrapper function to make it portable. Therefor your stuck using inline assembly(not portable) or using compare and swap and forcing the compare to be true(inneficient). Hope this helps :-) | GCC does provide this operation on some processors, under the (confusingly named) `__sync_lock_test_and_set`. From the GCC documentation:
>
>
> ```
> This builtin, as described by Intel, is not a traditional
> test-and-set operation, but rather an atomic exchange operation.
> It writes VALUE into `*PTR', and retu... |
45,888 | I use tabs in C/C++ but want to convert those tabs to spaces when copying code that I'm going to paste into an external program. However, I want the original code to retain tabs. Additionally (if possible), I'd like to keep the tabs when copying/pasting within Emacs.
I sort of adapted the code at [this link](https://e... | 2018/11/10 | [
"https://emacs.stackexchange.com/questions/45888",
"https://emacs.stackexchange.com",
"https://emacs.stackexchange.com/users/20317/"
] | It's not documented well enough, and possibly poorly named, but the `hideshow` function `hs-hide-level` will collapse all the blocks within the current block. That is, if your cursor is on the `class ...` line (or below it) in your example input, it will give you something very similar to your desired output. Since `hi... | I believe the method given in the question, although not efficient, is sufficient. Let me explain it in greater detail. Assuming you have `evil-mode` enabled:
1. Toggle `hs-minor-mode` to enable folding
2. Place your cursor at the first column of a `def` statement line. This can be done by pressing `0`
3. Record a mac... |
53,242 | How do I check if a partition is encrypted? In particular I would like to know how I check if `/home` and swap is encrypted. | 2011/07/15 | [
"https://askubuntu.com/questions/53242",
"https://askubuntu.com",
"https://askubuntu.com/users/19490/"
] | Regarding the standard home encryption provided by Ubuntu, you can
```
sudo ls -lA /home/username/
```
and if you get something like
```
totale 0
lrwxrwxrwx 1 username username 56 2011-05-08 18:12 Access-Your-Private-Data.desktop -> /usr/share/ecryptfs-utils/ecryptfs-mount-private.desktop
lrwxrwxrwx 1 username use... | In addition to the answer provided by enzotib, there's the possibility of full disk encryption as provided by the alternate installer. (Also called LUKS-crypt.)
You can use `sudo dmsetup status` to check if there are any LUKS-encrypted partitions. The output should look something like:
```
ubuntu-home: 0 195305472 li... |
53,242 | How do I check if a partition is encrypted? In particular I would like to know how I check if `/home` and swap is encrypted. | 2011/07/15 | [
"https://askubuntu.com/questions/53242",
"https://askubuntu.com",
"https://askubuntu.com/users/19490/"
] | Regarding the standard home encryption provided by Ubuntu, you can
```
sudo ls -lA /home/username/
```
and if you get something like
```
totale 0
lrwxrwxrwx 1 username username 56 2011-05-08 18:12 Access-Your-Private-Data.desktop -> /usr/share/ecryptfs-utils/ecryptfs-mount-private.desktop
lrwxrwxrwx 1 username use... | To check the encrypted swap status and cipher details, use this cmd:
```
$ sudo cryptsetup status /dev/mapper/cryptswap1
/dev/mapper/cryptswap1 is active and is in use.
type: PLAIN
cipher: aes-cbc-essiv:sha256
keysize: 256 bits
device: /dev/sda2
offset: 0 sectors
size: 8388608 sectors
mode: r... |
53,242 | How do I check if a partition is encrypted? In particular I would like to know how I check if `/home` and swap is encrypted. | 2011/07/15 | [
"https://askubuntu.com/questions/53242",
"https://askubuntu.com",
"https://askubuntu.com/users/19490/"
] | In addition to the answer provided by enzotib, there's the possibility of full disk encryption as provided by the alternate installer. (Also called LUKS-crypt.)
You can use `sudo dmsetup status` to check if there are any LUKS-encrypted partitions. The output should look something like:
```
ubuntu-home: 0 195305472 li... | To check the encrypted swap status and cipher details, use this cmd:
```
$ sudo cryptsetup status /dev/mapper/cryptswap1
/dev/mapper/cryptswap1 is active and is in use.
type: PLAIN
cipher: aes-cbc-essiv:sha256
keysize: 256 bits
device: /dev/sda2
offset: 0 sectors
size: 8388608 sectors
mode: r... |
105,877 | So I'm making a game using love2d where the player will find himself in an zombie infested city but I don't want the city/map to be just the same all the time, so I want to create a random map/city generator, but I don't know where to start, I maybe can make my own but the result would probably be not what I wanted, as... | 2015/08/19 | [
"https://gamedev.stackexchange.com/questions/105877",
"https://gamedev.stackexchange.com",
"https://gamedev.stackexchange.com/users/70087/"
] | Like stated by Shiro in a comment , it's difficult to give a precise answer. I can suggest a possible starting point.
Use random [voronoi](https://it.wikipedia.org/wiki/Diagramma_di_Voronoi) generation where , given a set of random points P , each point in space is weighted relative to the distance from the nearest p ... | You should do some research about l-systems, they allow you to specify some basic rules and then procedurally generate the map.
You could for example specify that every building must be surrounded by roads, and every road must continue in a straight line or eventually end, and every road is surrounded by buildings or ... |
105,877 | So I'm making a game using love2d where the player will find himself in an zombie infested city but I don't want the city/map to be just the same all the time, so I want to create a random map/city generator, but I don't know where to start, I maybe can make my own but the result would probably be not what I wanted, as... | 2015/08/19 | [
"https://gamedev.stackexchange.com/questions/105877",
"https://gamedev.stackexchange.com",
"https://gamedev.stackexchange.com/users/70087/"
] | There are simple ways to generate cities, depending on your needs.
Some time ago, I wanted to generate cities for a fantasy setting, so I started [playing with a generator](http://rpg20.com/cityGen.php?imgStyle=3&citySize=very_large). Like I said in [another SE post](https://rpg.stackexchange.com/questions/57695/moder... | You should do some research about l-systems, they allow you to specify some basic rules and then procedurally generate the map.
You could for example specify that every building must be surrounded by roads, and every road must continue in a straight line or eventually end, and every road is surrounded by buildings or ... |
951,981 | Expanding on [How can I make Windows 8 use the classic theme?](https://superuser.com/questions/513492/how-can-i-make-windows-8-use-the-classic-theme) and [Windows 10 TenForums: Windows Classic Look Theme in Windows 10](http://www.tenforums.com/customization/11432-windows-classic-look-theme-windows-10-a.html) -- how doe... | 2015/08/06 | [
"https://superuser.com/questions/951981",
"https://superuser.com",
"https://superuser.com/users/327566/"
] | Have a look at this thread:
<http://forum.thinkpads.com/viewtopic.php?f=67&t=113024&p=777781&hilit=classictheme#p777781>
They're discussing/testing how to modify windows binary files to "get back" to classic interface by "unusual" methods, rather than just turning colors into gray!
But it appears to be very complex d... | Its impossible to change it to:
[](https://i.stack.imgur.com/YMIdr.png)
If you are REALLY desperate for the classic theme, [downgrade to Windows 7](http://www.pcadvisor.co.uk/how-to/windows/roll-back-windows-7-from-windows-8-3459580/). Or go along with this
[ and [Windows 10 TenForums: Windows Classic Look Theme in Windows 10](http://www.tenforums.com/customization/11432-windows-classic-look-theme-windows-10-a.html) -- how doe... | 2015/08/06 | [
"https://superuser.com/questions/951981",
"https://superuser.com",
"https://superuser.com/users/327566/"
] | Have a look at this thread:
<http://forum.thinkpads.com/viewtopic.php?f=67&t=113024&p=777781&hilit=classictheme#p777781>
They're discussing/testing how to modify windows binary files to "get back" to classic interface by "unusual" methods, rather than just turning colors into gray!
But it appears to be very complex d... | On Windows 11 and Windows 10 version 1903 and above I suggest to use [Explorer Patcher](https://github.com/valinet/ExplorerPatcher) and [ClassicThemeTray](https://github.com/spitfirex86/ClassicThemeTray):
[? Thanks... | 2012/05/13 | [
"https://Stackoverflow.com/questions/10569321",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/379814/"
] | In your spring-ws-servlet.xml configuration,add the following:
```
<?xml version="1.0" encoding="UTF-8"?>
<beans>
<context:annotation-config />
<sws:annotation-driven />
<sws:dynamic-wsdl id="holidayEndPoint" portTypeName="HolidayEndpoint"
............
......
```
More info can be had from here
[Unable t... | Generate and publish wsdl:
```
<sws:dynamic-wsdl id="EntityService" portTypeName="Entity" locationUri="/ws/EntityService/"
targetNamespace="http://me.com/myproject/definitions">
<sws:xsd location="WEB-INF/schemas/EntityCommons.xsd" />
<sws:xsd location="WEB-INF/schemas/EntityService.xsd" />
</sws:dynamic-w... |
40,012,211 | The question reads "Just as it is possible to multiply by adding over and over, it is possible to divide by subtracting over and over. Write a program with a procedure to compute how many times a number N1 goes into another number N2. You will need a loop, and count for how many times that loop is executed". I am reall... | 2016/10/13 | [
"https://Stackoverflow.com/questions/40012211",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7011413/"
] | Algorithm for positive N1,N2:
1. prepare `N1`, `N2` and set some `R` to -1
2. increment `R`
3. subtract `N1` from `N2` (update `N2` with result)
4. when result of subtraction is above or equal to zero, go to step 2.
5. `R` has result of integer division `N2`/`N1`
Steps 2. to 4. can be written in x86 Assembly by singl... | Next program does the job. The numbers are declared as variables in the data segment, comments explain everything (just copy-paste it in EMU8086 and run it) :
```
.model small
.stack 100h
.data
n1 dw 3
n2 dw 95
count dw ?
msg db 'Quotient = $'
str db 10 dup('$')
.code
mov ax, @data
mov ds, ax
;DIVIDE ... |
4,468,310 | suppose there is a tree with number of child nodes increasing from 2 to 4 then 8 and so on.how can we write recurrence relation for such a tree. | 2010/12/17 | [
"https://Stackoverflow.com/questions/4468310",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/531802/"
] | * using subtitution method- T(n)=2T(n/2)+n
=2[2T(n/2^2)+n/2]+n
=2^2T(n/2^2)+n+n
=2^2[2T(n/2^3)+n/2^2]+n+n
=2^3T(n/2^3)+n+n+n
similarly subtituing k times-- we get
T(n)=2^k T(n/2^k)+nk
the recursion will terminate when n/2^k=1
k=log n base 2.
thus T(n)=2^log n(base2)+n(log n)
=n+nlogn
thus the tight bound for... | Take a look at this [link](http://www.cs.duke.edu/~ola/ap/recurrence.html).
```
T(n) = 2 T(n/2) + O(n) [the O(n) is for Combine]
T(1) = O(1)
``` |
34,686,217 | ```
ggplot(all, aes(x=area, y=nq)) +
geom_point(size=0.5) +
geom_abline(data = levelnew, aes(intercept=log10(exp(interceptmax)), slope=fslope)) + #shifted regression line
scale_y_log10(labels = function(y) format(y, scientific = FALSE)) +
scale_x_log10(labels = function(x) format(x, scientific = FALSE)) +
f... | 2016/01/08 | [
"https://Stackoverflow.com/questions/34686217",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3942806/"
] | I don't have your data, so I made some up:
```
df <- data.frame(x=rnorm(100),y=rnorm(100),z=rep(letters[1:4],each=25))
ggplot(df,aes(x,y)) +
geom_point() +
theme_bw() +
facet_wrap(~z)
```
[](https://i.stack.imgur.com/uCOR9.png)
To add a vert... | Another way to express this which is possibly easier to generalize (and formatting stuff left out):
```
ggplot(df, aes(x,y)) +
geom_point() +
facet_wrap(~ z) +
geom_vline(data = subset(df, z == "b"), aes(xintercept = 1))
```
The key things being: facet first, then decorate facets by subsetting the original da... |
6,117,315 | I have three questions regarding SSL that I don't fully understand.
1. If I get it correctly, a server `A` submits a request to a certain CA. Then, it receives (after validation etc.) a digital certificate composed of a public key + identity + an encription of this information using the CA's private key.
Later on, a ... | 2011/05/24 | [
"https://Stackoverflow.com/questions/6117315",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/764420/"
] | An SSL identity is characterized by four parts:
1. A *private* key, which is not shared with anyone.
2. A *public* key, which you can share with anyone.
The private and public key form a matched pair: anything you encrypt with one can be decrypted with the other, but you *cannot* decrypt something encrypted with the ... | Question N°1
------------
>
> can't B just take this certificate [...] which will allow them to authenticate as A to C
>
>
>
This [part](http://i.imgur.com/jrUIZOn.png) of the a larger [diagram](http://i.imgur.com/5T2fJsG.png) deals with that question.
Mainly : if you only have the public key then you can not es... |
6,117,315 | I have three questions regarding SSL that I don't fully understand.
1. If I get it correctly, a server `A` submits a request to a certain CA. Then, it receives (after validation etc.) a digital certificate composed of a public key + identity + an encription of this information using the CA's private key.
Later on, a ... | 2011/05/24 | [
"https://Stackoverflow.com/questions/6117315",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/764420/"
] | An SSL identity is characterized by four parts:
1. A *private* key, which is not shared with anyone.
2. A *public* key, which you can share with anyone.
The private and public key form a matched pair: anything you encrypt with one can be decrypted with the other, but you *cannot* decrypt something encrypted with the ... | I also have some answers.
Q1) If B steals A's certificate and try to impersonate as A to C.
* C will validate the IP address of B and find out that it does not belong to C. It will then abort the SSL connection. Of course, even if C sends an encrypted message, then only the Real A will be able to decrypt it.
Q2) A c... |
6,117,315 | I have three questions regarding SSL that I don't fully understand.
1. If I get it correctly, a server `A` submits a request to a certain CA. Then, it receives (after validation etc.) a digital certificate composed of a public key + identity + an encription of this information using the CA's private key.
Later on, a ... | 2011/05/24 | [
"https://Stackoverflow.com/questions/6117315",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/764420/"
] | >
> My question is can't "B" just take this certificate, thus stealing the identity of "A" - which will allow them to authenticate as "A" to "C"
>
>
>
There's also a private part of the certificate that does not get transmitted (the private key). **Without the private key, B cannot authenticate as A.** Similarly, ... | Question N°1
------------
>
> can't B just take this certificate [...] which will allow them to authenticate as A to C
>
>
>
This [part](http://i.imgur.com/jrUIZOn.png) of the a larger [diagram](http://i.imgur.com/5T2fJsG.png) deals with that question.
Mainly : if you only have the public key then you can not es... |
6,117,315 | I have three questions regarding SSL that I don't fully understand.
1. If I get it correctly, a server `A` submits a request to a certain CA. Then, it receives (after validation etc.) a digital certificate composed of a public key + identity + an encription of this information using the CA's private key.
Later on, a ... | 2011/05/24 | [
"https://Stackoverflow.com/questions/6117315",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/764420/"
] | Question N°1
------------
>
> can't B just take this certificate [...] which will allow them to authenticate as A to C
>
>
>
This [part](http://i.imgur.com/jrUIZOn.png) of the a larger [diagram](http://i.imgur.com/5T2fJsG.png) deals with that question.
Mainly : if you only have the public key then you can not es... | I also have some answers.
Q1) If B steals A's certificate and try to impersonate as A to C.
* C will validate the IP address of B and find out that it does not belong to C. It will then abort the SSL connection. Of course, even if C sends an encrypted message, then only the Real A will be able to decrypt it.
Q2) A c... |
6,117,315 | I have three questions regarding SSL that I don't fully understand.
1. If I get it correctly, a server `A` submits a request to a certain CA. Then, it receives (after validation etc.) a digital certificate composed of a public key + identity + an encription of this information using the CA's private key.
Later on, a ... | 2011/05/24 | [
"https://Stackoverflow.com/questions/6117315",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/764420/"
] | An SSL identity is characterized by four parts:
1. A *private* key, which is not shared with anyone.
2. A *public* key, which you can share with anyone.
The private and public key form a matched pair: anything you encrypt with one can be decrypted with the other, but you *cannot* decrypt something encrypted with the ... | In general, yes, if the cert file gets stolen, nothing will stop someone from installing it on their server and suddenly assuming the stolen site's identity. However, unless the thief takes over control of the original site's DNS setup, any requests for the site's URL will still go to the original server, and the thief... |
6,117,315 | I have three questions regarding SSL that I don't fully understand.
1. If I get it correctly, a server `A` submits a request to a certain CA. Then, it receives (after validation etc.) a digital certificate composed of a public key + identity + an encription of this information using the CA's private key.
Later on, a ... | 2011/05/24 | [
"https://Stackoverflow.com/questions/6117315",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/764420/"
] | >
> My question is can't "B" just take this certificate, thus stealing the identity of "A" - which will allow them to authenticate as "A" to "C"
>
>
>
There's also a private part of the certificate that does not get transmitted (the private key). **Without the private key, B cannot authenticate as A.** Similarly, ... | First question: You are correct about what you get back from the CA, but you are missing part of what you need before you submit your request to the CA. You need (1) a certificate request, and (2) the corresponding *private* key. You do not send the private key as part of the request; you keep it secret on your server.... |
6,117,315 | I have three questions regarding SSL that I don't fully understand.
1. If I get it correctly, a server `A` submits a request to a certain CA. Then, it receives (after validation etc.) a digital certificate composed of a public key + identity + an encription of this information using the CA's private key.
Later on, a ... | 2011/05/24 | [
"https://Stackoverflow.com/questions/6117315",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/764420/"
] | An SSL identity is characterized by four parts:
1. A *private* key, which is not shared with anyone.
2. A *public* key, which you can share with anyone.
The private and public key form a matched pair: anything you encrypt with one can be decrypted with the other, but you *cannot* decrypt something encrypted with the ... | >
> My question is can't "B" just take this certificate, thus stealing the identity of "A" - which will allow them to authenticate as "A" to "C"
>
>
>
There's also a private part of the certificate that does not get transmitted (the private key). **Without the private key, B cannot authenticate as A.** Similarly, ... |
6,117,315 | I have three questions regarding SSL that I don't fully understand.
1. If I get it correctly, a server `A` submits a request to a certain CA. Then, it receives (after validation etc.) a digital certificate composed of a public key + identity + an encription of this information using the CA's private key.
Later on, a ... | 2011/05/24 | [
"https://Stackoverflow.com/questions/6117315",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/764420/"
] | First question: You are correct about what you get back from the CA, but you are missing part of what you need before you submit your request to the CA. You need (1) a certificate request, and (2) the corresponding *private* key. You do not send the private key as part of the request; you keep it secret on your server.... | I also have some answers.
Q1) If B steals A's certificate and try to impersonate as A to C.
* C will validate the IP address of B and find out that it does not belong to C. It will then abort the SSL connection. Of course, even if C sends an encrypted message, then only the Real A will be able to decrypt it.
Q2) A c... |
6,117,315 | I have three questions regarding SSL that I don't fully understand.
1. If I get it correctly, a server `A` submits a request to a certain CA. Then, it receives (after validation etc.) a digital certificate composed of a public key + identity + an encription of this information using the CA's private key.
Later on, a ... | 2011/05/24 | [
"https://Stackoverflow.com/questions/6117315",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/764420/"
] | >
> My question is can't "B" just take this certificate, thus stealing the identity of "A" - which will allow them to authenticate as "A" to "C"
>
>
>
There's also a private part of the certificate that does not get transmitted (the private key). **Without the private key, B cannot authenticate as A.** Similarly, ... | I also have some answers.
Q1) If B steals A's certificate and try to impersonate as A to C.
* C will validate the IP address of B and find out that it does not belong to C. It will then abort the SSL connection. Of course, even if C sends an encrypted message, then only the Real A will be able to decrypt it.
Q2) A c... |
6,117,315 | I have three questions regarding SSL that I don't fully understand.
1. If I get it correctly, a server `A` submits a request to a certain CA. Then, it receives (after validation etc.) a digital certificate composed of a public key + identity + an encription of this information using the CA's private key.
Later on, a ... | 2011/05/24 | [
"https://Stackoverflow.com/questions/6117315",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/764420/"
] | An SSL identity is characterized by four parts:
1. A *private* key, which is not shared with anyone.
2. A *public* key, which you can share with anyone.
The private and public key form a matched pair: anything you encrypt with one can be decrypted with the other, but you *cannot* decrypt something encrypted with the ... | First question: You are correct about what you get back from the CA, but you are missing part of what you need before you submit your request to the CA. You need (1) a certificate request, and (2) the corresponding *private* key. You do not send the private key as part of the request; you keep it secret on your server.... |
10,017,027 | I have a table transaction which has duplicates. i want to keep the record that had minimum id and delete all the duplicates based on four fields DATE, AMOUNT, REFNUMBER, PARENTFOLDERID. I wrote this query but i am not sure if this can be written in an efficient way. Do you think there is a better way? I am asking beca... | 2012/04/04 | [
"https://Stackoverflow.com/questions/10017027",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/510242/"
] | It would probably be more efficient to do something like
```
DELETE FROM transaction t1
WHERE EXISTS( SELECT 1
FROM transaction t2
WHERE t1.date = t2.date
AND t1.refnumber = t2.refnumber
AND t1.parentFolderId = t2.parentFolderId
AN... | I would try something like this:
```
DELETE transaction
FROM transaction
LEFT OUTER JOIN
(
SELECT MIN(id) as id, date, amount, refnumber, parentfolderid
FROM transaction
GROUP BY date, amount, refnumber, parentfolderid
) as validRows
ON transaction.id = validRows.id
WHERE validRows.id IS ... |
10,017,027 | I have a table transaction which has duplicates. i want to keep the record that had minimum id and delete all the duplicates based on four fields DATE, AMOUNT, REFNUMBER, PARENTFOLDERID. I wrote this query but i am not sure if this can be written in an efficient way. Do you think there is a better way? I am asking beca... | 2012/04/04 | [
"https://Stackoverflow.com/questions/10017027",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/510242/"
] | It would probably be more efficient to do something like
```
DELETE FROM transaction t1
WHERE EXISTS( SELECT 1
FROM transaction t2
WHERE t1.date = t2.date
AND t1.refnumber = t2.refnumber
AND t1.parentFolderId = t2.parentFolderId
AN... | ```
DELETE FROM transaction
WHERE ID IN (
SELECT ID
FROM (SELECT ID,
ROW_NUMBER () OVER (PARTITION BY date
,amount
,refnumber
... |
10,017,027 | I have a table transaction which has duplicates. i want to keep the record that had minimum id and delete all the duplicates based on four fields DATE, AMOUNT, REFNUMBER, PARENTFOLDERID. I wrote this query but i am not sure if this can be written in an efficient way. Do you think there is a better way? I am asking beca... | 2012/04/04 | [
"https://Stackoverflow.com/questions/10017027",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/510242/"
] | ```
DELETE FROM transaction
WHERE ID IN (
SELECT ID
FROM (SELECT ID,
ROW_NUMBER () OVER (PARTITION BY date
,amount
,refnumber
... | I would try something like this:
```
DELETE transaction
FROM transaction
LEFT OUTER JOIN
(
SELECT MIN(id) as id, date, amount, refnumber, parentfolderid
FROM transaction
GROUP BY date, amount, refnumber, parentfolderid
) as validRows
ON transaction.id = validRows.id
WHERE validRows.id IS ... |
43,339,561 | I want to select the number of rows which are greater than 3 by rownum function i\_e "(rownum>3)"
for example if there are 25 rows and I want to retrieve the last 22 rows by rownum function.
but when I write the
```
select * from test_table where rownum>3;
```
it retrieve no row.
can any one help me to solve this p... | 2017/04/11 | [
"https://Stackoverflow.com/questions/43339561",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7677507/"
] | In RDBMS there is no first or last rows. What you calls "raws" , actually is set(sets), they can be ordered or not. `rownum` is a function, which is just enumerates result set, it makes sense only after set is calculated, to order your set of data (rows) you should do it in your query before `rownum` call, you must tel... | ```
select * from (select rownum as rn, t.* from test_table t) where rn > 3
```
see this article for more samples
[On Top-n and Pagination Queries By Tom Kyte](http://www.oracle.com/technetwork/issue-archive/2007/07-jan/o17asktom-093877.html) |
43,339,561 | I want to select the number of rows which are greater than 3 by rownum function i\_e "(rownum>3)"
for example if there are 25 rows and I want to retrieve the last 22 rows by rownum function.
but when I write the
```
select * from test_table where rownum>3;
```
it retrieve no row.
can any one help me to solve this p... | 2017/04/11 | [
"https://Stackoverflow.com/questions/43339561",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7677507/"
] | It is not working because: for the first row assumes the `ROWNUM` of 1 and since your `WHERE` clause is `ROWNUM>3` then this reduces to `1>3` and the row is discarded. The subsequent row will then be tested against a `ROWNUM` of 1 (since the previous row is no longer in the output and now does not require a row number)... | ```
select * from (select rownum as rn, t.* from test_table t) where rn > 3
```
see this article for more samples
[On Top-n and Pagination Queries By Tom Kyte](http://www.oracle.com/technetwork/issue-archive/2007/07-jan/o17asktom-093877.html) |
6,213,814 | How to populate form with JSON data using data store? How are the textfields connected with store, model?
```
Ext.define('app.formStore', {
extend: 'Ext.data.Model',
fields: [
{name: 'naziv', type:'string'},
{name: 'oib', type:'int'},
{name: 'email', type:'string'}
]
});
var myStore = Ext.create('Ext.data.St... | 2011/06/02 | [
"https://Stackoverflow.com/questions/6213814",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/765628/"
] | The field names of your model and form **should match**. Then you can load the form using `loadRecord()`. For example:
```
var record = Ext.create('XYZ',{
name: 'Abc',
email: 'abc@abc.com'
});
formpanel.getForm().loadRecord(record);
```
or, get the values from already loaded store. | The answer of Abdel Olakara works great. But if you want to populate without the use of a store you can also do it like:
```
var record = {
data : {
group : 'Moody Blues',
text : 'One of the greatest bands'
}
};
formpanel.getForm().loadRecord(record);
``` |
6,213,814 | How to populate form with JSON data using data store? How are the textfields connected with store, model?
```
Ext.define('app.formStore', {
extend: 'Ext.data.Model',
fields: [
{name: 'naziv', type:'string'},
{name: 'oib', type:'int'},
{name: 'email', type:'string'}
]
});
var myStore = Ext.create('Ext.data.St... | 2011/06/02 | [
"https://Stackoverflow.com/questions/6213814",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/765628/"
] | The field names of your model and form **should match**. Then you can load the form using `loadRecord()`. For example:
```
var record = Ext.create('XYZ',{
name: 'Abc',
email: 'abc@abc.com'
});
formpanel.getForm().loadRecord(record);
```
or, get the values from already loaded store. | I suggest you use Ext Direct methods. This way you can implement very nice and clean all operations: edit, delete, etc. |
6,213,814 | How to populate form with JSON data using data store? How are the textfields connected with store, model?
```
Ext.define('app.formStore', {
extend: 'Ext.data.Model',
fields: [
{name: 'naziv', type:'string'},
{name: 'oib', type:'int'},
{name: 'email', type:'string'}
]
});
var myStore = Ext.create('Ext.data.St... | 2011/06/02 | [
"https://Stackoverflow.com/questions/6213814",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/765628/"
] | The answer of Abdel Olakara works great. But if you want to populate without the use of a store you can also do it like:
```
var record = {
data : {
group : 'Moody Blues',
text : 'One of the greatest bands'
}
};
formpanel.getForm().loadRecord(record);
``` | I suggest you use Ext Direct methods. This way you can implement very nice and clean all operations: edit, delete, etc. |
33,864,134 | I'm developing an Android Application which is consists of a Navigation drawer and a Google Map. I have successfully developed my Navigation Drawer and connect my Map into it. The thing is I need my Map to Zoom to the current location.
Here is the code I used in `MapsActivity.java`.
```
protected void onCreate(Bund... | 2015/11/23 | [
"https://Stackoverflow.com/questions/33864134",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | try this ..
```
map.animateCamera(CameraUpdateFactory.newLatLngZoom((sydney), 13.0f));
```
you have not given by in float. so its not working.. try this.. | it will not work because the navigation drawer takes a fragment and you are initializing :
```
fragment = new MapFragment();
```
so it takes the **MapFragment default layout** .
you must to change the **updateDisplay** to takes an activity not a fragment . In another words change the navigation drawer to activi... |
33,864,134 | I'm developing an Android Application which is consists of a Navigation drawer and a Google Map. I have successfully developed my Navigation Drawer and connect my Map into it. The thing is I need my Map to Zoom to the current location.
Here is the code I used in `MapsActivity.java`.
```
protected void onCreate(Bund... | 2015/11/23 | [
"https://Stackoverflow.com/questions/33864134",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | try this
```
map.moveCamera(CameraUpdateFactory.newLatLngZoom(currentCoordinates, 13));
```
In XML
```
<com.google.android.gms.maps.MapView
android:id="@+id/mapView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
```
In JAVA Activity
```
private vo... | it will not work because the navigation drawer takes a fragment and you are initializing :
```
fragment = new MapFragment();
```
so it takes the **MapFragment default layout** .
you must to change the **updateDisplay** to takes an activity not a fragment . In another words change the navigation drawer to activi... |
32,739,103 | I have a complex object and I'm trying to set the
>
> SelectedTransportation
>
>
>
property which I manually add in a mapping. The code properly populates the dropdownlist, but I can't figure out how to set SelectedTransportation properly. I've tried setting it during the mapping process and after mapping through... | 2015/09/23 | [
"https://Stackoverflow.com/questions/32739103",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2855467/"
] | Your idea of creating a proxy is good imo, however, if you have access to ES6, why not looking into [Proxy](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy)? I think it does what you want out-of-the-box.
The MDN provides good examples on how do traps for value validation in a set... | This way for protecting JavaScript objects has a very significant issue which should be addressed, otherwise this way will not work properly.
[MDN](https://developer.mozilla.org/en-US/docs/Web/API/Document/currentScript) noted on this API that:
>
> It's important to note that this will not reference the `<script>` ... |
5,100,229 | So I have set up a mysql database that holds an image (more specifically a path to an image) and the images rank (starting at 0). I then created a web page that displays two images at random at a time. [Up till here everything works fine] I want my users to be able to click on one of the images that they like better an... | 2011/02/24 | [
"https://Stackoverflow.com/questions/5100229",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/518080/"
] | Well i wasn't able to solve why the Between function didn't work - but mysql doesn't allow BETWEEN on floating point numbers either. So i'm going to assume that it's a similar reason.
I changed my code to merely create it's own between statement.
```
NSPredicate *longPredicate = nil;
NSPredicate *latPredica... | I don't see the exact cause either, and you haven't shown the code where the rest of boutiqueRequest's properties are set and the fetch fired (not that it matters unless you set the predicate again or something else funky), but the report
>
> 2011-02-24 13:57:18.916 DL2[9628:207] -[NSCFNumber constantValue]: unrecogn... |
5,100,229 | So I have set up a mysql database that holds an image (more specifically a path to an image) and the images rank (starting at 0). I then created a web page that displays two images at random at a time. [Up till here everything works fine] I want my users to be able to click on one of the images that they like better an... | 2011/02/24 | [
"https://Stackoverflow.com/questions/5100229",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/518080/"
] | I had a similar error as well. I am pretty sure it is a very low level database related issue. Here is some more information I have -
a. With a inmemory database, I could run a test case with exactly the same data just fine.
b. When I got the error "-[\_\_NSCFNumber constantValue]: unrecognized selector sent to insta... | I don't see the exact cause either, and you haven't shown the code where the rest of boutiqueRequest's properties are set and the fetch fired (not that it matters unless you set the predicate again or something else funky), but the report
>
> 2011-02-24 13:57:18.916 DL2[9628:207] -[NSCFNumber constantValue]: unrecogn... |
5,100,229 | So I have set up a mysql database that holds an image (more specifically a path to an image) and the images rank (starting at 0). I then created a web page that displays two images at random at a time. [Up till here everything works fine] I want my users to be able to click on one of the images that they like better an... | 2011/02/24 | [
"https://Stackoverflow.com/questions/5100229",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/518080/"
] | Well i wasn't able to solve why the Between function didn't work - but mysql doesn't allow BETWEEN on floating point numbers either. So i'm going to assume that it's a similar reason.
I changed my code to merely create it's own between statement.
```
NSPredicate *longPredicate = nil;
NSPredicate *latPredica... | At the beginning of your fetch you're declaring
`NSPredicate *predicateToRun = nil;`
And then you assign it a NSCompoundPredicate to it in
`predicateToRun = [NSCompoundPredicate andPredicateWithSubpredicates:[NSArray arrayWithObjects:longPredicate, latPredicate, nil]];`
See if that solves it.
Rog |
5,100,229 | So I have set up a mysql database that holds an image (more specifically a path to an image) and the images rank (starting at 0). I then created a web page that displays two images at random at a time. [Up till here everything works fine] I want my users to be able to click on one of the images that they like better an... | 2011/02/24 | [
"https://Stackoverflow.com/questions/5100229",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/518080/"
] | Well i wasn't able to solve why the Between function didn't work - but mysql doesn't allow BETWEEN on floating point numbers either. So i'm going to assume that it's a similar reason.
I changed my code to merely create it's own between statement.
```
NSPredicate *longPredicate = nil;
NSPredicate *latPredica... | I had a similar error as well. I am pretty sure it is a very low level database related issue. Here is some more information I have -
a. With a inmemory database, I could run a test case with exactly the same data just fine.
b. When I got the error "-[\_\_NSCFNumber constantValue]: unrecognized selector sent to insta... |
5,100,229 | So I have set up a mysql database that holds an image (more specifically a path to an image) and the images rank (starting at 0). I then created a web page that displays two images at random at a time. [Up till here everything works fine] I want my users to be able to click on one of the images that they like better an... | 2011/02/24 | [
"https://Stackoverflow.com/questions/5100229",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/518080/"
] | I had a similar error as well. I am pretty sure it is a very low level database related issue. Here is some more information I have -
a. With a inmemory database, I could run a test case with exactly the same data just fine.
b. When I got the error "-[\_\_NSCFNumber constantValue]: unrecognized selector sent to insta... | At the beginning of your fetch you're declaring
`NSPredicate *predicateToRun = nil;`
And then you assign it a NSCompoundPredicate to it in
`predicateToRun = [NSCompoundPredicate andPredicateWithSubpredicates:[NSArray arrayWithObjects:longPredicate, latPredicate, nil]];`
See if that solves it.
Rog |
357,141 | I am struck in finding the solution for the below requirements
Assume drop down#1 and drop down#2 selection box in the Magento2 admin UI grid filters. If we select option in one drop down#1 then we have to filter option in drop down#2 based on drop down#1 selection value.
If anyone aware of the solution / any alterna... | 2022/06/23 | [
"https://magento.stackexchange.com/questions/357141",
"https://magento.stackexchange.com",
"https://magento.stackexchange.com/users/12392/"
] | The answer just a concept and i don't have enough time to provide full example, but hope this will help to understand a concept.
**1. Custom Column Ui Component**
You need to create a custom column element for your second filter and extend for example `Magento_Ui/js/grid/columns/select`. You still can use native temp... | Credit to Victor, just refactored the code with working examples
```
define(
[
'Magento_Ui/js/form/element/select',
'uiRegistry',
'underscore'
],
function (Select, registry, _) {
'use strict';
return Select.extend({
defaults: {
parent: '$... |
34,798,757 | I am working on an app written in Polymer.
I have some CSS variables defined like this:
```
:root {
--my-option-1: #ff8a80;
--my-option-2: #4a148c;
--my-option-3: #8c9eff;
}
```
The user literally chooses "1", "2", or "3". I have a function that looks like this:
```
// The v parameter will be 1, 2, or 3
fun... | 2016/01/14 | [
"https://Stackoverflow.com/questions/34798757",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1185425/"
] | You can use a constructor, I don't see a need for inheritance
```
function Config(key, name, icon, values, filterFn) {
this.key = key;
this.name = name;
this.icon = icon;
this.values = values;
this.filterFn = filterFn;
}
var cfg = {};
// Don't want to repeat "someKey"? put it in a variable.
var my... | What I've done before:
```
var defaultConfig = {
everything: 'goes',
'in': {here: ""},
once: true
};
var selectedOptions = jQuery.extend(true, {}, defaultConfig, optionConfig);
```
Where optionConfig can look like this:
```
{once: false}
``` |
16,637,051 | I'm trying to make a number input. I've made so my textbox only accepts numbers via this code:
```
function isNumber(evt) {
evt = (evt) ? evt : window.event;
var charCode = (evt.which) ? evt.which : evt.keyCode;
if (charCode > 31 && (charCode < 48 || charCode > 57)) {
return false;
}
return... | 2013/05/19 | [
"https://Stackoverflow.com/questions/16637051",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1768788/"
] | For integers use
```
function numberWithSpaces(x) {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, " ");
}
```
For floating point numbers you can use
```
function numberWithSpaces(x) {
var parts = x.toString().split(".");
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, " ");
return parts... | Easiest way:
1
=
```
var num = 1234567890,
result = num.toLocaleString() ;// result will equal to "1 234 567 890"
```
2
=
```
var num = 1234567.890,
result = num.toLocaleString() + num.toString().slice(num.toString().indexOf('.')) // will equal to 1 234 567.890
```
3
=
```
var num = 1234567.890123,
result = Num... |
16,637,051 | I'm trying to make a number input. I've made so my textbox only accepts numbers via this code:
```
function isNumber(evt) {
evt = (evt) ? evt : window.event;
var charCode = (evt.which) ? evt.which : evt.keyCode;
if (charCode > 31 && (charCode < 48 || charCode > 57)) {
return false;
}
return... | 2013/05/19 | [
"https://Stackoverflow.com/questions/16637051",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1768788/"
] | For integers use
```
function numberWithSpaces(x) {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, " ");
}
```
For floating point numbers you can use
```
function numberWithSpaces(x) {
var parts = x.toString().split(".");
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, " ");
return parts... | This function works well inside an input:
```
const formatAndVerifyNumericValue = (value, callback) => {
const reg = new RegExp('^[0-9]+$');
let newValue = value.replace(/\s/g, '');
if (reg.test(newValue)) {
newValue = newValue.toString().replace(/\B(?<!\.\d*)(?=(\d{3})+.
(?!\d))/g, ' ');
return callback... |
16,637,051 | I'm trying to make a number input. I've made so my textbox only accepts numbers via this code:
```
function isNumber(evt) {
evt = (evt) ? evt : window.event;
var charCode = (evt.which) ? evt.which : evt.keyCode;
if (charCode > 31 && (charCode < 48 || charCode > 57)) {
return false;
}
return... | 2013/05/19 | [
"https://Stackoverflow.com/questions/16637051",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1768788/"
] | Easiest way:
1
=
```
var num = 1234567890,
result = num.toLocaleString() ;// result will equal to "1 234 567 890"
```
2
=
```
var num = 1234567.890,
result = num.toLocaleString() + num.toString().slice(num.toString().indexOf('.')) // will equal to 1 234 567.890
```
3
=
```
var num = 1234567.890123,
result = Num... | This function works well inside an input:
```
const formatAndVerifyNumericValue = (value, callback) => {
const reg = new RegExp('^[0-9]+$');
let newValue = value.replace(/\s/g, '');
if (reg.test(newValue)) {
newValue = newValue.toString().replace(/\B(?<!\.\d*)(?=(\d{3})+.
(?!\d))/g, ' ');
return callback... |
72,120,997 | Let's say I have a data frame like this:
```
dat<- data.frame(ID= c("A","A","A","A","B","B", "B", "B"),
test= rep(c("pre","post"),4),
item= c(rep("item1",2), rep("item2",2), rep("item1",2), rep("item2",2)),
answer= c("1_2_3_4", "1_2_3_4","2_4_3_1","4_3_2_1", "2_4_3_1","2_4_3_1",... | 2022/05/05 | [
"https://Stackoverflow.com/questions/72120997",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8061255/"
] | ```r
dat<- data.frame(ID= c("A","A","A","A","B","B", "B", "B"),
test= rep(c("pre","post"),4),
item= c(rep("item1",2), rep("item2",2), rep("item1",2), rep("item2",2)),
answer= c("1_2_3_4", "1_2_3_4","2_4_3_1","4_3_2_1", "2_4_3_1","2_4_3_1","4_3_2_1","4_3_2_1"))
library(data.table... | In `dplyr`, we can use `group_by` and `summarize` to see if the `answer` column is the same in "pre" and "post" with the same `ID` and `item` columns.
```r
library(dplyr)
dat<- data.frame(ID= c("A","A","A","A","B","B", "B", "B"),
test= rep(c("pre","post"),4),
item= c(rep("item1",2),... |
49,320,845 | <https://colab.research.google.com/notebooks/io.ipynb#scrollTo=KHeruhacFpSU>
In this notebook help it explains how to upload a file to drive and then download to Colaboratory but my files are already in drive.
Where can I find the file ID ?
```
# Download the file we just uploaded.
#
# Replace the assignment below w... | 2018/03/16 | [
"https://Stackoverflow.com/questions/49320845",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8833943/"
] | If the parameter is definitely unused, `[[maybe_unused]]` is not particularly useful, unnamed parameters and comments work just fine for that.
`[[maybe_unused]]` is mostly useful for things that are *potentially* unused, like in
```
void fun(int i, int j) {
assert(i < j);
// j not used here anymore
}
```
Th... | [Baum mit Augen's answer](https://stackoverflow.com/a/49320892/817643) is the definitive and undisputed explanation. I just want to present another example, which doesn't require macros. Specifically, C++17 introduced the `constexpr if` construct. So you may see template code like this (bar the stupid functionality):
... |
49,320,845 | <https://colab.research.google.com/notebooks/io.ipynb#scrollTo=KHeruhacFpSU>
In this notebook help it explains how to upload a file to drive and then download to Colaboratory but my files are already in drive.
Where can I find the file ID ?
```
# Download the file we just uploaded.
#
# Replace the assignment below w... | 2018/03/16 | [
"https://Stackoverflow.com/questions/49320845",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8833943/"
] | If the parameter is definitely unused, `[[maybe_unused]]` is not particularly useful, unnamed parameters and comments work just fine for that.
`[[maybe_unused]]` is mostly useful for things that are *potentially* unused, like in
```
void fun(int i, int j) {
assert(i < j);
// j not used here anymore
}
```
Th... | I find [[maybe\_unused]] is useful when you have a set of constants that define a set configuration constants that may or may not be used depending on the configuration. You are then free to change the configuration without having to define new constants and worrying about unused constants.
I use this mainly in embedd... |
49,320,845 | <https://colab.research.google.com/notebooks/io.ipynb#scrollTo=KHeruhacFpSU>
In this notebook help it explains how to upload a file to drive and then download to Colaboratory but my files are already in drive.
Where can I find the file ID ?
```
# Download the file we just uploaded.
#
# Replace the assignment below w... | 2018/03/16 | [
"https://Stackoverflow.com/questions/49320845",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8833943/"
] | [Baum mit Augen's answer](https://stackoverflow.com/a/49320892/817643) is the definitive and undisputed explanation. I just want to present another example, which doesn't require macros. Specifically, C++17 introduced the `constexpr if` construct. So you may see template code like this (bar the stupid functionality):
... | I find [[maybe\_unused]] is useful when you have a set of constants that define a set configuration constants that may or may not be used depending on the configuration. You are then free to change the configuration without having to define new constants and worrying about unused constants.
I use this mainly in embedd... |
33,001,985 | I have started using Webpack when developing usual web sites consisting of a number pages and of different pages types. I'm used to the RequireJs script loader that loads all dependencies on demand when needed. Just a small piece of javascript is downloaded when page loads.
What I want to achieve is this:
* A small i... | 2015/10/07 | [
"https://Stackoverflow.com/questions/33001985",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4886214/"
] | The solution to this problem is two-fold:
1. First you need to understand [how code-splitting works in webpack](https://webpack.github.io/docs/code-splitting.html)
2. Secondly, you need to use something like the `CommonsChunkPlugin` to generate that shared bundle.
### Code Splitting
Before you start using webpack yo... | Here's the solution I came up with.
First, export these two functions to `window.*` -- you'll want them in the browser.
```
export function requireAsync(module) {
return new Promise((resolve, reject) => require(`bundle!./pages/${module}`)(resolve));
}
export function runAsync(moduleName, data={}) {
return re... |
33,001,985 | I have started using Webpack when developing usual web sites consisting of a number pages and of different pages types. I'm used to the RequireJs script loader that loads all dependencies on demand when needed. Just a small piece of javascript is downloaded when page loads.
What I want to achieve is this:
* A small i... | 2015/10/07 | [
"https://Stackoverflow.com/questions/33001985",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4886214/"
] | The solution to this problem is two-fold:
1. First you need to understand [how code-splitting works in webpack](https://webpack.github.io/docs/code-splitting.html)
2. Secondly, you need to use something like the `CommonsChunkPlugin` to generate that shared bundle.
### Code Splitting
Before you start using webpack yo... | I've recently travelled this same road, I'm working on optimizing my Webpack output since I think bundles are too big, HTTP2 can load js files in parallel and caching will be better with separate files, I was getting some dependencies duplicated in bundles, etc. While I got a solution working with Webpack 4 SplitChunks... |
33,001,985 | I have started using Webpack when developing usual web sites consisting of a number pages and of different pages types. I'm used to the RequireJs script loader that loads all dependencies on demand when needed. Just a small piece of javascript is downloaded when page loads.
What I want to achieve is this:
* A small i... | 2015/10/07 | [
"https://Stackoverflow.com/questions/33001985",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4886214/"
] | The solution to this problem is two-fold:
1. First you need to understand [how code-splitting works in webpack](https://webpack.github.io/docs/code-splitting.html)
2. Secondly, you need to use something like the `CommonsChunkPlugin` to generate that shared bundle.
### Code Splitting
Before you start using webpack yo... | Some time ago I made such a small "Proof of concept" to check how importlazy will work in IE11. I have to admit it works :)
After clicking the button, the code responsible for changing the background color of the page is loaded - [full example](https://github.com/tomik23/importlazy)
Js:
```
// polyfils for IE11
impor... |
510,152 | Quite often, the script I want to execute is not located in my current working directory and I don't really want to leave it.
Is it a good practice to run scripts (BASH, Perl etc.) from another directory? Will they usually find all the stuff they need to run properly?
If so, what is the best way to run a "distant" sc... | 2012/11/24 | [
"https://superuser.com/questions/510152",
"https://superuser.com",
"https://superuser.com/users/105968/"
] | sh /path/to/script will spawn a new shell and run she script independent of your current shell. The `source` (.) command will call all the commands in the script in the current shell. If the script happens to call `exit` for example, then you'll lose the current shell. Because of this it is usually safer to call script... | I'm not sure it works like this in linux, assuming it doesn't if no-ones suggested it. But instead of using ././ to go back directories. Can you use quotes to give it an absolute path? Maybe it doesn't give you access to the whole drive to even be able to do that actually come to think of it. |
510,152 | Quite often, the script I want to execute is not located in my current working directory and I don't really want to leave it.
Is it a good practice to run scripts (BASH, Perl etc.) from another directory? Will they usually find all the stuff they need to run properly?
If so, what is the best way to run a "distant" sc... | 2012/11/24 | [
"https://superuser.com/questions/510152",
"https://superuser.com",
"https://superuser.com/users/105968/"
] | Not sure why no one has suggested this one, but it's super easy! I've Googled a few times and couldn't find this exact answer I'm giving so I'd thought I'd share. IMO, this but the best solution, also the easiest one, for me anyway, however others may feel and do things differently.
```
# Place this somewhere in your... | Ancient question, but a timeless one.
The solution I've consistently seen is to have a `$HOME/bin` directory and put it first in `$PATH` (via `~/.bashrc` if it isn't already there; on some systems `~/bin` is first in `$PATH` by default). Dropping scripts in there for execution or symlinks to scripts/executables elsewh... |
510,152 | Quite often, the script I want to execute is not located in my current working directory and I don't really want to leave it.
Is it a good practice to run scripts (BASH, Perl etc.) from another directory? Will they usually find all the stuff they need to run properly?
If so, what is the best way to run a "distant" sc... | 2012/11/24 | [
"https://superuser.com/questions/510152",
"https://superuser.com",
"https://superuser.com/users/105968/"
] | You can definitely do that (with the adjustments the others mentioned like `sudo sh /pathto/script.sh` or `./script.sh`). However, I do one of a few things to run them system wide to not worry about dirs and save me useless extra typing.
1) Symlink to `/usr/bin`
```
ln -s /home/username/Scripts/name.sh /usr/bin/name... | Ancient question, but a timeless one.
The solution I've consistently seen is to have a `$HOME/bin` directory and put it first in `$PATH` (via `~/.bashrc` if it isn't already there; on some systems `~/bin` is first in `$PATH` by default). Dropping scripts in there for execution or symlinks to scripts/executables elsewh... |
510,152 | Quite often, the script I want to execute is not located in my current working directory and I don't really want to leave it.
Is it a good practice to run scripts (BASH, Perl etc.) from another directory? Will they usually find all the stuff they need to run properly?
If so, what is the best way to run a "distant" sc... | 2012/11/24 | [
"https://superuser.com/questions/510152",
"https://superuser.com",
"https://superuser.com/users/105968/"
] | Say you want to run `./script` and the path is `/home/test/stuff/`
But the path you're currently in is `/home/test/public_html/a/`
Then you would need to do `../../stuff/./script`
Which goes back 2 folders, then into into the folder there and run the script. | It's better to modify your script to use its absolute path before addressing any relative files.
Of course for scripts we can do it conveniently and flexibly by keeping the [`dirname`](https://linux.die.net/man/1/dirname) of the script in a variable before-hand.
For example, change:
```
cat needed_file
```
to:
``... |
510,152 | Quite often, the script I want to execute is not located in my current working directory and I don't really want to leave it.
Is it a good practice to run scripts (BASH, Perl etc.) from another directory? Will they usually find all the stuff they need to run properly?
If so, what is the best way to run a "distant" sc... | 2012/11/24 | [
"https://superuser.com/questions/510152",
"https://superuser.com",
"https://superuser.com/users/105968/"
] | If you have scripts lying around that you need to run often, and they depend on their location for finding resources you can easily do this by just combining commands in an alias like this.
```
alias run-script="cd /home/user/path/to/script/ && bash script.sh"
```
This way you don't have to alter anything else to ma... | Ancient question, but a timeless one.
The solution I've consistently seen is to have a `$HOME/bin` directory and put it first in `$PATH` (via `~/.bashrc` if it isn't already there; on some systems `~/bin` is first in `$PATH` by default). Dropping scripts in there for execution or symlinks to scripts/executables elsewh... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.