How do the marriages that I bring about (through the relationship option) affect the game?

Question: I noticed that when I got Owain to join my entourage, he had the same hair color as my character. Are there other effects that come about by different marriages?
Answer: The characters in Fire Emblem: Awakening are divided into 1st generation and 2nd generation, aka. "parents" and "children".
Each child is bound to a female parent character (the mother). There are only two children that do not adhere to that rule: Lucina, daughter of Chrom, and Morgan, daughter of the male Avatar. You can only get the children if the mother (or father, in the case of Lucina and female Morgan) is married.
Children inherit a couple of attributes from their parents, according to Serenes Forest:

Base stats and growth rates are inherited, but these aren't very important in the long run. Weapons and items are not inherited, since the parents are still around.
Children characters inherit the sum of their parent's maximum stat modifiers, +1. If your Avatar pairs with a children character, Morgan does not receive the +1 to his/her modifiers.
The children inherit the last active Skill from each of their parents. This can include Skills from gender-specific classes (except Special Dance), so you can have Demoiselle on male children. Chrom's children are exceptions--his daughter(s) will always learn Aether and his son will always inherit Rightful King (even if Chrom hasn't learnt either Skill). Skill inheritance occurs at the moment you enter the mission required to recruit the child, so you've got plenty of time to play around with the parents' Skills.
In general, children inherit all the regular class options from both their parents (so a lot of classes if one of their parents is your Avatar), except classes exclusive to the opposite gender. If a class option cannot be inherited due to gender issues, that option will be replaced with another option more appropriate for their gender. Despite being a Special class, Villager can be inherited by male children and both Taguel and Manakete can be inherited by Morgan.
Classes and Skills obtained from DLC (this includes Skills learned by DLC classes) can not be inherited.

Additionally, a child will always inherit the father's hair color.
Anna, Say'ri, Tiki, Flavia, Emmeryn and Aversa do not have children, but can be paired up with the Avatar to produce Morgan. Children characters do not produce any offspring, except if paired up with the Avatar to produce Morgan.
Answer: I'm not positive what you mean by "other effects" but as far as children's look is concerned.
The child is based of the mother. For example, this means that Sumia will ALWAYS have Cynthia, regardless of the father. The possible exceptions are Chrom (who will always have Lucina and the mothers child) and Avatar, who if male can have Morgan and the mothers child.
The child's hair will be the color of the fathers. The one exception here is female Morgan (male Avatar's child) who will have her mothers hair.
Parents also affect the classes and stats of children, but that is a little more in depth. If you would like to read about it please visit this site and scroll down to the Awakening section.


We use both SOAP and REST endpoints for our WCF services. What will the ASP.NET Web API mean to us?

Question: On our services, we configure several endpoints, allowing us to publish the same interfaces to SOAP 1.1 and 1.2 clients and HTTP clients consuming either XML or JSON. Now that the WCF REST team has been merged into the ASP.NET team to create the Web API stuff, what will this mean for us in the future? Will it still be supported to expose WCF interfaces as XML/JSON services? Should we move the REST endpoints to the Web API framework? Will this be the last shift of the MS REST stack?
Comment: I got two great answers to my question. Both address the superiority of the new framework for implementing 'real' REST interfaces, both imply the impossibility to support SOAP interfaces on the new plaform. I accepted Stilgars answer, because it felt more useful to my specific situation.
Answer: Good question. I don't work for Microsoft and I don't have any inside information but my understanding is that WCF will be able to expose XML and JSON forever. In fact if you are merely exposing JSON or XML endpoints you are not doing REST. The real question is do you use the HTTP verbs (DELETE, PUT, POST, GET) as part of your API or you are simply exposing methods that are equivalent to your SOAP methods. If you are using the HTTP verbs it may be a good long-term strategy to migrate the REST part to WebAPI. If you are not then you can happily use WCF (go ahead tell your cusomers you are using REST for marketing reasons, to marketing people it's just a buzzword anyway).
If you are using the HTTP verbs it is not that hard to have both WCF and WebAPI. All you need to do is remove all logic from the service itself and expose it as a business layer methods. Then both kids of services can use these methods, call them in the appropriate way and shape the results.
Comment: :) You're completely right, what we do is not REST proper, but I don't know the correct term other than "exposing our service as XML and JSON". We don't use DELETE and PUT, so we might not have much reason to move over.
Comment: Then unless you want to do actual rest you not only have no reason to migrate but will have hard time migrating to WebAPI. If you want to do actual REST then by definition your endpoints will be different (i.e. you will NEED to have two implementations of the methods one for SOAP one for REST)
Answer: To answer this, you need to have a little history on the ASP.NET Web API.
Initially the ASP.NET Web API it was the WCF Web API, a project on Codeplex extending WCF to make it easier to support a REST-style service. WCF was entirely built on SOAP as its core messaging type, so using HTTP as anything other than a transport-layer protocol required a different approach, with a different set of attributes and generally didn't mesh well with the rest of the framework.
The WCF Web API was extending the WCF framework in all the ways required to support HTTP as an application-level transport mechanism. It was introducing request routing based on the resource URI, dynamic formatting according to the Accept headers and the other things which were previously missing from WCF.
However, it became clear during its development that these technologies already existed within .NET, in the MVC stack. Thus, the decision was made that rather than having two competing sets of technologies, they move the work over to the ASP.NET MVC team, and the ASP.NET Web API was born.

If you are doing a REST-style service, the ASP.NET Web API is much better suited to your needs than the WCF framework. The WCF team will not be progressing their support for the REST-style architecture; these features of the WCF framework are effectively subsumed by the Web API, where it finds a much more natural fit.
Should you re-write your services to use the new Web API? Well, the REST features of WCF aren't going to suddenly stop working. You should only consider the move if it gives you some features you're after (like dynamic content-format selection), or if you're looking to continually develop your API (as the Web API is significantly easier to use than WCF).


Tracking of spacecrafts of the Mercury project

Question: In the absence of any communication satellite in 1958, back in Mercury times, how did the tracking centers, which were spread world across, communicated with each other, passed on their data to the next tracking station, and thus kept a track of the spacecraft?
Answer: NASA report SP-6, chapter 2 describes the tracking network in detail. It provides this overview schematic explaining how the various stations communicated with each other:

(source: NASA SP-6, chapter 2, figure 2-8)
Communications were via the following channels:

Radio
Submarine cable
Land line

The submarine lines and land lines were direct-line links, used exclusively by NASA. It was a mix of leased existing lines and newly installed lines.
The NASA report "Historics of the Space Tracking And Data Acquisition Network (STADAN), the Manned Space Flight Network (MSFN), and the NASA Communications Network (NASCOM)", available here as PDF download (100MB), provides a ton of background information.
Comment: For the submarine lines, did NASA lease some capacity or some of the physical wires within a larger submarine cable, or were dedicated NASA cables laid across the bottom of the ocean for this application?
Comment: @uhoh I believe the answer is in [this massive report](https://ntrs.nasa.gov/citations/19750002909), but so far I have only found this remark on p100: "Requirements like this forced network
designers to lease or install many alternate, redundant communication links.", implying that there was a mix of leased existing lines and newly laid lines. Will search more when I have the time.
Comment: This covers a good portion of the globe, but there's a lot of longitude between London and Perth - was there a gap in communication when Mercury was on that side of the world?  Or was the orbit high enough that it could bridge that gap without losing connection?
Comment: @DarrelHoffman In the same chapter 2 of report SP-6 you can find a table of the tracking stations (the open circles). Between Londen and Perth there's CYI (Gran Canary Island), KNO (Kano, Nigeria), ZZB (Zanzibar, off the coast of Tanzania) and IOS (Indian Ocean Ship).
Comment: Ah, okay, so map not-to-scale I guess.  Now I'm curious about that Indian Ocean Ship - being mobile there's a wide area where it could've been stationed, or it could possibly even move to track with Mercury?  (Obviously it couldn't be fast enough to keep up with an orbiting vessel, but it could possibly extend the range a bit by following in the same direction?)


How to install mod_pagespeed on Apache Server on Mac?

Question: I'm trying to install mod_pagespeed for Apache server, but I can find instructions only for Linux. Is there any tutorial or description on how to do it on Mac?
Answer: mod_pagespeedis currently not supported. However, you can build it from source. Google is describing here how you can do that.
Instead of using apt-get you can install brew. Brew is a lightweight package manager for OS X and can be obtained at their official homepage.
I'd recommend to install a Linux distro on a VM and then installing mod_pagespeed as this is way easier, plus you get more support probably.


Launch IE from app passing HTML content

Question: I need to launch IE from my WP7 app and load the HTML to create the page dynamically. The HTML is read from a web service and can change at any time, so I'm not able to just store the HTML in a file. Is there a way to do this -- much like you do with WebBrowser.NavigateToString(strHtml)?
-Thanks!
Comment: Why can't you use WebBrowser.NavigateToString() with the webservice's address?
Comment: Application requirement that the page needs to be launched in the browser. I was using WebBrowser, but was handed new req.
Answer: If you are attempting to open your HTML content in an embedded WebBrowser control you can use the "NavigateToString" function and pass it the HTML content you would like to load.
If you are trying to open it in the native IE browser on the device then I would recommend putting state information in the URL and opening the page directly with any parameters required to replicate the view in the browser via the WebBrowserTask. This way you wouldn't technically be opening the HTML code from your app but you would be able to ensure that the HTML content loaded from your service is correct based on your query parameters.
Answer: Are you looking for WebBrowserTask?
Comment: Thanks Shawn L and willmel, but unfortunately, I can't use a uri that points to a page on the server side; the HTML needs to be returned via an existing web service method and I need to display the content within the IE browser.

Launch IE from app passing HTML content


How did the split between ichidan and godan verb conjugations come to be? Were suru and kuru always irregular?

