Engine performance

Question: On a straight four diesel engine Can you replace some pistons bearings and leave other unchanged ,
Will that have any negative effects on the performance of the engine
Comment: Welcome to Motor Vehicle Maintenance & Repair!
Comment: May not affect performance, but the ones that were not replaced will fail soon so you will do all that work again... May be a good plan if labor is cheap and parts expensive, but not a route I would take.
Comment: @SolarMike Perfect advice.
Answer: NOTE: You state "piston bearings" ... which don't exist. I'm assuming you actually mean either the rod or main bearings which the crankshaft rides on, so that's what I'm going with.
Technically I suppose you could ... but why? It doesn't make sense for many reasons:

When you get new bearings, they come as a set for all of the journals. You've got new bearings, why wouldn't you use them?
When you don't replace all of the bearings, they'll (obviously) be different. The engine won't necessarily like that and could cause more issues down the road.
If you have to have machine work on a single journal, it will be undersize. If you only did this to one journal, you'll have a journal which will have less friction on the single journal, which means the engine will be out of balance in power production.
If you need machine work, a shop won't do "just one journal". They'll want to do all of the journals because they know you'll want to do them all.
If you have to open up your engine to replace "just one journal" worth of bearings, why not just replace them all while you're in there. It's a lot of work to rebuild an engine. It only makes sense to be "one and done", meaning, do it once and you won't be redoing it anytime soon. More than likely if you don't do them all, you'll just be turning around and  having to do the other bearings in the not too distant future.

I'm sure there are other reasons I could come up with, but hopefully this is more than enough to convince you.

Engine performance


How can I compare model fitting accuracy between Random Forest and Logistic regression models

Question: I am conducting a classification problem. Usually AUC is used to check the effectiveness of a model when performing logistic regression model. However, if I fit the same data set by using Random forest and logistic regression models, which measures should be used to check the accuracy of the two models? Are there any measures like "BIC" can be used to compare the two models? Thanks.
Answer: Those are two separate issues, AUC can be used to compare arbitrarily many algorithms. AUC is also not more linked to logistic regression than to random forests or any other algorithm. Just test both algorithms on the same data-set splits (hold-out, cross validation, bootstrap or whatever it is you do) and compare the numbers.
AUC has other drawbacks like being limited to binary classification and being less intuitive than say accuracy, but that's data-set related and thus also independent of the number and type of algorithms to compare.
There are many measures you can use, AUC is one of them.
Comment: Thank you for the quick answering. My question is, if the AUCs calculated from the two models are the same, but the estimated outputs (e.g., y-hat for regression model) are totally different, then which one is better?
Comment: You didn't say that. If your algorithms have (as good as) the same average performance, you have the discretion to choose the algorithm with the lower variance of performance, the algorithm that is computationally simpler or conceptually simpler etc. You could also have an ensemble of algorithms and determine the label by majority vote. Your choice! But that is also true for all performance metrics, not just for AUC.
Comment: +1, however, the AUC is not ultimately limited to binary classification ([Hand & Till, 2001](https://link.springer.com/content/pdf/10.1023%2FA%3A1010920819831.pdf)); & although the AUC is less immediately intuitive to people who have never completed any statistical or machine learning coursework, it shouldn't be any less intuitive than accuracy to people who have (eg, see: [here](https://stats.stackexchange.com/q/132777/), &/or [here](https://stats.stackexchange.com/q/145566/)).
Comment: @Liam, if your models have comparable overall performance, but yield different outcomes for individual cases, you might explore how to combine them. Eg, you might train a 3rd model that uses the outputs of the 1st 2 to make a final prediction.
Answer: You can also use other measures like the brier score and logarithmic loss which look how well the probability estimations are done. Or of course the missclassification case, which has the drawback that a specific threshold has to be set. I always check these three measures together with the AUC. In R you can easily calculate them with the mlr package: http://mlr-org.github.io/mlr-tutorial/devel/html/measures/index.html
Comment: Thank you very much! Your answer is exactly what I want.


Making a HANDLE RAII-compliant using shared_ptr with a custom deleter

Question: I've recently posted a general question about RAII at SO.
However, I still have some implementation issues with my HANDLE example.
A HANDLE is typedeffed to void * in windows.h. Therefore, the correct shared_ptr definition needs to be
std::tr1::shared_ptr<void> myHandle (INVALID_HANDLE_VALUE, CloseHandle);

Example 1 CreateToolhelp32Snapshot: returns HANDLE and works.
const std::tr1::shared_ptr<void> h
    (CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, NULL), CloseHandle);

As I use void in the definition (what is the correct way?) problems go on, when I try to call some more winapi commands with this pointer. They functionally work, but are ugly and I am sure that there has to be a better solution.
In the following examples, h is a pointer which was created via the definition at the top.
Example 2 OpenProcessToken: last argument is a PHANDLE. medium ugly with the cast.
OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY,
    (PHANDLE)&h);

Example 3 Process32First: first argument is a HANDLE. REALLY ugly.
Process32First(*((PHANDLE)&h), &pEntry);

Example 4 simple comparison with a constant HANDLE. REALLY ugly.
if (*((PHANDLE)&h) == INVALID_HANDLE) { /* do something */ }

What is the correct way to create a proper shared_ptr for a HANDLE?
Comment: Not a complete answer, but one can slightly reduce "ugliness" of using `void` type by using `std::remove_pointer::type` from `type_traits` instead.
Answer: Example 1 is OK
Example 2 is wrong. By blindly casting to PHANDLE, the shared_ptr logic is bypassed. It should be something like this instead:
HANDLE h;
OpenProcessToken(...., &h);
shared_ptr<void> safe_h(h, &::CloseHandle);

or, to assign to a pre-exising shared_ptr:
shared_ptr<void> safe_h = ....
{
  HANDLE h;
  OpenProcessToken(...., &h);
  safe_h.reset(h, &::CloseHandle);
}//For extra safety, limit visibility of the naked handle

or, create your own, safe, version of OpenProcessToken that returns a shared handle instead of taking a PHANDLE:
// Using SharedHandle defined at the end of this post
SharedHandle OpenProcess(....)
{
    HANDLE h = INVALID_HANDLE_VALUE;
    ::OpenProcessToken(...., &h);
    return SharedHandle(h);
}

Example 3: No need to take these detours. This should be ok:
Process32First(h.get(), ...);

Example 4: Again, no detour:
if (h.get() == INVALID_HANDLE){...}

To make things nicer, you could typedef something like:
typedef shared_ptr<void> SharedHandle;

or better yet, if all handles are to be closed with CloseHandle(), create a SharedHandle class wrapping a shared_ptr and automatically providing the right deleter:
// Warning: Not tested. For illustration purposes only
class SharedHandle
{
public:
  explicit SharedHandle(HANDLE h) : m_Handle(h, &::CloseHandle){};
  HANDLE get()const{return m_Handle.get();}

  //Expose other shared_ptr-like methods as needed
  //...

private:
  shared_ptr<void> m_Handle;
};

Comment: is there some possibility to delete the unsafe `HANDLE` after converting it to a safe one in your first example 2 code snippet?
Comment: You could create a function wrapping OpenProcessHandle() (I added this to the post) or do the same thing than in the second snippet, with shared_h initialized to INVALID_HANDLE_VALUE
Answer: Don't bother with shared_ptr for that, use ATL::CHandle.
Here is why:

