Laurent series expansion (example)

Question: $$ \text{Let} \quad f(z)=\frac{1}{z}+\frac{2}{3-z},\quad z\in \mathbb{C}\smallsetminus \{0,3\}.$$ To find the Laurent series expansion of $f$ about $z_0=1$ within the annulus $1<|z-1|<2,$ one must aim to expand each fraction as an infinte geometric series with radius of convergence $|r|<1.$ $$f(z)=\frac{1}{1+(z-1)}+\frac{2}{2-(z-1)}=\frac{1}{(z-1)} \cdot \frac{1}{1+\frac{1}{z-1}}+\frac{1}{1-\frac{z-1}{2}}$$ Since $\bigg|\frac{z-1}{2}\bigg|<1$ and $\bigg|\frac{1}{z-1}\bigg|<1,$ $$f(z)=\frac{1}{(z-1)} \cdot\sum_{n=0}^\infty \frac{(-1)^n}{(z-1)^n}+\sum_{n=0}^\infty \frac{(z-1)^n}{2^n} \iff$$ $$f(z)=\sum_{n=0}^\infty \frac{(-1)^n}{(z-1)^{n+1}}+\sum_{n=0}^\infty \frac{(z-1)^n}{2^n}$$ Can someone elaborate on the geometric relation between the large and small radius of the annulus and the geometric series' radii of convergence?
Answer: As you see the series
$$f(z)=\frac{1}{(z-1)} \cdot\sum_{n=0}^\infty \frac{(-1)^n}{(z-1)^n}$$
valid for $\bigg|\frac{1}{z-1}\bigg|<1$  which is outside a circle centered at $z=1$, and the series
$$\sum_{n=0}^\infty \frac{(z-1)^n}{2^n}$$
valid for $\bigg|\frac{z-1}{2}\bigg|<1$, which is inside of a circle centered at $z=1$, so your Laurent series
$$f(z)=\sum_{n=0}^\infty \frac{(-1)^n}{(z-1)^{n+1}}+\sum_{n=0}^\infty \frac{(z-1)^n}{2^n}$$
valid in intersection of two areas, that is
$$\{z:|z-1|<2\} \bigcap \{z:|z-1|>1\} = \{z:1<|z-1|<2\}$$
Answer:
The function
  \begin{align*}
f(z)=\frac{1}{z}+\frac{2}{3-z}\qquad\qquad z\in\mathbb{C}\setminus\{0,3\}
\end{align*}
  is to expand around the center $z_0=1$.

Informally: In order to determine the regions of convergence in case of isolated singularities we start from the point we want to expand the function (here $z_0=1$). Then we look at the greatest circular region with center $z_0$ which does not contain a singularity and so has necessarily a point of singularity at its boundary. This determines the first region. Then we consider an annulus starting from the first point of singularity circularly extended to the next point of singularity. We continue this way till all singularities are at the boundary of one of these regions. The final region is the complement of (the union of the closure) of all the other regions.

Since there are simple poles at $z=0$ and $z=3$ we have to distinguish three regions of convergence
  \begin{align*}
D_1:&\quad 0\leq  |z-1|<1\\
D_2:&\quad 1<|z-1|<3\\
D_3:&\quad  |z-1|>3
 \end{align*}

The first region $D_1$ is a disc with center $z=1$, radius $1$ and the pole at $z=0$ at the boundary of the disc. It admits for both fractions of $f$ a representation as power series.
The region $D_2$ is an annulus containing all points outside the closure of $D_1$ and the closure of $D_3$. It has the poles $z=0$ and $z=3$ at the boundary of the annulus. It admits for the fraction with pole  at $z=0$ a representation as principal part of a Laurent series and for the fraction with pole at $z=1$ a representation as power series.
The region $D_3$ contains all points outside the disc with center $z=1$ and radius $2$. It admits for both fractions a representation as principal part of a Laurent series.

Hint: An answer with calculation of a power series and principal part is for instance given here.

Laurent series expansion (example)


How can I delete all files/subfolders in a given folder via the command prompt?

Question: I would like to delete all files and subfolders in a batch file in Windows 7 and keep the top folder. Basically emptying the folder. What's the command line instruction for that?
Comment: Not to nitpick, but you're looking for how do do this "from the command prompt" not from "DOS." There hasn't been a DOS subsystem since Win ME.
Comment: @MarkM: Well, there is/was `ntvdm` but as 64-bit systems gain market share it's getting increasingly irrelevant.
Comment: See also http://stackoverflow.com/questions/1965787/how-to-delete-files-subfolders-in-a-specific-directory-at-command-prompt-in-wind
Answer: You can do this using del and the /S flag (to tell it to remove all files from all subdirectories):
del /S C:\Path\to\directory\*

Comment: This is the wrong answer and I don't know why it received many up votes. It seems people didn't understand the question fully and don't read comments! I will go through the answers and select the correct one.
Comment: But it leaves the Subfolders how do you also tell it to delete the sub folder itself ?
Comment: and using /Q keeps empty sub folders which is undesirable.
Comment: Explanation: del stands for Delete and S stands for Recursive.
Comment: @Tony_Henrich, Learn more about msdos commands here.  http://www.computerhope.com/msdos.htm
Comment: It left empty subfolders.
Comment: @Moab - that link is not very useful for Windows 7. For example deltree doesn't exist
Comment: With /Q i don't have to enter Y to confirm.
Comment: My answer was wrong as the top folder had to remain.
Comment: @MarkM - This command is giving prompts which can't be allowed in a batch file. It needs to run silently.
Comment: @Tony_Henrich there wasn't a correct answer yet?
Comment: +1 more.  Also good catch Tom!  You seem like one of the more level-headed people here :)
Comment: /Q on windows 7 will do it Quietly, i.e. no "are you sure?" prompt in case you are scripting it.
Answer: The best Solution:
e.g. i want to delete all files and sub-directories of parent directory lets say  "C:\Users\Desktop\New folder\".  The easy way is create batch file of below three commands.

cd C:\Users\Desktop\New folder\
del * /S /Q
rmdir /S /Q "C:\Users\Desktop\New folder\"