Question: Ichidan verbs ditch ru, godan verbs replace the next character with any of the 5 vowels. Is it known how this distinction came to be? Were the irregular verbs kuru and suru always irregular?
Answer: The theory is this:
Godan verbs have a consonant at the end of their root. The various stem forms each add a vowel on the end, and then further suffixes are added. This has been the case in Japonic as long as we can tell; though /o/ is a new vowel to the paradigm (they used to be called yodan verbs).
Ichidan verbs with -iru (kami-ichidan verbs) probably had a vowel at the end of their root, initially. I'm not sure why the shuushikei added a -ru; this might have been on analogy with the rentaikei (which uses -ru in several other verb classes, and later replaced the shuushikei forms in most cases). I don't think anyone's ever explored the question of why the root-final vowel is always -i, though.
It's not fully clear whether or not all the vowels godan verbs take could have at one point been added to ichidan forms. Old Japanese is very aggressive about deleting vowels adjacent to other vowels, though, and so it wouldn't be surprising if they had been there and were just all deleted. (I don't think Ryuukyuuan languages show any trace of these vowels either, though.)
Ichidan verbs with -eru (shimo-ichidan verbs) were all once nidan verbs, which had two vowels in the stem: -e- in most forms, but a shuushikei in -u and a rentaikei in -uru (so modern 食べる was once 食ぶ in the shuushikei, and 食ぶる in the rentaikei). These are mostly believed to come from the incorporation of 得る 'get', which before the creation of nidan verbs would have just been irregular. These have since lost the alternations involving an -u, and have become shimo-ichidan verbs.
(The only historical shimo-ichidan verb was 蹴る, which is now a godan verb - go figure.)
する and くる seem to have been irregular as long as we can tell. People have tried to propose various unified underlying root forms, but none have been all that plausible. They're a bit less regular in Modern Japanese than they used to be, but even so, the vowel alternations they underwent in Old Japanese aren't the same as the vowel alternations for yodan verbs.
Incidentally, する and くる aren't the only irregular verbs in Modern Japanese. 行く has the unexpected forms 行った and 行って instead of *行いた and *行いて, and 良い has an irregular shuushikei/rentaikei いい instead of the expected (and historical) よい.
Comment: I don't know if I would consider 良い "irregular"; I would simply say that it has a colloquial modern alternative of いい, though it feels a bit strange to call it an alternative given the fact that it's vastly more common.
Comment: Re: よい manifesting as いい, this appears to be a semi-regular vowel shift: //joi// → //jəi// → //jei// → //ei// → //ii//.  We even see the えい form listed in dictionaries, as in [this Daijisen entry at Kotobank](https://kotobank.jp/word/%E8%89%AF%E3%81%84-442930). The variation between initial //jo-// and //je-// is also seen in the historical pronunciations of the verb 酔う.


A/B testing and Multi-armed bandit algorithms in a recommender system

Question: I was reading about these two algorithms, but I don't understand how they can be used in a recommender system because using the MovieLens dataset these algorithms recommend the best movie for all the users and not for a specifc user. I mean does multi armed bandit do the same predictions for all users?
Answer: A/B testing is not a recommendation algorithm per se, but a method used to evaluate and compare systems such as, for example, recommender systems.
You would use A/B testing in a live setting, where a recommender system is used to provide recommendations to users. By assigning users to two groups and giving both of these groups recommendations coming from two different systems (usually one representing the status quo and the other representing a new variant), you can compare both groups and determine if the new variant leads to better results than the status quo.
The name "A/B testing" usually refers to this kind of analysis performed on a live setting. If you are doing offline analysis, on a dataset like MovieLens, then you wouldn't usually call it A/B testing.
Methods for multi-armed bandits address a different problem: balancing exploration and exploitation.
The idea is that once you begin using a recommender system, the content your users consume is influenced by the output of this recommender system. This is a problem, because data about these consumption patterns is usually used to train the recommender system, which means the system would be trained on data influenced by its own predictions.
The most basic example of a multi-armed bandits approach would be to use your recommender system on half the users, give random recommendations to the other half, and use only the data from the latter half's behaviour to train the recommender system.
Because multi-armed bandit systems act by controlling how training data is collected, it doesn't make much sense to talk about them in the context of a dataset that has already been collected, like MovieLens.


will unmodified thinset stick to hardiboard?

Question: Will unmodified thinset stick to hardiboard, I want to apply a schluter membrane to it?
I am making an shower
Comment: Thanks, Here is an answer from the Hardi Building Company. This tech told me only modified may be used.  *****************************************************************************************
Sorry we only recommend a modified thinset to attach things to the backer.

Thank you

Mark Van Dorselaer
Technical Services  Representative
Technical Dpt. Phone Number: 888-542-7343
James Hardie Building Products Inc.
Answer: From what I see on their websites FAQ, unmodified is actually recommended, just mix it to be a "fairly fluid consistency".  As far as sticking to hardboard, it will.
Answer: From experience, yes it'll stick.
The HardieBacker installation manual for attachment to subfloor says to "apply a supporting bed of mortar or modified thinset to subfloor." A mortar bed is often unmodified thinset, so I read it that you are okay using unmodified thinset. Modified thinset can be much stronger, so they suggest using it to help the floor performance. Mortar beds can be 2" or so thick, so it's not as important to have the additional strength from the modified additives.
The problem with using modified thinset with Schluter Kerdi is that any thinset that gets trapped between two waterproof layers of Kerdi will not cure.
So even if Hardie didn't approve of using unmodified thinset, you'd still need to use it anyway because of the problems you'll have with the Kerdi.


Django & Postgis : Distance lookup using ST_Distance_sphere

Question: In Django documentation, I read this:

On every distance lookup but dwithin, an optional third element, 'spheroid', may be included to tell GeoDjango to use the more accurate spheroid distance calculation functions on fields with a geodetic coordinate system (e.g., ST_Distance_Spheroid would be used instead of ST_Distance_Sphere).

But when I try to execute a distance lookup with 'distance_lte' on a Postgis 1.5 database, the query is executed with "ST_Distance" instead of "ST_Distance_sphere". Why ? Did I forget something ?
stations = Station.objects.filter(point__distance_lte=(pnt, D(km=10))).count()
from django.db import connection
print connection.queries

Which prints this :
[{'time': '0.144', 'sql':
  'SELECT "spatial_ref_sys"."srid", "spatial_ref_sys"."auth_name", "spatial_ref_sys"."auth_srid", "spatial_ref_sys"."srtext", "spatial_ref_sys"."proj4text" FROM "spatial_ref_sys" WHERE "spatial_ref_sys"."srid" = 900913 '},
{'time': '0.903', 'sql':
  'SELECT COUNT(*) FROM "prices_station" WHERE ST_Distance("prices_station"."point", ST_GeomFromEWKB(E\'\\\\001\\\\001\\\\000\\\\000 1\\\\277\\\\015\\\\000\\\\270\\\\036\\\\205\\\\353Q\\\\270\\\\372\\\\277H\\\\341z\\\\024\\\\256\\\\007H@\'::bytea)) <= 10000.0'}]

Thanks
Comment: I get the same issue. Did you ever figure this out?
Answer: Well it does look like you have forgotten something! The third parameter which specifies that the spheroid function should be used.
stations = Station.objects.filter(
   point__distance_lte=(pnt,   D(km=10), True)).count()

it is also worth noting that use of dwithin might actually be the better option.


Let guest account use Boot Camp

Question: On a 2013 iMac running the latest Mac OS X, we have a Mac partition and a Windows 7 partition. The administrator can use the Boot Camp application to restart the Mac into Windows. The guest account however should also be able to use Boot Camp and restart into Windows. Is this in any way possible, because it seems you always need to enter the Administrator password in order to reboot into Windows?
Comment: @MrRabbit: This would expose the Recovery partition (unless there's a way to hide that), so we would like to avoid this option.
Comment: When you say the "Boot Camp application", are you referring to System Preferences > Startup Disk?
Comment: Is asking the guest user to boot to Windows by holding the Option key when powering on and selecting the Windows partition out of the question?
Comment: @tubedogg: With bootcamp application, I mean Boot Champ.
Answer: You can use the following code to create an Applescript application to accomplish this.

do shell script "bless -mount \"/Volumes/Boot Camp Name\"
  -setBoot -nextonly" user name "admin username" password "admin password" with administrator privileges
do shell script "shutdown -r now" user name "admin username" password
  "admin password" with administrator privileges

You will need to:

Paste the above code into AppleScript Editor
Fill in your admin username, password and name of your bootcamp volume where necessary

Once your details are entered you can save the script for editing later and then export it (File > Export) as an Application, making sure to check the "Run-Only" box before clicking Save.  What this does is create an AppleScript application that can only be run, not edited or viewed.  When you launch the application your Mac will temporarily reboot into whichever volume you specified in the code.
The following accomplishes this:

bless & setboot - This designates the default startup disk
nextonly - This tells the system that the volume designated in this command should only be the startup disk for the following boot, subsequent restarts will boot to the proper startup disk.
shutdown -r now - This tells the system to reboot now
Exporting as a run-only AppleScript application allows the students to execute the command but not view the contents, which should keep the admin credentials safe.  I made a sample application on my system and was unable to view the script inside the application by digging through the package contents.  It may be possible to get around this but I couldn't find a direct way.

To make this accessible to Guest users in addition to standard user accounts you could add it into the default user template at /System/Library/User\ Template/English.lproj/.  Settings, files, etc in this location carry over to the "on the fly" Guest accounts available in the newer Mac OS X revisions.
Hopefully that does the trick for you!
Comment: That did it! :D Almost. I just had to add the -legacy command to make it work, but after that it worked like a charm. Thank you!
Answer: You can boot into Windows without needing to change the Startup Disk.
Simply hold ⌥ alt/option whilst the system is booting to have the option to select a boot drive. From there, you can select the Boot Camp partition. Next time the machine reboots, it will reboot into OS X unless you repeat the procedure.
Comment: The problem is that this will expose the Recovery partition as well. We would like to avoid that because the iMacs are being used in a school environment.
Answer: BootChamp
BootChamp is a menu bar app that allows you to reboot into Windows on the next boot.

Admin is only required the first time this is carried out…

The first time a restart is initiated with BootChamp, it will ask for the admin password. After this initial process, you will no longer need to enter your admin password again.

The next time the machine boots, it will boot back into OS X.

BootChamp does not modify your startup disk, it only temporarily sets the startup disk for the next restart.

You can add this to the Guest account by adding it to the Guest user template at <code>/System/Library/User Template/English.lproj/</code>. The simplest way may be to log in as a Guest, then install BootChamp as a login item, give it your administrator password, and copy the contents of the Guest account to that folder.
Alternatively, you could use Workgroup Manager to add it as a login item.
Comment: Looks great. We're going to try that at once.

Let guest account use Boot Camp


ADC differential dynamic range vs Differential input voltage range

Question: Is there a difference between Differential dynamic range(in volt) and the Differential input voltage range?
If I have an input that swings between 1V and 3.4V, Is the Differential input voltage range in the below( which is a screenshot form a datasheet) enough or not?

Answer: Either differential input can reside between 0V and AVcc (without potential chip damage) but, if you exceed a difference voltage greater than 2.2 volts then your digital result is out of range.
You should also note figure 32 in the data sheet that gives you an indication of the input circuitry and informs you where the 1 kohm differential input resistance comes from.
Theory of operation (page 17) also informs you that the inputs are each centred at about 2.4 volts with the expectation being that an individual input may impose up to +/-0.55 volts (1.1 Vp-p). Clearly both together give you a capability of 2.2 Vp-p as previously mentioned.
You should also note that gain error could make the 2.2 V typical value for full scale +/-10% different. Zero error can add or subtract +/-10 mV also so, if you expect to use it without calibration checks take into account the potential reduction in range to less than 2 Vp-p.


Do all cards that have abilities to play another card trigger that unit's deploy ability?

Question: I've noticed that in most cases when a unit has an ability to search for and play another unit that it triggers the deploy ability for that unit. I would like to know, are there exceptions to this rule?
Comment: Deploy is quite different from Hearthstone's Battlecry, which is based on a Minion being played from hand, but is easy to confuse, especially since it's one of the few other cases where this kind of effect qualifier has a keyword in the first place (most TCGs like Yu-Gi-Oh or Magic have both variants and explain them in detail in each card's text rather than shortening them to a keyword like Deploy or Battlecry, so you'll see wordings like "When this card enters play").
Answer: The definition of the Deploy keyword is as follows
Deploy: Trigger this ability when the card is placed on the Board.
This means that as long as the card enters the board, whether it be from a spawn or card effect, it will trigger its deploy effect.
If an exception arises, it would likely be in the card text of the summoner.
Comment: It is worth noting that at least one card has an ability that specifies its effect triggers *before* the deploy ability of an enemy card. So there are some cases where a card will enter play, but its deploy effect may not get triggered (i.e. the card is destroyed before deploy triggers).
Answer: No (as of December 2018).
There are some cards that "Summon" another cards, for example Carantir Ar-Feiniel:

Which has this description:

Summon: Move automatically to he battlefield (not considered played)

So summoned cards won't have their Deploy ability activated.


How to Set the default storage of apps in my samsung galaxy young?

Question: I have a samsung galaxy young. How can I Set The Default Storage of my apps from Internal memory to SD card. I can't Download Anything right now. Can you tell me how?
Comment: I'm pretty sure the [same advices valid for other devices](http://android.stackexchange.com/search?q=set+default+install+location+is%3Aquestion+answers%3A1) will apply to the GY as well. Specifically check: [How to Install Android Apps to the SD Card by Default](http://android.stackexchange.com/q/42820/16575)
Answer: You first priority is probably to clean-up downloaded files, cached files, old APF (installation) files to give yourself more room and operate more efficiently.   You can clear cache individual applications through settings > applications > clear cache.
Use any File Explorer to remove files no longer needed or no longer wanted from your
downloads.  Each browser normally has its own downloads folder.  "SD Maid" includes a File Explorer if you don't already have a separate application.
You can clear cache files much quicker by installing
"Clean Master"

get rid of "Junk Files" such as cached files

"SD Maid".  Some items within  are

"Overview"  help to see what you are working with.
"CorpsleFinder"  find and delete files SD Maid believes belong to your old/deleted applications
"AppCleaner"  is a premium feature so you can use "Clean Master" to get rid of cached files, would need to mount your removable SD card, and once mounted, you would have to unmount the card before you physically  remove your card.
Settings > Storage > External SD Card > Mount/Unmount SD card.

You have to set default storage individually per application.  Some applications would slow down everything if they used your removable SD Card storage, such as "play store", and applications that start at startup.
To move an application to your SD card:
Settings > Applications > choose application > "Move to SD card"
To choose applications:
Settings > Applications > on SD card
http://www.tomshardware.com/faq/id-1772970/set-default-download-location-card.html
http://forums.androidcentral.com/t-mobile-galaxy-s-ii/137116-can-i-set-external-sd-card-default-media-storage.html
Comment: I think he asked how to set default storage as SD card...


Wire and Conduit for line between house and outbuilding

Question: I need to run a line from my home to an outbuilding about 100 feet away, but 175 feet from panel to panel.  I have a deck and walkway between the home and outbuilding that I thought I would just run the line under in conduit rather than burying.  I am thinking of a 6-3 line with ground for a 50 amp service, perhaps a couple 1500 watt heaters, some lights and a few outlets.  Should I use cable or 4 single wires (all identical??) and do I need to run what I use in conduit in the garage attic and down an outside wall before going under the deck and walkway?  Also, what size conduit will I need to use?
Comment: Is this an elevated walkway, or pavement in the ground?
Comment: The wooden walkway is elevated.
Answer: If you run conduit you would use individual wires. You could run the entire distance in conduit if you choose.
A 50 amp circuit only requires a #10 ground so you would have 3-#6 and 1-#10 copper wires for this circuit. These would fit in a 3/4" PVC schedule 40 conduit according to the Code.
With a light load (4 KW is less than half of this circuit) voltage drop should not be an issue but if you add a large motor load like a compressor you may get a slight flicker in your lights when the compressor starts. The longer the distance on the circuit the more this becomes an issue. Since you are currently oversized it should not be a problem unless you plan to put a larger load on the end of the line in the future.
Good luck and be careful!


Laravel unit tests in the wild

Question: Where would be a good place to find Laravel unit tests in the wild? Similar to this: Good Cucumber examples in the wild?
but for laravel. I know there are lots of examples out there but I'm looking for real tests based on a real project.
Answer: You could look at Laravel's own test suite, which is quite extensive and is based on PHPUnit. See https://github.com/laravel/framework/tree/master/tests.

Laravel unit tests in the wild


Chawmaysh mayoys, chawmeeshuh ussawr (515) mi yodeya?

Question: B"H
What's significant about 515 in the Torah?
Blessings and success
Answer: Midrash Tanchumah on Parshas Terumah 9:5 notes that whilst there is a difference of 500 years from the earth to the rekiah (firmament) there is 515 years that separates the earth and the טַּלְפֵי הַחַיּוֹת - steps of the beasts that pull the maaseh merkavah (Divine chariot).
Answer: B"H
It is the number of tefillos Moyshe made in order to enter the land of Yisroyayl, same gematria as "vieschawnawn" (and he prayed, second parsha of devarim)
The source is in the midrash
https://www.chabad.org/kabbalah/article_cdo/aid/1590696/jewish/Entreaties-and-Prayers.htm
Blessings and success


Locking and unlocking rows in sql database from C# winform

Question: I have a project where I use a select statement to select a group of records from a sql table, I need to locked the selected records and then update some and move others to another table. Right now I have a select such as this.
Select item
from tableA
where batchno = 123;

I believe I would lock them by writing it like this
Select item
from tableA with (rowlock, readpast)
where batchno = 123;

This is basically the select then I do an update on each records in a datagridview and place in another table that contains all that has been added to the record as well as the original fields. When I insert the records into the other table I delete the original records,those not updated, I change the batch number on those that are not updated and need to release the lock.
I use the readpast in order that no records already selected will appear for other useres. I believe that is right.
If this is correct I need to know how to release the records. I am new to C# so please make it clear and be patient.
Comment: Which type of SQL, is this SQL Server?
Answer: I believe the lock is released as soon as the transaction commits or rolbacks


Enabling left navigation for communication SharePoint site

Question: I created a communication site using blank template. How do i enable left  navigation(quick launch)? top menu is fine.
Answer: It seems like Microsoft is of the opinion that a Communication Site should not have any left nav as per https://www.wortell.nl/blogs/modern-sharepoint-sites-navigation-options/ and similar sources


What are the basics to collect seed from the vegetable garden?

Question: Since I was able to purchase NON-GMO seed, I'd like to harvest seed from my vegetable garden this year.  How do you tell when the seed is ready for harvest?  Lettuce, cauliflower, cabbage, celery, beets, squash?
Comment: One year later!! Did you have any success saving seeds this past year?
Answer: I'm going to assume that you're wanting to save open pollinated seeds. There's a difference between GMO, "hybrid" and "open pollinated" seeds.  While you can save hybrid seeds, you're getting an intentionally cross-pollinated plant seed initially but if you save seeds from that, you'll not get the same plant from those seeds.  But you can save them if you want.
I don't grow beets.  Never met a beet I liked. =)
I don't grow celery but it's a biennial.  Can't speak to saving either of those.
I imagine someone else can talk about those two.
Lettuces are pretty easy.  You might need to concern yourself with cross-pollination - there are techniques for this - row covers, etc. but more to the question you asked, they'll bolt when it gets too warm, create a flower and then after it blooms it's maybe 2-3 weeks before the seeds are ready to harvest.  There's some wiggle room there.
For squash seed saving I let the squash fruit ripen past the point where I'd harvest them to actually eat.  The fruit gets a bit harder at this point and then the seeds are good to go.  Honestly, I'd say I give them a week past the point where I'd harvest to eat.  I suppose you could wait longer but I never do. I cut the squash open, scrape out the seed and rinse them off in a colander.  I do the same thing with pumpkin seeds.  I run water over then and move them around in the colander to remove the pulp and stuff off of them and then I spread them out to dry.  Very easy to save them.
Cauliflower is a brassica and so is a biennial plant - it seeds in the second year, like carrots do.  I'm assuming you already knew this but anyway.  They get tall - 3 feet or more - and when those pods brown up, they're ready.  They need to overwinter safely though for year two.  Folks in colder climates need to save them from freezing hard - digging them up and storing them until spring is common.
Cabbage is a brassica too and a biennial.  Similar thing going here.  Note, however, that brassicas will readily cross-pollinate and so unless you've isolated them well, you run the risk of your brassicas cross-pollinating and producing some cabbage/cauliflower cross.  Interesting, but not likely what you want.
Comment: I was afraid of this cross-pollination thing...arghhhh!  I'll probably try collecting a few seeds to try next year otherwise it is back to the seed catalogs!  Thanks Matt!
Comment: Have you tried beet greens?  They are my favorite part even better than spinach! Grin!
Answer: Why are heirloom varieties best for saving seed? They aren't hybridized, so their offspring will be very similar genetically, to the original stock, if good techniques are implemented.
So, for the basic answer:
We'll first go into pollination. There are:

Self-pollinated plants

Insect-pollinated plants

wind pollinated plants

Let's look at self pollinated plants first. These have functional male and female parts within the same flower (or have both flower types on the same plant). This makes setting seed easy, but some can cross-pollinated by insects as well, which means you'll have to use isolation techniques with them.
Insect pollinated plants, on the other hand, always require varietal purity techniques in order to maintain a specific variety. There are many insects that pollinate plants, but the most common efficient one is the honeybee. These are great, because they will only visit one type of flower during a trip, so they are far less random than bumblebees, sweat bees, isolated bees, etc. Moths and butterflies, though they visit flowers often, are not efficient at pollination. Wasps don't have the type of hair to transfer pollen well, so they aren't good, either. Flies, though random, will pollinate flowers that have open, exposed nectaries, such as various individuals in the Umbelliferae and Brassicaceae families.
Wind pollinated plants (such as corn or spinach) are easy to keep pure, if you live alone. All they need is isolation.
Maintaining Varietal Purity

distance isolation: This is the technique of growing the seed plants far enough from potential pollinator plants (either wind- or insect-pollinated) that the pollination is almost pure. The distances change from plant to plant.

time isolation: This is the technique of sowing and raising plants at a far enough time from the potential pollinators that the seed remains almost pure. The times, of course, vary from plant to plant.

mechanical isolation: This is the use of a physical barrier to keep the plants from being pollinated by other strains. There are a few ways of doing this.

Bagging: This is used to isolate only the flowering portion of a plant, especially where only a small amount of seeds are needed. Like on tomatoes, you can cover an individual cluster with a bag, so that the only pollination is self-pollination. Paper bags are the most common. Never use plastic.

Caging: This is often a wood, plastic, pvc or wire frame, covered in screening or lightweight row cloth.

Alternate day caging: This is to maintain purity when raising two varieties together. You plant the two varieties together, and when they start flowering, cage only one variety. The insects pollinate the others all day. That night switch the cages over to the other variety, and the originally caged plants get pollinated the next day. This is used for insect pollinated plants.

Caging with introduced pollinators: This is using rapped or newly emerged pollinators (flies or bees) to pollinate the plants inside the cages. They need to be large enough to allow flying room around the plant.

Hand pollination: This is often used for plants that are insect or wind pollinated, to maintain pure seed. This is often done in conjunction with caging, for plants that are naturally insect pollinated.

Selection and Population Size
Vegetable seeds are constantly changing (slowly) due to either environmental factors or genetic factors, and you have to learn how to maintain a variety using certain techniques. You have to learn to look at the entire plant, and develop for specific traits. Characteristics to consider will include:

earliness
disease resistance
insect resistance
drought resistance
stockiness
vigor
color
lateness to bolt
hardiness
uniformity
trueness to type
flavor
overall health

How is this accomplished? Each year, seed savers must grow a good amount of each plant they want to save. The more plants the better, to maintain genetic diversity, and plant vigor. Once the plants are planted, watch the new plants. Cull any which differ from the original plants. Like being noticeably smaller, a different shape, bug bitten, etc. Every off-type is to be removed.

How do you tell when the seed is ready for harvest? Lettuce, cauliflower, cabbage, celery, beets, squash?

Lettuce seeds ripen irregularly and are ready to harvest from 12-24 days after flowering. The seeds should be harvested daily during that time, by shaking the seedheads into a large grocery bag and storing in a dry place in between.

Cauliflower is usually a biennial, and requires vernalization in order to flower. This means that if the plants are in an area where is gets colder than 28 degrees F., the plants will need to be dug up and stored overwinter at between 32 and 40 degrees F., at 90-95% relative humidity, and planted out again in the spring. Cut the stalks when the pods have turned brown, but before they shatter. Hang in a dry place to continue drying, and tie a paper bag on the end, to catch the seeds.

Cabbage is the same as cauliflower, except that when planted out in spring, you need to cut a shallow 'X' in the middle of the cabbage, to allow the stalk to emerge. Otherwise, see the cauliflower section.

Same as for the brassicas, celery needs to be overwintered and replanted in the spring. Celery doesn't like being disturbed, rootwise, so dig them carefully. They will then grow a seed stalk. Celery seed stalks are comprised of several umbels, some of which ripen before others. It is best to harvest the umbels one at a time, as they mature, but before they shatter.

Beets These are also biennial, and must be dug and stored in damp sand (in a 90-95% relative humidity environment) overwinter in most areas. Harvest when the seed clusters on the 4' stalk have turned light brown. Once the stalks are completely dry, thresh them with a flail, and winnow to remove chaff (I have used the wind method).

Squash Harvest when completely ripe, and let them sit at least a month before removing the seed. Pick the seed from the pulp, and rinse in a colander, removing all debris. Drain and dry.

Seed saving is a very time-consuming and involved process, which is why it has become less and less common over the past years. There are still many interested in the process, and you can find tutorials and videos online, demonstrating how to do any of the numerous tasks you will need to accomplish. It is an art form, and so many people find it more convenient to simply buy new seeds each year.
The book that has helped me most, and I highly recommend to anyone with an interest in this topic (also my main reference for this answer), is 'Seed to Seed' by Suzanne Ashworth.
Comment: If you need expansion on any point, let me know.
Comment: Oh my goodness!  What a great answer!! WELL!  Gotta start out planning to harvest seed.  This is so well done, J.  But gotta learn how to do this.  I don't expect to always have non-gmo seed available.  Thank you so very much!
Comment: @stormy I believe non-commercial varieties of vegetables have to be labeled as GMO if they are. Your basic seed catalogs don't usually have GMO seed for sale. I know Jung, for one, does their best to never sell gmo seeds.
Comment: @stormy most vegetable seeds are non-gmo. As itsmatt says, hybrid and gmo are different. Again, if you want me to expand on any point, I'd be glad to, and if you have any new questions, ask some new ones.
Comment: Absolutely...but how do you know most seeds we buy at the store are Non-GMO? The only way I can be kinda assured is if the package says Non-GMO. They were tough to find this last season.
Comment: In the case of lettuce, cauliflower, cabbage and celery, there's an even easier way to know they are not GMO. It's because no GMO variety of those plants currently exists. Sugar beets (a distinctly different cultivar from the beets in most gardens) do have glyphosate tolerant GMO varieties. There are GMO varieties of Squash that have added resistance to mosaic viruses. https://en.wikipedia.org/wiki/Genetically_modified_crops#Development


Turn off Timer1 / Timer1 One-shot

Question: A zero detector crossover sends a pulse to the Arduino, it must start counting x time and then a pulse is sent from the Arduino, once the timer reaches time x, it must stop counting and only start counting again when it receives the new pulse of the zero crossing detector, the idea is to do something like this:

What I don't know is how to keep the timer off all the time toff that appears in the image.
Comment: Does this answer your question? [Fan regulator control from Arduino](https://arduino.stackexchange.com/questions/63631/fan-regulator-control-from-arduino)
Comment: You can trick the timer into doing one-shot, by setting the counter to a value higher than TOP. See https://hackaday.com/2015/03/24/avr-hardware-timer-tricked-into-one-shot/
Comment: *A zero detector crossover sends a pulse to the arduino*... How does your code and wiring detect the zero cross-over now? Is the detector external and just sends a signal to Arduino? Wouldn't you just reset the timer any time you detected the cross-over to positive? Or doesn't the detector distinguish between a positive crossing and a negative one? Or are you really wanting to know how to do a cross-over detection for a sinusoidal signal?
Comment: @lurker what I get from the zero crossing detector is a train of pulses, which varies from 0 to 5v each time it passes through zero, but that's not the point, create an edge ISR when the signal varies, at that time it should start the counting, stop when it reaches the time x that I need and stay off until the next zero edge, in the examples that I have seen the timer restarts and continues counting, I need it to turn off or stop counting until the next zero crossing
Answer: the way to turn off the Timer is to set the CS12, CS11 and CS10 prescale bits to 0, in this way the CLK signal is disconnected and the timer stops counting, when you want the timer to continue counting, they are set back to 1 the CS12, CS11 and CS10 bits according to the selected prescale.
byte savePrescale

savePrescale = TCCR1B & (0b111<<CS10);
...
TCCR1B &= ~(0b111<<CS10); // Stop Timer1 Clock
...
TCCR1B |= savePrescale;  // Restart Timer1 clock.
...

Answer: You can initiate a "One shot" timer at each zero-crossing.
The trick @Gerben mentioned in turn off Timer1 / Timer1 One-shot eventually links to code at https://github.com/bigjosh/TimerShot which does the one-shot functionality on Timer2 by idling the timer at TCNT2=0 with OCR2A=0, and using the TCNT2 space above 0 to operate an adjustable oneshot on OC2B.
This trick can be adapted to Timer1:
// The one shot pulses are output on Digital pin OC1B (Arduino Uno D10, Mega D12, Nano D3)
// Modified by Dave Forrest 2020-01-11 for Timer 1
// Based on Josh Levine's Nov 23, 2015 work at https://github.com/bigjosh/TimerShot/blob/master/TimerShot.ino

#define OSP_SET_WIDTH(cycles) (OCR1B = 0xffff-(cycles-1))

// Setup the one-shot pulse generator and initialize with a pulse width that is (cycles) clock counts long

void osp_setup(uint16_t cycles) {

  TCCR1B =  0;      // Halt counter by setting clock select bits to 0 (No clock source).
              // This keeps anything from happeneing while we get set up

  TCNT1 = 0x00;     // Start counting at bottom.
  OCR1A = 0;      // Set TOP to 0. This effectively keeps us from counting because the counter just keeps reseting back to 0.
          // We break out of this by manually setting the TCNT higher than 0, in which case it will count all the way up to MAX and then overflow back to 0 and get locked up again.
  OSP_SET_WIDTH(cycles);    // This also makes new OCR values get loaded from the buffer on every clock cycle.

  TCCR1A = 0b11<<COM1B0  | 0b11<<WGM10;  // OC1B=Set on Match, clear on BOTTOM. Mode 15 Fast PWM.
  TCCR1B = (0b11<<WGM12)| (0b001<<CS10); // Start counting now. WGM 15=0b1111  to select Fast PWM mode

  //DDRB |= _BV(2);     // Set pin to output (Note that OC1B = GPIO port PB2 = Arduino Uno Digital Pin 10)
  DDRB |= _BV(6);     // Set pin to output (Note that OC1B = GPIO port PB6 = Arduino Mega Digital Pin 12)
  //DDRD |= _BV(3);     // Set pin to output (Note that OC1B = GPIO port PD3 = Arduino Nano Digital Pin 3)
}

// Setup the one-shot pulse generator

void osp_setup() {
  osp_setup(1);
}

// Fire a one-shot pulse. Use the most recently set width.

#define OSP_FIRE() (TCNT1 = OCR1B - 1)

// Test there is currently a pulse still in progress

#define OSP_INPROGRESS() (TCNT1>0)

// Fire a one-shot pulse with the specified width.
// Order of operations in calculating m must avoid overflow of the uint16_t.
// TCNT2 starts one count lower than the match value becuase the chip will block any compare on the cycle after setting a TCNT.

#define OSP_SET_AND_FIRE(cycles) {uint16_t m=0xffff-(cycles-1); OCR1B=m;TCNT1 =m-1;}

void setup()
{
  osp_setup();

}

void loop()
{
  // Step though 0-11 cycle long pulses for demo purposes
  for (uint8_t o = 0; o < 101; o++) {
    OSP_SET_AND_FIRE(o);
    while (OSP_INPROGRESS());         // This just shows how you would wait if necessary - not necessary in this application.
    //_delay_us(1);      // Wait to let the audience clap
  }
}

This code produced pulses with a resolution of 62.5ns, which is on the edge of what my test equipment can measure.  Here's a 6.25us, 100 cycle pulse next to a 1 cycle pulse:

With Timer1's 16 bit range and the /1 prescaler you can do pulses from 62.5ns to 4us.  With the /1024 prescaler, (TCCR1B|=(0b101 <<CS10);) it can do 64us up to 4.194sec.  With /256 prescaler, (TCCR1B|=(0b100 <<CS10);) it can do 16us up to 1.05sec.
For a one shot triggered on a zero-crossing, you might try something like this with the above
void loop()
{
  ...
  int t1_us = 1000000UL/60 /8 ; // 1/8th of a 60Hz cycle

  if(needOneShot){  // Set needOneShot with an interrupt or sensor or something
    OSP_SET_AND_FIRE(t1_us/16);  // 16us ticks with the /256 prescaler
     needOneShot = false;
  }
  ...
}

Turn off Timer1 / Timer1 One-shot


Returning Error Details from AJAX-Enabled WCF Service

Question: Short Version: Is there a/what is the suggested way to return error details to the client when an exception is thrown in an AJAX-Enabled WCF Service (aside from just throwing the gates open and sending back all of the exception details)?
Long Version:
I've got a relatively simple AJAX-enabled WCF service that I'm calling from the client using the default service proxy.  I've provided code snippets below, but I do not believe there is anything wrong with the code per se.
My problem is that if I throw an exception in the service, the error object returned to the client is always generic:
{
    "ExceptionDetail":null,
    "ExceptionType":null,
    "Message":"The server was unable to process the request..."
    "StackTrace":null
}

Ideally I would like to display different error messages on the client depending on what went wrong.
One option is to allow exceptions in WCF faults, which would provide me with the full stack trace and everything, but I appreciate the security concerns with this, and that's actually a lot more information than I need.  I could make do with just being able to send back a string describing the problem or something, but I don't see a way to do this.
My Service Code:
[ServiceContract(Namespace = "MyNamespace")]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class MyService
{
    [OperationContract]
    public void DoStuff(string param1, string etc)
    {
        //Do some stuff that maybe causes an exception
    }
}

On the client:
MyNamespace.MyService.DoStuff(
    param1,
    etc,
    function() { alert("success"); },
    HandleError);

where "HandleError" is just a generic error handling method that would display details about the error.
Answer: EDIT: Updated the post with a proper custom json error handler
The quick but non-preffered way.
<serviceDebug includeExceptionDetailInFaults="true"/>

In Your service behavior will give you all the details you need.
The Nice way
All exceptions from the application are converted to an JsonError and serialized using a DataContractJsonSerializer. The Exception.Message is used directly. FaultExceptions provide the FaultCode and other exception are threated as unknown with faultcode -1.
FaultException are sent with HTTP status code 400 and other exceptions are HTTP code 500 - internal server error. This not nescessary as the faultcode can be used to decide if it is and unknown error. It was however convenient in my app.
The error handler
internal class CustomErrorHandler : IErrorHandler
{
    public bool HandleError(Exception error)
    {
        //Tell the system that we handle all errors here.
        return true;
    }

    public void ProvideFault(Exception error, System.ServiceModel.Channels.MessageVersion version, ref System.ServiceModel.Channels.Message fault)
    {
        if (error is FaultException<int>)
        {
            FaultException<int> fe = (FaultException<int>)error;

            //Detail for the returned value
            int faultCode = fe.Detail;
            string cause = fe.Message;

            //The json serializable object
            JsonError msErrObject = new JsonError { Message = cause, FaultCode = faultCode };

            //The fault to be returned
            fault = Message.CreateMessage(version, "", msErrObject, new DataContractJsonSerializer(msErrObject.GetType()));

            // tell WCF to use JSON encoding rather than default XML
            WebBodyFormatMessageProperty wbf = new WebBodyFormatMessageProperty(WebContentFormat.Json);

            // Add the formatter to the fault
            fault.Properties.Add(WebBodyFormatMessageProperty.Name, wbf);

            //Modify response
            HttpResponseMessageProperty rmp = new HttpResponseMessageProperty();

            // return custom error code, 400.
            rmp.StatusCode = System.Net.HttpStatusCode.BadRequest;
            rmp.StatusDescription = "Bad request";

            //Mark the jsonerror and json content
            rmp.Headers[HttpResponseHeader.ContentType] = "application/json";
            rmp.Headers["jsonerror"] = "true";

            //Add to fault
            fault.Properties.Add(HttpResponseMessageProperty.Name, rmp);
        }
        else
        {
            //Arbitraty error
            JsonError msErrObject = new JsonError { Message = error.Message, FaultCode = -1};

            // create a fault message containing our FaultContract object
            fault = Message.CreateMessage(version, "", msErrObject, new DataContractJsonSerializer(msErrObject.GetType()));

            // tell WCF to use JSON encoding rather than default XML
            var wbf = new WebBodyFormatMessageProperty(WebContentFormat.Json);
            fault.Properties.Add(WebBodyFormatMessageProperty.Name, wbf);

            //Modify response
            var rmp = new HttpResponseMessageProperty();

            rmp.Headers[HttpResponseHeader.ContentType] = "application/json";
            rmp.Headers["jsonerror"] = "true";

            //Internal server error with exception mesasage as status.
            rmp.StatusCode = System.Net.HttpStatusCode.InternalServerError;
            rmp.StatusDescription = error.Message;

            fault.Properties.Add(HttpResponseMessageProperty.Name, rmp);
        }
    }

    #endregion
}

Webbehaviour used to install the above error handler
internal class AddErrorHandlerBehavior : WebHttpBehavior
{
    protected override void AddServerErrorHandlers(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher)
    {
        base.AddServerErrorHandlers(endpoint, endpointDispatcher);

        //Remove all other error handlers
        endpointDispatcher.ChannelDispatcher.ErrorHandlers.Clear();
        //Add our own
        endpointDispatcher.ChannelDispatcher.ErrorHandlers.Add(new CustomErrorHandler());
    }
}

The json error data contract
Specifies the json error format.
Add properties here to change the error format.
[DataContractFormat]
public class JsonError
{
    [DataMember]
    public string Message { get; set; }

    [DataMember]
    public int FaultCode { get; set; }
}

Using the error handler
Self-hosted
ServiceHost wsHost = new ServiceHost(new Webservice1(), new Uri("http://localhost/json"));

ServiceEndpoint wsEndpoint = wsHost.AddServiceEndpoint(typeof(IWebservice1), new WebHttpBinding(), string.Empty);

wsEndpoint.Behaviors.Add(new AddErrorHandlerBehavior());

App.config
<extensions>
  <behaviorExtensions>
    <add name="errorHandler"
        type="WcfServiceLibrary1.ErrorHandlerElement, WcfServiceLibrary1" />
  </behaviorExtensions>
</extensions>

Comment: Most of the articles I've read seem to frown upon including exception details in production settings since it's exposing information about your service's implementation.

That said, none of those same articles seem to offer a "better" solution to returning error information.
Comment: It should be noted that there is a bug in WCF that when adding the assembly information to the behaviorExtension tag, you need to use the fully qualified name (tack on `, Version=184.108.40.206, Culture=neutral, PublicKeyToken=null` if the code is in the same assembly as your services).
Comment: I do not know why, but the simple `` in the service behaviour in my Web.config didn't work for me. But when I added the same directive into my code file (as `[ServiceBehavior(IncludeExceptionDetailInFaults = true)]` above the class declaration, from [this question](http://stackoverflow.com/q/7404478/575530)) it worked.
Answer: The only way I am able to get exception detail back is with
<serviceDebug includeExceptionDetailInFaults="true"/>

I tried the suggested method with extending HttpWebBehavior but when it is used with enableWebScript like the following:
<behavior name="JsonBehavior">
    <myWebHttp/>
    <enableWebScript/>
</behavior>

The WCF call will return status code 202 without anything information.
If the configuration turns into
<behavior name="JsonBehavior">
        <enableWebScript/>
        <myWebHttp/>
    </behavior>

You will get the nicely formatted message back but you lose all the json formatting functionality as well as request parameter parsing from enableWebScript, which completely defeats the purpose of using enableWebScript
I have attempted FaultContract as well but it appears to only work for Service References and not AJAX calls from JQuery.
It would be nice to be able to override WebScriptEnablingBehavior or the service itself to provide custom error handling.
Answer: I had the same problem as Bernd Bumüller and user446861 and at the end of it, I just reverted to using  as the behaviour for my WCF service. Lo and behold, you don't need any of the IErrorHandler stuff anymore. You can just throw WebFaultException/WebFaultException types and everything is golden on the client side.
webHttp is basically the same as enableWebScript (webscript derives from webHttp from what I understand) minus the ASP.NET Ajax stuff (ScriptManager ServiceReference and all that). Since I am using jQuery, I didn't need the auto-generated JS service proxies and the other Ajax.net baggage. This worked wonderfully for my needs, so just thought I'd post a comment just in case anybody else is still looking for some info.
Answer: It looks like the preferred way to differentiate between error states is via the http status code on the response.  This can be manually set in the service method, but I'm not sure if this is the best way to approach this or not:
[ServiceContract(Namespace = "MyNamespace")]
AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class MyService
{
    [OperationContract]
    public void DoStuff(string param1, string etc)
    {
        try
        {
        //Do some stuff that maybe causes an exception
        }
        catch(ExceptionType1 ex)
        {
            WebOperationContext.Current.OutgoingResponse.StatusCode = HttpStatusCode.BadRequest;
        }
        catch(ExceptionType2 ex)
        {
            WebOperationContext.Current.OutgoingResponse.StatusCode = HttpStatusCode.Conflict;
        }
        ... etc.
    }
}

Answer: I would suggest wrapping the exception and letting all exceptions go through the service wrapped. The ones that you expect you will filter out (like in the above example) with meaningful messages. The general case will just say:
throw new ApplicationException("Unknown Error");
This way you won't give out information to the client about the inner workings of the service but will be able to show meaningful messages for cases where you need to pass back error information to the client like security exceptions, etc.


Why should I be a freelancer

Question: I would like to know why people would prefer to freelance than to work as an employee.
I hope to get various answers. I don't think there would be a definitive answer to this question.
PS:
Again not sure which tag to use.
Comment: Hello, johan! Here on Stack Exchange, we like questions that are answerable and whose answers aren't opinion-based. While we are lenient with this at times, asking "why should I freelance" is quite subjective, so I'd [edit] your question into something a little more objective.
Answer: There are various reasons. As a Freelancer what I think is:

A Freelancer is free to work. He is not bound for certain  working hours.
He is free to accept or reject any work.
He is free to choose his rates. (I think that usually freelancers charge less than any other employee)
A freelancer can do various jobs at a time from his home or any other location. He is not bound to sit and work in office.
A Freelancer is not bound to have a physical work location. He can take work just via telling his country name. (No need to disclose his complete address)
Comment: I disagree that freelancers usually charge less than their employee counterparts. Freelancers should be charging more because it is necessary to take into account office expenses, etc. that employees don't have.

Why should I be a freelancer


Sign of the real part of the roots of a particular polynomial of degree 4

Question: I am working with the polynomial $x^4+ax^3+bx^2+cx+d$, with $a>0, b>0, c>0, d>0$.
I would like to understand under which conditions, on the coefficients, this polynomial has only complex roots with negative real part or real negative roots.
Does someone knows this conditions or someone has some literature to suggest?
Answer: What you are after is called the Routh-Hurwitz criterion.
As you guessed, it will require some reading, but the bottom line is that there is an algorithm to draw up a table, and the condition is that all entries from the first column should be of the same sign.
See this, for instance.
Answer: Given a polynomial  $P=a_0 x^n + a_1 x^{n-1} + \cdots + a_n$, set up the $(n+1)\times (n+1)$ Hurwitz matrix
$$H(P)= \begin{matrix} a_0 & a_2 & \ldots &\\
                        0&  a_1 & a_3 & \ldots\\
                        0&  a_0 & a_2 & \ldots\\
                        0 & 0   &  a_1 & \ldots \\
                        0& 0 & \ldots & a_{n+1} \end{matrix} $$
$H(P)$ is constructed as follows: on the first row we place $a$'s with even indexes. Then, in each column, the indexes decrease by $1$. On the diagonal we have the coefficients $a_0$, $\ldots$, $a_{n+1}$. Note that $a_{\mu}$ is $0$ for $\mu>n$, or for $\mu<0$.
Assume that $a_0>0$. Then $P$ has all roots with real part $<0$ if and only if all the leading minors of the matrix $H(P)$ are $>0$. Note that this is equivalent to $a_0>0$, $a_n>0$ and the principal minors $(2,\ldots,k)$ positive for all $2\le k \le n$, that is, $a_0$, $a_1$, $a_n>0$ and $n-2$ other algebraic conditions.
In the case $n=4$, appearing also in Hurwitz original paper, we have
$$P= a_0 x^4 + a_1 x^3 + a_2 x^2 + a_3 x + a_4$$
the Hurwitz matrix is
$$H(P) = \left(\begin{matrix} a_0 & a_2 & a_4 & 0 & 0\\
0& a_1 & a_3 & 0 & 0\\
0& a_0& a_2 & a_4 & 0\\
0& 0& a_1 & a_3 & 0\\
0& 0& a_0& a_2 & a_4\end{matrix} \right)$$
and the conditions, on top of $a_i>0$, are
$$\left| \begin{matrix} a_1 & a_3 \\
                        a_0 & a_2 \end{matrix} \right |>0 \\
\left | \begin{matrix} a_1 & a_3 & 0\\
                        a_0 & a_2 & a_4\\
                         0& a_1 & a_3 \end{matrix} \right |>0$$


Is this question scoped too broadly?

Question: @NigelJ and I got into a comment discussion on this question. I probably shouldn't have started the discussion, but I wanted to respond to an apparent frame challenge by challenging it. The interchange of comments, though, especially the comment "I cannot answer on behalf of [Protestants believing differently than NigelJ]", made me think. If different Protestants can (apparently) have different views on whether the question is even phrased correctly, is it appropriate to tag the question "Protestantism"?
Answer: I think the question is fine as a question of church history. I don't think anyone would dispute the basic facts: that before the reformation infant baptism was supreme in the Catholic Church, that most early reformers still baptised infants, that the anabaptists did not and would even rebaptise adults, and that since then both Reformed and Arminian baptists have grown often without a lot of direct links to the anabaptists. A good answer would trace how it spread from anabaptists to other Protestants even without being direct descendants from the anabaptists, or in other words, how the idea spread sideways between the branches of descent among Protestant denominations.
Answer: The question itself is actually not too bad, but it is a little off in that it pretends this is something that there is going to be an objective right answer too no matter what your viewpoint. This expectation itself is objectively false given thousands of years of disagreement over the "right" answer. If this question was easy to answer as framed we wouldn't be where we are now.
The issue with answering this is going to be similar to NigelJ's comments: dogmatic assertion that only one side of the story even exists. (Sorry mate, I'm not trying to put you down here, but implying nothing else is there to be seen in Scripture is pretty dogmatic for an issue that solid folks all round have seen other sides to for a couple thousand years.) In fact I'll say that even I would have a hard time answering the question as worded, because it would be almost impossible to do so without asserting my own perspective as the way it actually happened. However much I think that to be the truth, clearly it is a contested issue (case in point, I see the opposite story as NigelJ and think its relatively obvious when you sum up the whole Scripture story).
All that to say I think the question is going to be a hotbed for "truth takes", and would be much better directed at either credo- or peodo- baptists. Ask two questions if needed, but 'protestantism' is indeed too broad a scope to frame this question.

Is this question scoped too broadly?


Help identifying frost free faucet make and model

Question: The plastic collar in the image below is cracked and needs replaced.  Does anyone know what make of faucet this is so i can track down parts. The knob has remnant of blue paint on it.
Comment: There are **multiple duplicate questions** with much better pictures, some good enough that someone could actually sort it out. This picture, well, you can see it's a frost free sillcock, but there's no detail to help with what one it might be. The usual advice is to take it to a plumbing supply, or replace the whole thing. If you only shop at big-box stores, replace is really it. A decent plumbing supply will most likely be able to get you parts.
Comment: the knob tells us noting, keep looking for some kind of marker
Comment: Blue colour on a knob just means it should be used on/for cold water line, but works just as well on the hot(red) water taps.
Answer: Trying to identify the manufacturer will be near impossible from the pictures you provided. Your best bet would be to bring the old one into your home store or better yet, a plumbing supply store, and have them try to identify replacement parts. You could also try any local stores because they might have supplied the original to the builders and would have parts.  Honestly, I would just replace the the old one with a new one and since you've already removed it, half the work is done.


norm form of remainder of Taylor's expansion

Question: Let $\mathbf x=(x_1,x_2,\cdots,x_n), \mathbf a=(a_1,a_2,\cdots,a_n)$, Can we write Taylor's expansion of $f(\mathbf x)$ at $\mathbf a$ as
$f(\mathbf a)+(f_1(\mathbf a),f_2(\mathbf a),\cdots,f_n(\mathbf a))(\mathbf x-\mathbf a)^T+\frac{1}{2}(\mathbf x-\mathbf a)\left(\begin{array}{cccc}f_{11}(\mathbf a)&f_{12}(\mathbf a)&\cdots&f_{1n}(\mathbf a)\\f_{21}(\mathbf a)&f_{22}(\mathbf a)&\cdots&f_{2n}(\mathbf a)\\\vdots&\vdots&\vdots&\vdots\\f_{n1}(\mathbf a)&f_{n2}(\mathbf a)&\cdots&f_{nn}(\mathbf a)\end{array}\right)(\mathbf x-\mathbf a)^T+o(\|\mathbf x-\mathbf a\|^2)$
where the norm in the remainder is any norm of $\mathbb R^n$. If it can, please refer me to a textbook that explicitly mentions this. Thank you!
Answer: This is multivariable Taylor's formula with the remainder in Peano's form. One should assume that $f$ is twice continuously differentiable. The formula is stated in Encyclopedia of Mathematics where textbook references are given, such as

T.M. Apostol, "Mathematical analysis" , Addison-Wesley (1957)


How can I convert a flow sensor's pwm output to logic level relay control?

Question: I have a flow sensor with PWM output and I can't replace it with a flow switch due to mechanical restrictions. Is there any simple way to convert the PWM output to a logic / or analog signal and trigger a transistor with that? e.g. something like a filter that converts the PWM output to voltage and then after a specific threshold turns on a relay?
Answer: There is a couple of ways that you can tackle this project.
1) Filter (integrate) the PWM signal into an analog level that you then compare against a reference voltage.  This is probably the easiest method but it may not be as accurate as other methods.
2) measure the PWM duty-cycle with a microcontroller such as a PIC or Arduino board.  This requires software but has the advantage that it can be more accurate than the first method.
Question 1: does your sensor have an open-collector output?
Question 2: what is the PWM frequency?  What duty-cycle range does it provide?
Question 3: are you certain that the output is PWM with variable duty-cycle as opposed to just variable frequency?  Many flow sensors use a rotary vane with sensor and their output signal is a pulse train who's frequency varies with flow rate.  This requires somewhat different measurement techniques than what I described above.
Comment: It's a hall sensor based flow sensor, I was told it's a PWM output but it may just have a variable frequency output. Using an mcu is out of the question as the scope of the project is to replace a simple magnetic reed sensor with a hall effect sensor (which already exists and is currently in our stock)

