Change color of UISwitch in "off" state

Question: I've learned that we can change the UISwitch button appearance in its "on" state,
but is it also possible to change the color of the UISwitch in the "off" state?
Comment: have you used tintColor property to change colour?
Answer: My solution with #swift2:
let onColor  = _your_on_state_color
let offColor = _your_off_state_color

let mSwitch = UISwitch(frame: CGRect.zero)
mSwitch.on = true

/*For on state*/
mSwitch.onTintColor = onColor

/*For off state*/
mSwitch.tintColor = offColor
mSwitch.layer.cornerRadius = mSwitch.frame.height / 2.0
mSwitch.backgroundColor = offColor
mSwitch.clipsToBounds = true

Result:
Comment: Hey, @longpham , I would just make a little change on the radius code. In case the height ever changes I would use: mSwitch.layer.cornerRadius = mSwitch.frame.height/2 (I'm just paranoid).
Comment: @Felipe Gringo No problem. Depend on your UI. Standard `UISwitch` is 31pt.
Answer: Try using this
yourSwitch.backgroundColor = [UIColor whiteColor];
youSwitch.layer.cornerRadius = 16.0;

All thanks to @Barry Wyckoff.
Comment: THIS is correct answer:) setTint changes the "outline" colour as well which visually "hides" the background on white background.
Comment: Be aware that the background is in rectangular shape.
Comment: @aykutt for scaled view you can use yourSwitch.layer.cornerRadius = yourSwitch.frame.height / 2 / scaleFactor
Comment: My switch is resized with `CGAffineTransformMakeScale(0.80, 0.80)`. And this is not working with scaled view. Because view's layer is not resized. How can i make this work?
Answer: You can use the tintColor property on the switch.
switch.tintColor = [UIColor redColor]; // the "off" color
switch.onTintColor = [UIColor greenColor]; // the "on" color

Note this requires iOS 5+
Comment: Setting tintColor in iOS7 removes "outline" for me (tint white against white background).
Answer: Swift IBDesignable
import UIKit
@IBDesignable

class UISwitchCustom: UISwitch {
    @IBInspectable var OffTint: UIColor? {
        didSet {
            self.tintColor = OffTint
            self.layer.cornerRadius = 16
            self.backgroundColor = OffTint
        }
    }
}

set class in Identity inspector

change color from Attributes inspector

Output
Comment: running Xcode 11.2.1, works when running the app, but it does not show the color in IB.... anyway, it works when deployed to device.
Comment: It is not giving proper out put in swift 3
Comment: @KetanP can you explain issue in more detail?
Answer: Here's a pretty good trick: you can just reach right into the UISwitch's subview that draws its "off" background, and change its background color. This works a lot better in iOS 13 than it does in iOS 12:
if #available(iOS 13.0, *) {
    self.sw.subviews.first?.subviews.first?.backgroundColor = .green
} else if #available(iOS 12.0, *) {
    self.sw.subviews.first?.subviews.first?.subviews.first?.backgroundColor = .green
}

Comment: Probably not crash during subscription in future iOS better to use subviews.first?. instead of subviews[0].
Comment: @IgorPalaguta Yes, good idea. I'll make that change.
Comment: @ Igor Palaguta, here we have 2 subviews, can you please post your complete code.
Comment: Minor issue to be aware of with this technique; for some reason, iOS likes to erase this color back to the default once the app comes back from the background.
Answer:

Working 100% IOS 13.0 and Swift 5.0 switch both state color set same #ios13 #swift #swift5
@IBOutlet weak var switchProfile: UISwitch!{
    didSet{
        switchProfile.onTintColor = .red
        switchProfile.tintColor = .red
        switchProfile.subviews[0].subviews[0].backgroundColor = .red
    }
}

Comment: Your solution doesn't work with colors that adapt to the dark mode.
Comment: This is the only solution that works for me. To use it on dark mode, don't use ".red", use ".systemRed"
Answer:
The Best way to manage background color & size of UISwitch

For now it's Swift 2.3 code
import Foundation
import UIKit

@IBDesignable
class UICustomSwitch : UISwitch {

    @IBInspectable var OnColor : UIColor! = UIColor.blueColor()
    @IBInspectable var OffColor : UIColor! = UIColor.grayColor()
    @IBInspectable var Scale : CGFloat! = 1.0

    override init(frame: CGRect) {
        super.init(frame: frame)
        self.setUpCustomUserInterface()
    }

    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
        self.setUpCustomUserInterface()
    }

    func setUpCustomUserInterface() {

        //clip the background color
        self.layer.cornerRadius = 16
        self.layer.masksToBounds = true

        //Scale down to make it smaller in look
        self.transform = CGAffineTransformMakeScale(self.Scale, self.Scale);

        //add target to get user interation to update user-interface accordingly
        self.addTarget(self, action: #selector(UICustomSwitch.updateUI), forControlEvents: UIControlEvents.ValueChanged)

        //set onTintColor : is necessary to make it colored
        self.onTintColor = self.OnColor

        //setup to initial state
        self.updateUI()
    }

    //to track programatic update
    override func setOn(on: Bool, animated: Bool) {
        super.setOn(on, animated: true)
        updateUI()
    }

    //Update user-interface according to on/off state
    func updateUI() {
        if self.on == true {
            self.backgroundColor = self.OnColor
        }
        else {
            self.backgroundColor = self.OffColor
        }
    }
}

Answer: Swift 5:
import UIKit

extension UISwitch {

    func set(offTint color: UIColor ) {
        let minSide = min(bounds.size.height, bounds.size.width)
        layer.cornerRadius = minSide / 2
        backgroundColor = color
        tintColor = color
    }
}

Answer: Should you need other switches around your app, it might be also a good idea implementing @LongPham's code inside a custom class.
As others have pointed out, for the "off" state you'll need to change the background colour as well, since the default is transparent.
class MySwitch: UISwitch {

  required init?(coder aDecoder: NSCoder) {
    super.init(coder: aDecoder)

    // Setting "on" state colour
    self.onTintColor        = UIColor.green

    // Setting "off" state colour
    self.tintColor          = UIColor.red
    self.layer.cornerRadius = self.frame.height / 2
    self.backgroundColor    = UIColor.red
  }
}

Answer: Swift 4 easiest and fastest way to get it in 3 steps:
// background color is the color of the background of the switch
switchControl.backgroundColor = UIColor.white.withAlphaComponent(0.9)

// tint color is the color of the border when the switch is off, use
// clear if you want it the same as the background, or different otherwise
switchControl.tintColor = UIColor.clear

// and make sure that the background color will stay in border of the switch
switchControl.layer.cornerRadius = switchControl.bounds.height / 2

If you manually change the size of the switch (e.g., by using autolayout), you will have to update the switch.layer.cornerRadius too, e.g., by overriding layoutSubviews and after calling super updating the corner radius:
override func layoutSubviews() {
    super.layoutSubviews()
    switchControl.layer.cornerRadius = switchControl.bounds.height / 2
}

Comment: @iOSCalendarViewOnMyProfile it's supposed to change the background color, not the bullet itself.. in iOS look and feel that's always the default color..
Comment: what is integrationSwitch? and also, doesnt seem to work in iOS 11. Changing the background color changes a larger looking view around the switch
Comment: @iOSCalendarViewOnMyProfile sorry, it should be `switchControl`
Answer: 2020 As of Xcode 11.3.1 & Swift 5
Here's the simplest way I've found of doing setting the UISwitch off-state colour with one line of code. Writing this here since this page is what came up first when I was looking and the other answers didn't help.
This is if I wanted to set the off state to be red, and can be added to the viewDidLoad() function:
yourSwitchName.subviews[0].subviews[0].backgroundColor = UIColor.red

