Making Sense of Differences Between Durbin-Watson Test, ACF, and auto.arima

Question: Trying to make sense of my results. I'm trying to assess if an intervention had an effect on infection rates using an interrupted time series design. I have monthly data on infection rates for approximately 4 years.
I developed a simple segmented regression design, and following advice from articles I've read like this one. I ran a Durbin-Watson test on the residuals from my model (with infection as the dependent and time as independent), and, lo and behold, the test statistic = 1.24 and p = 0.001.
I went ahead with trying to select an ARIMA model. When mapping the ACF, I see the following:

I took a look at the output from auto.arima from the forecast package, which suggested a regression with ARIMA(0,0,0) errors, which I understand would be the same thing as my initial linear regression. The AIC of the (0,0,0) and the (1,0,0) are extremely similar (within .01 of each other) but I'm not sure that the difference is meaningful.
My question is, what do I make of the suggestion of AR(1) from the DW test in light of no other evidence of autocorrelation? Am I missing / violating some assumption of the DW test that renders it unusable in this situation? I'd like to use the simpler model for the benefit of my audience if possible, but I'd like my conclusions to be as strong as possible.
I'm a final year student in a medicine program, please forgive me if I've missed some introductory concept here.
I also included a plot of the residuals from the linear model. I see what looks like a strong negative correlation from index 20 - 25. That's not related temporally to my intervention, I was wondering if this is what's driving the positive DW test.
Answer: Durbin Watson is a very old test and there are much better ones now, if more complex. It only test for AR 1 although in this case it probably did not matter since at most you have AR1. You might want to try some of the the newer test to confirm what the DW is saying, however. One thing that is strange to me is that you are testing segmented regression/interrupted time series so you assume the pattern changed over time, after the intervention. Yet the ARIMA model you generated shows stationarity. Which suggests nothing changed. Did your raw data suggest a change at all after the intervention? If the pattern of data remained essentially unchanged over time I am not certain why you ran segmented regression or interrupted time series.
It is possible I don't understand what you were testing. :) I assume it is some type of data over time which you think changed its pattern at some point. The (0,0,0) model does not suggest that to me.


What is the use of #if in C#?

Question: I need to know the usage of #if in C#...Thanks..
Answer: #if is a pre-processor command.
It's most common usage (which some might say is an abuse) is to have code that only compiles in debug mode:
#if DEBUG
    Console.WriteLine("Here");
#endif

One very good use (as StingyJack points out) is to allow easy debugging of a Windows Service:
static void Main()
{
#if (!DEBUG)
    System.ServiceProcess.ServiceBase[] ServicesToRun;
    ServicesToRun = new System.ServiceProcess.ServiceBase[] { new Service1() };
    System.ServiceProcess.ServiceBase.Run(ServicesToRun);
#else
    // Debug code: this allows the process to run as a non-service.

    // It will kick off the service start point, but never kill it.

    // Shut down the debugger to exit

    Service1 service = new Service1();
    service.<YourServicesPrimaryMethodHere>();
    // Put a breakpoint on the following line to always catch
    // your service when it has finished its work
    System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite);
#endif
}

Source
This means that running release mode will start the service as expected, while running in debug mode will allow you to actually debug the code.
Comment: Best use of #if that I have seen.... http://www.codeproject.com/KB/dotnet/DebugWinServices.aspx
Answer: "When the C# compiler encounters an #if directive, followed eventually by an #endif directive, it will compile the code between the directives only if the specified symbol is defined"
Here's the MSDN link.
Answer: #if has lost so much compared to its ancestors -- c or C++. nowadays I use #if for only two scenarios
1) use it to enable code for debug or not debug
#if DEBUG
    // code inside this block will run in debug mode.
#endif

2) use it to quickly turn off code
#if false
     // all the code inside here are turned off..
#endi

Answer: #if (C# Reference) is a compiler directive. See the MSDN article for more info.
Answer: It is used for Preprocessor Directives, see here http://msdn.microsoft.com/en-us/library/4y6tbswk(v=VS.71).aspx
Answer: #if is a compiler directive, for example you can #define test
and later in the code you may test #ifdef test
compile code block with #ifdef

What is the use of #if in C#?


Taking constant out of multivariate normal

