Organic and Referral Traffic mismatch on Google Analytics

Question: I am here once again. I have noticed that one of my client's website  Organic traffic and referral traffic data have mismatched on Google analytics. When I calculate daily organic data of last 7 day's data then total traffic is 1,933 but the Google analytics is showing 1,805 same as on referral traffic total data of last 7 days is 355 but the google analytics is showing 276. I do not understand why is the data showing mismatched? Please help me. Here is the screenshot below:
Comment: In what way are they mismatched? Mismatched compared to what? You're calculating from where? If it's from server log files, the disparity is probably due to filters used by Analytics (typically bots being excluded) or perhaps users with JavaScript disabled.
Comment: Thank you for your response. I basically calculate the data on daily basic and maintain an excel. For an example on daily basis traffic below:

1st Jan -  Organic traffic received : 295
2nd Jan - Organic traffic received : 223
3rd Jan - Organic traffic received : 273
4th Jan -Organic traffic received : 269
5th Jan - Organic traffic received : 287
6th - Organic traffic received : 313
7th Jan - Organic traffic received : 273

So If I calculate the total number of data of last 7 days then total traffic should be 1,933 but analytics is showing 1,805. I do not have any filter.
Comment: I do not create any filter on analytics. and that's my concern if daily data got right on analytics then why did total traffic got mismatched by Google analytics. It will be applied for referral traffic data as well.
Answer: You are comparing a daily running tally of users on the site, with the weekly total in Analytics.
The problem is, if a visitor comes to the site more than once during that week, you'll be counting them each time in the daily tally, and Analytics will only count them once for the week. As "Users" is literally "individual visitors during this period" (although that's based on Analytics best estimation, using devices and accounts, so it's not entirely foolproof).
As an example, let's say there are three people who have visited your site, Person A, Person B, and Person C.

Person A visits the site on Monday and Tuesday.
Person B visits the site only on Monday.
Person C visits the site only on Tuesday.

Looking at the Analytics data for just Monday or Tuesday, would both show two users, because two different users visited the site each day. But looking at the data for both Monday and Tuesday would show only three users, because only three different users visited the site over that period.
That is what accounts for the discrepancy you're seeing.
A better metric might be to look at sessions. Those are each unique and represent the sum of all visits to the site.
If you'd like to see a breakdown of daily users that does match with the weekly total, you can add "Day of the Month" as a secondary dimension to the weekly report. That will show you the totals with users returning during that period excluded from subsequent days. There are several "day" secondary dimensions, but in your case "day of the month" is going to give the clearest breakdown of data.
Comment: Here is the breakdown of organic traffic for last 7 days: (News users 1,544 + returning 396 = 1,940). Thank you for clarification.


how to enable ctrl-alt-Fn consoles

Question: I am used to ctrl-alt-Fn (say, ctrl-alt-F3) to get a terminal CLI console scrolling screen.  On 20.04 LTS (MATE Xwindow environment), the default ctrl-alt-F1 is the (dark pink) login screen, ctrl-alt-F2 is the Xwindow MATE screen, but the rest do not produce a login prompt but merely a dark "blank" screen.  How does one enable these other consoles with a login CLI (e.g., bash)?  Neither a web search engine search nor a Search on Ask Ubuntu has found the answer, possibly because I am not using the currently correct search target words.  Take care.  Stay safe.
Answer: The answer is in Enable Ctrl+Alt+F1 Virtual Consoles in GNOME (Ubuntu 17.04+)
The solution of modify /etc/systemd/logind.conf, uncomment NAutoVTs=6 and restart.
Also, check /etc/default/console-setup, the line: ACTIVE_CONSOLES="/dev/tty[1-6]"
works on 20.04 LTS, but a reboot is required -- a systemctl as further in the answer I found locks the GUI Xwindow screen, requiring a reboot, at least when I just tried it as root.
Comment: I also have Ubuntu 20.04, but the F1 and F2 consoles aren't made accessible with this, the first is an extra DM log in screen, and the second the graphical session opened by default. F7 is a blinking cursor.
F3-6 do work as expected however.

how to enable ctrl-alt-Fn consoles


Is the empty set included when determining cardinality?

Question: Suppose I gave you the collection of sets $\textit{L}=\{{S_1,S_2}\}, S_1 \neq S_2$. I would think that $|\textit{L}| = 2$ because the collection of sets $\textit{L}$ has only two distinct elements. However, the empty set $\emptyset$ is inherently in every collection of sets, no? So should $|\textit{L}|=3$ instead? Does the answer change when I explicitly state that the empty set is in $\textit{L}$? That is, $\textit{L}=\{\emptyset, S_1, S_2\}$.
Comment: The empty set is a subset, not necessarily an element, of any set. The cardinality of a (say, finite) set is the number of elements it contains.
Comment: No. The empty set is a *subset* of every set (and hence of $L$), but it is not an *element* of every set. And it's an *element* of $L$ (and hence counted towards $|L|$) if and only if $S_1=\varnothing$ or $S_2=\varnothing$.
Comment: @BrianM.Scott So does that mean the empty set is an element when I specified $\textit{L}=\{\emptyset, S_1, S_2\}$? And hence this L would have cardinality 3? Because is equivalent to me saying $\textit{L} = \{S_1, S_2, S_3\}, S_1 \neq S_2 \neq S_3, S_3 = \emptyset$, right?
Comment: If $L=\{\emptyset,S_1,S_2\}$, you've named three different things, yes? So $|L|=3$.
Comment: @Bryyo357: Yes, assuming that $S_\ne S_2$ and that $S_1$ and $S_2$ are non-empty, $|\{\varnothing,S_1,S_2\}|=3$.
Answer: The empty set is not inherently in every set. You are getting confused. The empty set is inherently a SUBSET of every set. There's a difference between subset and element. The set {$S_1,S_2$} has cardinality 2. The set {$S_1,S_2,\varnothing$} has cardinality 3 because it has 3 elements.
The empty set is a subset of both of these however: for if, x is in $\varnothing$, then x is in the set A, where A is ANY set. The reason is that it is impossible for x to be in the empty set, because the empty set is empty. Since the hypothesis is guaranteed false, the truth of the conclusion doesn't matter and thus any implication with this as a hypothesis is automatically true.


What is considered the risk free rate?

Question: I see some place reference the S&P 500 index (SPY) as the risk-free rate and other place reference the 10-year Treasury yield as the risk-free rate. Which one is the correct one?
Answer: I assume you want to use CAPM that ralates e.g. a single stock to "the market" (often take to be the S&P500). In this model you need a "risk free rate". I think you do not make a mistake if you take government bonds as the risk free rate. But do not simply use 10Y. The maturity should depend on the time index t in the Security Characteristic Line. If it is a quarterly index use the 3M government bond rate.
See this link for the equation I am refering to:
https://en.wikipedia.org/wiki/Security_characteristic_line

What is considered the risk free rate?


Javascript/jsLint: What to replace jQuery(this) with when using "use strict";

Question: When I validate the following code with jslint I get the following errors.
function displayMegaDropDown() {
"use strict";
var liMegaPosition, divMegaOffset;
liMegaPosition = jQuery(this).position();
divMegaOffset = { top: liMegaPosition.top + jQuery(this).height(), left: liMegaPosition.left };
jQuery(this).find("div").offset(divMegaOffset);

jQuery(this).addClass("hovering");
}

Problem at line 4 character 29: Strict violation.
 liMegaPosition = jQuery(this).position();

