Workflow to set hyperlink field to open in new tab

Question: I need to set a field called "Vehicle Picture" to hyperlink to a photo of the vehicle that opens in a new tab.  The hyperlink should say "Click to View Picture" and the link itself should have mostly the same URL except the vehicle number (a required field in the form) in the link changes each time.  My problem is changing both the URL and the description, as well as plugging in the vehicle number into the URL.
Answer: You can use the below script to modify how the "Vehicle Picture" field is displayed using JS Link.

Create a JavasScript file and name it "vehiclePictureFieldTemplate.js"
(function () {
    var templatesContext = {};
    templatesContext.Templates = {};
    templatesContext.Templates.Fields = {
        "Vehicle_x0020_Picture": { "View": vehiclePictureFieldTemplate}
    };
    SPClientTemplates.TemplateManager.RegisterTemplateOverrides(templatesContext);
})();

function vehiclePictureFieldTemplate(ctx) {

    var vehicleNumber = ctx.CurrentItem["Vehicle_x0020_Number"];
    if(!vehicleNumber){
        return null;
    }
    //assuming that the name of the picture of the vehicle is "{Vehicle Number}.png"
    var urlToPicture = _spPageContextInfo.webAbsoluteUrl + "/Pictures/" + vehicleNumber + ".png";
    return "Click to View Picture";
}

Upload the file to the "Style Library"
Edit the list web part and in the "JS Link" field under "Miscellaneous" enter the line below:
~site/Style%20Library/vehiclePictureFieldTemplate.js

Make sure that the "Vehicle Picture" column is added to the list view


Is there a synonym for lazy with a positive connotation?

Question: Is there a word or phrase to describe someone who is willing to do extra work in the short term to avoid work in the long run? I have seen "lazy" used for this, but I'd like to know if there's a more precise term.
Comment: *Efficient, calculating, far-seeing*? How about just *intelligent*?
Comment: Forward-thinking?
Comment: 'laid back'. Oh...and extra work up front? That's not lazy at all, or lazy with _a lot_ of qualification.
Comment: I don't think there are enough of them to warrant a word. *Wily* might do.
Answer: Well, that's what software engineering/architecture/development is all about. And it's not about laziness, its about efficiency. Maintenance costs grow exponentially (in time, effort and money) when the base is poorly designed. The more money or effort you spend on the early stages of any development project, the more money squared you save in maintenance costs. I've seen tons of software projects to turn unprofitable because of lousy architectures, just because the project started as a quick fix after quick fix. It gets to a point where the project needs to be blown up and started from scratch, or be prepared to waste lots of money on maintenance.
As for a term for this concept, maybe long-term laziness (kind of a humorous term) (good design, low maintenance costs) compared to short-term laziness (poor design, extremely high maintenance costs).
I'm personally very lazy in nature, and that's why I work so hard when programming. I don't like to do things twice, and that's why I try to do them right from the beginning, even if it implies much more effort. I know that extra work will eventually pay off, and will let me lay on my back afterwards, or at least do the required work with minimum effort. Maybe plain oldsmartness, being smart, being time-smart or being effort-smart would do the trick.
Long-term effort minimization strategies in any given activity would be another good and general alternative to describe these kind of situations.
Comment: Reminds me of the saying, "There's never time to do it right, but there's always time to do it over."
Comment: *Code Complete* uses the term "long-term laziness," and I think that's about as good an endorsement as I'm gonna find.
Comment: Long-term effort minimization strategy → LTEMS!
Answer: The word Tom Sawyer comes to mind
see also Time Leverage and Time Arbitrage & How to become a Time Arbitraguer
Answer: The closest I can think of is LANGUOR, defined (also) as 'a relaxed comfortable feeling'. I also do not think LAZY is altogether a negative word, having regularly come across 'lazy elegance' to describe Inzamam ul-Haq (Pak cricketer).
Comment: Reminds me of the book title "Leisure: The Basis of Culture".
Answer: It's a cliche that conjures up images of Dilbert's pointy-haired manager, but you could say that somebody works smarter, not harder.
Edit: Efficient is a broader term than what you describe, but in the right context would meet your needs. Perhaps efficiency gained through foresight?
Answer: Lazy isn't necessarily a derogatory term.  Those of us who practice the behaviour you mention often refer to ourselves as lazy, and mean it in a positive way.  "If you want a job done right, give it to a lazy man", someone once told me!  :)
You might be looking for a word like "pragmatic", though that's not really related to lazy at all -- it just fits well in the sense of "he has a very pragmatic approach", which can imply that he doesn't do a sloppy job now that would require re-work later.  That's not the real meaning of pragmatic, either, but it could be used that way.
"Thoughtfully precise" is probably too verbose, but gives the right idea.
In writing, you might say someone was "concise."  I'm not sure if that applies to actions.  "He is a very concise programmer"...?  Maybe.
If you're just trying to convey the idea, it might be best to spell out exactly what you mean.  "He is very good at getting to the core of the problem and focusing on only that which needs to be done.  He doesn't try to slop-together half a solution, thus generating more work for his future self."
Answer: @CR Drost recently posted the following question, which was just closed as a duplicate: How can I more aptly describe acceptable laziness?
Given its close connection to your question, I'm going to answer the question posted by @CR Drost here and in the process respond to your question.
My response to question posted by @CR Drost:
"Neutral laziness" involves actions taken for the sake of convenience.

Merriam-Webster: convenience -- something conducive to comfort or
  ease.

"Positive laziness" involves actions taken for the sake of expediency.

Merriam-Webster: expediency -- the quality or state of being
  suited to the end in view.

My response to your question:
Expediency, which is not mentioned above, may be the word you were looking for.
Comment: Link to the duplicate?
Comment: I don't know how. I'll try to figure it out later. Thanks.
Comment: http://english.stackexchange.com/questions/343281/how-can-i-more-aptly-describe-acceptable-laziness
Answer: A colleague of mine, who was the documentation manager in an engineering firm, was the most ruthlessly organised person I have ever encountered.  He sat at his desk on a swivel chair with castors, and at his back was a row of filing cabinets arranged in an arc. It must have taken a lot of effort to set up, but he could quickly lay his hand on any document, usually without getting out of his chair.
His term for it was "constructive idleness".
Answer: I used to be a basketball referee, and a phrase that was used for similar things was

Run smarter, not harder

It was often said somewhat sarcastically by the older, more experienced, but definitely less fit referees.
Answer: The phrase "a stitch in time saves nine" describes the idea that it is better to do a small amount of work immediately than it is to wait until it becomes a bigger problem down the road:

The phrase basically means it's better to solve a problem right away, to stop it becoming a much bigger one.
It's first recorded in a book way back in 1723 and it's a sewing reference.
The idea is that sewing up a small rip with one stitch means the tear is less likely to get bigger, and need more - or, well, nine - stitches later on.

The above-linked article is from the BBC, explaining the usage of the phrase after then-prime-minister Boris Johnson used it in a September 2020 speech announcing new coronavirus restrictions:

The point Boris Johnson was going for was that asking bars and restaurants to shut earlier now (the stitch) will hopefully mean there's not a huge wave of coronavirus cases in a month or so (a bigger rip) and a tougher lockdown (nine stitches) won't be needed.


Play media from a computer to a TV wirelessly?

Question: I want the same functionality one gets when connecting a TV and a laptop using a HDMI cable, but wirelessly. I have a Samsung Series 6, Smart TV and want to mirror my Windows 7 PC's video and audio output to the TV without an HDMI cable. If I play a movie in VLC, I should see and hear it on the TV as well.
Can anyone help me?
Answer: You have a number of options for doing this, but I think the cheapest may be to use a $35 Chromecast. According to this site full desktop sharing is a beta feature of Chromecast:

How to setup desktop screen sharing to Chromecast?
The setup of desktop screen sharing is very simple and
  straightforward.  You do not need any additional software or hardware.
In Chrome browser, click the Google Cast button, you will see the
  available Chormecasr devices in your network as shown below.
You can click the arrow icon in the right. The  options will be shown
  as:
Cast current tab. This is the default. The Chromecast tab will be cast to Chromecast.
Cast entire screen (experimental). This will share the desktop screen, not just a Chromecast tab, to Chromecast.
Audio mode. This will only send audio output to Chromecast. The screen or Chrome tab will not be shared.
You can click "Cast entire screen (experimental)" to start the desktop
  screen sharing.
Of course, before sharing the desktop screen with the Chromecast
  device, there is a warning message letting you know that Google cast
  wants to share the screen and audio output (with Chromecast). You must
  click "Yes" to approve the screen sharing.
Once the desktop screen is shared to Chromecast, Google cast will
  indicate the screen is being captured and played on the Chromecast
  device.
At the same time, a notification of "Google cast is sharing your
  screen" will be shown on your desktop.
Now, the the desktop screen and audio is shared to Chromecast. You
  should be able to enjoy the video or  music on your TV.

There are other options specifically designed for wireless screen sharing, like Intel WiDi. However, your computer must support it and the TV may need an adapter. This page has a good list of other alternatives.
Answer: What you describe is only offered by Miracast. Miracast allows you to mirror or extend the screen, just like using a HDMI cable would. DLNA and Chromecast do not offer what you are asking for, and they are described in detail by other answers.
The huge disadvantage of Miracast is that it requires hardware support. It's supported by probably all Windows devices released in 2014, and many devices released earlier. The only reasonable way to get it to Work on a Windows 7 computer is to go through Intel WiDi, which supports Miracast. If your hardware allows you to install the free Intel WiDi software* on your PC, you can use it to connect to a Miracast Receiver. Miracast receivers are built into modern TVs (I think series 6 doesn't have them yet), or they can be bought as separate devices. Common Miracast Receivers are the P2TV3000, Microsoft Miracast Receiver, and the Roku.

