how to write validation for currency fields in InfoPath 2010

Question: Hi I have an InfoPath form where there are some date fields and cost fields. Date fields are like Startdate and Enddate, Cost fields are like StartCost and EndCost.
My validation is such that whenever Endcost is greater than 0 and users click submit without entering any date then it should throw error message.
I have taken a variable and assigned it to the error message and trying to show this message when the user clicks on Submit.But this is not working some how with the rules. Can someone help me out in this.
Answer: you can use infopath Validation rules. you can assigned this rule on your date feild, this rule's condition check on the cost and date values and show an error message when the condition is true.
Comment: Hi Saeed , that wont work in my scenario as this will show a pop up box when user hits submit which is InfoPath default validation error message. I am looking for something which should validate and give user friendly message. I was able to do this for all other fields except the scenario which I have mentioned in my question above. Thanks.


Convolution: Laplace vs Fourier

Question: Are there real world examples when it is better to use laplace instead of fourier to compute a convolution? And vice versa. Fourier can use negative numbers (as in 'integrates from minus infinity to infinity'), but what kind of benefit does that have?
Comment: The better question I think is, which convolution should I use given the domain of interest of my problem?
Comment: Well, whether you are dealing with the entire real line or the half line.
Comment: Any time you have a signal that rapidly vanishes with sufficient distance from an origin, i.e., a gaussian signal.
Comment: Please elaborate on ' domain of interest of my problem'
Comment: Real world examples of dealing with the entire real line?
Answer: An engineer's perspective: (A mathematical rigorous explanation, I am not aware of)
Fourier transform is used in steady state signal analysis and Laplace in transient signal analysis. It is preferable to use Laplace for a system's response to step and impulse signals and fourier for continuous signals. Laplace works well for initial value problems and fourier for boundary value problems.
For control systems where one is interested in stability analysis, Laplace transformation naturally defines a transfer function and this in turn gives the poles and zeros of the systems. (Poles and zeros determine if the system in consideration is stable or not - it actually tells much more than that)
For instances where one wants to look at the frequency components or "spectrum", Fourier analysis is always the best. The Fourier transform is simply the frequency spectrum of a signal. Another example is solving the wave equation. Fourier actually used Fourier series and fourier transforms for heat conduction problems (which is a boundary value problem).
A reason that hit me when I read Ron's comment:
Consider a signal $f(t)$ in the time domain. If we look at the positive direction of the time axis, we are looking at the past information left by the trail of the signal and the negative direction indicates the future. If one is interested in the future, one would go for Fourier transform (integral is from $-\infty$ to $+ \infty$) and if not Laplace is preferable. That's why Fourier transform makes sense when looking at sinusoidal signals because one has an idea of what is going to come. If $f(t)=0$ for $t<0$, then the Laplace and Fourier transforms coincide for the signal (causal systems). The response of such systems depend only on what happened so far.
Comment: Why can't I use Fourier for transient signal analysis? "Laplace works well for initial value problems and fourier for boundary value problems" Why? "Laplace transformation is easier to deal with. It naturally defines a transfer function" Please elaborate.Please give an example of "whose solution, at times may be difficult to compute."
Comment: Edited: read the last paragraph. Solving any differential equation reduces to solving an algebraic equation when we take laplace (this is true for almost all signals that come up in signal processing or control). Does this not make the solution procedure simpler.
Comment: Aside from the things above: How about the application of Fourier and Laplace in image processing?
Comment: Image processing also comes under signal processing, so every thing that is mentioned above holds. It would be better if you are more specific in your question, so that you get all your doubts cleared.
Comment: The most books on image processing cover 'convolution' in combination with DFT and FFT, but not with Laplace, so I wondered whether this was possible or not. And where I could find an example of image processing with laplace transformations.
Answer: The answer to your question comes down to boundary conditions.  Say, for instance, you want to solve the wave equation.  On one hand you might be interested in any finite energy solution you can find; then you don't care about the boundary behavior (except for the finite energy constraint) and you should use the Fourier transform because the Laplace transform will ignore solutions which don't vanish on the negative part of the real line.  On the other hand, maybe you are looking for waves on a string where one end is fixed; then you only care about half of the real line and you should use the Laplace transform.
You ask specifically about convolutions, but the answer is the same.  You are either taking the convolution of two functions on the whole real line (in which case you should use the Fourier transform) or the convolution of two functions on the ray $[0, \infty)$ and you should use the Laplace transform.
In the end, you shouldn't think of the Fourier transform and the Laplace transform as fundamentally distinct: the Laplace transform of $f(t)$ evaluated at $s$ is just the Fourier transform of $\mu(t)f(t)$ evaluated at $is$ where $\mu$ is the Heaviside function.  Multiplying by $\mu(t)$ has the effect of imposing boundary conditions on $f$, and this can make life more complicated for the Laplace transform.  For instance, the beautiful symmetry in the Fourier inversion formula is lost when inverting the Laplace transform.

Convolution: Laplace vs Fourier


Why does the blade height goes on decreasing in a multi-stage axial flow compressor?

Question: The axial compressors used in jet engines have their blade heights in decreasing order in the direction of the flow.
Answer: The blade size reduction is to achieve large pressure rises.the pressure is proportional to the volume.Axial flow compressors produce a continuous decelerating flow of compressed gas,for high efficiency and large mass flow rate, particularly in relation to their cross-section.the casing around these blades also reduces.high-pressure gas enters a turbine, where it expands down to the exhaust turbine.
Comment: + Right. As the air is squeezed, its volume decreases.


Visualforce markup used to display a required password field, with field type "password"

Question: Inside a pageBlock with mode="edit", I'd like to show a required inputField with the type set to "password" instead of "text".  When I use inputSecret, even with required="true", it doesn't show the red bar indicating that the field is required.
I've been able to do it with a lot of tags, but I'm thinking that there must be an easier way.

<apex:pageBlockSectionItem >
  <apex:outputLabel value="Password" />
  <apex:outputPanel styleClass="requiredInput" layout="block">
    <apex:outputPanel styleClass="requiredBlock" layout="block" />
    <apex:inputSecret value="{!MyObject__c.Password__c}"
      required="true" />
  </apex:outputPanel>
</apex:pageBlockSectionItem>