the 1 way seems to be the most appropriate (accuracy isn't that critical) but I can't find any similar circuit to work with
Answer: That should be fairly easy.  You need to make a couple of measurements.
1) What DC power supply voltage is available for you to use to power the hall-effect sensor?
2) Is one leg of the current reed-switch connected to your DC ground rail.  That is: the (-) supply connection.  Or is it connected to some DC voltage above ground?
3) What is the DC voltage across the reed-switch when it is either open or disconnected?
The easiest connection is if one side of the reed-switch is connected to ground (negative supply rail) and if the open-circuit voltage across the reed-switch is less than the max output voltage rating of the hall-effect sensor.
If that is the case, connect the (-) lead of the hall-effect sensor to the ground where the reed-switch used to connect.  Connect the output pin of the hall-effect sensor to the other wire where the reed-switch used to connect.  Finally, power the (+) lead of the hall-effect sensor with any DC voltage that is within its' allowable power supply voltage.  Note that in most logic-signal hall-effect sensors, the output pin voltage can be higher than the power supply voltage (open-collector or open-drain output stage).
Many logic-signal hall-effect sensors are will operate from about 4 Vdc through 24 Vdc and the output pin voltage can be as high as 24 Vdc.  But you need to check the specs of the particular hall-effect sensor that your flow sensor has.