EDIT [22 Apr 2017]: Intel has made the decision to discontinue marketing and
  development of Intel® WiDi and Intel® Pro WiDi applications and
  related receiver certification program effective immediately. Now that
  the Miracast* standard is natively supported in the Microsoft Windows*
  8.1 and 10 operating system for wireless display capabilities with strong user experience, Intel is redirecting its resources and focus
  to future areas of growth.

If your computer does not have the hardware to support Miracast, go with DLNA or Chromecast.
*Notice that there is a link to an older version of the software, for older chipsets, on that site.
Comment: Intel has discontinued support for this software and it is no longer available there.
Comment: How can you tell if it will work or not?  By now, the Win7 computers are definitely considered to be older.   (Oct 2017)  My tablet supports the "Anycast" dongle just fine.  So next step would be the Win7 laptop.
Answer: If you are only interested in playing media files (video/music/pictures) through your TV, there are a few ways of doing this:
USB Hard Drive
You can copy/move your media files to a USB hard drive, and plug the USB HDD into your TV. It should simply appear under your TV's 'Input' or 'Source' menus.
All you have to do is browse to the file you want to play, and select it.
Using Windows Media Player as a DLNA/UPnP host
Windows 7 allows you to quickly set up your PC as a Digital Living Network Alliance (DLNA) server, which can be seen up by Smart TVs and other DLNA-capable devices on the network.

Launch Windows Media Player (switch to Libraries view if necessary),
Click the Stream drop-down menu at the top,
Select the option Automatically allow devices to play my media.

Enabling this option essentially turns the PC into a DLNA (Digital Living Network Alliance)-compatible Digital Media Server.
Just be sure that you've either already organized your files into your My Music, My Pictures, and My Videos folders, or imported different locations of files into WMP.
To do so:

Open WMP and switch to Libraries view if necessary.
Click the Organize drop-down menu,
Select Manage Libraries,
choose Music, Pictures, or Videos.

A Library Locations window will open, in which you can add other folders simply by clicking the Add button and browsing to the folders.
Source
Answer: If you're only interested in media you can set-up a media server on your PC. Then you could use your smart TV's browser to play media or an application.
A software that does that is Serviio. Your TV may support DLNA which gives you even more options.
You can use Samsung's software called Samsung Link.
Comment: Samsung Link was deprecated.


Is it possible to create your own ammo?

Question: I haven't found this option at the weapon crafting station, which was my first thought, and a brief google shows Fallout: New Vegas had it, so I'd think FO:4 would have it too. I don't see it anywhere though. If there's no way to craft ammo, what's the best way of gaining/hoarding lots of ammo?
Comment: Would like to know that, too. Ammunition seems to be very rare, but I haven't found a way yet to build my own.
Answer: The only special ammo in fallout 4 you can create is for the syringer rifle.
However, the shops and the wandering caravans tend to hold a lot of ammo.
Random caravans will show up in your settlements, such as sanctuary.  Also the weapon dealers in Diamond City and Good neighbor tend to carry a lot of ammo.
Finally there is the scrounger perk that lets you find more ammo as loot.
Comment: Would it be possible to get a little more detail on the shops and wandering caravans? Just like which ones usually hold the most ammo/resupply the quickest. If they specialize in different ammo types that would be appreciated too. Thanks!
Comment: @Robert I added some info on the merchants.  Hope that helps.
Answer: It's worth mentioning there's a mod for this:  Craftable ammo.
Mods are currently only supported for PC, but will be supported for consoles(!!) in early 2016.
Answer: You can craft ammo with the Contraptions Workshop DLC using the Ammunition Plant.
I have yet to try this in-game myself, so this answer isn't very detailed, but I'm surprised no one has written a nice answer about it yet, so let me at least note it.
Answer: If you build the ammo maker in the workshop, you can make most of the ballistic ammo like .38, .308, .44, .45, and shotgun shells. If you have all the levels of the gun nut perk, you can put the components in the machine and then tell the computer you have to hook up to it what kind you want to make. Most need fertilizer and lead.

Is it possible to create your own ammo?


Setting up OpenGL/Cuda interop in Windows

