How to disable line wrap in TextEdit

Question: I can not find a settings in TextEdit to disable line wrap. I have found only wrap to page/window.
Answer: This isn't possible and you can't even dig into the plist file to override this behaviour. But you can get close.
In File → Page Setup create a Custom Page size with absurdly huge margins:

Now select Format → Wrap to Page and TextEdit will now have horizontal scroll bars, but you'll be stuck with an annoying whitespace on the top and left side of the page.
Comment: ugh! i could have sworn there used to be a way to do this.  or maybe i'm thinking of some equivalent in another OS...
Comment: looks like when you revert to the disk copy it "forgets" that you have set it up to wrap to page, so you have to do it again.  not terribly helpful when an external process is frequently updating the file!
Comment: I've switched from Linux to a Mac a few weeks ago and it still annoys me how many obvious things are impossible* on this system.

*I know it's not impossible, I can always download a different program. But come on, it's such a basic feature!
Answer: Another suggestion is to try smultron.
I don't think textedit is designed to be much more than demoware.
Comment: Feature anemic demoware; pretty useful term there.
Comment: Thanks, I got another suggestion to try smultron, I have already installed it.
Answer: I know that this does not answer your question, but let me suggest you TextWrangler as a free and more featured alternative to TextEdit.
Hope it helps.
Comment: Thanks Pablo, I am actually looking for less features, not more. :) I will take a look at TextWrangler.
Answer: There's actually a weird bug/behavior in TextEdit on Mac which frustrates me to no end!  If you zoom in or out in TextEdit, it breaks the word-wrapping feature, dead.
In other words, to get the behavior you want, simply do the following:

View -> Zoom Out
View -> Zoom In
If not on 'Format -> Wrap to page', switch to it first*
Format -> Wrap to Window *

(* This is because you have to toggle in and out of 'Wrap to Page')
Bam. No more word-wrapping.
Just tested this on both High Sierra and even Mojave. Same thing.  Set that up as a macro using Automator and you can execute it from the services menu or even via a keyboard shortcut.
The down-side is there's no way to re-enable it short of selecting everything, then pasting it into a new document, or saving, then re-starting.
Comment: this doesn't work for me on High Sierra
Comment: I just tried it and it still works as described on 10.13.6.  Again, you have to use View->Zoom Out menu, not the keyboard shortcut.  They have it connected differently for some reason.  The former zooms the window's view area (allowing the trick) while the latter actually increases the text size.
Comment: Of course the real solution is to just switch to VS Code anyway! :)
Comment: Yup, on Mojave here, and get this exact bug.
Comment: It doesn't work on my High Serria and I believe that it wouldn't work anyway due to the very high number of columns of my text file.
Answer: The following works to make lines wrap to a very large number of characters, similar to the way it is done in Notepad (there text wraps to 1024 characters):

Set text size to 2 (setting size to 1 leads to aliasing issues).
Zoom in until the text size is what you like.

The text wraps to the window when the zoom is at 100%; therefore, when you zoom in, the amount of text on a line does not change.
Ultimately, you can control how much text fits on a line by changing the font and/or the size of the window.
Also, here is a better-explained version of Mark A. Donohoe's answer; however, since it only works in order to yield a disabling of word wrap for a single document, until you close it (and only on some systems), I use my method instead.
1) Zoom out until you believe your whole document width can fit in your window.
2) Shift + ⌘ + W to zoom to paper size, then again to zoom to window.
3) If your whole document width does not fit in your window, go back to step 1.
4) Do View -> Zoom In until you get your desired size.
Note: Do NOT use the keyboard shortcut to zoom in.  When you use the keyboard shortcut, the Mac re-wraps the text after zooming in; on the other hand, if you do View -> Zoom In in order to zoom in, it does not.  As a result, what you get is a real-sized copy of the text to which the wrap was applied when it was zoomed out.
Answer: I just discovered a neat trick that seems to workaround the wrapping issues (only good for one document at a time perhaps): select the entire document, then right click in the tabstop pane and create a bunch of left tabs extending out to the width that you desire (or perhaps just one really far out to the right).   TextEdit will not auto-wrap text that is within the right-most tab!

How to disable line wrap in TextEdit


iTunes File Sharing - Microsoft Office?

Question: Does Microsoft Office for iOS support iTunes' File Sharing feature?
Comment: What's your definition of Office for iOS? There are some apps that come to mind, but there's no guarantee any / all support that feature. Also, the apps don't even work without some sort of subscription. Which subscription type are you going to choose?
Comment: I am talking about Word, PowerPoint, and Excel for iOS. Those apps work without a subscription. When they were first released, they could only be read without a subscription, but that has since changed.
Comment: Thanks - I was glad to find the current versions don't need a log in to view files.
Answer: PowerPoint v 1.13.1 on iOS 9.0 works with iTunes 12.3 to transfer files over USB to the app. You can view them in view only mode without needing an account or log in.
It's highly likely the rest of the apps work as well for iTunes to transfer files to and from the iOS to a computer.

iTunes File Sharing - Microsoft Office?


Sort "My SharePoint Sites" list in "My Links"

Question: Anyone know of any way to get the "My SharePoint Sites" list that is generated and shown in the users's "My Links" to be sorted alphabetically?  They seem to display in a random order by default.
Answer: When you open the master page in sharepoint designer can you see the datasource for the list.
Try and set and order by at this level.


How can I stay on my IP longer than 10 minutes?

Question: I need to stay on an IP for longer than ten minutes to finish a download. Can I tell Orbot to stay on the IP for a fixed time? I'm running Orfox on Orbot for Android. Thanks,
Brian
Answer: You won't change IP mid-download.
Tor considers creating new circuits by looking at the 'dirtiness' of existing circuits. If a new connection request is received and the current circuit is more than 10 minutes old, it will build a new circuit for the connection. However any connections which are on the old (>10 minute) circuit will be unaffected.
If you are experiencing breaks in connectivity, it is unrelated to this property. Adjusting this property will make your circuits look different from all other Tor users and as such will potentially catastrophically affect your anonymity set, it is not recommended to do this.
Tor Browser uses the KeepAliveIsolateSOCKSAuth SOCKSPort flag to achieve long-term sessions. Since Tor Browser uses SOCKS5 authentication to isolate connections between hosts, each time a new connection is made to the same host the "dirtiness" is reset to 0. This means that as long as connections are actively happening within the 10 minute period, the circuit will remain open indefinitely. This improves user experience for websites which link IP addresses to login sessions for Tor Browser users.
This may be the solution you are looking for but I am unsure if Orfox is yet using SOCKS5 isolation, as I understand it is still under heavy development but as explained above: I do not believe that your problems are related to changes in circuit and you should look for other possible problems first.


Cannot remove AWN and desktop messed up

Question: I recently installed AWN after reading an article on OMGUbuntu. It looked very good in the pictures but I didnt like it at all. I couldent remove it and it replaced the status bar and the Applications menu. I went into the settings and told it to not begin on startup, rebooted, and logged into a destop with no menu bar, applications, and I'm limited to a few folders on my desktop and terminal. PLEASE HELP!!
Answer: what version of Ubuntu you're using ?
I guess its having unity , then do as in your terminal
<code>unity --reset
</code>
then give a restart .
Answer: This question was asked a long time ago, but the answer given did not help me. I am using Ubuntu 12.4. Here is my solution, I opened Ubuntu software center, located the offensive installation, and clicked the REMOVE button. I then did a system restart and upon reboot, I am happy to report that awn was gone. Sorry I'm late but I was using windows and didn't know any better.

Cannot remove AWN and desktop messed up


passing parameter from one batch apex into another batch apex

Question: I want to know whether it is practically possible to pass a parameter from first batch apex into second batch apex. I do not want code but a brief concept would be greatly helpful.
Answer: Yes, you simply pass the values to the next batch, typically in the constructor.
public class Batch1 implements Database.Batchable<SObject> {
  Integer veryImportantValue;
  public Batch1(Integer someParam) {
    veryImportantValue = someParam;
  }
  // omitting start and execute
  public void finish(Database.BatchableContext context) {
    Database.executeBatch(new Batch2(veryImportantValue));
  }
}

The first batch would be called with the parameter:
Database.executeBatch(new Batch1(42));

Comment: @PoojaBiswas Anything you set before start method runs will be available in the finish method without Database.Stateful. This will improve performance. You only need to use Database.Stateful if you need to modify the variables during the execute method.
Comment: thanks for your prompt reply. I have one doubt, do we need to sue database.stateful to maintain the state of across transactions?
Comment: thanks, there's one more thing I would like to ask, its a separate topic. I hope u dont mind. what is Test.isRunningTest() method used for. how can I use this in batch apex and callout?
Comment: @PoojaBiswas You shouldn't use Test.isRunningTest for callouts usually. You should be able to test it with just Test.setMock.
Comment: can we use Test.isRunningTes() to check of first batch has completed and then start the second ?
Comment: @PoojaBiswas You can't run more than one batch per unit test using Test.stopTest, so you'll have to have multiple unit tests.
Comment: Think you need `Database.Stateful` to carry the field value across to the `finish` method.
Comment: @KeithC Read [Using Batch Apex](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_batch_interface.htm). Too long for a comment, but when you don't use Database.Stateful, variables that are set before start method remain set, but cannot be modified, between each call to execute. They include some example code.
Comment: @sfdcfox Thanks, didn't know that (and should have read the earlier comment more carefully).


Using "might have been" in the present perfect

Question: How do we use "might have been" in the present perfect? For example, "The door might have been closed". How can we say this in the present perfect? Or is it already in the present perfect?
Comment: I don't think you can use ***might*** in a "standard" present perfect construction, but you could do it with a different word to indicate uncertainty in the statement: ***Perhaps** the door has been closed*.
Answer: In the sentence "The door might have been closed", the main verb is already in the perfect form (the equivalent non-perfect sentence would be "The door might be closed"). However, it is not the present perfect, but the perfect infinitive, since after "might" we use an infinitive form of the verb. There is no need and no way of shifting the sentence to the present perfect, since the overall verb phrase here already includes a perfect construction.


Rig moving to another location in edit mode