Here first it will clean all files in all sub-directories and then cleans all empty sub-directories.
Since current working directory is parent directory i.e."\New folder", rmdir command can't delete this directory itself.
Comment: Real dangerous. If somebody goes ahead and removes/renames `C:\Users\Desktop\New folder\`, the very first line with CD fails and your batch file happily deletes everything in the current (default) directory. Which could very well end up being your working directory or C:\Windows\System32
Comment: Not good. Hard coded paths and by looking at it, it doesn't empty the folder. It removes it. Very dangerous also. It deletes files at the current folder if the path doesn't exit or mispelled.
Comment: Works very well, except for a warning when the system cannot delete the root folder.
Comment: As @Tony_Henrich said the `rmdir` command will delete `New folder`
Comment: No. This actually works at completely clearing the "New folder" without deleting the folder itself.

The only issue is that it gives a minor warning when the OS fails to delete the parent folder. Also, the del command is redundant unless you have a large folder, in which case it might be faster. You could just modify it as such (Sorry about the lack of line breaks in comments):

set FOLDER="%userprofile%\Desktop\New folder"
cd %FOLDER%
rmdir /S /Q %FOLDER%\ >nul 2>&1
Comment: Can confirm `rmdir` deletes the parent directory - not sure what HSuke is talking about in that regard, but the `del` command does seem redundant here.
Answer: Navigate to the parent directory:
pushd "Parent Directory"

Delete the sub folders:
rd /s /q . 2>nul

Comment: Wow, that's hackish. :)
Comment: This is essentially equivalent to two previous answers.
Comment: Agreed with above - this is a copy of previous answers, replaced with commands synonymous to those they're replacing. `pushd` doesn't add anything here that `cd` isn't already doing.
Comment: this is the only one i was able to use so far that worked exactly for what the asker was asking, all the other ones just delete all the files. Of course `rmdir /s path-to-folder` will delete the folder with all the stuff in it, but the asker wanted to know how to delete everything in working directory.
Comment: This answer worked best for me. With all the other answers it didn't delete non-empty directories when using /Q and it always asked for confirmation when not using /Q.
Comment: This is the best and simple answer, worked well for me.
Comment: Interesting. The `2>nul` part redirects the standard error stream to null so you don't see the error appear that reads "The process cannot access the file because it is being used by another process."
Answer: rmdir "c:\pathofyourdirectory" /q /s

Don't forget to use the quotes and for the /q /s it will delete all the repositories and without prompting.
Comment: The question was "I would like to delete all files and subfolders in a batch file in Windows 7 and **keep the top folder.**"
Comment: This solution works perfectly on windows 10. Thanks.
Answer: You can do it quickly and easily by putting these three instructions in your bat file:
mkdir empty_folder
robocopy /mir empty_folder "path_to_directory"
rmdir empty_folder

Comment: This is immensely useful since it also removes any hidden or system files.
Comment: In Windows even the simplest tasks become complicated beyond description. Add a space before the closing quote if you use filenames with spaces in Robocopy
Answer: user340956 was painfully close to the solution, but you know what they say about close…
To be clear, rd /s /q c:\foobar deletes the target directory in addition to its contents, but you don't always want to delete the directory itself, sometimes you just want to delete its contents and leave the directory alone. The deltree command could do this, but Micrsoft, in its infinite "wisdom" removed the command and didn't port it to Windows.
Here's a solution that works without resorting to third-party tools. It's probably about as simple and efficient as is possible with a command-line script instead of outright writing an actual executable. It doesn't set any environment variables and it doesn't use any loops. It's also as safe as can be, with error-checking everywhere possible, and also as user-friendly as possible, with built-in docs.
dt.bat (or dt.cmd for the kids; whatever, I'm old, I use .bat ):
:: dt is a Windows-compatible version of the deltree command
:: Posted to SuperUser by Synetech: https://superuser.com/a/1526232/3279

@echo off
goto start

:start
    if ["%~1"]==[""] goto usage
    pushd "%~1" 2>nul
    if /i not ["%cd%"]==["%~1"] goto wrongdir
    rd /s /q "%~1" 2>nul
    popd
goto :eof

:usage
    echo   Delete all of the contents of a directory
    echo.
    echo   ^> %0 DIR
    echo.
    echo   %0 is a substitute for deltree, it recursively deletes the contents
    echo   (files and folders) of a directory, but not the directory itself
    echo.
    echo   DIR is the directory whose contents are to be deleted
goto :eof

:wrongdir
    echo Could not change to the target directory. Invalid directory? Access denied?
goto :eof

Here's how it works:

It checks if a command-line argument has been passed, and prints usage information and quits if not.
It uses pushd to save the current directory, then switch to the target directory, redirecting any errors to nul for a cleaner command-line experience (and cleaner logs).
It checks to see if the current directory is now the same as the target directory, and prints an error message and quits if it is not. This avoids accidentally deleting the contents of the previous directory if the pushd command failed (e.g., passing an invalid directory, access-error, etc.)

This check is case-insensitive, so it's usually safe on Windows, but isn't for any case-sensitive file-systems like those used by *nix systems, even under Windows.
It doesn't work with short-filenames (e.g. C:\Users\Bob Bobson\foobar won't be seen as being the same as C:\Users\BobBob~1\foobar even if they actually are). It's a slight inconvenience to have to use the non-short filename, but it's better safe than sorry, especially since SFNs aren't completely reliable or always predictable (and may even be disabled altogether).

It then uses rd to delete the target directory and all of its contents, redirecting any errors (which there should be at least one for the directory itself) to nul. Some notes about this:

Because the target directory is the current directory, the system has an open file-handle to it, and thus it cannot actually delete it, so it remains as is, which is the desired behavior.
Because it doesn't try to remove the target directory until after its contents have been removed, it should now be empty (other than anything that also has open file handles).

Finally, it uses popd to return to the previously-current directory and ends the script.

(If you like, you can comment the script with the above descriptions using rem or ::.)
Comment: Thank you for this. I created the batch file but it doesn't delete certain folders such as the `Documents` folder that I backed up from `C:\users\joe` in a Windows OS. I made that backup using `robocopy` using the `/copyall` parameter so I guess it copied security and ownership info. Maybe that stops your batch script from deleting that folder?
Comment: Yup, that would be my guess. You can try opening an elevated command-prompt and running the batch-file from that.
Answer: you can use rmdir to delete the files and subfolder, like this:
rmdir /s/q MyFolderPath

However, it is significantly faster, especially when you have a lot of subfolders in your structure to use del before the rmdir, like this:
del /f/s/q MyFolderPath > nul
rmdir /s/q MyFolderPath

Comment: The `rmdir` command (both are the same) will delete the parent folder. This is *not* an answer to the question. Why don't people read?
Comment: First option gives an error "the directory is not empty". The first command in the second option, deletes the whole folder. It doesn't keep it like I wanted. The second command is not needed if the first command deleted the whole folder.
Answer: 1. What the OP asked for
del /f /s /q "C:\some\Path\*.*"
rmdir /s /q "C:\some\Path"
mkdir "C:\some\Path"

That will remove all files and folders in and including the directory of "C:\some\Path" but remakes the top directory at the end.
2. What most people will want
del /f /s /q "C:\some\Path\*.*"
rmdir /s /q "C:\some\Path"

That will completely remove "C:\some\Path" and all of its contents
If OP has some oddly specific requirement to not touch the top-level directory in any capacity... they should mention that in their question :)
Comment: It is less "oddly specific" than you think, I just came to that question with this exact requirement (the top folder cannot be removed because the script does not have the permission to do it).
Answer: If you want to delete all files in a folder, including all subfolders and not rely on some error conditions to keep the root folder intact (like I saw in another answer)
you could have a batch file like this:
@echo off

REM Checking for command line parameter
if "%~1"=="" (

    echo Parameter required.
    exit /b 1

) else (

    REM Change directory and keep track of the previous one
    pushd "%~1"

    if errorlevel 1 (

        REM The directory passed from command line is not valid, stop here.
        exit /b %errorlevel%

    ) else (

        REM First we delete all files, including the ones in the subdirs, without confirmation
        del * /S /Q

        REM Then we delete all the empty subdirs that were left behind
        for /f %%D IN ('dir /b /s /a:d "%~1"') DO rmdir /S /Q "%%D"

        REM Change directory back to the previous one
        popd

        REM All good.
        exit /b 0
    )

)

And then you would simply call it with:
empty_my_folder.bat "C:\whatever\is\my folder"

Comment: This left subdirectories in my testing
Answer: To delete file:
del PATH_TO_FILE

To delete folder with all files in it:
rmdir /s /q PATH_TO_FOLDER

To delete all files from specific folder (not deleting folder itself) is a little bit complicated. del /s *.* cannot delete folders, but removes files from all subfolder. So two commands are needed:
del /q PATH_TO_FOLDER\*.*
for /d %i in (PATH_TO_FOLDER\*.*) do @rmdir /s /q "%i"

You can create a script to delete whatever you want (folder or file) like this mydel.bat:
@echo off
setlocal enableextensions

if "%~1"=="" (
    echo Usage: %0 path
    exit /b 1
)

:: check whether it is folder or file
set ISDIR=0
set ATTR=%~a1
set DIRATTR=%ATTR:~0,1%
if /i "%DIRATTR%"=="d" set ISDIR=1

:: Delete folder or file
if %ISDIR%==1 (rmdir /s /q "%~1") else (del "%~1")
exit /b %ERRORLEVEL%

Few example of usage:
mydel.bat "path\to\folder with spaces"
mydel.bat path\to\file_or_folder

Answer: To delete all subdirectories and their contents use robocopy. Create an empty directory, for example C:\Empty. Let's say you want to empty C:\test which has lots of subdirectories and files and more subdirectories and more files:
robocopy c:\empty c:\test /purge
then, rd C:\test if need be.
Answer: This worked better for me when I had spaces in the folder names.
@echo off
REM ---- Batch file to clean out a folder
REM Checking for command line parameter
if "%~1"=="" (

echo Parameter required.
exit /b 1

) else (
echo ***********************************************************************************
    echo *** Deleting all files, including the ones in the subdirs, without confirmation ***
    del "%~1\*" /S /Q
echo ***********************************************************************************
    REM Deleting all the empty subdirs that were left behind
FOR /R "%~1" %%D IN (.) DO (
    if "%%D"=="%~1\."  (
    echo *** Cleaning out folder: %~1 ***
    ) else (
    echo Removed folder "%%D"
    rmdir /S /Q "%%D"
    )
)

    REM All good.
    exit /b 0

)

Comment: People always forget about having spaces in the names.
Answer: If you wanted to empty the folder, my take is:
@ECHO OFF

:choice
cls
set /P c=Which directory? [Desktop, Documents, Downloads, Pictures]
if /I "%c%" EQU "Desktop" set Point = "Desktop"
if /I "%c%" EQU "Documents" set Point = "Documents"
if /I "%c%" EQU "Downloads" set Point = "Downloads"
if /I "%c%" EQU "Pictures" set Point = "Pictures"
if /I "%c%" EQU "Videos" set Point = "Videos"
goto choice
set /P d=Which subdirectory? If you are putting multiple. Your's should be like "path/to/folder" (no files!!)

IF NOT EXIST C:\Users\%USERNAME%\%Point%\%d% GOTO NOWINDIR
rmdir C:\Users\%USERNAME%\%Point%\%d%
mkdir C:\Users\%USERNAME%\%Point%\%d%
:NOWINDIR
mkdir C:\Users\%USERNAME%\%Point%\%d%

Simple as that!
I hope I helped you out!
I recommend you to take the whole code, if you don't want to take the whole code, then you can simplify this with.
IF NOT EXIST *path here* GOTO NOWINDIR
rmdir *path here*
mkdir *path here*
:NOWINDIR
mkdir *path here*

EDIT:
rmdir won't work if it isn't empty. To fix that.
IF NOT EXIST *path here* GOTO NOWINDIR
del *path here*/* /S /Q (dont copy this, the above prevents the del command from deleting everything in the folder, this is simallar to another answer.)
rmdir *path here*
mkdir *path here*
:NOWINDIR
mkdir *path here*

Not sure if this works but...
sdelete -s -p *path here*/*

Answer: None of the answers already posted here is very good, so I will add my own answer.
Try this:
for /f "delims=" %i in ('dir path\to\folder /s /b /a:-d') do del "%i" /f /q /s
fot /f "delims=" %i in ('dir path\to\folder /s /b /a:d') do rd "%i" /q /s

This should do it.
Comment: You don't actually need to do dir /s, because rd /s will delete the subfolders.  And you don't need to do dir /s for the files, because you only need to delete files in the root folder.  This assumes, of course, that there are no errors when attempting to remove folders.
Answer: Seems everyone is missing the fact that we're wanting to delete multiple sub folders, but NOT delete the parent folder.  We may also no know all the names of the subfolders, and don't want to do each one individually.
So, thinking outside the box, this is how I solved this issue.
mkdir c:\EmptyFolderToBeDeletedSoon
Robocopy /Purge c:\EmptyFolderToBeDeletedSoon c:\FolderIWantEmpty
rmdir c:\EmptyFolderToBeDeletedSoon
Make a temp directory that's empty.
Use the RoboCopy command with the /Purge switch (/PURGE :: delete dest files/dirs that no longer exist in source.) using the empty folder as the source, and the folder we want empty as the destination.
Delete the empty temp folder we created to be the empty source for Robocopy.
Now, you have an empty folder of all files and folders, which is what this whole string was about.
Answer: This is what worked for me.

Navigate inside the folder where you want to delete the files.
Type: del *
Y for yes.
Done
Answer: Example: Delete everything (folders/subfolders/files) in 3D Objects folder but want to leave 3D Objects folder alone
pathThere="C:\Users\PhilosophyPoet\3D Objects"
CD pathThere
RMDIR /s /q pathThere
When CMD is oriented to working directory, using RMDIR will delete all folders, subfolders and files from the working directory. Seems like CMD process cannot process itself just like 'I can't throw myself into rubbish bin because the rubbish bin need to be seal by someone'
Answer: Here's a two-line solution I just came up with, possibly exploiting a bug or unexpected behavior in robocopy. This works with the newest version of cmd and robocopy on Windows 10 at this writing.
It mirror syncs an empty sub-folder to its parent folder. In other words, it tells the parent folder to have all the same files as the sub-folder: none. Amusingly, this means it also deletes the empty sub-folder that it is instructed to sync with.
This example will empty the Temp folder for the current user. Note that it is using the %TEMP% environment variable, which cmd expands to whatever that may be, for example C:\Users\Dobby_the_Free\AppData\Local\Temp:
mkdir %TEMP%\i_like_cheez
robocopy /mir %TEMP%\i_like_cheez %TEMP%

Answer: this script works with folders with a space in the name
for /f "tokens=*" %%i in ('dir /b /s /a:d "%~1"') do rd /S /Q "%%~i"


CM11 com.android.themes.provider and com.android.settings crash

Question: Dirty updated from OmniROM to latest CM11, fixed permissions, and got crashes. Firstly crashed com.android.phone, I have removed some files and managed to fix it. After it I have tested a little and experienced other crashes: com.android.themes.provider (when trying to enter to any submenu of themes menu) and com.android.settings (when trying to enter cellular network settings) . What files should I remove to fix it? I tried to clear .themes.provider's folder and .settings' folder, it doesn't help.
Answer: A dirty upgrade is never 100% error free. You have to either fix permissions (worked out for me) or wipe data and reinstall everything. Also check the owner and group of all the files and folders, they tend to be different even on the same Android version.
Comment: I have already done fixing permissions: both via recovery and via nandroid manager (fixes permissions for apps, recovery doesnt do it)
Comment: I mean manually eg with rootexplorer. Check read, write and execute permissions as well as owner and group. Fixing permissions with recovery didn't work for me, only the manual way.


What are the pros and cons of having a unit type over C-like void?

Question: Unit types are types found in more modern languages, replacing void in the C-family languages. Unlike void, a unit type has an actual value, exactly one. This allows functions that return nothing to be used in expressions and the like. Initially, my language had a Void type, which simply served the purpose of void in the C-likes (I thought a unit type would be too hard to implement for the time being). However, as my compiler grew, Void slowly gained more and more "realness" until I got to the point where it was just below a "real" type. All that was needed was a few more lines of code and it'd be a full-blown unit type. What are the advantages of me turning it into a unit type versus just having an equivalent of C's void?
Comment: @Aster well, then you could say the same about all types. A C function whose result is an `int` is also not guaranteed to terminate; yet it's generally understood that this has nothing to do with the `int` type having an extra value `Never`, but simply that it's always possible for a function to not yield a value at all in finite time. By contrast, Haskell does consider nontermination as a special (un-matchable) value `⊥` which every type has in addition to its "proper" values. In that sense Haskell's unit type `()` has indeed two values, `()` and `⊥`.
Comment: I don't think the two are equivalent, in fact the equivalent of `void` should be `Unit | Never`
Comment: The void type in C was a design error, retained for historical reasons. Don't emulate it. (It seems like all the actual answers support this.)
Comment: And yet in Racket `(void)` evaluates to the singleton value `#`
Comment: " This allows functions that return nothing to be used in expressions and the like"  C++ allows this and its `void` is certainly "C-like"
Comment: @BenVoigt but others with such a `void` dont
Comment: C's `void` is ultimately an idiosyncratic unit type. It's a unit type, but it's not actually first-class (for instance, you can't have a variable of type `void`). It's treated as a special case. IMO, there isn't much reason to have such a special case and it'd be nicer to have a first-class unit type. The name adds to the confusion, since "void" suggests it's an empty type but it isn't an empty type (it's just that there are restrictions to where you're allowed to have the value).
Answer: In C, void is used in four and a half different ways.  A unit type is equally good for one, worse for a second, better for two more, and totally unsuitable for the last.
Some languages have a Top or Bottom type, both distinct from the unit type, which is a better fit for some of the ways C uses void.
Side-Effect Functions
Marking the return type of a side-effect function is completely equivalent to a unit type in other languages.  There are no advantages one way or the other; it's just spelled differently.  An unusual variation is Haskell: since there is no such thing as a side-effect function that's pure, a pure function returning a unit type would be completely useless in a functional language—but many Haskell functions return io (), which actually represents an operation evaluating to () that can be run.
Throwing Away Return Values
The second distinct use for void in C is that the cast (void) explicitly declares that you are ignoring a return value.  This can be necessary to make all the branches of a ? expression have the same type.
In other contexts, C spells this cast ;. This is partly because K&R-style functions needed to return something, so a function that would return void in ANSI C returned int in K&R C, and the programmer would just ignore the meaningless return value.  You will sometimes. however, see C programmers write it out as (void)printf("hello, world!");.  In fact, lint used to require it.  If your function is returning something so useless that it's better to ignore it than to check it, that's a code smell, but Dennis Ritchie would have copped to that.
The reason for this is that many C functions report errors in their return values, and the language makes it easy to shoot yourself in the foot by ignoring errors.  If programmers are forced to explicitly write out that they are ignoring the return value, they at least need to think about it, and are less likely to neglect to check for an error just because the language makes it easier to ignore them.
A modern strongly-typed language returns different types on success and error, like Just x/Nothing in Haskell, or Ok ()/Err _ in Rust.  In practice, an option unit type is equivalent to a boolean, but might appear as a stage of a railway-oriented computation terminating in ().  A unit type is useful to compose a result type that reports either the fact of success or details about the error.  The void type in C or C++ cannot be used this way: a std::variant or union cannot contain void.
The language might or might not make it syntactically possible to ignore errors at all.  One solution would be to implicitly unwrap values, so that if (in Rust syntax) foo returns a Result<(),Error>, foo(bar); would implicitly check the return value.  If it's Ok (), the program proceeds, and if it's an error, the program panics.  A language that did this would probably have a lot of unexpected runtime panics, but at least there would be a message giving the line of code where the error appeared and a useful stack trace.  Rust instead takes a middle ground (based on Swift) where unwrapping must be explicit, but there's the syntax sugar ? for unwrapping on success and short-circuiting on error.
Some languages use a return value of the bottom type (the type that no other is a subtype of) to denote the return value of an expression that never returns at all, such as throw.  This is very different from a function that always returns successfully!  A special case is a panic function that needs to be able to appear in any context.  In many languages, these functions that terminate the program are the one exception to the type system, since there should be no type-checking of its return value (or it can be thought of as having a fully-generic return type).  C has syntax to make all branches of a ? expression return (void), but not to ignore the type only of branches that do not return, and unify the type of all the ones that could.
A Generic Reference
C uses void* as the type of a generic object pointer.  A unit type would be a poor fit for this.  A top type from computer science (like Object or Any) would be more appropriate, if a language has such a thing at all.
C needed a type like void* because of some quirks required for compatibility.  A new language would not have the same requirements.  One is that K&R-style functions don't type-check their arguments, so it was common to write code like memcpy(&dest, &src, sizeof(dest));.  When C++ and ANSI wanted to add type-checking, they therefore needed a type that any other object pointer implicitly converts to.  Another quirk is that C historically had to support mainframes that used different pointer formats for character and word pointers, or even had pointer types of different sizes.  K&R historically reads these out as char*, and mainframes with different word and character pointers historically made character pointers long enough to hold word pointers but not vice versa. Standard C and C++ therefore specified that it must be safe to convert any object type to either void* or char*. and furthermore that a function call with K&R-style promotions must use the same representation for a conversion to void* or char*.  Finally, C keeps backward-compatibility with code like char* foo; foo = malloc(SIZE);, and in fact now lets you write T* const foo = calloc(elems, sizeof(T));, but this was a bridge too far for C++, which wanted programmers to stop using C-style memory management anyway.  (C++ then introduced a new unit type, nullptr_t, to restore this implicit conversion to, and not just from, any pointer type.  There had previously been a widely-used implementation by Scott Myers, in Effective C++.)
One disadvantage of a reference to a unit type is that the compiler will catch the logic error of dereferencing a void*.  If you tried to represent something similar using a reference to a unit type, in a language with automatic type inference, it would dereference to a valid object.
Another is that a generic object pointer must be at least as wide as any object pointer, plus whatever bits are needed to distinguish between different pointer types. It would me more efficient for all unit-type references to have zero bits of storage and compare equal to each other.
If you allow objects or references to the unit type to exist, there would also be no way to distinguish between their type and the fully-generic pointer type.
For most purposes that you would use a void* that isn't NULL, it would be better to use the concept of a top type, one that every other type is a subtype of.  That would represent a reference that could be to any type, in a more rigorous way.  A weakly-typed language (one that only distinguishes between returning nothing or returning something, or one that has everything return some possibly-empty string) implicitly has a top type that it uses to represent some arbitrary untyped thing.  It might or might not have a name in the language itself.
Empty Argument Lists
The only reason this is a homonym for the unit type in C was that the more-intuitive syntax f(), as in most other C-family languages, already meant something different.  C does not use void to define an empty struct, but some C++ templates do.
Some other answers discuss whether, in a language with template or generic type parameters, void should be a valid type.  This essentially means that everything you specify as "of one generic parameter" really means "of zero or one parameter," and everything you specify as N generic parameters really means "of up to N parameters."  A language with generics, but not overloading, does need some construct that means, "any number of items," "zero or one item," and "exactly one item."  These might be type qualifiers.
There are several advantages to representing a generic set of function parameters as a tuple, with its syntactic sugar, rather than with some other syntax like a C++ T... parameter pack.  In terms of semantics, and not just spelling, a unit type has the advantage that the logic of many operations that would fail for void work for ().  For example, you can call a function with the members of () as its arguments, or iterate over the members of (), but not pass in the value of a void.
It is possible to write around the quirks of void in C++, for instance by specializing the template, using if constexpr (std::same_as<T,void>) to handle the special case, or by defining a concept notvoid that lets you write template <notvoid T>.  In a language like Rust or Haskell, where generic code needs to specify at least one typeclass to be able to do anything with a generic parameter, void would be excluded as a possible type naturally.
The Type of a Null Pointer (Possibly)
C has never said that the type of NULL must be void*—and some compilers resolve it to a magic keyword instead.  But ((void*)0) is the most common definition in C (not C++).
First, modern languages usually don't have null pointers at all.  C.A.R. Hoare, who invented the concept, called it his "billion-dollar mistake."  It's a lot more than that today.  Modern languages typically give success and error values different types, so that attempting to use an error code as a reference becomes a type error.
A possibly-invalid reference should be an option type.  A constant representing an invalid machine address should be a pointer-sized integer.  A valid reference to no valid object might be a reference to the bottom type.  You shouldn't attempt to shoehorn a reference to a unit type into this role just because C does something similar, any more than you should assume that in and on are the same in English because some other languages uses the same word for both, or that some other language has one word for you.
Comment: Tiny nitpick, while Hoare did invent nulls in the '60s, he didn't *say that line* [until 2009](https://www.infoq.com/presentations/Null-References-The-Billion-Dollar-Mistake-Tony-Hoare/)
Comment: @AakashM While I liked the joke, I don't want to spread any misinformation. So, removed.
Comment: C++11 (I think) replaced the `NULL` macro with a `nullptr` keyword, with the type `nullptr_t`, which is convertible to, but distinct from, `void*`.
Comment: @dan04 Even before that, GCC 4.9.2 [had introduced `__null` as a magic keyword in G++,](https://gcc.gnu.org/onlinedocs/gcc-4.9.2/libstdc++/manual/manual/support.html#std.support.types.null) and Scott Meyers had written a widely-cited `nullptr_t` template in his book *Effective C++*. However, I see that GCC on many platforms does still define `NULL` as `((void*)0)`.
Comment: Nullability, optionality, whatever you name it. As long as it is not the default and universally applicable (including stackable), it's fine.
Comment: There is another option for the type of a null pointer. Let's say pointers in our language are represented as a parametrized type named `Ptr` which we can use like `Ptr`. Then, we can give `null` the type `forall A. Ptr`. Of course, whether null pointers should exist at all is a separate question.
Comment: @DavidYoung Isn't that a reference to the top type? I'd normally expect the type checker to allow a value of that type to be used as any kind of pointer, which I would not want.
Comment: @DavidYoung I do suggest that as a solution for a generic reference. I would recommend against it as the type of an error code.
Comment: @Davislor What I mean is if you want the kind of setup like C where `null` can be used for any pointer type. Also top types are not necessarily what I mean here. I am largely talking about a system without subtyping (in the usual sense anyway). I'm not sure what you mean by an error code. `null` does not necessarily indicate an error. In fact, `null` is really the *only* value that (potentially) makes sense to have with that type since such a value would need to be able to be used at any pointer type (assuming you aren't allowed to cast a integer literal to a pointer or something like that).
Answer: An advantage of having a unit type instead of a void type is: unit is a regular type that functions normally, whereas void is weird and creates special cases.
Consider C#: they have void instead of unit, and when you want to write a wrapper for a function that returns a value, you have to write it twice:
    // normal function
    T Wrap<T>(Func<T> f)
    {
        Console.WriteLine("Calling the wrapped function...");
        return f();
    }
    // special case to handle void
    void Wrap(Action f)
    {
        Console.WriteLine("Calling the wrapped function...");
        f();
    }

If C# had chosen unit instead of void, you would simply call Wrap<Unit>() with a Func<Unit>. void and also Action would become unneeded.
Comment: Is this a duplicate of my answer?
Comment: As Java successfully used `Void` in its generics I'm surprised that C# made it worse.
Comment: I believe in C++ it's legal to write `return f();` if `f()` is template-dependent and is of type `void` when the templates are filled in.
Comment: It doesn't need to involve templates. `return f();` where `f()` returns `void` is perfectly legal C++. The same holds for C. I am not sure why C# decided to make it more cumbersome in this aspect. See the answer by @abel1502 for details.
Comment: They both kinda make the same point, yes. I guess you win because you posted 3 minutes before me. But I think my example is clearer.
Answer: Type Theory
It's never a bad idea to start with some theory. In programming language theory, a type is akin to the set of values that instances of the type can take.
Some types are a finite set: a boolean has 2 values, a 32-bits integer a little over 4 billions. Others are an infinite set: strings, lists, etc...
Empty and Unit are very different there:

Empty: no value, the empty set.
Unit: one value, a singleton set.

Unit types and Empty types in the wild
First of all, unit types just exist. Even in C!
A struct with no field, or similarly a tuple or any other product type with no field, is a unit type. An array of 0 elements is a unit type. You can create a value, and all values are equivalent.
Similarly, empty types just exist. Even in C!
A union with no field, or any other sum type with no alternative, is an empty type. You cannot create a value.
Unless you go out of your way to forbid them in a language, they emerge spontaneously.
No value?
This is correct, an Empty type cannot be instantiated.
This has several implications:

A function taking an Empty type as argument can never be called.
A function returning an Empty type... actually will never return.
A generic sum type with an Empty type in some alternative will never have an instance of that alternative.

Empty types are very useful markers, allowing to cull away execution paths that cannot exist. This is useful for communicating intent to other humans and tools alike.
For example, let's have a look at the definition of abort in C++ and Rust:
[[noreturn]] void abort();

fn abort() -> !;

C++ requires a dedicated attribute, which is only usable in return position, and doesn't mesh well with meta-programming.
Rust, on the other hand, treats ! as just another type1. It can be used everywhere a type is expected, it's accessible via meta-programming, etc...
1 Ahem, well, it's not quite just another type yet.
What of C's void?
C's void is a strange beast, behaving at times like a unit type and at times like an empty type.
When denoting the parameters or return type of a function, it doesn't denote a function that cannot be called, or will never return, so is somewhat like a unit type -- except there is not really any value.
Still, it's a bit weird:
void foo(int);    //  One argument.
void bar(void);   //  No argument, of course!

Yet, no field of type void may exist in a struct or union, and no variable of type void may be declared. The latter, notably, means that direct chaining of return values is possible, but attempting to do so in two steps is not:
void foo();

void ok() {
    return foo();
}

void error() {
    void v = foo();
    return v;
}

Code generation, whether with external tools or macros, and in C++ templates, particularly suffer from this "special case".
Uniformity, Regularity
It's easier to shun C's void, and properly use unit and empty types instead.
It's easier both for the compiler writer and for the user, because it eliminates special cases!
From the user end, more specifically:

The less "special cases", the easier it is to learn a language.
The less "special cases", the more "brain cells" available for actual problem solving.
The less "special cases", the less issues in generic code.

The only cons, really, is unfamiliarity for people who have no been exposed to the concept previously... and they'll be converted quickly once they realize how much it simplifies their life.
Regrets
I remember reading that Anders Hejlsberg, the creator of C#, infamously regretted the irregularity of void in C# due the difficulties this introduced in generic code.
I cannot find a citation, but I can point at TypeScript -- his next brainchild -- where he kept void, but made it more regular instead. You can have variables of type void in TypeScript, though they can only be of value undefined.
Still named void, but not quite like C's void.
Comment: @KarlKnechtel: It doesn't entail it, but it creates a corner case -- a difference between functions that return values vs functions that don't -- which makes the life of users more complicated in "generic" code, be it code generators, macros, templates, generics, ...
Comment: "A function returning a Void type... actually will never return." Why couldn't it just be unusable in expressions, the way C's actual `void` actually works? Why does the lack of a return value prevent `return`ing, if the code is not permitted to *use* the missing return value?
Comment: @KarlKnechtel: To return a value, you must create it. A value of a Void type cannot be created, hence you cannot call return with it.
Comment: @Seggan-OnStrike: Your question asks about unit vs c-void. This answer explains what unit types and empty types are, which should make it evident that c-void is a weird mix of both, sometimes behaving like a unit type (you can return it) sometimes like an empty type (you can't create a value of it, nor a variable with its type). If it's not as clear as I hoped, let me know what you're missing and I'll try to clarify it.
Comment: @MatthieuM. That isn't the question. Why does returning from a function entail returning *a value*?
Comment: "An array of 0 elements is a unit type. You can create a value, and all values are equivalent". Both for the empty struct and an array with 0 elements, this claim is not true in C. `malloc(0) != malloc(0)` is perfectly acceptable in the standard (the behavior is implementation defined), same goes for two statically allocated arrays of size 0. This violates the usual definition of a unit type.
Comment: @Voo: `malloc` does NOT create an instance of a unit type, it allocates (raw) memory.
Comment: @Matthieu I don't think C uses the terminology of "instance of a type" in the standard, so it's probably open to interpretation what that'd be. But in any case even for the alternative `int x[0]; int y[0]` case those won't compare equal either.
Comment: @Voo: They do, as in `memcmp(x, y, sizeof(x)) == 0` (https://godbolt.org/z/jWebnWra9). As for "instance of a type", note that this answer starts with _programming language theory_, talking about programming language _in general_. Indeed, the section you talk about mentions _tuples_ and there's none in C.
Comment: @Matthieu The part that I cite is about the claim that _C_ has a unit type, so clearly it's about C. But yes if you define equivalence in C in terms of memcmp then that should work. But then that also works for malloc(). Although usually equivalence classes are defined in terms of the relational operators - otherwise, every language can have a unit type.
Comment: But I'll freely admit that I was in a nitpicking mood, mostly because the missing Unit Type in C# just caused me troubles the last few days again.
Answer: Generic callback arguments
Consider a function with a generic type argument, such as the resolve callback to a TS Promise:
let x = new Promise<T>((resolve, reject) => {
    // resolve has type (T) => void
});

If void is not usable in generic types, as in Java and C#, these have to be special-cased. And indeed they are: C# has different types Task and Task<TResult>. Having a first-class unit type makes library code like this simpler and less redundant.
On the other hand, if (as in C) an argument list of (void) means "no arguments", this becomes easier on the caller. To call a function of type (Void) -> Void in Swift requires an extra pair of parens, foo(()), which just serves as visual noise.
Answer: I'd say there is no con to having a unit type. Even C++, while inheriting void from C has a unit type standardized in the form of std::monostate. Moreover, even with void, C and C++ allow constructs like:
void f() {}

void g() { return f(); }

So really, I'd say void type is merely a slightly restricted version of unit type. If your language has some custom weird behaviours related to void (like forbidding its use in structures, perhaps), you may, in the worst case, extend them to the unit type too. Regardless, the users will probably appreciate the increased generality.
Comment: Though C++'s `void` gets hairy when you try to assign the result of a `void` function to a local variable temporarily. It's really easy to make a template function accidentally stop working when `T = void` by changing something trivial like that; trust me, I've been there.
Answer: It could make sets a special case of maps. That is, std::map<T, void> works very like std::set<T>. In a theoretical new language we could make the way we use both of them identical.
I don't know a case that makes it obviously useful except for writing less code implementing both of them, though.
Comment: @Longinus I don't think it works in C++. At least it doesn't compile in g++. The point is if void was a unit type, this could easily be supported, as something in the pros list. (Also, the downvoter has reversed their vote after my edit.)
Comment: That is an example of a unit type though. That it works in C++ is because C++ special-cases this particular use.
Comment: Ah I see, I misunderstood what you wrote. _(Also why did I believe C++ allowed that? I don't know)_
Answer: In some contexts, void means that the function might have a return value, but the caller isn't supposed to use it. Consider this in Typescript:
function doSomethingAndThen(callback: () => void) {
    doSomething();
    callback();
}

In Typescript, it's legal to provide a callback which does return something, e.g. () => someArray.pop(), because () => T is a subtype of () => void for all T. This is convenient for the programmer, to not have to write the more verbose () => { someArray.pop(); }. It also allows things like  doSomethingAndThen(somethingElse), where somethingElse is a named function which already exists but has a return type.
This would be unsound if void were supposed to be a unit type like undefined (that is, the unit type whose only member is the value undefined), because the expression callback() would have type undefined despite not necessarily having the value undefined.
So, when void appears in return position like () => void, it is more analogous to a top type like unknown than a unit type. On the other hand, it's more useful to annotate functions as returning void rather than unknown, since the former indicates that even if some value is returned, it is meaningless and shouldn't be used.
Answer: Disadvantage: the language lets you do more silly things. Everywhere there isn't a value, you can treat it as a value and you get some nonsense like unit or (). For example, Haskell is happy to let you store () in a variable and print it.
All else being equal, a language that prevents more mistakes is a better language.
Comment: I don't think this is a disadvantage. Being able to generalise functions that expect to store something, so that they don't actually store anything useful, is a good feature
Comment: Why is it "silly" or "a mistake" to do so?
Comment: @KarlKnechtel What do you expect print(print(42)) to do? I think if you interview 100 programmers who don't already know your language or similar ones, they probably didn't say 42unit or 42()
Comment: That still doesn't explain why it's "silly" or a "mistake"
Comment: @Seggan-OnStrike I shouldn't have to explain why print(print(42)) is "silly" or a "mistake" - it should be readily apparent!
Comment: Languages that remove functionality because it's allegedly error prone are all good until it prevents someone from doing something because they think it's a mistake but in reality they know what they're doing.
Comment: @user16217248 Then I suppose C++ is the only language you use. **Every** other language has gone down the path of removing features to achieve the best power-to-weight ratio. C++ is the only language which focuses on adding many features to achieve the most raw power.
Comment: @user253751 Well technically I use C more but yeah basically. I think C++ is great.


What Oil thickness is used for the geared turbofan jet engine gearbox

Question: In light of the huge operating speed of the geared tubofan gearbox gearing down the fan speed, what Oil thickness is used for the geared turbofan jet engine gearbox and does it use use regular gearbox oil used in cars and trucks, also in light of the huge difference in operating speeds of these gearboxes?
Answer: The more regular specification for such oils is given for the viscosity in centistokes versus temperature, as an example the Mobil Jet™ Oil 387 lubricant that can be used on Pratt & Whitney PurePower® Geared Turbofan™ PW1900G engines has a viscosity of about 5 cSt at 100°C, and about 25cSt at 40°C
Other parameters are extremely important such as the flash point temperature, the fire point temperature and the autogenous ignition temperature
Also the Total Acid Number is an important parameter for engines oil.
Please refer to the following website for more details about above mentioned oil specifications.
https://www.exxonmobil.com/english-US/Aviation/pds/GLXXMobil-Jet-Oil-387
Comment: Thank you for the answer
Answer: I don't think oils for this application are classified by weight. The specification for Mobil Jet Oil II, for example, which is one of the approved lubricants for this application, is quite a bit more complex.
Comment: Thanks for the answer


How much unit-testing before start coding a method/class?

Question: I´m starting (trying at least) to do coding using TDD principles and I have this question: how much tests do I need to write before actually start coding?
Take for example a hypothetically Math class and a method Divide(int a, int b).
a) Do I have to fully test all methods of Math class (Sum, Average, ...) before start coding Math?
b) Do I have to fully test the Divide method, asserting for example for division by zero, before start coding the method?
c) Or I can create a simple test assertion and verify that it fails, write the code and check that it´s OK, reapeating the process for each of the assertions of a method?
I think the option c) is the correct, but I couldn´t find an answer to it (I did some searchs but couldn´t find a definitive answer).
Comment: TDD purists would certainly not advocate coding the entire behavior of the method first.

