Trace termination length limits

Question: Are there any length limits to series termination ? If I have a trace that's 12 in or a trace that is 100 in, can the same series termination resistor be used (assuming that Zo = 50 ohm) ?
Answer: What are you making :).  Yes the same series terminator can be used.  You want to match the output impedance of the driver to the impedance of the line.  As an example I have a total source impedance of 75 ohm driving a 75 ohm 1500 ft cable that is then end terminated at 75 ohms.
Now loss over 100 inches will different of course but it's not a function of the source terminator.
Btw there are some great books about this by Howard Johnson and Eric Bogatin
-----Edit to add simulation results
Let me try to add more color here, I assumed from your question that you are already considering 12" or 100" to be a transmission line for your application.
For slow speed signals or short lines we usually treat them as just a lumped element RLC.   The rise time vs the line length is too short to really be talking about reflections and terminating transmission lines.  To determine if you should be dealing with your connection as just a lumped system, vs a distributed (transmission line) system.   I use the following formula:
L = Rise Time(ps) / Delay(ps) in
Anything trace longer than l/6 I consider as a transmission line.  I'm not really interested in what you choose to do with your series terminator in the lumped case :), but let's talk about the transmission line case and 12" vs 100".
The Setup
I grabbed a 1.8V LVCMOS IBIS model from a well known FPGA vendor, it has about a 21.25Ohm output resistance, and it gave me about a 1.1ns rise time on a nice short 3" 50 Ohm transmission line.  The transmission line used in this model includes loss so you will see the effect when going from 12" to 100".  A perfectly matched impedance would be a series terminator of 28.75Ohms.  I'm showing the resulting waveform at the receiver, using the same model as an input.  Sorry the pics are small but I think you can click and enlarge.
Zs = 28.75 Tr = 1.15ns Len = 12inches
Here you can see we are well matched there's a little bit of a bump but over all pretty clean.

Zs = 100 Tr = 6ns Len = 12inches
Here I've increased the series terminator to 100 Ohms like someone might do for EMI to slow down the edge rate.  My rise time slumped to 6ns, now if I can take that maybe I can use the resistor to lower the possibility of EMI problems.  Personally I prefer to keep my traces close to my planes and route carefully to avoid EMI :)

Zs = 10 Tr = 0.9ns Len = 12inches
Ok let's go the other way with 10 ohm series termination.  Look at that, rise time increased a bit and there's clear overshoot, followed by a dip :)  Now if I was really careful and this bump and dip were inside my bit time maybe I could use this to squeeze out some extra margin.  If I'm running faster though that dip is going to affect the next bit in my stream and I really don't want to deal with that.  Why make problems for myself.
Note the scale change to capture the overshoot.

Z=28.8 Tr = 3.11ns L = 100 inches
Ok let's go big at 100 inches, you'll see loss is starting to roll off our signal at this distance and our rise time has gone up to 3.11ns.  Still looks pretty clean to me.

Z=100 Tr = 40ns Len = 100 inches
Let's try that 100 Ohm EMI trick at 100 inches, woah rise time goes way out to 40ns!  I really like this plot though, it's pretty cool.  This is a microstrip so flight time should be about 150ps/inch.  At 100 inches that's a round trip time of 30ns.  The second bump up you see between 40ns and 60ns, is just about 30ns from when the first wave hit the receiver so that must be the reflection coming back from the 100 Ohm source terminator.  Pretty cool if you ask me.
Now think about if you were trying to change bits quickly on a setup like this, you'd have low amplitudes and then much later on a reflection would come along and interfere with your bit...

Zo = 10Ohms  Tr = 1.5ns Len = 12 inches
Pretty cool lowering the impedance gave me a faster rise time, but I pay for it with overshoot just like last time.  Keep in mind that in this case too the opposite reflection is coming for your other bits if you are running fast enough.

Hope that helps clear some things up from this I think you can see what happens and make your own decisions.  Btw if you can swing it getting a hold of hyperlynx or something similar can really let you explore these kinds of questions.
Comment: The lengths were just dramatic examples. I have a book from Eric Bogatin, but I didn't see it mention anything about distance. Signal integrity has never been of concern until recently as my boards were getting bigger.
Comment: Ah yeah length or speed or both will force you to start looking at transmission lines.  Sounds like you're on the right track and asking the right questions.
Comment: This is the best case for signal integrity when the source impedance, transmission line, and load impedance all match. But in this case, if the open-circuit high output voltage of your driver is, say 3.3V, the high voltage at the load (ignoring attenuation in transmission line) will be 1.65V, which is too low for reliable switching of a 3.3V digital circuit.
Comment: Yes I only mention it as an example of a very long line in practice.
Answer: You may have to change the series terminator when trace length changes. A lot of the time, series terminators are just really damping resistors, and don't really match impedance. The driver impedance is extremely low, and the load impedance is extremely high (and slightly capacitive) and the trace is short enough that its impedance is mostly irrelevant. Think about it, if the source impedance is 50 Ohms, and the transmission line is 50 Ohms, the output voltage will initially be divided in half while the signal is in flight to the load.
The actual purpose of the series terminator is often just to damp out the overshoot, or slow the edges to help with EMC. This requires tuning (or simulation with accurate models), and line length can effect it, causing you to change the value of the series terminator.
When you get to long transmission lines, termination becomes pretty important. In theory, if your long transmission line is terminated at the load, you don't need driver series termination. There may be a mismatch between driver and transmission line, but it doesn't matter, because there will be no reflection, and no damping needed. In other words, you have a low impedance source driving a 50 Ohm (or whatever load). This presents no problem and allows the voltage to slew immediately to VCC. However, if there is any chance that the load is mismatched, then the best situation is to have the source impedance be the same as the transmission line. This way, any reflections coming back from the load will encounter a matched termination at the source and will not reflect again. But, as noted before, this situation cuts the drive voltage in half.
I would like to make clear that I recommend to always put series termination in any high-speed signal if you have room to place the resistor, especially clocks. You may need to tune the resistor to pass radiated emissions.
One other thing. If the chip has variable drive strength settings, start with 0 Ohm series termination and use the weakest drive setting that will meet setup and hold times. Usually reducing drive strength gets you more radiation reduction with less degradation of signal integrity than adding series resistance.
I believe this is all theoretically sound, and it is also based on my practical experience.
Comment: You know I re-read your answer and I think you are saying the purpose of series terminator changes when you go from the short (or lumped element) case, to the longer treat it like a transmission line case.  In which case I agree with you.
Comment: Series terminators are not just for dampening overshoot for high speed signals maybe for low speed short traces where it's not really a transmission line.  Yes the signal enters at half voltage and travels down the line that way.   It's the initial unterminated reflection that brings you up to full output swing.  In the high speed transmission line case your series terminator is there to absorb as much of that return reflection as possible.
Comment: I don't really agree with you, in a nice way I know it gets unfriendly on here sometimes.  If you increase your series termination above the matching value you will reduce your ringing by greatly slowing down the edge rate at the receiver.  This is a thing emi guys like to do that crushes the receive eye if you really are trying to go fast.  Going under the match and you will increase your ringing.  In the sim I just did this resulted in a nice overshoot at both the receiver and the transmitter.   That said if you don't need the speed I agree with you on the emi point.
Comment: And one more thing to be completely fair I have seen people use that overshoot slightly to their advantage when trying to tune an eye and get a little extra out of it.   But in that case I think the engineer had better be simulating, measuring and really knowing what they're doing
Comment: Maybe what I should have said is that though there is a sound theory and reason to use series termination, it is often the case that their value will not be chosen based on the transmission line impedance alone, and that changing trace length may necessitate changing series termination value.
Comment: @SomeHardwareGuy, I have no quarrel with you. Everything you say is sound and correct as far as I know. Matches up with what I learned in school and what I have seen on oscilloscopes. As for the basic question, does the value need to change with trace length, well, I don't think it is bad if we disagree.

Trace termination length limits


How can I remove more libs to reduce loading at startup?

Question: When I view the number of commands or functions through M-x I notice so many that I never use.  However I also didn't load them explicitly in my init.el either.  I do use use-package and have attempted to keep my dotfiles small and light, but it occurred to me that I might have some defaults going on in my build of Emacs that includes a number of 'site' libs.  I'm not sure if there might be a recommended minimum, or how to removed these unnecessary libs from startup.  How can I do that?
Comment: If you want to find out whether it is you or `site-lisp.el` that is doing this, start Emacs using `emacs -Q` (no init file), and see if you see the same thing.
Answer: You don't need to remove anything. Emacs has a system called Autoloading that has a list of functions and what file they are defined in, and only loads the file when the function is called. This means that most of the functions you see in that list are things that are not yet fully loaded. They will only be fully loaded the first time you use them.


What happens to a transaction if the network connection fails?

Question: What happens to a transaction when the client connection is lost.
Example the client is a web application code that starts a transaction to a remote server instance. The client sends the sql code to the server and waits for the transaction to complete.
What happens if the network connection fails? Does it depend on the point we are in a transaction? Is it irrelevant? Is it aborted?
Comment: if connection is lost uncommitted transaction is rolled back
Answer: http://dev.mysql.com/doc/refman/5.6/en/innodb-implicit-commit.html says:

If a session that has autocommit disabled ends without explicitly committing the final transaction, MySQL rolls back that transaction.

That means if your session disconnects for any reason, either by choice, or else because an error occurs like the network connection fails, etc., then a transaction in progress is rolled back.
If you think about it, this is the only appropriate thing for the RDBMS to do. It doesn't know if you had completed the work for your transaction only partially. For example, you might have debited one bank account, and you intended to credit another bank account to reflect a funds transfer. If the debit has occurred but the credit has not, and the connection is lost, MySQL has no way of completing the transaction or even of knowing what you wanted to do next. So it has to roll back all work so far.
Comment: But this assumes that I execute statements in my application code one at a time.So if the connection is lost before doing: `stmt.commit()` then it is rolled back.What if I pass a series of SQL statements?
Answer:
To disable autocommit mode implicitly for a single series of statements, use the START TRANSACTION statement.

Source: https://dev.mysql.com/doc/refman/5.6/en/commit.html


Tests of rational inattention

