Where did the phrase "batsh*t crazy" come from?

Question: I am curious how this term came to be. I've found this question on various forums, but none of them seem to agree where the term came from. The most popular explanation seems to come from "bat in the belfry," but I don't see how the two are necessarily connected.
Comment: Could it have anything to do with the fact that the fungus Histoplasma capsulatum resides in bat guano, and, since the fungus infects the brain of the host, makes them behave in a psychotic manner?
Comment: Related: _[The origin of the word "bats" to mean "mad" or "insane"](http://english.stackexchange.com/q/12073/5822)_
Answer: I started to type up an answer summarizing several theories about its origin and first use, but then I found that since the last time I tried to look it up, the Oxford English Dictionary has in fact added an entry for this term (in the online edition), along with some helpful citations. Turns out the phrase didn't originate with Hunter S. Thompson, or with Kubrick's Col. "Bat" Guano in Dr. Strangelove.
Here are the definitions provided by the OED, along with the earliest citation for each:

A worthless or contemptible thing; rubbish, nonsense. Cf. bullshit n. (1950 M. Shedd Return to Beach ii. 156: "I felt the minute hand of that bat shit of a Judas clock stand up to me.")
Austral. Used in similative phrases as the type of something dull or uninteresting. Chiefly in boring as batshit. (1964 G. H. Johnston My Brother Jack iv. 58: "He would describe somebody as being 'as silly as a two-bob watch' or 'dreary as bat-shit'.")
Crazy, mad, insane. Cf. bats at bat *n*. 1 b. Orig. and freq. in to go batshit (cf. to go ape-shit at ape n. Additions). (1971 W. Calley Lieutenant Calley 104: "Most of America's males were in Korea or World War II or I. They killed, and they aren't all going batshit.")
As an intensifier, esp. in batshit crazy. (1993 Toronto Life Aug. 6/4: "His mug is emblazoned with the words: full-blown bat shit crazy.")

So, while batshit crazy certainly does seem to be influenced by the expression bats in the belfry as you suggest, its first meaning, in use by 1950, was simply a variant of bullshit. This use continued and overlapped with the "crazy" meaning: further citations are given for definition #1 from Dean Koontz's 1985 novel Door to December and from Seattle Weekly in 2002. Also, batshit as a standalone word meaning "crazy" appears to be older than the two-word phrase batshit crazy, at least as far as the written record shows.
There's anecdotal evidence scattered around the internet, like in this Straight Dope Message Board discussion, that definition #1 was in common use in the US military during the 1950s. Someone else points out there that Hunter S. Thompson may have picked up the term in the Air Force, from which he was discharged in 1958. Apparently he used the terms batshit, batshit crazy, and/or batshit insane in Fear and Loathing in Las Vegas and/or Fear and Loathing on the Campaign Trail '72, but I don't have either book handy to check, and none of the claims I've found includes a full quotation.
Comment: Any thoughts on the difference between *apeshit* and *batshit*?
Comment: There's no *batshit, batshit crazy* or *batshit insane* in *Fear and Loathing in Las Vegas*.
Comment: @ect: [*go apeshit*](http://english.stackexchange.com/questions/25535/what-is-the-origin-of-the-phrase-to-go-apeshit/66711#66711), meaning "to go crazy", is from the 1950s, before and possibly inspiring the *batshit* "to go crazy" from the 1970s.
Comment: Perhaps they aren't two definitions?  "That's crazy" and "That's bullshit" can mean the same thing.
Answer: From an inexplicably deleted answer is a 1983 cartoon by P. S. Mueller (the voice of Onion News Radio) captioned:

Full blown batshit crazy and still holding down a productive job

Mueller adds:

Since I first published this cartoon around 25 years ago, I have received more correspondence about it than anything I have done before or since. I guess it struck a chord. As far as I knew at the time or know now, the phrase "Full Blown Batshit Crazy" just sort of fell out of my head and appears to have entered some part of the language. I seem to have the dimmest memory of a guy I knew in my early teens uttering the word "Batshit" on the school bus and nearly killing me with it. I could have it all tangled up with another guy or made it up myself, but it certainly sounds like something Birdy would have said.

I'm not sure when Mueller was born, but he "began
contributing drawings to the Daily Egyptian at Southern Illinois University-Cabondale" from 1967, so his early teens batshit memory was probably around the early 1960s.
Answer: The word crazy is a later addition. Scanning Google Books I find a handful of references starting from the mid-60s where batshit is clearly just a variation on bullshit (nonsense, rubbish) - which meaning still turns up even in 2001, but it's relatively uncommon now.
Here's a relatively early one from 1967 where the meaning is crazy. A decade later most references have this meaning, but the earliest actual "batshit crazy" I can find is this one from 1989.
I'm not sure it makes a lot of sense to call batshit a "euphemism" for bullshit, but it does seem to me that's how the word got started. In ordinary speech there's no meaningful difference between "That's bullshit!" and "That's crazy!". Bats in the belfry/batty had been around since 1901/1903; obviously people just latched on to that crazy connotation, thus popularising the word-pair.
Answer: This might be a stretch, but what the author says here makes some sense.

However, it was interesting to note the first recorded usage of each of the elements of the phrase: bat appeared as bakke in C.E. 1340; shit appeared as schite in C.E. 1308; and crazy appeared as crasie in C.E. 1583. Knowing as we do that a) modern English words beginning in sh or sch began life as Scandinavian words beginning in sk, and b) bakke, with its hard b and double k, is obviously also of Norse derivation,  it wouldn't be too improbable to guess that Vikings were running around Northern Europe describing last night's pillaging as totally "bakke-skite."

The term has on occasion been attributed to Hunter S. Thompson, who was a lover of bats and quite crazy in his own right, but I believe the term originated well before Thompson's time.
Comment: I'm not sure I buy it, though. Just because 3 words came from the same roots, doesn't mean that the phrase itself was ever used.
Comment: This doesn't say where batshit *crazy* comes from, though.
Comment: It ties the first known use of all three words together and shows the commonality amongst them as being of Scandinavian origin. From that, what the author implies is certainly plausible as the origin of the term.
Comment: Well I did preface my post with "this might be a stretch..." :)
Comment: Who knows, perhaps this will spark something in somebody else and they will be able to find something more concrete as to the term's origination.
Answer: While looking up cut up rough, I detoured into going postal and run amok.
Wikipedia goes into the medico-cultural (or perhaps culturo-medical) associations of the phrase run amok and links it to such phenomena as The Jumping Frenchmen of Maine (I kid you not), latah, and, wait for it, bat-schi in Thai culture.
If the phrase bat shit crazy originated in the era/area of the Vietnam War, perhaps it was because some GI had encountered bat schi in nearby Thailand.


What is ARM Debug Interface?

Question: I was reading about debuging the code for ARM Cortex-M based MCUs. Moreover, I read about ARM Debug Interface, so What is ARM Debug Interface?
Answer: The arm has something called macrocels, the most used are,
Information Macrocel,
Trace macrocell,
Embedded trace Macrocell,
Bus macrocell and so on.
The main use of these is that it provides an insight of what is actually happening inside the processor. These macrocells are hardware inside the processor which collect information about the what was being processed and sends this information to the PC via the Jtag usually. And on the PC you have a software development kit whihc shows you the results that were obtained from these. Thus giving us an insight on whats happening inside therby helping us for example debug the code, view the interrupts that occured etc.,
Answer: This is probably a reference to the Arm Debug Interface Specification, this is the specification for how to use JTAG to access a CoreSight debug interface, and the specification for Serial Wire Debug (and how to use that to access CoreSight as well).
The interface defines a mechanism for memory mapped accesses to the peripherals within a processor or SoC which make up the debug system. At the processor level, these registers will be defined by the processor architecture, so the debug interface spec only covers a handful of registers (target address, data transfer, status and port identification).
This white paper has more detail on the on-chip side of this interface.

What is ARM Debug Interface?


Would it be feasible to build an arduino that takes 12v on/off signals from a vehicle diagnostic port (1984 pre-OBD)?

Question: The vehicle is an AMC eagle, they come with a diagnostic port
I have made a diagnostic tool that lights led lights when signals turn on and off, but it has to be wired in and is bulky. I am wondering if it would be possible to have an arduino plugged in and running off the 12v battery supply (with step-down to 5v) and have it catch the signals and send them over Bluetooth to a computer. Does this sound like it is within the scope of an arduino or am I asking too much? Or is there a better and easier way to do this?
Comment: Two things. 1. With the engine running, you may have 14.5VDC, not 12VDC. 2. Be careful with the tach signal. If it's connected to the negative side of the ignition coil, you could see a voltage spike of up to 250 volts.
Answer: Yes, it is possible. The 12v signals would have to be conditioned for the Arduino to receive them (0 - 12v or maybe 0 - 12-14.5v?). Then the Bluetooth side would be the same as any other Bluetooth data transmission.
So your question comes down to: Is this a fun project that's worth the effort you put into it for the learning experience? Or is this meant to answer a need, and the most practical means to that end is the best means?
Ex: I wanted to know how long / what kind of driving would it take to get my car's oil to full temp (~100C), starting from dead-cold in the winter? I had a thermo-logger I'd built for another experiment, so I taped a sensor to my oil filter (yeah, not the greatest, but quick and dirty) and lead a cable outside the hood, through the driver's window, to the experimental PC board on my dash-board. It wasn't a miserable failure but nothing to be proud of, either.
The solution I settled on was a USD$12.00 OBD port sender and an iPhone app. The results were much better, and while I didn't have the built-it-myself experience, I got the data and the answers I needed.
Comment: It is to answer a need, it would be a replacement for my homemade diagnostic tool that I built (picture added). These vehicles are finicky as older cars can be, and I would like to be able to provide a simple tool for me and others who want it to use, not unlike the small Bluetooth obd2 readers that have pop'd up. Arduino sounds like the best option but I wanted to ask before I went down the rabbit hole only to find out that there is already something that does pretty close to what I'm after.
Answer: You can step down 12V to 5V with resistor dividers, or drive transistor base with 12V and let the collector pulldown an input with pullup resistor to signal an active signal (like an optocoupler, but without the slow optical part).
Arduino reading the inputs and sending via bluetooth to something else is pretty straightforward, perhaps send only when a change from 0 to 1, and 1 to 0, on any input is sensed. Check Adafruit.com for bluetooth modules that are easy to use.
Comment: I have a bunch of 2n222 smd parts but I doubt they could handle 12v, would I need to have one transistor per gpio used? The diagnostic port has 16 inputs that I would like to use.
Comment: Also, a lot of these signals are either always on, off, or change rarely. For example coolant temperature switch just goes from off (0v) to on (12v) when the coolant temperature reaches 135deg F. So speed is not that critical for most operations. Would an optocoupler work fast enough for these types of signals? My only concern is putting a bunch of resistors in a small package in a hot engine bay and having them constantly divide 12v would make the whole thing pretty hot. I could be wrong thou, I have a pretty basic understanding of electrics.
Comment: The current flow thru the transistors is very low, not much heat will be generated.  P=I*I*R, so say you had a 10K and a 5Kin series to drop 12V down to 4V, then the current thru the pair would be I=V/R = 12/15000= 0.8mA, and P = 0.096W * 16 = 1.5W for 16 circuits. You could increase the resistor values and lower the generated power.   Alternatively, you could use a pair of cd74HC4050 as level translaters, powered from 5V, to bring 12V down to 5V. 48 cents each at Digikey.com. That would use even less current for lower power dissipation as the output is just 1uA to drive the Arduino inputs.
Comment: I like the cd74HC4050 idea, in looking at the spec sheet, are there 6 inputs per chip? So for instance I would plug 5v regulated into pin 1, arduino gpio X into pin 2 and input 1 into pin 3? I'm specifically looking at the cd74HC4050E if there are differences between the chips. If there are 6 "inputs" per chip I would need 3 correct?
Comment: Yes, 3 chips would provide 18 channels. I don't have the datasheet in front of me, but the pinout is straight forward. Don't forget to use a 0.1uF cap from 5V to Gnd, located near the chip.