Question: For a univariate normal distribution $X \sim N(0, k\sigma^2)$ we can take out the $k$ to get $\sqrt{k}X \sim N(0, \sigma^2)$. In the multivariate normal case is there something similar? If $\textbf{Y} \sim N(\textbf{0}, \textbf{C}\sigma^2)$, can I say that $\textbf{C}^{\frac{1}{2}}\textbf{Y} \sim N(\textbf{0}, \sigma^2)$? If yes, how do I prove it?
Answer: You have some errors: Actually $\frac{1}{\sqrt{k}}X\sim N(0,\sigma^2)$, which corresponds to $\textbf{C}^{-1/2}Y\sim N(0,\sigma^2\textbf{I})$. In MV normal RVs, it's well known that $Y=PX$ yields $Y\sim N(P\mu_x,PC_xP^T)$; you can look here for its proof.
So, here, $\mathbf{C}^{-1/2}\mathbf{Y}\sim N(\mathbf{0},\mathbf{C^{-1/2}C}\sigma^2\mathbf{C^{-T/2}})$, where $\mathbf{C}^{-1/2}=\mathbf{C}^{-T/2}$ and $\mathbf{C^{-1/2}CC^{-1/2}}=\mathbf{I}$, assuming that $\mathbf{C}$ was invertible, in which it might not be. And, recall that it is already symmetric, since $\mathbf{C}\sigma^2$ is the covariance matrix of $\mathbf{Y}$.
Note: $\mathbf{C^{-1/2}}$ can be calculated via diagonalization if applicable.
Answer: Actually, for the multivariate case, given a random variable $X \sim N(\mu,\Sigma )$, the linearity property of the normal distribution says that if you multiply $X$ by a $p\times p$ matrix $B$ then $BX \sim N(B\mu,B\Sigma B')$.
For a proof, check the second theorem in this note.


A modified divisor game

Question: Consider a two player game. There are N balls marked 1 to N. A move consists of removing a ball n and all other balls which are divisors of n (including 1). The players alternate the moves. The one who takes the last ball wins the game.
Eg. [1 ,2 ,3 , 4, 5]--[Player 1 (4, 2, 1)]-->[3, 5]--[Player 2 (3)]-->[5]--[Player 1 (5)]-->[]. Player 1 wins. The () contains the balls a player removes.
I tried solving the problem for N < 10 manually and was able to observe that it was always possible to force victory for player who starts the game. I also know that this is always the case for all N from here. Can someone share the proof of this result and the playing strategy?
I tried to use the strategy stealing argument from the game of chomp but I am not sure if it is applicable here.
Answer: One can indeed prove that the first player has a winning strategy using the classical strategy stealing argument. If the second player had a winning strategy, the first player would just play "1" and then follow the second player's winning strategy. This works since any move by the second player would also remove the number "1", thus the the state of the game after the second player's turn would be a valid state of the game after a single move.
Comment: Well, now I understand that the crux of the strategy stealing is finding a "zero" move which is a subset of any other legal move. Though we can figure out the winning moves with the aid of computer, is it possible to find a general strategy? Is there a mathematical formula as in the case Nim`s game or it`s proven that it can`t be found?
Comment: I did not think about this particular game, but in chomp it is a notable open problem.

A modified divisor game


Simplifying Integral Expression w/ Antiderivative

Question: I'm trying to simplify this formula here. For the most part, evaluating this expression is straightforward. However I am very confused about how to  approach this last term in the expression. I want to simplify this part of the formula and break it down further if possible by coming up with an antiderivative formulation or something similar to make it more understandable, and to be able to evaluate it in terms of its unknowns. It's clearly related to the normal distribution but I'm unsure of how to simplify it in terms of the normal as well. How should I approach this? What would be the best way to evaluate this term?
Answer: Ultimately, it seems like you want a nice expression for integrals of the form
$$ \int_a^b e^{-x^2} dx. \tag{1}$$
You ask for an antiderivative. Unfortunately, no antiderivative of this expression exists in terms of elementary functions.
If you're looking to write it in terms of named special functions, then you might think of $(1)$ as
$$ \int_a^0 e^{-x^2} dx + \int_0^b e^{-x^2}dx$$
and consider integrals of the form
$$ \int_0^b e^{-x^2} dx.$$
By a change of variables, this can be written as
$$ \frac{1}{2} \int_0^{\sqrt{b}} e^{-x} x^{1/2} \frac{dx}{x},$$
which is the lower incomplete Gamma function
$$\frac{1}{2}\gamma(\tfrac{1}{2}, \sqrt b).$$
This comes up frequently, and one can understand it numerically pretty quickly.
Comment: Thank you for your reply. I can see how to simplify the integral in terms of the lower incomplete gamma function as you've shown, but how do I evaluate that integral in terms of the infinite upper bound? How would I apply this transformation to the function above?
Comment: If you have integrals of this shape with infinite upper bounds, then you can either use the upper incomplete Gamma function or the regular Gamma function and subtraction to transform it into a lower incomplete Gamma function.


Can an ICAO contracting state charge money for NOTAMS?

Question: does anyone know of any written icao rules where they state if a contracting state is allowed to charge money for the dissemination of NOTAMS? are products like notams and Local Aeronautical Circular messages supposed to be free for everyone? so that safety can be guaranteed ?
Comment: I don't think there is a specific rule. In the US, NOTAMS are free. So are the majority of FAA documents and information like charts, handbooks, and manuals. If you want those same documents printed, there is usually a charge. If you get the documents from a third party vendor who got the information from the FAA, there can be a charge. And some information requires research on the part of the FAA or others (like aircraft ADs). There may be a charge for that.
Answer: Extract from ICAO Annexe 15 (Aeronautical Information Services):

3.5 Cost recovery

Recommendation.— The overhead cost of collecting and compiling aeronautical information/data should be included in the cost basis for airport and air navigation services charges, as appropriate, in accordance with the principles contained in ICAO's Policies on Charges for Airports and Air Navigation Services (Doc 9082).

Note.— When costs of collection and compilation of aeronautical information/data are recovered through airports and air navigation services charges, the charge to an individual customer for the supply of a particular AIS product, either in paper or electronic form, may be based on the costs of printing paper copies or production of electronic media, and costs of distribution.

NOTAMS are issued gratis (free) as the information can be essential to the safe conduct of flights. The raw NOTAM is available to any member of the public, anywhere in the world online via the country's AIP (Aeronautiical Information Publication/Services) documents which are of a standard format. You'll probably have to register at no cost as a user though.
Click here for the FAA site
A company could charge a fee for processing the info thus obtained so as to tailor the NOTAM list and filter it in a manner suitable for a particular Operator. Or they could put it into a more user friendly format. It maybe noted that briefing areas have (computer) terminals dedicated to this linked to the official NOTAM server, and these terminals can have powerful filtering capabilities already provided by the issueing/distributing authorities.
ICAO lays down that safety related info should disseminated in such a way that there's no undue hindrance for the end user. Think of it this way - could the authority refuse this info to the pilot if it so happens that the subscription was not renewed on time due to any mundane reason?


Where can one get one's philosophy paper edited?

Question: I have some philosophy works that I want to see improved into a more succinct, scholarly text. Where can I get such help (for free if possible)?
Comment: Update: The Academia mods don't want this question, but they referred me to this one currently on their site: http://academia.stackexchange.com/questions/9939/how-to-hire-editor-to-improve-my-paper
Comment: This question appears to be off-topic. This one is better suited for http://academia.stackexchange.com. Could the mods migrate this one?
Comment: What is your work about?
Comment: If they are relatively short (less than 10 pages) and on  topics of interest to me, I'll read them and offer what criticism I can. :)
Comment: There are often writing centers at universities; and just in passing, if you actually like writing philosophy papers, you might consider taking a graduate degree ;)
Answer: Nobody who has the skillset to do what you want is going to do it for free. Professional philosophers and advanced grad students are pretty busy people. Would you ask a medical doctor to help you with your medical article for free? Would you ask a lawyer to help you with your law review article for free?
Comment: Or to put shane's answer another way, there may be people who will read your paper for free, but they are probably not going to be helpful. Anyone capable of moving a paper forward and who isn't your spouse, brother, or uncle, doesn't have the time/interest to revise random papers for the fun of it.
Comment: I thought there might have been a website for this...
Comment: Well, aside from the whole journal refereeing self-exploitation business aka "service to the community" :)
Comment: @DBK -- journals don't do that level of editing for you, and they tend to reject things that are quite poor after a brief reading of the abstract without comment.
Answer: semester is about to start; go join a university course asap and ask your tutor if they will help you work on some essay/s that you have already started work on. they won't be obliged to help, but they might be willing to if they think it will help you on your course.


More on the closed-form for a simple pendulum

Question: I've learnt about the simple pendulum, and while the regular curriculum only uses the linear approximation of $\sin\theta$ to obtain $\ddot\theta+\omega_0^{2}\theta=0$. I tried to find out about a purely analytical solution, without approximations (though I knew about Taylor approximations for sine), so I obtained: $T=4\sqrt\frac{l}{g}K(\sin\frac{\theta_0}{2})$ so that $T$ increases with amplitude. I also tried to obtain $\theta(t)$ but ended up with an admittedly messy expression, via:
$$\ddot\theta+\omega_0^{2}\theta=0\\ \dot\theta\ddot\theta+\omega_0^{2}\theta\dot\theta=0 \\ \dot\theta^{2}=\sqrt2 \omega_0 \sqrt{\cos\theta -\cos\theta_0} $$
(with the help of initial conditions: no $\dot\theta_0$, $\theta_0=\theta(t=0)$)
with integration I obtained:
$$\omega_0 t=K(\sin\frac{\theta_0}{2})-F(\phi,\sin\frac{\theta_0}{2})$$ with $$\sin\phi=\frac{\sin\frac{\theta(t)}{2}}{\sin\frac{\theta_0}{2}}$$
Is there any better closed solution and physical input+method for $\theta(t)$?
Answer: The simple pendulum is the one that uses the small angle approximation. Using a massless rod isn't necessary as any moment of inertia can be expressed as $mr^2$ for some $r$. So I'll go through a quick derivation of the equations of motion and compare the exact solution of the approximate (locally linearized) equation and I'll go over how to get to the elliptic integral for the real equation.
Also, I believe you might have made an error going from the second order equation to the first order equation, but I see no work, so I can't actually tell. The end looks similar to what wikipedia has, but that isn't based on the linearized equation, so that would be highly unexpected. Further, you say that the equation is for unspecified $\dot{\theta}_0$ but the square root implies that $cos\theta\geq cos\theta_0$ so if I send a pendulum at a high speed from the horizontal it's orientation would become complex. Something seems odd.

Looking at the equation for the undamped pendulum - massless rod fixed about a
point, the other end fixed to a point mass - where $\theta$ is the angle from the vertical, we can write the Lagrangian, and then the equations of motion.
$$
L = ml^2{\dot{\theta}}^2 - mgl (1-cos\theta)\\
\frac{d}{dt}\bigg[\frac{\delta L}{\delta \dot{\theta}} \bigg] - \frac{\delta L}{\delta \theta}=0 \\
ml^2\ddot{\theta} + mgl~sin\theta = 0 \\
\ddot{\theta} + \frac{g}{l}~sin\theta = 0
$$
From here, we can make the approximation, $sin\theta\approx\theta$ that for small $\theta$ which produces an equation that you have, where $l{\omega_0}^2=g$. This is a second order linear equation, there is no first order term, the possible solutions are $\theta=0$ or $\theta=exp(rt)$ and if you substitute the second, you'll find that $r^2+{\omega_0}^2=0$ so $r$ is a pure imaginary number and the solutions are sines and cosines of frequency $\omega_0$. This fact is independent of initial condition. Importantly, the period is constant if you use this equation, it's linear, single variable.

More exciting is solving the original, I'll rewrite with a small modification, multiplying by $\dot{\theta}$,
$$
\dot{\theta}\ddot{\theta} + \dot{\theta}\frac{g}{l}sin\theta = 0
$$
From here, I'll just do it, let C be a constant of integration.
$$
\frac{d}{dt} \bigg[\dot{\theta}^2/2 - \frac{g}{l}cos\theta\bigg] = 0 \\
\dot{\theta}^2/2 - \frac{g}{l}cos\theta = C \\
\frac{d\theta}{dt} = \sqrt{ 2C+2\frac{\strut g}{l}cos\theta} \\
\int d\theta\bigg/\sqrt{ 2C+2\frac{\strut g}{l}cos\theta} = \int{dt}
$$
The last part's a toughie. But the only thing left I can say is that $C$ is probably proportional to the total energy of the system since it's conserved and it has $s^{-2}$ in it.
Comment: Using the supstitution $\sin{\frac{\theta}{2}} = u$ you can express $\theta(t)$ in terms of sn function [link](https://en.wikipedia.org/wiki/Jacobi_elliptic_functions)


No text shown in GMod

Question: I'm playing Gmod TTT and no text is showing up - I can't read my weapons menu, map vote or HUD. This is very strange because I could play just fine yesterday - I played for several hours on the same server as I am now. I also played on a different server a couple of minutes ago and had the same problem. What's going on? This screenshot shows what I mean:
Comment: What does the console say?
Answer: This sounds like a game file was removed or corrupted. Go into Steam. Right click on where it says "Garry's Mod" in the list of games. Click on "Properties". Go to the "Local Files" section. Click on "Verify integrity of game cache". It will show a loading bar for a few seconds to a few minutes, and when it ends your problems should be fixed.
A YouTube video of someone doing this can be found here.
Comment: To add to this, if the problem is happening across different servers then it's _your_ game that's corrupted. Doing the above will fix it 95% of the time.

No text shown in GMod


How to Delete Old Comments by Date?

Question: I run a contest/giveaway blog at www.mommylivingthelifeofriley.com and currently have over 160,000 comments on 1100 posts.  I would like to find a way to delete all comments from my site which are older than 6 months, so as to improve my site's overall performance.  Does anyone have any ideas on how to accomplish this?  Thanks for your help!
Answer: You could easily do this using mysql:
<code>DELETE FROM wp_comments WHERE comment_date < DATE_ADD(CURDATE(), INTERVAL -6 MONTH)
</code>
Comment: just keep in mind that you may orphan some newer child comments by deleting their older parents.
Comment: I might have time to create simple plugin for this. But, I have questions: what's the best solution for old comments that has new childs? should the old comment be deleted along with it's childs? or should it be preserved? or maybe something better (that I don't know yet)?

How to Delete Old Comments by Date?


How to compare different nlme models ?

Question: If there are 2 nlme models with same non-linear mean function, model 1 and model 2, how do you compare them ? Which R function does this for us ?
And when there are random effects or fixed effects, I don't know how a nested model is defined ?
For example model 1,
`model1  <- nlme(df_measures ~ meanfunc(w, time, b0,b1,b2) ,
            fixed = list(b0 ~1, b1 ~ 1, b2 ~ 1),
            random = b0 + b1 + b2 ~ 1,
            groups = ~ subject ,
            data = dataa,
            start = list(fixed = c(b0 = 3,1, b1 = 5,1,b2 = 1,1)),
            verbose = T
            )`

and model 2:
`model2 <- nlme(df_measures ~ meanfunc(w, time, b0,b1,b2) ,
            fixed = list(b0 ~w, b1 ~ w, b2 ~ w),
            random = b0 + b1 + b2 ~ 1,
            groups = ~ subject ,
            data = dataa,
            start = list(fixed = c(b0 = 3,1, b1 = 5,1,b2 = 1,1)),
            verbose = T
            )`

Is model2 a nested model of model 1 ? This is confusing me and how do I compare them ?
If model 2 is a nested model of model 1, can I still use ANOVA  function in R to compare them ?
What if model 2 is not a nested model of model 1 ? How should I compare between these 2 models? Based on what criteria ?
Thanks.
Answer: Model A is nested within Model B if A is a special case of B. In your example, model 1 is nested within model2 because it equals to the special case of model2, where the slope for w is set to be 0.
My understanding is that the nested nature can apply to both random effects structure and fixed effects structure. Yours is nested in the fixed effect structure. (edit: in the original post I said "nested in the random effect structure", which is wrong)
I am not sure about ANOVA, but yes you can use anova to compare them (anova(model2,model1)), although the authors of nlme advise against it, because the likelihood ratio test (for comparing fixed effects) will be anti-conservative. That is, the p-value will be less than what it actually is.
They recommend using the conditional t-test, which is implemented in the summary function. So in your case, there is no need to fit model1, and you can simply look at summary(model2).
The alternative they recommend is the conditional F-test, which is implemented in the anova but with 1 model only. That is, anova(model2). So you have 2 to choose from.
For completeness sake perhaps I should say that the above advice seems to hold only for fixed effect comparison. If you are making inference on the variance components, then the Likelihood ratio test (from anova) will be conservative instead. But people tend to accept being conservative, which means anova can be used.
My reference is the author's book.
Pinheiro & Bates (2000), Mixed-Effects model for S and S-plus

How to compare different nlme models ?


Polygons from different layers

Question:
How to create a map with polygons from all the different layers?
I'm using ArcGIS Pro and it does not have Overlay analysis tool.
Comment: Use union tool to achieve this.
Answer: You can use the merge tool:
http://pro.arcgis.com/en/pro-app/help/editing/merge-features-into-one-feature.htm
Or you can use the append tool:
http://pro.arcgis.com/en/pro-app/tool-reference/data-management/append.htm
Note: You will need to make sure the schema of all the feature classes is the same. If not then carefully map the fields.
Answer: The [merge tool] (http://pro.arcgis.com/en/pro-app/tool-reference/data-management/merge.htm)

Combines multiple input datasets into a single, new output dataset. This tool can combine point, line, or polygon feature classes or tables.
Use the Append tool to combine input datasets with an existing dataset.
Use this tool to combine datasets from multiple sources into a new, single output dataset. All input feature classes must be of the same geometry type. For example, several point feature classes can be merged, but a line feature class cannot be merged with a polygon feature class.
Tables and feature classes can be combined in a single output dataset. The output type is determined by the first input; if the first input is a feature class, the output will be a feature class, if the first input is a table, the output will be a table. If a table is merged into a feature class, the rows from the input table will have null geometry.
All fields in the output dataset and the contents of those fields can be controlled using the Field map.
This tool will not split or alter the geometries from the input datasets. All features from the input datasets will remain intact in the output dataset, even if the features overlap. To combine, or planarize, feature geometries, use the Union tool.
If feature classes are being merged, the output dataset will be in the coordinate system of the first feature class in the Input Datasets list, unless the Output Coordinate System geoprocessing environment is set.
This tool does not support annotation feature classes.
This tool does not support raster datasets. Use the Mosaic To New Raster tool to merge multiple rasters into a new output raster.

Polygons from different layers


What does it mean for software to run natively?

Question: I've been wondering what it means for software to run natively. What exactly is such software and how is it different from software that does not run natively? How can I tell if a given peice of software will run natively on my computer? Is there likely to be software already on my computer that runs natively?
Comment: @faB You do realize that no moderator was involved in closing the question?
Comment: "native" implies it's designed to run on whatever platform/os it's on
Comment: Me neither... it seems like the moderators have a difficult time reading questions...
Comment: I admit, the question title made me think of the difference between running a "program" under either an "operating system" or on the processor itself (e.g. direct hardware access).
Comment: It's not that the question is *bad* per se, but it's not good for this site. As evidenced by the answers, it's not something that can be answered cleanly and has a number of arguments surrounding it, which makes its closing entirely appropriate according to the FAQ.
Comment: To understand why the question was closed, go into the [edit history](http://superuser.com/posts/583337/revisions) and read the original wording. It was reopened after a _major_ rewriting.
Answer: A software is native to a platform if it was designed to run on that platform.
A platform usually refers to an operating system, but it can also be applied to devices such as the Nintendo Game Boy.
Using the Game Boy as an example, it gets its software from cartridges.  These cartridges contain code that runs natively on the Game Boy.
Emulators are a layer that allows software designed for one platform to be run on another.  For example, there are emulators that can execute images of Game Boy cartridges and allow you to play Game Boy games on your computer or even your mobile phone.
A compatibility layer is kind of like an emulator.  When 64-bit computers and operating systems became mainstream, they needed to be compatible with the existing 32-bit technologies.  Since 64-bit and 32-bit architectures are very different, a compatibility layer is often needed to run 32-bit software on 64-bit machines.  For 64-bit editions of Microsoft Windows, Microsoft needed to write a compatibility layer so that 32-bit programs would still work on the new 64-bit system.  This is why some programs are often installed to a folder called Program Files (x86), where x86 means "32-bit".
Compatibility layers tend to be more intimate with the native system than emulators are.  VirtualBox emulates hardware for operating systems*, and the systems that it emulates doesn't have very much direct interaction with the host system.  WoW64 is a compatibility layer in that it lets 32-bit programs run on 64-bit Windows in a more integrated way.  WoW64 helps make programs compatible rather than emulating them in an isolated environment.
A translation library is a component of compatibility layers.  Whenever binary code is running non-natively, a translation library helps redirect foreign, non-native calls to native calls that the system can understand.  Assembly programs written for the original TI-83 might not be compatible with the newer TI-83/84 Plus calculators because some calls that made sense in the TI-83's architecture may no longer be valid in the TI-83/84+.  A translation library (probably included in shells like MirageOS) ensures that calls for the TI-83 go to the new, updated places in the TI-83/84+ calculators.
Platform-independent code is written in a language that is interpreted by something that usually runs natively.  For example, PHP is a programming language that is interpreted and executed by the installed PHP binary, which has already been compiled natively for Windows, Mac, and Unix-based operating systems.  The PHP code that web scripters write are independent of the platform, allowing the code to work on multiple operating systems as long as PHP is installed for those operating systems.

Miscellaneous
Corrections
* Thank you, Michael Kjörling, for catching some issues with this answer.
Other
The difference between "native" and "non-native" is not black and white.  (Credits to afrazier)
Comment: Minor nitpick: (it's VirtualBox, not VirualBox, and) VirtualBox does not emulate the operating system, it emulates the *hardware*. So you can install any operating system you like in VirtualBox (subject to virtualization limitations), or even write your very own from scratch.
Comment: *Native* also often implies that it's using the primary library set and API for the underlying platform, which can make distinctions a bit fuzzy.  There's quite a few people who don't consider .NET applications to be "native" like Win32 API applications are "native", and similarly some people don't consider a KDE program running on a Gnome desktop "native".
Comment: @afrazier: That's because .NET applications are designed to run on the "Common Language Runtime", and need a compatibility layer to run on Windows.  Or a different compatibility layer to run on Linux.
Comment: @Ben Voigt: It's still a first-party API, the binaries are compiled to native x86/amd64 code (whether at runtime by the CLR or in advance with ngen), and the framework has been shipped with recent versions of Windows.  This is part of a larger argument though, and not really appropriate here.
Comment: Virtual Box is not technically an emulator but a Virtualizer.  An emulator of times passed has always emulated completely different hardware.  Under a virtualizer, the OS & software actually runs natively on the host CPU.  The difference is that the devices are virtual or emulated.  It's a minor technical difference that even the Virtual Box website points out here: https://www.virtualbox.org/wiki/Virtualization
Answer: Native code is usually used as opposite of platform-indepedent code. If you run native software, you are running a compiled binary and not, for instance, a platform-indepedent script such as javascript or Java bytecode. Compiled C or compiled C++ are the good examples of native code.
Answer: There are surprisingly a couple possible answers, but the standard usually is: code compiled to the opcodes for the CPU, and running against the programming libraries of the OS that booted the computer. In this case, most code you run will be native code. Maybe some counter-examples will clear things up.
Java is not native code. It is compiled to an intermediate bytecode, which is then run on the specific chipset. Java can call native code. Eclipse is a great example - for speed, Java calls out to some platform native graphics calls.
If you run WINE, an MS Windows API emulator, that is not native code. Though you're executing code designed for that chipset (x86), you are not running the code for the OS that booted it, but replacement libraries.  MAME runs binaries for different CPUs AND operating systems.
Scripts are not native code. They are written in a higher level language which then has to be converted at runtime to code that runs on your CPU.
There are some blurry lines. Your web browser runs as native code,, but it can also run Java (compiled to bytecode) or Javascript (a script interpreted language).
Comment: .NET, VBA, [XUL](http://en.wikipedia.org/wiki/XUL#XUL_applications), [IA-32](http://en.wikipedia.org/wiki/IA-32) (on AMD64 CPUs, at least), ...
Answer: It depends a lot on the context. To me, "native" means an application uses the features and mechanisms the operating system provides, rather than rolling their own. That can apply to user interface features (buttons, windows, file-chooser dialogs), as well as to features under the hood (e.g. integration with "Open with...").
For example, on Windows, a native app would use "WinAPI" to get the same buttons, scrollbars, etc. as other applications. They behave exactly the same in system apps (notepad) as in native third-party apps.
Java applications often use "Swing" and look completely different, because they draw their controls themself, rather than using the system ones. The benefit is that the program looks the same on every OS.
Another option to build a GUI is a cross-platform toolkit like "QT". QT will ask the OS to draw the controls for it, so they should look very much native, no matter whether you are running Windows, OSX, or Linux. A QT text box will look just like a windows textbox, however it isn't exatly a native one, but a kind of emulation. You might notice small differences in the details (e.g. the context menu, input methods, etc.).
Note when people say "native", they often mean a program is compiled to machine code rather than to an intermediate code, which is ran in a virtual machine (like Java and .NET programs). In the above examples, the WinAPI and the QT app are using machine code, whereas the Java program is compiled to Java bytecode. This usage is a bit problematic nowadays, because many users would consider a well done .NET application native for Windows - it is just an .exe, uses the exact same controls and APIs under the hood, and is almost indistinguishable from a program compiled to machine code.
Likewise, I'd consider a program that uses GTK, knows about the Unix file system structure and perhaps comes in a .deb package native for Ubuntu or Gnome. There are even first-party Gnome apps written in javascript that one could call native! The same applies to Windows 8 "Metro" apps, that can be written in a variety of languages, some compiled, some not.
Answer: To put in more abstract terms, it's like letting someone else your trust executing a program in a different language.

Native means the OS will use the fastest, simplest dialect he knows, binary.
Pros: fast, large availability of language that can talk to each other since it's down to metal. Cons: security, complex API, restricted to OS capabilities, also compilers are hard to make, because a program, once compiled, is released into the wild.
Not native, means your code will not be executed directly by the OS. He can be executed in many many different ways, the main ones being interpreted and running a bytecode version of your program in a virtual machine.
Pros: the API almost ever change, so it's much easier for programmers to work (at least when they stick to this particular language). Cons: performance (it's often a mild decrease, it can rarely become a problem), and not everyone will actually use this particular language, so it can also be a problem to adopt this technology. Security can also be a problem, but it's much more under-control. Somehow.


how much RAM my laptop can support

Question: I've purchased Dell Inspiron15 3558 which specs are:
Intel Core i3 5005U @ 2.00GHz.
4.00GB Single-Channel DDR3 @ 798MHz. (2 slots, 1 used)
Intel HD Graphics 5500
1 TB HDD.
how much RAM I can extend in it.
I checked on Crucial.com and Crucial System Scanner both says max 16 GB,
but Kingston.com says max 8GB and now I'm confused which one is true,
 because I want to extend it to 12GB (8GB+4GB).
and If I'll buy one 8GB from local market or Online and if it'll not work they will replace it but not return and refund, so I can't purchase until i'm sure.
is there any other way to find out actual compatibility ??
 can anyone help??
Answer: According to Dell's website, the max is 8GB.

how much RAM my laptop can support


Sculpting selection problem

Question: I have problem with selecting in sculpting. It only wants to sculpt the last object I selected in Object mode. Here only plane.010 is being sculpted and its mesh icon is highlighted, when I press double A, everything deselect but that triangle icon before Plane.010 name is still highlighted, and so when I select some another than again same problem but only with that Plane. If I select multiple, last one I selected is highlighted and being sculpted etc. What am I doing wrong?
Comment: That's not a bug, it's a feature ;). You used to be able to switch active object in sculpt mode using CRTL, I just tried that doesn't work anymore. The only workaround I see is joining your shindles, sculpting them and separating them again afterwards. Might work with multires, but try it out first.
Comment: I checked the tutorial and put what he does in the form of an answer.
Comment: I will try that way. I am following https://youtu.be/bWHhx4uos84 this tutorial and on 7.20 he just take sculpting tool and start sculpting them all at once so I was asking what may I have missed. Anyway thanks, I will try your's way too
Answer: The only way how you can do that (at the moment) is to actually join them togeher. Select all of them, the Shift-click on the one you want to be the center and press Ctrl+J. This way they are all one mesh and you can sculpt away.
If you need them to be separate again at some point, go into Edit Mode, press P and select By Loose Parts.
Comment: That will do it surely. Thanks!

Sculpting selection problem


publishing images of public art in US

Question: I am a small press book publisher. I'm planning an anthology with 50 photographs of Public Art pieces, mostly sculptures found in Washington state and in Oregon; on the facing pages will be poems about those works of art. Do I need to elicit permissions from the 50 entities on whose (public) property the art is located, or can I simply provide a page to acknowledge ownership, the artists who created the public artworks, and their locations?
Comment: Does this answer your question? [Copyright infringement question, photography of public art](https://law.stackexchange.com/questions/22255/copyright-infringement-question-photography-of-public-art)
Comment: The issues in the linked question, while relevant here, are significantly different. IMO it is not a duplicate. The Issue on the linked Q is whether an owner's right to control who enters land can be sued to prevent commercial use of photos, and also whether the posted sign accurately represents BLM policy.. Neither of those are relevant to this Q
Comment: Who owns the copyright to the photograph(s) you want to reproduce? That is who you should be in contact with. It's not really a "public art" question.
Answer: You do not need to get permission from the property owners, except insofar as you have to enter the property to take a photo. You do need the permission of the copyright owner. That could be the artist, or it could be a person who commissioned the work. See Davidson v. US for an expensive lesson (paid by the USPS) on not getting permission from the copyright holder. The copyright office has a summary of legal points regarding copyright on visual works (yes, sculptures are copyrightable). There is an exemption for "US government works" under 17 USC 105, which is "a work prepared by an officer or employee of the United States Government as part of that person's official duties" – such a work is not protected. Otherwise, it is protected.
Comment: There is also an exemption for built structures (including outdoor sculpture) where they are background rather than the subject of the image. That's not something the OP could use here.
Comment: This answer significantly oversimplifies the situation. In particular it does not deal with the complexities for statues erected prior to 1978, when a copyright notice was required under US law, or before 1964, when copyright renewal registration was also required. See my answer.
Answer: This turns out to be a somewhat complicated issue, and the rules are different for US and UK law, and may be different again under the laws of other countries.
US Law
If the statues are incorporated into buildings 17 USC 120 (a) seems to grant permission. Specifically, it provides that:

Pictorial Representations Permitted.—The copyright in an architectural work that has been constructed does not include the right to prevent the making, distributing, or public display of pictures, paintings, photographs, or other pictorial representations of the work, if the building in which the work is embodied is located in or ordinarily visible from a public place.

This does not, however, apply to free-standing statues, and the description in the question suggests that most of the images involved would be of free-standing works.
The Wikimedia Commons page Public art and copyrights in the US is intended for guidance to Wikipedia editors and Commons contributors on what uses of photos are permissible under US law, except that as per Commons policy, it ignores any question of fair use, because commons does not host work available only under fair use.
As that page points out, the rules under US law are different depending on the date of creation and publication. See also the famous Cornell Public Domain Chart
Copyright Notice
Many statures were erected under the old 1909 Copyright act. This will apply to all statutes created prior to 1978 (the effective date of the 1976 Act). Under the 1909 act, a copyright notice was absolutely required. Publication without a notice resulted in loss of copyright. Under the 1976 act as originally passed, a notice was still required, but the omission could be cured by registration within 5 years. If that was not done, the work entered the public domain. After amendments that took effect in 1989, notice became optional and was never cause for loss of copyright.
Publication
Under the 1909 Copyright act, "publication" was defined in case law, not in the statute. This definition was summarized by Nimmer on Copyright in section 4.039(A) where Nimmer states  that  "publication occurred when … the original or tangible copies of a work are sold, leased, loaned, given away, or otherwise made available to the general public..."
Publication was important because the notice requirement applied only to published works, and statutory copyright began with publication. Publication is thus still important to determine the copyright status under US law of works created before 1978, and in some cases before 1989.
In King v. Mister Maestro, Inc., 224 F. Supp. 101 (S.D.N.Y. 1963) Nimmer was quoted on this issue at page 107 as stating:

This analysis suggests that a sine qua non of publication should be the acquisition by members of the public of a possessory interest in tangible copies of the work in question.

In that case the court held that advance distribution to the press of the text of Dr. Martin Luther King Jr's "I have a Dream" speech was a limited distribution, and so the absence of a copyright notice did not cause the loss of copyright.
In Letter Edged in Black Press, Inc. v. Public Bldg. Com'n of Chicago, 320 F. Supp. 1303 (N.D. Ill. 1970) The district court held that the statue known as "The Chicago Picasso" had passed into the public domain because models of the stature were publicly exhibited without a copyright notice, and photos of the statue were distributed to the press and widely reproduced that did not show or include any copyright notice. The court wrote (at page 1308, footnotes omitted):

To determine how a work comes to be in the public domain it is necessary to explore the basis of the copyright protection. The common law copyright arises upon the creation of any work of art, be it a first sketch or the finished product. This common law right protects against unauthorized copying, publishing, vending, performing, and recording. The common law copyright is terminated by publication of the work by the proprietor of the copyright. Upon termination of the common law copyright, the work falls into the public domain if statutory protection is not obtained by the giving of the requisite notice.
...
[page 1309] Once a work is published, however, the Constitution dictates that the time for which the statutory copyright protection is accorded starts to run. An author is not allowed to publish a work and then after a period of time has elapsed choose to invoke statutory copyright protection. If the statutory protection is not acquired at the time of publication by appropriate notice, the work is lost to the public domain. Any other rule would permit avoidance of the "limited times" provision of the Constitution.
...
[page 1310] The maquette [reduced-scale model], however, was an original, tangible work of art which would have qualified for statutory copyright protection under 17 U.S.C. § 5(g).[19] The court finds that when the maquette was published without statutory notice Picasso's work was forever lost to the public domain. When the monumental sculpture was finally completed it could not be copyrighted for it was a mere copy, albeit on a grand scale, of the maquette, a work already in the public domain.
...
[page 1311] ... every citizen was free to copy the maquette for his own pleasure and camera permits were available to members of the public. At its first public display the press was freely allowed to photograph the maquette and publish these photographs in major newspapers and magazines. Further, officials at this first public showing of the maquette made uncopyrighted pictures of the maquette available upon request. Were this activity classified as limited publication, there would no longer be any meaningful distinction between limited and general publication. The activity in question does not comport with any definition of limited publication. Rather, the display of the maquette constituted general publication.

Thus, under the 1909 Copyright Act, public display of a statute, under condition's where any person could view, sketch, or photograph the work constituted publication and if done without a copyright notice affixed at the time of publication so as to be visible to the public, meant that the statue entered the public domain at once and forever.
Copyright renewal
Under the 1909 Copyright act, copyrights lasted for an initial term of 28 years, and unless renewed, copyright expired. Later law made renewal automatic for works still in their first term, thus any work published (see above on publication) in 1964 or later did not require a renewal registration. But any works published in 1963 or earlier required a renewal registration to be filed with the US Copyright Office. This could be done in the 27th, 28th, or 29th year after publication, but not earlier or later. Failure to properly renew caused the copyright to expire.
The records of renewal registration can be found online at  https://www.gutenberg.org/cache/epub/11800/pg11800.html How to search those records is discussed in https://law.stackexchange.com/a/78681/17500
Statues Erected before 1927
Any statues erected in a public place in the US, and therefore published before 1927 are now in the public domain under US law. Photos of such works can be freely reproduced with no legal restriction, no need for any permission, or any royalty or fee payment. (Indeed even attribution is not legally required, although I and many others would think it morally essential.)
Statues Erected 1927-1963
Any statues erected in a public place in the US, and therefore published, during the period 1927-1963 are now in the public domain IF:

No visible copyright notice was affixed to the statue;
Copies of the statue, or photographs of the statue, were distributed by permission of the copyright owner without copyright notices; or
Timely renewal registration was not made.

Statues Erected 1964-1977
The same conditions apply as in the 1927-1963 period, except that renewal of copyright was automatic, so renewal registrations were not required.
Statues Erected 1978-1 March 1989
During this period copyright notice was still required, but lack of notice could be cured by registration within five years. Also during this period the definition of "publication" had changed. 17 USC 101 now defines publication as:

... the distribution of copies or phonorecords of a work to the public by sale or other transfer of ownership, or by rental, lease, or lending. The offering to distribute copies or phonorecords to a group of persons for purposes of further distribution, public performance, or public display, constitutes publication. A public performance or display of a work does not of itself constitute publication. [Emphasis added]

So to establish publication one must show authorized distribution or offering of copies to the public, not merely display in a public place.
Statutes published during this period are now in the public domain IF:

There was no copyright notice on the statue itself;
Copies were distributed or offered to the general public with no copyright notice; and
The statue was not registered with the Copyright Office within five years of publication.

To document public domain status for works in this period would require research in to the distribution and format of copies, and a check of the copyright office records, not merely an inspection of the statue.
Statues Erected After 1 March 1989
All works created or published after 1 March 1989  are still under copyright unless some other exception applies, such as the statue being a work of the US Federal Government, or being a copy of an older work that is in the public domain. Neither copyright notice nor registration was or is required.
Permission or Fair Use
Any statues which do not fall into the public domain under one of the above categories can be used only with permission, or under a claim of fair use.
Permission is simple, but may be hard to obtain. Indeed it may be hard even to determine who the current copyright owner of a statue is. But if one can determine the owner, one may simply ask. The owner is free to say yes or no, and may grant permission on whatever terms the owner chooses, including a specified attribution, or a fee or royalty.
That brings us to the consideration of fair use, and whether a photograph of  a statue can be fair use under the conditions of the question.
In the case of Robert S. Davidson v. United States, United States Court of Federal Claims, No. 13-942C (2018) cited in the answer by user6726 and in the somewhat similar earlier case of Gaylord v. United States, 595 F.3d 1364, 1374 (Fed. Cir. 2010) courts declined to find that use of a photo image on a US stamp by the US postal service was a fair use.
But in Davidson the court stressed that the use was not transformative, that billions of copies of the image were made, that the Postal Service made tens of millions of dollars of "pure profit" on the images, and that no text or other addition to the image of the statue was made. It did a full four-factor analysis and held that, in this particular case, the  use was not a fair use. Several of the circumstances whch led to the Davidson  decision are not comparable to the situation suggested in he question here.

There is no generally applicable definition of fair use, and therefore each case must be decided on its own facts and unique circumstances. Campbell v. Acuff-Rose Music, Inc., 510 U.S. 569, 577-78 (1994). [quoted in Davidson, supra]

Let us consider the four statutory factors from 17 USC 107 in the circumstances of the question.
The purpose and Character of the Use

The purpose and character of the use is often the dispositive factor in the fair use analysis. This factor embraces both how the work is used and to what end, i.e., whether the work is somehow transformed by the new use and what is the user of the work doing with it. [Davidson, supra]

By pairing the image of a statue with a poem about that work of art, or reflecting on its theme, the described work is arguably transformative. Such a book would be commercial in that it would be sold, but presumably would not be a major money-maker (unlike the stamps in Davidson). The question states that proper attribution and credit would be provided. By selection of angle and lighting, and original element is added to the photo.
Overall, this first factor seem to me to lean strongly toward a finding of fair use.
The Nature of the Copyrighted Work
The statues are presumably creative works, and in most cases are not themselves derivative. Thus the second factor leans away from a finding of fair use.
The Amount and Substantiality of the Portion used
Presumably the photos would show the entire statue, or at least most of one side. This leans somewhat against fir use, but has not precluded a finding of fair use in many cases.
The Effect of the use Upon the Potential Market for or Value of the Copyrighted Work
This factor is often of key importance, along with the transformation aspect of the first factor. It is also particularly hard to asses without knowing the specifics. In particular, how each individual statue had previously been marketed by the copyright holder, and any evidence of plans to market photos of the statue.
In the absence of significant marketing or likelihood of future marketing of images of a given statue by the copyright holder, and in the presence of other commercial images of the statue without a royalty being charged, this factor would lean toward fair use. Evidence of current marketing that might plausibly be interfered with by such a book would cause this to lean away from fair use. It seems unlikely that the book would function as a substitute for the statue, which favors a finding of fair use.
Overall Fair Use Analysis
It is not really possible to determine in advance how a court would rule on the fair use issue. Note also that there could be a separate suit, with a separate analysis, for each of the statues that is under copyright. But there is a reasonable chance of a finding of fair use, depending on the detailed facts. It is by no means implausible.
Conclusion on US law
By selecting statues not protected by copyright, due to the dates when they were erected, the absence of a copyright notice, or the absence of a required renewal of copyright, such a book might well be created with no copyright liability. Additional works that are in copyright, but where a fair use finding seems likely, could be added with only limited risk. Addition of commentary on individual statues would bolster the likelihood of a fair use finding.
Canadian Law
According to "Copyright and Taking Pictures of Sculptures" from Cjam (Clinique Juridique des Artistes de Montréal),

If the sculpture is "permanently situated in a public place or building", it is not an infringement of copyright to reproduce it in photographic form. While this might not apply to a temporary exhibition in a coffee shop, if you then sell the sculpture to the city of Montreal and they place it permanently in Parc Lafontaine, you no longer have the exclusive right of reproduction.

This cites the Copyright act RSC 1985, c C-42, s32.2(1)(b) which provides that:

32.2 (1) It is not an infringement of copyright ...
(b) for any person to reproduce, in a painting, drawing, engraving, photograph or cinematographic work
(b) (i) an architectural work, provided the copy is not in the nature of an architectural drawing or plan, or

(b) (ii) a sculpture or work of artistic craftsmanship or a cast or model of a sculpture or work of artistic craftsmanship, that is permanently situated in a public place or building;

Other Countries
In those countries wil provide for the Freedom of panorama such a book would be likely to be legal.
According to the Wikipedia article linked above:

Freedom of panorama (FOP) is a provision in the copyright laws of various jurisdictions that permits taking photographs and video footage and creating other images (such as paintings) of buildings and sometimes sculptures and other art works which are permanently located in a public place, without infringing on any copyright that may otherwise subsist in such works, and the publishing of such images.

The article lists many countries where FOP applies, and others where it applies in a limited way.
In a country where FOP applies fully, a book such as described in the question would not be restricted by copyright on the various statues.
Comment: This is a perfect answer. Very helpful to clarify our problem and allow us to move forward. Thank you.
Comment: @user44362 Thank you. If you find the answer helpful, you may upvote it by clicking the up-arrow to the left of the answer. If you think this answer fully solves your problem, you may accept it by clicking the check-mark just below the up-arrow.

publishing images of public art in US


IBM quantum experience: Why are intermediate measurements ignored?

Question:
Why am I getting here a measurement outcome of $00$? I measure after the first $X$ gate in a separate output bit c[1] which should result in a $1$ and I measure again after a second $X$ gate in a separate output bit c[0] which should result in a $0$, so $10$ in total. Why do I get the output $00$ as if both measurements are performed after the whole circuit? And how can I do intermediate measurements as expected?
Answer: The problem is that IBM Q shows results of measurement of a final quantum state (I found this after some trial and error).
When you apply first $X$ gate, qubits switches from $|0\rangle$ to $|1\rangle$. The measurement result is of course 1 and this value is stored in classical register, hence you see 10 in Measurement probabilities window.
Now you apply another $X$ gate and this switches your qubit back to state $|0\rangle$. So, after measurement you see 0 in classical register. As I mentioned above, only final state probabilities is shown Measurement probabilities window. So, yes, the first measurement is really ignored and it seems that this  is a feature of IBM Q environment, although logic says that if you save results to different classical bits, they should be preserved.
Comment: I think the IBM devices are not even capable of performing intermediary measurements...
Comment: Maybe getting the state vector after the quantum operation and then randomly pick one state(although there might be technical issues obstacle this strategy) according to the probability distribution to initialize another quantum register is a possible way to perform intermediary measurements. But this is a pureely coding job and seems more like "I do so"?
Answer: The first measurement is not being ignored.
Your quantum state started in the state $|0\rangle$ and after the $X$ gate, it is now in the state $|1\rangle$. Measuring the qubit collapsed it into the state $|1\rangle$ again... since $|1\rangle$ is already an eigenvector of the $Z$ Pauli operator.
So your state never changes after the first measurement, you still in the state $|1\rangle$. Thus, after applying another $X$ gate, you get back to $|0\rangle$. That is the reason why you only see $0$ is being measured.

Edit: My comment about the first measurement "not" being ignored when looking at the measurement probabilities is incorrect.
However, the first measurement is not being ignore in the experiment overall...  That is, say you start in the state $|0\rangle$ then apply Hadamard gate $H$ to it, make a measurement, apply another Hadamard gate $H$ and then make another measurement. If the first measurement is being ignored, then you would get back $|0\rangle$.. but in fact we don't:

Now, if you put the first measurement in the first cbit1 and the second measurement on the second cbit2 then you get something like:

This was being simulated on the qasm_simulator as current device is not capable of yet doing this intermediate measurement. So on the real hardware, you can't perform any additional operations after the first measurement.
Another note is that if you do this in the circuit composer environment, you get something like:
Comment: Actually, the measurement is ignored since first result (1) is stored in classical bit c1 and the second result(0) is stored in classical bit c0. But this is probably feature of IBM Q. See my  answer below for details.
Comment: Still hard to understand why measurement result of `clbit[1]` is changed.
Comment: @YitianWang I didn't see that clearly. I was just reading the right hand graph... so yes, that was a mistake.


The validity of dividing an average cost by an average duration?

Question: Let's say you wanted to calculate, for example, the average (i.e. mean) cost per day for a hotel to accommodate a tourist. If only aggregate cost data is available, is dividing the average cumulative cost for one person's stay by the average person's duration of stay an acceptable method? Would using the median cost and median duration of stay be better? Worse? The same?
I know the median is less susceptible to outliers than the mean, so if both the median and the mean work the same I'd rather use the median.
Answer: I don't see a problem with the average,
$$\frac{\overline C}{\overline D}=\frac{\frac1n\sum_i C_i}{\frac1n\sum_i D_i}=\frac{\sum_i C_i}{\sum_i D_i}.$$


Disabling a control vs hiding a control in ASP.NET

Question: From a User Interface design point of view when is it better to disable a control or to completely hide it. I have attached an example. In both case if the "Enable ASP.NET" checkbox is clicked the "Select. Net Version selector is enabled.
Answer: I would argue that it's almost always best to just disable.  Hiding controls means you're leaving a portion of your functionality/configurability a mystery to the end-user.  Unless there's a compelling reason to keep users in the dark, I wouldn't.
Your example of a checkbox that enables/disables or hides/unhides a dropdown box is a good one.  If users aren't aware that checking the box allows them to select further options, they may never check it and find out, because they don't realize the option they're looking for is there.
Many of us, as developers, come from the "try everything" mindset when it comes to using a piece of software.  Normal users don't think that way, and that's not a bad thing, either.  It just means we have to keep in mind that not everybody will do what it takes to discover a piece of UI that's been hidden.  Leaving it visible but disabled lets them see that there's something there for the having should they decide they want/need to use it, rather than leaving them either wondering if the software does something or never even considering that it might.
Answer: This really depends on the context of the example. In this case there is some value associated with disabling the control as it provides a visual affordance that enabling the ASP .Net checkbox will have a determinable outcome.
If the outcome of the checkbox is actually a whole series of non related suboptions or the parent control was a dropdownlist which determines which child elements become available then it would be better to hide / show only those elements that are appropriate to the current selection.
One other point, if you are describing "hiding" the controls as control.visible = false in code rather than display:none then remember that the output will actually not be rendered into the browser at all. This may be a concern if you are catering for disabled users with browsers requiring stricter accessibility requirements etc.
Comment: Good stuff. I completely agree.
Answer: To me that depends on user knowledge. If the user knows what should follow I tend to give them as much information as possible so I would show it disabled. If the user is clueless as to what follows I hide as much as possible. Sometimes I do different things on user role and sometimes it depends on the average user of the application and their expected understanding of the underlying issues.
hth,
\ ^ / i l l
Answer: I prefer to disabled the control, so the user can see that he may have something to fill out. But it can be usefull to hide it if you are restricted on space.
It really depends on the situation


generate a sql query for the following output

Question: I have a table account(ID,TransDate,amount,isDebit,balance). Obviously  this is a trimmed down version of my table for sake of clarity. TransDate is the date for which the entry will be made, isDebit is a boolean which tells if this transaction is a DEBIT or CREDIT.
A when a new entry is made it could have a transDate older then the last entry made, so i have to position it in right place and change the balances of all the rows which will be below that position. There I sort the rows by transDate ASC , ID ASC , which gives me the correct order of entries.
Balance will be generated by adding current amount to previous last balance id DEBIT and deducted if current entry is CREDIT.
It has the following last 5 entries sorted by transDate ASC , ID ASC:
account(ID,TransDate,amount,isDebit,balance) as an example
41 | 2011-04-10 | 1000 | 1 | 1000      // as this is the first entry  but not always

37 | 2011-05-14 | 7500 | 1 | 8500

39 | 2011-05-14 | 6500 | 0 | 2000

46 | 2011-05-15 | 1000 | 1 | 3000

Can anyone generate a query(s):
To make a new entry with following details : <ID auto> | 2011-05-9 | 1000 | 1 | <balance>
the query should find that the new entry position is after row with ID 41 and before row ID 37. and also fetches me rows from Id 41 (as this row's balance will be used to calculate the balance for the new row) and below on which i set the new corrected balances.
Or suggest a new method to implement this kind of "ledger accounting".
Answer: Unfortunately, MySQL has no support for window functions, but you might be able to derive a solution from this previous answer involving stored procedures, as SQL Server's window function support is too limited for this kind of query as well: Calculate a Running Total in SQL Server


Can I log time in an RV-12 towards a commercial certificate, and is it a TAA?

Question:
Can I legally log hours flying RV-12 towards commercial airplane rating?

Does RV-12 qualify as a TAA?
Comment: What country are you asking about?
Comment: I've added the FAA regulations tag to your question on the assumption that you're asking about the US (since you mentioned TAA). If that's wrong, please edit your question and/or tag it to indicate the correct country. Please *always* tell us which country or regulations you're asking about.
Answer: Assuming that you are asking about the US, there are two parts to your question-total time and Complex/Turbine/TAA time.
As to whether the RV meets the requirements for a TAA that depends on what instrumentation/avionics it has. If it meets the definition, then you can use if for the training part of the aeronautical experience.

§61.129   Aeronautical experience.
(ii) 10 hours of training in a complex airplane, a turbine-powered
airplane, or a technically advanced airplane (TAA) that meets the
requirements of paragraph (j) of this section, or any combination
thereof. The airplane must be appropriate to land or sea for the
rating sought;

Further down in the reg it tells you what a TAA airplane is:

(j) Technically advanced airplane. Unless otherwise authorized by the
Administrator, a technically advanced airplane must be equipped with
an electronically advanced avionics system that includes the following
installed components:
(1) An electronic Primary Flight Display (PFD) that includes, at a
minimum, an airspeed indicator, turn coordinator, attitude indicator,
heading indicator, altimeter, and vertical speed indicator;
(2) An electronic Multifunction Display (MFD) that includes, at a
minimum, a moving map using Global Positioning System (GPS) navigation
with the aircraft position displayed;
(3) A two axis autopilot integrated with the navigation and heading
guidance system; and
(4) The display elements described in paragraphs (j)(1) and (2) of
this section must be continuously visible.

As for total time, read the regulation. An RV is an airplane so as long as you have at least 50 hours of the 250 in an airplane then you are good. You could do all 250 in the RV if you wanted.

(a) For an airplane single-engine rating. Except as provided in
paragraph (i) of this section, a person who applies for a commercial
pilot certificate with an airplane category and single-engine class
rating must log at least 250 hours of flight time as a pilot that
consists of at least:
(1) 100 hours in powered aircraft, of which 50 hours must be in
airplanes.…

You are no longer required to take the practical test in a complex or TAA airplane, so no matter what instrumentation/avionics it has you can use it for your practical.
Comment: One small point on your final comment: you can indeed do a checkride in an RV-12 but it's an experimental aircraft so [the DPE has to agree first](https://aviation.stackexchange.com/q/47116/62).
Comment: @Pondlife Good point. He would also have to own (or borrow) the aircraft since  expirementals can't be rented out by flight schools for general training.
Comment: A minor point - the "iST" version (i.e. the RV-12iST) is factory built and can have the above mentioned electronic instrumentation. As such, it is not experimental and likely would be a TAA.


What does it mean to be a sharp cookie?

Question: What does it mean to be a sharp cookie? Is it a compliment (because I've never heard of sharp cookie)?
Comment: Have you googled it? I found it in [urban dictionary](http://www.urbandictionary.com/define.php?term=sharp+cookie) and [wiktionary](https://en.wiktionary.org/wiki/sharp_cookie)
Comment: "Sharp cookie"!  That's hilarious.  I have these images of chocolate chip cookies honed like a razor.  Angry cookies to be sure!  I think you're muddling calling someone "one smart cookie" and calling someone "sharp."  Both expressions comment on an individual's intelligence, albeit in slightly different ways.  The former refers to someone's knowledge base, giving them credit for knowing a lot.  The latter refers to cleverness, a mental quickness or an overall aptitude.  "Sharp cookie," indeed!  Now I will go to bed thinking of violent baked goods.
Comment: A far more common collocation is [*a **smart** cookie*](https://www.google.com/search?q=%22a+smart+cookie%22&btnG=Search+Books&tbm=bks&tbo=1) (1220 hits in Google Books, compared to just 333 for [*a **sharp** cookie*](https://www.google.com/search?q=%22a+sharp+cookie%22&btnG=Search+Books&tbm=bks&tbo=1)). But definitions for both forms are easily found online even if you've never encountered usages like [*a **tough** cookie*](https://www.google.com/search?q=%22a+tough+cookie%22&btnG=Search+Books&tbm=bks&tbo=1) before.
Answer: It is not a new expression, according to Ngram it has been used from the '40s. One of the few references available says: (hardly a compliment I'd say)
Sharp cookie: (Wiktionary)

(idiomatic) One who is intelligent, bright, or sharp; especially, one who can identify attempts to deceive or mislead.

She's a sharp cookie and will have no trouble seeing a sales pitch for what it is.

The following extract from World Association of International Studies
 adds:

Randy Black writes: In response to WAIS editor-in-chief John Eipper's post, Deborah Dupire-Nelson commented in her 10 June post that she was having a tough time of it finding a definition of one sharp cookie and its origin.
It's my impression that calling anyone sharp is a compliment and that the cookie part of it goes back to the days when we referred to others as cookie, toots, babe, and other diminutive, affectionate terms. In short, being one sharp, or smart cookie is very high praise. One can also be one tough cookie.
In any event, the idiomatic expression means: One who is intelligent, bright, or sharp; especially, one who can identify attempts to deceive or mislead.

The expression can be found in the  Routledge Dictionary of Modern American Slang and Unconventional English 1954.
Answer: The meaning is clear, perhaps, but tracing the origin is challenging.  Tough cookies are almost as common as sharp and smart cookies, suggesting the key to the etymology lies in tracing the usage of 'cookie' referring to a person.  OED chases it back to the 1920's in the US, and suggests that it associated with both women (1920 Colliers Magazine: That girlfriend of yours is a cookie) and men (1942 American Mercury Magazine: Just about the toughest cookie ever born.)
None of the professions that bear the name cookie seem likely candidates - noting that they include not just chefs, but also (according to the Cassell Dictionary of Slang) those who 'cook' drugs or 'books' (crooked accountants).  A borrowed foreign word, perhaps Yiddish, is a possibility - but I don't have the resources to follow that through.  Tracing back roots in English might lead to 'cuck' (meaning excreta, hence 'cack'), but it doesn't seem to have been in common use for at least a couple of hundred years, and the modern usage (particularly in respect of females) doesn't seem to fit the bill. It is possible that a sharp cookie could refer to a 'clever' crooked accountant (or bookmaker), but again the usual sense is complimentary rather than derogatory.
I think we're left with the weight of (absence of confounding) evidence favouring a derivation from the baked cookie (somehow I'm thinking Yiddish/New York culture again..).  A girl could be a 'sweet cookie', and a man could be 'hard-baked' or tough cookie, and somewhere in there might also belong the 'smart' or 'sharp' cookie.  It's not beyond the bounds of possibility that the 'smart cookie' may have had something to do with the fortune cookie (see Wikipedia for the history of the fortune cookie) which came into being in the 1890's or early 1900's.

What does it mean to be a sharp cookie?


When you return an evolved pokemon to your hand, and you put it back into play, do you have to evolve the pokemon again?

Question: For example, when amoonguss is returned to the hand, and you take it's stage one devolved form with it (foongus), and then you want to put it back into play, do you place amoonguss back in, or foongus?
Answer: You need to put them back into play the same as if they'd never been in.  You may return the Basic Pokémon to the field immediately if you want, but the Stage 1 must be placed on a Basic Pokémon that has been out since before the beginning of the turn.
Comment: Hey thanks for responding! I'm still confused (I'm just a bit slow to understand things), so I'll follow up with this question. I'm editing this comment because I don't know how to reply on this site...

Ok so what I'm confused is with the last sentence. So, I'll list the steps, and if you could correct where I'm wrong, that'd be great.

1.) Put amoongus and foongus back into hand

2.) when placing it back, you put the basic pokemon first (foongus)

3.) Next turn, you evolve foongus into amoongus
Comment: Yes that's correct - unless you have another foongus out already from a prior turn.  That foongus could be evolved this turn into amoongus.


IFDEF equivalent in VBA

Question: I have code that needs to run on both Excel 2003 and Excel 2007, and there are a few spots where changes in the versions cause the code to halt.  I tried separating these lines out with If-Else statements, but the code won't compile on either because it doesn't recognize the code used for the other.  Is there any way I could tell one version to ignore a block of code, similar to a C or C++-style #ifdef, in VBA?
Answer:
This is a good starting point, but it won't work with the version of Excel that its running on, since that can only be figured out at run-time, not compile time.

If you need to branch your code based on information only discoverable at run time you might consider late binding as a solution. There are two ways you can sneak around version problems.
The first way can be used if you need to Access a property or method that only exists in certain versions, you can use CallByName. The advantage of call by name is that it allows you to preserve early binding (and intellisense) for your objects as much as possible.
To give an example, Excel 2007 has a new TintAndShade property. If you wanted to change the color of a range, and for Excel 2007 also ensure TintAndShade was set to 0 you would run into trouble because your code won't compile in Excel 2003 which does not have TintAndShade as a property of the range object. If you access the property that you know is not in all versions using CallByName, you code will compile in all versions fine, but only run in the versions you specify. See below:
Sub Test()
    ColorRange Selection, Excel.Application.version, 6
End Sub
Sub ColorRange(rng As Excel.Range, version As Double, ParamArray args() As Variant)
    With rng.Interior
        .colorIndex = 6
        .Pattern = xlSolid
        If version >= 12# Then
             'Because the property name is stored in a string this will still compile.
             'And it will only get called if the correct version is in use.
            CallByName rng.Interior, "TintAndShade", VbLet, 0
        End If
    End With
End Sub

The second way is for classes that have to be instantiated via "New" and don't even exist in old versions. You won't run into this problem with Excel, but I will give a quickie demo so you can see what I mean:
Imagine that you wanted to do File IO, and for some bizarre reason not all of the computers had the Microsoft Scripting Runtime on them. But for some equally bizarre reason you wanted to make sure it was used whenever it was available. If set a reference to it and use early binding in your code, the code won't compile on systems that don't have the file. So you use late binding instead:
Public Sub test()
    Dim strMyString As String
    Dim strMyPath As String
    strMyPath = "C:\Test\Junk.txt"
    strMyString = "Foo"
    If LenB(Dir("C:\Windows\System32\scrrun.dll")) Then
        WriteString strMyPath, strMyString
    Else
        WriteStringNative strMyPath, strMyString
    End If
End Sub

Public Sub WriteString(ByVal path As String, ByVal value As String)
    Dim fso As Object '<-Use generic object
    'This is late binding:
    Set fso = CreateObject("Scripting.FileSystemObject")
    fso.CreateTextFile(path, True, False).Write value
End Sub

Public Sub WriteStringNative(ByVal path As String, ByVal value As String)
    Dim lngFileNum As Long
    lngFileNum = FreeFile
    If LenB(Dir(path)) Then Kill path
    Open path For Binary Access Write Lock Read Write As #lngFileNum
    Put #lngFileNum, , value
    Close #lngFileNum
End Sub

There is a comprehensive list of all Adds and Changes to Excel Object Model since 2003:
http://msdn.microsoft.com/en-us/library/bb149069.aspx
For changes between 1997 and 2000 go here:
http://msdn.microsoft.com/en-us/library/aa140068(office.10).aspx
Answer: Yes it is possible to do conditional compilation in Excel VBA.  Below is a brief resource and some example code:
Conditional Compilation
#If Win32 Then
    ' Profile String functions:
    Private Declare Function WritePrivateProfileString Lib "KERNEL32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As String) As Long
    Private Declare Function GetPrivateProfileString Lib "KERNEL32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As Any, ByVal lpKeyName As Any, ByVal lpDefault As Any, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
#Else
    ' Profile String functions:
    Private Declare Function WritePrivateProfileString Lib "Kernel" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As String) As Integer
    Private Declare Function GetPrivateProfileString Lib "Kernel" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpDefault As Any, ByVal lpReturnedString As String, ByVal nSize As Integer, ByVal lpFileName As String) As Integer
#End If

Comment: This is a good starting point, but it won't work with the version of Excel that its running on, since that can only be figured out at run-time, not compile time.
Comment: doesn't answer the question, while that will work for general compilation directives the question states how to check the applicatino version of Excel.
Answer: Can you post the offending lines of code?
If it is a constant like vbYes or xlFileFormat or whatever, use the corresponding numeric value.
Show me what you got, I'll see if I can refactor it.
Bill
Comment: This isn't needed -- the code was macro-generated, and the code from 2003 works fine in 2007, so I've just scrapped the 2007 code.

IFDEF equivalent in VBA


How to connect two different technologies in one LTE and DSL

Question: In place where I'm living now, I have a poor internet connection. My download speed is not bad, but upload is poor. I have two broadband providers. First is DSL, or isdn I'm not sure, but I know one think working on annex b. My second provider is LTE -- its a typical SIM card. Several weeks ago I found this website, and now I'm wondering on one thing: is it possible to connect (to unite) two different technologies in one? For example, connect DSL and LTE in one to have the combined download and upload speed? If this is possible what sort of router and dongle for SIM card would I need?
Comment: Consider asking this on SuperUser. We do not answer questions relating to home networking.
Comment: Product recommendations ("shopping questions") are also off topic.
Answer: Multipath TCP (RFC 6824) could be a solution to explore. In my understanding you can split a single session across different technologies, so it should be possible to divide up- and downlink and spread it across different links. That being said, it is an ongoing effort so actually using it requires to employ an experimental Linux kernel module (download and documentation here) and to build a Linux router that operates that way.
Answer: The term is bonding. And no, you, the end user, cannot combine the connections from two different ISPs into one larger pipe. You can load balance between the two, but the speed will be limited to the connection selected.
That said, there are ways to get the same net effect using a 3rd party service. Sort of a "multilink VPN", but I wouldn't recommend it.
Answer: I agree with Ricky Beam that bonding cannot be accomplished with discimilar WAN technologies from different providers. However, you can do some load balancing with fail-over if your firewall is intelligent enough.
Here is a how-to from the pfsense people should give some fairly good insight:
Multi-WAN
Having said all of that, it appears your greatest desire is to increase your individual download speeds and this will not address that directly as  Multi-WAN operates on a connection-based round robin basis.


Temperature rise for multiple layers of PCB

Question: I'd like to better understand what to expect when carrying current on multiple layers of a PCB.  I've used trace width calculators to determine how wide a trace needs to be to carry a given amount of current while limiting temperature rise to a given delta.  Let's say for example that I've calculated a trace width that limits the temperature rise on the top layer to 10 degrees.  Let's say I also have a trace running in the inner layer below it that is intended to limit the temperature rise to 10 degrees.  What is the total temperature rise I should expect?  What happens if I have traces that are expected to limit temperature rise to 10 degrees on all 4 layers of a 4-layer board, or all 6 layers of a 6-layer board?
Answer: It's not an exact science unless you throw the board files into a 3d FEM thermal solver and accurately model the materials.
There are also multiple factors that will determine the temperature rise, such as what the temperature of the traces endpoints (how the heat spreads out horizontally) and what the ambient temperature is. It's also not so much as what the temperature is (simmilar to voltage) as the heat produced in the trace and the heat flow (simmilar to current in the thermal world).
If you have a trace that is 10 degrees in the layer above and the layer below then no heat flow will go between the traces but there will be more heat that will need to spread out into other areas of the board (similar to two voltage sources being the same voltage). In the end it matters how much power you are putting into the board and where it will go.
Comment: Thanks for the input, but this doesn't really help.  (Not saying you're incorrect.)  Just looking for some rules of thumb here.  Maybe the answer is that I need to learn FEM.  However, even though it's not an exact science, we do rely on trace width calculators for single traces.
Comment: What I'm saying is you need to include much more information to do even a ball park answer. The first thing is knowing how much power is dissipated in those traces. You can have a two completely different traces with the same temperature rise but different powers of heat being dissipated in them.


Thermal conductivity and enthalphy data for nitrogen gas

Question: I am struggling to find the data for thermal conductivity and ethalphy of nitrogen gas at reduced pressure (500 mbar). Most of the information is for nitrogen gas at 1 bar or above. Does anyone know where I can find this information? Specifically, I need to know the thermal conductivity and enthalphy of nitrogen at 295.15 K (22 degrees) and pressure of 0.5 bar (500mbar)
Comment: Transport Phenomena, Bird, Stewart, and Lightfoot.  Certainly, under these conditions, N2 can be treated as an ideal gas.  The data at 1 bar are adequate, and the values are not significantly different.
Answer: By way of comparison, using NIST Reference Fluid Thermodynamic and Transport Properties Database (REFPROP) – NIST Standard Reference Database 23, Version 9, I have got a specific enthalpy of $h=306.26\ \mathrm{kJ/kg}$ and thermal conductivity of $\lambda=25.601\ \mathrm{mW/(K\ m)}$ for nitrogen at a temperature of $T=295.15\ \mathrm K$ and a pressure of $p=0.5\ \mathrm{bar}$.
Note that the absolute value of enthalpy at a single state point is meaningless; it is only the difference between two different state points that matters.
Comment: Thanks, I need to find the difference between the enthalpy of nitrogen at two different set-points [(T = 295.15, P = 1 bar) and (T = 308.46, P = 0.5 bar)]. I do not have access to the NIST database. So I tried to look up the values from Perry's Engineering Handbook. I have the table for the enthalpy values but it only gives me values at certain conditions. I obtained the enthalpy for (T = 295.15, P = 1 bar), which is 306.168 kJ/kg. **It would be really helpful if you could check the enthalpy at (T = 308.46, P = 0.5 bar)**
Answer: The thermal conductivity is largely independent of pressure. Values for nitrogen gas at 1 atm. are (in units of $10^{-2}$ W/m/K ) 1.59 at 173.2 K, 2.40 at 273.2 and 3.09 at 373.2 K.
The values are independent of pressure because conductivity is, from kinetic theory of gases, $\kappa = n\bar v s k_B \lambda_m/6$ where $n$ is the number density of molecules, $s$ the number of translational degrees of freedom, 3, $\bar v$ the mean speed of the gas and $\lambda_m$ the mean free path. (This equation can be re-written as $\displaystyle \kappa=\frac{\bar v sk_B}{6\sqrt{2}\pi r^2}$ where $r$ is the molecular radius which shows that $\kappa$ has no pressure dependence )
The conductivity will be greatest when there are more molecules to carry the energy (large $n$) and when they can travel unrestricted through the gas, large $\lambda_m$.  However, these two terms are in inverse relationship and exactly cancel one another and hence thermal conductivity is largely independent of pressure. The range turns out to be from about $10^3 \to 10^6 $ Pa.


IIR System Identification Difficult Problem

Question: Identifying IIR systems is considered a difficult problem and different approaches have been proposed. Why is it considered difficult? I would like to find an accessible discussion of the problem (a link to an academic paper online would be ideal). Is there a good discussion somewhere?
Answer:
Identifying IIR systems is considered a difficult problem

This really depends on the specifics. Sometimes, it's easy, sometimes it's difficult.

Why is it considered difficult?

It tends to get difficult if the order of the filter is high, if there is a lot of detail at low frequencies and if the target phase is inherently non-causal.
The first two are related to the fact that most of the standard algorithms (such as Matlab's invfreqz() operate in the "transfer function domain" which at some point needs to be converted to poles and zeros. This involves finding the roots of a polynomial which is numerically difficult, especially if the order is high and the roots are close together.
As a simple example let's design a 8th order Butterworth highpass filter at 40 Hz sampled at 48 kHz (which is a typical filter you can find in a HIFI speaker).
We design as poles and zeros, then convert to transfer function and then back again to poles and zeros.

We can see that originally all zeros are at $z=1$ and the poles are on an ellipse inside the unit circle. After the back and forth conversion, both poles and zeroes have moved quite a bit. In fact, some of the poles are now outside the unit circle and the resulting filter is unstable.
A more mathematical view would be that the algorithms are based on solving a least squared error problem and that in some cases the error surface is extremely steep and badly shaped. For filters that are often used in audio, it's not unusual to see gradients that are 10 or more orders of magnitude larger than the actual coefficients). The resulting matrices are often poorly conditioned and iterative search algorithms have trouble converging.
The "causality" argument is more complicated, so I'm going to skip it here. In conclusion, there are effective methods of IIR system identification but they are cases where the "simple" algorithms fail miserably and the there is no "one size fits" all work-around. Most more advanced algorithms are tailored & optimized to the specific class of systems and problems that you are trying to solve.
%% design 8th order BW high pass
fs = 48000;
[z,p,k] = butter(8,2*40/fs,'high');
% convert to transfer function
[b1,a1] = zp2tf(z,p,k);
% convert back to poles and zeros
[z1,p1,k1] = tf2zp(b1,a1);
% and plot it
clf;
zplaneplot([z z1],[p p1]);
grid('on');
lims = .03*[-1 1];
set(gca,'xlim',1+lims);
set(gca,'ylim',lims);
legend('original','after conversion');
title('8th order BW highpass @48kHz');

Comment: Thank you. It is good to know I can't be expected to find a one size fits all approach. Is there a reference - book or paper - I could cite that recognizes this?
Comment: @TobiasCarlson one option is to simply [quote Hilmar's answer](https://math.meta.stackexchange.com/questions/4259/do-i-cite-mathematics-stack-exchange-in-my-thesis-paper).
Comment: What someone can reasonably expect depends on the specific circumstances and requirements. I sincerely doubt that anyone asked the OP to provide IIR system identification that work under any and all circumstance to a high degree of accuracy. Even if someone did, a simple clarification question can go a long way.
Comment: The problem was given in completely general terms for FIR and IIR filters. No suggestion that a patchwork of approaches to identifying IIR filters is necessary because any individual approach would fail radically for some subset of filters.


Could not fetch chain ID. Is your RPC URL correct?

Question:
I want to connect local ethereum network to metamask , it says that it need chain id but when i entered the chain id for local node it shows the error "Could not fetch chain ID. Is your RPC URL correct?" I am running geth consol on local pc. What should i do ? thank you
Comment: Can you paste the command you are using to start geth?
Comment: geth --port 30303 --networkid 1234 --nodiscover --datadir=$ethereum_home/paradox  --rpc --rpcport 8545  --rpccorsdomain "http://localhost:8000"  --allow-insecure-unlock --ethstats paradox:s3cr3t@localhost:3000  --rpcapi "eth,net,web3,personal,miner"
Comment: I tried --rpcorsdomain "*" and also tried to set network id and chain id same. But did not work
Comment: You are starting that local node, and then trying to connect to it from MetaMask? And MetaMask gives you that error?
Comment: That is right , I started node and deployed contract on local ethereum , then I went to the front end of that contract to make a transaction and for that transaction to complete i need metamask. so I added custom RPC and it was long before the metamask update back then it worked very well but now it is asking for ChainId and when i am entering , it gives error. I tried both Hex and Decimal value of chainId
Comment: Did anybody find a solution? I'm running into the same problem. I **can** connect from my Windows 10 to the Ethereum node running under WSL with *geth* (running under Windows) without problems, but MetaMask shows the error *"Could not fetch chain ID. Is your RPC URL correct?"*
Answer: You seem to have started geth with networkid 1234 and then are trying to reach it on id 4224.
Try connecting it to 1234 (or set networkid to 4224 in geth)
Comment: The chainId and networkId are different.
Answer: SOLVED: I just had to change "localhost" to "127.0.0.1" in RPC url.
Comment: would be nice of you to mark your solution as an accepted answer
Answer: If you happen to be using Ganache in combination with WSL, then you may have to adjust your settings accordingly:

In Ganache, go to Settings => Server
In the HOSTNAME dropdown box, select the network interface with (WSL) at the end, e.g. 172.29.64.1 - vEthernet (WSL)
Click on the SAVE AND RESTART button

Change your truffle-config.js to reflect the changed IP address, e.g.:
module.exports = {
  // See <http://truffleframework.com/docs/advanced/configuration>
  // for more about customizing your Truffle configuration!
  networks: {
    development: {
      host: "172.29.64.1",
      port: 7545,
      network_id: "*" // Match any network id
    },
    develop: {
      port: 8545
    }
  }
};

In Metamask, use the following settings for the Custom RPC:

New RPC URL http://172.29.64.1:7545
Chain ID 1337

The Chain ID must be set in Metamask and is configured according to this information:

--chainId: Specify the Chain ID ganache-cli will use for eth_chainId RPC and the CHAINID opcode. For legacy reasons, the default is currently 1337 for eth_chainId RPC and 1 for the CHAINID opcode. Setting this flag will align the chainId values. This will be fixed in the next major version of ganache-cli and ganache-core!

Possibly this will change in the future, but at the moment it's the setting that works.
Answer: The issue here is that you need to add --http.corsdomain=* --http.vhosts=*
Answer: You have to change the localhost to a loopback ip address with the port e.g HTTP://127.0.0.1:7545 that is whatever your Ganache RPC SERVER IS


XMPP BOSH Response issue

Question: I am new with XMPP web client and bosh. I am using stropher js for chat demo.
On my server punjab bosh installed successfully. I am sending below request for connection establish in post on bosh server url.
Request :

Response :

And giving me continuous status as a connecting  and when response get from above request its would send automatically new below request data.
Request

Response :

and continuous send above request and getting above response. I tried with different different demo. But every where i am getting same type of data.
I am not getting why my login credentials authentication not performing.
Please help me...!!
Thanks in advance..!!
Answer: You're not done. Once you get the SID back from the server, you need to authenticate, restart, bind the resource, restart, etc. See http://xmpp.org/extensions/xep-0206.html.

XMPP BOSH Response issue


How To Improve?

Question: Could it really be possible for a rider, like me (who is fat but loves cycling) to improve his skills and gain stability for riding a good mile? If Yes, How?
Comment: I assume you mean *improve* and not *improvise*. Yes, and we've got [quite a lot of questions on the subject under the *beginner* tag](https://bicycles.stackexchange.com/questions/tagged/beginner?mixed=1)
Comment: The only thing you need to do is to get on a bike and ride.  That single set of actions puts you ahead of everyone else who doesn't/can't/won't ride.   And do it again the next day.... repeat.
Comment: What do you mean by "ride a good mile"?  Do you mean being able to go a mile, or do you mean improving your speed in sprinting a mile?  Either way, the answer is still yes.  The human body has an amazing ability to strengthen and become more capable in response to repeated stress of appropriate difficulty -- not too easy, not too hard -- with appropriate rest and nutrition.  You can think of it as signaling or sending a message to your body: when you repeatedly stress your body, you're telling it, this is something you want to get better at.  And then you do.
Comment: just gotta keep riding
Answer: Yes, stick to it and keep doing it, each time will get you that much closer to your goal. It is very possible, start slow and stay dedicated.
Answer: I actually am jealous of where you are! At your stage of training, you will see enormous improvements in your fitness and athletic performance by any measure you like, in a short period of time and without much effort. I haven't seen 100% or 200% improvements in anything in a six month period in probably 20 years.
At the stage I'm at, on the other hand, I have to put in a Herculean effort to see even small performance gains. Thankfully, I bike because I like it. :)

How To Improve?