Homogeneous localization and regularity

Question: Let $k$ be a field, $S = k[x_0,\dots,x_r]$, $I$ a homogeneous ideal of $S$ and $R=S/I$. Let $P$ be a homogeneous prime ideal of $R$ and let $R_{(P)}$ be the homogeneous localization of $R$ at $P$. I seem to have proved that $R_P$ is regular if and only if $R_{(P)}$ is regular. Do you agree? Also, is there any reason to believe that $R_P$ is flat over $R_{(P)}$?
Answer: This is almost Exercise 2.2.24(b) of Bruns-Herzog. And other parts of Exercise complete this.
Hint.

Localization is flat.
$\left(R_{(p)}\right)_{pR_{(p)}}=R_p.$
Comment: Actually 2.2.24(c) is more relevant, as the other answer shows.
Comment: That exercise says something a little different than the OP wants: it is about any graded prime while here there is only one (given) prime.
Comment: its almost Exercise 2.2.24(b)
Answer:
Let $R$ be a noetherian ($\mathbb Z$-)graded ring, and $\mathfrak p\subset R$ a graded prime ideal. Then $R_{\mathfrak p}$ is regular if and only if $R_{(\mathfrak p)}$ is regular.

"$\Leftarrow$" This follows from $\left(R_{(\mathfrak p)}\right)_{\mathfrak pR_{(\mathfrak p)}}=R_{\mathfrak p}$.
"$\Rightarrow$" Now let's suppose one knows the following result (which is part (c) of the exercise 2.2.24 from Bruns and Herzog):

If $(R,\mathfrak m)$ is gr-local then $R$ is regular iff $R_{\mathfrak m}$ is.

The ring $R_{(\mathfrak p)}$ is gr-local with the gr-maximal ideal $\mathfrak pR_{(\mathfrak p)}$, and then it is regular iff $\left(R_{(\mathfrak p)}\right)_{\mathfrak pR_{(\mathfrak p)}}=R_{\mathfrak p}$ is.
Comment: This is right, although I'm referring to 2.2.24(c). But for your needs 2.2.25 is enough.
Comment: @Manos I see. The second highlighted statement is an exercise in B&H and which I've solved following their hint. But I think we could also use the results on $^*\text{gldim}$ from the paper *The category of graded modules* by Fossum and Foxby. However, I haven't tried this yet.
Comment: I see which exercise you are referring to. Statement 2.2.25(c) is very interesting. So essentially it says that a positively graded  $k$-algebra is regular if and only if it is a polynomial ring, but potentially with non-standard grading. I would add in your answer that this is Exercise 2.2.25 in B&H i think its useful as a reference.

Homogeneous localization and regularity


graphic card and drivers for ubuntu 18.04

Question: I have hp pavilion laptop with nvidia geforce graphic card. after installing ubuntu 18.04 in dual boot with windows 8.1, which graphic card or drivers ubuntu is using on my pc?
Answer: By default, Ubuntu uses the open source nouveau driver for NVIDIA cards. I recommend you switch to the proprietary NVIDIA driver, you can do this by opening the dash and searching 'drivers', which will show an application which opens a window that then searches for drivers, from there you can select the circle next to 'nvidia-driver-390', and then click Apply in the bottom corner of the window. You'll need to restart after it has finished downloading and installing the NVIDIA graphics driver.
Comment: Thanks for your answer. can you please tell me if i should switch to NVIDIA drivers or default ubuntu drivers are better?


A simple number theory confirmation