Question: Can you provide a reference regarding a revealed preference test(s) of rational inattention models, as proposed by Sims, ergo, using a mutual information measure as the cost of putting attention. And if possible can you briefly explained it. A link that explains the model is given here http://sims.princeton.edu/yftp/Gerzensee/info.pdf
Comment: Please expand this question. "I am interested" is too foggy: _Given_ that you are interested, what is that you require: a list of references of papers where such tests are described? Empirical studies? A description of a test? Also, don't take as granted that all people know about Rational Inattention. Please take the trouble to describe a bit more what this is all about, and ideally, provide a reference where the concept was historically introduced, or presented and described. Don't forget: the better the question, the better the answers, almost all of the time.
Comment: Not familiar with the literature, so I won't attempt to explain it. But, Andrew Caplin and Mark Dean have a working paper that might be of interest. [Revealed Preference, Rational Inattention, and Costly Information Acquisition](http://www.econ.brown.edu/fac/Mark_Dean/papers.shtml#Working), just scroll down--they have a draft and some supplementary stuff available.
Comment: I agree with ^ besides the part where Rational Inattention should be explained. A lot of the content here is advanced, such that explaining it in every question would make questions unreadable. Ex-ante, there is no reason why readers should be more familiar with with Neokeynesian Theory than with Sims' work on Rational Inattention. Explaining everything that goes beyond, say, First-year graduate courses in every question would be unpractical imo.
Comment: Which doesn't say that introductions should be forbidden. If OP has a question for a niche, he can chose to extend the question to include an introduction in order to increase the likelihood of a good answer. On the other hand, the people that need an introduction into niche A are probably not able to answer the "advanced question" in niche A anyways, so the direct advantage of doing so is limited.
Comment: @FooBar In my opinion, the body of a question should also perform the function to alert users here that something that they may not know, may be of interest to them. Of course they will not be answerers, but they may very well want to follow the thread here, which will increase traffic in the site, which is _vital_. "Explain a little bit more" could be just "...Rational Inattention, which models formally in an information-theoretic way the limited information-processing capacity of individuals".
Comment: I agree. But I don't think we should set it up as a rule and require it for every question above the mentioned first-year sequence. Just let OP decide on a case-by-case basis... free markets rule! :P
Comment: Comparing my beliefs now with the last-november-me: I agree now that while not necessary, a longer explanation would increase the value of the question by a lot and should be more encouraged.
Answer: Empirical Evidence on rational inattention:
-Title: Attention Discrimination: Theory and Field Experiments with Monitoring Information Acquisition,
Authors: Vojtěch Bartoš, Michal Bauer, Julie Chytilová, and Filip Matějka.
Source: IZA Discussion Paper No. 8058.
Link: Attention Discrimination: Theory and Field Experiments with Monitoring Information Acquisition
-Title: What Can Survey Forecasts Tell Us about Information Rigidities?
Authors: Olivier Coibion and Yuriy Gorodnichenko.
Source: Journal of Political Economy, Vol. 120, No. 1 (February 2012), pp. 116-159
Link: What Can Survey Forecasts Tell Us about Information Rigidities?
-Title: A Rational Theory of Mutual Funds' Attention Allocation,
Authors: Marcin Kacperczyk, Stijn Van Nieuwerburgh, Laura Veldkamp.
Source: NYU Working Paper No. 2451/28347 June 5, 2014
Link: A Rational Theory of Mutual Funds' Attention Allocation
Comment: This answer would be much more valuable with a short description/abstract of the papers listed, and/or a link to them.
Comment: I've added links to the papers now, I believe that anyone interested can and should rather read the original abstracts given by the authors than any imperfect summary of mine.
Answer: The following two papers by Andrew Caplin and Mark Dean focus on tests of rational inattention in a lab setting (i.e. with data one could in principle find the field). As BB King said, I won't do it any justice summarizing myself. The second is about Shannon entropy specifically.
http://www.econ.brown.edu/fac/Mark_Dean/Pub_Paper_8.pdf
http://www.econ.brown.edu/fac/Mark_Dean/Working_Paper_10.pdf

Tests of rational inattention


Adding an element to the beginning of an array without changing other array keys

Question: How can I add an element to the beginning of array without changing array key values in PHP?
Comment: Can you give an example with an array of what input and output you need
Comment: How would that work? What if you've got an item with the key `0`?
Answer: To keep numerical keys from being reindexed, you could simply add the arrays together.
Instead of:
array_unshift($arr1, $arr2)

try:
$arr1 = $arr2 + $arr1;

