Learning FORTRAN In the Modern Era

Question: I've recently come to maintain a large amount of scientific calculation-intensive FORTRAN code.  I'm having difficulties getting a handle on all of the, say, nuances, of a forty year old language, despite google & two introductory level books.  The code is rife with "performance enhancing improvements".  Does anyone have any guides or practical advice for de-optimizing FORTRAN into CS 101 levels?  Does anyone have knowledge of how FORTRAN code optimization operated? Are there any typical FORTRAN 'gotchas' that might not occur to a Java/C++/.NET raised developer taking over a FORTRAN 77/90 codebase?
Comment: Would this text perhaps be interesting to you? http://www.fortranrefactoring.com.ar/papers/Fortran-Refactoring-for-Legacy-Systems.pdf
Comment: @DavidSokol I enjoyed listening to you on the [dinosaur TDL podcast](http://thisdeveloperslife.com/post/2-0-7-dinosaurs), especially with this question for context :) Note, the podcast doesn't mention this, I just remembered seeing it after listening.
Comment: The link above is dead, the document is now here: http://fortranrefactoring.org/papers/Fortran-Refactoring-for-Legacy-Systems.pdf
Answer: You kind of have to get a "feel" for what programmers had to do back in the day. The vast majority of the code I work with is older than I am and ran on machines that were "new" when my parents were in high school.
Common FORTRAN-isms I deal with, that hurt readability are:

Common blocks
Implicit variables
Two or three DO loops with shared CONTINUE statements
GOTO's in place of DO loops
Arithmetic IF statements
Computed GOTO's
Equivalence REAL/INTEGER/other in some common block

Strategies for solving these involve:

Get Spag / plusFORT, worth the money, it solves a lot of them automatically and Bug Free(tm)
Move to Fortran 90 if at all possible, if not move to free-format Fortran 77
Add IMPLICIT NONE to each subroutine and then fix every compile error, time consuming but ultimately necessary, some programs can do this for you automatically (or you can script it)
Moving all COMMON blocks to MODULEs, low hanging fruit, worth it
Convert arithmetic IF statements to IF..ELSEIF..ELSE blocks
Convert computed GOTOs to SELECT CASE blocks
Convert all DO loops to the newer F90 syntax
myloop: do ii = 1, nloops
    ! do something
enddo myloop

Convert equivalenced common block members to either ALLOCATABLE memory allocated in a module, or to their true character routines if it is Hollerith being stored in a REAL

If you had more specific questions as to how to accomplish some readability tasks, I can give advice. I have a code base of a few hundred thousand lines of Fortran which was written over the span of 40 years that I am in some way responsible for, so I've probably run across any "problems" you may have found.
Comment: Also, a nice text regarding fortran refactoring. http://www.fortranrefactoring.com.ar/papers/Fortran-Refactoring-for-Legacy-Systems.pdf
Comment: It is very difficult if the code is not organised very well and pretty much obfuscated by optimisation details. Migrating to fortran 90 style would help you. In addition the later versions of fortran 2008 provide functionality for optimisation.
Comment: It looks like the plusFORT site has moved to here: https://polyhedron.com/?product=plusfort
Answer: Legacy Fortran Soapbox
I helped maintain/improve a legacy Fortran code base for quite a while and for the most part think sixlettervariables is on the money. That advice though, tends to the technical; a tougher row to hoe is in implementing "good practices".

Establish a required coding style and coding guidelines.
Require a code review (of more than just the coder!) for anything submitted to the code base. (Version control should be tied to this process.)
Start building and running unit tests; ditto benchmark or regression tests.

These might sound like obvious things these days, but at the risk of over-generalizing, I claim that most Fortran code shops have an entrenched culture, some started before the term "software engineering" even existed, and that over time what comes to dominate is "Get it done now". (This is not unique to Fortran shops by any means.)
Embracing Gotchas
But what to do with an already existing, grotty old legacy code base? I agree with Joel Spolsky on rewriting, don't. However, in my opinion sixlettervariables does point to the allowable exception: Use software tools to transition to better Fortran constructs. A lot can be caught/corrected by code analyzers (FORCHECK) and code rewriters (plusFORT). If you have to do it by hand, make sure you have a pressing reason. (I wish I had on hand a reference to the number of software bugs that came from fixing software bugs, it is humbling. I think some such statistic is in Expert C Programming.)
Probably the best offense in winning the game of Fortran gotchas is having the best defense: Knowing the language fairly well. To further that end, I recommend ... books!
Fortran Dead Tree Library
I have had only modest success as a "QA nag" over the years, but I have found that education does work, some times inadvertently, and that one of the most influential things is a reference book that someone has on hand. I love and highly recommend
Fortran 90/95 for Scientists and Engineers, by Stephen J. Chapman
The book is even good with Fortran 77 in that it specifically identifies the constructs that shouldn't be used and gives the better alternatives. However, it is actually a textbook and can run out of steam when you really want to know the nitty-gritty of Fortran 95, which is why I recommend
Fortran 90/95 Explained, by Michael Metcalf & John K. Reid
as your go-to reference (sic) for Fortran 95. Be warned that it is not the most lucid writing, but the veil will lift when you really want to get the most out of a new Fortran 95 feature.
For focusing on the issues of going from Fortran 77 to Fortran 90, I enjoyed
Migrating to Fortran 90, by Jim Kerrigan
but the book is now out-of-print. (I just don't understand O'Reilly's use of Safari, why isn't every one of their out-of-print books available?)
Lastly, as to the heir to the wonderful, wonderful classic, Software Tools, I nominate
Classical FORTRAN, by Michael Kupferschmid
This book not only shows what one can do with "only" Fortran 77, but it also talks about some of the more subtle issues that arise (e.g., should or should not one use the EXTERNAL declaration). This book doesn't exactly cover the same space as "Software Tools" but they are two of the three Fortran programming books that I would tag as "fun".... (here's the third).
Miscellaneous Advice that applies to almost every Fortran compiler