Question: Suppose $a,b\in\Bbb N$ are odd coprime with $a,b>1$ then is it true that if all four of $$x_1a+x_2b,\mbox{ }x_2a-x_1b,\mbox{ }x_1\frac{(a+b)}2+x_2\frac{(a-b)}2,\mbox{ }x_2\frac{(a+b)}2-x_1\frac{(a-b)}2$$ are in $\Bbb Z$ for some $x_1,x_2\in\Bbb R$ then $x_1,x_2\in\Bbb Z$ should hold?
Answer: Yes. If we set $\alpha = (a+b)/2$ and $\beta=(a-b)/2$, then the lattice generated by the four vectors
$$
\binom{\alpha}{\beta},\binom{-\beta}{\alpha},\binom{\alpha+\beta}{\alpha -\beta},\binom{\beta -\alpha}{\alpha +\beta}
$$
is contained in the set of $(y_1,y_2) \in \mathbb{Z}^2$ such that $x_1 y_1 + x_2 y_2 \in \mathbb{Z}$.
We thus have to check that these four vectors generate all of $\mathbb{Z}^2$. This is true whenever $\alpha$ and $\beta$ are coprime integers with $\alpha + \beta$ odd. Indeed, these conditions imply that the three integers $\alpha^2 + \beta^2$, $\alpha^2 - 2\alpha \beta - \beta^2$, $\alpha^2 + 2\alpha \beta - \beta^2$ are coprime; this ensures the existence of three integers $u,v,w$ such that the quantity
$$
\mathrm{det} \left( \binom{\alpha}{\beta},u \binom{-\beta}{\alpha}+v\binom{\alpha+\beta}{\alpha -\beta}+w\binom{\beta -\alpha}{\alpha +\beta} \right) \\= u(\alpha^2 + \beta^2) + v(\alpha^2 - 2\alpha \beta - \beta^2)+w(\alpha^2 + 2\alpha \beta - \beta^2)
$$
is equal to $1$ (Bezout's lemma). This shows that the two vectors
$$
\binom{\alpha}{\beta}, \ \ \mathrm{and} \  \ u \binom{-\beta}{\alpha}+v\binom{\alpha+\beta}{\alpha -\beta}+w\binom{\beta -\alpha}{\alpha +\beta}
$$
form an integral basis of $\mathbb{Z}^2$.
Comment: I am not seeing directly since I am not familiar with lattice terminology - why does this show  '$x_1,x_2\in\Bbb Z$ has to hold' ?
Comment: @Turbo, We know that $x_1y_1+x_2y_2$ is an integer whenever $(y_1,y_2)$ is in the group generated by the four vectors. js21 shows that this group includes the vectors $(1,0)$ and $(0,1)$, which implies directly that $x_1=1\cdot x_1+0\cdot x_2$ and $x_2=0\cdot x_1+1\cdot x_2$ are integers.
Comment: @js21 Your proof seems to show only $
\binom{\alpha}{\beta}$ and two of $$\binom{-\beta}{\alpha},\binom{\alpha+\beta}{\alpha -\beta},\binom{\beta -\alpha}{\alpha +\beta}
$$ suffices to form an integral basis of $\mathbb Z^2$. So perhaps the right problem should perhaps be 'if three of $$x_1a+x_2b,\mbox{ }x_2a-x_1b,\mbox{ }x_1\frac{(a+b)}2+x_2\frac{(a-b)}2,\mbox{ }x_2\frac{(a+b)}2-x_1\frac{(a-b)}2$$ are in $\Bbb Z$ for some $x_1,x_2\in\Bbb R$ then $x_1,x_2\in\Bbb Z$ should hold?'?
Answer: Yes, it holds. Here is a different proof. The given conditions are equivalent to $$(a+bi)(x_1-x_2i)\in {\mathbb Z}[i]$$ and $$\left(\frac{a+b}2+\frac{a-b}2i\right)(x_1-x_2i)\in {\mathbb Z}[i].$$ To show that $x_1-x_2i\in {\mathbb Z}[i],$ it suffices to show that $$\gcd\left(a+bi,\frac{a+b}2+\frac{a-b}2i\right)=1~~{\rm in~}{\mathbb Z}[i].$$ Let $\gcd\left(a+bi,\frac{a+b}2+\frac{a-b}2i\right)=\alpha\in {\mathbb Z}[i].$ Since $\frac{a+b}2+\frac{a-b}2i=\frac{1+i}2(a-bi),$ we see that $1+i\nmid \alpha$ (and the same for $1-i=i(1+i)$), for otherwise $(1-i)\left(\frac{a+b}2+\frac{a-b}2i\right)$ would be divisible by 2, but it equals $a-bi$, which is not divible by 2. Now if $\alpha\neq 1$, then there must exist an odd prime $p$ and $u+vi$ such that $u+vi|\alpha$ with $u^2+v^2=p.$ This means that $$u+vi|a+bi~{\rm and~}u+vi|a-bi.$$ By taking conjugate in the factorization of $a+bi$, $u+vi|a+bi$ implies $u-vi|a-bi.$ Therefore both $u+vi$ and $u-vi$ divide $a-bi$, so $$p=(u+vi)(u-vi)|a-bi.$$ This is a contradiction to the fact that $a$ and $b$ are coprime.
Remark 1. The ring ${\mathbb Z}[i]$ is a Euclidean domain, hence a PID and UFD.
Remark 2. For an odd prime $p$ with $p=u^2+v^2=(u+vi)(u-vi)$, the two factors $u+vi$ and $u-vi$ are coprime as the ideal generated by them contains $2u$ and $p$ which generate the unit 1.
Comment: ${ }$ cool proof.
Comment: I simplified your proof a bit. See my response.
Answer: Here is a more elementary approach.
Label the $4$ expressions in the question as (1), (2), (3), and (4), in the order they appear. Then subtracting and adding equations (3) and (4) from each other we get new integral expressions; namely, (3'): $x_1a-x_2b$ and (4'): $x_2a+x_1b$. Bring back (1): $x_1a+x_2b$ and (2): $x_2a-x_1b$.
Next, (3')+(1) becomes $2x_1a\in\mathbb{Z}$ and (4')-(2) turns into $2x_1b\in\mathbb{Z}$. Therefore, $2x_1=\frac{a'}a=\frac{b'}b$ for some $a',b'\in\mathbb{Z}$. Since $\gcd(a,b)=1$, the only way $ab'=ba'$ holds is if $a'=\alpha a$ and $b'=\alpha b$. The outcome is $x_1=\frac{\alpha}2$ is a half-integer. A similar argument leads to $x_2=\frac{\beta}2$ is also a half-integer.
Since $a, b$ are odd, $x_1a+x_2b\in\mathbb{Z}$ implies $\alpha, \beta$ are of the same parity. If both $\alpha, \beta$ are odd then (3) can not be an integer because $\frac{a+b}2$ and $\frac{a-b}2$ are of opposite parity. A contradiction. That means $\alpha, \beta$ must be even and hence $x_1, x_2$ are integers, as desired.
Comment: this is more or less what I had come with.
Answer: This is a simplification of Cehrng-tiao Perng's proof. As observed in that proof, it suffices to show that the Gaussian integers
$$ \gamma:=a+bi\qquad\text{and}\qquad \delta:=\frac{1+i}{2}(a-bi) $$
are coprime. We know that some $\mathbb{Z}$-linear combination of $a$ and $b$ equals $1$, while also
$$\gamma+(1-i)\delta=2a\qquad\text{and}\qquad -i\gamma+(1+i)\delta=2b,$$
hence some $\mathbb{Z}[i]$-linear combination of $\gamma$ and $\delta$ equals $2$. This shows that $\gcd(\gamma,\delta)$ divides $2$, hence the only possible common prime divisor of $\gamma$ and $\delta$ is $1+i$. However,
$$ \frac{\delta}{1+i}=\frac{a-bi}{2}\not\in\mathbb{Z}[i],$$
because $a$ and $b$ are odd integers. Hence $\delta$ is not divisible by $1+i$, and we are done.

A simple number theory confirmation


How to find the alcohol content of a probiotic liquid?

Question: Probiotics are microorganisms that are believed to provide health benefits when consumed. Water Kefir is one such probiotic drink. This has blend of bacteria, yeast (BY), sugar water and the result of action of BY on sugar water. There is alcohol. One of my problem is to find out the alcohol content in the solution. Less expensive, simpler methods/protocols are much appreciated.
Answer: Complex instrumental analytics (HPLC, photometry using a $\ce{NAD+/\,NADH}$ testing kit, etc.) is out of question.
In principle, the most simple approach would be the use of a hydrometer to measure the density before and after fermentation.


Is it safe to add LVM cache device to existing LVM volume group while filesystem is mounted?

Question: I have an existing LVM volume group with a 10 TB logical volume mounted as an ext4 system which is actively in use.
Is it safe to run the command lvconvert --type cache --cachepool storage/lvmcache-data storage/data while ext4 filesystem is already mounted on storage/data? (The storage/lvmcache-data has been previously configured with lvconvert --type cache-pool --cachemode writeback --poolmetadata storage/lvmcache-metadata storage/lvmcache-data in case it makes a difference.)
I would assume yes, it's safe to add cache on-the-fly to online volume with mounted filesystem, but I couldn't find documentation either way.
Comment: According to https://blog.delouw.ch/2020/01/29/using-lvm-cache-for-storage-tiering/ "Another benefit of dm-cache over dm-writecache is that the cache can be created, activated and destroyed online." This suggests that `dm-cache` would be okay to add online but `dm-writecache` would not be okay to add online.
Answer: This hasn't been clearly documented anywhere by the authors of LVM but according to https://blog.delouw.ch/2020/01/29/using-lvm-cache-for-storage-tiering/

Another benefit of dm-cache over dm-writecache is that the cache can
be created, activated and destroyed online.

That means that as long as you're using dm-cache module instead of dm-writecache module, it should be safe to add and remove the LVM cache while the logical volume has already been mounted.
Note that LVM cachemode setting writeback is different from dm-writecache.
In addition, RedHat documentation at https://access.redhat.com/documentation/en-us/red_hat_gluster_storage/3.5/html/administration_guide/sect-lvm_cache#idm140401735629408 says following:

19.8.3. Configuring LVM Cache
...
Adding or removing cache pools can be done on active volumes, even with mounted filesystems in use.
However, there is overhead to the operation and performance impacts
will be seen, especially when removing a cache volume in writeback
mode, as a full data sync will need to occur.

I also verified this by following test:

Create 4 additional storage devices on a virtual machine: sda (2 GB), sdb (4 GB), sdc (4 GB), sdd (1 GB). Sizes of these devices are not important, I used different sized devices to illustrate the flexibility of LVM here. You can pretend that smaller sdd is the fastest device and will be used as a cache.

Build an LVM storage out of sda, sdb, sdc taking all the extents from all the devices (the volume group is called storage and logical volume is called data for this example):
pvcreate /dev/sda /dev/sdb /dev/sdc
vgcreate storage /dev/sda /dev/sdb /dev/sdc
lvcreate -l100%FREE -n data storage
mkfs.ext4 /dev/mapper/storage-data
mkdir -p /root/test
mount /dev/mapper/storage-data /root/test

In real world, I would recommend creating partitions that are  a bit shorter than the whole device and using those partitions for LVM physical volume. This allows easier replacement of a device because "1 TB" devices from different manufacturers may differ a couple of megabytes. I prefer to keep the last ~100 MB unpartitioned for SSDs to be able to create indentically sized partitions on different SSD devices. As a bonus, SSD device can use this never-used area of the disk as extra wear leveling area. If you use cheap drives, I would recommend leaving 10–20% never used because cheap drives typically have way less wear leveling area outside user accessible area. Leaving some user accessible area untouched (or freed with TRIM) allows the firmware to have more wear leveling area which prolongs the life of the drive and typically improves its performance.

Start two fio test loops in paraller on two separate terminals in directory /root/test:
First loop:
while fio --name TEST --eta-newline=5s --filename=fio-tempfile.dat --rw=randwrite --size=500m --blocksize=4k --ioengine=libaio --fsync=1m --iodepth=1 --direct=1 --numjobs=1 --group_reporting --verify=sha1 --do_verify=0 --verify_state_save=1 --verify_backlog=1024 && fio --name TEST --eta-newline=5s --filename=fio-tempfile.dat --rw=randread --size=500m --blocksize=4k --ioengine=libaio --fsync=1m --iodepth=1 --direct=1 --numjobs=1 --group_reporting --verify=sha1 --do_verify=1 --verify_state_save=1 --verify_backlog=1024 --verify_dump=1 --verify_only ; do printf "\nOK -- %s\n\n\n" "$(date --iso=sec)"; done

Second loop (in another terminal):
while fio --name TEST --eta-newline=5s --filename=fio-tempfile2.dat --rw=randwrite --size=500m --blocksize=4k --ioengine=libaio --fsync=1m --iodepth=4 --direct=1 --numjobs=4 --group_reporting --verify=sha1 --do_verify=0 --verify_state_save=1 --verify_backlog=1024 && fio --name TEST --eta-newline=5s --filename=fio-tempfile2.dat --rw=randread --size=500m --blocksize=4k --ioengine=libaio --fsync=1m --iodepth=2 --direct=1 --numjobs=8 --group_reporting --verify=sha1 --do_verify=1 --verify_state_save=1 --verify_backlog=1024 --verify_dump=1 --verify_only ; do printf "\nOK -- %s\n\n\n" "$(date --iso=sec)"; done

These create two files called fio-tempfile.dat and fio-tempfile2.dat which are continously written and verified with total of 5 processes and the contents of the files are verified. I tested with dd that if you modify a single byte, the loop will detect the error:
dd if=/dev/zero of=fio-tempfile.dat seek=1000000 count=1 bs=1

Once an error is detected, you can restart the loop and it will keep testing and verifying the storage until stopped or until an error is found.

Add a new cache device (sdd) to this existing storage while the above test loops are constantly running to demonstrate that accessing the filesystem is safe:
pvcreate /dev/sdd
vgextend storage /dev/sdd
lvcreate -n lvmcache-data -l 98%FREE storage /dev/sdd
lvcreate -n lvmcache-metadata -l 50%FREE storage /dev/sdd
lvconvert --type cache-pool --cachemode writeback --poolmetadata storage/lvmcache-metadata storage/lvmcache-data
lvconvert --type cache --cachepool storage/lvmcache-data storage/data

The last command adds the LVM cache device on-the-fly without causing data corruption. The cache will last over system reboots without issues, too. The reason for allocating only 98% for the data cache and 50% of the remaining space (1%) for the metadata cache is that building a cachepool out of these requires a bit of free space in volume group or it will fail. You could also use cachevol instead of cachepool but 3rd party software typically only supports cachepool because it's the older method. Both have identical performance and cachepool is just more complex to build but has better interoperability with 3rd party repair and diagnostics software which is why I prefer to use it. The cachepool mode also supports using separate devices for metadata and data which could improve performance if you have multiple really fast devices.

If you then want to remove the cache device, you can do following on-the-fly without data corruption:
lvconvert --uncache storage/data

This will take quite a long time if the LVM cache is in active use (such as in the example above with the test loops running) and it will keep displaying status such as
Flushing 15610 blocks for cache storage/data.
Flushing 11514 blocks for cache storage/data.
Flushing 7418 blocks for cache storage/data.
Flushing 5481 blocks for cache storage/data.
...
Flushing 1 blocks for cache storage/data.
Logical volume "lvmcache-data_cpool" successfully removed
Logical volume storage/data is not cached.

It seems that flushing may stall for a long time and keep displaying same amount of unflushed blocks but you just have to keep waiting. The filesystem mounted on top of the LVM keeps working at all times.
I didn't verify what happens if the power is lost while the uncache operation is in progress. I would assume the LVM boots with the cache still in use and you can simply re-run the uncache operation again.

Note that after the uncache command, both the data cache and metadata cache logical volumes will be lost (freed without any history) so if you want to re-attach the cache device, you have to build it from the start (all the lvcreate and lvconvert commands for the step 4). The cache device will still be part of the volume group after the uncache operation so you don't need to redo that.
And as usual, always have up-to-date backup complete and verified before messing with any important data!
The above LVM cache setup will look like following according to lsblk -sp:
NAME                                             MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
/dev/mapper/storage-data                         253:3    0    10G  0 lvm  /root/test
├─/dev/mapper/storage-lvmcache--data_cpool_cdata 253:0    0   996M  0 lvm
│ └─/dev/sdd                                       8:48   0     1G  0 disk
├─/dev/mapper/storage-lvmcache--data_cpool_cmeta 253:1    0    12M  0 lvm
│ └─/dev/sdd                                       8:48   0     1G  0 disk
└─/dev/mapper/storage-data_corig                 253:2    0    10G  0 lvm
  ├─/dev/sda                                       8:0    0     2G  0 disk
  ├─/dev/sdb                                       8:16   0     4G  0 disk
  └─/dev/sdc                                       8:32   0     4G  0 disk

Some additional tips on LVM cache usage:
You can tune LVM cache a bit even though the logic to select what to keep in cache is fully automatic. See man lvmcache for full details. Some examples:

List current cache settings (default values will not be listed):
lvs -o cachesettings storage/data

Clear all cache settings (use defaults for everything):
lvchange --cachesettings '' storage/data

Tune cache to always start flushing write cache to backing storage when if more than 10% of cache is used for write buffering:
lvchange --cachesettings 'high_watermark=10' storage/data

Tune cache to keep flushing the write cache when there's anything to flush once flushing has been started for any reason:
lvchange --cachesettings 'low_watermark=0' storage/data

Tune cache to automatically pause flushing for 50 ms if backing storage is accessed (avoid introducing latency for flushing)
lvchange --cachesettings 'pause_writeback=50' storage/data

Automatically flush even small amount of data to backing storage when it has been in the cache for more than 60 seconds:
lvchange --cachesettings 'autocommit_time=60000' storage/data


Connect to more VPNs

Question: I am using ubuntu 12.04LTS on my vaio laptop and I am in a situation that I have to use two different VPNs to have a good internet access and I don't know how to achieve that.because when I click on a VPN to connect(through Networks->VPN Connections), current connected VPN will be disconnected first.
Comment: Are you trying to multiplex? Wouldn't the bottleneck be your last-mile connection to your (physical) ISP, if you have a good VPN service?
Comment: No, I'm just a user wants to have two connected VPNs together to have access both resources simultaneously.
Answer: As far as I know, you can only run one VPN using Network Manager. I have to run two VPNs (openvpn) at work, too. I connect to the first with Network Manager and to the second using a terminal. I have installed the byobu terminal emulator for this, because you can detach the vpn session from it (using the F6 key).
Comment: Could you please add more details about your answer,specially about byobu terminal emulator.
Comment: You can use any terminal, e.g. the standard gnome terminal (just type "terminal" in the Dash to find it). To start a openvpn session, navigate to the directory containing your vpn certificates, then type "sudo openvpn ". You will be asked to type first your sudo-password and then your vpn username and password. If you have done everything right, the vpn session will be running until you stop it by pressing ctrl+c in the terminal window. I only prefer byobu because you can close the terminal without stopping the vpn process. It can be installed from Ubuntu Software Center.
Comment: ,I've done what you said and I get this----> sudo: openvpn: command not found
Comment: Sounds loke you haven't installed openvpn yet. To do so, open a terminal, type "sudo apt-get update && sudo apt-get install openvpn". After the installation, try again.
Comment: What is , because when I write my VPN name in VPN Connections, I get this --> Options error: In [CMD-LINE]:1: Error opening configuration file: XXX
Comment: Can't tell you. Look through your vpn directory and try the filenames. When it's openvpn, it is most linely a .ovpn file.
Comment: Where is my vpn directory? what do you mean when you say _it's openvpn_? should I make a open vpn first? could you please mention all steps of using openvpn? thanks.
Comment: First you have to find out which vpn-protocol and software your vpn provider relies on. Besides openvpn, there are several other protocols ( which I couldn't help you with). If yours cannot be run from the command line, all this is of no use for you.

Connect to more VPNs


iOS app to transfer images, photos to another phone via Bluetooth

Question: Is there an app that can help me get connected to bluetooth in mobile phones manufactured by companies like nokia, samsunng, etc
Comment: I'm not sure what you are asking.  You want to connect the iPhone 4 to other phones via bluetooth?  What do you want the phones to do once they are connected via bluetooth?
Comment: i want to transfer pictures, songs and messages. Is there a app for that?
Answer: The iPhone 4 does not support the Bluetooth OPP profiles which you need for standard device to device transfers. All you have available are

HFP (handsfree)
PBAP (Phonebook access)
A2DP (advanced audio distribution)
AVRCP (av remote)
PAN (Personal Area Network)
HID (Human Interface)

Peer to peer comms are possible over BT but the app has to implement the protocol stack itself
Answer: There is word out on a jailbroken app in development called Celeste that should be able to do that and is rumored to be release soon.
If you are still on iOS3 you could try iBlueNova.
Answer: You can use iBlueNova; it is a commercial app that you have to pay for. Alternatively, you can jailbreak your iPhone and maybe then you can send pictures and files to other phones without needing a commercial app.


Change individual file from public to private and vice-versa

Question: Running Drupal 7.  I have two file fields set up: One is public, the other private.  I need to be able to take a file which has been saved as a public file, and switch it to the private file field.  And, vice-versa.  Can someone provide some some advice on this?  Thanks!
Answer: I've written an update script to switch a file field from private to public:
function MYMODULE_update_7100(&$sandbox) {
  $field_name = 'MY_FIELD_NAME';

  $fids_data = db_select('field_data_' . $field_name, 'dat')
    ->fields('dat', array($field_name . '_fid'))
    ->execute()
    ->fetchCol();

  $fids_revision = db_select('field_revision_' . $field_name, 'rev')
    ->fields('rev', array($field_name . '_fid'))
    ->execute()
    ->fetchCol();

  $fids = array_unique(array_merge($fids_data, $fids_revision));

  // Move files using Drupal's File API
  $files = file_load_multiple($fids);
  foreach ($files as $file) {
    if ($file && file_exists($file->uri)) {
      $destination = str_replace('private:', 'public:', $file->uri);
      $directory = drupal_dirname($destination);
      if (file_prepare_directory($directory, FILE_CREATE_DIRECTORY|FILE_MODIFY_PERMISSIONS)) {
        file_move($file, $destination, FILE_EXISTS_RENAME);
      }
    }
  }

  // Update field configuration
  $field = field_info_field($field_name);
  $field['settings']['uri_scheme'] = 'public';
  field_update_field($field);
}

What this function simply does:

Gets the fid of all files from field_data and field_revision tables.
Moves files using File API
Updates field configuration
Comment: this works but to get the default file system setting of the field switched for future file uploads you still need to temporary empty the field data and field data revision tables in the database. As for this you have to go in the database directly anyway I do not see much advantage of using an update script as you can do this replacing a lot easier in the database.
Comment: @HansRossel If you don't use any version control system like git, then you don't need an update script. However if there are more environments and/or more developers working on the same project, then an update script is required.
Comment: @HansRossel I've further updated the answer. You need neither to edit the database, nor to move the files manually. The update script takes care of both.
Comment: I noticed a problem where for each file a directory was created with the name of the file (e.g. public://foo/image.png/image.png). Solved by adding `$destination = dirname($destination);`
Comment: Thanks @HermanvanRink, I've updated the answer. I've used `drupal_dirname` and also added a `file_exists` check before trying to move the file.
Answer: I'm assuming that your "fields" are fields on a content type, but I think this advice is helpful regardless.

Use the File API (also, here) to store your files;
Store the row id from the managed_files table ($file->fid) in your fields.

When you need to switch a file from one to the other, just set the values of those fields (for example, load the content using entity_load and set the field's value with something like $my_content->public_file_id = NULL   and $my_content->private_file_id = 3.
...AND when referring to the file, use the public:// or private:// notation. You'll see that there's methods for actually moving the file, too, if you need to do so. I've only scratched the surface, but the File API has been very useful.
Comment: OK, it took me a while to comprehend your response, but I think I've got the gist.  Just a couple of clarifications.  When I view the node_load hook, I see this in the public and private file attachments:
Comment: OK, thanks! Just a couple of clarifications.  When I view the node_load hook, I see the public and private file attachments:

!https://drive.google.com/file/d/0B9Ep0Y1FILulejhsWTJJRTM1ZWc/edit?usp=sharing

entity_load() on the files gives this:

!https://drive.google.com/file/d/0B9Ep0Y1FILulQ2xzbG9DUHRUYlk/edit?usp=sharing

Do I simply load the file object and execute a file_move()  changing the uri to private:// or public:// as approprite?; or,

Do I modify the file attachment arrays in the node itself, moving the public elements to the private array or vice-versa as appropriate?
Answer: I finally got this to work.  Essentially, Micheal's response (first response to original question) was a good guideline for beginning.  I'll add some notes here in case someone else is looking for this solution.
First, you need to be able to modify the file attachment widget in order to put in a checkbox or button or whatever you want to use to indicate that an existing file needs to be switched from one file_attachment field to another.  I used this very excellent tutorial as my guide to modify the widget: Drupal7 tip: Alter a field widget by
Dominique De Cooman (google this).
Next, you need to process the results of this form -- that is, create code which will actually do the physical switching.  I tried using hook_node_update(), but found out it would not save my changes.  I ended up putting my processing code into hook_node_presave();
My processing consisted of:

Moving the file's file_attachments field elements in the $node from public table to private (or vice-versa) as suggested by Michael.
Copying (or moving) the physical file using the file api.  I discovered that you can use file_move() to move from from private to public, but you must use file_copy() to move file from public to private. This is because when you remove the public file_attachment's field info in the $node, that ends up deleting the physical file (or, at least removing it from the file_managed table).

Also don't forget to use the public:// and/or private:// uris as appropriate when copying/moving files.
Of course, there are a lot of little details in between, but the gist of it is that it can be done, and Michael's outline is a great roadmap for at least one way to do it.
Answer: I am using the following query to change all files from public:// to private://. This also will update URLs contained in content body and summary.
START TRANSACTION;

# WARNING: Do not just blindly run this without making sure that this only modifies what you want.

SET @public = '"/sites/default/files/';
SET @private = '"/system/files/';

# change field URI scheme from public:// to private://

UPDATE field_config
SET `data` = REPLACE(field_config.`data`, 's:10:"uri_scheme";s:6:"public";', 's:10:"uri_scheme";s:7:"private";')
WHERE `data` LIKE '%s:10:"uri_scheme";s:6:"public";%'
;

# update URLs of files

UPDATE file_managed
SET file_managed.uri = REPLACE(file_managed.uri, 'public://', 'private://')
WHERE fid=fid
;

# update URLs in content body and summaries

UPDATE field_revision_body
SET field_revision_body.body_value = REPLACE(field_revision_body.body_value, @public, @private)
WHERE field_revision_body.body_value LIKE CONCAT('%', @public, '%')
    AND field_revision_body.revision_id IN (SELECT revision_id FROM field_data_body)
;
UPDATE field_revision_body
SET field_revision_body.body_summary = REPLACE(field_revision_body.body_summary, @public, @private)
WHERE field_revision_body.body_summary LIKE CONCAT('%', @public, '%')
    AND field_revision_body.revision_id IN (SELECT revision_id FROM field_data_body)
;

UPDATE field_data_body
SET field_data_body.body_value = REPLACE(field_data_body.body_value, @public, @private)
WHERE field_data_body.body_value LIKE CONCAT('%', @public, '%')
;
UPDATE field_data_body
SET field_data_body.body_summary = REPLACE(field_data_body.body_summary, @public, @private)
WHERE field_data_body.body_summary LIKE CONCAT('%', @public, '%')
;

/*
COMMIT;

ROLLBACK;
*/

After this, move the files themselves from your public files directory to the private directory.


adduser Firstname.Lastname

Question: I tried to use both useradd and adduser to get a username typed as Firstname.Lastname. I tried also installing libuser and using luseradd, but also I got error. Is there a way to do that (of course it should be)?
I'm trying to write a script that takes a list of users from a file and creates the new users there are in. I can do that with the simple username, but I need to list Firstname.Lastname.
if I use: adduser --force-badname then I can get the user Firstname.Lastname but the home folder does not contain Desktop and Templates dirs..
as well if I use: useradd --create-home "john.doe" I can get the home folder but no Desktop and Templates inside....
Comment: Next time, don't tell us that you got an error. Instead, tell us exactly what error you got. Without that information, we have to play the guessing game.
Comment: That's what you were told in the answer from @NasirRiley. Please consider accepting it since it seems to have solved your problem. (Similarly with your other questions: please accept the answer that worked for you.)
Comment: OK SOLVED. (that was silly...) --> Desktop, Templates and other dirs are configured at first login.
Answer: The easiest way is to use to --force-badname switch.
adduser firstname.lastname --force-badname

You'll get a message Allowing use of questionable username. and then it will continue with creating the home directory and asking for the password.
Comment: @pietroletti They will either be created at first login or if you want them to be created when the user is added: The files and directories that are created in the user's home when the user is added are located in `/etc/skel`. Create what you desire to be added in that directory via `mkdir /etc/skel/Desktop` for example. They will then be created when the user is added. Do this before running the script that adds the users.
Comment: when I do that I get the new.user home dir without Desktop and Templates folder... how can I add those folders?

adduser Firstname.Lastname


Converting text date into standard date format in Excel 2010

Question: I've got an Excel 2010 spreadsheet that has a large number of dates for the year 2014 entered in the following format: Thursday 24th July that I need to convert into standard date time format (the end result is going to be imported into an SQL table and the dates will be like YYYYMMDD so the date I mentioned above would need to be 20140724, I can deal with that conversion, but Excel won't recognise Thursday 24th July as a date).
Answer: OK, so this is a pretty ugly formula, and I'm sure someone can come up with one much cleaner. Still I've tested it and it works, which I guess is what matters.
In an adjacent column enter this formula:
Where the dates start in A2
=DATEVALUE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(
  RIGHT($A2,LEN($A2)-FIND(" ",$A2)),"th","",1),"rd","",1),"st","",1"),"nd","",1))

DATEVALUE converts a date stored as text into an Excel date code, so that it can be formatted correctly, but the date Thursday 24th July has a few issues with it;

DATEVALUE can't make any use of the day of the week, and it's not relevant anyway
the th or rd at the end of the day numbers are also values that the formula can't use
There's no year stored in this date

This formula can't do anything about the year, but what it does do is this (working from the middle out):

RIGHT($A2,LEN($A2)-FIND(" ",$A2))

Return the day number and month by finding out how long the text date is and subtracting the number of characters between the start and the first space (the space after the day name)
SUBSTITUTE([FindText],"th","")

Replace any instance of th in the returned string with nothing
SUBSTITUTE([FirstSubstitute],"rd","")

Replace any instance of rd in the returned string with nothing
=DATEVALUE([StringReplacers])

Convert the result to a date. With no year supplied it will assume the current year.
Comment: Sorry about that, rushing a bit :( I've updated the answer to include all sufixes (just remove the caridage return, it's just easier to copy this way) I'd have thought August would be an issue but it's working fine. Still to be on the safe side I've added a First Instance restriction so it will stop substituting after it hits the suffix
Comment: cool `"st",",1"` should be `"st","",1` I think. It won't let me edit less than 6 characters!
Comment: No worries, done :)
Comment: Looks good, would probably need to do `SUBSTITUTE([SecondSubstitute],"nd","")` and similar for `st`, but but would the `st` interfere with `August`?
Answer: I found one solution to this while writing the question, so I thought I'd submit it anyway in case it helps anyone else:
It's not an ideal solution, however it appears to work. A number of batch Find/Replace actions to convert the dates to what Excel will understand. Important to note the spacing, do the searches excluding the apostrophes but note if there is a space within them

Find/Replace, find 'Monday ' and replace with '', same for 'Tuesday ', 'Wednesday ' etc to remove the days from the date.
Find/replace, find 'January' and replace with 'January 2014', same for 'February', 'March' etc to add the year that you want
Find/replace, find 'st ' and replace with ' ', same for 'nd ', 'rd ' and 'th '

Then you can format cells as date and Excel should recognise and convert them. The correct spacing in the search/replace is important because you don't want to find 'st' for '1st' and have it remove the end of 'August'
Comment: Note that I added the apostrophes above because the code tags drop trailing spaces, remember to exclude the apostrophes
Answer: Well, you can use something a little shorter:
=(IFERROR(MID(K32,FIND(" ",K32)+1,2)*1,MID(K32,FIND(" ",K32)+1,1))&
  MID(K32,FIND(" ",SUBSTITUTE(K32," ","",1))+1,100))*1

The first part:
IFERROR(MID(K32,FIND(" ",K32)+1,2)*1,MID(K32,FIND(" ",K32)+1,1))

Extracts the date. It tries to extract 2 characters after the first space first, and if that's a number (doesn't return an error when multiplied by 1), adds it to the second part which is the month.
If that's an error (e.g. first two characters in 1st are 1s which is an invalid number), then that's a date less than 10 and thus extract only one character.
MID(K32,FIND(" ",SUBSTITUTE(K32," ","",1))+1,100)