Comment: I've always steered away from adding arrays this way, favoring `array_merge` instead, but now I have a legitimate reason to use it.  Thanks!
Answer: If you use self-assigned (e.g. literal) keys, array_unshift() will do it.
If you use auto-generated (numeric) keys, how should that work? Use '-1' as the new first key?
EDIT:
Thank you to JasonS for pointing out an error in this answer.
ANY numeric key will be re-indexed by array_unshift(), no matter if it was auto-generated or self-assigned - if it's numeric, it'll get scrambled. See the link to the documentation above for details.
Comment: no because if the indexes represent ids in a table, there will never be a zero index so this works fine for these situations
Comment: @Nicola I'm sorry - I don't understand what you're trying to tell me.
Comment: I was meaning that if you return rows from a database and the keys of the array are the row ids, then an array will never have a 0 key.  Therefore, in this instance, a situation would not arise where the index would be -1.
Comment: Any numerically indexed array will have the keys re-indexed to start counting from zero, as explained in the array_unshift() docs you linked to. Your example has numeric keys and so will be re-indexed if using array_unshift()
Comment: I tried to edit your answer, using your original example, but it was rejected (by others). Presumably they didn't take notice that I was using your original example. So I'm posting it as an (abbreviated), comment. To take three items from an integer indexed array `$a`, and move them to the front of the array (your original example), you could do this. `$a = array_slice($a, -3, null, true) + $a;`
Comment: Since my last comment I've added the edits I made to your answer as my own answer, since that is what the reviewers suggested I do. Still, I thought the spirit of SO is to edit and improve answers rather than add multiple redundant ones. So please excuse me.
Answer: Use array_unshift(). (As mentioned, it will keep your string keys intact, but not numeric keys).
Comment: "All numerical array keys will be modified to start counting from zero while literal keys won't be touched." (http://www.php.net/array-unshift)
Answer: try this:
function array_insert(&$array, $insert, $position = -1) {
        $position = ($position == -1) ? (count($array)) : $position ;

        if($position != (count($array))) {
            $ta = $array;

            for($i = $position; $i < (count($array)); $i++) {
                if(!isset($array[$i])) {
                    die(print_r($array, 1)."\r\nInvalid array: All keys must be numerical and in sequence.");
                }

                $tmp[$i+1] = $array[$i];
                unset($ta[$i]);
            }

            $ta[$position] = $insert;
            $array = $ta + $tmp;
            //print_r($array);
        } else {
            $array[$position] = $insert;
        }

        //ksort($array);
        return true;
    }

Answer: Just a quick note for if you wish to use this in a loop...
As stated here: https://www.php.net/manual/en/function.array-unshift.php

array_unshift() prepends passed elements to the front of the array. Note that the list of elements is prepended as a whole, so that the prepended elements stay in the same order. All numerical array keys will be modified to start counting from zero while literal keys won't be touched.

TO give you an idea of how slow this is, we wrote some benchmark code (based on http://pastebin.com/Jad5TjsQ), and here is how it looks
mt@wizcorp-dev2:~/dev/test$ for d in arrayFillBrackets.php arrayFillPush.php arrayFillUnshift.php arrayFillPushReverse.php ; do cat $d; php $d; done
<?php
require "benchmark.php";

function ArrayFillBrackets()
{
    $result = array();
    for($i = 0; $i < 10000; $i++) $result[] = $i;
    return $result;
}

$result = array();
$result[10]['ArrayFillBrackets'] = Benchmark('ArrayFillBrackets', null, 10);

!!! Benchmarking function ArrayFillBrackets for 10 iteration (args:null)...
===================
Results:
===================
time total:     0.02686286
time min:       0.00198293
time max:       0.0058589
time avg:       0.002686286
memory total:       0
memory min:     0
memory max:     0
memory avg:     0
<?php
require "benchmark.php";

function ArrayFillPush()
{
    $result = array();
    for($i = 0; $i < 10000; $i++) array_push($result, $i);
    return $result;
}

$result = array();
$result[10]['ArrayFillPush'] = Benchmark('ArrayFillPush', null, 10);

!!! Benchmarking function ArrayFillPush for 10 iteration (args:null)...
===================
Results:
===================
time total:     0.03958679
time min:       0.003757
time max:       0.00485086
time avg:       0.003958679
memory total:       0
memory min:     0
memory max:     0
memory avg:     0
<?php
require "benchmark.php";

function ArrayFillUnshift()
{
    $result = array();
    for($i = 0; $i < 10000; $i++) array_unshift($result, $i);
    return $result;
}

$result = array();
$result[1]['ArrayFillUnshift'] = Benchmark('ArrayFillUnshift', null, 1);

!!! Benchmarking function ArrayFillUnshift for 1 iteration (args:null)...
===================
Results:
===================
time total:     3.62487912
time min:       3.62487912
time max:       3.62487912
time avg:       3.62487912
memory total:       0
memory min:     0
memory max:     0
memory avg:     0
<?php
require "benchmark.php";

function ArrayFillPushReverse()
{
    $result = array();
    for($i = 0; $i < 10000; $i++) array_push($result, $i);
    return array_reverse($result);
}

$result = array();
$result[10]['ArrayFillPushReverse'] = Benchmark('ArrayFillPushReverse', null, 10);

!!! Benchmarking function ArrayFillPushReverse for 10 iteration (args:null)...
===================
Results:
===================
time total:     0.05071593
time min:       0.00475311
time max:       0.00560999
time avg:       0.005071593
memory total:       108
memory min:     0
memory max:     24
memory avg:     10.8
mt@wizcorp-dev2:~/dev/test$

Please note that all tests are 10 * 10,000, except the array_unshift that runs 1 * 10,000 (was quite tired of waiting)... So again, don't use array_shift in iteration, as reversing the array only once costs almost nothing instead.
Answer: Adding my own (redundant) answer, because I tried to edit Martin's answer, using his original example, but it was rejected by others (not Martin). Maybe they didn't review the history of his answer, as I'm using his original example array and problem. Here is my rejected edit.
Kevin Wentworth's answer is correct.
Expanding on that answer using the original example from Martin's answer, if you have an array
$a = [1 => a, 2 => b, 5 => e, 6 => f, 8 => h, 9 => i];

and you want to take the last three items and prepend them to this same array, then you could do the following.
$a = array_slice($a, -3, null, true) + $a;

The resulting array is
 array (6 => 'f', 8 => 'h', 9 => 'i', 1 => 'a', 2 => 'b', 5 => 'e',)

Notes
The true argument to array_slice preserves numeric keys (no such parameter exists for array_unshift).
Although array_slice doesn't remove anything from the original array, because of the behaviour of the + operator on arrays, the last three items are cancelled out.
From the docs for the + array operator

The + operator returns the right-hand array appended to the left-hand array; for keys that exist in both arrays, the elements from the left-hand array will be used, and the matching elements from the right-hand array will be ignored.
Answer: array_unshift will not modify non numeric keys
Answer: Use array_unshift(); this will help u in adding element
Comment: `array_unshift()` WILL re-index numeric keys.
Answer: Well, if you are doing what I am doing and creating a select form using results from the DB with indexes being the ids from the DB table, but want to add say "Any..." to the array with an index of 0, simply create the array variable with that item first, then populate the remaining values from the database.  No need to unshift or order things after the database call.


Get time of last commit for Git repository files via Python?

Question: I have a Git repository with several thousand files, and would like to get the date and time of the last commit for each individual file. Can this be done using Python (e.g., by using something like os.path.getmtime(path))?
Answer: With GitPython, this would do the job:
import git
repo = git.Repo("./repo")
tree = repo.tree()
for blob in tree:
    commit = next(repo.iter_commits(paths=blob.path, max_count=1))
    print(blob.path, commit.committed_date)

Note that commit.committed_date is in "seconds since epoch" format.
Answer: An interesting question. Below is a quick and dirty implementation.
I've used multiprocessing.Pool.imap() to start subprocesses because it's convenient.
#!/usr/bin/env python
# vim:fileencoding=utf-8:ft=python
#
# Author: R.F. Smith <email@example.com>
# Last modified: 2015-05-24 12:28:45 +0200
#
# To the extent possible under law, Roland Smith has waived all
# copyright and related or neighboring rights to gitdates.py. This
# work is published from the Netherlands. See
# http://creativecommons.org/publicdomain/zero/1.0/

"""For each file in a directory managed by git, get the short hash and
data of the most recent commit of that file."""

from __future__ import print_function
from multiprocessing import Pool
import os
import subprocess
import sys
import time

# Suppres annoying command prompts on ms-windows.
startupinfo = None
if os.name == 'nt':
    startupinfo = subprocess.STARTUPINFO()
    startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW

def main():
    """
    Entry point for gitdates.
    """
    checkfor(['git', '--version'])
    # Get a list of all files
    allfiles = []
    # Get a list of excluded files.
    if '.git' not in os.listdir('.'):
        print('This directory is not managed by git.')
        sys.exit(0)
    exargs = ['git', 'ls-files', '-i', '-o', '--exclude-standard']
    exc = subprocess.check_output(exargs, startupinfo=startupinfo).split()
    for root, dirs, files in os.walk('.'):
        for d in ['.git', '__pycache__']:
            try:
                dirs.remove(d)
            except ValueError:
                pass
        tmp = [os.path.join(root, f) for f in files if f not in exc]
        allfiles += tmp
    # Gather the files' data using a Pool.
    p = Pool()
    filedata = [res for res in p.imap_unordered(filecheck, allfiles)
                if res is not None]
    p.close()
    # Sort the data (latest modified first) and print it
    filedata.sort(key=lambda a: a[2], reverse=True)
    dfmt = '%Y-%m-%d %H:%M:%S %Z'
    for name, tag, date in filedata:
        print('{}|{}|{}'.format(name, tag, time.strftime(dfmt, date)))

def checkfor(args, rv=0):
    """
    Make sure that a program necessary for using this script is available.
    Calls sys.exit when this is not the case.

    Arguments:
        args: String or list of strings of commands. A single string may
            not contain spaces.
        rv: Expected return value from evoking the command.
    """
    if isinstance(args, str):
        if ' ' in args:
            raise ValueError('no spaces in single command allowed')
        args = [args]
    try:
        with open(os.devnull, 'w') as bb:
            rc = subprocess.call(args, stdout=bb, stderr=bb,
                                 startupinfo=startupinfo)
        if rc != rv:
            raise OSError
    except OSError as oops:
        outs = "Required program '{}' not found: {}."
        print(outs.format(args[0], oops.strerror))
        sys.exit(1)

def filecheck(fname):
    """
    Start a git process to get file info. Return a string containing the
    filename, the abbreviated commit hash and the author date in ISO 8601
    format.

    Arguments:
        fname: Name of the file to check.

    Returns:
        A 3-tuple containing the file name, latest short hash and latest
        commit date.
    """
    args = ['git', '--no-pager', 'log', '-1', '--format=%h|%at', fname]
    try:
        b = subprocess.check_output(args, startupinfo=startupinfo)
        data = b.decode()[:-1]
        h, t = data.split('|')
        out = (fname[2:], h, time.gmtime(float(t)))
    except (subprocess.CalledProcessError, ValueError):
        return None
    return out

if __name__ == '__main__':
    main()

Example output:
serve-git|8d92934|2012-08-31 21:21:38 +0200
setres|8d92934|2012-08-31 21:21:38 +0200
mydec|e711e27|2008-04-09 21:26:05 +0200
sync-iaudio|8d92934|2012-08-31 21:21:38 +0200
tarenc|8d92934|2012-08-31 21:21:38 +0200
keypress.sh|a5c0fb5|2009-09-29 00:00:51 +0200
tolower|8d92934|2012-08-31 21:21:38 +0200

Edit: Updated to use the os.devnull (that works on ms-windows as well) instead of /dev/null.
Edit2: Used startupinfo to suppress command prompts popping up on ms-windows.
Edit3: Used __future__ to make this compatible with both Python 2 and 3. Tested with 2.7.9 and 3.4.3. Now also available on github.
Comment: Thanks. I probably should have mentioned that I'm trying to do this under Windwos, though, so the `/dev/null` bit won't work.
Comment: @RintzeZelle Answer updated to use the more portable `os.devnull`.
Comment: Thanks! I just had to add the path to the git executable to the Windows PATH system variable. Command prompts are opened (and closed) for each file though, although it might be possible to suppress that: http://stackoverflow.com/questions/1016384/cross-platform-subprocess-with-hidden-window
Answer: You can use the GitPython library.
Comment: Thanks. I found that library already, but I couldn't make much sense out of its documentation (I haven't really studied up on the inner workings of Git).
Answer: This works for me
http://gitpython.readthedocs.io/en/stable/tutorial.html#the-tree-object
As per the doc As trees allow direct access to their intermediate child entries only, use the traverse method to obtain an iterator to retrieve entries recursively
It creates a generator object which does the work
print tree.traverse()
<generator object traverse at 0x0000000004129DC8>

for blob in tree.traverse():
    commit=repo.iter_commits(paths=blob.path).next()
        print(blob.path,commit.committed_date)

Comment: In Python 3 you need to use `next(repo.iter_commits(paths=blob.path))`.


Parsing an Address with T-SQL

Question: I am trying to figure out how to parse an address using T-SQL and I suck at T-SQL. My challenge is this,
I have a table called Locations defined as follows:
<code>- City [varchar(100)]
- State [char(2)]
- PostalCode [char(5)]
</code>
My UI has a text box in which a user can enter an address in. This address could be in the form of essentially anything (yuck, I know). Unfortunately, I cannot change this UI either. Anyways, the value of the text box is passed into the stored procedure that is responsible for parsing the address. I need to take what the person enters and get the PostalCode from the Locations table associated with their input. For the life of me, I cannot figure out how to do this. There are so many cases. For instance, the user could enter one of the following:

Chicago, IL
Chicago, IL 60601
Chicago, IL, 60601
Chicago, IL 60601 USA
Chicago, IL, 60601 USA
Chicago IL 60601 USA
New York NY 10001 USA
New York, NY 10001, USA

You get the idea. There are a lot of cases. I can't find any parsers online either. I must not be looking correctly. Can someone please point me to a parser online or explain how to do this? I'm willing to pay for a solution to this problem, but I can't find anything, I'm shocked.
Answer: Perhaps a CLR function might be a better choice than tsql.  Check out http://msdn.microsoft.com/en-us/magazine/cc163473.aspx for an example of using regular expressions to parse some pretty complex string inputs into table value results.  Now you get to be as creative as you please with your regex matching but the following regex should get you started:
<code>(.*?)([A-Z]{2}),? (\d+)( USA)?$
</code>
If you're reluctant to use CLR functions, perhaps you have regex functionality in the calling system, like ASP.Net or PHP.

Parsing an Address with T-SQL


Something that can not be undone or undo

Question: A word for something that can't be undone or undo ?
Comment: permanent? irreversible? You can try these in a thesaurus.
Comment: Please show the results of your own research to save others repeating it.
Comment: `non-repudiable` is one that doesn't show up in most thesaurus, but I added it to powerthesaurus.org
Answer: "irreversible"
<code> -  not able to be undone or altered.
 - not able to be reversed.
</code>
source.
or
"irrevocable"
<code>not able to be revoked, changed, or undone.
</code>
source.
Answer: Synonyms for "permanent" from NOAD 2011:
lasting, enduring, indefinite, continuing, perpetual, everlasting, eternal, abiding, constant, irreparable, irreversible, lifelong, indissoluble, indelible, standing, perennial, unending, endless, never-ending, immutable, undying, imperishable, indestructible, ineradicable, ineliminable; literary sempiternal, perdurable, long-term, stable, secure, durable.
Synonyms for "secure" from NOAD 2011:
fastened, fixed, secured, done up; closed, shut, locked, safe, protected, sheltered, certain, assured, reliable, dependable, settled, fixed.
Answer: not a single word but
written in stone (or carved in stone/engraved in stone)

Fig. permanent or not subject to change. (Often in the negative.) Now, this isn't carved in stone yet, but this looks like the way it's going to be. Is this policy carved in stone, or can it still be modified? - The Free Dictionary

Like the definition says - it is usually used in the negative, but you can use it the other way for emphasis as well.
Answer: "At(or beyond) the point of no return"


Will put a metallic plate behind an RFID antenna change the readings?

Question: I have an RFID antenna that has been delivered with a flat metallic plate glued to its back. I don't know much about this antenna it arrived without any documentation, it is square and can read tags in every orientation (not polarised). I am wondering whether I could remove it or if this might have been glued for a reason (insulation? amplification?). I guess in a more general sense my question is: does a metallic object behind an RFID antenna change the readings?
Answer: Most known RFID methods are digital, and incorporate some means of self-consistency checking.
Therefore, the actual identity "readings" would not be altered.  What would be altered (likely substantially reduced) would be the chance that any given reading attempt is successful.
If you have a reader that reports some kind of signal quality metric, that could be altered.
Ultimately your question is a bit too broad, as going beyond the simplistic question, the meaningful question requires speculation about the nature of the unspecified device.
Answer: I assume that OP means "change antenna parameters", not digital content of ID. Note that RFID "Near Field Communication" antenna in smartphones is frequently glued to phone's battery, Samsung phones (S3, S4, J3, etc.) have it. The battery case is essentially metal, and the antenna works just fine. So the metallic plate might limit the distance of sensing (my speculations), so two persons with tags approaching the RFID base won't accidentally interfere.
There were quite a few studies on this subject, "because metallic surface changes its radiation pattern, input impedance, radiation efficiency and resonant frequency", see this article, and sophisticated modeling methods were used to evaluate the plate effects.
To reduce the influence of metaillc mounting surfaces on performance of RFID installations, special flexible ferrite tiles are offered,

I would hazard to guess that the plate is inseparable part of the antenna design, and I wouldn't remove it.


My GFCI red light is on and it won't reset

Question: None of the circuits breakers are tripped but when I try to reset the button it won't reset. It just pops back out and the red light stays on. There is no power coming through the outlet or any outlets downstream from it.  It is on our screen porch and I sprayed the pollen off the porch last week.  That is when I happened.  This has happened before when I spray off the porch and after a day or so when things dry out it starts working again.  But it has been 5-6 days of warm dry weather, so I would imagine everything is dry and it will still not reset.
Comment: Not a good idea to spray any liquid on an outlet, GFCI or otherwise or on any electrical fixtures. When it won't reset, there's a reason. There may be an unsafe condition it's protecting you from or it's just worn out. GFCI units have a finite life span. Yours may need replacing.
Answer: Sounds like you killed it with water, or you've created a persistent ground fault that's triggering it with water. I would guess that repeated wetting has just finally killed the GFCI itself.
This is one reason that most of us prefer to locate the GFCI indoors, not out. If you are going to continue with an outdoor location, put a full weatherproof in-use cover over the new GFCI outlet, and buy a WR (weather-resistant) GFCI for a few bucks more.
Answer: Turn the power off, pull the GFCI receptacle out.  remove any wires off of its "Load" terminals, and cap them off.  Put the GFCI back in the box, power back up and hit "Reset".
If it still won't reset with nothing plugged in and nothing on Load, then the GFCI is finished.
If it resets fine with the Load wires disconnected, then the GFCI is fine and there is a ground fault in the onward part of the circuit. Work the trouble tree for that, i.e. divide and conquer.
Comment: So I took off the Load wires and the GFCI is resetting w/o those connected, but when I connect them back it doesn't reset.  So it sounds like the fault is downstream.  How do I find the ground fault downstream?
Comment: @Joe figure out the route of the circuit, find a nice halfway point and disconnect hot and neutral there. See if the GFCI clears. Now you know which half the problem is in, divide *that* in half and repeat.
Comment: Thanks!  I did it and found it to be the ceiling fan with the fault.  I'm sure it got wet when spraying off a week ago.  Any thoughts why it wouldn't be working by now?  I would imagine it has dried out.  thanks again, you've been a big help.


Meaning of "Red Flags" and "Bites the Dust" in Sia's song, Elastic Heart?

Question: I've read the lyric Elastic Heart by Sia, and I don't really understand in this part:

And I wanted it, I wanted it bad
But there were so many red flags
Now another one bites the dust
Yeah let's be clear, I'll trust no one

I'm not sure about this, but does red flags here mean something like blockades?
And how about bites the dust? I have no idea what this means.
English isn't my main language, so I'm not really sure what these lyrics mean.
Comment: This question belongs on http://english.stackexchange.com/ or even better http://ell.stackexchange.com/ considering that these are common expressions. Or how about Google: https://www.google.com/search?q=what%20does%20%22red%20flags%22%20mean ?
Comment: Agree with @BCdotWEB. [english.se] has a "lyrics" tag for exactly this.  [ BTW similar on the French one.
Answer:
Now another one bites the dust
Yeah let's be clear, I'll trust no one

Sia uses the common metaphor of love as war. The opening phrase, "another one bites the dust," borrows the title of a Queen song to suggest a recent relationship has failed, and that it feels like a death.
This metaphor sets up lines in the song that refer to both love and to Katniss Everdeen, the warrior for peace in the Hunger Games trilogy. The second line suggests that Sia does not have Everdeen's aim.

And I wanted it, I wanted it bad
But there were so many red flags

Sia wanted things to work out but there were too many 'red flags', referring to warning signals, like flags used in motor racing. They indicated conditions were too unsafe to continue, and this hints that the singer is the one who ended the relationship.
More on Genius


Manually installing sample schemas in Oracle 11g

Question: I am trying to manually install HR schema in my oracle environment by following the steps specified by oracle Help Center (11.2). Web link: https://docs.oracle.com/cd/E11882_01/server.112/e10831/installation.htm#COMSC001
However, I have run into some problems. It is specified that I only need to call hr_main.sql script (located in human_resources directory)using this command @?/demo/schema/human_resources/hr_main.sql.
My human_resources has only a script named hr_code and when I run it I do not get any type of installation procedure (entering password, tablespace etc as oracle specifies in the procedure).
Any help as well as other possible solutions would be very much appreciated.
Alternatively, could it be more feasible if I created a new database using database configuration assistant (thus installing the schemas during the installation procedure itself)?
Answer: Manually Installing Sample Schemas

Install Oracle Database Examples (Companion CD, part of the media kit)
  to include these scripts in the demo directory under $ORACLE_HOME.

The scripts for installing sample schemas is a seperate download and they are not installed by default.
Download Oracle Database Examples
Follow the instructions there.
Comment: Hey, thanks for the suggestion. I am following it, but the oracle link to download Oracle Database Examples zip file (from [link]http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html) is broken.
Comment: @Bendemann The link here is not broken: http://www.oracle.com/technetwork/database/enterprise-edition/downloads/112010-linx8664soft-100572.html
Answer: Oracle has them on GitHub.
https://github.com/oracle/db-sample-schemas
They also have the scripts for LiveSQL userd.


Change the name of Server console

Question: Is there a way to change the name Server to something else, so when I announce something from the server console it could be from a name rather than just Server e.g.
this - [God] hello world.
instead of this - [Server] hello world.
Answer: There are two ways.
The first and easier option would be to summon an armorstand at spawn in the permanently loaded chunk named "God".
summon armor_stand X Y Z {Marker:1b,CustomName:'{"text":"God"}'}

You can then use it to announce stuff:
execute as @e[type=minecraft:armor_stand,name=God,limit=1] run say Hello world
-> [God] Hello World

The second option is to use tellraw. This is a bit more advanced, but I would suggest using it. It doesn't require an entity and is thus more fail save. It is also good practice to avoid using say.
tellraw @a {"text":"[God] Hello world"}
=> [God] Hello World

This also allows you to customize the output. For example to make "[God]" bold and dark red:
tellraw @a [{"text":""},{"text":"[God]","color":"dark_red","bold":true},{"text":" Hello world"}]

Change the name of Server console


TR-8 as master clock for eurorack system

Question: I am trying to clock my eurorack with my TR-8. I have a 2-hp MIDI to CV/gate, which I feed with the MIDI out of my TR-8 (using a MIDI-to-USB cable as the 2-hp takes USB mini as input). I tried changing the MIDI channels on the TR-8, but it didn't change.
Any idea?
Thank you.
Answer: I thought I had seached the internet enough before asking this question, but apparently not. Here is the answer: I need a MIDI host to convert the MIDI from the TR-8 to USB-MIDI read by the 2hp MIDI to CV/gate.


Finding relations using Maple

Question: Suppose that one has 3 (complicated) functions $f(x)$, $g(x)$, and $h(x)$. I would like to use Maple to find any relations that may exist between these functions. For instance, if it so happens that $f(x)=5g(x)$, I would like to uncover that. Is there a Maple command which takes a set of `things' and compares them, with the goal of uncovering any relations that may exist.
Comment: Try to ask at http://www.mapleprimes.com as well.
Answer: It depends on what kind of relations you are expecting.  If you think there is a linear dependence (with constant coefficients), take the vectors $\langle f(x), g(x), h(x) \rangle$ for (more than three) different values of $x$ and see if they are linearly dependent.
If you think there is a polynomial $P(f(x),g(x),h(x))=0$ of degree at most $n$, do the same for products...
Comment: Where?  I don't see any expression.

Finding relations using Maple


What would a completely terraformed Mars look/behave like?

Question: A Mars with an atmosphere, oceans, flora and fauna, and capable of sustaining human life? How would such a Mars possibly behave? Knowing that Earth and Mars are quite similar but also have large and various differences in terms of size, satellites, orbit, proximity to the sun, etc?
Comment: Hi FireSoul and welcome to Worldbuilding!  Are you asking about geological processes, biological processes, or...?  A good forum to test this question out is our sandbox, where we can help you narrow the question down and get you the correct answers you need for your story/thoughts: https://worldbuilding.meta.stackexchange.com/questions/635/sandbox-for-proposed-questions
Comment: I suspect it would just keep orbiting the sun. Most planets have pretty predictable behaviors like that.
Comment: Try reading the Red/Blue/Green Mars books.  Those go into it pretty well (especially the last one).
Comment: @ShadoCat. Yes, the books of Kim Stanley Robinson are a MUST, if you ever consider terminating Mars
Answer: In part, it would depend on how advanced the technology is, so there's no one answer and a fair bit of opinion.
In my opinion, Mars is a lousy terraform planet because it's too small.  People don't like to hear that, but it's my opinion.   It has a hard time holding onto it's atmosphere and it would probably lose water fairly quickly It's below the gravity needed to hold onto it's atmospheric water vapor and it might lose some oxygen and nitrogen too for the same reason.    I'm not even talking about the solar wind blowing the atmosphere off the planet, but straight forward escape, like how hydrogen and helium escape the Earth's atmosphere into space.

Source.
There's 3 ways to deal with atmospheric escape, One is replenishment.   A body like Ceres has enough Oxygen, Nitrogen and Water to supply Mars for a very long time, but that's a huge amount of work and energy required.
Another is to build an envelope around the whole planet.   Think giant balloon, which could be semi-pressurized so you'd need less atmosphere.     Problem, if it springs a leak, and Mars gets hit by hundreds or thousands of meteors every day - well, that approach might cause more work than it saves.
Three, my personal favorite - keep Mars cold.   It's cold anyway, so, let it be cold.   Forget the rivers, forget the oceans, let it be covered with snow and ice.   (you can have underground rivers).   That reduces the amount of water vapor in the air significantly.   Cold air is very dry, and you hope the planet has enough gravity to hold onto it's O2 and N2 to limit replenishment.   (I'm just going off a chart in Wikipedia, so I'm not really sure how fast it would lose atmosphere).
Letting mars be mostly covered with snow would have the benefit of reducing the dust storms - which are no fun at all.   Yes, the albedo would make the planet colder, but keep a balance of greenhouse gas heat trapping and albedo reflection, so it's cold enough to stay mostly snow covered, but not necessarily crazy-bonkers cold.
You could have an equatorial ring of tree life, (think pine trees, arctic spruce, cold weather trees).  and for food, grow food mostly in greenhouses.   Underground rivers could be used to keep the equatorial ring of trees alive.  Mars could have a cold weather ecosystem, squires, birds.  some predators for balance.   What's the point of terraforming if you can't have a real nature.
In the low G, animals would probably grow larger over time.   How birds adapt to the low G would be interesting and I'm not sure how to predict.   Flight would be easier.   Climbing trees would be easier.  Trees might grow taller.
We'd want a real atmosphere, probably similar to Earth.  Oxygen, Nitrogen, CO2. (but not too much CO2 - as we'd want to keep it snow covered).  Argon could be used for filler/density as well.   We'd only need about 20% oxygen to breath comfortably, maybe a bit higher percentage if it was lower air pressure, but we'd probably want at least 60%-70% of 1 atm for comfort.  An atmosphere that thick would have a pretty good chance of developing it's own ozone layer - which is very important for going outside.  Protection from UV rays.
I don't think there's much point to terraforming if you can't take a walk outside and breathe the air.  cold isn't a big deal - wear a coat, hat and gloves.
Human cities, we'd probably want centrifuges to keep our bodies adjusted to earth gravity.   Spend an hour or two in a centrifuge gym every day and the rest of the time, enjoy the low G.   Sports would be interesting.   An average person would be able to dunk like MJ.
I don't think Mars would ever be like a "new world", stake a claim on new land and start planting crops.   It essentially has no soil.   Soil has to be made.   It gets about 1/2 the sunlight Earth gets, so even if you had soil, growing crops in low light would be difficult and lower yield.   You'd depend on technology.   Greenhouses, underground water systems and artificial lighting to grow food.   Over the long run you'd need to monitor atmospheric depletion and (perhaps) build an artificial magnetic field, which wouldn't necessarily always need to be on, it could just be turned on for when a coronal mass ejection was headed towards Mars.
That's my 2-cents based on it's low gravity.   I'd want a larger planet before I'd have have oceans and rives and rain and all that good stuff.
Beyond that - the sky's the limit with technology.   Buildings could be built some 3 times taller than on Earth in the low G.  More than a mile high with good construction.    It would be possible to jump out of windows on Mars wearing a parachute.  (OK, that's possible here too), but the lower gravity and slower descent would make such activity feel a lot safer.   Human powered flight would be possible too.   Bicycles that lifted you into the air on pedal power alone.   Jetpacks - also much easier on Mars.   Flying cars.  Come to think of it, Mars sounds dangerous.
If you got into a fender-bender on mars, driving around and the person was in good shape, they might be able to lift up and tip over your car with you inside it.   Road-rage is a problem here.   on Mars, car flipping might be a real thing.
That's all I've got.
Answer: Lack of magnetic field and low gravity: The low gravity is going to reduce the muscle and bone strength of people and animals, but probably proportionally to what they need on Mars, so it shouldn't be an issue for "local" life.
Without something really radical like an artificial planetary magnetic field, the atmosphere would probably bleed away over astronomical/geological time scales - just as it did in the early Solar System.
Mars apparently had a much more atmosphere early on, and in fact appears to be currently losing what limited atmosphere it has at about 100 grams per second - https://www.nasa.gov/press-release/nasa-mission-reveals-speed-of-solar-wind-stripping-martian-atmosphere .
However, this isn't terribly relevant on timescales meaningful to human civilization - and if you could terraform it in the first place, you could presumably make up any losses every couple million years, if the Martian civilization lasts that long.
Effects of orbit/Sun distance: To keep the temperature at a level comfortable for humans and non-Arctic/Antarctic Earth life, you'd need more greenhouse gases in the atmosphere. Thankfully, there's plenty of room to increase the CO2 and methane levels from what current Earth has before it gets toxic to humans (recent ISS studies suggest subtle CO2 problems, like increased headaches, happen at lower levels than previously thought - but that's still a few thousand parts per million, whereas current Earth is about 400 ppm and pre-industrial levels were under 300).
There will be less energy for solar power, but in general plants can't efficiently use the full intensity of Earth noon sunlight, so it shouldn't matter much for photosynthesis (maybe you'd lose some in early morning/evening, but plants usually aren't light-limited anyway).


What does the expression "body shop" mean?

Question: I recently encountered the expression "the man in the body shop", and I have absolutely no idea what it means. All help is welcome.
Comment: Without context there is no way to answer this question.
Comment: I believe [the man in the body shop was Eye-gor.](http://www.youtube.com/watch?v=g0_1F0_20mE)  ;-)
Answer: body shop:

Date: 1954
  a shop where automotive bodies are made or repaired

See this article for "body shop" context:

From the sales floor to the body shop to the office there is a resounding feeling that this Ford dealership is a good place to work.
  The man in the body shop pointed out that the air filter system overhead was something that Dean Green voluntarily installed for the welfare of the employees.

so... basically "the mechanic", the technician, the repairman.
Comment: Excellent, I will have to point this out to my wife the next time she tries to drag me into one of [these](http://www.thebodyshop-usa.com/). "Darling, the body oil they are advertising is not the kind of oil you think it is!"
Comment: The longer form 'automobile body shop' occurs in the [Classified Index of Occupations](http://books.google.com/books?id=9Yh6BPjQrQUC&pg=PA91&dq="body+shop") for the Fiftenth Census 1930
Answer: Without knowing the context, I can think of body shop as "a garage where repairs to the bodies of vehicles are carried out"; the phrase would then refer to somebody who repairs automotive bodies. The Merriam-Webster Dictionary dates body shop to 1954.
Answer: In the UK, body shop means this http://www.thebodyshop.co.uk/, The Body Shop http://en.wikipedia.org/wiki/The_Body_Shop, a chain of shops selling products for the body, face, hair and home.
Answer: Body shopping can also refer to consulting companies that hire people and then provide them directly to their clients for the clients to manage (as opposed to the consulting companies managing them). The wikipedia article at http://en.wikipedia.org/wiki/Body_shopping seems to focus on offshore / outsourced work, but it can apply to other consulting companies as well.
In this case the "body shop" would refer to the consulting company, and so "the man in the body shop" might be someone who works for that kind of consulting company.
Answer: When your car breaks down, you take it to the shop (rarely referred to as a garage any more.) When your car gets dented in a fender-bender, you take it to the body shop.


Making Strip Map Polygons Flush?

Question: When I create a strip map of a line the polygons overlap slightly even if I choose a 0% overlap. How Can I make the strip map completely flush without manually going through each frame and clipping them?
Comment: I don't think it is possible, unless your line is straight, or you are Ok to be part of it outside polygons
Comment: Not sure I follow what you are doing really, but maybe you can do something with either Data Frame Properties>Data Frame>Clip Options or Advanced Drawing Options>Layer Masking?
Comment: I was able to use topology to assist in finding the areas that overlap but I can't merge multiple overlapping areas, only one at a time.
Comment: Intersect your polygons with themselves (run intersect with only the one layer). Use the output to erase the original layer then merge the intersect output with the erased dataset. There will likely be some field you can dissolve on or you could try running Eliminate at that point.
Answer: First do a self intersection (with only one layer in intersect).  Then erase the sliver polygons from the original frames.  Next dissolve the slivers with no input or statistical fields.  Do a one-to-one spatial join with the original slivers on the dissolved slivers with a field mapping of minimum page number to the output.  Merge the final sliver polygons with the pages that have the slivers erased.  Then dissolve the merged layer based on the page number.

Making Strip Map Polygons Flush?


Moving django apps into subfolder and url.py error

Question: I have a question about putting django apps into "apps" subdirectory. I have the app called "faktura" in a project_root. I didn't like the fact it lies there and I want to store all my apps under "apps" subdirectory.
So, I found out that I could extend python path to "apps" subdir, so after looking in the internet, I added this string to settings.py: sys.path.insert(0, os.path.join(PROJECT_PATH, "apps")). Then I added the app to INSTALLED_APPS like "faktura". Everything worked smooth until I added url(r'^faktura/', include('faktura.urls')) to urls.py in the root. Since that, Django throws the error message "No module named faktura" full taceback is here: http://dpaste.com/737380/
What can be wrong here, why only urls.py can't find the app? And does it can't find this app if I added it to the PATH? I spent a morning trying to figure out what's wrong and now I need your help.
Answer: I don't know why the previous answer got -1 aside from maybe a few redundant lines that can be corrected. Anyway, I found a slightly different method that doesn't involve adding anything to the python path.
This is my final directory structure, I will explain in a moment:
mysite
├── mysite
│   ├── __init__.py
│   ├── settings.py
│   ├── urls.py
│   └── wsgi.py
├── apps
│   ├── __init__.py
│   └── myfirstapp
│       ├── __init__.py
│       ├── admin.py
│       ├── models.py
│       ├── tests.py
│       └── views.py
└── manage.py

No matter if you have just created your project or if you want to move your apps, create the apps subdirectory that should contain your apps. The trick is to add an __init__.py to that directory.
mkdir apps
touch apps/__init__.py

Now you can move your existing apps into the apps subdirectory. If you would like to create a new one instead here are the commands:
python manage.py mysecondapp
mv mysecondapp apps/

Warning: Don't be tempted to call python manage.py ./apps/mysecondapp. For some reason this deletes all other apps in that directory. I just lost a day of work this way.
Next, you will need to fix a few imports. Your settings.py should be prefixed with apps:
INSTALLED_APPS = (
    ...
    'apps.myfirstapp',
    'apps.mysecondapp'
)

Lastly, fix your project's urls.py to prefix apps:
urlpatterns = patterns('',
  url(r'^myfirstapp', include('apps.myfirstapp.urls')),
  ...
)

Depending on how you wrote them, you might also have to fix a few imports inside your app. Either just use from models import MyFirstModel or also prefix it using from apps.myfirstapp.models import MyFirstModel.
In short, if you make your apps directory a python package (by adding __init__.py), you can use it as part of the import path. This should work regardless of the deployment method with no extra configuration.
Comment: from apps.myfirstapp.models import MyFirstModel not working in the secondapps models file..don't know why..
Comment: Note that you **can't** use `apps.myfirstapp.apps.MyfirstappConfig` in `INSTALLED_APPS`
Comment: I ran into a problem that wasn't addressed in this answer, in that the urls.py in apps/myfirstapp needed to have the first argument of patterns(...) set to 'apps.myfirstapp', as before I moved it, it read only 'myfirstapp'.  Django's debug output was much less than helpful for this.
Comment: @ReinstateMonica Why we cannot use `Config`?
Answer: Use BASE_DIR variable from the settings.py. It should be already defined:
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

Better not use the __file__ attribute in manage.py and wsgi.py, as they are located in different directories.
So, just add the following to manage.py and wsgi.py (and to the celery.py if you use Celery):
    from django.conf import settings
    sys.path.append(os.path.join(settings.BASE_DIR, "apps"))

You will end up with the following project structure:
project
├── project
│   ├── __init__.py
│   ├── celery.py
│   ├── settings.py
│   ├── urls.py
│   └── wsgi.py
├── apps
│   ├── app1
│   └── app2
└── manage.py

Answer: To keep your Django applications in a subfolder (such as apps/), first add the following to your settings.py:
import os
PROJECT_ROOT = os.path.dirname(__file__)
Then in manage.py:
Right under #!/usr/bin/env python add:
import sys
from os.path import abspath, dirname, join
from site import addsitedir
Right before if __name__ == "__main__" : add:
sys.path.insert(0, join(settings.PROJECT_ROOT, "apps"))
Comment: Yep this works... but if you use - like I do - uwsgi as a app server then you should ALSO apply the insert into the wsgi.py file.
Comment: Do you really need the unused imports (addsitedir, dirname, abspath)? Or are they left over from a previous version of this answer?
Answer: @Radu Gheorghiu's answer; It is not necessary to edit settings.py, and the insert path line can be condensed to 1 line of code.
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "apps"))

I sourced this answer from http://obroll.com/nested-application-inside-apps-sub-folder-in-django-1-3/
Comment: Please do not create an answer on an answer. If you want to add something to Radu's answer, use the comment function.


Meaning of "bejesus" in the idiomatic expression "… the bejesus out of …"

Question: According to multiple online dictionaries, bejesus is a quite common mild expletive used to express surprise and/or dismay and is derived from by Jesus. But what does it mean? The phrase "you scared the by Jesus out of me" doesn't seem to make much more sense than the derivative expression.
Answer: It simply means the thing was scary enough to cause you to speak that oath.
Compare "scare the crap out of", which means the thing was scary enough to cause you to defecate.
The oath by Jesus itself is already in print by 1863:

By Jeſus, quoth Ben. Johnſon, (his uſual Oath) I believe this is my son Randolph, which being made known to them, he was kindly entertained into their company, and Ben. Johnſon ever after called him Son.
  —The Philobiblion: a monthly bibliographical journal, Volume 2, by George Philip Philes

But using be for by in dialect speech is earlier (1848):

"Be Jasus! and well you may be, my dear frind!" cried the gallant gentleman. "But who is the governor, d'ye say?"
  —The mysteries of London, Volume 4, by George William MacArthur Reynolds

The single word bejasus appears in 1882:

One mad-looking fellow put his bayonet to my side, and swore, "bejasus, he would skipper me."
  —The Battle of Groton Heights, by William Wallace Harris

The earliest example of "bejesus out of" I could find is from 1932:

[T]he most interesting and at the same time the most frightening spectacle of the modern world is probably Gary Cooper's new house. The decorations are late African in period, and are guaranteed to scare the bejeezus out of any slightly cock-eyed sightseer who might have the misfortune to get locked in after closing time.
  —Motion Picture, Volume 44 [emphasis added]

Note the variant spelling in the quotation above. The spellings bejesus and bejeezus both first show up in 1932; bejaysus late in the same decade. The slightly more euphemistic "bejeebers out of" is much more recent; it first shows up in a letter to Time Magazine in 1973.
Comment: Yes, it *does* make sense put that way. Also, "scare the *crap* out of" could be interpreted as scary enough to make you shout "Crap!"
Comment: @Kaivosukeltaja I had not thought of that. To me, that expression has to do with the "[fight or flight response](http://www.theregister.co.uk/2006/10/20/the_odd_body_bowels_fright/)".
Comment: *Bejeebers* sounds like something out of Scooby-Doo; I wonder if it might not have been used there first (or, barring that, whether the author of the letter to *Time* was a fan of the show).
Answer: The etymology of the word reads:

mild expletive, 1908, perhaps from by Jesus. To beat the bejesus out of someone is from 1934.

As the OP has noted, the word appears to be an ameliorated version of the exclamation, "By Jesus!", and appears to have been a preferred expletive of the Irish.
Here's an excerpt from Gas House McGinty, a novel by James Thomas Farrell (1933):

Over here, the Sammies marched down Michigan Boulevard while the bands played, and the natives cheered and waved the flags they had bought in Woolworth's jitney gyp joints. And bejesus, did the bands rum-tum-tum, and did the natives ...

One can extrapolate that the word, through extensive use, took on a life of its own as an oath, shedding its "By Jesus" roots. This eventually led to its current use as seen in this 1937 excerpt from To Quito and Back by Ben Hecht:

Besides I used to whip the bejesus out of Zamiano when he was a snotty little brat. I should have murdered him. Isn't it gloomy.

Wiktionary's definition of bejesus states:

(euphemistic) Used for emphasis, similar to crap, shit or wits.
The bear scared the bejesus out of us.

Meaning of “bejesus” in the idiomatic expression “… the bejesus out of …”


My site and AD?

Question: We are about create my sites for our users. In this regard I have some questions.
How many my sites can we have in a web-application for my site?
How many AD sources can one have with regards to Active Directory and My Site in SharePoint 2013 ?
Answer: in this case msdn is you best friend. As i created it for the company that i work for i could answer this for you ;)
mysite limmit for webapplication
first you need to understand what is a mysite? a mysite is a site collection.
The mysite when setup if done according to best practice should be hosted on its own web application. This web application would be the central storage of all personal mysites. Each individual user would have a mysite directly under the webapplication which is basicly a site collection for that user.
so now we know that mysite is a web application and that each users mysite is a site collection we can now find out the max size. A farm can hold 750,000 site collections out of 750,000 is 500,000 personal site collections. Lets not forget that is huge!! this would mean that your content database would be massive.
for a big business with over 500,000 employees would require a different setup with a sharepoit farm (need multiple shared farms) to accept 1milion users+! as this would be a massive strain on the farm and is highly not recommended. The chances of you getting to this value is remote unless you work for a massive global organisation like a bank!
http://technet.microsoft.com/en-us/library/cc262787%28v=office.15%29.aspx#WebApplication
http://technet.microsoft.com/en-us/library/cc262500%28v=office.15%29.aspx
Active directory sources
This depends on your topology of your network but in theory you should be able to add as much as you need! Once again its based to your topoloy and how AD is setup on how many forrests and domains you have and the trust between them.
its not hard todo but a pain to get right! in my case i did some STSADM code to get multiple forrests to connect together within sharepoint when searching for users in peoplepicker.
key here is that you have your user service configured properly so that multiple domains and/or forests are searchable for user profile import and from this they can create their mysite.
sync one way(import ad)
https://amjadk.wordpress.com/tag/step-by-step-active-directory-user-profile-import-for-sharepoint-2013/
http://technet.microsoft.com/en-us/library/gg602075%28v=office.15%29.aspx
http://technet.microsoft.com/en-us/library/ff182925%28v=office.15%29.aspx#connections
Comment: Thanks for the valuable input. I read that content database has limit of 200 GB. So, what does one do when the content database of my site gets bigger than 200 GB?
Comment: its not a hard limmit but just that its recommended that you dont hit that point but otherwise you could increase it to any value you like. The 200GB hard limmit is set for Remote BLOB Storage (RBS). According to msdn you could go upto 4 terrabites let alone 200GB! but you need to meet the requirements to reach that ammount like hardware to support it. If you see 200gb as too much you could scale up the content db. i think what your looking for is http://blogs.msdn.com/b/markarend/archive/2008/04/14/scaling-mysites-how-many-mysites-per-content-db.aspx
Answer: Maximum supported limit is 750,000 MySites (site collections) per web application. I don't think there is a limit. There is nothing on TechNet that says otherwise, but I'm sure the number you have is much less than SharePoint can handle. If users are planning on using their MySites for content, I would recommend creating multiple MySite content databases, depending on how much space a user would have in their quota for space. Just remember that 200GB is the supported size for read/write operations in a normal web application, unless you are in a medium sized organization with a fast SAN and virtual server environment, then it's 4TB.
For example (under a 200GB limit):
100 content databases for 10,000 mysites can allow 1,000 people spread across all content databases, and each user having a maximum quota of 200 MB.
Comment: sorry mike you have it wrong! technet nope msdn yes! there is a hard limmit as i have outlined and given url for! 750k is max out of 750k only 500k is personal sites and 250k is other ;) http://technet.microsoft.com/en-us/library/cc262787%28v=office.15%29.aspx#SiteCollection
Comment: also site collections per content DB is 10,000 maximum (2,500 non-Personal site collections and 7,500 Personal Sites, or 10,000 Personal Sites alone) with what ever limit you set on mysite quota
Comment: See my edit please. thanks for your input ali, I have misspoke!

My site and AD?


How to communicate a 'positive' result (from a blood test) that is actually negative for the user?

Question: I'm designing an app for a doctor with a list and detail view of blood tests. What's important is to see if the test has a negative (you don't have the disease) or positive (you have the disease). I was wondering if anyone has a good idea for the visual design because it feels strange to use red/green or a checkmark/cross or something similar.
Comment: Are you designing the app for the doctor (or other medical professionals) to use, or will it be usable by the layman?
Comment: For de doctor and someone with a medical background. The person having the disease (or not) does not see the design.
Answer: Using color or icons to reinforce your message here would likely be the wrong direction to go. Color in interfaces have evolved to take on a pretty standard set of definitions:

What you're displaying to your patients isn't always an issue of pass/fail. A lot of blood tests don't even test for things with a true/false outcome. Some measure a particular level (like cholesterol or CD4 count). When taking a blood test, red, to me, would best be used if there was a problem with the test and I need to retake it. Green would simply mean the test was successfully executed. I wouldn't consider it being indicative of the particular result.
A color that can help is blue, which indicates that this-thingy-right-here is important information that pertains to you. I would say list the results of each test in blue, and then provide a description in plain english to the patient as to what that means. Don't focus on if the result is good or bad, as you won't always know that anyway (for example: your Lymphocyte count is under 200 ppm... yay?) and it is the doctor's job to explain that to the patient. Not the lab technician.
Answer: Since results of such tests could be critical and affect the person adversely, don't rely solely upon terms like 'positive' or 'negative'.
Have a CONCLUSION section that clearly and textually states the conclusion(s) of the test.
For example -
Have all the test results and conclusions shown under a different sections like:
TEST CONCLUSIONS (FOR PATIENT)

You're fine! Just ... keep away from alcohol, will ya?
Also, you'd need to spend your next month's salary but that's ok
Found a couple pennies. Good thing 'cause you'd probably need 'em anyway

TEST RESULTS (FOR DOCTOR/DOCTOR'S COPY/FOR REFERENCE)
blah blah blah ... medical terms ... weird numbers and words
confusing language ... high anxiety terms ... some more blahs ...
This would definitely avoid confusion.
Answer: This is an interesting UI/UX problem. If I was tasked with such a design, my first instinct would be to reference existing test result forms and use them as a design guide.
If your primary user (of the interface, not the subject of the test result) is a medical professional, I would not be concerned with conveying the information as "good" or "bad". Instead, focus on conveying the result of the test. A medical professional should be adept at parsing test result information and conveying the conclusion to a patient.
If you absolutely must emphasize the result, the only information the design should convey is whether or not the disease was present.

Disease Test Results
Disease 1: Positive
Disease 2: Negative
Disease 3: Negative


Default audio output to HDMI

Question: I have an RPi4 installed with ubuntu20.10. I connect it to a display(TV) using an HDMI cable.
The problem is the output is by default set to a 3.5mm jack. I override that by running the raspi-config script and then I change the audio output to HDMI.
How to set default audio output to HDMI?
I opened /boot/config.txt
/boot/config.txt was empty
Also I tried to access the opt folder
cd: /opt: No such file or dir
Comment: Does / should Ubuntu use config.txt as per Debian?  Maybe adding the lines in usercfg.txt   Saying that, there are some answers in https://ubuntu-mate.community/t/no-sound-through-hdmi-ubuntu-mate-20-04-pi4/22478/8 that may help and the 'how to' config docs at https://core.docs.ubuntu.com/en/guides/intro/get-started have two sound sections.
Comment: There are many Ubuntu releases, so unless you identify which no one knows, but whatever you CAN NOT use a Raspberry Pi OS solution.
Comment: Yeah, @Milliways I have mentioned the ubuntu release '20.10'
Comment: @Andyroo I guess Debian doesn't use config.txt. I posted that just to clarify. I will check the solutions you mentioned.
Comment: @Milliways Ubuntu lots of Rapsberry Pi OS solutions work on Ubuntu/debian, specially now that Raspberry Pi OS comes with pulseaudio. The flip side is even more true... debian solutions almost always work on Raspberry Pi OS
Answer: Note Not working on 21.10
Tl;Dr: Run the commands in the codebox to configure pulseaudio... and restart.

Things to note:

There is no raspi-config outside RaspberryPi OS
The config file you seek is in /boot/firmware/config.txt
But hdmi mode 2 probably ins't your issue... That's about DVI mode, if you can manually turn the audio on, that's not the problem.
pulseaudio has a config file at /etc/pulse/default.pa used by Ubuntu
You can override it for the current user by copying it to ~/.config/pulse/default.pa

The sink doesn't exist at GDM login apparently... but you can set the profile anyway. Userland pactl breaks and and the gui sound indicator shows no icon... but it selects the HDMI audio by default, and so does the volume control.
I have an ArgonOne which has a breakout board which connects to the headphone, probably tripping a headphone plugged in sensor. I tried disabling the sensor, but that didn't work.
Btw, Ubuntu 20.10 seems to use GDM to start pulseaudio, it's not a service and the daemonization is disabled. Also, pulse is known to be finnicky when independent digital and analog audio devices run off the same card... that may be why the GUI isn't able to set the default sink normally.
To fix for Pi 4B, run the following as the user you normally log into.
cp /etc/pulse/default.pa ~/.config/pulse/
sed -i 's/load-module module-switch-on-connect/# &/' ~/.config/pulse/default.pa

Restart.
Source

Me after a few hours of pain and suffering.
Comment: I tried running the code block. Its not working. :sad:
Comment: @BaskaranPanneerselvam Try now. This worked reliably. I had a lot of false starts due to a race condition. Pulseaudio 14 would help, with it's blacklist, but we have 13. The card is simply not ready when the settings are loaded. And the is no way to unload the modules in a way that reliably results in headphones being unselected. The best way I've found is to disable the module entirely.
Comment: still no change

Default audio output to HDMI


How do I get the date from two weeks ago using Solaris' date?

Question: Linux uses:
date -d "2 weeks ago" +%b

which is equivalent in Solaris?, I searched online, but nothing.
Comment: Add your Solaris version to your question.
Answer: Solaris' date can't do that.  AFAICT from the man page, it can't even display an arbitrary date, so you can't just get the date in seconds since the epoch, subtract 2 weeks (14 * 86400 = 1209600 seconds), and then give that to date +%b.
If you can, install GNU date.  Either under /usr/local/gnu/bin or similar if you have root (BTW, GNU Coreutils which contains GNU date is available pre-packaged for Solaris here), or in ~/bin if not.
If you can't install GNU date, your next best option would be to write a wrapper around strftime() to do the calculation mentioned above, or write a 5-liner in perl or python both of which have excellent date handling libs.
Comment: I hope you recommend to install `gdate` in a way that makes it obvious for the user that he is not using the standard `date` utility. While it is not that problem with date, there are many gnu utilities that miss important features you get with standard system features (e.g. ACL support) and some gnu utilities are even risky as e.g. gnu strip may destroy binaries because it misses complete ELF support.
Answer: Just do gdate instead of date. This will give you GNU date as opposed to the traditional Solaris date command. This will work unless you are on a very old version of Solaris, i.e. Solaris 10 or before.
Note that if you are in a local zone then your sysadm may have decided for you that gdate shouldn't be available, despite the fact that it is available by default in the global zone. In that case go tell him he's a .....  (use your own word here).
For more information:
Solaris default install (user tools)


What is the difference between ethers.getDefaultProvider() and providers.EtherscanProvider() in ethersjs?

Question: What is the difference between ethers.getDefaultProvider() and providers.EtherscanProvider() in ethersjs and when should you use one over the other?
Answer: From ethers docs,
ethers.getDefaultProvider() connects you to a node on the ethereum network. Use it when you want to interact directly with the blockchain.
new ethers.providers.EtherscanProvider() connects you to the Etherscan blockchain web service API. Use it if you only want data from the Etherscan web service API.
Answer: ethers.getDefaultProvider() is meant basically for prototyping and testing.  When you connect to a specific provider with your own API key, you have better performance and access to communication metrics. (see docs)

These API keys are provided as a community resource by the backend
services for low-traffic projects and for early prototyping.
Since these [default provider] API keys are shared by all users (that
have not acquired their own API key), they are aggressively throttled
which means retries occur more frequently and the responses are
slower.
It is highly recommended that you sign up for a free API key from each
service for their free tier, which (depending on the service) includes
many advantages:

a much higher request rate and concurrent request limit
faster responses with fewer retries and timeouts
useful metric tracking for performance tuning and to analyze your customer behaviour
more advanced APIs, such as archive data or advanced log queries

For example, to connect to an Infura node on the Ropsten test network:
let provider = new ethers.providers.InfuraProvider("ropsten", infuraProjectID);
And for WebSockets:
let infuraRopstenWSProvider = new ethers.providers.InfuraProvider.getWebSocketProvider("ropsten", process.env.RPC_INFURA_PROJECTID);
You can also use a simper JRPC URL, however JRPC connections are read-only:
let JRPC_infuraRopstenProvider = new ethers.providers.JsonRpcProvider(process.env.RPC_INFURA_HTTP_ROPSTEN_URL);
Here is also a nice Ethers.js Cheat Sheet for other functions.


Relation between Network Hash-Rate & bitcoin value?

Question: how is the relation betweeen network hash rate to healthyness of bitcoin, such as bitcoin value compared to USD, or the growth rate of this currency?
Answer: You can find graphs charting this relationship at http://bitcoinx.com/charts/. (scroll down)
Network hash rate and exchange rate are certainly correlated, but the relationship is very complex, I think it would be inaccurate to say that one depends on the other. In general, if price increases due to an outside factor (eg. new adopters buying Bitcoins) hash rate will go up, as you can see in the chart at the above link around July 2011, when price spiked and hash rate followed.
Impact of hash rate changes due to outside factors on price is harder to predict. Hash rate increases can lead to increased investor confidence in the currency (which would increase price), but they can also drive miners on the edge of profitability out of mining and potentially even Bitcoin, decreasing the price. (less participants in a market generally leads to price decreases, though not always)
Comment: Well put.  I would add that the *marginal* cost of acquiring a Bitcoin, has a floor set by the current hash rate using the most efficient source of computation (energy costs).  A rational actor will choose to mine for Bitcoins rather than purchase them, if the cost of mining is lower than the cost of exchange.

But getting involved in mining has rather large fixed costs that make it difficult for most individuals to choose mining over purchasing; so one can expect the cost of Bitcoin to be at a premium over energy costs of mining for the near future.
Answer: Bitcoin hash rate is:

25 BTC / (physical cost to perform one hash in BTC) / 10 minutes.

There are two factors in this formula which are subject to change:

The physical cost to perform one hash in BTC is obviously linked (linearly) to the healthiness (trade value) of the currency. It's also subject to change with hardware improvements, but this has no effect on the overall security of the system. (Attackers would also benefit from it.)
Last, 25 BTC is in fact not fixed: it's an approximation of today's block reward + transaction fees miners get mining one block.
In particular, every 4 years this reward is scheduled to be divided by two. Therefore, if the trade value of bitcoins is not multiplied by two every four years, the total effort spent on mining (to secure the chain) could decrease.
Answer: The network hash-rate is mostly reflective of Bitcoin's exchange rate.  If the exchange rate goes up, then mining's hash rate will follow.  It will lag, but it will mostly follow the direction and to a lesser degree, the magnitude of the change in the exchange rate.
While there are some who will mine regardless of profitability, each additional bit of hashing has the effect of lessening profitability -- displacing those who are mining for economic gain.
So as a whole, the network hash rate itself doesn't say much about the currency's health.  Now for each individual that goes and spends $20K worth on mining hardware, you can assume that one individual believes in bitcoin's future enough to risk that kind of an investment, if profit was the reason for pursing such a venture.


Password required for ubuntu core on raspberry Pi3 after configuration (ssh login)

Question: I followed the instructions for generating a pair of private and public key as in help.ubuntu.com/community/SSH/OpenSSH/Keys. I uploaded the pub key on my SSO account, I copied ubuntu-core-16-pi3.img file on a sd and configured ubuntu core on my raspberry pi 3. I try to connect from another computer on my home network having ubuntu 16.04 LTS. A password is required! What password!? What is going bad?
Answer: Your ssh keys have to be present, in the proper location, on the computer you are using to remotely login to the Pi and/or installed in the application you are using to login. If this is not the case you'll be asked for a password -- which does not exist.


Rebel T6 EOS LCD Screen completely blank

Question: The LCD screen on my Rebel T6 is completely blank. I have tried all suggestions listed of similar questions to no avail. Battery is fully charged, I have taken battery out and replaced, clicked the on and off switch, Display button, Menu,ETC. Unfortunately, I did not purchase the extended warranty and my one warranty just expired. Any other suggestions welcomed.
Comment: Take it in for servicing.
Comment: Unfortunately, when a camera malfunctions and you've "tried everything"...the only thing left to do is send it in for repair. If the cost of that is more than the value of the camera or too high a percentage of its value to you, then get a new camera. Sorry mate, that's about all you can do.
Answer: As you indicate Any other suggestions welcomed here are a few:

Take the camera in for repairs. Don't expect it to be cheap.
Use an external HDMI monitor to show the camera display on there.
Tether the camera to a computer via USB and control it through EOS Utility.

For the last two suggestions you can search the pdf manual and DuckDuckGo to find out how to do that.
If something is unclear, please search Photo.SE before posting a new question.


Actuality of black hole singularity

Question: With the completion of finite theory of physics, even if the theoretical black hole singularity is completely eliminated, how can we be sure that it does not exist in nature? Physics theory is essentially verified by experiment. So, apart from the theoretical elimination, the actual singularity should also be refuted by the experiment, but is this possible?
Comment: *With the completion of finite physics theory* What do you mean by this? What is "finite physics theory?"
Comment: I think we won't know that until we have a theory!
Comment: Why is this being close voted? It's asking if we can ever prove experimentally that a singularity does or doesn't exist. That seems a perfectly good question to me.
Comment: No need to wait for a new theory, because the singularity already does not exist in the current theory, but is only a widespread misconception. To exist means to move in time. For an external observer nothing exists inside a BH, because it is causally disconnected from our time. Inside the BH, no singularity exists at any moment of time until time ends at the center and matter ceases to exist, because, again, to exist means to move in time and there is no time beyond the center, so nothing there exists. There also is no gravity inside a BH where things at rest move only in time.
Answer: The scientific method requires that measurements are made, shared, and replicated. It is true that in this sense all the data predicted by Einstein gravity beyond the black hole horizon is beyond the reach of the scientific method because no one will share their results with people outside the horizon. (There might be a society of people inside the black hole for whom the question is relevant, but let's omit that right now.)
To underline this argument, consider the following: the field equations of general relativity allow to be extended beyond null infinity. Null infinity is kind of like spatial infinity, but for good reasons, relativists make a distinction between the two. Null infinity is the point where light-rays go after an infinite amount of oscillations of their waves. Below you can see a Penrose diagram including the extensions of the Schwarzschild space-time beyond null infinity (in the corners). (Taken from Haláček & Ledvinka, 2014)

In fact, it turns out that it is convenient to have these "ghost regions" in numerical simulations to compute radiation leaving the space-time! On the other hand, these are obviously beyond the scientific method as well, because to probe them, you have to send a massless object to infinity, and this massless object will never send a signal back.
Consider yet another argument from quantum mechanics. Bohmian quantum mechanics posit that behind the wave-function of the theory, there are real particles that are "piloted" by the wave field. However, the theory is built so that even though the particles have real trajectories and behaviors, their real states are unmeasurable without collapsing the wave-function. Additionally, the theory has a singularity in the moment of the wave-function collapse, and the predictions are identical to usual quantum mechanics. In other words, there is a fundamental experimental horizon beyond which we cannot see the behaviour of these particles. We instead choose to describe a "reduced" theory describing only the "enveloping" objects, normal quantum mechanics describing the wave-function, and we even understand it as more fundamental or "correct" than Bohmian mechanics.
In many approaches to curing the singularity of the black hole, a similar approach is taken as well. These approaches essentially tell you that the black hole interior is not physical at all. You should instead describe an "enveloping", "reduced" theory of black holes and gravity in general. In this theory, it is automatically obvious why a single region of space-time is "the" priviliged physical part, and this will lead you to a more fundamental insight (and true observable corrections outside of the horizon). It might be convenient to keep the interior of the black holes for numerical simulations in a classical, Einstein-gravity limit, but this is somehow only a crutch, the region beyond the horizon is a "ghost region" that tells you nothing of the real physics. A number of these ideas can be summarized as the Holographic principle and various incarnations thereof.
Answer: I dont think you can be really sure of anything in science.
By experiment, you can refute theories that lead to singularities and show, that the only (or simplest) theory we concieved of which fits the data is the one without singularities. But i dont think we can ever make such a bold claim as to say "we cannot in principle concieve of any theory with singularities that would fit the data". Data are, after all, always faulty and unprecise. You are always left with regimes you cannot probe. And who knows what awaits us in those regimes?
In science you say something is true if it works and fits together. You may put forward more theories with same predictions (quantum mechanics has several of them) and scientist will choose the true one to be the one with the easiest math and the rest will be left as curiosities. Even though philosophers (and especially general public) could argue science doesnt know what is actually true, for scientists, the truth has more pragmatical meaning. They dont seek or  care about absolute truths. They care about truths, that works the best. And that is what is meant, when scientist presents some claims as true.
Comment: ...of it being wrong in the regimes in which it was tested. As is known from theory of renormalization in QFT - the long/short range physics has negligible consequences on physics in our regime.
Comment: Data may always be imprecise, but it is possible to quantify the level of error in experimental measurements. If enough data is gathered to support a theory to within a six sigma level of accuracy, that effectively 'proves' the theory, because the chance of it being wrong is so small.

Actuality of black hole singularity


No checked-in version files during content database migration

Question: We're planning to migrate our SharePoint from 2013 to 2019 via 2016 bridge farm. Will documents with no-checked in version will migrate ? If I use sharegate or any third-party tool, it is mandated to check in the files .
Answer: You will need to check in the documents in order to migrate them along with the content database. You can use PowerShell to do the trick.
Here's a sample script (web application scope) for your reference:
<code>Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Set the Web application URL
$WebAppURL="<WAURL>"

#Get the Web Application
$WebApp = Get-SPWebApplication $WebAppURL

#Get all Site collections from the web application
$SitesCollection  = $WebApp.Sites

#Enumerate all site collections in the web application
Foreach($Site in $SitesCollection) {

    #Loop through each sub-site of the site collection
    ForEach($Web in $Site.AllWebs) {
        Write-host -f Yellow "Searching for Checked out Files in Web:" $Web.Url

        #Loop through each list
        ForEach($List in $Web.Lists) {
            #Get Checked out files with no checkin versions
            $CheckedOutFiles = $List.CheckedOutFiles

            #Loop through each checked out File
            ForEach ($File in $CheckedOutFiles) {
                Write-Host -f Yellow "`t '$($File.LeafName)' at $($File.Url) is Checked out by: $($File.CheckedOutByName)"

                #Take ownership of the file
                $File.TakeOverCheckOut()

                #Check in the file
                $List.GetItemById($File.ListItemId).File.Checkin("Checked in by Administrator")
                Write-host -f Green "`t Took Ownership and Checked in the File!"
            }
        }
    }
}
</code>
Reference: PowerShell to Manage Files Which Have No Checked in Version in SharePoint.


