Steps towards TDD

Question: I need some advice to take the steps for TDD. How do we think in terms of interfaces for everything when we are writing code? Most of the testing books tell you how to write tests. But I want a book which tells whats the good way to write code in terms of TDD
Comment: Write your code *functionally;* that is, write code that accepts values and returns values, with no state side-effects. Functional-style code is easier to write unit tests for.
Comment: "How do we think in terms of interfaces for everything when we are writing code?" - Remember, an interface doesn't have to be an `interface`.
Answer: How do we think in terms of interfaces for everything when we are writing code?
YOU DON'T
Some of the other answers have touched on proper courses of design, but the unstated assumption in the question is subtle and flawed and deserves to be dragged kicking and screaming into the harsh light of day.
YOU WRITE THE TEST FIRST
It's common to read about TDD and think 'yeah that is a great idea' and then not do it. Instead, it's easy to fall back into code-first habits, and then wonder how you're supposed to think of all of the required and convenient interfaces as you're writing the code. Ya don't!
NO, SRSLY, WRITE THE TEST FIRST
Writing the test first forces you to invent the interface before you write the code. So you're not thinking about the code at all, you're thinking about the interface to test the code.
TDD IS NOT UNIT TESTING
TDD tests features, not units. Feel free to add unit testing and code coverage et al if you want, but all TDD requires is that every feature has automated tests. [But look into BDD for even easier test specification]
RED-GREEN-REFACTOR
This process will create the interfaces, get the code working, then refine the interfaces and the code, incrementally.
If you find during the refactoring step that, say, dependency injection (DI) would simplify the design, great, use it. But don't start with DI or any other tactic/technique as a preferential hammer. Let the code be your guide, and let the design evolve naturally, one test at a time.
Comment: +1 I agree with everything... except the oversized font. :P
Answer: One of the biggest ways to make your code testable is to use Dependency Injection. This allows you to have a default implementation of the programming logic, but then when you go to test, you can mock that implementation in order to facilitate the tests.
public interface Model {
  //methods
}
public class DefaultModel : Model {
  //default implementation
}
public class Worker {
  private Model _model;
  public Worker(Model model) {
    _model = model;
  }

  public void DoSomething() {
    var result = _model.Action();
    //...
  }
}

//real code
Worker worker = new Worker(new DefaultModel());

//test code
public class TestModel : Model {
  //code for testing
}
Worker worker = new Worker(new TestModel());
//do testing of worker

Following this model, you can test Worker without needing the real implementation of DefaultModel and things it might depend on. You would then have separate tests to ensure DefaultModel is correct.
Here is a tech talk that is about writing testable code. I haven't watched it, but I've seen one given by the same guy. I just couldn't find a link for the one I watched.
Comment: +1 Refactoring stuff behind interfaces really does get you about 90% there
Comment: While TDD often leads to use interfaces and DI-related ideas, it bothers me to see an answer which says nothing about writing tests first. Your code may end up looking that way, but this is a side-effect of TDD.
Answer: The principles of TDD are inherent in its name. The very first thing to keep in mind is, test first.
When you write a test that will exercise a new, previously unwritten object or method, you are basically defining the usage (translated: interface) for that new piece of code. That forces you to examine how you will want to use this code, which is critical to good design.
TDD also encourages a Single-Responsibility way of thinking. You need a new piece of functionality that will run every minute, get some data from the DB, perform some arbitrarily-complex calculation, then write the result back to the DB. Well, the first thing you need is code that will run every minute. So you create a Timer. Then, the timer needs to get something from the DB. That sounds like its own responsibility, so you mock out the use of some DB reader object. That forces you to think of how you want to use THAT object. This inherently-recursive system of defining the usage of something new before you define that something new generally leads to making decent, or at least easily-refactorable, design decisions.
As far as strictly thinking about interfaces, that's not really TDD, that's just "SOLID" design, specifically adherence to the "Dependency Inversion Principle" (stated succinctly, "classes should always depend upon abstractions, never upon other concrete classes"). If your class BusinessLogicObject requires code to write to the DB, it should never be dependent upon a concrete class DBWriter, but instead upon an IDBWriter. This promotes "loose coupling"; that way, if down the line you wanted to swap DBWriter for BetterDBWriter, then as long as BetterDBWriter implemented the same IDBWriter interface, you wouldn't have to change BusinessLogicClass to create or work with BetterDBWriter.
Answer: In my humble opinion you need several skills before you can become good at TDD.
First you need an understanding on how to build SOLID code, Agile Principles, Patterns, and Practices in C# (Robert C. Martin)  is great for that. A short introduction is on DimeCast.
You also need Unit test knowledge

an introduction : The Art of unit testing
the bible : XUnit Test Patterns

Than TDD knowledge:

TDD by example
Growing Object-Oriented Software, Guided by Tests

And than you have read all the necessary knowledge and you need to make a mind shift. And the only way I know on how to do that is just by doing. Getting a coach would be great. Also to get a feeling for how the process might work you could watch James Shore's "Lets play TDD" 140+ screencasts.
Answer: Since you're on .NET you might want to watch DNRTV with the early episodes on TDD to get a good overview of that (and get a glimpse of the the MVC pattern).

DNRTV - JP Boodhoo on TDD Part 1 of 2 | (alt. link)
DNRTV - JP Boodhoo on TDD Part 2 of 2 | (alt. link)

JP Boodhoo goes through TDD quite clearly together with the concept of interfaces and dependency injection in those videos and at least helped me get a groove on how to do it.
Answer: The biggest point of interfaces in test code is the idea of "seams" used for "test isolation".
To unit test properly, you have to be able to isolate the code under test completely, so the only production code running is that under test. To do this you will have to replace other objects it depends on with fakes.
To do this quickly, mocking frameworks exist and they can quickly build fake objects that implement the interfaces you need, that way your code doesn't depend on the concrete type and a fake can be passed to the code as part of your test call.
Dependency Injection is to do with ensuring production code knows which concrete type to pass to your code.
Answer: Read Clean Code by Robert C. Martin.  You will learn how to write good code, and good code also happens to be easily testable.

Steps towards TDD


How can I render a specific node as the content for the maintenance page?

Question: Given a nid X, how do I have Drupal render it as the content for the maintenance page?
Comment: A maintenance page needs to be available when the database isn't available. So basing it on anything that comes from the database, like an entity, probably isn't going to work out
Comment: @Clive Yeah, that's certainly a valid point. In this case the only concern we really have though is the maintenance page for during a site upgrade, not during "catastrophic failure". I think my first attempt at solving both issues would be to cache the maintenance page in varnish/nginx and return that if hitting a 5xx.
Answer: Use the Twig tweak module and create an overwrite template for maintenance-page.html.twig. Then copy & paste stuff from your base theme, but replace {{ page.content }} from the base theme with {{ drupal_entity('node', X) }}
E.g. for stable 9 theme this would look like

  {% if logo %}

  {% endif %}

  {% if site_name or site_slogan %}
    {% if site_name %}

        {{ site_name }}

    {% endif %}

    {% if site_slogan %}

{{ site_slogan }}

    {% endif %}
  {% endif %}

  {% if title %}