Extracts the month with its preceding space.
Then multiply the whole thing by 1 to get the datevalue. You can format as yyyymmdd via custom formatting and the dates will be ready to be imported to SQL.
As with @CLockeWork's formula, since no year is mentioned in the formula, the sheet will take the current year. If you need to specify it, you'll have to do it manually, for example, like this:
=(IFERROR(MID(K32,FIND(" ",K32)+1,2)*1,MID(K32,FIND(" ",K32)+1,1))&
  MID(K32,FIND(" ",SUBSTITUTE(K32," ","",1))+1,100)&" 2013")*1

For the year 2013.
Answer: You can use this formula to convert to a date in 2014
=(REPLACE(REPLACE(A2,FIND(" ",A2,11)-2,2,""),1,FIND(" ",A2),"")&2014)+0
that will return the date serial number, format in required date format
The first FIND function finds the first space at character 11 or later (which must be the second space in the string given the length of weekdays), and then, based on that, REPLACE removes the two characters immediately before (which will be the "st","th","rd" or "nd")
...and then the 2nd FIND finds the first space and REPLACE replaces all the text before that, leaving you with just 24July or similar
You can then concatenate the year [2014] to the end and use +0 to co-erce to a date
If you want to go directly to 20140724 (as a string) you can use this version
=2014&TEXT(REPLACE(REPLACE(A2,FIND(" ",A2,11)-2,2,""),1,FIND(" ",A2),""),"mmdd")