There is a compiler option to enforce IMPLICIT NONE behavior, which you can use to identify problem routines without modifying them with the IMPLICIT NONE declaration first. This piece of advice won't seem meaningful until after the first time a build bombs because of an IMPLICIT NONE command inserted into a legacy routine. (What? Your code review didn't catch this? ;-)
There is a compiler option for array bounds checking, which can be useful when debugging Fortran 77 code.
Fortran 90 compilers should be able to compile almost all Fortran 77 code and even older Fortran code. Turn on the reporting options on your Fortran 90 compiler, run your legacy code through it and you will have a decent start on syntax checking. Some commercial Fortran 77 compilers are actually Fortran 90 compilers that are running in Fortran 77 mode, so this might be relatively trivial option twiddling for whatever build scripts you have.
Comment: The Fortran 90/95 for scientists and engineers link is dead, but you can find it on [amazon](https://www.amazon.com/dp/0072825758/) for around 50 USD, or paperback 1st edition for around $25
Answer: There's something in the original question that I would caution about. You say the code is rife with "performance enhancing improvements". Since Fortran problems are generally of a scientific and mathematical nature, do not assume these performance tricks are there to improve the compilation. It's probably not about the language. In Fortran, the solution is seldom about efficiency of the code itself but of the underlying mathematics to solve the end problem. The tricks may make the compilation slower, may even make the logic appear messy, but the intent is to make the solution faster. Unless you know exactly what it is doing and why, leave it alone.
Even simple refactoring, like changing dumb looking variable names can be a big pitfall. Historically standard mathematical equations in a given field of science will have used a particular shorthand since the days of Maxwell. So to see an array named B(:) in electromagnetics tells all Emag engineers exactly what is being solved for. Change that at your peril. Moral, get to know the standard nomenclature of the science before renaming too.
Answer: As someone with experience in both FORTRAN (77 flavor although it has been a while since I used it seriously) and C/C++ the item to watch out for that immediately jumps to mind are arrays.  FORTRAN arrays start with an index of 1 instead of 0 as they do in C/C++/Java.  Also, memory arrangement is reversed.  So incrementing the first index gives you sequential memory locations.
My wife still uses FORTRAN regularly and has some C++ code she needs to work with now that I'm about to start helping her with.  As issues come up during her conversion I'll try to point them out.  Maybe they will help.
Comment: Fortran arrays start with index 1 by default but can be declared to start with any value.
Answer: I have used Fortran starting with the '66 version since 1967 (on an IBM 7090 with 32k words of memory). I then used PL/1 for some time, but later went back to Fortran 95 because it is ideally suited for the matrix/complex-number problems we have. I would like to add to the considerations that much of the convoluted structure of old codes is simply due to the small amount of memory available, forcing such thing like reusing a few lines of code via computed or assigned GOTOs. Another problem is optimization by defining auxiliary variables for every repeated subexpression - compilers simply did not optimize for that. In addition, it was not allowed to write DO i=1,n+1; you had to write n1=n+1; DO i=1,n1. In consequence old codes are overwhelmed with superfluous variables. When I rewrote a code in Fortran 95, only 10% of the variables survived. If you want to make the code more legible, I highly recommend looking for variables that can easily be eliminated.
Another thing I might mention is that for many years complex arithmetic and multidimensional arrays were highly inefficient. That is why you often find code rewritten to do complex calculations using only real variables, and matrices addressed with a single linear index.
Answer: Well, in one sense, you're lucky, 'cause Fortran doesn't have much in the way of subtle flow-of-control constructs or inheritance or the like.  On the other, it's got some truly amazing gotchas, like the arithmetically-calculated branch-to-numeric-label stuff, the implicitly-typed variables which don't require declaration, the lack of true keywords.
I don't know about the "performance enhancing improvements".  I'd guess most of them are probably ineffective, as a couple of decades of compiler technology have made most hinting unnecessary.  Unfortunately, you'll probably have to leave things the way they are, unless you're planning to do a massive rewrite.
Anyway, the core scientific calculation code should be fairly readable.  Any programming language using infix arithmetic would be good preparation for reading Fortran's arithmetic and assignment code.
Answer: Could you explain what you have to do in maintaining the code? Do you really have to modify the code? If you can get away by modifying just the interface to that code instead of the code itself, that would be the best.
The inherent problem when dealing with a large scientific code (not just FORTRAN) is that the underlying mathematics and the implementation are both complex. Almost by default, the implementation has to include code optimization, in order to run within reasonable time frame. This is compounded by the fact that a lot of code in this field is created by scientists / engineers that are expert in their field, but not in software development. Let's just say that "easy to understand" is not the first priority to them (I was one of them, still learning to be a better software developer).
Due to the nature of the problem, I don't think a general question and answer is enough to be helpful. I suggest you post a series of specific questions with code snippet attached. Perhaps starting with the one that gives you the most headache?
Answer: I loved FORTRAN, I used to teach and code in it. Just wanted to throw that in. Haven't touched it in years.
I started out in COBOL, when I moved to FORTRAN I felt I was freed. Everything is relative, yeah?
I'd second what has been said above - recognise that this is a PROCEDURAL language - no subtelties - so take it as you see it.
Probably frustrate you to start with.
Comment: I went through that phase too. In fact I remember "best practices" that minimized the gotchas. But then I went on to Lisp, Pascal, C, C++. I still have to work with some Fortran. The real problem is that most of it is written with very little programmer discipline. People are still teaching Fortran, but they're not teaching discipline.
Answer: I started on Fortran IV (WATFIV) on punch cards, and my early working years were VS FORTRAN v1 (IBM, Fortran 77 level). Lots of good advice in this thread.
I would add that you have to distinguish between things done to get the beast to run at all, versus things that "optimize" the code, versus things that are more readable and maintainable. I can remember dealing with VAX overlays in trying to get DOE simulation code to run on IBM with virtual memory (they had to be removed and the whole thing turned into one address space).
I would certainly start by carefully restructuring FORTRAN IV control structures to at least FORTRAN 77 level, with proper indentation and commenting. Try to get rid of primitive control structures like ASSIGN and COMPUTED GOTO and arithmetic IF, and of course, as many GOTOs as you can (using IF-THEN-ELSE-ENDIF). Definitely use IMPLICIT NONE in every routine, to force you to properly declare all variables (you wouldn't believe how many bugs I caught in other people's code -- typos in variable names). Watch out for "premature optimizations" that you're better off letting the compiler handle by itself.
If this code is to continue to live and be maintainable, you owe it to yourself and your successors to make it readable and understandable. Just be certain of what you are doing as you change the code! FORTRAN has lots of peculiar constructs that can easily trip up someone coming from the C side of the programming world. Remember than FORTRAN dates back to the mid-late '50s, when there was no such thing as a science of language and compiler design, just ad hoc hacking together of something (sorry, Dr. B!).
Answer: Here's another one that has bit me from time to time.  When you are working on FORTRAN code make sure you skip all six initial columns.  Every once and a while, I'll only get the code indented five spaces and nothing works.  At first glance everything seems okay and then I finally realize that all the lines are starting in column 6 instead of column 7.
For anyone not familiar with FORTRAN, the first 5 columns are for line numbers (=labels), the 6th column is for a continuation character in case you have a line longer than 80 characters (just put something here and the compiler knows that this line is actually part of the one before it) and code always starts in column 7.
Comment: This comment is true of FORTRAN 77 and earlier, but not for Fortran 90 and later, which uses free-form source layout.
Comment: Also, the lines are supposed to finish in the 72th column, not 80th.

Learning FORTRAN In the Modern Era


What is the order of an algorithm? Are these of same order $2^n$ and $3^n$

Question: I've two algorithms A whose complexity is $2^n$ and B whose complexity is $3^n$?
I've to find the relation between their orders in big-O notation.

My attempt: As i think order is the highest degree of the polynomial.
So i have to find out $2^n=n^?$ and $3^n=n^?$

Let $2^n=n^{k_1}$ and $3^n=n^{k_2}$
then $$k_1=\frac{n}{\log_2n}\implies k_1=\log_32\left(\frac{n}{\log_3n}\right)$$
Similarly
$$k_2=\frac{n}{\log_3n}$$
Since $\log_32<1$ so $k_1<k_2$ and so $2^n=O(3^n)$

Am i correct or not? Please explain.
Comment: $2^n$ and $3^n$ are both exponential complexity, so there is no polynomial that will adequately represent either of them. Instead, think of whether you can express them as $c_1 e^{c_2}$ form - if they use the same $c_2$ then they're the same order (since the constant out the front disappears in expressing the complexity).
Answer: Recall that two complexities $f(n)$ and $g(n)$ are of the same order if $\lim_{n \to \infty}\frac{f(n)}{g(n)}$ exists and is not zero. So what you need to do is determine whether $\lim_{n \to \infty}\frac{2^n}{3^n}$ exists and is not zero.
For polynomials, you're correct that the exponent of the highest-order term determines the order; for example, $n^3 + 3n + 6$ and $n^3 + 126n^2 - n + 1$ are of the same order, but $n^4$ has higher order than either of them. But this rule is only useful for functions that can be bounded by polynomials; $2^n$ and $3^n$, being exponential, cannot.
Comment: good explanation but how can i prove $\lim_{n \to \infty} \frac{2^n}{3^n}$ is not zero?
Comment: I worked on it and got it . Thanks.
Answer: Notice the following: for all $x$, $2^{n} \leq 3^{n}$. Correct? By definition, $f(n) \in O(g(n))$ if there exists a $k$ s.t. for all sufficiently large $n\geq n_{0}$, $f(n) \leq k\cdot g(n)$. Well, we can just take $n_{0}=0,k=1$ — this is what we just asserted earlier. So we have that $2^{n} \in O(3^{n})$.
EDIT: Oops, too late.


How to change front page template based on url alias?

Question: I have many homepages and template file for every homepage and also a custom template for the front page the problem is when I change the default front page in admin/config/system/site-information to any other alias the page still have the page--front.tpl.php styles not the custom node style page--node--68.tpl.php , any help please ?
Comment: Have you tried to clear your theme cache? you need to clear the theme cache before they will be active.
Comment: @iamroald : yes I cleared the cache, the problem is the url alias became the front page so it reads the front page template not it's own original template .
Answer: In Drupal 7, template suggestions are added/modified in the preprocess function, in this case HOOK_preprocess_page().
Add this to the template.php file in your theme root directory; you may need to create this file.
The problem is that the page--node--id suggestion is weaker than page--front and does not get used. We need to move the page--node--id suggestion to the end of the theme_hook_suggestions array, so it overrides page--front.
Add this snippet. I have added comments to explain what each line of code does. Replace ThemeName with your theme name.
/**
 * Override or insert variables into the page template.
 */
function ThemeName_preprocess_page(&$variables) {

  // Check if this is the front page and a node is the front page.
  if ($variables['is_front'] == TRUE && isset($variables['node'])) {

    // Foreach over the theme_hook_suggestions array.
    foreach ($variables['theme_hook_suggestions'] as $key => $value) {

      // Does the suggestion match the current node?
      if ($value == 'page__node__' . $variables['node']->nid) {

        // Match, unset the template suggestion.
        unset($variables['theme_hook_suggestions'][$key]);

        // Push the template suggestion onto the end of the array, this will give
        // it precedence over page--front.
        $variables['theme_hook_suggestions'][] = 'page__node__' . $variables['node']->nid;
      }
    }
  }
}

I think this is the easiest/quickest way to move an array item to the end, where it will override page--front.
Comment: This is brilliant it worked like a charm thank you so much :D
Comment: You're welcome, and again, sorry for the noise of the first answer, however I'm sure it will help someone some day :)
Answer: Hope this work on you this will allow you define/add your custom tpl base on url alias,
Example: you have url alias /sample then your custom tpl should be page--sample.tpl.php
if you dump the variables variable in theme_preprocess_page you will notice that there's a new tpl suggested in theme_hook_suggestions 'page__sample' you jus need to create a new tpl in templates directory name it page--sample.tpl.php

/**
 * Implements template_preprocess_page().
 */
function exmaple_preprocess_page(&$variables) {
  if (module_exists('path')) {
    $url_alias = drupal_get_path_alias(str_replace('/edit', '', $_GET['q']));
    foreach(explode('/', $url_alias) as $path_part) {
      $template = 'page__' . $path_part;
      $variables['theme_hook_suggestions'][] = $template;
    }
  }
}


Keep cgi applications always running in c++

Question: I have written a CGI application and it is run by Apache server, waiting for requests to process. The fact is that after receiving each request, Apache runs the application, processes the requests and replies accordingly. It has some drawbacks in terms of performance since by receiving each request, it has to load all the necessary requirements and initialization. Another problem is that in the application, I have to keep track of some information for the ACK that the client will be sending later. How can I run the application once, get it always wait to serve the requests?
Answer: It sounds like you want to use mod_fastcgi for Apache. From the web site:

This 3rd party module provides support for the FastCGI protocol. FastCGI is a language independent, scalable, open extension to CGI that provides high performance and persistence without the limitations of server specific APIs.
  ...
  FastCGI applications are fast because they're persistent. There is no per-request startup and initialization overhead. This makes possible the development of applications which would otherwise be impractical within the CGI paradigm (e.g. a huge Perl script, or an application which requires a connection to one or more databases).
Answer: If I am understanding your question correctly you would basically be covered by a finite-state machine. This would allow you to have a "waiting" state, an "action" state, and so on. Using this would allow you to make a request and act only when the request has been fulfilled. A great site for a more in-depth understanding would be "http://www.drdobbs.com/cpp/state-machine-design-in-c/184401236"
Or you could use promises.


Resource not found in Eclipse

Question: I am creating a web application in Eclipse IDE. My project was running fine. Once I did clean project and after that when I am trying to run it its throwing error

resource not found

Also there is a red exclamation mark in front of the project name.
Comment: Have you checked your build path?
Comment: what to look for in build path?
Answer: You have to do few things trying to fix that.
First of all. Make a refresh. press F5 on the very first folder of the project.
Now try to build again the project ctrl - B (ord cmd B in mac).
then find an error in a class, find the resource that is giving you problem (maybe a class) and then try to go to that class, right click, build path > add to build path.
Do it with every class giving you problem
if the problem is still there try a again to rebuild.
if the problem is not resolved, please comment this answer with a screenshot and I will help you better (hope)

Resource not found in Eclipse


Limitations that make a simple euclidean space a Hilbert space

