Python glob but against a list of strings rather than the filesystem

Question: I want to be able to match a pattern in glob format to a list of strings, rather than to actual files in the filesystem. Is there any way to do this, or convert a glob pattern easily to a regex?
Comment: I don't know if I'm doing anything wrong, but I think the author wanted a solution to match against any string, not just filenames, and the solutions here are not able to extract even a simple string like `max_volume` from `[Parsed_volumedetect_0 @ 0x7fbf12004080] max_volume: -9.3 dB`. I'm trying to extract `{max,mean}_volume` from ffmpeg output
Answer: The glob module uses the fnmatch module for individual path elements.
That means the path is split into the directory name and the filename, and if the directory name contains meta characters (contains any of the characters [, * or ?) then these are expanded recursively.
If you have a list of strings that are simple filenames, then just using the fnmatch.filter() function is enough:
import fnmatch

matching = fnmatch.filter(filenames, pattern)

but if they contain full paths, you need to do more work as the regular expression generated doesn't take path segments into account (wildcards don't exclude the separators nor are they adjusted for cross-platform path matching).
You can construct a simple trie from the paths, then match your pattern against that:
import fnmatch
import glob
import os.path
from itertools import product

# Cross-Python dictionary views on the keys
if hasattr(dict, 'viewkeys'):
    # Python 2
    def _viewkeys(d):
        return d.viewkeys()
else:
    # Python 3
    def _viewkeys(d):
        return d.keys()

def _in_trie(trie, path):
    """Determine if path is completely in trie"""
    current = trie
    for elem in path:
        try:
            current = current[elem]
        except KeyError:
            return False
    return None in current

def find_matching_paths(paths, pattern):
    """Produce a list of paths that match the pattern.

    * paths is a list of strings representing filesystem paths
    * pattern is a glob pattern as supported by the fnmatch module

    """
    if os.altsep:  # normalise
        pattern = pattern.replace(os.altsep, os.sep)
    pattern = pattern.split(os.sep)

    # build a trie out of path elements; efficiently search on prefixes
    path_trie = {}
    for path in paths:
        if os.altsep:  # normalise
            path = path.replace(os.altsep, os.sep)
        _, path = os.path.splitdrive(path)
        elems = path.split(os.sep)
        current = path_trie
        for elem in elems:
            current = current.setdefault(elem, {})
        current.setdefault(None, None)  # sentinel

    matching = []

    current_level = [path_trie]
    for subpattern in pattern:
        if not glob.has_magic(subpattern):
            # plain element, element must be in the trie or there are
            # 0 matches
            if not any(subpattern in d for d in current_level):
                return []
            matching.append([subpattern])
            current_level = [d[subpattern] for d in current_level if subpattern in d]
        else:
            # match all next levels in the trie that match the pattern
            matched_names = fnmatch.filter({k for d in current_level for k in d}, subpattern)
            if not matched_names:
                # nothing found
                return []
            matching.append(matched_names)
            current_level = [d[n] for d in current_level for n in _viewkeys(d) & set(matched_names)]

    return [os.sep.join(p) for p in product(*matching)
            if _in_trie(path_trie, p)]

This mouthful can quickly find matches using globs anywhere along the path:
>>> paths = ['/foo/bar/baz', '/spam/eggs/baz', '/foo/bar/bar']
>>> find_matching_paths(paths, '/foo/bar/*')
['/foo/bar/baz', '/foo/bar/bar']
>>> find_matching_paths(paths, '/*/bar/b*')
['/foo/bar/baz', '/foo/bar/bar']
>>> find_matching_paths(paths, '/*/[be]*/b*')
['/foo/bar/baz', '/foo/bar/bar', '/spam/eggs/baz']

Answer: On Python 3.4+ you can just use PurePath.match.
pathlib.PurePath(path_string).match(pattern)

On Python 3.3 or earlier (including 2.x), get pathlib from PyPI.
Note that to get platform-independent results (which will depend on why you're running this) you'd want to explicitly state PurePosixPath or PureWindowsPath.
Comment: A benefit to this approach is that it doesn't require you to specify glob syntax (`**/*`) if it's not needed. For example, if you are just trying to find a path based on a filename.
Comment: @schirrmacher `pathlib.PurePath.match` doesn't match across path separators, and they always match end-first. Python master supports `**` globs, which would work here, but I don't think it's released yet.
Comment: This only works on a single string. While useful, it doesn't fully answer OP's question of "`glob` format to a **list** of strings".
Comment: Found a way to extend this answer with list comprehension, see my answer.
Comment: @Esteban For some use-cases it is also a weakness. If you're explicitly looking for `a.py` with `*.py` and it then returns recursive results. E.g. this returns true `pathlib.PurePath("a/b/c/abc.py").match("*.py")` while I think it should only return true for `**/*.py`. But Mathew's solution below solves that.
Comment: Why does the following not match?`pathlib.PurePath("virt/kvm/devices/vm.rst").match("virt/*") # False` with fnmatch it works...

`fnmatch.filter(["virt/kvm/devices/vm.rst"], "virt/*") # ['virt/kvm/devices/vm.rst']`
Answer: Good artists copy; great artists steal.
I stole ;)
fnmatch.translate translates globs ? and * to regex . and .* respectively. I tweaked it not to.
import re

def glob2re(pat):
    """Translate a shell PATTERN to a regular expression.

    There is no way to quote meta-characters.
    """

    i, n = 0, len(pat)
    res = ''
    while i < n:
        c = pat[i]
        i = i+1
        if c == '*':
            #res = res + '.*'
            res = res + '[^/]*'
        elif c == '?':
            #res = res + '.'
            res = res + '[^/]'
        elif c == '[':
            j = i
            if j < n and pat[j] == '!':
                j = j+1
            if j < n and pat[j] == ']':
                j = j+1
            while j < n and pat[j] != ']':
                j = j+1
            if j >= n:
                res = res + '\\['
            else:
                stuff = pat[i:j].replace('\\','\\\\')
                i = j+1
                if stuff[0] == '!':
                    stuff = '^' + stuff[1:]
                elif stuff[0] == '^':
                    stuff = '\\' + stuff
                res = '%s[%s]' % (res, stuff)
        else:
            res = res + re.escape(c)
    return res + '\Z(?ms)'

This one à la fnmatch.filter, both re.match and re.search work.
def glob_filter(names,pat):
    return (name for name in names if re.match(glob2re(pat),name))

Glob patterns and strings found on this page pass test.
pat_dict = {
            'a/b/*/f.txt': ['a/b/c/f.txt', 'a/b/q/f.txt', 'a/b/c/d/f.txt','a/b/c/d/e/f.txt'],
            '/foo/bar/*': ['/foo/bar/baz', '/spam/eggs/baz', '/foo/bar/bar'],
            '/*/bar/b*': ['/foo/bar/baz', '/foo/bar/bar'],
            '/*/[be]*/b*': ['/foo/bar/baz', '/foo/bar/bar'],
            '/foo*/bar': ['/foolicious/spamfantastic/bar', '/foolicious/bar']

        }
for pat in pat_dict:
    print('pattern :\t{}\nstrings :\t{}'.format(pat,pat_dict[pat]))
    print('matched :\t{}\n'.format(list(glob_filter(pat_dict[pat],pat))))

Comment: Great scoop! Yes, translating the pattern to one that ignores path separators is a great idea. Note that it doesn't handle `os.sep` or `os.altsep` though, but it should be easy enough to adjust for that.
Comment: I usually just canonicalize paths into using forward slashes first before any processing.
Comment: This solution will incorrectly allow `[^abc]` to match a directory separator like `/`. See [my solution](https://stackoverflow.com/a/72400344/5030772) for an example that fixes this, and also allows `**` wildcards.
Answer: While fnmatch.fnmatch can be used directly to check whether a pattern matches a filename or not, you can also use the fnmatch.translate method to generate the regex out of the given fnmatch pattern:
>>> import fnmatch
>>> fnmatch.translate('*.txt')
'.*\\.txt\\Z(?ms)'

From the documenation:

fnmatch.translate(pattern)
Return the shell-style pattern converted to a regular expression.
Answer: My solution is similar to Nizam's but with a few changes:

Support for ** wildcards
Prevents patterns like [^abc] from matching /
Updated to use fnmatch.translate() from Python 3.8.13 as a base

WARNING:
There are some slight differences to glob.glob() which this solution suffers from (along with most of the other solutions), feel free to suggest changes in the comments if you know how to fix them:

* and ? should not match file names starting with .
** should also match 0 folders when used like /**/

Code:
import re

def glob_to_re(pat: str) -> str:
    """Translate a shell PATTERN to a regular expression.

    Derived from `fnmatch.translate()` of Python version 3.8.13
    SOURCE: https://github.com/python/cpython/blob/v3.8.13/Lib/fnmatch.py#L74-L128
    """

    i, n = 0, len(pat)
    res = ''
    while i < n:
        c = pat[i]
        i = i+1
        if c == '*':
            # -------- CHANGE START --------
            # prevent '*' matching directory boundaries, but allow '**' to match them
            j = i
            if j < n and pat[j] == '*':
                res = res + '.*'
                i = j+1
            else:
                res = res + '[^/]*'
            # -------- CHANGE END ----------
        elif c == '?':
            # -------- CHANGE START --------
            # prevent '?' matching directory boundaries
            res = res + '[^/]'
            # -------- CHANGE END ----------
        elif c == '[':
            j = i
            if j < n and pat[j] == '!':
                j = j+1
            if j < n and pat[j] == ']':
                j = j+1
            while j < n and pat[j] != ']':
                j = j+1
            if j >= n:
                res = res + '\\['
            else:
                stuff = pat[i:j]
                if '--' not in stuff:
                    stuff = stuff.replace('\\', r'\\')
                else:
                    chunks = []
                    k = i+2 if pat[i] == '!' else i+1
                    while True:
                        k = pat.find('-', k, j)
                        if k < 0:
                            break
                        chunks.append(pat[i:k])
                        i = k+1
                        k = k+3
                    chunks.append(pat[i:j])
                    # Escape backslashes and hyphens for set difference (--).
                    # Hyphens that create ranges shouldn't be escaped.
                    stuff = '-'.join(s.replace('\\', r'\\').replace('-', r'\-')
                                     for s in chunks)
                # Escape set operations (&&, ~~ and ||).
                stuff = re.sub(r'([&~|])', r'\\\1', stuff)
                i = j+1
                if stuff[0] == '!':
                    # -------- CHANGE START --------
                    # ensure sequence negations don't match directory boundaries
                    stuff = '^/' + stuff[1:]
                    # -------- CHANGE END ----------
                elif stuff[0] in ('^', '['):
                    stuff = '\\' + stuff
                res = '%s[%s]' % (res, stuff)
        else:
            res = res + re.escape(c)
    return r'(?s:%s)\Z' % res

Test Cases:
Here are some test cases comparing the built-in fnmatch.translate() to the above glob_to_re().
import fnmatch

test_cases = [
    # path, pattern, old_should_match, new_should_match
    ("/path/to/foo", "*", True, False),
    ("/path/to/foo", "**", True, True),
    ("/path/to/foo", "/path/*", True, False),
    ("/path/to/foo", "/path/**", True, True),
    ("/path/to/foo", "/path/to/*", True, True),
    ("/path/to", "/path?to", True, False),
    ("/path/to", "/path[!abc]to", True, False),
]

for path, pattern, old_should_match, new_should_match in test_cases:

    old_re = re.compile(fnmatch.translate(pattern))
    old_match = bool(old_re.match(path))
    if old_match is not old_should_match:
        raise AssertionError(
            f"regex from `fnmatch.translate()` should match path "
            f"'{path}' when given pattern: {pattern}"
        )

    new_re = re.compile(glob_to_re(pattern))
    new_match = bool(new_re.match(path))
    if new_match is not new_should_match:
        raise AssertionError(
            f"regex from `glob_to_re()` should match path "
            f"'{path}' when given pattern: {pattern}"
        )

Example:
Here is an example that uses glob_to_re() with a list of strings.
glob_pattern = "/path/to/*.txt"
glob_re = re.compile(glob_to_re(glob_pattern))

input_paths = [
    "/path/to/file_1.txt",
    "/path/to/file_2.txt",
    "/path/to/folder/file_3.txt",
    "/path/to/folder/file_4.txt",
]

filtered_paths = [path for path in input_paths if glob_re.match(path)]
# filtered_paths = ["/path/to/file_1.txt", "/path/to/file_2.txt"]

Comment: Good job! I guess this is the warning you're talking about, that this pattern: `"/a/b/c/**/test.py"` fails to match this input: `"/a/b/c/test.py"`. I'm still testing, but changing `res = res + '.*'` to `res = res + '.*/?'` and the line below to `i = j + 2` seems to work - not sure how robust it is, but works for my purposes. :)
Answer: Can't say how efficient it is, but it is much less verbose, much less complicated, more complete, and possibly more secure/reliable than other solutions.
Supported syntax:

