total internal reflection implementation in pbrt-v3

Question: I've been implementing a path tracer, referring pbrt-v3. However, I'm a bit confused about its implementation. Code is here.
It seems when we sample to do transmission, it tests if it meets a total internal reflection, but it doesn't assign a proper value to the pdf, instead, after the function returns Vec3f(0,0,0) as BTDF value, it then tests if pdf is 0, if 0 then directly jumps out of the tracing loop.
I don't think this make sense since there should be radiance value if this ray continues to trace and does out of the specular object and hit a surface which is illuminated. But this implementation seems to leave out all such kind of radiance, and rely on the sample_f function to sample a reflection.
So how to properly compute the pdf of total internal reflection?
        // Account for the indirect subsurface scattering component
        Spectrum f = pi.bsdf->Sample_f(pi.wo, &wi, sampler.Get2D(), &pdf,
                                       BSDF_ALL, &flags);
        if (f.IsBlack() || pdf == 0) break;

Answer: The code does seem a bit ugly since it doesn't assign pdf and instead returns 0.
By returning 0 it's basically saying the same thing as pdf = 0 because f.IsBlack() returns true.
This is acceptable, it's basically saying the BSDF doesn't allow light go through at the given $w_o$


Can I play music from my macbook on my iPad for free?

Question: Is there an app that works to play music that's on my macbook on my iPad? Right now my iPad is connected to my stereo, and is only the 16 gig model, so I can't exactly move all my tunes onto it. I know I can use airfoil to play iTunes on my macbook and have the iPad act as the speaker control, but it is expensive. I installed the Remote app and set up home sharing but it only seems to work in the opposite direction (play music on my macbook speakers using the iPad as the controller).
Answer: This is exactly what iTunes Home Sharing allows you to do -- stream music stored on my Mac using your iDevice.
The short steps for setting this up are:

Enable home sharing in iTunes on your Mac:

Start iTunes
Go to Preferences -> Sharing and make certain 'Share my library on my local network' is checked.
LEAVE ITUNES RUNNING!

Now connect to your shared library from your iDevice:

Go to the Settings app and click on the Music settings
Scroll down to the bottom of the Music settings page and you'll see the 'Home Sharing' setting
Enter your iTunes account ID and password to enable your iDevice to see your shared library

Use the Music app on your iDevice to access your shared library

Open the Music app
Your shared iTunes library should now be available as a source of audio in the app

This works for video, audio and podcasts as well. If your Mac puts itself to sleep you might need to wake it back up for the shared library to show up in your iDevice before you can stream audio or video from it.
Comment: I also had to click on `File > Home Sharing > Turn On Home Sharing` to make this work.
Answer: You can listen to music stored on your MacBook using the built-in Music app. First turn on Home Sharing in iTunes on your Mac, then in Settings on your iPad. On your iPad, in the Music app select your iTunes library.
Comment: Correct: you can't control the stream from your Mac. If that's what you want to do, what you need is an AppleTV or an AirPort Express connected to your stereo. Both of those devices show up as "outputs" for iTunes on your Mac that you can pick just like they were speakers attached to physically to your computer.
Comment: Works great... the only difference is I can't control it (i.e. press play or pause) from my macbook. Or can I?


Cat is afraid of another cat

Question: Okay, so I have four cats in my household now. About a month ago, two started fighting. Neither were neutered, and one was the offspring of the other. I don't feel like typing out their names, so let's go by initials. The oldest male cat is called B, and the child is named W.
W has just now grown into a full grown male cat, and has tried to breed with the two other female cats. B then attacked him, and every time they saw each other, they would fight until W has secluded himself in small rooms and corners, and hisses when B comes near him. My family and I decided it was due to them not being neutered, so we had that done a couple days ago. Now, B still attacks W and W still hides. He also refuses to use the litter tray, and is generally terrified of B.
Will this change, or will we have to do more?
Comment: It sounds like a territorial or dominance issue to me, regarding the females. Also, how old are the males? You say that 'W' is now a `fully grown male`, which theoretically, is only 1 yr old, for an 'adult'. However, a fully grown adult may take up to 2-4 years to reach maximum size.
Comment: It will take more than "a couple of days" for the cats' hormone levels to drop, and longer than that for them to decide whether they still dislike each other or can tolerate having the other around. Meanwhile make sure there are two litterboxes placed so one cat can't block access to both. Also, it can take several days for the vet scents to wear off and for even friendly cats to stop hissing at each other; Harry was in for dental work two days ago, and Hazel just now finally stopped being suspicious and is sharing a grooming session with him.
Comment: When I say fully grown male, I mean like how an 18year old human would be considered adult. Just about 1 year old, I think.
Answer: Lots of factors can cause disputes between cats, but here are a few general suggestions that may help:

Litter boxes. The way you described the issue, the problem doesn't sound like it's specifically a litter-box dispute, but your question implied there is only a single litter tray in your home. This may be making a bad problem even worse. The general rule is "number of cats, plus 1 more", so if at all possible, you should have 5 litter boxes in your home. Try to spread out the locations of the litter boxes and avoid areas that could cause 'W' to become cornered while using them.
As others mentioned in comments, give the cats more time. You need to be prepared for weeks, not days, of adjustment.
Depending on how long the drama was going on, the cats may have become conditioned to be hostile towards one another. If you can, you might want to consider separating them for a while and gradually re-introducing them under favorable conditions such as during feeding time, after lots of exercise to ensure they're both calmer. Even if you can't separate them, it is definitely a good idea to try feeding them at the same time in the same room to strengthen the association between each other's presence and "good things" (food) happening.

Cat is afraid of another cat


Text doesn't show up in zoomed section

Question: I've made a zoomed still frame in my sequence, but I want to display text at the exact same relative position as in the unzoomed sequence. This isn't working. At first I thought that I must change the position of the text strip accordingly, because it uses the unzoomed, absolute positions. But when I changed it to 0.5 0.5, where it definetly should have showed up, I couldn't see it. I tried adding the text strip to the zoom transform, not the original video strip, but that didn't help. Maybe it's important in which order I added my effects and which is attached to which? I use both a speed strip as well as a transform strip at once. Is there a certain order of adding strips on top of each other I have to keep in mind?
Answer: Ok so seems blender's interface is a bit unintuitive for newcommers, because after I put the text strips to the top, the main strips at the bottom and the effect strips in the middle, everything worked perfectly and as expected.
You really have to keep in mind the order (top to bottom) of your strips since they determine the layering of your, I guess, masks? It is also important which effects are applied to which strip, because similarly my speed effect (speed to zero for a freeze frame) didn't work with my transform if I applied both to the main sequence.
So top to bottom order and effect attribution are pitfalls as far as I can tell.

Text doesn't show up in zoomed section


Is there a way to keep labels and symbols from displaying inside an extent indicator?

Question: I've been working on a utilities map and have been asked to turn off the labels and symbols within the extent indicator on the larger scale map and show them only in the detailed map. Is there a way to do this without converting labels to annotation and making a copy of and editing each individual shapefile specifically for this map?
Comment: what software are you using ?
Comment: I'm using ArcMap 10.1
Answer: The first thing that you could try is to use a display scale range so that the label disappear when you zoom out (layer properties > label). At the same place, you can also handle conflicts, but this is more complex. For symbols it is the same.
Answer: I have two...workable solutions,
First solution:  set label classes for the features in question.  Then change the default class to not include anything within the extent.  This does require writing SQL that calls out each of these features individually so not a great solution.
Second solution:  create a new Polygon feature mimicking the extent indicator.  Turn it on, but make its symbology invisible.  Then set its feature weight to High/1000 so nothing get labeled over it.  If you want, you could also set it so only the border has a weight and the interior doesn't.
Answer: Insert a new data frame, add your layers to that. Don't label any. Set the data frame extent of the new data frame to that of the first one (Data Frame Properties > Data Frame tab > Extent drop down > Other Data Frame). Adjust your layout as desired.


Fighting that damping off fungus

Question: I am having a hard time finding anything that kills this. Some people say a normal fungicide will not kill them, and I can't find products made to kill it specifically like people are saying I should do, at least products that don't cost $100. I have just learned how to prevent it, now what can I use that is safe for seedlings that will kill this stuff without harming the seedlings as well?
Answer: There is no effective, sure fire cure when damping off has affected seedlings, in fact, the seedlings usually die, so if you have a container affected in this way, get rid of the seedlings and the soil, because the soil will contain the fungal spores. Because there is no cure, most efforts regarding damping off are aimed at preventing it in the first place, especially for seeds. Damping off can occur on larger plants, but they usually manage to cope and don't get killed. See information here https://www.planetnatural.com/pest-problem-solver/plant-disease/damping-off/
You don't say whether this damping off is occurring in open ground in the soil or whether its in the potting medium you've used to raise seeds in a container. Assuming its the latter, always use new sterilised starter soil and a well scrubbed, very clean container, and don't overwater the seedlings.
Answer: My advice would be similar to Bamboo's, do not over water those seedlings.  Even in 1" X 2" pots with sterilized soil you do not soak that soil, just moisten.  Is there space between the seed trays and the surface beneath?
There is another critical item for a grow room; fans, ventilation!  Using sterile soil will not eliminate fungal spores of damping off, nor will an enclosed room...well, maybe level 2 bio hazard (1,2,3,4) room with positive pressure.
Do not add fertilizer during this baby period.  Period.  Feeds fungus, baby plants use the cotyledon for chemistry until they are able to do photosynthesis on their own and then not before, those plants need basic, balanced fertilizer.
From 1"X2" seed starting trays, the next size up is 3 and 4" pots with potting soil.  As your plants continue to grow in this next size up, 3 to 4" pots, you could start acclimating those starts to the out of doors garden.  Takes at least 2 to 3 weeks to go through this process.  Any change in environment and light source the plants need acclimatization to the new environment and light source.  Just as important the reverse; taking plants indoors from green house or straight sun needs acclimatization.
Moving the air furiously will be the best prevention of damping off.  Pruning excess vegetation to allow air flow.  Second necessary step.  Growing in a greenhouse emphasizes this air flow stuff big time.  Your hair should be looking like a maniac if that fan is strong enough to minimize moisture and fungus.
Fungicide is generally considered a 'raincoat'.  If not applied as a preventative, a fungicide will be useless.  The exception is powdery mildew.  This is the only fungus that we treat after the fact...after messing up by not having enough ventilation as well as free water on the plants.
Damping off and botrytis are in the same department.  The preventative measures are major ventilation, sterilized soil and thinning of plant material.  Baby seedlings don't have too much vegetation blocking the air.  The spores are in the air for botrytis and damping off.
Treatment

There is no cure for plants that already have damping off. However,
  you can easily prevent the problem by providing good air circulation.
  A small fan or simply cracking the lid of the germination tray will
  suffice. The biological fungicide Mycostop may also be used as a seed
  treatment to prevent seed or soil-borne diseases. Other steps for
  preventing damping off include the following:

When starting seeds indoors, use good organic potting soil or
    sterilize your own potting soil in an oven.
        Make sure your seed starter mix is light and fast-draining.
        Plant seedlings so that the soil surface is near the top of the container to insure proper air circulation.
        Sow seeds thinly to prevent over crowding which can lead to humid, moist conditions.
        Seedling trays that provide water from below are preferable to overhead watering.
        Never water past noon so that the soil surface and the plants are dry by evening.
        Avoid overwatering tender seedlings.
        Organocide® Plant Doctor is an earth-friendly systemic fungicide that works its way through the entire plant to combat a large number
    of disease problems. Apply as a soil drench or foliar spray (3-4 tsp/
    gallon of water) to prevent and attack many fungal problems, including
    pythium, fusarium and root rot.
    Treatment

damping off article

Fighting that damping off fungus


Migrating a single 2010 site collection to 2013 site collection

Question: I have a fresh 2013 TEST and PROD SharePoint farm. At this point, I am just trying to migrate a SP 2010 Sales site collection to 2013 site collection. What are the steps for this. I did a backup of the source db and restored it to 2013 db. Is spmount be the next step.
Answer: You will need to create a site collection in SharePoint 2013, detach the newly created content database and then attach the 2010 content database to the site collection. SharePoint 2013 will upgrade it for you.
The process is explained here http://www.orcsweb.com/blog/cory-granata/how-to-upgrade-sharepoint-2010-to-sharepoint-2013-using-database-attach/
Comment: Arsalan: that process did not work. Could it be the new sp 2013 farm is based on completely different services accounts including the domain. Do I need to add the service accounts to the 2010 content db before taking a back up and restore. Also SP roles for DB are missing after restoring 2010 db to 2013 db.
Comment: Hi Arsalan, the backup > restore to blank DB > spmount = did not work. Could it be the farm is on another domain and I need to add all the service accounts before I take sp 2010 backup thru sql mgmt. Also I don't see spdataaccess and spreadonly role after migrating to 2013 db.


Ortho-Eigen Vector in Two -Space

Question: For a linear mapping $L$ in the plane transforming $[1 ,0]$ to $[a ,c]$ and $[0 ,1]$ to $[b, d]$ a non-zero vector $v$ such that $v$ and $Lv$ are orthogonal will be named an ortho-eigen vector for $L$. May be there is another name for such vector: my name goes in parallel with an eigen vector, which you get by replacing "orthogonal" by parallel. A task:
Find conditions on $a,b,c,d$ to determine if $L$ has ortho-eigen vectors.
Answer: Assuming the usual euclidean product:
So we can put $\,L\,$ in matrix form wrt the standard basis of $\,\Bbb R^2\,$ :
$$[L] =\begin{pmatrix}a&b\\c&d\end{pmatrix}$$
and then we have an orthoeigenvector iff
$$0=\left\langle\;\binom xy\;,\;\binom{ax+by}{cx+dy}\;\right\rangle=ax^2+(b+c)xy+dy^2$$
Let us look at the above right side of the equation as a quadratic in $\,x\,$ :
$$ax^2+(b+c)y\,x+dy^2=0\;\;\text{has a real solution iff}$$
$$\Delta=(b+c)^2y^2-4ady^2\ge 0\iff(b+c)^2y^2\ge4ady^2$$
Now check cases: if $\,y=0\,$ we have an obvious solution whenever $\,ax=0\,$ , otherwise
$$y\neq 0\implies(b+c)^2\ge4ad\implies (b+c)^2-4bc\ge 4(ad-bc)\iff$$
$$\text{tr.}^2[L]-4bc\ge4\det[L]\;\ldots\ldots$$

Ortho-Eigen Vector in Two -Space


Asimov's three laws and non human inteligence