touchegg gestures on desktop

Question: I am trying to use three finger scrolling on the desktop, but it is not responding. It only works when i am holding the cursor on a app or the plank. Can i edit something in the config file to change this?
Comment: Welcome to Ask Ubuntu!  Please, *please* provide more information in your question - we cannot even begin to help you if we don't have any information about your problem!  For example, what make/model of computer are you using?  Are you utilizing a touchscreen or a touchpad (yes, I know that you are on a desktop, but having confirmation helps)?  The more information that you can provide, the better that we can help you.
Answer: Assuming you are using the gnome-shell you can configure it to Have file manager handle the desktop. This way the desktop is managed by nautilus and your gestures should be recognized.
The easiest way to configure this is to use Gnome Tweak Tool.
<code>sudo apt-get install gnome-tweak-tool
</code>
Launch Gnome Tweak Tool from the Gnome Shell menu. It will be called Advanced Settings. Then, click on the Desktop button. Enable the option that says "Have file manager handle the desktop. Now, any files placed in the Desktop folder inside your home folder should appear on ther desktop.
As I'm lazy the former paragraph was taken from:
https://askubuntu.com/a/105988/233113
Just changed the formatting and stripped the image.
If you want to use (three finger) scrolling to switch desktops, I remember there was a setting someday, I recommend using the touchegg action called CHANGE_DESKTOP. If you use SCROLL it will scroll on any windows.
Comment: Nice workaround.
Answer: if you are using a touchscreen, might be an upstream based bug: http://libcoding.wordpress.com/2013/11/02/issue-with-touchpad-in-ubuntu-13-10-in-xps-12/comment-page-1/#comment-22
Comment: Welcome to Ask Ubuntu!  It appears that your answer has little relation to the question; your link concerns the Dell XPS 12 whereas the question does not provide any information about the make or model of computer.  Additionally, please refrain from posting links as answers, as they have a habit of dying and then just taking up space.  Try to at least copy down the gist of the link's content.  Thanks!

touchegg gestures on desktop