LDP: which FEC to advertise when using Ordered Control?

Question: I have the following doubt: if an egress router knows how to reach a set of subnets, is it expected to bind all those remote destinations in just a FEC (one label) or has it to bind a label for each of those?
Comment: Did any answer help you? If so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you can provide and accept your own answer.
Answer: Depends on what you mean by a destination. In IPv4 world, FEC is actually an IPv4 prefix (or a route in other words). Simply put a router will map each prefix it learns via IGP to a label. RFC 3036 describes FECs as follows:

2.1. FECs
It is necessary to precisely specify which packets may be mapped to
  each LSP.  This is done by providing a FEC specification for each
  LSP.  The FEC identifies the set of IP packets which may be mapped to
  that LSP.
Each FEC is specified as a set of one or more FEC elements.  Each
  FEC    element identifies a set of packets which may be mapped to the
  corresponding LSP.  When an LSP is shared by multiple FEC elements,
  that LSP is terminated at (or before) the node where the FEC elements
  can no longer share the same path.
Following are the currently defined types of FEC elements.  New
  element types may be added as needed:
<code>  1. Address Prefix.  This element is an address prefix of any
     length from 0 to a full address, inclusive.

  2. Host Address.  This element is a full host address.
</code>
Comment: Now I read and try to understand, However I have this in mind: an egress router knows how to reach x, y and z networks (in IPv4 world). Is it expected to bind the same label to each of those or one different for each of those? My doubt arose when I thought that in the MPLS domain it is not important which is the final destination since it is "ip-free", and therefore it is sufficient to carry the packet to that egress router. Thanks for answering (and forgive my english)
Comment: In other words, I'm assuming that x, y and z are "indipendent" networks, but reachable by this egress router
Comment: @Luigi2405, in that case, a router will generate a label per each network


Light-field shots entirely in focus?

Question: A light field camera can be used to make shots which can be truly refocused after the shot, however if I understand the technology correctly it would be just as easy to process the "image data" in such a way that you can get a shot which is entirely in focus, which seems even more interesting than after the fact focusing. However, as far as I know with the current light-field camera(s) this is not possible, so is this technically impossible or is there another reason this has not yet been done? (Such as it being possible somehow with traditional cameras?)
Comment: Relevant - http://petapixel.com/2014/04/22/lytro-unveils-illum-light-field-camera-features-1-inch-sensor-costs-1600/ - note that in the preview thing there, the perspective shift actually does just this.
Comment: @AJHenderson: WOW! I had seen those previews before, but didn't notice the drag functionality until now. Got to say I also don't get why there is that 3d effect and I only noticed now that often the background layers (as the viewer at least I also noticed now works in layers) isn't in focus no matter what... oh well, looking forward to the results when it gets on the market.
Answer: It is certainly possible through a similar principal to focus stacking.  If that feature actually isn't available, it's entirely opinion as to why it hasn't been added unless they have some disclosure of that, but the same focus stacking technique that works for traditional images would work for individual slices taken from a light-field shot.
As for why this is necessary with a light-field camera, think about determining what part of the image is in focus.  The camera may capture the image at an infinite number of focal depths, but in order to piece together an image that is more in focus than the optical system would have produced for a given selection of focal plane, parts of the image have to be taken from different focal distances and this means that each pixel has to be selected for the most in focus distance and blend them with the sharpest parts from other parts.  This is the same if your source is either a light-field camera or a still camera, the only difference is the simplicity in capturing the depth information.
If I had to guess, I'd say it is because the entire point of a light field camera is that it gives depth of field blur but still allows shifting.  If someone want's an image entirely in focus, there's not much reason to use a light-field camera since you don't gain anything by its use, but you give up a whole lot of resolution.
That said, I can also see the argument that you might want to simultaneously have an image that could have different things in focus and a copy of the image with everything in focus, so I don't necessarily think that is good reasoning.
Update: It appears that the software is actually capable of doing this already.  On this review of the new Lytro, if you do the perspective shift, everything comes in to focus.
Comment: Focus stacking is taking multiple images after eachother which is quite far from taking a 'single' 'shot' which would be entirely in focus which should in theory be possible with light field camera's if my understanding is correct.
Comment: @DavidMulder - but the technique is the same.  My understanding of the lytro is basically that it captures information about various focus depths simultaneously.  Focus stacking would still have to be used in order to piece together the overall image because you effectively have a bunch of different focal depths that need the sharpest parts chosen from each.  This is the same process whether the source is one light field or multiple still images with different focal lengths.  You still have to figure out the sharpest part of each layer.
Comment: Just for the record, the downvote isn't mine, either way, if my understanding is correct you actually get post-processing a spatial space map including depth using light field shots.
Comment: @DavidMulder - it should certainly be possible to compute a depth map with a light-field shot, though you could do the same with a focus stack, though not at the same level of detail and only if you know where the focus plane was set.  If they are computing one, it makes even less sense that they wouldn't offer this feature built in to the software as they have to find what parts of the image are in focus at each focal distance in order to generate the depth map.
Comment: This is not how light fields work. This answer sounds plausible (hence the upvotes, I guess), but it's fundamentally not right at all.
Comment: @mattdm could you clarify on what is incorrect so I could fix it.  I'm not saying that a light field actually captures a series of images, but rather than in order to produce an image that has infinite depth of field, the in focus point for each part of the image must be determined.  The exact math and processing may be very different, but the principal that each pixel comes from the sharpest sample is still fundamentally what has to happen in the flattening process.
Answer: No. They cannot be entirely in focus. That is why there is a focus control.
You see, the lightfield is captured by micro-lenses splitting light. This effectively creates a stack of images at different focus-distances. Software interpolates between these to generate an image which is in focus at any range from the nearest to the furthest focus-plane which is captured.
This lets you have a great depth-of-field but not an infinite one. If you want to cover a much wider range of focus, you will have to resort to manually focus-stacking because you can move and set the lens at a greater number of distances and with greater depth. The difference in focus between micro-lenses is just not that big.

Light-field shots entirely in focus?


Why does hair grow after trimming but remains at a constant length after a while?

Question: Some hair especially body hair regrows after trimming but stops growing after a while. What is the mechanism behind control of hair growth and how is the length limit determined?
Answer: Hair grows from the follicle; there is no way for the follicle to determine if the hair tip is trimmed or not. This is unlike plant shoot/root growth that happens at the tip. Also there is no signaling from tip to follicle.
Hair growth has four stages: Anagen (Initiation), Catagen, Telogen (resting) and Exogen (falling off). Initially the primary follicle is formed during development of the skin, after that the hair growth continues in a cycle. In other words the old hair shaft is replaced by a new one. The period of the cycle (or how fast it happens determines the final hair length); the faster is the cycle the shorter will be the hair (you may note that certain people have a very short head hair even when they do not trim). This is because the old shaft doesn't get time to grow before it is shed and replaced by the new one.

From: Stenn & Paus (2001)
From the same source

Because there is a limit to the time a follicle stays in anagen, there
  is also a limit to the length of its product, the hair shaft. The
  anagen phase has been divided into six subphases (64, 359). Except for
  the last subphase, anagen VI (the duration of which dictates the shaft
  length), the length of the anagen subphases I–V does not differ
  substantially between follicles from different regions (490, 565).
  […]
   Because the actual length of a hair follicle does not appear to
  dictate the length of its shaft (rather the duration of anagen
  determines hair shaft length), it is tempting to speculate that the
  subcutis offers optimal growth conditions…
  […]Although influenced by environment (light, temperature, and
  nutrition) and systemic (endocrinological factors) parameters, it is
  generally believed that there is considerable innate local control of
  hair shedding; each fiber grows to a specific length, for a specific
  period of time, before being shed
Comment: Interesting. I looked at the source, and it seemed to imply that hair length is determined only by the length of time in which the hair has grown, which would assume constant growth speed. This would be a very interesting fact, I'd intuitively assume that hair (within the same animal) grows with different speed depending on body part and the current state of the body chemistry. Do you know if such difference exists, or is it a constant speed growth process? I don't remember an explicit statement from the paper, it was just an impression I got, maybe I overlooked something.
Comment: @rumtscho Yes that happens indeed. It is mentioned in the paper. For example head hair and body hair. I also cannot find an explicit statement but it is indicated implicitly. for eg: "*Except for the last subphase, anagen VI (the duration of which dictates the shaft length), the length of the anagen subphases I–V does not differ substantially between follicles from different regions*"
Comment: To be clear, you are implying that the only reason your hair has a limited length is that the skin itself regenerates, causing the hair to fall out?
Comment: To be clear, you are implying that the only reason your hair has a limited length is that the tip of the hair "sheds" (breaks and falls off)?
Comment: @cowlinator not the tip but the root. It doesn't break. It is displaced by a new incoming hair tip.


data loader daily backup records

Question: I want to schedule daily backups of my salesforce records into my local system.
How can we schedule daily automatic backups using Salesforce Data loader using CLI so that I do not have to run the data loader manually.
Answer: There are two ways to achieve your goal:

You can use dataloader.io
You can use schedule export for every day in the week(you need to set the schedule export for each day of week).
Answer: check my blog on automating data-loader -
https://rpsalesforce.wordpress.com/2015/06/12/automating-dataloader/
Let me know if you face any issues.
Comment: While the link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes.

data loader daily backup records


Is there a way to prevent an irresponsible pet owner from getting another pet?

Question: I hate to say it but I know someone who lives in an apartment and had a dog in the past and didn't get him groomed regularly. Now she is going to get another dog. Is there any way this can legally be prevented in BC, Canada?
Answer: No.
The quality of care for chattel is that the animal is not starving, it is not being subjected to cruelty or pain.   Not getting a "haircut" is perhaps inexplicably not on that list of egregious grievances.


Detect named entities inside words using spaCy