Is this actually a bug (that inputSecret doesn't show the red bar)?
Answer: It is not a bug in apex:inputSecret.  It happens with all non apex:inputField tags, including apex:text. See this post.
The reasoning is that you can use whatever styling you want to indicate that it is required.  For example, I have a Force.com Site where I specify that a field (using an apex:inputText) is required, but I use a red asterisk to indicate requiredness visually. If you want the styling from SF you have to use their inputField or follow one of the workarounds for using their style class.
Answer: While it's not the cleanest way to do it, it works, and encapsulating it in a compoment will make it feel clean.  Bonus points if you add custom CSS to drive the component so it doesn't break during the next release.
Component
<apex:component>
  <apex:attribute name="errorMessage" required="false" type="String"
    description="Error Message"/>
  <apex:outputPanel styleClass="requiredInput" layout="block">
    <apex:outputPanel styleClass="requiredBlock" layout="block"/>
    <apex:outputPanel styleClass="errorMsg" layout="block" rendered="{!NOT(ISBLANK(errorMessage))}">
      Error: {!errorMessage}
    </apex:outputPanel>
  </apex:outputPanel>
</apex:component>

Visualforce Page
<c:RequiredFieldPanel error="{!errorMsg}">
  <apex:componentBody/>
</c:RequiredFieldPanel>


Why is Class#allocate a public method in Ruby?

Question: Why is MyClass.allocate a public method in Ruby? Under what circumstances would you want to create an object but not run initialize on it?
Answer: Deserialization comes to mind. A class may be serializable but might not have an initialize that takes no arguments, and that code shouldn't need to initialize it to something just to immediately undo that work.
Basically any scenario where you initialize an object differently then your typical case it becomes useful to separate those two steps.
Answer: sometimes you want to "avoid" the initialize method, if you want to short-circuit it for some reason (ex: Time.allocate might be "faster" than getting a real time object)


How to detect built-in laptop display?

Question: xrandr and similar tools will print information about the various graphics ports available on a machine. However, there doesn't seem to be a simple and reliable way to detect which one of them is the "native" or built-in display. Whether something is built in is a bit vague anyway, and in case of desktop machines there is no built-in display, but if there's a well-defined way to detect it it would be useful for swapping between built-in and external monitors.
Answer: As a general rule of them (from this question, as well as personal experience with xrandr on laptops), laptops will either use eDP1 or LVDS1 as their '"native" or built-in display.'  Here is a bit of demystification from wikipedia: eDP1 stands for embedded display port.
If you are looking for a way to script this behavior so you can easily swap automatically when, for example, an external monitor is plugged in, check out the example script in the xrandr entry for Arch linux.
The Arch page provides a nice example script (you will have to set your variables yourself) that you can name, for example, check_displays.sh.  Then, as long as it is executable (chmod +755 check_displays.sh), you can run it whenever you connect your displays to easily toggle them.  You will have to manually run them, however, unless you have a script that will automatically monitor for changes.
For example, if you want something that will automatically monitor for changes in your inputs, the accepted solution to this question provided a script (albeit a somewhat hacky one) to apply preconfigured changes when a new output was detected.
Lastly, if you would like to output on all connected displays in the simplest way possible, you can run xrandr --auto .  This comes from man xrandr:
--auto For connected but  disabled  outputs,  this  will
          enable them using their first preferred mode (or,
          something close to 96dpi if  they  have  no  pre‐
          ferred  mode).  For disconnected but enabled out‐
          puts, this will disable them.

How to detect built-in laptop display?


Display website as wallpaper?

Question: Is it possible in elementary OS 5.1 Hera to display a website as wallpaper? I'd love to render https://wall.marco.betschart.name/ as my dynamically changing wallpaper, but I'm not able to figure out how.
Answer: You can get it done by Komorebi, it allows you to set a webpage or a video as your wallpaper.

Download the .deb file from :
https://github.com/cheesecakeufo/komorebi/releases
install it using gdebi or the dpkg command from terminal
search for wallpaper creator
there you can easily set the webpage as your wallpaper.

http://ubuntuhandbook.org/index.php/2018/07/animated-wallpaper-background-ubuntu-18-04/

Display website as wallpaper?


Glass edges look blurred

Question: I'm modeling an interior. As you can see, a part of the table's glass top looks blurred. I think this is given by the noise due to the engine lacking data to understand how to render the transarency of glass.
Here is a detail of my problem and the the nodes of the glass material.
Any advices for "sharpening" the edges of the top?
Comment: Why are you using a simulated glass shader? I don't think it is actually blurred, just the appearance of the glossy/transparent mix. Have you tried using just a Glass Shader instead - that would include refraction which would make it look far more realistic (or try replacing your Transparent shader with a Refraction shader)
Answer: It looks like the "blurred" part is mostly volume shader, surface is tranparent.
If you don't want to change your shader, you can try to use a bevel on the edges to catch the light and make it look real somehow.

Glass edges look blurred


AntMiner S5 chain #2 intermittently operational

Question: Why is my AntMiner S5 chain only intermittently operational? What could cause this, how could I diagnose it, and what is the solution? Will BitmainTech replace it for me? How do I know if it's under warranty? Is there a warranty?
Answer: Why is my AntMiner S5 chain only intermittently operational?
It's due to hardware failure.
Will BitmainTech replace it for me?
Yes, I had the same issue. I had to pay to ship it back to them, and they very promptly shipped back a replacement board.
How do I know if it's under warranty?
Ask them. They're able to figure it out for you.
Is there a warranty?
Yes, I believe it's 3 months (90 days).
Answer: Someone suggested:

And first look through -
  https://bitmain.zendesk.com/hc/en-us/articles/204875015-How-to-diagnose-S5-hashing-PCB
Then if needed try -
  https://bitmain.zendesk.com/hc/en-us/articles/203559969-My-S5-hashes-at-about-600GH-S

Oddly, I unplugged the "Power Cable to Control" (with it still running), which cut the power to it, and plugged it back in. I also sprayed the Chain #2 board with some electrical contact cleaner, and that helped. Now the little red light on that board is on!
Update: But the it's no longer on now! ☹ It just shows: "------ -------- -------- -------- " in the "ASIC status".


Material that untangles itself when a current is applied?

Question: I remember years ago in school my chemistry teacher showed us a tangled wire that untangled itself when a current is applied, can anyone suggest what the material may be?
Comment: Furthering this, what about electro-active shape memory polymers, are they a heat free alternative of shape memory alloys?
Comment: Relevant video: https://youtu.be/FBaIdvgbBAM
Answer: You are almost certainly thinking of nitinol wire or "memory wire".
However, it's not electricity that makes it untangle.  It's heat.  Running current through the wire is just a way to heat it.
When at room temperature, nitinol wire can be easily bent.  When heated, it acts like a spring trying to go back to its unbent shape.  You can see the same effect by twisting some wire, then dropping it into boiling water.
There have been "electric pistons" built on this principle.  The piston is driven by a spring of memory wire.  When cold, the piston is easily compressed.  When the spring is heated by running electric current thru it, it pushes against the piston harder than what it took to push the piston in when cold.  This effect has niche uses but is mostly a curiosity.  The overall cycle is not very efficient.
Comment: @allo You can get useful energy out of a temperature difference/gradient. The piston would not work if the whole engine was hot, but it can work when the wire is hotter than the surroundings. Likewise, the pistons in a car engine wouldn't work if the surrounding atmosphere was as hot as burning petrol, but they can work when the surroundings are cool. You can also "power" an engine using "cold", e.g. using a block of ice to run a Sterling Engine: it's the *difference* which matters.
Comment: Oh I understand, thanks for your response. So I'm assuming relatively large currents are necessary for reaching the temperatures required for it to return to its original shape?
Comment: @Agrif123: Metals generally have very low specific heat, so probably not. You realize an incandescent bulb filament reaches 3000°C almost immediately after you switch it on, right?
Comment: Out of curiousity: I guess your "electric pistons" get the energy to "push harder" from the heat. But don't the laws of thermodynamics tell us that you cannot convert heat directly into energy?
Comment: What I find most intresting are nitinol implants that fold into their form when heatet by body temperature, like stents.
Answer: That was a shape memory alloy, probably nitinol.


Chilkat mail UWP on Windows 10 Phone gives Class not registered error

Question: As explained in http://www.chilkatsoft.com/downloads_uwp.asp, we installed the Chilkat UWP runtime via NuGet. We then used the following sample code:
https://www.example-code.com/csharp_winrt/smtp_simpleSend.asp
which should send an e-mail (using our own Chilkat unlock code).
However, although the program compiles and runs (we test it on a Nokia Phone by deploying it straight from Visual Studio on the device) we directly get an exception on the first line:
Chilkat.MailMan mailman = new Chilkat.MailMan();
InnerException is Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))
EDIT: I actually DID  find a solution. I had to copy the Chilkat.dll in the same directory where the Package.appxmanifest was located (down from the subdirectory bin\Release). This doesn't mean it now works. Chilkat logs (part of it:)               smtpAuthenticate:
                This SMTP server did not list authentication methods.
                Defaulting to LOGIN authentication method.
                login_method: LOGIN
                auth_login:
                      SmtpCmdSendFailed: AUTH LOGIN
                    --sendCmdToSmtp
                  --smtpSendGet2
                  AUTH LOGIN failed
                --auth_login
                Failed to login using LOGIN method
              --smtpAuthenticate
I use the same settings as the e-mail program uses, as far as I can see.
Does anyone has an idea?
Comment: I actually DID  find a solution. I had to copy the Chilkat.dll in the same directory where the Package.appxmanifest was located (down from the subdirectory bin\Release).
Answer: I'm sorry to say that Chilkat abandoned support for Windows Phone many years ago.  (Windows Phone was a complete boondoggle..)


Hibernate: How can I join 2 classes in one table?

Question: So, I'm pretty new to Hibernate and I have a problem.
I have an abstract class (the super-class, class Super), and 5 subclasses which should use the proprieties from the class Super and add a new propriety (a new column)
So how can I do this? Should I extend the class Super from java, or it's enough to join the classes using a JPA annotation.
Here is the second problem. How can I have 1 table for 2 classes.
Someone (smarter than me) told me to use the  @JoinTable, but form my searches with google, I think I need to use @Inheritance(strategy=InheritanceStrategy.JOINED)
Can I use the @JoinTable too?
Answer: Yours is a case of inheritance:

add the @Inheritance(stretegy=InheritanceStrategy.SINGLE_TABLE) annotation on your Super
add the @DiscriminatorColumn annotation (and setting its attributes name and discriminatorType) (again on the Super)
on each subclass extend the Super, and add the annotation @DiscriminatorValue, with different value for each of the subclasses.
Answer: If you are new to Hibernate, you should read its documentation. Inheritance strategies are explained here and using annotations to express inheritance strategy is explained here


GX23-2 Lampholder removing wires without cutting

Question: An existing lamp holder has cracked and will not hold a lamp. How can I remove the existing broken lamp holder without cutting wires? The pictures are of one I can cannibalize.
Answer: You probably can't. I would just cut them back an inch or two on both the bad one and the "donor", then use splices on the wires.
Answer: They are generally soldered on. The 2nd picture shows the plastic covers, which push in, which inside is where the wires are soldered on. You'll need to find a way to pull these out. Once they are out you can melt the solder with a soldering iron to remove the wires.


My code uses `ClebschGordan` but `Mathematica` is using `ThreeJSymbol`

Question: I'm using a function that calculate CG coefficients with the function
ClebschGordan but instead, I've got the following error because Mathematica is using ThreeJSymbol:
ClebschGordan::phy: "ThreeJSymbol[{1/2,1/2},{0,0},{1/2,1/2}] is not physical.

I know that this 3JSymbols isn't physical but is a valid value for a CG coefficient:
ClebschGordan[{1/2, 1/2}, {0, 0}, {1/2, 1/2}]

gives 1 as result.
Edit: Here is all the code and the actual code that I'm running.
GeneradorQs[M_] :=
 Module[{l = Length[M], q, i}, q = {M[[l]] + M[[l - 1]]};
  Table[AppendTo[q, q[[i]] + M[[l - (i + 1)]]], {i, 1, l - 3}];
  q]

RangoAngular[j_] := Table[m, {m, -j, j}]

QVD[k_, q_] :=
 Module[{i, total = 0},
  For[i = 1, i <= Length[k], i++,
   If[MemberQ[RangoAngular[k[[i]]], q[[i]]], total += 1]];
  If[total == Length[k], True, False]]

Mexico[k_, q_, M_, j_, m_] :=
 Module[{l = Length[M], prod = 0, i},
  prod = ClebschGordan[{1/2, M[[l - 1]]}, {1/2, M[[l]]}, {k[[1]],
     q[[1]]}];
  For[i = 1, i <= l - 3, i++,
   prod *= ClebschGordan[{1/2, M[[l - i]]}, {k[[i]],
      q[[i]]}, {k[[i + 1]], q[[i + 1]]}]];
  prod *=
   ClebschGordan[{1/2, M[[1]]}, {k[[l - 2]], q[[l - 2]]}, {j, m}]]

Lapiz[K_, M_, j_, m_] :=
 If[Total[M] == m &&
   QVD[K, GeneradorQs[M]], {Mexico[K, GeneradorQs[M], M, j, m],
   M}, {0, M}]

And I'm calling the function Lapiz with:
Lapiz[{0, 1/2}, {1/2, -(1/2), 1/2, -(1/2)}, 0, 0]

Edit${}^2$:
The snippet:
For[i = 1, i <= l - 3, i++,
   prod *= ClebschGordan[{1/2, M[[l - i]]}, {k[[i]],
      q[[i]]}, {k[[i + 1]], q[[i + 1]]}]];
have to be changed for
For[i = 1, i <= l - 3, i++,
   prod *= ClebschGordan[{1/2, M[[l - (i-1)]]}, {k[[i]],
      q[[i]]}, {k[[i + 1]], q[[i + 1]]}]];
Answer: You probably entered
ClebschGordan[{1/2,1/2},{0,0},{1/2,-1/2}]

and got the warning message. This happens when you use angular-momentum quantum numbers that don't satisfy the conservation laws. In this case, the rule $m_1+m_2=m$ is not met, see the documentation for ClebschGordan. However, Mathematica still produces the correct result, i.e., 0. This just says that the product state with individual angular-momentum z momenta $0$ and $\frac12$ does not occur in the total-angular-momentum state with z angular momentum $-\frac12$.
All you have to do is turn off the warning message, and everything will be fine:
Off[ClebschGordan::phy];