Can you "re-use" Hardi Backer?

Question: I installed Hardi Backer under a ceramic tile floor several years back. We are planning a remodel soon. Can I remove the tile, clean up the backer board, and install new tile? That stuff has a million screws in it! I would really like not to have to remove it.
Comment: I partially agree with redlud97, if properly installed the tile will tear up the surface when removed, but it's worth a try.  I see more cracked tiles on floors when products like Ditra are used. A solid base that couples a shock wave through the bonding agent into the backer and then to the sub floor has a much higher chance of surviving than a flexible bond. Or that is my experience. When I do tile I expect it to be there for a lifetime, or be a real bugger to remove this is why we use tile for it to last.
Comment: My understanding is cracked tile often comes from movement of the subfloor due to deflection or seasonal shifting that propagates up through the backer and bonding agent into the tile casing it to crack. Hence why uncoupling membranes are popular nowadays
Answer: The tile, if installed correctly will not come off the backer board cleanly, it will leave behind thinset or rip up chunks of backer board when you demo it. Even if it was relatively easy, keeping the flatness spec of 1/8" within 10' and 1/16" within 6' will be hard to meet with reused board. Its best to get back down to the subfloor to inspect anyways and install new clean board or use an uncoupling membrane like Schluter Ditra in the future.

Can you “re-use” Hardi Backer?


How to resize logical volume to fit filesystem

Question: How can I resize logical volume to fit filesystem automagically?
Answer: To increase the size of a filesystem you must first grow the logical volume container and then increase the size of the filesystem within.  When decreasing the size of a filesystem, shrinking the surrounding logical volume is done last.
A shorthand way of expanding a logical volume and the filesystem is contains can be achieved using lvextend with the --resizefs option.  For example, assume that you have a logical volume of 1000 extents that you want to grow to 1600 and then expand the filesystem within; do:
lvextend -l 1600 --resizefs /dev/vg01/lvol1

This increases the logical volume size to a total of 1600 extents and then grows the filesystem associated with it.  There is no need to unmount the filesystem to perform this operation.
In order to shrink the size of a filesystem, you must first unmount it and fsck it.  Then, reduce the size of the filesystem first, followed by shrinking the size of the surrounding logical volume container.  Use tune2fs to ascertain the "Block size" of the filesystem.  Multiply the block size value by the number of physical extents you want the final logical volume to contain, and use that product as the argument to resize2fs.  For example if the block size is 4096 and the final number of physical extents you want in your logical volume is 1200, then the product is 4915200 (blocks).  Hence:
umount /myfs
e2fsck -f /dev/vg01/lvol1
resize2fs /dev/vg001/lvol1 4915200
lvreduce -l 1200 /dev/vg01/lvol1
[ respond "y" when asked if you really want to reduce it ]

Answer: JRFerguson provided a great answer. I think the OP was looking for something like this:
lvextend -l+100%FREE /dev/path/to/your/logical/volume

It's convenient to be able to refer to the available space in relative terms than calculating the number of blocks by hand. For more information, you can check out the man page for lvextend or any of the other lvm2 commands.
Answer: Another, slower, option for reducing:

Resize filesystem smaller than intended (but still large enough to contain existing data)

sudo resize2fs /dev/mapper/LVM--vg-root 19G

Reduce lv to intended size

sudo lvreduce -L 20G /dev/mapper/LVM--vg-root

Then extend filesystem to fill avaliable space

sudo resize2fs /dev/mapper/LVM--vg-root
EDIT Just did this myself and the final resize took less than a second so may not be slower after all
Credit


Compare standard devation between different samples?

Question: I am calculating standard deviations $\hat\sigma_i$ from many samples from distributions with mean equal to zero but different variances $N(0, \sigma_i^2)$. Each sample has different size $N$. When comparing $\hat\sigma_i$, should I divide each standard deviation by square root of sample size $\sqrt{N}$ or not?
Answer: In your problem you are comparing the variances of distributions where the mean is known. The division by $\sqrt{N}$ is used when you are comparing the means of distributions by using the sample mean. This is because for a sample $X_1, X_2, \dots, X_N \sim N(\mu, \sigma^2)$,
$$\bar{X}_n \sim N\left(\mu, \dfrac{\sigma^2}{N} \right). $$
However, in your problem you are not comparing the means of the distributions, but comparing the variances. So you need to look at the sampling distribution of the sample variance.
Say you have $k$ different distributions from which you have samples of varying sizes.
\begin{align*}
& X_{11}, X_{12}, \dots, X_{1N_1} \sim N(0, \sigma_1^2)\\
\vdots \\
& X_{k1}, X_{k2}, \dots, X_{kN_k} \sim N(0, \sigma_k^2)
\end{align*}
You estimate the variance of each distribution using the sample variance with known mean,
$$ \hat{\sigma}_i^2  = \frac{1}{N_i} \sum_{j=1}^{N_i}(X_{ij} - 0)^2.$$
Since the original data is Normally distributed, and assuming the samples are drawn independently,
$$ \dfrac{N_i \hat{\sigma}^2_i}{\sigma^2_i} \sim \chi^2_{N_i}.$$
Now if you want to compare different variances, one way is to make confidence regions around each estimate. Using the test statistic distribution, you can creat exact confidence regions. The $100(1- \alpha)\%$ confidence region for $\sigma_i$ is then,
$$\left(\dfrac{\sqrt{N_i} \hat{\sigma}_i}{\sqrt{\chi^2_{\alpha/2, N_i}}}, \dfrac{\sqrt{N_i} \hat{\sigma}_i}{\sqrt{\chi^2_{1 - \alpha/2, N_i}}}  \right). $$


Six-year-old dog peeing/pooping when alone at home

Question: I have a six-year-old greyhound who started to pee/poop upstairs when I'm not home, even for a short time after he has been taken out. He goes from 7:30pm to 7:30am without an accident and the door to the bedroom is open. He never goes upstairs when we're home, even when coaxed. He weighs 80 lbs (36 kg) and I cannot physically carry him up, so I can't reprimand him at the spot. What can I do?
Comment: How long have you had your Greyhound? How long has this been going on? Has anything about his routine (exercise, eating, etc.) changed?
Comment: I have him 3+ years and it started 3 months ago. Nothing has changed.
Answer: This sounds a lot like separation anxiety. He doesn't deliberately misbehave to annoy you.
First things first:
If you want to reprimand a dog (or any animal), you have to do it within 3 seconds of the unwanted behavior. Dragging your dog to his poop upstairs and yelling at him is not going to change a single thing. Your dog doesn't understand why you are angry at the poop because he doesn't connect the reprimand with his earlier action of pooping there.
Now to his behavior. If he poops in the house even after he was outside (and had the chance to do his business) because you're away for a short time, he probably has separation anxiety. Unfortunately, this is very hard to treat and I cannot give you a simple solution.
It's best to contact a professional dog trainer and ask for their help. By that I don't mean a puppy class, but someone who analyzes your dog's behavior at home and then tells you what to do.
Blocking the way upstairs like Eager to Play suggested is a good start, but might not have the desired effect. Providing a potty pad upstairs is an alternative, but it just deals with the symptom, not the cause.
Classical music or talk shows seem to reduce stress in dogs, as discussed in this question How effective is leaving a television or radio on to comfort dogs when away?
One possible solution that comes to my mind is to play or walk with your dog before you leave the house to make him tired. We have a list of different activities in this post. Hopefully, he will be somewhat exhausted or tired and use his alone-time to either relax or sleep. But even that is not guaranteed to work.
Your best chance is a professional dog trainer.
Answer: Since this is only happening when he is alone at home, it may be difficult to remove the behavior through direct training. My first recommendation is to prevent your dog from going upstairs when you are not home. Baby gates are often useful for this, or just strategically placed objects blocking him from going upstairs. See what happens when he is not able to go upstairs at all. Does he do his business in the rest of the house? Or is he successful at holding it? That will give you some more information about what the issue is.
If he does not have accidents in the rest of the house, then my recommendation is to keep him restricted from the upstairs for a few months and then try taking the gate away. See if the problem starts again. By that point, the habit may have been broken and it may not start again.
If he does have accidents in the downstairs area, then it means that he likely does need to be let out during the day and that he is using the upstairs area since that is less strongly associated with "don't pee or poop here." It is not unlikely for a dog to need to go out more during the day than at night since at night he is mostly sleeping and probably isn't eating or drinking much.
If this is the case, there are a few things you can try. If you feed in the morning, make sure that you are feeding early enough for your dog to go out at least half an hour after eating. If you are currently free-feeding at all (e.g., leaving dry food out all day for him to snack on), transitioning to set meal times may help. You should also talk about the issue with your vet to make sure there are no health concerns.
Good luck!


What is the series resistor doing between the power source and the power input of this IC?