* -- matches zero or more characters.
** (actually, it's either **/ or /**) -- matches zero or more subdirectories.
? -- matches one character.
[] -- matches one character within brackets.
[!] -- matches one character not within brackets.
Due to escaping with \, only / can be used as a path separator.

Order of operation:

Escape special RE chars in glob.
Generate RE for tokenization of escaped glob.
Replace escaped glob tokens by equivalent RE.

import re
from sys import hexversion, implementation
# Support for insertion-preserving/ordered dicts became language feature in Python 3.7, but works in CPython since 3.6.
if hexversion >= 0x03070000 or (implementation.name == 'cpython' and hexversion >= 0x03060000):
    ordered_dict = dict
else:
    from collections import OrderedDict as ordered_dict

escaped_glob_tokens_to_re = ordered_dict((
    # Order of ``**/`` and ``/**`` in RE tokenization pattern doesn't matter because ``**/`` will be caught first no matter what, making ``/**`` the only option later on.
    # W/o leading or trailing ``/`` two consecutive asterisks will be treated as literals.
    ('/\*\*', '(?:/.+?)*'), # Edge-case #1. Catches recursive globs in the middle of path. Requires edge case #2 handled after this case.
    ('\*\*/', '(?:^.+?/)*'), # Edge-case #2. Catches recursive globs at the start of path. Requires edge case #1 handled before this case. ``^`` is used to ensure proper location for ``**/``.
    ('\*', '[^/]*'), # ``[^/]*`` is used to ensure that ``*`` won't match subdirs, as with naive ``.*?`` solution.
    ('\?', '.'),
    ('\[\*\]', '\*'), # Escaped special glob character.
    ('\[\?\]', '\?'), # Escaped special glob character.
    ('\[!', '[^'), # Requires ordered dict, so that ``\[!`` preceded ``\[`` in RE pattern. Needed mostly to differentiate between ``!`` used within character class ``[]`` and outside of it, to avoid faulty conversion.
    ('\[', '['),
    ('\]', ']'),
))

escaped_glob_replacement = re.compile('(%s)' % '|'.join(escaped_glob_tokens_to_re).replace('\\', '\\\\\\'))

def glob_to_re(pattern):
    return escaped_glob_replacement.sub(lambda match: escaped_glob_tokens_to_re[match.group(0)], re.escape(pattern))

if __name__ == '__main__':
    validity_paths_globs = (
        (True, 'foo.py', 'foo.py'),
        (True, 'foo.py', 'fo[o].py'),
        (True, 'fob.py', 'fo[!o].py'),
        (True, '*foo.py', '[*]foo.py'),
        (True, 'foo.py', '**/foo.py'),
        (True, 'baz/duck/bar/bam/quack/foo.py', '**/bar/**/foo.py'),
        (True, 'bar/foo.py', '**/foo.py'),
        (True, 'bar/baz/foo.py', 'bar/**'),
        (False, 'bar/baz/foo.py', 'bar/*'),
        (False, 'bar/baz/foo.py', 'bar**/foo.py'),
        (True, 'bar/baz/foo.py', 'bar/**/foo.py'),
        (True, 'bar/baz/wut/foo.py', 'bar/**/foo.py'),
    )
    results = []
    for seg in validity_paths_globs:
        valid, path, glob_pat = seg
        print('valid:', valid)
        print('path:', path)
        print('glob pattern:', glob_pat)
        re_pat = glob_to_re(glob_pat)
        print('RE pattern:', re_pat)
        match = re.fullmatch(re_pat, path)
        print('match:', match)
        result = bool(match) == valid
        results.append(result)
        print('result was expected:', result)
        print('-'*79)
    print('all results were expected:', all(results))
    print('='*79)

Comment: Thank you for this, it's the first solution I found that works as expected. Fairly readable considering the complexity. I guess it would be nice to extract the actual comparison in a separate function `def glob(path, pattern)`
Answer: never mind, I found it. I want the fnmatch module.
Comment: Oh wait -- fnmatch doesn't handle the pathname segmentization... sigh.
Comment: Can you provide examples, where `fnmatch` does not handle your case?
Comment: @BhargavRao: `glob.glob()` applies patters to path elements separetely
Comment: @MartijnPieters Yep. But when you look at the cpython implementation of [glob](https://github.com/python/cpython/blob/74bfc0455896315d48a42eb7e4b52ab758adbac3/Lib/glob.py), they just split on the path sep and recursively use `fnmatch`! So *What is the problem with using `fnmatch`* is my question. (My draft answer is already ready based on few assumptions, Just waiting for the OP to clarify)
Comment: Oops Martijn, you've answered on the same lines, up for that! Hadn't see your answer! Discarding my draft right away :)
Comment: @BhargavRao: the recursive `glob` calls have your filesystem to work with, so they can do `os.listdir()` as needed when traversing the glob. You don't have the same functionality when you only have a list. My answer uses a Trie structure to replicate the behaviour, and I avoided a recursive call by exploding multiple matches at various path levels only at the end. I guess that figuring out how to do *that* part was the reason why just `fnmatch()` doesn't handle their case. :-)
Comment: @Martijn Mine had a ugly looking recursive call :( But it worked quite well. I guess it would have crapped in a few end cases. Anyway thanks for introducing *trie*. I'll read more bout that. Ty. :)
Comment: I'm not going to change my answer to improve it when my answer has a flaw that Martijn's answer addresses.
Comment: Alternatively, if you want support for `**` globs (which match zero or more path segments), you can see [my answer](https://stackoverflow.com/a/72400344/5030772) which lets you translate a path glob into a regex pattern that can then be used to match any number of path strings.
Answer: An extension to @Veedrac PurePath.match answer that can be applied to a lists of strings:
# Python 3.4+
from pathlib import Path

path_list = ["foo/bar.txt", "spam/bar.txt", "foo/eggs.txt"]
# convert string to pathlib.PosixPath / .WindowsPath, then apply PurePath.match to list
print([p for p in path_list if Path(p).match("ba*")])  # "*ba*" also works
# output: ['foo/bar.txt', 'spam/bar.txt']

print([p for p in path_list if Path(p).match("*o/ba*")])
# output: ['foo/bar.txt']

It is preferable to use pathlib.Path() over pathlib.PurePath(), because then you don't have to worry about the underlying filesystem.
Answer: Here is a glob that can deal with escaped punctuation.  It does not stop on path separators.  I'm posting it here because it matches the title of the question.
To use on a list:
rex = glob_to_re(glob_pattern)
rex = r'(?s:%s)\Z' % rex # Can match newline; match whole string.
rex = re.compile(rex)
matches = [name for name in names if rex.match(name)]

Here's the code:
import re as _re

class GlobSyntaxError(SyntaxError):
    pass

def glob_to_re(pattern):
    r"""
    Given pattern, a unicode string, return the equivalent regular expression.
    Any special character * ? [ ! - ] \ can be escaped by preceding it with
    backslash ('\') in the pattern.  Forward-slashes ('/') and escaped
    backslashes ('\\') are treated as ordinary characters, not boundaries.

    Here is the language glob_to_re understands.
    Earlier alternatives within rules have precedence.
        pattern = item*
        item    = '*'  |  '?'  |  '[!' set ']'  |  '[' set ']'  |  literal
        set     = element element*
        element = literal '-' literal  |  literal
        literal = '\' char  |  char other than \  [  ] and sometimes -
    glob_to_re does not understand "{a,b...}".
    """
    # (Note: the docstring above is r""" ... """ to preserve backslashes.)
    def expect_char(i, context):
        if i >= len(pattern):
            s = "Unfinished %s: %r, position %d." % (context, pattern, i)
            raise GlobSyntaxError(s)

    def literal_to_re(i, context="pattern", bad="[]"):
        if pattern[i] == '\\':
            i += 1
            expect_char(i, "backslashed literal")
        else:
            if pattern[i] in bad:
                s = "Unexpected %r in %s: %r, position %d." \
                    % (pattern[i], context, pattern, i)
                raise GlobSyntaxError(s)
        return _re.escape(pattern[i]), i + 1

    def set_to_re(i):
        assert pattern[i] == '['
        set_re = "["
        i += 1
        try:
            if pattern[i] == '!':
                set_re += '^'
                i += 1
            while True:
                lit_re, i = literal_to_re(i, "character set", bad="[-]")
                set_re += lit_re
                if pattern[i] == '-':
                    set_re += '-'
                    i += 1
                    expect_char(i, "character set range")
                    lit_re, i = literal_to_re(i, "character set range", bad="[-]")
                    set_re += lit_re
                if pattern[i] == ']':
                    return set_re + ']', i + 1

        except IndexError:
            expect_char(i, "character set")  # Trigger "unfinished" error.

    i = 0
    re_pat = ""
    while i < len(pattern):
        if pattern[i] == '*':
            re_pat += ".*"
            i += 1
        elif pattern[i] == '?':
            re_pat += "."
            i += 1
        elif pattern[i] == '[':
            set_re, i = set_to_re(i)
            re_pat += set_re
        else:
            lit_re, i = literal_to_re(i)
            re_pat += lit_re
    return re_pat

Answer: I wanted to add support for recursive glob patterns, i.e. things/**/*.py  and have relative path matching so example*.py doesn't match with folder/example_stuff.py.
Here is my approach:

from os import path
import re

def recursive_glob_filter(files, glob):
    # Convert to regex and add start of line match
    pattern_re = '^' + fnmatch_translate(glob)

    # fnmatch does not escape path separators so escape them
    if path.sep in pattern_re and not r'\{}'.format(path.sep) in pattern_re:
        pattern_re = pattern_re.replace('/', r'\/')

    # Replace `*` with one that ignores path separators
    sep_respecting_wildcard = '[^\{}]*'.format(path.sep)
    pattern_re = pattern_re.replace('.*', sep_respecting_wildcard)

    # And now for `**` we have `[^\/]*[^\/]*`, so replace that with `.*`
    # to match all patterns in-between
    pattern_re = pattern_re.replace(2 * sep_respecting_wildcard, '.*')
    compiled_re = re.compile(pattern_re)
    return filter(compiled_re.search, files)

Answer: just an example. Not sure whether it is exactly what people would need, but I like how simple it is:
files = [
    'AI_datasets/client1/metadata.json',
    'AI_datasets/client2/metadata.json',
    'AI_datasets/client3/metadata.json',
    'AI_datasets/client1/X.npy',
    'AI_datasets/client2/X.npy',
    'AI_datasets/client3/X.npy',
    'AI_datasets/client1/y.npy',
    'AI_datasets/client2/y.npy',
    'AI_datasets/client3/y.npy'
]

metadata = [f for f in files if 'metadata.json' in f]

>>> metadata
['AI_datasets/client1/metadata.json', 'AI_datasets/client2/metadata.json', 'AI_datasets/client3/metadata.json']

Comment: Not robust enough; this matches files like `fmetadata.json` and `metadata.json.exe`.
Answer: from wcmatch import pathlib
pathlib.PurePath("a/b/c").globmatch("**/*", flags=pathlib.GLOBSTAR) // True

Comment: Would you mind adding more context to your proposed solution?
Comment: Code-only answers aren't very useful, since they do not explain what you are doing and why.
Comment: [`wcmatch` does not exist in the standard library](https://docs.python.org/3/search.html?q=wcmatch). If you're going to recommend third-party modules, please be explicit about that.


On Google Drive, how do I download files?

Question: So I was uploading to Google Drive, and I found the lack of a download button on the home page. Where is the download button?
Answer: Highlight the file.
Open the overflow menu (three vertical dots).
Select "Download".

Or, if you install the Google Drive app on your PC, the file(s) will automatically sync to your hard drive.
Answer: Or, if you want to download all your files at once, use the Google Takeout service.


Dirt mound in backyard

Question: I see several dirt mounds in my backyard. These are usually around 6 inches in diameter with no obvious hole caused by an animal. Can you please help me identify what is causing it and also how to stop it?
Comment: @learnerer Where are you from?
Comment: I'm from Seattle
Comment: Squirrels bury things in the fall. They are not always fastidious about putting all the dirt back.
Comment: In the UK the commonest culprits are moles - but they wouldn't bother to force the earth up through a crack between to concrete blocks, if they could make a molehill in open ground only a foot away. Moles live entirely underground in the tunnels they excavate, so there would not be any holes visible on the surface.
Answer: I am from the Seattle area as well.  I've done most of my career in the PNW as a Landscape Architect.  Part of my career involved landscape maintenance just to have a job.  Ran 7 crews and I was there hands on for 4 years as foreman/supervisor.
Moles and gophers and sometimes voles become part of the landscape's soil.  They are a GOOD thing.  They do not overpopulate.  Rarely are there but two of moles or one of gopher.  Yours looks like a gopher.  Larger hole and running around your landscape instead of your lawn.
These animals eat insects, grubs, not plants normally.  If they are there they are eating grubs or larvae that could cause a problem if you kill these animals.  When you run out of grubs/insects they leave to go to the neighbors.
I once thought of 'rent a mole' where I would take a few sweet little moles and allow them to reduce populations of crane fly larva, aerate and top dress and charge people money for this service.  If I ever caught a 'wack a mole' person I would probably bury them in the compost heap.
Just sweep the piles of soil off your hardscape.  Relax. You've got some free service little guys that are wonderful.  And I am not charging you money. These guys aerate the soil.  They recycle the soil.  I charged big bucks to 'top dress' lawns and beds.  These guys are doing it for free with your own soil while at the same time providing aeration.  And keeping the damaging (crane fly larva in your area) in control!
Piles on your lawn or beds or patio?  Take a rake and simply flip that soil onto the top of your lawn and beds.  There is a reason for the subsurface preparation of hardscapes and this is a good example.  They aren't able to come up with the rest of your patio, just these informally laid blocks.
If you live in Seattle, I gotta tell you you have access the the BEST mulch for ornamental beds and lawns in the world!  Call Sawdust Supply and ask about Gro-Co.  You are so dang lucky!  I was able to tell clients to find another company if they wanted to use bark for mulch.  Ugly and oh so worthless for the soil.
This Gro-Co mulch is flat out amazing.  More beautiful than any mulch.  Feeds the soil organisms.  Put this on your beds and your plants will blow you away within one week.  It is human poo plus sawdust COMPLETELY decomposed.  Perfect texture, dark taupe, no sticks or stones and the best thing is no weed seeds no pesticide residues!  There are mulches and composts added to top soil that one can't grow a petunia because of the pesticide residues.
You are so lucky and if you want to know more, ask away.
Those mammals in your soil are a benefit!  Do you have a compost pile?  That attracts these animals so if you do want to eliminate them get your compost further away from your home or put it in a composter barrel. Above ground.  The soil beneath the compost will be very active with grubs/insects.

Dirt mound in backyard


What's the difference between a quarter and a district?

Question: All I want to know about these words is their meaning difference and how they are used in sentences...
(If you can give me examples it would be great :))
Comment: "District" is fairly generic.  "Quarter" would only be used if it fit the local jargon.
Comment: Since 'quarter' is rarely used in 'BrE' for UK urban areas, it might be best to specify a perhaps 'AmE'. And attempts at research need to be shown.
Comment: I can't think of a US English usage of _quarter_ other than for the _French Quarter_ in New Orleans. _Quartier_ is frequently used to describe a neighborhood in French (_Quartier Latin_ in Paris, for example), and of course, there's a lot of French influence in New Orleans. Interestingly, the local French name for the French Quarter doesn't include the word _quartier_; it's the _Vieux Carré_. But the word _Quarter_ must have come from somewhere. My guess is that the New Orleans _Quarter_ is a big exception, related to French. Otherwise, US English does not really use _quarter_ in this context.
Answer: Your question is both very easy and very hard.  To the extent that there are differences they are very subtle.

District. As in Pittsburgh's Strip District, a strip of wholesale and specialist stores along the Allegheny River, with an diverse population
Quarter Like the Latin Quarter (Quartier Latin) on the left bank of the Seine, known for its intellectual and literary interest, close as it is to the University of the Sorbonne and the School of Fine Art (Beaux Arts)
Neighbourhood applies to any relatively self-contained portion of a town or city, usually with housing rather than blocks of flats (at least in the UK).
Village as in Greenwhich Village in New York, very artsy and, in its day, alternative culture.
Town. as in Camden Town in London, which was once just a town in the traditional sense before being absorbed into London, but now more associated with young people and families, outdoor markets and antiques.  It could have been called 'Camden Village'.  Camden is also a huge London borough and could easily be described as a 'district, but not really a neighbourhood.

I am afraid that travel is the only way to become confident in your use of these overlapping concepts.  But what can be said about your two words is that the word district, unlike the word quarter, can be used as an official or administrative subdivision of a city or even large town.  'Quarter is more unofficial (though you can find it on maps because it designates an area tha is know to be interesting and fun to visit.
Comment: In other words, a district is whatever is called 'district' and a quarter is whatever is called 'quarter'; there is no sharp criterion that would allow one to confidently say which of these words is the most apt for something, prior to finding out how people in fact refer to it. It should, however, also be noted that, as @Hot Licks pointed our above, *district* is a safer term to use if one is not familiar with the local terminology; *quarter* should be used only for what is known as a quarter.
Comment: @jsw29 Yes, and I think I made the distinction in my last paragraph.
Comment: In the United States, we also have Congressional districts, each of which elects a member of the U.S. House of Representatives.  Districts are based on population and reconfigured every ten years.
Comment: Also, central business district and secondary business district are standard terms. So is "school district."
Comment: @Xanne Yes, that is a good example i had not thought of..


Lagrange multipliers not giving all the solutions

Question: I was working on a maximization problem that can be reduced to maximizing
$$f(a,b,c,d)= ab + bc + cd $$
subject to the constraint
$$a +b +c +d = 63 $$
I thought that this was a trivial and straightfoward problem for the method of lagrange multiplier, so I defined the Lagrangian as
$$\mathcal{L}(a,b,c,d,\lambda) = ab + bc + cd - \lambda (a +b +c +d - 63) $$
and setting the derivatives equal to 0, I got
$$
b - \lambda = 0 \\
a + c - \lambda = 0 \\
b +d - \lambda = 0 \\
c - \lambda = 0 \\
a +b +c +d = -63
$$
That is a linear problem that can be re-stated as finding the solution for the system $Ax = b$ with
$$ A = \begin{bmatrix}
0 & 1 & 0 & 0 & -1 \\
1 & 0 & 1 & 0 & -1 \\
0 & 1 & 0 & 1 & -1 \\
0 & 0 & 1 & 0 & -1 \\
1 & 1 & 1 & 1 & 0
  \end{bmatrix}$$
and
$$
b = \begin{bmatrix}
0 & 0 & 0 & 0 & -63 \\
\end{bmatrix}^T$$
to my surprise, this system is determined with only one solution for $a,b,c$ and $d$
$$ x = \begin{bmatrix}
0 & 31.5 & 31.5 & 0 \\
\end{bmatrix}^T$$
But a direct evalution of the function to maximize and the constrains shows that, for example, the vector
$$ x = \begin{bmatrix}
31.5 & 31.5 & 0 & 0 \\
\end{bmatrix}^T$$
yields the same result for the function and is also part of the constraint surface, so it should be a critical point too, more over, there are infinetly many critical points, so way is the lagrange multipliers just giving me one result?
Comment: Where did this maximation problem come from? Either the teacher set you up with a trap, or the nature of the optimization problem is in doubt, and there are no optimal points.
Comment: Not that it matters here but in general you should put an additional multiplier on the objective function. If the constraint function has the gradient that vanishes on the constrained set those points will also be critical, see [abnormal case](https://math.la.asu.edu/~kawski/MAPLE/272/f_optim/lagrange10.html).
Comment: An alternative that occurred to me is that you forgot to tell us that $a,b,c,d$ are all supposed to be non-negative. These additional constraints turn the set of possible values of $(a,b,c,d)$ into a compact set $K$ (a 3-simplex), implying that maxima and minima exist. In that case the lack of local extrema means that the extrema are on the boundary of $K$, and you need to study several problems with two constraints (or, eliminate one variable as in my answer, and then study the values at the boundary).
Comment: This was actually a geometric trivia some friend showed me, where the values should not only be non-negative but also integers. I just approached the problem with this to see quickly what I could get (and indeed, by luck, point me to the right direction)
Answer: There is only one critical point but it is indefinite. This is seen for example by eliminating $d$ and studying the Hessian of the resulting unconstrained problem (see below for the details). Therefore there are no local extrema.
Your function is unbounded. For example, if we set $c=0$, then the constraint is satisfied by $d=63-a-b$, but this will not affect the value of $f$. Take a look:
$$
f(a,b,0,63-a-b)=ab.
$$
Clearly we can make this as large or as small as we wish, and there is no global maximum or minimum.

IMHO it is usually easier to use a linear constraint simply to eliminate one of the variables. If we here solve $d=63-a-b-c$ from the constraint, we get the function in three variables
$$
g(a,b,c)=f(a,b,c,63-a-b-c)=ab-ac-c^2+63c.
$$
Its gradient is
$$
\nabla g(a,b,c)=(b-c,a,63-a-2c),
$$
and this vanishes only at the critical point $P_1=(a,b,c)=(0,63/2,63/2)$.
The Hessian of $g$ at $P_1$ is
$$
H(g,P_1)=\left(\begin{array}{ccc}0&1&-1\\ 1&0&0\\ -1&0&-2\end{array}\right).
$$
Its characteristic polynomial is
$$
\chi_H(x)=\det(x I_3-H)=x^3+2x^2-2x-2.
$$
We could solve for the zeros using Cardano, but for our purposes it suffices to check that $\chi_H(x)$ has zeros in the intervals $\lambda_1\in(-3,-2)$,
$\lambda_2\in(-1,0)$, $\lambda_3=(1,2)$. Both signs occur, so the Hessian form is indefinite. In other words, $P_1$ is a saddle point. You can use Sylvester's criterion to reach the same conclusion — $P_1$ is not a local extremum.
Comment: Because the objective function is a quadratic form, this question can probably be handled with linear algebra alone.
Comment: This makes perfect sense. The only thing is left for me is a geometric intuition. In two dimensions if a point is critical then every point in it's sorrounding goes either "up", "down" or both (saddle). In that case this couldn't happen right? The other points that share the same function output value than the found critical point should also be critical points if I am picturing it right
Comment: I don't agree with your last point @diegobatt. Surely around a saddle point the same value is attained at non-critical points also?
Comment: I was getting confused. Nevermind


Expected number of cards we end up with in game

Question: Suppose that we have $N$ distinct cards arranged in no particular order. If the first card of the pack is less than the second card of the pack, we keep both cards. Otherwise we discard the second one and keep the first one. We then carry on the process in the same way and we want to determine the expected number of cards we end up with. The base cases can be solved in a straightforward way and give us $e_1=1$, $e_2=\frac{3}{2}$ and $e_3=\frac{11}{6}$, where $e_N$ is the expected value we are looking for if we play with $N$ cards. Looking at these base cases, it would appear that we have the following relation:
$$e_N=e_{N-1}+\frac{1}{N}=\frac{1}{N}\sum_{i=1}^{N-1} e_i+1=\sum_{i=1}^N\frac{1}{i}.$$
My question is how can we give a heuristic interpretation to this relation, i.e knowing that the expected value we end up with playing with $N-1$ cards is $e_{N-1}$, why should the expected value we end up with playing with $N$ cards be equal to $e_{N-1}+\frac{1}{N}$ (or $\frac{1}{N}\sum_{i=1}^{N-1} e_i+1$)? I am also very interested in trying to understand if there is any underlying explanation for the logarithmic order which would appear to come into play when we play with a large number of cards. Any comments or ideas would be greatly appreciated.
Comment: When you draw the third card, which do you compare it to?  The higher of the two (if you have kept both) or the first one?
Comment: @RossMillikan the third card is compared to the second card if it has been kept (i.e higher than first)
Answer: You keep the $n^{\text{th}}$ card if it is the highest of the first $n$, which happens with probability $\frac 1n$  This explains your value for $e_N$.  The logarithmic order then comes from the fact that the integral of $\frac 1n$ is $\log n$.  Your $e_N$ are the harmonic numbers, which are very close to $\log n + \gamma$ with $\gamma \approx 0.577$
Comment: Thanks for your input. So I guess the problem can be solved directly  (by immediate induction) in the following way. Suppose that playing with $N-1$ cards we end up on average with $e_{N-1}$ cards. With $N$ cards, we end up with one extra card if and only if the $N$-th card is higher in value than all the other cards, which happens with probability $\frac{1}{N}$.
Comment: Can we also find an interpretation for the $e_N=\frac{1}{N}\sum_{i=1}^{N-1} e_i+1$ relation?
Comment: For the logarithmic order I was aware of Euler's constant, but I am trying to understand it from a heuristic viewpoint. A bit like with binary search, the complexity is logarithmic because we half the search interval at each iteration, something along those lines.
Answer: The following does not directly answer why it should be the case that $e_N=e_{N-1}+1/N$, but rather it proves the assertion that $e_{N}=1+1/2+\cdots+1/N$.
Suppose that $e_{n,N}$ denotes the expectation of number of cards you keep by repeating the procedure for $N$ cards, given that your first draw is $n\le N$ (say we number the cards from $1$ to $N$ for simplicity).
Given $N$ cards, your first draw can be $n$ with probability $1/N$, and since distinct first draws partition the sample space, we have
$$
e_{N}=\frac{1}{N} \left( e_{1,N}+e_{2,N}+\cdots+e_{N,N} \right)
$$
Now if your first draw is $n$, then as you repeat the procedure any cards whose number is less than $n$ will surely be discarded at some point. So those cards with numbers less than $n$ are irrelevant to your expectation, and in fact it comes down to question of which of cards with numbers bigger than $n$ you keep at the end. Therefore, in fact for any $n$,
$$
e_{n,N}=e_{1,N-(n-1)}
$$
On the other hand, if your first draw is indeed $1$, then whatever number is written on the second card you will always keep it. So in a sense you can regard your second draw as a first draw of a new process containing $m-1$ cards. Therefore, we have
$$
e_{1,m}=1+e_{m-1}
$$
for any $m\ge 1$ where $e_{0}:=0$ for convenience. It follows that
$$
e_{N}=\frac{1}{N}\left( e_{1,1}+\cdots+e_{1,N} \right)=\frac{1}{N}\left( N+e_{1}+\cdots+e_{N-1} \right)
$$
Now you can use induction on $N$ to show that $e_N=\sum_{i=1}^{N} \frac{1}{i}$.

Edit: about your respond to @Ross Millikan's answer:
I think written as it is, it is a not quite logically correct.
You'd rather argue like this:
So you will keep last card if and only if the last card is numbered $N$. You can partition the sample space into events where whether or not you keep the last card. Now if you keep the last card, then it means last card is numbered $N$, and so any card before the last card is numbered from $1$ to $N-1$. You can regard the previous cards as a deck with $N-1$ distinct cards, and expectation of number of cards you get from them by repeating procedure is just $e_{N-1}$. Since you always keep the last card, then the expectation given that you keep the last card is just
$$
1+e_{N-1}
$$
Now suppose that you don't keep the last card. Probability of that happening is just $1-1/N=(N-1)/N$. Then last card is numbered some $m\neq N$. Then previous $N-1$ cards are numbered from $1$ to $N$ with $m$ being 'skipped'. But you can the then renumber them from $1$ to $N-1$ without changing the order, so in that case expectation is just $e_{N-1}$.
So by partition principle it follows that
$$
e_N = \frac{1}{N} (e_{N-1}+1) + \frac{N-1}{N} e_{N-1}=e_{N-1}+1/N
$$
Comment: @user223935 I've edited last section of the answer to show how Ross Millikan's answer can be used to deduce correct conclusion.
Comment: Thanks for your very clear explanation, this gives a great intuition about the whole problem. Do you believe that my comment above which justifies the relation $e_N=e_{N-1}+\frac{1}{N}$ is also correct?
Comment: Ok thanks man, just one last thing. Do you think there is a possible intuitive interpretation of the logarithmic order which appears when the number of cards becomes large?
Comment: @user223935 As in Ross Millikan's answer, it is a known fact that harmonic numbers more or less behave logarithmically when $N$ is large. You can interpret the result as $e_N/\log N \to 1 $ as $N\to \infty$. You can say a bit more about it, using E-M constant as $e_N\approx \log N + \gamma$. I think the wikipedia page on the topic (which is linked in his answer) does a good intuitive explanation of the phenomena at some point, where it shows how area under the graph $1/x$ can be interpreted as the harmonic sum. Then you can relate it to the integral of the function, which is evidently $\log x$


What process do I follow to land a civilian aircraft on a military base?

Question: Let's say I have business on a US military base (e.g. JBLM), and I'd like to fly a privately owned aircraft there. What is the process I follow before the flight to get approval to land, and once I'm enroute to ensure everything goes smoothly?
Comment: Sneak it in really low.  Stick between all the little hills on the approach and dodge between the houses, certainly not above 30 feet.  At the last minute, pop it up over the fence and plonk her down.  You'll be parked before anyone even notices.  I'm curious to know how it goes.  Let us know how it worked out ;)
Comment: @Simon It will probably help if you paint over all the markings on your aircraft and switch off your radios. :-)
Comment: Having never done it the best advice I can offer is "Contact the base ***WAY*** before you're airborne - like weeks out - to get permission." Since you've got business on the base maybe ask the folks you're dealing with to put you in touch with the officer in charge of the field - having the request brought to them internally would probably help. If you don't get an answer & manage to find out more about the process on your own please let us know - I'm curious myself :-)
Comment: @Simon well, it worked for Red Square :) https://en.wikipedia.org/wiki/Mathias_Rust
Answer: Landing at a US military base isn't all that hard (I've landed at Ft. Drum before), you just have to get prior permission (PPR) (submitted at least 30 days in advance and confirmed within 24 hours according to 32 CFR 855.8), and need to have a "good reason" (as determined by them).
32 CFR 855, Table 1 (which is quite long) includes the purposes that are normally allowed.
You will be required to submit the following forms to the base commander (See the A/FD):