What is Pan for in pan-caspase?

Question: A simple question (I could not find it on internet): What is Pan for in pan-caspase? Is it any different from the term 'caspase' ?
Comment: can you tell the context of that phrase? If in case of inhibitor it could mean that it inhibits all caspases. Similarly with antibodies: a pan-caspase antibody would bind to all caspases.
Comment: there is no specific context but i now realized that it is usually used as pan-caspase inhibitor in the articles i was looking at. just to be sure: can we then say that pan is the opposite of specific?
Comment: yes you can say that.. but we generally use the term "caspase-`x` inhibitor", where `x` is that specific caspase
Answer: The term pan, in my opinion, is perhaps one of the most vague that exists in science! I can partley answer this question (ironically as vague as the term pan) by referring you to the term pan-neuronal. A pan neuronally expressed genes has features, which include the expression of many "generic" genes required non-specifically for neuronal function, such as components of the synaptic vesicle machinery, so pan-neuronal genes are not neurone class specific (http://www.wormbook.org/chapters/www_specnervsys/specnervsys.html). So with that token pan-caspases are a term referring to a general caspase activity/function/structure and not a specific caspase type activity but I would welcome any corrections or edits to this response.
Answer: Pan is referring to all. So a pan-caspase inhibitor is a molecule that inhibits all caspases indiscriminately.
Note that pan means all in Greek.

What is Pan for in pan-caspase?


Why SSH is asking for my private key password each time

Question: Since yesterday, each time I try to connect to an ssh server, I got asked for my password. What should I do to make SSH not ask for my password each time.
Comment: Blind guess by me: check that your key is loaded with `ssh-add -l`.
Comment: I assume you are using ssh keys? If you don't use a keymanager and have a non-empty passphrase, this is normal. Either use a keymanager or create an empty passphrase for your key. I guess the former is recommended.
Comment: if it's "since yesterday", maybe it's just that you have updated your system, and now ssh-agent does not work anymore.
Answer: Put your public key in hostmachine:~/.ssh/authorized_keys and make sure it has the appropriate permissions (use chmod 600). See the man page, section AUTHENTICATION, for more details. Note that sshd maybe configured to disallow this method of login although I cannot fathom why.
Comment: You can also use **ssh-copy-id** in order to get your public key automatically copied to destination host, if you don't want/need to copy it manually.
Comment: The man page has the information in the AUTHENTICATION section.  As to why it was working before hand, I cannot be sure without having root access to your machines and doing some forensics work.
Comment: Thank, that worked. However could you explain me why do I have to put it in authorized_keys and why it was working without it before.
Answer: Check directory permissions, and file permissions.
$HOME can't be writeable by group or other.
$HOME/.ssh needs to have 700 permissions, not readable, writeable or executable by group and other.
$HOME/.ssh/authorized_keys to be not writeable or executable by anyone.
If you find that permissions aren't strict enough, try to figure out what caused the problem. Last time this happened to me, I had compiled PHP from scratch.  Executing make install as root (Slackware) changed the permissions and ownership of / or /home as I recall, and kept ssh from working with authorized_keys and id_rsa.pub files that had been in place and working for ages. You want to determine what caused the problem, as changed directory ownership and/or permission can happen because of a rootkit install or something like that.
Comment: This fixed it for me.. After fixing my permissions, I added it using 'ssh-add'.. after closing that terminal and re-opening it and doing 'ssh-add -l' (lower L) I could see my identity, which worked.. I could SSH to all my boxes without having to type my private key pass 300+ times a day!! Thank you!


How to choose proper measurement operator?

Question: Let's assume I have two states inside the Bloch sphere, at radial vectors $r_1$ and $r_2$ respectively $(r_1<r_2<1)$. Their angular location is same. These are like:
\begin{equation}
\rho =
\begin{pmatrix}
\frac{1+r_1 \cos\theta}{2} &\frac{r_1 \exp(-i\phi)\sin\theta}{2} \\
\frac{r_1 \exp(i\phi)\sin\theta}{2} &\frac{1-r_1 \cos\theta}{2} \nonumber
\end{pmatrix}
\end{equation}
and another state as
\begin{equation}
\rho' =
\begin{pmatrix}
\frac{1+r_2 \cos\theta}{2} &\frac{r_2 \exp(-i\phi)\sin\theta}{2} \\
\frac{r_2 \exp(i\phi)\sin\theta}{2} &\frac{1-r_2 \cos\theta}{2} \nonumber
\end{pmatrix}
\end{equation}
I know that measurement can increase radial vectors but I don't know the procedure to find the suitable measurement operators which can relate the above states $\rho$ and $\rho'$.
Comment: Got too late to this one. Craig's answer touches on the main issues, and Emilio's comment dots the i. You can do this only with post-selection and in the ensemble sense by measuring along the direction of the (common) eigenstates.
Answer: When don't you condition on the result, measurement of a qubit can only decrease its purity (you end up with less information than you started with).
When you do condition on the result, measurement of a qubit will make it 100% pure but there are two possible results. One possible result is along the measurement axis you measured. The other is against the measurement axis (well... along it, but negative-ward instead of positive-ward). This will invert the angles instead of only changing the radius.
So I'm not sure how you could do what you want (increase radius without affecting angles) without post-selecting. Measure the qubit along the axis component of its Bloch sphere representation, retry the whole experiment up to that point until you get the "along" answer instead of the "against" answer, then continue.
Here's an example circuit, where I setup a qubit to have a mixed state pointing towards the -X state then post-select it into the -X state. But keep in mind that it's the post-selection that's entirely responsible for the final state; states along the Z axis would also end up at -X in this case.

If you want to decrease the radius, that's easy. use the qubit to control small/misaligned rotations on other qubits (that's what I do in the above circuit). Partial measurements also work, as long as you don't condition on the result.
Comment: @ParveenKumar What kind of measurement operator do you want? An axis? An observable (Hermitian matrix)? A POVM?
Comment: You can measure and then decide randomly, using coins of different bias for the two possible outcomes, whether to keep the result. That will increase the purity but not to 100%.
Comment: @EmilioPisanty That will work if you replace 'whether to keep the result' with 'whether to post-select'. Measurement will increase the purity, but not necessarily maintain the direction (my interpretation of the question is that they also want to maintain the direction).
Comment: Thanks for the reply. Yes, directions are fixed. We can imagine the situation on the Bloch sphere. The required job is to change the length of Bloch vector while $\theta$ and $\phi$ are fixed. Proper measurements operator can change the length of Bloch vector without changing directions but I don't know the procedure how to choose appropriate measurement operator.
Comment: Hermitian matrix won't work because Hermitian matrix provides only rotation on the Bloch sphere. They can't change radial vector. They changes only $\theta$ and  $\phi$. Probably POVM is required to increase the radial vector without affecting the angles.