Question:
This is from an Adafruit RTC module.
What purpose is the R3 1k resistor serving in this circuit? Is this a RC charging circuit? Would the capacitor C1 not get any charge if the resistor wasnt there? How is the value of R3 determined?
Thanks!
Answer: Section 14.1 of the datasheet tells you why - the supply is monitored to allow it to switch over to the backup battery if and when it fails, and needs to not fall by more than a specified rate, such that the monitor circuit has time to make the switch over before power is lost.
Answer: The voltage will drop at a rate of dV/dt = Ic/C and if current is limited by 1k then Ic (max) =V/R where a power interruption or switch to battery becomes worst case dV=V so the time constant for 64% voltage sag = RC=Tau = 10ms so a 1ms interruption is only 6% and less for a FET bridge.
Also any ripple > 1/RCf  is attenuated by 20 dB/decade in f, which may be of more benefit.
The datasheet  spec says d Vdd/dt = 0.7
V/ms max
Thus Tau = 10ms and Vdd=5V gives 0.5 V/ms and satisfies the spec. with only 40% margin. Best case.  I once worked with a great consultant who discovered this weakness and notified the IC OEM chip maker >20 yrs ago which may have been the source of this spec.
An abrupt failure might be a sudden disconnect or a Vdd short so you need temporary storage so it has time to switch to battery in this logical OR function of battery backup.  Often it arises due to the ESR of a tiny battery dropping its voltage momentarily to charge the load cap.


effects of hFE in emitter follower?

Question: There are multiple hFE options for BD139s, with the higher hFE being slightly more expensive. What advantages or disadvantages, if any, would the higher hFE parts have in emitter follower circuit?
Answer: Advantages of higher hFE:

Higher input impedance to the circuit
Lower output impedance

This way the emitter follower load effects to previous and next stages are reduced.
Disadvantages:

Depending on the polarization of the transistor, high hFE can affect negatively the stability due to variations on temperature.

References:
Emitter Follower, Ruye Wang, Electronic Circuits - I. pp. 1-21, A.P.Godse, U.A.Bakshi
Answer: For a given bias current, the relationship between input impedance and hFE is one of proportionality.
Answer: given the beta results from carriers injected by the emitter, attempting to impact carriers arriving from the base pin and yet missing thus continue on into the collector, with THINNER BASE regions producing HIGHER BETA, we have some interesting changes in behavior with high beta.
Higher beta means thinner base regions.
Thinner base regions mean FASTER TRANSISTORS.

effects of hFE in emitter follower?


When changing ISPs, do I have to order a new static IP address?

Question: With my current ISP, I have a static IP address for the server to be able to access it from anywhere in the world. Now I'm changing ISPs - should I ask a new ISP for new static IP address, or can I reuse the current one?
Comment: Did any answer help you? If so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you could provide and accept your own answer.
Answer: You will not be able to reuse the current one, it will be part of your current ISP address range, and will not be portable to your new ISP
Comment: I actually made a mistake in terminology I think. I meant external IP address, which is also a static one, but just to clarify. Does your comment still stand with this clarification?
Comment: Yes the comment still applies, unless you are an organisation that has PI (Provider Independent) address space, then the addresses cannot be carried from one ISP to another.  This is fundamental to practical Internet routing.
Answer: Unless you have your own provider-independent block of addresses, you will not be able to take your addresses with you.
ISP will not advertise prefixes longer than /24 for IPv4 or /48 for IPv6. That means if your block of addresses is smaller than those, the IP addresses are assigned to the ISP, not to you. A new ISP cannot advertise your address block if it belongs to your former ISP.


How do I get the entity framework to work with archive flags?

Question: I'm trying to create a set of tables where we don't actually delete them, but rather we set the archive flags instead. When we delete an entity, it shouldn't be deleted, it should be marked as archived instead.
What are the programming patterns to support this?
I would also prefer not to have to roll out my own stored procs for every table that have these archive flags if there is another solution.
Answer: myEntity.IsArchived = true;
context.SaveChanges();

if your requirements are to not delete, then don't delete ;-)
Comment: My concern is mostly with getting the relationships between entities correct. My hope was not to have to query .Where(o => !o.Archived) against every relationship.
Answer: This is an old question and it doesn't specify the EntityFramework version. There are a few good solution for newer versions:
Entity Framework: Soft Deletes Are Easy
Soft Delete pattern for Entity Framework Code First
Entity Framework 5 Soft Delete
Also there are sources for EF 6.1.1+
Highlights of Rowan Miller's EF6/EF7 Talk at TechEd 2014
Entity Framework: Building Applications with Entity Framework 6
Answer: You'll have to write your own logic to do this, and steer clear of the "MarkForDeletion" method on those entities.
Your logic will need to take a provided entity, alter it in some way to signify it is now "archived", and then Save the changes on the context.
You'll then need to make sure any code pulling from the DB honors these values that signify an archived record.
To make it simpler, you can create partial classes to match your entity classes, so they honor say, a custom interface.  That way you can code against the interface and not have to use reflection to set the entity values.
If you can use .NET 4.0, EF supports POCOs and you can mark the entities natively with the appropriate interfaces, which will cut down the number of files you have to work with.
Answer: I'm not sure about best practices, but you might try writing your own DeleteObject method and putting it in a class of some sort (EFHelper is the name of the class I use for these sorts of things).  Then instead of calling ObjectContext.DeleteObject, you call EFHelper.DeleteObject, and do any custom logic you care to do in that method. If you're consistent with the way you name these archive flag properties, you can use .NET's reflection API to find the archive_flag property of each EntityObject you're "deleting" and set it appropriately.


What are these divots (holes) in the mulch?

Question: These dents, divots, or holes recently appeared in the mulch, located in a covered area next to the house and deck. The holes look like inverted cones and are an inch or two in diameter at the widest part. There isn't any obvious insect activity. What are they, and are they cause for concern?
Answer: These look like Ant Lion traps to me. Ant Lions are considered beneficial garden insects and are nothing to worry about.
Here's a blog post with a photo of an almost identical situation.

And another photo of traps in a more common, sandy location:
Comment: I believe you are correct That Idiot!  I was shown these ant lions a few years back and was amazed.
Comment: Look like ant lion traps to me too. They tend to like sandy soil. If you watch an active trap, you'll often see them throwing sand out of the hole.


What is the difference between misuse and abuse cases in security?

Question: I know that misuse cases are use cases which help identify security requirements as they highlight the user's goal in misusing the system, but what exactly is abuse cases and what is the difference or these very similar to each other?
Answer: The nuance is subtle and not well-defined, but if you really want to make a distinction between misuse and abuse, then I'd say that abuse is "misuse with malicious intent".
E.g. running while carrying a powered chainsaw is misuse; doing so on purpose in a crowded mall is abuse.
Comment: Academic definitions actually reverse the definitions compared to what you stated. Misuse is malicious. Abuse does not define intent.
Comment: @schroeder Do you have a citation? Edit: I see now you have some in your answer below. An edit to mention your answer might be beneficial...
Comment: @TylerH see below...
Answer: Misuse Case:

It describes the process of executing a malicious act against a
  system, while use case can be used to describe any action taken by the
  system.

Abuse Case:

A complete abuse case defines an interaction between an actor and the
  system that results in harm to a resource associated with one of the
  actors, one of the stakeholders, or the system itself.

Contrary to what most people would naturally conclude, "Misuse Cases" require malicious intent, "Abuse Cases" do not. Misuse Case is the antithesis of the Use Case where users are not doing what they should according to established procedure. Actors are "mis-using" the system. "Abuse Case" seems to draw from the technical etymology of the term "ab-use", meaning "outside of the use".
"Misuse Case" is an intentional violation of the system by a "Mis-Actor". Misuse Cases analyse user/actor threats to the system.
"Abuse Case" does not include intent in its analysis. It is focused on the set of actions that can cause harm. Abuse Cases analyse system vulnerabilities.
But these terms are new and practitioners are defining them as we go.
Further reading on the differences as of 2005
Answer: Misuse may be accidental, and implies that you are using the system in a way not designed.

e.g., run rm -rf on your filesystem

Abuse is usually premeditated and purposeful; you can abuse a system without misusing it by doing legitimate activities in an unauthorized manner.

e.g., DDoS attack using legitimate requests to load a page

You may be interested to read the legal text of Computer Fraud and Abuse Act (CFAA) [USA].

Edit:
I found a formal definition of "computer abuse" from NIST in their Glossary of Key Information
Security Terms :

Computer Abuse –  Intentional or reckless misuse, alteration,
  disruption, or destruction of information processing resources.

However, whereas the US has an "abuse" act, the UK has a "misuse" act (Computer Misuse Act 1990) (another ref), as does Signapore (Computer Misuse and Cybersecurity Act
(CHAPTER 50A)) which sounds closer to the definition of abuse.
Comment: Misuse Case and Abuse Case have formal definitions. The NIST definition of "computer abuse" and "computer misuse" laws are not applicable.
Answer: In non-technical English, misuse and abuse have near-identical connotation.
I'd encourage the contemporary analyst to avoid using these terms.  We have much more understandable terminology: insider threats, external threats, and usability defects.
But... if for some reason you really want to use these terms... here are the definitions developed within my security group sometime during the period 2004-6, when we were considering how we might extend use-case diagrams so that they'd handle a full range of security, functionality and usability requirements.
.
Consider:

someone who causes a system to perform some action either gains the (significant) results they were intending, or else there are some (significant) unintended consequences.  Note: we ignore actions which have no major consequences.
someone who accesses a system in some way may be authorised to access it in this way, or else they are unauthorised.
someone who accesses a system may be intending to cause harm, or else their motives are beneficial.  Note: we understand that an unauthorised user may believe themselves to be acting in a way that is beneficial to the system's owner, or in a way that is beneficial to parties other than the owner of the system; but (as is customary in security analyses) we define system requirements from the perspective of the primary stakeholder in the system (which we call its "owner", for convenience), and we leave it to the owner of the system to decide who is authorised to perform beneficial acts using their system, and who is unauthorised.

Although three Boolean variables have eight possibilities, half are unimportant (or have been defined-away, as in the case of an unauthorised user who intends a beneficial use).   This leaves us with just four major types of cases to consider, when defining system requirements -- and we chose "cute" names (???use) for these three extensions to the good-old use case:
() [Use Case:]

A beneficial result from an authorised user.

() [Confuse Case:]

A harmful but unintentional result from an authorised user, that is, the harmful consequences of a usability defect in a use-case.

() [Misuse Case:]

Harm intentionally caused by an authorised user, that is, an insider threat of a use-case that is exercised with harmful intent.

() [Abuse Case:]

Harm intentionally caused by an unauthorised user, that is, an outsider threat of a system with inadequate access control.

AFAIK nobody in our group has ever published these definitions.  I recall Mike Stay as making the key insight, in discussions with Jas Nagra, Stephen Drape, and myself.  We were definitely guided by a very nicely-researched report written by a student in the 2005 offering of my COMPSCI 725 course.  And I'm almost certain that Mike's naming of the "confuse case" was a linguistic reference to the confused deputy problem.
I believe there is still no general agreement, among scholars, on how misuse cases and abuse cases "should" be defined.  But -- no matter how they are named, or exactly how they are defined, the underlying concepts of insider threat, external threat, and the threats posted by usability defects are important to all security practitioners.   And some practitioners do use these terms, e.g. Vector offers deliverables which include "Pentest misuse, abuse and confuse scenarios".