DD Form 2400 - Civil Aircraft Certificate of Insurance
DD Form 2401 - Civil Aircraft Landing Permit
DD Form 2402 - Civil Aircraft Hold Harmless Agreement

32 CFR 855 contains the regulations pertaining to US Air Force airfields (and the rules are similar for each branch).
855.1 - Policy includes:

(1) Normally, landing permits will be issued only for civil aircraft
  operating in support of official Government business. Other types of
  use may be authorized if justified by exceptional circumstances.
  Access will be granted on an equitable basis.
...
(3) Any aircraft operator with an inflight emergency may land at any
  Air Force airfield without prior authorization. An inflight emergency
  is defined as a situation that makes continued flight hazardous.

855.5 - Responsibilities and authorities. includes:

(6) Will not authorize use of Air Force airfields:
(i) In competition with civil airports by providing services or
  facilities that are already available in the private sector.
Note: Use to conduct business with or for the US Government is not
  considered as competition with civil airports.
(ii) Solely for the convenience of passengers or aircraft operator.
(iii) Solely for transient aircraft servicing.
(iv) By civil aircraft that do not meet US Department of
  Transportation operating and airworthiness standards.
(v) That selectively promotes, benefits, or favors a specific
  commercial venture unless equitable consideration is available to all
  potential users in like circumstances.