Storing/transporting nut brittle in tins

Question: I made different types molasses nut brittle for the first time tonight to give as holidays gifts. I'm going to put a little of each type in small round holiday tins that I found at a craft store. I plan on putting the tins in my check-on bag when I catch my flight. However, I'm not sure how I should package them for this! Should I wrap the contents (if so, with what?), and how can I make sure the tins stay closed during the flight? I haven't packaged using tins before so I wanted to hear your thoughts.
Comment: What sort of tins are you using?
If they are airtight, then you have potential problems with air pressure differences, which may end up with the tins buckling in on themselves.
Comment: They are definitely not airtight at only $1.50 a piece from Michaels. I can't find the exact tins online, but they are just decorative mini tins that are about 4.5x2.5"
Comment: related : http://cooking.stackexchange.com/q/39632/67
Answer: Based on your answer, here's what I would do:

Line the tins with a bit of tissue paper, to cushion the brittle
Use rubber bands to keep the tins closed in transport
Wrap the tins in more tissue paper, again, to provide cushioning
Comment: Beware that if you wrap the tins, you might have to unwrap the when going through airport security.  (which slows you down)
Answer: (note: in re-reading your question, I noticed that you said 'check-on', which I read as 'carry-on'.  I've made notes for both checked & carry-on baggage)
This might be a little bit late, but in case someone in the future has this issue again:

Carrying lots of little metal containers onto a plane can slow you down going through airport security.  (although, it's a bit hit and miss -- I've been stopped before for lots of things ... oddly shaped picture frames, blocks of cheese, an Apples to Apples deck, pocket wrench, rechargable batteries in their charger, etc.).  I'd likely lean towards boxes over tins if you have them available and you're carrying on.  If you're checking them it's not as much of a problem, but I've had my notes from the TSA a couple of times that my bags got searched due to things I was carrying (those were mostly electronics & lots of cables)
Packaging inside the container depends on how thin you've made the brittle -- the more slender it is, the higher the chance of breakage.  I'd probably put something to take up any extra space to  keep the brittle from sliding around inside the case; crushed waxed paper, etc.  If there's lots of extra space, I might line the tins with bubble wrap, and then something I'd be okay coming into contact with the food (if it was reused from my supply saved for bubble wrap appreciation day).
You then need to protect the containers from getting too crushed and dented ... I'd likely stack them all up and then tie them together with some string, so that most of the tops & bottoms are protected, then roll the whole thing in a shirt or other clothes (I always carry-on a change of clothes, just in case my checked luggage is delayed).  If it's in a larger bag, try to get it towards the middle of the bag, especially if it's a soft-sided bag.
Comment: Wish I would have read this sooner! Most of the brittle did arrive broken. When making the brittle, I tried to make it as thin as possible (first mistake- most of the pieces arrived broken). To transport, I put brittle in each tin, filling it about 3/4 of the way (2nd mistake- there was room for the brittle to jostle around and break). I did use large rubber bands to keep the containers closed. I placed the tins together at the top of my bag (3rd mistake) with no clothes as padding, as they were being used to protect my huge laptop. Luckily, though, I did not have any problems with security.
Comment: Sorry ... I wish I had posted it sooner.  (you asked your question weeks before Christmas; I didn't reply 'til the week after.)


Loop through a temporary table and insert to another table

Question: I need to insert the data in a csv file in to a temporary table and insert some data for the corresponding id value in another table. I have created and inserted the data in to the csv file. For all the records in the csv file how can I loop through and insert dome data for the corresponding record in the other table.
CREATE TABLE #tbcompanies
(ID INT)
GO

BULK
INSERT #tbcompanies
FROM 'd:\ids.csv'
WITH
(
ROWTERMINATOR = '\n'
)

select * from #tbcompanies

drop table #tbcompanies

Comment: Why do you think a loop is necessary? Can't you just `INSERT [other table] SELECT ID FROM #tbcompanies AS t /* perhaps some join to [yet another table]`?
Answer: Assuming both tables have an ID column, you could update the other table like:
update  ot
set     col1 = tmp.col1
.       col2 = tmp.col2
from    @tbcompanies tmp
join    OtherTable ot
on      ot.ID = tmp.ID

If in addition to updating, you'd like to insert rows that do not exist, consider the merge statement:
; merge OtherTable as target
using   #tmpcompanies as source
on      target.id = source.id
when    not matched by target then
        insert (id, col1, col2) values (source.id, source.col1, source.col2)
when    matched then
        update set col1 = source.col1, col2 = source.col2;

Comment: Thanks, I actually need to insert some new records. I will update my script.
Answer: You don't need to loop through anything, since you use SQL Server 2008 and this version supports the MERGE statement.
Have a look here.
Or simply use update with a from clause and join the two tables.
Answer: If it's upsert functionality you need, I strongly recommend the Merge function.
pseudo code
   merge TargetTableName target
   using #tbcompanies tmp on tmp.idfield=target.idfield
   when matched then update......
   when not matched then insert...........


Why do users reply to messages clearly marked as do not reply

Question: In a web app, we generate a lot of emails including reminders, requests for approvals, login details etc. They all come from a real email address to help with deliverability etc and they all quite clearly state:
*** This is an automatically generated email, please do not reply to this message ***

For clarity here is an example of an email as there seems to be some confusion on the type of message being sent and the suitability of "no reply" emails especially as all the requests require the user to login, check the item and then action something:
John,

Michelle has created a new requisition for 6 widgets which needs your approval - please login and process this requisition

https://www.domain.com/app/requisitions/123/process

    *** This is an automatically generated email, please do not reply to this message ***

And an example of the messages we get back:
Michelle,

Why have you ordered 6 widgets? I thought you only wanted 4?

John

The message is in plain text rather than HTML (again to aid deliverability etc) so there is no other easy way to highlight the line - the emails typically only contain three or four lines and this one is at the bottom with white space above and below so it is not lost in amongst lots of other lines.
Despite this, we get numerous people replying to the emails either saying things like "approved" rather than logging in and actually approving the request or they ask questions etc - these all come to us, of course, but they are actually intended for the person who generated the message in the application so each time we have to find that address manually and forward it on.
Why do users ignore this and reply to an automated message? What clever ways are there which we could use to overcome this?
Edit I have no idea why everyone is assuming this comes from a no-reply@ email address - this is a proper email address with a mail account etc
Comment: In this day and age I don't really think having a 'do not reply' email address is necessary. We can easily detect incoming emails and route them to appropriate places. Otherwise it's just like shouting something at people through their letterbox and then running away so they can't reply. It's outdated. Email is for communication, so we should allow our customers to communicate with us in the easiest possible way. Which means allowing them to reply to emails.
Comment: Whenever Google sends me an email about some new policy that is pro-Google, anti-everyone else, I always reply with "**** you Google!", knowing full well it is a do not reply email. Our company, a pro-customer online retail company, always has our receipts, shipment notices, etc, sent from the service email, so that they can reply to any notices and have it go to service. I think the answer here is, "because they expect that if you can write to them, they should be able to write back".
Comment: A better question: Why are emails sent that aren't designed to have responses to? :)
Comment: @Pdxd who's to say? I can't speak for each user. But email, as a medium, is designed to be a two-way street. I'd suggest that emails sent from a no-reply address are akin to robo-calls on your phone. They're impersonal. Sometimes that's fine, but for those that *do* want to reply, why not let them?
Comment: The problem is we cannot easily route them as we have 10,000+ users and at least 40 different email templates which get generated all of which are asking the user to login and do something. These are not our customers per se but users or clients of our customers and they don't want to communicate with us, they want to communicate with the sender (i.e. our customer) if that makes sense?
Comment: Depends on the message that was sent to the user. If the message contains invokes an emotional response, you are more likely to get the user to reply.
Comment: @DA01 sometimes the purpose of the email is part of a transaction. For example, if you buy something and get a receipt, or if you get your movie ticket stub in your inbox, usually that's just a one way street. As a user you wouldn't reply to those, would you?
Comment: So how else can we communicate to the user (who may well not be logged in and not intend to login that day) that there is an action they need to complete? Yes email is designed to be two way but, in this instance, what other medium can be used?
Comment: Who actually reads the from address on emails.  Also, if it's on a iPad, it just says the name it's registered under.
Comment: Nice that you say "please" -- many of the DNR emails I get are scolding in tone, leaving me with a bad taste in my mouth at the company.  Fascinating too that a lot of people *try* to reply.
Answer: The best solution would be to handle those emails automatically and forward them to the appropriate recipient.
For emails that can't be auto-forwarded, you can simply write an automatic email back reading something like: "Sorry, you can't reply to our automatic emails. Please login and do your action online (example.com/do/action). If you have any questions contact our support at email@example.com."
Answer: I think the problem that you are describing is not a problem with do-not-reply emails but with the lack of support for email interaction with your system.
Many systems (like bug reporting Sifter, Trello, Basecamp and others) let people respond to issues sent to them by email (a response needs to be included above a certain point in the email) and after a person responds - the response is included in the original issue/conversation or a thread by the system. This enables a very easy and quick way to respond and get on with your other tasks without having to login to the system.
Do-not-reply "attitude" simply rudely cuts off a possibility of that dialogue continuing and introduces extra steps for the user to complete their tasks.
If you really need to use "do not reply" (like in the case of password changes etc) consider giving it a bit of personality - maybe a friendly name like "email@example.com" with a matching autoresponder should someone ignore your please not to respond  .
Comment: @PatomaS the response is not "people want to communicate" the response is that email communication is simply an extension of the existing system and should be considered as another interaction channel. Do-no-reply simply limits that interaction. Systems should be designed with all the communication channels in mind as possible means to interaction.
Comment: Although there is a response on your text, it's hidden on all the words you wrote. What you say is true and quite valid, but if you can isolate and expand the idea of "people want to communicate with you" would be a much better answer.
Answer: I had to add my 2 cents for the sake of the necessity of no-reply accounts, as well as what we do to mitigate the issue of replies to no-reply.
For starters, there are several systems that can generate emails without being tied into an actual email messaging system. For instance, it seems as though the example "generated message" above is from some online retail store, and the back end can generate and send messages; but it knows very little about messaging, as the designer didn't know much about messaging. Like, if I send out an alert from a management platform, why would anyone expect that to be a 2 way street? There's a surprising amount of this type of communication on the internet, and there is a perfectly good reason for almost all of it. Some companies, to avoid this issue altogether, will change the "reply to" address to the user's prefered address, so any reply to the automated message goes somewhere else than where it was sent from. That's not always possible, and not every system is intelligently designed to allow this.
So, rather than trying to tell OP that the issue is "no-replies are impersonal and email is 2 way communication, etc etc" I hope to propose some actual useful advice. What we've done for systems with the described limitations is create specific no-replies for each of them. So, we have firstname.lastname@example.com instead of firstname.lastname@example.com. We have a service mailbox established for each of these accounts in our actual mail system. From there, we go one of two ways: our most common setup is a transport rule that delivers an NDR if someone tried to respond to the message. You can create specific NDR messages, and in this case, it could be "Order Confirmation messages are informational only. For any additional information, contact the user directly or follow the instruction provided in the message." The only issue (benefit?) to this method is no one ever receives the reply. I prefer this method because it forces users to re-read the original message, helping them to learn or do something on their own. Alternatively, you can generate an Out of Office response on those service mailboxes. What's elegant about this solution is that someone can still get the messages and handle them individually while you generate a message back to the sender right away, telling them, more or less, the same as above. Some OOF responses support HTML, so you can even get some good formating to convey your point about the inbox.
Finally, I do believe it helps to have the "automation notification" at the top. We try and put all our notifications for automated messages at the top, so they are less likely to be skipped. This is not meant to be super personal, and a little less worry over not providing every single nicety to the user can go along way. Most users, from my experience, do not expect much in the way of niceties from no-reply addresses anyway. Straight and to the point usually does it for us, and we save our politeness for actual personal interaction. If someone's getting something from a robot or automated account, I think they would rather it be brief and to the point. I liked the comment about firstname.lastname@example.com, and that would be fun and semi-personal way to let the user know that it's not a valid account to respond to. It may not have to be named robot, but the message string could facilitate the establishment of that precedence.
Finally, I don't think it's as easy as one would think to automatically handle emails like this. It's easy to recommend it, but many systems make this extremely difficult, at best. It's usually impossible.
Comment: Hi. Please help improve this answer by utilising some of the available formatting tools. That would really help with the readability of this answer.
Answer: Why is not as simple as a user not reading the email. There are two likely scenarios:

The message contains no surprising information. The user reads all the way to the end and learns that they can't reply, or only reads far enough to confirm their expectations. They weren't going to reply anyway, so the warning was redundant. You'll never hear about these occurrences because success means nothing happens.
The message contains something surprising or "wrong" from the user's perspective. They read only as far as the perceived error (6 widgets in your example) and then anger, confusion, or frustration take over. They fall back on default assumptions about email, which means replying to them, and forget that this is a special case.

To fix #2 you either need to change human nature (a losing battle) or bend to meet expectations and allow them to reply. If they expect a reply to go to Michelle or the person who generated the message, consider using that email address instead of email@example.com.
Comment: I think there's another aspect to #2, though: the OP's example reads roughly "needs approval, visit `.../process` to process" -- it is not entirely obvious if you can decline approval at that link, or if clicking on it is supposed to be the approval already.
Answer:
Why do users ignore this and reply to an automated message? What
  clever ways are there which we could use to overcome this?

The first step in making sure users do not reply to your emails is to make sure nobody ever reads the replies. This is where your problems are starting. You are trying to combine two things that cannot mix, namely use a "real life" account and treat it as a "do not reply" account. If you want users not to reply, just use an account for this purpose.

Conceive (but do not make) two email addresses, one called something like "email@example.com" and a second one called something like "firstname.lastname@example.com"
Change the template of the notification email you are sending so the headers have the "notification" address as the FROM, and the "mailbounce" address as the REPLY-TO. For more information on email headers check here.

Edit I have no idea why everyone is assuming this comes from a
  no-reply@ email address - this is a proper email address with a mail
  account etc

If you insist in using a "proper" mail account you need to have the discipline (and create credibility with your users) that these kinds of emails are not read. Never EVER read them. Eventually the users will learn. The reason I would use a bogus email and not a real email is because mail sent to a bogus email will typically immediately and automatically be refused by the server. This helps users learn faster. If you use a real account, and if you reply to a user reply with a message "no, don't reply to the notification" then the users know that a human is reading the mails and that the human (you) might help them. Users don't learn this way. My advice - let the server handle it, make sure the user gets an automated error message.
Answer: I can present as one example where I attempted to do so was with regard the US Government Healthcare Exchange website.
This site expects you to do certain things via logging in the site.  It creates an account, associates it with the user's email. Warns the user NOT to make another account, then sends a confirmation mail that you need to click a link in.
Well, thanks to their fouled up system, the confirmation link never worked, so I was unable to login to the real account.  Phone operators tried, but were unable to assist.  As the deadline approached I signed up for insurance over the phone.
Periodic attempts to correct the login failed later.  The email that was sent contained a dead link.  One I tried many times, and phone support had no way to get another sent.
But the system did know my policy was associated with my email.  And it sent me NO-REPLY emails telling me to login and do XYZ.  (Tasks I eventually had to do via US Postal Service).
At wits end, I did several replies to a NO-REPLY email, in hopes that someone might be skimming replies looking for hints of unexpected problems (as the existence of this question shows can actually happen).
Never worked though.
The rest of the story was that eventually a customer service person suggested I ignore the instructions to not make another account and make one anyway.   So I made one using the trick that GMail ignores added periods in inbound email addresses.  That way mail associated with either account would come to the same GMail account.
I was able to get a account made, and associate it with my policy with the assistance of the customer service operators.  Now I can log in.
And all it took me was hours and hours on the phone and days and days waiting for the US Mail.
Frustration like that leads people to reply to NO-REPLY emails.
and IMHO skimming the replies that do arrive is worthwhile to the company.
Answer: Unfortunately there is only one way to fix this issue and it's not a good one. People will always do this even if you include the warning in 48px blinking red type so you have to set the reply-to email as the one that should be getting replied to. Either that or live with people that can't be bothered to read the instructions.
You may consider putting the warning above and below the message. You will still get people doing it though.
Comment: Although what you say is true, that still doesn't answer the question. Except for the obvious part of people don't read instructions, of course.
Comment: What other reason is there? Either they didn't read the warning or they ignored it. The only answer is to make the reply go where the user thinks it should go, unless you want to continue the way you are now.
Answer: A real life example why:
What if the message was sent to the wrong address, because someone signed up with an address he/she does not own. Then the login won't work and to add to that fustration, the email may be in a language that the email address's owner does not speak (and read on a device with no translation option e.g. a phone).
A possible solution:
All you need to do is add a reference ID to the emails you send and if someone replies, use the reference ID to route the email + send a confirmation email (did you send this email yes/no?) to the user to make sure that the email wasn't spoofed.
You should also support remove this address via this method (reply with remove me in the subject) with a confirmation mail.


how could I exist where I did not exist in the past?

Question: If I was able to go back in time via Machine or whatever, would traveling back in time not create a paradox?
I was not there, so how could I exist where I did not exist in the passed?
 i would have to assume that we could never go backwards in time in any way shape or form.
Comment: Someone retag with time travel.  And likely duplicate of http://physics.stackexchange.com/questions/7823/is-time-travel-possible but I won't call it quite yet.  These both seem to be about standard Back to the Future kind of time travel, which might be already addressed sufficiently.
Comment: Neither question (nor most of the answers to 7823) are coached in sufficiently precise language to be dealt with well. There are attempts to deal with the possibility of closed time-like curves, and the properties they must have (or not have), but as yet they must be formulated in fairly opaque mathematics.
Answer: This question is directly about the apparent paradoxes that are present in what I will refer to "Back to the Future" time travel.  This is the time travel depicted in several major movies where a time machine is created and someone goes back into the past and changes something.
A simple solution to time travel paradoxes
This might be better handled by a philosophy perspective, but since it's being asked here, I'll start with a slightly less relevant of a physical example where something can be taken to be traveling backward in time.  Hawking radiation involves a particle radiating away from an event horizon after being spontaneously created from quantum fluctuations with an antiparticle that falls into a black hole.

In this case, the antiparticles can be interpreted as the particle itself traveling back in time.  On can not escape the event horizon of a black hole, but it can if it travels backward in time.  The "lame" thing about this situation is that time travel happens without any conflicting world-lines.  There is a singular story of what happened, and no multiple universes are required.
Hollywood time travel often does involve conflicting (and often hopelessly confused) world-lines.  This generally comes in the form of someone from the future affecting the series of events that leads to the creation of a time machine.  Developing a plot should depend on several philosophic physical questions like:

Can a given outcome be guaranteed, or does the world exhibit determinism / fatalism?

One could potentially take the above example of particles and antiparticles and replace it with an intrepid time traveler.  In that case, the time traveler is moving forward in time, until at one point in spacetime he goes into reverse and begins traveling backward in time.  This would be observed as the existence of 2 versions of the time traveler colliding and then disappearing.  Then if he reverses back into the forward direction, then at some other point in spacetime, before his "first" reversal (first, perceived in his time), there is an apparently spontaneous creation of 2 versions of him, one of them going backward in time and one of them going forward in time.
There is no way to create time paradoxes because the versions that have time traveled already exist by the time the time machine is used.
Entropy arguments
Yet another way to time travel goes back to the definition of entropy and time itself.  The laws of physics are (to the extent of my own knowledge) fully reversible, and the reason time progress in one direct was due to the low entropy at the big bang, which allows us to have a memory of the past and not the future.
You could just create something that has a decreasing entropy.  There, finished.  What does this mean?  This means that you create an item that has a decreasing number of degrees of freedom.  For instance, a gas that starts with chaotic-seeming motion of particles that are really precisely engineered to converge on a single point in the middle.  The event of that gas contracting is identical to saying that the gas is expanding backwards in time.
Again, you should find Hollywood disappointed with the proposal because no privileged information is gained.  No one can use this to win the lottery, and the systems required to decrease entropy of a chunk of matter are drastically more elaborate than the system that is created.  On the plus side, we are getting closer to the point when we can technologically do this.
Answer: The universe lives in a continuum evolving present . The past do not exist, neither the future; there are no such places.  The equations are symmetric irt time and they only told what will be the next state in face of the actual snapshot and similarly we can derive what was the previous state, eg. the Earth will progress to the next position in space and not to the position it occupied a moment ago.
I'm looking to the night sky and I'm receiving energy (photons) released billions of years ago as measured by our local clock or by the cosmological clock used to describe the evolution of the universe as a whole by an independent observer (not attached to the matter properties).
If in the next moment, say  $t_{+1}$, I intended to be in my past $t_{-1}$ I will have to deconstruct all past events that already happened in the whole universe between  $t_{-1}$ and  $t_{0}$. All photons that are hitting my eyes now must be sent back into space to some other evolving position. All other people normally evolving will have to be deprived of that light. Can we erase stars from the sky? No. Can we substitute one photons by others? No. Now lets admit that you arrived to your desired past. What photons are you seeing? In what position in space is the Earth? Was it moved at your will to any other place except that one that physical laws will determine? With all its present inhabitants ? With all past and dead inhabitants, those that are now flowing in the rivers or buried down in the Earth (possibly some atoms of them are now integrated in my body) ? How much energy will you need to recall all that matter from its present locality to your desired position?
Will you go and at the same moment stay here? Will you have two consciences?
Some atoms in your body could belong to someone else in the past. To return there will you destroy him? or will you reassemble some other matter locally available to reconstruct your body? What happens to your present body?
All matter radiates gravito/electromagnetic energy into space always. How do you reassemble back that energy into the particles to have the world of the past? There is no way!
In the universe there is a currency, called energy that has to be paid to do any action. All the matter/energy in this universe is allocated, engaged in this trip. If we want to construct an alternative reality we have to assume other simultaneous universe like a shifted copy modified, of this one. The object of physics is only the universe that we observe. Some theoretical instances wrote about other realities, mental constructs, desires, much like many others constructed other places like Heaven and Hell. When some believe in other universes we have two situations: if they interact or leave some trace in this one then we are only talking about this one and if they do not interact then they are out of the domain of physics.
Using Einstein SR equations we describe the viewpoint of a moving body and get prisoner of our local clocks and we think about closed time-like curves.
If we adopt another viewpoint, above all moving bodies and with instant vision to acknowledge the events,not the kind of the Einstein referential, we will have a broader view and see that there is no chance to travel to the past.
The energy argument and the choice of a more proper referential should be enough to put an end to the dream of time travel. But because we are humans it is nice to have dreams.
Comment: Thank you a great answer to my question. Witch brings me to think that if we could travail back in time it would only be during the 'big crunch' thus the universe itself being the time machine. Maybe some day the notion/study of the Déjà vu could prove with calculations that we are constantly being looped froward and backward in time and that we have time during our Déjà vu to change history of that particular big bang expansion, Thus only effecting the one we are in at the moment and no others. and if that being true why?
Comment: The universe is absolutely fascinating without Big Crunch, Big Bang, DM, DE, BH, time travel, etc. I've experienced once or twice the Déjà Vu. Its a mirage. My brain is a marvelous construction that took 57y of my own time, 30 of my parents time, more 30 of my grand-parents,.... and some of the neuronal constructs of the past may have survived in my brain and the pattern matching that our brain constantly do can activate false memories. In some future ;) I can add to this answer more about quantity of information, emitter and receiver stations and the notion of 'time' local and cosmological.


Inner product on global sections of positive line bundle

Question: Let $\Sigma = S^2$ be thought of as a Riemann surface, and let $L$ be a Hermitian line bundle on $\Sigma$ with curvature $2$-form $-2 \pi i \Omega \in \Omega^2(\Sigma, \mathbb{R})$. Then $L$ is a positive line bundle iff $\Omega$ is cohomologous to a positive $2$-form. If $\Omega$ is a positive $2$-form then the Hermitian bilinear form on $H^0(L)$
$$ (f, g) \mapsto \int_\Sigma \langle f, g\rangle\Omega $$
is positive definite on $H^0(L)$. Is this bilinear form still positive definite without the assumption that $\Omega$ is positive, i.e. while assuming only that $L$ is positive?
Answer: This is in general false, if I am not missing anything. Suppose you start from the form  $\Omega_0$ given by the Chern connection on $O(1)$ with respect to the standard metric coming from $\mathbb{C}^2.$ Up to a constant multiple this is the standard area form on $S^2.$
If you multiply the metric $h$ by $f=e^{\phi}$ then the curvature changes by $\frac{1}{4} \Delta \phi.$ This means that for a section $s$ its norm squared becomes:
$$ \int_{S^2} |s|^2 e^{\phi} (1+\frac{1}{4} \Delta \phi) \Omega_0.$$
The idea is to make $e^{\phi} (1+\frac{1}{4} \Delta \phi)$ negative where $|s|^2$ is large.
Take the section corresponding to the homogeneous polynomial $z_2^d$ on $\mathbb{C}^2.$ Then $$|s|^2 = \left(\frac{|z_2|^2}{|z_1|^2+|z_2|^2}\right)^d.$$ Note that in suitable real coordinates $(x,y,z)$ coming from an orthonormal basis on $\mathbb{R}^3$ this is a constant multiple of $(z+1)^{d}.$
Take for simplicity $d=1.$ Let $\phi = 4 z.$ Passing to polar coordinates $$(\sin(\theta)\cos(\varphi),\sin(\theta)\sin(\varphi),\cos(\theta))$$ for $(\theta,\varphi) \in (0,\pi) \times (0,2\pi),$ and using the formula $$\Delta = \cot(\theta) \partial_{\theta} + \partial^2_{\theta} + \sin^{-2}(\theta) \partial_{\varphi}^2$$ for the Laplacian in spherical coordinates
the norm squared of $s$ becomes: $$2\pi \int_0^{\pi} (\cos(\theta)+1) e^{4 \cos(\theta)} (1-2\cos(\theta)) \sin(\theta) d\theta =$$ $$ = -\pi \sinh(4) < 0,$$ the computation having been done by Wolfram Alpha.


Are electrons and holes distinguishable particles?

Question: In condensed matter physics: If we describe e.g. an exciton as a combination of an electron and a hole, do we need to combine them in a Slater determinant or into a simple product state? What happens with exchange interactions?
Comment: There will be a splitting between singlet and triplet states, and this normally called the exchange. But yes, I see a conceptual difficulty. The energy difference is larger in small systems (molecules, quantum dots).
Answer: A hole is an abstraction of a missing electron, that is of a many electron system with spin 1/2. The wave function of the total system is antisymmetric under exchange of participating electrons. This implies that there is effectively exchange interaction between the hole and electron that occupied it.


How to solder WS2812b LEDs(individual,not a strip) to a PCB?

Question: I wanted to do a project using these ws2812b leds, and I find them nearly impossible to hand-solder them because of the tiny contact points. Can someone teach me how to solder these by hand? They are surface mount components as you can see in the images.
Comment: It'll take some practice, but what I would do is put down a little bit of solder on the PCB at pin 2 or 4 (assuming potential for ground or power pours requiring more heat). Then, place the component on top and heat up the bit of solder and the pin simultaneously for about 10s, while lightly pressing on the LED. once the first pin is secured go around and do the rest. Alternatively, use a bit of kapton tape and tape it down then go around pin by pin. The key is heating both the pad and the pin so that solder wicks up onto the pin to make the connection
Comment: @ks0ze 10s is *far* too long.
Comment: I do it the same way with these and other smt parts, put solder on one pad.  When I bring the part in warm it with the iron and center the part.  With these parts they were easy to damage with too much heat or too long, burned up a few of them before I figured that out.  Now you have the fun of trying to remove one (even more fun that putting them down in the first place).  If you see a wave of heat pass across the window and change the color of the logic/planes inside, you might have damaged it completely or perhaps just one of the colors.
Comment: I use the tape solution as well sometimes for more than two pad components.
Answer: I assume you don't have an SMT rework station :)
Put some solder paste on each pad. Place the part on the board. Use a toothpick or something similar to hold it in place, and use your iron to melt the soldering paste on each pad individually. I would guess about two cubic millimeters. If you are not happy with the result, you can touch up each pad individually. Use plenty of flux for the touch-up.
Practice on a scratch board with a dead part first, as it's easy to mess it up if you haven't done it before (but then again, how would I know :) )
Comment: Sounds like a good idea, thank you!
Answer: Assuming you have clean PCB and diode, and you don't have any special equipment other than soldering station and small chisel tip. If you don't have soldering station, buy one, even a cheapo from AliExpress.
These diodes aren't hard to solder at all. They have huge pads which extend outside the package. With a tiny bit of technique this can easily be done.