One failing test at a time.
Comment: Test-Driven Development is very much about design, so if you have to ask, I would suggest that you need to know more about design principles. You can red-green-refactor all day long, but without a good grounding in design, you will eventually code yourself into a corner.
Comment: TDD is not about making "one assertion" pass either (which is what *c)* is explicitly mentioning).
Comment: @Robert: You're right, I need to improve my software design knowledge. Until now I've programming in a "loose" way, but I'm trying to program in a better way. Thanks.

@Pascal: TDD and unit-testing are not a clear concept to me, I probably have mixed up in the text. Sorry for this :)
Answer: Your option c represents fully by the book TDD.
You write one failing test exercising a feature of the class that you are working on and then write only enough code to make that test pass. Then you do this again, for the next test.
By doing it this way you should then see each new piece of code you write being very focused upon a particular use-case/test and also find that your tests remain distinct in what they cover.
You want to end up working in a red-green-refactor fashion, so that periodically you go back over both your code and your tests for places where you can refactor things into a better design.
Of course, in the real world you may end up writing many red tests, or writing more code than a particular test requires, or even writing code without tests, but that is moving away from TDD and should only be done with caution.
The wikipedia article on this is actually quite good. http://en.wikipedia.org/wiki/Test-driven_development
Comment: I'm a little ashamed that I didn't find this link before. I was leaning toward c) as stated in my text, but I wanted to be sure. Sometimes it's difficult to do the tests before any coding, but I think I'll get used to. Thanks :)
Answer: The first thing you want to do is write a specification for each method you want to implement.  In your specification, you need to address as many corner cases as you care about, and define the behavior your method should result in when executing those cases.
Once your specification is complete, you design tests for every part of your specification ensuring that each test is not passing or failing due to corner case conditions.  At this point you are ready to code up your function implementation and tests.  Once this is complete, you refine your specification/tests/implementation as necessary until the results are exactly what you desire from your implementation.
Then you document everything (particularly your reasoning for handling corner cases).
Comment: +1: This is something I need to improve: write a specification for a class (what it will do) before start coding.
Comment: +1 for writing a specification, or at least knowing what the shape of your class is going to look like before writing tests.  I don't know why more TDD'ers don't talk about this.
Answer: Like others have mentioned, your option c would be the pure TDD way to do this.  The idea is to build your code up in small red-green-refactor increments.  A good simple example of this is Robert Martin's Bowling Kata.
Answer: Well You can probably write
@Test
public void testDivide() {
   Math math = new Math();
   int result = math.divide(20,2);
   Assert.assertNotNull(result);
}