Question: From what I understood is that a complex vector space $\mathbb{V}\cap\mathbb{C}^{\infty}$ becomes a Hilbert space if it is orthonormal, if the inner product of all vectors$(\left|x\right>,\left|y\right>)$ is defined and if the space is complete. From what I understood, completeness implies that the sum of vectors should converge towards a vector of finite length. Basically, what I understand is that $$||\sum_{k=0}^{\infty}\left|v_k\right>||<\infty$$
But it's not difficult for a mathematician to figure out that I could easily construct vectors in euclidean space that disobey this ruling, (but wikipedia says that one of the most famous examples of Hilbert space is the euclidean space). For example let met have a vector $0<\left|||A\right>||<\infty$ such that and let me define $\left|x_n\right>=\left(\frac{1}{n}\right)\left|A\right>$. This vector series wouldn't converge, then why is euclidean space in $\mathbb{R}^3$ a Hilbert space?
Comment: A metric space is complete if every Cauchy sequence converge. Obviously we can have many non-convergent non-Cauchy sequences.
Answer: For understanding what it means, you need to look at an example of a non-complete normed vector space :
Let $E,\|.\|_2$ bet the set of real (or complex) sequences ending with infinitely many zeros, with the $\|.\|_2$ norm $\|y\|_2 = \sqrt{\sum_n |y(n)|^2}$.
You can easily check it is a normed vector space.
Then let $x_k(n) = \begin{cases}\frac{1}{n^2} \text{ if } n \le k\\ 0 \text{ otherwise} \end{cases}$
since $\|x_k-x_{k'}\|_2 = \sum_{n\in (k,k']} \frac{1}{n^2}$ you see that $(x_k)_{k \in \mathbb{N}}$ is a Cauchy sequence in $E,\|.\|_2$, but $x_k$ converges in the $l^2$ norm to the sequence $y_n = \frac{1}{n^2}$ which is not in $E$.
The completion of $E,\|.\|_2$ is the Hilbert space $l^2$ containing all the sequence with finite $\|.\|_2$ norm.
$l^2$ is a Hilbert space because its norm comes from a inner product
$$\|y\|_2^2 = \langle y,y \rangle \qquad \quad \langle x,y \rangle = \sum_n x_n y_n$$
(or $\langle x,y \rangle = \sum_n x_n \overline{y_n}$ if you are considering the complex sequences)
Answer: It seems that there is some confusion here.
First, note that the notion of ''orthonormal'' does not apply to a vector space but to a basis, i.e. a set of lineraly independent vectors that span the vector space.
More: the notion of orthogonality of vectors can be defined only if the space has an inner product. In this case the vector space is called a pre-Hilbert space, and we can prove that, the inner product define a norm, so the space is also a normed space (called a pre-Banach space) and from this norm we can define a distance so that the space is a metric space.
In a metric space we can define a notion of convergence for sequences of elements (vectors) and we can define  Cauchy's sequences.

The (metric) space is called complete if all the Cauchy's sequences are convergent to a limit in the space.

( Note that the sequence $|x_n\rangle$ in OP is not a Cauchy sequence).
In this case, if the distance comes from a norm and this comes from an inner product, the space is also a normed Banach space and a Hilbert space.
Since there is a general way to complete any metric space, using the equivalence classes of Cauchy  sequences, we can always complete a pre-Hilbert space, i.e. : any vector space with an inner product can be ''promoted'' to an Hilbert space with a standard  procedure of completion.


iPhone Certificate Fog

Question:
This question is, in some ways, a follow up on my earlier question regarding Push Notifications.  After much time wasted I have more or less concluded that the issues I am running into, particularly with Titanium, are down to my not configuring my Keychain in the right order.  I am now contemplating redoing it all from scratch but thought it best to first post a question here to establish the right way. Here is what I am planning to do

Log in to my Apple iOS provisioning portal account, download and install the Apple WWDRCA cert
Open up KeyChain and create a new certificate signing request.  I call it myname.certS... .
Go to the provisioning portal account and use the CSR created above to secure my development and production certificates.
Download and install those certs on my machine by double clicking on them
Back in the provisioning portal create my first appID - call it, com.example.push
Back in KeyChain create a new csr - push.certSig... .
Back in the provisioning portal choose the new appID and configure it for Push using the new csr
Still in the provisioning portal select Devices and add the UUIDs for the devices on which I want to test my app
Still in the provisioning portal select Provisioning and create a new development and production provisioning profile for the app.  The latter has AdHoc selected.  Use the certificates created earlier. At this stage assign only one device in each profile.
Submit the profile, wait then edit it and add the remaining devices - I am doing this because I have read that there is bug somewhere that stops the provisioning profile from using the Push configuration for the appID in question the first time round
Download and install the two provisioning profiles

Well as I write I have followed all of these steps.  I then wrote and compiled a simple Titanium mobile project and tried the Install To Device option with the AdHoc profile created above. Everything went swimmingly well and I got my IPA.  I took the IPA and fed it to TestFlightApp which reported Invalid Profile: developer build entitlements must have get-task-allow set to true.  So I tried again with the Development profile.  This time round TestFlightApp accepted the IPA.  In installed it on my iPad but still find that registerForPushNotifications is going away into the ether with nothing being reported - no success, no  erors... just a defeaning silence.
I have to admit that I am at my wits end here.  I am clearly doing something wrong but I haven't got the foggiest idea what it could be.  If I had a million dollars I would give em away to anyone who could set me on the right track.  Well I don't so I hope someone just puts me on the right track out of sheer goodness
Answer:
tried the Install To Device option with the AdHoc profile created above. Everything went swimmingly well and I got my IPA

That doesn't sound right.  You aren't installing to a device, you're generating a distributable build.  I'm not familiar with Titanium's build process, but in Xcode 4, you select Archive to generate the IPA, and Xcode generates the appropriate entitlements at that point.  If you're using an option intended to install directly onto a device, it won't generate those entitlements.

So I tried again with the Development profile.

This doesn't sound right either.  You should be using the distribution profile.

iPhone Certificate Fog


UK stock historical data

Question: Where can I find UK stock data over the last 70-80 years? Preferably adjusted to to the inflation.
Comment: Free sources only? A stock index or individual stock prices?
Comment: Have you considered accepting one of the answers?
Answer: There are more and more free database available. Here are a few that I like:

Quandl: this platform gathers data from many providers. Not all database are free, but there are enough data to play around with. One of the best things about Quandl is the APIs and the Excel macro, which allow you to easly send requests and download data.
Yahoo Finance: one of the most popular I guess. It is also possible to use some excel macros to download the data, see for example this macro from InvestExcel
GOOGLEFINANCE: If you like Google Sheets, then the function GOOGLEFINANCE is very handy and works quite well. It allows you to get real time data as well as historical data.
Answer: I think you can find info on this from 1970s at Yahoo Finance
You must, however, do the adjustment yourself by obtaining the CPI inflation from the web site of Office for national statistics.
Comment: I usually find technical information like the yield. I am interesting in more historical data to show the development of the market.
Comment: You should go to 'Historical Data' link on this web site.

UK stock historical data


Holomorphic function

Question: Let $f(z)$ be a holomorphic  function  that  maps  the  unit  disk  to  the  unit  disk. Prove that $$|f^{(5)}(0)| \leq 120.$$  I use some concrete example it seems that this statement work out but i do not know how to come up with a formal proof help any one
Comment: Is that $5$ a power or the order of the derivative?
Answer: Perhaps you should use Cauchy's integral formula
$$f^{(5)}(0)=\frac{5!}{2\pi i}\int_\gamma\frac{f(z)}{z^6}dz$$
where $\gamma$ is the unit circle.
Then, use the Estimation Lemma:
$$|f^{(5)}(0)|\le \frac{120}{2\pi}|\gamma|M$$
where $|\gamma|$ is the length of $\gamma$ and $M$ is an upper bound for $f(z)/z^6$ on $\gamma$.
Can you finish?
Comment: i am still not following though. especially the part where you say to use cauchy integral
Comment: i am really having a hard time with this problem
Answer: Assuming $f^5$ means really $f^{(5)}$. Then the hypothesis says that $f$ is holomorphic in the open unit disk $D(0,1)$, and that $|f(z)|\leq 1$ for all $z \in D(0,1)$. Then by the general Cauchy´s Integral Formula
$$
|f^{(5)}(0)| = \left| \frac{5!}{2\pi i} \int_{|z|=1} \frac{f(z)}{z^6}dz\right| \leq \frac{|5!|}{|2\pi i|} \int_{|z|=1} \frac{|f(z)|}{|z|^6}|dz| \leq  \frac{5!}{2\pi} \int_{|z|=1}|dz| = 5! = 120
$$
since $|f(z)|/|z|^6 \leq 1$ and $\int_{|z|=1}|dz|=2\pi$.
Comment: @ᴇʏᴇs , Well since $f$ sends the unit disk to the unit disk thats exactly what it says. By Integrating on the contour $|z|=1$ the region bounded is the unit disk, then $|f(z)|\leq 1$ and $|z|=1$, thus $|f(z)|/|z| \leq 1$
Comment: i have one question shouldn't it $\frac {5!}{2 \pi i}$
Comment: where is the i that is the part i do not understand i feel like something is missing
Comment: You are right, am editing that, however, since $|2\pi i|= 2\pi$, after the first inequality the $i$ becomes $|i|=1$.
Comment: @user146269 yes, indeed the $i$ was missing, now i have made an edit? is everything clear now ?
Comment: Like water my friend thanks. Now i can finally move on
Comment: I don't see where in the problem it says that $\lvert f(z) \rvert / |z|^6 \leq 1$
Answer: Maybe overly pedantic, but we can't really integrate over $|z| = 1$ without some justification, since $f$ is only assumed to be holomorphic on $|z| < 1$. It's not that big of a deal though, since we can integrate over the circle $|z| = r$ for any $r < 1$ to get:
$$
|f^{(5)}(0)| = \bigg| \frac{5!}{2\pi i}\int_{|z|=r} \frac{f(z)}{z^6}\,dz \bigg| \le \frac{120}{2\pi} \cdot 2\pi r \cdot \frac{1}{r^6} = \frac{120}{r^5}
$$
since $|f(z)| < 1$ on $|z|=r$ by assumption. The above inequality holds for all $r$, so by letting $r \to 1^-$, it follows that $|f^{5}(0)| \le 120$.

Holomorphic function


View translation path