{{ title }}

  {% endif %}

  {{ page.highlighted }}

  {# disabled {page.content} here #}
  {{ drupal_entity('node', X) }}

{% if page.sidebar_first %}

    {{ page.sidebar_first }}

{% endif %}

{% if page.sidebar_second %}

    {{ page.sidebar_second }}

{% endif %}

{% if page.footer %}

    {{ page.footer }}

{% endif %}

Comment: This looks really promising, but is there a way to do it without adding Twig tweak?
Like could I pass in the node as an argument in the preprocessor?
Comment: Just google `drupal programmatically render node`, you'll find a ton of answers here on this site.
Comment: Apart from that, Twig Tweak really is a very well-maintained, wideley used  - and IMHO must-have - module. This is no big dependency, see it as a collection of code recipes.
Answer: In order to customize the Maintenace Page in Drupal 8/9 We need to do following items but not restricted to:

Create a Basic Page or Article in Drupal for Maintenance page and keep its node id in handy

Update settings.php to include your custom theme machine name in the config value like: $settings['maintenance_theme'] = 'your_theme_machine_name';

Copy maintenance-page.html.twig from batrik theme or core/modules/system/templates/maintenance-page.html.twig and keep at your_theme_name/templates/system/maintenance-page.html.twig

Update your maintenance-page.html.twig as in below snippet to embed the content you have in place from Article/Basic page in 1st step
 {#
 /**
  * @file
  * Bartik's theme implementation to display a single Drupal page while offline.
  *
  * All available variables are mirrored in page.html.twig.
  *
  * @see template_preprocess_maintenance_page()
  */
  #}

    {% if logo %}

    {% endif %}

   {% block article_title %}

              {# disabled {page.content} here #}
              {# render body field from Article or Basic page with specific node id #}
              {{ drupal_field('body', 'node', nid) }}

   {% endblock %}

In order to  have some static page like maintenance-page--ofline.html.twig in drupal 8/9 as in Drupal 7 when Database is down we need to refer to the ongoing discussion on issues: https://www.drupal.org/project/drupal/issues/2720109
We can also refer existing discussion: Drupal 8 maintenance page theming


What is the icing probability required for an AIRMET?

Question: For an icing AIRMET to be issued, moderate icing must be forecast over an area of at least 3,000 square miles. What probability of moderate icing is required before that AIRMET will be issued?
Answer: For any AIRMET, the event must have a probability of 50% at least (that is more than playing playing heads or tails).
Related US NOAA definition for AIRMET Z:

AIRMETs are issued every 6 hours, where there is a 50% probability
  that any of the following en-route weather phenomena will cover an
  area of 3000 square miles or greater.

Phenomena for AIRMET Z are:

Icing: Areas of moderate airframe icing, other than convectively
  induced, including the areal extent. Freezing Level information is included after AIRMETs for moderate icing or statements indicating that no significant icing is expected.

Freezing level is defined as:

The lowest freezing level above the ground or at the SFC as
  appropriate. Freezing levels are delineated using high altitude VOR
  locations describing the location of the lowest freezing level above
  the ground or SFC as appropriate.
Freezing levels above the ground are delineated at 4000 feet intervals
  above mean sea level (AMSL). Multiple freezing levels above the ground
  are delineated using "BOUNDED BY" followed by high altitude VOR
  locations. The range of freezing levels across the forecast area is
  also included.

G-AIRMETs, the graphical version, are issued every 3 hours (but still describe the next 6 hours).
Comment: Thanks for the quick answer. This one stumped a number of people, including in follow-up to my asking this during a webinar on the subject. I'll take a brief wet noodle lashing for inadequate searching before asking the question here: I didn't phrase my searches broadly enough.
Comment: @mins is a much respected Hanshi master in the ancient art of Google-Fu. Do not despair. Few can match his skills.
Comment: Btw, your GPS knows where you are. The NSA knows what you're doing there. Google knows what you're thinking while you're doing it


Receive money from US Client to Myself in India by selling services

Question: I have some clients in United States that I am doing some software development for them.  How can I receive money from them. What are the exact legal steps that I need to take so this works perfectly?  Paypal is a big headache that we donno when it blocks our account.  So, what are the steps needed for this ?  (like registering a company, and what kind of company to register(ltd, private ltd etc).
Answer: You can receive funds from US Client as an individual. There is no legal requirement for you to have a company. If the transactions are large say more than 20 lacs in a year, its advisable to open a Private Ltd. Although its simple opening & Registering a company [A CA or a Laywer would get one at a nominal price of Rs 5000] you can do yourself.
Whatever be the case, its advisable to have seperate accounts for this business / professional service transactions. Maintain proper records of the funds received. There are certain benefits you can claim, a CA can help you. Paying taxes in Advance is your responsibility and hence make sure you keep paying every quarter as advance tax.
Related questions
Indian citizen working from India as freelancer for U.S.-based company. How to report the income & pay tax in India?
Freelancer in India working for Swiss Company
Freelancing to UK company from India
How do I account for money paid to colleagues out of my professional income?
Answer: Depending on how tech savvy your client is you could potentially use bitcoin. There is some take of indian regulators stopping bitcoin exchanges, meaning it might be hard to get your money out in your local country but the lack of fees to transfer and not getting killed on the exchange rate every time has a huge impact, especially if your individual transaction sizes are not huge.


Classic sci-fi anime, where mechs are launched by space shuttle like booster system to hotspots on earth

Question: I am looking to find the name of a series for which I had seen a few episodes quite a while back - say about 15 or so years back - on either Animax India or AXN (AXN India used to show some anime shows when it first started). It basically had the art style of classic mecha anime - think like Macross or older Gundam series or the first metal gear panic series.
It was a more military-themed, United Earth possibly, where earth forces used to launch mech suits strapped to Space shuttle type booster rockets and fuel pods to possible hot spots or where the aliens were attacking(or bad guys?). I am not sure about the details of who the antagonists were in the series - but the mech plus booster rocket launch sequence stood out to me.
Any clues or help would be appreciated!
Comment: Welcome to Science Fiction & Fantasy! This question would be improved if you went through the checklists here; [How to ask a good anime Story-ID question?](https://scifi.meta.stackexchange.com/questions/11874/how-to-ask-a-good-anime-story-id-question) and here; [How to ask a good story-ID question?](https://scifi.meta.stackexchange.com/questions/9335/how-to-ask-a-good-story-id-question)
Comment: Reminds me of *Captain Earth*, but that's from the mid-2010s. I think Jacob C might be right; if there's any other details you can remember, please add them. Every little helps.
Answer: Without further details narrowing it down, multiple mecha series probably match the question as it stands. One possibility is Robotech (the English language series which through editing and changed dialogue glued together the mentioned Japanese series Macross with a couple of other unrelated but stylistically similar anime series).
The "Shimada Enterprises SC-32 Roc Trans-orbital Transport Space Shuttle" seems like what you describe.
From an entry on the site "Mecha Journal" which in turn credits the "Unofficial Robotech Reference Guide 2066 edition":

During the war with the Robotech Masters, these simple cargo shuttles were rapidly built and modified to carry mecha into combat.
Comment: *Gunbuster* also [had Mecha that spaceship *forms*](https://www.youtube.com/watch?v=l0vCY3I5yxo) but that doesn't quite match the question.


send verification mail in flutter/dart development

Question: I'm New to flutter and dart mobile app development. how to implement forgot password and send verification mail in flutter/dart development or is there any way to implement to send mail.
Comment: I added the dart server version of this question [here](https://stackoverflow.com/questions/56194778/send-user-verification-email-from-dart-server)
Answer: I don't think there is any way to send an email from your flutter application. This is something I would definitely implement on a backend server.
I would implement a 'forgot password' button in flutter, which triggers a http call to the backend which then triggers the password generation and email sending.
Comment: Can you please explain more about your implementation ?
Answer: Yes there are some ways. The most common would be to use firebase as a backend server handling these requests.
You could do it like this
Add these packages to your flutter apps pubspec.yaml file
// latest version
firebase_core: ^1.17.0
firebase_auth: ^3.3.18

On forgot password button click
once you've completed the logic necessary before making the request, call this function
sendResetEmail(String email, BuildContext context) async {
  final FirebaseAuth _auth = FirebaseAuth.instance;
  try {
    await _auth.sendPasswordResetEmail(email: email);
    Timer(
      const Duration(seconds: 3),
      () => CustomWidgets().moveToPage(
        page: const Home(), context: context, replacement: true),
  );
 } catch (e) {
  // error handling here
}

}
This will send an email from firebase to the selected email to reset password.
On email verification request
Once the logic is over, call this function.
bool _isEmailVerified = false;
Timer? timer;
final FirebaseAuth _auth = FirebaseAuth.instance;

the initstate method
@override
void initState() {
_isEmailVerified = _auth.currentUser!.emailVerified;

if (!_isEmailVerified) {
  sendEmailVerificationForUser();
  timer = Timer.periodic(const Duration(seconds: 5), (timer) {
    emailVerificationStatus(context);
  });
}

email verification check function
emailVerificationStatus(BuildContext context) async {
try {
  await _auth.currentUser!.reload();
  setState(() {
    _isEmailVerified = _auth.currentUser!.emailVerified;
  });
} catch (e) {
  // handle the error here
}
setState(() {
  _isEmailVerified = _auth.currentUser!.emailVerified;
});

if (_isEmailVerified) {
  timer?.cancel();

// and move to next page

}}

send email verification function
Future sendEmailVerificationForUser() async {
try {
  await FirebaseAuth.instance.currentUser!.sendEmailVerification();
} catch (e) {
  // error handling}


Kashrut- steam from meat

Question: If steam from a cholent pot condensed on the cover and then the liquid from the cover fell onto a pareve container, is the container now meat?
Comment: Does this answer your question? [Does eating a parev item cooked in an oven with meat make you meaty?](https://judaism.stackexchange.com/questions/59998/does-eating-a-parev-item-cooked-in-an-oven-with-meat-make-you-meaty)
Comment: To the two closure-voters citing https://judaism.stackexchange.com/questions/59998/does-eating-a-parev-item-cooked-in-an-oven-with-meat-make-you-meaty : How is that the same question at all? One is about liquid falling from a pot lid, the other is about baking two things at the same time. Their answers may depend on the same principles, but that's for answerers to figure out: the questions are clearly different.
Comment: https://oukosher.org/blog/consumer-kosher/oven-kosher-find-steam-aroma-factors-change-ovens-status/
Answer: The answer to your question will depend on at least three factors

Whether the liquid from the cover was hot (generally considered to be 110 degrees F, 43C) when it fell into the container - if it was cold there are no issues as taste is not transferred without heat, so one needs to wash and rinse the container with cold water
Whether the container is made of a material which absorbs or not?
If the liquid was hot and the container absorbs, whether the volume of the walls of the container are 60x the volume of liquid that fell

For a practical ruling, you need to ask a Rav since context and details matter a lot.
Comment: Who says that plastic won't absorb hot liquid? There's lots of discussion among poskim whether you can kasher plastic or not, but I don't remember opinions which say it doesn't become non-kosher. Were you contrasting plastic to other materials which would absorb when touching cold liquid, i.e. some materials may be so porous that they could physically absorb  liquids (like sponges) and not be kosherable?
Comment: @Binyomin I agree with you and edited
Comment: Potentially there's also tata gavar here
Answer: Not a complete answer, but an important source about the state of steams and drops created from steam:
שלחן ערוך יורה דעה קח א

אין צולין בשר כשרה עם בשר נבילה או של בהמה טמאה בתנור א' ואף על פי
שאין נוגעים זה בזה ואם צלאן הרי זה מותר ...אם אפו או צלו איסור והיתר
תחת מחבת אחת מגולין אסור (תוספות) אפילו בדיעבד (שם בארוך) וה"ה אם אפו
בכה"ג פת עם בשר אסור לאכלו בחלב (ש"ד סימן ס' ומהרא"י) אבל בזה אחר זה
אין לחוש (תשובת מיי' סוף הל' מ"א ותשובת ר"י ואו"ה) אלא אם כן הזיע
המחבת משניהם דאז אסור אפילו בזה אחר זה ...

SH"A YO"D 108:1

Do not roast kosher meat with non-kosher meat or meat of an unclean
animal in the same oven, even if they do not touch one another. But if
you did roast them, this is permitted ... If they baked or roasted a
prohibited thing and a permitted thing under one (covered) frying pan,
uncovered (from one another) this is prohibited even after the fact.
The same is true if they baked a loaf of bread with meat in such a
manner, it is prohibited to eat it with milk. But one after the other
there is no concern, unless there was sweat from the pan in both of
them...

I've skipped  much of the passage because it's massive, full read is advised.
Comment: YD 93:1 is perhaps more relevant
Comment: I think the case at hand is different. Here we have meat liquid falling into a parve pot - the question is what is the status of the pot
Comment: @DoubleAA Can you elaborate? It seems to me that it's quite the same.
Comment: @mbloch I agree, as I said, it's not a complete answer.

Kashrut- steam from meat


Conditional Alert in SharePoint 2010 list

Question: Is it possible to create an Alert which should only fire when certain field value is blank or something like that ? I don't find any reference for the same anywhere.
Answer: If your alert criteria can be expressed in a view, you can then do this through the UI without code.  Create the view on the list with your criteria.  Then set an alert for the list.  In the section for set alerts for these changes, select the someone changes an item that appears in this view and select your view from the dropdown list.
This option is not easily discovered in 2010 as the option only appears after a custom view exists for the list (except for the task list, which has a number of views included by default).
Answer: You can create a workflow through SharePoint designer to achieve this functionality.
Comment: You're going to give more detail, aren't you?
Comment: Madhur, I believe so..but if already some workflows are running then it will make things more complex.. But what If user wants to subscribe an alert by own rather than something running behind the scene ?
Comment: @Rishi: Can you explain more about this complexity? How about a workflow which can be manually started, in that case the action item on part of user is just starting the workflow rather than subscribing the oob alert. In that case you can name the workflow as "Subscribe Alert workflow"


When will Ubuntu One for Windows be released?

Question: I wanted to know when will the Windows version of Ubuntu one be available? Does anyone have any information about it?
Comment: Ha, I like how on the Ubuntu One site that section starts with, *"Recognizing that many of us are sometimes forced to use legacy operating systems..."*
Answer: We will be releasing a public beta of the Windows client within the next couple weeks. When it's ready, we'll be sure to announce it on the Ubuntu One blog: http://voices.canonical.com/ubuntuone
Answer: Ahem... allow me to quote:

Recognizing that many of us are sometimes forced to use legacy operating systems, Ubuntu One is coming to the rescue. You're invited to beta test our new Windows client for syncing files — just sign up for our free Ubuntu One Basic plan and install the software to contribute.
Answer: The Ubuntu One Roadmap says that "Windows file sync" is coming as part of the Ubuntu 10.10 release:

Windows file sync

Addresses the needs of the many
  Ubuntu users who operate in a mixed
  platform environment of Ubuntu +
  Windows
Will support syncing files
  between Windows desktops and your
  Ubuntu One personal cloud

Also, see the the Ubuntu Weekly Newsletter, Issue 208 for the week August 22nd - August 28th, 2010., which says:

Ubuntu One taking care of Windows users ... not so much users of other
  Linux distributions
Steven Rosenberg, of Tech Talk
  discusses Ubuntu One. A look at the
  roadmap for Ubuntu One reveals the
  following feature planned for Maverick
  — Windows file sync: Addresses the
  needs of the many Ubuntu users who
  operate in a mixed platform
  environment of Ubuntu + Windows ...
  Will support syncing files between
  Windows desktops and your Ubuntu One
  personal cloud ... I wonder, what
  about a free, open-source Ubuntu One
  client that could be used in any Linux
  distribution?
To read the full article go to:
  http://www.insidesocal.com/click/2010/08/ubuntu-one-taking-care-of-wind.html
Comment: The client _is_ free, open source and written in Python. There is nothing to prevent all other distros for using it, but packaging software for other distros is not Ubuntus job. It's much more difficult to make it available on systems like Windows.
Answer: I asked this question on one of the Ubuntu One developer's blog.
It turns out that there is work underway, but no date as of the time I asked.
Comment: @Giuliano , that blog entry is a little old. I believe I found some more recent information. See my post below.
Answer: Ubuntu One for Windows (XP, Vista, Win7 and Win8) has been released. It may be downloaded from here.
Answer: It already has according to their website:
https://one.ubuntu.com/plans/
But only for subscribers.
Comment: I think his is just for contact sync
Answer: We are also extending our platform support to include a Windows client, which will be available in Beta very soon.
http://voices.canonical.com/ubuntuone/?p=617
Answer: Can we just assume that DropBox is the immediate solution: More space, less price, works on windows/linux/mac. I know its not a real "answer" but its my reason for not using ubuntu one. Also I could not even get it working since I think it wants some special Firefox plugin.


wp_list_pages sort order by custom nav menu order

Question: Does anyone know of a way to create a sitemap by using wp_list_pages and have the order by the same orders a custom nav menu?
Answer: Using wp_list_pages you can sort order only by:

'post_title'
'menu_order'
'post_date'
'post_modified'
'ID'
'post_author'
'post_name'

anything else (like order by custom menu order) you would have to write your own function.
But a better way to get it done would be to create a custom walker for it so you could control the output.
Answer: Here's a snippet I use to create a sitemap based on custom menu order:
http://snipplr.com/view/54404/wordpress-custom-sitemap-shortcode-following-custom-menu-order/


When I open blender I have some issues

Question:
When I open Blender this is what happens when I start a new project. How do I fix this issue? I also tried to add a Mesh, just as a circle and it did what the second picture shows. I don't even know how this happened.
Comment: Check if your hardware fulfills the [minimum requirements](https://www.blender.org/download/requirements/). If its does, try to update your graphics driver. If it doesn't use an older version of Blender with lower requirements or upgrade your hardware.
Comment: Hi. Please make the title of your question specific to the problem you are having and not just the general topic. Thanks.
Answer: It seems that your startup file has some issues. You can go back to the factory startup file by doing the following:

Go to File > Defaults > Load Factory Settings. This loads in the startup file that would come with a new installation of Blender.
Go to File > Defaults > Save Startup File. This saves the current .blend file (in this case, the factory one you just loaded) as the startup one.
If 1 and 2 do not solve your problem, you may also have to reset your preferences by going to Edit > Preferences (while in the factory file), click on the menu button in the bottom left corner, and click Save Preferences.
If 1, 2, and 3 still do not solve your problem, you may have to reinstall Blender.

When I open blender I have some issues


Are unequal 5ths going from i to ii°6 acceptable in 4 part harmony?

Question:
Im major this wouldn't work but in minor usually a P5 to a D5 is permitted right?
Comment: Acceptable in what context? Surely this is a subjective question, answerable by "does it sound good"?
Answer: In my experience, this answer really depends on who/what you're learning from, because there are different schools of thought:

Some say that parallel fifths are okay as long as one of the fifths is not perfect. As such, your part writing is correct.
Others specify that P5–d5 is okay, but that d5–P5 is incorrect. Allegedly, since we're moving into the P5 in this latter instance, that's what makes the voice leading more problematic. In any event, your part writing here would still be correct.
Still others think that any parallel motion between fifths, including P5–d5, is incorrect. If this is the case, then your part writing is not correct.

In my opinion, compositional practice from this time period proves again and again that the third option is far too strict. I'm personally in the first camp, but I know many that are in the second camp. The good news is that the first two camps allow your voice leading; as such, unless you have a really strict (and relatively uncommon) teacher/textbook that falls in line with the third camp, your progression is fine.


What to do if a company with bad reputation provides a job?

Question: Is there any advice what one should do in the following situation? I am unemployed in Finland. In Finnish law, if one provides you a job and you decline it, you won't get an unemployment benefit. But now a company that provides a really small salary and has a bad reputation offers me a job via https://kokeile.tyomarkkinatori.fi/Etusivu . I hate to take the job but I'm not willing to live some months without any payment. The job is about selling a product in telephone and my education is on a complete different field.
Comment: @O.Jones is that off-topic? I see a lot of questions that are basically about labor laws of a specific country
Comment: Is it even a question about law? I think this is an on-topic question about accepting what you are given and making the most of the options at hand.
Comment: This is on the edge of being off-topic and perhaps better suited to [money.se] but I think it's within bounds here. For example it would also be good for hiring managers to know whether a candidate they extend an offer to might be accepting it for legal reasons rather than because they're excited about the job.
Comment: Why did you apply for the job?
Comment: This is a valid question and should be reopened.  If the location was the USA rather than Finland, it would not have been closed
Comment: Yeah yeah 0/-3 DVs, but I think it's an interesting question.  So +1/-3 now :)
Comment: Did you apply for this job?
Comment: @Kilisi Maybe it was offered by the employment agency. I do not know Finnish laws, but in Europe there are countries that can force you to take certain jobs if they cannot find employment for you otherwise.
Comment: I got the message from the web site työmarkkinatori that is held by the unemloyment agency if I have understood correctly. Therefore I am afraid to lose my unemployment benefit if I refuse the job.
Comment: @Daniel Messages crossed, but the comment I just posted has two version of the question that I consider answerable. It's more technical / fact-driven than most of our question but this is usually considered on-topic here. We just don't get too many questions from the Nordics I suppose. :)
Comment: I'm voting to close this question as off-topic because it's about labor laws in Finland.
Comment: @CaptainEmacs or it could be a random person offering a job via email, or aliens, hence why I asked the question.
Comment: Why is this offtopic? (I am not the question author)
Comment: Voting to close this as Opinion based. We can´t tell you what to do.
Comment: @Lilienthal is has no clear goal and is basically asking us what to to. The answer could only be take the job, but keep looking or reject the job and start living on your savings. How is that useful for anyone?
Comment: That said, @guest, could you [edit] your question to remove that link and just clarify what that means? Not sure if your question is "Do  I need to accept any offer I get?" or "Does an email via Website X constitute a valid job offer?".
Answer: You should look up if they can actually force you to work at that company. In my country, which has a welfare state that is comparable to the Finnish welfare state, you can't forced into a field if you have a different education and you generally don't have any experience in that kind of work.
Answer: So, let us clarify the question.  Assuming that you are correct on the matter of law, you have three options.
The first is to work for little pay, at a company with a bad reputation, doing something that's not in your field.  Further, it's a job that's generally quite emotionally draining.  (You spend your day calling up people who don't want to be called, and trying to convincing them to spend money on something that they generally won't want or need.  People will react poorly to this.  It is likely to be emotionally draining for you.)  The issue here is that it's a lousy experience, not much money, and it'll make it harder for you to gather together the resources to find a real job.
The second is to accept that this company, by their offer, has deprived you of unemployment benefits, and push as hard as you can on trying to find a real job that is in your field as fast as possible, in the hopes of getting said real job before your money runs out.  The obvious issue here is that you won't be getting any income in the meantime.  If it takes too long for you to get a job, and you don't have the cash reserves to support it, you could be in real trouble.  This one's going to depend on how bad the job market for your type is where you are, and how much money you have available in your emergency fund to cover situations like this.
The third is to try to split the difference.  Being underpaid by a bad company to make sales calls is rough work, emotionally speaking.  Is anyone hiring where you are?  Is there an accessible gig economy?  Is the military recruiting?  Your situation has just been made materially worse, and you need to re-evaluate your available options.  You may not be able to get the kind of job you want fast enough to handle your bills without unemployment, but there's a good chance that there's something out there that you could grab that would be better than the job you were offered.  The issue here is that it splits the difference between the other options.  On the one side, it might still take some times to get employed - you don't have an offer in hand right now.  On the other side, once you do get hired, it won't be as good as the job you want, and you'll probably have to keep looking.
So, first, be sure that you're understanding the law correctly.  If you are?  You have three options to consider, all bad.  Discard the ones you simply cannot accept, and see if there are any left.  If not, lower your standards, and do it again.  Pick the option that is least bad for your particular situation.
Comment: My experience with telemarketing company is they hire quick and fire quick if you don´t make the required sales. So OP could be out of this job pretty quickly how this affects his unemployment is another interesting question.
Answer: Under this system, what happens if you can't do the job?
This mandatory employment strategy is going to lead to many people being matched to work they cannot actually do. What happens to people who cannot actually do the job assigned? Do you get your unemployment benefits back if you are terminated for a lack of relevant skill?
If you can get them back, show up, accept that you will probably fail (as that is what happens to most people who try telemarketing), fail, and then get back to the rest of your life. You never need to list this job on your resume either.
Comment: This is what most people actually do, if they don't want any job at all. Sometimes they accept the offer officially and never show up until they get fired.


Elevation and point data

Question: On arcmap 10.1, I have elevation data that is shown as contour lines (polylines) i also have point data showing the distribution on certain animals. I want to run some kind of statistical analysis to see at what height the animals are most commonly found at, how would i do that/what tools would i use? Thanks
Comment: Do you have the Spatial Analyst Extension?
Answer: the first thing to do is creating a DEM based on your contour lines. If you have 3D analyst, you can build a TIN, and if you have spatial analyst you can use "topo to raster". Then you can extract the values using extract value to point.
If you don't have the extension, either you use "spatial join" to extract the values of the closest polyline (in this case, you are not very precise), or you do it QGIS.
Answer: firstly make a raster data (i.e. DEM or TIN) by 3D analysis tools or also you can make a DEM by Topo to Raster.
After that in Arc toolbox go to spatial analysis tools-------select extraction-------extract values to points.
In order to this select input points data and input Raster data set the path of your output data.
Run the process, you will find the height for every points.

Elevation and point data


How to draw on UIView

Question:
Possible Duplicate:
Subclassing UIView to draw in Quartz

Hello i am searching good example how to draw something on UIView, UIScrollView ... using QuartzCore.
For first try i want to draw a triangle or even a line on some view. Is it possible this implement in UIVIewController ?
Thanks.
Answer: This can be an excellent start up tutorial for Quartz core
Quartz Core Sample From Apple
This includes all basic drawings. No doubt you will need to optimize that.
Answer: The easiest way is to subclass a UIView, have your UIViewController add an instance of the subclass as a visible sub view, and call setNeedsDisplay on it.  Then, when the drawRect method of your UIView subclass gets called, do your quartz drawing on the context given.

How to draw on UIView


Using both whipped egg whites and egg yolks vs whipped egg whites only?

Question: Would you get more leavening if you used both whipped egg whites and egg yolks and folded them into a batter (pancake batter,for example)compared to using whipped egg whites only, and would it make a noticeable difference? If yes, then why is it more common to use just the whites?
Comment: It's no extra benefit, which is why recipes don't call for it.
Comment: Does this answer your question? [Can you substitute whole eggs for egg whites in baking?](https://cooking.stackexchange.com/questions/14214/can-you-substitute-whole-eggs-for-egg-whites-in-baking)
Answer: Whipping egg whites is usually done to make a batter lighter and fluffier. In such a case, adding in egg yolks will likely make the batter denser and less fluffy.
On the other hand, if the recipe has substituted  egg white for egg in order to make a recipe healthier by reducing fat content, you can revert to using whole eggs (1 for every 2 egg whites). The texture will still be different, but that might be what you want.
Comment: No. Even a little bit off egg yolk in your egg white will prevent fluffy meringue formation.
Comment: Even if they're whipped?  I would have thought that whipping the yolks,  just like when whipping whites, would aerate them so it would provide more leavening?
Comment: I mean whipping them seperately. So e.g. you would fold in the whipped egg yolks into the batter first (as the 2nd to last ingredient in the batter), and then the whipped egg whites last.
Comment: That would allow the whites to whip and it would add some air, but the fat in the egg yolks will still make your food denser. This might be what you want (eg. fudgy brownies aren't supposed to be light and fluffy).


Storing meat on the outside of a spacecraft

Question: Could space travelers save space inside their craft by trailing freeze-dried meat on a rope (space tether) behind their space pod?  Presumably nothing would be able to get it out there, and it wouldn't spoil.  Would this be hazardous?
Comment: A slight question: how would they get the meat up into space in the first place?  Presumably they had to pack it inside the craft while launching and deploy it once they were in the vacuum of space?
Comment: Very similar question on space stackexchange: ["Could the void of space act as a good refrigerator for food in long journeys?"](http://space.stackexchange.com/questions/4864/could-the-void-of-space-act-as-a-good-refrigerator-for-food-in-long-journeys/)
Comment: Absolute disaster! unless your space trailer comes with smart propulsion booster to keep up with the acceleration especially during hi speed maneuver in space.
Comment: @CortAmmon Indeed they'd have to park it in the craft for launch, but once coasting in space, surely the occupants would want to move some of the supplies out of the craft so they'd have more room to move.  This goes to user6760 's point as well, they'd need to re-pack for maneuvering, but for the long coast between stars, it would be steady rolling.
Comment: A general case of this could be fascinating.  Instead of just moving the meat outside, with limited increases in livable space, one could look at entire classes of starships which are launched in one configuration and then reconfigured mid-flight to provide a better living experience.  Why waste space on cargo when you can just lash it to the side of the vessel.  Hoberman spheres could also be very useful!
Comment: @CortAmmon Sounds a bit like the [manned Venus flyby](https://en.wikipedia.org/wiki/Manned_Venus_Flyby) plans of the [Apollo Applications Program](https://en.wikipedia.org/wiki/Apollo_Applications_Program#Manned_Venus_Flyby).
Answer: Assuming you are talking about putting a side of beef or a package of sausage outside the spacecraft, rather than processed meat substitute packaged in a sealed foil pouch (which can go anywhere), then what you will end up with is perhaps the worst jerky possible.
The first issue is that the vacuum of space will draw all the moisture out of the meat, dehydrating it. I suspect that the process will be pretty violent, with the water essentially "boiling" out; the temperature will be low but the process will be violent, tearing the fibres of the meat.
Then, the meat will be exposed to high levels of radiation. This will have the positive aspect at first, since it will sterilize the meat, but the end result will be closer to cooking the meat in a badly functioning microwave.
There will also be thermal cooking every time the ship rotates and the meat is exposed to direct sunlight. In Earth orbit the meat will be receiving almost 1400W/m^2 of energy whenever it is exposed to the sun, then it will be rapidly chilled as the ship rotates and the meat is exposed to the cold.
By the time you decide to bring it in and "throw it on the barbie", you will have a shrivelled up bit of something which would resemble old leather. I think at that point I'll reach into the locker and pull out a foil bag of the processed meat substitute, since it will be a lot tastier in comparison...
Comment: https://www.youtube.com/watch?v=lD08CuUi_Ek
Answer: It should be fine, but you won't win any cooking awards.
I don't think the meat would be instantly dehydrated per se; most of the fluid in the meat would freeze solid faster than it could boil away, except from the surface of the meat and any pockets of free liquids.  This could be reduced to essentially nothing by freezing it before exposing it to vacuum.  That would be the immediate effect, however it would probably be badly freezer burned over time, so the quality of the meat might be low.  In addition, the previous answer raises a great point about it essentially being cooked over and over by exposure to radiation.  It would benefit from being in a reflective or radiation resistant wrap, and preferably kept in the shadow of the ship.  In the outer solar system or interstellar space, this wouldn't really be an issue since the sun would be little more than a brighter star and it's heat and radiation wouldn't be very significant.
Comment: Just keep it in the shade until you're safely "interstellar", then just coast along.  This confirms my suspicions.
Answer: I recall a story where beef (or something like that) was shipped between planets in the same system with minimal containers and slow low-energy transfer orbits. It relied on the coldness of space to preserve it for months or a year or two during transit.
The long exposure also decontaminated the meat from a disease present on the supplier's planet, it turned out.


Permanent employee leaving immedialty without any notice

Question: An year into a job role, are there any sort of complications to immediately leaving a permanent position, when in contract employee is required to give 3 months notice ?
Comment: This is going to depend a lot on your contract. Also, why do you want to leave without giving notice?
Answer: Obviously yes - you will have as much trouble as the employer wants to cause you. You would be in breach of your contract; if your employer thinks that causes them damages, they can sue you or your next employer. That's what contracts are there for.
This is something that you should really negotiate. OTOH if you need to leave because of a sick family member, or to serve a jail sentence, your employer may be understanding.
Comment: I agree the OP should talk with his employer.
Comment: _they can sue ... your next employer_ The next employer is not a party to the prior employment contract, and not bound by its terms. Such an action would probably fail before even a court hearing, or if not costs and other losses would likely be awarded against the plaintiff (original company). Reasons to do this are to cause the employee as much trouble as possible, or frighten the new company into not employing them. +1 for negotiation, although "force majeure" would probably apply in the case of jail sentence.
Answer: You'll be in breach of contract. It all depends on what sort of monetary/criminal/civil implications there are but nobody here would know as you're the only one with the actual contract. I suggest you read it, and possibly consult a lawyer on what your options are. It's probably best to simply give the notice.
Answer: Depends on your contract really, and even then it would be best to consult a lawyer. If you've undergone any training or courses you may be required to reimburse the cost of the training.


Identify what type of leakage from car

Question: I have a leakage from my car that looks brownish. Not sure what it is. If anyone can guess that will be helpful. I have attached the pictures for closer look.
Comment: Get some and smell it : engine oil smells oily, gearbox oil like cat's piss... but does not look like water.
Comment: it is most likely oil,you need to keep an eye on the oil level and to find the source for the leak,how urgent it is to get it fixed depends on what is leaking.
Answer: Looks like motor oil, but one look under the car is worth a hundred guesses. Likely to be drops somewhere on the car bottom that will indicate where or at least the general location of the car that is leaking.

Identify what type of leakage from car


50 amp stove? and it appears to be gas

Question: My buddy wants me to hook up his stove, but it has a 50 amp cord at the bottom. Why does a gas stove need a 50 amp cord. My stove just has a plug for a 110 volts. His stove is not electric, I'm a little confused, or should I say unlearned.
Comment: Unplug the stove but leave the gas hooked up.  What still works? What breaks?
Comment: a guess: manufacturer provided consumers with the most likely connector to be found behind a stove; it _will_ work, right? check the label for the actual power consumption.
Answer: The stove may be one of the more modern types known as having "dual fuel". I have one of those and the cook top burners above are using natural gas while the oven operates on electricity. In fact even the oven has two operating modes selectable between static heat generation and convection with the hot air being moved around.
As such the stove unit has a 50A electrical hookup and a gas line hookup.
Answer: The earlier-posted answer wisely suggests your buddy may have a gas stovetop but an electric oven. If both are gas, perhaps the cord is for an electric ignition. Typically that draws much fewer amps than fifty, but maybe that's what the cord is for.
Comment: If you came across a gas-only oven (which used electricity only for ignition and oven light) and it was plugged into a 50A connector, it means the last guy made a serious wiring mistake. Far worse if the connector is NEMA 10, because then the oven chassis is grounded to neutral, and an upstream problem with the neutral wire could electrify the oven chassis at 120V right while you're touching it.  Better to reconfigure those fat wires to feed a 120V/20A breaker and receptacle.

50 amp stove? and it appears to be gas


A safety relay systems circuit

Question: Can someone help explain the operation of a safety relay system. I know that they can be connected to e-stops for emergency stops but I don't understand the relays and how they operate.
Comment: Michael, please do not vandalise your posts in such a way as to make the answers already written look stupid. If the image which has been referenced in the answer is no longer applicable or relevant to your question then edit your question to explain why but leave the image there so that the answers make sense. You have done this on other posts too so it shows a repeating lack of respect to those giving freely of their time to educate you.
Comment: See my answer to https://electronics.stackexchange.com/a/240352/73158 for a detailed analysis of a safety relay.
Answer: In general , safety relay contacts are mechanically linked or "force guided". in other words and i quote phoenixcontact " Forced guidance means that the N/O and N/C contacts of an elementary relay are linked to one another mechanically. This prevents N/O and N/C contacts from closing at the same time. When used together with a suitable circuit, failure to open is reliably detected. This is the most reliable way of ensuring maximum safety for both person and machine "
Offcourse addition circuits and interlocks are added to a safety relay module for diagnostics
EDIT after the new image you posted: In the figure K1 and K2 are 2 separate contacts connected in series , the horizontal line with 4 dots near letter K1 and K2 means the contacts are mechanically linked
13-23-33 are connected to 14-24-34 when the relay is energized through A1-A2 . while 41 to 42 will be open. Y32 is not clear what it does , it should be mensioned in the data sheet. S34 appears to be a reset pin if fault occuered.
for more details check this answer : Safety Relay Symbol
Comment: i updated the image if that helps. So when say and e-stop is pressed the N/O contacts close but whats the purpose of the contacts at 41 and 42?
Comment: 41 -42 is the NC contact , if the NO contact is welded this contact will become open ( because of mechanical linkage ) , if you test for continuty on 41-42 you will no that it is open while it should be closed
Comment: offcourse you can do whatever you want with this signal , for example use 41-42 to feed a LEd or PLC input  or shut off supply for something .
Comment: consider this contact a way to know the state of the other relay contacts . In a normal relay you cannot do that , because there is no guarantee that NO and NC will not engage at the same time . I hope this helps
Answer: A 'safety relay' is a dual-redundant safety device meant to shut down a machine even in the event of failures like

An E-stop mushroom pushbutton switch 'NC' contact not opening.
An E-stop relay 'NO' contact not opening.

After the shutdown the 'safety relay' is to prevent a machine restart till the fault is cleared.
For the purpose, the 'safety relay' has 2 relays monitoring each other and other machine E-stop mushroom pushbutton switches via hard-wired logic utilising the 'NO' & 'NC' of these devices.
Earlier this safety function was hardwired in machine controls (especially in cam-operated and hydraulic presses).
Later it became mandatory to incorporate exclusive stand-alone safety relay units, certified by international occupational safety and health monitoring agencies.

A safety relay systems circuit


On Windows, do I need to give any special permissions to my web server user to run a script created by Administrator?

Question: I'm trying to run a PHP script from the webserver that executes other scripts and programs. When I run it manually, everything works fine, but when I run it from the webserver, it doesn't seem to execute it, though I get no error messages. Could be a permissions issue? If so, how can I fix it? If not, well, how do I fix it?
Comment: Which web server software?
Answer: If the errorlog shows nothing of value i usually resort to procmon wich should give you a good hint to find the problem. just start procmon, execute the script through apache2, stop procmon and search for the scriptname or filter accordingly.

http://technet.microsoft.com/de-de/sysinternals/bb896645


Pedals won't turn while riding

Question: Rebuild bike converted to a single speed. Using a tensioner on the chain. Have a three ring chainring and using the high gear (46T) and a 16T cog.  Bike spins great on the work stand but riding it I can't get the pedals to work. Can't understand why I can pedal on the stand but not on the pavement.  Thanks for help.
Comment: You've got to explain that a little better.  By "not work" do you mean that the pedals won't move, or that they move and don't turn the wheel?  Or what?
Comment: Is the chain too tight? So that when you put the bike on the wheels the chain tensioned even further. There should be about 1cm slag.
Comment: Have you checked your chainline?
Comment: Welcome to Bicycles SE. Your question has received a few flags and close votes because it is not clear what the problem is, as indicated in the above comments. For now, your question has been closed. You should see an "edit" button just below your post. Edit in some additional information and your question will automatically be flagged for reopening. We also have a [short guide on how to ask a question that gets good answers](http://bicycles.stackexchange.com/help/how-to-ask) that is worth a read.
Answer: There are three things to check (well, more, but let's start here):

Chainline. Is the front cog so offset from the rear cog that the teeth are catching on the chain? Is the offset so great that when you introduce variance i.e. take the bike off the rack and put it on the road, it's overly-resistant to turning.
Chain tension - per Carel's comment above, make sure your chain is not overly tensioned. This will also cause seizure. I'm guessing this is it.
And because I'm so smart, I have first-hand knowledge of this one, bmx versus road chain, cog, etc. i.e. make sure if you're using a road chain that you're not using a BMX cog and visa versa.

Pedals won't turn while riding


I want a loan that affects credit

Question: I'm 18 with no credit (a collector has been disputed off) I want to get a personal loan of only a couple hundred but I need it to go towards my credit while I'm paying it back. I also want to take out a secured loan. However I want the lowest interest possible. What would be the best type of product to get for this this?
Comment: Is there a particular reason for wanting the lump sum? Make sure it's purpose justifies paying interest (likely at a high rate, if you can get a loan at all).
Comment: Why do you want to do this?
Comment: I want to build credit, while getting a lump sum.
Comment: https://www.studentdebtrelief.us/debt-credit/how-long-does-it-take-to-build-credit/
Comment: Well the lump sum will be diversified, I would use some for a car, some for different investments, then depending on the amount left I would get some Certificate of deposits.
Comment: @Stressed4Success being young with no credit history, the interest you pay on the loan will likely wipe out any investment gains and definitely negate (and then some) any interest from a CD. You'd be better off not getting the loan and investing the money you would use for the loan payments
Comment: Good advice, thank you. I might go with the credit card
Comment: Wow.  If this isn't a troll, it's a pretty good example of what not to do.
Comment: @acpilot yeah I realized that lol. I still dont see too much of a down side for a secured loan. Say it's a $2,000 secured loan, you pay monthly, and once it hit your loan amount you get the lump sum?
Answer: Get a credit card, not a loan.
If you borrow a pile of money, you'll have to pay interest on it, and may be tempted to spend it on unnecessary things.
If you use your credit card to cover your regular daily spending and then always pay it off, you'll pay no interest and establish good credit history.
Comment: Side benefit is you can get a credit card that gives you cashback or rewards, so it actually makes you money instead of costing you.
Comment: @Dugan That may not be possible at first due to OP's lack of credit history (usually cash back cards require at least some history). However, you are absolutely correct. My wife and I make about $50 a month just for spending money on essentials and putting it on our CC (and paying it off completely so no interest).
Answer: You're not going to get decent interest on anything, sadly, but fortunately there are options for which the interest rate is nearly immaterial:
Get a low balance credit card.
Many credit card companies will extend you a limited amount of credit (say, $250), for usurious interest rates.  Get one.  Use it sparingly.  Pay it off in full every month.  You will never pay a dime of interest on it, so the interest rate they charge doesn't matter.
And most importantly: keep that line of credit open for the remainder of your natural life.
There are lots of factors that go into your credit score, but one of the most important is the age of your credit card accounts.  I was fortunate to get a low balance credit card at your age, and I was stupid to close it -- doing so cut the average age of my lines of credit in half and cost me around 200 points on my score.
Comment: A better way of saying it is this: the habit of paying it in full every month will probably end up being more important to you than squeezing a potential few extra points from your score.  It's best to start out that way in any case, and then if you find out that a small % utilization is good, evolve your habits over time.
Comment: I was going to do a credit card, however I've been told many things. "put your phone bill on auto, on the credit card and pay everything but $5" "paying it off doesnt build credit" "buy everyday items with the card and pay it all off" "use the credit card on a big purchase and pay just over the minimum until its paid in full" I'm just not sure. But a secured loan (to my understanding is a loan to yourself) sounds like a great way to build credit, and when the limit is reached and I recieve the lump some it will help me buy a car this month next year. (I say personal loan because I'm sure auto
Comment: @Stressed4Success Some credit tracking sites tell you what's impacting your score.  While I won't endorse any of them, some of the factors they've given me are: 1) average age of your accounts (which I went over in my answer), and 2) credit utilization, which is the amount of money loaned to you divided by the original amount.  For the personal loan, it'll start at 100% and go down as you pay it off.  I.E., it'll initially hurt your score.  For the credit card, it'll start at 0% and go up as you charge to it.  I.E., it'll help your score until you over-utilize it.
Comment: Additional factors are the obvious: number of lines of credit, which is a "good thing" until it's not (i.e., you have too much credit), and number of delinquencies/complaints on your profile -- that is, late payments, accounts in collections ,etc.  I suspect the ones in my first comments are the "big ones" though, assuming you're not consistently defaulting on loans, that is!
Comment: @Stressed4Success As others have already said the best way to build credit is to get a credit card, use it for your normal everyday purchases (i.e. don't buy more things just for the sake of building credit), and pay it off in full every month. Think of your credit score as just being a way of banks to determine how much they trust you to pay money back on time-- e.g. they don't care if you carry a balance of $5. But they will care if you have a longer history of making payments, making all your payments on time, and not having so much credit that you could easily bankrupt yourself.
Comment: So for instance get a low balance credit card and buy ciggerettes and gas, then pay the whole bill off? Or should I hook up a recurring phone bill paying it off in full? Or should I leave a small amount each bill so there still is credit?
Comment: @Stressed4Success There may be minor differences in having some small amount of utilization every month, but you can micromanage that as your understanding of how this all works evolves (and keep in mind that credit agencies can change their algorithms around as well).  The general idea of 1) having the credit card, and 2) using it every once in a while will get you 90% of the way there.

I want a loan that affects credit


Minecraft entity locating

Question: I was just wondering if I can use tilde's in setting a scoreboard count or something. Ideally what I want to do is that the location of an entity to three objectives, the X, Y, and Z, so that I can run a fill command. Thanks
Comment: Hello TameHog and welcome to Arqade. Pretty good first questions, but I fear we're going to need more information. In particular, I don't know how you will link the x y z objectives to your `/fill` command. What is it exactly you are trying to achieve? Do you want to execute `/fill` with coordinates relative to an entity? If so, did you have a look at the `/execute` command?
Answer: There is no easy way to set a scoreboard objective to X Y Z using tildes or JSon or anything like that.
One possible way to do it would be to summon a "tracker" entity at 0,0,0, have it detect (using dz dy dz) which direction the entity to locate is from this tracker entity, teleport the tracker one block in that direction, increment/decrement X, Y, or Z, then repeat until the entities are on top of eachother.
I would explain that method in more detail, but even once you have the coordinates in a scoreboard objective there's not really anything you can do with them, there's no way to use them in a /fill command.

What I would recommend instead is using /execute and then tildes straight into the /fill command. For example, to fill a region from 10,10,10 to the entity's location, you could run:
/execute @e[name=FillEntity] ~ ~ ~ /fill ~ ~ ~ 10 10 10 stone

I'd need more information about what you're actually trying to do though. If you're wanting to fill an area between two dynamic points (rather than a dynamic and a static) then it'd be hundreds of times harder.

Minecraft entity locating


Can zksnark prove DLP?

Question: Can one use zksnark to prove the knowledge of a discrete logarithm? In another word, can zksnark (R1CS) encode exponentiation?
Answer: final_exp_gadget<>() of libsnark could be a practical example to tune for DLP.
The idea is, "final exponentiation" is a part of Ate pairing, that is verified as a part of check_e_equals_e_gadget<>(), which stands for Groth16 verification equation.
Comment: Just curious, if R1CS is eventually translated into arithmetic gate circuit, how would the expnentiation like x^y is encoded as a circuit? Would we end up with a loop of multiplication gates, since "y" is a variable here.
Comment: Start from splitting exponent "y" into bits, then square-and-conditional-multiply loop.  @Sean
Comment: Zokrates is still in my todo pipline, sorry. Gate cost/complexity should be the same as with libsnark, as you suggested.
Comment: That's right! Thanks again!
Comment: I'm looking at zokrate (instead of direclty cut into the libsnark as you suggested) - it looks like its language spec does not support  power operations also the loop is bounded. Are there any particular reason for this? -- in another word, could this make proof generation too costly in zksnark? (looks like not to me - as square-and-multiply would be linear with the number of bits - the number of gates needed cound't be a very large number)
Answer: Yes, for sure! R1CS is an NP-complete language. It is basically a characterization of arithmetic circuits, hence every computation can be expressed as a R1CS.
There are compilers that reduce program executions to R1CS. One of my favourite tools is Zokrates.

Can zksnark prove DLP?


How to change the user and group permissions for a directory, by name?

Question: os.chown is exactly what I want, but I want to specify the user and group by name, not ID (I don't know what they are). How can I do that?
Comment: possible duplicate of [Python: finding uid/gid for a given username/groupname (for os.chown)](http://stackoverflow.com/questions/826082/python-finding-uid-gid-for-a-given-username-groupname-for-os-chown)
Answer: import pwd
import grp
import os

uid = pwd.getpwnam("nobody").pw_uid
gid = grp.getgrnam("nogroup").gr_gid
path = '/tmp/f.txt'
os.chown(path, uid, gid)

Comment: Yes, just pass -1 for the ID you want to ignore as per the documentation (https://docs.python.org/3/library/os.html#os.chown)
Comment: Can I set without providing a `gid`?
Answer: Since Python 3.3
https://docs.python.org/3.3/library/shutil.html#shutil.chown
import shutil
shutil.chown(path, user=None, group=None)

Change owner user and/or group of the given path.
user can be a system user name or a uid;
the same applies to group.
At least one argument is required.
Availability: Unix.
Answer: Since the shutil version supports group being optional, I copy and pasted the code to my Python2 project.
https://hg.python.org/cpython/file/tip/Lib/shutil.py#l1010
def chown(path, user=None, group=None):
    """Change owner user and group of the given path.

    user and group can be the uid/gid or the user/group names, and in that case,
    they are converted to their respective uid/gid.
    """

    if user is None and group is None:
        raise ValueError("user and/or group must be set")

    _user = user
    _group = group

    # -1 means don't change it
    if user is None:
        _user = -1
    # user can either be an int (the uid) or a string (the system username)
    elif isinstance(user, basestring):
        _user = _get_uid(user)
        if _user is None:
            raise LookupError("no such user: {!r}".format(user))

    if group is None:
        _group = -1
    elif not isinstance(group, int):
        _group = _get_gid(group)
        if _group is None:
            raise LookupError("no such group: {!r}".format(group))

    os.chown(path, _user, _group)

Comment: You should check against basestr no?
Answer: You can use id -u wong2 to get the uid of a user
You can do this with python:
import os
def getUidByUname(uname):
    return os.popen("id -u %s" % uname).read().strip()

Then use the id to os.chown


Fragment design: Adapting to multiple screen layouts by showing/hiding fragments within a single Activity?

Question: I am trying to understand how to use Fragments to create apps that adapt well to multiple screens and layouts. I have studied a few examples:

The Fragments document on Android Developer guide.
Google IO app
Fragments sample from ActionBar Sherlock.

All of these advocate a multiple Activity approach:

On a large screen, display a single Activity with multiple Fragments
On a smaller screen, split up the Fragments among multiple Activitys.

I thought of another approach - a single Activity one:

Have a single Activity with all the Fragments in it.
Depending on the screen size and orientation, show/hide the appropriate Fragment(s) (using FragmentTransaction.show() / FragmentTransaction.hide()) .

To illustrate with the same "News article list/article contents" example that Android developer guide uses:

Have the News activity containing both an ArticleListFragment and ArticleReaderFragment.
On a tab, both fragments are always displayed.
On a phone, the ArticleReaderFragment is initially hidden. When an article is selected from the list, the ArticleListFragment is hidden and the ArticleReaderFragment is shown.

Has anybody used a similar approach? Are there any practical downsides this method might have? Does it seem better/worse compared to the multiple-activity way? For example, fragments cannot be shown/hidden in XML - one must use FragmentTransaction for this.

EDIT 1: Description of a Hypothetical Scenario
Imagine an app which can display up to three "panes" at a time on the screen. Further, these are the factors to consider:

A phone can display only one pane at a time (regardless of portrait/landscape orientation)
A 7-inch tablet can display 2 panes, split vertically in Portrait, and split horizontally in landscape mode.
A 10+ inch tablet can display 2 panes, split vertically in Portrait; 3 panes split horizontally in landscape.

For simplicity, lets keep TV screens out of the discussion.
Now, translating this to design:

We have three fragments: Frag1, Frag2 and Frag3.
In the simplest case, All three fragments are in a single Activity (lets call it ActivityA). This is the 10-inch, landscape case.
The other "simple" case is when each Fragment is in its own Activity - ActivityA contains Frag1; ActivityB contains Frag2 and ActivityC contains Frag3.

So far, we have not considered anything which is significantly different from the News Reader example presented in the Android developer guide. The only major difference is having three fragments instead of two.
Now, the case of 7-inch tabs which can accommodate only 2 fragments. How would this work? Note that there are two combinations possible here:

Frag1 and Frag2 are being displayed.
Frag2 and Frag3 are being displayed.

I'm just unable to wrap my head around this. Do I do all of this within ActivityA? Do I just create an altogether new ActivityD? How many layouts would I need to create (I counted around 8)? Isn't it too many permuations?
I do realize that the single-activity approach I proposed above might also not be a good fit for this scenario - since showing/hiding fragments in itself is non-trivial.
Any suggestions on how to handle this without getting overwhelmed with layouts and combinations?
Comment: I would personally use as less activities as possible, given that this question exposes exactly the mess of API that Activities/Fragments is. Instead of transform activities and allow more than one to be shown at the same time, the Android devs injected these "pseudo activities" called Fragments, which have their own lifecycle "kind of tied" to an activity (but not really in all the cases). So dealing with less activities gives you, in my opinion, the closest you can get to imagining a nice world where you only rely on your Fragment(s).
Comment: @MartínMarconcini That is the opinion I am leaning towards of late :-). This works fine until you come across nested fragments and a few gotchas with those.
Comment: Well yeah, nested fragments are a hack on top of a hack, but they "work", kinda. :)
Comment: One thing I will say, fragments load **alot** faster than activities.
Answer: This answer by @Taylor Clark was pretty informative. However, it wasn't an actual sharing of experience with using the single-activity approach as I asked in my original question. I set out to modify the News Reader example from the Android developer guide to use the single-activity approach and came up with a workable solution.
What remains to be seen is what are the use cases where this approach is preferable over the multiple-activity method (or whether there are any such cases at all). Also, I haven't looked in detail about the 3-pane scenario described in Edit 1 of my question.
I hope to post my entire project shortly, but here is a quick overview of how I went about it:

Single Activity: NewsActivity
Two Fragments: TitlesListFragment and DetailsFragment
Both fragments are always present in NewsActivity. Depending on the current dual-pane-ness, I show/hide the appropriate fragment.

Some problems I came across:
Designating a Layout as Dual-pane or not:
In the original News Reader example, dual-pane layouts have a FrameLayout for holding the news Details. We figure out whether we are currently in a dual-pane layout by testing for the existence of this Frame Layout.
However, in my solution, both fragments are always present in all layouts. I hacked this by including a View with id dualPane and android:visibility="gone" in those layouts that I want to be dual-pane and omitting this view in the single-pane layout. Then, it was a matter of
mDualPane = findViewById(R.id.dualPane)!=null;
EDIT:
There are better ways to designate dual pane-ness than having a dummy view. The one I prefer is to create a boolean resource. For example, I have a config.xml as follows:
<resources>
    <bool name="dual_pane">false</bool>
</resources>

I can then place additional config.xml files in folders like values-xlarge-land, values-port or values-sw600dp etc and adjust the boolean value to true or false as I desire.
Then, in the code it is a matter of getResources().getBoolean(R.bool.dual_pane);
Closing the Details Fragment
This was a problem of differentiating between the Activity close and the Fragment close. In the end, I had to override onBackPressed() as follows:

In dual-pane mode, just call super.onBackPressed();
In single-pane mode, if we are in TitlesListFragment, call super.onBackPressed();
In single-pane mode, if we are in DetailsFragment, then treat it as closing the fragment. This means hiding it and showing the TitlesListFragment.

This is not ideal, but it is the best I could come up with.
EDIT:
Based on the suggestion by @SherifelKhatib in the comments, there is a much cleaner way to handle back-button presses: Simply add to the Fragment backstack, the transaction of showing/hiding the details fragment. That way, when you press the back button, the fragment transaction is reversed. You can also pop the backstack manually if you wish to do so on other button clicks.
Comment: Can't hiding/showing a fragment be a Transaction? Thus, this might exclude the need of handling `onBackPressed()`?
Comment: @SherifelKhatib From the top of my head, I cannot find any fault with your proposal :) .. but I guess I should try it out - only then we'll know.
Comment: How does this approach handle Intents and Bundles? If the application is split between multiple activities it's easy to programmatically invoke an intent for a certain list element. Does your multiplePaneActivity act on those scenarios? If so, then how?
Comment: @Rekin it is easy to "convert" intent based communication between activities into bundle based communication between fragments. Buy I suspect that's not what you're asking about. Could you put up some example code somewhere describing your question in more detail?
Answer: Generally applications are split into Activities because each represents a specific "thing" that a user can do.  For example, in an email application a defined set of actions could be:

Viewing a list of messages
Viewing a message's detail
Composing a reply to an email.

Each action could be its own Activity that shows a single (or set) of Fragments. However, if you had the screen real-estate it would make sense to combine the viewing of a message list AND the message detail into a single Activity that can show/hide the "detail view" Fragment. Essentially, Fragments allow you to show the user multiple 'activities' at one time.

Things to consider when making your decision:

Fragments specified in xml cannot be supplied arguments
If your decision is based on screen orientation you can always use resource qualifiers to point to another layout with more/less Fragments (ex. layout-land-large)
Fragments cannot be maintained Activities
Are the Fragments working together to provide the user a streamlined experience?
Is there a time where one of your Fragments will be gone for good? If so, maybe it's time for a new Activity
Go with your gut. If its "natural" for you application to swap-out fragments, go for it. Just remember that if you find yourself doing it a lot, maybe a separate Activity is a more appropriate solution

I've usually employed the "multiple Fragment approach" for tablet versions of applications and a "one Fragment per Activity" for phones, which sounds in-line with your first approach listed. Not that the second doesn't have a time and place, but I could see the implementation getting messy quick!
Sorry for the wordy reply! Perhaps you could tell more about your specific use case? Hope this helps!

Response to Question Edit One

Here's how I imagine your application project could be setup:
Source files:
yourapp.package.phone: NewsActivity1, NewsActivity2, NewsActivity3
yourapp.package.tablet: NewsMultipaneActivity
Resources
layout/
activity_news.xml- phone version, only includes Fragment1
activity_news_detail.xml- phone version, only includes Fragment2
activity_news_<something>.xml- phone version, only includes Fragment3

layout-large/
activity_news.xml- 7" tablet version, includes Fragment2 and an empty fragment container. Split vertically

layout-large-land/
activity_news.xml- same as layout-large, but with the split being horizontally

layout-xlarge-land/
activity_news.xml- 10"+ tablet version, contains all three fragments split horizontally

So what happens here?

If your app is running on a phone, start NewsActivity1
If you app is runnin on a tablet, start NewsMultipaneActivity

Android will swap layouts for you, based on screen size and orientation as long as the file names are the same. Because Fragment2 will always be displayed, you can 'hard code' it into your tablet layouts. Then you can use FragmentTransactions to switch between Fragment1 and Fragment3 in the container as necessary
Be sure to check out http://developer.android.com/guide/topics/resources/providing-resources.html#AlternativeResources to see how you can take advantage of resource qualifiers to mitigate some of the headaches of different screens and orientations
Comment: The original thought behind this question was - how "scalable" is the "separate Activity" approach? Imagine a file browser app. On a phone, I display contents of one folder at a time. On a 7-inch tablet in landscape, I can show two panes. On a 10-inch tab: 3 panes. How about a TV screen? Probably drill-down 5-6 panes side-by-side? I realize that my single-activity approach does little to address this scalability concern. But, there's the headache associated with saving activity state while switching between activities. This can be mitigated if everything happens within a single `Activity`
Comment: The key here is how your application functions. Remember that Activities are supposed to represent a single, focused thing a user can do.
Comment: [Accidentally submitted the comment]
I tend to think that multiple activities, each with a maximum of, say, 5 fragments would be the most scalable solution. At some point there are diminishing returns to presenting more data to the user at one time.

Think about Windows Explorer for example. Each window you can open can be thought of as a fragment. Yes, you can open up 10 file browsrs at once, but things would become cluttered and confusing quickly.
Comment: I see your point about diminishing returns. I still don't see how to predictably work with multiple activities and fragments without running into way too many combinations. Updated my question with a hypothetical 3-pane scenario.
Comment: I have awarded the bounty to this answer since it was very helpful in sorting out my thoughts on the topic. However, I have not "accepted" this answer - Hopefully we get more answers or thoughts on the central point - single-activity-with-all-fragments approach.
Answer: Thank you for this question and your insights. I used multiple-activity approach until I stepped into a problem. My app is like the doc-example news reader. Consider this scenario:

(initial state) I'm using a tablet in landscape mode (two-pane), activity A is displaying article list on the left and some article on the right.
I rotate the device, now activity A is in single-pane mode and displays a list of articles.
I click on a list item, activity B starts with aritcle opened.
Now I rotate the device back to landscape mode.

What's happening? Activity B is displaying an article full-sized, while of course I want to go back to two panes. I'm not sure how to solve this nicely. Of course activity B may check for multi-pane mode and finish itself, and activity A may check what was the last article displayed... That looks ugly. Thoughts?
PS I have a suspicion that GMail app uses single-activity approach. I don't see any activity transition when I select an e-mail from the list. It also behaves properly in the scenario I described.
Comment: Your problem is what Google engineers refer to as "rotational stability". The way I see it - ActivityB is a portrait-mode-only Activity. It should never be displayed in a dual-pane configuration. So basically the solution you described is the way to go . It certainly isn't ugly.
Comment: Hmm where did you see that "rotational stability" term?
I can see your point with "never displayed activity", but the problem is that Android platform does not allow me to enforce that rule in a beautiful way - the activity is just recreated when I switch to landscape mode in Activity B. Any solution in this case looks like a hack to me.
Comment: I remember it being used either in a Google IO talk or in Android Design in Action (can't quite recollect which one). I agree that the "finish itself if no longer required" behavior of Activity B may seem like a hack. But this is how even some of the samples provided by Google work.
Answer: In this article http://developer.android.com/guide/practices/tablets-and-handsets.html#Fragments Google says:

"The approach you choose depends on your design and personal
  preferences."

and

"Other times, however, dynamically swapping fragments for your handset
  design can make your code more complicated, because you must manage
  all the fragment combinations in the activity's code (rather than use
  alternative layout resources to define fragment combinations) and
  manage the back stack of fragments yourself (rather than allow the
  normal activity stack to handle back-navigation)."


How can I set the camera to default to HDR on?

Question: I'd like to set my (iOS7) iPhone's camera to always default to HDR on. I do enable HDR when I'm taking pictures, but it always seems like the iPhone forgets the setting and goes back to HDR off.
Answer: This depends on the "Flash" settings you select:

Flash-Auto : HDR - Auto
Flash-Off : HDR - On
Flash-On : HDR - OFF

So, whenever you force the Flash ON, HDR reverts to OFF. Alternatively, turning Flash OFF retains the HDR ON setting
Answer: On a stock (non-jailbroken) iPhone running iOS 7, this appears to not be possible (see for example https://discussions.apple.com/message/23530580#23530580#23530580). Yes, turning on the flash will automatically disable HDR, but even if the flash is left off the camera will eventually revert to non-HDR mode.


How to communicate securely over a monitored network

Question: Let's say we have Alice and Bob in a chatroom, trying to communicate. They're connected to the same network, but we have the network admin constantly monitoring all data being sent to servers (and received from servers, for that matter). How would they be able to send messages to each other without the Administrator being able to see? Assuming they're sending plaintext messages, nothing complicated
Comment: The admin will *see* the messages, but will not be able to read them. Which goal are you looking for? Hiding, or making it unreadable?
Comment: (I'm voting to close this question as a duplicate because Diffie-Hellman is one possible answer on how to exchange keys over a public channel which seems to solve what you're asking for.)
Comment: The answer is to encrypt the communication. But I think you knew that. What's your real question?
Answer: You might be interested in PGP communication: http://www.pitt.edu/~poole/PGP.htm
Both of you would generate a public key-private key pair on your local systems. Each key pair is mathematically related, that is, a public key is related to its private key. You would then publish the public key, well, publicly for everyone to see. The idea is anyone can encrypt a simple plaintext message using your public key and send you the result. Only you would be able to decrypt the message using your stored private key.
So in this case, Alice would tell Bob their public key, in the chatroom or somewhere else. Bob then uses Alice's public key to encrypt a secret plaintext message, then posts the result on the chat service. Alice grabs the encrypted message from the chat server and decrypts it at their local machine using the secret private key. Similarly, communications from Alice to Bob are also encrypted using Bob's public key.
The steps involved in generating a public key-private key pair are listed here: http://www.seas.upenn.edu/cets/answers/pgp_keys.html


How is teamkilling penalized in BF3?

Question: Is there an anti-TK system in the game? How can I punish somebody who intentionally killed me? Is there some kind of slap or slay system?
Comment: @Bora That is, until they add in hats! What FPS worth its money doesn't have hats!
Comment: I just had a flashback to playing TFC 12 years ago when you said "slap or slay".
Comment: Yeah some kind of slap or slay would be nice... but I will say that I seem to have "problems" with the friendly icons in hardcore mode... they just show up a bit after your turned a corner and spotted som guy barreling down on you...
Comment: @Holger: If you are aware of the team (US / RU) you are on, then it is mostly easy to differentiate between friend and foe looking at his outfit.
Comment: @Bora: Well actually I don't find it that easy to differentiate between the US / RU uniforms... but that might just be me or the faster gameplay on hardcore...
Answer: There is an anti-team-killing setup on the server side of things. Server admins can adjust these as they see fit, but if you team kill enough you'll get booted.
This is what the defaults look like:
Comment: Do you know what typical values are set to? I don't think "A player is forgiven for one teamkill in 0.5 seconds" is reasonable at all.
Comment: My guess is they are left at default right now by the majority of server admins. give it another month or so for people to see how these values work out. It's a balancing act, you want to penalize intentional TKs w/o too severely penalizing unintentional TKs
Answer: There is a server side setting that causes you to be kicked from the server after a certain amount of team kills. This is obviously decided by the server owner, so some servers will have it set very low (maybe even 1 if they're extremely picky) while some will give you lots of freedom (maybe set it to 50?)
Answer: There is no anti-TK system in the game itself, but I expect this to come in a future update.
We all do.. gives the MW3 fraction a leering look
Answer: On PC some servers with the appropriate plugin adopt the following: typing !punish into the chat window after getting tk'ed will punish the offender. Similarly forgiving is !forgive
you can also !votekick
Insane Punisher provides such functionality for PC Servers.
These were all seemingly standard commands on the original Battlefield/Desert Combat servers I played on, not sure if everyone just added in the mods or whether they were in fact standard on the original.

How is teamkilling penalized in BF3?


Sample size calculation - repeated measures, two groups

Question: We want to calculate sample size for detecting the difference between mean depression scores of two groups of patients after three months of treatment - i.e. those who received a specialized mental health intervention ("treatment group") and those received routine treatment ("control group"). These patients are randomly assigned to the two groups. Also, the mean scores are differences between the baseline (pre-treatment) and end-line (post-treatment or at 3 months) scores of the respective groups. So, we wanted to calculate the sample size for detecting the difference in differences. Which is the best approach to follow for this situation?
Answer: Assuming treatment and control 3-month differences are nearly normally distributed, you want a power and sample size computation for a two-sample t test.
In order to get the sample size for each group you need the following:

Approximate variance of data in the two groups,
Significance level of the test [5% ?],
Size of difference you want
to detect, power (probability of detecting a difference of that size, if it exists) [95% ?],
Whether the test is one or two-sided.

Many statistical software programs (and some Internet sites) have procedures for doing the computations. For example, here is output from a power and sample size procedure in Minitab statistical software.
Power and Sample Size

2-Sample t Test

Testing mean 1 = mean 2 (versus ≠)
Calculating power for mean 1 = mean 2 + difference
α = 0.05  Assumed standard deviation = 10

            Sample  Target
Difference    Size   Power  Actual Power
         5      64    0.80      0.801460
         5      86    0.90      0.903230
         5     105    0.95      0.950129

The sample size is for each group.

Notes: (1) If the ratio of the difference to detect to the standard deviation is the same as above $(5/10 = 0.5),$ the required sample size will be the same (for a two-sided test with the same significance level and power).
(2) For cases where the required sample size is large, a rough approximate formula is $n \approx \frac{2\sigma^2(z_{\beta} + z_{\alpha/2})^2}{\Delta^2},$ where $\Delta$ is the difference between population means to detect.
For the parameters above, this approximate formula gives $n\approx 104,$ which is not far from the Minitab value $(n=105)$ for power $.95 = 1 - \beta.$
2*10^2*(1.645+1.96)^2/5^2
[1] 103.9682

(3) A balanced design with equal sample sizes $n_1=n_2,$ is most
efficient, so most 'power and sample size' procedure assume equal sample sizes.
(4) In practice, it is best to use a Welch 2-sample t test (which does not require that the two populations have the same variance $\sigma^2)$, unless you have prior experience with similar measurements and are reasonably
sure population variances are equal. The procedure from Minitab (and many other programs) is for a pooled 2-sample t test, which does require
equal population variances.
(5) Power for the Welch test can be simulated as shown below (in R) for a test
with unequal variances (and also perhaps unequal sample sizes).
Below, sample sizes are $n_1=60, n_2=70$ (bracketing Minitab's $n_1=n_2=64)$ and population standard deviations are $\sigma_1 = 8, \sigma_2=12,$ (bracketing my input to Minitab with $\sigma_1 = \sigma_2 = 10.$
[In R, t.test is the Welch test unless the additional parameter var.eq=T
is used.]
According to the simulation, the power of the Welch test in these circumstances is about $0.8 = 80\%,$ similar
to Minitab's power $80\%$ above.
set.seed(121)
pv = replicate(10^5,
               t.test(rnorm(60, 100, 8), rnorm(70, 105, 12))$p,val)
mean(pv <= .05)
[1] 0.8003      # aprx power of Welch test at 5% level

summary(pv)
     Min.   1st Qu.    Median      Mean   3rd Qu.      Max.
0.0000000 0.0006006 0.0054053 0.0457570 0.0333773 0.9997453

Comment: Thanks Bruce, so shall we use either of these methods in GPower (or any equivalent software) to calculate sample size i.e. 1) ANOVA: Repeated measures, between factors 2) Means: Difference between two independent means (Two groups)
Comment: Thanks Bruce for answering the question so promptly and comprehensively! However, I guess our question was slightly different - We want to calculate the number of participants required to measure the difference in differences between the baseline and endline mean scores of participants of the two groups. We will explain the "difference in differences" below -
- the before-after difference in mean depression scores for the treatment group (B-A).
- the before-after difference in mean depression scores for the comparison group (D-C)
- the difference between the above differences in depression sco
Comment: I believe I did understand and answer your question. Your two samples will be the 3-month differences for treatment group and 3-month differences for control group, and the variance is the variance of the differences. // If you have an ANOVA in mind also testing whether there is any change of treatment or control subjects over 3 months, that is fine. In the end looking a differences in differences comes down to a 2-sample test that's equivalent to a t test. If sample sizes are big enough for that final comparison, they will also be big enough for what amount to paired t tests for 3-mo diff.
Answer: A parallel-group randomized trial is design to compare parallel groups, not to compare change from baseline.  You need to be using ANCOVA with Y=post score and X=baseline score.  Change from baseline assumes linearity and a slope of 1.0 for post-pre.  In depression studies I've seen strong nonlinearity.  The most general analysis that is powerful is a generalization of the Wilcoxon test: the proportional odds ordinal logistic model with Y=post score and using a cubic spline function to adjust for X.  More details are here.
That being said, for planning purposes, when we don't have pilot data that allows us to do ANCOVA, we assume linearity and a slope of 1.0 and use the unpaired t-test on change from baseline for power calculation when there are no intermediate measurements between baseline and 3m.  This will underestimate power because the mean squared error assuming a slope of 1.0 will be higher than the mean squared error that estimates the slope from the data.  But it is better to use the two-sample t-test to analyze change from baseline than it is to get a much bigger mean squared error by using a two-sample t-test without baseline subtraction, which assumes a slope of 0.0.
Comment: Thanks Frank, we also found the following paper that may help. Would you recommend following either of the methods explained in 3.1 and 3.2, if not the ANCOVA, due to strong assumptions in the latter. https://www.ncbi.nlm.nih.gov/pmc/articles/PMC6297128/#appsec1


Do I need an HSA in order to purchase an HSA health plan?

Question: I live in New Jersey and am buying insurance through the healthcare.gov marketplace.  Some of the plans are marked 'HSA'.  Can I purchase these plans even if I don't have a health savings account?  (HealthCare.gov's customer service was unable to answer this question.)
Comment: I think it is very sad that healthcare.gov customer service couldn't answer this question.
Answer: Having an HSA-eligible plan means that you are legally ALLOWED to open an HSA. You are not required to do so. Or if you do open one, there is no law requiring you to make any minimum contribution to it. (The bank that manages the HSA might have minimum deposits, but these are usually small.)
That said, it is to your advantage to open an HSA. This allows you to pay your medical bills with tax-free money. The higher your medical bills and the higher your tax bracket, the better this is for you. If you don't see any need to open an HSA, I think in most cases you would be better off to get a non-HSA medical plan. But without knowing the details of the plans available to you, I can't really say.
Additional thought that occurred to me: It's illegal to open an HSA if you don't have an HSA-compatible plan. If you switch from an HSA-compatible plan to a non-HSA plan, you can keep an existing HSA and you can make disbursements from it but you can't make deposits to it. Anyway, my point being, most people who buy an HSA-compatible policy won't already have an HSA, and it would be illegal for them to have one. (Unless they had previously had an HSA-compatible plan.) So the situation is rather the opposite of what you're asking: It's not that you have to get an HSA before you can buy an HSA plan. You have to get the insurance plan first, then open the HSA.
Comment: Another benefit of the HSA: at age 65 (or earlier in the case of disability), the money in an HSA can be withdrawn without penalty for non-medical purposes (though still subject to income tax), effectively becoming an additional IRA whose contributions are not counted against the annual limit for IRAs.
Answer: That "HSA" marking means that you're eligible to contribute to an HSA when you're covered by those plans. So yes, you can sign up for those plans, and then open an HSA and contribute to it once you're covered by the plan.