If you design the PCB, ensure that pads are larger than the diode so that you can touch the PCB pad with your soldering iron and not just LED pad.
Add flux onto PCB pads
With your soldering iron, add a tiny bit of solder to each of the pads so that each has noticeably convex amount of solder. There should be just enough solder to coat LED pad and not more than that.
Add more fresh flux (you can never have too much flux)
Place diode and delicately press it (so that it doesn't move anywhere) while you
Delicately touch either just the PCB pad or both PCB pad and LED pad with your soldering iron, at the same time. Wait just enough for the solder to melt and visibly coat the LED pad. With well set temperature this should take half a second to a second.
Clean the flux off the diode and the PCB

Some notes:

If you don't have good technique, you will be safer using leaded solder. Leaded solder melts in lower temperature which means you have more margin for error before you destroy the LED. I use leaded solder exclusively because it makes my life easier.
Set correct temperature on your soldering station. You want it just enough to melt the solder comfortably and that's it. Each station reacts differently and will require different setting, and frequently also different setting depending on what you are soldering. You need to experiment with it.
Comment: The only thing making these kind of LEDs harder to solder is that they don't like heat much at all, so you pretty much only get one chance to get it right. Re-heating it multiple times might damage the component. Apart from that, these are indeed not hard to solder at all.
Comment: I'd agree apart from the "tin all pads" bit. You should apply solder to one pad only, first, just to hold it in place. That way the device will be flat to the board when you then solder the others. Otherwise it will be hard to get it to sit flat without repeated re-heating (and possible melting).
Comment: The reason to "tin all pads" is that you only have two hands and that it is much easier to judge and handle good amount of solder when it is on the pad vs when it is on the iron. When you have right amount of solder on all pads, you put flux on them, place the part, keep the part pressed with your one hand and use the soldering iron with the other hand to reflow the solder that already is on the pads. You don't have to bring any new soldier from wire (which would require third hand which most of us don't have) and it does not require you to bring solder on the soldering iron (which is finicky)