Question: I am using rasa nlu for training an NLU system to detect intents and slots. Now, some languages have word endings with their nouns (like Finnish, e.g. "in Berlin" -> "Berliinissä"). I have tried to annotate the characters in the training data as entities, but then I run the model, it doesn't detect the characters inside the word. When those characters are a separate word, only then they're detected. I am unable to think of an implementation to effectively detect named entities within a word. Suggestions needed.
Answer: You could use a tool to decompose composite word. There are many open source softwares for various languages. For example : german-word-splitter


Why are website certificates secure?

Question: I understand how HTTPS connections work, and I also understand they they require a certificate to know that the secure connection you have is with the right server (and not someone pretending to be the right server). My question is, how are these certificates secure? Why is it hard to fake them?
Answer: SSL is based on public/private key cryptography. This means that

anything encrypted with a public key can only be decrypted with the associated private key
the private key can be used to sign a something and that signature can be verified with the public key.

A certificate is a public key with information about the owner attached to it. The owner can either be a person or a domain.
When you visit https://stackauth.com, the server will present its certificate to your browser. The browser checks that the name in the certificate matches the name of the website you requested and if the expire dates are valid.
Then the browser checks whether the certificate was signed by a certificate authority that the browser knows as trustworthy. Anyone who creates a faked certificate has the challenge to get it signed by a certification authority that is trusted by the browsers. There may be a chain of signatures from intermediate certificate authorities which needs to eventually lead to a trusted one.
If any of those checks fails, the browser will show you a warning and require confirmation. If all the checks are passed (or overridden by the user), the browser will use the public key from the certificate to encrypt some information that only the server can decrypt. This information is used to setup a secure session in a couple of more steps.
The main issues with this model is that the certification authorities are the weak link. There is a huge number of CA, that are directly or indirectly trusted by the common browsers. All of them can issue faked signatures, and this has allerady happened a number of times in the past (e. g. Verisign, Comodo, Diginotar).
Comment: @philpirozhkov  There is a namespace extension to restrict intermediate certificates to specific domains, but it is hardly used. The trusted CA authorities can make a lot more money by requiring customers to buy individual certificate for all their servers, instead of issuing a intermediate certificates, which can be used by the customer to create any amount of certificate for the servers in their domain. Since it is not widely used, I am not sure how well it is supported by browsers.
Comment: This can be easily worked around using a well-known browser issue where browser trusts the certificate to be an intermediate certificate authority to sign certificates. So if you have bought a VerySign (root CA) certificate for example.com, you can use your certificate to sign ebay.com certificate, and some browsers can trust that it's ebay.com if it isn't (when using MiTM attack).
Comment: @philpirozhkov. The term "root certificate" refers to the root of the trust chain of multiple intermediate certificates; in other words: A root certificate is a certificate that is hardcoded in the browsers.
Comment: @philpirozhkov There are different types of certificate usages that are part of the signature. So a certificate for servers cannot not be used to create valid signatures on other certificates. (Around 1997 there were a couple of programs which did not enforce the certificate usage. e. g. Microsoft accepted Active X controls signed by a time service and Sun Java accept certificates for emails on Webstart code). Those issues have been fixed a long time ago.

Why are website certificates secure?


Using a password manager vs manual

Question: Who still uses the traditional method of storing passwords (written down) in an actual physical safebox vs modern methods like password managers? What are the pros and cons of each method?
Answer: There are still people who use both options with benefits to either. One thing to keep in mind is that there are a variety of threats that are dependent on password strength rather than someone actually finding your passwords on paper.
The 'Safebox':
Lets break this down into a few traditional 'safeboxes'.
A Wallet - This method provides some security in that you (generally) take it with you everywhere and rarely lose possesion of. If you have passwords in this and your wallet gets lost or stolen you really have to hope no one can wreck havoc with them.
Under your keyboard - Please don't do this at work just a bad idea. At home maybe, since unless you are a bank exec or notorius cyber criminal no one will target your passwords when they break into your house.
In an actual safe - Okay, now we're talking! That seems like a decent idea unless your adversary is a government or a hardened criminal.
One of the decent things about a Safebox of varying types is that those passwords are very hard to steal from you. There is always the potential that your website account gets compromised because of a companies lax security or eavesdropping over unsecured or poorly secured connections.
Because of this, even if you write down passwords and use a safe, keep them unique and strong passwords or else if your account on one site gets compromised your account on other sites might also get compromised.
The Password Manager
There are several kinds of password managers each with their own set of benefits and flaws. One immense improvement over a safe is that most password managers can generate lengthy, randomized passwords that would be incredibly hard to guess. There are also differences in the sorts of digital password managers you could use.
Browser Storage - Firefox, Chrome, and many other browsers have some component of password management built in. However, these passwords are easily accessible with brief access to your machine while logged in. They are stored unencrypted, and often don't require a master password to use. Because of this, browser storage, despite being convenient, isn't the most secure.
Cloud-Based Proprietary Password Managers - There are some great companies out there and there are some awful ones. How are you really going to tell the different if they wont show you or anyone else exactly how they operate? Maybe they store your passwords in plain text? Maybe they store it encrypted with a decryption they have control over. Do you want to trust strangers (even reputable ones) with your bank account, personal email, and facebook logins? No? Then don't do this. There might be decent companies using zero knowledge systems where they couldn't look at your information or passwords if they wanted to but I don't think those are the majority. These often cost money
Local installations of strong password managers - Now we're talking! Programs like KeePass and KeePassX for non-windows computers provide all the benefits of the above with fewer drawbacks. They are encrypted to the teeth to protect your passwords. Password database files can be stored as encrypted files in the cloud to use at any location with internet access, and you can even put the programs to open them and the files securely on a USB without having to worry if the USB gets lost or stolen. If it does, the encryption should keep your passwords safe for a few billion years. These are free!
So, I'd suggest using a password manager like KeePass(x). There are also additional drawbacks to the safe options because they are a pain in the butt if you use the passwords in your safe frequently. Then you have to open and close your safe all the time. And who wants to do that?!
Answer: The Pros of a Password Manager:

Reduces the friction for maintaining unique, strong random passwords for each application that requires them.
Centralized account management in a digital form means that it's more portable, and easily backed up.
Integrated tools for creating unique, strong random passwords means that you don't have to worry about password generation.

The Cons of a Password Manager:

Vulnerable to malware.   If your computer gets owned, there's a significant chance your password manager may end up owned as well, leading to a complete compromise of all accounts and credentials.
If you use a web-based password manager, you're relying on a third-party to ensure the security of your credentials, and also potentially opening yourself up to theft by remote web exploit, if there are weaknesses in the password manager's web interface. (Which research has shown there are/have been.)

The Pros of writing down and locking up your passwords:

Highly secure from theft.  Generally requires a high-risk physical attack to breach.
Immune to mass credential theft by malware.

The Cons of writing down and locking up your passwords:

Introduces massive friction.   It's very difficult to use a system of passwords when they are all locked up securely.
Still need a separate tool for generating unique, strong random passwords.
Difficult and expensive to back up securely, and introduces new potential for loss from physical threats such as fire and flood.

Given the pros and cons, I think it's clear that password managers are superior for general use, though the pros of written, physically secured passwords do offer significant advantages for cases that are particularly sensitive and require extraordinary controls, for instance in the examples Lucas mentioned in his answer.
Comment: Are phasing attacks a con of writing down passwords and locking them up? Or are password managers and writing them down equivalently risky for phishing attacks?
Comment: @StanShunpike Generally speaking, they're equally risky.  A phishing attack is a social engineering attack.  It is designed to bypass technical controls, regardless of what those technical controls are, so, a phishing attack is designed to get you to enter your username and password, regardless of whether they are stored in a book, or your head, or a password manager. The solution to a phishing attack is strong MFA, like FIDO U2F.
Answer: It's often still used for sensitive, powerful accounts on systems to which administrators even only get limited access. The password is created and stored by the security officer often and stored in a safebox which often requires more than one person to open.
The accounts are mostly not used frequently and only in case of emergency.
Answer: One advantage of the "envelope in a safe" method is that you can make use of Bruce Schneier's observation that society already has many well established and effective methods for securely storing small pieces of paper.
In particular, there is an effortless process for securely doing an off-site back up to a trusted third party, namely putting another copy of the envelope in your lawyer's safe.

Using a password manager vs manual


Does it matter which 3-way switch I put a dimmer at on a 4-way circuit?