Question: I have a View with an path like example.com/en/news. I translated the view with Views translation. Works like a charm. But how and where do I translate the path to something like example.com/de/neues?
Answer: a very simple way would be to add a new alias yourself by accessing "/admin/config/search/path"
however, if you have translation set up correctly, that path should already exist.  I think maybe your translation set up is done in a non-standard way.  could you describe it in detail?
Comment: I think this is still a very simple way to translate view paths.
Answer: An alternative would be to use i18n_page_views module - it is a display plugin that installs an item labeled i18n page into the +Add (display) button menu. It's like a page display extended by fields for entering a path for each enabled language.
While it does not offer any tool to convert existing displays into i18_page type, it's quite easy to do that manually - just export your existing view(s), change the type of the display in a notepad and re-import w/override.
Regretfully, the module does not offer UI for creating translated menu items - this also has to be done manually.
At any rate, it's advisable to bind all translation paths (created manually as jdu suggested, or created automatically) into a translation path set (admin/config/regional/i18n_translation/path/add). I found that without it the i18n_get_path_translations function worked whimsically.
Answer: Use the Path Translation module.

View translation path


Are Data Extensions Called Custom Objects in Salesforce Marketing Cloud?

Question: Are Data Extensions Called Custom Objects in Salesforce Marketing Cloud when logged into the dashboard of exacttargetapis.com?
Comment: To Retrieve Custom Objects using API Calls mean retrieving the data extensions ?
Comment: What dashboard? Can you post a screenshot?
Comment: @zuzannamj I have added the picture to the question
Comment: where do you see "custom object"?
Comment: I meant to add a screenshot of the "dashboard of exacttargetapis.com" - I have no idea what you're referring to. The API name of the Data Extension object is simply `DataExtension`: https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/dataextension.htm?gclid=CjwKCAjwsan5BRAOEiwALzomX3UUhlI8S6zO_iO32RJ6QIZfJsWmu_CaEhr7OKju6IOh42Kw58LV4RoCQVEQAvD_BwE
Comment: @LukasLunow, I am not sure of what exactly are custom objects in Salesforce Marketing Cloud. Everytime I try to get more information it lands up in the page   https://help.salesforce.com/articleView?id=dev_objectcreate_task_parent.htm&type=5  which isn't relevant
Comment: @zuzannamj, I have updated the screenshot
Answer: You are mixing up clouds.
Whenever you need to create a new table for storing data, you will do either of these tasks:

In Marketing Cloud: create a new Data Extension
In Sales Cloud: create a new Custom Object

They both hold rows of data, can consist of a number of columns, and can have records written or updated via API. The key difference is, which cloud you are working with.
Comment: oh, got it now. Few members who were common with salesforce usage called it custom objects and few were calling it as Data Extensions which I couldn't relate.
This cleared my doubt.
Thanks


How Can I Recover a .nfs file?

Question: I have been working on an algorithm in Python, and I was using Vim to edit this file.  I opened it up, did a save, and it came up with an Error something like it occasionally does:
"WARNING: YOUR FILE CANNOT BE SAVED!  ALL CHANGES WILL BE LOST!  CANNOT WRITE THE FILE!"
As this happens occasionally, I did what I normally do, and I hit :q! to quit without writing any changes.  No harm, no foul.  When I looked at my file, everything had been erased!  Everything!
I talked around the office, and it seems that the nfs mount was full, and so that was why I couldn't save anything.  There was a huge script generating a ton of data, which caused the mount to be full temporarily.  I believe the NFS mount is from NetApp. I found 2 files in my current directory.
One was last saved two days ago, and one was today.  They are in the format of:
.nfs.xxxxxxxxxxx
When I try to attempt to open up this file, I see some of my code, here and there, splattered among unknown characters.  Apparently, this must be a binary representation of the state of the file.
Is there any way to recover this file from this NFS mount?  If there is a shortcut to recover this file in Emacs, I will switch to Emacs from vim!
Answer: So, I did find a way to recover the file.  I found two ways, in fact.  Since it was on a NetApp NFS mount, I was able to use the snapshots feature.  When you are in a directory just do
ls .snapshot
And this will pull up any snapshots that your system administrators have set.  For us, we have an hourly.0, hourly.1, and nightly.0, and nightly.1 backups.  So, we can go back two days, and in the same day, we can go back one hour (the current hour, and the previous).
The other way was to rename the file to a vim swap file like this.
mv .nfs.xxx my_vim_file.cpp.swp
vim my_vim_file.cpp.swp
Then attempt to open it up in Vim, and it should ask you if you want to Recover the swap file, say yes, and it should be back!
Answer: Apparently your Netapp uses NFS to mount its volumes (as opposed to iSCSI, for example). Generally, each VM is stored on a unique volume (aka datastore) on the Netapp filer. To find out the volumes and snapshots, and then restore a snapshot, here are the commands to execute at the command line:
<code># list all volumes, snapshots are taken of volumes
vol status
# list the snapshots available for a particular volume
snap list <vol_name>
# restore a snapshot, nightly.1 for example
snap restore <vol_name> nightly.1
</code>
That's it. All that's left is to turn the VM back on and see if you've restored far back enough. If not, then do another "snap restore" but with an older snapshot.
Note that this procedure assumes your administrator didn't disable snapshots (Netapp has a snapshot schedule by default) and that the Netapp is licensed for snaprestore (use the "license" command to verify). This procedure can further be simplified if you have the Netapp OnCommand System Manager, which is a GUI for managing the Netapp. Reverting a snapshot in the GUI is simple:
<code>Go to Storage > Volumes > click on a volume > click on Snapshot Copies (at the bottom)
Choose a snapshot and restore
</code>

How Can I Recover a .nfs file?


Adobe Illustrator: After a radial repeat, how can you recolor individual intersecting shapes?

Question: When making a pattern of intersecting shapes with Object>Repeat>Radial, can this shape be divided it into individual segments that can then be colored individually?
[Shape Builder tool recognizes individual sections
Answer: You can use the Pathfinder tool: the Divide option.

That will divide up your shape into individual paths.
You can also still use the Shape Builder by just clicking in each divided area - this will convert it to it's own path.
Comment: You can also choose a color for fill while shapebuilder is activated this does not change color of objects but will color the area shapebuilt. This allows you to color and shapebuild in one go.
Comment: Thank you so much!
Answer: Grab the Live Paint Bucket, pick a color, and start clicking.
Pick a different color, click more.... Or use the left/right arrow keys with the Live Paint Bucket Tool active to cycle through swatches. When done click the Expand button in the Control Bar across the top of the screen.
Or... double-click the Shape Builder tool in the toolbar and tick the "Cursor Swatch Preview" option and do all the above with the Shape Builder Tool.
Comment: Thank you very much! Very helpful.


Do vintage guitars really sound better with age? Or is this perception affected by selection bias?

Question: Guitars are often said to sound better with age. How much of it is due to worse-sounding guitars being discarded before they reach vintage age?
Answer: It is possible that some guitars just never live long enough to become "vintage", because they never sounded good in the first place.  And a bad sounding guitar is not going to improve much with age.  In the case of a laminate top cheap mass produced guitar, no amount of aging is ever going to make it sound like a new solid wood guitar.
Acoustic guitars have proven to the ears of many players - to sound better as they age.  The theory that best explains this is - that as the wood in the body ages, it becomes lighter and more responsive and more resonant.
In an acoustic guitar, the sound comes from the vibration of the top - also known as the sound board.  The vibration of the strings alone produces very little sound.  The vibration of the strings is transferred to the top through the bridge and saddle.  The vibration of the soundboard (top) is what produces the audible sound we hear from an acoustic guitar.
To prove this, take a tuning fork and strike it to set it into vibration.  It makes very little sound on its own.  But if you touch the end of the vibrating tuning fork to the top of an acoustic guitar, the note created by the tuning fork rings loud and clear.
Some folks believe that the more an acoustic guitar is played, the better it sounds because the vibration of the top loosens up the wood and leads to greater responsiveness.  I have heard that some guitar owners will set their guitars in front of their speakers and turn up the volume on their home stereo believing that the vibrations will help loosen up the top and make it sound better.  But I think this vibration theory is more like speculation and difficult to prove.
Yamaha is convinced that aged wood has superior tone producing qualities so they developed an accelerated aging process knows as Acoustic Resonance Enhancement Technology (A.R.E.).  They started using it on violins and have recently began using this process on some of their acoustic guitars.  You can read all about it and watch a video here on the Yamaha Website Acoustic Resonance Technology by Yamaha
Another reason "vintage" guitars may sound good is that the wood available decades ago may have been a better quality wood than what is available today.  It's also possible that older guitars from reputable makers were more meticulously crafted with more of the work done by hand and more time devoted to finding the best sounding wood for the soundboard and more time tweaking the building process to get the best sounding guitar possible.
Mass produced guitars -- even by well respected companies such as Martin, Gibson and Taylor -- don't get the same amount of individual attention as they did in the "old days".
Most of the foregoing relates to acoustic guitars sounding better with age.  Electric guitars, which rely more on their electronics to produce sound, are less likely to show any dramatic improvement in tone through the aging process.
The factors discussed above all offer plausible reasons why 'vintage" guitars seem to sound better than newer guitars.  And certainly a really good sounding new guitar is more likely to live to become vintage due to receiving better care.
But I believe that tone woods used to make acoustic guitars do improve their sound-producing quality as they age.  Different tone woods have been shown to improve at different rates -- characteristic of the particular type of wood (spruce, cedar, maple, rosewood, koa etc. will all age at different rates).
And I am convinced that a given well made guitar that sounds good when new, will (if well cared for) sound better as it ages.
Comment: FWIW most of this answer applies to the orchestral strings as well, tho in recent years a lot of progress on varnishes and wood selection has allowed new instruments to 'break in' rather quickly.
Comment: @CarlWitthoft you are so right.  Yamaha started using their Acoustic Resonance Enhancement Technology on orchestral strings before they began trying it on acoustic guitars.
Comment: I am convinced that there's a survivor bias too: old bad sounding guitars were thrown away. Thre's also the interaction and aging of varnish and wood: older aged paint has different properties compared to new paint.
Comment: I'm pretty much with you all the way on this one - I just wanted to add, anecdotally, that I have never heard/felt anything so good as the 64 strat I used to own. Weighed half what a modern one does, sang twice as clear, even unplugged; which i've always felt to be an acid test for an e guit anyway.
Comment: @Tetsujin Used to own?  Sorry you had to part with it.
Comment: @MicheleL'Intenditore  Agree about the survivor bias being a potential factor as stated in my opening paragraph.  Never thought about the varnish or sealant aging and changing in character but that is a good point.  Many folks believe that lacquer applied to a guitar top will diminish the ability of the wood to vibrate and thereby have a dampening effect on the sound.  Lacquer will actually crack on vintage guitars from the inside next to the wood due to the vibration and movement of the wood due to environmental factors that is not matched by the relatively static lacquer coat on the outside.
Answer: In some circumstances the vintage instruments sound better due to changes in the manufacturer's specs.  For instance, the Fender P-Bass is a very highly desired instrument from certain specific years (can't remember which years off hand).  Fender changed their specs and many have argued not for the better.  In this particular case, I think there are two factors.  The obvious one, the change in sound due to manufacturing specs.  The other consideration is that of the history of the instrument.  Many great artists used these classic P-Basses on their recordings that have become standards in the modern repertoire.  One could argue that due to their consistent use, the sound of that particular series is considered the P-Bass sound, so if you want to emulate the sound of your favorite Fusion bass players, then you are going to want a P-Bass from those years.
Answer: The cellular makeup of most wood used in guitar building is such that the wood is full of microscopic voids called capillaries. These capillaries or micro cavities in the wood start out as hollow (full of water), and they become consolidated or filed-in over time by the surrounding wood, as the wood dries and ages. Basically the wood becomes more solid as the capillaries are reduced in size and eventually disappear. Vibration of the wood promotes this effect creating a settling effect and collapsing the capillaries. The wood therefore becomes more dense/solid over time and the resulting sonic effects are: 1)expanded range; fuller tone with boomming bass and sparkling trebles; better clarity; larger volume; and increased sustain.
Answer: Electric guitars cannot be made like they were in the 60s. Even though Fender reissues many iconic guitars, you simply cannot produce electronics to an exact 60s specification.
Copper wire was pretty impure in the old days. Today copper wire is pure copper in the old days copper wire had a certain amount of impurities to them. This leads to a certain character in pickups that is hard to fake.
Also there are certain things guitar producers could do in the manufacturing process in the 60s that they cannot anymore because of environmental concerns.
Although old wood does have certain resonance that is pretty groovy. You should also realise that guitar design has come a long way in 60 years.
The old guitars often are very temperamental. You struggle to keep them in tune. They are often quite soft for humidity and temperature changes.
The worst part is that they are so completely over-priced for the small improvement they give in tone.
They are only really an option for established musos who have everything else about there tone dialed-in and want to try and go for that last 2 percent.
I must admit though that blackguard Telly sounds superb.
Answer: In the case of acoustics, age improves sound as the wood becomes drier.
As for as electric guitars, age has little to do with it. A well made new instrument can sound just as good, provided it is made with quality tone woods.
There could be some argument that older electric guitars were made from old growth wood that is simply no longer available.
Comment: Wood doesn't dry out with age; the moisture content reaches equilibrium with its environment. Kiln-dried wood typically starts out with a lower moisture content than air-dried, but both reach the same level after a short time. Wet wood sawn from a tree and air-dried takes about 1 year per inch of thickness to reach equilibrium. Seasonal variations in local humidity lead to seasonal variations in moisture content, so my acoustics sound better when air is dry in winter than they do when air is humid in summer. There may be other structural changes that occur in the wood as it ages, though.
Answer: I think something to consider, is the the wood might have more slight imperfections over time, due to constant environmental changes (temperature, moisture, etc...) and that these imperfections create a fuller more resonant tone. I agree with most that a guitar that never sounded very good... won't sound better over time, but a great solid wood guitar, will sound better over time
.
Answer: There is one theory that states that the wood's cell walls slowly break down over time, and the wood becomes lighter, and as a result more resonant. This article goes into more detail.