(vi) For unsolicited proposals in procuring Government business or
  contracts.
(vii) Solely for customs-handling purposes.
(viii) When the air traffic control tower and base operations are
  closed or when a runway is restricted from use by all aircraft.
Comment: Its funny how someone somewhere in the Government has already written a law or policy document for almost every scenario you can dream of. :)
Comment: Most of the purposes in Table 1 fall under "you have business at the base", or when due to weather or airport closure the planned destination is unavailable. This includes contractor business at a colocated private facility. It seems to me (not a lawyer) that OP would be able to fly there, provided the paperwork has been filed and accepted.
Comment: @curious_cat Username checks out :D
Answer: A "Joint Base" does not refer to joint military and civilian, it refers to Joint as in co-use by multiple branches of the services.  If you show up unannounced as an emergency aircraft, they will not point guns at you or detain you, they will simply handle your situation, provide the help and resources you need to get the aircraft back in the air and send you in your way.  There are only a couple bases that have "security at the ready" and will meet you with armed individuals.  The military is not some war-crazed institution waiting to shoot people, the bases are staffed with civilian controllers as well as a military and they are there to help when and where they can in aviation.  My experience flying both military and civilian aircraft for over 30 years has only produced professional accolades for the folks on the bases around the world.  If you have official business, it should be easy to land there with prior permission, if not- don't go or ask. If you have an emergency, do not hesitate to use the installation, it is funded by your tax dollars and they will be happy to share.
Comment: That's great, but as a pilot it's nice to have regs to refer to. Especially when the FAA wants your cert, or something.
Comment: I love this answer, but any chance you could include a reference, preferably military, that goes into greater detail?
Comment: @egid, Mr BBT said that he had experience flying military planes.  Is that not a sufficient "reference?"
Answer: I'd never heard of JBLM but I guess you're referring to Joint Base Lewis-McChord which has the identifier KTCM? Airnav says it's joint civilian and military use, AOPA says it's private military, but the AF/D says it's joint, which should be the definitive answer.
If so, as a joint field then civilian flights should be OK but I would carefully read the entire AF/D entry as well as any other information it references and if you have any doubts or concerns at all then you should contact them in advance. Even if you don't, I would still contact them anyway and in this case the AF/D tells you to do exactly that:

tran acft parking extremely ltd. 24 hr prior coordination rqr

Landing at a private military field on the other hand would require special permission from the military which I assume is very unlikely to be granted unless you have good connections on base.
Update from an anonymous user:

The reason that AirNav says 'joint military/civillian use' is that at
  one time KGRF (the airfield on the Army side of JBLM, then a separate
  installation - Fort Lewis) had an 'Aero Club' that operated a flight
  school & rented Cessnas for use by the base population. They also
  allowed troops who owned personal aircraft to base them on field at
  the Aero Club.
That Aero Club facility closed due to insufficient use during the
  height of Iraq/AFG deployments, and with it civil use of the JBLM
  runways ended. The ramp space is now used by military aviation units
  (an Army Combat Aviation Brigade) that moved to JBLM after the Aero
  Club closed.
Comment: Note that the regulations specifically allow emergency aircraft to land at military airports.   They might not like it much, but it is allowed!
Comment: Back when I was a student, my instructor had a genuine emergency and had to land there unscheduled.  Despite being listed as joint civ/mil, they were a little hostile there.  I would not treat JBLM as a civilian airport. Its military-only.
Comment: Yeah they'll let you but even if it is an emergency I can almost guarantee you'll have security forces show up with guns at the ready if not pointed at you when you land
Comment: @abelenky That's good advice, I wouldn't treat it that way either and the comment I quoted from the AF/D hopefully makes it clear that you can't just turn up unannounced.
Comment: What would happen if you landed there without even contacting ATC?
Answer: The comments are all over the place on how to land a civilian aircraft onto a military airfield. Here's how you really do it:
1. Get signed copy of a DD 2400 from you insurance company.
2. Fill out DD Form 2401 and 2402.
3. Submit all forms to the military service HQ in Washington DC for the airfield you want to land on. Address is on the forms. (JBLM belongs to Army and Air Force. If you want to land on the McChord airfield, you have to have Air Force permission. Army airfield, Army permission.
4. Once permission is granted, you have to contact the airfield manager and submit documents required by the airfield manager.
Bottom line: You have to have an association with the military to land your aircraft onto a military field; i.e. active duty, retired, contracted. I've been landing at military airfields for over 20 years.


Cannot Connect to internet in windows 7 (No Internet Connection)

Question: I have an airport express and Win 7 pro. My router is a Trendnet TEW-423PI G. The problem is everytime i try to connect it says it is unsuccessful and can't find ip address. I have tried everything. WPA2, WPA, WEP, Messing with the registry, Manually Inputting the ip address, Reinstalling drivers. I have two Macs that connect perfectly and are both running Snow Leopard that is why I am able to post this. What Should I do. I'm Going Crazy
Comment: I've found that disabling the LLTD stuff and IPv6 (if not needed) in the network adapter's properties can help with some connectivity issues.
Answer: Have you double checked on the router if it has any security such as MAC filtering?
After this, I would double check that you have selected the right Encryption type (TKIP/AES).
Lastly, double check DHCP settings / as you said you did manual, make sure that the settings are correct.
I have seen your issue a few times when either one of the three above problems exist.. If you still have the problem, please say
Answer: If Wil's answer didn't solve the problem, have a look at the following article:
Trendnet TEW-423PI wireless PCI adapter.
The article explains the steps to take to verify connecting to the wifi card.
If this does not work, and you wish to have more help, please add to your post the output you get from running the following commands in Command Prompt (cmd):

ipconfig /all ping
  192.168.2.1 ping www.google.com

You might also add a comment below to notify me that this output is ready.
Answer: When I got my new computer with Windows 7 last month, I had the same problem, and went through the same steps you did.  Here are two things that worked for me:

Make sure you have the Security Type option for authentication correct: change from No Authentication (Open) to Shared or vice versa.
Change the Homegroup name from whatever Windows assigned when you set up your connection to the network you assigned both your Macs.


bad design? a class that can cause an error in a package

Question: Suppose I create a some client code consisting of a couple of classes. A user is able to create a class/object that causes an exception to be thrown. Is this bad design? Should your ideal code be such that it is impossible for someone to cause an exception?
Answer: No, design patterns do not discount exceptions. There may be portions/functions within your library where a strong/weak exception guarantee is desirable. But that depends entirely on the library.
Answer: No, every API that I have used is perfectly capable of throwing exceptions.  Look at it this way; you pass in some "bad" data to a framework class.  What would you rather have happen; an exception is thrown which makes the problem immediately obvious, or the call fails silently and you spend hours trying to figure out why your code is not working?
Answer: There are countless examples of APIs that throw exceptions when given an object supplied by the user.  This is by no means bad design by good design and indicates the API is validating its input.
The first example I thought of was .NET's System.IO.File.Delete(string) function which will throw an exception if the file to be deleted is not found.
Answer: Your classes can throw exceptions, but you should check all the input to it and throw controlled exceptions when possible. I mean, if you know some argument is invalid, throw an InvalidArgumentException or something like it. Catch the errors you should, treat them or throw them.


Does work done depend on the frame of reference?

Question: Suppose I am sitting on a bench and looking at a moving car. Force is applied on the car by its engine, and it makes it displace, hence some work is done on the car. But what if I am sitting in the car and looking at the bench? The bench covers some displacement, but who has applied force to it? Is any work done on it?
Comment: The bench is not moving with respect to the ground it's sitting on, so there's no friction to overcome and no need for a force to keep it in motion.
Answer: It's a good question. You're right that the bench has kinetic energy in the car-frame, so it seems natural that somebody had to do work on it.
That's not true, however. The energy of an object can be completely different depending on what reference frame you look at it from. So can the work. But in this case, the work on the bench is 0 no matter how you look at it, because the force is zero. So even if there is a displacement,
$$W=0\cdot d=0.$$
In an inertial frame (one not accelerating), you only require work to change the energy of an object. In the car's frame, the bench has some kinetic energy, but it always had that kinetic energy. So nobody had to apply work to it.
Comment: can't we say that the pseudoforce has done work on the bench?
Comment: There seems to be more to this though.
Comment: @JoeSantino such forces are called [fictitious forces](https://en.wikipedia.org/wiki/Fictitious_force). Yes, such a force has done some work.
Answer:
The bench covers some displacement but who has applied force to it. Is some work done on it?

No.
Work is the change in kinetic energy. In the simple case, we can think of it as the change in velocity. The velocity of the bench didn't change in your example, so there's no work.
But let's say it does change; let's modify the original question so the car is speeding up. To someone in the car, it looks like the bench is speeding up in the opposite direction. So now we do have a change in velocity, and thus a change in energy, and thus work.
So who did the work in this case? The car engine. You might ask "well how did the engine do work on the bench, it's not even touching it!". Well who said that the item doing work had to be in any way related to the object you're measuring?
For instance, what if the bench is on a treadmill and the treadmill starts moving? You would still say work was done on the bench, even though the motor was connected to the belt. You're OK with that?
Ok, well in this case, the car's engine spins the planet in the reverse direction, and the bench is on the planet. It's the exact same setup.
Now you'll likely say "there's no way that the car engine is spinning the whole planet!" - but that's precisely what Galilean relativity is all about. If you say "I'm sitting still in this car", then yes, by definition, the planet is spinning the other way.
You may not feel comfortable with that statement, but physically it's up to you to pick the reference frame that "makes the most sense". If that statement doesn't make sense, then simple pick the Earth as the reference frame - now it's the car that's speeding up and you're back to the bench not moving.
There's zero physical difference in any of these, it's all nothing more than what frame you feel most comfortable with? Did the car accelerate one way, or the Earth the other? You decide, it makes no difference in the end.
Comment: Careful: where you say "work is the change in kinetic energy" you are going to cause confusion in cases involving friction and/or potential energy. Work is the product of force and displacement.
Comment: Energy is not conserved between different inertial frames and accelerating changes you to one that has different amounts of energy.
Answer: Does work done depend on the frame of reference?
Unequivocally, YES. Forces are the same in any inertial reference frame, but displacements are not.
You are getting confusing and confused answers because the wording of the question is not entirely clear.  There seem to be two possible interpretations, neither of which effectively gets at the heart of the title question: (1) the car is accelerating, or (2) it is moving at a constant speed.  If (1) then the car frame of reference is non-inertial, which adds unnecessary complication if what you really want to know is the answer to the title question.  If (2) then there is no net force on the car, and hence no work done in either frame.
So, forget the car, accelerating or not, and consider instead a man lifting a heavy bag vertically at constant speed while riding an elevator that is itself rising at a constant speed.  The force applied by the man to the bag, in any frame, is just the weight of the bag.  The distance over which that force is applied depends on the reference frame: in the elevator frame, the man moves the bag from knee to shoulder height in a certain period of time--say a one meter displacement over the course of five seconds.  In the earth frame, the elevator might have risen two floors (six meters) during those same five seconds, so the total displacement of the bag is seven meters, and the work done on the bag is seven times greater than in the elevator frame. Meanwhile in the bag frame, the displacement, and therefore the work, is zero.
Answer: In a friction free world, the car moving with a certain velocity will not have any forces acting on it. If there were forces acting on the car, it would be accelerating.
There can be multiple forces acting on a body, so it's really important to specify which force are we talking about when we are calculating the work.
$\mathcal{Case (i) - }$
When you are sitting on a bench, you will observe the car to be accelerating from your non-inertial frame of reference (frame at rest or moving with constant velocity). Since, the car is accelerating, there must be some force acting on it.  Therefore, that force will do some work.
$\mathcal{Case (ii)-}$
Now when you are sitting in the accelerating car, an inertial frame, there will be pseudo force acting on all the objects you observe from your frame of reference. That pseudo force will certainly do work on the bench.
Although the engine will not doing any work on the bench.
Answer: Let me address your scenario first. What you suggested is bad physics because it breaks the conservation of energy. It doesn't work because the car is not an inertial frame. An inertial frame is arguably defined as one in which newton's laws work. We know that the bench frame is inertial because momentum is conserved as the car accelerates. The car frame is not inertial so it is meaningless to apply newton's laws and subsequently, energy conservation (unless you introduce fictitious forces, but those are limited to only a few scenarios). If this makes the definitions and statements in newton's laws seem circular, it's because they are. They empirically work relative to the fixed stars, (and any galilean shift of that) and one can show that they are true for frames purely accelerating due to gravity, as in the earth, so they are very useful anyway.
Now to answer the question you literally asked. Momentum change of a particle is conserved between inertial reference frames. However, energy change of that particle across a chosen path is not preserved, once you apply the appropriate transformations. The work done on a closed system however, is zero in any inertial reference frame, this is the conservation of energy and it is all that is needed to allow the frames to agree with each other.
For instance, think of an elastic collision between two particles with equal and opposite velocities magnitude $v$, in frame A, the work done on each particle is $mv^2$. Now choose a frame with a particle at rest, the work done is now $2mv^2$, the energy change of the system in both frames is 0.
Comment: This answer has serious confusions on the difference between inertial and non-inertial frames of reference, and how newton's laws are applied in both.
Comment: how so, in what sense?
Comment: the car is not inertial, and momentum isn't conserved in its frame. You can't just say the earth is accelerating one way without throwing away newton's third law. please address this
Comment: "What you suggested is bad physics because it breaks the conservation of energy." No conservation of energy is not violated in the example. You must take into account pseudo force for non inertial frame. Look here for more understanding https://physics.stackexchange.com/questions/538885/why-does-this-example-seem-to-contradict-conservation-of-energy
Answer: Wikipedia says

In physics, work is the product of force and displacement.

Or to put it mathematically $$\overrightarrow W =\int_{\overrightarrow x_{i}} ^{\overrightarrow x_{f}}\overrightarrow F\cdot \overrightarrow {ds}$$ here ${\overrightarrow x_{i}}$ and ${\overrightarrow x_{f}}$ are initial and final position vectors and that dot is dot product.
As both $\overrightarrow F$ and $\overrightarrow {ds}$ are both frame dependent thus their product will change with frame transformation(unless there is some specific reason). It really depends on the context.

The bench covers some displacement but who has applied force to it. Is some work done on it?

Note that you are observing bench in a non inertial frame so you have to take into account pseudo forces which seem to do negative work on the bench on your system and decrease its energy(in that frame).
So, yes work is frame variant, it has to be, as follows from it's definition.
Answer: If your velocity is zero then due to work energy theorem the work done would be zero. But if you are accelerating then pseudo force would do the work
Answer: If the frame of reference is on the  accelerating car, we have a non inertial frame of reference, so a pseudoforce (~fictious force) is born on the bench, which makes it accelerates as to the non inertial frame of reference.


GSA feed - adding multiple documents to a single record

Question: I am working on a product catalog whose search is powered by GSA. Each product is a single entry, but may have many associated documents. As I see there is only one content node allowed in the feed XML. is there a way to add multiple files to same record in the feed xml?  Any suggestions?
Comment: Can you please explain in a bit more detail what you are trying to achieve? You can add references to other records as metadata but one record = one document in the index.
Comment: The product specification is not a single file. There is a document for sales pitch, anther with detailed specifications and may even have another with customer reference/case study. The application being a product catalog ultimately, it needs to show only one search result per product.
Answer: Your best bet is going be when submitting each record to the feed, is to extract the content of associated documents and add as additional meta-data before sending to the feed.
Alternately, you can submit each record and each document, with some meta-data that references the record it's associated with. When returning search results, you could customize the front-end results to display related content (records or other attached documents).
Comment: The downside of submitting multiple records is the relevancy score and the response time (application needs to de-duplicate the results prior to display) Another approach we are trying out is the concatenating of text from multiple files, albeit from limited file formats.
Comment: I agree with Ed. Put the additional content on the record as additional metadata. You might not fit all of the content but if you really have to combine it all that's the best approach.
Answer: You can try additional document content into new metadata(1500 char limit) or document body.


How to set up an email notification if a user gets a new role?

Question: I'm on d7. I want to notify users if they have received a new role. Any suggestions on how can I do this? Thanks.
Answer: I suppose this is for manually promoting a user. I would try creating a rule using the Rules module for modifying the role and sending a mail to the user about his/her new role on the site.
I'm still learning how to use Rules, so I won't be able to give you a detailed recipe here, but after watching the excellent Rules screencast series at the NodeOne site, you might be able to do this quickly without making a custom module.
Answer: You can try "Role change Notify" module. But this module only sending one and the same email content to the user regardless of which new role assigned. You can't send different emails to different user based on the different role assigned.
I think a better way is to use Rules module to achieve. But no easy event can achieve this at the moment. Im still figuring out how to code it with Rules. Any new findings please let us know. Thanks.


How could ABC notation be embedded in our posts' Markdown?

Question: While it has by now been determined that music.SE wants ABC music markup, and the SE community managers have taken note, the integration remains to be implemented. A crucial point where this touches the users is: how can we best include ABC snippets within the Markdown of answers?
Comment: Thanks for turning this into its own Meta post!  See also: [this previous discussion](http://meta.music.stackexchange.com/q/956/28) about "code" blocks.
Answer: $ is a good delimiter character – it is long established on other SE sites for LaTeX / MathJax notation, and is not hard-wired in ABC syntax. However, I would vote for using the doubled variant $$, for the following reasons:

ABC allows assigning characters as line-delimiters, and $ is the recommended choice for this (though ! is also possible). Unless there's a good reason, we should not undermine this.
Music snippets will always be "displays", i.e. set apart from the surrounding text rather than inline with words of that text. This is analogous to the $$ TeX math display delimiter, whereas $ delimits simple inline maths expressions. It would be somewhat inconsistent if we now used single $ for music displays.

So,
Example of how a ABC-featuring post could look in Markdown editor.
$$
M: 4/4
L: 1/8
K: Dmaj
|:D3 EFGFC|D2 A2 AF2E|D4 B2C2:|
$$
This should then be easy to parse, and process using the existing ABCjs plugin,
and give nice notation output!

Answer: We already have jTab support that works without any delimiter.
So we will now have 2 different "languages". There might also potentially be need for having support for other stuff in the future.

So would it be smart to name the plugin?
$ABC$
X: 1
M: 4/4
L: 1/8
K: Dmaj
|:D3 EFGFC|D2 A2 AF2E|D4 B2C2:|

$ABC$

And for consistency, also support specifying jTab block:
(but keep jTab as default if needed for backward-compability - see comments)
$TAB$
C E F

$TAB$

If we need to keep jTab as default, there are also use cases where you want to have a monospace code block, but not parsed with jTab. Even though it might not be the most common case, it should be really easy to implement, and I found at least three feature requests for this (here, here and here).
It could be something like this:
$TEXT$
C    B       A         F            G      Eb   C      B        A
Sing along a song with notation without display chords here and there, lalala...
$TEXT$
Status: Almost complete....
OK, as ABCjs is now implemented, this is quite good, but I still miss the possibility to mark code block with just letters like the last example. I guess we could use inline coding like I have done above.
The best alternative is probably to use
 like this:

C    B       A         F            G      Eb   C      B        A
Sing along a song with notation without display chords here and there
    C       G      Emaj7 B     C            A       C       A    C
but still position the   chord names at the right position above lyrics.
Comment: I think existing SE posts are _generally_ not affected by syntax changes (apparently, each post is always saved in two forms – editable source code and some kind of lower-level persistent format), so this would only be an issue whenever somebody _edits_ an _old_ post with jTab in it. But I could be wrong here.
Comment: Good point about jTab, which IMHO does _not_ work very satisfyingly – posting monospace plaintext snippets in the way that's possible on any other SE site is always a bit of a roulette here. Hence, I would agree on `$ABC$` and `$TAB$`, _together_ with removal of jTab defaulting. OTOH, I think this is a bit YAGNI and contrary to the spirit of Markdown (as well as ABC), hence I still stay with my `$$` suggestion.
Comment: It would be bad to remove jTab defaulting, because there is a lot of existing content that relies on it. It could maybe be done if the SE team can do a global insertion of the $TAB$ tags in the music.SE database for code blocks when applying the new notation support, but that would be potentially dangerous... It is an idea for the SE team, and they can do it if they feel confident that they can do it in a way that does not break any content.
Comment: If that's true, it would be great! The SE team obviously knows this, so we leave it up to them to decide. We can agree on that removing the defaulting to jTab would be very nice.
Answer: Note: based on comments below I am effectively withdrawing my answer as a recommendation, but am leaving up in case anyone else has a similar thought.
Markdown uses a suffix description of the language that is to follow. Here's an example, using the $ symbol that seems to be popular here:
$$$abc
music markup here
more music markup here
the line beneath this closes this block statement
$$$

Personally, I'd prefer to use the grave symbol (which is often the same key as tilde ~ ) for several reasons

it's what is used in Markdown
the $ symbol is usually reserved for variable names in many computer programming languages
the grave symbol looks more eloquent when editing

For example:
```abc
music markup here
more music markup here
the line beneath this closes this block statement
```

Comment: Markdown uses backticks for _preformatted code snippets_, that's very different from a domain-specific language like ABC since the _source code_ is visible in public, rather than a rendered result. As for `$` being reserved in some programming languages... why would that be relevant here? They are _not_ used for variables in ABC, isn't that all that matters? And FWIW, use of `$` as a rendering-delimiter character in [TeX](https://en.wikipedia.org/wiki/TeX) is almost as old as its use for variable names in Unix shells.
Comment: Good points, thank you. My thoughts on not using $ were to pre-preemptively anticipate if ABC were ever extended to include variables, but (and I didn't know this) since Tex uses it as a convention it makes sense to use it.


Abel-Ruffini Theorem

Question: Is the Abel-Ruffini Theorem essentially equivalent to saying that the set of all complex numbers constructable by a concatenation of field operations and n-roots of rational numbers is a proper subset of the algebraic numbers?
Answer: I wouldn't put it quite that way. After all the Abel-Ruffini Theorem also tells us that in general the zeros of a fifth degree (or higher) polynomial are not contained in a root tower extension field of the smallest field containing the coefficients of the polynomials.
But that field generated by the coefficients of the given polynomial may very well contain transcendental numbers as well. If $K$ is the field generated by the coefficients of such a polynomial Abel-Ruffini says that the zeros of that polynomial, while necessarily transcendental numbers themselves, do not even belong to a root tower extension of $K$.
Of course, you are correct in stating that Abel-Ruffini also implies the existence of algebraic integers not contained in a root tower extension of the rationals. My point is that the scope of Abel-Ruffini is wider, and not restricted to subsets of the field of algebraic numbers.
Comment: Oh, so for algebraic numbers we think of polynomials in $\mathbb{Q}[x]$, but for Abel Ruffini the polynomials can have coefficients in any field?
Comment: Correct. I guess for the purposes of quintic polynomials we may want the field to have characteristic $>5$, but the field may, for example, be an extension of $\Bbb{C}$.

Abel-Ruffini Theorem


Largest number with sum S and N number of digits

Question: Given a number N and sum as S .What is the mathematical approach to construct the largest number  having N digits whose sum is S and smallest number of N digits  whose sum is again S. Leading zero digit numbers are not considered.
Comment: Put the number 9 as the first digit and after the biggest one to fill the sum S, by example if S=19 and N=5 then the largest number is 99100. The smaller is the "reverse", start with 9 in the last digit and continue putting numbers and reserve a 1 to the first digit by example for the anterior case the smaller number is 10099.
Comment: Any number with $N$ digits starting with 9 is bigger than any number with $N$ digits starting with a smaller digit. Note that there are no such numbers if $S>9N$. But we get the largest by taking $[S/N]$ 9s followed by one digit $S-9[S/N]$ followed by 0s. A similar approach for the smallest, except that there is an ambiguity for the smallest: is it allowed to begin with 0s? If not start it with a 1.
Answer: (a)Fill the first $\lfloor\frac S9 \rfloor$ digits by $9$Fill the next digit by $S\mod9$ Fill the rest of the digits by $0$
(b)Fill the last $\lfloor\frac {S-1}9 \rfloor$ digits by $9$Fill the previous digit by $S-1\mod9$  Fill the rest of the digits by $0$ Add $1$ to the first digit.
Example from the comment below,
$S=15$, $N=2$
$\lfloor\frac {S-1}9 \rfloor = 1$
$S-1\mod9 = 5$
So, you have $59$. No remaining digits, so no $0$s. Now, the last step - add $1$ gives $69$
Comment: can u illustrate b with an example
Comment: if SUM is 15 and u have to make the smallest 2 digit number,ans is 69.By doing as per your method floor(15-1/9)=1 so i placed 9at last and for next digit i need 6 to make 69  but your method 15-1%9=5 ,so it goes wrong here.CORRECT me if my argument is wrong
Comment: You are right. My method assuming certain things.. I just exchanged two steps in my method. Now, it will take care of that wrong assumption. Thank you.
Comment: @Vin Vineeth  where is the correct version ?YOU have not yet edited it .
Comment: @satya I exchanged two steps in my method. Well, I edited it again to include your example.
Answer: I assume you mean a number with $N$ digits in decimal base and having the digit sum $S$.
It runs down to partition the number $S$ into $N$ parts (if possible at all!), where the parts are in the range $\{ 0, \dotsc, 9 \}$ and sorting it such that either the largest parts come first for a maximal number, or such that the smallest parts come first for a minimal number. Of all feasible partitions one picks the one which comes first under the considered order.
One could pose it as integer linear programming (ILP) problem, e.g.
\begin{matrix}
\max & c^\top x \\
\text{w.r.t.} & Ax = b \\
& 0 \le x \\
& x \le 9
\end{matrix}
with
\begin{align}
c^\top &= (10^{N-1}, 10^{N-2}, \dotsc, 1) \in \mathbb{R}^{1 \times N} \\
A &= (1, \dotsc, 1) \in \mathbb{R}^{1 \times N} \\
x &= (x_!, \dotsc, x_N)^\top \in \mathbb{Z}^N \\
b &= (S) \in \mathbb{N}
\end{align}
and use a solver.
The minimal number is a bit trickier, because of the convention that leading $0$ digits are dropped (except for single digit numbers).


Is there any mention of consuming egg in any sastra or puran?

Question: Is there  any mention of consuming egg in any sastra or puran?
I mean details vidhi about

when to consume when to avoid.
what are the merits or demerits .
food value
how to consume etc etc

if yes then please provide the details
Comment: Related [What are Tamasic, Rajasic and Sattvic foods?](https://hinduism.stackexchange.com/q/2659/16823)
Answer: Atharvaveda 8.6.23 condemns the consumption of eggs.
It states

Ya aamam maansamadanti paurusheyam cha ye kravih
Garbhaan khaadanti keshavaastaanito naashayaamasi
We ought to destroy those who eat cooked as well as uncooked meat, meat involving destruction of males and females, foetus and eggs.
Answer: Both fertilized & unfertilized eggs are Non-Veg.
Veg/Non-Veg categorization is based on moral reasons:

Fertilized egg: This is egg which contains unborn baby and hence this is Non-Veg

Unfertilized egg: This is also Non-Veg because for getting unfertilized eggs, you will have to separate Hen from Rooster. Separating wife (Hen) from Husband (Rooster) is immoral and hence unfertilized egg is also Non-Veg.
mahAbhArata Adi parva ch. CXVIII also considers this a sinful act as deer censures/curses pAndu for denying sexual relation between male & female animal:

The sexual intercourse is agreeable to every creature and productive of good to all.
But that effort of mine
hath been rendered futile by thee.

Atharvaveda 8.6.23 also condemns the consumption of eggs as mentioned already
As per mahAbhArata shAntiparva CCLXXXII , chicken/chicken-products are forbidden :

From the blood of Vritra, O son of Pritha, were born high-crested cocks. For this reason, those fowls are unclean (as food) for the
regenerate classes, and those ascetics that have undergone the rite of
initiation.


Battery indicator disappears and shows frequently

Question: I have a problem with a battery (power) indicator in Ubuntu 11.10 with Gnome Shell. The indicator disappears and shows every moment when the cable is pluged in. It's ok until I want to click on weather, volume or any other "applet" in the panel, because if I do that at the same moment as the battery indicator dissappears, I click on a wrong applet and that's annoying. Thanks for any suggestion
Comment: have you tried to reinstall the applet that isn't working? (it's a package)
Comment: yep, I had tried it and nothing changed
Comment: is this a bug? if so is it reported at http://launchpad.net ?
Comment: I'm not sure whether it's a bug, but I haven't find it reported anywhere.
Answer: Try to install another battery indicator:
<code>sudo add-apt-repository ppa:iaz/battery-status
sudo apt-get update
sudo apt-get install battery-status
</code>
Comment: The software is apparently not in development any more. Last stable release is from 2010. It might not work on newer Ubuntu releases.


Best Alternative to WP List Table

Question: According to Codex they are not recommended uss WP List Table. So what is the best alternative to WP List Table?
Answer: I've not found any best alternative to this class. The WP_List_table is best to use. But the way to use it, is the concern. If you read the Codex cafefully you'll see a warning that-

This class's access is marked as private. That means it is not intended for use by plugin and theme developers as it is subject to
  change without warning in any future WordPress release. If you would
  still like to make use of the class, you should make a copy to use and
  distribute with your own project, or else use it at your own risk.

So from here we see the best practice to use the class. Copy it, rename it with your prefix and use it in your solution. By using this way you'll be safe if the WordPress admin changes anything or make the class deprecated it isn't gonna hurt your code or system or solution.

Best Alternative to WP List Table


Where can I get trained in Speech?

Question: I want to increase my speech skill in Skyrim so that I can sell any item to any merchant.
Where can I find someone who will train me in the Speech skill?
Comment: Related: [What is the fastest way to level up my speech skill?](http://gaming.stackexchange.com/q/43560/4797)
Answer: There are many places all over the world of Skyrim where you can be taught speech.
Information about speech can be found on the wiki here.
One of the methods of gaining speech as written on the wiki:

Method Two
During the Dark Brotherhood quest, "Recipe for Disaster", Anton Virane (the Chef of the Understone Keep in Markarth) can be intimidated repeatedly to level Speech. This can be accomplished by:

When talking with him, after saying "For the Dark Brotherhood, that can be easily arranged. (Intimidate)", he will respond "The Dark Brotherhood?".
If the conversation is immediately exited, the Dragonborn can begin to talk to him again and quickly skip through most of the conversation.
Exiting the conversation at the same time as before increases Speech.
This can be repeated forever.

Check that wiki page though, too much to explain here, it shows EVERYTHING on it.
Speech Trainers
Adept --- Dro'marash --- Khajiit Caravans (Travels between Riften and Dawnstar)
Adept --- Revyn Sadri --- Sadri's Used Wares in Windhelm
Adept --- Ronthil --- Castle Volkihar (Only available with The Elder Scrolls V: Dawnguard)
Expert --- Ogmund --- Markarth  (Can be found in the Silver-Blood Inn)
Master --- Giraud Gemane --- Bards College in Solitude
Comment: Not a problem. Happy to help.
Comment: Revyn Sadri's a common trainer(to lvl 50). He's a general goods merchant, so will buy anything. Handy if you're leveling crafting skills and looking for somewhere to sell the debris. You will need to do a small task for him first before he'll train you. You need to covertly return a ring to its owner's house(master locked. Best to make a save and try pickpocketing the key from the owner. Reload and try again if you get caught, but since keys weigh nothing and are worth nothing you shouldn't have much trouble). After that, you can pay for training and get even more xp in sales to get gold back.

Where can I get trained in Speech?


How to enable anonymous access for the custom master page in SP2010

Question: I created one site with forms based authentication and anonymous access. That is working fine. Now i want to replace the master page with the custom master page. I just copied the nightandday.master page and pasted in the same directory of the master pages. Now I changed the master page in the site settings page of the site to my custom master page. With custom master page when I signed out it is showing the sign-in page always. I am unable to show the site with anonymous access with my custom master page. I didn't approve my custom master page and I didn't publish it. Is it may be the problem?
If not, How to over come this?
Answer: Always make sure to check in, publish, and approve your custom masterpages as they will not be visible for anonymous user as they have no permissions to see non-published content.
Comment: But after publishing if want to edit and save the page, sharepoint designer is not allowing to save. It is saying that another version of this file exists. What to do for this?
Comment: @Mihir Refresh the Masterpage list or restart your SharePoint Designer to make sure it has the latest version index of your SharePoint site.
Comment: Even though it is not working fine. Can you please give me any link or site to study about these!!
Answer: Have you enable the anonymous access at site collection level?
http://salvatoredifaziosharepoint.blogspot.co.uk/2010/05/sharepoint-2010-abilitare-laccesso.html
http://www.topsharepoint.com/enable-anonymous-access-in-sharepoint-2010


Linksys router p roblem

Question: I have a Linksys WRT54G V8 router. I connected it to my PC today. The Power LED does not light up but the Internet and Node ones do light up. But the router does not seem to be working. I put in the install CD and it asked me to see if the router was connected properly. It is connected properly. I cannot access the settings page too. It is unable to connect. How can I solve this problem?
Comment: Is it safe to assume you have a network cable coming from your modem (Internet connection) into the WAN port, and then another network cable going to your computer from one of the LAN ports?  Do you know if you are getting an IP address on your computer (Start->Control Panel->Network Connections->Local Area Connection...->Support tab)?
Answer: I had this kind of problem with my WRT 54GC router several times.
Few hard resets helped me first time (hold reset button for 30 seconds). Note that router's IP address will change to 192.168.1.1
Half a year later this problem came again and I found that it was caused by (it is strange!) power supply. So I replaced it by a new one and all works fine since then.

Linksys router p roblem


Quantitative Location Shifting Detection for Run-Sequence Plot

Question: I am trying to complement a Run-Sequence Plot by some quantitative metric to validate that a dataset has a fixed location. Since the Run-Sequence Plot will be used in the early phases of Exploratory Data Analysis, the mean is used for location. What I am looking for is a unit-free coefficient and a reasonable threshold to decide whether the location (mean) is fixed.
My initial intuition is to split the dataset in samples of equal sizes, compute the means of every samples, then calculate the relative standard deviation for the computed means. From there, the threshold would be set to 0.01, 0.05, or 0.1. Below the threshold, the dataset would be considered as having a fixed location.
Because this quantitative metric would come in direct support of the graphical analysis of the Run-Sequence Plot from which we expect the analyst to visually decide whether the location is fixed, I am assuming that sampling should be done sequentially instead of randomly. If n is the number of values in a given sample, the first sample would be made of the first n values used to generate the Run-Sequence Plot, the second sample of the next n values, and so on.
In order to reduce the risk of having too few samples and the risk of having samples made of too few values, the number of samples would be defined as the floor of the square root of the number of values in the dataset. Therefore, the number of values in a sample would be roughly equal to the number of samples.
My questions are the following:

Is this run location shifting coefficient valid?
Is there a better coefficient?
Is the suggested sampling method acceptable?
Is the suggested sample size optimum?

Note: a similar method could be used to detect shifts in variation.
Answer: A simpler solution would consists in doing a linear least square regression of the dataset using the index variable as the independent variable in the regression, as described here. If there is no significant drift in the location over time, the slope parameter should be zero. But it won't show that the location is fixed over shorter intervals.


Cat meows at nothing

Question: Why is my cat randomly meowing? She jumped off the bed, laid down on the ground looked ta the ceiling and started meowing. Then she started grooming herself.
Answer: This probably isn't going to be a very satisfying answer, but: It's just something some cats do. Some cats never meow unless they need something. Some cats like to "talk" to people (and enjoy it when their human talks back to them). Some cats like to "talk" to themselves.
Think of it as your cat thinking out loud "I wonder if there's anything interesting on the ceiling."

Cat meows at nothing


How would a satellite powered by RTG be terminated?

Question: How will a satellite powered by RTG be terminated at the end of its  life?
Is there any set of rules to be followed? What's the general procedure?
Comment: Are you asking about how to deal with the nuclear-waste issue? I.e. that we've got Voyager 1 flying out there with rather bad nuclear waste sitting on it?

Or a technical question on how to power them down?
Comment: I don't think RTG are used by Earth-orbiting anymore, they stopped launching them for near-Earth spacecraft a long time ago.
Answer: Some examples:
Viking 1 was inadvertently terminated by overwriting the antenna pointing software.  Contact was never regained.
Viking 2's rechargeable battery died, ending that mission.
So neither Viking lander was deliberately terminated.
The Galileo orbiter was sent into Jupiter's atmosphere, where it was destroyed.
Cassini will be sent into Saturn's atmosphere in 2017.
There are planetary protection considerations in systems that might harbor biology, such as the Jupiter and Saturn systems, leading to some sort of deliberate disposal of any vehicle that has not been sterilized.  You want to avoid contamination by an inadvertent impact of an unsterilized vehicle on, for example, Europa or Enceladus.
There is no general procedure.  If the spacecraft does not need to be disposed of, like the Voyagers or Curiosity, I expect that they will be operated until they run out of power, fail, or until they are no longer funded.
Answer: Although technically a manned spacecraft rather than a satellite, the Apollo lunar modules each carried an RTG to power scientific equipment to be left behind on the moon.  However, Apollo 13's LM was brought back to Earth as a "lifeboat", including its RTG.  Although the RTG was designed to be "indestructible" and expected to survive re-entry, the Atomic Energy Commission insisted that it be disposed of in the most remote location on Earth:

The intent was to leave the Apollo 13's SNAP-27 RTG on the Moon to power surface experiments long after the crew had left. Now it was destined to re-enter the Earth's atmosphere, along with the rest of the LM.  The SNAP-27 was designed to survive re-entry without releasing its contents, but the AEC wanted to make sure it landed as far away from anyone as possible, just in case. Around eight to ten hours before Apollo 13 was due to re-enter, Lunney called Bostick up to his console and told Bostick about the AEC worries about the RTG. "I had been eyewitness to all these tests done on the RTG—it was indestructible… I reminded Glynn of that and he said 'I know, I know, but we've got to put it in a safe place.' I said, 'Glynn, I will do the best I can do but the number one thing is getting the guys back home.' So we did move the landing point a little bit… to put the RTG in the deepest part of the Pacific we could find," says Bostick. Whatever was left of the Aquarius, after its descent through the Earth's atmosphere, would find its resting place about 10 kilometers beneath the waves in the Tonga Trench. Ultimately, no released radioactivity was ever detected, despite a helicopter survey of the area.
https://spectrum.ieee.org/tech-history/space-age/apollo-13-we-have-a-solution-part-3


Can I use an LED bulb in a incandescent only fixture?

Question: I'm considering buying a Home Easy ceiling rose, as my light switch is in awkward place and I'm unable to move it. I have an LED bulb in the correct socket, and this manual says you can't use fluorescent bulbs, only incandescent. However it makes no mention of LED bulbs. Is it safe to use an LED bulb in such a socket?
Comment: Self-citing here, but the same applies. https://diy.stackexchange.com/questions/79466/why-do-my-led-bulbs-state-not-for-use-in-totally-enclosed-luminaires/79520#79520
Answer: There are a few reasons you might not want to use an LED bulb in a fixture:

If the fixture is dimmable and the LED bulb is not, the bulb may flicker or not come on.
If the fixture is enclosed, an LED bulb may overheat. (LED bulbs generate much less heat than incandescents, but they do generate some... and they're a lot more sensitive to overheating). Some LED bulbs say they're OK in enclosed fixtures.
LED bulbs are often larger (even if the mount is the same), so an LED might not fit.
If the fixture or circuit runs a small amount of current through the bulb at all times, this can cause a LED bulb to stay lit. This is usually an issue with light switches that have some electronics in them and don't have their own neutral (e.g. a timer or night light). I can't really tell what's going on with your fixture, but this might be the reason.
Answer: If the LED bulb is dimable it might work.
Typically when you see incandescent only it is modifying the AC wave form.  Incandescent bulbs don't care and can work over a pretty broad range.  Where bulbs that have a solid state controller or transformer in it are pretty limited to a standard AC wave form.  And if that LED/CF bulb can be dimmed, they they can handle the most common type of AC dimming only.


What is the origin of the tag property in UI toolkits?

Question: I've seen the tag property in all UI frameworks I worked with: UIKit, Forms, OpenStep, even Delphi 6. Was it in the original Macintosh Toolbox or Xerox's framework? WhAt was the original idea behind it?
Answer: Quoting from the docs for UIView...

tag Property
  An integer that you can use to identify view objects in your application.

Assuming you've seen the docs for such attributes, you're probably really asking why people still use them today. They are there as a convenience to developers to use however they want. In an object graph containing multiple objects of the same class (buttons, menu items, etc.), different tag values can be assigned to help identify one button over another. Or they can be used to hold a pointer to some more data (not necessarily a recommended approach), or bit field, or whatever.
Nowadays, memory and CPU resources are such that we can throw in other stuff to help identify things at runtime. The integer tag attribute was used in "the good old days" when memory and CPU resources were more scarce. It doesn't hurt anything to leave the tag attribute in there, and many developers still use it.
Answer: Before data binding was a popular method in UI libraries, the Tag property allowed you to place an Identifier that might be associated with a backend object (in Windows Forms the Tag property was an object, so you could place the entire object into the Tag).