Switch user for executing processes with API on Nginx/Ubuntu

Question: I would like to create an API using Nginx (on Ubuntu server) that is able to run processes (execute commands) but www-data is not a user that has access to the data these processes will work on. What is the usual way to do this without compromising security. In other words, how can I make the API execute commands as another user?
Answer: www-data is just the user that runs the NGINX process by default, I assume your API is running behind NGINX, then your API would execute as www-data. In order to solve what I assume is a permission problem you are having when testing you need to change the permissions of your data (if local) to allow www-data user and/or group to read/write or creating a new user for NGINX to run.
A few pointers when working with an NGINX:

Don't give root access to the user running your web server, because then your web application would have root access over your system, opening up unnecessary vulnerabilities.
Don't make your data public (open permissions for all users) but restrict them to the owner and specific users that will be accessing them, even if you think your server is secured.

If this is not what you are looking for, please elaborate to get better and more accurate answers.
Edit: realised that I never gave you the commands to switch user:
To modify permissions on a file you can use chmod and chown, for example to change permissions of files to the www-data user:
<code>chmod 500 file1 file2 file3
chmod -R 500 directory1/

chown www-data:www-data file1 file2 file3
chown -R www:data:www-data directory1
</code>
Should get you started!
Regards
Comment: If the data is written by your API, it should automatically get the required permissions to be read later on, assuming the API is run behind the NGINX, if its an external system if would suggest making the user that system run part of the www-data group so even if he writes with his own permissions the NGINX will be able to access the new data.
Comment: This I understand but, on a daily basis, new data under the non-www-data user get written on the location to be worked on, how would I deal with that...
Comment: In that case just adding that user to the www-data group is not enough. Each file/folder also needs to have that group set... which is not automatically done. Should I do this with like a group mask or something?
Comment: No, you add www-data to whatever group is being set when creating the files, that way each folder/file has it and your nginx is automatically allowed
Answer: Maintaining a job list on the executing server and running the jobs (commands) locally with e.g. cron sounded like a nice way of doing it. Completely separating the API that creates the commands and the data to work on. No need for masking and massive chmods etc al the time...