Question: I was rigging a character. After my rigging was finished I got out of edit mode and the rig moved away from the character. If I move the rig and align with the character in object or pose mode. The rig move in edit mode. Even if I reset the origin it does not work. My enter code here question might not be clear just open my file and answer my question.
Here is the link:
https://drive.google.com/file/d/1_WGivtF_Y7PThvR8xbzmY_8rPUjVRePH/view?usp=sharing
Comment: did you try to delete all keyframes? i didn't see a problem after that
Answer: You've moved your armature in Pose mode, so it is not aligned with the Rest pose anymore. The Rest pose will show the bones as they are in Edit mode. To reset the bones position, select them all in Pose mode and press AltG (reset location), AltR (reset rotation) and AltS (reset scale).
Comment: Thanks it worked. After reseting things in the rig another problem came up. I was not able to select any object. Then I restarted blender and everything was fine.


Big endian or Little endian on net?

Question: In what byte order does data transfer occur on net? Is it Little Endian or big endian? How is it converted  to the respective byte order once the data reaches the host ?
Comment: can you explain a bit more? tcp/udp?
Comment: reaches the host from where / how?
Answer: "Network byte order" is Big Endian, and protocols such as TCP use this for integer fields (e.g. port numbers). Functions such as htons and ntohs can be used to do conversion.
The data itself doesn't have any endianness it's entirely application defined, unless you're using a Presentation Layer such as XDR.
Answer: Its transferred in whatever order you send it.
Traditionally, internet protocols use big endian, because the machines doing most of the communication were big endian.
However, if you define your own structures to send across the net, there is no need to follow that convention.
With C programming, typically, one often uses the htons or ntohs macros to do the conversion.
Answer: if you are using tcp using htons((short)port) enables you to use network safe protocol(basically big endian) and dont care about little vs. big endian.
if you do need to convert use
http://www.codeguru.com/forum/showthread.php?t=292902
Its explained well

Big endian or Little endian on net?


KL divergence vs Absolute Difference between two distributions?