Is a diminished chord ever considered an incomplete dominant 7 chord?

Question: I noticed that if the root note of the dominant 7 chord is omitted, it makes it a diminished chord. Here is an example: if the G note in the G dominant 7 chord is omitted, it becomes a B diminished chord. So, is the diminished chord even considered an incomplete dominant 7 chord?
Comment: Do you mean, "is the diminished chord eveR considered an incomplete dominant 7 chord?"
Comment: The short answer to your question is yes.
Comment: I think context is pretty important here. If you are analyzing (for example) a Mozart Piano Sonata, you will never see a `viio` in place of `V7`, the simple reason being that without the root, the voice leading will not work out. In Mozart's time and place, the voice leading defined the chords and not the other way around. If you are looking at a Jazz Standards, you will see `viio` used this way quite often because there the chords progression is more important (in the written representation of the music, anyway) than is the counterpoint.
Answer: Certainly in some circumstances it functions as a V7 chord. Interestingly/ambiguously, depending on the inversion/voicing, it can pretend to be an incomplete V7 in 4 different (major) keys. :)
I recall, as a kid, thinking that the diminished chords in classical music "really needed to be filled out to V7 chords"... but I've since recovered. :)
If the question is about whether or not various specific practice traditions would consider it so... well, that depends on the tradition. But, still, I'd agree that its sound/function often is V7-ish.
Not always, though! Already in Brahms, and in jazz-standard-type stuff, the voicings often are stretched-out diminished chords, whose function is as much voice-leading as V7. Not going to the tonic or even secondary tonics, etc. Further, as in George Shearings "locked hands" voicings, diminished chords are simply not-quite-in-the-scale passing chords between inversions of something like I69 or other pentatonic-ish chords. It would be a stretch to declare all of them V7-ish, unless one had a very limited list of allowed labels. :)
Answer: There are several theorists (Walter Piston for one) who have suggested that the vii0 is equivalent to a rootless V7. In practice, it's sometimes used that way; the voice leading is identical to the V7-I or V7-i (except for step 5) in that scale step 7 moves to the tonic.
There is another usage of vii0 that is quite different and not equivalent harmonically to a rootless V7. In a sequence (such as those using the Circle of Fifths). In major keys, the chord sequence I-IV-vii0-iii-vi-ii-V7-I is often used with the vii0 in root position where the pattern of fifths in the bass dominates the usual diminished chord voicing.
Comment: To quote Piston: _the leading-tone triad may be disposed of at once [as an exceptional dissonant chord] by declaring it to be an incomplete dominant seventh [chord.]_ Chapter 13, 1st ed.
Answer: Do you mean "...is the diminished chord EVER considered an incomplete dominant 7 chord?"
That simple question deserves a simple answer.   Yes, it sometimes is.  A diminished triad isn't JUST an incomplete dom7, it can do other things as well.   But Bdim and G7 (B, D, F and G, B, D, F) both contain the tritone B - F, and when it resolves to C - E there's certainly a dominant - tonic thing going on!
Bdim can also resolve to Bmajor, which is acting quite differently to G7.  Or to F♯7(sus4)...   So it isn't merely an incomplete G7.  But it can do that.
Comment: I think the chord that resolves to B major must have B Cx and E♯, not B D and F. The Cx and E♯ might be non-harmony notes (just neighbour notes to the D♯ and F♯ of the B major chord). Or, in the right context, it might be V7 of V of B major with its root C♯ chromatically raised.
Comment: @Rosie  "V7 of V of B major with its root C♯ chromatically raised".    Amazing the hoops people will jump through to force EVERYTHING to be a 'cycle of 5ths' progression, isn't it!
Answer: The short answer is no. Your observations are correct but a diminished triad and a dominant 7th chord are two different things. Following your logic you might ask if an Em chord is an incomplete Cmaj7 chord or a host of other scenarios.
A diminished chord sometimes but not always functions much like a dominant chord though. Take your G7 and Bdim. Both are diatonic to the key of C. Both contain a tritone interval that resolves inward to a major 3rd on a C chord. However both are not 7th chords and both do not contain a major triad. The diminished triad on its own doesn't imply a dominant seventh chord with no root.
Answer: Yes, but pay attention to the context of the music and whatever you are analyzing.
For example, don't try labeling a perfect cadence in a passage with viio I, justified by viio = V7. Certain passing diminished chords aren't necessarily incomplete dominant seventh chords. There are times when the specifics, not equivalencies, are most important.
Answer: A diminished 7th chord is a V7b9 chord without the root. Every diminished 7th can substitute for a V7b9 and vice versa. The issue is that a diminished 7th chord has 4 V7b9 chords and not every one will work in the global context and they do have different sounds in some cases[In the sense that it might not be what you want due to subtle implications due to the larger context. Sorta like how in English(or any language) some words have multiple means].
You want to always think of a dim7th as also being 4 V7b9 along with variations such as #ivo7, #vio7, io7, etc.
It is not about it being a specific thing. It's a color, a sound. You simply want to learn how it works by usage rather than try to peg it to some ideal or specific thing that it must be. It can be anything. You can make a diminished chord be a minor chord, a major 7th chord, or whatever. It is harder to do but if you've established Cmaj7 as the quality for the C chord and then play Cdim7 you are essentially combining Cmaj7 and Cdim7 and it will color that Cdim7 as a Cmaj7 sound. E.g., if you play Cmaj7 Cdim7 Cmaj7 and Cmaj7 is clearly the quality for the C chord then that Cdim7 is functioning as an alteration of Cmaj7 and it will sound different than if you did G7 Cdim7 G7 in which case the Cdim7 will be functioning in terms of G7 giving a sort of G7 Lydian augmented if the context is appropriate. Of course it might be clear it is part of something else, e.g., G7 Ab7b9 G7 if that is more natural. It all depends. Also different people will have different "expectations". It's not about tying things down and saying it has to be X. We get in to the trap because "basic" harmonies are generally not ambiguous(but they can be) and we think all other harmonies sorta have the same simple interpretation. Ultimately one just needs to familiarize themselves with how harmony works and how to name chords/colors and then everything else takes care of itself. Once you understand it through experience then you realize it is not something that can be explained using worse because the words are not the thing. You just know how to communicate the basic color and then use your intuition(experience) to interpret it and understand it.
For example, in moonlight sonata there is a section of 3 dim7th arpeggios(2 out of the 4 possible) over a G# bass. The G# acts as the V7b9 chord for the C#min tonic but the diminished sound is expressed and not the dominant sound due to the arpeggiation of D#o7(a V7b9), then C#o7(a io7 or a #ivo7 etc), then F#o7(V7b9). All these though are essentially a G#7b9 sound as Beethoven peddles the G# to reinforce this. In each case though they are variations of coloration of the V7b9 chord. In the case of C#o7 over the G# bass, it creates a Lydian augmented sound: G# C# E(D##) G Bb(A#). The G and A# are the maj7th and maj9th and act as dissonances but work because they make sense locally(It's just a Dim7 chord) and make sense globally as just dissonances that resolve to something that works/make sense next(A true G7b9). The point here is that it doesn't matter how you think about it. Maybe the lydian explanation I gave is nonsense because it makes more sense to think of it just as a C#o7 chord over a G# pedal. Ultimately it depends on context and what one is trying to do with it. (e.g., if you are improvising you might want to think of it as sort of Lydian augmented so you can come up with new material that still relates in some way)
The the entire point of a dim7th chord is that it has many different interpretations and this can help one reinterpret it different to lead to different harmonic consequences. Not everything will work, one has to learn how it works through experience.
Diminished 7th chords have unique tense sounds and so the point is that they can act as drivers of momentum and interest and you won't learn how to understand that unless you learn to use them through improvisation which requires you to master the technical aspects of them such as learning their arpeggiations and chord forms along with the scales that fit them.
Again, the idea is that if it fits then it fits. It may not be the best fit but the idea is not to try to narrow down but to expand. You want to understand all the ways, not just one way. There is no best way(although there is, generally, a best way in terms of memorization and recall because our brains will latch on to what is the most "obvious" understanding but that depends on our experiences).
E.g., if you can see a chord/melody/scale/theme/etc as X, Y, Z, A, B, C, Q, DFS, AIKDFJKSJF, ETEREA, etc then it is better than to see it just as X or A.
Most of the time in musical analysis we simply choose the most direct understanding because most music is pretty simple. For example, a i chord in our traditional CPP understanding generally is pretty simple and most people use it in a simple way. This does not mean it doesn't have far more complexity but that complexity has yet to be understood by modern music and modern ears. Over time things develop as people "discover" new things and they become popular. With 12-TET though there is a limitation because there has to be some separation between colors or you just have noise. So really what we do as humans is have a sort of basic palette of colors then a few colors that we can use that are very special and complex and this offers us a nice balance and set of building blocks to do interesting things. One should learn basic harmony and theory in this nature but realize it's just a topological analysis of music... it isn't music. Ultimately if one wants to be a true musician they have to develop their own understanding that transcends words and this can only come through "practice"/experience and this is what ultimately separates the "masters" from everyone else.
Answer: A dominant seventh chord (V7) generally resolves to i, unless we're in Blues territory. Component-wise, a diminished is an incomplete dominant seventh chord - however, one main component is missing - its root. So we can't call V7 - G7 in key C, without that root, an incomplete dominant  seventh, as it can't even be named G7 - that G isn't there.
That apart, any diminished triad could and often does (it's one of its useful positions)lead to other places. True, BDF could lead to CEG, actually making iio>I, but could just as easily move to E♭G B♭, or F♯A♯C♯.
So, no is the answer. Unless a different instrument (bass, maybe) was providing that root (of G here).
Comment: The root of a V7 chord is generally the third most important note.  If one is producing a three-part arrangement of a piece of music in C, and the melody is descending G-F-E, it would not be unusual for the lowest part to go C-B-C and the middle part to go E-D-C.  I would not describe such an arrangement as reharmonizing the V7 to a vii0, but nor would I fault someone who given the three-part version described the B-D-F chord as a vii0.


2 different Online-Shops in one Magento with same stock management

Question: Is it possible to have 2 complete different shops (different product page but same products)? The on stock management should be same for both shops.
Answer: Yes this is possible. Actually this is one of Magento's strongest features. Your requirements are described very limited, but you should be looking into Magento's storeviews, stores and websites.
Start reading here: http://devdocs.magento.com/guides/v2.1/config-guide/multi-site/ms_over.html
You can have your shops on different domains, you can have the shops on the same domain but in different folders or subdomains. You can share products and other entities (customers, catalog, etc.) over different shops. There are many possibilities.


Why is entropy increased when a bit is erased?

Question: I'm writing a report on Landauers principle, and I can see that compressing the volume of the "merged" state requires some work for the system to be able to continue. But, I cannot accurately formulate exactly why mapping 2 possible states to 1 firm state increase "disorder"? If someone could make it clear to me, that would be greatly appreciated.
Comment: From  the physics side, any interaction introduces more microstates and thus increases disorder. Your "work" means interactions. From the information entropy side somebody who knows about it should answer.
Comment: Hello! if you think the answer I posted is satisfactory you can select it as the correct one. Otherwise you can point out why it wasn't helpful. Hope it helped!
Answer: The laws of physics are, at a fundamental level, reversible, so "mapping 2 possible states to 1 firm state" is actually imposible. This is easy to see: if you are in one of the two initial state you certainly know where you are going (to the 1 firm state) but if you are in the final state you don't know where did you came from (it could be either of the 2 possible states).
However, bits can be "efectively" erased. Supose you have a spin that can be either up or down (that's the same as a bit that can be 0 or 1) and you want to "erase" the information of that spin. You would want to make that spin up whether it was up or down (a.k.a. mapping two possible states to 1 state).
In order to do so, you have to send the information of the original state somewhere, it just can't dissapear. What you can do is this, take another spin in the enviroment and map your spin state to this one and then "erase" your spin. for example
Initial state:    Your spin is down
final state:      your spin is up  and enviroment spin is down
Now you "erased" the information within your system but you have stored the missing bit by fliping a spin in the enviroment. That information is tecnically lost, so you have indeed erased a bit for your system. Evenmore, in order to do so, you had to increase disorder in the enviroment, what caused an increase in entropy.
if you do the math you'll see that the entropy increase is ln(2) which accounts for the two possible configurations that you have added to the enviroment.
Landauer Principle is very important because it relates information entropy with thermodynamic entropy in a very clear way.
Hope this makes it clear.


Calculation of labor, capital and productivity deviation

Question: In  Ohanian (2010): The Economic Crisis from a Neoclassical Perspective ( https://pubs.aeaweb.org/doi/pdfplus/10.1257/jep.24.4.45 ) I read about labor, capital and productivity deviation. I would like to calculate those numbers for the current economic situation (2018 - 2020+) but I don't understand how the calculation works. Can someone explain to me how those are calculated? Which data do I need?
Answer: The details are outlined in the original Business Cycle Accounting-paper by Chari et al. (2007) at https://onlinelibrary.wiley.com/doi/abs/10.1111/j.1468-0262.2007.00768.x
A replication is at https://github.com/JohannesPfeifer/DSGE_mod/tree/master/Chari_et_al_2007