Question: I am writing a DLL that needs to do some work in Cuda 3.2 and some work in OpenGL.  OpenGL will render some grayscale images that my Cuda code needs to read in and modify, and then give back to OpenGL as a texture.  I believe I need to create PBOs to do that.  I have done some basic OpenGL stuff before but never worked with extensions, and that's where my problem is - I've been searching for 2 days and so far haven't been able to find a working example, despite wading through pages and pages of code.  None of the samples I've tried work (and I'm sure my vid card will support it, being a GTX470)
Some specific questions:
1. I installed the nvidia opengl sdk.  Should I be using glew.h and wglew.h to access the extensions?
2. My DLL does not have any UI - do I need to create a hidden window or is there an easier way to create an off-screen rendering context?
3. Can I create a grayscale PBO by using GL_RED_8UI format?  Will both cuda and gl be happy with that?  I read the opengl interop section in the cuda programming manual and it said GL_RGBA_8UI was only usable by pixel shaders because it was an OpenGL 3.0 feature, but I didn't know if that applied to a 1-channel format.  1 channel float would also work for my purposes.
4. I thought this would be fairly easy to do - does it really require hundreds of lines of code?
Edit:
I have code to create an OpenGL context attached to a HBITMAP.  Should I create a bitmap-rendering context and then try to attach a PBO to that?  Or will that slow me down by also rendering to CPU memory?  Is it better to create an invisible window and attach the PBO to that?  Also, does the pixel format of my PBO have to match the window/bitmap?  What about the dimensions?
Thanks,
Alex
Comment: There's some code in this thread that might get you started:

http://stackoverflow.com/questions/3883790/how-to-copy-cuda-generated-pbo-to-texture-with-mipmapping/3884490#3884490
Answer: There's actually an example of how to use OpenGL and CUDA together. Look at the SimpleGL example.
Comment: I saw that, but it only demonstrates using a vertex buffer.  There's nothing in there about creating a context without a window (they use glut to set up a windowed gl context), or setting up the pixel format for a PBO.  Those are the things I'm having trouble with.
Answer: You may want to take a look at this example:
https://github.com/nvpro-samples/gl_cuda_interop_pingpong_st


Interpreting a Butcher Table

Question: I have the following adaptive Adams-Bashforth scheme for estimating an ODE:
$y_{{i+1}} = y_{{i}} + \alpha f_i + \beta f_{i-1}$
where, if we have 3 time points that are not equally spaced: $t_{i-1}, t_i$ and $t_{i+1}$, then
$t_i - t_{i-1} = h_{prev}, \space \space t_{i+1} - t_i = h$
I am asked to calculate an alternative $y^*_{i+1}$, given a $y_i$, using the third order Runge-Kutta method defined by the Butcher table:
<code>    0    |
  (1/2)  | (1/2)
    1    |  -1      2
--------------------------------
         |  (1/6)  (2/3)  (1/6)
</code>
I have no idea if I wrote the explicit formula for the Runge-Kutta method correctly, however. I dont have experience working with Butcher tables which is why I'm not confident.
Here's what I got:
$y_{i+1} = y_i + h/6 (k_1 + 4k_2 +k_3)$ where
$k_1 = f(t_i,y_i)$
$k_2 = f(t_i + h/2, \space y_i + \frac{h}{2} k_1)$
$k_3 = f(t_i + h/2, \space y_i + \frac{h}{2} k_2)$
I'm hoping someone can show me if/where I went wrong. Part of what's throwing me off is that we're dealing with an adaptive step size, but I'm not sure either way. I'd really appreciate the help.
Answer: Up to $k_2$ it is correct, however, you have to read the third line as
$$
    k_3 = f(t_i+h, y_i-h·k_1+2h·k_2).
$$

Interpreting a Butcher Table


Finished AVI file wont open!

Question: (I have newest version of mac and blender) I finished rendering my intro template after about 30 mins. The rectangle where it was rendering went black. I went to my downloads where I had saved it there was a quicktime file that I opened and said "converting....... QuickTime Player can't open "blender finished intro0001-0220.avi" To see if additional software is available that will enable QuickTime Player to open the movie, click Tell Me More. when I did i brought me to the apple website and said I had to download quicktime 7 even though i already have 10.6 I think. I followed the instructions and downloaded it but the file still wont open.
Answer: If an error happened before blender finished all the frames that were supposed to be rendered, I am afraid the .avi file may be corrupt. It cannot be opened or fixed. The way to render an animation the safe way is to always render as an image sequence. Meaning render each frame as a .jpg or .png file format. You would then use the VSE (Video Sequence Editor) in blender to combine all the images and save it as a .mov or .avi movie file format.
This way if some error occurs you can still restart the rendered at the point where the error occurred, instead of starting all over again because your movie file was corrupted by the incomplete rendering process.
That is how the animation industry does rendering work at a professional level too. This workflow allow for post production work, like adding visual effects and color correction after the all the frames are rendered.

Finished AVI file wont open!


Solspace Tracker - Any way to order results?

Question: Looking at the Tracker Control Panel, is there any way to order the tables for Overall Statistics, Site Averages, or Entry Statistics? It seems intuitive to click the column heading for that, but that doesn't do anything.
Answer: Unfortunately, that isn't possible.
I recommend submitting this as a Feature Request under the specific add-on category. It'll also give other users the option to vote up the feature request, and help us prioritize features to add in upcoming versions of this add-on.
http://support.solspace.com/support/discussions


Seeking an index for the Mishnah Berurah

Question: Can anyone tell me where I might find an index to help me find a topic in Mishna Berura (preferably in English)?
Comment: An index of what? Word usage? Topics? You've only used one sentence. Surely there is more you can say to describe what you seek.
Comment: @DoubleAA  I was using the term index as it is usually used: "an alphabetical list of persons, places, subjects, etc, mentioned in the text of a printed work, usually at the back, and indicating where in the work they are referred to" (http://www.collinsdictionary.com/dictionary/english/index).
Answer: There is an index called Yad Yisrael
http://seforimsets.com/index.php?route=product/product&product_id=555
Answer: Dirshu has an excellent Hebrew index on all 6 volumes of Mishna Brura, in one volume covering 6,000 categories and 30,000 sub-categories over 600 pages. You can see sample pages here. Although it is in Hebrew there are a few dozen pages in English at the end with words translated from modern Hebrew.
See a background article on the publication of this volume here.
Sold online in the US here and there for instance.


Electrostatics - Inserting a brass plate between two charges

Question: The question is: if I were to insert a brass plate between two charges, what will happen to the force between the charges? Would it increase, decrease or stay the same?

Does the brass plate increase the value of permittivity of the medium and therefore the force decreases?

The correct answer is that it will increase. But I do not understand how.
Answer: The brass plate is a conductor, so the potential will be the same on both sides.  The thickness of the brass plate therefore subtracts from the effective distance between the two charges, making the electric field strength higher in the remaining open space between the charges.  This stronger field will cause more force to be experienced by each charge.
Another effect is that the shape of the field will change.  Since the conductive plate has the same potential everywhere on its surface, each charge now sees a plane at half the voltage and half the distance, as apposed to the point charge before.
Comment: But the electric field must be perpendicular to an ideal conductor.  Brass is certainly not ideal, but it will certainly cause a change in shape of the field.  I think this answer needs more work.
Comment: @garyp: Brass is a pretty good conductor (has low bulk resistivity).  Since there is no current flowing, it is a "perfect" conductor for this purpose, meaning the potential will be equal everywhere on its surface.  Yes, the field shape will also change.  I'm adding to my answer accordingly.
Comment: What's still not clear to me:  since the shape of the field is different, the simple argument of equipotential within the conductor seems not enough.  The field lines at the test particle are no longer radial straight lines.  It's not clear to me if the field strength would have gotten larger or smaller.
Answer: When you take a brass plate of considerable thickness and place it in between two charges, say positive and negative, induction takes place in the brass plate since it is a conductor: the electrons shift to the end near the positive charge while the cations stay near the negative charge. Now, induction occurs in order to make the field outside a certain region zero. Here the regions in question are the sets of points between the plate and the charges. Thus the magnitude of charge on each side of the plate tries to be as close as possible but opposite in sign to the charge that it is facing. Hence, the (here) attractive force increases, due to lesser distance (the brass plate is closer to a charged particle than the other charged particle since it is kept between them) while the repulsive force is comparatively weaker since the brass plate is of sizeable thickness and increases the distance between like charges (like charges being the charged particle and the similar charge on the opposite face of the plate). A similar question can be found in the problem book by SS Krotov.
Comment: I think both the terms fit, the plate is "polarized" while charges are "induced" in the plate.
Comment: I think you mean polarization rather than induction.


How to access symbols in emacs, which are accessed normally by alt key

Question: I tried my best to find a solution to my problem in internet. I gave up looking.
I am trying learning emacs on a mac. There are symbols I normally type by using the alt key. However in emacs I do not have access to them (in my german keyboard layout, @ is accessed by alt-l)
How can I access these symbols in emacs?
Answer: This is simple: set the Cmd key as Meta and let Alt key as Alt in your init.el file - use these:
(setq ns-alternate-modifier              'alt
      ns-command-modifier                'meta
      ns-function-modifier               'hyper
      ns-right-alternate-modifier        nil)   ;; Act as AltGR, for "|"

Take care of right Alt, it may be modified by lsp-mode if you use it.
These are for German keyboard, not German Standard.
Comment: Great! It worked perfectly! Many thanks. I am now learning customizing init.el files.
Comment: I tried this in an American Keyboard using Brazilian Portuguese Input... But it did not workout: https://emacs.stackexchange.com/questions/72953/why-i-cant-type-things-such-as-and-in-emacs-with-my-macos-running-brazi
Answer: The suggestion by @Ian did not help on my system, a MacBook with Ubuntu installed. Here is my solution.
German keyboards of Macs lack frequently used keys like backslash, the pipe symbol, or curly and square brackets. Under MacOs, these are mapped to Alt-5 to Alt-9, where Alt is the left Alt-key. Ubuntu, however, maps them by default to the right Alt-key, which is not only confusing when using both MacOs and Linux, but even difficult to enter (the backslash is Alt-Shift-7). I have thus mapped the modifier key to the left Alt-key for compatibility with MacOs with the following entries in .Xmodmap:
clear mod1
clear mod5
keycode 108 = Alt_L
keycode 64 = ISO_Level3_Shift
add mod5 = ISO_Level3_Shift Meta_L
add mod1 = Alt_L Mode_switch

This works for every application except Emacs, which apparently maps Alt-combinations to something different (which seems to be just nothing, but this prevents entering special characters). To make these characters work, I had to explicitly bind them in .emacs with
(global-set-key (kbd "M-7") (lambda () (interactive) (insert "|")))
(global-set-key (kbd "M-/") (lambda () (interactive) (insert "\\")))
(global-set-key (kbd "M-5") (lambda () (interactive) (insert "[")))
(global-set-key (kbd "M-6") (lambda () (interactive) (insert "]")))
(global-set-key (kbd "M-8") (lambda () (interactive) (insert "{")))
(global-set-key (kbd "M-9") (lambda () (interactive) (insert "}")))
(global-set-key (kbd "M-l") (lambda () (interactive) (insert "@")))

Which key code actually is required by the kbd function can be figured out within Emacs with Ctrl-h k and then entering the key combination.


Retrieving shared video memory using SharpDX

Question: I am trying to retrieve the total available video memory using SharpDX via DXGI, using the Description of the best available adapter.
The DedicatedVideoMemory is correct (1GB in my case), but the SharedSystemMemory value is wrong - and in fact is a negative number (-1073549312, in case that's of interest). The correct value should be 3072MB, as reported by my system information and when running the Microsoft VideoMemory_2012 example application (which also queries DXGI).
Any ideas what might be going on? Or is there another way to get this information using SharpDX? I need to scale some textures according to the available resources, and I need to know the shared component as well as the dedicated.
Answer: This happened to me when my App was 32 bit.
Try 64 bit and see if the number is correct then...


How to test if all coins have the same bias

Question: I have data from a coin flipping experiment. I flipped $N$ coins $M$ times and want to know if the probability of heads is the same across all the coins or if it varies. It might be that one coin has a different bias than all the others or that there $k$ sets of coins each with a unique bias. I am having trouble framing the problem in a way that I can see what statistical test to use.
Comment: Hint: Presumably you hope each coin will have approximately (in some sense) the same proportion of heads and tails when the null hypothesis is true.   Perhaps a contingency table showing numbers of heads and tails by coin might help you estimate how many you would have expected of each and help you calculate how big the difference of your observations is from this expectation
Answer: Perhaps an good first approach is to produce a confidence interval for the probability of heads for each coin and see if there is overlap.
As a working example, I simulated some data for $N=10$ coins, each flipped $M=500$ times. In the simulation, each coin is "fair" with $p_i = 0.5$ except for the third coin which has $p_3 = 0.7$.
N <- 10
M <- 500
p_i <- rep(0.5, N)
p_i[3] <- 0.7
Y <- rbinom(N, M, p_i)

Using R, we can readily compute the confidence intervals for $p_i$ with confidence level $\gamma = 1 - 0.05 = 0.95$. The interval for the first coin can be extracted as follows.
 conf <- binom.test(Y[1], M, conf.level=0.95)$conf.int

We can repeat this for each coin, an produce a plot of the confidence intervals.

The sample size appears to be large enough, for us to pick up on the fact that the third coin has a higher probability of heads than the others.

There is a problem with this procedure. We are making multiple comparisons and not considering this in the analysis. The idea is, if you flip enough different coins, one of them is bound to be "different" from the others eventually, based solely on chance.
We can fix this (possibly at the cost of less power) with the Bonferonni Correction. Without going into details, we need to adjust the confidence level according the number of different coins flipped.
$$\gamma = 1 - \frac{\alpha}{N} = 0.995$$
We can repeat the procedure, this time putting,
conf <- binom.test(y[1], M, conf.level=0.995)$conf.int

Notice that the confidence intervals are wider this time. These intervals define a Joint Confidence Region, which is to say that these intervals hold simultaneously with (at least) 95% confidence.

Even with the larger intervals, we are able to correctly identify that the third coin has a different probability of heads than the others.
In summary, you will be able to pick up on differences more effectively with a larger sample size $M$. This graphical approach will allow you to visualize single coins or groups of coins with different "bias" than others.

An example, with the Bonferonni Correction demonstrating the case questioned in the comment. Here, $\epsilon=0.1$ so that the first 5 coins have $p_i = 0.4$ and the next 5 coins have $p_i = 0.6$.
Comment: I am not sure how/if this captures a bimodal distribution where $N/2$ coins have a probability of heads of $p+\epsilon$ and the rest have a probability of heads of $p-\epsilon$.
Comment: Sure it does. See update. If $\epsilon$ is very small, then no statistical procedure will capture the difference, unless the sample size is enormous.
Comment: If I am following the answer, if the difference was smaller so the CIs all overlapped you would conclude that all the coins are the same, but it seems like a biomodal distribution would be unlikely if they were all the same. Maybe what I want to test is if the data is binomial.
Comment: Formally, you would "lack evidence to conclude the coins were different". Detecting small differences in probability is going to be difficult regardless of method. The Binomial assumption should be quite valid, for each coin. If you are interested in the difference in probabilities, you should use a method like this one, or a contingency table as recommended by @Henry in his comment.


Whats the name of that short story series online about a post apocalyptic world?

Question: All I can remember is I originally watched it on syfy's website ....after it was gone I had to watch the others on YouTube ..I never finished watching them but would LOVE TO..
The man wakes up not knowing what has happened and I believe he used to be a cop if I remember correctey. There is bits I can remember about the 4 horsemen of the apocalypse
Comment: Welcome to Scifi.stckexchane. Please add information like when did you watch it, language, country of origin. That might help people to figure out.
Comment: Welcome to SFF:SE, user56380.  You logged in a couple of weeks after I posted my answer below --- is it correct?  If so, feel free to click the checkmark the left of the answer.   This tells us that your query has been resolved.
Answer:
This is Amnesia, whose plot is described on IMDb as:

Man wakes up in a post-apocalyptic world with amnesia and is looking for his family despite being pursued by a ruthless army.

There doesn't appear to be a formal relationship between the project and the Scyfy Channel.  The series' creator, John Wayne Bosley, had made a pilot and was hoping for Scyfy to pick it up as a mini-series.  Scyfy appears to have posted the pilot (or parts of it) on its web site, perhaps to gauge audience demand.
It doesn't seem to have gotten a pick-up as of this time, which is probably why you had to see the rest of the episodes on YouTube.
Six episodes have been made so far.
There is also a Kickstarter fund that's been organized to keep the show going, so if you like it enough, you may wish to contribute to it.
Comment: youtube doesn't have it, as you say. sadly.


Determine if an app is running in the foreground when a notification is received on iOS

Question: I would like to find a way to see what app is running in foreground or if the home screen is displayed when a local notification from my app show up. For example i want to have different actions if there is in homescreen or in someone else app.
I tried to use processed and pid but the pid is generated hen the app starts and not the last time the app is used.
Any idea?
thanks
Answer: As described in the push notification documentation you can read [[UIApplication sharedApplication] applicationState] when you receive the notification to determine whether your app is in foreground, inactive (it's visible but a dialog like the WiFi chooser is in front) or in background.
Comment: There is no way to get this information. You only know whether your app is in foreground or not.
Comment: i want to know if anither app is running in foreground like camera or ipod or notes
Comment: So, what part of my answer do you have trouble with? If you read `[[UIApplication sharedApplication] applicationState]` it tells you whether your app is foreground or not.
Comment: Yes. this is for my app. how I would now exactly what app was before mine?IF was Camera for example or an appstore app?
Answer: Just to have a copy-paste code available for others:
if([[UIApplication sharedApplication] applicationState] == UIApplicationStateActive)
{
    //App is in foreground. Act on it.
}

Comment: p1us 0ne for the copy paste
Answer: Swift 5 version:
import UIKit
let isForeground = UIApplication.shared.applicationState == .active

Comment: It's probably worth noting you need `import UIKit` since it's not obvious where the identifier `UIApplication` comes from.


Energy of electron spinning in a magnetic field

Question: When an electron travels in circles in a uniform magnetic field, it must lose energy because all accelerated charges radiate, and must therefore spiral down to the center. Is this energy compensated by the magnetic field? Or where does this energy go?
Comment: **Spiral?** how exactly? Is it doing a [helical motion](http://t1.gstatic.com/images?q=tbn:ANd9GcQ6H6aNDguI8xEPXH0g_rFwQdf5oeHLnkI0RZB4cK1Ailo6rIUT)?If not, please post a diagram.
Comment: spiral motion. spiral motion or helical motion whatever may be, it is accelerated and release energy.
Comment: If its a helical motion it will not release energy, even if it is accelerated, just like electrons revolving around a nucleus do not release energy.
Comment: electron moving in a magnetic field is not like the electron in atoms. According to the quantum mechanics the electrons that are bound to an atom are standing waves that completely engulf and surround the nucleus. It won't release the energy...
Answer: You are right. An electron in a uniform magnetic field will travel in circles (or in a helix, up to a change in frame of reference), but this means that it is an accelerated charge and it must therefore radiate and lose energy. This radiation is known as synchrotron radiation, and it is a major design issue for particle accelerators. (In fact, it is the reason for a recent trend to go back to linear accelerators, which are less efficient as each accelerating stage only works once per particle, but are not subject to this.) It can also be harnessed to make synchrotron light sources, and with some extra work one can build a free-electron laser using that principle.
In short, then, the electron will spiral down to the centre and lose all its kinetic energy as electromagnetic radiation.

(For the more quantum-mechanical minded, now that Landau eigenstates have joined the fray, this means that all excited Landau states will have to decay through radiative coupling to the ground state with zero angular momentum. Once there, though, the uncertainty principle kicks in and stops the electron getting localized to radii smaller than the characteristic harmonic oscillator length $$x_0=\sqrt\frac{\hbar\omega_c}{m}=\frac{\sqrt{\hbar eB}}{m}$$
corresponding to the cyclotron frequency $\omega_c=eB/m$.)
Comment: Thanks, but I din't understand what prevents the electron from stopping after a long time, if the electron is circulating in a magnetic field for long time?
Comment: @albedo The electron will spiral into the centre of the circle (slowly if it's nonrelativistic). However, at the very end it will not be perfectly localized at the centre, since that is forbidden by the Uncertainty Principle. Instead it will have a gaussian wavefunction of characteristic size $\sigma_x=x_0$. (This $x_0$ is chosen so that the minimum momentum uncertainty $\sigma_p=p_0=\hbar/\sigma_x$ will make the electron circle with a radius of order $x_0$.)
Comment: So, if we somehow inject an electron bunch perpendicular to the magnetic field, this buch of electron will lose energy continuously. It will spiral and eventually will we get a buch of electron almost concentrated at some point in the magnetic field?
Comment: Yes. For a real electron bunch, though, space charge (repulsion between the different electrons) will prevent this.
Answer: I think the question is somewhat related to landau energy level(one electron in uniform magnetic field).
Comment: Could you clarify and elaborate?


Adding more than one character using ManuelBastioniLab

Question: is there a way to create more than one character in the same scene by using MBLab? When I create the first one I do not not have the "Create Character " available anymore. I need to add more than one character and they need to have active pose as they need to be set accordingly.
Thanks for any help
Answer: I just tried it in a new .blend file, It is possible but I had to "Finalize" the first character created, and the second one was still editable.
Have you tried to create a .blend file per character and append them in a main scene file ? This way you can still play individually with your character and have full control of your scene.
Comment: No did not try! I will :D


Notation: Vector contains an element equal to 0

Question: I have a vector $v \in \mathbb{R}^n$ and I am searching for a mathematical notation for a function that returns $1$ if at least one of the vector's elements is $0$ and $0$ otherwise. The analogue function for a set $S$ would be:
$$
f = \begin{cases} 1 & \text{if } 0 \in S \\ 0 & \text{if } 0 \notin S
 \end{cases}
$$
However I am struggling to find a similar notation for a vector. In particular, how do I write: "If any element in $v$ is $0$"?
Answer: It's best to write it in words:
$$
f(v)
=
\begin{cases}
1&\text{when at least one component of $v$ is zero}\\
0&\text{otherwise}.
\end{cases}
$$
This is perfectly valid mathematical notation.
Using symbols doesn't make it better than using words.
With words you can say directly what you want to say instead of taking an unnecessary detour.
If someone insists on using symbols (in order for the function to be implementable on a machine), you can replace "when at least one component of $v$ is zero" by "$0\in\{v_1,\dots,v_n\}$".
That's still readable, but I think the version in words is best for communicating with people.
Answer: If $\prod_{i=1}^nv_i=0$, then $f(v)=1$ otherwise $f(v)=0$. For a compact representation, you can use the indicator function $\mathbf 1_E$ of an event $E$. Define the event $E$ to be the event that $\prod_{i=1}^n v_i=0$. Then $$f(v)=\mathbf 1_E$$
Comment: I wasn't sure I believed [Joonas Ilmavirta's answer](https://math.stackexchange.com/a/2711698/227783) until I read this one.
Comment: For slightly greater obscurity, use one of the notations for the Dirac delta function : $\delta_{\prod_{i=1}^n v_i}$.  Or further, the Dirac measure $\delta_0( \{ v_1, \dots, v_n \} )$.  Of course, explaining either of these is at least as complicated as just writing what one means...
Answer: I agree with @Joonas Ilmavirta that it's probably better to write it in words.
Nevertheless, one can talk about the support of a vector, namely,
$$\operatorname{supp}(v)=\{i\in[n]\, |\, v_i \neq 0\},$$
where $[n]=\{1,\ldots,n\}$. This is a widely accepted terminology.
In particular,
$$\text{"If any element of $v$ is $0$"}$$
becomes
$$\text{"If $\operatorname{supp}(v)\neq [n]$"}$$
Comment: I was unclear. The point was that if you substitute your statement to the formula I gave, you get$$f(v)
=
\begin{cases}
1&\text{when supp($v$)${}\neq[n]$}\\
0&\text{otherwise}.
\end{cases}$$It would be more natural to flip these and say that the function is zero when the support is $[n]$ and one otherwise. But it's not really an important point. (And you got my +1 for pointing out the support of a vector.)
Comment: In that case, you would probably want to write the two cases in a different order. If the first case contains "$\neq$" and the second one is "otherwise", it feels a little wrong.
Comment: @JoonasIlmavirta I am not sure to understand what you mean
Comment: @JoonasIlmavirta (You got my +1 too :). In fact, I agree with with you but then, as you said, either we flip the definition of $f$ or we flip the definition of support. The first solution depends on OP and the second is likely a bad idea.
Answer: There is a distinction between a vector and its coordinates. A vector doesn't have elements; while vectors are often represented by a tuple of numbers, those numbers are simply the projection of the vector onto various axes, not the "elements". Just because one of the coordinates is zero, that doesn't mean 0 is "in" v, it just means that one of the axes you chose is perpendicular to v. If you want to know whether a tuple contains zero, one way is to take the product; the product of a tuple containing zero will be zero. There is a term "sign function" (not to be confused with "sine") that returns zero if x = 0, -1 if x<0, and 1 if x>0. So if we denote the projection onto the ith axis with $\pi_i$, then
$f(\textbf{v}) = 1-|sgn(\prod_{i=1}^n \pi_i(\textbf{v}))|$
You could also write it as
$f= 1_{\{\textbf{u} : \exists i :\pi_i(\textbf{u})=0\}}$
Explanation:
$\{\textbf{u} : \exists i :\pi_i(\textbf{u})0\}$ means "The set of vectors for which at least one projection function results in zero when applied to the vector".
The notation $1_S$ represents a function that gives 1 if the argument is in the set S, and 0 otherwise. So $1_{\{\textbf{u} : \exists i :\pi_i(\textbf{u})=0\}}$ gives 1 if any of the coordinates are zero, and 0 otherwise.
Note that this depends on what the $\pi_i$ are; that is, what coordinate system you pick will affect whether there are any zeros in the vector's representation.
Answer: You might be interested in the $0$-norm, defined here as $\|\cdot\|_0 : \mathbb{R}^n \to \mathbb{R}$ given by
$$\|(x_1, \ldots, x_n)\|_0 = \text{ number of nonzero entries $x_i$} = \sum_{x_i \ne 0} 1$$
In this context, your function is given by
$$f = \chi_{\|\cdot\|_0^{-1}(\{0, 1, \ldots, n-1\})}$$
where $\chi_{\|\cdot\|_0^{-1}(\{0, 1, \ldots, n-1\})}$ is the indicator function of the set $$\|\cdot\|_0^{-1}(\{0, 1, \ldots, n-1\}) = \{x \in \mathbb{R}^n : \|x\|_0 \le n-1\} = \{(x_1, \ldots, x_n) \in \mathbb{R}^n : x_i = 0 \text{ for some } i\}$$
You can write it even shorter:
$$f(x) = \operatorname{sign}(n-\|x\|_0)$$
Comment: Yes, not what I would call the _usual_ [absolute value](https://en.wikipedia.org/wiki/Absolute_value_(algebra)) ;)
Comment: It's also the taxicab norm derived from the trivial absolute value on $\mathbb R$.
Comment: @barto The trivial valuation, yes.


Why is NodePort discouraged?

Question: In Kubernetes, is there any general reason to avoid NodePort services? In what particular circumstances are NodePorts appropriate?
Answer: First, let's review quickly what is NodePort service.
What is NodePort? How does it work?

Internal Service accessible on Service IP address + Port
NodePort also creates ClusterIP internal Service
NodePort, Opens Port on each Worker Node
External traffic has access to a fixed port on each Worker Node!
Range: 30000-32676

NodePort Service Accessibility:

NodePort accessible from outside the cluster
On IP address of Node IP + The NodePort
NodePort accessible from outside the cluster

Well, it is an excellent choice for testing purposes.
But in production is not a good choice.
Why?
Because you should type each worker node IP with the corresponding NodePort.
InProduction, we want only 1 Ip that automatically LoadBalance between each worker Node.
So, let's quickly review the LoadBalancer type.
Why LoadBalancer?
At this point, our application is accessible from the outside, but it has a couple of downgrades:

Not user-friendly (Node IP:NodePort)
Insecure & messy!
is it OK to test
Better Alternative: LoadBalancer Service Type

apiVersion: v1
kind: Service
metadata:
  name: nginx-service
  labels:
    app: nginx
    svc: nginx-test
spec:
  type: LoadBalancer # The configuration of Loadbalancer is exactly like NodePort except for this part...
  selector:
    app: nginx
  ports:
    - protocol: TCP
      port: 8080
      targetPort: 80
      nodePort: 30000 # Notice we still have a nodePort!

How LoadBalancer works?

LoadBalancer outside of K8s cluster
Which accepts traffic as an entry point
LoadBalances to 1 of Worker Node on the NodePort
Then gets forward to ClusterIP
Accessible at own IP address & port
LoadBalancer is not created inside the cluster

Okay, so we learned that LoadBalancer is a better alternative in production.
But, still, it is not the Best practice and the best solution in Production.
The Best Practice in the Production environment is the Ingress type.

Why Ingress?

Self-Managed K8s cluster: Create LoadBalancer yourself

Managed K8s cluster: Creates LoadBalancers automatically

Loadbalancer Disadvantages:

LoadbBlancer that all become entry points
Configure the Domain Name
Each LoadBalancer exposes new NodePort
Each Loadbalancer increases the cloud bill
Configure everything outside the cluster

Isn't it good:

Having this as part of the K8s cluster?
Configure secure connection
LoadBalancing to different services

Ingress

A K8s component
Configure Routing
Configure HTTPS
Ingress is deployed and available inside the cluster
We need to expose it either as NodePort or LoadBalancer
1 NodePort or LoadBalancer, which is the single entry point

Summary

ClusterIP: Internal Access
NodePort: External Access / Testing
LoadBalancer: External Access / Production
Ingress: External Access / Production / Best Practice

Be sure to check these resources as well:

Make application accessible from outside the cluster
Create Loadbalancer
Setup ingress
Comment: I can't literally think of any reason why load balancing to a single IP is a good idea in production.
Answer: NodePorts are discouraged by sources such as this article.
Some problems:

Nonstandard port numbers get assigned to services. These are undesirable to use, due to lack of human readability and potential to be blocked by firewalls/gateways.
Services may clobber each other. (For example, if a service gets randomly assigned a port number that another service was going to request.)
Security may be more difficult to verify, with direct external traffic to many nodes (and ports).
DNS may behave poorly (hostnames of different services may be synonymous, and address record sets may become too large to fit in UDP query responses).

Situations where NodePort is still justified:

With a gateway (such as a load balancer) that translates automatically between external hostnames and internal port numbers.

For temporary testing, although kubectl port-forward is preferred where possible.

Why is NodePort discouraged?


Mercurial: Getting changed files from revision?

Question: I can't get my head around how I can get only the files that were changed in my last revision, and not the complete repo, which i get by using Clone. This would  be super helpful to for instance, deploy the last changed files.
What do I do?
Thanks
Answer: You cannot transfer just some files -- you must always have a full clone locally. So I suggest you make that once and then pull in changes incrementally.
You should then use hg status to show the names of files changes been revisions. You normally use hg status to see which files are changes compared to the working copy parent revision, but you can pass --rev to status to see changes between any two revisions!
So use
$ hg status --change tip

to see which files were changed in the tip changeset. Use
 $ hg pull
 $ hg status --rev .:tip

to see what files will be changed when you do a hg update after a pull. The update will take you from the current working directory parent, denoted by ., to the tip, assuming you are on the same named branch as tip. Otherwise hg update will take you to the tip-most changeset on your current branch.
Comment: Also `--change REV   list the changed files of a revision`
Answer: You can use a template to hg log or hg tip to get all filenames:
hg tip --template '{files}'

or to get e.g. all files changed/added/modified by changeset 5:
 hg log -r5  --template '{files}'

You can read more about templates Mercurial: The Definitive Guide, Chapter 11. Customizing the output of Mercurial or short help with hg help templating`
If you want to do something to the files e.g grep through them:
hg tip --template '{files}' | xargs grep foo

Careful this will break with filenames containing spaces!
To process all kinds of filenames something more complicated is needed (thanks to mg on #mercurial for the tip):
We need multiline styles for this suppose a file named zerosep contains:
changeset = "{files}"
file = "{file}\0"

Then you can use this to produce a \0 separated list of filenames and process it with xargs -0:
hg tip --style zerosep | xargs -0 grep foo

Information how this works can be found in: Listing files on multiple lines
Comment: `hg help status` shows `-0 --print0   end filenames with NUL, for use with xargs`.
Answer: Martin has the right way to get a list of what files have changed in a revision, and I've upvoted his answer, but just to expand on why your question is a little off:
In Mercurial every location has a full copy with all changes.  If you're going to use Mercurial to deploy to your server then you have to clone everything to your server -- once.  After that push/pull will move over only the (compressed) changesets that the server doesn't already have.
If you don't want to have everything that ever was on the server, then you need to use something other than mercurial for your deployment, perhaps something fed from the status commands Martin showed or a snapshot created from hg archive.
Personally, I'm okay with having full history on my servers, and just do a hg pull ; hg update on the server for each new deployment.  It's tidy and efficient.
Comment: Hi Ry4an - I am well aware of Mercurial needs a full copy with the changes. I won't be able to run mercurial on all servers where code lies, so I will need to use FTP/SSH to upload files, and it is be quite nice to just upload the files that have changed. I tried the archive thing which seems to work really well, especially within the Repo browser in Tortoisehg. Thanks!


Why is the amount of force/moment transfer occurring between bodies in FEA is independent of mesh size?

Question: So I read somewhere that the mesh size won't effect the amount of force transfer occurring between bodies if several bodies are in contact, and a global force is applied somewhere. I wanted to know why is this the case?
Comment: What do you understand about mesh size and what it does?
Comment: Why do you think the real-world object "knows" how to change its behavior depending on the mesh size of your model? It should be obvious that *correct* output from the model doesn't depend on the mesh size.
Comment: @SolarMike, so bascially we vary the mesh size if we want to observe a difference in the results after solution. A finer mesh size would give a relatively accurate results for displacements, stresses and strains. But it won't change the amount of force transfer, thats what I have heard. So why would only the displacements/stresses/strains would have a difference in the values but not the force going through the elements, is my basic concern.
Comment: @alephzero, I mean why would the displacements, stresses, strains would be more accurate now. Doesn't it have to do anything with the force passing through the elements before and after mesh refinement?
Answer: Forces do not disappear without resistance. For a statically balanced system, globally, the sum of the applied Forces must equal to the sum of the resistance forces, so the number, and size of the mesh will not affect the result.
However, the number and size of the mesh will affect the pattern of the internal forces/stresses. Usually, it is advisable to provide finer mesh near the concentrated forces, sharp corners, and openings where distorted results may occur due to stress concentrations.


Acceptable Standard for MAPE

Question: What is the general acceptable value of MAPE in industry ?. I am getting MAPE of around 24% on live data that has 48 data points in which 42 as train data and 6 as test data. I am trying to do ARIMA on these sets. This is a sales data that has both trend and seasonality components.
Answer: The question is meaningless. Yes, some organizations publish "benchmarks" for forecast accuracy, but these are completely useless, because achievable forecast accuracy depends on your data generating process, on the quality of your data, on your aggregation granularity (along multiple dimensions, including product, location, time and others) and on other factors.
For instance, slow movers are harder to forecast than fast movers, so if two firms in the same industry have different proportions of slow and fast movers, their best achievable accuracy will differ widely - even if they are identical on all other attributes described above (which they will never be).
Better: look at internal benchmarks, e.g., simple forecasts.
See also Kolassa (2008, Foresight), "Can We Obtain Valid Benchmarks from Published Surveys of Forecast Accuracy?" Or take a look at How to know that your machine learning problem is hopeless?
Comment: But is it wrong to have a benchmark and check, whether we can still improve our model performance by using other algorithms ?. For example for the data set i have..ARIMA is some value but ETS or nnet might give me a different value..
Comment: Yes, but knowing whether other firms in the industry have a lower or a higher MAPE does not tell you anything about whether your MAPE is "good" or "bad". You may have easily forecastable series, so if your MAPE is the same as the "benchmark", you are still not doing the best you can. Or the other way around.

Acceptable Standard for MAPE


How to apply bootstrap classes to "li" items of Pagelist component in Sitecore SXA?

Question: I want to show my items in pagelist component horizontally in sets of 3. the default behaviour shows item in vertical list. So in order to show items horizontally, i need to apply bootstrap classes "col-xs-12 col-sm-4 col-md-4 col-lg-4" to "li" items. I tried adding classes through rendering variants and to pagelist component in exeperience editor, the classes are getting added to its parent div.
Comment: Can you add some screenshots where it is shown where you have added classes? I think that you are adding classes to Default or root node in rendering variant not to the correct location.
Answer: As far as I know it isn't possible to add those classes via html without cloning the component and modifying the view. However you can achieve the same result using bootstrap mixins and functions in SCSS, with the bootstrap .scss files imported into the theme directory. For example you can add the following to your theme/scss/variants/search-results directory:
@import "base/bootstrap/_functions";
@import "base/bootstrap/_variables";
@import "base/bootstrap/_mixins";
&.search-result-product {
    ul {
        @include make-row();
    }
    li {
        @include media-breakpoint-up(sm) {
            @include make-col(12);
        }
        @include media-breakpoint-up(md) {
            @include make-col(6);
        }
        @include media-breakpoint-up(lg) {
            @include make-col(3);
        }
        list-style: none;
        position: relative;
    }
}

Then add a rendering variant to the search results and set a css class of search-result-product.
More info about working with SXA themes in Creative Exchange here.
Comment: ...thank you for the reply. The first approach you suggested is working !! for the second approach, if i add a new scss file in theme folder, will sitecore compile it automatically ? because i created a new scss files with changes and after using the class name to pagelist component the change is not reflecting
Comment: Hi @Fahmida sorry, some assumed knowledge about SXA Creative Exchange. I've added a link to my answer as to how to change the .scss files.
Comment: You can achieve styling using CSS. After adding the style class in component container and custom rendering variant as per your need. You can achieve desired outcome.


Custom Field Create Bulk via SQL Query

Question: I have a question.  A created a custom field named video_desc. I have ofer 2000 posts and I need to add this custom field to all posts and add the text "Description Here"  to it. How can this be done with SQL Query because all plugins I used didn't worked as it should.
TThanks!
Answer: I manage to work my problem.
For those who seek the same answer, just run this query
<code>INSERT INTO wp_postmeta (post_id, meta_key, meta_value)
SELECT wp_posts.ID, 'video_desc', 'Description here'
FROM wp_posts
WHERE wp_posts.post_status = 'publish';
</code>

Custom Field Create Bulk via SQL Query


Can I use this material for tayammum?

Question: Can I use this type of earthen unglazed product for tayammum though it doesnt have dust over it?
Answer: Tayammum is valid if done using anything that comes from the face of the earth, such as dust, mud, rocks, sand and clay, because Allaah says (interpretation of the meaning):

perform Tayammum with clean Earth
(al-Nisa' 4:43)

It is permissible to do tayammum on walls or vessels made of clay, so long as they are not painted. If they are painted, tayammum is not valid unless there is dust on them. You can put some dirt or sand in a vessel and use that for tayammum.

Can I use this material for tayammum?


WordPress Sub domain

Question: I installed WordPress on sub domain and I have Permalinks as domain/subdomain.com.
In this way this website is working correctly and the main website is accessible via subdomain.domain.com as well but using this URL its sub pages are causing Internal Server Error.
Is there any way to serve this website using both these type of URLs ?
Comment: It is unclear what you are asking. If your permalinks go domain/subdomain.com/page-name that is broken AF and not going to load anything.
Answer: did you try going to settings -> permalinks and clicking save?

WordPress Sub domain


Why do we need different clefs?

Question: Besides reducing the needs of using ledger lines and making the score easier to read, are there any other reasons?
Comment: Have you considered what the alternatives could be?
Comment: That's an easy one: no, there aren't any other imprtant reasons. Clefs are necessary because our eyes deal well only with about five lines and that's it.
Answer: There are two main reasons for this which have to do with the actual instrument ranges and what you can fit on manuscript paper. Different instruments play in much different ranges so having only one clef will make things difficult. Using the same clef for double bass and flute would be silly as you would have and instrument whose lowest note is C1 use the same clef as an instrument that can get up to D7.
As you increase ledger lines needed you also reduce what you can fit on an actual score especially when you have more than one instrument on a score. If we got rid of a clef then any instrument that uses that clef would pretty much take up an extra staff on a manuscript so you could not fit as much material per page.
Answer: The different clefs makes reading music easier. Sure everything could be written in treble clef, but counting 6+ ledger lines is pain especially when sight reading. The Bass clef and Tenor (also all other C clefs) make the notes fit into a staff and thus easier to read. It also shows the pitch relative to middle C, unless the clef is used for transposition. Example Bb Clarinet
Comment: "The different clefs makes reading music easier" - This is not necessarily true. Standard British brass band notation *does* notate every instrument in the treble clef (except for bass trombone) using octave transpositions. The historical reason was to simplify reading if a player moved from one instrument to another - the position of a note of the staff corresponds to the same valve fingering and harmonic for every instrument.
Comment: Exactly! An alternative 'bass clef' would be the treble clef transposed two octaves down.
Answer: It is not exactly clear, whether you are asking for a full score or a part.
For a part only one reason is missing from your enumeration, but this is in my opinion the most important one: convention or tradition.
You will have a hard time to find a viola piece notated in something else than alto clef, and even in case of success, you would likely receive a bewildered glance from a potential player.
For some instruments the conventions are regionally dependent, so French Horn seems to have bass and treble clef areas.
Comment: Instruments with a wide range, usually read two or even three clefs (e.g. cello - bass, tenor, treble) to cover the whole range of the instrument without excessive use of leger lines. French horns are a bit of a special case, since the only notes that *need* the bass clef are the rarely used pedal notes, and to fit them on the bass clef a different octave transposition is used for the treble and bass clef notation!
Comment: @alephzero: As bassoonist I'm aware of the range argument, but I consider it lacking. The basset horn also has a range of four octaves (which corresponds to bass and tenor clef with at least two ledger lines each) and I'm told it is generally notated in the treble clef. The brain is a flexible thing, and one may train it  a second clef as well as recognizing more than four ledger lines, even If I would prefer the first one.
Answer: Bass Clef totally unnecessary, just complicates the music. It's just tradition. If you have a note at the beginning of the piece that a section is one, two or three octaves lower. that is all that is required. It's a pain in the butt for instrumentalist who have only read treble clef.

Why do we need different clefs?


What is the coordinate system used in an Aircraft?

Question: I know that from nose to tail the aircraft is divided by STA (station). At least for Boeing and Airbus this is the case but I am not familiar with other manufacturers.  However, there is also two other dimensions that give every location of an aircraft an identifiable point location. It's obviously not x,y,z.  What is this coordinate system and approximately what does one unit along each access mean in terms of inches or centimeters?
Answer: Stations (STA), generally Fuselage Stations (FS), designate location along the length of the aircraft, increasing from nose to tail. Generally station 0 is somewhere in front of the airplane. One reason for this is that if the airplane grows longer, there still won't be any negative stations, and sections of the plane keep their station numbers. FS 100 can also be placed at an important location (looks like the firewall below).
Water lines (WL) designate location in the height of the aircraft, from ground up. You can probably guess by now that these are holdovers from the marine industry. Like the stations, water line 0 is generally a bit below the aircraft, possibly to have WL 100 at the center of the fuselage, or WL 0 could be at the bottom of the fuselage.
Butt lines (BL) designate location left/right on the aircraft, generally centered in the middle.
While the main system is based on the whole airplane, different parts (like the wings) have their own system of STA, WL, and BL.
The stations are generally in whatever unit is being used for the aircraft. In the US, this is inches.
See this link for an example and further explanation.
For a picture similar to the one below but with more detail, see here.
Comment: Swept wing aircraft also use Wing Stations (WS), a reference parallel to the sweep of the leading edge or perpendicular to the wing ribs in the swept portion of the wing.
Answer: There is a fair amount of variability between aircraft manufacturers as to how they reference physical locations on their airplanes, especially along the longitudinal axis. Even within a company, different schemes are sometimes used for different models.
For example, on the Boeing 747-100, -200, -300, and -400 aircraft, the reference datum is 90 inches in front of the airplane's nose. Why 90? Because the tip of the 90 inch test probe for pitot tube calibration on the original aircraft was the zero point.
However, for the 767-300 the reference datum is 28.5 inches aft of the airplane nose, which of course means that weight and balance calculations have to deal with negative arms.
Boeing uses two systems to refer to a longitudinal axis location. The Boeing Weight and Balance Control and Loading Manual puts it like this:

Balance Arm (B.A.) A true measure of distance from foward to aft, in inches, from a fixed
  datum. The fixed datum is selected by the airplane manufacturer.
  Balance Arms are used in weight and balance calculations.
Body Station (B.S.) A manufacturing location on the airplane. For first of an airplane
  model, B.S. are continuous from the front to the aft of the airplane.
  For later versions that are either stretched (i.e. fuselage inserts
  added) or shrunk (i.e. fuselage sections removed), B.S. becomes
  discontinuous, for manufacturing reasons.

Another system for referencing a point along the longitudinal axis is the percent of the mean aerodynamic chord (%MAC), and to the best of my knowledge this is standardized. C.G. limits for the various operating envelopes (zero fuel weight, taxi, takeoff, landing and others) use the %MAC for the x-axis and weight for the y-axis. Thus, weight and balance calculations come up with the actual C.G. in, say, inches, and then translate this to %MAC for to see if the C.G. lies within the the operating envelopes. The calculation is straightforward. Take the C.G. in inches, subtract the leading edge of the MAC, divide by the length of the MAC, and multiply by 100.
Note that for purposes of C.G. calculation, the wings have to use the same reference system as the fuselage (or have it translatable in reference to the fuselage) because the C.G. of fuel tanks varies depending on how much fuel there is.
Typically wide-body cargo aircraft have lateral imbalance limitations, and for that the lateral referencing system is used. For the 747-400, for example, the maximum lateral imbalance is 10,000,000 inch-pounds up to 846,000 lbs. From there it slopes to 3,340,000 inch-lbs at 913,000 lbs.
Comment: good info. thanks.
Comment: I'll piggy-back here.  Usually the station origin is in front of the nose and the waterline origin is below the aircraft.  That way, all arms used for CG calculations are positive -- and you generally only ever deal with positive numbers.  You place the datum in front of the nose (instead of _on_ the nose) because things change throughout the design process and you might need to extend the nose.  One of the other answers mentions an aircraft whose datum makes some of the aircraft negative -- that is likely a derivative aircraft, or one whose nose design changed in the design process.
Answer: It is much different with depending on what you are doing. Engineering drawings reference a 3 point system for installations mainly Station (X or FS), Butt Line (Y or BL), and Water Line (Z or WL) these 3 coordinates dictate where things are installed exactly.  If you were to look at the production drawings of those light piston and corporate aircraft you would see these much like the illustrations given by Fooot above.
As you are maintenance, simplified drawings are issued to expedite work. It's much easier to tell you it is Fwd of INBD flap rail than FS XXX, LBL YYY, WL ZZZ, as a technician would be more familiar with the location of the INBD Flap rail than its coordinate location.
If you were building that plane, the coordinate locations would be given as it would have to put in an specified location to comply with the type certificate of that aircraft at least in America.
Answer: To my knowledge there isn't a coordinate system to describe locations on an aircraft airframe.  Measurements along the longitudinal axis of the aircraft exist for center of gravity measurements.  These measurements are made as an "arm" measurement from a standard arbitrary point, known as the datum.  Specific measurement locations are "stations".  There is no real need as far as I know to have a measurements in the other 2 axis.
For locating components for maintenance purposes, my experience of technical manuals usually describe locations verbally, such as "the flap actuator can be located forward of the inboard flap rail".
My experience is mainly with light piston aircraft and corporate jets, it could be different with larger aircraft.


Why is gravity only an attractive force?

Question: As per the universal law of attraction, any two bodies (having some mass) experience a force of 'attraction' which is proportionate to ...and ...inverse proportionate ....
Then comes my question: Why it should be force should be of type 'attraction' only ?  Why it should not be repulsion / any other kind of force ?
Comment: @BetaDecay I'm not sure what that article is talking about. No real predictions in physics suggest antiparticles have negative mass. From [wikipedia](https://en.wikipedia.org/wiki/Antimatter): "A particle and its antiparticle have the same mass as one another, but opposite electric charge and other quantum numbers."
Comment: There was an article in New Scientist on this a while ago. It was describing research into how antimatter (presumed to have a *negative mass*) reacts under Earth's gravity. It is thought that antimatter (specifically anti-hydrogen, in this case) may rise instead of fall.
Comment: [The aforementioned article](https://www.newscientist.com/article/mg23331050-100-does-antimatter-fall-up/)
Comment: I think the question is stated in a manner that limits generalizatioon. I think the larger question is if gravity is a manifestation of some larger theory under certain boundary conditions. Newton's theory of gravity is based on "ordinary observations" and works very well for most human considerations. Calculations based on Newton's theory got men to the moon and back. However for the orbit of Mercury and timing of GPS then relativistic considerations need to be taken into account. So back to what should be the question? Given that "dark energy" is causing the universe to expand faster and fas
Comment: Same question on the physics board.   https://physics.stackexchange.com/questions/11542/why-is-gravitation-force-always-attractive   You can look up Spin 1 and Spin 2 particles for some explanations, but until gravity is actually understood, all the answers are pretty much hypothesis.    Some related answers here as well:  https://www.quora.com/Quantum-Field-Theory-Why-do-particles-of-odd-integer-spin-generate-forces-which-can-be-both-attractive-and-repulsive-whereas-particles-of-even-integer-spin-only-attract
Answer: Because mass is positive
To expand your quote concerning the gravitational force into an equation:
$$F_G = -\frac{Gm_1m_2}{r^2}$$
The force of gravity, $F_G$ is proportional to the product of the masses and inversely proportional to the distance, $r$, squared. Let's break this down and see what might cause $F_G$ to be positive.
In this equation, $r$ cannot be negative because it's a distance between two locations. Two locations cannot be a negative distance apart. And even if they somehow were, the squared would take care of that anyway.
$G$ is the universal constant and always positive. You might argue that it could possibly be negative, but that's not possible. $G$ actually doesn't really exist. It doesn't describe anything fundamental to the physics of the universe. $G$ is simply a bookkeeping constant that allows us to get the right answer for the force based on any choice of units for mass and distance. Technically, if one uses the "correct" units for mass and distance (e.g., the Planck units), then $G=1$ and effectively doesn't exist. Since $G$ is just a scaling factor that depends on the choice of units, it will only be a positive number.
That leaves us with the masses. These are the only things which could possibly be negative. Of course, to get a positive, repulsive force, one mass would have to be positive and the other negative. But what exactly is a negative mass? Mass is the metric which describes "how much" of something there is. How can you have less than nothing of something?
Why can mass not be negative?
If you want to look at this another way, you can show that if mass could be negative, you'd get nonsensical results! Assuming of course, all other aspects of physics were the same. Recall from Newton's second law that
$$F = ma$$
Let's say there are two blocks sitting on a table. One block has a mass $m_1>0$ which is positive and the other has a mass $m_2<0$ which is negative. Ignore all other forces on these two blocks for the moment.
I go up to $m_1$ and I apply a force to push this mass forward. The acceleration that is induced is: $a = F/m_1$. Necessarily, the direction in which $m_1$ moves is the same direction in which I'm pushing. That's all well and good.
Now I go over to $m_2$ and I apply the same force, attempting to push it forward on the table. The acceleration induced on $m_2$ will be: $a = -F/|m_2|$. Note I made $m_2$ positive and pulled out the negative sign. You can see that if my force is forward, the direction the mass moves will be backwards! But here's the problem, my hand is in the way because it's trying to push to mass. As the mass tries to move backwards into my hand, it will be applying a force back on my hand, which by Newton's third law, necessarily mean's my hand is applying more force on the block, which then applies more force on my hand, ... and suddenly infinite forces are being applied or equivalently, these objects are infinitely accelerating. This is described by the concept of Runaway Motion.
If this seems strange to you, that's because it is. If negative masses existed, we'd live in a very weird universe. Fortunately, we live in a universe where physics makes sense, mass is positive, and by extension gravity is always attractive.
Comment: Interestingly, the force of gravity would be negative if the distance was imaginary! So just imagine some mass at a particular distance from you and it will repel you.
Comment: As convincing as this explanation seems, electrical charge follows the inverse square law and charge can be positive or negative. I see no reason why mass couldn't theoretically behave the same way. I believe it's actually a "fundamental mystery" as to why gravity is the only one of the four known forces that acts only to attract and never to repel. The other 3 fundamental forces can do either.
Comment: The second law describes inertial mass, not (necessarily) gravitational mass though.
Comment: @barrycarter I thought about addressing this in my answer. I guess I should have. The catch here is that Newton's second law is **not** $F=ea$, it's $F=ma$. You can't apply the argument above to negative electric charges for that reason. The reason mass can't behave in the same way is for the reason I outlined above. It isn't a mystery. If Newton's second law instead was $F=ea$, then electric charge could not be negative.
Comment: @adrianmcmenamin But all evidence suggests the two are equivalent. In fact, their equivalence is a major component of GR and there has been no evidence so far showing this part of GR is wrong. I described the answer for the universe we appear to live in (aside from the potentiality for negative mass). If you want to throw in all sorts of other complications, that's outside the scope of my answer.
Comment: The "why mass can't be negative" doesn't seem very convincing to me. *F* in your example could just as well be a force caused by gravity and there would be nothing in the way. Presumably, if the mass were negative you wouldn't be able to push it with your hand.
Comment: @Octopus There are many reasons why mass can't be negative. The one I outlined is just one reason using one particular case. And I don't see why you wouldn't be able to push the mass with your hand if it were negative (aside from the runaway motion problem I described).
Comment: @zephyr, well you just said "mass can't be negative" and then "I don't see why I wouldnt be able to push it if it were negative." you've contradicted yourself. There are theories on antimatter. You wouldn't push antimatter with matter.
Comment: @Octopus I didn't contradict myself. I said mass can't be negative. But, if it could, I don't see why you believe you couldn't push it with your hand. And what does anti-matter have to do with any of this? That is not pertinent to this discussion.
Comment: "suddenly infinite forces are being applied"... OK, but when a proton attracts an electron, doesn't the same thing happen? The two get closer and closer and the attractive force increases to infinity? In reality, at some point, the weak and strong nuclear forces take over.
Comment: @zephyr, well, thanks for providing a sort of explanation ....but it seems there is an assumption that a force being '+ve' would mean attraction...which does not make sense ...as it could not explain why two masses should attract each other ...
Comment: I don't see a whole lot of talk about General Relativity here. If gravity is just thought of as mass causing 3d "divots" in space time, I don't see why some unknown entity wouldn't cause "bumps", other than the fact that we don't observe them.  Or, maybe all of space-time in our universe is one big "bump" that we call "dark energy".
Comment: @barrycarter Yes, you're correct that the functional forms of graivty and electromagnetism diverge when $r\rightarrow 0$, however that's not possible in reality. Not to mention that has nothing to do with my answer anyway, so I don't see why you mentioned it.
Comment: @MeaCulpaNay What is '+ve' supposed to be? I don't know what you mean by a force of that type. I make no assumptions about anything, I just take the normal laws of physics and say what happens if mass can be negative.
Comment: @zephyr, well, my earlier comments were based on entirely a single-sided argument which considers what are all possible quantities can go '-ve' in the illustrated equation...and there by counter-arguing ...that neither mass/nor distance/nor 'G' can become negative ...and there by proving that 'F' must be a positive quantity. Till this it is fine. But then comes the crux - how nature of F is linked with the force being attractive or something else ? That is my basic doubt.

Hope this clarifies.
Comment: @MeaCulpaNay I still don't understand what '-ve' is supposed to be. What is 'v' and what is 'e'? Is this an equation? Is it a suffix? And I still don't understand your doubt. I basically showed F depends on three terms, all of which must be positive, implying F necessarily must be positive as well.
Comment: @zephyr, well, thanks. I am sorry, I could not express myself in a better manner... what I meant in my earlier posts are:

+ve = positive, -ve = negative.
Answer:
Why is gravity only an attractive force?

TL;DR
Because mass is always positive.

There are different notions of mass, but they're equivalent.
There are two distinct notions of mass: gravitational and inertial. The masses in Newton's law of gravitation, $F = \frac{Gm_1m_2}{r^2}$, are gravitational masses. The mass in Newton's second law of motion, $F=ma$, is inertial mass. Gravitational and inertial mass are implicitly assumed to be the same in Newtonian mechanics. General relativity makes this assumption explicit in the equivalence principle.
But what if they're not equivalent?
Unlike mathematics, where one can simply make an assumption and see where it leads, assumptions in physics need to be validated. This assumption has been tested with many kinds of materials, both on the ground and in space. Variations on the Cavendish experiment using different kinds of materials have been made. Within the limits of the rather lousy accuracy of the gravitational constant (one part per ten thousand, at best), every one of these is consistent with the null hypothesis (gravitational and inertial mass are the same) and inconsistent with the hypothesis that different materials have measurably different gravitational and inertial masses.
The Earth's Moon, with its very different near-side and far-side, provides an even better mechanism for testing this equivalence. Rather than the one part per ten thousand (at best) accuracy available to Cavendish-style experiments, the Moon shows that gravitational and inertial mass for sodium and iron are equivalent to within about one part per ten trillion.
So much for ordinary matter, but what about antimatter?
That an ordinary matter particle and its antimatter equivalent have the same (positive) inertial mass has been tested over and over in particle colliders around the world. Whether the equivalence principle also applies to antimatter remains a somewhat open question. While there are many reasons to think that the equivalence principle applies to antimatter as well as normal matter, testing that this is the case is very hard. The best results to date are from the ALPHA experiment, which tests whether neutral antihydrogen (a antiproton and an positron) falls up or down. The results are that antihydrogen's gravitational mass lies somewhere between -65 and 120 times its inertial mass. This is not anywhere close to conclusive, but it does lean towards antimatter having a positive gravitational mass, consistent with the equivalence principle.
Answer: Along the same lines with previous answers suggesting "mass cannot be negative," I'd like to add an insight for why that might probably be the case. If Higgs field and particles' varying degrees of interaction with the field is what gives rise to what we call mass, then the theory suggests that photons don't have mass (and constitute the velocity limit through space) because they don't interact with the field at all. I don't think the framework allows for negative interaction with the field or an "anti-Higgs" field.
Comment: Did you mean "photon" rather than "proton" being massless?
Answer: Theoretically, gravity can be "attractive" in the sense that objects move towards you when pushed. This can occur from negative mass (doesn't seem to make sense, but theoretically possible). Peter Engels and others have written a paper about it here and it's an interesting idea.
The idea is that by cooling the atoms to almost absolute zero, they create a Bose-Einstein condensate and act likes waves in the realm of quantum dynamics.
Comment: That paper in no way suggests that *gravity* can be reversed. The paper says that atoms within a Bose-Einstein condensate can, under certain conditions involving 1-D expansion of the BEC, "accelerate against the applied force, realizing a negative effective mass related to a negative curvature of the underlying dispersion relation." In other words, the positive-mass rubidium-87 atoms briefly *behave* as if they had negative mass. The equivalence of inertial and gravitational forces remains uncertain at quantum level, so you can't use this result to argue for "negative" gravity.


Overriding higher-kinded abstract types in Scala

Question: The following code shows a shallow hierarchy where a type representing a generic binary operation is used to substantiate a parameterized abstract type in another shallow container hierarchy:
trait BinaryOp[A] extends ((A,A) => A)
trait Plus[A] extends BinaryOp[A]
trait Minus[A] extends BinaryOp[A]

trait BaseOps {
  type T[A] <: BinaryOp[A]
  def apply[B](one: B, two: B)(op: T[B]) = op(one, two)
}

case object PlusOp extends BaseOps {
  override type T[A] = Plus[A]
}
case object MinusOp extends BaseOps {
  override type T[A] = Minus[A]
}

object App {
  val plus = new Plus[Int] {
    def apply(i: Int, i2: Int) = i + i2
  }

  def main(a: Array[String]) {
    val exp = Expr(PlusOp)
    exp.bo(1,2)(plus)
  }
}

The idea is to be able to state an operation that may be valid for many different types up front, without being tied to a type-specific operation. If I define an expression class generically, all is well
case class Expr[T <: BaseOps](bo: T = PlusOp)

However for my use case it is undesirable for Expr to to be paremeterized:
case class Expr(bo: BaseOps = PlusOp)

The following code fails without a generic Expr:
object App {
  val plus = new Plus[Int] {
    def apply(i: Int, i2: Int) = i + i2
  }

  def main(a: Array[String]) {
    val exp = Expr(PlusOp)
    exp.bo(1,2)(plus)
  }
}

The error:
 found   : App.plus.type (with underlying type java.lang.Object with Plus[Int])
 required: exp.bo.T[Int]
   exp.bo(1,2)(plus)

This makes it seem as if the type information from the abstract type T[A] <: BinaryOp[A] is not being substantiated with the information in the subtype PlusOp, which overrides the abstract type as T[A] = Plus[A]. Is there any way to work around this without making Expr generic?
Answer: With "-Ydependent-method-types",
def Expr(_bo: BaseOps = PlusOp) = new BaseOps {
    override type T[A] = _bo.T[A]
    val bo: _bo.type = _bo
}

But, I don't know what this precisely means...