Question: I was working a side job today and re-wired quite a few 3 and 4-way circuits.  I have a good understanding on how each work, but when I hooked up a 3-way dimmer on a 4-way circuit, the light would come on only if I had a certain switch on.  Basically, I put it where I thought was at the switch leg end of the circuit.  I'm only assuming this because the first 3-way is a foot away from the panel then the 4-way and finally the last 3-way.  I've heard several people say to put it on the switch leg end (granted it's wired for a traditional 4-way circuit) or the switch that is not the line side.  I also heard it does not matter... as long as it's obviously not in the middle.  What the heck is the problem here???
Answer: Was it a standard dimmer switch, rather than a 3-way one?
When replacing an on/off switch with a dimmer switch, you must make sure the type of switch (standard, 3-way, 4-way) matches.  They make all three types of on/off switches, but I've only ever seen standard and 3-way dimmers.  I figure the rarity of use for 4-way dimmers, combined with the rarity with which they would be purchased, make them not worth manufacturing.
Anyway, in a 4-way circuit (or more-way), you can replace either 3-way on/off switch (which will either be the first or last switch) with a 3-way dimmer.  But it must be a 3-way dimmer, not a basic dimmer.
I refer you to some excellent diagrams on wikipedia to see how multi-way circuits work.  Note the difference between how a 3-way and 4-way switch work.  If you can find a 4-way dimmer switch, you could replace any 4-way switch in a multi-way circuit with it.  Otherwise, it's either got to be the first or last switch.
Comment: +1 But I have never seen or heard of a 4-way dimmer. 4-way switches are just reversers of connection (A1-A2, B1-B2 switches to A1-B2, B1-A2). You can have several 4-way switches in a circuit, so long as you have two 3-ways at either end. I think you can always substitute one 3-way dimmer for one of the 3-way regular switches. When wired right, every switch can turn on or off the lights, but usually only at the level the dimmer is set to.
Comment: Correct, no 4 way dimmers. The 3 way must be at either end of the switch legs, whatever it takes. If the dimmer is desired in a location where only a 4 way switch makes sense, the only solution is to extend the power and double back the switch legs so that it becomes the "end". If the OP's circuit is not working, either it's not a 3 way dimmer, the switch legs are run in a non-intuitive manner, or the dimmer is connected incorrectly (power to switch leg terminal). He seems to be knowledgeable, so the switch legs are probably run non-intuitively.
Answer: Let's get our lingo straight.  In a 4-way switch network, there are 3 switches:
1) Line end 3-way switch
2) middle of network 4-way switch
3) load end 3-way switch
If you want to install a dimmer, I'd buy a Lutron 3-way dimmer at a compatible wattage for the load.  Identify which of the 3 switches is at the Line end.  The common lug on this Line End switch remains hot (120 VAC) when you toggle its switch.  This Line End 3-way is the one you replace with the 3-way dimmer.
Sounds like you tried to install the dimmer at the Load End.  As you describe, the switch on the dimmer was not sufficient to toggle the load state.  That's because the Line voltage coming to it is conditional on the first two switch settings.
Answer: Here is how three way and four way switches should be wired:

For deeper understanding, here is what it looks like schematically:

And here are specifics about wire marking and the different types of Romex™ (or NM-B) used:
Answer: This post is old so I'll add a decade plus later they have multi location dimmers when more than 3 way is required, so single, 3 way, or multi location
Comment: Please provide an example
Comment: While updated/modern answers to old questions are _very_ welcome, this one is a bit vague. Please take a look at [how to write a good answer](https://diy.stackexchange.com/help/how-to-answer).


Aligning in Illustrator

Question:
How do you equally space these around the center in Illustrator please?
Answer: You really can't in any easy, effective, manner. You'd have to measure between each element and use guides and manually position each object...
It would be quicker and easier to build a circle and the shapes from scratch and then color them as needed.

Draw 2 circles - Object > Compound Shape > Make
Draw a triangle with the primary point at the center of the circles.
Effect > Distort & Transform & Transform with the triangle
selected (note settings in animation below -- I counted your spaces which is why I use "17" in the effect).
Object > Expand Appearance on triangles
Select All - > Pathfinder Panel > Minus Front button
Then color as desired. (May need to ungroup first Object >
Ungroup)

This way everything is equally spaced and aligned before you add color.
Comment: Clearly I did something wrong because they are not uniform in size. The green is my attempt. It does look much better than my original one.
Comment: I also included my happy accidents. : )
Comment: @ElizabethHart the point of your triangle isn't centered so when you apply the effect, there's a slight skew to the copies. The triangle needs the bottom point to be exactly equidistant from the other two points horizontally.
Comment: Thank you. Scott. I will try another attempt tomorrow when I am more bright-eyed and bushy-tailed. : )
Answer: Here's a method using a Pattern Brush.

Create a single rectangular shape, fill with green and no stroke,
then copy and paste in place a second rectangle, with no fill or
stroke, then extended it a little to make a gap.
Select both shapes and make a pattern brush, by clicking the tiny
menu icon in the Brushes palette, click New Brush, choose "pattern"
option.
Then apply the pattern brush stroke you made to a circle. Change the
stroke width in the Ellipse options bar along the top.
Select the circle, then click Object > Expand Appearance, then
Object > Ungroup several times until Ungroup is greyed out.
Then you can select each shape, and fill with your desired colour.

If you have a shape you don't want to be distorted, you can make a Scatter Brush instead, and set the "Rotation relative to path" option, and adjust the spacing.
Answer: Assuming that the pieces are given - zero edits to them, only the placing: Move them to the cusps of a star:

Many pieces needed a little rotation, too.
Answer: You could do it with a dashed stroke...

Draw a circle
Bump up the stroke weight to your desired width
Check "Dashed Line" and set the dash and gap to your liking

You could even color it with a gradient on the stroke (or just expand appearance and set fills on the resulting shapes if setting up the gradient is too much work)...

Aligning in Illustrator


How large an energy difference in Hartree can be used to distinguish two different structures?

Question: For example, I use two different geometries of the same molecule to do optimisation in Gaussian, and the two resultant geometries look roughly the same. The energy difference between the two optimised geometries is only 0.0000001 a.u.. So can I view them as the same geometry? Or is the energy difference large enough to distinguish them? How large an energy difference is large enough for you to see two geometries as different geometries?
Comment: When you do a geometry optimization, one of the convergence criteria is the change in energy between iterations.
I think  0.0000001 a.u., is below the threshold for convergence in energy (if you use standard settings).
This suggest that the two structures are the "same".
Answer: I wouldn't use energy as a general criteria to discriminate conformations; a root mean squared deviation (RMSD) of superimposed structures would be a better metric. This is because two very different conformations may have very similar energy. For example, if you perform a relaxed energy scan of one of the dihedrals of cyclopentane, you get nearly the same energy for most of the dihedral angles, bu very different ring conformations.
If you found an energy difference of 0.0000001 a.u. and the superimposition of the conformations is nearly perfect, I'd say they are in the same minimum of the energy surface.
Comment: Your talking about confirmation is a good example. But in my case, the two geometries are not conformers. They are just slightly different in bond lengths (around 0.0002 angstrom). I'm thinking whether I can see them as the same point on the potential energy surface, or they are actually two different points...
Comment: I consider them to be in the same point in the energy surface - 0.0002 angstrom and 0.0000001 a.u. is pretty much nothing! Gaussian stops the minimization because it considers that both structures have optimized. If the minimization was continued, they would certainly land in the same exact conformation.
Comment: By the way, what are the details of your criteria for superimposed structures? How small a deviation is acceptable to see two geometries as the same minimum on PES?
Comment: I doubt there is a need for a cutoff. If a molecule is fully optimized from multiple starting structures, there is either a very small deviation (e.g. 0.0002) or something much bigger (e.g. 0.5 angstroms). Did you ever find something between - like 0.01 angstroms?
Answer: That's a pretty incredible threshold. To put things in perspective, if $1 E_{\mathrm{h}} \approx \pu{627 kcal/mol}$, then $\pu{0.0000001 a.u.} = \pu{6.27e-5 kcal/mol}$. Energy differences between conformers are often only a few kcal/mol, but this is a full 5 orders of magnitude smaller. Even $k_{\mathrm{B}}T$, which is $\pu{207 cm^{-1}}$ at room temperature, is $\pu{0.59 kcal/mol}$. If two molecules are truly the same conformer, then small geometry differences (bond lengths, angles) will 1. computationally converge to identical structures by slightly tightening convergence criteria, and 2. exist experimentally as identical vibrationally-averaged structures. That is, any vibrational mode has enough energy to cover this difference. Using a similar argument to the above, $\pu{1 cm^{-1} = 0.0029 kcal/mol}$, which is 2 orders of magnitude larger than the criterion you gave.
Consider the default energy convergence criteria for a few popular packages:
$$
\begin{array}{lc}
\hline
\text{Program} & \text{Max energy change}\,(E_{\mathrm{h}}) \\
\hline
\text{Gaussian 16} & \pu{1.0e-7} \\
\text{Molpro 2015.1} & \pu{1.0e-6} \\
\text{ORCA 4.0} & \pu{5.0e-6} \\
\text{Psi4 1.1} & \pu{1.0e-6} \\
\text{Q-Chem 5.0} & \pu{1.0e-6} \\
\hline
\end{array}
$$

So can I view them as the same geometry? Or is the energy difference large enough to distinguish them?

For two molecules you know to be the same conformer, $\pu{0.0000001 a.u.}$ is indistinguishable and not far from numerical noise due to loss of precision.

How large an energy difference is large enough for you to see two geometries as different geometries?

I am not aware of an official reference. However, for the case of a typical organic molecule that doesn't have shallow basins in its potential energy surface, I would consider the default geometry optimization convergence criteria enough.
Useful links

Gaussian manual (see the "Options" tab)
Psi4 manual
Q-Chem 5.0 manual


timing belt pulleys