Question: Is there any work by Asimov regarding how the three laws of robotics apply for non human intelligent beings? Do they apply only for humans or can they be extended to any intelligent being?
Comment: I've removed the part about other authors in your question. We've found that such "list questions" attract many poor answers with just one example each, rather than a few great answers as we prefer, and so they are [off-topic](http://scifi.stackexchange.com/faq) on this site. A good resource for lists of works (especially SF) is [TV Tropes](http://www.tvtropes.org/). Answerers should feel free to support their answers with other authors, but please base your answers on something about Asimov.
Comment: I don't remember that there are actual non-human aliens in the robot series. The only non-humans are the robots themselves.
Answer: Yes.
In That Thou Art Mindful of Him a pair of highly advanced robots study the laws, discuss the weights they must give to them in the event of conflicts (such as saving a child versus and elderly person, etc) and eventually decide that they are 'human' as defined by the laws in every way that matters.  They then decide that, as the most advanced 'humans', and as those whose potential to help humanity in general is highest, they are 'most human' and best suited to giving each other orders.  In effect, they reason their way into a state where they can place their own good above the good of others.
This would not be possible if the Three Laws didn't cover non-human intelligence (or if the definition of 'human' weren't flexible enough to extend to any sentient being).
Comment: No, the Zero'th law was not mentioned in that story.  It was added later, in _Robots and Empire_ and described before that (but not articulated as such) in "The Evitable Conflict", which I believe came after 'TTAMoH'.
Comment: TTAMoH is about whether all humans are truly included in the Three Laws, a theme that Asimov briefly returned to with the Solarians in *[Robots and Empire](http://en.wikipedia.org/wiki/Robots_and_Empire)* and *[Foundation and Earth](http://en.wikipedia.org/wiki/Foundation_and_Earth)*. I don't remember non-humans being discussed by Asimov.
Comment: Is this where the Zeroth law comes from?  (I read that as a word, for years, until I realized they meant Zero'th law.  Ah well, amusing how things like that happen!)
Comment: The [Zeroth Law](http://en.wikipedia.org/wiki/Zeroth_Law_of_Robotics#Zeroth_Law_added) was only formulated as such in *[Robots and Empire](http://en.wikipedia.org/wiki/Robots_and_Empire)* (1985), but it was almost formulated in ["The Evitable Conflict"](http://en.wikipedia.org/wiki/The_Evitable_Conflict) (1950). "That Thou Art Mindful of Him" happens earlier than "The Evitable Conflict" in the internal chronology, but was written much later (1974).
Answer: In "Victory Unintentional", humans send three robots to the surface of Jupiter, to make contact with the belligerent Jovians. The robots were built to be extremely robust and programmed to be as inoffensive as possible. For much of the story the Jovians arrogantly show off their superior might and science, while the robots walk around completely invulnerable to it all, profusely apologizing for breaking everything they touch, and conferring among themselves about whether the human race can possibly survive the coming war, and whether anything can be done to prevent it.
The story is humorous, and not really a part of his Robot series, but the Three Laws are present and clearly do not give human status to the Jovians.
Comment: But do they ever violate the Three Laws?  They obviously PREFER humanity to the Jovians (the same as they give preference to whom they save in an emergency, under the first law) and want humanity to survive, but I don't think they ever violate the Laws.  They are never given an order, they are never put into physical peril (so we can't see if they'd kill a Jovian to escape it), and they don't kill any Jovians.  They do not give the Jovians the title of 'human', but they do not (explicitly or implicitly) deny them the protections and rights the 3 Laws give to 'humans'.
Comment: @Jeff: They witness the death of a Jovian (killed by friendly fire) without agitation, their compliance with commands and concern for the safety of their hosts seems to stem from a desire to avoid giving offense (I seem to remember the most tactless of the three tilting a foundry crucible in order to look at the molten metal-- and stir it with his arm -- while Jovians scramble for safety), and they consider wrecking the factories and (if memory serves) bombarding the planet with H-bombs, and dismiss these plans as futile. (Forgive any mistakes of memory-- it's been thirty years.)
Comment: Apparantly I don't remember the story as well as I thought, then.  Though I will point out that the tilting of the crucible and the discussion of offensive actions against the planet are not in violation of the Laws.  About the rest, I have no response.
Comment: Technically you're correct, but in Asimov's stories the Laws are reflected in *attitudes*, not just actions. I may have been mistaken about the bombardment -- I know it's discussed by men in the preceding story -- but when the robots tilt the crucible and consider whether to wreck the factory, it is clear that the safety and wishes of the Jovians *are not foremost in the their minds*. Just imagine them doing that with humans; Asimov's robots just don't act that way. And besides, why would they consider a plan that they knew they could not carry out?
Comment: Because the safety of humans-like-earthmen trumps the safety of humans-not-like-earthmen, by virtue of humanity's general traits that make them more 'valued' by the Laws (per TTAMoH) - especially the lack of xenophobic genocidal (xenocidal?) tendencies and the overall lack of a massive superiority complex as a species.
Answer: I depends on the individual robots and their programmers. I remember that one of the robot stories includes Spacer robots that have been given an extremely narrow definition of "human", such that it doesn't include Earth-born humans. Can't recall the name of the story right now, though.
Answer: Asimov also considers circumstances in which the rules might not apply to the whole of humanity. In Robots and Empire the Solarian robots have been adjusted to limit their classification of human to only those who

 speak with a Solarian accent.
Comment: Interesting observation but not an answer to the question.  A subset of humanity is still humanity and the question is about extension of the rules to non-humans.
Comment: If you can bend it that far, than you can bend it very far the other way.


How to get name of the constant?

Question: Assuming you have a constant defined in a class:
class Foo {
    const ERR_SOME_CONST = 6001;

    function bar() {
        $x = 6001;
        // need to get 'ERR_SOME_CONST'
    }
}

Is it possible with PHP?
Answer: You can get them with the reflection API
I'm assuming you would like to get the name of the constant based on the value of your variable (value of variable == value of constant). Get all the constants defined in the class, loop over them and compare the values of those constants with the value of your variable.
Note that with this approach you might get some other constant that the one you want, if there are two constants with the same value.
example:
class Foo {
    const ERR_SOME_CONST = 6001;
    const ERR_SOME_OTHER_CONST = 5001;

    function bar() {
        $x = 6001;
        $fooClass = new ReflectionClass ( 'Foo' );
        $constants = $fooClass->getConstants();

        $constName = null;
        foreach ( $constants as $name => $value )
        {
            if ( $value == $x )
            {
                $constName = $name;
                break;
            }
        }

        echo $constName;
    }
}

ps: do you mind telling why you need this, as it seems very unusual ...
Comment: I "need" something like this in order to provide a nicer error output without having to rewrite how we track certain error codes that are stored as constants.
Comment: Nothing serious, actually. Just thinking of the way to pass error code from class function. As for me const ERR_SOME_ERROR='ERR_SOME_ERROR' looks strange, i thought my getLastError() function could return something like array(5003=>'ERR_SOME_ERROR',5002=>'ERR_SOME_ERR2') and so on.
Just to have error code and error name returned. Well, the more i think of it, i'll probably will not use it (for the unusual syntax as you told) :)
Comment: also needed it for CURLE_* constant support where `curl_multi_strerror` was not available
Answer: Here's what I did to achieve it. Inspired by Jan Hancic.
class ErrorCode
{
    const COMMENT_NEWCOMMENT_DISABLED = -4;
    const COMMENT_TIMEBETWEENPOST_ERROR = -3;
    /**
     * Get error message of a value. It's actually the constant's name
     * @param integer $value
     *
     * @return string
     */
    public static function getErrorMessage($value)
    {
        $constantNames = array_flip(
           array_filter(
               (new ReflectionClass(OrderStatus::class))->getConstants(),
                static fn($v) => is_scalar($v), // only int/string
           ),
        );

        return $constantNames[$value] ?? null;
    }
}

Comment: Just wanna say that this will not work if constants have the same value. Shouldn't be a problem most of the time, but yea...
Comment: I think this wouldn't work when a constant has an array as value as well..
Comment: edited answer to allow arrays
Answer: With Reflection:
$class = new ReflectionClass("Foo");
$constants = $class->getConstants();

$constants is an array which holds all the names and values of the constants defined in class Foo.
Answer: All the other answers cover the essential points.  But, if crazy one liners is your thing, then:
function getConstantName($class, $value)
{
    return array_flip((new \ReflectionClass($class))->getConstants())[$value];
}

If you need to handle the case where the value might not actually be one of the constants, then you can give up an extra line:
function getConstantName($class, $value)
{
    $map = array_flip((new \ReflectionClass($class))->getConstants());
    return (array_key_exists($value, $map) ? $map[$value] : null);
}

Comment: This is Easy and Quick Solution. Flip the Array and check for the Key.
Answer: I know this is an old question and all, but I still feel that I have some useful input. I implemented this using an abstract class that all my enums extend. The abstract class contains a generic toString() method;
abstract class BaseEnum{
    private final function __construct(){ }

    public static function toString($val){
        $tmp = new ReflectionClass(get_called_class());
        $a = $tmp->getConstants();
        $b = array_flip($a);

        return ucfirst(strtolower($b[$val]));
    }
}

//actual enum
final class UserType extends BaseEnum {
    const ADMIN = 10;
    const USER = 5;
    const VIEWER = 0;
}

This way you can get a human readable string to use in output, on every enum that extends the base enum. Furthermore, your implementation of the enum, being final, cannot be extended and because the constructor in the BaseEnum is private it can never be instantiated.
So for instance, if you show a list of all usernames with their types you can do something like
foreach($users as $user){
    echo "
{$user->name}, ".UserType::toString($user->usertype)."
";
}

Answer: All constant can be assigned to an array using this function.
$const = get_defined_constants();

then using following function you can print the array structure
echo "<pre>";

print_r($const);

and you can see more explanation here www.sugunan.com
Answer: Warning: This way you should NOT program... ( if youre not sure what youre doing :) )
I wrote 1 row which echos constants and their numeric values by your choice of CATEGORY_
so here is the list of CATEGORY_ ERR_
foreach(get_defined_constants() as $key => $value) if(strlen($key)>5) if(substr($key, 0,5)=="ERR_") echo"
Found an php ERR_ constant! : ".$key."=>".$value;

And if you want just the one youre looking for by number => I created 1row function:
//input parameters: CATEGORYNAME_ , #constantNumber
function getConstantName($category,$constantNumber){foreach(get_defined_constants() as $key => $value) if(strlen($key)>strlen($category)) if(substr($key, 0,strlen($category))==$category) if($value==$constantNumber) return $key; return "No constant found.";}

So for example some info constant with number 64:
echo "NameOfConstant: ".getConstantName("INFO_",64);

will output something like: NameOfConstant: INFO_LICENSE
Answer: OK, OK, I know everything is already covered :)
But Jan Hančič asked for use case, so I'll share mine.
Aside: everyone seems to use array_flip(). Why not array_search()?
I needed it in a class that extends \Exception and is base class of small set of my concrete exceptions. Each of those concrete exception classes covers a broad exception domain and has defined several precise exception causes. Reason? I don't want to have a horde of exceptions to maintain and remember of. Also, there is exception handler set that dumps exception's guts into log file - and it's here I need to get the constant name as trying to decipher exception cause from status in quite painful.
Examples from my CLI scripts:
class AbstractException extends Exception {
    public function getName() {
        return array_search($this->getCode(), (new ReflectionClass($this))->getConstants());
    }
}

class SyntaxException extends AbstractException {
    const BAD_SYNTAX = 90;
    const REQUIRED_PARAM = 91;
    const REQUIRED_VALUE = 92;
    const VALUE_TYPE = 93;
    const VALUE_OUT_OF_BOUNDS = 94;

    public function __construct ($message = "", $code = self::BAD_SYNTAX, Exception $previous = NULL) {
        $script = basename($GLOBALS['argv'][0]);

        echo "Invalid syntax: $message \nSee: `$script --help` for more information\n";
        parent::__construct($message, $code, $previous);
    }
}

// in autoload include
set_exception_handler(function(Exception $e) {
    error_log(basename($GLOBALS['argv'][0]) . ';'. date('Y-m-d H:i:s') .';'. $e->getName() .';'. $e->getMessage() .';'. $e->getFile() .';'. $e->getLine() ."\n", 3, 'error.log');
    exit ($e->getCode());
});

Answer: class OrderStatus
{
    public const PENDING = 1;
    public const PROCESSED  = 2;

    public static function getStatusCode($value)
    {
        $class = new ReflectionClass(__CLASS__);
        $constants = array_flip($class->getConstants());

        return $constants[$value] ?? null;
    }

    // OrderStatus::getStatusCode(1); // 'PENDING'

}

Answer: if you need to get the constant value on a method of the same class, you just need to use the self operator. You could use reflection if you want to use the constants on another class
class Foo {
    const ERR_SOME_CONST = 6001;

    function bar() {
        self::ERR_SOME_CONST;
    }
}

Comment: That is not what the OP asked for.

How to get name of the constant?


Do apps designed for a different desktop environment (GNOME, XFCE, LXDE, ...) break?

Question: Is it true that each app is designed for its own desktop environment (like GNOME, XFCE, LXDE, etc.)? If I try to use an app that's made for a different desktop than I'm using (like using a GNOME app in LXDE), will it break/look ugly or something? I don't get it...
Comment: There, the grammar is more readable.
Comment: Please clarify your question a bit better. You have question marks after sentences that sound like statements.
Comment: Hmmm... I have question marks for question sentences. ;)
Comment: It's not clear if "And when I will try to use app that's made for other DE (like Gnome app on LXDE) it will break/look ugly or something?" is a question or a statement. The structure implies it's a statement, mostly because it starts with the word "And".
Comment: I guess you are the only one that have problems with it. You can edit my post, anyway. I don't see need to do it!
Answer: No. Well generally the answer is 'no'.
A program depends (for instance) on libraries and those libraries get installed with the program. And since those libraries are unique for the desktop environment (DE) they are intended for they will most likely not break the DE you install it on since the maker of said software will try to create unique file names or use general libraries and use general toolkits (and those should be unique too).
If by accident the creator of the program creates something that has the same name and is also saved into the same directory as the software on the DE you want to install it it will get tricky. Sometimes the installer will warn you and quit.
I have seen 1 time where this happend but that was because a piece of software was forked and the person forking it decided to keep names identical instead of actually making it into a new independent program. But you are likely to then choose one over the other so it was basically a non existing problem.
I remember another one: on SCO you have a command called enable that has 2 functions: it is part of a printer setup where you disable and enable a printer. But it also a function for something else (and this one comes first). So you can do disable /dev/kyo0 but need to do /usr/bin/enable /dev/kyo0 to enable the printer (this was later fixed by renaming enable to cups-enable) (from memory so specifics might be off ;) ).
But this is just annoying and was not a big problem: since both reside in different directories the command further up the PATH directive needs to have the directory in front of it).
Comment: It seems like you're describing an issue that applies to package management in general, having only a minor connection to the issue of desktop environments. Am I right?
Comment: No you are not correct @Firefeather and are you the one that downvoted me?
Comment: Whoa, Rinzwind, I haven't voted on your answer (up *or* down) at all. I just don't understand.
Answer: You really only need to worry about KDE in terms of apps from different desktop environments, and even then, you only need to worry just a little bit. As for Xfce, LXDE, and GNOME, all three of those use the Gimp toolkit (Gtk), so they should function and look properly between each other.
Yes, it might look a bit uglier, but functionality should be retained.
Comment: Could you clarify why you would need to worry about KDE? What does or doesn't work?
Answer: They might look a bit ugly in some cases, but the functionality will almost always work.


Azerbaijan job - Best way to take money from the contract

Question: I am in the process of getting a job in Baku, and have been offered X amount, and been told to pay the taxes on it.  My question, given I'd be in Baku 183 days a year, would be how best to pay taxes; would it be to declare them locally, declare them in the UK or still be paid through my own limited company?
Answer: Refer to HM Revenue & Custom's Double taxation treaty of UK with Azerbaijan and all its details (PDF).
Comment: Seems all a bit too convoluted. May have to live there too me thinks...

Thanks a lot
Answer: This is the kind of question best answered by a professional specialist in international taxation, who knows something about Azerbaijan. The precise rules can be very complicated, and consulting a professional can save you thousands. Even little things like exactly how many days you spend in the country can make a difference. I did that when I changed countries, and their advice saved me thousands.


Why are there gaps between two lines of iron filings in a magnetic field?

Question: I mean if the magnetic field is slightly increasing or decreasing at a place should'nt there be a gradient of iron filings instead of clear lines?
As to me clear lines mean that there is a comparatively strong magnetic area next to a weaker one hence the iron filings are more attracted to that particular area hence forming a line.
Comment: Someone may correct me here, but it seems like this is to do with the iron filings sticking together rather than showing a feature of the magnetic field they're in.
Answer: The magnetic field originating from a bar magnet is continuously decreasing when moving away from the bar magnet. It does not have "lines" of stronger field strength. The lines that are forming are a consequence of the magnetic fields generated by the iron fillings themselves.
An iron particle possesses a magnetic moment that aligns with the magnetic field of the bar magnet. The magnetic moment of the particle also generates a magnetic field around it (just as the bar magnet does). Now, two factors of this field are important in the explanation of the lines:

The magnetic field generated by the particle has an opposite direction with respect to the field of the bar magnet (on the sides of the iron particle). Hence, in the region besides the particle, the net field is reduced.
The field generated by the particle (near field) decays faster than the field of the bar magnet (far field). Therefore, after some distance, the reduction of the net field due to the particles is neglectable.