getting rid of Media Module Message "Media Folder: Media Root"

Question: Why is the message "Media Folder  - Media Root" appearing on this article, and not on the other articles and pages that also use media to insert images on my site? How can i get rid of it, i don't like it.
http://notesmusic.be/node/3
Answer: A similar problem came up for me when upgrading a Drupal site to Drupal 7.53. I found that the "media folder" field suddenly started appearing on all images on the site.
What fixed it for me was hiding the media folder field from the file type generated by the file entity module (which makes files fieldable). Here are the steps to do that on your Drupal site:

Go to Home » Administration » Structure (admin/structure/file-types).
Click "Manage display" for the affected file type.
Change the label and format to "hidden" for the "Media folder" field and click save.
While you are at it, repeat steps 1 and 2 for all the file types on your site.
Clear your caches.
Answer: Media Folder is a taxonomy field on your your node type that's set to display. If you want to disable its display. Go to the Manage Display section for your relevant content type and set it to Hidden.


Ending a sentence with "?!" or "!?"

Question: When ending a sentence with a ? and a !, is there a rule which one comes first?  That is, ?! or !??  If either is okay, are they interchangeable, or for difference circumstances?
Comment: Just combine the ? and the !, like so: ‽
Comment: Possible duplicate: http://english.stackexchange.com/q/531/14666   Existing duplicate: http://english.stackexchange.com/q/2423/14666
Comment: Sorry, didn't realise it was already asked - when I searched using "?!" rather than spelling out their names, those questions didn't come up.
Answer: There is no rule about such things, but in formal prose I would avoid using the two together in any order, and I suspect most careful writers would too.
Answer: The term for that is "interrobang." Wikipedia states,

The interrobang, also known as the interabang, (pron.: /ɪnˈtɛrəbæŋ/), ‽ (often represented by ?! or !?), is a nonstandard punctuation mark used in various written languages and intended to combine the functions of the question mark (also called the "interrogative point") and the exclamation mark or exclamation point (known in printers' and programmers' jargon as the "bang"). The glyph is a superimposition of these two marks.

It is a nonstandard (informal English) punctuation mark, that is used at the end of a sentence to express "excitement or disbelief in a form of a question, or asks a rhetorical question." As what Barrie England said, there is no rule for this type of mark—they are interchangeable, when the symbol "?!" is used other than "‽".
You should avoid this in formal writing. Visit this site to know more: WhiteSmoke.com. Points to ponder on:

Even in literary or dialog writing, over-use of the exclamation point should be avoided, using alternative wording or other punctuation marks to express emotion. Experienced writers know how to make their readers infer emotions from context.

Avoid: The Japanese food at Kyoto was just out of this world!!! Super-duper!!! These guys know how to cook!
    [Exaggerated enthusiasm using too many exclamation points]
Consider: The Japanese food at Kyoto was the best we have ever had. It appears that the chefs there are highly professional. [Subtle enthusiasm using alternative wording with periods instead of exclamation points]

Do not use the exclamation point to express overt amazement or sarcasm. Use other words for rephrasing.

At 3.3 meters and 7 tons (!), the African elephant is the biggest (!) land animal on Earth. Yet, Johnny (!) thinks       that the Indian elephant is bigger.
    [1st exclamation point expresses amazement, 2nd exclamation point expresses sarcasm]
At a majestic 3.3 meters and 7 tons, the African elephant is the largest land animal on Earth. Yet, Johnny,          stubbornly, thinks that the Indian elephant is larger.
    [majestic expresses amazement, stubbornly expresses sarcasm, both instead of the exclamation point]
Comment: Thank you, didn't know there was even a name for it! :-)
Answer: This is one of those things that falls to setting and preference. Many more 'rule police' types will tell you not to use it at all. I could rant about that for ages but back on topic.
I generally use Interrobangs as "!?" but there is no set etiquette for it. Mostly because it's combining two concepts that don't mesh cleanly so it's hard to put into black and white in a way that satisfies people bound and determined to have rules in a language that like any other language constantly changes.
That all said, personally my rule of thumb would be if you care enough to have a 'rule' for it. I would use the punctuation that's more prevalent first to suit the tone more accurately. !? for more sudden reactions ?! for more accusatory or confused statements.

Ending a sentence with "?!" or "!?"


Can't install El Capitan over beta version

Question: I saw a previous question similar to mine but no answer. I participated in the beta version of El Capitan I think last year. When the public release version came out I installed it and didn't discover that I was still using the Beta version until a month ago. I can't seem to find a way to do so. Apple tech support wants to charge me ridiculous $'s to help me with no guarantees. Can anyone send me to a site or tech paper or direct help to help get rid of the beta? I am unable to update from the app store. I am using a MacBook Pro (15-inch, Mid 2012). Thanks
Comment: Why are you unable to update from the App Store? What happens when you try?
Comment: Thanks for responding Tetsujin. I have version 10.11 Beta (15A278b) installed. When I try to install from the apps page (OS X El Capitan GM Candidate) it says OS X v10.11 is already installed on this computer. Use the Updates page to install the 10.11 update or if you would like to download the full OS X installer click Continue. What is a GM Candidate? Until I find out I don't want to download the full installer. Do you know if that is a safe installer?
Answer: GM is a Master update (the last one before the real thing).
Your literature when participating in the beta testing has a paragraf how to go from beta to the final release.
Comment: Thanks, LexS, I remember that it did but couldn't find it in my email from a year or so ago. I went ahead and tried the GM install. It took six hours to download, but it and the following two updates seemed to have worked! I am now at version 10.11.2. Everything seems to be working the same right now. Thanks all of you.


Origin of "Butter wouldn't melt in his/her mouth."

Question: This phrase means that someone is being prim and proper with a cool kind of demeanour. But from what event or phenomenon or occurrence was this idiom derived from, and when?
Comment: Never having known the history, I had always thought it meant not proper but just plain cold, rigid, and emotionally negative, and that it was just a clever turn of phrase created to imply 'cold'.
Answer: The Phrase Finder has a citation from 1530, in Jehan Palsgrave's Lesclarcissement de la langue françoyse:

He maketh as thoughe butter wolde nat melte in his mouthe.

It goes on to say,

The phrase is usually used in a derogatory and critical sense and, in the past at least, was most often applied to women. Occasionally, it was used to denote a quiet meekness and sweetness of temper rather than emotional coldness. For example, this description of Mr Pecksniff in Charles Dickens' Martin Chuzzlewit:

It would be no description of Mr Pecksniff's gentleness of manner to adopt the
         common parlance, and say that he looked at this moment as if butter wouldn't melt
          in   his mouth. He rather looked as if any quantity of butter might have been made  out of him,
         by churning the milk of human kindness, as it spouted upwards from his heart.