See also here.
In your function Mexico, you do indeed call ClebschGordan[{1/2,1/2},{0,0},{1/2,-1/2}] as I suspected. This is easily confirmed by modifying the definition of Mexico by replacing ClebschGordan by ClebschGordan1 to see what arguments the functions are getting.
Comment: As I said, you would have to post valid code to reproduce the problem before I can say anything else.
Comment: You may be misunderstanding something. Probably something in your  loops is wrong, but I can't guess what their purpose is. `CG` invokes `ThreeJSymbol` but that has the rule that the m indices add up to *minus* the total `m`. The error corresponds exactly to the incorrect invocation I mentioned, and everything is the way it should be. The warning does deserve to be turned off *when you know what you're doing*. In your case, the warning probably points to a separate error that is specific to your loop.
Comment: Sorry but it isn't the case. The message that Mathematica shows me says that I'm doing: `ClebschGordan[{1/2, 1/2}, {0, 0}, {1/2, 1/2}]`. I'm thinking that the problem is somewhere else because, I've written `CG[a_, b_, c_] :=
 If[a == {1/2, 1/2} && c == {1/2, 1/2} && b == {0, 0}, 1,
  ClebschGordan[a, b, c]]` but still giving me the same error.
Comment: I don't understand. You'd have to post the actual input that gives rise to the warning. I get the warning you quote when I input the values I stated above. What happens if you type `ClebschGordan[{1/2,1/2},{0,0},{1/2,1/2}]`? You don't get any warning, or do you? If you do, what version of *Mathematica* are you using?
Comment: I don't get any warning, just `1`. But when ClebschGordan is called with the same arguments **inside** my functions* gives me the error that I put in the post. My functions is ```
Comment: I'm posting all the code...
Comment: Yes, it's exactly as I thought. See my updated answer.
Comment: So, the message that gives Mathematica doesn't correspond with the actual arguments that is receiving?
Comment: @David, it should be noted that *Mathematica* is using a very general definition for all of `ClebschGordan[]`, `ThreeJSymbol[]`, and `SixJSymbol[]` that will work for arguments not necessarily corresponding to the physically sensible ones, but is helpful enough to warn you if you are doing so. (If you need a refresher on the restrictions, see [here](http://functions.wolfram.com/HypergeometricFunctions/ClebschGordan/02/).)
Comment: @J.M. Thanks. I fond that the `For` in `Mexico` have the indices in an incorrect way.


Focus on 1 muscle group or not

Question: I am thinking of building some muscle to help burn off the excess fat on my body. Of every part of my body, my abdomen has the most fat. So, I was thinking of focusing on my abs and obliques. But I have heard that a muscle imbalance can cause pain similar to that of a pulled muscle. So should I focus on my abs and obliques or not?
Answer: A few things you should understand:
Muscle imbalance can indeed cause long term pain or injuries so if you work out, you want to work on your entire body (and work on mental health is as important in my opinion but this ain't the place for that I guess).
Also, focussing on your abs will not help on getting rid of belly fat faster. The contrary will happen. You need to burn fat over your entire body and most ab exercises don't burn a lot of calories, so you won't lose fat fast. It's better to do compound movements and some cardio if you want to burn fat.
Hope it helps!
Comment: So, that means that for every day I do abdominal exercises, I should also exercise my chest and back, is that what you are saying? I have noticed when I had long term abdominal muscle pain(lasted a year) that doing an abdominal stretch helped with the pain and I did do basically no back exercises for 2 months(that is how long I could do just abdominal exercises before I had the 1 year long muscle pain) so maybe that pain was caused by a muscle imbalance.
Comment: Caters, yes to your first question in general.

Focus on 1 muscle group or not


Bonjour Networking Help on iPhone WiTap sample

Question: I can follow most of Apple's WiTap sample, but am sort of stumped on this bit in the send method:
- (void) send:(const uint8_t)message
{
if (_outStream && [_outStream hasSpaceAvailable])
    if([_outStream write:(const uint8_t *)&message maxLength:sizeof(const uint8_t)] == -1)
        [self _showAlert:@"Failed sending data to peer"];
 }

 - (void) activateView:(TapView*)view
{
    NSLog(@"ACTIVATE TAG: %d", [view tag]);
    //[self send:[view tag] | 0x80];
    [self send:[view tag]];
 }

 - (void) deactivateView:(TapView*)view
 {
    NSLog(@"DEACTIVATE TAG: %d", [view tag]);
    //[self send:[view tag] & 0x7f];
    [self send:[view tag]];

 }

Note that I have changed the send: argument to just the tag of the views, which are numbered 1-9. Originally the code had the bitwise AND and OR adjustments.
WHY?
I get the fact that the send method needs a uint8_t, but is that why the bitwise stuff is there? To turn a NSInteger into a unint8_t?
The code doesn't work with my changes above. It will log fine and visually the client will function correctly, but the messages aren't being sent/received correctly from client to client.
Can someone explain in small words what the bitwise stuff is doing? Or am I correct?
Thanks! This is my first question to SO so please be kind.

thanks for the response. I am still puzzled a bit. Get it?
Basically, why?
Is this just a geeky way of passing an identifier? Each of those views have a tag #, why not just pass that, and toggle the state (up/down) from the view class?
Is this just a case of "this is how the person who wrote it did it", or am I missing a crucial piece of the puzzle in that this is how I should also be structuring my code.
I would just want to pass a tag # and then have that tag decide what to do in a clearly readable function like toggleUpOrDownState or something.
This bitwise stuff always makes me feel stupid I guess, unless it is necessary, etc. Then I feel stupid but manage to muddle through somehow anyway. : )
Answer: Basically, [view tag] | 0x80 is setting the high bit in that value (so 00010011 would become 10010011) and [view tag] & 0x7f is removing it (10010011 -> 00010011).
Take a look at the [AppController stream:handleEvent:] method. You'll see this code:
        //We received a remote tap update, forward it to the appropriate view
    if(b & 0x80)
        [(TapView*)[_window viewWithTag:b & 0x7f] touchDown:YES];
    else
        [(TapView*)[_window viewWithTag:b] touchUp:YES];

So, the receiver of the stream is checking for that high bit.
Answer: I think it's possible for messages to get dropped, or arrive in a different order. So if you don't say if it's a tap down or tap up, it's possible that toggling would get thrown off.
Answer: I believe the reason why is that the high-order bit is another piece of the data passed from one peer to the other. It specifies whether the message is for the "start" of the tap or the "end" of the tap.
Based on that bit, the receiver either activates the tap view or deactivates it.
So in essence, they are putting two pieces of information in that single unsigned integer - which square was tapped (the low bits), and were the touches beginning or ending (the high bit).


Why stackoverflow's website is not optimized to big screen?

Question: It is really annoying that stackoverflow's website is not optimized to big screen - my screen is 29 inch wide - all the left and right side is unused, empty, and in the same time question / answer textfield / view is small, can not see long code lines. You can see the overall look down here:
Comment: Why is this downvoted so much?! On a 27" screen, the content's width is VERY VERY small! And even for creating a GreaseMonkey script I had to fiddle a lot with absolute pixels instead of percentages. Why are the values so hardcoded?
Comment: The center component is often narrower than I would like on a wide screen, even if I would not want it to be the full width of the screen. It would be **much** better if it were in a frame with draggabble edges so that each user could make it as wide or as narrow as suits them and their screen.
Comment: Closely related on Meta.SE: [Utilizing blank space](http://meta.stackexchange.com/questions/210995/utilising-blank-space)
Answer: While wider lines would be useful for some code (usually overly long lines indicate bad code unless it's a big string literal e.g. for a log message), they make normal text incredibly hard to read. So I don't think it makes lots of sense to make the page much wider.
Comment: @János no, the space on the sides should not be used *for anything*. You want to draw attention to the center, not have users be distracted by non-relevant items on the sides.
Comment: The ideal solution for overly long code would be a small button somewhere that stretches the code block over the full screen width while leaving anything else as it is.
Comment: I don't see the harm in resizing the width of the main text area if the browser window is wide enough to leave empty space otherwise. Nobody would be forced to make their browser window wider if they don't like long text lines. If the sidebars have a fixed width, and the rest of the window is used for the main text area, everybody can resize their browser to make the text as wide or narrow as they like.
Comment: @RetoKoradi that would be an extremely bad idea - practically, you would force users to use their browser window for SO _and nothing else_. I have many tabs open, some of them need a wide window. But I also want the SO text to be considerably smaller than my 24" monitor size. Implementing your suggestion would force me to use a second, smaller browser window for SO. And you don't even consider that not everybody uses a stacking window manager, it would be even more annoying with the tiling window manager I use at work...
Comment: agree, but at least that white space would be used for something
Comment: I think if Steve Jobs would be your boss, he would not hesitate to fire you, because screen is designed to show something, and not show the emptiness .. it is not about advertisement .. put something there, allign the whole freaking website differently, but I do not want to see white empty spaces
Comment: @János see http://store.apple.com/us - yeah, I guess Steve Jobs would have made the space grey instead. Anyways, if you have an awesome idea for a specific "something" that should be put there, feel free to propose it; otherwise, enjoy your blank space like everyone else does. But keep in mind there's already people who want to hide the "hot meta posts" box, so I don't think adding even more content to the site will find a huge following.
Comment: I hate to scrolldown the screen too much, I preffer to read everything in one wider screen than moving the text up and down and remembering the code. I usually have to copy paste some SO codes to Notepad++ and read it better there.
Comment: Yeah, nothing worse than ads etc. in that white space outside...
Comment: @l4mpi: Good point. I'm not using any web sites that require a wide window, but I can see how that would be a problem if you do. I could argue that having to scroll left and right to read **each line** if people post code with long lines is worse. But an ideal solution would work for all these use cases.
Comment: Of course, we talk about Themes - we don't ask to spend 100s of hours. Why do you want to decide that a user must use narrow columns if he prefers wider columns?
Answer: ThiefMaster points out one very practical reason to avoid this; here's another: right now, if you format your code so that it looks good on your screen, it'll look pretty much the same on anyone else's. Maybe a few characters wider or narrower if you're unlucky in the font department, but pretty close.
Whereas if you format your code for your screen, chances are it'll look awful on mine, where I keep the window at half-width to leave room for other things (like editors...) on the rest of the screen.
Chances are, you're using a whitespace agnostic language anyway; just wrap the long lines and your readers will thank you.
Comment: I am developing in Xcode, how is it possible that either in big, wide window or in small, narrow window source-code looks good?
Comment: On Stackoverflow, a lot of code is cut because the lines are too long. But this is not the subject of this proposal: If users like to better use the Monitor space by changing to a wide Stackoverflow-Theme, then it is and it should be their decision.
Comment: Easy - just get rid of the space-wasting sidebars in XCode.
Answer: The reason is user experience / readability.
StackExchange is so vast by now, it can answer this very question in itself:
https://ux.stackexchange.com/a/108803/101037
To address your specific arguments:

Parse Server Dashboard does not use "all the space", the empty space is just in between and information more scattered across the screen. This makes information such as the table in your screenshot harder to read, because your eyes need to scan the lines.
"Ugly" / "Tasteful" are is a subjective evaluations. You may as well ask why the site is called StackOverflow and not BufferOverflow.


Does bringing slits closer together increase or decrease intensity of interference pattern

Question: Does bringing the slits together affect the intensity of maxima for double slit experiment and also the diffraction grating? Does decreasing slit width affect the intensity of the maxima for a single slit experiment.
Comment: please give an explanation, even a crude one. I will accept it
Comment: Do the math and see.
Comment: I can understand that the fringe spacing decreases cannot make sense of the intensity
Comment: yeak ok, I have researched that intensity is $cos^2(\frac{d\pi sin\theta}{\lambda})$. So for small theta, (the central maxima), reducing $d$ will get you a greater intensity. Problem is 1 i don't understand it and 2 it's the wrong answer on a multiple choice in an exam question i have. So I struggle to verify the correct answer and neither can i explain it
Answer: First, let me tell you that amplitude is proportional to slit width because as slit width increases, more light gets through, so more energy is transmitted, and therefore, the amplitude must also get bigger (by the same factor).
Furthermore, intensity is proportional to amplitude squared.
By applying the 2 above statements, we get that intensity is proportional to slit width squared.
For the picture below, the x and y only represent that there is some kind of part in the equation, it is just not shown here, instead, it is denoted as x and y.

Answering below to: Does decreasing slit width affect the intensity of the maxima for a single slit experiment?
So, if we for example, reduce the width of the slit by a factor of two (we halve the width), what is going to happen, is that intensity will decrease by a factor of four.
$I$ = the central intensity before the width of the slit is reduced.
$I_1$ = the central intensity after the width of the slit is reduced by 2.
And since intensity is proportional to slit width squared, we will have $$I_1 = z\left(\frac d2\right)^2 = z(\frac{d^2}{4})$$ So, $d^2$ is reduced by 4, and because $d^2$ is directly proportional to intensity, $I$ (intensity) is reduced by 4. (The z represents some part of the equation).
So, yes, reducing the width of a slit decreases the intensity of the central maxima in a single slit experiment.
I hope that this helped! :)
Comment: Hello! I have edited your answer using MathJax (LaTeX) math typesetting. For future posts, you can refer to [MathJax basic tutorial and quick reference](https://math.meta.stackexchange.com/q/5020/). Thanks!
Comment: Thank you very much Jonas!


6 x 12 header capability

Question: I need to support a ridge beam on one end with a Douglas fir 6 x 12 x 12 ft long header. The load will be on a single point in the center and will be about 8000 lbs total. I can't tolerate sag as there is an expensive door/window assembly installed below. I cannot find single point header tables anywhere and don't care to enlist an engineer as most will not work on a single component basis. My experience and gut says it's good but I want to prove the math. Any suggestions?
Comment: What kind of load will be 8000 lb single point? How would this single point load be attached to this beam? You have to describe the situation in detail so potential commenters can know the implications of an opinion that might be wrong or even just questionable.
Answer: Yes, a 6 x 12 Douglas Fir-Larch (#2 and better) with a 12' span will support 8,000 lbs. at mid-span. It's deflection will be less than 1/3 inch when fully loaded.
If the 6 x 12 is a Select Structural, then it will support 10,300 lbs. and deflect about 1/4".
BTW, I recommend the window (vinyl, wood, whatever) that you are going to install below this beam should NOT be secured at the head in the middle one-half of the span.

6 x 12 header capability


Does different percentage chocolate set differently?

Question: My glaze did not come out as expected. Will chocolate set differently if I start with, say 60% vs 70% chocolate? If so, is there a suggestion as to how to adjust the recipe so a lower or higher percentage chocolate will work best in a glaze?
Comment: Could you please add your recipe?
Comment: 4 oz bittersweet chocolate (55%-65%), chopped
1/2 cup heavy cream
1 Tbsp light corn syrup

In a small saucepan, bring the heavy cream just to a simmer or microwave it in a bowl.  Take off heat.  Add the chocolate and syrup and let sit for 5 minutes.  Whisk until smooth.  Make this right before using since it's not easy to reheat.  If you do have leftover ganache, warm it up over a bowl of hot water whisking constantly.
Answer: For glazing the best is to use a couverture chocolate which is richer in cocoa butter than the standard chocolat (more than 31% for dark chocolate): https://en.wikipedia.org/wiki/Couverture_chocolate
But generally you can't find it in supermarket and you will need to buy or order in from a specialized shop. And when you check the nutritional informations, a lot of chocolates we find supermarkets will also have a cocoa butter percentage higher than 31%! The problem with these is that they are often the low quality chocolates, and their taste won't be so great and have a negative impact on the final taste of your cake...
So the best way is to try different types, ideally with the same recipe, and see which one works the best! Be patient, it took me forever to find an acceptable one... Also, make sure that your glazing recipe is good!


How hard is it to obtain perfect alignment of optical equipment?

Question: While reading a published paper, I read that some photons were being detected at the arm of a Michelson interferometer which was intended and set to have approximately perfect deconstructive interference. This was ultimately attributed to imperfect alignment and optical equipment. The paper also said that the experimenters used HeNe laser alignment and other protocols to try and make as best a setup as possible. This got me wondering; just how difficult is it to perfectly align optical equipment to yield 100% constructive or deconstructive interference? While I mostly want the practical knowledge of how difficult the task is, any and all scientific explanations as to why it is difficult or easy are welcome.
Comment: 0% and 0.1% are definitely different beasts.   0% is unattainable by an human constructed device ever made.  0.1% is easy.  In fact, 0.000001% is not uncommon.   0% is impossible.  The particular study you would be interested in is called "metrology," and it is the study of how we make measurements.  And one can make a living at it.
Comment: In practice one would design the experiment in such a way that there is a feedback loop that constantly adjusts the interferometer so that the detector sits at a dark spot. More precisely, there are usually two, three or more detectors to decide which way the optical path has to be tuned and by how much. If you want to see a practical implementation of this... LIGO is probably the most complex example of this type of interferometric zero measurement.
Comment: What is an acceptable error bound for you?
Comment: @onestrangequark can you please provide a reference for the paper you were reading?
Comment: it took a few years and millions of dollars to align the interfering lasers in the LIGO experiment ..... to detect gravity waves.
Comment: The question is more pertaining to the ideal 0% error, but if it assists in answering the question, anywhere from 0-0.1% error. I am not a professional, so I apologize if the information given is insufficient or unrelated in any way.
Comment: @PhysicsDave That's probably the understatement of the day... but I like it. ;-)
Answer: It is very hard indeed. It requires mechanically positioning all the optical components to accuracies of order ~wavelength of light and holding them in those precise positions while a fork lift truck rumbles by 50 yards away from your test apparatus or when your football-scholarship research assistant passes gas in the lab.
For this reason, experiments of this type usually rely on a couple of tricks to make them feasible. The first is that for the case of recombining two light beams and looking for interference, you can calibrate the device to zero in on one interference case out of the unlimited number of possible cases which would result as the optical components are progressively shifted by integer wavelength amounts.
The second trick is to look for relative changes in the interference pattern as the experiment is conducted rather than absolute measurements.


Jquery, how: click anywhere outside of the div, the div fades out

Question: In Jquery how would i make it so that if i had a div, with different elements inside of it, a select, a search input, etc, that when i click outside of the div, on the page, the div fades out, but i can click on the select and type in the search input and not have it fade? any help is appreciated.
-nick
Answer: Code Duck's answer is incomplete, because you'd need to have it not fade out if you click the DIV itself (only outside). So say your DIV that's supposed to fade out has an ID of "menu".
jQuery("#menu").click(function(){ return false; });
jQuery(document).one("click", function() { jQuery("#menu").fadeOut(); });

The use of one is more concise than the bind/unbind. Also namespaced events aren't really needed here if you use one because there's no need to explicitly unbind a particular click handler on document.
The return false is just saying "stop bubbling this event up to the document."
Comment: No, when you open the menu you call this code. "One" means it fires once then unbinds itself. After the menu closes click all you want all over the place and nothing is bound or gets called.
Comment: A more idiomatic jQuery way to do this would be to do jQuery("#menu").click(function(ev){ ev.stopPropagation(); });
Comment: nice, works great! but isn't there a better way than to check each time the user clicks the document? so if i randomly click everywhere on the screen, that's firing the function, isn't it?
maybe it's early but i don't understand how your code works, but it does.... mmmmmm
Comment: Hey man, i had this working, and then my hard drive crashed and i lost everything. I'm trying to re-build it but whatever i did with this code isn't working now, should this be the final code?

    $(document).click(function(){ jQuery("#menu").click(function(){ return false; }); jQuery(document).one("click", function() { jQuery("#menu").fadeOut(); }); })

it works the first time i click anything but the DIV itself, but the second time that i do that, it wont fade out
Comment: Yeah, that code I posted needs to run every time you open the div. So like `var d = openSomeDiv(); d.click(...); jQuery(document).click(...);`
Answer: Many modal dialogs use an partially transparent overlay that covers the entire page indicating that the dialog has focus. I would consider this the best way to accomplish what you want. If you really don't want the page darkened or grayed out, you can always just make the overlay completely transparent. For an example check out Facebox.
Answer: I know this is an older question, but here's an extension I wrote to add a clickOutside function to elements:
$.fn.extend({
// Calls the handler function if the user has clicked outside the object (and not on any of the exceptions)
clickOutside: function(handler, exceptions) {
    var $this = this;

    $("body").bind("click", function(event) {
        if (exceptions && $.inArray(event.target, exceptions) > -1) {
            return;
        } else if ($.contains($this[0], event.target)) {
            return;
        } else {
            handler(event, $this);
        }
    });

    return this;
}

}
With this you could easily do
$("#menu").clickOutside(function(event, obj) { obj.fadeOut() });

Answer: $("#menu").click(function(){
        $(document).unbind("click");
        $("#menu").show();
        $("#menu").bind('mouseout',function(){
        $(document).bind("click",function(){$("#menu").fadeOut();});
        });
});

This should do.. cheers.
Answer: Check this out
Demo is here
$('#menuBtn').click(function(e) {
    e.stopPropagation();
    $('.navMenuSecWrapper').fadeToggle();
    return false;
});

$(document).click(function() {
    $('.navMenuSecWrapper').fadeOut();
});

Answer: You can bind a click handler on $(document) like
$(document).click(function(){
  $(this).unbind('click');
  $('#menu').fadeOut();
  }

Comment: I haven't done much with bind. is your code saying that if you click an element with the class of "close_menu" that "#menu" will fade out?
I don't want the user to have to click a close button or anything like that, i just want it to fade if the user clicks outside of that div.
Comment: The click.close_menu is not about a css class; it's a named bind. I could have just put 'click' there, or used the .click method. I'll edit it to make it more clear. The click is being bound to the whole document.
Comment: wouldn't that fadeout the menu, even if i clicked on the menu itself?
Comment: Yeah, I wasn't feeling very with it that day. This came from a project where I built a dropdown menu, so it was supposed to close as soon as you clicked the menu, or outside the menu. Worked for us, probably not for what you were asking. I very much recommend Dark Porter's answer. It's what I was getting at, but fixed.
Comment: Actually, it wouldn't fade out with a click on the menu if you put an ev.stopPropagation() on the menu element.


Is there a way to access ubuntu files from windows?

Question: My laptop is dual boot
I was trying to update ubuntu but something went wrong , I think ubuntu is now corrupt from the inside out , I can no longer boot into it , I tried every possible solution but it either fails or shows countless errors . So I decided to save the files that are on it (it was my main OS , I have some very important files on it ) from windows if possible , then remove it completely and reinstall it .
So what's the best , safest and free way to get my files to windows ?
Comment: Do it from a live session. You can install software in Windows to read EXT4 file systems but it's notoriously unreliable and can further corrupt the exact data you want to retrieve.
Comment: +1 for "Do it from a live session" - I would only make clear that I mean for an **Ubuntu** live session for example booted from a USB pendrive.
Comment: "Ubuntu pendrive" = The installation media, in "Try ubuntu" mode.
Answer: If you wish to access it on your Windows through -for instance- a USB to SATA adapter, you will need a software like explore2fs (portable edition here on sourceforge).
This is only if your Linux partition is still relatively intact and unencrypted!
In the case you had it encrypted (that's an option at install sometimes people don't really pay attention to), there's no other (easy) option than to boot on it and log in to copy the files on a USB stick.
Worst case scenario would be a damaged AND encrypted partition, chances of recovery would be extra thin (close to zero).


I made a payment of bitcoin into escrow for services that were not delivered and bitcoin not returned

Question: I made a payment of bitcoin into escrow for services that were not delivered. I requested that the funds be returned and they have been removed from escrow, but never returned to me. Can I do anything to recover my funds?
Comment: How did you choose the escrow service?
Comment: Hi, it was an escrow service which was approved through the vendor, so I unfortunately went with it. Appreciate your response.
Answer: You can contact the service provider, and the escrow agent to request a refund, but beyond that there is likely nothing that can be done. If you have lost a substantial amount of money, you could file reports with your local law enforcement agency, but understand that there is almost no chance they will be able to help you recover the funds.
Bitcoin transactions are not reversible, once confirmed several blocks deep in the blockchain history, the chance of that transaction being removed or replaced is basically zero. The only way those funds can be returned, is if the person who now controls them decides to send a transaction paying you back.
Sorry for your loss here, it is unfortunate to hear that even after employing an escrow agent, your trade did not go as planned.
Comment: Thanks for your comment and thoughts. It was my first involvement with bitcoin and a learning experience. If it comes back I'll look at that as a bonus, as currently the vendor and escrow contacts are both ignoring any contact.
Comment: @Alrob01 I see in your other comment that the escrow was approved by the vendor, so that makes me wonder if the two were colluding (or perhaps, were the same person). If you employ an escrow agent, its best to find one yourself, that the vendor then also agrees with. In any case, I hope your funds are recovered!


Is Avodah Zarah still the great danger that it once was?

Question: I have no direct sources, but I seem to recall that various Chassidic rabbis, maybe others too, have taught that idolatry no longer has any real, or effective power. I think this is limited to Jews, although I may be wrong. It ended with Malachi and the end of prophecy, or alternatively around the second Temple period. (For example, T.B. Chullin 13b suggests that idolatry is not as serious an issue when outside the land of Israel.) If my memory is correct, and Avodah Zarah is no longer the great danger it once was, what if any, are the halachic and other consequences?
Comment: I've heard (from Rav Manis Friedman) that Avodah Zara and "selfishness" are synonymous. Anything that we devote ourselves to, anything we worship, other than Hashem, is considered AZ. Nowadays, it's no longer an external god but our own selfish aims. In fact, pure selfishness, not even trying to be altruistic, seems to be the idol of today
Answer: I would answer no, because paganism is no longer a thing. Yes, there is Islam and Christianity, but they are based on Judaism and do not constitute a dangerous threat to Judaism.
Answer: Jews abandoned idolatry after the return from Babylon.  The Talmud has a colorful explanation: The Jews captured the idolatry demon and destroyed it.  They were about to do the same for the sexual immorality demon, but didn't because sex is needed for procreation:

[After the return from Babylonian captivity, the Men of the Great Assembly said:] Woe, woe!  It is [the evil desire for idolatry] who has destroyed the Sanctuary, burned the Temple, killed all the righteous, driven all Israel into exile, and is still dancing around among us! You [God] have surely given him to us so that we may receive reward [by resisting him.] We do not want either him or reward through him!... [So the evil desire for idolatry] was surrendered to them.  He came forth from the Holy of Holies like a young fiery lion... They said: How shall we act? Perhaps, God forbid, Heaven may have mercy upon him!... The prophet said to them: Cast him into a pot made of lead and close its opening with lead, because lead absorbs the voice...  [They did so and he died.]
They said... Let us [also] pray for mercy for the Evil Inclination.  They prayed for mercy, and he was handed over to them. [The prophet] said to them: Realize that if you kill him [also], the world goes down. They imprisoned him for three days [to see what would happen], then looked in the whole land of Israel for a fresh egg and could not find it. [The Evil Inclination is responsible for sex, which is required for reproduction.] They said: What shall we do now? Shall we kill him? The world would then go down. Shall we beg for half-mercy [allow him to live, but not to tempt us]? They do not grant half-measures in heaven. They put out his eyes and let him go. It helped inasmuch as he no longer entices men to commit incest. [Yoma 69b]

The Midrash concludes:

Rabbi Hunia said in the name of Rabbi Dosa bar Tebeth: God created two evil inclinations in His world, the inclination to idolatry and the inclination to [sexual immorality].  The inclination to idolatry has already been uprooted [from the Jewish people]. The inclination to [sexual immorality, however,] still exists... [Song of Songs Rabbah 7:14]

After Babylon, the Jews did not just ignore idolatry, they were willing to die rather than be forced to worship idols! (Maccabean revolt, etc.)  So no, idolatry is no longer a problem for Jews.


How to create date picker for Dob in salesforce

Question: I want to create a date picker in salesforce in which i can only select date less then today date, i can't select date after today date, how i can achieve this task in salesforce.?
Answer: You can do this with jQuery Datepicker set the maxDate property to 0 so that it will disable future dates. Hope this helps.
<apex:page id="myPage" standardController="Contact">
    <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css"></link>

    <apex:form id="myForm">
      Select Date: <apex:inputText id="sDate"/>

    </apex:form>
</apex:page>

Comment: Your approach is good i knows this approach but problem is this if we want to select 1980 then we need to more and more click approx 12*35 = 420  click to go there so i think is very bed thing.

Another approach to go on 1980 to enter date by hand but user don't want to do this , user always select a date Using date picker .

So if you have any other idea then give me thanks in Advance.
Comment: Thank you very much i have solved it using your code and add some extra attribute in it like.

changeMonth: true, changeYear: true, maxDate: 0, inline: true, yearRange: "-80:+0",
Comment: @RavikantKedia If this works for you, can you please mark it as answer. It will help others.
Answer: You should use <apex:inputField> for getting the date picker. But for the validation, you should use controller method to determine whether the picked date is less than today, if not throw error message to user.
if(object__c.field__c > system.today()) {
    ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.INFO,'Please select date less than today'));
}

You need to add <apex:pageMessages> component in your VF page as well to show the message added in controller.
Hope is helps.
Answer: As Vigneshwaran rightly said that you will have to create and <apex:inputField> in your visualforce.
I think this will work when you bind the <apex:inputField> with an object field which is of date or date-time type (or you will have to create a dummy field) also it will not limit you from selecting past date. (The limit will be imposed in form of an error after user submit or you will have to write an on-change function on the field)
Alternatively, you may jQuery Datepicker which supports limiting the date value and has many other options as well.

There are many datpickers available apart from this.


How to record my microphone on Windows 7?

Question: I want to make a podcast kind of thing and record what I am saying on the microphone and then export it as an MP3. What is a good simple program to do this?
Answer: I'd use Audacity for this. It's a totally free audio recorder and editor. You can export into any format, but don't forget to fetch the "mp3 export plugin".
Answer: Windows has already integrate a sound recorder on its own. But if you want more feature then a 3rd party recorder is recommended


The Coin Collector's Problem

Question: I can not understand package-merge algorithm.
Can anyone explain package-merge algorithm step by step please?
How we package and how we merge?
Is there any other optimal algorithm for solving coin collector's problem?
Comment: Some background on the Coin Collector's Problem and 'package-merge' for anyone interested: http://en.wikipedia.org/wiki/Package-merge_algorithm
Answer: This is a code-free answer: I'm going to try and explain the method using some example situations, and hope it can be intuited from them as I generalise it.  Sorry it's quite long, but if you read it through methodically it should all make sense.
Let's say a coin collector has two sets of coins: a set of dollar coins and a set of half dollar coins.  However, the coin collector values each coin differently based on, say, the date it was minted.  Some are very rare and so are more valuable.
Now, the situation is: he has no ordinary money except for his valuable coins, and he needs to use them to buy something at a store, where the clerk at the counter will only take them at their standard value.  But as he values his collection, he wants to use the least valuable set of coins he can to make the payment.
So let's say he has 7 dollar coins and 5 half dollar coins, and he wants to buy something worth 4 dollars.  A simplistic solution would be to take just his dollar coins and rank them by value, select the 4 least valuable, and hand them over, pocketing the remaining 3 dollar coins, which are the most valuable ones.
But then he realises that if he takes two half dollars and "packages" them together, he can treat the package as a new dollar-sized coin.  To the clerk at the counter it's worth a dollar, but to the collector it's worth the combined value of the two individual half dollars he used.
A better strategy then is to look at his half-dollars, take the cheapest two, package them together as a new dollar "coin", and add ("merge") it into his set of dollars.
So now he has 8 (7+1) dollar-sized coins/packages and 3 (5-2) half dollars.
This step can be repeated once more, and now he has 9 dollar-sized coins/packages, and 1 remaining half dollar that cannot be packaged with anything else.  Since this is his most valuable half dollar, he realises that he should not use it and pockets it again, effectively removing it from the problem.
Now he just has a set of 9 dollar-sized coins/packages.  He sorts them by value, selects the 4 that are least valuable, and hands them over to the clerk, pocketing the remaining (most valuable) coins.
To generalise slightly: imagine he also has some quarters with him.  Before packaging the half dollar coins, the he must first package the quarters into half-dollar packages (selecting the cheapest pairs in turn, discarding the most valuable remainder, if there is one), and then merge them into the set of half dollar coins.
Hypothetically there could be lesser denominations: 1/8th dollars, 1/16th dollars, etc.  As long as they are negative powers of two the strategy can be generalised: sort the coins of least denomination, package them, merge the packages into the set of the next smallest denomination, and continue until you have only dollar-sized coins/packages.
(There's one other case that's worth considering: if the asking price is not a round dollar figure, e.g. 7 1/4 dollars.  In this case, before packaging the quarter-sized coins/packages, you first select the cheapest, hand it over and subtract it from the asking price, then package the remaining ones.
This also can be generalised: whenever the price requires a particular denomination (i.e. it is an odd multiple of that denomination); while packaging that denomination you remove the cheapest one first, subtracting it from the price.  By the time you get to the dollar stage, the price will then be a whole number of dollars.)
Comment: The Wikipedia article ought to explain it like this. Thank you.
Comment: well written, i agree with @jrodatus, having an example like this would have been better in the wikipedia article.
Comment: @mwfearnley please add this to Wikipedia page
Comment: What is the benefit of this over sorting all of your coins by numismatic value and then taking the first X number of coins that add up to $4? If you are at $3.50, and the next coin is a dollar, then just select the next half dollar with the lowest numismatic value instead.
Comment: Nice question.  I guess that's essentially a "greedy algorithm" approach...  But let's say you value all your coins roughly the same, and we put lower denominitions before higher ones (we can tweak the values to ensure this happens) - then you will find yourself preferring two half-dollars (which will be roughly twice as valuable to you) over one whole dollar.
Answer: I find the coin analogy unhelpful. You might too. More intuitive for me is to consider a set of rods of various lengths in powers of two: 1/4, 1/2, 1, 2, 4, 8, .... Each rod has a different price. You need to spend the least money on rods and yet span some exact distance X.
With any combination of these rods, you can only /exactly/ span a distance which is diadic, that is "which has factors only of two in its denominator", ie has a terminating binary representation after the point. You can't span 1/5 or 4 3/7 because no finite number of rods matches such distances exactly, there will always be a little left over.
So assuming you have do cover a diadic X, what rods do you use? Think about the smallest binary fraction used in your distance X. If X is 13 3/128 then that's 1/128. That's the level of accuracy you need.
a. If all your rods are bigger than 1/128 then you're stuffed. None of your rods are fine enough to make that last 1/128th. Bad luck.
b. If 1/128 is the smallest kind of rod you have, you're going to have to use at least one of them. There's no choice to go that extra tiny distance: you're going to use one. So may as well buy the cheapest 1/128 rod now. Then you can solve the remaining slightly smaller problem (13 1/64) with the remaining rods.
c. If your smallest rod is tinier than 1/128 (say 1/512) then it's possible that you will use them, but only an even number of them. If you use an odd number, you'll have some tiny amount (here 1/512) left over and whatever you do with the bigger rods can't get rid of that extra little bit and you are stuffed. So you're either gonna use none of them or an even number. If you end up using two, you'll end up using the cheapest two. If you end up using four, you'll end up using the cheapest four, and so on.
So you'll use them in pairs. If you take the cheapest two -- say they cost 5p and 7p -- then if you use them, then you'll use them, effectively, as if they're a single 1/256 piece costing 12p. So take them out of the 1/512 pile and consider them as if a 12p 1/256 piece along with all the other 1/256 pieces. The leftover third 1/512 piece, the most expensive one, is useless, it won't be used for the reason above, it is too fine and will leave over that tiny fraction.
Now we're done with the 1/512 pile, you can now consider the 1/256 pile, which is now the smallest and maybe has a proper 1/256 (say costing 8p) in it, and also our "package" of two 1/512s (costing say 12p). You can then package these up in a pair using the arguments above. It has a cost of 20p and equivalent to a 1/128 piece.
You've not committed to using any of these packages yet, you just know that if you do, you'll use the whole package. And you carry on, up the sizes, making the problem smaller each time, either by reducing the total number of pieces by packaging, or by reducing the target.
So eventually, you will reach your target, or prove that you can't.
The most important thing is to remember that when you build a package you're not, at that point, committing to use it, you're just saying /if/ you do, then you'll use the rods inside as a unit.
Answer: It doesn't lend itself to a very short explanation; have you read the Wikipedia page?
Comment: yes i read wikipedia.but it is unclear.when we package coins then we merge which list with this?
Comment: I find an algorithm
Package-Merge  Algorithm(I, X){S is empty;
for all  d, Ld list  of  items having width 2^d;
while  X  >  0  loop
minwidth =  the smallest term  in diadic expansion of X;
ifI=0then //is empty
return  "No  solution." ;
else
d=the minimum  such that  L is not empty;
r=2^d;
if  r > minwidth then
return  "No  solution."
else  if  r = minwidth then
Delete the minimum  weight ;
X= X -  minwidth ;
end  if
Pd+1=PACKAGE(Ld) ;
discard Ld ;
Ld+l=MERGE(pd+1,Ld+1);
end  if
end  loop
return  "S  is the optimal  solution."
Comment: *what is Ld+1 in above algorithm?why we discard Ld when it mybe  have one coins that have value=minwidth?

The Coin Collector's Problem


Why did some old cars use both electrical and mechanical fuel pumps at the same time?

Question: I was researching the Ferrari 250 GT Lusso and realized that it has an electrical pump at the fuel tank and it also has a mechanical fuel pump driven by the engine. The electrical pump feeds the mechanical pump which feeds the Weber carburettors. Why did they decide to use both an electrical and a mechanical pump at the same time? Wouldnt only an electric pump be able to fullfill the job without needing a mechanical pump? This video at the timestamp for example https://youtu.be/AVuSf6tkfpQ?t=68 he talks about how electric fuel pump works together with the mechanical pump in the 250 gt lusso. Or in this website author says you can install a modern pump instead of using the old electrical and mechanical pump combination http://tomyang.net/blog/2010/09/15/mechanical-fuel-pump-i/    In here they talk about how the electrical pump only feeds into the mechanical pump and doesnt influence the fuel delivery from mechanical pump to the carburettor. https://www.gtoengineering.com/post/2019/03/21/fastidious-about-ferrari. Also one last question, was it like this on every car? or were there some cars that only used a mechanical pump without any help from an electrical pump?
Comment: Not all cars are Ferraris...
Answer: I can't tell you specifically for the application you're talking about, but most of the time when manufacturers use two pumps as you describe, one is a lift pump to get the fuel from the fuel tank to supply the mechanical fuel pump which then pushes the fuel into the carb.
You can still see this used today, but with direct port fuel injection. On GM vehicles, there's a separate lobe on the camshaft (for overhead valve engines). The lift pump (or low pressure pump) gets the fuel to the high pressure pump which is actuated off of the cam lobe. From the electric pump, the fuel is pressurized below 100 psi (I don't remember the exact pressure off hand), while the high pressure pump increases the pressure to around 2100psi. The high pressure pump isn't made to pull the fuel from the tank. Anyways, just an example of how what you're describing is still used today. Diesel engines do pretty much the same thing.
As far as cars only using a mechanical fuel pump, the Ferrari you describe is an odd ball for the era. Most carbureted engines only need a mechanical fuel pump. GM's vehicles only pushed ~14psi to the carb. If more than that was used, it would push past the needle seats and flood the engine. I believe most other manufacturers ran pretty much the same. The mechanical fuel pump was more than capable of pulling fuel from the tank as well as pushing it up to the carb. It would sit fairly low on the engine, fairly close to the level of the fuel tank. Once the fuel was to the pump, there wasn't really a lot of work going on to get it from the tank to the pump.
Comment: The mechanical fuel pump can have good suction performance - one model of car was known to have its fuel tank compressed flat due to the reduced pressure in the tank... A good laugh as the customer complained they could only get 2 gallons into it before it was full.
Comment: ♦ Thanks a lot, i also did some more research to see if there were other cars like those Ferraris and i have found another one. W198 Mercedes 300SL Gullwing http://300sl.org/technik-300-sl-w198-technology-300-sl-w198/. From what i understand: you need to crank the engine for a bit for the mechanical pump to prime the carburettors right? What i just now thought is that maybe by using an electric one coupled to a mechanical one they eliminate the need to crank the engine so you can turn on the e-pump and prime the carbs and then start right away.
Comment: The old carburetor US cars needed very little pressure , basically just enough to push gasoline to the carb. I drove one car several hundred miles with no fuel pump, just the vapor pressure of the gas ( '72 Pontiac full size 400 / 5.9L ?  fuel tank was upright in a rear fender). The pump arm that rode the camshaft was broken off so it did nothing. Wyoming to Chicago , I did not measure the miles .


Draining LG LW5016 air conditioner

Question: I have a LG LW5016 air conditioner. It is a room ac that is 5000 btu. It seems that water is building up inside of it. Is there a way I can drain it?
Answer: Usually if a window mount AC is not draining, then it is not installed properly. Typically these units need to be installed so the underside is level, or tilted so that the outside is slightly lower than the inside.
The drain hole might also be clogged, which can usually be cleared with a bit of compressed air or a pipe cleaner.
I could not easily find the manual for your unit, so I am unable to advise on the correct installation angle or the location of the drain hole. You should try to find the owners manual.

Edit: I found a copy of the manual: https://mans.io/files/viewer/808290/16#navigate_bar
The rear of the unit should be about a 1/4 inch lower than the front of the unit.
The unit also comes with a drain pipe you can install to drain the condensate faster if it doesn't drain correctly by itself. Theoretically, you could just remove the cap and not install the little pipe, but the pipe is designed to carry the water away from the metal case and reduce corrosion.
Answer: Some (if not most) air conditioners make use of the water the builds up in them to improve efficiency by slinging the water against the condenser.  Some owner manuals even point this out, including the one for your model!  You can download the manual from their website, but to quote:

This air conditioner is equipped with a slinger fan. (See drawing.) The fan's outer ring picks up the condensed water from the base pan if the water level gets high enough. The water is then picked up by the fan and expelled through the condenser, making the air conditioner more efficient.

As long as no water is making its way into your dwelling, you should be fine.  If the noise of the water slinging is too much for your liking, some air conditioners come with a plug of some sort on the bottom of the drain pan that you can remove to let the water out, such as this GE model AHW06LZ:

Draining LG LW5016 air conditioner


Why has Sakura Yamauchi never had a pancreas transplant?

Question: Why has Sakura Yamauchi never had a pancreas transplant in the "I Want to Eat Your Pancreas" anime? Why didn't doctors suggest this?
Comment: I'm not familiar enough with the series, but as a physician I could help if I knew what was her disease. At least, from what I gather, it's probably pancreas cancer, which can't be cured by a transplant given that it's usually detected in its late stages when it has already spread throughout the body.
Answer: I haven't seen the animated film but I assume her condition is the same as the manga which is Pancreatic cancer, it's mentioned on page 20 of chapter 1 on the first page of her "Infirmity Novel" (a journal she's keeping about the progression of her disease). As @paulnamida mentions in a comment and a bit of Googling around a pancreas transplant is occasionally done for people with Type 1 Diabetes but not for Pancreatic cancer. Usually Pancreatic cancer is discovered too late to be treated as it is more difficult than most cancers to detect in its early stages due to its symptoms being mistaken with those of other illnesses more common than cancer. By the time it is detected it has often already started to spread to other parts of the body which makes a transplant of just the pancreas futile. If the cancer had been caught early enough (which the story seems to imply it wasn't) and has yet to spread to other parts of the body then it can be treated by surgically removing part of the pancreas via Whipple Surgery which would not require a transplant to be done anyway.


Can I replace my Shimano RX 100 with a Campagnolo group?

Question: I just purchased a Concorde Mistral with Columbus Gara tubing and would like to transfer my Campagnolo group from an SLX frame that is too big. The Concorde frame has a front derailleur mounting bracket on the seat tube just like the SLX frame I already have. I understand I would be losing the indexed feature the Shimano has, but would it be possible?
Comment: I'm not 100% so will only enter this as a comment...I suspect if you wanted to change every part of the groupset, you'd be fine. You also need to consider the freewheel body, not normally considered part of the groupset, but which is splined differently between Shim and Campag. Trying to do a partial conversion is a recipe for disaster, these two companies are famously incompatible with each other.
Comment: It would help if you could provide more details about exactly which parts you want to swap. In particular the type and number of cogs on the rear wheel is important.
Comment: I would swapping every part including the wheels.  I think PeteH's answer really helped me. I was specifically concerned with the mounting i.e. front derailer and friction shifters on bottom tube for the parts are not on this continent.
Answer: As Pete H has commented, a partial swap will probably not work out.
On frames / bikes of this age, things were easier as compatibility was not quite so much of an issue, so some elements could probably work together OK - but if you are not sure / inexperienced, best is to swap everything.
Worth checking, though, that the threads for the bottom bracket on both frames are the same - some Concordes used to be Italian threads, your existing frame may be Enlish and they are not interchangeable.
To check which you have, measure the width of the shell, width-ways (i.e don't try and measure the diameter) excluding the cups that screw into it - 70 mm Italian, 68 mm English.
Comment: +1 for the thread mention. I was thinking the same thing. I wanted to swap out a BB and crankset on an old Gitane once and ran into this exact problem.
Answer: With some customization the partial change is possible.
Get a rear sprocket cassette which mounts on Shimano freewheel but is designed for Campagnolo - they are available. So, you can use your old wheels.
Crankset, chain, derailleurs must be changed completely, cross-compatibility with Shimano (with chains in particular) there happens but is neither flawless neither recommended. Be careful with cranksets - your Campagnolo crankset may be incompatible with bottom bracket in the frame, therefore it would need to be replaced.
Levers - it is technically possible to use Shimano ones, but don't. Just for one simple reason - Campagnolo levers are more comfortable and replacing levers is not such a difficult task technically.
Brakes - these will work whatever they are, Shimano or Campa.


appcenter error

Question: Nice day I'm testing the new version of elementary and I have a hard time in the application center. Applications available do not appear in repositories. I attach a screenshot
Answer: This question was answered in this post:
Almost no apps on appcenter

If you sideload a flatpak from flathub.org you'll automatically add
their repo, and populate Appcenter a bit more.
Other than that it seems AppCenter won't support deb packages anymore.
So yes, you can still install deb programs via the terminal, but I'm
afraid you'll then need to manually update them, because appcenter
won't do it for you.
The reasoning for this apparently is that some users found non curated
apps "ugly" so now they castrated the whole os for it.

Note: You will not immediately see the applications in AppCenter. In my case after installing an app from https://flathub.org/ it took a few reboots for  finally show up all apps available. Unfortunately, you will only see Flatpak apps in AppCenter. to install apps from repositories, you will have to use terminal or download Eddy or other application to install .deb
If this solves your question don't forget to mark as solved

appcenter error


How does mindfulness practice (sati) lead to jhana?

Question: How does mindfulness lead to jhana? How does contemplating the four frames - body, mind, feelings, dhamma (phenomena) lead to jhana? Is mindfulness the first jhana (Vitarka-vicāra)?
Answer: The word mindfulness (sati) does not mean contemplating (anupassana).
Mindfulness refers to 'remembering' to keep the mind clear of unwholesome states.
When mindfulness keeps the mind clear of unwholesome states, the act of 'contemplating', i.e., 'seeing closely', naturally occurs.
When the mind is quiet & clear, the breathing & body naturally becomes the predominant meditation object. Then when the breathing calms down, feelings become the predominant meditation object. Then when the feelings calm down, the mind itself naturally becomes the predominant meditation object. Then when the mind becomes very clear & free, Dhammas or Realites naturally become the predominant meditation object.
When body, feelings, mind & Dhammas are 'seen closely', mindfulness again acts to ensure or 'remember' to abandon any wrong views that may arise towards body, feelings, mind & Dhammas.
Also, contemplating (anupassana) is a state of 'seeing', i.e., a state of 'non-active-thinking'. When the mind only sees & does not actively think, the mind calms down, the breathing calms down & the body calms down.
Thus, when when mindfulness maintains clarity & contemplating, certain 'nirodha' ('cessation') processes naturally, occur. The breathing becomes calmer & calmer, longer & longer, more & more refined. Internal stored stress progressively comes into awareness & dissolves. This calming & purification build a certain momentum, resulting in mindfulness being easier & easier to maintain because the mind, breath & body are becoming calmer & calmer; purer & purer. The happier & more content the mind is, the less effort required to maintain mindfulness.
When the body becomes very purified from stored mental stresses & formations, jhana will occur. This can be compared to continuously using mindfulness to rinse out dirt. When the dirt is finally rinsed out,  water naturally flows into the cleared space. This naturally 'flowing' of the mind's momentum into a unity is jhana.
The mind flows into a 'unity' because the breathing has also become so refined that it cannot be felt anymore within the physical body. Therefore, instead of the mind naturally feeling/tracking the breathing in & out, down & up, within the body; the mind naturally creates a luminous mental image & absorbs into the mental image. This is jhana. The bliss that has generated within the body due to purification is now experienced intensely because the mind is absorbed into one-point with the mental image & the bliss is only felt in the brain.
In summary, mindfulness acts to remember, moment by moment, to keep the mind clear of unwholesome states & wrong views. This constant maintenance of mental clarity then, eventually, transforms into jhana.
Answer: If you do 4 satipaṭṭhāna (equivalent to sati) with proper passaddhi (pacification/relaxation) awakening factor, then it's in the 4 jhāna spectrum of samādhi. If the passaddhi is insufficient, then it's just sati. If it's sufficient, it's both jhāna and sati.
MN 125 is particularly clear in showing this, since it explicitly removes the first jhāna formula and replaces it with a second satipaṭṭhāna section.
https://lucid24.org/mn/main/mn125/index.html#126.96.36.199
And here is a collection of all the sutta references I've collected over the years showing where sati and jhāna overlap, in all postures, activities, etc.
https://lucid24.org/tped/s/samadhi/smd247/index.html
MN 125 alone should clear up many modern misconceptions.
If you can hear sounds, think verbal thoughts in sati, walk while doing sati, you can also do that in first jhāna.
If you're in a samādhi where the mind is divorced from the body, you're no longer in 4 jhāna territory. You're in either in a formless attainment, or 8 vimokkha, or 8abhibhayata.

Is mindfulness the first jhana (Vitarka-vicāra)?

wikipedia vitakka-vicāra definition is not quite right.
vitakka and vicāra is verbal, linguistic, communicable language. Otherwise, how could the Buddha's instruction, which is encoded in a communicable language, ever get decoded by your ears from sound, into a silent verbal mental talk of Dharma that sati and mind can think about?
You hear dharma, memorize it (sati), and recollect and apply Dhamma (sati again).
In first jhāna, this would be done with verbal thoughts (vitakka and vicāra).
Beyond first jhāna, it's subverbal mental processing. For example, you cultivate an attitude of kindness and compassion, or your observe sensations of breath in the body, it doesn't require any verbal thought.
In short, sati can be verbal (with vitakka and vicāra), or subverbal.
Comment: I have no idea what you're referring to. Not MN 125, probably something in my very large article on smd247?


Is NEXUS clearly better than Global Entry or TSA Pre-Check for US citizens?

Question: I'm considering joining one of the US government's Trusted Traveler programs.  I found this comparison chart (see below) on the Homeland Security website comparing TSA Pre-Check, Global Entry, NEXUS, and SENTRI.
I'm a US citizen, so I'm eligible to join any of them.  Now usually when you have multiple options for something, each has its own relative advantages and disadvantages.  But when comparing TSA Pre-Check, Global Entry, and NEXUS, it appears that NEXUS offers all the benefits of the other two, in addition to expedited processing to enter Canada, and also costs a lot less.  This seems a little too good to be true, so I wonder if I am missing something.
Given the choice between the three of them, is it really true that NEXUS is clearly superior in all ways?  Or is there a catch?
(As for SENTRI, I guess the main extra benefit it offers is that you can register your car, so if you enter the US by road in your own car, you can use a special lane.  I don't think I'd use that feature so I don't think it's worth it for me to pay the higher fee for SENTRI, unless it has even more features that I'm missing.)

Comparison chart:
Comment: This isn't a comprehensive answer, so I'll leave it as a comment, but an important catch is that you can only have your Nexus application interview at various sites near the US-Canada border, while Global Entry and TSA-Pre interview sites are at many international airports throughout the US. If this is inconvenient for you, then Nexus probably isn't the program for you.
Comment: I have essentially the same question, but a bit more specific. So I'll see if this comment gets a response before posting something new: If I apply for NEXUS, get conditionally approved, then go up to Seattle or Detroit for the interview and they ask "Why do you want a NEXUS card?", will responding with "Because it's 15 dollars cheaper than PreCheck and I've always wanted to visit Canada," would they reject the application? In other words, would having no definite plans to travel to Canada be a deal-breaker?
Comment: The qualifications for each of these are not just "is a US citizen" so it's possible not everyone can get each of them.
Comment: There isn't much advantage to Global Entry now that any US or Canadian citizen, and VWP repeat travelers, can use the Automated Passport Control kiosks.
Comment: I created the [tag:trusted-traveler] tag.  Feel free to go back and add it to other questions about these programs and others that may be similar.
Comment: @Kate: It's certainly true that some citizens of other countries might be eligible for some of these programs and not others. But it does appear to be that every US citizen is eligible for all four (provided they have a passport, I guess). That being the case, if, as it seems, NEXUS is better, you might think they wouldn't bother to offer the other options to US citizens.
Comment: for example, you can't get Nexus if you've ever misbehaved wrt to customs before, but you might still be able to get preCheck. I think also you have to have lived at the same address for some period of time for Nexus. And so on. It's not an automatic approval just because you are a US citizen.
Comment: @Kate: That's the sort of thing I wanted to know. I know it isn't automatic approval, but I didn't know the approval criteria were different. Post an answer?
Comment: @Michael: My main interest is in access to TSA Pre Check. It seems like NEXUS offers this at lower cost than TSA's own program.
Comment: alas I don't really know the conditions for the various programs. If someone wants to do the research and write it up, that would be cool.
Comment: For that last comment, assume that I would be traveling to Detroit or Seattle for other reasons than the NEXUS interview. I do understand that traveling to these cities will cost more than the 15 dollars saved (and the extra month waiting).
Comment: @Anthony https://travel.stackexchange.com/questions/109137/can-i-get-a-nexus-card-with-no-intention-of-regularly-traveling-to-or-from-canad
Answer: I'm a NEXUS member, and it is indeed the case that NEXUS is the best of these.  It gets you TSA-Pre, it includes all the benefits of Global Entry when entering the US, both the NEXUS lanes at land border crossings from Canada and the Global Entry machines in US airports (it doesn't matter where you are coming from), and it provides similar benefits when crossing into Canada by land or flying into a Canadian airport (from anywhere).  And the price is $50 for 5 years, compared to $85 for TSA-Precheck and $100 for Global Entry.
The drawbacks of NEXUS are mostly related to the process of getting the membership.  It takes about a month for a NEXUS application to be conditionally approved, which I understand is significantly longer than it takes for Global Entry alone, and the NEXUS interviews need to be conducted at a place where both CBP and CBSA officers are present, which mostly limits you to offices at US-Canada land border crossings or at the Canadian airports which have US preclearance facilities.
So if you live close enough to the Canada border to visit a border crossing for an interview, or you fly to Canada frequently enough to make an appointment at a Canadian airport convenient, the NEXUS membership is preferred.  If getting to a NEXUS office is a problem, however, then you probably won't care so much about the Canadian privileges NEXUS provides beyond Global Entry in any case and it is likely worth the extra $50 to be able to do the Global Entry interview close to home.
Comment: There are some interview locations in the US (other than border crossings).  There's one in Seattle.  Strangely, not at our big airport; it's at what everyone calls Boeing Field (but is officially King County International Airport).
Comment: I did see Seattle in the NEXUS office list, though it seems to be unique.  Do you know if CBSA does preclearance somewhere in Seattle?  I notice Kenmore Air, which flies from Boeing Field, also flies sea planes from Seattle direct to some fairly tiny places on the BC Inside Passage, so it might be more efficient to do the Canada customs inspection for them in Seattle before departure then it would be to man offices to process arrivals in all those places.  If so the NEXUS office there would be like the offices at Canadian airports with US preclearance.
Comment: @Dennis Canada doesn't do preclearance at Boeing Field, although it has the right to establish preclearance in the US; to date, it hasn't taken up the right.
Answer: I have had TSA-Pre for a couple of years now thanks to my airline status.  It has been a nice benefit, as it makes security a bit less burdensome, faster at big airports, less hassle at smaller airports.
I had INSPASS when it was in operation and while it sped up time through immigration, I still had to wait for my baggage, so the end result was still the same.  As a result I have never bothered with Global Entry, as my work travel requires lots of gear, so I am always checking bags.  If you travel globally with only carry on, then it might be worth looking into.
They now have the Passport Apps, which let you fill out your entry form on your phone, submit it when you land and breeze through immigration by simply having the barcode scanned (a bit faster than the kiosks and much faster than the old talk with an official lines, BUT not available at all international airports yet).
I could be wrong, but my understanding of NEXUS is that it is only for crossing between US & Canada.  And while the NEXUS card holders can use Global Entry machines (in lieu of a NEXUS machine), it doesn't provide the same "global" coverage as Global Entry does (ie you can't use it for expedited entry when coming from China, France, etc).
Comment: NEXUS itself doesn't get you in, but part of getting NEXUS membership is that you also get Global Entry membership.  (That may not have been true years ago, but it is now.).
Comment: Looks like "membership" isn't the right word: https://goes-app.cbp.dhs.gov/common/FAQ.html#faq_cardholder_11 and http://www.cbp.gov/travel/trusted-traveler-programs/nexus/global-entry-kiosks.  Also if you log into your GOES account (https://goes-app.cbp.dhs.gov/main/goes/HomePagePreAction.do) and you've done your NEXUS interview and fingerprints it'll list Global Entry on your account.
Comment: @JamesMoore - Perhaps you can cite a reference for your statement.  Nexus allows you to use Global Entry kiosks at some border crossings, but it does not give you Global Entry membership.
Comment: NEXUS does get you expedited entry when crossing between Canada and the USA.  Based on your links it would seem you can now obtain Global Entry, by fulfilling the fingerprint requirements and such.  So the question would be, what fee do you pay as Nexus is still $50 and Global Entry is $100.  Seems a ripoff if you can sneak in Global Entry with a Nexus application for half price.
Comment: When you do your NEXUS interview, part of it is doing the fingerprint stuff for Global Entry; it's not an optional extra.  NEXUS fees are decided jointly by Canada and the US, so it's not really surprising that they're really different than the other programs.  Doing NEXUS is better than Global Entry by itself - cheaper and does more.  The big catch is that you have to interview with both the Canadians and the US, and the number of places you can do that is small and geographically restricted.  But if you can get to a NEXUS interview, you should.  (Plus, the NEXUS card is valid airport ID.)
Comment: @JamesMoore - as you seem to have found a loophole, you should be writing this info as an answer to the OP's question, not as comments on another answer.
Answer: We travel frequently to Canada and find that they are now accepting Global Entry as equivalent to Nexus in terms of fast security check lines and fast customs processing. About the only difference I can see is that Nexus is the cheaper of the two.
Comment: You *cannot* use GE in a NEXUS lane entering Canada by land, or at all entering Canada by air or water. You can use GE in a NEXUS lane entering the US, however.  So there is a significant difference in functionality.
Comment: It is true that at Canadian airports GE lets you use GE machines at US preclearance and the card gets you into the NEXUS line at security. The card also lets you use US-bound NEXUS lanes at the land border. I don't, however, think the card allows you to use the NEXUS machines to clear Canadian airport immigration (those machines use an iris scan biometric that is only recorded at NEXUS interview offices, GE machines use finger prints) and I doubt it is useful in Canada-bound NEXUS lanes at the land border. You need the NEXUS membership for those.
Answer: Your Global entry card is also a "legal" document in airports. Global entry also has an affiliation with other Countries, I don't know if Nexus does, It is not mentioned
Comment: Do you have a reference for that ?
Comment: This answer seems very vague and I don't understand it. What do you mean when you say "legal" document?  What kind of "affiliation" are you talking about?  What is the practical significance of this for a traveler?
Comment: A Global Entry card is a federal ID that the TSA accepts yes. And Global Entry is available to citizens of some other countries while NEXUS has more limited eligibility requirements, as noted in the linked comparison chart in the question.
Comment: https://www.tsa.gov/travel/security-screening/identification lists "DHS trusted traveler cards (Global Entry, NEXUS, SENTRI, FAST)" as "valid identification" so both the Global Entry card and the NEXUS card work.