Note - what this is actually doing is setting the background colour of the switch. This may influence the colour of the switch in the on-state too (though for me this wasn't a problem since I wanted the on and off state to be the same colour).
A solution for this:
Simply tie in the colours with an 'if else' statement inside your IBAction. If the switch is off, colour the background red. If the switch is on, leave the background clear so your chosen 'on' colour will display properly.
This goes inside the switch IBAction.
  if yourSwitch.isOn == false {
           yourSwitch.subviews[0].subviews[0].backgroundColor = UIColor.red
    } else {
        yourSwitch.subviews[0].subviews[0].backgroundColor = UIColor.clear
    }

I found some behaviour where, upon the app resuming from background, the switch background would return to clear. To remedy this problem I simply added in the following code to set the colour every time the app comes to the foreground:
 override func viewDidAppear(_ animated: Bool) {
    super.viewDidAppear(animated)

    NotificationCenter.default.addObserver(
      self,
      selector: #selector(applicationWillEnterForeground(_:)),
      name: UIApplication.willEnterForegroundNotification,
      object: nil)
}

@objc func applicationWillEnterForeground(_ notification: NSNotification) {
   yourSwitch.subviews[0].subviews[0].backgroundColor = UIColor.red
   yourSwitch.subviews[0].subviews[0].backgroundColor = UIColor.red
}

Seems simpler than the other answers. Hope that helps!
Comment: Beautiful and simple answer, thank you very much,  +1
Comment: This method shows strange area on iOS 12.
Answer: The UISwitch offTintColor is transparent, so whatever is behind the switch shows through. Therefore, instead of masking the background color, it suffices to draw a switch-shaped image behind the switch (this implementation assumes that the switch is positioned by autolayout):
func putColor(_ color: UIColor, behindSwitch sw: UISwitch) {
    guard sw.superview != nil else {return}
    let onswitch = UISwitch()
    onswitch.isOn = true
    let r = UIGraphicsImageRenderer(bounds:sw.bounds)
    let im = r.image { ctx in
        onswitch.layer.render(in: ctx.cgContext)
        }.withRenderingMode(.alwaysTemplate)
    let iv = UIImageView(image:im)
    iv.tintColor = color
    sw.superview!.insertSubview(iv, belowSubview: sw)
    iv.translatesAutoresizingMaskIntoConstraints = false
    NSLayoutConstraint.activate([
        iv.topAnchor.constraint(equalTo: sw.topAnchor),
        iv.bottomAnchor.constraint(equalTo: sw.bottomAnchor),
        iv.leadingAnchor.constraint(equalTo: sw.leadingAnchor),
        iv.trailingAnchor.constraint(equalTo: sw.trailingAnchor),
    ])
}

[But see now my other answer.]
Answer: In Swift 4+:
off state:
switch.tintColor = UIColor.blue

on state:
switch.onTintColor = UIColor.red

Comment: This doesn't work on iOS 13+, setting `tintColor` has no effect.
Answer: objective c category to use on any UISwitch in project using code or storyboard:
#import <UIKit/UIKit.h>

@interface UISwitch (SAHelper)
@property (nonatomic) IBInspectable UIColor *offTint;
@end

implementation
#import "UISwitch+SAHelper.h"

@implementation UISwitch (SAHelper)
@dynamic offTint;
- (void)setOffTint:(UIColor *)offTint {
    self.tintColor = offTint;   //comment this line to hide border in off state
    self.layer.cornerRadius = 16;
    self.backgroundColor = offTint;
}
@end

Answer: More safe way in Swift 3 without magical 16pt values:
class ColoredBackgroundSwitch: UISwitch {

  var offTintColor: UIColor {
    get {
      return backgroundColor ?? UIColor.clear
    }
    set {
      backgroundColor = newValue
    }
  }

  override func layoutSubviews() {
    super.layoutSubviews()
    let minSide = min(frame.size.height, frame.size.width)
    layer.cornerRadius = ceil(minSide / 2)
  }

}

Answer: XCode 11, Swift 5
I don't prefer using subViews, cause you never know when apple gonna change the hierarchy.
so I use mask view instead.
it works with iOS 12, iOS 13
    private lazy var settingSwitch: UISwitch = {
        let swt: UISwitch = UISwitch()
        // set border color when isOn is false
        swt.tintColor = .cloudyBlueTwo
        // set border color when isOn is true
        swt.onTintColor = .greenishTeal

        // set background color when isOn is false
        swt.backgroundColor = .cloudyBlueTwo

        // create a mask view to clip background over the size you expected.
        let maskView = UIView(frame: swt.frame)
        maskView.backgroundColor = .red
        maskView.layer.cornerRadius = swt.frame.height / 2
        maskView.clipsToBounds = true
        swt.mask = maskView

        // set the scale to your expectation, here is around height: 34, width: 21.
        let scale: CGFloat = 2 / 3
        swt.transform = CGAffineTransform(scaleX: scale, y: scale)
        swt.addTarget(self, action: #selector(switchOnChange(_:)), for: .valueChanged)
        return swt
    }()

    @objc
    func switchOnChange(_ sender: UISwitch) {
        if sender.isOn {
            // set background color when isOn is true
            sender.backgroundColor = .greenishTeal
        } else {
            // set background color when isOn is false
            sender.backgroundColor = .cloudyBlueTwo
        }
    }

Answer: I tested on IOS 14, set background as off color and onTintColor as On and works:
uiSwitch.onTintColor = UIColor.blue
uiSwitch.backgroundColor = UIColor.red

Comment: This doesn't seem to work on iOS 16. backgroundColor colors the whole switch box and omits rounded corners. As others suggested below you need to add a .layer.cornerRadius
Comment: I updated my App for IOS 16 and still working ok. no need to add nothing more on my app.
Answer: XCode 11, Swift 4.2
Starting with Matt's solution I added it to a custom, IBDesignable control. There is a timing issue in that didMoveToSuperview() is called before the offTintColor is set that needed to be handled.
@IBDesignable public class UISwitchCustom: UISwitch {

    var switchMask: UIImageView?
    private var observers = [NSKeyValueObservation]()

    @IBInspectable dynamic var offTintColor : UIColor! = UIColor.gray {
        didSet {
             switchMask?.tintColor = offTintColor
        }
    }

    override init(frame: CGRect) {
        super.init(frame: frame)
        initializeObservers()
    }

    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
        initializeObservers()
    }

    private func initializeObservers() {
        observers.append(observe(\.isHidden, options: [.initial]) {(model, change) in
            self.switchMask?.isHidden = self.isHidden
        })
    }

    override public func didMoveToSuperview() {
        addOffColorMask(offTintColor)
        super.didMoveToSuperview()
    }

   private func addOffColorMask(_ color: UIColor) {
        guard self.superview != nil else {return}
        let onswitch = UISwitch()
        onswitch.isOn = true
        let r = UIGraphicsImageRenderer(bounds:self.bounds)
        let im = r.image { ctx in
            onswitch.layer.render(in: ctx.cgContext)
            }.withRenderingMode(.alwaysTemplate)
        let iv = UIImageView(image:im)
        iv.tintColor = color
        self.superview!.insertSubview(iv, belowSubview: self)
        iv.translatesAutoresizingMaskIntoConstraints = false
        NSLayoutConstraint.activate([
            iv.topAnchor.constraint(equalTo: self.topAnchor),
            iv.bottomAnchor.constraint(equalTo: self.bottomAnchor),
            iv.leadingAnchor.constraint(equalTo: self.leadingAnchor),
            iv.trailingAnchor.constraint(equalTo: self.trailingAnchor),
            ])
        switchMask = iv
        switchMask?.isHidden = self.isHidden
    }

}

Answer: all I finally used transform and layer.cornerRadius too.
But I have added translation to it to be center.
    private func setSwitchSize() {
    let iosSwitchSize = switchBlockAction.bounds.size
    let requiredSwitchSize = ...
    let transform = CGAffineTransform(a: requiredSwitchSize.width / iosSwitchSize.width, b: 0,
                                      c: 0, d:  requiredSwitchSize.height / iosSwitchSize.height,
                                      tx: (requiredSwitchSize.width - iosSwitchSize.width) / 2.0,
                                      ty: (requiredSwitchSize.height - iosSwitchSize.height) / 2.0)

    switchBlockAction.layer.cornerRadius = iosSwitchSize.height / 2.0
    switchBlockAction.transform = transform
}

And I did use backgroundColor and tintColor in designer.
Hope it helps.

Change color of UISwitch in "off" state


Why oil changes and not oil replenishment

Question: Provided that the oil filter of an engine would be swapped every x time intervals as needed to be kept clean, I was wondering if, instead of removing all engine oil and replacing it with new (clean and uncontaminated), there would be any advantages in adding clean oil in shorter intervals and bleeding the same amount of the dirtier oil (probably left in the bottom most of the oil pan). This suggests that no oil leaks and oil consumption takes place.
Would such a method provide better cleaning/flushing of the engine parts? The idea here is that replenishment will keep oil in an overall good/clean condition.
If this method keeps the oil at an overall "cleaner" state would it help to prolong the filter longevity as well???
Comment: Its not just contaminants, oil does wear out and needs to be replaced>>>>>https://www.amsoil.com/newsstand/motor-oil/articles/why-motor-oil-deteriorates/
Answer: The short answer is convenience. It's just too much to ask of the average consumer to perform a drain-and-top-up procedure at regular intervals.
It's also messy. Anyone who's topped up oil without a funnel can attest to that. And once the drain plug is undone, you can't turn off gravity at will to prevent spills.
Comment: Not sure about this. I tend to believe that modern mechanics are able to produce easy operated oil inlets/drains. Also i didn't actually mention that the end user should preform this task so there might be actually a "market" advantage.
Answer: Some manufacturers do this - at least on larger equipment.
The oil is rated for 100,000 miles and the filters changed every 10,000 or 20,000. The oil is topped up as necessary. And, in some locations they are very quick to sort leaks so they don't contaminate the terrain...
I did this on a car kept the fully synthetic in for twice the recommended interval but changed the filter as per spec. Engine was fine, but I was using Mobil 1 5W-50 and it was really expensive then.
Comment: That doesn't seem to be exactly what the question is asking (only partially changing oil often, vs. complete changes per spec)
Comment: @towe then do an answer based on your experience - that should help.
Comment: Railroad locomotive diesels rarely have oil changes ; 100,000 +. They are topped off and lab tests determine if any additives need replacement.


Change Caps Lock to still register as caps lock but do Nothing

Question: Currently my caps lock key functions exactly like it should, is it possible for me to disable the function that converts inputs to capital without disabling detection of the actual key and without re-mapping to something else. I am using a program to detect key presses and want the triggering key to be the caps lock key, but without caps lock auto-capitalizing everything. For reference, I am using Logitech Gaming Software for key press detection.
Comment: Possible duplicate of [How do I disable the CAPS LOCK function WITHOUT disabling the key or remapping it?](https://superuser.com/questions/490737/how-do-i-disable-the-caps-lock-function-without-disabling-the-key-or-remapping-i)
Answer: Using AutoHotKey ( https://autohotkey.com/ ) you can remap the CapsLock button into a hotkey, and it will prevent the default purpose of the key.
AutoHotKey also comes with all the documentation you need to use it, including a 'quick start' tutorial for people who don't want to get into majorly complex hotkeys.
Comment: I can see how that would be useful to remap the key, but how would I be able to use it to change the function of the key?
Comment: AutoHotKey allows you not only to remap keys, but make entire scripts that run from a keypress. In essence, it can make a key do most things.
Comment: I don't think I was clear enough, I have another program that I want to use to detect key presses, and I want to use caps lock as the hotkey to be detected, but for that to work I would need to stop it from changing inputs to capital letters without effecting the ability for the key press to be detected, let me update the OP.
Comment: Fair enough, then might I suggest using AutoHotKey to prevent the auto-capitalization and see if your capture software still sees the keypress? Just have the AutoHotKey script do nothing on the CapsLock:: capture
Answer: I'd probably use the Microsoft Keyboard Layout Creator, load the default US keyboard layout, and disable the "CAPS=Shift" option for all of the keys which have it enabled. Then you can install it and load the layout as an input language (language bar options). To expedite the process, here's the built install I just made (you'll still need to set your input to use this keyboard):
https://www.dropbox.com/s/kbag84s7vjykv1x/usnocaps.zip?dl=1
Here's Microsoft's Keyboard Layout Creator:
https://msdn.microsoft.com/en-us/goglobal/bb964665.aspx
Comment: Will this disable the ability to capitalize letters with shift?
Comment: No, it only disables capitalization with caps-lock, and you can enable/disable caps lock any time by switching keyboard layouts via a hotkey (which you can set in the language bar options, I believe Ctrl+Shift is the default). Sorry for the slow reply, I'm still getting used to the site and wasn't aware you had commented.


Is it possible to release a NFT collection then later mint more from the same collection?

Question: If I wanted to release 1k NFTs, then if they sell out release more.
Answer: The answer to that question depends on how you will be creating these NFTs.
Editions:
If the NFTs are all the same you could use an open Edition and first print 1k Editions and later on add more.
Candy machine:
If you are creating normal NFTs and want to sell them you could use sugar to create a candy machine and do one of the following:

Create the CMv2 for x thousand > 1k NFTs and use end settings and set them to 1000 to first just sell 1k, then later update the endsettings to be able to sell more

"endSettings": {
  "endSettingType": "Amount",
  "number": 1000
   }

Or first create a CMv2 with 1k NFTs and sell out. As soon as you need more NFTs create a new Candy machine. Before selling the first NFT use sugar collection set <COLLECTION MINT ID> to set the candy machine to the same collection as the first one.
Answer: Yes you can if you have the collection NFT/Parent NFT for your Collection.If you are going to use Candy Machine then you have to setup multiple Candy Machines because once you have specified the size than more NFT metadata cannot be added in it. So in this case you need to have 2 Candy Machines one for the initial 1K NFTs and later on a different Candy Machine. The Main Thing is all your NFT should be pointing to the same Collection NFT.


determine which branch a changeset is associated with tfs_warehouse

Question: I'm querying the TFS_Warehouse and TFS_DefaultCollection databases to look at changesets but I need to determine which branch the changeset is associated with. This isn't obvious to me looking at the data. Ideas?
Comment: Care to elaborate?
Comment: Yes, sorry. I'm looking at tbl_ChangeSet. That has every changeset that happens in TFS, regardless of Branch. There's no ID that links that changeset to the branch that the changeset occurred in that I can see. That's what I need to figure out.
Comment: Hi Terry, any update on this? Did my reply help or give a right direction?
Answer: You can write queries against the TFS data warehouse or the TFS analysis cube. However, do not write queries directly against the project collection databases, it's not suggested and will lose support.
A changeset can of course contain files in multiple branches. There is not any table or query could indicate which branch a changeset is associated with.
The simplest way is through tracking changeset feature.

Detail steps please refer this question: Is there a way to find out the source changeset from which a particular branch was created in TFS?
If you insist on using SQL, you could first get all files and version numbers with a particular changeset, and then through all of the files get the related branch. Take a look at below thread which may be helpful:

TFS Listing of all files and version numbers with a particular changeset
TFS: Find Files Affected Between Changesets


Why is that when one person or group gets a good or service, someone else will have to live without it?

Question: !
There's this statement in my Applied Economics book that I don't understand. Why is that when one person or group gets a good or service, someone else will have to live without it? I hope you answer this question. Thank you.
Answer: That statement is not generally true.
It is true of rivalrous goods (e.g. when I take a slice of a pizza, there's that much less left of the pizza for you).
It is false of non-rivalrous goods (e.g. when I step into the sunshine, there is usually* no less of the sunshine for you).
*Unless of course I somehow also block the sunshine for you.
Answer: I believe this comes from a very beginning of the book, which tries to emphasize the concept of scarcity... a very important idea in economics.
Later on, you'll see that there are certain types of goods that, when one person "consumes" it, it doesn't mean that other people cannot consume it as well. In economics, this is called a non-rivalry good. Some examples include scenic views (you enjoy it doesn't mean your friends can't too), national defense, and radio signal.
Note that this is true only up to a point... when there's two people enjoying the view of the mountain, that's fine. Three, ok... but when it gets up to thousands of people enjoying the same view of the mountain, that gets a bit crowded. Here we're only talking to non-rivalry within reasons.
Comment: Probably the only real examples of truly non-rival goods are intellectual property. But even then, there can be side effects (discouraging innovation) if it's not protected somehow (patentes, copyright etc.)
Answer: The statement is most clearly correct for goods which are both rival and unique, for example, some houses (which may be unique by virtue of their size, room configuration and location), and unique original works of art (which can have only one owner even if displayed for viewing by others).
As other answers have said, the statement is not true for non-rival goods. But even for ordinary rival goods produced in large quantities (slices of pizza, say), the statement is only true in the sense that if someone consumes a particular unit of a good, then someone else (indeed everyone else) cannot consume that particular unit. The wording "have to live without it" is rather pretentious in that context, given that a person who cannot consume one particular unit can often consume another equally good unit.


Page cache coherency

Question: From what I understand, there are hardware-implemented techniques to keep the CPU L1 cache coherent with the data in RAM (when performing read/writes on a shared variable)

every write will invalidate the corresponding entry in all CPU caches
or, every write will update the corresponding entry on all other CPU caches

Is there a similar mechanism (software/hardware-wise) for maintaining consistency on the page cache? As far as I understand, the page cache is a write-back cache, meaning writes only show up in the cache, but only show up on disk later "asynchronously" (e.g. when the page gets evicted from the cache).
Answer: system calls sync or fsync instruct disk driver to make the writes persisted but it does not guarantee. Also both the calls are blocking or synchronous.

Page cache coherency


Differentiating between zero and not sending for OOK

Question: How would a trigger works for on-off keying (OOK)? How would it differentiate between not receiving anything and zero?
Comment: This does not apply to OOK only. If you assume for instance, a correlator followed by binary decisions, then one cannot know the output bitstream (both 0s and 1s) is data or garbage (noise). It only makes sense when the receiver already **knows** it should receive data on the specific timeslot (e.g. a packet preamble is already detected).
Answer: A simple way to do it would be using a start bit like UART. When idle, don't transmit anything. When you want to transmit something, first transmit a start bit which is a '1' (ON). Then transmit a fixed number of bits known to both the transmitter and receiver. The receiver looks for the start bit and knows to begin demodulating after it receives the start bit.
A more rigorous way to do it would be the following:

Assemble bits into a frame of size X bits.
At the beginning of the frame, transmit a preamble sequence. This is some known sequence of bits that will be the same every time. This is what is done in Wi-Fi, Ethernet, etc.
The receiver looks for that preamble sequence by correlating the received signal with the expected preamble signal. Once you get a high peak in the correlation, the receiver knows that is the start of the frame.
The receiver is now synchronized and knows that it needs to demodulate X bits. After that, the receiver goes back to looking for the start of the next frame.

Raw modulation isn't really useful by itself; you need to add some extra stuff to have a practical communication system.
Comment: Thank you, so is there a way to detect the preamble sequence by looking at the signal ? I can see the digital sequence of my key fob with SDR. Is there a way to guess which part of the beginning of the sequence  is preamble sequence by just looking at the signal? Is there a rule or it depends on the manufacturer?
Comment: The preamble will always be the same, so look for a sequence right at the beginning which is the same every time you press the key fob. You'll probably want to look at the raw received I/Q signal with your SDR. I personally have not played around with key fobs.
Answer: If in your particular application you need to differentiate between an idle channel  (nothing being transmitted) and an off-state transmission, then you either do not use OOK, or replace the zero transmission with something nonzero, effectively resulting in a non OOK modulation...
For a wired channel an off state with 0 volts can be differentiated from an idle channel via the impedance. A high impedance could be used to denote an idle channel whereas a zero volts with normal impedance would then mean an off state. Bear in mind that channel impedance switching as well determination could be slow, hence limiting its transmission capacity.
Answer: Note that a modulation scheme such as OOK or BPSK is never used in isolation -- in order to have a working communications system, you need to solve a few problems besides raw information transmission, and you also typically need to add a few (ISO) layers on top of the physical layer.
Some examples:

In synchronous communication, there is always something being transmitted; an idle state is represented by idle flags. For instance, in HDLC, when there is no data to transmit a flag (0x7E IIRC) is always transmitted. Actual data always comes after a flag.
In asynchronous communication, data is preceded by "start bits" (as in RS-232).
Usually you want to be able to identify individual time slots, which means that the receiver must look for a framing pattern before handing bits to the upper layers. The framing pattern appears periodically in the data stream.
You also need a way to identify the end of the transmission; it's not enough to identify the start.
Many systems avoid long streams of constant bits by encoding, scrambling or otherwise modifying the data stream to force 0-1-0 or 1-0-1 transitions. For example T1 trunks in telephony use a line encoding that forces transitions for a long stream of 1's (alternate mark inversion), and B8ZS (bipolar 8 zero substitution) to force transitions for long streams of 0's.

All this means that, in practice, receiving 0 volts for a long time is equivalent to there being no signal at all to receive.
In practice, you can do the following. If your system is asynchronous, then look for the start bit before receiving data. If it is synchronous, then calculate the energy of the received signal over the last few symbol times. If the energy is above an (experimental) threshold, then start looking for your framing pattern or idle flags.
Answer: You can't. OOK is defined as something like the following:

For each symbol period:

To send a "1", transmit a sinusoid of constant amplitude.
To send a "0", transmit nothing.

The details of the above could be different depending upon the whims of the system designer (e.g. whether "no signal" refers to a "0" or "1"), but that's the general case. Note that there is no distinction whatsoever between the two cases you described (you receive a zero from the transmitter versus you don't receive anything). There is no difference in the observable conditions between the two cases, so there's not really anything you can do about it.
This is one reason why OOK is not commonly used.
Comment: ok, to be fair, you'd typically find an encoding scheme where "anything being transmitte" guarantees a state transmission every so and so many symbols (diff manchester with zerostuffing)
Comment: Indeed that's true. But OOK just doesn't have much to recommend it. There are other approaches that are still simple but more efficient and easier to synchronize to (e.g. BPSK).
Comment: @JasonR Is this correct to assume that they always start with 1 so the receiver would know something is coming?
Comment: @Jack: That sounds like a reasonable thing to expect, absent some other means of synchronizing the transmitter and receiver.
Answer: A "zero" would be recognized not in isolation, at a single point in time, but in statistical context to a sufficient amount of surrounding information, e.g. other stuff that looks sufficiently like a sufficient amount of "ones" and/or "zeros" (or other known signal types), at the sufficiently right time, both before and perhaps after the decision of the input being a "zero".  There are a vast number of ways to gather the surrounding information in time, and do "the statistics" needed for a decision (all the way from a simple single one-shot after a start-bit to a multi-layer adaptive convolutional DNN).


Can I warm up "cold patch" in a microwave?

Question: I found two asphalt patching products online that are designed to be heated in the microwave.  Both are out of stock.  Can I heat up ordinary "cold patch" or "trowel patch" in the microwave?
Comment: Only if you are not married (or otherwise sharing a living space), or not planning to stay that way, IMHO. Perhaps if you have a "garage microwave" for crazy non-food uses. Boil some water and put it in a bucket outside (then put the container of cold patch in the bucket of hot water) seems far less likely to irritate other uses of the microwave. Mmmm...  tar-flavored microwave popcorn.
Comment: Oh boy, how to get to sleep on the couch in one easy move :)
Comment: @Ecnerwal - But the two products seemed to work great after microwaving.  I wonder what the ingredients are?  The think I know one should never microwave is metal.  I wonder if regular cold patch contains anything metallic.
Comment: The problem is not just that the patch might not heat up properly, or damage the microwave, but that it may leave residue behind in a microwave that you then use for food. Even if it doesn't leave behind traces of some horrible chemical, there's a good chance that the smell will linger on, and make your food taste like hot asphalt for a few weeks.
Answer: Microwaves work by exciting the molecules in liquids that then trasfer their heat into surrounding materials. To be safe, "microwavable" products have water in them so that the water molecules are what heats up. If you use a product not designed for this, you could end up volatizing (vaporizing) VOCs (Volatile Organic Compounds) that are not only harmful, but potentially FLAMMABLE!


Where does the profile name on the Status Report come from?

Question: When I click on Reports > Status report, the Install profile field says Snrub (snrub-"1.1) (with exactly one double quote). Where is this value defined?
Answer: When the status report is rendered, profile info is retrieved from drupal_get_profile() (by referencing the install_profile var) as well as system_get_info() to retrieve all the metadata properties (by referencing the system data table)
Answer: The installation profile name given in the status report is output from system_requirements(), which uses the following code. (Note that code outputs the installation profile name and, between parentheses, the profile name returned from drupal_get_profile() and its version. It's not the installation profile name that contains the installation profile version.)
// Display the currently active installation profile, if the site
// is not running the default installation profile.
$profile = drupal_get_profile();
if ($profile != 'standard') {
  $info = system_get_info('module', $profile);
  $requirements['install_profile'] = array(
    'title' => $t('Install profile'),
    'value' => $t('%profile_name (%profile-%version)', array(
      '%profile_name' => $info['name'],
      '%profile' => $profile,
      '%version' => $info['version'],
    )),
    'severity' => REQUIREMENT_INFO,
    'weight' => -9,
  );
}

In other places, Drupal shows the distribution name, which is returned from drupal_install_profile_distribution_name().
  // During installation, the profile information is stored in the global
  // installation state (it might not be saved anywhere yet).
  if (drupal_installation_attempted()) {
    global $install_state;
    return $install_state['profile_info']['distribution_name'];
  }
  else {
    $profile = drupal_get_profile();
    $info = system_get_info('module', $profile);
    return $info['distribution_name'];
  }
}

In both the case, that information is found in the .info file used from the installation profile / distribution. For example, the .info file for the Panopoly distribution contains the following lines.
name = Panopoly
distribution_name = Panopoly
description = A magical framework for building Drupal products based on the Panels module
core = 7.x
exclusive = 1

; Drupal Core
dependencies[] = block
dependencies[] = menu
dependencies[] = image
dependencies[] = list
dependencies[] = number
dependencies[] = options
dependencies[] = path
dependencies[] = taxonomy
dependencies[] = search
dependencies[] = shortcut
dependencies[] = field
dependencies[] = field_ui
dependencies[] = file
dependencies[] = dblog
dependencies[] = update

; Panopoly Foundation
dependencies[] = panopoly_core
dependencies[] = panopoly_images
dependencies[] = panopoly_theme
dependencies[] = panopoly_magic
dependencies[] = panopoly_widgets
dependencies[] = panopoly_admin
dependencies[] = panopoly_users

; Panopoly Toolset
dependencies[] = panopoly_pages
dependencies[] = panopoly_search
dependencies[] = panopoly_wysiwyg

; Panopoly Recommended - Admin & UI
dependencies[] = navbar
dependencies[] = breakpoints
dependencies[] = backports
dependencies[] = simplified_menu_admin
dependencies[] = save_draft
dependencies[] = module_filter
dependencies[] = date_popup_authored
dependencies[] = views_ui

; Panopoly Recommended - Other
dependencies[] = devel
dependencies[] = distro_update
dependencies[] = uuid
dependencies[] = apps

If you are searching which file you need to edit to remove the double-quote character shown in the installation profile version, that is the .info file of the installation profile / distribution you used to install Drupal. Check the values given for the version key. The installation profile / distribution is using a wrong value for the version. (Actually, a distribution hosted on Drupal.org should not add the version key in its .info file, since that is automatically added from the packaging scripts running on Drupal.org. On Drupal.org, there isn't any Snrub distribution; I take it's a custom distribution hosted somewhere else, or build specifically for the site you are maintaining/developing.)


How to force XNA to render model very far away as a light dot?

Question: Making a space strategy game focusing on commanding a large fleet, with 1000+ ships per side.(I'm new in XNA 3D...below is a test screenshot. The ships will be scaled down another 2-5 times) When a unit is too far away, it's not rendered anymore.(obviously...when people get killed, they die) are there any way (as fast as possible) to force XNA to render the model into a 1-pixel dot if it's too far/smaller than 1 pixel? (I'm thinking about dynamic scaling, but that will probably drag down the performance severely)
Answer: Problem is two-fold:

Determine how many pixels the model will take when rendered
Replace model with a dot

Suggestions:

Pick the cut-off distance by eye. So when the model is this big and this far - it should be replaced with a dot. I would make it a property of the ship.
Render all models that are closer than their cutoff distance as usual. Do not render all models that are farther. Instead render dots (single pixels or sprites, whichever is simpler for you) in their places.
Answer: Hmm interesting but I'm not sure if that's the strategy I'd use.. what about using distance as a determining factor or have you looked into or considered camera culling? Something like this article.
Comment: If you insert a link, then insert the main part of the content on it so you can avoid link rot


Stirling numbers of the second kind formulae

Question: We want to determine the number of ways that 10 distinct pieces of candy can be placed into 2 identical bags with each bag getting at least 1 piece.
As we know the answer is $S(10,2)$, where $S$ stands for Stirling number of the second kind.
I thought that we can start by choosing two candies out 10 to put each one in a bag, so we will have that each bag is nonempty. Then, the remaining 8 candies will either be put in a single bag or put in the two bags (meaning each bag gets at least one candy out of 8) and that can be done in $S(8,2)$ ways.
And finally, I get $S(10,2)= \binom {10}{2} \left( S(8,1) + S(8,2) \right) $.I know that the result I get is wrong, because from the tables of the Stirling numbers $S(10,2)$ is $511$. But the reasoning seems to me correct!!!
Where is the problem with my reasoning?
Answer: Suppose there are 4 candies and 2 bags. let the candies be $1,2,3,4.$ Choose $2$ perhaps $\color{red}1,2.$ Then you place them in different bags and then you distribute the $2$ other candies as $\{3,4\}$ in one bag or $\{3\},\{4\}$ in two different bags.  So one of the partitions created on this process is $\{\color{red}{1},3\},\{\color{red}{2},4\}.$
Notice that you could have chosen $\color{red}{3,4}$ instead of $1,2$ and so here also you will end up with $\{1,\color{red}{3}\},\{2,\color{red}{4}\}.$ In consequence, you are overcounting partitions. You are giving them a color!
Comment: yeah that was really helpful, thank you
Comment: it would be interesting if I could find a way to subtract the overcounted cases, I will try that
Comment: Take a look at Jeea's answer(+1) for the way to not overcount. You are welcome!
Answer: Stirling number $S(n,k)$ is concerned with number of different groupings of $n$ entities into $k$ groups.

Suppose that you have $n-1$ items and $k$ groups, then new nth element has to be added to one of the existing $k$ groups, so this will generate some of the required partitions. How many partitions can there be of this kind, well we can choose one out of $k$ groups, so $k \times S(n-1, k)$
Another case can be when you have $n-1$ items and $k-1$ groups, then if we create a group in itself for nth added element, then this will generate partitions different from first case. So this is $S(n-1, k-1)$

Overall recurrence relation comes as
$$S(n, k) = kS(n-1, k) + S(n-1,k-1)$$
Phicar has already pointed out a mistake in your example
Comment: thank you so much


Should I have our old maple cut down?

Question: We have a huge sugar maple in our yard that is almost 200 years old. This spring when cleaning up the yard I noticed a lot of bark and smaller limbs have come off the tree and on one side at least, the foliage appears rather sparse.
We've contacted a tree company to remove it, but I hate to see it go, however, I'm also concerned about a limb coming off in a high wind and killing someone!  Any advice?
Comment: Are you able to post a photo
Answer: You should have your old maple professionally assessed by a qualified arborist. Depending where you are you may have one available to you that's paid by your taxes through cooperative extension or your state forest service.
If  you call someone to cut it down, they are going to cut it down.
If you want to know if it needs to be cut down, you need an evaluation, so (as it were) consult a doctor, not an executioner. If the tree needs to come down upon evaluation, see if you can arrange to have it turned into lumber.
Answer: Your first step will be to see if the tree has protected status. Depending on the jurisdiction that you live in this may involve your local/ municipal government, your state/ provincial/ county government or federal/ central government. In many areas, a 200-year-old tree may be protected, especially if it is in a character area.
I suggest starting with your local government as they will likely tell you about the upstream rules.
Once you know if you will be allowed to remove the tree, or what protocols you have to operate in, you should contact an arborist. Your local authority may have someone who will assess the tree, especially if it holds any status so you might get a twofer here.
The arborist will tell you whether the tree needs to be cut down entirely if a large delimbing is required or whether you can take a conservative approach to trimming.
You should now have a fair plan of what will be cut and whether you need permission to proceed.
Now you can contact a tree cutting service. You can always offer the wood if they're interested to soften the cost. Maple makes good firewood and there's plenty of time for it to be dried before the fall.
Explain to the crew exactly what you want done. Sometimes instructions don't translate well and you could find they cut too much. This could be a problem if the tree is protected and it will be your accountability at the end of the day.
Good luck with the job!
Comment: This sound slike it came from chatgpt, which is banned here.  And it does not answer thh question
Comment: It's not, it's just knowledge from many years working in municipal governments and a basic understanding of how to construct a plan. OP is asking for advice. The advice is to do your due diligence and engage a professional. 10+ years on SE and that's the first time I've ever been accused of plagiarism.
Comment:  It wasn't an accusation, it was a request for clarification. +1

Should I have our old maple cut down?


What is the significance of cows in Hinduism?

Question: In India, a land of Hindus, cows are worshiped across the nation. Any significance of it?
Comment: @SwiftPushkar other question also ask about cow only not other animals
Comment: @SwiftPushkar Boith question are about cow and there significance in Hinduism, so i can't get you point. Better you try to explain why you think both are diffrent
Comment: @SwiftPushkar i think Awal garg wants religious reasons. But this question is exact duplicate of that question. Anyways, You can post your answer to that question or i think Mods can shift it to that question. If marked question is concerned about usage or something else, that will be off topic. But i don't think Awal wants that.
Answer:
गाव: स्वर्गस्य सोपानं गाव: स्वर्गेपी पूजितः । गाव: कामदुहो
  देव्यो:नांन्यत किंचित परं स्मृतं ।।
Cows are the path to heaven, they are worshipable even in heaven. Cows
  grant a desirable objects, therefore there is nothing superior to the
  cows.
(गाव:) = cow
ब्रह्म सूर्यसमं ज्योतिर्ध्य: समुद्र: समं सर:।
   इंद्र: पृथीव्य:वर्षीययाँ गोस्तु मात्रा न विद्यते ।।
Brahma Vidya, (ब्रह्म विद्या) which grants supreme bliss is compared
  to the Sun.Earth to Indra  deva but the cow, which does unlimited
  welfare to hunamy, cannot be compared to anything cow is without any
  comparison. Indeed there is no other being like a cow, which does
  welfare to human beings.
Yajurved (यजुर्वेद) 23.48
प्रजावतीः सुयवसे रुशन्तीः शुध्द अपः सुप्रपाणे पिबन्तीः। मा वस्तेन ईशत
  माघशंसः परि वो रुद्रस्य हेतिर्वृणक्तु।।
                 (अथर्व.-7.75.1)
In Athervaveda (अथर्ववेद)  there are verses which states that the cow
  are be protected and. It is considered a sin to kill a cow

.
In Hinduism We Respect, Honour and Adore the cow and Calf .
In Hinduism or Sanatan Dharma (सनातन धर्म) We see Cow as a Godess and as Mother (माँ). Therefore, the cow is considered a sacred animal, as she sustains us and our babies , elderly people etc with her  milk.
Since from ages Cow dung is  used as fuel in our houses as it is high in methane, and can generate heat and electricity.  Village houses are plastered with a mud/cow dung mixture, which insulates the walls and floors from extreme hot and cold temperatures.
dung is also rich in minerals, and makes an excellent fertilize in our farms.
The surabhi cow (सुरभि गाय) descended from the spiritual worlds and manifested herself in the heavenly spheres from the aroma of celestial nectar for the benefit of all created beings.
So cow is the most Holy Animal in Sanatan Dharma (सनातन धर्म)  Or Hinduism ,  She contains all 33 Crore Gods in her.
Answer: Cows are the only animals that gives milk to humanity. As a baby takes birth only a mother can feed it. Comparing this two, we can say cow is mother who is sacrificing milk which is prerogative of its own child for humanity.Many medicines are made from the urine of cows.
There is a verse

gavo me vyagrato santu gavo me santu prushtata, gavo me hridaye santu gavam madhye vasamyaham

When Lord Krishna says cows contain all deities in them and in the heart of cow saintly properties reside. Lord Krishna narrates himself as he is Kamdhenu among cows in Goloka.(Land of cows) who fulfills every desire.
Thus cows are considered very important and pious animal when Goddess Gayatri became cow and stood behind Lord Dattatreya and in the same fashion she supported Lord Krishna too. This is the reason why cows are there in the pictures of Lord Dattatreya and Lord Krishna.
Goddess Umiyamata, incarnation of Mother Parvati also has cow as her vehicle. Following cows are placid and calm, they are also great virtuous donors. As per astrology feeding cow is considered virtuous acts that removes any kind of trouble. Pacifying cows also gives peace in life. Therefore, cow is worshiped as a mother.
Comment: Goats also give milk and rural people of India during 90s drank goat milk. Indeed all mammals produce milk. Some verses about cow in Hindu mythology are allegorical.
Comment: @Parth Trivedi - Very nice answer , but as @ The Destroyer  said cows are not only animals that gives milk to us , though we mainly use it in large quantity . Also for desert people " Camel" is equally significant as Cows.


Where can you find out to whom a given Mac is registered?

Question: Is there a place in the OS that we can see to which person the OS is registered to?
Answer: The registration information that you enter when you setup OS X is stored in a hidden plist file in the system.
That data is stored the file /var/db/.AppleSetupDone if you run the following command in terminal you should be able to see that information:
<code>sudo cat /var/db/.AppleSetupDone
</code>
This will show you the information entered. You will need to modify this information with a plist editor. For warranty claims Apple will know who registered the machine for AppleCare.
Answer: I don't know whether the registration information is stored locally. If you call Apple, they can certainly tell you under which person the Mac is registered.


Syncing iPhone 5c with Banshee

Question: Hi everyone I'm running Ubuntu 16.04 LTS with Banshee 2.6.2, and the phone I'm attempting to sync is an iPhone 5c, iOS 9.2. I recently downloaded Banshee so that I can sync my phone, however it does not appear in the devices list. (It's definitely supported; I checked in extensions) It is recognized by my computer though, like with Shotwell asking me about photos and such. Any help? If it's relevant, I couldn't import any media to Banshee without disabling the Podcasts extension, as it would freeze. Thanks!
Answer: I don't think banshee supports iphone sync. I don't think anything can sync music to an iphone other than itunes.
The manual here: https://help.gnome.org/users/banshee/2.6/sync.html.en says "with the notable exception of..." meaning it cannot sync iphone or ipods.
Comment: Huh, really? According to Banshee's FAQ it says the feature has been available since 1.7.5, and in the extensions there is one for Apple support...

Syncing iPhone 5c with Banshee


What AP based champion can do the most damage in two seconds? not counting nunu or shaco.

Question: I'm trying to expand my champion pool but I want to find better champions, like Annie, that can kill someone in a single combo. Are there any other champions like this?
Comment: There're so many champions that can do such amount of damage in 2 seconds. After yor mentioned Annie, there's also Xerath, Lissandra, Syndra, Vel'Koz, Katarina, LeBlanc, Malphite, Anivia, Fizz, Diana, Veigar, Zyra, Rammus, Sejuani, Amumu. With proper build, timing and fingerspeed, you can instakill with any of those.
Comment: are you asking about single target or overall in a teamfight?
Comment: I main xerath, his damage isn't that big. I theorize that his damage has been reduced due to his range and AOE characteristics. His ap ratios are 45 to 75, not very impressive when people like ahri buttrape you in .5 seconds without any ap.
Comment: Ahri does even less damage than Xerath, since her abilities aren't beam-like and her spells have a small hitbox. In other words he can do more damage in teamfights than Ahri.
Answer: Taking into account that Veigar and Thresh have no AP limitation, those two champions would deal the most Burst, however usually you won't get enough AP on Thresh to compete with other AP burst champions.
Veigar however would be the champion with the highest single target burst in a realistic scenario. His skills and Items:
Q: 260 + 60%  AP
W: 320 + 100% AP
R: 500 + 120% AP + 80% enemy AP
Deathfire Grasp: 20% of Target Health and + 20% magic damage increase
Lichbane: 75% Base AD + 50% AP (75% Base AD of veigar on lvl 18 = 71.625)
Arcane Blade: 5% AP

Can hit in under 2 seconds. It is very possible to gain 1000 AP in a game with veigar with a normal build but I wouldn't recommend buying Lichbane a lot but I'll include it here for the highest possible burst damage in under 2 seconds.
Now If you open up with DFG you'll already have 20% of the enemies HP and a 20% magic damage increase.
This means you can hit for a total of: 20% HP + 1381.95 + 392% AP + 96% Enemy AP with DFG, Your Skills and an autoattack.
Let's say you're up against a Syndra on level 18 with 2000 HP, 600 AP and 100 Magic resistance while you have farmed up to get exactly 1000 AP.
If you full Combo Her you'd hit her for:
400 (20% HP) +
3920 (392 % of your AP) +
576 (96% of her AP) +
1382 (Base damage rounded up)
_______________________________
6278 Raw damage

Now even if you take her Magic resistance into account you'll still deal 3139 damage which is pretty much an overkill. So this is one of the more realistic burst scenarios but of course it differs from situation to situation.
In the end most champions that are designed to burst someone down have a huge damage potential and are good at their role. You could take champions like Annie, Leblanc and even a Cho Gath can deal a huge amount of burst damage if played full AP. But Veigar  has the highest amount of burst within 2 seconds in a realistic scenario.
Comment: I frequently 100-0 people with Brand as well if he can get fed, and he also does mass AoE at the same time.
Comment: How does Veigar's ult rework affect these numbers?
Comment: @JamesENL See Veigar's page on [wikia](http://leagueoflegends.wikia.com/wiki/Veigar). His passive gains stacks more easily. Q = 230 + 60%, W = 300 + 100%, R = 375 + 75% (with *1.5% increased damage for every 1% of target's missing health, up to double damage against targets below 33.3% of their maximum health*). Also, DFG was removed from the game, and Lich Bane and Echo have changed.
Comment: In short, you need more stacks to hit previous damage levels, meaning you have to do better at farming and landing skill shots. Your ult deals less damage against enemy champions with AP (no longer taking their AP total into account), but more damage if they're missing health. So it's better to use R last.
Answer: Ap ezreal does the most dmg to 5 people in 2 seconds.
Comment: Can you add a little more detail?
Comment: I would say that LB would do more assuming they are packed...
Answer: I think that when you are get lulu's ult on you, dat you can kill a champion in 2 seconds, no matter who you are playing. But it is still cheating XD
Comment: Why/how is it cheating?


Which material is considered non linear communication channel?

Question: Communication channels as far I have seen(Air and conductors) are modeled as Linear systems. Was wondering if there are mediums/materials that make the channel nonlinear? For example, if channel is through human body, how do I know if it's linear or not?
Comment: Can you give an example? Of the linear model of a communication channel.
Comment: @EugeneSh. any conventional passive circuit component and their combination is linear for example.
Comment: Put a ferrite bead on a wire and overcurrent it.
Answer: Linearity in the medium is usually limited by the variation of the dielectric constant Dk.  For cables with Dk reducing somewhat above 1Ghz and for optical fibre the same is true for single and multi mode glass fibres which causes diffraction due to the Dk value. So variations in Dk cause group delay skew variable and optical diffraction  variances.
I have tested my body up to 6GHz with an Anritsu VNA and and HP spectrum analyzers and  found no such cutaneous or subcutaneous external harmonic distortion or peculiar resonances other than natural inductive leads with variable capacitance.  However there must be some dielectric variation effects found in Nuclear Imaging but this is beyond my bandwidth to explain or professional experience although I have collected and created many such datasets in both CAT and MRI for my amusement in 3D analysis.  (most diagnostics are done in 2D)
Comment: Output waveform depends on conductance, and capacitance which depend on surface area, source and load impedance and current limit. I don't know if they use current source or voltage source, I suspect current pulse to overcome electrode oxidation, which translates into muscle force from xx uA currents.
Comment: So basically if a pacemaker(located inside the heart) for example sends a pulse train, and if I put some sort of sensor that can pick that up in palm of ones hand, then I should expect the same pulse train(plus interference of course)?
Comment: You're right, that depends on the electrical model. They use voltage source. So bottom line is it's expected to be linear: If a `Sin(w)` is applied to one end, `a.Sin(w-phi)` should be observed at the other end.


English word for the Afrikaans word "bies"

Question: I tried google translate with no luck. This may be a translation of a word only a person who has spent time on a farm would know. When a cow gives birth to a calf there is a type milk that the calf has to drink soon after birth. It has a yellow tint to it and contains the antibodies that are crucial to the calfs survival. This is also consider to be a truly remarkable type of milk. In Afrikaans this yellow milk is called bies. I was wondering what the English version of this word was?
Comment: Have you tried searching for `calf first milk` with a web search engine of your choice?
Answer: Humans have this kind of milk too, it's called colostrum.
There is another word, "beestings" in the dictionary. I'd not heard this word, but it seems to be more agricultural than medical. It's clearly cognate with the Afrikaans word. It seems more common in Irish dialects.
Comment: Humans, and also every other mammal produce colostrum.
Comment: Well, I'm neither Irish nor from a farming background, but I immediately thought of _beestings_, a  word I knew from general reading.


Can people know the server I'm connecting to despite being on SSH/HTTPS?

Question: I understand that by connecting securely over SSH or HTTPS, the data that I transfer is cryptographically secure. However, can someone spying on my connection still determine the server I'm sending it to? If they can, what are the risks? What information can they get from it?
Comment: They can see the domain name, yes, but not necessarily the exact server, depending on how the specific site is set up. see http://security.stackexchange.com/questions/4388/are-urls-viewed-during-https-transactions-to-one-or-more-websites-from-a-single
Comment: This is NOT a duplicate, it's a better, more generalized question.  The previous question was a technical one.  This one is closer to the general case.
Comment: Do you mean ssl?
Comment: In principle, in any information exchange system that relies on third parties (post office, internet...), every middle man needs to know how to route the data (hidden or not) they get to where you want it. Putting messages inside of messages (i.e. a VPN) could hide the endpoint of your traffic, depending on where the attacker is in the chain.
Answer: They can. In order to establish a secure HTTPS connection a handshake must happen between you, (the client, i.e. your browser or any other application) and the server. Any data sent within the handshake is not encrypted.
About the risks, it's a broad topic to discuss. The plain information that you are connecting to some public server (Facebook, Gmail, etc.) might be useless, but there might be situations when this information actually might be a leverage for the attacker. It depends on the concrete situation.
Answer: Yes.  This is called "Traffic Analysis".
Broadly speaking, the useful information that can be obtained is who you're talking to, and when.  So if you're ssh'ed into a server and the packets look like someone typing, it then looks like you're up and actively engaged in some activity with that server.  The volume of the data going back and forth can be enlightening as well.
Traffic analysis is widely used by Law Enforcement and spying organizations.  For example, it was used to obtain search warrants on a Lulzsec hacker connected via TOR to anonymous chat forums.  The content of the message can't be obtained, but the fact that traffic is going back and forth at the same times as a confidential informant is talking to a known anonymous hacker can be enough to obtain search warrants, or further investigations.
Answer: Sure, they can. A proper encryption is supposed only to hide the content, but is not expected to hide:

parties involved in the communication
size of data exchanged
timing of packets
(anything else)

Moreover, some data may be leaked from the initial handshake. For example, HTTPS with SNI leaks the domain you are connecting to in plaintext even if the adversary can't see your DNS traffic. This is usually a minor additional leak. (Note that there are some arguments that SNI does not usually make the situation worse, it just makes the problem more visible.)
Asking about risks (and mitigations) of disclosing the server you are connection to is a too broad question there. It mainly depends on what you consider to be secret. BTW, other potential leaks (e.g. data size and packet timing) seems to be more interesting.
Answer: Both SSH and HTTPS (relying on SSL or TLS) use encryption, but are based on an established TCP/IP existing connection. This means that even if the content is opaque, all TCP/IP information are in clear and available to someone sniffing your network.
TCP/IP information includes IP address of each peer, port numbers used. This gives a good hint about protocol and kind of traffic.
Some information may also be exchanged during the handshake, giving out some information. For example, if SNI is used (when multiple HTTPS web servers share the same IP), the name of the website is part of the TLS handshake and could be available.
As a side note, even being blind about the content can giveaway information. I know about attacks on interactive SSH sessions that measure the time between keys typed to deduce the commands executed, the typing habits of the person, and even what keys were pressed.
Answer: It depends entirely on the topology of the network used to connect your computer to the server.
If your computer is connected to the server directly using an ethernet cable or similar connection, and those computers and cable are inside a secure room and you have made sure that nobody saw you entering the room then NO, nobody can know you have connected to that server.
But if you go through a network involving third parties, like the internet, then some members of those parties need to know who are you sending your encrypted data to. How would they know where to send it otherwise? So, yes, your Internet Service Provider can know where you are sending data. And so can any agency with legal or illegal power over your ISP. That is true for HTTPS, SSH and each and every kind of protocol, encrypted or not.
One way to avoid that is to use a third party which you can trust not to leak that information. Like the TOR network. Or a VPN.
Answer: There are several technologies involved in creating a secure connection (the network protocol stack). Each layer solves its own part of the job to make connections work. The parts of the stack that are relevant to your questions are:
HTTPS
TCP
IP

You can notice that HTTPS sits on top of TCP, which works on top of IP. HTTPS cannot change how underlying protocols work, thus encryption is added only to itself (and on protocol that works on top of HTTPS if any). IP packet header contains IP address of the host you are connecting to and TCP packet header contain port. So, unless underlying TCP and IP data is not embedded itself into some sort of encrypted channel (VPN, for example), whoever captures your network traffic in transit would be able to figure out target host/port.


Switching to a three prong outlet

Question:
This outlet has two copper (ground) wires twisted together and it also had a black cap on it. This had a two prong plug originally and we are looking to switch it to a three prong. Do I untwist and only use the ground wire that's around the back screw to ground to the new three prong outlet?
Comment: You might want to check that the ground actually goes somewhere... a multimeter should show nearly 0 ohms between ground and neutral. (Turn off the main breaker before checking!)
Comment: The two bare ground wires look like they might not be securely twisted together. Just to make things simpler, get a premade green 12 gauge short grounding "pigtail" wire and use a red size wire nut to attach the two bare ground wire ends and your pigtail wire bare end together securely.  Then, just attach the other (sheperd's crook looped) end of the green pigtail wire to the green grounding screw on your new outlet.  Be sure to watch a youtube video on how to use a wire nut, and on how to replace a 2 prong outlet with a 3 prong outlet.
Answer: Since it is a metal box which is grounded, installing a 3 prong (grounded) outlet will be grounded via the mounting screws/tabs. No need to connect the ground to the outlet.
Comment: _Technically_ the ground wire should have been wrapped around a 10-32 screw placed into an appropriately threaded hole, not the cable clamp screw, but I don't see any reason it wouldn't _work_ as is. It just might not pass a picky inspector.
Comment: The new outlet might not have a self-grounding tab either.
Comment: @FreeMan  Yeah, I noticed that too. It's in my category of safe-it works, but clearly not code compliant.   To Armand, most outlets are self grounding if in a metal, grounded box.  The OP could undo the ground, pig tail to a proper screw in the box and to the outlet to make it code compliant.   But it's functional, if not code compliant as it is.
Comment: @FreeMan  another comment, risking on getting conversational here.  I doubt an inspector would be that thorough. When I wired my new house and the inspector did the rough in inspection he only caught a few things like I didn't have all the ARC fault breakers covering the required areas (had to add 3 more).  But I was waiting for final before getting the POCO to hook up permanent power, I finally called them (L&I  in washington counties), and they just said: If you can do the rough in we figure you can install fixtures and outlets, no followup, good to go.
Answer: That's a metal box.  The ground wires coming in need to ground to the metal box first.  So leave them wire-nutted to a pigtail that goes to the ground screw in the back of the box.
If you want to ground any receptacle, you can add another ground pigtail that wire nut, and run that to the receptacle.
However if you use a better receptacle that is marked "Self-Grounding", the receptacle will automagically pick up ground from the metal box via its mounting screws.  Most better ($3+) receptacles have this feature, which is a brush or wiper that contacts the mounting screw.
Switches can self-ground this way, regardless of being marked "Self-grounding", because they're not serving ground to anything but themselves.

Switching to a three prong outlet


Objects in Illustrator doesn't align perfectly

Question: When working on logo design projects, there are some things in Illustrator that doesn't work perfectly. For example, when I need to make rectangle and then put in rounded rectangle and then aling to centre, it doesn't do that perfect. Why? There are lots of more examples to tell you but I think you get the point what I'm talking about.
Comment: Is snap to grid on or off?
Comment: Snap to point is on with 1px.
Comment: Just tried to make some objects and to edit those who had problem, but still exist. I needed to put very close two rectangles but program doesn't allow me to do, it goes over other object or way too much space from it.
Answer: For anyone else searching, I believe the problem is a little option when you first create a new document. It drove me crazy for the longest time. It causes objects not to line up correctly. Unclick align to pixel grid, and you should be good to go.
Pixel grids are useful for designing icons for the web, and web design in general, but when creating logos it can cause problems. A pixel grid is different from a regular grid.
Comment: One of the most devious checkboxes in Illustrator indeed!
Answer: Aligning objects, (and especially strokes) in Illustrator can be tricky. There are two options that are relatively hidden / hard to grasp, and that can easily make your life hell if you don't know about them.
1 - When you create a new document:
Click "Advanced", then "Align New Objects to Pixel Grid" to uncheck it.

2 - Transform Panel
In Window > Transform, you also need to make sure, after selecting your object, that "Align New Objects to Pixel Grid" is unchecked (one would think that this option is disabled after you went through Step 1, but nope).
It's also important to notice that you will need to do this for every single object that you want to align precisely (yes, just because one object can be aligned precisely and just because you went through Step 1 doesn't mean that you can align it if the object you want to align it to has that checkbox ticked...).
Also, it's very important that you do not uncheck this box by mistake. If you select precisely aligned objects and uncheck it, your objects will all shift significantly out of alignment.

3 - View Menu
In the View Menu, uncheck "Snap to Pixel" and other "Snap" options.

Voilà! You should be able to create freely...
Answer: If I understand you correctly, you have two or more objects, and want them both/all to centre. Some screenshots of your problem might help, but if I got it right, here is what I would do:
In align options, choose horizontal align centre

Then choose vertical align centre

And you will get this:
Answer: The "Use preview bounds" option (in the pulldown of the align menu [shift+f7]) can also cause unexpected results.
However, I think the snapping is what is causing your problem. In pixel-preview mode a 1 pt line will be 1 pixel wide. Illustrator will snap your anchor points (not the stroke edge) to the grid. So the stroke will end up half a pixel over the grid.
You can try setting the 'Align Stroke' option in your stroke menu (ctrl-f10) to go to the inside of the object. That way the edge of the stroke will align with the outer edge of your path.
Answer: Stroke weight is ignored in alignment, so an object with a 1pt center stroke will appear offset by 0.5pt on its axes, for example. Setting stroke alignment to "inside" will prevent this, and any blurriness when rasterizing strokes of odd-numbered weights.


ArrayFire AF_BACKEND_CPU not multi-threaded?

Question: I usually use the OpenCL backend when I use ArrayFire.  I was using Intel OpenCL on my i7 CPU.  When I switched to the AF_BACKEND_CPU backend my code was about 10-15x slower.  I checked and noticed that it was only running on one core.  I also suspect that it is not using SSE or AVX instructions which accounts for the rest of the slowdown since my processor only has 4 cores.  I feel like the ArrayFire cpu backend should be faster.  Is there a way to make it multithreaded?
Answer: The CPU backend is not yet multithreaded. But from version 3.4.0, I suspect it will change (see "Sparse Support, Thread Safety, Parallel CPU" on https://github.com/arrayfire/arrayfire/milestones)
Answer: I was wondering the same thing. It turns out in the meantime the milestone has been moved to 3.5.0 (https://github.com/arrayfire/arrayfire/issues/451).
As far as I could see only one core is used from AF by now. So 4 cores is still 3 too much.
In general I'd suggest using AF together with the GPU and creating af::array's only when needed, since there is no way otherwise to hold data just on the GPU or just on the CPU (see How to explicitly get linear indices from arrayfire? and http://forums.accelereyes.com/forums/viewtopic.php?f=17&t=43097&p=61730&hilit=copy+host+memory+into+an+array#p61727 on how to construct af::arrays ad-hoc.)
Also as a general rule of thumb for many tasks the GPU implementation still much fast than the CPU implementation, even if the task is not suited perfectly for the CPU. See for example sorting algorithms which normally involve a lot of branching.
If you insist on using the CPU in parallel you could also try to put OpenMP, MPI or just stl::thread on top of AF and parallelize like this. I didn't gained a lot with stl::thread for sorting operations though.


Looking for sources that support needing a mechitzah in shul for activities other than davening

Question: What are sources that support having a mechitzah or for gatherings in shul outside of davening such as kiddush, adult education, or other seudas mitzvah? Also helpful are sources that are against not having one. Thank you
Comment: Igrot Moshe OC 1:41 and 5:11
Comment: "Against not having" sounds the same as "support having". Do you mean "against having one"?
Comment: What difference does it make? If it is there to prevent histaklus b'nashim and any resulting kalus rosh etc. why should it make a difference if its a kiddush or shiur?
Comment: @shmosel it may sound the same and the result might be the same but the way the topic might be discussed would be different. This is the difference of being in favor of something versus being against the opposite. I've included both descriptions so that answers to this question could be more inclusive. If I only asked for arguments in favor then technically any answer which only focussed on being against not having one wouldn't answer the question.
Comment: @TamirEvan edited now
Comment: @DoubleAA, isn't it IM 1:39
Comment: Last 2 paragraphs of that teshuva specifically, hard to determine what a tzarich gathering is vs a non tazrich gathering .
Comment: What's the difference in regard to this question if the gathering is needed or not needed?
Comment: There seem to be two details in your question that aren't clear. Is your question specifically about mechitzot (meaning that specific tool/structure) or simply the separation of men and women generally? Also, you are specifically asking for "sources". Does this mean you are seeking a diverse range of textual citations regarding the subject?
Comment: @YaacovDeane a mechitza is the tool which accomplishes separating men and women. Sources are are textual citations. A single source would be helpful. A diverse range of sources would be even better.
Answer: Rav Moshe Feinstein writes that for gatherings that are non-obligatory, such as weddings, he is in doubt as to the need for a mechitzah. He proceeds to bring a number of proofs that there is no obligation to erect a mechitzah for non-obligatory events, as we find concerning eating the Korban Pesach, and in other sources.
In another teshuva (Yoreh De'ah Vol. 4) he notes that the obligation for a mechitzah applies only to events that are open to the public, and not to private affairs (such as weddings) that are not open to the general public. For a Torah lecture open to the general public Rav Moshe writes (Orach Chaim 5:11) that there is an obligation of a mechitzah (since it is open to the general public), but if there is no option one should not refrain from teaching in such an environment, where doing so is for Kiruv purposes.
Other authorities are far more stringent, and write that even at weddings and similar functions there is a full prohibition on mixed seating of men and women. Rav Moshe Sternbuch (Teshuvos VeHanhagos 2:65) writes (concerning South Africa, where most weddings were mixed) that there is no room for leniency, noting that according to the Bach the Simcha Bime'ono blessing is not recited in a mixed environment, and adding that rabbis should refrain from attending such weddings (see also Shut Lev Avraham 1:135, who disputes Rav Moshe's ruling at length).
Comment: A warm welcome to MY, we hope you stay and continue to make excellent contributions like this answer!
Comment: how are weddings and the karbon pesach non obligatory?
Comment: the question asks for sources that say it's necessary so if igros moshe is saying it's not necessary then that doesn't answer the question
Comment: Reb Moshe, like Rambam, distinguishes between preventing the men from gazing at the women (which relates to the subject of mechitzah) and the obligation to avoid frivolity (which doesn't necessarily require a mechitzah, only some means to avoid mixing) meaning physical contact of the hands, etc.
Answer: This is based on the general principle that the Shul, the בית כנסת, is considered to be G-d's residence (מעונו).
And in this context, in all places where ten or more congregate, separation is relevant, just like with the בית המקדש.
See Bereshit Rabbah 55:7 for the concept.
And this concept is emphasized in Sefer Chassidim 393:1 by Rabbi Yehuda HaChassid,who says:

כתיב (דברי הימים א טז כז) הוד והדר לפניו עוז וחדוה במקומו לכך אמר שהשמחה במעונו. לכך אמר פסוק שיש בו רמז השם בשמים ובארץ כגון ישמחו השמים ותגל הארץ ר"ת השם של ארבע אותיות. כשיש גילה בארץ ברעדה אז שמחה בשמים לפניו. כל המברך שהשמחה במעונו צריך לחקור אם קיימו וגילו ברעדה אם רעדה במקום גילה. אבל אם לוקח אדם אשה שאינה הגונה או היא לוקחת איש שאין הגון או שניהם אינם הגונים. או אין תרבות שם ונבול פה ביניהם. או נשים יושבות בין האנשים שהרהורים שם לא יתכן לברך שהשמחה במעונו. ועל אלה וכיוצא בהם נאמר (ירמיהו טו יז) לא ישבתי בסוד משחקים ואעלוזה. וכתיב (ישעיהו כח ח) כי כל שלחנות מלאו קיא צואה בלי מקום לא אבוא שמוע בגימטריא עשרה אומר שכינה לא אבו שמוע דברי תורה ולשמחה מה זו עושה כתיב מה זו עושה בין תלמידי חכמים ובין לצים כל מצוה הבאה עבירה על ידה מוטב שלא יעשה המצוה כמו מצוה לשמח החתן. ואם יש שם פריצי' ויודע שבלא פריצות לא יהיה או אינו יכול להיות בלא הרהור או אינו יכול להיות מלראות בנשים אל יהיה שם:

These are very strong words from Rabbi Yehuda HaChassid and he is not mentioning mechitza at all, but the possibility, or worse, the  likelihood of frivolity. He says in such a place it is better not to be present, even for a mitzvah like a wedding.
And it shouldn't be missed that the posuk from Tehillim 96:11 (and also 1 Divrei HaYomim 16:31) that Rabbi Yehuda HaChassid uses to illustrate this concept actually contains two names of G-d, the one from the Roshei Teivot pertains to the men (יהוה) and the one from the Sofei Teivot (in reverse order) pertains to the women (צלמו). And these two names are in separate locations (beginning and end of the words), not mixing or touching.
The balance of this answer can be found in part 5 of the following web site dealing with the subject of the need to separate men and women in the Beit Knesset.
The concept of the separation of men and women in the Beit Knesset is learned from the practice which was instituted in the Temple like is mentioned in Sukkah 51b which says:

בְּמוֹצָאֵי יוֹם טוֹב כּוּ׳. מַאי תִּיקּוּן גָּדוֹל? אָמַר רַבִּי אֶלְעָזָר: כְּאוֹתָהּ שֶׁשָּׁנִינוּ: חֲלָקָה הָיְתָה בָּרִאשׁוֹנָה. וְהִקִּיפוּהָ גְּזוּזְטְרָא, וְהִתְקִינוּ שֶׁיְּהוּ נָשִׁים יוֹשְׁבוֹת מִלְמַעְלָה וַאֲנָשִׁים מִלְּמַטָּה.

The men and women are seated separately. The women are seated above and the men are below preventing the men from viewing the women.
There are some important points regarding the details mentioned in Sukkah 51b that should be noted.
It mentions the differences between the first Temple and the second Temple. In general, the sanctity of the first Temple was greater than the sanctity of the second Temple.
In the description of the first Temple, both the men and the women stood. In the second Temple, the language used refers to sitting (יוֹשְׁבוֹת). The general rule is that only the King and the Kohen Gadol are permitted to sit in the courtyards.
It mentions in regard to the time of the second Temple, both the Temple in Jerusalem and the similar copy (the Beit Knesset) that was in Alexandria in Egypt.
It emphasizes that this principle of increased separation was manifest both in regard to the Beit Knesset in Alexandria (the men were separated according to their trades/professions) and with the second Temple in Jerusalem (the place where the women stood in the Women's Courtyard was reversed with that of the men and ultimately the balconies were built to physically elevate the women above the level of the men and to have the women sit). This increased separation is a sign of the decreased sanctity of the second Temple.
There are two reasons mentioned as to why this separation was made. The first is according to the view of Rambam in his commentary to Mishnah Sukkah 5:2 which says that it was to prevent the men from gazing at the women.

שהיו מכינים מקום לנשים ומקום גדור לאנשים, ומקום הנשים למעלה על מקום האנשים גבוה ממנו כדי שלא יסתכלו האנשים בנשים.

The second reason is like is discussed by Rabbi Moshe Feinstein in Igros Moshe, Orach Chaim, Vol. I, Simonim 39-43. Reb Moshe says the reason is to prevent mixing.
Reb Moshe bases this on wording from Rambam used in Mishnah Torah, Hilchot Shofar Sukkah v'Lulav 8:12 which says:

והיו מתקנין במקדש מקום לנשים מלמעלה ולאנשים מלמטה כדי שלא יתערבו אלו עם אלו.

Reb Moshe goes further in Igrot Moshe, Orach Chaim, Volume 1, 39-40 to clarify that  this concept of the separation of men and women is because of the obligation to avoid frivolity in the solemn environment of the Beit Knesset.

ורק בשביל קלות ראש הוא חיוב המחיצה.
קלות ראש שהוא להרבות שיחה ביניהם ולנגיעה בידיהם וכדומה

Reb Moshe explains that frivolity is the idea of talking and the touching of hands (perhaps like when passing food between one another) and similar things.
It should be noted concerning the responsa in Igrot Moshe that his language is with many qualifications, in particular about what is and is not considered to be a Beit Knesset. Even a place for fixed prayer and with a regular quorum may not be assumed to have the status of a Beit Knesset. There are about half a dozen letters discussing the subject and many refer back to earlier letters, clarifying his view. The question posed here is about a "Shul", which is usually understood to mean a valid Beit Knesset. The responsa from Igrot Moshe must be read in that that context.
And this concern over frivolity is also the ruling from Rabbi Shlomo Ganzfried in Kitzur Shulchan Aruch 149:1 which says:

צְרִיכִין לִזָּהֵר שֶׁלֹּא יֹאכְלוּ אֲנָשִׁים וְנָשִׁים בְּחֶדֶּר אֶחָד. שֶׁאִם אוֹכְלִים אֲנָשִׁים וְנָשִׁים בְּחֶדֶר אֶחָד, אֵין אוֹמְרִים שֶהַשִּׂמְחָה בִּמְעוֹנוֹ, כִּי אֵין שִׂמְחָה כְּשֶיֵצֶר הָרַע שׁוֹלֵט.

A similar distinction is made by the Tzitz Eliezer, vol. 7, siman 8, who emphasizes that the type of mechitzah required for the Beit HaKnesset during prayer must make it impossible for men to see women. He says traditionally this was a floor to ceiling wall with small holes high up the wall to allow for the sound of the service to be heard by the women. But a different type of mechitzah for the purpose of modesty and to prevent frivolity is less stringent. It can be used for things like lectures where men and women will attend together, whether organized or not. But he emphasizes that even in these situations not involving prayer, some type of mechitzah is required.
In this context it is worth noting the comment of Rabbi, Dr. Yoseph B. Soloveitchik who wrote in his book on Mechitzah, Pg. 13 the following:

The separation of the sexes in the synagogue is a basic tenet in our faith. It dates back to the very dawn of our religious halachic community, and constitutes a Torah prohibition which can never be abandoned by any legislative act on the part of a Rabbinic or lay body regardless of its numeric strength or so-called prominence. What was decreed by God can never be undone by human hand.
Comment: Rabbi, Dr. Yoseph B. Soloveitchik opened a ran a coed day school. Your selective quoting from him to try and confuse your readers is disingenuous at best.


How many times should an unverified user be allowed to post on a social site?

Question: If you allowed user to post content on social media site prior to verifying email, in order to increase conversions, how many times should he be allowed to do so?
What anti-spam measures you can put in place to prevent these potential problems?
Answer: I think you are looking at it the wrong way. Limiting the number of posts isn't going to solve the spam problem.
You really have 2 problems to solve here:
Allow user interaction before confirmation
Personally, I would just force confirmation before allowing any posts, but that's just my opinion.
However, if you wan't to take your approach then it makes more sense to limit the frequency rather than the number of posts. For example: Limit new users to 1 post every five minutes.
This might even make sense for new users even after email confirmation, say for the first couple of days.
This also solves the problem of spam bots trying to flood posts, even ones that have verified their accounts.
Dealing with spam
You can't deal with spam just by limiting posting. After all, it only takes one post to post spam.
You need to have spam detection methods. It could be an algorithm that auto-detects it, or it could be a community flagging feature, or preferably a combination of both.
Then, once a new users get flagged as posting spam, you immediately lock their account until it has been reviewed. If their posts were turn out to be false spam, then you can unblock them.

In summary, force verification before allowing users to post - it's really not hard to verify an email these days.
But don't expect verification to be a reliable method of preventing spam. You need more dedicated features in place to deal with that.
Answer: In a lot of digital spaces, we let user try the platform out or use it enough times to become habit-forming. This makes sense for things like note-taking apps, calorie counters, etc.
Social sites are different -- conversion is going to come from other users' interaction with and amplification of content, not from the habit of posting multiple times.
In addition to spam, unverified users could enact many undesirable behaviors including impersonation, trolling, and harassment, which could harm your entire platform. So to answer your question, I would say no posting before email confirmation, but make confirmation as quick and non-disruptive as possible.


looking for simulated annealing implementation in VB

Question: Is anyone aware of a reasonably well documented example of simulated annealing in Visual Basic that I can examine and adapt?
Answer: This project looks pretty well documented: http://www.codeproject.com/KB/recipes/simulatedAnnealingTSP.aspx. It's C# but contains only one important source file (TravellingSalesmanProblem.cs) so it's pretty easy to run it through a converter. Maybe: http://labs.developerfusion.co.uk/convert/csharp-to-vb.aspx?
MSDN magazine also had an interesting article on neural networks. As I understand simulated annealing, you can add it to other function estimation methods (like neural nets). So you could add simulated annealing to the MSDN VB code by shrinking the Momentum over time. The network starts 'hot' by backpropagating error with a large Momentum and slowly 'cools' by shrinking the Momentum and thus reducing the effect of output error in backpropagation.
Cheers.
Answer: I generally refer to "Numerical recipes in C/C++" for all the pseudocode and adapt to my own later. That is the best documentation/implementation you could find. Sometimes you could even find better algorithms or an alternative way of solving. (In case Newton Raphshon is not the way to go)
Comment: Can you give a link to this library? Thanks.


Nuclear Compton Scattering Data

Question: Is there a repository where one can find unpolarized nuclear Compton scattering data $\gamma (Z,N)\rightarrow \gamma (Z,N)$ for specific nuclei $(Z,N)$?  or even some parametrization of structure functions that loosely follows the data?
Comment: I don't know of any, but check out http://www.dmoz.org/Science/Physics/Particle/Software/, as well as the PSI website. They mention a free service (you don't run it on your machine) that simulates scattering events.
Answer: Try exploring the National Nuclear Data Center. If I search the Evaluated Nuclear Structure Data File for "incident particle: g" and "outgoing particle: g" I get datasets for most, but not all, nuclei. There are other databases hosted by the NNDC as well, and all are well-referenced to the experimental literature.
Comment: Of course, the ENSDFs are a bear to read and interpret. But then most major simulation packages already know how to do that.

Nuclear Compton Scattering Data


Interpretation of gravitational waves

Question: A wave has peaks and valleys. I can think of a sine wave as a wave with peaks and valleys.
Now, if gravity is a wave, can we say that gravity would have peaks and valleys, with the valley becoming negative? In other words, in the picture of gravitational waves, can gravity become negative or 0? If yes, what does negative gravity mean? Repulsive gravity?
Comment: "A wave has peaks and valleys." not always true--eg. could be a positive pulse.
Answer: Gravitational waves are waves of tidal forces.  If a gravitational plane wave passes, it alternates pulling  you apart in one direction and squashing you in the orthogonal direction.
Answer: First of all, waves can have any shape.  Sines and cosines are the simplest waveforms, and in fact you treat a wave with a more complicated shape as a sum of multiple sine and cosine waves with different amplitudes and frequencies called a Fourier series.  This fact is helpful, because it means you can figure out how any wave behaves by considering only the simplest waves.
Before we think about a gravitational wave, let's think about a sound wave.  The thing that oscillates in a sound wave is the pressure.  As the sound wave passes, the pressure increases above ambient pressure, and then decreases below ambient pressure.  The equilibrium point of the oscillation is not zero pressure, it is the ambient pressure.  The pressure oscillates up and down, but it doesn't ever go to zero or to a negative value.
A gravitational wave has similar behavior.  The thing that oscillates in a gravitational wave is the metric.  The metric tells us how to measure distances in spacetime and is related to the curvature of the spacetime.  But the there is always an ambient, non-zero, equilibrium metric.  When the metric increases the spacetime between objects expands, increasing the proper distance between them.  When the metric decreases the spacetime between objects shrinks, decreasing the proper distance.  The oscillation doesn't make the distance go all the way to zero or flip the sign of the distance to negative.
Answer:
A wave has peaks and valleys.

This is not necessarily true. In particular, it assumes the existence of an order relation on the values of the wave (i.e. that we can meaningfully say that the peaks are "greater" than the valleys). However, this is only the case for scalar quantities like in sound waves (pressure) or water waves (height). For other types of waves, like electromagnetic waves (electric field and magnetic field vectors), it does not make sense to talk about peaks and valleys (unless dealing with some scalar quantity calculated from the vector/tensor/etc). Since gravitational waves are oscillations in the metric tensor (i.e. not a scalar), it is not particularly meaningful to say that they have peaks and valleys, or to say whether they are positive or negative.
Answer: Waves are moving perturbations of and/or on a substantial medium. So, if "space" (or "space-time") is either nothingness or an immaterial fabric of spooky geometry (or pure 4-D maths), then how could gravity make waves?
BTW, "space" is an artifact of our perception of "things" and "places" that exist in our "field" of experience. Of course, all of that is enabled by the intrinsic principles of being, like form, structure, functionality, dimensionality, causality, identity, multiplicity, complexity, etc. "Time" is a concept we associate with our misperceptions of change, etc. Thus, a "fabric" of curvy "space-time" is clearly as fictional as unsupportable beliefs about "dark" matter/energy that we cannot directly detect. Hence, no amount of beautiful maths will ever make fictions, conjectures, approximations, and maps more real than the territory (the cosmos).
Yet, if somebody can explain how an omnidirectional "force" (G) without a motivator can cause effects (waves) in nothing, then I will be amazed. However, I will then expect to see their proof of the Navier-Stokes equations problem and the Yang-Mills band gap problem and get the two $1-million prizes (before I do).
So, best of luck etc. ~ M
Comment: Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer).

Interpretation of gravitational waves


WCF Service Start

Question: I have a wcf service and i want to call a method automatically , immediately after the publishing in IIS. Like an initialization of the WCF service without having to call the method manually or from somewhere else. Where should i place my Initialize method in WCF Service in order to run exactly after the start of the application?
Answer: If you're hosting in IIS you can use the application_start event within the Global.asax of the web app that hosting tHE WCF service to do any application initialization. If you are trying to call one of your services when it is first installed then this is likely the wrong approach.
What is the motivation for running some code on start up of the web service? If you are trying to get around a slow initial call to the WCF service I suggest you would want to do some work on the WCF client-side rather than in the service...but Im just guessing at your motivation here
Answer: Initialization of the WCF service? So do you have singleton service or do you want to initialize some global state? Otherwise initialization doesn't make sense because service instances will be created for actual clients.
By default IIS starts application when it is accessed first time. If you place initialization in Application_Start (HttpApplication or Global.asax) the code will run when the application is first accessed. But accessing the service is not something that your application can initiate.
IIS 7.5 (Windows 2008 R2) has warm-up module which can run some code when pool is recycled or worker is restarted. If you use other version of IIS you have to use some external solution like custom application pinging your service in regular intervals.
Comment: A WCF service configured with the single instance mode gets its instance automatically created by the hosting platform. So the initialization will take place right after deployment anyway (assuming the initialization is properly done in the constructor)

WCF Service Start


What exactly does Unreal Engine 4's Class Wizard do?

Question: I know "it adds classes to your project" and "creates boiler plate code for you" but what does that actually mean? Does it do anything besides properly generate your .h and .cpp files for you?
Answer: I've never used UE4 but I've used UE3.
And yes by reading at the documentation, I believe it indeed does more than setting up two files with boilerplate code. Quotation:

This converts a content-only project into a code project.

That should mean:

Creating a Visual Studio or Xcode solution for the generation of user DLLs,
Preparing it for compilation (c.f. this page),
Maybe some messing up with the Unreal game project and its packaging, as the game will now run those custom DLLs instead (on top?) of the stock ones.

Probably more, but you get the idea.
Answer: It adds 'boiler plate' code to your project, based on what have you choosen. By doing this you are converting your content-only project to code project and that means that you can build it from Visual Studio/Xcode, and it will also slow down the building process. You can use the classes you have written in C++ in Blueprints, too.