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 |
|---|---|---|---|---|---|
4 | I am looking for a starting point for my project, preferably using popular systems (ones there is a lot of support for). I have an Arduino Uno, a Raspberry Pi, and a lot of willpower :) Anyone here built a project using the systems above?
Observation: I'd like to start with a simple line-following vehicle and build up... | 2012/10/23 | [
"https://robotics.stackexchange.com/questions/4",
"https://robotics.stackexchange.com",
"https://robotics.stackexchange.com/users/32/"
] | The Arduino is really an AVR Atmega328p. The Arduino is a fine off-the-shelf implementation of this microcontroller, but if you make many of them, you can buy the chip for less than $3 each in bulk, and it requires very little circuitry to run on its own -- a crystal and a couple of capacitors to run at 20 Mhz, or not ... | I would suggest using lower end Atmel AVRs for beginning robotics projects. An AVR can take a lot of abuse and can sink and source more current without burning out than the PIC microcontrollers I have used.
If you are going to be building multiple projects, you should consider investing in building your own breakout ... |
4 | I am looking for a starting point for my project, preferably using popular systems (ones there is a lot of support for). I have an Arduino Uno, a Raspberry Pi, and a lot of willpower :) Anyone here built a project using the systems above?
Observation: I'd like to start with a simple line-following vehicle and build up... | 2012/10/23 | [
"https://robotics.stackexchange.com/questions/4",
"https://robotics.stackexchange.com",
"https://robotics.stackexchange.com/users/32/"
] | It really depends on the project.
For a line follower robot ( in your case ), using the Atmel's AVR series is the best choice. Specially ATMEGA16 or even ATMEGA32.
Because the line-follower is a small project and the Arduino is too much for it. And the other advantage of Atmega16 is that it is cheap. If it is broken... | If you want to go further than using microcontrollers you could run ROS on you [Raspberry Pi](http://www.ros.org/wiki/ROSberryPi/Setting%20up%20ROS%20on%20RaspberryPi).
I have build several robots and a couple of other projects using a [RoboCard](http://robocard.dk/) (site in Danish, but can [be translated](http://tra... |
4 | I am looking for a starting point for my project, preferably using popular systems (ones there is a lot of support for). I have an Arduino Uno, a Raspberry Pi, and a lot of willpower :) Anyone here built a project using the systems above?
Observation: I'd like to start with a simple line-following vehicle and build up... | 2012/10/23 | [
"https://robotics.stackexchange.com/questions/4",
"https://robotics.stackexchange.com",
"https://robotics.stackexchange.com/users/32/"
] | You should use an ARM. Then you can run full linux or android and have access to powerful libraries, high-level functional languages, and a package manager and community. You can use gcc or LLVM, and a modern debugger like gdb.
ARMs used to be too expensive and/or too big, but nowadays you can get an ARM for $5 that's... | If you want to go further than using microcontrollers you could run ROS on you [Raspberry Pi](http://www.ros.org/wiki/ROSberryPi/Setting%20up%20ROS%20on%20RaspberryPi).
I have build several robots and a couple of other projects using a [RoboCard](http://robocard.dk/) (site in Danish, but can [be translated](http://tra... |
4 | I am looking for a starting point for my project, preferably using popular systems (ones there is a lot of support for). I have an Arduino Uno, a Raspberry Pi, and a lot of willpower :) Anyone here built a project using the systems above?
Observation: I'd like to start with a simple line-following vehicle and build up... | 2012/10/23 | [
"https://robotics.stackexchange.com/questions/4",
"https://robotics.stackexchange.com",
"https://robotics.stackexchange.com/users/32/"
] | The Arduino is really an AVR Atmega328p. The Arduino is a fine off-the-shelf implementation of this microcontroller, but if you make many of them, you can buy the chip for less than $3 each in bulk, and it requires very little circuitry to run on its own -- a crystal and a couple of capacitors to run at 20 Mhz, or not ... | It really depends on the project.
For a line follower robot ( in your case ), using the Atmel's AVR series is the best choice. Specially ATMEGA16 or even ATMEGA32.
Because the line-follower is a small project and the Arduino is too much for it. And the other advantage of Atmega16 is that it is cheap. If it is broken... |
4 | I am looking for a starting point for my project, preferably using popular systems (ones there is a lot of support for). I have an Arduino Uno, a Raspberry Pi, and a lot of willpower :) Anyone here built a project using the systems above?
Observation: I'd like to start with a simple line-following vehicle and build up... | 2012/10/23 | [
"https://robotics.stackexchange.com/questions/4",
"https://robotics.stackexchange.com",
"https://robotics.stackexchange.com/users/32/"
] | The Arduino is really an AVR Atmega328p. The Arduino is a fine off-the-shelf implementation of this microcontroller, but if you make many of them, you can buy the chip for less than $3 each in bulk, and it requires very little circuitry to run on its own -- a crystal and a couple of capacitors to run at 20 Mhz, or not ... | If you want a line-following robot, then something similar to an [m3pi](http://mbed.org/cookbook/m3pi) would be achievable. Photo-transistors seem to be very effective with a black-on-white track.
As for a microcontroller, Mario Markarian is probably right, it is down to personal preference and the project you are wor... |
4 | I am looking for a starting point for my project, preferably using popular systems (ones there is a lot of support for). I have an Arduino Uno, a Raspberry Pi, and a lot of willpower :) Anyone here built a project using the systems above?
Observation: I'd like to start with a simple line-following vehicle and build up... | 2012/10/23 | [
"https://robotics.stackexchange.com/questions/4",
"https://robotics.stackexchange.com",
"https://robotics.stackexchange.com/users/32/"
] | I would suggest using lower end Atmel AVRs for beginning robotics projects. An AVR can take a lot of abuse and can sink and source more current without burning out than the PIC microcontrollers I have used.
If you are going to be building multiple projects, you should consider investing in building your own breakout ... | If you want to go further than using microcontrollers you could run ROS on you [Raspberry Pi](http://www.ros.org/wiki/ROSberryPi/Setting%20up%20ROS%20on%20RaspberryPi).
I have build several robots and a couple of other projects using a [RoboCard](http://robocard.dk/) (site in Danish, but can [be translated](http://tra... |
4 | I am looking for a starting point for my project, preferably using popular systems (ones there is a lot of support for). I have an Arduino Uno, a Raspberry Pi, and a lot of willpower :) Anyone here built a project using the systems above?
Observation: I'd like to start with a simple line-following vehicle and build up... | 2012/10/23 | [
"https://robotics.stackexchange.com/questions/4",
"https://robotics.stackexchange.com",
"https://robotics.stackexchange.com/users/32/"
] | I built a line following robot with an Arduino before. It was really simple to do and all we used were color sensors on the bottom inputted in the Arduino, and then of course some motors for the wheels.
But using an Arduino allowed us to have plenty of room for other components we wanted to add on to make our robot d... | If you want to go further than using microcontrollers you could run ROS on you [Raspberry Pi](http://www.ros.org/wiki/ROSberryPi/Setting%20up%20ROS%20on%20RaspberryPi).
I have build several robots and a couple of other projects using a [RoboCard](http://robocard.dk/) (site in Danish, but can [be translated](http://tra... |
56,490,250 | I'm trying to conditionally hide a `DatePicker` in SwiftUI. However, I'm having any issue with mismatched types:
```
var datePicker = DatePicker($datePickerDate)
if self.showDatePicker {
datePicker = datePicker.hidden()
}
```
In this case, `datePicker` is a `DatePicker<EmptyView>` type but `datePicker.hidden()` ... | 2019/06/07 | [
"https://Stackoverflow.com/questions/56490250",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3814799/"
] | Command-click the view in question and select the Make Conditional option in Beta 5. I did this on one of my views (LiftsCollectionView), and it generated the following:
```
if suggestedLayout.size.height > 150 {
LiftsCollectionView()
} else {
EmptyView()
}
``` | The following custom modifier works as .hidden() does by both hiding the view and disabling interaction with it.
ViewModifier and View extension func -
```swift
import SwiftUI
fileprivate struct HiddenIfModifier: ViewModifier {
var isHidden: Bool
init(condition: Bool) {
self.isHidden = condition
}
func... |
56,490,250 | I'm trying to conditionally hide a `DatePicker` in SwiftUI. However, I'm having any issue with mismatched types:
```
var datePicker = DatePicker($datePickerDate)
if self.showDatePicker {
datePicker = datePicker.hidden()
}
```
In this case, `datePicker` is a `DatePicker<EmptyView>` type but `datePicker.hidden()` ... | 2019/06/07 | [
"https://Stackoverflow.com/questions/56490250",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3814799/"
] | Edit Nov 4 2021
---------------
I now prefer another approach over the one in my original answer (below):
There are two possible solutions depending on if you want to keep the original space occupied or make the other views take the space of the one that's hidden.
### Keep the space
```swift
DatePicker("Choose date... | You also have the `opacity` modifier on any `View`:
```
ActivityIndicator(tint: .black)
.opacity(self.isLoading ? 1.0 : 0.0)
``` |
56,490,250 | I'm trying to conditionally hide a `DatePicker` in SwiftUI. However, I'm having any issue with mismatched types:
```
var datePicker = DatePicker($datePickerDate)
if self.showDatePicker {
datePicker = datePicker.hidden()
}
```
In this case, `datePicker` is a `DatePicker<EmptyView>` type but `datePicker.hidden()` ... | 2019/06/07 | [
"https://Stackoverflow.com/questions/56490250",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3814799/"
] | I had the same problem, and I solved it in the following way:
Note: I use **binding** to hide and/or show dynamically.
1 - Create Modifier
```swift
struct HiddenModifier: ViewModifier{
var isHide:Binding<Bool>
func body(content: Content) -> some View {
if isHide.wrappedValue{
content
... | The bad part of the above solution `.isHidden(true, remove: true)` is onAppear callback will not be called when `remove = true`.
`.opacity(isHidden ? 0 : 1)` is definitely the right way. |
56,490,250 | I'm trying to conditionally hide a `DatePicker` in SwiftUI. However, I'm having any issue with mismatched types:
```
var datePicker = DatePicker($datePickerDate)
if self.showDatePicker {
datePicker = datePicker.hidden()
}
```
In this case, `datePicker` is a `DatePicker<EmptyView>` type but `datePicker.hidden()` ... | 2019/06/07 | [
"https://Stackoverflow.com/questions/56490250",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3814799/"
] | ✅ The correct and Simplest Way:
===============================
You can set the alpha instead, this will preserve the layout space of the view too and does not force you to add dummy views like the other answers:
```
.opacity(isHidden ? 0 : 1)
```
### Demo
[](https://i.s... | The bad part of the above solution `.isHidden(true, remove: true)` is onAppear callback will not be called when `remove = true`.
`.opacity(isHidden ? 0 : 1)` is definitely the right way. |
56,490,250 | I'm trying to conditionally hide a `DatePicker` in SwiftUI. However, I'm having any issue with mismatched types:
```
var datePicker = DatePicker($datePickerDate)
if self.showDatePicker {
datePicker = datePicker.hidden()
}
```
In this case, `datePicker` is a `DatePicker<EmptyView>` type but `datePicker.hidden()` ... | 2019/06/07 | [
"https://Stackoverflow.com/questions/56490250",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3814799/"
] | The simplest and most common way to hide a view is like the following:
```
struct ContentView: View {
@State private var showText = true
var body: some View {
VStack {
Button("Toggle text") {
showText.toggle()
}
if showText {
Text("H... | Here is the simple way to Show/Hide view in SwiftUI.
1. Add `@State` variable:
```
@State var showLogo = false
```
2. Add condition like below:
```
VStack {
if showLogo {
Image(systemName: "house.fill")
.resizable()
.frame(width: 100, height: 100, alignment: .center)
... |
56,490,250 | I'm trying to conditionally hide a `DatePicker` in SwiftUI. However, I'm having any issue with mismatched types:
```
var datePicker = DatePicker($datePickerDate)
if self.showDatePicker {
datePicker = datePicker.hidden()
}
```
In this case, `datePicker` is a `DatePicker<EmptyView>` type but `datePicker.hidden()` ... | 2019/06/07 | [
"https://Stackoverflow.com/questions/56490250",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3814799/"
] | Edit Nov 4 2021
---------------
I now prefer another approach over the one in my original answer (below):
There are two possible solutions depending on if you want to keep the original space occupied or make the other views take the space of the one that's hidden.
### Keep the space
```swift
DatePicker("Choose date... | I had the same problem, and I solved it in the following way:
Note: I use **binding** to hide and/or show dynamically.
1 - Create Modifier
```swift
struct HiddenModifier: ViewModifier{
var isHide:Binding<Bool>
func body(content: Content) -> some View {
if isHide.wrappedValue{
content
... |
56,490,250 | I'm trying to conditionally hide a `DatePicker` in SwiftUI. However, I'm having any issue with mismatched types:
```
var datePicker = DatePicker($datePickerDate)
if self.showDatePicker {
datePicker = datePicker.hidden()
}
```
In this case, `datePicker` is a `DatePicker<EmptyView>` type but `datePicker.hidden()` ... | 2019/06/07 | [
"https://Stackoverflow.com/questions/56490250",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3814799/"
] | Here is the simple way to Show/Hide view in SwiftUI.
1. Add `@State` variable:
```
@State var showLogo = false
```
2. Add condition like below:
```
VStack {
if showLogo {
Image(systemName: "house.fill")
.resizable()
.frame(width: 100, height: 100, alignment: .center)
... | Command-click the view in question and select the Make Conditional option in Beta 5. I did this on one of my views (LiftsCollectionView), and it generated the following:
```
if suggestedLayout.size.height > 150 {
LiftsCollectionView()
} else {
EmptyView()
}
``` |
56,490,250 | I'm trying to conditionally hide a `DatePicker` in SwiftUI. However, I'm having any issue with mismatched types:
```
var datePicker = DatePicker($datePickerDate)
if self.showDatePicker {
datePicker = datePicker.hidden()
}
```
In this case, `datePicker` is a `DatePicker<EmptyView>` type but `datePicker.hidden()` ... | 2019/06/07 | [
"https://Stackoverflow.com/questions/56490250",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3814799/"
] | ✅ The correct and Simplest Way:
===============================
You can set the alpha instead, this will preserve the layout space of the view too and does not force you to add dummy views like the other answers:
```
.opacity(isHidden ? 0 : 1)
```
### Demo
[](https://i.s... | Here is the simple way to Show/Hide view in SwiftUI.
1. Add `@State` variable:
```
@State var showLogo = false
```
2. Add condition like below:
```
VStack {
if showLogo {
Image(systemName: "house.fill")
.resizable()
.frame(width: 100, height: 100, alignment: .center)
... |
56,490,250 | I'm trying to conditionally hide a `DatePicker` in SwiftUI. However, I'm having any issue with mismatched types:
```
var datePicker = DatePicker($datePickerDate)
if self.showDatePicker {
datePicker = datePicker.hidden()
}
```
In this case, `datePicker` is a `DatePicker<EmptyView>` type but `datePicker.hidden()` ... | 2019/06/07 | [
"https://Stackoverflow.com/questions/56490250",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3814799/"
] | ✅ The correct and Simplest Way:
===============================
You can set the alpha instead, this will preserve the layout space of the view too and does not force you to add dummy views like the other answers:
```
.opacity(isHidden ? 0 : 1)
```
### Demo
[](https://i.s... | The following also works even without a placeholder view or calling hidden (iOS13.1 and Swift 5)
```
struct Foo: View {
@State var condition: Bool
var body: some View {
if self.condition {
Text("Hello")
}
}
}
```
It's hard to know exactly without peeking at the `@ViewBuilder`... |
56,490,250 | I'm trying to conditionally hide a `DatePicker` in SwiftUI. However, I'm having any issue with mismatched types:
```
var datePicker = DatePicker($datePickerDate)
if self.showDatePicker {
datePicker = datePicker.hidden()
}
```
In this case, `datePicker` is a `DatePicker<EmptyView>` type but `datePicker.hidden()` ... | 2019/06/07 | [
"https://Stackoverflow.com/questions/56490250",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3814799/"
] | Rather than dynamically setting a variable and using it in my view, I found that I was able to hide or show the date picker this way:
```
struct ContentView : View {
@State var showDatePicker = true
@State var datePickerDate: Date = Date()
var body: some View {
VStack {
if self.showDat... | The bad part of the above solution `.isHidden(true, remove: true)` is onAppear callback will not be called when `remove = true`.
`.opacity(isHidden ? 0 : 1)` is definitely the right way. |
220,614 | The most basic code(i guess so) to find all the factors of a number
Note:factors include 1 and the number itself
Here's the code:
```
c=0
x=int(input("Enter number:"))
for i in range(1,x+1):
if x%i==0:
print("factor",c+1,":",i)
c=c+1
print("Total number of factors:",c)
```
Please make this code... | 2019/05/21 | [
"https://codereview.stackexchange.com/questions/220614",
"https://codereview.stackexchange.com",
"https://codereview.stackexchange.com/users/200977/"
] | Just to have a more readable (than the [answer](https://codereview.stackexchange.com/a/220618/98493) by [@Justin](https://codereview.stackexchange.com/users/195671/justin)) and complete (than the [answer](https://codereview.stackexchange.com/a/220617/98493) by [@Sedsarq](https://codereview.stackexchange.com/users/20116... | Divisors come in pairs. Since 2\*50 = 100, both 2 and 50 are divisors to 100. You don't need to search for both of these, because once you've found that 100 is divisible by 2, you can do 100 / 2 to find 50, which is the other divisor. So for every divisor you find, use division to find its "partner" at the same time. T... |
220,614 | The most basic code(i guess so) to find all the factors of a number
Note:factors include 1 and the number itself
Here's the code:
```
c=0
x=int(input("Enter number:"))
for i in range(1,x+1):
if x%i==0:
print("factor",c+1,":",i)
c=c+1
print("Total number of factors:",c)
```
Please make this code... | 2019/05/21 | [
"https://codereview.stackexchange.com/questions/220614",
"https://codereview.stackexchange.com",
"https://codereview.stackexchange.com/users/200977/"
] | Divisors come in pairs. Since 2\*50 = 100, both 2 and 50 are divisors to 100. You don't need to search for both of these, because once you've found that 100 is divisible by 2, you can do 100 / 2 to find 50, which is the other divisor. So for every divisor you find, use division to find its "partner" at the same time. T... | Since you say in a comment that you may need to find the divisors of a number \$n\$ up to \$10^{60}\$, trial division is not practical, even if performed only up to \$\sqrt n\$ . The only option is to find the prime factorisation and then reconstruct the divisors from the prime factorisation.
There are quite a few [al... |
220,614 | The most basic code(i guess so) to find all the factors of a number
Note:factors include 1 and the number itself
Here's the code:
```
c=0
x=int(input("Enter number:"))
for i in range(1,x+1):
if x%i==0:
print("factor",c+1,":",i)
c=c+1
print("Total number of factors:",c)
```
Please make this code... | 2019/05/21 | [
"https://codereview.stackexchange.com/questions/220614",
"https://codereview.stackexchange.com",
"https://codereview.stackexchange.com/users/200977/"
] | Just to have a more readable (than the [answer](https://codereview.stackexchange.com/a/220618/98493) by [@Justin](https://codereview.stackexchange.com/users/195671/justin)) and complete (than the [answer](https://codereview.stackexchange.com/a/220617/98493) by [@Sedsarq](https://codereview.stackexchange.com/users/20116... | All answers provided are great and offer suggestions with a complexity in `O(sqrt(n))` instead of the original `O(n)` by using the trick to stop at `sqrt(n)`.
On big inputs, we can go for an even faster solution by using the decomposition in prime numbers:
* the decomposition in prime numbers can be computed in a tim... |
220,614 | The most basic code(i guess so) to find all the factors of a number
Note:factors include 1 and the number itself
Here's the code:
```
c=0
x=int(input("Enter number:"))
for i in range(1,x+1):
if x%i==0:
print("factor",c+1,":",i)
c=c+1
print("Total number of factors:",c)
```
Please make this code... | 2019/05/21 | [
"https://codereview.stackexchange.com/questions/220614",
"https://codereview.stackexchange.com",
"https://codereview.stackexchange.com/users/200977/"
] | Just to have a more readable (than the [answer](https://codereview.stackexchange.com/a/220618/98493) by [@Justin](https://codereview.stackexchange.com/users/195671/justin)) and complete (than the [answer](https://codereview.stackexchange.com/a/220617/98493) by [@Sedsarq](https://codereview.stackexchange.com/users/20116... | Since you say in a comment that you may need to find the divisors of a number \$n\$ up to \$10^{60}\$, trial division is not practical, even if performed only up to \$\sqrt n\$ . The only option is to find the prime factorisation and then reconstruct the divisors from the prime factorisation.
There are quite a few [al... |
220,614 | The most basic code(i guess so) to find all the factors of a number
Note:factors include 1 and the number itself
Here's the code:
```
c=0
x=int(input("Enter number:"))
for i in range(1,x+1):
if x%i==0:
print("factor",c+1,":",i)
c=c+1
print("Total number of factors:",c)
```
Please make this code... | 2019/05/21 | [
"https://codereview.stackexchange.com/questions/220614",
"https://codereview.stackexchange.com",
"https://codereview.stackexchange.com/users/200977/"
] | All answers provided are great and offer suggestions with a complexity in `O(sqrt(n))` instead of the original `O(n)` by using the trick to stop at `sqrt(n)`.
On big inputs, we can go for an even faster solution by using the decomposition in prime numbers:
* the decomposition in prime numbers can be computed in a tim... | Since you say in a comment that you may need to find the divisors of a number \$n\$ up to \$10^{60}\$, trial division is not practical, even if performed only up to \$\sqrt n\$ . The only option is to find the prime factorisation and then reconstruct the divisors from the prime factorisation.
There are quite a few [al... |
41,463 | I have an arduino Uno and nodemcu development board.[](https://i.stack.imgur.com/vsM3q.jpg)
I have an OV7076 camera and used with arduino UNO. It worked flawlessly with it and the code used is provided in the [Instructables tutorial][2] named as FromC... | 2017/07/10 | [
"https://arduino.stackexchange.com/questions/41463",
"https://arduino.stackexchange.com",
"https://arduino.stackexchange.com/users/35205/"
] | Camera doesn't send data via Analog to Arduino.
A5 and A4 are I2C bus beside Analog.
NodeMCU has Software I2C protocol bus too, You can use D1 (GPIO 5) as CLK, and D2 (GPIO 4) as SDA.
see : <https://github.com/esp8266/Arduino/blob/master/doc/libraries.rst#i2c-wire-library> | I am suggesting you to buy NodeMCU because it is having inbuilt WIFI, you can connect NodeMcu to internet without much effort compare to connecting UNO to internet, and the best thing is NodeMCU is arduino compatible you can do all possible stuff that can be done with UNO. We can also program NodeMCU in 'C' language us... |
69,069,482 | I am getting time in this format like startTime="1:00 am" and endTime="12:00 pm" how can to check if endTime>startTime . I'm using react-timekeeper component | 2021/09/06 | [
"https://Stackoverflow.com/questions/69069482",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15682271/"
] | Well you need to check the date somehow, if you want the date to be a part of the calculation.
There might be a nicer approach, but an easy one is to just loop the range and compare the date.
```
Sub Differences()
Dim vRng As Range, r As Variant, vDate As String
Set vRng = Range("B2", Range("B2").End(xlDown))
For E... | This gets the intended results. I am assuming that the first row with data is A1, if it's not then adjust accordingly.
```
Sub test()
Dim i As Long
Dim lastRow As Long
lastRow = Cells(Rows.Count, 1).End(xlUp).Row
For i = 1 To lastRow
If i = 1 Then
Cells(i, 5) = Cells(i, 2)
... |
4,173,530 | What is the best way to validate a cost/price input by a user, validation rules below:
* Examples of formats allowed .23, .2, 1.23, 0.25, 5, 6.3 (maximum of two digits after decimal point)
* Minimum value of 0.01
* Maximum value of 9.99 | 2010/11/13 | [
"https://Stackoverflow.com/questions/4173530",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/489978/"
] | ### Check the price and verify the format
```
#rails 3
validates :price, :format => { :with => /\A\d+(?:\.\d{0,2})?\z/ }, :numericality => {:greater_than => 0, :less_than => 10}
#rails 2
validates_numericality_of :price, :greater_than => 0, :less_than => 10
validates_format_of :price, :with => /\A\d+(?:\.\d{0... | For client side validations you can use a jQuery plugin like [this one](http://docs.jquery.com/Plugins/validation) that allows you to define different valid formats for a given input.
For server side validations and according to this [question/answer](https://stackoverflow.com/questions/1019939/ruby-on-rails-best-meth... |
4,173,530 | What is the best way to validate a cost/price input by a user, validation rules below:
* Examples of formats allowed .23, .2, 1.23, 0.25, 5, 6.3 (maximum of two digits after decimal point)
* Minimum value of 0.01
* Maximum value of 9.99 | 2010/11/13 | [
"https://Stackoverflow.com/questions/4173530",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/489978/"
] | ### Check the price and verify the format
```
#rails 3
validates :price, :format => { :with => /\A\d+(?:\.\d{0,2})?\z/ }, :numericality => {:greater_than => 0, :less_than => 10}
#rails 2
validates_numericality_of :price, :greater_than => 0, :less_than => 10
validates_format_of :price, :with => /\A\d+(?:\.\d{0... | You can build custom validations.Lets say, for example the second case:
```
validate :price_has_to_be_greater_than_minimum
def price_has_to_be_greater_than_minimum
errors.add(:price, "price has to be greater than 0.01") if
!price.blank? and price > 0.01
end
```
More on this, in the Rails Guides, [here](http://g... |
23,822 | I'd like to stay in the EU for some time, maybe get a residence permit if possible. The question is what are my healthcare options. As far as I know, citizens of EU countries can get public healthcare coverage. Can I get this by paying for it? Are there any alternatives for people with a residence permit yet without ci... | 2022/01/31 | [
"https://expatriates.stackexchange.com/questions/23822",
"https://expatriates.stackexchange.com",
"https://expatriates.stackexchange.com/users/24573/"
] | That's not exactly the way it works, health insurance is typically based on residence or (mandatory) contributions. I have varying level of familiarity with the healthcare system in half-a-dozen EU countries and I do not know a single one that would offer free coverage to citizens *qua* citizens.
In some cases, living... | Yes - you can get on local health insurance in some countries in the EU. It is managed on a country-by-country basis. I know Switzerland, for one, would require foreign nationals who get residency to purchase a local health insurance plan (<https://www.bag.admin.ch/bag/en/home/versicherungen/krankenversicherung.html>).... |
14,520 | When I am pedaling hard and shift to a larger sprocket, the shift is not smooth or sometimes doesn't happen at all. Sometimes even double up-shifts don't work. There is no problem shifting when I test for it without riding. What could be the issue? | 2013/02/18 | [
"https://bicycles.stackexchange.com/questions/14520",
"https://bicycles.stackexchange.com",
"https://bicycles.stackexchange.com/users/3925/"
] | On ground, after shifting, look at your bike from the back. The sprocket into which you have attempted to shift, and the pulley in the derailleur should be aligned. If the pulley is more to the right than sprocket, you need to get it aligned to the sprocket, by tightening in the screw on shifter or on the rear deraille... | That is perfectly normal because when you are pedaling hard the chain is under tension and resists being moved by the derailleur. Before shifting to a higher gear slow your pedaling slightly. |
14,520 | When I am pedaling hard and shift to a larger sprocket, the shift is not smooth or sometimes doesn't happen at all. Sometimes even double up-shifts don't work. There is no problem shifting when I test for it without riding. What could be the issue? | 2013/02/18 | [
"https://bicycles.stackexchange.com/questions/14520",
"https://bicycles.stackexchange.com",
"https://bicycles.stackexchange.com/users/3925/"
] | After a lot of tinkering and research I found the derailleur was in the need of [indexing adjustment](http://sheldonbrown.com/derailer-adjustment.html). Just twisted the barrel adjuster anticlockwise a little and the gears are shifting promptly now. The above link advises that indexing adjustment is the most frequently... | That is perfectly normal because when you are pedaling hard the chain is under tension and resists being moved by the derailleur. Before shifting to a higher gear slow your pedaling slightly. |
316,749 | >
> It is now clear that no such creatures as vampires have been seen and none \_\_\_ in the world.
>
>
> A. was found
>
>
> B. have been found
>
>
>
I chose B, but the answer is A. I don't see the necessity to use the past tense here. Besides, allowing for that "have been seen" is already mentioned, I think i... | 2022/06/06 | [
"https://ell.stackexchange.com/questions/316749",
"https://ell.stackexchange.com",
"https://ell.stackexchange.com/users/152414/"
] | "Creatures" is plural, so "was" cannot be used in the sentence. Therefore the answer is B. It means that no creatures such as vampires were found from the past all the way to the present. | There are two issues here: tense and number.
The preceding clause ("that no such creatures as vampires have been seen") is in the present perfect tense, and, as Kate Bunting notes in a comment, there does not seem to be any reason to use a different tense for the current clause. Therefore, answer choice B seems better... |
22,535,102 | This is my code:
```
XmlTextReader reader = new XmlTextReader(xmlPath);
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(reader);
XmlNode root = xmlDoc.DocumentElement;
XmlNode node = root.SelectSingleNode("marketingid");
```
XML that works:
```
<confirmsubmit>
<marketingid>-1</marketingid>
</confirmsubmit>... | 2014/03/20 | [
"https://Stackoverflow.com/questions/22535102",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2338687/"
] | You need to add a XmlNamespaceManager instance in the game, as shown in this example from the [documentation](https://msdn.microsoft.com/en-us/library/4bektfx9(v=vs.110).aspx):
>
>
> ```
> public class Sample
> {
> public static void Main()
> {
>
> XmlDocument doc = new XmlDocument();
> doc.Load... | `xmlns` attribute is used at XHTML and defines namespace for a document. You can parse it like:
```
XDocument xdoc = XDocument.Load(xmlPath);
var attrib = xdoc.Root.Attribute("xmlns").Value;
``` |
22,535,102 | This is my code:
```
XmlTextReader reader = new XmlTextReader(xmlPath);
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(reader);
XmlNode root = xmlDoc.DocumentElement;
XmlNode node = root.SelectSingleNode("marketingid");
```
XML that works:
```
<confirmsubmit>
<marketingid>-1</marketingid>
</confirmsubmit>... | 2014/03/20 | [
"https://Stackoverflow.com/questions/22535102",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2338687/"
] | Here is how to do it from LINQ to XML. Short and simple
```
const string xml = @"<confirmsubmit xmlns='http:....'>
<marketingid>-1</marketingid>
</confirmsubmit>";
XElement element = XElement.Parse(xml);
var requestedElement = element.Elements().FirstOrDefault(x => x.Name.L... | `xmlns` attribute is used at XHTML and defines namespace for a document. You can parse it like:
```
XDocument xdoc = XDocument.Load(xmlPath);
var attrib = xdoc.Root.Attribute("xmlns").Value;
``` |
22,535,102 | This is my code:
```
XmlTextReader reader = new XmlTextReader(xmlPath);
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(reader);
XmlNode root = xmlDoc.DocumentElement;
XmlNode node = root.SelectSingleNode("marketingid");
```
XML that works:
```
<confirmsubmit>
<marketingid>-1</marketingid>
</confirmsubmit>... | 2014/03/20 | [
"https://Stackoverflow.com/questions/22535102",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2338687/"
] | You need to add a XmlNamespaceManager instance in the game, as shown in this example from the [documentation](https://msdn.microsoft.com/en-us/library/4bektfx9(v=vs.110).aspx):
>
>
> ```
> public class Sample
> {
> public static void Main()
> {
>
> XmlDocument doc = new XmlDocument();
> doc.Load... | Here is how to do it from LINQ to XML. Short and simple
```
const string xml = @"<confirmsubmit xmlns='http:....'>
<marketingid>-1</marketingid>
</confirmsubmit>";
XElement element = XElement.Parse(xml);
var requestedElement = element.Elements().FirstOrDefault(x => x.Name.L... |
9,786,515 | I'm not having much success when attempting building `pgmagick` on OS X Lion with XCode 4.3.1.
I've installed both ImageMagick and GraphicsMagick, along side boost, using the following commands (via homebrew):
```
$ brew install graphicsmagick --with-magick-plus-plus
$ brew install imagemagick --with-magick-plus-plu... | 2012/03/20 | [
"https://Stackoverflow.com/questions/9786515",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30478/"
] | The boost\_python lib inside /usr/local/lib/ is named after libboost\_python-mt.a and libboost\_python-mt.dylib, since the default compiling is w/ multi-threads supporting enabled.
Grep boost\_lib="boost\_python" under ELSE condition in setup.py and replace it w/ boost\_lib="boost\_python-mt", will fix the "not found"... | Does setting `DYLD_FALLBACK_LIBRARY_PATH=/usr/local/lib` in the environment help before the build
e.g
```
$ export DYLD_FALLBACK_LIBRARY_PATH=/usr/local/lib
$ hg clone https://bitbucket.org/hhatto/pgmagick/src
$ cd pgmagick
$ python setup.py build
``` |
9,786,515 | I'm not having much success when attempting building `pgmagick` on OS X Lion with XCode 4.3.1.
I've installed both ImageMagick and GraphicsMagick, along side boost, using the following commands (via homebrew):
```
$ brew install graphicsmagick --with-magick-plus-plus
$ brew install imagemagick --with-magick-plus-plu... | 2012/03/20 | [
"https://Stackoverflow.com/questions/9786515",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30478/"
] | According to my own reproduction of this issue in brew 0.9 and OSX 10.6.8, the problem is `--with-thread-unsafe` isn't being honored by the current brew formula file. You can verify this by checking the formula with `brew edit boost` and seeing if the option appears within the contents of the formula.
Because of this,... | Does setting `DYLD_FALLBACK_LIBRARY_PATH=/usr/local/lib` in the environment help before the build
e.g
```
$ export DYLD_FALLBACK_LIBRARY_PATH=/usr/local/lib
$ hg clone https://bitbucket.org/hhatto/pgmagick/src
$ cd pgmagick
$ python setup.py build
``` |
9,786,515 | I'm not having much success when attempting building `pgmagick` on OS X Lion with XCode 4.3.1.
I've installed both ImageMagick and GraphicsMagick, along side boost, using the following commands (via homebrew):
```
$ brew install graphicsmagick --with-magick-plus-plus
$ brew install imagemagick --with-magick-plus-plu... | 2012/03/20 | [
"https://Stackoverflow.com/questions/9786515",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30478/"
] | Note that as of July 2014 the boost Python library is a separate homebrew package called `boost-python`.
```
5254f8f510fb30484f8fac8be3d38e388a4392e2
Author: Tim D. Smith <git@tim-smith.us>
Date: Sat Jul 19 15:37:25 2014 -0700
Split out Boost.Python
```
You need to install it separately to get the `libboost_p... | Does setting `DYLD_FALLBACK_LIBRARY_PATH=/usr/local/lib` in the environment help before the build
e.g
```
$ export DYLD_FALLBACK_LIBRARY_PATH=/usr/local/lib
$ hg clone https://bitbucket.org/hhatto/pgmagick/src
$ cd pgmagick
$ python setup.py build
``` |
9,786,515 | I'm not having much success when attempting building `pgmagick` on OS X Lion with XCode 4.3.1.
I've installed both ImageMagick and GraphicsMagick, along side boost, using the following commands (via homebrew):
```
$ brew install graphicsmagick --with-magick-plus-plus
$ brew install imagemagick --with-magick-plus-plu... | 2012/03/20 | [
"https://Stackoverflow.com/questions/9786515",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30478/"
] | According to my own reproduction of this issue in brew 0.9 and OSX 10.6.8, the problem is `--with-thread-unsafe` isn't being honored by the current brew formula file. You can verify this by checking the formula with `brew edit boost` and seeing if the option appears within the contents of the formula.
Because of this,... | The boost\_python lib inside /usr/local/lib/ is named after libboost\_python-mt.a and libboost\_python-mt.dylib, since the default compiling is w/ multi-threads supporting enabled.
Grep boost\_lib="boost\_python" under ELSE condition in setup.py and replace it w/ boost\_lib="boost\_python-mt", will fix the "not found"... |
9,786,515 | I'm not having much success when attempting building `pgmagick` on OS X Lion with XCode 4.3.1.
I've installed both ImageMagick and GraphicsMagick, along side boost, using the following commands (via homebrew):
```
$ brew install graphicsmagick --with-magick-plus-plus
$ brew install imagemagick --with-magick-plus-plu... | 2012/03/20 | [
"https://Stackoverflow.com/questions/9786515",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30478/"
] | The boost\_python lib inside /usr/local/lib/ is named after libboost\_python-mt.a and libboost\_python-mt.dylib, since the default compiling is w/ multi-threads supporting enabled.
Grep boost\_lib="boost\_python" under ELSE condition in setup.py and replace it w/ boost\_lib="boost\_python-mt", will fix the "not found"... | I've [submitted a pull request](https://github.com/mxcl/homebrew/pull/19722) to homebrew to build Boost with both mt and non mt (threaded and thread unsafe) binaries which are required to build pgmagick.
Turns out this is a rather common problem, until the patch is accepted, you can check out or use my formula for Bo... |
9,786,515 | I'm not having much success when attempting building `pgmagick` on OS X Lion with XCode 4.3.1.
I've installed both ImageMagick and GraphicsMagick, along side boost, using the following commands (via homebrew):
```
$ brew install graphicsmagick --with-magick-plus-plus
$ brew install imagemagick --with-magick-plus-plu... | 2012/03/20 | [
"https://Stackoverflow.com/questions/9786515",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30478/"
] | According to my own reproduction of this issue in brew 0.9 and OSX 10.6.8, the problem is `--with-thread-unsafe` isn't being honored by the current brew formula file. You can verify this by checking the formula with `brew edit boost` and seeing if the option appears within the contents of the formula.
Because of this,... | I've [submitted a pull request](https://github.com/mxcl/homebrew/pull/19722) to homebrew to build Boost with both mt and non mt (threaded and thread unsafe) binaries which are required to build pgmagick.
Turns out this is a rather common problem, until the patch is accepted, you can check out or use my formula for Bo... |
9,786,515 | I'm not having much success when attempting building `pgmagick` on OS X Lion with XCode 4.3.1.
I've installed both ImageMagick and GraphicsMagick, along side boost, using the following commands (via homebrew):
```
$ brew install graphicsmagick --with-magick-plus-plus
$ brew install imagemagick --with-magick-plus-plu... | 2012/03/20 | [
"https://Stackoverflow.com/questions/9786515",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30478/"
] | According to my own reproduction of this issue in brew 0.9 and OSX 10.6.8, the problem is `--with-thread-unsafe` isn't being honored by the current brew formula file. You can verify this by checking the formula with `brew edit boost` and seeing if the option appears within the contents of the formula.
Because of this,... | Note that as of July 2014 the boost Python library is a separate homebrew package called `boost-python`.
```
5254f8f510fb30484f8fac8be3d38e388a4392e2
Author: Tim D. Smith <git@tim-smith.us>
Date: Sat Jul 19 15:37:25 2014 -0700
Split out Boost.Python
```
You need to install it separately to get the `libboost_p... |
9,786,515 | I'm not having much success when attempting building `pgmagick` on OS X Lion with XCode 4.3.1.
I've installed both ImageMagick and GraphicsMagick, along side boost, using the following commands (via homebrew):
```
$ brew install graphicsmagick --with-magick-plus-plus
$ brew install imagemagick --with-magick-plus-plu... | 2012/03/20 | [
"https://Stackoverflow.com/questions/9786515",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30478/"
] | Note that as of July 2014 the boost Python library is a separate homebrew package called `boost-python`.
```
5254f8f510fb30484f8fac8be3d38e388a4392e2
Author: Tim D. Smith <git@tim-smith.us>
Date: Sat Jul 19 15:37:25 2014 -0700
Split out Boost.Python
```
You need to install it separately to get the `libboost_p... | I've [submitted a pull request](https://github.com/mxcl/homebrew/pull/19722) to homebrew to build Boost with both mt and non mt (threaded and thread unsafe) binaries which are required to build pgmagick.
Turns out this is a rather common problem, until the patch is accepted, you can check out or use my formula for Bo... |
17,506,647 | In my custom Wordpress theme I am trying to animate all my table "nodes" in as the page loads simultaneously.
I can get this animation to work by applying the animation to each element individually but since trying to automate this process the animation fades all my nodes in at the same time and I do not understand wh... | 2013/07/06 | [
"https://Stackoverflow.com/questions/17506647",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1020154/"
] | Use your brandy dandy `.fadeQueue()`: [working jsFiddle](http://jsfiddle.net/rARAW/)
```
$.fn.fadeQueue = function(){
$(this).fadeIn(function(){
if(!$(this).is(':last-child')) // making sure we are not done
$(this).next().fadeQueue();
});
}
```
This will wait for the callback of `.fadeIn(... | Probably not as elegant, but still works:
```
$(document).ready(function(){
$('.node').hide();
$('.node').each(function(index,elem){
setTimeout(function(){$(elem).fadeIn(1000);},1000*index);
});
});
```
[jsFiddle here](http://jsfiddle.net/nxjg2/) |
17,506,647 | In my custom Wordpress theme I am trying to animate all my table "nodes" in as the page loads simultaneously.
I can get this animation to work by applying the animation to each element individually but since trying to automate this process the animation fades all my nodes in at the same time and I do not understand wh... | 2013/07/06 | [
"https://Stackoverflow.com/questions/17506647",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1020154/"
] | Here's a generic plugin that will perform any animation you want, in sequence, on a jQuery collection of elements:
```
(function ($) {
$.fn.queueEach = function (func) {
var args = [].slice.call(arguments, 1); // array of remaining args
var els = this.get(); // copy of elements
... | Probably not as elegant, but still works:
```
$(document).ready(function(){
$('.node').hide();
$('.node').each(function(index,elem){
setTimeout(function(){$(elem).fadeIn(1000);},1000*index);
});
});
```
[jsFiddle here](http://jsfiddle.net/nxjg2/) |
51,512 | For some months, I'm renting an apartment in the Canary Islands. It looks like the plugs are not grounded. For example, when I connect my laptop, a ThinkPad T420si, then I feel an unpleasant sensation on my bare legs when connected to mains ([220V/50Hz](http://de.wikipedia.org/wiki/L%C3%A4nder%C3%BCbersicht_Steckertype... | 2014/10/12 | [
"https://diy.stackexchange.com/questions/51512",
"https://diy.stackexchange.com",
"https://diy.stackexchange.com/users/27184/"
] | This is not about grounding, or perhaps it is...
Lets start with your connectors: Do you have AC-connectors at your devices with or without grounding pin? Laptop psu may have a protective earth connection, a phone charger won't have one. I've never seen a phone charger with protective earth connection.
Both PSUs are ... | Steps to go through:
1. Turn off the power to an outlet that is causing you problems. (Fusebox/main switch)
2. Check the exterior of the outlet for presence of a metal grounding element/grounding pin/whatever you have over there.
3. Open the outlet, check to see if there's proper wiring: all three pins connected.
4. C... |
53,520,080 | I need to encrypt user names that i receive from an external partners SSO. This needs to be done because the user names are assigned to school children. But we still need to be able to track each individual to prevent abuse of our systems, so we have decided to encrypt the user names in our logs etc.
This way, a breach... | 2018/11/28 | [
"https://Stackoverflow.com/questions/53520080",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4149494/"
] | If you want a one-way function, you don't want encryption. You want hashing. The easiest thing to do is to use a hash like SHA-256. I recommend salting the username before hashing. In this case, I would probably pick a static salt like `edu.myschoolname:` and put that in front of the username. Then run that through SHA... | I think that PGP is a good Idea, but risk to make usernames hard to memorize, why not simply make a list of usernames composed with `user + OrderedNumbers` where user can be wichever word you want and oredered number is a 4-5 digit number ordered by birth date of childrens?
Once you have done this you only have to ke... |
206,136 | We know that a cat is able to endure, continue, or survive despite a near encounter with death or disaster because cats have nine lives (according to a common myth).
>
> Example:
> - Mr. Pickles has been missing for a few days, but I wouldn't worry about him. **He is a cat with nine lives.**
>
>
>
>
Does m... | 2019/04/19 | [
"https://ell.stackexchange.com/questions/206136",
"https://ell.stackexchange.com",
"https://ell.stackexchange.com/users/5652/"
] | It is in the past tense. This is a "[future in the past](https://www.englishpage.com/verbpage/futureinpast.html)" construction. The question is rhetorical. Leonard isn't looking for an answer, but he phrases his statement as a question. Changing it back to a statement gives:
>
> I told you I would be working nights.
... | It's not "would be doing", it's "would be sth".
`Working nights` is a idiom means the shift of working at night.
"Would" indicates that all the "L telling S about working nights thing" happened in the past, not this morning, it might be yesterday. |
3,028,475 | I'm having the following tables:
Table a
| Field | Type | Null | Key |
| --- | --- | --- | --- |
| bid | int(10) unsigned | YES | |
| cid | int(10) unsigned | YES | |
Table b
| Field | Type | Null |
| --- | --- | --- |
| bid | int(10) unsigned | NO |
| cid | int(10) unsigned | NO |
| data | int(10) unsigned | NO ... | 2010/06/12 | [
"https://Stackoverflow.com/questions/3028475",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/73299/"
] | No, that's pretty much it.
(I'd generally rephrase `ISNULL(a.bind)` as `a.bind IS NULL` for ANSI SQL compliance FWIW.) | Too old, but here is my 2 cents, it might be useful for someone:
```
ISNULL(a.cid, 0) = ISNULL(b.cid) AND ISNULL(a.bid, 0) = ISNULL(b.bid)
``` |
3,028,475 | I'm having the following tables:
Table a
| Field | Type | Null | Key |
| --- | --- | --- | --- |
| bid | int(10) unsigned | YES | |
| cid | int(10) unsigned | YES | |
Table b
| Field | Type | Null |
| --- | --- | --- |
| bid | int(10) unsigned | NO |
| cid | int(10) unsigned | NO |
| data | int(10) unsigned | NO ... | 2010/06/12 | [
"https://Stackoverflow.com/questions/3028475",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/73299/"
] | The ISNULL function is not actually ANSI compliant. Yes, you do need to check for nulls in both columns. Another way to write your query would be:
```
Select Distinct b.*
From b
Join a
On ( a.bid = b.bid Or ( a.bid Is Null And b.bid Is Null ) )
And ( a.cid = b.cid Or ( a.cid Is Null And b.cid I... | Too old, but here is my 2 cents, it might be useful for someone:
```
ISNULL(a.cid, 0) = ISNULL(b.cid) AND ISNULL(a.bid, 0) = ISNULL(b.bid)
``` |
627,683 | I've figured out that extracting a `.zip` you need the path to the directory as well when you are recursively looking through subdirectories. So how do you store the path?
This is nearly there but doesn't work properly when there is a space in the `{zip_file}`.
```
zip_dir=$PWD/$(basename "${zip_file}")
``` | 2015/05/24 | [
"https://askubuntu.com/questions/627683",
"https://askubuntu.com",
"https://askubuntu.com/users/323574/"
] | I created this from your other question as well. It took me a bit, but this is what I was able to come up with to create the folders based on the zip file name, removing the `.zip` from the folder name, then extracting the zip file into that folder.
```
#!/bin/bash
echo "Start folder create..."
find . -type f -iname ... | Edit: I must not have tested this correctly.
Generally you don't need quotes when doing a variable assignment, just when dereferencing a variable. When making an assignment you don't need to put quotes around a variable being dereferenced, but since the dereferencing happens in a sub shell, quotes are needed around th... |
60,583,052 | I was trying to test my code with fixed time. so I wrote something like this:
```rust
use std::time::{SystemTime, UNIX_EPOCH};
trait Clock {
fn now(&self) -> SystemTime;
}
trait MixInClock {
type Impl;
}
struct RealClock;
impl<T: MixInClock<Impl = RealClock>> Clock for T {
fn now(&self) -> SystemTime {
... | 2020/03/07 | [
"https://Stackoverflow.com/questions/60583052",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13025505/"
] | You ran into a [long-standing issue with Rust's coherence rules](https://github.com/rust-lang/rust/issues/20400). There are proposals how to resolve this, but the work has been postponed for now. Quoting [Jonas Schievink's most recent comment on the bug](https://github.com/rust-lang/rust/issues/20400#issuecomment-49320... | While Sven's answer is correct, that this is an issue with Rust's coherence rules, you can solve this problem by just generalizing your code a bit. In praticular, when you have two different types that should have different behavior but a similar interface, it's often useful to create a trait for that.
In this case, y... |
22,393,605 | how to get text from json without [" "] only text ,in android project
this is my json from url {"code":200,"lang":"en-ru","text":["Better late than never"]}
i need get text "text":["Better late than never"] without [" "] only text: Better late than never
myclass MAINACTIVITY
```
public class MainActivity extends Ac... | 2014/03/14 | [
"https://Stackoverflow.com/questions/22393605",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3413314/"
] | To uninstall the version of Typescript used by Visual Studio, use "add/remove programs" in Windows and remove "TypeScript for Visual Studio". It's installed as a program rather than an extension for VS (and as you've noticed, it doesn't use the NodeJs version). | The visual studio version of TypeScript does *not* depend on nodejs. It uses IE for compilation.
You can uninstall the nodejs version using `npm uninstall -g typescript` if you installed it previously (which you probably didn't).
And then simply install TS from : <http://www.microsoft.com/en-us/download/details.asp... |
20,710 | After around 15 minutes of playing Battlefield: Bad Company 2, my computer completely locks up with the game's image on screen and the last second of sound constantly looping. I have to hard restart the machine to get it to come back.
I'm not sure if this issue is isolated to BF:BC2 but it's the only game I've been pl... | 2011/04/23 | [
"https://gaming.stackexchange.com/questions/20710",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/-1/"
] | Your temps are mostly fine, maybe the CPU is a bit hot, if these are idle temperatures.
Seems like it's the RAM or the CPU.
GPU faults don't act up like that.
So, you setup an isolated stress test for each suspect.
**RAM:**
Download memtest86+ and install it on a medium and boot your system with it. I'd suggest ... | Here's the way that I would recommend you troubleshoot this:
1. Unplug all USB devices, with the exception of keyboard and mouse.
2. Update the video driver.
3. Update Windows via Windows update.
4. If all of the above fail, remove all the extra hardware that you aren't using from the computer (i.e. extra sound cards... |
20,710 | After around 15 minutes of playing Battlefield: Bad Company 2, my computer completely locks up with the game's image on screen and the last second of sound constantly looping. I have to hard restart the machine to get it to come back.
I'm not sure if this issue is isolated to BF:BC2 but it's the only game I've been pl... | 2011/04/23 | [
"https://gaming.stackexchange.com/questions/20710",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/-1/"
] | Your temps are mostly fine, maybe the CPU is a bit hot, if these are idle temperatures.
Seems like it's the RAM or the CPU.
GPU faults don't act up like that.
So, you setup an isolated stress test for each suspect.
**RAM:**
Download memtest86+ and install it on a medium and boot your system with it. I'd suggest ... | I had this issue and resolved it by disabling my motherboards onboard realetek sound and fitting a pci soundcard (Creative Labs).
Hope this helps |
72,534,839 | I am struggling to update the interpolation of `thing`.
This simple function should change the value of the data but instead does nothing.
Chrome logs the change of thing in the console but the HTML does not update.
```
<template>
<div class="container-xl pb-5">
<button class="mb-2 btn-lg selected-dropdown" @cli... | 2022/06/07 | [
"https://Stackoverflow.com/questions/72534839",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1939661/"
] | Since the function `getData` is `async`, it's a `Future` and you can't use a future methods inside your tree widget directly
you can use it inside your widget tree using the widget `FutureBuilder`
```
FutureBuilder(
future: getData(),
builder: (context, snapshot){
if (!snapshot.hasData) return const S... | ```
getData() async {
User? user = await FirebaseAuth.instance.currentUser;
if(user!=null){
print(user.displayName);
print(user.email);}
}
```
this will wait for an async method to first complete then print |
78,579 | In one of my projects my requirement is to insert/add more than 15000 records/entries at one og in a custom list.
After searching some of the blogs i found some useful information about adding bulk entries in custom list.I tried to add by the batch files, i called processbatchdata method for bulk entries.
Referred li... | 2013/10/01 | [
"https://sharepoint.stackexchange.com/questions/78579",
"https://sharepoint.stackexchange.com",
"https://sharepoint.stackexchange.com/users/19863/"
] | If you are complaining about 2 minutes being slow for 5k items, presumably this isn't a one time import - you may consider looking at [Business Connectivity Services](http://msdn.microsoft.com/en-us/library/ff798319.aspx) to connect directly to your external data source. | Is this a frequent step or just a one time task?
If it's frequent, I recommend NOT doing this in SharePoint! Sorry, I don't have a good answer. I would revisit the requirements and look at farming this high amount of data into another SQL database and use BCS to connect and manage the data.
I strongly oppose high am... |
25,653,399 | On one controller, I have a function that handles a drill down that sets that record's information on another controller's config variables.
It seems to set them fine the from first controller. When it switches to the other controller, it says those variables are undefined. What is going on?
Controller handling dril... | 2014/09/03 | [
"https://Stackoverflow.com/questions/25653399",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2115016/"
] | ExtJS recommends using generated setter and getter for configs. The direct access is not documented.
Doc: <http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.Class-cfg-config>
So using
```
console.log("this.siteName = " + this.getSiteName());
console.log("this.siteId = " + this.getSiteId());
```
is best practice and s... | Apparently having the underscore seems to be working...
```
console.log("this.siteName = " + this._siteName);
console.log("this.siteId = " + this._siteId);
``` |
23,794,483 | I'm just starting coding in Django and I have code that repeat itself on a lot of pages.
for example:
```
<select name="seasons" id="season-id">
{% for season in seasons %}
{% if season_id|add:0 == season.id %}
<option value="{{ season.id }}" selected="selected">{{ season.name }}</option>
... | 2014/05/21 | [
"https://Stackoverflow.com/questions/23794483",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/490570/"
] | Extract the code into a separate template file and [`include`](https://docs.djangoproject.com/en/dev/ref/templates/builtins/#include) it instead of repeating:
```
{% include "seasons.html" %}
```
FYI, you can also specify that you want to pass only `seasons` variable into the context of included template:
```
{% in... | Depends on what is repeating.
1. You can nest templates. Probably not useful here.
2. You can write your own template tags and template filters. [further info](http://www.pfinn.net/custom-django-filter-tutorial.html) |
23,794,483 | I'm just starting coding in Django and I have code that repeat itself on a lot of pages.
for example:
```
<select name="seasons" id="season-id">
{% for season in seasons %}
{% if season_id|add:0 == season.id %}
<option value="{{ season.id }}" selected="selected">{{ season.name }}</option>
... | 2014/05/21 | [
"https://Stackoverflow.com/questions/23794483",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/490570/"
] | Extract the code into a separate template file and [`include`](https://docs.djangoproject.com/en/dev/ref/templates/builtins/#include) it instead of repeating:
```
{% include "seasons.html" %}
```
FYI, you can also specify that you want to pass only `seasons` variable into the context of included template:
```
{% in... | You shouldn't be writing this template code at all. You should define a Django form and let that output the field. |
23,794,483 | I'm just starting coding in Django and I have code that repeat itself on a lot of pages.
for example:
```
<select name="seasons" id="season-id">
{% for season in seasons %}
{% if season_id|add:0 == season.id %}
<option value="{{ season.id }}" selected="selected">{{ season.name }}</option>
... | 2014/05/21 | [
"https://Stackoverflow.com/questions/23794483",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/490570/"
] | Depends on what is repeating.
1. You can nest templates. Probably not useful here.
2. You can write your own template tags and template filters. [further info](http://www.pfinn.net/custom-django-filter-tutorial.html) | You shouldn't be writing this template code at all. You should define a Django form and let that output the field. |
2,676,057 | Feel free to close and/or redirect if this has been asked, but here's my situation:
I've got an application that will require doing a bunch of small units of work (polling a web service until something is done, then parsing about 1MB worth of XML and putting it in a database). I want to have a simple async queueing me... | 2010/04/20 | [
"https://Stackoverflow.com/questions/2676057",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2484/"
] | There's [celery](http://ask.github.com/celery/getting-started/introduction.html).
You could break it down into 2 different `Tasks`: one to poll the web service and queue the second task, which would be in charge of parsing the XML and persisting it. | This problem sounds like a pretty good candidate for Python's built-in (2.6+ anyway) multiprocessing module: <http://docs.python.org/library/multiprocessing.html>
A simple solution would be to create a process Pool and use your main program to poll for the XML chunks. Once it has them it can then pass them off to the ... |
13,069,605 | In my assignment the third step is to Call the method merge to merge the two lists in list1 so that the list1 **remains sorted.**
I write my code but it doesn't work well , the output show wrong because it important to be sorted
```
public static void merge (ArrayList<Integer> list1, ArrayList<Integer> list2)
{
... | 2012/10/25 | [
"https://Stackoverflow.com/questions/13069605",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1772461/"
] | ```
public static void merge (ArrayList<Integer> list1, ArrayList<Integer> list2)
{
list1.addAll(list2);
Collections.sort(list1);
}
``` | If your input Lists aren't too long, I'd suggest just merging the lists and using the `Collections.sort()` Method to restore the order:
```
public static void mergeAndSort(List<Integer> list1, List<Integer> list2) {
List<Integer> combinedList = new ArrayList<Integer>(list1);
combinedList.addAll(list2);
Col... |
13,069,605 | In my assignment the third step is to Call the method merge to merge the two lists in list1 so that the list1 **remains sorted.**
I write my code but it doesn't work well , the output show wrong because it important to be sorted
```
public static void merge (ArrayList<Integer> list1, ArrayList<Integer> list2)
{
... | 2012/10/25 | [
"https://Stackoverflow.com/questions/13069605",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1772461/"
] | After you merge the lists, call sort method as below.
```
Collections.sort(list1); // carries out natural ordering.
```
If you need a customized sorting, use Comparator object
```
Collections.sort(list1, comparatorObject);
```
Check [Comparator example](http://www.mkyong.com/java/java-object-sorting-example-compa... | ```
ArrayList<Integer> a = new ArrayList();
ArrayList<Integer> b = new ArrayList();
ArrayList<Integer> c = new ArrayList();
a.add(1);
a.add(3);
a.add(5);
a.add(7);
a.add(17);
a.add(27);
a.add(37);
b.add(0);
b.add(2);
b.add(4);
while( a.size() > 0... |
13,069,605 | In my assignment the third step is to Call the method merge to merge the two lists in list1 so that the list1 **remains sorted.**
I write my code but it doesn't work well , the output show wrong because it important to be sorted
```
public static void merge (ArrayList<Integer> list1, ArrayList<Integer> list2)
{
... | 2012/10/25 | [
"https://Stackoverflow.com/questions/13069605",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1772461/"
] | ```
public list mergeAndSort(List<integer> list1, List<integer> list2){
List<integer> list3;
int list2Size = list2.size();
for(int i=0;i<list2Size;i++){
list1.add(list2(i));
}
// Here we got all the elements in 1 list i.e list1
int list1Size = list1.size();
for(i=0;i<list1Size;i++){
int small = 0;
for(in... | ```
ArrayList<Integer> a = new ArrayList();
ArrayList<Integer> b = new ArrayList();
ArrayList<Integer> c = new ArrayList();
a.add(1);
a.add(3);
a.add(5);
a.add(7);
a.add(17);
a.add(27);
a.add(37);
b.add(0);
b.add(2);
b.add(4);
while( a.size() > 0... |
13,069,605 | In my assignment the third step is to Call the method merge to merge the two lists in list1 so that the list1 **remains sorted.**
I write my code but it doesn't work well , the output show wrong because it important to be sorted
```
public static void merge (ArrayList<Integer> list1, ArrayList<Integer> list2)
{
... | 2012/10/25 | [
"https://Stackoverflow.com/questions/13069605",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1772461/"
] | ```
public static void merge (ArrayList<Integer> list1, ArrayList<Integer> list2)
{
list1.addAll(list2);
Collections.sort(list1);
}
``` | After you merge the lists, call sort method as below.
```
Collections.sort(list1); // carries out natural ordering.
```
If you need a customized sorting, use Comparator object
```
Collections.sort(list1, comparatorObject);
```
Check [Comparator example](http://www.mkyong.com/java/java-object-sorting-example-compa... |
13,069,605 | In my assignment the third step is to Call the method merge to merge the two lists in list1 so that the list1 **remains sorted.**
I write my code but it doesn't work well , the output show wrong because it important to be sorted
```
public static void merge (ArrayList<Integer> list1, ArrayList<Integer> list2)
{
... | 2012/10/25 | [
"https://Stackoverflow.com/questions/13069605",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1772461/"
] | ```
public static void merge (ArrayList<Integer> list1, ArrayList<Integer> list2)
{
list1.addAll(list2);
Collections.sort(list1);
}
``` | ```
public list mergeAndSort(List<integer> list1, List<integer> list2){
List<integer> list3;
int list2Size = list2.size();
for(int i=0;i<list2Size;i++){
list1.add(list2(i));
}
// Here we got all the elements in 1 list i.e list1
int list1Size = list1.size();
for(i=0;i<list1Size;i++){
int small = 0;
for(in... |
13,069,605 | In my assignment the third step is to Call the method merge to merge the two lists in list1 so that the list1 **remains sorted.**
I write my code but it doesn't work well , the output show wrong because it important to be sorted
```
public static void merge (ArrayList<Integer> list1, ArrayList<Integer> list2)
{
... | 2012/10/25 | [
"https://Stackoverflow.com/questions/13069605",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1772461/"
] | You only need one `for` loop assuming both lists are sorted:
```
public static void merge(List<Integer> l1, List<Integer> l2) {
for (int index1 = 0, index2 = 0; index2 < l2.size(); index1++) {
if (index1 == l1.size() || l1.get(index1) > l2.get(index2)) {
l1.add(index1, l2.get(index2++));
... | After you merge the lists, call sort method as below.
```
Collections.sort(list1); // carries out natural ordering.
```
If you need a customized sorting, use Comparator object
```
Collections.sort(list1, comparatorObject);
```
Check [Comparator example](http://www.mkyong.com/java/java-object-sorting-example-compa... |
13,069,605 | In my assignment the third step is to Call the method merge to merge the two lists in list1 so that the list1 **remains sorted.**
I write my code but it doesn't work well , the output show wrong because it important to be sorted
```
public static void merge (ArrayList<Integer> list1, ArrayList<Integer> list2)
{
... | 2012/10/25 | [
"https://Stackoverflow.com/questions/13069605",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1772461/"
] | You only need one `for` loop assuming both lists are sorted:
```
public static void merge(List<Integer> l1, List<Integer> l2) {
for (int index1 = 0, index2 = 0; index2 < l2.size(); index1++) {
if (index1 == l1.size() || l1.get(index1) > l2.get(index2)) {
l1.add(index1, l2.get(index2++));
... | ```
public static void merge (ArrayList<Integer> list1, ArrayList<Integer> list2)
{
list1.addAll(list2);
Collections.sort(list1);
}
``` |
13,069,605 | In my assignment the third step is to Call the method merge to merge the two lists in list1 so that the list1 **remains sorted.**
I write my code but it doesn't work well , the output show wrong because it important to be sorted
```
public static void merge (ArrayList<Integer> list1, ArrayList<Integer> list2)
{
... | 2012/10/25 | [
"https://Stackoverflow.com/questions/13069605",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1772461/"
] | Easy fix: sort afterwards.
```
list1.addAll(list2);
Collections.sort(list1);
```
Use sets to avoid duplicates. | After you merge the lists, call sort method as below.
```
Collections.sort(list1); // carries out natural ordering.
```
If you need a customized sorting, use Comparator object
```
Collections.sort(list1, comparatorObject);
```
Check [Comparator example](http://www.mkyong.com/java/java-object-sorting-example-compa... |
13,069,605 | In my assignment the third step is to Call the method merge to merge the two lists in list1 so that the list1 **remains sorted.**
I write my code but it doesn't work well , the output show wrong because it important to be sorted
```
public static void merge (ArrayList<Integer> list1, ArrayList<Integer> list2)
{
... | 2012/10/25 | [
"https://Stackoverflow.com/questions/13069605",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1772461/"
] | If your input Lists aren't too long, I'd suggest just merging the lists and using the `Collections.sort()` Method to restore the order:
```
public static void mergeAndSort(List<Integer> list1, List<Integer> list2) {
List<Integer> combinedList = new ArrayList<Integer>(list1);
combinedList.addAll(list2);
Col... | ```
ArrayList<Integer> a = new ArrayList();
ArrayList<Integer> b = new ArrayList();
ArrayList<Integer> c = new ArrayList();
a.add(1);
a.add(3);
a.add(5);
a.add(7);
a.add(17);
a.add(27);
a.add(37);
b.add(0);
b.add(2);
b.add(4);
while( a.size() > 0... |
13,069,605 | In my assignment the third step is to Call the method merge to merge the two lists in list1 so that the list1 **remains sorted.**
I write my code but it doesn't work well , the output show wrong because it important to be sorted
```
public static void merge (ArrayList<Integer> list1, ArrayList<Integer> list2)
{
... | 2012/10/25 | [
"https://Stackoverflow.com/questions/13069605",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1772461/"
] | Easy fix: sort afterwards.
```
list1.addAll(list2);
Collections.sort(list1);
```
Use sets to avoid duplicates. | ```
ArrayList<Integer> a = new ArrayList();
ArrayList<Integer> b = new ArrayList();
ArrayList<Integer> c = new ArrayList();
a.add(1);
a.add(3);
a.add(5);
a.add(7);
a.add(17);
a.add(27);
a.add(37);
b.add(0);
b.add(2);
b.add(4);
while( a.size() > 0... |
7,242,226 | What is the fastest way to get a list of all members/users in a given AD group and determine whether or not a user is enabled (or disabled)?
We are potentially talking about 20K users, so I would like to avoid hitting the AD for each individual user. | 2011/08/30 | [
"https://Stackoverflow.com/questions/7242226",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/154991/"
] | If you're on .NET 3.5 and up, you should check out the `System.DirectoryServices.AccountManagement` (S.DS.AM) namespace. Read all about it here:
* [Managing Directory Security Principals in the .NET Framework 3.5](http://msdn.microsoft.com/en-us/magazine/cc135979.aspx)
* [MSDN docs on System.DirectoryServices.AccountM... | Please can you try the following code. it use [Search Filter Syntax](http://msdn.microsoft.com/en-us/library/aa746475%28v=vs.85%29.aspx) to get what you want in one LDAP query and recursively. The interest is that the query is done on the server. I'am not sure that it faster than @marc\_s solution but it exists, and it... |
9,874 | I can't remember when and where I had this discussion, but I remember being corrected when I was speaking by a stranger saying that it is never correct to say *give me half of this*; instead, the grammatically correct phrase would be *give me one half of this*. I've never been a pro at where numbers fit in with the Eng... | 2011/01/25 | [
"https://english.stackexchange.com/questions/9874",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/4064/"
] | I had this situation recently. It was so embarrassing when the saleslady told her co-workers about what I said.
I asked her to give me one half kilo (1/2 kilo) of prawns and 3 pieces of fish. She ended up giving me one and one half kilo of prawns. When she asked for the payments and I asked the amount, i freaked out. ... | You don't need the 'one' in expressions like 'give me half a cookie'. Where you do need the 'one' is in when units of measurement are involved, like "please give me one half pound of sugar". You can use 'a' instead of 'one', but leaving out any determiner is wrong.
Correct:
>
> Give me one half pound of sugar.
>
... |
9,874 | I can't remember when and where I had this discussion, but I remember being corrected when I was speaking by a stranger saying that it is never correct to say *give me half of this*; instead, the grammatically correct phrase would be *give me one half of this*. I've never been a pro at where numbers fit in with the Eng... | 2011/01/25 | [
"https://english.stackexchange.com/questions/9874",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/4064/"
] | It is perfectly acceptable to say "give me half of that". In English, "half" in understood on its own to mean "[one of two equal parts of something](http://www.merriam-webster.com/dictionary/half "Half - Definition, Merriam-Webster Dictionary\"")".
To put it another way:
* It would make no sense to say "give me no ha... | You don't need the 'one' in expressions like 'give me half a cookie'. Where you do need the 'one' is in when units of measurement are involved, like "please give me one half pound of sugar". You can use 'a' instead of 'one', but leaving out any determiner is wrong.
Correct:
>
> Give me one half pound of sugar.
>
... |
9,874 | I can't remember when and where I had this discussion, but I remember being corrected when I was speaking by a stranger saying that it is never correct to say *give me half of this*; instead, the grammatically correct phrase would be *give me one half of this*. I've never been a pro at where numbers fit in with the Eng... | 2011/01/25 | [
"https://english.stackexchange.com/questions/9874",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/4064/"
] | *Comment posted as answer - as requested*
In idiomatic usage, you would seldom say 'one half of this'. You might say 'give me one half-pound pack of sugar' but the hyphen shows that it is a different construct. You might say 'give me one third of that' (as opposed to 'two thirds of that'), but with halves, the alterna... | If you are discussing arithmetic, it is always correct to stipulate a numerator and a denominator. "Give me half an apple" is fine, but "what is half plus a third?" is incorrect and should be "what is one-half plus one-third?" |
9,874 | I can't remember when and where I had this discussion, but I remember being corrected when I was speaking by a stranger saying that it is never correct to say *give me half of this*; instead, the grammatically correct phrase would be *give me one half of this*. I've never been a pro at where numbers fit in with the Eng... | 2011/01/25 | [
"https://english.stackexchange.com/questions/9874",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/4064/"
] | It is perfectly acceptable to say "give me half of that". In English, "half" in understood on its own to mean "[one of two equal parts of something](http://www.merriam-webster.com/dictionary/half "Half - Definition, Merriam-Webster Dictionary\"")".
To put it another way:
* It would make no sense to say "give me no ha... | *Comment posted as answer - as requested*
In idiomatic usage, you would seldom say 'one half of this'. You might say 'give me one half-pound pack of sugar' but the hyphen shows that it is a different construct. You might say 'give me one third of that' (as opposed to 'two thirds of that'), but with halves, the alterna... |
9,874 | I can't remember when and where I had this discussion, but I remember being corrected when I was speaking by a stranger saying that it is never correct to say *give me half of this*; instead, the grammatically correct phrase would be *give me one half of this*. I've never been a pro at where numbers fit in with the Eng... | 2011/01/25 | [
"https://english.stackexchange.com/questions/9874",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/4064/"
] | *Comment posted as answer - as requested*
In idiomatic usage, you would seldom say 'one half of this'. You might say 'give me one half-pound pack of sugar' but the hyphen shows that it is a different construct. You might say 'give me one third of that' (as opposed to 'two thirds of that'), but with halves, the alterna... | You don't need the 'one' in expressions like 'give me half a cookie'. Where you do need the 'one' is in when units of measurement are involved, like "please give me one half pound of sugar". You can use 'a' instead of 'one', but leaving out any determiner is wrong.
Correct:
>
> Give me one half pound of sugar.
>
... |
9,874 | I can't remember when and where I had this discussion, but I remember being corrected when I was speaking by a stranger saying that it is never correct to say *give me half of this*; instead, the grammatically correct phrase would be *give me one half of this*. I've never been a pro at where numbers fit in with the Eng... | 2011/01/25 | [
"https://english.stackexchange.com/questions/9874",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/4064/"
] | There is no need to say "one half" there. "Give me half of that" is sufficient. | You don't need the 'one' in expressions like 'give me half a cookie'. Where you do need the 'one' is in when units of measurement are involved, like "please give me one half pound of sugar". You can use 'a' instead of 'one', but leaving out any determiner is wrong.
Correct:
>
> Give me one half pound of sugar.
>
... |
9,874 | I can't remember when and where I had this discussion, but I remember being corrected when I was speaking by a stranger saying that it is never correct to say *give me half of this*; instead, the grammatically correct phrase would be *give me one half of this*. I've never been a pro at where numbers fit in with the Eng... | 2011/01/25 | [
"https://english.stackexchange.com/questions/9874",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/4064/"
] | I had this situation recently. It was so embarrassing when the saleslady told her co-workers about what I said.
I asked her to give me one half kilo (1/2 kilo) of prawns and 3 pieces of fish. She ended up giving me one and one half kilo of prawns. When she asked for the payments and I asked the amount, i freaked out. ... | If you are discussing arithmetic, it is always correct to stipulate a numerator and a denominator. "Give me half an apple" is fine, but "what is half plus a third?" is incorrect and should be "what is one-half plus one-third?" |
9,874 | I can't remember when and where I had this discussion, but I remember being corrected when I was speaking by a stranger saying that it is never correct to say *give me half of this*; instead, the grammatically correct phrase would be *give me one half of this*. I've never been a pro at where numbers fit in with the Eng... | 2011/01/25 | [
"https://english.stackexchange.com/questions/9874",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/4064/"
] | There is no need to say "one half" there. "Give me half of that" is sufficient. | If you are discussing arithmetic, it is always correct to stipulate a numerator and a denominator. "Give me half an apple" is fine, but "what is half plus a third?" is incorrect and should be "what is one-half plus one-third?" |
9,874 | I can't remember when and where I had this discussion, but I remember being corrected when I was speaking by a stranger saying that it is never correct to say *give me half of this*; instead, the grammatically correct phrase would be *give me one half of this*. I've never been a pro at where numbers fit in with the Eng... | 2011/01/25 | [
"https://english.stackexchange.com/questions/9874",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/4064/"
] | There is no need to say "one half" there. "Give me half of that" is sufficient. | I had this situation recently. It was so embarrassing when the saleslady told her co-workers about what I said.
I asked her to give me one half kilo (1/2 kilo) of prawns and 3 pieces of fish. She ended up giving me one and one half kilo of prawns. When she asked for the payments and I asked the amount, i freaked out. ... |
9,874 | I can't remember when and where I had this discussion, but I remember being corrected when I was speaking by a stranger saying that it is never correct to say *give me half of this*; instead, the grammatically correct phrase would be *give me one half of this*. I've never been a pro at where numbers fit in with the Eng... | 2011/01/25 | [
"https://english.stackexchange.com/questions/9874",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/4064/"
] | It is perfectly acceptable to say "give me half of that". In English, "half" in understood on its own to mean "[one of two equal parts of something](http://www.merriam-webster.com/dictionary/half "Half - Definition, Merriam-Webster Dictionary\"")".
To put it another way:
* It would make no sense to say "give me no ha... | If you are discussing arithmetic, it is always correct to stipulate a numerator and a denominator. "Give me half an apple" is fine, but "what is half plus a third?" is incorrect and should be "what is one-half plus one-third?" |
32,082,233 | I have a dataframe with missing values. How can I write either a python or an R code to replace empty spaces with 0, a single string with 1, and multiple strings joined by "\t" with a number corresponding to how many "\t"s + 1.
my data frame:
```
col1 col2 col3
row1 5blue 2green5 white
row2 ... | 2015/08/18 | [
"https://Stackoverflow.com/questions/32082233",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2597415/"
] | [Parsing Tab Delimited](https://stackoverflow.com/questions/11059390/parsing-a-tab-separated-file-in-python)
Read this post above. It covers using python csv module to parse tab delimited. I think it will help you.
**Input File data\_frame.txt**
```
5blue 2green5 white
white green\twhite3\t3blue5
blue3 ... | Use the `yourstring.count("\t")` function to get the number of tabs, add 1 to the value to get the number of words. If string is empty, output 0. |
32,082,233 | I have a dataframe with missing values. How can I write either a python or an R code to replace empty spaces with 0, a single string with 1, and multiple strings joined by "\t" with a number corresponding to how many "\t"s + 1.
my data frame:
```
col1 col2 col3
row1 5blue 2green5 white
row2 ... | 2015/08/18 | [
"https://Stackoverflow.com/questions/32082233",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2597415/"
] | I'm using a function that goes to each column element and checks if the element is a space (You can change that depending on what you have. It looks likes a space to me) and returns 0 if it is, otherwise it splits the string by "\t" and counts the strings that are produced.
```
# example dataset
dt = data.frame(col1 =... | Use the `yourstring.count("\t")` function to get the number of tabs, add 1 to the value to get the number of words. If string is empty, output 0. |
32,082,233 | I have a dataframe with missing values. How can I write either a python or an R code to replace empty spaces with 0, a single string with 1, and multiple strings joined by "\t" with a number corresponding to how many "\t"s + 1.
my data frame:
```
col1 col2 col3
row1 5blue 2green5 white
row2 ... | 2015/08/18 | [
"https://Stackoverflow.com/questions/32082233",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2597415/"
] | I'm using a function that goes to each column element and checks if the element is a space (You can change that depending on what you have. It looks likes a space to me) and returns 0 if it is, otherwise it splits the string by "\t" and counts the strings that are produced.
```
# example dataset
dt = data.frame(col1 =... | [Parsing Tab Delimited](https://stackoverflow.com/questions/11059390/parsing-a-tab-separated-file-in-python)
Read this post above. It covers using python csv module to parse tab delimited. I think it will help you.
**Input File data\_frame.txt**
```
5blue 2green5 white
white green\twhite3\t3blue5
blue3 ... |
15,840,273 | I have an existing MVC3 application which allows users to upload files and share them with others. The current model is that if a user wants to change a file, they have to delete the one there and re-upload the new version. To improve this, we are looking into integrating WebDAV to allow the online editing of things li... | 2013/04/05 | [
"https://Stackoverflow.com/questions/15840273",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/799403/"
] | In the end it seems that the better option was to allow users to directly talk to the WebDAV server and implement the authentication logic to control it.
The IT Hit server has extensions that allow you to authenticate against the forms authentication for the rest of the site using basic or digest authentication from ... | This is exactly what i did for a MVC 4 project.
<https://mvc4webdav.codeplex.com/> |
51,169,227 | I have Android layout listed below, but *layout\_marginBottom* is not working - there is no any margin between *myTextView* and *myRecyclerView*.
Any ideas, what may be wrong with my layout?
```
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.... | 2018/07/04 | [
"https://Stackoverflow.com/questions/51169227",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5752684/"
] | To understand your question correctly, do you meant to say telnet is not found inside the running container? If not then you can install if while building the image itself. | Why you need telnet to other container?
if you want to copy files from one container to another container then you can use
`docker cp <containerid>:<path/to/copy> <conatinerid>:<path/to/copy>`
Docker container is like lightweight os that has minimum but necessary requirements
and telnet is definitely not one of the... |
36,144,214 | I have a vb string with this value: `c:\program\bin\files`
I need to convert this string to this value: `files`
All i need is the last folder of the path.
The path is not fixed. It can be anything like: `d:\app\win\7\sp1\update`
In this case the string must be converted to: `update`
I think that should be done by ... | 2016/03/22 | [
"https://Stackoverflow.com/questions/36144214",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1181161/"
] | Rather than try to pull apart the string yourself, have a look at the [System.IO.Path](https://msdn.microsoft.com/en-us/library/system.io.path(v=vs.110).aspx) class.
In your case, the GetFileName method does what you want:
```
lastFolder = System.IO.Path.GetFileName(path)
```
To fill a combo box with names you c... | In VBScript, which this is tagged you have two choices. This was written before any code was edited into the question.
Use `InstrR` which is `Instr` but from back to front of string.
You also have `StrReverse` which reverses a string.
>
> **InStrRev**
>
>
> Returns the position of an occurrence of one string with... |
1,863,954 | $$\int \frac{dx}{x(x^n +1)} $$
$$t=x^n + 1$$
$${dt}=nx^{n-1}{dx}$$
$$\frac{dx}{x}=\frac{dt}{nx^n}$$
$$\int \frac{1}{n}\frac{dt}{t(t-1)} $$
I tried $t=\sin^2\theta $ but back substitution will be difficult .
How to integrate this type of integration ? | 2016/07/19 | [
"https://math.stackexchange.com/questions/1863954",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/346279/"
] | Let $$I = \int\frac{1}{x(x^n+1)}dx = \int\frac{1}{\left(1+x^{-n}\right)}\cdot \frac{1}{x^{n+1}}dx$$
Now put $1+x^{-n} = t\; $ Then $\displaystyle -\frac{1}{n}\cdot \frac{1}{x^{n+1}}dx = dt$
So $$I =-n\int\frac{1}{t}dt=-n\ln |t|+\mathcal{C} = n\ln \left|\frac{x^n}{1+x^n}\right|+\mathcal{C}$$ | **Hint:**
$$\frac{1}{t(t-1)}=\frac{1}{t-1}-\frac{1}{t}.$$
Hope this helps. |
1,863,954 | $$\int \frac{dx}{x(x^n +1)} $$
$$t=x^n + 1$$
$${dt}=nx^{n-1}{dx}$$
$$\frac{dx}{x}=\frac{dt}{nx^n}$$
$$\int \frac{1}{n}\frac{dt}{t(t-1)} $$
I tried $t=\sin^2\theta $ but back substitution will be difficult .
How to integrate this type of integration ? | 2016/07/19 | [
"https://math.stackexchange.com/questions/1863954",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/346279/"
] | Let $$I = \int\frac{1}{x(x^n+1)}dx = \int\frac{1}{\left(1+x^{-n}\right)}\cdot \frac{1}{x^{n+1}}dx$$
Now put $1+x^{-n} = t\; $ Then $\displaystyle -\frac{1}{n}\cdot \frac{1}{x^{n+1}}dx = dt$
So $$I =-n\int\frac{1}{t}dt=-n\ln |t|+\mathcal{C} = n\ln \left|\frac{x^n}{1+x^n}\right|+\mathcal{C}$$ | If you insist on doing the problem solely with substitution, you should probably try substituting $t=\sec^2\theta$. Then you end up with
$$\frac1n\int\frac{2\sec^2\theta\tan\theta\,d\theta}{\sec^2\theta\tan^2\theta} = \frac2n\int\cot\theta\,d\theta,$$
which is quite straightforward. |
1,954,608 | >
> Prove that $$\binom{2n}{n}>\frac{4n}{n+1}\forall \; n\geq 2, n\in \mathbb{N}$$
>
>
>
$\bf{My\; Try::}$ Using $$(1+x)^n = \binom{n}{0}+\binom{n}{1}x+\binom{n}{2}x^2+........+\binom{n}{n}x^n$$
and $$(x+1)^n = \binom{n}{0}x^n+\binom{n}{1}x^{n-1}+\binom{n}{2}x^{n-1}+........+\binom{n}{n}$$
Now Coefficients of $x... | 2016/10/05 | [
"https://math.stackexchange.com/questions/1954608",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/14311/"
] | $$\binom{2n}n=\frac{n+1}{1}\frac{n+2}{2}\cdots\frac{2n-1}{n-1}\frac{2n}{n}\ge2^n>\frac{4n}{n+1}.$$ | The proof is correct. I particularly enjoyed how you proved the identity involving the squares of the binomial coefficients. |
1,954,608 | >
> Prove that $$\binom{2n}{n}>\frac{4n}{n+1}\forall \; n\geq 2, n\in \mathbb{N}$$
>
>
>
$\bf{My\; Try::}$ Using $$(1+x)^n = \binom{n}{0}+\binom{n}{1}x+\binom{n}{2}x^2+........+\binom{n}{n}x^n$$
and $$(x+1)^n = \binom{n}{0}x^n+\binom{n}{1}x^{n-1}+\binom{n}{2}x^{n-1}+........+\binom{n}{n}$$
Now Coefficients of $x... | 2016/10/05 | [
"https://math.stackexchange.com/questions/1954608",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/14311/"
] | We prove the stronger bound $\binom{2n}{n} \geq \frac{4^n}{2n+1}$, which is bigger than $\frac{4}{n+1}$ for all $n \geq 2$.
Note that the $2n+1$ binomial coefficients $\binom{2n}{0}$, $\binom{2n}{1}$, ..., $\binom{2n}{2n}$ have average
$$
\frac{\binom{2n}{0} + \binom{2n}{1} + \ldots + \binom{2n}{2n}}{2n+1} = \frac{2^{... | The proof is correct. I particularly enjoyed how you proved the identity involving the squares of the binomial coefficients. |
1,954,608 | >
> Prove that $$\binom{2n}{n}>\frac{4n}{n+1}\forall \; n\geq 2, n\in \mathbb{N}$$
>
>
>
$\bf{My\; Try::}$ Using $$(1+x)^n = \binom{n}{0}+\binom{n}{1}x+\binom{n}{2}x^2+........+\binom{n}{n}x^n$$
and $$(x+1)^n = \binom{n}{0}x^n+\binom{n}{1}x^{n-1}+\binom{n}{2}x^{n-1}+........+\binom{n}{n}$$
Now Coefficients of $x... | 2016/10/05 | [
"https://math.stackexchange.com/questions/1954608",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/14311/"
] | $$\binom{2n}n=\frac{n+1}{1}\frac{n+2}{2}\cdots\frac{2n-1}{n-1}\frac{2n}{n}\ge2^n>\frac{4n}{n+1}.$$ | It can probably be made shorter using induction: $$\binom{2(k+1)}{k+1)}=\binom{2k}k\cdot \frac{(2k+1)(2k+2)}{k+1}\\
>\frac{4k(2k+1)(2k+2)}{(k+1)^2}$$It isn't very hard to show that the final fraction is larger than $\frac{4k+4}{k+2}$. |
1,954,608 | >
> Prove that $$\binom{2n}{n}>\frac{4n}{n+1}\forall \; n\geq 2, n\in \mathbb{N}$$
>
>
>
$\bf{My\; Try::}$ Using $$(1+x)^n = \binom{n}{0}+\binom{n}{1}x+\binom{n}{2}x^2+........+\binom{n}{n}x^n$$
and $$(x+1)^n = \binom{n}{0}x^n+\binom{n}{1}x^{n-1}+\binom{n}{2}x^{n-1}+........+\binom{n}{n}$$
Now Coefficients of $x... | 2016/10/05 | [
"https://math.stackexchange.com/questions/1954608",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/14311/"
] | We prove the stronger bound $\binom{2n}{n} \geq \frac{4^n}{2n+1}$, which is bigger than $\frac{4}{n+1}$ for all $n \geq 2$.
Note that the $2n+1$ binomial coefficients $\binom{2n}{0}$, $\binom{2n}{1}$, ..., $\binom{2n}{2n}$ have average
$$
\frac{\binom{2n}{0} + \binom{2n}{1} + \ldots + \binom{2n}{2n}}{2n+1} = \frac{2^{... | It can probably be made shorter using induction: $$\binom{2(k+1)}{k+1)}=\binom{2k}k\cdot \frac{(2k+1)(2k+2)}{k+1}\\
>\frac{4k(2k+1)(2k+2)}{(k+1)^2}$$It isn't very hard to show that the final fraction is larger than $\frac{4k+4}{k+2}$. |
1,954,608 | >
> Prove that $$\binom{2n}{n}>\frac{4n}{n+1}\forall \; n\geq 2, n\in \mathbb{N}$$
>
>
>
$\bf{My\; Try::}$ Using $$(1+x)^n = \binom{n}{0}+\binom{n}{1}x+\binom{n}{2}x^2+........+\binom{n}{n}x^n$$
and $$(x+1)^n = \binom{n}{0}x^n+\binom{n}{1}x^{n-1}+\binom{n}{2}x^{n-1}+........+\binom{n}{n}$$
Now Coefficients of $x... | 2016/10/05 | [
"https://math.stackexchange.com/questions/1954608",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/14311/"
] | $$\binom{2n}n=\frac{n+1}{1}\frac{n+2}{2}\cdots\frac{2n-1}{n-1}\frac{2n}{n}\ge2^n>\frac{4n}{n+1}.$$ | Imagine a population, $P$, consisting of $n$ men and $n$ women. You are tasked with putting together a committee of $n$ people from $P$. There are no restriction on the make-up of the committee (for instance, it can be unisex). How many different committees can you put together?
Align the men in one row, and the women... |
1,954,608 | >
> Prove that $$\binom{2n}{n}>\frac{4n}{n+1}\forall \; n\geq 2, n\in \mathbb{N}$$
>
>
>
$\bf{My\; Try::}$ Using $$(1+x)^n = \binom{n}{0}+\binom{n}{1}x+\binom{n}{2}x^2+........+\binom{n}{n}x^n$$
and $$(x+1)^n = \binom{n}{0}x^n+\binom{n}{1}x^{n-1}+\binom{n}{2}x^{n-1}+........+\binom{n}{n}$$
Now Coefficients of $x... | 2016/10/05 | [
"https://math.stackexchange.com/questions/1954608",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/14311/"
] | We prove the stronger bound $\binom{2n}{n} \geq \frac{4^n}{2n+1}$, which is bigger than $\frac{4}{n+1}$ for all $n \geq 2$.
Note that the $2n+1$ binomial coefficients $\binom{2n}{0}$, $\binom{2n}{1}$, ..., $\binom{2n}{2n}$ have average
$$
\frac{\binom{2n}{0} + \binom{2n}{1} + \ldots + \binom{2n}{2n}}{2n+1} = \frac{2^{... | Imagine a population, $P$, consisting of $n$ men and $n$ women. You are tasked with putting together a committee of $n$ people from $P$. There are no restriction on the make-up of the committee (for instance, it can be unisex). How many different committees can you put together?
Align the men in one row, and the women... |
1,954,608 | >
> Prove that $$\binom{2n}{n}>\frac{4n}{n+1}\forall \; n\geq 2, n\in \mathbb{N}$$
>
>
>
$\bf{My\; Try::}$ Using $$(1+x)^n = \binom{n}{0}+\binom{n}{1}x+\binom{n}{2}x^2+........+\binom{n}{n}x^n$$
and $$(x+1)^n = \binom{n}{0}x^n+\binom{n}{1}x^{n-1}+\binom{n}{2}x^{n-1}+........+\binom{n}{n}$$
Now Coefficients of $x... | 2016/10/05 | [
"https://math.stackexchange.com/questions/1954608",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/14311/"
] | $$\binom{2n}n=\frac{n+1}{1}\frac{n+2}{2}\cdots\frac{2n-1}{n-1}\frac{2n}{n}\ge2^n>\frac{4n}{n+1}.$$ | Some other approaches look like sledgehammers to me, as you essentially need to show that the central binomial coefficient exceeds $4$, which is true for $2n=4$.
Is it really necessary to prove that the central coefficients are increasing ?
---
If yes,
$$\binom{2n+2}{n+1}=\frac{(2n+2)(2n+1)}{(n+1)(n+1)}\binom{2n}n$$... |
1,954,608 | >
> Prove that $$\binom{2n}{n}>\frac{4n}{n+1}\forall \; n\geq 2, n\in \mathbb{N}$$
>
>
>
$\bf{My\; Try::}$ Using $$(1+x)^n = \binom{n}{0}+\binom{n}{1}x+\binom{n}{2}x^2+........+\binom{n}{n}x^n$$
and $$(x+1)^n = \binom{n}{0}x^n+\binom{n}{1}x^{n-1}+\binom{n}{2}x^{n-1}+........+\binom{n}{n}$$
Now Coefficients of $x... | 2016/10/05 | [
"https://math.stackexchange.com/questions/1954608",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/14311/"
] | We prove the stronger bound $\binom{2n}{n} \geq \frac{4^n}{2n+1}$, which is bigger than $\frac{4}{n+1}$ for all $n \geq 2$.
Note that the $2n+1$ binomial coefficients $\binom{2n}{0}$, $\binom{2n}{1}$, ..., $\binom{2n}{2n}$ have average
$$
\frac{\binom{2n}{0} + \binom{2n}{1} + \ldots + \binom{2n}{2n}}{2n+1} = \frac{2^{... | Some other approaches look like sledgehammers to me, as you essentially need to show that the central binomial coefficient exceeds $4$, which is true for $2n=4$.
Is it really necessary to prove that the central coefficients are increasing ?
---
If yes,
$$\binom{2n+2}{n+1}=\frac{(2n+2)(2n+1)}{(n+1)(n+1)}\binom{2n}n$$... |
66,921,057 | I'm new to bash scripting and trying to learn.
I have a variable $temp, that contains what I get from an API call, which is a long list of SHA1 hashes. I want to take what is in $temp and create an array that I can loop through and compare each entry to a string I have defined. Somehow, I can not seem to get it to wor... | 2021/04/02 | [
"https://Stackoverflow.com/questions/66921057",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14851149/"
] | ```
declare -A myArr # creates an associative array (hash)
declare -a myArr # creates an array
```
Neither is necessary here. `read` can create the array for you. See `help declare` and `help read`.
---
```
temp=$(curl --silent --request GET "https://api.pwnedpasswords.com/range/$shortendHash")
# -a: assign the wo... | Assuming ...
```
$(curl --silent --request GET "https://api.pwnedpasswords.com/range/$shortendHash")
```
Returns ...
```
002C3CADF9FC86069F09961B10E0EDEFC45:1
003BE35BD9466D19258E79C8665AFB072F6:1
0075B2ADF782F9677BDDF8CC5778900D986:8
00810352C02B145FF304FCBD5BEF4F7AA9F:1
013720F40B99D6BCF6F08BD7271523EBB49:1
01C89... |
17,696,760 | 
As show in Picture above UIView A & UIView C are Added on UIView B. for B ClipToBounds is YES so the Red area is not visible.
Is it possible to get Visible rectangle of A & C ( shown with Lines )
I need show Rectangle in visible area when I touche... | 2013/07/17 | [
"https://Stackoverflow.com/questions/17696760",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/355082/"
] | You can get an intersection rect of the two rects by using [CGRectIntersection()](http://developer.apple.com/library/mac/#documentation/GraphicsImaging/Reference/CGGeometry/Reference/reference.html#//apple_ref/doc/uid/TP30000955-CH1g-F17157) method
```
CGRect intersectionRect = CGRectIntersection(viewA.frame, viewB.fr... | Use for this
```
[UIView convertRect:<#(CGRect)#> fromView:<#(UIView *)#>]
[UIView convertRect:<#(CGRect)#> toView:<#(UIView *)#>]
```
And CGRectIntersection function |
17,696,760 | 
As show in Picture above UIView A & UIView C are Added on UIView B. for B ClipToBounds is YES so the Red area is not visible.
Is it possible to get Visible rectangle of A & C ( shown with Lines )
I need show Rectangle in visible area when I touche... | 2013/07/17 | [
"https://Stackoverflow.com/questions/17696760",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/355082/"
] | You can get an intersection rect of the two rects by using [CGRectIntersection()](http://developer.apple.com/library/mac/#documentation/GraphicsImaging/Reference/CGGeometry/Reference/reference.html#//apple_ref/doc/uid/TP30000955-CH1g-F17157) method
```
CGRect intersectionRect = CGRectIntersection(viewA.frame, viewB.fr... | on `touchesEnded:` method you can find it like bellow..
```
-(void) touchesEnded:(NSSet *) touches {
if(CGRectIntersectsRect([ViewA frame], [ViewB frame]) {
//Do something here
}
}
```
Read More Information about RectInterSect From [This Link](https://developer.apple.com/library/mac/#documentation/... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.