How are closures implemented in scala?

Question: How are the variables outside of the scope of the function pulled into the function when it's created?  I tried decompiling, but I had trouble understanding it.  It looked like it uses putfield.  Does putfield make a pointer to an object reference?
Comment: This seems to be a duplicate of http://stackoverflow.com/questions/2670350/how-are-scala-closures-transformed-to-java-objects?rq=1
Answer: The answer is "it depends". There will probably be some major changes to this with the scala 2.11 release. Hopefully 2.11 will be able to inline simple closures.
But anyway, let's try to give an answer for the current scala version (javap below is from scala 2.10.2). Below is a very simple closure that uses a val and a var, and the javap output of the generated closure class. As you can see there is a major difference if you capture a var or if you capture a val.
If you capture a val it just gets passed to the closure class as a copy (you can do this since it is a val).
If you capture a var, the declaration of the var itself has to be changed at the call site location. Instead of a local int that sits on the stack, the var gets turned into an object of type scala.runtime.IntRef. This is basically just a boxed integer, but with a mutable int field.
(This is somewhat similar to the java approach of using a final array of size 1 when you want to update a field from inside an anonymous inner class)
This has some impact on performance. When you use a var in a closure, you have to generate the closure object and also the xxxRef object to contain the var. One mean thing is that if you have a block of code like this:
var counter = 0
// some large loop that uses the counter

And add a closure that captures counter somewhere else, the performance of your loop will be lowered significantly.
So the bottom line is: capturing vals is usually not a big deal, but be very careful with capturing vars.

object ClosureTest extends App {
  def test() {
    val i = 3
    var j = 0
    val closure:() => Unit = () => {
      j = i
    }
    closure()
  }
  test()
}

And here is the javap code of the generated closure class:
public final class ClosureTest$$anonfun$1 extends scala.runtime.AbstractFunction0$mcV$sp implements scala.Serializable {
  public static final long serialVersionUID;

  public final void apply();
Code:
  0: aload_0
  1: invokevirtual #24                 // Method apply$mcV$sp:()V
  4: return

  public void apply$mcV$sp();
Code:
  0: aload_0
  1: getfield      #28                 // Field j$1:Lscala/runtime/IntRef;
  4: aload_0
  5: getfield      #30                 // Field i$1:I
  8: putfield      #35                 // Field scala/runtime/IntRef.elem:I
  11: return

  public final java.lang.Object apply();
Code:
  0: aload_0
  1: invokevirtual #38                 // Method apply:()V
  4: getstatic     #44                 // Field scala/runtime/BoxedUnit.UNIT:Lscala/runtime/BoxedUnit;
  7: areturn

  public ClosureTest$$anonfun$1(int, scala.runtime.IntRef);
Code:
  0: aload_0
  1: iload_1
  2: putfield      #30                 // Field i$1:I
  5: aload_0
  6: aload_2
  7: putfield      #28                 // Field j$1:Lscala/runtime/IntRef;
  10: aload_0
  11: invokespecial #48                 // Method scala/runtime/AbstractFunction0$mcV$sp."<init>":()V
  14: return
}

Answer: Let's see a concrete example :
scala> var more = 1
more: Int = 1

scala> val f = (x: Int) => x + more
f: Int => Int = <function1>

This closure is an open term.
scala> f(1)
res38: Int = 2

scala> more = 2
more: Int = 2

scala> f(1)
res39: Int = 3

As you see, the closure contains a reference to the captured more variable
Comment: "Scala capture the context outside the closure", this is hardly an explanation…
Answer: Here is the Bytecode for the following method containing a closure:
def run()
{
val buff = new ArrayBuffer[Int]();

val i = 7;

buff.foreach( a =>  {  a + i  }  )
}

