Do all programs running in a computer show up in the processes tab in Task Manager?

Question: The reason I am asking this is because I am curious if there can exist a virus in the computer without me ever being able to know it exists. To be more specific, a virus that emits no signs of any sort.
Answer: There is a class of malware that can hide itself completely from the operating system known as a rootkit.
Rootkits are used to hide the evidence of other malware at work and are embedded very deeply in the operating system.  Because of their deep embedding they are able to manipulate process lists, filesystem tables and other important structures on-the-fly.
By manipulating filesystem structures in memory they can return false or misleading results for directories, specifically not showing files related to the main malware itself.  The files are there, and booting into an uninfected operating system such as a Linux LiveCD will show the files though, as they have to be stored somewhere.
Similarly, rootkits can simply drop certain processes from being reported to programs such as the Task Manager. The operating system core knows about them, as it needs to in order to schedule them, it has just been blocked from letting the outside world know about them.
Comment: @zyboxenterprises Maybe, maybe not ;) [Flame](https://en.wikipedia.org/wiki/Flame_(malware)) exploited Windows Update for its own purposes by forging a certificate, but that vulnerability has already been patched. There are no publicly known WU exploits, but that doesn't mean none exist. The one used by Flame wasn't known before too. (see [0-day attack](https://en.wikipedia.org/wiki/Zero-day_attack)
Comment: well dang, maybe someone should invent an anti-virus that runs on BIOS lol
Comment: @Raestloz: They achieve the feat by getting root access and then rewriting Windows to remove the bits that disallow it.  I've _heard_ that some of them do this by "booting" into the rootkit as an OS, altering Windows, and then they run Windows, so neither the user nor Windows has any idea that anything is unusual.
Comment: I'm curious, how do they achieve that feat? It seems like something that Windows should not allow in the first place. I mean, even "show process from all users" are less 'hiding' and more 'categorizing'
Comment: @zyboxenterprises Real Windows updates are signed and cannot be forged, but you could forge just the restart request dialog, or trick user into restarting in any other way, or force a restart (`shutdown -r -t 0`, no privileges required), or just wait until user reboots.
Comment: @Raestloz [flippant]*NIX is about as close as you can get to that.[/flippant]
Comment: @MooingDuck So in theory a harmless(?) Windows Update 'Windows needs to restart your computer to install updates' could potentially be a rootkit wanting to install itself when the computer reboots?
Comment: @Raestloz It's not a job for BIOS, but for a OS-independent antivirus: http://www.livecdlist.com/purpose/windows-antivirus
Comment: @gronostaj So the 'Windows Update' part of my answer is invalid? Should I remove that part?
Comment: @gronostaj There's always vulnerabilities in every program, and there always will be. It's just a matter of time until someone else finds another WU exploit.
Answer: All normal programs will appear there, but...

without an Administrator account you will only be able to see your own process (Admin accounts can choose to view everybody's processes)
rootkits will try to conceal its existence by hiding its process from the list, compromising the task manager (so it doesn't show him), hiding inside another process address space...
services will run as threads under a svchost process (in most cases), so there's no easy pointint at which service is running under a given svchost instance.

There are some programs designed for detecting rootkits. They do so by checking for instance the list of threads programmed for execution and the list of processes in the system (a thread not belonging to any process is a sign of a hidden process), or the list of files seen at high-level, and comparing it with the files it manually reads from the disk partition.
Nonetheless, once you are infected, it is possible for a virus to conceal its presence so good that it's almost impossible to detect. Those are usually termed APTs (advanced persistent threat).
Comment: Some of these points are somewhat invalidated by Sysinternals [Process Explorer](http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx) - limited users can see the file names of processes run by another user, and the tooltips of svchosts list what they're hosting.
Comment: @DebugErr, they look at high-level and low-level, then report the differences (sometimes producing false positives, such as when a file has been changed in-between). By _checking the list of threads programmed for execution_ I was refering to the double-linked list used by the OS scheduler ie. completely low-level: if it's not there, it doesn't get a time-slice (althogh there are more places to check, like the ISR).
Comment: Did you mean to write "threat" or did you mean "thread"? It actually works there ;)
Comment: How does a rootkit detector enumerate the threads or processes? If it's a typical way / WinAPI, can't a rootkit manipulate the enumeration and the rootkit detector won't notice this?
Answer: Background
The operating system has a component known as the kernel. One of the kernel's (many) responsibilities is to manage system memory (both physical and virtual).
As part of doing this, the kernel splits the available memory into two distinct regions known as user mode and kernel mode. The kernel and drivers share the kernel mode memory, and user programs and less critical system components reside in the user mode memory region.
Processes in user mode can not generally communicate with those in kernel mode, except through specially designated and controlled channels.
For completeness it should be mentioned that processes running in user mode are also isolated from each other, but can more freely communicate with each other using facilities provided by the operating system provided that the programs are designed to do so.
Processes
The kernel provides the ability to launch processes in user mode. When a process is created it is added to an internal list of processes that currently exist. When a program such as Task Manager asks for a list of processes, it receives a subset of the information in this list, filtered by per user permissions.
One means for malware such as a rootkit to hide its existence is to directly remove itself from this table. Having done this it can still execute, but would no longer appear on a process list obtained by normal means.
Since these processes still actually exist and execute, they could be found by inspection of other kernel data structures, such as handle tables, which hold information about resources a process has open (e.g. files), or by examining memory allocations from which it is more difficult to hide without hindering the software's ability to function.
Kernel Mode Drivers
Kernel Mode drivers used for many things including interacting with physical hardware devices. They execute under the control of the kernel as necessary, but since they are not a user-mode process they do not appear in the table of processes. and hence will not appear in Task Manager, or other tools concerned exclusively with processes.
Being able to run code in kernel mode is an important step to being able to effectively hide the existence of executing code. Under normal circumstances Windows requires that code in kernel mode be signed in order to run, so malware may need to use exploits in the operating system, other software, or even social engineering to get here, but once code is executing in kernel mode, hiding becomes easier.
Summary
In summary, it's possible to hide evidence of a processes existence, there's likely always going to be some indication that the process exists, because it will generally always need to use some form of resource in order to do whatever it was designed to, how difficult that detection is depends on the specific malware.
Answer: Viruses are pretty sophisticated nowadays. There can be a virus on your computer but not showing up in Task Manager. It is possible for Task Manager (and other parts of the operating system) to themselves be compromised, thus hiding the virus. For example, a rootkit.
If you're planning on relying on Task Manager to check for viruses, then you should stop now. Install an antivirus, and even an antivirus will sometimes fail to detect a virus on your PC.
Answer: There is one more simple way to "hide a virus" apart from others already nicely explained in other answers:
A compromised DLL (dynamically linked library)
A great deal of programs - nearly all of the untrivial ones - need one or more DLLs to run. Some belong to the OS itself (e.g. hal.dll, which abstracts hardware access for Windows), some are used by one program only, which is broken up to more small pieces (one .exe file and more .dll files with core functionality, plugins etc.) You don't get your virus to run all the time like an ordinary process or service, but your virus will be very hard to find indeed, since it will look like a completely innocent program or program component.
Further reading: http://msitpros.com/?p=2012

And there is one thing very appealing about this sort of virus-making: there are tons of websites offering a free (requires no payment) download of dlls which may for this or that reason go missing on your computer. Since the possibility to compare the checksums of the original and the new .dll file is very limited and almost nobody cares, the dll-viruses may enter and stay in the system for a long time unnoticed (unless, off course, an antivirus program detects them and the user agrees with deletion - you see the pattern already).
From the question I take it that we speak of Windows here, but this technique may very well apply to other OSes as well.
Answer: TL;DR: Windows' Task Manager is pretty limited in what it can do, and it *will not ever show every process running on your system. Want proof? Count (roughly) the amount of RAM the processes shown in Task Manager are using, and compare it to the RAM usage of the system; you should have at least 100MB RAM unaccounted for, and sometimes it rises to around 1GB, depending on what you're using the system for. Graphics cards can also take some memory from the RAM along with its own GDDR RAM.*
To expand on Pavel Petman's answer, I might add that many sophisticated cheat engines for games rely on injecting code into game DLLs that enable their cheats.
This type of compromisation is pretty hard to detect, and the same technique can be applied in this question.
If, say, a virus wants to go undetected, it can pose as a Windows update of the type that extracts itself to the system directories, the virus could overwrite a critical system file.
Most antivirus programs will not detect this type of virus, meaning the virus can go ahead injecting the virus code into the critical Windows DLLs (and also .exes).
When a client of mine tells of unusual behaviour, I always run Process Explorer (download from Microsoft) to detect any virus running. Process Explorer can tell you exactly which processes are running (even the ones that aren't in Task Manager), and also what DLL modules they are using.


Is NET::SCP uses multiple connections to transfer multiple files?

Question: HI,
   Actually i am trying to reduce the time taken to transfer N-number of files from remote machine local machine using secure file transfer, previously i used scp system command it establishes a connection for each file transfer.
Thanks in advance.
Comment: Net::OpenSSH::Parallel can handle several transfers in parallel.
Answer: Unless you have a bandwidth cap on each individual TCP connection, you are not going to get a significant reduction in download time by using multiple SCP connections.
You can check whether you get a speed up by putting a separate scp command for each file in a shell script and timing the script. Then rerun the shell script with & at the end of each scp line. If this speeds up the transfer and you want to really do this in Perl, look into fork or Parallel::ForkManager.
Answer: I think this would create a separate connection each time.  However, scp with the -r flag (which Net::SCP uses) recursively copies all of the files in a directory with a single connection. That might be the way to go, if you have your files in a few directories and you want to copy all of the files in those directories.
Otherwise, rsync with the --files-from option should use only one connection.  (Don't forget -z for compression, or -a).
If the only reason you're considering using perl to do this is that you want a single session, then just use the command line rsync to get this effect (with --files-from).  If you want perl power to generate the list of files-from, File::Rsync supports that.


What's the exact mechanism of spin coupling in NMR?

Question: The most common one that's found nearly in every textbook and site is that splitting occurs due to the alignment of neighboring proton either with or against the external magnetic field so as it's B effective is increased or decreased, However in Pavia's "Introduction To Spectroscopy" a different mechanism of coupling is described, in chapter 7.1 -Although the first mechanism is mentioned in chapter 5.1- where Dirac vector model is used with pauli exclusion principle to explain coupling, It doesn't state or mention the first mechanism, and actually I'm pretty confused how come both of two mechanisms can be used to explain the same phenomenon, They seem to be contraindicated with the first mechanism stating to be a matter of alignment with external field and second one stating to be a matter of internal electron and protons alignment, I understand both but I'm just not sure I can use them in the right place.
Answer: In a system with only one spin, the energy levels available to that spin depend on the strength of the external magnetic field (there is a direct proportionality).
In more complex systems, spin–spin coupling happens when the energy levels of spin 1 are affected by the spin state of spin 2, i.e. whether spin 2 is pointing up or down. This can happen in (at least) two ways:

through-bond coupling, also known as scalar coupling and referred to with the symbol $J$. This is primarily (though not exclusively) mediated by the Fermi contact interaction, which is all the electrons-in-bonds and Pauli exclusion principle stuff that you may have seen.
This only works if the two spins are 'connected' via a series of bonds that isn't too long.

through-space coupling, also known as dipolar coupling and referred to with the symbol $D$. This is because spin 2 generates its own magnetic field, which can either oppose or reinforce the external magnetic field.
This doesn't require the two spins to be linked by covalent bonds. However, in solution-state NMR where molecules rotate freely, the dipolar coupling is averaged to zero* and is therefore not observed in the spectrum.

These two interactions are not mutually exclusive, and the observed coupling can be a sum of both of these. However, in solution-state spectra you only really see scalar coupling because the dipolar coupling is averaged out, and people tend to loosely use the more general term 'coupling' to refer to scalar coupling.
Chances are, what you've been reading is a mixture of both. Practically speaking, for an introductory NMR course on organic molecules, you will only ever really encounter scalar coupling. Dipolar coupling is important in more advanced NMR, as well as solid-state NMR, but most people don't really deal with that at the undergraduate level.

* Higher-order effects of dipolar coupling, such as relaxation and the NOE, do still persist in solution.
Comment: I can't really comment without looking at the specific source you're using, unfortunately.
Comment: Yup - I don't have that book on hand, though, sorry. Anyway, you're probably asking about magnetically equivalent spins, which is not exactly the same thing as chemically equivalent. Magnetically equivalent spins still have a coupling constant between them, it's just that we don't see it in the spectrum, because of quantum mechanics (see e.g. https://chemistry.stackexchange.com/q/53478/16683). It's a bit weird, but that's how it is.
Comment: Can't describe how much your answer helped me, it took me a whole day searching and trying to understand how both the mechanisms relate, Also that coupling constant puzzled me and I couldn't move further, Thx so much!
Comment: I'm very thankful for this explanation, However I don't understand why if it's almost the scalar coupling we're encountering most textbooks and common websites uses the explanation of dipolar coupling, The literature doesn't seem consistent to me at this point, Our doctor talked only about the dipolar mechanism referring to - and using - diagrams of scalar coupling, Is it just a huge misconception?
Comment: Pavia's "introduction to spectroscopy" Chapter 5.1, also if there's a way i can upload Our doctor's PowerPoint. However I think this well enough for my question, Just one last question, If coupling depends on carbons which are non chemically equivalent then why there's a coupling constant for benzene ortho and para protons even though they're the same?


Authentication from Salesforce Streaming API

Question: I have a authentication problem.I have planned to use COmetD libray to subscribe any Sobject Changes to hit my java application.Is there any mechanism to authenticate a Call that comes from salesforce. I could not barely accept the json from salesforce  in my java application without any authentication.How to overcome this problem
Answer: The network layers take care of this authentication for you. When you subscribe to a CometD connection, you start by calling the Salesforce server, which enters a long polling loop with you. This connection is secured by TLS, which is considered unbreakable (at least, for TLS1.1 and above, which is required to connect to Salesforce at all). At no point does any outside connection attempt to contact your application; the session between you and the server is established by your client and verified by the TLS protocol. There is no practical way that a man-in-the-middle or some other server could inject data that your application would ever see.


Is it possible to call MathGL functions from .NET?

Question: As in the subject - if I would like to create a publication ready graph from .NET, is this possible?
Answer: I ended up calling the Matlab runtime functions. MatPlotLib also works well, but would require IronPython for interop between .NET and Python.
Answer: I think it is possible. You just need to use C functions of MathGL from .NET.


No filesystem is same as no Operating System?

Question: Some legacy computers/controllers don't have the filesystem with them is that because these devices don't have an Operating System?
If files cannot be saved to these devices, how can the factory control logic/program and other data get saved to the device?
Answer: Filesystem is basically the method for storing files in memory.
Memory devices, such as hard disks, flash drives, optical disks, memory cards etc. can store a fixed number of bytes. An empty, erased, 48-byte memory contains this:
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00

Now, let's say I have two text files

First one is called Greetings.txt and contains the word Hello.
The other is called Username.txt and contains the word gronostaj.

Files are encoded using ASCII, so each letter corresponds to one byte. After encoding using ASCII, the files' bytes are:

Name 47 72 65 65 74 69 6e 67 73 2e 74 78 74
Contents 48 65 6c 6c 6f
Name 55 73 65 72 6e 61 6d 65 2e 74 78 74
Contents 67 72 6f 6e 6f 73 74 61 6a

(I'm using hexadecimal values from the second column in table on that website.)
I can put first file's contents in our memory like this:
48 65 6c 6c 6f 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00

There are some issues, though.

What if I want to place a second file in the memory? How will I know where one file ends and the other begins?
Files have names, how do I store these?

To solve these, we can invent a simple filesystem. Let's say that we interleave file names with their contents, so that every file name is followed by content of that file, and separate them with zero bytes. Two sequential zero bytes mean "no more files".
47 72 65 65 74 69 6e 67    <- first 8 bytes of name 1
73 2e 74 78 74 00 48 65    <- next 5 bytes of name 1, then 00, then 2 bytes of content 1
6c 6c 6f 00 55 73 65 72    <- next 3 bytes of content 1, then 00, then 4 bytes of name 2
6e 61 6d 65 2e 74 78 74    <- next 8 bytes of name 2
00 67 72 6f 6e 6f 73 74    <- 00, then 7 bytes of content 2
61 6a 00 00 00 00 00 00    <- 2 bytes of content 2, then 00 00, so no more files

Or the same thing, but without ASCII encoding: (we can't store it in memory like that, it's just for the sake of readability)
 G  r  e  e  t  i  n  g
 s  .  t  x  t 00  H  e
 l  l  o 00  U  s  e  r
 n  a  m  e  .  t  x  t
00  g  r  o  n  o  s  t
 a  j 00 00 00 00 00 00

A real filesystem would also:

Store file creation and modification dates, attributes, permissions, metadata and other stuff
Contain some sort of table of contents so that files can be accessed almost immediately, without scanning entire disk until they are found
Support directories
Support files and file names that contain 00 bytes
Be able to recover from some failures
Support changing length of file without moving following files

But you get the idea.
Now, operating systems. Operating systems for most computers consist of files, so you need a filesystem to store operating system in it. But you could create a monolithic OS that doesn't have to work with persistent files and isn't stored in a file. FreeRTOS is one example. So while filesystems and operating systems are usually tightly coupled, they can actually exist without each other.
By "monolithic" I mean "a single piece of binary code". It would be a so-called blob: a sequence of bytes without a name, creation date or any other properties. After all, CPUs just process sequences of instructions. They don't care about file metadata or filesystems, they just want to be fed with tasks to execute. And if you can express these instructions as bytes, then blobs are sufficient!
And blobs can easily be stored in memory without any kind of filesystem. Actually we did that in our first example, when we just put content of file 1 in the memory.
I hope this answers your question!
Answer: The bios, operating system, and file system are distinct and separate elements, and an operating system can exist in read only memory on the device. So no the messages are not equal, but the operating system has one job, to be the interface between programs and the hardware. If the device does not have an operating system then the program or programs running on the device are the operating system.
It sounds likely that the system does not have an operating system if it is reporting no file system or a broken or incomplete partition/file system; But
... It may be that the mass storage device is mis-configured; or more specifically that the number of heads and tracks that bios is configured to use is not the same as the number of heads and tracks that the device has been formatted to use. When that happens the bootstrap can not load the complete file allocation system.
Does the system have a battery that ran out resulting in the loss of setup information. If so correctly matching the bios settings to the formatting will recover the system ...
Bios is the basic interface to hardware. The operating system is the interface for programs to use which has been standardized so programs do not need to care about what specific hardware is being used. The file system is the standard data table to access a mass storage device.
The bios loads first from read only memory on the driver interface device sets up interrupt points for access. Int 13 is the access point for the mass storage devices.
https://en.wikipedia.org/wiki/INT_13H ... the bios then loads the partition table, from track 0, sector 0 of the device and a bootstrap routine. http://www.ntfs.com/fat-partition-sector.htm
The partition table tells everything how large the hard drive is and the bootstrap routine at machine address partition table+3E hex, (if I recall my reverse engineering correctly this is at 0000:063E hex on the machine), normally loads the operating system, and drivers which are able to be more advanced.
If the computer's OS does not have mass storage support you can still hook into this bios's support and build a extension to the system based on mass storage device. But be advised the OS may be turning interrupts on and off to keep the requests to the bios sequential.
The bios itself can not handle multi-threaded operations. Specifically a call is made to the bios to instruct the hard drive to get ready to read or write at a specific location. The read write operations then take place on a second call to the bios. An more advanced operating system is needed because something has to prevent one program from getting ready to read data while another program wants to write data or data will be overwritten.
A file system is needed for programs to use the mass storage device without risking overwriting data or locking other programs out of using the hard drive or bios.

The operating system used by Altair basic in the days of the 8080 was very Minimalist. You could save files to the hard drive, by specifying what head and track to begin saying the file at. No file system was used, the user had to remember the head and track number the file was saved at, himself.
Not much of a disk operating system but it worked. The routines for reading the keyboard and sending information to the display were minimal as well.
Answer: I think there are two points to address here:

Some systems don't have a filesystem - does that mean they don't have an OS?
Where can configuration be stored if there is no filesystem (or it's read-only)

Baremetal
Some systems do not have an operating system - there is one application, and that application software interfaces directly with the hardware. This is common with small microcontroller systems, where the complexity is low. In this scenario the software will typically be bespoke, with the development team writing the drivers and abstraction from scratch, or using vendor code to facilitate their design goal.
This being said, such systems may support a filesystem. Simple filesystems such as FAT are commonly used to store logs and provide firmware update functionally.
Configuration will often be formatted and written directly to raw non-volatile storage, without using a filesystem.
Embedded Systems - Scheduler
Going up a level, we find slightly larger systems and an increase in complexity. At this point we will find Real Time Operating Systems (RTOS) - though not all have real time requirements - that are designed with a specific set if features. These systems will be built with a set of "tasks" that are scheduled for execution - usually other / arbitrary tasks cannot be run. It is common for these systems to readily support filesystems, networking, etc... by using vendor or community-produced code.
Configuration may be written to raw storage, or stored as a file in a filesystem.
Look into FreeRTOS, ThreadX, etc...
Embedded Systems
Now we find embedded systems that are even larger. Complexity has risen, and at this level we find a dependence on a filesystem to organise the system configuration and applications / software. We are now able to execute arbitrary applications, and the kernels will come with a whole load of drivers for various hardware.
Here we're looking at Linux, QNX, "Windows Embedded Compact", etc...
Software will typically be built for the system, calling on projects like busybox to provide much of the functionality, and using projects like buildroot and Yocto to build the various applications and produce an image.
Configuration will most likely be written to a file - though the is nothing to stop the developers from using raw storage like before, as these systems will usually run on custom hardware.
The filesystem is required, but may not be writable, and may be purely "in-memory" - limited in size, and all changes (if RW) are lost on a reboot.
Full User / Server Systems
Here we are looking at desktop PCs running a windowing system, read-write filesystems (usually on large disks), arbitrary code execution galore, configuration is definitely stored as a file - this is the type of system you're familiar with. Servers are generally quite similar to desktop PCs in the terms we're discussing here.
In the Linux world this would be a "distribution". You'll usually find some form of package management, so installing / uninstalling an application is a matter of downloading and unpacking (compiling too if you're using the likes of Gentoo).
Here we are looking at Linux, Windows, Windows Server, etc...

Above I've mentioned that smaller systems typically store configuration in raw non-volatile storage. This is done by deciding what you want to store, collating the data, and writing it into storage.
For example, we may want to store the following simple configuration:

The flange has precicely 52458 steps of rotation
The flange must be rotated to position 5547 at 05:00
The flange must be rotated to positron 49885 at 18:00

The numbers all fit into a 16-bit integer, so let's use that to represent steps. For the times, we decide to store in BCD for better compatibility with an RTC, so that's that.
We have the following data:

52458 --> 0xCCEA
5547 --> 0x15AB
05:00 --> 0x0500
49885 --> 0xC2DD
18:00 --> 0x1800

There values can be collated and written to storage as 10 bytes:
0x00000000    CC EA 15 AB 05 00 C2 DD 18 00

The application knows how to interpret this, so needs no support. By support I am referring to locating the storage area by name (e.g: filesystem and file name), and sharing understanding of the configuration with a human (e.g: JSON / XML / YAML / TOML).


What certificates are needed for multi-level subdomains?

Question: I'm working on a web site with a several levels of subdomains. I need to secure all of them with SSL, and I'm trying to determine the correct certificate strategy.
Here's what I need to secure:

foo.com
www.foo.com
Any combination of city.state.foo.com. (These are US states.)

My understanding is that a wildcard certificate can only cover one "level" of subdomain. According to RFC 2818:

Names may contain the wildcard character * which is considered to
  match any single domain name component or component fragment. E.g.,
  *.a.com matches foo.a.com but not bar.foo.a.com.
  f*.com matches foo.com but not bar.com.

What I think I need is the following certificates:

*.foo.com, which will match, for example, foo.com, www.foo.com. (Though I'm not clear on whether *.a.com matches a.com by itself.)
*.ny.foo.com to match new-york.ny.foo.com, buffalo.ny.foo.com, etc. I will eventually need 50 such certificates to match all the states, once our site expands to serve them all.

My questions are:

Is this scheme correct? In the scenario above, if a user visits ca.foo.com, will they get the certificate for *.foo.com or for *.ca.foo.com?
How can I ensure that users see all of these subdomains as legitimately owned by us? For example, if a user visits foo.com, then mountain-view.ca.foo.com, and those are different certificates, will they get a warning? Is there some way to assure their browser that these certificates share the same owner?
Comment: Aside from the exact topic of this question, it's worth noting that you could also do `foo.com/state/city`, which would be pretty user friendly.
Comment: You could cheat and use `city-state.foo.com` (dash) instead of dot. Then you would have only one level and would only need a single wildcard `*.foo.com` as well as `foo.com` as subject-alternative-names.
Comment: This sounds very much like one of the problems Stack Exchange is having with setting up TLS on their site.
Comment: Found the blog post: http://nickcraver.com/blog/2013/04/23/stackoverflow-com-the-road-to-ssl/
Comment: To answer your very last question - the browser will verify that the certificate matches the site you're on, and that it's issued by a trusted CA, and that it's valid at this point in time. Going from `foo.com` to `bar.baz.foo.com` won't trigger any warning, just as following a link from `foo.com` to `bar.com` won't. The browser does not care that there's a subdomain involved.
Comment: You don't need three certificates you need multiple subject alternative names within the same certificate.
Comment: @Ben: so has the idea of wildcard certs and single domain certs etc been replaced with one standard cert and any types of defined rules are contained? Or have I gotten my assumption that they're usually one type or another just that only one rule is normally enough?
Comment: @indivisible, there is only one kind of cert. Issuers generally charge more for a cert which has a wildcard name, but that's literally just their pricing policy. With a wildcard cert they will usually allow a couple of non-wildcard names in there too, so you should be able to create a cert which does what I suggest.
Comment: @Ben: Thanks for the answer - it clears up quite a few things about the technical implementations/limits where I'd only found commercial info up till now. If you want to expand your comments into a full answer I'll give you the bounty. Otherwise you can opt to edit your favourite existing answer with the extra details and I'll award the bounty there - your call.
Comment: Bruno identified RFC6125 s6.4.3 where it says browsers (specifically browsers rather than general usage) shouldn't accept multiple asterisks in a name.
Answer: Theoretically:

a * matches exactly one level (hence *.foo.com does not match foo.com)
but you can have several * in a name

Hence, if all SSL implementations faithfully follow RFC 2818, you just need three certificates, with names:

foo.com
*.foo.com
*.*.foo.com

and, if the implementations are really good at sticking with RFC 2818 and the intricacies of X.509, you could even use a single certificate which lists the three strings above in its Subject Alt Name extension.
Now, theory and practice perfectly match... in theory. You may have surprises with what browsers actually do. I suggest you try it out; some example certificates can be created with the OpenSSL command-line tool (see for instance this page for a few guidelines).
Comment: This does not seem to work with the "Subject Alt Name" extension.  `foo.bar.baz.example.com` is not covered with a cert for `baz.example.com`, that also has `*.baz.example.com` and `*.*.baz.example.com` as alternate name.  It appears to be that only the first wildcard is being considered.  Both Firefox and Chrome complain.  I am using nginx as a server.
Comment: As I wrote, what RFC 2818 states and what browsers do are different things. Browsers are a lot more restrictive. [RFC 6125](http://tools.ietf.org/html/rfc6125#section-6.4.3) is closer to what actually happens in practice. (The server species does not matter here, only the certificate contents and the Web browser.)
Comment: Near as I can tell, RFC 2818 doesn't talk about wildcards, beyond, "Matching is performed using the matching rules specified by [RFC2459]."; RFC 2459 is obsolete. Following the updates, all you get is "the semantics of subject alternative names that include wildcard characters are not addressed by this specification. Applications with specific requirements MAY use such names, but they must define the semantics." *That* spec seems to be RFC 6125, which states in a rather round-about fashion that double wildcards are illegal. It appears double wildcards are illegal both in spec, and in practice.
Comment: I'm seeing the same as @blueyed, browsers complain if certificates have multiple subdomain wildcards ala `*.*.baz.example.com`. It doesn't seem like having more than one subdomain wildcard is possible without browsers complaining.
Comment: The part about RFC 2459 is not about wildcards; RFC 2459 (and its successors, RFC 3280 and 5280) does not talk about wildcards. Wildcards are described by the sentence that follow in RFC 2818: "Names may contain the wildcard character * which is considered to match any single domain name component or component fragment"; that sentence is not an explanation of RFC 2459 rules, but an _additional_ matching rule.
Comment: I wanted to point out that multiple wildcard SAN's is more than theory. Microsoft Office 365 is using it in production at time of writing. (I found that out here http://stackoverflow.com/a/33109589/1695680)
Answer: RFC 6125 is quite recent and not implemented by everyone, but it tries to clarify some of these issues. It gathers the identity specification in RFC 2818 and RFCs of other protocols. I would suggest adhering to RFC 6125 if you can. The relevant sections for wildcard certificates are 6.4.3 and 7.2 (which discourages the use of wildcard certificates, in fact).
It's not clear from your question whether you want to run a single web server (or at least be able to run it all behind a single IP address), or if you're able to have a certificate per site (and thus an IP address per site, since SNI is not very well supported in general).
You could have a single certificate with multiple Subject Alternative Names (SANs). The problem comes from the case with two wildcard labels, which may not be clearly specified (*.*.foo.com).
If the double wildcard works, a certificate with these 3 SAN DNS entries should work:

foo.com
*.foo.com
*.*.foo.com

However, since it might not work (depending on the client's implementations, which are probably not under your control), and since you can list the 50 states, you could have 52 SAN DNS entries:

foo.com
*.foo.com
*.ny.foo.com
... (one for each state)

How can I ensure that users see all of these subdomains as
legitimately owned by us? For example, if a user visits foo.com, then
mountain-view.ca.foo.com, and those are different certificates, will
they get a warning? Is there some way to assure their browser that
these certificates share the same owner?

This is a tricky question, since it depends on how familiar the users are with the certificate verification process. You could get an Extended Validation certificate (although I think wildcard EV certificate are probably not allowed), which would give a green bar. This would give some "ownership" label in most browsers. After that, browser's interfaces themselves can be confusing (e.g. Firefox's "which is run by (unknown)" in the blue bar, which doesn't really help either way). Ultimately, the users could go and check within your certificate to see to which SANs the certificate was issued. However, I doubt many will do this and understand what it means.
Comment: @voutasaurus As far as I know, this is still valid (RFC 6125 has not even been fully implemented in all clients). I don't think anyone tried to consider multiple wildcard levels as a feature to add to any spec.
Comment: This was 4 years ago. What is the state of client support for multiple wildcard depth? Does anybody know about this for any of the major browsers: Chrome, Safari, Firefox, IE, Edge, Opera?
Answer: http://www.digicert.com/welcome/wildcard-plus.htm says

Even more, DigiCert WildCard ssl certificates are unique in allowing
  you to secure ANY subdomain of your domain, including multiple levels
  of subdomains with one certificate. For example, your WildCard for
  *.digicert.com com could include server1.sub.mail.digicert.com as a subject alternate name.
Comment: What a CA says in its marketing material should be interpreted with caution. How names are verified doesn't depend on them, but on the client implementations and how they follow the specifications. When read closely, this sentence could mean that they'd issue a cert with a SAN for `*.digicert.com` and another SAN for `server1.sub.mail.digicert.com`, not necessarily that the cert will allow any subdomain at any level once issued.
Comment: I just had a chat with them about this. Bruno is right - with a wildcard cert they let you add up to 10 single names, but you can also purchase extra wildcards and add them as SAN names. They will also issue duplicates of the original cert and you can add another set of names to that at no extra cost, though that would need an extra IP. They provide a web UI for adding names and reissuing is free of charge. They can allow up to 30 names per cert on request. Sounds like a nice service, similar to what AJ Henderson says StartSSL do.
Answer: You could either use a wildcard cert or you could also make use of a certificate with alternate domain names.  Personally, I use a certificate from StartSSL which allows me to have all of my domains listed on a single certificate.  I have something like 10 wildcard domains and 15 some other ADNs all on the same certificate so that I can use SSL across the sites I have hosted on my server.


Do not change the order of the tags in the editor

Question: I have a list posts by tag, but the relation is not relevant because first look for the posts with the first tags stored alphabetically, and not the first main tag, that is to say for me the order of the tags are key because the first tag is the most relevant. So when saving everything, it is sorted alphabetically and this does not help me, any idea how to alter this?
Comment: It may be easier to create your own custom taxonomy than try to alter Core alphabetization.
Comment: Terms/Tags aren't ordered, any order you see in the editor is purely circumstantial, there is no order mechanism in the database for terms. If you want to give special meaning to a term, you need to do so explicitly, e.g. store the term ID of the significant term in post meta
Answer: Terms/Tags aren't ordered.
To help make the terms easier to read, the editor will list them alphabetically, but that isn't because they're ordered alphabetically in the database. It's because a piece of javascript sorted the terms in the UI control.
There is no order, only the order you give them. Fundamentally terms have no order. Any order you see in the editor is purely circumstantial, there is no order mechanism in the database for terms.
If you want to give special meaning to a term, you need to do so explicitly, e.g. store the term ID of the significant term in post meta. You cannot rely on order, as terms do not have order.
Comment: Exactly, I think that this is not going to be able to at all from the CORE, because what wordpress does is that if a tag exists it is simply the same id in the relation of increased term the counter, and if it is a new tag then insert a new one tag with new id, but the order does not exist in itself. I cannot order by ID because I know that the last one is not always the one that I put as the first tag in the editor. I have to create a separate custom field to be able to make that possibility, thank you very much for the reply.
Answer: I faced the same issue and saw that while there is the wp_term_relationships table, it doesn't get properly updated with the tags' order on post update. As a workaround, I hooked into the rest_after_insert_this-post_type to update the order myself. Here is a more detailed explanation of what I did, along with some code that seems to work fine so far.
Comment: Hello, I find the article you created interesting, I'm going to check it to see if it works for me, is this also compatible with the Classic Editor?
Comment: I don't know if it works the same with the classic editor. My approach is specifically for Gutenberg and I've already tried it on a site, where it works fine. If you use the classic editor, though, you could try an [existing plugin](https://github.com/sectsect/wp-tag-order), which says that requires the classic editor, as it is not compatible with Gutenberg.
Comment: I use Gutenberg, I just wanted to see the scope of your solution, but I already check


Why did my eggless cup cake prepared with condensed milk get charred in a convection microwave?

Question: We have prepared the eggless cupcake with condensed milk. We have used convection mode in microwave.
Preheated to 200C and then baked the cake for 10 mins. It started off nicely, but at 10th min, we got the charred cake.
What could be the problem with this?
Comment: Could you possibly post the exact recipe that you are using? I've never seen a cupcake recipe with condensed milk before.
Answer: It's probably best to make this cake in an actual oven (even if the recipe specified a microwave oven) as the heat will be more even. Anyway, ovens can be remarkably inaccurate in temperature so perhaps although you set your oven at 200 C it may have been actually at 225 C say. The batter may have also been quite thick and so have a higher tendency to burn unlike a thinner, wetter batter, if you pair this with the inaccuracy of the oven temperature then it's not surprising that it burnt.
Hope this helps for next time!
Comment: @Sebiddyhef, Thanks for the nice answer. I will try this and let u know the result in due course. I will try these possibilities. 1. Reduce the temp to 175C and thinner batter. 2. 200C and thinner batter. What i have observed in the previous case, is it has raised  as expected and came down in seconds. May be stuff was not sufficient??
Comment: Perhaps you could just try a different recipe if all else fails, there are plenty of other eggless cakes using condensed milk as a quick google search: (http://www.google.co.uk/search?q=eggless+condensed+milk+cake) reveals.
Answer: I have been making black forest cakes in the microwave for over 6 years without any errors.
The time you used was way too long! For 600g it takes a maximum of 8 mins and 30 seconds to bake.
I make walnut and banana muffins based on which, I am giving you the following advice,
Next time make sure:

The batter flows slightly but is not too liquid;
Set your oven on combination mode if you can, or convection mode is fine;
Temperature 600ºC and time: first 2 mins, then a 30 second wait followed by another minute;
Test with a clean needle or toothpick after a minute of it cooling inside the oven.
Comment: I suggest you mistyped the temperature on step three.


What's causing all the disk activity on OS X?

Question: Occasionally my Macbook Pro will slow down as the hard drive clicks away endlessly. CPU load is low, but applications and menuitems are slow to respond. Is there a utility that can help me determine what's going on, such as the number of bytes read/written or files open/closed per process, over time?
Comment: 9 times out of 10 spotlight is the problem.  One thing I've noticed is that if you have a bootcamp partition, be sure to include it on the spotlight blacklist or mds will seem to always be chewing on it.
Comment: Thanks for the suggestion regarding Spotlight. I was just now experiencing very high disk reads, threw my Boot Camp partition into the Privacy tab in Spotlight prefs, and immediately disk reads flatlined! Been driving me nuts for months.
Comment: Speculating here, but it might be something simple like `mds` updating Spotlight's index.
Answer: From man iotop:

iotop tracks disk I/O by process, and
  prints a summary report that is
  refreshed every interval.
This is measuring disk events that
  have made it past system caches.
Since this uses DTrace, only the root
  user or users with the dtrace_kernel
  privilege can run this command.

This may not be precisely what you want - but it's a ksh script which wraps around dtrace, so you should be able to figure out how to make dtrace do what you need, if iotop doesn't handle it by default.
However, something like iotop -C 5 12 should give you something to start with: it will output 12 samples, each 5 seconds long.
Comment: Pretty good. `iotop -C 5 12` is a good way to get a summary of what's going on.
Answer: You can also use fs_usage to get a blow-by-blow account of what apps are hitting the disk.
Comment: Oooh, this is hot. `fs_usage` also lets you filter network and  filesystem activity.
Answer: I always noticed this on Saturday mornings, and it turned out to be locate, which updates its database at 3:15am on Friday nights.
I tried disabling its launchd configuration (in /System/Library/LaunchDaemons/com.apple.locate.plist), but it still ran anyway, so I just moved /usr/libexec/locate.updatedb out of the way. Problem…mitigated.
Answer: It might be the OS paging to virtual memory instead of something application specific. You might try quitting less frequently used applications or at least restarting some applications that like to build up in-memory caches over time (e.g. Safari). Check out the various per-process memory statistics with Activity Monitor to find likely culprits. If quitting some memory intensive applications seems to temporarily alleviate the problem, you might try adding RAM.
If the disk activity is not paging related, you might be able to use fs_usage to track it back to one or more specific processes.


How to Focus 3D View to Object Origin?

Question: I just did a fresh install of the newest Blender since I hadn't updated in quite a while but forgot about my essential custom keybind. I setup "Shift+J" as a focus on the origin of whatever object was selected. This was easier to me than moving the camera around manually but now I can't remember how I did it. I know it's buried somewhere in Preferences.
Answer: I figured it out! It was not in Preferences. Rather it was in "View", specifically the one in the top left of the 3D Viewport. Then I went to "Align View" and right clicked on "View Lock to Active" to input my shortcut.

How to Focus 3D View to Object Origin?


From iOS, how to communicate to Sphero when app is in background

Question: Assuming that the 'External accessory communication' background mode is enabled, is it possible to communicate to and from the Sphero while the iOS app is in background? If it is possible, what mechanism should I use? I'm trying to get the SensorStreaming example app to continue streaming while the app is in background.
Answer: Looks like a NO as current sphero is not BTLE:
Objective-C/iOS: Keeping bluetooth connection alive in the background
For BTLE accessories:
https://developer.apple.com/library/ios/documentation/NetworkingInternetWeb/Conceptual/CoreBluetooth_concepts/CoreBluetoothBackgroundProcessingForIOSApps/PerformingTasksWhileYourAppIsInTheBackground.html
But not sure you can have a continuos stream but maybe an event with a batch of data as app has to be woken up and max 10 seconds to do something with the info before termination.
Answer: Sphero communicates to iOS using Bluetooth Classic and not Bluetooth LE. As such, it's treated as an external accessory by iOS. In order to keep my app talking to Sphero in the background for greater than 10 minutes, I had to enabled the "External accessory communication" background mode and setup a timer in it's own run loop:


What are some "easy" unreasonable implications of O(1) time memory access?

Question: If you are given a memory address $n$ bits long, then you need to at least process those bits. Hence, if you have $N$ memory available, addressed by $n$ bits, it would take  $O(\mathbf{log}(N)) = O(n)$ time to access a given memory location, at best. I can see why it might be convenient to assume $O(1)$ memory access time because we don't go out of our way to abuse it in day-to-day arguments, and because $\mathbf{log}$ grows slowly. That said, what are some "easy" unreasonable implications of being able to access memory in $O(1)$?
Comment: Not a hardware expert, but I expect some micro-paralellism is going on, that yes, you need to see each of the $n$ bits, but the circuits can access them in parallel.
Comment: @jmite, but hardware is fixed, so as $n$ goes to infinity, you still need linear time with respect to the size of the address.
Comment: Right, but if $n$ is tending to infinity, then we're working with a theoretical model, which means memory access time depends on what we choose as our model of computation. We can axiomatically define a system to have $O(1)$ memory access, and there's nothing inherently contradictory about that, just like we can define non-deterministic Turing Machines or oracles. The question is, which is most useful in practice, and the consensus seems to be that modelling memory access as $O(1)$ provides the best model of real-world computing.
Comment: http://stackoverflow.com/a/941340/5191731
Comment: To some extent, you take this into account since it takes time for the program to write the address (if it's very long). However, once you've calculated one address, you can change only parts of it in $O(1)$. If you change higher order bits, then the resulting addresses are not adjacent, so this is somewhat unrealistic, as you mention.
Comment: Define "easy" and "unreasonable". Which model of computation are you talking about? Community votes, please: is this subjective?
Comment: @Raphael I guess I am really just asking for any literature or blog references on this matter. For example, hash tables containing $N$ objections now take $O(log(N))$ to access because you need to discriminate between $N$ addresses; on the other hand, mergesort or quicksort are still $O(N \mathbf{log}(N)$ from a direct application of Master's theorem. By "easy" I was trying to convey a preference for relatively accessible material.
Answer: Memory access is assumed to be constant time, because normally you access memory that is close to each other, eg. from one hard drive or one given computer. Under that assumption there is a constant maximum amount of time to retrieve that data.
You are right. If I access data randomly accross very large amounts of data, then it's nowhere near constant, but normally you can arrange the data beforehand in a way that makes it O(1), because of it fitting onto one machine or very close machines. Another reason is that, harddrives all come with their hardware. That means normally you won't be switching hard drives in and out of one machine, and each drive comes with it's own reader. Also most machines are limited to a certain amount of drives. Those technical limitation give O(1) comlexity to most pratical applications and the software perspective of things.
One easy and unreasonable implication of O(1) time memory access is violating the assumptions above by scattering data randomly, across multiple machines in an unordered fashion or switching drives in and out of machines and expecting O(1) access times. Anything relying on wrong assumption is doomed to be wrong and thus unreasonable.
Answer: The fault in the logic here is that n bits are processed in parallel. Roughly speaking out of those n bits, m<n bits are used to select the chip, and on the chip m-n bits are used to select the memory cell.
The chip select can be envisaged as offering all chips in parallel the relevant m bits of the address. Each chip has a unique ID, so only one of them will match that part of the address and start decoding the next n-m bits.
On the chip, pretty much the same process repeats: the memory cells are arranged in rows and columns. The incoming n-m bits are split in two. Half of those select the correct row, half select the right column, and at the crosspoint of the two is the right memory cell.
In practice, chips are grouped in DIMM's, inside a chip there are individual pages, memory access isn't bit-by-bit but typically 64 to 256 bits at a time, but that's irrelevant for the big-O picture. All relevant address decoding happens in parallel.
Answer: The easiest unreasonable implication is that such ignores the impact of temporal and spatial locality of reference in conventional systems. Processor caches cause accesses to other addresses within a cache block to be faster (spatial locality) and repeated accesses to the same address (temporal locality) when accessed while still in cache. Conventional implementations of virtual memory also cache address translations at page granularity. Latency (and bandwidth) in accessing standard DRAM will vary based on whether the access is a row hit (this avoids the need for a row activate command) and whether the DRAM bank being accessed has an active row (this requires a precharge command before the row activate command). Conventional storage devices are high latency block devices and copy data to main memory (in some cases to last level cache), again introducing issues of spatial and temporal locality.
Random accesses may have approximately constant latency when the working set size is within the capacity of one level of the memory hierarchy but much larger than the next level closer to the processor. That is, when the vast majority of accesses are satisfied by one level of the memory hierarchy. (Even this ignores cold-start latencies.)
Even without caching (i.e., copying data into a faster memory), basic physics encourage non-uniform access delay: storage that is physically closer to the processing element can have lower latency. In addition, while the speed of light limit would imply O($\sqrt[3]{N}$) latency (not O(log(N))), something between O($\sqrt[3]{N}$) and O($\sqrt{N}$) is probably more realistic because of the way systems are biased toward two dimensional layout (not that a circular single processor system with a radius of tens of meters is especially realistic).
Another factor is that for larger memories, reducing cost per bit of "distant" storage at the cost of latency becomes attractive because the latency cost of a slower technology is effectively constant while the latency cost of communication is related to distance. Not only are caches requiring spatial and temporal locality effective, but programmers even have some bias toward such locality (e.g., data members of an object are typically allocated together and referenced with some temporal locality because they are conceptually related). This further encourages the use of memory hierarchies.
(Distributing work to multiple processing elements increases the complexity of memory latency considerations. Because physical distance is a factor in latency and large crossbar interconnects are expensive, local memory will be used and access latency will depend on which processing element is accessing the memory. Each processing element is likely to have its own memory hierarchy with levels of sharing. In addition to reducing local latency, distributing computation facilitates increased local bandwith.)
Another factor involves the ability to overlap latencies (memory level parallelism). An algorithm that can do other work while waiting for a slow access will hide some of the latency of that access. By introducing necessary slow accesses at a higher rate more of the latency can be hidden (the accesses are effectively pipelined). Unlimited memory level parallelism changes a latency bottleneck into a bandwidth bottleneck.
(Asymptotic notation also inherently ignores constant factors and lower order terms, but in actual systems these can be significant.)


Sac Fly or not?

Question: Runners on 1st & 3rd with one out.  Runner on 1st attempts to steal as batter lines out to RF.  runner on 3rd tags and scores before runner attempting to steal is doubled off of 1st.  The run counts. How is the AB scored?  Sac Fly w/RBI or Double Play w/no RBI?
Comment: I believe it's scored the same as a ground ball to ShortStop. A double play with no RBI.
Answer: Rule 10.04(b)

The official scorer shall not credit a run batted in

when the batter grounds into a force double play or a reverse-force double
  play;

We know what a force out is (a runner is forced out when a fielder with the ball steps on a bag that they are required to advance to). But what is a "reverse-force"
Rule 2.00

(b) A reverse force double play is one in which the first out is a force play and the
  second out is made on a runner for whom the force is removed by reason of
  the first out. Examples of reverse force plays: runner on first, one out; batter
  grounds to first baseman, who steps on first base (one out) and throws to sec-
  ond baseman or shortstop for the second out (a tag play)

In other words it's the old force the runner at first, tag the runner going to second play.
This is not the case in the play described, and there is no error on the play so the batter would be credited with a sac fly and an RBI and the runner getting doubled off first base would get a TOOTBLAN
All rules citations from here
Comment: To clarify, because the batter flies out, the play at second is never a force play (the runner on first isn't required to run and in fact must tag up before attempting to advance). Because it's not a force play, the batter didn't hit into a DP; it's a simple flyout. Because he advanced a runner, it's a sac fly, and because the runner advanced home it's a sac RBI.

Sac Fly or not?


Do zombie testifacates naturally spawn like regular zombies in Minecraft xbox 360 edition?

Question: Do zombie villagers in the Xbox 360 edition spawn randomly or does there have to be villagers in the world originally
Answer: As of TU14, Zombie Villagers are part of console edition.
From the wiki:

Zombie villagers comprise 5% of all spawned zombies. They behave as ordinary zombies, but their character model's head and face is reminiscent of that of a villager, shaded with a darker green hue.
Zombie villagers can also result from zombie attacks on villagers. If any type of zombie kills a villager, there is a chance that the villager will transform into a zombie villager (100% on hard difficulty, 50% on normal, 0% on easy).

Zombie villagers will spawn in worlds where there are no villagers.
Answer: A few months ago, Zombie Testificates were added in an update to the XBox 360 (I don't have it for PC, so I was super psyched when I first saw this).
Comment: Do you know the exact release number?


Does audio signal change polarity?

Question: Does analog audio signal change polarity, or only "voltage level"?
Example, If I took the audio signal from a phone or computer and connected it to an electro magnet (basically just what a speaker is) will the magnet direction oscillate / switch back and forth between north and south or would the magnetic field never change direction only get weaker stronger with the frequency of the audio signal?
Answer: It switches back and forth. That's what "alternating" (the "A" in "AC") means.
The speaker cone both pushes and pulls from its neutral position.

However, in many applications, it is useful to add a DC signal to an AC signal so that the resulting sum is single-polarity. The most common example of this is the class-A amplifier. A DC "bias" signal is added to the low-level incoming AC audio signal so that the amplifying device is always in its "active" region. The amplified DC component at the output is removed (typically by a capacitor or coupling transformer), leaving you with just the amplified audio component.
Comment: That's what I assumed but reading online I see a lot of conflicting opinion saying its AC or AC with DC bias or AV (alternating voltage DC)  I't would make the most sense if it was actually AC "push pull" for speakers but how confident are you in your answer that it is actually AC?
Comment: See the second part that I added to my answer.
Answer:
"... an electro-magnet (basically just what a speaker is) ...".

It's a little more: it's an electro-magnetic coil in a concentrated magnetic field generated by a permanent magnet.

The interaction of the two generates motion.
The suspension is designed to hold the cone at mid or neutral position.
The alternating audio current will drive the speaker in and out depending on polarity. You can demonstrate this by connecting a 1.5 V battery to the speaker leads and alternate the polarity. (Higher powered speakers may require a higher voltage to give a discernible effect.)

Would the magnetic field never change direction only get weaker stronger with the frequency of the audio signal?

That implies a DC bias on the audio signal which is generally to be avoided.

Figure 1. Cross-section of a loudspeaker. Source: TonMeister.

Figure 1 shows the loudspeaker in the neutral position. The spider is horizontal and the coil is centred in the magnetic field.
Not shown, but worth mentioning, is that the pole piece will be, say, north pole and the top plate south. In this orientation flux will radiate from the centre outwards through the coil.
It is to be expected that this arrangement will work reasonably linearly for small excursions about the mid position. At high excursions the response will deviate from linear and some distortion will result.

Another reason for avoiding DC bias on the audio is that it will run the coil hot even when silent. This is undesirable.
Answer: It can work in both modes AC and DC.The DAC chip only converts digital bits into DC current and generate sound.If you apply an square wave(DC waveform) into the speaker,it still generate sound with very high frequency.The original sine wave appears as an AC current,however most of audio devices simulate the sine wave from square wave or from digital data as a compulsory property,AC current also generates much more noise that's avoidable for musical applications.Conclusion,it's just voltage level modulation without alternative current in most of the applications.
Comment: Welcome to EE.SE. Please explain in more detail what you want to say. E.g. "audio devices simulate the sine wave from square wave". And why does AC generate more noise than DC? And keep in mind to answer directly to the question,

Does audio signal change polarity?


Why do shiny surfaces reflect more light than other surfaces?

Question: I'm an A-level student and I love learning new things in physics.  A new concept that I learnt says that the reflection is due to the scattering of light by electrons in the material.  I've got my head around this yet something that bothers me is how do shiny surfaces like a mirror or reflective surface like silver or platnum reflect almost all of the light that it receives and yet certain other metals don't.  If it depends on the electrons scattering light, why is the material or composition of electrons so important?  What is the property that makes reflective surfaces the way that they are even when the number of electrons differs?
Comment: Could you make the title more descriptive? I'd answer the question, "Why do shiny surfaces reflect more light than other surfaces" with, "because that's how shiny is defined".
Answer: A clean metallic surface appears shiny because it is reflecting light. The interaction is due to the conductivity of the surface of the metal.
When surface conditions change, the reflectivity is reduced. For example, a clean aluminum surface is very reflective, and aluminum coatings are used on the back side of mirrors; the glass protects the clean aluminum surface.
If the clean aluminum surface is exposed to air it will rapidly oxidize. You can test this by scratching or cutting any thick piece of dull aluminum. The oxidized layer is actually a good insulator, but is quite thin.  The same holds for most other metals. If they don't tarnish, then stuff gets on the surface.
Comment: is it possible that in addition to the conductivity of the the metal surface that the glass and the internal reflection between its two surfaces also plays a part in smoothing out the image?
Comment: @Bill Alsept: glass is a dielectric reflector, so back-and-forth reflections are possible, but are suppressed if the surfaces are optically contacted. The front glass surface of a back-coated glass mirror will also reflect, but only about 4%. If you look closely, using a finely detailed object, you should be able to see a clear double reflection.


"Is planned" or "has been planned"?

Question: Which is correct, "a celebration is planned by the government" or "a celebration has been planned by the government"?
Answer: Why do you think one of them might be "incorrect"?
They are both grammatical, but have different structures, and hence slightly different meanings, though in practice they're probably interchangeable in most circumstances.
In is planned, "planned" is an adjective. The sentence is describing the state of the celebration.
Has been planned is a verbal expression, a "present perfect", so talking about an activity and its result.
To my ear, "has been planned" puts a little more focus on the activity of planning that has happened, so suggests that the government has put some work into the planning.
"Is planned" does not deny that possibility, but it doesn't focus on the activity. It might suggest that less work has gone into the planning up to now. But on the other hand, it might just mean that the speaker is more interested in the celebration than in the planning.

"Is planned" or "has been planned"?


Stationarity and seasonality of residuals

Question: Why is it necessary to evaluate stationarity and seasonality of model residuals? Or is it? The model in question is an OLS model that represents a relationship between Y and a bunch of economic variables.
Comment: Stationarity is irrelevant if your data are not temporal or spatial. Seasonality is irrelevant if you do not have data indexed by date within year. These replies are trivial but the question presumes a context which it does not spell out. Conversely, the question is much more general than just economic applications.
Answer: OLS is only supposed to work (and deliver minimum variance unbiased estimates) under a set of assumptions. If you run OLS but do not check the assumptions, you will not know whether you can trust the results. Therefore you want to check the assumptions.
Model residuals being non-stationary (for example, due to having a seasonal component in them) is a violation of the assumptions. Some forms of non-stationarity may be less harmful than other; if residuals are only heteroskedastic, OLS will still deliver consistent estimates (ones that converge to the true values when the sample size grows) although they will no longer be minimum variance (a.k.a. efficient); if residuals follow an integrated process (a.k.a. unit-root process), OLS is no longer consistent (am I right on this one?), and that is something you really do not want. Generally, if you see some pattern (like seasonality) in the residuals, it indicates that you have misspecified the model. The cure would be to think about model specification again (e.g. model the seasonality explicitly).
Comment: Normality does not hurt but is not essential (in my understanding of what is essential and what is not). Normality gives you exact small sample properties of estimators while without normality you have the same properties only asymptotically (i.e. for large samples). Also, normality makes OLS coincide with maximum likelihood estimation. However, normality is not needed for unbiasedness, consistency and efficiency of OLS estimators. I guess the book you read mentioned OLS as the 5th assumption of 5 assumptions, not the 1st one. But as I said, normality does not hurt.
Comment: Ok - I am not a statistician so I don't understand technical jargon. In plain english, OLS assumption is residuals should be normally distributed. So we should be checking for this by drawing the historam. Where is this pattern and seasonality and non-stationarity coming into play. Non-stationarity to me is if the variance is not constant over time. I don't quite understand how all of this is linked together. I have not heard/read any OLS assumption that talks about residual non-stationarity
Comment: Normality is not among the regular OLS assumptions. (It can be used as an auxiliary assumption, though.) In the answer I tried to be clear that if you see some pattern in the residuals (e.g. non-stationarity and seasonality), generally it indicates that you have misspecified the model.
Comment: Thanks, the book I read on OLS mentioned normality of residals as being one of the assumptions unless i understood it wrong. That is the reason we do QQ plot of normality of residuals. Is it not


How to i Combine Front and back leaf Textures that is not alpha From Cgbookcase.com with Maps. on a Leaf plane front and back with two uv Map?

Question:
I have two UV Maps on the mesh but I can not get UV map 2 to show at the bottom for the back of the leaf its a plane-shaped leaf...
Answer:
Use the Backfacing property from the Geometry node to mix the front and back textures.
Use the alpha of any texture as usual.


Broken push to close latch, drawer closed

Question: How can I open a push to open latch drawer stuck closed by a faulty latch?
Can anybody please provide me with some tips/tricks and advice as to how I may go about opening the drawer? It is full, I have no access to the mechanism from back, below or either side, drawer fully encased by cabinetry. The rails are on the side of the drawer, not able to push it anywhere to open. I have not been able to find any solutions online. Very frustrating!!
Thank you all.
Answer: Most of this style I have installed are magnetic. If you can't get a finger behind it a screwdriver may be needed to pop it open.


Twitter4J timeline in Android ListView

Question: I am using Twitter4J to get a public timeline from twitter. I want to display the data in a ListView but I don't know what to do with the List<Status> type I get from twitter4j. How do I get that into an Array so that I can use it with my ArrayAdapter.
If I am going about this completely wrong I apologize. I am new to Java and Android.
EDIT:
To be more clear I am trying to display my timeline in a ListView. I am using this code to get the timeline:
 Twitter twitter = new TwitterFactory().getInstance();
    try {
        List<Status> statuses = twitter.getPublicTimeline();

        System.out.println("Showing public timeline.");
        for (Status status : statuses) {
            System.out.println("@" + status.getUser().getScreenName() + " + " + status.getText());
        }
        System.exit(0);
    } catch (TwitterException te) {
        te.printStackTrace();
        System.out.println("Failed to get timeline: " + te.getMessage());
        System.exit(-1);
    }

How do I display that data in a ListView though? I know how to display a string array in a ListView using an ArrayAdapter but I am not sure what to do with this.
Answer: For storing the timeline , u can use an SQLite Database .
For displaying , you can extend the class simpleCursorAdapter which maps the database values to the views .
More info :- http://marakana.com/forums/android/examples/72.html

Twitter4J timeline in Android ListView


jEditable, undefined settings when using callback function

Question: I'm using jEditable and instead of using ajax to save, I just want to use the callback function to put the contents into a hidden form elements, the problem is using the callback function I receive this error:

Uncaught TypeError: Cannot read property 'settings' of undefined

This is the code I'm using:
     $('.editable').editable(function(value, settings) {
         console.log(this);
         console.log(value);
         console.log(settings);
         return(value);
      }, {
         submit  : 'OK'
     });

Any ideas what the problem could be? Thank you!
Comment: Could it be somewhere else in the code? What versions of jQuery and jEditable are you using? It seems to work at this jsfiddle: http://jsfiddle.net/william/6VUHh/.
Answer: I had exactly the same error message. But in that case I used the plugin ajaxupload for jEditable in my Javascript and called it like that:
$("edit_photo").editable{type:"ajaxupload"};

On updating jQuery I made only one file containing all the minified stuff to reduce the web to a single request. Then I recognized, that the plugin ajaxupload just was missing.
Answer: I had simillar problem with dblckick event.
Jquery.validate plugin (v 1.7) was throwing this error.
Fixed by installing new version of Jquery.validate (v 1.9).
Answer: I was getting this error because I was making a call to $("#element").rules() before a call to $("#form").validate() on the form DOM element. There error was the same using both jQuery Validate version 1.7 and 1.9 (I upgraded per the above suggestion before getting it to work).


Spatial adaption of points to polygons

Question: I have a point layer for the cold air flow in specific region. I would like to simplify all the single points to a polygon shape as to be able to join the data with other spatial data. My way is pretty complicated (buffer the points e.g.400m, dissolve, simplify) because I have to extract the single values (orange, blue, light blue) and then do it with all these single values separately. Afterwards there is the need to create differences in order to avoid doubles. I wonder if somebody knows a more convenient way.
Comment: I think you maybe want a concave hull (alpha shape) rather than convex
Comment: How can your point data not be joined with other data?
Comment: ..we want to define the whole area of e.g. yellow arrows and combine (union) them with other polygones so that we have a defined area with the attributes yellow+nature reserve+arable land + etc...
Comment: frankly, not but it hits my point exactly. I will test it out. Thank you so far and sorry for missing it out.
Answer: Assuming that all the points are in the same layer, and they already an attribute with the desired unique values (classes) I would do the following:

Create Voronoi polygons for the point layer (this avoids overlapping)
Dissolve the polygons using the mentioned attribute to dissolve adjacent polygons of the same class.
Run multiple parts to single parts to split the multi-polygons into single part polygons
Clip the result to the area of interest
Comment: this is smart, thank you!

Spatial adaption of points to polygons


iPhone Quartz. How do I create a matte using a path rather then a bitmap?

Question: In the visualization app I'm writing I want to shape a graphic using a matte created with a path. The graphic is a horizontal rectangular strip with various shapes drawn within. Atop this rectangular strip I want to draw an ellipse to act as a matte that shapes the rectangular strip to make it appear to drawn within the ellipse. How do I do this?
In this simplified example, I am trying - and failing to make the background blue rectangle to appear as a blue ellipes by drawing an ellipse atop it using various blend modes.
- (void)drawRect:(CGRect)rect {

    CGContextRef context = UIGraphicsGetCurrentContext();

    [[colorDictionary objectForKey:@"blueSolid"] setFill];
    CGContextFillRect(context, self.bounds);

    //CGContextSetBlendMode(context, kCGBlendModeNormal);
    CGContextSetBlendMode(context, kCGBlendModeDestinationIn);

    CGContextFillEllipseInRect(context, self.bounds);

}

Thanks,
Doug
UPDATE: SOLUTION
In brief: clipping paths. Dooh! The following code snippet creates the effect I am after which is a blue ellipse against a red background. Note, the blue ellipse is created by constraining a blue rectangle to the shape of the ellipse. This is what I need. Cool.
Hope this helps someone else. Clipping paths are super powerful. Cheers.
CGContextRef context = UIGraphicsGetCurrentContext();

[[colorDictionary objectForKey:@"redSolid"] setFill];
CGContextFillRect(context, self.bounds);

CGContextBeginPath(context);
CGContextAddEllipseInRect(context, CGRectInset(self.bounds, 32, 32));
CGContextClip(context);

[[colorDictionary objectForKey:@"blueSolid"] setFill];
CGContextFillRect(context, self.bounds);

Comment: I answered my own question after looking closer at the Quartz programming docs. Hope this helps someone.
Answer: In brief: clipping paths. Dooh! The following code snippet creates the effect I am after which is a blue ellipse against a red background. Note, the blue ellipse is created by constraining a blue rectangle to the shape of the ellipse. This is what I need. Cool.
Hope this helps someone else. Clipping paths are super powerful. Cheers.
CGContextRef context = UIGraphicsGetCurrentContext();

[[colorDictionary objectForKey:@"redSolid"] setFill];
CGContextFillRect(context, self.bounds);

CGContextBeginPath(context);
CGContextAddEllipseInRect(context, CGRectInset(self.bounds, 32, 32));
CGContextClip(context);

[[colorDictionary objectForKey:@"blueSolid"] setFill];
CGContextFillRect(context, self.bounds);


How can I stop KDE apps from being shown in the Software Centre?

Question: Their size is so big, that's why I will never download any of them so they're just been in my way to find the native software that am willing to download from Ubuntu software center, so is there is anyway to delete their PPA or whatever?
Answer: You cannot, but try Synaptic instead
Most KDE apps are in the official repositories and not in a PPA, so there's no way to prevent them being shown when you browse/search in the Software Centre.
As an alternative, try installing the Synaptic Package Manager instead, and look at the listings under the "Gnome Desktop Environment" sections for a selection of "native" apps:
Comment: Thanks a lot for clearing thing, I like to stay with USC so I guess will have to learn to live with them being around :)


proving an unknown organic compound using reactions

Question: I have been given three spectras (MS, IR, H NMR) to analyse, from them I have found that the compound is chlorobenzene (and I've confirmed online). The task I have gotten asks me to further justify my findings by using reactions and predicting and analysing the spectra of the products. However, I am quite unsure how I'm going to predict and analyse the spectra of the products from the reaction to prove my compound.
Comment: You could think of some characteristic reactions that chlorbenzene would undergo and then evaluate your hypothesis based on product spectra. For example there's one reaction through aryne intermediate. I wonder then if you could also test for chlorides in the reaction mixture.
Comment: As comment on language: The (single) "spectrum", and in plural several "spectra" (well, Webster lists "spectrums" as an alternative of modern times, too).  For future reference, please refrain from thinking /saying / writing  three "spectras" which were two plurals in one word.
Answer: The task you had being assigned is called identification by derivatization. It's one of the strongest proof for the confirmation of the structure of a molecule.
If you have an hard-to-identify compound X, you can make it react with Y and then analyze the product of the reaction, X-Y, instead.
I once synthesized a polysubstituted aromatic compound and wasn't sure whether or not a iodine atom was present on the ring. So I performed a Heck reaction on the molecule obtaining the corresponding substituted olefin, which was a known compound, present in the literature and could be identified by its NMR spectra.
Chlorobenzene is quite an anonymous compound and its derivatization does not lead to significative compounds. Just an example to answer your question, you can perform a nitration to get o-chloronitrobenzene which is a solid and can be identified by its melting point.
Comment: +1 For the example in the end, nitration will give a mixture of o- and p- nitrochlorobenzenes. You might further nitrate this mixture or use stronger conditions in the initial reaction to get 2,4-dinitrochlorobenzene which is also a known compound.
Answer: The key is to unequivocally form something (I'm presuming these are thought experiments)  so there can be no ambiguity.  The aryne example to get only one product is a good one.  Could you also use deuterium compounds e.g. form an organometallic and quench in one case with water (to give benzene)  and in the other with D2O as a comparison? Gentle reduction with H2 or D2 would have the same effect. Forcing conditions would give cyclohexane.
Comment: Not bad in theory. In practice Cl-metal exchange doesn't generally work with chlorobenzene. The reduction would work but then you create benzene or d-benzene that would not be easy to isolate and characterise.
Comment: Mass spec, boiling point and NMR, proton and carbon


Imagemagick: Convert PNG lost "image data"

Question: I'm using this command and all I get is an empty black image:
convert image.png image.tif

All I need is the same image in tif and with a white background.
Answer: Your original PNG has a transparent background. If you want to convert to a non-transparent background (which is done implicitly if the target format does not support transparency), you should specify yourself the desired color.
I believe something like this should work
   convert image.png -background white -flatten -alpha off image.tif

For details, see here.
Answer: It's because the transparent background is automatically converted to black colour. So your output is as expected - black text on black background...
You need to set white background, flatten the image and remove transparency before converting to tiff. So use:
 convert input.png -background white -flatten -alpha off output.tif

See more at:
http://www.imagemagick.org/Usage/masking/#remove


"Wordpress" should be in Pascal Case, as "WordPress", in the blog's footer

Question: In The Overflow blog's footer the word "Wordpress" should be stylized in Pascal Case as "WordPress". That's how it's usually written, see wordpress.com.
Comment: I want to split the difference and just go "The appropriate case" :D
Comment: I think that is intentional, @GeorgeStocker. I even left it be when editing to preserve the play despite considering correcting it.
Comment: Title case? It spelled *"[WordPress](https://en.wikipedia.org/wiki/WordPress)"* and is independent of casing. "Wordpress" is a ***very*** common misspelling of "WordPress".
Comment: Ahem, Pascal Case (aka Upper Camel Case), ahem
Comment: I love that this post title doesn't even have WordPress in Pascal case, even though it's complaining about WordPress not being in Pascal case in the footer.  That irony is delicious.
Comment: I've edited to use the correct case for WordPress in the title. While there are arguments for and against doing so, IMO, it's better to show a correct version in the title, as that is more likely to reinforce correct usage. Most people only ever see the title of a post and never click to open the full question. For something like this, having only the incorrect version in the title provides yet another place where people see the incorrect usage, which reinforces using it in the incorrect way.
Comment: I urge the previous editor (not Sonic) to read the article they linked *very* closely - the title case is for Capitalized Words, the correct case for WordPress is PascalCase.
Comment: @bad_coder it's WordPressCase. ;-)
Comment: @P.Mort.-forgotClayShirky_q I'm a bit confused right now of exactly what to call it...
Comment: @Makyen I agree that showing correct examples of stylizing is the best way to lead users to mimic the right way of writing it. Good edit!
Answer: This has been fixed, it's currently displayed as shown in the screenshot:


Is it cryptographically insecure to use fixed-length AES-GCM messages?

Question: Is there any weaknesses to encrypting fixed-length messages? Should a random amount of padding be added to the message to decrease the odds of some sort of attack?
Comment: GCM is CPA secure so no problem and actually mode than Ind-CCA since it has authenticated encryption. [What are the rules for using AES-GCM correctly?](https://crypto.stackexchange.com/q/84357/18298)
Answer: An adversary who obtains AES-GCM ciphertexts but does not know the key cannot obtain any information about the plaintexts except their lengths. This is (in a highly simplified form) the definition of the claim that AES-GCM is secure. This is true for any secure authenticated cipher.
If your plaintexts are intrinsically all the same size, this is an ideal situation, because the ciphertexts leak no information at all about the content of the plaintext.
If your plaintexts can have different sizes and the size of the plaintext leaks some information that you want to keep secret, then padding plaintexts so that they all have the same length is a possible solution. Beware that the generation of the message, the padding process, the unpadding process and the processing of the unpadded messages are likely to take time that depends on the length of the plaintext, so it may still leak through timing. Appending padding to the message may not be the best solution: depending on how the message is structured, it may be easier to construct a secure system if you arrange each part of the message to have a fixed size, and concatenate those fixed-size parts. That way the assembly and parsing of messages is less likely to reveal confidential information through side channels.
Adding a random amount of padding is unlikely to help security. In particular, if the same message is likely to be transmitted many times, an adversary can average out the lengths, which will negate the uncertainty of the random padding. However, it can help in some scenarios where you want to hide which message was transmitted for privacy (for example, to make it harder to figure out which file a user download on a server). Still, the only fully reliable way is to have fixed-size messages (in the download privacy example, this would mean padding all files to the length of the largest one).
Comment: About hiding the length of message, allocating a zeroed buffer (like calloc), and xor masking the message with a fixed length byte sequence before encrypting can do perhaps. And we need constant time copy of the message into buffer. And just writing from the original buffer can leak memory contents to whoever it is intended.
Answer: Yes, it may be because the size of the message is directly leaked. This is the kind of thing that professional cryptographers learn at the first day and then forget about. However, it depends on the type of message that is encrypted and the context if hiding the size makes any difference.
Usually the size of the message is indicated in bytes. GCM can work on any bit string, but generally implementations require a plaintext message be build out of bytes. Adding a random amount of padding or padding up to a certain size can help disguise the size of the message.
Any encryption leaks some length information about the plaintext message, even if padding is applied. If the ciphertext is a certain size then the plaintext message fed to the cipher needs to be smaller after all, and padding won't help against leaking that kind of information.
Beware that statistical data may still reveal information about the plaintext messages before encryption, especially regarding max and minimum sizes. Adding, say, 0..10 bytes of random padding will also not help that much if your message is e.g. multiple gigabytes in size. If you can pad to the maximum message size that is best, but of course it will could create a lot of ciphertext.
Note that I would then deliberately put padding inside of your protocol, to be applied before GCM is used. You can use any padding value. Don't use one of the existing padding modes used for block ciphers and combine that with GCM. For instance, you could specify <code>"AES/GCM/PKCS5Padding"</code> in Java, but that really doesn't make sense at all; it may work differently in specific implementations, if it is not outright rejected.
GCM itself works perfectly fine with fixed size messages, other than the more generic issue about leaking information about the plaintext (which every mode does to a certain amount).
Comment: "leaking information about the plaintext" If it leaks any information other than the length, then it's broken, by definition of the security of a cipher.
Comment: Well, there is such a thing as timing, deterministic ciphers etc. But yeah, true for IND-CPA ciphers I guess, and then mainly in a theoretical sense.


Using autofill with a MAX function within a macro

Question: I know you've answered similar topics which I have tried to duplicate, but I am a novice and apparently need the answer spelled out for me! I am trying to apply autofill code to a MAX formula column within a Macro, so that it will autofill to different row counts each time.
Range("AC2").Select
ActiveCell.FormulaR1C1 = "=MAX(RC[-2],RC[-1])"
Selection.AutoFill Destination:=Range("AC2:AC285")
Range("AC2:AC285").Select

Thank you!
Comment: The code above works. What are you trying to do?
Comment: I am trying to change it so the macro will apply autofill to that MAX column to the correct number of rows, since I will have a different row count each time I run it.
Answer: Assuming there are no blanks between the first and last row in column AC this will work and you don't even need AutoFill
With Range(Range("AC2"),Range("AC2").End(xlDown))
     .FormulaR1C1 = "=MAX(RC[-2],RC[-1])"
End With

This works specifically becuase you are using R1C1 notation which can be applied across all cells.
If there may be blanks, you can find last row like below and fill the formulas the same way:
Dim lastRow as Long
lastRow = Range("AC" & Rows.Count).End(xlUp).Row

With Range("AC2:AC" & lastRow)
    .FormulaR1C1 = "=MAX(RC[-2],RC[-1])"
End With

Answer: It is only important to fill the formula down to the last value within the columns referenced within the formula.
dim lr as long
with worksheets("sheet1")
    lr = application.max(.cells(.rows.count, "AA").end(xlup).row, _
                         .cells(.rows.count, "AB").end(xlup).row)
    .Range("AC2:AC" & lr).FormulaR1C1 = "=MAX(RC[-2],RC[-1])"
end with

Answer: So you have two main tasks:

how to define last row in a given column;
how to define range, based on a row and column;

This is the answer both:
Option Explicit

Sub TestMe()

    Dim currLastRow As Long
    currLastRow = lastRow(columnToCheck:=4)

    With Worksheets(1)
       .Range("D1").FormulaR1C1 = "=MAX(RC[-2],RC[-1])"
       .Range("D1").AutoFill Destination:=.Range(.Cells(1, "D"), .Cells(currLastRow, "D"))
    End With

End Sub

Function lastRow(Optional wsName As String, Optional columnToCheck As Long = 1) As Long

    Dim ws As Worksheet

    If wsName = vbNullString Then
        Set ws = ActiveSheet
    Else
        Set ws = Worksheets(wsName)
    End If

    lastRow = ws.Cells(ws.Rows.Count, columnToCheck).End(xlUp).Row

End Function

The lastRow function gives the last row per column. In your case, you want column D, e.g. the 4. column.


How can the same virtual particle both attract and repel charged particles together?

Question: so I've read a lot of things about QED and stuff, and I've clearly understood that charged particles are in fact "charged" because they exchange virtual photons, small packets of energy with each other, and that's ok. But I've always asked myself: how can two charged particles exchange the same virtual particle and act differently (attraction / repulsion). I've already seen the boat example of the conservation of momentum, but that makes me think that maybe charge is related to the quantum spin and orientation of the particle and direction of emission of the photon? So then why are some particles that don't have spin charged? I'm having a hard time with this. Please don't answer if your response is: "They act like this because that's how they are built", because i could say that protons are charged because that's how they are built, but we all know they are made of quarks, so I'm searching of a correlation with what I've just said.
Comment: I wanted to add, I've also seen the explaination that it's because it could increase or decrease the electric potential energy between the particles, but all opposite and like charged prticles have positive mass, so wouldn't energy increase anyway?
Comment: Also, I would like more of a concept answer than math because from what I've seen, other answers brought up maxwell's equations and stuff, but these simply describe the behavior in relation to electric charge, but they don't explain charge itself. For example i could say that I start moving because God pushes me at 1 m/s². Of course this isn't true but it serves as a good example.
Answer:
I've clearly understood that charged particles are in fact "charged" because they exchange virtual photons, small packets of energy with each other, and that's ok.

You are confusing the natural reality which has recorded charged and neutral particles with measurements and observations, with a Quantum Field Theory model for fitting those observation in a confused manner.
In QFT the charge of the particle can be modeled as virtual photons , but not as

are in fact "charged" because they exchange virtual photons, small packets of energy with each other

but virtual particles are not small packets of energy. They are part of the mathematical model of QFT which uses Feynman diagrams for its calculations, and are called virtual because they are off mass shell and exist only in the mathematics of the calculation of particle interactions.

My answer here goes into the Feynman diagrams whose calculations will allow attraction and repulsion, and a bit about the boat analogy.
Comment: Yes, I know that I didn't explain very well, but really what I don't understand is how two particles can exchange the photon in the same direction and, based on some unexplained reason called charge, they either attract or repel. I mean this in the real world, not in maths. In fact, if I look at the diagrams for electromagnetism, I see that when charges are like, particles seem to emit photons in a specific direction, hence the question for spin. Moreover, from what I know the Feynman diagram explain how particles react to an exchange of virtual particles, but now why.
Comment: I kinda feel like QED, Maxwell's Equations etc. serve only as models for predictions, but not understanding the reasons.
Comment: @BlueCrasho  It is not a matter of directions, it is a matter of **probability** for the electrons  to scatter off in a given direction with given momentum and energy . It is quantum mechanics, and if you are serious about  physics you have to study its mathematics . The only way to really understand a QM theoretical model,


Android in-app billing error code - Error OR-IEH-02

Question: I released a new version of my Android app, along with a newly added managed in-app purchase product. However, many users are not able to make a purchase of the new product, and reported having an error code when attempting to make a purchase that says "Can't purchase. Error OR-IEH-02".
So far we have not been able to reproduced the error as a test user. Any idea on what the error code means?
Answer: This means payment is being denied to to Google Play's fraud risk controls. Either your users are potentially fraudulent, or Google Play is incorrectly detecting their payment method as at a very high risk of fraud. The only thing you can do is contact Google Play support through the help menu on the Play console.