These two arguments combined, explain the iron particle lines. If more particles are added, they will not nest themself in the region besides the already present particles because the field is weaker there. Instead, they will nest themselves somewhat further (in a new line) where the influence of the field of the iron particles is neglectable. As a result, iron particle lines are formed.
Answer: Self interaction of the iron filings is a valid explanation however the void-gaps  are there but not of the size scale you may think.  Quantum electrodynamics and their consequent macroscopic classical electromagnetic phenomena is discrete in nature phenomena and vacuum void space is part of the equation. Thus  coherent distortions  in quantum field cannot be continuous. It may look at such at the macroscopic classical scale but it is not. Even water flow in a river consists at the microscopic level of coherent flow streams of of Hydrogen and Oxygen atoms separated by vacuum space between them inside the water molecule and molecules in a stream are also separated by vacuum gaps (i.e. bear in mind that inside any materiel at atomic and subatomic size scales there is no medium between two atoms but only vacuum space).
Electromagnetic flux is coherent streams of virtual photons linked to electrons and void space is always there between them at least at the Plank length scale. So the physical description of a magnetic field and its magnetic flux consisting of what may seem at the macroscopic level of "countless" but still finite number of coherent stream lines of these virtual photons, carriers of the the EM force is valid and actually true.
Therefore, examining the isolated H field of a permanent magnet placed in a vacuum environment,  assuming there are no iron filings present or any other magnetic matter except the permanent magnet, the vacuum gaps between the different discrete streams of flux (i.e. flow of energy) are physically there but there are so small that at the macroscopic classical scale we observe the magnetic flux as a continuous field.
The quantum world consists manly of void vacuum gaps and is elementary discrete and this also applies for the magnetic flux of a magnetic field. The only physical entity that today is not being resolved of being discrete phenomenon is vacuum space itself and considered as contentious by General relativity. Quantization of space prove is one of the main goals of modern quantum gravity theory.
An effective method but not actual for representing the magnetic field strength using magnetic flux lines is instead of Tesla units to use Maxwell units thus number of lines per cm^2. For this units a 100μΤ field strength is represented with one line penetrating vertically a one cm^2 surface. This representation is symbolic however and not the actual physical number of lines that macroscopically and practically would appear to us as  "countless" nevertheless is a finite  number.
To get a feeling for example:
This calculator translates Tesla units to Maxwell (lines/cm^2). According, it says that 100μΤ correspond to one line per square cm thus  0.5 cm clearance from every side.
A quick calculation shows a $1T$ field has 10,000 lines/cm^2 which corresponds to a separation distance between the lines of 500 nm (i.e. there is a line present at regular 500nm intervals in space) for a homogeneous magnetic field assuming also the flux lines are infinite thin.
Again, this is just a representation of a given field strength using number of lines and the number of lines per field strength used by this unit cannot be taken literally. The discrete magnetic flux lines, streams of virtual photons consisting the field are physically there but in a finite number much much larger as represented by this unit.


The locus of the center of a variable conic inscribed in a triangle, such that the sum of the squares of its axes is constant