That's it, now when you run this your test will fail so you fix your Math.divide method. and add cases in the next step
this is a very ideal way but everyone knows it's not always this way.
Comment: You might want to add a test to confirm that 20/2=10.
Answer: The definition of "unit" is not universal, sometimes the unit is the class, sometimes it can be a method. So there is no real universal answer.
In this particular case, I would consider the unit to be a method so wouldn't not all methods before to start coding. Instead, I would do things incrementally, methods after methods. This eliminates a).
However, when writing a test for a method, I would write a rigorous test i.e. I would test the passing and the non passing cases, test at the limits, test the special values, etc. When writing a test, you're defining a contract and this contract should include exceptional situation. Thinking of them from the start do help. And for me, the point of having a green light is to be done so I want my test to be exhaustive. And I think that this is b).
If your test is not exhaustive, then you're actually not done with your unit even if the test is passing and I don't really see the point. I guess that this is c).
So my choice would be b).
Answer: If you are going for completeness you should design and code your unit tests prior to development and then develop the primary functionality to the created unit tests.  The more thorough you are the clearer the scope and better the final quality.  If time and functionality allow, I would create tests for each method/function.


At the end of the Hobbit, if Strider was already a Ranger, how come he still looks that young in Fellowship of the Ring?

Question: I didn't read the books (obviously), so I am kind of confused. Do Men live that long in Tolkien's world? I know Gandalf is supposedly an old-timer as well, but he's a wizard so it kind of doesn't count :D
Comment: The movies altered the timeline.  The below answer is correct, but Arargorn should not be a ranger during or immediately after the Hobbit (he should be a 10 year old kid).
Comment: Can't add an answer anymore, but if you're referring to the line mentioning him at the end of Episode III, the movies indeed messed with the timeline. The book's 17-year gap between Bilbo's party and Frodo leaving the Shire didn't happen, so in movie time the bulk of LotR occurs "only" 60 years after The Hobbit. That would put Aragorn at age 27-28 at the time of this reference, plenty old enough to have been a reputable Ranger.
Answer: The high men, who befriended the elves in the First Age and fought against the first dark lord Morgoth, were gifted with long lives.  Aragorn (who was descended from the royal house of the high men) was 88 when he was crowned king, and he lived for a further 122 years after that.  That was a fairly typical lifespan for a pureblooded man of the West in the Third Age, although his ancestors had lived to even greater ages.  Elros (Elrond's twin brother, who opted to be a man rather than an elf) lived to the age of 500, ruling as the first king of Numenor for 442 years.
Other men did not enjoy these extremely long lifespans.  By the end of the Third Age, even in the realm of Gondor, most people of Numenorean descent had interbred extensively with the low men, shortening their lifespans.  It is noted in The Return of the King that even living past 100 was growing uncommon except among the more pureblooded Gondorian nobility.


How to make Unity game moddable with scripting in a friendly way?

Question: I am building a game in Unity using C# and visual studio. I want to make it possible for users to write code in some scripting (for modding purposes) without necessarily opening the source. What are my best options?
I'd prefer well-supported and battle-tested options that integrate well with Unity and visual studio, but I am willing to do a fair amount of work myself as long as it makes scripting as seamless as possible for future modders.
Answer: A somewhat blunt approach would be to let modders write C# code and then have your game read & compile those scripts, using them as though they were code the game was built with.
This has some advantages:

Modders can use the existing Unity API, so it's already familiar to many, with extensive documentation and tutorials.
It's very fast to get up and running, exposing a very large feature set, with very little API development or supporting code you need to provide.

...And some disadvantages:

The exposed feature set is very large, roughly everything C# can do. As described in the linked answer, a modder with this kind of access can do basically anything they want to your game. I don't know any ironclad way to lock them out of particular functionality or constrain what they can mod once you've let them execute arbitrary code.
This means that installing a mod written by a stranger requires a high level of trust. They might have coded-in spyware, or other malicious content, so your game can be used as an attack vector against unwary players. Not necessarily a situation you want to be in.
As described in the linked answer, compiling at runtime is not supported on all platforms Unity can target, and requires additional plugins on some.

A more robust solution, as mentioned at the link, is to build your own virtual machine — using eg. The Bytecode Pattern — so you can execute scripts you've loaded as data at runtime, with strict control over what they're allowed to do.
Answer: You could do it like Kerbal Space Program does it: Allow your game to load AssetBundles at runtime by having it read config files which tell it where and in what way the assets in the bundle are supposed to appear in the game.
Then tell your modders to get Unity Personal Edition and use it to build their mod as one such asset bundles with an appropriate config file. You might need to open source some of your interfaces and offer them as a "mod SDK" asset bundle for your modders in order to interface properly with the rest of your game.
This method has the advantage that your modders can do anything Unity can do, which is a lot of nice stuff. But unfortunately, this method has the disadvantage that modders can do anything Unity can do, which also includes a lot of malicious stuff. So you need to educate your players to not download any mod they find.
If you want more secure modding, then you need to invest some more work. A good method to properly sandbox mods is by using a scripting language which allows you to selectively expose certain functionality of your game. You could write it yourself, but designing a good programming language and writing an interpreter for it is much more difficult than it seems. A better solution can be to use an existing scripting engine. There are scripting engines for C# available for pretty much any well-known scripting language.
Answer: As more advanced and more powerful alternative you could try using either MAF or MEF frameworks for C#. Among other things it handles for you automatic mod discovery, runtime loading and unloading, controllable security and improves stability (can run in separate domains).
The downside is that designing addin-aware architecture is much harder than simple compiling text file. While powerful it also imposes some requirements on loaded code as it is made primarily for plugin/DI systems which you might find too restricting - or ideal, depending on what are the mods supposed to do/add/modify.


Lorentz force, must there be two magnets?

Question:
The diagram above demonstrates the Lorentz force, Yet I wonder... must there be two magnets/electromagnets?
If the two magnets form a magnetic field of $1$ $Tesla$ acting on the wire, why not use 1 magnet and make the wire really really close to it. So that the gap would be 0. Will $B$ still be valid based on one magnet?
Answer: Let us take a bar magnet and place a current carrying wire very close to it as shown below

The magnetic field in that region of space( very close to the wire and thus the magnet ) can be treated as a uniform field( approximately ).

Now, the charges within the current carrying wire experience a Lorentz force given by
$$\vec{F} = q(\vec{v}\times\vec{B}) + q\vec{E}$$
Let us see how

Consider an electron moving within the wire. This electron would experience an electric force due to the presence of an electric field inside the wire and a magnetic force due to the magnetic field created by the magnet outside the wire. So, you need not have two magnets to produce a Lorentz force. However, having two magnets would enhance the strength of the magnetic field and thus the magnetic force. Also, having two magnets would better ensure the presence of a uniform magnetic field unlike in the case of a single magnet. I conclude by saying that Lorentz force will act on the charged particle even in the presence of a single magnet because all we need is an electric field and a magnetic field( which is created by a single magnet ).
Also, you need not place the wire close to the magnet. You can place it at a considerable distance from the single magnet. In this case, you will have a non-uniform magnetic field in space. Nevertheless, a Lorentz force will continue to act on the charged particles within the current carrying wire( the magnetic force will vary from point to point ).
Answer: If you use single magnet and remove the other magnet in your experimental set up shown in figure of your question, the magnetic field B would not remain in the expected direction. In your case, using two magnets, you can have the direction of B perpendicular (approx) to the straight current carrying conductor (see the picture).

You can also use single magnet and keep it close to north or south pole so that magnetic field remains perpendicular to the straight conductor, as explained in the other answer, but there you are going change the placement of the magnet, thus area of the magnet facing the conductor decreases.


Why doesn't $v_T = \omega r$ involve the direction of its variables?

Question: We derived $v_T = \omega r$ by the following procedure, and it's said that $v_T = \omega r$ "is a relation between the magnitudes of the tangential linear velocity and the angular velocity". Why doesn't the formula involve the direction of its variables?

We first define
Answer: The direction is implied to be in the $\hat{\phi}$ direction because it is assumed that (eq 8-9) $r$ is not changing with time. Moreover, it's not really implied since it's the tangential velocity and so is in the tangential ($\hat{\phi}$) direction.

To clarify, let's work with an object spinning in a circle in two dimensions, to keep things simple. A point at distance $r$ in the direction $\hat{r}$ is given by
$$\mathbf{r} = r \hat{r}.$$
where $\hat{r} = \cos\phi \hat{x} + \sin\phi \hat{y}$. The time derivative of this point is given by
$$ \mathbf{v} = \frac{dr}{dt} \hat{r} + r \frac{d\phi}{dt}\hat{\phi} $$
By definition $\frac{d\phi}{dt} := \omega$. Now since it is assumed that $dr/dt = 0$ we are left with
\begin{align}
\mathbf{v} &= r \omega \hat{\phi}\\
&=r\omega (-\sin\phi\hat{x} + \cos\phi \hat{y}).
\end{align}
for the full vector description.
Comment: Would you mind explaining why $\hat{r} = \cos\phi \hat{x} + \sin\phi \hat{y}$? I'm a beginner to this topic, so my knowledge isn't very adequate.
Answer: Suppose we have a rigid object rotating at some angular velocity $\vec{\omega}$ about some fixed axis.  It can be shown that in general, $\vec{v} = \vec{\omega} \times \vec{r}$, where $\vec{r}$ is the instantaneous position of the object.  This more general equation does take the directions of the quantities into account via their cross product.
However, it is common (particularly in introductory physics texts) to consider only the case where $\vec{\omega}$ and $\vec{r}$ are at right angles to each other.  In that case, this equation simplifies to the version you have.  Recall that the magnitude of a cross product is $|\vec{A} \times \vec{B}| = |\vec{A}||\vec{B}|\sin \theta$.  This means that if $\vec{r}$ and $\vec{\omega}$ are perpendicular to each other, then we have $\theta = 90^\circ$ and
$$
v = |\vec{v}| = |\vec{\omega} \times \vec{r}| = |\vec{\omega}||\vec{r}| \sin \theta = \omega r.
$$


Can anyone provide documentation for the 2011 chevy cruze eco grill shutters?

Question: I'm trying to understand how they work and where the motor is since I am unable to get the plastic off the bottom of the grill to access them directly. Mine seem to move if I slowly torque them directly, but they are not actuating on their own and its constantly popping the P069E code from the Fuel Pump Control Module.
Comment: I don't have the workshop manual, but you might find one - online possibly.
Answer:
Active Grille Shutter:

How does the Active Grille Shutter work?
Purpose of the active grille shutter?

The active grille shutter assembly accomplishes three things:

Improves aerodynamic efficiency at higher speeds by forcing airflow over the hood,
Improves emissions by blocking airflow across the radiator at cold startup to speed up engine warm-up, and
increasing passenger comfort by blocking airflow across radiator to improve coolant heat retention.

As carmakers downsized engines to improve fuel economy they ran into a problem with cabin heat. Smaller engines require less coolant, so in cold weather that coolant cooling couldn't provide enough heat to warm cabin occupants and keep the engine at full operating temperature. To remedy the situation, car makers install an active grille shutter assembly in front of the radiator to reduce airflow and increase coolant heat retention.
When the active grille shutter operates the ECU controls the active grille shutter operation. It closes the shutter when it detects low cooling and A/C loads the engine cooling system doesn't need high airflow. In some makes, the shutter is controlled by the fuel pump control module. In other words, high fuel pump loads automatically dictate high speed and that opens the shutters.
The shutters remain closed at engine startup and in cold weather.
Ref: https://ricksfreeautorepairadvice.com/active-grille-shutter/
Comment: You should have just edited your original post. You also should reference your information if pulling it from another source. I'll put the link in this answer and delete the other one for you.
Comment: This doesn't answer my question because it is just generic information. I am looking for information specific to the 2011 Chevy Cruze Eco. On the eco, active grill shutters do not block the main opening on the radiator, but a smaller grill closer to the road. It is for air damning purposes however I am looking for specifics about when the grill opens and closes(temp ranges) and preferably some mechanical diagram what the location of the motor and wiring which I don't have in any aftermarket manual. On the eco, its controled by the fuel pump control module in the trunk.


Cannot open a .air file even with Adobe AIR installed

Question: I douwnloaded a .air file (designview.air, to have a design viewer for flashdevelop). Also I have installed Adobe AIR, but still i cannot open this file. After the installation setup is finished i don't have any interface with the adobe AIR nor put it as the predefined program to open a .air file. Any solution to this problem?
Answer: Try to right click on the air file, and select open file with. In the window, click on browse, and navigate to the installation of adobe air. Make sure the box is checked for always use this program and then hit ok.
This site may help with the installation location. LINK
Answer: The problem was the way of installing .air files. As generally done in windows i expected that Adobe AIR would have a GUI interface, which don't. The way to install a .air file is to look the folder where Adobe AIR is intalled and run an exe that is called Adobe AIR Application Installer.exe. This will launch the GUI to intall a .air file.
Answer: I looked all over for a solution for not being able to open a .air file on a Mac Pro. I kept getting a message saying it was an incorrect file type. I reloaded Adobe Air, I re-downloaded the .air file. Nothing helped. The simple answer was to go to the .air file - it happened to BE in my Download folder - and, instead of double clicking on it as I had been doing, Right Click, then use the Open With, Other, and locate the executable file called Adobe AIR Application Installer. The .air file ran beautifully. Thanks to Restro Fad for getting me most of the way there.


How can I force Windows 7 to update the user profile path?

Question: I renamed a user profile to a new name. This worked but when I look into the folder path, the old name is being used. Why? And how can I make the folder pathname the same as the new name?
Answer: Just fyi, there is a GUI to make the creation of symbolic links easier - symlinker

With this utility you can use the
  symlink application Microsoft Windows
  has well hidden inside the cmd.exe
  app.
The goal is just make it easier to
  create symbolic links, hard links, or
  directory junctions, using a pretty
  simple interface, so no more bogus
  command line to do it...
This application needs .Net Framework
  3.5 to run (SP1 recommended)
Comment: +1 That's my answer, only a lot easier!
Comment: True, I wanted to post this as a comment to your post, but I didn't have the required reputation for that.
Answer: This might work for you:
It let's you relocate your user profile. So you simply relocate it to a folder that has the name you want it to have and it will replace the old name.

Microsoft supplies a tool mklink
  which can create a symbolic link under
  Windows 7 just as the command ln under
  unix/linux. Below is an example about
  how to put user data on in a
  non-system folder using mklink in
  Windows 7.

Enable administrator account and set a password for it. You can refer How
  to enable or disable administrator
  account in windows 7
Logoff and login with administrator account
Relocate your user data to other non-system partion, for example from
  C:\users\J  to D:\users\J
Use mklink to create a symbolic link from C:\users\J to D:\users\J
mklink /D C:\Users\J  D:\users\J
Re-login use your own account,you will find nothing changed, but in fact
  your physical user data is on drive D.
Done. The next time you re-install your OS, just use the same user name,
  remove  C:\users\J then run the
  command of step 3 again then your user
  data is back.
Comment: Accepted answer and +1 and +1 credit to Om Nom Nom as well for GUI. I'm hoping I can use this answer for the following: started with admin user/profile BOB with folder C:\Users\BOB. Had a strange profile won't load error when trying to login one day. So had to create new admin profile/user ROB with folder C:\Users\ROB and copy BOB's data over. Renamed ROB in Windows user management to BOB but folder path remained same i.e. C:\Users\ROB. So I'm hoping I can use your answer to get it back to C:\Users\BOB.
Comment: Hope it helps!!
Answer: try just CMD> gpupdate /force to update the user rights


How do I handle an unused light fixture junction box in a bathroom?

Question: I am in the process of adding a 3/4 bathroom to the upper of my house. The plumber just finished the rough in and all framing is complete. I am now looking at the electrical and I have a issue.
There are two lights on a three way switch, but one of these lights falls inside my new bathroom in the wrong spot so I need to eliminate it. I plan on a new ceiling light but it needs to be in a different location.
Can I eliminate the light then do what I need to do to the wires (cap),
put the wires back in the box, and then put a cover over the box leaving it visible? I will not bury the box or hide it or conceal it. The bath will have its own separate circuit when I am done.
Answer: Since it sounds like you have a major remodel project in process you probably have all the walls open too. The very best bet for the discontinued light would be to remove the circuit and electrical boxes entirely. This way you do not need to keep an ugly do-nothing electrical box cover on your wall or ceiling.
Keeping an unused electrical box accessible can be an extra burden if you are trying to put tile on the wall or finish a ceiling. Remove it and eliminate those PITA points.
Answer: Yes, that sounds like the correct plan -- just use wirenuts to cap the wires off (as if you were making a connection with them, but with only the wire being capped off included).
Also, make sure the box isn't in the "wet zone" (aka above the tub/shower) -- indoor-type junction boxes are dry-location only!


Why can't I declare a friend through a typedef?

Question: Does anyone know why typedefs of class names don't work like class names for the friend declaration?
class A
{
public:
};

class B : public A
{
public:
   typedef A SUPERCLASS;
};

typedef A X;

class C
{
public:
   friend class A;             // OK
   friend class X;             // fails
   friend class B::SUPERCLASS; // fails
};

Answer: It can't, currently. I don't know the reason yet (just looking it up, because i find it interesting). Update: you can find the reason in the first proposal to support typedef-names as friends: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2003/n1520.pdf . The reason is that the Standard only supported elaborated-type-specifiers. It's easy to allow only those, and say if the entity declared as friend is not declared yet, it will be made a member of the surrounding namespace. But this means that if you want to use a template parameter, you would have to do (a class is required then for example)
friend class T;

But that brought additional problems, and it was figured not worth the gain. Now, the paper proposes to allow additional type specifiers to be given (so that this then allows use of template parameters and typedef-names).
The next C++ version (due to 2010) will be able to do it.
See this updated proposal to the standard: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1791.pdf . It will not allow only typedef names, but also template parameters to be used as the type declared as friend.
Answer: AFAIK, In C++ typedef does not create a full-fledged synonyms when used in conjuction with classes. In other words, it's not like a macro.
Among the restrictions is that the synonym cannot appear after a class or struct prefix, or be used as a destructor or constructor name. You also cannot subclass the synonym. I would bet that is also means you can't friend it.
Answer: I tried in the VC++ 8.0 the code:
...
class C
{
public:
  friend class A;
  friend X;
  friend B::SUPERCLASS;
};
...

It is compiled without errors.
I am not aware whether it MS specific or not.
Answer: A typedef defines a type. Friend decls declare friend classes or functions (substantially scopes), which then have "access" to the non public area of the declaring class...
Primitives, i.E. a float or an int* don't define a scope with code etc.,
they don't "use" the class anyway.
Don't forget, you can also "pack" call conventions, alignment attribs and other compiler specific stuff in a typedef, i.e. multiple vector TYPES implemented by the same class but with distinct alignment attribs. => A type is not a class, but vice versa.
IMHO, declaring a friend typedef can be useful, but when "class typedefs" from anywhere can be set as friend, the friendships can become extremely incomprehensible and therefore error-prone, especially where templates are used excessively.
Invalidating a single typedef can mess up the whole project due to widespread dependencies.
Template friends and the 0x template typedefs are useful, but don't relax the rules of a friend declaration.
I don't know of any proposal concerning friend typedefs.


Permission issues in TortoiseSVN on SAMBA share

Question: I have spent a full day troubleshooting this issue and am truly desperate now.
Windows 10 is my main machine, and within it, I run a Debian VM that I use as a full Linux web stack. The Linux VM runs an SVN server, which in itself works just fine. On my Windows 10 machine (local drive) I can checkout and commit. I do it with the only user that I have configured in SVN.
That's not my use case though. What I want is to use my Windows IDE to directly manipulate files on the Linux server. I access said files via a network mapping.
I've installed SAMBA on the Linux VM to make that possible. And this in itself also works. I can access the network mapping and have full control over all files on it. The authorization setup is simple: I have a group @fileadmins to which I added my personal user, root, and www-data (for Apache). To keep this situation simple, however, for now I'm doing everything under the root account.
Now for the final part: I like to put working copies on that network drive. This way I can directly manipulate the files, as well as do commits, seamlessly from Windows using TortoiseSVN. I know that this scenario is not recommended, but note that I am the only user, and this is a very efficient setup. I've been doing this for personal projects for many years, on previous servers.
For some reason, I cannot get it to work this time. Here's the error I'm getting, for example when doing a first checkout of a repos:

Can't move 'W:\jd5.svn\tmp\svn-5FDD2730' to
  'W:\jd5.svn\pristine\18\185e98e0088e20d84a5dfaaee60a22f73658439a.svn-base':
  Access is denied.

From people with similar problems, I've learned that TortoiseSVN is creating these SVN-specific files on the fly with a specific set of very limited permissions, meaning as readonly, and with limited Linux file permissions.
Almost all answers therefore focus on configuring Samba to force higher permissions on newly created files (such as those created by TortoiseSVN). Here is my current samba config file:
<code>[projects]
comment = web apps for users in group *fileadmins*
path = /var/www/apps
valid users = @fileadmins
create mask = 0777
directory mask = 0777
writable = yes
force create mode = 0777
force directory mode = 0777
write list = +@fileadmins
delete readonly = yes
read only = No
</code>
As you can see, I'm leaving permissions wide open, intentionally, just to get something to work. If I now from Windows create a new text document manually on the network drive, it will have the above permissions applied to them, so that works.
The files created by the TortoiseSVN client, in particular the ones it is complaining about, are as follow:

.svn/tmp (group: fileadmins, owner: root, permissions: 0777)
.svn/tmp/svn-5FDD2730 (group: root, owner: root, permissions: 0777)
.svn/pristine (group: fileadmins, owner: root, permissions: 0777)
.svn/pristine (group: fileadmins, owner: root, permissions: 0777)
.svn\pristine\18 (group: root, owner: root, permissions: 0777)

From the looks of it, root has full access to all files, and I'm using the network drive as user root. I assume TortoiseSVN runs under the same account.
The only weird thing about the above is that some files have root as their group. I tried to force a group via Samba settings, but that led to an issue that made the whole drive unavailable. Either way, as root is owner (as a user), I don't expect that to matter.
From my perspective, I have stretched permissions to the maximum possible, yet I still get permission errors. I am eager to learn what I am overlooking. I have had such a setup working on multiple machines for over a decade, yet am completely stuck on this one.
Answer: I have this problem as well, but found that if I repeat the update process a few times, eventually all files are updated.  I occasionally need to do a clean up as well.
This problem started when I upgraded Tortoise from 1.7.11.xx to 1.9.0.xx
Comment: Thank you for your answer. I'll soon try to downgrade TortoiseSVN, to see if that makes a difference.


interest rate swap: PV01 vs DV01

Question: Bloomberg defines PV01 as PV of adding 1 bps on a fixed coupon , while 'DV01' as (down - up principal) / 2 * bps shift.   The resulting PVs are generally very close but could there be a case where they are significantly different?   Also, with the curve shift, do we shift zero rates?
Answer: In traditional terminology PV01 is 'present value of a basis point' and DV01 is 'dollar value of a basis point' which might technically only different in different currencies. I have also seen it considered that DV01 is 'delta value of a basis point'. Bloomberg / and others has decided to bastardise the terminology for different types of curve bumps so I wouldn't place too much attachment to the name. Regardless..
Analytic PV01
What I like to call analytic PV01 is when you change the value of the fixed coupon by 1bp and evaluate the impact on the IRS:
$$ P = R \sum_{i=1}^{n_i} d_i v_i - \sum_{j=1}^{n_j} r_j d_j v_j $$
$$ \frac{\partial P}{\partial R} = \underbrace{\sum_{i=1}^{n_i} d_i v_i }_{\text{analytic fixed leg}}$$
where $d$ is day fraction, $v$ the discount factors, and $r$ the floating rates. The notation here is a bit mangled because the i's and the j's might refer to schedules of different frequencies. If fixed leg is annual and float leg is semi-annual then $v_{i=1}$ is equal to $v_{j=2}$, for example.
Note that this is a useful measure for dealers calculating the exact PnL generated by applying a spread (or margin) to a fixed rate away from the mid-market rate.
Real Portfolio PV01 / Delta / (might be called DV01)
If you transact an IRS an you want to know the (linear) risk if the market actually moves this is a slightly different calculation. Above, the discount factors did not change when the fixed rate was varied, but in the 'real' scenario the fixed rate is, well, fixed and floating rates move, so will so you also have to consider that.
If you were to consider what happens if every forecast rate $r_j$ changed in parallel then you might derive the expression:
$$ \frac{\partial P}{\partial r} = \sum_{j=1}^{n_j} \frac{\partial P}{\partial r_j} = - \sum_{j=1}^{n_j} d_j v_j + \sum_{j=1}^{n_j} \left ( R \sum_{i=1}^{n_i} d_i \frac{\partial v_i}{\partial r_j} - \sum_{k=1}^{n_j} r_k d_k \frac{\partial v_k}{\partial r_j} \right )$$
Generally speaking an approximation for $\frac{\partial v_i}{\partial r_j} \approx d_j v_i$ if the rate $r_j$ impacts $v_i$ (i.e. if the rate is before $v_i$) and zero otherwise. If the schedules were the same frequency ($n_i=n_j$) we can ignore the i,j mangling and state,
$$ \frac{\partial P}{\partial r} \approx \underbrace{- \sum_{j=1}^{n_j} d_j v_j}_{\text{analytic float leg}} +\underbrace{ \sum_{j=1}^{n_j} \left ( R \sum_{i=j}^{n_i} d_i d_j v_i - \sum_{k=j}^{n_j} r_k d_k d_j v_k \right )}_{\text{effect of curvature and cashflows}}$$
If the curve is flat, i.e. $r_j = R \forall j$ then the curvature component is zero.
Numerical Calculation
The method Bloomberg uses is to try and estimate the above real PV01, by using a central finite difference method to derive it. Bloomberg knows swaps have convexity so the theory is as follows.
Assume the PnL on a swap is almost its linear pnl plus its convexity:
$$ \Delta P(\Delta r) \approx \frac{\partial P}{\partial r} \Delta r + \frac{1}{2} \frac{\partial^2 P}{\partial r^2} \Delta r^2$$
Then bumping by +1bp and -1bp, dividing by 2 eliminates the convexity element and very accurately approximates the real PV01:
$$ \frac{\Delta P(+1) - \Delta P(-1)}{2} = \frac{\partial P}{\partial r} $$
Another common method of calculation is to use a single bumped curve by, say, $\frac{1}{100}$th of a bp, and scale the result by 100. Although less accurate, since the convexity is marginalised and not eliminated, the calculation is twice as fast, for example:
$$ 100 \Delta P(+\frac{1}{100}) = \frac{\partial P}{\partial r} + \frac{1}{200} \frac{\partial^2 P}{\partial r^2} $$
External Link
You can see an example of rateslib calculating what it terms delta and analytic_delta to replicate the Bloomberg values DV01 and PV01 respectively, https://rateslib.readthedocs.io/en/stable/z_swpm.html
Comment: Is $\frac{\partial v_i}{\partial r_j} = d_j v_i$ in fact exact for continuously compounded forwards? Thank you
Comment: if $v_i = e^{-\sum_{k=1}^{i}d_k r_k}$ where $r_k$ is a continuously compounded rate then yes it is exact.
Comment: but note that definition would change the PV of the swap since a floating leg cashflow does not reference continuously compounded rates

interest rate swap: PV01 vs DV01


Can I use an oversized blade on a radial arm saw?

Question: I have a 10" Craftsman radial arm saw that serves most of my shop cutting needs. However, occasionally I need to cut through material that is just a bit thicker than what can fit under the blade. While in most cases rotating the material and making multiple cuts works, there are some cases where this isn't possible (say, the material is only flat on one side).  In these cases, could I mount a 12" blade on the saw to get a deeper cut depth?  Obviously the existing blade guard wouldn't cover the larger blade and a naked rotating blade would be extremely dangerous, but assuming I made a special guard specifically for the oversized blade, are there other considerations (safety or otherwise) that would prevent this arrangement from working?
Comment: TL;DR: No. Longer answer: No, do not do this.
Comment: I'm glad you're coming around to the notion that this is a terrible idea. Want one more reason? The arbor size doesn't match. (10"=5/8" arbor; 12"=1" arbor.)
Comment: I don't know much, but I have some pretty deep suspicions that, in a situation where the wood don't fit into the space where the saw can cut it, you're probably using the wrong tool for the job....
Answer: Obviously this is questionably safe, even if you can actually fit a 12" blade to your 10" radial-arm saw.

While in most cases rotating the material and making multiple cuts works, there are some cases where this isn't possible (say, the material is only flat on one side).

There's a very simple and safe solution that should work for any situation you might face: complete the cut using a hand saw.
Any situation in which you can cut through a decent portion of the thickness, or better yet cut around an item one side at a time leaving just a central stub of wood, you're well positioned to finish the cut by hand as the kerf formed by a circular blade makes a very good channel for the panel saw to follow without error.
If you don't currently own a panel saw, modern ones are very inexpensive and because of the impulse-hardened teeth they stay sharp for a very long time so they're great value. Additionally such a saw has numerous other potential uses in a modern woodworking shop.
Comment: Not sure why I didn't think of finishing the cut with a hand saw. I've got a fairly decent variety of them, so finding the right one for the job should be simple enough. There are advantages to inheriting a whole bunch of tools from a master woodworker, even if not all of them have been maintained since he died forty or so years ago.
Comment: Fascinating -- when I hear "panel saw" I think of the electric circular saw on a sliding carriage that the lumber yard (or a large enough woodshop) uses to cut sheet goods to order.  I'd never heard it used to refer to a type of hand saw.
Comment: @TimSparkles, understandable confusion on this point given two *completely* different saws regrettably share the exact same name. For those of us who use it to generically describe [a hand saw that isn't a backsaw or frame saw](https://woodandshop.com/woodworking-hand-tool-buying-guide-handsaws/) we can console ourselves that they did have the name first :-) Unfortunately there's further confusion possible as in some naming conventions it refers to smaller/shorter hand saws (~20", but no larger), and in other still it refers to saws of this size but exclusively those filed for crosscut.
Answer: The bigger blade will have more mass than the motor is designed to spin. This could cause issues for the motor, potentially burning it out. This is part of the reason that dado blade sets come in 8" size designed for use in a 10" table saw - you're adding multiple blades where only one normally goes, so by making the blade smaller, you're reducing mass, making it easier for the motor to spin.
If you're cutting a softwood like pine, you'd might be OK, but harder woods that the saw may struggle to cut in the first place would definitely be out.
Note: I say might be OK, because I don't know for certain. I would use extreme caution* if I were to attempt this.

*Note that "extreme caution" means I'd mention it to my wife and she would beat me senseless if I attempted it. ;)
Comment: TBH I would be hope that *extreme caution* here should be read as *don't try it*. Obviously the motor or gearing is at risk as you say, but let's say it does fit and seems to work fine I worry about the arbor. After a given time it seems inevitable a user will have become accustomed to using the larger blade without apparent harm to the saw ("It's never caused a problem before...." kind of thing) and therefore won't be a hyper-vigilant as they were early on.... the potential consequences if it breaks somewhere down the road don't bear thinking about
Comment: Seeing as the wood I need to cut includes some really hard white oak, I'll be putting this down as a bad idea not to be entertained again.
Comment: It's not the *mass* - a 12" blade is cutting 20% further away from the rotation axis, so it experiences 20% more cutting torque for the same blade speed and depth of cut.  This is where the extra load will come from.
Answer: Really no, it's a deadly proposition.
When these blades turn, the centrifugal force tries to tear them apart, so they have a maximum RPM rating which is usually written on the side. Larger diameter means lower RPM. However if you mount the larger blade on your saw, it will spin at the rpm of the motor designed for the smaller one, which means it will spin faster than intended. Best case, the carbide teeth hit the wood at a faster speed than intended, so they could get damaged. Worst case, the blade splits from centrifugal force, and since you removed the guard, you end up with a chunk of circular saw blade embedded in your face.
It would be a good excuse to get a bandsaw though.
Comment: Exceeding the maximum rated RPM seems to be a non-issue. 12" blades appear to be built for the same range of speeds, *and sometimes slightly higher* (e.g. 4000rpm when the saw might only go up to 3400-3500.... assuming it could even spin the blade up to that speed with the extra load, which seems unlikely.
Comment: This is probably the most accurate and succinct answer to the Q
Comment: BTW not having a guard fitted would be a bad day all round, but even with a factory-style guard fitted there's every likelihood it wouldn't provide sufficient protection in the event a saw blade came apart, just as the guards on grinders sometimes do not when a wheel explodes (even on solid old grinders where the guards aren't made of tinfoil).


Why are there no down votes for comments

Question: Why are there no down votes for comments as there are for questions and answers. People sometimes use the comments to give answers as well.
Comment: I mean, if you find a comment something that is not appropriate according to the rules or if they're completely off topic and/or not helpful and you feel the need to want to implement some down vote system for comments, you can always flag the comment to get rid of it completely. (Wow that's a long sentence, sorry about that but it was the best way to explain it haha)
Comment: There has been debates about this: https://meta.stackexchange.com/questions/3615/allow-downvoting-comments. By the way, this kind of questions regarding the way stackexchange works should be addressed on the main meta, because it isn't specific to the electronics site.
Answer: Because people should not give answers in the comment section. Such answers should be flagged and deleted, not downvoted.
Comments on Stack Exchange are an afterthought and essentially a "second hand citizen". As you can see when you try to write one, the clarification iterates that they are for asking for clarification and explicitly not for answering. You can not accept a comment as the right answer, and you can not edit mistakes in it. They can also be removed at any time.
Answer: This is site wide (through all of SE's networks) and is not going to change as it would affect all sites. This has already been covered here in the meta:
Allow downvoting comments


chol hamoed outings

Question: The Halocho rules that, on chol hamoed, one may only do melochos (creative labors) which are needed for the Yom Tov. What justifies doing melochos when going on family trips? Surely these trips can be done after Yom Tov!
Comment: Do you mean to ask about Yom Tov (as the question body says) or Chol Hamoed (as the title says)?  (This is also the answer to your question, I think)
Comment: chol hamoed, but the poskim speak about chol hamoed as tzorech hamoed.
Comment: Later near-duplicate: http://judaism.stackexchange.com/q/47316
Answer: Sh'miras Shabas K'hilchasah, chapter 66, paragraph 58 and footnote 224, discusses riding in a car on a pleasure trip on chol hamoed, as follows. Rav Sh'lomo Zalman Auerbach suggests that it may be permissible even if one can walk, because the m'lacha involved in riding in a car is hav'ara, burning [gasoline], which is permitted on chol hamoed; but he's unsure, as operating the car may be considered m'leches uman, skilled labor, which would be forbidden. Rav Moshe Feinstein suggests that driving is more pleasurable than walking for most people, so that — SSK adds — as long as the trip is for some pleasure for chol hamoed (e.g. visiting a friend), it's permissible as tzorech hamoed, needed for the holiday.
Comment: I assume you mean the second edition of _SSK_? I don't see a chapter 66 in mine.
Comment: Second volume, yes, @DoubleAA.
Comment: I asked about _editions_ not _volumes_. (But you have indirectly confirmed my suspicion, as the first edition was published in only one volume.)
Comment: @DoubleAA, it's volume 2, but afaict the first edition thereof. (At least, there's no indication in it to the contrary.) And it looks like it was published separately from the first volume. Hence, not a second edition in any sense, but a second volume. (That's why I answered as I did above.)
Comment: (relevant especially to the comments) http://judaism.stackexchange.com/q/74108
Comment: and http://judaism.stackexchange.com/questions/57485/why-do-women-wear-ponytail-elastics-on-shabas/57493#comment153862_57493

chol hamoed outings


Investing in cryptocurrency in India

Question: Question: My friend in India wants to start investing in cryptocurrency such as bitcoin. I have a few questions. What is the current legality of cryptocurrency in India? What exchange should he use? What wallet app should he use (should support main popular coins)?
Answer: Crypto was declared legal in India, earlier this year by the Supreme Court. That being said there are no legal frameworks/regulations right now by the government.
WazirX is one popular exchange in India. Haven't used it though.
Comment: None of the KYC exchanges in India are good
Comment: mentioned that haven't used it, therefore got no idea.

Investing in cryptocurrency in India