Comment: Since your whole answer is a direct quote from The Phrase Finder, you should make it more clear that these are not your words.
Comment: More clear? Hey users, these are not my words, these are not my words;)
Comment: This is terrible formatting the way it stands right now.  You need to clearly show that what is not blockquoted -- the "this is an old phrase" and "the phrase is usually used in a derogatory sense" -- are not your words.   I'm not sure I like the fact that the entire post is cribbed almost verbatim from the Phrase Finder; there's nary an original thought of yours to be found as commentary.
Answer: Eric Partridge offers this citation in A Dictionary of Slang and Unconventional English:

butter would not melt in one's mouth, (look) as if (To seem) demure. Coll. from the 1530's; Palsgrave (O.E.D.), Latimer, Sedley, Swift, Scott, Thackeray. In reference to women, Swift and Grose add: yet, I warrant you, cheese would not choke her, the meaning of which must be left to the reader who will look at cheese.

So, onward to cheese, we find — nothing useful. Partridge is curiously silent on the subject, at least as it relates to this case directly. I wonder if his reticence might be due to one unsavory meaning of the word, use of cheese for smegma, giving the whole thing a lewd sexual connotation. But I can find nothing in the O.E.D. or elsewhere to support this contention. Still, if cheese is somehow related to butter in this context, this could well shed a whole new light on that phrase as well. But given the lack of sources, I have to conclude this is a dead end.
Still, we might also consider another meaning of butter as "fulsome flattery, unctuous praise" (Partridge). A young woman who was demure, as Partridge calls it, would be likely to receive much of this kind of butter.

demure |diˈmyoŏr|
adjective ( -murer, -murest)
(of a woman or her behavior) reserved, modest, and shy : a demure little wife who sits at home minding the house.

A woman who was "reserved, modest, and shy" would probably seem a little cold, and certainly resistant to the kind of buttering flattery that might come her way.
Upon further review, more than a decade later
Regarding the "yet, I warrant you, cheese would not choke her" in the context of "butter would not melt in her mouth," as a kind of rebuttal to that thought, perhaps although the woman in question seemed cool on the outside, perhaps it is by way of suggesting that she is passionate on the inside, hot enough to melt said cheese. Just a thought.
Answer: I would offer the suggestion that butter and cheese though both dairy products have varying melting points. Though butter may go soft at room temperature (and some cheeses) I might infer that the suggestion from this quote may be that cheese would in fact melt in her mouth and therefore butter wouldn't stand a chance. The key to this being that she 'looks' as though butter wouldn't melt although the truth is that cheese would not choke her. Perhaps therefore it has 'melted' or at least gone soft. Good old hot lips.


Ran 2002 PT cruiser w/ out coolant/water, overheated but temp gauge showed normal.

Question: I did a radiator flush, refilled the radiator with water and cleaner, and drove for about 10 minutes.  Because I was trying to get my car to temp so the fans and water-pump would kick in I was keeping and eye on the temp gauge.  After a few minutes I noticed I was loosing power, but my temp gauge was not even going up half way.  I made it home, with the temp still reading normal, but with the car obviously overheating. I added water, and found that the radiator plug had come out, so I was driving without coolant/water.  So my question is how bad is the damage probably?  Also why didn't I see the temp gauge rising?  I notice that the thermostat housing is near the radiator cap.  Is sufficient coolant required to transfer heat to the thermostat for it to work?
Thanks
Answer: Ok, no real way to tell what damage was done. Possibilities,  anywhere from scored pistons and cylinder walls. Blown head gasket, cracked head/block. I would fill the system and bleed out the air and see how it goes. Very strong possibility all will be ok. As for the temp sensor/gauge not reading correctly,  if there is not enough coolant in the system it has nothing to read.
Comment: This type of event will have affected the longevity of the engine but, no way to even start to guess by how much... good answer, good advice.
Comment: Further reading on the internet suggests that the car may have gone into a "limp mode" when sensing the overheating.  This could also explain the loss of power, but with the heat sensor not working, is this really a possibility?
Answer: Just got my 2002 PT Cruiser LE DREAM.  Driving home from the lot, I pulled over for a couple of minutes.  Started running hot, temp gauge going up, so got back on the road.  Got home, drove to store, every time I stopped, the overflow was bubbling over.  It got quite hot, which really worried me that some damage had been done internally. Honey is retired mechanic (thank goodness), he tried to turn fan manually with engine off... it would not turn.  Luckily the dealer had a brand new fan, got that and changed them out (quite the job in labor).  Still fan would not run, on A/C, on heater, nothing... temp climbing.  He used a 12 volt test light to the low fan relay junction, got no juice.  Bought $8 Low Fan Speed Relay (there are two, low and high speed, he tried replacing low speed first because that is for fan... high is fan condenser relay, but there was nothing wrong with that once we got the first fan relay in), installed that...
VOILA!  My new beautiful PT Cruiser running like new.  Also, someone had not tightened down a bolt on the manifold cover, causing it to suck air, which caused a rough idle.  He made sure everything was tight and now I  can drive my zippy cruiser with confidence!!
No internal damage... Good luck to you on getting yours running right... it is well worth the time!!!  : )
Answer: If the coolant temperature sensor isn't in the coolant, i.e. in air instead, it won't register the water temperature elsewhere in the system.


WPF/MVVM: RichTexBox as datagrid cell editor, put formatting code into ViewModel?

Question: I really wonder what I can put in the ViewModel.
If its needed to be tested might some say...
But when the properties like CaretPosition (to get the selected Text) are no dependency
properties, then better forget about the ViewModel.
At the moment I have this in the codebehind:
<code>private void rtbContent_SelectionChanged(object sender, System.Windows.RoutedEventArgs e)
        {
            RichTextBox rtb = sender as RichTextBox;

            TextPointer tpForward = rtb.CaretPosition.GetNextContextPosition(LogicalDirection.Forward);
            TextPointer tpBackward = rtb.CaretPosition.GetNextContextPosition(LogicalDirection.Backward);

            if (tpForward != null && tpBackward != null)
            {
                DependencyObject nextObj = tpForward.GetAdjacentElement(LogicalDirection.Forward);
                DependencyObject prevObj = tpBackward.GetAdjacentElement(LogicalDirection.Backward);

                TextElement textElement = (TextElement)(nextObj ?? prevObj);

                if (textElement != null)
                {
                    tbBold.IsChecked = textElement.FontWeight == FontWeights.Bold;
                    tbItalic.IsChecked = textElement.FontStyle == FontStyles.Italic;
                    //...
                }
            }
        }
</code>
This code is formatting selected Text, toggles the state of the togglebutton when the cursor is before a formatted char/has formatted chars, just like in word...
1.) Where does such code belong? Code-behind or ViewModel? Actually I know the answer because of technical restrictions of the RTBox it will stay in the code-behind.
2.) The logic to toggle the format buttons is done via

But that will not work as the BoldCommand can not execute a method which would format the selected Text, as the selected Text of the RTB can not be bound to the ViewModel...
How to cope with that ?
UPDATE:
ward bell said:
"I am open to some code in the code-behind; ...I draw the line at decision logic. I smell a rat when I see a conditional statement of any kind. That's where bugs breed. Conditional logic is code we should be testing."
source: http://codebetter.com/blogs/wardbell/archive/2010/03/19/mvvm-josh-smith-s-way.aspx
Answer: Data goes in the Model, UI goes in the View, and that includes formatting text for display. Now, keep in mind the View can also include code-behind--it does not have to be strictly XAML.
Comment: this one helped me:

http://stackoverflow.com/questions/1338951/wpf-richtextbox-replace-selected-text-with-custom-control

