How to prepare Adapter For Showing ImageView Instead TextView upon need

Question: i have a ListView for my Chat app, some Times i need to remove the TextView and Load an Image Depending on Data Input, for Achieving that i have some idea's and i have already tried one, but listview Messes Up when i add Images , any way, thought may be Could use Some Experience From Some nice people please about What is the right Way to do so? they ways that i thought are these:
1.Create 2 ViewHolders and ConvertViews set's, and load 1 set each time
2.have imageView in the listView as Invisible , and visible it on need (This one i tried but failed like said)
please if you could give me a tip or help i really appreciate, thanks Alot
a Part of What i have already tried:
<code>     @Override
 public int getCount() {
return mCursor.getCount();
}

@Override
public Object getItem(int position) {
return mCursor.getString(position);
}

@Override
public long getItemId(int position) {
return mCursor.getPosition();
}

@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder = null;
if (convertView == null) {
    holder = new ViewHolder();
    convertView = mLayoutInflater.inflate(R.layout.listitem_discuss, null);
    this.convertview=convertView;

System.out.println("ConverView null");

holder.PimageView = (ImageView)convertView.findViewById(R.id.PimageView);
//PimageView is the One i have Problem With, it gets Visible When Inputs are Images
holder.wrapper = (LinearLayout) convertView.findViewById(R.id.wrapper);
//wrapper is my LinearLayout child of FrameLayout
holder.theMessage = (TextView) convertView.findViewById(R.id.comment);
holder.theName = (TextView) convertView.findViewById(R.id.MSGname);
holder.theImage = (ImageView)convertView.findViewById(R.id.MSGimage);
holder.lp = (FrameLayout.LayoutParams) holder.theName.getLayoutParams();
holder.paramsleft = new FrameLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT,Gravity.LEFT);
holder.paramsright = new   FrameLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT,Gravity.RIGHT);

convertView.setTag(holder);

}else {
   holder = (ViewHolder) convertView.getTag();
}

mCursor.moveToPosition(position);
String imagenamer=
(mCursor.getString(mCursor.getColumnIndex("username")).split("\\@"))[0];
int isright= Integer.valueOf(mCursor.getString(mCursor.getColumnIndex("isright")));