Problem at line 5 character 56: Strict violation.
divMegaOffset = { top: liMegaPosition.top + jQuery(this).height(), left: liM...

Problem at line 6 character 12: Strict violation.
jQuery(this).find("div").offset(divMegaOffset);

Problem at line 8 character 12: Strict violation.
jQuery(this).addClass("hovering");

I'm guessing that it's because of the use of jQuery(this) but I don't understand what to replace it with. Note that this is not because jQuery isn't declared as a global.
Comment: Read here: http://stackoverflow.com/questions/2500512/jslint-why-do-this-code-result-in-a-strict-violation-error-message
Comment: Here, I refactored your code a bit: http://jsfiddle.net/Kj3WR/1/
Comment: Thanks @sime-vidas. The linked question did help, sort of, but didn't explain why it was useful.
Answer: I think the problem is that you use this not inside of a method. The following code
/*global jQuery */
var myObj = {
    myNethod: function displayMegaDropDown() {
        "use strict";
        var ts = jQuery(this),
            liMegaPosition = ts.position(),
            divMegaOffset = {
                top: liMegaPosition.top + ts.height(),
                left: liMegaPosition.left
            };

        ts.find("div").offset(divMegaOffset);

        ts.addClass("hovering");
    }
};

or this one
/*global jQuery */
function displayMegaDropDown(t) {
    "use strict";
    var ts = jQuery(t),
        liMegaPosition = ts.position(),
        divMegaOffset = {
            top: liMegaPosition.top + ts.height(),
            left: liMegaPosition.left
        };

    ts.find("div").offset(divMegaOffset);

    ts.addClass("hovering");
}

will give you no errors or warnings.
UPDATED: One more version, which is very close to your original one, also has not errors or warnings:
/*global jQuery */
var displayMegaDropDown = function () {
    "use strict";
    var ts = jQuery(this),
        liMegaPosition = ts.position(),
        divMegaOffset = {
            top: liMegaPosition.top + ts.height(),
            left: liMegaPosition.left
        };

    ts.find("div").offset(divMegaOffset);

    ts.addClass("hovering");
};

UPDATED 2: I find the question interesting for understanding. So I look through ECMAScript standard . I find the following in the "Annex C (informative) The Strict Mode of ECMAScript" (see better in HTML version here):

If this is evaluated within strict mode code, then the this value is
  not coerced to an object. A this value of null or undefined is not
  converted to the global object and primitive values are not converted
  to wrapper objects. The this value passed via a function call
  (including calls made using Function.prototype.apply and
  Function.prototype.call) do not coerce the passed this value to an
  object (10.4.3, 11.1.1, 220.127.116.11, 220.127.116.11).

I suppose that it is the reason of the JSLint error.
Of cause if you would switch off the strict mode the code will have no more errors:
/*global jQuery */
/*jslint sloppy: true */
function displayMegaDropDown() {
    var ts = jQuery(this),
        liMegaPosition = ts.position(),
        divMegaOffset = {
            top: liMegaPosition.top + ts.height(),
            left: liMegaPosition.left
        };

    ts.find("div").offset(divMegaOffset);

    ts.addClass("hovering");
}

UPDATED 3: It seems that impossibility of the usage of this in the function statement and the possibility of the usage of this in the function expression seems suspected for many people. Today I received one more comment about this. So I created very simple demo
/*jslint devel: true */
(function () {
    'use strict';
    function test() {
        alert(this);
    }

    test();
}());

You can test it here that in IE9 the demo display alert with the text "[object Window]" and on the current versions of Chrome and Firefox you will see "undefined".
So the problem with the usage of this in function statement is not "a jslint thing". It's real problem which you should take in considerations during development of your JavaScript programs.
I personally prefer to use function expression and almost never use more function statements. I think that the people who come from another program languages (like me too) try at the beginning to use the same construction which was good in your favorite languages. Only later one finds out that definition of variables in block is bad (there are no block level scope in JavaScript) and that function statements is not always the best choice too.
Comment: +1 for providing alternatives that appease jsLint, which I'm certain is what OP was after. In response to your inquiry under my answer, I honestly don't spend too much time wondering why jsLint does what it does because I never use it. But with regard to the part of the spec you referenced, it still isn't a *"strict violation"* as jsLint claims. I suppose if jsLint can't tell what the value of `this` will be, it could complain that you may be passing `undefined` to `jQuery()` via `this` when in strict mode, but it's still a stretch to call it a violation. The odd thing is with your first...
Comment: ...update where you just changed the function declaration to an expression. There's no effective difference in the code being analyzed, yet it fixed the "issue". That just seems weird to me. I certainly would not take the approach of removing the `"use strict";` declarative. I think all code should be evaluated in strict mode if at all possible. IMO, strict mode should pretty well supplant the useful parts of jsLint. Anyway, good answer. :)
Comment: @ChrisFrancis: Nevertheless I see not so many possibilities. If one writes plugin and one needs to call a callback somewhere deep in the code, which the user of the plugin provides as parameters, one have to use `usercallback.call(mainObject, parameters)` to set additionally `this` context which could be helpful for the user. The user should just use `var usercallback = function ()` or anonymous style of declaration of the callback to be able to use information from `this`. The same problems exist internally in long code. So I 'll continue to use the way independent from the Douglas' opinion.
Comment: @ChrisFrancis: I understand as so: `var MyClass = function () { this.myProperty = "smomething"; };` **must work** because of such kind of defining of the constructor of the new object (new class definition). One can use `var myVar = new MyClass();` to define the instance of the class which call the constructor. The question is only *why* Strict Mode of ECMAScript decided explicitly remove the `this` support. I think that one wished to be able to define the function which has no relation to any object.
Comment: My suspicion is that complaining about the use of `this` in top level functions is a jslint thing, not a strict mode thing.
Comment: @SeanMcMillan: NO, it isn't. I wrote "**UPDATED 3**" part of my answer specially to answer on your comment.
Comment: @Oleg:But it's legitimate javascript to use `this` in a function statement. Foolish, sure. Probably not what you want, sure. worth warning about in a lint program, sure. But not an actual error. If it was, then the javascript interpreter would throw an "invalid use of `this` in a function statement" exception. And it's just as broken in a function expression, it's just that jslint can't tell legit uses from broken uses inside a function expression. Changing from a statement to an expression silences jslint, but does not improve your code any.
Comment: @patrick dw: Thanks for your comments. I included the example, where the strict mode was off, only to verify that the error message of JSLint exists really only because of the usage strict mode. I personally use "use strict" always. I use also JSLint permanently to find small errors in my code. I find JSLint very helpful, but find only some of errors in style of coding not good (like about "i++" in `for (i=0; i<l; i++)`). I asked about your opinion mostly because I am not sure that I interpret the referenced fragment of the ECMAScript specification correctly. I know English not good enough.:-)
Comment: After a pile of research I can now see that both @patrick-dw and oleg are correct but oleg's answer appeases jslint. If js calls a method normally, in sloppy mode, then this refers to the global object (the window in a browser). In strict mode this is disabled as oleg pointed out. However, one can call the function with call or apply in order to set this, and event handlers will also set this. For my code, the hoverIntent plugin was calling apply to set this to the element to which the event applied. oleg's update solves the problem but patrick-dw is correct that there is no difference.
Comment: @Sarge: I am glad that I could help you.
Comment: I'm late to the party, but if anyone can explain why a function expression allows "this", but not a function declaration, I'd be pretty interested... :)
Comment: Ah ok, thanks! So yeah, because a function expression is syntactically identical to a valid constructor, it must be allowed. That seems like an inherent 'bug' in the Javascript API to me - converting a function declaration to an expression allows you to 'get around' the strict mode violation, without actually changing the context `this` is evaluated in...
Comment: @ChrisFrancis: Exactly! Last time I used to use `var MyClass = function () {}` version of definition of the functions because I like to be able to define some context information in `this`. By the way if you would look through my post [here](https://github.com/douglascrockford/JSLint/issues/107) you would find what Douglas Crockford think about this: "Your code is horrible. I wish JSLint rejected all of that". I take it easy and stay at my opinion. :-)
Answer: There is no strict mode violation in your code. If there was, you'd get an Error of some sort.
Comment: Your opinion about my answer would be interesting for me.
Comment: Responded under your answer. :)
Answer: By native javascript, this will be undefined in strict mode if the function contains it is not invoked either:

as a method of an object
by Function.call or Function.apply
as a constructor

That's the reason jshint is complaining about it.
However, if the function is being used as a event handler for jQuery, jQuery will force the $(this) as the jQuery object of the DOM that fires the event.
To prove this, open the console of this page and run the following code.
(function(){
    "use strict";
    function event_handler() {
        $(this).css('background','red');
    }

    $('#content').on('click', 'table', event_handler);
})();

Click any question or answer of this page and you would see the background becomes red.
Answer: Much easier!
Just use ev.currentTarget instead of this. It is the same as you can test with ===
function event_handler(ev) {
    //var $el = $(this); // jshint - error
    var $el = $(ev.currentTarget); // is exactly the same as above
}


Secure resources from being extracted?

Question: I have a jar file with a resources folder, and I have converted it to EXE using Launch4J.
How can I protect my resources from being extracted using winzip/winrar ?
Comment: You don't. You can add some trivial obfuscations to discourage script kiddies, but you aren't going to stop anyone determined.
Comment: but obfuscations will not modify anything in the resources.Right now one can just right click and extract all the resources. I just to want to prevent that.
Answer: The only real protection is to not deliver the resources!
As long as you give the resources out of your hand they can be extracted. It may be difficult but it is possible to extract them.
The most secure way would be to store the resources on a server and access them in a remote way. But also then if the resource is on the client computer it is possible to extract them from memory.
Answer: The only real option you have here is to store the resources as encrypted data and decrypt them prior to loading in java. You could store the encrypted data as a byte array, and use some kind of xor encryption.
This is NOT secure, and you should NOT store any important keys, passwords, or credentials in any resource files.
Answer: I know few ways to prevent resources extraction/reading:

Encrypt your resources and dynamically decrypt them in runtime without writing temp files.

Load the resources from the Internet (require Internet connection).

Corrupt the CRC32 of the resources files, this will make WinZip or WinRAR unable to extract your resources.

Set \u0000 (\x0) as a file name prefix. The NUL terminator will  make WinZip or WinRAR unable to extract files (and also read file names).

However, none of these increases security. Resources will be able to get decrypted or extracted, these are only "simple tricks" to prevent standard reading / extraction. But people with enough knowledge will be able to bypass them and fix the files.

Secure resources from being extracted?


Usage of named parameters

Question: Sorry, if duplicate.
I'm reading CLR via C#. Chapter "Parameters" starts with the explanation of optional and named parameters.
So, can you give some example where using of named parameters has some benefits, or is it just the matter of style or habit? Do you personally use named parameters?
Answer: Named parameters are very useful when combined with optional parameters in C# 4.  This allows you to avoid providing a lot of method overloads, and instead just have a single one.
For example, instead of having 5 versions of a method, you can provide one method with multiple optional parameters, then call it as:
this.Foo("required argument", bar: 42);

This can simplify an API (one method instead of many), and still provide the same flexibility, without requiring the user to type in every argument.  Without this, you'd either need many overloads, or have to provide all of the default values.
Answer: Besides being used with optional parameters, named parameters are sometimes useful to make code more readable.
For example:
DrawLine(10, 10, 25, 16);
If you're not familiar with this (fictional) DrawLine method, but you know the box needs to be a little taller, you'd have to look up the method to determine which parameter to change. (Is it "Left, Top, Right, Bottom" or "Top, Left, Bottom, Right" or "Top, Height, Left, Width" etc.)
But:
DrawLine(left: 10, top: 10, width: 25, height: 16);

This makes clear exactly what is intended and which parameter to adjust.
Answer: Suppose you have 5 optional boolean parameters, and you only want to pass in one of them.
Using named parameters lets you do that without any ambiguities.
Answer: Named parameters is very much related with default values for parameters (optional) such as:
void Foo(int i = 10)

And is very good for several purposes as other answers have described already.
In my opinion (and I guess it is why we have had to rely on overloaded constructors until now) is to cut corners. In many cases some constructor can be more efficient if only a subset of another constructor is specified. Ex:
//Without optional parameters
public MyObj()
{
    this.result = 3628800; //Factorial 10 - pretty fast
}

public MyObj(int n)
{
    this.result = factorial(n);
}

//With optional parameters but same results for any number of n
public MyObj(int n = 10)
{
    this.result = factorial(n); //A lot slower when we just need the result for 10
}

//Usage
new MyObj(); //Fast with constructor overloading - slower with optional parameters