Question: Why should I use KL divergence over just giving the abs difference from two PDFs?
Comment: BTW, can you tell more about what is "absolute difference" for two PDFs?
Comment: See:  https://stats.stackexchange.com/questions/188903/intuition-on-the-kullback-leibler-kl-divergence/189758#189758
Answer: Kullback-Leibler (and other information theoretic divergences, the $f$-divergences) is linked to the Fisher Information: KL is locally an approximation of the Fisher-Rao geodesic distance, which is a Riemannian metric parameterized by the Fisher Information matrix. It has the property to be the only Riemannian metric (up to a multiplicative factor) which is invariant to reparameterization of the parameter space (in case of a parametric distribution).
Also, and this is important here, the divergence KL (and $f$-divergences) can be seen as diverging by the 'right' amount with respect to 'information' / statistical uncertainty: if you have a parametric distribution, paramaterized by $\theta$, and you estimate $\hat{\theta}$ with an unbiased estimator, then the Cramer-Rao lower bound tells you that $\mathrm{var}(\hat{\theta}) \geq \frac{1}{I(\theta)}$, where $I$ is the Fisher Information matrix parameterizing the KL divergence $\mathrm{KL}(\theta \| \theta + d\theta) \approx \frac{1}{2}\theta^\top I(\theta) \theta$.
Information Geometry is the field which investigates this kind of questions.
If you require a symmetry, you either symmetrized KL, it is called the Jeffreys divergence, or use Hellinger (which is also a $f$-divergence and a proper metric distance).
Answer: The empirical value of KL divergence is what maximum likelihood estimation tries to minimize. That is,
$\max_\theta \sum_{i=1}^n \log p(X_i|\theta)$  is equivalent to $\min_\theta \sum_{i=1}^n \log \frac{q(X_i)}{p(X_i|\theta)}$ (under regularity conditions).
If you wonder why this is related to KL divergence, note that $KL(q || p_\theta) := E_q[\log \frac{q(X)}{p(X|\theta)}]$.
Here it is assumed that $X_i$'s are i.i.d. samples from the distribution $q$.
And maximum likelihood estimators have good properties.
(In response to another answer)
@mic
(I can't comment yet, so let me add this here)

It has the property to be the only Riemannian metric (up to a multiplicative factor) which is invariant to reparameterization of the parameter space (in case of a parametric distribution).

Could you add a reference to support this? Because as far as I understand, this property has been proved only for the space of finite-dimensional, discrete distributions. (Well, maybe this is due to my limited knowledge, so one should check out anyway)
Edit
From an engineering point of view, there are alternatives to KL divergence too. One such an example is called Pearson divergence.


Boot CD for ia64

Question: I'm looking for rescue or live CDs for Itanium servers, but the only bootable CDs I've found are the distros installation CDs. Mainly I want to clone the servers disks, and also check memory or disk bad blocks. I've tried with the same CDs I use on x86-64 but none of them have a version for ia64.
Any recommendation?
Answer: At least the Debian text installer has a "rescue mode" giving you a shell with a handful of useful commands. It is not as comprehensive as SysRescueCD, but hey, it's precompiled for ia64. I believe Gentoo has something similar. There also is a memtest binary for ia64, but I do not know if it is part of the rescue mode shell as well.
Comment: Debian 6.0.3 installer in rescue mode worked fine for cloning disks (I needed badblocks and dd mainly). "fdisk -l" didn't work but "cat /proc/partitions" did
Answer: Pretty old-school, but there's the Gentoo live CD build for ia64 from 2007.

Boot CD for ia64


How to get the Disk Image property using terminal?

Question: Let's say I have the volume path.
Normally I can right-click and 'Get info' to get its Disk image.
I want to replicate the same on terminal (basically need to code it in objective C)
mdls doesn't seem to helping. Not xattr, putils etc.
Comment: Most of the data found in the GetInfo window is filesystem metadata. From the command line you can use `stat` , the only info missing would be the `Where:` label which you can use `hdiutil info`.
Answer: The Disk Utility application shows the following on my Mac.

If I select "Get Info" on Marlin, I get the following popup.

I can also get information about the volume labeled Marlin by entering the following command in a Terminal application window.
diskutil  info  Marlin

Doing so produces the following output.
   Device Identifier:        disk0s4
   Device Node:              /dev/disk0s4
   Whole:                    No
   Part of Whole:            disk0

   Volume Name:              Marlin
   Mounted:                  Yes
   Mount Point:              /

   Partition Type:           Apple_HFS
   File System Personality:  Journaled HFS+
   Type (Bundle):            hfs
   Name (User Visible):      Mac OS Extended (Journaled)
   Journal:                  Journal size 24576 KB at offset 0x64fa5000
   Owners:                   Enabled

   OS Can Be Installed:      Yes
   Booter Disk:              disk0s5
   Recovery Disk:            disk0s5
   Media Type:               Generic
   Protocol:                 SATA
   SMART Status:             Verified
   Volume UUID:              E0633113-8178-33A2-8ADF-95B61C49FD19
   Disk / Partition UUID:    398EA755-F8F5-403B-B946-0C75B5AD2783
   Partition Offset:         149075562496 Bytes (291163208 512-Byte-Device-Blocks)

   Disk Size:                250.0 GB (249999994880 Bytes) (exactly 488281240 512-Byte-Units)
   Device Block Size:        512 Bytes

   Volume Total Space:       250.0 GB (249999994880 Bytes) (exactly 488281240 512-Byte-Units)
   Volume Used Space:        237.4 GB (237416558592 Bytes) (exactly 463704216 512-Byte-Units) (95.0%)
   Volume Free Space:        12.6 GB (12583436288 Bytes) (exactly 24577024 512-Byte-Units) (5.0%)
   Allocation Block Size:    4096 Bytes

   Read-Only Media:          No
   Read-Only Volume:         No

   Device Location:          Internal
   Removable Media:          Fixed

   Solid State:              No
   Hardware AES Support:     No

Which is basically the same as using the Disk Utility application.


How to prove that the transpose operation maps an arbitrary qubit to its complex conjugate?

Question: How to prove that the transpose operation maps an arbitrary qubit to its complex conjugate, $|\psi^*\rangle \rightarrow |\psi\rangle$
Comment: In case you're not aware if it: please note that the transpose is not a valid quantum map, as it is not completely positive.
Answer: Think about that projector
$$
\rho=|\psi\rangle\langle\psi|.
$$
Note that this is Hermitian, $\rho^\dagger=\rho$. Take the transpose,
$$
{\rho^\dagger}^T=\rho^T
$$
but since the hermitian conjugate is the complex conjugate transpose, ${\rho^\dagger}^T=\rho^\star$.
If you want to see what pure state $\rho^\star=|\phi\rangle\langle\phi|$ corresponds to, think of $\rho$ as a matrix and find a non-zero column. That column is proportional to $|\psi\rangle$. The same column of $\rho^\star$ is proportional to $|\phi\rangle$. It should thus be clear that $|\phi\rangle=|\psi^\star\rangle$.
Answer: This question makes more sense in density matrix notation. You can then ask how to prove that
$$ (|\psi\rangle\langle \psi|)^T = |\psi^*\rangle\langle \psi^*|.$$
It's not difficult, just write the state in some basis, $|\psi\rangle = \sum_i \alpha_i |i\rangle$, and apply the operations.
Answer: I hope I understoody your question correctly but I think that there is nothing to prove, it is simply a definition.
Lets have a quantum state $|\psi\rangle$ which is described by a column vector. Then quantum state $\langle \psi|$ is defined as $(|\psi\rangle^T)^*$, i.e. coefficients are complex conugate numbers and the column vector is transposed. In the end you, have row vector with complex conjugated coefficients.
Maybe, a thread How does bra-ket notation work? would be helful for getting deeper understanding.


Adding a second Grounding Bar

Question: My current electrical system appears to have the ground and the neutral wires on the same bus bar.  If I had a second grounding bar, do I need to move ALL of my ground wires to the new grounding bar, which in turn would free up space on the ground/neutral bar?
Comment: This seems like a hypothetical question. Maybe you could try to explain what your are trying to accomplish and then maybe you can get some real guidance from the experts here.
Comment: I am trying to add another fixture to my electrical panel, however my current ground/neutral bus bar is full.  I can add the ground wiring but from everything that I am reading, the neutral wire needs to have a dedicated terminal.
Comment: What make and model is your panel? Can you post photos of the labeling on it?
Comment: Also, I take it this is your main panel?
Comment: It is my main panel, the brand is Cutler Hammer, I will have to open it back up tomorrow and try to get some pics.  thanks for the response........
Answer: Your neutral and ground bars must be separated, UNLESS this panel is the main service entrance panel, meaning this is where the line comes in from the utility meter and the neutral is bonded to the grounding electrode conductor (the wire going to the ground rod). In that case, the grounds and neutrals can be mixed on the same bar.
The problem I see is that if you have run out of spaces for both the grounds and neutrals in that panel, there are likely other problems with your system because you should not be able to run out of spaces unless something was done wrong. For example you may have wires doubled up on breakers where they should not have been. Many breakers are NOT rated for more than one wire per lug, those that are tend to come in panels with larger ground and neutral bars. If not that, then someone has installed too many "twin" (1/2 space) breakers to increase the number of circuits beyond what the panel was designed for.
Answer: Since your panel is a main service panel, neutral and ground must have an equipotential bond inside that panel.   As such, it's under an exception that allows all neutrals and grounds to be just spammed together on either a ground bar, or a neutral bar that is grounded.
If you add a ground bar, you can place any neutrals and grounds on it that you please.
However, elegance calls for putting all neutrals on a neutral bar, and all grounds on a ground bar, and then assuring the neutral-ground equipotential bond is intact.  I for one don't believe "green bar-grounding screws" are worth the paper they're printed on, because I've seen ground faults burn the threads off them and they fall out.   I prefer to have one or more heavy wires connecting the neutral to ground bar, and this provides a side benefit: if you suspect ground-fault leakage,  you can put a clamp ammeter around the wire and know for sure.

Adding a second Grounding Bar


Can haptic holograms be used to make something akin to a holodeck?

Question: If the holograms are really advanced like the hologram of Snoke in The Force Awakens and they are haptic, which means you can feel them, can they be used to make an immersive virtual reality enviornment, where you can and not limited to, have sex with any girl you want. Can holograms in theory get sophisticated enough?
Comment: Hello and welcome. Are you sure you need **hard** science on this? It's usually better to ask more general questions as simply science based, and only go for hard if you already have rough draft and basic understanding. Your question shows no background of real life haptic holograms.
Comment: Please read the documentation of the tag [tag:hard-science]. As @Mołot pointed out the requirements for answer to hard-science questions are very high. You need a lot of citations and similar scientific material. It should not be used in conjunction with [tag:science-based]. Please choose one. Hard-science is the one with higher requirements that will probably yield less answers. ALso have a look at the [tour] and the [help] to learn more about the site. Have fun!
Comment: Given enough energy this might be very much possible to recreate. But remember that a virtual reality is cheaper. You can feel the world around you using data gloves. Heck, even hallucinary drugs would be cheaper.
Comment: Just FYI, "hard science" kinda means "can I *actually* do this?", the "science based" tag might be better. **But** having said that, [haptic holograms](https://www.wired.co.uk/article/haptic-japanese-holograms) *are actually a thing*. The colour pallet is limited to... "electric lightning", but you can touch them. Perhaps combine them with one of those MS Hololenses if you want colours other than hot pink/sky blue..
Answer: The question currently has the hard science tag. I've attempted to link to sources where I can, but most of this falls outside the range of current science so sources necessarily don't exist.
Summary
The Star Trek holodeck has three primary technologies required to get the desired results, along with a few secondary technologies.
The most important technologies are non-existent to impossible, while some of the least important technologies are in use right now. In general, I don't think it's likely to be possible as shown in Star Trek.
An alternative to holograms and forcefields is some type of programmable matter such as claytronics. While this would require a tremendous amount of computation and isn't currently feasible, there don't seem to be any physical barriers to the concept.
I believe that between a 3D background and a foreground comprised of programmable matter, along with some type of moving floor to keep the user centered in the room, a reasonable simulation could be constructed. As such, I've put these three sections first.
Following these sections are sections on simulating acceleration (potentially feasible with a high-end centrifuge, but unnecessary for your use case) and on Star Trek-style "holograms" that I don't believe are feasible in real life.
Background Imagery
The background of the holosuite is a 2D image projected such that it appears to be 3D. While necessary for full immersion in a Star Trek Skyrim game, this is the least important aspect for simpler tasks like interactive porn, where the major parts of the simulation are within a few feet of the user and the background can be simple or nonexistent with little practical issue.
The simplest form of this already exists in the real world. Using methods such as shutter glasses, and tracking the current location of the two eyes in the room, the walls can simply be made of high-resolution monitors that display adequately-realistic 3D imagery using methods similar to modern computer games. In this case, the background strobes a "left eye" image while the right eye is blocked by an opaque shutter, then the "right eye" image is strobed while the left eye is blocked. In order to avoid flicker, this needs to be done at 60 to 100 frames per second per eye (possibly as high as 500 fps, but it depends on the technology used to generate images). Difficult, but certainly not insurmountable.
Using advanced technology, you could likely build contact lenses (or internal implants) that act as shutter glasses. These would perform just like existing glasses, but be virtually unnoticeable. While we don't have these yet, there are patents in place for implanted cameras and bionic lenses, leading me to think shutter glasses are very plausible.
A different way would involve the use of tiny laser beams located at each pixel. With two beams at each pixel, one pointed at each eye (again requiring proper eyeball tracking), the image could be constructed like a traditional LED monitor, but the collimated light would restrict the left/right images to the correct eye.
Physically constructing these tiny laser beams might be very hard, so it would likely work better to use tiny, adjustable mirrors and rapidly strobe some more traditional lasers across them from the corners of the room. I've found research on microscopic mirrors used in conjunction with hologram production, but these require a lens between the wall and the user (and use interferometry which is just cool).
These technologies could be expanded to allow multiple people to see simultaneously. Essentially, you just create an image for every eyeball in the room and display it rapidly enough that each person sees a smooth framerate.
The human eye has an angular resolution of about 1 arcminute, or 0.02°. If we assume the room is cube-shaped with square walls, the room is large enough that the user stays roughly in the center of the room at all times, and that the pixels on the wall are of equal size across the wall, we can compute the pixel resolution needed at about 6900 x 6900, which is about 5.75 times as many pixels as a modern 4k screen, or about 30 4k screens to do four walls and a ceiling. While these numbers are high, this is completely plausible with reasonable advances in technology.

Programmable Matter
Programmable matter (linked above, but again here and here for convenience) is a theoretical concept with a decent basis in reality. The basic idea is to build a large number of tiny robots that can be programmed in real-time to move, deform, assemble and disassemble in a way that mimics other objects.
So the 3D image on the wall would assemble into a physical object as the virtual object moved closer to the user than the wall. Likewise, an object moving beyond the wall would disassemble itself as it approached the wall, becoming a purely virtual object again.
The robots would have to be capable of changing their surface textures (mainly between rough and smooth), changing the stiffness between robots (to replicate either soft muscle tissue or a solid metal bracelet), and changing their color (to give visual texture). Even better if they could change their conductivity (mainly heat transfer, so aluminum would feel cooler than cotton, for example), reflectivity (so a wet surface would appear different than a dry one), and temperature to more accurately reflect the objects they represent.
Omni-directional "Treadmill"
In order to keep the simulation convincing, you'd ideally want to keep the user approximately in the center of the room. This way the user can walk from room to room, or run across a field, without running into the wall, or having to break the immersion by manually returning to the center of the room before the simulation continues.
In addition to giving the illusion of solid objects, advanced force fields could be used to slowly move the user back to the center of the room without being overtly noticeable. However, as above, such force fields may not be possible.
Alternately, the floor could be setup as a treadmill that works in any direction. There are things like the Virtuix Omni, but they require you to essentially strap on the entire treadmill.
A better method would involve floor plates that can be programmatically moved around the room with edges that disassemble as they move too far away and reassemble as they get close to the user. I don't know of any real-world research on this, but it doesn't seem particularly impossible.
Artifical Gravity
In order to simulate constant acceleration in something like a flight sim, you'd need some kind of artificial gravity. In your example use case, this would be totally unnecessary unless you're going for "extreme porn while falling off a really long waterfall with no terminal velocity" or something equally off the wall.
The best way would involve something like a graviton emitter (essentially, a device that creates real gravity just like an LED creates light), but these are completely fiction as far as we currently know.
As Anonymous Anonymous' answer shows, it may be possible to accomplish a similar result with very large magnets using diamagnetic levitation. Current magnets that might have the strength to levitate a human only have a bore size of about 1 inch, so we'd need huge advances in the size of the magnets, but it's within the realm of plausibility.
An alternate method involves putting your entire holosuite in a multi-axis centrifuge with a lot of power. It wouldn't be able to perfectly simulate all possible accelerations, but with sufficiently advanced technology (and energy), you could probably do a pretty good job. Plus, this is a technology we already use to some extent in real simulations.
People use tilting platforms to simulate sideways acceleration for racing and flight sims today. It's not perfect, since it always has exactly 1 gee of acceleration, but it can still be fun. Additionally, we have centrifuge simulators in use for professional training.
The best case scenario here would involve putting your centrifuge in space so you could simulate anything from free fall to whatever gee-force limits you feel are safe. On Earth, the only way to simulate free fall is to put your centrifuge 30 stories up and actually drop the user. The more stories you have, the longer of a free fall you could simulate. You can get decent simulations for racing sims with very small motions, but flight sims might need excessively large drops to get perfect.
Haptic Forcefields
The most important aspect of the Star Trek holosuites are the high-resolution force fields that push back on the user's skin. To my knowledge, such things are completely outside the range of current science.
There are various "force field" technologies being studied to protect military targets from explosions (see here, for example). However, these work by turning the air between the explosion and the target into plasma, which reflects the blast wave.
It's possible to create micro plasma bursts that you can feel (these guys did it), but I don't see how this could be used on a local level for anything that would push on your body hard enough to feel like a solid object.
Free-space Holograms
The visual portion of the various objects and actors within arms reach are made of free-space holograms. (I don't think free-space holograms technically count as "holograms", but everyone who's seen any sci-fi movie knows we're talking about visual projections to mid-air.) I'm not sure how likely it is that we'll really succeed here, but it's looking promising.
These guys (links to the same article as the micro plasma bursts above) have created a form of holographic images by making tiny explosions in the air. Right now, the images are safe to touch but rather loud, and monochromatic. If this technology can be improved to sufficient resolution and color reproduction we might have viable method of achieving this.
Alternately, there's a question here with more discussion on the subject.
In general, it seems unlikely we'll be able to render these holograms in such a way that they'd appear to be solid from multiple discrete angles. Any light on the front of an object would be visible through the back of the object. So multiple people in one room wouldn't work very well, though you could use multiple rooms and project different users into other user's rooms.
An alternative method would involve some type of floating mirror dust that could reflect external laser beams towards the user's eye while allowing background light to pass through unhindered and being totally safe for the user. I'm not sure how feasible this is, but it would have better appearance, since light on the front of an object would be reflected only towards eyeballs that should see the front.
Answer: This is just an addition to MichaelS' answer regarding acceleration/artificial gravity.
While not really acceleration, electromagnetic forces may be used to create a pull on the subject's body.
How you would do this:

First - you invent a very strong and focussed electromagnet (A Bitter Solenoid may be used)
Second - You construct, cool and power a few of them.
Third - You should make sure your subject doesn't wear too much ferromagnetic stuff, otheewise it may end up rather uncomfortable.
Fourth - You're done! Readjust the magnets a few times the second (in case your subject moves) and you should be ready to go!
Comment: The section on [diamagnetic fields](https://en.wikipedia.org/wiki/Magnetic_levitation#Diamagnetic_levitation) can be linked to directly, and mentions that typical field strengths are around 16 T, but this just levitates frogs and mice. A pdf of the experiment is [here](http://www.webcitation.org/5txsxCmCf?url=http://www.ru.nl/publish/pages/561854/frog-ejp.pdf), and mentioned that they kept the frog levitated for 30 minutes. This is certainly an interesting concept I hadn't seen before.
Comment: The wikipedia [Tesla](https://en.wikipedia.org/wiki/Tesla_(unit)) article says the world record for continuous field strength is 45 T. The magnet in question is detailed [here](https://nationalmaglab.org/about/around-the-lab/meet-the-magnets/meet-the-45-tesla-hybrid-magnet), is 30 tons, 22 feet tall, requires 33 megawatts, and costs about $1500 an hour at full strength. It also has a bore size of just 1 inch, which isn't particularly useful for our purposes,  I'm not sure what kind of field you'd need to levitate a human, but it's probably possible, while extremely expensive.


proving that the following limit exist

Question: How can I prove that the following limit exist?
$$
\mathop {\lim }\limits_{x,y \to 0} \frac{{x^2  + y^4 }}
{{\left| x \right| + 3\left| y \right|}}
$$
I tried a lot of tricks. At least assuming that this limit exist, I can prove using some special path (for example y=x) that the limit is zero.
But how can I prove the existence?
Answer: Hint:
Try using the squeeze theorem.  Since everything is positive, you're already half way there, that is if the limit exists, we know
$$0\le \lim_{(x,y)\to (0,0)}\frac{x^2+y^4}{|x|+3|y|}$$
For the other direction split the fraction into two parts, and try using the inequality:
$$\frac{x^2}{|x|+3|y|}\le|x|$$
A similar inequality will work for the $y^4$ part of the fraction.
Answer: We choose the norm one:
$$||(x,y)||=|x|+|y|$$
and we have
$$|x|\leq||(x,y)||\quad;\quad |y|\leq||(x,y)||$$
so
$$0\leq\frac{{x^2  + y^4 }}
{{\left| x \right| + 3\left| y \right|}}\leq\frac{||(x,y)||^2+||(x,y)||^4}{||(x,y)||}=||(x,y)||+||(x,y)||^3$$
Answer: There are more appropriate ways, but let's use the common hammer. Let $x=r\cos\theta$ and $y=r\sin\theta$. Substitute. The only other fact needed is that $|\sin\theta|+|\cos\theta|$ is bounded below. An easy lower bound is $\frac{1}{\sqrt{2}}$.
When you substitute for $x$ and $y$ on top, you get an $r^2$ term, part of which cancels the $r$ at the bottom, and the other part of which kills the new top as $r\to 0$.

proving that the following limit exist


Proof of existence of Pul e Sirat in Akhirah

Question: I've heard that if we don't accept that Pul e Sirat doesn't exist in Akhirah , it doesn't affect our Eman . Is this true ? Moreover, is there any proof of existence of Pul e Sirat from Quran or Hadith ?
Answer: It is obligatory to believe in the bridge(Sirat) over the hellfire. Anyone who rejects it exits the fold of Islam.

Abu Saʿīd Al-Khudri narrated that Allāh's Messenger(ﷺ) said, "Every
nation shall follow whatever they worshipped. Only this nation will
remain along with its hypocrites. Then the Bridge (As-Sirāt) will
be erected over the Hellfire, and I will be the first to cross it and
the intercession will be permitted. The people will say, 'O Allāh,
Save us! Save us!'" It was said, "O Allāh's Messenger, what is the
Bridge?" He replied, "A void into which a person is likely to slip.
Upon it there are claws, clamps and hooks like the thorns found in
Najd called Saʿdān. The believers would then pass over it in the blink
of an eye, like lightning, like wind, like a bird, like the finest
horses and camels. Some will escape and be safe, some will be
lacerated and let go, and some will be pushed into the fire of Hell."
(Muslim, no. 183)

In another Hadith

Abu Huraira reported: The Prophet, peace and blessings be upon him,
said, "I will be the first to cross the bridge over Hell. The
supplication of the Messengers on that day will be: O Allah, keep us
safe! O Allah, keep us safe! There will be hooks on the sides like the
thorns of al-Sa'dan, except their enormity is only known to Allah.
People will be seized by them according to their deeds. Among them are
those who are ruined by their deeds. Among them are those who are cut
into pieces and later saved, until Allah has finished judging between
His servants and He intends to take out of the Hellfire whomever He
wills to take out. For whomever testified there is no God but Allah,
the angels will be ordered to take them out and they will be known by
their trace marks of prostration. Allah has forbidden the Hellfire
from consuming any children of Adam with traces of prostration. They
will be taken out after they had been burned, then dipped into a water
called the water of life. They will spring forth like seeds on a
streaming river." Source: Ṣaḥīḥ al-Bukhārī 6573, Ṣaḥīḥ Muslim 182
Answer: As stated in the other answer, there is authentic evidence the Sirat is true. As Muslims, we must believe everything, without exception, from the book of Allah or the speech of His Messanger (peace and blessings be upon him).


What is special about programs that create bootable USB sticks for Linux?

Question: Why couldn't I just mount the ISO and copy the files over to the stick?
Comment: Every OS needs a bootloader to work, at least on x86
Answer: The ISO filesystem is read-only, and those bootable Linux images are usually created in a way where they are both a bootable ISO and a bootable hard-disk image (with bootrecord and partition table), so they could be copied to either a CD or a USB stick.
You can however create your own modifiable and bootable USB stick if you don't intend to ever burn it to a CD or DVD: partition it with fdisk(1), install grub(1) on it, etc.
Answer: Nothing is special about the programs, but they do create a special program on the USB storage: they create a program called a boot loader.


In what sense is the guitar a transposing instrument?

Question: Guitars are transposing instruments.  Does this mean if the music notation is calling for a C4 I should play a C3?  Or would I still play a C4?  Does the original instrument the notation was made for matter?
Answer: Guitar notation is written in treble clef, an octave above the sounding pitch. So if you want to hear C3 from a guitar, write C4.
When guitarists read a guitar part, they don't have to do any transposing. The note they see, played the way they have learned to play it, will deliver the required result.
If guitarists are reading music written for some OTHER instrument (piano, perhaps) they will have to play what THEY call C4 to get what a pianist calls C3. But, mostly, they needn't bother. It will sound fine in the 'wrong' octave.
Answer: Guitar music appears to be written an octave higher than it sounds.
It signifies that actually, the music is in the right octave for guitar, just written on the treble clef 'an octave too high', for convenience - of both writing and reading. To write music for guitar in its proper octave, it would need a clef of its own - hardly practical.
In order to play any other music not written specifically for guitar, it would need to play those dots an octave higher.
Comment: A quick internet sampling found no sheet music for guitar written with an 8 on the treble clef.  Can you point to a professionally engraved edition of guitar music that does?
Comment: @phoog - funnily enough, I can't. That was possibly the dv reason - once again, not followed up by what could have been useful information. I'm sure I've seen it, several times, but for now, you're most likely correct - that bit is hereby deleted until further notice.
Comment: @Tim - I recall Musescore being pretty prone by default to give guitar parts the ottava treble clef.
Comment: I have found some Universal Edition and Schott editions that use the ottave treble clef.


What do game developers do when they have to port their DirectX games to PS4/Switch?

Question: I'm not a game developer (hope to be one day though!) and was wondering how devs handle porting their games that use DirectX to PS4/Switch? From what I know neither supports DirectX, only OpenGL, and Vulkan. Do the devs just have to recreate their game with OpenGL or Vulkan? That seems like a lot of work. I'd imagine it would probably be a fairly common scenario, especially with AAA games so I'd assume that there would be something somebody has made to make it easier?
Comment: Neither supports OpenGL either.
Answer: Yes, porting games between platforms is a lot of work.
Typically it involves writing an abstraction layer, so game-specific code never references a DirectX or other platform-specific code directly. Instead it will direct its request to this intermediate layer. When done right, the vast majority of the game code will have no idea if it's running on DirectX or something else.
The old DirectX-specific code will become one version of the implementation of this layer, and the devs will create another version for the new platform - serving the same interface to the rest of the game, with different internals to match the new system.
At compile time, either version of these intermediate layers can be swapped-in, to compile a binary for one platform or another.
Now of course it's not a simple task, since different platforms and APIs work in different ways or make different assumptions. So there's a lot of work in establishing a common set of operations that the abstraction layer can efficiently map to one platform's implementation or the other.
DirectX shader code might need to be re-written for the new platform, or the team might use a transpiler to produce modified shader code automatically for most cases, and only hand-fix the problem cases.
Assets like textures might also need to be re-baked to suit the compression formats or memory size characteristics needed by the new platform. When porting to mobile, assets might also need to be exported at different resolutions to suit different screens. Sometimes an artist or other asset creator will need to make custom versions to support the new platform, like simpler meshes for weaker graphics hardware.
The amount of work involved in all this is one reason why established, cross-platform engines are so attractive. They've already done most of this hard work, so you have fewer steps required to port your game to a new platform (though usually there are still at least a few issues to sort out, since platforms don't just differ in rendering, but also input devices, vibration, player account management, online/store systems, achievements, console settings, certification requirements, etc...)
Answer: Having done so several times, I can say that porting the graphics part from PC to (modern) consoles, depending on how the PC code was written, could be relatively straightforward, or very hard.
Just like the differences between modern DirectX and OpenGL are not -that- big (from an API point of view), the several APIs for consoles also use similar architectures, and in general, porting a game from PC to consoles will mostly consist of changing the API calls, changing some of the platform-specific code, and fixing unusual things that might have worked on PC, but no longer work on your console. DMGregory's answer covers what you need to do pretty well.
That said, in my experience, the majority of effort in porting an (indie) game to consoles comes from porting the non-graphics stuff, where the underlying assumptions about how the platform works can be very different between platforms.
This is aggravated with the fact that consoles often have a long and very strict list of technical requirements that your game will be checked against, and has to pass, before it is allowed on the game store (PlayStation Store/Nintendo eShop). Some of these requirements will come and bite you where you least expect it.
For example, saved game data is stored in files in PC, and you might want to show a file open/file save dialog to let the user choose where to save their game. In some consoles, saved game data is not stored with the file IO API (fopen, fread, fwrite, etc.), but uses a special API, with a different GUI, and different concepts altogether.
Furthermore, you might have been able to save data on PC with simple synchronous calls; on consoles, on consoles you might be required to correctly save data asynchronously, and handle all errors appropriately. Depending on how you did saved games before, this might require you to re-engineer the parts where you are saving data in your game.
Another example is achievements/trophies. You can make a game for PC without the concept of achievements/trophies. When you move to consoles, you might be required to do so, and therefore you have to start from even planning what the achievements/trophies will be, where they will be unlocked, and add the code to do so.
Just like these examples, there are many, many, many requirements that have different assumptions on PCs and consoles, and in my experience these take much more effort to resolve, compared to the graphics API differences, which are comparatively straightforward.
If you're porting a game from PC to consoles, I do recommend you budget enough time to do all of this, especially if this is the first time you're working for a specific platform.


Retina display support for XQuartz X11 applications

Question: I use a MacBook Pro with retina display, OS X 10.8. I'm trying to run applications on a remote cluster via X11 ssh forwarding. I see everything with bad resolution, and guess this has to do with my retina display. I know that the same applications look good if installed on my local machine. Any ideas? Thanks!
Answer: Yes, you are correct. The problem is X11, XQuartz and their lack of support for the Retina Display. This is a long known issue.
In the linked thread, jeremyhu states:

X11 just doesn't work well for resolutions outside of the 72-90 DPI range. This is an upstream X11 issue that needs to be solved before we can really do anything about it in XQuartz.

Not sure this will help you, but at least since last August, RealVNC has supported Retina displays.

Also you might try running X11 with your Retinia display at full resolution to see if this mitigates the issue. You can accomplish this with SwitchResX, among other software that is available to access other resolutions.
SwitchResX is a commercial third party application, but it is available to try for free and for download. Probably because it is technically a hack to use the full resolution of Retina Displays, it appears to be unavailable on the Mac App Store.

Another option to try is using NoMachine's nxclient/nxserver technology. I can't find anything that says it has Retina Display support, but a post in their forums leads me to believe that there is at least some support for Retina Display resolutions in the current version.
Comment: I'm not sure why Jeremy said that -- it wasn't true then, and certainly isn't true now.  X11 (including Xquartz) understands the resolution of a display, i.e. the pixels per inch, (unlike native macOS) and font sizes can be chosen by absolute point size, so text remains the same size on the screen no matter what the display resolution!  The (more recent Xrandr support in Xquartz makes this work now, and modern font scaling looks really good on hi-res displays!  Icons, cursors, and pixel-based layout can be a problem, but usually not an unsurmountable one.


What is meant by a "tattoo"?

Question: From the places I have heard the term, it seems to mean a strictly rhythmic motif, as opposed to a short melodic theme. Specifically, it's been used in the description of the snare drum part in the second movement of Bartok's Concerto for Orchestra
Comment: I have never heard it used for anything other than for drumming.  Some composers may have borrowed the term for instrumental sections that they wanted fast staccato, but I can't think of any.
Comment: Did you try wiktionary: "A signal by drum or bugle ordering soldiers to return to their quarters"? Other sources may provide more information.
Answer: There's a good article in Groves dictionary which describes it.  Originally a signal for soldiers to return to quarters (otherwise known as "Retreat"), as mentioned by @PJTRaill, this function has become more-or-less obsolete over the years.
Answer: From what I read about, the local annual Tattoo in my area is a series of concerts, parades, and performances. Including Military, police, and civilians performing historic re-enactments, dances, acrobats, choirs, military displays & competitions, dramas, comedy, etc...
Here is where I found the information; http://www.nstattoo.ca/about-us/what-is-a-tattoo

What is meant by a “tattoo”?


How to refresh custom tab in a lightning record page when you save a new record in a lightning component?

Question: I have a lighnting component on a custom tab where I am creating a new record or editing the existing record. I am unable to refresh the my custom tab after I save the new record, currently I am manually refreshing the page to see the created record. I have tried naviagtePageItem and refreshTab() but nothing worked so far. Could some one give me some pointers ?
Answer: If you have a custom tab then I'm sure you are able to check if you have the record's Id or not, which will determine the mode in which the component will operate (either "edit" or "create" mode).
After submitting the record, you'll need to fire the same functionality you have when you load the component, no? You don't necessarily need to refresh the whole page for that.
Suppose that your user navigates to the page, and the record is not created yet. They proceed to do so, and when the record is saved on the database, it will return the record's Id (you would get it in a callback in your JS helper). With the record's Id, you would be able to reload the content of the tab using the record's Id as reference for it to load the data, instead of displaying an empty form to the user (so it would go into "edit mode" instead of "create mode").

For one moment I thought about the "refresh view" event. But I believe that would be useful if you were in a standard page, or if the component implements the handler for said event. You'd call the event like this: $A.get('e.force:refreshView').fire();. And then your component would implement a handler for it, like this:
<aura:handler event="force:refreshView" action="{!c.doRefresh}" />

Where doRefresh is a method in your JS controller.
Comment: This refreshes the other tabs like Details, Activities except my custom tab
Comment: Read the whole post, not just the code snippets.
Comment: Fixed, Thank you !!
Comment: hello Renato Oliveira, one quick question, what if we have a visualForce page under that tab, how do we achieve this refresh thing! any pointers ?


Xcode Swift: is being asked to animate its opacity. This will cause the effect to appear broken until opacity returns to 1

Question:
Everytime I click on the Sign Up button on the left view controller. I get this warning saying:

"2017-09-10 11:14:50.573574+0800 Custom Fonts[1413:62959] [Warning] <UIVisualEffectView 0x7fc1e1e203a0> is being asked to animate its opacity. This will cause the effect to appear broken until opacity returns to 1."

I checked the alpha setting of my visual effects, they're all set to 1. How can I fix this?
My Code:
import UIKit

class SignUpVC: UIViewController {
    @IBAction func dismissPopUp(_ sender: UIButton) {
        dismiss(animated: true, completion: nil)
    }

    @IBAction func signUp(_ sender: UIButton) {
        //signup logic
         dismiss(animated: true, completion: nil)
    }
}

Comment: Check [these search results](https://stackoverflow.com/search?q=%5Bios%5D++being+asked+to+animate+its+opacity).
Answer: Change the animated to "false",
dismiss(animated: false, completion: nil)


Is it possible to remove a baked shadow from a texture using Blender?

Question: I have this texture from a game that I'm trying to mod and i was wondering if it's possible to remove the baked shadow on the pants using compositor or another method on blender
Comment: you can directly add the image in the question just to avoid everyone clicking on the link and redirecting to the other page
Answer: It's somewhat impossible. At least without additional data like the environment in which the texture was baked - then you could bake shadows alone and remove that. Also keep in mind that a lot of the detail you want to preserve is also shadows - unless you have recreated all the little details like buttons and pocket irregularities - but then you actually can try the suggestion in the 2nd sentence of this paragraph.
You can use something like High Pass filter in Photoshop to detect edges. Keep in mind if you have a shadow of a stripe like the two stripes here:

Then you will get edges between bright and dark areas, that I imagine weren't there on the original texture. Also, blurring the underlying image before reapplying the high frequency detail will remove a lot of information that you probably want to keep.
Here's a node setup I tried:

(I used Shader Editor, but similar principle could be achieved in the Compositor)

You can get better results, but not a lot better, I imagine. At least not without some AI algorithms.


Redirect systemd service STDERR to command (sendmail)

Question: This seems like something that's been asked before but I can't find it anywhere.
I have a systemd service that runs on a timer, updating my packages.  I want to get emailed using ssmtp every time the service throws an error.
If I run this in the terminal as root, it works.
 # /root/bin/update 2> >(printf "Subject: ERROR from update.service\n\n$(cat -)" | sendmail email@example.com)
Updating package lists... Done!
Updating packages... Done!
Removing old packages... Done!
Cleaning up... Done!
Updating dotfiles... FAILED!
Updating bpytop... Done!
Updating global npm packages... Done!

That part that failed sent STDERR which was caught by the pseudo file >().  The printf "...$(cat -)" appends a subject to the beginning of the stream.  I get an email with the stderr as body.  Pretty slick, huh?

This is what I want the service to do.  Print the stdout to journald as default, but redirect stderr to a command of my choice.  I tried this first:
ExecStart=/root/bin/update 2> >(printf "Subject: ERROR from update.service\n\n$(cat -)" | sendmail email@example.com)

But the errors are still sent to journald and not ssmtp.  I think systemd intercepts stderr and sends it wherever is specified by StandardError=.  The StandardError= option allows the stderr to be sent to a file descriptor or file... so I tried stuff like this:
ExecStart=/root/bin/update
StandardError=file:>(printf "Subject: ERROR from update.service\n\n$(cat -)" | sendmail email@example.com)

and
StandardError=fd:printf "Subject: ERROR from update.service\n\n$(cat -)" | sendmail email@example.com

Didn't work.  It might be possible to send it the StandardError to a named pipe which points to sendmail.  I fooled around with trying to get this to work and finally gave up and came here.
EDIT: I also thought about writing a bash function in the update script that sends email, then redirecting stderr from each command in the script to that function.  I'm looking for a solution at the systemd level though, instead of hardcoding the STDERRs' destination in the script itself.
Answer: I've come up with one possible solution: writing stderr to a file and then mailing it using ExecStartPost=.  I also learned that systemd service files don't play nicely with redirection unless you wrap commands in /bin/bash -c '':
ExecStartPre=/bin/rm -f /root/update.err
ExecStart=/bin/bash -c '/root/bin/update 2>/root/update.err'
ExecStartPost=/bin/bash -c 'test -f /root/update.err && printf "Subject: ERROR from update.service\n\n$(cat /root/update.err)\n" | sendmail email@example.com'

Source: How to pipe Systemd service standard output from ExecStart to shell, ex. bash?


how do I work with LAB color space in the compositor?

Question: Any way to get a separate and combine LAB node? I would like to adjust the A and B channels individually to create a certain color effect. Is there any way to do this like an add-on, or maybe convert the channels from another color space.
Answer: You can't, not without adding a whole different reference space, and you don't actually want to. The explanation for this is very long winded, and I'm willing to explain, but the short version is as follows.
Proper mixing of colour relies on modeling our real-world of physics. That part includes using linearized systems that orbit around the spectral locus. Lab is strictly a perceptually uniform model based off of XYZ. As such, it is a nonlinear space, which makes it absolutely one of, if not the, worst possible choice for manipulation of images. No really, it is that bad[1].
So what you are actually requesting is a method to manipulate a dual axis model that works in conjunction with the default tristimulus (RGB) linearized reference model. At the current time, there is no OpenColorIO node, so you can't transform the data along the nodal pipeline.
Further, even if you could perform an OpenColorIO transformation along the pipeline, this would be an awful idea to take your reference RGB data to Lab for the reasons identified above. So is there a reasonable dual axis system that could work in conjunction with a linearized tristimulus reference space? In theory yes, you could change to xyY, which is a scaled version of XYZ. The problem with xyY is that the range of values that can be produced from the primary lights are largely imaginary, and as such, there are many other pitfalls that come along with that sort of a choice that have to be closely managed.
Perhaps sometime soon on the horizon, Blender will be fully agnostic and the colour pickers and such will be properly set up to enable a changing of viewing transforms on the UI elements. This would allow you to use whatever colour transformation you wish only on the view of the UI element, while leaving the actual reference values in their established state. That would permit using something like a Lab 3D LUT to view the picker, and give you the RGB values transformed for the reference space.
The key takeaway here is:

Lab is an awful choice for manipulation of images, and a questionable choice for colour based selection.
A clear division of reference / working space and UI / View space alleviates any artistic reasoning for (1) above. That is, as long as your reference remains strictly scene linearized, and the view / UI permits one-way only transformation of those values, the correctness of the image manipulation pipeline is preserved.

[1] The great granddaddy of misinformation was a tome written for a commercial image manipulation program that has since become infamous among imagers. It has some of the worst advice, some of the biggest misinformation, and some of the most dire concepts delivered to imagers in perhaps the past twenty years. Lab is a fool's errand.
Comment: Hey, could you share some details on *why* working in LAB is an awful choice? In the compositor, I don't care about the physics so much, only about the perception: I just want to adjust some colors without messing with the luminance values. So why not do it in LAB? I don't get your point.
Comment: You *do* care about the physics, as the physics are the stimulus that leads to the sensation of appearance. It requires a separate question likely.
Comment: Couldn't one reproduce the color space transformation with these conversion equations using math nodes? https://fujiwaratko.sakura.ne.jp/infosci/colorspace/colorspace3_e.html
Comment: You could. The question is, would it lead to anything meaningful and useful.

My best advice is to try it. Try it with known expectations such as mixing two stimuli and determining if the expected output is arrived at.


If Montana elects a Democratic senator, would the state "turn blue"?

Question: I have been thinking about something that sounds like a pipe dream based on the Cook PVI. But it doesn't look like it when you see that Jon Tester is a Democrat representing Montana in a federal office. Because Steve Bullock looks like he has a shot because of the deviation of presidential and senate races, if he wins, does that mean the state "turned blue" because Congress is a federal office?
Answer: There is no legal definition of blue or red so no.
Blue and Red is a way to discuss what states are likely to go for one party's candidate or another. It usually refers to presidential politics. It comes out of graphics on television (or now the internet). To show a graphic of how each state voted, each candidate gets a color. It used to be that some networks had it reversed, but now red = Republican and blue = Democrat.
The other thing is that local politics can be different from the president. Even though it is a federal office, the senator from Montana is still a statewide Montana election. A Democrat from Montana may be more conservative in general or on specific issues than the majority leader from New York. Even though presidential elections are by state (mostly), the candidates are national candidates.
Add to that that individual presidential elections have vagaries based on who the candidate is. In 1984, all but one state and D.C. voted for Reagan. They did not all became red states though, just for that election. In 1988 there was more spread.
States do change though, based on demographic shifts, changes in attitude and priorities, and shifts in parties that may seem small but for a given state hit one issue that is important to them. West Virgina switched from blue to red. Other states have drifted from reliably red to in play.
So, for Montana:

If multiple reliable polls showed a close race between Trump and Biden, then news organizations might identify it as "in play" and perhaps color it purple this year.

After the election is in, if Biden were to win Montana, it would be on a graphic of results as blue.

But in 2024, unless there is sustained apparent propensity to vote for DEM, it would still be considered red. Maybe "in play" if opinion polls suggested that was the case.
Keep in mind- this only matters to people who are planning how to spend campaign time and money, and then afterward to people who are analyzing the aftermath. And also to news and information people trying to present or prognosticate. Red, blue, purple, or orange: If Trump wins the election in Montana, he gets their electoral votes. Ditto Biden. If Bullock wins, they have a DEM Senator, specifically Mr. Bullock. If not they have a GOP senator, specifically whoever. Etc.
Comment: 'It used to be that some networks had it reversed' – [It used to alternate](https://politics.stackexchange.com/a/39328/24022) but thanks to the 2000 election the colour patterns stuck by virtue of being broadcast for weeks on end while the whole nation watched Florida come up with a result.
Answer: A state being "red" or "blue" is a journalistic shorthand, there is no constitutional, legal or official definition.
Generally when a journalist says "X is a red state" they mean that it is expected that they will return a Republican in the next (or in a generic) Presidential Election.  It is well known that otherwise "Red" states can sometimes have Democrat as senator or governor (eg Jon Tester, or Doug Jones in Alabama), or "blue" states can have a republican (think of Arnold Schwarzenegger). This doesn't make Montana or Alabama a "purple" state,  Montana is expected (with 97% probability) to vote for Trump in the Economist's model
Therefore, most commentators would say that Montana remains a "red" state.


How do I disable double-click to launch iTunes and play song in OS X Mavericks

Question: In Maverick, whenever I double-click a track to rename it, iTunes launches and the track plays in iTunes. Very annoying. How do I disable (or re-assign) the double-click to launch/play in iTunes command? Thanks in advance.
Comment: It should only open iTunes if you double-click too quickly. An option would be to use the return key to rename the currently selected item to make sure you don't open it accidentaly.
Comment: Simply... don't double-click to edit a name, that's not what it's for. Double-click is to action a file.
Comment: Just wanted to thank Daniel Lawson and Wayfaring Stranger for that solution!Such a relief not to have to deal with iTunes opening all the time, whenever I accidentally double-click an mp3 file.
Answer: In the Finder?  You can't.  That's what double-clicking does.  To rename, single-click after selecting the file, or press return.
Answer: I suspect you are clicking too fast.
A 'Double-click' in Finder opens the file or launches the application, etc.
On the other hand, selecting a file/directory, waiting a short period, then clicking again, will allow you to rename it. It's not technically a 'Double-Click' even though you are clicking twice (you could equally use arrows to navigate to the file, then click, for example).
You can alter that delay in System Preferences under the Mouse preference pane. The 'Double-Click speed' slider lets you adjust this. Perhaps you should move the slider closer to the 'Fast' end, which will reduce the chance of it assuming you meant to open the file instead of renaming it when clicking twice.
Answer: You can prevent iTunes from opening when you double-click on a track by telling the Finder to open some other Application when you double-click on an mp3, or whatever, music file.
A simple Applescript such as

say "beep"

will do the job. Just open Applescript Editor, type the above script, and save it as an Application, e.g. "Beep.app".
Then do a get-info on a music file, and set the "Open with" option to "Beep.app" instead of iTunes. Now try double-clicking on the track. You should see an expanding icon, like the file is opening, but nothing further will happen because "Beep.app" doesn't actually do anything with mp3 files. (Activity Monitor shows Beep actually opens for a few seconds, but it takes up no cpu, and the script itself doesn't execute.)
Once satisfied that the script is working properly, you can go back to your mp3 file's get-info window, and click the "Change All" button to open any double-clicked mp3 with Beep.app instead of iTunes.
That'll stop iTunes from annoying you when you're just trying to change a file's name.
click the "Change all" button to use the "Beep.app" to open all mp3 files
If you don't want the beep, you could even make the AppleScript do nothing:
<code> Tell Application "Finder"
 End Tell
</code>


Minify tool that can be executed through terminal

Question: I am looking for a tool or a way to minify (similar to Compress my code and this question on Stack) all of the code in my .xml, .css, .html and .js files through Ubuntu's terminal.  Eventually I will bash script the process, but at the moment I would like to just find something to test.  Is there a tool out there that I can use to compress all these file formats through the terminal?
Comment: Have you tried something like `tar -czvf compressed.tar.gz *.xml *.css *.html *.php` ?
Comment: I am looking to compress the code itself.  Something like CSS Minify
Comment: Then I think you're not asking for *compression*. By compression on regular files (non-media like music/videos) we mostly only consider lossless compression, but you're looking for a way to minimize the whitespace (in which you lose this data). And because minifying is lossy, you can't decompress (because it's not reversible). To me this makes it "unclear what you're asking".
Answer: This is not the best option but it's probably the easiest. The YUI compressor was long thought to be the best compressor for Javascript and CSS, offering 20-40% improvements over other minifiers.
It has since been superseded by newer projects like Uglify.JS (which Grunt will probably suggest) but it's still a fairly easy thing to get up and running in Ubuntu.
sudo apt-get install yui-compressor

That's it. Now you can run yui-compressor myfile.js and it'll do its magic, just not as well, or as conveniently as a properly install Node/Grunt/Uglify+YUI stack.
Comment: Not everyone who uses js or css is using node.js or doing node.js projects. It is yet another framework to learn and configure if you want to use grunt. Yes grunt is cool. But now-a-days, we already have enough to learn before we can even start coding. So node/grunt is not always convenient. :)  I myself am going to try your suggestion of yui-compressor.
Comment: @BillR I sort of agree with the sentiment but while I don't have any node.js projects, I still use things like lessc and uglify.js because **they are the best tools for the job**. I don't use Grunt because I've replaced it with my own tooling but for the actual work, I'd never hobble myself just to avoid Node. If you want to stay in the industry, you have to keep up with best practices.
Comment: You've got five years on me but I don't know what your point is... Are you still using static HTML4 with a bit of "DHTML" and perl CGI scripts? Still using ASP? Or have you switched things up as better technologies have made themselves available? We've got two separate points going on in this; it's getting a little silly. I don't care if you don't like retraining, but I do care that you're making out that using the `more-css` NPM package to minify your CSS is any more intrusive than using yui-compressor. It isn't. It's just another command that does the same thing better.
Comment: You are making the assumption that using node is best practice. Maybe in your world which is not everyone's world.
Comment: My point is if what you know works, then you use what's easiest with what you know. Chasing change for change's sake has no value. There's been too many silver bullets. New languages break out faster than a social disease in a whore house. Sure, many flock to them because they are new, but that is a fool's game. I can and will learn new things if there is a benefit to do so. If learning node.js were to help me, I'd learn it. It's just another language. But to learn it, I need to reallocate time to it. My time is valuable to me, and so far I haven't seen the justification in terms of that cost.
Comment: Note that with this install you're going to install also the openjkd, a thing that someone wouldn't want in the system.
Comment: `sudo apt-get install yui-compressor` comes with 171 MB of libraries and binaries. No, thanks.
Comment: yui-compressor doesn't support ES6/JS2015
Comment: In many cases the output (the minification, or whatever) is the best. Objectively. That's what I'm taking about here. If you only ever use what's easiest for what you *currently* know, you'll go extinct faster than a dinosaur.
Comment: And that's my original point. You aren't *learning node.js*. You're using `npm` to install a couple of node applications and then you're using those. That 10 minutes is worth it... But if you can't see it that way and can never make time for improving yourself, you'll seriously have a shelf-life of about five years. Education is important in all fields but so much more so on the Internet.
Comment: I've been doing this for 20. You be the judge.
Comment: @tolos An answer on here is never going to stay in-date because, well, that's how webdev is. Today's best answer is install node, npm, esbuild or webpack and a pile of libraries (which change much faster) for the actual compression. You'd get a lot more than minification, you'd get things like tree shaking, modules, purgecss. But it's a hell of a lot of leg work too.
Comment: If you absolutely want to use YUI, you [can transpile back to more basic code](https://clarle.github.io/yui3/yui/docs/yui/es6-modules.html). Is it worth it? Probably not. Probably better to upgrade your build system.
Comment: I tried to install Uglify by `aptitude install node-uglify` as root under Debian 4.19.118-2+deb10u1. It errored out. I decided to have [my site](https://cjshayward.com) make fewer HTTPS requests by consolidating CSS and JS includes, on a custom CMS tweaking a previously Wordpress site. One thing I found is that the lion's share of JavaScript and CSS includes were boilerplate conclusions that were already minified, so the proportionate savings for minifying JavaScript and CSS were not that much. I used `yui-compressor`. **I wonder if this is a case of "For experts only: optimize later."**
Comment: Didn't work - gave me a bunch of errors.  minify worked as expected.
Answer: You can minify js easily with node and uglify-js from command line:

install uglify-js with npm install uglify-js -g

run it uglifyjs app-test.js > app-test.min.js

For css I would suggest clean-css (probably the most stable css minifier on npm). It requires cli package
example usage:
cleancss -o public-min.css public.css

As far as html is concerned usually minification is not usually worth the time you invest in setting it up, but I have tried html-minifier and it's an awesome tool.
Whatever you do just be sure that you gzip what you're serving.

Edit 05-03-2020
Nowadays, instead of using uglify-js, js developers usually use terser.
Comment: `uglify ` can be directly installed with `sudo apt-get install node-uglify`
Comment: @Gery if you want to install `uglify` with `apt` you also need to install `node-legacy`, so run `sudo apt install node-uglify node-legacy`
Comment: Note that the `cleancss` CLI tool is now in the `clean-css-cli` package.
Comment: Note that uglify-js is only for Javascript, and not for css or other files.
Comment: `uglifyjs src/lib.js --output dist/lib.min.js --compress --mangle` Is better IMHO.
Comment: @Gery Why not **apt-get install uglifyjs** ? Can you tell me whats the difference between 'em ?
Answer: Use minify - unlike the other suggestions, this tool minifies a lot more file types:
CSS     text/css
HTM     text/html
HTML    text/html
JS      text/javascript
JSON    application/json
SVG     image/svg+xml
XML     text/xml

Comment: It does a very poor job with javascript.
Comment: Which makes sense, minifying Javascript is very hard, especially if you want to minify it to a large degree. Multiple dedicated projects for JS exist. I'd recommend those for JS.
Answer: JavaScript Minifier is a Online JavaScript Minifier project by Andrew Chilton. Free, decent and no installation needed
url updated on nov-18-2023 - Thanks sechstein
curl -X POST -s --data-urlencode 'email@example.com' https://www.toptal.com/developers/javascript-minifier/api/raw > my.min.js

Comment: url changed
https://www.toptal.com/developers/javascript-minifier/api/raw
Answer: There is no reason to minify php files (except you have very limited disk space and want to use every bit of it).
If you could add a goal (What do you want to accomplish and why?), somebody might show you a better way.
JS and CSS files are minified on runtime and cached in most webprojects. There is minify (https://github.com/mrclay/minify), a php "library" which is able to do exactly this. (can also be executed with php from the terminal)
But keep in mind that one big javascript file does not necessary load faster than 5 small files. If you need a reason and a solution for this statement, take a look at http://headjs.com/
May the source be with you...
Answer: I have had good results with Closure Compiler.

The Closure Compiler is a tool for making JavaScript download and run
  faster. Instead of compiling from a source language to machine code, it
  compiles from JavaScript to better JavaScript. It parses your JavaScript,
  analyzes it, removes dead code and rewrites and minimizes what's left. It
  also checks syntax, variable references, and types, and warns about common
  JavaScript pitfalls.

It's developed by Google and written in Java. It's packaged for Debian-based systems as closure-compiler and is easily installed on Ubuntu systems.  As it doesn't use a GUI, it requires the more lightweight default-jre-headless package.
It's slower that YUI compressor but the resulting filesize is (slightly) smaller. It also prints useful warning messages, similar to compilers for other programming languages.
Documentation: Getting started
Usage:
closure-compiler --js input.js --js_output_file output.js

Comment: I am using Closure Compiler for JS on an existing project as well as [Closure Stylesheets](https://github.com/google/closure-stylesheets) for css minification. Both are working very well. Thanks, @anthony
Comment: The closure is really good if you start your project with it and extend your objects in separate files, etc. But for an existing project, it's rather terrible.
Answer: I would recommend using Grunt.js. It's an automation tool that has minifiers available as plugins and can be run in your terminal via Node.js. It should not be necessary to minify PHP as the code executes on the server side and only its HTML output is sent to the client.
You can find available plugins here
Comment: Be aware that choosing Grunt implies a learning curve.
Answer: Another option is to use npx command from Node.js. npx runs a command of a Node.js package without installing it explicitly.
# Minify JS
npx -p uglify-js uglifyjs -o app.min.js app.js common.js

# Minify CSS
npx clean-css-cli -o style.min.css css/bootstrap.css style.css

# Minify HTML
npx html-minifier index-2.html -o index.html --remove-comments --collapse-whitespace

# XML
npx pretty-data-cli --type xml --minify input.xml > input.min.xml

Answer: I found this java library for HTML (you need to have java installed):
https://code.google.com/archive/p/htmlcompressor/
Command line usage is simple:
java -jar htmlcompressor.jar inputfile.html > outputfile.html

And for CSS I use this (better compression rates than other tools that I've tried):
https://github.com/acwtools/accss
Command line usage:
accss inputfile.css > outputfile.css


Revealing a sin

Question: What is the ruling of revealing the sin and transgression of someone close to you to pious individuals who can make du'a for the reformation of said person? Does this constitute to exposing a sin in public and backbiting and is the one revealing it sinful?
Answer: In general, discussing your sins is haram as it was narrated that Abu Hurayrah said:

I heard the Messenger of Allah (blessings and peace of Allah be upon him) say: "All of my ummah will be fine except those who commit sin openly, and it is part of committing sin openly for a man to do something at night, then in the morning when his Lord has concealed him he says: O So and so, I did such and such last night, when his Lord had concealed him all night, but in the morning he discloses that which Allah had concealed for him."

Unless there is a legitimate excuse for you to reveal your sins such as to get a fatwa, to get health advice from a professional such as if you were suffering from alcohol addiction and other harmful things than it would be ok, however anything else there isn't a need and wouldn't be permissible  rather you should tell your close friend to make dua for you to better yourself and make Allah guide you to the straight path and also make dua for yourself, rather than disclosing your sin.
Comment: I just like to know do the people who do this have no hope whatsoever? Is repentance futile?
Comment: every sinner has hope no matter how much they have sinned  "Say My slaves who have transgressed against themselves (by committing evil deeds and sins) Do not despair of the Mercy of Allah: verily He forgives all sins. Truly He is Oft-Forgiving, Most Merciful." (Quran)

Revealing a sin


Are there any pinhole "lenses" available from lens manufacturers?

Question: I know that it is possible to make your own pinhole, but do lens manufacturer's make pinhole "lenses" that include aperture data, etc? If so, who makes them?
Answer: A company called Rising makes a precision laser cut pinhole lens based on the body caps for various makers, including all the dSLR makers. Included in the documentation with it is the focal length and aperture, but it varies a little bit by body because of the distance from the hole to the sensor. On the Pentax, for example, it's 45mm and f/204.
At any rate, I can't find their website, but if you Google "rising pinhole cap" and camera maker you want it for, you'll get a ton of hits. As far as I can tell, they are available in Australia.
I have one, at any rate, and it's kind of neat. You get some interesting effects with certain kinds of lighting.
Comment: Thanks, especially for including the "available in Australia part".
Answer: Photojojo make a pinhole "lens" for Canon and Nikon, it's f/181 but is not chipped so you won't get aperture recorded in the EXIF data.
http://photojojo.com/store/awesomeness/slr-pinhole-body-cap/
Although Canon surprised everyone recently by releasing a pancake lens I can't see them coming out with a pinhole!
Answer: I've been very happy with my Skink pinhole and zone sieve. They are very high quality parts and work very well.
You can read about them on their website, they use ebay for sales and I'd reccomend them to anyone interested in the subject. What's really nice is that you get to try different inserts, pinhole and 2 different zone sieves!
Here's one of my shots:
Answer: A number of people make them for CCTV use - often aimed at security use.
Here are some offerings from Goyo Optical
Here's the datasheet for their GAPM23824AC 3.8mm f/2.8 - 360 !!! with electrically controlled iris.

Modified product table image from the above site:
Comment: From the specs (3.8mm f/2.4) those are a different type of "pinhole" lens that is designed to shoot through a small hole and project a wide angle view. I think the OP is asking about traditional pinhole cameras which have a small hole and no glass.


Tables with no Primary Key

Question: I have several tables whose only unique data is a uniqueidentifier (a Guid) column. Because guids are non-sequential (and they're client-side generated so I can't use newsequentialid()), I have made a non-primary, non-clustered index on this ID field rather than giving the tables a clustered primary key.
I'm wondering what the performance implications are for this approach. I've seen some people suggest that tables should have an auto-incrementing ("identity") int as a clustered primary key even if it doesn't have any meaning, as it means that the database engine itself can use that value to quickly look up a row instead of having to use a bookmark.
My database is merge-replicated across a bunch of servers, so I've shied away from identity int columns as they're a bit hairy to get right in replication.
What are your thoughts? Should tables have primary keys? Or is it ok to not have any clustered indexes if there are no sensible columns to index that way?
Comment: Since you are doing replication, your are correct identities are something to stear clear of. I would make your GUID a primary key but nonclustered since you can't use newsequentialid. That stikes me as your best course. If you don't make it a PK but put a unique index on it, sooner or later that may cause people who maintain the system to not understand the FK relationships properly introducing bugs.
Answer: When dealing with indexes, you have to determine what your table is going to be used for.  If you are primarily inserting 1000 rows a second and not doing any querying, then a clustered index is a hit to performance.  If you are doing 1000 queries a second, then not having an index will lead to very bad performance.  The best thing to do when trying to tune queries/indexes is to use the Query Plan Analyzer and SQL Profiler in SQL Server.  This will show you where you are running into costly table scans or other performance blockers.
As for the GUID vs ID argument, you can find people online that swear by both.  I have always been taught to use GUIDs unless I have a really good reason not to.  Jeff has a good post that talks about the reasons for using GUIDs: https://blog.codinghorror.com/primary-keys-ids-versus-guids/.
As with most anything development related, if you are looking to improve performance there is not one, single right answer.  It really depends on what you are trying to accomplish and how you are implementing the solution.  The only true answer is to test, test, and test again against performance metrics to ensure that you are meeting your goals.
[Edit]
@Matt, after doing some more research on the GUID/ID debate I came across this post.  Like I mentioned before, there is not a true right or wrong answer.  It depends on your specific implementation needs.  But these are some pretty valid reasons to use GUIDs as the primary key:

For example, there is an issue known as a "hotspot", where certain pages of data in a table are under relatively high currency contention. Basically, what happens is most of the traffic on a table (and hence page-level locks) occurs on a small area of the table, towards the end. New records will always go to this hotspot, because IDENTITY is a sequential number generator. These inserts are troublesome because they require Exlusive page lock on the page they are added to (the hotspot). This effectively serializes all inserts to a table thanks to the page locking mechanism. NewID() on the other hand does not suffer from hotspots. Values generated using the NewID() function are only sequential for short bursts of inserts (where the function is being called very quickly, such as during a multi-row insert), which causes the inserted rows to spread randomly throughout the table's data pages instead of all at the end - thus eliminating a hotspot from inserts.
Also, because the inserts are randomly distributed, the chance of page splits is greatly reduced. While a page split here and there isnt too bad, the effects do add up quickly. With IDENTITY, page Fill Factor is pretty useless as a tuning mechanism and might as well be set to 100% - rows will never be inserted in any page but the last one. With NewID(), you can actually make use of Fill Factor as a performance-enabling tool. You can set Fill Factor to a level that approximates estimated volume growth between index rebuilds, and then schedule the rebuilds during off-peak hours using dbcc reindex. This effectively delays the performance hits of page splits until off-peak times.
If you even think you might need to enable replication for the table in question - then you might as well make the PK a uniqueidentifier and flag the guid field as ROWGUIDCOL. Replication will require a uniquely valued guid field with this attribute, and it will add one if none exists. If a suitable field exists, then it will just use the one thats there.
Yet another huge benefit for using GUIDs for PKs is the fact that the value is indeed guaranteed unique - not just among all values generated by this server, but all values generated by all computers - whether it be your db server, web server, app server, or client machine. Pretty much every modern language has the capability of generating a valid guid now - in .NET you can use System.Guid.NewGuid. This is VERY handy when dealing with cached master-detail datasets in particular. You dont have to employ crazy temporary keying schemes just to relate your records together before they are committed. You just fetch a perfectly valid new Guid from the operating system for each new record's permanent key value at the time the record is created.
http://forums.asp.net/t/264350.aspx
Comment: Read Kimberly Tripp's [GUIDs as Primary and/or clustering key](http://sqlskills.com/BLOGS/KIMBERLY/post/GUIDs-as-PRIMARY-KEYs-andor-the-clustering-key.aspx) and [Disk space is cheap - that's **NOT** the point!](http://www.sqlskills.com/BLOGS/KIMBERLY/post/Disk-space-is-cheap.aspx) and so many more of her excellent blog posts - she **clearly** shows just how bad an idea a clustering key on a GUID column is. Also - hotspots's are a myth that are long debunked - not a problem anymore anytime after SQL Server 6.5 ....
Comment: Fascinating. I will look into the "page splits and index rebuilds" option if performance becomes an issue. Thanks for that.
Answer: The primary key serves three purposes:

indicates that the column(s) should be unique
indicates that the column(s) should be non-null
document the intent that this is the unique identifier of the row

The first two can be specified in lots of ways, as you have already done.
The third reason is good:

for humans, so they can easily see your intent
for the computer, so a program that might compare or otherwise process your table can query the database for the table's primary key.

A primary key doesn't have to be an auto-incrementing number field, so I would say that it's a good idea to specify your guid column as the primary key.
Comment: It's definitely not a good idea to have a guid column as a primary key, because primary keys are clustered and guids are random. That means that any time you insert a new row your table is essentially being restructured on disk. People normally advise that primary keys should be sequential, ever-growing types so that each new row gets tacked onto the end of the table.
Comment: A primary key is by default backed by a clustered index but it can be removed (the clustered index).
Comment: @MattHamilton re "...not a good idea to have a guid column as a primary key, because primary keys are clustered and guids are random" to overcome this, you can use the "newsequentialid()" function on SQL 2005/2008 edit: found the requisite [CodingHorror post](http://www.codinghorror.com/blog/archives/000817.html) that talks about this ;-)
Answer: Just jumping in, because Matt's baited me a bit.
You need to understand that although a clustered index is put on the primary key of a table by default, that the two concepts are separate and should be considered separately. A CIX indicates the way that the data is stored and referred to by NCIXs, whereas the PK provides a uniqueness for each row to satisfy the LOGICAL requirements of a table.
A table without a CIX is just a Heap. A table without a PK is often considered "not a table". It's best to get an understanding of both the PK and CIX concepts separately so that you can make sensible decisions in database design.
Rob
Answer: Nobody answered actual question: what are pluses/minuses of a table with NO PK NOR a CLUSTERED index.
In my opinion, if you optimize for faster inserts (especially incremental bulk-insert, e.g. when you bulk load data into a non-empty table), such a table: with NO clustered index, NO constraints, NO Foreign Keys, NO Defaults and NO Primary Key, in a database with Simple Recovery Model, is the best. Now, if you ever want to query this table (as opposed to scanning it in its entirety) you may want to add a non-clustered non-unique indexes as needed but keep them to the minimum.
Comment: Actually, this is **wrong** - as Kimberly Tripp (the Queen of Indexing) clearly shows: having a **good** clustered index will **increase** the INSERT performance! http://sqlskills.com/BLOGS/KIMBERLY/post/The-Clustered-Index-Debate-Continues.aspx
Comment: I wouldn't call that _clearly_ showing :) She talks about general principles, not backing her statement with, well, anything, while I'm talking about a very specific scenario I have encountered in my practice: bulk-inserts of potentially hundreds of millions of records into a non-empty table, which is then never updated nor accessed in a random-read mode but only scanned in its entirety. I suppose there might be more factors at play than indexes though. Always test your optimizations kids.
Answer: I too have always heard having an auto-incrementing int is good for performance even if you don't actually use it.
Answer: A Primary Key needn't be an autoincrementing field, in many cases this just means you are complicating your table structure.
Instead, a Primary Key should be the minimum collection of attributes (note that most DBMS will allow a composite primary key) that uniquely identifies a tuple.
In technical terms, it should be the field that every other field in the tuple is fully functionally dependent upon.  (If it isn't you might need to normalise).
In practice, performance issues may mean that you merge tables, and use an incrementing field, but I seem to recall something about premature optimisation being evil...
Answer: Since you are doing replication, your are correct identities are something to stear clear of. I would make your GUID a primary key but nonclustered since you can't use newsequentialid. That stikes me as your best course. If you don't make it a PK but put a unique index on it, sooner or later that may cause people who maintain the system to not understand the FK relationships properly introducing bugs.

Tables with no Primary Key