Using lazy initialisation with namespaces in Javascript

Question: I'm running into a couple issues with JavaScript, namespaces and minification/concatenation. I have no control (at least I don't want to have any) over in which order the files get concatenated. Using a namespace function which simply returns an object when given a string such as 'com.example.ExampleClass', a 'class' might not be defined when I need it in another one.
Suppose I have a DocumentProvider object, which needs functionality from EventDispatcher. But, in my current setup, DocumentProvider is concatenated before EventDispatcher. I want to define this functionality on the prototype, so I can't extend it in the constructor.
So, my proposed solution is to use lazy initialization:

Define a top level namespace(alias, factory) function
Use pseudo-overloading in namespace to either assign a factory to the
specified name or return the object created by the factory

Alternatively I could split it up in define(alias, factory) and import(alias). Better for readability, more polluting of global space.
My question is: am I overengineering? Are there better, simpler, more 'standard' solutions to this problem? And what's the risk of namespace functionality (with a different implementation) being added to the language?
Answer: Check out RequireJS It may save you a lot of time.


How to gain strength and muscle with a power twister workout?

Question: I've been doing power twister workout for the last 3 months and I noticed that I'm gaining strength, but no muscles (chest and arms). For the workout I'm using a 30kg power twister. I just bought a 60kg one, but I cannot bend it at all. Do you have any specific workout routine (using ONLY power twister) targeting chest, arms and a bit of the back?
Comment: How did you determine that you have not gained any muscle mass?
Comment: Why not consider alternative routines for strengthening supporting muscles that might help you get to a point where you can bend the 60kg bar?
Answer: I think it's quite natural you've gained strength and no muscle mass. You're getting more and more able to use the same muscles more efficiently. That's what isometrics do. They increase muscle fibres recruitment. That's what you've been doing.
I owe these infos to this wonderful guy that spoke about it in YouTube: https://youtu.be/RwHbWUXz98I


Difference between ethics and bias in Machine Learning