Question: On my 2001 Jetta GLS 2.0 SOHC im replacing all pulleys for timing belt and i was wondering how to know the correct position to put new ones on. I will also be putting new belt. i know there are marking on them at least mine there are but how do i know i put them in the correct position to start with. I have been told just taker to place to have put on but i want to learn for my self. i cant find any marking on block.
Comment: Which exact pulleys are you talking about? Timing or serpentine belt? [Does this video help you?](https://youtu.be/L_5aXPkkkts)
Comment: the timing belt and replacing all pulleys.
Answer: I don't have your manual to hand, but the manufacturers use one of two systems normally to show timing : marks that you have been looking for or they use holes in the pulley webs and matching holes in the cylinder head or block which locate the positions precisely. Once locked into position then you slide the belt on and release the tensioner. then check the positions are correct after rotating the engine by hand...
Answer: If you haven't suffered a belt slippage incident, you look at the camshaft sprocket. You should see a notch in the sprocket and an arrow behind it. As long as the two line up properly, you shouldn't have an issue. Ensure you line it up BEFORE YOU TAKE THE BELT OFF!!! Should look like this:

If you've already taken the belt off, you'll need to ensure the engine is at Top Dead Center (TDC) on cylinder 1, and then camshaft sprocket in the position indicated.

timing belt pulleys


Self-study guide for translating a psychological scale

Question: I am conducting research on Arab homosexual men. I want to translate to Arabic and validate psychological scales like scales for gender dysphoria, internalized homophobia scales ..etc
first, How to know if the scale is copyrighted or not?(e.g. are scales in the DSM copyrighted ?)
second, is their any plan or self-study book to help me do this?
Answer: The article by Gudmundsson (2009) looks very useful. It describes an eight step process for translating and adaptive psychological instruments. The article is written clearly with concrete suggestions and references to the broader literature.

selecting an instrument for translation
selecting qualified translators
selecting qualified experts
Method of translation (e.g., back translation, two independent translations)
Method of adaptation
Investigating bias
pilot studies
validity studies

In general, psychological scales are copyrighted. That said, many academics would be excited at the prospect of having their scale being translated into another language. Thus, in general, a good approach is to contact the author of the scale to get their consent to you performing the translation.
References
Gudmundsson, E. (2009). Guidelines for translating and adapting psychological instruments. Nordic Psychology, 61(2), 29.


How to stop distortion from making minor chords muddy?

Question: I have a Roland/Boss GT3, which I use to get various distortion sounds. I like the sound for the most part, but I find that distorted sounds seem very ... "muddy" I guess would be the best way to describe it. Major chords, 7ths, etc,  sound fine, or at least much better. Is there some common setting that can help clean up the sound at bit? What would be the most likely causes of this behaviour?
Comment: The "power chord" as you know is a chord where the 3rd has been removed, whether it is a major 3rd or minor 3rd. The power chord was invented because major 3rds or minor 3rds sound muddy with distortion. So the answer is, "if you want to use a lot of distortion, don't play major or minor chords. Play power chords." Otherwise, with distortion, you need to arpeggiate the notes in the chord cleanly and don't let the notes overlap each other.
Comment: Why distortion interferes with major and minor thirds: Every note you play has a fundamental pitch and harmonics, or partials. Distortion plays havoc with changing the relative volume of the harmonics above the fundamental pitch. This creates dissonance. Intervals of major or minor thirds in chords, when run through distortion, creates even more dissonance. If you only play power chords, you only have the root pitch and the fifth, and when you run that through distortion, the extra emphasized harmonics and overtones line up in a consonant fashion, meaning less "mud".
Comment: Tuning can also play a role, especially if you're trying to tune by ear. If you tune all the fourths to perfect, all the error accumulates in the G-B interval, which can give you a nice G chord because the third is very mild; but the Em sounds like hell.
Comment: This is a really interesting question, unfortunately it seems most of the answers have missed, or only touched on, the main point about minor chords. I wonder if it might be word starting a new questions that is phrased more specifically, like "Why do minor chords sound muddy with distortion"? @WheatWilliams: that's some good information there. If you turned that into an answer, you might resolve the problem I mentioned.
Answer: Quite possibly one of the best ways to remove muddiness from your overdriven tone (regardless of what chords you play) is through the use of a compressor. If you don't know what one of those is, check out this question. If you think you know what one is, you probably don't, and you should check out this question =D. I kid. In all seriousness though--JFET based and digital overdrive pedals will do this. If using a compressor in front of (or behind, some players like that too) the overdrive--and using it correctly--doesn't work, then consider reducing the amount of distortion on your overdrive or changing some parameters on how you equalize the tone pre and post drive.
Before I describe that a little more in depth, let me give you a little background on the way a TS808 clone (which is nearly every mass market overdrive since the TS hit the market) works. Inside your nifty little stompbox you likely have little electrical components called JFETs. These little guys are the next best thing for overdriving circuits in a natural way behind tube amps. Some people would even say that JFET's do it better, and there are several boutique and mass market JFET based overdrives on the market that sound phenomenal--tube like even. However, one thing that these JFET's won't do that a tube amp will is compress at higher gain settings--you need some other heavy duty components in the mix to acquire that property. So, lots of folks build what's known as clipping circuits into their overdrive designs. These circuits come in two applicable flavors: symmetrical and asymmetrical clipping, and they both lend unique dynamics to the overdrive. Asymmetrical clipping generates both even and odd order harmonics, and skews more towards even order the harder you clip. This results in a natural, smoother compressed sound with little to no intermodulation distortion--and sounds much like the push/pull dynamics of a tube based amplifier. Symmetrical clipping tends to emphasize the odd order harmonics and sounds harsher due to intermodulation distortion. The original TS808 used (and newer reissues still use I believe) symmetrical clipping.
Now, with all that history, if your GT-3 enables you to configure any of these parameters on your overdrive patch, you should play with them. If you want cleaner sounding overdriven tone then consider an asymmetrical overdrive or tossing a compressor in your chain (software or hardware). Also, if you have your amplifier gained out any whatsoever, you should remix the amplifier distortion and the stompbox distortion. It took me a month or two to find the proper overdrive mix on my rig such that my Orange didn't sound like a muffled, nasty, pissed off bass cabinet. Also know that all TS808 clones and most digital drives hike the middle frequencies. They do this for two reasons. First, bass frequencies sound blatty distorted--so most overdrives will cut those before they gain the signal. Second, high frequencies sound glassy and harsh when overdriven, and will sometimes get lost in the mix--so those are cut a little bit too pre-gain. All this results in a muddy mess.
Here's neat piece of information that I learned from Paul Cochrane of the Tim/Timmy fame. If you can control your bass frequencies pre distortion, and your highs post distortion, you pretty much have all the control you will ever need to get very nice overdriven tones. You can roll back the bass to reduce the blattyness to your preference--sometimes called "tighter" bass response, and then increase the highs to cover the mid bump and get a nice fat creamy awesome overdriven tone. Or jack the highs even more to cut through the mix during a solo. Very few newer boutique and mass market overdrives take advantage of this mostly because they are going for the TS808 vibe--which is dirt cheap and easy as pie to build.
Anyway, hope this helps. My overdrive tone quest has taken me years to arrive at a sound I'm happy with, but I'm still not even close to being done :D.
References & Trivia:

GeoFex FX Terminology Descriptions
TS808 @Wiki
Analogman's TS808 History Page
The Tubescreamer's Secret
Comment: Clipping is a form of natural compression :D. You're technically right--it's not compression along the lines of what a pedal or rack unit will give you but the concept is very similar.
Comment: Fascinating. I'd upvote twice if I could. Can you do all this to the sound and still preserve dynamic range?
Comment: You're going to loose a little bit any way you slice it with JFET overdrives, especially if you use a compressor--whose very trademark is controlling your dynamic range. However, I know of a couple of extremely tube like JFET based distortions that work beautifully with my tube amp and react very similarly. There's a ton on the market, and a couple of really magical ones (YMMV). You have to be careful with this though, because it's not easy to blend two completely dynamic components. Think of it as placing two tube amps in series and hooking the final output to a cabinet--interesting indeed.
Comment: Fixed the bit about symmetrical clipping. I totally didn't explain it right.
Comment: You talk a whole answer about the Tubescreamer without mentioning the JRC4558 chip! Unusual... Great answer though! This is exactly the reason why I don't use multieffects (as well as the sound..). It is so much easier to tweak when you have all components right in front of you!
Comment: @mrbuxley Ah the legendary JRC4558. I actually have one in a boutique overdrive I own--but I was going for a more layman's description of how overdrive circuits work. I don't understand them entirely myself, but I do know enough to be dangerous. It's totally worth mentioning though :).
Comment: Great answer, but to be pedantic, overdrive does not introduce compression. Overdrive introduces clipping. The advantages of using a compressor before your gain stage is twofold: first, it will even out the amplitude of your notes, giving you a more consistent tone; second, it will (when properly set) pass the attack (transient) through and compress the sustain, giving you an overdriven tone on attack that blends nicely when held (say, in a minor chord). The disadvantage is that it somewhat reduces your ability to control tone through picking dynamics.
Comment: "Asymmetrical clipping ... results in ... little to no intermodulation distortion"  How so?
Answer: In my experience, this is a problem inherent in heavy distortion. I'd suggest one of two things:

You can decrease the amount of distortion, letting the notes you play come through a little more cleanly.
You can play fewer notes at a time. Most chords only need three or four notes to be clear, and generally higher notes will punch through distortion more clearly. Rather than play six or seven notes of a chord, try playing only three or even two. If you're playing with a band, that opens up your options even more. For, say, a C minor, play Eb and G, letting the bass player play the C root.

If these don't work:

I would try using EQ, possibly notching out frequencies until the chords become clearer. Guitar mostly lies from 80hz to 1khz, with overtones up to 5khz. (At a guess, I'd concentrate on the 1 - 5khz range first.)
Might your presets be adding reverb/echo? If so, that can make sounds muddier, particularly long reverbs; try dialing that back a bit.
Comment: @Nerdfest - I would try using EQ next, possibly notching out frequencies until the chords become clearer. Also, are your presets adding reverb/echo? If so, that can make sounds muddier; try dialing that back.
Comment: That's the workaround I've been using, but I was hoping there was a technical solution. I don't remember the muddiness when using a real overdriven amp.
Comment: Toss that in as an answer ... sounds promising.
Comment: Done, but [@jduv's answer](http://music.stackexchange.com/questions/2230/how-to-stop-distortion-from-making-minor-chords-muddy/2232#2232) sounds even more promising than mine.
Comment: +1 for the reverb/echo question. Those will seriously muddy things up depending on where you put them. Everything else is great advice too.
Comment: +1 Playing fewer notes at a time is the best solution, and leaving the root is particularly useful for minor chords, as the remaining notes don't contain the 5th-overtone-dissonance anymore, which is the main reason for minor chords sounding muddy.
Comment: +1 for playing fewer notes at a time. It was a big revelation to me that those big Black Sabbath chords are usually two note chords, with harmonics and distortion giving the illusion of more notes.
Answer: I have been through maybe 25 or 30 different distortion boxes in my life trying to find the one that has the 'perfect' sound for me, and to be fair, it doesn't exist :-)
In saying that, I have managed to find ways to make the sound work. On something like the GT3 I find you can reduce muddiness a lot by scooping out more mid and low than you might expect before you get to the distortion stage and then roll off a little bit of the highs on the output if it sounds too harsh.
Backing off on the drive for the distortion stage also works well to keep dynamic range as well as giving a warmer, less muddy sound.
On my Line 6 (which is in the same market place as the GT3) most of the muddiness, if I want it, comes from the amp simulator - if running into a real amp make sure simulation is disabled.
As already mentioned, choosing your chords correctly will have a big effect. If you are playing rhythm guitar you really won't need as much distortion, and you can allow a more middle-y sound. For lead you will usually want more clarity, but that can be through more or less distortion.
Answer: I had this problem for a long time, after tweaking with it a bit I've finally got the perfect tone with no muddiness on my chords.  You won't even need a compressor or EQ.  I'm playing through a Boss Blues Driver and Fender Twin Reverb.  Make sure you are using your bridge pick up, as the neck pick up won't be favorable for overdriven chords.  Now, turn your volume on your guitar down from 10 to about 7-8.  You will immediately notice a cleaner sound and that minor third won't get blurred out nearly as bad.  Now, for the overdrive itself.  For lead work, my gain is at about 2 o'clock/12.  I turn it left to about 11 o'clock and I have completed the perfect overdriven sound for any chords(major,minor,7ths,sus,etc.)  I can't speak for everyone, but with my particularly set up, this change produces no unwanted noise while still keeping the power and fullness that I look to achieve when using my overdrive.
Answer: The kind of distortion that is relevant here is called intermodulation distortion.
The problem with intermodulation distortion is not primary the thirds. A minor chord consists of exactly the same intervals as a major chord and still gets more muddy when distorted. A third sounds only muddy with distortion, if the tuning is not just. The problem is that the minor chord is primarily u-tonal.
What distortion does is adding frequencies that are sums and differences between different harmonics of the notes played. All of these extra frequencies are harmonics of the highest note which contains all notes of the chord played in its harmonics.
For intervals there are two factors at work:

Dissonance of the interval: The more dissonant the interval is, the      deeper this tone will be and the more dissonant the sound will       become. This factor alone induces only a mild dissonance for thirds      and sixths.
The deviation from the just interval: This problem occurs in the generally used equal temperament tuning. Intervals deviate from       perfect integer ratios. This induces a split in the harmonics created    thorugh distortion and creates muddyness. The further the interval is    from the perfect ratio, the worse it becomes. Fourths, fifths and the major second are nearly perfect, thirds, the tritone and sixths suffer     from it and for the major seventh it's especially bad.

When we form a chord, the note which shares all of the chord's notes in its harmonics is not just dependent on the dissonance of the chord. It depends one where that chord is found on the overtone scale. The notes of the major chord have the frequency ratio 4:5:6, so the highest common note would be 1. The minor chord is just the inverse - 1/4:1/5:1/6 on the undertone scale, which does not have a common fundamental frequency. So what counts is the first occurance of the chord in the overtone series. It's 10:12:15, so the note created by distortion is way lower and not even an octave to any notes in the chord. This means rather consonant o-tonal chords are fine with distortion, while u-tonal (and mixed tonal) chords are generally much more muddy.
They just work better with less distortion. In contrast to o-tonal chords, however, the notes of an u-tonal chord share a harmonic. Thus a kind of harmonic distortion that boosts shared harmonics would work very well with u-tonal chords (don't know if something like that exists).
So what you could do to reduce muddyness in distortion:

Consider this knowledge of which chords sound good with distortion already when composing a song, so you can use proper chords for passages with higher or lower levels of distortion.
Use less distortion or use distortion settings that produce noise and/or harmonic distortion rather than intermodulation distortion, when necessary (others can tell you better than me how to achieve that).
The octave matters. The same chord has different levels on dissonance depending on in which octaves the different notes are play. A classic major chord would be 4:5:6. If you played the major third one octave higher, you get 4:6:10 = 2:3:5, so we've just reduced the dissonance significantly. Playing the minor seventh and the major second one or even two octaves higher has a similar effect.
Use just intonation. Well, learning to play a fretless guitar might be too challenging. But you might be able to compensate for the deviations of the equal temperament system through bending in some situations.

What could you do harmonically about the minor chord (1/6:1/5:1/4 = 10:12:15) in particular?

Leave the root (10) for the bass and just play the major third (12:15 = 5:4) on top of it. If you want it still brighter and more consonant, you can play the top note one octave higher (5:4 becomes 5:2).
Leave apart the fifth (15). The remaining minor third (10:12 = 5:6) still has the minor feeling. If you play the root of the minor third an octave higher, you get 10:6 = 5:3, a major sixth, which sounds even more consonant. Letting the bass play the fifth at the bottom is an interesting option.
Only play the fifth with the guitar (10:15 = 2:3). Let the bass do the minor third, but make sure it's an octave lower (bigger major third = more consonant - 1/6:1/5:1/4 changes to 1/5:1/3:1/2).
Use arpeggio to make different types notes sound at different times.
Not as a substitute, but in addition you could bend the third up very slightly by about one 7th of a semitone. This makes the minor third/sixth sligthly larger and the major third/sixth slightly smaller. You'll hear best when you've arrived at just intonation, if you only play two notes and use intermodulation distortion.

Each of those approaches creates a quite different overall effect.
Comment: Very good suggestions! I can confirm that all the options for de-mudding a minor chords are effective.
Answer: Okay, here's a solution for this that I just discovered.
I've been playing with various methods of gain stacking. I found a good (actually, pretty awesome) sound with the Zoom G5. I simply pushed the signal a bit from the compressor to the "Extreme Distortion" they have in the unit. (It's pretty amazing. I wish I could find something like this in a real pedal.)
Then I push it into the "Exciter" effect. (I'm pretty sure this thing just boosts the top and bottom frequencies in some way, but I'd love to hear if anyone here knows of a unit that this compares to.
Now, this still left my sound a tad muddy in the mids. But the distortion was TIGHT. Not a lot of weird fuzziness (I don't like that in my tone.) And the artificial harmonics are off the hook.
I just didn't like the sound when I was playing rhythm. I could boost the lows, but it never had that punch-in-the-gut feel I was looking for.
But I just grabbed a Boss DA-2 - adaptive distortion - yesterday. I had a sneaking suspicion that this would be a solution to that "indistinct" notes issue that most distortion creates.
To be honest, I'm amazed at the sound on this thing. All notes are clear and ring out distinctly, allowing you to play full maj/min and 7th chords and get ALL the notes. It's phenomenal.
Now, since I want a much "heavier" sound, I played with gain stacking on this bad boy. THIS is tricky, since the Boss wants to carve up the sound and throttle the distortion on each note.
What I wound up doing was punching in a Tube screamer on it, and bumped up the levels (not the drive) in the Zoom G5 chain. I'm playing through a clean amp (strictly power) into a Line 6 4x12 cabinet.
I've got an HD500, a Zoom G5, and a Digitech IPB10 (the iPad one.) They're all looped, so I can basically just mix n match. Every so often I have to throw a gate in the mix to quiet things down.
What I eventually came up with is a really kickass rhythm sound that just feels incredible. The leads jump out because the Boss does an excellent job of balancing the note frequencies and volume levels.
The only thing I can't get are crazy pinched harmonics quite like the setup I had on the Zoom originally.
I can honestly say that if I could get that last bit of flavor in my sound, I'd be 95% to my personal tone "holy grail." (C'mon, no one gets 100%  :)
Answer: A possible culprit here is the volume balance among the strings, and the voicing you are using.  Adjust the pickup's pole pieces to even out the volume balance.

Try playing different voicing/inversion of the minor chord at a different positions. For instance, if the original chord is has the shape of an open Em, try playing it as an open Am shape elsewhere on the neck, or the open Dm shape.
Play fewer notes of the chord. Distortion doesn't work well with strummed full bar chords. You can use the bar chord fingering, but pick out just three different notes from it.
Try more widely separated voicings. For instance the notes of a minor chord can be reorganized into stacked sixths.  The bass note of a chord can be dropped an octave to separate it more from the upper voices. Etc.
Learn how to play the arpeggio of the minor chord in all positions. When you have it internalized, you will be able to pick out three notes from that arpeggio in any position and literally improvise voicings around the chord on the fly.
Try not playing all the notes of the chord at the same time. Even though the chord is sustained, the notes can come in at different times. For instance the minor chord can begin with root-fifth-octave power chord, and then the minor third above the octave can come in one beat later (or whatever).
Listen to what is done in metal: metal players don't just strum chords; they play various patterns. One common one is pedal point: thumping on the root note (often an open string) while syncopating the upper voices into it.  This is not just cool sounding, but it helps overcome the problem that distortion makes everything muddy.
Answer: My theory is that the minor and major third are dissonant in 12-TET.. Especially the minor third at around -15.6 cents flat.. The major third is around +13 cents sharp in 12-TET compared to a just intonated major 3.
Distortion adds a lot of harmonics so you get multiple layered minor or major (depending on the chord). I think our ears are more sensitive to hearing a flat tritone than a sharp tritone so the major chords with overdrive sound slightly "better" than the minor chord with overdrive..
Comment: That's not the reason why major chords sound better than minor chords. Both chords consist of exactly the same intervals! The reason is that the major chord has a consonant  common fundamental, while the minor chord does not (see also my answer).


What lights are used on top of a building or structure near an airport?

Question: What type of light (strobe, beacon, color) should be displayed on top of a building or structure near an airport ?
Comment: For what country?
Comment: See also (for the US): [Are red obstacle lights near an airport required to be lit during the day?](https://aviation.stackexchange.com/q/8528/3201)
Comment: Country this question relates to is the Philippines.
Comment: I should also add that the building is only 23 m above ground. Located about 2km from the airport but not in it's flight path.
Answer: The general guidelines are:

4.3 Lighting Systems. Obstruction lighting may be displayed on structures as follows:

Aviation Red Obstruction Lights. Use flashing lights and/or steady-burning lights during nighttime. Tower structures are typically
  marked with flashing red lights. Buildings and smaller obstructions
  located near airports should be marked with steady-burning red lights.
  (See Chapter 5).
Medium-Intensity Flashing White Obstruction Lights. Medium-intensity flashing white obstruction lights may be used during
  daytime and twilight with automatically selected reduced intensity for
  nighttime operation. When this system is used on structures 700 feet
  (213 m) AGL or less, other methods of marking and lighting the
  structure may be omitted. Aviation orange and white paint is always
  required for daytime marking on structures exceeding 700 feet (213 m)
  AGL. This system is not normally recommended on structures 200 feet
  (61 m) AGL or less.
High-Intensity Flashing White Obstruction Lights. High-intensity flashing white obstruction lights may be used during daytime with
  automatically selected reduced intensities for twilight and nighttime
  operations. When this system is used, other methods of marking and
  lighting the structure may be omitted. This system should not be used
  on structures 700 feet (213 m) AGL or less, unless an FAA aeronautical
  study shows otherwise.
  Note: All flashing lights on a structure
  should flash simultaneously except for catenary support structures,
  which have a distinct flashing sequence between the levels of lights
  (see paragraph 4.4).
Dual Lighting. This system consists of red lights for nighttime and high- or medium-intensity flashing white obstruction lights for
  daytime and twilight. When a dual lighting system incorporates
  medium-intensity flashing white lights on structures 700 feet (213 m)
  AGL or less or high-intensity flashing white lights on structures
  greater than 700 feet (213 m) AGL, other methods of marking the
  structure may be omitted.

Specific details are spelled out in AC 70/7460-1L CHG1 Obstruction Marking and Lighting.


How is this code feasibly valid?

Question: is this code valid? https://ethereum.stackexchange.com/a/8484/10138
I just don't see how Mortal(mortal) - an instantiation of the Mortal contract with one parameter - is possible when Mortal takes no parameters!
Answer: I can see why you're confused.  The key thing to know here is that typename(X) looks the same as functionname(parametername) but is actually a totally different operation you may well be familiar with, casting.
For those who don't know, casting is about changing the type of a variable, usually from a simpler type to a more complex type that typically inherits from it.  For example, you may want to cast a uint32 to the larger-but-still-compatible uint64 type.  To do that, you preface the name of the variable you want to cast with the name of the type you want to cast it to, and then surround it with parentheses like this:
uint64(mycurrentvariablewhichisauint32)
In the case of your question, we are specifically looking at a lesser known feature of the Solidity language: contracts all inherit from the "address" type, and therefore address types can be casted to contract types.
Given this information, it's easy to see what's going on in the snippet you reference.  As Badr points out, the confusingly named address "mortal" is assumed by the snippet to be the address of an already instantiated copy of a mortal type contract (or technically mortal-interface-compatible since it doesn't have to be exactly mortal it just has to include the function signatures mortal includes, usually because it inherited from it).  However, in order to actually call one of the mortal functions you have to tell solidity that this particular address is a contract of type mortal.  You do that by casting the address to the mortal type:
Mortal(theaddressofthecontractwhichisactuallyamortaltypecontract)
This is not a call to the constructor for Mortal, which would look like new Mortal() and would generate its own brand new address from scratch.  Make sense?
Comment: So, basically, we're downcasting an address to `mortal`: kind of like an `Object` to `String` (in Java)?
Comment: Yup!  I always feel like the terms upcasting and downcasting should be reversed but since it is going from a base class to a derived class it would indeed be a downcast.
Comment: @JeffColeman I'm curious why you think the terminology for upcasting and downcasting should be reversed? When I see "down" I think "lower-level" so it makes sense to me, you're casting to something more specific. Upcasting is higher-level and in general will always be guaranteed to work (assuming the interface is implemented correctly), whereas downcasting requires that you know the underlying type ahead of time.
Answer: you mean this snippet code :
function checkMortal(address mortal) {
    if (Mortal(mortal).owner() == 0) {
        // You know it is dead.
    } else {
        // You know it is alive.
    }
}

the Mortal(mortal) in this case is an instantiation of the Mortal contract, it is similar to
function checkMortal(address mortal) {

Mortal M=Mortal(mortal);
        if (M.owner() == 0) {
            // You know it is dead.
        } else {
            // You know it is alive.
        }
    }

Comment: **Yes, but why can it be instantiated?** There's no constructor for Mortal with one parameter, which is called when an instantiation of the Mortal contract (with one parameter) is created.

I can see `Mortal M=Mortal()` being valid, but not `Mortal M=Mortal(someParameter)`.
Comment: forget the POO vision, here the constructor is a function executed once when the contract is created. so when you call it using its address its mean that you are not calling its constructor.
Comment: What's POO stand for? And is there a name for this pattern that you are talking about (`Contract(Address)`)?
Comment: @JossieCalderon that is not the code that is doing the instantiating.  What Badr means is that the function has been passed the address of an *already instantiated* copy of mortal.  The code `Mortal(passedInAddress)` is simply casting the address type to a "Mortal" type so that one of its functions can be called.  Now that I wrote that out, I think it probably deserves a whole separate answer, so I'll write one.
Comment: Poo or OOP for oriented object programing,

How is this code feasibly valid?


Detect if Font is Serif

Question: Is there a way to programmatically detect if a given font is serif or sans serif?
For example, if the user has selected Palatino it's serif. If the user selected Arial, it's sans serif.
I can detect the font name and family name. But I don't see a serif or san serif property for UIFont. Without this, I guess I'd have to set and track a isSerif BOOL manually for every font available to the user?
Answer: In fact there is no attribute of UIFont that hints at the font type.
If you are only relying on OS font familys (50+ iOS 6.x) you could easily manage them in a plist with all (future) attributes necessary. For using a third party set of fonts you could read up ttf spec if there is an attribute for (sans) serif fonts. last resort is to check the family or/and font name for »serif« in it, assumed they are named accordingly.
Answer: There is no property on UIFont that will this explicitly for you. At this point point it might be worth while to add a category to UIFont, but it looks like you will have to set up the mapping on your own.
Might be a good project onto GitHub.
Answer: You can make a plist with key font name and value a boolean.
Here is the list of fonts in iOS

Detect if Font is Serif


Can I disclose my company's financial troubles when applying for new jobs (UK)?

Question: My new company of 3 months is having trouble servicing its debts, including payroll, and I am actively looking for a new job. When asked by potential employers as to why I am moving on so soon, am I ethically and legally allowed to say the company is heading for insolvency?
Comment: **My new company of 3 months**.  Is it a startup of yours?
Comment: I think it is generally a bad idea to be critical of your current employer. There are ways to allude to the issues while keeping your response focused on you and not the company you want to leave. A lot of industries are surprisingly small places and you don't want idle gossip to burn future bridges.
Comment: Where I live (Germany) this would be illegal, especially since it would probably hasten the demise if the company (no one gives contracts to a company that has troubles), plus this might be tradeable insider information. Unless, as per Dawnys comment, this is a company you founded yourself (but even then you have legal obligations that might make disclosure less than advisable).
Comment: @JaneS, not necessarily - lowering the value of your remaining assets when you file for bankruptcy might still be illegal (depending on circumstances and legislation).
Comment: @EikePierstorff: I don't think that simply stating the fact that you were not paid on time is illegal (IANAL, of course). Divulging insider information (such as the list of open bills that you know because you work in finance) is a different matter. Still, does not mean it is wise to mention that.
Answer: Honesty isn't always the best policy
At least, not when talking about previous employers.
I can see your point here, you're being asked "Why are you leaving your job?" and the honest answer is (at least partially) "Because the company is in trouble and I want to know my job is secure". Saying this can be bad in a few ways though:

Although understandable as a reason to leave, it marks you as someone who may jump ship at the start of any problems. I'm not saying you are, and neither are the recruiters, but without context we have no idea if "Financial trouble" is "No bonus this year", "Going bust next week" or somewhere in between.

Avoid anything negative in the same way you'd avoid "My manager is an idiot and only lets me have 2 cups of coffee a day", and keep things positive. You don't want to be marked down as a negative person, or a flight risk, before you've even started!

You may be breaching confidentiality/anti-competition etc agreements, or a clause in your contract forbidding you from giving sensitive information regarding the company (which financial information almost certainly is). It's just not worth the risk of someone noticing, even if they have better things to be doing right now.

That said, if you've only been with the new company for 3 months, I wouldn't be surprised to find that "Because I'd like to further my career" invited further questioning along the lines of "Well yes, but why are you moving after only 3 months?". At this point you have to make a judgement call (based on your own contract) as to whether you feel comfortable with a statement along the lines of "We've been made aware of some risk to the future of the company. I'm not in a position to give out further details as I'm not aware of the full situation, but what I've heard is enough to make me concerned for my job security"
Comment: I dont go with most parts of this post, but the conclusion is perfect.
Answer:
When asked by potential employers as to why I am moving on so soon, am
  I ethically and legally allowed to say the company is heading for
  insolvency?

That depends on the company, and your role in it.
For example, if this is a publicly traded company, and you are an insider with material knowledge of the company's finances, you are not allowed to expose insider knowledge.
Most likely, you aren't in that position though. You probably aren't in a position to conclude that they are definitely "heading for insolvency" since many things could happen to change that potential outcome.
You could say that you are worried about the company financially and that you are worried about your job stability. Don't get into specifics, since they aren't really important. Hiring companies will understand.
Comment: Doesn't "insider knowledge" apply to anyone employed by the company?
Answer: Despite what others here are saying, you need to be realistic about why you are moving, otherwise you will look like a flight risk/or about to be fired.  You don't need to be explicit of the details, and can use the short term part of your time as part of the answer.  For example:

I have only been at the company for three months, but given what I have seen I have deep concerns for their long term viability, and given I'm only just in I felt it is better to move now when I can take my time to find the right opportunity rather than wait until I may have to find a new role quickly.
Comment: Just say that you feel the position isn't a good fit - three months in is still within a probation period, and interviewers will understand. As long as it isn't the only short stint, that is
Comment: This is sounding like legal advice talking about slander, don't want my answer moved off topic.  My limited googling of slander seems to require the injured party to show financial loss , so not relevant here.
Comment: Just be factual.  You can't be sued for slander if it's factual.  Established companies actually like to see people who are looking for stability.
Comment: @horusKol I wouldn't go that way.  This makes the person seem flighty.  I see no harm in stating that the reason for leaving is that the company couldn't make payroll.
Comment: @BillLeeper - actually, you can be sued for slander even if your statement was factual - and given the current libel laws in most Western countries, you will then have to stump for solicitor's bills to prove it was factual.


Mounting 24v transformer?

Question: I bought a standard 24v transformer and attached a plug to one end so I can plug it into a standard outlet. Can I just mount it to the wall by the outlet? Should I leave some space between the back and the wall, or does that not matter? I'm concerned some portion of it may get hot, or needs some air by it, etc.
Comment: What is the model number of the transformer?  What do the instructions that came with the transformer say?  24V AC Doorbell transformers are usually installed inside the wall in a junction box behind the door bell.  Please add a picture of what you've done.
Comment: What are you using this 24V transformer to power?
Comment: It's a Honeywell AT72D 1006. I'll try to add a pic to the question. I want to install it in the basement and run it up to my tstat to power it. The furnace has only dry relays, so I can't use that. All I did was connect the attached wires to a standard two-prong to plug into an outlet.
Comment: Added the photos to comment.
Answer: in mains electrical, wiring methods are everything.  You're running smack into that right now.
What you were thinking of is this.

However for thermostat wiring, the above is a silly product, because generally speaking thermostat wiring is a permanent part of the building, and there'd be no reason to make it pluggable, and a lot of reason not to.   Enter products like yours, which are designed to mount on standard 120/240V steel junction boxes, common as dirt in 120V wiring methods:

They're so common Amazon doesn't practically sell them, since every hardware store and electrical supply stocks them for about a dollar.   As you can see, your transformer is made to be the lid of this.
However, you have it upside down. Code requires it be mounted with the AC power (black and white) wires on the inside, where they will splice to AC power wires also inside. The non-hazardous low voltage terminals are to be on the outside of the box.
Now, if your basement is unfinished, there's likely to be one of these junction boxes somewhere, with handy circuits behind it your electrician can tap.  Alternately, she can fit one of these boxes at an appropriate location, and then use listed wiring methods compliant with the Electrical Code to bring 120V mains power to the box.
At that point, the electrician splices the transformer's 2 wires to mains power hardwired, fits the transformer as the box lid, tightens it down, and leaves. You use thermostat cable to take the 24V wherever you need to go.  (or the electrician also could, obviously, and they're experienced at fishing wires through finished walls without wrecking drywall).
The key to this type is you let the thermostat wire do the traveling, you fit the transformer in a less finished utility space, crawlspace or basement where that makes sense.   I would say that is also true of the wall-wart transformer you really want.
But you don't really want a wall-wart transformer, you want this thing, hardwired in and installed to code.  Call an electrician, or learn proper wiring methods and fit your own box.  DO NOT hork this thing together like you have been aiming to do so far.
Comment: @Skeptic I got that. I just haven't seen much interest in proper wiring methods, and that's an area I'd encourage you to get religion.  It's fairly easy and it makes the job CORRECT instead of dingle-dangled together. Which by the way, is very typical of degreed EEs who design the electronic guts of products but leave the packaging to others. To them it feels like they're stooping to learn where to use cable clamps and pigtail grounds.
Comment: Thanks. My plan was to do exactly what you're suggesting, only I didn't see any harm in plugging this into an outlet in the unfinished part of the basement rather than connecting it to the mains directly. Just seems easier.
Answer: The install sheet as seen here suggests that your transformer should be mounted to a 4" x 4" junction box.  Once installed into a junction box, the transformer can be mounted in a manner approved by your local electrical codes.  Typically, these are attached with machine screws to whatever metal enclosure your electrical source and controls are housed in.
Some possible issues with your setup: The black and white wires are meant to be wired directly into a 120v circuit with wire nuts or a junction block.  This is usually done by running a section of EMT/flex conduit towards your power source to make a safe connection. In your case, you may also be able to stack your junction box on another existing junction box for power connection.
On the topic of heat, the screw terminals for your transformer are made to be on the outside of your junction box.  Mounted in this manner, heat accumulation won't be an issue.
Comment: Could I mount the junction box just to a stud next to an outlet? I'm thinking eventually of replacing this whole thing with a. Plugin 24v transformer, which would alleviate this whole problem.
Comment: Your problem would be getting power from the outlet to this junction box. Specific wiring methods need to be used to make it Code legal. Not a big deal, but must be done right with knowledge of how.  If it isn't Code legal, you could burn your house down, shock somebody, insurance won't pay, and/or be redflagged when you try to sell  your house.
Answer: You can and it will work however, you will be installing it counter to the instructions from the manufacturer, a no-no.  Additionally, your installation will not meet basic code parameters.  If you could install new 4-square J box on the stud next to an outlet box, then just run a new wire/cable between the two boxes and hard wire the new transformer in the new box.

Mounting 24v transformer?


"System Builder" Windows on VMWare Fusion?

Question: I am a web developer, and I want to buy a copy of Windows 7 to use with my currently-existing copy of VMWare Fusion for easier testing of web sites in Internet Explorer. However, the overabundance of Windows versions is confusing me. I believe I want the Professional version, since from what I understand, the Windows XP emulation feature will let me install IE 6 and 7 for testing alongside 8 and 9. However, Amazon is offering me two versions of Windows 7 Pro; a normal boxed one, and a "System Builder" one for half the price. Obviously I'd rather purchase the latter, but I haven't found any clear information as to whether it can legally or technically be used under virtualization or not. Can anyone shed some light on this?
Answer: The "System Builder" version is intended for OEMs.
Basically, the difference boils down to the fact that microsoft will not provide support (e.g. tech support calls or live-chat) for the OS.
It is perfectly legal, will still receive all the patches and service packs, etc...
Here are more details. It's worth noting that I have transfered OEM versions of Windows XP (though not 7) between multiple computers without any significant issues, and generally if it's not activating, you just call Microsoft and they give you a new code.
Furthermore, since you're sticking it in a VM anyways, you should never really have to worry about windows thinking you swapped the mobo, and trying to reactivate anyways.

Off-topic a bit, have you tried running Internet Explorer under WINE? I know WINE supports IE6, and you may be able to finangle IE7 or 8 into working as well.
Comment: If I were to clone the VM files in order to make a "fork" to do something experimental in without messing up my main VM, would Windows consider that a new computer and complain about multiple installations? What if I were to upgrade to a new Mac in the future? As for WINE, while interesting from a technical standpoint, I'd rather have "real" Windows to work and test with in this case, particularly since, from what I've seen in the past, Wine doesn't really handle fonts well.
Comment: As long as all your forks are based off the same trunk, I don't think it would cause any issues. Regarding moving between Macs, the virtualized hardware should stay the same from the VM OS's perspective (I think), so it would likely not be considered a new PC. Really, I haven't virtualized W7 much, so I can't speak to the specific issue at hand as much as I can to virtualizing WinXP.


In the Ruy Lopez, does White play on the queenside or King side?

Question: I always play on the kingside, but I recently heard from Expert class that White plays on the queenside. I also seen another Expert class play on the queenside. If this is true, then why does White play on the queenside? Also, when does White play on the Kingside?
Answer: In most variations of the Ruy Lopez, White, with the Bishop on b3, has better chances playing on the kingside.  In the Marshall gambit, White counterattacks on the Queenside.  In the Exchange variation, White normally has better chances in the kingside in the endgame.
Fischer-Spassky
Ninth Match Game
Sveti Stefan 1992
<code>
[fen ""]

1. e4 e5 2. Nf3 Nc6 3. Bb5 a6 4. Bxc6 dxc6 5. O-O f6 6. d4 exd4 7. Nd4 c5 8. Nb3 Qd1 9. Rd1 Bg4 10. f3 Be6 11. Nc3 Bd6 12. Be3 b6 13. a4 O-O-O 14. a5 Kb7 15. e5 Be7 16. Rd8 Bd8 17. Ne4 Kc6 18. axb6 cxb6 19. Nbc5 Bc8 20. Na6 fxe5 21. Nb4
</code>
In this famous game, White did attack on the queenside.  The reason for the exception is the placement of the King.  Opposite side castling throws most chess rules out the window and the only thing that matters is an attack.
Comment: Thanks for the fix, I seem never to get this player to play correctly.
Answer: You can play wherever you want to. The kingisde seems obviously like a better option. Why? Because normally in the main line Black has already gained space with a6 and b5, meaning that it will be easier for him to manouever his pieces on the queenside. As for you, you may want to go h3 g4 and Nf5 if possible, as Fischer did in a game against Wolfgang Unzicker which I think is covered in his book. Also, black can get a passed pawn from his attack, but if you get the king, it is game over.
Note: The latter manouver involving h3 and g4 is only good when the center is closed, if it is open I wouldnt suggest to attempt at your king's life like that.
Answer: Black's moves ...a6 and ...b5 can also be quite weakening so White often plays a4, axb5 axb5 and then Black's b5 pawn is weak and can be attacked. Also after these moves the a-file is open so White can invade with heavy pieces on the a-file as well as having the option of playing on the kingside.


How do I know that the majority of bitcoin miners are not XYZ government's facilities?

Question: Even if "Satoshi Nakamoto" is/was actually a real person, how can I be sure that XYZ government (XYZ can be US, or China, or ...) does not have now (or will not have in the future) 51% of the hashing power to mess with the bitcoin network transactions when the right time, in their opinion, comes?
Comment: Do you believe conspiracies easily? If yes, we can't help you.
Answer: Your answer is Incentives.
Let's imagine a bad guy, called Mallory, has an interest in attacking Bitcoin and has either created for himself, or desires to, 51% of the hashing power required to start shenanigans. (Start, because he has to maintain and grow that hashing power for sufficiently long to outpace the 'good guys'.)
To start with, there's no technical or legal way to prove that Mallory hasn't, or cannot, obtain that 51% any more than than there's a technical or legal way to prove Mallory hasn't, or cannot, obtain nuclear devices to hold the world to ransom like a James Bond villain.
Instead, you're relying on incentives. Assuming Mallory has spent $1 billion to marshal his forces, you have to wonder - would it make sense to destroy Bitcoin? If he does, his $1 billion is lost. True, perhaps he plans to make $1.1 billion from the chaos, and so the cost - to him - is "worth it". Or is the cost now so high that even Mallory stops and thinks "Hey - I'm making $0.1 billion a year from securing the network. It's actually more profitable to keep doing that, even though I'm a bad guy."
It's also worth pointing out his 51% only allows him to double-spend money he's already spent.
You specifically suggested that Mallory is a Government. We can look again at the incentives above: if his interest is to destroy Bitcoin as an alternative, then he'll quickly run into trouble: everyone will rapidly know that the 51% was achieved and so everyone will know that someone (Mallory will not likely reveal himself) has mining resources previously unknown. Perhaps a more efficient SHA-breaking algorithm. Even if Bitcoin itself is flown into the ground by him, alternate algorithms can be put into place such that a Bitcoin2 is immune to his attack. So: Mallory has now spent huge amounts of his resources, revealed something that would be of interest to his existing adversaries (that he has a means to break an encryption algorithm they use) AND has found himself back at step 1: Bitcoin2 is up and going without him. What attacker deliberately makes his own position worse?
Comment: Larger hashing power only lets them double-spend funds they've just spent. How much would they get before people noticed? Very, very little, and not enough to bring down Bitcoin. Why reveal you have that capacity when you can just print off the dollars needed?
Comment: What if the imcentive is to lure a party PQR to invest heavily in bitcoin, and then crash it? After all, several billion dollars is pocket money for US (since 2008 it stamped trillions) but for PQR this may not be so (yes, I do think that if Mallory is a government, it is most likely the US government).
Comment: What does PQR stand for?
Comment: Then my point still stands: would the US Government reveal that they have broken SHA in order to destroy a Mafia? I suggest to you they would not: hiding they have broken it is more valuable than destroying a Mafia whose base is the people within it, not the bitcoins in their wallet.
Comment: Does US government really have to break SHA-256 for that? It needs only to have a larger hashing power than the rest of the miners.


Infidelity and Forgiveness guidance

Question: My husband cheated on me after 3 years of marriage.  I've decided to stay for all the other things he is and does.  Buddhism has helped in all other facets in my life. What would the Buddha advise me to do, what tools would he suggest in overcoming the betrayal of trust, the lying and find my way back to a happy partnership with someone I believe deserves the forgiveness.  I no longer want to speak to him in a way which I feel that is punishing for his transgression.  Please help.
Answer: According to the Buddha, confessing one's misdeed, seeing the fault and blameworthiness in that misdeed, and resolving not to transgress again is considered a maturing, a growth in a person. So too is the ability to accept that confession, forgive the person and harbour no malice.
I hope your husband understands the hurt he has caused you after making a solemn vow of fidelity, and that he has resolved to never do that again.
Now that you have decided to continue stay married, the Dhamma would tell us to let go of thoughts such as 'he cheated on me, he lied to me, he betrayed me'. For holding on to such thoughts will not allow you to find peace and move forward. Re Dhammapada verses 3 and 4.
I did a search on Google a little while ago and according to the results the estimate is that 30% of married men will. Ofcourse the results will vary based on location. I am currently in Sydney.
Also some studies have shown that 1 in 4 or even 1 in 3 marriages end in divorce.
So relationships are risky business, but they can be rewarding too. People make mistakes. However having the maturity to, admit the mistake, have the insight to see the error in it, and forgive and continue to move forward together lovingly is the Buddhist way, but it takes two.
If one party is continually failing to hold up their part, the Buddha says it's better to live alone, our find suitable companions. Also even in relationships we are adviced to practice being an island unto ourselves. For all meetings end in parting.
I recall watching a talk by Ajhan Brahm on this topic some time ago. Perhaps you might find that useful.
No matter what you do, don't live in regret and with thoughts of anger.
In addition you will find it useful developing the practice of the 5 daily recollections recommended by the Buddha.
http://www.accesstoinsight.org/tipitaka/an/an05/an05.057.than.html
I wish you well.
Answer: It is possible that there are answers directly in scripture relating to your situation.  If there are, I am not aware of them.
There is some guidance that is in the spirit of Buddhist awareness that I can offer you with regards to some of the spaces you are likely to go through.
Real Buddhist practice can be the most transformative when dealing with emotional unpleasantness.  It is as if during times of stress, our mind reacts like a hornets nest being hit with rocks.  "Stuff" gets stirred up; and long supressed emotional conflicts and past traumas seem to rise up to the surface -

If you wish to understand yourself, you must succeed in doing so in the midst of all kinds of confusions and upsets. Don't make the mistake of sitting dead in the cold ashes of a withered tree. - Enyo

I suggest throughout your path of forgiveness, you keep the spirit of that quote  in front of you.
When you try and bulldoze through upsets and constantly overcome emotional setbacks, it's easy to get swept up in the mess of thoughts and feelings - and easy also perhaps to stop caring; or to lose sight of the spiritual possibility that gives you power to face what frightens you.  I find that if I treat my upsets as an opportunity for awareness and awakening, I have much more power in traversing the dangerous territory of the mind.
For now, I will refer to you as two - I will say it when referring to your mind ( to MIND ) and you when referring to possibility of being who you really are ( to SELF ).
It is nasty.  It will attempt in many insidious ways to sabatoge your goal.  You wish to forgive, and it will do what it can to try and make sure that doesn't happen.
Your goal is forgiveness.  It's goal is survival.  It will attempt to protect you from getting hurt again using whatever resources it can.  It does not want you to be free.  It wants you to be safe.
You may find that yourself in an argument with your husband about something totally unrelated to the infidelity - and it will start chattering away.  "Well what does he know anyway?  He cheated.  Why do I even trust him?  He might be lying to me right now."
If every time thoughts like that arise, you try and suppress them; overcome them; or the like, you will lose the opportunity of awareness.  What will give you freedom is if you can find a way to give space to those thoughts without succombing to them or trying to overcome them.  If you can just let them be, they will lose their potency and your awareness will expand.
You might also find it thinking negative thoughts about you.  "I'm such a fool.  He doesn't even love me.  Why am I forgiving him?"  It is the same thing, the target is just reversed.
If you deal with these thoughts as the TRUTH - you will be trapped, a helpless victim of it's whims and fancies.  However if you permit these thoughts to exist; recognize them for what they are; and allow them to be - as it talking - then you will gain freedom.  The more space you have for what you consider to be the worst parts of yourself - the more your awareness will expand - and forgiveness will stop being the right thing to do or a good idea and become a natural freeflowing expression of your Self.
It is very difficult.  From my perspective, infidelity is one of the most difficult upsets, because the emotions that get triggered tend to be the most primal and the most deeply rooted.  If, however, you find a way to give yourself space - not once, but repeatedly - then this can become a most transformative experience.
The last bit I have to offer is this:  You chose to forgive.  You didn't have to choose that, and many people don't - and I suspect the majority of people who do don't have the awareness to confront it head on as you are.  Your word given freely has a great deal of power.  If you relate to your word as a sacred promise independent of any emotional state or discomfort you feel, this too can help you guide yourself.
As you chose this freely, you get to be the author of your destiny; not a victim who is at the effect of something or a bystander watching your emotions overcome you.  Because you said, "I choose to forgive", that is solid ground you can stand on.  That is you.  It would not say that.
Answer: It's impossible to know what the Buddha would have said, but to make a guess, he would have looked into your mind to see what faculties are developed, what are lacking, what  inclinations and latent tendencies you have etc. Then he would have given you a customized sermon to put you on the path to end of all suffering.
A lay disciple of the Buddha would say, if your husband broke the precept, he would have to suffer for that Karma in the future. You don't have to punish him yourself. The grief and the disappointment you are experiencing is a result of your past bad Karma. Samsara is so long that the amount of tears you have shed for heatbreaks like this is greater than the water in all the oceans.
Dhammapada -213 comes to mind:

From affection springs grief, from affection springs fear. For one who
  is wholly free from affection there is no grief, whence then fear?

The Buddha preached about 7 types of wives to Sujatha, the daughter-in-law of Anathapindika. One of the good wives out of the seven is the motherly-wife:

(matusama or matubhariya) – she treats her husband like her son in
  every way, being compassionate and kind, as well as caring responsibly
  after his wealth;

A person who lets his desires overcome his sense of shame and fear(of consequences) is like a kid who goes after things by instinct. He's no longer a matured adult. So you have to act like a motherly-wife and try to bring him to the Dhamma. Practice compassion with wisdom, teach him the demerits of breaking the precepts and try to make him understand how his actions will ruin his life and your relationship.

Infidelity and Forgiveness guidance