Bytecode:
  public class com.anarsoft.plugin.scala.views.ClosureTest$$anonfun$run$1 extends   scala.runtime.AbstractFunction1$mcII$sp implements scala.Serializable {

// Field descriptor #14 J
public static final long serialVersionUID = 0L;

// Field descriptor #18 I
private final int i$1;

public ClosureTest$$anonfun$run$1(com.anarsoft.plugin.scala.views.ClosureTest $outer, int i$1);

...

The Compiler generates a new ClosureTest$$anonfun$run$1 with a constructor with two fields for the variables outside the scope, e.g. i and this of the calling class.

How are closures implemented in scala?


Help with skyrim combination

Question: I'm stuck at the combination lock in the caves for the quest that you get the golden claw... I know the right combination, but the pillars are actually stuck! none of the will turn, and they are all stuck on the chicken head thing! PLEASE HELP!! :(
Comment: Didnt I see this question asked last night already? (though now you are atleast telling us which of the puzzles)
Comment: garrett, please accept my apologies for deleting your question yesterday. For some reason I scanned it as an answer in your feed and thus deleted it for not being an answer.
Comment: Yea I've asked this already, but it got deleted...
Comment: I guess the other question is gone.. And it wont let me remove my down vote for some reason.. Anywho, if you click on them and they do not rotate, your game is likely bugged, not sure what can be done.
Comment: Yesterday his question did not provide any information to what quest he was on or the location of the pillars.  As there are many pillar puzzles, we asked for more information and did not receive any.  It most-likely got closed as a un-answerable question.
Answer: I had a cave puzzle glitched somewhere else. It had something to do with spikes. Try leaving the cave and entering again. It seems Skyrim caves run on Windows OS.
Comment: oops... I tried to vote this comment up but it says I can't and voted it down automatically. Thanks though!
Comment: @garret Don't worry it wasn't you. You need like 125 points to vote down questions. Did it work?
Answer: Watch this Video.  If the pillars shown in this tutorial do not rotate, your game is bugged.  It would be best to revert to an older save.
Spoiler, that Video shows you how to solve the problem.

Help with skyrim combination


2D Camera Movement Temporal Reprojection

Question: Having an Orthographic Camera with its View Projection Matrix given from the current and last frame, how to reproject the previous frame to the new one?
Comment: Does the camera rotate between frames, or only translate / change in size? (I ask because orthographic cameras are often used in 2D settings where panning/zooming are more common than rotating the camera)
Comment: @DMGregory as of right now it doesn't rotate and i don't think i ever will rotate so it should be fine without. did not specify it because i assumed that there is a matrix based trick out there
Comment: There is, but the reprojection is even easier if there's no rotation, because then it's just a 2D scale & shift, and we don't even need depth information.
Comment: @DMGregory well for now without should do just fine but in the future i need to tackle rotation as well but around z axis only so no depth needed (in theory)
Answer: Some years late I needed it again and finally solved it. For some reason the translation was inversed so I fixed that by inversing the scale but it shouldn't be needed
float2 halfRes = ((float2)texResolution - 1f) * 0.5f;
float4x4 ndc = float4x4.TRS(new float3(halfRes, 0f), quaternion.identity, new float3(-halfRes, 1f));
float4x4 projMat= mul(ndc, mul(_camera.projectionMatrix, _camera.worldToCameraMatrix));

float4x4 reprojMat = mul(previous, inverse(projMat));
previous = projMat;

and in shader simply
float2 oldPos = mul(ReprojectMatrix, float4(pos, 0, 1)).xy

Answer: currently i'm tracking the separate camera data and calculating a reprojection matrix like this (dirty "just make it work" code)
    Vector3 pos = cam.transform.position;
    Vector3 diff = lastPos - pos; // pos delta
    diff = Vector3.Scale(diff, new Vector3(1f / (cam.orthographicSize * 2f * cam.aspect), 1f / (cam.orthographicSize * 2f), 1f)); // world to uv scale
    float relscale = cam.orthographicSize / lastsize;
    float relrot = cam.transform.eulerAngles.z - lastrot; // needs aspect ratio correction in shader then maybe it works
    Matrix4x4 reprojectmat = Matrix4x4.TRS(-diff, Quaternion.Euler(0f, 0f, relrot), new Vector3(relscale, relscale, 1f));

and in the shader a simply edit the uv by the created matrix
    uv = mul(_Reprojection, float4(uv - 0.5, 0.0, 1.0)).xy + 0.5; // -/+ 0.5 to center scale / rotation

this works for translation and scaling right now (not for rotation) but is for sure not the best way to do it
Answer: Im not sure is worth for u or not but at least try once unity cinemachine asset..
Cinemachine
After important try 2d camera.
For more information plz check this breakeys tutorial. enter link description here
Comment: sorry but how does this help me? cinemachine is just controlling the camera and does nothing else that has to do reprojecting the last frame
Comment: whilst any attempt to help answer a question should be welcomed, please ensure you are offering help specific to the question. Otherwise this can lead to needless confusion for both the asker and others reading the information in future. Also, where possible please give a better description of how a tool you mention is used to achieve the desired functionality, rather than just saying 'take a look at xyz asset in Store" etc. Unfortunately I don't have a clue how to answer the question either but if you are not sure, then it is almost always better to leave the answering to somebody else.


Which file in /proc gets read by the kernel during the boot up process?

Question: Which file in /proc gets read by the kernel during the boot up process? This was a question on my LPIC 101 test that I think I might have answered wrong. I searched on google and some other places but wasn't able to find an answer. Hoping one of you could provide. Thanks!
Answer:
My question is, which file in /proc gets read by the kernel during the boot up process? This was a question on my LPIC 101 test...

Sounds like a trick question.  The files in /proc aren't real files on disk (this is why they have a size of 0) and the nodes don't exist until the kernel mounts a procfs file system there and populates it.
Procfs and sysfs files are kernel interfaces.  When you read a file in /proc, you are asking the kernel for information and it will supply it.  That information is not stored in that file -- nothing is.  When you write to a file in /proc, you are sending the kernel information, but again, the information will not be stored in that file.
This is possible because the kernel is the gatekeeper to file access generally.  All file access involves system calls, i.e., they must pass through the kernel.
So I would say the answer here is that it does not read any files in /proc at boot or at any other time.  This would be like dialing your own phone number.
Comment: True, it does sound like a trick question. It may have been the way I worded it :\ because it wasn't a multiple choice question or anything. There was a text input to type in a specific filename
Answer: I think the answer they were looking for is /proc/cmdline
"This file shows the parameters passed to the kernel at the time it is started. A sample /proc/cmdline file looks like the following:
ro root=/dev/VolGroup00/LogVol00 rhgb quiet 3
This tells us that the kernel is mounted read-only (signified by (ro)), located on the first logical volume (LogVol00) of the first volume group (/dev/VolGroup00). LogVol00 is the equivalent of a disk partition in a non-LVM system (Logical Volume Management), just as /dev/VolGroup00 is similar in concept to /dev/hda1, but much more extensible. " -redhat
Comment: But the kernel does not need to *read* `/proc/cmdline` to know  the boot parameters, as the bootloader will hand those parameters to the kernel directly when turning over control to the kernel (when `/proc` is not even mounted yet). In fact, it is the *userspace boot scripts* and/or the `init` process which will read `/proc/cmdline` so that they too may know the boot parameters the kernel received. The kernel will *respond to the userspace read request* by giving out the parameter information; but from the kernel's viewpoint, that's *outputting* the information to the userspace.


Mixed models for longitudinal data

Question: I'm starting to study the Linear Mixed Models (LMM) and the Generalized Mixed Models (GLMM) and I got kinda confused.
If I want to apply logistic regression to a longitudinal data, I need to add random effects. But which one should I use? LMM or GLMM?
Whats the difference of using logistic regression with LMM and with GLMM?
Answer: The language is very confusing and it doesn't help that different software packages and different authors use different names and that the acronyms (GLM, LM, LME, LMM, GLMM and more) are inconsistent as well.
Within your sets of names, the following should help:
Linear model - ordinary least squares regression, ANOVA, ANCOVA; the dependent variable is continuous, errors are independent
Generalized linear model - Logistic regression and other methods; dependent variable may be categorical, errors are independent
Linear mixed model - dependent variable is continuous, errors need not be independent; good for longitudinal data (also other kinds, such as clustered data)
Generalized linear mixed model - depenedent variable need not be continuous, errors need not be independent.
Comment: You mentioned that logistic regression can be used in GLM, but that does not take in account the random effects. If I want to use random effects, the only difference between LMM and GLMM is that the dependent variable is continous in the case of LMM and continous or other type in GLMM? It all comes down to what type is the depedent variable , right?
Comment: Yes, read the last paragraph of my answer.

Mixed models for longitudinal data


Where is the list of sidebar's favourites stored in macOS Sierra?

Question: Where is the list of sidebar's favourites stored in macOS Sierra?
I tried to delete ~/Library/Preferences/com.applde.finder.plist and ~/Library/Preferences/com.applde.sidebarlist.plist - almost all preferences are reset except list of favourites - it remains
Answer: Thanks to @TonyWilliams for the starting point and after a brief research I realized that requested sidebar's favourites are stored actually in directory ~/Library/Application Support/com.apple.sharedfilelist/, the file com.apple.LSSharedFileList.FavoriteItems.sfl among other files which are responsible for other sidebar sections. But those files are not available for easy editing.
Starting from OSX El Capitan and newer versions there is a command-line tool sfltool availabe to make some operations with that files, such as add an item.
But this tools doesn't have ability to remove items (the root of my problem which causes to this research) and I found another good tool on GitHub called mysides
which allows to remove items as well.
Comment: That allowed me to see that the permanently appearing item cannot be deleted.
When I tried to delete (see [first screenshot](https://dl.dropboxusercontent.com/u/15119356/scs1.png)) "Desktop" item I got an error, but the command `mysides list` helped me to try firstly remove AirDrop from list (via Finder Preferences) and repeat operation on the updated list. The result [was positive](https://dl.dropboxusercontent.com/u/15119356/scs2.png)
Comment: Not to mention that `sfltool` is awful. You can't check to see if an item already exists. You can't specify where it gets added and if you add it twice it will be in the list twice.

As I said, futzing with the Sidebar is pain and suffering.
Comment: Apple deprecated `sfltool` see here: https://openradar.appspot.com/radar?id=4985135170584576
Answer: The sidebar's favourites are managed by sharedfilelistd which is an XPC service, don't try to manipulate it manually. This way lies pain and suffering.
Comment: Hi @Tony, thanks for that knowledge. Maybe you can help with following:
In my sidebar the Desktop icon appears from time to time and I cannot remove it permanently
Comment: If it's appearing then disappearing there's something seriously wrong with your install. If it refuses to disappear then I suspect that the OS just automatically replaces it at boot, but I'd have to do some testing :)


if I purchase Apple watch series 3 or 4 (GPS only) from USA, will it work in India?

Question: I am going to USA for 15 days next month. I am thinking to buy an Apple watch series 3 or 4 only GPS, no requirement for cellular for me. Will it work when I come back to India? I am living in India permanently.
Comment: Why exactly are you asking this? Apple Watch is already sold in India locally and it works just fine. There isn't any "American Apple Watch" and "Indian Apple Watch". They're all the same. Apple controls it's features through software only based on region.
Comment: @JashJacob What about Cellular version?
Comment: Cellular Version also works in India. eSim is available on Jio and Airtel. You can look it up on Apple India website. Series 3 and 4 have cellular capability in India.
Answer: The Watch will function perfectly fine in India, however some functionalities will not work or be limited. This is for example the ECG feature, turn-by-turn navigation, the News app, etc.
There's no reason to buy the Watch in the US in hope of getting access to US-only functionality, as that functionality most probably will not be available in India and will cease to function when you get back, or at a later time when the software is updated.
You enquire about the GPS - it will work fine all over the world. Also in India. Other answers here focus on other positioning systems such as the Indian IRNSS (NAVIC). It is not supported on the Apple Watch, no matter if you buy the watch in India or in the US. It is also not supported on iPhones or any other Apple device. The Apple Watch supports GPS (US operated), GLONASS (Russian operated), Galileo (EU operated) and QZSS (Japan operated).
As you're looking at the model without cellular, you do not have to worry about cell coverage. The other answers that talk about LTE bands, etc. are irrelevant when the watch does not have cellular. The Watch will use your iPhone for calls, SMS, etc. and automatically supports whatever iPhone you have with the LTE bands, etc. it is using for communication.
The last thing to note is that the Watch in the US comes with a US charger. I.e. they are 110V/60Hz and a different type of plug, compared to the 230V/50Hz system and plugs used in India. You will need an adapter to be able to use the charger, or you could substitute any ordinary USB charger. The magnetic charging puck for the Apple Watch comes as a seperate cable that is plugged into the charger, so you will be able to use a different charger very easily.
Answer: Obviously it would be best to ask Apple, but based on what I know, I'm pretty certain the watch will function correctly while you're in India, but GPS services will not. India's NAVIC is independent from the European Galileo and American GPS satellite systems.
I'm pretty certain that most of your apps will work between the Apple Watch and the phone, though you may have issues if you're doing international roaming. You should even be able to make and answer phone calls from your watch.
LTE, I'm pretty certain will NOT work since the carriers in India use different bands.
Ultimately you should ask Apple, but given that a US-purchased Apple Watch functions fine when visiting India, I think you're safe.
Good luck! If you find out otherwise, please let us know.
Comment: LTE means Apple watch Cellular?
Answer: GPS works all over the world. That is why it's called the Global Positioning System.
I don't know whether or not the Apple Watches can utilise the Indian NAVIC, but I guess it's unlikely. Despite that, GPS should still work, as these are independent systems.
Comment: NAVIC interferes with American GPS in India. It was originally designed to be backward compatible, but then India tweaked its version, using the same satellites and algorithms as Galileo I believe. The Apple Watch doesn't support the secondary frequencies that are necessary to use NAVIC and doesn't have adequate reception to pick up enough GPS satellites. In India, iPhones and Apple Watches determine location based on information from the cell towers and less accurate triangulation.
Comment: Almost everybody used to use the American GPS system, but India and Europe became concerned about continued availability in times of war...as if the US would ever go to war against India...Europe maybe, but never India.
Comment: I don't think that NAVIC does actually use the same satellites as Galileo.
Comment: @BillSmith Hmm, I have been googling a bit, and can't quite find much on interference from NAVIC on GPS. That doesn't mean you're wrong, of course – after all they both use the L5 band. On the other hand, the signals are encoded to minimise interference problems: After all, *every* GPS satellite uses the same frequency bands, so they will interfere among themselves to some degree. NAVIC transmitters use more power, but they are in a higher (24h) orbit than the 12 hour orbits of the GPS satellites. So it's not clear to me wherein the problem lies. Do you have any references?
Comment: Clarifying. NAVIC uses physically similar satellites as Galileo, not the same satellites. As in they came from the same factory, not they share a satellite.


CouchDB doesn't hash admin password on restart

Question: The docs and local.ini comments say that CouchDB would hash the admin passwords on restart. However, I've restarted the db several times now and the passwords are still unhashed in plain text. What could be the reasons for that? I'm running the Bitnami CouchDB version if that makes any difference.
Comment: Which version of CouchDB? 1, 2, or 3?
Comment: 3.0.0-2-r08 (https://console.cloud.google.com/marketplace/details/bitnami-launchpad/couchdb)
Answer: This might be because the local.ini is not owned by the CouchDB user.
If the local.ini is for example owned by root then the CouchDB process can't write to it because it lacks permission.
Please check who owns the file with ls -l /opt/local/etc/couchdb/local.ini
If the local.ini is not owned by the same owner than CouchDB try to change its owner with:
sudo chown -R couchdb:couchdb /opt/local/etc/couchdb/local.ini
After changing the user restart CouchDB.
Note
Your path to the local.ini or your CouchDB user might be different than in my answer and you might need to change this according to your configuration.
To find who owns your CouchDB process you can use ps -aux | grep couchdb
Comment: With CouchDB user is meant the Linux user who owns the CouchDB process. This process currently can't update the local.ini because it does not have admin rights. Try to execute the chown command from my answer and restart the server. If this does not work you need to figure out what user the CouchDB is. For this you could try ps -aux | grep couchdb
Comment: Sorry, I can't really answer if this is normal or if it was messed up by the install.
Comment: I contacted them and it was a misconfiguration in their image. Thank you for helping out.
Comment: Bitnami automatically installs one user account called 'bitnami' during deployment. That's the one I am using right now. The access rights for `local.ini` are `-rw-r--r-- 1 root root 4025 Apr 29 12:13 local.ini`. What do you mean with "not owned by the CouchDB user"?
Comment: Updating the access rights solved the problem. Is it normal that you have to give CouchDB access rights for this file or did they mess up something with their image? They haven't mentioned this anywhere in their docs and it's also not mentioned in the CouchDB docs.
Answer: Bitnami Engineer here,
I just wanted to let you know that we released a new version of CouchDB (3.0.0-6) including the fix on ini-file so you shouldn't experience this issue anymore with this new version.
It could take some days to be published in all the marketplaces.
Thanks so much for reporting this issue!


How can I install this automatic transfer switch?

Question: I currently have a Gentran 3028 subpanel connected to a 12,000 watt generator over a 30 AMP branch and the utility/main panel over a 60 AMP branch.  I want to replace the Gentran with a APC UTS10BI.  I would like to mount the APC more than the recommended one foot distance away from the utility/main panel.  The APC can use a UPS as an alternate power source until I can get the generator running.  This is also the reason I need to mount the APC away from the utility/main panel.  There isn't enough floor space for a rack mounted UPS system near the main panel.  My question is how much of a gauge drop do I need to make to cover the 18 to 20 foot distance?  The installation manual recommends a utility line of "Circuit: 12 AWG Two Neutral:10 AWG".  If I drop the circuit to 10 AWG and the two neutral to 8 AWG would that be safe?
Comment: There's a lot of different max. amperages going on there. Do you know the actual max. amps through this particular line? Also, sure it's not 2-#12 with 1-#10 neutral? I don't get the over sized neutral, much less two of them. So... anyone know why the over sized neutral?
Comment: Is the one foot distance a *recommendation*, or a *requirement* in the manufacturers documentation?
Comment: @bcworkz It's not a single #12, it's a #12 per circuit. It's a 8 circuit transfer switch, so it would be 16 #12 ungrounded (hot) conductors and 2 #10 grounded (neutral) conductors.
Comment: Is this for a home or a data center?
Answer: According to the Manufacturers Installation Guide (PDF)...

Physical - install the UTS within one foot of the building circuit breaker panel

Page 4

Caution: The UTS must be installed within one foot of the building circuit breaker panel. If the UTS must be located further than one foot from the circuit breaker panel, a licensed electrician must extend the wiring using standard electrical wiring conduit and junction boxes.

Page 7
According to National Electrical Code (NEC)...

National Electrical Code 2011
ARTICLE 110 Requirements for Electrical Installations
110.3 Examination, Identification, Installation, and Use of Equipment.
(B) Installation and Use. Listed or labeled equipment shall be installed and used in accordance with any instructions included in the listing or labeling.

I'm guessing the unit has permanently attached wires in a raceway, which is of a limited length.  So mounting the unit further from the panel would require you to extend these wires and raceway, which requires knowledge of wiring methods to do properly.  It's not likely you'll have to upsize the wires, but you will have to understand basic wiring methods (Chapter 1-4 of NEC).


Is $\sum\frac1{p^{1+ 1/p}}$ divergent?

Question: Is $\displaystyle\sum\frac1{p^{1+ 1/p}}$ divergent? How can we prove that it is divergent or convergent in analytic number theory?
I know what bound of the n-th prime number is, and that its order is $n\log(n)$.
Maybe we can use the divergence of $\displaystyle\sum\frac1{n^{1+ 1/n}}$ to show that. I'm not sure that $\displaystyle\sum\frac1{n^{1+ 1/n}}$ is divergent, but I think it is.
So would you please help me with this ? Can you help me in finding a proof for it ?
Thank you very much, friends.
Comment: Even if $\sum_{n=1}^{\infty}\frac{1}{n^{1+1/n}}$ diverges, that doesn't tell you much, since all we know is that this sum is larger than the sum with primes. If  it converges, however... Also see [this guide](http://meta.math.stackexchange.com/questions/5020/mathjax-basic-tutorial-and-quick-reference) for how to write math on this site. Welcome to math.stackexchange.
Answer: This is a great question. But you can show that
$$\frac 1{p^{1+1/p}} > \frac 1{2p}$$
since $2^p >p$, and thus your series diverges.

Is $\sum\frac1{p^{1+ 1/p}}$ divergent?


Can I turn a PCI-e x1 slot into an old PCI slot?

Question: Is it possible to convert a PCI-e x1 slot into an old PCI slot? If so, how?
Comment: Some additional information might help you make the best choice. What card are you trying to use in a pci-e slot? There may be a replacement or upgrade that your money would be better spent on.
Answer: Well after a little digging around (which I guess i should have done first) the truth of the matter is, yes, there actually are. There are little cards that you can slip into the PCI-e x1 slot to convert it to a PCI slot. Why would anyone want to do this you ask? well, many companies still make products intended for PCI slots, not PCI-e. It was the graphics card companies that lead the rush twords PCI-e (and for some very valid reasons).
However, new interfaces take time to get accepted, besides, if an old standard works perfectly fine, development of the product to switch to a new standard would be extra costs.
Unfortunately most computer motherboard manufacturers seem to want to follow the rush twords new technology even when older technology still works fine. What i don't understand is why do computer motherboard manufactures even put PCI-e x1 card slots in their systems. At the moment, the only technology that uses PCI-e slots is either graphics cards, raid controllers, or USB2.0. As far as graphics cards go, the PCI-e x16 slot is a necessary advancement. However, no one buys raid controllers because most people who use it have raid chips inside their motherboards anyways, this goes the same with USB2.0.
So whats the point of having PCI-e x1, x4, and x8 slots if they are rarely used? Instead of a useless PCI-e x1 slot, why not put in a useful PCI slot insted?
PCI-e x1 to PCI converters:
http://www.virtuavia.eu/shop/index.php?target=categories&category_id=227&sl=EN
Comment: They make Ethernet cards, wireless cards, adapters etc. also. There is much more out there than just graphics, raid, and usb.
Comment: Also, "RAID" chips on motherboards are almost never real RAID--they're software fakeraid. Real RAID cards generally have backup batteries.
Comment: Plenty of reasons for PCIe x1.  First is cost/complexity.  PCI is parallel technology requiring 16 interconnects.  Having a single PCI slot requires just as much "resources" as having 6 PCI slots.  Given PCI is a dead end there is no reason to move EVERYTHING to PCIe and thus remove entire PCI subsystem from northbridge.

PCIe 1x has plenty of bandwidth.  The newest version has 500MB/s in each direction.  Compare that to 133MB/s for "conventional PCI.  Soundcard, entry level RAID, video capture cards, TV tuners, etc can all be easily supported by PCIe 1x.
Comment: They key reason from the manufacturer's point of view for provinding PCI-E 1x slots rather than PCI-E ones isn't the bandwidth (which is a significant difference) or the relative cheapness of the connector due to fewer pins and traces: they have to provide the modern standard for high bandwidth devices (GFX, RAID) and providing both PCI and PCI-E instead of just the variations on PCI-E is considerably more hassle/expense in board design especially when you are running close to your profit margin anyway as most consumer grade electronics lines do these days due to competition pressures.
Comment: The reason mobo makers like PCIe 1.x slots is that they're cheaper to implement.  They only need 18 pins vs 62 for a 32bit PCI slot.  Fewer traces leads to simpler board layout, less EMI, and potentially fewer layers needed in the PCB itself (this is a big cost savings).
Comment: Makers of low end expansion cards also like the form factor since it reduces the minimum size of the PCB needed for the card.  If you look on sites like newegg you'll see lots of a triangle and L shaped PCI cards that add an ethernet port/usb ports or something else that's trivial and which needed to make the PCB larger to support the connection to the mainboard.
Comment: For devices that can consume significant amounts of bandwidth PCIe is also better since a 1x slot gives either 125 (1.0) or 250MB/sec (2.0) of dedicated bandwidth in each direction, vs PCIs 133MB that's shared both directions with all other PCI devices.  In the next year or so PCIe 3.0 will boost the per lane bandwidth to 500MB/sec allowing SATA6GB and USB3 addon cards to operate at near full speed in a 1x slot.
Answer: No, this is not possible. I have never seen a product for that purpose and I am not sure how they could do it. Pci-e slots(not even the full size 16x versions, let alone a 1x) are not backwards compatible with pci.
Edit: People are finding solutions for this.  I do however agree they are not that cheap, add complexity (drivers, overhead, etc), and some of these adapters I am seeing will only work with low profile cards. I know some of these adapters will not work with all cases. You might have to remove the case mount plate on the PCI card to be able to use. If it is a full height PCI card, you might be stuck in many cases, unless you do not mind the side of your case being off.
Comment: Yea, they are damn expensive...oh well at least I'm not paying for it. Ill probably get one of those quad box things, in case i need even more slots. This actually works out quite nice as i wont be needing those slots for quite some time, this means i can squeeze more money into the computer budget itself to get a more powerful computer and buy the converter box later as some other expense (i don't like it when the computer can't keep up with me)
Comment: Motherboard expansion slots are designed to line the card up with the back of the case. So even if an adapter was somehow produced, I am not sure how they would fit an adapter and the card properly. None the less, good question.
Comment: There are PCI-E to PCI-X bridge chips, OCZ uses them in their RevoDrive and IBIS because they're very cheap. PCI-X is backwards compatible wit PCI, but so far risers aren't that widespread because PCI is almost extinct and you could only use a half-height card.
Answer: They do and they work.  I bought a simple slim one that adds about 1" height to the MB PCI slot (Tekit Desktop PCI-E1X TO PCI expansion card available at Newegg.com) and use it for my extremely old but necessary PCI modem that supports nextalk TTY software for the deaf.  That older modem is the only one that will work with the software in windows 7 & up (not tested in Windows 10). Fortunately I have 3 of the older modems and taking care to keep them operating normally for over 15 years now.  Now I can upgrade to newer motherboards that rarely have PCI ports (considering upgrading to newer GIGABYTE GA-X170-EXTREME ECC (rev. 1.0) LGA 1151 Intel C236) to that I can take advantage of NVMe M.2 ports, etc.
What should be happening is that MB makers should be including adapters that do just this--plug it in to convert it to PCI or PCIex1, etc.  IN other words--backwards compatibility just like USB 3.0, 2.0, etc.
If in the future Windows 10 won't work with the software I can always run Windows 7 in a virtual windows to make use of the modem.  Already tried that and it works.
Answer: PCIe-to-PCI converters exist, but they are rather expensive and add another layer of complexity to a computer's setup.
It's generally cheaper to purchase a new expansion card that is PCIe rather than attempting to fiddle with a converter.
Answer: Assuming that you're actually trying to plug a PCIe card to your desktop...
Double check your motherboard's manual. Sometimes you can plug a PCIe x1 board to a slot that is PCIe but more lanes than x1.
If you're trying to plug a PCI card on to a PCIe slot, that's quite different. You can probably still find a PCI to PCIe bridge somewhere, but it's not worth your while.
Comment: Yah, this doesn't answer any part of the question.
Comment: @Faken Last I read about hardware bridges were for graphics card, bridging a chipset in PCIe to AGP (or the other way around). It doesn't require drivers, but it introduce another item for things to cause problems.
A 2 PCI slot board is abundant. And you shouldn't blow through your budget unless you're getting an i7. Is your program single-threaded? or multi-threaded? i.e. is it cranking at a tedious task that can't be broken apart? or is it busy juggling tasks?
Comment: this don't help much if he got a reqular PCI card
Comment: I actually wrote that thinking that he wants to convert a PCIe card into a PCI.

If that's the case, the OP could be just looking for the right slot to put his PCIe card.

However, if he's looking for a PCIe slot, to convert to a PCI slot, then he's probably just out of PCI slots.
Comment: Actually, im trying to buy a powerful budget computer for use at the university. I found the exact PC i wanted at dell with a very reasonable price, the only problem is that it only comes with 1 PCI slot and a whole whack of PCI-e x1 and x4's which are total useless. We cant swap out the motherboard to get more PCI slots. Thats why i was looking for something like this so i can plug in more PCI slots. I'm doing some robotics control and i need 2 PCI slots for motor controler boards.
Comment: @Faken If you haven't bought the computer yet, IMHO it would be much easier to find a different dell system with more pci slots to buy or even another vendor. Also, I am not sure how those robotics control cards would react to being on an adapter. You could potentially run into other issues beyond just being able to hook it up.  Sounds like you will be doing some cool stuff with the machine.  Good luck and let us know what you decide.
Comment: @Troggy: the problem here is I'm being limited to approximately $1000 in price (minus monitor). My application is extremely CPU and RAM intensive so i need as powerful a computer as possible. From what I have read so far, all modern computer components require a driver to work, drivers remove a layer of complexity by providing a more standard programming interface between your programs and actual hardware. So as long as the drivers can interface with the card (which means they will be going through yet another driver, the PCI-e to PCI converter) then we sould be ok...I hope...
Answer:
Is it possible to convert a PCI-e x1 slot into an old PCI slot?

No. PCI-e slots are completely different from PCI slot. Different pin-outs, different signals, different protocols. Converting PCI-e to PCI is like converting an electrical wall outlet to deliver water.
What you can do is use a PCI-e card with a PCI bus on it. This is an active card which speaks the PCI-e protocol and rather than adding popular things like network, graphics, RAID, SAS, etc you add a PCI bus. Then connect the your PCI card to this bus.
That is quite a bit different from 'convering' it.
Answer: Such adapters exist, for example the Startech PEX1PCI1 but there are some caveats.
The data interface is handled by a PCIe to PCI bridge chip. This part is not a problem, PCIe to PCI bridge chips are used on many motherboards and expansion cards and they work just fine.
Where it gets messy is mechanical and power considerations. The adapter card with the bridge chip on has a finite non-zero height. In the case of the Startech one it's designed so that using the adapter in conjunction with a low-profile card results in a regular height card that works fine if you have a low profile card with a low profile bracket. If you have a low profile card but with a full height bracket you may find it difficult to securely mount the card. If the actual card is full height then you may find it is not possible to access the connectors on the backplate or that it is not possible to fit the lid on your case.
Then there is power. PCI slots need 5V but PCIe slots don't provide it, so you end up with a cable hanging off the adapter board that needs to be connected to the power supply.
Finally the adapters are quite pricey, presumably because they are a niche product.
Often replacing the motherboard or card is likely to be a better option. The good news is that since this question was asked most types of expansion cards have become available in PCIe x1.


Texturing Mesh for Second Life

Question: I'm told you cannot texture and object in Blender and then upload the textured object into Second Life.
My work flow is Object > Unwrap > UV Map to Photoshop for Textures > Assign UV Map to Object > Export to Collada, selecting SL/OpenSim Static > Upload to SL.
Of course, the textures do not follow.  Am I missing a step?
If you can't upload a textured object, what is the use of the Operator Preset?
The other related issue is that when I upload an object to SL, in edit, I cannot select an individual face to apply a texture to.  It applies the texture to the entire object, regardless of selecting "Select Face."
I have mapped, not mapped, mapped each individual face, textured, untextured.  It always applies an texture to the entire object.
Answer: Yes you can't is the simple answer. You have to upload your textures and apply them in world. As for selecting faces, in Blender you need to assign a "material" to the parts you want to call a "face" in Second Life. If I can attach a photo you will see an object created in Blender, material slots applied (Black,red, green, yellow, blue) and, each of those are faces 0-5 on the object in SL.

Texturing Mesh for Second Life


android.R error if import is present

Question: I just finished debugging one of my apps because I was having issues with R.layout.
Naturally, I went to my .xml files and cleaned up a few errors and everything should have been fine, but it wasn't.
For some reason, I was still getting an error with R.layout saying that my .xml files could not be resolved to a type.
As soon as I deleted the import android.R statement, everything went away and my program compiled correctly.
To my knowledge this is the opposite of what people are saying to do in this situation. Normally they tell you to ADD that statement in to eliminate any errors, but mine was the opposite. Does anyone have any insight as to why this happens so that when this inevitably happens again I won't have to spend as much time on it?
Thanks all!
Answer: There's two R: your project one and android.R one. You were importing the wrong one
Answer: android.R should NOT be imported. It's the system's R.java not your project's. By importing android.R, you are in fact hiding your own R.java and that's why it can't resolve the values inside it. So as you (correctly) did, android.R should be removed from your import list.
If you need to use it in your app you can use it like this :
android.R.layout.xxx

Answer: You are importing an R that doesn't contain your application's layout resources. You are instead importing the Android framework's R, thus causing a name collision. There are, however, situations in which you may need android.R. In these cases, you shouldn't import android.R, but instead explicitly use android.R.[whatever] when you need it.
Your application has it's own R which contains most of your application's resources.
android.R contains a variety of Android framework resources.
There is more information on the R class in the Android: What is R? question.
Comment: TL;DR - Don't import the OS R package, but rather let Eclipse import YOUR R package (which will get "put" into the root of your namespace).

android.R error if import is present


Using Fat Secret Api in Rails 3

Question: I would like to use the Fat Secret API in a Rails 3 application to get nutrition data for an item. I don't need to authenticate any users. I have an development account, with a key and shared secret. However, I don't really understand the OAuth1 authentication. How would I go about accomplishing this? I tried using the 'passport' gem, but got lost.
Answer: If all you want is an example of authentication with the API I can help you with that. This API is only OAuth1 so we can use the standard oauth gem to reduce the boilerplate code that we need to write.
Using the OAuth gem we want to create a consumer and then make a request to the API like so:
@consumer = OAuth::Consumer.new("key", "secret", :site => "http://platform.fatsecret.com/rest/server.api")
@consumer.request(:post, '', token = nil, {:method => "recipe_types.get"})

I wish I could test this but the API signup wont let me test without a URL.
Comment: This Didn't work, it returned 'Missing required oauth parameter: oauth_signature_method'. However, the code at http://groups.google.com/group/fatsecret-platform-api/browse_thread/thread/45b3e8efa412c660/c45159103b1dcd94?lnk=gst&q=rails#c45159103b1dcd94 worked. I would love a more concise version, though. Thanks for helping.

Using Fat Secret Api in Rails 3


Issue with creating a permission set - it adds every custom field in the system

Question: This happens even with a blank permission set - I created a new permission set called "blank" and retrieved it through the package.xml in Visual Studio code.  When I open and look at the permission set in VSCode, it is over 2000 lines long, and seems to contain every custom field on every object in the org. The good news is that all of the extra fields fieldPermissions have false as editable and readable. I would like them not to be there at all, and it is a PIA to delete them every time I perform a metadata retrieve.
Anyone seen anything like this and/or have a solution?
Answer: Doing a sfdx force:source:retrieve -m PermissionSet:blank (here blank is the permission set i created) only yields me the permission set metadata with no field FLS or Object settings included.
This is the same behavior if I do a retrieve using mdapi as below
sfdx force:mdapi:retrieve -k ./src/package.xml -r ./src --wait=-1 --json

As documented here with v41.0 and above permissionset will include everything that is exposed while retrieving and deploying.
In your use case if you are getting 2000 lines with false permissions then it's not correct.
Try with the source:retrieve command
Comment: interesting ....I have observed the same issue as OP when using Gearset, which uses MDAPI ...hundreds / thousands of fields all with editable/readable as false
Comment: Interesting as it it went fine for me in sandbox org


Are pass-through grounding screw connections allowed by the NEC?

Question: Is this type of connection allowed according to the NEC assuming the ground wire is sheathed (like thhn) and striped back at the area of the screw and then continued to the receptacle ground screw then stripped there?
Comment: Comment because I don't have a definitive answer about the NEC, but this is the *preferred* way to make connections to a screw+washer fitting in a ring-main in the UK.  You have to be careful not to nick the copper when stripping the insulation of course.  In this case, I would cut the insulation almost all the way through with a very sharp knife, and then grip it with pliars and **pull**, that would open the cut and slide the insulation along the wire a little.  Then you just have to strip the end.  (Possibly slide it a bit too far, cut the insulation, and slide back.)
Comment: Possible duplicate of [Wire that was stripped inline and loops over the side screw](https://diy.stackexchange.com/questions/139116/wire-that-was-stripped-inline-and-loops-over-the-side-screw)
Answer: I'm not a fan.  Several reasons. Remember the axiom of grounding (very similar to the axiom of neutrals in MWBCs):
Removing devices must not break continuity to other devices
Which in practice means they must be pigtailed.
This is sort of a "hybrid pigtail" where it is both pigtailed and not (Schroedinger's pigtail?)
Repeated removal/replacement of the rightside lamp could fatigue and break strands in that wire, injuring the ground going to the other lamp - that doesn't feel right.  As an aside, it also fails to ground the junction box.
In the first picture, it's not so bad provided this is the supply cable, because removing that cable will render the whole box dead.  But if  you do it with any other cable, you have a problem because removing/replacing that cable will sever ground to equipment.
The right way, as always, is to pigtail to the metal box and to each piece of equipment, and join them in a splice; or take advantage of  other means of grounding, such as in metal boxes: extra ground screws, "via screws" for switches, or "via hard flush contact" for receptacles.
Internal wiring to equipment is an exception
The situation in the second photo is a funny case, because it seems to be the interior of equipment which is sold, i.e. that looks like a multi-stalk security light.  Equipment is not subject to NEC; it's subject to a different rulebook that is curated by Underwriter's Laboratories - who issues "UL Listings".
Answer: It is a good method and some local jurisdictions require it, the wrap is required to be between 2/3 & 3/4 around the screw.
Comment: Is this true for stranded wire as well?
Comment: @isherwood Note that the pictured green wire is twisted *considerably more* than stock... that will help it not fray when the screw is tightened.  If it frays, start over.  Stranded on screws takes a knack... myself I stick the wire in the #8 bolt shear, and use that as a pliers to twist the wire tighter than I could by hand.
Comment: Yep. That's why I ask whether code allows it. Stock wire tends to spread when placed under a screw.


What are some ways a SPO can attack the network and what mechanisms exist to discourage or mitigate such attacks?

Question: What are some ways a SPO can attack the Cardano blockchain? E.g. in Bitcoin, a miner could intentionally exclude certain transactions to the extend that the miner's hash power allows. Is something like this possible in Cardano? What about other forms of attack? What discourages such attacks or mitigates the harm they can cause?
Answer: I am still researching if it is possible for a SPO to choose and exclude transactions when they are elected to create the block. I am pretty sure it isn't something you can just do 'out of the box,' I believe you would need to modify the client code of your block producer. With that said, if they could do that, it still wouldn't cause much damage. The reason why is because there is enough entropy built into the slot leader selection that the next block would pick up the excluded transaction. This is because it would be a new slot leader, thus only causing a ~20 second delay. This kind of attack is also discouraged because there is not incentive for just 1 pool operator to cherry pick (choose some, exclude others) transactions because the rewards are pooled and distributed at the end of the epoch. Meaning that if there were a lot of full-blocks, you could very slightly increase the overall rewards. However, after dividing it out to all the SPOs who created blocks, it likely wouldn't be worth your time. Now if multiple SPOs worked together on something like this, and we were constantly creating full blocks there could be incentive to choose the transactions that have larger fees (like ETH).
Answer: Decentralization is the mitigation against attacks in almost all of these systems, they all assume that a centralized player has not gained the power to control consensus.
An SPO could theoretically re-write their block producers software to do anything, like award themselves a million ADA.  But it doesnt have any effect because no other SPOs agree that should happen.
Chain forks are probably the next thing an SPO could try to do, if they could create a dummy chain they could double-spend ADA.  Ouroborous can withstand at least 6 blocks in any 22 blocks being created by attackers trying to fork the chain, and with 15 confirmations no users will be duped onto the wrong chain.  It would be very hard for any SPO to co-ordinate more than 6 in 22 blocks becaise of the random nature of slot leader selection, unless they had a very high amount of stake and could wait for the the right time.  Of course the problem there is that having a lot of stake on the system and damaging the system is stupid, because you are damaging your own value.
Forking is also dis-incentivized by the fact that all SPOs earn more if there are more successful blocks on the main chain.  As rewards are held to the epoch end and distributed to SPOs based on the number of blocks they created on the main chain, its an incentive for all SPOs to find and stay on the main chain.
Answer: The most feasible (and most well-established) method by which any kind of validator (be it a miner, SPO, etc) can game the system is through Miner Extractable Value (MEV), a.k.a front-running. It is an endemic (though non-catastrophic) problem for any public blockchain network that is maintained in a trust-less fashion.
In a nutshell, when a validator creates a new block, she temporarily gains a non-insignificant glimpse into the future of the blockchain before the rest of the network does. This is because there is a small amount of time elapsed between the validator making the block locally and that block being validated and incorporated into the rest of the network. Let's call this the MEV-window. If during this window the issuing validator is quick enough to act, they can gain an arbitrage opportunity over the rest of the network. This is especially true if the validator in question is responsible for more than just good 'ol block production on the CSL, but is also providing oracle data, babel fee liquidity, DEX scooping, and/or a variety of other distributed services.
For example, if I'm an SPO and an oracle provider, and I see that the block I'm about to publish contains a sudden surge of transactions towards a known exchange address(es), I may conclude that the price is about to go down, so I may then include some of my own buy orders in the same block. I can also adjust my oracle feeds to match where I expect the price to go before anyone else does; I'd be using my position as a block producer (in that moment) to front-run the market. This is just one of many ways MEV can be used to game the system.
As far as I am aware, there is no generalized solution to the problem of MEV, and I believe it is widely accepted as an issue that can only be minimized, but not completely eliminated. The good news is there may be ways to minimize this problem to the point of relative obscurity. Things like minimizing the MEV window, clever use of ZK-technology, or just building applications with a highly meticulous approach to the underlying game theory, just like IOG did with the development of Cardano.


Question about the Dirac equation

Question: Energy and momentum of a particle can be expressed by equation
$$E^2=p_1^2c^2+p_2^2c^2+p_3^2c^2+m^2c^4\hspace{40pt}(1)$$
Equation (1) can be divided into $E$ on both sides. We obtain
$$E=\frac{v_1}{c}p_1\,c+\frac{v_2}{c}p_2\,c+\frac{v_3}{c}p_3\,c+\frac{v_4}{c}m\,c^2\hspace{40pt}(2)$$ where $v^2=v_1^2+v_2^2+v_3^2$, and $v_4=\sqrt{c^2-v^2}$;
The Dirac equation has the form $$i\hbar\frac{\partial\psi}{\partial t}=(\alpha_1\hat p_1c+\alpha_2\hat p_2c+\alpha_3\hat p_3c+\alpha_4m\,c^2)\psi\hspace{30pt}(3)$$ where $\alpha_i$ is matrix $(i=1,2,3,4)$.
From the principle of correspondence between (2) and (3) is $\alpha_i\rightarrow v_i/c$.
In quantum mechanics, it is shown that the relativistic velocity operator $v_v=dx_v/dt$; $(v=1,2,3)$ is given by $\hat{v}_v=c\,\alpha_v$, ie is a matrix operator. Then relativistic velocity operator $v_4=\sqrt {c^2-v^2}$ is the matrix $\hat v_4=c\alpha_4$. Is it right? Does the equation (2) be the basis of the Dirac equation?
Comment: Why don't you square your equation (2) and check if it returns your equation (1). Frankly, I don't understand how you divided (1) into (2).
Comment: Let $v_4=\sqrt{c^2-v^2}$ then $$\frac{p_1c}{E}=\frac{mv_1c(c/v_4)}{mc^2(c/v_4)}=\frac{v_1}{c}$$  and so on. Let $E_0=mc^2$ then $$\frac{E_0}{E}=\frac{v_4}{c}$$;
Comment: Well your math seems to check out. However a quick search on the Dirac equation would already tell you that the $\alpha$ matrices have the Pauli matrices for elements, independent of velocity. Also simply squaring your equation (2), it is already evident that it does not return the original equation (1), not unless $v_i v_j = 0$ where i does not equal j. I have an idea on why this is so though I think I am wrong.
Comment: From the textbook: $$\frac{dx_{\nu}}{dt}=\frac{\partial x_{\nu}}{\partial t}+[H, x_{\nu}]$$ where $$H=c\alpha_{\nu}p_{\nu}+mc^2\alpha_4$$ Since the operator $x_{\nu}$ does not depend on time, it will be $dx_{\nu}/dt=[H,x_{\nu}]$. We get $$\frac{dx_{\nu}}{dt}=[{c\alpha_{\mu}p_{\nu}+mc^2\alpha_4},x_{\nu}]$$ The matrix $\alpha_{\mu}$ commutes with $x_{\nu}$, so that the matrix $\alpha_{\mu}$ can be factored out. Finally we have $$v_{\nu}=dx_{\nu}/dt=c\alpha_{\mu}[p_{\mu},x_{\nu}]=c\alpha_{\mu}\delta_{\mu\nu}=c\alpha_{\nu}$$
Answer: The Dirac equation (according to my understanding), is an alternate form of the Klein-Gordon equation. The Dirac equation can be derived from the following equation.
$$ Z_{μ\ }Z^{μ}-m^{2}=0 $$
 Were,$$ Z_{μ\ }= \left(E\ \ \ P\right)$$
and,
$$Z^{μ}= \begin{pmatrix}
           E\\-P \end{pmatrix} $$
Where "E" is the operator of energy, and "P" is the operator of momentum. The equation:
$$ Z_{μ\ }Z^{μ}-m^{2}=0 $$
Is the 4-vector representation of the equation:
$$ E^{2}-P^{2}-m^{2}=0 $$
Which is just a rearranged form of the Mass-Energy equation, with natural-unit simplification namely,
$$E^{2}=\ P^{2}+m^{2\ }$$
Therefore, the Dirac equation is just the Schrodinger equation, with a relativistic Hamiltonian. I guess, if you start with a relativistic Hamiltonian, and rearrange it in 4-vector notation, and then substitute in Quantum operators for energy and momentum, you will eventually get some form of the Dirac equation!
The connection between the equation,
$$ Z_{μ\ }Z^{μ}-m^{2}=0 $$
and the Dirac equation, can be found in this video: https://www.youtube.com/watch?v=jjG2Y_dMsbI
I hope this helps!

Question about the Dirac equation


How to install FamilySearch Indexing on Ubuntu 16.04

Question: How can I install FamilySearch Indexing on Ubuntu 16.04? When running the installation script found at https://indexing.familysearch.org/downloads/Indexing_unix.sh the prompt says that Java 1.6 is required, but openjdk-6-jre is deprecated? Is it possible to install with a newer version of Java?
Comment: I don't have enough reputation to comment, but I just got the application to work by installing the PPA for java 6 described in this thread: https://github.com/zvakanaka/family-search-ubuntu/issues/1
Comment: Which software exactly and how are you trying to install it? Maybe there's a way around that hard dependency on OpenJDK 6 and the program can run fine with OpenJDK 8. After all, Java applications are supposed to be compatible with later runtime environment releases.
Comment: Familysearch indexing.  Technically its only supported on 32 bit linux but I was able to install it on Ubuntu 14.04 using the script in this repository https://github.com/zvakanaka/family-search-ubuntu.  I upgraded to version 8 of Java on my system and just changed a few lines in the launch script to get it to work, but now I'm trying to install it on a clean Ubuntu 16.04 install and can't figure out how to install familysearch without openjdk-6-jre
Answer: I documented my attempt in Family Search for Linux patch set for any JVM ≥ 1.6 :

Family Search for Linux patch set for any JVM ≥ 1.6
Prerequisites
You can install all of the following packages with a single apt install command. I just listed them here separately to explain each of them.

A Java runtime environment of at least version 1.6. On Debian you
  can install one like this:
sudo apt install default-jre

According to Getting FamilySearch Indexing to work in Ubuntu
  14.04
  you also need a few shared libraries:
sudo apt install libgtk2.0-0:i386 libxtst6:i386 libxtst6:i386 libx11-dev:i386 libz1:i386 libncurses5:i386 libbz2-1.0:i386 libxi6 libxtst6 libxrender1

They were already installed on my system so I haven't tested the veracity of that claim.
The wget and patch tools:
sudo apt install wget patch

Installation instructions

Download the Unix installer.
wget -c https://indexing.familysearch.org/downloads/Indexing_unix.sh

Download the patch set.
wget https://gist.githubusercontent.com/davidfoerster/a7eb57becee7d5c44a3f5d9df89e2a78/raw/Indexing_unix.sh.patch https://gist.githubusercontent.com/davidfoerster/a7eb57becee7d5c44a3f5d9df89e2a78/raw/indexing.patch

Patch the installer.
patch -b Indexing_unix.sh < Indexing_unix.sh.patch

Run the installer.
./Indexing_unix.sh

Patch the installed application.
patch -p2 -d ~/.FamilySearchIndexing < indexing.patch

… and you're good to go.
Tested with OpenJDK 1.8 on Ubuntu 14.04.
Comment: Unfortunately this solution no longer works, the installation still works fine but the program has errors when trying to use it.  I contacted their support and was able to get on a beta test for the new, long awaited web app