if(!"".equals(mCursor.getString(mCursor.getColumnIndex("isfile")))){
 System.out.println("its a file");
String type=(mCursor.getString(mCursor.getColumnIndex("isfile")).split("\\@ADAT")
[0]);
System.out.println("Type:"+type);
switch (type) {
case "image":
        //theMessage is replaced with PimageView and so TheView
        holder.theMessage.setVisibility(View.GONE);
        holder.PimageView.setVisibility(View.VISIBLE);
        System.out.println("its an image");
        holder.PimageView.setLayoutParams(new
LinearLayout.LayoutParams(PViewWidth,LayoutParams.WRAP_CONTENT));
if(isright==0){
holder.PimageView.setBackgroundResource(R.drawable.bubble_yellow);

}else{
holder.PimageView.setBackgroundResource(R.drawable.bubble_yellow);

 }
</code>
but ListView messes up positions upon scroll
Answer: You have two options.  One is going the visible/invisible route.  If you go this route, you'll have to make the proper view visible and invisible on every call to getView(), and your getView will need to know which one to go with.
Option two is a totally custom Adapter based off of Adapter.  Specifically you'll need to overload getViewTypeCount() and getItemViewType() in addition to the normal functions.  I'd probably go with route 1 for such a simple view, this option is better for complex views.
Comment: well i extacly did first one, take a look please i add the code
Comment: You really need to format that code.  But I don't see you setting the correct visibilities in the case of it being text.  You need to set them on both.  Other than that, tell me what problems you're seeing.
Comment: imageView is already "gone" in the xml, thats why, and this is just a part of it, since i have like 8 conditions like this , problem is for example if i should have 2 images on my list, i have 4, and whenever i scroll up and down it gets even more messed up resulting all textview's are removed and imageViews taken their places
Comment: Doesn't matter if its gone in the xml.  WHen you scroll, views are recycled.  You must set EVERY setting of EVERY field on each call to get view-  that means all texts, all images, and all visibilities.
Comment: that was not extact reason or solution, but it helped to help me fix recyclying a little more, so i accept the answer ty


To whom do we owe this construction of angles and trigonometry?

Question: I've come across what is, to me, the most precise, beautiful and thorough definition of what we know of as the angle between two vectors. I say this because most literature either skims over things and starts talking about angles all of the sudden, or uses a contrived definition like  the unique  $\theta\in[0,\pi]$ such that  $\|u\|\|v\|\cos\theta = u\cdot v$. Yes it works fine, but it leaves me quite unsatisfied; I should like to already have an "intrinsic" definition of an angle, and then let the cosine function be defined to tell me things about angles. Why, the other way around we have to define cosine by some magical power series, and then it turns out that the above definition makes angles behave as they should! To me it seems disingenuous, but thoughts on this are welcome.
Anyway, the construction comes from a book called Àlgebra Lineal i Geometria (Castellet/Llerena), and I'd like to know if anyone has seen it, other than in this book of course. I'll post the beginning of the section (translated from Catalan, and paraphrased):

Let $(E,\langle\cdot,\cdot\rangle)$ be a $2$-dimensional Euclidean space. In the set of pairs of unit vectors, define the equivalence relationship $$(u,u')\sim(v,v') \iff \exists f\in SO(2) : f(u)=v,\, f(u') = v'$$
This condition is proven to be equivalent to $\exists g\in SO(2) : g(u)=u',\, g(v) = v'$. We define an angle as one of these equivalence classes. We denote the class represented by $(u,u')$ as $[(u,u')] = \widehat{uu'}$. This can be easily extended to $E\times E$ by defining $\widehat{uv}$ as the angle defined by $\frac{u}{\|u\|},\frac{v}{\|v\|}$. Call the set of angles $A =E\times E_{\large{/\sim}}$ and for any $u\in E$ define a map $$SO(2)\longrightarrow A \atop \qquad\qquad\, f\mapsto \widehat{uf(u)}$$ This is in fact a bijection, and allows us to transport the operation in $SO(2)$ to  $A$: given $\alpha,\beta\in A$ with preimages $f,g$ respectively, define the sum $\alpha+\beta$ as the image of $f\circ g$. In class notation: $$\left.\begin{align}&\alpha = [(u,f(u))] \\ &\beta = [(f(u),gf(u))]\end{align}\right\}\Rightarrow \alpha+\beta = [(u,gf(u))]$$
Naturally, this sum has the same properties in $A$ as does the operation in $SO(2)$. $A$ is then an abelian group, whose identity is $0 = \widehat{uu}$. The inverse, or opposite angle of $\widehat{uf(u)}$ is $\widehat{f(u)u}$.

Here comes the fun part.

By fixing an orientation on $E$, each $f\in SO(2)$ has a corresponding matrix $$\left(\begin{array}{ccc}a & -b \\ b & a\end{array}\right)\text{ with } a^2+b^2 = 1$$ Let $\alpha$ be the angle corresponding to $f$. We define the cosine, and the sine, of $\alpha$ by $$\cos\alpha = a\qquad \sin\alpha = b$$

Too clever. And it gets better:

We'll make a couple of observations now about this definition. Firstly, in changing the orientation of $E$ the sign of $\sin\alpha$ changes, but not $\cos\alpha$.
One has $$\cos0 = 1\qquad \sin0 = 0$$ since the angle $0$ corresponds to $\mathrm{id}$.
The angle $-\alpha$ (the opposite wrt the sum) corresponds to $f^{-1}$, whose matrix is the transpose of $f$'s matrix; therefore: $$\cos(-\alpha) = \cos\alpha\qquad \sin(-\alpha) = -\sin(\alpha)$$
The angle $\alpha + \beta$ corresponds to the composition of their respective maps. Thus, matrix multiplication gives: $$\begin{align}\cos(\alpha+\beta) = \cos\alpha\cos\beta-\sin\alpha\sin\beta \\ \sin(\alpha+\beta) = \sin\alpha\cos\beta+\cos\alpha\sin\beta\end{align}$$

To finish I'll put some subsequent propositions without proofs.

There exists one, and only one angle $\pi$ such that $\pi+\pi = 0$. $\pi$ is the angle such that $\cos\pi = -1$ and $\sin\pi = 0$.
 There exist two, and only two angles  $\delta_1,\delta_2$  such that  $\delta_i + \delta_i = \pi$. $\delta_i$ are the angles such that $\cos\delta_1 = \cos\delta_2 = 0$  and  $\sin\delta_1 = -\sin\delta_2 = 1$.  We call these right angles.
$\widehat{uv}$  is a right angle iff  $\langle u,v\rangle = 0$

The text continues proving things like these. My question is whether anyone has seen this, or a similar extensive treatment. Also though, I'm interested in finding any text that formally links the primitive angles, sine and cosine from geometry to the sine and cosine we now all know and love from calculus, or even complex analysis, preferably with geometry as a starting point.
Notes:

Obviously there are well definedness issues to address. It seems this is left to the reader.
Should I post this on mathoverflow? I've never used it but something tells me a bibliographic inquiry like this one could fit.
Unfortunately, angles are now abstract objects, and we haven't at all defined the sine or cosine of a real number, so I'm thinking of a way to map real numbers to angles. Any comment on this would be appreciated!
Comment: I absolutely agree that the power series definition of cosines is very unsatisfying, and I really enjoyed reading this. As a tutor, the way I tell my students about sine and cosine is in terms of projection to the axes of the points of the unit circle. This does not answer the question about an intrinsic notion of angle, but it is definitely better than a power series, in the sense that it maps points around a circumference (which can be perhaps naively understood as an angle) to values in [-1,1].
Comment: Very sexy. Thanks for sharing!
Comment: @DavidH I'm glad you enjoyed it.
Comment: FWIW, the book 'Elementary Geometry from an Advanced Standpoint' by Edwin E. Moise might interest you: http://www.cross-reference-kingdom.com/temo-elementary-geometry-from-an-advanced-standpoint.html
Comment: @GPerez, how do they define $\operatorname{SO}(2)$ in that book?
Comment: @OskarLimka Well, they define $\operatorname O(2)$ as the set of orthogonal maps, and $\operatorname{SO}(2)$ are those with positive determinant. Fairly standard, no?
Comment: @GPerez, thanks, I know the standard definition, but I got the impression that you were trying to avoid the standard way (determinants and the "usual" algebraic approach). The approach you're citing seems to be like minded, but I couldn't trace the book... I think I can handle the Catalan :-)
Comment: @GPerez, it is possible to avoid the determinant, by using the linear map $\dot I$ such that $\dot Ie^1=e^2$ and $\dot Ie^2=-e^1$ for a given "positively oriented orthonormal basis" (we're ok with "orthonormal" as we have the inner product $\langle\cdot,\cdot\rangle$, and I presume "positively" is arbitrary but once it's settled for one basis it follows for all others and it is not hard to check that $\dot I$ is invariant.). Then you can define $\operatorname{SO(2)}$ to be the linear maps that preserve $\langle u,v\rangle$ and $\langle \dot Iu,v\rangle$ (which is the determinant in disguise).
Answer: Yes. In fact, $\operatorname{SO}(2)$ is isomorphic to $S^1$ (the circle) as a subset of $\mathbb{C}$.  An amusing way of seeing this is to consider all the $2\times 2$ matrices of the form $$Z:=\begin{bmatrix}a&-b\\b&a\end{bmatrix}$$ for any choice of $a,b\in\mathbb{R}$.  Exercise: check that the set of all such matrices is closed under addition and matrix multiplication and thus forms a so-called algebra, whose only singular element is $(0,0)$.  In fact this algebra is isomorphic to $\mathbb{C}$. Now you will recall from basic complex arithmetic that any complex number $z=a+ib$ can be written as $z=\rho e^{i\theta}$ where $\rho^2=a^2+b^2$, $\rho>0$ and $\cos\theta=a/\rho$, $\sin\theta=b/\rho$, $\theta\in[0,2\pi)$ are uniquely determined, but there is always something upsetting about this approach. Think instead of the complex number $z$ as a matrix $Z$ of the above form, then $\rho^2=\det Z$ and $\exp(\theta J)=Z/\rho$ where the $\exp$ function of matrices is defined as a power series (of matrices)
$$\exp(M):=I+M+\frac{M^2}2+\frac{M^3}{3!}+\dotsb$$
and $$J=\begin{bmatrix}0&-1\\1&0\end{bmatrix}\text{ hence }
Z=\sqrt{\det Z}\exp(\theta J).$$ If you don't like that exponential, just think of it as
$$Z=\sqrt{\det Z} E\text{ for some matrix }E.$$
Now thinking geometrically, a matrix $Z$ of the above form represents a linear transformation in the plane and $\det Z$ is the corresponding transformation of area, so $\sqrt{\det Z}$ is the change in length, provided length changes uniformly in all directions (isotropic). But isotropic change occurs if and only if angles (or their cosines) are preserved by the linear transformation... and they are, take two vectors $u,v\in\mathbb R^2$
and check that $u^*Z^*Zv=\det Z\,u^*v$.  So in fact, the matrices $Z$ are nothing but a stretching by $\sqrt{\det Z}$ combined with a rotation $E:=Z/\sqrt{\det{Z}}$. (At this point you see that this rotation $E$ corresponds to one of angle $\theta$, but you don't need to think of $\theta$ yet.) If you impose the extra constraint that $\det Z=1$, the transformations $Z$ describe all possible rotations in the plane.  The set of matrices of the form of $Z$ with $\det Z=1$ is known as $\operatorname{SO}(2)$ and this shows that it is isomorphic to the circle $S^1$.
If you prefer complex analysis, you may introduce the so called unitary group of order $1$, $\operatorname{U}(1)$ by taking all complex numbers $z$ of unit length $|z|=1$.  But as we've seen above this is nothing but $\operatorname{SO}(2)$ viewed from a different angle (pun unintended).
I'm not sure this clarifies things, but I find it fascinating to introduce complex numbers in this geometric way, as orientation-preserving linear and conformal (OPLAC) mappings, i.e., as plane transformations (mappings) that preserve orientation, straight lines (linear) and angles (conformal), rather than the mechanical $i^2=-1$ algebraic way.
To finish, let's revisit the matrix exponential function. If $L$ is an OPLAC map let's look at $\exp L$.  First we may decompose
\begin{equation}
L=\begin{bmatrix}m&-n\\n&m\end{bmatrix}
=\begin{bmatrix}m&0\\0&m\end{bmatrix}+\begin{bmatrix}0&-n\\n&0\end{bmatrix}
=mI+nJ,\text{ with $J$ as above}.
\end{equation}
Since $I$ and $J$ commute (check) it follows that
\begin{equation}
\exp L=\exp(mI)\exp(nJ)=e^m\exp(nJ).
\end{equation}
Now given another OPLAC map $Z$ one may ask the question of whether it is possible to find $L$ such that $Z=\exp L$.  If $Z=0$, no chance.  But if $Z\neq0$
it is sufficient to take $m=\log\sqrt{\det Z}$ and $n$ such that $\exp(nJ)=Z/\sqrt{\det Z}$.  Working out the exponential we see Euler's formula in matrix form:
\begin{equation}
\exp(nJ)
=
I+nJ+\frac{n^2J^2}2+\frac{n^3J^3}{3!}+\frac{n^4J^4}{4!}+\dotsb
\\
=
I+nJ-\frac{n^2I}2-\frac{n^3J}{3!}+\frac{n^4I}{4!}+\dotsb
\\
=
(\cos n)I+(\sin n)J
.
\end{equation}
Again this connects to the rotation and the trigonometry, but by using the cosine and sine as power series.
Comment: Thank you for the response! I feel sort of bad in saying this (because your post is certainly interesting), but I have more or less received what you post here throughout my education. What I meant by my question, was not so much this "intuitive" link, rather an actual *formality* (such as the one in my post) that connects the geometric (classical, if you wish) trigonometry to the modern power series.

P.S. My favorite definition is the shamelessly algebraic $\Bbb C = \Bbb R[X]/\langle X^2 + 1\rangle$ :P (Although $\Bbb R$ isn't necessarily a purely algebraic concept)
Comment: I'm afraid you can't escape the fact that when connecting an angle to cos (or more generally a complex to its exponential) you need to take a limit of some kind. If you don't like the power series, you can define $$\exp(\theta J):=\lim_{\mathbb N\ni k\to\infty}(1+\theta J/k)^k;$$ or use linear differential equations $\dot z(t)=cz(t)$, $t$ real and $c$ complex constant in $t$, e.g., $c=\theta\operatorname i$.
Answer: Note that you have an oriented angle: $(u,v)$ and $(v,u)$ will be distinct angles unless $v = \pm u.$
That problem disappears if you start considering pairs of unit vectors in $\mathbb R^3$ and $SO(3).$
I believe the notion originates with Xavi Hernandez of FC Barcelona.
Comment: Really? $SO(3)$ is trickier for me I will admit, but I'll give it a shot. Also... what??
Comment: @GPerez, I mentioned Xavi because you said you were translating from Catalan. I have no idea how this version originated, it may be due to these authors. You do not need to calculate with SO(3), just take two sticks of the same length and glue them together at an angle, paint one red and one blue. On a flat tabletop, you cannot reverse the colors. If you pick up the sticks, rotate a bit in the air, and put back down in the correct way, you can reverse the colors. This is dealt with in an old book called Flatland.
Comment: Ah, I thought that was the joke but I wasn't sure if I was missing a very intricate pun of some sort. Anyways, thanks!
Comment: I guess you need $\mathbb R^3\times\operatorname{SO(3)}$ to describe the motion of a spinning football. Not sure Xavi is into that sort of thing though... his approach seems to be more "intuitive".


PHP Session string limit

Question: Is there a length limit to a string that can be placed into $_SESSION with PHP?
Thanks
Comment: If you are asking such a question, you are doing something wrong
Answer: The size of string is limited by the amount of memory available on the server. Whether that string can be successfully stored in a session would depend on the session storage mechanism in use.
If you're using the out-of-the-box file based session storage, then the it's likely you can write a file which is larger than the amount of available memory. If however you were using, say, memcache, then you might be more limited.
However, practically speaking, if you're storing so much in a session you have ask this question, you're probably abusing sessions!
Sessions should contain only that which you really want to have readily available for virtually every PHP request your application handles - typical examples would be a user name, user id or privilege level. When your app needs something bigger occasionally, it can go and grab it from another storage system.
Comment: I was thinking of running a query on user login and storing ID's of all members that this user follows, so that when I need to retreive their records, which I will for sure I don't have to query the db again. I'm thinking just up to 50-100 4-5 digit long ids.
Comment: That's fairly small. If you need it on every page, then go for it. Otherwise, I'd suggest just caching that elsewhere.
Answer: It depends on the session_save_handler used. For the default one, there is in theory no limit (or a very, very high one, dictated by the file system), because session data is saved in files.
Seeing as session data is imported on every request, however, there is an effective limit imposed by the maximum amount of memory the script is allowed to occupy. It is wise not to store more than a few kilobytes in there.
If you need to save large chunks of data, store it in temporary files (named after the current session) instead.
Comment: I like this idea of storing in files. Actually I have a few pages that have heavy db driven content, that I update only nightly. I store those in include txt files which improved my loading speed drastically. Thanks.

PHP Session string limit


What is the difference in overlay and framebuffer?

Question: I have been trying to understand display and graphics. I feel that it's hard to make a logical image of the terms. I understand this:

Frame buffer is a dedicated memory that has the image/video/3dimage or video to be shown, in pixel format.
Overlay is some kind of hardware that is used with the frame buffer.
Surfaceflinger is a composition manager. It takes rendered data from the GPU, and composites them in one surface. That means, it uses the underlying hardware and driver to do all this composition.
Composition means blending, mixing of all the surfaces.
Overlay, plane, framebuffer and sprite? What does all this do, or how to combine them and understand?

Any book, links will be appreciated. A lot of books go to graphics way, instead of taking one particular SoC and explain display first then graphics in detail.
Answer: As you've understood, the framebuffer is an array in memory that holds all the pixels to display on the screen. On a desktop PC, it's probably special memory on the graphics card, but in a SoC with one memory shared by GPU and CPU, it's probably a normal memory allocation that the display controller uses DMA to read from.
The display controller is a piece of hardware that reads pixels from the frame buffer and displays them on the physical screen.
Many display controllers support the use of an overlay, which is like a very simple window. Sometimes they're fixed-size, but sometimes they're masked off. In this case, then there might be a secondary framebuffer that covers the whole screen. When the display controller reads a pixel of a particular colour from the primary framebuffer, then instead of displaying that pixel, it substitutes the corresponding pixel from the secondary framebuffer. It's like the chroma key or green screen technique used in movie effects and weather forecasts.
That's one particular configuration: sometimes the secondary framebuffer is much smaller than the primary framebuffer, and a particular register in the display controller controls the dimensions and offset.
The overlay technique is commonly used for displaying video streams. The frames of video might be coming from camera hardware or from video decoder hardware. Using an overlay means that this hardware and the GPU that's producing the rest of the screen (such as camera or playback GUI) aren't trying to access the same memory at once. The overlay might also be in a different pixel format to the primary framebuffer.
The overlay technique only lets you do this simple substitution, though (and maybe some scaling), not anything complicated. You can't make the frame of video spin around and shrink to an icon when you're transitioning between different applications. You can't alpha-blend the video with the primary framebuffer. Also, the number of overlays is limited by the hardware: usually one, but some controllers support two.
Composition in this context refers to something the window manager does. It takes the frames from each application on the screen (the system GUI is also an application), and produces the final frame. On a smartphone, this usually means just taking the current foreground app and the system GUI (notification bar and navigation bar) and drawing them next to each other. But when there are transitions between apps, or if you use the "recent tasks" button, the situation is more complicated. The compositor also has to handle choreographing applications so the screen gets updated at 60 Hz even if applications are drawing at different rates.
Surface Flinger is Android's compositor. It uses OpenGL ES to do the things described in the previous paragraph. It's also in charge of creating a framebuffer for each application to render into. (These framebuffers show up as textures inside Surface Flinger, using EGLImage.)
Android also detects when there are simple cases that the display controller on the phone can handle as an overlay, so that it can switch to the faster, more energy-efficient path of using the overlay instead of using Surface Flinger's full GLES-based composition.
Comment: Is there any image or picture with all of these components working together?
Comment: @mrigendra Every frame displayed on your Android phone shows these components working together! Seriously, if you mean a diagram, I don't know of one.


EnvStats simulateVector function

Question: I'm using the EnvStats package more specifically the simulateVector function to generate random samples from pdf's.
I've tried using a Normal pdf and varying the parameters that truncate this pdf:
> vfy <- simulateVector(10, distribution = "norm",
+                param.list = list(mean = 400, sd = 40), seed = 47,
+                sort = FALSE, left.tail.cutoff = 1, right.tail.cutoff = 1)
> vfy
 [1] 479.7879 428.4457 407.4162 388.7294 404.3510 356.5705 360.5807 400.6052 389.9182 341.3700
> vfy <- simulateVector(10, distribution = "norm",
+                param.list = list(mean = 400, sd = 40), seed = 47,
+                sort = FALSE, left.tail.cutoff = 0, right.tail.cutoff = 0)
> vfy
 [1] 479.7879 428.4457 407.4162 388.7294 404.3510 356.5705 360.5807 400.6052 389.9182 341.3700

For my surprise the results do not vary.... What's wrong? Thanks
Answer: The left.tail.cutoff and right.tail.cutoff arguments are only relevant when you use sample.method = "LHS" for Latin Hypercube sampling.
The default is sample.method = "SRS" for simple random sampling, which uses the rnomr() function. The help file states "This argument is ignored if sample.method="SRS"."
See ?simulateVector() for the default arguments.
Comment: Thanks! I thought LHS was the default sampling method. By the way do you know how can one specify lower and upper limit values instead of percentages? Thanks
Comment: No, sorry. I don't think you can specify lower and upper limit values directly. You might have to calculate the expected probability of the values based on the distribution you're using.

EnvStats simulateVector function


Typescript undefined is not an object when pushing to array

Question: I am trying to push to an array but it keeps giving me this error:
Uncaught (in promise): TypeError: Cannot read property 'push' of undefined
TypeError: Cannot read property 'push' of undefined

here is the source where I am simply adding to an array. I take the obsevable from the firestore collection and loop through it. Why is it giving me this error when the array of category objects is right there. categories: Category[];
transactions: Observable<Transaction[]>;
categories: Category[];

private organizeData() {
    let category: Category;

    this.transactions.forEach(v => {
      for (let i = 0; i < v.length; i++) {
        category = {name: v[i].category, totalSpent: v[i].amount};
        this.categories.push(category);
      }
    });
  }

Answer: categories: Category[] is just the declaration of an array, you need to actually create a new array and assign it to the field:
categories: Category[] = []

Answer: You are not initiating your array categories so it will return undefined. Try:
categories: Category[] = [];


Having multiple IFrames in a single page

Question: I have an application which takes in users' HTML from an editor like CKEditor and display them back to the user in a list.
To be safe, as in to avoid breaking the container page's html structure by mal-formed html input, i want to render each user's html input in an iframe (iframe will render from a URL).
The container page will just have a list of frames each with users html. They will be sized to a height of 100px or so to accommodate multiple inputs in a list.
My question is:
1.) how good of an idea is it to render potentially hundreds of iFrames in a single page ? Will the memory usage blow-up the end users browser ?
2.) Is there a safer and easier way to render user's html ? I want to put as few restrictions as possible on user's input.
[I will of course sanitize all the input on the server before sending it back to client.]
Answer: The iFrame is exactly what you are looking for.
Why would you render 100+ iFrames? As I understood, you want to paste the content of a users "page" to your page - so just make it one site per "user Site" ...
If you want to display all iFrames on one site, it would be a potential huge ass Website but as everying is static, it should'nt be a problem.
Comment: Think of it like stack overflow or a forum, when u r replying, you are entering HTML. in a thread, there could be hundreds of replies. my use-case is somewhat similar. I am not sure what you mean by one site per user site..
Comment: I thought about something like JSBin (which is also made with iFrames) but in a forum you can limit the iFrames per Site by limitting the answers per page.


What effect does the variance of a sequence of random variables $\{X_n\}$ have on their uniform integrability?

Question: I am wondering how the variance of a sequence of random variables affects their uniform integrability.
Let $\{X_n\}$ be a set of normally distributed random variables with mean 0 and an $n$ dependent variance function $\sigma^2(n)$:
$$
X_n \sim \mathcal{N}(0,\sigma^2(n)).
$$
For what type of function $\sigma^2(n)$ will $\{X_n\}$ not be uniformly integrable? Will a fast decay, or a fast growth of $\sigma^2(n)$ affect the uniform integrability? Or is $\{X_n\}$ always uniformly integrable no matter how the variance changes with n?
Answer: If I did not make any computation mistake, we have
\begin{align*}\forall a\geq 0, \forall n\in\mathbb{N} : \quad \mathbb{E}\left[|X_n|\mathbf{1}_{\left\{|X_n|>a\right\}}\right] &=\int_a^\infty xP_{|X_n|}(dx) \\
&=\frac{2}{\sqrt{\pi}}\int_a^\infty \frac{x}{\sqrt{2\sigma^2(n)}}\cdot e^{-\frac{x^2}{2\sigma^2(n)}}dx  \\ &= \sqrt{\frac{2\sigma^2(n)}{\pi}}\cdot e^{-\frac{a^2}{2\sigma^2(n)}}\end{align*}
It follows that $\left(X_n\right)_{n\geq 0}$ is uniformly integrable if and only if $\left(\sigma^2(n)\right)_{n\geq 0}$ is bounded above.


32-bit Keyboard Hook unexpectedly works in 64-bit apps, but is hanging Outlook

Question: Have been reading a lot about this one and the picture just gets muddier. I have a 32-bit app that installs a KeyboardHook to wait for a global hotkey and wake up. Running it on Win 7 x64 edition I notice it hangs Outlook x64 edition when the hotkey is pressed.
So I did some research and it looks like 32-bit keyboard hooks aren't even supposed to work in 64 bit apps. Time for more testing...
They hotkey works fine in 64-bit notepad, wordpad, and sticky notes. I verified that these are 64-bit apps since they don't have "*32" next to them in Task Manager. Doesn't hang the app and it does what it's supposed to. But wait... a 32-bit hook dll can't be loaded into a 64-bit app, right?
A look at Process Explorer shows the hook dll isn't even loaded into the notepad process! (If I run the 32-bit notepad.exe from WOW64 directory, I can see the dll loaded into the process, so I know I'm using the tools right).
So the Outlook hanging issue might or might not be related, but why is the hook even working at all in 64-bit notepad?
Comment: There are *two* keyboard hook types.  The low-level one doesn't require DLL injection.
Comment: Ok, got WH_KEYBOARD_LL working in the same process. hMod parameter has to be set using GetModuleHandle(NULL). Seemed contrary to the docs but it's working. Thanks for the tip!
Comment: Thanks for that tip. I should look into low level hooking. Currently I'm using SetWindowsHookEx() with WH_KEYBOARD. Now I'm exploring RegisterHotKey() which doesn't seem to require a DLL either.
Comment: Looking into and testing WH_KEYBOARD_LL, it seems that it DOES require dll injection. I can't get the hook to register and numerous references online say that the DLL is required. Ideas?
Answer:
I have a 32-bit app that installs a KeyboardHook to wait for a global hotkey and wake up.

If that's your ultimate goal, then it's simpler and less of an impact on the system to just use RegisterHotKey.


what file systems are compatible with Ubuntu 20.04.2 LTS

Question: I  am looking at buying a large (2TB or larger) external drive for backups and want to know which file formats are supported on Ubuntu 20.04.2 LTS. Alternatively if you know of a drive that is compatible out of the box, it would be helpful
Comment: you should check https://help.ubuntu.com/community/LinuxFilesystemsExplained
Comment: Have you considered a Dropbox subscription? Dropbox integrates very well with Ubuntu "out of the box" and your files will be safer off site.
Answer: If the external drive will be used only by Ubuntu, then stick with the file system you use on the host machine, whether it's ext4, Btrfs, or zfs. Ubuntu supports a lot of file systems for compatibility reasons, but sticking with something that is Linux-specific will save headaches in the future.
Answer: If you need read/write access to this drive from Ubuntu and also Windows, then I believe you are still best to format in ntfs.


What commands the suspend item in system menu really launch?

Question: On my laptop trying to go in sleep mode using the Unity Sleep item (or closing the lid for what it is worth) does not work well (it goes in suspend mode very slowly and after that I am unable to wake the laptop correctly).
When I use a simple sudo pm-suspend everything is working fine and quick.
I thus would like to know exactly what actions are done by Unity when trying to go in sleep mode.
Just for the sake of information I currently use Ubuntu 14.04 on a MacBookPro10,1 (first retina edition) using the integrated graphics card (discrete one, which is an nvidia, is powered off so that suspend and brightness control may be usable) and after booting directly using EFI (using rEFInd and linux kernel efistub).
Answer: systemd-logind manages user sessions in 14.04 (replacing consolekit and upower with login1), the command to used by the system menu to suspend the system is:
dbus-send --system --print-reply --dest=org.freedesktop.login1 /org/freedesktop/login1 "org.freedesktop.login1.Manager.Suspend" boolean:true


How Would I have a button unique add a row to a JTable

Question: I'm wondering how I would add a unique(changing one does't change all of them) row to a JTable with a JButton
final DefaultTableModel mod = new DefaultTableModel();
JTable t = new JTable(mod);
mod.addColumn{"        "};
mod.addColumn{"        "};
JButton b = new JButton
b.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
 //How would I make tf unique by producing a different variable every row if changed
 final JTextField tf = new JTextField();
 final Object[] ro = {"UNIQUE ROW", tf};
 mode.addRow(ro);
 }):
 tf.addActionListener(new ActionListener() {
   public void actionPerformed(ActionEvent e) {
   //s change to an other variable every row added
   String s = tf.getText();
 }):

Comment: If this were my problem and I were seeking help here, I'd take a little time to create and post a [minimal example program](http://stackoverflow.com/help/mcve) since I'd know that this would be the best and quickest way to get folks to fully understand my problem and then help me.
Comment: Also, you seem to be trying to add a JTextField component to a table model's row, and I don't think that you really want to do that since JTable's don't display components per se but rather rendered "copies" of components. And while the same column of each row may share the same "rendered" component, the displayed content is different precisely because the model's data is different. Better for you to more fully describe what you're trying to achieve, and yes, create and post your [mcve](http://stackoverflow.com/help/mcve).
Answer: You seem close, but you don't want to add JTextField's to a table row. Instead add the data it holds. For example:
import java.awt.event.ActionEvent;
import javax.swing.*;
import javax.swing.table.DefaultTableModel;

public class UniqueRow extends JPanel {
   public static final String[] COLS = {"Col 1", "Col 2"};
   private DefaultTableModel model = new DefaultTableModel(COLS, 0);
   private JTable table = new JTable(model);
   private JTextField textField1 = new JTextField(10);
   private JTextField textField2 = new JTextField(10);

   public UniqueRow() {
      add(new JScrollPane(table));
      add(textField1);
      add(textField2);
      ButtonAction action = new ButtonAction("Add Data");
      textField1.addActionListener(action);
      textField2.addActionListener(action);
      add(new JButton(action));
   }

   private class ButtonAction extends AbstractAction {
      public ButtonAction(String name) {
         super(name);
      }

      @Override
      public void actionPerformed(ActionEvent e) {

         // get text from JTextField
         String text1 = textField1.getText();
         String text2 = textField2.getText();

         // create a data row with it. Can use Vector if desired
         Object[] row = {text1, text2};

         // and add row to JTable
         model.addRow(row);
      }
   }

   private static void createAndShowGui() {
      UniqueRow mainPanel = new UniqueRow();

      JFrame frame = new JFrame("UniqueRow");
      frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
      frame.getContentPane().add(mainPanel);
      frame.pack();
      frame.setLocationByPlatform(true);
      frame.setVisible(true);
   }

   public static void main(String[] args) {
      SwingUtilities.invokeLater(new Runnable() {
         public void run() {
            createAndShowGui();
         }
      });
   }
}


How should been set permissions for / , /home etc. freshly after instalation of ubuntu?

Question: i had a problem to boot Ubuntu 11.10 after instalation caused by lack of permissions on freshly set partitions (partitions made by disk utility on live CD). I gave all permissions to all files to any user. How i should set it back to work properly with Ubuntu ?
Answer: What command did you run exactly ? If you ran it recursively you will have to reinstall. If you simply ran sudo chmod 777 /home it can be fixed
sudo chmod 755 /home
sudo chmod 755 /

In the future, rather then changing ownership and permissions of system files, use sudo or gksu
gksu nautilus

See also https://help.ubuntu.com/community/RootSudo


Why did Ubuntu 16.04.2 install the loader on Macbook Pro hard drive despite being told to put it on USB hard drive?

Question: Macbook Pro 12,1 with OS X 10.11.6; installing using Ubuntu 16.04.2-desktop-amd64.iso
Trying to install Ubuntu 16 to a USB hard drive, for use with my Macbook Pro, which I have set up with Boot Camp and Windows 10. So I put the installer on a USB stick, booted using it, and set stuff up in the partition manager as per this photo.

(Why am I adding an EFI partition? Because it had already gone wrong once, and I thought I'd try again, this time taking photos, and wondered whether maybe adding an EFI partition to the USB hard drive would help it decide to do the right thing. Anyway, I'm the one asking the questions here.)
Note device selected for boot loader installation.
I clicked Install Now.

That all seemed in order, so I clicked Continue and let it install. And what ended up happening was that the boot loader was installed on /dev/sda1, and /dev/sdd1 was left blank.
This made a bit of a mess:

Switch on with USB hard drive connected: Ubuntu boot menu appears, with an option for Ubuntu and an option for Windows 10 (which works). No sign of OS X
Switch on with USB hard drive disconnected: grub text console. I don't know how to use this, because when I typed help I got several pages of output that immediately scrolled away and I decided life was too short
Switch on while holding Alt: standard Apple boot menu appears, allowing selection of OS X and Windows as before. But even when USB hard drive is connected, there's no sign of Ubuntu

It's fairly easy to remove the loader (mount EFI partition and remove the ubuntu folder there), so now I'm back where I was.
But I'm still a bit confused. What, if anything, did I do wrong? Why did the loader end up on /dev/sda1 rather than /dev/sdd1?
Comment: You did not do anything wrong. Grub only installs to ESP - efi system partition on sda. And you have to manually copy /EFI/ubuntu to flash drive and copy again to /EFI/Boot and rename either shimx64.efi or grubx64.efi to bootx64.efi. External drives in UEFI mode only boot from /EFI/Boot/bootx64.efi (on PCs, not sure about Mac).  And copy of grub in /EFI/ubuntu expects rest of grub files to be in /EFI/ubuntu so copy in /EFI/Boot needs the/EFI/ubuntu to work. Similar bug (was for OEM) https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1414124
Comment: You also probably need to edit fstab with efi mount of flash drive rather than that of ESP on sda. I have both left 3 line grub in /EFI/ubuntu and changed to one line configfile with my PC, again there may be differences with a Mac?
Comment: @oldfred Thanks, that was most helpful. If you want to post that as an answer (since "grub only installs to ESP" answers my main question!) then I'll accept it. I'm going to add an answer with some extra notes anyway, since I've got it working now thanks to your note about needing EFI/ubuntu as well as EFI/Boot.
Comment: Yes, you're quite right, I have `/dev/sda1` mounted as `/boot/efi`. It's mounted by GUID in `/etc/fstab` so that looks like it ought to be an easy fix.
Answer: (This doesn't answer my direct question, but making it work proved more annoying than I expected so I thought I'd post some notes.)
In the end I seem to have got it working to my satisfaction. Armed with the ubuntu folder that the installer had added to my Macbook's EFI partition, my USB hard drive with an empty EFI partition, and @oldfred's comments, I filled the USB hard drive's EFI partition as follows:

make folder in root of empty EFI partition called EFI
copy ubuntu folder (that the installer added) into the new EFI folder
make folder in EFI called Boot
move EFI/ubuntu/grubx64.efi and EFI/ubuntu/MokManager.efi into EFI/Boot
move EFI/ubuntu/shimx64.efi into Boot, and rename it to BOOTx64.EFI
Edit EFI/ubuntu/grub.cfg, find the search.fs_uuid line, and remove the device specifier from the end (so it reads just search.fs_uuid <<GUID>> root).

My USB disk then appears in the Apple boot menu when it's connected. And when selected, it brings up the usual boot menu, and I can select Ubuntu and off it goes.
As a final step, once up and running, I edited /etc/fstab to mount the USB disk's EFI partition, rather than the MBP's.
(I don't know whether step 6 is vital, and I don't know whether these file names are case-sensitive. This took numerous reboots and I don't fancy doing much more additional experimentation.)


Laravel 5.8 error 500 uploaded in shared hosting cpanel

Question: I uploaded a laravel-5.8 project to a shared hosting cpanel.
The problem is when I access index.php it gives me an error 500.
Here is my project directory
I didn't transfer the public folder yet. but it should work when access.
stage.example.com/public/ instead it displays error 500.

I changed the database credentials.
I haven't changed the path in index.php since I didn't move the public folder yet.
path:index.php
I tried putting phpinfo.php in the root folder to check the requirements for laravel 5.8 all of this was met, except for the PHP version, according to phpinfo, PHP version is 5.6. but when I checked under myphpadmin>web server the PHP version is 7.2.7.
PHP >= 7.1.3
BCMath PHP Extension
Ctype PHP Extension
JSON PHP Extension
Mbstring PHP Extension
OpenSSL PHP Extension
PDO PHP Extension
Tokenizer PHP Extension
XML PHP Extension

I hope someone can help I wanted to run my laravel5.8 project in Cpanel.
Comment: Post your Laravel log here locate at `storage\logs`
Comment: @Ivan logs has permissions 0644. is this what you meant? Thanks!
Comment: No, I mean you should post your laravel log (content of this file) here.
Answer: I have answered this question in another post. Have a look at it and see if helps:
 What is the easiest and quickest method to deploy a Laravel web application live?
Answer:
I tried putting phpinfo.php in the root folder to check the requirements for laravel 5.8 all of this was met, except for the PHP version, according to phpinfo, PHP version is 5.6. but when I checked under myphpadmin>web server the PHP version is 7.2.7

I have no idea what "myphpadmin" is, anyway since you're running PHP 5.6 Laravel can't work.
In cPanel you should have an option to select the PHP version, select the latest available, 7.3 if your cPanel is updated.
Comment: Thanks! issue resolved the problem is within my htaccess apparently i have to specify that i am using php version 7.1 up.
Answer: If you have blank page maybe you need to change the path to the autoload.php file in index.php. This file is in vendor folder.
Change :
require __DIR__.'/bootstrap/autoload.php';

by
require __DIR__.'/vendor/autoload.php';


Separate column into three columns with grouping

Question: I have a column with Full names that should be separated into three columns just by spaces. The problem is that some full names contains more than three words, and 4-th and other words shouldn't be omitted, but added to third part.
For instance, "Abdullaeva Mehseti Nuraddin Kyzy" should be separated as:
| Abdullaeva | Mehseti | Nuraddin Kyzy |

I tried to split column with (tidyr) package as follow, but in this way 3d part contains only 1 word after second space.
df<-df %>%
    separate('FULL_NAME', c("1st_part","2d_part","3d_part"), sep=" ")

Any help will be appreciated.
Comment: How do we know which way to group?
Comment: Please provide reproducible example
Comment: Do you have always `name1 name2 fname lname`  and you want `| name1 | name2 | fname lname |` ?
Comment: @shA.t, At almost most situation,yes, but I suppose it is possible situation, where I should group names in other way : `| name1 | name2  name3 | lname |` for another dataset (not in this one)
Comment: @Sotos, based on names count. If names number would be more than four.
Comment: What is the difference between `A |B C| D` and `A | B | C D` ? They both have 4 elements
Comment: @ЕвгенийМ please add more example names, and expected output.
Comment: Polad Bjul' Bjul' Oglý Mamedov splits into `Polad |Bjul Bjul| Ogly Mamedov`. But it's quite rare situation, so it can be done manually. Great thanks for help!
Comment: @Sotos 'A |B C| D E' - if full names contains more than 4 elements, 'A | B | C D' - if full names contains 4 elements.
Answer: Use extra argument:
# dummy data
df1 <- data.frame(x = c(
  "some name1",
  "justOneName",
  "some three name",
  "Abdullaeva Mehseti Nuraddin Kyzy"))

library(tidyr)
library(dplyr)

df1 %>%
  separate(x, c("a1", "a2", "a3"), extra = "merge")
#            a1      a2            a3
# 1        some   name1          <NA>
# 2 justOneName    <NA>          <NA>
# 3        some   three          name
# 4  Abdullaeva Mehseti Nuraddin Kyzy
# Warning message:
#   Too few values at 2 locations: 1, 2

From manual:

extra
If sep is a character vector, this controls what happens when
  there are too many pieces. There are three valid options:
  - "warn" (the default): emit a warning and drop extra values.
  - "drop": drop any extra values without a warning.
  - "merge": only splits at most length(into) times
Comment: @Sotos black magic :D
Comment: What's that `extra = merge` business?
Comment: Hihi...that dates back to the dark ages :) Nice argument  though. Merges all the remaining cols. I wonder if this can be utilized to address not-known number of cols (kind of like cSplit)
Answer: Since for this dataset you said that you only have name1, name2, last name, then you can also use str_split_fixed from stringr, i.e.
setNames(data.frame(stringr::str_split_fixed(df1$x, ' ', 3)), paste0('a', 1:3))

Which gives,

        a1      a2            a3
1        some   name1
2 justOneName
3        some   three          name
4  Abdullaeva Mehseti Nuraddin Kyzy

Note that you can fill the empty slots with NA as per usual


How to verify / troubleshoot AVD debug key

Question: I'm trying the HelloMapView example found here: http://developer.android.com/guide/tutorials/views/hello-mapview.html
Problem I'm having is that when I run my application, none of the map tiles will load... I heard this is usually do to my google maps api key not being correct. I tried signing my app with a key that I generated from google, but the application still wouldn't load the tiles into the map. I can zoom and effect other features of the map, everything except for actually loading the tiles. I was reading that the eclipse (which I'm using) will automatically generate a key for you, but that's not happening. Any suggestions on how to troubleshoot this problem? Thanks!
Answer: You should get an api-key for your debug key.

Go to http://code.google.com/android/maps-api-signup.html
Run keytool -list -keystore ~/.android/debug.keystore from a shell
Paste your Certificate fingerprint in the link
Add the api-key to your layout. it should look like this.


How do you breed the Legendary monster?

Question: There is a quest in the game to acquire the Legendary monster.  Description:

Legendary
Find and hatch the mysterious Legendary monster, master of the elements!

If you want to breed it, what combination of monsters do you use?
Comment: I see you saw the dragonvale clone too
Comment: Indeed.  Check the wiki description I wrote for it.
Comment: I have made a combination of all of the monsters to try and find the legendary monster.... First I did plant and earth, then with the child of that I combined it with fire, and then I combined that child with the ice monster, and now I'm gonna mix the child of that with the electric and see what happens. I doubt my method will work though. :(
Comment: Well do far I've Just got the fire plant and mountain to breed and I'll see how they do. To get the mountain you have to breed earth and ice monsters and for the fire plant you have to breed fire and plant monsters. I hope that helps and I'll get back to you on how it turns out.
Answer: It has been confirm here and here that breeding Flower and Mountain has a rare chance to produce the legendary monster.  The first link involves a screen cap of the park and the second link includes a video, so I'm going to consider this definitive proof.  Since this combination is Fire/Plant + Earth/Plant it appears that previous theories about involving all elements are incorrect.  You do need to be level 22 to buy the habitat that the Legendary Monster lives in.
Answer: You have to be on to level 22 to be able to hatch the legendary monster.
To hatch the monster you have to:

Be on level 22
Breed a teenage plant and an adult earth.

Then you will get a legendary monster.
Answer:
You have to be level 22
Breed a teenage plant with an adult earth
Comment: Welcome to the site Francis!  Can you edit your answer to add a link to the source for the level 22 requirement?
Answer: I got the legendary and the combos have to have the types plant and earth.
Comment: Hi Pat, welcome to the site.  Due the amount of speculation on this monster, could you please site a source or at least provide some proof that you have the monster?  It is easy with any Apple device to take a screen shot, simple press the square "home" button and the top "lock" button at the same time.  Then when you connect the device to your computer you can copy over the pictures from whichever device you are using (iPhone, iPad, iPod Touch, etc).
Answer: Elements are earth electric ice fire get a hatching that will have all these Elements and you got your mystery monster
Comment: This is true but you missed some elements my friend

How do you breed the Legendary monster?


Why is it removing CUDA when I am removing mate desktop?

Question: I am trying to remove mate desktop and get
$ sudo apt-get remove --auto-remove mate-desktop
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package 'mate-desktop' is not installed, so not removed
The following packages will be REMOVED:
  cuda-11-0 cuda-command-line-tools-11-0 cuda-compiler-11-0 cuda-cudart-11-0
  ...

But why is it removing irrelevant libraries?
Answer: From the output of man apt-get under the --autoremove option:

If the command is either install or remove, then this option acts like running the autoremove command, removing unused dependency packages.

Those cuda packages were just waiting for an autoremove to come along, nothing to do with the Mate Desktop.  So the real question was did you really want to remove them?  Intel tends to hook all sorts of dependencies on their cuda packages, like depending upon the Nvidia driver package (which may be old), so when that get replaced, bingo -- all sorts of unwanted removes and autoremoves may gets triggered.


How to set up NAT and Host-Only networking with static IP address in VirtualBox

Question: I am trying to set up a set of guests in VirtualBox, such that each of them can access the Internet as well as be visible to each other and to the host. I also want the guests to have static IP addresses.
Here's the procedure that I have followed so far:

Switch off the DHCP Server feature of the Host-Only network to be used in this setup
Change the IP address assigned to the host to 192.168.56.254
Create a guest machine with 2 networking interface cards (NIC)
Configure the 1st NIC to use NAT
Configure the 2nd NIC to use Hot-Only Networking
Install the OS (Ubuntu Server 13.10) on each of them
Update the OS
Configure the networking as follows by editing /etc/network/interfaces

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

auto eth1
iface eth1 inet static
address 192.168.56.1
netmask 255.255.255.0
network 192.168.56.0
broadcast 192.168.56.255
gateway 192.168.56.254
dns-search cloudspace.local
dns-nameservers 126.96.36.199 18.104.22.168

Save the file
Reboot

When the guest boots up again, the Host-Only networking is working fine. The host/guest and guest/guest pairs of machines can ping each other, however the Internet isn't working as apt-get fails.
If I then issue a service networking restart command, the networking begins to work as it should.
What am I doing wrong?
I have tried switching the order in which the NICs appear in the /etc/network/interfaces file. I have also swapped the NAT/Host-Only Network around between the 2 NICs. Nothing worked.
The host is Windows 8.1 and the guest is Ubuntu Server 13.10. I have tried the same on Mac OS X with similar results.
I would greatly appreciate any help in this.
Update:
I have included the output from the following commands below, to help in diagnostics:

cat /etc/network/interfaces
ifconfig -a
route -n

$ cat /etc/network/interfaces
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

auto eth1
iface eth1 inet static
address 192.168.56.1
netmask 255.255.255.0
network 192.168.56.0
broadcast 192.168.56.255
gateway 192.168.56.254

$ ifconfig -a
eth0      Link encap:Ethernet  HWaddr 08:00:27:75:47:64
          inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe75:4764/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2 errors:0 dropped:0 overruns:0 frame:0
          TX packets:10 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1180 (1.1 KB)  TX bytes:1332 (1.3 KB)

eth1      Link encap:Ethernet  HWaddr 08:00:27:93:98:d8
          inet addr:192.168.56.1  Bcast:192.168.56.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe93:98d8/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:140 errors:0 dropped:0 overruns:0 frame:0
          TX packets:225 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:14418 (14.4 KB)  TX bytes:27378 (27.3 KB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:16 errors:0 dropped:0 overruns:0 frame:0
          TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:1184 (1.1 KB)  TX bytes:1184 (1.1 KB)

$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.56.254  0.0.0.0         UG    0      0        0 eth1
10.0.2.0        0.0.0.0         255.255.255.0   U     0      0        0 eth0
192.168.56.0    0.0.0.0         255.255.255.0   U     0      0        0 eth1

Update 2:
After I execute sudo service networking restart, the output from route -n becomes:

$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         10.0.2.2        0.0.0.0         UG    0      0        0 eth0
10.0.2.0        0.0.0.0         255.255.255.0   U     0      0        0 eth0
192.168.56.0    0.0.0.0         255.255.255.0   U     0      0        0 eth1

So how do I ensure this configuration on boot?
Answer: It would be easier to troubleshoot your problem if you posted the results you are getting when trying to ping an external address (like the Google DNS servers you're using), the current network settings, and your routing table.
/sbin/ifconfig -a
/sbin/route -n

Without knowing more this is a bit of a shot in the dark, but my guesses are that either a) you are not getting a DHCP address on eth0, or b) your gateway settings for eth1 are messing with the default route DHCP assigned.
If you're not getting a DHCP address for eth0, it's probably a misconfiguration in VirtualBox (like getting your adapters backwards).
Either way, you don't need a gateway or DNS settings assigned specifically for eth1 since that will be assigned by DHCP on eth0, so I would remove the gateway, dns-search, and dns-nameservers lines from your config.  Your virtual machines will still be able to communicate without a gateway setting if they are on the same network and VirtualBox is set up right.
Edit: To make sure you don't have a gateway on eth1 after a reboot, remove lines from your eth1 block so that it looks like this:
auto eth1
iface eth1 inet static
address 192.168.56.1
netmask 255.255.255.0

When you're done, you won't have any gateway lines in your interfaces file.
Comment: I have edited my answer to show the way your eth1 block should look in the interfaces file.  You don't need the network or broadcast lines, and you shouldn't have the gateway line.  Remove those three.
Comment: I have added the diagnostics as you suggested. I think the correct answer is (b), i.e., the gateway settings for `eth1` are messing with the default route DHCP assigned. Is there a solution to this?
Answer: I came up with thissolution, which is the same as @jkt123's answer, and @Umar's question, but shorter. I'd appreciate feedback on it!
In virtualbox, enable both NAT and host-only networks. (BTW: It works on my win7 host. I don't know how to do that in linux host).
On the host - find the "host-only" interface's ip
ipconfig /all     # for windows host
ifconfig -a       # for linux host

In the guest, edit /etc/network/interfaces. The trick was reversing the order  eth1 (host-only) comes BEFORE eth0 (internet/dhcp). I don't know why.
auto lo                        # keep the original loopback settings
iface lo ...                   # yeah, i don't remember, just keep it.

# ----> Ok, this is my addition <-----
auto eth1
allow-hotplug eth1             # i think hotplug it helps. not sure.
iface eth1 inet static
address 192.168.56.100         # arbitrary IP address between 2 and 254

auto eth0                      # This is the original content
iface eth0 inet dhcp           #  of this file, now at the end.

reboot.
Answer: First of all, I enabled both networks NAT with DHCP and host only network with static ip add 192.168.40.41.
Then, I followed with this command :
nano cat /etc/network/interfaces

I obtained this result:
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

auto eth1
iface eth1 inet static
address 192.168.41.4
netmask 255.255.255.0

And before rebooting, I typed the following command:
sudo service networking restart

Then rebooted.
After I loaded to VM VirtualBox, both networks are working. I can connect to internet and I can connect to 192.168.40.41 through a web browser.
I hope this will be helpful
to get nano editor:
sudo apt-get update
sudo apt-get install nano

Then just type nano in terminal to start it.
Answer: You have multiple default gateways assigned to different NICs. In general, "Default" means a preselected option. In this case, if a specified default gateway is defined to both NICs, it would not be a preselected option. In addition, this would also result in communication issues such as Asynchronous routing. I'm not sure how the Metric of both interfaces is set to 0, but it may be due to having both NICs with gateways. Microsoft's write-up about this is located here and the Metric feature has a number of factors that provide how it is determined for setting priorities. (Link: https://support.microsoft.com/en-us/help/299540/an-explanation-of-the-automatic-metric-feature-for-ipv4-routes)
In agreement to @jkt123 in the answered response, there is only 1 default gateway that should be assigned.
Answer: I've tried to set it by configuring /etc/network/interfaces but didn't work,
Then I'd read about netplan then set my ip address in  /etc/netplan/00-installer-config.yaml
# This is the network config written by 'subiquity'
network:
  ethernets:
    enp0s10:
      dhcp4: true
    enp0s3:
      dhcp4: true
    enp0s8:
      dhcp4: true
    enp0s9:
      addresses:
      - 192.168.57.3/24
      nameservers: {}
  version: 2

It'd worked


can we store fadeOut method in a variable

Question: i have a jquery slider function and i want to customize it. my requirement is i want store fadeout effect in variable but i am not getting any idea. i spent some time on the internet to find out the solutions but not reaching up to the solutions. so there is any solutions regarding this. if yes please let me know it will be very helpful for me.
var mYname=fadeOut(500)

or
if (option[12]/*prevNext*/) eA[fadeOpacity ? 'fadeIn' : 'fadeOut' ](fadetime);

Comment: why you need to save fadeOut anyway, since you can call it anytime you want?
Comment: i want to fadeOut in slow mode, and my i want to change it in this line if (option[12]/*prevNext*/) eA[fadeOpacity ? 'fadeIn' : 'fadeOut(1000)' ](fadetime); but it is not working
Answer: you don't have to save the fadeOut function in a variable if your requirement is only for that line,
so you can change your line to
if (option[12]/*prevNext*/) fadeOpacity ? fadeIn(fadetime) : fadeOut(fadetime);

or if you want to store the function in a variable, then you just have to assign the function name to the variable. The way you were doing in the question will call the function and will assign the return value to the variable, instead you can do it as
var mYname=fadeOut;

and then you can use it to call like
mYname(500);


AmCharts AmMap - Set starting location for zoom actions

Question: I would like to use the "zoomToMapObject" method based on a selection on a dropdown menu.
For some reason the start zoom location is the middle of the map and not the set the geoPoint.
(The zooming works but the start location make it look a bit weird.)
My current approach looks like this:
const duration = this.chart.zoomToMapObject(selectedPoloygon, this.countryZoom, true).duration;
    setTimeout(() => {
      this.chart.homeGeoPoint = geoPoint;
      this.chart.homeZoomLevel = this.countryZoom;
    }, duration);

this.handleCountrySelection(selectedPoloygon);

Somehow even setting the homeGeoPoint / homeZoomLevel doesn't affect next zoom actions.
**UPDATE: Workaround heavy cost (from 1300 nodes to over 9000) **
I examined the problem a step further. It seems the middle point gets set when I push a new mapImageSeries into the map.
My workarround currently is to draw all points on the map and hide them.
Then after I select a country I change the state to visible.
However this approach is very costly. The DOM-Nodes rises from 1300 to ~ 9100.
My other approach with creating them after a country has been selected AND the zoom animation finished was much more
effective. But due to the map starting every time for a center location it is not viable? Or did I do s.th. wrong?
Here is my current code which is not performant:
// map.ts
export class MapComponent implements AfterViewInit, OnDestroy {
    imageSeriesMap = {};

    // ... standard map initialization ( not in zone  of course )

    // creating the "MapImages" which is very costly

    this.dataService.getCountries().forEach(country => {
    const imageSeriesKey = country.id;
    const imageSeriesVal = chart.series.push(new am4maps.MapImageSeries()); // takes arround 1-2 ms -> 300 x 2 ~ 500 ms.
    const addressForCountry = this.dataService.filterAddressToCountry(country.id); // returns "DE" or "FR" for example.
    const imageSeriesTemplate = imageSeriesVal.mapImages.template;
    const circle = imageSeriesTemplate.createChild(am4core.Circle);
    circle.radius = 4;
    circle.fill = am4core.color(this.colorRed);
    circle.stroke = am4core.color('#FFFFFF');
    circle.strokeWidth = 2;
    circle.nonScaling = true;
    circle.tooltipText = '{title}';
    imageSeriesTemplate.propertyFields.latitude = 'latitude';
    imageSeriesTemplate.propertyFields.longitude = 'longitude';
    imageSeriesVal.data = addressForCountry.map(address => {
      return {
            latitude: Number.parseFloat(address.lat),
            longitude: Number.parseFloat(address.long),
            title: address.company
          };
        });
    imageSeriesVal.visible = false;
    this.imageSeriesMap[imageSeriesKey] = imageSeriesVal;
    });

    // clicking on the map
    onSelect(country) {
      this.imageSeriesMap[country].visible = true;
      setTimeout( () => {
          const chartPolygons = <any>this.chart.series.values[0];
          const polygon = chartPolygons.getPolygonById(country);

          const anim = this.chart.zoomToMapObject(polygon, 1, true, 1000);
          anim.events.on('animationended', () => {});
            this.handleCountrySelection(polygon);
          }, 100);

      });
    }

    handleCountrySelection(polygon: am4maps.MapPolygon) {
    if (this.selectedPolygon && this.selectedPolygon !== polygon) {
      this.selectedPolygon.isActive = false;
    }
    polygon.isActive = true;

    const geoPoint: IGeoPoint = {
      latitude: polygon.latitude,
      longitude: polygon.longitude
    };

    this.chart.homeGeoPoint = geoPoint;
    this.chart.homeZoomLevel = this.countryZoom;
    this.selectedPolygon = polygon;
  }
}

Answer: Thanks to your thorough followup I was able to replicate the issue. The problem you were having is triggered by any one of these steps:

dynamically pushing a MapImageSeries to the chart
dynamically creating a MapImage via data (also please note in the pastebind you provided, data expects an array, I had to change that while testing)

In either step, the chart will fully zoom out as if resetting itself. I'm going to look into why this is happening and if it can be changed, so in the meantime let's see if the workaround below will work for you.
If we only use a single MapImageSeries set in advance (I don't particularly see a reason to have multiple MapImageSeries, would one not do?), that eliminates problem 1 from occurring. Asides from data, we can create() MapImages manually via mapImageSeries.mapImages.create(); then assign their latitude and longitude properties manually, too. With that, problem 2 does not occur either, and we seem to be good.
Here's a demo with a modified version of the pastebin:
https://codepen.io/team/amcharts/pen/c460241b0efe9c8f6ab1746f44d666af
The changes are that the MapImageSeries code is taken out of the createMarkers function so it only happens once:
const mapImageSeries = chart.series.push(new am4maps.MapImageSeries());
const imageSeriesTemplate = mapImageSeries.mapImages.template;
const circle = imageSeriesTemplate.createChild(am4core.Circle);
circle.radius = 10;
circle.fill = am4core.color('#ff0000');
circle.stroke = am4core.color('#FFFFFF');
circle.strokeWidth = 2;
circle.nonScaling = true;
circle.tooltipText = 'hi';

In this case, there's no need to pass chart to createMarkers and return it, so I've passed polygon instead just to demo dynamic latitude/longitudes, I also assign our new MapImage to the polygon's data (dataItem.dataContext) so we can refer to it later. Here's the new body of createMarkers:
function createMarkers(polygon) {
  console.log('calling createMarkers');

  if ( !polygon.dataItem.dataContext.redDot) {
    const dataItem = polygon.dataItem;

    // Object notation for making a MapImage
    const redDot = mapImageSeries.mapImages.create();
    // Note the lat/long are direct properties
    redDot.id = `reddot-${dataItem.dataContext.id}`;
    // attempt to make a marker in the middle of the country (note how this is inaccurate for US since we're getting the center for a rectangle, but it's not a rectangle)
    redDot.latitude = dataItem.north - (dataItem.north - dataItem.south)/2;
    redDot.longitude = dataItem.west - (dataItem.west - dataItem.east)/2;;
    dataItem.dataContext.redDot = redDot;
  }

}

There's no need for the animationended event or anything, it just works since there is no longer anything interfering with your code. You should also have your performance back.
Will this work for you?
Original answer prior to question's edits below:

I am unable to replicate the behavior you mentioned. Also, I don't know what this.countryZoom is.
Just using the following in a button handler...
chart.zoomToMapObject(polygon);

...seems to zoom just fine to the country, regardless of the current map position/zoomLevel.
If you need to time something after the zoom animation has ended, the zoomToMapObject returns an Animation, you can use its 'animationended' event, e.g.
const animation = this.chart.zoomToMapObject(selectedPoloygon, this.countryZoom, true);
animation.events.on("animationended", () => {
    // ...
});

Here's an example with all that with 2 external <button>s, one for zooming to USA and the other Brazil:
https://codepen.io/team/amcharts/pen/c1d1151803799c3d8f51afed0c6eb61d
Does this help? If not, could you possibly provide a minimal example so we can replicate the issue you're having?
Comment: I have reproduced a minimal example. Insert this JavaScript code in your codepen and click on the buttons. You will notice that it will start zooming everytime from the center of the map.

https://pastebin.com/ipa1H4zf

Thanks for your help so far :).
Comment: works great thanks for the workarround. I do not know why my edits have been removed in stackblitz. Sorry for that.
Comment: @MadScientisto Hey the Stackblitz example is like a bare angular example or something, but I'll check out your pastebin just now.


Adding Aspnet Identity 2 to Code First EF model

Question: I am using Entity Framework with the Code First approach. I created a MVC app and 'registered' and it generated all of the AspNet tables.
I would like to have a AspNetUsers model so one of my other models can reference it.
I have tried adding a mapping like the below but I am still getting the There is already an object named 'AspNetUsers' in the database. error.
AspNetUser.cs
   public class AspNetUser
    {
        public string Id { get; set; }
        public string Email { get; set; }
        public bool EmailConfirmed { get; set; }
        public string PasswordHash { get; set; }
        public string SecurityStamp { get; set; }
        public string PhoneNumber { get; set; }
        public bool PhoneNumberConfirmed { get; set; }
        public bool TwoFactorEnabled { get; set; }
        public DateTime? LockoutEndDateUtc { get; set; }
        public bool LockoutEnabled { get; set; }
        public int AccessFailedCount { get; set; }
        public string UserName { get; set; }
    }

Mapping
 public class AspNetUserMap : EntityTypeConfiguration<AspNetUser>
    {
        public AspNetUserMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            this.Property(t => t.Id)
                .IsRequired()
                .HasMaxLength(128);

            this.Property(t => t.Email)
                .HasMaxLength(256);

            this.Property(t => t.UserName)
                .IsRequired()
                .HasMaxLength(256);

            // Table & Column Mappings
            this.ToTable("AspNetUsers");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.Email).HasColumnName("Email");
            this.Property(t => t.EmailConfirmed).HasColumnName("EmailConfirmed");
            this.Property(t => t.PasswordHash).HasColumnName("PasswordHash");
            this.Property(t => t.SecurityStamp).HasColumnName("SecurityStamp");
            this.Property(t => t.PhoneNumber).HasColumnName("PhoneNumber");
            this.Property(t => t.PhoneNumberConfirmed).HasColumnName("PhoneNumberConfirmed");
            this.Property(t => t.TwoFactorEnabled).HasColumnName("TwoFactorEnabled");
            this.Property(t => t.LockoutEndDateUtc).HasColumnName("LockoutEndDateUtc");
            this.Property(t => t.LockoutEnabled).HasColumnName("LockoutEnabled");
            this.Property(t => t.AccessFailedCount).HasColumnName("AccessFailedCount");
            this.Property(t => t.UserName).HasColumnName("UserName");
        }
    }

DbContext
public class MovieContext : DbContext
    {
        public MovieContext() : base("DatabaseName")
        {
            Database.SetInitializer(new MigrateDatabaseToLatestVersion<MovieContext, Migrations.Configuration>("DatabaseName"));
        }

        public DbSet<Movie> Movies { get; set; }
        public DbSet<Genre> Genres { get; set; }
        public DbSet<Log> Logs { get; set; }
        public DbSet<AspNetUser> Users { get; set; }
        public DbSet<Tracking> Tracking { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Configurations.Add(new AspNetUserMap());
            modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
        }

UPDATE:
I think I am asking the question in the wrong way.
Basically how can I do this:
public class Tracking
{
    public int TrackingId { get; set; }
    public Guid UserId { get; set; } <--This needs to be the ID in the AspNetUsers table
    public ICollection<Movie> MovieId { get; set; }
}

Comment: You don't need DbSet for ApsNetUser - that is handled by IdentityDbContext. I've had no issues customizing my derived class.
Comment: You should do something like: public class ApplicationUser : IdentityUser { } http://www.codeproject.com/Articles/790720/ASP-NET-Identity-Customizing-Users-and-Roles
Comment: The easiest thing would probably be to derive your DbContext from IdentityDbContext where ApplicationUser derives from IdentityUser. http://stackoverflow.com/questions/20104289/foreign-key-to-microsoft-aspnet-identity-entityframework-identityuser
Answer: I have not had any success customizing the schema for the identity entity using code first. I ended up modifying the migration code that EF generated instead, and just make sure not to run add-migration Initial -force without doing a careful merge. This also allowed me to change the clustered index to a datetime2 column, getting around the horrible performance problems of keeping a clustered index on a guid.
Edit: If you are trying to change the type of the primary key for the user entity, you'll need to extend the IdentityUser type with your key choice (in this case Guid), which will then necessitate extending the rest of the generic entity types to Guid keys for the user as well. There's a great article on doing this - he uses an integer, but the same pattern would be used for a guid key.
Alternatively, you could expose a computed property on the user entity that parsed the string Id into a guid, since that is
Comment: I don't want to customize the schema, please see my update on my original post.
Comment: Then what is the purpose of your mapping?


keycloak connect backend systems with oauth2

Question: I would like to secure our web services and would like to know if I have understand the concept and how to implement this in keycloak. We have 2 backend systems A and B and keycloak as oauth2 provider. System A consumes services on system B.

I would like to let system A requests an access token from keycloack with client credentials flow, because this is an backend request only.
System A sends the request to system B along with this access token
System B checks the access token against keycloak
System B sends actual service response if token check has passed or an appropriate failure message.

Is that a good approach and how can we implemnt this in keycloak?
Answer: You have three types of access types with keycloak

public
confidential
bearer-only

More information can be found here
https://www.keycloak.org/docs/latest/server_admin/index.html
If Your System A is accessed by other client facing UI then implement System A and System B as bearer-only clients.


Specifying the JSON names in response

Question: I want to be able to specify the names used in the JSON response from my server.
I have the following code:
@RequestMapping(value = "/accounts/search/forSearchPage", method = RequestMethod.GET)
public ResponseEntity<PagedResources<Resource<Object>>> searchForFeaturedContent() {
    List<Account> nearbyAccounts = accountService.findClosestNearbyAccounts();
    List<Account> onlineAccounts = accountService.findOnlineAccounts();
    Pageable pageable = new PageRequest(0, 10);
    Page<Place> places = placeService.findTop10ByFeaturedTrue(pageable);
    List<Place> placesList = places.getContent();

    List<Object> accountsAndPlaces = new ArrayList<>();
    accountsAndPlaces.addAll(nearbyAccounts);
    accountsAndPlaces.addAll(onlineAccounts);
    accountsAndPlaces.addAll(placesList);

    // Create page out of this list
    Page<Object> pageOfAccountsAndPlaces = new PageImpl<>(accountsAndPlaces, pageable, accountsAndPlaces.size());
    return new ResponseEntity<>(objectPagedAssembler.toResource(pageOfAccountsAndPlaces), HttpStatus.OK);
}

This returns a response like this:
{
"_embedded" : {
    "places" : [...],
    "accounts" : [...],
    "_links" : {
    "self" : {
        "href" : "http://staging-api.papped.co/accounts/search/forSearchPage"
    }
},
"page" : {
    "size" : 10,
    "totalElements" : 10,
    "totalPages" : 1,
    "number" : 0
}

This groups all the accounts together and sticks them under the name "accounts". However, I  want to change it to look something like:
{
"_embedded" : {
    "places" : [...],
    "nearbyAccounts" : [...],
    "onlineAccounts" : [...], // <- See how these have been separated
    "_links" : {
    "self" : {
        "href" : "http://staging-api.papped.co/accounts/search/forSearchPage"
    }
},
"page" : {
    "size" : 10,
    "totalElements" : 10,
    "totalPages" : 1,
    "number" : 0
}

How can I do that??
Answer: what is happening is that you are inadvertently concatenating the two  Account List together when you add them onto the accountsAndPlaces List.
Replace:
List<Account> nearbyAccounts = accountService.findClosestNearbyAccounts();
List<Account> onlineAccounts = accountService.findOnlineAccounts();

With:
List<NearByAccounts> nearbyAccounts = accountService.findClosestNearbyAccounts();
List<OnlineAccounts> onlineAccounts = accountService.findOnlineAccounts();

You will have to create the two new classes as well:
public class NearByAccount extends Account {}

public class OnlineAccounts extends Account {}

Comment: For some reasons the paged assembler treats them all as Accounts still and not separate classes, so this didn't work for me :/
Answer: A simple way is to declare a class which will be serialized as expected.
public class MeaningfulNameHere {
    Collection<Account> nearbyAccount;
    Collection<Account> onlineAccount;
    Collection<Place> places;

    /* constructors and getters */
}

Instead of putting list of objects, return an instance of the given class. Depending on your serialization library you may need to add some anotations on your new type. Most probably, yours is Jackson and.will work as it.
Comment: How would this be made into a page?

Specifying the JSON names in response


Cadence IUS simulator options

Question: What is the difference between -INcdir and +incdir+ options in NC simulator?
Below is the example command from the Makefile. As far as I know the testbench directories are included using -INcdir and  the source code file directories are included using +incdir+ command
ncvlog -SV -INcdir ../include -INcdir ../src -64bit ../src/top.sv ../src/test.sv;
ncelab ncelab.log top +incdir+../../../sv/src +incdir+../../../sv/include

Please help me to understand the the significance of these options.
Comment: Testbench files are also source code files.
Comment: @TudorTimi Yes , but testbench files won't be encrypted like the BFM or Monitor files, so I described these as source files.
Answer: They both mean the same thing. The original Verilog simulator used arguments of the type +incdir+ to specify include paths. The options still exist for legacy reasons. You'll notice other tools also provide +incdir+, for the same reason.
Answer: I agree with Tudor. They actually mean the same thing.
The +incdir+arg is replaced with ncvlog -incdir arg, the same way in which +define+arg is replaced with ncvlog -define arg.
It is referred to as "Plus" option translation in the Cadence NC-Verilog Simulator user guide.

Cadence IUS simulator options


Composable State from Jetpack Compose execute these two states once or twice

Question: I got a two states for handling a dynamic pop up screen component
var showPopUpScreen by remember { viewModel.popUpScreenIsOpen }
var popUpType by remember { viewModel.popUpScreenType }

but when I change the value of these mutableState-values when opening the pop up component
like this:
fun OpenPopUpScreen(type: BasePopUpScreen) {
    popUpScreenType.value = type
    popUpScreenIsOpen.value = true
}

will this composable function get executed twice (which is performance heavy) or will it be smart enough to know that these values are set at once so execute my pop up render function only once?
Extra code info:
fun LiveTrainingScreen(viewModel: LiveTrainingViewModel = viewModel()) {
// lots of code and then:
        var showPopUpScreen by remember { viewModel.popUpScreenIsOpen }
        var popUpType by remember { viewModel.popUpScreenType }

        //pop up container
        if(showPopUpScreen) {

            Row(modifier = Modifier
                .fillMaxSize()
                .background(Color.Black.copy(alpha = 0.6f))
                .zIndex(11f), verticalAlignment = Alignment.CenterVertically) {
                Column(modifier = Modifier.fillMaxWidth(), horizontalAlignment = Alignment.CenterHorizontally) {

                    DyanmicPopUpScreenLiveTraining(popUpScreenTypeInfo = popUpType, viewModel = viewModel)

                } // pop up main column

            } // end pop up screen row

        } // end if pop up screen
}

Answer: I believe the recomposition starts right after both have changed as the compose guide says:
"Recomposition is optimistic and may be canceled." [source: https://developer.android.com/jetpack/compose/mental-model]
in which means the recomposition will be canceled as the other parameter is assigned and you will see the change in state in UI in means of both values.
However, it is a better approach to save the UI state inside a data class and remember the data class directly. that way, you change both variables and the composition resets as the data class changes. plus, rather than remembering the data class, hoist the state in a ViewModel and you will good to go.
Comment: Yeah I was thinking about doing this, thanks for your reaction. Will do this :D
Answer: I think compose is smart enough to identify the changes and react on it.
As per your question

once you set first value it will start changes compose views which are dependent on it
And suppose considering complex view previous recomposition process is going on, after setting second value previous recomposition will get cancelled and compose will recompose your screen with updated both values.

So effectively we can Recomposition will happen once only.


What does the Ubuntu Firefox Modifications extension to firefox do?

Question: I'm presently running Firefox 3.6.8 on Ubuntu 9.04. My Firefox extensions include Ubuntu Firefox Modifications 0.9rc2. I've upgraded Firefox on this install a few times; as far as I can recall, some version of this extension was present when I initially installed Ubuntu 9.04. I have disabled it, mostly because I didn't know what it provided me, nor was I able to find out when I tried a bit.
What does the extension do?
Comment: This was also asked on superuser http://superuser.com/questions/65104/what-is-this-ubuntu-firefox-modifications-addon-in-ff-3-5-4-in-karmic
Comment: This extension also [disables multiprocess support](https://askubuntu.com/q/865525/298314). This issue appeared to be fixed at some point, but it seems we're back to having it mess with Firefox. Launchpad bug report can be found [here](https://bugs.launchpad.net/ubufox/+bug/1627808). If you type `about:support` into Firefox, you'll get *0/1 (Disabled by add-ons)* in the *Multiprocess Windows* entry.
Answer: It came with xul-ext-ubufox :

Ubuntu-specific configuration defaults and apt support for Firefox.
Adds Ubuntu-specific modifications to Firefox.
Integrates the browser with Ubuntu to:

Enable searching for missing plugins from Ubuntu software catalog
Add the following options to the Help menu:

Get help on-line
Help translating Firefox
Ubuntu Release Notes

Set homepage to Ubuntu Start Page
Display a restart notification after upgrading Firefox
Add ask.com to the search engines.

You can uninstall this if you prefer to use a pristine Firefox install.

Homepage: https://launchpad.net/ubufox
Answer: The files here show some of the changes that Ubufox provides (custom branding, search preferences, etc.)
http://bazaar.launchpad.net/~mozillateam/ubufox/trunk/view/head:/defaults/preferences/ubuntu-mods.js
Comment: It must be really difficult to provide a description, and links to additional resources, and other details, within the extension itself. Open Firefox > Go to Addons > Ubuntu Firefox Modifications > Click "more" > Your description: "Ubuntu Firefox Pack". Powerful stuff.
Comment: @GerardRoche haha felt the same. Whats the worst? It is still the same in 2016. It's over 9000 now.
Answer: It enables Firefox addons to be installed through the package manager.
Comment: According to Synaptic, it also provides some Ubuntu-specific configuration defaults.


What can cause high variability of Untraced Time in App Engine requests?

Question: I just ran a load test against my app.  I noticed some very large variability in latency for two identical requests: 3 s vs. 30 s.  When I dug into the traces I found the following:
|                      | Traced (ms) | Untraced (ms) |
|----------------------+-------------+---------------|
| High-latency Request |         193 |         29948 |
| Low-latency Request  |         305 |          2934 |

Here are screen shots for the traces:
Low overall latency

High overall latency

I cannot make sense of a 10-to-1 difference in runtime performance.
I only see these high-latency requests under load.  Could something in my code account for this variability (assuming the same path through the code was followed for both requests)?
Comment: Do you still see this issue? Are you sure it's the same code path? What is the code in question?
Answer: In my experience, those extraordinarily high latencies are caused by a fresh instance starting up. There was a discussion in the AppEngine Google Group which is about similar issues: https://groups.google.com/d/msg/google-appengine/MBveo1KSTyY/mkYdyCmfAgAJ
Two things you can do:

reduce time it takes an instance to start by reducing overall size of your application (code, libraries, assets) and heavy use of lazy initialization. Using a higher instance class might help too (stronger instances boot up faster)
tweak your scaling options: always have one (or two) idle instances hanging around so there is no need to wait for an instance to boot during traffic peaks

Hope that helps. In my case, using a higher instance class helped a lot already!
Comment: IMHO if this would be true for the request in question the trace would show the RPC calls "squeezed" towards the end of the ~30s timeline as all the calls would be made **after** the new instance starts up (plus it would be obvious from the request logs as those affected by instance startup contain an info log message to that effect). But the trace RPC calls distribution shape is very similar to the one in the low latency case, meaning the request handling is just uniformly slower...
Answer: I had this problem too, google supports suggested to reduce max_concurrent_requests. The hypothesis at that time was the CPU was throttled. After reducing it, the latency gotten better in general. I still wasn't sure what's going on because I didn't expect the application to be using that much CPU. Unfortunately no tool to profile the CPU on GAE to pin point where exactly the CPU intensive part


Enclosing a breezeway between house and garage, (there is an existing roof )

Question: I am in Calif. I would like to enclose my breezeway. At front of house would be solid, possibly a transom window at top. At back yard side of breezeway, a set of French doors with a vinyl window at each side. I can't find anybody to do it for me, so I think I should try it myself.
Although the front of house is lapboard, Iwould like this wall to be stuccoed. Would like to use cement board rather than plywood. Wondering how far back I should place the bottom plate to accommodate thickness of finish materials. Also, since bottom plate will be placed on existing concrete slab, I'd like to use a well recommended caulking under it so water will not creep in.
Comment: You put the bottom plate where you want it and the finish sticks out from there. If you need the finish to be at a specific place, you measure the thickness of the finish material and set the wall back that much. Follow Lee Sam's advice and don't try to line up a new wall with an existing one in a straight plane - it won't end well...
Comment: Stucco on cement board? Ok it will require a more robust frame work and not be as good of a base for stucco. The wire or mesh needs lots of support cement board is not a good idea in my opinion even though it rarely freezes  where I grew up I would use plywood or OSB with a vapor barrier. I can see this not turning out well and the stucco not lasting. Yes I have done stucco in the north Bay Area.
Comment: Don't forget Code requires a 36" wide front door. If you enclose the existing front door, you'll need to add another that's not in the garage.
Answer: Never try to align a new wall with an existing wall, unless you are using the same identical materials.
Your plan calls for different materials, so I'd recommend you step the wall back a few inches so it doesn't look like a mistake.