This is of cause a stupid example but the idea is very important. I know Anders H. (co-author of C#) had this as an argument for not introducing optional parameters. But I guess most programmers will use the appropriate method when performance, readability etc. is emphasized in a project :)
It should also be noted that the newer initializer...
var foo = new Foo(...)
{
    SomeProperty1 = something,
    SomeProperty2 = something
}

...can be an good alternative to the named parameter style in many cases.
Answer: I had a need of them a few days ago ...
I had to give a full object parameter by parameter to a function and those were like 20 paramters, so i used named parameters for better understanding.

Usage of named parameters


When looking to get your first book published, do you turn in a mostly finished manuscript or a completely finished one?

Question: I understand this is a stupid question. I understand the answer should be obvious! I'm new to the writing scene, however, and I would like to know the proper process of going about it.
Comment: Nope, you can't.
Answer: You must completely finish your manuscript, and be ready for it to be published as-is. There may be some changes requested, they may fix things, but don't submit something you think needs work. Submit a completely finished story.
To understand why, understand the industry. Authors are NOT in short supply! Agents and publishers have to turn down 95% of what they read, the vast majority of stuff they get is flawed. If you are an agent, how do you get through twenty manuscripts from first-timers to find the one you MIGHT be willing to read more of? The only efficient way to do that is to reject things quickly and permanently the minute you detect bad writing. You also reject anything that is described as a "work in progress", because if you want to represent it, you want it done RIGHT NOW, not in three months or a year or never.
These people won't coddle you or mentor you, and a newbie writer is not in the power position. They don't want to babysit you, or nurture you. Their ideal scenario is to find a completed work they can read from start to finish without cringing, with a satisfying ending, that they can start representing tomorrow.
They make their decisions harshly and efficiently, first on your query letter, then on your first chapter or 30 pages or whatever, then on the full manuscript. Finish the whole thing, to the point you can read it cover to cover without cringing yourself, or feeling like something sucks.
Then write your query. Query about six agents at a time. This way if you get any constructive rejections, you can address their criticisms before the next round of queries. Don't blast a hundred agents with your first or ANY query! You can't query them again (unless they offer that.) Most agents will filter out repeated queries.
This way if there is something wrong with your story or writing or query letter, you can try to address that and you have more agents to try. You can iterate several times this way. There are plenty of online sites for finding agents, my approach is to find about thirty that might be interested in my book, and then try them six at a time. Follow their rules for submission; if they ask for ten pages, give them ten, not eleven. If they ask for the first chapter, give them that. If they ask for 30 pages, don't give them 31 pages to "finish the scene".
Prepare yourself emotionally for 100% rejection, but also be ready to send the full manuscript on request.
Answer: You do what the submission guidelines say you should do.
ALWAYS find out what is wanted.  Some publishers want a 50 page extract, some want it all.  They often want their own standards for layout too, so be prepared to alter it as needed.
But, as said above.  Never, ever, never, submit work that is not the very best you can produce.  And I'd never submit anything which I did not have completed finished, even if I'm only sending an extract.


Is there a way to enable command prompts 'quick edit' mode from the command line?

Question: Tired of having to right click and go to properties and enable quick edit. Is there a command I can run? a reg key I can modify from the cmd?
Windows 10
Comment: In order to get to CMD properties in windows you have to open CMD and right click on the bar at the top of the window.
Comment: The setting should stick all by itself if you go to the cmd properties dialog.  You shouldn't need a registry hack.  I just tested this myself and it sticks to whatever I last left it at.
Comment: @SeñorCMasMas This is for work. I do help desk and we have over 200k machines we support. location 1 might have it but tomorrow ill need to remote into location 45000 and that wont be enabled there.
Answer: There is a regkey in:
Computer\HKEY_CURRENT_USER\Console
There should be (or create it) a value QuickEdit of type DWORD, you can set it to 1.
Found it on: https://stackoverflow.com/a/9929239/2100126
Answer: Already answered here, update "QuickMode" setting in Windows Registry:
reg add HKCU\Console /v QuickEdit /t REG_DWORD /d 0 /f

However it will not affect currently opened window. But you can reopen a window:
:: Get QuickEdit Mode setting from Windows Registry
FOR /F "usebackq tokens=3*" %%A IN (`REG QUERY "HKCU\Console" /v QuickEdit`) DO (
  set quickEditSetting=%%A %%B
)

if %quickEditSetting%==0x1 (
  :: Disable QuickEdit Mode
  reg add HKCU\Console /v QuickEdit /t REG_DWORD /d 0 /f

  :: Open script in a new Command Prompt window
  start "" "%~dpnx0" %* && exit
)

... script logic here ...
exit

Additional info about HKEY_CURRENT_USER\Console Registry configuration - https://renenyffenegger.ch/notes/Windows/registry/tree/HKEY_CURRENT_USER/console/index


Is it legal for restaurants to not pay their courier the tips we pay them?

Question: Is it legal for restaurants to not pay their courier the tips we pay them? I used SkipTheDishes and paid 15% in tip and the driver told me that the tip is given to the restaurant and not to him, which I didn't believe at all, but then the app said that the restaurant is managing its own delivery, so I wondered if there was a legal loophole that allow restaurants to not give the tip you intended to give the courier and fill their own pockets? Can SkipTheDishes or the restaurants doing this be sued?
Comment: What is SkipTheDishes?
Answer: We need to know your jurisdiction, as special local laws may apply. The general answer for the United States follows.
It's routine for restaurants to pool tips for on-site employees, so that the waiters share with busboys and other less-visible personnel. Until recently, Federal law allowed the owner to be able to keep for himself tips that brought the waiter's salary over the standard minimum wage. (The Federal minimum wage for tipped employees is much lower, $2.13/hour.) Some states prohibited this, and it's no longer permitted. So the driver's tip might be shared with other workers, but not with the owners.
Perhaps tip delivery drivers in cash?
Comment: Additionally, if someone is being paid tip minimum wage and they do not make at least the difference between tip and minimum wage, the restruant must pay minimum wage.
Answer: australia
Yes
Tipping in Australia is purely voluntary and is given for exceptional service - not adequate service. The minimum wage in Australia is currently $18.93/hr (June 2019), however, restaurant workers with any experience earn more than this.
Tipping is not directly dealt with in employment law anywhere in Australia so how tips are dealt with is purely a matter between the business and its employees - the customer has nothing to do with it. Of course, the customer can ask and modify their tipping behaviour in response to the answer.
At common law, an employee is an agent of their employer and is responsible for accounting for all earnings to their employer. Various establishments have differing arrangements, some may pool all tips and divide them among all employees or just front of house employees, some may allow each employee to keep their own tips and some businesses may keep them for themselves. As far as the Australian Tax Office (ATO) is concerned, tips are assessable income (i.e. taxed) in the hands of whoever gets them.


How to "see" discontinuity of second derivative from graph of function

Question: Suppose we have a real function $ f: \mathbb{R} \to \mathbb{R}$ that is two times differentiable and we draw its graph $\{(x,f(x)), x \in \mathbb{R} \} $. We know, for example, that when the first derivative is not continuous at a point we then have an "corner" in the graph. How about a discontinuity of $f''(x)$ at a point $x_0$ though? Can we spot that just by drawing the graph of $f(x)$ -not drawing the graph of the first derivative and noticing it has an "corner" at $x_0$, that's cheating. What about discontinuities of higher derivatives, which will of course be way harder to "see"?
Comment: It's likely that you actually have something else that you are thinking of and not what you ask. For example, you might be thinking that $|x|$ has discontinuous derivative, but that is not true. Actually, $|x|$ has no derivative at $0$ at all. Could you name from top of your head a differentiable function on whole $\mathbb R$, but it's derivative not continuous? What you probably have in mind is $n$ times differentiable, but not $n+1$ times.
Comment: Defined but discontinuous is not as easy to find as it might seem. The problem is that derivatives, even though not necessarily continuous, still have intermediate value property, so functions with jump discontinuities are not derivatives. Classic example of differentiable function with discontinuous derivative is $x^2\sin(1/x)$ for $x>0$, and $0$ otherwise. Plot it and tell me if you can spot that the derivative is discontinuous :)
Comment: @CarstenS Sure, but if I remember correctly, cubic splines have jumps in the third derivative and the junction points
Comment: Yeah I might have mistakenly (?) said discontinuous at a point meaning either undefined (which is what the answers cover) or defined but discontinuous (so any examples on this?).
Comment: I don't think you can see it, but you can feel it. The second derivative is acceleration, or force. If you're cruising down the freeway and then step on the gas (maybe you're passing someone), your distance ($f(t)$) and speed ($f^\prime(x)$) are both continuous, but your acceleration ($f^{\prime\prime}(x)$) just had a jump discontinuity.
Comment: @CarstenS Aren't cubic splines $C^2$?
Comment: @martini you are right, I miscounted, thanks.
Answer: Seeing the second derivative by eye is rather impossible as the examples in the other answers show. Nonetheless there is a good way to visualize the second derivative as curvature, which gives a good way to see the discontinuities if some additional visual aids are available.
Whereas the first derivative describes the slope of the line that best approximates the graph, the second derivative describes the curvature of the best approximating circle. The best approximating circle to the graph of $f:\mathbb{R}\to\mathbb{R}$ at a point $x$ is the circle tangent to $(x,f(x))$ with radius equal to $((1+f'(x)^2)^{3/2})/\left\vert f''(x) \right\vert$. This leaves exactly two possible circles, and the sign of $f''(x)$ determines which is the correct one. That is, whether the circle should be above ($f''(x)>0$) or below ($f''(x)<0$) the graph. Note that the case when $f''(x)=0$ corresponds to a circle with "infinite" radius, i.e., just a line.
As a demonstration, consider the difference between some of the functions mentioned before. For $x\mapsto x^3$, the second derivative is continuous, and the best approximating circle varies in a continuous manner ("continuous" here needs to be interpreted with care, since the radius passes through the degenerate $\infty$-case when it switches sign)

For $x\mapsto \begin{cases}x^2,&x>0\\-x^2,&x\leq 0\end{cases}$ the best approximating circle has a visible discontinuity at $x=0$, where the circle abruptly hops from one side to the other.

The pictures above were made with Sage. The code used to create the second one is below to play around with:
<code>def tangent_circle(f,x0,df=None):
    if df is None:
        df = f.derivative(x)
    r = (1+df(x=x0)^2)^(3/2)/df.derivative(x)(x=x0)
    tang = df(x=x0)
    unitnormal = vector(SR,(-tang,1))/sqrt(1+tang^2)
    c = vector(SR,(x0,f(x0)))+unitnormal*r
    return c,r

def plot_curvatures(f,df=None,plotrange=(-1.2,1.2),xran=(-1,1),framenum=50):
    fplot = plot(f,(x,plotrange[0],plotrange[1]),aspect_ratio=1,color="black")
    xmin = xran[0]
    xmax = xran[1]
    pts = [xmin+(xmax-xmin)*(k/(framenum-1)) for k in range(framenum)]
    return [fplot+circle((x0,f(x0)),0.03,fill=True,color="blue")+circle(*tangent_circle(f,x0,df),color="blue") for x0 in pts]

f = lambda x: x^2 if x>0 else -x^2
df = 2*abs(x)
frames = plot_curvatures(f,df)
animate(frames,xmin=-1.5,xmax=1.5,ymin=-1,ymax=1)
</code>
Comment: +1 lovely picture
Comment: Great figures. Did you make them yourself? [otherwise, please cite the source! Thanks]
Comment: Lines for first derivative, circles for second derivative, is there an analogue for the third derivative?
Comment: @surb we're talking about a point (0D) on a curve (zeroth derivative), which get's inflated to a line (1D) for the first derivative and to a circle (2D) for the second derivative. A sphere (3D) for the third derivative seems only logical to me. Think of it like pulling the sphere through the plane which results in changing circles on the plane. The faster the circles change, the smaller the sphere.
Comment: @DonQuiKong yeah, it is just a representation, however both the line and circle seem kind of the "aesthetically unique way to go" for approximating a curve to match the first and second derivative, respectively. It would be nice to formalise this in such a way that every order gives rise to a unique approximation, but I'm pretty sure they wouldn't be closed loops of any sort. And a sphere would not even be a better approximation to third order.
Comment: "a good way to see the discontinuities if some additional visual aids are available." If additional visual aids are permitted, I would just draw a graph of the second derivative. After all, you have to compute that to obtain the curvature in the first place.
Comment: @Surb spheres? Hard to draw though
Comment: @DonQuiKong ok... I didn't expect such an answer. It feels counter-intuitive to call for a three dimensional object. Furthermore, I'm having a hard time imagining the additional information given by the tangent sphere instead of the tangent circle on a curve contained in a plane.
Comment: @DonQuiKong I see, and this somewhat makes sense when thinking at higher-order Fréchet derivatives which are linear maps, bilinear maps, trilinear maps, etc.
Comment: @Surb there might be a way to use ovals too, after all those would add another dimension too, but it beats me how to do that specifically. It's just a representation after all, so anything might be fine (colors, dotted circles, you name it), but spheres (to me) seem most "right".
Comment: @DonQuiKong that doesn't seem to make sense. The circle is a one-dimensional manifold, like the line, they just have different global topology.
Comment: Actually how did you obtain the expression $((1+f'(x))^{3/2})/f''(x)$?
Comment: @leftaroundabout the slope of the line is described by one parameter, the curvature of the circle is described by two parameters, the slope and the slopes slope. The slope of an oval-ish thingy or a sphere-ish thingy is described by (at least) another parameter (slopes slopes slope for the oval). As I already said, it's just a representation, so anything is fine. Instead of the circle for the second derivative, something else could have been used too. For me, sphere seems sensible for the next dimension because changing sphere sizes represent the third dimensions along the graph nicely.
Comment: @leftaroundabout let's just agree that we have different opinions of the "aesthetically unique way to go". For me, that's the sphere there.
Answer: Whether or not you can "see" this is in some sense a question about the acuity of human vision. I think the answer is "no". If you graph the function
$$
g(x) = \int_0^x |t|dt
$$
you will see the usual parabola in the right half plane and its negative in the left half plane. They meet at the origin with derivative $0$. The derivative of this function is $|x|$, whose derivative is undefined at $0$. The second derivative is $-1$ on the left and $1$ on the right, undefined at the origin.
Plot that and see if you can see the second derivative. Unless you draw it really carefully and know what you are looking for the graph will look like that of $x^3$, which is quite respectable.
Comment: FWIW, $g(x)=\frac12 x|x|$.
Comment: +1, I was just about to write this example.
Comment: Also FWIW, $2g(x)$ is the second function in Eero Hakavuori's answer, whereas $x \mapsto x^3$ is his first, and he shows how to see the different behaviour of their second derivatives at $0$.
Answer: Assuming your graph is made from reflective material, you can see discontinuous second derivatives in the reflection. For example, if you stand at $(0,-1)$ and look upwards at the graph of $f(x)=\max\{x,0\}$ the reflection will have a discontinuity at the point of nondifferentiability of $f$, namely $(0,0)$, even though $f$ is continuous there. Similarly, if you look at a diffferentiable graph that is differentiable but not twice differentiable, the reflection will not be differentiable.
Answer: Some years ago I crammed my adult body into a rather small car of a child's ride called The Wild Mouse. It was a "roller coaster" with no perceptible vertical drops as it went in a helical fashion on a path that consisted of alternating line segments and quarter circles. Children could be delighted at a transition between line and circle because the path has a discontinuity in its second derivative at each transition.
The car essentially moved at a constant speed, so on the straight segments the car was not accelerating, and there was "no" force on the car. However, a particle moving at constant speed in a circular path has constant non-zero acceleration pointing toward the circle's center, so the car, and child, experiences a force toward the circle center. The children could feel the discontinuity in the second derivative of the car's path.
Railroad engineers have known about this abrupt change in force since before the mid 19th century, and used curves with spiral characteristics, now called "transition curves." Such curves are used by railroad and highway designers to provide smoother rides for their customers.
Answer: Not sure if there is a "picture rigorous" way of checking, but there are subtle clues that could indicate it's possible.
For instance, if you know the first derivative $f'$ has a "corner" at $x=a$, then the graph of $f$ has to be monotonically increasing/decreasing around $x=a$. Furthermore, this indicates a change in concavity has to be present. So places where you have

a change in concavity AND
don't change increasing/decreasing behavior (we allow derivative of zero here),

then it could happen at that point (in terms of limiting down the choice of possibilities).  Take for instance the antiderivative of $|x|$.

Obviously this isn't saying this is always true (see $x^3$ for instance). Just that if you want to narrow your focus to potential points, do this trick.
Please let me know if there is something I'm missing or wrong about.
Comment: The antiderivative of $2x+|x|$ is strictly increasing and strictly concave up everywhere, but still has the same problems.
Comment: So, what exactly do you see at that plot that would tell you there is no second derivative at $0$? Why don't you plot $x^3$ next to it and tell me the qualitative difference.
Comment: The question is how to spot it from the graph. With $|x|$ it's quite obvious where it isn't differentiable, and similarly for any continuous function not differentiable at some point. I wouldn't say you could see the same thing about second derivative just from the graph.
Comment: Not saying it occurs. Just that it is possible.


A question about pure state

Question: For every unit vector $x$ in a Hilbert space $H$,let $F_x$ be the linear functional on $\mathcal B(H)$ (bounded linear operators) defined by $F_x(T)=(Tx,x)$. Prove that each $F_x$ is pure state and $\mathcal B(H)$ has pure states which are not like this.
Comment: How are pure states defined in your textbook?
Comment: It is a extreme point of state space.
Answer: Here is another way to see that not all pure states on $B(H)$ are equal to some $F_x$ (the second part of your question). Recall the following theorem:

Theorem. Let $a$ be a positive element of a non-zero $C^*$-algebra $A$. Then there exists a pure state $\rho$ of $A$ such that $\lVert a \rVert = \rho(a)$.
Proof. See e.g. Gerard J. Murphy, $C^*$-algebras and operator theory, theorem 5.1.11.

Now assume that $H$ is infinite-dimensional and let $\{y_n\}_{n=1}^\infty$ be an orthonormal sequence in $H$. Let $T \in B(H)$ be the diagonal operator given by $y_n \mapsto \frac{n - 1}{n} y_n$ (and $z \mapsto 0$ if $\{z\} \perp \{y_n\}_{n=1}^\infty$). Note that $T$ is positive with $\lVert T \rVert = 1$, but it does not preserve the norm of any non-zero vector. We apply the above theorem to the positive operator $T^2$, so we find a pure state $\rho$ satisfying $\rho(T^2) = \lVert T^2\rVert = 1$. But for any unit vector $x\in H$ we have
$$ F_x(T^2) = \langle T^2x,x\rangle = \langle Tx,Tx\rangle = \lVert Tx\rVert^2 < 1, $$
since we established that $T$ does not preserve the norm of any non-zero vector. Consequently, $\rho$ is not of the form $F_x$.
Answer: Consider an orthonormal basis $\{x_j\}$ of $H$ with $x_1=x$, and consider $\{E_{kj}\}$ the corresponding matrix units (we don't really need matrix units, just the projection onto the span of $x$, but it might help understand). Assume that you can write $F_x=\alpha f + (1-\alpha)g$, for some $\alpha\in[0,1]$ and states $f,g$. Then, since $0\leq E_{11}\leq I$,
$$
1=\langle E_{11}x,x\rangle = F_x(E_{11})=\alpha f(E_{11}) + (1-\alpha) g(E_{11})\leq
\alpha+1-\alpha = 1.
$$
So $\alpha f(E_{11}) + (1-\alpha) g(E_{11})=1$. But as $f(E_{11})\leq1$, $g(E_{11})\leq1$, we conclude that $f(E_{11})=g(E_{11})=1$. In particular, $f(I-E_{11})=0$. Then, for any $T\in B(H)$,
$$
0\leq|f(T(I-E_{11}))|\leq f(T^*T)^{1/2} f((I-E_{11})^2)^{1/2}=f(T^*T)^{1/2}f(I-E_{11})^{1/2}=0.
$$
Thus $f(T)=f(T\,E_{11})$ for all $T$. Taking adjoints, $f(T)=f(E_{11}T)$. But then $f(T)=f(TE_{11})=f(E_{11}TE_{11})$. As $E_{11}TE_{11}=\langle Tx,x\rangle\,E_{11}=F_x(T)E_{11}$,
$$
f(T)=f(E_{11}TE_{11})=F_x(T)\,f(E_{11})=F_x(T).
$$
Similarly with $g$, so $F_x$ is an extreme point.
Edit: thanks to Matthew for noting that my argument in the last paragraph from the previous version was wrong. Here is the new argument.
Let $\pi_0:B(H)\to B(H)/K(H)$ be the quotient map onto the Calkin algebra $C(H)$. Let $\pi_1:C(H)\to B(K)$ be an irreducible representation of $C(H)$. Then
$$
\pi=\pi_1\circ\pi_0:B(H)\to B(K)
$$
is an irreducible representation. Using the correspondence between irreps and pure states, there exists a pure state $\varphi$ on $B(H)$ such that its GNS representation is unitarily equivalent to $\pi$. But this tells us that $\varphi(T)=0$ for all $T\in K(H)$, and so $\varphi$ cannot be a point state.
Comment: Nice answer!The matrix units is good!
Comment: In the final paragraph, I'm worried that to get all states, you'd want to take _weak$^*$_ limits in $\mathcal{B}(H)^*$, and that there is no reason why this should preserve normality?  Or did I make a mistake?
Comment: Looks like you are right, Matthew, thank you. I'll try to think about it later today.
Comment: It's fixed now. Thanks again, Matthew!
Answer: One can give a simple cardinality argument: let $H$ be a Hilbert space with an orthonormal basis $(e_i)_{i\in \Gamma}$. Let $\ell_\infty(\Gamma)$ act on $H$ via diagonal operators wrt to the chosen basis. Then $\ell_\infty=C(\beta \Gamma)$ has $2^{2^{|\Gamma|}}$ (Pospíšil) characters which correspond to points in $\beta \Gamma$. Characters (multiplicative functionals on commutative C*-algebras) are pure. Use Krein-Milman to extend them to pure states on $\mathscr{B}(H)$. Consequently, we have $2^{2^{|\Gamma|}}$ pure states on $\mathscr{B}(H)$ but only at most $2^{|\Gamma|}$ vectors in $H$ (and these correspond to vector states).
Comment: this is simple modulo very strong results
Comment: Norbert; one can get rid of Krein-Milman here, and also the fact that $|\beta \Gamma| = 2^{2^{|\Gamma|}}$ is not terribly difficult once you know how to construct big independent families in the power-set of $\Gamma$.
Comment: and what about $\ell_\infty=C(\beta\Gamma)$. Do you have a simple argument here?
Comment: Firstly, Hausdorff's proof is nice: http://math.stackexchange.com/questions/83526/the-set-of-ultrafilters-on-an-infinite-set/83540#83540

I used to know even simpler proof of the inequality $|\beta \mathbb{N}|>\mathfrak{c}$ (which is what we need). Give me some time to remind that myself.

A question about pure state


Supplying fmincon with Hessian

Question: I am trying to help fmincon to converge faster by supplying gradient vector and Hessian matrix. I am using interior-point algorithm and I realize that in such case, I have to supply Hessian using a call to another function which is assigned to HessFcn of my OPTIOINS. I also realize that the Hessian for fmincon is the second derivatives of the Lagrangian as described here in equation 14-1. I am supposed to use the following function definition to have access to my fitting parameters and lambda while calculating the hessian
hessian = hessianfcn(x, lambda)

From this point on I have some difficulties figuring out the procedure. Although my problem has linear constraints and upper and lower bounds, lambda structure is empty i.e. whenever I try to access it from hessianfcn, it returns:
lambda =
        eqnonlin: [0x1 double]
      ineqnonlin: [0x1 double]

Any idea how to fix this problem?
P.S. I am following the instructions given here which works until I deliberately replace the nonlinear constraint with some random linear constraints and then I will have the same problem again (empty lambda structure).
Answer: lambda is not a direct value, but a structure in which you can access many information. Matlab is telling you that there are 2 values currently in lambda. Choose what you need by
lambda.eqnonlin(1)
lambda.ineqnonlin(1)

Here is an example of using user-supplied hessian

Supplying fmincon with Hessian


ArcGIS: Least-Cost Path between points; Source Destinationissue

Question: I am trying to find the least-cost path between 2 points. The problem I am having is that if I use point A as source and point B as destination, I get a value, but when I do the opposite i.e., use point B as source and point A as destination I get another value for the least-cost path. I need to have the same distance whatever source or destination I am using; is that possible? Is there a way to ask ArcGIS to find the least-cost path that would result in the same distance whatever the source and destination as long as I am using the same two points? thanks
Comment: (1) Which functionality are you using?  CostDistance or PathDistance? (2) How different are the results?  (You can expect slight differences due to floating point roundoff error.)
Answer: If your points A and B are point features, there could be a snapping issue when (internally) converting to raster. It is safer to use a raster as input, making sure that the "snap raster"  is activated.
On the other hand, it is theoretically possible to have two (or more) "best path", so you would need to add additional constraint to chose your "preferred one".
Comment: In a costdistance context "shortest" is irrelevant, so in your original (now edited) answer I understood "shortest" in the sense of "least cost."  Although it is possible--indeed common--to have multiple least-cost paths, by definition they all have the *same* cost.
Comment: If two "shortest paths" returned by software have different lengths, then isn't the one with the longer length an error?
Comment: @whuber this is true for distance, but we are talking about cost weighted distance if I understand well. So you can have two best paths with different length, and the shortest is not necessarily the best. (e.g. swimming accross a river vs using the bridge a bit further)
Comment: Here you can find something about the possibility of mentioned many "best" paths http://gis.stackexchange.com/questions/178156/arcgis-cost-path-analysis-how-to-extract-the-area-covered-by-the-many-possible


Why is it at times impossible to get an answer?

Question: I've posted a problem twice, asking for help, and I've yet to have anyone respond? What gives?
Comment: Patience is a virtue.
Comment: How many questions have you answered?
Comment: @GregS: I don't think the number of answered question should be a factor in whether someone should receive help or not. Unless, of course, you're referring to accept rate. If responding to questions was based on how number of answers given by the user - newbies would never get any help!
Comment: @Saladin Akara: Neither one. I just think one should be aware that answering questions can be difficult. If one hasn't answered any  then one should understand that.
Comment: @GregS: Good point. I agree it can be difficult sometimes.
Comment: possible duplicate of [Why are my questions not attracting answers?](http://meta.stackexchange.com/questions/51076/why-are-my-questions-not-attracting-answers)
Answer: As @Saladin says in his comment, patience is a virtue, and getting a problem solved on SO for free is still a privilege, not a right. If you want guaranteed answers, hire somebody.
Also, the two questions you complain about are way too broad, and reek of "please debug my incredibly complex jQuery animation thingadongdong, that I copy&pasted from somewhere else, for me". It's little wonder nobody feels a calling to sort these out for you.
Try to split up the question in isolated steps that don't work, and can be illustrated with a small block of code, and put in one clear question each. Those are very likely to get answered much more readily and quickly.
Also, timing is surely also an issue. Weekends are relatively slow on SO. Chances of getting an answer will be best again Monday morning in the U.S. time zones. (A good question will however find an answer regardless whether it's a weekend or not.)
Comment: +1 for "thingadongdong"
Comment: I would change "Chances of getting an answer" to something like "Your chance of getting an answer in the first 10 minutes is higher". Since there are less questions, those that are asked on off-times get more attention. :D
Answer: Seriously?
Have you ever thought about the possibility that no one that saw your question was able to answer it? Have you thought about "not posting the same question twice"? (It often stops people from helping spammers). Take a look at your accept rate.. 39% isn't very encouraging to take a serious look into your question. And the quality of your posts as Pekka already mentioned.
Btw I have two unanswered questions, too. Maybe I start a bounty, you can do the same!
Answer: None.
Impossibility indicates 0% probability. Each time a question gets a view, there is a chance that it will be answered. There are no questions that go over two hours without getting a view. Every view gives the possibility of an answer, views are virtually guaranteed for any question. Therefore, there is no time that it is impossible to get an answer. There is nothing that gives.
Comment: +1 for a very exact answer :)


clicking on a library to import on arduino creates blank line in arduino sketch

Question: I have a sketch that I am trying tin use Time.h in or DateTime.h. I have imported the libraries and they show up in the list on libraries. when I click on ether of them they just ad a blank line to my sketch. if I try to add it myself like #include  then try to access part of the library I get an error telling me the item I am trying to access is not defined. I can see the Time and DateTime folders in the libraries folder. and can see them as a options in the import Library menu.
Please help.
Danny
Answer: Just remove library from
<code>Documents\Arduino\libraries\DateTime\
</code>
and copy lib manually from zip file.


Windows boot manager with UEFI not loading

Question: I had windows 10 preinstalled on my system with boot type UEFI mentioned in my lenovo ideal pad boot options. I dual booted with linux mint tara which worked fine with grub loader showing both the OS entries. Later on i decided to delete linux partition which happened to be the system FAT32 partion on which efi bootloader was installed i suppose . to get rid of grub i deleted the EFI dir from windows . Now i am not able to boot into windows as it is on a boot loop keeps saying System BootOrder not found. reSet to default. Help !
Comment: What is the manufacturer/model of your BIOS? Do you have access to the BIOS settings?
Comment: yes i do have access to BIOS settings. Boot is set to UEFI even ,legacy support option dint work cuz hdd is gpt so no mbr. on reinstalling linux grub is showing up windows bootloader which is booting to wimdows fine. but when i remove ubuntu entry from EFI partition boot option it goes back to same problem. All i want to convey here is that UEFI loads grub well but not windows bootmanager alone.
Answer: The \EFI folder contained subfolders for both the Mint GRUB2 bootloader and the Windows bootloader – and you deleted both. To reinstall the Windows bootloader, use bcdboot:

Boot from the Windows 10 install CD or USB. Make sure you boot it in UEFI mode (the firmware might have two very similar boot choices).
Choose the "recovery console" option. (I don't remember what the menu item is called, exactly, but ShiftF10 should open it anyway.)
Use dir c:\, dir d:\, etc. to find your main Windows partition (with the \WINDOWS folder).
Once you know the correct drive, run bcdboot c:\windows (replace c: with the correct letter).
Comment: thanks for the answer but tried the option already but no luck . C :\  is the drive letter for me , what i have learned so far from my research on the topic . the EFI looks for the system partition with FAT32 fs for the bootloader which is D:\ in my case where linux resided previously and EFI entries as well. Now that i have run bcdboot i have EFI on C: and D: as well with boot and Microsoft/Boot sub folder and both have bootmgr.efi in it but still somehow EFI firmware is not able to load it. I have Hiren's BootCD win10 live USB with bootice and easybcd
Comment: if you know how to tweak with this please let me know


Correlation between fixed effect and random effect in mixed model

Question: I'm interested to study weather conditions on species diversity. To this end, I used a mixed model, where Julian-day, temperature, and precipitations are the fixed effects, while the month is used as a random effect. My question is: Is it a problem to use a random effect that is correlated with one of the variables in fixed term?
Answer: Random effects terms are used to account for correlations in grouped/clustered data. When you include a random effect for the grouping factor month, then you postulate that species diversity measurements in the same month are correlated. The fixed effects are used to specify the mean of your outcome variable (i.e., species diversity).
When you put month as a grouping factor it is not treated as an ordered factor. Hence, if you have that month is January, February, March, and April, you could recode it to banana, apple, orange, and grape, and you would get the same results.
Comment: @Alaa the grouping variable is a factor for which you can put different random effects, e.g., intercept, slope, etc.
Comment: Thanks a lot @Dimitris Rizopoulos it is really helpful. So the random effect should be factor with different levels not continuous variable, Am I right?
Comment: Correct, @Alaa. You could theoretically have a random intercept with 5 levels, 20, 100, or 1000. A random slope could be estimated on a continuous variable or a 0/1 binary variable.
Comment: Thanks @Dimitris Rizopoulos it helps
Comment: thanks @Erik Ruzek. it helps


How can add Thumbnail image in Drupal 7 site?

Question: I have set an image style as a thumbnail, but it doesn't render as my thumbnail style.  Instead, it is showing the original size of image.  How can I solve this problem.
Answer: You can edit the content type and configure in the manage display fields. Go to admin/structure/types/manage/article/display considering article is a content type.Replace 'article' with what every node type you have and change the image fields display options as shown in the screen shot.
Comment: Thanks dinesh ,but i have already set image style to thumbnail and its not working ,then i tried for medium and large image style same Problem ,But when i add it to my custom image style ,its working fine .what would be problem with default image styles?
Comment: You can edit the default styles admin/config/media/image-styles/edit/thumbnail and see for actual change. If not try to clear cache or see dblogs for any warnings.
Comment: Although this is not usually the case for image styles, you can also try to clear your website's cache.

Another thing that you can consider doing is checking the folder permissions and see if any images are stored within your `/sites/default/files/styles/`. There might be some configuration mishap.
Comment: Thanks Dinesh and Prof Elm ,I have set 755 permission to styles and i checked out actual  change of thumbnail image style,also cleared cache but still getting original image instead of thumbnail..i have install media module in my site .Is it making any conflict with image styles?
Answer: change image format from 'mange display'.

Navigate to the Content types page (Administer > Structure > Content types).
In the table, locate the row that contains your content type and click the manage display link.
Specify the "thumbnail" format.
Click Save.


EC2 load balancer route traffic to specific instance based on source ip address

Question: I have an AWS EC2 application load balancer with a corresponding backend target group. Is it possible to send traffic to a particular EC2 instance if the source IP matches a given ip address, otherwise send to the default other EC2 instances? Basically I am looking to feature test some code, but only send a small subnet of known ip traffic to that instance with the new code.
Answer: Typically the best way to do Canary deployment on AWS is using Route53 weighted routing. However AFAIK that's not sticky, so you can't guarantee the same users will go to the new server each time.
A bit of reading suggests this solution is probably best. You:

Create a new autoscaling instance
add the new instance(s) to the load balancer, making sure they have effective health checks
make sure sticky sessions are enabled on the ALB

I think that will give you canary deployments, with the ability to roll back fairly easily, though not instantly. If you have a small number of instances you may have a fairly large fraction of your traffic going to the new version.
You could always install Nginx, HAProxy or similar and put that in the mix, though that adds complexity.


How to remove NoData areas from modis 09 data?

Question: I have mosaicked modis09 rasters that have areas of NoData values displayed in black, I have used every option possible from raster con and set null conditions in raster calculator to setting the NoData values to 0 in properties but the black spaces would not erase. Is there any other option available in ArcGIS 10.2 for solving this issue?
Comment: Are you trying to convert `nodata` values into zero? So zero does not exist as a value in the rest of the data? What do you intend to do when its converted to zero?
Comment: Actually I am trying to remove the areas with NoDATA so that I get rasters free of the black spaces and then mosaic them for further processing.
Comment: @Mashal hi,could you find a way fix your problem?
Comment: Hi, I tried to process the same product in several ways according to my own findings and suggestions given but could not get a clean mosaic without the NoData values. I found an alternate product MOD09GQ which did not need any conversion from swath to grid and had the same level of atmospheric correction. I used that dataset for my analysis and the results were satisfactory.
Answer: In ArcMap, NoData values default to transparent. However, you have the option to change them to something else. Are you sure they are truly NoData values and not something else? One way to test it to set the NoData values to a particular color (see screenshot). You can also use the ID button and click on the areas that are black to determine the actual value being used.
If you are willing and able to share the file, I will take a look, too. Sometimes it is easier to work with the actual data to determine what is amiss.
Good luck.
Comment: Thank you, I have tried this method but it did not remove the unwanted areas, I have uploaded the image, if you could please take a look and give your opinion.
Answer: If there is nodata then how can you remove them, there is nothing to remove? Even if you convert them to a zero value you just end up with the large blank areas coded as zero rather than nodata (which is a legitimate value). If you have created a mosaic dataset as opposed to mosaicking a set of rasters into a new single raster dataset then you may have overlapping rasters where nodata cells obscure underlying rasters and you end up with what you are showing. If this is the case you can set the draw order of the mosaic dataset by changing the property Default Mosaic Operator to MAX. Areas with overlap will show the maximum cell value from all overlapping cells.
Comment: +1 MAX overlap rule is the way to go (i.e. assuming the NoData value is <=0).
Answer: I think it is better to use raster calculator to remove this Nodata pixels
first you should know the smallest pixel value say it will be Zero
then you will use a 'Con' function as follows:
Con("B1" >= 0,"B1")
assuming that your band name is 'B1'
Comment: Thank you, I will give this method another try and then inform about the result.
Answer: Looking at the image above, it appears that the images you mosaicked were "collared." Did you do the initial mosaic? If so, it may be easier to re-mosaic them in a manner to ensure there is no "collar." There's actually a couple of ways to do this, but specifying the appropriate method is often dependent on the source data.
On that note, did you download these data. If so, if you could send me a link, I will take a look and try to come up with the best way to do this.
Comment: I downloaded the data from Laadsweb, here is the link https://ladsweb.nascom.nasa.gov/data/search.html.


Vintage derailleur identification

Question: I have a vintage Shimano derailleur that I'm trying to identify, specifically to figure out which jockey wheel set is compatible as mine badly need replacing. The derailleur is marked "Shimano SIS" but doesn't otherwise seem to have a model number or other identifier. As far as I know the bike is a custom build done in the mid-to-late 1980s. I don't necessarily need to know the derailleur model if for instance all derailleurs from that period use the same jockey wheels. I've found a few photos online that match my derailleur, but unfortunately not with an accompanying model number...
Comment: @DoNuT Road bike.
Comment: Road or mountainbike?
Answer: I think, by the period (85-89), speeds and the SIS label (indicating "Shimano Index Shifting"), you can narrow it down, it could be

Dura-Ace 7400 - 6/7/8-speed
600 EX - 6-speed
Ultegra 600 (6400) - 7-speed

6/7/8-speed are the same chain, so pulley designs could be universal.
See also: https://en.wikipedia.org/wiki/Shimano#Road_groupsets
Comment: Great, thanks a lot. Forgot to mention it's a 6-speed, so that narrows it down a bit more.
Answer: Mine seems to be the RD-L541-SS variant based on the catalogue page reproduced here. Apparently a MTB derailleur, despite being mounted on a road bike. But it was a custom build by the original owner, so who knows why they chose it...
Comment: Sure about the model number, though? RD-M531 gives me lots of results for a fairly modern late-2000s 9-speed Deore rear derailleur. Deore XT was Shimano's first MTB groupset but those were numbered M7xx from the start, for example the '87 6-speed group was M731....
Comment: @DoNuT I noticed the same. I think more accurately it's a L541, but see the catalogue page scan that I linked. Unless they misprinted the listing for the M531, then there's also a derailleur from the 80s with the same part number...
Comment: Looks legit, I'm actually surprised, Shimano are usually pretty strict with their numbering and there is continuity from the 80s to present day in most groupsets. I wonder if this is an original '88 [document](https://si.shimano.com/de/pdfs/ev/RD-M531-0806/EV-RD-M531-0806A.pdf) because West Germany didn't exist anymore when a "new" RD-M531 came out (in 2008). #27 and #31 would be the (legacy) part numbers for the pulleys, then. That could even be a [hint](https://www.google.com/search?q=shimano+%2B+%22563+9837%22) to the pulleys you need.

Vintage derailleur identification


Different Portrait layouts in android

Question: Initially I developed my application for phones only in portrait mode. But now, I want to shift that to tablets as well, but in portrait mode only. My question is, can we define different layouts for portrait mode for different screen sizes. It works on tablets but the UI is stretched. If yes, how..? If someone could give an example.
Answer: Yes you can define the same layout for different sized devices.
Assuming you have the layout folder already, you can create another one called 'layout-xlarge'.
In here, create an xml layout with the same name as the one in the layout folder. Now when you run the app, only 10" tablets (devices designated as having extra large screens) will use the 'layout-xlarge' folder.
All other smaller devices will use the 'layout' folder.
Your folder structure will look like so:
res/layout/my_layout.xml             // layout for normal screen size ("default")
res/layout-xlarge/my_layout.xml      // layout for extra large screen size

You can do the same for small and large screens, among others.
This is a rather brief description and you would do well to read this when you get a chance:
http://developer.android.com/guide/practices/screens_support.html
Answer: i think you have to create 3 layout in your resource folder and each one has same name xml file
that are

layout  (contaning a.xml, b.xml, c.xml)
layout-large (also contaning a.xml, b.xml, c.xml)
layout-small (also contaning a.xml, b.xml, c.xml)

check your application on different size of emulators like QVGA, HVGA, etc.
Answer: Yes you can develop define different layouts for portrait mode for different screen sizes
res/layout/my_layout.xml             // layout for normal screen size ("default")
res/layout-small/my_layout.xml       // layout for small screen size
res/layout-large/my_layout.xml       // layout for large screen size
res/layout-xlarge/my_layout.xml      // layout for extra large screen size
res/layout-xlarge-land/my_layout.xml // layout for extra large screen size for land scale

by default res/layout/my_layout.xml this means you are going to create my_layout for portrait mode.
just take care of folder hierarchy .

for more details

Different Portrait layouts in android


Can't change brightness

Question: I tryed ubuntu 14.04 and 15.10, but I can't change the brightness. It is always on maximum.
Comment: I try changing the xbacklight, max_brightness, íntall driver NVIDIA quadro...
Comment: If it is always at maximum, it is clearly driver issues. Please try my answer here: https://askubuntu.com/a/1254557/903123 if you have Nvidia Driver.
Answer: The simplest way is to use a program called xbacklight , open your terminal and type this
sudo apt-get install xbacklight

Brightness range can go upto 100 from 0 .
type this xbacklight -set 50 to set brightness to 50 from 100.
you can also increase and decrease the brightness from present value to specified level if you want to increase to 10% from current value of brightness then you can give this
xbacklight -inc 10

and to decrease 10% you can give this
xbacklight -dec 10

Comment: I've tried but nothing changed
Comment: What you did exactly ? What's the output ? any error messages ?
Comment: No error messages, but brightness no change  !
Answer: You can try to change grub configuration file. Open it
sudo nano /etc/default/grub

and go to the following line:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

Now, next step depend on your computer. Try to change the above line, with one of the following:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi_backlight=vendor"

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi_osi=Linux acpi_backlight=legacy"

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi_osi=Linux"

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi_osi="

Every time that you edit /eft/default/grub file you have to run the following command that will apply changes.
sudo update-grub

To see results you have to reboot your system.
If the previous solution doesn't change your situation, you can try to do 2 things:

update your kernel
use a workaround

Update your kernel to latest Ubuntu version
sudo apt-get update
sudo apt-get install linux-image-generic

Workaround
Make a script to increment your brightness and one to decrement and bind them to a shortcut. You can try to use mine that I'm using on my PC.
Brighness up:
#! /bin/bash

# get max brightness and actual brighness
MAX=`cat /sys/class/backlight/intel_backlight/max_brightness`
AC_BR=`cat /sys/class/backlight/intel_backlight/brightness`

# grow brightness of 5%
AC_BR=$((MAX / 100 * 5 + AC_BR))

# check if i can set new brightness
if (($AC_BR <= $MAX)); then
  echo $AC_BR > /sys/class/backlight/intel_backlight/brightness
fi

Brightness down:
#! /bin/bash

# get max brightness and actual brighness
MAX=`cat /sys/class/backlight/intel_backlight/max_brightness`
AC_BR=`cat /sys/class/backlight/intel_backlight/brightness`

# decrease brightness of 5%
AC_BR=$((AC_BR - MAX / 100 * 5))

# check if i can set new brightness
if (($AC_BR > 0)); then
  echo $AC_BR > /sys/class/backlight/intel_backlight/brightness
else
  echo 5
fi

Copy the two bash scripts in two different file and give them execution permission:
chmod +x <file_name>

Move two script into your local bin directory to let you access to them everywhere in terminal:
sudo mv <file_brightness_up> <file_brightness_down> /usr/local/bin

Now you are ready to bind the scripts with shortcut. From System Setting select Keyboard and then Shortcuts. Select from the list on the left Custom Shortcuts and press Add shortcut button (+). Insert something as name and <file_brightness_up> file name as command and save.
Then double click on right column and press your preferred shortcut.
Do the same for brightness down script.
To be sure that script works you have to change brightness file owner. So open /etc/rc.local file
sudo nano /etc/rc.local

and add the following line before exit 0:
chown <username>:<username> /sys/class/backlight/intel_backlight/brightness

Where  is your user name. Reboot your system to apply changes.
It should work because also your PC have an Intel graphic card. So you should get actual brightness value with:
cat /sys/class/backlight/intel_backlight/brightness

I hope this could help you.
Comment: In file  /sys/class/  have only acpi_video0 and nv_backlight, don't have intel_backlight !

Can't change brightness


How many spells per day and spells known does a level 30 Oracle have?

Question: How many spells can an Oracle use per day and learn at level 30 in Pathfinder?
Comment: Related: https://rpg.stackexchange.com/questions/50425/how-can-you-cast-a-spell-at-a-caster-level-much-higher-than-20-in-pathfinder/50428#50428
Answer: According to the vanilla rules, there is no such thing as a level 30 Oracle.
Pathfinder is supposed to handle PCs with levels between 1 and 20 and does that more-or-less well. The 20th level is supposed to already be the capstone of the possibilities of a class.
If you want to run over-the-top games with characters even more powerful, you can use mythic rules (it doesn't function like additional levels but gives you up to 10 "mythic ranks"). A spellcaster doesn't automatically gain new spell slots/spell known with more mythic ranks, but he can choose mythic features for that.
But there are optional rules you seem to be using.
You can also follow the previous recommendations (optional rules that existed before the mythic rules, for some reason they can be found in the favored class section). That said, either:

You can't have more than 20 levels in the same class, but you can multi-class past this 20th level. By following this rule, your 30th level Oracle still can't exist.

You can put more that 20 levels in the same class. In that case at each level you gain a certain number of spells known or of spell slots, depending on your choice:

A spellcaster's caster level continues to increase by one for each level beyond 20th level. Every odd-numbered level, a spellcaster gains access to a new level of spell one above his previous maximum level, gaining one spell slot in that new level. These spell slots can be used to prepare or cast spells adjusted by metamagic feats or any known spell of lower levels. Every even-numbered level, a spellcaster gains additional spell slots equal to the highest level spell he can currently cast. He can split these new slots any way he wants among the slots he currently has access to. [...]
Spellcasters who have a limited number of spells known (such as bards and sorcerers) can opt out of the benefits they gain (either a new level of spells or a number of spell slots) for that level and in exchange learn two more spells of any level they can currently cast.

That means if you never opt for the "bonus spell known" option, your level 30 Oracle:

will get one spell slot for each level up to 14th.

will get 60 "slot points" (assuming a nth level slot takes 1 "slot point"). For example he can have 60 more slots for 1st level spells, or one more slot for levels 10, 11, 12, 13 and 14)

won't know more spell than he knew at his 20th level

Alternatively he can use the "new spell learn option", up to 10 times (once per level), to learn 2 more spells, so a maximum of 20 more spell known.
It seems to me the "best choice" is probably to keep the additional spell slot when it unlocks you a new spell level, and forgo it for new spell known only when it doesn't. In that case you will end up with 9/5/5/4/4/4/3/3/3/3 spell known (+10 at the levels he wants) and infinite/6/6/6/6/6/6/6/6/6/1/1/1/1/1 spell slots (+ the bonus ones from your Charisma)
Comment: @ShadowKras: "Every even-numbered level, a spellcaster gains additional spell slots equal to the highest level spell he can currently cast. He can split these new slots any way he wants among the slots he currently has access to" -> basically at lvl 22 when you are able to cast 10th level spells you can gain 10 new slots for 1st level spells or 5 for 2nd level ones. This is detailed unambiguously in the part I skipped for concision but you can follow the link if you are not convinced. When you reach level 30 if you sum up all the slot you gained it makes 60.
Comment: Edited to change some of the numbers, I made a mistake calculating everything but it should be fixed.
Comment: Ah, 60 was my calculation aswell. I was about to post a second (third?) answer to fix that.


Unicode Characters in iOS App Name?

Question: I recently tried submitting my universal app "Blackout" to iTunes connect and, unsurprisingly, found that the app name had already been taken.  So I changed the name to "Blackout ☉☉" because the main character is a set of eyes in the dark.  I got a little popup warning saying that the unicode character "☉" is not allowed.  Does anyone know what characters are allowed?  Searching "flashlight" on the iOS app store yields a number of apps with names containing hearts and circular characters.  Maybe this is a recent change on Apple's end?  I searched the iOS developer documentation and could not find any clarification on this subject.
Answer: I've found that Apple only allows characters from certain Unicode blocks.
The "☉" symbol I wanted to use is from the Unicode "Miscellaneous Symbols" block (2600–26FF) which is not allowed.
I found a similar symbol "⊙" in the "Mathematical Operators" block (2200–22FF) which was allowed.
I'm not entirely sure which blocks are allowed and which blocks aren't but if you're facing a similar problem, the quickest way to find out is by entering your desired app name into iTunes Connect.
Answer: I have checked in iTunes Connect your problem solution here you can do that.. just enter it..
"Blackout ©" thats was accepted in iTunes Connect and those uni-code is only accepted in iTunes Connect which is UTF-8 Supported and i suggest to use Mozilla as well for setup app in iTunesConnect.
Any more information need just add comment i will help you out.

Unicode Characters in iOS App Name?


If I make an Unarmed Attack while using Rage of the Remorhaz, do I deal extra damage?

Question: So, for a gestalt campaign, using all books for D&D 3.5, I made a Psychic Warrior/Monk character. I just turned level 16, and I saw the power Rage of the Remorhaz.  If I make an unarmed attack while this power is in effect, do my attacks now deal the 4d6 fire damage?  It says that anyone attacking me with unarmed or natural attacks do, so I am under the impression that the opposite should also be true, but would love to confirm this before deciding on this power.
Answer: I would say no.
The text of the power is not explicit in this regard, but it is conspicuously explicit in another regard that is RELEVANT to determining this ruling.
The clauses:

"anything touching your
body takes 4d6 points of fire damage"
"Creatures striking you with natural
attacks or unarmed attacks are subject
to this damage as well"

Taken together, it is obvious that the authors of this feat felt that "creatures striking you" was not covered by "anything touch your body".  There is no practical difference between that and "you striking creatures", and thus, I believe that the authors would have explicitly called out that interaction, had that interaction been intended.
Answer: Unfortunately, an effect only does what it says it does
The description of the 6th-level psychic warrior power rage of the remorhaz [psychometabolism] (Complete Psionic 97) says, in part, that

Your skin pulses, generating a heat so intense that anything touching your body takes 4d6 points of fire damage. Creatures striking you with natural attacks or unarmed attacks are subject to this damage as well. Creatures striking with melee weapons do not take damage from your heat, but their weapons do take damage.

…And, sadly, that's pretty much the extent of the power.
The power neither causes everything the psychic warrior touches with his body to be dealt 4d6 points of fire damage nor causes the psychic warrior's own unarmed or natural attacks to deal an extra 4d6 points of fire damage.
For comparison, many spells and effects endanger foes that harm (or seek to harm) the user yet the user gains only minor benefits from such effects if no foes do—for example, the 1st-level Sor/Wiz spell babau slime [trans] (Spell Compendium 22), the 4th-level Sor/Wiz spell fire shield [evoc] (Player's Handbook 230-1), the 7th-level Sor/Wiz spell acid sheath [conj] (Spell Compendium 7), and the soulmeld mantle of flame (Magic of Incarnum 78) (although when bound to the shoulders chakra the mantle can be used offensively) are all based on foes striking (and, typically, also dealing damage) to the user in much the same way the rage power is. None of these similar effects allow the user to deal extra damage with the user's attacks, either—the effects don't say they do, so they don't.
This does make the rage of the remorhaz power as written pretty disappointing, though. I'd suggest that if you're seriously considering the power for your gestalt monk 16/psychic warrior 16 that you ask the DM to house rule the power to work like you want it to work. I can't know if in your campaign this would be balanced, but considering what you could have picked to play instead of a monk/psychic warrior, this—in the abstract, anyway—seems okay.
Comment: To be clear 'touching your body' here is differentiated from 'touched by your body'?  So you couldn't, for example, activate it while fighting atop a pile of paper to light the paper on fire as you're touching the paper, not the other way around, yes?
Comment: @thedarkwanderer Yeah, unless the pile  of paper beneath the user were animate and attacking, it should not be set alight. Honestly, I really don't know *how* the power works except that it does. That is, the power somehow—while leaving the user's belongings unharmed—harms attackers that use unarmed strikes and natural weapons or harms the melee weapons that the attackers use. It's quite the gamist power (like many damage shields), and it's probably best not to try to delve too deeply into the physics of it.
Comment: @HeyICanChan I disagree with your comment to thedakrwanderer. The power specifically says "anything touching your body" not "anything touched by your body".  The paper WOULD light on fire because the only thing preventing your own shorts from combusting is the line you missed in the power description: "You and your possessions are immune to your own heat (but you are not resistant or immune to heat from other sources)."  However, after reading the spells referenced, I see what you mean about they don't say they do, so they don't.
Comment: @Pethrax Fair enough, but, in my defense, I assumed the power's user wears shoes. That is, the power says, "Your skin pulses, generating a heat so intense that anything touching *your body* takes 4d6 points of fire damage" yet "[y]ou and your possessions are immune to your own heat" (emphasis mine). Even I'd probably allow a shoeless user of the power *rage* to set alight the papers beneath him (and maybe even tunnel very slowly), but I'd still be hesitant to allow the user to *weaponize* that.
Comment: @HeyICanChan Fair enough back at you. I personally was leaning towards no due to the not explicitly stated clause, but I didn't know if there were FAQ's or errata that I hadn't found that would have allowed weaponization, due to the wording "Your skin" and "anything touching your body" giving the possibility that your fists would count, as they are your skin, and part of your body, and when you punch someone, that someone is technically "touching your body".
Comment: @Pethrax The game tends to assume a difference between *a creature touching things* and *things touching the creature*. Otherwise, were a creature to, for instance, be [holding the charge of a touch spell](http://dndsrd.net/actionsInCombat.html#holding-the-charge) and attacked, the foe would set off the charge!


How to map different Java-Bean structures onto one another

Question: In our project we have to map one nested structures of beans onto another. (These are actually JAXB mapped Java-Representations of XML documents that, say, represent an incoming order document.) This has to be mapped onto the quite different order document structure of another system.
What are the options to do this? I would prefer something that fulfills the following requirements:

The mapping should alert me when the mapping of one field was not defined
The mapping should have some defaults, like mapping fields of equal names onto one another and providing standard mappings for, say, int to String and vice versa.
The mapping should be bidirectional.
One should be able to use code completion when defining the mapping.

A promising framework for this is Dozer, but it does not fulfill 1 and 4. Same with JBeanMapper. Just programming it in Java does 4 but not the other requirements; using XSLT fulfills perhaps 2 but nothing else. Do you have better ideas?
Answer: Another alternative is MapStruct which generates mapping code at build time, resulting in type-safe mappings which don't require any dependencies at runtime (Disclaimer: I'm the author of MapStruct).
Answer: When we've had this problem, we've ended up doing field mappings in Java in a utility class. It's a real hassle, especially when you have to map to several different web services and have to write mappings for each of them (some of which are a simple 2D map of named attributes rather than a hierarchy of objects, cries).
However in that way you do have the power to analyse the requirements of the target of the mapping to get the best quality mapping, setting defaults where data isn't set, and so on. You can throw a custom "UndefinedMappingException" in your mapper where you need to. And by not being a fluffy library that uses reflection and/or complex XML mapping configuration files, it's a darn sight faster.
I.e., this is the post arguing for "write it in Java".
Answer: I solved a similar issue with commons-beanutils.
My final goal was a big Java file which would build the data structure and the mapper created that file for me. This way, I could create test data from snapshots made while the program was running.
The mapper allowed to define the keys by which to sort the objects, the field to use to generate object names in the Java file and I used a map with "class:field" as the key. The value was an object implementing a simple "Mapping" interface (one method: toJava(Object instance, String field, Object value)).
My main problem was to compile 2MB+ Java files :)
Answer: Transmorph, EZMorph, Dozer, OTOM are some of them you could look at for Bean to Bean mapping.
I have used Dozer in the past and feel that it has grown quite stable over years.
Answer: Have a look at GeDA which uses byte code to create mapping classes during runtime, which makes it extremely fast http://genericdtoassembler.org/ . It would cover point 1-3. Regarding point 4 I would imagine it is an IDE thing so I do not think you will find any library that would facilitate that unless it has IDE plugins.
Answer: There is an interesting solution that might help you if you are mapping data structures that have many slightly different variants. For example if you are modelling business order structures for different business cases and product variants, and different variants require different combinations of the same attributes like adresses, account ids, configuration information for the products etc.
Thus, you have many structurally similar beans that contain different subsets of a number of attributes. If you do not want to write code for each individual variant, you could introduce a Java-interface that has all attributes that occur in these beans, and use java.lang.reflect.Proxy to construct proxy instances for the bean you want to map, and which returns null for getters the actual bean does not have / throws an exception if a non existent setter is called on the actual bean. In a manner of speaking, you inject an interface into those beans that has more methods than the bean itself.


Why is continuous space-time necessary for conservation laws?

Question: I'm aware of Noether's theorem and symmetries leading to conserved quantities.
Excuse me if this is a straightforward result in the underlying math but as a newb to the math, I want to ask, are infinitesimals absolutely necessary for translational invariance and a corresponding conserved quantity such as momentum? Why can't a discrete or grid space-time exhibit conservation laws?
Comment: Note that the anisotropy is probably the biggest issue. We observe angular momentum to be conserved, so how do you make a discrete grid isotropic?
Comment: That helped. Can we also show that energy too, is not conserved?
Comment: From what i understand, a non infinitesimal amount of motion cannot be curved, so any body moving around in circular/elliptical paths won't be stable and would either fall off its orbit or fall towards the center. Is that it?
Comment: Shouldn't it also follow that in a non continuous space-time, no matter how small the distance between two points is, we should, over time, observe bodies falling out of orbits, so theoretically an electron would fall out of its orbit without any external forces, given enough time?
Answer: I am a newbie to the math as well, but let's take one of the conservation  laws.
If a physical system behaves the same regardless of how it is oriented in space, its Lagrangian is rotationally symmetric: from this symmetry, Noether's theorem dictates that the angular momentum of the system be conserved, as a consequence of its laws of motion. The physical system itself need not be symmetric; a jagged asteroid tumbling in space conserves angular momentum despite its asymmetry. It is the laws of its motion that are symmetric.
I honestly don't know if this is a valid argument against your suggestion, because I have not got the math background,  but the very first line of Wikipedia's article on Noether's work says:
Noether's (first) theorem states that every differentiable symmetry of the action of a physical system has a corresponding conservation law.
That being the case, allied with the derivative with respect to time implied in the angular momentum example above then this, to my (very naive) understanding of the continuity of a function, would suggest a problem with modelling spacetime as a set of discrete points, rather than a differentiable continuum.
Comment: I think I get the point now. While it's impossible to model discrete points in space preserving angular momentum, we can make them sufficiently small and close together, so that deviations in angular momentum observed at each point are too little for measurement?
Comment: Well I know that there is evidence for  no discreteness at really small scales, from space probes, there are questions on this site regarding that. What you are describing sounds like a Wilson lattice idea from particle physics. And also a bit like loop quantum gravity. Personally I don't have a problem with discrete points, there is just no evidence for them......good question though . regards
Comment: Aye, I've read answers to similar questions. Ultimately they all boil down to the fact that it's continuous "as fast as we can tell ", if there is discreteness it has to be below the Planck scale, as a 2009 Fermi experiment falsified predictions of any discrete model larger than a scale that is well smaller than the Planck scale. However we could keep making claims that the effects only show up at even smaller scales than what we probed, and so on. Thus making these models unfalsifiable, in a sense.
Comment: But I intuitively feel like there must be some experiment that would show deviations from continuous models regardless of scale, if space-time were indeed, discrete
Comment: my intuition was right ;-)
http://physics.stackexchange.com/a/282877/128779
Comment: Hi weeky,  I came across this article, in the "Economist magazine!!", where rich physicists (worldwide, I think there might be up 20 of them), publish their findings. I hope spacetime is discrete, we need a fundamental new discovery.....http://www.economist.com/node/1606258
Comment: And this question is related to yours, just in case you don't see it. I am guessing, but in the simulation of two black holes, with limited computer power they might create a lattice : http://physics.stackexchange.com/questions/283555/discretizing-spacetime


What's the difference between a v$ view and its dba_ equivalent?

Question: What's the general difference between a v$ view and its dba_ equivalent? Take, for example, v$tablespace and dba_tablespaces.
Answer: The easiest way to think of it is:

DBA_ / USER_ / ALL_ views are built on the data dictionary - they're not available if the database is not mounted and opened.
V$ views tend to run against the instance, and therefore may be available if the database is not mounted, or is not mounted and opened, depending on the nature of the view.

Using your example:

V$TABLESPACE is a view on X$KCCTS, which is an internal memory structure.
DBA_TABLESPACES is a view on the data dictionary table SYS.TS$
Answer: Besides the differences that Adam Musch listed, there are a few more differences between dba_ views and v$ views that are worth mentioning since they are potential gotchas if you aren't aware of these differences:
1)  Most (but not quite all) v$ views aren't technically views at all, but are synonyms to v_$ views.  This is an important distinction since you can't grant/revoke permissions against synonyms:
sqlplus / as sysdba

grant select on v$tablespace to user1;
   SQL Error: ORA-02030: can only select from fixed tables/views

select table_name from dba_synonyms where synonym_name = 'V$TABLESPACE';
   TABLE_NAME
   -------------
   V_$TABLESPACE

grant select on V_$TABLESPACE to user1;
   grant succeeded.

2)  You can run flashback queries against dba_ views.  However, running flashback queries against v$ views returns current data (12.1 docs on Using Oracle Flashback Technology):

You cannot retrieve past data from a dynamic performance (V$) view. A
  query on such a view returns current data.
You can perform queries on past data in static data dictionary views,
  such as *_TABLES.

As Adam Musch pointed out, v$ views run directly against the instance whereas dba_ views run against the data dictionary.  Once you understand that, it makes sense why this limitation is in place.  Still though, I really wish flashback query against v$ views would return an error instead of silently not working as this gotcha can remain unnoticed for quite some time...
Answer: dba_views are static  and they are avaliable  once the db is open mode
only v$view are dynamic they are avaliable when database is mount stage
Comment: This differs a bit from the accepted answer. Are you able to point to a reference?


Body field in colorbox

Question: Is it possible to have body trimmed to lets say 150 chars with read more link, and when you click read more, full body field opens in colorbox ?
Answer: If you have Colorbox installed, you can install Colorbox Node & Overlay which will let you create a colorbox node link with a colorbox-node class (e.g. My Node).
In your theme's node preprocess function, you can add that class to the read more link:
/**
 * Implements hook_preprocess_node() in your theme's template.php
 */
function MYTHEME_preprocess_node(&$variables) {
  if ($variables['view_mode'] == 'teaser') {
    $variables['content']['links']['node']['#links']['node-readmore']['attributes']['class'] = 'colorbox-node';
  }
}

You'll need to adjust your theme's stylesheet rules to hide the non-body fields (and other styling as necessary), but it will work.
Comment: Thx Shawn, but its a bit to much for me.
Comment: I'm doubtful there's a turnkey solution for you. This solution requires 3 things: knowing how download/install 2 modules (one of which is built into D7 core), knowing how to modify your customize your theme's preprocess_node function in template.php (or creating a subtheme for that purpose), and alter your theme's stylesheet rules (i.e. editing style.css). Learn how to do those 3 tasks (they're fairly common) and revisit the solution later.
Comment: Would this work for all nodes created for particular content type automaticly after i do those modifications ?
Comment: This will work for any node displayed in teaser mode that has a read-more link at the end of it.

Body field in colorbox