Question: I'm confused about the difference between "ethics" and "bias" when those concepts are discussed in the context of Machine Learning (ML). In my understanding, ethical issue in ML is pretty much exactly the same thing as "bias": say, the model discriminates people of color and this is the same as to say that the model is biased. In short, "ethics is always a bias, but it is not necessarily true that a bias is always an ethical issue". Is this true?
Comment: I would say No, many ethic questions are not directly bias related. If you supose your ML is perfect (which is impossible) you still have ethis questions: Examples: Is it ethic to let a ML choose who will get the job ? Is it ethic to let the ML driven car crash the driver or pedestrian in case of unavoidable crash ?
Comment: Per my answer, [this researcher](https://sites.google.com/site/zliobaite/non-discriminatory) focuses on Ethics, transparency and accountability of AI. It can be a start for a more rigorous approach to discrimination in machine learning.
Comment: "Bias" might also have the definition from statistics that the expected value is not the true value. Watch out for if the term is used in a mathematical or colloquial context.
Comment: Thank you Dave! But this is not what I'm asking. I'm asking about the case when ethics issues are NOT biases: do these cases exist?
Comment: You may be interested in a [post](https://stackoverflow.blog/2022/05/30/ethical-ai-isnt-just-how-you-build-it-its-how-you-use-it/) about ethical ai
Answer: The term bias is, to my knowledge, not related to ethics in the context of ML. Instead, it usually refers either to the bias–variance tradeoff or to a learnable parameter of a model, e.g. bias in a neural network. (Note that in statistics the term is commonly used to refer to biased estimators which is related to but more general than its use with regards to the bias-variance-tradeoff.)
In contrast, when making a connection to ethics (aka fairness) you most likely use the term in a more general way or how it commonly used in science. (But it is important to note that this is not what bias refers to in ML.)
However, even when applying the general scientific definition of bias its relation to ethics/fairness in ML is limited:

Let's assume you apply a model to classify images of chairs and tables. If your dataset contains 99.999% chairs the naïve classifier which always predicts chairs would perform very well in terms of accuracy. (side note: let's ignore the fact that "very good" is task-specific and accuracy might not be the best metric here)
This model would be very biased towards chairs in the general meaning of the term. However, we would not consider this an issue of ethics or fairness (unless you're a big fan of tables).

Now let's assume that you have a model applied in a self-driving car task. One could think of a situation where the model needs to decide to either run over a group of two people or a group of three people. The decision the model has to be made is an ethical ML problem. (probably it's actually an AI issue, i.e. involves other sub-fields of AI too since self-driving cars usually apply techniques from multiple AI-fields and not just ML) Clearly, this is an ethical problem independent of any bias, i.e. you can have ethical considerations in ML without necessarily involving bias.

As the above two examples show you can have ethical issues in ML without bias (in the general sense) and vice versa.
Answer: I'd say the reverse is true: "bias is always an ethical issue, but it is not necessarily true that an ethical issue is always a bias".
"bias is always an ethical issue" because like you said, a model may discriminate against people of color when it comes to hiring, for example. Even if the model is correct (this is very unlikely and if it happened it is caused by confounding variables obviously), it is unethical to decide not to hire someone because of their skin color. More generally, we should not leave out a group of people entirely.
"an ethical issue may not be a bias" because there are many ethical issues related to Machine Learning that do not involve bias. For example:

Government Surveillance: the government uses cameras incorporated with facial recognition to track activities and location of certain people of interest.
Deep fake videos: a video of a person in which their face or body has been digitally altered so that they appear to be someone else, typically used maliciously or to spread false information. (example: https://youtu.be/bE1KWpoX9Hk)
Comment: Nice youtube video!
Answer: There is a confusion between "bias" in the mathematical/statistical sense (that is the difference between 2 values) and "bias" in the psychological/social sense which means prejudice. In fact the two can be related in all sorts of ways, not in a simple one-to-one sense.
For example a biased model (in the mathematical sense) may counteract the effect of social prejudice (eg because the data are imbalanced due to social bias, so another bias can equalize this), while another unbiased model may support social bias/prejudice effects. The other way is also possible. There is no simple one-to-one mapping.
This researcher focuses on Ethics, transparency and accountability of AI. It can be a start for a more rigorous approach to discrimination in machine learning.
See also: What is Inductive bias?
Answer: In statistics bias is often used to refer to a statistics inability to measure the true population value of the statistic. This is usually shown analytically by computing the expected value of the statistic. If it is equal to the true population parameter, it is 'unbiased'.  This is sometimes hard to do, so you can sometimes use simulation to look at the resultants distribution to see if it looks biased or not. Small biases will usually not matter.
This also translates to machine learning. If your sampling method is bad, your statistics (means, correlations, models) will always be bad because your sample may not reflect the population. If you choose different models, most likely it will favor certain groups over others.  Sometimes this is by optimization, but often it can just occur randomly.  If you omit an important variable from a model, it may be biased towards one group, and if you then include the important group it may eliminate the bias to the group, or it may increase the bias toward the other group. You never really know how bias will work. You just need to be aware if it. Bias in statistics is not inherently right or wrong. But ethics is a different matter. That usually includes a statement of fairness and equity.


Is the gom player and codec safe to download?

Question: is the gom player and codec safe to download?
Answer: Assuming you're talking about the one from Gomlab, yes. It's a nice player, it seeks well and it's small.
VLC still plays more file-types out of the box and tends to be the player I recommend as part of a coin flip with with MPlayer.
Comment: ya, highly recommend VLC player...+1


Find the Fourier Transform of $e^{i x t}$.

Question: Find the Fourier Transform of $e^{ixt}$, where $x$ is a real parameter, $t\in \mathbb R$. I started writing:
$$\int_{-\infty}^\infty e^{ixt} e^{-i\omega t}dt$$
but I do not know how to go on!
Comment: In the distribution sens this is Dirac: $\delta_x$.
Answer: $$\int_{-\infty}^{+\infty} e^{ixt} e^{-i \omega t} dt=\int_{-\infty}^{+\infty} e^{ixt-i \omega t} dt=\int_{-\infty}^{+\infty} e^{i(x- \omega )t} dt=2 \pi \delta(x- \omega)$$
EDIT: It is known that:
$$\delta(x-a)= \frac{1}{2 \pi}\int_{-\infty}^{\infty} e^{ip(x-a)} dp$$
Comment: Just curious, how would you justify the value of this integral at any other point than $x = \omega$? I can't see how it converges.
Comment: For $x=\omega$,the integral is equal to:

$$\int_{-\infty}^{+\infty} 1 dt$$
and so,obviously,it does not converge.Also,the integral diverges for $x \neq \omega$.The fact that $||e^{i(x- \omega)t}||=1$ is enough,to conclude this.
Comment: That is true, and I have no trouble accepting this. However, at the _other_ points? I cannot see the integral converging to any one value. So, at $x = \omega$, I can buy the $\delta$-evaluation. But why is it chosen to be zero everywhere else?
Comment: We know that:

$$\int_{-a}^a e^{it} dt=2 \sin a$$

and the limit $a \to \infty$ does not exist.

So,the integral does not diverge for $x \neq \omega$
Answer: Using the inverse Fourier transform, you may write (everything in distributional sense)
$f(x)=\frac{1}{2\pi}\int_\mathbb{R}e^{ixt}\int_\mathbb{R} e^{-i\omega t} dt d\omega =\frac{1}{2\pi}\int_\mathbb{R}(\int_\mathbb{R}e^{ixt} e^{-i\omega t}dt) d\omega=\frac{1}{2\pi}\int_\mathbb{R}\delta(x-\omega)f(\omega)d\omega
$
And therefore your Integral equals $2\pi \delta(x-\omega)$ in the distributional sense.


Cardinality of a linear continuum

Question: A linear continuum is a totally ordered set with more than one element, which is both dense and satisfies the least upper bound property. Is it true that every linear continuum has the same cardinality as the reals?
Answer: No, there are larger linear continua. Let $\kappa$ be any infinite cardinal; then $X=\kappa\times[0,1)$ with the lexicographic order is a linear continuum. It's easily seen to be densely ordered. If $A\subseteq X$ is non-empty and bounded above by some $\langle\alpha,x\rangle$, let
$$\beta=\min\left\{\gamma<\kappa:\big(\{\gamma\}\times[0,1)\big)\cap A=\varnothing\right\}\;.$$
If $\beta$ is a limit ordinal, then $\sup A=\langle\beta,0\rangle$. If $\beta=\gamma+1$ for some $\gamma<\kappa$, let $$S=\{y\in[0,1):\langle\gamma,y\rangle\in A\}\;.$$ If $\sup S=1$, then again $\sup A=\langle\beta,0\rangle$. Otherwise, $\sup A=\langle\gamma,\sup S\rangle$.
Comment: @BrianMScott:  So what extra axioms must one add to those for a linear continuum to insure that its models are all isomorphic to $\mathbb R$?
Comment: Can a linear continuum be countable?
Comment: @Sushil: (I must not have been around when you posted your question.) This is very late, but for the benefit of future readers, the answer is *no*. Every countable dense linear order is order-isomorphic to $\Bbb Q$, $\Bbb Q\cap[0,1)$, $\Bbb Q\cap(0,1]$, or $\Bbb Q\cap[0,1]$, none of which has the least upper bound property.

Cardinality of a linear continuum


PDF fails to render correctly in Web App

Question: I have a pdf opening from Sharepoint 2013 being displayed in the office web app. It displays text as squares instead of actual letters.  The font used in the file is Arial, strangely some of the text renders correctly, even though it is also the same Arial font as the 'square' text.
On the left is the in the Web App, on the right I've downloaded the file and am viewing it from my local computer.

I am using Windows 10.
Some info on the pdf file itself, it was created from a Word document, being converted to pdf using Abode InDesign.  I don't know much about Adobe and have never used InDesign.
URL Testing
This works (i.e. just clicking on the file name to open it): https://CONTOSO/deptsite/Shared%20Documents/Mutual%20Exchange%20Policy.pdf
This does not work: https://CONTOSO/deptsite/_layouts/15/WopiFrame.aspx?sourcedoc=/deptsite/Shared%20Documents/Mutual%20Exchange%20Policy.pdf&action=default
This also does not work: https://CONTOSO/deptsite/_layouts/15/WopiFrame.aspx?sourcedoc=%2Fdeptsite%2FShared%20Documents%2FMutual%20Exchange%20Policy%2Epdf&action=view&source=https%CONTOSO%2Fdeptsite%2FShared%2520Documents%2FForms%2FAsset%2520Management%2Easpx
Possible Explanations

Wrong settings used in Adobe InDesign when saving the Word file as a .pdf?
Something wrong in Sharepoint web app (yet all other pdfs display correctly)....
o The font is not unusual, it is just Arial, so is standard.

Research
This MS link suggests a problem with Middle East and Asian fonts, not applicable to me as my file is in English and is using Arial.  Though I am using Windows 10.
Answer: I don't have a definitive answer, but I suspect the issue was caused by the software used to create the pdf.
If someone else has trouble with this, then try recreating the pdf with different software.


If force is a localized vector, what does it's resultant mean?

Question: And how is the resultant formally calculated?
Why do we treat force as a free vector when writing down Newton's Laws of motion?
Comment: Possible duplicate of [Why is force a localized vector and not a free vector?](https://physics.stackexchange.com/questions/139824/why-is-force-a-localized-vector-and-not-a-free-vector)
Comment: @David Hammen That doesn't answer my questions
Answer: As far as you are not concerned with rotations, you may treat forces as free vectors. Because, you know, translational motion is only determined by magnitudes and directions of applied forces.
However, when you want to investigate rotations, you have to treat forces as localized vectors, because what determines rotation is not force per se, but, rather, torque. And torque somewhat depends on point of application of force.
The reason I'm using the word "somewhat" is that you may still move forces around but in a very limited way: each force may be translated only along the line of that force.
As for the resultant, when you are concerned with rotations of an object, you calculate resultant treating forces like free vectors, but you have to localize resultant at the point, where lines of forces intersect (refer the figure, where $R$ is a resultant of $F_1$ and $F_2$). Your object will not rotate if and only if line of resultant force goes through the object's center of inertia.