Question:
A variable conic is inscribed in a given triangle. If the sum of the squares of its axes is constant, then the locus of its center is a circle whose center is the orthocenter of the triangle.
Comment: Welcome to Math.SE! The community prefers/expects questions to include something of what the asker knows of the problem. (*What have you tried? Where did you get stuck?* etc) This information helps answerers tailor their responses to best serve you, without wasting time (theirs or yours) explaining things you already know or talking over your head. (It also helps convince people that you aren't simply trying to get them to do your homework for you.) Since comments are easily overlooked, please [edit your question](https://math.stackexchange.com/posts/3450333/edit) to add details.
Answer: Not an answer, just a start to stimulate some work on this interesting problem.
I'll show first of all how to construct an ellipse inscribed into a triangle. Given a triangle $ABC$, we can choose at will two tangency points (for instance $P$ on side $AB$ and $Q$ on side $BC$, as in figure below). If $M$ is the midpoint of $PQ$, then the center $O$ of the ellipse lies on line $BM$.
To construct the third tangency point, draw from $A$ a line parallel to $PQ$, intersecting line $BM$ at $L$. Tangency point $R$ is then the intersection between line $QL$ and side $AC$. We can then construct $N$, midpoint of $QR$: center $O$ of the ellipse is the intersection between lines $CN$ and $BM$.
Lines $OB$ and $OD$ (parallel to $PQ$) give the directions of a couple of conjugate diameters. Semi-diameters $OF$ and $OG$ can be found from the relations:
$$
OF^2=PM\cdot OD,\quad OG^2=OM\cdot OB.
$$
If $a$ and $b$ are the semi-axes of the ellipse, then the first theorem of Apollonius gives:
$$
a^2+b^2=OF^2+OG^2=PM\cdot OD+OM\cdot OB.
$$
One should then prove that the distance of $O$ from the orthocenter $H$ of $ABC$ depends only on the above quantity, but at the moment I have no idea of how to do that.

EDIT.
After some experiment with GeoGebra, I found for instance that $OH=\sqrt{a^2+b^2}$ when $ABC$ is a right triangle, for any position of $P$ and $Q$.
Comment: @Blue Here's a reference to that theorem: https://www.cut-the-knot.org/Curriculum/Geometry/ConjugateDiameters.shtml
Comment: +1. The key relation is shown in [my answer's](https://math.stackexchange.com/a/3458124/409) equation $(\star)$. My path to it isn't very satisfying, however. (The Apollonius relation was very helpful. Do you have a reference?)
Comment: Nifty. I had a passing knowledge of conjugate diameters in a projective context, but I'm not sure I ever knew their metric properties.
Comment: @Intelligentipauca : how did you draw the ellipse?
Comment: @BlackMild I used GeoGebra.
Comment: @Intelligentipauca I mean other: how to determine/construct (rotation angles of) the major/minor axe of the ellipse? I am redrawing the figure with TikZ or Asymptote
Comment: @BlackMild Once you find conjugate diameters $OG$ and $OF$, as explained above, you can construct principal axes [as explained here](https://math.stackexchange.com/questions/3320901/conjugate-diameters-of-ellipse/3321038#3321038). To make the figure, though, I simply used GeoGebra tool "conic through five points".
Answer: Here's an ugly coordinate algebra approach. I suspect there must be a much more straightfoward way to show the key result $(\star)$.

In $\triangle ABC$ let $D$, $E$, $F$ be the points of tangency of the conic as shown in the figure. (This argument is constructed with an ellipse in mind. I think that hyperbolas are properly covered simply by allowing parameters $\alpha$, $\beta$, $\gamma$ ---and therefore also the ratios in $(4)$--- to be negative.)

One can show that $\overline{AD}$, $\overline{BE}$, $\overline{CF}$ concur at a point; let $P$ be that point, and let $(\alpha:\beta:\gamma)$ be its barycentric coordinates, so that
$$P = \frac{\alpha A+\beta B+\gamma C}{\alpha+\beta+\gamma} \tag{1}$$
then
$$D = \frac{\beta B+\gamma C}{\beta+\gamma} \qquad E = \frac{\alpha A+\gamma C}{\alpha+\gamma} \qquad F = \frac{\alpha A+\beta B}{\alpha+\beta} \tag{2}$$
As @Aretino observes, the conic's center (here, $K$) lies on the line through $A$ and the midpoint of $\overline{EF}$; likewise, the line through $B$ and the midpoint of $\overline{FD}$, and the line through $C$ and the midpoint of $\overline{DE}$. If $K$ has barycentric coordinates $(\alpha':\beta':\gamma')$, then
$$(\alpha':\beta':\gamma') =
\left(\overline{\beta}+\overline{\gamma}:
\overline{\gamma}+\overline{\alpha}:
\overline{\alpha}+\overline{\beta}\right)
\quad\text{where}\;\;\overline{x}:= 1/x\tag{3}$$
Let $M$ be the midpoint of $\overline{EF}$ and let $L$ be the point on $\overline{CA}$ such that $\overline{KL}\parallel\overline{ME}$. With some symbol-crunching, we find
$$\frac{|KL|}{|ME|}=\frac{|KA|}{|MA|}=\frac{
(\overline{\alpha}+\overline{\beta})(\overline{\alpha}+\overline{\gamma})}{\overline{\alpha}(\overline{\alpha}+\overline{\beta}+\overline{\gamma})}\qquad
\frac{|KM|}{|MA|}=\frac{\overline{\beta}\overline{\gamma}}{\overline{\alpha}(\overline{\alpha}+\overline{\beta}+\overline{\gamma})} \tag{4}$$
We also have
$$\begin{align}
|ME|^2 &= \overline{\alpha}^2\;\frac{a^2(\overline{\alpha}+\overline{\beta})(\overline{\alpha} + \overline{\gamma})
+b^2 (\overline{\beta}-\overline{\gamma})(\overline{\alpha} + \overline{\beta})
+c^2(\overline{\gamma}-\overline{\beta})(\overline{\alpha} + \overline{\gamma})}{4(\overline{\alpha}+\overline{\beta})^2(\overline{\alpha} + \overline{\gamma})^2} \\[4pt]
|MA|^2 &= \overline{\alpha}^2\;\frac{
- a^2(\overline{\alpha}+\overline{\beta})(\overline{\alpha}+\overline{\gamma})
+ b^2 (2\overline{\alpha}+\overline{\beta}+\overline{\gamma})(\overline{\alpha} + \overline{\beta})
+ c^2   (2\overline{\alpha}+\overline{\beta}+\overline{\gamma})(\overline{\alpha} + \overline{\gamma})}{
4(\overline{\alpha}+\overline{\beta})^2(\overline{\alpha}+\overline{\gamma})^2
}
\end{align}\tag{5}$$
where $a:=|BC|$, $b:=|CA|$, $c:=|AB|$. These calculations are relevant, with another nod to @Aretino (and Apollonius), because
$$\begin{align}
s^2 &:= (\text{maj.radius})^2 + (\text{min.radius})^2 \\[4pt]
&= |KL||ME|+|KM||KA| \\[4pt]
&= \frac{|KL|}{|ME|}|ME|^2 + \frac{|KM|}{|MA|}\frac{|KA|}{|MA|} |MA|^2 \\[4pt]
&= \frac{a^2\overline{\alpha}+b^2\overline{\beta}+c^2\overline{\gamma}}{4(\overline{\alpha}+\overline{\beta}+\overline{\gamma})}
-\frac{a^2\overline{\beta}\overline{\gamma}
+b^2\overline{\gamma}\overline{\alpha}
+c^2\overline{\alpha}\overline{\beta}}{4(\overline{\alpha}+\overline{\beta}+\overline{\gamma})^2} \tag{6}
\end{align}$$
To relate this with the locus of the conic's center, we can position $\triangle ABC$ with its orthocenter $O$ at the origin; eg,
$$A = 2r\,(0,\cos A) \quad B = 2r \cos B\,(-\sin C, -\cos C) \quad C = 2 r \cos C\,(\sin B,-\cos B) \tag{7}$$
where $r$ is the circumradius of $\triangle ABC$. Then, since
$$K = \frac{\alpha'A+\beta'B+\gamma'C}{\alpha'+\beta'+\gamma'} \tag{8}$$
with $\alpha'$, $\beta'$, $\gamma'$ from $(3)$, we find, after much more symbol-crunching, that
$$k^2 := |OK|^2 = 4r^2 - \sum_{cyc} a^2 \frac{(\overline{\alpha}+2\overline{\beta}+\overline{\gamma} )(\overline{\alpha}+\overline{\beta}+2\overline{\gamma})
}{4 (\overline{\alpha}+\overline{\beta}+\overline{\gamma})^2} \tag{9}$$
Therefore,

$$k^2 - s^2 = 4r^2 - \tfrac12\left(a^2+b^2+c^2\right) \tag{$\star$}$$

Since the right-hand side of $(\star)$ is a constant, we have that the variable conic's center has a fixed distance from the orthocenter if and only if the sum of the squares of the conic's radii is itself fixed.
Note that this doesn't say that the locus of the center is a full circle about the orthocenter. For that, we must convince ourselves that (barring degeneracies) any point is the center of some tangent conic. But this is clear: relation $(3)$ tells us that, given a center with barycentric coordinates $(\alpha':\beta':\gamma')$, we can solve for the coordinates of a corresponding $P$
to get
$$(\alpha:\beta:\gamma)= \left(\frac1{-\alpha'+\beta'+\gamma'}:\frac1{\alpha'-\beta'+\gamma'}:\frac1{\alpha'+\beta'-\gamma'}\right)$$
Cevian lines through this $P$ meet the side-lines of $\triangle ABC$ at the points of tangency for the conic. $\square$
Comment: Fine work! I'd be surprised if a simpler proof would appear.


Facing Pages in Pages 6.x

Question: I think this question is fairly straight-forward: is there any way to get Pages 6.x (I have 6.2) to have facing pages? I typically word-process in Pages '09, however that doesn't have right-to-left support and I don't need Adobe InDesign for this project.
Answer: Facing pages are available in Pages 7.0.

Turn on facing pages to format your document as two-page spreads.

This can be enabled as per the instructions in Set up your document in Pages

Use facing pages
You can set your document up as a two-page spread. Documents set up as two-page spreads can have different headers, footers, and master objects on left- and right-facing pages. Use facing pages for layouts for printed books, or for double-sided documents that you intend to print.

Click , then click Document.
Select Facing Pages.
If you want different footers for the left and right facing pages:

Click , then click Section.
Select "Left and right pages are different."

You can view facing pages as a two-page spread, or as a single page. Click Zoom, then choose Two Pages or One Page. If you're viewing your document as a two-page spread, choose Fit Spread to fit the two-page spread vertically on your screen.
Answer: It's not possible, this question comes up frequently in the Apple forums, e.g.  here.
Word Mac 2016 is supposed to be able to do mirrored margins and RTL.
Also I think Nisus Writer.
Comment: Progress in restoring lost Pages 09 features has been glacial.  We just got back linked text boxes finally.
Comment: Apple really hasn't addressed that in the last four years?!
Comment: Has anyone with contacts to Apple software execs tried to exert influence?
Comment: Also, Word sucks at RTL support. I'd use Pages '09, but that also sucks at RTL support.
Comment: @NoahM I would be interested in specific problems with word 2016 RTL if you have time .  You can email tom at bluesky dot org
Answer: I have tried to resolve this issue by opening the Pages document in OOD and there it can be formatted with mirror margins. It worked.  Negatively this process changed some fonts (from italic to normal)  issues. So, if you are aware of the pitfalls you can produce a document for printing (OOD is free)
Now I am back to square 1, wondering what can be done as this is a large document and easy to miss bugs. Apache Open Office 4 was the program I used.  Marie
Comment: The question is about how to do it in Pages, not in Word, OpenOffice, LibreOffice, or Nisus Writer.  All you are doing is telling people to use a different app,

Facing Pages in Pages 6.x


How to define a catch all route to handle 404 in can js?

Question: What is the proper way to define a catch all route to handle 404 in can.js in a way that all the correct routes will be checked against first? If non are matched this route will catch it and I can display a 404 message.
Answer: These are just some things I learned diving into the source and doing some tests...
If I defined a root with a single param, for example can.route(":section") and enter into the address bar a fragment that looks like "!#toronto/something/feasf" and there isn't another route to match it, can will currently consider that as the above route and convert it "!#toronto%23something%23else" which is according to the tests generated for that route is correct.
The way to prevent that behavior is defining the route with a trailing slash, can.route(":section/") which when tested agaist the false route should rewrite it to the first match "toronto". The same applies if you define your routes in a control.
You have to catch an invalid param in your route handler or if it is supplied to a model, you can handle the error in the callback. But I think that is pretty clear from the get go.
If you still want to catch an incorrect route for whatever reason, I've made the following test to catch the invalid route. I don't suggest it since it does create unnecessary overhead in your application.
<code>can.route.bind('change', function(ev, newVal) {
    if (newVal === 'route') {
        var valid = false;
        $.each(can.route.routes, function(k,v) {
            if (new RegExp(v.test).test(window.location.hash)){
                valid = true;
                return; //exit loop
            }
        })

        if (!valid) {
            //handle the false route here
        }
    }
});
</code>
Answer: You can register a wildcard after all your routes
<code>// Catch 404
router.register('.*', 'controller#action');
</code>


Where to ground digital and analog regulators when using separate planes?

Question: Below is a topology of my new project. I am noticed about importance of planes separation. But I'm in doubt how to ground power regulators and filters.
Answer:
Analog Ground is closest to signal input being measured by ADC such that no digital loop currents are shared in the path of the analog current loop so that supply noise is decoupled and ground ripple currents do not cause ground ripple voltage on analog Vref.
This is done by physical layout of star grounds and isolated ground copper pours and active guarding of sensitive sensor sources.
Each digital current path must consider inductive and capacitive effects that may couple to analog loop elements.


Connect to Raspberry Pi over ssh: connection refused (from putty)

Question: I have a raspberry running raspbian, and I want to connect over SSH, but something is happening.
On the raspberry I have run nmap and port 22 says: OPEN; the ssh process is running and fine.
But I can't connect from my windows 8.1 machine with putty, I just get connection refused.
Can anyone give me any pointers?
Edit: forgot to mention that I can both ping it and I have checked raspi-config, and it seems normal.
I had some trouble resolving dependencies with apt-get, but I reinstalled resolvconf, and that fixed it.
EDIT2: It also didn't work while disabling the Windows Firewall.
EDIT3: I can ssh the pi from the pi.
EDIT4: I just found out that my raspberry and windows box have the same ip... what?
Comment: Sure it is connected to the internet? Try in the command line following command : `ifconfig wlan0` . Is there a _real_ IP adress in the line `inet addr`?
Comment: Can you ping from Windows machine to your Pi?
Comment: Check if the ssh starts in boot from '/etc/init/' and check 'sudo raspi-config', you might have disabled ssh
Comment: See edit for more info.
Comment: I had a similar issue...finally just restarted my router (after losing 1.5 hrs debugging), and boom, magically it all works again! Symptoms were weird: all devices had internet, but could not talk to each other, and SSH refused. Restarting router fixed whatever the issue was...so it turns out it wasn't even on the PCs.
Answer: Raspberry changed something since November 2016
here is the noob instruction to get this problem fixed
sudo su
raspi-config

1) Choose first  'update'
2) In advanced options ->  expand_root file system
3) interfacing options  ->   ssh [enable]
4) change_locale [your country-UTF8]
and if you still here, it's good to change the timezone as well
5) change the default password (don't be lazy, just do it :)
Comment: Please - add "change default user password" to the above list. This is probably the reason they turned it off by defaut.
Comment: @TomaszGandor ty that's a good one
Answer: So, I figured it out.
A long time ago I assigned an IP to my pi on the router, binding its mac address to the IP.
It so happened yesterday that I had the same IP when I needed the pi again.
So I probably tried to connect to my windows machine from my windows machine because of the identical IP's.
What fixed it was this in cmd (on my windows box):
ipconfig /release
ipconfig /renew
yay, finally
Comment: Worth noting that the latest Raspbian ships with ssh disabled in the config.
Comment: @Eddie You saved my life man!!!!!
Answer: It might be an issue with wrong SSH key pair matching.
Your client stores SSH keys of previous sessions.  So if you've SSH'ed in the past with this same client to another device (or same Raspberry but with different build) on the same IP, the keys on both sides don't match.
Solution: delete the keys on your client.
Putty stores SSH keys in the registry: HKEY_CURRENT_USER\SoftWare\YOU\PuTTY\SshHostKeys.  If you aren't using Putty have a look at %USERPROFILE%\ssh or %USERPROFILE%\.ssh.  If you're using OSX, have a look at ~/.ssh/known_hosts
Comment: This was a clean install on the pi, and I havent used any ssh keys with putty on this machine. This is getting difficult.
Answer: It might be the windows firewall that is blocking the outbound ssh connection.  Make sure port 22 is allowed out of your windows machine.
Comment: Ah, I didn't mention that I disabled the Windows Firewall as well, but with no luck.
Comment: On the Pi can you `ssh localhost`
Comment: Yeah, that works.
Comment: And for kicks `ifconfig` on the Pi and `ipconfig` on windows show that both systems are on the same network?
Comment: I'm not at home right now, but I remember both having the same default gateway, both being plugged into the same switch with ethernet cable, and though I didn't check my windows box's ip, the pi's ip looked like it should.


Is it possible to print a list of orders including items ordered?

Question: I'd like to print a report that simply lists the orders made in the last month, that includes simple order info including price, customer name, etc, as well as the items in that order.  It seems that items orders/invoiced is not an option either in reporting or in the order list.  Is there a way to print a simple list of orders such as this?
Answer: From Sales->Orders you can able to see the grid with the details. In that same grid you can add the extra column by choosing from here https://www.screencast.com/t/u9sb2w7XFmx .
In that columns section, we don't have product name details because if a order has more products then it is difficult to accommodate in the grid. But you can overwrite the grid file and add the product details in the collection.


How do I properly load a PSD in GIMP?

Question: I wanted to load up free PSD's from TurboSquid.com, they are royalty free, and they encourage the downloads...
But I CAN NOT, load them up in GIMP at all. All they show is a WHITE screen when i load it into gimp.
I have GIMP v2.8.16, and I have tried to drag and drop, or manually load, or open with on the file itself. Nothing seems to actually want to open it up nothing... any help would be appreciated.
Comment: no hidden layers or anything? Tried running gimp in a terminal & watch for errors, especially with `-c, --console-messages`?
Comment: Nope no hidden layers, or anything.  Oddly I did run it in a terminal, and it jut blazed by no errors, it sees it as a good file, no corruptions or anything.  This is a first time I have ever tried to open a PSD in GIMP, so it is new experience for me. It is weird when nothing happens.
Comment: Another idea - the download failed somehow, perhaps silently, still downloading a file with the correct name, but only containing text or HTML. Looked at/in it with a binary/hex editor? I'd expect some errors or some results from trying to open it in gimp though. Maybe try a newer (or older) version of Gimp?
Comment: Did the re downloading, nope.   Never did look at it with a binary/hex to me why would I think of doing that to a picture file...heh good idea though. Not the first thing to enter my mind.   Though I didnt think of trying an older GIMP version.  Since I have the newest, didnt think of going old school heh.
Comment: I've seen a few websites that will quietly send a short HTML page (something like "can't download this") in place of a downloaded file. Misconfigured probably, but it probably won't be the last time it happens. Also try running `file` on the downloaded file, maybe it's something different.
Comment: And what exactly does gimp say when trying to open it? Any error messages, or just a big white canvas? Maybe it's just a blank image. Are the file url's public, feel like sharing them?
Comment: I agree, sadly it is a PSD in a ZIP file so running it is out of the question. I wish I could have done that.    As for the error, there isnt any, it loads up without errors meaning textual, the only error(if it is an error all in all i think it is) i can see is the white 1 layer that is it that all i get, nothing on it, it should be a multi-layer file like possibly upwards of 10-15 layers if not more. But I get nothing other than 1 layer period. So that is what is con-fuddling me. And it was a no go on the older version of gimp as well.
Comment: Example: https://www.pixelsquid.com/stock-image/square-wooden-crate-1010261998966937049?image=G02   Take that one for instance,  The PNG is worthless to me, it isnt layered.  The PSD is what i need/want, I download it(zip file) then extract it, but then normally one would think that i could jsut dbl click it and poof it will open in gimp with the layers... not so, you will just get 1 white layer/canvas. If you use GIMP try it yourself, it will confuse you too i swear.
Answer: Tried downloading the link you pasted, from https://www.pixelsquid.com/stock-image/square-wooden-crate-1010261998966937049?image=G02 (after checking bugmenot.com to "log in"), and it downloaded a zip file Square%20Wooden%20Crate.G02.2k.psd.zip and after unzipping Square_Wooden_Crate_01.G02.2k.psd I dragged it into GIMP and the wood crate image appeared:

It is still just one "flat" layer, with some darkening around the bottom for it's "shadow," so it's probably not much better than an image from the webpage, but it is fairly high resolution and the white background isn't extremely difficult to make transparent.
This was after I tried downloading the below plugin & copying it to GIMP's plugin directory, but I don't think it did anything. And it doesn't seem to allow the rotating that their website advertises, maybe that's what the plugin does (and probably why it's a 100MB file for an image if a crate).

I think I've found the problem... the PixelSquid website has this info (not super-easy to find, and the plugin link looks like it might be randomly generated):

Remember to install the free PixelSquid Photoshop plugin and start placing PixelSquid objects directly into your comp!

So, I think you need their special "PixelSquid Photoshop plugin" to use their files. Especially since I don't remember Photoshop or GIMP having a standard rotate feature like they describe "objects that can be placed and rotated right inside of your Photoshop comp. Just click-and-drag to find the perfect angle."
I'm not too sure if that plugin will work in GIMP...

First I tried a google search for gimp use photoshop plugins. Results were inconclusive, so
I just tried to download the "PixelSquid Photoshop plugin" to see if just copying it to my GIMP folder would work. Under GIMP's Preferences, in Folders -> Plug-Ins it lists /home/user/.gimp-2.8/plug-ins and /usr/lib/gimp/2.0/plug-ins so I was going to try one of those.
However, problems include:

Have to go to adobe.com to download it, which requires an email & login & password.
After jumping through those hoops, it then tells me:

Congratulations!
  Add-on acquired
Thanks for using Adobe Add-ons!
  Follow these steps to get started:

You need to install the Creative Cloud app in order to install this Add-on
Click "Get Creative Cloud App"
  Install a compatible app, if needed, and make sure to Sync files to Creative Cloud
Turn on Files Sync when you've installed Creative Cloud app, your Add-on(s) will be automatically installed

Then it wants me to install the "Adobe Creative Cloud desktop application". I'm not even sure if that's for Windows only (likely), and it's download page won't even load on a near-recent firefox (maybe it's the ad-blocking)

--> Took another look on the plugin's page, and near the bottom there's a "Trouble installing?" section, there's a "Download (this plugin) using Extension Manager >" link, where the actual plugin can be downlaoded, so FINALLY got it downloaded. And avoided the "Adobe Creative Cloud desktop application".
BUT, it may require another program/plugin, the actual "Extension manager CC" to install it. It's supposed to be here: Adobe Extension Manager CC.
From GIMP's help on plugins it looks like GIMP's plugins are plain scripts or compile-able programs, probably more than a little different from plain PhotoShop plugins. And my Linux's file doesn't even know what the plugin is, aside from data. With a hex editor it looks almost completely random, as if it were encrypted or something... maybe it is, with all the trouble it took just to download it, and Adobe wanting it's own program to hold my hand while using it.
I did try Tor Lillqvist's program "PSPI is a GIMP plug-in that runs 3rd-party Photoshop plug-in filters", but using Linux & WINE didn't work out for me (psp.exe.so segfault), and I'm not holding my breath that the Adobe Extension Manager CC would work any better.
At that point, I'm giving up. But at least I think I found the problem - missing the "PixelSquid Photoshop plugin". If you're using Windows you should have better luck, since on Linux it's the windows & WINE programs that are giving me trouble. So on Windows the PSPI plugin for GIMP should work, and then you can try using the PixelSquid plugin. And the "Adobe Extension Manager CC" program (plugin?) should work on Windows too...
Comment: As soon as I saw this,"At that point, I'm giving up...". i got to this.. & I was like...I just laughed least I know it wasent me and i wasent goign nuts! And you are right it is hidden. *sigh* I do have a Win8.1 comp was trying to follow on Nixxy to my windows what you said... and it didn't work there either.   it got close, It turned black instead of white... lol.  But goign through all those steps... I owe you a beer man! Cause I certainly wouldn't have dont what you did. Not thought of it.  Though I cant believe you got farther than i ever did a PICTURE SHOWED UP!!!
Comment: Well, I don't mind not be able to use the files, just kinda disappointing is all.  Oh well, I still appreciate you giving me info that I would never have even thought of and the help you have given me... so you have been a HUGE HELP throughout all this! Thank you so much!  And your patience as well!  I appreciate it a lot.  Hope you have a great day.
Comment: Getting the flat image to appear was actually the *easy* part, and it does work with a plain GIMP (version 2.8.10). I may take another look at the "GIMP use photoshop plugins" problem since that sounds useful no matter what, I'll update if I find out anything. If the answer's useful or "good enough" (or the only one) you could click the check-mark beside it to select it as "correct", and maybe the up arrow to "vote up" it (may need 15 rep first)
Comment: Ok, I actually found a PSD file that works, I guess the PSD from PSq are different in coding? Like the above maybe file encrypted to a point, prob to only work with PS? So the PSD do work perse in GIMP. This PSD is working Both on Nixxy, and Kaitlyn. Both PC's same setup/pic layers etc:  http://i.imgur.com/kSeVKJW.png ~197MB PSD 130layers, so it is possible to open, just not with the PSq files is all. So you are not getting confused, or anything it is supposed to work, but it isnt period. I shouldnt need any other plugins since it is native to the program itself.
Comment: Sorry just realized after re reading this, Nixxy is my Linux Desktop, and Kaitlyn is my Windows PC, I call them by their names,  it is natural to me... My bad for any confusion I caused you...and anyone else what I call my electronics. Heck even my wife gets confused sometimes so my apologies, especially with my Tablets and cellphones, lol makes it even worse but we aint going there.

How do I properly load a PSD in GIMP?


No API token was configured - When starting graylog-sidecar

Question: I got ELK working to search for logs using Kibana and I am attempting to have Graylog working as well. I found that logstash need to have added the logstash-output-gelf to convert the messages to GELF format, so I installed and restarted the service:
[root@dev-graylog bin]# ./logstash-plugin install logstash-output-gelf
Validating logstash-output-gelf
Installing logstash-output-gelf
Installation successful

Then, in the client side where I need to collect the logs, I have installed the graylog-sidecar in this way, filebeat is already installed:
wget https://github.com/Graylog2/collector-sidecar/releases/download/1.0.0/graylog-sidecar-1.0.0-1.x86_64.rpm
tar -vxzf graylog-sidecar-1.0.0-1.x86_64.rpm
sudo rpm -i graylog-sidecar-1.0.0-1.x86_64.rpm
sudo graylog-sidecar -service install
sudo systemctl start graylog-sidecar

I will use the same filebeat and logstash instances used by Kibana to setup graylog. The graylog interface is up and running on the port 9000, but when running the graylog-sidecar I am getting the error "No API token was configured". I have tried the different solutions given in similar issues related to Collector Sidecar. However, I have been able to spot the problem in Graylog Sidecar (new version).
Which configuration needs to be in place to get rid of this error?
The environment has the following characteristics:

CentOS Linux 7 (Core)
Java: 1.8.0_192
graylog-3.0.0-beta-beta.2.tgz
mongodb-linux-x86_64-rhel62-4.0.6-rc1.tgz
logstash-6.6.0.tar.gz
elasticsearch-6.6.0.tar.gz graylog-sidecar-1.0.0-1.x86_64.rpm
filebeat-6.6.0-linux-x86_64.tar.gz

When running sudo systemctl start graylog-sidecar, I am getting the following error:
[root@c1 sidecar]# sudo systemctl status graylog-sidecar
● graylog-sidecar.service - Wrapper service for Graylog controlled collector
   Loaded: loaded (/etc/systemd/system/graylog-sidecar.service; enabled; vendor preset: disabled)
   Active: activating (auto-restart) (Result: exit-code) since Wed 2019-02-20 14:21:46 PST; 1min 29s ago
  Process: 21640 ExecStart=/usr/bin/graylog-sidecar (code=exited, status=1/FAILURE)
 Main PID: 21640 (code=exited, status=1/FAILURE)

Feb 20 14:21:46 c1.local.com systemd[1]: graylog-sidecar.service: main process exited, code=exited, status=1/FAILURE
Feb 20 14:21:46 c1.local.com systemd[1]: Unit graylog-sidecar.service entered failed state.
Feb 20 14:21:46 c1.local.com systemd[1]: graylog-sidecar.service failed.

In the journal I can see the following:
Feb 20 14:23:46 c1.local.com systemd[1]: graylog-sidecar.service holdoff time over, scheduling restart.
Feb 20 14:23:46 c1.local.com systemd[1]: Stopped Wrapper service for Graylog controlled collector.
Feb 20 14:23:46 c1.local.com systemd[1]: Started Wrapper service for Graylog controlled collector.
Feb 20 14:23:46 c1.local.com graylog-sidecar[21651]: time="2019-02-20T14:23:46-08:00" level=fatal msg="No API token was configured."
Feb 20 14:23:46 c1.local.com systemd[1]: graylog-sidecar.service: main process exited, code=exited, status=1/FAILURE
Feb 20 14:23:46 c1.local.com systemd[1]: Unit graylog-sidecar.service entered failed state.
Feb 20 14:23:46 c1.local.com systemd[1]: graylog-sidecar.service failed.

On server, graylog.conf:
rest_listen_uri = http://172.28.128.3:9000/api/
web_listen_uri = https://172.28.128.3:9000/

On client, sidecar.yml:
# The URL to the Graylog server API.
server_url: "http://172.28.128.3:9000/api/"

# The API token to use to authenticate against the Graylog server API.
# This field is mandatory
server_api_token: ""

# The node ID of the sidecar. This can be a path to a file or an ID string.
# If set to a file and the file doesn't exist, the sidecar will generate an
# unique ID and writes it to the configured path.
#
# Example file path: "file:/etc/graylog/sidecar/node-id"
# Example ID string: "6033137e-d56b-47fc-9762-cd699c11a5a9"
#
# ATTENTION: Every sidecar instance needs a unique ID!
#
node_id: "graylog-collector-sidecar"

# The node name of the sidecar. If this is empty, the sidecar will use the
# hostname of the host it is running on.
#node_name: ""

# The update interval in secods. This configures how often the sidecar will
# contact the Graylog server for keep-alive and configuration update requests.
update_interval: 5

# This configures if the sidecar should skip the verification of TLS connections.
# Default: false
tls_skip_verify: true

# This enables/disables the transmission of detailed sidecar information like
# collector statues, metrics and log file lists. It can be disabled to reduce
# load on the Graylog server if needed. (disables some features in the server UI)
send_status: true

# A list of directories to scan for log files. The sidecar will scan each
# directory for log files and submits them to the server on each update.
#
# Example:
#     list_log_files:
#       - "/var/log/nginx"
#       - "/opt/app/logs"
#
# Default: empty list
list_log_files: []

# Directory where the sidecar stores internal data.
#cache_path: "/var/cache/graylog-sidecar"

# Directory where the sidecar stores logs for collectors and the sidecar itself.
log_path: "/var/log/graylog-sidecar"

# The maximum size of the log file before it gets rotated.
#log_rotate_max_file_size: "10MiB"

# The maximum number of old log files to retain.
#log_rotate_keep_files: 10

# Directory where the sidecar generates configurations for collectors.
#collector_configuration_directory: "/var/lib/graylog-sidecar/generated"

# A list of binaries which are allowed to be executed by the Sidecar. An empty list disables the whitelist feature.
# Wildcards can be used, for a full pattern description see https://golang.org/pkg/path/filepath/#Match
# Example:
#     collector_binaries_whitelist:
#       - "/usr/bin/filebeat"
#       - "/opt/collectors/*"
#
# Example disable whitelisting:
#     collector_binaries_whitelist: []
#
# Default:
# collector_binaries_whitelist:
#  - "/usr/bin/filebeat"
#  - "/usr/bin/packetbeat"
#  - "/usr/bin/metricbeat"
#  - "/usr/bin/heartbeat"
#  - "/usr/bin/auditbeat"
#  - "/usr/bin/journalbeat"
#  - "/usr/share/filebeat/bin/filebeat"
#  - "/usr/share/packetbeat/bin/packetbeat"
#  - "/usr/share/metricbeat/bin/metricbeat"
#  - "/usr/share/heartbeat/bin/heartbeat"
#  - "/usr/share/auditbeat/bin/auditbeat"
#  - "/usr/share/journalbeat/bin/journalbeat"
#  - "/usr/bin/nxlog"
#  - "/opt/nxlog/bin/nxlog"

On the client side, I am able to execute the following successfully:
 [root@c1 filebeat]# curl -i -H 'Accept: application/json' 'http://172.28.128.3:9000/api/?pretty=true'
    HTTP/1.1 200 OK
    X-Graylog-Node-ID: 95c1074c-268c-4996-83ac-8fffeaae901c
    X-Runtime-Microseconds: 21775
    Content-Type: application/json
    Date: Thu, 21 Feb 2019 07:08:08 GMT
    Content-Length: 260

    {
      "cluster_id" : "55dc5eb8-616b-4d37-af4d-572d9cb61a29",
      "node_id" : "95c1074c-268c-4996-83ac-8fffeaae901c",
      "version" : "3.0.0-beta.2+a5d9cc0",
      "tagline" : "Manage your logs in the dark and have lasers going and make it look like you're from space!"

How to solve the error "No API token was configured"?
Is this the best approach to have ELK and graylog working together?
Thanks for your help
Answer: I've just installed graylog-sidecar this morning and I've encountered same problem, but I find a solution (not so tested as I would like).
The API token needed in order to start graylog-sidecar should be got from Graylog website. You should go to System/Authentication and in "Users" part, you choose user related to sidecar. In th column "Actions", if you clicK in "More actions", you'll be able to edit tokens. You only need to write down a token name, create it and copy it. Then, you just paste this token in graylog-sidecar configuration (sidecar.yml -> server_api_token: "API_TOKEN") and start service.
At this point, I can tell you that not all users work fine because graylog-sidecar need permission to perform API queries.
I hope this answers your question about the error "No API token was configured".
About the second question, I cannot answer because I don't use Kibana and Logstash.


Can a bowler call batsman back if he takes his wicket?

Question: If a bowler takes the wicket of a batsman, then after that can the bowling side's captain or the bowler call the batsman back on the field to play again?
Answer: This is possible, and has indeed happened (at least) once in a Test match, where the India Captain,Gundappa Viswanath, recalled the England Wicketkeeper Bob Taylor.

...umpire Hanumantha Rao upheld an appeal against Taylor for a catch
  behind the wicket, off Kapil Dev. Taylor hesitated and protested at
  the decision. Viswanath, the Indian captain, who was fielding at first
  slip, was as certain as the batsman that there had been no contact and
  persuaded the umpire to rescind his verdict.

Viswanath was a successful batsman in the India side in the 1970s, but only captained two Test matches. His cricinfo profile suggests that this was typical of his manner:

He played the game in its true spirit: a century had little value to
  him if it didn't contribute to the team cause and he disputed an
  umpire¹s decision only once, recalling Bob Taylor in the Golden
  Jubilee match against England in 1979-80. It cost him the Test, one of
  only two where he led India, but to Vishy, it mattered more that the
  game should be played fair.
Answer: Yes, a captain can withdraw an appeal should he decide to. See Law 27 section 8. He must have the agreement of the relevant umpire, and it must take place immediately after the fall of wicket.
Answer: When we are consulting with cricketing history its reveal that the team captain can withdraw from the wicket.. He can overlap the umpire's decision.


Dimensions of Faraday shielding mesh

Question: Why should the spacings of the wires that constitute a Faraday cage be smaller than the wavelength of the radiation we wish to prevent from penenetrating inside the cage?
Answer: I think I've found it. According to the Babinet principle, the slot radiates the same way a metal sheet would radiate if it had the same dimensions as the slot. But with dimensions much smaller than a wavelength this radiation is very faint. Thus, the interior of the Faraday cage is protected.

Dimensions of Faraday shielding mesh


How player(sprite) in the phaser will opposite or reverse while going left and right?

Question: I am developing a game where my player has to look to see forward when I am pressing right arrow key. But how can I make it look reverse after pressing left arrow? I can create a sprite of reverse look but how can load that while pressing left and at the same time forward player should be destroyed?
Answer: Usually I set the sprite's scale.x to <code>-1</code> to flip it horizontally. You can see an example here: https://phaser.io/examples/v2/sprites/scale-a-sprite some of those sprites are scaled to negative values, and they appear mirrored.

Another approach is to flip the sprites in your assets. This has the added advantage of looking correct if the character is handed - if they were holding a gun, they won't be switching their gun hand depending on which direction they're facing. Phaser's platformer example does this, and has separate left and right animation frames:
Comment: I ran into some weird issues with setting X to -1.  I just mirrored my image to create "left-walk" animation.  thanks.
Answer: When your character is looking rightward, his width is positive. So, all you need to do is to invert proportionally his width.
Visual example:
This image's width is 779px

And this image's width is -779px

When reversing, also remember to add the X-axis by the width, so that the character's sprite doesn't "walk" behind the total units that the width of the sprite has


Is there any increase in legendary drop rate with the True Vault Hunter mode or the Vault Hunter's Relic?

Question: True Vault Hunter Mode
I heard it gives better and more loot, so does that mean legendary?
Vault Hunter's Relic
Says it increases rare drop rates, legendaries are rare, too... (heh)
Answer: Vault Hunter's Relic
It has a very minor effect on legendary drop rates, that you're probably better off using another relic. It only affects white (common) and non-white drop rates (and not legendary drop rates, specifically).
From this somethingawful.com forum post by user, gibbed:

So I just investigated the Vault Hunter Relic data.
It modifies two attributes:
GD_Balance.Weighting.GearDrops_RareWeightModifier: +0.05
GD_Balance.Weighting.GearDrops_CommonWeightModifier: -0.06
Let's set them to +100.00 and -100.00!

Net result: I have not seen a single white weapon drop, greens drop,
seen a few blues. Nothing else.
So, what I can gauge from this, is that it shifts a 5% of your chance
for whites into non-whites. Doesn't touch anything else. Very low
impact, perhaps bordering on useless.

True Vault Hunter Mode

Some of differences in True Vault Hunter Mode as opposed to Normal
mode are:
...

Better Loot: Due to the nature of difficulty increase and the fact the game becomes more difficult, in True Vault Hunter Mode there
is a higher chance of enemies dropping better loot and chest also will
contain better loot.
Better Loot more frequently: Enemies in True Vault Hunter Mode will be have a higher percentage chance of dropping better loot as
they have more health and are more difficult to defeat.

Source: Borderlands wiki, "True Vault Hunter Mode" article
Comment: There is also [a big crowdsourcing project](http://www.reddit.com/r/Borderlands/comments/18r7ip/crowd_sourcing_project_v3_legendary_drop_rate/) on Reddit, where guys keep track of drop rates. Many sets are non-representative (below 100 runs), and crowdsourcing is unreliable by itself, but the results are interesting.
Answer: In first run, the relic helps you get some greens. However, as your level closes in on 50, and due to exponential increases in level powers, the color of weaponry becomes less important compared the level of the weaponry.  IE: a level 53 white weapon is better than a green 52 weapon.  Also, the relic basically becomes worthless very early on when you come across better relics more suited to your character (cooldown times, more ammo, etc).  Much like the season passes, it was basically an enticement item to sucker folks into ordering/buying.  IE: the expectation of what it could due lured folks in more than what the item actually could do.  "We're offering a special loot bonus item if you preorder or get mechromancer kit!"  "ZOMG!  AMAZING!"  (use item...find out it's completely worthless). Like most games, it's a gimick item to sucker folks in while not really giving them anything special.
Answer: It makes a difference with the relic. When I didn't have it I rarely saw orange items; but now I have it I have more purple and orange gear than I know what to do with! It's a lot better if you have more players with the relic; so instead of 5% it's more like 10 or 20%. In any case an increase is an increase. I just think people are over thinking it.
Answer: Not always true if you go to a regular boss that usually drops white or green. It will make way better chances to get a rare or legendary weapon. In my opinion, you should go try my theory out because I'm still in regular mode with my 35 Krieg. If there is some boost after any thing like a better chance of yellow other than farming, tell me.


In the QS method of integer factoring, how does one know what number can be in the factor base?

Question: I'm not talking about the size of the factor base, but which primes are candidates (only half are). Isn't there some easy way to test a prime to see if it can be?
Answer: When using the quadratic sieve to factor $n$, the only primes you need in the factor base are the ones for which $n$ is a quadratic residue. Testing whether $n$ is a quadratic residue for a given prime modulus $p$ is easy (if $p$ is not too big) by using quadratic reciprocity and other properties of quadratic residues, which can be found in intro Number Theory texts.


Jobs RSS feed: limit result items

Question: I'm using the RSS feed URL https://stackoverflow.com/jobs/feed?q=wordpress but it's super slow as it seems to be downloading 1000 results. Is there a way to paginate or limit the returned results?
Comment: [no-repro] 40KB loaded in 665ms.
Comment: Please provide more information in your question itself.
Comment: @SamuelLiew how do you load it? If I pate it in the browser I get abut 100kb, which is not the same if I load it through an RSS reader or PHP. Then it loads 1000 items. In the browser only 10.
Comment: @SamuelLiew as the question states, I'm wondering if I can limit the results because it's slow on my end. I'm including the RSS feed URL I'm using. What more info can I provide? If someone comments they can't reproduce this (as in, the slowness), my question still seems valid? Please consider reopening.
Answer: Stack Overflow's Q&A feeds as well as Jobs RSS feeds do not support a pagesize parameter.

Jobs RSS feed: limit result items


How long does it take for the debuffs from Red's Wings to start?

Question: I've been on Terraria for about 2 months and I have came across a nice pair of wings- reds wings. I put them on and nothing happened, so I was wondering how long until the debuffs may start.
Comment: What do you mean by debuffs? None of the wings in Terraria give you a debuff (except the developer wings that can only be worn by a dev, they will kill anyone else) http://terraria.gamepedia.com/Wings
Comment: @DBS It looks like OP was referring to Red's Wings. The question was edited for clarity.
Answer: Actually, the wings don't affect players in the console, and in the mobile, so if you are using the wings on XBox, PS, iOS, etc., it doesn't give you effects, which means you can use them all you want.


From a Fundamentalist Church standpoint, what is its equivalent of a catechumen?

Question: From a Fundamentalist Church standpoint, what is its equivalent of a catechumen? In many denominations (Roman Catholic, Eastern Orthodox, Lutheran, Anglican, Episcopalian), there is a concept called a catechumen, who takes religious education course called a catechumenate, that is taught by a catechist. So, what is the equivalent of such a role in a Fundamentalist/Bible Church? How do Fundamentalist Christians deal with prospective Christians (i.e. teaching church history, official doctrine and practices, etc.)? For Fundamentalist Christians, does that include teaching prospective Christians about the Scopes trial?
Answer: "From a Fundamentalist Church standpoint, what is its equivalent of a catechumen?" In my experience in several Protestant churches, Sunday School is the place of catechumen for young ones. The parents drop off their children in age-appropriate classrooms and the children are taught Bible stories/lessons by teachers from a church-approved lesson plan.
The plan may include any mixture of Bible stories, memorization of verses, Q&A, singing, puppets, dress-up, skits and other lively interactions, all to help bring the Bible stories to life and help the children see the lesson is for them.
This takes place as the parents are edified by the pastor in the main sanctuary.
Comment: So, what about adult prospective Christians? Do they attend "Sunday school" too, or do they get their own special classroom where the catechist teaches them Fundamentalist doctrines, practices, interpretations, and controversies surrounding the Fundamentalist view of the world?
Comment: The link in my answer was actually to adult new member from Rick Warren.
Comment: @anonymous Some of the larger churches (1000s of people) may have classes for new believers, offered at irregular times during the year. Other large churches will invite the new person to a home fellowship to learn. Still others will leave it up to the people to speak one on one with the new convert.
Comment: Protestant churches tend to invite new adults to an "Inquirer's class."
Answer: I would make a distinction between "catechumen" classes and religious education classes in general, such as Sunday School for children and Adult education classes such as Bible study groups.  Regular bible studies for kids or adults are beneficial and continuous, with no proper end goal in sight other than ongoing growth in the grace and knowledge of the Lord Jesus while "catechumen" type classes have an end goal of either baptism, membership in a local church or denomination, or both.  Many fundamentalist churches hold "new member" classes which might be better titled "prospective member" classes.
I was saved quite apart from the educational programs of the Conservative Baptist Church I attended at the time.  When Scripture convinced me that baptism was my next step of obedience I approached the leadership of the Church and was instructed to do 2 things to make myself ready for Baptism:

Attend a "new members" class taught by the chief Deacon wherein the very basics of Christian belief (according to conservative Baptists) were gone over and baptism and church membership were explained.

Give my "testimony" before the board of deacons and the Pastor.

It was a confusing mix of "being made ready" for membership in the body of Christ, which thing I was certain had occurred at the very moment of my salvation when the Holy Spirit was given to me. And a water baptism which was insisted on as an outward sign of an inward reality, insisted on as not necessary for salvation, and insisted on as a pre-requisite of membership to the point of issuing a certificate of Baptism transferable as proof to other Churches should God call one away.
I came to understand such "catechumen" classes (at this Church, at least) as a worldly affectation.  In order to meet the criteria for a tax exempt status the church needed to maintain, among other things, a voting membership roll.  In order to have a valid membership roll there needed to be certain requirements in place so that these could be met and membership conferred.  The requirements were the new members class wherein it was "ensured" that the correct basic doctrine was at least assented to and water baptism.
I understand that this represents somewhat of a pessimistic view of the "rules and regulations" of many current Churches but I see no Biblical mandate to seek and maintain "tax exempt" status while also perceiving in such things a strong inroad of worldliness into what is a spiritual entity.
Answer: I can answer as to a nondenominational evangelical church, which may be what you are asking for.
Whereas many protestant and Catholic churches baptize infants and catechumize youth, nondenominational churches typically dedicate babies and then may hold a short, intensive class for baptism candidates as they reach an age of responsibility. The class may give an overview of the basics of doctrine. I know one church where the material is based on the pastor's modification of Rick Warren's 101 Material.
Even among pastors who may hold a Young Earth Creationist view, I haven't seen mentions of the Scope trial. Even among those who hold six-24h-days as a necessary teaching, the focus would be on believing God's word, not an opinion on a 19th century trial.
Comment: I thought mainline only referred to a specific type of American Protestant denominations. Catholics (Western and Eastern) baptize infants and instruct youths.
Comment: I should have correctly stated Orthodox Catholics, or Eastern Orthodox Christians, because the term "Eastern Catholics" can be misleading. I meant to refer to Eastern Orthodox Catholics, who also baptize infants and educate youths. I think "Eastern Christians" would be a fitting term for those Christians in the Eastern European, Mediterranean, and Near Eastern regions.
Comment: I'll use the right term, but my belief, at least in politics, is that mainline sometimes used to mean everything not evangelical.
Comment: Would that just be non-Evangelical Christian? I wonder if Methodists from the United Methodist Church would consider themselves Evangelical or Mainline. Maybe both. Now what? Maybe it's the distinction between high-church people and low-church people.
Comment: I don't think the "mainline" qualifier is useful here. Many presbyterian churches that are not a part of the "mainline presbyterian church" (the PCUSA) believe in infant baptism. I don't think Lutherans are considered "mainline" nor would the various forms of the reformed church (URC, CRC etc).
Comment: @waxeagle Wikipedia states otherwise: http://en.wikipedia.org/wiki/Mainline_Protestant
Answer: Right of Passage At a certain age (entering teen-age years, usually) several religions hold catechism classes, at the end of which the prospective members of a church or synagogue affirm their belief (allegiance) to the Church, and are baptized (or perform some other rite of passage). {At Jewish "confirmation" or Bar Mitzvah, the child becomes a Son of the Torah.}
In Fundamental Christian churches, the procedure is similar with some minor differences. Usually, there is a series of classes for prospective members to attend, and then the person is Baptized as a show of his/her public confession and confirmation of the Christian creeds (or local denomination beliefs).
The classes may be geared toward young people who were raised in the church, and who have "been raised Christian." Or the classes may be for adults who have, later in life, chosen to become disciples of Christ. In either case, the end result of the classes is to allow the people to be aware of the major doctrines of the Church and to affirm their belief in them.
Sometimes these classes are called New Convert Classes, or Belong Classes, or Basic Doctrine Classes. Whichever, they all perform the same task: ground the Christian in the Word, and encourage a Personal Walk with the Savior, who also wants to be their Shepherd.
These classes also introduce the prospective members to the Body, the Community of believers, where they can "get plugged in" and become a vital part of the Church of Christ. There they will receive fellowship, instruction, protection, guidance, charity...Christian love. But just as important, they will be part of the spiritual choir that gives God his due worship and eternal gratitude.
Addendum Confirmation or catechumen classes are not considered the time to delve into controversial topics. They basically deal with the doctrines that are fundamental to the Christian faith which are agreed upon by the majority of Evangelical (fundamental) Christians. There is plenty of occasion during the Christian walk to discuss topics of interest but do not infringe upon eternal verities.


If $\omega$ is primitive nth root of unity, then does $|\text{Gal}(\mathbb{Q}(\omega)/\mathbb{Q})| = n - 1$?

Question: Consider the polynomial $x^n - 1$, then a splitting field for $x^n- 1$ over $\mathbb{Q}$ is $Q(\omega)$ where $\omega$ is the nth primitive root of unity. If we look at the values we can send $\omega$ to that keeps the criteria that whatever we send it to is also an nth root of unity, then it seems that we can send
$$\omega \rightarrow \omega, \omega^2, \omega^3, ..., \omega^{n-1}$$
Because $(\omega^k)^n = 1$ where $k < n$. To me, it seems that this is perfectly valid and these are the only automorphisms for $\mathbb{Q}(\omega)$ that fix $\mathbb{Q}$, which implies that $|\text{Gal}(\mathbb{Q}(\omega)/\mathbb{Q})| = n - 1$, but I'm almost sure I'm wrong, because I know that
$$\text{Gal}(\mathbb{Q}(\omega)/\mathbb{Q}) \approx U(n)$$
And it is not necessary for $|U(n)| = n - 1$, so where am I going wrong?
Comment: When $n=2$, $\omega=-1$ and $1$ is also a second root of unity; is there an automorphism mapping $-1$ to $1$?
Comment: You've only listed $n-1$ maps though? $\omega$ cannot go to $1$, since the latter is rational.  A very useful case to study is $n=4$, where $\omega=i$.
Comment: When $n=4$, $\omega=i$, and $-1$ is also a fourth root of unity; is there an automorphism mapping $i$ to $-1$?
Comment: My apologies, I made a counting mistake, I have edited the question
Comment: @LordSharktheUnknown, I've thought about it for a while, and don't understand why can't there be an automorphism mapping $i$ to $-1$?
Comment: @LordSharktheUnknown, is it because it is necessary for an automorphism to map $-1$ to $-1$ since its in Q?
Comment: @q.Then If $ψ \colon ℚ(ω) → ℚ(ω)$ with $ψ(\mathrm i) = -1$, then $\mathrm i^2 = ψ^{-1}(-1)^2 = ψ^{-1}(1) = 1$.
Answer: You list the possible nontrivial group homomorphisms of $μ_n = \{ζ ∈ ℚ(ω); ζ^n = 1\}$. Of course, every field automorphism on $ℚ(ω)$ restricts to such a homomorphism, but that restriction is then an automorphism as well. So you  cannot send $ω$ to each of $ω, …, ω^{n-1}$, but only to those of the same order.
Comment: it sounds like $\phi$ needs to send $\omega$ to $\omega^k$, and $(k, n) = 1$?
Comment: @q.Then Yes, because $μ_n \cong ℤ/nℤ$ via $ω^k \leftrightarrow k$, and so the elements of order $n$ in $μ_n$ correspond to those $k=1, …, n$ with $(k,n) = 1$.