see IanR`s post.


What key parts of a car should responders know about?

Question: This might be on topic here, so I'm going to ask it:
If a car was hit by another one and responders needed access to it, what key parts should they be aware of the location when entering the vehicle?
Comment: I would think my biggest concerns would be air bag deployment during extraction, electrocution from a hybrid battery, explosion of natural gas in a CNG powered vehicle.
Answer: I'd have thought it'd be anything that could cause a fire/explosion - Airbags, batteries and fuel tanks/lines.
The first thing you're going to want to do is cut off the fuel supply. On most cars, this is done off the ignition key, so that'd be your first target.
You don't mention whether you're talking about standard or modified cars - it's an easier question to answer with standard vehicles, as such locations can be readily identified in advance, and tend to be fairly predictable, wheras in a modified vehicle they might not be in the expected locations (for example, batteries might be located in the back of the car for improved weight distribution). Of course, if the vehicle was modified for competition use, there are strict rules regarding such components, including clearly marking the locations of battery cut-off switches and extinguisher triggers.
Comment: Thanks to both of you for helping me out. I'm currently working on building a system for emergency responders to identify parts of the car quickly using a phone (like the system by Mercedes). I guess we'll have to deal with modified cars as well.
Answer:
Airbags if they were not deployed during the accident

You'll sometimes see the emergency teams disconnect the battery and wait ~15-20 minutes before beginning to cut into the vehicle. This is to ensure that there is no power going to the airbags.

Some vehicles, i.e. Hybrid, come with additional accessory batteries and high voltage batteries. These sometimes are not stored in the obvious locations.
Fuel Lines and also auxilary fuel tanks
If the team only has the "Jaws of Life" then they would not be able to cut through sections made of High Strength Steel.

Rocker Panels
A/B/C-Pillars
Roof Beams
Side Impact Beams, basically any main structural support.


What's the Magic Behind Escape(\) Character

Question: How does the C/C++ compiler manipulate the escape character ["\"] in source code? How is compiler grammar written for processing that character? What does the compiler do after encountering that character?
Comment: Anyone care to comment on why this question is being pushed down? Is there something I am missing? To me it seems as a fair and correct question to ask.
Comment: at least try to spell your created tags correctly...
Comment: sorry for that, question was typed hastily
Comment: This character (?) is missing in your questions.
What's the rush, though?
Comment: Had urgent meeting minute back question popped up so typed liked that. thanks for modifying :)
Comment: Maybe I'm late, but I don't see this question being pushed down at all.
Answer: Most compilers are divided into parts: the compiler front-end is called a lexical analyzer or a scanner. This part of the compiler reads the actual characters and creates tokens. It has a state machine which decides, upon seeing an escape character, whether it is genuine (for example when it appears inside a string) or it modifies the next character. The token is output accordingly as the escape character or some other token (such as a tab or a newline) to the next part of the compiler (the parser). The state machine can group several characters into a token.
Answer: An interesting note on this subject is On Trusting Trust [PDF link].
The paper describes one way a compiler could handle this problem exactly, shows how the c-written-in-c compiler does not have an explicit translation of the codes into ASCII values; and how to bootstrap a new escape code into the compiler so that the understanding of the ASCII value for the new code is also implicit.
Comment: That is a very interesting paper which I'd not read in a while.  I'd forgotten the section on boot-strapping a compiler to understand a new escape character sequence such as '\v' - so I didn't immediately see its relevance.  I'm glad I checked it out.
Answer: It generally escapes the following character:

In a string literal or character literal, it means escape the next character. \a means 'alert' (flashing the terminal, beeping or whatever), \n means 'linefeed', \xNUM means an hexadecimal number for example.
If it appears as the last visible character before a newline, whether within a string or not (and even within a line-wide comment!), it acts as a line-continuation: The following newline character is ignored, and the next line is merged with the current line.
Comment: Don't forget \uXXXX and \UXXXXXXXX in C99.
Comment: \NNN (where N are digits 0-7) represents a byte-number in Octal.
\0, commonly referred to as a Null-Terminator, is really the same as \000.   I think 255 is \377
Comment: Aaron, that's right. there are other uses of \ too. i thought i would list the most important (by subjective measuring).
Answer: escape character with a following character (like \n) is a single character for C compiler - scanner presents it to parser as character token, so there is no need in special syntax rules in parser for escape character.


How to send messages between Companies

Question: I often see myself in the need of setting up automated transfer of messages/data/files between companies.
Besides the monstrous EDIFACT, Odette and a few other "big" electronic data exchange standards every industry has a few dozen or even e few hundred relatively sane relatively light weight, relatively well documented file formats for orders and the like.
What I'm missing is the right protocol to move files in this formats from machine to machine. The protocol should support

authentication
be usable with standard tools on MS Windows and unix
support something transaction like: a file is transfered or it isn't. but it is never received in half transfered state.
transport encryption
firewall friendly
a way to "bundle", e.g. an xml description and a bunch of PDFs.

Today basically everybody falls back to FTP. But FTP servers struggle hard to fullfill requiremetns 3, 5 and 6.
Is there a better way? Can things like Amazon SQS used to send messages from one company to the other?
Clarification: I mean small and medium companies. Our partners usually have no in-house developers and sometimes even no in-house IT people. So there needs to be an abolute minimal set-up effort at at least one side of the connection.
Answer: SOAP and web services ticks all the boxes
Here is a list of Java Open Source Web Services frameworks
Comment: Sounds good. But what are the standard tools on Windows and Unix?
Comment: Well, they need a bit more infrastructure than, say, FTP, but there are a whole host of frameworks which provide native support for SOAP, especially in Java.  I've added a link to my answer with a list.
Comment: ...of course the advantage of Java is its cross-platform nature

How to send messages between Companies


Are the Scales which use double-flats and double-sharps in the key signature just theoretical scales? Why?

Question: I've just found this information on a page I use to practice my scales. Is it true?
What's the difference between a theoretical scale and a real one???
https://www.musicteacherguide.com/piano-melodic-minor-scales/
Comment: I don't consider this approach (train all scales in case one encounter them later)  as efficient: playing scales is most useful, when you begin exercising a piece in  the respective key. This has the advantage, that wil not loose time with hard-to-encounter key signatures.
Answer: The page itself tries to explain it. Quote with emphasis:

Double-flats and double-sharps are often used as accidentals but
  placing them in the key signature makes the music generally very hard
to read. The Scales who use double-flats in the key signature (Db
  Minor, Gb Minor, Ab Minor) are just Theoretical Scales.

Such key signatures could theoretically exist, but you won't find them used in practice. For example, instead of Gb minor, F# minor with three sharps is used.
Here's another page that tries to explain it:
https://www.basicmusictheory.com/g-flat-minor-key-signature
As noted by Rosie F, Ab minor (7 flats) shouldn't be on the list. https://www.basicmusictheory.com/a-flat-minor-key-signature
Comment: Correction: A♭ minor's scale doesn't have any double-flats (it's all the single-flats). It's not just theoretical either -- composers have actually used it, usually with its complete key signature of 7 flats.
Comment: @RosieF good catch. :) It's a quote from the page linked by the OP. This other site doesn't have that mistake https://www.basicmusictheory.com/a-flat-minor-key-signature
Answer: Generally speaking, there are enough keys to cover all, using purely sharps or flats. With seven sharps, that takes us into C♯ major, which can, in 12tet, be re-written as D♭. The latter has five flats.
With seven flats, that takes us into C♭ major, which can be written as B major, with five sharps. There are very few occasions where a composer would need, or want to use more sharps/flats in a key signature, so going even further and using double sharps (x) or double flats (♭♭) is not going to be helpful to any instrument player. If particular scales have to use double either, it's due to particular notes needing to be written as such.
Having double either in a key signature is therefore somewhat pointless, as the 'simple' ones cover all that's needed. Thus, theoretical.
Answer: Key signatures and accidentals are a form of conventionalised notation - with equal temperament tuning there are multiple ways of notating the same note and the same scale. Double sharps and flats aren't the limit, and a few composers have used triple accidentals.
But just because something is possible in this notation system doesn't mean it should be used. We could teach beginners to play piano in the B♯ major key, but that would be needless cruel when we could teach them to play in the C major key instead. Theoretical keys are allowed by the notation system but have a simpler equivalent notation which should be used unless you have an extremely good reason for putting such a burden on the performers of your music.
Wikipedia gives a few examples of compositions which have modulations from seven-accidental keys to their fifth, which therefore has eight accidentals, and where the composer then has to choose whether its simpler to switch from sharps to flats (or vice versa) or to use double accidentals.


How to regulate a flyback transformer to have output of 100mv or 200mv ripple?

Question: I see spellman/bertan hv power supplies achieve this but are expensive. Is there a circuit that can regulate cheap flyback transformer's voltage ripple just as well? I've seen some circuits referred to as smoothing circuits and filter circuits but it's hard to find quality search results that actually mention design related to voltage ripple control. I would only need around 30 uA to 400 uA.
Comment: Given Q = C * V, and the time derivative produces I = C * dV/dT, then you have a tradeoff in the size of the capacitor, the size of the load current and the ripple, versus the frequency of recharging. (The formula does assume constant C).
Comment: do you need 200mV regulation too?
Answer: With those modest current requirements (30-400uA), why not just use an LDO on the output as  post regulator?  You don't mention the voltages, so that may not be an option.  If the voltage is higher than 36V, then you'll have to start looking at RC or LC low-pass filters.
For the filters you'll have to know the highest frequency of the ripple and just filter it.
Comment: flyback is a topology,  it can be used at lower voltages, even for step-down! most phone chargers are flyback topology.
Comment: If the L+C filter is used, then add a resistor in parallel with the inductor, of value sqrt( L / C ). Thus for 100uH and 1uF, use 10 ohms in parallel, for excellent dampening.
Comment: The OP doesn't mention the switching frequency, but it would be important to select an LDO that has good PSRR at the switching frequency.  Also, it's important to be careful with LC filters as a pure LC (outside the control loop) could ring if there are transients with repetition rate or frequency content at the resonant frequency.  Inside the loop the filter can cause excess phase shift and instability.  All these can be good options if done correctly.
Comment: I thought it was well known that flyback transformers output around 15,000 to 30,000 volts. Of course they can be driven higher. I measured 27kv on one the other day.
Answer: pretty much you need to put active regulation after the rectifier of the flyback.
a capacitance multiplier is probably  good start.
Answer:
Disclaimer: I am not responsible for the actions of others, this post is merely educational. Do not make this circuit.
The best way I could find to have high voltage ripple brought to negligible amounts is to drive the flyback transformer(or other high freq. AC source) at the highest frequency possible within the range of 20khz to 100khz, take its AC (remove diode) and use this as input to a full wave Greinacher multiplier, with a parallel filter network. It may be more practical to include a voltage divider after the flyback, as I intend to do.
This spreadsheet calculator helps to calculate capacitor and diode values for low ripple, according to your own desired current and voltage.
I used google translate on this pdf with OCR to learn of this design as Fig. 7. The final ripple is shown in Fig. 9.
Fig. 10 implies that inductors stray capacitors are added; the roughly translated text claims the following:
"Stray capacitors equivalently between two condenser columns
Must compensate for the lead current flowing through the
As shown in Figure 10, cw circuit capacitors
Insert an inductor in parallel between the column and the boost transformer
true
Sky
The gain of the step-down transformer at this time was increased."
I believe google translate mistakenly translated "step-up" as "step-down".
I recommend making a negative voltage version of this circuit to accomplish the ranges of voltages closer to earth ground and to reduce the number of stages and their consequential voltage drop.
Example component values are provided for Fig. 7, where any capacitor labeled "Cf" is equal to Co, and N is the number of stages in the Greinacher/Cockroft-Walton multiplier:
f=100KHz, I=75μA, I2=10μA
I3=10μA, Cp=36pF, Co=3900pF
R1=250KΩ, R2=125KΩ, R3=62.5KΩ
Keep in mind any load resistances affect the low pass filter cutoff frequency. I could not find much of example values for the "RL1" and "RL2" load resistances, seemingly they are just there to show how to connect the circuit to its application.
Due to low capacitance values and high voltages, it is cheaper to make your own capacitors according to this formula so long as large size is not a problem. Caps and diodes minimum ratings should be twice the input voltage and current.
It is best to avoid parallel diodes to achieve current rating because of their tendency to heat up and provide resistance, taking current disproportionately. Also, apply soldering heat conservatively to avoid breaking them.


Should the captions in a figure list include their references?

Question: The "list of figures" page in my Masters thesis lists many figure captions. Some of these figure captions have references. Should I remove or keep the reference in the list of figures? Definitely the references are always keeping in main text of the report, I just do not know how to handle them in the list of figures.
Comment: *[...] I just donot know how to handle them in the list of figures?* There are two questions in your post. 1) Whether it is right to have your reference tags in your list of figures and 2) how you should remove those tags. The first part seems to be on topic for this site because it is about style of thesis writing, but the second question is not. If you are writing your thesis by means of TeX/LaTeX; you may search about the second part of your question (the technical aspect) in other websites related to LaTeX. Your current question post seems to be too broad to me.
Comment: @EnthusiasticStudent I am asking the first question. IF the answer is KEEP then I donot need continue to ask question two.
Answer: Assuming that the thesis preparation guide from your university says nothing about this, I would approach the question by considering the purpose of the figures list.  The point of the figures list is to make it easier to find these key elements of a very large document; the caption fragment is intended to help a reader find the figure that they are looking for.  There are two typical approaches to making these such caption fragments, either of which might be reasonable:

List the exact caption for each figure, so that the list can be more complete.  In this case, you should keep the references, since they're part of the exact caption.
Make a one-line summary of each caption, so that the list can be more compressed.  In this case, you should remove the references, since you are making a digest in any case.

If you have lots of very long captions, option #2 is probably better, as otherwise it defeats the point of the index.  If your captions are all fairly short, then option #1 is probably better, since it provides a fuller summary of the contents of each figure.


Help regarding website based javascript using 0x for order trades

Question: Hey I apologize in advance, I am very new to a lot of the development regarding this subject. I have written my own erc20 token and was trying to find a way to easily trade it. I am aware of the many AMM exchanges, however I feel that the order system from 0x would fit better to the token. I am having difficulty trying to incorporate the 0x API into my website to allow these trades. Many tutorials or guides I have found use Node.js or functions only available to it. Is it possible at all to use the functionality of 0x's API from a standard website and if so, how would these functions be called?
Answer: The 0x instant project might be useful in your situation. 0x instant's repo
As the description reads -
"0x Instant is a product from the 0x core team that offers a convenient way for people to get access to a wide variety of tokens and other crypto-assets in just a few clicks. Developers can integrate the free, open source library into their applications or websites in order to both offer seamless access to crypto-assets, as well as gain a new source of revenue, with just a few lines of code...0x Instant UI powered by 0x API are bundled together in a convenient JS package for you".
It is live on mainnet and ropsten. Here is a live example of it used for dexkit


Derating for wires in conduit

Question: I'm wiring my workshop (standalone 200-amp service) and running wires in 1-1/4" PVC conduit under the slab from the breaker panel on one wall to another wall about 50 feet away. I have one 50-amp breaker feeding a 240v outlet and also want to run wires for 120V outlets on four 20-amp circuits, all with copper THHN. The 50-amp circuit will use 6 AWG power wires and an 8 AWG ground wire while the 20-amp circuits will use 12 AWG for power, neutral, and ground.  All the wires will go through the PVC conduit to a 6x6x4 electrical enclosure and from there through EMT to the individual outlets.  I just learned of MWBC's so I'm going to give them a shot.  Using an MWBC for the 20-amp circuits (diagram below), I count eight current-carrying conductors.  Checking a few tables, it looks like I need to derate to 70% of rated capacity but would still be OK with the wire quantity and AWG listed.  Conduit fill seems good, also.  Is there anything I overlooked or misinterpreted here?
Answer: No, this is much worse.  You just degraded yourself from six 120V circuits to four, and now you have foreclosed any possibility of converting a 120V circuit to 240V to support 240V shop tools, which are inevitable.
And if you get a shop tool, heater or mini-split that needs a 25A+ circuit, it's worse, because now you're out cash money for an extra 100' of #10 copper for that long conduit run.  You can't just fork the 50A outlet and serve a bunch of 15-30A 240V loads.
I mean compared to your earlier scenario you've sidestepped a thermal derate... but you're still trapped in a situation that a) degrades your capacity and you'll regret that later... and worse, b) costs you more.
The bog-standard thing that we recommend (and just about everyone does) is a 2-2-2-4 or 2-2-2-6 aluminum to a subpanel, giving 90A feeder (feel free to breaker at 60A if your panel's 60A breakers fit #2).  Nothing wrong with aluminum at these large sizes, and it's going to lugs made of aluminum anyway.  Now you price that in XHHW and it's cheaper than your two #6 copper and one #8.  And it's cheaper by enough to pay for a subpanel.
The subpanel then crosses off all these problems with thermal derate in the conduit.
Since you can use 2-2-2-4 SER here, that also means you can delete some conduit, because SER doesn't need conduit the entire route from panel to subpanel.

I was able to buy a few thousand feet of 12 AWG still on the spools from a local school auction for $100 so I'm going to use it :)

I know about that.  When I say you don't save any money, I'm assuming free #12.
Which is a false dichotomy anyway, because "use it, or throw it in the trash" are not the only 2 options.  I would have it up on Craigslist. By comparison, it's 17 cents per foot on 500' rolls, but most DIYers want less than 500', so they're paying extortionate per-foot prices at the store - up to 50 cents a foot for a 50' roll. And Home Depot's "price inflation" on small reels is shocking - pre-COVID it used to be $9.99 for a 50' roll. Now it's $25. (contrast with $52->$85 for 500').
Also if there's one thing I know about bargain/found wire, it's always the wrong color lol.  This is where novices think they can tape it, like a white wire in a cable to make it a hot.  Nope! That rule only works with cable, and only neutral-to-hot.  With THHN there's no remarking amongst hots, neutrals and grounds on wires #6 or smaller. Grounds must be green, or yellow/green natively. Neutrals must be white or gray.
So yeah, perhaps not the value you'd hoped for.
Comment: OP could presumably fit a 20A 240V socket to any of the MWBCs to power small 240V loads, though I agree that not having the option for 30A circuits is less than ideal.
Comment: @Someone But that would degrade the two 120V legs of the MWBC, leaving you only two for the whole place.
Comment: Fair. It would depend on loadings. The previously suggested 6 circuits/3xMWBC would be preferable.
Answer: On your new drawing if configured as MWBC's your wire count will only be six. 4 for the 20A circuits and 2 for the 50A.
On a MWBC's you only count the hots, since the neutrals only carry the imbalance. Stepping back let me explain, with a single circuit you (potentially) can have 20A of heat current that disapates heat on both the black and white. Add the red circuit from the other leg of the panel drawing 20A and sharing the white, then you get 20A on black, 0A on white, and the same 20A being routed through the load connected to the red circuit. You shifted the current and heat from white to red, and got a second circuit without any added heat in the conduit. The only time you get current/heat on the white is if you reduce the current/heat on red, black, or both. So since the white only carries heat is when the current is reduced on the black or red you don't have to count the white.
So in your original drawing:
You could arrange the top two 20A circuits sharing a neutral as a MWBC and those 3 wires only counts fill as 2 wires. The middle two could be a second MWBC, the bottom two a third and you have a total of 3 MWBC's functioning as 6 circuits with a wire count of 6. Add the two wires on the 50A recept, and you're at 8 wires, still in the 70% category.
Comment: Adding a second panel at  the location you show a junction box may prove cheaper. Working clearance might prove more of a complication.
Comment: Thanks @NoSparksPlease for the MWBC explanation.  Very helpful.  I will give serious consideration to the second panel idea.

Derating for wires in conduit


Show differentiability of $f(x) = \sqrt{x^4 + y^4}$ in $(0,0)$

Question: I'm trying to show the differentiability of $$f:\mathbb R^2 \to \mathbb R\text;\quad f(x) = \sqrt{x^4 + y^4}$$
in (0,0).
Here's my attempt:
Since $\partial_xf(x,y) = \frac{4x^3}{2\sqrt{x^4+y^4}}$ we would divide be zero plugging in (0,0), so we need to compute the limit manually (same holds for $\partial_y f(x,y)$). Doing that, we get $$\lim \limits_{h\to 0} \frac{f(h,0) - f(0)}{h} = \lim \limits_{h\to 0} \frac{h^2}{h} = \lim \limits_{h\to 0} h = 0$$
(analog for $\partial_y f(x,y)$), hence $\partial_xf(0,0) = 0$. Now it remains to show that $\partial _xf(x,y)$ (resp. $\partial_yf(x,y)$ is continuous. This is true since $$\lim \limits_{(x,y)\to(0,0)} \partial_xf(x,y) = \lim \limits_{(x,y)\to(0,0)}  \frac{4x^3}{2\sqrt{x^4+y^4}} = 0 = \partial_xf(0,0)$$
(analog for the partial to y). Since both partials exist and are continuous, we're done.
Now, is that attempt correct? If yes, did I do something I didn't necessarily have to do? Are there better/faster/easier methods to proof differentiability?
ADDITIONAL QUESTION: I did not prove that $\lim \limits_{(x,y)\to(0,0)}  \frac{4x^3}{2\sqrt{x^4+y^4}} = 0$. Do I need to do that and how would I do that?
Comment: You could also proceed directly and show that $$\lim_{(x,y) \to (0,0)} \frac{f(x,y)}{\sqrt{x^2+y^2}}=0,$$ but it would not be much easier.
Comment: If you let $$F(x,y)=\frac{4x^3}{2\sqrt{x^2+y^2}},$$ you can prove $$\lim_{(x,y)\to (0,0)}F(x,y)=0$$ easily by noticing that $F(r\cdot x,r\cdot y)=r^2\cdot F(x,y)$ for all $r$.
Comment: Hint: consider $f$ in the polar coordinates, i.e. let $x=r\cos \theta, y=r\sin \theta$, then $f(r,\theta)=r^{2}\sqrt{\cos^{4}\theta + \sin^{4}\theta}$
Answer: You could also prove $Df(0,0)=0$ directly. We need show
$$\frac{f(x,y) -[ f(0,0) + 0\cdot x + 0\cdot x]}{(x^2+y^2)^{1/2}} \to 0$$
as $(x,y) \to (0,0).$ Everything in brackets in the numerator is $0.$ So this fraction equals
$$\frac{(x^4+y^4)^{1/2}}{(x^2+y^2)^{1/2}} = \left (\frac{x^4+y^4}{x^2+y^2}\right )^{1/2}.$$
Since $(x^4+y^4)/(x^2 + y^2) \to 0,$ we're done.
Answer: For the differentiability we have to consider $$L=\lim_{\left(x,y\right)\rightarrow\left(0,0\right)}\frac{\sqrt{x^{4}+y^{4}}}{\sqrt{x^{2}+y^{2}}}
 $$ and taking the polar coordinates we get

$$\color{red}{L=\lim_{\rho\rightarrow0^{+}}\frac{\rho^{2}\sqrt{\cos^{4}\left(\theta\right)+\sin^{4}\left(\theta\right)}}{\rho}=0.}$$