When you see CHandle you know that it's a RAII wrapper for a handle.
When you see shared_ptr<void> you don't know what it is.
CHandle doesn't make an ownership shared (however in some cases you may want a shared ownership).
CHandle is a standard for a windows development stack.
CHandle is more compact than shared_ptr<void> with custom deleter (less typing/reading).
Comment: Can you expand on that? The [documentation](https://msdn.microsoft.com/en-us/library/5fc6ft2t.aspx) doesn't say much, but it looks more like a unique_ptr, I don't see how CHandle facilitates sharing.
Comment: @phant0m CHandle doesn't provide a shared ownership.
Answer: Take a look at boost 2: shared_ptr wraps resource handles
Answer: Here is my alternative, which is quite nice except you need to dereference always after .get() and requires a functor or lambda:
template<typename HandleType, typename Deleter>
std::shared_ptr<HandleType> make_shared_handle(HandleType _handle, Deleter _dx)
{
    return std::shared_ptr<HandleType>(new HandleType(_handle), _dx);
}

then:
auto closeHandleDeleter = [](HANDLE* h) {
    ::CloseHandle(*h);
    delete h;
};
std::shared_ptr<HANDLE> sp = make_shared_handle(a_HANDLE, closeHandleDeleter);
f_that_takes_handle(*sp.get());

what I like most about this is there is no extra work to have access to this:
std::weak_ptr<HANDLE> wp = sp; // Yes. This could make sense in some designs.

and of course, the helper function works with any handle type of the likes.


Intel mnemonic to machine code converter library

Question: I'm trying to do the following: take a single IA32 instruction in the Intel syntax (such as ADD EAX, EBX) and produce the corresponding machine code for this instruction. Is there some small library, preferably open source, that can do this for me?
Comment: You could probably extract that part from, say, NASM, and turn it into a library -- but I don't know of one that's already built to do exactly that (and it's not clear how it would work in some cases, such as jmp instructions, which normally need a series of instructions so the assembler can compute the offset to the target).
Comment: Jerry, for JMPs I'd like to be able to specify the target address and the resulting object code should imply include the address verbatim.
Comment: Do you want to write a small assembler, or do you need to have an assembler in your program?
Comment: @Thorbjørn I need the assembler inside my program.
Answer: You can do it with FASM.
There is a sample GUI application distributed with FASM DLL
Or, you can use Python interpreter, with Python binding for FASM DLL
Comment: Is there a version for linux too, Abyx?
Comment: @Frederick, DLL? You can try Wine.
Comment: I guess I could use Wine if nothing else works. But I think I should try and hack NASM into a library first. Thanks anyway :)


Is there a program that will let me move an item from my Dock to my Menu Bar?

Question: And I don't mean like StatusDock, which will move it to the menu bar but also keeps it in the dock. I'd prefer it to just be gone from the Dock. Any way you can do this?
Comment: why not StatusDuck with hide dock?
Answer: Removing the Dock Icon
There is a way to remove the icon from the dock; the only problem is that you also lose the menu for the application, which is a slight drawback depending on the purpose of the application itself.
I, personally have never tried StatusDuck, perhaps when combined with the removal of the dock icon, it could be exactly what you're looking for.
As far as removing the dock icon itself, here's the process.

Find the application in the Applications folder (⌘ + click Dock Icon)
Right-click application
Click Show Package Contents
Edit the Info.plist inside the Contents folder
Modify/Add the LSUIElement key so that the value says YES

Note: LSUIElement may change to Application is agent (UIElement)
If you would like the application to show the dock icon again, modify the value to NO and save the .plist file.

It is worthy to mention that using an application like StatusDuck could help you access the application as a status item. You will just have to test it out.
StatusDuck:
http://www.statusduck.com
Comment: I tried to do this but now whenever I try to open the application it just errors out. Not sure why adding the `Application is agent (UIElement)` to true would do that.
Answer: If you are wanting a way to change a Dock based app to a Menu Bar app, you are out of luck. But if you are looking for an alternative way to deal with apps focused on the Menu Bar there maybe a solution.
Take a look at XMenu (Scroll to the bottom of the page.)
XMenu acts as a launcher for apps, folders, documents, etc. It will allow you to recreate something like the Apple Menu of the Classic Mac OS.
You may know the following, but worth restating:

Non-running apps in the Dock can be removed by dragging the icon out of the Dock until a "Remove" popup appears over the icon. (This is the current behavior in Mac OS X 10.10)
The Dock preferences allow you to hide the Dock so that it is mostly out of the way.
Many utility type apps have a preference setting to change them from running in the Dock to the Menu Bar
Comment: Thanks for commenting. I do know that I can remove unopened apps from the dock. However, I like to keep my dock minimal, especially during work hours. Just things like me IDE, chats, email, notes, etc. However, certain apps like my money management app or my weather app (which stupidly only comes in dock form) are nice to have open and available without cluttering my dock. They'd be much more useful in the menu bar. That's what I'm trying to achieve.


How to make apache2 serve HTTPS on port 443 and non-standard ports?

Question: Hi i want to change port in apache2. i was running owncloud on standard ports http=80 https=443. For some reasons i need to change https port from 443 to 8443. i have seen many solutions but i dont come to hundred percent result what i  want.
i just want that when i write my hostname "server" then i just see my owncloud page. when i write my ipadress then i no need to mention port number but when i write "server" then i need to mention port number 8443 then it works. i am using Ubuntu 16.04 LTS. i have tried everything on virtualhost and also by ports.conf.  kindly tell me some solution if someone know .Thanks in advance
Answer: Browser knows default ports (80, 443). http:// is also default. So when you write
server

Your browser actually makes a request
http://server:80/

If you type in
https://server/

Your browser will make a request
https://server:443/

In fact it is a little more complicated, because you cannot access the network name directly. Browser finds out IP of the server and makes request
http://<ip of server>:80/

and tells the server that the request is for server, because you can host also server1, server2,... on the same IP address.
You will not be able to make browser to request port 8443 by default. You will have to write it in the address.
The problems you are describing are not all clear to me, but it looks like they are all connected with apache configuration and the inability of browser to go to 8443 port by default.
When you have VirtualHost defined in apache, you must specify ServerName. Clients will arrive to the IP of server, but apache needs to know which server name was requested to send back the correct pages. If you access server only with IP the name will not be sent to apache and it will send back the default pages. I suspect that is happening in your case, because you say that browsing to IP works. I would suspect it works to default port numbers.
I hope I helped to clear out the questions at least a bit.
Comment: You can just write your server name if you stay on standard ports or if you make a redirection. But that would mean that apache would still work on standard ports. On standard port it would just redirect to non-standard. You could make it listen on port 80 and then redirect to 8443. Take a look here https://httpd.apache.org/docs/2.4/vhosts/examples.html to understand ports, IPs and names. Look here for redirect https://wiki.apache.org/httpd/RedirectSSL
Comment: you mean to say there is no possibility that i just write server (without port number ) to come to the owncloud page? if yes than what would be your method csn please write it here. because if i just write my ipadress then i no need to mention port number.


Vietoris-Rips complex and coarse geometry

Question: Let $K$ be an infinite countable subset of Euclidean space $E$ such any point of $E$ is within distance 1 of some point of $K$. In the language of John Roe's "coarse geometry", this implies that $K$ is coarsely equivalent to $E$. Let us also assume that $K$ is uniformly discrete, i.e. that the distance between distinct points of $K$ is bounded from below by a positive constant. Consider the Vietoris-Rips complex of $K$. It depends on a parameter delta (a positive number). What can one say about the homology of this complex for large delta? Is it true that it stabilizes for sufficiently large delta? Is the limit isomorphic to the homology of $E$ (that is, trivial in degree greater than $0$)? There is also a "Borel-Moore" version of this question, where one allows locally-finite but not necessarily finite chains.
Comment: "*this means that $K$ is coarsely equivalent to $E$*". No: this means that the embedding of $K$ into $E$ is a coarse equivalence. (It's maybe true that $E$ is not coarsely equivalent to any non-cobounded subset, but if so that's certainly not a definition, but a theorem.)
Answer: If you strengthen the uniform discreteness assumption a little you can ensure that the Rips complex of any such $K$ is contractible for large enough $\delta$. The strengthened assumption I have in mind is to require the set of distances between points in $K$ to form a discrete subset of $\mathbb{R}$ (so the distances don't accumulate anywhere in $\mathbb{R}$ - your requirement is that they just don't accumulate at $0$). Then contractibility of $Rips_\delta(K)$ for large $\delta$ follows from Example 4.7 in https://arxiv.org/abs/1812.10976v2 using $r=1$.
This condition about the set of distances being discrete is equivalent to your condition about non-zero distances being bounded away from zero in some special cases. For example they're equivalent if $K$ is the orbit of a finite subset under the action of some group of isometries of $E$. But I don't know if the kinds of $K$ you have in mind arise that way. For the record an example that satisfies your condition but not mine is $E=\mathbb{R}$ and $K=\{m\in\mathbb{Z}\mid m\le 1\}  \cup \{n+\frac{1}{n}\mid n\in\mathbb{N}\}$.


Graphical equivalent to /dev/null?

Question: I'm trying to run a GTK-based plotting library that I wrote over an SSH terminal that's too slow to run an X session over.  GTK assumes that a graphical display is present and won't work otherwise.  However, I only want to use this library to generate plots and save them to a file, not display them on the screen.  Is there any way I can set up a graphical equivalent to /dev/null as my graphical display, without root access to the machine in question?  Such a device would report sane values for resolution and depth (1280x1024, 24-bit, for example), and report that all screen drawing commands succeeded without doing anything, and make GTK think there was a real graphical display present.
Answer: Check out xvfb: "X virtual framebuffer is an X11 server that performs all graphical operations in memory, not showing any screen output."
edit  Whoops, I missed that bit about not having admin access (edit: it wasn't bolded then).  Probably not an option then unless it's already set up.
Comment: It seems like, at least in theory, you could hook into ssh to present a dummy X display that would catch and discard the data that would normally go back through -X.  But I have about 0% of the considerable knowledge that would be necessary to estimate the practicality of such an endeavour.
Comment: Good answer anyways.  I have only ever heard of this being done using either xvfb or vnc / x11vnc.  There's not much you can do to change the basic configuration of the x server without any admin privileges.
Answer: Another option is to use X.org's dummy video driver and void input driver. Using them will start a X server that does not connect to hardware and has little or no backing store. Pass -config to Xorg to use a separate config file you supply.
Comment: Can this be done w/o root access?
Comment: Provided the drivers are already in place, yes.
Comment: @dsimcha: on ubuntu look for package `xserver-xorg-driver-dummy`

Graphical equivalent to /dev/null?


Truffle Error: PollingBlockTracker - encountered an error while attempting to update latest block: Error: connect ECONNREFUSED 127.0.0.1:8545

Question: I am just trying to create a HD  wallet with web3 and truffle to make receive some ethers.  I have installed both of these packages with npm. Inside a node console, I am trying to run this to get a private/public key :
Bip39 = require("bip39");
const mnemonicPhrase = Bip39.generateMnemonic();

const HDWalletProvider = require("@truffle/hdwallet-provider");
Web3 = require('web3');

provider = new HDWalletProvider({
  mnemonic: mnemonicPhrase,
  providerOrUrl: "http://localhost:8545",
  numberOfAddresses: 1,
  shareNonce: true,
  derivationPath: "m/44'/0'/0'/0/"
});

const web3 = new Web3(provider);
web3.eth.accounts.create()

I am running one piece of code after another and just after I run the provider = new HDWalletProvider(), I get this error:
Error: PollingBlockTracker - encountered an error while attempting to update latest block:
Error: connect ECONNREFUSED 127.0.0.1:8545
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16)
    at TCPConnectWrap.callbackTrampoline (internal/async_hooks.js:131:14)
    at PollingBlockTracker._performSync (C:\Users\Me\node_modules\eth-block-tracker\src\polling.js:51:24)
    at processTicksAndRejections (internal/process/task_queues.js:93:5) {

Some people mentioning this error are fixing it with something like testrpc, geth --rpc that is apparently used to send the transaction on the ethereum network, but I don't want to do that, I just need to retrieve the private/public key in web3js. I really don't understand what I need to do to fix this.
Answer: I had a similar error. I solved it by changing the IP address I had been trying to connect to.
from "https://10.161.162.12:8545" to "http://10.161.162.12:8554"


NTFS partition corrupted for dual boot

Question: I tried to dual-boot Ubuntu with Win8.1 but at installation by mistake selected LVM and then did reboot.
All my partitions now in Ubuntu Live CD shows as single LVM. How can I recover the data of old Win8.1?
Comment: possible duplicate of [How do I recover my accidentally lost Windows partitions after installing Ubuntu?](http://askubuntu.com/questions/286181/how-do-i-recover-my-accidentally-lost-windows-partitions-after-installing-ubuntu)
Answer: Short answer:
You may want to try using TestDisk and PhotoRec from http://www.cgsecurity.org/ to recover your data. Depending on how corrupted the data is, it might be possible to recover most of your data including the partition table. Worst case, you may be able to at least recover your files partially.
Long answer:
It appears you may have selected an option to reformat your partition table / partitions as LVM instead of the usual MBR/UEFI format if the former, or instead of a FAT32/NTFS system if the latter. This means that the part of the hard drive which Windows 8.1 used for keeping track of where each part of which file is (let's call it a file index) might have been corrupted to a varying degree.

This means that the files may be still there (or partially there, if the LVM format process overwrote the part of the hard drive where a file or a file fragment was stored), just not in a format which your operating system can recognise immediately as the OS depends on the index to work. PhotoRec tries hard to find files without using an index, which means that:

The folder structure and file names might not be preserved. This means that the items may unordered, all placed in the same folder upon recovery and with auto-generated names (or partially-recovered names in some instances), even if the files themselves are recovered in their entirety.
Some files may not be contiguous (i.e. occupying a single continuous chunk of hard drive space), which is not normally a problem as the index stores the information on which chunks of the file are located where. Parts of the index may be missing, so some files may be recovered as cut-up in several pieces.
Before you begin recovery, you must select which file types you want PhotoRec to look for. File detection is done using pattern matching, so it may produce false positives/negatives. Pick carefully.
Try TestDisk first. It doesn't do such a deep scan as PhotoRec, but it may be able to recover some partition table/file system structures and you might not need to do a PhotoRec scan.

NTFS partition corrupted for dual boot


How to adapt to Redux Toolkit's Updated selectById Type in EntitySelectors

Question: I've recently updated "react-redux": "8.0.4" to "8.0.5" and "@reduxjs/toolkit" from "1.8.6" to "2.0.0". In doing so I've noticed a change in the type definition of EntitySelectors in Redux Toolkit's EntityAdapter, particularly for the selectById selector.
Previously, the type explicitly allowed for undefined as a possible return type. However, the updated definition uses Compute<UncheckedIndexedAccess<T>>, which seems to complicate type inference.
This is the old definition:
export interface EntitySelectors<T, V> {
  selectIds: (state: V) => EntityId[];
  selectEntities: (state: V) => Record<EntityId, T>;
  selectAll: (state: V) => T[];
  selectTotal: (state: V) => number;
  selectById: (state: V, id: EntityId) => T | undefined;
}

And this is the new definition:
export interface EntitySelectors<T, V, Id extends EntityId> {
    selectIds: (state: V) => Id[];
    selectEntities: (state: V) => Record<Id, T>;
    selectAll: (state: V) => T[];
    selectTotal: (state: V) => number;
    selectById: (state: V, id: Id) => Compute<UncheckedIndexedAccess<T>>;
}

Previously I would define my entity selectors like so:
/* Export selectors ------------------------------------- */
export const selectUsers = usersAdapter.getSelectors(
    (state: RootState) => state.users
);

And then call them like so:
const user = useAppSelector((state) =>
    selectUsers.selectById(state, userId ?? "")
);

user would then be inferred as User_Entity or undefined
However since updating user is now only inferred as User_Entity which then doesn't cover the posibilty of undefined values, say for example if the userId is incorrect and doesn't exist as an id in the users slice.
I've got around this by doing the following:
export const { selectById, ...rest } = usersAdapter.getSelectors(
    (state: RootState) => state.users,
);

export const selectUsers = {
    ...rest,
    selectById: (state: RootState, userId: EntityId): User_Entity | undefined =>
        selectById(state, userId),
};

However I'm curious if there are better ways to approach this, especially in light of the new type definitions. Any insights or suggestions would be greatly appreciated!
Answer: As noted in the migration guide, the entity typing now depends on your noUncheckedIndexedAccess setting - if it's on, it'll be possibly undefined, if not it won't.
As you've noted, you can manually annotate to add the possibly undefined type in a case by case basis.
Comment: Thanks, I completely overlooked the migration guide. That solved it, thank you.


The hot burner light on my Kenmore glass top range stays on all the time, is it dangerous to leave this alone and not fix it?

Question: My Kenmore glasstop range hot burner light stays on all the time, is this dangerous?
Comment: Hello, and welcome to Home Improvement. It's hard to know without more information, but my personal guess is not. And, you should probably [take our tour](//diy.stackexchange.com/tour) so you'll know the details of contributing here.
Answer: In the sense that it no longer serves its function (it's on all the time, so it's no longer an indication that you should be cautious of a hot surface,) there's some danger that you might get burned, or set down something that melts or catches fire when there actually IS a hot surface, since that's not otherwise visibly obvious.
Other than that, I don't think there's any danger to having the light on, as such. Just treat the thing as if the light was accurate, so as not to get burned when it is accurate.


Translation of mRNA?

Question: We inserted an insulin gene from human into bacteria. Will translation of the gene (protein formation) occur in bacteria? If translation occurs then why does it occurs, give a reason for this?
Comment: In the context of this question it is useful to distiguish between the primary product of translation - a polypeptide- and a functional protein. The insulin polypeptide has to be post-translationally modified by the removal of a signal sequence, the formation of correct disulphides, and by proteolytic processing to remove the C peptide before it can be called insulin.
Answer: Yes, bacteria will produce human (or any organism's) proteins if you introduce their genetic material but there are a few things to consider.
First, the introns must be removed from the human genetic sequence. Bacteria do not have the machinery to splice out introns after transcription. This is typically done by using a viral protein to reverse transcribe mRNA, which already have the introns removed, into DNA which you can use to transform bacteria.
Second, you need to insert a Shine-Dalgarno sequence. This allows the bacterial ribosomes to bind to the mRNA they will produce, and translate the protein you desire. This sequence is not found in eukaryotic genes, so you have to make sure it was included either in the vector or in the PCR primers you used to amplify the gene sequence.
Answer: Although the genetic code is almost conserved among organisms there are some issues to take in account, among which:

Every organism has its own codon usage, i.e. the differences in frequency of occurrence in synonymous codons in coding DNA (that reflect the composition of tRNA abundances). So, for example, the codons UUU and UUC both encode for phenylalanine but - I'm making this up - UUU is common in human but rare in coli while UUC the contrary. If the coding sequence of insuline is rich of UUU, you probably need to change the codon UUU to UUC in order to avoid slow translation.
Also the aminoacid abundance can be very variable between two organisms. One of the ways you can handle the differences is by "tuning" the expression of the aminoacids. Here a table of aminoacids abundance in coli.
The regulatory sequences in coli are not the same as in human. In fact, prokaryotic translation initiation needs a purine-rich sequence upstream the (usually) AUG initiation codon called Shine Dalgarno. This sequence is complementary to the 16S RNA in 30S ribosome subunit.
Often peptide chains are subjected to various post-translational modifications. The insulin peptide, for example, once synthetized is cleaved by specific peptidases and disulfide bonds are formed. Because human and coli post-translational modification mechanisms are not the same, this can be a difficult problem to handle. Instead of trying to exactly reproduce the protein with all its modifications, often people search for functionally (and not structurally) identical proteins.
Also the folding process can be different, both assisted (by chaperones) and spontaneous (withouth chaperones). The folding can be influenced by a number of factors like molecular crowding, pH, ...
A lot of eukaryotic genes have introns: sequences removed before translation. Once splicing sites are known, this problem is easily solved by using a sequence withouth introns.
Answer: All the organisms share a common ancestor and have evolved from it. So they share quite the same machinery for transcription and translation. Codons are also interpreted in the same way in almost all the organisms.
So, yes translation should happen ( Assuming that the gene has been cloned in the right way.)
Comment: It depends on the regulatory elements controlling this inserted sequence in the bacteria, isn't it?
Answer: It works, and is actually done to make all the "human" insulin which is used by diabetes patients today.
This is because the genetic code is almost completely conserved (with only very few exceptions in nature), so bacteria use the same codons to code for an amino acid as in humans. So with a suitable vector (a ring of DNA which carries extrachromosomal genetic information) which has the ability to replicate independent from the cell and which has the correct promoters (start points) for initiating transcription in bacterial cells, you can basically clone and express any human gene.
Comment: Is this question have any relation with degeneracy of genetic cods..???
Comment: Sorry, but I don't understand your comment? If you are asking, if the degenerated code is important here, my answer is no.
Comment: Ok.Then the Translation occurs in bacteria, because the genetic codes are  universal.
Comment: Yes, the code is universal (for exceptions see [the Wikipedia](http://en.wikipedia.org/wiki/Genetic_code#Variations_to_the_standard_genetic_code), the regulatory elements are specific for bacteria (and need to be compatible).
Comment: Thanx for the help..

Translation of mRNA?


Destiny Engram Chance

Question: So I have my first character, a level 15 hunter and I have only got around 3 engrams over the whole game experience. Now I was wondering if higher levels (ex: level 20) would yield a higher chance of receiving an engram or I am just completely unlucky and I need more time to farm/kill enemies.
Comment: The game only really starts when you hit lv20.
Comment: Are you playing strikes, or just doing missions and bounties?
Comment: Engrams are less common than simply getting gear. They become more common at higher levels because they are earned as rewards. As for the drop rate, items are still more common even at higher level.
Answer: 3 seems reasonable for lower levels. Most engram's you get early on will automatically decrypt into a weapon or piece of armor.
There's no exact chance that anyone knows of, and it changes from time to time. However I can tell you that an hour of doing public events typically nets me 5-10 greens and 1-4 blues. An hour of lvl 28 strikes will typically net me 5-20 blues. An hour of PvP Control will typically net me 2-8 blues.
I've put approximately 300 hours into destiny. In that entire time, I have gotten around 10 legendary (purple) engrams, and 2 exotic (yellow) engrams. That doesn't count engrams that I've purchased.
It does differ depending on conditions, and even then the randomness really governs the drops. I have had times where an hour of strikes has netted me 5 blues, and times where an hour netted me 30.
Comment: Thanks man, I was getting kind of annoyed how I am barely getting any engrams.

Destiny Engram Chance


What is the difference between N and N-1 in calculating population variance?

Question: I did not get the why there are N and N-1 while calculating population variance. When we use N and when we use N-1?

Click here for a larger version
It says that when population is very big there is no difference between N and N-1 but it does not tell why is there N-1 at the beginning.
Edit: Please don't confuse with n and n-1 which are used in estimating.
Edit2: I'm not talking about population estimation.
Comment: You can find an answer there: http://stats.stackexchange.com/questions/16008/what-does-unbiasedness-mean/16009#16009. Basically, you should use N-1 when you *estimate* a variance, and N when you *compute* it exactly.
Comment: None of the answers below are written in terms of finite population inference. The word *finite* is absolutely crucial here; that's what Kish's book is about (and whoever was saying "The book is wrong" simply don't know enough about finite population surveys and samples). The quotient $N-1$ instead of $N$ just makes computations nicer and obviates the need to haul around factors like $1-1/N$. The full answer to this question would have to introduce the sampling inference where the sample indicators are random, and the values of observed characteristics $y$ are FIXED. Non-random. Set in stone.
Comment: This doesn't really add to the other answers. That different divisors give different answers, or even that the difference diminishes with N, is not at issue. The question is when and why to use either divisor.
Comment: I would just like to mention to the other readers that this issue is called "Bassel's correction".  You can check it out on Wikipedia https://en.wikipedia.org/wiki/Bessel%27s_correction#Proof_of_correctness_%E2%80%93_Alternate_1
Comment: @ocram, as far as I know when we estimate a variance we use either n or n-1.
Comment: If you want your estimator to be unbiased, then you should use n-1. Note that when n is large, this is not a matter.
Comment: You could have a better feeling about this question when playing with octave or matlab...
Example: x = rand(10,1); var1 = sum((x - mean(x)).^2) / (length(x)); var2 = sum((x - mean(x)).^2) / (length(x)-1); you will verify a significant difference between `var1` and `var2`, since your sample size is very small. Repeat it by considering a larger population size. x = rand(1e6,1); var1 = sum((x - mean(x)).^2) / (length(x)); var2 = sum((x - mean(x)).^2) / (length(x)-1); you will verify that `var1` $\approx$ `var2`
Comment: Watch this video, it precisely answers your question.

https://www.youtube.com/watch?v=xslIhnquFoE
Comment: @SahilChaudhary, your video talks about n and n-1. My quesyion has nothing to do with n and n-1. My question is about N and N-1. You can see that n and N are diffetent right? I have commented on my questtion!
Comment: Can you tell us, which book is it? @StasK
Comment: The book is "Survey Sampling" by "Leslie Kish" from "John Willey & Sons" https://archive.org/details/in.ernet.dli.2015.214343
Answer: Instead of going into maths I'll try to put it in plain words. If you have the whole population at your disposal then its variance (population variance) is computed with the denominator N. Likewise, if you have only sample and want to compute this sample's variance, you use denominator N (n of the sample, in this case). In both cases, note, you don't estimate anything: the mean that you measured is the true mean and the variance you computed from that mean is the true variance.
Now, you have only sample and want to infer about the unknown mean and variance in the population. In other words, you want estimates. You take your sample mean for the estimate of population mean (because your sample is representative), OK. To obtain estimate of population variance, you have to pretend that that mean is really population mean and therefore it is not dependent on your sample anymore since when you computed it. To "show" that you now take it as fixed you reserve one (any) observation from your sample to "support" the mean's value: whatever your sample might have happened, one reserved observation could always bring the mean to the value that you've got and which believe is insensitive to sampling contingencies. One reserved observation is "-1" and so you have N-1 in computing the variance estimate. The unbiased estimate is called sample variance (not to be confused with the sample's variance) which is an argot; it is better call what it is: sample unbiased estimate of population variance estimated with the sample's mean.
[Pasting here from my below comments: Imagine you are taking repeatedly samples of N=3 size. Of the 3 values in a sample, only 2 values express random deviatedness of observations from the population mean, but the left one expresses (takes on itself) the shift of the sample's mean from the population mean. Thus the "degree of free" observational variability is 2 of the 3, in each separate sample. When we estimate variability on a sample but want it to be an unbiased (unshifted) estimate of populational variability, we "believe" only those 2 free observations. We "pay" for the decision to measure variability off the sample mean as if it were the population mean, for we need to infer about the population variability. This "fee" (N-1 denominator, the Bessel correction) makes the variability wider, incorporating the oscillation of sample means within the variance, but it makes such variance an unbiased estimator.]
But imagine now that you somehow know the true population mean, but want to estimate variance from the sample. Then you will substitute that true mean into the formula for variance and apply denominator N: no "-1" is needed here since you know the true mean, you didn't estimate it from this same sample.
Comment: @ilhan - Couldn't comment directly on your comment to ttnphns post, but here is an explanation of what you see in the book and how you should infer it. The symbol 'S' when used to imply variance always refers to sample variance. The Greek letter sigma is used to refer to the population variance. That is the reason why you see the book mention S = N * sigma / (N - 1)
Comment: If you do have your population then use N. N-1 would be illogical to use.
Comment: @ilhan, in my reply, I used `N` for both N and n. `N` is a size of a totality at hand, either population or sample. To compute _population_ variance, you _must_ have population at your disposal. If you have only sample you can either compute this sample's variance or compute population _estimate_ variance. No other way round.
Comment: But my question has nothing to do with estimation. It is about computing population variance; with N and N-1. I'm not talking about n and n-1.
Comment: I have a complete information about my population; all the values are know. I'm not interested in estimation.
Comment: Kish does not say so http://i.imgur.com/OpAVd.jpg
Comment: This is not convincing at all. Population is population, sample is sample, all said. You cannot substitute one for the other, even for simplicity.
Comment: I don't quite understand the concept of "reserving" 1 observation. Why not reserve 2 observations, 3, 4, etc...? If you reserve, say, 2 observations, then you could make the same argument that 2 observations are what you need to get back the mean?
Comment: @user5965026, population mean is _one_ parameter that is independent of the sample. To secure its independence you reserve _one_ value (observation) in the sample.
Comment: @ttnphns Hmm, I'm having trouble understanding what this means. I do understand population means is independent of the sample. I think I'm not understanding why reserving one observation from the sample makes the population mean independent. Coudl you please expand?
Comment: @user5965026, Imagine you you are taking repeatedly samples of n=3 size. Of the 3 values in a sample, only 2  values express random deviatedness of observations from the _population_ mean, but the left one expresses (takes on itself) the shift of the sample's _mean_ from the population mean. Thus the "degree of free" observational variability is 2 of the 3,  in each separate sample. When we estimate variability on a sample but want it to be an unbiased (unshifted) estimate of populational variability, we "believe" only those 2 free observations.
Comment: I think that makes sense. This seems to assume that the sample mean from the n=3 sample is equal to the population mean?
Comment: Not assume but pretend. We "pay" for the decision to measure variability off the sample mean _as if_ it were the population mean, for we need to infer about the population variability.
Comment: (cont.) This "fee" (n-1 denominator) makes the variability wider, incorporating the oscillation of sample means within the variance, but it makes such variance an unbiased estimator.
Answer: $N$ is the population size and $n$ is the sample size.  The question asks why the population variance is the mean squared deviation from the mean rather than $(N-1)/N = 1-(1/N)$ times it.  For that matter, why stop there?  Why not multiply the mean squared deviation by $1-2/N$, or $1-17/N$, or $\exp(-1/N)$, for instance?
There actually is a good reason not to.  Any of these figures I just mentioned would serve just fine as a way to quantify a "typical spread" within the population.  However, without prior knowledge of the population size, it would be impossible to use a random sample to find an unbiased estimator of such a figure.  We know that the sample variance, which multiplies the mean squared deviation from the sample mean by $(n-1)/n$, is an unbiased estimator of the usual population variance when sampling with replacement.  (There is no problem with making this correction, because we know $n$!)  The sample variance would therefore be a biased estimator of any multiple of the population variance where that multiple, such as $1-1/N$, is not exactly known beforehand.
This problem of some unknown amount of bias would propagate to all statistical tests that use the sample variance, including t-tests and F-tests.  In effect, dividing by anything other than $N$ in the population variance formula would require us to change all statistical tabulations of t-statistics and F-statistics (and many other tables as well), but the adjustment would depend on the population size.  Nobody wants to have to make tables for every possible $N$!  Especially when it's not necessary.
As a practical matter, when $N$ is small enough that using $N-1$ instead of $N$ in formulas makes a difference, you usually do know the population size (or can guess it accurately) and you would likely resort to much more substantial small-population corrections when working with random samples (without replacement) from the population.  In all other cases, who cares?  The difference doesn't matter.  For these reasons, guided by pedagogical considerations (namely, of focusing on details that matter and glossing over details that don't), some excellent introductory statistics texts don't even bother to teach the difference: they simply provide a single variance formula (divide by $N$ or $n$ as the case may be).
Answer: There has, in the past been an argument that you should use N for a non-inferential variance but I wouldn't recommended that anymore.  You should always use N-1.  As sample size decreases N-1 is a pretty good correction for the fact that the sample variance gets lower (you're just more likely to sample near the peak of the distribution---see figure).  If sample size is really big then it doesn't matter any meaningful amount.
An alternative explanation is that the population is a theoretical construct that's impossible to achieve.  Therefore, always use N-1 because whatever you're doing you're, at best, estimating the population variance.
Also, you're going to be seeing N-1 for variance estimates from here on in.  You'll likely not ever encounter this issue... except on a test when your teacher might ask you to make a distinction between an inferential and non-inferential variance measure.  In that case don't use whuber's answer or mine, refer to ttnphns's answer.

Note, in this figure the variance should be close to 1.  Look how much it varies with sample size when you use N to estimate the variance. (this is the "bias" referred to elswhere)
Comment: @ilhan Please, consider updating your question (as you did) and point to the updated version rather than leaving such non-constructive comments. Everything is debatable, especially when the question itself lacks some context. Here it seems that the problem stands from defining what a population really is.
Comment: Please, tell me why N "not recommended anymore" with true population at hand? Population is not always a theoretical construct. Sometimes your sample is a bona fide population for you.
Comment: ilhan, N can be used for your sample, or it can be used for the population size, if one exists.  In most cases the distinction between big N and small n is dependent upon the topic.  For example, n might be the number of cases in each condition in an experiment while N might be the number for the experiment.  They're both samples.  There is no global rule.
Comment: ttnphns, it depends on what you mean by population.  I would argue that if your whole population is so small that N-1 matters then it's questionable whether calculating a mean squared deviation is remotely useful at all.  Show all the values, their shape and range.  Furthermore, the whole old argument that you actually have N degrees of freedom if you're not making an inference is questionable.  You lost one when you calculated the mean, that you needed to calculate the variance.
Comment: @John, if you calculate mean within population you just _state_ the fact about the parameter, so you spend no degrees of freedom. If you calculate it in sample and want to _infer_ about the population, then you do spend one. Also, I can have population with N=1. With denominator N-1, it appeares that such parameter as variance does not _exist_ for it. It is nonsense.
Comment: @John, can you please remove everything related with "estimation", "estimating", and "sample"? The question is about population itself. No estimation, no sampling, no samples. And please use "n" when referring to sample size. "N" is used for population size. Correct me if I'm wrong.
Comment: I'm not saying there isn't an argument.  I'm just saying it's questionable.  Even the student's textbook basically says, forget I said anything about using N.  It's probably the best advice at this point.  And you're right, if the population N=1 there is NO variance parameter that exists for it because it has no variability.  Your example proves against your point, not for it.
Comment: _Zero_ variability and _inapplicability_ of concept of variability are different things, John. In fact, with N=1 population does have variability, it is zero.
Answer: Generally, when one has only a fraction of the population, i.e. a sample, you should divide by n-1. There is a good reason to do so, we know that the sample variance, which multiplies the mean squared deviation from the sample mean by (n−1)/n, is an unbiased estimator of the population variance.
You can find a proof that the estimator of the sample variance is unbiased here: https://economictheoryblog.com/2012/06/28/latexlatexs2/
Further, if one were to apply the estimator of the population variance, that is the version of the variance estimator that divides by n, on a sample of instead of the population, the obtained estimate would biased.
Comment: This seems to answer a different question concerning estimating the population variance. It looks circular: isn't this answer predicated on assuming a specific convention for defining the population variance in the first place?
Answer: The population variance is the sum of the squared deviations of all of the values in the population divided by the number of values in the population. When we are estimating the variance of a population from a sample, though, we encounter the problem that the deviations of the sample values from the mean of the sample are, on average, a little less than the deviations of those sample values from the (unknown) true population mean. That results in a variance calculated from the sample being a little less than the true population variance. Using an n-1 divisor instead of n corrects for that underestimation.
Comment: @ Bunnenburg, If you got answer to your question. Please clear to me now, what you got? It is a big confusion to me as well.
Comment: to compensate for that _little less_ variance we get, why can't one use n-2, n-3, etc.? why n-1 in particular? why not a constant...???
Comment: @SaravanabalagiRamachandran The discrepancy varies with the sample size and so a constant will not serve. The correction using n-1 is closer works better than the others you mention.


systemd screen lock with fingerprint on wake

Question: 5.18.9-arch1-1
Fingerprint sensor: 27c6:63ac Shenzhen Goodix Technology Co.,Ltd. Goodix USB2.0 MISC
I created a systemd service that runs a bash script when the system wakes from hibernate:
[Unit]
Description=User resume actions
After=hibernate.target

[Service]
User=marc
Type=forking
Environment=DISPLAY=:0
ExecStart=/usr/bin/lock.sh

[Install]
WantedBy=hibernate.target

Here is lock.sh:
#!/bin/bash

thisPid=$$
xsecurelock &
lock=$!

# loop until $lock is gone, or fingerprint is verified
until ! kill -0 $lock || fprintd-verify; do
    echo "FAILURE"
done

#kill the pid for the lock and thisPid
kill $lock
kill $thisPid

This script spawns xsecurelock and captures its pid. It then runs fprintd-verify and blocks until a fingerprint is successfully read. The script then kills xsecurelock and itself, which is redundant, I know.
The systemd service works fine. After waking, xsecurelock spawns, but I am unable to kill it with my fingerprint.
Note that lock.sh runs perfectly if I manually execute it. xsecurelock opens and I am able to kill it with my fingerprint. However, when I wake the screen (triggering the systemd file which triggers lock.sh), the screen locks with xsecurelock and I can type my password to unlock it, but fprintd-verify fails. The systemctl status is:
Jul 07 12:33:49 manray lock.sh[6630]: failed to claim device: GDBus.Error:net.reactivated.Fprint.Error.PermissionDenied: Not Authorized: ne>
Jul 07 12:33:49 manray lock.sh[4760]: FAILURE
Jul 07 12:33:49 manray lock.sh[6634]: Using device /net/reactivated/Fprint/Device/0
Jul 07 12:33:49 manray lock.sh[6634]: failed to claim device: GDBus.Error:net.reactivated.Fprint.Error.PermissionDenied: Not Authorized: ne>
Jul 07 12:33:49 manray lock.sh[4760]: FAILURE

How can I get fprintd-verify to claim the device.
EDIT:
systemctl status when I set the user to root:
Jul 07 13:14:43 manray systemd[1]: Starting User resume actions...
Jul 07 13:14:43 manray lock.sh[25997]: Authorization required, but no authorization protocol specified
Jul 07 13:14:43 manray lock.sh[25997]: 2022-07-07T17:14:43Z 25997 xsecurelock: Could not connect to $DISPLAY.
Jul 07 13:14:44 manray lock.sh[25998]: Using device /net/reactivated/Fprint/Device/0
Jul 07 13:14:44 manray lock.sh[25998]: ListEnrolledFingers failed: GDBus.Error:net.reactivated.Fprint.Error.NoEnrolledPrints: Failed to dis>
Jul 07 13:14:44 manray lock.sh[25996]: FAILURE

When running as root, xsecurelock can't detect the display and the fingerprint sensor still does not work. It appears that there are no enrolled fingers for root and I am unable to add any.
Answer: The solution was to add a new rule at /usr/share/polkit-1/rules.d/50-net.reactivated.fprint.device.verify.rules:
polkit.addRule(function (action, subject) {
  if (action.id == "net.reactivated.fprint.device.verify") {
    return polkit.Result.YES
  }
})

This rule always allows fprintd-verify to run, reguardless of polkit authentication (I think).
I don't like this solution because it (seems) insecure.


dedekind ramanujan identities

Question: I get the following representation using laplace transform the remainder part it dificult to check numerically could you get some numerically result?
Sorry for my bad latex i have correct the formula before
$$\sum _{k=1}^{\infty } \frac{1}{k \left(e^{2 \pi  k x}-1\right)}=\left(-\frac{\pi  x}{12}+\frac{\pi }{12 x}+\frac{\log (x)}{2}\right)-\sum _{n=1}^{\infty } \left(\frac{\pi }{\sqrt{\frac{1}{n^2}} x}+\log \left(\frac{x \left(\pi  n \text{csch}\left(\frac{\pi  n}{x}\right)\right)}{(2 \pi  n) x}\right)\right)$$
you can check that
$$\frac{1}{1-e^{-\frac{2 \pi  n}{x}}}=\frac{1}{2} e^{\frac{\pi  n}{x}} \text{csch}\left(\frac{\pi  n}{x}\right)=\log \left(\frac{1}{2} e^{\frac{\pi  n}{x}} \text{csch}\left(\frac{\pi  n}{x}\right)\right)=\frac{\pi }{\sqrt{\frac{1}{n^2}} x}+\log \left(\frac{x \left(\pi  n \text{csch}\left(\frac{\pi  n}{x}\right)\right)}{(2 \pi  n) x}\right)$$
 Paramanand Singh wa right
Comment: Your first sum on left appears to diverge because the n-th term does not tend to $0$.
Comment: @ParamanandSingh he plays with wolfram and formulas he doesn't understand
Comment: @user1952009: maybe you are right. that's why i never get to see the complete derivation from his side.
Comment: Wolfram can not made the remainder term you need more algebra..anyway thanks for your time
Answer: Let $$q = e^{-\pi / x}$$ and consider the sum
\begin{align}
S &= \sum_{n = 1}^{\infty}\log\left(\frac{2\pi^{2}n^{2}\operatorname{cosech}(\pi n/x)}{x^{2}}\right) - \frac{\pi n}{x}\notag\\
&= \sum_{n = 1}^{\infty}\log\left(\frac{2\pi^{2}n^{2}e^{-\pi n/x}}{x^{2}\sinh(\pi n/x)}\right)\notag\\
&= \sum_{n = 1}^{\infty}\log\left(\frac{4\pi^{2}n^{2}e^{-\pi n/x}}{x^{2}\{e^{\pi n / x} - e^{-\pi n / x}\}}\right)\notag\\
&= \sum_{n = 1}^{\infty}\log\frac{4\pi^{2}n^{2}q^{2n}}{x^{2}(1 - q^{2n})}\notag\\
\end{align}
Now we can see that as $n \to \infty$ we have $n^{2}q^{2n} \to 0$ and hence the $\log$ term tends to $-\infty$ and the series therefore does not converge. Perhaps there is a typo somewhere.
On the other hand the sum of RHS is well defined and is equal to $$\sum_{n = 1}^{\infty}\frac{q^{2n}}{n(1 - q^{2n})} = a(q^{2})$$ and from this post we see that $$a(q^{2}) = -\frac{\log(kk')}{6} - \frac{\log 2}{6} - \frac{1}{2}\log\left(\frac{K}{\pi}\right) - \frac{\pi K'}{12K}$$ Note that $\pi K'/K = -\log q = \pi/x$ and hence we get the term $-\pi/12x$ on LHS.
Note further that if $q' = e^{-\pi x}$ then $$a(q'^{2}) = -\frac{\log(kk')}{6} - \frac{\log 2}{6} - \frac{1}{2}\log\left(\frac{K'}{\pi}\right) - \frac{\pi K}{12K'}$$ and on subtraction we see that $$a(q^{2}) - a(q'^{2}) = \frac{1}{2}\log(K'/K) + \frac{\pi K}{12K'} - \frac{\pi K'}{12K} = -\frac{1}{2}\log x - \frac{\pi }{12 x} + \frac{\pi x}{12}$$ So your identity should look like the following $$\boxed{\sum_{n = 1}^{\infty}\frac{1}{n(e^{2\pi n x} - 1)} + \frac{\pi x}{12} - \frac{\pi }{12x} - \frac{1}{2}\log x = \sum_{n = 1}^{\infty}\frac{1}{n(e^{2\pi n/x} - 1)}}$$ and thus you need to replace the sum $$S = \sum_{n = 1}^{\infty}\log\left(\frac{2\pi^{2}n^{2}\operatorname{cosech}(\pi n/x)}{x^{2}}\right) - \frac{\pi n}{x}$$ with $$S = \sum_{n = 1}^{\infty}\frac{1}{n(e^{2\pi n x} - 1)}$$
Comment: @antonioasis: It would be nice if you could also show how you arrived at such log sums. If the work is too lengthy to type in $\mathrm\LaTeX$ here then you can perhaps give a link to some online (scanned) copy of your work.
Comment: Thanks Paramanand great work , i have correct the initial question( i made a mistake as you seen ) i realice that the serie do not converge but the calculate  it is ok the sum of log it must be a certenly anality continuation ..
Comment: @antonioasis: please see my updated answer. I don't think your sum with $\log$ is correct because it diverges.
Comment: ok thanks i try to review the calculation

dedekind ramanujan identities


Figure numbering removing section LyX

Question: Figures are labeled as 1.0.1 but as I am only using "Parts" and do not have "chapters" or"sections" i would like them to be 1.1, 1.2 and so on.
Comment: Further more they should be labeled with the parts... 2.1 2.2 and so on
Comment: What document class are you using?
Comment: Please post a Minimal Working Example so people can understand your setup.
Comment: It is a report (KOMA - Script). I've added "\setcounter{chapter}{1}" to get the numbers to start at one and not zero. I am using parts and unnumbered sections but not chapters. There are 3 parts in the document, each with (say) 3 figures. The figures are labeled 1.0.1 to 1.0.9 where I would like them to be as follows: 1.1, 1.2, 1.3, 2.1, 2.2, 2.3, 3.1, 3.2, 3.3 Thanks!
Answer: Add to your Document > Settings... > LaTeX Preamble the following code:
\makeatletter
\@addtoreset{figure}{part}% Reset figure numbering at every part
\makeatother
\renewcommand{\thefigure}{\arabic{part}.\arabic{figure}}% Figure number is part.figure

The default numbering of parts in KOMA-Script is Roman, so I've used \arabic{part} since. However, if you've updated this somehow to be Roman elsewhere, you could just use \thepart.\arabic{figure}.
Comment: This is so close. The only problem now is that there is an extra period following the number. So it reads "1.1." which would be fine except there is an additional colon following it so it looks funny (1.1.:). Thanks!
Comment: @user48857: You may wish to add `\renewcommand*{\figureformat}{\figurename~\thefigure}` to your LaTeX Preamble as well. This redefinition removes the default `\autodot` that follows `\thefigure`. Depending on your preference, you may not like the inconsistency between how the figure number is displayed in the actual float compared to the LoF, for example.
Answer: If what you want is to have figures numbered not following sectionning ! fig1 fig2 fig3!
And what you are getting is fig 0.1, fig 0.2 ...
Then what you need to do is to make sure the Number figures by section is not used in document > settings > modules!
And too use document class article (standard).
(on document > settings > document class)
The numbering will turn nice! Continous without sectionning!

Figure numbering removing section LyX


make two sets of eigenvectors orthogonal

Question: Suppose that $v_1,v_2,v_3$ are orthogonal eigenvectors of $A$ and $u_1,u_2$ are orthogonal eigenvectors of $B$. Is there any way to choose $v_1,v_2,v_3$ and $u_1,u_2$ such that $v_1,v_2,v_3,u_1,u_2$ are orthogonal eigenvectors?
Comment: Is $A$ symmetric? Do $v_1,v_2,v_3$ span the same eigenspace? If so, Gram-Schmidt.
Comment: Is there any other information about $A$ and $B$? Clearly if $A$ and $B$ are both tranformations $\mathbb R^3 \to \mathbb R^3$ then the answer is no.
Comment: I forgot to mention, yes $A,B$ are symmetric. Let's say that $A,B$ are 10x10 and $v_1,v_2,v_3$ correspond to 3 different eigenvalues of $A$ while $u_1,u_2$ correspond to 2 different eigenvalues of $B$.
Answer: Without any further information on $A$ and $B$, I'd say that this isn't possible in general. In particular when the dimension of the eigenspaces is one (for each of the 3 eigenvectors of $A$ and $B$). One easy example to see this is considering a 10x10 matrix $A$ with 10 distinct eigenvalues and taking $B=2A$, and taking the eigenvectors corresponing to the 3 largest eigenvalues of $A$ and the 2 largest eigenvalues of $B$.


Short for "time period in life" like teenage

Question: I am looking for a word to describe a time period in life, like teenage, but that would work for any time period, like 11 – 22. I want to say it is xxxxxx in everyone's life.
Comment: Age (e.g.it is that age). Suggest: Can you edit your question to be a little more specific? As in can you give reference to context where you are trying to use this word?
Answer: Consider "life stage" or "stage of life" as common expressions that work for all periods of life.

stage: a distinct period of development, growth, or progress.
Answer: Seasons of life to refer to different periods trough which life has changed.
Answer: There are many specific intra-vitam stages from young to old: adolescence or the the time period between the beginning of puberty and adulthood to presenium or The period of life preceding old age.
Answer: In some  situations "age group" would fit.


IOS WebAudio only works on headphones

Question: I've been running into an issue now for a while where on some ios devices my webaudio system only seems to work with headphones where as other devices (exact same os, model, etc) the audio plays perfectly fine through the speakers or headphones. I've searched for a solution to this but haven't found anything on this exact issue. The only thing I can think of is that maybe it's an audio channel issue or something.
How can I fix this?
Comment: This. Is. Incredible. I've been trying to figure out why I wasn't hearing anything from one of my webapps on an iPad from our QA lab - from the web inspector I saw that everything was being correctly init'ed from a touch event and that everything was loading.  I read your post, plugged in headphones and went into shock. I can only recreate this on an iPad3 (retina) running iOS 7.0.4, and the webapp in question is using CreateJS/SoundJS.  The odd thing is - going to http://webaudioapi.com/samples/, playing some samples, and returning to my webapp fixed the sound... until I cleared the cache.
Comment: I did read something about it possibly being a headphone jack issue, however I've seen this on brand new devices and have seen it work fine on old / heavily used devices as well. I've also tried toggling mute..no difference.
Comment: Okay, it turns out that the side slider switch was set to control mute and it was muted.  But that doesn't explain why the sounds began playing after switching sites, since I didn't even realize that the switch existed until just now. Even now I can get web audio sound to play once started while switch-unmuted and then changing to switch-muted.
Comment: Yeah this definitely caused me some headaches. I honestly can't even remember now if we resolved it or not, but I do remember adding the gain node which I think I remember it helping with the issue.
Comment: Could it have something to do with the fact that Web Audio is muted until the user taps the screen? See http://paulbakaus.com/tutorials/html5/web-audio-on-ios/
Answer: @Alastair is correct, the mute toggle switch does mute WebAudio, but it does not mute HTML5  tags. Thanks to his work I managed to find a work around for the web which enables WebAudio to play even when the mute toggle switch is on. I'd post this as a comment on his reply, but I don't have the reputation.
In order to play WebAudio you must also play at least one WebAudio sound source node and one HTML5  tag during a user action. It is fine if these sounds are short bits of silence. I found that this self contained code works without any extra files needed:
EDIT 11/29/19:
Removed vestigial typescript typedefs. Thanks @Joep. I also realized the code below is woefully out of date and janky. Just consider it an example. Editing this post prompted me to create an open source solution for this. You can see a demo of it here: https://spencer-evans.com/share/github/unmute/ and check out the repo here: https://github.com/swevans/unmute
/**
 * PLEASE DONT USE THIS AS IT IS, THIS IS JUST EXAMPLE CODE.
 * If you want a drop in solution I have a script on git hub
 * Demo:
 * @see https://spencer-evans.com/share/github/unmute/
 * Github Repo:
 * @see https://github.com/swevans/unmute
 */
var isWebAudioUnlocked = false;
var isHTMLAudioUnlocked = false;

function unlock() {
    if (isWebAudioUnlocked  && isHTMLAudioUnlocked) return;

    // Unlock WebAudio - create short silent buffer and play it
    // This will allow us to play web audio at any time in the app
    var buffer = myContext.createBuffer(1, 1, 22050); // 1/10th of a second of silence
    var source = myContext.createBufferSource();
    source.buffer = buffer;
    source.connect(myContext.destination);
    source.onended = function()
    {
        console.log("WebAudio unlocked!");
        isWebAudioUnlocked = true;
        if (isWebAudioUnlocked && isHTMLAudioUnlocked)
        {
            console.log("WebAudio unlocked and playable w/ mute toggled on!");
            window.removeEventListener("mousedown", unlock);
        }
    };
    source.start();

    // Unlock HTML5 Audio - load a data url of short silence and play it
    // This will allow us to play web audio when the mute toggle is on
    var silenceDataURL = "data:audio/mp3;base64,//MkxAAHiAICWABElBeKPL/RANb2w+yiT1g/gTok//lP/W/l3h8QO/OCdCqCW2Cw//MkxAQHkAIWUAhEmAQXWUOFW2dxPu//9mr60ElY5sseQ+xxesmHKtZr7bsqqX2L//MkxAgFwAYiQAhEAC2hq22d3///9FTV6tA36JdgBJoOGgc+7qvqej5Zu7/7uI9l//MkxBQHAAYi8AhEAO193vt9KGOq+6qcT7hhfN5FTInmwk8RkqKImTM55pRQHQSq//MkxBsGkgoIAABHhTACIJLf99nVI///yuW1uBqWfEu7CgNPWGpUadBmZ////4sL//MkxCMHMAH9iABEmAsKioqKigsLCwtVTEFNRTMuOTkuNVVVVVVVVVVVVVVVVVVV//MkxCkECAUYCAAAAFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV";
    var tag = document.createElement("audio");
    tag.controls = false;
    tag.preload = "auto";
    tag.loop = false;
    tag.src = silenceDataURL;
    tag.onended = function()
    {
        console.log("HTMLAudio unlocked!");
        isHTMLAudioUnlocked = true;
        if (isWebAudioUnlocked && isHTMLAudioUnlocked)
        {
            console.log("WebAudio unlocked and playable w/ mute toggled on!");
            window.removeEventListener("mousedown", unlock);
        }
    };
    var p = tag.play();
    if (p) p.then(function(){console.log("play success")}, function(reason){console.log("play failed", reason)});
}

window.addEventListener("mousedown", unlock);

Comment: It is disgusting that this is possible or necessary. Thank you for sharing this awful thing.
Comment: The solution works, but Safari's console says "Unhandled Promise Rejection: NotAllowedError: The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission."

I guess adding an error listener could solve that, any idea how?
Comment: @kslstn I believe chrome and safari are now requiring that promises returned from .play() have resolution handlers. Not all browsers support promises. You have to check if one was returned and can't really count on them being supported consistently or behaving consistently. That said, the promise is most likely being rejected because unlock is being called outside of a user interaction handler. I updated the code to suppress those promise errors.
Comment: I am loading this script as unmute.js into my website and I get following error in the console: SyntaxError: unexpected token: ':' unmute.js:27:22
Comment: @Joep Thanks for pointing that out. It was some typescript code I accidentally left in. I updated the post and created an open source solution for you. LMK if you have any trouble with it.
Comment: Thanks a lot! I will test the unmute.min.js asap and let you know if it worked out for me!
Comment: It does help in the silent mode and it doesn't with background tabs or locked iPhone (iPhone 15 Pro, iOS 17.2.1). Probably they fixed/changed something. Anyway, upvoting because it makes better than it was!
Answer: This is likely because the iPhone's side switch is on "mute". It's very confusing - HTML5 <audio> tags still play fine when the phone is muted, but WebAudio does not. Why? Who knows. But it's a restriction I currently haven't found a way around.
Comment: Yes, on my web app using soundmanager2, I found that the iPhone's side switch on mute was causing sound to not play through speakers. Thank you!
Comment: There is a solution, please see my answer.
Answer: If the iPhone mute button is down, meaning that the iPhone is muted, what is played through Web Audio Api will be muted.
Unfortunately there is no way to check if that physical button (located on the left edge towards the top of the iPhone) is on or off through Javascript.
This issue is completely independent from the fact that in iOS Safari the audio has to be started by a user action for it to be unmuted. There are some tricks that can be done to overcome that fact,  including the one suggested by here Spencer, were you use "any action or a specific action" started by the user to "play" a silent audio file to allow subsequently playing audio files to play unmuted.
Comment: actually the solution to getting around the mute button is to play html and web audio at the same time. Resuming on user interaction is just to make sure that audio is "unlocked" all the time.
Answer: had same issue, and finally understood problem.
indeed WebView don't play sound on internal  speakers if phone is in mute.
when i dig deeper i found a workaround :)
original post => https://stackoverflow.com/a/37874619/8064246
do {
    try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayback)
    //print("AVAudioSession Category Playback OK")
    do {
        try AVAudioSession.sharedInstance().setActive(true)
        //print("AVAudioSession is Active")
    } catch _ as NSError {
        //print(error.localizedDescription)
    }
} catch _ as NSError {
    //print(error.localizedDescription)
}

Comment: This is an objective c solution. The poster is asking about web audio.

IOS WebAudio only works on headphones


A question based on complex number

Question: Locate the complex number $z=x+iy\;$ for which $$\log_{\cos(\pi/6)} \frac{|z–2|+5}{4|z–2|–4}<2$$ I tried to solve this problem but is equation of circle and then putting the values but I was not able to proceed further please help me out.
Comment: Are you able to solve this numerically? Because that logarithm looks intimidating
Answer: Since $\cos {\pi\over6}=\frac{\sqrt 3}{2}<1,$ the logarithme is decreasing.
The number $|z-2|$ is the distance between $2$ and $z.$ For simplicity, denote $|z-2|=a \;$ and solve the equivalent inequality * $$\quad \frac{a+5}{4(a-1)}>{\frac 34} \tag 1$$
or $$\frac{2(4-a)}{a-1}>0. \tag 2$$
The solutions are $a \in (1,4)$ or, in terms of $z,$ $$1<|z-2|<4.$$ Convenient points fulfill the open area bounded by two concentric circles with center $z_0=2,$ radii $r=1$ and $R=4, $ respectively.
*Note: It is not necessary to care about the domain of the function, as due to $(1)$ is the logarithme well defined.
Answer: $$\log_{\cos(\pi/6)} \frac{|z–2|+5}{4|z–2|–4}<2$$ so we have
$$ \frac{|z–2|+5}{4|z–2|–4}>\cos^2(\pi/6)$$
so $$ \frac{|z–2|+5}{4|z–2|–4}>{3\over 4}$$ Since the right side is positive then the left side must be also. But denumerator is always positive so numerator must be also, so we have $|z-2|>1$. Now we can also get rid of the fractions and we get: $$|z-2|+5>3|z-2|-3\implies |z-2|<4$$
If we put this together we get $$1<|z-2|<4$$
so $z$ is betwen two concentric circles with radius 1 and 4 and with center at $4$ (this is a point on real axsis).
Comment: We need to expand it further

A question based on complex number


Reference that contains examples of absolutely indecomposable representations of quivers over a finite field

Question: Is there a reference that lists/discusses examples of absolutely indecomposable representations of quivers over a finite field (absolutely indecomposable = does not decompose into a direct sum over the algebraic closure of the finite field, they are important in Kac's conjecture)?
Answer: Two references, neither of which exactly addresses your question, are as follows:
Ringel, Claus Michael
Exceptional modules are tree modules.
Linear Algebra Appl. 275/276 (1998), 471–493.
In this paper, Ringel shows that any exceptional representation can be written with a matrix using only 0's and 1's.  In particular, it can be defined over a finite field.  So this might be kind of the reverse of what you asked, but it does show that there is a nice class of representations over the algebraic closure which descend to representations over the finite field.
The textbook by Deng, Du, Parshall, and Wang, Finite dimensional algebras and quantum groups, develops a considerable amount of the theory of quiver representations over an arbitrary field, and includes material about the behaviour of representations over finite fields and how they split up over the algebraic closure.  I don't remember seeing anything there specifically about absolutely indecomposable representations, but it should be possible to glean useful things.


Show that the only subfields of $\mathbb{Q}(i, \sqrt{5})$ is $\mathbb{Q}, \mathbb{Q}(i),\mathbb{Q}(\sqrt{5}), \mathbb{Q}(i \sqrt{5})$ and itself?

Question: I'm reading Stewart's Galois Theory and encountered this exercise in Chapter 8. I want to show this by contradiction: Assuming there exists a proper subfield $\mathbb{Q}(\alpha)$ of $\mathbb{Q}(i, \sqrt{5})$, then $\alpha = a + bi + c\sqrt{5} + di\sqrt{5}$ for $a,b,c,d \in \mathbb{Q}$ but $\alpha$ cannot be expressed as $a + bi$ or $a + b\sqrt{5}$ solely. Then $\mathbb{Q}(\alpha)$ has to be the $\mathbb{Q}(i, \sqrt{5})$, contradicting it being a proper subfield? I think my argument isn't strong enough so could anyone give me a hint of how to show it more effectively? Also, since this is a chapter where we used a lot of field extension skills, I wonder if there is a way of seeing these field and subfields as towers and field extensions and prove the desired result. Thanks a ton!
Comment: Have you seen the Galois correspondence theorem? If yes, then you just need to determine the Galois group of the extension $\mathbb{Q} \subset \mathbb{Q}(i,\sqrt{5})$. If not, then perhaps you need to show that such an $\alpha$ as you have does not satisfy a quadratic equation over $\mathbb{Q}$. This could get pretty nasty.
Comment: Your reasoning is not bad, however the question is about Galois theory.
Comment: You're missing the subfield  $\mathbb{Q}(i\sqrt{5})$.
Comment: @PrahladVaidyanathan This exercise is indeed following Galois correspondence theorem, but I'm not sure how to apply. Could you give a hint? Thanks!
Answer: I'll give you two different ways to do this as I don't know if you know the main theorem yet but even if you don't you can revisit this once you do learn it.
Method 1:
The simplest method is to use the Fundamental Theorem/ Galois Correspondence Theorem which says the intermediate fields are in bijection with subgroups of the Galois group, which is isomorphic to $C_2 \times C_2$ in this case.
This has $5$ subgroups so we have $5$ intermediate fields which are $\mathbb{Q}$, $\mathbb{Q}(i)$, $\mathbb{Q}(\sqrt{5})$, $\mathbb{Q}(i\sqrt{5})$ and $\mathbb{Q}(i, \sqrt{5})$ which are easily spotted.
Method 2:
If you haven't got that far yet then we can use the tower law instead. Note $[\mathbb{Q}(i,\sqrt{5}):\mathbb{Q}]=4$ so any nontrivial subfield will have degree $2$.
It's a standard result that any quadratic field has the form $\mathbb{Q}(\sqrt{D})$ for some squarefree integer $D$. Using your basis $a+bi+c\sqrt{5} +di\sqrt{5}$, we can see $i=\sqrt{-1}$, $\sqrt{5}$ and $i\sqrt{5}=\sqrt{-5}$ all lie in $\mathbb{Q}(i,\sqrt{5})$ so all give quadratic subfields.
Now suppose $\mathbb{Q}(\sqrt{D})$ was also a subfield. Then$\sqrt{D} \in \mathbb{Q}(i,\sqrt{5})$. This means $\sqrt{D} = a+bi+c\sqrt{5} +di\sqrt{5}$ for some $a,b,c,d$.
Squaring both sides we get $D= (a^2 - b^2 +5c^2 - 5d^2) + (2ab+10cd)i + (2ac-2bd)\sqrt{5} +(2ad+2bc)i\sqrt{5}$.
We are then left with solving the simulataneous equations:
$\begin{eqnarray*}
D &=& a^2 - b^2 +5c^2 - 5d^2, \\
0 &=& 2ab+10cd, \\
0 &=& 2ac-2bd, \\
0 &=& 2ad+2bc,
\end{eqnarray*}$
which then gives you solutions only for $D=-1,5,-5$ (remembering that we only consider squarefree $D$), but this is quite tedious.
Comment: Thank you! I think I understand the flow of the proof now. Two quick questions: how do we know the bijection is isomorphic to $C_2 \times C_2$? And how do we argue that there are only 5 subgroups?
Comment: I meant that the Galois group of $\mathbb{Q}(i,\sqrt{5})/\mathbb{Q}$ was isomorphic to $C_2 \times C_2$ which should be easy enough to prove. As for there being 5 subgroups of $C_2 \times C_2$, you can just count them.
Comment: We clearly have the trivial subgroup and the whole thing so that's two. Any other subgroup must have order 2 by Lagrange's theorem so is cyclic and generated by an element of order 2, and there are 3 of those: $(1,0), (0,1)$ and $(1,1)$.


Why does the MAV tip over, but the astronauts do not?

Question: They were simply walking through the storm. If storm was strong enough to move the MAV, humans who are a lot lighter should've just flown away, no?
Comment: this is from the face book off Andy : Someday, Neil deGrasse Tyson is going to either read "The Martian" or see the film adaptation of it. When he does, he's going to immediately know that the sandstorm part at the beginning isn't accurate to physics. He'll point out that the inertia of a Martian storm isn't enough to do damage to anything.

The knowledge that this is going to happen haunts me.
Comment: I don't have the math to prove it, but I imagine that in such a thin atmosphere surface area makes a big difference in the effective force of the wind.
Comment: Buildings sway in the wind, while people standing on a balcony don't get tossed around.  It's a function of greater surface area and higher center of gravity.
Answer: The Real Answer, as from Andy Weir himself: There isn't. While the book is grounded in science, there are no such storms of record that could create the effects that are shown in the book or movie. It is a large, windy, atmospheric MacGuffin. The storm is solely there to move the crew off the planet, leaving a presumed-dead Mark Watney to a disco-themed purgatory. (I'd link to the Triangulation podcast episode where he talks about that, but don't have access atm. I'm sure he says it elsewhere.)
The in-universe answer: All of the landing sites are in craters, for the sole reason to mitigate impact of wind. The MAV is the highest point of the landing site, it's large enough to be caught by the wind, but with a small enough base to actually be able to be tipped over. That is why there is a decided plan on how to react to windstorms of various magnitudes already in place while they were in the HAB.
Comment: @RobertF: Keep in mind that it needs to force them off while leaving the Hab intact, and also create some event that destroy's Watney's biological monitor.  It also needs the time/immediacy factor, where they're forced to leave without searching for his body.  Additionally, the novel was originally posted in a serial format, and the windstorm event is right at the start.  So by the time the rest got researched, he might have felt he was stuck with it.
Comment: Given how well-researched the novel is, I'm surprised the author couldn't find a better plot device than the dust storm, like a freak volcanic eruption or a collapsing lava tube.
Comment: You would think. I did find that interview - it's Triangulation 163. I'll update this with the time when I can review it
Comment: So basically the real reason is the same as the real reason Mark doesn't enjoy hos *own* entertainment that he would have surely brought along.
Comment: See also the Google Tech Talk video where Andy Weir was the speaker.  Someone asked whether dust particles could help the thin atmosphere push hard enough to be a threat, and Andy Weir said no, Martian dust is like talcum powder.
Answer: Due to ground friction, wind speed close to ground is slower than at higher altitude. That's why wind turbines are so tall. Wind speed at the height of the MAV should be a lot higher, because of that.
Comment: True [wind sensor height](http://www.acurite.com/acurite-sensor-siting) should be 33 feet off the ground to get an accurate reading due to ground effects. That being said the astronauts don't seem to be fighting that hard against the wind in the movie, and the MAV doesn't seem to be as tall as a wind turbine either.
Answer: The MAV had a higher surface area exposed to the storm and therefore was exposed to more force. It may have been top heavy and is less able to correct it's balance against the storm. A human can lean into the wind and shift around to find a balance point.


Is a finite birational morphism a blowup?

Question: Suppose that $C \rightarrow D$ is a finite morphism of projective schemes over an algebraically closed field of characteristic 0.  The morphism is not birational, and $C$ and $D$ are reducible but reduced.  If we take the Galois closure $C' \rightarrow C \rightarrow D$
then $C' \rightarrow C$ is a finite birational morphism of projective schemes.  Is this morphism a blowup?
Comment: If $C\to D$ is the normalisation of a cuspidal curve, what is $C'$? Don't you need some extra hypotheses for this question to make sense?
Comment: Please see my response below.
Comment: Experience shows that this site works best if you make your remarks and clarifications by editing the question (where everyone will see them) rather than as comments to answers. In particular, it's best to ask exactly what you want to ask in the question itself (and clarifying what extra assumptions you are and are not happy to make).
Answer: Liu, Theorem 8.1.24: Let $f: Z \to X$ be a projective birational morphism of integral schemes. Suppose $X$ is quasi-projective over an affine Noetherian scheme. Then $f$ is the blowing-up morphism of $X$ along a closed subscheme.
Comment: In response to the answer given above, what if the varieties are reducible?
Comment: I would check Hartshorne too.  There is some result along the lines of 'any projective morphism is the blow up of some coherent sheaf of ideals'.  I don't remember the conditions on the schemes thought.
Comment: This was meant as an answer to your second question: "If we take the Galois closure $C' \to C \to D$ then $C' \to C$ is a finite birational morphism of projective schemes. Is this morphism a blowup?"


Android Build Error: Attribute Signature requires InnerClasses attribute. Check -keepattributes directive

Question: I'm facing this error when trying to build the app in release mode.

Error: Attribute Signature requires InnerClasses attribute. Check -keepattributes directive

My proguard-rules.pro line looks like this:
-keepattributes Signature

what InnerClasses is the compiler referring to? What am I omitting?
Comment: Can you please have -keepattributes InnerClasses in your proguard config and check.
Comment: @kj007 yeah it worked, I was thinking it referred to some Signatures' inner classes. The way it's written is a bit ambiguous to me
Comment: I have posted my answer.
Comment: I have also added possible reason was not working Signature .
Answer: Signature (Java 8 or higher) works only Java 8 or higher and InnerClasses (Java 5 or higher) so check your Android Studio is using Java SDK version.
Please update your Proguard config with below settings
Add this line to your proguard-rules.pro file:
-keepattributes InnerClasses

InnerClasses (Java 5 or higher)
Specifies the relationship between a class and its inner classes and
  outer classes. Other than this and the naming convention with a '$'
  separator between the names of inner classes and outer classes, inner
  classes are just like ordinary classes. Compilers may need this
  information to find classes referenced in a compiled library. Code may
  access this information by reflection, for instance to derive the
  simple name of the class.
Signature (Java 8 or higher)
Specifies the generic signature of the class, field, or method.
  Compilers may need this information to properly compile classes that
  use generic types from compiled libraries. Code may access this
  signature by reflection.

More details about -keepattributes and more settings you can apply, please see below link.
Proguard options
Comment: Took me a life to find this soloution
Answer: Ref : https://stuff.mit.edu/afs/sipb/project/android/sdk/android-sdk-linux/tools/proguard/docs/index.html#manual/usage.html

keepattributes [attribute_filter]
Specifies any optional attributes to be preserved. The attributes can
  be specified with one or more -keepattributes directives. The optional
  filter is a comma-separated list of attribute names. Attribute names
  can contain ?, *, and ** wildcards, and they can be preceded by the !
  negator. Typical optional attributes are Exceptions, Signature,
  Deprecated, SourceFile, SourceDir, LineNumberTable,
  LocalVariableTable, LocalVariableTypeTable, Synthetic,
  EnclosingMethod, RuntimeVisibleAnnotations,
  RuntimeInvisibleAnnotations, RuntimeVisibleParameterAnnotations,
  RuntimeInvisibleParameterAnnotations, and AnnotationDefault. The
  InnerClasses attribute name can be specified as well, referring to the
  source name part of this attribute. For example, you should at least
  keep the Exceptions, InnerClasses, and Signature attributes when
  processing a library. You should also keep the SourceFile and
  LineNumberTable attributes for producing useful obfuscated stack
  traces. Finally, you may want to keep annotations if your code depends
  on them. Only applicable when obfuscating.

Add This Line in proguard-rules.pro File
-keepattributes InnerClasses

More Details Found From https://stuff.mit.edu/afs/sipb/project/android/sdk/android-sdk-linux/tools/proguard/docs/index.html#manual/usage.html


Sharepoint search not giving results and error message

Question: My Client upgraded their SharePoint from 2013 to 2016 and from a standalone server to a 2-tier environment. (1 x DB server + 1 x App/Web server)
The Search did work for a while, but now it stopped working.  It does the index and crawling, but when searching there is no results. The crawl log shows 72k errors, much more than the 1k Successes.
In the 'Crawled Properties' and managed Properties windows, it does not show any managed property entry and only has 'An unknown error occurred' in red at the top of the screen.
Opening 'Launch query builder' also gives: Error: Not able to connect to search service to retrieve valid settings'.
Can I delete the Search Service Application and rebuild it?
Answer: Take the back up of all search service application databases -  mostly 3 to 4 database will be there, you will get these details from the search service administration page of central admin... then click on the index reset link from the crawling section. Then, restart the search service from Windows service and run the full crawl.
If it still does not fix the issue, you may re-create the service application.
Using the below PowerShell also search service can be reset:
<code>(Get-SPEnterpriseSearchServiceApplication).reset($true, $true)
</code>
For details steps, you may refer to the below article:
Reset Search Index in SharePoint 2013 using Powershell
Comment: Before going for recreation try with reset index, followed by the restart the search service and full crawl if doesn't work this... you can go with recreating the search service application.. but in that case need to take necessary backup of all databases... mostly SA databases and MMS database.
Comment: Thank you Habibur. Should I go with the option to recreate the Search Service application, will it affect my current managed metadata?
Comment: Thanks, I did an Index reset and full crawl but without restarting the search service.  Will try that and if not working, I'll do the recreating of ssa.
Answer: You could go to search administration page to check the status of six search components and whether any error message in the page. In addition, you could check ULS logs for more details about error. Investigating logs will help to understand the problem.
Of course you could choose delete the Search Service Application then rebuild it.
Comment: Thank you Emily.  If I delete the SSA, will it affect my managed metadata?
Answer: I've deleted the current Search Service Application (made sure the app pool is also deleted) and recreated the SSA.  Everything is working as it should.
The error I got when opening 'Launch query builder' also gives: Error: Not able to connect to search service to retrieve valid settings' - it pointed to the previous server, that is why it gave an error message.


Strange and layer shifts in X axis prints

Question: This problem started technically just before a major move but I had hoped it was a "one off" issue... I started up my trusty Ender 3 today to find it may have actually gotten worse and I'm not entirely sure what the solution is. I was printing a replica of a weapon from a game and I noticed at one point through the print I had a rather extreme X layer shift now today after finally getting the printer setup I've come to find the problem may have actually gotten worse, additionally I'm having a strange gap issue on the top most layers of my prints and strange waving patterns. Now I should note my printer is printing within an enclosure and its temperatures have been adjusted for it but this is rather extreme.
Comment: Can you please check your belt tightness, and that all your frame bolts are secure.  I'd suspect the X belt, presuming that's the "bow to stern" axis as opposed to the port/starboard belt.
Comment: belt is fully tightened and bolts seem to be secure I may need to double check the bolts though
Answer: As others have said, shifts in the X-axis are generally from belts at the wrong tension and loose frame screws. Especially after moving, I would say to check all of the frame screws and retighten them to their original torque. Moving a printer puts a lot of stress on its joints and hardware if it's not handled correctly.
I highly recommend you print a quick X-axis belt tensioner for your printer. It takes no time at all and it did wonders for my Ender 3 when it was having issues with skipping and layer shifting.
Even if your belts feel tight they may not be at the correct tension. This is generally from the belts stretching out over time or the printer just rattling the belt pulleys loose. After printing the belt-tensioner for the  X-axis you'll be able to adjust the tension mid-print if it's still skipping.
Honestly go ahead and print one for the Y-axis at the same time. Both shouldn't take longer than an hour.
X-axis Belt Tensioner for Ender 3
Y-axis Belt Tensioner for Ender 3
If all else fails you can buy a new belt(I'd recommend one with some kind of reinforcements embedded in it) for like $10 on Amazon.
Also, as someone else said - it could be a connection short between your computer and printer If you're printing straight from the USB cable. I've had a ton of trouble with that in the past which is why with the nurse three I decided to just put all of my prints on the SD card and start them from the screen on the printer, it saves on the headaches and you can at least rule out your PC and the Printing software as the culprits.
Good Luck!!
Answer: Some things that can cause this.

You eliminated the belt.

The extruder colliding with something rigid enough to cause it to lose track of the origin.

What seems most likely is intermittent power to your x-motor, so that the computer continues as if the motor moved when it didn't completely.  This is a possible intermittent at different locations accociated with the motor.

I've seen a power glitch cause a single offset in print when the computer has battery backup, but the printer does not.
Comment: hmmm this could be a solution I havent noticed any power fluctuation but I actually have a battery backup thats been sitting aside I could attempt to run with the printer if its within its specs. I'll have to try that!
Comment: It looks like  you had multiple small shifts and one big one.  It they are all on the x-axis, I would suspect an intermittent connection related to the power to the x-axis motor only; probably not ac power.  If you see x-axis and y-axis shifts, it may be due to ac power.


Velocity value in a pipe junction when we're applying the energy equation

Question: I'm trying to understand how to apply the energy equation at a junction of 3 pipes. For example, when we are considering points A and D, should we consider that velocity at point D just before the fluid entres the junction (that is, there are 3 different values for V_D, one for each branch? Or it should be zero, as the sum of flow rates is zero?
The energy should be almost the same inside the junction and at the end / begining of the branches (around point D).
I know i can apply it between A and B, etc., but I would like to know how to apply it for point D.
Comment: why do you want this?  Apply a pressure drop for the junction and go back to straight pipe losses.  The velocity at the Y isn't important, use empirical methods.  The reality is that you won't have uniform flow in that area.
Answer: Velocity at $D$ should definitely not be zero, because you would have to apply the same logic to other points, which would mean zero velocity everywhere. The energy equation does not use local velocity, but mean velocity through a section. So "velocity at $D$" depends on which section you consider there.
A simplified version of the problem dealing just with a section change would be a straight pipe with abrupt change of section in the middle. In such case you could also ask what is the velocity at the middle. I think it is more clear in that case, that while local velocities might be very diverse, mean velocity will change just as abruptly as the section.
Also a more general point regarding energy equations is that you only need to consider conditions at some (boundary) points to be able to use them (and avoid hard to describe conditions at internal points). In your case, you would have input at $A$ and two outputs at $B$ and $C$. For these, the energy equation will describe the relation between velocities, sections, elevations and pressures. There is no point in considering point $D$ in the equation (or any other "internal" point of the system). Very simple example of this is change of potential energy of an object due to change of its elevation. Only important information is start and end elevation (boundary points), no one cares if took the object using elevator or crane, or if you first went 20 m down and 25 meters up.